From cb7c2f9feb5f4d5ed47c1cdadff628b13efd78d1 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sat, 2 Apr 2022 20:51:23 -0400 Subject: [PATCH] Immediate result of tModPorter --- Backgrounds/AstralDesertSurfaceBGStyle.cs | 6 +- Backgrounds/AstralSnowSurfaceBGStyle.cs | 6 +- Backgrounds/AstralSurfaceBGStyle.cs | 6 +- Backgrounds/AstralUndergroundBGStyle.cs | 2 +- Backgrounds/SulphurSeaSurfaceBGStyle.cs | 2 +- Buffs/Alcohol/AlcoholPoisoning.cs | 2 +- Buffs/Alcohol/BloodyMaryBuff.cs | 2 +- Buffs/Alcohol/CaribbeanRumBuff.cs | 2 +- Buffs/Alcohol/CinnamonRollBuff.cs | 2 +- Buffs/Alcohol/EverclearBuff.cs | 2 +- Buffs/Alcohol/EvergreenGinBuff.cs | 2 +- Buffs/Alcohol/FabsolVodkaBuff.cs | 2 +- Buffs/Alcohol/FireballBuff.cs | 2 +- Buffs/Alcohol/GrapeBeerBuff.cs | 2 +- Buffs/Alcohol/MargaritaBuff.cs | 2 +- Buffs/Alcohol/MoonshineBuff.cs | 2 +- Buffs/Alcohol/MoscowMuleBuff.cs | 2 +- Buffs/Alcohol/RedWineBuff.cs | 2 +- Buffs/Alcohol/RumBuff.cs | 2 +- Buffs/Alcohol/ScrewdriverBuff.cs | 2 +- Buffs/Alcohol/StarBeamRyeBuff.cs | 2 +- Buffs/Alcohol/TequilaBuff.cs | 2 +- Buffs/Alcohol/TequilaSunriseBuff.cs | 2 +- Buffs/Alcohol/Trippy.cs | 2 +- Buffs/Alcohol/VodkaBuff.cs | 2 +- Buffs/Alcohol/WhiskeyBuff.cs | 2 +- Buffs/Alcohol/WhiteWineBuff.cs | 2 +- Buffs/CalamityGlobalBuff.cs | 2 +- Buffs/Cooldowns/Withered.cs | 2 +- Buffs/DamageOverTime/AbyssalFlames.cs | 2 +- Buffs/DamageOverTime/AstralInfectionDebuff.cs | 2 +- Buffs/DamageOverTime/BanishingFire.cs | 2 +- Buffs/DamageOverTime/BrimstoneFlames.cs | 2 +- Buffs/DamageOverTime/BurningBlood.cs | 2 +- Buffs/DamageOverTime/CragsLava.cs | 2 +- Buffs/DamageOverTime/CrushDepth.cs | 2 +- Buffs/DamageOverTime/DemonFlames.cs | 2 +- Buffs/DamageOverTime/GodSlayerInferno.cs | 2 +- Buffs/DamageOverTime/HeavyBleeding.cs | 2 +- Buffs/DamageOverTime/HolyFlames.cs | 2 +- Buffs/DamageOverTime/HolyInferno.cs | 2 +- Buffs/DamageOverTime/LethalLavaBurn.cs | 2 +- Buffs/DamageOverTime/ManaBurn.cs | 2 +- Buffs/DamageOverTime/Nightwither.cs | 2 +- Buffs/DamageOverTime/Plague.cs | 2 +- Buffs/DamageOverTime/SagePoison.cs | 2 +- Buffs/DamageOverTime/Shadowflame.cs | 2 +- Buffs/DamageOverTime/ShellfishEating.cs | 2 +- Buffs/DamageOverTime/Shred.cs | 6 +- Buffs/DamageOverTime/SnapClamDebuff.cs | 2 +- Buffs/DamageOverTime/SulphuricPoisoning.cs | 2 +- Buffs/DamageOverTime/Vaporfied.cs | 2 +- Buffs/DamageOverTime/VulnerabilityHex.cs | 2 +- Buffs/DamageOverTime/WeakBrimstoneFlames.cs | 2 +- Buffs/Mounts/AlicornBuff.cs | 2 +- Buffs/Mounts/AndromedaBuff.cs | 2 +- Buffs/Mounts/AndromedaSmallBuff.cs | 2 +- Buffs/Mounts/BrimstoneMount.cs | 2 +- Buffs/Mounts/BumbledogeMount.cs | 2 +- Buffs/Mounts/DoGCartBuff.cs | 2 +- Buffs/Mounts/DraedonGamerChairBuff.cs | 2 +- Buffs/Mounts/GazeOfCrysthamyrBuff.cs | 2 +- Buffs/Mounts/OnyxExcavatorBuff.cs | 2 +- Buffs/Mounts/SquishyBeanBuff.cs | 2 +- Buffs/Mounts/TundraLeashBuff.cs | 2 +- Buffs/Pets/AkatoYharonBuff.cs | 2 +- Buffs/Pets/AstrophageBuff.cs | 2 +- Buffs/Pets/BabyGhostBellBuff.cs | 2 +- Buffs/Pets/BearBuff.cs | 2 +- Buffs/Pets/BendyBuff.cs | 2 +- Buffs/Pets/BloodBound.cs | 2 +- Buffs/Pets/BrimlingBuff.cs | 2 +- Buffs/Pets/ChibiiBuff.cs | 2 +- Buffs/Pets/DaawnlightSpiritOriginBuff.cs | 2 +- Buffs/Pets/DannyDevito.cs | 2 +- Buffs/Pets/FlakPetBuff.cs | 2 +- Buffs/Pets/Fox.cs | 2 +- Buffs/Pets/FurtasticDuoBuff.cs | 2 +- Buffs/Pets/HiveMindPet.cs | 2 +- Buffs/Pets/Kendra.cs | 2 +- Buffs/Pets/LadBuff.cs | 2 +- Buffs/Pets/LeviBuff.cs | 2 +- Buffs/Pets/LittleLightBuff.cs | 2 +- Buffs/Pets/PineappleBuff.cs | 2 +- Buffs/Pets/PlaguebringerBabBuff.cs | 2 +- Buffs/Pets/RadiatorBuff.cs | 2 +- Buffs/Pets/ReaverOrbBuff.cs | 2 +- Buffs/Pets/RotomBuff.cs | 2 +- Buffs/Pets/SCalPetBuff.cs | 2 +- Buffs/Pets/SirenLightPetBuff.cs | 2 +- Buffs/Pets/SparksBuff.cs | 2 +- Buffs/Pets/ThirdSageBuff.cs | 2 +- Buffs/Pets/YharonSonBuff.cs | 2 +- Buffs/Placeables/BlueSpeedCandle.cs | 2 +- Buffs/Placeables/ChaosCandleBuff.cs | 2 +- Buffs/Placeables/CorruptionEffigyBuff.cs | 2 +- Buffs/Placeables/CrimsonEffigyBuff.cs | 2 +- Buffs/Placeables/EffigyOfDecayBuff.cs | 2 +- Buffs/Placeables/PinkHealthCandle.cs | 2 +- Buffs/Placeables/PurpleDefenseCandle.cs | 2 +- Buffs/Placeables/TranquilityCandleBuff.cs | 2 +- Buffs/Placeables/YellowDamageCandle.cs | 2 +- Buffs/PopoBuff.cs | 2 +- Buffs/PopoNoselessBuff.cs | 2 +- Buffs/Potions/AbyssalWeapon.cs | 2 +- Buffs/Potions/AnechoicCoatingBuff.cs | 2 +- Buffs/Potions/ArmorCrumbling.cs | 2 +- Buffs/Potions/ArmorShattering.cs | 2 +- Buffs/Potions/AstralInjectionBuff.cs | 2 +- Buffs/Potions/BaguetteBuff.cs | 2 +- Buffs/Potions/BloodfinBoost.cs | 2 +- Buffs/Potions/BoundingBuff.cs | 2 +- Buffs/Potions/Cadence.cs | 2 +- Buffs/Potions/CalciumBuff.cs | 2 +- Buffs/Potions/CeaselessHunger.cs | 2 +- Buffs/Potions/DraconicSurgeBuff.cs | 2 +- Buffs/Potions/GravityNormalizerBuff.cs | 2 +- Buffs/Potions/HolyWrathBuff.cs | 2 +- Buffs/Potions/Invincible.cs | 2 +- Buffs/Potions/Omniscience.cs | 2 +- Buffs/Potions/PenumbraBuff.cs | 2 +- Buffs/Potions/PhotosynthesisBuff.cs | 2 +- Buffs/Potions/ProfanedRageBuff.cs | 2 +- Buffs/Potions/Revivify.cs | 2 +- Buffs/Potions/ShadowBuff.cs | 2 +- Buffs/Potions/Soaring.cs | 2 +- Buffs/Potions/SulphurskinBuff.cs | 2 +- Buffs/Potions/TeslaBuff.cs | 2 +- Buffs/Potions/TitanScale.cs | 2 +- Buffs/Potions/TriumphBuff.cs | 2 +- Buffs/Potions/YharimPower.cs | 2 +- Buffs/Potions/Zen.cs | 2 +- Buffs/Potions/Zerg.cs | 2 +- Buffs/RancorBurn.cs | 2 +- Buffs/StatBuffs/AbyssalDivingSuitBuff.cs | 2 +- Buffs/StatBuffs/AbyssalDivingSuitPlates.cs | 2 +- Buffs/StatBuffs/AbyssalMadness.cs | 2 +- Buffs/StatBuffs/AdrenalineMode.cs | 2 +- Buffs/StatBuffs/Afflicted.cs | 2 +- Buffs/StatBuffs/AmidiasBlessing.cs | 2 +- Buffs/StatBuffs/AvertorBonus.cs | 2 +- Buffs/StatBuffs/BloodflareBloodFrenzy.cs | 2 +- Buffs/StatBuffs/BloodyBoost.cs | 2 +- Buffs/StatBuffs/BossZen.cs | 2 +- Buffs/StatBuffs/BrimflameFrenzyBuff.cs | 2 +- Buffs/StatBuffs/ChiBuff.cs | 2 +- Buffs/StatBuffs/CosmicFreeze.cs | 2 +- Buffs/StatBuffs/DivineBless.cs | 2 +- Buffs/StatBuffs/ElysianGuard.cs | 2 +- Buffs/StatBuffs/Encased.cs | 5 +- Buffs/StatBuffs/GraxDefense.cs | 2 +- Buffs/StatBuffs/HallowedRuneAtkBuff.cs | 4 +- Buffs/StatBuffs/HallowedRuneDefBuff.cs | 2 +- Buffs/StatBuffs/HallowedRuneRegenBuff.cs | 2 +- Buffs/StatBuffs/IceShieldBuff.cs | 2 +- Buffs/StatBuffs/KamiBuff.cs | 5 +- Buffs/StatBuffs/Molten.cs | 2 +- Buffs/StatBuffs/Mushy.cs | 2 +- Buffs/StatBuffs/PhantomicArmourBuff.cs | 2 +- Buffs/StatBuffs/PhantomicEmpowermentBuff.cs | 4 +- Buffs/StatBuffs/PhantomicRestorationBuff.cs | 2 +- Buffs/StatBuffs/PolarisBuff.cs | 2 +- Buffs/StatBuffs/ProfanedCrystalBuff.cs | 2 +- Buffs/StatBuffs/RageMode.cs | 5 +- Buffs/StatBuffs/ReaverRage.cs | 2 +- Buffs/StatBuffs/ShellBoost.cs | 2 +- Buffs/StatBuffs/SilvaRevival.cs | 2 +- Buffs/StatBuffs/SirenBobs.cs | 2 +- Buffs/StatBuffs/SirenWaterSpeed.cs | 2 +- Buffs/StatBuffs/SpiritGeneratorAtkBuff.cs | 4 +- Buffs/StatBuffs/SpiritGeneratorDefBuff.cs | 2 +- Buffs/StatBuffs/SpiritGeneratorRegenBuff.cs | 2 +- Buffs/StatBuffs/TarraLifeRegen.cs | 2 +- Buffs/StatBuffs/TarragonCloak.cs | 2 +- Buffs/StatBuffs/TarragonImmunity.cs | 2 +- Buffs/StatBuffs/TyrantsFury.cs | 2 +- Buffs/StatBuffs/XerocRage.cs | 2 +- Buffs/StatBuffs/XerocWrath.cs | 2 +- Buffs/StatDebuffs/AndromedaCripple.cs | 2 +- Buffs/StatDebuffs/ArmorCrunch.cs | 2 +- Buffs/StatDebuffs/Clamity.cs | 2 +- Buffs/StatDebuffs/Enraged.cs | 2 +- Buffs/StatDebuffs/Eutrophication.cs | 2 +- Buffs/StatDebuffs/ExoFreeze.cs | 2 +- Buffs/StatDebuffs/ExtremeGrav.cs | 2 +- Buffs/StatDebuffs/ExtremeGravity.cs | 2 +- Buffs/StatDebuffs/FishAlert.cs | 2 +- Buffs/StatDebuffs/FrozenLungs.cs | 2 +- Buffs/StatDebuffs/GlacialState.cs | 2 +- Buffs/StatDebuffs/Irradiated.cs | 2 +- Buffs/StatDebuffs/KamiDebuff.cs | 2 +- Buffs/StatDebuffs/MarkedforDeath.cs | 2 +- Buffs/StatDebuffs/PearlAura.cs | 2 +- Buffs/StatDebuffs/ProfanedWeakness.cs | 2 +- Buffs/StatDebuffs/TemporalSadness.cs | 2 +- Buffs/StatDebuffs/TeslaFreeze.cs | 2 +- Buffs/StatDebuffs/TimeSlow.cs | 2 +- Buffs/StatDebuffs/WarCleave.cs | 2 +- Buffs/StatDebuffs/Warped.cs | 2 +- Buffs/StatDebuffs/WeakPetrification.cs | 2 +- Buffs/StatDebuffs/WhisperingDeath.cs | 2 +- Buffs/StatDebuffs/WitherDebuff.cs | 2 +- Buffs/Summon/AerospecSummonSetBuff.cs | 2 +- Buffs/Summon/ApexSharkBuff.cs | 2 +- Buffs/Summon/AquaticStar.cs | 2 +- Buffs/Summon/AstrageldonBuff.cs | 2 +- Buffs/Summon/AstralProbeBuff.cs | 2 +- Buffs/Summon/AtaxiaSummonSetBuff.cs | 2 +- Buffs/Summon/BelladonnaSpiritBuff.cs | 2 +- Buffs/Summon/BlackHawkBuff.cs | 2 +- Buffs/Summon/BloodClot.cs | 2 +- Buffs/Summon/BloodDragonsBuff.cs | 2 +- Buffs/Summon/BrimstoneWaifu.cs | 2 +- Buffs/Summon/BrittleStar.cs | 2 +- Buffs/Summon/Calamari.cs | 2 +- Buffs/Summon/CalamitasEyes.cs | 2 +- Buffs/Summon/CausticStaffBuff.cs | 2 +- Buffs/Summon/CinderBlossomBuff.cs | 2 +- Buffs/Summon/CloudyWaifu.cs | 2 +- Buffs/Summon/ColdDivinityBuff.cs | 2 +- Buffs/Summon/Corroslime.cs | 2 +- Buffs/Summon/CorvidHarbringerBuff.cs | 2 +- Buffs/Summon/CosmicEnergy.cs | 2 +- Buffs/Summon/CosmicViperEngineBuff.cs | 2 +- Buffs/Summon/CosmilampBuff.cs | 2 +- Buffs/Summon/Crimslime.cs | 2 +- Buffs/Summon/DaedalusGolemBuff.cs | 2 +- Buffs/Summon/DaedalusSummonSetBuff.cs | 2 +- Buffs/Summon/DankCreeperBuff.cs | 2 +- Buffs/Summon/DazzlingStabberBuff.cs | 2 +- Buffs/Summon/DeathstareBuff.cs | 2 +- Buffs/Summon/DemonshadeSetDevilBuff.cs | 2 +- Buffs/Summon/DormantBrimseekerBuff.cs | 2 +- Buffs/Summon/ElementalAxeBuff.cs | 2 +- Buffs/Summon/EndoCooperBuff.cs | 2 +- Buffs/Summon/EndoHydraBuff.cs | 2 +- Buffs/Summon/EyeOfNightBuff.cs | 2 +- Buffs/Summon/FleshOfInfidelityBuff.cs | 2 +- Buffs/Summon/FlowersOfMortalityBuff.cs | 2 +- Buffs/Summon/FrostBlossomBuff.cs | 2 +- Buffs/Summon/FuelCellBundleBuff.cs | 2 +- Buffs/Summon/FungalClumpBuff.cs | 2 +- Buffs/Summon/GammaHeadBuff.cs | 2 +- Buffs/Summon/GastricBelcherBuff.cs | 2 +- Buffs/Summon/GladiatorSwords.cs | 2 +- Buffs/Summon/HauntedDishesBuff.cs | 2 +- Buffs/Summon/HermitCrab.cs | 2 +- Buffs/Summon/Herring.cs | 2 +- Buffs/Summon/HotE.cs | 2 +- Buffs/Summon/HowlTrio.cs | 2 +- Buffs/Summon/IceClasperBuff.cs | 2 +- Buffs/Summon/IgneousExaltationBuff.cs | 2 +- Buffs/Summon/MagicHatBuff.cs | 2 +- Buffs/Summon/Mechworm.cs | 2 +- Buffs/Summon/MidnightSunBuff.cs | 2 +- Buffs/Summon/MountedScannerBuff.cs | 2 +- Buffs/Summon/MutatedTruffleBuff.cs | 2 +- Buffs/Summon/PerditionBuff.cs | 2 +- Buffs/Summon/Phantom.cs | 2 +- Buffs/Summon/PlaguePrincessBuff.cs | 4 +- Buffs/Summon/PlaguebringerSummonBuff.cs | 2 +- Buffs/Summon/PlantationBuff.cs | 2 +- Buffs/Summon/PoleWarperBuff.cs | 2 +- Buffs/Summon/ProfanedBabs.cs | 2 +- Buffs/Summon/RadiantResolutionBuff.cs | 2 +- Buffs/Summon/ResurrectionButterflyBuff.cs | 2 +- Buffs/Summon/RustyDroneBuff.cs | 2 +- Buffs/Summon/SageSpiritBuff.cs | 2 +- Buffs/Summon/Sandnado.cs | 2 +- Buffs/Summon/SandyHealingWaifu.cs | 2 +- Buffs/Summon/SandyWaifu.cs | 2 +- Buffs/Summon/ScabRipperBuff.cs | 2 +- Buffs/Summon/SepulcherMinionBuff.cs | 2 +- Buffs/Summon/ShellfishBuff.cs | 2 +- Buffs/Summon/SilvaSummonSetBuff.cs | 2 +- Buffs/Summon/SiriusBuff.cs | 2 +- Buffs/Summon/SnakeEyesBuff.cs | 2 +- Buffs/Summon/SolarSpirit.cs | 2 +- Buffs/Summon/SolarSpiritGod.cs | 2 +- Buffs/Summon/SoulSeekerBuff.cs | 2 +- Buffs/Summon/StaffOfNecrosteocytesBuff.cs | 2 +- Buffs/Summon/StarSwallowerBuff.cs | 2 +- Buffs/Summon/StatigelSummonSetBuff.cs | 2 +- Buffs/Summon/StormjawBuff.cs | 2 +- Buffs/Summon/TacticalPlagueEngineBuff.cs | 2 +- Buffs/Summon/TundraFlameBlossomsBuff.cs | 2 +- Buffs/Summon/VictideSummonSetBuff.cs | 2 +- Buffs/Summon/VileFeederBuff.cs | 2 +- Buffs/Summon/ViridVanguardBuff.cs | 2 +- Buffs/Summon/VoidConcentrationBuff.cs | 4 +- Buffs/Summon/WaterWaifu.cs | 2 +- Buffs/Summon/WitherBlossomsBuff.cs | 2 +- Buffs/Summon/WulfrumDroidBuff.cs | 2 +- Buffs/Summon/YharonKindleBuff.cs | 2 +- CalPlayer/CalamityPlayer.cs | 2445 +++++++++-------- CalPlayer/CalamityPlayerDrawEffects.cs | 226 +- CalPlayer/CalamityPlayerFishing.cs | 94 +- CalPlayer/CalamityPlayerLifeRegen.cs | 504 ++-- CalPlayer/CalamityPlayerMiscEffects.cs | 1685 ++++++------ CalPlayer/CalamityPlayerNetcode.cs | 100 +- CalPlayer/CalamityPlayerOnHit.cs | 319 +-- CalamityConfig.cs | 20 +- CalamityMod.cs | 6 +- Cooldowns/BloodflareRangedSet.cs | 2 +- Cooldowns/BrimflameFrenzy.cs | 2 +- Cooldowns/ChaosState.cs | 2 +- Cooldowns/CooldownHandler.cs | 14 +- Cooldowns/OmegaBlue.cs | 2 +- Cooldowns/PlagueBlackout.cs | 2 +- Cooldowns/PotionSickness.cs | 2 +- DataStructures/Attunement.cs | 55 +- DataStructures/GemTechArmorState.cs | 19 +- Effects/CalamityShaders.cs | 54 +- Events/BossRushEvent.cs | 13 +- Events/BossRushSky.cs | 4 +- Gores/AstralWaterDroplet.cs | 5 +- ILEditing/ILHelperMethods.cs | 7 +- ILEditing/MechanicILChanges.cs | 14 +- ILEditing/WorldgenILChanges.cs | 2 +- Items/Accessories/Abaddon.cs | 10 +- Items/Accessories/AbyssalAmulet.cs | 10 +- Items/Accessories/AbyssalDivingGear.cs | 19 +- Items/Accessories/AbyssalDivingSuit.cs | 23 +- Items/Accessories/AbyssalMirror.cs | 21 +- Items/Accessories/AeroStone.cs | 12 +- Items/Accessories/Affliction.cs | 14 +- Items/Accessories/AlchemicalFlask.cs | 18 +- Items/Accessories/AlluringBait.cs | 10 +- Items/Accessories/AmalgamatedBrain.cs | 18 +- Items/Accessories/AmbrosialAmpoule.cs | 30 +- Items/Accessories/AmidiasPendant.cs | 10 +- Items/Accessories/AmidiasSpark.cs | 10 +- Items/Accessories/AncientFossil.cs | 16 +- Items/Accessories/AnechoicPlating.cs | 10 +- Items/Accessories/AngelTreads.cs | 22 +- Items/Accessories/AngelicAlliance.cs | 32 +- Items/Accessories/AquaticEmblem.cs | 10 +- Items/Accessories/ArchaicPowder.cs | 19 +- Items/Accessories/AsgardianAegis.cs | 23 +- Items/Accessories/AsgardsValor.cs | 23 +- Items/Accessories/AstralArcanum.cs | 24 +- Items/Accessories/BadgeofBravery.cs | 19 +- Items/Accessories/BlazingCore.cs | 14 +- Items/Accessories/BloodPact.cs | 10 +- Items/Accessories/BloodflareCore.cs | 12 +- Items/Accessories/BloodstainedGlove.cs | 18 +- Items/Accessories/BloodyWormScarf.cs | 20 +- Items/Accessories/BloodyWormTooth.cs | 10 +- Items/Accessories/BloomStone.cs | 66 +- Items/Accessories/BlunderBooster.cs | 19 +- Items/Accessories/Calamity.cs | 14 +- Items/Accessories/CalamityRing.cs | 10 +- Items/Accessories/CelestialJewel.cs | 23 +- Items/Accessories/ChaosAmulet.cs | 17 +- Items/Accessories/ChaosStone.cs | 12 +- Items/Accessories/CheatTestThing.cs | 10 +- Items/Accessories/CoinofDeceit.cs | 19 +- Items/Accessories/CoreOfTheBloodGod.cs | 22 +- Items/Accessories/CorrosiveSpine.cs | 12 +- Items/Accessories/CorruptFlask.cs | 17 +- Items/Accessories/CounterScarf.cs | 10 +- Items/Accessories/CrawCarapace.cs | 12 +- Items/Accessories/CrimsonFlask.cs | 17 +- Items/Accessories/CrownJewel.cs | 12 +- Items/Accessories/CryoStone.cs | 12 +- Items/Accessories/DaawnlightSpiritOrigin.cs | 24 +- Items/Accessories/DaedalusEmblem.cs | 22 +- Items/Accessories/DarkGodsSheath.cs | 18 +- Items/Accessories/DarkSunRing.cs | 25 +- Items/Accessories/DeepDiver.cs | 12 +- Items/Accessories/DeificAmulet.cs | 20 +- Items/Accessories/DepthCharm.cs | 10 +- Items/Accessories/DimensionalSoulArtifact.cs | 20 +- Items/Accessories/DraedonsHeart.cs | 14 +- Items/Accessories/DragonScales.cs | 12 +- Items/Accessories/DukeScales.cs | 10 +- Items/Accessories/DynamoStemCells.cs | 12 +- Items/Accessories/EclipseMirror.cs | 20 +- Items/Accessories/EldritchSoulArtifact.cs | 18 +- Items/Accessories/ElectriciansGlove.cs | 26 +- Items/Accessories/ElementalGauntlet.cs | 20 +- Items/Accessories/ElementalQuiver.cs | 24 +- Items/Accessories/ElysianAegis.cs | 16 +- Items/Accessories/EnchantedPearl.cs | 20 +- Items/Accessories/EtherealExtorter.cs | 10 +- Items/Accessories/EtherealTalisman.cs | 24 +- Items/Accessories/EvasionScarf.cs | 21 +- Items/Accessories/EyeoftheStorm.cs | 10 +- Items/Accessories/FabledTortoiseShell.cs | 12 +- Items/Accessories/FeatherCrown.cs | 26 +- Items/Accessories/FilthyGlove.cs | 18 +- Items/Accessories/FleshTotem.cs | 10 +- Items/Accessories/FrigidBulwark.cs | 21 +- Items/Accessories/FrostBarrier.cs | 12 +- Items/Accessories/FrostFlare.cs | 12 +- Items/Accessories/FungalCarapace.cs | 12 +- Items/Accessories/FungalClump.cs | 10 +- Items/Accessories/FungalSymbiote.cs | 10 +- Items/Accessories/Gehenna.cs | 10 +- Items/Accessories/GiantPearl.cs | 10 +- Items/Accessories/GiantShell.cs | 12 +- Items/Accessories/GiantTortoiseShell.cs | 12 +- Items/Accessories/GladiatorsLocket.cs | 12 +- Items/Accessories/GloveOfRecklessness.cs | 10 +- Items/Accessories/GloveofPrecision.cs | 10 +- Items/Accessories/GodlySoulArtifact.cs | 20 +- Items/Accessories/GrandGelatin.cs | 20 +- Items/Accessories/GravistarSabaton.cs | 10 +- Items/Accessories/HallowedRune.cs | 20 +- Items/Accessories/HarpyRing.cs | 18 +- Items/Accessories/HeartofDarkness.cs | 12 +- Items/Accessories/HeartoftheElements.cs | 24 +- Items/Accessories/HideofAstrumDeus.cs | 10 +- Items/Accessories/HoneyDew.cs | 20 +- Items/Accessories/HowlsHeart.cs | 14 +- Items/Accessories/InkBomb.cs | 10 +- Items/Accessories/IronBoots.cs | 10 +- Items/Accessories/JellyChargedBattery.cs | 21 +- Items/Accessories/Laudanum.cs | 10 +- Items/Accessories/LeadCore.cs | 10 +- Items/Accessories/LeviathanAmbergris.cs | 12 +- Items/Accessories/LifeJelly.cs | 10 +- Items/Accessories/LivingDew.cs | 18 +- Items/Accessories/LumenousAmulet.cs | 19 +- Items/Accessories/LureofEnthrallment.cs | 10 +- Items/Accessories/LuxorsGift.cs | 10 +- Items/Accessories/MagicLevelMeter.cs | 12 +- Items/Accessories/ManaJelly.cs | 10 +- Items/Accessories/ManaOverloader.cs | 10 +- Items/Accessories/MeleeLevelMeter.cs | 12 +- Items/Accessories/MirageMirror.cs | 27 +- Items/Accessories/MomentumCapacitor.cs | 12 +- Items/Accessories/MoonstoneCrown.cs | 18 +- Items/Accessories/MutatedTruffle.cs | 12 +- Items/Accessories/Nanotech.cs | 24 +- Items/Accessories/NebulousCore.cs | 16 +- Items/Accessories/NecklaceofVexation.cs | 17 +- Items/Accessories/NuclearRod.cs | 10 +- Items/Accessories/Nucleogenesis.cs | 22 +- Items/Accessories/OccultSkullCrown.cs | 23 +- Items/Accessories/OceanCrest.cs | 10 +- Items/Accessories/OldDie.cs | 10 +- Items/Accessories/OrnateShield.cs | 19 +- Items/Accessories/PermafrostsConcoction.cs | 10 +- Items/Accessories/PhantomicArtifact.cs | 23 +- Items/Accessories/PlagueHive.cs | 17 +- Items/Accessories/PlaguedFuelPack.cs | 12 +- Items/Accessories/ProfanedSoulArtifact.cs | 22 +- Items/Accessories/ProfanedSoulCrystal.cs | 46 +- Items/Accessories/PsychoticAmulet.cs | 14 +- Items/Accessories/RadiantOoze.cs | 17 +- Items/Accessories/RaidersTalisman.cs | 19 +- Items/Accessories/RampartofDeities.cs | 23 +- Items/Accessories/RangedLevelMeter.cs | 12 +- Items/Accessories/ReaperToothNecklace.cs | 22 +- Items/Accessories/Regenator.cs | 12 +- Items/Accessories/RogueEmblem.cs | 10 +- Items/Accessories/RogueLevelMeter.cs | 12 +- Items/Accessories/RoseStone.cs | 10 +- Items/Accessories/RottenBrain.cs | 10 +- Items/Accessories/RottenDogtooth.cs | 10 +- Items/Accessories/RoverDrive.cs | 10 +- Items/Accessories/RuinMedallion.cs | 18 +- Items/Accessories/RustyMedallion.cs | 17 +- Items/Accessories/SamuraiBadge.cs | 12 +- Items/Accessories/SandCloak.cs | 12 +- Items/Accessories/SandSharkToothNecklace.cs | 18 +- Items/Accessories/ScuttlersJewel.cs | 10 +- Items/Accessories/SeaShell.cs | 12 +- Items/Accessories/ShatteredCommunity.cs | 29 +- Items/Accessories/ShieldoftheOcean.cs | 19 +- Items/Accessories/SigilofCalamitas.cs | 24 +- Items/Accessories/SilencingSheath.cs | 18 +- Items/Accessories/SirensHeart.cs | 10 +- Items/Accessories/SpectralVeil.cs | 14 +- Items/Accessories/SpiritGenerator.cs | 18 +- Items/Accessories/Sponge.cs | 32 +- Items/Accessories/StarTaintedGenerator.cs | 21 +- Items/Accessories/StarbusterCore.cs | 10 +- Items/Accessories/StatMeter.cs | 12 +- Items/Accessories/StatisBeltOfCurses.cs | 21 +- Items/Accessories/StatisBlessing.cs | 22 +- Items/Accessories/StatisCurse.cs | 22 +- Items/Accessories/StatisNinjaBelt.cs | 21 +- Items/Accessories/StressPills.cs | 10 +- Items/Accessories/SummonLevelMeter.cs | 12 +- .../SupremeBaitTackleBoxFishingStation.cs | 26 +- Items/Accessories/TheAbsorber.cs | 42 +- Items/Accessories/TheAmalgam.cs | 26 +- Items/Accessories/TheBee.cs | 10 +- Items/Accessories/TheCamper.cs | 26 +- Items/Accessories/TheCommunity.cs | 14 +- Items/Accessories/TheEvolution.cs | 14 +- Items/Accessories/TheFirstShadowflame.cs | 12 +- Items/Accessories/TheTransformer.cs | 12 +- Items/Accessories/ThiefsDime.cs | 12 +- Items/Accessories/ToxicHeart.cs | 10 +- Items/Accessories/TrinketofChi.cs | 10 +- Items/Accessories/UnstablePrism.cs | 12 +- Items/Accessories/VampiricTalisman.cs | 17 +- Items/Accessories/Vanity/Popo.cs | 12 +- Items/Accessories/VeneratedLocket.cs | 12 +- Items/Accessories/VitalJelly.cs | 10 +- Items/Accessories/VoidofExtinction.cs | 20 +- Items/Accessories/VoltaicJelly.cs | 10 +- Items/Accessories/WifeinaBottle.cs | 10 +- Items/Accessories/WifeinaBottlewithBoobs.cs | 10 +- Items/Accessories/Wings/AureateWings.cs | 21 +- Items/Accessories/Wings/CelestialTracers.cs | 18 +- Items/Accessories/Wings/DiscordianWings.cs | 18 +- Items/Accessories/Wings/DrewsWings.cs | 10 +- Items/Accessories/Wings/ElysianTracers.cs | 19 +- Items/Accessories/Wings/ElysianWings.cs | 12 +- Items/Accessories/Wings/HadarianWings.cs | 18 +- Items/Accessories/Wings/InfinityBoots.cs | 20 +- Items/Accessories/Wings/MOAB.cs | 25 +- Items/Accessories/Wings/SilvaWings.cs | 21 +- Items/Accessories/Wings/SkylineWings.cs | 19 +- Items/Accessories/Wings/SoulofCryogen.cs | 14 +- Items/Accessories/Wings/StarlightWings.cs | 18 +- Items/Accessories/Wings/TarragonWings.cs | 19 +- Items/Accessories/Wings/XerocWings.cs | 17 +- Items/Accessories/WulfrumBattery.cs | 12 +- Items/Accessories/YharimsGift.cs | 14 +- Items/Accessories/YharimsInsignia.cs | 21 +- Items/Ammo/AccelerationBullet.cs | 31 +- Items/Ammo/AcidBullet.cs | 31 +- Items/Ammo/ArcticArrow.cs | 30 +- Items/Ammo/AstralSolution.cs | 16 +- Items/Ammo/BloodRune.cs | 24 +- Items/Ammo/BloodfireArrow.cs | 32 +- Items/Ammo/BloodfireBullet.cs | 32 +- Items/Ammo/ElysianArrow.cs | 31 +- Items/Ammo/EnhancedNanoRound.cs | 31 +- Items/Ammo/FiniteUse/ExplosiveShells.cs | 22 +- Items/Ammo/FiniteUse/GrenadeRounds.cs | 22 +- Items/Ammo/FiniteUse/MagnumRounds.cs | 24 +- Items/Ammo/FlashBullet.cs | 31 +- Items/Ammo/GodSlayerSlug.cs | 33 +- Items/Ammo/HolyFireBullet.cs | 31 +- Items/Ammo/HyperiusBullet.cs | 31 +- Items/Ammo/IcicleArrow.cs | 24 +- Items/Ammo/IcyBullet.cs | 24 +- Items/Ammo/MortarRound.cs | 29 +- Items/Ammo/NapalmArrow.cs | 32 +- Items/Ammo/RubberMortarRound.cs | 29 +- Items/Ammo/SuperballBullet.cs | 31 +- Items/Ammo/TerraArrow.cs | 31 +- Items/Ammo/TerraBullet.cs | 31 +- Items/Ammo/VanquisherArrow.cs | 32 +- Items/Ammo/VeriumBullet.cs | 31 +- Items/AntiCystOintment.cs | 17 +- Items/AntiTumorOintment.cs | 17 +- Items/Armor/AerospecBreastplate.cs | 25 +- Items/Armor/AerospecHat.cs | 23 +- Items/Armor/AerospecHeadgear.cs | 19 +- Items/Armor/AerospecHelm.cs | 23 +- Items/Armor/AerospecHelmet.cs | 23 +- Items/Armor/AerospecHood.cs | 23 +- Items/Armor/AerospecLeggings.cs | 19 +- Items/Armor/AstralBreastplate.cs | 17 +- Items/Armor/AstralHelm.cs | 17 +- Items/Armor/AstralLeggings.cs | 17 +- Items/Armor/AtaxiaArmor.cs | 18 +- Items/Armor/AtaxiaHeadgear.cs | 24 +- Items/Armor/AtaxiaHelm.cs | 24 +- Items/Armor/AtaxiaHelmet.cs | 22 +- Items/Armor/AtaxiaHood.cs | 18 +- Items/Armor/AtaxiaMask.cs | 24 +- Items/Armor/AtaxiaSubligar.cs | 18 +- Items/Armor/AuricTeslaBodyArmor.cs | 31 +- Items/Armor/AuricTeslaCuisses.cs | 31 +- Items/Armor/AuricTeslaHelm.cs | 24 +- Items/Armor/AuricTeslaHoodedFacemask.cs | 24 +- Items/Armor/AuricTeslaPlumedHelm.cs | 20 +- Items/Armor/AuricTeslaSpaceHelmet.cs | 24 +- Items/Armor/AuricTeslaWireHemmedVisage.cs | 24 +- Items/Armor/BloodflareBodyArmor.cs | 17 +- Items/Armor/BloodflareCuisses.cs | 17 +- Items/Armor/BloodflareHelm.cs | 17 +- Items/Armor/BloodflareHelmet.cs | 21 +- Items/Armor/BloodflareHornedHelm.cs | 21 +- Items/Armor/BloodflareHornedMask.cs | 21 +- Items/Armor/BloodflareMask.cs | 21 +- Items/Armor/BrimflameBoots.cs | 19 +- Items/Armor/BrimflameRobes.cs | 22 +- Items/Armor/BrimflameScowl.cs | 25 +- Items/Armor/CirrusDress.cs | 18 +- Items/Armor/DaedalusBreastplate.cs | 18 +- Items/Armor/DaedalusHat.cs | 24 +- Items/Armor/DaedalusHeadgear.cs | 22 +- Items/Armor/DaedalusHelm.cs | 24 +- Items/Armor/DaedalusHelmet.cs | 24 +- Items/Armor/DaedalusLeggings.cs | 18 +- Items/Armor/DaedalusVisor.cs | 18 +- Items/Armor/DemonshadeBreastplate.cs | 18 +- Items/Armor/DemonshadeGreaves.cs | 18 +- Items/Armor/DemonshadeHelm.cs | 20 +- Items/Armor/DesertProwlerHat.cs | 19 +- Items/Armor/DesertProwlerPants.cs | 17 +- Items/Armor/DesertProwlerShirt.cs | 19 +- Items/Armor/FathomSwarmerBoots.cs | 22 +- Items/Armor/FathomSwarmerBreastplate.cs | 22 +- Items/Armor/FathomSwarmerVisage.cs | 26 +- Items/Armor/FearmongerGreathelm.cs | 23 +- Items/Armor/FearmongerGreaves.cs | 19 +- Items/Armor/FearmongerPlateMail.cs | 19 +- Items/Armor/ForbiddenCirclet.cs | 21 +- Items/Armor/GemTechBodyArmor.cs | 22 +- Items/Armor/GemTechHeadgear.cs | 22 +- Items/Armor/GemTechSchynbaulds.cs | 22 +- Items/Armor/GodSlayerChestplate.cs | 17 +- Items/Armor/GodSlayerHelm.cs | 21 +- Items/Armor/GodSlayerHelmet.cs | 21 +- Items/Armor/GodSlayerLeggings.cs | 17 +- Items/Armor/GodSlayerMask.cs | 17 +- Items/Armor/MolluskShelleggings.cs | 17 +- Items/Armor/MolluskShellmet.cs | 17 +- Items/Armor/MolluskShellplate.cs | 17 +- Items/Armor/OmegaBlueChestplate.cs | 21 +- Items/Armor/OmegaBlueHelmet.cs | 21 +- Items/Armor/OmegaBlueLeggings.cs | 21 +- Items/Armor/PlagueReaperMask.cs | 34 +- Items/Armor/PlagueReaperStriders.cs | 20 +- Items/Armor/PlagueReaperVest.cs | 22 +- Items/Armor/PlaguebringerCarapace.cs | 23 +- Items/Armor/PlaguebringerPistons.cs | 77 +- Items/Armor/PlaguebringerVisor.cs | 22 +- Items/Armor/PrismaticGreaves.cs | 27 +- Items/Armor/PrismaticHelmet.cs | 27 +- Items/Armor/PrismaticRegalia.cs | 27 +- Items/Armor/ReaverCuisses.cs | 18 +- Items/Armor/ReaverHeadgear.cs | 26 +- Items/Armor/ReaverHelm.cs | 18 +- Items/Armor/ReaverScaleMail.cs | 18 +- Items/Armor/ReaverVisage.cs | 18 +- Items/Armor/ShroomiteVisage.cs | 16 +- Items/Armor/SilvaArmor.cs | 21 +- Items/Armor/SilvaHelmet.cs | 25 +- Items/Armor/SilvaLeggings.cs | 21 +- Items/Armor/SilvaMaskedCap.cs | 25 +- Items/Armor/SnowRuffianChestplate.cs | 18 +- Items/Armor/SnowRuffianGreaves.cs | 18 +- Items/Armor/SnowRuffianMask.cs | 18 +- Items/Armor/StatigelArmor.cs | 17 +- Items/Armor/StatigelCap.cs | 21 +- Items/Armor/StatigelGreaves.cs | 17 +- Items/Armor/StatigelHeadgear.cs | 21 +- Items/Armor/StatigelHelm.cs | 21 +- Items/Armor/StatigelHood.cs | 23 +- Items/Armor/StatigelMask.cs | 17 +- Items/Armor/SulfurBreastplate.cs | 20 +- Items/Armor/SulfurHelmet.cs | 20 +- Items/Armor/SulfurLeggings.cs | 20 +- Items/Armor/TarragonBreastplate.cs | 19 +- Items/Armor/TarragonHelm.cs | 21 +- Items/Armor/TarragonHelmet.cs | 17 +- Items/Armor/TarragonHornedHelm.cs | 21 +- Items/Armor/TarragonLeggings.cs | 17 +- Items/Armor/TarragonMask.cs | 21 +- Items/Armor/TarragonVisage.cs | 21 +- Items/Armor/TitanHeartBoots.cs | 17 +- Items/Armor/TitanHeartMantle.cs | 17 +- Items/Armor/TitanHeartMask.cs | 17 +- Items/Armor/UmbraphileBoots.cs | 17 +- Items/Armor/UmbraphileHood.cs | 17 +- Items/Armor/UmbraphileRegalia.cs | 17 +- Items/Armor/Vanity/AnahitaMask.cs | 8 +- .../Vanity/AncientGodSlayerChestplate.cs | 10 +- Items/Armor/Vanity/AncientGodSlayerHelm.cs | 10 +- .../Armor/Vanity/AncientGodSlayerLeggings.cs | 10 +- Items/Armor/Vanity/ApolloMask.cs | 8 +- Items/Armor/Vanity/ApronOfAffection.cs | 20 +- Items/Armor/Vanity/AquaticScourgeMask.cs | 8 +- Items/Armor/Vanity/AresMask.cs | 8 +- Items/Armor/Vanity/ArtemisMask.cs | 8 +- Items/Armor/Vanity/AshenHorns.cs | 8 +- Items/Armor/Vanity/AstrumDeusMask.cs | 8 +- Items/Armor/Vanity/AureusMask.cs | 8 +- Items/Armor/Vanity/BrimstoneWaifuMask.cs | 8 +- Items/Armor/Vanity/BumblefuckMask.cs | 8 +- Items/Armor/Vanity/CalamitasMask.cs | 8 +- Items/Armor/Vanity/CalamityHood.cs | 12 +- Items/Armor/Vanity/CalamityRobes.cs | 12 +- Items/Armor/Vanity/CeaselessVoidMask.cs | 8 +- Items/Armor/Vanity/CrabulonMask.cs | 8 +- Items/Armor/Vanity/CryogenMask.cs | 8 +- Items/Armor/Vanity/DesertScourgeMask.cs | 8 +- Items/Armor/Vanity/DevourerofGodsMask.cs | 8 +- Items/Armor/Vanity/DraedonMask.cs | 8 +- Items/Armor/Vanity/GodSlayerHornedHelm.cs | 10 +- Items/Armor/Vanity/GodSlayerVisage.cs | 10 +- Items/Armor/Vanity/HiveMindMask.cs | 8 +- Items/Armor/Vanity/LeviathanMask.cs | 8 +- Items/Armor/Vanity/OldDukeMask.cs | 8 +- Items/Armor/Vanity/PerforatorMask.cs | 8 +- .../Armor/Vanity/PlaguebringerGoliathMask.cs | 8 +- Items/Armor/Vanity/PolterghastMask.cs | 8 +- Items/Armor/Vanity/ProfanedGuardianMask.cs | 8 +- Items/Armor/Vanity/ProvidenceMask.cs | 8 +- Items/Armor/Vanity/RavagerMask.cs | 8 +- Items/Armor/Vanity/SCalBoots.cs | 8 +- Items/Armor/Vanity/SCalMask.cs | 8 +- Items/Armor/Vanity/SCalRobes.cs | 8 +- Items/Armor/Vanity/SignusMask.cs | 8 +- Items/Armor/Vanity/SilvaHelm.cs | 12 +- Items/Armor/Vanity/SilvaHornedHelm.cs | 12 +- Items/Armor/Vanity/SilvaMask.cs | 12 +- Items/Armor/Vanity/SlimeGodMask.cs | 8 +- Items/Armor/Vanity/SlimeGodMask2.cs | 8 +- Items/Armor/Vanity/StormWeaverMask.cs | 8 +- Items/Armor/Vanity/ThanatosMask.cs | 8 +- Items/Armor/Vanity/YharonMask.cs | 8 +- Items/Armor/VictideBreastplate.cs | 16 +- Items/Armor/VictideHeadgear.cs | 16 +- Items/Armor/VictideHelm.cs | 20 +- Items/Armor/VictideHelmet.cs | 22 +- Items/Armor/VictideLeggings.cs | 16 +- Items/Armor/VictideMask.cs | 20 +- Items/Armor/VictideVisage.cs | 20 +- Items/Armor/WulfrumArmor.cs | 17 +- Items/Armor/WulfrumHeadgear.cs | 19 +- Items/Armor/WulfrumHelm.cs | 19 +- Items/Armor/WulfrumHelmet.cs | 17 +- Items/Armor/WulfrumHood.cs | 19 +- Items/Armor/WulfrumLeggings.cs | 17 +- Items/Armor/WulfrumMask.cs | 17 +- Items/Armor/XerocCuisses.cs | 17 +- Items/Armor/XerocMask.cs | 17 +- Items/Armor/XerocPlateMail.cs | 17 +- Items/BleachBall.cs | 17 +- Items/BrimstoneLocus.cs | 16 +- Items/BrokenWaterFilter.cs | 18 +- Items/CalamityGlobalItem.cs | 167 +- Items/CalamityGlobalItemTooltip.cs | 24 +- Items/Critters/BabyFlakHermit.cs | 26 +- Items/Critters/BabyGhostBellItem.cs | 26 +- Items/Critters/PiggyItem.cs | 28 +- Items/Critters/SeaMinnowItem.cs | 28 +- Items/Critters/TwinklerItem.cs | 28 +- Items/DifficultyItems/BallAndChain.cs | 16 +- Items/DifficultyItems/Death.cs | 25 +- Items/DifficultyItems/Malice.cs | 33 +- Items/DifficultyItems/Revenge.cs | 29 +- Items/DraedonMisc/AdvancedDisplay.cs | 27 +- Items/DraedonMisc/AuricQuantumCoolingCell.cs | 34 +- Items/DraedonMisc/CodebreakerBase.cs | 30 +- Items/DraedonMisc/DecryptionComputer.cs | 31 +- Items/DraedonMisc/DraedonsLogHell.cs | 14 +- Items/DraedonMisc/DraedonsLogJungle.cs | 14 +- Items/DraedonMisc/DraedonsLogPlanetoid.cs | 14 +- Items/DraedonMisc/DraedonsLogSnowBiome.cs | 14 +- Items/DraedonMisc/DraedonsLogSunkenSea.cs | 14 +- Items/DraedonMisc/EncryptedSchematicHell.cs | 18 +- Items/DraedonMisc/EncryptedSchematicIce.cs | 18 +- Items/DraedonMisc/EncryptedSchematicJungle.cs | 18 +- .../EncryptedSchematicPlanetoid.cs | 18 +- .../EncryptedSchematicSunkenSea.cs | 20 +- Items/DraedonMisc/LongRangedSensorArray.cs | 27 +- Items/DraedonMisc/PowerCell.cs | 26 +- Items/DraedonMisc/VoltageRegulationSystem.cs | 29 +- Items/Dyes/AerialiteDye.cs | 13 +- Items/Dyes/AstralBlueDye.cs | 13 +- Items/Dyes/AstralDye.cs | 13 +- Items/Dyes/AstralOrangeDye.cs | 13 +- Items/Dyes/AstralSwirlDye.cs | 14 +- Items/Dyes/AuricDye.cs | 17 +- Items/Dyes/BaseDye.cs | 8 +- Items/Dyes/BloodflareDye.cs | 15 +- Items/Dyes/BlueCosmicFlameDye.cs | 15 +- Items/Dyes/BlueStatigelDye.cs | 13 +- Items/Dyes/BrimflameDye.cs | 13 +- Items/Dyes/CalamitousDye.cs | 15 +- Items/Dyes/CeaselessDye.cs | 16 +- Items/Dyes/CosmiliteDye.cs | 15 +- Items/Dyes/CryonicDye.cs | 13 +- Items/Dyes/DefiledFlameDye.cs | 6 +- Items/Dyes/DragonSoulDye.cs | 15 +- Items/Dyes/ElementalDye.cs | 16 +- Items/Dyes/EndothermicDye.cs | 15 +- Items/Dyes/ExoDye.cs | 15 +- Items/Dyes/HairDye/AdrenalineHairDye.cs | 22 +- Items/Dyes/HairDye/RageHairDye.cs | 22 +- Items/Dyes/HairDye/StealthHairDye.cs | 22 +- Items/Dyes/HairDye/WingTimeHairDye.cs | 22 +- Items/Dyes/NightmareDye.cs | 15 +- Items/Dyes/PhantoplasmDye.cs | 13 +- Items/Dyes/PinkCosmicFlameDye.cs | 15 +- Items/Dyes/PinkStatigelDye.cs | 13 +- Items/Dyes/ProfanedFlameDye.cs | 13 +- Items/Dyes/ProfanedMoonlightDye.cs | 8 +- Items/Dyes/ReaverDye.cs | 13 +- Items/Dyes/ShadowspecDye.cs | 15 +- Items/Dyes/SlimeGodDye.cs | 14 +- Items/Dyes/StratusDye.cs | 17 +- Items/Dyes/SwirlingCosmicFlameDye.cs | 15 +- .../Fishing/AstralCatches/AldebaranAlewife.cs | 10 +- .../AstralCatches/ArcturusAstroidean.cs | 12 +- Items/Fishing/AstralCatches/AstralCrate.cs | 24 +- Items/Fishing/AstralCatches/AstrophageItem.cs | 10 +- .../Fishing/AstralCatches/GacruxianMollusk.cs | 32 +- .../AstralCatches/PolarisParrotfish.cs | 32 +- Items/Fishing/AstralCatches/ProcyonidPrawn.cs | 10 +- .../Fishing/AstralCatches/TwinklingPollox.cs | 10 +- Items/Fishing/AstralCatches/UrsaSergeant.cs | 12 +- .../Fishing/BrimstoneCragCatches/Bloodfin.cs | 28 +- .../Fishing/BrimstoneCragCatches/Brimlish.cs | 12 +- .../BrimstoneCragCatches/BrimstoneCrate.cs | 24 +- .../BrimstoneCragCatches/BrimstoneFish.cs | 10 +- .../BrimstoneCragCatches/ChaoticFish.cs | 10 +- .../BrimstoneCragCatches/CharredLasher.cs | 10 +- .../BrimstoneCragCatches/CoastalDemonfish.cs | 10 +- .../BrimstoneCragCatches/CragBullhead.cs | 10 +- .../DragoonDrizzlefish.cs | 32 +- .../BrimstoneCragCatches/Shadowfish.cs | 10 +- .../Fishing/BrimstoneCragCatches/Slurpfish.cs | 12 +- Items/Fishing/EnchantedStarfish.cs | 22 +- Items/Fishing/FishingRods/ChaoticSpreadRod.cs | 29 +- Items/Fishing/FishingRods/EarlyBloomRod.cs | 31 +- Items/Fishing/FishingRods/FeralDoubleRod.cs | 28 +- Items/Fishing/FishingRods/HeronRod.cs | 29 +- Items/Fishing/FishingRods/NavyFishingRod.cs | 29 +- Items/Fishing/FishingRods/SlurperPole.cs | 22 +- .../Fishing/FishingRods/TheDevourerofCods.cs | 30 +- .../FishingRods/VerstaltiteFishingRod.cs | 28 +- Items/Fishing/FishingRods/WulfrumRod.cs | 28 +- Items/Fishing/FishofEleum.cs | 10 +- Items/Fishing/FishofFlight.cs | 12 +- Items/Fishing/FishofLight.cs | 12 +- Items/Fishing/FishofNight.cs | 12 +- Items/Fishing/GlimmeringGemfish.cs | 18 +- Items/Fishing/Spadefish.cs | 28 +- Items/Fishing/StuffedFish.cs | 24 +- Items/Fishing/SulphurCatches/AbyssalCrate.cs | 24 +- Items/Fishing/SunbeamFish.cs | 10 +- .../SunkenSeaCatches/CoralskinFoolfish.cs | 10 +- .../SunkenSeaCatches/EutrophicSandfish.cs | 14 +- .../SunkenSeaCatches/GreenwaveLoach.cs | 10 +- .../SunkenSeaCatches/PrismaticGuppy.cs | 10 +- .../SunkenSeaCatches/RustedJingleBell.cs | 12 +- .../SunkenSeaCatches/ScarredAngelfish.cs | 10 +- .../Fishing/SunkenSeaCatches/SerpentsBite.cs | 14 +- Items/Fishing/SunkenSeaCatches/Serpentuna.cs | 12 +- .../SunkenSeaCatches/SparklingEmpress.cs | 32 +- Items/Fishing/SunkenSeaCatches/SunkenCrate.cs | 24 +- .../SunkenSeaCatches/SunkenSailfish.cs | 10 +- Items/Fishing/SunkenSeaCatches/SurfClam.cs | 12 +- Items/Fishing/Xerocodile.cs | 10 +- Items/LabFinders/CyanSeekingMechanism.cs | 29 +- Items/LabFinders/GreenSeekingMechanism.cs | 29 +- Items/LabFinders/MysteriousMechanism.cs | 15 +- Items/LabFinders/PurpleSeekingMechanism.cs | 29 +- Items/LabFinders/RedSeekingMechanism.cs | 29 +- Items/LabFinders/YellowSeekingMechanism.cs | 29 +- Items/LoreItems/KnowledgeAquaticScourge.cs | 15 +- Items/LoreItems/KnowledgeAstralInfection.cs | 15 +- Items/LoreItems/KnowledgeAstrumAureus.cs | 15 +- Items/LoreItems/KnowledgeAstrumDeus.cs | 15 +- Items/LoreItems/KnowledgeBloodMoon.cs | 15 +- Items/LoreItems/KnowledgeBrainofCthulhu.cs | 25 +- Items/LoreItems/KnowledgeBrimstoneCrag.cs | 15 +- .../LoreItems/KnowledgeBrimstoneElemental.cs | 15 +- Items/LoreItems/KnowledgeBumblebirb.cs | 15 +- Items/LoreItems/KnowledgeCalamitas.cs | 17 +- Items/LoreItems/KnowledgeCalamitasClone.cs | 15 +- Items/LoreItems/KnowledgeCorruption.cs | 15 +- Items/LoreItems/KnowledgeCrabulon.cs | 15 +- Items/LoreItems/KnowledgeCrimson.cs | 15 +- Items/LoreItems/KnowledgeCryogen.cs | 15 +- Items/LoreItems/KnowledgeDesertScourge.cs | 15 +- Items/LoreItems/KnowledgeDestroyer.cs | 15 +- Items/LoreItems/KnowledgeDevourerofGods.cs | 19 +- Items/LoreItems/KnowledgeDukeFishron.cs | 15 +- Items/LoreItems/KnowledgeEaterofWorlds.cs | 15 +- Items/LoreItems/KnowledgeExoMechs.cs | 41 +- Items/LoreItems/KnowledgeEyeofCthulhu.cs | 15 +- Items/LoreItems/KnowledgeGolem.cs | 15 +- Items/LoreItems/KnowledgeHiveMind.cs | 15 +- Items/LoreItems/KnowledgeKingSlime.cs | 15 +- Items/LoreItems/KnowledgeLeviathanandSiren.cs | 15 +- Items/LoreItems/KnowledgeLunaticCultist.cs | 15 +- Items/LoreItems/KnowledgeMechs.cs | 39 +- Items/LoreItems/KnowledgeMoonLord.cs | 15 +- Items/LoreItems/KnowledgeOcean.cs | 15 +- Items/LoreItems/KnowledgeOldDuke.cs | 15 +- Items/LoreItems/KnowledgePerforators.cs | 15 +- .../KnowledgePlaguebringerGoliath.cs | 15 +- Items/LoreItems/KnowledgePlantera.cs | 15 +- Items/LoreItems/KnowledgePolterghast.cs | 17 +- Items/LoreItems/KnowledgeProfanedGuardians.cs | 15 +- Items/LoreItems/KnowledgeProvidence.cs | 17 +- Items/LoreItems/KnowledgeQueenBee.cs | 15 +- Items/LoreItems/KnowledgeRavager.cs | 15 +- Items/LoreItems/KnowledgeSentinels.cs | 35 +- Items/LoreItems/KnowledgeSkeletron.cs | 15 +- Items/LoreItems/KnowledgeSkeletronPrime.cs | 15 +- Items/LoreItems/KnowledgeSlimeGod.cs | 15 +- Items/LoreItems/KnowledgeSulphurSea.cs | 15 +- Items/LoreItems/KnowledgeTwins.cs | 23 +- Items/LoreItems/KnowledgeUnderworld.cs | 15 +- Items/LoreItems/KnowledgeWallofFlesh.cs | 15 +- Items/LoreItems/KnowledgeYharon.cs | 17 +- Items/Materials/AerialiteBar.cs | 30 +- Items/Materials/AncientBoneDust.cs | 10 +- Items/Materials/ArmoredShell.cs | 12 +- Items/Materials/AscendantSpiritEssence.cs | 33 +- Items/Materials/AuricBar.cs | 45 +- Items/Materials/BarofLife.cs | 18 +- Items/Materials/BeetleJuice.cs | 10 +- Items/Materials/BlightedLens.cs | 10 +- Items/Materials/BloodOrb.cs | 12 +- Items/Materials/BloodSample.cs | 10 +- Items/Materials/Bloodstone.cs | 12 +- Items/Materials/BloodstoneCore.cs | 20 +- Items/Materials/CalamitousEssence.cs | 22 +- Items/Materials/CalamityDust.cs | 14 +- Items/Materials/CoreofCalamity.cs | 21 +- Items/Materials/CoreofChaos.cs | 21 +- Items/Materials/CoreofCinder.cs | 21 +- Items/Materials/CoreofEleum.cs | 21 +- Items/Materials/CorrodedFossil.cs | 10 +- Items/Materials/CosmiliteBar.cs | 36 +- Items/Materials/CruptixBar.cs | 38 +- Items/Materials/DarkPlasma.cs | 16 +- Items/Materials/DarksunFragment.cs | 24 +- Items/Materials/DemonicBoneAsh.cs | 10 +- Items/Materials/DepthCells.cs | 10 +- Items/Materials/DesertFeather.cs | 10 +- Items/Materials/DivineGeode.cs | 14 +- Items/Materials/DraedonBar.cs | 30 +- Items/Materials/DubiousPlating.cs | 12 +- Items/Materials/EbonianGel.cs | 24 +- Items/Materials/EffulgentFeather.cs | 12 +- Items/Materials/EndothermicEnergy.cs | 24 +- Items/Materials/EnergyCore.cs | 8 +- Items/Materials/EssenceofChaos.cs | 14 +- Items/Materials/EssenceofCinder.cs | 14 +- Items/Materials/EssenceofEleum.cs | 14 +- Items/Materials/ExoPrism.cs | 22 +- Items/Materials/GalacticaSingularity.cs | 23 +- Items/Materials/GrandScale.cs | 10 +- Items/Materials/HadarianMembrane.cs | 10 +- Items/Materials/HellcasterFragment.cs | 12 +- Items/Materials/InfectedArmorPlating.cs | 10 +- Items/Materials/LivingShard.cs | 10 +- Items/Materials/Lumenite.cs | 24 +- Items/Materials/MeldBlob.cs | 10 +- Items/Materials/MeldiateBar.cs | 17 +- Items/Materials/MiracleMatter.cs | 37 +- Items/Materials/MolluskHusk.cs | 10 +- Items/Materials/MurkyPaste.cs | 10 +- Items/Materials/MysteriousCircuitry.cs | 12 +- Items/Materials/NightmareFuel.cs | 24 +- Items/Materials/Phantoplasm.cs | 12 +- Items/Materials/PlagueCellCluster.cs | 10 +- Items/Materials/PlasmaDriveCore.cs | 14 +- Items/Materials/PurifiedGel.cs | 10 +- Items/Materials/ReaperTooth.cs | 12 +- Items/Materials/RuinousSoul.cs | 12 +- Items/Materials/ShadowspecBar.cs | 42 +- Items/Materials/SolarVeil.cs | 10 +- Items/Materials/Stardust.cs | 10 +- Items/Materials/StormlionMandible.cs | 12 +- Items/Materials/SulfuricScale.cs | 10 +- Items/Materials/SuspiciousScrap.cs | 18 +- Items/Materials/TitanHeart.cs | 10 +- Items/Materials/TrapperBulb.cs | 10 +- Items/Materials/TrueShadowScale.cs | 10 +- Items/Materials/TwistingNether.cs | 14 +- Items/Materials/UeliaceBar.cs | 32 +- Items/Materials/UnholyCore.cs | 17 +- Items/Materials/UnholyEssence.cs | 14 +- Items/Materials/VerstaltiteBar.cs | 30 +- Items/Materials/VictideBar.cs | 19 +- Items/Materials/VictoryShard.cs | 10 +- Items/Materials/WulfrumShard.cs | 10 +- Items/Mounts/AlicornMount.cs | 6 +- Items/Mounts/BirdSeed.cs | 22 +- Items/Mounts/Brimrose.cs | 22 +- Items/Mounts/Crysthamyr.cs | 6 +- Items/Mounts/DraedonGamerChairMount.cs | 2 +- Items/Mounts/ExoThrone.cs | 22 +- Items/Mounts/Fabsol.cs | 22 +- Items/Mounts/GazeOfCrysthamyr.cs | 31 +- Items/Mounts/Minecarts/DoGCart.cs | 32 +- Items/Mounts/Minecarts/DoGCartMount.cs | 4 +- Items/Mounts/OnyxExcavator.cs | 17 +- Items/Mounts/OnyxExcavatorKey.cs | 20 +- Items/Mounts/SquishyBeanMount.cs | 22 +- Items/Mounts/TundraLeash.cs | 20 +- Items/NormalityRelocator.cs | 23 +- Items/PermanentBoosters/BloodOrange.cs | 29 +- Items/PermanentBoosters/CometShard.cs | 26 +- Items/PermanentBoosters/Dragonfruit.cs | 30 +- Items/PermanentBoosters/Ectoheart.cs | 32 +- Items/PermanentBoosters/Elderberry.cs | 30 +- Items/PermanentBoosters/ElectrolyteGelPack.cs | 18 +- Items/PermanentBoosters/EtherealCore.cs | 27 +- Items/PermanentBoosters/InfernalBlood.cs | 18 +- Items/PermanentBoosters/MLGRune2.cs | 20 +- Items/PermanentBoosters/MiracleFruit.cs | 28 +- Items/PermanentBoosters/MushroomPlasmaRoot.cs | 18 +- Items/PermanentBoosters/PhantomHeart.cs | 27 +- .../RedLightningContainer.cs | 30 +- Items/PermanentBoosters/StarlightFuelCell.cs | 18 +- Items/Pets/BearEye.cs | 28 +- Items/Pets/BloodyVein.cs | 28 +- Items/Pets/BrimstoneJewel.cs | 14 +- Items/Pets/CharredRelic.cs | 16 +- Items/Pets/ChromaticOrb.cs | 14 +- Items/Pets/CosmicPlushie.cs | 28 +- Items/Pets/ForgottenDragonEgg.cs | 14 +- Items/Pets/FoxDrive.cs | 16 +- Items/Pets/GeyserShell.cs | 26 +- Items/Pets/IbarakiBox.cs | 30 +- Items/Pets/JoyfulHeart.cs | 28 +- Items/Pets/Levi.cs | 14 +- Items/Pets/LittleLight.cs | 18 +- Items/Pets/McNuggets.cs | 12 +- Items/Pets/PineapplePet.cs | 26 +- Items/Pets/PlagueCaller.cs | 10 +- Items/Pets/PrimroseKeepsake.cs | 36 +- Items/Pets/RadiatingCrystal.cs | 12 +- Items/Pets/RomajedaOrchid.cs | 28 +- Items/Pets/RotomRemote.cs | 36 +- Items/Pets/RottingEyeball.cs | 24 +- Items/Pets/SparksSummon.cs | 28 +- Items/Pets/StrangeOrb.cs | 8 +- Items/Pets/TrashmanTrashcan.cs | 28 +- Items/Placeables/AbyssGravel.cs | 20 +- Items/Placeables/Acidwood.cs | 25 +- Items/Placeables/AerialiteBrick.cs | 33 +- Items/Placeables/AstralBar.cs | 31 +- Items/Placeables/AstralBrick.cs | 33 +- Items/Placeables/AstralClay.cs | 20 +- Items/Placeables/AstralDirt.cs | 27 +- Items/Placeables/AstralFossil.cs | 29 +- Items/Placeables/AstralIce.cs | 27 +- Items/Placeables/AstralMonolith.cs | 31 +- Items/Placeables/AstralSand.cs | 22 +- Items/Placeables/AstralSandstone.cs | 27 +- Items/Placeables/AstralSilt.cs | 22 +- Items/Placeables/AstralSnow.cs | 27 +- Items/Placeables/AstralStone.cs | 27 +- Items/Placeables/Banners/AcidEelBanner.cs | 26 +- Items/Placeables/Banners/AeroSlimeBanner.cs | 26 +- .../Placeables/Banners/AmberCrawlerBanner.cs | 26 +- .../Banners/AmethystCrawlerBanner.cs | 26 +- Items/Placeables/Banners/AngryDogBanner.cs | 26 +- .../Placeables/Banners/AnthozoanCrabBanner.cs | 26 +- .../Banners/AquaticAberrationBanner.cs | 26 +- .../Banners/AquaticParasiteBanner.cs | 26 +- .../Placeables/Banners/AquaticSeekerBanner.cs | 26 +- .../Placeables/Banners/AquaticUrchinBanner.cs | 26 +- Items/Placeables/Banners/AriesBanner.cs | 26 +- .../Placeables/Banners/ArmoredDiggerBanner.cs | 26 +- Items/Placeables/Banners/AstralProbeBanner.cs | 26 +- Items/Placeables/Banners/AstralSlimeBanner.cs | 26 +- .../Placeables/Banners/AstralachneaBanner.cs | 26 +- Items/Placeables/Banners/AtlasBanner.cs | 26 +- Items/Placeables/Banners/BOHLDOHRBanner.cs | 26 +- .../Placeables/Banners/BelchingCoralBanner.cs | 26 +- .../Placeables/Banners/BigSightseerBanner.cs | 26 +- Items/Placeables/Banners/BlightedEyeBanner.cs | 26 +- .../Placeables/Banners/BlindedAnglerBanner.cs | 26 +- Items/Placeables/Banners/BloatfishBanner.cs | 26 +- Items/Placeables/Banners/BloomSlimeBanner.cs | 26 +- Items/Placeables/Banners/BobbitWormBanner.cs | 26 +- .../Placeables/Banners/BoxJellyfishBanner.cs | 26 +- Items/Placeables/Banners/CalamityEyeBanner.cs | 26 +- Items/Placeables/Banners/CatfishBanner.cs | 26 +- .../Placeables/Banners/ChaoticPufferBanner.cs | 26 +- .../Placeables/Banners/CharredSlimeBanner.cs | 26 +- Items/Placeables/Banners/ClamBanner.cs | 26 +- .../Banners/CloudElementalBanner.cs | 26 +- Items/Placeables/Banners/CnidrionBanner.cs | 26 +- .../Placeables/Banners/ColossalSquidBanner.cs | 26 +- .../Banners/CosmicElementalBanner.cs | 26 +- .../Banners/CrimulanBlightSlimeBanner.cs | 26 +- Items/Placeables/Banners/CryoSlimeBanner.cs | 26 +- Items/Placeables/Banners/CryonBanner.cs | 26 +- .../Banners/CrystalCrawlerBanner.cs | 26 +- .../Banners/CultistAssassinBanner.cs | 26 +- Items/Placeables/Banners/CuttlefishBanner.cs | 26 +- .../Placeables/Banners/DespairStoneBanner.cs | 26 +- Items/Placeables/Banners/DevilFishBanner.cs | 26 +- .../Banners/DiamondCrawlerBanner.cs | 26 +- .../Banners/EarthElementalBanner.cs | 26 +- .../Banners/EbonianBlightSlimeBanner.cs | 26 +- Items/Placeables/Banners/EidolistBanner.cs | 26 +- .../Banners/EidolonWyrmJuvenileBanner.cs | 26 +- .../Banners/EmeraldCrawlerBanner.cs | 26 +- .../Placeables/Banners/EutrophicRayBanner.cs | 26 +- .../Banners/FearlessGoldfishWarriorBanner.cs | 28 +- Items/Placeables/Banners/FlakBabyBanner.cs | 26 +- Items/Placeables/Banners/FlakCrabBanner.cs | 26 +- Items/Placeables/Banners/FlounderBanner.cs | 26 +- Items/Placeables/Banners/FrogfishBanner.cs | 26 +- .../Placeables/Banners/FusionFeederBanner.cs | 26 +- Items/Placeables/Banners/GammaSlimeBanner.cs | 26 +- Items/Placeables/Banners/GhostBellBanner.cs | 26 +- .../Banners/GhostBellSmallBanner.cs | 26 +- Items/Placeables/Banners/GiantClamBanner.cs | 26 +- Items/Placeables/Banners/GiantSquidBanner.cs | 26 +- Items/Placeables/Banners/GnasherBanner.cs | 26 +- .../Banners/GreatSandSharkBanner.cs | 26 +- Items/Placeables/Banners/GulperEelBanner.cs | 26 +- Items/Placeables/Banners/HadarianBanner.cs | 26 +- Items/Placeables/Banners/HeatSpiritBanner.cs | 26 +- Items/Placeables/Banners/HiveBanner.cs | 26 +- Items/Placeables/Banners/IceClasperBanner.cs | 26 +- .../Banners/ImpiousImmolatorBanner.cs | 26 +- .../Banners/IrradiatedSlimeBanner.cs | 26 +- Items/Placeables/Banners/LaserfishBanner.cs | 26 +- .../Banners/LuminousCorvinaBanner.cs | 26 +- Items/Placeables/Banners/MantisBanner.cs | 26 +- .../Placeables/Banners/MantisShrimpBanner.cs | 26 +- Items/Placeables/Banners/MaulerBanner.cs | 26 +- Items/Placeables/Banners/MelterBanner.cs | 26 +- Items/Placeables/Banners/MirageJellyBanner.cs | 26 +- Items/Placeables/Banners/MorayEelBanner.cs | 26 +- Items/Placeables/Banners/NovaBanner.cs | 26 +- Items/Placeables/Banners/NuclearToadBanner.cs | 26 +- Items/Placeables/Banners/OarfishBanner.cs | 26 +- Items/Placeables/Banners/OrthoceraBanner.cs | 26 +- .../Banners/OverloadedSoldierBanner.cs | 26 +- Items/Placeables/Banners/ParaseaBanner.cs | 26 +- .../Banners/PerennialSlimeBanner.cs | 26 +- .../Banners/PestilentSlimeBanner.cs | 26 +- .../Placeables/Banners/PhantomDebrisBanner.cs | 26 +- .../Placeables/Banners/PhantomSpiritBanner.cs | 26 +- Items/Placeables/Banners/PiggyBanner.cs | 28 +- Items/Placeables/Banners/PitbullBanner.cs | 26 +- .../Placeables/Banners/PlagueChargerBanner.cs | 26 +- .../Placeables/Banners/PlaguebringerBanner.cs | 26 +- Items/Placeables/Banners/PlagueshellBanner.cs | 26 +- Items/Placeables/Banners/PrismTurtleBanner.cs | 26 +- .../Banners/ProfanedEnergyBanner.cs | 26 +- Items/Placeables/Banners/RadiatorBanner.cs | 26 +- Items/Placeables/Banners/ReaperSharkBanner.cs | 26 +- Items/Placeables/Banners/RubyCrawlerBanner.cs | 26 +- .../Placeables/Banners/SandTortoiseBanner.cs | 26 +- .../Banners/SapphireCrawlerBanner.cs | 26 +- Items/Placeables/Banners/ScornEaterBanner.cs | 26 +- Items/Placeables/Banners/ScryllarBanner.cs | 26 +- Items/Placeables/Banners/SeaFloatyBanner.cs | 26 +- Items/Placeables/Banners/SeaMinnowBanner.cs | 26 +- Items/Placeables/Banners/SeaSerpentBanner.cs | 26 +- Items/Placeables/Banners/SeaUrchinBanner.cs | 26 +- .../Banners/ShockstormShuttleBanner.cs | 26 +- Items/Placeables/Banners/SkyfinBanner.cs | 26 +- .../Banners/SmallSightseerBanner.cs | 26 +- Items/Placeables/Banners/SoulSluperBanner.cs | 26 +- .../Placeables/Banners/StellarCulexBanner.cs | 26 +- Items/Placeables/Banners/StormlionBanner.cs | 26 +- .../Banners/SulfurousSkaterBanner.cs | 26 +- Items/Placeables/Banners/SunBatBanner.cs | 26 +- Items/Placeables/Banners/SunskaterBanner.cs | 26 +- .../Placeables/Banners/TopazCrawlerBanner.cs | 26 +- Items/Placeables/Banners/ToxicMinnowBanner.cs | 26 +- Items/Placeables/Banners/TrasherBanner.cs | 26 +- Items/Placeables/Banners/TrilobiteBanner.cs | 26 +- Items/Placeables/Banners/ViperfishBanner.cs | 26 +- Items/Placeables/Banners/VirulingBanner.cs | 26 +- Items/Placeables/Banners/WaterLeechBanner.cs | 26 +- .../Placeables/Banners/WulfrumDroneBanner.cs | 26 +- .../Banners/WulfrumGyratorBanner.cs | 26 +- .../Banners/WulfrumHovercraftBanner.cs | 26 +- .../Placeables/Banners/WulfrumPylonBanner.cs | 26 +- .../Placeables/Banners/WulfrumRoverBanner.cs | 26 +- .../Placeables/Banners/WulfrumSlimeBanner.cs | 33 +- Items/Placeables/BrimstoneSlag.cs | 30 +- Items/Placeables/ChaoticBrick.cs | 38 +- Items/Placeables/CryonicBrick.cs | 33 +- .../AgedLaboratoryConsoleItem.cs | 28 +- .../AgedLaboratoryContainmentBoxItem.cs | 27 +- .../AgedLaboratoryDisplayItem.cs | 27 +- .../AgedLaboratoryDoorItem.cs | 31 +- .../AgedLaboratoryElectricPanelItem.cs | 28 +- .../AgedLaboratoryScreenItem.cs | 27 +- .../AgedLaboratoryServerItem.cs | 28 +- .../AgedLaboratoryTerminalItem.cs | 27 +- .../AgedReinforcedCrateItem.cs | 27 +- .../DraedonStructures/AgedSecurityChest.cs | 36 +- .../DraedonStructures/ChargingStationItem.cs | 24 +- .../DraedonStructures/HazardChevronPanels.cs | 34 +- .../LabHologramProjectorItem.cs | 35 +- .../LaboratoryConsoleItem.cs | 28 +- .../LaboratoryContainmentBoxItem.cs | 27 +- .../LaboratoryDisplayItem.cs | 27 +- .../DraedonStructures/LaboratoryDoorItem.cs | 31 +- .../LaboratoryElectricPanelItem.cs | 28 +- .../DraedonStructures/LaboratoryPanels.cs | 34 +- .../LaboratoryPipePlating.cs | 27 +- .../DraedonStructures/LaboratoryPlating.cs | 57 +- .../DraedonStructures/LaboratoryScreenItem.cs | 27 +- .../DraedonStructures/LaboratoryServerItem.cs | 28 +- .../DraedonStructures/LaboratoryShelf.cs | 30 +- .../LaboratoryTerminalItem.cs | 27 +- .../DraedonStructures/PowerCellFactoryItem.cs | 24 +- .../DraedonStructures/ReinforcedCrateItem.cs | 27 +- .../DraedonStructures/RustedPipes.cs | 27 +- .../DraedonStructures/RustedPlating.cs | 57 +- .../DraedonStructures/RustedShelf.cs | 30 +- .../DraedonStructures/SecurityChest.cs | 36 +- Items/Placeables/EutrophicSand.cs | 32 +- .../Placeables/Furniture/AstralBeaconItem.cs | 30 +- Items/Placeables/Furniture/AstralChest.cs | 22 +- Items/Placeables/Furniture/AuricToilet.cs | 31 +- .../Furniture/BabyFlakHermitCage.cs | 26 +- .../Placeables/Furniture/BabyGhostBellJar.cs | 26 +- Items/Placeables/Furniture/BlueCandle.cs | 24 +- Items/Placeables/Furniture/ChaosCandle.cs | 37 +- .../Placeables/Furniture/CorruptionEffigy.cs | 24 +- .../CraftingStations/AncientAltar.cs | 31 +- .../Furniture/CraftingStations/AshenAltar.cs | 31 +- .../CraftingStations/BotanicPlanter.cs | 29 +- .../CraftingStations/CosmicAnvilItem.cs | 36 +- .../CraftingStations/DraedonsForge.cs | 37 +- .../CraftingStations/EutrophicCrafting.cs | 30 +- .../CraftingStations/MonolithCrafting.cs | 28 +- .../CraftingStations/PlagueInfuser.cs | 28 +- .../CraftingStations/ProfanedBasin.cs | 29 +- .../Furniture/CraftingStations/SilvaBasin.cs | 29 +- .../CraftingStations/StaticRefiner.cs | 27 +- .../CraftingStations/VoidCondenser.cs | 26 +- Items/Placeables/Furniture/CrimsonEffigy.cs | 24 +- Items/Placeables/Furniture/EffigyOfDecay.cs | 31 +- .../Furniture/Fountains/AbyssFountainItem.cs | 24 +- .../Furniture/Fountains/AstralFountainItem.cs | 24 +- .../Fountains/SulphurousFountainItem.cs | 24 +- .../Furniture/Fountains/SunkenSeaFountain.cs | 24 +- Items/Placeables/Furniture/PiggyCage.cs | 28 +- Items/Placeables/Furniture/PinkCandle.cs | 24 +- Items/Placeables/Furniture/PurpleCandle.cs | 24 +- Items/Placeables/Furniture/RustyChest.cs | 29 +- Items/Placeables/Furniture/SCalAltarItem.cs | 30 +- Items/Placeables/Furniture/SeaMinnowJar.cs | 26 +- Items/Placeables/Furniture/ThaumaticChair.cs | 43 +- .../Placeables/Furniture/TranquilityCandle.cs | 37 +- .../Furniture/Trophies/AnahitaTrophy.cs | 26 +- .../Furniture/Trophies/ApolloTrophy.cs | 24 +- .../Trophies/AquaticScourgeTrophy.cs | 26 +- .../Furniture/Trophies/AresTrophy.cs | 24 +- .../Furniture/Trophies/ArtemisTrophy.cs | 24 +- .../Furniture/Trophies/AstrageldonTrophy.cs | 26 +- .../Furniture/Trophies/AstrumDeusTrophy.cs | 26 +- .../Trophies/BrimstoneElementalTrophy.cs | 26 +- .../Furniture/Trophies/BumblebirbTrophy.cs | 26 +- .../Furniture/Trophies/CalamitasTrophy.cs | 26 +- .../Furniture/Trophies/CataclysmTrophy.cs | 26 +- .../Furniture/Trophies/CatastropheTrophy.cs | 26 +- .../Furniture/Trophies/CeaselessVoidTrophy.cs | 26 +- .../Furniture/Trophies/CrabulonTrophy.cs | 26 +- .../Furniture/Trophies/CryogenTrophy.cs | 26 +- .../Furniture/Trophies/DesertScourgeTrophy.cs | 26 +- .../Trophies/DevourerofGodsTrophy.cs | 26 +- .../Furniture/Trophies/HiveMindTrophy.cs | 26 +- .../Furniture/Trophies/LeviathanTrophy.cs | 26 +- .../Furniture/Trophies/OldDukeTrophy.cs | 26 +- .../Furniture/Trophies/PerforatorTrophy.cs | 26 +- .../Trophies/PlaguebringerGoliathTrophy.cs | 26 +- .../Furniture/Trophies/PolterghastTrophy.cs | 26 +- .../Trophies/ProfanedGuardianTrophy.cs | 26 +- .../Furniture/Trophies/ProvidenceTrophy.cs | 26 +- .../Furniture/Trophies/RavagerTrophy.cs | 26 +- .../Furniture/Trophies/SignusTrophy.cs | 26 +- .../Furniture/Trophies/SlimeGodTrophy.cs | 26 +- .../Trophies/SupremeCalamitasTrophy.cs | 26 +- .../Trophies/SupremeCataclysmTrophy.cs | 26 +- .../Trophies/SupremeCatastropheTrophy.cs | 26 +- .../Furniture/Trophies/ThanatosTrophy.cs | 24 +- .../Furniture/Trophies/WeaverTrophy.cs | 26 +- .../Furniture/Trophies/YharonTrophy.cs | 26 +- .../Placeables/Furniture/TwinklerInABottle.cs | 26 +- Items/Placeables/Furniture/YellowCandle.cs | 24 +- Items/Placeables/FurnitureAbyss/AbyssBath.cs | 30 +- Items/Placeables/FurnitureAbyss/AbyssBed.cs | 29 +- .../FurnitureAbyss/AbyssBookcase.cs | 29 +- .../FurnitureAbyss/AbyssCandelabra.cs | 29 +- .../Placeables/FurnitureAbyss/AbyssCandle.cs | 29 +- Items/Placeables/FurnitureAbyss/AbyssChair.cs | 28 +- .../FurnitureAbyss/AbyssChandelier.cs | 30 +- Items/Placeables/FurnitureAbyss/AbyssChest.cs | 30 +- Items/Placeables/FurnitureAbyss/AbyssClock.cs | 31 +- Items/Placeables/FurnitureAbyss/AbyssDoor.cs | 28 +- .../Placeables/FurnitureAbyss/AbyssDresser.cs | 28 +- Items/Placeables/FurnitureAbyss/AbyssLamp.cs | 29 +- .../Placeables/FurnitureAbyss/AbyssLantern.cs | 29 +- Items/Placeables/FurnitureAbyss/AbyssPiano.cs | 32 +- Items/Placeables/FurnitureAbyss/AbyssSink.cs | 29 +- Items/Placeables/FurnitureAbyss/AbyssSofa.cs | 29 +- Items/Placeables/FurnitureAbyss/AbyssTable.cs | 28 +- Items/Placeables/FurnitureAbyss/AbyssTorch.cs | 36 +- .../FurnitureAbyss/AbyssWorkbench.cs | 30 +- .../FurnitureAbyss/SmoothAbyssGravel.cs | 38 +- .../SmoothAbyssGravelPlatform.cs | 26 +- .../FurnitureAcidwood/AcidwoodBathtub.cs | 28 +- .../FurnitureAcidwood/AcidwoodBed.cs | 29 +- .../FurnitureAcidwood/AcidwoodBench.cs | 28 +- .../FurnitureAcidwood/AcidwoodBookcase.cs | 29 +- .../FurnitureAcidwood/AcidwoodCandelabra.cs | 29 +- .../FurnitureAcidwood/AcidwoodCandle.cs | 29 +- .../FurnitureAcidwood/AcidwoodChair.cs | 28 +- .../FurnitureAcidwood/AcidwoodChandelier.cs | 30 +- .../FurnitureAcidwood/AcidwoodChest.cs | 30 +- .../FurnitureAcidwood/AcidwoodClock.cs | 31 +- .../FurnitureAcidwood/AcidwoodDoor.cs | 28 +- .../FurnitureAcidwood/AcidwoodDresser.cs | 28 +- .../FurnitureAcidwood/AcidwoodLamp.cs | 29 +- .../FurnitureAcidwood/AcidwoodLantern.cs | 29 +- .../FurnitureAcidwood/AcidwoodPiano.cs | 30 +- .../FurnitureAcidwood/AcidwoodPlatform.cs | 27 +- .../FurnitureAcidwood/AcidwoodSink.cs | 29 +- .../FurnitureAcidwood/AcidwoodTable.cs | 28 +- .../FurnitureAcidwood/AcidwoodWorkbench.cs | 27 +- .../FurnitureAncient/AncientBasin.cs | 31 +- .../FurnitureAncient/AncientBath.cs | 32 +- .../Placeables/FurnitureAncient/AncientBed.cs | 31 +- .../FurnitureAncient/AncientBookcase.cs | 31 +- .../FurnitureAncient/AncientChair.cs | 30 +- .../FurnitureAncient/AncientChandelier.cs | 32 +- .../FurnitureAncient/AncientDoor.cs | 30 +- .../FurnitureAncient/AncientDresser.cs | 30 +- .../FurnitureAncient/AncientLamp.cs | 31 +- .../FurnitureAncient/AncientLantern.cs | 31 +- .../FurnitureAncient/AncientMonolith.cs | 31 +- .../FurnitureAncient/AncientPiano.cs | 34 +- .../FurnitureAncient/AncientSink.cs | 31 +- .../FurnitureAncient/AncientSofa.cs | 31 +- .../FurnitureAncient/AncientTable.cs | 30 +- .../FurnitureAncient/AncientWorkbench.cs | 32 +- Items/Placeables/FurnitureAshen/AshenBasin.cs | 31 +- Items/Placeables/FurnitureAshen/AshenBath.cs | 32 +- Items/Placeables/FurnitureAshen/AshenBed.cs | 31 +- .../FurnitureAshen/AshenBookcase.cs | 31 +- .../FurnitureAshen/AshenCandelabra.cs | 31 +- .../Placeables/FurnitureAshen/AshenCandle.cs | 31 +- Items/Placeables/FurnitureAshen/AshenChair.cs | 30 +- .../FurnitureAshen/AshenChandelier.cs | 32 +- Items/Placeables/FurnitureAshen/AshenChest.cs | 32 +- Items/Placeables/FurnitureAshen/AshenDoor.cs | 30 +- .../Placeables/FurnitureAshen/AshenDresser.cs | 30 +- Items/Placeables/FurnitureAshen/AshenLamp.cs | 31 +- .../Placeables/FurnitureAshen/AshenLantern.cs | 31 +- .../FurnitureAshen/AshenMonolith.cs | 31 +- Items/Placeables/FurnitureAshen/AshenPiano.cs | 34 +- .../FurnitureAshen/AshenPlatform.cs | 28 +- Items/Placeables/FurnitureAshen/AshenSink.cs | 31 +- Items/Placeables/FurnitureAshen/AshenSlab.cs | 35 +- Items/Placeables/FurnitureAshen/AshenSofa.cs | 31 +- Items/Placeables/FurnitureAshen/AshenTable.cs | 30 +- .../FurnitureAshen/AshenWorkbench.cs | 32 +- .../FurnitureAshen/SmoothBrimstoneSlag.cs | 40 +- .../FurnitureAstral/MonolithBathtub.cs | 28 +- .../Placeables/FurnitureAstral/MonolithBed.cs | 29 +- .../FurnitureAstral/MonolithBench.cs | 29 +- .../FurnitureAstral/MonolithBookcase.cs | 29 +- .../FurnitureAstral/MonolithCandelabra.cs | 29 +- .../FurnitureAstral/MonolithCandle.cs | 29 +- .../FurnitureAstral/MonolithChair.cs | 28 +- .../FurnitureAstral/MonolithChandelier.cs | 29 +- .../FurnitureAstral/MonolithChest.cs | 30 +- .../FurnitureAstral/MonolithClock.cs | 31 +- .../FurnitureAstral/MonolithDoor.cs | 28 +- .../FurnitureAstral/MonolithDresser.cs | 28 +- .../FurnitureAstral/MonolithLamp.cs | 29 +- .../FurnitureAstral/MonolithLantern.cs | 29 +- .../FurnitureAstral/MonolithPiano.cs | 30 +- .../FurnitureAstral/MonolithPlatform.cs | 27 +- .../FurnitureAstral/MonolithSink.cs | 29 +- .../FurnitureAstral/MonolithTable.cs | 28 +- .../FurnitureAstral/MonolithWorkBench.cs | 28 +- .../FurnitureBotanic/BotanicBathtub.cs | 28 +- .../Placeables/FurnitureBotanic/BotanicBed.cs | 29 +- .../FurnitureBotanic/BotanicBench.cs | 29 +- .../FurnitureBotanic/BotanicBookcase.cs | 29 +- .../FurnitureBotanic/BotanicCandelabra.cs | 29 +- .../FurnitureBotanic/BotanicCandle.cs | 29 +- .../FurnitureBotanic/BotanicChair.cs | 28 +- .../FurnitureBotanic/BotanicChandelier.cs | 29 +- .../FurnitureBotanic/BotanicChest.cs | 30 +- .../FurnitureBotanic/BotanicClock.cs | 30 +- .../FurnitureBotanic/BotanicDoor.cs | 28 +- .../FurnitureBotanic/BotanicDresser.cs | 28 +- .../FurnitureBotanic/BotanicLamp.cs | 29 +- .../FurnitureBotanic/BotanicLantern.cs | 29 +- .../FurnitureBotanic/BotanicPiano.cs | 30 +- .../FurnitureBotanic/BotanicPlatform.cs | 26 +- .../FurnitureBotanic/BotanicSink.cs | 29 +- .../FurnitureBotanic/BotanicTable.cs | 28 +- .../FurnitureBotanic/BotanicWorkBench.cs | 28 +- .../FurnitureCosmilite/CosmiliteBasin.cs | 28 +- .../FurnitureCosmilite/CosmiliteBath.cs | 28 +- .../FurnitureCosmilite/CosmiliteBed.cs | 27 +- .../FurnitureCosmilite/CosmiliteBookcase.cs | 27 +- .../FurnitureCosmilite/CosmiliteBrick.cs | 39 +- .../FurnitureCosmilite/CosmiliteCandelabra.cs | 27 +- .../FurnitureCosmilite/CosmiliteCandle.cs | 27 +- .../FurnitureCosmilite/CosmiliteChair.cs | 26 +- .../FurnitureCosmilite/CosmiliteChandelier.cs | 28 +- .../FurnitureCosmilite/CosmiliteChest.cs | 28 +- .../FurnitureCosmilite/CosmiliteClock.cs | 29 +- .../FurnitureCosmilite/CosmiliteDoor.cs | 26 +- .../FurnitureCosmilite/CosmiliteDresser.cs | 26 +- .../FurnitureCosmilite/CosmiliteLamp.cs | 27 +- .../FurnitureCosmilite/CosmiliteLantern.cs | 27 +- .../FurnitureCosmilite/CosmilitePiano.cs | 28 +- .../FurnitureCosmilite/CosmilitePlatform.cs | 26 +- .../FurnitureCosmilite/CosmiliteSconce.cs | 27 +- .../FurnitureCosmilite/CosmiliteSink.cs | 27 +- .../FurnitureCosmilite/CosmiliteSofa.cs | 27 +- .../FurnitureCosmilite/CosmiliteTable.cs | 26 +- .../FurnitureCosmilite/CosmiliteWorkbench.cs | 28 +- .../FurnitureEutrophic/EutrophicBathtub.cs | 26 +- .../FurnitureEutrophic/EutrophicBed.cs | 27 +- .../FurnitureEutrophic/EutrophicBench.cs | 26 +- .../FurnitureEutrophic/EutrophicBookcase.cs | 27 +- .../FurnitureEutrophic/EutrophicCandelabra.cs | 27 +- .../FurnitureEutrophic/EutrophicCandle.cs | 27 +- .../FurnitureEutrophic/EutrophicChair.cs | 26 +- .../FurnitureEutrophic/EutrophicChandelier.cs | 28 +- .../FurnitureEutrophic/EutrophicChest.cs | 27 +- .../FurnitureEutrophic/EutrophicClock.cs | 28 +- .../FurnitureEutrophic/EutrophicDoor.cs | 26 +- .../FurnitureEutrophic/EutrophicDresser.cs | 26 +- .../FurnitureEutrophic/EutrophicLamp.cs | 27 +- .../FurnitureEutrophic/EutrophicLantern.cs | 27 +- .../FurnitureEutrophic/EutrophicPiano.cs | 28 +- .../FurnitureEutrophic/EutrophicPlatform.cs | 26 +- .../FurnitureEutrophic/EutrophicSink.cs | 27 +- .../FurnitureEutrophic/EutrophicTable.cs | 26 +- .../FurnitureEutrophic/EutrophicWorkBench.cs | 26 +- .../FurnitureEutrophic/SmoothNavystone.cs | 32 +- Items/Placeables/FurnitureExo/ExoBathtub.cs | 30 +- Items/Placeables/FurnitureExo/ExoBed.cs | 31 +- Items/Placeables/FurnitureExo/ExoBookcase.cs | 31 +- .../Placeables/FurnitureExo/ExoCandelabra.cs | 31 +- Items/Placeables/FurnitureExo/ExoCandle.cs | 31 +- Items/Placeables/FurnitureExo/ExoChair.cs | 30 +- .../Placeables/FurnitureExo/ExoChandelier.cs | 32 +- Items/Placeables/FurnitureExo/ExoChest.cs | 32 +- Items/Placeables/FurnitureExo/ExoClock.cs | 33 +- Items/Placeables/FurnitureExo/ExoConsole.cs | 29 +- Items/Placeables/FurnitureExo/ExoDisplay.cs | 29 +- Items/Placeables/FurnitureExo/ExoDoor.cs | 30 +- Items/Placeables/FurnitureExo/ExoDresser.cs | 30 +- Items/Placeables/FurnitureExo/ExoKeyboard.cs | 32 +- Items/Placeables/FurnitureExo/ExoLamp.cs | 31 +- Items/Placeables/FurnitureExo/ExoLantern.cs | 31 +- Items/Placeables/FurnitureExo/ExoPlatform.cs | 29 +- Items/Placeables/FurnitureExo/ExoPlating.cs | 42 +- .../Placeables/FurnitureExo/ExoPrismPanel.cs | 42 +- .../FurnitureExo/ExoPrismPlatform.cs | 31 +- Items/Placeables/FurnitureExo/ExoScreen.cs | 29 +- Items/Placeables/FurnitureExo/ExoServer.cs | 29 +- Items/Placeables/FurnitureExo/ExoSink.cs | 33 +- Items/Placeables/FurnitureExo/ExoSofa.cs | 31 +- Items/Placeables/FurnitureExo/ExoTable.cs | 30 +- Items/Placeables/FurnitureExo/ExoTerminal.cs | 29 +- Items/Placeables/FurnitureExo/ExoToilet.cs | 30 +- Items/Placeables/FurnitureExo/ExoWorkbench.cs | 29 +- .../FurnitureOccult/OccultBathtub.cs | 28 +- Items/Placeables/FurnitureOccult/OccultBed.cs | 29 +- .../FurnitureOccult/OccultBookcase.cs | 29 +- .../FurnitureOccult/OccultCandelabra.cs | 29 +- .../FurnitureOccult/OccultCandle.cs | 29 +- .../Placeables/FurnitureOccult/OccultChair.cs | 28 +- .../FurnitureOccult/OccultChandelier.cs | 29 +- .../Placeables/FurnitureOccult/OccultChest.cs | 29 +- .../Placeables/FurnitureOccult/OccultClock.cs | 30 +- .../Placeables/FurnitureOccult/OccultDoor.cs | 28 +- .../FurnitureOccult/OccultDresser.cs | 28 +- .../Placeables/FurnitureOccult/OccultLamp.cs | 29 +- .../FurnitureOccult/OccultLantern.cs | 29 +- .../Placeables/FurnitureOccult/OccultPiano.cs | 30 +- .../FurnitureOccult/OccultPlatform.cs | 28 +- .../Placeables/FurnitureOccult/OccultSink.cs | 29 +- .../Placeables/FurnitureOccult/OccultSofa.cs | 29 +- .../Placeables/FurnitureOccult/OccultStone.cs | 44 +- .../Placeables/FurnitureOccult/OccultTable.cs | 28 +- .../FurnitureOccult/OccultWorkBench.cs | 28 +- .../FurniturePlaguedPlate/PlaguedPlate.cs | 39 +- .../PlaguedPlateBasin.cs | 28 +- .../PlaguedPlateBathtub.cs | 27 +- .../FurniturePlaguedPlate/PlaguedPlateBed.cs | 27 +- .../PlaguedPlateBookcase.cs | 28 +- .../PlaguedPlateCandelabra.cs | 28 +- .../PlaguedPlateCandle.cs | 28 +- .../PlaguedPlateChair.cs | 27 +- .../PlaguedPlateChandelier.cs | 29 +- .../PlaguedPlateChest.cs | 29 +- .../PlaguedPlateClock.cs | 30 +- .../FurniturePlaguedPlate/PlaguedPlateDoor.cs | 27 +- .../PlaguedPlateDresser.cs | 27 +- .../FurniturePlaguedPlate/PlaguedPlateLamp.cs | 28 +- .../PlaguedPlateLantern.cs | 28 +- .../PlaguedPlatePiano.cs | 29 +- .../PlaguedPlatePlatform.cs | 26 +- .../FurniturePlaguedPlate/PlaguedPlateSink.cs | 28 +- .../FurniturePlaguedPlate/PlaguedPlateSofa.cs | 28 +- .../PlaguedPlateTable.cs | 27 +- .../PlaguedPlateWorkbench.cs | 27 +- .../FurnitureProfaned/ProfanedBath.cs | 28 +- .../FurnitureProfaned/ProfanedBed.cs | 27 +- .../FurnitureProfaned/ProfanedBench.cs | 27 +- .../FurnitureProfaned/ProfanedBookcase.cs | 27 +- .../FurnitureProfaned/ProfanedCandelabra.cs | 27 +- .../FurnitureProfaned/ProfanedCandle.cs | 27 +- .../FurnitureProfaned/ProfanedChair.cs | 26 +- .../FurnitureProfaned/ProfanedChandelier.cs | 28 +- .../FurnitureProfaned/ProfanedChest.cs | 28 +- .../FurnitureProfaned/ProfanedClock.cs | 29 +- .../FurnitureProfaned/ProfanedCrystal.cs | 33 +- .../FurnitureProfaned/ProfanedDoor.cs | 26 +- .../FurnitureProfaned/ProfanedDresser.cs | 26 +- .../FurnitureProfaned/ProfanedLamp.cs | 27 +- .../FurnitureProfaned/ProfanedLantern.cs | 27 +- .../FurnitureProfaned/ProfanedPiano.cs | 28 +- .../FurnitureProfaned/ProfanedPlatform.cs | 26 +- .../FurnitureProfaned/ProfanedRock.cs | 39 +- .../FurnitureProfaned/ProfanedSink.cs | 27 +- .../FurnitureProfaned/ProfanedSlab.cs | 32 +- .../FurnitureProfaned/ProfanedTable.cs | 26 +- .../FurnitureProfaned/ProfanedWorkbench.cs | 28 +- .../FurnitureProfaned/RunicProfanedBrick.cs | 33 +- .../Placeables/FurnitureSilva/SilvaBathtub.cs | 26 +- Items/Placeables/FurnitureSilva/SilvaBed.cs | 27 +- Items/Placeables/FurnitureSilva/SilvaBench.cs | 26 +- .../FurnitureSilva/SilvaBookcase.cs | 27 +- .../FurnitureSilva/SilvaCandelabra.cs | 27 +- .../Placeables/FurnitureSilva/SilvaCandle.cs | 27 +- Items/Placeables/FurnitureSilva/SilvaChair.cs | 26 +- .../FurnitureSilva/SilvaChandelier.cs | 28 +- Items/Placeables/FurnitureSilva/SilvaChest.cs | 27 +- Items/Placeables/FurnitureSilva/SilvaClock.cs | 29 +- .../Placeables/FurnitureSilva/SilvaCrystal.cs | 41 +- Items/Placeables/FurnitureSilva/SilvaDoor.cs | 26 +- .../Placeables/FurnitureSilva/SilvaDresser.cs | 26 +- Items/Placeables/FurnitureSilva/SilvaLamp.cs | 27 +- .../Placeables/FurnitureSilva/SilvaLantern.cs | 27 +- Items/Placeables/FurnitureSilva/SilvaPiano.cs | 28 +- .../FurnitureSilva/SilvaPlatform.cs | 26 +- Items/Placeables/FurnitureSilva/SilvaSink.cs | 27 +- Items/Placeables/FurnitureSilva/SilvaTable.cs | 26 +- .../FurnitureSilva/SilvaWorkBench.cs | 26 +- .../FurnitureStatigel/StatigelBath.cs | 28 +- .../FurnitureStatigel/StatigelBed.cs | 27 +- .../FurnitureStatigel/StatigelBlock.cs | 40 +- .../FurnitureStatigel/StatigelBookcase.cs | 27 +- .../FurnitureStatigel/StatigelCandelabra.cs | 27 +- .../FurnitureStatigel/StatigelCandle.cs | 27 +- .../FurnitureStatigel/StatigelChair.cs | 26 +- .../FurnitureStatigel/StatigelChandelier.cs | 28 +- .../FurnitureStatigel/StatigelChest.cs | 28 +- .../FurnitureStatigel/StatigelClock.cs | 29 +- .../FurnitureStatigel/StatigelDoor.cs | 26 +- .../FurnitureStatigel/StatigelDresser.cs | 26 +- .../FurnitureStatigel/StatigelLamp.cs | 27 +- .../FurnitureStatigel/StatigelLantern.cs | 27 +- .../FurnitureStatigel/StatigelPiano.cs | 28 +- .../FurnitureStatigel/StatigelPlatform.cs | 26 +- .../FurnitureStatigel/StatigelSink.cs | 27 +- .../FurnitureStatigel/StatigelSofa.cs | 27 +- .../FurnitureStatigel/StatigelTable.cs | 26 +- .../FurnitureStatigel/StatigelWorkbench.cs | 28 +- .../FurnitureStratus/StratusBathtub.cs | 26 +- .../Placeables/FurnitureStratus/StratusBed.cs | 27 +- .../FurnitureStratus/StratusBookcase.cs | 27 +- .../FurnitureStratus/StratusBricks.cs | 47 +- .../FurnitureStratus/StratusCandelabra.cs | 27 +- .../FurnitureStratus/StratusCandle.cs | 27 +- .../FurnitureStratus/StratusChair.cs | 26 +- .../FurnitureStratus/StratusChandelier.cs | 28 +- .../FurnitureStratus/StratusChest.cs | 28 +- .../FurnitureStratus/StratusClock.cs | 29 +- .../FurnitureStratus/StratusDoor.cs | 26 +- .../FurnitureStratus/StratusDresser.cs | 26 +- .../FurnitureStratus/StratusLamp.cs | 27 +- .../FurnitureStratus/StratusLantern.cs | 27 +- .../FurnitureStratus/StratusPiano.cs | 28 +- .../FurnitureStratus/StratusPlatform.cs | 26 +- .../FurnitureStratus/StratusSink.cs | 27 +- .../FurnitureStratus/StratusSofa.cs | 27 +- .../StratusStarPlatformItem.cs | 26 +- .../FurnitureStratus/StratusTable.cs | 26 +- .../FurnitureStratus/StratusWorkbench.cs | 28 +- .../FurnitureVoid/SmoothVoidstone.cs | 38 +- .../FurnitureVoid/SmoothVoidstonePlatform.cs | 26 +- Items/Placeables/FurnitureVoid/VoidBath.cs | 28 +- Items/Placeables/FurnitureVoid/VoidBed.cs | 27 +- .../Placeables/FurnitureVoid/VoidBookcase.cs | 27 +- .../FurnitureVoid/VoidCandelabra.cs | 27 +- Items/Placeables/FurnitureVoid/VoidCandle.cs | 27 +- Items/Placeables/FurnitureVoid/VoidChair.cs | 26 +- .../FurnitureVoid/VoidChandelier.cs | 28 +- Items/Placeables/FurnitureVoid/VoidChest.cs | 28 +- Items/Placeables/FurnitureVoid/VoidClock.cs | 31 +- Items/Placeables/FurnitureVoid/VoidDoor.cs | 26 +- Items/Placeables/FurnitureVoid/VoidDresser.cs | 26 +- Items/Placeables/FurnitureVoid/VoidLamp.cs | 27 +- Items/Placeables/FurnitureVoid/VoidLantern.cs | 27 +- Items/Placeables/FurnitureVoid/VoidPiano.cs | 28 +- Items/Placeables/FurnitureVoid/VoidSink.cs | 27 +- Items/Placeables/FurnitureVoid/VoidSofa.cs | 27 +- Items/Placeables/FurnitureVoid/VoidTable.cs | 26 +- .../Placeables/FurnitureVoid/VoidWorkbench.cs | 28 +- .../Placeables/FurnitureVoid/VoidstoneSlab.cs | 32 +- Items/Placeables/HardenedAstralSand.cs | 27 +- .../Placeables/HardenedSulphurousSandstone.cs | 27 +- .../LivingFire/LivingBrimstoneFireBlock.cs | 28 +- .../LivingFire/LivingGodSlayerFireBlock.cs | 28 +- .../LivingFire/LivingHolyFireBlock.cs | 28 +- Items/Placeables/Navystone.cs | 38 +- Items/Placeables/Ores/AerialiteOre.cs | 24 +- Items/Placeables/Ores/AstralOre.cs | 24 +- Items/Placeables/Ores/AuricOre.cs | 24 +- Items/Placeables/Ores/ChaoticOre.cs | 24 +- Items/Placeables/Ores/CharredOre.cs | 24 +- Items/Placeables/Ores/CryonicOre.cs | 24 +- Items/Placeables/Ores/ExodiumClusterOre.cs | 34 +- Items/Placeables/Ores/HallowedOre.cs | 24 +- Items/Placeables/Ores/PerennialOre.cs | 24 +- Items/Placeables/Ores/UelibloomOre.cs | 26 +- Items/Placeables/PerennialBrick.cs | 33 +- Items/Placeables/PlantyMush.cs | 24 +- Items/Placeables/Plates/Chaosplate.cs | 37 +- Items/Placeables/Plates/Cinderplate.cs | 37 +- Items/Placeables/Plates/Elumplate.cs | 37 +- Items/Placeables/Plates/Navyplate.cs | 37 +- .../Plates/PlagueContainmentCells.cs | 37 +- Items/Placeables/PrismShard.cs | 24 +- Items/Placeables/SeaPrism.cs | 30 +- Items/Placeables/SulphurousSand.cs | 27 +- Items/Placeables/SulphurousSandstone.cs | 27 +- Items/Placeables/Tenebris.cs | 24 +- Items/Placeables/UelibloomBrick.cs | 39 +- Items/Placeables/Voidstone.cs | 26 +- Items/Placeables/Walls/AbyssGravelWallItem.cs | 33 +- Items/Placeables/Walls/AerialiteBrickWall.cs | 26 +- Items/Placeables/Walls/AshenSlabWall.cs | 28 +- Items/Placeables/Walls/AstralBrickWall.cs | 26 +- Items/Placeables/Walls/AstralDirtWall.cs | 27 +- Items/Placeables/Walls/AstralFossilWall.cs | 27 +- Items/Placeables/Walls/AstralGrassWall.cs | 20 +- Items/Placeables/Walls/AstralIceWall.cs | 27 +- Items/Placeables/Walls/AstralMonolithWall.cs | 26 +- Items/Placeables/Walls/AstralSandstoneWall.cs | 27 +- Items/Placeables/Walls/AstralSnowWall.cs | 27 +- Items/Placeables/Walls/AstralStoneWall.cs | 27 +- Items/Placeables/Walls/BlueBrickWallUnsafe.cs | 20 +- Items/Placeables/Walls/BlueSlabWallUnsafe.cs | 20 +- Items/Placeables/Walls/BlueTiledWallUnsafe.cs | 20 +- Items/Placeables/Walls/BrimstoneSlagWall.cs | 26 +- Items/Placeables/Walls/ChaosplateWall.cs | 26 +- Items/Placeables/Walls/ChaoticBrickWall.cs | 26 +- Items/Placeables/Walls/CinderplateWall.cs | 26 +- Items/Placeables/Walls/CosmiliteBrickWall.cs | 26 +- Items/Placeables/Walls/CryonicBrickWall.cs | 26 +- .../DraedonStructures/HazardChevronWall.cs | 26 +- .../DraedonStructures/LaboratoryPanelWall.cs | 26 +- .../DraedonStructures/LaboratoryPlateBeam.cs | 26 +- .../LaboratoryPlatePillar.cs | 26 +- .../LaboratoryPlatingWall.cs | 26 +- .../DraedonStructures/RustedPlateBeam.cs | 26 +- .../DraedonStructures/RustedPlatePillar.cs | 26 +- .../DraedonStructures/RustedPlatingWall.cs | 26 +- Items/Placeables/Walls/ElumplateWall.cs | 26 +- Items/Placeables/Walls/EutrophicSandWall.cs | 26 +- .../Placeables/Walls/EutrophicSandWallSafe.cs | 26 +- Items/Placeables/Walls/ExoPlatingWallItem.cs | 26 +- .../Placeables/Walls/ExoPrismPanelWallItem.cs | 26 +- .../Placeables/Walls/GreenBrickWallUnsafe.cs | 20 +- Items/Placeables/Walls/GreenSlabWallUnsafe.cs | 20 +- .../Placeables/Walls/GreenTiledWallUnsafe.cs | 20 +- .../Walls/HardenedAstralSandWall.cs | 27 +- .../Walls/HardenedSulphurousSandstoneWall.cs | 27 +- Items/Placeables/Walls/NavyplateWall.cs | 26 +- Items/Placeables/Walls/NavystoneWall.cs | 26 +- Items/Placeables/Walls/NavystoneWallSafe.cs | 26 +- Items/Placeables/Walls/OccultStoneWall.cs | 28 +- Items/Placeables/Walls/PerennialBrickWall.cs | 26 +- Items/Placeables/Walls/PinkBrickWallUnsafe.cs | 20 +- Items/Placeables/Walls/PinkSlabWallUnsafe.cs | 20 +- Items/Placeables/Walls/PinkTiledWallUnsafe.cs | 20 +- .../Walls/PlagueContainmentCellsWall.cs | 26 +- Items/Placeables/Walls/PlaguedPlateWall.cs | 26 +- Items/Placeables/Walls/ProfanedCrystalWall.cs | 26 +- Items/Placeables/Walls/ProfanedRockWall.cs | 26 +- Items/Placeables/Walls/ProfanedSlabWall.cs | 26 +- .../Walls/RunicProfanedBrickWall.cs | 26 +- Items/Placeables/Walls/SilvaWall.cs | 26 +- .../Placeables/Walls/SmoothAbyssGravelWall.cs | 26 +- .../Walls/SmoothBrimstoneSlagWall.cs | 28 +- Items/Placeables/Walls/SmoothNavystoneWall.cs | 26 +- Items/Placeables/Walls/SmoothVoidstoneWall.cs | 26 +- Items/Placeables/Walls/StatigelWall.cs | 26 +- Items/Placeables/Walls/StratusWall.cs | 26 +- Items/Placeables/Walls/SulphurousSandWall.cs | 29 +- .../Walls/SulphurousSandstoneWall.cs | 27 +- Items/Placeables/Walls/UelibloomBrickWall.cs | 26 +- Items/Placeables/Walls/VoidstoneSlabWall.cs | 26 +- Items/Placeables/Walls/VoidstoneWall.cs | 26 +- Items/Potions/Alcohol/BloodyMary.cs | 26 +- Items/Potions/Alcohol/CaribbeanRum.cs | 26 +- Items/Potions/Alcohol/CinnamonRoll.cs | 26 +- Items/Potions/Alcohol/Everclear.cs | 26 +- Items/Potions/Alcohol/EvergreenGin.cs | 26 +- Items/Potions/Alcohol/FabsolsVodka.cs | 43 +- Items/Potions/Alcohol/Fireball.cs | 26 +- Items/Potions/Alcohol/GrapeBeer.cs | 28 +- Items/Potions/Alcohol/Margarita.cs | 28 +- Items/Potions/Alcohol/Moonshine.cs | 26 +- Items/Potions/Alcohol/MoscowMule.cs | 26 +- Items/Potions/Alcohol/OddMushroom.cs | 26 +- Items/Potions/Alcohol/RedWine.cs | 28 +- Items/Potions/Alcohol/Rum.cs | 26 +- Items/Potions/Alcohol/Screwdriver.cs | 26 +- Items/Potions/Alcohol/StarBeamRye.cs | 26 +- Items/Potions/Alcohol/Tequila.cs | 26 +- Items/Potions/Alcohol/TequilaSunrise.cs | 26 +- Items/Potions/Alcohol/Vodka.cs | 26 +- Items/Potions/Alcohol/Whiskey.cs | 26 +- Items/Potions/Alcohol/WhiteWine.cs | 30 +- Items/Potions/AnechoicCoating.cs | 33 +- Items/Potions/AstralInjection.cs | 44 +- Items/Potions/AstralJelly.cs | 30 +- Items/Potions/Baguette.cs | 34 +- Items/Potions/BoundingPotion.cs | 41 +- Items/Potions/CadencePotion.cs | 42 +- Items/Potions/CalamitasBrew.cs | 42 +- Items/Potions/CalciumPotion.cs | 40 +- Items/Potions/CeaselessHungerPotion.cs | 46 +- Items/Potions/CrumblingPotion.cs | 42 +- Items/Potions/DeliciousMeat.cs | 26 +- Items/Potions/DraconicElixir.cs | 56 +- Items/Potions/GravityNormalizerPotion.cs | 44 +- Items/Potions/HolyWrathPotion.cs | 44 +- Items/Potions/OmegaHealingPotion.cs | 35 +- Items/Potions/PenumbraPotion.cs | 44 +- Items/Potions/PhotosynthesisPotion.cs | 43 +- Items/Potions/PotionofOmniscience.cs | 41 +- Items/Potions/ProfanedRagePotion.cs | 44 +- Items/Potions/PurifiedJam.cs | 26 +- Items/Potions/RevivifyPotion.cs | 45 +- Items/Potions/ShadowPotion.cs | 42 +- Items/Potions/ShatteringPotion.cs | 43 +- Items/Potions/SoaringPotion.cs | 44 +- Items/Potions/SulphurskinPotion.cs | 41 +- Items/Potions/SunkenStew.cs | 50 +- Items/Potions/SupremeHealingPotion.cs | 33 +- Items/Potions/SupremeManaPotion.cs | 31 +- Items/Potions/TeslaPotion.cs | 42 +- Items/Potions/TitanScalePotion.cs | 44 +- Items/Potions/TriumphPotion.cs | 40 +- Items/Potions/YharimsStimulants.cs | 43 +- Items/Potions/ZenPotion.cs | 47 +- Items/Potions/ZergPotion.cs | 46 +- Items/RelicOfConvergence.cs | 26 +- Items/Rock.cs | 20 +- Items/SirenproofEarMuffs.cs | 17 +- Items/SummonItems/Abomination.cs | 27 +- Items/SummonItems/AncientMedallion.cs | 24 +- Items/SummonItems/AstralChunk.cs | 24 +- Items/SummonItems/BirbPheromones.cs | 24 +- Items/SummonItems/BlightedEyeball.cs | 25 +- Items/SummonItems/BloodwormItem.cs | 28 +- Items/SummonItems/BloodyWormFood.cs | 25 +- Items/SummonItems/BossRush.cs | 20 +- Items/SummonItems/BulbofDoom.cs | 28 +- Items/SummonItems/CharredIdol.cs | 25 +- Items/SummonItems/ChickenEgg.cs | 26 +- Items/SummonItems/CosmicWorm.cs | 41 +- Items/SummonItems/CryoKey.cs | 24 +- Items/SummonItems/DecapoditaSprout.cs | 23 +- Items/SummonItems/DraedonsRemote.cs | 17 +- Items/SummonItems/DriedSeafood.cs | 26 +- Items/SummonItems/EidolonTablet.cs | 16 +- Items/SummonItems/EyeofExtinction.cs | 13 +- Items/SummonItems/Invasion/CausticTear.cs | 24 +- .../Invasion/MartianDistressBeacon.cs | 18 +- Items/SummonItems/NecroplasmicBeacon.cs | 28 +- Items/SummonItems/OldPowerCell.cs | 26 +- Items/SummonItems/OverloadedSludge.cs | 24 +- Items/SummonItems/ProfanedCoreUnlimited.cs | 17 +- Items/SummonItems/ProfanedShard.cs | 24 +- Items/SummonItems/RuneofCos.cs | 29 +- Items/SummonItems/SandstormsCore.cs | 25 +- Items/SummonItems/Seafood.cs | 25 +- Items/SummonItems/Starcore.cs | 14 +- Items/SummonItems/Teratoma.cs | 25 +- Items/SuperDummy.cs | 27 +- Items/Tools/AbyssalWarhammer.cs | 36 +- Items/Tools/AerialHamaxe.cs | 39 +- Items/Tools/AstralHamaxe.cs | 38 +- Items/Tools/AstralPickaxe.cs | 36 +- Items/Tools/BeastialPickaxe.cs | 34 +- Items/Tools/BerserkerWaraxe.cs | 34 +- Items/Tools/BlossomPickaxe.cs | 38 +- Items/Tools/BobbitHook.cs | 16 +- Items/Tools/ChaoswarpedSlashaxe.cs | 36 +- Items/Tools/ClimateChange/AridArtifact.cs | 25 +- Items/Tools/ClimateChange/BloodIdol.cs | 25 +- Items/Tools/ClimateChange/Cosmolight.cs | 27 +- Items/Tools/ClimateChange/TorrentialTear.cs | 18 +- Items/Tools/CrystylCrusher.cs | 82 +- Items/Tools/FellerofEvergreens.cs | 48 +- Items/Tools/FlamebeakHampick.cs | 46 +- Items/Tools/GallantPickaxe.cs | 39 +- Items/Tools/Gelpick.cs | 38 +- Items/Tools/Grax.cs | 54 +- Items/Tools/GreatbayPickaxe.cs | 34 +- Items/Tools/InfernaCutter.cs | 40 +- Items/Tools/MarniteObliterator.cs | 48 +- Items/Tools/PurityAxe.cs | 51 +- Items/Tools/ReefclawHamaxe.cs | 36 +- Items/Tools/ShardlightPickaxe.cs | 36 +- Items/Tools/SkyfringePickaxe.cs | 37 +- Items/Tools/WulfrumAxe.cs | 36 +- Items/Tools/WulfrumHammer.cs | 36 +- Items/Tools/WulfrumPickaxe.cs | 36 +- Items/TreasureBags/AbyssalTreasure.cs | 10 +- Items/TreasureBags/AquaticScourgeBag.cs | 14 +- Items/TreasureBags/AstrageldonBag.cs | 12 +- Items/TreasureBags/AstrumDeusBag.cs | 14 +- Items/TreasureBags/BleachedAnglingKit.cs | 10 +- Items/TreasureBags/BrimstoneWaifuBag.cs | 12 +- Items/TreasureBags/BumblebirbBag.cs | 12 +- Items/TreasureBags/CalamitasBag.cs | 12 +- Items/TreasureBags/CeaselessVoidBag.cs | 12 +- Items/TreasureBags/CrabulonBag.cs | 12 +- Items/TreasureBags/CryogenBag.cs | 12 +- Items/TreasureBags/DesertScourgeBag.cs | 12 +- Items/TreasureBags/DevourerofGodsBag.cs | 16 +- Items/TreasureBags/DraedonTreasureBag.cs | 14 +- Items/TreasureBags/FleshyGeodeT1.cs | 10 +- Items/TreasureBags/FleshyGeodeT2.cs | 10 +- Items/TreasureBags/HiveMindBag.cs | 12 +- Items/TreasureBags/LeviathanBag.cs | 14 +- Items/TreasureBags/OldDukeBag.cs | 14 +- Items/TreasureBags/PerforatorBag.cs | 12 +- Items/TreasureBags/PlaguebringerGoliathBag.cs | 12 +- Items/TreasureBags/PolterghastBag.cs | 14 +- Items/TreasureBags/ProvidenceBag.cs | 12 +- Items/TreasureBags/RavagerBag.cs | 12 +- Items/TreasureBags/SCalBag.cs | 12 +- Items/TreasureBags/SandyAnglingKit.cs | 10 +- Items/TreasureBags/SignusBag.cs | 12 +- Items/TreasureBags/SlimeGodBag.cs | 12 +- Items/TreasureBags/StarterBag.cs | 10 +- Items/TreasureBags/StormWeaverBag.cs | 12 +- Items/TreasureBags/SulphuricTreasure.cs | 10 +- Items/TreasureBags/YharonBag.cs | 12 +- .../AdamantiteArmorSetChange.cs | 6 +- .../MonkT2ArmorSetChange.cs | 14 +- Items/VoodooDemonVoodooDoll.cs | 17 +- .../DraedonsArsenal/FrequencyManipulator.cs | 43 +- .../DraedonsArsenal/GalvanizingGlaive.cs | 49 +- Items/Weapons/DraedonsArsenal/GatlingLaser.cs | 49 +- Items/Weapons/DraedonsArsenal/GaussDagger.cs | 39 +- Items/Weapons/DraedonsArsenal/GaussPistol.cs | 41 +- Items/Weapons/DraedonsArsenal/GaussRifle.cs | 39 +- .../DraedonsArsenal/HydraulicVoltCrasher.cs | 47 +- Items/Weapons/DraedonsArsenal/LaserRifle.cs | 41 +- .../DraedonsArsenal/MatterModulator.cs | 39 +- .../Weapons/DraedonsArsenal/MountedScanner.cs | 41 +- Items/Weapons/DraedonsArsenal/Phaseslayer.cs | 45 +- Items/Weapons/DraedonsArsenal/PlasmaCaster.cs | 43 +- .../Weapons/DraedonsArsenal/PlasmaGrenade.cs | 43 +- Items/Weapons/DraedonsArsenal/PoleWarper.cs | 43 +- Items/Weapons/DraedonsArsenal/PulseDragon.cs | 45 +- Items/Weapons/DraedonsArsenal/PulsePistol.cs | 39 +- Items/Weapons/DraedonsArsenal/PulseRifle.cs | 41 +- .../DraedonsArsenal/PulseTurretRemote.cs | 43 +- Items/Weapons/DraedonsArsenal/SnakeEyes.cs | 43 +- .../StarSwallowerContainmentUnit.cs | 43 +- Items/Weapons/DraedonsArsenal/SystemBane.cs | 43 +- Items/Weapons/DraedonsArsenal/Taser.cs | 41 +- Items/Weapons/DraedonsArsenal/TeslaCannon.cs | 43 +- Items/Weapons/DraedonsArsenal/TrackingDisk.cs | 41 +- Items/Weapons/DraedonsArsenal/WavePounder.cs | 41 +- Items/Weapons/Magic/AbyssShocker.cs | 36 +- Items/Weapons/Magic/AbyssalTome.cs | 32 +- Items/Weapons/Magic/AcidGun.cs | 37 +- Items/Weapons/Magic/AlphaRay.cs | 41 +- Items/Weapons/Magic/AlulaAustralis.cs | 34 +- Items/Weapons/Magic/ApoctosisArray.cs | 39 +- Items/Weapons/Magic/Apotheosis.cs | 48 +- Items/Weapons/Magic/AquamarineStaff.cs | 50 +- Items/Weapons/Magic/ArchAmaryllis.cs | 41 +- Items/Weapons/Magic/ArcticBearPaw.cs | 34 +- Items/Weapons/Magic/ArtAttack.cs | 45 +- Items/Weapons/Magic/AsteroidStaff.cs | 43 +- Items/Weapons/Magic/AstralStaff.cs | 40 +- Items/Weapons/Magic/AstralachneaStaff.cs | 36 +- Items/Weapons/Magic/Atlantis.cs | 34 +- Items/Weapons/Magic/AuguroftheElements.cs | 46 +- Items/Weapons/Magic/BelchingSaxophone.cs | 30 +- Items/Weapons/Magic/BlackAnurian.cs | 32 +- Items/Weapons/Magic/BloodBath.cs | 44 +- Items/Weapons/Magic/BlushieStaff.cs | 44 +- Items/Weapons/Magic/BrimroseStaff.cs | 40 +- Items/Weapons/Magic/BurningSea.cs | 39 +- Items/Weapons/Magic/CalamitasInferno.cs | 30 +- Items/Weapons/Magic/CarnageRay.cs | 45 +- Items/Weapons/Magic/ClamorNoctus.cs | 47 +- Items/Weapons/Magic/Climax.cs | 43 +- Items/Weapons/Magic/ClothiersWrath.cs | 32 +- Items/Weapons/Magic/CoralSpout.cs | 39 +- Items/Weapons/Magic/CosmicRainbow.cs | 44 +- Items/Weapons/Magic/Cryophobia.cs | 32 +- Items/Weapons/Magic/CrystalFlareStaff.cs | 44 +- Items/Weapons/Magic/DarkSpark.cs | 53 +- Items/Weapons/Magic/DeathValley.cs | 42 +- Items/Weapons/Magic/DeathhailStaff.cs | 44 +- Items/Weapons/Magic/DivineRetribution.cs | 47 +- Items/Weapons/Magic/Downpour.cs | 34 +- Items/Weapons/Magic/Effervescence.cs | 41 +- Items/Weapons/Magic/EidolicWail.cs | 36 +- Items/Weapons/Magic/EldritchTome.cs | 38 +- Items/Weapons/Magic/ElementalRay.cs | 52 +- Items/Weapons/Magic/Eternity.cs | 51 +- Items/Weapons/Magic/EventHorizon.cs | 42 +- Items/Weapons/Magic/EvergladeSpray.cs | 46 +- Items/Weapons/Magic/Fabstaff.cs | 44 +- Items/Weapons/Magic/FaceMelter.cs | 52 +- Items/Weapons/Magic/FatesReveal.cs | 40 +- Items/Weapons/Magic/FlareBolt.cs | 41 +- Items/Weapons/Magic/ForbiddenSun.cs | 37 +- Items/Weapons/Magic/FrigidflashBolt.cs | 41 +- Items/Weapons/Magic/FrostBolt.cs | 41 +- Items/Weapons/Magic/GammaFusillade.cs | 41 +- Items/Weapons/Magic/Genisis.cs | 40 +- Items/Weapons/Magic/GhastlyVisage.cs | 36 +- Items/Weapons/Magic/GleamingMagnolia.cs | 41 +- Items/Weapons/Magic/GloriousEnd.cs | 34 +- Items/Weapons/Magic/GruesomeEminence.cs | 36 +- Items/Weapons/Magic/HadopelagicEcho.cs | 44 +- Items/Weapons/Magic/HarvestStaff.cs | 43 +- Items/Weapons/Magic/HeliumFlash.cs | 47 +- Items/Weapons/Magic/HellBurst.cs | 42 +- Items/Weapons/Magic/HellwingStaff.cs | 43 +- Items/Weapons/Magic/Hematemesis.cs | 34 +- Items/Weapons/Magic/Heresy.cs | 38 +- Items/Weapons/Magic/HyphaeRod.cs | 36 +- Items/Weapons/Magic/IceBarrage.cs | 51 +- Items/Weapons/Magic/IcicleStaff.cs | 51 +- Items/Weapons/Magic/IcicleTrident.cs | 34 +- Items/Weapons/Magic/InfernalRift.cs | 46 +- Items/Weapons/Magic/IonBlaster.cs | 39 +- Items/Weapons/Magic/Judgement.cs | 45 +- Items/Weapons/Magic/Keelhaul.cs | 36 +- Items/Weapons/Magic/Lazhar.cs | 41 +- Items/Weapons/Magic/LightGodsBrilliance.cs | 46 +- .../Magic/MadAlchemistsCocktailGlove.cs | 47 +- Items/Weapons/Magic/MagnaCannon.cs | 41 +- Items/Weapons/Magic/MagneticMeltdown.cs | 42 +- Items/Weapons/Magic/ManaRose.cs | 42 +- Items/Weapons/Magic/Miasma.cs | 40 +- Items/Weapons/Magic/Mistlestorm.cs | 47 +- Items/Weapons/Magic/NightsRay.cs | 45 +- Items/Weapons/Magic/NuclearFury.cs | 43 +- Items/Weapons/Magic/ParasiticSceptor.cs | 32 +- Items/Weapons/Magic/PhantasmalFury.cs | 44 +- Items/Weapons/Magic/PhoenixFlameBarrage.cs | 40 +- Items/Weapons/Magic/PlagueStaff.cs | 36 +- Items/Weapons/Magic/PlasmaRifle.cs | 52 +- Items/Weapons/Magic/PlasmaRod.cs | 34 +- Items/Weapons/Magic/Poseidon.cs | 32 +- Items/Weapons/Magic/PrimordialAncient.cs | 43 +- Items/Weapons/Magic/PrimordialEarth.cs | 41 +- Items/Weapons/Magic/Purge.cs | 42 +- Items/Weapons/Magic/PurgeGuzzler.cs | 32 +- Items/Weapons/Magic/RainbowPartyCannon.cs | 57 +- Items/Weapons/Magic/Rancor.cs | 36 +- Items/Weapons/Magic/RecitationoftheBeast.cs | 43 +- Items/Weapons/Magic/RelicofRuin.cs | 42 +- Items/Weapons/Magic/RougeSlash.cs | 32 +- Items/Weapons/Magic/SHPC.cs | 42 +- Items/Weapons/Magic/SanguineFlare.cs | 42 +- Items/Weapons/Magic/SeethingDischarge.cs | 32 +- Items/Weapons/Magic/Serpentine.cs | 36 +- Items/Weapons/Magic/ShadecrystalTome.cs | 39 +- Items/Weapons/Magic/ShaderainStaff.cs | 40 +- Items/Weapons/Magic/ShadowboltStaff.cs | 44 +- Items/Weapons/Magic/ShadowdropStaff.cs | 44 +- Items/Weapons/Magic/ShiftingSands.cs | 41 +- Items/Weapons/Magic/SirensSong.cs | 30 +- Items/Weapons/Magic/SkyGlaze.cs | 36 +- Items/Weapons/Magic/SlitheringEels.cs | 30 +- Items/Weapons/Magic/SnowstormStaff.cs | 32 +- Items/Weapons/Magic/SoulPiercer.cs | 42 +- Items/Weapons/Magic/StardustStaff.cs | 38 +- Items/Weapons/Magic/Starfall.cs | 34 +- Items/Weapons/Magic/StormSpray.cs | 34 +- Items/Weapons/Magic/StratusSphere.cs | 53 +- Items/Weapons/Magic/SubsumingVortex.cs | 43 +- Items/Weapons/Magic/T1000.cs | 46 +- Items/Weapons/Magic/TacticiansTrumpCard.cs | 58 +- Items/Weapons/Magic/TearsofHeaven.cs | 41 +- Items/Weapons/Magic/TerraRay.cs | 50 +- Items/Weapons/Magic/ThePrince.cs | 44 +- Items/Weapons/Magic/TheSwarmer.cs | 40 +- Items/Weapons/Magic/TheWand.cs | 45 +- Items/Weapons/Magic/ThornBlossom.cs | 44 +- Items/Weapons/Magic/Thunderstorm.cs | 34 +- Items/Weapons/Magic/TomeofFates.cs | 45 +- Items/Weapons/Magic/Tradewinds.cs | 40 +- Items/Weapons/Magic/UltraLiquidator.cs | 45 +- Items/Weapons/Magic/UndinesRetribution.cs | 44 +- Items/Weapons/Magic/ValkyrieRay.cs | 47 +- Items/Weapons/Magic/Vehemenc.cs | 40 +- Items/Weapons/Magic/VenusianTrident.cs | 44 +- Items/Weapons/Magic/Vesuvius.cs | 34 +- Items/Weapons/Magic/Viscera.cs | 42 +- Items/Weapons/Magic/VitriolicViper.cs | 32 +- Items/Weapons/Magic/VividClarity.cs | 64 +- Items/Weapons/Magic/VoidVortex.cs | 43 +- Items/Weapons/Magic/Waywasher.cs | 32 +- Items/Weapons/Magic/Wingman.cs | 32 +- Items/Weapons/Magic/WintersFury.cs | 39 +- Items/Weapons/Magic/WrathoftheAncients.cs | 30 +- Items/Weapons/Magic/WulfrumStaff.cs | 38 +- Items/Weapons/Magic/WyvernsCall.cs | 44 +- Items/Weapons/Magic/YharimsCrystal.cs | 40 +- Items/Weapons/Magic/Zapper.cs | 43 +- Items/Weapons/Melee/AbsoluteZero.cs | 30 +- Items/Weapons/Melee/AbyssBlade.cs | 40 +- Items/Weapons/Melee/AegisBlade.cs | 42 +- Items/Weapons/Melee/Aftershock.cs | 38 +- Items/Weapons/Melee/AirSpinner.cs | 46 +- Items/Weapons/Melee/AmidiasTrident.cs | 36 +- Items/Weapons/Melee/AnarchyBlade.cs | 36 +- Items/Weapons/Melee/AncientShiv.cs | 32 +- Items/Weapons/Melee/Animus.cs | 37 +- Items/Weapons/Melee/Aorta.cs | 48 +- Items/Weapons/Melee/AquaticDischarge.cs | 32 +- Items/Weapons/Melee/AquaticDissolution.cs | 42 +- Items/Weapons/Melee/ArkoftheAncients.cs | 54 +- Items/Weapons/Melee/ArkoftheCosmos.cs | 54 +- Items/Weapons/Melee/ArkoftheElements.cs | 60 +- Items/Weapons/Melee/AstralBlade.cs | 39 +- Items/Weapons/Melee/AstralPike.cs | 44 +- Items/Weapons/Melee/AstralScythe.cs | 30 +- Items/Weapons/Melee/Ataraxia.cs | 49 +- Items/Weapons/Melee/Avalanche.cs | 32 +- Items/Weapons/Melee/Azathoth.cs | 52 +- Items/Weapons/Melee/BalefulHarvester.cs | 38 +- Items/Weapons/Melee/BallOFugu.cs | 34 +- Items/Weapons/Melee/BansheeHook.cs | 44 +- Items/Weapons/Melee/Basher.cs | 33 +- Items/Weapons/Melee/BiomeBlade.cs | 76 +- Items/Weapons/Melee/BladecrestOathsword.cs | 32 +- Items/Weapons/Melee/BladeofEnmity.cs | 35 +- Items/Weapons/Melee/BloodyEdge.cs | 46 +- Items/Weapons/Melee/BloodyRupture.cs | 40 +- Items/Weapons/Melee/Bonebreaker.cs | 41 +- Items/Weapons/Melee/Brimlance.cs | 38 +- Items/Weapons/Melee/Brimlash.cs | 36 +- Items/Weapons/Melee/BrimlashBuster.cs | 36 +- Items/Weapons/Melee/BrinyBaron.cs | 46 +- Items/Weapons/Melee/BurntSienna.cs | 26 +- Items/Weapons/Melee/Carnage.cs | 35 +- Items/Weapons/Melee/CatastropheClaymore.cs | 42 +- Items/Weapons/Melee/CausticEdge.cs | 37 +- Items/Weapons/Melee/CelestialClaymore.cs | 30 +- Items/Weapons/Melee/Chaotrix.cs | 46 +- Items/Weapons/Melee/ClamCrusher.cs | 34 +- Items/Weapons/Melee/Cnidarian.cs | 46 +- Items/Weapons/Melee/ColdheartIcicle.cs | 24 +- Items/Weapons/Melee/CometQuasher.cs | 43 +- Items/Weapons/Melee/CorruptedCrusherBlade.cs | 38 +- Items/Weapons/Melee/CosmicDischarge.cs | 36 +- Items/Weapons/Melee/CosmicShiv.cs | 45 +- Items/Weapons/Melee/CrescentMoon.cs | 44 +- Items/Weapons/Melee/CrimsonCrusherBlade.cs | 38 +- Items/Weapons/Melee/CrystalBlade.cs | 39 +- Items/Weapons/Melee/DarklightGreatsword.cs | 41 +- Items/Weapons/Melee/DepthBlade.cs | 32 +- Items/Weapons/Melee/Devastation.cs | 41 +- Items/Weapons/Melee/DevilsDevastation.cs | 48 +- Items/Weapons/Melee/DevilsSunrise.cs | 44 +- Items/Weapons/Melee/DiseasedPike.cs | 38 +- Items/Weapons/Melee/DivineHatchet.cs | 43 +- Items/Weapons/Melee/DraconicDestruction.cs | 41 +- Items/Weapons/Melee/DraedonsExoblade.cs | 52 +- Items/Weapons/Melee/DragonPow.cs | 50 +- Items/Weapons/Melee/DragonRage.cs | 36 +- Items/Weapons/Melee/Earth.cs | 42 +- Items/Weapons/Melee/EarthenPike.cs | 36 +- Items/Weapons/Melee/ElementalExcalibur.cs | 55 +- Items/Weapons/Melee/ElementalShortsword.cs | 42 +- Items/Weapons/Melee/EmpyreanKnives.cs | 45 +- Items/Weapons/Melee/EssenceFlayer.cs | 40 +- Items/Weapons/Melee/EutrophicScimitar.cs | 30 +- Items/Weapons/Melee/EutrophicShank.cs | 32 +- Items/Weapons/Melee/EvilSmasher.cs | 26 +- Items/Weapons/Melee/ExcaliburShortsword.cs | 34 +- Items/Weapons/Melee/Excelsus.cs | 34 +- Items/Weapons/Melee/ExoGladius.cs | 45 +- Items/Weapons/Melee/ExsanguinationLance.cs | 44 +- Items/Weapons/Melee/FeralthornClaymore.cs | 32 +- Items/Weapons/Melee/FlameburstShortsword.cs | 38 +- Items/Weapons/Melee/FlarefrostBlade.cs | 38 +- Items/Weapons/Melee/Floodtide.cs | 41 +- Items/Weapons/Melee/ForbiddenOathblade.cs | 47 +- Items/Weapons/Melee/ForsakenSaber.cs | 37 +- Items/Weapons/Melee/FourSeasonsGalaxia.cs | 54 +- Items/Weapons/Melee/FulgurationHalberd.cs | 57 +- Items/Weapons/Melee/GaelsGreatsword.cs | 38 +- Items/Weapons/Melee/GalacticaBlade.cs | 46 +- Items/Weapons/Melee/GalaxySmasherMelee.cs | 41 +- Items/Weapons/Melee/GalileoGladius.cs | 42 +- Items/Weapons/Melee/GeliticBlade.cs | 38 +- Items/Weapons/Melee/GildedProboscis.cs | 38 +- Items/Weapons/Melee/GlacialCrusher.cs | 32 +- Items/Weapons/Melee/GoldplumeSpear.cs | 43 +- Items/Weapons/Melee/GrandGuardian.cs | 38 +- Items/Weapons/Melee/GreatswordofBlah.cs | 38 +- Items/Weapons/Melee/GreatswordofJudgement.cs | 36 +- Items/Weapons/Melee/Greentide.cs | 48 +- Items/Weapons/Melee/HellfireFlamberge.cs | 39 +- Items/Weapons/Melee/HellionFlowerSpear.cs | 42 +- Items/Weapons/Melee/Hellkite.cs | 40 +- Items/Weapons/Melee/HolyCollider.cs | 49 +- Items/Weapons/Melee/InsidiousImpaler.cs | 36 +- Items/Weapons/Melee/Lacerator.cs | 48 +- Items/Weapons/Melee/LeechingDagger.cs | 40 +- Items/Weapons/Melee/LifefruitScythe.cs | 38 +- Items/Weapons/Melee/LionHeart.cs | 38 +- Items/Weapons/Melee/Lucrecia.cs | 45 +- Items/Weapons/Melee/MajesticGuard.cs | 42 +- Items/Weapons/Melee/MandibleClaws.cs | 26 +- Items/Weapons/Melee/MantisClaws.cs | 26 +- Items/Weapons/Melee/Mariana.cs | 44 +- Items/Weapons/Melee/MarniteSpear.cs | 46 +- Items/Weapons/Melee/MirrorBlade.cs | 34 +- Items/Weapons/Melee/MonstrousKnives.cs | 45 +- Items/Weapons/Melee/Mourningstar.cs | 45 +- Items/Weapons/Melee/Murasama.cs | 54 +- Items/Weapons/Melee/MycelialClaws.cs | 26 +- Items/Weapons/Melee/Nadir.cs | 45 +- Items/Weapons/Melee/Nebulash.cs | 34 +- Items/Weapons/Melee/NeptunesBounty.cs | 41 +- Items/Weapons/Melee/NightsStabber.cs | 50 +- Items/Weapons/Melee/OldLordOathsword.cs | 32 +- Items/Weapons/Melee/OmegaBiomeBlade.cs | 67 +- Items/Weapons/Melee/Omniblade.cs | 48 +- Items/Weapons/Melee/Oracle.cs | 50 +- Items/Weapons/Melee/PerfectDark.cs | 38 +- Items/Weapons/Melee/PhoenixBlade.cs | 41 +- Items/Weapons/Melee/PhosphorescentGauntlet.cs | 36 +- Items/Weapons/Melee/PhotonRipper.cs | 38 +- Items/Weapons/Melee/PlagueKeeper.cs | 40 +- Items/Weapons/Melee/PrismaticBreaker.cs | 72 +- Items/Weapons/Melee/ProfanedSword.cs | 48 +- Items/Weapons/Melee/PwnagehammerMelee.cs | 40 +- Items/Weapons/Melee/Quagmire.cs | 46 +- Items/Weapons/Melee/RedSun.cs | 45 +- Items/Weapons/Melee/RedtideSword.cs | 36 +- Items/Weapons/Melee/RemsRevenge.cs | 44 +- Items/Weapons/Melee/Roxcalibur.cs | 60 +- Items/Weapons/Melee/RoyalKnivesMelee.cs | 44 +- Items/Weapons/Melee/SausageMaker.cs | 46 +- Items/Weapons/Melee/ScourgeoftheCosmos.cs | 40 +- Items/Weapons/Melee/SeashineSword.cs | 29 +- Items/Weapons/Melee/Shimmerspark.cs | 46 +- Items/Weapons/Melee/SolarFlare.cs | 42 +- Items/Weapons/Melee/SolsticeClaymore.cs | 39 +- Items/Weapons/Melee/SoulEdge.cs | 30 +- Items/Weapons/Melee/SoulHarvester.cs | 45 +- Items/Weapons/Melee/SpatialLance.cs | 45 +- Items/Weapons/Melee/SpineOfThanatos.cs | 34 +- Items/Weapons/Melee/SporeKnife.cs | 39 +- Items/Weapons/Melee/StarnightLance.cs | 42 +- Items/Weapons/Melee/StellarContemptMelee.cs | 41 +- Items/Weapons/Melee/StellarStriker.cs | 44 +- Items/Weapons/Melee/StormRuler.cs | 39 +- Items/Weapons/Melee/StormSaber.cs | 30 +- Items/Weapons/Melee/StreamGouge.cs | 48 +- Items/Weapons/Melee/SubmarineShocker.cs | 30 +- Items/Weapons/Melee/SulphurousGrabber.cs | 38 +- Items/Weapons/Melee/Swordsplosion.cs | 30 +- Items/Weapons/Melee/TeardropCleaver.cs | 26 +- Items/Weapons/Melee/TemporalFloeSword.cs | 38 +- Items/Weapons/Melee/TenebreusTides.cs | 45 +- Items/Weapons/Melee/TerraEdge.cs | 48 +- Items/Weapons/Melee/TerraLance.cs | 45 +- Items/Weapons/Melee/TerraShiv.cs | 42 +- Items/Weapons/Melee/Terracotta.cs | 34 +- Items/Weapons/Melee/Terratomere.cs | 52 +- Items/Weapons/Melee/TerrorBlade.cs | 32 +- Items/Weapons/Melee/TheBurningSky.cs | 37 +- Items/Weapons/Melee/TheEnforcer.cs | 51 +- Items/Weapons/Melee/TheEyeofCalamitas.cs | 40 +- Items/Weapons/Melee/TheGodsGambit.cs | 46 +- Items/Weapons/Melee/TheLastMourning.cs | 45 +- Items/Weapons/Melee/TheMicrowave.cs | 40 +- Items/Weapons/Melee/TheMutilator.cs | 39 +- Items/Weapons/Melee/TheObliterator.cs | 42 +- Items/Weapons/Melee/ThePlaguebringer.cs | 40 +- Items/Weapons/Melee/TitanArm.cs | 28 +- ...tisTruePaladinianMageHammerofMightMelee.cs | 42 +- Items/Weapons/Melee/Trinity.cs | 36 +- Items/Weapons/Melee/TrueArkoftheAncients.cs | 45 +- Items/Weapons/Melee/TrueBiomeBlade.cs | 65 +- Items/Weapons/Melee/TrueBloodyEdge.cs | 37 +- Items/Weapons/Melee/TrueCausticEdge.cs | 39 +- .../Weapons/Melee/TrueExcaliburShortsword.cs | 41 +- Items/Weapons/Melee/TrueForbiddenOathblade.cs | 44 +- Items/Weapons/Melee/TrueNightsStabber.cs | 41 +- .../Weapons/Melee/TruePaladinsHammerMelee.cs | 42 +- .../Melee/TrueTyrantYharimsUltisword.cs | 40 +- Items/Weapons/Melee/Tumbleweed.cs | 42 +- Items/Weapons/Melee/TyphonsGreed.cs | 42 +- Items/Weapons/Melee/TyrantYharimsUltisword.cs | 39 +- Items/Weapons/Melee/UltimusCleaver.cs | 35 +- Items/Weapons/Melee/UrchinFlail.cs | 34 +- Items/Weapons/Melee/UrchinSpear.cs | 42 +- Items/Weapons/Melee/VeinBurster.cs | 38 +- Items/Weapons/Melee/Verdant.cs | 50 +- Items/Weapons/Melee/Violence.cs | 38 +- Items/Weapons/Melee/VirulentKatana.cs | 28 +- Items/Weapons/Melee/Waraxe.cs | 26 +- Items/Weapons/Melee/Warblade.cs | 26 +- Items/Weapons/Melee/Whirlpool.cs | 47 +- Items/Weapons/Melee/WindBlade.cs | 37 +- Items/Weapons/Melee/WulfrumBlade.cs | 32 +- Items/Weapons/Melee/XerocsGreatsword.cs | 36 +- Items/Weapons/Melee/YateveoBloom.cs | 58 +- Items/Weapons/Melee/YinYo.cs | 47 +- Items/Weapons/Ranged/AMR.cs | 43 +- Items/Weapons/Ranged/AcesHigh.cs | 45 +- Items/Weapons/Ranged/Alluvion.cs | 48 +- Items/Weapons/Ranged/AngelicShotgun.cs | 48 +- Items/Weapons/Ranged/Animosity.cs | 56 +- Items/Weapons/Ranged/AquashardShotgun.cs | 44 +- Items/Weapons/Ranged/Arbalest.cs | 39 +- Items/Weapons/Ranged/Archerfish.cs | 34 +- Items/Weapons/Ranged/ArterialAssault.cs | 44 +- Items/Weapons/Ranged/AstralBlaster.cs | 40 +- Items/Weapons/Ranged/AstralRepeater.cs | 42 +- Items/Weapons/Ranged/AstrealDefeat.cs | 48 +- Items/Weapons/Ranged/Auralis.cs | 47 +- Items/Weapons/Ranged/AuroraBlazer.cs | 34 +- Items/Weapons/Ranged/Barinade.cs | 34 +- Items/Weapons/Ranged/Barinautical.cs | 36 +- Items/Weapons/Ranged/BarracudaGun.cs | 42 +- Items/Weapons/Ranged/BladedgeGreatbow.cs | 40 +- Items/Weapons/Ranged/BlissfulBombardier.cs | 34 +- Items/Weapons/Ranged/BloodBoiler.cs | 36 +- Items/Weapons/Ranged/BlossomFlux.cs | 46 +- Items/Weapons/Ranged/BrimstoneFlameblaster.cs | 32 +- Items/Weapons/Ranged/BrimstoneFlamesprayer.cs | 32 +- Items/Weapons/Ranged/BrimstoneFury.cs | 40 +- Items/Weapons/Ranged/BulletFilledShotgun.cs | 49 +- Items/Weapons/Ranged/Butcher.cs | 49 +- Items/Weapons/Ranged/ChargedDartRifle.cs | 52 +- Items/Weapons/Ranged/ChickenCannon.cs | 41 +- Items/Weapons/Ranged/ClamorRifle.cs | 34 +- Items/Weapons/Ranged/ClaretCannon.cs | 44 +- Items/Weapons/Ranged/CleansingBlaze.cs | 42 +- Items/Weapons/Ranged/ClockGatlignum.cs | 46 +- Items/Weapons/Ranged/ClockworkBow.cs | 43 +- Items/Weapons/Ranged/Condemnation.cs | 40 +- Items/Weapons/Ranged/Contagion.cs | 48 +- Items/Weapons/Ranged/CoralCannon.cs | 32 +- Items/Weapons/Ranged/CorrodedCaustibow.cs | 42 +- Items/Weapons/Ranged/CosmicBolter.cs | 43 +- Items/Weapons/Ranged/CursedCapper.cs | 41 +- Items/Weapons/Ranged/DaemonsFlame.cs | 42 +- Items/Weapons/Ranged/DarkechoGreatbow.cs | 40 +- Items/Weapons/Ranged/Deathwind.cs | 38 +- Items/Weapons/Ranged/DodusHandcannon.cs | 48 +- Items/Weapons/Ranged/DragonsBreath.cs | 49 +- Items/Weapons/Ranged/Drataliornus.cs | 57 +- Items/Weapons/Ranged/Dualpoon.cs | 40 +- Items/Weapons/Ranged/EffluviumBow.cs | 34 +- Items/Weapons/Ranged/ElementalBlaster.cs | 40 +- Items/Weapons/Ranged/ElementalEruption.cs | 43 +- Items/Weapons/Ranged/EternalBlizzard.cs | 36 +- Items/Weapons/Ranged/Eviscerator.cs | 42 +- Items/Weapons/Ranged/FetidEmesis.cs | 35 +- Items/Weapons/Ranged/FirestormCannon.cs | 43 +- Items/Weapons/Ranged/FlakKraken.cs | 45 +- Items/Weapons/Ranged/FlakToxicannon.cs | 30 +- Items/Weapons/Ranged/FlarewingBow.cs | 43 +- Items/Weapons/Ranged/FlurrystormCannon.cs | 53 +- Items/Weapons/Ranged/FrostbiteBlaster.cs | 45 +- Items/Weapons/Ranged/Fungicide.cs | 34 +- Items/Weapons/Ranged/Galeforce.cs | 41 +- Items/Weapons/Ranged/GoldenEagle.cs | 34 +- Items/Weapons/Ranged/Goobow.cs | 42 +- Items/Weapons/Ranged/GreatbowofTurmoil.cs | 40 +- Items/Weapons/Ranged/GunkShot.cs | 42 +- Items/Weapons/Ranged/HalibutCannon.cs | 37 +- Items/Weapons/Ranged/HalleysInferno.cs | 41 +- Items/Weapons/Ranged/HandheldTank.cs | 44 +- Items/Weapons/Ranged/HeavenlyGale.cs | 46 +- Items/Weapons/Ranged/Hellborn.cs | 37 +- Items/Weapons/Ranged/Helstorm.cs | 38 +- Items/Weapons/Ranged/Impaler.cs | 43 +- Items/Weapons/Ranged/Infinity.cs | 45 +- Items/Weapons/Ranged/Interfacer.cs | 47 +- Items/Weapons/Ranged/Karasawa.cs | 49 +- Items/Weapons/Ranged/Leviatitan.cs | 34 +- Items/Weapons/Ranged/LunarianBow.cs | 52 +- Items/Weapons/Ranged/MagnaStriker.cs | 45 +- Items/Weapons/Ranged/MagnomalyCannon.cs | 44 +- Items/Weapons/Ranged/Malevolence.cs | 34 +- Items/Weapons/Ranged/MandibleBow.cs | 34 +- Items/Weapons/Ranged/MarksmanBow.cs | 42 +- Items/Weapons/Ranged/MarniteRifleSpear.cs | 40 +- Items/Weapons/Ranged/Megafleet.cs | 44 +- Items/Weapons/Ranged/Megalodon.cs | 44 +- Items/Weapons/Ranged/Meowthrower.cs | 32 +- Items/Weapons/Ranged/MepheticSprayer.cs | 32 +- Items/Weapons/Ranged/MineralMortar.cs | 39 +- Items/Weapons/Ranged/Minigun.cs | 44 +- Items/Weapons/Ranged/MolecularManipulator.cs | 42 +- Items/Weapons/Ranged/Monsoon.cs | 46 +- Items/Weapons/Ranged/Needler.cs | 32 +- Items/Weapons/Ranged/NettlelineGreatbow.cs | 42 +- Items/Weapons/Ranged/Norfleet.cs | 44 +- Items/Weapons/Ranged/NullificationRifle.cs | 32 +- Items/Weapons/Ranged/OnyxChainBlaster.cs | 42 +- Items/Weapons/Ranged/Onyxia.cs | 42 +- Items/Weapons/Ranged/OpalStriker.cs | 45 +- Items/Weapons/Ranged/OverloadedBlaster.cs | 32 +- Items/Weapons/Ranged/P90.cs | 34 +- Items/Weapons/Ranged/PaintballBlaster.cs | 43 +- Items/Weapons/Ranged/PearlGod.cs | 42 +- Items/Weapons/Ranged/PestilentDefiler.cs | 34 +- Items/Weapons/Ranged/Phangasm.cs | 51 +- Items/Weapons/Ranged/Photoviscerator.cs | 51 +- Items/Weapons/Ranged/PlanetaryAnnihilation.cs | 43 +- .../Ranged/PrideHuntersPlanarRipper.cs | 49 +- Items/Weapons/Ranged/PristineFury.cs | 54 +- Items/Weapons/Ranged/ProporsePistol.cs | 32 +- Items/Weapons/Ranged/Pumpler.cs | 44 +- Items/Weapons/Ranged/RaidersGlory.cs | 34 +- Items/Weapons/Ranged/RealmRavager.cs | 34 +- Items/Weapons/Ranged/RubicoPrime.cs | 42 +- Items/Weapons/Ranged/SDFMG.cs | 49 +- Items/Weapons/Ranged/SandstormGun.cs | 43 +- Items/Weapons/Ranged/ScorchedEarth.cs | 48 +- Items/Weapons/Ranged/Scorpion.cs | 43 +- Items/Weapons/Ranged/Seabow.cs | 40 +- Items/Weapons/Ranged/Seadragon.cs | 48 +- Items/Weapons/Ranged/SeasSearing.cs | 44 +- Items/Weapons/Ranged/SepticSkewer.cs | 32 +- Items/Weapons/Ranged/Shadethrower.cs | 40 +- Items/Weapons/Ranged/Shellshooter.cs | 34 +- Items/Weapons/Ranged/Shredder.cs | 47 +- Items/Weapons/Ranged/Shroomer.cs | 42 +- Items/Weapons/Ranged/SlagMagnum.cs | 34 +- Items/Weapons/Ranged/SomaPrime.cs | 42 +- Items/Weapons/Ranged/SparkSpreader.cs | 40 +- Items/Weapons/Ranged/SpectralstormCannon.cs | 42 +- Items/Weapons/Ranged/SpectreRifle.cs | 41 +- Items/Weapons/Ranged/Spyker.cs | 42 +- Items/Weapons/Ranged/StarCannonEX.cs | 40 +- Items/Weapons/Ranged/StarSputter.cs | 34 +- Items/Weapons/Ranged/Starfleet.cs | 40 +- Items/Weapons/Ranged/StarfleetMK2.cs | 54 +- Items/Weapons/Ranged/StellarCannon.cs | 30 +- Items/Weapons/Ranged/StormDragoon.cs | 38 +- Items/Weapons/Ranged/StormSurge.cs | 38 +- Items/Weapons/Ranged/SulphuricAcidCannon.cs | 32 +- Items/Weapons/Ranged/SurgeDriver.cs | 44 +- Items/Weapons/Ranged/Svantechnical.cs | 52 +- Items/Weapons/Ranged/TelluricGlare.cs | 40 +- Items/Weapons/Ranged/TerraFlameburster.cs | 40 +- Items/Weapons/Ranged/TheBallista.cs | 42 +- Items/Weapons/Ranged/TheEmpyrean.cs | 38 +- Items/Weapons/Ranged/TheHive.cs | 32 +- Items/Weapons/Ranged/TheJailor.cs | 36 +- Items/Weapons/Ranged/TheMaelstrom.cs | 47 +- Items/Weapons/Ranged/ThePack.cs | 44 +- Items/Weapons/Ranged/TheStorm.cs | 38 +- Items/Weapons/Ranged/TitaniumRailgun.cs | 38 +- Items/Weapons/Ranged/Toxibow.cs | 39 +- Items/Weapons/Ranged/Triploon.cs | 42 +- Items/Weapons/Ranged/TrueConferenceCall.cs | 43 +- Items/Weapons/Ranged/TyrannysEnd.cs | 44 +- Items/Weapons/Ranged/Ultima.cs | 54 +- Items/Weapons/Ranged/UniversalGenesis.cs | 61 +- Items/Weapons/Ranged/Vortexpopper.cs | 43 +- Items/Weapons/Ranged/WulfrumBow.cs | 40 +- Items/Weapons/Rogue/AccretionDisk.cs | 43 +- Items/Weapons/Rogue/AcidicRainBarrel.cs | 40 +- Items/Weapons/Rogue/AdamantiteThrowingAxe.cs | 42 +- Items/Weapons/Rogue/AlphaVirus.cs | 46 +- Items/Weapons/Rogue/Apoctolith.cs | 43 +- Items/Weapons/Rogue/AshenStalactite.cs | 34 +- Items/Weapons/Rogue/AuroradicalThrow.cs | 34 +- Items/Weapons/Rogue/BallisticPoisonBomb.cs | 41 +- Items/Weapons/Rogue/BlastBarrel.cs | 32 +- Items/Weapons/Rogue/BlazingStar.cs | 48 +- Items/Weapons/Rogue/BloodsoakedCrasher.cs | 39 +- Items/Weapons/Rogue/BouncingBetty.cs | 36 +- Items/Weapons/Rogue/BouncingEyeball.cs | 30 +- Items/Weapons/Rogue/BouncySpikyBall.cs | 43 +- Items/Weapons/Rogue/BrackishFlask.cs | 32 +- Items/Weapons/Rogue/Brimblade.cs | 38 +- Items/Weapons/Rogue/BurningStrife.cs | 30 +- Items/Weapons/Rogue/CelestialReaper.cs | 32 +- Items/Weapons/Rogue/Celestus.cs | 41 +- Items/Weapons/Rogue/Cinquedea.cs | 32 +- Items/Weapons/Rogue/CobaltKunai.cs | 42 +- Items/Weapons/Rogue/ConsecratedWater.cs | 41 +- Items/Weapons/Rogue/ContaminatedBile.cs | 35 +- Items/Weapons/Rogue/CorpusAvertor.cs | 34 +- Items/Weapons/Rogue/CosmicKunai.cs | 41 +- Items/Weapons/Rogue/CraniumSmasher.cs | 32 +- Items/Weapons/Rogue/CrushsawCrasher.cs | 28 +- Items/Weapons/Rogue/CrystalPiercer.cs | 42 +- Items/Weapons/Rogue/Crystalline.cs | 40 +- Items/Weapons/Rogue/CursedDagger.cs | 32 +- Items/Weapons/Rogue/DeepSeaDumbbell.cs | 56 +- Items/Weapons/Rogue/DeepWounder.cs | 36 +- Items/Weapons/Rogue/DefectiveSphere.cs | 38 +- Items/Weapons/Rogue/DeificThunderbolt.cs | 41 +- Items/Weapons/Rogue/DesecratedWater.cs | 41 +- Items/Weapons/Rogue/DukesDecapitator.cs | 34 +- Items/Weapons/Rogue/DuneHopper.cs | 41 +- Items/Weapons/Rogue/DuststormInABottle.cs | 40 +- Items/Weapons/Rogue/EclipsesFall.cs | 39 +- Items/Weapons/Rogue/EnchantedAxe.cs | 54 +- Items/Weapons/Rogue/EpidemicShredder.cs | 40 +- Items/Weapons/Rogue/Equanimity.cs | 43 +- Items/Weapons/Rogue/Eradicator.cs | 36 +- Items/Weapons/Rogue/ExecutionersBlade.cs | 46 +- Items/Weapons/Rogue/Exorcism.cs | 44 +- Items/Weapons/Rogue/FantasyTalisman.cs | 44 +- Items/Weapons/Rogue/FeatherKnife.cs | 42 +- Items/Weapons/Rogue/FinalDawn.cs | 36 +- Items/Weapons/Rogue/FlameScythe.cs | 38 +- Items/Weapons/Rogue/FrostcrushValari.cs | 43 +- Items/Weapons/Rogue/FrostyFlare.cs | 38 +- Items/Weapons/Rogue/GelDart.cs | 36 +- Items/Weapons/Rogue/GhoulishGouger.cs | 36 +- Items/Weapons/Rogue/GildedDagger.cs | 41 +- Items/Weapons/Rogue/Glaive.cs | 34 +- Items/Weapons/Rogue/GleamingDagger.cs | 41 +- Items/Weapons/Rogue/GodsParanoia.cs | 54 +- Items/Weapons/Rogue/HardenedHoneycomb.cs | 44 +- Items/Weapons/Rogue/HeavenfallenStardisk.cs | 32 +- Items/Weapons/Rogue/HellsSun.cs | 52 +- Items/Weapons/Rogue/Hypothermia.cs | 45 +- Items/Weapons/Rogue/IceStar.cs | 34 +- Items/Weapons/Rogue/Icebreaker.cs | 32 +- Items/Weapons/Rogue/IchorSpear.cs | 32 +- Items/Weapons/Rogue/InfernalKris.cs | 43 +- Items/Weapons/Rogue/IronFrancisca.cs | 44 +- Items/Weapons/Rogue/JawsOfOblivion.cs | 41 +- Items/Weapons/Rogue/KelvinCatalyst.cs | 46 +- Items/Weapons/Rogue/Kylie.cs | 32 +- Items/Weapons/Rogue/LatcherMine.cs | 34 +- Items/Weapons/Rogue/LeadTomahawk.cs | 44 +- Items/Weapons/Rogue/LeonidProgenitor.cs | 40 +- Items/Weapons/Rogue/LeviathanTeeth.cs | 34 +- Items/Weapons/Rogue/Lionfish.cs | 32 +- Items/Weapons/Rogue/LuminousStriker.cs | 42 +- Items/Weapons/Rogue/LunarKunai.cs | 44 +- Items/Weapons/Rogue/Malachite.cs | 42 +- Items/Weapons/Rogue/MangroveChakram.cs | 38 +- Items/Weapons/Rogue/MetalMonstrosity.cs | 39 +- Items/Weapons/Rogue/MeteorFist.cs | 40 +- Items/Weapons/Rogue/MoltenAmputator.cs | 34 +- Items/Weapons/Rogue/MonkeyDarts.cs | 36 +- Items/Weapons/Rogue/Mycoroot.cs | 32 +- Items/Weapons/Rogue/MythrilKnife.cs | 42 +- Items/Weapons/Rogue/NanoblackReaperRogue.cs | 45 +- Items/Weapons/Rogue/NastyCholla.cs | 40 +- Items/Weapons/Rogue/NightsGaze.cs | 45 +- Items/Weapons/Rogue/Nychthemeron.cs | 55 +- .../Weapons/Rogue/OrichalcumSpikedGemstone.cs | 44 +- Items/Weapons/Rogue/PalladiumJavelin.cs | 44 +- Items/Weapons/Rogue/Penumbra.cs | 42 +- Items/Weapons/Rogue/PhantasmalRuin.cs | 41 +- Items/Weapons/Rogue/PhantomLance.cs | 44 +- Items/Weapons/Rogue/Plaguenade.cs | 45 +- Items/Weapons/Rogue/PoisonPack.cs | 50 +- Items/Weapons/Rogue/Prismalline.cs | 40 +- Items/Weapons/Rogue/ProfanedPartisan.cs | 43 +- Items/Weapons/Rogue/ProfanedTrident.cs | 32 +- Items/Weapons/Rogue/RadiantStar.cs | 41 +- Items/Weapons/Rogue/RefractionRotor.cs | 30 +- Items/Weapons/Rogue/RegulusRiot.cs | 32 +- Items/Weapons/Rogue/RogueWeapon.cs | 26 +- Items/Weapons/Rogue/RotBall.cs | 44 +- Items/Weapons/Rogue/Sacrifice.cs | 32 +- Items/Weapons/Rogue/SandDollar.cs | 40 +- Items/Weapons/Rogue/Sandslasher.cs | 41 +- Items/Weapons/Rogue/ScarletDevil.cs | 42 +- Items/Weapons/Rogue/ScourgeoftheDesert.cs | 32 +- Items/Weapons/Rogue/ScourgeoftheSeas.cs | 30 +- Items/Weapons/Rogue/SeafoamBomb.cs | 39 +- Items/Weapons/Rogue/SealedSingularity.cs | 35 +- Items/Weapons/Rogue/SearedPan.cs | 45 +- Items/Weapons/Rogue/SeashellBoomerang.cs | 36 +- Items/Weapons/Rogue/Seraphim.cs | 41 +- Items/Weapons/Rogue/ShatteredSun.cs | 41 +- Items/Weapons/Rogue/ShinobiBlade.cs | 34 +- Items/Weapons/Rogue/ShockGrenade.cs | 44 +- Items/Weapons/Rogue/Shroomerang.cs | 30 +- Items/Weapons/Rogue/SkyStabber.cs | 51 +- Items/Weapons/Rogue/SkyfinBombers.cs | 32 +- Items/Weapons/Rogue/SlickCane.cs | 40 +- Items/Weapons/Rogue/SludgeSplotch.cs | 43 +- Items/Weapons/Rogue/SnapClam.cs | 34 +- Items/Weapons/Rogue/SpearofDestiny.cs | 40 +- Items/Weapons/Rogue/SpearofPaleolith.cs | 39 +- Items/Weapons/Rogue/SpentFuelContainer.cs | 32 +- Items/Weapons/Rogue/StarofDestruction.cs | 36 +- Items/Weapons/Rogue/StellarKnife.cs | 38 +- Items/Weapons/Rogue/StickySpikyBall.cs | 41 +- Items/Weapons/Rogue/StormfrontRazor.cs | 44 +- Items/Weapons/Rogue/Supernova.cs | 47 +- Items/Weapons/Rogue/SylvanSlasher.cs | 34 +- Items/Weapons/Rogue/TarragonThrowingDart.cs | 44 +- Items/Weapons/Rogue/TerraDisk.cs | 43 +- Items/Weapons/Rogue/TerrorTalons.cs | 40 +- Items/Weapons/Rogue/TheAtomSplitter.cs | 30 +- Items/Weapons/Rogue/TheReaper.cs | 34 +- Items/Weapons/Rogue/TheSyringe.cs | 32 +- Items/Weapons/Rogue/ThrowingBrick.cs | 38 +- Items/Weapons/Rogue/TimeBolt.cs | 45 +- Items/Weapons/Rogue/TitaniumShuriken.cs | 42 +- Items/Weapons/Rogue/ToothBall.cs | 44 +- Items/Weapons/Rogue/TotalityBreakers.cs | 42 +- Items/Weapons/Rogue/ToxicantTwister.cs | 30 +- Items/Weapons/Rogue/Turbulance.cs | 40 +- Items/Weapons/Rogue/UrchinStinger.cs | 36 +- Items/Weapons/Rogue/UtensilPoker.cs | 38 +- Items/Weapons/Rogue/Valediction.cs | 32 +- Items/Weapons/Rogue/WebBall.cs | 39 +- Items/Weapons/Rogue/WulfrumKnife.cs | 42 +- Items/Weapons/Rogue/XerocPitchfork.cs | 42 +- Items/Weapons/Summon/AbandonedSlimeStaff.cs | 30 +- Items/Weapons/Summon/AncientIceChunk.cs | 34 +- Items/Weapons/Summon/AngryChickenStaff.cs | 32 +- Items/Weapons/Summon/BelladonnaSpiritStaff.cs | 39 +- Items/Weapons/Summon/BensUmbrella.cs | 42 +- Items/Weapons/Summon/BlackHawkRemote.cs | 30 +- Items/Weapons/Summon/BlightedEyeStaff.cs | 36 +- Items/Weapons/Summon/BloodClotStaff.cs | 38 +- Items/Weapons/Summon/BorealisBomber.cs | 30 +- Items/Weapons/Summon/CadaverousCarrion.cs | 30 +- Items/Weapons/Summon/CalamarisLament.cs | 32 +- Items/Weapons/Summon/CausticCroakerStaff.cs | 30 +- Items/Weapons/Summon/CausticStaff.cs | 41 +- Items/Weapons/Summon/CinderBlossomStaff.cs | 38 +- Items/Weapons/Summon/CindersOfLament.cs | 32 +- Items/Weapons/Summon/ColdDivinity.cs | 30 +- Items/Weapons/Summon/CorroslimeStaff.cs | 30 +- Items/Weapons/Summon/CorvidHarbringerStaff.cs | 40 +- Items/Weapons/Summon/CosmicImmaterializer.cs | 42 +- Items/Weapons/Summon/CosmicViperEngine.cs | 44 +- Items/Weapons/Summon/Cosmilamp.cs | 34 +- Items/Weapons/Summon/CrimslimeStaff.cs | 30 +- Items/Weapons/Summon/CryogenicStaff.cs | 32 +- Items/Weapons/Summon/DaedalusGolemStaff.cs | 34 +- Items/Weapons/Summon/DankStaff.cs | 40 +- Items/Weapons/Summon/DazzlingStabberStaff.cs | 36 +- Items/Weapons/Summon/DeathstareRod.cs | 28 +- Items/Weapons/Summon/DeepseaStaff.cs | 30 +- Items/Weapons/Summon/DormantBrimseeker.cs | 30 +- Items/Weapons/Summon/DragonbloodDisgorger.cs | 38 +- Items/Weapons/Summon/DreadmineStaff.cs | 40 +- Items/Weapons/Summon/ElementalAxe.cs | 40 +- Items/Weapons/Summon/EndoHydraStaff.cs | 40 +- Items/Weapons/Summon/Endogenesis.cs | 44 +- Items/Weapons/Summon/EnergyStaff.cs | 30 +- Items/Weapons/Summon/EtherealSubjugator.cs | 40 +- Items/Weapons/Summon/EyeOfNight.cs | 37 +- Items/Weapons/Summon/FleshOfInfidelity.cs | 37 +- Items/Weapons/Summon/FlowersOfMortality.cs | 40 +- Items/Weapons/Summon/ForgottenApexWand.cs | 40 +- Items/Weapons/Summon/FrostBlossomStaff.cs | 38 +- Items/Weapons/Summon/FuelCellBundle.cs | 32 +- Items/Weapons/Summon/GammaHeart.cs | 32 +- Items/Weapons/Summon/GastricBelcherStaff.cs | 36 +- Items/Weapons/Summon/GodspawnHelixStaff.cs | 28 +- Items/Weapons/Summon/HauntedScroll.cs | 40 +- Items/Weapons/Summon/HerringStaff.cs | 28 +- Items/Weapons/Summon/HivePod.cs | 30 +- Items/Weapons/Summon/IgneousExaltation.cs | 39 +- Items/Weapons/Summon/InfectedRemote.cs | 34 +- Items/Weapons/Summon/LanternoftheSoul.cs | 32 +- Items/Weapons/Summon/MagicalConch.cs | 36 +- Items/Weapons/Summon/Metastasis.cs | 32 +- Items/Weapons/Summon/MidnightSunBeacon.cs | 40 +- Items/Weapons/Summon/OrthoceraShell.cs | 30 +- Items/Weapons/Summon/Perdition.cs | 37 +- Items/Weapons/Summon/PlantationStaff.cs | 52 +- Items/Weapons/Summon/PolypLauncher.cs | 30 +- .../Weapons/Summon/PrototypeAndromechaRing.cs | 47 +- Items/Weapons/Summon/ResurrectionButterfly.cs | 47 +- Items/Weapons/Summon/RustyBeaconPrototype.cs | 35 +- Items/Weapons/Summon/SandSharknadoStaff.cs | 39 +- Items/Weapons/Summon/SarosPossession.cs | 40 +- Items/Weapons/Summon/ScabRipper.cs | 38 +- Items/Weapons/Summon/SeaboundStaff.cs | 32 +- Items/Weapons/Summon/ShellfishStaff.cs | 30 +- Items/Weapons/Summon/Sirius.cs | 41 +- Items/Weapons/Summon/SlimePuppetStaff.cs | 30 +- Items/Weapons/Summon/SpikecragStaff.cs | 32 +- Items/Weapons/Summon/SquirrelSquireStaff.cs | 40 +- Items/Weapons/Summon/StaffOfNecrosteocytes.cs | 30 +- Items/Weapons/Summon/StaffoftheMechworm.cs | 32 +- Items/Weapons/Summon/StormjawStaff.cs | 32 +- Items/Weapons/Summon/SunGodStaff.cs | 38 +- Items/Weapons/Summon/SunSpiritStaff.cs | 35 +- Items/Weapons/Summon/TacticalPlagueEngine.cs | 41 +- .../Summon/TundraFlameBlossomsStaff.cs | 38 +- Items/Weapons/Summon/UniverseSplitter.cs | 44 +- Items/Weapons/Summon/Vigilance.cs | 30 +- Items/Weapons/Summon/VileFeeder.cs | 44 +- Items/Weapons/Summon/ViralSprout.cs | 36 +- Items/Weapons/Summon/ViridVanguard.cs | 39 +- .../Weapons/Summon/VoidConcentrationStaff.cs | 30 +- Items/Weapons/Summon/WitherBlossomsStaff.cs | 39 +- Items/Weapons/Summon/WulfrumController.cs | 36 +- Items/Weapons/Typeless/AeroDynamite.cs | 33 +- Items/Weapons/Typeless/Aestheticus.cs | 48 +- Items/Weapons/Typeless/AethersWhisper.cs | 55 +- Items/Weapons/Typeless/EyeofMagnus.cs | 43 +- Items/Weapons/Typeless/FiniteUse/Bazooka.cs | 49 +- .../Typeless/FiniteUse/ElephantKiller.cs | 48 +- Items/Weapons/Typeless/FiniteUse/Hydra.cs | 50 +- .../Typeless/FiniteUse/LightningHawk.cs | 51 +- Items/Weapons/Typeless/FiniteUse/Magnum.cs | 49 +- Items/Weapons/Typeless/GoldenGun.cs | 35 +- Items/Weapons/Typeless/LunicEye.cs | 45 +- Items/Weapons/Typeless/MarkedMagnum.cs | 44 +- Items/Weapons/Typeless/RelicOfDeliverance.cs | 30 +- Items/Weapons/Typeless/RelicOfResilience.cs | 28 +- Items/Weapons/Typeless/StarStruckWater.cs | 39 +- Items/Weapons/Typeless/YanmeisKnife.cs | 40 +- NPCs/Abyss/Bloatfish.cs | 162 +- NPCs/Abyss/BobbitWormHead.cs | 224 +- NPCs/Abyss/BobbitWormSegment.cs | 48 +- NPCs/Abyss/BoxJellyfish.cs | 166 +- NPCs/Abyss/ChaoticPuffer.cs | 131 +- NPCs/Abyss/ColossalSquid.cs | 515 ++-- NPCs/Abyss/Cuttlefish.cs | 338 +-- NPCs/Abyss/DevilFish.cs | 229 +- NPCs/Abyss/DevilFishAlt.cs | 229 +- NPCs/Abyss/EidolonWyrmBody.cs | 110 +- NPCs/Abyss/EidolonWyrmBodyAlt.cs | 110 +- NPCs/Abyss/EidolonWyrmHead.cs | 305 +- NPCs/Abyss/EidolonWyrmTail.cs | 110 +- NPCs/Abyss/GiantSquid.cs | 198 +- NPCs/Abyss/GulperEelBody.cs | 118 +- NPCs/Abyss/GulperEelBodyAlt.cs | 118 +- NPCs/Abyss/GulperEelHead.cs | 216 +- NPCs/Abyss/GulperEelTail.cs | 116 +- NPCs/Abyss/Laserfish.cs | 92 +- NPCs/Abyss/LuminousCorvina.cs | 213 +- NPCs/Abyss/MirageJelly.cs | 146 +- NPCs/Abyss/MorayEel.cs | 66 +- NPCs/Abyss/OarfishBody.cs | 98 +- NPCs/Abyss/OarfishHead.cs | 190 +- NPCs/Abyss/OarfishTail.cs | 98 +- NPCs/Abyss/Reaper.cs | 563 ++-- NPCs/Abyss/ToxicMinnow.cs | 105 +- NPCs/Abyss/Viperfish.cs | 90 +- NPCs/AcidRain/AcidEel.cs | 131 +- NPCs/AcidRain/BloodwormFleeing.cs | 50 +- NPCs/AcidRain/BloodwormNormal.cs | 80 +- NPCs/AcidRain/CragmawMire.cs | 227 +- NPCs/AcidRain/FlakBaby.cs | 102 +- NPCs/AcidRain/FlakCrab.cs | 136 +- NPCs/AcidRain/GammaSlime.cs | 109 +- NPCs/AcidRain/IrradiatedSlime.cs | 76 +- NPCs/AcidRain/Mauler.cs | 263 +- NPCs/AcidRain/NuclearTerror.cs | 237 +- NPCs/AcidRain/NuclearToad.cs | 129 +- NPCs/AcidRain/Orthocera.cs | 138 +- NPCs/AcidRain/Radiator.cs | 72 +- NPCs/AcidRain/Skyfin.cs | 145 +- NPCs/AcidRain/SulfurousSkater.cs | 148 +- NPCs/AcidRain/Trilobite.cs | 145 +- NPCs/AcidRain/WaterLeech.cs | 136 +- .../EidolonWyrmBodyAltHuge.cs | 140 +- NPCs/AdultEidolonWyrm/EidolonWyrmBodyHuge.cs | 138 +- NPCs/AdultEidolonWyrm/EidolonWyrmHeadHuge.cs | 531 ++-- NPCs/AdultEidolonWyrm/EidolonWyrmTailHuge.cs | 118 +- NPCs/AquaticScourge/AquaticParasite.cs | 156 +- NPCs/AquaticScourge/AquaticScourgeBody.cs | 110 +- NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs | 106 +- NPCs/AquaticScourge/AquaticScourgeHead.cs | 161 +- NPCs/AquaticScourge/AquaticScourgeTail.cs | 104 +- NPCs/AquaticScourge/AquaticSeekerBody.cs | 106 +- NPCs/AquaticScourge/AquaticSeekerHead.cs | 184 +- NPCs/AquaticScourge/AquaticSeekerTail.cs | 106 +- NPCs/AquaticScourge/AquaticUrchin.cs | 50 +- NPCs/Astral/Aries.cs | 83 +- NPCs/Astral/AstralProbe.cs | 211 +- NPCs/Astral/AstralSlime.cs | 50 +- NPCs/Astral/AstralachneaGround.cs | 85 +- NPCs/Astral/AstralachneaWall.cs | 71 +- NPCs/Astral/Atlas.cs | 265 +- NPCs/Astral/BigSightseer.cs | 155 +- NPCs/Astral/EnchantedNightcrawler.cs | 12 +- NPCs/Astral/FusionFeeder.cs | 73 +- NPCs/Astral/Hadarian.cs | 121 +- NPCs/Astral/Hive.cs | 83 +- NPCs/Astral/Hiveling.cs | 95 +- NPCs/Astral/Mantis.cs | 181 +- NPCs/Astral/Nova.cs | 177 +- NPCs/Astral/SmallSightseer.cs | 85 +- NPCs/Astral/StellarCulex.cs | 73 +- NPCs/Astral/Twinkler.cs | 26 +- NPCs/AstrumAureus/AstrumAureus.cs | 287 +- NPCs/AstrumAureus/AureusSpawn.cs | 251 +- NPCs/AstrumDeus/AstrumDeusBodySpectral.cs | 148 +- NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs | 184 +- NPCs/AstrumDeus/AstrumDeusTailSpectral.cs | 136 +- NPCs/BrimstoneElemental/Brimling.cs | 173 +- NPCs/BrimstoneElemental/BrimstoneElemental.cs | 178 +- NPCs/Bumblebirb/Bumblefuck.cs | 234 +- NPCs/Bumblebirb/Bumblefuck2.cs | 90 +- NPCs/Calamitas/CalamitasRun.cs | 140 +- NPCs/Calamitas/CalamitasRun2.cs | 138 +- NPCs/Calamitas/CalamitasRun3.cs | 195 +- NPCs/Calamitas/SoulSeeker.cs | 136 +- NPCs/CalamityAI.cs | 111 +- NPCs/CalamityGlobalAI.cs | 128 +- NPCs/CalamityGlobalNPC.cs | 192 +- NPCs/CalamityGlobalNPCLoot.cs | 9 +- NPCs/CeaselessVoid/CeaselessVoid.cs | 183 +- NPCs/CeaselessVoid/DarkEnergy.cs | 172 +- NPCs/Crabulon/CrabShroom.cs | 102 +- NPCs/Crabulon/CrabulonIdle.cs | 527 ++-- NPCs/Crags/CalamityEye.cs | 122 +- NPCs/Crags/CharredSlime.cs | 58 +- NPCs/Crags/CultistAssassin.cs | 58 +- NPCs/Crags/DespairStone.cs | 58 +- NPCs/Crags/HeatSpirit.cs | 66 +- NPCs/Crags/Scryllar.cs | 214 +- NPCs/Crags/ScryllarRage.cs | 214 +- NPCs/Crags/SoulSlurper.cs | 228 +- NPCs/Cryogen/Cryogen.cs | 683 ++--- NPCs/Cryogen/CryogenIce.cs | 88 +- NPCs/DesertScourge/DesertNuisanceBody.cs | 112 +- NPCs/DesertScourge/DesertNuisanceHead.cs | 253 +- NPCs/DesertScourge/DesertNuisanceTail.cs | 108 +- NPCs/DesertScourge/DesertScourgeBody.cs | 144 +- NPCs/DesertScourge/DesertScourgeHead.cs | 343 +-- NPCs/DesertScourge/DesertScourgeTail.cs | 122 +- NPCs/DevourerofGods/DevourerofGodsBody.cs | 250 +- NPCs/DevourerofGods/DevourerofGodsBody2.cs | 146 +- NPCs/DevourerofGods/DevourerofGodsHead.cs | 957 +++---- NPCs/DevourerofGods/DevourerofGodsHead2.cs | 232 +- NPCs/DevourerofGods/DevourerofGodsTail.cs | 263 +- NPCs/DevourerofGods/DevourerofGodsTail2.cs | 144 +- NPCs/DraedonLabThings/RepairUnitCritter.cs | 200 +- NPCs/ExoMechs/Apollo/Apollo.cs | 499 ++-- NPCs/ExoMechs/Ares/AresBody.cs | 435 +-- NPCs/ExoMechs/Ares/AresGaussNuke.cs | 253 +- NPCs/ExoMechs/Ares/AresLaserCannon.cs | 279 +- NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs | 251 +- NPCs/ExoMechs/Ares/AresTeslaCannon.cs | 245 +- NPCs/ExoMechs/Artemis/Artemis.cs | 455 +-- NPCs/ExoMechs/Draedon.cs | 211 +- NPCs/ExoMechs/Thanatos/ThanatosBody1.cs | 339 +-- NPCs/ExoMechs/Thanatos/ThanatosBody2.cs | 339 +-- NPCs/ExoMechs/Thanatos/ThanatosHead.cs | 431 +-- NPCs/ExoMechs/Thanatos/ThanatosTail.cs | 341 +-- NPCs/GreatSandShark/GreatSandShark.cs | 459 ++-- NPCs/HiveMind/DankCreeper.cs | 92 +- NPCs/HiveMind/DarkHeart.cs | 110 +- NPCs/HiveMind/HiveBlob.cs | 148 +- NPCs/HiveMind/HiveBlob2.cs | 148 +- NPCs/HiveMind/HiveCyst.cs | 56 +- NPCs/HiveMind/HiveMind.cs | 547 ++-- NPCs/Leviathan/AquaticAberration.cs | 188 +- NPCs/Leviathan/Leviathan.cs | 443 +-- NPCs/Leviathan/LeviathanStart.cs | 106 +- NPCs/Leviathan/Siren.cs | 567 ++-- NPCs/Leviathan/SirenIce.cs | 90 +- NPCs/NormalNPCs/AeroSlime.cs | 48 +- NPCs/NormalNPCs/AngryDog.cs | 109 +- NPCs/NormalNPCs/ArmoredDiggerBody.cs | 102 +- NPCs/NormalNPCs/ArmoredDiggerHead.cs | 257 +- NPCs/NormalNPCs/ArmoredDiggerTail.cs | 82 +- NPCs/NormalNPCs/BlightedEye.cs | 40 +- NPCs/NormalNPCs/BloomSlime.cs | 48 +- NPCs/NormalNPCs/Bohldohr.cs | 44 +- NPCs/NormalNPCs/Cnidrion.cs | 244 +- NPCs/NormalNPCs/CosmicElemental.cs | 70 +- NPCs/NormalNPCs/CrawlerAmber.cs | 70 +- NPCs/NormalNPCs/CrawlerAmethyst.cs | 70 +- NPCs/NormalNPCs/CrawlerCrystal.cs | 72 +- NPCs/NormalNPCs/CrawlerDiamond.cs | 70 +- NPCs/NormalNPCs/CrawlerEmerald.cs | 70 +- NPCs/NormalNPCs/CrawlerRuby.cs | 70 +- NPCs/NormalNPCs/CrawlerSapphire.cs | 70 +- NPCs/NormalNPCs/CrawlerTopaz.cs | 70 +- NPCs/NormalNPCs/CrimulanBlightSlime.cs | 48 +- NPCs/NormalNPCs/CryoSlime.cs | 50 +- NPCs/NormalNPCs/Cryocore.cs | 98 +- NPCs/NormalNPCs/Cryocore2.cs | 98 +- NPCs/NormalNPCs/Cryon.cs | 76 +- NPCs/NormalNPCs/EbonianBlightSlime.cs | 48 +- NPCs/NormalNPCs/Eidolist.cs | 225 +- NPCs/NormalNPCs/FearlessGoldfishWarrior.cs | 320 +-- NPCs/NormalNPCs/Frogfish.cs | 102 +- NPCs/NormalNPCs/Horse.cs | 165 +- NPCs/NormalNPCs/IceClasper.cs | 218 +- NPCs/NormalNPCs/IceMass.cs | 86 +- NPCs/NormalNPCs/ImpiousImmolator.cs | 200 +- NPCs/NormalNPCs/KingSlimeJewel.cs | 127 +- NPCs/NormalNPCs/MantisShrimp.cs | 76 +- NPCs/NormalNPCs/OverloadedSoldier.cs | 298 +- NPCs/NormalNPCs/Parasea.cs | 58 +- NPCs/NormalNPCs/PerennialSlime.cs | 48 +- NPCs/NormalNPCs/PhantomDebris.cs | 294 +- NPCs/NormalNPCs/PhantomSpirit.cs | 42 +- NPCs/NormalNPCs/PhantomSpiritL.cs | 80 +- NPCs/NormalNPCs/PhantomSpiritM.cs | 50 +- NPCs/NormalNPCs/PhantomSpiritS.cs | 48 +- NPCs/NormalNPCs/Piggy.cs | 78 +- NPCs/NormalNPCs/ProfanedEnergyBody.cs | 56 +- NPCs/NormalNPCs/ProfanedEnergyLantern.cs | 146 +- NPCs/NormalNPCs/Rotdog.cs | 42 +- NPCs/NormalNPCs/SandTortoise.cs | 48 +- NPCs/NormalNPCs/ScornEater.cs | 161 +- NPCs/NormalNPCs/SeaUrchin.cs | 44 +- NPCs/NormalNPCs/ShockstormShuttle.cs | 214 +- NPCs/NormalNPCs/StormlionCharger.cs | 52 +- NPCs/NormalNPCs/SunBat.cs | 66 +- NPCs/NormalNPCs/Sunskater.cs | 170 +- NPCs/NormalNPCs/SuperDummyNPC.cs | 28 +- NPCs/NormalNPCs/ThiccWaifu.cs | 165 +- NPCs/NormalNPCs/WildBumblefuck.cs | 88 +- NPCs/NormalNPCs/WulfrumDrone.cs | 132 +- NPCs/NormalNPCs/WulfrumGyrator.cs | 126 +- NPCs/NormalNPCs/WulfrumHovercraft.cs | 140 +- NPCs/NormalNPCs/WulfrumPylon.cs | 76 +- NPCs/NormalNPCs/WulfrumRover.cs | 106 +- NPCs/OldDuke/OldDuke.cs | 274 +- NPCs/OldDuke/OldDukeSharkron.cs | 201 +- NPCs/OldDuke/OldDukeToothBall.cs | 169 +- NPCs/Other/CalamitasEnchantDemon.cs | 96 +- NPCs/Other/DemonPortal.cs | 83 +- NPCs/Other/ExhumedHeart.cs | 68 +- NPCs/Other/LecherousOrb.cs | 128 +- NPCs/Perforator/PerforatorBodyLarge.cs | 138 +- NPCs/Perforator/PerforatorBodyMedium.cs | 200 +- NPCs/Perforator/PerforatorBodySmall.cs | 134 +- NPCs/Perforator/PerforatorCyst.cs | 74 +- NPCs/Perforator/PerforatorHeadLarge.cs | 329 +-- NPCs/Perforator/PerforatorHeadMedium.cs | 329 +-- NPCs/Perforator/PerforatorHeadSmall.cs | 289 +- NPCs/Perforator/PerforatorHive.cs | 271 +- NPCs/Perforator/PerforatorTailLarge.cs | 136 +- NPCs/Perforator/PerforatorTailMedium.cs | 156 +- NPCs/Perforator/PerforatorTailSmall.cs | 134 +- NPCs/PlagueEnemies/PlagueBee.cs | 85 +- NPCs/PlagueEnemies/PlagueBeeLarge.cs | 83 +- NPCs/PlagueEnemies/PlaguebringerShade.cs | 495 ++-- NPCs/PlagueEnemies/PlaguedDerpling.cs | 133 +- NPCs/PlagueEnemies/PlaguedFlyingFox.cs | 43 +- NPCs/PlagueEnemies/PlaguedJungleSlime.cs | 79 +- NPCs/PlagueEnemies/PlaguedTortoise.cs | 45 +- .../PlagueHomingMissile.cs | 179 +- NPCs/PlaguebringerGoliath/PlagueMine.cs | 121 +- .../PlaguebringerGoliath.cs | 733 ++--- NPCs/Polterghast/PhantomFuckYou.cs | 106 +- NPCs/Polterghast/PolterPhantom.cs | 301 +- NPCs/Polterghast/Polterghast.cs | 447 +-- NPCs/Polterghast/PolterghastHook.cs | 246 +- .../ProfanedGuardians/ProfanedGuardianBoss.cs | 323 +-- .../ProfanedGuardianBoss2.cs | 271 +- .../ProfanedGuardianBoss3.cs | 154 +- NPCs/Providence/ProvSpawnDefense.cs | 130 +- NPCs/Providence/ProvSpawnHealer.cs | 140 +- NPCs/Providence/ProvSpawnOffense.cs | 134 +- NPCs/Providence/Providence.cs | 657 ++--- NPCs/Ravager/FlamePillar.cs | 148 +- NPCs/Ravager/RavagerBody.cs | 399 +-- NPCs/Ravager/RavagerClawLeft.cs | 232 +- NPCs/Ravager/RavagerClawRight.cs | 230 +- NPCs/Ravager/RavagerHead.cs | 93 +- NPCs/Ravager/RavagerHead2.cs | 167 +- NPCs/Ravager/RavagerLegLeft.cs | 74 +- NPCs/Ravager/RavagerLegRight.cs | 74 +- NPCs/Ravager/RockPillar.cs | 151 +- NPCs/Signus/CosmicLantern.cs | 108 +- NPCs/Signus/Signus.cs | 539 ++-- NPCs/Signus/SignusBomb.cs | 169 +- NPCs/SlimeGod/SlimeGod.cs | 447 +-- NPCs/SlimeGod/SlimeGodCore.cs | 371 +-- NPCs/SlimeGod/SlimeGodRun.cs | 457 +-- NPCs/SlimeGod/SlimeGodRunSplit.cs | 458 +-- NPCs/SlimeGod/SlimeGodSplit.cs | 454 +-- NPCs/SlimeGod/SlimeSpawnCorrupt.cs | 42 +- NPCs/SlimeGod/SlimeSpawnCorrupt2.cs | 48 +- NPCs/SlimeGod/SlimeSpawnCrimson.cs | 48 +- NPCs/SlimeGod/SlimeSpawnCrimson2.cs | 102 +- NPCs/StormWeaver/StormWeaverBody.cs | 228 +- NPCs/StormWeaver/StormWeaverHead.cs | 451 +-- NPCs/StormWeaver/StormWeaverTail.cs | 230 +- NPCs/SulphurousSea/AnthozoanCrab.cs | 162 +- NPCs/SulphurousSea/BelchingCoral.cs | 58 +- NPCs/SulphurousSea/Catfish.cs | 66 +- NPCs/SulphurousSea/Flounder.cs | 102 +- NPCs/SulphurousSea/Gnasher.cs | 84 +- NPCs/SulphurousSea/MicrobialCluster.cs | 52 +- NPCs/SulphurousSea/Trasher.cs | 260 +- NPCs/SunkenSea/BlindedAngler.cs | 92 +- NPCs/SunkenSea/Clam.cs | 152 +- NPCs/SunkenSea/EutrophicRay.cs | 160 +- NPCs/SunkenSea/GhostBell.cs | 120 +- NPCs/SunkenSea/GhostBellSmall.cs | 100 +- NPCs/SunkenSea/GiantClam.cs | 281 +- NPCs/SunkenSea/PrismTurtle.cs | 110 +- NPCs/SunkenSea/SeaFloaty.cs | 122 +- NPCs/SunkenSea/SeaMinnow.cs | 176 +- NPCs/SunkenSea/SeaSerpent1.cs | 194 +- NPCs/SunkenSea/SeaSerpent2.cs | 102 +- NPCs/SunkenSea/SeaSerpent3.cs | 102 +- NPCs/SunkenSea/SeaSerpent4.cs | 102 +- NPCs/SunkenSea/SeaSerpent5.cs | 102 +- NPCs/SupremeCalamitas/BrimstoneHeart.cs | 70 +- NPCs/SupremeCalamitas/SCalWormArm.cs | 132 +- NPCs/SupremeCalamitas/SCalWormBody.cs | 108 +- NPCs/SupremeCalamitas/SCalWormBodyWeak.cs | 97 +- NPCs/SupremeCalamitas/SCalWormHead.cs | 201 +- NPCs/SupremeCalamitas/SCalWormTail.cs | 116 +- NPCs/SupremeCalamitas/SoulSeekerSupreme.cs | 139 +- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 1127 ++++---- NPCs/SupremeCalamitas/SupremeCataclysm.cs | 155 +- NPCs/SupremeCalamitas/SupremeCatastrophe.cs | 159 +- NPCs/TownNPCs/DILF.cs | 44 +- NPCs/TownNPCs/FAP.cs | 40 +- NPCs/TownNPCs/SEAHOE.cs | 74 +- NPCs/TownNPCs/THIEF.cs | 65 +- NPCs/TownNPCs/WITCH.cs | 64 +- .../Bosses/BrainOfCthulhuAI.cs | 13 +- NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs | 7 +- .../VanillaNPCOverrides/Bosses/DestroyerAI.cs | 5 +- .../Bosses/DukeFishronAI.cs | 21 +- .../Bosses/EaterOfWorldsAI.cs | 5 +- .../Bosses/EyeOfCthulhuAI.cs | 15 +- NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs | 11 +- .../VanillaNPCOverrides/Bosses/KingSlimeAI.cs | 7 +- NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs | 19 +- NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs | 7 +- NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs | 7 +- .../VanillaNPCOverrides/Bosses/SkeletronAI.cs | 9 +- .../Bosses/SkeletronPrimeAI.cs | 9 +- NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs | 17 +- .../Bosses/WallOfFleshAI.cs | 5 +- .../RegularEnemies/DemonEyeAI.cs | 3 +- NPCs/Yharon/Yharon.cs | 1987 +++++++------- Particles/BaseParticleSet.cs | 2 +- Particles/BloodParticle.cs | 2 +- Particles/BloodParticle2.cs | 2 +- Particles/BloomLineVFX.cs | 4 +- Particles/BloomRing.cs | 2 +- Particles/ChargeUpLineVFX.cs | 2 +- Particles/ConstellationRing.cs | 6 +- Particles/CritSpark.cs | 4 +- Particles/ElectricSpark.cs | 4 +- Particles/FakeDustParticle.cs | 2 +- Particles/FlareShine.cs | 4 +- Particles/GeneralParticleHandler.cs | 2 +- Particles/GenericBloom.cs | 2 +- Particles/GenericSparkle.cs | 4 +- Particles/GruesomeEminenceParticleSet.cs | 12 +- Particles/HeavySmoke.cs | 2 +- Particles/ImpactParticle.cs | 2 +- Particles/LineVFX.cs | 4 +- Particles/PulseRing.cs | 4 +- Particles/RancorGroundLavaParticleSet.cs | 4 +- Particles/RancorLavaParticleSet.cs | 4 +- Particles/SemiCircularSmearVFX.cs | 2 +- Particles/SnowflakeSparkle.cs | 4 +- Particles/SparkParticle.cs | 2 +- Particles/SquishyLightParticle.cs | 4 +- Particles/StreamGougeParticleSet.cs | 4 +- Particles/StrongBloom.cs | 4 +- Particles/ThunderBoltVFX.cs | 2 +- Prefixes/AccessoryPrefix.cs | 8 +- Prefixes/RoguePrefix.cs | 32 +- .../BaseIdleHoldoutProjectile.cs | 4 +- .../BaseLaserbeamProjectile.cs | 60 +- .../BaseMassiveExplosionProjectile.cs | 20 +- .../BaseProjectiles/BaseSpearProjectile.cs | 84 +- .../BaseProjectiles/BaseSporeSacProjectile.cs | 48 +- .../BaseProjectiles/BaseWhipProjectile.cs | 110 +- Projectiles/Boss/AbyssBallVolley.cs | 41 +- Projectiles/Boss/AbyssBallVolley2.cs | 41 +- Projectiles/Boss/ApolloChargeTelegraph.cs | 40 +- Projectiles/Boss/ApolloFireball.cs | 103 +- Projectiles/Boss/ApolloRocket.cs | 139 +- Projectiles/Boss/AresDeathBeamStart.cs | 96 +- Projectiles/Boss/AresDeathBeamTelegraph.cs | 48 +- Projectiles/Boss/AresGaussNukeProjectile.cs | 117 +- .../Boss/AresGaussNukeProjectileBoom.cs | 18 +- .../Boss/AresGaussNukeProjectileSpark.cs | 74 +- Projectiles/Boss/AresLaserBeamStart.cs | 110 +- Projectiles/Boss/AresPlasmaBolt.cs | 72 +- Projectiles/Boss/AresPlasmaFireball.cs | 107 +- Projectiles/Boss/AresTeslaOrb.cs | 100 +- Projectiles/Boss/ArtemisChargeTelegraph.cs | 42 +- Projectiles/Boss/ArtemisDeathrayTelegraph.cs | 48 +- Projectiles/Boss/ArtemisLaser.cs | 132 +- Projectiles/Boss/ArtemisLaserBeamStart.cs | 88 +- Projectiles/Boss/AstralFlame.cs | 107 +- Projectiles/Boss/AstralGodRay.cs | 76 +- Projectiles/Boss/AstralLaser.cs | 70 +- Projectiles/Boss/AstralShot2.cs | 70 +- Projectiles/Boss/BigFlare.cs | 93 +- Projectiles/Boss/BigFlare2.cs | 93 +- Projectiles/Boss/BirbAura.cs | 109 +- Projectiles/Boss/BirbAuraFlare.cs | 65 +- Projectiles/Boss/BloodGeyser.cs | 26 +- Projectiles/Boss/BrimstoneBall.cs | 20 +- Projectiles/Boss/BrimstoneBarrage.cs | 82 +- Projectiles/Boss/BrimstoneFire.cs | 34 +- Projectiles/Boss/BrimstoneFireblast.cs | 91 +- Projectiles/Boss/BrimstoneGigaBlast.cs | 93 +- Projectiles/Boss/BrimstoneHellblast.cs | 75 +- Projectiles/Boss/BrimstoneHellblast2.cs | 76 +- Projectiles/Boss/BrimstoneHellfireball.cs | 87 +- Projectiles/Boss/BrimstoneMonster.cs | 95 +- Projectiles/Boss/BrimstoneRay.cs | 124 +- Projectiles/Boss/BrimstoneTargetRay.cs | 102 +- Projectiles/Boss/BrimstoneWave.cs | 62 +- Projectiles/Boss/BrokenApolloLens.cs | 36 +- Projectiles/Boss/BrokenArtemisLens.cs | 36 +- Projectiles/Boss/DarkEnergyBall.cs | 84 +- Projectiles/Boss/DarkEnergyBall2.cs | 84 +- Projectiles/Boss/DarkOrb.cs | 270 +- Projectiles/Boss/DestroyerCursedLaser.cs | 47 +- Projectiles/Boss/DestroyerElectricLaser.cs | 47 +- Projectiles/Boss/DeusMine.cs | 85 +- Projectiles/Boss/DeusRitualDrama.cs | 49 +- Projectiles/Boss/DoGBeam.cs | 66 +- Projectiles/Boss/DoGBeamPortal.cs | 73 +- Projectiles/Boss/DoGDeath.cs | 60 +- Projectiles/Boss/DoGDeathBoom.cs | 12 +- Projectiles/Boss/DoGFire.cs | 85 +- Projectiles/Boss/DoGP1EndPortal.cs | 28 +- Projectiles/Boss/DoGTeleportRift.cs | 74 +- Projectiles/Boss/DraedonSummonLaser.cs | 37 +- Projectiles/Boss/DyingSun.cs | 30 +- Projectiles/Boss/EssenceDust.cs | 39 +- Projectiles/Boss/Flare.cs | 85 +- Projectiles/Boss/FlareBomb.cs | 107 +- Projectiles/Boss/FlareDust.cs | 103 +- Projectiles/Boss/FlareDust2.cs | 91 +- Projectiles/Boss/Flarenado.cs | 120 +- Projectiles/Boss/FrostMist.cs | 112 +- Projectiles/Boss/GreatSandBlast.cs | 61 +- Projectiles/Boss/HealOrbProv.cs | 36 +- Projectiles/Boss/HellfireExplosion.cs | 51 +- Projectiles/Boss/HiveBombGoliath.cs | 87 +- Projectiles/Boss/HolyAura.cs | 32 +- Projectiles/Boss/HolyBlast.cs | 77 +- Projectiles/Boss/HolyBomb.cs | 87 +- Projectiles/Boss/HolyBurnOrb.cs | 53 +- Projectiles/Boss/HolyExplosionBoom.cs | 12 +- Projectiles/Boss/HolyFire.cs | 87 +- Projectiles/Boss/HolyFire2.cs | 85 +- Projectiles/Boss/HolyFlare.cs | 95 +- Projectiles/Boss/HolyLight.cs | 69 +- Projectiles/Boss/HolySpear.cs | 120 +- Projectiles/Boss/IceBlast.cs | 51 +- Projectiles/Boss/IceBomb.cs | 77 +- Projectiles/Boss/IceRain.cs | 71 +- Projectiles/Boss/IchorBlob.cs | 137 +- Projectiles/Boss/IchorShot.cs | 40 +- Projectiles/Boss/Infernado.cs | 120 +- Projectiles/Boss/Infernado2.cs | 120 +- Projectiles/Boss/InfernadoRevenge.cs | 38 +- Projectiles/Boss/JewelProjectile.cs | 25 +- Projectiles/Boss/LeviathanBomb.cs | 49 +- Projectiles/Boss/LeviathanSpawner.cs | 33 +- Projectiles/Boss/MajesticSparkle.cs | 52 +- Projectiles/Boss/MoltenBlast.cs | 89 +- Projectiles/Boss/MoltenBlob.cs | 73 +- Projectiles/Boss/MushBomb.cs | 83 +- Projectiles/Boss/MushBombFall.cs | 85 +- Projectiles/Boss/OldDukeGore.cs | 59 +- Projectiles/Boss/OldDukeSummonDrop.cs | 28 +- Projectiles/Boss/OldDukeVortex.cs | 99 +- .../Boss/OverlyDramaticDukeSummoner.cs | 84 +- Projectiles/Boss/PhantomBlast.cs | 89 +- Projectiles/Boss/PhantomBlast2.cs | 89 +- Projectiles/Boss/PhantomGhostShot.cs | 49 +- Projectiles/Boss/PhantomHookShot.cs | 49 +- Projectiles/Boss/PhantomMine.cs | 51 +- Projectiles/Boss/PhantomShot.cs | 53 +- Projectiles/Boss/PhantomShot2.cs | 53 +- Projectiles/Boss/PlagueExplosion.cs | 34 +- Projectiles/Boss/PlagueStingerGoliath.cs | 58 +- Projectiles/Boss/PlagueStingerGoliathV2.cs | 53 +- Projectiles/Boss/ProfanedSpear.cs | 72 +- Projectiles/Boss/ProvidenceCrystal.cs | 97 +- Projectiles/Boss/ProvidenceCrystalShard.cs | 97 +- Projectiles/Boss/ProvidenceHolyRay.cs | 116 +- Projectiles/Boss/RavagerFlame.cs | 31 +- Projectiles/Boss/RedLightning.cs | 126 +- Projectiles/Boss/RedLightningFeather.cs | 111 +- Projectiles/Boss/SCalRitualDrama.cs | 25 +- Projectiles/Boss/SandBlast.cs | 69 +- Projectiles/Boss/SandPoisonCloud.cs | 78 +- Projectiles/Boss/SandPoisonCloudOldDuke.cs | 74 +- Projectiles/Boss/SandTooth.cs | 42 +- Projectiles/Boss/SandToothOldDuke.cs | 36 +- Projectiles/Boss/ScavengerLaser.cs | 177 +- Projectiles/Boss/ScavengerNuke.cs | 87 +- Projectiles/Boss/ShadeNimbusHostile.cs | 52 +- Projectiles/Boss/ShaderainHostile.cs | 24 +- Projectiles/Boss/ShadowflameFireball.cs | 67 +- Projectiles/Boss/Shadowflamethrower.cs | 34 +- Projectiles/Boss/SignusScythe.cs | 65 +- Projectiles/Boss/SirenSong.cs | 62 +- Projectiles/Boss/SkyFlare.cs | 53 +- Projectiles/Boss/SkyFlareRevenge.cs | 51 +- Projectiles/Boss/SporeGasPlantera.cs | 72 +- Projectiles/Boss/SupremeCataclysmFist.cs | 52 +- Projectiles/Boss/SupremeCatastropheSlash.cs | 60 +- Projectiles/Boss/SwirlingFire.cs | 22 +- Projectiles/Boss/ThanatosBeamStart.cs | 101 +- Projectiles/Boss/ThanatosBeamTelegraph.cs | 40 +- Projectiles/Boss/ThanatosLaser.cs | 172 +- Projectiles/Boss/ToxicCloud.cs | 82 +- Projectiles/Boss/VileClot.cs | 33 +- Projectiles/Boss/WaterSpear.cs | 58 +- Projectiles/Boss/YharonFireball.cs | 76 +- Projectiles/Boss/YharonFireball2.cs | 91 +- Projectiles/CalamityGlobalProjectile.cs | 93 +- .../Damageable/ArtifactOfResilienceBulwark.cs | 20 +- .../Damageable/DamageableProjectile.cs | 36 +- .../FrequencyManipulatorEnergy.cs | 40 +- .../FrequencyManipulatorProjectile.cs | 65 +- .../GalvanizingGlaiveProjectile.cs | 58 +- .../DraedonsArsenal/GatlingLaserProj.cs | 79 +- .../DraedonsArsenal/GatlingLaserShot.cs | 76 +- Projectiles/DraedonsArsenal/GaussEnergy.cs | 14 +- Projectiles/DraedonsArsenal/GaussFlux.cs | 30 +- .../DraedonsArsenal/GaussPistolShot.cs | 44 +- .../DraedonsArsenal/GaussRifleBlast.cs | 27 +- .../DraedonsArsenal/GaussRifleExplosion.cs | 22 +- .../HydraulicVoltCrasherProjectile.cs | 99 +- Projectiles/DraedonsArsenal/LaserRifleShot.cs | 62 +- .../DraedonsArsenal/MassivePlasmaExplosion.cs | 41 +- .../DraedonsArsenal/MountedScannerLaser.cs | 48 +- .../DraedonsArsenal/MountedScannerSummon.cs | 93 +- .../DraedonsArsenal/PhaseslayerBeam.cs | 40 +- .../DraedonsArsenal/PhaseslayerProjectile.cs | 155 +- .../DraedonsArsenal/PlasmaCasterShot.cs | 85 +- .../PlasmaGrenadeProjectile.cs | 47 +- .../PlasmaGrenadeSmallExplosion.cs | 32 +- .../DraedonsArsenal/PoleWarperSummon.cs | 98 +- .../DraedonsArsenal/PulseDragonProjectile.cs | 104 +- .../DraedonsArsenal/PulsePistolShot.cs | 64 +- Projectiles/DraedonsArsenal/PulseRifleShot.cs | 89 +- Projectiles/DraedonsArsenal/PulseTurret.cs | 113 +- .../DraedonsArsenal/PulseTurretShot.cs | 46 +- .../DraedonsArsenal/SnakeEyesSummon.cs | 128 +- .../DraedonsArsenal/StarSwallowerAcid.cs | 44 +- .../DraedonsArsenal/StarSwallowerSummon.cs | 163 +- .../DraedonsArsenal/SystemBaneLightning.cs | 68 +- .../DraedonsArsenal/SystemBaneProjectile.cs | 72 +- Projectiles/DraedonsArsenal/TaserHook.cs | 62 +- .../DraedonsArsenal/TeslaCannonShot.cs | 111 +- .../DraedonsArsenal/TrackingDiskLaser.cs | 42 +- .../DraedonsArsenal/TrackingDiskProjectile.cs | 84 +- Projectiles/DraedonsArsenal/UnstableMatter.cs | 50 +- Projectiles/DraedonsArsenal/VoltageStream.cs | 40 +- .../DraedonsArsenal/WavePounderBoom.cs | 20 +- .../DraedonsArsenal/WavePounderProjectile.cs | 43 +- Projectiles/Enemy/BelchingCoralSpike.cs | 32 +- Projectiles/Enemy/CrabBoulder.cs | 28 +- Projectiles/Enemy/CragmawAcidDrop.cs | 26 +- Projectiles/Enemy/CragmawBeam.cs | 104 +- Projectiles/Enemy/CragmawBubble.cs | 85 +- Projectiles/Enemy/CragmawExplosion.cs | 24 +- Projectiles/Enemy/CragmawSpike.cs | 24 +- Projectiles/Enemy/CragmawVibeCheckChain.cs | 76 +- Projectiles/Enemy/CrimsonSpike.cs | 41 +- Projectiles/Enemy/DraedonLaser.cs | 37 +- Projectiles/Enemy/EarthRockBig.cs | 53 +- Projectiles/Enemy/EarthRockSmall.cs | 37 +- Projectiles/Enemy/FlakAcid.cs | 46 +- Projectiles/Enemy/FlameBurstHostile.cs | 63 +- Projectiles/Enemy/GammaAcid.cs | 34 +- Projectiles/Enemy/GammaBeam.cs | 100 +- Projectiles/Enemy/HorsWaterBlast.cs | 35 +- Projectiles/Enemy/InkBombHostile.cs | 59 +- Projectiles/Enemy/InkPoisonCloud.cs | 62 +- Projectiles/Enemy/InkPoisonCloud2.cs | 62 +- Projectiles/Enemy/InkPoisonCloud3.cs | 62 +- Projectiles/Enemy/LightningCloud.cs | 45 +- Projectiles/Enemy/MantisRing.cs | 45 +- Projectiles/Enemy/MaulerAcidBubble.cs | 45 +- Projectiles/Enemy/MaulerAcidDrop.cs | 26 +- Projectiles/Enemy/NuclearBulletLarge.cs | 20 +- Projectiles/Enemy/NuclearBulletMedium.cs | 42 +- Projectiles/Enemy/NuclearToadGoo.cs | 28 +- Projectiles/Enemy/OrthoceraStream.cs | 42 +- Projectiles/Enemy/PearlBurst.cs | 74 +- Projectiles/Enemy/PearlRain.cs | 38 +- Projectiles/Enemy/PufferExplosion.cs | 53 +- Projectiles/Enemy/StormMarkHostile.cs | 113 +- Projectiles/Enemy/SulphuricAcidBubble.cs | 105 +- Projectiles/Enemy/SulphuricAcidMist.cs | 67 +- Projectiles/Enemy/TornadoHostile.cs | 67 +- Projectiles/Enemy/ToxicMinnowCloud.cs | 74 +- Projectiles/Enemy/TrilobiteSpike.cs | 22 +- Projectiles/Environment/AcidDrop.cs | 24 +- Projectiles/Environment/BrimstoneGeyser.cs | 95 +- Projectiles/Environment/GeyserTelegraph.cs | 22 +- Projectiles/Environment/HotSteam.cs | 14 +- Projectiles/Environment/LavaChunk.cs | 68 +- Projectiles/Environment/LightningMark.cs | 45 +- Projectiles/Environment/SmokeTelegraph.cs | 95 +- Projectiles/Healing/AtaxiaHealOrb.cs | 22 +- Projectiles/Healing/AuricOrb.cs | 36 +- Projectiles/Healing/BurntSiennaProj.cs | 24 +- Projectiles/Healing/CactusHealOrb.cs | 24 +- Projectiles/Healing/DemonHeal.cs | 16 +- Projectiles/Healing/EarthHealOrb.cs | 22 +- Projectiles/Healing/EssenceFlame.cs | 55 +- Projectiles/Healing/Exoheal.cs | 22 +- Projectiles/Healing/FungalHeal.cs | 34 +- Projectiles/Healing/GodSlayerHealOrb.cs | 22 +- Projectiles/Healing/ManaOverloaderHealOrb.cs | 22 +- Projectiles/Healing/PhantomicHeart.cs | 54 +- Projectiles/Healing/PhoenixHeal.cs | 24 +- Projectiles/Healing/RainHeal.cs | 28 +- Projectiles/Healing/ReaverHealOrb.cs | 22 +- Projectiles/Healing/RoyalHeal.cs | 24 +- Projectiles/Healing/ShinobiHealOrb.cs | 18 +- Projectiles/Healing/SilvaOrb.cs | 36 +- Projectiles/Healing/TerracottaProj.cs | 26 +- Projectiles/Healing/TransfusionTrail.cs | 24 +- Projectiles/Healing/XerocHealOrb.cs | 24 +- Projectiles/Hybrid/AetherBeam.cs | 64 +- Projectiles/Magic/AbyssBall.cs | 49 +- Projectiles/Magic/AcidGunStream.cs | 44 +- Projectiles/Magic/AcidicReed.cs | 45 +- Projectiles/Magic/AcidicSaxBubble.cs | 115 +- Projectiles/Magic/AcidicSaxMist.cs | 73 +- Projectiles/Magic/AetherfluxCannonHoldout.cs | 73 +- Projectiles/Magic/Ancient.cs | 70 +- Projectiles/Magic/Ancient2.cs | 68 +- Projectiles/Magic/ApotheosisEnergy.cs | 46 +- Projectiles/Magic/ApotheosisWorm.cs | 125 +- Projectiles/Magic/AquamarineBolt.cs | 30 +- Projectiles/Magic/ArcticBearPawProj.cs | 34 +- Projectiles/Magic/ArtAttackHoldout.cs | 50 +- Projectiles/Magic/ArtAttackStar.cs | 97 +- Projectiles/Magic/Asteroid.cs | 81 +- Projectiles/Magic/AsteroidMolten.cs | 109 +- Projectiles/Magic/AstralCrystal.cs | 63 +- .../Magic/AstralCrystalInvisibleExplosion.cs | 18 +- Projectiles/Magic/AstralStarMagic.cs | 81 +- Projectiles/Magic/AstralachneaFang.cs | 31 +- Projectiles/Magic/AtlantisSpear.cs | 70 +- Projectiles/Magic/AtlantisSpear2.cs | 52 +- Projectiles/Magic/AuraRain.cs | 32 +- Projectiles/Magic/AuroraAustralis.cs | 56 +- Projectiles/Magic/BeamStar.cs | 54 +- Projectiles/Magic/BeamingBolt.cs | 41 +- Projectiles/Magic/BeamingBolt2.cs | 32 +- Projectiles/Magic/BeastScythe.cs | 131 +- Projectiles/Magic/BigBeamofDeath.cs | 34 +- Projectiles/Magic/BigBeamofDeath2.cs | 24 +- Projectiles/Magic/BlackAnurianBubble.cs | 55 +- Projectiles/Magic/BlackAnurianPlankton.cs | 96 +- Projectiles/Magic/BlindingLight.cs | 42 +- Projectiles/Magic/BloodBeam.cs | 34 +- Projectiles/Magic/BloodBlast.cs | 40 +- Projectiles/Magic/BloodRay.cs | 28 +- Projectiles/Magic/BlueBubble.cs | 49 +- Projectiles/Magic/BlushieStaffProj.cs | 86 +- Projectiles/Magic/BrimstoneBeam.cs | 30 +- Projectiles/Magic/BrimstoneBeam2.cs | 26 +- Projectiles/Magic/BrimstoneBeam3.cs | 26 +- Projectiles/Magic/BrimstoneBeam4.cs | 26 +- Projectiles/Magic/BrimstoneBeam5.cs | 20 +- Projectiles/Magic/BrimstoneFireball.cs | 83 +- .../Magic/BrimstoneHellfireballFriendly.cs | 69 +- Projectiles/Magic/BrimstoneHomer.cs | 26 +- Projectiles/Magic/BrimstoneTentacle.cs | 82 +- Projectiles/Magic/ClamorNoctusStar.cs | 61 +- Projectiles/Magic/ClamorNoctusWyvern.cs | 37 +- Projectiles/Magic/ClimaxBeam.cs | 20 +- Projectiles/Magic/ClimaxProj.cs | 60 +- Projectiles/Magic/CoralSpike.cs | 20 +- Projectiles/Magic/CosmicTentacle.cs | 82 +- Projectiles/Magic/Crescent.cs | 46 +- Projectiles/Magic/CryoBlast.cs | 85 +- Projectiles/Magic/DarkSparkBeam.cs | 136 +- Projectiles/Magic/DarkSparkPrism.cs | 159 +- Projectiles/Magic/DeathhailBeam.cs | 22 +- Projectiles/Magic/DivineRetributionSpear.cs | 81 +- Projectiles/Magic/DustProjectile.cs | 62 +- Projectiles/Magic/EelDrop.cs | 26 +- Projectiles/Magic/EidolicWailSoundwave.cs | 64 +- Projectiles/Magic/EldritchTentacle.cs | 78 +- Projectiles/Magic/ElementBolt.cs | 26 +- Projectiles/Magic/ElementBolt2.cs | 18 +- Projectiles/Magic/ElementOrb.cs | 18 +- Projectiles/Magic/ElementOrb2.cs | 18 +- Projectiles/Magic/ElementTentacle.cs | 78 +- Projectiles/Magic/ElementalRayBeam.cs | 32 +- Projectiles/Magic/EnormousConsumingVortex.cs | 103 +- Projectiles/Magic/EternityBook.cs | 53 +- Projectiles/Magic/EternityCircle.cs | 42 +- Projectiles/Magic/EternityCrystal.cs | 81 +- Projectiles/Magic/EternityHex.cs | 64 +- Projectiles/Magic/EternityHoming.cs | 30 +- Projectiles/Magic/EventHorizonBlackhole.cs | 48 +- Projectiles/Magic/EventHorizonStar.cs | 75 +- Projectiles/Magic/EvergladeSprayProjectile.cs | 46 +- Projectiles/Magic/FabBolt.cs | 64 +- Projectiles/Magic/FabRay.cs | 72 +- Projectiles/Magic/FatesRevealFlame.cs | 123 +- Projectiles/Magic/FlameBeamTip.cs | 56 +- Projectiles/Magic/FlameBeamTip2.cs | 44 +- Projectiles/Magic/FlamingPumpkin.cs | 16 +- Projectiles/Magic/FlareBoltProjectile.cs | 65 +- Projectiles/Magic/ForbiddenAxeBlade.cs | 44 +- Projectiles/Magic/ForbiddenSunProjectile.cs | 43 +- Projectiles/Magic/ForbiddenSunburst.cs | 47 +- .../Magic/FrigidflashBoltProjectile.cs | 79 +- Projectiles/Magic/FrostBoltProjectile.cs | 67 +- Projectiles/Magic/GammaLaser.cs | 26 +- Projectiles/Magic/GhastlyBlast.cs | 177 +- Projectiles/Magic/GhastlyExplosion.cs | 35 +- Projectiles/Magic/GhastlyExplosionShard.cs | 50 +- Projectiles/Magic/GhastlySubBlast.cs | 66 +- Projectiles/Magic/GhastlyVisageProj.cs | 117 +- Projectiles/Magic/GleamingBolt.cs | 31 +- Projectiles/Magic/GleamingBolt2.cs | 26 +- Projectiles/Magic/GraniteEnergy.cs | 22 +- Projectiles/Magic/GranitePulse.cs | 103 +- Projectiles/Magic/GruesomeEminenceHoldout.cs | 53 +- Projectiles/Magic/HadopelagicEcho2.cs | 46 +- Projectiles/Magic/HadopelagicEchoSoundwave.cs | 79 +- Projectiles/Magic/HeliumFlashBlast.cs | 45 +- .../Magic/HellfireExplosionFriendly.cs | 43 +- Projectiles/Magic/HellwingPillar.cs | 56 +- Projectiles/Magic/HeresyProj.cs | 67 +- Projectiles/Magic/HolyFlame.cs | 59 +- Projectiles/Magic/HolyLaser.cs | 30 +- Projectiles/Magic/IceBarrageMain.cs | 102 +- Projectiles/Magic/IceBlock.cs | 59 +- Projectiles/Magic/IceBlockIcicle.cs | 35 +- Projectiles/Magic/IceCluster.cs | 67 +- Projectiles/Magic/IceSpike.cs | 27 +- Projectiles/Magic/Icicle.cs | 23 +- Projectiles/Magic/IcicleStaffProj.cs | 29 +- Projectiles/Magic/InfernadoFriendly.cs | 128 +- Projectiles/Magic/InfernadoMarkFriendly.cs | 91 +- Projectiles/Magic/InfernalBlade.cs | 85 +- Projectiles/Magic/InfernalBlade2.cs | 81 +- Projectiles/Magic/IonBlast.cs | 77 +- Projectiles/Magic/KeelhaulBubble.cs | 14 +- Projectiles/Magic/KeelhaulGeyserBottom.cs | 36 +- Projectiles/Magic/KeelhaulGeyserTop.cs | 36 +- Projectiles/Magic/LightBall.cs | 47 +- Projectiles/Magic/LightBallExplosion.cs | 18 +- Projectiles/Magic/LightBead.cs | 44 +- Projectiles/Magic/LightBeadSplit.cs | 24 +- Projectiles/Magic/LightBlade.cs | 105 +- Projectiles/Magic/LightningArc.cs | 46 +- Projectiles/Magic/LiquidBlade.cs | 87 +- Projectiles/Magic/LiquidBlade2.cs | 83 +- Projectiles/Magic/LuxorsGiftMagic.cs | 68 +- Projectiles/Magic/MadAlchemistsCocktailAlt.cs | 71 +- .../Magic/MadAlchemistsCocktailBlue.cs | 39 +- .../Magic/MadAlchemistsCocktailGasCloud.cs | 38 +- .../Magic/MadAlchemistsCocktailGreen.cs | 49 +- .../Magic/MadAlchemistsCocktailPurple.cs | 39 +- Projectiles/Magic/MadAlchemistsCocktailRed.cs | 75 +- .../Magic/MadAlchemistsCocktailShrapnel.cs | 38 +- Projectiles/Magic/MagnaBlast.cs | 32 +- Projectiles/Magic/MagneticBeam.cs | 18 +- Projectiles/Magic/MagneticOrb.cs | 60 +- Projectiles/Magic/MagnusBeam.cs | 163 +- Projectiles/Magic/ManaBolt.cs | 33 +- Projectiles/Magic/ManaBoltSmall.cs | 31 +- Projectiles/Magic/ManaBoltSmall2.cs | 29 +- Projectiles/Magic/ManaMonster.cs | 61 +- Projectiles/Magic/MelterAmp.cs | 74 +- Projectiles/Magic/MelterNote1.cs | 38 +- Projectiles/Magic/MelterNote2.cs | 38 +- Projectiles/Magic/MeteorStar.cs | 131 +- Projectiles/Magic/MeteorStarExplosion.cs | 30 +- Projectiles/Magic/MiasmaGas.cs | 50 +- Projectiles/Magic/NanoPurgeHoldout.cs | 69 +- Projectiles/Magic/NanoPurgeLaser.cs | 44 +- Projectiles/Magic/NebulaElementalBeam.cs | 32 +- Projectiles/Magic/NettleRight.cs | 56 +- Projectiles/Magic/NettleTip.cs | 18 +- Projectiles/Magic/NightBolt.cs | 18 +- Projectiles/Magic/NightOrb.cs | 18 +- Projectiles/Magic/NightsRayBeam.cs | 30 +- Projectiles/Magic/NuclearFuryProjectile.cs | 95 +- Projectiles/Magic/ParticleBeamofDoom.cs | 28 +- Projectiles/Magic/PartySparkle.cs | 68 +- Projectiles/Magic/PhantasmalFuryProj.cs | 63 +- Projectiles/Magic/Phantom.cs | 24 +- Projectiles/Magic/PhasedGodRay.cs | 70 +- Projectiles/Magic/PlagueFang.cs | 51 +- Projectiles/Magic/PlasmaBolt.cs | 24 +- Projectiles/Magic/PlasmaRay.cs | 54 +- Projectiles/Magic/PlasmaRay2.cs | 42 +- Projectiles/Magic/PlasmaShot.cs | 33 +- Projectiles/Magic/PoseidonTyphoon.cs | 35 +- Projectiles/Magic/PrinceFlameLarge.cs | 77 +- Projectiles/Magic/PrinceFlameSmall.cs | 34 +- Projectiles/Magic/RainbowComet.cs | 63 +- .../Magic/RainbowPartyCannonProjectile.cs | 59 +- Projectiles/Magic/RainbowRocket.cs | 125 +- Projectiles/Magic/RancorArm.cs | 91 +- Projectiles/Magic/RancorFog.cs | 42 +- Projectiles/Magic/RancorHoldout.cs | 44 +- Projectiles/Magic/RancorLargeCinder.cs | 32 +- Projectiles/Magic/RancorLaserbeam.cs | 86 +- Projectiles/Magic/RancorMagicCircle.cs | 106 +- Projectiles/Magic/RancorSmallCinder.cs | 34 +- Projectiles/Magic/RedirectingFire.cs | 43 +- Projectiles/Magic/RedirectingGildedSoul.cs | 57 +- Projectiles/Magic/RedirectingLostSoul.cs | 53 +- Projectiles/Magic/RedirectingVengefulSoul.cs | 59 +- Projectiles/Magic/RougeSlashLarge.cs | 54 +- Projectiles/Magic/RougeSlashMedium.cs | 54 +- Projectiles/Magic/RougeSlashSmall.cs | 54 +- Projectiles/Magic/SHPB.cs | 81 +- Projectiles/Magic/SHPExplosion.cs | 36 +- Projectiles/Magic/SHPL.cs | 46 +- Projectiles/Magic/SanguineFlareProj.cs | 69 +- .../SeethingDischargeBrimstoneBarrage.cs | 46 +- .../SeethingDischargeBrimstoneHellblast.cs | 77 +- Projectiles/Magic/SerpentineBody.cs | 76 +- Projectiles/Magic/SerpentineHead.cs | 143 +- Projectiles/Magic/SerpentineTail.cs | 76 +- Projectiles/Magic/ShadeNimbus.cs | 60 +- Projectiles/Magic/ShadeNimbusCloud.cs | 38 +- Projectiles/Magic/ShadecrystalProjectile.cs | 50 +- Projectiles/Magic/Shaderain.cs | 22 +- Projectiles/Magic/Shadowbolt.cs | 48 +- Projectiles/Magic/ShiftingSandsProj.cs | 121 +- Projectiles/Magic/SilvaBurst.cs | 30 +- Projectiles/Magic/SirensSongNote.cs | 71 +- Projectiles/Magic/SlitheringEelProjectile.cs | 72 +- Projectiles/Magic/SmallSpirit.cs | 60 +- Projectiles/Magic/Snowball.cs | 37 +- Projectiles/Magic/Snowflake.cs | 37 +- Projectiles/Magic/SolarBeam2.cs | 44 +- Projectiles/Magic/SolarElementalBeam.cs | 32 +- Projectiles/Magic/SoulPiercerBeam.cs | 34 +- Projectiles/Magic/SoulPiercerBolt.cs | 24 +- Projectiles/Magic/SparkInfernal.cs | 18 +- Projectiles/Magic/SparklingBeam.cs | 109 +- Projectiles/Magic/SpiritCongregation.cs | 153 +- Projectiles/Magic/SpiritDust.cs | 16 +- Projectiles/Magic/SpiritFlameCurse.cs | 67 +- Projectiles/Magic/Starblast.cs | 54 +- Projectiles/Magic/StardustElementalBeam.cs | 42 +- Projectiles/Magic/StickyFeather.cs | 45 +- Projectiles/Magic/StratusSphereProj.cs | 90 +- Projectiles/Magic/SubsumingTentacle.cs | 96 +- .../Magic/SupremeDustFlakProjectile.cs | 40 +- Projectiles/Magic/SupremeDustProjectile.cs | 44 +- Projectiles/Magic/TacticiansElectricBoom.cs | 26 +- Projectiles/Magic/TacticiansTrumpCardProj.cs | 38 +- Projectiles/Magic/TearsofHeavenProjectile.cs | 48 +- Projectiles/Magic/TerraBeam.cs | 44 +- Projectiles/Magic/TerraShard.cs | 14 +- Projectiles/Magic/ThunderstormShot.cs | 53 +- Projectiles/Magic/ThunderstormShotSplit.cs | 59 +- Projectiles/Magic/TradewindsProjectile.cs | 42 +- Projectiles/Magic/TridentIcicle.cs | 27 +- Projectiles/Magic/UberBubble.cs | 45 +- Projectiles/Magic/UndinesRetributionSpear.cs | 97 +- Projectiles/Magic/ValkyrieRayBeam.cs | 90 +- Projectiles/Magic/ValkyrieRayStaff.cs | 67 +- Projectiles/Magic/Vehemence.cs | 49 +- Projectiles/Magic/VehemenceHoldout.cs | 58 +- Projectiles/Magic/VehemenceSkull.cs | 56 +- Projectiles/Magic/VenusianBolt.cs | 51 +- Projectiles/Magic/VenusianExplosion.cs | 43 +- Projectiles/Magic/VenusianFlame.cs | 98 +- Projectiles/Magic/VisceraBeam.cs | 46 +- Projectiles/Magic/VitriolicViperFang.cs | 34 +- Projectiles/Magic/VitriolicViperSpit.cs | 20 +- Projectiles/Magic/VividBeam.cs | 64 +- Projectiles/Magic/VividBolt.cs | 42 +- Projectiles/Magic/VividClarityBeam.cs | 70 +- Projectiles/Magic/VividExplosion.cs | 26 +- Projectiles/Magic/VividLaser2.cs | 40 +- Projectiles/Magic/VividOrb.cs | 22 +- Projectiles/Magic/VoidVortexProj.cs | 62 +- Projectiles/Magic/VolatileStarcore.cs | 61 +- Projectiles/Magic/Vortex.cs | 72 +- Projectiles/Magic/VortexElementalBeam.cs | 88 +- Projectiles/Magic/WaterLeechProj.cs | 65 +- Projectiles/Magic/WaterStream.cs | 54 +- Projectiles/Magic/WaterStream2.cs | 42 +- Projectiles/Magic/WaywasherProj.cs | 41 +- Projectiles/Magic/WulfrumBolt.cs | 26 +- Projectiles/Magic/WyvernFeatherGreen.cs | 49 +- Projectiles/Magic/WyvernFeatherPink.cs | 47 +- Projectiles/Magic/WyvernFeatherPurple.cs | 47 +- Projectiles/Magic/WyvernProjectile.cs | 35 +- Projectiles/Magic/YharimsCrystalBeam.cs | 126 +- Projectiles/Magic/YharimsCrystalPrism.cs | 113 +- Projectiles/Melee/AegisBeam.cs | 65 +- Projectiles/Melee/AegisBlast.cs | 55 +- Projectiles/Melee/AegisBlast2.cs | 46 +- Projectiles/Melee/AegisFlame.cs | 60 +- Projectiles/Melee/AftershockRock.cs | 20 +- Projectiles/Melee/AmidiasWhirlpool.cs | 93 +- Projectiles/Melee/AncientBeam.cs | 57 +- Projectiles/Melee/AncientStar.cs | 69 +- Projectiles/Melee/AquaStream.cs | 22 +- .../Melee/ArkOfTheAncients_ParryHoldout.cs | 77 +- .../Melee/ArkOfTheAncients_SwungBlade.cs | 87 +- .../Melee/ArkOfTheCosmos_BlastAttack.cs | 85 +- .../Melee/ArkOfTheCosmos_ParryHoldout.cs | 79 +- .../Melee/ArkOfTheCosmos_SwungBlade.cs | 247 +- .../Melee/ArkOfTheElements_ParryHoldout.cs | 81 +- .../Melee/ArkOfTheElements_SnapBlast.cs | 75 +- .../Melee/ArkOfTheElements_SwungBlade.cs | 195 +- .../Melee/ArkoftheCosmos_Constellation.cs | 38 +- Projectiles/Melee/AstralScytheProjectile.cs | 51 +- Projectiles/Melee/AtaraxiaHoming.cs | 86 +- Projectiles/Melee/AtaraxiaMain.cs | 67 +- Projectiles/Melee/AtaraxiaSide.cs | 47 +- Projectiles/Melee/AtaraxiaSplit.cs | 40 +- .../Melee/BalefulHarvesterProjectile.cs | 89 +- Projectiles/Melee/BallOFuguProj.cs | 77 +- Projectiles/Melee/BansheeHookBoom.cs | 66 +- Projectiles/Melee/BansheeHookScythe.cs | 30 +- Projectiles/Melee/BiomeBladeHoldout.cs | 53 +- Projectiles/Melee/BladecrestOathswordProj.cs | 64 +- Projectiles/Melee/BlazingPhantomBlade.cs | 36 +- Projectiles/Melee/Blood.cs | 26 +- Projectiles/Melee/Blood2.cs | 24 +- Projectiles/Melee/BloodBall.cs | 95 +- Projectiles/Melee/BloodExplosion.cs | 33 +- Projectiles/Melee/BloodScythe.cs | 34 +- Projectiles/Melee/BloodyBlade.cs | 28 +- Projectiles/Melee/BlueAura.cs | 20 +- Projectiles/Melee/BonebreakerFragment1.cs | 28 +- Projectiles/Melee/BonebreakerProjectile.cs | 56 +- Projectiles/Melee/Brimblast.cs | 60 +- .../Melee/BrimlanceHellfireExplosion.cs | 53 +- Projectiles/Melee/BrimlanceStandingFire.cs | 67 +- Projectiles/Melee/Brimlash2.cs | 49 +- Projectiles/Melee/BrimlashProj.cs | 57 +- Projectiles/Melee/BrimstoneBoom.cs | 38 +- Projectiles/Melee/BrimstoneLaserFriendly.cs | 38 +- Projectiles/Melee/BrimstoneSwordExplosion.cs | 53 +- Projectiles/Melee/BrinySpout.cs | 122 +- Projectiles/Melee/BrinyTyphoonBubble.cs | 97 +- Projectiles/Melee/BrokenBiomeBladeHoldout.cs | 53 +- .../Melee/BrokenBiomeBlade_AridGrandeur.cs | 77 +- .../Melee/BrokenBiomeBlade_BitingEmbrace.cs | 91 +- .../Melee/BrokenBiomeBlade_DecaysRetort.cs | 61 +- .../BrokenBiomeBlade_GrovetendersTouch.cs | 81 +- .../BrokenBiomeBlade_PurityProjection.cs | 41 +- Projectiles/Melee/BurningMeteor.cs | 67 +- Projectiles/Melee/CalamityAura.cs | 55 +- Projectiles/Melee/CalamityAuraType2.cs | 55 +- Projectiles/Melee/CalamityAuraType3.cs | 55 +- Projectiles/Melee/ChaosFlameLarge.cs | 38 +- Projectiles/Melee/ChaosFlameSmall.cs | 38 +- Projectiles/Melee/ClamCrusherFlail.cs | 119 +- Projectiles/Melee/CometQuasherMeteor.cs | 57 +- Projectiles/Melee/CosmicBolt.cs | 26 +- Projectiles/Melee/CosmicDischargeFlail.cs | 62 +- Projectiles/Melee/CosmicIceBurst.cs | 101 +- Projectiles/Melee/CosmicOrb.cs | 55 +- Projectiles/Melee/CosmicShivBall.cs | 66 +- Projectiles/Melee/CosmicShivBlade.cs | 52 +- Projectiles/Melee/CosmicSpiritBomb1.cs | 41 +- Projectiles/Melee/CosmicSpiritBomb2.cs | 41 +- Projectiles/Melee/CosmicSpiritBomb3.cs | 41 +- Projectiles/Melee/CrescentMoonFlail.cs | 32 +- Projectiles/Melee/CrescentMoonProj.cs | 43 +- Projectiles/Melee/CrystalDust.cs | 22 +- Projectiles/Melee/CrystylCrusherRay.cs | 91 +- Projectiles/Melee/Cyclone.cs | 69 +- Projectiles/Melee/DNA.cs | 66 +- Projectiles/Melee/DNA2.cs | 54 +- Projectiles/Melee/Dark.cs | 26 +- Projectiles/Melee/DarkBall.cs | 97 +- Projectiles/Melee/DarkBeam.cs | 40 +- Projectiles/Melee/DarkIceZero.cs | 55 +- Projectiles/Melee/DemonBlast.cs | 49 +- Projectiles/Melee/DepthOrb.cs | 57 +- Projectiles/Melee/DepthOrb2.cs | 61 +- Projectiles/Melee/DevilsSunriseCyclone.cs | 173 +- Projectiles/Melee/DevilsSunriseProj.cs | 85 +- Projectiles/Melee/DivineHatchetBoomerang.cs | 123 +- Projectiles/Melee/DracoBeam.cs | 42 +- Projectiles/Melee/DracoBeam2.cs | 42 +- Projectiles/Melee/DraconicSpark.cs | 56 +- Projectiles/Melee/DragonPowFlail.cs | 105 +- Projectiles/Melee/DragonRageFireball.cs | 79 +- Projectiles/Melee/DragonRageStaff.cs | 128 +- Projectiles/Melee/Earth2.cs | 65 +- Projectiles/Melee/Earth3.cs | 81 +- Projectiles/Melee/Earth4.cs | 67 +- Projectiles/Melee/EarthProj.cs | 69 +- Projectiles/Melee/ElementBall.cs | 20 +- Projectiles/Melee/ElementBallShiv.cs | 28 +- Projectiles/Melee/ElementalExcaliburBeam.cs | 211 +- Projectiles/Melee/ElementalGlassStar.cs | 69 +- Projectiles/Melee/EmpyreanKnife.cs | 62 +- Projectiles/Melee/EonBolt.cs | 56 +- Projectiles/Melee/EssenceBeam.cs | 43 +- Projectiles/Melee/EssenceFireball.cs | 87 +- Projectiles/Melee/EssenceFlame2.cs | 61 +- Projectiles/Melee/EssenceScythe.cs | 46 +- Projectiles/Melee/EutrophicScimitarProj.cs | 40 +- Projectiles/Melee/EutrophicSpark.cs | 62 +- Projectiles/Melee/ExcelsusBlue.cs | 56 +- Projectiles/Melee/ExcelsusMain.cs | 56 +- Projectiles/Melee/ExcelsusPink.cs | 56 +- Projectiles/Melee/ExoGladComet.cs | 83 +- Projectiles/Melee/ExoGladProj.cs | 36 +- Projectiles/Melee/ExoGladSpears.cs | 67 +- Projectiles/Melee/ExoGladiusBeam.cs | 68 +- Projectiles/Melee/Exobeam.cs | 149 +- Projectiles/Melee/Exoboom.cs | 53 +- Projectiles/Melee/Exocomet.cs | 103 +- Projectiles/Melee/FallenPaladinsHammerProj.cs | 97 +- Projectiles/Melee/Feather.cs | 18 +- Projectiles/Melee/Flarefrost.cs | 41 +- .../Melee/ForbiddenOathbladeProjectile.cs | 30 +- Projectiles/Melee/GaelExplosion.cs | 53 +- Projectiles/Melee/GaelSkull.cs | 143 +- Projectiles/Melee/GaelSkull2.cs | 119 +- Projectiles/Melee/GalacticaComet.cs | 111 +- Projectiles/Melee/GalaxiaBolt.cs | 48 +- Projectiles/Melee/GalaxiaHoldout.cs | 27 +- Projectiles/Melee/GalaxiaTropicRing.cs | 40 +- Projectiles/Melee/Galaxia_AndromedasStride.cs | 103 +- .../Galaxia_AndromedasStrideBoltSpawner.cs | 61 +- Projectiles/Melee/Galaxia_AriesWrath.cs | 99 +- .../Melee/Galaxia_AriesWrathConstellation.cs | 56 +- Projectiles/Melee/Galaxia_PhoenixsPride.cs | 107 +- Projectiles/Melee/Galaxia_PolarisGaze.cs | 81 +- Projectiles/Melee/Galaxia_PolarisGazeDash.cs | 28 +- Projectiles/Melee/Galaxia_PolarisGazeStar.cs | 73 +- Projectiles/Melee/GalaxyBlast.cs | 91 +- Projectiles/Melee/GalaxyBlastType2.cs | 91 +- Projectiles/Melee/GalaxyBlastType3.cs | 91 +- Projectiles/Melee/GalaxySmasherHammer.cs | 107 +- Projectiles/Melee/GalaxyStar.cs | 35 +- Projectiles/Melee/GalileosMoon.cs | 43 +- Projectiles/Melee/GalileosPlanet.cs | 69 +- Projectiles/Melee/GelWave.cs | 47 +- Projectiles/Melee/GemTechYellowShard.cs | 41 +- Projectiles/Melee/GhastlySoulLarge.cs | 97 +- Projectiles/Melee/GhastlySoulMedium.cs | 97 +- Projectiles/Melee/GhastlySoulSmall.cs | 95 +- Projectiles/Melee/GreenDust.cs | 60 +- Projectiles/Melee/GreenWater.cs | 49 +- Projectiles/Melee/HellionSpike.cs | 34 +- Projectiles/Melee/HolyColliderHolyFire.cs | 71 +- Projectiles/Melee/HyperBlade.cs | 40 +- Projectiles/Melee/IceBombFriendly.cs | 73 +- Projectiles/Melee/Iceberg.cs | 29 +- Projectiles/Melee/IllustriousKnife.cs | 46 +- Projectiles/Melee/InsidiousHarpoon.cs | 79 +- Projectiles/Melee/JudgementBlah.cs | 87 +- Projectiles/Melee/JudgementProj.cs | 37 +- Projectiles/Melee/LaserFountain.cs | 26 +- Projectiles/Melee/Leech.cs | 30 +- Projectiles/Melee/LifeScythe.cs | 34 +- Projectiles/Melee/Light.cs | 26 +- Projectiles/Melee/LightBeam.cs | 40 +- Projectiles/Melee/LightningThing.cs | 16 +- Projectiles/Melee/LuxorsGiftMelee.cs | 91 +- Projectiles/Melee/MarianaProjectile.cs | 47 +- Projectiles/Melee/MarniteObliteratorProj.cs | 20 +- .../Melee/MeldGreatswordBigProjectile.cs | 38 +- .../Melee/MeldGreatswordMediumProjectile.cs | 38 +- .../Melee/MeldGreatswordSmallProjectile.cs | 38 +- .../MendedBiomeBlade_BitingEmbraceMist.cs | 46 +- .../MendedBiomeBlade_DecaysRetortDash.cs | 28 +- .../MendedBiomeBlade_ExtantAbhorrence.cs | 97 +- ...ndedBiomeBlade_ExtantAbhorrenceMonolith.cs | 61 +- .../MendedBiomeBlade_GestureForTheDrowned.cs | 32 +- ...endedBiomeBlade_GestureForTheDrownedOrb.cs | 134 +- ...dBiomeBlade_GrovetendersEntanglingVines.cs | 34 +- .../Melee/MendedBiomeBlade_HeavensMight.cs | 107 +- .../MendedBiomeBlade_PurityProjectionSigil.cs | 34 +- .../MendedBiomeBlade_TrueAridGrandeur.cs | 83 +- .../MendedBiomeBlade_TrueAridGrandeurShot.cs | 53 +- .../MendedBiomeBlade_TrueBitingEmbrace.cs | 85 +- .../MendedBiomeBlade_TrueDecaysRetort.cs | 71 +- .../MendedBiomeBlade_TrueGrovetendersTouch.cs | 89 +- .../MendedBiomeBlade_TruePurityProjection.cs | 57 +- Projectiles/Melee/MicrowaveAura.cs | 37 +- Projectiles/Melee/MirrorBlast.cs | 46 +- Projectiles/Melee/MonstrousKnife.cs | 52 +- Projectiles/Melee/MourningSkull.cs | 99 +- Projectiles/Melee/MourningstarFlail.cs | 28 +- Projectiles/Melee/MurasamaSlash.cs | 83 +- Projectiles/Melee/Nebudust.cs | 39 +- Projectiles/Melee/NebulaShot.cs | 39 +- Projectiles/Melee/NebulashFlail.cs | 28 +- Projectiles/Melee/NeptuneOrb.cs | 63 +- Projectiles/Melee/NightStabber.cs | 28 +- Projectiles/Melee/Oathblade.cs | 26 +- Projectiles/Melee/OathswordFlame.cs | 29 +- Projectiles/Melee/OceanBeam.cs | 71 +- Projectiles/Melee/OldLordOathswordProj.cs | 79 +- Projectiles/Melee/OmnibladeSwing.cs | 68 +- Projectiles/Melee/Orbacle.cs | 36 +- .../Melee/PhosphorescentGauntletPunches.cs | 88 +- Projectiles/Melee/PhotonRipperProjectile.cs | 119 +- Projectiles/Melee/PlagueBeeDust.cs | 88 +- Projectiles/Melee/PlagueDust.cs | 78 +- Projectiles/Melee/PlagueSeeker.cs | 30 +- Projectiles/Melee/PrismRay.cs | 112 +- Projectiles/Melee/PrismTooth.cs | 68 +- Projectiles/Melee/PrismaticBeam.cs | 69 +- Projectiles/Melee/PrismaticWave.cs | 70 +- Projectiles/Melee/ProfanedSwordProj.cs | 44 +- Projectiles/Melee/PwnagehammerEcho.cs | 86 +- Projectiles/Melee/PwnagehammerProj.cs | 107 +- Projectiles/Melee/RSSolarFlare.cs | 101 +- Projectiles/Melee/RainBolt.cs | 33 +- Projectiles/Melee/RainbowBoom.cs | 46 +- Projectiles/Melee/Razorwind.cs | 48 +- Projectiles/Melee/RedDust.cs | 60 +- Projectiles/Melee/RedtideWhirlpool.cs | 65 +- Projectiles/Melee/RemsRevengeProj.cs | 84 +- Projectiles/Melee/RendingNeedle.cs | 63 +- Projectiles/Melee/Rox1.cs | 41 +- Projectiles/Melee/RoxShockwave.cs | 14 +- Projectiles/Melee/RoxSlam.cs | 41 +- Projectiles/Melee/SHIV.cs | 34 +- Projectiles/Melee/SandBlade.cs | 40 +- Projectiles/Melee/SandFire.cs | 26 +- Projectiles/Melee/ScourgeoftheCosmosMini.cs | 128 +- Projectiles/Melee/ScourgeoftheCosmosProj.cs | 79 +- Projectiles/Melee/SeashineSwordProj.cs | 23 +- Projectiles/Melee/ShortBeam.cs | 28 +- Projectiles/Melee/ShortNightBeam.cs | 28 +- Projectiles/Melee/ShortTerraBeam.cs | 37 +- Projectiles/Melee/SolarNeedle.cs | 59 +- Projectiles/Melee/SolsticeBeam.cs | 67 +- Projectiles/Melee/SoulScythe.cs | 37 +- Projectiles/Melee/SoulScytheExplosion.cs | 28 +- Projectiles/Melee/Spark.cs | 62 +- Projectiles/Melee/SpatialSpear.cs | 91 +- Projectiles/Melee/SpatialSpear2.cs | 74 +- Projectiles/Melee/SpatialSpear3.cs | 70 +- Projectiles/Melee/SpatialSpear4.cs | 58 +- .../Melee/Spears/AmidiasTridentProj.cs | 26 +- Projectiles/Melee/Spears/AstralPikeProj.cs | 32 +- Projectiles/Melee/Spears/BansheeHookProj.cs | 84 +- Projectiles/Melee/Spears/BrimlanceProj.cs | 36 +- Projectiles/Melee/Spears/DiseasedPikeSpear.cs | 32 +- Projectiles/Melee/Spears/EarthenPikeSpear.cs | 42 +- .../Spears/ExsanguinationLanceProjectile.cs | 38 +- .../Melee/Spears/FulgurationHalberdProj.cs | 28 +- .../Melee/Spears/GildedProboscisProj.cs | 34 +- .../Melee/Spears/GoldplumeSpearProjectile.cs | 36 +- .../Spears/HellionFlowerSpearProjectile.cs | 30 +- .../Melee/Spears/InsidiousImpalerProj.cs | 30 +- .../Melee/Spears/MarniteSpearProjectile.cs | 24 +- Projectiles/Melee/Spears/NadirSpear.cs | 45 +- Projectiles/Melee/Spears/SausageMakerSpear.cs | 30 +- .../Melee/Spears/SpatialLanceProjectile.cs | 32 +- .../Melee/Spears/StarnightLanceProjectile.cs | 30 +- Projectiles/Melee/Spears/StreamGougeProj.cs | 87 +- .../Melee/Spears/TenebreusTidesProjectile.cs | 34 +- .../Melee/Spears/TerraLanceProjectile.cs | 30 +- .../Melee/Spears/UrchinSpearProjectile.cs | 26 +- Projectiles/Melee/Spears/YateveoBloomSpear.cs | 26 +- .../Melee/SpineOfThanatosProjectile.cs | 89 +- Projectiles/Melee/StarnightBeam.cs | 37 +- Projectiles/Melee/StellarContemptHammer.cs | 105 +- Projectiles/Melee/StormBeam.cs | 28 +- Projectiles/Melee/StormMark.cs | 119 +- Projectiles/Melee/StormRulerProj.cs | 54 +- Projectiles/Melee/StreamGougePortal.cs | 79 +- Projectiles/Melee/SulphurousGrabberBubble.cs | 29 +- Projectiles/Melee/SulphurousGrabberBubble2.cs | 31 +- Projectiles/Melee/SunlightBlade.cs | 36 +- Projectiles/Melee/SwordsplosionBlue.cs | 38 +- Projectiles/Melee/SwordsplosionGreen.cs | 36 +- Projectiles/Melee/SwordsplosionPurple.cs | 36 +- Projectiles/Melee/SwordsplosionRed.cs | 38 +- Projectiles/Melee/TaintedBladeSlasher.cs | 87 +- Projectiles/Melee/TemporalFloeNumberTwo.cs | 43 +- .../Melee/TemporalFloeSwordProjectile.cs | 39 +- .../Melee/TenebreusTidesWaterProjectile.cs | 61 +- Projectiles/Melee/TenebreusTidesWaterSpear.cs | 166 +- Projectiles/Melee/TenebreusTidesWaterSword.cs | 148 +- Projectiles/Melee/TerraEdgeBeam.cs | 27 +- Projectiles/Melee/TerraSpear.cs | 63 +- Projectiles/Melee/TerracottaExplosion.cs | 48 +- Projectiles/Melee/TerratomereProjectile.cs | 31 +- Projectiles/Melee/TerrorBeam.cs | 71 +- Projectiles/Melee/TerrorBlast.cs | 41 +- Projectiles/Melee/ThanatosBoom.cs | 24 +- Projectiles/Melee/ThornBase.cs | 58 +- Projectiles/Melee/ThornTip.cs | 18 +- Projectiles/Melee/TinyCrystal.cs | 43 +- Projectiles/Melee/TinyFlare.cs | 26 +- Projectiles/Melee/Tornado.cs | 91 +- Projectiles/Melee/TriactisHammerProj.cs | 119 +- Projectiles/Melee/TrueAncientBeam.cs | 59 +- Projectiles/Melee/TrueAncientBlast.cs | 47 +- .../TrueArkOfTheAncients_ParryHoldout.cs | 77 +- .../Melee/TrueArkOfTheAncients_SwungBlade.cs | 89 +- Projectiles/Melee/TrueBiomeBladeHoldout.cs | 61 +- .../Melee/TrueBiomeBlade_ChainedMeatHook.cs | 83 +- .../Melee/TrueBiomeBlade_GhastlyChain.cs | 34 +- ...TrueBiomeBlade_LamentationsOfTheChained.cs | 65 +- .../Melee/TrueBiomeBlade_MercurialTides.cs | 101 +- .../TrueBiomeBlade_MercurialTidesMonolith.cs | 71 +- .../TrueBiomeBlade_MercurialTidesShockwave.cs | 57 +- .../Melee/TrueBiomeBlade_SanguineFury.cs | 87 +- .../Melee/TrueBiomeBlade_SanguineFuryDash.cs | 26 +- .../Melee/TrueBiomeBlade_SanguineFuryWheel.cs | 59 +- .../Melee/TrueBiomeBlade_SwordsmithsPride.cs | 113 +- .../TrueBiomeBlade_SwordsmithsPrideBeam.cs | 57 +- .../Melee/TrueCausticEdgeProjectile.cs | 55 +- Projectiles/Melee/TumbleweedFlail.cs | 91 +- Projectiles/Melee/TumbleweedRolling.cs | 43 +- Projectiles/Melee/TyphonsGreedBubble.cs | 93 +- Projectiles/Melee/TyphonsGreedStaff.cs | 130 +- Projectiles/Melee/UltimusCleaverDust.cs | 68 +- Projectiles/Melee/UrchinBall.cs | 81 +- Projectiles/Melee/UrchinBallSpike.cs | 43 +- Projectiles/Melee/UrchinSpikeFugu.cs | 54 +- Projectiles/Melee/ViolenceSlashProjectile.cs | 74 +- Projectiles/Melee/ViolenceThrownProjectile.cs | 99 +- Projectiles/Melee/VoidEssence.cs | 104 +- Projectiles/Melee/VoidTentacle.cs | 82 +- Projectiles/Melee/Waterfall.cs | 67 +- Projectiles/Melee/WhiteBoltAura.cs | 48 +- Projectiles/Melee/WhiteBoltAuraBlah.cs | 48 +- Projectiles/Melee/WhiteOrb.cs | 22 +- Projectiles/Melee/WhiteOrbBlah.cs | 22 +- Projectiles/Melee/Whiterain.cs | 33 +- Projectiles/Melee/WhiterainBlah.cs | 33 +- Projectiles/Melee/YateveoBloomProj.cs | 131 +- Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs | 38 +- Projectiles/Melee/Yoyos/AortaYoyo.cs | 38 +- Projectiles/Melee/Yoyos/AzathothYoyo.cs | 40 +- Projectiles/Melee/Yoyos/ChaotrixYoyo.cs | 44 +- Projectiles/Melee/Yoyos/CnidarianYoyo.cs | 36 +- Projectiles/Melee/Yoyos/GodsGambitYoyo.cs | 36 +- Projectiles/Melee/Yoyos/LaceratorYoyo.cs | 40 +- Projectiles/Melee/Yoyos/MicrowaveYoyo.cs | 57 +- Projectiles/Melee/Yoyos/ObliteratorYoyo.cs | 68 +- Projectiles/Melee/Yoyos/OblivionYoyo.cs | 38 +- Projectiles/Melee/Yoyos/OracleYoyo.cs | 93 +- Projectiles/Melee/Yoyos/PandemicYoyo.cs | 36 +- Projectiles/Melee/Yoyos/QuagmireYoyo.cs | 42 +- Projectiles/Melee/Yoyos/RiptideYoyo.cs | 48 +- Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs | 36 +- Projectiles/Melee/Yoyos/SolarFlareYoyo.cs | 42 +- .../Melee/Yoyos/SulphurousGrabberYoyo.cs | 62 +- Projectiles/Melee/Yoyos/VerdantYoyo.cs | 42 +- Projectiles/Melee/Yoyos/YinYoyo.cs | 36 +- Projectiles/Pets/Akato.cs | 36 +- Projectiles/Pets/Astrophage.cs | 122 +- Projectiles/Pets/BabyGhostBell.cs | 42 +- Projectiles/Pets/Bear.cs | 240 +- Projectiles/Pets/BendyPet.cs | 156 +- Projectiles/Pets/BrimlingPet.cs | 124 +- Projectiles/Pets/ChibiiDoggo.cs | 99 +- Projectiles/Pets/ChibiiDoggoFly.cs | 72 +- .../Pets/DaawnlightSpiritOriginMinion.cs | 50 +- Projectiles/Pets/DannyDevitoPet.cs | 178 +- Projectiles/Pets/FlakPet.cs | 184 +- Projectiles/Pets/FoxPet.cs | 26 +- Projectiles/Pets/KendraPet.cs | 251 +- Projectiles/Pets/LadShark.cs | 35 +- Projectiles/Pets/LeviPet.cs | 36 +- Projectiles/Pets/LittleLightProj.cs | 46 +- Projectiles/Pets/MiniHiveMind.cs | 73 +- Projectiles/Pets/PerforaMini.cs | 50 +- Projectiles/Pets/PineapplePetProj.cs | 92 +- Projectiles/Pets/PlaguebringerBab.cs | 36 +- Projectiles/Pets/RadiatorPet.cs | 126 +- Projectiles/Pets/RotomPet.cs | 72 +- Projectiles/Pets/SCalPet.cs | 34 +- Projectiles/Pets/SirenYoung.cs | 132 +- Projectiles/Pets/Sparks.cs | 229 +- Projectiles/Pets/ThirdSage.cs | 51 +- Projectiles/Pets/YharonSonPet.cs | 216 +- Projectiles/Ranged/AMR2.cs | 26 +- Projectiles/Ranged/AMRShot.cs | 47 +- Projectiles/Ranged/AccelerationBulletProj.cs | 51 +- Projectiles/Ranged/AcidBulletProj.cs | 41 +- Projectiles/Ranged/AngelicBeam.cs | 30 +- Projectiles/Ranged/AquaBlast.cs | 44 +- Projectiles/Ranged/AquaBlastToxic.cs | 44 +- Projectiles/Ranged/Aquashard.cs | 29 +- Projectiles/Ranged/AquashardSplit.cs | 29 +- Projectiles/Ranged/ArcherfishShot.cs | 50 +- Projectiles/Ranged/ArcticArrowProj.cs | 45 +- Projectiles/Ranged/AstralCannonProjectile.cs | 87 +- Projectiles/Ranged/AstralRound.cs | 47 +- Projectiles/Ranged/AstralSandgun.cs | 34 +- Projectiles/Ranged/AstrealArrow.cs | 86 +- Projectiles/Ranged/AstrealFlame.cs | 53 +- Projectiles/Ranged/AuralisBullet.cs | 30 +- Projectiles/Ranged/AuroraFire.cs | 42 +- Projectiles/Ranged/BallistaGreatArrow.cs | 39 +- Projectiles/Ranged/BeeRPG.cs | 83 +- Projectiles/Ranged/BigCoral.cs | 41 +- Projectiles/Ranged/BigNuke.cs | 79 +- Projectiles/Ranged/BloodBoilerFire.cs | 111 +- Projectiles/Ranged/BloodClotFriendly.cs | 35 +- Projectiles/Ranged/BloodfireArrowProj.cs | 65 +- Projectiles/Ranged/BloodfireBulletProj.cs | 47 +- Projectiles/Ranged/BloodflareSoul.cs | 89 +- Projectiles/Ranged/BlueExoArrow.cs | 50 +- Projectiles/Ranged/BlueExoArrow2.cs | 46 +- Projectiles/Ranged/Bolt.cs | 66 +- Projectiles/Ranged/BoltArrow.cs | 65 +- Projectiles/Ranged/BouncingShotgunPellet.cs | 45 +- Projectiles/Ranged/BrimstoneBallFriendly.cs | 44 +- Projectiles/Ranged/BrimstoneBolt.cs | 41 +- Projectiles/Ranged/BrimstoneFireFriendly.cs | 40 +- Projectiles/Ranged/ButcherGun.cs | 87 +- Projectiles/Ranged/CardClub.cs | 43 +- Projectiles/Ranged/CardClubSplit.cs | 45 +- Projectiles/Ranged/CardDiamond.cs | 61 +- Projectiles/Ranged/CardHeart.cs | 41 +- Projectiles/Ranged/CardSpade.cs | 43 +- Projectiles/Ranged/ChargedBlast.cs | 53 +- Projectiles/Ranged/ChargedBlast2.cs | 63 +- Projectiles/Ranged/ChargedBlast3.cs | 71 +- Projectiles/Ranged/ChargedDartExplosion.cs | 38 +- Projectiles/Ranged/ChickenCannonHeld.cs | 71 +- Projectiles/Ranged/ChickenExplosion.cs | 37 +- Projectiles/Ranged/ChickenRocket.cs | 71 +- Projectiles/Ranged/ClamorRifleProj.cs | 35 +- Projectiles/Ranged/ClamorRifleProjSplit.cs | 30 +- Projectiles/Ranged/ClaretCannonProj.cs | 39 +- Projectiles/Ranged/ClockworkBowHoldout.cs | 85 +- Projectiles/Ranged/CondemnationArrow.cs | 59 +- Projectiles/Ranged/CondemnationArrowHoming.cs | 44 +- Projectiles/Ranged/CondemnationHoldout.cs | 73 +- Projectiles/Ranged/ContagionArrow.cs | 43 +- Projectiles/Ranged/ContagionBall.cs | 35 +- Projectiles/Ranged/ContagionBow.cs | 99 +- Projectiles/Ranged/CorossiveFlames.cs | 36 +- Projectiles/Ranged/CorrodedShell.cs | 53 +- Projectiles/Ranged/CosmicFire.cs | 42 +- Projectiles/Ranged/DWArrow.cs | 53 +- Projectiles/Ranged/DaemonsFlameArrow.cs | 65 +- Projectiles/Ranged/DaemonsFlameBow.cs | 111 +- Projectiles/Ranged/DesertMark.cs | 119 +- Projectiles/Ranged/DesertTornado.cs | 83 +- Projectiles/Ranged/DragonsBreathRound.cs | 46 +- Projectiles/Ranged/DrataliornusBow.cs | 91 +- Projectiles/Ranged/DrataliornusExoArrow.cs | 50 +- Projectiles/Ranged/DrataliornusFlame.cs | 165 +- Projectiles/Ranged/DrizzlefishFire.cs | 66 +- Projectiles/Ranged/DrizzlefishFireSplit.cs | 50 +- Projectiles/Ranged/DrizzlefishFireball.cs | 32 +- Projectiles/Ranged/DualpoonProj.cs | 70 +- Projectiles/Ranged/ElysianArrowProj.cs | 63 +- Projectiles/Ranged/EmesisGore.cs | 38 +- Projectiles/Ranged/EnhancedNanoRoundProj.cs | 43 +- Projectiles/Ranged/EssenceFire.cs | 46 +- Projectiles/Ranged/ExoFire.cs | 34 +- Projectiles/Ranged/ExoFlare.cs | 56 +- Projectiles/Ranged/ExoFlareCluster.cs | 50 +- Projectiles/Ranged/ExoLight.cs | 83 +- Projectiles/Ranged/ExoMark.cs | 119 +- Projectiles/Ranged/ExoSpark.cs | 34 +- Projectiles/Ranged/ExoTornado.cs | 73 +- Projectiles/Ranged/ExplodingStake.cs | 39 +- Projectiles/Ranged/FallenStarProj.cs | 93 +- Projectiles/Ranged/FeatherLarge.cs | 29 +- Projectiles/Ranged/FishronRPG.cs | 87 +- Projectiles/Ranged/FlakKrakenGun.cs | 83 +- Projectiles/Ranged/FlakKrakenProj.cs | 90 +- Projectiles/Ranged/FlamingStake.cs | 28 +- Projectiles/Ranged/FlareBat.cs | 82 +- Projectiles/Ranged/Flash.cs | 44 +- Projectiles/Ranged/FlashBulletProj.cs | 43 +- .../Ranged/FlurrystormCannonShooting.cs | 107 +- Projectiles/Ranged/FlurrystormIceChunk.cs | 33 +- Projectiles/Ranged/FlurrystormIceShard.cs | 23 +- Projectiles/Ranged/FossilShard.cs | 24 +- Projectiles/Ranged/FungiOrb.cs | 37 +- Projectiles/Ranged/FungiOrb2.cs | 40 +- Projectiles/Ranged/GemTechGreenFlechette.cs | 47 +- Projectiles/Ranged/GodSlayerSlugProj.cs | 123 +- Projectiles/Ranged/GoliathRocket.cs | 83 +- Projectiles/Ranged/GreenExoArrow.cs | 50 +- Projectiles/Ranged/HalleysComet.cs | 36 +- Projectiles/Ranged/HandheldTankShell.cs | 43 +- .../Ranged/HighExplosivePeanutShell.cs | 57 +- Projectiles/Ranged/HiveBomb.cs | 83 +- Projectiles/Ranged/HiveMissile.cs | 85 +- Projectiles/Ranged/HolyFireBulletProj.cs | 46 +- Projectiles/Ranged/HyperiusBulletProj.cs | 34 +- Projectiles/Ranged/HyperiusSplit.cs | 32 +- Projectiles/Ranged/IcicleArrowProj.cs | 39 +- Projectiles/Ranged/IcyBulletProj.cs | 53 +- Projectiles/Ranged/IlluminatedBullet.cs | 45 +- Projectiles/Ranged/ImpactRound.cs | 41 +- Projectiles/Ranged/KarasawaShot.cs | 91 +- Projectiles/Ranged/LeafArrow.cs | 73 +- Projectiles/Ranged/LunarBolt.cs | 53 +- Projectiles/Ranged/LunarBolt2.cs | 53 +- Projectiles/Ranged/LuxorsGiftRanged.cs | 81 +- Projectiles/Ranged/MaelstromHoldout.cs | 71 +- Projectiles/Ranged/MagnaStrike.cs | 36 +- Projectiles/Ranged/MagnomalyAura.cs | 32 +- Projectiles/Ranged/MagnomalyBeam.cs | 52 +- Projectiles/Ranged/MagnomalyExplosion.cs | 22 +- Projectiles/Ranged/MagnomalyRocket.cs | 77 +- Projectiles/Ranged/MechanicalBarracuda.cs | 18 +- Projectiles/Ranged/MeowFire.cs | 57 +- Projectiles/Ranged/MeowFire2.cs | 57 +- Projectiles/Ranged/MiniRocket.cs | 77 +- Projectiles/Ranged/MiniSharkron.cs | 26 +- Projectiles/Ranged/Minibirb.cs | 45 +- Projectiles/Ranged/MistArrow.cs | 58 +- Projectiles/Ranged/MortarRoundProj.cs | 57 +- Projectiles/Ranged/Nanomachine.cs | 96 +- Projectiles/Ranged/NapalmArrowProj.cs | 39 +- Projectiles/Ranged/NeedlerProj.cs | 50 +- Projectiles/Ranged/NorfleetCannon.cs | 91 +- Projectiles/Ranged/NorfleetComet.cs | 89 +- Projectiles/Ranged/NorfleetExplosion.cs | 28 +- Projectiles/Ranged/Nuke.cs | 83 +- Projectiles/Ranged/NullShot.cs | 24 +- Projectiles/Ranged/NullShot2.cs | 26 +- Projectiles/Ranged/OnyxSharkBomb.cs | 61 +- Projectiles/Ranged/OpalStrike.cs | 34 +- Projectiles/Ranged/OrangeExoArrow.cs | 67 +- Projectiles/Ranged/PhangasmBow.cs | 81 +- Projectiles/Ranged/PiercingBullet.cs | 37 +- Projectiles/Ranged/PlagueArrow.cs | 41 +- Projectiles/Ranged/PlagueExplosionFriendly.cs | 42 +- Projectiles/Ranged/PlanarRipperBolt.cs | 75 +- Projectiles/Ranged/PlanarRipperExplosion.cs | 38 +- .../Ranged/PlanetaryAnnihilationProj.cs | 59 +- Projectiles/Ranged/PlasmaBlast.cs | 91 +- Projectiles/Ranged/PlasmaExplosion.cs | 55 +- Projectiles/Ranged/PolarStar.cs | 133 +- Projectiles/Ranged/PrecisionBolt.cs | 57 +- Projectiles/Ranged/PrismComet.cs | 69 +- Projectiles/Ranged/PrismEnergyBullet.cs | 49 +- Projectiles/Ranged/PrismExplosionLarge.cs | 54 +- Projectiles/Ranged/PrismExplosionSmall.cs | 48 +- Projectiles/Ranged/PrismMine.cs | 62 +- Projectiles/Ranged/PrismaticEnergyBlast.cs | 78 +- Projectiles/Ranged/PristineFire.cs | 82 +- Projectiles/Ranged/PristineSecondary.cs | 40 +- Projectiles/Ranged/ProBolt.cs | 58 +- Projectiles/Ranged/PumplerGrenade.cs | 45 +- Projectiles/Ranged/PumplerGrenadeExplosion.cs | 32 +- Projectiles/Ranged/PumplerHoldout.cs | 105 +- Projectiles/Ranged/RainbowBlast.cs | 36 +- Projectiles/Ranged/RainbowFront.cs | 56 +- Projectiles/Ranged/RainbowTrail.cs | 24 +- Projectiles/Ranged/RealmRavagerBullet.cs | 53 +- Projectiles/Ranged/RocketFire.cs | 92 +- Projectiles/Ranged/RubberMortarRoundProj.cs | 101 +- Projectiles/Ranged/SandWater.cs | 29 +- Projectiles/Ranged/SandstormBullet.cs | 67 +- Projectiles/Ranged/SandyWaifuShark.cs | 62 +- Projectiles/Ranged/ScorchedEarthBlast.cs | 38 +- .../Ranged/ScorchedEarthClusterBomb.cs | 35 +- Projectiles/Ranged/ScorchedEarthRocket.cs | 65 +- Projectiles/Ranged/SeaDragonRocket.cs | 81 +- Projectiles/Ranged/SeasSearingBubble.cs | 65 +- Projectiles/Ranged/SeasSearingSecondary.cs | 38 +- Projectiles/Ranged/SeasSearingSpout.cs | 124 +- Projectiles/Ranged/SepticSkewerBacteria.cs | 114 +- Projectiles/Ranged/SepticSkewerHarpoon.cs | 90 +- Projectiles/Ranged/ShadeFire.cs | 40 +- Projectiles/Ranged/Shell.cs | 39 +- Projectiles/Ranged/Shockblast.cs | 38 +- Projectiles/Ranged/ShockblastRound.cs | 58 +- Projectiles/Ranged/Shroom.cs | 30 +- Projectiles/Ranged/Sickness.cs | 42 +- Projectiles/Ranged/SicknessRound.cs | 52 +- Projectiles/Ranged/SicknessRound2.cs | 46 +- Projectiles/Ranged/SlagRound.cs | 40 +- Projectiles/Ranged/SlimeBolt.cs | 36 +- Projectiles/Ranged/SmallCoral.cs | 41 +- Projectiles/Ranged/SparkSpreaderFire.cs | 42 +- Projectiles/Ranged/SporeBomb.cs | 69 +- Projectiles/Ranged/SputterComet.cs | 39 +- Projectiles/Ranged/SputterCometBig.cs | 47 +- Projectiles/Ranged/SpykerProj.cs | 58 +- Projectiles/Ranged/StarfleetMK2Gun.cs | 91 +- Projectiles/Ranged/StormSurgeTornado.cs | 50 +- Projectiles/Ranged/SulphuricBlast.cs | 56 +- Projectiles/Ranged/SuperballBulletProj.cs | 57 +- Projectiles/Ranged/SurgeDriverHoldout.cs | 61 +- Projectiles/Ranged/TealExoArrow.cs | 50 +- Projectiles/Ranged/TelluricGlareArrow.cs | 53 +- Projectiles/Ranged/TerraArrowMain.cs | 41 +- Projectiles/Ranged/TerraArrowSplit.cs | 45 +- Projectiles/Ranged/TerraBulletMain.cs | 45 +- Projectiles/Ranged/TerraBulletSplit.cs | 44 +- Projectiles/Ranged/TerraFireGreen.cs | 42 +- Projectiles/Ranged/TerraFireGreen2.cs | 40 +- Projectiles/Ranged/TheMaelstromExplosion.cs | 48 +- Projectiles/Ranged/TheMaelstromShark.cs | 75 +- Projectiles/Ranged/ThePackMinissile.cs | 37 +- Projectiles/Ranged/ThePackMissile.cs | 79 +- Projectiles/Ranged/TitRail.cs | 26 +- Projectiles/Ranged/TorrentialArrow.cs | 50 +- Projectiles/Ranged/ToxicArrow.cs | 41 +- Projectiles/Ranged/ToxicannonDrop.cs | 32 +- Projectiles/Ranged/ToxicannonShot.cs | 54 +- Projectiles/Ranged/TriploonProj.cs | 70 +- Projectiles/Ranged/TyphoonArrow.cs | 22 +- Projectiles/Ranged/TyphoonBubble.cs | 97 +- Projectiles/Ranged/UltimaBolt.cs | 58 +- Projectiles/Ranged/UltimaBowProjectile.cs | 57 +- Projectiles/Ranged/UltimaRay.cs | 30 +- Projectiles/Ranged/UltimaSpark.cs | 34 +- Projectiles/Ranged/UniversalGenesisStar.cs | 83 +- .../Ranged/UniversalGenesisStarcaller.cs | 65 +- Projectiles/Ranged/VanquisherArrowMain.cs | 40 +- Projectiles/Ranged/VeriumBulletProj.cs | 84 +- Projectiles/Ranged/Voidragon.cs | 87 +- Projectiles/Ranged/VoidragonTentacle.cs | 90 +- Projectiles/Ranged/WaterSpout.cs | 122 +- Projectiles/Rogue/AbyssalMirrorProjectile.cs | 28 +- Projectiles/Rogue/AccretionDisk2.cs | 28 +- Projectiles/Rogue/AccretionDiskProj.cs | 121 +- Projectiles/Rogue/AcidBarrelDrop.cs | 32 +- Projectiles/Rogue/AcidShrapnel.cs | 34 +- .../Rogue/AdamantiteThrowingAxeProjectile.cs | 26 +- Projectiles/Rogue/AlphaSeeker.cs | 66 +- Projectiles/Rogue/AlphaVirusProjectile.cs | 117 +- Projectiles/Rogue/AntumbraShardProjectile.cs | 56 +- Projectiles/Rogue/ApoctolithProj.cs | 49 +- Projectiles/Rogue/ApoctolithShard.cs | 25 +- Projectiles/Rogue/AshenStalactiteDebris.cs | 33 +- Projectiles/Rogue/AshenStalactiteProj.cs | 33 +- Projectiles/Rogue/AshenStalagmiteProj.cs | 35 +- Projectiles/Rogue/AuroradicalSplitter.cs | 73 +- Projectiles/Rogue/AuroradicalStar.cs | 95 +- Projectiles/Rogue/BallisticPoisonBombProj.cs | 73 +- Projectiles/Rogue/BallisticPoisonBombSpike.cs | 48 +- Projectiles/Rogue/BarrelShrapnel.cs | 32 +- Projectiles/Rogue/BettyExplosion.cs | 32 +- Projectiles/Rogue/BileExplosion.cs | 32 +- Projectiles/Rogue/BlastBarrelProjectile.cs | 61 +- Projectiles/Rogue/BlazingStarProj.cs | 103 +- Projectiles/Rogue/BloodsoakedCrashax.cs | 60 +- Projectiles/Rogue/BlueFlamePillar.cs | 32 +- Projectiles/Rogue/BlunderBoosterLightning.cs | 69 +- Projectiles/Rogue/BouncingBettyProjectile.cs | 47 +- Projectiles/Rogue/BouncingBettyShrapnel.cs | 26 +- .../Rogue/BouncingEyeballProjectile.cs | 45 +- .../BouncingEyeballProjectileStealthStrike.cs | 43 +- Projectiles/Rogue/BouncyBol.cs | 50 +- Projectiles/Rogue/BrackishFlaskProj.cs | 35 +- Projectiles/Rogue/BrackishSpear.cs | 72 +- Projectiles/Rogue/BrackishSpear2.cs | 54 +- Projectiles/Rogue/BrackishWater.cs | 33 +- Projectiles/Rogue/BrackishWaterBlast.cs | 51 +- Projectiles/Rogue/Brick.cs | 37 +- Projectiles/Rogue/BrickFragment.cs | 29 +- Projectiles/Rogue/Brimblade2.cs | 20 +- Projectiles/Rogue/BrimbladeProj.cs | 36 +- Projectiles/Rogue/BurningStrifeProj.cs | 71 +- Projectiles/Rogue/ButcherKnife.cs | 106 +- Projectiles/Rogue/CarvingFork.cs | 38 +- .../Rogue/CelestialReaperAfterimage.cs | 30 +- .../Rogue/CelestialReaperProjectile.cs | 48 +- Projectiles/Rogue/Celestus2.cs | 40 +- Projectiles/Rogue/CelestusBoomerang.cs | 119 +- Projectiles/Rogue/CinquedeaProj.cs | 73 +- Projectiles/Rogue/CircletMark.cs | 119 +- Projectiles/Rogue/CircletTornado.cs | 83 +- Projectiles/Rogue/CobaltEnergy.cs | 49 +- Projectiles/Rogue/CobaltKunaiProjectile.cs | 34 +- .../Rogue/ConsecratedWaterProjectile.cs | 47 +- Projectiles/Rogue/ContaminatedBileFlask.cs | 29 +- Projectiles/Rogue/CorpusAvertorClone.cs | 48 +- Projectiles/Rogue/CorpusAvertorProj.cs | 54 +- Projectiles/Rogue/CorpusAvertorStealth.cs | 38 +- Projectiles/Rogue/Corrocloud1.cs | 32 +- Projectiles/Rogue/Corrocloud2.cs | 32 +- Projectiles/Rogue/Corrocloud3.cs | 32 +- Projectiles/Rogue/CosmicKunaiProj.cs | 26 +- Projectiles/Rogue/CosmicScythe.cs | 63 +- Projectiles/Rogue/CraniumSMASH.cs | 33 +- Projectiles/Rogue/CraniumSmasherExplosive.cs | 55 +- Projectiles/Rogue/CraniumSmasherProj.cs | 36 +- Projectiles/Rogue/CraniumSmasherStealth.cs | 73 +- Projectiles/Rogue/Crushax.cs | 42 +- Projectiles/Rogue/CrystalPiercerProjectile.cs | 44 +- Projectiles/Rogue/CrystalPiercerShard.cs | 16 +- Projectiles/Rogue/Crystalline2.cs | 36 +- Projectiles/Rogue/CrystallineProj.cs | 37 +- Projectiles/Rogue/CursedDaggerProj.cs | 50 +- Projectiles/Rogue/DeepSeaDumbbell1.cs | 73 +- Projectiles/Rogue/DeepSeaDumbbell2.cs | 79 +- Projectiles/Rogue/DeepSeaDumbbell3.cs | 51 +- Projectiles/Rogue/DeepSeaDumbbellWeight.cs | 41 +- Projectiles/Rogue/DeepWounderProjectile.cs | 43 +- Projectiles/Rogue/DeepWounderWater.cs | 32 +- Projectiles/Rogue/DeificThunderboltProj.cs | 59 +- Projectiles/Rogue/DesecratedBubble.cs | 53 +- Projectiles/Rogue/DesecratedWaterProj.cs | 35 +- Projectiles/Rogue/DestructionBolt.cs | 125 +- Projectiles/Rogue/DestructionStar.cs | 41 +- Projectiles/Rogue/DragonShit.cs | 79 +- Projectiles/Rogue/DukesDecapitatorBubble.cs | 55 +- Projectiles/Rogue/DukesDecapitatorProj.cs | 52 +- Projectiles/Rogue/DuneHopperProjectile.cs | 36 +- Projectiles/Rogue/DuststormCloud.cs | 62 +- Projectiles/Rogue/DuststormCloudStealth.cs | 62 +- Projectiles/Rogue/DuststormInABottleProj.cs | 27 +- Projectiles/Rogue/EclipseMirrorBurst.cs | 34 +- Projectiles/Rogue/EclipsesFallMain.cs | 34 +- Projectiles/Rogue/EclipsesSmol.cs | 33 +- Projectiles/Rogue/EclipsesStealth.cs | 54 +- Projectiles/Rogue/EnchantedAxe2.cs | 24 +- Projectiles/Rogue/EnchantedAxeProj.cs | 89 +- .../Rogue/EpidemicShredderProjectile.cs | 68 +- Projectiles/Rogue/EquanimityDarkShard.cs | 51 +- Projectiles/Rogue/EquanimityLightShard.cs | 35 +- Projectiles/Rogue/EquanimityProj.cs | 63 +- Projectiles/Rogue/EradicatorProjectile.cs | 120 +- Projectiles/Rogue/ExecutionersBladeProj.cs | 53 +- .../Rogue/ExecutionersBladeStealthProj.cs | 43 +- Projectiles/Rogue/ExorcismProj.cs | 95 +- Projectiles/Rogue/ExorcismShockwave.cs | 50 +- Projectiles/Rogue/ExorcismStar.cs | 33 +- Projectiles/Rogue/ExplosiveSun.cs | 67 +- Projectiles/Rogue/FantasyTalismanProj.cs | 44 +- Projectiles/Rogue/FantasyTalismanStealth.cs | 54 +- Projectiles/Rogue/FeatherKnifeProjectile.cs | 28 +- Projectiles/Rogue/FinalDawnFireSlash.cs | 91 +- Projectiles/Rogue/FinalDawnFireball.cs | 74 +- Projectiles/Rogue/FinalDawnFlame.cs | 64 +- Projectiles/Rogue/FinalDawnHorizontalSlash.cs | 89 +- Projectiles/Rogue/FinalDawnProjectile.cs | 126 +- Projectiles/Rogue/FinalDawnReticle.cs | 70 +- Projectiles/Rogue/FinalDawnThrow.cs | 85 +- Projectiles/Rogue/FinalDawnThrow2.cs | 95 +- Projectiles/Rogue/FlameScytheProjectile.cs | 50 +- Projectiles/Rogue/Fork.cs | 34 +- Projectiles/Rogue/FossilShardThrown.cs | 20 +- Projectiles/Rogue/FrostShardFriendly.cs | 65 +- Projectiles/Rogue/FrostyFlareProj.cs | 68 +- Projectiles/Rogue/FrostyFlareStealth.cs | 68 +- Projectiles/Rogue/GacruxianHome.cs | 30 +- Projectiles/Rogue/GacruxianProj.cs | 28 +- Projectiles/Rogue/GelDartProjectile.cs | 55 +- Projectiles/Rogue/GhoulishGougerBoomerang.cs | 98 +- Projectiles/Rogue/GildedDaggerProj.cs | 63 +- Projectiles/Rogue/GlaiveProj.cs | 109 +- Projectiles/Rogue/GleamingDaggerProj.cs | 63 +- Projectiles/Rogue/GodsParanoiaDart.cs | 66 +- Projectiles/Rogue/GodsParanoiaProj.cs | 60 +- Projectiles/Rogue/GreenDonkeyKongReference.cs | 69 +- Projectiles/Rogue/HeavenfallenEnergy.cs | 26 +- .../Rogue/HeavenfallenStardiskBoomerang.cs | 111 +- Projectiles/Rogue/HellsSunProj.cs | 56 +- Projectiles/Rogue/Honeycomb.cs | 79 +- Projectiles/Rogue/HoneycombFragment.cs | 30 +- Projectiles/Rogue/HypothermiaChunk.cs | 48 +- Projectiles/Rogue/HypothermiaShard.cs | 66 +- Projectiles/Rogue/IceStarProjectile.cs | 79 +- Projectiles/Rogue/IcebreakerHammer.cs | 42 +- Projectiles/Rogue/IchorSpearProj.cs | 44 +- Projectiles/Rogue/InfernalKrisCinder.cs | 36 +- Projectiles/Rogue/InfernalKrisExplosion.cs | 26 +- Projectiles/Rogue/InfernalKrisProjectile.cs | 103 +- Projectiles/Rogue/InkBombProjectile.cs | 33 +- Projectiles/Rogue/InkCloud.cs | 30 +- Projectiles/Rogue/InkCloud2.cs | 30 +- Projectiles/Rogue/InkCloud3.cs | 30 +- Projectiles/Rogue/IronFranciscaProj.cs | 53 +- Projectiles/Rogue/JawsProjectile.cs | 57 +- Projectiles/Rogue/JawsShockwave.cs | 26 +- Projectiles/Rogue/JewelSpike.cs | 46 +- Projectiles/Rogue/KelvinCatalystBoomerang.cs | 123 +- Projectiles/Rogue/Knife.cs | 34 +- Projectiles/Rogue/KylieBoomerang.cs | 111 +- Projectiles/Rogue/LatcherMineProjectile.cs | 123 +- Projectiles/Rogue/LeadTomahawkProj.cs | 53 +- Projectiles/Rogue/LeonidCometBig.cs | 63 +- Projectiles/Rogue/LeonidCometSmall.cs | 93 +- .../Rogue/LeonidProgenitorBombshell.cs | 67 +- Projectiles/Rogue/LeonidStar.cs | 43 +- Projectiles/Rogue/LeviathanTooth.cs | 63 +- Projectiles/Rogue/LionfishProj.cs | 67 +- Projectiles/Rogue/LostSoulFriendly.cs | 58 +- Projectiles/Rogue/LuminousShard.cs | 32 +- Projectiles/Rogue/LuminousStrikerProj.cs | 54 +- Projectiles/Rogue/LunarKunaiProj.cs | 67 +- Projectiles/Rogue/LuxorsGiftRogue.cs | 86 +- Projectiles/Rogue/MalachiteBolt.cs | 102 +- Projectiles/Rogue/MalachiteProj.cs | 58 +- Projectiles/Rogue/MalachiteStealth.cs | 93 +- Projectiles/Rogue/MangroveChakramFlower.cs | 27 +- .../Rogue/MangroveChakramProjectile.cs | 44 +- Projectiles/Rogue/MetalChunk.cs | 43 +- Projectiles/Rogue/MetalShard.cs | 49 +- Projectiles/Rogue/MeteorFistProj.cs | 91 +- Projectiles/Rogue/MoltenAmputatorProj.cs | 125 +- Projectiles/Rogue/MoltenBlobThrown.cs | 61 +- Projectiles/Rogue/MonkeyDart.cs | 69 +- Projectiles/Rogue/MoonSigil.cs | 48 +- Projectiles/Rogue/MycorootProj.cs | 26 +- Projectiles/Rogue/MythrilKnifeProjectile.cs | 38 +- Projectiles/Rogue/NanoblackMain.cs | 124 +- Projectiles/Rogue/NanoblackSplit.cs | 82 +- Projectiles/Rogue/NanoblackStealthSplit.cs | 76 +- Projectiles/Rogue/NastyChollaBol.cs | 50 +- Projectiles/Rogue/NastyChollaNeedle.cs | 34 +- Projectiles/Rogue/NiceCock.cs | 63 +- Projectiles/Rogue/NightsGazeProjectile.cs | 59 +- Projectiles/Rogue/NightsGazeSpark.cs | 38 +- Projectiles/Rogue/NightsGazeStar.cs | 61 +- Projectiles/Rogue/NychthemeronOrb.cs | 74 +- Projectiles/Rogue/NychthemeronProjectile.cs | 61 +- .../OrichalcumSpikedGemstoneProjectile.cs | 45 +- .../Rogue/PalladiumJavelinProjectile.cs | 48 +- Projectiles/Rogue/PanSpark.cs | 92 +- Projectiles/Rogue/PartisanExplosion.cs | 24 +- Projectiles/Rogue/PenumbraBomb.cs | 85 +- Projectiles/Rogue/PenumbraSoul.cs | 58 +- Projectiles/Rogue/PhantasmalRuinGhost.cs | 32 +- Projectiles/Rogue/PhantasmalRuinProj.cs | 54 +- Projectiles/Rogue/PhantasmalSoul.cs | 85 +- Projectiles/Rogue/PhantomLanceProj.cs | 56 +- Projectiles/Rogue/PlaguedFuelPackCloud.cs | 34 +- Projectiles/Rogue/PlaguenadeBee.cs | 108 +- Projectiles/Rogue/PlaguenadeProj.cs | 89 +- Projectiles/Rogue/PoisonBol.cs | 40 +- Projectiles/Rogue/PrismRocket.cs | 40 +- Projectiles/Rogue/PrismShurikenBlade.cs | 22 +- Projectiles/Rogue/Prismalline2.cs | 24 +- Projectiles/Rogue/Prismalline3.cs | 32 +- Projectiles/Rogue/PrismallineProj.cs | 51 +- Projectiles/Rogue/ProfanedPartisanProj.cs | 75 +- Projectiles/Rogue/ProfanedPartisanSpear.cs | 68 +- Projectiles/Rogue/RadiantExplosion.cs | 40 +- Projectiles/Rogue/RadiantStar2.cs | 42 +- Projectiles/Rogue/RadiantStarKnife.cs | 63 +- Projectiles/Rogue/ReaperProjectile.cs | 123 +- .../Rogue/RefractionRotorProjectile.cs | 68 +- Projectiles/Rogue/RegulusEnergy.cs | 64 +- Projectiles/Rogue/RegulusRiotProj.cs | 117 +- Projectiles/Rogue/RotBallProjectile.cs | 26 +- Projectiles/Rogue/SacrificeProjectile.cs | 62 +- Projectiles/Rogue/SandDollarProj.cs | 24 +- Projectiles/Rogue/SandDollarStealth.cs | 32 +- Projectiles/Rogue/SandslasherProj.cs | 58 +- Projectiles/Rogue/ScarletBlast.cs | 53 +- Projectiles/Rogue/ScarletDevilBullet.cs | 36 +- Projectiles/Rogue/ScarletDevilProjectile.cs | 87 +- Projectiles/Rogue/ScourgeVenomCloud.cs | 62 +- Projectiles/Rogue/ScourgeoftheDesertProj.cs | 46 +- .../Rogue/ScourgeoftheSeasProjectile.cs | 49 +- Projectiles/Rogue/SeafoamBombProj.cs | 49 +- Projectiles/Rogue/SeafoamBubble.cs | 53 +- .../Rogue/SealedSingularityBlackhole.cs | 56 +- Projectiles/Rogue/SealedSingularityGore.cs | 31 +- Projectiles/Rogue/SealedSingularityProj.cs | 37 +- Projectiles/Rogue/SearedPanProjectile.cs | 51 +- .../Rogue/SeashellBoomerangProjectile.cs | 18 +- Projectiles/Rogue/SeraphimAngelicLight.cs | 42 +- Projectiles/Rogue/SeraphimAngelicLight2.cs | 44 +- Projectiles/Rogue/SeraphimBeamLarge.cs | 93 +- Projectiles/Rogue/SeraphimDagger.cs | 75 +- Projectiles/Rogue/SeraphimProjectile.cs | 72 +- Projectiles/Rogue/ShadowBlackhole.cs | 42 +- Projectiles/Rogue/ShatteredExplosion.cs | 30 +- Projectiles/Rogue/ShatteredSunKnife.cs | 85 +- .../Rogue/ShatteredSunScorchedBlade.cs | 127 +- Projectiles/Rogue/ShinobiBladeProjectile.cs | 35 +- Projectiles/Rogue/ShockGrenadeBolt.cs | 63 +- Projectiles/Rogue/ShockGrenadeExplosion.cs | 26 +- Projectiles/Rogue/ShockGrenadeProjectile.cs | 73 +- Projectiles/Rogue/ShockTeslaAura.cs | 58 +- Projectiles/Rogue/ShroomerangProj.cs | 38 +- Projectiles/Rogue/ShroomerangSpore.cs | 28 +- Projectiles/Rogue/SkyBomberGas.cs | 34 +- Projectiles/Rogue/SkyStabberProj.cs | 48 +- Projectiles/Rogue/SkyfinNuke.cs | 59 +- Projectiles/Rogue/SlickCaneProjectile.cs | 52 +- Projectiles/Rogue/SludgeSplotchProj1.cs | 65 +- Projectiles/Rogue/SludgeSplotchProj2.cs | 43 +- Projectiles/Rogue/SnapClamProj.cs | 51 +- Projectiles/Rogue/SnapClamStealth.cs | 55 +- Projectiles/Rogue/SpearofDestinyProjectile.cs | 58 +- Projectiles/Rogue/SpearofPaleolithProj.cs | 40 +- .../Rogue/SpentFuelContainerProjectile.cs | 39 +- Projectiles/Rogue/SphereBladed.cs | 105 +- Projectiles/Rogue/SphereBlue.cs | 69 +- Projectiles/Rogue/SphereSpiked.cs | 33 +- Projectiles/Rogue/SphereYellow.cs | 41 +- Projectiles/Rogue/StealthNimbus.cs | 72 +- Projectiles/Rogue/StealthNimbusCloud.cs | 46 +- Projectiles/Rogue/StealthRain.cs | 36 +- Projectiles/Rogue/StellarKnifeProj.cs | 74 +- Projectiles/Rogue/StickyBol.cs | 48 +- .../Rogue/StormfrontRazorProjectile.cs | 65 +- Projectiles/Rogue/Stormfrontspark.cs | 32 +- Projectiles/Rogue/SubductionFlameburst.cs | 38 +- Projectiles/Rogue/SulphuricNukesplosion.cs | 62 +- Projectiles/Rogue/SupernovaBomb.cs | 79 +- Projectiles/Rogue/SupernovaBoom.cs | 36 +- Projectiles/Rogue/SupernovaHoming.cs | 56 +- Projectiles/Rogue/SupernovaSpike.cs | 54 +- Projectiles/Rogue/SylvanSlash.cs | 55 +- Projectiles/Rogue/SylvanSlashAttack.cs | 97 +- Projectiles/Rogue/TalonLargeProj.cs | 44 +- Projectiles/Rogue/TalonSmallProj.cs | 48 +- Projectiles/Rogue/TarraThornRight.cs | 60 +- Projectiles/Rogue/TarraThornTip.cs | 22 +- .../Rogue/TarragonThrowingDartProjectile.cs | 44 +- Projectiles/Rogue/TerraDiskProjectile.cs | 139 +- Projectiles/Rogue/TerraDiskProjectile2.cs | 48 +- Projectiles/Rogue/TheAtomSplitterDuplicate.cs | 46 +- .../Rogue/TheAtomSplitterProjectile.cs | 86 +- Projectiles/Rogue/TheSyringeCinder.cs | 86 +- Projectiles/Rogue/TheSyringeProj.cs | 61 +- Projectiles/Rogue/TheSyringeS1.cs | 42 +- Projectiles/Rogue/ThiefsDimeProj.cs | 60 +- Projectiles/Rogue/TimeBoltKnife.cs | 177 +- Projectiles/Rogue/TitaniumClone.cs | 34 +- .../Rogue/TitaniumShurikenProjectile.cs | 116 +- Projectiles/Rogue/ToothBallProjectile.cs | 26 +- Projectiles/Rogue/TotalMeltdown.cs | 22 +- Projectiles/Rogue/TotalityFire.cs | 92 +- Projectiles/Rogue/TotalityFlask.cs | 49 +- Projectiles/Rogue/TotalityTar.cs | 73 +- Projectiles/Rogue/ToxicantTwisterDust.cs | 18 +- .../Rogue/ToxicantTwisterTwoPointZero.cs | 113 +- Projectiles/Rogue/TurbulanceProjectile.cs | 42 +- Projectiles/Rogue/TurbulanceWindSlash.cs | 64 +- Projectiles/Rogue/UmbraphileBoom.cs | 22 +- Projectiles/Rogue/UrchinStingerProj.cs | 56 +- Projectiles/Rogue/ValariBoomerang.cs | 117 +- Projectiles/Rogue/Valaricicle.cs | 31 +- Projectiles/Rogue/Valaricicle2.cs | 31 +- Projectiles/Rogue/ValedictionBoomerang.cs | 113 +- Projectiles/Rogue/VeneratedKnife.cs | 68 +- Projectiles/Rogue/WebBallBol.cs | 20 +- Projectiles/Rogue/WrathwingCinder.cs | 95 +- Projectiles/Rogue/WrathwingFireball.cs | 80 +- Projectiles/Rogue/WrathwingSpear.cs | 66 +- Projectiles/Rogue/WulfrumKnifeProj.cs | 20 +- Projectiles/Summon/AndromedaDeathRay.cs | 102 +- Projectiles/Summon/AndromedaRegislash.cs | 77 +- .../AndromedaUI/AndromedaUI_Background.cs | 165 +- Projectiles/Summon/AngelBolt.cs | 24 +- Projectiles/Summon/AngelOrb.cs | 26 +- Projectiles/Summon/AngelRay.cs | 50 +- .../Summon/AngelicAllianceArchangel.cs | 114 +- Projectiles/Summon/ApexShark.cs | 181 +- Projectiles/Summon/ApparatusExplosion.cs | 32 +- Projectiles/Summon/AquaticStarMinion.cs | 52 +- Projectiles/Summon/AstrageldonLaser.cs | 63 +- Projectiles/Summon/AstrageldonSummon.cs | 110 +- Projectiles/Summon/AstralProbeRound.cs | 45 +- Projectiles/Summon/AstralProbeSummon.cs | 93 +- Projectiles/Summon/AureusBomber.cs | 179 +- Projectiles/Summon/BabyBloodCrawler.cs | 60 +- Projectiles/Summon/BabyPlaguebringer.cs | 169 +- Projectiles/Summon/BelladonnaPetal.cs | 30 +- Projectiles/Summon/BelladonnaSpirit.cs | 122 +- Projectiles/Summon/BlackHawkBullet.cs | 30 +- Projectiles/Summon/BlackHawkSummon.cs | 161 +- Projectiles/Summon/BloodBreath.cs | 34 +- Projectiles/Summon/BloodClotMinion.cs | 176 +- Projectiles/Summon/BloodRain.cs | 26 +- Projectiles/Summon/BloodSpit.cs | 42 +- Projectiles/Summon/BoneMatter.cs | 24 +- Projectiles/Summon/BoneMatter2.cs | 26 +- Projectiles/Summon/BrimseekerAuraBall.cs | 40 +- Projectiles/Summon/BrimstoneDartMinion.cs | 44 +- Projectiles/Summon/BrimstoneDartSummon.cs | 52 +- .../Summon/BrimstoneElementalMinion.cs | 156 +- .../Summon/BrimstoneExplosionMinion.cs | 45 +- Projectiles/Summon/BrimstoneFireSummon.cs | 42 +- Projectiles/Summon/BrimstoneFireballMinion.cs | 73 +- Projectiles/Summon/BrimstoneLaserSummon.cs | 32 +- Projectiles/Summon/BrittleStarMinion.cs | 52 +- Projectiles/Summon/CalamariInk.cs | 83 +- Projectiles/Summon/CalamariMinion.cs | 241 +- Projectiles/Summon/Calamitamini.cs | 160 +- Projectiles/Summon/Cataclymini.cs | 160 +- Projectiles/Summon/CataclysmSummon.cs | 67 +- Projectiles/Summon/Catastromini.cs | 84 +- Projectiles/Summon/CatastropheSummon.cs | 62 +- Projectiles/Summon/CausticStaffProjectile.cs | 42 +- Projectiles/Summon/CausticStaffSummon.cs | 174 +- Projectiles/Summon/ChaosFlame.cs | 46 +- Projectiles/Summon/ChaosSpirit.cs | 113 +- Projectiles/Summon/Cinder.cs | 66 +- Projectiles/Summon/CinderBlossom.cs | 78 +- Projectiles/Summon/CloudElementalMinion.cs | 74 +- Projectiles/Summon/ColdDivinityPointyThing.cs | 167 +- Projectiles/Summon/CorroslimeMinion.cs | 66 +- .../Summon/CorruptionSlimeGodMinion.cs | 60 +- Projectiles/Summon/CosmicBlast.cs | 83 +- Projectiles/Summon/CosmicBlastBig.cs | 77 +- Projectiles/Summon/CosmicEnergySpiral.cs | 135 +- .../Summon/CosmicViperConcussionMissile.cs | 75 +- Projectiles/Summon/CosmicViperHomingRocket.cs | 101 +- Projectiles/Summon/CosmicViperSplitRocket1.cs | 34 +- .../Summon/CosmicViperSplittingRocket.cs | 121 +- Projectiles/Summon/CosmicViperSummon.cs | 181 +- Projectiles/Summon/CosmilampMinion.cs | 180 +- Projectiles/Summon/CrimslimeMinion.cs | 66 +- Projectiles/Summon/CrimsonSlimeGodMinion.cs | 60 +- Projectiles/Summon/DaedalusCrystal.cs | 96 +- Projectiles/Summon/DaedalusCrystalShot.cs | 37 +- Projectiles/Summon/DaedalusGolem.cs | 183 +- Projectiles/Summon/DaedalusLightning.cs | 68 +- Projectiles/Summon/DaedalusPellet.cs | 55 +- Projectiles/Summon/DankCreeperMinion.cs | 164 +- Projectiles/Summon/DazzlingStabber.cs | 120 +- Projectiles/Summon/DeathstareBeam.cs | 40 +- Projectiles/Summon/DeathstareEyeball.cs | 94 +- Projectiles/Summon/DormantBrimseekerAura.cs | 63 +- Projectiles/Summon/DormantBrimseekerBab.cs | 169 +- .../Summon/DormantBrimseekerSummoner.cs | 41 +- Projectiles/Summon/Dreadmine.cs | 121 +- Projectiles/Summon/DreadmineTurret.cs | 70 +- Projectiles/Summon/EXPLODINGFROG.cs | 91 +- Projectiles/Summon/ElementalAxeMinion.cs | 64 +- Projectiles/Summon/EndoBeam.cs | 108 +- Projectiles/Summon/EndoCooperBody.cs | 197 +- Projectiles/Summon/EndoCooperLimbs.cs | 123 +- Projectiles/Summon/EndoFire.cs | 48 +- Projectiles/Summon/EndoHydraBody.cs | 75 +- Projectiles/Summon/EndoHydraHead.cs | 140 +- Projectiles/Summon/EndoIceShard.cs | 75 +- Projectiles/Summon/EndoRay.cs | 32 +- Projectiles/Summon/EnergyOrb.cs | 26 +- Projectiles/Summon/EyeOfNightCell.cs | 34 +- Projectiles/Summon/EyeOfNightSummon.cs | 92 +- Projectiles/Summon/FlameBlast.cs | 53 +- Projectiles/Summon/FlameBurst.cs | 53 +- Projectiles/Summon/FleshBallMinion.cs | 94 +- Projectiles/Summon/FleshBlood.cs | 26 +- Projectiles/Summon/FlowersOfMortalityPetal.cs | 78 +- Projectiles/Summon/FlyingOrthocera.cs | 62 +- Projectiles/Summon/FlyingOrthoceraStream.cs | 52 +- Projectiles/Summon/ForbiddenCircletEater.cs | 126 +- Projectiles/Summon/FrogGore1.cs | 32 +- Projectiles/Summon/FrogGore2.cs | 32 +- Projectiles/Summon/FrogGore3.cs | 32 +- Projectiles/Summon/FrogGore4.cs | 32 +- Projectiles/Summon/FrogGore5.cs | 32 +- Projectiles/Summon/FrostBeam.cs | 50 +- Projectiles/Summon/FrostBlossom.cs | 76 +- Projectiles/Summon/FrostMistFriendly.cs | 105 +- Projectiles/Summon/FungalClumpMinion.cs | 142 +- Projectiles/Summon/GammaCanister.cs | 36 +- Projectiles/Summon/GammaHead.cs | 122 +- Projectiles/Summon/GastricBelcher.cs | 153 +- Projectiles/Summon/GastricBelcherBubble.cs | 25 +- Projectiles/Summon/GastricBelcherVomit.cs | 39 +- Projectiles/Summon/GhostFire.cs | 34 +- Projectiles/Summon/GhostlyMine.cs | 71 +- Projectiles/Summon/GiantIbanRobotOfDoom.cs | 113 +- Projectiles/Summon/HallowedStarSummon.cs | 69 +- Projectiles/Summon/HauntedDishes.cs | 422 +-- Projectiles/Summon/HermitCrabMinion.cs | 200 +- Projectiles/Summon/HerringMinion.cs | 84 +- Projectiles/Summon/Hive.cs | 82 +- Projectiles/Summon/Hiveling.cs | 52 +- Projectiles/Summon/HomingGammaBullet.cs | 32 +- Projectiles/Summon/HowlsHeartCalcifer.cs | 42 +- Projectiles/Summon/HowlsHeartFireball.cs | 73 +- Projectiles/Summon/HowlsHeartHowl.cs | 173 +- Projectiles/Summon/HowlsHeartTurnipHead.cs | 116 +- Projectiles/Summon/IceClasperMinion.cs | 82 +- Projectiles/Summon/IceSentry.cs | 122 +- Projectiles/Summon/IceSentryFrostBolt.cs | 69 +- Projectiles/Summon/IceSentryShard.cs | 51 +- Projectiles/Summon/IgneousBlade.cs | 106 +- Projectiles/Summon/IgneousBladeStrike.cs | 31 +- Projectiles/Summon/IrradiatedAura.cs | 22 +- Projectiles/Summon/LanternFlame.cs | 71 +- Projectiles/Summon/LanternSoul.cs | 70 +- Projectiles/Summon/LostSoulGiant.cs | 53 +- Projectiles/Summon/LostSoulGold.cs | 51 +- Projectiles/Summon/LostSoulLarge.cs | 53 +- Projectiles/Summon/LostSoulSmall.cs | 51 +- Projectiles/Summon/LuxorsGiftSummon.cs | 90 +- Projectiles/Summon/MK2FlaskSummon.cs | 35 +- Projectiles/Summon/MK2RocketHoming.cs | 49 +- Projectiles/Summon/MK2RocketNormal.cs | 45 +- Projectiles/Summon/MagicAxe.cs | 48 +- Projectiles/Summon/MagicBat.cs | 28 +- Projectiles/Summon/MagicBird.cs | 80 +- Projectiles/Summon/MagicBullet.cs | 32 +- Projectiles/Summon/MagicHammer.cs | 94 +- Projectiles/Summon/MagicHat.cs | 74 +- Projectiles/Summon/MagicRifle.cs | 115 +- Projectiles/Summon/MagicUmbrella.cs | 48 +- Projectiles/Summon/MechwormBody.cs | 40 +- Projectiles/Summon/MechwormHead.cs | 189 +- Projectiles/Summon/MechwormLaser.cs | 50 +- Projectiles/Summon/MechwormTail.cs | 46 +- Projectiles/Summon/MechwormTeleportRift.cs | 46 +- Projectiles/Summon/MidnightSunBeaconProj.cs | 48 +- Projectiles/Summon/MidnightSunBeam.cs | 104 +- Projectiles/Summon/MidnightSunShot.cs | 30 +- Projectiles/Summon/MidnightSunUFO.cs | 123 +- Projectiles/Summon/MiniGuardianAttack.cs | 180 +- Projectiles/Summon/MiniGuardianDefense.cs | 178 +- Projectiles/Summon/MiniGuardianHealer.cs | 116 +- Projectiles/Summon/MiniSandShark.cs | 83 +- Projectiles/Summon/MortalityBeam.cs | 40 +- Projectiles/Summon/MortalityBolt.cs | 28 +- Projectiles/Summon/OldDukeHeadCorpse.cs | 66 +- Projectiles/Summon/OldDukeSharkVomit.cs | 66 +- Projectiles/Summon/PerditionBeacon.cs | 84 +- Projectiles/Summon/PhantomGuy.cs | 137 +- Projectiles/Summon/PhantomicDagger.cs | 62 +- Projectiles/Summon/PhantomicShield.cs | 58 +- Projectiles/Summon/PinkButterfly.cs | 167 +- Projectiles/Summon/PlagueBeeSmall.cs | 116 +- Projectiles/Summon/PlaguePrincess.cs | 200 +- Projectiles/Summon/PlaguebringerMK2.cs | 124 +- Projectiles/Summon/PlaguebringerSummon.cs | 138 +- Projectiles/Summon/PlantSeed.cs | 44 +- Projectiles/Summon/PlantSeedGreen.cs | 48 +- Projectiles/Summon/PlantSporeCloud.cs | 46 +- Projectiles/Summon/PlantSummon.cs | 227 +- Projectiles/Summon/PlantTentacle.cs | 122 +- Projectiles/Summon/PlantThornBall.cs | 36 +- Projectiles/Summon/PlateProjectile.cs | 47 +- Projectiles/Summon/PolypLauncherProjectile.cs | 47 +- Projectiles/Summon/PolypLauncherSentry.cs | 78 +- Projectiles/Summon/PolypLauncherShrapnel.cs | 38 +- Projectiles/Summon/PowerfulRaven.cs | 134 +- Projectiles/Summon/PrincessMissile.cs | 83 +- Projectiles/Summon/ProfanedEnergy.cs | 95 +- .../Summon/ProfanedSoulCrystalProjectiles.cs | 718 ++--- Projectiles/Summon/PurpleButterfly.cs | 86 +- Projectiles/Summon/RadiantResolutionAura.cs | 82 +- Projectiles/Summon/RadiantResolutionFire.cs | 39 +- Projectiles/Summon/RadiantResolutionOrb.cs | 58 +- Projectiles/Summon/RustShrapnel.cs | 42 +- Projectiles/Summon/RustyDrone.cs | 124 +- .../Summon/RustyDroneTargetIndicator.cs | 66 +- Projectiles/Summon/SageNeedle.cs | 30 +- Projectiles/Summon/SageSpirit.cs | 78 +- Projectiles/Summon/SakuraBullet.cs | 61 +- Projectiles/Summon/SandBolt.cs | 22 +- Projectiles/Summon/SandElementalHealer.cs | 139 +- Projectiles/Summon/SandElementalMinion.cs | 178 +- Projectiles/Summon/SandMark.cs | 121 +- Projectiles/Summon/SandTornado.cs | 75 +- Projectiles/Summon/SandnadoMinion.cs | 188 +- Projectiles/Summon/SeekerSummonProj.cs | 99 +- Projectiles/Summon/SepulcherMinion.cs | 229 +- Projectiles/Summon/Shellfish.cs | 212 +- Projectiles/Summon/SilvaCrystal.cs | 158 +- Projectiles/Summon/SilvaCrystalExplosion.cs | 142 +- Projectiles/Summon/SirenSongFriendly.cs | 45 +- Projectiles/Summon/SiriusBeam.cs | 34 +- Projectiles/Summon/SiriusExplosion.cs | 142 +- Projectiles/Summon/SiriusMinion.cs | 96 +- Projectiles/Summon/SkeletalDragonChild.cs | 106 +- Projectiles/Summon/SkeletalDragonMother.cs | 120 +- Projectiles/Summon/SlimePuppet.cs | 93 +- Projectiles/Summon/SmallSkeletonMinion.cs | 146 +- Projectiles/Summon/SolarBeam.cs | 30 +- Projectiles/Summon/SolarGod.cs | 92 +- Projectiles/Summon/SolarPixie.cs | 92 +- Projectiles/Summon/SonOfYharon.cs | 143 +- Projectiles/Summon/Spikecrag.cs | 72 +- Projectiles/Summon/SpikecragSpike.cs | 22 +- Projectiles/Summon/SquirrelSquireAcorn.cs | 22 +- Projectiles/Summon/SquirrelSquireMinion.cs | 112 +- Projectiles/Summon/StormMarkSummon.cs | 117 +- Projectiles/Summon/StormjawBaby.cs | 408 +-- Projectiles/Summon/SummonAstralExplosion.cs | 26 +- .../Summon/SummonBrimstoneExplosion.cs | 36 +- .../Summon/SummonBrimstoneExplosionSmall.cs | 34 +- Projectiles/Summon/TacticalPlagueJet.cs | 124 +- Projectiles/Summon/TundraFlameBlossom.cs | 76 +- Projectiles/Summon/TundraFlameBlossomsOrb.cs | 41 +- Projectiles/Summon/UniverseSplitterField.cs | 55 +- .../Summon/UniverseSplitterHugeBeam.cs | 105 +- .../Summon/UniverseSplitterSmallBeam.cs | 90 +- Projectiles/Summon/Urchin.cs | 79 +- Projectiles/Summon/UrchinSpike.cs | 20 +- Projectiles/Summon/Valkyrie.cs | 88 +- Projectiles/Summon/VileFeederProjectile.cs | 126 +- Projectiles/Summon/VileFeederSummon.cs | 144 +- Projectiles/Summon/ViridVanguardBlade.cs | 112 +- Projectiles/Summon/VoidConcentrationAura.cs | 44 +- .../Summon/VoidConcentrationBlackhole.cs | 121 +- Projectiles/Summon/VoidConcentrationOrb.cs | 68 +- Projectiles/Summon/WaterElementalMinion.cs | 118 +- Projectiles/Summon/WaterSpearFriendly.cs | 69 +- Projectiles/Summon/WitherBlossom.cs | 64 +- Projectiles/Summon/WitherBolt.cs | 64 +- Projectiles/Summon/WulfrumBoltMinion.cs | 32 +- Projectiles/Summon/WulfrumDroid.cs | 160 +- Projectiles/Summon/YharonMinionFireball.cs | 73 +- Projectiles/Summon/YoungDuke.cs | 92 +- Projectiles/Typeless/AeroExplosive.cs | 79 +- Projectiles/Typeless/AllianceTriangle.cs | 40 +- .../Typeless/ArtifactOfResilienceShards.cs | 156 +- Projectiles/Typeless/AstralFallingSand.cs | 30 +- Projectiles/Typeless/AstralSpray.cs | 46 +- Projectiles/Typeless/AstralStar.cs | 87 +- Projectiles/Typeless/AtaxiaOrb.cs | 22 +- Projectiles/Typeless/BallisticPoisonCloud.cs | 56 +- Projectiles/Typeless/BlazingSun.cs | 62 +- Projectiles/Typeless/BlazingSun2.cs | 40 +- Projectiles/Typeless/BloodBomb.cs | 29 +- Projectiles/Typeless/BloodBombExplosion.cs | 51 +- Projectiles/Typeless/BlunderBoosterAura.cs | 74 +- Projectiles/Typeless/BobbitHead.cs | 14 +- Projectiles/Typeless/BossRushEffectThing.cs | 24 +- .../Typeless/BossRushEndEffectThing.cs | 27 +- .../Typeless/BossRushFailureEffectThing.cs | 23 +- .../BrimstoneHellfireballFriendly2.cs | 35 +- Projectiles/Typeless/ChaosBlaze.cs | 48 +- Projectiles/Typeless/ChaosFlare.cs | 33 +- Projectiles/Typeless/ChaosFlare2.cs | 26 +- Projectiles/Typeless/ChaosGeyser.cs | 69 +- Projectiles/Typeless/ChaoticSpreadBobber.cs | 16 +- Projectiles/Typeless/ChlorophyteLifePulse.cs | 40 +- Projectiles/Typeless/CoralBubble.cs | 69 +- Projectiles/Typeless/CoralBubbleSmall.cs | 63 +- Projectiles/Typeless/CryonicShield.cs | 40 +- Projectiles/Typeless/CursorProj.cs | 131 +- Projectiles/Typeless/CursorProjSplit.cs | 145 +- Projectiles/Typeless/CyanLabSeeker.cs | 28 +- Projectiles/Typeless/DarkIce.cs | 35 +- Projectiles/Typeless/DemonshadeRedDevil.cs | 178 +- Projectiles/Typeless/DevourerofCodsBobber.cs | 30 +- Projectiles/Typeless/DirectStrike.cs | 20 +- Projectiles/Typeless/DragonDust.cs | 40 +- Projectiles/Typeless/EarlyBloomBobber.cs | 14 +- Projectiles/Typeless/EnergyShell.cs | 47 +- Projectiles/Typeless/FabsolDust.cs | 24 +- Projectiles/Typeless/FeralDoubleBobber.cs | 14 +- .../FiniteUse/ExplosiveShotgunShell.cs | 47 +- .../Typeless/FiniteUse/GrenadeRound.cs | 59 +- Projectiles/Typeless/FiniteUse/MagnumRound.cs | 20 +- Projectiles/Typeless/FlareExplosion.cs | 26 +- Projectiles/Typeless/FuckYou.cs | 91 +- Projectiles/Typeless/GemTechArmorGem.cs | 103 +- Projectiles/Typeless/GhostlyBolt.cs | 37 +- Projectiles/Typeless/GladiatorSword.cs | 54 +- Projectiles/Typeless/GladiatorSword2.cs | 56 +- Projectiles/Typeless/GodKiller.cs | 73 +- Projectiles/Typeless/GodSlayerBlaze.cs | 40 +- Projectiles/Typeless/GodSlayerOrb.cs | 18 +- Projectiles/Typeless/GodSlayerPhantom.cs | 84 +- Projectiles/Typeless/GodSlayerShrapnel.cs | 63 +- .../Typeless/GodSlayerShrapnelRound.cs | 27 +- Projectiles/Typeless/GoldenGunProj.cs | 46 +- Projectiles/Typeless/GreenLabSeeker.cs | 28 +- .../Typeless/HellfireExplosionFriendly2.cs | 41 +- Projectiles/Typeless/HeronBobber.cs | 12 +- Projectiles/Typeless/HolyEruption.cs | 60 +- Projectiles/Typeless/HolyExplosion.cs | 39 +- Projectiles/Typeless/HolyExplosionSupreme.cs | 39 +- Projectiles/Typeless/HolyFlameBomb.cs | 57 +- Projectiles/Typeless/HydrothermalSmoke.cs | 22 +- Projectiles/Typeless/KelvinCatalystStar.cs | 65 +- Projectiles/Typeless/LunicBeam.cs | 157 +- Projectiles/Typeless/MageHammerBoom.cs | 18 +- Projectiles/Typeless/MarkRound.cs | 42 +- Projectiles/Typeless/MomentumCapacitorOrb.cs | 28 +- Projectiles/Typeless/MythrilFlare.cs | 54 +- Projectiles/Typeless/NanoFlare.cs | 43 +- Projectiles/Typeless/Nanotech.cs | 50 +- Projectiles/Typeless/NavyBobber.cs | 14 +- Projectiles/Typeless/NebulaDust.cs | 62 +- Projectiles/Typeless/NebulaStar.cs | 22 +- Projectiles/Typeless/NobodyKnows.cs | 10 +- Projectiles/Typeless/OmegaBlueTentacle.cs | 136 +- Projectiles/Typeless/PendantProjectile1.cs | 22 +- Projectiles/Typeless/PendantProjectile2.cs | 22 +- Projectiles/Typeless/PendantProjectile3.cs | 24 +- Projectiles/Typeless/PoisonousSeawater.cs | 24 +- Projectiles/Typeless/PurpleLabSeeker.cs | 28 +- Projectiles/Typeless/ReaverOrb.cs | 44 +- Projectiles/Typeless/ReaverThornBase.cs | 60 +- Projectiles/Typeless/ReaverThornTip.cs | 20 +- Projectiles/Typeless/RedLabSeeker.cs | 28 +- .../Typeless/RelicOfConvergenceCrystal.cs | 73 +- .../Typeless/RelicOfDeliveranceSpear.cs | 165 +- Projectiles/Typeless/SabatonBoom.cs | 24 +- Projectiles/Typeless/SabatonSlam.cs | 31 +- Projectiles/Typeless/SandCloakVeil.cs | 46 +- Projectiles/Typeless/SandExplosion.cs | 22 +- Projectiles/Typeless/Seashell.cs | 26 +- Projectiles/Typeless/SepulcherSoul.cs | 30 +- Projectiles/Typeless/SerpentsBiteHook.cs | 8 +- Projectiles/Typeless/ShadowflameExplosion.cs | 34 +- .../Typeless/ShadowflameExplosionBig.cs | 36 +- Projectiles/Typeless/SkyFlareFriendly.cs | 57 +- Projectiles/Typeless/SlurperBobber.cs | 14 +- Projectiles/Typeless/SpiritOriginBullseye.cs | 58 +- Projectiles/Typeless/StandingFire.cs | 67 +- Projectiles/Typeless/StarStruckWaterBottle.cs | 29 +- Projectiles/Typeless/StickyFeatherAero.cs | 43 +- Projectiles/Typeless/StormBolt.cs | 18 +- Projectiles/Typeless/SuicideBomberDemon.cs | 169 +- .../Typeless/SulphuricAcidBubbleFriendly.cs | 115 +- Projectiles/Typeless/TarraEnergy.cs | 28 +- Projectiles/Typeless/TerminusHoldout.cs | 67 +- Projectiles/Typeless/TeslaAura.cs | 74 +- Projectiles/Typeless/TrueBattleSpawn.cs | 22 +- Projectiles/Typeless/UnstableSpark.cs | 62 +- Projectiles/Typeless/VanquisherArrowSplit.cs | 32 +- Projectiles/Typeless/VerstaltiteBobber.cs | 14 +- Projectiles/Typeless/WaterConvertor.cs | 18 +- Projectiles/Typeless/WulfrumBobber.cs | 12 +- Projectiles/Typeless/XerocBlast.cs | 40 +- Projectiles/Typeless/XerocBubble.cs | 22 +- Projectiles/Typeless/XerocFire.cs | 56 +- Projectiles/Typeless/XerocOrb.cs | 16 +- Projectiles/Typeless/XerocStar.cs | 30 +- Projectiles/Typeless/YanmeisKnifeSlash.cs | 71 +- Projectiles/Typeless/YellowLabSeeker.cs | 28 +- .../ChlorophyteCrystalAI.cs | 3 +- Schematics/CalamitySchematicIO.cs | 28 +- Schematics/SchematicManager.cs | 8 +- Skies/CryogenSky.cs | 2 +- Skies/ExoMechsSky.cs | 5 +- Skies/SCalSky.cs | 2 +- TileEntities/TEBaseTurret.cs | 4 +- TileEntities/TEChargingStation.cs | 6 +- TileEntities/TECodebreaker.cs | 10 +- TileEntities/TEDraedonLabTurret.cs | 2 +- TileEntities/TELabHologramProjector.cs | 4 +- TileEntities/TEPowerCellFactory.cs | 6 +- Tiles/Abyss/AbyssGravel.cs | 2 +- Tiles/Abyss/AbyssalCrateTile.cs | 2 +- Tiles/Abyss/AbyssalPots.cs | 2 +- Tiles/Abyss/AcidWoodTree.cs | 4 +- Tiles/Abyss/AcidWoodTreeSapling.cs | 24 +- Tiles/Abyss/AcidwoodTile.cs | 2 +- Tiles/Abyss/HardenedSulphurousSandstone.cs | 10 +- Tiles/Abyss/LumenylCrystals.cs | 20 +- Tiles/Abyss/PlantyMush.cs | 8 +- Tiles/Abyss/RustyChestTile.cs | 4 +- .../Abyss/Stalactite/SulphurousStalacmite1.cs | 2 +- .../Abyss/Stalactite/SulphurousStalacmite2.cs | 2 +- .../Abyss/Stalactite/SulphurousStalacmite3.cs | 2 +- .../Abyss/Stalactite/SulphurousStalacmite4.cs | 2 +- .../Abyss/Stalactite/SulphurousStalacmite5.cs | 2 +- .../Abyss/Stalactite/SulphurousStalacmite6.cs | 2 +- .../Abyss/Stalactite/SulphurousStalactite1.cs | 2 +- .../Abyss/Stalactite/SulphurousStalactite2.cs | 2 +- .../Abyss/Stalactite/SulphurousStalactite3.cs | 2 +- .../Abyss/Stalactite/SulphurousStalactite4.cs | 2 +- .../Abyss/Stalactite/SulphurousStalactite5.cs | 2 +- .../Abyss/Stalactite/SulphurousStalactite6.cs | 2 +- Tiles/Abyss/SteamGeyser.cs | 2 +- Tiles/Abyss/SulphuricFossil1.cs | 2 +- Tiles/Abyss/SulphuricFossil2.cs | 2 +- Tiles/Abyss/SulphuricFossil3.cs | 2 +- Tiles/Abyss/SulphurousCactus.cs | 2 +- Tiles/Abyss/SulphurousColumn.cs | 4 +- Tiles/Abyss/SulphurousPots.cs | 2 +- Tiles/Abyss/SulphurousRib1.cs | 2 +- Tiles/Abyss/SulphurousRib2.cs | 2 +- Tiles/Abyss/SulphurousRib3.cs | 2 +- Tiles/Abyss/SulphurousRib4.cs | 2 +- Tiles/Abyss/SulphurousRib5.cs | 2 +- Tiles/Abyss/SulphurousSand.cs | 14 +- Tiles/Abyss/SulphurousSandNoWater.cs | 2 +- Tiles/Abyss/SulphurousSandstone.cs | 10 +- Tiles/Abyss/SulphurousVines.cs | 16 +- Tiles/Abyss/Tenebris.cs | 2 +- Tiles/Abyss/ViperVines.cs | 16 +- Tiles/Abyss/Voidstone.cs | 8 +- Tiles/AerialiteBarTile.cs | 2 +- Tiles/AerialiteBrick.cs | 2 +- Tiles/ArenaTile.cs | 2 +- Tiles/Astral/AstralBeacon.cs | 11 +- Tiles/Astral/AstralChestLocked.cs | 12 +- Tiles/Astral/AstralClay.cs | 2 +- Tiles/Astral/AstralCrateTile.cs | 2 +- Tiles/Astral/AstralDirt.cs | 4 +- Tiles/Astral/AstralGrass.cs | 4 +- Tiles/Astral/AstralMonolith.cs | 8 +- Tiles/Astral/AstralNormalLargePiles.cs | 2 +- Tiles/Astral/AstralNormalMediumPiles.cs | 2 +- Tiles/Astral/AstralNormalSmallPiles.cs | 2 +- Tiles/Astral/AstralNormalStalactite.cs | 6 +- Tiles/Astral/AstralShortPlants.cs | 2 +- Tiles/Astral/AstralSilt.cs | 2 +- Tiles/Astral/AstralStone.cs | 2 +- Tiles/Astral/AstralTallPlants.cs | 2 +- Tiles/Astral/AstralTree.cs | 6 +- Tiles/Astral/AstralTreeSapling.cs | 2 +- Tiles/Astral/AstralVines.cs | 2 +- Tiles/AstralBar.cs | 2 +- Tiles/AstralBrick.cs | 8 +- Tiles/AstralDesert/AstralDesertLargePiles.cs | 2 +- Tiles/AstralDesert/AstralDesertMediumPiles.cs | 2 +- Tiles/AstralDesert/AstralDesertSmallPiles.cs | 2 +- Tiles/AstralDesert/AstralDesertStalactite.cs | 6 +- Tiles/AstralDesert/AstralFossil.cs | 2 +- Tiles/AstralDesert/AstralPalmSapling.cs | 2 +- Tiles/AstralDesert/AstralPalmTree.cs | 4 +- Tiles/AstralDesert/AstralSand.cs | 2 +- Tiles/AstralDesert/AstralSandstone.cs | 2 +- Tiles/AstralDesert/HardenedAstralSand.cs | 2 +- Tiles/AstralSnow/AstralIce.cs | 2 +- Tiles/AstralSnow/AstralIceLargePiles.cs | 2 +- Tiles/AstralSnow/AstralIceMediumPiles.cs | 2 +- Tiles/AstralSnow/AstralIceSmallPiles.cs | 2 +- Tiles/AstralSnow/AstralIceStalactite.cs | 6 +- Tiles/AstralSnow/AstralSnow.cs | 2 +- Tiles/AstralSnow/AstralSnowTree.cs | 6 +- Tiles/AstralSnow/AstralSnowTreeSapling.cs | 6 +- Tiles/AuricTeslaBar.cs | 2 +- Tiles/BaseTiles/DoubleDirectionalTile.cs | 10 +- Tiles/CalamityGlobalTile.cs | 30 +- Tiles/ChaoticBarPlaced.cs | 2 +- Tiles/ChaoticBrick.cs | 2 +- Tiles/CosmiliteBarTile.cs | 2 +- Tiles/Crags/BrimstoneCrateTile.cs | 2 +- Tiles/Crags/BrimstoneSlag.cs | 2 +- Tiles/CryonicBar.cs | 2 +- Tiles/CryonicBrick.cs | 2 +- .../AgedLaboratoryConsole.cs | 8 +- .../AgedLaboratoryContainmentBox.cs | 2 +- .../AgedLaboratoryDisplay.cs | 8 +- .../AgedLaboratoryDoorClosed.cs | 2 +- .../AgedLaboratoryDoorOpen.cs | 2 +- .../AgedLaboratoryElectricPanel.cs | 2 +- .../DraedonStructures/AgedLaboratoryScreen.cs | 8 +- .../DraedonStructures/AgedLaboratoryServer.cs | 8 +- .../AgedLaboratoryTerminal.cs | 2 +- .../DraedonStructures/AgedReinforcedCrate.cs | 8 +- .../AgedSecurityChestTile.cs | 4 +- Tiles/DraedonStructures/ChargingStation.cs | 19 +- Tiles/DraedonStructures/DraedonLabTurret.cs | 10 +- .../DraedonStructures/HazardChevronPanels.cs | 2 +- .../InactivePowerCellFactory.cs | 2 +- .../DraedonStructures/LabHologramProjector.cs | 17 +- Tiles/DraedonStructures/LaboratoryConsole.cs | 8 +- .../LaboratoryContainmentBox.cs | 2 +- Tiles/DraedonStructures/LaboratoryDisplay.cs | 8 +- .../DraedonStructures/LaboratoryDoorClosed.cs | 2 +- Tiles/DraedonStructures/LaboratoryDoorOpen.cs | 2 +- .../LaboratoryElectricPanel.cs | 2 +- Tiles/DraedonStructures/LaboratoryPanels.cs | 2 +- .../LaboratoryPipePlating.cs | 2 +- Tiles/DraedonStructures/LaboratoryPlating.cs | 2 +- Tiles/DraedonStructures/LaboratoryScreen.cs | 8 +- Tiles/DraedonStructures/LaboratoryServer.cs | 8 +- Tiles/DraedonStructures/LaboratoryShelf.cs | 2 +- Tiles/DraedonStructures/LaboratoryTerminal.cs | 8 +- Tiles/DraedonStructures/PowerCellFactory.cs | 19 +- Tiles/DraedonStructures/ReinforcedCrate.cs | 8 +- Tiles/DraedonStructures/RustedPipes.cs | 5 +- Tiles/DraedonStructures/RustedPlating.cs | 2 +- Tiles/DraedonStructures/RustedShelf.cs | 2 +- Tiles/DraedonStructures/SecurityChestTile.cs | 4 +- Tiles/DraedonSummoner/CodebreakerTile.cs | 33 +- Tiles/Furniture/AuricToiletTile.cs | 2 +- Tiles/Furniture/BabyFlakHermitCageTile.cs | 2 +- Tiles/Furniture/BabyGhostBellJarTile.cs | 2 +- Tiles/Furniture/BlueCandle.cs | 2 +- Tiles/Furniture/BossTrophy.cs | 2 +- Tiles/Furniture/ChaosCandle.cs | 10 +- Tiles/Furniture/CorruptionEffigy.cs | 2 +- .../CraftingStations/AncientAltar.cs | 6 +- .../Furniture/CraftingStations/AshenAltar.cs | 6 +- .../CraftingStations/BotanicPlanter.cs | 4 +- .../Furniture/CraftingStations/CosmicAnvil.cs | 2 +- .../CraftingStations/DraedonsForge.cs | 2 +- .../CraftingStations/EutrophicCrafting.cs | 2 +- .../CraftingStations/MonolithCrafting.cs | 8 +- .../CraftingStations/PlagueInfuser.cs | 2 +- .../CraftingStations/ProfanedBasin.cs | 4 +- .../Furniture/CraftingStations/SilvaBasin.cs | 4 +- .../CraftingStations/StaticRefiner.cs | 2 +- .../CraftingStations/VoidCondenser.cs | 2 +- Tiles/Furniture/CrimsonEffigy.cs | 2 +- Tiles/Furniture/EffigyOfDecayPlaceable.cs | 2 +- .../Furniture/Fountains/AbyssFountainTile.cs | 6 +- .../Furniture/Fountains/AstralFountainTile.cs | 6 +- .../Fountains/SulphurousFountainTile.cs | 6 +- .../Fountains/SunkenSeaFountainTile.cs | 6 +- Tiles/Furniture/PiggyCageTile.cs | 2 +- Tiles/Furniture/PinkCandle.cs | 2 +- Tiles/Furniture/PurpleCandle.cs | 2 +- Tiles/Furniture/SCalAltar.cs | 11 +- Tiles/Furniture/SeaMinnowJarTile.cs | 2 +- Tiles/Furniture/ThaumaticChairTile.cs | 2 +- Tiles/Furniture/TranquilityCandle.cs | 10 +- Tiles/Furniture/TwinklerInABottleTile.cs | 2 +- Tiles/Furniture/YellowCandle.cs | 2 +- Tiles/FurnitureAbyss/AbyssBath.cs | 2 +- Tiles/FurnitureAbyss/AbyssBed.cs | 4 +- Tiles/FurnitureAbyss/AbyssBookcase.cs | 2 +- Tiles/FurnitureAbyss/AbyssCandelabra.cs | 4 +- Tiles/FurnitureAbyss/AbyssCandle.cs | 6 +- Tiles/FurnitureAbyss/AbyssChair.cs | 2 +- Tiles/FurnitureAbyss/AbyssChandelier.cs | 4 +- Tiles/FurnitureAbyss/AbyssChest.cs | 4 +- Tiles/FurnitureAbyss/AbyssClock.cs | 4 +- Tiles/FurnitureAbyss/AbyssDoorClosed.cs | 2 +- Tiles/FurnitureAbyss/AbyssDoorOpen.cs | 2 +- Tiles/FurnitureAbyss/AbyssDresser.cs | 4 +- Tiles/FurnitureAbyss/AbyssLamp.cs | 4 +- Tiles/FurnitureAbyss/AbyssLantern.cs | 4 +- Tiles/FurnitureAbyss/AbyssPiano.cs | 2 +- Tiles/FurnitureAbyss/AbyssSink.cs | 2 +- Tiles/FurnitureAbyss/AbyssSofa.cs | 2 +- Tiles/FurnitureAbyss/AbyssTable.cs | 2 +- Tiles/FurnitureAbyss/AbyssTorch.cs | 10 +- Tiles/FurnitureAbyss/AbyssWorkbench.cs | 2 +- Tiles/FurnitureAbyss/SmoothAbyssGravel.cs | 2 +- .../SmoothAbyssGravelPlatform.cs | 2 +- Tiles/FurnitureAcidwood/AcidwoodBathTile.cs | 2 +- Tiles/FurnitureAcidwood/AcidwoodBedTile.cs | 4 +- Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs | 2 +- .../FurnitureAcidwood/AcidwoodBookcaseTile.cs | 2 +- .../AcidwoodCandelabraTile.cs | 6 +- Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs | 8 +- Tiles/FurnitureAcidwood/AcidwoodChairTile.cs | 2 +- .../AcidwoodChandelierTile.cs | 6 +- Tiles/FurnitureAcidwood/AcidwoodChestTile.cs | 4 +- Tiles/FurnitureAcidwood/AcidwoodClockTile.cs | 4 +- Tiles/FurnitureAcidwood/AcidwoodDoorClosed.cs | 2 +- Tiles/FurnitureAcidwood/AcidwoodDoorOpen.cs | 2 +- .../FurnitureAcidwood/AcidwoodDresserTile.cs | 4 +- Tiles/FurnitureAcidwood/AcidwoodLampTile.cs | 6 +- .../FurnitureAcidwood/AcidwoodLanternTile.cs | 6 +- Tiles/FurnitureAcidwood/AcidwoodPianoTile.cs | 2 +- .../FurnitureAcidwood/AcidwoodPlatformTile.cs | 2 +- Tiles/FurnitureAcidwood/AcidwoodSinkTile.cs | 2 +- Tiles/FurnitureAcidwood/AcidwoodTableTile.cs | 2 +- .../AcidwoodWorkbenchTile.cs | 2 +- Tiles/FurnitureAncient/AncientBasin.cs | 8 +- Tiles/FurnitureAncient/AncientBath.cs | 2 +- Tiles/FurnitureAncient/AncientBed.cs | 4 +- Tiles/FurnitureAncient/AncientBookcase.cs | 2 +- Tiles/FurnitureAncient/AncientChair.cs | 2 +- Tiles/FurnitureAncient/AncientChandelier.cs | 6 +- Tiles/FurnitureAncient/AncientDoorClosed.cs | 2 +- Tiles/FurnitureAncient/AncientDoorOpen.cs | 2 +- Tiles/FurnitureAncient/AncientDresser.cs | 4 +- Tiles/FurnitureAncient/AncientLamp.cs | 6 +- Tiles/FurnitureAncient/AncientLantern.cs | 8 +- Tiles/FurnitureAncient/AncientMonolith.cs | 4 +- Tiles/FurnitureAncient/AncientPiano.cs | 2 +- Tiles/FurnitureAncient/AncientSink.cs | 2 +- Tiles/FurnitureAncient/AncientSofa.cs | 2 +- Tiles/FurnitureAncient/AncientTable.cs | 2 +- Tiles/FurnitureAncient/AncientWorkbench.cs | 2 +- Tiles/FurnitureAshen/AshenBasin.cs | 8 +- Tiles/FurnitureAshen/AshenBath.cs | 2 +- Tiles/FurnitureAshen/AshenBed.cs | 4 +- Tiles/FurnitureAshen/AshenBookcase.cs | 2 +- Tiles/FurnitureAshen/AshenCandelabra.cs | 8 +- Tiles/FurnitureAshen/AshenCandle.cs | 10 +- Tiles/FurnitureAshen/AshenChair.cs | 2 +- Tiles/FurnitureAshen/AshenChandelier.cs | 8 +- Tiles/FurnitureAshen/AshenChest.cs | 12 +- Tiles/FurnitureAshen/AshenDoorClosed.cs | 2 +- Tiles/FurnitureAshen/AshenDoorOpen.cs | 2 +- Tiles/FurnitureAshen/AshenDresser.cs | 4 +- Tiles/FurnitureAshen/AshenLamp.cs | 8 +- Tiles/FurnitureAshen/AshenLantern.cs | 8 +- Tiles/FurnitureAshen/AshenMonolith.cs | 12 +- Tiles/FurnitureAshen/AshenPiano.cs | 2 +- Tiles/FurnitureAshen/AshenPlatform.cs | 2 +- Tiles/FurnitureAshen/AshenSink.cs | 2 +- Tiles/FurnitureAshen/AshenSlab.cs | 8 +- Tiles/FurnitureAshen/AshenSofa.cs | 2 +- Tiles/FurnitureAshen/AshenTable.cs | 2 +- Tiles/FurnitureAshen/AshenWorkbench.cs | 2 +- Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs | 8 +- Tiles/FurnitureAstral/MonolithBathtub.cs | 8 +- Tiles/FurnitureAstral/MonolithBed.cs | 10 +- Tiles/FurnitureAstral/MonolithBench.cs | 8 +- Tiles/FurnitureAstral/MonolithBookcase.cs | 8 +- Tiles/FurnitureAstral/MonolithCandelabra.cs | 12 +- Tiles/FurnitureAstral/MonolithCandle.cs | 14 +- Tiles/FurnitureAstral/MonolithChair.cs | 8 +- Tiles/FurnitureAstral/MonolithChandelier.cs | 12 +- Tiles/FurnitureAstral/MonolithChest.cs | 17 +- Tiles/FurnitureAstral/MonolithClock.cs | 10 +- Tiles/FurnitureAstral/MonolithDoorClosed.cs | 8 +- Tiles/FurnitureAstral/MonolithDoorOpen.cs | 8 +- Tiles/FurnitureAstral/MonolithDresser.cs | 10 +- Tiles/FurnitureAstral/MonolithLamp.cs | 12 +- Tiles/FurnitureAstral/MonolithLantern.cs | 12 +- Tiles/FurnitureAstral/MonolithPiano.cs | 8 +- Tiles/FurnitureAstral/MonolithPlatform.cs | 2 +- Tiles/FurnitureAstral/MonolithSink.cs | 8 +- Tiles/FurnitureAstral/MonolithTable.cs | 8 +- Tiles/FurnitureAstral/MonolithWorkbench.cs | 8 +- Tiles/FurnitureBotanic/BotanicBathtub.cs | 2 +- Tiles/FurnitureBotanic/BotanicBed.cs | 4 +- Tiles/FurnitureBotanic/BotanicBench.cs | 2 +- Tiles/FurnitureBotanic/BotanicBookcase.cs | 2 +- Tiles/FurnitureBotanic/BotanicCandelabra.cs | 4 +- Tiles/FurnitureBotanic/BotanicCandle.cs | 6 +- Tiles/FurnitureBotanic/BotanicChair.cs | 2 +- Tiles/FurnitureBotanic/BotanicChandelier.cs | 4 +- Tiles/FurnitureBotanic/BotanicChest.cs | 4 +- Tiles/FurnitureBotanic/BotanicClock.cs | 4 +- Tiles/FurnitureBotanic/BotanicDoorClosed.cs | 2 +- Tiles/FurnitureBotanic/BotanicDoorOpen.cs | 2 +- Tiles/FurnitureBotanic/BotanicDresser.cs | 4 +- Tiles/FurnitureBotanic/BotanicLamp.cs | 4 +- Tiles/FurnitureBotanic/BotanicLantern.cs | 4 +- Tiles/FurnitureBotanic/BotanicPiano.cs | 2 +- Tiles/FurnitureBotanic/BotanicPlatform.cs | 2 +- Tiles/FurnitureBotanic/BotanicSink.cs | 2 +- Tiles/FurnitureBotanic/BotanicTable.cs | 2 +- Tiles/FurnitureBotanic/BotanicWorkBench.cs | 2 +- .../FurnitureCosmilite/CosmiliteBasinTile.cs | 8 +- Tiles/FurnitureCosmilite/CosmiliteBath.cs | 2 +- Tiles/FurnitureCosmilite/CosmiliteBed.cs | 4 +- Tiles/FurnitureCosmilite/CosmiliteBookcase.cs | 2 +- Tiles/FurnitureCosmilite/CosmiliteBrick.cs | 8 +- .../FurnitureCosmilite/CosmiliteCandelabra.cs | 4 +- Tiles/FurnitureCosmilite/CosmiliteCandle.cs | 6 +- Tiles/FurnitureCosmilite/CosmiliteChair.cs | 2 +- .../FurnitureCosmilite/CosmiliteChandelier.cs | 4 +- Tiles/FurnitureCosmilite/CosmiliteChest.cs | 4 +- Tiles/FurnitureCosmilite/CosmiliteClock.cs | 4 +- .../FurnitureCosmilite/CosmiliteDoorClosed.cs | 2 +- Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs | 2 +- Tiles/FurnitureCosmilite/CosmiliteDresser.cs | 4 +- Tiles/FurnitureCosmilite/CosmiliteLamp.cs | 4 +- Tiles/FurnitureCosmilite/CosmiliteLantern.cs | 4 +- Tiles/FurnitureCosmilite/CosmilitePiano.cs | 2 +- Tiles/FurnitureCosmilite/CosmilitePlatform.cs | 2 +- Tiles/FurnitureCosmilite/CosmiliteSconce.cs | 4 +- Tiles/FurnitureCosmilite/CosmiliteSink.cs | 2 +- Tiles/FurnitureCosmilite/CosmiliteSofa.cs | 2 +- Tiles/FurnitureCosmilite/CosmiliteTable.cs | 2 +- .../FurnitureCosmilite/CosmiliteWorkbench.cs | 2 +- Tiles/FurnitureEutrophic/EutrophicBathtub.cs | 2 +- Tiles/FurnitureEutrophic/EutrophicBed.cs | 4 +- Tiles/FurnitureEutrophic/EutrophicBench.cs | 2 +- Tiles/FurnitureEutrophic/EutrophicBookcase.cs | 2 +- .../FurnitureEutrophic/EutrophicCandelabra.cs | 4 +- Tiles/FurnitureEutrophic/EutrophicCandle.cs | 6 +- Tiles/FurnitureEutrophic/EutrophicChair.cs | 2 +- .../FurnitureEutrophic/EutrophicChandelier.cs | 4 +- Tiles/FurnitureEutrophic/EutrophicChest.cs | 4 +- Tiles/FurnitureEutrophic/EutrophicClock.cs | 6 +- .../FurnitureEutrophic/EutrophicDoorClosed.cs | 2 +- Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs | 2 +- Tiles/FurnitureEutrophic/EutrophicDresser.cs | 4 +- Tiles/FurnitureEutrophic/EutrophicLamp.cs | 4 +- Tiles/FurnitureEutrophic/EutrophicLantern.cs | 4 +- Tiles/FurnitureEutrophic/EutrophicPiano.cs | 2 +- Tiles/FurnitureEutrophic/EutrophicPlatform.cs | 2 +- Tiles/FurnitureEutrophic/EutrophicSink.cs | 2 +- Tiles/FurnitureEutrophic/EutrophicTable.cs | 2 +- .../FurnitureEutrophic/EutrophicWorkBench.cs | 2 +- Tiles/FurnitureEutrophic/SmoothNavystone.cs | 2 +- Tiles/FurnitureExo/ExoBathtubTile.cs | 8 +- Tiles/FurnitureExo/ExoBedTile.cs | 10 +- Tiles/FurnitureExo/ExoBookcaseTile.cs | 8 +- Tiles/FurnitureExo/ExoCandelabraTile.cs | 6 +- Tiles/FurnitureExo/ExoCandleTile.cs | 8 +- Tiles/FurnitureExo/ExoChairTile.cs | 8 +- Tiles/FurnitureExo/ExoChandelierTile.cs | 6 +- Tiles/FurnitureExo/ExoChestTile.cs | 8 +- Tiles/FurnitureExo/ExoClockTile.cs | 10 +- Tiles/FurnitureExo/ExoConsoleTile.cs | 8 +- Tiles/FurnitureExo/ExoDisplayTile.cs | 8 +- Tiles/FurnitureExo/ExoDoorClosed.cs | 2 +- Tiles/FurnitureExo/ExoDoorOpen.cs | 2 +- Tiles/FurnitureExo/ExoDresserTile.cs | 10 +- Tiles/FurnitureExo/ExoKeyboardTile.cs | 8 +- Tiles/FurnitureExo/ExoLampTile.cs | 6 +- Tiles/FurnitureExo/ExoLanternTile.cs | 6 +- Tiles/FurnitureExo/ExoPlatformTile.cs | 2 +- Tiles/FurnitureExo/ExoPlatingTile.cs | 8 +- Tiles/FurnitureExo/ExoPrismPanelTile.cs | 8 +- Tiles/FurnitureExo/ExoPrismPlatformTile.cs | 8 +- Tiles/FurnitureExo/ExoScreenTile.cs | 6 +- Tiles/FurnitureExo/ExoServerTile.cs | 8 +- Tiles/FurnitureExo/ExoSinkTile.cs | 8 +- Tiles/FurnitureExo/ExoSofaTile.cs | 8 +- Tiles/FurnitureExo/ExoTableTile.cs | 8 +- Tiles/FurnitureExo/ExoTerminalTile.cs | 8 +- Tiles/FurnitureExo/ExoToiletTile.cs | 8 +- Tiles/FurnitureExo/ExoWorkbenchTile.cs | 8 +- Tiles/FurnitureOccult/OccultBathtub.cs | 2 +- Tiles/FurnitureOccult/OccultBed.cs | 4 +- Tiles/FurnitureOccult/OccultBookcase.cs | 2 +- Tiles/FurnitureOccult/OccultCandelabra.cs | 4 +- Tiles/FurnitureOccult/OccultCandle.cs | 6 +- Tiles/FurnitureOccult/OccultChair.cs | 2 +- Tiles/FurnitureOccult/OccultChandelier.cs | 4 +- Tiles/FurnitureOccult/OccultChest.cs | 4 +- Tiles/FurnitureOccult/OccultClock.cs | 4 +- Tiles/FurnitureOccult/OccultDoorClosed.cs | 2 +- Tiles/FurnitureOccult/OccultDoorOpen.cs | 2 +- Tiles/FurnitureOccult/OccultDresser.cs | 4 +- Tiles/FurnitureOccult/OccultLamp.cs | 4 +- Tiles/FurnitureOccult/OccultLantern.cs | 4 +- Tiles/FurnitureOccult/OccultPiano.cs | 2 +- Tiles/FurnitureOccult/OccultPlatform.cs | 2 +- Tiles/FurnitureOccult/OccultSink.cs | 2 +- Tiles/FurnitureOccult/OccultSofa.cs | 2 +- Tiles/FurnitureOccult/OccultStone.cs | 10 +- Tiles/FurnitureOccult/OccultTable.cs | 2 +- Tiles/FurnitureOccult/OccultWorkbench.cs | 2 +- Tiles/FurniturePlaguedPlate/PlaguedPlate.cs | 8 +- .../PlaguedPlateBasin.cs | 4 +- .../PlaguedPlateBathtub.cs | 2 +- .../FurniturePlaguedPlate/PlaguedPlateBed.cs | 10 +- .../PlaguedPlateBookcase.cs | 2 +- .../PlaguedPlateCandelabra.cs | 4 +- .../PlaguedPlateCandle.cs | 6 +- .../PlaguedPlateChair.cs | 2 +- .../PlaguedPlateChandelier.cs | 4 +- .../PlaguedPlateChest.cs | 4 +- .../PlaguedPlateClock.cs | 4 +- .../PlaguedPlateDoorClosed.cs | 2 +- .../PlaguedPlateDoorOpen.cs | 2 +- .../PlaguedPlateDresser.cs | 4 +- .../FurniturePlaguedPlate/PlaguedPlateLamp.cs | 4 +- .../PlaguedPlateLantern.cs | 4 +- .../PlaguedPlatePiano.cs | 2 +- .../PlaguedPlatePlatform.cs | 2 +- .../FurniturePlaguedPlate/PlaguedPlateSink.cs | 2 +- .../FurniturePlaguedPlate/PlaguedPlateSofa.cs | 2 +- .../PlaguedPlateTable.cs | 2 +- .../PlaguedPlateWorkbench.cs | 2 +- Tiles/FurnitureProfaned/ProfanedBath.cs | 2 +- Tiles/FurnitureProfaned/ProfanedBed.cs | 4 +- Tiles/FurnitureProfaned/ProfanedBench.cs | 2 +- Tiles/FurnitureProfaned/ProfanedBookcase.cs | 2 +- Tiles/FurnitureProfaned/ProfanedCandelabra.cs | 8 +- Tiles/FurnitureProfaned/ProfanedCandle.cs | 10 +- Tiles/FurnitureProfaned/ProfanedChair.cs | 2 +- Tiles/FurnitureProfaned/ProfanedChandelier.cs | 4 +- Tiles/FurnitureProfaned/ProfanedChest.cs | 4 +- Tiles/FurnitureProfaned/ProfanedClock.cs | 4 +- Tiles/FurnitureProfaned/ProfanedCrystal.cs | 2 +- Tiles/FurnitureProfaned/ProfanedDoorClosed.cs | 2 +- Tiles/FurnitureProfaned/ProfanedDoorOpen.cs | 2 +- Tiles/FurnitureProfaned/ProfanedDresser.cs | 4 +- Tiles/FurnitureProfaned/ProfanedLamp.cs | 8 +- Tiles/FurnitureProfaned/ProfanedLantern.cs | 8 +- Tiles/FurnitureProfaned/ProfanedPiano.cs | 2 +- Tiles/FurnitureProfaned/ProfanedPlatform.cs | 2 +- Tiles/FurnitureProfaned/ProfanedRock.cs | 8 +- Tiles/FurnitureProfaned/ProfanedSink.cs | 2 +- Tiles/FurnitureProfaned/ProfanedSlab.cs | 2 +- Tiles/FurnitureProfaned/ProfanedTable.cs | 2 +- Tiles/FurnitureProfaned/ProfanedWorkbench.cs | 2 +- Tiles/FurnitureProfaned/RunicProfanedBrick.cs | 8 +- Tiles/FurnitureSilva/SilvaBathtub.cs | 2 +- Tiles/FurnitureSilva/SilvaBed.cs | 4 +- Tiles/FurnitureSilva/SilvaBench.cs | 2 +- Tiles/FurnitureSilva/SilvaBookcase.cs | 2 +- Tiles/FurnitureSilva/SilvaCandelabra.cs | 4 +- Tiles/FurnitureSilva/SilvaCandle.cs | 6 +- Tiles/FurnitureSilva/SilvaChair.cs | 2 +- Tiles/FurnitureSilva/SilvaChandelier.cs | 4 +- Tiles/FurnitureSilva/SilvaChest.cs | 4 +- Tiles/FurnitureSilva/SilvaClock.cs | 4 +- Tiles/FurnitureSilva/SilvaCrystal.cs | 2 +- Tiles/FurnitureSilva/SilvaDoorClosed.cs | 2 +- Tiles/FurnitureSilva/SilvaDoorOpen.cs | 2 +- Tiles/FurnitureSilva/SilvaDresser.cs | 4 +- Tiles/FurnitureSilva/SilvaLamp.cs | 4 +- Tiles/FurnitureSilva/SilvaLantern.cs | 4 +- Tiles/FurnitureSilva/SilvaPiano.cs | 2 +- Tiles/FurnitureSilva/SilvaPlatform.cs | 2 +- Tiles/FurnitureSilva/SilvaSink.cs | 2 +- Tiles/FurnitureSilva/SilvaTable.cs | 2 +- Tiles/FurnitureSilva/SilvaWorkBench.cs | 2 +- Tiles/FurnitureStatigel/StatigelBath.cs | 2 +- Tiles/FurnitureStatigel/StatigelBed.cs | 4 +- Tiles/FurnitureStatigel/StatigelBlock.cs | 2 +- Tiles/FurnitureStatigel/StatigelBookcase.cs | 2 +- Tiles/FurnitureStatigel/StatigelCandelabra.cs | 6 +- Tiles/FurnitureStatigel/StatigelCandle.cs | 8 +- Tiles/FurnitureStatigel/StatigelChair.cs | 2 +- Tiles/FurnitureStatigel/StatigelChandelier.cs | 6 +- Tiles/FurnitureStatigel/StatigelChest.cs | 4 +- Tiles/FurnitureStatigel/StatigelClock.cs | 4 +- Tiles/FurnitureStatigel/StatigelDoorClosed.cs | 2 +- Tiles/FurnitureStatigel/StatigelDoorOpen.cs | 2 +- Tiles/FurnitureStatigel/StatigelDresser.cs | 4 +- Tiles/FurnitureStatigel/StatigelLamp.cs | 6 +- Tiles/FurnitureStatigel/StatigelLantern.cs | 6 +- Tiles/FurnitureStatigel/StatigelPiano.cs | 2 +- Tiles/FurnitureStatigel/StatigelPlatform.cs | 2 +- Tiles/FurnitureStatigel/StatigelSink.cs | 2 +- Tiles/FurnitureStatigel/StatigelSofa.cs | 2 +- Tiles/FurnitureStatigel/StatigelTable.cs | 2 +- Tiles/FurnitureStatigel/StatigelWorkbench.cs | 2 +- Tiles/FurnitureStratus/StratusBathtub.cs | 2 +- Tiles/FurnitureStratus/StratusBed.cs | 4 +- Tiles/FurnitureStratus/StratusBookcase.cs | 2 +- Tiles/FurnitureStratus/StratusBricks.cs | 8 +- Tiles/FurnitureStratus/StratusCandelabra.cs | 4 +- Tiles/FurnitureStratus/StratusCandle.cs | 8 +- Tiles/FurnitureStratus/StratusChair.cs | 2 +- Tiles/FurnitureStratus/StratusChandelier.cs | 4 +- Tiles/FurnitureStratus/StratusChest.cs | 4 +- Tiles/FurnitureStratus/StratusClock.cs | 4 +- Tiles/FurnitureStratus/StratusDoorClosed.cs | 2 +- Tiles/FurnitureStratus/StratusDoorOpen.cs | 2 +- Tiles/FurnitureStratus/StratusDresser.cs | 4 +- Tiles/FurnitureStratus/StratusLamp.cs | 4 +- Tiles/FurnitureStratus/StratusLantern.cs | 4 +- Tiles/FurnitureStratus/StratusPiano.cs | 2 +- Tiles/FurnitureStratus/StratusPlatform.cs | 8 +- Tiles/FurnitureStratus/StratusSink.cs | 2 +- Tiles/FurnitureStratus/StratusSofa.cs | 2 +- Tiles/FurnitureStratus/StratusStarPlatform.cs | 8 +- Tiles/FurnitureStratus/StratusTable.cs | 2 +- Tiles/FurnitureStratus/StratusWorkbench.cs | 2 +- Tiles/FurnitureVoid/SmoothVoidstone.cs | 8 +- .../FurnitureVoid/SmoothVoidstonePlatform.cs | 2 +- Tiles/FurnitureVoid/VoidBath.cs | 2 +- Tiles/FurnitureVoid/VoidBed.cs | 4 +- Tiles/FurnitureVoid/VoidBookcase.cs | 2 +- Tiles/FurnitureVoid/VoidCandelabra.cs | 4 +- Tiles/FurnitureVoid/VoidCandle.cs | 6 +- Tiles/FurnitureVoid/VoidChair.cs | 2 +- Tiles/FurnitureVoid/VoidChandelier.cs | 4 +- Tiles/FurnitureVoid/VoidChest.cs | 4 +- Tiles/FurnitureVoid/VoidClock.cs | 4 +- Tiles/FurnitureVoid/VoidDoorClosed.cs | 2 +- Tiles/FurnitureVoid/VoidDoorOpen.cs | 2 +- Tiles/FurnitureVoid/VoidDresser.cs | 4 +- Tiles/FurnitureVoid/VoidLamp.cs | 4 +- Tiles/FurnitureVoid/VoidLantern.cs | 4 +- Tiles/FurnitureVoid/VoidPiano.cs | 2 +- Tiles/FurnitureVoid/VoidSink.cs | 2 +- Tiles/FurnitureVoid/VoidSofa.cs | 2 +- Tiles/FurnitureVoid/VoidTable.cs | 2 +- Tiles/FurnitureVoid/VoidWorkbench.cs | 2 +- Tiles/FurnitureVoid/VoidstoneSlab.cs | 10 +- .../LivingBrimstoneFireBlockTile.cs | 6 +- .../LivingGodSlayerFireBlockTile.cs | 6 +- Tiles/LivingFire/LivingHolyFireBlockTile.cs | 6 +- Tiles/MonsterBanner.cs | 4 +- Tiles/Ores/AerialiteOre.cs | 2 +- Tiles/Ores/AstralOre.cs | 2 +- Tiles/Ores/AuricOre.cs | 2 +- Tiles/Ores/ChaoticOre.cs | 8 +- Tiles/Ores/CharredOre.cs | 2 +- Tiles/Ores/CryonicOre.cs | 2 +- Tiles/Ores/ExodiumOre.cs | 2 +- Tiles/Ores/HallowedOre.cs | 2 +- Tiles/Ores/PerennialOre.cs | 2 +- Tiles/Ores/UelibloomOre.cs | 2 +- Tiles/PerennialBar.cs | 2 +- Tiles/PerennialBrick.cs | 2 +- Tiles/PlacedRock.cs | 6 +- Tiles/Plates/Chaosplate.cs | 10 +- Tiles/Plates/Cinderplate.cs | 10 +- Tiles/Plates/Elumplate.cs | 10 +- Tiles/Plates/Navyplate.cs | 10 +- Tiles/Plates/PlagueContainmentCells.cs | 10 +- Tiles/RoxTile.cs | 2 +- Tiles/ShadowspecBarTile.cs | 2 +- Tiles/SunkenSea/BrainCoral.cs | 2 +- Tiles/SunkenSea/EutrophicSand.cs | 2 +- Tiles/SunkenSea/FanCoral.cs | 2 +- Tiles/SunkenSea/Navystone.cs | 2 +- Tiles/SunkenSea/SeaAnemone.cs | 2 +- Tiles/SunkenSea/SeaPrism.cs | 2 +- Tiles/SunkenSea/SeaPrismCrystals.cs | 20 +- Tiles/SunkenSea/SmallBrainCoral.cs | 2 +- Tiles/SunkenSea/SmallTubeCoral.cs | 2 +- Tiles/SunkenSea/SunkenCrateTile.cs | 2 +- Tiles/SunkenSea/SunkenSeaStalactite.cs | 6 +- Tiles/SunkenSea/TableCoral.cs | 2 +- Tiles/SunkenSea/TubeCoral.cs | 2 +- Tiles/UelibloomBar.cs | 2 +- Tiles/UelibloomBrick.cs | 10 +- UI/AcidRainUI.cs | 2 +- UI/AstralArcanumUI.cs | 7 +- UI/BossRushUI.cs | 2 +- .../CalamitasEnchantUI.cs | 35 +- UI/ChargeMeterUI.cs | 4 +- UI/ChargingStationUI.cs | 9 +- UI/CodebreakerUI.cs | 49 +- UI/DefenseDamageDisplayUI.cs | 4 +- UI/DraedonLogHellGUI.cs | 6 +- UI/DraedonLogJungleGUI.cs | 6 +- UI/DraedonLogPlanetoidGUI.cs | 4 +- UI/DraedonLogSnowBiomeGUI.cs | 4 +- UI/DraedonLogSunkenSeaGUI.cs | 6 +- UI/DraedonsLogGUI.cs | 8 +- UI/EnchantmentMetersUI.cs | 4 +- UI/ExoMechSelectionUI.cs | 6 +- UI/LabHologramProjectorUI.cs | 3 +- UI/ModeIndicatorUI.cs | 2 +- UI/PowerCellFactoryUI.cs | 5 +- UI/RipperUI.cs | 26 +- UI/StealthUI.cs | 8 +- Utilities/CalamityRecipes.cs | 122 +- Utilities/CollisionUtils.cs | 2 +- Utilities/DrawingUtils.cs | 4 +- Utilities/FurnitureSetupUtils.cs | 69 +- Utilities/GenericAIUtils.cs | 6 +- Utilities/ItemUtils.cs | 5 +- Utilities/PlayerUtils.cs | 16 +- Utilities/ProjectileUtils.cs | 18 +- Utilities/TileEntityUtils.cs | 9 +- Utilities/TileFraming.cs | 510 ++-- Utilities/TileUtils.cs | 32 +- Utilities/WorldgenUtils.cs | 2 +- Walls/AbyssGravelWall.cs | 2 +- Walls/AbyssGravelWallSafe.cs | 2 +- Walls/AerialiteBrickWall.cs | 2 +- Walls/AshenSlabWall.cs | 4 +- Walls/AstralBrickWall.cs | 2 +- Walls/AstralDirtWall.cs | 2 +- Walls/AstralDirtWallSafe.cs | 2 +- Walls/AstralFossilWall.cs | 2 +- Walls/AstralGrassWall.cs | 2 +- Walls/AstralIceWall.cs | 2 +- Walls/AstralIceWallSafe.cs | 2 +- Walls/AstralMonolithWall.cs | 4 +- Walls/AstralSandstoneWall.cs | 2 +- Walls/AstralSandstoneWallSafe.cs | 2 +- Walls/AstralSnowWall.cs | 2 +- Walls/AstralSnowWallSafe.cs | 2 +- Walls/AstralStoneWall.cs | 2 +- Walls/AstralStoneWallSafe.cs | 2 +- Walls/BrimstoneSlagWall.cs | 4 +- Walls/BrimstoneSlagWallUnsafe.cs | 4 +- Walls/ChaosplateWall.cs | 2 +- Walls/ChaoticBrickWall.cs | 2 +- Walls/CinderplateWall.cs | 2 +- Walls/CosmiliteBrickWall.cs | 2 +- Walls/CryonicBrickWall.cs | 4 +- Walls/DraedonStructures/HazardChevronWall.cs | 2 +- .../DraedonStructures/LaboratoryPanelWall.cs | 2 +- .../DraedonStructures/LaboratoryPlateBeam.cs | 2 +- .../LaboratoryPlatePillar.cs | 2 +- .../LaboratoryPlatingWall.cs | 2 +- Walls/DraedonStructures/RustedPlateBeam.cs | 2 +- Walls/DraedonStructures/RustedPlatePillar.cs | 2 +- Walls/DraedonStructures/RustedPlatingWall.cs | 2 +- Walls/ElumplateWall.cs | 2 +- Walls/EutrophicSandWall.cs | 2 +- Walls/EutrophicSandWallSafe.cs | 2 +- Walls/ExoPlatingWall.cs | 2 +- Walls/ExoPrismPanelWall.cs | 2 +- Walls/HardenedAstralSandWall.cs | 2 +- Walls/HardenedAstralSandWallSafe.cs | 2 +- Walls/HardenedSulphurousSandstoneWall.cs | 2 +- Walls/NavyplateWall.cs | 2 +- Walls/NavystoneWall.cs | 2 +- Walls/NavystoneWallSafe.cs | 2 +- Walls/OccultStoneWall.cs | 2 +- Walls/PerennialBrickWall.cs | 4 +- Walls/PlagueContainmentCellsWall.cs | 2 +- Walls/PlaguedPlateWall.cs | 2 +- Walls/ProfanedCrystalWall.cs | 2 +- Walls/ProfanedRockWall.cs | 2 +- Walls/ProfanedSlabWall.cs | 4 +- Walls/RunicProfanedBrickWall.cs | 4 +- Walls/SilvaWall.cs | 2 +- Walls/SmoothAbyssGravelWall.cs | 2 +- Walls/SmoothBrimstoneSlagWall.cs | 2 +- Walls/SmoothNavystoneWall.cs | 2 +- Walls/SmoothVoidstoneWall.cs | 2 +- Walls/StatigelWall.cs | 2 +- Walls/StratusWall.cs | 2 +- Walls/SulphurousSandWall.cs | 2 +- Walls/SulphurousSandWallSafe.cs | 2 +- Walls/SulphurousSandstoneWall.cs | 2 +- Walls/SulphurousSandstoneWallSafe.cs | 2 +- Walls/UelibloomBrickWall.cs | 2 +- Walls/VoidstoneSlabWall.cs | 4 +- Walls/VoidstoneWall.cs | 2 +- Walls/VoidstoneWallUnsafe.cs | 2 +- Waters/AbyssWater.cs | 2 +- Waters/AstralWater.cs | 4 +- Waters/CustomLavaManagement.cs | 4 +- Waters/CustomLavaStyle.cs | 4 +- Waters/SulphuricWater.cs | 2 +- Waters/SunkenSeaWater.cs | 2 +- World/Abyss.cs | 142 +- World/AstralBiome.cs | 248 +- World/CalamityWorld.cs | 12 +- World/CustomActions.cs | 4 +- World/CustomConditions.cs | 4 +- World/CustomShapes.cs | 2 +- World/CustomTemple.cs | 84 +- World/DraedonStructures.cs | 30 +- World/MiscWorldgenRoutines.cs | 64 +- World/Planets/GrassPlanet.cs | 2 +- World/Planets/HeartPlanet.cs | 2 +- World/Planets/LuminitePlanet.cs | 2 +- World/Planets/LuminitePlanet2.cs | 2 +- World/Planets/MainPlanet.cs | 2 +- World/Planets/MudPlanet.cs | 2 +- World/Planets/Planetoid.cs | 6 +- World/SulphurousSea.cs | 78 +- World/SunkenSea.cs | 86 +- World/UndergroundShrines.cs | 28 +- World/WorldEvilIsland.cs | 32 +- World/WorldUpdateMiscEffects.cs | 36 +- 5539 files changed, 121268 insertions(+), 129358 deletions(-) diff --git a/Backgrounds/AstralDesertSurfaceBGStyle.cs b/Backgrounds/AstralDesertSurfaceBGStyle.cs index d47afe4f29..dae07c8cf8 100644 --- a/Backgrounds/AstralDesertSurfaceBGStyle.cs +++ b/Backgrounds/AstralDesertSurfaceBGStyle.cs @@ -5,14 +5,14 @@ namespace CalamityMod.Backgrounds { public class AstralDesertSurfaceBGStyle : ModSurfaceBgStyle { - public override int ChooseFarTexture() => mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceFar"); + public override int ChooseFarTexture() => Mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceFar"); - public override int ChooseMiddleTexture() => mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceMiddle"); + public override int ChooseMiddleTexture() => Mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceMiddle"); public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) { b -= 75f; - return mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceClose"); + return Mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceClose"); } public override bool ChooseBgStyle() => !Main.gameMenu && Main.LocalPlayer.InAstral() && Main.LocalPlayer.ZoneDesert; diff --git a/Backgrounds/AstralSnowSurfaceBGStyle.cs b/Backgrounds/AstralSnowSurfaceBGStyle.cs index e6277edd5a..f56f360a81 100644 --- a/Backgrounds/AstralSnowSurfaceBGStyle.cs +++ b/Backgrounds/AstralSnowSurfaceBGStyle.cs @@ -5,11 +5,11 @@ namespace CalamityMod.Backgrounds { public class AstralSnowSurfaceBGStyle : ModSurfaceBgStyle { - public override int ChooseFarTexture() => mod.GetBackgroundSlot("Backgrounds/AstralSnowSurfaceFar"); + public override int ChooseFarTexture() => Mod.GetBackgroundSlot("Backgrounds/AstralSnowSurfaceFar"); - public override int ChooseMiddleTexture() => mod.GetBackgroundSlot("Backgrounds/AstralSnowSurfaceMiddle"); + public override int ChooseMiddleTexture() => Mod.GetBackgroundSlot("Backgrounds/AstralSnowSurfaceMiddle"); - public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) => mod.GetBackgroundSlot("Backgrounds/AstralSurfaceClose"); + public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) => Mod.GetBackgroundSlot("Backgrounds/AstralSurfaceClose"); public override bool ChooseBgStyle() => !Main.gameMenu && Main.LocalPlayer.InAstral() && Main.LocalPlayer.ZoneSnow; diff --git a/Backgrounds/AstralSurfaceBGStyle.cs b/Backgrounds/AstralSurfaceBGStyle.cs index 338b92d53f..45632d5d2f 100644 --- a/Backgrounds/AstralSurfaceBGStyle.cs +++ b/Backgrounds/AstralSurfaceBGStyle.cs @@ -5,14 +5,14 @@ namespace CalamityMod.Backgrounds { public class AstralSurfaceBGStyle : ModSurfaceBgStyle { - public override int ChooseFarTexture() => mod.GetBackgroundSlot("Backgrounds/AstralSurfaceFar"); + public override int ChooseFarTexture() => Mod.GetBackgroundSlot("Backgrounds/AstralSurfaceFar"); - public override int ChooseMiddleTexture() => mod.GetBackgroundSlot("Backgrounds/AstralSurfaceMiddle"); + public override int ChooseMiddleTexture() => Mod.GetBackgroundSlot("Backgrounds/AstralSurfaceMiddle"); public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) { scale *= 0.75f; - return mod.GetBackgroundSlot("Backgrounds/AstralSurfaceClose"); + return Mod.GetBackgroundSlot("Backgrounds/AstralSurfaceClose"); } public override bool ChooseBgStyle() => !Main.gameMenu && Main.LocalPlayer.InAstral() && !Main.LocalPlayer.ZoneDesert && !Main.LocalPlayer.ZoneSnow; diff --git a/Backgrounds/AstralUndergroundBGStyle.cs b/Backgrounds/AstralUndergroundBGStyle.cs index 23f177f5c4..f4c558c716 100644 --- a/Backgrounds/AstralUndergroundBGStyle.cs +++ b/Backgrounds/AstralUndergroundBGStyle.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Backgrounds { for (int i = 0; i <= 3; i++) { - textureSlots[i] = mod.GetBackgroundSlot("Backgrounds/AstralUG" + i.ToString()); + textureSlots[i] = Mod.GetBackgroundSlot("Backgrounds/AstralUG" + i.ToString()); } } } diff --git a/Backgrounds/SulphurSeaSurfaceBGStyle.cs b/Backgrounds/SulphurSeaSurfaceBGStyle.cs index 43c07e7b1a..6893e0734d 100644 --- a/Backgrounds/SulphurSeaSurfaceBGStyle.cs +++ b/Backgrounds/SulphurSeaSurfaceBGStyle.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Backgrounds public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) { b -= 250f; - return mod.GetBackgroundSlot("Backgrounds/SulphurSeaSurfaceClose"); + return Mod.GetBackgroundSlot("Backgrounds/SulphurSeaSurfaceClose"); } public override bool ChooseBgStyle() => !Main.gameMenu && Main.LocalPlayer.InSulphur(); diff --git a/Buffs/Alcohol/AlcoholPoisoning.cs b/Buffs/Alcohol/AlcoholPoisoning.cs index 59e6e2dcc3..840fd0657b 100644 --- a/Buffs/Alcohol/AlcoholPoisoning.cs +++ b/Buffs/Alcohol/AlcoholPoisoning.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class AlcoholPoisoning : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Alcohol Poisoning"); Description.SetDefault("You drank too much and you are now dying"); diff --git a/Buffs/Alcohol/BloodyMaryBuff.cs b/Buffs/Alcohol/BloodyMaryBuff.cs index 3b24a8627d..41a3a96c9d 100644 --- a/Buffs/Alcohol/BloodyMaryBuff.cs +++ b/Buffs/Alcohol/BloodyMaryBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class BloodyMaryBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Bloody Mary"); Description.SetDefault("Damage, critical strike chance, movement speed, and melee speed boosted during a Blood Moon, life regen and defense reduced"); diff --git a/Buffs/Alcohol/CaribbeanRumBuff.cs b/Buffs/Alcohol/CaribbeanRumBuff.cs index e9146ba1a2..ce0abb377c 100644 --- a/Buffs/Alcohol/CaribbeanRumBuff.cs +++ b/Buffs/Alcohol/CaribbeanRumBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class CaribbeanRumBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Caribbean Rum"); Description.SetDefault("Life regen, movement speed, and wing flight time boosted, you are floaty and defense is reduced"); diff --git a/Buffs/Alcohol/CinnamonRollBuff.cs b/Buffs/Alcohol/CinnamonRollBuff.cs index 734ffd5622..5039e20f12 100644 --- a/Buffs/Alcohol/CinnamonRollBuff.cs +++ b/Buffs/Alcohol/CinnamonRollBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class CinnamonRollBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Cinnamon Roll"); Description.SetDefault("Mana regen rate and fire debuff damage boosted, defense reduced"); diff --git a/Buffs/Alcohol/EverclearBuff.cs b/Buffs/Alcohol/EverclearBuff.cs index 113c9d4282..90fb246963 100644 --- a/Buffs/Alcohol/EverclearBuff.cs +++ b/Buffs/Alcohol/EverclearBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class EverclearBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Everclear"); Description.SetDefault("Damage boosted, life regen and defense reduced"); diff --git a/Buffs/Alcohol/EvergreenGinBuff.cs b/Buffs/Alcohol/EvergreenGinBuff.cs index af8998adff..d2dc790954 100644 --- a/Buffs/Alcohol/EvergreenGinBuff.cs +++ b/Buffs/Alcohol/EvergreenGinBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class EvergreenGinBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Evergreen Gin"); Description.SetDefault("Sickness and water debuff damage and damage reduction boosted, life regen reduced"); diff --git a/Buffs/Alcohol/FabsolVodkaBuff.cs b/Buffs/Alcohol/FabsolVodkaBuff.cs index afd6016e98..be7fe9885c 100644 --- a/Buffs/Alcohol/FabsolVodkaBuff.cs +++ b/Buffs/Alcohol/FabsolVodkaBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class FabsolVodkaBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Fab"); Description.SetDefault("You feel fabulous"); diff --git a/Buffs/Alcohol/FireballBuff.cs b/Buffs/Alcohol/FireballBuff.cs index 9dfd95e01d..6f99457fb1 100644 --- a/Buffs/Alcohol/FireballBuff.cs +++ b/Buffs/Alcohol/FireballBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class FireballBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Fireball"); Description.SetDefault("Fire debuff damage boosted, life regen reduced"); diff --git a/Buffs/Alcohol/GrapeBeerBuff.cs b/Buffs/Alcohol/GrapeBeerBuff.cs index d0e6f64c81..e73d984c0c 100644 --- a/Buffs/Alcohol/GrapeBeerBuff.cs +++ b/Buffs/Alcohol/GrapeBeerBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class GrapeBeerBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Grape Beer"); Description.SetDefault("Defense and movement speed reduced"); diff --git a/Buffs/Alcohol/MargaritaBuff.cs b/Buffs/Alcohol/MargaritaBuff.cs index 16490e0b55..ef8b4803f5 100644 --- a/Buffs/Alcohol/MargaritaBuff.cs +++ b/Buffs/Alcohol/MargaritaBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class MargaritaBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Margarita"); Description.SetDefault("Reduced duration to most debuffs, defense and life regen reduced"); diff --git a/Buffs/Alcohol/MoonshineBuff.cs b/Buffs/Alcohol/MoonshineBuff.cs index 9fe7a24fcd..203b2b52aa 100644 --- a/Buffs/Alcohol/MoonshineBuff.cs +++ b/Buffs/Alcohol/MoonshineBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class MoonshineBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Moonshine"); Description.SetDefault("Defense and damage reduction boosted, life regen reduced"); diff --git a/Buffs/Alcohol/MoscowMuleBuff.cs b/Buffs/Alcohol/MoscowMuleBuff.cs index f9d0c793fe..c8d75ca3d7 100644 --- a/Buffs/Alcohol/MoscowMuleBuff.cs +++ b/Buffs/Alcohol/MoscowMuleBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class MoscowMuleBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Moscow Mule"); Description.SetDefault("Damage, critical strike chance, and knockback boosted, life regen reduced"); diff --git a/Buffs/Alcohol/RedWineBuff.cs b/Buffs/Alcohol/RedWineBuff.cs index 7c88708840..5a180e9489 100644 --- a/Buffs/Alcohol/RedWineBuff.cs +++ b/Buffs/Alcohol/RedWineBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class RedWineBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Red Wine"); Description.SetDefault("Life regen reduced"); diff --git a/Buffs/Alcohol/RumBuff.cs b/Buffs/Alcohol/RumBuff.cs index 2757bb9681..dc429dee1a 100644 --- a/Buffs/Alcohol/RumBuff.cs +++ b/Buffs/Alcohol/RumBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class RumBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Rum"); Description.SetDefault("Movement speed and life regen boosted, defense reduced"); diff --git a/Buffs/Alcohol/ScrewdriverBuff.cs b/Buffs/Alcohol/ScrewdriverBuff.cs index d625aa2584..bff3229b41 100644 --- a/Buffs/Alcohol/ScrewdriverBuff.cs +++ b/Buffs/Alcohol/ScrewdriverBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class ScrewdriverBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Screwdriver"); Description.SetDefault("Piercing projectile damage boosted, life regen reduced"); diff --git a/Buffs/Alcohol/StarBeamRyeBuff.cs b/Buffs/Alcohol/StarBeamRyeBuff.cs index f1dd542182..ac89226225 100644 --- a/Buffs/Alcohol/StarBeamRyeBuff.cs +++ b/Buffs/Alcohol/StarBeamRyeBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class StarBeamRyeBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Star Beam Rye"); Description.SetDefault("Max mana and magic damage increased. Defense, mana usage, and life regen reduced"); diff --git a/Buffs/Alcohol/TequilaBuff.cs b/Buffs/Alcohol/TequilaBuff.cs index 15355206bd..f6a371a740 100644 --- a/Buffs/Alcohol/TequilaBuff.cs +++ b/Buffs/Alcohol/TequilaBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class TequilaBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Tequila"); Description.SetDefault("Damage, critical strike chance, damage reduction, defense, and knockback boosted during daytime, life regen reduced"); diff --git a/Buffs/Alcohol/TequilaSunriseBuff.cs b/Buffs/Alcohol/TequilaSunriseBuff.cs index 325f40f1b1..d7dec2b348 100644 --- a/Buffs/Alcohol/TequilaSunriseBuff.cs +++ b/Buffs/Alcohol/TequilaSunriseBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class TequilaSunriseBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Tequila Sunrise"); Description.SetDefault("Damage, critical strike chance, damage reduction, defense, and knockback boosted during daytime, life regen reduced"); diff --git a/Buffs/Alcohol/Trippy.cs b/Buffs/Alcohol/Trippy.cs index b536f08765..f7535b8e98 100644 --- a/Buffs/Alcohol/Trippy.cs +++ b/Buffs/Alcohol/Trippy.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class Trippy : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Trippy"); Description.SetDefault("You see the world for what it truly is... and you also have a 50% increase to all damage"); diff --git a/Buffs/Alcohol/VodkaBuff.cs b/Buffs/Alcohol/VodkaBuff.cs index 89b12cf0e8..1d76b24338 100644 --- a/Buffs/Alcohol/VodkaBuff.cs +++ b/Buffs/Alcohol/VodkaBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class VodkaBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Vodka"); Description.SetDefault("Damage and critical stike chance boosted, defense and life regen reduced"); diff --git a/Buffs/Alcohol/WhiskeyBuff.cs b/Buffs/Alcohol/WhiskeyBuff.cs index 3b673d0f92..a392c53bb3 100644 --- a/Buffs/Alcohol/WhiskeyBuff.cs +++ b/Buffs/Alcohol/WhiskeyBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class WhiskeyBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Whiskey"); Description.SetDefault("Damage, critical strike chance, and knockback boosted, defense reduced"); diff --git a/Buffs/Alcohol/WhiteWineBuff.cs b/Buffs/Alcohol/WhiteWineBuff.cs index f1b72fcbed..05ebabb36f 100644 --- a/Buffs/Alcohol/WhiteWineBuff.cs +++ b/Buffs/Alcohol/WhiteWineBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Alcohol { public class WhiteWineBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("White Wine"); Description.SetDefault("Magic damage boosted, life regen and defense reduced"); diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 13b236904d..cb3c535c68 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs } else if (type == BuffID.MagicPower) { - player.magicDamage -= 0.1f; + player.GetDamage(DamageClass.Magic) -= 0.1f; } else if (type == BuffID.Panic) { diff --git a/Buffs/Cooldowns/Withered.cs b/Buffs/Cooldowns/Withered.cs index 5a68168394..647cc8939d 100644 --- a/Buffs/Cooldowns/Withered.cs +++ b/Buffs/Cooldowns/Withered.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Cooldowns { public class Withered : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Withered"); Description.SetDefault("Holding withered weapons causes you to suffer but makes your weapons strong"); diff --git a/Buffs/DamageOverTime/AbyssalFlames.cs b/Buffs/DamageOverTime/AbyssalFlames.cs index 8cd81ba6cb..01517d5d44 100644 --- a/Buffs/DamageOverTime/AbyssalFlames.cs +++ b/Buffs/DamageOverTime/AbyssalFlames.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class AbyssalFlames : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Abyssal Flames"); Description.SetDefault("Your soul is being consumed"); diff --git a/Buffs/DamageOverTime/AstralInfectionDebuff.cs b/Buffs/DamageOverTime/AstralInfectionDebuff.cs index 51e67816d5..20e9f027fa 100644 --- a/Buffs/DamageOverTime/AstralInfectionDebuff.cs +++ b/Buffs/DamageOverTime/AstralInfectionDebuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class AstralInfectionDebuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Infection"); Description.SetDefault("Your flesh is melting off"); diff --git a/Buffs/DamageOverTime/BanishingFire.cs b/Buffs/DamageOverTime/BanishingFire.cs index 1e182ef7b7..79ceb0ed40 100644 --- a/Buffs/DamageOverTime/BanishingFire.cs +++ b/Buffs/DamageOverTime/BanishingFire.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class BanishingFire : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Banishing Fire"); Description.SetDefault("You shall not be forgiven for your sins"); diff --git a/Buffs/DamageOverTime/BrimstoneFlames.cs b/Buffs/DamageOverTime/BrimstoneFlames.cs index d14a428d97..ca4031aaa9 100644 --- a/Buffs/DamageOverTime/BrimstoneFlames.cs +++ b/Buffs/DamageOverTime/BrimstoneFlames.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class BrimstoneFlames : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Flames"); Description.SetDefault("Rapid health loss"); diff --git a/Buffs/DamageOverTime/BurningBlood.cs b/Buffs/DamageOverTime/BurningBlood.cs index 6db18910e3..67f35c647f 100644 --- a/Buffs/DamageOverTime/BurningBlood.cs +++ b/Buffs/DamageOverTime/BurningBlood.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class BurningBlood : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Burning Blood"); Description.SetDefault("Your blood is on fire"); diff --git a/Buffs/DamageOverTime/CragsLava.cs b/Buffs/DamageOverTime/CragsLava.cs index 1cb28d6d16..96507e9e3a 100644 --- a/Buffs/DamageOverTime/CragsLava.cs +++ b/Buffs/DamageOverTime/CragsLava.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class CragsLava : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Searing Lava"); Description.SetDefault("The brimstone lava sears your flesh"); diff --git a/Buffs/DamageOverTime/CrushDepth.cs b/Buffs/DamageOverTime/CrushDepth.cs index 120f031ca3..621a35e032 100644 --- a/Buffs/DamageOverTime/CrushDepth.cs +++ b/Buffs/DamageOverTime/CrushDepth.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class CrushDepth : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Crush Depth"); Description.SetDefault("Aquatic pressure"); diff --git a/Buffs/DamageOverTime/DemonFlames.cs b/Buffs/DamageOverTime/DemonFlames.cs index 1ccf79aa9e..d609d1a7ee 100644 --- a/Buffs/DamageOverTime/DemonFlames.cs +++ b/Buffs/DamageOverTime/DemonFlames.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class DemonFlames : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Demon Flames"); Description.SetDefault("Another burning debuff"); diff --git a/Buffs/DamageOverTime/GodSlayerInferno.cs b/Buffs/DamageOverTime/GodSlayerInferno.cs index 89c97ee4ef..eae53ed25d 100644 --- a/Buffs/DamageOverTime/GodSlayerInferno.cs +++ b/Buffs/DamageOverTime/GodSlayerInferno.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class GodSlayerInferno : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("God Slayer Inferno"); Description.SetDefault("Your flesh is burning off"); diff --git a/Buffs/DamageOverTime/HeavyBleeding.cs b/Buffs/DamageOverTime/HeavyBleeding.cs index e44fb8e344..9e78e3db3a 100644 --- a/Buffs/DamageOverTime/HeavyBleeding.cs +++ b/Buffs/DamageOverTime/HeavyBleeding.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class HeavyBleeding : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Heavy Bleeding"); Description.SetDefault("You're losing a lot of blood"); diff --git a/Buffs/DamageOverTime/HolyFlames.cs b/Buffs/DamageOverTime/HolyFlames.cs index 0774575b57..94d84b6a56 100644 --- a/Buffs/DamageOverTime/HolyFlames.cs +++ b/Buffs/DamageOverTime/HolyFlames.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class HolyFlames : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Flames"); Description.SetDefault("Dissolving from holy light"); diff --git a/Buffs/DamageOverTime/HolyInferno.cs b/Buffs/DamageOverTime/HolyInferno.cs index 6581fa159d..8c9dbd4049 100644 --- a/Buffs/DamageOverTime/HolyInferno.cs +++ b/Buffs/DamageOverTime/HolyInferno.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class HolyInferno : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Inferno"); Description.SetDefault("You've gone too far from the Profaned Goddess!"); diff --git a/Buffs/DamageOverTime/LethalLavaBurn.cs b/Buffs/DamageOverTime/LethalLavaBurn.cs index d6d40e5f09..a579bb4556 100644 --- a/Buffs/DamageOverTime/LethalLavaBurn.cs +++ b/Buffs/DamageOverTime/LethalLavaBurn.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class LethalLavaBurn : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Dragon Fire"); Description.SetDefault("Losing life, reduced movement speed"); diff --git a/Buffs/DamageOverTime/ManaBurn.cs b/Buffs/DamageOverTime/ManaBurn.cs index 1be76f5df5..5e1121642f 100644 --- a/Buffs/DamageOverTime/ManaBurn.cs +++ b/Buffs/DamageOverTime/ManaBurn.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class ManaBurn : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Mana Burn"); Description.SetDefault("The excess of mana sears your body and mind"); diff --git a/Buffs/DamageOverTime/Nightwither.cs b/Buffs/DamageOverTime/Nightwither.cs index d7563521f5..1bb7a7da04 100644 --- a/Buffs/DamageOverTime/Nightwither.cs +++ b/Buffs/DamageOverTime/Nightwither.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class Nightwither : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Nightwither"); Description.SetDefault("Incinerated by lunar rays"); diff --git a/Buffs/DamageOverTime/Plague.cs b/Buffs/DamageOverTime/Plague.cs index dd95c370bc..529d82ec8f 100644 --- a/Buffs/DamageOverTime/Plague.cs +++ b/Buffs/DamageOverTime/Plague.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class Plague : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Plague"); Description.SetDefault("Rotting from the inside"); diff --git a/Buffs/DamageOverTime/SagePoison.cs b/Buffs/DamageOverTime/SagePoison.cs index b1763d9e41..94a8f52a72 100644 --- a/Buffs/DamageOverTime/SagePoison.cs +++ b/Buffs/DamageOverTime/SagePoison.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class SagePoison : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Sage Poison"); Description.SetDefault("Poisoned"); diff --git a/Buffs/DamageOverTime/Shadowflame.cs b/Buffs/DamageOverTime/Shadowflame.cs index c752b86b3b..f89386d6dc 100644 --- a/Buffs/DamageOverTime/Shadowflame.cs +++ b/Buffs/DamageOverTime/Shadowflame.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class Shadowflame : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Shadowflame"); Description.SetDefault("Losing life"); diff --git a/Buffs/DamageOverTime/ShellfishEating.cs b/Buffs/DamageOverTime/ShellfishEating.cs index e3a16ae5c7..c0c2c323db 100644 --- a/Buffs/DamageOverTime/ShellfishEating.cs +++ b/Buffs/DamageOverTime/ShellfishEating.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class ShellfishEating : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Shellfish Claps"); Description.SetDefault("Clamfest"); diff --git a/Buffs/DamageOverTime/Shred.cs b/Buffs/DamageOverTime/Shred.cs index 191ab15d18..2f3ae95e43 100644 --- a/Buffs/DamageOverTime/Shred.cs +++ b/Buffs/DamageOverTime/Shred.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Buffs.DamageOverTime internal static int BaseDamage = 15; internal static int FramesPerDamageTick = 12; - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Shred"); Description.SetDefault("Someone built ten Tri-Tip Daggers..."); @@ -60,9 +60,9 @@ namespace CalamityMod.Buffs.DamageOverTime // Only deal damage once every several frames. if (applicator.miscCounter % FramesPerDamageTick == 0) { - int dmg = (int)(BaseDamage * cgn.somaShredStacks * applicator.rangedDamage); + int dmg = (int)(BaseDamage * cgn.somaShredStacks * applicator.GetDamage(DamageClass.Ranged)); Projectile tick = Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ModContent.ProjectileType(), dmg, 0f, applicator.whoAmI, target.whoAmI); - tick.ranged = true; // Uncommon for DirectStrikes, but it needs to be able to crit. + tick.DamageType = DamageClass.Ranged; // Uncommon for DirectStrikes, but it needs to be able to crit. tick.Calamity().canSupercrit = true; } } diff --git a/Buffs/DamageOverTime/SnapClamDebuff.cs b/Buffs/DamageOverTime/SnapClamDebuff.cs index c7049a673a..a94f55b028 100644 --- a/Buffs/DamageOverTime/SnapClamDebuff.cs +++ b/Buffs/DamageOverTime/SnapClamDebuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class SnapClamDebuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Clammed"); Description.SetDefault("Clam clap"); diff --git a/Buffs/DamageOverTime/SulphuricPoisoning.cs b/Buffs/DamageOverTime/SulphuricPoisoning.cs index 9868b44a29..04ea5fde5a 100644 --- a/Buffs/DamageOverTime/SulphuricPoisoning.cs +++ b/Buffs/DamageOverTime/SulphuricPoisoning.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class SulphuricPoisoning : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphuric Poisoning"); Description.SetDefault("The acidic water burns away your flesh"); diff --git a/Buffs/DamageOverTime/Vaporfied.cs b/Buffs/DamageOverTime/Vaporfied.cs index 29e3cbfc39..4a41b2d2a7 100644 --- a/Buffs/DamageOverTime/Vaporfied.cs +++ b/Buffs/DamageOverTime/Vaporfied.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class Vaporfied : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Vaporfied"); Description.SetDefault("Vape"); diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index c7a9bbab20..b4c65a286f 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Buffs.DamageOverTime public const int CalamityDuration = 24; public const int AflameDuration = 120; - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Vulnerability Hex"); Description.SetDefault("You are weak"); diff --git a/Buffs/DamageOverTime/WeakBrimstoneFlames.cs b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs index edf6f12830..c6256e514f 100644 --- a/Buffs/DamageOverTime/WeakBrimstoneFlames.cs +++ b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.DamageOverTime { public class WeakBrimstoneFlames : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Weak Brimstone Flames"); Description.SetDefault("Health loss"); diff --git a/Buffs/Mounts/AlicornBuff.cs b/Buffs/Mounts/AlicornBuff.cs index ccd207a64c..4985c06d66 100644 --- a/Buffs/Mounts/AlicornBuff.cs +++ b/Buffs/Mounts/AlicornBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Mounts { public class AlicornBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Alicorn"); Description.SetDefault("You beat DoG while drunk, you are truly fabulous!"); diff --git a/Buffs/Mounts/AndromedaBuff.cs b/Buffs/Mounts/AndromedaBuff.cs index 87e673f814..623f7a880f 100644 --- a/Buffs/Mounts/AndromedaBuff.cs +++ b/Buffs/Mounts/AndromedaBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Mounts { public class AndromedaBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Andromeda"); Description.SetDefault("You're controlling a piece of history"); diff --git a/Buffs/Mounts/AndromedaSmallBuff.cs b/Buffs/Mounts/AndromedaSmallBuff.cs index 72856d744f..190dcb5f71 100644 --- a/Buffs/Mounts/AndromedaSmallBuff.cs +++ b/Buffs/Mounts/AndromedaSmallBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Mounts { public class AndromedaSmallBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Andromeda"); Description.SetDefault("You're controlling a small piece of history"); diff --git a/Buffs/Mounts/BrimstoneMount.cs b/Buffs/Mounts/BrimstoneMount.cs index 0bf69688ab..3487f4ad2a 100644 --- a/Buffs/Mounts/BrimstoneMount.cs +++ b/Buffs/Mounts/BrimstoneMount.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Mounts { public class BrimstoneMount : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimrose Mount"); Description.SetDefault("The seat is toasty. That is all"); diff --git a/Buffs/Mounts/BumbledogeMount.cs b/Buffs/Mounts/BumbledogeMount.cs index 6275fefc24..fe7c8df140 100644 --- a/Buffs/Mounts/BumbledogeMount.cs +++ b/Buffs/Mounts/BumbledogeMount.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Mounts { public class BumbledogeMount : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Bumbledoge"); Description.SetDefault("Wait a second. That's not right..."); diff --git a/Buffs/Mounts/DoGCartBuff.cs b/Buffs/Mounts/DoGCartBuff.cs index 9e2b5390c1..17354381ad 100644 --- a/Buffs/Mounts/DoGCartBuff.cs +++ b/Buffs/Mounts/DoGCartBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Mounts { public class DoGCartBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Devourer Cart"); Description.SetDefault("Riding a cosmic terror"); diff --git a/Buffs/Mounts/DraedonGamerChairBuff.cs b/Buffs/Mounts/DraedonGamerChairBuff.cs index db7f56cb59..58f670d107 100644 --- a/Buffs/Mounts/DraedonGamerChairBuff.cs +++ b/Buffs/Mounts/DraedonGamerChairBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Mounts { public class DraedonGamerChairBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Exo Chair"); Description.SetDefault("Riding a physics defying gamer chair"); diff --git a/Buffs/Mounts/GazeOfCrysthamyrBuff.cs b/Buffs/Mounts/GazeOfCrysthamyrBuff.cs index da5e3fd2b3..21337226d4 100644 --- a/Buffs/Mounts/GazeOfCrysthamyrBuff.cs +++ b/Buffs/Mounts/GazeOfCrysthamyrBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Mounts { public class GazeOfCrysthamyrBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Gaze of Crysthamyr"); Description.SetDefault("You are riding a shadow dragon"); diff --git a/Buffs/Mounts/OnyxExcavatorBuff.cs b/Buffs/Mounts/OnyxExcavatorBuff.cs index f5ce5a53ce..4ae204899e 100644 --- a/Buffs/Mounts/OnyxExcavatorBuff.cs +++ b/Buffs/Mounts/OnyxExcavatorBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Mounts { public class OnyxExcavatorBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Onyx Excavator"); Description.SetDefault("Drill"); diff --git a/Buffs/Mounts/SquishyBeanBuff.cs b/Buffs/Mounts/SquishyBeanBuff.cs index b912fcdd38..e569f4fad0 100644 --- a/Buffs/Mounts/SquishyBeanBuff.cs +++ b/Buffs/Mounts/SquishyBeanBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Mounts { public class SquishyBeanBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Squishy Bean"); Description.SetDefault("BEAN MAN. BEAN DO T H E B EA N IS HER E"); diff --git a/Buffs/Mounts/TundraLeashBuff.cs b/Buffs/Mounts/TundraLeashBuff.cs index 90fd6205dc..ce5b4908bc 100644 --- a/Buffs/Mounts/TundraLeashBuff.cs +++ b/Buffs/Mounts/TundraLeashBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Mounts { public class TundraLeashBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Angry Dog"); Description.SetDefault("You are riding an angry dog"); diff --git a/Buffs/Pets/AkatoYharonBuff.cs b/Buffs/Pets/AkatoYharonBuff.cs index 123369a3d2..4881dca7e6 100644 --- a/Buffs/Pets/AkatoYharonBuff.cs +++ b/Buffs/Pets/AkatoYharonBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class AkatoYharonBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Akato"); Description.SetDefault("Looks like you'll have to take care of it now"); diff --git a/Buffs/Pets/AstrophageBuff.cs b/Buffs/Pets/AstrophageBuff.cs index c36b06e0e0..2946f400be 100644 --- a/Buffs/Pets/AstrophageBuff.cs +++ b/Buffs/Pets/AstrophageBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class AstrophageBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Astrophage"); Description.SetDefault("Little astral buggy"); diff --git a/Buffs/Pets/BabyGhostBellBuff.cs b/Buffs/Pets/BabyGhostBellBuff.cs index 53c2d67460..6890a10bf2 100644 --- a/Buffs/Pets/BabyGhostBellBuff.cs +++ b/Buffs/Pets/BabyGhostBellBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class BabyGhostBellBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Baby Ghost Bell"); Description.SetDefault("Be careful not to pop the bubble"); diff --git a/Buffs/Pets/BearBuff.cs b/Buffs/Pets/BearBuff.cs index 6a1a0fd599..9d268851dd 100644 --- a/Buffs/Pets/BearBuff.cs +++ b/Buffs/Pets/BearBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class BearBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Bear"); Description.SetDefault("A guardian angel is following you."); diff --git a/Buffs/Pets/BendyBuff.cs b/Buffs/Pets/BendyBuff.cs index 9acece95d2..b674e6ada6 100644 --- a/Buffs/Pets/BendyBuff.cs +++ b/Buffs/Pets/BendyBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class BendyBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Dreamfog"); Description.SetDefault("Xi believes in Yuu"); diff --git a/Buffs/Pets/BloodBound.cs b/Buffs/Pets/BloodBound.cs index adef2fd525..bbad157418 100644 --- a/Buffs/Pets/BloodBound.cs +++ b/Buffs/Pets/BloodBound.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class BloodBound : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Bound"); Description.SetDefault("You must be desperate for company"); diff --git a/Buffs/Pets/BrimlingBuff.cs b/Buffs/Pets/BrimlingBuff.cs index 1b70d42046..bde2bcb76d 100644 --- a/Buffs/Pets/BrimlingBuff.cs +++ b/Buffs/Pets/BrimlingBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class BrimlingBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimling"); Description.SetDefault("Protect her or suffer in agony"); diff --git a/Buffs/Pets/ChibiiBuff.cs b/Buffs/Pets/ChibiiBuff.cs index 0b34e23395..c11fcddb7d 100644 --- a/Buffs/Pets/ChibiiBuff.cs +++ b/Buffs/Pets/ChibiiBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class ChibiiBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Chibii Devourer"); Description.SetDefault("What? Were you expecting someone else?"); diff --git a/Buffs/Pets/DaawnlightSpiritOriginBuff.cs b/Buffs/Pets/DaawnlightSpiritOriginBuff.cs index fe321f59de..2bfeca44fa 100644 --- a/Buffs/Pets/DaawnlightSpiritOriginBuff.cs +++ b/Buffs/Pets/DaawnlightSpiritOriginBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Pets { public class DaawnlightSpiritOriginBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Archer of Lunamoon"); Description.SetDefault("You have a personal spotter"); diff --git a/Buffs/Pets/DannyDevito.cs b/Buffs/Pets/DannyDevito.cs index 7ac55eee86..574cc95344 100644 --- a/Buffs/Pets/DannyDevito.cs +++ b/Buffs/Pets/DannyDevito.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class DannyDevito : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Danny Devito"); Description.SetDefault("The trash man is following you."); diff --git a/Buffs/Pets/FlakPetBuff.cs b/Buffs/Pets/FlakPetBuff.cs index e77750ff92..7017ae0084 100644 --- a/Buffs/Pets/FlakPetBuff.cs +++ b/Buffs/Pets/FlakPetBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class FlakPetBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Flak Hermit"); Description.SetDefault("Little acid buggy"); diff --git a/Buffs/Pets/Fox.cs b/Buffs/Pets/Fox.cs index ebe4e31caa..791ffc3648 100644 --- a/Buffs/Pets/Fox.cs +++ b/Buffs/Pets/Fox.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class Fox : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Fox Pet"); Description.SetDefault("Fox Pet? FOX PET"); diff --git a/Buffs/Pets/FurtasticDuoBuff.cs b/Buffs/Pets/FurtasticDuoBuff.cs index 262b042712..aff6878b1e 100644 --- a/Buffs/Pets/FurtasticDuoBuff.cs +++ b/Buffs/Pets/FurtasticDuoBuff.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.Pets { public class FurtasticDuoBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Furtastic Duo"); Description.SetDefault("They just did! The Furtastic Duo will accompany you!"); diff --git a/Buffs/Pets/HiveMindPet.cs b/Buffs/Pets/HiveMindPet.cs index 6a423c7cfb..d543c3b119 100644 --- a/Buffs/Pets/HiveMindPet.cs +++ b/Buffs/Pets/HiveMindPet.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Pets { public class HiveMindPet : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Mini Mind"); Description.SetDefault("It knows everything"); diff --git a/Buffs/Pets/Kendra.cs b/Buffs/Pets/Kendra.cs index ffadb9aa8d..c229f9e74f 100644 --- a/Buffs/Pets/Kendra.cs +++ b/Buffs/Pets/Kendra.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class Kendra : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Kendra"); Description.SetDefault("A loyal friend accompanies you."); diff --git a/Buffs/Pets/LadBuff.cs b/Buffs/Pets/LadBuff.cs index 655bc61f3c..cb262a16b4 100644 --- a/Buffs/Pets/LadBuff.cs +++ b/Buffs/Pets/LadBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class LadBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("The Father"); Description.SetDefault("A father of many floats around you"); diff --git a/Buffs/Pets/LeviBuff.cs b/Buffs/Pets/LeviBuff.cs index 3081f8dfc3..a9639a7540 100644 --- a/Buffs/Pets/LeviBuff.cs +++ b/Buffs/Pets/LeviBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class LeviBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Levi"); Description.SetDefault("Small and cute"); diff --git a/Buffs/Pets/LittleLightBuff.cs b/Buffs/Pets/LittleLightBuff.cs index ecce8e35fd..c105206e4a 100644 --- a/Buffs/Pets/LittleLightBuff.cs +++ b/Buffs/Pets/LittleLightBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Pets { public class LittleLightBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Little Light"); Description.SetDefault("Endearing"); diff --git a/Buffs/Pets/PineappleBuff.cs b/Buffs/Pets/PineappleBuff.cs index f7df037f00..d0dabebfce 100644 --- a/Buffs/Pets/PineappleBuff.cs +++ b/Buffs/Pets/PineappleBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Pets { public class PineappleBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Pineapple"); Description.SetDefault("It smells like pizza..."); diff --git a/Buffs/Pets/PlaguebringerBabBuff.cs b/Buffs/Pets/PlaguebringerBabBuff.cs index 682d65ff6d..11e4b75e5e 100644 --- a/Buffs/Pets/PlaguebringerBabBuff.cs +++ b/Buffs/Pets/PlaguebringerBabBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class PlaguebringerBabBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Plaguebringer Bab"); Description.SetDefault("The baby plaguebringer sees you as the queen"); diff --git a/Buffs/Pets/RadiatorBuff.cs b/Buffs/Pets/RadiatorBuff.cs index 5b20f47659..6b5299d748 100644 --- a/Buffs/Pets/RadiatorBuff.cs +++ b/Buffs/Pets/RadiatorBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class RadiatorBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Radiator"); Description.SetDefault("Radioactive but adorable"); diff --git a/Buffs/Pets/ReaverOrbBuff.cs b/Buffs/Pets/ReaverOrbBuff.cs index 93a3e04085..ff95d2cb16 100644 --- a/Buffs/Pets/ReaverOrbBuff.cs +++ b/Buffs/Pets/ReaverOrbBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Pets { public class ReaverOrbBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Reaver Orb"); Description.SetDefault("The reaver orb will light your way"); diff --git a/Buffs/Pets/RotomBuff.cs b/Buffs/Pets/RotomBuff.cs index df0ad77cd7..5cc81fcd09 100644 --- a/Buffs/Pets/RotomBuff.cs +++ b/Buffs/Pets/RotomBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Pets { public class RotomBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Electric Troublemaker"); Description.SetDefault("Lightning never strikes the same place twice"); diff --git a/Buffs/Pets/SCalPetBuff.cs b/Buffs/Pets/SCalPetBuff.cs index f26eb3e5c8..71f05c6ae0 100644 --- a/Buffs/Pets/SCalPetBuff.cs +++ b/Buffs/Pets/SCalPetBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class SCalPetBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Supreme Calamitas"); Description.SetDefault("Watching over you with supreme calamitous energy... how adorable"); diff --git a/Buffs/Pets/SirenLightPetBuff.cs b/Buffs/Pets/SirenLightPetBuff.cs index faf7694757..dd9f95d729 100644 --- a/Buffs/Pets/SirenLightPetBuff.cs +++ b/Buffs/Pets/SirenLightPetBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class SirenLightPetBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Ocean Spirit"); Description.SetDefault("Small and cute"); diff --git a/Buffs/Pets/SparksBuff.cs b/Buffs/Pets/SparksBuff.cs index c591ed997f..aa05c37037 100644 --- a/Buffs/Pets/SparksBuff.cs +++ b/Buffs/Pets/SparksBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class SparksBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Sparks"); Description.SetDefault("Eats butterflies"); diff --git a/Buffs/Pets/ThirdSageBuff.cs b/Buffs/Pets/ThirdSageBuff.cs index c879217262..892395e31a 100644 --- a/Buffs/Pets/ThirdSageBuff.cs +++ b/Buffs/Pets/ThirdSageBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Pets { public class ThirdSageBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Third Sage"); Description.SetDefault("Eh? No way it's an oni."); diff --git a/Buffs/Pets/YharonSonBuff.cs b/Buffs/Pets/YharonSonBuff.cs index 2712c6ed07..7a89f99144 100644 --- a/Buffs/Pets/YharonSonBuff.cs +++ b/Buffs/Pets/YharonSonBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Pets { public class YharonSonBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Son of Yharon"); Description.SetDefault("You better not eat his dinner"); diff --git a/Buffs/Placeables/BlueSpeedCandle.cs b/Buffs/Placeables/BlueSpeedCandle.cs index f0233ffbcf..32163a34e7 100644 --- a/Buffs/Placeables/BlueSpeedCandle.cs +++ b/Buffs/Placeables/BlueSpeedCandle.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Placeables { public class BlueSpeedCandle : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Limber"); Description.SetDefault("The floating flame seems to uplift your very spirit"); diff --git a/Buffs/Placeables/ChaosCandleBuff.cs b/Buffs/Placeables/ChaosCandleBuff.cs index b395b3f889..838ad8db0c 100644 --- a/Buffs/Placeables/ChaosCandleBuff.cs +++ b/Buffs/Placeables/ChaosCandleBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Placeables { public class ChaosCandleBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Chaos Candle"); Description.SetDefault("Spawn rates around the candle are boosted!"); diff --git a/Buffs/Placeables/CorruptionEffigyBuff.cs b/Buffs/Placeables/CorruptionEffigyBuff.cs index b1fa642529..de2599d7aa 100644 --- a/Buffs/Placeables/CorruptionEffigyBuff.cs +++ b/Buffs/Placeables/CorruptionEffigyBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Placeables { public class CorruptionEffigyBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Corruption Effigy"); Description.SetDefault("The corruption empowers you"); diff --git a/Buffs/Placeables/CrimsonEffigyBuff.cs b/Buffs/Placeables/CrimsonEffigyBuff.cs index 8898a5038a..5218a97b13 100644 --- a/Buffs/Placeables/CrimsonEffigyBuff.cs +++ b/Buffs/Placeables/CrimsonEffigyBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Placeables { public class CrimsonEffigyBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Crimson Effigy"); Description.SetDefault("The crimson empowers you"); diff --git a/Buffs/Placeables/EffigyOfDecayBuff.cs b/Buffs/Placeables/EffigyOfDecayBuff.cs index 500c66aabd..aeedfcdd8c 100644 --- a/Buffs/Placeables/EffigyOfDecayBuff.cs +++ b/Buffs/Placeables/EffigyOfDecayBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Placeables { public class EffigyOfDecayBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Effigy of Decay"); Description.SetDefault("The sulphuric waters empower you"); diff --git a/Buffs/Placeables/PinkHealthCandle.cs b/Buffs/Placeables/PinkHealthCandle.cs index 6603da177f..a040861518 100644 --- a/Buffs/Placeables/PinkHealthCandle.cs +++ b/Buffs/Placeables/PinkHealthCandle.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Placeables { public class PinkHealthCandle : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Vigor"); Description.SetDefault("Its brilliant light suffuses those nearby with hope"); diff --git a/Buffs/Placeables/PurpleDefenseCandle.cs b/Buffs/Placeables/PurpleDefenseCandle.cs index d6daf5f8f8..d679293a01 100644 --- a/Buffs/Placeables/PurpleDefenseCandle.cs +++ b/Buffs/Placeables/PurpleDefenseCandle.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Placeables { public class PurpleDefenseCandle : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Resilience"); Description.SetDefault("Neither rain nor wind can snuff its undying flame"); diff --git a/Buffs/Placeables/TranquilityCandleBuff.cs b/Buffs/Placeables/TranquilityCandleBuff.cs index 3ccdc99e70..3371bf2179 100644 --- a/Buffs/Placeables/TranquilityCandleBuff.cs +++ b/Buffs/Placeables/TranquilityCandleBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Placeables { public class TranquilityCandleBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Tranquility Candle"); Description.SetDefault("Spawn rates around the candle are reduced!"); diff --git a/Buffs/Placeables/YellowDamageCandle.cs b/Buffs/Placeables/YellowDamageCandle.cs index 0b7dd4348a..afc14b303c 100644 --- a/Buffs/Placeables/YellowDamageCandle.cs +++ b/Buffs/Placeables/YellowDamageCandle.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Placeables { public class YellowDamageCandle : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Spite"); Description.SetDefault("Its hateful glow flickers with ire"); diff --git a/Buffs/PopoBuff.cs b/Buffs/PopoBuff.cs index c24ce48df9..8db981ce2d 100644 --- a/Buffs/PopoBuff.cs +++ b/Buffs/PopoBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs { public class PopoBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Popo"); Description.SetDefault("You are a snowman now!"); diff --git a/Buffs/PopoNoselessBuff.cs b/Buffs/PopoNoselessBuff.cs index 244249e5b9..ed2475c44b 100644 --- a/Buffs/PopoNoselessBuff.cs +++ b/Buffs/PopoNoselessBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs { public class PopoNoselessBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Noseless Popo"); Description.SetDefault("Your nose has been stolen!"); diff --git a/Buffs/Potions/AbyssalWeapon.cs b/Buffs/Potions/AbyssalWeapon.cs index 33ec746212..f74bca814b 100644 --- a/Buffs/Potions/AbyssalWeapon.cs +++ b/Buffs/Potions/AbyssalWeapon.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class AbyssalWeapon : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Abyssal Weapon"); Description.SetDefault("Melee and rogue weapons inflict abyssal flames, 5% increased movement speed"); diff --git a/Buffs/Potions/AnechoicCoatingBuff.cs b/Buffs/Potions/AnechoicCoatingBuff.cs index 6e19438ed0..33316fa9ca 100644 --- a/Buffs/Potions/AnechoicCoatingBuff.cs +++ b/Buffs/Potions/AnechoicCoatingBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class AnechoicCoatingBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Anechoic Coating"); Description.SetDefault("Abyssal creatures' detection radius reduced"); diff --git a/Buffs/Potions/ArmorCrumbling.cs b/Buffs/Potions/ArmorCrumbling.cs index e6cb425ab6..4da8bc037b 100644 --- a/Buffs/Potions/ArmorCrumbling.cs +++ b/Buffs/Potions/ArmorCrumbling.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class ArmorCrumbling : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Armor Crumbling"); Description.SetDefault("Melee and rogue attacks break enemy armor"); diff --git a/Buffs/Potions/ArmorShattering.cs b/Buffs/Potions/ArmorShattering.cs index 79cfe6a4bf..2138fd81cc 100644 --- a/Buffs/Potions/ArmorShattering.cs +++ b/Buffs/Potions/ArmorShattering.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class ArmorShattering : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Armor Shattering"); Description.SetDefault("Melee and rogue attacks break enemy armor"); diff --git a/Buffs/Potions/AstralInjectionBuff.cs b/Buffs/Potions/AstralInjectionBuff.cs index 9d252305e8..3d939a5fbf 100644 --- a/Buffs/Potions/AstralInjectionBuff.cs +++ b/Buffs/Potions/AstralInjectionBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class AstralInjectionBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Injection"); Description.SetDefault("Extreme mana recovery"); diff --git a/Buffs/Potions/BaguetteBuff.cs b/Buffs/Potions/BaguetteBuff.cs index 3fa791524d..64fa584f52 100644 --- a/Buffs/Potions/BaguetteBuff.cs +++ b/Buffs/Potions/BaguetteBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class BaguetteBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Baguette"); Description.SetDefault("If only I knew... ~Cirrus"); diff --git a/Buffs/Potions/BloodfinBoost.cs b/Buffs/Potions/BloodfinBoost.cs index 973d9dbc77..292ffa2010 100644 --- a/Buffs/Potions/BloodfinBoost.cs +++ b/Buffs/Potions/BloodfinBoost.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class BloodfinBoost : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Bloodfin Boost"); Description.SetDefault("Don't let the blood get to your head"); diff --git a/Buffs/Potions/BoundingBuff.cs b/Buffs/Potions/BoundingBuff.cs index b5cd8cc4b0..a17551ba5c 100644 --- a/Buffs/Potions/BoundingBuff.cs +++ b/Buffs/Potions/BoundingBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class BoundingBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Bounding"); Description.SetDefault("Increased jump height, jump speed, and fall damage resistance"); diff --git a/Buffs/Potions/Cadence.cs b/Buffs/Potions/Cadence.cs index 7999b55a89..58d01c837f 100644 --- a/Buffs/Potions/Cadence.cs +++ b/Buffs/Potions/Cadence.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class Cadence : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Cadance"); Description.SetDefault("Your heart is pure"); diff --git a/Buffs/Potions/CalciumBuff.cs b/Buffs/Potions/CalciumBuff.cs index b43ebb1e15..1e2be5613d 100644 --- a/Buffs/Potions/CalciumBuff.cs +++ b/Buffs/Potions/CalciumBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class CalciumBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Calcium"); Description.SetDefault("You are immune to fall damage"); diff --git a/Buffs/Potions/CeaselessHunger.cs b/Buffs/Potions/CeaselessHunger.cs index 2b443d9c9e..45876bcb36 100644 --- a/Buffs/Potions/CeaselessHunger.cs +++ b/Buffs/Potions/CeaselessHunger.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class CeaselessHunger : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Ceaseless Hunger"); Description.SetDefault("You are sucking up all the items"); diff --git a/Buffs/Potions/DraconicSurgeBuff.cs b/Buffs/Potions/DraconicSurgeBuff.cs index 13b29873a4..e4891834df 100644 --- a/Buffs/Potions/DraconicSurgeBuff.cs +++ b/Buffs/Potions/DraconicSurgeBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class DraconicSurgeBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Draconic Surge"); Description.SetDefault("The power of a dragon courses through your veins"); diff --git a/Buffs/Potions/GravityNormalizerBuff.cs b/Buffs/Potions/GravityNormalizerBuff.cs index c62b862983..64d8721c65 100644 --- a/Buffs/Potions/GravityNormalizerBuff.cs +++ b/Buffs/Potions/GravityNormalizerBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class GravityNormalizerBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Gravity Normalizer"); Description.SetDefault("Gravity is now normal in space, immunity to distorted"); diff --git a/Buffs/Potions/HolyWrathBuff.cs b/Buffs/Potions/HolyWrathBuff.cs index ee12d1a6d5..1dba5048b5 100644 --- a/Buffs/Potions/HolyWrathBuff.cs +++ b/Buffs/Potions/HolyWrathBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class HolyWrathBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Wrath"); Description.SetDefault("Increased damage and all attacks inflict holy fire"); diff --git a/Buffs/Potions/Invincible.cs b/Buffs/Potions/Invincible.cs index e6c9a0bbe8..03c7fdf111 100644 --- a/Buffs/Potions/Invincible.cs +++ b/Buffs/Potions/Invincible.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class Invincible : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Invincible"); Description.SetDefault("Immune to damage and most debuffs"); diff --git a/Buffs/Potions/Omniscience.cs b/Buffs/Potions/Omniscience.cs index a984c8580c..847b7fd428 100644 --- a/Buffs/Potions/Omniscience.cs +++ b/Buffs/Potions/Omniscience.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class Omniscience : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Omniscience"); Description.SetDefault("You can see everything"); diff --git a/Buffs/Potions/PenumbraBuff.cs b/Buffs/Potions/PenumbraBuff.cs index b1127349a0..bc3855511f 100644 --- a/Buffs/Potions/PenumbraBuff.cs +++ b/Buffs/Potions/PenumbraBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class PenumbraBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Penumbra"); Description.SetDefault("Stealth regenerates 15% faster while moving\n" + diff --git a/Buffs/Potions/PhotosynthesisBuff.cs b/Buffs/Potions/PhotosynthesisBuff.cs index 005a94af14..f1f339d36e 100644 --- a/Buffs/Potions/PhotosynthesisBuff.cs +++ b/Buffs/Potions/PhotosynthesisBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class PhotosynthesisBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Photosynthesis"); Description.SetDefault("Life regen boosted, more during daytime, and hearts heal more HP"); diff --git a/Buffs/Potions/ProfanedRageBuff.cs b/Buffs/Potions/ProfanedRageBuff.cs index 719a5763f3..15e7fec44a 100644 --- a/Buffs/Potions/ProfanedRageBuff.cs +++ b/Buffs/Potions/ProfanedRageBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class ProfanedRageBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Profaned Rage"); Description.SetDefault("Increased critical strike chance"); diff --git a/Buffs/Potions/Revivify.cs b/Buffs/Potions/Revivify.cs index 92394b9465..24d2434ee8 100644 --- a/Buffs/Potions/Revivify.cs +++ b/Buffs/Potions/Revivify.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class Revivify : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Revivify"); Description.SetDefault("You are healed by a fraction of the damage you take"); diff --git a/Buffs/Potions/ShadowBuff.cs b/Buffs/Potions/ShadowBuff.cs index 3184e8210b..27441f0295 100644 --- a/Buffs/Potions/ShadowBuff.cs +++ b/Buffs/Potions/ShadowBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class ShadowBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Shadow"); Description.SetDefault("You're invisible, certain rogue weapons give and gain buffs, and stealth generation is boosted."); diff --git a/Buffs/Potions/Soaring.cs b/Buffs/Potions/Soaring.cs index c302c0ced4..cfaaa3fc9e 100644 --- a/Buffs/Potions/Soaring.cs +++ b/Buffs/Potions/Soaring.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class Soaring : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Soaring"); Description.SetDefault("Increased wing flight time and speed\n" + diff --git a/Buffs/Potions/SulphurskinBuff.cs b/Buffs/Potions/SulphurskinBuff.cs index ed59bef8eb..4ce86a769d 100644 --- a/Buffs/Potions/SulphurskinBuff.cs +++ b/Buffs/Potions/SulphurskinBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class SulphurskinBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurskin"); Description.SetDefault("The sulphuric waters have a lesser effect on you"); diff --git a/Buffs/Potions/TeslaBuff.cs b/Buffs/Potions/TeslaBuff.cs index d72c8f05f3..bca4982b7e 100644 --- a/Buffs/Potions/TeslaBuff.cs +++ b/Buffs/Potions/TeslaBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class TeslaBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Tesla's Electricity"); Description.SetDefault("Summons an aura of electricity"); diff --git a/Buffs/Potions/TitanScale.cs b/Buffs/Potions/TitanScale.cs index e01f18adea..15c36e5e65 100644 --- a/Buffs/Potions/TitanScale.cs +++ b/Buffs/Potions/TitanScale.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class TitanScale : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Titan Scale"); Description.SetDefault("You feel tanky"); diff --git a/Buffs/Potions/TriumphBuff.cs b/Buffs/Potions/TriumphBuff.cs index b52031dcb9..e50bdbe3f1 100644 --- a/Buffs/Potions/TriumphBuff.cs +++ b/Buffs/Potions/TriumphBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class TriumphBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Triumph"); Description.SetDefault("Enemy contact damage is reduced, the lower their health the greater the reduction"); diff --git a/Buffs/Potions/YharimPower.cs b/Buffs/Potions/YharimPower.cs index 549f640804..e02998fe4b 100644 --- a/Buffs/Potions/YharimPower.cs +++ b/Buffs/Potions/YharimPower.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class YharimPower : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Yharim's Power"); Description.SetDefault("You feel like you can break the world in two... with your bare hands!"); diff --git a/Buffs/Potions/Zen.cs b/Buffs/Potions/Zen.cs index fa5d033f71..0d507cf7d2 100644 --- a/Buffs/Potions/Zen.cs +++ b/Buffs/Potions/Zen.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class Zen : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Zen"); Description.SetDefault("Spawn rates are reduced"); diff --git a/Buffs/Potions/Zerg.cs b/Buffs/Potions/Zerg.cs index e6ae303758..e7f1eb4ce9 100644 --- a/Buffs/Potions/Zerg.cs +++ b/Buffs/Potions/Zerg.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Potions { public class Zerg : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Zerg"); Description.SetDefault("Spawn rates are boosted"); diff --git a/Buffs/RancorBurn.cs b/Buffs/RancorBurn.cs index 0d4b6ba9b4..62700f8b24 100644 --- a/Buffs/RancorBurn.cs +++ b/Buffs/RancorBurn.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs { public class RancorBurn : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Rancor Burn"); Description.SetDefault("Burning"); diff --git a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs index 77c85358ab..2cfc8c1989 100644 --- a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs +++ b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class AbyssalDivingSuitBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Abyssal Diving Suit"); Description.SetDefault("You are made of metal"); diff --git a/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs b/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs index bf4737cdbf..220602de33 100644 --- a/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs +++ b/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class AbyssalDivingSuitPlates : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Abyssal Diving Suit Plates"); Description.SetDefault("The plates will absorb 15% damage"); diff --git a/Buffs/StatBuffs/AbyssalMadness.cs b/Buffs/StatBuffs/AbyssalMadness.cs index 6f7ff9d49b..283888e7eb 100644 --- a/Buffs/StatBuffs/AbyssalMadness.cs +++ b/Buffs/StatBuffs/AbyssalMadness.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class AbyssalMadness : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Abyssal Madness"); Description.SetDefault("Increased damage, critical strike chance, and tentacle aggression/range"); diff --git a/Buffs/StatBuffs/AdrenalineMode.cs b/Buffs/StatBuffs/AdrenalineMode.cs index 515eb75b3b..cf64679f94 100644 --- a/Buffs/StatBuffs/AdrenalineMode.cs +++ b/Buffs/StatBuffs/AdrenalineMode.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class AdrenalineMode : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Adrenaline Mode"); Description.SetDefault("200% damage boost. Can be boosted by other items up to 245%."); diff --git a/Buffs/StatBuffs/Afflicted.cs b/Buffs/StatBuffs/Afflicted.cs index 84a37d60fa..f18244b7e3 100644 --- a/Buffs/StatBuffs/Afflicted.cs +++ b/Buffs/StatBuffs/Afflicted.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class Afflicted : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Afflicted"); Description.SetDefault("Empowered by otherworldly spirits"); diff --git a/Buffs/StatBuffs/AmidiasBlessing.cs b/Buffs/StatBuffs/AmidiasBlessing.cs index 6c16af5f2f..84d5d91126 100644 --- a/Buffs/StatBuffs/AmidiasBlessing.cs +++ b/Buffs/StatBuffs/AmidiasBlessing.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class AmidiasBlessing : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Amidias' Blessing"); Description.SetDefault("You are blessed by Amidias" + diff --git a/Buffs/StatBuffs/AvertorBonus.cs b/Buffs/StatBuffs/AvertorBonus.cs index ebbb822c26..013b9112bd 100644 --- a/Buffs/StatBuffs/AvertorBonus.cs +++ b/Buffs/StatBuffs/AvertorBonus.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class AvertorBonus : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Avertor Bonus"); Description.SetDefault("Boosted damage and life regeneration"); diff --git a/Buffs/StatBuffs/BloodflareBloodFrenzy.cs b/Buffs/StatBuffs/BloodflareBloodFrenzy.cs index bf46dc7499..0b22167a77 100644 --- a/Buffs/StatBuffs/BloodflareBloodFrenzy.cs +++ b/Buffs/StatBuffs/BloodflareBloodFrenzy.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class BloodflareBloodFrenzy : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Frenzy"); Description.SetDefault("Contact damage is reduced and melee stats are greatly increased"); diff --git a/Buffs/StatBuffs/BloodyBoost.cs b/Buffs/StatBuffs/BloodyBoost.cs index 7b996b8a7e..b1e7a483d3 100644 --- a/Buffs/StatBuffs/BloodyBoost.cs +++ b/Buffs/StatBuffs/BloodyBoost.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class BloodyBoost : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Bloody Boost"); Description.SetDefault("Increased offensive and defensive stats\n" + diff --git a/Buffs/StatBuffs/BossZen.cs b/Buffs/StatBuffs/BossZen.cs index 8745f40d5b..e73e217cb1 100644 --- a/Buffs/StatBuffs/BossZen.cs +++ b/Buffs/StatBuffs/BossZen.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class BossZen : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Boss Effects"); Description.SetDefault("This tooltip is edited in the function below"); diff --git a/Buffs/StatBuffs/BrimflameFrenzyBuff.cs b/Buffs/StatBuffs/BrimflameFrenzyBuff.cs index 2e4f3fca94..50cb28f330 100644 --- a/Buffs/StatBuffs/BrimflameFrenzyBuff.cs +++ b/Buffs/StatBuffs/BrimflameFrenzyBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class BrimflameFrenzyBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimflame Frenzy"); Description.SetDefault("Dark magic empowers your attacks at the cost of your life"); diff --git a/Buffs/StatBuffs/ChiBuff.cs b/Buffs/StatBuffs/ChiBuff.cs index 920a2358b6..b2d12357fc 100644 --- a/Buffs/StatBuffs/ChiBuff.cs +++ b/Buffs/StatBuffs/ChiBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class ChiBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Chi"); Description.SetDefault("Your next attack is boosted and you are more resilient"); diff --git a/Buffs/StatBuffs/CosmicFreeze.cs b/Buffs/StatBuffs/CosmicFreeze.cs index 12dd1ca5b0..3ce93a3580 100644 --- a/Buffs/StatBuffs/CosmicFreeze.cs +++ b/Buffs/StatBuffs/CosmicFreeze.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class CosmicFreeze : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Freeze"); Description.SetDefault("You feel as cold as the empty expanse of outer space"); diff --git a/Buffs/StatBuffs/DivineBless.cs b/Buffs/StatBuffs/DivineBless.cs index 4a75db454f..8db0916d18 100644 --- a/Buffs/StatBuffs/DivineBless.cs +++ b/Buffs/StatBuffs/DivineBless.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class DivineBless : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Divine Bless"); Description.SetDefault("Increased health regen and minions inflict Banishing Fire"); diff --git a/Buffs/StatBuffs/ElysianGuard.cs b/Buffs/StatBuffs/ElysianGuard.cs index d6dc282b36..30fa8e50f0 100644 --- a/Buffs/StatBuffs/ElysianGuard.cs +++ b/Buffs/StatBuffs/ElysianGuard.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class ElysianGuard : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Elysian Guard"); Description.SetDefault("Movement speed reduced, other stats buffed"); diff --git a/Buffs/StatBuffs/Encased.cs b/Buffs/StatBuffs/Encased.cs index 40ad412046..1366c77ba5 100644 --- a/Buffs/StatBuffs/Encased.cs +++ b/Buffs/StatBuffs/Encased.cs @@ -1,12 +1,13 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Buffs.StatBuffs { public class Encased : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Encased"); Description.SetDefault("30 defense and +30% damage reduction, but..."); @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.StatBuffs player.Calamity().encased = true; if (player.buffTime[buffIndex] == 2) { - Main.PlaySound(SoundID.Item27, player.position); + SoundEngine.PlaySound(SoundID.Item27, player.position); player.GiveIFrames(90, true); } } diff --git a/Buffs/StatBuffs/GraxDefense.cs b/Buffs/StatBuffs/GraxDefense.cs index aadc44a528..e165f1fafa 100644 --- a/Buffs/StatBuffs/GraxDefense.cs +++ b/Buffs/StatBuffs/GraxDefense.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class GraxDefense : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Grax Boost"); Description.SetDefault("Your defenses and muscles are strong"); diff --git a/Buffs/StatBuffs/HallowedRuneAtkBuff.cs b/Buffs/StatBuffs/HallowedRuneAtkBuff.cs index 876a2b24ff..f087c63a7e 100644 --- a/Buffs/StatBuffs/HallowedRuneAtkBuff.cs +++ b/Buffs/StatBuffs/HallowedRuneAtkBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class HallowedRuneAtkBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Hallowed Power"); Description.SetDefault("Minion damage boosted by 10%"); @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { player.Calamity().hallowedPower = true; - player.minionDamage += 0.1f; + player.GetDamage(DamageClass.Summon) += 0.1f; } } } diff --git a/Buffs/StatBuffs/HallowedRuneDefBuff.cs b/Buffs/StatBuffs/HallowedRuneDefBuff.cs index fd4b8c8436..63147ff901 100644 --- a/Buffs/StatBuffs/HallowedRuneDefBuff.cs +++ b/Buffs/StatBuffs/HallowedRuneDefBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class HallowedRuneDefBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Hallowed Defense"); Description.SetDefault("Defense boosted by 8 and damage reduction boosted by 4%"); diff --git a/Buffs/StatBuffs/HallowedRuneRegenBuff.cs b/Buffs/StatBuffs/HallowedRuneRegenBuff.cs index d69e28bc8a..3e6d65be3f 100644 --- a/Buffs/StatBuffs/HallowedRuneRegenBuff.cs +++ b/Buffs/StatBuffs/HallowedRuneRegenBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class HallowedRuneRegenBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Hallowed Regen"); Description.SetDefault("Regenerating life"); diff --git a/Buffs/StatBuffs/IceShieldBuff.cs b/Buffs/StatBuffs/IceShieldBuff.cs index cd57c36d03..360ce44388 100644 --- a/Buffs/StatBuffs/IceShieldBuff.cs +++ b/Buffs/StatBuffs/IceShieldBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class IceShieldBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Ice Shield"); Description.SetDefault("Absorbs 20% damage from the next hit you take, then shatters"); diff --git a/Buffs/StatBuffs/KamiBuff.cs b/Buffs/StatBuffs/KamiBuff.cs index 444b09cd92..e4c77592f8 100644 --- a/Buffs/StatBuffs/KamiBuff.cs +++ b/Buffs/StatBuffs/KamiBuff.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Buffs.StatBuffs { @@ -7,7 +8,7 @@ namespace CalamityMod.Buffs.StatBuffs { public const float RunSpeedBoost = 0.15f; public const float RunAccelerationBoost = 0.15f; - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Kami Injection"); Description.SetDefault("Increased max movement speed, acceleration and damage"); @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.StatBuffs { player.Calamity().kamiBoost = true; if (player.buffTime[buffIndex] == 1) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YanmeiKnifeExpire"), player.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YanmeiKnifeExpire"), player.Center); } } } diff --git a/Buffs/StatBuffs/Molten.cs b/Buffs/StatBuffs/Molten.cs index 35f8accd59..f40a7b7459 100644 --- a/Buffs/StatBuffs/Molten.cs +++ b/Buffs/StatBuffs/Molten.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class Molten : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Molten"); Description.SetDefault("Resistant to cold effects"); diff --git a/Buffs/StatBuffs/Mushy.cs b/Buffs/StatBuffs/Mushy.cs index eea140a50b..6db0cfc946 100644 --- a/Buffs/StatBuffs/Mushy.cs +++ b/Buffs/StatBuffs/Mushy.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class Mushy : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Mushy"); Description.SetDefault("Increased defense and life regen"); diff --git a/Buffs/StatBuffs/PhantomicArmourBuff.cs b/Buffs/StatBuffs/PhantomicArmourBuff.cs index 85327fb561..f995b5e473 100644 --- a/Buffs/StatBuffs/PhantomicArmourBuff.cs +++ b/Buffs/StatBuffs/PhantomicArmourBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { class PhantomicArmourBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Phantomic Shield"); Description.SetDefault("Defense boosted by 10 and damage reduction boosted by 5%\n" + diff --git a/Buffs/StatBuffs/PhantomicEmpowermentBuff.cs b/Buffs/StatBuffs/PhantomicEmpowermentBuff.cs index fe78a8f2af..61d8f08f84 100644 --- a/Buffs/StatBuffs/PhantomicEmpowermentBuff.cs +++ b/Buffs/StatBuffs/PhantomicEmpowermentBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { class PhantomicEmpowermentBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Phantomic Empowerment"); Description.SetDefault("Empowering minion damage by 10%"); @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.minionDamage += 0.1f; + player.GetDamage(DamageClass.Summon) += 0.1f; } } } diff --git a/Buffs/StatBuffs/PhantomicRestorationBuff.cs b/Buffs/StatBuffs/PhantomicRestorationBuff.cs index ace3972774..6f5e90fcf7 100644 --- a/Buffs/StatBuffs/PhantomicRestorationBuff.cs +++ b/Buffs/StatBuffs/PhantomicRestorationBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.StatBuffs { class PhantomicRestorationBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Phantomic Regen"); Description.SetDefault("Regenerating life"); diff --git a/Buffs/StatBuffs/PolarisBuff.cs b/Buffs/StatBuffs/PolarisBuff.cs index 79ec4f9a15..48827afc2b 100644 --- a/Buffs/StatBuffs/PolarisBuff.cs +++ b/Buffs/StatBuffs/PolarisBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class PolarisBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Polaris Boost"); Description.SetDefault("The Northern Star empowers your weapon"); diff --git a/Buffs/StatBuffs/ProfanedCrystalBuff.cs b/Buffs/StatBuffs/ProfanedCrystalBuff.cs index 1f879de370..a67f853e63 100644 --- a/Buffs/StatBuffs/ProfanedCrystalBuff.cs +++ b/Buffs/StatBuffs/ProfanedCrystalBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class ProfanedCrystalBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Devotion"); Description.SetDefault(""); diff --git a/Buffs/StatBuffs/RageMode.cs b/Buffs/StatBuffs/RageMode.cs index c60767bfe3..4bc6f6ca5a 100644 --- a/Buffs/StatBuffs/RageMode.cs +++ b/Buffs/StatBuffs/RageMode.cs @@ -1,12 +1,13 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Buffs.StatBuffs { public class RageMode : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Rage Mode"); Description.SetDefault("35% damage boost."); @@ -32,7 +33,7 @@ namespace CalamityMod.Buffs.StatBuffs // Otherwise, Rage Mode ends instantly. else { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/RageEnd"), player.position); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/RageEnd"), player.position); player.DelBuff(buffIndex--); // TML documentation requires you to decrement buffIndex if deleting the buff during Update. mp.rageModeActive = false; mp.rage = 0f; diff --git a/Buffs/StatBuffs/ReaverRage.cs b/Buffs/StatBuffs/ReaverRage.cs index 8e35172d22..d7492d2772 100644 --- a/Buffs/StatBuffs/ReaverRage.cs +++ b/Buffs/StatBuffs/ReaverRage.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class ReaverRage : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Reaver Rage"); Description.SetDefault("You are angry"); diff --git a/Buffs/StatBuffs/ShellBoost.cs b/Buffs/StatBuffs/ShellBoost.cs index ae1276eec9..fdbc9538b0 100644 --- a/Buffs/StatBuffs/ShellBoost.cs +++ b/Buffs/StatBuffs/ShellBoost.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class ShellBoost : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Shell Speed Boost"); Description.SetDefault("Speed is boosted"); diff --git a/Buffs/StatBuffs/SilvaRevival.cs b/Buffs/StatBuffs/SilvaRevival.cs index 160890cc95..046a8b0701 100644 --- a/Buffs/StatBuffs/SilvaRevival.cs +++ b/Buffs/StatBuffs/SilvaRevival.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class SilvaRevival : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Silva Immunity"); Description.SetDefault("You are unkillable and immune to most debuffs"); diff --git a/Buffs/StatBuffs/SirenBobs.cs b/Buffs/StatBuffs/SirenBobs.cs index 75d2cd5cc1..d4742e60ae 100644 --- a/Buffs/StatBuffs/SirenBobs.cs +++ b/Buffs/StatBuffs/SirenBobs.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class SirenBobs : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Water Elemental"); Description.SetDefault("You are a water elemental now"); diff --git a/Buffs/StatBuffs/SirenWaterSpeed.cs b/Buffs/StatBuffs/SirenWaterSpeed.cs index c0e4c54556..118eddd46b 100644 --- a/Buffs/StatBuffs/SirenWaterSpeed.cs +++ b/Buffs/StatBuffs/SirenWaterSpeed.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class SirenWaterSpeed : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Ocean's Blessing"); Description.SetDefault("15% increased max speed and acceleration"); diff --git a/Buffs/StatBuffs/SpiritGeneratorAtkBuff.cs b/Buffs/StatBuffs/SpiritGeneratorAtkBuff.cs index 360862743a..144d49ab05 100644 --- a/Buffs/StatBuffs/SpiritGeneratorAtkBuff.cs +++ b/Buffs/StatBuffs/SpiritGeneratorAtkBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class SpiritGeneratorAtkBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Spirit Power"); Description.SetDefault("Minion damage boosted by 10%"); @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.minionDamage += 0.1f; + player.GetDamage(DamageClass.Summon) += 0.1f; } } } diff --git a/Buffs/StatBuffs/SpiritGeneratorDefBuff.cs b/Buffs/StatBuffs/SpiritGeneratorDefBuff.cs index 4e2ad33344..45e46d643c 100644 --- a/Buffs/StatBuffs/SpiritGeneratorDefBuff.cs +++ b/Buffs/StatBuffs/SpiritGeneratorDefBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class SpiritGeneratorDefBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Spirit Defense"); Description.SetDefault("Defense boosted by 6 and damage reduction boosted by 3%"); diff --git a/Buffs/StatBuffs/SpiritGeneratorRegenBuff.cs b/Buffs/StatBuffs/SpiritGeneratorRegenBuff.cs index 9ce3a3038c..b2ef77c5ed 100644 --- a/Buffs/StatBuffs/SpiritGeneratorRegenBuff.cs +++ b/Buffs/StatBuffs/SpiritGeneratorRegenBuff.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class SpiritGeneratorRegenBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Spirit Regen"); Description.SetDefault("Regenerating life"); diff --git a/Buffs/StatBuffs/TarraLifeRegen.cs b/Buffs/StatBuffs/TarraLifeRegen.cs index 8faa4969e0..de4fc008a4 100644 --- a/Buffs/StatBuffs/TarraLifeRegen.cs +++ b/Buffs/StatBuffs/TarraLifeRegen.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class TarraLifeRegen : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Tarra Life"); Description.SetDefault("Rapid healing"); diff --git a/Buffs/StatBuffs/TarragonCloak.cs b/Buffs/StatBuffs/TarragonCloak.cs index 0fd7e3448a..c991e8ac86 100644 --- a/Buffs/StatBuffs/TarragonCloak.cs +++ b/Buffs/StatBuffs/TarragonCloak.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class TarragonCloak : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Tarragon Cloak"); Description.SetDefault("Contact damage is reduced"); diff --git a/Buffs/StatBuffs/TarragonImmunity.cs b/Buffs/StatBuffs/TarragonImmunity.cs index 4552ffc727..5afb8329d1 100644 --- a/Buffs/StatBuffs/TarragonImmunity.cs +++ b/Buffs/StatBuffs/TarragonImmunity.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class TarragonImmunity : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Tarragon Immunity"); Description.SetDefault("You are immune"); diff --git a/Buffs/StatBuffs/TyrantsFury.cs b/Buffs/StatBuffs/TyrantsFury.cs index 2358138430..92ad71457b 100644 --- a/Buffs/StatBuffs/TyrantsFury.cs +++ b/Buffs/StatBuffs/TyrantsFury.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class TyrantsFury : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Tyrant's Fury"); Description.SetDefault("30% increased melee damage and 10% increased melee crit chance"); diff --git a/Buffs/StatBuffs/XerocRage.cs b/Buffs/StatBuffs/XerocRage.cs index ee1114b928..9da1c4e87e 100644 --- a/Buffs/StatBuffs/XerocRage.cs +++ b/Buffs/StatBuffs/XerocRage.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class XerocRage : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Empyrean Rage"); Description.SetDefault("Rage of the cosmos"); diff --git a/Buffs/StatBuffs/XerocWrath.cs b/Buffs/StatBuffs/XerocWrath.cs index 2f7f47d7a8..ae77e57f3b 100644 --- a/Buffs/StatBuffs/XerocWrath.cs +++ b/Buffs/StatBuffs/XerocWrath.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class XerocWrath : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Empyrean Wrath"); Description.SetDefault("Wrath of the cosmos"); diff --git a/Buffs/StatDebuffs/AndromedaCripple.cs b/Buffs/StatDebuffs/AndromedaCripple.cs index 9488fe4641..047fb5986f 100644 --- a/Buffs/StatDebuffs/AndromedaCripple.cs +++ b/Buffs/StatDebuffs/AndromedaCripple.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class AndromedaCripple : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Andromeda Cripple"); Description.SetDefault("You're slow"); diff --git a/Buffs/StatDebuffs/ArmorCrunch.cs b/Buffs/StatDebuffs/ArmorCrunch.cs index 7aecebe2a2..0103373a79 100644 --- a/Buffs/StatDebuffs/ArmorCrunch.cs +++ b/Buffs/StatDebuffs/ArmorCrunch.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public static int DefenseReduction = 15; - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Armor Crunch"); Description.SetDefault("Your armor is shredded"); diff --git a/Buffs/StatDebuffs/Clamity.cs b/Buffs/StatDebuffs/Clamity.cs index 439655ea95..86f260a1b9 100644 --- a/Buffs/StatDebuffs/Clamity.cs +++ b/Buffs/StatDebuffs/Clamity.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class Clamity : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Clamity"); Description.SetDefault("The clams have been angered!"); diff --git a/Buffs/StatDebuffs/Enraged.cs b/Buffs/StatDebuffs/Enraged.cs index 4a55ec7231..86fa671788 100644 --- a/Buffs/StatDebuffs/Enraged.cs +++ b/Buffs/StatDebuffs/Enraged.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class Enraged : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Enraged"); Description.SetDefault("All damage taken is increased by 25%"); diff --git a/Buffs/StatDebuffs/Eutrophication.cs b/Buffs/StatDebuffs/Eutrophication.cs index 53510221a4..81bfd49820 100644 --- a/Buffs/StatDebuffs/Eutrophication.cs +++ b/Buffs/StatDebuffs/Eutrophication.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class Eutrophication : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Eutrophication"); Description.SetDefault("Excessive nutrients restrict your movement"); diff --git a/Buffs/StatDebuffs/ExoFreeze.cs b/Buffs/StatDebuffs/ExoFreeze.cs index 5b490f26e9..d4737d200f 100644 --- a/Buffs/StatDebuffs/ExoFreeze.cs +++ b/Buffs/StatDebuffs/ExoFreeze.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class ExoFreeze : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Exo Freeze"); Description.SetDefault("Cannot move"); diff --git a/Buffs/StatDebuffs/ExtremeGrav.cs b/Buffs/StatDebuffs/ExtremeGrav.cs index 5c9b9538c7..29ca449f5f 100644 --- a/Buffs/StatDebuffs/ExtremeGrav.cs +++ b/Buffs/StatDebuffs/ExtremeGrav.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class ExtremeGrav : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Extreme Gravity"); Description.SetDefault("Your wing time is reduced by 25%, infinite flight is disabled"); diff --git a/Buffs/StatDebuffs/ExtremeGravity.cs b/Buffs/StatDebuffs/ExtremeGravity.cs index d1c18b0f93..bdee81146c 100644 --- a/Buffs/StatDebuffs/ExtremeGravity.cs +++ b/Buffs/StatDebuffs/ExtremeGravity.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class ExtremeGravity : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Icarus' Folly"); Description.SetDefault("Your wing time is reduced by 33%, infinite flight is disabled"); diff --git a/Buffs/StatDebuffs/FishAlert.cs b/Buffs/StatDebuffs/FishAlert.cs index 8f5d741026..61a28d2517 100644 --- a/Buffs/StatDebuffs/FishAlert.cs +++ b/Buffs/StatDebuffs/FishAlert.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class FishAlert : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Fish Alert"); Description.SetDefault("The abyssal creatures have spotted you!"); diff --git a/Buffs/StatDebuffs/FrozenLungs.cs b/Buffs/StatDebuffs/FrozenLungs.cs index ca885f84a8..513f2e4dc8 100644 --- a/Buffs/StatDebuffs/FrozenLungs.cs +++ b/Buffs/StatDebuffs/FrozenLungs.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class FrozenLungs : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Frozen Lungs"); Description.SetDefault("The icy waters restrict your breathing"); diff --git a/Buffs/StatDebuffs/GlacialState.cs b/Buffs/StatDebuffs/GlacialState.cs index 1cb543f523..c46ea4d985 100644 --- a/Buffs/StatDebuffs/GlacialState.cs +++ b/Buffs/StatDebuffs/GlacialState.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class GlacialState : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Glacial State"); Description.SetDefault("Cannot move"); diff --git a/Buffs/StatDebuffs/Irradiated.cs b/Buffs/StatDebuffs/Irradiated.cs index 458b9887c5..7f7aa29fa9 100644 --- a/Buffs/StatDebuffs/Irradiated.cs +++ b/Buffs/StatDebuffs/Irradiated.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class Irradiated : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Irradiated"); Description.SetDefault("Your skin is burning off"); diff --git a/Buffs/StatDebuffs/KamiDebuff.cs b/Buffs/StatDebuffs/KamiDebuff.cs index e29040ef6d..a5ec6f8848 100644 --- a/Buffs/StatDebuffs/KamiDebuff.cs +++ b/Buffs/StatDebuffs/KamiDebuff.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Buffs.StatDebuffs // Hard-cap for npc speed when afflicted with this debuff. Does not affect certain NPCs and does not affect any bosses (Basically only works on boss minions). public const float MaxNPCSpeed = 16f; - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Kami Flu"); Description.SetDefault("Defenseless and dying"); diff --git a/Buffs/StatDebuffs/MarkedforDeath.cs b/Buffs/StatDebuffs/MarkedforDeath.cs index 0f7ec2f986..68ab21078b 100644 --- a/Buffs/StatDebuffs/MarkedforDeath.cs +++ b/Buffs/StatDebuffs/MarkedforDeath.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public static int DefenseReduction = 5; - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Marked"); Description.SetDefault("Damage reduction reduced"); diff --git a/Buffs/StatDebuffs/PearlAura.cs b/Buffs/StatDebuffs/PearlAura.cs index 328aed6b5a..10473a1cd5 100644 --- a/Buffs/StatDebuffs/PearlAura.cs +++ b/Buffs/StatDebuffs/PearlAura.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class PearlAura : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Pearl Aura"); Description.SetDefault("Slowed down"); diff --git a/Buffs/StatDebuffs/ProfanedWeakness.cs b/Buffs/StatDebuffs/ProfanedWeakness.cs index b62b658707..95dd8e9715 100644 --- a/Buffs/StatDebuffs/ProfanedWeakness.cs +++ b/Buffs/StatDebuffs/ProfanedWeakness.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class ProfanedWeakness : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Profaned Weakness"); Description.SetDefault("You do less damage"); diff --git a/Buffs/StatDebuffs/TemporalSadness.cs b/Buffs/StatDebuffs/TemporalSadness.cs index 196883779e..d28177e7e7 100644 --- a/Buffs/StatDebuffs/TemporalSadness.cs +++ b/Buffs/StatDebuffs/TemporalSadness.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class TemporalSadness : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Temporal Sadness"); Description.SetDefault("You are crying"); diff --git a/Buffs/StatDebuffs/TeslaFreeze.cs b/Buffs/StatDebuffs/TeslaFreeze.cs index 31e64000da..5cb125bd15 100644 --- a/Buffs/StatDebuffs/TeslaFreeze.cs +++ b/Buffs/StatDebuffs/TeslaFreeze.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class TeslaFreeze : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Galvanic Corrosion"); Description.SetDefault("Your limbs have begun to corrode"); diff --git a/Buffs/StatDebuffs/TimeSlow.cs b/Buffs/StatDebuffs/TimeSlow.cs index cf072806ce..da5252cbee 100644 --- a/Buffs/StatDebuffs/TimeSlow.cs +++ b/Buffs/StatDebuffs/TimeSlow.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class TimeSlow : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Time Distortion"); Description.SetDefault("Time is slowed"); diff --git a/Buffs/StatDebuffs/WarCleave.cs b/Buffs/StatDebuffs/WarCleave.cs index eb7edfe3ad..cbd86ebd80 100644 --- a/Buffs/StatDebuffs/WarCleave.cs +++ b/Buffs/StatDebuffs/WarCleave.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public static int DefenseReduction = 15; - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("War Cleave"); Description.SetDefault("Defense and protection reduced"); diff --git a/Buffs/StatDebuffs/Warped.cs b/Buffs/StatDebuffs/Warped.cs index c700b2df34..bcc329a92c 100644 --- a/Buffs/StatDebuffs/Warped.cs +++ b/Buffs/StatDebuffs/Warped.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class Warped : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Warped"); Description.SetDefault("Movement is being warped"); diff --git a/Buffs/StatDebuffs/WeakPetrification.cs b/Buffs/StatDebuffs/WeakPetrification.cs index 6db6abf11a..c7e60bf574 100644 --- a/Buffs/StatDebuffs/WeakPetrification.cs +++ b/Buffs/StatDebuffs/WeakPetrification.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class WeakPetrification : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Weak Petrification"); Description.SetDefault("Your vertical movement is weakened"); diff --git a/Buffs/StatDebuffs/WhisperingDeath.cs b/Buffs/StatDebuffs/WhisperingDeath.cs index d21f0ca879..90ef4f07fe 100644 --- a/Buffs/StatDebuffs/WhisperingDeath.cs +++ b/Buffs/StatDebuffs/WhisperingDeath.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public class WhisperingDeath : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Whispering Death"); Description.SetDefault("Death approaches; movement speed, attack power and life regen reduced"); diff --git a/Buffs/StatDebuffs/WitherDebuff.cs b/Buffs/StatDebuffs/WitherDebuff.cs index cbdbb4d2f9..4e119dc551 100644 --- a/Buffs/StatDebuffs/WitherDebuff.cs +++ b/Buffs/StatDebuffs/WitherDebuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.StatDebuffs { public static int DefenseReduction = 20; - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Wither"); Description.SetDefault("Withered...\n" + diff --git a/Buffs/Summon/AerospecSummonSetBuff.cs b/Buffs/Summon/AerospecSummonSetBuff.cs index bd5f2e7bee..680aaf7164 100644 --- a/Buffs/Summon/AerospecSummonSetBuff.cs +++ b/Buffs/Summon/AerospecSummonSetBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class AerospecSummonSetBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Valkyrie"); Description.SetDefault("The valkyrie will protect you"); diff --git a/Buffs/Summon/ApexSharkBuff.cs b/Buffs/Summon/ApexSharkBuff.cs index 36849c6d50..19ed6b0bde 100644 --- a/Buffs/Summon/ApexSharkBuff.cs +++ b/Buffs/Summon/ApexSharkBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class ApexSharkBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Ancient Mineral Shark"); Description.SetDefault("Ancient yet so dangerous"); diff --git a/Buffs/Summon/AquaticStar.cs b/Buffs/Summon/AquaticStar.cs index 496cbf47ff..3a49d3813b 100644 --- a/Buffs/Summon/AquaticStar.cs +++ b/Buffs/Summon/AquaticStar.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class AquaticStar : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Aquatic Star"); Description.SetDefault("The aquatic star will protect you"); diff --git a/Buffs/Summon/AstrageldonBuff.cs b/Buffs/Summon/AstrageldonBuff.cs index c977a131ec..2a9a437a8e 100644 --- a/Buffs/Summon/AstrageldonBuff.cs +++ b/Buffs/Summon/AstrageldonBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class AstrageldonBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Jelly"); Description.SetDefault("The mini astrageldon slime will protect you"); diff --git a/Buffs/Summon/AstralProbeBuff.cs b/Buffs/Summon/AstralProbeBuff.cs index dac48fe7dd..0993508787 100644 --- a/Buffs/Summon/AstralProbeBuff.cs +++ b/Buffs/Summon/AstralProbeBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class AstralProbeBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Probe"); Description.SetDefault("The astral probe will protect you"); diff --git a/Buffs/Summon/AtaxiaSummonSetBuff.cs b/Buffs/Summon/AtaxiaSummonSetBuff.cs index 350fdeefba..9b094da5ff 100644 --- a/Buffs/Summon/AtaxiaSummonSetBuff.cs +++ b/Buffs/Summon/AtaxiaSummonSetBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class AtaxiaSummonSetBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Hydrothermic Vent"); Description.SetDefault("The hydrothermic vent will protect you"); diff --git a/Buffs/Summon/BelladonnaSpiritBuff.cs b/Buffs/Summon/BelladonnaSpiritBuff.cs index 78993e6f52..9db4da2126 100644 --- a/Buffs/Summon/BelladonnaSpiritBuff.cs +++ b/Buffs/Summon/BelladonnaSpiritBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class BelladonnaSpiritBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Belladonna Spirit"); Description.SetDefault("A cute forest spirit is following you"); diff --git a/Buffs/Summon/BlackHawkBuff.cs b/Buffs/Summon/BlackHawkBuff.cs index 78ff092d3b..0858bf6993 100644 --- a/Buffs/Summon/BlackHawkBuff.cs +++ b/Buffs/Summon/BlackHawkBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class BlackHawkBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Black Hawk"); Description.SetDefault("The fighter jet will protect you"); diff --git a/Buffs/Summon/BloodClot.cs b/Buffs/Summon/BloodClot.cs index bf8e60993b..3c4d63e170 100644 --- a/Buffs/Summon/BloodClot.cs +++ b/Buffs/Summon/BloodClot.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class BloodClot : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Clot"); Description.SetDefault("The blood clot will protect you"); diff --git a/Buffs/Summon/BloodDragonsBuff.cs b/Buffs/Summon/BloodDragonsBuff.cs index e1c0f63a90..ed94e25290 100644 --- a/Buffs/Summon/BloodDragonsBuff.cs +++ b/Buffs/Summon/BloodDragonsBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class BloodDragonsBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Skeletal Dragons"); Description.SetDefault("Big happy family"); diff --git a/Buffs/Summon/BrimstoneWaifu.cs b/Buffs/Summon/BrimstoneWaifu.cs index d96e8335f4..56208e3e9f 100644 --- a/Buffs/Summon/BrimstoneWaifu.cs +++ b/Buffs/Summon/BrimstoneWaifu.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class BrimstoneWaifu : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Elemental"); Description.SetDefault("The brimstone elemental will protect you"); diff --git a/Buffs/Summon/BrittleStar.cs b/Buffs/Summon/BrittleStar.cs index 23436ec672..09dd1af953 100644 --- a/Buffs/Summon/BrittleStar.cs +++ b/Buffs/Summon/BrittleStar.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class BrittleStar : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Brittle Star"); Description.SetDefault("The brittle star will protect you"); diff --git a/Buffs/Summon/Calamari.cs b/Buffs/Summon/Calamari.cs index 0d90a14826..564807a46d 100644 --- a/Buffs/Summon/Calamari.cs +++ b/Buffs/Summon/Calamari.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Summon { public class Calamari : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Calamari"); Description.SetDefault("The squid will protect you"); diff --git a/Buffs/Summon/CalamitasEyes.cs b/Buffs/Summon/CalamitasEyes.cs index 5d5906b0cf..e201a6fad8 100644 --- a/Buffs/Summon/CalamitasEyes.cs +++ b/Buffs/Summon/CalamitasEyes.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class CalamitasEyes : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Blighted Eyes"); Description.SetDefault("Calamitas and her brothers will protect you"); diff --git a/Buffs/Summon/CausticStaffBuff.cs b/Buffs/Summon/CausticStaffBuff.cs index 370f0feb26..3c0ca84e92 100644 --- a/Buffs/Summon/CausticStaffBuff.cs +++ b/Buffs/Summon/CausticStaffBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class CausticStaffBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Caustic Dragon"); Description.SetDefault("A mini jungle dragon is following you"); diff --git a/Buffs/Summon/CinderBlossomBuff.cs b/Buffs/Summon/CinderBlossomBuff.cs index e9549d9147..ca5c3e48c5 100644 --- a/Buffs/Summon/CinderBlossomBuff.cs +++ b/Buffs/Summon/CinderBlossomBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class CinderBlossomBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Cinder Blossom"); Description.SetDefault("A hot, searing flower is floating uncomfortably close to you"); diff --git a/Buffs/Summon/CloudyWaifu.cs b/Buffs/Summon/CloudyWaifu.cs index 7e739bd29e..64a52506ee 100644 --- a/Buffs/Summon/CloudyWaifu.cs +++ b/Buffs/Summon/CloudyWaifu.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class CloudyWaifu : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Cloud Elemental"); Description.SetDefault("The cloud elemental will protect you"); diff --git a/Buffs/Summon/ColdDivinityBuff.cs b/Buffs/Summon/ColdDivinityBuff.cs index e3e279d58b..c2aa09a431 100644 --- a/Buffs/Summon/ColdDivinityBuff.cs +++ b/Buffs/Summon/ColdDivinityBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Summon { public class ColdDivinityBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Cold Divinity"); Description.SetDefault("The magic of the ancient ice castle will aid you"); diff --git a/Buffs/Summon/Corroslime.cs b/Buffs/Summon/Corroslime.cs index 5f80a91696..b03c89b374 100644 --- a/Buffs/Summon/Corroslime.cs +++ b/Buffs/Summon/Corroslime.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class Corroslime : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Corroslime"); Description.SetDefault("The corroslime will protect you"); diff --git a/Buffs/Summon/CorvidHarbringerBuff.cs b/Buffs/Summon/CorvidHarbringerBuff.cs index 84ae1f4c6e..f5e0b5418b 100644 --- a/Buffs/Summon/CorvidHarbringerBuff.cs +++ b/Buffs/Summon/CorvidHarbringerBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class CorvidHarbringerBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Raven"); Description.SetDefault("The powerful raven will protect you"); diff --git a/Buffs/Summon/CosmicEnergy.cs b/Buffs/Summon/CosmicEnergy.cs index 363167631a..0a97bb9df5 100644 --- a/Buffs/Summon/CosmicEnergy.cs +++ b/Buffs/Summon/CosmicEnergy.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class CosmicEnergy : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Energy"); Description.SetDefault("The cosmic energy will protect you"); diff --git a/Buffs/Summon/CosmicViperEngineBuff.cs b/Buffs/Summon/CosmicViperEngineBuff.cs index a61500b0cf..88048c03c3 100644 --- a/Buffs/Summon/CosmicViperEngineBuff.cs +++ b/Buffs/Summon/CosmicViperEngineBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class CosmicViperEngineBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Viper"); Description.SetDefault("The cosmic gunship will protect you"); diff --git a/Buffs/Summon/CosmilampBuff.cs b/Buffs/Summon/CosmilampBuff.cs index ac57e51f9b..5879df05fe 100644 --- a/Buffs/Summon/CosmilampBuff.cs +++ b/Buffs/Summon/CosmilampBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class CosmilampBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmilamp"); Description.SetDefault("The cosmilamp will protect you"); diff --git a/Buffs/Summon/Crimslime.cs b/Buffs/Summon/Crimslime.cs index 4f89aa5702..dd0c768536 100644 --- a/Buffs/Summon/Crimslime.cs +++ b/Buffs/Summon/Crimslime.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class Crimslime : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Crimslime"); Description.SetDefault("The crimslime will protect you"); diff --git a/Buffs/Summon/DaedalusGolemBuff.cs b/Buffs/Summon/DaedalusGolemBuff.cs index 6c0972e123..26ae4656d1 100644 --- a/Buffs/Summon/DaedalusGolemBuff.cs +++ b/Buffs/Summon/DaedalusGolemBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class DaedalusGolemBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Daedalus Golem"); Description.SetDefault("A crystal golem is following you"); diff --git a/Buffs/Summon/DaedalusSummonSetBuff.cs b/Buffs/Summon/DaedalusSummonSetBuff.cs index 0d15f66d40..c2feb40cff 100644 --- a/Buffs/Summon/DaedalusSummonSetBuff.cs +++ b/Buffs/Summon/DaedalusSummonSetBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class DaedalusSummonSetBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Daedalus Crystal"); Description.SetDefault("The daedalus crystal will protect you"); diff --git a/Buffs/Summon/DankCreeperBuff.cs b/Buffs/Summon/DankCreeperBuff.cs index b46d4c6f1b..690e28a01a 100644 --- a/Buffs/Summon/DankCreeperBuff.cs +++ b/Buffs/Summon/DankCreeperBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class DankCreeperBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Dank Creeper"); Description.SetDefault("The dank creeper will protect you"); diff --git a/Buffs/Summon/DazzlingStabberBuff.cs b/Buffs/Summon/DazzlingStabberBuff.cs index e6fd71bff4..378be5e2c0 100644 --- a/Buffs/Summon/DazzlingStabberBuff.cs +++ b/Buffs/Summon/DazzlingStabberBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class DazzlingStabberBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Dazzling Stabber"); Description.SetDefault("En garde"); diff --git a/Buffs/Summon/DeathstareBuff.cs b/Buffs/Summon/DeathstareBuff.cs index 8c3de83967..26e35a5088 100644 --- a/Buffs/Summon/DeathstareBuff.cs +++ b/Buffs/Summon/DeathstareBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class DeathstareBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Miniature Eye of Cthulhu"); Description.SetDefault("It's watching you"); diff --git a/Buffs/Summon/DemonshadeSetDevilBuff.cs b/Buffs/Summon/DemonshadeSetDevilBuff.cs index 24efeacef1..e2f63e56f9 100644 --- a/Buffs/Summon/DemonshadeSetDevilBuff.cs +++ b/Buffs/Summon/DemonshadeSetDevilBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class DemonshadeSetDevilBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Red Devil"); Description.SetDefault("The red devil will protect you"); diff --git a/Buffs/Summon/DormantBrimseekerBuff.cs b/Buffs/Summon/DormantBrimseekerBuff.cs index 00e572c307..ad0e99e123 100644 --- a/Buffs/Summon/DormantBrimseekerBuff.cs +++ b/Buffs/Summon/DormantBrimseekerBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class DormantBrimseekerBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimseeker"); Description.SetDefault("Does it want something from you?"); diff --git a/Buffs/Summon/ElementalAxeBuff.cs b/Buffs/Summon/ElementalAxeBuff.cs index 56e668a49c..0ca8740ca7 100644 --- a/Buffs/Summon/ElementalAxeBuff.cs +++ b/Buffs/Summon/ElementalAxeBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class ElementalAxeBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Axe"); Description.SetDefault("The elemental axe will protect you"); diff --git a/Buffs/Summon/EndoCooperBuff.cs b/Buffs/Summon/EndoCooperBuff.cs index 980a6fe36a..1a81e07d0f 100644 --- a/Buffs/Summon/EndoCooperBuff.cs +++ b/Buffs/Summon/EndoCooperBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class EndoCooperBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Endo Cooper"); Description.SetDefault("The ascened Cooper will protect you"); diff --git a/Buffs/Summon/EndoHydraBuff.cs b/Buffs/Summon/EndoHydraBuff.cs index 587195156d..d2dfdd0b7b 100644 --- a/Buffs/Summon/EndoHydraBuff.cs +++ b/Buffs/Summon/EndoHydraBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class EndoHydraBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Endo Hydra"); Description.SetDefault("The endo hydra will protect you... for some reason"); diff --git a/Buffs/Summon/EyeOfNightBuff.cs b/Buffs/Summon/EyeOfNightBuff.cs index f820b55ad0..b8921f043c 100644 --- a/Buffs/Summon/EyeOfNightBuff.cs +++ b/Buffs/Summon/EyeOfNightBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class EyeOfNightBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Eye of Night"); Description.SetDefault("It eerily watches"); diff --git a/Buffs/Summon/FleshOfInfidelityBuff.cs b/Buffs/Summon/FleshOfInfidelityBuff.cs index 2d55ee5230..79676b413f 100644 --- a/Buffs/Summon/FleshOfInfidelityBuff.cs +++ b/Buffs/Summon/FleshOfInfidelityBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class FleshOfInfidelityBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Flesh Ball"); Description.SetDefault("Why is it following you?"); diff --git a/Buffs/Summon/FlowersOfMortalityBuff.cs b/Buffs/Summon/FlowersOfMortalityBuff.cs index a27ece7655..c57efa4333 100644 --- a/Buffs/Summon/FlowersOfMortalityBuff.cs +++ b/Buffs/Summon/FlowersOfMortalityBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class FlowersOfMortalityBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Flowers of Mortality"); Description.SetDefault("Celestial blossoms surround you"); diff --git a/Buffs/Summon/FrostBlossomBuff.cs b/Buffs/Summon/FrostBlossomBuff.cs index b32c24d843..4f4dc15259 100644 --- a/Buffs/Summon/FrostBlossomBuff.cs +++ b/Buffs/Summon/FrostBlossomBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class FrostBlossomBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Frost Blossom"); Description.SetDefault("A cold, prickly flower is floating uncomfortably close to you"); diff --git a/Buffs/Summon/FuelCellBundleBuff.cs b/Buffs/Summon/FuelCellBundleBuff.cs index 98f65a67d4..15c48348c2 100644 --- a/Buffs/Summon/FuelCellBundleBuff.cs +++ b/Buffs/Summon/FuelCellBundleBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class FuelCellBundleBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Mini Plaguebringer"); Description.SetDefault("A small plague bee is following you"); diff --git a/Buffs/Summon/FungalClumpBuff.cs b/Buffs/Summon/FungalClumpBuff.cs index d924b87111..3288fe9f5d 100644 --- a/Buffs/Summon/FungalClumpBuff.cs +++ b/Buffs/Summon/FungalClumpBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class FungalClumpBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Fungal Clump"); Description.SetDefault("The fungal clump will protect you"); diff --git a/Buffs/Summon/GammaHeadBuff.cs b/Buffs/Summon/GammaHeadBuff.cs index 18ce2b5b88..819215c1a8 100644 --- a/Buffs/Summon/GammaHeadBuff.cs +++ b/Buffs/Summon/GammaHeadBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class GammaHeadBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Gamma Hydra"); Description.SetDefault("..."); diff --git a/Buffs/Summon/GastricBelcherBuff.cs b/Buffs/Summon/GastricBelcherBuff.cs index 44a310395c..7290ed07cc 100644 --- a/Buffs/Summon/GastricBelcherBuff.cs +++ b/Buffs/Summon/GastricBelcherBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class GastricBelcherBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Gastric Aberration"); Description.SetDefault("The aquatic aberration will protect you"); diff --git a/Buffs/Summon/GladiatorSwords.cs b/Buffs/Summon/GladiatorSwords.cs index 8737258f8b..a43cc61c03 100644 --- a/Buffs/Summon/GladiatorSwords.cs +++ b/Buffs/Summon/GladiatorSwords.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class GladiatorSwords : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Gladiator Swords"); Description.SetDefault("The gladiator swords will protect you"); diff --git a/Buffs/Summon/HauntedDishesBuff.cs b/Buffs/Summon/HauntedDishesBuff.cs index fb4d76beae..7bfbe7b6a3 100644 --- a/Buffs/Summon/HauntedDishesBuff.cs +++ b/Buffs/Summon/HauntedDishesBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class HauntedDishesBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Haunted Dishes"); Description.SetDefault("The haunted dishes will protect you"); diff --git a/Buffs/Summon/HermitCrab.cs b/Buffs/Summon/HermitCrab.cs index 747f206bce..ddeeccb026 100644 --- a/Buffs/Summon/HermitCrab.cs +++ b/Buffs/Summon/HermitCrab.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class HermitCrab : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Hermit Crab"); Description.SetDefault("The hermit crab will protect you"); diff --git a/Buffs/Summon/Herring.cs b/Buffs/Summon/Herring.cs index 1419a878cf..43a5e6fcfa 100644 --- a/Buffs/Summon/Herring.cs +++ b/Buffs/Summon/Herring.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class Herring : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Herring"); Description.SetDefault("The herring will protect you"); diff --git a/Buffs/Summon/HotE.cs b/Buffs/Summon/HotE.cs index 5d245e95c3..b6d5333f7d 100644 --- a/Buffs/Summon/HotE.cs +++ b/Buffs/Summon/HotE.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Buffs.Summon { public class HotE : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Heart of the Elements"); Description.SetDefault("All elementals will protect you"); diff --git a/Buffs/Summon/HowlTrio.cs b/Buffs/Summon/HowlTrio.cs index be1c1bf911..8f9164ef12 100644 --- a/Buffs/Summon/HowlTrio.cs +++ b/Buffs/Summon/HowlTrio.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class HowlTrio : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Howl's Heart"); Description.SetDefault("Howl protects you, Calcifer lights your way, Turnip-Head stalks you"); diff --git a/Buffs/Summon/IceClasperBuff.cs b/Buffs/Summon/IceClasperBuff.cs index d24013c214..ce1b8848ad 100644 --- a/Buffs/Summon/IceClasperBuff.cs +++ b/Buffs/Summon/IceClasperBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class IceClasperBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Ice Clasper"); Description.SetDefault("The ice clasper will protect you"); diff --git a/Buffs/Summon/IgneousExaltationBuff.cs b/Buffs/Summon/IgneousExaltationBuff.cs index f813278cca..6ddb07e185 100644 --- a/Buffs/Summon/IgneousExaltationBuff.cs +++ b/Buffs/Summon/IgneousExaltationBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class IgneousExaltationBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Igneous Blade"); Description.SetDefault("A blade is orbiting you"); diff --git a/Buffs/Summon/MagicHatBuff.cs b/Buffs/Summon/MagicHatBuff.cs index 7fc47d1781..5541ad15c0 100644 --- a/Buffs/Summon/MagicHatBuff.cs +++ b/Buffs/Summon/MagicHatBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class MagicHatBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Magic Hat"); Description.SetDefault("The hat carries your soul, bound by a contract"); diff --git a/Buffs/Summon/Mechworm.cs b/Buffs/Summon/Mechworm.cs index e988eef205..7cbe284e9e 100644 --- a/Buffs/Summon/Mechworm.cs +++ b/Buffs/Summon/Mechworm.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class Mechworm : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Mechworm"); Description.SetDefault("The mechworm will protect you"); diff --git a/Buffs/Summon/MidnightSunBuff.cs b/Buffs/Summon/MidnightSunBuff.cs index 09ed5b4817..f5b3f9587f 100644 --- a/Buffs/Summon/MidnightSunBuff.cs +++ b/Buffs/Summon/MidnightSunBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class MidnightSunBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Midnight Sun UFO"); Description.SetDefault("A strange UFO is observing you, and it's making you very uncomfortable"); diff --git a/Buffs/Summon/MountedScannerBuff.cs b/Buffs/Summon/MountedScannerBuff.cs index beed63ef08..26a5bf1e6d 100644 --- a/Buffs/Summon/MountedScannerBuff.cs +++ b/Buffs/Summon/MountedScannerBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class MountedScannerBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Mounted Scanner"); Description.SetDefault("Powerful machinery surrounds you"); diff --git a/Buffs/Summon/MutatedTruffleBuff.cs b/Buffs/Summon/MutatedTruffleBuff.cs index 1e39a968db..246d9f722e 100644 --- a/Buffs/Summon/MutatedTruffleBuff.cs +++ b/Buffs/Summon/MutatedTruffleBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class MutatedTruffleBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Mini Old Duke"); Description.SetDefault("The young duke will protect you"); diff --git a/Buffs/Summon/PerditionBuff.cs b/Buffs/Summon/PerditionBuff.cs index 8e3093b182..c375b95247 100644 --- a/Buffs/Summon/PerditionBuff.cs +++ b/Buffs/Summon/PerditionBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class PerditionBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Perdition"); Description.SetDefault("How unfortunate"); diff --git a/Buffs/Summon/Phantom.cs b/Buffs/Summon/Phantom.cs index 67e796f3c9..084a245950 100644 --- a/Buffs/Summon/Phantom.cs +++ b/Buffs/Summon/Phantom.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class Phantom : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Phantom"); Description.SetDefault("The phantom will protect you"); diff --git a/Buffs/Summon/PlaguePrincessBuff.cs b/Buffs/Summon/PlaguePrincessBuff.cs index f51ade2569..ff2ff2bc34 100644 --- a/Buffs/Summon/PlaguePrincessBuff.cs +++ b/Buffs/Summon/PlaguePrincessBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class PlaguePrincessBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Virili"); Description.SetDefault("It’s a shame you can’t hug her"); diff --git a/Buffs/Summon/PlaguebringerSummonBuff.cs b/Buffs/Summon/PlaguebringerSummonBuff.cs index 476fd7c502..887ee4e0e4 100644 --- a/Buffs/Summon/PlaguebringerSummonBuff.cs +++ b/Buffs/Summon/PlaguebringerSummonBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class PlaguebringerSummonBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Lil' Plaguebringer"); Description.SetDefault("The plaguebringer will protect you"); diff --git a/Buffs/Summon/PlantationBuff.cs b/Buffs/Summon/PlantationBuff.cs index 9f007ec5f9..f7a97d7c90 100644 --- a/Buffs/Summon/PlantationBuff.cs +++ b/Buffs/Summon/PlantationBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class PlantationBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Plantation"); Description.SetDefault("The miniature plantera will protect you"); diff --git a/Buffs/Summon/PoleWarperBuff.cs b/Buffs/Summon/PoleWarperBuff.cs index ec0c17c7d2..0de2f81d33 100644 --- a/Buffs/Summon/PoleWarperBuff.cs +++ b/Buffs/Summon/PoleWarperBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class PoleWarperBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Pole Warper"); Description.SetDefault("Sentient magnets are attracted to you"); diff --git a/Buffs/Summon/ProfanedBabs.cs b/Buffs/Summon/ProfanedBabs.cs index 403e5b11aa..6471437d45 100644 --- a/Buffs/Summon/ProfanedBabs.cs +++ b/Buffs/Summon/ProfanedBabs.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class ProfanedBabs : ModBuff //Buff name is reference to how I refer to the guardians as my babs ~Amber { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("The Profaned Soul"); Description.SetDefault("The healer will heal your wounds!"); diff --git a/Buffs/Summon/RadiantResolutionBuff.cs b/Buffs/Summon/RadiantResolutionBuff.cs index 17522338eb..f35205ee9b 100644 --- a/Buffs/Summon/RadiantResolutionBuff.cs +++ b/Buffs/Summon/RadiantResolutionBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class RadiantResolutionBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Saros Possession"); Description.SetDefault("A radiant aura protects you"); diff --git a/Buffs/Summon/ResurrectionButterflyBuff.cs b/Buffs/Summon/ResurrectionButterflyBuff.cs index c0ea1d68ad..3813476ccd 100644 --- a/Buffs/Summon/ResurrectionButterflyBuff.cs +++ b/Buffs/Summon/ResurrectionButterflyBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class ResurrectionButterflyBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Resurrection Butterfly"); Description.SetDefault("Sleep beneath the Cherry Blossoms, Red-White Butterfly"); diff --git a/Buffs/Summon/RustyDroneBuff.cs b/Buffs/Summon/RustyDroneBuff.cs index fb32c86e9e..52d0523a06 100644 --- a/Buffs/Summon/RustyDroneBuff.cs +++ b/Buffs/Summon/RustyDroneBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class RustyDroneBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Rusty Drone"); Description.SetDefault("A pitifully fragile drone is observing you"); diff --git a/Buffs/Summon/SageSpiritBuff.cs b/Buffs/Summon/SageSpiritBuff.cs index 68d211a2f5..35730b5262 100644 --- a/Buffs/Summon/SageSpiritBuff.cs +++ b/Buffs/Summon/SageSpiritBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class SageSpiritBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Sage Spirit"); Description.SetDefault("It's uncomfortably close"); diff --git a/Buffs/Summon/Sandnado.cs b/Buffs/Summon/Sandnado.cs index ae18616a31..7a4e8eea9b 100644 --- a/Buffs/Summon/Sandnado.cs +++ b/Buffs/Summon/Sandnado.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class Sandnado : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Sandnado"); Description.SetDefault("The sandnado will protect you"); diff --git a/Buffs/Summon/SandyHealingWaifu.cs b/Buffs/Summon/SandyHealingWaifu.cs index 6c3f232602..aa2d7a9384 100644 --- a/Buffs/Summon/SandyHealingWaifu.cs +++ b/Buffs/Summon/SandyHealingWaifu.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class SandyHealingWaifu : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Rare Sand Elemental"); Description.SetDefault("The sand elemental will heal you"); diff --git a/Buffs/Summon/SandyWaifu.cs b/Buffs/Summon/SandyWaifu.cs index f67eb2b2be..920a079719 100644 --- a/Buffs/Summon/SandyWaifu.cs +++ b/Buffs/Summon/SandyWaifu.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class SandyWaifu : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Sand Elemental"); Description.SetDefault("The sand elemental will protect you"); diff --git a/Buffs/Summon/ScabRipperBuff.cs b/Buffs/Summon/ScabRipperBuff.cs index 45dd9e96b0..63e05fb4f3 100644 --- a/Buffs/Summon/ScabRipperBuff.cs +++ b/Buffs/Summon/ScabRipperBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Summon { public class ScabRipperBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Baby Blood Crawler"); Description.SetDefault("The baby blood crawler will protect you"); diff --git a/Buffs/Summon/SepulcherMinionBuff.cs b/Buffs/Summon/SepulcherMinionBuff.cs index ed1a18e8ac..788a7121b8 100644 --- a/Buffs/Summon/SepulcherMinionBuff.cs +++ b/Buffs/Summon/SepulcherMinionBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class SepulcherMinionBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Sepulcher"); Description.SetDefault("It is not benevolent"); diff --git a/Buffs/Summon/ShellfishBuff.cs b/Buffs/Summon/ShellfishBuff.cs index a70b954563..a63d9f1580 100644 --- a/Buffs/Summon/ShellfishBuff.cs +++ b/Buffs/Summon/ShellfishBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class ShellfishBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Shellfish"); Description.SetDefault("The shellfish will protect you"); diff --git a/Buffs/Summon/SilvaSummonSetBuff.cs b/Buffs/Summon/SilvaSummonSetBuff.cs index 50e63dcd63..0bf1b7fa57 100644 --- a/Buffs/Summon/SilvaSummonSetBuff.cs +++ b/Buffs/Summon/SilvaSummonSetBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class SilvaSummonSetBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Silva Crystal"); Description.SetDefault("The crystal will protect you"); diff --git a/Buffs/Summon/SiriusBuff.cs b/Buffs/Summon/SiriusBuff.cs index 556d02204e..6479f9010f 100644 --- a/Buffs/Summon/SiriusBuff.cs +++ b/Buffs/Summon/SiriusBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class SiriusBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Sirius"); Description.SetDefault("A bit too bright, but it helps you"); diff --git a/Buffs/Summon/SnakeEyesBuff.cs b/Buffs/Summon/SnakeEyesBuff.cs index a27dfc6047..f9fe2de3df 100644 --- a/Buffs/Summon/SnakeEyesBuff.cs +++ b/Buffs/Summon/SnakeEyesBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class SnakeEyesBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Snake Eyes"); Description.SetDefault("Always watching..."); diff --git a/Buffs/Summon/SolarSpirit.cs b/Buffs/Summon/SolarSpirit.cs index 63b94c2477..933e8e0cae 100644 --- a/Buffs/Summon/SolarSpirit.cs +++ b/Buffs/Summon/SolarSpirit.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class SolarSpirit : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Solar Spirit"); Description.SetDefault("The solar spirit will protect you"); diff --git a/Buffs/Summon/SolarSpiritGod.cs b/Buffs/Summon/SolarSpiritGod.cs index d6cd9098de..86b653723d 100644 --- a/Buffs/Summon/SolarSpiritGod.cs +++ b/Buffs/Summon/SolarSpiritGod.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class SolarSpiritGod : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Solar God Spirit"); Description.SetDefault("The solar god spirit will protect you"); diff --git a/Buffs/Summon/SoulSeekerBuff.cs b/Buffs/Summon/SoulSeekerBuff.cs index 68d7ff322d..ae049893a8 100644 --- a/Buffs/Summon/SoulSeekerBuff.cs +++ b/Buffs/Summon/SoulSeekerBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class SoulSeekerBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Soul Seeker"); Description.SetDefault("It definitely wants something from you"); diff --git a/Buffs/Summon/StaffOfNecrosteocytesBuff.cs b/Buffs/Summon/StaffOfNecrosteocytesBuff.cs index 67da8ca383..9d76fa02d1 100644 --- a/Buffs/Summon/StaffOfNecrosteocytesBuff.cs +++ b/Buffs/Summon/StaffOfNecrosteocytesBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class StaffOfNecrosteocytesBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Small Skeleton"); Description.SetDefault("A skeleton is observing you"); diff --git a/Buffs/Summon/StarSwallowerBuff.cs b/Buffs/Summon/StarSwallowerBuff.cs index 2bfc20882e..270c79b461 100644 --- a/Buffs/Summon/StarSwallowerBuff.cs +++ b/Buffs/Summon/StarSwallowerBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class StarSwallowerBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Star Swallower"); Description.SetDefault("Mmmm myes"); diff --git a/Buffs/Summon/StatigelSummonSetBuff.cs b/Buffs/Summon/StatigelSummonSetBuff.cs index adb050f6b2..f9d631949a 100644 --- a/Buffs/Summon/StatigelSummonSetBuff.cs +++ b/Buffs/Summon/StatigelSummonSetBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class StatigelSummonSetBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Baby Slime God"); Description.SetDefault("The slime god will protect you"); diff --git a/Buffs/Summon/StormjawBuff.cs b/Buffs/Summon/StormjawBuff.cs index dc2db86111..983e991412 100644 --- a/Buffs/Summon/StormjawBuff.cs +++ b/Buffs/Summon/StormjawBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class StormjawBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Baby Stormlion"); Description.SetDefault("The baby stormlion will protect you"); diff --git a/Buffs/Summon/TacticalPlagueEngineBuff.cs b/Buffs/Summon/TacticalPlagueEngineBuff.cs index 79c38a7a82..6440e5d9fc 100644 --- a/Buffs/Summon/TacticalPlagueEngineBuff.cs +++ b/Buffs/Summon/TacticalPlagueEngineBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class TacticalPlagueEngineBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Tactical Plague Engine"); Description.SetDefault("A giant plague jet is following you"); diff --git a/Buffs/Summon/TundraFlameBlossomsBuff.cs b/Buffs/Summon/TundraFlameBlossomsBuff.cs index 8dde3986a9..f487ea6d7c 100644 --- a/Buffs/Summon/TundraFlameBlossomsBuff.cs +++ b/Buffs/Summon/TundraFlameBlossomsBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class TundraFlameBlossomsBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Tundra Flame Blossom"); Description.SetDefault("A perfect unison of balance and beauty"); diff --git a/Buffs/Summon/VictideSummonSetBuff.cs b/Buffs/Summon/VictideSummonSetBuff.cs index 708484f760..06d6e1fb52 100644 --- a/Buffs/Summon/VictideSummonSetBuff.cs +++ b/Buffs/Summon/VictideSummonSetBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class VictideSummonSetBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Urchin"); Description.SetDefault("The urchin will protect you"); diff --git a/Buffs/Summon/VileFeederBuff.cs b/Buffs/Summon/VileFeederBuff.cs index 9b11e86a47..bbe2b7e938 100644 --- a/Buffs/Summon/VileFeederBuff.cs +++ b/Buffs/Summon/VileFeederBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class VileFeederBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Vile Feeder"); Description.SetDefault("The baby eater of souls will protect you"); diff --git a/Buffs/Summon/ViridVanguardBuff.cs b/Buffs/Summon/ViridVanguardBuff.cs index ef7f387078..a304218317 100644 --- a/Buffs/Summon/ViridVanguardBuff.cs +++ b/Buffs/Summon/ViridVanguardBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class ViridVanguardBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Virid Vanguard"); Description.SetDefault("A perfect act of unity surrounds you"); diff --git a/Buffs/Summon/VoidConcentrationBuff.cs b/Buffs/Summon/VoidConcentrationBuff.cs index e1bf0ed474..28b9b62d39 100644 --- a/Buffs/Summon/VoidConcentrationBuff.cs +++ b/Buffs/Summon/VoidConcentrationBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { class VoidConcentrationBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Concentrated Void"); Description.SetDefault("The infinite void yearns for more..."); @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.Summon { CalamityPlayer mp = player.Calamity(); int count = player.ownedProjectileCounts[ModContent.ProjectileType()]; - player.minionDamage += 0.05f; //5% + player.GetDamage(DamageClass.Summon) += 0.05f; //5% mp.voidConcentrationAura = true; if (!mp.voidAuraDamage && count == 0) { diff --git a/Buffs/Summon/WaterWaifu.cs b/Buffs/Summon/WaterWaifu.cs index 380fd4c672..12096f117d 100644 --- a/Buffs/Summon/WaterWaifu.cs +++ b/Buffs/Summon/WaterWaifu.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class WaterWaifu : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Anahita"); Description.SetDefault("Anahita will protect you"); diff --git a/Buffs/Summon/WitherBlossomsBuff.cs b/Buffs/Summon/WitherBlossomsBuff.cs index 2518bc18a0..ae0d67a137 100644 --- a/Buffs/Summon/WitherBlossomsBuff.cs +++ b/Buffs/Summon/WitherBlossomsBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class WitherBlossomsBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Wither Blossoms"); Description.SetDefault("Pestilence surrounds you"); diff --git a/Buffs/Summon/WulfrumDroidBuff.cs b/Buffs/Summon/WulfrumDroidBuff.cs index 89352151c3..b25ea3161b 100644 --- a/Buffs/Summon/WulfrumDroidBuff.cs +++ b/Buffs/Summon/WulfrumDroidBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class WulfrumDroidBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Droid"); Description.SetDefault("The wulfrum droid will protect you"); diff --git a/Buffs/Summon/YharonKindleBuff.cs b/Buffs/Summon/YharonKindleBuff.cs index d885cf3bde..5253d12afc 100644 --- a/Buffs/Summon/YharonKindleBuff.cs +++ b/Buffs/Summon/YharonKindleBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Summon { public class YharonKindleBuff : ModBuff { - public override void SetDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Fiery Draconid"); Description.SetDefault("The fiery draconid will protect you"); diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 55ea23bc60..8530f59788 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -77,6 +77,7 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.IO; +using Terraria.Audio; namespace CalamityMod.CalPlayer { @@ -804,7 +805,7 @@ namespace CalamityMod.CalPlayer get { if (gemTechState is null || gemTechState.HasInvalidOwner) - gemTechState = new GemTechArmorState(player.whoAmI); + gemTechState = new GemTechArmorState(Player.whoAmI); return gemTechState; } set => gemTechState = value; @@ -1456,7 +1457,7 @@ namespace CalamityMod.CalPlayer KeyValuePair kv = tagIterator.Current; string id = kv.Key; TagCompound singleCDTag = cooldownsTag.GetCompound(id); - CooldownInstance instance = new CooldownInstance(player, id, singleCDTag); + CooldownInstance instance = new CooldownInstance(Player, id, singleCDTag); cooldowns.Add(id, instance); } } @@ -1467,24 +1468,24 @@ namespace CalamityMod.CalPlayer { // Max health bonuses if (absorber) - player.statLifeMax2 += sponge ? 30 : 20; - player.statLifeMax2 += + Player.statLifeMax2 += sponge ? 30 : 20; + Player.statLifeMax2 += (mFruit ? 25 : 0) + (bOrange ? 25 : 0) + (eBerry ? 25 : 0) + (dFruit ? 25 : 0); if (fleshKnuckles) - player.statLifeMax2 += 45; + Player.statLifeMax2 += 45; if (ZoneAbyss && abyssalAmulet) - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * (lumenousAmulet ? 25 : 10); + Player.statLifeMax2 += Player.statLifeMax2 / 5 / 20 * (lumenousAmulet ? 25 : 10); if (coreOfTheBloodGod) - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 10; + Player.statLifeMax2 += Player.statLifeMax2 / 5 / 20 * 10; if (bloodPact) - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 100; + Player.statLifeMax2 += Player.statLifeMax2 / 5 / 20 * 100; if (affliction || afflicted) - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 10; + Player.statLifeMax2 += Player.statLifeMax / 5 / 20 * 10; if (cadence) - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 25; + Player.statLifeMax2 += Player.statLifeMax / 5 / 20 * 25; if (community) { float floatTypeBoost = 0.05f + @@ -1504,28 +1505,28 @@ namespace CalamityMod.CalPlayer (CalamityWorld.downedDoG ? 0.01f : 0f) + (CalamityWorld.downedYharon ? 0.01f : 0f); // 0.2 int integerTypeBoost = (int)(floatTypeBoost * 50f); - player.statLifeMax2 += player.statLifeMax / 5 / 20 * integerTypeBoost; + Player.statLifeMax2 += Player.statLifeMax / 5 / 20 * integerTypeBoost; } // Shattered Community gives the same max health boost as normal full-power Community (10%) if (shatteredCommunity) - player.statLifeMax2 += (player.statLifeMax / 5 / 10) * 5; + Player.statLifeMax2 += (Player.statLifeMax / 5 / 10) * 5; // Max health reductions if (crimEffigy) - player.statLifeMax2 = (int)(player.statLifeMax2 * 0.9); + Player.statLifeMax2 = (int)(Player.statLifeMax2 * 0.9); if (regenator) - player.statLifeMax2 = (int)(player.statLifeMax2 * 0.5); + Player.statLifeMax2 = (int)(Player.statLifeMax2 * 0.5); // Extra accessory slots // This is probably fucked in 1.4 if (extraAccessoryML) - player.extraAccessorySlots = 1; - if (extraAccessoryML && player.extraAccessory && (Main.expertMode || Main.gameMenu)) - player.extraAccessorySlots = 2; + Player.extraAccessorySlots = 1; + if (extraAccessoryML && Player.extraAccessory && (Main.expertMode || Main.gameMenu)) + Player.extraAccessorySlots = 2; if (BossRushEvent.BossRushActive) { if (CalamityConfig.Instance.BossRushAccessoryCurse) - player.extraAccessorySlots = 0; + Player.extraAccessorySlots = 0; } ResetRogueStealth(); @@ -2172,8 +2173,8 @@ namespace CalamityMod.CalPlayer AbleToSelectExoMech = false; - EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem()); - BaseIdleHoldoutProjectile.CheckForEveryHoldout(player); + EnchantHeldItemEffects(Player, Player.Calamity(), Player.ActiveItem()); + BaseIdleHoldoutProjectile.CheckForEveryHoldout(Player); } #endregion @@ -2576,16 +2577,16 @@ namespace CalamityMod.CalPlayer if (BossRushEvent.BossRushActive) { - if (player.whoAmI == 0 && !CalamityGlobalNPC.AnyLivingPlayers() && CalamityUtils.CountProjectiles(ModContent.ProjectileType()) == 0) - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); + if (Player.whoAmI == 0 && !CalamityGlobalNPC.AnyLivingPlayers() && CalamityUtils.CountProjectiles(ModContent.ProjectileType()) == 0) + Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); } - if (player.respawnTimer > 300) + if (Player.respawnTimer > 300) { if (CalamityWorld.armageddon && !areThereAnyDamnBosses) - player.respawnTimer -= 5; + Player.respawnTimer -= 5; else if (Main.expertMode) // 600 normal 900 expert - player.respawnTimer--; + Player.respawnTimer--; } } #endregion @@ -2617,68 +2618,68 @@ namespace CalamityMod.CalPlayer } bool useNebula = NPC.AnyNPCs(ModContent.NPCType()); - player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHead", useNebula); + Player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHead", useNebula); bool useFlash = NPC.AnyNPCs(ModContent.NPCType()); if (SkyManager.Instance["CalamityMod:StormWeaverFlash"] != null && useFlash != SkyManager.Instance["CalamityMod:StormWeaverFlash"].IsActive()) { if (useFlash) - SkyManager.Instance.Activate("CalamityMod:StormWeaverFlash", player.Center); + SkyManager.Instance.Activate("CalamityMod:StormWeaverFlash", Player.Center); else SkyManager.Instance.Deactivate("CalamityMod:StormWeaverFlash"); } bool useBrimstone = NPC.AnyNPCs(ModContent.NPCType()); - player.ManageSpecialBiomeVisuals("CalamityMod:CalamitasRun3", useBrimstone); + Player.ManageSpecialBiomeVisuals("CalamityMod:CalamitasRun3", useBrimstone); bool usePlague = NPC.AnyNPCs(ModContent.NPCType()); - player.ManageSpecialBiomeVisuals("CalamityMod:PlaguebringerGoliath", usePlague); + Player.ManageSpecialBiomeVisuals("CalamityMod:PlaguebringerGoliath", usePlague); bool useCryogen = NPC.AnyNPCs(ModContent.NPCType()); if (SkyManager.Instance["CalamityMod:Cryogen"] != null && useCryogen != SkyManager.Instance["CalamityMod:Cryogen"].IsActive()) { if (useCryogen) - SkyManager.Instance.Activate("CalamityMod:Cryogen", player.Center); + SkyManager.Instance.Activate("CalamityMod:Cryogen", Player.Center); else SkyManager.Instance.Deactivate("CalamityMod:Cryogen"); } bool useExoMechs = ExoMechsSky.CanSkyBeActive; - player.ManageSpecialBiomeVisuals("CalamityMod:ExoMechs", useExoMechs); + Player.ManageSpecialBiomeVisuals("CalamityMod:ExoMechs", useExoMechs); if (useExoMechs) - SkyManager.Instance.Activate("CalamityMod:ExoMechs", player.Center); + SkyManager.Instance.Activate("CalamityMod:ExoMechs", Player.Center); else SkyManager.Instance.Deactivate("CalamityMod:ExoMechs"); - Point point = player.Center.ToTileCoordinates(); + Point point = Player.Center.ToTileCoordinates(); bool aboveGround = point.Y > Main.maxTilesY - 320; - bool overworld = player.ZoneOverworldHeight && (point.X < 380 || point.X > Main.maxTilesX - 380); + bool overworld = Player.ZoneOverworldHeight && (point.X < 380 || point.X > Main.maxTilesX - 380); bool useFire = NPC.AnyNPCs(ModContent.NPCType()); - player.ManageSpecialBiomeVisuals("CalamityMod:Yharon", useFire); - player.ManageSpecialBiomeVisuals("HeatDistortion", Main.UseHeatDistortion && (useFire || trippy || - aboveGround || (point.Y < Main.worldSurface && player.ZoneDesert && !overworld && !Main.raining && !Filters.Scene["Sandstorm"].IsActive()))); + Player.ManageSpecialBiomeVisuals("CalamityMod:Yharon", useFire); + Player.ManageSpecialBiomeVisuals("HeatDistortion", Main.UseHeatDistortion && (useFire || trippy || + aboveGround || (point.Y < Main.worldSurface && Player.ZoneDesert && !overworld && !Main.raining && !Filters.Scene["Sandstorm"].IsActive()))); bool useWater = NPC.AnyNPCs(ModContent.NPCType()); - player.ManageSpecialBiomeVisuals("CalamityMod:Leviathan", useWater); + Player.ManageSpecialBiomeVisuals("CalamityMod:Leviathan", useWater); bool useHoly = NPC.AnyNPCs(ModContent.NPCType()); - player.ManageSpecialBiomeVisuals("CalamityMod:Providence", useHoly); + Player.ManageSpecialBiomeVisuals("CalamityMod:Providence", useHoly); bool useSBrimstone = NPC.AnyNPCs(ModContent.NPCType()) || SCalSky.OverridingIntensity > 0f; - player.ManageSpecialBiomeVisuals("CalamityMod:SupremeCalamitas", useSBrimstone); + Player.ManageSpecialBiomeVisuals("CalamityMod:SupremeCalamitas", useSBrimstone); bool useWyrmWater = NPC.AnyNPCs(ModContent.NPCType()); - player.ManageSpecialBiomeVisuals("CalamityMod:AdultEidolonWyrm", useWyrmWater); + Player.ManageSpecialBiomeVisuals("CalamityMod:AdultEidolonWyrm", useWyrmWater); bool inAstral = ZoneAstral; - player.ManageSpecialBiomeVisuals("CalamityMod:Astral", inAstral); + Player.ManageSpecialBiomeVisuals("CalamityMod:Astral", inAstral); CryogenSky.UpdateDrawEligibility(); if (SkyManager.Instance["CalamityMod:StormWeaverFlash"] != null && useFlash != SkyManager.Instance["CalamityMod:StormWeaverFlash"].IsActive()) { if (useFlash) - SkyManager.Instance.Activate("CalamityMod:StormWeaverFlash", player.Center); + SkyManager.Instance.Activate("CalamityMod:StormWeaverFlash", Player.Center); else SkyManager.Instance.Deactivate("CalamityMod:StormWeaverFlash"); } @@ -2686,9 +2687,9 @@ namespace CalamityMod.CalPlayer public override void UpdateBiomes() { - Point point = player.Center.ToTileCoordinates(); + Point point = Player.Center.ToTileCoordinates(); ZoneCalamity = CalamityWorld.calamityTiles > 50; - ZoneAstral = !player.ZoneDungeon && (CalamityWorld.astralTiles > 950 || (player.ZoneSnow && CalamityWorld.astralTiles > 300)); + ZoneAstral = !Player.ZoneDungeon && (CalamityWorld.astralTiles > 950 || (Player.ZoneSnow && CalamityWorld.astralTiles > 300)); ZoneSunkenSea = CalamityWorld.sunkenSeaTiles > 150; int x = Main.maxTilesX; @@ -2724,8 +2725,8 @@ namespace CalamityMod.CalPlayer } ZoneAbyss = point.Y > (Main.rockLayer - y * 0.05) && - !player.lavaWet && - !player.honeyWet && + !Player.lavaWet && + !Player.honeyWet && abyssPosY && abyssPosX; @@ -2743,11 +2744,11 @@ namespace CalamityMod.CalPlayer ZoneAbyssLayer4 = ZoneAbyss && point.Y > (Main.rockLayer + y * 0.26); - ZoneSulphur = (CalamityWorld.sulphurTiles >= 300 || (player.ZoneOverworldHeight && sulphurPosX)) && !ZoneAbyss; + ZoneSulphur = (CalamityWorld.sulphurTiles >= 300 || (Player.ZoneOverworldHeight && sulphurPosX)) && !ZoneAbyss; //Overriding 1.4's ass req boosts if (Main.snowTiles > 300) - player.ZoneSnow = true; + Player.ZoneSnow = true; } public override bool CustomBiomesMatch(Player other) @@ -2819,11 +2820,11 @@ namespace CalamityMod.CalPlayer { if (ZoneSulphur) { - return ModContent.GetTexture("CalamityMod/Backgrounds/MapBackgrounds/SulphurBG"); + return ModContent.Request("CalamityMod/Backgrounds/MapBackgrounds/SulphurBG"); } if (ZoneAstral) { - return ModContent.GetTexture("CalamityMod/Backgrounds/MapBackgrounds/AstralBG"); + return ModContent.Request("CalamityMod/Backgrounds/MapBackgrounds/AstralBG"); } return null; } @@ -2849,56 +2850,56 @@ namespace CalamityMod.CalPlayer #region HotKeys public override void ProcessTriggers(TriggersSet triggersSet) { - if (CalamityMod.MomentumCapacitatorHotkey.JustPressed && momentumCapacitor && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.3f && + if (CalamityMod.MomentumCapacitatorHotkey.JustPressed && momentumCapacitor && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.3f && wearingRogueArmor && rogueStealthMax > 0 && CalamityUtils.CountProjectiles(ModContent.ProjectileType()) == 0) { rogueStealth -= rogueStealthMax * 0.3f; Vector2 fieldSpawnCenter = new Vector2(Main.mouseX, Main.mouseY) + Main.screenPosition; - Projectile.NewProjectile(fieldSpawnCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(fieldSpawnCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, 0f, 0f); } - if (CalamityMod.NormalityRelocatorHotKey.JustPressed && normalityRelocator && Main.myPlayer == player.whoAmI) + if (CalamityMod.NormalityRelocatorHotKey.JustPressed && normalityRelocator && Main.myPlayer == Player.whoAmI) { - if (!player.CCed && !player.chaosState) + if (!Player.CCed && !Player.chaosState) { Vector2 teleportLocation; teleportLocation.X = (float)Main.mouseX + Main.screenPosition.X; - if (player.gravDir == 1f) + if (Player.gravDir == 1f) { - teleportLocation.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height; + teleportLocation.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)Player.height; } else { teleportLocation.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; } - teleportLocation.X -= (float)(player.width / 2); + teleportLocation.X -= (float)(Player.width / 2); if (teleportLocation.X > 50f && teleportLocation.X < (float)(Main.maxTilesX * 16 - 50) && teleportLocation.Y > 50f && teleportLocation.Y < (float)(Main.maxTilesY * 16 - 50)) { int x = (int)(teleportLocation.X / 16f); int y = (int)(teleportLocation.Y / 16f); - if (!Collision.SolidCollision(teleportLocation, player.width, player.height)) + if (!Collision.SolidCollision(teleportLocation, Player.width, Player.height)) { - player.Teleport(teleportLocation, 4, 0); - NetMessage.SendData(MessageID.Teleport, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); + Player.Teleport(teleportLocation, 4, 0); + NetMessage.SendData(MessageID.Teleport, -1, -1, null, 0, (float)Player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); int duration = chaosStateDuration; if (areThereAnyDamnBosses || areThereAnyDamnEvents) duration = (int)(chaosStateDurationBoss * 1.5); - if (player.HasCooldown(Cooldowns.EvasionScarf.ID)) + if (Player.HasCooldown(Cooldowns.EvasionScarf.ID)) duration = (int)(duration * 1.5); - else if (player.HasCooldown(Cooldowns.CounterScarf.ID)) + else if (Player.HasCooldown(Cooldowns.CounterScarf.ID)) duration *= 2; - player.AddBuff(BuffID.ChaosState, duration, true); + Player.AddBuff(BuffID.ChaosState, duration, true); // Add a cooldown here so it can have the custom NR icon - player.AddCooldown(ChaosState.ID, duration, true, "normalityrelocator"); + Player.AddCooldown(ChaosState.ID, duration, true, "normalityrelocator"); } } } } - if (CalamityMod.AngelicAllianceHotKey.JustPressed && angelicAlliance && Main.myPlayer == player.whoAmI && !divineBless && !player.HasCooldown(Cooldowns.DivineBless.ID)) + if (CalamityMod.AngelicAllianceHotKey.JustPressed && angelicAlliance && Main.myPlayer == Player.whoAmI && !divineBless && !Player.HasCooldown(Cooldowns.DivineBless.ID)) { int seconds = CalamityUtils.SecondsToFrames(15f); - player.AddBuff(ModContent.BuffType(), seconds, false); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/AngelicAllianceActivation"), player.Center); + Player.AddBuff(ModContent.BuffType(), seconds, false); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/AngelicAllianceActivation"), Player.Center); // Spawn an archangel for every minion you have float angelAmt = 0f; @@ -2907,7 +2908,7 @@ namespace CalamityMod.CalPlayer Projectile proj = Main.projectile[projIndex]; if (proj.minionSlots <= 0f || !proj.IsSummon()) continue; - if (proj.active && proj.owner == player.whoAmI) + if (proj.active && proj.owner == Player.whoAmI) { angelAmt += 1f; } @@ -2916,62 +2917,62 @@ namespace CalamityMod.CalPlayer { Projectile proj = Main.projectile[projIndex]; float start = 360f / angelAmt; - Projectile.NewProjectile(new Vector2((int)(player.Center.X + (Math.Sin(projIndex * start) * 300)), (int)(player.Center.Y + (Math.Cos(projIndex * start) * 300))), Vector2.Zero, ModContent.ProjectileType(), proj.damage / 4, proj.knockBack / 4f, player.whoAmI, Main.rand.Next(120), projIndex * start); - player.statLife += 2; - player.HealEffect(2); + Projectile.NewProjectile(new Vector2((int)(Player.Center.X + (Math.Sin(projIndex * start) * 300)), (int)(Player.Center.Y + (Math.Cos(projIndex * start) * 300))), Vector2.Zero, ModContent.ProjectileType(), proj.damage / 4, proj.knockBack / 4f, Player.whoAmI, Main.rand.Next(120), projIndex * start); + Player.statLife += 2; + Player.HealEffect(2); } } - if (CalamityMod.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && - wearingRogueArmor && rogueStealthMax > 0 && !player.HasCooldown(Cooldowns.SandCloak.ID)) + if (CalamityMod.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && + wearingRogueArmor && rogueStealthMax > 0 && !Player.HasCooldown(Cooldowns.SandCloak.ID)) { - player.AddCooldown(Cooldowns.SandCloak.ID, CalamityUtils.SecondsToFrames(30)); + Player.AddCooldown(Cooldowns.SandCloak.ID, CalamityUtils.SecondsToFrames(30)); rogueStealth -= rogueStealthMax * 0.25f; - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 7, 8, player.whoAmI); - Main.PlaySound(SoundID.Item, player.position, 45); + Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), 7, 8, Player.whoAmI); + SoundEngine.PlaySound(SoundID.Item, Player.position, 45); } - if (CalamityMod.SpectralVeilHotKey.JustPressed && spectralVeil && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && + if (CalamityMod.SpectralVeilHotKey.JustPressed && spectralVeil && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0) { - if (!player.chaosState) + if (!Player.chaosState) { Vector2 teleportLocation; teleportLocation.X = Main.mouseX + Main.screenPosition.X; - if (player.gravDir == 1f) - teleportLocation.Y = Main.mouseY + Main.screenPosition.Y - player.height; + if (Player.gravDir == 1f) + teleportLocation.Y = Main.mouseY + Main.screenPosition.Y - Player.height; else teleportLocation.Y = Main.screenPosition.Y + Main.screenHeight - Main.mouseY; - teleportLocation.X -= player.width * 0.5f; - Vector2 teleportOffset = teleportLocation - player.position; + teleportLocation.X -= Player.width * 0.5f; + Vector2 teleportOffset = teleportLocation - Player.position; if (teleportOffset.Length() > SpectralVeil.TeleportRange) { teleportOffset = teleportOffset.SafeNormalize(Vector2.Zero) * SpectralVeil.TeleportRange; - teleportLocation = player.position + teleportOffset; + teleportLocation = Player.position + teleportOffset; } if (teleportLocation.X > 50f && teleportLocation.X < (float)(Main.maxTilesX * 16 - 50) && teleportLocation.Y > 50f && teleportLocation.Y < (float)(Main.maxTilesY * 16 - 50)) { - if (!Collision.SolidCollision(teleportLocation, player.width, player.height)) + if (!Collision.SolidCollision(teleportLocation, Player.width, Player.height)) { rogueStealth -= rogueStealthMax * 0.25f; - player.Teleport(teleportLocation, 1); - NetMessage.SendData(MessageID.Teleport, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); + Player.Teleport(teleportLocation, 1); + NetMessage.SendData(MessageID.Teleport, -1, -1, null, 0, (float)Player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); int duration = chaosStateDuration; if (areThereAnyDamnBosses || areThereAnyDamnEvents) duration = chaosStateDurationBoss; - if (player.HasCooldown(Cooldowns.EvasionScarf.ID)) + if (Player.HasCooldown(Cooldowns.EvasionScarf.ID)) duration = (int)(duration * 1.5); - else if (player.HasCooldown(Cooldowns.CounterScarf.ID)) + else if (Player.HasCooldown(Cooldowns.CounterScarf.ID)) duration *= 2; - player.AddBuff(BuffID.ChaosState, duration, true); - player.AddCooldown(ChaosState.ID, duration, true, "spectralveil"); + Player.AddBuff(BuffID.ChaosState, duration, true); + Player.AddCooldown(ChaosState.ID, duration, true, "spectralveil"); int numDust = 40; Vector2 step = teleportOffset / numDust; for (int i = 0; i < numDust; i++) { - int dustIndex = Dust.NewDust(player.Center - (step * i), 1, 1, 21, step.X, step.Y); + int dustIndex = Dust.NewDust(Player.Center - (step * i), 1, 1, 21, step.X, step.Y); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].noLight = true; } @@ -2981,44 +2982,44 @@ namespace CalamityMod.CalPlayer } } } - if (CalamityMod.PlaguePackHotKey.JustPressed && hasJetpack && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && - wearingRogueArmor && rogueStealthMax > 0 && !player.HasCooldown(RogueBooster.ID) && !player.mount.Active) + if (CalamityMod.PlaguePackHotKey.JustPressed && hasJetpack && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && + wearingRogueArmor && rogueStealthMax > 0 && !Player.HasCooldown(RogueBooster.ID) && !Player.mount.Active) { jetPackDash = blunderBooster ? 15 : 10; - jetPackDirection = player.direction; - player.AddCooldown(RogueBooster.ID, 60, true, blunderBooster ? "birb" : "default"); + jetPackDirection = Player.direction; + Player.AddCooldown(RogueBooster.ID, 60, true, blunderBooster ? "birb" : "default"); rogueStealth -= rogueStealthMax * 0.25f; - Main.PlaySound(SoundID.Item66, player.Center); - Main.PlaySound(SoundID.Item34, player.Center); + SoundEngine.PlaySound(SoundID.Item66, Player.Center); + SoundEngine.PlaySound(SoundID.Item34, Player.Center); } if (CalamityMod.TarraHotKey.JustPressed) { - if (brimflameSet && !player.HasCooldown(BrimflameFrenzy.ID)) + if (brimflameSet && !Player.HasCooldown(BrimflameFrenzy.ID)) { - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { if (brimflameFrenzy) { brimflameFrenzy = false; - player.ClearBuff(ModContent.BuffType()); + Player.ClearBuff(ModContent.BuffType()); } else { brimflameFrenzy = true; - player.AddBuff(ModContent.BuffType(), 10 * 60, true); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/AbilitySounds/BrimflameAbility"), player.Center); + Player.AddBuff(ModContent.BuffType(), 10 * 60, true); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/AbilitySounds/BrimflameAbility"), Player.Center); for (int num502 = 0; num502 < 36; num502++) { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 3f; Main.dust[dust].scale *= 1.15f; } int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / (float)num226), default) + player.Center; - Vector2 vector7 = vector6 - player.Center; + Vector2 vector6 = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / (float)num226), default) + Player.Center; + Vector2 vector7 = vector6 - Player.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (int)CalamityDusts.Brimstone, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; @@ -3027,42 +3028,42 @@ namespace CalamityMod.CalPlayer } } } - if (tarraMelee && !player.HasCooldown(Cooldowns.TarragonCloak.ID) && !tarragonCloak) + if (tarraMelee && !Player.HasCooldown(Cooldowns.TarragonCloak.ID) && !tarragonCloak) { - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { - player.AddBuff(ModContent.BuffType(), 602, false); + Player.AddBuff(ModContent.BuffType(), 602, false); } } - if (bloodflareRanged && !player.HasCooldown(BloodflareRangedSet.ID)) + if (bloodflareRanged && !Player.HasCooldown(BloodflareRangedSet.ID)) { - if (player.whoAmI == Main.myPlayer) - player.AddCooldown(BloodflareRangedSet.ID, 1800); + if (Player.whoAmI == Main.myPlayer) + Player.AddCooldown(BloodflareRangedSet.ID, 1800); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/BloodflareRangerActivation"), player.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/BloodflareRangerActivation"), Player.Center); for (int d = 0; d < 64; d++) { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 3f; Main.dust[dust].scale *= 1.15f; } int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { - Vector2 source = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + player.Center; - Vector2 dustVel = source - player.Center; + Vector2 source = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; + Vector2 dustVel = source - Player.Center; int phanto = Dust.NewDust(source + dustVel, 0, 0, (int)CalamityDusts.Phantoplasm, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.4f); Main.dust[phanto].noGravity = true; Main.dust[phanto].noLight = true; Main.dust[phanto].velocity = dustVel; } float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int damage = (int)(300 * player.RangedDamage()); - if (player.whoAmI == Main.myPlayer) + int damage = (int)(300 * Player.RangedDamage()); + if (Player.whoAmI == Main.myPlayer) { for (int i = 0; i < 8; i++) { @@ -3070,26 +3071,26 @@ namespace CalamityMod.CalPlayer float randomSpeed = (float)Main.rand.Next(1, 7); float randomSpeed2 = (float)Main.rand.Next(1, 7); offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int soul = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, ai1); + int soul = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, 0f, ai1); if (soul.WithinBounds(Main.maxProjectiles)) Main.projectile[soul].Calamity().forceTypeless = true; - int soul2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, ai1); + int soul2 = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, 0f, ai1); if (soul2.WithinBounds(Main.maxProjectiles)) Main.projectile[soul2].Calamity().forceTypeless = true; } } } - if (omegaBlueSet && !player.HasCooldown(OmegaBlue.ID)) + if (omegaBlueSet && !Player.HasCooldown(OmegaBlue.ID)) { - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { - player.AddBuff(ModContent.BuffType(), 300, false); + Player.AddBuff(ModContent.BuffType(), 300, false); } - player.AddCooldown(OmegaBlue.ID, 1800); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/OmegaBlueAbility"), player.Center); + Player.AddCooldown(OmegaBlue.ID, 1800); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/OmegaBlueAbility"), Player.Center); for (int i = 0; i < 66; i++) { - int d = Dust.NewDust(player.position, player.width, player.height, 20, 0, 0, 100, Color.Transparent, 2.6f); + int d = Dust.NewDust(Player.position, Player.width, Player.height, 20, 0, 0, 100, Color.Transparent, 2.6f); Main.dust[d].noGravity = true; Main.dust[d].noLight = true; Main.dust[d].fadeIn = 1f; @@ -3098,77 +3099,77 @@ namespace CalamityMod.CalPlayer } if (dsSetBonus) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/DemonshadeEnrage"), player.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/DemonshadeEnrage"), Player.Center); for (int num502 = 0; num502 < 36; num502++) { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 3f; Main.dust[dust].scale *= 1.15f; } int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / (float)num226), default) + player.Center; - Vector2 vector7 = vector6 - player.Center; + Vector2 vector6 = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / (float)num226), default) + Player.Center; + Vector2 vector7 = vector6 - Player.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (int)CalamityDusts.Brimstone, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { - player.AddBuff(ModContent.BuffType(), 600, false); + Player.AddBuff(ModContent.BuffType(), 600, false); } if (Main.netMode != NetmodeID.MultiplayerClient) { for (int l = 0; l < Main.maxNPCs; l++) { NPC npc = Main.npc[l]; - if (npc.active && !npc.friendly && !npc.dontTakeDamage && Vector2.Distance(player.Center, npc.Center) <= 3000f) + if (npc.active && !npc.friendly && !npc.dontTakeDamage && Vector2.Distance(Player.Center, npc.Center) <= 3000f) { npc.AddBuff(ModContent.BuffType(), 600, false); } } } } - if (plagueReaper && !player.HasCooldown(PlagueBlackout.ID)) + if (plagueReaper && !Player.HasCooldown(PlagueBlackout.ID)) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/PlagueReaperAbility"), player.Center); - player.AddCooldown(PlagueBlackout.ID, 1800); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/PlagueReaperAbility"), Player.Center); + Player.AddCooldown(PlagueBlackout.ID, 1800); } if (forbiddenCirclet && forbiddenCooldown <= 0) { forbiddenCooldown = 45; - int stormMana = (int)(ForbiddenCirclet.manaCost * player.manaCost); - if (player.statMana < stormMana) + int stormMana = (int)(ForbiddenCirclet.manaCost * Player.manaCost); + if (Player.statMana < stormMana) { - if (player.manaFlower) + if (Player.manaFlower) { - player.QuickMana(); + Player.QuickMana(); } } - if (player.statMana >= stormMana && !player.silence) + if (Player.statMana >= stormMana && !Player.silence) { - player.manaRegenDelay = (int)player.maxRegenDelay; - player.statMana -= stormMana; - float dmgMult = player.RogueDamage() + player.minionDamage - 1f; + Player.manaRegenDelay = (int)Player.maxRegenDelay; + Player.statMana -= stormMana; + float dmgMult = Player.RogueDamage() + Player.GetDamage(DamageClass.Summon) - 1f; int damage = (int)(ForbiddenCirclet.tornadoBaseDmg * dmgMult); - if (player.HasBuff(BuffID.ManaSickness)) + if (Player.HasBuff(BuffID.ManaSickness)) { - int sickPenalty = (int)(damage * (0.05f * ((player.buffTime[player.FindBuffIndex(BuffID.ManaSickness)] + 60) / 60))); + int sickPenalty = (int)(damage * (0.05f * ((Player.buffTime[Player.FindBuffIndex(BuffID.ManaSickness)] + 60) / 60))); damage -= sickPenalty; } - float kBack = ForbiddenCirclet.tornadoBaseKB + player.minionKB; - if (player.whoAmI == Main.myPlayer) + float kBack = ForbiddenCirclet.tornadoBaseKB + Player.minionKB; + if (Player.whoAmI == Main.myPlayer) { - int mark = Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, kBack, player.whoAmI); + int mark = Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, kBack, Player.whoAmI); if (mark.WithinBounds(Main.maxProjectiles)) Main.projectile[mark].Calamity().forceTypeless = true; } } } - if (prismaticSet && !player.HasCooldown(PrismaticLaser.ID) && prismaticLasers <= 0) + if (prismaticSet && !Player.HasCooldown(PrismaticLaser.ID) && prismaticLasers <= 0) prismaticLasers = CalamityUtils.SecondsToFrames(35f); } if (CalamityMod.AstralArcanumUIHotkey.JustPressed && astralArcanum && !areThereAnyDamnBosses) @@ -3181,10 +3182,10 @@ namespace CalamityMod.CalPlayer { if (Main.netMode == NetmodeID.SinglePlayer) { - player.TeleportationPotion(); - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 6); + Player.TeleportationPotion(); + SoundEngine.PlaySound(SoundID.Item, (int)Player.position.X, (int)Player.position.Y, 6); } - else if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) + else if (Main.netMode == NetmodeID.MultiplayerClient && Player.whoAmI == Main.myPlayer) { NetMessage.SendData(MessageID.TeleportationPotion, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); } @@ -3192,40 +3193,40 @@ namespace CalamityMod.CalPlayer } if (CalamityMod.AegisHotKey.JustPressed) { - if (elysianAegis && !player.mount.Active) + if (elysianAegis && !Player.mount.Active) { elysianGuard = !elysianGuard; } } // Trigger for pressing the God Slayer dash key - if (CalamityMod.GodSlayerDashHotKey.JustPressed && (player.controlUp || player.controlDown || player.controlLeft || player.controlRight) && !player.pulley && player.grappling[0] == -1 && !player.tongued && !player.mount.Active && !player.HasCooldown(GodSlayerDash.ID) && player.dashDelay == 0) + if (CalamityMod.GodSlayerDashHotKey.JustPressed && (Player.controlUp || Player.controlDown || Player.controlLeft || Player.controlRight) && !Player.pulley && Player.grappling[0] == -1 && !Player.tongued && !Player.mount.Active && !Player.HasCooldown(GodSlayerDash.ID) && Player.dashDelay == 0) godSlayerDashHotKeyPressed = true; // Trigger for pressing the Rage hotkey. if (CalamityMod.RageHotKey.JustPressed) { // Gael's Greatsword replaces Rage Mode with an uber skull attack - if (gaelRageAttackCooldown == 0 && player.ActiveItem().type == ModContent.ItemType() && rage > 0f) + if (gaelRageAttackCooldown == 0 && Player.ActiveItem().type == ModContent.ItemType() && rage > 0f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/SilvaDispel"), player.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/SilvaDispel"), Player.Center); for (int i = 0; i < 3; i++) - Dust.NewDust(player.position, 120, 120, 218, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Player.position, 120, 120, 218, 0f, 0f, 100, default, 1.5f); for (int i = 0; i < 30; i++) { float angle = MathHelper.TwoPi * i / 30f; - int dustIndex = Dust.NewDust(player.position, 120, 120, 218, 0f, 0f, 0, default, 2f); + int dustIndex = Dust.NewDust(Player.position, 120, 120, 218, 0f, 0f, 0, default, 2f); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].velocity *= 4f; - dustIndex = Dust.NewDust(player.position, 120, 120, 218, 0f, 0f, 100, default, 1f); + dustIndex = Dust.NewDust(Player.position, 120, 120, 218, 0f, 0f, 100, default, 1f); Main.dust[dustIndex].velocity *= 2.25f; Main.dust[dustIndex].noGravity = true; - Dust.NewDust(player.Center + angle.ToRotationVector2() * 160f, 0, 0, 218, 0f, 0f, 100, default, 1f); + Dust.NewDust(Player.Center + angle.ToRotationVector2() * 160f, 0, 0, 218, 0f, 0f, 100, default, 1f); } float rageRatio = rage / rageMax; - int damage = (int)(rageRatio * GaelsGreatsword.SkullsplosionDamageMultiplier * GaelsGreatsword.BaseDamage * player.MeleeDamage()); + int damage = (int)(rageRatio * GaelsGreatsword.SkullsplosionDamageMultiplier * GaelsGreatsword.BaseDamage * Player.MeleeDamage()); float skullCount = 20f; float skullSpeed = 12f; for (float i = 0; i < skullCount; i += 1f) @@ -3233,7 +3234,7 @@ namespace CalamityMod.CalPlayer float angle = MathHelper.TwoPi * i / skullCount; Vector2 initialVelocity = angle.ToRotationVector2().RotatedByRandom(MathHelper.ToRadians(12f)) * skullSpeed * new Vector2(0.82f, 1.5f) * Main.rand.NextFloat(0.8f, 1.2f) * (i < skullCount / 2 ? 0.25f : 1f); - int projectileIndex = Projectile.NewProjectile(player.Center + initialVelocity * 3f, initialVelocity, ModContent.ProjectileType(), damage, 2f, player.whoAmI); + int projectileIndex = Projectile.NewProjectile(Player.Center + initialVelocity * 3f, initialVelocity, ModContent.ProjectileType(), damage, 2f, Player.whoAmI); Main.projectile[projectileIndex].tileCollide = false; Main.projectile[projectileIndex].localAI[1] = (Main.projectile[projectileIndex].velocity.Y < 0f).ToInt(); if (projectileIndex.WithinBounds(Main.maxProjectiles)) @@ -3249,24 +3250,24 @@ namespace CalamityMod.CalPlayer if (rage >= rageMax && !rageModeActive) { // Rage duration isn't calculated here because the buff keeps itself alive automatically as long as the player has Rage left. - player.AddBuff(ModContent.BuffType(), 2); + Player.AddBuff(ModContent.BuffType(), 2); // Play Rage Activation sound - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/RageActivate"), player.position); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/RageActivate"), Player.position); // TODO -- improve Rage activation visuals for (int num502 = 0; num502 < 64; num502++) { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 3f; Main.dust[dust].scale *= 1.15f; } int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + player.Center; - Vector2 vector7 = vector6 - player.Center; + Vector2 vector6 = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Player.Center; + Vector2 vector7 = vector6 - Player.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (int)CalamityDusts.Brimstone, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; @@ -3280,24 +3281,24 @@ namespace CalamityMod.CalPlayer { if (adrenaline == adrenalineMax && !adrenalineModeActive) { - player.AddBuff(ModContent.BuffType(), AdrenalineDuration); + Player.AddBuff(ModContent.BuffType(), AdrenalineDuration); // Play Adrenaline Activation sound - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/AdrenalineActivate"), player.position); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/AdrenalineActivate"), Player.position); // TODO -- improve Adrenaline activation visuals for (int num502 = 0; num502 < 64; num502++) { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 206, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, 206, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 3f; Main.dust[dust].scale *= 2f; } int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + player.Center; - Vector2 vector7 = vector6 - player.Center; + Vector2 vector6 = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Player.Center; + Vector2 vector7 = vector6 - Player.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 206, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; @@ -3308,29 +3309,29 @@ namespace CalamityMod.CalPlayer bool mountCheck = true; - if (player.mount != null && player.mount.Active) - mountCheck = !player.mount.BlockExtraJumps; - bool canJump = (!player.doubleJumpCloud || !player.jumpAgainCloud) && - (!player.doubleJumpSandstorm || !player.jumpAgainSandstorm) && - (!player.doubleJumpBlizzard || !player.jumpAgainBlizzard) && - (!player.doubleJumpFart || !player.jumpAgainFart) && - (!player.doubleJumpSail || !player.jumpAgainSail) && - (!player.doubleJumpUnicorn || !player.jumpAgainUnicorn) && - CalamityUtils.CountHookProj() <= 0 && (player.rocketTime == 0 || player.wings > 0) && mountCheck; - if (PlayerInput.Triggers.JustPressed.Jump && player.position.Y != player.oldPosition.Y && canJump) + if (Player.mount != null && Player.mount.Active) + mountCheck = !Player.mount.BlockExtraJumps; + bool canJump = (!Player.doubleJumpCloud || !Player.jumpAgainCloud) && + (!Player.doubleJumpSandstorm || !Player.jumpAgainSandstorm) && + (!Player.doubleJumpBlizzard || !Player.jumpAgainBlizzard) && + (!Player.doubleJumpFart || !Player.jumpAgainFart) && + (!Player.doubleJumpSail || !Player.jumpAgainSail) && + (!Player.doubleJumpUnicorn || !Player.jumpAgainUnicorn) && + CalamityUtils.CountHookProj() <= 0 && (Player.rocketTime == 0 || Player.wings > 0) && mountCheck; + if (PlayerInput.Triggers.JustPressed.Jump && Player.position.Y != Player.oldPosition.Y && canJump) { if (statigelJump && jumpAgainStatigel) { jumpAgainStatigel = false; - int offset = player.height; - if (player.gravDir == -1f) + int offset = Player.height; + if (Player.gravDir == -1f) offset = 0; - Main.PlaySound(SoundID.DoubleJump, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); - player.velocity.Y = -Player.jumpSpeed * player.gravDir; - player.jump = (int)(Player.jumpHeight * 1.25); + SoundEngine.PlaySound(SoundID.DoubleJump, (int)Player.position.X, (int)Player.position.Y, 1, 1f, 0f); + Player.velocity.Y = -Player.jumpSpeed * Player.gravDir; + Player.jump = (int)(Player.jumpHeight * 1.25); for (int d = 0; d < 30; ++d) { - int goo = Dust.NewDust(new Vector2(player.position.X, player.position.Y + offset), player.width, 12, 4, player.velocity.X * 0.3f, player.velocity.Y * 0.3f, 100, new Color(0, 80, 255, 100), 1.5f); + int goo = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + offset), Player.width, 12, 4, Player.velocity.X * 0.3f, Player.velocity.Y * 0.3f, 100, new Color(0, 80, 255, 100), 1.5f); if (d % 2 == 0) Main.dust[goo].velocity.X += (float)Main.rand.Next(30, 71) * 0.1f; else @@ -3344,15 +3345,15 @@ namespace CalamityMod.CalPlayer else if (sulfurJump && jumpAgainSulfur) { jumpAgainSulfur = false; - int offset = player.height; - if (player.gravDir == -1f) + int offset = Player.height; + if (Player.gravDir == -1f) offset = 0; - Main.PlaySound(SoundID.DoubleJump, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); - player.velocity.Y = -Player.jumpSpeed * player.gravDir; - player.jump = (int)(Player.jumpHeight * 1.5); + SoundEngine.PlaySound(SoundID.DoubleJump, (int)Player.position.X, (int)Player.position.Y, 1, 1f, 0f); + Player.velocity.Y = -Player.jumpSpeed * Player.gravDir; + Player.jump = (int)(Player.jumpHeight * 1.5); for (int d = 0; d < 30; ++d) { - int sulfur = Dust.NewDust(new Vector2(player.position.X, player.position.Y + offset), player.width, 12, 31, player.velocity.X * 0.3f, player.velocity.Y * 0.3f, 100, default, 1.5f); + int sulfur = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + offset), Player.width, 12, 31, Player.velocity.X * 0.3f, Player.velocity.Y * 0.3f, 100, default, 1.5f); if (d % 2 == 0) Main.dust[sulfur].velocity.X += (float)Main.rand.Next(30, 71) * 0.1f; else @@ -3364,7 +3365,7 @@ namespace CalamityMod.CalPlayer } if (sulphurBubbleCooldown <= 0) { - int bubble = Projectile.NewProjectile(new Vector2(player.position.X, player.position.Y + (player.gravDir == -1f ? 20 : -20)), Vector2.Zero, ModContent.ProjectileType(), (int)(20f * player.RogueDamage()), 0f, player.whoAmI, 1f, 0f); + int bubble = Projectile.NewProjectile(new Vector2(Player.position.X, Player.position.Y + (Player.gravDir == -1f ? 20 : -20)), Vector2.Zero, ModContent.ProjectileType(), (int)(20f * Player.RogueDamage()), 0f, Player.whoAmI, 1f, 0f); if (bubble.WithinBounds(Main.maxProjectiles)) Main.projectile[bubble].Calamity().forceTypeless = true; sulphurBubbleCooldown = 20; @@ -3417,7 +3418,7 @@ namespace CalamityMod.CalPlayer public void SyncTeleport(int teleportType) { - ModPacket netMessage = mod.GetPacket(); + ModPacket netMessage = Mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.TeleportPlayer); netMessage.Write(teleportType); netMessage.Send(); @@ -3468,7 +3469,7 @@ namespace CalamityMod.CalPlayer } else { - if (tile.active() && !tile.inActive() && Main.tileSolid[(int)tile.type]) + if (tile.active() && !tile.inActive() && Main.tileSolid[(int)tile.TileType]) { break; } @@ -3561,7 +3562,7 @@ namespace CalamityMod.CalPlayer } else { - if (tile.active() && !tile.inActive() && Main.tileSolid[(int)tile.type]) + if (tile.active() && !tile.inActive() && Main.tileSolid[(int)tile.TileType]) { break; } @@ -3630,7 +3631,7 @@ namespace CalamityMod.CalPlayer } Main.TeleportEffect(player.getRect(), 1); Main.TeleportEffect(player.getRect(), 3); - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 6); + SoundEngine.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 6); if (Main.netMode != NetmodeID.Server) { return; @@ -3646,9 +3647,9 @@ namespace CalamityMod.CalPlayer #region UpdateEquips public override void UpdateVanityAccessories() { - for (int n = 13; n < 18 + player.extraAccessorySlots; n++) + for (int n = 13; n < 18 + Player.extraAccessorySlots; n++) { - Item item = player.armor[n]; + Item item = Player.armor[n]; if (item.type == ModContent.ItemType()) { @@ -3696,32 +3697,32 @@ namespace CalamityMod.CalPlayer if (item.type == ModContent.ItemType()) { spiritOriginVanity = true; - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) - player.AddBuff(ModContent.BuffType(), 18000, true); + if (Player.FindBuffIndex(ModContent.BuffType()) == -1) + Player.AddBuff(ModContent.BuffType(), 18000, true); } } if (item.type == ModContent.ItemType()) { howlsHeartVanity = true; - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (Player.FindBuffIndex(ModContent.BuffType()) == -1) { - player.AddBuff(ModContent.BuffType(), 3600, true); + Player.AddBuff(ModContent.BuffType(), 3600, true); } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center, -Vector2.UnitY, ModContent.ProjectileType(), (int)(HowlsHeart.HowlDamage * player.MinionDamage()), 1f, player.whoAmI, 0f, 1f); + Projectile.NewProjectile(Player.Center, -Vector2.UnitY, ModContent.ProjectileType(), (int)(HowlsHeart.HowlDamage * Player.MinionDamage()), 1f, Player.whoAmI, 0f, 1f); } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center, -Vector2.UnitY, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(Player.Center, -Vector2.UnitY, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, 0f, 0f); } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center, -Vector2.UnitY, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(Player.Center, -Vector2.UnitY, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, 0f, 0f); } } } @@ -3731,10 +3732,10 @@ namespace CalamityMod.CalPlayer public override void UpdateEquips(ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff) { // Ankh Shield Mighty Wind immunity. - for (int i = 0; i < 8 + player.extraAccessorySlots; i++) + for (int i = 0; i < 8 + Player.extraAccessorySlots; i++) { - if (player.armor[i].type == ItemID.AnkhShield) - player.buffImmune[BuffID.WindPushed] = true; + if (Player.armor[i].type == ItemID.AnkhShield) + Player.buffImmune[BuffID.WindPushed] = true; } if (CalamityConfig.Instance.BossHealthBar) @@ -3749,18 +3750,18 @@ namespace CalamityMod.CalPlayer CalamityConfig.Instance.BossHealthBarExtraInfo = shouldDrawSmallText; // Increase tile placement speed to speed up early game a bit and make building more fun - player.tileSpeed += 0.5f; + Player.tileSpeed += 0.5f; // Increase wall placement speed to speed up early game a bit and make building more fun - player.wallSpeed += 0.5f; + Player.wallSpeed += 0.5f; // Takes the % move speed boost and reduces it to a quarter to get the actual speed increase // 400% move speed boost = 80% run speed boost, so an 8 run speed would become 14.4 with a 400% move speed stat - float accRunSpeedMin = player.accRunSpeed * 0.5f; - player.accRunSpeed += player.accRunSpeed * moveSpeedStat * 0.002f; + float accRunSpeedMin = Player.accRunSpeed * 0.5f; + Player.accRunSpeed += Player.accRunSpeed * moveSpeedStat * 0.002f; - if (player.accRunSpeed < accRunSpeedMin) - player.accRunSpeed = accRunSpeedMin; + if (Player.accRunSpeed < accRunSpeedMin) + Player.accRunSpeed = accRunSpeedMin; #region MeleeSpeed float meleeSpeedMult = 0f; @@ -3802,7 +3803,7 @@ namespace CalamityMod.CalPlayer NPC nPC = Main.npc[j]; if (nPC.active && !nPC.friendly && (nPC.damage > 0 || nPC.boss) && !nPC.dontTakeDamage) { - float distance2 = Math.Abs(nPC.position.X + (float)(nPC.width / 2) - (player.position.X + (float)(player.width / 2))) + Math.Abs(nPC.position.Y + (float)(nPC.height / 2) - (player.position.Y + (float)(player.height / 2))); + float distance2 = Math.Abs(nPC.position.X + (float)(nPC.width / 2) - (Player.position.X + (float)(Player.width / 2))) + Math.Abs(nPC.position.Y + (float)(nPC.height / 2) - (Player.position.Y + (float)(Player.height / 2))); if (distance == -1f || distance2 < distance) { distance = distance2; @@ -3816,7 +3817,7 @@ namespace CalamityMod.CalPlayer NPC actualClosestNPC = Main.npc[closestNPC]; float generousHitboxWidth = Math.Max(actualClosestNPC.Hitbox.Width / 2f, actualClosestNPC.Hitbox.Height / 2f); - float hitboxEdgeDist = actualClosestNPC.Distance(player.Center) - generousHitboxWidth; + float hitboxEdgeDist = actualClosestNPC.Distance(Player.Center) - generousHitboxWidth; if (hitboxEdgeDist < 0) hitboxEdgeDist = 0; @@ -3871,14 +3872,14 @@ namespace CalamityMod.CalPlayer } if (bloodyWormTooth) { - if (player.statLife < (int)(player.statLifeMax2 * 0.5)) + if (Player.statLife < (int)(Player.statLifeMax2 * 0.5)) meleeSpeedMult += 0.1f; else meleeSpeedMult += 0.05f; } - if (player.beetleOffense && player.beetleOrbs > 0) + if (Player.beetleOffense && Player.beetleOrbs > 0) { - meleeSpeedMult -= 0.1f * player.beetleOrbs; + meleeSpeedMult -= 0.1f * Player.beetleOrbs; } if (CalamityConfig.Instance.Proficiency) { @@ -3887,34 +3888,34 @@ namespace CalamityMod.CalPlayer if (GemTechState.IsYellowGemActive) meleeSpeedMult += GemTechHeadgear.MeleeSpeedBoost; - player.meleeSpeed += meleeSpeedMult; + Player.meleeSpeed += meleeSpeedMult; - if (player.ActiveItem().type == ModContent.ItemType() || player.ActiveItem().type == ModContent.ItemType() || - player.ActiveItem().type == ModContent.ItemType() || player.ActiveItem().type == ModContent.ItemType()) + if (Player.ActiveItem().type == ModContent.ItemType() || Player.ActiveItem().type == ModContent.ItemType() || + Player.ActiveItem().type == ModContent.ItemType() || Player.ActiveItem().type == ModContent.ItemType()) { - float newMeleeSpeed = 1f + ((player.meleeSpeed - 1f) * 0.25f); - player.meleeSpeed = newMeleeSpeed; + float newMeleeSpeed = 1f + ((Player.meleeSpeed - 1f) * 0.25f); + Player.meleeSpeed = newMeleeSpeed; } #endregion if (snowman) { - if (player.whoAmI == Main.myPlayer && !snowmanNoseless) - player.AddBuff(ModContent.BuffType(), 60, true); + if (Player.whoAmI == Main.myPlayer && !snowmanNoseless) + Player.AddBuff(ModContent.BuffType(), 60, true); } if (abyssalDivingSuit) { - player.AddBuff(ModContent.BuffType(), 60, true); - if (player.whoAmI == Main.myPlayer && !player.HasCooldown(DivingPlatesBroken.ID)) + Player.AddBuff(ModContent.BuffType(), 60, true); + if (Player.whoAmI == Main.myPlayer && !Player.HasCooldown(DivingPlatesBroken.ID)) { - player.AddBuff(ModContent.BuffType(), 2); + Player.AddBuff(ModContent.BuffType(), 2); } - if (player.whoAmI == Main.myPlayer && player.active && abyssalDivingSuitPlateHits < 3) + if (Player.whoAmI == Main.myPlayer && Player.active && abyssalDivingSuitPlateHits < 3) { - if (!player.HasCooldown(DivingPlatesBreaking.ID)) + if (!Player.HasCooldown(DivingPlatesBreaking.ID)) { - CooldownInstance plates = player.AddCooldown(DivingPlatesBreaking.ID, 3); + CooldownInstance plates = Player.AddCooldown(DivingPlatesBreaking.ID, 3); plates.timeLeft = abyssalDivingSuitPlateHits; } else @@ -3927,18 +3928,18 @@ namespace CalamityMod.CalPlayer if (sirenBoobs) { - player.AddBuff(ModContent.BuffType(), 60, true); + Player.AddBuff(ModContent.BuffType(), 60, true); } if (sirenBoobs && NPC.downedBoss3) { - if (player.whoAmI == Main.myPlayer && !player.HasCooldown(AquaticHeartIceShield.ID)) + if (Player.whoAmI == Main.myPlayer && !Player.HasCooldown(AquaticHeartIceShield.ID)) { - player.AddBuff(ModContent.BuffType(), 2); + Player.AddBuff(ModContent.BuffType(), 2); } } if (profanedCrystal) { - player.AddBuff(ModContent.BuffType(), 60, true); + Player.AddBuff(ModContent.BuffType(), 60, true); } } #endregion @@ -3973,15 +3974,15 @@ namespace CalamityMod.CalPlayer } voidFrameCounter++; - for (int i = 0; i < player.dye.Length; i++) + for (int i = 0; i < Player.dye.Length; i++) { - if (player.dye[i].type == ModContent.ItemType()) + if (Player.dye[i].type == ModContent.ItemType()) { - GameShaders.Armor.GetSecondaryShader(player.dye[i].dye, player)?.UseColor(GetCurrentMoonlightDyeColor()); + GameShaders.Armor.GetSecondaryShader(Player.dye[i].dye, Player)?.UseColor(GetCurrentMoonlightDyeColor()); } } //Syncing mouse controls - if (Main.myPlayer == player.whoAmI) + if (Main.myPlayer == Player.whoAmI) { mouseRight = PlayerInput.Triggers.Current.MouseRight; mouseWorld = Main.MouseWorld; @@ -3998,7 +3999,7 @@ namespace CalamityMod.CalPlayer syncMouseControls = true; mouseWorldListener = false; } - if (mouseRotationListener && Math.Abs((mouseWorld - player.MountedCenter).ToRotation() - (oldMouseWorld - player.MountedCenter).ToRotation()) > 0.15f) + if (mouseRotationListener && Math.Abs((mouseWorld - Player.MountedCenter).ToRotation() - (oldMouseWorld - Player.MountedCenter).ToRotation()) > 0.15f) { oldMouseWorld = mouseWorld; syncMouseControls = true; @@ -4012,9 +4013,9 @@ namespace CalamityMod.CalPlayer public override void PreUpdateBuffs() { // Remove the mighty wind buff if the player is in the astral desert or if a boss is alive. - if (player.ZoneDesert && (ZoneAstral || areThereAnyDamnBosses) && player.HasBuff(BuffID.WindPushed)) + if (Player.ZoneDesert && (ZoneAstral || areThereAnyDamnBosses) && Player.HasBuff(BuffID.WindPushed)) { - player.ClearBuff(BuffID.WindPushed); + Player.ClearBuff(BuffID.WindPushed); } } #endregion @@ -4029,33 +4030,33 @@ namespace CalamityMod.CalPlayer if (CalamityMod.ExoChairSpeedupHotkey.Current) speed *= 2f; - if (player.controlLeft) + if (Player.controlLeft) { - player.velocity.X = -speed; - player.direction = -1; + Player.velocity.X = -speed; + Player.direction = -1; } - else if (player.controlRight) + else if (Player.controlRight) { - player.velocity.X = speed; - player.direction = 1; + Player.velocity.X = speed; + Player.direction = 1; } else - player.velocity.X = 0f; + Player.velocity.X = 0f; - if (player.controlUp || player.controlJump) - player.velocity.Y = -speed; + if (Player.controlUp || Player.controlJump) + Player.velocity.Y = -speed; - else if (player.controlDown) + else if (Player.controlDown) { - player.velocity.Y = speed; - if (Collision.TileCollision(player.position, player.velocity, player.width, player.height, true, false, (int)player.gravDir).Y == 0f) - player.velocity.Y = 0.5f; + Player.velocity.Y = speed; + if (Collision.TileCollision(Player.position, Player.velocity, Player.width, Player.height, true, false, (int)Player.gravDir).Y == 0f) + Player.velocity.Y = 0.5f; } else - player.velocity.Y = 0f; + Player.velocity.Y = 0f; if (CalamityMod.ExoChairSlowdownHotkey.Current) - player.velocity *= 0.5f; + Player.velocity *= 0.5f; } } #endregion @@ -4063,20 +4064,20 @@ namespace CalamityMod.CalPlayer #region PostUpdateBuffs public override void PostUpdateBuffs() { - if (player.whoAmI == Main.myPlayer && CalamityConfig.Instance.VanillaCooldownDisplay) + if (Player.whoAmI == Main.myPlayer && CalamityConfig.Instance.VanillaCooldownDisplay) { // Add a cooldown display for potion sickness if the player has the vanilla counter ticking - if (player.potionDelay > 0 && !player.HasCooldown(PotionSickness.ID)) - player.AddCooldown(PotionSickness.ID, player.potionDelay, false); + if (Player.potionDelay > 0 && !Player.HasCooldown(PotionSickness.ID)) + Player.AddCooldown(PotionSickness.ID, Player.potionDelay, false); // Add a cooldown display for chaos state if the player has the vanilla counter ticking // This will make the cooldown look like vanilla Rod of Discord, as it wasn't applied by either Normality Relocator or Spectral Veil - if (player.chaosState && !player.HasCooldown(ChaosState.ID)) + if (Player.chaosState && !Player.HasCooldown(ChaosState.ID)) { for (int l = 0; l < Player.MaxBuffs; l++) - if (player.buffType[l] == BuffID.ChaosState) + if (Player.buffType[l] == BuffID.ChaosState) { - player.AddCooldown(ChaosState.ID, player.buffTime[l], false); + Player.AddCooldown(ChaosState.ID, Player.buffTime[l], false); break; } } @@ -4104,38 +4105,38 @@ namespace CalamityMod.CalPlayer public override void PostUpdateRunSpeeds() { #region SpeedBoosts - if (!player.mount.Active) + if (!Player.mount.Active) { float runAccMult = 1f + (shadowSpeed ? 0.5f : 0f) + (stressPills ? 0.05f : 0f) + - ((abyssalDivingSuit && player.IsUnderwater()) ? 0.05f : 0f) + + ((abyssalDivingSuit && Player.IsUnderwater()) ? 0.05f : 0f) + (sirenWaterBuff ? 0.15f : 0f) + - ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + + ((frostFlare && Player.statLife < (int)(Player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + (dragonScales ? 0.1f : 0f) + (kamiBoost ? KamiBuff.RunAccelerationBoost : 0f) + (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? 0.05f : 0f) + (blueCandle ? 0.05f : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - ((deepDiver && player.IsUnderwater()) ? 0.15f : 0f) + + ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f) + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); float runSpeedMult = 1f + (shadowSpeed ? 0.5f : 0f) + (stressPills ? 0.05f : 0f) + - ((abyssalDivingSuit && player.IsUnderwater()) ? 0.05f : 0f) + + ((abyssalDivingSuit && Player.IsUnderwater()) ? 0.05f : 0f) + (sirenWaterBuff ? 0.15f : 0f) + - ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + + ((frostFlare && Player.statLife < (int)(Player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + (dragonScales ? 0.1f : 0f) + (kamiBoost ? KamiBuff.RunSpeedBoost : 0f) + (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? 0.05f : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - ((deepDiver && player.IsUnderwater()) ? 0.15f : 0f) + + ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f) + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); - if (abyssalDivingSuit && !player.IsUnderwater()) + if (abyssalDivingSuit && !Player.IsUnderwater()) { float multiplier = 0.4f + abyssalDivingSuitPlateHits * 0.2f; runAccMult *= multiplier; @@ -4157,22 +4158,22 @@ namespace CalamityMod.CalPlayer runAccMult *= 0.5f; runSpeedMult *= 0.5f; } - if ((player.slippy || player.slippy2) && player.iceSkate) + if ((Player.slippy || Player.slippy2) && Player.iceSkate) { runAccMult *= 0.6f; } - player.runAcceleration *= runAccMult; - player.maxRunSpeed *= runSpeedMult; + Player.runAcceleration *= runAccMult; + Player.maxRunSpeed *= runSpeedMult; } #endregion #region DashEffects - if (player.pulley && dashMod > 0) + if (Player.pulley && dashMod > 0) { ModDashMovement(); } - else if (player.grappling[0] == -1 && !player.tongued) + else if (Player.grappling[0] == -1 && !Player.tongued) { ModHorizontalMovement(); @@ -4181,9 +4182,9 @@ namespace CalamityMod.CalPlayer if (pAmulet && modStealth < 1f) { - float num43 = player.maxRunSpeed / 2f * (1f - modStealth); - player.maxRunSpeed -= num43; - player.accRunSpeed = player.maxRunSpeed; + float num43 = Player.maxRunSpeed / 2f * (1f - modStealth); + Player.maxRunSpeed -= num43; + Player.accRunSpeed = Player.maxRunSpeed; } } #endregion @@ -4193,7 +4194,7 @@ namespace CalamityMod.CalPlayer #region Dodges private bool HandleDodges() { - if (player.whoAmI != Main.myPlayer || disableAllDodges) + if (Player.whoAmI != Main.myPlayer || disableAllDodges) return false; if (spectralVeil && spectralVeilImmunity > 0) @@ -4202,22 +4203,22 @@ namespace CalamityMod.CalPlayer return true; } - bool playerDashing = player.pulley || (player.grappling[0] == -1 && !player.tongued); - if (playerDashing && dashMod == 9 && player.dashDelay < 0) + bool playerDashing = Player.pulley || (Player.grappling[0] == -1 && !Player.tongued); + if (playerDashing && dashMod == 9 && Player.dashDelay < 0) { GodSlayerDodge(); return true; } // Neither scarf can be used if either is on cooldown // TODO -- Why do the two scarves not use the same cooldown? They're both called "Scarf Cooldown". - if (playerDashing && dashMod == 1 && player.dashDelay < 0 && dodgeScarf && !(player.HasCooldown(Cooldowns.CounterScarf.ID) || player.HasCooldown(Cooldowns.EvasionScarf.ID))) + if (playerDashing && dashMod == 1 && Player.dashDelay < 0 && dodgeScarf && !(Player.HasCooldown(Cooldowns.CounterScarf.ID) || Player.HasCooldown(Cooldowns.EvasionScarf.ID))) { CounterScarfDodge(); return true; } // Mirror evades do not work if the global dodge cooldown is active. This cooldown can be triggered by either mirror. - if (!player.HasCooldown(GlobalDodge.ID)) + if (!Player.HasCooldown(GlobalDodge.ID)) { if (eclipseMirror) { @@ -4235,7 +4236,7 @@ namespace CalamityMod.CalPlayer private void SpectralVeilDodge() { - player.GiveIFrames(spectralVeilImmunity, true); //Set immunity before setting this variable to 0 + Player.GiveIFrames(spectralVeilImmunity, true); //Set immunity before setting this variable to 0 rogueStealth = rogueStealthMax; spectralVeilImmunity = 0; @@ -4245,33 +4246,33 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 20; j++) { - int sVeilDustIndex1 = Dust.NewDust(player.Center, 1, 1, 21, sVeilDustDir.X * j, sVeilDustDir.Y * j); - int sVeilDustIndex2 = Dust.NewDust(player.Center, 1, 1, 21, -sVeilDustDir.X * j, -sVeilDustDir.Y * j); + int sVeilDustIndex1 = Dust.NewDust(Player.Center, 1, 1, 21, sVeilDustDir.X * j, sVeilDustDir.Y * j); + int sVeilDustIndex2 = Dust.NewDust(Player.Center, 1, 1, 21, -sVeilDustDir.X * j, -sVeilDustDir.Y * j); Main.dust[sVeilDustIndex1].noGravity = false; Main.dust[sVeilDustIndex1].noLight = false; Main.dust[sVeilDustIndex2].noGravity = false; Main.dust[sVeilDustIndex2].noLight = false; } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/SilvaDispel"), player.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/SilvaDispel"), Player.Center); - NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } private void GodSlayerDodge() { - player.GiveIFrames(player.longInvince ? 100 : 60, true); - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 67); + Player.GiveIFrames(Player.longInvince ? 100 : 60, true); + SoundEngine.PlaySound(SoundID.Item, (int)Player.position.X, (int)Player.position.Y, 67); for (int j = 0; j < 30; j++) { - int num = Dust.NewDust(player.position, player.width, player.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num = Dust.NewDust(Player.position, Player.width, Player.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[num]; dust.position.X += Main.rand.Next(-20, 21); dust.position.Y += Main.rand.Next(-20, 21); dust.velocity *= 0.4f; dust.scale *= 1f + Main.rand.Next(40) * 0.01f; - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + dust.shader = GameShaders.Armor.GetSecondaryShader(Player.cWaist, Player); if (Main.rand.NextBool(2)) { dust.scale *= 1f + Main.rand.Next(40) * 0.01f; @@ -4279,33 +4280,33 @@ namespace CalamityMod.CalPlayer } } - NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } private void CounterScarfDodge() { if (evasionScarf) { - int duration = CalamityUtils.SecondsToFrames(player.chaosState ? 20 : 13); - player.AddCooldown(Cooldowns.EvasionScarf.ID, duration); + int duration = CalamityUtils.SecondsToFrames(Player.chaosState ? 20 : 13); + Player.AddCooldown(Cooldowns.EvasionScarf.ID, duration); } else { - int duration = CalamityUtils.SecondsToFrames(player.chaosState ? 30 : 15); - player.AddCooldown(Cooldowns.CounterScarf.ID, duration); + int duration = CalamityUtils.SecondsToFrames(Player.chaosState ? 30 : 15); + Player.AddCooldown(Cooldowns.CounterScarf.ID, duration); } - player.GiveIFrames(player.longInvince ? 100 : 60, true); + Player.GiveIFrames(Player.longInvince ? 100 : 60, true); for (int j = 0; j < 100; j++) { - int num = Dust.NewDust(player.position, player.width, player.height, 235, 0f, 0f, 100, default, 2f); + int num = Dust.NewDust(Player.position, Player.width, Player.height, 235, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[num]; dust.position.X += Main.rand.Next(-20, 21); dust.position.Y += Main.rand.Next(-20, 21); dust.velocity *= 0.4f; dust.scale *= 1f + Main.rand.Next(40) * 0.01f; - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + dust.shader = GameShaders.Armor.GetSecondaryShader(Player.cWaist, Player); if (Main.rand.NextBool(2)) { dust.scale *= 1f + Main.rand.Next(40) * 0.01f; @@ -4313,25 +4314,25 @@ namespace CalamityMod.CalPlayer } } - NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } public void AbyssMirrorEvade() { - if (player.whoAmI == Main.myPlayer && abyssalMirror && !eclipseMirror) + if (Player.whoAmI == Main.myPlayer && abyssalMirror && !eclipseMirror) { - player.AddCooldown(GlobalDodge.ID, MirrorDodgeCooldown, true, "abyssmirror"); + Player.AddCooldown(GlobalDodge.ID, MirrorDodgeCooldown, true, "abyssmirror"); // TODO -- why is this here? - player.noKnockback = true; + Player.noKnockback = true; - player.GiveIFrames(player.longInvince ? 100 : 60, true); + Player.GiveIFrames(Player.longInvince ? 100 : 60, true); rogueStealth += 0.5f; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/SilvaActivation"), player.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/SilvaActivation"), Player.Center); for (int i = 0; i < 10; i++) { - int lumenyl = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), ModContent.ProjectileType(), (int)(55 * player.RogueDamage()), 0, player.whoAmI); + int lumenyl = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), ModContent.ProjectileType(), (int)(55 * Player.RogueDamage()), 0, Player.whoAmI); Main.projectile[lumenyl].rotation = Main.rand.NextFloat(0, 360); Main.projectile[lumenyl].frame = Main.rand.Next(0, 4); if (lumenyl.WithinBounds(Main.maxProjectiles)) @@ -4339,34 +4340,34 @@ namespace CalamityMod.CalPlayer } // TODO -- Calamity dodges should probably not send a vanilla dodge packet considering that causes Tabi dust - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { - NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } } } public void EclipseMirrorEvade() { - if (player.whoAmI == Main.myPlayer && eclipseMirror) + if (Player.whoAmI == Main.myPlayer && eclipseMirror) { - player.AddCooldown(GlobalDodge.ID, MirrorDodgeCooldown, true, "eclipsemirror"); + Player.AddCooldown(GlobalDodge.ID, MirrorDodgeCooldown, true, "eclipsemirror"); // TODO -- why is this here? - player.noKnockback = true; + Player.noKnockback = true; - player.GiveIFrames(player.longInvince ? 100 : 60, true); + Player.GiveIFrames(Player.longInvince ? 100 : 60, true); rogueStealth = rogueStealthMax; - Main.PlaySound(SoundID.Item68, player.Center); + SoundEngine.PlaySound(SoundID.Item68, Player.Center); - int eclipse = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(2750 * player.RogueDamage()), 0, player.whoAmI); + int eclipse = Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(2750 * Player.RogueDamage()), 0, Player.whoAmI); if (eclipse.WithinBounds(Main.maxProjectiles)) Main.projectile[eclipse].Calamity().forceTypeless = true; // TODO -- Calamity dodges should probably not send a vanilla dodge packet considering that causes Tabi dust - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { - NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } } } @@ -4378,7 +4379,7 @@ namespace CalamityMod.CalPlayer PopupGUIManager.SuspendAll(); // Determine which minions need to be respawned. - if (Main.myPlayer == player.whoAmI) + if (Main.myPlayer == Player.whoAmI) { int endoHydraHeadCount = 0; int endoCooperType = ModContent.ProjectileType(); @@ -4390,7 +4391,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxProjectiles; i++) { Projectile projectile = Main.projectile[i]; - if (projectile.type != endoHydraHeadType || projectile.owner != player.whoAmI || !projectile.active) + if (projectile.type != endoHydraHeadType || projectile.owner != Player.whoAmI || !projectile.active) continue; endoHydraHeadCount++; } @@ -4399,7 +4400,7 @@ namespace CalamityMod.CalPlayer { Projectile projectile = Main.projectile[i]; if ((projectile.minionSlots <= 0f && !CalamityLists.ZeroMinionSlotExceptionList.Contains(projectile.type)) || !projectile.minion || - projectile.owner != player.whoAmI || !projectile.active || CalamityLists.MinionsToNotResurrectList.Contains(projectile.type)) + projectile.owner != Player.whoAmI || !projectile.active || CalamityLists.MinionsToNotResurrectList.Contains(projectile.type)) continue; DeadMinionProperties deadMinionProperties; @@ -4435,21 +4436,21 @@ namespace CalamityMod.CalPlayer { for (int i = 0; i < 40; i++) { - Dust dust = Dust.NewDustPerfect(player.Center + Utils.NextVector2Circular(Main.rand, 60f, 90f), 133); + Dust dust = Dust.NewDustPerfect(Player.Center + Utils.NextVector2Circular(Main.rand, 60f, 90f), 133); dust.velocity = Utils.NextVector2Circular(Main.rand, 4f, 4f); dust.noGravity = true; dust.scale = Main.rand.NextFloat(1.2f, 1.35f); } for (int i = 0; i < 3; i++) - Utils.PoofOfSmoke(player.Center + Utils.NextVector2Circular(Main.rand, 20f, 30f)); + Utils.PoofOfSmoke(Player.Center + Utils.NextVector2Circular(Main.rand, 20f, 30f)); } } - if (invincible && player.ActiveItem().type != ModContent.ItemType()) + if (invincible && Player.ActiveItem().type != ModContent.ItemType()) { - if (player.statLife <= 0) - player.statLife = 1; + if (Player.statLife <= 0) + Player.statLife = 1; return false; } @@ -4463,37 +4464,37 @@ namespace CalamityMod.CalPlayer } } - if (nCore && !player.HasCooldown(Cooldowns.NebulousCore.ID)) + if (nCore && !Player.HasCooldown(Cooldowns.NebulousCore.ID)) { - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 67); + SoundEngine.PlaySound(SoundID.Item, (int)Player.position.X, (int)Player.position.Y, 67); for (int j = 0; j < 50; j++) { - int num = Dust.NewDust(player.position, player.width, player.height, 173, 0f, 0f, 100, default, 2f); + int num = Dust.NewDust(Player.position, Player.width, Player.height, 173, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[num]; dust.position.X += Main.rand.Next(-20, 21); dust.position.Y += Main.rand.Next(-20, 21); dust.velocity *= 0.9f; dust.scale *= 1f + Main.rand.Next(40) * 0.01f; - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + dust.shader = GameShaders.Armor.GetSecondaryShader(Player.cWaist, Player); if (Main.rand.NextBool(2)) dust.scale *= 1f + Main.rand.Next(40) * 0.01f; } - player.statLife += 100; - player.HealEffect(100); + Player.statLife += 100; + Player.HealEffect(100); - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; + if (Player.statLife > Player.statLifeMax2) + Player.statLife = Player.statLifeMax2; - player.AddCooldown(Cooldowns.NebulousCore.ID, CalamityUtils.SecondsToFrames(90)); + Player.AddCooldown(Cooldowns.NebulousCore.ID, CalamityUtils.SecondsToFrames(90)); return false; } - if (dashMod == 9 && player.dashDelay < 0) + if (dashMod == 9 && Player.dashDelay < 0) { - if (player.statLife < 1) - player.statLife = 1; + if (Player.statLife < 1) + Player.statLife = 1; return false; } @@ -4502,65 +4503,65 @@ namespace CalamityMod.CalPlayer { if (silvaCountdown == silvaReviveDuration && !hasSilvaEffect) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/SilvaActivation"), (int)player.position.X, (int)player.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/SilvaActivation"), (int)Player.position.X, (int)Player.position.Y); - player.AddBuff(ModContent.BuffType(), silvaReviveDuration); + Player.AddBuff(ModContent.BuffType(), silvaReviveDuration); - if (draconicSurge && !player.HasCooldown(DraconicElixir.ID)) + if (draconicSurge && !Player.HasCooldown(DraconicElixir.ID)) { - player.statLife += player.statLifeMax2 / 2; - player.HealEffect(player.statLifeMax2 / 2); + Player.statLife += Player.statLifeMax2 / 2; + Player.HealEffect(Player.statLifeMax2 / 2); - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; + if (Player.statLife > Player.statLifeMax2) + Player.statLife = Player.statLifeMax2; - if (player.FindBuffIndex(ModContent.BuffType()) > -1) + if (Player.FindBuffIndex(ModContent.BuffType()) > -1) { - player.ClearBuff(ModContent.BuffType()); - player.AddCooldown(DraconicElixir.ID, CalamityUtils.SecondsToFrames(60)); + Player.ClearBuff(ModContent.BuffType()); + Player.AddCooldown(DraconicElixir.ID, CalamityUtils.SecondsToFrames(60)); // Additional potion sickness time int additionalTime = 0; for (int i = 0; i < Player.MaxBuffs; i++) { - if (player.buffType[i] == BuffID.PotionSickness) - additionalTime = player.buffTime[i]; + if (Player.buffType[i] == BuffID.PotionSickness) + additionalTime = Player.buffTime[i]; } float potionSicknessTime = 30f + (float)Math.Ceiling(additionalTime / 60D); - player.AddBuff(BuffID.PotionSickness, CalamityUtils.SecondsToFrames(potionSicknessTime)); + Player.AddBuff(BuffID.PotionSickness, CalamityUtils.SecondsToFrames(potionSicknessTime)); } } else if (silvaWings) { - player.statLife += player.statLifeMax2 / 2; - player.HealEffect(player.statLifeMax2 / 2); + Player.statLife += Player.statLifeMax2 / 2; + Player.HealEffect(Player.statLifeMax2 / 2); - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; + if (Player.statLife > Player.statLifeMax2) + Player.statLife = Player.statLifeMax2; } } hasSilvaEffect = true; - if (player.statLife < 1) - player.statLife = 1; + if (Player.statLife < 1) + Player.statLife = 1; return false; } - if (permafrostsConcoction && !player.HasCooldown(PermafrostConcoction.ID)) + if (permafrostsConcoction && !Player.HasCooldown(PermafrostConcoction.ID)) { - player.AddCooldown(PermafrostConcoction.ID, CalamityUtils.SecondsToFrames(180)); - player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(3f)); + Player.AddCooldown(PermafrostConcoction.ID, CalamityUtils.SecondsToFrames(180)); + Player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(3f)); - player.statLife = player.statLifeMax2 * 3 / 10; + Player.statLife = Player.statLifeMax2 * 3 / 10; - Main.PlaySound(SoundID.Item92, player.position); + SoundEngine.PlaySound(SoundID.Item92, Player.position); for (int i = 0; i < 60; i++) { - int d = Dust.NewDust(player.position, player.width, player.height, 88, 0f, 0f, 0, default, 2.5f); + int d = Dust.NewDust(Player.position, Player.width, Player.height, 88, 0f, 0f, 0, default, 2.5f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 5f; } @@ -4575,102 +4576,102 @@ namespace CalamityMod.CalPlayer if (alcoholPoisoning) { if (Main.rand.NextBool()) - damageSource = PlayerDeathReason.ByCustomReason(player.name + " downed too many shots."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " downed too many shots."); else - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s liver failed."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + "'s liver failed."); } if (vHex) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was charred by the brimstone inferno."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " was charred by the brimstone inferno."); } - if (ZoneCalamity && player.lavaWet) + if (ZoneCalamity && Player.lavaWet) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s soul was released by the lava."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + "'s soul was released by the lava."); } if (gsInferno) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s soul was extinguished."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + "'s soul was extinguished."); } if (sulphurPoison) { if (Main.rand.NextBool(2)) - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was melted by the toxic waste."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " was melted by the toxic waste."); else damageSource = PlayerDeathReason.ByOther(9); } if (dragonFire) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " disintegrated into ashes."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " disintegrated into ashes."); } if (hInferno) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was turned to ashes by the Profaned Goddess."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " was turned to ashes by the Profaned Goddess."); } if (hFlames || banishingFire) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " fell prey to their sins."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " fell prey to their sins."); } if (waterLeechBleeding) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " lost too much blood."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " lost too much blood."); } if (shadowflame) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s spirit was turned to ash."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + "'s spirit was turned to ash."); } if (bBlood) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " became a blood geyser."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " became a blood geyser."); } if (cDepth) { if (Main.rand.NextBool()) - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was crushed by the pressure."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " was crushed by the pressure."); else - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s lungs collapsed."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + "'s lungs collapsed."); } if (bFlames || aFlames || weakBrimstoneFlames) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was consumed by the black flames."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " was consumed by the black flames."); } if (pFlames) { if (Main.rand.NextBool()) - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s flesh was melted by the plague."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + "'s flesh was melted by the plague."); else - damageSource = PlayerDeathReason.ByCustomReason(player.name + " didn't vaccinate."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " didn't vaccinate."); } if (astralInfection) { if (Main.rand.NextBool()) - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s infection spread too far."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + "'s infection spread too far."); else - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s skin was replaced by the astral virus."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + "'s skin was replaced by the astral virus."); } if (nightwither) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was incinerated by lunar rays."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " was incinerated by lunar rays."); } if (vaporfied) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " vaporized into thin air."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " vaporized into thin air."); } if (manaOverloader || ManaBurn) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s life was completely converted into mana."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + "'s life was completely converted into mana."); } if (bloodyMary || everclear || evergreenGin || fireball || margarita || moonshine || moscowMule || redWine || screwdriver || starBeamRye || tequila || tequilaSunrise || vodka || whiteWine) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " succumbed to alcohol sickness."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " succumbed to alcohol sickness."); } if (witheredDebuff) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " withered away."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " withered away."); } } if (profanedCrystalBuffs && !profanedCrystalHide) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was summoned too soon."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " was summoned too soon."); } if (NPC.AnyNPCs(ModContent.NPCType())) @@ -4682,7 +4683,7 @@ namespace CalamityMod.CalPlayer } deathCount++; - if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) + if (Player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) { SyncDeathCount(false); } @@ -4804,14 +4805,14 @@ namespace CalamityMod.CalPlayer #region Melee Effects public override void MeleeEffects(Item item, Rectangle hitbox) { - if (!item.melee && !item.noMelee && (!item.noUseGraphic && player.meleeEnchant > 0)) + if (!item.melee && !item.noMelee && (!item.noUseGraphic && Player.meleeEnchant > 0)) { - if (player.meleeEnchant == 7) + if (Player.meleeEnchant == 7) { if (Main.rand.NextBool(20)) { int confettiDust = Main.rand.Next(139, 143); - int confetti = Dust.NewDust(new Vector2(hitbox.X,hitbox.Y), hitbox.Width, hitbox.Height, confettiDust, player.velocity.X, player.velocity.Y, 0, new Color(), 1.2f); + int confetti = Dust.NewDust(new Vector2(hitbox.X,hitbox.Y), hitbox.Width, hitbox.Height, confettiDust, Player.velocity.X, Player.velocity.Y, 0, new Color(), 1.2f); Main.dust[confetti].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); Main.dust[confetti].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); Main.dust[confetti].velocity.X += Main.rand.Next(-50, 51) * 0.05f; @@ -4821,7 +4822,7 @@ namespace CalamityMod.CalPlayer if (Main.rand.NextBool(40)) { int confettiGore = Main.rand.Next(276, 283); - int confetti = Gore.NewGore(new Vector2(hitbox.X, hitbox.Y), player.velocity, confettiGore, 1f); + int confetti = Gore.NewGore(new Vector2(hitbox.X, hitbox.Y), Player.velocity, confettiGore, 1f); Main.gore[confetti].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); Main.gore[confetti].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); Main.gore[confetti].scale *= (float)(1.0 + Main.rand.Next(-20, 21) * 0.01); @@ -4832,85 +4833,85 @@ namespace CalamityMod.CalPlayer } if (item.melee) { - if (fungalSymbiote && player.whoAmI == Main.myPlayer && fungalSymbioteTimer == 0) + if (fungalSymbiote && Player.whoAmI == Main.myPlayer && fungalSymbioteTimer == 0) { - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1) || - player.itemAnimation == (int)(player.itemAnimationMax * 0.3) || - player.itemAnimation == (int)(player.itemAnimationMax * 0.5) || - player.itemAnimation == (int)(player.itemAnimationMax * 0.7) || - player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) + if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.1) || + Player.itemAnimation == (int)(Player.itemAnimationMax * 0.3) || + Player.itemAnimation == (int)(Player.itemAnimationMax * 0.5) || + Player.itemAnimation == (int)(Player.itemAnimationMax * 0.7) || + Player.itemAnimation == (int)(Player.itemAnimationMax * 0.9)) { fungalSymbioteTimer = 3; float yVel = 0f; float xVel = 0f; float yOffset = 0f; float xOffset = 0f; - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) + if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.9)) { yVel = -7f; } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) + if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.7)) { yVel = -6f; xVel = 2f; } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.5)) + if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.5)) { yVel = -4f; xVel = 4f; } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.3)) + if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.3)) { yVel = -2f; xVel = 6f; } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1)) + if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.1)) { xVel = 7f; } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) + if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.7)) { xOffset = 26f; } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.3)) + if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.3)) { xOffset -= 4f; yOffset -= 20f; } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1)) + if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.1)) { yOffset += 6f; } - if (player.direction == -1) + if (Player.direction == -1) { - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) + if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.9)) { xOffset -= 8f; } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) + if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.7)) { xOffset -= 6f; } } yVel *= 1.5f; xVel *= 1.5f; - xOffset *= (float)player.direction; - yOffset *= player.gravDir; - Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + xOffset, (float)(hitbox.Y + hitbox.Height / 2) + yOffset, (float)player.direction * xVel, yVel * player.gravDir, ProjectileID.Mushroom, (int)(item.damage * 0.15 * player.MeleeDamage()), 0f, player.whoAmI, 0f, 0f); + xOffset *= (float)Player.direction; + yOffset *= Player.gravDir; + Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + xOffset, (float)(hitbox.Y + hitbox.Height / 2) + yOffset, (float)Player.direction * xVel, yVel * Player.gravDir, ProjectileID.Mushroom, (int)(item.damage * 0.15 * Player.MeleeDamage()), 0f, Player.whoAmI, 0f, 0f); } } if (aWeapon) { if (Main.rand.NextBool(3)) { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType(), player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, default, 0.75f); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType(), Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, default, 0.75f); } } if (eGauntlet) { if (Main.rand.NextBool(3)) { - int element = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 66, player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); + int element = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 66, Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); Main.dust[element].noGravity = true; } } @@ -4918,21 +4919,21 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(3)) { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 67, player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, default, 0.75f); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 67, Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, default, 0.75f); } } if (xerocSet) { if (Main.rand.NextBool(3)) { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 58, player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, default, 1.25f); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 58, Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, default, 1.25f); } } if (dsSetBonus) { if (Main.rand.NextBool(3)) { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 27, player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, default, 2.5f); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 27, Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, default, 2.5f); } } } @@ -4998,7 +4999,7 @@ namespace CalamityMod.CalPlayer } if (item.melee && badgeOfBravery) { - int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); + int penetratableDefense = Math.Max(target.defense - Player.armorPenetration, 0); int penetratedDefense = Math.Min(penetratableDefense, 5); damage += (int)(0.5f * penetratedDefense); } @@ -5006,11 +5007,11 @@ namespace CalamityMod.CalPlayer if (draedonsHeart) { - if (player.StandingStill() && player.itemAnimation == 0) + if (Player.StandingStill() && Player.itemAnimation == 0) damage = (int)(damage * 0.5); } - if ((target.damage > 0 || target.boss) && !target.SpawnedFromStatue && player.whoAmI == Main.myPlayer) + if ((target.damage > 0 || target.boss) && !target.SpawnedFromStatue && Player.whoAmI == Main.myPlayer) { if (CalamityConfig.Instance.Proficiency) { @@ -5050,7 +5051,7 @@ namespace CalamityMod.CalPlayer bool isTrueMelee = proj.Calamity().trueMelee; bool isSummon = proj.IsSummon(); - Item heldItem = player.ActiveItem(); + Item heldItem = Player.ActiveItem(); #region MultiplierBoosts double damageMult = 1.0; @@ -5067,7 +5068,7 @@ namespace CalamityMod.CalPlayer { // Add more true melee damage to the true melee projectile that scales with melee speed // This is done because melee speed does nothing to melee weapons that are purely projectiles - damageMult += trueMeleeDamage + ((1f - player.meleeSpeed) * (100f / player.meleeSpeed) / 100f * 0.25f); + damageMult += trueMeleeDamage + ((1f - Player.meleeSpeed) * (100f / Player.meleeSpeed) / 100f * 0.25f); } if (screwdriver) @@ -5168,7 +5169,7 @@ namespace CalamityMod.CalPlayer { penetrateAmt += 5; } - int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); //if find how much defense we can penetrate + int penetratableDefense = Math.Max(target.defense - Player.armorPenetration, 0); //if find how much defense we can penetrate int penetratedDefense = Math.Min(penetratableDefense, penetrateAmt); //if we have more penetrate than enemy defense, use enemy defense damage += (int)(0.5f * penetratedDefense); #endregion @@ -5179,7 +5180,7 @@ namespace CalamityMod.CalPlayer // Forbidden armor reduces said nerf when holding the respective helmet's preferred weapon type // Profaned Soul Crystal encourages use of other weapons, nerfing the damage would not make sense. - bool forbidden = player.head == ArmorIDs.Head.AncientBattleArmor && player.body == ArmorIDs.Body.AncientBattleArmor && player.legs == ArmorIDs.Legs.AncientBattleArmor; + bool forbidden = Player.head == ArmorIDs.Head.AncientBattleArmor && Player.body == ArmorIDs.Body.AncientBattleArmor && Player.legs == ArmorIDs.Legs.AncientBattleArmor; bool reducedNerf = fearmongerSet || (forbidden && heldItem.magic) || (GemTechSet && GemTechState.IsBlueGemActive); double summonNerfMult = reducedNerf ? 0.75 : 0.5; @@ -5209,12 +5210,12 @@ namespace CalamityMod.CalPlayer damage = (int)(damage * 0.75); } - if (proj.type == ProjectileID.SpectreWrath && player.ghostHurt) + if (proj.type == ProjectileID.SpectreWrath && Player.ghostHurt) damage = (int)(damage * 0.7); if (draedonsHeart) { - if (player.StandingStill() && player.itemAnimation == 0) + if (Player.StandingStill() && Player.itemAnimation == 0) damage = (int)(damage * 0.5); } @@ -5422,8 +5423,8 @@ namespace CalamityMod.CalPlayer // Check if the player has iframes for the sake of avoiding defense damage. bool hasIFrames = false; - for (int i = 0; i < player.hurtCooldowns.Length; i++) - if (player.hurtCooldowns[i] > 0) + for (int i = 0; i < Player.hurtCooldowns.Length; i++) + if (Player.hurtCooldowns[i] > 0) hasIFrames = true; // If this NPC deals defense damage with contact damage, then apply defense damage. @@ -5468,16 +5469,16 @@ namespace CalamityMod.CalPlayer contactDamageReduction += 0.5; } - if (fleshTotem && !player.HasCooldown(Cooldowns.FleshTotem.ID)) + if (fleshTotem && !Player.HasCooldown(Cooldowns.FleshTotem.ID)) { - player.AddCooldown(Cooldowns.FleshTotem.ID, CalamityUtils.SecondsToFrames(20), true, coreOfTheBloodGod ? "bloodgod" : "default"); + Player.AddCooldown(Cooldowns.FleshTotem.ID, CalamityUtils.SecondsToFrames(20), true, coreOfTheBloodGod ? "bloodgod" : "default"); contactDamageReduction += 0.5; } - if (tarragonCloak && tarraMelee && !player.HasCooldown(Cooldowns.TarragonCloak.ID)) + if (tarragonCloak && tarraMelee && !Player.HasCooldown(Cooldowns.TarragonCloak.ID)) contactDamageReduction += 0.5; - if (bloodflareMelee && bloodflareFrenzy && !player.HasCooldown(BloodflareFrenzy.ID)) + if (bloodflareMelee && bloodflareFrenzy && !Player.HasCooldown(BloodflareFrenzy.ID)) contactDamageReduction += 0.5; if (npc.Calamity().tSad > 0) @@ -5518,10 +5519,10 @@ namespace CalamityMod.CalPlayer if (encased) contactDamageReduction += 0.3; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && player.ActiveItem().type == ModContent.ItemType()) + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && Player.ActiveItem().type == ModContent.ItemType()) contactDamageReduction += 0.5; - if (theBee && player.statLife >= player.statLifeMax2 && theBeeCooldown <= 0) + if (theBee && Player.statLife >= Player.statLifeMax2 && theBeeCooldown <= 0) { contactDamageReduction += 0.5; theBeeCooldown = 600; @@ -5539,7 +5540,7 @@ namespace CalamityMod.CalPlayer } } - if (player.mount.Active && (player.mount.Type == ModContent.MountType() || player.mount.Type == ModContent.MountType()) && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) + if (Player.mount.Active && (Player.mount.Type == ModContent.MountType() || Player.mount.Type == ModContent.MountType()) && Math.Abs(Player.velocity.X) > Player.mount.RunSpeed / 2f) contactDamageReduction += 0.1; if (vHex) @@ -5611,7 +5612,7 @@ namespace CalamityMod.CalPlayer if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && damage > 0) { // Reflects count as dodges. They share the timer and can be disabled by Armageddon right click. - if (!disableAllDodges && !player.HasCooldown(GlobalDodge.ID)) + if (!disableAllDodges && !Player.HasCooldown(GlobalDodge.ID)) { // The Evolution if (projRefRare) @@ -5621,21 +5622,21 @@ namespace CalamityMod.CalPlayer proj.velocity *= -2f; proj.extraUpdates += 1; proj.penetrate = 1; - player.GiveIFrames(20, false); + Player.GiveIFrames(20, false); damage = 0; projRefRareLifeRegenCounter = 300; projTypeJustHitBy = proj.type; - player.AddCooldown(GlobalDodge.ID, EvolutionReflectCooldown); + Player.AddCooldown(GlobalDodge.ID, EvolutionReflectCooldown); return; } } } - if (phantomicArtifact && player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) + if (phantomicArtifact && Player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) { - Projectile pro = Main.projectile.AsEnumerable().Where(projectile => projectile.friendly && projectile.owner == player.whoAmI && projectile.type == ModContent.ProjectileType()).First(); + Projectile pro = Main.projectile.AsEnumerable().Where(projectile => projectile.friendly && projectile.owner == Player.whoAmI && projectile.type == ModContent.ProjectileType()).First(); phantomicBulwarkCooldown = 1800; // 30 second cooldown pro.Kill(); projectileDamageReduction += 0.2; @@ -5699,8 +5700,8 @@ namespace CalamityMod.CalPlayer // Check if the player has iframes for the sake of avoiding defense damage. bool hasIFrames = false; - for (int i = 0; i < player.hurtCooldowns.Length; i++) - if (player.hurtCooldowns[i] > 0) + for (int i = 0; i < Player.hurtCooldowns.Length; i++) + if (Player.hurtCooldowns[i] > 0) hasIFrames = true; // If this projectile is capable of dealing defense damage, then apply defense damage. @@ -5711,7 +5712,7 @@ namespace CalamityMod.CalPlayer // Reduce projectile damage based on banner type // IMPORTANT NOTE: Rework this in 1.4! // TODO -- 1.4 has a banner projectile source system. Rework this. - Point point = player.Center.ToTileCoordinates(); + Point point = Player.Center.ToTileCoordinates(); int buffScanAreaWidth = (Main.maxScreenW + 800) / 16 - 1; int buffScanAreaHeight = (Main.maxScreenH + 800) / 16 - 1; Rectangle rectangle = CalamityUtils.ClampToWorld(tileRectangle: new Rectangle(point.X - buffScanAreaWidth / 2, point.Y - buffScanAreaHeight / 2, buffScanAreaWidth, buffScanAreaHeight)); @@ -5730,10 +5731,10 @@ namespace CalamityMod.CalPlayer if (tile is null || !tile.active()) continue; - if (tile.type == TileID.Banners && (tile.frameX >= 396 || tile.frameY >= 54)) + if (tile.TileType == TileID.Banners && (tile.TileFrameX >= 396 || tile.TileFrameY >= 54)) { - int bannerType = tile.frameX / 18 - 21; - for (int k = tile.frameY; k >= 54; k -= 54) + int bannerType = tile.TileFrameX / 18 - 21; + for (int k = tile.TileFrameY; k >= 54; k -= 54) { bannerType += 90; bannerType += 21; @@ -5746,9 +5747,9 @@ namespace CalamityMod.CalPlayer hasBanner = true; } } - if (tile.type == ModContent.TileType()) + if (tile.TileType == ModContent.TileType()) { - int bannerType = tile.frameX / 18; + int bannerType = tile.TileFrameX / 18; int bannerItemType = CalamityUtils.GetBannerItem(bannerType); if (ItemID.Sets.BannerStrength[bannerItemType].Enabled) @@ -5779,7 +5780,7 @@ namespace CalamityMod.CalPlayer if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && damage > 0) { // Daedalus Reflect counts as a reflect but doesn't actually stop you from taking damage - if (daedalusReflect && !disableAllDodges && !projRefRare && !player.HasCooldown(GlobalDodge.ID)) + if (daedalusReflect && !disableAllDodges && !projRefRare && !Player.HasCooldown(GlobalDodge.ID)) projectileDamageReduction += 0.5; } @@ -5807,10 +5808,10 @@ namespace CalamityMod.CalPlayer if (encased) projectileDamageReduction += 0.3; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && player.ActiveItem().type == ModContent.ItemType()) + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && Player.ActiveItem().type == ModContent.ItemType()) projectileDamageReduction += 0.5; - if (theBee && player.statLife >= player.statLifeMax2 && theBeeCooldown <= 0) + if (theBee && Player.statLife >= Player.statLifeMax2 && theBeeCooldown <= 0) { projectileDamageReduction += 0.5; theBeeCooldown = 600; @@ -5828,7 +5829,7 @@ namespace CalamityMod.CalPlayer } } - if (player.mount.Active && (player.mount.Type == ModContent.MountType() || player.mount.Type == ModContent.MountType()) && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) + if (Player.mount.Active && (Player.mount.Type == ModContent.MountType() || Player.mount.Type == ModContent.MountType()) && Math.Abs(Player.velocity.X) > Player.mount.RunSpeed / 2f) projectileDamageReduction += 0.1; if (vHex) @@ -6408,27 +6409,27 @@ namespace CalamityMod.CalPlayer if (npc.type == NPCID.ShadowFlameApparition || (npc.type == NPCID.ChaosBall && (Main.hardMode || areThereAnyDamnBosses))) { - player.AddBuff(ModContent.BuffType(), 180); + Player.AddBuff(ModContent.BuffType(), 180); } else if (npc.type == NPCID.Spazmatism && npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) { - player.AddBuff(BuffID.Bleeding, 300); + Player.AddBuff(BuffID.Bleeding, 300); } else if (npc.type == NPCID.Plantera && npc.life < npc.lifeMax / 2) { - player.AddBuff(BuffID.Poisoned, 300); + Player.AddBuff(BuffID.Poisoned, 300); } else if (npc.type == NPCID.PlanterasTentacle) { - player.AddBuff(BuffID.Poisoned, 180); + Player.AddBuff(BuffID.Poisoned, 180); } else if (npc.type == NPCID.AncientDoom) { - player.AddBuff(ModContent.BuffType(), 120); + Player.AddBuff(ModContent.BuffType(), 120); } else if (npc.type == NPCID.AncientLight) { - player.AddBuff(ModContent.BuffType(), 180); + Player.AddBuff(ModContent.BuffType(), 180); } } @@ -6444,7 +6445,7 @@ namespace CalamityMod.CalPlayer else { Player p = Main.player[proj.owner]; - if (p.hostile && player.hostile && (player.team != p.team || p.team == 0)) + if (p.hostile && Player.hostile && (Player.team != p.team || p.team == 0)) p.AddBuff(BuffID.Poisoned, 120); } } @@ -6453,58 +6454,58 @@ namespace CalamityMod.CalPlayer { if (proj.type == ProjectileID.Explosives) { - player.AddBuff(BuffID.OnFire, 600); + Player.AddBuff(BuffID.OnFire, 600); } else if (proj.type == ProjectileID.Boulder) { - player.AddBuff(BuffID.BrokenArmor, 600); + Player.AddBuff(BuffID.BrokenArmor, 600); } - else if (proj.type == ProjectileID.FrostBeam && !player.frozen && !gState) + else if (proj.type == ProjectileID.FrostBeam && !Player.frozen && !gState) { - player.AddBuff(ModContent.BuffType(), 120); + Player.AddBuff(ModContent.BuffType(), 120); } else if (proj.type == ProjectileID.DeathLaser || proj.type == ProjectileID.RocketSkeleton) { - player.AddBuff(BuffID.OnFire, 240); + Player.AddBuff(BuffID.OnFire, 240); } else if (proj.type == ProjectileID.Skull) { - player.AddBuff(BuffID.Weak, 180); + Player.AddBuff(BuffID.Weak, 180); } else if (proj.type == ProjectileID.ThornBall) { - player.AddBuff(BuffID.Poisoned, 240); + Player.AddBuff(BuffID.Poisoned, 240); } else if (proj.type == ProjectileID.CultistBossIceMist) { - player.AddBuff(BuffID.Frozen, 90); - player.AddBuff(BuffID.Chilled, 180); + Player.AddBuff(BuffID.Frozen, 90); + Player.AddBuff(BuffID.Chilled, 180); } else if (proj.type == ProjectileID.CultistBossLightningOrbArc) { int deathModeDuration = NPC.downedMoonlord ? 80 : NPC.downedPlantBoss ? 40 : Main.hardMode ? 20 : 10; - player.AddBuff(BuffID.Electrified, proj.Calamity().lineColor == 1 ? deathModeDuration : 120); + Player.AddBuff(BuffID.Electrified, proj.Calamity().lineColor == 1 ? deathModeDuration : 120); // Scaled duration for DM lightning, 2 seconds for Storm Weaver/Cultist lightning } else if (proj.type == ProjectileID.AncientDoomProjectile) { - player.AddBuff(ModContent.BuffType(), 120); + Player.AddBuff(ModContent.BuffType(), 120); } else if (proj.type == ProjectileID.CultistBossFireBallClone) { - player.AddBuff(ModContent.BuffType(), 120); + Player.AddBuff(ModContent.BuffType(), 120); } else if (proj.type == ProjectileID.PhantasmalBolt || proj.type == ProjectileID.PhantasmalEye) { - player.AddBuff(ModContent.BuffType(), 180); + Player.AddBuff(ModContent.BuffType(), 180); } else if (proj.type == ProjectileID.PhantasmalSphere) { - player.AddBuff(ModContent.BuffType(), 360); + Player.AddBuff(ModContent.BuffType(), 360); } else if (proj.type == ProjectileID.PhantasmalDeathray) { - player.AddBuff(ModContent.BuffType(), 600); + Player.AddBuff(ModContent.BuffType(), 600); } } @@ -6519,14 +6520,14 @@ namespace CalamityMod.CalPlayer proj.hostile = false; proj.friendly = true; proj.velocity *= -1f; - proj.damage = (int)(proj.damage * 8 * player.AverageDamage()); + proj.damage = (int)(proj.damage * 8 * Player.AverageDamage()); proj.penetrate = 1; - player.GiveIFrames(20, false); + Player.GiveIFrames(20, false); } } // Reflects count as dodges. They share the timer and can be disabled by global dodge disabling effects. - if (!disableAllDodges && !player.HasCooldown(GlobalDodge.ID)) + if (!disableAllDodges && !Player.HasCooldown(GlobalDodge.ID)) { if (daedalusReflect && !projRefRare) { @@ -6534,11 +6535,11 @@ namespace CalamityMod.CalPlayer proj.friendly = true; proj.velocity *= -1f; proj.penetrate = 1; - player.GiveIFrames(20, false); + Player.GiveIFrames(20, false); damage /= 2; - player.AddCooldown(GlobalDodge.ID, DaedalusReflectCooldown); + Player.AddCooldown(GlobalDodge.ID, DaedalusReflectCooldown); // No return because the projectile hit isn't canceled -- it only does half damage. } } @@ -6560,17 +6561,17 @@ namespace CalamityMod.CalPlayer if (item.Calamity().rogue && item.type != ModContent.ItemType()) { float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 vector2 = Player.RotatedRelativePoint(Player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) + if (Player.gravDir == -1f) { num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; } float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) { - num78 = (float)player.direction; + num78 = (float)Player.direction; num79 = 0f; num80 = num72; } @@ -6579,8 +6580,8 @@ namespace CalamityMod.CalPlayer num80 = num72 / num80; } - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2 = new Vector2(Player.position.X + (float)Player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)Player.direction) + ((float)Main.mouseX + Main.screenPosition.X - Player.position.X), Player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + Player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); vector2.Y -= 100f; num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -6598,7 +6599,7 @@ namespace CalamityMod.CalPlayer num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; - int p = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, (int)(damage * 0.065), knockBack * 0.5f, player.whoAmI); + int p = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, (int)(damage * 0.065), knockBack * 0.5f, Player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().forceTypeless = true; //in case melee/rogue variants bug out @@ -6612,7 +6613,7 @@ namespace CalamityMod.CalPlayer if (StealthStrikeAvailable()) { int knifeCount = 15; - int knifeDamage = (int)(35 * player.RogueDamage()); + int knifeDamage = (int)(35 * Player.RogueDamage()); float angleStep = MathHelper.TwoPi / knifeCount; float speed = 15f; @@ -6622,7 +6623,7 @@ namespace CalamityMod.CalPlayer velocity = velocity.RotatedBy(angleStep * i); int knifeCol = Main.rand.Next(0, 2); - int knife = Projectile.NewProjectile(player.Center, velocity, ModContent.ProjectileType(), knifeDamage, 0f, player.whoAmI, knifeCol, 0); + int knife = Projectile.NewProjectile(Player.Center, velocity, ModContent.ProjectileType(), knifeDamage, 0f, Player.whoAmI, knifeCol, 0); if (knife.WithinBounds(Main.maxProjectiles)) Main.projectile[knife].Calamity().forceTypeless = true; } @@ -6640,7 +6641,7 @@ namespace CalamityMod.CalPlayer { Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.4f) * 1250f; Vector2 directionToMouse = (startingPosition - Main.MouseWorld).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.1f); - int drop = Projectile.NewProjectileDirect(startingPosition, directionToMouse * 12f, ModContent.ProjectileType(), (int)(damage * 0.3), 0f, player.whoAmI).penetrate = 2; + int drop = Projectile.NewProjectileDirect(startingPosition, directionToMouse * 12f, ModContent.ProjectileType(), (int)(damage * 0.3), 0f, Player.whoAmI).penetrate = 2; if (drop.WithinBounds(Main.maxProjectiles)) Main.projectile[drop].Calamity().forceTypeless = true; } @@ -6655,20 +6656,20 @@ namespace CalamityMod.CalPlayer #region Frame Effects public override void FrameEffects() { - if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot || - player.Calamity().andromedaState == AndromedaPlayerState.SpecialAttack) + if (Player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot || + Player.Calamity().andromedaState == AndromedaPlayerState.SpecialAttack) { - player.head = mod.GetEquipSlot("NoHead", EquipType.Head); // To make the head invisible on the map. The map was having a hissy fit because of hitbox changes. + Player.head = Mod.GetEquipSlot("NoHead", EquipType.Head); // To make the head invisible on the map. The map was having a hissy fit because of hitbox changes. } else if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) { - player.legs = mod.GetEquipSlot("ProviLegs", EquipType.Legs); - player.body = mod.GetEquipSlot("ProviBody", EquipType.Body); - player.head = mod.GetEquipSlot("ProviHead", EquipType.Head); - player.wings = mod.GetEquipSlot("ProviWings", EquipType.Wings); - player.face = -1; + Player.legs = Mod.GetEquipSlot("ProviLegs", EquipType.Legs); + Player.body = Mod.GetEquipSlot("ProviBody", EquipType.Body); + Player.head = Mod.GetEquipSlot("ProviHead", EquipType.Head); + Player.wings = Mod.GetEquipSlot("ProviWings", EquipType.Wings); + Player.face = -1; - bool enrage = !profanedCrystalForce && profanedCrystalBuffs && player.statLife <= (int)(player.statLifeMax2 * 0.5); + bool enrage = !profanedCrystalForce && profanedCrystalBuffs && Player.statLife <= (int)(Player.statLifeMax2 * 0.5); if (profanedCrystalWingCounter.Value == 0) { @@ -6676,50 +6677,50 @@ namespace CalamityMod.CalPlayer profanedCrystalWingCounter = new KeyValuePair(key == 3 ? 0 : key + 1, enrage ? 5 : 7); } - player.wingFrame = profanedCrystalWingCounter.Key; + Player.wingFrame = profanedCrystalWingCounter.Key; profanedCrystalWingCounter = new KeyValuePair(profanedCrystalWingCounter.Key, profanedCrystalWingCounter.Value - 1); - player.armorEffectDrawOutlines = true; + Player.armorEffectDrawOutlines = true; if (profanedCrystalBuffs) { - player.armorEffectDrawShadow = true; + Player.armorEffectDrawShadow = true; if (enrage) { - player.armorEffectDrawOutlinesForbidden = true; + Player.armorEffectDrawOutlinesForbidden = true; } } } else if ((snowmanPower || snowmanForce) && !snowmanHide) { - player.legs = mod.GetEquipSlot("PopoLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("PopoBody", EquipType.Body); - player.head = snowmanNoseless ? mod.GetEquipSlot("PopoNoselessHead", EquipType.Head) : mod.GetEquipSlot("PopoHead", EquipType.Head); - player.face = -1; + Player.legs = Mod.GetEquipSlot("PopoLeg", EquipType.Legs); + Player.body = Mod.GetEquipSlot("PopoBody", EquipType.Body); + Player.head = snowmanNoseless ? Mod.GetEquipSlot("PopoNoselessHead", EquipType.Head) : Mod.GetEquipSlot("PopoHead", EquipType.Head); + Player.face = -1; } else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) { - player.legs = mod.GetEquipSlot("AbyssalDivingSuitLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("AbyssalDivingSuitBody", EquipType.Body); - player.head = mod.GetEquipSlot("AbyssalDivingSuitHead", EquipType.Head); - player.face = -1; + Player.legs = Mod.GetEquipSlot("AbyssalDivingSuitLeg", EquipType.Legs); + Player.body = Mod.GetEquipSlot("AbyssalDivingSuitBody", EquipType.Body); + Player.head = Mod.GetEquipSlot("AbyssalDivingSuitHead", EquipType.Head); + Player.face = -1; } else if ((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) { - player.legs = mod.GetEquipSlot("SirenLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("SirenBody", EquipType.Body); - player.head = mod.GetEquipSlot("SirenHead", EquipType.Head); - player.face = -1; + Player.legs = Mod.GetEquipSlot("SirenLeg", EquipType.Legs); + Player.body = Mod.GetEquipSlot("SirenBody", EquipType.Body); + Player.head = Mod.GetEquipSlot("SirenHead", EquipType.Head); + Player.face = -1; } else if (meldTransformationPower || meldTransformationForce) { - player.legs = mod.GetEquipSlot("MeldTransformationLegs", EquipType.Legs); - player.body = mod.GetEquipSlot("MeldTransformationBody", EquipType.Body); - player.head = mod.GetEquipSlot("MeldTransformationHead", EquipType.Head); + Player.legs = Mod.GetEquipSlot("MeldTransformationLegs", EquipType.Legs); + Player.body = Mod.GetEquipSlot("MeldTransformationBody", EquipType.Body); + Player.head = Mod.GetEquipSlot("MeldTransformationHead", EquipType.Head); } else if (omegaBlueTransformationPower || omegaBlueTransformationForce) { bool hasOmegaBlueCooldown = cooldowns.TryGetValue(OmegaBlue.ID, out CooldownInstance cd); if (hasOmegaBlueCooldown && cd.timeLeft > 1500) - player.head = mod.GetEquipSlot("OmegaBlueTransformationHead", EquipType.Head); + Player.head = Mod.GetEquipSlot("OmegaBlueTransformationHead", EquipType.Head); } else { @@ -6730,33 +6731,33 @@ namespace CalamityMod.CalPlayer } if (snowRuffianSet) { - player.wings = mod.GetEquipSlot("SnowRuffWings", EquipType.Wings); - bool falling = player.gravDir == -1 ? player.velocity.Y < 0.05f : player.velocity.Y > 0.05f; - if (player.controlJump && falling) + Player.wings = Mod.GetEquipSlot("SnowRuffWings", EquipType.Wings); + bool falling = Player.gravDir == -1 ? Player.velocity.Y < 0.05f : Player.velocity.Y > 0.05f; + if (Player.controlJump && falling) { - if (!player.mount.Active) + if (!Player.mount.Active) { - player.velocity.Y *= 0.9f; - player.wingFrame = 3; + Player.velocity.Y *= 0.9f; + Player.wingFrame = 3; } - player.noFallDmg = true; - player.fallStart = (int)(player.position.Y / 16f); + Player.noFallDmg = true; + Player.fallStart = (int)(Player.position.Y / 16f); } } - if (abyssDivingGear && (player.head == -1 || player.head == ArmorIDs.Head.FamiliarWig)) + if (abyssDivingGear && (Player.head == -1 || Player.head == ArmorIDs.Head.FamiliarWig)) { - player.head = mod.GetEquipSlot("AbyssDivingGearHead", EquipType.Head); - player.face = -1; + Player.head = Mod.GetEquipSlot("AbyssDivingGearHead", EquipType.Head); + Player.face = -1; } - if (featherCrownDraw && (player.head == -1 || player.head == ArmorIDs.Head.FamiliarWig)) + if (featherCrownDraw && (Player.head == -1 || Player.head == ArmorIDs.Head.FamiliarWig)) { - player.head = mod.GetEquipSlot("FeatherCrownHead", EquipType.Head); - player.face = -1; + Player.head = Mod.GetEquipSlot("FeatherCrownHead", EquipType.Head); + Player.face = -1; } - if (moonCrownDraw && (player.head == -1 || player.head == ArmorIDs.Head.FamiliarWig)) + if (moonCrownDraw && (Player.head == -1 || Player.head == ArmorIDs.Head.FamiliarWig)) { - player.head = mod.GetEquipSlot("MoonstoneCrownHead", EquipType.Head); - player.face = -1; + Player.head = Mod.GetEquipSlot("MoonstoneCrownHead", EquipType.Head); + Player.face = -1; } } #endregion @@ -6773,59 +6774,59 @@ namespace CalamityMod.CalPlayer if (godSlayerDashHotKeyPressed) { // Set the player to have no registered vanilla dashes. - player.dash = 0; + Player.dash = 0; // Prevent the possibility of Shield of Cthulhu invulnerability exploits. - player.eocHit = -1; - if (player.eocDash != 0) - player.eocDash = 0; + Player.eocHit = -1; + if (Player.eocDash != 0) + Player.eocDash = 0; } - if (lol || (silvaCountdown > 0 && hasSilvaEffect && silvaSet) || (dashMod == 9 && player.dashDelay < 0)) + if (lol || (silvaCountdown > 0 && hasSilvaEffect && silvaSet) || (dashMod == 9 && Player.dashDelay < 0)) { - if (player.lifeRegen < 0) - player.lifeRegen = 0; + if (Player.lifeRegen < 0) + Player.lifeRegen = 0; } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - player.yoraiz0rEye = 0; + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + Player.yoraiz0rEye = 0; } private void DisableDashes() { // Set the player to have no registered dashes. - player.dash = 0; + Player.dash = 0; dashMod = 0; // Put the player in a permanent state of dash cooldown. This is removed 1/5 of a second after disabling the effect. // This is necessary so that arbitrary dashes from other mods are also blocked by Calamity. - if (player.dashDelay >= 0 && player.dashDelay < DashDisableCooldown) - player.dashDelay = DashDisableCooldown; + if (Player.dashDelay >= 0 && Player.dashDelay < DashDisableCooldown) + Player.dashDelay = DashDisableCooldown; // Prevent the possibility of Shield of Cthulhu invulnerability exploits. - player.eocHit = -1; - if (player.eocDash != 0) - player.eocDash = 0; + Player.eocHit = -1; + if (Player.eocDash != 0) + Player.eocDash = 0; } private void WeakPetrification() { weakPetrification = true; - player.doubleJumpCloud = false; - player.doubleJumpSandstorm = false; - player.doubleJumpBlizzard = false; - player.doubleJumpSail = false; - player.doubleJumpFart = false; + Player.doubleJumpCloud = false; + Player.doubleJumpSandstorm = false; + Player.doubleJumpBlizzard = false; + Player.doubleJumpSail = false; + Player.doubleJumpFart = false; statigelJump = false; sulfurJump = false; - player.rocketBoots = 0; - player.jumpBoost = false; - player.slowFall = false; - player.gravControl = false; - player.gravControl2 = false; - player.jumpSpeedBoost = 0f; - player.wingTimeMax = (int)(player.wingTimeMax * 0.5); - player.balloon = -1; + Player.rocketBoots = 0; + Player.jumpBoost = false; + Player.slowFall = false; + Player.gravControl = false; + Player.gravControl2 = false; + Player.jumpSpeedBoost = 0f; + Player.wingTimeMax = (int)(Player.wingTimeMax * 0.5); + Player.balloon = -1; } #endregion @@ -6842,7 +6843,7 @@ namespace CalamityMod.CalPlayer return false; // Unless holding Coldheart Icicle, the Purified Jam makes you completely invincible. - if (invincible && player.ActiveItem().type != ModContent.ItemType()) + if (invincible && Player.ActiveItem().type != ModContent.ItemType()) return false; // If Armageddon is active or the Boss Rush Immunity Curse is triggered, instantly kill the player. @@ -6855,7 +6856,7 @@ namespace CalamityMod.CalPlayer CalamityWorld.DoGSecondStageCountdown = 0; if (Main.netMode == NetmodeID.Server) { - var netMessage = mod.GetPacket(); + var netMessage = Mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); @@ -6877,19 +6878,19 @@ namespace CalamityMod.CalPlayer if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) { playSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/ProvidenceHurt"), (int)player.position.X, (int)player.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/ProvidenceHurt"), (int)Player.position.X, (int)Player.position.Y); hurtSoundTimer = 20; } else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) { playSound = false; - Main.PlaySound(SoundID.NPCHit, (int)player.position.X, (int)player.position.Y, 4, 1f, 0f); //metal hit noise + SoundEngine.PlaySound(SoundID.NPCHit, (int)Player.position.X, (int)Player.position.Y, 4, 1f, 0f); //metal hit noise hurtSoundTimer = 10; } else if ((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) { playSound = false; - Main.PlaySound(SoundID.FemaleHit, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); //female hit noise + SoundEngine.PlaySound(SoundID.FemaleHit, (int)Player.position.X, (int)Player.position.Y, 1, 1f, 0f); //female hit noise hurtSoundTimer = 10; } else if (titanHeartSet) @@ -6897,11 +6898,11 @@ namespace CalamityMod.CalPlayer playSound = false; Terraria.Audio.LegacySoundStyle atlasHurt = Utils.SelectRandom(Main.rand, new Terraria.Audio.LegacySoundStyle[] { - mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt0"), - mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt1"), - mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt2") + Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt0"), + Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt1"), + Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt2") }); - Main.PlaySound(atlasHurt, (int)player.position.X, (int)player.position.Y); + SoundEngine.PlaySound(atlasHurt, (int)Player.position.X, (int)Player.position.Y); hurtSoundTimer = 10; } } @@ -6915,18 +6916,18 @@ namespace CalamityMod.CalPlayer damageMult += 0.25; // Add 5% damage multiplier for each Beetle Shell beetle that is active, thus reducing the DR from 10% to 5% per stack. - if (player.beetleDefense && player.beetleOrbs > 0) - damageMult += 0.05 * player.beetleOrbs; + if (Player.beetleDefense && Player.beetleOrbs > 0) + damageMult += 0.05 * Player.beetleOrbs; // If inflicted with Cursed Inferno, take 20% more damage. // This is the equivalent to reducing DR by 20%, except it works on you even when you have less than 20% DR. - if (player.onFire2) + if (Player.onFire2) damageMult += 0.2; // Blood Pact gives you a 1/4 chance to be crit, increasing the incoming damage by 25%. if (bloodPact && Main.rand.NextBool(4)) { - player.AddBuff(ModContent.BuffType(), 600); + Player.AddBuff(ModContent.BuffType(), 600); damageMult += 1.25; } @@ -6946,7 +6947,7 @@ namespace CalamityMod.CalPlayer // Also set the Rage gain cooldown to prevent bizarre abuse cases. if (CalamityWorld.revenge && shatteredCommunity && rageGainCooldown == 0) { - float HPRatio = (float)damage / player.statLifeMax2; + float HPRatio = (float)damage / Player.statLifeMax2; float rageConversionRatio = 0.8f; // Damage to rage conversion is half as effective while Rage Mode is active. @@ -6963,7 +6964,7 @@ namespace CalamityMod.CalPlayer // Resilient Candle makes defense 5% more effective, aka 5% of defense is subtracted from all incoming damage. if (purpleCandle) - damage = (int)(damage - (player.statDefense * 0.05)); + damage = (int)(damage - (Player.statDefense * 0.05)); return true; } @@ -6978,41 +6979,41 @@ namespace CalamityMod.CalPlayer if (CalamityWorld.revenge) rageCombatFrames = RageCombatDelayTime; - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { // Summon a portal if needed. - if (player.Calamity().persecutedEnchant && NPC.CountNPCS(ModContent.NPCType()) < 2) + if (Player.Calamity().persecutedEnchant && NPC.CountNPCS(ModContent.NPCType()) < 2) { int tries = 0; Vector2 spawnPosition; do { - spawnPosition = player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(270f, 420f); + spawnPosition = Player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(270f, 420f); tries++; } while (Collision.SolidCollision(spawnPosition - Vector2.One * 24f, 48, 24) && tries < 100); - CalamityNetcode.NewNPC_ClientSide(spawnPosition, ModContent.NPCType(), player); + CalamityNetcode.NewNPC_ClientSide(spawnPosition, ModContent.NPCType(), Player); } if (revivify) { int healAmt = (int)(damage / 15D); - player.statLife += healAmt; - player.HealEffect(healAmt); + Player.statLife += healAmt; + Player.HealEffect(healAmt); } if (daedalusAbsorb && Main.rand.NextBool(10)) { int healAmt = (int)(damage / 2D); - player.statLife += healAmt; - player.HealEffect(healAmt); + Player.statLife += healAmt; + Player.HealEffect(healAmt); } if (absorber) { int healAmt = (int)(damage / (sponge ? 16D : 20D)); - player.statLife += healAmt; - player.HealEffect(healAmt); + Player.statLife += healAmt; + Player.HealEffect(healAmt); } if (witheringDamageDone > 0) @@ -7021,9 +7022,9 @@ namespace CalamityMod.CalPlayer if (healCompenstationRatio > 1D) healCompenstationRatio = 1D; int healCompensation = (int)(healCompenstationRatio * damage); - player.statLife += (int)(healCompenstationRatio * damage); - player.HealEffect(healCompensation); - player.AddBuff(ModContent.BuffType(), 1080); + Player.statLife += (int)(healCompenstationRatio * damage); + Player.HealEffect(healCompensation); + Player.AddBuff(ModContent.BuffType(), 1080); witheringDamageDone = 0; } @@ -7044,12 +7045,12 @@ namespace CalamityMod.CalPlayer if (amidiasBlessing) { - player.ClearBuff(ModContent.BuffType()); - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 96); + Player.ClearBuff(ModContent.BuffType()); + SoundEngine.PlaySound(SoundID.Item, (int)Player.position.X, (int)Player.position.Y, 96); } - if ((gShell || fabledTortoise) && !player.panic) - player.AddBuff(ModContent.BuffType(), 180); + if ((gShell || fabledTortoise) && !Player.panic) + Player.AddBuff(ModContent.BuffType(), 180); if (abyssalDivingSuitPlates && damage > 50) { @@ -7062,13 +7063,13 @@ namespace CalamityMod.CalPlayer if (abyssalDivingSuitPlateHits >= 3) { - Main.PlaySound(SoundID.NPCKilled, (int)player.position.X, (int)player.position.Y, 14); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Player.position.X, (int)Player.position.Y, 14); if (plateCDExists) cooldowns.Remove(DivingPlatesBreaking.ID); - player.AddCooldown(DivingPlatesBroken.ID, 10830); + Player.AddCooldown(DivingPlatesBroken.ID, 10830); for (int d = 0; d < 20; d++) { - int dust = Dust.NewDust(player.position, player.width, player.height, 31, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Player.position, Player.width, Player.height, 31, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -7078,24 +7079,24 @@ namespace CalamityMod.CalPlayer } for (int d = 0; d < 35; d++) { - int fire = Dust.NewDust(player.position, player.width, player.height, DustID.Fire, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Player.position, Player.width, Player.height, DustID.Fire, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(player.position, player.width, player.height, DustID.Fire, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(Player.position, Player.width, Player.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } - CalamityUtils.ExplosionGores(player.Center, 3); + CalamityUtils.ExplosionGores(Player.Center, 3); } } if (sirenIce) { - Main.PlaySound(SoundID.NPCKilled, (int)player.Center.X, (int)player.Center.Y, 7); - player.AddCooldown(AquaticHeartIceShield.ID, CalamityUtils.SecondsToFrames(30)); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Player.Center.X, (int)Player.Center.Y, 7); + Player.AddCooldown(AquaticHeartIceShield.ID, CalamityUtils.SecondsToFrames(30)); for (int d = 0; d < 10; d++) { - int ice = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 100, default, 2f); + int ice = Dust.NewDust(Player.position, Player.width, Player.height, 67, 0f, 0f, 100, default, 2f); Main.dust[ice].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -7105,10 +7106,10 @@ namespace CalamityMod.CalPlayer } for (int d = 0; d < 15; d++) { - int ice = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 100, default, 3f); + int ice = Dust.NewDust(Player.position, Player.width, Player.height, 67, 0f, 0f, 100, default, 3f); Main.dust[ice].noGravity = true; Main.dust[ice].velocity *= 5f; - ice = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 100, default, 2f); + ice = Dust.NewDust(Player.position, Player.width, Player.height, 67, 0f, 0f, 100, default, 2f); Main.dust[ice].velocity *= 2f; } } @@ -7116,29 +7117,29 @@ namespace CalamityMod.CalPlayer if (tarraMelee) { if (Main.rand.NextBool(4)) - player.AddBuff(ModContent.BuffType(), 120); + Player.AddBuff(ModContent.BuffType(), 120); } else if (xerocSet) { - player.AddBuff(ModContent.BuffType(), 240); - player.AddBuff(ModContent.BuffType(), 240); + Player.AddBuff(ModContent.BuffType(), 240); + Player.AddBuff(ModContent.BuffType(), 240); } else if (reaverDefense) { if (Main.rand.NextBool(4)) - player.AddBuff(ModContent.BuffType(), 180); + Player.AddBuff(ModContent.BuffType(), 180); } if ((fBarrier || (sirenBoobs && NPC.downedBoss3)) && !areThereAnyDamnBosses) { - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 27); + SoundEngine.PlaySound(SoundID.Item, (int)Player.position.X, (int)Player.position.Y, 27); for (int m = 0; m < Main.maxNPCs; m++) { NPC npc = Main.npc[m]; if (!npc.active || npc.friendly || npc.dontTakeDamage) continue; - float npcDist = (npc.Center - player.Center).Length(); + float npcDist = (npc.Center - Player.Center).Length(); float freezeDist = Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); if (freezeDist > 500f) freezeDist = 500f + (freezeDist - 500f) * 0.75f; @@ -7166,7 +7167,7 @@ namespace CalamityMod.CalPlayer if (!npc.active || npc.friendly || npc.dontTakeDamage) continue; - float npcDist = (npc.Center - player.Center).Length(); + float npcDist = (npc.Center - Player.Center).Length(); float range = Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); if (range > 500f) range = 500f + (range - 500f) * 0.75f; @@ -7190,7 +7191,7 @@ namespace CalamityMod.CalPlayer } // Spawn the harmless brain images that are actually projectiles - Projectile.NewProjectile(player.Center.X + Main.rand.Next(-40, 40), player.Center.Y - Main.rand.Next(20, 60), player.velocity.X * 0.3f, player.velocity.Y * 0.3f, ProjectileID.BrainOfConfusion, 0, 0f, player.whoAmI); + Projectile.NewProjectile(Player.Center.X + Main.rand.Next(-40, 40), Player.Center.Y - Main.rand.Next(20, 60), Player.velocity.X * 0.3f, Player.velocity.Y * 0.3f, ProjectileID.BrainOfConfusion, 0, 0f, Player.whoAmI); } if (polarisBoost) @@ -7199,24 +7200,24 @@ namespace CalamityMod.CalPlayer polarisBoost = false; polarisBoostTwo = false; polarisBoostThree = false; - if (player.FindBuffIndex(ModContent.BuffType()) > -1) - player.ClearBuff(ModContent.BuffType()); + if (Player.FindBuffIndex(ModContent.BuffType()) > -1) + Player.ClearBuff(ModContent.BuffType()); } } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) { for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == player.whoAmI) + if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == Player.whoAmI) { Main.projectile[i].Kill(); break; } } - if (player.wingTime > player.wingTimeMax / 2) - player.wingTime = player.wingTimeMax / 2; + if (Player.wingTime > Player.wingTimeMax / 2) + Player.wingTime = Player.wingTimeMax / 2; } } #endregion @@ -7225,16 +7226,16 @@ namespace CalamityMod.CalPlayer public override void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) { if (pArtifact && !profanedCrystal) - player.AddCooldown(Cooldowns.ProfanedSoulArtifact.ID, CalamityUtils.SecondsToFrames(5)); + Player.AddCooldown(Cooldowns.ProfanedSoulArtifact.ID, CalamityUtils.SecondsToFrames(5)); // Bloodflare Core defense shattering if (bloodflareCore) { // Shattered defense has a hard cap equal to half of total defense. // It also has a soft cap determined by a formula so it isn't too powerful at excessively high defense. - int shatterDefenseCap = (int)(1.5D * Math.Pow(player.statDefense, 0.91D) - 0.5D * player.statDefense); - if (shatterDefenseCap > player.statDefense / 2) - shatterDefenseCap = player.statDefense / 2; + int shatterDefenseCap = (int)(1.5D * Math.Pow(Player.statDefense, 0.91D) - 0.5D * Player.statDefense); + if (shatterDefenseCap > Player.statDefense / 2) + shatterDefenseCap = Player.statDefense / 2; // Every hit adds its damage as shattered defense. int newLostDefense = Math.Min(bloodflareCoreLostDefense + (int)damage, shatterDefenseCap); @@ -7245,12 +7246,12 @@ namespace CalamityMod.CalPlayer bloodflareCoreLostDefense = newLostDefense; // Play a sound and make dust to signify that defense has been shattered - Main.PlaySound(SoundID.DD2_MonkStaffGroundImpact, player.Center); + SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Player.Center); for (int i = 0; i < 36; ++i) { float speed = Main.rand.NextFloat(1.8f, 8f); Vector2 dustVel = new Vector2(speed, speed); - Dust d = Dust.NewDustDirect(player.position, player.width, player.height, 90); + Dust d = Dust.NewDustDirect(Player.position, Player.width, Player.height, 90); d.velocity = dustVel; d.noGravity = true; d.scale *= Main.rand.NextFloat(1.1f, 1.4f); @@ -7261,10 +7262,10 @@ namespace CalamityMod.CalPlayer } // Handle hit effects from the gem tech armor set. - player.Calamity().GemTechState.PlayerOnHitEffects((int)damage); + Player.Calamity().GemTechState.PlayerOnHitEffects((int)damage); bool hardMode = Main.hardMode; - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { int iFramesToAdd = 0; if (cTracers && damage > 200) @@ -7302,43 +7303,43 @@ namespace CalamityMod.CalPlayer { case 0: case 1: - player.hurtCooldowns[lastProjectileHit.modProjectile.cooldownSlot] += iFramesToAdd; + Player.hurtCooldowns[lastProjectileHit.modProjectile.cooldownSlot] += iFramesToAdd; break; case -1: default: - player.GiveIFrames(player.immuneTime + iFramesToAdd, true); + Player.GiveIFrames(Player.immuneTime + iFramesToAdd, true); break; } } // In the case that no projectile that hit the player was defined, just give them iframes normally else - player.GiveIFrames(player.immuneTime + iFramesToAdd, true); + Player.GiveIFrames(Player.immuneTime + iFramesToAdd, true); if (BossRushEvent.BossRushActive && CalamityConfig.Instance.BossRushImmunityFrameCurse) - bossRushImmunityFrameCurseTimer = 180 + player.immuneTime; + bossRushImmunityFrameCurseTimer = 180 + Player.immuneTime; if (aeroSet && damage > 25) { for (int n = 0; n < 4; n++) { - CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 20f, ModContent.ProjectileType(), (int)(20 * player.AverageDamage()), 1f, player.whoAmI); + CalamityUtils.ProjectileRain(Player.Center, 400f, 100f, 500f, 800f, 20f, ModContent.ProjectileType(), (int)(20 * Player.AverageDamage()), 1f, Player.whoAmI); } } if (aBulwarkRare) { - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 74); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(25 * player.AverageDamage()), 5f, player.whoAmI, 0f, 1f); + SoundEngine.PlaySound(SoundID.Item, (int)Player.position.X, (int)Player.position.Y, 74); + Projectile.NewProjectile(Player.Center.X, Player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(25 * Player.AverageDamage()), 5f, Player.whoAmI, 0f, 1f); for (int n = 0; n < 12; n++) { - CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(320 * player.AverageDamage()), 5f, player.whoAmI); + CalamityUtils.ProjectileRain(Player.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(320 * Player.AverageDamage()), 5f, Player.whoAmI); } } if (dAmulet) { for (int n = 0; n < 3; n++) { - Projectile star = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileID.HallowStar, (int)(130 * player.AverageDamage()), 4f, player.whoAmI); + Projectile star = CalamityUtils.ProjectileRain(Player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileID.HallowStar, (int)(130 * Player.AverageDamage()), 4f, Player.whoAmI); if (star.whoAmI.WithinBounds(Main.maxProjectiles)) { star.Calamity().forceTypeless = true; @@ -7351,21 +7352,21 @@ namespace CalamityMod.CalPlayer { if (damage > 0) { - Main.PlaySound(SoundID.NPCHit, (int)player.position.X, (int)player.position.Y, 45); + SoundEngine.PlaySound(SoundID.NPCHit, (int)Player.position.X, (int)Player.position.Y, 45); float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int fDamage = (int)(70 * player.AverageDamage()); - if (player.whoAmI == Main.myPlayer) + int fDamage = (int)(70 * Player.AverageDamage()); + if (Player.whoAmI == Main.myPlayer) { for (int i = 0; i < 4; i++) { - float xPos = Main.rand.NextBool(2) ? player.Center.X + 100 : player.Center.X - 100; - Vector2 spawnPos = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); + float xPos = Main.rand.NextBool(2) ? Player.Center.X + 100 : Player.Center.X - 100; + Vector2 spawnPos = new Vector2(xPos, Player.Center.Y + Main.rand.Next(-100, 101)); offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int spore1 = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ProjectileID.TruffleSpore, fDamage, 1.25f, player.whoAmI, 0f, 0f); - int spore2 = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ProjectileID.TruffleSpore, fDamage, 1.25f, player.whoAmI, 0f, 0f); + int spore1 = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ProjectileID.TruffleSpore, fDamage, 1.25f, Player.whoAmI, 0f, 0f); + int spore2 = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ProjectileID.TruffleSpore, fDamage, 1.25f, Player.whoAmI, 0f, 0f); Main.projectile[spore1].timeLeft = 300; Main.projectile[spore2].timeLeft = 300; } @@ -7376,21 +7377,21 @@ namespace CalamityMod.CalPlayer { if (damage > 0) { - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 93); + SoundEngine.PlaySound(SoundID.Item, (int)Player.position.X, (int)Player.position.Y, 93); float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int sDamage = 6; if (aSparkRare) sDamage += 42; - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int spark1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(sDamage * player.AverageDamage()), 1.25f, player.whoAmI, 0f, 0f); - int spark2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(sDamage * player.AverageDamage()), 1.25f, player.whoAmI, 0f, 0f); + int spark1 = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(sDamage * Player.AverageDamage()), 1.25f, Player.whoAmI, 0f, 0f); + int spark2 = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(sDamage * Player.AverageDamage()), 1.25f, Player.whoAmI, 0f, 0f); if (spark1.WithinBounds(Main.maxProjectiles)) { Main.projectile[spark1].timeLeft = 120; @@ -7407,14 +7408,14 @@ namespace CalamityMod.CalPlayer } if (inkBomb && !abyssalMirror && !eclipseMirror) { - if (player.whoAmI == Main.myPlayer && !player.HasCooldown(Cooldowns.InkBomb.ID)) + if (Player.whoAmI == Main.myPlayer && !Player.HasCooldown(Cooldowns.InkBomb.ID)) { - player.AddCooldown(Cooldowns.InkBomb.ID, CalamityUtils.SecondsToFrames(20)); + Player.AddCooldown(Cooldowns.InkBomb.ID, CalamityUtils.SecondsToFrames(20)); rogueStealth += 0.5f; for (int i = 0; i < 5; i++) { - Main.PlaySound(SoundID.Item, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 61); - int ink = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-0f, -4f), ModContent.ProjectileType(), 0, 0, player.whoAmI); + SoundEngine.PlaySound(SoundID.Item, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 61); + int ink = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-0f, -4f), ModContent.ProjectileType(), 0, 0, Player.whoAmI); if (ink.WithinBounds(Main.maxProjectiles)) Main.projectile[ink].Calamity().forceTypeless = true; } @@ -7422,29 +7423,29 @@ namespace CalamityMod.CalPlayer } if (blazingCore) { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { for (int i = 0; i < 360; i += 3) { Vector2 BCDSpeed = new Vector2(5f, 5f).RotatedBy(MathHelper.ToRadians(i)); - Dust.NewDust(player.Center, 1, 1, 244, BCDSpeed.X, BCDSpeed.Y, 0, default, 1.1f); + Dust.NewDust(Player.Center, 1, 1, 244, BCDSpeed.X, BCDSpeed.Y, 0, default, 1.1f); } - Main.PlaySound(SoundID.Item14, player.Center); - int blazingSun = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(1270 * player.AverageDamage()), 0f, player.whoAmI, 0f, 0f); - Main.projectile[blazingSun].Center = player.Center; - int blazingSun2 = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); - Main.projectile[blazingSun2].Center = player.Center; + SoundEngine.PlaySound(SoundID.Item14, Player.Center); + int blazingSun = Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(1270 * Player.AverageDamage()), 0f, Player.whoAmI, 0f, 0f); + Main.projectile[blazingSun].Center = Player.Center; + int blazingSun2 = Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, 0f, 0f); + Main.projectile[blazingSun2].Center = Player.Center; } } if (ataxiaBlaze) { if (damage > 0) { - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 74); - int eDamage = (int)(100 * player.AverageDamage()); - if (player.whoAmI == Main.myPlayer) + SoundEngine.PlaySound(SoundID.Item, (int)Player.position.X, (int)Player.position.Y, 74); + int eDamage = (int)(100 * Player.AverageDamage()); + if (Player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), eDamage, 1f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), eDamage, 1f, Player.whoAmI, 0f, 0f); } } } @@ -7452,21 +7453,21 @@ namespace CalamityMod.CalPlayer { if (damage > 0) { - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 27); + SoundEngine.PlaySound(SoundID.Item, (int)Player.position.X, (int)Player.position.Y, 27); float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int sDamage = (int)(27 * player.RangedDamage()); //daedalus ranged helm - if (player.whoAmI == Main.myPlayer) + int sDamage = (int)(27 * Player.RangedDamage()); //daedalus ranged helm + if (Player.whoAmI == Main.myPlayer) { for (int i = 0; i < 8; i++) { float randomSpeed = Main.rand.Next(1, 7); float randomSpeed2 = Main.rand.Next(1, 7); offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int shard = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, ProjectileID.CrystalShard, sDamage, 1f, player.whoAmI, 0f, 0f); - int shard2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, ProjectileID.CrystalShard, sDamage, 1f, player.whoAmI, 0f, 0f); + int shard = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, ProjectileID.CrystalShard, sDamage, 1f, Player.whoAmI, 0f, 0f); + int shard2 = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, ProjectileID.CrystalShard, sDamage, 1f, Player.whoAmI, 0f, 0f); if (shard.WithinBounds(Main.maxProjectiles)) Main.projectile[shard].Calamity().forceTypeless = true; if (shard2.WithinBounds(Main.maxProjectiles)) @@ -7479,10 +7480,10 @@ namespace CalamityMod.CalPlayer { if (damage > 0) { - int rDamage = (int)(80 * player.AverageDamage()); - if (player.whoAmI == Main.myPlayer) + int rDamage = (int)(80 * Player.AverageDamage()); + if (Player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(player.Center.X, player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), rDamage, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(Player.Center.X, Player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), rDamage, 0f, Player.whoAmI, 0f, 0f); } } } @@ -7490,29 +7491,29 @@ namespace CalamityMod.CalPlayer { if (damage > 80) { - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 73); + SoundEngine.PlaySound(SoundID.Item, (int)Player.position.X, (int)Player.position.Y, 73); float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(675 * player.MeleeDamage()), 5f, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(675 * player.MeleeDamage()), 5f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(Player.Center.X, Player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(675 * Player.MeleeDamage()), 5f, Player.whoAmI, 0f, 0f); + Projectile.NewProjectile(Player.Center.X, Player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(675 * Player.MeleeDamage()), 5f, Player.whoAmI, 0f, 0f); } } } } else if (dsSetBonus) { - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { for (int l = 0; l < 2; l++) { - Projectile beam = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileID.ShadowBeamFriendly, (int)(3000 * player.AverageDamage()), 7f, player.whoAmI); + Projectile beam = CalamityUtils.ProjectileRain(Player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileID.ShadowBeamFriendly, (int)(3000 * Player.AverageDamage()), 7f, Player.whoAmI); if (beam.whoAmI.WithinBounds(Main.maxProjectiles)) { beam.Calamity().forceTypeless = true; @@ -7522,7 +7523,7 @@ namespace CalamityMod.CalPlayer } for (int l = 0; l < 5; l++) { - Projectile scythe = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileID.DemonScythe, (int)(5000 * player.AverageDamage()), 7f, player.whoAmI); + Projectile scythe = CalamityUtils.ProjectileRain(Player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileID.DemonScythe, (int)(5000 * Player.AverageDamage()), 7f, Player.whoAmI); if (scythe.whoAmI.WithinBounds(Main.maxProjectiles)) { scythe.Calamity().forceTypeless = true; @@ -7540,36 +7541,36 @@ namespace CalamityMod.CalPlayer public void KillPlayer() { deathCount++; - if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) + if (Player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) { SyncDeathCount(false); } - player.lastDeathPostion = player.Center; - player.lastDeathTime = DateTime.Now; - player.showLastDeath = true; - int coinsOwned = (int)Utils.CoinsCount(out bool flag, player.inventory, new int[0]); - if (Main.myPlayer == player.whoAmI) + Player.lastDeathPostion = Player.Center; + Player.lastDeathTime = DateTime.Now; + Player.showLastDeath = true; + int coinsOwned = (int)Utils.CoinsCount(out bool flag, Player.inventory, new int[0]); + if (Main.myPlayer == Player.whoAmI) { - player.lostCoins = coinsOwned; - player.lostCoinString = Main.ValueToCoins(player.lostCoins); + Player.lostCoins = coinsOwned; + Player.lostCoinString = Main.ValueToCoins(Player.lostCoins); } - if (Main.myPlayer == player.whoAmI) + if (Main.myPlayer == Player.whoAmI) { Main.mapFullscreen = false; } - if (Main.myPlayer == player.whoAmI) + if (Main.myPlayer == Player.whoAmI) { - player.trashItem.SetDefaults(0, false); - if (player.difficulty == 0) + Player.trashItem.SetDefaults(0, false); + if (Player.difficulty == 0) { for (int i = 0; i < 59; i++) { - if (player.inventory[i].stack > 0 && ((player.inventory[i].type >= ItemID.LargeAmethyst && player.inventory[i].type <= ItemID.LargeDiamond) || player.inventory[i].type == ItemID.LargeAmber)) + if (Player.inventory[i].stack > 0 && ((Player.inventory[i].type >= ItemID.LargeAmethyst && Player.inventory[i].type <= ItemID.LargeDiamond) || Player.inventory[i].type == ItemID.LargeAmber)) { - int num = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, player.inventory[i].type, 1, false, 0, false, false); - Main.item[num].netDefaults(player.inventory[i].netID); - Main.item[num].Prefix((int)player.inventory[i].prefix); - Main.item[num].stack = player.inventory[i].stack; + int num = Item.NewItem((int)Player.position.X, (int)Player.position.Y, Player.width, Player.height, Player.inventory[i].type, 1, false, 0, false, false); + Main.item[num].netDefaults(Player.inventory[i].netID); + Main.item[num].Prefix((int)Player.inventory[i].prefix); + Main.item[num].stack = Player.inventory[i].stack; Main.item[num].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; Main.item[num].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f; Main.item[num].noGrabDelay = 100; @@ -7579,73 +7580,73 @@ namespace CalamityMod.CalPlayer { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, num, 0f, 0f, 0f, 0, 0, 0); } - player.inventory[i].SetDefaults(0, false); + Player.inventory[i].SetDefaults(0, false); } } } - else if (player.difficulty == 1) + else if (Player.difficulty == 1) { - player.DropItems(); + Player.DropItems(); } - else if (player.difficulty == 2) + else if (Player.difficulty == 2) { - player.DropItems(); - player.KillMeForGood(); + Player.DropItems(); + Player.KillMeForGood(); } } - Main.PlaySound(SoundID.PlayerKilled, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); - player.headVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; - player.bodyVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; - player.legVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; - player.headVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); - player.bodyVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); - player.legVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); - if (player.stoned) + SoundEngine.PlaySound(SoundID.PlayerKilled, (int)Player.position.X, (int)Player.position.Y, 1, 1f, 0f); + Player.headVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; + Player.bodyVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; + Player.legVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; + Player.headVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); + Player.bodyVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); + Player.legVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); + if (Player.stoned) { - player.headPosition = Vector2.Zero; - player.bodyPosition = Vector2.Zero; - player.legPosition = Vector2.Zero; + Player.headPosition = Vector2.Zero; + Player.bodyPosition = Vector2.Zero; + Player.legPosition = Vector2.Zero; } for (int j = 0; j < 100; j++) { - Dust.NewDust(player.position, player.width, player.height, 235, (float)(2 * 0), -2f, 0, default, 1f); + Dust.NewDust(Player.position, Player.width, Player.height, 235, (float)(2 * 0), -2f, 0, default, 1f); } - player.mount.Dismount(player); - player.dead = true; - player.respawnTimer = 600; + Player.mount.Dismount(Player); + Player.dead = true; + Player.respawnTimer = 600; if (Main.expertMode) { - player.respawnTimer = (int)(player.respawnTimer * 1.5); + Player.respawnTimer = (int)(Player.respawnTimer * 1.5); } - player.immuneAlpha = 0; - player.palladiumRegen = false; - player.iceBarrier = false; - player.crystalLeaf = false; + Player.immuneAlpha = 0; + Player.palladiumRegen = false; + Player.iceBarrier = false; + Player.crystalLeaf = false; - PlayerDeathReason damageSource = PlayerDeathReason.ByOther(player.Male ? 14 : 15); + PlayerDeathReason damageSource = PlayerDeathReason.ByOther(Player.Male ? 14 : 15); if (abyssDeath) { if (Main.rand.NextBool(2)) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " is food for the Wyrms."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " is food for the Wyrms."); } else { - damageSource = PlayerDeathReason.ByCustomReason("Oxygen failed to reach " + player.name + " from the depths of the Abyss."); + damageSource = PlayerDeathReason.ByCustomReason("Oxygen failed to reach " + Player.name + " from the depths of the Abyss."); } } else if (CalamityWorld.armageddon && areThereAnyDamnBosses) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " failed the challenge at hand."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " failed the challenge at hand."); } else if (BossRushEvent.BossRushActive && bossRushImmunityFrameCurseTimer > 0) { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was destroyed by a mysterious force."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + " was destroyed by a mysterious force."); } - NetworkText deathText = damageSource.GetDeathText(player.name); - if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) + NetworkText deathText = damageSource.GetDeathText(Player.name); + if (Main.netMode == NetmodeID.MultiplayerClient && Player.whoAmI == Main.myPlayer) { - NetMessage.SendPlayerDeath(player.whoAmI, damageSource, (int)1000.0, 0, false, -1, -1); + NetMessage.SendPlayerDeath(Player.whoAmI, damageSource, (int)1000.0, 0, false, -1, -1); } if (Main.netMode == NetmodeID.Server) { @@ -7656,13 +7657,13 @@ namespace CalamityMod.CalPlayer Main.NewText(deathText.ToString(), 225, 25, 25, false); } - if (player.whoAmI == Main.myPlayer && player.difficulty == 0) + if (Player.whoAmI == Main.myPlayer && Player.difficulty == 0) { - player.DropCoins(); + Player.DropCoins(); } - player.DropTombstone(coinsOwned, deathText, 0); + Player.DropTombstone(coinsOwned, deathText, 0); - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { try { @@ -7678,291 +7679,291 @@ namespace CalamityMod.CalPlayer #region Dash Stuff public void ModDashMovement() { - if (dashMod == 4 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) // Asgardian Aegis + if (dashMod == 4 && Player.dashDelay < 0 && Player.whoAmI == Main.myPlayer) // Asgardian Aegis { - Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + Rectangle rectangle = new Rectangle((int)((double)Player.position.X + (double)Player.velocity.X * 0.5 - 4.0), (int)((double)Player.position.Y + (double)Player.velocity.Y * 0.5 - 4.0), Player.width + 8, Player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[player.whoAmI] <= 0) + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[Player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); - if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) + if (rectangle.Intersects(rect) && (npc.noTileCollide || Player.CanHit(npc))) { - float num = 300f * player.AverageDamage(); + float num = 300f * Player.AverageDamage(); float num2 = 15f; bool crit = false; - if (player.kbGlove) + if (Player.kbGlove) { num2 *= 2f; } - if (player.kbBuff) + if (Player.kbBuff) { num2 *= 1.5f; } - if (Main.rand.Next(100) < player.meleeCrit) + if (Main.rand.Next(100) < Player.GetCritChance(DamageClass.Melee)) { crit = true; } - int direction = player.direction; - if (player.velocity.X < 0f) + int direction = Player.direction; + if (Player.velocity.X < 0f) { direction = -1; } - if (player.velocity.X > 0f) + if (Player.velocity.X > 0f) { direction = 1; } - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(135 * player.AverageDamage()), 20f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(90 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); - if (npc.Calamity().dashImmunityTime[player.whoAmI] < 6) - npc.Calamity().dashImmunityTime[player.whoAmI] = 6; + Player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); + Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(135 * Player.AverageDamage()), 20f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(90 * Player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); + if (npc.Calamity().dashImmunityTime[Player.whoAmI] < 6) + npc.Calamity().dashImmunityTime[Player.whoAmI] = 6; npc.AddBuff(ModContent.BuffType(), 300); - player.GiveIFrames(AsgardianAegis.ShieldSlamIFrames, false); + Player.GiveIFrames(AsgardianAegis.ShieldSlamIFrames, false); } } } } - if (dashMod == 3 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) // Elysian Aegis + if (dashMod == 3 && Player.dashDelay < 0 && Player.whoAmI == Main.myPlayer) // Elysian Aegis { - Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + Rectangle rectangle = new Rectangle((int)((double)Player.position.X + (double)Player.velocity.X * 0.5 - 4.0), (int)((double)Player.position.Y + (double)Player.velocity.Y * 0.5 - 4.0), Player.width + 8, Player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[player.whoAmI] <= 0) + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[Player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); - if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) + if (rectangle.Intersects(rect) && (npc.noTileCollide || Player.CanHit(npc))) { - float num = 250f * player.AverageDamage(); + float num = 250f * Player.AverageDamage(); float num2 = 12f; bool crit = false; - if (player.kbGlove) + if (Player.kbGlove) { num2 *= 2f; } - if (player.kbBuff) + if (Player.kbBuff) { num2 *= 1.5f; } - if (Main.rand.Next(100) < player.meleeCrit) + if (Main.rand.Next(100) < Player.GetCritChance(DamageClass.Melee)) { crit = true; } - int direction = player.direction; - if (player.velocity.X < 0f) + int direction = Player.direction; + if (Player.velocity.X < 0f) { direction = -1; } - if (player.velocity.X > 0f) + if (Player.velocity.X > 0f) { direction = 1; } - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(120 * player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(80 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); - if (npc.Calamity().dashImmunityTime[player.whoAmI] < 6) - npc.Calamity().dashImmunityTime[player.whoAmI] = 6; + Player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); + Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(120 * Player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(80 * Player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); + if (npc.Calamity().dashImmunityTime[Player.whoAmI] < 6) + npc.Calamity().dashImmunityTime[Player.whoAmI] = 6; - player.GiveIFrames(ElysianAegis.ShieldSlamIFrames, false); + Player.GiveIFrames(ElysianAegis.ShieldSlamIFrames, false); } } } } - if (dashMod == 2 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) // Asgard's Valor + if (dashMod == 2 && Player.dashDelay < 0 && Player.whoAmI == Main.myPlayer) // Asgard's Valor { - Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + Rectangle rectangle = new Rectangle((int)((double)Player.position.X + (double)Player.velocity.X * 0.5 - 4.0), (int)((double)Player.position.Y + (double)Player.velocity.Y * 0.5 - 4.0), Player.width + 8, Player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[player.whoAmI] <= 0) + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[Player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); - if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) + if (rectangle.Intersects(rect) && (npc.noTileCollide || Player.CanHit(npc))) { - float num = 100f * player.AverageDamage(); + float num = 100f * Player.AverageDamage(); float num2 = 9f; bool crit = false; - if (player.kbGlove) + if (Player.kbGlove) { num2 *= 2f; } - if (player.kbBuff) + if (Player.kbBuff) { num2 *= 1.5f; } - if (Main.rand.Next(100) < player.meleeCrit) + if (Main.rand.Next(100) < Player.GetCritChance(DamageClass.Melee)) { crit = true; } - int direction = player.direction; - if (player.velocity.X < 0f) + int direction = Player.direction; + if (Player.velocity.X < 0f) { direction = -1; } - if (player.velocity.X > 0f) + if (Player.velocity.X > 0f) { direction = 1; } - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(60 * player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); - if (npc.Calamity().dashImmunityTime[player.whoAmI] < 6) - npc.Calamity().dashImmunityTime[player.whoAmI] = 6; + Player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); + Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(60 * Player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); + if (npc.Calamity().dashImmunityTime[Player.whoAmI] < 6) + npc.Calamity().dashImmunityTime[Player.whoAmI] = 6; - player.GiveIFrames(AsgardsValor.ShieldSlamIFrames, false); + Player.GiveIFrames(AsgardsValor.ShieldSlamIFrames, false); } } } } - if (dashMod == 6 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) // Ornate Shield + if (dashMod == 6 && Player.dashDelay < 0 && Player.whoAmI == Main.myPlayer) // Ornate Shield { - Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + Rectangle rectangle = new Rectangle((int)((double)Player.position.X + (double)Player.velocity.X * 0.5 - 4.0), (int)((double)Player.position.Y + (double)Player.velocity.Y * 0.5 - 4.0), Player.width + 8, Player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[player.whoAmI] <= 0) + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[Player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); - if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) + if (rectangle.Intersects(rect) && (npc.noTileCollide || Player.CanHit(npc))) { - float num = 50f * player.AverageDamage(); + float num = 50f * Player.AverageDamage(); float num2 = 3f; bool crit = false; - if (player.kbGlove) + if (Player.kbGlove) { num2 *= 2f; } - if (player.kbBuff) + if (Player.kbBuff) { num2 *= 1.5f; } - if (Main.rand.Next(100) < player.meleeCrit) + if (Main.rand.Next(100) < Player.GetCritChance(DamageClass.Melee)) { crit = true; } - int direction = player.direction; - if (player.velocity.X < 0f) + int direction = Player.direction; + if (Player.velocity.X < 0f) { direction = -1; } - if (player.velocity.X > 0f) + if (Player.velocity.X > 0f) { direction = 1; } - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - if (npc.Calamity().dashImmunityTime[player.whoAmI] < 6) - npc.Calamity().dashImmunityTime[player.whoAmI] = 6; + Player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); + if (npc.Calamity().dashImmunityTime[Player.whoAmI] < 6) + npc.Calamity().dashImmunityTime[Player.whoAmI] = 6; npc.AddBuff(BuffID.Frostburn, 300); - player.GiveIFrames(OrnateShield.ShieldSlamIFrames, false); + Player.GiveIFrames(OrnateShield.ShieldSlamIFrames, false); } } } } - if (dashMod == 8 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) // Plaguebringer Armor + if (dashMod == 8 && Player.dashDelay < 0 && Player.whoAmI == Main.myPlayer) // Plaguebringer Armor { - Rectangle rectangle = new Rectangle((int)(player.position.X + player.velocity.X * 0.5f - 4f), (int)(player.position.Y + player.velocity.Y * 0.5f - 4f), player.width + 8, player.height + 8); + Rectangle rectangle = new Rectangle((int)(Player.position.X + Player.velocity.X * 0.5f - 4f), (int)(Player.position.Y + Player.velocity.Y * 0.5f - 4f), Player.width + 8, Player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[player.whoAmI] <= 0) + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[Player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); - if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) + if (rectangle.Intersects(rect) && (npc.noTileCollide || Player.CanHit(npc))) { - float num = 50f * player.MinionDamage(); + float num = 50f * Player.MinionDamage(); float num2 = 3f; bool crit = false; - int direction = player.direction; - if (player.velocity.X < 0f) + int direction = Player.direction; + if (Player.velocity.X < 0f) { direction = -1; } - if (player.velocity.X > 0f) + if (Player.velocity.X > 0f) { direction = 1; } - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - if (npc.Calamity().dashImmunityTime[player.whoAmI] < 6) - npc.Calamity().dashImmunityTime[player.whoAmI] = 6; + Player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); + if (npc.Calamity().dashImmunityTime[Player.whoAmI] < 6) + npc.Calamity().dashImmunityTime[Player.whoAmI] = 6; npc.AddBuff(ModContent.BuffType(), 300); - player.GiveIFrames(PlaguebringerVisor.PlagueDashIFrames, false); + Player.GiveIFrames(PlaguebringerVisor.PlagueDashIFrames, false); } } } } - if (dashMod == 9 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) // God Slayer Armor + if (dashMod == 9 && Player.dashDelay < 0 && Player.whoAmI == Main.myPlayer) // God Slayer Armor { - Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + Rectangle rectangle = new Rectangle((int)((double)Player.position.X + (double)Player.velocity.X * 0.5 - 4.0), (int)((double)Player.position.Y + (double)Player.velocity.Y * 0.5 - 4.0), Player.width + 8, Player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[player.whoAmI] <= 0) + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[Player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); - if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) + if (rectangle.Intersects(rect) && (npc.noTileCollide || Player.CanHit(npc))) { - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 67); + SoundEngine.PlaySound(SoundID.Item, (int)Player.position.X, (int)Player.position.Y, 67); for (int j = 0; j < 30; j++) { - int dust = Dust.NewDust(player.position, player.width, player.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Player.position, Player.width, Player.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Dust dust2 = Main.dust[dust]; dust2.position.X += Main.rand.Next(-20, 21); dust2.position.Y += Main.rand.Next(-20, 21); dust2.velocity *= 0.9f; dust2.scale *= 1f + Main.rand.Next(40) * 0.01f; - dust2.shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + dust2.shader = GameShaders.Armor.GetSecondaryShader(Player.cWaist, Player); if (Main.rand.NextBool(2)) dust2.scale *= 1f + Main.rand.Next(40) * 0.01f; } - float num = 3000f * player.AverageDamage(); + float num = 3000f * Player.AverageDamage(); float num2 = 15f; bool crit = false; - if (player.kbGlove) + if (Player.kbGlove) { num2 *= 2f; } - if (player.kbBuff) + if (Player.kbBuff) { num2 *= 1.5f; } - if (Main.rand.Next(100) < player.meleeCrit) + if (Main.rand.Next(100) < Player.GetCritChance(DamageClass.Melee)) { crit = true; } - int direction = player.direction; - if (player.velocity.X < 0f) + int direction = Player.direction; + if (Player.velocity.X < 0f) { direction = -1; } - if (player.velocity.X > 0f) + if (Player.velocity.X > 0f) { direction = 1; } - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - if (npc.Calamity().dashImmunityTime[player.whoAmI] < 6) - npc.Calamity().dashImmunityTime[player.whoAmI] = 6; + Player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); + if (npc.Calamity().dashImmunityTime[Player.whoAmI] < 6) + npc.Calamity().dashImmunityTime[Player.whoAmI] = 6; npc.AddBuff(ModContent.BuffType(), 300); - player.GiveIFrames(GodSlayerChestplate.DashIFrames, false); + Player.GiveIFrames(GodSlayerChestplate.DashIFrames, false); } } } } - if (player.dashDelay > 0) + if (Player.dashDelay > 0) { return; } - if (player.dashDelay < 0) + if (Player.dashDelay < 0) { float num7 = 12f; float num8 = 0.985f; - float num9 = Math.Max(player.accRunSpeed, player.maxRunSpeed); + float num9 = Math.Max(Player.accRunSpeed, Player.maxRunSpeed); float num10 = 0.94f; int delay = 20; if (dashMod == 1) // Counter Scarf @@ -7970,27 +7971,27 @@ namespace CalamityMod.CalPlayer for (int k = 0; k < 2; k++) { int num12; - if (player.velocity.Y == 0f) + if (Player.velocity.Y == 0f) { - num12 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)player.height - 4f), player.width, 8, 235, 0f, 0f, 100, default, 1.4f); + num12 = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + (float)Player.height - 4f), Player.width, 8, 235, 0f, 0f, 100, default, 1.4f); } else { - num12 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)(player.height / 2) - 8f), player.width, 16, 235, 0f, 0f, 100, default, 1.4f); + num12 = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + (float)(Player.height / 2) - 8f), Player.width, 16, 235, 0f, 0f, 100, default, 1.4f); } Main.dust[num12].velocity *= 0.1f; Main.dust[num12].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } } else if (dashMod == 2) // Asgard's Valor { for (int m = 0; m < 4; m++) { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 246, 0f, 0f, 100, default, 2.75f); + int num14 = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 4f), Player.width, Player.height - 8, 246, 0f, 0f, 100, default, 2.75f); Main.dust[num14].velocity *= 0.1f; Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); Main.dust[num14].noGravity = true; if (Main.rand.NextBool(2)) { @@ -8002,10 +8003,10 @@ namespace CalamityMod.CalPlayer { for (int m = 0; m < 12; m++) { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 244, 0f, 0f, 100, default, 2.75f); + int num14 = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 4f), Player.width, Player.height - 8, 244, 0f, 0f, 100, default, 2.75f); Main.dust[num14].velocity *= 0.1f; Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); Main.dust[num14].noGravity = true; if (Main.rand.NextBool(2)) { @@ -8018,10 +8019,10 @@ namespace CalamityMod.CalPlayer { for (int m = 0; m < 24; m++) { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 244, 0f, 0f, 100, default, 2.75f); + int num14 = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 4f), Player.width, Player.height - 8, 244, 0f, 0f, 100, default, 2.75f); Main.dust[num14].velocity *= 0.1f; Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); Main.dust[num14].noGravity = true; if (Main.rand.NextBool(2)) { @@ -8034,10 +8035,10 @@ namespace CalamityMod.CalPlayer { for (int m = 0; m < 24; m++) { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 33, 0f, 0f, 100, default, 2.75f); + int num14 = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 4f), Player.width, Player.height - 8, 33, 0f, 0f, 100, default, 2.75f); Main.dust[num14].velocity *= 0.1f; Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); Main.dust[num14].noGravity = true; if (Main.rand.NextBool(2)) { @@ -8050,10 +8051,10 @@ namespace CalamityMod.CalPlayer { for (int m = 0; m < 24; m++) { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 67, 0f, 0f, 100, default, 1f); + int num14 = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 4f), Player.width, Player.height - 8, 67, 0f, 0f, 100, default, 1f); Main.dust[num14].velocity *= 0.1f; Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); Main.dust[num14].noGravity = true; if (Main.rand.NextBool(2)) { @@ -8068,22 +8069,22 @@ namespace CalamityMod.CalPlayer for (int k = 0; k < 2; k++) { int num12; - if (player.velocity.Y == 0f) + if (Player.velocity.Y == 0f) { - num12 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)player.height - 4f), player.width, 8, 70, 0f, 0f, 100, default, 1.4f); + num12 = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + (float)Player.height - 4f), Player.width, 8, 70, 0f, 0f, 100, default, 1.4f); } else { - num12 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)(player.height / 2) - 8f), player.width, 16, 70, 0f, 0f, 100, default, 1.4f); + num12 = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + (float)(Player.height / 2) - 8f), Player.width, 16, 70, 0f, 0f, 100, default, 1.4f); } Main.dust[num12].velocity *= 0.1f; Main.dust[num12].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } num7 = 14f; if (statisTimer % 5 == 0) { - int scythe = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(250 * player.AverageDamage()), 5f, player.whoAmI); + int scythe = Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(250 * Player.AverageDamage()), 5f, Player.whoAmI); if (scythe.WithinBounds(Main.maxProjectiles)) { Main.projectile[scythe].Calamity().forceTypeless = true; @@ -8096,10 +8097,10 @@ namespace CalamityMod.CalPlayer { for (int m = 0; m < 24; m++) { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 89, 0f, 0f, 100, default, 1f); + int num14 = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 4f), Player.width, Player.height - 8, 89, 0f, 0f, 100, default, 1f); Main.dust[num14].velocity *= 0.1f; Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); Main.dust[num14].noGravity = true; if (Main.rand.NextBool(2)) { @@ -8110,13 +8111,13 @@ namespace CalamityMod.CalPlayer } else if (dashMod == 9) // God Slayer Armor { - player.maxFallSpeed = 50f; + Player.maxFallSpeed = 50f; for (int m = 0; m < 24; m++) { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2.75f); + int num14 = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 4f), Player.width, Player.height - 8, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2.75f); Main.dust[num14].velocity *= 0.1f; Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); Main.dust[num14].noGravity = true; if (Main.rand.NextBool(2)) { @@ -8128,75 +8129,75 @@ namespace CalamityMod.CalPlayer } if (dashMod > 0) { - player.vortexStealthActive = false; + Player.vortexStealthActive = false; if (dashMod == 9) { - if (player.velocity.Length() > num7) + if (Player.velocity.Length() > num7) { - player.velocity *= num8; + Player.velocity *= num8; return; } - if (player.velocity.Length() > num9) + if (Player.velocity.Length() > num9) { - player.velocity *= num10; + Player.velocity *= num10; return; } } else { - if (player.velocity.X > num7 || player.velocity.X < -num7) + if (Player.velocity.X > num7 || Player.velocity.X < -num7) { - player.velocity.X *= num8; + Player.velocity.X *= num8; return; } - if (player.velocity.X > num9 || player.velocity.X < -num9) + if (Player.velocity.X > num9 || Player.velocity.X < -num9) { - player.velocity.X *= num10; + Player.velocity.X *= num10; return; } } - player.dashDelay = delay; + Player.dashDelay = delay; // Cooldown for God Slayer Armor dash if (dashMod == 9) { - player.AddCooldown(GodSlayerDash.ID, CalamityUtils.SecondsToFrames(35)); + Player.AddCooldown(GodSlayerDash.ID, CalamityUtils.SecondsToFrames(35)); godSlayerDashHotKeyPressed = false; } if (dashMod == 9) { - if (player.velocity.Length() < 0f) + if (Player.velocity.Length() < 0f) { - player.velocity.Normalize(); - player.velocity *= -num9; + Player.velocity.Normalize(); + Player.velocity *= -num9; return; } - if (player.velocity.Length() > 0f) + if (Player.velocity.Length() > 0f) { - player.velocity.Normalize(); - player.velocity *= num9; + Player.velocity.Normalize(); + Player.velocity *= num9; return; } } else { - if (player.velocity.X < 0f) + if (Player.velocity.X < 0f) { - player.velocity.X = -num9; + Player.velocity.X = -num9; return; } - if (player.velocity.X > 0f) + if (Player.velocity.X > 0f) { - player.velocity.X = num9; + Player.velocity.X = num9; return; } } } } - else if (dashMod > 0 && !player.mount.Active) + else if (dashMod > 0 && !Player.mount.Active) { if (dashMod == 1) // Counter and Evasion Scarf { @@ -8204,13 +8205,13 @@ namespace CalamityMod.CalPlayer { for (int d = 0; d < 20; d++) { - int idx = Dust.NewDust(player.position, player.width, player.height, 235, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Player.position, Player.width, Player.height, 235, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[idx]; dust.position.X += Main.rand.NextFloat(-5f, 5f); dust.position.Y += Main.rand.NextFloat(-5f, 5f); dust.velocity *= 0.2f; dust.scale *= Main.rand.NextFloat(1f, 1.2f); - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + dust.shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } } } @@ -8220,13 +8221,13 @@ namespace CalamityMod.CalPlayer { for (int d = 0; d < 20; d++) { - int idx = Dust.NewDust(player.position, player.width, player.height, 246, 0f, 0f, 100, default, 3f); + int idx = Dust.NewDust(Player.position, Player.width, Player.height, 246, 0f, 0f, 100, default, 3f); Dust dust = Main.dust[idx]; dust.position.X += Main.rand.NextFloat(-5f, 5f); dust.position.Y += Main.rand.NextFloat(-5f, 5f); dust.velocity *= 0.2f; dust.scale *= Main.rand.NextFloat(1f, 1.2f); - dust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + dust.shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); dust.noGravity = true; dust.fadeIn = 0.5f; } @@ -8238,13 +8239,13 @@ namespace CalamityMod.CalPlayer { for (int d = 0; d < 40; d++) { - int idx = Dust.NewDust(player.position, player.width, player.height, 244, 0f, 0f, 100, default, 3f); + int idx = Dust.NewDust(Player.position, Player.width, Player.height, 244, 0f, 0f, 100, default, 3f); Dust dust = Main.dust[idx]; dust.position.X += Main.rand.NextFloat(-5f, 5f); dust.position.Y += Main.rand.NextFloat(-5f, 5f); dust.velocity *= 0.2f; dust.scale *= Main.rand.NextFloat(1f, 1.2f); - dust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + dust.shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); dust.noGravity = true; dust.fadeIn = 0.5f; } @@ -8256,13 +8257,13 @@ namespace CalamityMod.CalPlayer { for (int d = 0; d < 60; d++) { - int idx = Dust.NewDust(player.position, player.width, player.height, 244, 0f, 0f, 100, default, 3f); + int idx = Dust.NewDust(Player.position, Player.width, Player.height, 244, 0f, 0f, 100, default, 3f); Dust dust = Main.dust[idx]; dust.position.X += Main.rand.NextFloat(-5f, 5f); dust.position.Y += Main.rand.NextFloat(-5f, 5f); dust.velocity *= 0.2f; dust.scale *= Main.rand.NextFloat(1f, 1.2f); - dust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + dust.shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); dust.noGravity = true; dust.fadeIn = 0.5f; } @@ -8274,13 +8275,13 @@ namespace CalamityMod.CalPlayer { for (int d = 0; d < 60; d++) { - int idx = Dust.NewDust(player.position, player.width, player.height, 33, 0f, 0f, 100, default, 3f); + int idx = Dust.NewDust(Player.position, Player.width, Player.height, 33, 0f, 0f, 100, default, 3f); Dust dust = Main.dust[idx]; dust.position.X += Main.rand.NextFloat(-5f, 5f); dust.position.Y += Main.rand.NextFloat(-5f, 5f); dust.velocity *= 0.2f; dust.scale *= Main.rand.NextFloat(1f, 1.2f); - dust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + dust.shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); dust.noGravity = true; dust.fadeIn = 0.5f; } @@ -8292,13 +8293,13 @@ namespace CalamityMod.CalPlayer { for (int d = 0; d < 60; d++) { - int idx = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 100, default, 1.25f); + int idx = Dust.NewDust(Player.position, Player.width, Player.height, 67, 0f, 0f, 100, default, 1.25f); Dust dust = Main.dust[idx]; dust.position.X += Main.rand.NextFloat(-5f, 5f); dust.position.Y += Main.rand.NextFloat(-5f, 5f); dust.velocity *= 0.2f; dust.scale *= Main.rand.NextFloat(1f, 1.2f); - dust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + dust.shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); dust.noGravity = true; dust.fadeIn = 0.5f; } @@ -8310,13 +8311,13 @@ namespace CalamityMod.CalPlayer { for (int d = 0; d < 20; d++) { - int idx = Dust.NewDust(player.position, player.width, player.height, 70, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Player.position, Player.width, Player.height, 70, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[idx]; dust.position.X += Main.rand.NextFloat(-5f, 5f); dust.position.Y += Main.rand.NextFloat(-5f, 5f); dust.velocity *= 0.2f; dust.scale *= Main.rand.NextFloat(1f, 1.2f); - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + dust.shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } } } @@ -8326,13 +8327,13 @@ namespace CalamityMod.CalPlayer { for (int d = 0; d < 60; d++) { - int idx = Dust.NewDust(player.position, player.width, player.height, 89, 0f, 0f, 100, default, 1.25f); + int idx = Dust.NewDust(Player.position, Player.width, Player.height, 89, 0f, 0f, 100, default, 1.25f); Dust dust = Main.dust[idx]; dust.position.X += Main.rand.NextFloat(-5f, 5f); dust.position.Y += Main.rand.NextFloat(-5f, 5f); dust.velocity *= 0.2f; dust.scale *= Main.rand.NextFloat(1f, 1.2f); - dust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + dust.shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); dust.noGravity = true; dust.fadeIn = 0.5f; } @@ -8342,17 +8343,17 @@ namespace CalamityMod.CalPlayer { if (DoADash(80f)) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)Player.position.X, (int)Player.position.Y); for (int d = 0; d < 60; d++) { - int idx = Dust.NewDust(player.position, player.width, player.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int idx = Dust.NewDust(Player.position, Player.width, Player.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Dust dust = Main.dust[idx]; dust.position.X += Main.rand.NextFloat(-5f, 5f); dust.position.Y += Main.rand.NextFloat(-5f, 5f); dust.velocity *= 0.2f; dust.scale *= Main.rand.NextFloat(1f, 1.2f); - dust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + dust.shader = GameShaders.Armor.GetSecondaryShader(Player.ArmorSetDye(), Player); dust.noGravity = true; dust.fadeIn = 0.5f; } @@ -8374,7 +8375,7 @@ namespace CalamityMod.CalPlayer if (godSlayerDash) { - if (player.controlUp && player.controlLeft) + if (Player.controlUp && Player.controlLeft) { if (dashTimeMod < 0) { @@ -8385,7 +8386,7 @@ namespace CalamityMod.CalPlayer else dashTimeMod = -15; } - else if (player.controlUp && player.controlRight) + else if (Player.controlUp && Player.controlRight) { if (dashTimeMod > 0) { @@ -8396,31 +8397,31 @@ namespace CalamityMod.CalPlayer else dashTimeMod = 15; } - else if (player.controlDown && player.controlLeft) + else if (Player.controlDown && Player.controlLeft) { if (dashTimeMod < 0) { direction = -3; justDashed = true; dashTimeMod = 0; - player.maxFallSpeed = 50f; + Player.maxFallSpeed = 50f; } else dashTimeMod = -15; } - else if (player.controlDown && player.controlRight) + else if (Player.controlDown && Player.controlRight) { if (dashTimeMod > 0) { direction = 3; justDashed = true; dashTimeMod = 0; - player.maxFallSpeed = 50f; + Player.maxFallSpeed = 50f; } else dashTimeMod = 15; } - else if (player.controlUp) + else if (Player.controlUp) { if (dashTimeMod < 0) { @@ -8431,19 +8432,19 @@ namespace CalamityMod.CalPlayer else dashTimeMod = -15; } - else if (player.controlDown) + else if (Player.controlDown) { if (dashTimeMod > 0) { direction = 2; justDashed = true; dashTimeMod = 0; - player.maxFallSpeed = 50f; + Player.maxFallSpeed = 50f; } else dashTimeMod = 15; } - else if (player.controlLeft) + else if (Player.controlLeft) { if (dashTimeMod < 0) { @@ -8454,7 +8455,7 @@ namespace CalamityMod.CalPlayer else dashTimeMod = -15; } - else if (player.controlRight) + else if (Player.controlRight) { if (dashTimeMod > 0) { @@ -8468,7 +8469,7 @@ namespace CalamityMod.CalPlayer } else { - if (player.controlRight && player.releaseRight) + if (Player.controlRight && Player.releaseRight) { if (dashTimeMod > 0) { @@ -8479,7 +8480,7 @@ namespace CalamityMod.CalPlayer else dashTimeMod = 15; } - else if (player.controlLeft && player.releaseLeft) + else if (Player.controlLeft && Player.releaseLeft) { if (dashTimeMod < 0) { @@ -8505,22 +8506,22 @@ namespace CalamityMod.CalPlayer { // Up Left case -4: - player.velocity = possibleVelocities[7]; + Player.velocity = possibleVelocities[7]; break; // Down Left case -3: - player.velocity = possibleVelocities[5]; + Player.velocity = possibleVelocities[5]; break; // Up case -2: - player.velocity = possibleVelocities[0]; + Player.velocity = possibleVelocities[0]; break; // Left case -1: - player.velocity = godSlayerDash ? possibleVelocities[6] : new Vector2(possibleVelocities[6].X, player.velocity.Y); + Player.velocity = godSlayerDash ? possibleVelocities[6] : new Vector2(possibleVelocities[6].X, Player.velocity.Y); break; // Nothing @@ -8529,31 +8530,31 @@ namespace CalamityMod.CalPlayer // Right case 1: - player.velocity = godSlayerDash ? possibleVelocities[2] : new Vector2(possibleVelocities[2].X, player.velocity.Y); + Player.velocity = godSlayerDash ? possibleVelocities[2] : new Vector2(possibleVelocities[2].X, Player.velocity.Y); break; // Down case 2: - player.velocity = possibleVelocities[4]; + Player.velocity = possibleVelocities[4]; break; // Down Right case 3: - player.velocity = possibleVelocities[3]; + Player.velocity = possibleVelocities[3]; break; // Up Right case 4: - player.velocity = possibleVelocities[1]; + Player.velocity = possibleVelocities[1]; break; } - Point point5 = (player.Center + new Vector2(MathHelper.Clamp(direction, -1f, 1f) * player.width / 2 + 2, player.gravDir * -player.height / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point6 = (player.Center + new Vector2(MathHelper.Clamp(direction, -1f, 1f) * player.width / 2 + 2, 0f)).ToTileCoordinates(); + Point point5 = (Player.Center + new Vector2(MathHelper.Clamp(direction, -1f, 1f) * Player.width / 2 + 2, Player.gravDir * -Player.height / 2f + Player.gravDir * 2f)).ToTileCoordinates(); + Point point6 = (Player.Center + new Vector2(MathHelper.Clamp(direction, -1f, 1f) * Player.width / 2 + 2, 0f)).ToTileCoordinates(); if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) - player.velocity.X /= 2f; + Player.velocity.X /= 2f; - player.dashDelay = -1; + Player.dashDelay = -1; } return justDashed; @@ -8561,198 +8562,198 @@ namespace CalamityMod.CalPlayer public void ModHorizontalMovement() { - float num = (player.accRunSpeed + player.maxRunSpeed) / 2f; - if (player.controlLeft && player.velocity.X > -player.accRunSpeed && player.dashDelay >= 0) + float num = (Player.accRunSpeed + Player.maxRunSpeed) / 2f; + if (Player.controlLeft && Player.velocity.X > -Player.accRunSpeed && Player.dashDelay >= 0) { - if (player.velocity.X < -num && player.velocity.Y == 0f && !player.mount.Active) + if (Player.velocity.X < -num && Player.velocity.Y == 0f && !Player.mount.Active) { int num3 = 0; - if (player.gravDir == -1f) + if (Player.gravDir == -1f) { - num3 -= player.height; + num3 -= Player.height; } if (dashMod == 1) { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 235, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); + int num7 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num3), Player.width + 8, 4, 235, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 1.5f); Main.dust[num7].velocity.X *= 0.2f; Main.dust[num7].velocity.Y *= 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 2) { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 246, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 2.5f); + int num7 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num3), Player.width + 8, 4, 246, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 2.5f); Main.dust[num7].velocity.X *= 0.2f; Main.dust[num7].velocity.Y *= 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 3) { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + int num7 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num3), Player.width + 8, 4, 244, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 3f); Main.dust[num7].velocity.X *= 0.2f; Main.dust[num7].velocity.Y *= 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 4) { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + int num7 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num3), Player.width + 8, 4, 244, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 3f); Main.dust[num7].velocity.X *= 0.2f; Main.dust[num7].velocity.Y *= 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 5) { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 33, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + int num7 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num3), Player.width + 8, 4, 33, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 3f); Main.dust[num7].velocity.X *= 0.2f; Main.dust[num7].velocity.Y *= 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 6) { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 67, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.25f); + int num7 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num3), Player.width + 8, 4, 67, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 1.25f); Main.dust[num7].velocity.X *= 0.2f; Main.dust[num7].velocity.Y *= 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 7) { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 70, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); + int num7 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num3), Player.width + 8, 4, 70, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 1.5f); Main.dust[num7].velocity.X *= 0.2f; Main.dust[num7].velocity.Y *= 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 8) { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 89, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.25f); + int num7 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num3), Player.width + 8, 4, 89, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 1.25f); Main.dust[num7].velocity.X *= 0.2f; Main.dust[num7].velocity.Y *= 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 9) { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, (int)CalamityDusts.PurpleCosmilite, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + int num7 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num3), Player.width + 8, 4, (int)CalamityDusts.PurpleCosmilite, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 3f); Main.dust[num7].velocity.X *= 0.2f; Main.dust[num7].velocity.Y *= 0.2f; - Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } } } - else if (player.controlRight && player.velocity.X < player.accRunSpeed && player.dashDelay >= 0) + else if (Player.controlRight && Player.velocity.X < Player.accRunSpeed && Player.dashDelay >= 0) { - if (player.velocity.X > num && player.velocity.Y == 0f && !player.mount.Active) + if (Player.velocity.X > num && Player.velocity.Y == 0f && !Player.mount.Active) { int num8 = 0; - if (player.gravDir == -1f) + if (Player.gravDir == -1f) { - num8 -= player.height; + num8 -= Player.height; } if (dashMod == 1) { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 235, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); + int num12 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num8), Player.width + 8, 4, 235, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 1.5f); Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 2) { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 246, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 2.5f); + int num12 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num8), Player.width + 8, 4, 246, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 2.5f); Main.dust[num12].velocity.X *= 0.2f; Main.dust[num12].velocity.Y *= 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 3) { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + int num12 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num8), Player.width + 8, 4, 244, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 3f); Main.dust[num12].velocity.X *= 0.2f; Main.dust[num12].velocity.Y *= 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 4) { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + int num12 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num8), Player.width + 8, 4, 244, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 3f); Main.dust[num12].velocity.X *= 0.2f; Main.dust[num12].velocity.Y *= 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 5) { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 33, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + int num12 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num8), Player.width + 8, 4, 33, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 3f); Main.dust[num12].velocity.X *= 0.2f; Main.dust[num12].velocity.Y *= 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 6) { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 67, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.25f); + int num12 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num8), Player.width + 8, 4, 67, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 1.25f); Main.dust[num12].velocity.X *= 0.2f; Main.dust[num12].velocity.Y *= 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 7) { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 70, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); + int num12 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num8), Player.width + 8, 4, 70, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 1.5f); Main.dust[num12].velocity.X *= 0.2f; Main.dust[num12].velocity.Y *= 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 8) { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 89, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.25f); + int num12 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num8), Player.width + 8, 4, 89, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 1.25f); Main.dust[num12].velocity.X *= 0.2f; Main.dust[num12].velocity.Y *= 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } else if (dashMod == 9) { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, (int)CalamityDusts.PurpleCosmilite, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); + int num12 = Dust.NewDust(new Vector2(Player.position.X - 4f, Player.position.Y + (float)Player.height + (float)num8), Player.width + 8, 4, (int)CalamityDusts.PurpleCosmilite, -Player.velocity.X * 0.5f, Player.velocity.Y * 0.5f, 50, default, 3f); Main.dust[num12].velocity.X *= 0.2f; Main.dust[num12].velocity.Y *= 0.2f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(Player.cShoe, Player); } } } - if (player.mount.Active && player.mount.Type == ModContent.MountType() && Math.Abs(player.velocity.X) > player.mount.DashSpeed - player.mount.RunSpeed / 2f) + if (Player.mount.Active && Player.mount.Type == ModContent.MountType() && Math.Abs(Player.velocity.X) > Player.mount.DashSpeed - Player.mount.RunSpeed / 2f) { - Rectangle rect = player.getRect(); + Rectangle rect = Player.getRect(); - if (player.direction == 1) - rect.Offset(player.width - 1, 0); + if (Player.direction == 1) + rect.Offset(Player.width - 1, 0); rect.Width = 2; rect.Inflate(6, 12); - float damage = 800f * player.MinionDamage(); + float damage = 800f * Player.MinionDamage(); float knockback = 10f; int NPCImmuneTime = 30; int playerImmuneTime = 6; ModCollideWithNPCs(rect, damage, knockback, NPCImmuneTime, playerImmuneTime); } - if (player.mount.Active && player.mount.Type == ModContent.MountType() && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) + if (Player.mount.Active && Player.mount.Type == ModContent.MountType() && Math.Abs(Player.velocity.X) > Player.mount.RunSpeed / 2f) { - Rectangle rect2 = player.getRect(); + Rectangle rect2 = Player.getRect(); - if (player.direction == 1) - rect2.Offset(player.width - 1, 0); + if (Player.direction == 1) + rect2.Offset(Player.width - 1, 0); rect2.Width = 2; rect2.Inflate(6, 12); - float damage2 = 50f * player.MinionDamage(); + float damage2 = 50f * Player.MinionDamage(); float knockback2 = 8f; int NPCImmuneTime = 30; int playerImmuneTime = 6; ModCollideWithNPCs(rect2, damage2, knockback2, NPCImmuneTime, playerImmuneTime); } - if (player.mount.Active && player.mount.Type == ModContent.MountType() && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) + if (Player.mount.Active && Player.mount.Type == ModContent.MountType() && Math.Abs(Player.velocity.X) > Player.mount.RunSpeed / 2f) { - Rectangle rect2 = player.getRect(); + Rectangle rect2 = Player.getRect(); - if (player.direction == 1) - rect2.Offset(player.width - 1, 0); + if (Player.direction == 1) + rect2.Offset(Player.width - 1, 0); rect2.Width = 2; rect2.Inflate(6, 12); - float damage2 = 25f * player.MinionDamage(); + float damage2 = 25f * Player.MinionDamage(); float knockback2 = 5f; int NPCImmuneTime = 30; int playerImmuneTime = 6; @@ -8766,26 +8767,26 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { NPC nPC = Main.npc[i]; - if (nPC.active && !nPC.dontTakeDamage && !nPC.friendly && nPC.Calamity().dashImmunityTime[player.whoAmI] <= 0) + if (nPC.active && !nPC.dontTakeDamage && !nPC.friendly && nPC.Calamity().dashImmunityTime[Player.whoAmI] <= 0) { Rectangle rect = nPC.getRect(); - if (myRect.Intersects(rect) && (nPC.noTileCollide || Collision.CanHit(player.position, player.width, player.height, nPC.position, nPC.width, nPC.height))) + if (myRect.Intersects(rect) && (nPC.noTileCollide || Collision.CanHit(Player.position, Player.width, Player.height, nPC.position, nPC.width, nPC.height))) { - int direction = player.direction; - if (player.velocity.X < 0f) + int direction = Player.direction; + if (Player.velocity.X < 0f) { direction = -1; } - if (player.velocity.X > 0f) + if (Player.velocity.X > 0f) { direction = 1; } - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { - player.ApplyDamageToNPC(nPC, (int)Damage, Knockback, direction, false); + Player.ApplyDamageToNPC(nPC, (int)Damage, Knockback, direction, false); } - nPC.Calamity().dashImmunityTime[player.whoAmI] = NPCImmuneTime; - player.GiveIFrames(PlayerImmuneTime, false); + nPC.Calamity().dashImmunityTime[Player.whoAmI] = NPCImmuneTime; + Player.GiveIFrames(PlayerImmuneTime, false); num++; break; } @@ -8862,10 +8863,10 @@ namespace CalamityMod.CalPlayer #region All-Class Crit Boost public void AllCritBoost(int boost) { - player.meleeCrit += boost; - player.rangedCrit += boost; - player.magicCrit += boost; - player.thrownCrit += boost; + Player.GetCritChance(DamageClass.Melee) += boost; + Player.GetCritChance(DamageClass.Ranged) += boost; + Player.GetCritChance(DamageClass.Magic) += boost; + Player.GetCritChance(DamageClass.Throwing) += boost; // Rogue weapons benefit from throwing crit AND rogue crit, so don't add both. // throwingCrit += boost; } @@ -8905,7 +8906,7 @@ namespace CalamityMod.CalPlayer if (playRogueStealthSound && rogueStealth >= rogueStealthMax) { playRogueStealthSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/RogueStealth"), (int)player.position.X, (int)player.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/RogueStealth"), (int)Player.position.X, (int)Player.position.Y); } // If the player isn't at full stealth, reset the sound so it'll play again when they hit full stealth. @@ -8927,7 +8928,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.ActiveItem(); + Item it = Player.ActiveItem(); bool hasDamage = it.damage > 0; bool hasHitboxes = !it.noMelee || it.shoot > ProjectileID.None; bool isPickaxe = it.pick > 0; @@ -8945,8 +8946,8 @@ namespace CalamityMod.CalPlayer // Animation check depends on whether the item is "clockwork", like Clockwork Assault Rifle. // "Clockwork" weapons can chain-fire multiple stealth strikes (really only 2 max) until you run out of stealth. bool animationCheck = it.useAnimation == it.useTime - ? player.itemAnimation == player.itemAnimationMax - 1 // Standard weapon (first frame of use animation) - : player.itemTime == it.useTime; // Clockwork weapon (first frame of any individual use event) + ? Player.itemAnimation == Player.itemAnimationMax - 1 // Standard weapon (first frame of use animation) + : Player.itemTime == it.useTime; // Clockwork weapon (first frame of any individual use event) if (!stealthStrikeThisFrame && animationCheck && playerUsingWeapon) { @@ -8967,7 +8968,7 @@ namespace CalamityMod.CalPlayer return; // Hovering over an item will adjust the stealth bonus dynamically so that you see the correct damage for an item you put your cursor on. - Item it = !Main.HoverItem.IsAir ? Main.HoverItem : player.ActiveItem(); + Item it = !Main.HoverItem.IsAir ? Main.HoverItem : Player.ActiveItem(); // The potential damage bonus from stealth is a complex equation based on the item's use time, // the player's averaged-together stealth generation stats, and max stealth. @@ -9001,19 +9002,19 @@ namespace CalamityMod.CalPlayer throwingCrit = 100; // Stealth slightly decreases aggro. - player.aggro -= (int)(rogueStealth * 300f); + Player.aggro -= (int)(rogueStealth * 300f); } private float UpdateStealthGenStats() { - int finalDawnProjCount = player.ownedProjectileCounts[ModContent.ProjectileType()] + - player.ownedProjectileCounts[ModContent.ProjectileType()] + - player.ownedProjectileCounts[ModContent.ProjectileType()] + - player.ownedProjectileCounts[ModContent.ProjectileType()] + - player.ownedProjectileCounts[ModContent.ProjectileType()]; + int finalDawnProjCount = Player.ownedProjectileCounts[ModContent.ProjectileType()] + + Player.ownedProjectileCounts[ModContent.ProjectileType()] + + Player.ownedProjectileCounts[ModContent.ProjectileType()] + + Player.ownedProjectileCounts[ModContent.ProjectileType()] + + Player.ownedProjectileCounts[ModContent.ProjectileType()]; // If you are actively using an item, you cannot gain stealth. - if (player.itemAnimation > 0 || finalDawnProjCount > 0) + if (Player.itemAnimation > 0 || finalDawnProjCount > 0) return 0f; // Penumbra Potion provides various boosts to rogue stealth generation @@ -9033,7 +9034,7 @@ namespace CalamityMod.CalPlayer stealthGenMoving += 0.15f; } - if (CalamityLists.daggerList.Contains(player.ActiveItem().type) && player.invis) + if (CalamityLists.daggerList.Contains(Player.ActiveItem().type) && Player.invis) { stealthGenStandstill += 0.08f; stealthGenMoving += 0.08f; @@ -9081,7 +9082,7 @@ namespace CalamityMod.CalPlayer // You get 100% stealth regen while standing still and not on a mount. Otherwise, you get your stealth regeneration while moving. // Stealth only regenerates at 1/3 speed while moving. - bool standstill = player.StandingStill(0.1f) && !player.mount.Active; + bool standstill = Player.StandingStill(0.1f) && !Player.mount.Active; return standstill ? stealthGenStandstill : stealthGenMoving * 0.333333f * stealthAcceleration; } @@ -9470,19 +9471,19 @@ namespace CalamityMod.CalPlayer { string key = final ? "Mods.CalamityMod.MeleeLevelUpFinal" : "Mods.CalamityMod.MeleeLevelUp"; shootFireworksLevelUpMelee = false; - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { if (final) { - int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + int prof = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 1f); - Main.projectile[prof].ranged = false; + // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; } else { - int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + int prof = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[prof].ranged = false; + // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; } Main.NewText(Language.GetTextValue(key), messageColor); } @@ -9495,19 +9496,19 @@ namespace CalamityMod.CalPlayer string key = final ? "Mods.CalamityMod.RangedLevelUpFinal" : "Mods.CalamityMod.RangedLevelUp"; messageColor = Color.GreenYellow; shootFireworksLevelUpRanged = false; - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { if (final) { - int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + int prof = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 1f); - Main.projectile[prof].ranged = false; + // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; } else { - int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + int prof = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[prof].ranged = false; + // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; } Main.NewText(Language.GetTextValue(key), messageColor); } @@ -9520,19 +9521,19 @@ namespace CalamityMod.CalPlayer string key = final ? "Mods.CalamityMod.MagicLevelUpFinal" : "Mods.CalamityMod.MagicLevelUp"; messageColor = Color.DodgerBlue; shootFireworksLevelUpMagic = false; - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { if (final) { - int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + int prof = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 1f); - Main.projectile[prof].ranged = false; + // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; } else { - int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + int prof = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[prof].ranged = false; + // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; } Main.NewText(Language.GetTextValue(key), messageColor); } @@ -9545,19 +9546,19 @@ namespace CalamityMod.CalPlayer string key = final ? "Mods.CalamityMod.SummonLevelUpFinal" : "Mods.CalamityMod.SummonLevelUp"; messageColor = Color.Aquamarine; shootFireworksLevelUpSummon = false; - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { if (final) { - int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + int prof = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 1f); - Main.projectile[prof].ranged = false; + // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; } else { - int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + int prof = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[prof].ranged = false; + // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; } Main.NewText(Language.GetTextValue(key), messageColor); } @@ -9570,19 +9571,19 @@ namespace CalamityMod.CalPlayer string key = final ? "Mods.CalamityMod.RogueLevelUpFinal" : "Mods.CalamityMod.RogueLevelUp"; messageColor = Color.Orchid; shootFireworksLevelUpRogue = false; - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { if (final) { - int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + int prof = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 1f); - Main.projectile[prof].ranged = false; + // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; } else { - int prof = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + int prof = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), 0, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[prof].ranged = false; + // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; } Main.NewText(Language.GetTextValue(key), messageColor); } @@ -9600,312 +9601,312 @@ namespace CalamityMod.CalPlayer #region MeleeLevelBoosts if (meleeLevel >= 12500) { - player.meleeDamage += 0.06f; - player.meleeCrit += 3; + Player.GetDamage(DamageClass.Melee) += 0.06f; + Player.GetCritChance(DamageClass.Melee) += 3; } else if (meleeLevel >= 10500) { - player.meleeDamage += 0.06f; - player.meleeCrit += 3; + Player.GetDamage(DamageClass.Melee) += 0.06f; + Player.GetCritChance(DamageClass.Melee) += 3; } else if (meleeLevel >= 9100) { - player.meleeDamage += 0.06f; - player.meleeCrit += 3; + Player.GetDamage(DamageClass.Melee) += 0.06f; + Player.GetCritChance(DamageClass.Melee) += 3; } else if (meleeLevel >= 7800) { - player.meleeDamage += 0.05f; - player.meleeCrit += 3; + Player.GetDamage(DamageClass.Melee) += 0.05f; + Player.GetCritChance(DamageClass.Melee) += 3; } else if (meleeLevel >= 6600) { - player.meleeDamage += 0.05f; - player.meleeCrit += 3; + Player.GetDamage(DamageClass.Melee) += 0.05f; + Player.GetCritChance(DamageClass.Melee) += 3; } else if (meleeLevel >= 5500) //hm limit { - player.meleeDamage += 0.05f; - player.meleeCrit += 2; + Player.GetDamage(DamageClass.Melee) += 0.05f; + Player.GetCritChance(DamageClass.Melee) += 2; } else if (meleeLevel >= 4500) { - player.meleeDamage += 0.05f; - player.meleeCrit += 2; + Player.GetDamage(DamageClass.Melee) += 0.05f; + Player.GetCritChance(DamageClass.Melee) += 2; } else if (meleeLevel >= 3600) { - player.meleeDamage += 0.04f; - player.meleeCrit += 2; + Player.GetDamage(DamageClass.Melee) += 0.04f; + Player.GetCritChance(DamageClass.Melee) += 2; } else if (meleeLevel >= 2800) { - player.meleeDamage += 0.04f; - player.meleeCrit += 1; + Player.GetDamage(DamageClass.Melee) += 0.04f; + Player.GetCritChance(DamageClass.Melee) += 1; } else if (meleeLevel >= 2100) { - player.meleeDamage += 0.04f; - player.meleeCrit += 1; + Player.GetDamage(DamageClass.Melee) += 0.04f; + Player.GetCritChance(DamageClass.Melee) += 1; } else if (meleeLevel >= 1500) //prehm limit { - player.meleeDamage += 0.03f; - player.meleeCrit += 1; + Player.GetDamage(DamageClass.Melee) += 0.03f; + Player.GetCritChance(DamageClass.Melee) += 1; } else if (meleeLevel >= 1000) { - player.meleeDamage += 0.02f; - player.meleeCrit += 1; + Player.GetDamage(DamageClass.Melee) += 0.02f; + Player.GetCritChance(DamageClass.Melee) += 1; } else if (meleeLevel >= 600) { - player.meleeDamage += 0.02f; + Player.GetDamage(DamageClass.Melee) += 0.02f; } else if (meleeLevel >= 300) - player.meleeDamage += 0.02f; + Player.GetDamage(DamageClass.Melee) += 0.02f; else if (meleeLevel >= 100) - player.meleeDamage += 0.01f; + Player.GetDamage(DamageClass.Melee) += 0.01f; #endregion #region RangedLevelBoosts if (rangedLevel >= 12500) { - player.rangedDamage += 0.06f; - player.moveSpeed += 0.06f; - player.rangedCrit += 3; + Player.GetDamage(DamageClass.Ranged) += 0.06f; + Player.moveSpeed += 0.06f; + Player.GetCritChance(DamageClass.Ranged) += 3; } else if (rangedLevel >= 10500) { - player.rangedDamage += 0.05f; - player.moveSpeed += 0.06f; - player.rangedCrit += 3; + Player.GetDamage(DamageClass.Ranged) += 0.05f; + Player.moveSpeed += 0.06f; + Player.GetCritChance(DamageClass.Ranged) += 3; } else if (rangedLevel >= 9100) { - player.rangedDamage += 0.05f; - player.moveSpeed += 0.05f; - player.rangedCrit += 3; + Player.GetDamage(DamageClass.Ranged) += 0.05f; + Player.moveSpeed += 0.05f; + Player.GetCritChance(DamageClass.Ranged) += 3; } else if (rangedLevel >= 7800) { - player.rangedDamage += 0.04f; - player.moveSpeed += 0.05f; - player.rangedCrit += 3; + Player.GetDamage(DamageClass.Ranged) += 0.04f; + Player.moveSpeed += 0.05f; + Player.GetCritChance(DamageClass.Ranged) += 3; } else if (rangedLevel >= 6600) { - player.rangedDamage += 0.04f; - player.moveSpeed += 0.04f; - player.rangedCrit += 3; + Player.GetDamage(DamageClass.Ranged) += 0.04f; + Player.moveSpeed += 0.04f; + Player.GetCritChance(DamageClass.Ranged) += 3; } else if (rangedLevel >= 5500) { - player.rangedDamage += 0.04f; - player.moveSpeed += 0.04f; - player.rangedCrit += 2; + Player.GetDamage(DamageClass.Ranged) += 0.04f; + Player.moveSpeed += 0.04f; + Player.GetCritChance(DamageClass.Ranged) += 2; } else if (rangedLevel >= 4500) { - player.rangedDamage += 0.03f; - player.moveSpeed += 0.04f; - player.rangedCrit += 2; + Player.GetDamage(DamageClass.Ranged) += 0.03f; + Player.moveSpeed += 0.04f; + Player.GetCritChance(DamageClass.Ranged) += 2; } else if (rangedLevel >= 3600) { - player.rangedDamage += 0.03f; - player.moveSpeed += 0.03f; - player.rangedCrit += 2; + Player.GetDamage(DamageClass.Ranged) += 0.03f; + Player.moveSpeed += 0.03f; + Player.GetCritChance(DamageClass.Ranged) += 2; } else if (rangedLevel >= 2800) { - player.rangedDamage += 0.02f; - player.moveSpeed += 0.03f; - player.rangedCrit += 2; + Player.GetDamage(DamageClass.Ranged) += 0.02f; + Player.moveSpeed += 0.03f; + Player.GetCritChance(DamageClass.Ranged) += 2; } else if (rangedLevel >= 2100) { - player.rangedDamage += 0.02f; - player.moveSpeed += 0.03f; - player.rangedCrit += 1; + Player.GetDamage(DamageClass.Ranged) += 0.02f; + Player.moveSpeed += 0.03f; + Player.GetCritChance(DamageClass.Ranged) += 1; } else if (rangedLevel >= 1500) { - player.rangedDamage += 0.02f; - player.moveSpeed += 0.02f; - player.rangedCrit += 1; + Player.GetDamage(DamageClass.Ranged) += 0.02f; + Player.moveSpeed += 0.02f; + Player.GetCritChance(DamageClass.Ranged) += 1; } else if (rangedLevel >= 1000) { - player.rangedDamage += 0.02f; - player.moveSpeed += 0.01f; - player.rangedCrit += 1; + Player.GetDamage(DamageClass.Ranged) += 0.02f; + Player.moveSpeed += 0.01f; + Player.GetCritChance(DamageClass.Ranged) += 1; } else if (rangedLevel >= 600) { - player.rangedDamage += 0.02f; - player.rangedCrit += 1; + Player.GetDamage(DamageClass.Ranged) += 0.02f; + Player.GetCritChance(DamageClass.Ranged) += 1; } else if (rangedLevel >= 300) - player.rangedDamage += 0.02f; + Player.GetDamage(DamageClass.Ranged) += 0.02f; else if (rangedLevel >= 100) - player.rangedDamage += 0.01f; + Player.GetDamage(DamageClass.Ranged) += 0.01f; #endregion #region MagicLevelBoosts if (magicLevel >= 12500) { - player.magicDamage += 0.06f; - player.manaCost *= 0.94f; - player.magicCrit += 3; + Player.GetDamage(DamageClass.Magic) += 0.06f; + Player.manaCost *= 0.94f; + Player.GetCritChance(DamageClass.Magic) += 3; } else if (magicLevel >= 10500) { - player.magicDamage += 0.05f; - player.manaCost *= 0.94f; - player.magicCrit += 3; + Player.GetDamage(DamageClass.Magic) += 0.05f; + Player.manaCost *= 0.94f; + Player.GetCritChance(DamageClass.Magic) += 3; } else if (magicLevel >= 9100) { - player.magicDamage += 0.05f; - player.manaCost *= 0.95f; - player.magicCrit += 3; + Player.GetDamage(DamageClass.Magic) += 0.05f; + Player.manaCost *= 0.95f; + Player.GetCritChance(DamageClass.Magic) += 3; } else if (magicLevel >= 7800) { - player.magicDamage += 0.04f; - player.manaCost *= 0.95f; - player.magicCrit += 3; + Player.GetDamage(DamageClass.Magic) += 0.04f; + Player.manaCost *= 0.95f; + Player.GetCritChance(DamageClass.Magic) += 3; } else if (magicLevel >= 6600) { - player.magicDamage += 0.04f; - player.manaCost *= 0.96f; - player.magicCrit += 3; + Player.GetDamage(DamageClass.Magic) += 0.04f; + Player.manaCost *= 0.96f; + Player.GetCritChance(DamageClass.Magic) += 3; } else if (magicLevel >= 5500) { - player.magicDamage += 0.04f; - player.manaCost *= 0.96f; - player.magicCrit += 2; + Player.GetDamage(DamageClass.Magic) += 0.04f; + Player.manaCost *= 0.96f; + Player.GetCritChance(DamageClass.Magic) += 2; } else if (magicLevel >= 4500) { - player.magicDamage += 0.04f; - player.manaCost *= 0.97f; - player.magicCrit += 2; + Player.GetDamage(DamageClass.Magic) += 0.04f; + Player.manaCost *= 0.97f; + Player.GetCritChance(DamageClass.Magic) += 2; } else if (magicLevel >= 3600) { - player.magicDamage += 0.03f; - player.manaCost *= 0.97f; - player.magicCrit += 2; + Player.GetDamage(DamageClass.Magic) += 0.03f; + Player.manaCost *= 0.97f; + Player.GetCritChance(DamageClass.Magic) += 2; } else if (magicLevel >= 2800) { - player.magicDamage += 0.03f; - player.manaCost *= 0.98f; - player.magicCrit += 2; + Player.GetDamage(DamageClass.Magic) += 0.03f; + Player.manaCost *= 0.98f; + Player.GetCritChance(DamageClass.Magic) += 2; } else if (magicLevel >= 2100) { - player.magicDamage += 0.03f; - player.manaCost *= 0.98f; - player.magicCrit += 1; + Player.GetDamage(DamageClass.Magic) += 0.03f; + Player.manaCost *= 0.98f; + Player.GetCritChance(DamageClass.Magic) += 1; } else if (magicLevel >= 1500) { - player.magicDamage += 0.02f; - player.manaCost *= 0.98f; - player.magicCrit += 1; + Player.GetDamage(DamageClass.Magic) += 0.02f; + Player.manaCost *= 0.98f; + Player.GetCritChance(DamageClass.Magic) += 1; } else if (magicLevel >= 1000) { - player.magicDamage += 0.02f; - player.manaCost *= 0.99f; - player.magicCrit += 1; + Player.GetDamage(DamageClass.Magic) += 0.02f; + Player.manaCost *= 0.99f; + Player.GetCritChance(DamageClass.Magic) += 1; } else if (magicLevel >= 600) { - player.magicDamage += 0.02f; - player.manaCost *= 0.99f; + Player.GetDamage(DamageClass.Magic) += 0.02f; + Player.manaCost *= 0.99f; } else if (magicLevel >= 300) - player.magicDamage += 0.02f; + Player.GetDamage(DamageClass.Magic) += 0.02f; else if (magicLevel >= 100) - player.magicDamage += 0.01f; + Player.GetDamage(DamageClass.Magic) += 0.01f; #endregion #region SummonLevelBoosts if (summonLevel >= 12500) { - player.minionDamage += 0.12f; - player.minionKB += 3.0f; + Player.GetDamage(DamageClass.Summon) += 0.12f; + Player.minionKB += 3.0f; } else if (summonLevel >= 10500) { - player.minionDamage += 0.1f; - player.minionKB += 3.0f; + Player.GetDamage(DamageClass.Summon) += 0.1f; + Player.minionKB += 3.0f; } else if (summonLevel >= 9100) { - player.minionDamage += 0.09f; - player.minionKB += 2.7f; + Player.GetDamage(DamageClass.Summon) += 0.09f; + Player.minionKB += 2.7f; } else if (summonLevel >= 7800) { - player.minionDamage += 0.08f; - player.minionKB += 2.4f; + Player.GetDamage(DamageClass.Summon) += 0.08f; + Player.minionKB += 2.4f; } else if (summonLevel >= 6600) { - player.minionDamage += 0.07f; - player.minionKB += 2.1f; + Player.GetDamage(DamageClass.Summon) += 0.07f; + Player.minionKB += 2.1f; } else if (summonLevel >= 5500) { - player.minionDamage += 0.07f; - player.minionKB += 1.8f; + Player.GetDamage(DamageClass.Summon) += 0.07f; + Player.minionKB += 1.8f; } else if (summonLevel >= 4500) { - player.minionDamage += 0.06f; - player.minionKB += 1.8f; + Player.GetDamage(DamageClass.Summon) += 0.06f; + Player.minionKB += 1.8f; } else if (summonLevel >= 3600) { - player.minionDamage += 0.05f; - player.minionKB += 1.5f; + Player.GetDamage(DamageClass.Summon) += 0.05f; + Player.minionKB += 1.5f; } else if (summonLevel >= 2800) { - player.minionDamage += 0.04f; - player.minionKB += 1.2f; + Player.GetDamage(DamageClass.Summon) += 0.04f; + Player.minionKB += 1.2f; } else if (summonLevel >= 2100) { - player.minionDamage += 0.04f; - player.minionKB += 0.9f; + Player.GetDamage(DamageClass.Summon) += 0.04f; + Player.minionKB += 0.9f; } else if (summonLevel >= 1500) { - player.minionDamage += 0.03f; - player.minionKB += 0.6f; + Player.GetDamage(DamageClass.Summon) += 0.03f; + Player.minionKB += 0.6f; } else if (summonLevel >= 1000) { - player.minionDamage += 0.03f; - player.minionKB += 0.3f; + Player.GetDamage(DamageClass.Summon) += 0.03f; + Player.minionKB += 0.3f; } else if (summonLevel >= 600) { - player.minionDamage += 0.02f; - player.minionKB += 0.3f; + Player.GetDamage(DamageClass.Summon) += 0.02f; + Player.minionKB += 0.3f; } else if (summonLevel >= 300) - player.minionDamage += 0.02f; + Player.GetDamage(DamageClass.Summon) += 0.02f; else if (summonLevel >= 100) - player.minionDamage += 0.01f; + Player.GetDamage(DamageClass.Summon) += 0.01f; #endregion #region RogueLevelBoosts @@ -10056,17 +10057,17 @@ namespace CalamityMod.CalPlayer internal void rollBabSpears(int randAmt, bool chaseable) { - if (player.whoAmI == Main.myPlayer && !endoCooper && randAmt > 0 && Main.rand.NextBool(randAmt) && chaseable) + if (Player.whoAmI == Main.myPlayer && !endoCooper && randAmt > 0 && Main.rand.NextBool(randAmt) && chaseable) { int spearsFired = 0; for (int i = 0; i < Main.projectile.Length; i++) { if (spearsFired == 2) break; - if (Main.projectile[i].friendly && Main.projectile[i].owner == player.whoAmI) + if (Main.projectile[i].friendly && Main.projectile[i].owner == Player.whoAmI) { - bool attack = Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == player.whoAmI; - if (attack || (Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == player.whoAmI)) + bool attack = Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == Player.whoAmI; + if (attack || (Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == Player.whoAmI)) { int numSpears = attack ? 12 : 6; int dam = Main.projectile[i].damage; @@ -10081,7 +10082,7 @@ namespace CalamityMod.CalPlayer Vector2 velocity = new Vector2(posVec.X, posVec.Y).RotatedBy(spinOffsetAngle); velocity.Normalize(); velocity *= 8f; - Projectile.NewProjectile(Main.projectile[i].Center + posVec, velocity, ModContent.ProjectileType(), dam, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(Main.projectile[i].Center + posVec, velocity, ModContent.ProjectileType(), dam, 0f, Player.whoAmI, 0f, 0f); } spearsFired++; } @@ -10112,7 +10113,7 @@ namespace CalamityMod.CalPlayer bool isInvalidTransFrame = !IsValidTransitionFrame(currentType, newType, key, value); //to make the transition between walk and idle frames less jarring and smoother AnimationType type = isInvalidTransFrame ? newType : currentType; - int frameCount = type == AnimationType.Walk || (!profanedCrystalForce && player.statLife <= (int)(player.statLifeMax2 * 0.5)) ? 7 : 10; + int frameCount = type == AnimationType.Walk || (!profanedCrystalForce && Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) ? 7 : 10; int lowerRange = type == AnimationType.Idle ? 0 : type == AnimationType.Jump ? 8 : 9; int upperRange = type == AnimationType.Idle ? 7 : type == AnimationType.Jump ? 8 : 22; if (value <= 0 || !isInvalidTransFrame) @@ -10129,16 +10130,16 @@ namespace CalamityMod.CalPlayer public override void PostUpdate() //needs to be here else it doesn't work properly, otherwise i'd have stuck it with the wing anim stuffs { - if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide && player.legs == mod.GetEquipSlot("ProviLegs", EquipType.Legs)) + if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide && Player.legs == Mod.GetEquipSlot("ProviLegs", EquipType.Legs)) { - bool usingCarpet = player.carpetTime > 0 && player.controlJump; //doesn't make sense for carpet to use jump frame since you have solid ground + bool usingCarpet = Player.carpetTime > 0 && Player.controlJump; //doesn't make sense for carpet to use jump frame since you have solid ground AnimationType animType = AnimationType.Walk; - if ((player.sliding || player.velocity.Y != 0 || player.mount.Active || player.grappling[0] != -1 || player.GoingDownWithGrapple) && !usingCarpet) + if ((Player.sliding || Player.velocity.Y != 0 || Player.mount.Active || Player.grappling[0] != -1 || Player.GoingDownWithGrapple) && !usingCarpet) animType = AnimationType.Jump; - else if (player.velocity.X == 0 || usingCarpet) + else if (Player.velocity.X == 0 || usingCarpet) animType = AnimationType.Idle; int frame = HandlePSCAnimationFrames(animType); - player.legFrame.Y = player.legFrame.Height * frame; + Player.legFrame.Y = Player.legFrame.Height * frame; } waterLeechTarget = -1; } @@ -10189,21 +10190,21 @@ namespace CalamityMod.CalPlayer public int GetTotalLightStrength() { int light = externalAbyssLight; - bool underwater = player.IsUnderwater(); - bool miningHelmet = player.head == ArmorIDs.Head.MiningHelmet; + bool underwater = Player.IsUnderwater(); + bool miningHelmet = Player.head == ArmorIDs.Head.MiningHelmet; // The campfire bonus does not apply while in the Abyss. - if (!ZoneAbyss && (player.HasBuff(BuffID.Campfire) || Main.campfire)) + if (!ZoneAbyss && (Player.HasBuff(BuffID.Campfire) || Main.campfire)) light += 1; if (camper) //inherits Campfire so really +2 light += 1; if (miningHelmet) light += 1; - if (player.lightOrb) + if (Player.lightOrb) light += 1; - if (player.crimsonHeart) + if (Player.crimsonHeart) light += 1; - if (player.magicLantern) + if (Player.magicLantern) light += 1; if (giantPearl) light += 1; @@ -10223,7 +10224,7 @@ namespace CalamityMod.CalPlayer light += 1; if (aquaticEmblem && underwater) light += 1; - if (player.arcticDivingGear && underwater) //inherited by abyssal diving gear/suit, also gives jellyfish necklace so really +2 + if (Player.arcticDivingGear && underwater) //inherited by abyssal diving gear/suit, also gives jellyfish necklace so really +2 light += 1; if (jellyfishNecklace && underwater) //inherited by deific amulet+, jellyfish diving gear+ light += 1; @@ -10233,22 +10234,22 @@ namespace CalamityMod.CalPlayer light += 2; if (blazingCore) light += 2; - if (player.redFairy || player.greenFairy || player.blueFairy) + if (Player.redFairy || Player.greenFairy || Player.blueFairy) light += 2; if (babyGhostBell) light += underwater ? 2 : 1; - if (player.petFlagDD2Ghost) + if (Player.petFlagDD2Ghost) light += 2; if (sirenPet) light += underwater ? 3 : 1; - if (player.wisp) + if (Player.wisp) light += 3; - if (player.suspiciouslookingTentacle) + if (Player.suspiciouslookingTentacle) light += 3; if (littleLightPet) light += 3; if (profanedCrystalBuffs && !ZoneAbyss) - light += Main.dayTime || player.lavaWet ? 2 : 1; + light += Main.dayTime || Player.lavaWet ? 2 : 1; return light; } @@ -10257,20 +10258,20 @@ namespace CalamityMod.CalPlayer #region Mana Consumption Effects public override void OnConsumeMana(Item item, int manaConsumed) { - CalamityPlayer modPlayer = player.Calamity(); + CalamityPlayer modPlayer = Player.Calamity(); if (Main.rand.NextBool(2) && modPlayer.lifeManaEnchant) { - if (Main.myPlayer == player.whoAmI) + if (Main.myPlayer == Player.whoAmI) { - player.HealEffect(-5); - player.statLife -= 5; - if (player.statLife <= 0) - player.KillMe(PlayerDeathReason.ByCustomReason($"{player.name} converted all of their life to mana."), 1000, -1); + Player.HealEffect(-5); + Player.statLife -= 5; + if (Player.statLife <= 0) + Player.KillMe(PlayerDeathReason.ByCustomReason($"{Player.name} converted all of their life to mana."), 1000, -1); } for (int i = 0; i < 8; i++) { - Dust life = Dust.NewDustPerfect(player.Top + Main.rand.NextVector2Circular(player.width * 0.5f, 6f), 267); + Dust life = Dust.NewDustPerfect(Player.Top + Main.rand.NextVector2Circular(Player.width * 0.5f, 6f), 267); life.color = Color.Red; life.velocity = -Vector2.UnitY.RotatedByRandom(0.48f) * Main.rand.NextFloat(3f, 4.4f); life.scale = Main.rand.NextFloat(1.5f, 1.72f); @@ -10301,7 +10302,7 @@ namespace CalamityMod.CalPlayer } // There is also a cap on defense damage: 25% of the player's original defense. - int cap = player.statDefense / 4; + int cap = Player.statDefense / 4; if (defenseDamageTaken > cap) defenseDamageTaken = cap; @@ -10330,14 +10331,14 @@ namespace CalamityMod.CalPlayer // Play a sound from taking defense damage. if (hurtSoundTimer == 0) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DefenseDamage"), (int)player.position.X, (int)player.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DefenseDamage"), (int)Player.position.X, (int)Player.position.Y); hurtSoundTimer = 30; } // Display text indicating that defense damage was taken. string text = (-defenseDamageTaken).ToString(); Color messageColor = Color.LightGray; - Rectangle location = new Rectangle((int)player.position.X, (int)player.position.Y - 16, player.width, player.height); + Rectangle location = new Rectangle((int)Player.position.X, (int)Player.position.Y - 16, Player.width, Player.height); CombatText.NewText(location, messageColor, Language.GetTextValue(text)); } #endregion diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 49e334fc06..e30566b385 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -104,7 +104,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.sirenIce) { - Texture2D texture = ModContent.GetTexture("CalamityMod/ExtraTextures/IceShield"); + Texture2D texture = ModContent.Request("CalamityMod/ExtraTextures/IceShield"); int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X); int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y); DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, Color.White, 0f, texture.Size() * 0.5f, 1f, SpriteEffects.None, 0); @@ -112,7 +112,7 @@ namespace CalamityMod.CalPlayer } if (modPlayer.amidiasBlessing) { - Texture2D texture = ModContent.GetTexture("CalamityMod/ExtraTextures/AmidiasBubble"); + Texture2D texture = ModContent.Request("CalamityMod/ExtraTextures/AmidiasBubble"); int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X); int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y); //4 DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, Color.White, 0f, texture.Size() * 0.5f, 1f, SpriteEffects.None, 0); @@ -146,27 +146,27 @@ namespace CalamityMod.CalPlayer { case 0: default: - gemTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/GemTechArmor/RedGem"); + gemTexture = ModContent.Request("CalamityMod/ExtraTextures/GemTechArmor/RedGem"); gemType = GemTechArmorGemType.Rogue; break; case 1: - gemTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/GemTechArmor/YellowGem"); + gemTexture = ModContent.Request("CalamityMod/ExtraTextures/GemTechArmor/YellowGem"); gemType = GemTechArmorGemType.Melee; break; case 2: - gemTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/GemTechArmor/GreenGem"); + gemTexture = ModContent.Request("CalamityMod/ExtraTextures/GemTechArmor/GreenGem"); gemType = GemTechArmorGemType.Ranged; break; case 3: - gemTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/GemTechArmor/BlueGem"); + gemTexture = ModContent.Request("CalamityMod/ExtraTextures/GemTechArmor/BlueGem"); gemType = GemTechArmorGemType.Summoner; break; case 4: - gemTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/GemTechArmor/PurpleGem"); + gemTexture = ModContent.Request("CalamityMod/ExtraTextures/GemTechArmor/PurpleGem"); gemType = GemTechArmorGemType.Magic; break; case 5: - gemTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/GemTechArmor/PinkGem"); + gemTexture = ModContent.Request("CalamityMod/ExtraTextures/GemTechArmor/PinkGem"); gemType = GemTechArmorGemType.Base; pulseFactor = 2.5f; break; @@ -295,17 +295,17 @@ namespace CalamityMod.CalPlayer currentlyHeldItem.type == ModContent.ItemType() || currentlyHeldItem.type == ModContent.ItemType() || currentlyHeldItem.type == ModContent.ItemType() || - (currentlyHeldItem.type == ModContent.ItemType() && currentlyHeldItem.useStyle == ItemUseStyleID.HoldingOut)) + (currentlyHeldItem.type == ModContent.ItemType() && currentlyHeldItem.useStyle == ItemUseStyleID.Shoot)) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/DeathhailStaffGlow"); + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/DeathhailStaffGlow"); if (currentlyHeldItem.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/VesuviusGlow"); + texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/VesuviusGlow"); else if (currentlyHeldItem.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow"); + texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow"); else if (currentlyHeldItem.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/FatesRevealGlow"); + texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/FatesRevealGlow"); else if (currentlyHeldItem.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"); + texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"); float rotation = drawPlayer.itemRotation + MathHelper.PiOver4 * (float)drawPlayer.direction; int xOffset = 0; @@ -352,31 +352,31 @@ namespace CalamityMod.CalPlayer currentlyHeldItem.type == ModContent.ItemType() || currentlyHeldItem.type == ModContent.ItemType()) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/DeathwindGlow"); + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/DeathwindGlow"); int offsetX = 10; if (currentlyHeldItem.type == ModContent.ItemType()) { - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/ApotheosisGlow"); + texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/ApotheosisGlow"); offsetX = 6; } else if (currentlyHeldItem.type == ModContent.ItemType()) { - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow"); + texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow"); offsetX = 37; } else if (currentlyHeldItem.type == ModContent.ItemType()) { - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow"); + texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow"); offsetX = 9; } else if (currentlyHeldItem.type == ModContent.ItemType()) { - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/AuroraBlazerGlow"); + texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/AuroraBlazerGlow"); offsetX = 44; } else if (currentlyHeldItem.type == ModContent.ItemType()) { - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/AuralisGlow"); + texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/AuralisGlow"); offsetX = 62; } @@ -406,19 +406,19 @@ namespace CalamityMod.CalPlayer currentlyHeldItem.type == ModContent.ItemType() || currentlyHeldItem.type == ModContent.ItemType() || currentlyHeldItem.type == ModContent.ItemType() || - (currentlyHeldItem.type == ModContent.ItemType() && currentlyHeldItem.useStyle == ItemUseStyleID.SwingThrow)) + (currentlyHeldItem.type == ModContent.ItemType() && currentlyHeldItem.useStyle == ItemUseStyleID.Swing)) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ExcelsusGlow"); + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/ExcelsusGlow"); if (currentlyHeldItem.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/EssenceFlayerGlow"); + texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/EssenceFlayerGlow"); else if (currentlyHeldItem.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow"); + texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow"); else if (currentlyHeldItem.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow"); + texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow"); else if (currentlyHeldItem.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow"); + texture = ModContent.Request("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow"); else if (currentlyHeldItem.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"); + texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"); float yOffset = drawPlayer.gravDir == -1f ? 0f : (float)Main.itemTexture[currentlyHeldItem.type].Height; @@ -455,7 +455,7 @@ namespace CalamityMod.CalPlayer if (drawInfo.shadow != 0f || drawPlayer.dead) return; - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Armor/FathomSwarmerArmor_Tail"); + Texture2D texture = ModContent.Request("CalamityMod/Items/Armor/FathomSwarmerArmor_Tail"); Rectangle frame = texture.Frame(1, 4, 0, modPlayer.tailFrame); if (modPlayer.fathomSwarmerTail) @@ -534,7 +534,7 @@ namespace CalamityMod.CalPlayer headDrawPosition += ExtendedHatDrawer.ExtensionSpriteOffset(drawInfo); - Texture2D extraPieceTexture = ModContent.GetTexture(ExtendedHatDrawer.ExtensionTexture); + Texture2D extraPieceTexture = ModContent.Request(ExtendedHatDrawer.ExtensionTexture); Rectangle frame = extraPieceTexture.Frame(1, 20, 0, drawPlayer.bodyFrame.Y / drawPlayer.bodyFrame.Height); DrawData pieceDrawData = new DrawData(extraPieceTexture, headDrawPosition, frame, drawInfo.upperArmorColor, drawPlayer.fullRotation, origin, 1f, drawInfo.spriteEffects, 0); pieceDrawData.shader = dyeShader; @@ -598,7 +598,7 @@ namespace CalamityMod.CalPlayer CalamityPlayer modPlayer = drawPlayer.Calamity(); if (modPlayer.coldDivinity) { - Texture2D texture = ModContent.GetTexture("CalamityMod/ExtraTextures/ColdDivinityBody"); + Texture2D texture = ModContent.Request("CalamityMod/ExtraTextures/ColdDivinityBody"); int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X); int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y); SpriteEffects spriteEffects = drawPlayer.direction != -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; @@ -613,7 +613,7 @@ namespace CalamityMod.CalPlayer CalamityPlayer modPlayer = drawPlayer.Calamity(); if (modPlayer.voidAura || modPlayer.voidAuraDamage) { - Texture2D tex = ModContent.GetTexture("CalamityMod/ExtraTextures/VoidConcentrationAura"); + Texture2D tex = ModContent.Request("CalamityMod/ExtraTextures/VoidConcentrationAura"); Vector2 drawPos = drawPlayer.Center - Main.screenPosition + new Vector2(0f, drawPlayer.gfxOffY); drawPos.Y -= 9; SpriteEffects spriteEffects = drawPlayer.direction != -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; //intentionally inverse due to giving more space for the player model without faffing about with the specific positioning @@ -632,7 +632,7 @@ namespace CalamityMod.CalPlayer CalamityPlayer modPlayer = drawPlayer.Calamity(); if (modPlayer.roverDriveTimer < 616 && modPlayer.roverDrive && !drawPlayer.dead) { - Texture2D texture = ModContent.GetTexture("CalamityMod/ExtraTextures/RoverAccShield"); + Texture2D texture = ModContent.Request("CalamityMod/ExtraTextures/RoverAccShield"); Vector2 drawPos = drawPlayer.Center - Main.screenPosition + new Vector2(0f, drawPlayer.gfxOffY); Rectangle frame = texture.Frame(1, 11, 0, modPlayer.roverFrame); Color color = Color.White * 0.625f; @@ -662,7 +662,7 @@ namespace CalamityMod.CalPlayer if (drawPlayer.gravDir != 1f) effect |= SpriteEffects.FlipVertically; Vector2 itemDrawPosition = drawPlayer.Center; - Texture2D drawTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/StratusSphereHold"); + Texture2D drawTexture = ModContent.Request("CalamityMod/ExtraTextures/StratusSphereHold"); Rectangle rectangle = drawTexture.Frame(1, 4, 0, (int)(2 * Math.Sin(drawPlayer.miscCounter / 20f * MathHelper.TwoPi) + 2)); Vector2 drawOffset = new Vector2(rectangle.Width / 2 * drawPlayer.direction, 0f); Vector2 origin = rectangle.Size() / 2f; @@ -675,7 +675,7 @@ namespace CalamityMod.CalPlayer drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0)); - drawTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/StratusSphereHoldGlow"); + drawTexture = ModContent.Request("CalamityMod/ExtraTextures/StratusSphereHoldGlow"); Main.playerDrawData.Add(new DrawData(drawTexture, (itemDrawPosition - Main.screenPosition + drawOffset).Floor(), new Rectangle?(rectangle), @@ -742,7 +742,7 @@ namespace CalamityMod.CalPlayer switch (drawPlayer.Calamity().andromedaState) { case AndromedaPlayerState.SpecialAttack: - Texture2D dashTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AndromedaBolt"); + Texture2D dashTexture = ModContent.Request("CalamityMod/ExtraTextures/AndromedaBolt"); Rectangle frame = dashTexture.Frame(1, 4, 0, robotEntityInstance.RightIconCooldown / 4 % 4); DrawData drawData = new DrawData(dashTexture, @@ -759,10 +759,10 @@ namespace CalamityMod.CalPlayer Main.playerDrawData.Add(drawData); break; case AndromedaPlayerState.LargeRobot: - Texture2D robotTexture = ModContent.GetTexture(robotEntityInstance.Texture); + Texture2D robotTexture = ModContent.Request(robotEntityInstance.Texture); frame = new Rectangle(robotEntityInstance.FrameX * robotTexture.Width / 3, robotEntityInstance.FrameY * robotTexture.Height / 7, robotTexture.Width / 3, robotTexture.Height / 7); - drawData = new DrawData(ModContent.GetTexture(Main.projectile[robot].modProjectile.Texture), + drawData = new DrawData(ModContent.Request(Main.projectile[robot].modProjectile.Texture), Main.projectile[robot].Center + Vector2.UnitY * 6f - Main.screenPosition, frame, Color.White, @@ -776,7 +776,7 @@ namespace CalamityMod.CalPlayer Main.playerDrawData.Add(drawData); break; case AndromedaPlayerState.SmallRobot: - robotTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaSmall"); + robotTexture = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaSmall"); frame = new Rectangle(0, robotEntityInstance.CurrentFrame * 54, robotTexture.Width, robotTexture.Height / 21); drawData = new DrawData(robotTexture, drawPlayer.Center + new Vector2(drawPlayer.direction == 1 ? -24 : -10, -8f) - Main.screenPosition, @@ -846,22 +846,22 @@ namespace CalamityMod.CalPlayer list.Add(MiscEffectsFront); // Remove shoe drawing effects if special legs are meant to be drawn. - if (CalamityLists.legOverrideList.Contains(player.legs)) + if (CalamityLists.legOverrideList.Contains(Player.legs)) list[list.IndexOf(PlayerLayer.ShoeAcc)].visible = false; - if (player.Calamity().fab || player.Calamity().crysthamyr || player.Calamity().onyxExcavator) + if (Player.Calamity().fab || Player.Calamity().crysthamyr || Player.Calamity().onyxExcavator) AddPlayerLayer(list, clAfterAll, list[list.Count - 1], false); - if (player.heldProj != -1 && Main.projectile[player.heldProj].active && Main.projectile[player.heldProj].type == ModContent.ProjectileType()) + if (Player.heldProj != -1 && Main.projectile[Player.heldProj].active && Main.projectile[Player.heldProj].type == ModContent.ProjectileType()) list.Insert(list.IndexOf(PlayerLayer.Arms), DrawRancorBookManually); - if (player.Calamity().fathomSwarmerTail) + if (Player.Calamity().fathomSwarmerTail) { int skinIndex = list.IndexOf(PlayerLayer.Skin); list.Insert(skinIndex - 1, Tail); } - if (player.Calamity().forbiddenCirclet) + if (Player.Calamity().forbiddenCirclet) { int drawTheStupidSign = list.IndexOf(PlayerLayer.Skin); list.Insert(drawTheStupidSign, ForbiddenCircletSign); @@ -882,8 +882,8 @@ namespace CalamityMod.CalPlayer public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) { - CalamityPlayer calamityPlayer = player.Calamity(); - if (Main.myPlayer == player.whoAmI && !Main.gameMenu && CalamityConfig.Instance.SpeedrunTimer) + CalamityPlayer calamityPlayer = Player.Calamity(); + if (Main.myPlayer == Player.whoAmI && !Main.gameMenu && CalamityConfig.Instance.SpeedrunTimer) { string formatStr = @"hh\:mm\:ss\.ff"; string formatStrDays = @"d\:hh\:mm\:ss\.ff"; @@ -934,7 +934,7 @@ namespace CalamityMod.CalPlayer break; case 7: - texture = ModContent.GetTexture("CalamityMod/NPCs/HiveMind/HiveMindP2_Head_Boss"); + texture = ModContent.Request("CalamityMod/NPCs/HiveMind/HiveMindP2_Head_Boss"); break; case 8: @@ -1053,7 +1053,7 @@ namespace CalamityMod.CalPlayer break; case 34: - texture = ModContent.GetTexture("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked_Head_Boss"); + texture = ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked_Head_Boss"); break; case 35: @@ -1061,7 +1061,7 @@ namespace CalamityMod.CalPlayer break; case 36: - texture = ModContent.GetTexture("CalamityMod/NPCs/Polterghast/Necroplasm_Head_Boss"); + texture = ModContent.Request("CalamityMod/NPCs/Polterghast/Necroplasm_Head_Boss"); break; case 37: @@ -1077,7 +1077,7 @@ namespace CalamityMod.CalPlayer break; case 40: - texture = ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIcon"); + texture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIcon"); break; case 41: @@ -1104,7 +1104,7 @@ namespace CalamityMod.CalPlayer // Dust modifications while high. if (calamityPlayer.trippy) { - if (Main.myPlayer == player.whoAmI) + if (Main.myPlayer == Player.whoAmI) { Rectangle screenArea = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 50, Main.screenWidth + 1000, Main.screenHeight + 100); int dustDrawn = 0; @@ -1123,18 +1123,18 @@ namespace CalamityMod.CalPlayer Vector2 dustDrawPosition = dust.position; Vector2 dustCenter = dustDrawPosition + new Vector2(4f); - float distanceX = Math.Abs(dustCenter.X - player.Center.X); - float distanceY = Math.Abs(dustCenter.Y - player.Center.Y); + float distanceX = Math.Abs(dustCenter.X - Player.Center.X); + float distanceY = Math.Abs(dustCenter.Y - Player.Center.Y); if (j == 0 || j == 2) - dustDrawPosition.X = player.Center.X + distanceX; - else dustDrawPosition.X = player.Center.X - distanceX; + dustDrawPosition.X = Player.Center.X + distanceX; + else dustDrawPosition.X = Player.Center.X - distanceX; dustDrawPosition.X -= 4f; if (j == 0 || j == 1) - dustDrawPosition.Y = player.Center.Y + distanceY; + dustDrawPosition.Y = Player.Center.Y + distanceY; - else dustDrawPosition.Y = player.Center.Y - distanceY; + else dustDrawPosition.Y = Player.Center.Y - distanceY; dustDrawPosition.Y -= 4f; Main.spriteBatch.Draw(Main.dustTexture, dustDrawPosition - Main.screenPosition, dust.frame, dust.color, dust.rotation, new Vector2(4f), dust.scale, SpriteEffects.None, 0f); @@ -1150,8 +1150,8 @@ namespace CalamityMod.CalPlayer } } - bool noRogueStealth = calamityPlayer.rogueStealth == 0f || player.townNPCs > 2f || !CalamityConfig.Instance.StealthInvisbility; - if (calamityPlayer.rogueStealth > 0f && calamityPlayer.rogueStealthMax > 0f && player.townNPCs < 3f && CalamityConfig.Instance.StealthInvisbility) + bool noRogueStealth = calamityPlayer.rogueStealth == 0f || Player.townNPCs > 2f || !CalamityConfig.Instance.StealthInvisbility; + if (calamityPlayer.rogueStealth > 0f && calamityPlayer.rogueStealthMax > 0f && Player.townNPCs < 3f && CalamityConfig.Instance.StealthInvisbility) { // A translucent orchid color, the rogue class color float colorValue = calamityPlayer.rogueStealth / calamityPlayer.rogueStealthMax * 0.9f; //0 to 0.9 @@ -1159,17 +1159,17 @@ namespace CalamityMod.CalPlayer g *= 1f - colorValue; //255 to 25 b *= 1f - (colorValue * 0.89f); //255 to 50 a *= 1f - colorValue; //255 to 25 - player.armorEffectDrawOutlines = false; - player.armorEffectDrawShadow = false; - player.armorEffectDrawShadowSubtle = false; + Player.armorEffectDrawOutlines = false; + Player.armorEffectDrawShadow = false; + Player.armorEffectDrawShadowSubtle = false; } - Texture2D heart3 = ModContent.GetTexture("CalamityMod/ExtraTextures/Heart3"); - Texture2D heart4 = ModContent.GetTexture("CalamityMod/ExtraTextures/Heart4"); - Texture2D heart5 = ModContent.GetTexture("CalamityMod/ExtraTextures/Heart5"); - Texture2D heart6 = ModContent.GetTexture("CalamityMod/ExtraTextures/Heart6"); - Texture2D heartOriginal = ModContent.GetTexture("CalamityMod/ExtraTextures/HeartOriginal"); // Life fruit - Texture2D heartOriginal2 = ModContent.GetTexture("CalamityMod/ExtraTextures/HeartOriginal2"); // Life crystal + Texture2D heart3 = ModContent.Request("CalamityMod/ExtraTextures/Heart3"); + Texture2D heart4 = ModContent.Request("CalamityMod/ExtraTextures/Heart4"); + Texture2D heart5 = ModContent.Request("CalamityMod/ExtraTextures/Heart5"); + Texture2D heart6 = ModContent.Request("CalamityMod/ExtraTextures/Heart6"); + Texture2D heartOriginal = ModContent.Request("CalamityMod/ExtraTextures/HeartOriginal"); // Life fruit + Texture2D heartOriginal2 = ModContent.Request("CalamityMod/ExtraTextures/HeartOriginal2"); // Life crystal int totalFruit = (calamityPlayer.mFruit ? 1 : 0) + @@ -1201,7 +1201,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, 91, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, default, 1f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, 91, Player.velocity.X * 0.2f, Player.velocity.Y * 0.2f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity.Y -= 0.5f; Main.playerDrawDust.Add(dust); @@ -1211,7 +1211,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(10) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, 107, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, 107, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.75f; Main.dust[dust].velocity.Y -= 0.35f; @@ -1227,11 +1227,11 @@ namespace CalamityMod.CalPlayer } if (calamityPlayer.IBoots) { - if (!player.StandingStill() && !player.mount.Active) + if (!Player.StandingStill() && !Player.mount.Active) { if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, 229, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, 229, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.5f; Main.playerDrawDust.Add(dust); @@ -1247,11 +1247,11 @@ namespace CalamityMod.CalPlayer } if (calamityPlayer.elysianFire) { - if (!player.StandingStill() && !player.mount.Active) + if (!Player.StandingStill() && !Player.mount.Active) { if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, 246, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, 246, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.5f; Main.playerDrawDust.Add(dust); @@ -1267,11 +1267,11 @@ namespace CalamityMod.CalPlayer } if (calamityPlayer.dsSetBonus) { - if (!player.StandingStill() && !player.mount.Active) + if (!Player.StandingStill() && !Player.mount.Active) { if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, 27, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1.5f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, 27, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.5f; Main.playerDrawDust.Add(dust); @@ -1287,11 +1287,11 @@ namespace CalamityMod.CalPlayer } if (calamityPlayer.auricSet) { - if (!player.StandingStill() && !player.mount.Active) + if (!Player.StandingStill() && !Player.mount.Active) { if (drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, Main.rand.NextBool(2) ? 57 : 244, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1.5f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, Main.rand.NextBool(2) ? 57 : 244, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.5f; Main.playerDrawDust.Add(dust); @@ -1309,7 +1309,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, ModContent.DustType(), player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, ModContent.DustType(), Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; @@ -1327,7 +1327,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.Next(5) < 4 && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, 27, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1.95f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, 27, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.95f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.75f; Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 0.75f; @@ -1343,7 +1343,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.Next(5) < 4 && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, 46, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1.95f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, 46, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.95f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.75f; Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 0.75f; @@ -1365,7 +1365,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, 206, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, 206, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; Main.playerDrawDust.Add(dust); @@ -1382,7 +1382,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, 173, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, 173, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; @@ -1401,7 +1401,7 @@ namespace CalamityMod.CalPlayer if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { int dustType = Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(); - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, dustType, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, default, 0.7f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, dustType, Player.velocity.X * 0.2f, Player.velocity.Y * 0.2f, 100, default, 0.7f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.5f; @@ -1413,7 +1413,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, ModContent.DustType(), player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, ModContent.DustType(), Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; @@ -1431,7 +1431,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(calamityPlayer.dragonFire ? 6 : 12) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, (int)CalamityDusts.ProfanedFire, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, (int)CalamityDusts.ProfanedFire, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; @@ -1442,7 +1442,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, 89, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, 89, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; @@ -1460,7 +1460,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, 176, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, 176, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; @@ -1488,7 +1488,7 @@ namespace CalamityMod.CalPlayer }); if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, dustType, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, dustType, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; @@ -1517,7 +1517,7 @@ namespace CalamityMod.CalPlayer fullBright = true; } } - if (calamityPlayer.draedonsHeart && !calamityPlayer.shadeRegen && !calamityPlayer.cFreeze && player.StandingStill() && player.itemAnimation == 0) + if (calamityPlayer.draedonsHeart && !calamityPlayer.shadeRegen && !calamityPlayer.cFreeze && Player.StandingStill() && Player.itemAnimation == 0) { if (noRogueStealth) { @@ -1531,7 +1531,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(6) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, 5, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, 5, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; @@ -1549,7 +1549,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(6) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, 56, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 2f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, 56, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.5f; Main.dust[dust].velocity.Y -= 0.1f; @@ -1567,7 +1567,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(6) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), player.width + 4, player.height + 4, 5, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 3f); + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f), Player.width + 4, Player.height + 4, 5, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; @@ -1581,7 +1581,7 @@ namespace CalamityMod.CalPlayer fullBright = true; } } - if ((calamityPlayer.cadence || calamityPlayer.ladHearts > 0) && !player.loveStruck) + if ((calamityPlayer.cadence || calamityPlayer.ladHearts > 0) && !Player.loveStruck) { if (Main.rand.NextBool(5) && drawInfo.shadow == 0f) { @@ -1589,7 +1589,7 @@ namespace CalamityMod.CalPlayer velocity.X *= 0.66f; velocity *= Main.rand.NextFloat(1f, 2f); - int heart = Gore.NewGore(drawInfo.position + new Vector2(Main.rand.Next(player.width + 1), Main.rand.Next(player.height + 1)), velocity, 331, Main.rand.NextFloat(0.4f, 1.2f)); + int heart = Gore.NewGore(drawInfo.position + new Vector2(Main.rand.Next(Player.width + 1), Main.rand.Next(Player.height + 1)), velocity, 331, Main.rand.NextFloat(0.4f, 1.2f)); Main.gore[heart].sticky = false; Main.gore[heart].velocity *= 0.4f; Main.gore[heart].velocity.Y -= 0.6f; @@ -1637,23 +1637,23 @@ namespace CalamityMod.CalPlayer }; List tankTextures = new List() { - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_FlurrystormCannon"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_BlightSpewer"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_BrimstoneFlameblaster"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_HavocsBreath"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_SparkSpreader"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_HalleysInferno"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_CleansingBlaze"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_ElementalEruption"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_TheEmpyrean"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_Meowthrower"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_OverloadedBlaster"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_TerraFlameburster"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_Photoviscerator"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_Shadethrower"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_BloodBoiler"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_PristineFury"), - ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_AuroraBlazer") + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_FlurrystormCannon"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_BlightSpewer"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_BrimstoneFlameblaster"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_HavocsBreath"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_SparkSpreader"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_HalleysInferno"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_CleansingBlaze"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_ElementalEruption"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_TheEmpyrean"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_Meowthrower"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_OverloadedBlaster"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_TerraFlameburster"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_Photoviscerator"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_Shadethrower"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_BloodBoiler"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_PristineFury"), + ModContent.Request("CalamityMod/ExtraTextures/Tanks/Backpack_AuroraBlazer") }; if (tankItems.Contains(item.type) || drawPlayer.Calamity().plaguebringerCarapace) { @@ -1670,12 +1670,12 @@ namespace CalamityMod.CalPlayer } } else if (drawPlayer.Calamity().plaguebringerCarapace) - thingToDraw = ModContent.GetTexture("CalamityMod/Items/Armor/PlaguebringerCarapace_Back"); + thingToDraw = ModContent.Request("CalamityMod/Items/Armor/PlaguebringerCarapace_Back"); if (thingToDraw is null) return; - SpriteEffects spriteEffects = player.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + SpriteEffects spriteEffects = Player.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; float num25 = -4f; float num24 = -8f; diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index e052eae396..05c09d35c1 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -30,7 +30,7 @@ namespace CalamityMod.CalPlayer bool lava = liquidType == 1; bool honey = liquidType == 2; - Point point = player.Center.ToTileCoordinates(); + Point point = Player.Center.ToTileCoordinates(); bool canSulphurFish = false; if (CalamityWorld.abyssSide) { @@ -49,7 +49,7 @@ namespace CalamityMod.CalPlayer // Old Duke spawn if (canSulphurFish && bait.type == ModContent.ItemType() && water && !BossRushEvent.BossRushActive) { - CalamityGlobalNPC.OldDukeSpawn(player.whoAmI, ModContent.NPCType(), bait.type); + CalamityGlobalNPC.OldDukeSpawn(Player.whoAmI, ModContent.NPCType(), bait.type); } // Quest Fish @@ -100,25 +100,25 @@ namespace CalamityMod.CalPlayer } else if (water) { - if (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight) + if (Player.ZoneDirtLayerHeight || Player.ZoneRockLayerHeight) { fishList.Add(ItemID.ArmoredCavefish); fishList.Add(ItemID.Stinkfish); fishList.Add(ItemID.SpecularFish); - fishList.AddWithCondition(ItemID.ChaosFish, player.ZoneHoly); - fishList.AddWithCondition(ItemID.VariegatedLardfish, player.ZoneJungle); + fishList.AddWithCondition(ItemID.ChaosFish, Player.ZoneHoly); + fishList.AddWithCondition(ItemID.VariegatedLardfish, Player.ZoneJungle); } - if (player.ZoneOverworldHeight || player.ZoneSkyHeight) + if (Player.ZoneOverworldHeight || Player.ZoneSkyHeight) { - fishList.AddWithCondition(ItemID.DoubleCod, player.ZoneJungle); + fishList.AddWithCondition(ItemID.DoubleCod, Player.ZoneJungle); } - fishList.AddWithCondition(ItemID.FrostMinnow, player.ZoneSnow); - fishList.AddWithCondition(ItemID.Ebonkoi, player.ZoneCorrupt); - fishList.AddWithCondition(ItemID.CrimsonTigerfish, player.ZoneCrimson); - fishList.AddWithCondition(ItemID.Hemopiranha, player.ZoneCrimson); - fishList.AddWithCondition(ItemID.PrincessFish, player.ZoneHoly); - fishList.AddWithCondition(ItemID.Prismite, player.ZoneHoly); - fishList.AddWithCondition(ItemID.Damselfish, player.ZoneSkyHeight); + fishList.AddWithCondition(ItemID.FrostMinnow, Player.ZoneSnow); + fishList.AddWithCondition(ItemID.Ebonkoi, Player.ZoneCorrupt); + fishList.AddWithCondition(ItemID.CrimsonTigerfish, Player.ZoneCrimson); + fishList.AddWithCondition(ItemID.Hemopiranha, Player.ZoneCrimson); + fishList.AddWithCondition(ItemID.PrincessFish, Player.ZoneHoly); + fishList.AddWithCondition(ItemID.Prismite, Player.ZoneHoly); + fishList.AddWithCondition(ItemID.Damselfish, Player.ZoneSkyHeight); fishList.AddWithCondition(ModContent.ItemType(), ZoneAstral); fishList.AddWithCondition(ModContent.ItemType(), ZoneSunkenSea); fishList.AddWithCondition(ModContent.ItemType(), ZoneSunkenSea); @@ -179,7 +179,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.Next(100) < chanceForCrates) { - if (Main.rand.NextBool(chanceForRareItems) && enchantedPearl && fishingStation && player.cratePotion) + if (Main.rand.NextBool(chanceForRareItems) && enchantedPearl && fishingStation && Player.cratePotion) { List rareItemList = new List(); @@ -222,13 +222,13 @@ namespace CalamityMod.CalPlayer break; } } - if (player.ZoneSnow && player.ZoneRockLayerHeight && (player.ZoneCorrupt || player.ZoneCrimson || player.ZoneHoly)) + if (Player.ZoneSnow && Player.ZoneRockLayerHeight && (Player.ZoneCorrupt || Player.ZoneCrimson || Player.ZoneHoly)) { rareItemList.Add(ItemID.ScalyTruffle); } - rareItemList.AddWithCondition(ItemID.Toxikarp, player.ZoneCorrupt); - rareItemList.AddWithCondition(ItemID.Bladetongue, player.ZoneCrimson); - rareItemList.AddWithCondition(ItemID.CrystalSerpent, player.ZoneHoly); + rareItemList.AddWithCondition(ItemID.Toxikarp, Player.ZoneCorrupt); + rareItemList.AddWithCondition(ItemID.Bladetongue, Player.ZoneCrimson); + rareItemList.AddWithCondition(ItemID.CrystalSerpent, Player.ZoneHoly); if (rareItemList.Any()) { @@ -248,12 +248,12 @@ namespace CalamityMod.CalPlayer biomeCrateList.AddWithCondition(ModContent.ItemType(), ZoneAstral); biomeCrateList.AddWithCondition(ModContent.ItemType(), ZoneSunkenSea); biomeCrateList.AddWithCondition(ModContent.ItemType(), canSulphurFish); - biomeCrateList.AddWithCondition(ItemID.CorruptFishingCrate, player.ZoneCorrupt); - biomeCrateList.AddWithCondition(ItemID.CrimsonFishingCrate, player.ZoneCrimson); - biomeCrateList.AddWithCondition(ItemID.HallowedFishingCrate, player.ZoneHoly); - biomeCrateList.AddWithCondition(ItemID.DungeonFishingCrate, player.ZoneDungeon); - biomeCrateList.AddWithCondition(ItemID.JungleFishingCrate, player.ZoneJungle); - biomeCrateList.AddWithCondition(ItemID.FloatingIslandFishingCrate, player.ZoneSkyHeight); + biomeCrateList.AddWithCondition(ItemID.CorruptFishingCrate, Player.ZoneCorrupt); + biomeCrateList.AddWithCondition(ItemID.CrimsonFishingCrate, Player.ZoneCrimson); + biomeCrateList.AddWithCondition(ItemID.HallowedFishingCrate, Player.ZoneHoly); + biomeCrateList.AddWithCondition(ItemID.DungeonFishingCrate, Player.ZoneDungeon); + biomeCrateList.AddWithCondition(ItemID.JungleFishingCrate, Player.ZoneJungle); + biomeCrateList.AddWithCondition(ItemID.FloatingIslandFishingCrate, Player.ZoneSkyHeight); if (biomeCrateList.Any()) { @@ -281,7 +281,7 @@ namespace CalamityMod.CalPlayer { return; } - if ((player.ZoneCrimson || player.ZoneCorrupt) && player.ZoneRockLayerHeight && Main.hardMode) + if ((Player.ZoneCrimson || Player.ZoneCorrupt) && Player.ZoneRockLayerHeight && Main.hardMode) { if (Main.rand.NextBool(25)) { @@ -289,7 +289,7 @@ namespace CalamityMod.CalPlayer } } - if (player.ZoneHoly && player.ZoneRockLayerHeight && Main.hardMode) + if (Player.ZoneHoly && Player.ZoneRockLayerHeight && Main.hardMode) { if (Main.rand.NextBool(25)) { @@ -297,7 +297,7 @@ namespace CalamityMod.CalPlayer } } - if (player.ZoneSkyHeight && Main.hardMode) + if (Player.ZoneSkyHeight && Main.hardMode) { if (Main.rand.NextBool(25)) { @@ -305,7 +305,7 @@ namespace CalamityMod.CalPlayer } } - if (player.ZoneOverworldHeight && !Main.dayTime) + if (Player.ZoneOverworldHeight && !Main.dayTime) { if (Main.rand.NextBool(10)) { @@ -313,7 +313,7 @@ namespace CalamityMod.CalPlayer } } - if (player.ZoneOverworldHeight && Main.dayTime) + if (Player.ZoneOverworldHeight && Main.dayTime) { if (Main.rand.NextBool(25)) { @@ -321,7 +321,7 @@ namespace CalamityMod.CalPlayer } } - if (player.ZoneRockLayerHeight) + if (Player.ZoneRockLayerHeight) { if (Main.rand.NextBool(25)) { @@ -329,7 +329,7 @@ namespace CalamityMod.CalPlayer } } - if (player.ZoneSnow) + if (Player.ZoneSnow) { if (Main.rand.NextBool(25) && Main.hardMode) { @@ -337,7 +337,7 @@ namespace CalamityMod.CalPlayer } } - if (player.ZoneDirtLayerHeight) + if (Player.ZoneDirtLayerHeight) { if (Main.rand.NextBool(Main.hardMode ? 100 : 40)) { @@ -360,11 +360,11 @@ namespace CalamityMod.CalPlayer { caughtType = ModContent.ItemType(); } - else if (player.cratePotion && astralFish <= 18 && astralFish >= 9) // 10% + else if (Player.cratePotion && astralFish <= 18 && astralFish >= 9) // 10% { caughtType = ModContent.ItemType(); } - else if (!player.cratePotion && astralFish <= 13 && astralFish >= 9) // 5% + else if (!Player.cratePotion && astralFish <= 13 && astralFish >= 9) // 5% { caughtType = ModContent.ItemType(); } @@ -402,11 +402,11 @@ namespace CalamityMod.CalPlayer { caughtType = ModContent.ItemType(); } - else if (player.cratePotion && sunkenFish <= 18 && sunkenFish >= 9) // 10% + else if (Player.cratePotion && sunkenFish <= 18 && sunkenFish >= 9) // 10% { caughtType = ModContent.ItemType(); } - else if (!player.cratePotion && sunkenFish <= 13 && sunkenFish >= 9) // 5% + else if (!Player.cratePotion && sunkenFish <= 13 && sunkenFish >= 9) // 5% { caughtType = ModContent.ItemType(); } @@ -433,7 +433,7 @@ namespace CalamityMod.CalPlayer } } - if (player.FindBuffIndex(BuffID.Gills) > -1 && CalamityWorld.downedCalamitas && Main.rand.NextBool(25)) + if (Player.FindBuffIndex(BuffID.Gills) > -1 && CalamityWorld.downedCalamitas && Main.rand.NextBool(25)) { caughtType = ModContent.ItemType(); } @@ -481,17 +481,17 @@ namespace CalamityMod.CalPlayer ModContent.ItemType() }); } - if (player.cratePotion && Main.rand.NextBool(5)) // 20% + if (Player.cratePotion && Main.rand.NextBool(5)) // 20% { caughtType = ModContent.ItemType(); } - else if (!player.cratePotion && Main.rand.NextBool(10)) // 10% + else if (!Player.cratePotion && Main.rand.NextBool(10)) // 10% { caughtType = ModContent.ItemType(); } } - if (player.ZoneOverworldHeight && Main.bloodMoon) + if (Player.ZoneOverworldHeight && Main.bloodMoon) { if (Main.rand.NextBool(25)) { @@ -521,11 +521,11 @@ namespace CalamityMod.CalPlayer { caughtType = ModContent.ItemType(); } - else if (player.cratePotion && cragFish <= 30 && cragFish >= 21) // 10% + else if (Player.cratePotion && cragFish <= 30 && cragFish >= 21) // 10% { caughtType = ModContent.ItemType(); } - else if (!player.cratePotion && cragFish <= 25 && cragFish >= 21) // 5% + else if (!Player.cratePotion && cragFish <= 25 && cragFish >= 21) // 5% { caughtType = ModContent.ItemType(); } @@ -555,14 +555,14 @@ namespace CalamityMod.CalPlayer { if ((ZoneAstral || ZoneAbyss || ZoneSulphur) && bait.type == ModContent.ItemType()) fishingLevel = (int)(fishingLevel * 1.1f); - if (player.ZoneSnow && fishingRod.type == ModContent.ItemType()) + if (Player.ZoneSnow && fishingRod.type == ModContent.ItemType()) fishingLevel = (int)(fishingLevel * 1.1f); - if (player.ZoneSkyHeight && fishingRod.type == ModContent.ItemType()) + if (Player.ZoneSkyHeight && fishingRod.type == ModContent.ItemType()) fishingLevel = (int)(fishingLevel * 1.1f); if (bait.type == ModContent.ItemType()) { - Point point = player.Center.ToTileCoordinates(); + Point point = Player.Center.ToTileCoordinates(); bool canSulphurFish = false; if (CalamityWorld.abyssSide) { @@ -578,7 +578,7 @@ namespace CalamityMod.CalPlayer if (ZoneAbyss || ZoneSulphur) canSulphurFish = true; - Item item = player.ActiveItem(); + Item item = Player.ActiveItem(); if (!canSulphurFish || item.fishingPole <= 0 || item.holdStyle != 1) fishingLevel = -1; } diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 89ad121928..5589aefa09 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -15,7 +15,7 @@ namespace CalamityMod.CalPlayer #region Update Bad Life Regen public override void UpdateBadLifeRegen() { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) noLifeRegen = true; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -27,39 +27,39 @@ namespace CalamityMod.CalPlayer // Initial Debuffs // Get fucked, Nebula Armor - player.nebulaLevelLife = 0; + Player.nebulaLevelLife = 0; // Vanilla if (death) { - if (player.poisoned) + if (Player.poisoned) lifeRegenLost += 4; - if (player.onFire) + if (Player.onFire) lifeRegenLost += 8; - if (player.tongued) + if (Player.tongued) lifeRegenLost += 100; - if (player.venom) + if (Player.venom) lifeRegenLost += 12; - if (player.onFrostBurn) + if (Player.onFrostBurn) lifeRegenLost += 12; - if (player.onFire2) + if (Player.onFire2) lifeRegenLost += 12; - if (player.burned) + if (Player.burned) lifeRegenLost += 60; - if (player.suffocating) + if (Player.suffocating) lifeRegenLost += 40; - if (player.electrified) + if (Player.electrified) { lifeRegenLost += 8; - if (player.controlLeft || player.controlRight) + if (Player.controlLeft || Player.controlRight) lifeRegenLost += 32; } } @@ -67,102 +67,102 @@ namespace CalamityMod.CalPlayer // Calamity if (shadowflame) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 30; } if (wDeath) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; } if (aFlames) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 16; } if (weakBrimstoneFlames) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 7; } if (bFlames) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += abaddon ? 8 : 16; } if (nightwither) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 16; } if (vaporfied) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 8; } if (cragsLava) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 30; } if (gsInferno) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += profanedCrystalBuffs ? 35 : 30; } if (astralInfection) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 20; } - if (ZoneSulphur && player.IsUnderwater() && !decayEffigy && !player.lavaWet && !player.honeyWet) + if (ZoneSulphur && Player.IsUnderwater() && !decayEffigy && !Player.lavaWet && !Player.honeyWet) { - player.AddBuff(ModContent.BuffType(), 2, true); + Player.AddBuff(ModContent.BuffType(), 2, true); pissWaterBoost++; - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; int waterDivisor = 250; int minimumRegenLost = 8; if (sulfurSet && sulphurskin) @@ -190,10 +190,10 @@ namespace CalamityMod.CalPlayer if (sulphurPoison) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 6; if (sulfurSet) { @@ -207,28 +207,28 @@ namespace CalamityMod.CalPlayer if (hFlames) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 16; } if (banishingFire) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 60; } if (waterLeechBleeding) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 6; if (CalamityWorld.downedAquaticScourge) lifeRegenLost += 6; @@ -238,55 +238,55 @@ namespace CalamityMod.CalPlayer if (pFlames) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += reducedPlagueDmg ? 10 : 20; } if (bBlood) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 8; } if (vHex) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 16; } if (dragonFire) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 18; } if (cDepth) { - if (player.statDefense > 0) + if (Player.statDefense > 0) { int depthDamage = depthCharm ? 9 : 18; - int subtractDefense = (int)(player.statDefense * 0.05); // 240 defense = 0 damage taken with depth charm + int subtractDefense = (int)(Player.statDefense * 0.05); // 240 defense = 0 damage taken with depth charm int calcDepthDamage = depthDamage - subtractDefense; if (calcDepthDamage < 0) calcDepthDamage = 0; - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += calcDepthDamage; } } @@ -393,30 +393,30 @@ namespace CalamityMod.CalPlayer if (alcoholPoisonLevel > 3) { - player.nebulaLevelLife = 0; + Player.nebulaLevelLife = 0; - if (player.whoAmI == Main.myPlayer) - player.AddBuff(ModContent.BuffType(), 2, false); + if (Player.whoAmI == Main.myPlayer) + Player.AddBuff(ModContent.BuffType(), 2, false); - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; lifeRegenLost += 3 * alcoholPoisonLevel; } if (manaOverloader) { - if (player.statMana > (int)(player.statManaMax2 * 0.5)) + if (Player.statMana > (int)(Player.statManaMax2 * 0.5)) lifeRegenLost += 3; } if (brimflameFrenzy) { - player.manaRegen = 0; - player.manaRegenBonus = 0; - player.manaRegenDelay = (int) player.maxRegenDelay; - if (player.lifeRegen > 0) - player.lifeRegen = 0; + Player.manaRegen = 0; + Player.manaRegenBonus = 0; + Player.manaRegenDelay = (int) Player.maxRegenDelay; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; lifeRegenLost += 42; //the meaning of death } @@ -430,8 +430,8 @@ namespace CalamityMod.CalPlayer else { lifeRegenLost += (int)(5D * Math.Pow(1.5D, witheredWeaponHoldTime / 87D)); - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; } } else @@ -439,51 +439,51 @@ namespace CalamityMod.CalPlayer if (ManaBurn) { - int debuffIndex = player.FindBuffIndex(ModContent.BuffType()); - float debuffIntensity = debuffIndex == -1 ? 0f : player.buffTime[debuffIndex] / (float)Player.manaSickTimeMax; + int debuffIndex = Player.FindBuffIndex(ModContent.BuffType()); + float debuffIntensity = debuffIndex == -1 ? 0f : Player.buffTime[debuffIndex] / (float)Player.manaSickTimeMax; lifeRegenLost += (int)(Math.Sqrt(debuffIntensity) * Math.Pow(6D, debuffIntensity + 1f)); - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; } - player.lifeRegen -= (int)(lifeRegenLost * lifeRegenMult); + Player.lifeRegen -= (int)(lifeRegenLost * lifeRegenMult); // Buffs if (divineBless) { - if (player.whoAmI == Main.myPlayer && player.miscCounter % 15 == 0) // Flat 4 health per second + if (Player.whoAmI == Main.myPlayer && Player.miscCounter % 15 == 0) // Flat 4 health per second { if (!noLifeRegen) - player.statLife += 1; + Player.statLife += 1; } } if (bloodfinBoost) { - if (player.lifeRegen < 0) + if (Player.lifeRegen < 0) { - if (player.lifeRegenTime < 1800) - player.lifeRegenTime = 1800; + if (Player.lifeRegenTime < 1800) + Player.lifeRegenTime = 1800; - player.lifeRegen += 10; + Player.lifeRegen += 10; } else { - player.lifeRegen += 5; - player.lifeRegenTime += 10; + Player.lifeRegen += 5; + Player.lifeRegenTime += 10; } if (bloodfinTimer > 0) bloodfinTimer--; - if (player.whoAmI == Main.myPlayer && bloodfinTimer <= 0) + if (Player.whoAmI == Main.myPlayer && bloodfinTimer <= 0) { bloodfinTimer = 30; - if (player.statLife < (int)(player.statLifeMax2 * 0.75) && !noLifeRegen) - player.statLife += 1; + if (Player.statLife < (int)(Player.statLifeMax2 * 0.75) && !noLifeRegen) + Player.statLife += 1; } } @@ -492,28 +492,28 @@ namespace CalamityMod.CalPlayer bool lesserEffect = false; for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; + int hasBuff = Player.buffType[l]; lesserEffect = CalamityLists.alcoholList.Contains(hasBuff); } int defenseBoost = astralArcanum ? 15 : 11; if (lesserEffect) { - player.lifeRegen += astralArcanum ? 2 : 1; - player.statDefense += defenseBoost; + Player.lifeRegen += astralArcanum ? 2 : 1; + Player.statDefense += defenseBoost; } else { - if (player.lifeRegen < 0) + if (Player.lifeRegen < 0) { - if (player.lifeRegenTime < 1800) - player.lifeRegenTime = 1800; + if (Player.lifeRegenTime < 1800) + Player.lifeRegenTime = 1800; - player.lifeRegen += astralArcanum ? 6 : 4; - player.statDefense += defenseBoost; + Player.lifeRegen += astralArcanum ? 6 : 4; + Player.statDefense += defenseBoost; } else - player.lifeRegen += astralArcanum ? 3 : 2; + Player.lifeRegen += astralArcanum ? 3 : 2; } } else if (crownJewel) @@ -521,24 +521,24 @@ namespace CalamityMod.CalPlayer bool lesserEffect = false; for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; + int hasBuff = Player.buffType[l]; lesserEffect = CalamityLists.alcoholList.Contains(hasBuff); } if (lesserEffect) - player.statDefense += 8; + Player.statDefense += 8; else { - if (player.lifeRegen < 0) + if (Player.lifeRegen < 0) { - if (player.lifeRegenTime < 1800) - player.lifeRegenTime = 1800; + if (Player.lifeRegenTime < 1800) + Player.lifeRegenTime = 1800; - player.lifeRegen += 4; - player.statDefense += 8; + Player.lifeRegen += 4; + Player.statDefense += 8; } else - player.lifeRegen += 2; + Player.lifeRegen += 2; } } @@ -546,60 +546,60 @@ namespace CalamityMod.CalPlayer if (noLifeRegen) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; - if (player.lifeRegenCount > 0) - player.lifeRegenCount = 0; + if (Player.lifeRegenCount > 0) + Player.lifeRegenCount = 0; } if (hInferno) { - player.nebulaLevelLife = 0; + Player.nebulaLevelLife = 0; hInfernoBoost++; - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; - player.lifeRegen -= (int)(hInfernoBoost * lifeRegenMult); + Player.lifeRegenTime = 0; + Player.lifeRegen -= (int)(hInfernoBoost * lifeRegenMult); - if (player.lifeRegen < -200) - player.lifeRegen = -200; + if (Player.lifeRegen < -200) + Player.lifeRegen = -200; } else hInfernoBoost = 0; if (ZoneAbyss) { - if (!player.IsUnderwater()) + if (!Player.IsUnderwater()) { - if (player.statLife > 100) + if (Player.statLife > 100) { - player.nebulaLevelLife = 0; + Player.nebulaLevelLife = 0; - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; - player.lifeRegen -= (int)(160D * lifeRegenMult); + Player.lifeRegenTime = 0; + Player.lifeRegen -= (int)(160D * lifeRegenMult); } } } if (weakPetrification) { - if (player.mount.Active) - player.mount.Dismount(player); + if (Player.mount.Active) + Player.mount.Dismount(Player); } - if (lol || (silvaCountdown > 0 && hasSilvaEffect && silvaSet) || (dashMod == 9 && player.dashDelay < 0)) + if (lol || (silvaCountdown > 0 && hasSilvaEffect && silvaSet) || (dashMod == 9 && Player.dashDelay < 0)) { - if (player.lifeRegen < 0) - player.lifeRegen = 0; + if (Player.lifeRegen < 0) + Player.lifeRegen = 0; } } #endregion @@ -608,111 +608,111 @@ namespace CalamityMod.CalPlayer public override void UpdateLifeRegen() { if (rum) - player.lifeRegen += 2; + Player.lifeRegen += 2; if (caribbeanRum) - player.lifeRegen += 2; + Player.lifeRegen += 2; if (aChicken) - player.lifeRegen += 1; + Player.lifeRegen += 1; if (cadence) - player.lifeRegen += 5; + Player.lifeRegen += 5; if (mushy) - player.lifeRegen += 1; + Player.lifeRegen += 1; if (permafrostsConcoction) { - if (player.statLife < actualMaxLife / 2) - player.lifeRegen++; - if (player.statLife < actualMaxLife / 4) - player.lifeRegen++; - if (player.statLife < actualMaxLife / 10) - player.lifeRegen += 2; + if (Player.statLife < actualMaxLife / 2) + Player.lifeRegen++; + if (Player.statLife < actualMaxLife / 4) + Player.lifeRegen++; + if (Player.statLife < actualMaxLife / 10) + Player.lifeRegen += 2; - if (player.poisoned || player.onFire || bFlames) - player.lifeRegen += 4; + if (Player.poisoned || Player.onFire || bFlames) + Player.lifeRegen += 4; } if (tRegen) - player.lifeRegen += 3; + Player.lifeRegen += 3; if (sRegen) - player.lifeRegen += 2; + Player.lifeRegen += 2; if (hallowedRegen) - player.lifeRegen += 3; + Player.lifeRegen += 3; if (affliction || afflicted) - player.lifeRegen += 1; + Player.lifeRegen += 1; if (absorber) { - if (player.StandingStill() && player.itemAnimation == 0) - player.lifeRegen += 4; + if (Player.StandingStill() && Player.itemAnimation == 0) + Player.lifeRegen += 4; } if (aAmpoule) { - player.lifeRegen += 4; + Player.lifeRegen += 4; } else if (rOoze) { if (!Main.dayTime) - player.lifeRegen += 4; + Player.lifeRegen += 4; } if (ursaSergeant) { - if (player.statLife <= (int)(actualMaxLife * 0.15)) + if (Player.statLife <= (int)(actualMaxLife * 0.15)) { - player.lifeRegen += 3; - player.lifeRegenTime += 3; + Player.lifeRegen += 3; + Player.lifeRegenTime += 3; } - else if (player.statLife <= (int)(actualMaxLife * 0.25)) + else if (Player.statLife <= (int)(actualMaxLife * 0.25)) { - player.lifeRegen += 2; - player.lifeRegenTime += 2; + Player.lifeRegen += 2; + Player.lifeRegenTime += 2; } - else if (player.statLife <= (int)(actualMaxLife * 0.5)) + else if (Player.statLife <= (int)(actualMaxLife * 0.5)) { - player.lifeRegen += 1; - player.lifeRegenTime += 1; + Player.lifeRegen += 1; + Player.lifeRegenTime += 1; } } if (polarisBoost) { - player.lifeRegen += 1; - player.lifeRegenTime += 1; + Player.lifeRegen += 1; + Player.lifeRegenTime += 1; } if (projRefRareLifeRegenCounter > 0) { - player.lifeRegenTime += 2; - player.lifeRegen += 2; + Player.lifeRegenTime += 2; + Player.lifeRegen += 2; } if (darkSunRing) { if (Main.eclipse || Main.dayTime) - player.lifeRegen += 3; + Player.lifeRegen += 3; } if (phantomicHeartRegen <= 720 && phantomicHeartRegen >= 600) { - player.lifeRegen += 2; + Player.lifeRegen += 2; if (Main.rand.NextBool(2)) { - int regen = Dust.NewDust(player.position, player.width, player.height, 5, 0f, 0f, 200, new Color(99, 54, 84), 2f); + int regen = Dust.NewDust(Player.position, Player.width, Player.height, 5, 0f, 0f, 200, new Color(99, 54, 84), 2f); Main.dust[regen].noGravity = true; Main.dust[regen].fadeIn = 1.3f; Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); Main.dust[regen].velocity = velocity; velocity.Normalize(); velocity *= 34f; - Main.dust[regen].position = player.Center - velocity; + Main.dust[regen].position = Player.Center - velocity; } } @@ -739,60 +739,60 @@ namespace CalamityMod.CalPlayer bool lesserEffect = false; for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; + int hasBuff = Player.buffType[l]; bool shouldAffect = CalamityLists.alcoholList.Contains(hasBuff); if (shouldAffect) lesserEffect = true; } - if (player.lifeRegen < 0) - player.lifeRegen += lesserEffect ? 1 : regenBoost; + if (Player.lifeRegen < 0) + Player.lifeRegen += lesserEffect ? 1 : regenBoost; } if (regenator) { - player.lifeRegenTime += 6; - player.lifeRegen += 12; + Player.lifeRegenTime += 6; + Player.lifeRegen += 12; } if (handWarmer && eskimoSet) { - player.lifeRegen += 2; + Player.lifeRegen += 2; } if (bloodPactBoost) { - player.lifeRegen += 2; + Player.lifeRegen += 2; } if (avertorBonus) { - player.lifeRegen += 4; + Player.lifeRegen += 4; } if (bloodflareSummon) { - if (player.statLife <= (int)(actualMaxLife * 0.5)) - player.lifeRegen += 2; + if (Player.statLife <= (int)(actualMaxLife * 0.5)) + Player.lifeRegen += 2; } if (fearmongerSet && fearmongerRegenFrames > 0) { - player.lifeRegen += 7; + Player.lifeRegen += 7; - if (player.lifeRegenTime < 1800) - player.lifeRegenTime = 1800; + if (Player.lifeRegenTime < 1800) + Player.lifeRegenTime = 1800; - player.lifeRegenTime += 4; + Player.lifeRegenTime += 4; } if (pinkCandle && !noLifeRegen) { // Every frame, add up 1/60th of the healing value (0.4% max HP per second) - pinkCandleHealFraction += player.statLifeMax2 * 0.004 / 60; + pinkCandleHealFraction += Player.statLifeMax2 * 0.004 / 60; if (pinkCandleHealFraction >= 1D) { pinkCandleHealFraction = 0D; - if (player.statLife < player.statLifeMax2) - player.statLife++; + if (Player.statLife < Player.statLifeMax2) + Player.statLife++; } } else @@ -802,8 +802,8 @@ namespace CalamityMod.CalPlayer { reaverRegenCooldown = 0; - if (player.statLife != player.statLifeMax2 && !noLifeRegen) - player.statLife += 1; + if (Player.statLife != Player.statLifeMax2 && !noLifeRegen) + Player.statLife += 1; } if (BloomStoneRegen) @@ -811,72 +811,72 @@ namespace CalamityMod.CalPlayer float dayTimeCompletion = !Main.dayTime ? 1f : (float)(Main.time / Main.dayLength); float regenBenefitFactor = MathHelper.SmoothStep(0.25f, 1f, Utils.InverseLerp(0f, 0.24f, dayTimeCompletion, true) * Utils.InverseLerp(1f, 0.76f, dayTimeCompletion, true)); - player.lifeRegen += (int)MathHelper.Lerp(2f, 6f, regenBenefitFactor); - player.lifeRegenTime += (int)MathHelper.Lerp(1f, 3f, regenBenefitFactor); + Player.lifeRegen += (int)MathHelper.Lerp(2f, 6f, regenBenefitFactor); + Player.lifeRegenTime += (int)MathHelper.Lerp(1f, 3f, regenBenefitFactor); } // Standing still healing bonuses (all exclusive with vanilla Shiny Stone) - if (!player.shinyStone) + if (!Player.shinyStone) { int lifeRegenTimeMaxBoost = areThereAnyDamnBosses ? 450 : 1800; int lifeRegenMaxBoost = areThereAnyDamnBosses ? 1 : 4; float lifeRegenLifeRegenTimeMaxBoost = areThereAnyDamnBosses ? 8f : 30f; - if (player.StandingStill() && player.itemAnimation == 0) + if (Player.StandingStill() && Player.itemAnimation == 0) { bool boostedRegen = false; bool noSunlight = false; if (shadeRegen) { boostedRegen = true; - if (player.lifeRegen > 0 && player.statLife < actualMaxLife) + if (Player.lifeRegen > 0 && Player.statLife < actualMaxLife) { - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(30)) + if (Main.rand.Next(30000) < Player.lifeRegenTime || Main.rand.NextBool(30)) { - int regen = Dust.NewDust(player.position, player.width, player.height, 173, 0f, 0f, 200, default, 1f); + int regen = Dust.NewDust(Player.position, Player.width, Player.height, 173, 0f, 0f, 200, default, 1f); Main.dust[regen].noGravity = true; Main.dust[regen].fadeIn = 1.3f; Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); Main.dust[regen].velocity = velocity; velocity.Normalize(); velocity *= 34f; - Main.dust[regen].position = player.Center - velocity; + Main.dust[regen].position = Player.Center - velocity; } } } else if (cFreeze) { boostedRegen = true; - if (player.lifeRegen > 0 && player.statLife < actualMaxLife) + if (Player.lifeRegen > 0 && Player.statLife < actualMaxLife) { - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(30)) + if (Main.rand.Next(30000) < Player.lifeRegenTime || Main.rand.NextBool(30)) { - int regen = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 0.75f); + int regen = Dust.NewDust(Player.position, Player.width, Player.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 0.75f); Main.dust[regen].noGravity = true; Main.dust[regen].fadeIn = 1.3f; Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); Main.dust[regen].velocity = velocity; velocity.Normalize(); velocity *= 34f; - Main.dust[regen].position = player.Center - velocity; + Main.dust[regen].position = Player.Center - velocity; } } } else if (draedonsHeart) { boostedRegen = true; - if (player.lifeRegen > 0 && player.statLife < actualMaxLife) + if (Player.lifeRegen > 0 && Player.statLife < actualMaxLife) { - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) + if (Main.rand.Next(30000) < Player.lifeRegenTime || Main.rand.NextBool(2)) { - int regen = Dust.NewDust(player.position, player.width, player.height, 107, 0f, 0f, 200, default, 1f); + int regen = Dust.NewDust(Player.position, Player.width, Player.height, 107, 0f, 0f, 200, default, 1f); Main.dust[regen].noGravity = true; Main.dust[regen].fadeIn = 1.3f; Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); Main.dust[regen].velocity = velocity; velocity.Normalize(); velocity *= 34f; - Main.dust[regen].position = player.Center - velocity; + Main.dust[regen].position = Player.Center - velocity; } } } @@ -885,18 +885,18 @@ namespace CalamityMod.CalPlayer boostedRegen = true; if (!Main.dayTime) noSunlight = true; - if (player.lifeRegen > 0 && player.statLife < actualMaxLife) + if (Player.lifeRegen > 0 && Player.statLife < actualMaxLife) { - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) + if (Main.rand.Next(30000) < Player.lifeRegenTime || Main.rand.NextBool(2)) { - int regen = Dust.NewDust(player.position, player.width, player.height, 244, 0f, 0f, 200, default, 1f); + int regen = Dust.NewDust(Player.position, Player.width, Player.height, 244, 0f, 0f, 200, default, 1f); Main.dust[regen].noGravity = true; Main.dust[regen].fadeIn = 1.3f; Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); Main.dust[regen].velocity = velocity; velocity.Normalize(); velocity *= 34f; - Main.dust[regen].position = player.Center - velocity; + Main.dust[regen].position = Player.Center - velocity; } } } @@ -906,53 +906,53 @@ namespace CalamityMod.CalPlayer int lifeRegenMaxBoost2 = !noSunlight ? lifeRegenMaxBoost : (lifeRegenMaxBoost / 5); float lifeRegenLifeRegenTimeMaxBoost2 = !noSunlight ? lifeRegenLifeRegenTimeMaxBoost : (lifeRegenLifeRegenTimeMaxBoost / 5); - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost2) - player.lifeRegenTime = lifeRegenTimeMaxBoost2; + if (Player.lifeRegenTime > 90 && Player.lifeRegenTime < lifeRegenTimeMaxBoost2) + Player.lifeRegenTime = lifeRegenTimeMaxBoost2; - player.lifeRegenTime += lifeRegenMaxBoost2; - player.lifeRegen += lifeRegenMaxBoost2; + Player.lifeRegenTime += lifeRegenMaxBoost2; + Player.lifeRegen += lifeRegenMaxBoost2; - float num3 = player.lifeRegenTime * 2.5f; // lifeRegenTime max is 3600 + float num3 = Player.lifeRegenTime * 2.5f; // lifeRegenTime max is 3600 num3 /= 300f; if (num3 > 0f) { if (num3 > lifeRegenLifeRegenTimeMaxBoost2) num3 = lifeRegenLifeRegenTimeMaxBoost2; - player.lifeRegen += (int)num3; + Player.lifeRegen += (int)num3; } - if (player.lifeRegen > 0 && player.statLife < actualMaxLife) + if (Player.lifeRegen > 0 && Player.statLife < actualMaxLife) { - player.lifeRegenCount++; + Player.lifeRegenCount++; } } } } // The Camper regen boost activates while moving so it can stack with Shiny Stone like effects - if (camper && player.statLife < actualMaxLife && !player.StandingStill()) + if (camper && Player.statLife < actualMaxLife && !Player.StandingStill()) { float camperRegenMult = areThereAnyDamnBosses ? 1.25f : 2f; int camperRegenCount = areThereAnyDamnBosses ? 1 : 4; - player.lifeRegen = (int)(player.lifeRegen * camperRegenMult); - player.lifeRegenCount += camperRegenCount; - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) + Player.lifeRegen = (int)(Player.lifeRegen * camperRegenMult); + Player.lifeRegenCount += camperRegenCount; + if (Main.rand.Next(30000) < Player.lifeRegenTime || Main.rand.NextBool(2)) { - int regen = Dust.NewDust(player.position, player.width, player.height, 12, 0f, 0f, 200, Color.OrangeRed, 1f); + int regen = Dust.NewDust(Player.position, Player.width, Player.height, 12, 0f, 0f, 200, Color.OrangeRed, 1f); Main.dust[regen].noGravity = true; Main.dust[regen].fadeIn = 1.3f; Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); Main.dust[regen].velocity = velocity; velocity.Normalize(); velocity *= 34f; - Main.dust[regen].position = player.Center - velocity; + Main.dust[regen].position = Player.Center - velocity; } } - if (player.statLife < actualMaxLife) + if (Player.statLife < actualMaxLife) { - bool noLifeRegenCap = (player.shinyStone || draedonsHeart || cFreeze || shadeRegen || photosynthesis || camper) && - player.StandingStill() && player.itemAnimation == 0; + bool noLifeRegenCap = (Player.shinyStone || draedonsHeart || cFreeze || shadeRegen || photosynthesis || camper) && + Player.StandingStill() && Player.itemAnimation == 0; if (!noLifeRegenCap) { @@ -960,12 +960,12 @@ namespace CalamityMod.CalPlayer // 350 HP = 1 - 0.875 * 10 = 1.25 = 1 // 100 HP = 1 - 0.25 * 10 = 7.5 = 7 // 200 HP = 1 - 0.5 * 10 = 5 - int lifeRegenScale = (int)((1f - (player.statLife / actualMaxLife)) * 10f); // 9 to 0 (1% HP to 100%) - if (player.lifeRegen > lifeRegenScale) + int lifeRegenScale = (int)((1f - (Player.statLife / actualMaxLife)) * 10f); // 9 to 0 (1% HP to 100%) + if (Player.lifeRegen > lifeRegenScale) { - float lifeRegenScalar = 1f + (player.statLife / actualMaxLife); // 1 to 2 (1% HP to 100%) - int defLifeRegen = (int)(player.lifeRegen / lifeRegenScalar); - player.lifeRegen = defLifeRegen; + float lifeRegenScalar = 1f + (Player.statLife / actualMaxLife); // 1 to 2 (1% HP to 100%) + int defLifeRegen = (int)(Player.lifeRegen / lifeRegenScalar); + Player.lifeRegen = defLifeRegen; } } } @@ -974,18 +974,18 @@ namespace CalamityMod.CalPlayer { if (CalamityConfig.Instance.BossRushHealthCurse) { - if (player.lifeRegen > 0) - player.lifeRegen = 0; + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; - player.lifeRegenTime = 0; + Player.lifeRegenTime = 0; - if (player.lifeRegenCount > 0) - player.lifeRegenCount = 0; + if (Player.lifeRegenCount > 0) + Player.lifeRegenCount = 0; } } // For the stat meter - lifeRegenStat = player.lifeRegen; + lifeRegenStat = Player.lifeRegen; } #endregion } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 548ab962e3..5918ef0598 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -51,6 +51,7 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence; +using Terraria.Audio; namespace CalamityMod.CalPlayer { @@ -62,8 +63,8 @@ namespace CalamityMod.CalPlayer // No category // Give the player a 24% jump speed boost while wings are equipped - if (player.wingsLogic > 0) - player.jumpSpeedBoost += 1.2f; + if (Player.wingsLogic > 0) + Player.jumpSpeedBoost += 1.2f; // Decrease the counter on Fearmonger set turbo regeneration if (fearmongerRegenFrames > 0) @@ -77,7 +78,7 @@ namespace CalamityMod.CalPlayer areThereAnyDamnBosses = CalamityUtils.AnyBossNPCS(); // Bool for any existing events, true if any event is active - areThereAnyDamnEvents = CalamityGlobalNPC.AnyEvents(player); + areThereAnyDamnEvents = CalamityGlobalNPC.AnyEvents(Player); // Hurt the nearest NPC to the mouse if using the burning mouse. if (blazingCursorDamage) @@ -134,7 +135,7 @@ namespace CalamityMod.CalPlayer GemTechState.Update(); // Regularly sync player stats & mouse control info during multiplayer - if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) + if (Player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) { packetTimer++; if (packetTimer == GlobalSyncPacketTimer) @@ -157,11 +158,11 @@ namespace CalamityMod.CalPlayer { // player.rangedCrit already contains the crit stat of the held item, no need to grab it separately. // Don't store the base 4% because you're not removing it. - spiritOriginConvertedCrit = player.rangedCrit - 4; - player.rangedCrit = 4; + spiritOriginConvertedCrit = Player.GetCritChance(DamageClass.Ranged) - 4; + Player.GetCritChance(DamageClass.Ranged) = 4; } - if (player.ActiveItem().type == ModContent.ItemType()) + if (Player.ActiveItem().type == ModContent.ItemType()) heldGaelsLastFrame = true; // De-equipping Gael's Greatsword deletes all rage. @@ -180,31 +181,31 @@ namespace CalamityMod.CalPlayer { // Adjusts the life steal cap in rev/death float lifeStealCap = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 30f : CalamityWorld.death ? 45f : 60f; - if (player.lifeSteal > lifeStealCap) - player.lifeSteal = lifeStealCap; + if (Player.lifeSteal > lifeStealCap) + Player.lifeSteal = lifeStealCap; - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { // Titanium Armor nerf - if (player.onHitDodge) + if (Player.onHitDodge) { for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] > 360 && hasBuff == BuffID.ShadowDodge) - player.buffTime[l] = 360; + int hasBuff = Player.buffType[l]; + if (Player.buffTime[l] > 360 && hasBuff == BuffID.ShadowDodge) + Player.buffTime[l] = 360; } } // Immunity Frames nerf int immuneTimeLimit = 150; - if (player.immuneTime > immuneTimeLimit) - player.immuneTime = immuneTimeLimit; + if (Player.immuneTime > immuneTimeLimit) + Player.immuneTime = immuneTimeLimit; - for (int k = 0; k < player.hurtCooldowns.Length; k++) + for (int k = 0; k < Player.hurtCooldowns.Length; k++) { - if (player.hurtCooldowns[k] > immuneTimeLimit) - player.hurtCooldowns[k] = immuneTimeLimit; + if (Player.hurtCooldowns[k] > immuneTimeLimit) + Player.hurtCooldowns[k] = immuneTimeLimit; } // Adrenaline and Rage @@ -214,7 +215,7 @@ namespace CalamityMod.CalPlayer } // If Revengeance Mode is not active, then set rippers to zero - else if (player.whoAmI == Main.myPlayer) + else if (Player.whoAmI == Main.myPlayer) { rage = 0; adrenaline = 0; @@ -289,7 +290,7 @@ namespace CalamityMod.CalPlayer // Take the longer of the two directions for the NPC's hitbox to be generous. float generousHitboxWidth = Math.Max(npc.Hitbox.Width / 2f, npc.Hitbox.Height / 2f); - float hitboxEdgeDist = npc.Distance(player.Center) - generousHitboxWidth; + float hitboxEdgeDist = npc.Distance(Player.Center) - generousHitboxWidth; // If this enemy is closer than the previous, reduce the current minimum proximity distance. if (enemyDistance > hitboxEdgeDist) @@ -368,7 +369,7 @@ namespace CalamityMod.CalPlayer if (playFullRageSound) { playFullRageSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/FullRage"), (int)player.position.X, (int)player.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/FullRage"), (int)Player.position.X, (int)Player.position.Y); } } else @@ -377,7 +378,7 @@ namespace CalamityMod.CalPlayer // This is how much Adrenaline will be changed by this frame. float adrenalineDiff = 0; bool SCalAlive = NPC.AnyNPCs(ModContent.NPCType()); - bool wofAndNotHell = Main.wof >= 0 && player.position.Y < (float)((Main.maxTilesY - 200) * 16); + bool wofAndNotHell = Main.wof >= 0 && Player.position.Y < (float)((Main.maxTilesY - 200) * 16); // If Adrenaline Mode is currently active, you smoothly lose all adrenaline over the duration. if (adrenalineModeActive) @@ -414,7 +415,7 @@ namespace CalamityMod.CalPlayer if (playFullAdrenalineSound) { playFullAdrenalineSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/FullAdrenaline"), (int)player.position.X, (int)player.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/FullAdrenaline"), (int)Player.position.X, (int)Player.position.Y); } } else @@ -431,11 +432,11 @@ namespace CalamityMod.CalPlayer // miscCounter is used to limit Calamity's hit rate. int framesPerHit = 60 / Calamity.HitsPerSecond; - if (player.miscCounter % framesPerHit != 1) + if (Player.miscCounter % framesPerHit != 1) return; Rectangle sigilHitbox = Utils.CenteredRectangle(Main.MouseWorld, new Vector2(35f, 62f)); - int sigilDamage = (int)(player.AverageDamage() * Calamity.BaseDamage); + int sigilDamage = (int)(Player.AverageDamage() * Calamity.BaseDamage); bool brightenedSigil = false; for (int i = 0; i < Main.maxNPCs; i++) { @@ -451,7 +452,7 @@ namespace CalamityMod.CalPlayer } // Create a direct strike to hit this specific NPC. - Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ModContent.ProjectileType(), sigilDamage, 0f, player.whoAmI, i); + Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ModContent.ProjectileType(), sigilDamage, 0f, Player.whoAmI, i); // Incinerate the target with Vulnerability Hex. target.AddBuff(ModContent.BuffType(), VulnerabilityHex.CalamityDuration); @@ -472,9 +473,9 @@ namespace CalamityMod.CalPlayer { // Do a vanity/social slot check for SCal's expert drop since alternatives to get this working are a pain in the ass to create. int blazingCursorItem = ModContent.ItemType(); - for (int i = 13; i < 18 + player.extraAccessorySlots; i++) + for (int i = 13; i < 18 + Player.extraAccessorySlots; i++) { - if (player.armor[i].type == blazingCursorItem) + if (Player.armor[i].type == blazingCursorItem) { blazingCursorVisuals = true; break; @@ -482,47 +483,47 @@ namespace CalamityMod.CalPlayer } // Calculate/reset DoG cart rotations based on whether the DoG cart is in use. - if (player.mount.Active && player.mount.Type == ModContent.MountType()) + if (Player.mount.Active && Player.mount.Type == ModContent.MountType()) { SmoothenedMinecartRotation = MathHelper.Lerp(SmoothenedMinecartRotation, DelegateMethods.Minecart.rotation, 0.05f); // Initialize segments from null if necessary. - int direction = (player.velocity.SafeNormalize(Vector2.UnitX * player.direction).X > 0f).ToDirectionInt(); - if (player.velocity.X == 0f) - direction = player.direction; + int direction = (Player.velocity.SafeNormalize(Vector2.UnitX * Player.direction).X > 0f).ToDirectionInt(); + if (Player.velocity.X == 0f) + direction = Player.direction; - float idealRotation = DoGCartMount.CalculateIdealWormRotation(player); + float idealRotation = DoGCartMount.CalculateIdealWormRotation(Player); float minecartRotation = DelegateMethods.Minecart.rotation; if (Math.Abs(minecartRotation) < 0.5f) minecartRotation = 0f; - Vector2 stickOffset = minecartRotation.ToRotationVector2() * player.velocity.Length() * direction * 1.25f; + Vector2 stickOffset = minecartRotation.ToRotationVector2() * Player.velocity.Length() * direction * 1.25f; for (int i = 0; i < DoGCartSegments.Length; i++) { if (DoGCartSegments[i] is null) { DoGCartSegments[i] = new DoGCartSegment { - Center = player.Center - idealRotation.ToRotationVector2() * i * 20f + Center = Player.Center - idealRotation.ToRotationVector2() * i * 20f }; } } - Vector2 startingStickPosition = player.Center + stickOffset + new Vector2(direction * (float)Math.Cos(SmoothenedMinecartRotation * 2f) * -34f, 12f); - DoGCartSegments[0].Update(player, startingStickPosition, idealRotation); + Vector2 startingStickPosition = Player.Center + stickOffset + new Vector2(direction * (float)Math.Cos(SmoothenedMinecartRotation * 2f) * -34f, 12f); + DoGCartSegments[0].Update(Player, startingStickPosition, idealRotation); DoGCartSegments[0].Center = startingStickPosition; for (int i = 1; i < DoGCartSegments.Length; i++) { - Vector2 waveOffset = DoGCartMount.CalculateSegmentWaveOffset(i, player); - DoGCartSegments[i].Update(player, DoGCartSegments[i - 1].Center + waveOffset, DoGCartSegments[i - 1].Rotation); + Vector2 waveOffset = DoGCartMount.CalculateSegmentWaveOffset(i, Player); + DoGCartSegments[i].Update(Player, DoGCartSegments[i - 1].Center + waveOffset, DoGCartSegments[i - 1].Rotation); } } else DoGCartSegments = new DoGCartSegment[DoGCartSegments.Length]; // Dust on hand when holding the phosphorescent gauntlet. - if (player.ActiveItem().type == ModContent.ItemType()) - PhosphorescentGauntletPunches.GenerateDustOnOwnerHand(player); + if (Player.ActiveItem().type == ModContent.ItemType()) + PhosphorescentGauntletPunches.GenerateDustOnOwnerHand(Player); if (stealthUIAlpha > 0f && (rogueStealth <= 0f || rogueStealthMax <= 0f)) { @@ -536,18 +537,18 @@ namespace CalamityMod.CalPlayer } if (andromedaState == AndromedaPlayerState.LargeRobot || - player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { - player.controlHook = player.releaseHook = false; + Player.controlHook = Player.releaseHook = false; } if (andromedaCripple > 0) { - player.velocity = Vector2.Clamp(player.velocity, new Vector2(-11f, -8f), new Vector2(11f, 8f)); + Player.velocity = Vector2.Clamp(Player.velocity, new Vector2(-11f, -8f), new Vector2(11f, 8f)); andromedaCripple--; } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && andromedaState != AndromedaPlayerState.Inactive) { andromedaState = AndromedaPlayerState.Inactive; @@ -555,22 +556,22 @@ namespace CalamityMod.CalPlayer if (andromedaState == AndromedaPlayerState.LargeRobot) { - player.width = 80; - player.height = 212; - player.position.Y -= 170; + Player.width = 80; + Player.height = 212; + Player.position.Y -= 170; resetHeightandWidth = true; } else if (andromedaState == AndromedaPlayerState.SpecialAttack) { - player.width = 24; - player.height = 98; - player.position.Y -= 56; + Player.width = 24; + Player.height = 98; + Player.position.Y -= 56; resetHeightandWidth = true; } - else if (!player.mount.Active && resetHeightandWidth) + else if (!Player.mount.Active && resetHeightandWidth) { - player.width = 20; - player.height = 42; + Player.width = 20; + Player.height = 42; resetHeightandWidth = false; } @@ -581,7 +582,7 @@ namespace CalamityMod.CalPlayer List alreadyTargetedNPCs = new List(); for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].type != bullseyeType || !Main.projectile[i].active || Main.projectile[i].owner != player.whoAmI) + if (Main.projectile[i].type != bullseyeType || !Main.projectile[i].active || Main.projectile[i].owner != Player.whoAmI) continue; alreadyTargetedNPCs.Add((int)Main.projectile[i].ai[0]); @@ -592,8 +593,8 @@ namespace CalamityMod.CalPlayer if (!Main.npc[i].active || Main.npc[i].friendly || Main.npc[i].lifeMax < 5 || alreadyTargetedNPCs.Contains(i) || Main.npc[i].realLife >= 0 || Main.npc[i].dontTakeDamage || Main.npc[i].immortal) continue; - if (Main.myPlayer == player.whoAmI && Main.npc[i].WithinRange(player.Center, 2000f)) - Projectile.NewProjectile(Main.npc[i].Center, Vector2.Zero, bullseyeType, 0, 0f, player.whoAmI, i); + if (Main.myPlayer == Player.whoAmI && Main.npc[i].WithinRange(Player.Center, 2000f)) + Projectile.NewProjectile(Main.npc[i].Center, Vector2.Zero, bullseyeType, 0, 0f, Player.whoAmI, i); if (spiritOriginBullseyeShootCountdown <= 0) spiritOriginBullseyeShootCountdown = 45; } @@ -604,7 +605,7 @@ namespace CalamityMod.CalPlayer GetExactLevelUp(); // Max mana bonuses - player.statManaMax2 += + Player.statManaMax2 += (permafrostsConcoction ? 50 : 0) + (pHeart ? 50 : 0) + (eCore ? 50 : 0) + @@ -618,39 +619,39 @@ namespace CalamityMod.CalPlayer // Death Mode recovery rate is 0.25/s // Malice Mode recovery rate is 0.2/s float lifeStealCooldown = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 0.3f : CalamityWorld.death ? 0.25f : CalamityWorld.revenge ? 0.2f : Main.expertMode ? 0.15f : 0.1f; - player.lifeSteal -= lifeStealCooldown; + Player.lifeSteal -= lifeStealCooldown; // Nebula Armor nerf - if (player.nebulaLevelMana > 0 && player.statMana < player.statManaMax2) + if (Player.nebulaLevelMana > 0 && Player.statMana < Player.statManaMax2) { int num = 12; - nebulaManaNerfCounter += player.nebulaLevelMana; + nebulaManaNerfCounter += Player.nebulaLevelMana; if (nebulaManaNerfCounter >= num) { nebulaManaNerfCounter -= num; - player.statMana--; - if (player.statMana < 0) - player.statMana = 0; + Player.statMana--; + if (Player.statMana < 0) + Player.statMana = 0; } } else nebulaManaNerfCounter = 0; // Bool for drawing boss health bar small text or not - if (Main.myPlayer == player.whoAmI) + if (Main.myPlayer == Player.whoAmI) BossHealthBarManager.CanDrawExtraSmallText = shouldDrawSmallText; // Margarita halved debuff duration if (margarita) { - if (Main.myPlayer == player.whoAmI) + if (Main.myPlayer == Player.whoAmI) { for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff)) + int hasBuff = Player.buffType[l]; + if (Player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff)) { - player.buffTime[l]--; + Player.buffTime[l]--; } } } @@ -675,7 +676,7 @@ namespace CalamityMod.CalPlayer if (!Main.rand.NextBool(3)) continue; - Dust holyCinder = Dust.NewDustDirect(player.position, player.width, player.head, (int)CalamityDusts.ProfanedFire); + Dust holyCinder = Dust.NewDustDirect(Player.position, Player.width, Player.head, (int)CalamityDusts.ProfanedFire); holyCinder.velocity = Main.rand.NextVector2Circular(3.5f, 3.5f); holyCinder.velocity.Y -= Main.rand.NextFloat(1f, 3f); holyCinder.scale = Main.rand.NextFloat(1.15f, 1.45f); @@ -689,63 +690,63 @@ namespace CalamityMod.CalPlayer if (invincible) { foreach (int debuff in CalamityLists.debuffList) - player.buffImmune[debuff] = true; + Player.buffImmune[debuff] = true; } // Transformer immunity to Electrified if (aSparkRare) - player.buffImmune[BuffID.Electrified] = true; + Player.buffImmune[BuffID.Electrified] = true; // Reduce breath meter while in icy water instead of chilling - bool canBreath = (sirenBoobs && NPC.downedBoss3) || player.gills || player.merman; - if (player.arcticDivingGear || canBreath) + bool canBreath = (sirenBoobs && NPC.downedBoss3) || Player.gills || Player.merman; + if (Player.arcticDivingGear || canBreath) { - player.buffImmune[ModContent.BuffType()] = true; + Player.buffImmune[ModContent.BuffType()] = true; } if (CalamityConfig.Instance.ReworkChilledWater) { - if (Main.expertMode && player.ZoneSnow && player.wet && !player.lavaWet && !player.honeyWet) + if (Main.expertMode && Player.ZoneSnow && Player.wet && !Player.lavaWet && !Player.honeyWet) { - player.buffImmune[BuffID.Chilled] = true; - if (player.IsUnderwater()) + Player.buffImmune[BuffID.Chilled] = true; + if (Player.IsUnderwater()) { - if (Main.myPlayer == player.whoAmI) + if (Main.myPlayer == Player.whoAmI) { - player.AddBuff(ModContent.BuffType(), 2, false); + Player.AddBuff(ModContent.BuffType(), 2, false); } } } if (iCantBreathe) { - if (player.breath > 0) - player.breath--; + if (Player.breath > 0) + Player.breath--; } } // Extra DoT in the lava of the crags. Negated by Abaddon. - if (player.lavaWet) + if (Player.lavaWet) { if (ZoneCalamity && !abaddon) - player.AddBuff(ModContent.BuffType(), 2, false); + Player.AddBuff(ModContent.BuffType(), 2, false); } else { - if (player.lavaImmune) + if (Player.lavaImmune) { - if (player.lavaTime < player.lavaMax) - player.lavaTime++; + if (Player.lavaTime < Player.lavaMax) + Player.lavaTime++; } } // Acid rain droplets - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { - if (CalamityWorld.rainingAcid && ZoneSulphur && !areThereAnyDamnBosses && player.Center.Y < Main.worldSurface * 16f + 800f) + if (CalamityWorld.rainingAcid && ZoneSulphur && !areThereAnyDamnBosses && Player.Center.Y < Main.worldSurface * 16f + 800f) { int slimeRainRate = (int)(MathHelper.Clamp(Main.invasionSize * 0.4f, 13.5f, 50) * 2.25); - Vector2 spawnPoint = new Vector2(player.Center.X + Main.rand.Next(-1000, 1001), player.Center.Y - Main.rand.Next(700, 801)); + Vector2 spawnPoint = new Vector2(Player.Center.X + Main.rand.Next(-1000, 1001), Player.Center.Y - Main.rand.Next(700, 801)); - if (player.miscCounter % slimeRainRate == 0f) + if (Player.miscCounter % slimeRainRate == 0f) { if (CalamityWorld.downedAquaticScourge && !CalamityWorld.downedPolterghast && Main.rand.NextBool(12)) { @@ -756,17 +757,17 @@ namespace CalamityMod.CalPlayer } // Hydrothermal blue smoke effects but it doesn't work epicccccc - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { if (hydrothermalSmoke) { - if (Math.Abs(player.velocity.X) > 0.1f || Math.Abs(player.velocity.Y) > 0.1f) + if (Math.Abs(Player.velocity.X) > 0.1f || Math.Abs(Player.velocity.Y) > 0.1f) { - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI); } } // Trying to find a workaround because apparently putting the bool in ResetEffects prevents it from working - if (!player.armorEffectDrawOutlines) + if (!Player.armorEffectDrawOutlines) { hydrothermalSmoke = false; } @@ -776,29 +777,29 @@ namespace CalamityMod.CalPlayer caveDarkness = 0f; if (CalamityWorld.death) { - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { // Thorn and spike effects // 10 = crimson/corruption thorns, 17 = jungle thorns, 40 = dungeon spikes, 60 = temple spikes Vector2 tileType; - if (!player.mount.Active || !player.mount.Cart) - tileType = Collision.HurtTiles(player.position, player.velocity, player.width, player.height, player.fireWalk); + if (!Player.mount.Active || !Player.mount.Cart) + tileType = Collision.HurtTiles(Player.position, Player.velocity, Player.width, Player.height, Player.fireWalk); else - tileType = Collision.HurtTiles(player.position, player.velocity, player.width, player.height - 16, player.fireWalk); + tileType = Collision.HurtTiles(Player.position, Player.velocity, Player.width, Player.height - 16, Player.fireWalk); switch ((int)tileType.Y) { case 10: - player.AddBuff(BuffID.Weak, 300, false); - player.AddBuff(BuffID.Bleeding, 300, false); + Player.AddBuff(BuffID.Weak, 300, false); + Player.AddBuff(BuffID.Bleeding, 300, false); break; case 17: - player.AddBuff(BuffID.Poisoned, 300, false); + Player.AddBuff(BuffID.Poisoned, 300, false); break; case 40: - player.AddBuff(BuffID.Bleeding, 300, false); + Player.AddBuff(BuffID.Bleeding, 300, false); break; case 60: - player.AddBuff(BuffID.Venom, 300, false); + Player.AddBuff(BuffID.Venom, 300, false); break; default: break; @@ -807,25 +808,25 @@ namespace CalamityMod.CalPlayer } // Increase fall speed - if (!player.mount.Active) + if (!Player.mount.Active) { - if (player.IsUnderwater() && ironBoots) - player.maxFallSpeed = 9f; + if (Player.IsUnderwater() && ironBoots) + Player.maxFallSpeed = 9f; - if (!player.wet) + if (!Player.wet) { if (cirrusDress) - player.maxFallSpeed = 12f; + Player.maxFallSpeed = 12f; if (aeroSet) - player.maxFallSpeed = 15f; - if (gSabatonFall > 0 || player.PortalPhysicsEnabled) - player.maxFallSpeed = 20f; + Player.maxFallSpeed = 15f; + if (gSabatonFall > 0 || Player.PortalPhysicsEnabled) + Player.maxFallSpeed = 20f; } if (LungingDown) { - player.maxFallSpeed = 80f; - player.noFallDmg = true; + Player.maxFallSpeed = 80f; + Player.noFallDmg = true; } } @@ -833,7 +834,7 @@ namespace CalamityMod.CalPlayer if (omegaBlueSet) { // Add tentacles - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 6 && Main.myPlayer == player.whoAmI) + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 6 && Main.myPlayer == Player.whoAmI) { bool[] tentaclesPresent = new bool[6]; for (int i = 0; i < Main.maxProjectiles; i++) @@ -847,9 +848,9 @@ namespace CalamityMod.CalPlayer { if (!tentaclesPresent[i]) { - int damage = (int)(390 * player.AverageDamage()); + int damage = (int)(390 * Player.AverageDamage()); Vector2 vel = new Vector2(Main.rand.Next(-13, 14), Main.rand.Next(-13, 14)) * 0.25f; - Projectile.NewProjectile(player.Center, vel, ModContent.ProjectileType(), damage, 8f, Main.myPlayer, Main.rand.Next(120), i); + Projectile.NewProjectile(Player.Center, vel, ModContent.ProjectileType(), damage, 8f, Main.myPlayer, Main.rand.Next(120), i); } } } @@ -861,18 +862,18 @@ namespace CalamityMod.CalPlayer damageUp *= 2f; critUp *= 2; } - player.allDamage += damageUp; + Player.allDamage += damageUp; AllCritBoost(critUp); } bool canProvideBuffs = profanedCrystalBuffs || (!profanedCrystal && pArtifact) || (profanedCrystal && CalamityWorld.downedSCal && CalamityWorld.downedExoMechs); - bool attack = player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + bool attack = Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; // Guardian bonuses if not burnt out - if (canProvideBuffs && !player.HasCooldown(Cooldowns.ProfanedSoulArtifact.ID)) + if (canProvideBuffs && !Player.HasCooldown(Cooldowns.ProfanedSoulArtifact.ID)) { - bool healer = player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; - bool defend = player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + bool healer = Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + bool defend = Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; if (healer) { if (healCounter > 0) @@ -880,65 +881,65 @@ namespace CalamityMod.CalPlayer if (healCounter <= 0) { - bool enrage = player.statLife < (int)(player.statLifeMax2 * 0.5); + bool enrage = Player.statLife < (int)(Player.statLifeMax2 * 0.5); healCounter = (!enrage && profanedCrystalBuffs) ? 360 : 300; - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { int healAmount = 5 + (defend ? 5 : 0) + (attack ? 5 : 0); - player.statLife += healAmount; - player.HealEffect(healAmount); + Player.statLife += healAmount; + Player.HealEffect(healAmount); } } } if (defend) { - player.moveSpeed += 0.05f + + Player.moveSpeed += 0.05f + (attack ? 0.05f : 0f); - player.endurance += 0.025f + + Player.endurance += 0.025f + (attack ? 0.025f : 0f); } if (attack) { - player.minionDamage += 0.1f + + Player.GetDamage(DamageClass.Summon) += 0.1f + (defend ? 0.05f : 0f); } } // You always get the max minions, even during the effect of the burnout debuff if (attack && canProvideBuffs) - player.maxMinions++; + Player.maxMinions++; if (nucleogenesis) { - player.maxMinions += 4; + Player.maxMinions += 4; } else { // First Shadowflame is +1, Statis' Blessing is +2, Statis' Curse inherits both for +3 if (shadowMinions) - player.maxMinions ++; + Player.maxMinions ++; if (holyMinions) - player.maxMinions += 2; + Player.maxMinions += 2; if (starTaintedGenerator) - player.maxMinions += 2; + Player.maxMinions += 2; else { if (starbusterCore) - player.maxMinions++; + Player.maxMinions++; if (voltaicJelly) - player.maxMinions++; + Player.maxMinions++; if (nuclearRod) - player.maxMinions++; + Player.maxMinions++; } } @@ -965,7 +966,7 @@ namespace CalamityMod.CalPlayer if (instance.timeLeft < 0) { handler.OnCompleted(); - Main.PlaySound(handler.EndSound); + SoundEngine.PlaySound(handler.EndSound); expiredCooldowns.Add(id); } } @@ -1039,7 +1040,7 @@ namespace CalamityMod.CalPlayer hurtSoundTimer--; if (icicleCooldown > 0) icicleCooldown--; - if (statisTimer > 0 && player.dashDelay >= 0) + if (statisTimer > 0 && Player.dashDelay >= 0) statisTimer = 0; if (hallowedRuneCooldown > 0) hallowedRuneCooldown--; @@ -1070,24 +1071,24 @@ namespace CalamityMod.CalPlayer else { persecutedEnchantSummonTimer = 0; - if (Main.myPlayer == player.whoAmI && persecutedEnchant && NPC.CountNPCS(ModContent.NPCType()) < 2) + if (Main.myPlayer == Player.whoAmI && persecutedEnchant && NPC.CountNPCS(ModContent.NPCType()) < 2) { int tries = 0; Vector2 spawnPosition; do { - spawnPosition = player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(270f, 420f); + spawnPosition = Player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(270f, 420f); tries++; } while (Collision.SolidCollision(spawnPosition - Vector2.One * 24f, 48, 24) && tries < 100); - CalamityNetcode.NewNPC_ClientSide(spawnPosition, ModContent.NPCType(), player); + CalamityNetcode.NewNPC_ClientSide(spawnPosition, ModContent.NPCType(), Player); } } - if (player.miscCounter % 20 == 0) + if (Player.miscCounter % 20 == 0) canFireAtaxiaRangedProjectile = true; - if (player.miscCounter % 100 == 0) + if (Player.miscCounter % 100 == 0) canFireBloodflareMageProjectile = true; - if (player.miscCounter % 150 == 0) + if (Player.miscCounter % 150 == 0) { canFireGodSlayerRangedProjectile = true; canFireBloodflareRangedProjectile = true; @@ -1123,20 +1124,20 @@ namespace CalamityMod.CalPlayer adamantiteSetDefenseBoostInterpolant = 0f; // God Slayer Armor dash debuff immunity - if (dashMod == 9 && player.dashDelay < 0) + if (dashMod == 9 && Player.dashDelay < 0) { foreach (int debuff in CalamityLists.debuffList) - player.buffImmune[debuff] = true; + Player.buffImmune[debuff] = true; } // Auric dye cinders. - int auricDyeCount = player.dye.Count(dyeItem => dyeItem.type == ModContent.ItemType()); + int auricDyeCount = Player.dye.Count(dyeItem => dyeItem.type == ModContent.ItemType()); if (auricDyeCount > 0) { int sparkCreationChance = (int)MathHelper.Lerp(15f, 50f, Utils.InverseLerp(4f, 1f, auricDyeCount, true)); if (Main.rand.NextBool(sparkCreationChance)) { - Dust spark = Dust.NewDustDirect(player.position, player.width, player.height, 267); + Dust spark = Dust.NewDustDirect(Player.position, Player.width, Player.height, 267); spark.color = Color.Lerp(Color.Cyan, Color.SeaGreen, Main.rand.NextFloat(0.5f)); spark.velocity = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2 * 1.33f) * Main.rand.NextFloat(2f, 5.4f); spark.noGravity = true; @@ -1147,29 +1148,29 @@ namespace CalamityMod.CalPlayer if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) { foreach (int debuff in CalamityLists.debuffList) - player.buffImmune[debuff] = true; + Player.buffImmune[debuff] = true; silvaCountdown -= 1; if (silvaCountdown <= 0) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/SilvaDispel"), player.Center); - player.AddCooldown(SilvaRevive.ID, CalamityUtils.SecondsToFrames(5 * 60)); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AbilitySounds/SilvaDispel"), Player.Center); + Player.AddCooldown(SilvaRevive.ID, CalamityUtils.SecondsToFrames(5 * 60)); } for (int j = 0; j < 2; j++) { - int green = Dust.NewDust(player.position, player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); + int green = Dust.NewDust(Player.position, Player.width, Player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); Main.dust[green].position.X += (float)Main.rand.Next(-20, 21); Main.dust[green].position.Y += (float)Main.rand.Next(-20, 21); Main.dust[green].velocity *= 0.9f; Main.dust[green].noGravity = true; Main.dust[green].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[green].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + Main.dust[green].shader = GameShaders.Armor.GetSecondaryShader(Player.cWaist, Player); if (Main.rand.NextBool(2)) Main.dust[green].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; } } - if (!player.HasCooldown(SilvaRevive.ID) && hasSilvaEffect && silvaCountdown <= 0 && !areThereAnyDamnBosses && !areThereAnyDamnEvents) + if (!Player.HasCooldown(SilvaRevive.ID) && hasSilvaEffect && silvaCountdown <= 0 && !areThereAnyDamnBosses && !areThereAnyDamnEvents) { silvaCountdown = 480; hasSilvaEffect = false; @@ -1182,20 +1183,20 @@ namespace CalamityMod.CalPlayer if (tarraDefenseTime <= 0) { tarraDefenseTime = 600; - if (player.whoAmI == Main.myPlayer) - player.AddCooldown(Cooldowns.TarragonCloak.ID, CalamityUtils.SecondsToFrames(30)); + if (Player.whoAmI == Main.myPlayer) + Player.AddCooldown(Cooldowns.TarragonCloak.ID, CalamityUtils.SecondsToFrames(30)); } for (int j = 0; j < 2; j++) { - int green = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); + int green = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y), Player.width, Player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); Dust dust = Main.dust[green]; dust.position.X += (float)Main.rand.Next(-20, 21); dust.position.Y += (float)Main.rand.Next(-20, 21); dust.velocity *= 0.9f; dust.noGravity = true; dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + dust.shader = GameShaders.Armor.GetSecondaryShader(Player.cWaist, Player); if (Main.rand.NextBool(2)) dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; } @@ -1206,22 +1207,22 @@ namespace CalamityMod.CalPlayer { // The iframes from the evasion are disabled by dodge disabling effects. if (tarragonImmunity && !disableAllDodges) - player.GiveIFrames(2, true); + Player.GiveIFrames(2, true); if (tarraThrowingCrits >= 25) { tarraThrowingCrits = 0; - if (player.whoAmI == Main.myPlayer && !disableAllDodges) - player.AddBuff(ModContent.BuffType(), 180, false); + if (Player.whoAmI == Main.myPlayer && !disableAllDodges) + Player.AddBuff(ModContent.BuffType(), 180, false); } for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] <= 2 && hasBuff == ModContent.BuffType()) - if (player.whoAmI == Main.myPlayer) - player.AddCooldown(Cooldowns.TarragonImmunity.ID, CalamityUtils.SecondsToFrames(25)); + int hasBuff = Player.buffType[l]; + if (Player.buffTime[l] <= 2 && hasBuff == ModContent.BuffType()) + if (Player.whoAmI == Main.myPlayer) + Player.AddCooldown(Cooldowns.TarragonImmunity.ID, CalamityUtils.SecondsToFrames(25)); bool shouldAffect = CalamityLists.debuffList.Contains(hasBuff); if (shouldAffect) @@ -1242,32 +1243,32 @@ namespace CalamityMod.CalPlayer if (bloodflareMeleeHits >= 15) { bloodflareMeleeHits = 0; - if (player.whoAmI == Main.myPlayer) - player.AddBuff(ModContent.BuffType(), 302, false); + if (Player.whoAmI == Main.myPlayer) + Player.AddBuff(ModContent.BuffType(), 302, false); } if (bloodflareFrenzy) { for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] <= 2 && hasBuff == ModContent.BuffType() && player.whoAmI == Main.myPlayer) - player.AddCooldown(BloodflareFrenzy.ID, CalamityUtils.SecondsToFrames(30)); + int hasBuff = Player.buffType[l]; + if (Player.buffTime[l] <= 2 && hasBuff == ModContent.BuffType() && Player.whoAmI == Main.myPlayer) + Player.AddCooldown(BloodflareFrenzy.ID, CalamityUtils.SecondsToFrames(30)); } - player.meleeCrit += 25; - player.meleeDamage += 0.25f; + Player.GetCritChance(DamageClass.Melee) += 25; + Player.GetDamage(DamageClass.Melee) += 0.25f; for (int j = 0; j < 2; j++) { - int blood = Dust.NewDust(player.position, player.width, player.height, DustID.Blood, 0f, 0f, 100, default, 2f); + int blood = Dust.NewDust(Player.position, Player.width, Player.height, DustID.Blood, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[blood]; dust.position.X += (float)Main.rand.Next(-20, 21); dust.position.Y += (float)Main.rand.Next(-20, 21); dust.velocity *= 0.9f; dust.noGravity = true; dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + dust.shader = GameShaders.Armor.GetSecondaryShader(Player.cWaist, Player); if (Main.rand.NextBool(2)) dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; } @@ -1284,48 +1285,48 @@ namespace CalamityMod.CalPlayer } if (kamiBoost) - player.allDamage += 0.15f; + Player.allDamage += 0.15f; if (avertorBonus) - player.allDamage += 0.1f; + Player.allDamage += 0.1f; if (roverDriveTimer < 616) { - player.statDefense += 15; + Player.statDefense += 15; if (roverDriveTimer > 606) - player.statDefense -= roverDriveTimer - 606; //so it scales down when the shield dies + Player.statDefense -= roverDriveTimer - 606; //so it scales down when the shield dies } // Absorber bonus if (absorber) { - player.moveSpeed += 0.05f; - player.jumpSpeedBoost += 0.25f; - player.thorns += 0.5f; - player.endurance += sponge ? 0.15f : 0.1f; + Player.moveSpeed += 0.05f; + Player.jumpSpeedBoost += 0.25f; + Player.thorns += 0.5f; + Player.endurance += sponge ? 0.15f : 0.1f; - if (player.StandingStill() && player.itemAnimation == 0) - player.manaRegenBonus += 4; + if (Player.StandingStill() && Player.itemAnimation == 0) + Player.manaRegenBonus += 4; } // Sea Shell bonus if (seaShell) { - if (player.IsUnderwater()) + if (Player.IsUnderwater()) { - player.statDefense += 3; - player.endurance += 0.05f; - player.moveSpeed += 0.1f; - player.ignoreWater = true; + Player.statDefense += 3; + Player.endurance += 0.05f; + Player.moveSpeed += 0.1f; + Player.ignoreWater = true; } } // Affliction bonus if (affliction || afflicted) { - player.endurance += 0.07f; - player.statDefense += 13; - player.allDamage += 0.1f; + Player.endurance += 0.07f; + Player.statDefense += 13; + Player.allDamage += 0.1f; } // Ambrosial Ampoule bonus and other light-granting bonuses @@ -1338,10 +1339,10 @@ namespace CalamityMod.CalPlayer } if (aAmpoule) { - player.endurance += 0.07f; - player.buffImmune[BuffID.Frozen] = true; - player.buffImmune[BuffID.Chilled] = true; - player.buffImmune[BuffID.Frostburn] = true; + Player.endurance += 0.07f; + Player.buffImmune[BuffID.Frozen] = true; + Player.buffImmune[BuffID.Chilled] = true; + Player.buffImmune[BuffID.Frostburn] = true; } if (cFreeze) { @@ -1373,30 +1374,30 @@ namespace CalamityMod.CalPlayer light[1] += 0.7f; light[2] += 0.2f; } - Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), light[0], light[1], light[2]); + Lighting.AddLight((int)(Player.Center.X / 16f), (int)(Player.Center.Y / 16f), light[0], light[1], light[2]); // Blazing Core bonus if (blazingCore) - player.endurance += 0.1f; + Player.endurance += 0.1f; //Permafrost's Concoction bonuses/debuffs if (permafrostsConcoction) - player.manaCost *= 0.85f; + Player.manaCost *= 0.85f; if (encased) { - player.statDefense += 30; - player.frozen = true; - player.velocity.X = 0f; - player.velocity.Y = -0.4f; //should negate gravity + Player.statDefense += 30; + Player.frozen = true; + Player.velocity.X = 0f; + Player.velocity.Y = -0.4f; //should negate gravity - int ice = Dust.NewDust(player.position, player.width, player.height, 88); + int ice = Dust.NewDust(Player.position, Player.width, Player.height, 88); Main.dust[ice].noGravity = true; Main.dust[ice].velocity *= 2f; - player.buffImmune[BuffID.Frozen] = true; - player.buffImmune[BuffID.Chilled] = true; - player.buffImmune[ModContent.BuffType()] = true; + Player.buffImmune[BuffID.Frozen] = true; + Player.buffImmune[BuffID.Chilled] = true; + Player.buffImmune[ModContent.BuffType()] = true; } // Cosmic Discharge Cosmic Freeze buff, gives surrounding enemies the Glacial State debuff @@ -1404,7 +1405,7 @@ namespace CalamityMod.CalPlayer { int buffType = ModContent.BuffType(); float freezeDist = 200f; - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { if (Main.rand.NextBool(5)) { @@ -1413,7 +1414,7 @@ namespace CalamityMod.CalPlayer NPC npc = Main.npc[l]; if (!npc.active || npc.friendly || npc.damage <= 0 || npc.dontTakeDamage) continue; - if (!npc.buffImmune[buffType] && Vector2.Distance(player.Center, npc.Center) <= freezeDist) + if (!npc.buffImmune[buffType] && Vector2.Distance(Player.Center, npc.Center) <= freezeDist) { if (npc.FindBuffIndex(buffType) == -1) npc.AddBuff(buffType, 60, false); @@ -1426,28 +1427,28 @@ namespace CalamityMod.CalPlayer // Remove Purified Jam and Lul accessory thorn damage exploits if (invincible || lol) { - player.thorns = 0f; - player.turtleThorns = false; + Player.thorns = 0f; + Player.turtleThorns = false; } // Vortex Armor nerf - if (player.vortexStealthActive) + if (Player.vortexStealthActive) { - player.rangedDamage -= (1f - player.stealth) * 0.4f; // Change 80 to 40 - player.rangedCrit -= (int)((1f - player.stealth) * 5f); // Change 20 to 15 + Player.GetDamage(DamageClass.Ranged) -= (1f - Player.stealth) * 0.4f; // Change 80 to 40 + Player.GetCritChance(DamageClass.Ranged) -= (int)((1f - Player.stealth) * 5f); // Change 20 to 15 } // Polaris fish stuff if (polarisBoost) { - player.endurance += 0.01f; - player.statDefense += 2; + Player.endurance += 0.01f; + Player.statDefense += 2; } - if (!polarisBoost || player.ActiveItem().type != ModContent.ItemType()) + if (!polarisBoost || Player.ActiveItem().type != ModContent.ItemType()) { polarisBoost = false; - if (player.FindBuffIndex(ModContent.BuffType()) > -1) - player.ClearBuff(ModContent.BuffType()); + if (Player.FindBuffIndex(ModContent.BuffType()) > -1) + Player.ClearBuff(ModContent.BuffType()); polarisBoostCounter = 0; polarisBoostTwo = false; @@ -1463,7 +1464,7 @@ namespace CalamityMod.CalPlayer // Calcium Potion buff if (calcium) - player.noFallDmg = true; + Player.noFallDmg = true; // Ceaseless Hunger Potion buff if (ceaselessHunger) @@ -1471,12 +1472,12 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < Main.maxItems; j++) { Item item = Main.item[j]; - if (item.active && item.noGrabDelay == 0 && item.owner == player.whoAmI) + if (item.active && item.noGrabDelay == 0 && item.owner == Player.whoAmI) { item.beingGrabbed = true; - if (player.Center.X > item.Center.X) + if (Player.Center.X > item.Center.X) { - if (item.velocity.X < 90f + player.velocity.X) + if (item.velocity.X < 90f + Player.velocity.X) { item.velocity.X += 9f; } @@ -1487,7 +1488,7 @@ namespace CalamityMod.CalPlayer } else { - if (item.velocity.X > -90f + player.velocity.X) + if (item.velocity.X > -90f + Player.velocity.X) { item.velocity.X -= 9f; } @@ -1497,7 +1498,7 @@ namespace CalamityMod.CalPlayer } } - if (player.Center.Y > item.Center.Y) + if (Player.Center.Y > item.Center.Y) { if (item.velocity.Y < 90f) { @@ -1524,11 +1525,11 @@ namespace CalamityMod.CalPlayer } // Plagued Fuel Pack and Blunder Booster effects - if (jetPackDash > 0 && player.whoAmI == Main.myPlayer) + if (jetPackDash > 0 && Player.whoAmI == Main.myPlayer) { int velocityAmt = blunderBooster ? 35 : 25; int velocityMult = jetPackDash > 1 ? velocityAmt : 5; - player.velocity = new Vector2(jetPackDirection, -1) * velocityMult; + Player.velocity = new Vector2(jetPackDirection, -1) * velocityMult; if (blunderBooster) { @@ -1538,7 +1539,7 @@ namespace CalamityMod.CalPlayer Vector2 lightningVel = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); lightningVel.Normalize(); lightningVel *= Main.rand.NextFloat(1f, 2f); - int projectile = Projectile.NewProjectile(player.Center, lightningVel, ModContent.ProjectileType(), (int)(30 * player.RogueDamage()), 0, player.whoAmI, Main.rand.Next(2), 0f); + int projectile = Projectile.NewProjectile(Player.Center, lightningVel, ModContent.ProjectileType(), (int)(30 * Player.RogueDamage()), 0, Player.whoAmI, Main.rand.Next(2), 0f); Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); if (projectile.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile].Calamity().forceTypeless = true; @@ -1546,7 +1547,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < 3; i++) { - int dust = Dust.NewDust(player.Center, 1, 1, 60, player.velocity.X * -0.1f, player.velocity.Y * -0.1f, 100, default, 3.5f); + int dust = Dust.NewDust(Player.Center, 1, 1, 60, Player.velocity.X * -0.1f, Player.velocity.Y * -0.1f, 100, default, 3.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; @@ -1560,7 +1561,7 @@ namespace CalamityMod.CalPlayer Vector2 cloudVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); cloudVelocity.Normalize(); cloudVelocity *= Main.rand.NextFloat(0f, 1f); - int projectile = Projectile.NewProjectile(player.Center, cloudVelocity, ModContent.ProjectileType(), (int)(20 * player.RogueDamage()), 0, player.whoAmI, 0, 0); + int projectile = Projectile.NewProjectile(Player.Center, cloudVelocity, ModContent.ProjectileType(), (int)(20 * Player.RogueDamage()), 0, Player.whoAmI, 0, 0); Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); if (projectile.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile].Calamity().forceTypeless = true; @@ -1568,7 +1569,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < 3; i++) { - int dust = Dust.NewDust(player.Center, 1, 1, 89, player.velocity.X * -0.1f, player.velocity.Y * -0.1f, 100, default, 3.5f); + int dust = Dust.NewDust(Player.Center, 1, 1, 89, Player.velocity.X * -0.1f, Player.velocity.Y * -0.1f, 100, default, 3.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; @@ -1577,23 +1578,23 @@ namespace CalamityMod.CalPlayer } // Gravistar Sabaton effects - if (gSabaton && player.whoAmI == Main.myPlayer) + if (gSabaton && Player.whoAmI == Main.myPlayer) { - if (gSabatonCooldown <= 0 && !player.mount.Active) + if (gSabatonCooldown <= 0 && !Player.mount.Active) { - if (player.controlDown && player.releaseDown && player.position.Y != player.oldPosition.Y) + if (Player.controlDown && Player.releaseDown && Player.position.Y != Player.oldPosition.Y) { gSabatonFall = 300; gSabatonCooldown = 480; //8 second cooldown - player.gravity *= 2f; - Projectile.NewProjectile(player.Center.X, player.Center.Y + (player.height / 5f), player.velocity.X, player.velocity.Y, ModContent.ProjectileType(), 0, 0, player.whoAmI); + Player.gravity *= 2f; + Projectile.NewProjectile(Player.Center.X, Player.Center.Y + (Player.height / 5f), Player.velocity.X, Player.velocity.Y, ModContent.ProjectileType(), 0, 0, Player.whoAmI); } } if (gSabatonCooldown == 1) //dust when ready to use again { for (int i = 0; i < 66; i++) { - int d = Dust.NewDust(player.position, player.width, player.height, Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(), 0, 0, 100, default, 2.6f); + int d = Dust.NewDust(Player.position, Player.width, Player.height, Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(), 0, 0, 100, default, 2.6f); Main.dust[d].noGravity = true; Main.dust[d].noLight = true; Main.dust[d].fadeIn = 1f; @@ -1606,32 +1607,32 @@ namespace CalamityMod.CalPlayer if (!brimflameSet && brimflameFrenzy) { brimflameFrenzy = false; - player.ClearBuff(ModContent.BuffType()); - player.AddCooldown(BrimflameFrenzy.ID, BrimflameScowl.CooldownLength); + Player.ClearBuff(ModContent.BuffType()); + Player.AddCooldown(BrimflameFrenzy.ID, BrimflameScowl.CooldownLength); } if (!bloodflareMelee && bloodflareFrenzy) { bloodflareFrenzy = false; - player.ClearBuff(ModContent.BuffType()); - player.AddCooldown(BloodflareFrenzy.ID, CalamityUtils.SecondsToFrames(30)); + Player.ClearBuff(ModContent.BuffType()); + Player.AddCooldown(BloodflareFrenzy.ID, CalamityUtils.SecondsToFrames(30)); } if (!tarraMelee && tarragonCloak) { tarragonCloak = false; - player.ClearBuff(ModContent.BuffType()); - player.AddCooldown(Cooldowns.TarragonCloak.ID, CalamityUtils.SecondsToFrames(30)); + Player.ClearBuff(ModContent.BuffType()); + Player.AddCooldown(Cooldowns.TarragonCloak.ID, CalamityUtils.SecondsToFrames(30)); } if (!tarraThrowing && tarragonImmunity) { tarragonImmunity = false; - player.ClearBuff(ModContent.BuffType()); - player.AddCooldown(Cooldowns.TarragonImmunity.ID, CalamityUtils.SecondsToFrames(25)); + Player.ClearBuff(ModContent.BuffType()); + Player.AddCooldown(Cooldowns.TarragonImmunity.ID, CalamityUtils.SecondsToFrames(25)); } bool hasOmegaBlueCooldown = cooldowns.TryGetValue(OmegaBlue.ID, out CooldownInstance omegaBlueCD); if (!omegaBlueSet && hasOmegaBlueCooldown && omegaBlueCD.timeLeft > 1500) { - player.ClearBuff(ModContent.BuffType()); + Player.ClearBuff(ModContent.BuffType()); omegaBlueCD.timeLeft = 1500; } @@ -1642,20 +1643,20 @@ namespace CalamityMod.CalPlayer if (!prismaticSet && prismaticLasers > 1800) { prismaticLasers = 1800; - player.AddCooldown(PrismaticLaser.ID, 1800); + Player.AddCooldown(PrismaticLaser.ID, 1800); } if (!angelicAlliance && divineBless) { divineBless = false; - player.ClearBuff(ModContent.BuffType()); - player.AddCooldown(Cooldowns.DivineBless.ID, CalamityUtils.SecondsToFrames(60)); + Player.ClearBuff(ModContent.BuffType()); + Player.AddCooldown(Cooldowns.DivineBless.ID, CalamityUtils.SecondsToFrames(60)); } // Armageddon's Dodge Disable feature puts Shadow Dodge/Holy Protection on permanent cooldown if (disableAllDodges) { - if (player.shadowDodgeTimer < 2) - player.shadowDodgeTimer = 2; + if (Player.shadowDodgeTimer < 2) + Player.shadowDodgeTimer = 2; } } #endregion @@ -1668,10 +1669,10 @@ namespace CalamityMod.CalPlayer if (ZoneAbyss) { - if (Main.myPlayer == player.whoAmI) + if (Main.myPlayer == Player.whoAmI) { // Abyss depth variables - Point point = player.Center.ToTileCoordinates(); + Point point = Player.Center.ToTileCoordinates(); double abyssSurface = Main.rockLayer - Main.maxTilesY * 0.05; double abyssLevel1 = Main.rockLayer + Main.maxTilesY * 0.03; double totalAbyssDepth = Main.maxTilesY - 250D - abyssSurface; @@ -1724,7 +1725,7 @@ namespace CalamityMod.CalPlayer caveDarkness = darknessStrength * multiplier; // Nebula Headcrab darkness effect - if (!player.headcovered) + if (!Player.headcovered) { float screenObstructionAmt = MathHelper.Clamp(caveDarkness, 0f, 0.95f); float targetValue = MathHelper.Clamp(screenObstructionAmt * 0.7f, 0.1f, 0.3f); @@ -1736,11 +1737,11 @@ namespace CalamityMod.CalPlayer // Breath Loss Multiplier, depending on gear double breathLossMult = 1D - - (player.gills ? 0.2 : 0D) - // 0.8 - (player.accDivingHelm ? 0.25 : 0D) - // 0.75 - (player.arcticDivingGear ? 0.25 : 0D) - // 0.75 + (Player.gills ? 0.2 : 0D) - // 0.8 + (Player.accDivingHelm ? 0.25 : 0D) - // 0.75 + (Player.arcticDivingGear ? 0.25 : 0D) - // 0.75 (aquaticEmblem ? 0.25 : 0D) - // 0.75 - (player.accMerman ? 0.3 : 0D) - // 0.7 + (Player.accMerman ? 0.3 : 0D) - // 0.7 (victideSet ? 0.2 : 0D) - // 0.85 ((sirenBoobs && NPC.downedBoss3) ? 0.3 : 0D) - // 0.7 (abyssalDivingSuit ? 0.3 : 0D); // 0.7 @@ -1769,7 +1770,7 @@ namespace CalamityMod.CalPlayer defenseLoss = (int)(defenseLoss * 0.6f); // Reduce defense - player.statDefense -= defenseLoss; + Player.statDefense -= defenseLoss; // Stat Meter stat abyssDefenseLossStat = defenseLoss; @@ -1777,17 +1778,17 @@ namespace CalamityMod.CalPlayer // Bleed effect based on abyss layer if (ZoneAbyssLayer4) { - player.bleed = true; + Player.bleed = true; } else if (ZoneAbyssLayer3) { if (!abyssalDivingSuit) - player.bleed = true; + Player.bleed = true; } else if (ZoneAbyssLayer2) { if (!depthCharm) - player.bleed = true; + Player.bleed = true; } // Ticks (frames) until breath is deducted from the breath meter @@ -1799,12 +1800,12 @@ namespace CalamityMod.CalPlayer // Tick (frame) multiplier, depending on gear double tickMult = 1D + - (player.gills ? 4D : 0D) + // 5 - (player.ignoreWater ? 5D : 0D) + // 10 - (player.accDivingHelm ? 10D : 0D) + // 20 - (player.arcticDivingGear ? 10D : 0D) + // 30 + (Player.gills ? 4D : 0D) + // 5 + (Player.ignoreWater ? 5D : 0D) + // 10 + (Player.accDivingHelm ? 10D : 0D) + // 20 + (Player.arcticDivingGear ? 10D : 0D) + // 30 (aquaticEmblem ? 10D : 0D) + // 40 - (player.accMerman ? 15D : 0D) + // 55 + (Player.accMerman ? 15D : 0D) + // 55 (victideSet ? 5D : 0D) + // 60 ((sirenBoobs && NPC.downedBoss3) ? 15D : 0D) + // 75 (abyssalDivingSuit ? 15D : 0D); // 90 @@ -1827,15 +1828,15 @@ namespace CalamityMod.CalPlayer abyssBreathCD = 0; // Reduce breath - if (player.breath > 0) - player.breath -= (int)(cDepth ? breathLoss + 1D : breathLoss); + if (Player.breath > 0) + Player.breath -= (int)(cDepth ? breathLoss + 1D : breathLoss); } // If breath is greater than 0 and player has gills or is merfolk, balance out the effects by reducing breath - if (player.breath > 0) + if (Player.breath > 0) { - if (player.gills || player.merman) - player.breath -= 3; + if (Player.gills || Player.merman) + Player.breath -= 3; } // Life loss at zero breath @@ -1857,13 +1858,13 @@ namespace CalamityMod.CalPlayer abyssLifeLostAtZeroBreathStat = lifeLossAtZeroBreath; // Check breath value - if (player.breath <= 0) + if (Player.breath <= 0) { // Reduce life - player.statLife -= lifeLossAtZeroBreath; + Player.statLife -= lifeLossAtZeroBreath; // Special kill code if the life loss kills the player - if (player.statLife <= 0) + if (Player.statLife <= 0) { abyssDeath = true; KillPlayer(); @@ -1920,16 +1921,16 @@ namespace CalamityMod.CalPlayer private void MaxLifeAndManaEffects() { // New textures - if (Main.netMode != NetmodeID.Server && player.whoAmI == Main.myPlayer) + if (Main.netMode != NetmodeID.Server && Player.whoAmI == Main.myPlayer) { - Texture2D rain3 = ModContent.GetTexture("CalamityMod/ExtraTextures/Rain3"); - Texture2D rainOriginal = ModContent.GetTexture("CalamityMod/ExtraTextures/RainOriginal"); - Texture2D mana2 = ModContent.GetTexture("CalamityMod/ExtraTextures/Mana2"); - Texture2D mana3 = ModContent.GetTexture("CalamityMod/ExtraTextures/Mana3"); - Texture2D mana4 = ModContent.GetTexture("CalamityMod/ExtraTextures/Mana4"); - Texture2D manaOriginal = ModContent.GetTexture("CalamityMod/ExtraTextures/ManaOriginal"); - Texture2D carpetAuric = ModContent.GetTexture("CalamityMod/ExtraTextures/AuricCarpet"); - Texture2D carpetOriginal = ModContent.GetTexture("CalamityMod/ExtraTextures/Carpet"); + Texture2D rain3 = ModContent.Request("CalamityMod/ExtraTextures/Rain3"); + Texture2D rainOriginal = ModContent.Request("CalamityMod/ExtraTextures/RainOriginal"); + Texture2D mana2 = ModContent.Request("CalamityMod/ExtraTextures/Mana2"); + Texture2D mana3 = ModContent.Request("CalamityMod/ExtraTextures/Mana3"); + Texture2D mana4 = ModContent.Request("CalamityMod/ExtraTextures/Mana4"); + Texture2D manaOriginal = ModContent.Request("CalamityMod/ExtraTextures/ManaOriginal"); + Texture2D carpetAuric = ModContent.Request("CalamityMod/ExtraTextures/AuricCarpet"); + Texture2D carpetOriginal = ModContent.Request("CalamityMod/ExtraTextures/Carpet"); int totalManaBoost = (pHeart ? 1 : 0) + @@ -1977,17 +1978,17 @@ namespace CalamityMod.CalPlayer { if (trinketOfChiBuff) { - player.allDamage += 0.5f; - if (player.itemAnimation > 0) + Player.allDamage += 0.5f; + if (Player.itemAnimation > 0) chiBuffTimer = 0; } - if (player.StandingStill(0.1f) && !player.mount.Active) + if (Player.StandingStill(0.1f) && !Player.mount.Active) { if (chiBuffTimer < 60) chiBuffTimer++; else - player.AddBuff(ModContent.BuffType(), 6); + Player.AddBuff(ModContent.BuffType(), 6); } else chiBuffTimer--; @@ -1998,8 +1999,8 @@ namespace CalamityMod.CalPlayer // Aquatic Emblem bonus if (aquaticEmblem) { - if (player.IsUnderwater() && player.wet && !player.lavaWet && !player.honeyWet && - !player.mount.Active) + if (Player.IsUnderwater() && Player.wet && !Player.lavaWet && !Player.honeyWet && + !Player.mount.Active) { if (aquaticBoost > 0f) { @@ -2008,7 +2009,7 @@ namespace CalamityMod.CalPlayer { aquaticBoost = 0f; if (Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.PlayerStealth, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.PlayerStealth, -1, -1, null, Player.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } } @@ -2017,12 +2018,12 @@ namespace CalamityMod.CalPlayer aquaticBoost += 2f; if (aquaticBoost > aquaticBoostMax) aquaticBoost = aquaticBoostMax; - if (player.mount.Active) + if (Player.mount.Active) aquaticBoost = aquaticBoostMax; } - player.statDefense += (int)((1f - aquaticBoost * 0.0001f) * 50f); - player.moveSpeed -= (1f - aquaticBoost * 0.0001f) * 0.1f; + Player.statDefense += (int)((1f - aquaticBoost * 0.0001f) * 50f); + Player.moveSpeed -= (1f - aquaticBoost * 0.0001f) * 0.1f; } else aquaticBoost = aquaticBoostMax; @@ -2030,10 +2031,10 @@ namespace CalamityMod.CalPlayer // Auric bonus if (auricBoost) { - if (player.itemAnimation > 0) + if (Player.itemAnimation > 0) modStealthTimer = 5; - if (player.StandingStill(0.1f) && !player.mount.Active) + if (Player.StandingStill(0.1f) && !Player.mount.Active) { if (modStealthTimer == 0 && modStealth > 0f) { @@ -2042,22 +2043,22 @@ namespace CalamityMod.CalPlayer { modStealth = 0f; if (Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.PlayerStealth, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.PlayerStealth, -1, -1, null, Player.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } } else { - float playerVel = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); + float playerVel = Math.Abs(Player.velocity.X) + Math.Abs(Player.velocity.Y); modStealth += playerVel * 0.0075f; if (modStealth > 1f) modStealth = 1f; - if (player.mount.Active) + if (Player.mount.Active) modStealth = 1f; } float damageBoost = (1f - modStealth) * 0.2f; - player.allDamage += damageBoost; + Player.allDamage += damageBoost; int critBoost = (int)((1f - modStealth) * 10f); AllCritBoost(critBoost); @@ -2069,10 +2070,10 @@ namespace CalamityMod.CalPlayer // Psychotic Amulet bonus else if (pAmulet) { - if (player.itemAnimation > 0) + if (Player.itemAnimation > 0) modStealthTimer = 5; - if (player.StandingStill(0.1f) && !player.mount.Active) + if (Player.StandingStill(0.1f) && !Player.mount.Active) { if (modStealthTimer == 0 && modStealth > 0f) { @@ -2081,30 +2082,30 @@ namespace CalamityMod.CalPlayer { modStealth = 0f; if (Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.PlayerStealth, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.PlayerStealth, -1, -1, null, Player.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } } else { - float playerVel = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); + float playerVel = Math.Abs(Player.velocity.X) + Math.Abs(Player.velocity.Y); modStealth += playerVel * 0.0075f; if (modStealth > 1f) modStealth = 1f; - if (player.mount.Active) + if (Player.mount.Active) modStealth = 1f; } throwingDamage += (1f - modStealth) * 0.2f; throwingCrit += (int)((1f - modStealth) * 10f); - player.aggro -= (int)((1f - modStealth) * 750f); + Player.aggro -= (int)((1f - modStealth) * 750f); if (modStealthTimer > 0) modStealthTimer--; } else modStealth = 1f; - if (player.ActiveItem().type == ModContent.ItemType() && player.StandingStill(0.1f)) + if (Player.ActiveItem().type == ModContent.ItemType() && Player.StandingStill(0.1f)) { if (auralisStealthCounter < 300f) auralisStealthCounter++; @@ -2112,7 +2113,7 @@ namespace CalamityMod.CalPlayer bool usingScope = false; if (!Main.gameMenu && Main.netMode != NetmodeID.Server) { - if (player.noThrow <= 0 && !player.lastMouseInterface || (Main.zoomX != 0f || Main.zoomY != 0f)) + if (Player.noThrow <= 0 && !Player.lastMouseInterface || (Main.zoomX != 0f || Main.zoomY != 0f)) { if (PlayerInput.UsingGamepad) { @@ -2156,9 +2157,9 @@ namespace CalamityMod.CalPlayer int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { - Vector2 source = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 1f; //0.75 - source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + player.Center; - Vector2 dustVel = source - player.Center; + Vector2 source = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 1f; //0.75 + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; + Vector2 dustVel = source - Player.Center; int blue = Dust.NewDust(source + dustVel, 0, 0, 229, dustVel.X, dustVel.Y, 100, default, 1.2f); Main.dust[blue].noGravity = true; Main.dust[blue].noLight = false; @@ -2166,9 +2167,9 @@ namespace CalamityMod.CalPlayer } for (int d = 0; d < dustAmt; d++) { - Vector2 source = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + player.Center; - Vector2 dustVel = source - player.Center; + Vector2 source = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; + Vector2 dustVel = source - Player.Center; int green = Dust.NewDust(source + dustVel, 0, 0, 107, dustVel.X, dustVel.Y, 100, default, 1.2f); Main.dust[green].noGravity = true; Main.dust[green].noLight = false; @@ -2190,8 +2191,8 @@ namespace CalamityMod.CalPlayer // Activate buff if (elysianGuard) { - if (player.whoAmI == Main.myPlayer) - player.AddBuff(ModContent.BuffType(), 2, false); + if (Player.whoAmI == Main.myPlayer) + Player.AddBuff(ModContent.BuffType(), 2, false); float shieldBoostInitial = shieldInvinc; shieldInvinc -= 0.08f; @@ -2201,19 +2202,19 @@ namespace CalamityMod.CalPlayer spawnDust = true; if (shieldInvinc == 0f && shieldBoostInitial != shieldInvinc && Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.PlayerStealth, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.PlayerStealth, -1, -1, null, Player.whoAmI, 0f, 0f, 0f, 0, 0, 0); float damageBoost = (5f - shieldInvinc) * 0.03f; - player.allDamage += damageBoost; + Player.allDamage += damageBoost; int critBoost = (int)((5f - shieldInvinc) * 2f); AllCritBoost(critBoost); - player.aggro += (int)((5f - shieldInvinc) * 220f); - player.statDefense += (int)((5f - shieldInvinc) * 8f); - player.moveSpeed *= 0.85f; + Player.aggro += (int)((5f - shieldInvinc) * 220f); + Player.statDefense += (int)((5f - shieldInvinc) * 8f); + Player.moveSpeed *= 0.85f; - if (player.mount.Active) + if (Player.mount.Active) elysianGuard = false; } @@ -2228,7 +2229,7 @@ namespace CalamityMod.CalPlayer spawnDust = true; if (shieldInvinc == 5f && shieldBoostInitial != shieldInvinc && Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.PlayerStealth, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.PlayerStealth, -1, -1, null, Player.whoAmI, 0f, 0f, 0f, 0, 0, 0); } // Emit dust @@ -2237,9 +2238,9 @@ namespace CalamityMod.CalPlayer if (Main.rand.NextBool(2)) { Vector2 vector = Vector2.UnitY.RotatedByRandom(Math.PI * 2D); - Dust dust = Main.dust[Dust.NewDust(player.Center - vector * 30f, 0, 0, (int)CalamityDusts.ProfanedFire, 0f, 0f, 0, default, 1f)]; + Dust dust = Main.dust[Dust.NewDust(Player.Center - vector * 30f, 0, 0, (int)CalamityDusts.ProfanedFire, 0f, 0f, 0, default, 1f)]; dust.noGravity = true; - dust.position = player.Center - vector * (float)Main.rand.Next(5, 11); + dust.position = Player.Center - vector * (float)Main.rand.Next(5, 11); dust.velocity = vector.RotatedBy(Math.PI / 2D, default) * 4f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; @@ -2248,9 +2249,9 @@ namespace CalamityMod.CalPlayer if (Main.rand.NextBool(2)) { Vector2 vector2 = Vector2.UnitY.RotatedByRandom(Math.PI * 2D); - Dust dust2 = Main.dust[Dust.NewDust(player.Center - vector2 * 30f, 0, 0, 246, 0f, 0f, 0, default, 1f)]; + Dust dust2 = Main.dust[Dust.NewDust(Player.Center - vector2 * 30f, 0, 0, 246, 0f, 0f, 0, default, 1f)]; dust2.noGravity = true; - dust2.position = player.Center - vector2 * 12f; + dust2.position = Player.Center - vector2 * 12f; dust2.velocity = vector2.RotatedBy(-Math.PI / 2D, default) * 2f; dust2.scale = 0.5f + Main.rand.NextFloat(); dust2.fadeIn = 0.5f; @@ -2267,18 +2268,18 @@ namespace CalamityMod.CalPlayer { if (gravityNormalizer) { - player.buffImmune[BuffID.VortexDebuff] = true; - if (player.InSpace()) + Player.buffImmune[BuffID.VortexDebuff] = true; + if (Player.InSpace()) { - player.gravity = Player.defaultGravity; - if (player.wet) + Player.gravity = Player.defaultGravity; + if (Player.wet) { - if (player.honeyWet) - player.gravity = 0.1f; - else if (player.merman) - player.gravity = 0.3f; + if (Player.honeyWet) + Player.gravity = 0.1f; + else if (Player.merman) + Player.gravity = 0.3f; else - player.gravity = 0.2f; + Player.gravity = 0.2f; } } } @@ -2286,77 +2287,77 @@ namespace CalamityMod.CalPlayer // Effigy of Decay effects if (decayEffigy) { - player.buffImmune[ModContent.BuffType()] = true; + Player.buffImmune[ModContent.BuffType()] = true; if (!ZoneAbyss) { - player.gills = true; + Player.gills = true; } } // Cobalt armor set effects. if (CobaltSet) - CobaltArmorSetChange.ApplyMovementSpeedBonuses(player); + CobaltArmorSetChange.ApplyMovementSpeedBonuses(Player); // Adamantite armor set effects. if (AdamantiteSet) - player.statDefense += AdamantiteSetDefenseBoost; + Player.statDefense += AdamantiteSetDefenseBoost; if (astralInjection) { - if (player.statMana < player.statManaMax2) - player.statMana += 3; - if (player.statMana > player.statManaMax2) - player.statMana = player.statManaMax2; + if (Player.statMana < Player.statManaMax2) + Player.statMana += 3; + if (Player.statMana > Player.statManaMax2) + Player.statMana = Player.statManaMax2; } if (armorCrumbling) { throwingCrit += 5; - player.meleeCrit += 5; + Player.GetCritChance(DamageClass.Melee) += 5; } if (armorShattering) { - if (player.FindBuffIndex(ModContent.BuffType()) > -1) - player.ClearBuff(ModContent.BuffType()); + if (Player.FindBuffIndex(ModContent.BuffType()) > -1) + Player.ClearBuff(ModContent.BuffType()); throwingDamage += 0.08f; - player.meleeDamage += 0.08f; + Player.GetDamage(DamageClass.Melee) += 0.08f; throwingCrit += 8; - player.meleeCrit += 8; + Player.GetCritChance(DamageClass.Melee) += 8; } if (holyWrath) { - if (player.FindBuffIndex(BuffID.Wrath) > -1) - player.ClearBuff(BuffID.Wrath); - player.allDamage += 0.12f; + if (Player.FindBuffIndex(BuffID.Wrath) > -1) + Player.ClearBuff(BuffID.Wrath); + Player.allDamage += 0.12f; } if (profanedRage) { - if (player.FindBuffIndex(BuffID.Rage) > -1) - player.ClearBuff(BuffID.Rage); + if (Player.FindBuffIndex(BuffID.Rage) > -1) + Player.ClearBuff(BuffID.Rage); AllCritBoost(12); } if (shadow) { - if (player.FindBuffIndex(BuffID.Invisibility) > -1) - player.ClearBuff(BuffID.Invisibility); + if (Player.FindBuffIndex(BuffID.Invisibility) > -1) + Player.ClearBuff(BuffID.Invisibility); } if (irradiated) { - player.statDefense -= 10; - player.moveSpeed -= 0.1f; - player.allDamage += 0.05f; - player.minionKB += 0.5f; + Player.statDefense -= 10; + Player.moveSpeed -= 0.1f; + Player.allDamage += 0.05f; + Player.minionKB += 0.5f; } if (rRage) { - player.allDamage += 0.3f; - player.statDefense += 5; + Player.allDamage += 0.3f; + Player.statDefense += 5; } if (xRage) @@ -2367,37 +2368,37 @@ namespace CalamityMod.CalPlayer if (graxDefense) { - player.statDefense += 30; - player.endurance += 0.1f; - player.meleeDamage += 0.2f; + Player.statDefense += 30; + Player.endurance += 0.1f; + Player.GetDamage(DamageClass.Melee) += 0.2f; } if (tFury) { - player.meleeDamage += 0.3f; - player.meleeCrit += 10; + Player.GetDamage(DamageClass.Melee) += 0.3f; + Player.GetCritChance(DamageClass.Melee) += 10; } if (yPower) { - player.endurance += 0.06f; - player.statDefense += 8; - player.pickSpeed -= 0.05f; - player.allDamage += 0.06f; + Player.endurance += 0.06f; + Player.statDefense += 8; + Player.pickSpeed -= 0.05f; + Player.allDamage += 0.06f; AllCritBoost(2); - player.minionKB += 1f; - player.moveSpeed += 0.06f; + Player.minionKB += 1f; + Player.moveSpeed += 0.06f; } if (tScale) { - player.endurance += 0.05f; - player.statDefense += 5; - player.kbBuff = true; + Player.endurance += 0.05f; + Player.statDefense += 5; + Player.kbBuff = true; if (titanBoost > 0) { - player.statDefense += 25; - player.endurance += 0.1f; + Player.statDefense += 25; + Player.endurance += 0.1f; } } else @@ -2405,72 +2406,72 @@ namespace CalamityMod.CalPlayer if (darkSunRing) { - player.maxMinions += 2; - player.allDamage += 0.12f; - player.minionKB += 1.2f; - player.pickSpeed -= 0.15f; + Player.maxMinions += 2; + Player.allDamage += 0.12f; + Player.minionKB += 1.2f; + Player.pickSpeed -= 0.15f; if (Main.eclipse || !Main.dayTime) - player.statDefense += 15; + Player.statDefense += 15; } if (eGauntlet) { - player.kbGlove = true; - player.magmaStone = true; - player.meleeDamage += 0.15f; - player.meleeCrit += 5; - player.lavaMax += 240; + Player.kbGlove = true; + Player.magmaStone = true; + Player.GetDamage(DamageClass.Melee) += 0.15f; + Player.GetCritChance(DamageClass.Melee) += 5; + Player.lavaMax += 240; } if (bloodPactBoost) { - player.allDamage += 0.05f; - player.statDefense += 20; - player.endurance += 0.1f; - player.longInvince = true; - player.crimsonRegen = true; + Player.allDamage += 0.05f; + Player.statDefense += 20; + Player.endurance += 0.1f; + Player.longInvince = true; + Player.crimsonRegen = true; } if (cirrusDress) - player.moveSpeed -= 0.2f; + Player.moveSpeed -= 0.2f; if (fabsolVodka) - player.allDamage += 0.08f; + Player.allDamage += 0.08f; if (vodka) { - player.allDamage += 0.06f; + Player.allDamage += 0.06f; AllCritBoost(2); } if (grapeBeer) - player.moveSpeed -= 0.05f; + Player.moveSpeed -= 0.05f; if (moonshine) { - player.statDefense += 10; - player.endurance += 0.05f; + Player.statDefense += 10; + Player.endurance += 0.05f; } if (rum) - player.moveSpeed += 0.1f; + Player.moveSpeed += 0.1f; if (whiskey) { - player.allDamage += 0.04f; + Player.allDamage += 0.04f; AllCritBoost(2); } if (everclear) - player.allDamage += 0.25f; + Player.allDamage += 0.25f; if (bloodyMary) { if (Main.bloodMoon) { - player.allDamage += 0.15f; + Player.allDamage += 0.15f; AllCritBoost(7); - player.moveSpeed += 0.1f; + Player.moveSpeed += 0.1f; } } @@ -2478,10 +2479,10 @@ namespace CalamityMod.CalPlayer { if (Main.dayTime) { - player.statDefense += 5; - player.allDamage += 0.03f; + Player.statDefense += 5; + Player.allDamage += 0.03f; AllCritBoost(2); - player.endurance += 0.03f; + Player.endurance += 0.03f; } } @@ -2489,39 +2490,39 @@ namespace CalamityMod.CalPlayer { if (Main.dayTime) { - player.statDefense += 10; - player.allDamage += 0.07f; + Player.statDefense += 10; + Player.allDamage += 0.07f; AllCritBoost(3); - player.endurance += 0.07f; + Player.endurance += 0.07f; } } if (caribbeanRum) - player.moveSpeed += 0.1f; + Player.moveSpeed += 0.1f; if (cinnamonRoll) { - player.manaRegenDelay--; - player.manaRegenBonus += 10; + Player.manaRegenDelay--; + Player.manaRegenBonus += 10; } if (starBeamRye) { - player.magicDamage += 0.08f; - player.manaCost *= 0.9f; + Player.GetDamage(DamageClass.Magic) += 0.08f; + Player.manaCost *= 0.9f; } if (moscowMule) { - player.allDamage += 0.09f; + Player.allDamage += 0.09f; AllCritBoost(3); } if (whiteWine) - player.magicDamage += 0.1f; + Player.GetDamage(DamageClass.Magic) += 0.1f; if (evergreenGin) - player.endurance += 0.05f; + Player.endurance += 0.05f; if (giantPearl) { @@ -2532,49 +2533,49 @@ namespace CalamityMod.CalPlayer NPC npc = Main.npc[m]; if (!npc.active || npc.friendly || npc.dontTakeDamage) continue; - float distance = (npc.Center - player.Center).Length(); + float distance = (npc.Center - Player.Center).Length(); if (distance < 120f) npc.AddBuff(ModContent.BuffType(), 20, false); } } } - if (CalamityLists.scopedWeaponList.Contains(player.ActiveItem().type)) - player.scope = true; + if (CalamityLists.scopedWeaponList.Contains(Player.ActiveItem().type)) + Player.scope = true; - if (CalamityLists.highTestFishList.Contains(player.ActiveItem().type)) - player.accFishingLine = true; + if (CalamityLists.highTestFishList.Contains(Player.ActiveItem().type)) + Player.accFishingLine = true; - if (CalamityLists.boomerangList.Contains(player.ActiveItem().type) && player.invis) + if (CalamityLists.boomerangList.Contains(Player.ActiveItem().type) && Player.invis) throwingDamage += 0.1f; - if (CalamityLists.javelinList.Contains(player.ActiveItem().type) && player.invis) - player.armorPenetration += 5; + if (CalamityLists.javelinList.Contains(Player.ActiveItem().type) && Player.invis) + Player.armorPenetration += 5; - if (CalamityLists.flaskBombList.Contains(player.ActiveItem().type) && player.invis) + if (CalamityLists.flaskBombList.Contains(Player.ActiveItem().type) && Player.invis) throwingVelocity += 0.1f; - if (CalamityLists.spikyBallList.Contains(player.ActiveItem().type) && player.invis) + if (CalamityLists.spikyBallList.Contains(Player.ActiveItem().type) && Player.invis) throwingCrit += 10; if (planarSpeedBoost != 0) { - if (player.ActiveItem().type != ModContent.ItemType()) + if (Player.ActiveItem().type != ModContent.ItemType()) planarSpeedBoost = 0; } if (brimlashBusterBoost) { - if (player.ActiveItem().type != ModContent.ItemType()) + if (Player.ActiveItem().type != ModContent.ItemType()) brimlashBusterBoost = false; } if (evilSmasherBoost > 0) { - if (player.ActiveItem().type != ModContent.ItemType()) + if (Player.ActiveItem().type != ModContent.ItemType()) evilSmasherBoost = 0; } if (searedPanCounter > 0) { - if (player.ActiveItem().type != ModContent.ItemType()) + if (Player.ActiveItem().type != ModContent.ItemType()) { searedPanCounter = 0; searedPanTimer = 0; @@ -2586,7 +2587,7 @@ namespace CalamityMod.CalPlayer } if (animusBoost > 1f) { - if (player.ActiveItem().type != ModContent.ItemType()) + if (Player.ActiveItem().type != ModContent.ItemType()) animusBoost = 1f; } @@ -2604,18 +2605,18 @@ namespace CalamityMod.CalPlayer (draconicSurge ? 0.2 : 0D); if (harpyRing) - player.moveSpeed += 0.1f; + Player.moveSpeed += 0.1f; if (blueCandle) - player.moveSpeed += 0.1f; + Player.moveSpeed += 0.1f; // If the player has the Draconic Elixir cooldown, prevent Draconic Surge from being set as true by any means. // This can be caused by other mod interference, e.g. by Luiafk. - if (player.HasCooldown(Cooldowns.DraconicElixir.ID)) + if (Player.HasCooldown(Cooldowns.DraconicElixir.ID)) { draconicSurge = false; - if (player.FindBuffIndex(ModContent.BuffType()) > -1) - player.ClearBuff(ModContent.BuffType()); + if (Player.FindBuffIndex(ModContent.BuffType()) > -1) + Player.ClearBuff(ModContent.BuffType()); } if (community) @@ -2639,12 +2640,12 @@ namespace CalamityMod.CalPlayer int integerTypeBoost = (int)(floatTypeBoost * 50f); int critBoost = integerTypeBoost / 2; float damageBoost = floatTypeBoost * 0.5f; - player.endurance += floatTypeBoost * 0.25f; - player.statDefense += integerTypeBoost; - player.allDamage += damageBoost; + Player.endurance += floatTypeBoost * 0.25f; + Player.statDefense += integerTypeBoost; + Player.allDamage += damageBoost; AllCritBoost(critBoost); - player.minionKB += floatTypeBoost; - player.moveSpeed += floatTypeBoost * 0.5f; + Player.minionKB += floatTypeBoost; + Player.moveSpeed += floatTypeBoost * 0.5f; flightTimeMult += floatTypeBoost; } // Shattered Community gives the same wing time boost as normal Community @@ -2653,249 +2654,249 @@ namespace CalamityMod.CalPlayer if (profanedCrystalBuffs && gOffense && gDefense) { - bool offenseBuffs = (Main.dayTime && !player.wet) || player.lavaWet; + bool offenseBuffs = (Main.dayTime && !Player.wet) || Player.lavaWet; if (offenseBuffs) flightTimeMult += 0.1; } // Increase wing time - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)(player.wingTimeMax * flightTimeMult); + if (Player.wingTimeMax > 0) + Player.wingTimeMax = (int)(Player.wingTimeMax * flightTimeMult); if (vHex) { - player.blind = true; - player.statDefense -= 10; - player.moveSpeed -= 0.1f; + Player.blind = true; + Player.statDefense -= 10; + Player.moveSpeed -= 0.1f; - if (player.wingTimeMax < 0) - player.wingTimeMax = 0; + if (Player.wingTimeMax < 0) + Player.wingTimeMax = 0; - player.wingTimeMax = (int)(player.wingTimeMax * 0.75); + Player.wingTimeMax = (int)(Player.wingTimeMax * 0.75); } if (eGravity) { - if (player.wingTimeMax < 0) - player.wingTimeMax = 0; + if (Player.wingTimeMax < 0) + Player.wingTimeMax = 0; - if (player.wingTimeMax > 400) - player.wingTimeMax = 400; + if (Player.wingTimeMax > 400) + Player.wingTimeMax = 400; - player.wingTimeMax = (int)(player.wingTimeMax * 0.66); + Player.wingTimeMax = (int)(Player.wingTimeMax * 0.66); } if (eGrav) { - if (player.wingTimeMax < 0) - player.wingTimeMax = 0; + if (Player.wingTimeMax < 0) + Player.wingTimeMax = 0; - if (player.wingTimeMax > 400) - player.wingTimeMax = 400; + if (Player.wingTimeMax > 400) + Player.wingTimeMax = 400; - player.wingTimeMax = (int)(player.wingTimeMax * 0.75); + Player.wingTimeMax = (int)(Player.wingTimeMax * 0.75); } if (bounding) { - player.jumpSpeedBoost += 0.25f; + Player.jumpSpeedBoost += 0.25f; Player.jumpHeight += 10; - player.extraFall += 25; + Player.extraFall += 25; } if (mushy) - player.statDefense += 5; + Player.statDefense += 5; if (omniscience) { - player.detectCreature = true; - player.dangerSense = true; - player.findTreasure = true; + Player.detectCreature = true; + Player.dangerSense = true; + Player.findTreasure = true; } if (aWeapon) - player.moveSpeed += 0.05f; + Player.moveSpeed += 0.05f; if (molten) - player.resistCold = true; + Player.resistCold = true; if (shellBoost) - player.moveSpeed += 0.4f; + Player.moveSpeed += 0.4f; if (tarraSet) { if (!tarraMelee) - player.calmed = true; - player.lifeMagnet = true; + Player.calmed = true; + Player.lifeMagnet = true; } if (cadence) { - if (player.FindBuffIndex(BuffID.Regeneration) > -1) - player.ClearBuff(BuffID.Regeneration); - if (player.FindBuffIndex(BuffID.Lifeforce) > -1) - player.ClearBuff(BuffID.Lifeforce); - player.lifeMagnet = true; + if (Player.FindBuffIndex(BuffID.Regeneration) > -1) + Player.ClearBuff(BuffID.Regeneration); + if (Player.FindBuffIndex(BuffID.Lifeforce) > -1) + Player.ClearBuff(BuffID.Lifeforce); + Player.lifeMagnet = true; } - if (player.wellFed) - player.moveSpeed -= 0.1f; + if (Player.wellFed) + Player.moveSpeed -= 0.1f; - if (player.poisoned) - player.moveSpeed -= 0.1f; + if (Player.poisoned) + Player.moveSpeed -= 0.1f; - if (player.venom) - player.moveSpeed -= 0.15f; + if (Player.venom) + Player.moveSpeed -= 0.15f; if (wDeath) { - player.allDamage -= 0.2f; - player.moveSpeed -= 0.1f; + Player.allDamage -= 0.2f; + Player.moveSpeed -= 0.1f; } if (dragonFire) - player.moveSpeed -= 0.15f; + Player.moveSpeed -= 0.15f; if (hInferno) - player.moveSpeed -= 0.25f; + Player.moveSpeed -= 0.25f; if (gsInferno) - player.moveSpeed -= 0.15f; + Player.moveSpeed -= 0.15f; if (astralInfection) { - player.allDamage -= 0.1f; - player.moveSpeed -= 0.15f; + Player.allDamage -= 0.1f; + Player.moveSpeed -= 0.15f; } if (pFlames) { - player.blind = !reducedPlagueDmg; - player.allDamage -= 0.1f; - player.moveSpeed -= 0.15f; + Player.blind = !reducedPlagueDmg; + Player.allDamage -= 0.1f; + Player.moveSpeed -= 0.15f; } if (bBlood) { - player.blind = true; - player.statDefense -= 3; - player.moveSpeed += 0.1f; - player.meleeDamage += 0.05f; - player.rangedDamage -= 0.1f; - player.magicDamage -= 0.1f; + Player.blind = true; + Player.statDefense -= 3; + Player.moveSpeed += 0.1f; + Player.GetDamage(DamageClass.Melee) += 0.05f; + Player.GetDamage(DamageClass.Ranged) -= 0.1f; + Player.GetDamage(DamageClass.Magic) -= 0.1f; } if (aCrunch && !laudanum) { - player.statDefense -= ArmorCrunch.DefenseReduction; - player.endurance *= 0.33f; + Player.statDefense -= ArmorCrunch.DefenseReduction; + Player.endurance *= 0.33f; } if (wCleave && !laudanum) { - player.statDefense -= WarCleave.DefenseReduction; - player.endurance *= 0.75f; + Player.statDefense -= WarCleave.DefenseReduction; + Player.endurance *= 0.75f; } if (wither) { - player.statDefense -= WitherDebuff.DefenseReduction; + Player.statDefense -= WitherDebuff.DefenseReduction; } if (gState) { - player.velocity.X *= 0.5f; - player.velocity.Y += 0.05f; - if (player.velocity.Y > 15f) - player.velocity.Y = 15f; + Player.velocity.X *= 0.5f; + Player.velocity.Y += 0.05f; + if (Player.velocity.Y > 15f) + Player.velocity.Y = 15f; } if (eFreeze) { - player.velocity.X *= 0.5f; - player.velocity.Y += 0.1f; - if (player.velocity.Y > 15f) - player.velocity.Y = 15f; + Player.velocity.X *= 0.5f; + Player.velocity.Y += 0.1f; + if (Player.velocity.Y > 15f) + Player.velocity.Y = 15f; } if (eFreeze || eutrophication) - player.velocity = Vector2.Zero; + Player.velocity = Vector2.Zero; if (vaporfied || teslaFreeze) - player.velocity *= 0.98f; + Player.velocity *= 0.98f; if (molluskSet) - player.velocity.X *= 0.985f; + Player.velocity.X *= 0.985f; - if ((warped || caribbeanRum) && !player.slowFall && !player.mount.Active) + if ((warped || caribbeanRum) && !Player.slowFall && !Player.mount.Active) { - player.velocity.Y *= 1.01f; - player.moveSpeed -= 0.1f; + Player.velocity.Y *= 1.01f; + Player.moveSpeed -= 0.1f; } if (corrEffigy) { - player.moveSpeed += 0.1f; + Player.moveSpeed += 0.1f; AllCritBoost(10); } if (crimEffigy) { - player.allDamage += 0.15f; - player.statDefense += 10; + Player.allDamage += 0.15f; + Player.statDefense += 10; } if (badgeOfBraveryRare) - player.meleeDamage += warBannerBonus; + Player.GetDamage(DamageClass.Melee) += warBannerBonus; // The player's true max life value with Calamity adjustments - actualMaxLife = player.statLifeMax2; + actualMaxLife = Player.statLifeMax2; - if (thirdSageH && !player.dead && healToFull) + if (thirdSageH && !Player.dead && healToFull) { thirdSageH = false; - player.statLife = actualMaxLife; + Player.statLife = actualMaxLife; } if (manaOverloader) - player.magicDamage += 0.06f; + Player.GetDamage(DamageClass.Magic) += 0.06f; if (rBrain) { - if (player.statLife <= (int)(player.statLifeMax2 * 0.75)) - player.allDamage += 0.1f; - if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - player.moveSpeed -= 0.05f; + if (Player.statLife <= (int)(Player.statLifeMax2 * 0.75)) + Player.allDamage += 0.1f; + if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) + Player.moveSpeed -= 0.05f; } if (bloodyWormTooth) { - if (player.statLife < (int)(player.statLifeMax2 * 0.5)) + if (Player.statLife < (int)(Player.statLifeMax2 * 0.5)) { - player.meleeDamage += 0.1f; - player.endurance += 0.1f; + Player.GetDamage(DamageClass.Melee) += 0.1f; + Player.endurance += 0.1f; } else { - player.meleeDamage += 0.05f; - player.endurance += 0.05f; + Player.GetDamage(DamageClass.Melee) += 0.05f; + Player.endurance += 0.05f; } } if (dAmulet) - player.pStone = true; + Player.pStone = true; if (fBulwark) { - player.noKnockback = true; - if (player.statLife > (int)(player.statLifeMax2 * 0.25)) + Player.noKnockback = true; + if (Player.statLife > (int)(Player.statLifeMax2 * 0.25)) { - player.hasPaladinShield = true; - if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) + Player.hasPaladinShield = true; + if (Player.whoAmI != Main.myPlayer && Player.miscCounter % 10 == 0) { - if (Main.LocalPlayer.team == player.team && player.team != 0) + if (Main.LocalPlayer.team == Player.team && Player.team != 0) { - Vector2 otherPlayerPos = player.position - Main.LocalPlayer.position; + Vector2 otherPlayerPos = Player.position - Main.LocalPlayer.position; if (otherPlayerPos.Length() < 800f) Main.LocalPlayer.AddBuff(BuffID.PaladinsShield, 20, true); @@ -2903,43 +2904,43 @@ namespace CalamityMod.CalPlayer } } - if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - player.AddBuff(BuffID.IceBarrier, 5, true); - if (player.statLife <= (int)(player.statLifeMax2 * 0.15)) - player.endurance += 0.05f; + if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) + Player.AddBuff(BuffID.IceBarrier, 5, true); + if (Player.statLife <= (int)(Player.statLifeMax2 * 0.15)) + Player.endurance += 0.05f; } if (frostFlare) { - player.resistCold = true; - player.buffImmune[BuffID.Frostburn] = true; - player.buffImmune[BuffID.Chilled] = true; - player.buffImmune[BuffID.Frozen] = true; + Player.resistCold = true; + Player.buffImmune[BuffID.Frostburn] = true; + Player.buffImmune[BuffID.Chilled] = true; + Player.buffImmune[BuffID.Frozen] = true; - if (player.statLife > (int)(player.statLifeMax2 * 0.75)) - player.allDamage += 0.1f; - if (player.statLife < (int)(player.statLifeMax2 * 0.25)) - player.statDefense += 20; + if (Player.statLife > (int)(Player.statLifeMax2 * 0.75)) + Player.allDamage += 0.1f; + if (Player.statLife < (int)(Player.statLifeMax2 * 0.25)) + Player.statDefense += 20; } if (vexation) { - if (player.statLife < (int)(player.statLifeMax2 * 0.5)) - player.allDamage += 0.2f; + if (Player.statLife < (int)(Player.statLifeMax2 * 0.5)) + Player.allDamage += 0.2f; } if (ataxiaBlaze) { - if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - player.AddBuff(BuffID.Inferno, 2); + if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) + Player.AddBuff(BuffID.Inferno, 2); } if (bloodflareThrowing) { - if (player.statLife > (int)(player.statLifeMax2 * 0.8)) + if (Player.statLife > (int)(Player.statLifeMax2 * 0.8)) { throwingCrit += 5; - player.statDefense += 30; + Player.statDefense += 30; } else throwingDamage += 0.1f; @@ -2947,22 +2948,22 @@ namespace CalamityMod.CalPlayer if (bloodflareSummon) { - if (player.statLife >= (int)(player.statLifeMax2 * 0.9)) - player.minionDamage += 0.1f; - else if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - player.statDefense += 20; + if (Player.statLife >= (int)(Player.statLifeMax2 * 0.9)) + Player.GetDamage(DamageClass.Summon) += 0.1f; + else if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) + Player.statDefense += 20; if (bloodflareSummonTimer > 0) bloodflareSummonTimer--; - if (player.whoAmI == Main.myPlayer && bloodflareSummonTimer <= 0) + if (Player.whoAmI == Main.myPlayer && bloodflareSummonTimer <= 0) { bloodflareSummonTimer = 900; for (int I = 0; I < 3; I++) { float ai1 = I * 120; - int projectile = Projectile.NewProjectile(player.Center.X + (float)(Math.Sin(I * 120) * 550), player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f, - ModContent.ProjectileType(), (int)(3750 * player.MinionDamage()), 1f, player.whoAmI, ai1, 0f); + int projectile = Projectile.NewProjectile(Player.Center.X + (float)(Math.Sin(I * 120) * 550), Player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f, + ModContent.ProjectileType(), (int)(3750 * Player.MinionDamage()), 1f, Player.whoAmI, ai1, 0f); if (projectile.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile].Calamity().forceTypeless = true; } @@ -2971,40 +2972,40 @@ namespace CalamityMod.CalPlayer if (yInsignia) { - player.meleeDamage += 0.1f; - player.lavaMax += 240; - if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - player.allDamage += 0.1f; + Player.GetDamage(DamageClass.Melee) += 0.1f; + Player.lavaMax += 240; + if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) + Player.allDamage += 0.1f; } - if (deepDiver && player.IsUnderwater()) + if (deepDiver && Player.IsUnderwater()) { - player.allDamage += 0.15f; - player.statDefense += 15; - player.moveSpeed += 0.15f; + Player.allDamage += 0.15f; + Player.statDefense += 15; + Player.moveSpeed += 0.15f; } - if (abyssalDivingSuit && !player.IsUnderwater()) + if (abyssalDivingSuit && !Player.IsUnderwater()) { float moveSpeedLoss = (3 - abyssalDivingSuitPlateHits) * 0.2f; - player.moveSpeed -= moveSpeedLoss; + Player.moveSpeed -= moveSpeedLoss; } if (ursaSergeant) - player.moveSpeed -= 0.15f; + Player.moveSpeed -= 0.15f; if (elysianGuard) - player.moveSpeed -= 0.5f; + Player.moveSpeed -= 0.5f; if (coreOfTheBloodGod) { - player.endurance += 0.08f; - player.allDamage += 0.08f; + Player.endurance += 0.08f; + Player.allDamage += 0.08f; } if (godSlayerThrowing) { - if (player.statLife >= player.statLifeMax2) + if (Player.statLife >= Player.statLifeMax2) { throwingCrit += 10; throwingDamage += 0.1f; @@ -3022,10 +3023,10 @@ namespace CalamityMod.CalPlayer tarraLifeAuraTimer = (tarraLifeAuraTimer + 1) % FramesPerHit; // If the timer rolls over, it's time to deal damage. Only run this code for the client which is wearing the armor. - if (tarraLifeAuraTimer == 0 && player.whoAmI == Main.myPlayer) + if (tarraLifeAuraTimer == 0 && Player.whoAmI == Main.myPlayer) { const int BaseDamage = 120; - int damage = (int)(BaseDamage * player.MinionDamage()); + int damage = (int)(BaseDamage * Player.MinionDamage()); float range = 300f; for (int i = 0; i < Main.maxNPCs; ++i) @@ -3034,14 +3035,14 @@ namespace CalamityMod.CalPlayer if (!npc.active || npc.friendly || npc.damage <= 0 || npc.dontTakeDamage) continue; - if (Vector2.Distance(player.Center, npc.Center) <= range) - Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, i); + if (Vector2.Distance(Player.Center, npc.Center) <= range) + Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, i); } } } // Navy Fishing Rod's electric aura when in-use - if (player.ActiveItem().type == ModContent.ItemType() && player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) + if (Player.ActiveItem().type == ModContent.ItemType() && Player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) { const int FramesPerHit = 120; @@ -3049,10 +3050,10 @@ namespace CalamityMod.CalPlayer navyRodAuraTimer = (navyRodAuraTimer + 1) % FramesPerHit; // If the timer rolls over, it's time to deal damage. Only run this code for the client which is holding the fishing rod, - if (navyRodAuraTimer == 0 && player.whoAmI == Main.myPlayer) + if (navyRodAuraTimer == 0 && Player.whoAmI == Main.myPlayer) { const int BaseDamage = 10; - int damage = (int)(BaseDamage * player.AverageDamage()); + int damage = (int)(BaseDamage * Player.AverageDamage()); float range = 200f; for (int i = 0; i < Main.maxNPCs; ++i) @@ -3061,14 +3062,14 @@ namespace CalamityMod.CalPlayer if (!npc.active || npc.friendly || npc.damage <= 0 || npc.dontTakeDamage) continue; - if (Vector2.Distance(player.Center, npc.Center) <= range) - Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, i); + if (Vector2.Distance(Player.Center, npc.Center) <= range) + Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, i); // Occasionally spawn cute sparks so it looks like an electrical aura if (Main.rand.NextBool(10)) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - int spark = Projectile.NewProjectile(npc.Center, velocity, ModContent.ProjectileType(), damage / 2, 0f, player.whoAmI); + int spark = Projectile.NewProjectile(npc.Center, velocity, ModContent.ProjectileType(), damage / 2, 0f, Player.whoAmI); if (spark.WithinBounds(Main.maxProjectiles)) { Main.projectile[spark].Calamity().forceTypeless = true; @@ -3081,7 +3082,7 @@ namespace CalamityMod.CalPlayer } // Inferno potion boost - if (ataxiaBlaze && player.inferno) + if (ataxiaBlaze && Player.inferno) { const int FramesPerHit = 30; @@ -3090,10 +3091,10 @@ namespace CalamityMod.CalPlayer // Only run this code for the client which is wearing the armor. // Brimstone flames is applied every single frame, but direct damage is only dealt twice per second. - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { const int BaseDamage = 50; - int damage = (int)(BaseDamage * player.AverageDamage()); + int damage = (int)(BaseDamage * Player.AverageDamage()); float range = 300f; for (int i = 0; i < Main.maxNPCs; ++i) @@ -3102,11 +3103,11 @@ namespace CalamityMod.CalPlayer if (!npc.active || npc.friendly || npc.damage <= 0 || npc.dontTakeDamage) continue; - if (Vector2.Distance(player.Center, npc.Center) <= range) + if (Vector2.Distance(Player.Center, npc.Center) <= range) { npc.AddBuff(ModContent.BuffType(), 120); if (brimLoreInfernoTimer == 0) - Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, i); + Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, i); } } } @@ -3115,133 +3116,133 @@ namespace CalamityMod.CalPlayer if (royalGel) { - player.npcTypeNoAggro[ModContent.NPCType()] = true; - player.npcTypeNoAggro[ModContent.NPCType()] = true; - player.npcTypeNoAggro[ModContent.NPCType()] = true; - player.npcTypeNoAggro[ModContent.NPCType()] = true; - player.npcTypeNoAggro[ModContent.NPCType()] = true; - player.npcTypeNoAggro[ModContent.NPCType()] = true; - player.npcTypeNoAggro[ModContent.NPCType()] = true; - player.npcTypeNoAggro[ModContent.NPCType()] = true; - player.npcTypeNoAggro[ModContent.NPCType()] = true; - player.npcTypeNoAggro[ModContent.NPCType()] = true; - player.npcTypeNoAggro[ModContent.NPCType()] = true; + Player.npcTypeNoAggro[ModContent.NPCType()] = true; + Player.npcTypeNoAggro[ModContent.NPCType()] = true; + Player.npcTypeNoAggro[ModContent.NPCType()] = true; + Player.npcTypeNoAggro[ModContent.NPCType()] = true; + Player.npcTypeNoAggro[ModContent.NPCType()] = true; + Player.npcTypeNoAggro[ModContent.NPCType()] = true; + Player.npcTypeNoAggro[ModContent.NPCType()] = true; + Player.npcTypeNoAggro[ModContent.NPCType()] = true; + Player.npcTypeNoAggro[ModContent.NPCType()] = true; + Player.npcTypeNoAggro[ModContent.NPCType()] = true; + Player.npcTypeNoAggro[ModContent.NPCType()] = true; } if (dukeScales) { - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Poisoned] = true; - player.buffImmune[BuffID.Venom] = true; - if (player.statLife <= (int)(player.statLifeMax2 * 0.75)) + Player.buffImmune[ModContent.BuffType()] = true; + Player.buffImmune[BuffID.Poisoned] = true; + Player.buffImmune[BuffID.Venom] = true; + if (Player.statLife <= (int)(Player.statLifeMax2 * 0.75)) { - player.allDamage += 0.06f; + Player.allDamage += 0.06f; AllCritBoost(3); } - if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) + if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) { - player.allDamage += 0.06f; + Player.allDamage += 0.06f; AllCritBoost(3); } - if (player.statLife <= (int)(player.statLifeMax2 * 0.25)) + if (Player.statLife <= (int)(Player.statLifeMax2 * 0.25)) { - player.allDamage += 0.06f; + Player.allDamage += 0.06f; AllCritBoost(3); } - if (player.lifeRegen < 0) + if (Player.lifeRegen < 0) { - player.allDamage += 0.1f; + Player.allDamage += 0.1f; AllCritBoost(5); } } if (dArtifact) - player.allDamage += 0.25f; + Player.allDamage += 0.25f; if (trippy) - player.allDamage += 0.5f; + Player.allDamage += 0.5f; if (eArtifact) { - player.manaCost *= 0.85f; + Player.manaCost *= 0.85f; throwingDamage += 0.15f; - player.maxMinions += 2; + Player.maxMinions += 2; } - if (gArtifact && player.FindBuffIndex(ModContent.BuffType()) != -1) - player.maxMinions += player.ownedProjectileCounts[ModContent.ProjectileType()]; + if (gArtifact && Player.FindBuffIndex(ModContent.BuffType()) != -1) + Player.maxMinions += Player.ownedProjectileCounts[ModContent.ProjectileType()]; if (pArtifact) { - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1 && !profanedCrystalBuffs) - player.AddBuff(ModContent.BuffType(), 3600, true); + if (Player.FindBuffIndex(ModContent.BuffType()) == -1 && !profanedCrystalBuffs) + Player.AddBuff(ModContent.BuffType(), 3600, true); bool crystal = profanedCrystal && !profanedCrystalForce; bool summonSet = tarraSummon || bloodflareSummon || silvaSummon || dsSetBonus || omegaBlueSet || fearmongerSet; int guardianAmt = 1; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -6f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) + Projectile.NewProjectile(Player.Center.X, Player.Center.Y, 0f, -6f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); if (crystal || minionSlotStat >= 10) { gDefense = true; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -3f, ModContent.ProjectileType(), 1, 1f, Main.myPlayer, 0f, 0f); + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) + Projectile.NewProjectile(Player.Center.X, Player.Center.Y, 0f, -3f, ModContent.ProjectileType(), 1, 1f, Main.myPlayer, 0f, 0f); } if (crystal || summonSet) { gOffense = true; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), 1, 1f, Main.myPlayer, 0f, 0f); + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) + Projectile.NewProjectile(Player.Center.X, Player.Center.Y, 0f, -1f, ModContent.ProjectileType(), 1, 1f, Main.myPlayer, 0f, 0f); } } } if (profanedCrystalBuffs && gOffense && gDefense) { - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { - player.scope = false; //this is so it doesn't mess with the balance of ranged transform attacks over the others - player.lavaImmune = true; - player.lavaMax += 420; - player.lavaRose = true; - player.fireWalk = true; - player.buffImmune[ModContent.BuffType()] = Main.dayTime; - player.buffImmune[ModContent.BuffType()] = !Main.dayTime; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Burning] = true; - player.buffImmune[BuffID.Daybreak] = true; - bool offenseBuffs = (Main.dayTime && !player.wet) || player.lavaWet; + Player.scope = false; //this is so it doesn't mess with the balance of ranged transform attacks over the others + Player.lavaImmune = true; + Player.lavaMax += 420; + Player.lavaRose = true; + Player.fireWalk = true; + Player.buffImmune[ModContent.BuffType()] = Main.dayTime; + Player.buffImmune[ModContent.BuffType()] = !Main.dayTime; + Player.buffImmune[BuffID.OnFire] = true; + Player.buffImmune[BuffID.Burning] = true; + Player.buffImmune[BuffID.Daybreak] = true; + bool offenseBuffs = (Main.dayTime && !Player.wet) || Player.lavaWet; if (offenseBuffs) { - player.minionDamage += 0.15f; - player.minionKB += 0.15f; - player.moveSpeed += 0.1f; - player.statDefense -= 15; - player.ignoreWater = true; + Player.GetDamage(DamageClass.Summon) += 0.15f; + Player.minionKB += 0.15f; + Player.moveSpeed += 0.1f; + Player.statDefense -= 15; + Player.ignoreWater = true; } else { - player.moveSpeed -= 0.1f; - player.endurance += 0.05f; - player.statDefense += 15; - player.lifeRegen += 5; + Player.moveSpeed -= 0.1f; + Player.endurance += 0.05f; + Player.statDefense += 15; + Player.lifeRegen += 5; } - bool enrage = player.statLife <= (int)(player.statLifeMax2 * 0.5); + bool enrage = Player.statLife <= (int)(Player.statLifeMax2 * 0.5); if (!ZoneAbyss) //No abyss memes. - Lighting.AddLight(player.Center, enrage ? 1.2f : offenseBuffs ? 1f : 0.2f, enrage ? 0.21f : offenseBuffs ? 0.2f : 0.01f, 0); + Lighting.AddLight(Player.Center, enrage ? 1.2f : offenseBuffs ? 1f : 0.2f, enrage ? 0.21f : offenseBuffs ? 0.2f : 0.01f, 0); if (enrage) { - bool special = player.name == "Amber" || player.name == "Nincity" || player.name == "IbanPlay" || player.name == "Chen"; //People who either helped create the item or test it. + bool special = Player.name == "Amber" || Player.name == "Nincity" || Player.name == "IbanPlay" || Player.name == "Chen"; //People who either helped create the item or test it. for (int i = 0; i < 3; i++) { - int fire = Dust.NewDust(player.position, player.width, player.height, special ? 231 : (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, special ? Color.DarkRed : default, 1f); + int fire = Dust.NewDust(Player.position, Player.width, Player.height, special ? 231 : (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, special ? Color.DarkRed : default, 1f); Main.dust[fire].scale = special ? 1.169f : 2f; Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= special ? 10f : 6.9f; @@ -3256,19 +3257,19 @@ namespace CalamityMod.CalPlayer pistonsCounter++; if (pistonsCounter % 12 == 0) { - if (player.velocity.Length() >= 5f && player.whoAmI == Main.myPlayer) + if (Player.velocity.Length() >= 5f && Player.whoAmI == Main.myPlayer) { int beeCount = 1; if (Main.rand.NextBool(3)) ++beeCount; if (Main.rand.NextBool(3)) ++beeCount; - if (player.strongBees && Main.rand.NextBool(3)) + if (Player.strongBees && Main.rand.NextBool(3)) ++beeCount; - int damage = (int)(30 * player.MinionDamage()); + int damage = (int)(30 * Player.MinionDamage()); for (int index = 0; index < beeCount; ++index) { - int bee = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-35f, 35f) * 0.02f, Main.rand.NextFloat(-35f, 35f) * 0.02f, (Main.rand.NextBool(4) ? ModContent.ProjectileType() : player.beeType()), damage, player.beeKB(0f), player.whoAmI, 0f, 0f); + int bee = Projectile.NewProjectile(Player.Center.X, Player.Center.Y, Main.rand.NextFloat(-35f, 35f) * 0.02f, Main.rand.NextFloat(-35f, 35f) * 0.02f, (Main.rand.NextBool(4) ? ModContent.ProjectileType() : Player.beeType()), damage, Player.beeKB(0f), Player.whoAmI, 0f, 0f); Main.projectile[bee].usesLocalNPCImmunity = true; Main.projectile[bee].localNPCHitCooldown = 10; Main.projectile[bee].penetrate = 2; @@ -3297,12 +3298,12 @@ namespace CalamityMod.CalPlayer int projAmt = 1; for (int i = 0; i < summonDeleteList.Count; i++) { - if (player.ownedProjectileCounts[summonDeleteList[i]] > projAmt) + if (Player.ownedProjectileCounts[summonDeleteList[i]] > projAmt) { for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { Projectile proj = Main.projectile[projIndex]; - if (proj.active && proj.owner == player.whoAmI) + if (proj.active && proj.owner == Player.whoAmI) { if (summonDeleteList.Contains(proj.type)) { @@ -3315,19 +3316,19 @@ namespace CalamityMod.CalPlayer if (blunderBooster) { - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(30 * player.RogueDamage()), 0f, player.whoAmI, 0f, 0f); + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(30 * Player.RogueDamage()), 0f, Player.whoAmI, 0f, 0f); } } - else if (player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) + else if (Player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) { - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == player.whoAmI) + if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == Player.whoAmI) { Main.projectile[i].Kill(); break; @@ -3338,30 +3339,30 @@ namespace CalamityMod.CalPlayer if (tesla) { - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { //Reduce the buffTime of Electrified for (int l = 0; l < Player.MaxBuffs; l++) { - bool electrified = player.buffType[l] == BuffID.Electrified; - if (player.buffTime[l] > 2 && electrified) + bool electrified = Player.buffType[l] == BuffID.Electrified; + if (Player.buffTime[l] > 2 && electrified) { - player.buffTime[l]--; + Player.buffTime[l]--; } } //Summon the aura - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(10 * player.AverageDamage()), 0f, player.whoAmI, 0f, 0f); + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(10 * Player.AverageDamage()), 0f, Player.whoAmI, 0f, 0f); } } - else if (player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) + else if (Player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) { - if (player.whoAmI == Main.myPlayer) + if (Player.whoAmI == Main.myPlayer) { int auraType = ModContent.ProjectileType(); for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].type != auraType || !Main.projectile[i].active || Main.projectile[i].owner != player.whoAmI) + if (Main.projectile[i].type != auraType || !Main.projectile[i].active || Main.projectile[i].owner != Player.whoAmI) continue; Main.projectile[i].Kill(); @@ -3372,15 +3373,15 @@ namespace CalamityMod.CalPlayer if (CryoStone) { - if (player.whoAmI == Main.myPlayer && player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(player.AverageDamage() * 70), 0f, player.whoAmI); + if (Player.whoAmI == Main.myPlayer && Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + Projectile.NewProjectile(Player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Player.AverageDamage() * 70), 0f, Player.whoAmI); } - else if (player.whoAmI == Main.myPlayer) + else if (Player.whoAmI == Main.myPlayer) { int shieldType = ModContent.ProjectileType(); for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].type != shieldType || !Main.projectile[i].active || Main.projectile[i].owner != player.whoAmI) + if (Main.projectile[i].type != shieldType || !Main.projectile[i].active || Main.projectile[i].owner != Player.whoAmI) continue; Main.projectile[i].Kill(); @@ -3388,20 +3389,20 @@ namespace CalamityMod.CalPlayer } } - if (prismaticLasers > 1800 && player.whoAmI == Main.myPlayer) + if (prismaticLasers > 1800 && Player.whoAmI == Main.myPlayer) { float shootSpeed = 18f; - int dmg = (int)(30 * player.MagicDamage()); - Vector2 startPos = player.RotatedRelativePoint(player.MountedCenter, true); + int dmg = (int)(30 * Player.MagicDamage()); + Vector2 startPos = Player.RotatedRelativePoint(Player.MountedCenter, true); Vector2 velocity = Main.MouseWorld - startPos; - if (player.gravDir == -1f) + if (Player.gravDir == -1f) { velocity.Y = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - startPos.Y; } float travelDist = velocity.Length(); if ((float.IsNaN(velocity.X) && float.IsNaN(velocity.Y)) || (velocity.X == 0f && velocity.Y == 0f)) { - velocity.X = player.direction; + velocity.X = Player.direction; velocity.Y = 0f; travelDist = shootSpeed; } @@ -3413,8 +3414,8 @@ namespace CalamityMod.CalPlayer int laserAmt = Main.rand.Next(2); for (int index = 0; index < laserAmt; index++) { - startPos = new Vector2(player.Center.X + (Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - startPos.X = (startPos.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); + startPos = new Vector2(Player.Center.X + (Main.rand.Next(201) * -(float)Player.direction) + (Main.mouseX + Main.screenPosition.X - Player.position.X), Player.MountedCenter.Y - 600f); + startPos.X = (startPos.X + Player.Center.X) / 2f + Main.rand.Next(-200, 201); startPos.Y -= 100 * index; velocity.X = Main.mouseX + Main.screenPosition.X - startPos.X; velocity.Y = Main.mouseY + Main.screenPosition.Y - startPos.Y; @@ -3432,17 +3433,17 @@ namespace CalamityMod.CalPlayer velocity.Y *= travelDist; velocity.X += Main.rand.Next(-50, 51) * 0.02f; velocity.Y += Main.rand.Next(-50, 51) * 0.02f; - int laser = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), dmg, 4f, player.whoAmI, 0f, 0f); + int laser = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), dmg, 4f, Player.whoAmI, 0f, 0f); Main.projectile[laser].localNPCHitCooldown = 5; if (laser.WithinBounds(Main.maxProjectiles)) Main.projectile[laser].Calamity().forceTypeless = true; } - Main.PlaySound(SoundID.Item12, player.Center); + SoundEngine.PlaySound(SoundID.Item12, Player.Center); } if (prismaticLasers == 1800) { // At the exact moment the lasers stop, set the cooldown to appear - player.AddCooldown(PrismaticLaser.ID, 1800); + Player.AddCooldown(PrismaticLaser.ID, 1800); } if (prismaticLasers == 1) { @@ -3465,9 +3466,9 @@ namespace CalamityMod.CalPlayer new Color(255, 0, 255, 50), //Fuschia new Color(255, 0, 128, 50) //Hot Pink }); - Vector2 source = Vector2.Normalize(player.velocity) * new Vector2(player.width / 2f, player.height) * 0.75f; - source = source.RotatedBy((dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt, default) + player.Center; - Vector2 dustVel = source - player.Center; + Vector2 source = Vector2.Normalize(Player.velocity) * new Vector2(Player.width / 2f, Player.height) * 0.75f; + source = source.RotatedBy((dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt, default) + Player.Center; + Vector2 dustVel = source - Player.Center; int dusty = Dust.NewDust(source + dustVel, 0, 0, 267, dustVel.X * 1f, dustVel.Y * 1f, 100, color, 1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; @@ -3475,37 +3476,37 @@ namespace CalamityMod.CalPlayer } } - if (angelicAlliance && Main.myPlayer == player.whoAmI) + if (angelicAlliance && Main.myPlayer == Player.whoAmI) { for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; + int hasBuff = Player.buffType[l]; if (hasBuff == ModContent.BuffType()) { - angelicActivate = player.buffTime[l]; + angelicActivate = Player.buffTime[l]; } } - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (Player.FindBuffIndex(ModContent.BuffType()) == -1) angelicActivate = -1; if (angelicActivate == 1) - player.AddCooldown(Cooldowns.DivineBless.ID, CalamityUtils.SecondsToFrames(60)); + Player.AddCooldown(Cooldowns.DivineBless.ID, CalamityUtils.SecondsToFrames(60)); } if (theBee) { - if (player.statLife >= player.statLifeMax2) + if (Player.statLife >= Player.statLifeMax2) { - float beeBoost = player.endurance / 2f; - player.allDamage += beeBoost; + float beeBoost = Player.endurance / 2f; + Player.allDamage += beeBoost; } } if (badgeOfBravery) { - player.meleeDamage += 0.05f; - player.meleeCrit += 5; + Player.GetDamage(DamageClass.Melee) += 0.05f; + Player.GetCritChance(DamageClass.Melee) += 5; } if (CalamityConfig.Instance.Proficiency) @@ -3516,19 +3517,19 @@ namespace CalamityMod.CalPlayer (evasionScarf ? 0.05 : 0) + ((aBulwarkRare && aBulwarkRareMeleeBoostTimer > 0) ? 0.5 : 0) + (fungalSymbiote ? 0.15 : 0) + - ((player.head == ArmorIDs.Head.MoltenHelmet && player.body == ArmorIDs.Body.MoltenBreastplate && player.legs == ArmorIDs.Legs.MoltenGreaves) ? 0.2 : 0) + - (player.kbGlove ? 0.1 : 0) + + ((Player.head == ArmorIDs.Head.MoltenHelmet && Player.body == ArmorIDs.Body.MoltenBreastplate && Player.legs == ArmorIDs.Legs.MoltenGreaves) ? 0.2 : 0) + + (Player.kbGlove ? 0.1 : 0) + (eGauntlet ? 0.1 : 0) + (yInsignia ? 0.1 : 0) + (badgeOfBraveryRare ? warBannerBonus : 0); trueMeleeDamage += damageAdd; // Amalgam boosts - if (Main.myPlayer == player.whoAmI) + if (Main.myPlayer == Player.whoAmI) { for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; + int hasBuff = Player.buffType[l]; if ((hasBuff >= BuffID.ObsidianSkin && hasBuff <= BuffID.Gravitation) || hasBuff == BuffID.Tipsy || hasBuff == BuffID.WellFed || hasBuff == BuffID.Honey || hasBuff == BuffID.WeaponImbueVenom || (hasBuff >= BuffID.WeaponImbueCursedFlames && hasBuff <= BuffID.WeaponImbuePoison) || (hasBuff >= BuffID.Mining && hasBuff <= BuffID.Wrath) || (hasBuff >= BuffID.Lovestruck && hasBuff <= BuffID.Warmth) || hasBuff == BuffID.SugarRush || @@ -3553,8 +3554,8 @@ namespace CalamityMod.CalPlayer if (amalgam) { // Every other frame, increase the buff timer by one frame. Thus, the buff lasts twice as long. - if (player.miscCounter % 2 == 0) - player.buffTime[l] += 1; + if (Player.miscCounter % 2 == 0) + Player.buffTime[l] += 1; // Buffs will not go away when you die, to prevent wasting potions. if (!Main.persistentBuff[hasBuff]) @@ -3573,76 +3574,76 @@ namespace CalamityMod.CalPlayer // Laudanum boosts if (laudanum) { - if (Main.myPlayer == player.whoAmI) + if (Main.myPlayer == Player.whoAmI) { for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; + int hasBuff = Player.buffType[l]; if (hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == BuffID.Obstructed || hasBuff == BuffID.Ichor || hasBuff == BuffID.Chilled || hasBuff == BuffID.BrokenArmor || hasBuff == BuffID.Weak || hasBuff == BuffID.Slow || hasBuff == BuffID.Confused || hasBuff == BuffID.Blackout || hasBuff == BuffID.Darkness) { // Every other frame, increase the buff timer by one frame. Thus, the buff lasts twice as long. - if (player.miscCounter % 2 == 0) - player.buffTime[l] += 1; + if (Player.miscCounter % 2 == 0) + Player.buffTime[l] += 1; } // See later as Laud cancels out the normal effects if (hasBuff == ModContent.BuffType()) { // +15 defense - player.statDefense += ArmorCrunch.DefenseReduction; + Player.statDefense += ArmorCrunch.DefenseReduction; } if (hasBuff == ModContent.BuffType()) { // +10% damage reduction - player.endurance += 0.1f; + Player.endurance += 0.1f; } switch (hasBuff) { case BuffID.Obstructed: - player.headcovered = false; - player.statDefense += 50; - player.allDamage += 0.5f; + Player.headcovered = false; + Player.statDefense += 50; + Player.allDamage += 0.5f; AllCritBoost(25); break; case BuffID.Ichor: - player.statDefense += 40; + Player.statDefense += 40; break; case BuffID.Chilled: - player.chilled = false; - player.moveSpeed *= 1.3f; + Player.chilled = false; + Player.moveSpeed *= 1.3f; break; case BuffID.BrokenArmor: - player.brokenArmor = false; - player.statDefense += (int)(player.statDefense * 0.25); + Player.brokenArmor = false; + Player.statDefense += (int)(Player.statDefense * 0.25); break; case BuffID.Weak: - player.meleeDamage += 0.151f; - player.statDefense += 14; - player.moveSpeed += 0.3f; + Player.GetDamage(DamageClass.Melee) += 0.151f; + Player.statDefense += 14; + Player.moveSpeed += 0.3f; break; case BuffID.Slow: - player.slow = false; - player.moveSpeed *= 1.5f; + Player.slow = false; + Player.moveSpeed *= 1.5f; break; case BuffID.Confused: - player.confused = false; - player.statDefense += 30; - player.allDamage += 0.25f; + Player.confused = false; + Player.statDefense += 30; + Player.allDamage += 0.25f; AllCritBoost(10); break; case BuffID.Blackout: - player.blackout = false; - player.statDefense += 30; - player.allDamage += 0.25f; + Player.blackout = false; + Player.statDefense += 30; + Player.allDamage += 0.25f; AllCritBoost(10); break; case BuffID.Darkness: - player.blind = false; - player.statDefense += 15; - player.allDamage += 0.1f; + Player.blind = false; + Player.statDefense += 15; + Player.allDamage += 0.1f; AllCritBoost(5); break; } @@ -3653,8 +3654,8 @@ namespace CalamityMod.CalPlayer // Draedon's Heart bonus if (draedonsHeart) { - if (player.StandingStill() && player.itemAnimation == 0) - player.statDefense += (int)(player.statDefense * 0.75); + if (Player.StandingStill() && Player.itemAnimation == 0) + Player.statDefense += (int)(Player.statDefense * 0.75); } // Endurance reductions @@ -3665,7 +3666,7 @@ namespace CalamityMod.CalPlayer int numDust = 2; for (int i = 0; i < numDust; i++) { - int dustIndex = Dust.NewDust(player.position, player.width, player.height, 21, 0f, 0f); + int dustIndex = Dust.NewDust(Player.position, Player.width, Player.height, 21, 0f, 0f); Dust dust = Main.dust[dustIndex]; dust.position.X += Main.rand.Next(-5, 6); dust.position.Y += Main.rand.Next(-5, 6); @@ -3701,13 +3702,13 @@ namespace CalamityMod.CalPlayer if (totalDefenseDamage > 0) { // Defense damage is capped at your maximum defense, no matter what. - if (totalDefenseDamage > player.statDefense) - totalDefenseDamage = player.statDefense; + if (totalDefenseDamage > Player.statDefense) + totalDefenseDamage = Player.statDefense; // You cannot begin recovering from defense damage until your iframes wear off. bool hasIFrames = false; - for (int i = 0; i < player.hurtCooldowns.Length; i++) - if (player.hurtCooldowns[i] > 0) + for (int i = 0; i < Player.hurtCooldowns.Length; i++) + if (Player.hurtCooldowns[i] > 0) hasIFrames = true; // Delay before defense damage recovery can start. While this delay is ticking down, defense damage doesn't recover at all. @@ -3738,14 +3739,14 @@ namespace CalamityMod.CalPlayer // DR Damage is applied at exactly the same ratio as defense damage; // if you lose half your defense to defense damage, you also lose half your DR. // This is applied first because the math would be wrong if the player's defense was already reduced by defense damage. - if (player.statDefense > 0 && player.endurance > 0f) + if (Player.statDefense > 0 && Player.endurance > 0f) { - float drDamageRatio = currentDefenseDamage / (float)player.statDefense; - player.endurance *= 1f - drDamageRatio; + float drDamageRatio = currentDefenseDamage / (float)Player.statDefense; + Player.endurance *= 1f - drDamageRatio; } // Apply defense damage - player.statDefense -= currentDefenseDamage; + Player.statDefense -= currentDefenseDamage; } // Bloodflare Core's defense reduction @@ -3756,19 +3757,19 @@ namespace CalamityMod.CalPlayer if (lostDef > 0) { // Defense regeneration occurs every four frames while defense is missing - if (player.miscCounter % 4 == 0) + if (Player.miscCounter % 4 == 0) { --lostDef; if (bloodflareCore) { - player.statLife += 1; - player.HealEffect(1, false); + Player.statLife += 1; + Player.HealEffect(1, false); // Produce an implosion of blood themed dust so it's obvious an effect is occurring for (int i = 0; i < 3; ++i) { Vector2 offset = Main.rand.NextVector2Unit() * Main.rand.NextFloat(23f, 33f); - Vector2 dustPos = player.Center + offset; + Vector2 dustPos = Player.Center + offset; Vector2 dustVel = offset * -0.08f; Dust d = Dust.NewDustDirect(dustPos, 0, 0, 90, 0.08f, 0.08f); d.velocity = dustVel; @@ -3778,88 +3779,88 @@ namespace CalamityMod.CalPlayer } // Actually apply Bloodflare Core defense reduction - player.statDefense -= lostDef; + Player.statDefense -= lostDef; } // Defense can never be reduced below zero, no matter what - if (player.statDefense < 0) - player.statDefense = 0; + if (Player.statDefense < 0) + Player.statDefense = 0; // Multiplicative defense reductions. // These are done last because they need to be after the defense lower cap at 0. if (fabsolVodka) { - if (player.statDefense > 0) - player.statDefense -= (int)(player.statDefense * 0.1); + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * 0.1); } if (vodka) { - if (player.statDefense > 0) - player.statDefense -= (int)(player.statDefense * 0.05); + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * 0.05); } if (grapeBeer) { - if (player.statDefense > 0) - player.statDefense -= (int)(player.statDefense * 0.03); + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * 0.03); } if (rum) { - if (player.statDefense > 0) - player.statDefense -= (int)(player.statDefense * 0.05); + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * 0.05); } if (whiskey) { - if (player.statDefense > 0) - player.statDefense -= (int)(player.statDefense * 0.05); + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * 0.05); } if (everclear) { - if (player.statDefense > 0) - player.statDefense -= (int)(player.statDefense * 0.3); + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * 0.3); } if (bloodyMary) { if (Main.bloodMoon) { - if (player.statDefense > 0) - player.statDefense -= (int)(player.statDefense * 0.04); + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * 0.04); } } if (caribbeanRum) { - if (player.statDefense > 0) - player.statDefense -= (int)(player.statDefense * 0.1); + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * 0.1); } if (cinnamonRoll) { - if (player.statDefense > 0) - player.statDefense -= (int)(player.statDefense * 0.1); + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * 0.1); } if (margarita) { - if (player.statDefense > 0) - player.statDefense -= (int)(player.statDefense * 0.06); + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * 0.06); } if (starBeamRye) { - if (player.statDefense > 0) - player.statDefense -= (int)(player.statDefense * 0.06); + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * 0.06); } if (whiteWine) { - if (player.statDefense > 0) - player.statDefense -= (int)(player.statDefense * 0.06); + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * 0.06); } } #endregion @@ -3870,27 +3871,27 @@ namespace CalamityMod.CalPlayer //not sure where else this should go if (forbiddenCirclet) { - float rogueDmg = player.thrownDamage + throwingDamage - 1f; - float minionDmg = player.minionDamage; + float rogueDmg = Player.GetDamage(DamageClass.Throwing) + throwingDamage - 1f; + float minionDmg = Player.GetDamage(DamageClass.Summon); if (minionDmg < rogueDmg) { - player.minionDamage = rogueDmg; + Player.GetDamage(DamageClass.Summon) = rogueDmg; } if (rogueDmg < minionDmg) { - throwingDamage = minionDmg - player.thrownDamage + 1f; + throwingDamage = minionDmg - Player.GetDamage(DamageClass.Throwing) + 1f; } } // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% - if (player.endurance > 0f) - player.endurance = 1f - (1f / (1f + player.endurance)); + if (Player.endurance > 0f) + Player.endurance = 1f - (1f / (1f + Player.endurance)); // Do not apply reduced aggro if there are any bosses alive and it's singleplayer if (areThereAnyDamnBosses && Main.netMode == NetmodeID.SinglePlayer) { - if (player.aggro < 0) - player.aggro = 0; + if (Player.aggro < 0) + Player.aggro = 0; } } #endregion @@ -3899,42 +3900,42 @@ namespace CalamityMod.CalPlayer private void EnduranceReductions() { if (vHex) - player.endurance -= 0.1f; + Player.endurance -= 0.1f; if (irradiated) - player.endurance -= 0.1f; + Player.endurance -= 0.1f; if (corrEffigy) - player.endurance -= 0.05f; + Player.endurance -= 0.05f; } #endregion #region Stat Meter private void UpdateStatMeter() { - float allDamageStat = player.allDamage - 1f; - damageStats[0] = (int)((player.meleeDamage + allDamageStat - 1f) * 100f); - damageStats[1] = (int)((player.rangedDamage + allDamageStat - 1f) * 100f); - damageStats[2] = (int)((player.magicDamage + allDamageStat - 1f) * 100f); - damageStats[3] = (int)((player.minionDamage + allDamageStat - 1f) * 100f); + float allDamageStat = Player.allDamage - 1f; + damageStats[0] = (int)((Player.GetDamage(DamageClass.Melee) + allDamageStat - 1f) * 100f); + damageStats[1] = (int)((Player.GetDamage(DamageClass.Ranged) + allDamageStat - 1f) * 100f); + damageStats[2] = (int)((Player.GetDamage(DamageClass.Magic) + allDamageStat - 1f) * 100f); + damageStats[3] = (int)((Player.GetDamage(DamageClass.Summon) + allDamageStat - 1f) * 100f); damageStats[4] = (int)((throwingDamage + allDamageStat - 1f) * 100f); damageStats[5] = (int)(trueMeleeDamage * 100D); - critStats[0] = player.meleeCrit; - critStats[1] = player.rangedCrit; - critStats[2] = player.magicCrit; - critStats[3] = player.thrownCrit + throwingCrit; + critStats[0] = Player.GetCritChance(DamageClass.Melee); + critStats[1] = Player.GetCritChance(DamageClass.Ranged); + critStats[2] = Player.GetCritChance(DamageClass.Magic); + critStats[3] = Player.GetCritChance(DamageClass.Throwing) + throwingCrit; ammoReductionRanged = (int)(100f * - (player.ammoBox ? 0.8f : 1f) * - (player.ammoPotion ? 0.8f : 1f) * - (player.ammoCost80 ? 0.8f : 1f) * - (player.ammoCost75 ? 0.75f : 1f) * + (Player.ammoBox ? 0.8f : 1f) * + (Player.ammoPotion ? 0.8f : 1f) * + (Player.ammoCost80 ? 0.8f : 1f) * + (Player.ammoCost75 ? 0.75f : 1f) * rangedAmmoCost); ammoReductionRogue = (int)(throwingAmmoCost * 100); // Cancel out defense damage for the purposes of the stat meter. - defenseStat = player.statDefense + CurrentDefenseDamage; - DRStat = (int)(player.endurance * 100f); - meleeSpeedStat = (int)((1f - player.meleeSpeed) * (100f / player.meleeSpeed)); - manaCostStat = (int)(player.manaCost * 100f); + defenseStat = Player.statDefense + CurrentDefenseDamage; + DRStat = (int)(Player.endurance * 100f); + meleeSpeedStat = (int)((1f - Player.meleeSpeed) * (100f / Player.meleeSpeed)); + manaCostStat = (int)(Player.manaCost * 100f); rogueVelocityStat = (int)((throwingVelocity - 1f) * 100f); // Max stealth 1f is actually "100 stealth", so multiply by 100 to get visual stealth number. @@ -3945,17 +3946,17 @@ namespace CalamityMod.CalPlayer standingRegenStat = (rogueStealthMax * 100f / 3f) * stealthGenStandstill; movingRegenStat = (rogueStealthMax * 100f / 9f) * stealthGenMoving * stealthAcceleration; - minionSlotStat = player.maxMinions; - manaRegenStat = player.manaRegen; - armorPenetrationStat = player.armorPenetration; - moveSpeedStat = (int)((player.moveSpeed - 1f) * 100f); - wingFlightTimeStat = player.wingTimeMax / 60f; - float trueJumpSpeedBoost = player.jumpSpeedBoost + - (player.wereWolf ? 0.2f : 0f) + - (player.jumpBoost ? 0.75f : 0f); + minionSlotStat = Player.maxMinions; + manaRegenStat = Player.manaRegen; + armorPenetrationStat = Player.armorPenetration; + moveSpeedStat = (int)((Player.moveSpeed - 1f) * 100f); + wingFlightTimeStat = Player.wingTimeMax / 60f; + float trueJumpSpeedBoost = Player.jumpSpeedBoost + + (Player.wereWolf ? 0.2f : 0f) + + (Player.jumpBoost ? 0.75f : 0f); jumpSpeedStat = trueJumpSpeedBoost * 20f; rageDamageStat = (int)(100D * RageDamageBoost); - adrenalineDamageStat = (int)(100D * player.Calamity().GetAdrenalineDamage()); + adrenalineDamageStat = (int)(100D * Player.Calamity().GetAdrenalineDamage()); int extraAdrenalineDR = 0 + (adrenalineBoostOne ? 5 : 0) + (adrenalineBoostTwo ? 5 : 0) + @@ -3967,7 +3968,7 @@ namespace CalamityMod.CalPlayer #region Double Jumps private void DoubleJumps() { - if (CalamityUtils.CountHookProj() > 0 || player.sliding || player.autoJump && player.justJumped) + if (CalamityUtils.CountHookProj() > 0 || Player.sliding || Player.autoJump && Player.justJumped) { jumpAgainSulfur = true; jumpAgainStatigel = true; @@ -3975,15 +3976,15 @@ namespace CalamityMod.CalPlayer } bool mountCheck = true; - if (player.mount != null && player.mount.Active) - mountCheck = player.mount.BlockExtraJumps; + if (Player.mount != null && Player.mount.Active) + mountCheck = Player.mount.BlockExtraJumps; bool carpetCheck = true; - if (player.carpet) - carpetCheck = player.carpetTime <= 0 && player.canCarpet; - bool wingCheck = player.wingTime == player.wingTimeMax || player.autoJump; - Tile tileBelow = CalamityUtils.ParanoidTileRetrieval((int)(player.Bottom.X / 16f), (int)(player.Bottom.Y / 16f)); + if (Player.carpet) + carpetCheck = Player.carpetTime <= 0 && Player.canCarpet; + bool wingCheck = Player.wingTime == Player.wingTimeMax || Player.autoJump; + Tile tileBelow = CalamityUtils.ParanoidTileRetrieval((int)(Player.Bottom.X / 16f), (int)(Player.Bottom.Y / 16f)); - if (player.position.Y == player.oldPosition.Y && wingCheck && mountCheck && carpetCheck && tileBelow.IsTileSolidGround()) + if (Player.position.Y == Player.oldPosition.Y && wingCheck && mountCheck && carpetCheck && tileBelow.IsTileSolidGround()) { jumpAgainSulfur = true; jumpAgainStatigel = true; @@ -3994,7 +3995,7 @@ namespace CalamityMod.CalPlayer #region Mouse Item Checks public void CheckIfMouseItemIsSchematic() { - if (Main.myPlayer != player.whoAmI) + if (Main.myPlayer != Player.whoAmI) return; bool shouldSync = false; @@ -4044,35 +4045,35 @@ namespace CalamityMod.CalPlayer { if (potionTimer > 0) potionTimer--; - if (potionTimer > 0 && player.potionDelay == 0) - player.potionDelay = potionTimer; + if (potionTimer > 0 && Player.potionDelay == 0) + Player.potionDelay = potionTimer; if (potionTimer == 1) { //Reduced duration than normal int duration = 3000; - if (player.pStone) + if (Player.pStone) duration = (int)(duration * 0.75); - player.ClearBuff(BuffID.PotionSickness); - player.AddBuff(BuffID.PotionSickness, duration); + Player.ClearBuff(BuffID.PotionSickness); + Player.AddBuff(BuffID.PotionSickness, duration); } if (PlayerInput.Triggers.JustPressed.QuickBuff) { for (int i = 0; i < Main.maxInventory; ++i) { - Item item = player.inventory[i]; + Item item = Player.inventory[i]; - if (player.potionDelay > 0 || potionTimer > 0) + if (Player.potionDelay > 0 || potionTimer > 0) break; if (item is null || item.stack <= 0) continue; if (item.type == ModContent.ItemType()) - CalamityUtils.ConsumeItemViaQuickBuff(player, item, SunkenStew.BuffType, SunkenStew.BuffDuration, true); + CalamityUtils.ConsumeItemViaQuickBuff(Player, item, SunkenStew.BuffType, SunkenStew.BuffDuration, true); if (item.type == ModContent.ItemType()) - CalamityUtils.ConsumeItemViaQuickBuff(player, item, Margarita.BuffType, Margarita.BuffDuration, false); + CalamityUtils.ConsumeItemViaQuickBuff(Player, item, Margarita.BuffType, Margarita.BuffDuration, false); if (item.type == ModContent.ItemType()) - CalamityUtils.ConsumeItemViaQuickBuff(player, item, Bloodfin.BuffType, Bloodfin.BuffDuration, false); + CalamityUtils.ConsumeItemViaQuickBuff(Player, item, Bloodfin.BuffType, Bloodfin.BuffDuration, false); } } } diff --git a/CalPlayer/CalamityPlayerNetcode.cs b/CalPlayer/CalamityPlayerNetcode.cs index b8de863662..ceb4810986 100644 --- a/CalPlayer/CalamityPlayerNetcode.cs +++ b/CalPlayer/CalamityPlayerNetcode.cs @@ -45,190 +45,190 @@ namespace CalamityMod.CalPlayer #region Creating and Sending Packets private void SyncExactLevel(bool server, int levelType) { - ModPacket packet = mod.GetPacket(); + ModPacket packet = Mod.GetPacket(); switch (levelType) { case 0: packet.Write((byte)CalamityModMessageType.ExactMeleeLevelSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(exactMeleeLevel); break; case 1: packet.Write((byte)CalamityModMessageType.ExactRangedLevelSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(exactRangedLevel); break; case 2: packet.Write((byte)CalamityModMessageType.ExactMagicLevelSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(exactMagicLevel); break; case 3: packet.Write((byte)CalamityModMessageType.ExactSummonLevelSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(exactSummonLevel); break; case 4: packet.Write((byte)CalamityModMessageType.ExactRogueLevelSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(exactRogueLevel); break; } - player.SendPacket(packet, server); + Player.SendPacket(packet, server); } private void SyncLevel(bool server, int levelType) { - ModPacket packet = mod.GetPacket(256); + ModPacket packet = Mod.GetPacket(256); switch (levelType) { case 0: packet.Write((byte)CalamityModMessageType.MeleeLevelSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(meleeLevel); break; case 1: packet.Write((byte)CalamityModMessageType.RangedLevelSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(rangedLevel); break; case 2: packet.Write((byte)CalamityModMessageType.MagicLevelSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(magicLevel); break; case 3: packet.Write((byte)CalamityModMessageType.SummonLevelSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(summonLevel); break; case 4: packet.Write((byte)CalamityModMessageType.RogueLevelSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(rogueLevel); break; } - player.SendPacket(packet, server); + Player.SendPacket(packet, server); } public void SyncMoveSpeed(bool server) { - ModPacket packet = mod.GetPacket(256); + ModPacket packet = Mod.GetPacket(256); packet.Write((byte)CalamityModMessageType.MoveSpeedStatSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(moveSpeedStat); - player.SendPacket(packet, server); + Player.SendPacket(packet, server); } public void SyncDefenseDamage(bool server) { - ModPacket packet = mod.GetPacket(256); + ModPacket packet = Mod.GetPacket(256); packet.Write((byte)CalamityModMessageType.DefenseDamageSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(totalDefenseDamage); packet.Write(defenseDamageRecoveryFrames); packet.Write(totalDefenseDamageRecoveryFrames); packet.Write(defenseDamageDelayFrames); - player.SendPacket(packet, server); + Player.SendPacket(packet, server); } public void SyncRage(bool server) { - ModPacket packet = mod.GetPacket(256); + ModPacket packet = Mod.GetPacket(256); packet.Write((byte)CalamityModMessageType.RageSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(rage); - player.SendPacket(packet, server); + Player.SendPacket(packet, server); } public void SyncAdrenaline(bool server) { - ModPacket packet = mod.GetPacket(256); + ModPacket packet = Mod.GetPacket(256); packet.Write((byte)CalamityModMessageType.AdrenalineSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(adrenaline); - player.SendPacket(packet, server); + Player.SendPacket(packet, server); } public void SyncCooldownAddition(bool server, CooldownInstance cd) { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = mod.GetPacket(256); + ModPacket packet = Mod.GetPacket(256); packet.Write((byte)CalamityModMessageType.CooldownAddition); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); cd.Write(packet); - player.SendPacket(packet, server); + Player.SendPacket(packet, server); } public void SyncCooldownRemoval(bool server, IList cooldownIDs) { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = mod.GetPacket(256); + ModPacket packet = Mod.GetPacket(256); packet.Write((byte)CalamityModMessageType.CooldownRemoval); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(cooldownIDs.Count); foreach (string id in cooldownIDs) packet.Write(CooldownRegistry.Get(id).netID); - player.SendPacket(packet, server); + Player.SendPacket(packet, server); } public void SyncCooldownDictionary(bool server) { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = mod.GetPacket(1024); + ModPacket packet = Mod.GetPacket(1024); packet.Write((byte)CalamityModMessageType.SyncCooldownDictionary); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(cooldowns.Count); foreach (CooldownInstance cd in cooldowns.Values) cd.Write(packet); - player.SendPacket(packet, server); + Player.SendPacket(packet, server); } private void SyncDeathCount(bool server) { - ModPacket packet = mod.GetPacket(256); + ModPacket packet = Mod.GetPacket(256); packet.Write((byte)CalamityModMessageType.DeathCountSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(deathCount); - player.SendPacket(packet, server); + Player.SendPacket(packet, server); } public void SyncItemTypeLastReforged(bool server) { - ModPacket packet = mod.GetPacket(256); + ModPacket packet = Mod.GetPacket(256); packet.Write((byte)CalamityModMessageType.ItemTypeLastReforgedSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(itemTypeLastReforged); - player.SendPacket(packet, server); + Player.SendPacket(packet, server); } public void SyncReforgeTierSafety(bool server) { - ModPacket packet = mod.GetPacket(256); + ModPacket packet = Mod.GetPacket(256); packet.Write((byte)CalamityModMessageType.ReforgeTierSafetySync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(reforgeTierSafety); - player.SendPacket(packet, server); + Player.SendPacket(packet, server); } public void SyncRightClick(bool server) { - ModPacket packet = mod.GetPacket(256); + ModPacket packet = Mod.GetPacket(256); packet.Write((byte)CalamityModMessageType.RightClickSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.Write(mouseRight); - player.SendPacket(packet, server); + Player.SendPacket(packet, server); } public void SyncMousePosition(bool server) { - ModPacket packet = mod.GetPacket(256); + ModPacket packet = Mod.GetPacket(256); packet.Write((byte)CalamityModMessageType.MousePositionSync); - packet.Write(player.whoAmI); + packet.Write(Player.whoAmI); packet.WriteVector2(mouseWorld); - player.SendPacket(packet, server); + Player.SendPacket(packet, server); } #endregion diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 54401e47e7..ee10753f19 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -23,6 +23,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.CalPlayer { @@ -45,14 +46,14 @@ namespace CalamityMod.CalPlayer #region On Hit NPC public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit) { - if (player.whoAmI != Main.myPlayer) + if (Player.whoAmI != Main.myPlayer) return; // Handle on-hit melee effects for the gem tech armor set. GemTechState.MeleeOnHitEffects(target); // Handle on-hit melee effects for the mythril armor set. - MythrilArmorSetChange.OnHitEffects(target, damage, player); + MythrilArmorSetChange.OnHitEffects(target, damage, Player); if (witheringWeaponEnchant) witheringDamageDone += (int)(damage * (crit ? 2D : 1D)); @@ -73,9 +74,9 @@ namespace CalamityMod.CalPlayer break; case ItemID.PalladiumSword: - if (!target.canGhostHeal || player.moonLeech) + if (!target.canGhostHeal || Player.moonLeech) return; - player.lifeRegenTime += 2; + Player.lifeRegenTime += 2; break; case ItemID.MythrilSword: @@ -83,8 +84,8 @@ namespace CalamityMod.CalPlayer break; case ItemID.OrichalcumSword: - if (player.petalTimer > 0) - player.petalTimer /= 2; + if (Player.petalTimer > 0) + Player.petalTimer /= 2; break; case ItemID.AdamantiteSword: @@ -95,10 +96,10 @@ namespace CalamityMod.CalPlayer break; case ItemID.CandyCaneSword: - if (!target.canGhostHeal || player.moonLeech) + if (!target.canGhostHeal || Player.moonLeech) return; - player.statLife += 2; - player.HealEffect(2); + Player.statLife += 2; + Player.HealEffect(2); break; case ItemID.TheHorsemansBlade: @@ -168,14 +169,14 @@ namespace CalamityMod.CalPlayer if (target.type == NPCID.TargetDummy || target.type == NPCType()) return; if (rageModeActive && shatteredCommunity) - ShatteredCommunity.AccumulateRageDamage(player, this, damage); + ShatteredCommunity.AccumulateRageDamage(Player, this, damage); } #endregion #region On Hit NPC With Proj public override void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit) { - if (player.whoAmI != Main.myPlayer) + if (Player.whoAmI != Main.myPlayer) return; CalamityGlobalNPC cgn = target.Calamity(); @@ -185,7 +186,7 @@ namespace CalamityMod.CalPlayer // Handle on-hit projectiles effects for the mythril armor set. if (proj.type != ModContent.ProjectileType()) - MythrilArmorSetChange.OnHitEffects(target, damage, player); + MythrilArmorSetChange.OnHitEffects(target, damage, Player); if (witheringWeaponEnchant) witheringDamageDone += (int)(damage * (crit ? 2D : 1D)); @@ -201,9 +202,9 @@ namespace CalamityMod.CalPlayer break; case ProjectileID.PalladiumPike: - if (!target.canGhostHeal || player.moonLeech) + if (!target.canGhostHeal || Player.moonLeech) return; - player.lifeRegenTime += 2; + Player.lifeRegenTime += 2; break; case ProjectileID.MythrilHalberd: @@ -211,8 +212,8 @@ namespace CalamityMod.CalPlayer break; case ProjectileID.OrichalcumHalberd: - if (player.petalTimer > 0) - player.petalTimer /= 2; + if (Player.petalTimer > 0) + Player.petalTimer /= 2; break; case ProjectileID.AdamantiteGlaive: @@ -223,10 +224,10 @@ namespace CalamityMod.CalPlayer break; case ProjectileID.FruitcakeChakram: - if (!target.canGhostHeal || player.moonLeech) + if (!target.canGhostHeal || Player.moonLeech) return; - player.statLife += 2; - player.HealEffect(2); + Player.statLife += 2; + Player.HealEffect(2); break; case ProjectileID.TheRottedFork: @@ -347,7 +348,7 @@ namespace CalamityMod.CalPlayer if ((plaguebringerCarapace || uberBees) && CalamityLists.friendlyBeeList.Contains(proj.type)) target.AddBuff(BuffType(), 300); - if (proj.type == ProjectileID.IchorArrow && player.ActiveItem().type == ItemType()) + if (proj.type == ProjectileID.IchorArrow && Player.ActiveItem().type == ItemType()) target.AddBuff(BuffID.Midas, 300, false); // All projectiles fired from Soma Prime are marked using CalamityGlobalProjectile @@ -356,7 +357,7 @@ namespace CalamityMod.CalPlayer { target.AddBuff(BuffType(), 320); // This information cannot be transferred through the buff, but is necessary to calculate damage - cgn.somaShredApplicator = player.whoAmI; + cgn.somaShredApplicator = Player.whoAmI; } ProjLifesteal(target, proj, damage, crit); @@ -368,7 +369,7 @@ namespace CalamityMod.CalPlayer return; if (rageModeActive && shatteredCommunity) - ShatteredCommunity.AccumulateRageDamage(player, this, damage); + ShatteredCommunity.AccumulateRageDamage(Player, this, damage); } } #endregion @@ -376,29 +377,29 @@ namespace CalamityMod.CalPlayer #region PvP public override void OnHitPvp(Item item, Player target, int damage, bool crit) { - if (player.whoAmI != Main.myPlayer) + if (Player.whoAmI != Main.myPlayer) return; switch (item.type) { case ItemID.PalladiumSword: case ItemID.PalladiumPike: - if (player.moonLeech) + if (Player.moonLeech) return; - player.lifeRegenTime += 2; + Player.lifeRegenTime += 2; break; case ItemID.OrichalcumSword: case ItemID.OrichalcumHalberd: - if (player.petalTimer > 0) - player.petalTimer /= 2; + if (Player.petalTimer > 0) + Player.petalTimer /= 2; break; case ItemID.CandyCaneSword: - if (player.moonLeech) + if (Player.moonLeech) return; - player.statLife += 2; - player.HealEffect(2); + Player.statLife += 2; + Player.HealEffect(2); break; case ItemID.DeathSickle: @@ -453,27 +454,27 @@ namespace CalamityMod.CalPlayer public override void OnHitPvpWithProj(Projectile proj, Player target, int damage, bool crit) { - if (player.whoAmI != Main.myPlayer) + if (Player.whoAmI != Main.myPlayer) return; switch (proj.type) { case ProjectileID.PalladiumPike: - if (player.moonLeech) + if (Player.moonLeech) return; - player.lifeRegenTime += 2; + Player.lifeRegenTime += 2; break; case ProjectileID.OrichalcumHalberd: - if (player.petalTimer > 0) - player.petalTimer /= 2; + if (Player.petalTimer > 0) + Player.petalTimer /= 2; break; case ProjectileID.FruitcakeChakram: - if (player.moonLeech) + if (Player.moonLeech) return; - player.statLife += 2; - player.HealEffect(2); + Player.statLife += 2; + Player.HealEffect(2); break; case ProjectileID.TheRottedFork: @@ -591,18 +592,18 @@ namespace CalamityMod.CalPlayer #region Item public void ItemOnHit(Item item, int damage, Vector2 position, bool crit, bool npcCheck) { - if (!item.melee && player.meleeEnchant == 7) - Projectile.NewProjectile(position, player.velocity, ProjectileID.ConfettiMelee, 0, 0f, player.whoAmI); + if (!item.melee && Player.meleeEnchant == 7) + Projectile.NewProjectile(position, Player.velocity, ProjectileID.ConfettiMelee, 0, 0f, Player.whoAmI); if (reaverDefense) - player.lifeRegenTime += 1; + Player.lifeRegenTime += 1; - if (player.whoAmI == Main.myPlayer && desertProwler && crit && item.ranged) + if (Player.whoAmI == Main.myPlayer && desertProwler && crit && item.ranged) { - bool noTornado = player.ownedProjectileCounts[ProjectileType()] < 1 && player.ownedProjectileCounts[ProjectileType()] < 1; + bool noTornado = Player.ownedProjectileCounts[ProjectileType()] < 1 && Player.ownedProjectileCounts[ProjectileType()] < 1; if (noTornado && Main.rand.NextBool(15)) { - Projectile.NewProjectile(position, Vector2.Zero, ProjectileType(), damage, item.knockBack, player.whoAmI); + Projectile.NewProjectile(position, Vector2.Zero, ProjectileType(), damage, item.knockBack, Player.whoAmI); } } @@ -612,14 +613,14 @@ namespace CalamityMod.CalPlayer { aBulwarkRareTimer = 10; for (int n = 0; n < 3; n++) - CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileType(), (int)(320 * player.AverageDamage()), 5f, player.whoAmI); + CalamityUtils.ProjectileRain(Player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileType(), (int)(320 * Player.AverageDamage()), 5f, Player.whoAmI); } - if (unstablePrism && crit && player.ownedProjectileCounts[ProjectileType()] < 5) + if (unstablePrism && crit && Player.ownedProjectileCounts[ProjectileType()] < 5) { for (int s = 0; s < 3; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(15 * player.AverageDamage()), 0f, player.whoAmI); + Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(15 * Player.AverageDamage()), 0f, Player.whoAmI); } } if (astralStarRain && crit && astralStarRainCooldown <= 0) @@ -633,7 +634,7 @@ namespace CalamityMod.CalPlayer ProjectileID.HallowStar, ProjectileType() }); - Projectile star = CalamityUtils.ProjectileRain(position, 400f, 100f, 500f, 800f, 12f, projectileType, (int)(120 * player.AverageDamage()), 5f, player.whoAmI); + Projectile star = CalamityUtils.ProjectileRain(position, 400f, 100f, 500f, 800f, 12f, projectileType, (int)(120 * Player.AverageDamage()), 5f, Player.whoAmI); if (star.whoAmI.WithinBounds(Main.maxProjectiles)) star.Calamity().forceTypeless = true; } @@ -645,25 +646,25 @@ namespace CalamityMod.CalPlayer titanBoost = 600; if (npcCheck) { - if (ataxiaGeyser && player.ownedProjectileCounts[ProjectileType()] < 3) + if (ataxiaGeyser && Player.ownedProjectileCounts[ProjectileType()] < 3) { // Ataxia True Melee Geysers: 15%, softcap starts at 300 base damage int geyserDamage = CalamityUtils.DamageSoftCap(damage * 0.15, 45); - Projectile.NewProjectile(position, Vector2.Zero, ProjectileType(), geyserDamage, 2f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, Vector2.Zero, ProjectileType(), geyserDamage, 2f, Player.whoAmI, 0f, 0f); } if (soaring) { double useTimeMultiplier = 0.85 + (item.useTime * item.useAnimation / 3600D); //28 * 28 = 784 is average so that equals 784 / 3600 = 0.217777 + 1 = 21.7% boost - double wingTimeFraction = player.wingTimeMax / 20D; - double meleeStatMultiplier = (double)(player.meleeDamage * (float)(player.meleeCrit / 10D)); + double wingTimeFraction = Player.wingTimeMax / 20D; + double meleeStatMultiplier = (double)(Player.GetDamage(DamageClass.Melee) * (float)(Player.GetCritChance(DamageClass.Melee) / 10D)); - if (player.wingTime < player.wingTimeMax) - player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); + if (Player.wingTime < Player.wingTimeMax) + Player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); - if (player.wingTime > player.wingTimeMax) - player.wingTime = player.wingTimeMax; + if (Player.wingTime > Player.wingTimeMax) + Player.wingTime = Player.wingTimeMax; } - if (bloodflareMelee && item.melee && bloodflareMeleeHits < 15 && !bloodflareFrenzy && !player.HasCooldown(BloodflareFrenzy.ID)) + if (bloodflareMelee && item.melee && bloodflareMeleeHits < 15 && !bloodflareFrenzy && !Player.HasCooldown(BloodflareFrenzy.ID)) bloodflareMeleeHits++; } } @@ -677,30 +678,30 @@ namespace CalamityMod.CalPlayer bool hasClass = proj.melee || proj.ranged || proj.magic || proj.IsSummon() || modProj.rogue; //flask of party affects all types of weapons, !proj.melee is to prevent double flask effects - if (!proj.melee && player.meleeEnchant == 7) + if (!proj.melee && Player.meleeEnchant == 7) Projectile.NewProjectile(position, proj.velocity, ProjectileID.ConfettiMelee, 0, 0f, proj.owner); - if (alchFlask && player.ownedProjectileCounts[ProjectileType()] < 3 && hasClass) + if (alchFlask && Player.ownedProjectileCounts[ProjectileType()] < 3 && hasClass) { - Projectile projectile = CalamityGlobalProjectile.SpawnOrb(proj, (int)(30 * player.AverageDamage()), ProjectileType(), 400f, 12f); + Projectile projectile = CalamityGlobalProjectile.SpawnOrb(proj, (int)(30 * Player.AverageDamage()), ProjectileType(), 400f, 12f); if (projectile.whoAmI.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile.whoAmI].Calamity().forceTypeless = true; } - if (theBee && player.statLife >= player.statLifeMax2) - Main.PlaySound(SoundID.Item110, proj.Center); + if (theBee && Player.statLife >= Player.statLifeMax2) + SoundEngine.PlaySound(SoundID.Item110, proj.Center); if (reaverDefense) - player.lifeRegenTime += 1; + Player.lifeRegenTime += 1; if (npcCheck) { - if (unstablePrism && crit && player.ownedProjectileCounts[ProjectileType()] < 5) + if (unstablePrism && crit && Player.ownedProjectileCounts[ProjectileType()] < 5) { for (int s = 0; s < 3; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(15 * player.AverageDamage()), 0f, player.whoAmI); + Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(15 * Player.AverageDamage()), 0f, Player.whoAmI); } } @@ -715,7 +716,7 @@ namespace CalamityMod.CalPlayer ProjectileID.HallowStar, ProjectileType() }); - Projectile star = CalamityUtils.ProjectileRain(position, 400f, 100f, 500f, 800f, 25f, projectileType, (int)(120 * player.AverageDamage()), 5f, player.whoAmI); + Projectile star = CalamityUtils.ProjectileRain(position, 400f, 100f, 500f, 800f, 25f, projectileType, (int)(120 * Player.AverageDamage()), 5f, Player.whoAmI); if (star.whoAmI.WithinBounds(Main.maxProjectiles)) star.Calamity().forceTypeless = true; } @@ -737,7 +738,7 @@ namespace CalamityMod.CalPlayer #region Melee private void MeleeOnHit(Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) { - Item heldItem = player.ActiveItem(); + Item heldItem = Player.ActiveItem(); if (modProj.trueMelee) { @@ -745,32 +746,32 @@ namespace CalamityMod.CalPlayer if (soaring) { double useTimeMultiplier = 0.85 + (heldItem.useTime * heldItem.useAnimation / 3600D); //28 * 28 = 784 is average so that equals 784 / 3600 = 0.217777 + 1 = 21.7% boost - double wingTimeFraction = player.wingTimeMax / 20D; - double meleeStatMultiplier = player.meleeDamage * (float)(player.meleeCrit / 10D); + double wingTimeFraction = Player.wingTimeMax / 20D; + double meleeStatMultiplier = Player.GetDamage(DamageClass.Melee) * (float)(Player.GetCritChance(DamageClass.Melee) / 10D); - if (player.wingTime < player.wingTimeMax) - player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); + if (Player.wingTime < Player.wingTimeMax) + Player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); - if (player.wingTime > player.wingTimeMax) - player.wingTime = player.wingTimeMax; + if (Player.wingTime > Player.wingTimeMax) + Player.wingTime = Player.wingTimeMax; } if (aBulwarkRare && aBulwarkRareTimer == 0) { aBulwarkRareTimer = 10; for (int n = 0; n < 3; n++) - CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileType(), (int)(320 * player.AverageDamage()), 5f, player.whoAmI); + CalamityUtils.ProjectileRain(Player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileType(), (int)(320 * Player.AverageDamage()), 5f, Player.whoAmI); } } if (npcCheck) { - if (ataxiaGeyser && player.ownedProjectileCounts[ProjectileType()] < 3) + if (ataxiaGeyser && Player.ownedProjectileCounts[ProjectileType()] < 3) { // Ataxia Melee Geysers: 15%, softcap starts at 240 base damage int geyserDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.15, 36); - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), geyserDamage, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), geyserDamage, 0f, Player.whoAmI, 0f, 0f); } - if (bloodflareMelee && modProj.trueMelee && bloodflareMeleeHits < 15 && !bloodflareFrenzy && !player.HasCooldown(BloodflareFrenzy.ID)) + if (bloodflareMelee && modProj.trueMelee && bloodflareMeleeHits < 15 && !bloodflareFrenzy && !Player.HasCooldown(BloodflareFrenzy.ID)) bloodflareMeleeHits++; } } @@ -779,12 +780,12 @@ namespace CalamityMod.CalPlayer #region Ranged private void RangedOnHit(Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) { - if (player.whoAmI == Main.myPlayer && desertProwler && crit) + if (Player.whoAmI == Main.myPlayer && desertProwler && crit) { - bool noTornado = player.ownedProjectileCounts[ProjectileType()] < 1 && player.ownedProjectileCounts[ProjectileType()] < 1; + bool noTornado = Player.ownedProjectileCounts[ProjectileType()] < 1 && Player.ownedProjectileCounts[ProjectileType()] < 1; if (noTornado && Main.rand.NextBool(15)) { - Projectile.NewProjectile(position, Vector2.Zero, ProjectileType(), proj.damage, proj.knockBack, player.whoAmI); + Projectile.NewProjectile(position, Vector2.Zero, ProjectileType(), proj.damage, proj.knockBack, Player.whoAmI); } } @@ -797,14 +798,14 @@ namespace CalamityMod.CalPlayer { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); int leafDamage = (int)(0.25 * proj.damage); - int leaf = Projectile.NewProjectile(position, velocity, ProjectileID.Leaf, leafDamage, 0f, player.whoAmI); + int leaf = Projectile.NewProjectile(position, velocity, ProjectileID.Leaf, leafDamage, 0f, Player.whoAmI); if (leaf.WithinBounds(Main.maxProjectiles)) { Main.projectile[leaf].Calamity().forceTypeless = true; Main.projectile[leaf].netUpdate = true; } } - if (player.ownedProjectileCounts[ProjectileType()] < 2) + if (Player.ownedProjectileCounts[ProjectileType()] < 2) { for (int projCount = 0; projCount < 2; projCount++) { @@ -846,7 +847,7 @@ namespace CalamityMod.CalPlayer Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); // Bloodflare Mage Fireballs: 3 x 50%, softcap starts at 500 base damage to not overly punish slow weapons int bloodflareFireballDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.5, 250); - int fire = Projectile.NewProjectile(position, velocity, ProjectileID.BallofFire, bloodflareFireballDamage, 0f, player.whoAmI); + int fire = Projectile.NewProjectile(position, velocity, ProjectileID.BallofFire, bloodflareFireballDamage, 0f, Player.whoAmI); if (fire.WithinBounds(Main.maxProjectiles)) { Main.projectile[fire].Calamity().forceTypeless = true; @@ -858,10 +859,10 @@ namespace CalamityMod.CalPlayer if (silvaMage && silvaMageCooldown <= 0 && (proj.penetrate == 1 || proj.timeLeft <= 5)) { silvaMageCooldown = 300; - Main.PlaySound(SoundID.Zombie, (int)proj.position.X, (int)proj.position.Y, 103); + SoundEngine.PlaySound(SoundID.Zombie, (int)proj.position.X, (int)proj.position.Y, 103); // Silva Mage Blasts: 800 + 60%, softcap on the whole combined thing starts at 1400 int silvaBurstDamage = CalamityUtils.DamageSoftCap(800.0 + 0.6 * proj.damage, 1400); - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), silvaBurstDamage, 8f, player.whoAmI); + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), silvaBurstDamage, 8f, Player.whoAmI); } } #endregion @@ -882,31 +883,31 @@ namespace CalamityMod.CalPlayer empowerBuff, shieldBuff }); - player.AddBuff(buffType, 60); + Player.AddBuff(buffType, 60); if (buffType == restoreBuff) { - if (phantomicHeartRegen == 1000 && player.ownedProjectileCounts[ProjectileType()] == 0 && Main.rand.NextBool(20)) + if (phantomicHeartRegen == 1000 && Player.ownedProjectileCounts[ProjectileType()] == 0 && Main.rand.NextBool(20)) { Vector2 target = proj.Center; target.Y += Main.rand.Next(-50, 50); target.X += Main.rand.Next(-50, 50); - Projectile.NewProjectile(target, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 0f); + Projectile.NewProjectile(target, Vector2.Zero, ProjectileType(), 0, 0f, Player.whoAmI, 0f); } } else if (buffType == empowerBuff) { - if (player.ownedProjectileCounts[ProjectileType()] < 3 && Main.rand.NextBool(10)) + if (Player.ownedProjectileCounts[ProjectileType()] < 3 && Main.rand.NextBool(10)) { - int damage = (int)(75 * player.MinionDamage()); - int dagger = Projectile.NewProjectile(proj.position, proj.velocity, ProjectileType(), damage, 1f, player.whoAmI, 0f); + int damage = (int)(75 * Player.MinionDamage()); + int dagger = Projectile.NewProjectile(proj.position, proj.velocity, ProjectileType(), damage, 1f, Player.whoAmI, 0f); if (dagger.WithinBounds(Main.maxProjectiles)) Main.projectile[dagger].Calamity().forceTypeless = true; } } else { - if (player.ownedProjectileCounts[ProjectileType()] == 0 && phantomicBulwarkCooldown == 0) - Projectile.NewProjectile(player.position, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 0f); + if (Player.ownedProjectileCounts[ProjectileType()] == 0 && phantomicBulwarkCooldown == 0) + Projectile.NewProjectile(Player.position, Vector2.Zero, ProjectileType(), 0, 0f, Player.whoAmI, 0f); } } else if (hallowedRune) @@ -917,7 +918,7 @@ namespace CalamityMod.CalPlayer BuffType(), BuffType() }); - player.AddBuff(buffType, 60); + Player.AddBuff(buffType, 60); } else if (sGenerator) { @@ -927,7 +928,7 @@ namespace CalamityMod.CalPlayer BuffType(), BuffType() }); - player.AddBuff(buffType, 60); + Player.AddBuff(buffType, 60); } } @@ -955,28 +956,28 @@ namespace CalamityMod.CalPlayer { if (nucleogenesis) { - int projectile = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(60 * player.MinionDamage()), 4f, proj.owner); + int projectile = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(60 * Player.MinionDamage()), 4f, proj.owner); if (projectile.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile].Calamity().forceTypeless = true; jellyDmg = 100f; } else if (starbusterCore) { - int projectile = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(40 * player.MinionDamage()), 3.5f, proj.owner); + int projectile = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(40 * Player.MinionDamage()), 3.5f, proj.owner); if (projectile.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile].Calamity().forceTypeless = true; jellyDmg = 60f; } else if (nuclearRod) { - int projectile = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(20 * player.MinionDamage()), 0f, proj.owner); + int projectile = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(20 * Player.MinionDamage()), 0f, proj.owner); if (projectile.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile].Calamity().forceTypeless = true; jellyDmg = 60f; } else if (jellyChargedBattery) { - CalamityGlobalProjectile.SpawnOrb(proj, (int)(15 * player.MinionDamage()), ProjectileType(), 800f, 15f); + CalamityGlobalProjectile.SpawnOrb(proj, (int)(15 * Player.MinionDamage()), ProjectileType(), 800f, 15f); jellyDmg = 60f; } } @@ -988,7 +989,7 @@ namespace CalamityMod.CalPlayer hallowedRuneCooldown = 180; Vector2 spawnPosition = position - new Vector2(0f, 920f).RotatedByRandom(0.3f); float speed = Main.rand.NextFloat(17f, 23f); - int projectile = Projectile.NewProjectile(spawnPosition, Vector2.Normalize(position - spawnPosition) * speed, ProjectileType(), (int)(30 * player.MinionDamage()), 3f, proj.owner); + int projectile = Projectile.NewProjectile(spawnPosition, Vector2.Normalize(position - spawnPosition) * speed, ProjectileType(), (int)(30 * Player.MinionDamage()), 3f, proj.owner); if (projectile.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile].Calamity().forceTypeless = true; } @@ -1024,13 +1025,13 @@ namespace CalamityMod.CalPlayer for (int x = projTileX; x < projTileX + distance; x++) { Tile tile = Main.tile[projTileX, projTileY]; - if (tile.active() && (Main.tileSolid[tile.type] || tile.liquid != 0)) + if (tile.active() && (Main.tileSolid[tile.TileType] || tile.liquid != 0)) { projTileX = x; break; } } - int projectileIndex = Projectile.NewProjectile(projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), (int)(550 * player.RogueDamage()), 15f, Main.myPlayer, 16f, 16f); + int projectileIndex = Projectile.NewProjectile(projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), (int)(550 * Player.RogueDamage()), 15f, Main.myPlayer, 16f, 16f); if (projectileIndex.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectileIndex].Calamity().forceTypeless = true; @@ -1039,10 +1040,10 @@ namespace CalamityMod.CalPlayer } } - if (crit && tarraThrowing && tarraThrowingCrits < 25 && !tarragonImmunity && !player.HasCooldown(Cooldowns.TarragonImmunity.ID)) + if (crit && tarraThrowing && tarraThrowingCrits < 25 && !tarragonImmunity && !Player.HasCooldown(Cooldowns.TarragonImmunity.ID)) tarraThrowingCrits++; - if (xerocSet && xerocDmg <= 0 && player.ownedProjectileCounts[ProjectileType()] < 3 && player.ownedProjectileCounts[ProjectileType()] < 3) + if (xerocSet && xerocDmg <= 0 && Player.ownedProjectileCounts[ProjectileType()] < 3 && Player.ownedProjectileCounts[ProjectileType()] < 3) { switch (Main.rand.Next(5)) { @@ -1093,12 +1094,12 @@ namespace CalamityMod.CalPlayer { Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (position - source) / 40f; - Projectile.NewProjectile(source, velocity, ProjectileType(), (int)(120 * player.RogueDamage()), 3f, proj.owner); + Projectile.NewProjectile(source, velocity, ProjectileType(), (int)(120 * Player.RogueDamage()), 3f, proj.owner); } } else if (moonCrown) { - int lunarFlareDamage = (int)(MoonstoneCrown.BaseDamage * player.RogueDamage()); + int lunarFlareDamage = (int)(MoonstoneCrown.BaseDamage * Player.RogueDamage()); float lunarFlareKB = 3f; for (int i = 0; i < 3; i++) { @@ -1117,7 +1118,7 @@ namespace CalamityMod.CalPlayer float speedX = (position.X - source.X) / 30f; float speedY = (position.Y - source.Y) * 8; Vector2 velocity = new Vector2(speedX, speedY); - int featherDamage = (int)(15 * player.RogueDamage()); + int featherDamage = (int)(15 * Player.RogueDamage()); int feather = Projectile.NewProjectile(source, velocity, ProjectileType(), featherDamage, 3f, proj.owner); if (feather.WithinBounds(Main.maxProjectiles)) Main.projectile[feather].Calamity().forceTypeless = true; @@ -1135,7 +1136,7 @@ namespace CalamityMod.CalPlayer float yVector = Main.rand.Next(-35, 36) * 0.02f; xVector *= 10f; yVector *= 10f; - int eater = Projectile.NewProjectile(proj.Center.X, proj.Center.Y, xVector, yVector, ProjectileType(), (int)(40 * player.RogueDamage()), proj.knockBack, proj.owner); + int eater = Projectile.NewProjectile(proj.Center.X, proj.Center.Y, xVector, yVector, ProjectileType(), (int)(40 * Player.RogueDamage()), proj.knockBack, proj.owner); if (eater.WithinBounds(Main.maxProjectiles)) Main.projectile[eater].Calamity().forceTypeless = true; forbiddenCooldown = 15; @@ -1144,8 +1145,8 @@ namespace CalamityMod.CalPlayer if (titanHeartSet && modProj.stealthStrike && titanCooldown <= 0 && modProj.stealthStrikeHitCount < 5) { - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(50 * player.RogueDamage()), proj.knockBack, proj.owner, 1f, 0f); - Main.PlaySound(SoundID.Item14, proj.Center); + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(50 * Player.RogueDamage()), proj.knockBack, proj.owner, 1f, 0f); + SoundEngine.PlaySound(SoundID.Item14, proj.Center); for (int dustexplode = 0; dustexplode < 360; dustexplode++) { Vector2 dustd = new Vector2(17f, 17f).RotatedBy(MathHelper.ToRadians(dustexplode)); @@ -1180,7 +1181,7 @@ namespace CalamityMod.CalPlayer if (type != -1) { float speed = Main.rand.NextFloat(5f, 11f); - int cloud = Projectile.NewProjectile(position, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, type, (int)(30 * player.RogueDamage()), proj.knockBack, player.whoAmI); + int cloud = Projectile.NewProjectile(position, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, type, (int)(30 * Player.RogueDamage()), proj.knockBack, Player.whoAmI); if (cloud.WithinBounds(Main.maxProjectiles)) Main.projectile[cloud].Calamity().forceTypeless = true; } @@ -1248,7 +1249,7 @@ namespace CalamityMod.CalPlayer { // Umbraphile Rogue Blasts: 25%, softcap starts at 200 base damage int umbraBlastDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.25, 50); - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), umbraBlastDamage, 0f, player.whoAmI); + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), umbraBlastDamage, 0f, Player.whoAmI); } if (raiderTalisman && raiderStack < 150 && crit && raiderCooldown <= 0) @@ -1261,7 +1262,7 @@ namespace CalamityMod.CalPlayer for (int s = 0; s < 3; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - int spark = Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(20 * player.RogueDamage()), 0f, player.whoAmI); + int spark = Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(20 * Player.RogueDamage()), 0f, Player.whoAmI); if (spark.WithinBounds(Main.maxProjectiles)) { Main.projectile[spark].Calamity().forceTypeless = true; @@ -1313,7 +1314,7 @@ namespace CalamityMod.CalPlayer } if (rogue) { - switch (player.meleeEnchant) + switch (Player.meleeEnchant) { case 1: target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); @@ -1413,9 +1414,9 @@ namespace CalamityMod.CalPlayer } if (vexation) { - if ((player.armor[0].type == ItemType() || player.armor[0].type == ItemType() || - player.armor[0].type == ItemType()) && player.armor[1].type == ItemType() && - player.armor[2].type == ItemType()) + if ((Player.armor[0].type == ItemType() || Player.armor[0].type == ItemType() || + Player.armor[0].type == ItemType()) && Player.armor[1].type == ItemType() && + Player.armor[2].type == ItemType()) { target.AddBuff(BuffID.CursedInferno, 90, false); target.AddBuff(BuffID.Venom, 120, false); @@ -1460,7 +1461,7 @@ namespace CalamityMod.CalPlayer } if (rogue) { - switch (player.meleeEnchant) + switch (Player.meleeEnchant) { case 1: target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); @@ -1549,9 +1550,9 @@ namespace CalamityMod.CalPlayer } if (vexation) { - if ((player.armor[0].type == ItemType() || player.armor[0].type == ItemType() || - player.armor[0].type == ItemType()) && player.armor[1].type == ItemType() && - player.armor[2].type == ItemType()) + if ((Player.armor[0].type == ItemType() || Player.armor[0].type == ItemType() || + Player.armor[0].type == ItemType()) && Player.armor[1].type == ItemType() && + Player.armor[2].type == ItemType()) { target.AddBuff(BuffID.CursedInferno, 90, false); target.AddBuff(BuffID.Venom, 120, false); @@ -1568,14 +1569,14 @@ namespace CalamityMod.CalPlayer // Spectre Damage set and Nebula set work on enemies which are "immune to lifesteal" if (!target.canGhostHeal) { - if (player.ghostHurt) + if (Player.ghostHurt) { proj.ghostHurt(damage, target.Center); } - if (player.setNebula && player.nebulaCD == 0 && Main.rand.NextBool(3)) + if (Player.setNebula && Player.nebulaCD == 0 && Main.rand.NextBool(3)) { - player.nebulaCD = 30; + Player.nebulaCD = 30; int boosterType = Utils.SelectRandom(Main.rand, new int[] { ItemID.NebulaPickup1, @@ -1592,7 +1593,7 @@ namespace CalamityMod.CalPlayer } } - if (bloodflareSet && !target.SpawnedFromStatue && (target.damage > 0 || target.boss) && !player.moonLeech) + if (bloodflareSet && !target.SpawnedFromStatue && (target.damage > 0 || target.boss) && !Player.moonLeech) { if ((target.life < target.lifeMax * 0.5) && bloodflareHeartTimer <= 0) { @@ -1601,10 +1602,10 @@ namespace CalamityMod.CalPlayer } } - if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && !player.moonLeech) + if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && !Player.moonLeech) { // Increases the degree to which Spectre Healing set contributes to the lifesteal cap - if (player.ghostHeal) + if (Player.ghostHeal) { float cooldownMult = 0.2f; cooldownMult -= proj.numHits * 0.05f; @@ -1629,13 +1630,13 @@ namespace CalamityMod.CalPlayer { float heal = MathHelper.Clamp(damage * 0.011f, 0f, 5f); if ((int)heal > 0) - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileID.VampireHeal, 1200f, 3f); } if (bloodyGlove && modProj.rogue && modProj.stealthStrike) { - player.statLife += 1; - player.HealEffect(1); + Player.statLife += 1; + Player.HealEffect(1); } if ((target.damage > 5 || target.boss) && !target.SpawnedFromStatue) @@ -1651,25 +1652,25 @@ namespace CalamityMod.CalPlayer if (cooldownMult < 0f) cooldownMult = 0f; - if (player.lifeSteal > 0f) + if (Player.lifeSteal > 0f) { - player.statLife += 1; - player.HealEffect(1); - player.lifeSteal -= cooldownMult * 2f; + Player.statLife += 1; + Player.HealEffect(1); + Player.lifeSteal -= cooldownMult * 2f; } } if (bloodflareMelee && modProj.trueMelee) { int healAmount = Main.rand.Next(2) + 1; - player.statLife += healAmount; - player.HealEffect(healAmount); + Player.statLife += healAmount; + Player.HealEffect(healAmount); } } bool otherHealTypes = auricSet || silvaSet || tarraMage || ataxiaMage; - if (proj.magic && player.ActiveItem().magic) + if (proj.magic && Player.ActiveItem().magic) { if (manaOverloader && otherHealTypes) { @@ -1677,7 +1678,7 @@ namespace CalamityMod.CalPlayer { float healMult = 0.2f; healMult -= proj.numHits * 0.05f; - float heal = damage * healMult * (player.statMana / (float)player.statManaMax2); + float heal = damage * healMult * (Player.statMana / (float)Player.statManaMax2); if (heal > CalamityMod.lifeStealCap) heal = CalamityMod.lifeStealCap; @@ -1685,7 +1686,7 @@ namespace CalamityMod.CalPlayer if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) return; - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); } } } @@ -1702,7 +1703,7 @@ namespace CalamityMod.CalPlayer if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) return; - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); } else if (silvaSet) { @@ -1716,15 +1717,15 @@ namespace CalamityMod.CalPlayer if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) return; - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); } - else if (proj.magic && player.ActiveItem().magic) + else if (proj.magic && Player.ActiveItem().magic) { if (manaOverloader) { float healMult = 0.2f; healMult -= proj.numHits * 0.05f; - float heal = damage * healMult * (player.statMana / (float)player.statManaMax2); + float heal = damage * healMult * (Player.statMana / (float)Player.statManaMax2); if (heal > CalamityMod.lifeStealCap) heal = CalamityMod.lifeStealCap; @@ -1732,7 +1733,7 @@ namespace CalamityMod.CalPlayer if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) return; - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); } if (tarraMage) @@ -1754,11 +1755,11 @@ namespace CalamityMod.CalPlayer Main.player[Main.myPlayer].lifeSteal -= heal * 6f; int healAmount = (int)heal; - player.statLife += healAmount; - player.HealEffect(healAmount); + Player.statLife += healAmount; + Player.HealEffect(healAmount); - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; + if (Player.statLife > Player.statLifeMax2) + Player.statLife = Player.statLifeMax2; } } else if (ataxiaMage) @@ -1773,7 +1774,7 @@ namespace CalamityMod.CalPlayer if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) return; - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); } } @@ -1791,12 +1792,12 @@ namespace CalamityMod.CalPlayer if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) return; - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); } if (modProj.rogue) { - if (xerocSet && xerocDmg <= 0 && player.ownedProjectileCounts[ProjectileType()] < 3 && player.ownedProjectileCounts[ProjectileType()] < 3) + if (xerocSet && xerocDmg <= 0 && Player.ownedProjectileCounts[ProjectileType()] < 3 && Player.ownedProjectileCounts[ProjectileType()] < 3) { float healMult = 0.06f; healMult -= proj.numHits * 0.015f; @@ -1808,7 +1809,7 @@ namespace CalamityMod.CalPlayer if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) return; - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), 1200f, 3f); } } } @@ -1825,19 +1826,19 @@ namespace CalamityMod.CalPlayer } } - if ((target.damage > 5 || target.boss) && !target.SpawnedFromStatue && target.canGhostHeal && !player.moonLeech) + if ((target.damage > 5 || target.boss) && !target.SpawnedFromStatue && target.canGhostHeal && !Player.moonLeech) { if (bloodflareMelee && item.melee) { int healAmount = Main.rand.Next(2) + 1; - player.statLife += healAmount; - player.HealEffect(healAmount); + Player.statLife += healAmount; + Player.HealEffect(healAmount); } } if (reaverDefense) { - if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && !player.moonLeech) + if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && !Player.moonLeech) { float healMult = 0.2f; float heal = damage * healMult; @@ -1852,11 +1853,11 @@ namespace CalamityMod.CalPlayer Main.player[Main.myPlayer].lifeSteal -= heal * 3f; float lowestHealthCheck = 0f; - int healTarget = player.whoAmI; + int healTarget = Player.whoAmI; for (int i = 0; i < Main.maxPlayers; i++) { Player otherPlayer = Main.player[i]; - if (otherPlayer.active && !otherPlayer.dead && ((!player.hostile && !otherPlayer.hostile) || player.team == otherPlayer.team)) + if (otherPlayer.active && !otherPlayer.dead && ((!Player.hostile && !otherPlayer.hostile) || Player.team == otherPlayer.team)) { float playerDist = Vector2.Distance(target.Center, otherPlayer.Center); if (playerDist < 1200f && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) @@ -1867,7 +1868,7 @@ namespace CalamityMod.CalPlayer } } - Projectile.NewProjectile(target.Center, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, healTarget, heal); + Projectile.NewProjectile(target.Center, Vector2.Zero, ProjectileType(), 0, 0f, Player.whoAmI, healTarget, heal); } } } diff --git a/CalamityConfig.cs b/CalamityConfig.cs index 8d84629f6f..a20252eaf4 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -324,22 +324,22 @@ namespace CalamityMod { new [] { "Afterimages", ItemID.SteampunkGoggles.ToString(), "Afterimages" }, new [] { "MaxParticles", ItemID.FragmentStardust.ToString(), "Maximum particles" }, - new [] { "ScreenshakeOff", instance.ItemType("WavePounder").ToString(), "Disable Screenshakes" }, - new [] { "StealthInvisibility", instance.ItemType("StealthHairDye").ToString(), "Stealth Invisibility" }, + new [] { "ScreenshakeOff", instance.Find("WavePounder").Type.ToString(), "Disable Screenshakes" }, + new [] { "StealthInvisibility", instance.Find("StealthHairDye").Type.ToString(), "Stealth Invisibility" }, new [] { "ShopAlert", ItemID.GoldChest.ToString(), "New Shop Inventory Alert" }, - new [] { "BossHealthBar", instance.ItemType("BloodOrange").ToString(), "Boss Health Bars" }, - new [] { "BossHealthBarExtra", instance.ItemType("EncryptedSchematicPlanetoid").ToString(), "Boss Health Bar Extra Info" }, + new [] { "BossHealthBar", instance.Find("BloodOrange").Type.ToString(), "Boss Health Bars" }, + new [] { "BossHealthBarExtra", instance.Find("EncryptedSchematicPlanetoid").Type.ToString(), "Boss Health Bar Extra Info" }, new [] { "DebuffDisplay", ItemID.FlaskofIchor.ToString(), "Boss and Miniboss Debuff Display" }, - new [] { "CooldownDisplay", instance.ItemType("NebulousCore").ToString(), "Cooldown Display" }, + new [] { "CooldownDisplay", instance.Find("NebulousCore").Type.ToString(), "Cooldown Display" }, new [] { "VanillaCooldownDisplay", ItemID.HealingPotion.ToString(), "Vanilla Cooldowns Display" }, new [] { "MeterLock", ItemID.GemLockTopaz.ToString(), "Lock Meter Positions" }, - new [] { "StealthMeter", instance.ItemType("EclipseMirror").ToString(), "Stealth Meter" }, + new [] { "StealthMeter", instance.Find("EclipseMirror").Type.ToString(), "Stealth Meter" }, new [] { "StealthMeterX", ItemID.LaserRuler.ToString(), "Stealth Meter X Position" }, new [] { "StealthMeterY", ItemID.LaserRuler.ToString(), "Stealth Meter Y Position" }, - new [] { "ChargeMeter", instance.ItemType("PowerCell").ToString(), "Charge Meter" }, + new [] { "ChargeMeter", instance.Find("PowerCell").Type.ToString(), "Charge Meter" }, new [] { "ChargeMeterX", ItemID.LaserRuler.ToString(), "Charge Meter X Position" }, new [] { "ChargeMeterY", ItemID.LaserRuler.ToString(), "Charge Meter Y Position" }, @@ -348,8 +348,8 @@ namespace CalamityMod new [] { "SpeedrunTimerY", ItemID.LaserRuler.ToString(), "Speedrun Timer Y Position" }, new [] { "EarlyHMRework", ItemID.Pwnhammer.ToString(), "Early Hardmode Progression Rework" }, - new [] { "Proficiency", instance.ItemType("MagicLevelMeter").ToString(), "Proficiency" }, - new [] { "BossZen", instance.ItemType("ZenPotion").ToString(), "Boss Zen" }, + new [] { "Proficiency", instance.Find("MagicLevelMeter").Type.ToString(), "Proficiency" }, + new [] { "BossZen", instance.Find("ZenPotion").Type.ToString(), "Boss Zen" }, new [] { "NPCNightSpawn", ItemID.ClothierVoodooDoll.ToString(), "Let Town NPCs spawn at night" }, new [] { "NPCExtraSpawn", ItemID.GuideVoodooDoll.ToString(), "Town NPC Spawn Rate Multiplier" }, new [] { "BossHPBoost", ItemID.LifeCrystal.ToString(), "Boss Health Percentage Boost" }, @@ -357,7 +357,7 @@ namespace CalamityMod new [] { "ExpertDebuffReduction", ItemID.AnkhCharm.ToString(), "Reduce Expert Debuff Durations" }, new [] { "ChillWaterRework", ItemID.ArcticDivingGear.ToString(), "Rework Chilled Water" }, new [] { "ExpertSafeTowns", ItemID.Sunflower.ToString(), "Disable Expert Enemy Spawns in Towns" }, - new [] { "RipperBarShake", instance.ItemType("Revenge").ToString(), "Rage and Adrenaline Meter Shake" }, + new [] { "RipperBarShake", instance.Find("Revenge").Type.ToString(), "Rage and Adrenaline Meter Shake" }, new [] { "RageX", ItemID.LaserRuler.ToString(), "Rage Meter X Position" }, new [] { "RageY", ItemID.LaserRuler.ToString(), "Rage Meter Y Position" }, new [] { "AdrenalineX", ItemID.LaserRuler.ToString(), "Adrenaline Meter X Position" }, diff --git a/CalamityMod.cs b/CalamityMod.cs index 651049393d..3b851f982a 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -271,9 +271,9 @@ namespace CalamityMod AddEquipTexture(null, EquipType.Legs, "CirrusDress_Legs", "CalamityMod/Items/Armor/CirrusDress_Legs"); - AstralCactusTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Tiles/AstralCactus"); - AstralCactusGlowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Tiles/AstralCactusGlow"); - AstralSky = ModContent.GetTexture("CalamityMod/ExtraTextures/AstralSky"); + AstralCactusTexture = ModContent.Request("CalamityMod/ExtraTextures/Tiles/AstralCactus"); + AstralCactusGlowTexture = ModContent.Request("CalamityMod/ExtraTextures/Tiles/AstralCactusGlow"); + AstralSky = ModContent.Request("CalamityMod/ExtraTextures/AstralSky"); Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky(); diff --git a/Cooldowns/BloodflareRangedSet.cs b/Cooldowns/BloodflareRangedSet.cs index c66ea5aa46..9c02e7526d 100644 --- a/Cooldowns/BloodflareRangedSet.cs +++ b/Cooldowns/BloodflareRangedSet.cs @@ -13,6 +13,6 @@ namespace CalamityMod.Cooldowns public override Color CooldownStartColor => new Color(216, 60, 90); public override Color CooldownEndColor => new Color(251, 106, 150); - public override LegacySoundStyle EndSound => instance.player.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AbilitySounds/BloodflareRangerRecharge"); + public override LegacySoundStyle EndSound => instance.player.Calamity().Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AbilitySounds/BloodflareRangerRecharge"); } } diff --git a/Cooldowns/BrimflameFrenzy.cs b/Cooldowns/BrimflameFrenzy.cs index 11d5bd4e7f..c1b8273e3f 100644 --- a/Cooldowns/BrimflameFrenzy.cs +++ b/Cooldowns/BrimflameFrenzy.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Cooldowns public override Color CooldownStartColor => Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - instance.Completion); public override Color CooldownEndColor => Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - instance.Completion); - public override LegacySoundStyle EndSound => instance.player.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AbilitySounds/BrimflameRecharge"); + public override LegacySoundStyle EndSound => instance.player.Calamity().Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AbilitySounds/BrimflameRecharge"); //Add red eyes to the icon diff --git a/Cooldowns/ChaosState.cs b/Cooldowns/ChaosState.cs index e8a9aecc9a..d139e2d0fa 100644 --- a/Cooldowns/ChaosState.cs +++ b/Cooldowns/ChaosState.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Cooldowns public override Color OutlineColor => outlineColor; public override Color CooldownStartColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - instance.Completion); public override Color CooldownEndColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - instance.Completion); - public override LegacySoundStyle EndSound => instance.player.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AbilitySounds/ChaosStateOver"); + public override LegacySoundStyle EndSound => instance.player.Calamity().Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AbilitySounds/ChaosStateOver"); //It's the same cooldown with different skins each time, basically. public string skinTexture; diff --git a/Cooldowns/CooldownHandler.cs b/Cooldowns/CooldownHandler.cs index 6ec8208161..34b88b302e 100644 --- a/Cooldowns/CooldownHandler.cs +++ b/Cooldowns/CooldownHandler.cs @@ -112,9 +112,9 @@ namespace CalamityMod.Cooldowns /// public virtual void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) { - Texture2D sprite = ModContent.GetTexture(Texture); - Texture2D outline = ModContent.GetTexture(OutlineTexture); - Texture2D barBase = ModContent.GetTexture(ChargeBarTexture); + Texture2D sprite = ModContent.Request(Texture); + Texture2D outline = ModContent.Request(OutlineTexture); + Texture2D barBase = ModContent.Request(ChargeBarTexture); //Draw the ring spriteBatch.End(); @@ -138,9 +138,9 @@ namespace CalamityMod.Cooldowns /// public virtual void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) { - Texture2D sprite = ModContent.GetTexture(Texture); - Texture2D outline = ModContent.GetTexture(OutlineTexture); - Texture2D overlay = ModContent.GetTexture(OverlayTexture); + Texture2D sprite = ModContent.Request(Texture); + Texture2D outline = ModContent.Request(OutlineTexture); + Texture2D overlay = ModContent.Request(OverlayTexture); Color outlineColor = OutlineColor; //Draw the outline @@ -171,7 +171,7 @@ namespace CalamityMod.Cooldowns } else { - GameShaders.Misc["CalamityMod:CircularBarSpriteShader"].SetShaderTexture(ModContent.GetTexture(ChargeBarBackTexture)); + GameShaders.Misc["CalamityMod:CircularBarSpriteShader"].SetShaderTexture(ModContent.Request(ChargeBarBackTexture)); GameShaders.Misc["CalamityMod:CircularBarSpriteShader"].UseOpacity(opacity); GameShaders.Misc["CalamityMod:CircularBarSpriteShader"].UseSaturation(1 - instance.Completion); GameShaders.Misc["CalamityMod:CircularBarSpriteShader"].Apply(); diff --git a/Cooldowns/OmegaBlue.cs b/Cooldowns/OmegaBlue.cs index a17b00e389..42e37b0572 100644 --- a/Cooldowns/OmegaBlue.cs +++ b/Cooldowns/OmegaBlue.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Cooldowns public override Color OutlineColor => instance.timeLeft > 1500 ? new Color(231, 164, 1) : new Color(72, 135, 205); public override Color CooldownStartColor => instance.timeLeft > 1500 ? Color.Lerp(new Color(98, 110, 179), new Color(216, 176, 80), (instance.timeLeft - 1500) / 300f) : new Color(98, 110, 179); public override Color CooldownEndColor => instance.timeLeft > 1500 ? Color.Lerp(new Color(179, 132, 98), new Color(216, 176, 80), (instance.timeLeft - 1500) / 300f) : new Color(179, 132, 98); - public override LegacySoundStyle EndSound => instance.player.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AbilitySounds/OmegaBlueRecharge"); + public override LegacySoundStyle EndSound => instance.player.Calamity().Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AbilitySounds/OmegaBlueRecharge"); public override void OnCompleted() { diff --git a/Cooldowns/PlagueBlackout.cs b/Cooldowns/PlagueBlackout.cs index 95855a894a..5f8098004a 100644 --- a/Cooldowns/PlagueBlackout.cs +++ b/Cooldowns/PlagueBlackout.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Cooldowns public override Color OutlineColor => new Color(174, 237, 122); public override Color CooldownStartColor => Color.DarkSlateGray; public override Color CooldownEndColor => Color.DarkSlateGray; - public override LegacySoundStyle EndSound => instance.player.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AbilitySounds/PlagueReaperRecharge"); + public override LegacySoundStyle EndSound => instance.player.Calamity().Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AbilitySounds/PlagueReaperRecharge"); public override void OnCompleted() { diff --git a/Cooldowns/PotionSickness.cs b/Cooldowns/PotionSickness.cs index 686ed97449..810c4ccf0a 100644 --- a/Cooldowns/PotionSickness.cs +++ b/Cooldowns/PotionSickness.cs @@ -12,6 +12,6 @@ namespace CalamityMod.Cooldowns public override Color OutlineColor => new Color(255, 142, 165); public override Color CooldownStartColor => Color.Lerp(new Color(208, 234, 255), new Color(231, 3, 54), instance.Completion); public override Color CooldownEndColor => Color.Lerp(new Color(208, 234, 255), new Color(231, 3, 54), instance.Completion); - public override LegacySoundStyle EndSound => instance.player.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AbilitySounds/PotionSicknessOver"); + public override LegacySoundStyle EndSound => instance.player.Calamity().Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AbilitySounds/PotionSicknessOver"); } } diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index e63692b51b..f87e71c5f1 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using static Terraria.ModLoader.ModContent; using CalamityMod.Items.Weapons.Melee; +using Terraria.Audio; namespace CalamityMod.DataStructures { @@ -97,7 +98,7 @@ namespace CalamityMod.DataStructures { item.channel = false; item.noUseGraphic = false; - item.useStyle = ItemUseStyleID.SwingThrow; + item.useStyle = ItemUseStyleID.Swing; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = SoundID.Item1; @@ -123,7 +124,7 @@ namespace CalamityMod.DataStructures { item.channel = true; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; + item.useStyle = ItemUseStyleID.Shoot; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -149,7 +150,7 @@ namespace CalamityMod.DataStructures { item.channel = true; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; + item.useStyle = ItemUseStyleID.Shoot; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -198,7 +199,7 @@ namespace CalamityMod.DataStructures { item.channel = false; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; + item.useStyle = ItemUseStyleID.Swing; item.shoot = ProjectileType(); item.shootSpeed = 30; item.UseSound = null; @@ -225,7 +226,7 @@ namespace CalamityMod.DataStructures { item.channel = false; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.Stabbing; + item.useStyle = ItemUseStyleID.Thrust; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -262,7 +263,7 @@ namespace CalamityMod.DataStructures { item.channel = false; item.noUseGraphic = false; - item.useStyle = ItemUseStyleID.SwingThrow; + item.useStyle = ItemUseStyleID.Swing; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = SoundID.Item1; @@ -289,7 +290,7 @@ namespace CalamityMod.DataStructures { item.channel = true; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; + item.useStyle = ItemUseStyleID.Shoot; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -315,7 +316,7 @@ namespace CalamityMod.DataStructures { item.channel = true; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; + item.useStyle = ItemUseStyleID.Shoot; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -365,7 +366,7 @@ namespace CalamityMod.DataStructures { item.channel = false; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; + item.useStyle = ItemUseStyleID.Swing; item.shoot = ProjectileType(); item.shootSpeed = 30; item.UseSound = null; @@ -404,7 +405,7 @@ namespace CalamityMod.DataStructures { item.channel = false; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.Stabbing; + item.useStyle = ItemUseStyleID.Thrust; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -449,7 +450,7 @@ namespace CalamityMod.DataStructures { item.channel = true; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; + item.useStyle = ItemUseStyleID.Shoot; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -476,7 +477,7 @@ namespace CalamityMod.DataStructures { item.channel = true; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.Stabbing; + item.useStyle = ItemUseStyleID.Thrust; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -504,7 +505,7 @@ namespace CalamityMod.DataStructures { item.channel = false; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.Stabbing; + item.useStyle = ItemUseStyleID.Thrust; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -533,7 +534,7 @@ namespace CalamityMod.DataStructures { item.channel = true; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; + item.useStyle = ItemUseStyleID.Shoot; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -544,7 +545,7 @@ namespace CalamityMod.DataStructures { if (UseTimer % 30 == 29 && Main.rand.Next(2) == 0) { - Main.PlaySound(SoundID.Item78); + SoundEngine.PlaySound(SoundID.Item78); Projectile beamSword = Projectile.NewProjectileDirect(player.Center, player.SafeDirectionTo(Main.MouseWorld, Vector2.One) * 15f, ProjectileType(), (int)(OmegaBiomeBlade.WhirlwindAttunement_PassiveBaseDamage * player.MeleeDamage()), 10f, player.whoAmI, 1f); beamSword.timeLeft = 50; UseTimer++; @@ -570,7 +571,7 @@ namespace CalamityMod.DataStructures { item.channel = true; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; + item.useStyle = ItemUseStyleID.Shoot; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -584,7 +585,7 @@ namespace CalamityMod.DataStructures if (projectile.modProjectile is ChainedMeatHook hook && hook.Twirling == 0f) { hook.Twirling = 1f; - hook.projectile.timeLeft = (int)ChainedMeatHook.MaxTwirlTime; + hook.Projectile.timeLeft = (int)ChainedMeatHook.MaxTwirlTime; } Procced = false; } @@ -609,7 +610,7 @@ namespace CalamityMod.DataStructures { item.channel = true; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; + item.useStyle = ItemUseStyleID.Shoot; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -647,7 +648,7 @@ namespace CalamityMod.DataStructures { item.channel = true; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; + item.useStyle = ItemUseStyleID.Shoot; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -690,7 +691,7 @@ namespace CalamityMod.DataStructures { item.channel = true; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; + item.useStyle = ItemUseStyleID.Shoot; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -701,7 +702,7 @@ namespace CalamityMod.DataStructures { if (UseTimer % 500 == 449) { - Main.PlaySound(SoundID.Item78); + SoundEngine.PlaySound(SoundID.Item78); Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 1f); UseTimer++; } @@ -729,7 +730,7 @@ namespace CalamityMod.DataStructures { item.channel = true; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; + item.useStyle = ItemUseStyleID.Shoot; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -740,7 +741,7 @@ namespace CalamityMod.DataStructures { if (UseTimer % 500 == 449) { - Main.PlaySound(SoundID.Item78); + SoundEngine.PlaySound(SoundID.Item78); Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 1f); UseTimer++; } @@ -768,7 +769,7 @@ namespace CalamityMod.DataStructures { item.channel = true; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; + item.useStyle = ItemUseStyleID.Shoot; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -779,7 +780,7 @@ namespace CalamityMod.DataStructures { if (UseTimer % 500 == 449) { - Main.PlaySound(SoundID.Item78); + SoundEngine.PlaySound(SoundID.Item78); Projectile.NewProjectile(player.Center, Vector2.Zero, ProjectileType(), FourSeasonsGalaxia.CancerPassiveDamage, 0f, player.whoAmI, 0f); UseTimer++; } @@ -808,7 +809,7 @@ namespace CalamityMod.DataStructures { item.channel = true; item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; + item.useStyle = ItemUseStyleID.Shoot; item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; @@ -819,7 +820,7 @@ namespace CalamityMod.DataStructures { if (UseTimer % 500 == 449) { - Main.PlaySound(SoundID.Item78); + SoundEngine.PlaySound(SoundID.Item78); Projectile.NewProjectile(player.Center, Vector2.Zero, ProjectileType(), FourSeasonsGalaxia.CancerPassiveDamage, 0f, player.whoAmI, 0f); UseTimer++; } diff --git a/DataStructures/GemTechArmorState.cs b/DataStructures/GemTechArmorState.cs index 2087e62adf..8b7a9192bc 100644 --- a/DataStructures/GemTechArmorState.cs +++ b/DataStructures/GemTechArmorState.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.DataStructures { @@ -260,7 +261,7 @@ namespace CalamityMod.DataStructures if (gemWasLost) { - Main.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); Vector2 gemPosition = CalculateGemPosition(GemThatShouldBeLost); // Softcap the damage. This is done primarily to dampen stealth interactions. @@ -298,27 +299,27 @@ namespace CalamityMod.DataStructures // The melee speed boost code is present in the Player Misc Effects file. if (IsYellowGemActive) { - Owner.meleeCrit += (int)(GemTechHeadgear.MeleeCritBoost * 100f); - Owner.meleeDamage += GemTechHeadgear.MeleeDamageBoost; + Owner.GetCritChance(DamageClass.Melee) += (int)(GemTechHeadgear.MeleeCritBoost * 100f); + Owner.GetDamage(DamageClass.Melee) += GemTechHeadgear.MeleeDamageBoost; } if (IsGreenGemActive) { - Owner.rangedCrit += (int)(GemTechHeadgear.RangedCritBoost * 100f); - Owner.rangedDamage += GemTechHeadgear.RangedDamageBoost; + Owner.GetCritChance(DamageClass.Ranged) += (int)(GemTechHeadgear.RangedCritBoost * 100f); + Owner.GetDamage(DamageClass.Ranged) += GemTechHeadgear.RangedDamageBoost; } if (IsBlueGemActive) { Owner.maxMinions += GemTechHeadgear.SummonMinionCountBoost; - Owner.minionDamage += GemTechHeadgear.SummonDamageBoost; + Owner.GetDamage(DamageClass.Summon) += GemTechHeadgear.SummonDamageBoost; } if (IsPurpleGemActive) { Owner.statManaMax2 += GemTechHeadgear.MagicManaBoost; - Owner.magicCrit += (int)(GemTechHeadgear.MagicCritBoost * 100f); - Owner.magicDamage += GemTechHeadgear.MagicDamageBoost; + Owner.GetCritChance(DamageClass.Magic) += (int)(GemTechHeadgear.MagicCritBoost * 100f); + Owner.GetDamage(DamageClass.Magic) += GemTechHeadgear.MagicDamageBoost; } if (IsPinkGemActive) @@ -360,7 +361,7 @@ namespace CalamityMod.DataStructures public void CreateRegenerationEffect(GemTechArmorGemType gemType) { // Create a little visual effect to accompany the return of the gem and play a magic sound. - Main.PlaySound(SoundID.DD2_DarkMageHealImpact, Owner.Center); + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Owner.Center); for (int i = 0; i < 12; i++) { diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index 2233420755..2bc2db0fe0 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -43,35 +43,35 @@ namespace CalamityMod.Effects if (Main.dedServ) return; - AstralFogShader = CalamityMod.Instance.GetEffect("Effects/CustomShader"); - LightShader = CalamityMod.Instance.GetEffect("Effects/LightBurstShader"); - TentacleShader = CalamityMod.Instance.GetEffect("Effects/TentacleShader"); - TeleportDisplacementShader = CalamityMod.Instance.GetEffect("Effects/TeleportDisplacementShader"); - SCalMouseShader = CalamityMod.Instance.GetEffect("Effects/SCalMouseShader"); - LightDistortionShader = CalamityMod.Instance.GetEffect("Effects/DistortionShader"); - PhaseslayerRipShader = CalamityMod.Instance.GetEffect("Effects/PhaseslayerRipShader"); - ScarletDevilShader = CalamityMod.Instance.GetEffect("Effects/ScarletDevilStreak"); - BordernadoFireShader = CalamityMod.Instance.GetEffect("Effects/BordernadoFire"); - PrismCrystalShader = CalamityMod.Instance.GetEffect("Effects/PrismCrystalStreak"); - FadedUVMapStreakShader = CalamityMod.Instance.GetEffect("Effects/FadedUVMapStreak"); - FlameStreakShader = CalamityMod.Instance.GetEffect("Effects/Flame"); - FadingSolidTrailShader = CalamityMod.Instance.GetEffect("Effects/FadingSolidTrail"); - ImpFlameTrailShader = CalamityMod.Instance.GetEffect("Effects/ImpFlameTrail"); - SCalShieldShader = CalamityMod.Instance.GetEffect("Effects/SupremeShieldShader"); - RancorMagicCircleShader = CalamityMod.Instance.GetEffect("Effects/RancorMagicCircle"); - BasicTintShader = CalamityMod.Instance.GetEffect("Effects/BasicTint"); - CircularBarShader = CalamityMod.Instance.GetEffect("Effects/CircularBarShader"); - CircularBarSpriteShader = CalamityMod.Instance.GetEffect("Effects/CircularBarSpriteShader"); - DoGDisintegrationShader = CalamityMod.Instance.GetEffect("Effects/DoGDisintegration"); - ArtAttackTrailShader = CalamityMod.Instance.GetEffect("Effects/ArtAttackTrail"); - CircularAoETelegraph = CalamityMod.Instance.GetEffect("Effects/CircularAoETelegraph"); - IntersectionClipShader = CalamityMod.Instance.GetEffect("Effects/IntersectionClipShader"); - LocalLinearTransformationShader = CalamityMod.Instance.GetEffect("Effects/LocalLinearTransformationShader"); + AstralFogShader = CalamityMod.Instance.Assets.Request("Effects/CustomShader").Value; + LightShader = CalamityMod.Instance.Assets.Request("Effects/LightBurstShader").Value; + TentacleShader = CalamityMod.Instance.Assets.Request("Effects/TentacleShader").Value; + TeleportDisplacementShader = CalamityMod.Instance.Assets.Request("Effects/TeleportDisplacementShader").Value; + SCalMouseShader = CalamityMod.Instance.Assets.Request("Effects/SCalMouseShader").Value; + LightDistortionShader = CalamityMod.Instance.Assets.Request("Effects/DistortionShader").Value; + PhaseslayerRipShader = CalamityMod.Instance.Assets.Request("Effects/PhaseslayerRipShader").Value; + ScarletDevilShader = CalamityMod.Instance.Assets.Request("Effects/ScarletDevilStreak").Value; + BordernadoFireShader = CalamityMod.Instance.Assets.Request("Effects/BordernadoFire").Value; + PrismCrystalShader = CalamityMod.Instance.Assets.Request("Effects/PrismCrystalStreak").Value; + FadedUVMapStreakShader = CalamityMod.Instance.Assets.Request("Effects/FadedUVMapStreak").Value; + FlameStreakShader = CalamityMod.Instance.Assets.Request("Effects/Flame").Value; + FadingSolidTrailShader = CalamityMod.Instance.Assets.Request("Effects/FadingSolidTrail").Value; + ImpFlameTrailShader = CalamityMod.Instance.Assets.Request("Effects/ImpFlameTrail").Value; + SCalShieldShader = CalamityMod.Instance.Assets.Request("Effects/SupremeShieldShader").Value; + RancorMagicCircleShader = CalamityMod.Instance.Assets.Request("Effects/RancorMagicCircle").Value; + BasicTintShader = CalamityMod.Instance.Assets.Request("Effects/BasicTint").Value; + CircularBarShader = CalamityMod.Instance.Assets.Request("Effects/CircularBarShader").Value; + CircularBarSpriteShader = CalamityMod.Instance.Assets.Request("Effects/CircularBarSpriteShader").Value; + DoGDisintegrationShader = CalamityMod.Instance.Assets.Request("Effects/DoGDisintegration").Value; + ArtAttackTrailShader = CalamityMod.Instance.Assets.Request("Effects/ArtAttackTrail").Value; + CircularAoETelegraph = CalamityMod.Instance.Assets.Request("Effects/CircularAoETelegraph").Value; + IntersectionClipShader = CalamityMod.Instance.Assets.Request("Effects/IntersectionClipShader").Value; + LocalLinearTransformationShader = CalamityMod.Instance.Assets.Request("Effects/LocalLinearTransformationShader").Value; - BaseFusableParticleEdgeShader = CalamityMod.Instance.GetEffect("Effects/ParticleFusion/BaseFusableParticleEdgeShader"); - AdditiveFusableParticleEdgeShader = CalamityMod.Instance.GetEffect("Effects/ParticleFusion/AdditiveFusableParticleEdgeShader"); + BaseFusableParticleEdgeShader = CalamityMod.Instance.Assets.Request("Effects/ParticleFusion/BaseFusableParticleEdgeShader").Value; + AdditiveFusableParticleEdgeShader = CalamityMod.Instance.Assets.Request("Effects/ParticleFusion/AdditiveFusableParticleEdgeShader").Value; - DoGPortalShader = CalamityMod.Instance.GetEffect("Effects/ScreenShaders/DoGPortalShader"); + DoGPortalShader = CalamityMod.Instance.Assets.Request("Effects/ScreenShaders/DoGPortalShader").Value; Filters.Scene["CalamityMod:Astral"] = new Filter(new AstralScreenShaderData(new Ref(AstralFogShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f), EffectPriority.VeryHigh); diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index 6b4c074af1..b409367ca6 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -35,6 +35,7 @@ using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Events { @@ -213,7 +214,7 @@ namespace CalamityMod.Events { Player player = Main.player[ClosestPlayerToWorldCenter]; - Main.PlaySound(SoundID.Roar, player.position, 2); + SoundEngine.PlaySound(SoundID.Roar, player.position, 2); int ravager = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), type, 1); Main.npc[ravager].timeLeft *= 20; CalamityUtils.BossAwakenMessage(ravager); @@ -238,7 +239,7 @@ namespace CalamityMod.Events { Player player = Main.player[ClosestPlayerToWorldCenter]; - Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstrumDeusSpawn"), player.Center); + SoundEngine.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstrumDeusSpawn"), player.Center); NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); }, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType() }), @@ -267,7 +268,7 @@ namespace CalamityMod.Events { Player player = Main.player[ClosestPlayerToWorldCenter]; - Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceSpawn"), player.Center); + SoundEngine.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceSpawn"), player.Center); int prov = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-500, 501)), (int)(player.position.Y - 250f), type, 1); Main.npc[prov].timeLeft *= 20; CalamityUtils.BossAwakenMessage(prov); @@ -285,7 +286,7 @@ namespace CalamityMod.Events player.ClearBuff(ModContent.BuffType()); } } - Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SupremeCalamitasSpawn"), Main.player[ClosestPlayerToWorldCenter].Center); + SoundEngine.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SupremeCalamitasSpawn"), Main.player[ClosestPlayerToWorldCenter].Center); CalamityUtils.SpawnBossBetter(Main.player[ClosestPlayerToWorldCenter].Top - new Vector2(42f, 84f), type); }, dimnessFactor: 0.6f, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), @@ -296,7 +297,7 @@ namespace CalamityMod.Events { Player player = Main.player[ClosestPlayerToWorldCenter]; - Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), player.Center); + SoundEngine.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), player.Center); NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); }, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType() }) }; @@ -451,7 +452,7 @@ namespace CalamityMod.Events // Play the typical boss roar sound. if (!Bosses[BossRushStage].UsesSpecialSound) - Main.PlaySound(SoundID.Roar, Main.player[ClosestPlayerToWorldCenter].position, 0); + SoundEngine.PlaySound(SoundID.Roar, Main.player[ClosestPlayerToWorldCenter].position, 0); // And spawn the boss. Bosses[BossRushStage].SpawnContext.Invoke(CurrentlyFoughtBoss); diff --git a/Events/BossRushSky.cs b/Events/BossRushSky.cs index e552385f28..f2802523e6 100644 --- a/Events/BossRushSky.cs +++ b/Events/BossRushSky.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Events // Make the entire background fade to white at the end of the event. if (BossRushEvent.EndTimer >= 100f) { - Texture2D whiteTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/XerocLight"); + Texture2D whiteTexture = ModContent.Request("CalamityMod/ExtraTextures/XerocLight"); Vector2 screenCenter = new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; float fadeToWhite = Utils.InverseLerp(110f, 140f, BossRushEvent.EndTimer, true); fadeToWhite *= Utils.InverseLerp(BossRushEvent.EndVisualEffectTime - 5f, BossRushEvent.EndVisualEffectTime - 25f, BossRushEvent.EndTimer, true); @@ -108,7 +108,7 @@ namespace CalamityMod.Events Vector2 drawWorldPosition = new Vector2(Main.LocalPlayer.Center.X, 1120f); Vector2 drawPosition = (drawWorldPosition - screenCenter) * 0.097f + screenCenter - Main.screenPosition - Vector2.UnitY * 100f; - Texture2D eyeTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/XerocEye"); + Texture2D eyeTexture = ModContent.Request("CalamityMod/ExtraTextures/XerocEye"); Color baseColorDraw = Color.Lerp(Color.White, Color.Red, IncrementalInterest); spriteBatch.Draw(eyeTexture, drawPosition, null, baseColorDraw, 0f, eyeTexture.Size() * 0.5f, scale, SpriteEffects.None, 0f); diff --git a/Gores/AstralWaterDroplet.cs b/Gores/AstralWaterDroplet.cs index dcaf96b671..667d61fee5 100644 --- a/Gores/AstralWaterDroplet.cs +++ b/Gores/AstralWaterDroplet.cs @@ -6,6 +6,7 @@ using Terraria.GameContent.Shaders; using Terraria.Graphics.Effects; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Gores { @@ -147,7 +148,7 @@ namespace CalamityMod.Gores gore.frameCounter = 0; if (gore.type != 716 && gore.type != 717 && gore.type != 943) { - Main.PlaySound(SoundID.Drip, (int)gore.position.X + 8, (int)gore.position.Y + 8, Main.rand.Next(2), 1f, 0f); + SoundEngine.PlaySound(SoundID.Drip, (int)gore.position.X + 8, (int)gore.position.Y + 8, Main.rand.Next(2), 1f, 0f); } } } @@ -159,7 +160,7 @@ namespace CalamityMod.Gores gore.frameCounter = 0; if (gore.type != 716 && gore.type != 717 && gore.type != 943) { - Main.PlaySound(SoundID.Drip, (int)gore.position.X + 8, (int)gore.position.Y + 8, 2, 1f, 0f); + SoundEngine.PlaySound(SoundID.Drip, (int)gore.position.X + 8, (int)gore.position.Y + 8, 2, 1f, 0f); } ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(gore.position + new Vector2(8f, 8f), 1f, RippleShape.Square, 0f); } diff --git a/ILEditing/ILHelperMethods.cs b/ILEditing/ILHelperMethods.cs index dadec9e31b..6b70e5e8cc 100644 --- a/ILEditing/ILHelperMethods.cs +++ b/ILEditing/ILHelperMethods.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using MonoMod.Cil; using Terraria; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.ILEditing { @@ -13,7 +14,7 @@ namespace CalamityMod.ILEditing { Tile t = Main.tile[i, j]; int topY = j; - while (t != null && t.active() && t.type == rootTile.type) + while (t != null && t.active() && t.TileType == rootTile.TileType) { // Immediately stop at the top of the world, if you got there somehow. if (topY == 0) @@ -45,7 +46,7 @@ namespace CalamityMod.ILEditing // If applicable, skip wiring for all door tiles except the one that was hit by this wire event. for (int y = doorY; y < doorY + 4; ++y) { - Main.tile[doorX, y].type = (ushort)newDoorID; + Main.tile[doorX, y].TileType = (ushort)newDoorID; if (Main.netMode != NetmodeID.MultiplayerClient && Wiring.running && y != wireHitY) Wiring.SkipWire(doorX, y); } @@ -55,7 +56,7 @@ namespace CalamityMod.ILEditing WorldGen.TileFrame(doorX, y); // Play the door closing sound (lab doors do not use the door opening sound) - Main.PlaySound(SoundID.DoorClosed, doorX * 16, doorY * 16); + SoundEngine.PlaySound(SoundID.DoorClosed, doorX * 16, doorY * 16); return true; } diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 01f4fc4942..750c706bae 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -230,11 +230,11 @@ namespace CalamityMod.ILEditing return orig(i, j, direction); // If it's one of the two lab doors, use custom code to open the door and sync tiles in multiplayer. - else if (tile.type == labDoorClosed) + else if (tile.TileType == labDoorClosed) return OpenLabDoor(tile, i, j, labDoorOpen); - else if (tile.type == aLabDoorClosed) + else if (tile.TileType == aLabDoorClosed) return OpenLabDoor(tile, i, j, aLabDoorOpen); - else if (tile.type == exoDoorClosed) + else if (tile.TileType == exoDoorClosed) return OpenLabDoor(tile, i, j, exoDoorOpen); // If it's anything else, let vanilla and/or TML handle it. @@ -249,11 +249,11 @@ namespace CalamityMod.ILEditing return orig(i, j, forced); // If it's one of the two lab doors, use custom code to open the door and sync tiles in multiplayer. - else if (tile.type == labDoorOpen) + else if (tile.TileType == labDoorOpen) return CloseLabDoor(tile, i, j, labDoorClosed); - else if (tile.type == aLabDoorOpen) + else if (tile.TileType == aLabDoorOpen) return CloseLabDoor(tile, i, j, aLabDoorClosed); - else if (tile.type == exoDoorOpen) + else if (tile.TileType == exoDoorOpen) return CloseLabDoor(tile, i, j, exoDoorClosed); // If it's anything else, let vanilla and/or TML handle it. @@ -437,7 +437,7 @@ namespace CalamityMod.ILEditing // If the blazing mouse is actually going to do damage, draw an indicator aura. if (Main.LocalPlayer.Calamity().blazingCursorDamage && !Main.mapFullscreen) { - Texture2D auraTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/CalamityAura"); + Texture2D auraTexture = ModContent.Request("CalamityMod/ExtraTextures/CalamityAura"); Rectangle auraFrame = auraTexture.Frame(1, 6, 0, (int)(Main.GlobalTime * 12.3f) % 6); float auraScale = MathHelper.Lerp(0.95f, 1f, (float)Math.Sin(Main.GlobalTime * 1.1f) * 0.5f + 0.5f); diff --git a/ILEditing/WorldgenILChanges.cs b/ILEditing/WorldgenILChanges.cs index 96a8e4f24d..82aa8219e7 100644 --- a/ILEditing/WorldgenILChanges.cs +++ b/ILEditing/WorldgenILChanges.cs @@ -5,7 +5,7 @@ using MonoMod.Cil; using System; using Terraria; using Terraria.ID; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.ILEditing { diff --git a/Items/Accessories/Abaddon.cs b/Items/Accessories/Abaddon.cs index a5c896c7df..f74df03c69 100644 --- a/Items/Accessories/Abaddon.cs +++ b/Items/Accessories/Abaddon.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) => player.Calamity().abaddon = true; diff --git a/Items/Accessories/AbyssalAmulet.cs b/Items/Accessories/AbyssalAmulet.cs index bde7e75d05..499b493374 100644 --- a/Items/Accessories/AbyssalAmulet.cs +++ b/Items/Accessories/AbyssalAmulet.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/AbyssalDivingGear.cs b/Items/Accessories/AbyssalDivingGear.cs index aa67f4edd9..562e987925 100644 --- a/Items/Accessories/AbyssalDivingGear.cs +++ b/Items/Accessories/AbyssalDivingGear.cs @@ -22,11 +22,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -53,14 +53,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ArcticDivingGear); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ArcticDivingGear).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } diff --git a/Items/Accessories/AbyssalDivingSuit.cs b/Items/Accessories/AbyssalDivingSuit.cs index 1119d438c4..18e136865a 100644 --- a/Items/Accessories/AbyssalDivingSuit.cs +++ b/Items/Accessories/AbyssalDivingSuit.cs @@ -30,11 +30,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; + Item.width = 18; + Item.height = 18; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -49,18 +49,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 40).AddIngredient(ModContent.ItemType(), 40).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } diff --git a/Items/Accessories/AbyssalMirror.cs b/Items/Accessories/AbyssalMirror.cs index cb55cb2ed8..859f2da9ca 100644 --- a/Items/Accessories/AbyssalMirror.cs +++ b/Items/Accessories/AbyssalMirror.cs @@ -22,11 +22,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 30; - item.height = 38; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.accessory = true; + Item.width = 30; + Item.height = 38; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -40,16 +40,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SpectreBar, 8); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SpectreBar, 8).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/AeroStone.cs b/Items/Accessories/AeroStone.cs index 9de993da85..fe209db1bc 100644 --- a/Items/Accessories/AeroStone.cs +++ b/Items/Accessories/AeroStone.cs @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Aero Stone"); Tooltip.SetDefault("One of the ancient relics\n" + "Increases flight time, movement speed and jump speed by 10%"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 8)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(4, 8)); } public override void SetDefaults() { - item.width = 40; - item.height = 50; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.accessory = true; + Item.width = 40; + Item.height = 50; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Affliction.cs b/Items/Accessories/Affliction.cs index ea13bc890e..d1535270d8 100644 --- a/Items/Accessories/Affliction.cs +++ b/Items/Accessories/Affliction.cs @@ -19,17 +19,17 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 38; - item.height = 44; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.rare = ItemRarityID.Purple; + Item.width = 38; + Item.height = 44; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ItemRarityID.Purple; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Accessories/Affliction")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Accessories/Affliction")); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/AlchemicalFlask.cs b/Items/Accessories/AlchemicalFlask.cs index 2021cc3987..51a2c4908a 100644 --- a/Items/Accessories/AlchemicalFlask.cs +++ b/Items/Accessories/AlchemicalFlask.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -32,13 +32,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ItemID.BeeWax, 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ItemID.BeeWax, 5).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/AlluringBait.cs b/Items/Accessories/AlluringBait.cs index a4f8e254bf..b192f7c341 100644 --- a/Items/Accessories/AlluringBait.cs +++ b/Items/Accessories/AlluringBait.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index ee4125e504..a9185f00af 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 34; - item.height = 34; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.accessory = true; + Item.width = 34; + Item.height = 34; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -50,13 +50,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.BrainOfConfusion); - recipe.AddIngredient(ItemID.SoulofNight, 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.BrainOfConfusion).AddIngredient(ItemID.SoulofNight, 3).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index e2e97b94a7..51afee75e2 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 6; - item.width = 20; - item.height = 20; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.defense = 6; + Item.width = 20; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -36,22 +36,8 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/AmidiasPendant.cs b/Items/Accessories/AmidiasPendant.cs index 44477a3b3f..697cfacc82 100644 --- a/Items/Accessories/AmidiasPendant.cs +++ b/Items/Accessories/AmidiasPendant.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 46; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.accessory = true; + Item.width = 26; + Item.height = 46; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/AmidiasSpark.cs b/Items/Accessories/AmidiasSpark.cs index ece42bda98..fcfb925233 100644 --- a/Items/Accessories/AmidiasSpark.cs +++ b/Items/Accessories/AmidiasSpark.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/AncientFossil.cs b/Items/Accessories/AncientFossil.cs index 0c05c19989..51f587d9d1 100644 --- a/Items/Accessories/AncientFossil.cs +++ b/Items/Accessories/AncientFossil.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -31,11 +31,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("SiltGroup", 100); - recipe.AddTile(TileID.Furnaces); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("SiltGroup", 100).AddTile(TileID.Furnaces).Register(); } } } diff --git a/Items/Accessories/AnechoicPlating.cs b/Items/Accessories/AnechoicPlating.cs index 605668a1e5..732288187c 100644 --- a/Items/Accessories/AnechoicPlating.cs +++ b/Items/Accessories/AnechoicPlating.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/AngelTreads.cs b/Items/Accessories/AngelTreads.cs index a722496499..a151312e09 100644 --- a/Items/Accessories/AngelTreads.cs +++ b/Items/Accessories/AngelTreads.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 36; - item.height = 32; - item.value = CalamityGlobalItem.Rarity6BuyPrice; - item.rare = ItemRarityID.LightPurple; - item.accessory = true; + Item.width = 36; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.rare = ItemRarityID.LightPurple; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -46,17 +46,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FrostsparkBoots); - recipe.AddIngredient(ItemID.LavaWaders); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.SoulofMight); - recipe.AddIngredient(ItemID.SoulofSight); - recipe.AddIngredient(ItemID.SoulofFright); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.FrostsparkBoots).AddIngredient(ItemID.LavaWaders).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.SoulofMight).AddIngredient(ItemID.SoulofSight).AddIngredient(ItemID.SoulofFright).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/AngelicAlliance.cs b/Items/Accessories/AngelicAlliance.cs index 45e638f57e..369df7429e 100644 --- a/Items/Accessories/AngelicAlliance.cs +++ b/Items/Accessories/AngelicAlliance.cs @@ -27,13 +27,13 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 56; - item.height = 92; - item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - item.accessory = true; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.width = 56; + Item.height = 92; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; + Item.accessory = true; + Item.rare = 10; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } public override void ModifyTooltips(List list) @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Accessories string hotkey = CalamityMod.AngelicAllianceHotKey.TooltipHotkeyString(); foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip4") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip4") { line2.text = "Press " + hotkey + " to grace yourself in divinity for 15 seconds"; } @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.angelicAlliance = true; player.allDamage += 0.08f; - player.minionDamage += 0.07f; //7% + 8% = 15% + player.GetDamage(DamageClass.Summon) += 0.07f; //7% + 8% = 15% player.maxMinions += 2; if (player.controlJump) player.lifeRegen += 4; @@ -61,19 +61,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyHallowedHelmet"); - //recipe.AddRecipeGroup("AnyHallowedPlatemail"); - //recipe.AddRecipeGroup("AnyHallowedGreaves"); - recipe.AddIngredient(ItemID.HallowedPlateMail); - recipe.AddIngredient(ItemID.HallowedGreaves); - recipe.AddIngredient(ItemID.PaladinsShield); - recipe.AddIngredient(ItemID.TrueExcalibur); - recipe.AddIngredient(ItemID.CrossNecklace); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyHallowedHelmet").AddIngredient(ItemID.HallowedPlateMail).AddIngredient(ItemID.HallowedGreaves).AddIngredient(ItemID.PaladinsShield).AddIngredient(ItemID.TrueExcalibur).AddIngredient(ItemID.CrossNecklace).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/AquaticEmblem.cs b/Items/Accessories/AquaticEmblem.cs index d3edff7aac..61d574a96c 100644 --- a/Items/Accessories/AquaticEmblem.cs +++ b/Items/Accessories/AquaticEmblem.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 18; - item.height = 26; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 18; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/ArchaicPowder.cs b/Items/Accessories/ArchaicPowder.cs index 77d01e351b..226ab9a566 100644 --- a/Items/Accessories/ArchaicPowder.cs +++ b/Items/Accessories/ArchaicPowder.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 20; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -34,14 +34,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.Bone, 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.Bone, 15).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 185dd6287c..c0184b7d88 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -29,12 +29,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 60; - item.height = 54; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.defense = 28; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 60; + Item.height = 54; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.defense = 28; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void ModifyTooltips(List list) @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Accessories string hotkey = CalamityMod.AegisHotKey.TooltipHotkeyString(); foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip5") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip5") { line2.text = "Press " + hotkey + " to activate buffs to all damage, crit chance, and defense"; } @@ -83,14 +83,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index a3792f98bc..c761509ce1 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -23,12 +23,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 38; - item.height = 44; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.defense = 16; - item.accessory = true; + Item.width = 38; + Item.height = 44; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.defense = 16; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -59,16 +59,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AnkhShield); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.AnkhShield).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LifeFruit, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/AstralArcanum.cs b/Items/Accessories/AstralArcanum.cs index a124c1f7b6..6f69aa884a 100644 --- a/Items/Accessories/AstralArcanum.cs +++ b/Items/Accessories/AstralArcanum.cs @@ -21,13 +21,13 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 12; - item.width = 26; - item.height = 26; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.rare = ItemRarityID.Purple; + Item.defense = 12; + Item.width = 26; + Item.height = 26; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ItemRarityID.Purple; } public override void ModifyTooltips(List list) @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Accessories string hotkey = CalamityMod.AstralArcanumUIHotkey.TooltipHotkeyString(); foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip3") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip3") { line2.text = "Press " + hotkey + " to toggle teleportation UI while no bosses are alive"; } @@ -51,13 +51,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/BadgeofBravery.cs b/Items/Accessories/BadgeofBravery.cs index 5cb341ecf8..ecd0288440 100644 --- a/Items/Accessories/BadgeofBravery.cs +++ b/Items/Accessories/BadgeofBravery.cs @@ -18,12 +18,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.rare = ItemRarityID.Purple; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 30; + Item.height = 30; + Item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -34,12 +34,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FeralClaws); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.FeralClaws).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/BlazingCore.cs b/Items/Accessories/BlazingCore.cs index 368c952fe7..21ef1f3c70 100644 --- a/Items/Accessories/BlazingCore.cs +++ b/Items/Accessories/BlazingCore.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Items.Accessories "The sun will slowly drag enemies into it\n" + "Only one sun can be active at once\n" + "Provides a moderate amount of light in the Abyss"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 6)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 6)); } public override void SetDefaults() { - item.width = 42; - item.height = 46; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 42; + Item.height = 46; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/BloodPact.cs b/Items/Accessories/BloodPact.cs index e3c61680d1..a0edae30a4 100644 --- a/Items/Accessories/BloodPact.cs +++ b/Items/Accessories/BloodPact.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.rare = ItemRarityID.Yellow; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.rare = ItemRarityID.Yellow; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/BloodflareCore.cs b/Items/Accessories/BloodflareCore.cs index 732d7b3109..5f7467b233 100644 --- a/Items/Accessories/BloodflareCore.cs +++ b/Items/Accessories/BloodflareCore.cs @@ -15,12 +15,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/BloodstainedGlove.cs b/Items/Accessories/BloodstainedGlove.cs index 19669d1b8e..0cc943d0e4 100644 --- a/Items/Accessories/BloodstainedGlove.cs +++ b/Items/Accessories/BloodstainedGlove.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 36; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.accessory = true; - item.rare = ItemRarityID.Orange; + Item.width = 26; + Item.height = 36; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.accessory = true; + Item.rare = ItemRarityID.Orange; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -32,13 +32,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Vertebrae, 4); - recipe.AddIngredient(ItemID.CrimtaneBar, 4); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Vertebrae, 4).AddIngredient(ItemID.CrimtaneBar, 4).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Accessories/BloodyWormScarf.cs b/Items/Accessories/BloodyWormScarf.cs index fd0843eb27..eed2a9a7ba 100644 --- a/Items/Accessories/BloodyWormScarf.cs +++ b/Items/Accessories/BloodyWormScarf.cs @@ -15,29 +15,23 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 42; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.accessory = true; + Item.width = 26; + Item.height = 42; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - player.meleeDamage += 0.1f; + player.GetDamage(DamageClass.Melee) += 0.1f; player.meleeSpeed += 0.1f; player.endurance += 0.1f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.WormScarf); - recipe.AddIngredient(ItemID.SoulofNight, 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.WormScarf).AddIngredient(ItemID.SoulofNight, 3).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/BloodyWormTooth.cs b/Items/Accessories/BloodyWormTooth.cs index d9a84740ff..158fabfd43 100644 --- a/Items/Accessories/BloodyWormTooth.cs +++ b/Items/Accessories/BloodyWormTooth.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 12; - item.height = 15; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 12; + Item.height = 15; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/BloomStone.cs b/Items/Accessories/BloomStone.cs index 7b7ab61e3e..757055c613 100644 --- a/Items/Accessories/BloomStone.cs +++ b/Items/Accessories/BloomStone.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 38; - item.height = 54; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.accessory = true; + Item.width = 38; + Item.height = 54; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Accessories int x = (int)player.Center.X / 16; int y = (int)(player.Bottom.Y - 1f) / 16; Tile groundTile = CalamityUtils.ParanoidTileRetrieval(x, y + 1); - bool groundTileIsSolid = groundTile.nactive() && (Main.tileSolid[groundTile.type] || Main.tileSolidTop[groundTile.type]); + bool groundTileIsSolid = groundTile.nactive() && (Main.tileSolid[groundTile.TileType] || Main.tileSolidTop[groundTile.TileType]); if (groundTileIsSolid && player.gravDir == 1f) modPlayer.BloomStoneRegen = true; @@ -45,19 +45,19 @@ namespace CalamityMod.Items.Accessories Tile walkTile = CalamityUtils.ParanoidTileRetrieval(x, y); if (!walkTile.active() && walkTile.liquid == 0 && groundTile != null && WorldGen.SolidTile(groundTile)) { - walkTile.frameY = 0; + walkTile.TileFrameY = 0; walkTile.slope(0); walkTile.halfBrick(false); // On dirt blocks, there's a small chance to grow a dye plant. - if (groundTile.type == TileID.Dirt) + if (groundTile.TileType == TileID.Dirt) { if (Main.rand.NextBool(1000)) { walkTile.active(true); - walkTile.type = TileID.DyePlants; - walkTile.frameX = (short)(34 * Main.rand.Next(1, 13)); - while (walkTile.frameX == 144) - walkTile.frameX = (short)(34 * Main.rand.Next(1, 13)); + walkTile.TileType = TileID.DyePlants; + walkTile.TileFrameX = (short)(34 * Main.rand.Next(1, 13)); + while (walkTile.TileFrameX == 144) + walkTile.TileFrameX = (short)(34 * Main.rand.Next(1, 13)); } if (Main.netMode == NetmodeID.MultiplayerClient) @@ -65,25 +65,25 @@ namespace CalamityMod.Items.Accessories } // On grass, grow flowers. - if (groundTile.type == TileID.Grass) + if (groundTile.TileType == TileID.Grass) { if (Main.rand.NextBool(2)) { walkTile.active(true); - walkTile.type = TileID.Plants; - walkTile.frameX = (short)(18 * Main.rand.Next(6, 11)); + walkTile.TileType = TileID.Plants; + walkTile.TileFrameX = (short)(18 * Main.rand.Next(6, 11)); - while (walkTile.frameX == 144) - walkTile.frameX = (short)(18 * Main.rand.Next(6, 11)); + while (walkTile.TileFrameX == 144) + walkTile.TileFrameX = (short)(18 * Main.rand.Next(6, 11)); } else { walkTile.active(true); - walkTile.type = TileID.Plants2; - walkTile.frameX = (short)(18 * Main.rand.Next(6, 21)); + walkTile.TileType = TileID.Plants2; + walkTile.TileFrameX = (short)(18 * Main.rand.Next(6, 21)); - while (walkTile.frameX == 144) - walkTile.frameX = (short)(18 * Main.rand.Next(6, 21)); + while (walkTile.TileFrameX == 144) + walkTile.TileFrameX = (short)(18 * Main.rand.Next(6, 21)); } if (Main.netMode == NetmodeID.MultiplayerClient) @@ -91,23 +91,23 @@ namespace CalamityMod.Items.Accessories } // On hallowed grass, grow hallowed flowers. - else if (groundTile.type == TileID.HallowedGrass) + else if (groundTile.TileType == TileID.HallowedGrass) { if (Main.rand.NextBool(2)) { walkTile.active(true); - walkTile.type = TileID.HallowedPlants; - walkTile.frameX = (short)(18 * Main.rand.Next(4, 7)); - while (walkTile.frameX == 90) - walkTile.frameX = (short)(18 * Main.rand.Next(4, 7)); + walkTile.TileType = TileID.HallowedPlants; + walkTile.TileFrameX = (short)(18 * Main.rand.Next(4, 7)); + while (walkTile.TileFrameX == 90) + walkTile.TileFrameX = (short)(18 * Main.rand.Next(4, 7)); } else { walkTile.active(true); - walkTile.type = TileID.HallowedPlants2; - walkTile.frameX = (short)(18 * Main.rand.Next(2, 8)); - while (walkTile.frameX == 90) - walkTile.frameX = (short)(18 * Main.rand.Next(2, 8)); + walkTile.TileType = TileID.HallowedPlants2; + walkTile.TileFrameX = (short)(18 * Main.rand.Next(2, 8)); + while (walkTile.TileFrameX == 90) + walkTile.TileFrameX = (short)(18 * Main.rand.Next(2, 8)); } if (Main.netMode == NetmodeID.MultiplayerClient) @@ -115,11 +115,11 @@ namespace CalamityMod.Items.Accessories } // On jungle grass, grow jungle flowers. - else if (groundTile.type == TileID.JungleGrass) + else if (groundTile.TileType == TileID.JungleGrass) { walkTile.active(true); - walkTile.type = TileID.JunglePlants2; - walkTile.frameX = (short)(18 * Main.rand.Next(9, 17)); + walkTile.TileType = TileID.JunglePlants2; + walkTile.TileFrameX = (short)(18 * Main.rand.Next(9, 17)); if (Main.netMode == NetmodeID.MultiplayerClient) NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); diff --git a/Items/Accessories/BlunderBooster.cs b/Items/Accessories/BlunderBooster.cs index 834da37238..728491126e 100644 --- a/Items/Accessories/BlunderBooster.cs +++ b/Items/Accessories/BlunderBooster.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 30; - item.height = 38; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.accessory = true; + Item.width = 30; + Item.height = 38; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().hasJetpack; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Accessories string hotkey = CalamityMod.PlaguePackHotKey.TooltipHotkeyString(); foreach (TooltipLine line in list) { - if (line.mod == "Terraria" && line.Name == "Tooltip3") + if (line.Mod == "Terraria" && line.Name == "Tooltip3") { line.text = "Press " + hotkey + " to consume 25% of your maximum stealth to perform a swift upwards/diagonal dash which leaves a trail of lightning bolts"; } @@ -53,12 +53,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/Calamity.cs b/Items/Accessories/Calamity.cs index 6305ba1e80..1a473f819c 100644 --- a/Items/Accessories/Calamity.cs +++ b/Items/Accessories/Calamity.cs @@ -20,17 +20,17 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Lights your cursor ablaze with the Witch's flames, summoning a burning sigil around it\n" + "Enemies touching the sigil take immense damage and are inflicted with Vulnerability Hex\n" + "Equip in a vanity slot to change the cursor without dealing damage"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); } public override void SetDefaults() { - item.width = 44; - item.height = 108; - item.Calamity().customRarity = CalamityRarity.Violet; - item.rare = ItemRarityID.Purple; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.accessory = true; + Item.width = 44; + Item.height = 108; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/CalamityRing.cs b/Items/Accessories/CalamityRing.cs index 92ea1ec3c8..b8d685e067 100644 --- a/Items/Accessories/CalamityRing.cs +++ b/Items/Accessories/CalamityRing.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 22; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.accessory = true; + Item.width = 20; + Item.height = 22; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().calamityRing; diff --git a/Items/Accessories/CelestialJewel.cs b/Items/Accessories/CelestialJewel.cs index 89c639d0ee..39ec19ca87 100644 --- a/Items/Accessories/CelestialJewel.cs +++ b/Items/Accessories/CelestialJewel.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 8; - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.accessory = true; + Item.defense = 8; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; } public override void ModifyTooltips(List list) @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories string hotkey = CalamityMod.AstralTeleportHotKey.TooltipHotkeyString(); foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip2") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip2") { line2.text = "Press " + hotkey + " to teleport to a random location while no bosses are alive"; } @@ -48,14 +48,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.TeleportationPotion, 3); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.TeleportationPotion, 3).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/ChaosAmulet.cs b/Items/Accessories/ChaosAmulet.cs index 8d9204d1db..d030c46769 100644 --- a/Items/Accessories/ChaosAmulet.cs +++ b/Items/Accessories/ChaosAmulet.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 22; - item.height = 32; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.accessory = true; + Item.width = 22; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldDust, 7); - recipe.AddIngredient(ItemID.SpelunkerPotion, 7); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.GoldDust, 7).AddIngredient(ItemID.SpelunkerPotion, 7).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/ChaosStone.cs b/Items/Accessories/ChaosStone.cs index a6345bd3b2..ccec26dd89 100644 --- a/Items/Accessories/ChaosStone.cs +++ b/Items/Accessories/ChaosStone.cs @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Accessories "Mana Sickness from drinking mana potions is replaced by Mana Burn\n" + "Mana Burn deals damage over time relative to the intensity of the debuff\n" + "This debuff does not reduce your magic damage"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 7)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(8, 7)); } public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.accessory = true; + Item.width = 20; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) => player.Calamity().ChaosStone = true; diff --git a/Items/Accessories/CheatTestThing.cs b/Items/Accessories/CheatTestThing.cs index 9195ed98cf..a34ab5f723 100644 --- a/Items/Accessories/CheatTestThing.cs +++ b/Items/Accessories/CheatTestThing.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = 0; // lul intentionally has zero value - item.Calamity().customRarity = CalamityRarity.HotPink; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = 0; // lul intentionally has zero value + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/CoinofDeceit.cs b/Items/Accessories/CoinofDeceit.cs index 05092e6c76..c51e775e52 100644 --- a/Items/Accessories/CoinofDeceit.cs +++ b/Items/Accessories/CoinofDeceit.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 22; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.accessory = true; - item.rare = ItemRarityID.Blue; + Item.width = 20; + Item.height = 22; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.accessory = true; + Item.rare = ItemRarityID.Blue; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -31,14 +31,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyGoldBar", 4); - recipe.AddRecipeGroup("AnyCopperBar", 8); - // So you make fake coins out of wood, nobody will judge you - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyGoldBar", 4).AddRecipeGroup("AnyCopperBar", 8).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/CoreOfTheBloodGod.cs b/Items/Accessories/CoreOfTheBloodGod.cs index 8740809115..317fa1add3 100644 --- a/Items/Accessories/CoreOfTheBloodGod.cs +++ b/Items/Accessories/CoreOfTheBloodGod.cs @@ -18,16 +18,16 @@ namespace CalamityMod.Items.Accessories "Healing Potions are 15% more effective\n" + "Halves enemy contact damage\n" + "When you take contact damage this effect has a 20 second cooldown"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 4)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 4)); } public override void SetDefaults() { - item.width = item.height = 48; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.rare = ItemRarityID.Purple; + Item.width = Item.height = 48; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ItemRarityID.Purple; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -39,15 +39,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/CorrosiveSpine.cs b/Items/Accessories/CorrosiveSpine.cs index 07b43fb060..23abda2ed2 100644 --- a/Items/Accessories/CorrosiveSpine.cs +++ b/Items/Accessories/CorrosiveSpine.cs @@ -18,12 +18,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 18; - item.height = 46; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.defense = 4; - item.accessory = true; + Item.width = 18; + Item.height = 46; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.defense = 4; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/CorruptFlask.cs b/Items/Accessories/CorruptFlask.cs index 2ea4fe27d3..a9b9413255 100644 --- a/Items/Accessories/CorruptFlask.cs +++ b/Items/Accessories/CorruptFlask.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.accessory = true; + Item.width = 20; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -32,12 +32,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.VilePowder, 15); - recipe.AddIngredient(ItemID.RottenChunk, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.VilePowder, 15).AddIngredient(ItemID.RottenChunk, 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index ef829ab20e..1f17327873 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().dodgeScarf; diff --git a/Items/Accessories/CrawCarapace.cs b/Items/Accessories/CrawCarapace.cs index 4009821d34..0322fb7391 100644 --- a/Items/Accessories/CrawCarapace.cs +++ b/Items/Accessories/CrawCarapace.cs @@ -15,12 +15,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 3; - item.width = 28; - item.height = 28; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.defense = 3; + Item.width = 28; + Item.height = 28; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/CrimsonFlask.cs b/Items/Accessories/CrimsonFlask.cs index 58d44e7508..3e3d494efb 100644 --- a/Items/Accessories/CrimsonFlask.cs +++ b/Items/Accessories/CrimsonFlask.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.accessory = true; + Item.width = 20; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -32,12 +32,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ViciousPowder, 15); - recipe.AddIngredient(ItemID.Vertebrae, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ViciousPowder, 15).AddIngredient(ItemID.Vertebrae, 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/CrownJewel.cs b/Items/Accessories/CrownJewel.cs index 91a9b34d42..b29b820018 100644 --- a/Items/Accessories/CrownJewel.cs +++ b/Items/Accessories/CrownJewel.cs @@ -16,12 +16,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 5; - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.defense = 5; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/CryoStone.cs b/Items/Accessories/CryoStone.cs index dcda6173ef..e9f28cb1d4 100644 --- a/Items/Accessories/CryoStone.cs +++ b/Items/Accessories/CryoStone.cs @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Cryo Stone"); Tooltip.SetDefault("One of the ancient relics\n" + "Creates a rotating ice shield around you that damages and slows down enemies on contact"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 4)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(4, 4)); } public override void SetDefaults() { - item.width = 40; - item.height = 40; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 40; + Item.height = 40; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) => player.Calamity().CryoStone = true; diff --git a/Items/Accessories/DaawnlightSpiritOrigin.cs b/Items/Accessories/DaawnlightSpiritOrigin.cs index 34f4872c7a..2dd147774b 100644 --- a/Items/Accessories/DaawnlightSpiritOrigin.cs +++ b/Items/Accessories/DaawnlightSpiritOrigin.cs @@ -55,13 +55,13 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 22; - item.height = 38; - item.accessory = true; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - item.Calamity().donorItem = true; + Item.width = 22; + Item.height = 38; + Item.accessory = true; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.Calamity().donorItem = true; } // The pet is purely visual and does not affect the functionality of the item. @@ -85,15 +85,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/DaedalusEmblem.cs b/Items/Accessories/DaedalusEmblem.cs index 51743c227a..a370084474 100644 --- a/Items/Accessories/DaedalusEmblem.cs +++ b/Items/Accessories/DaedalusEmblem.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.accessory = true; + Item.width = 28; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -28,20 +28,14 @@ namespace CalamityMod.Items.Accessories player.Calamity().rangedAmmoCost *= 0.8f; player.lifeRegen += 2; player.statDefense += 5; - player.rangedDamage += 0.1f; - player.rangedCrit += 5; + player.GetDamage(DamageClass.Ranged) += 0.1f; + player.GetCritChance(DamageClass.Ranged) += 5; player.pickSpeed -= 0.15f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CelestialStone); - recipe.AddIngredient(ItemID.RangerEmblem); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.CelestialStone).AddIngredient(ItemID.RangerEmblem).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/DarkGodsSheath.cs b/Items/Accessories/DarkGodsSheath.cs index 7ea49b14a5..75b8f06dd4 100644 --- a/Items/Accessories/DarkGodsSheath.cs +++ b/Items/Accessories/DarkGodsSheath.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 48; - item.height = 62; - item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = ItemRarityID.Cyan; - item.accessory = true; + Item.width = 48; + Item.height = 62; + Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.rare = ItemRarityID.Cyan; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -40,13 +40,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index dadf4df362..637d26e035 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -20,19 +20,19 @@ namespace CalamityMod.Items.Accessories "During the day the player has +3 life regen\n" + "During the night the player has +15 defense\n" + "Both of these bonuses are granted during an eclipse"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 7)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 7)); } public override void SetDefaults() { - item.width = 42; - item.height = 60; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.defense = 10; - item.lifeRegen = 1; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 42; + Item.height = 60; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.defense = 10; + Item.lifeRegen = 1; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -43,12 +43,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/DeepDiver.cs b/Items/Accessories/DeepDiver.cs index c8c36ea047..535f62558e 100644 --- a/Items/Accessories/DeepDiver.cs +++ b/Items/Accessories/DeepDiver.cs @@ -16,12 +16,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 24; - item.height = 28; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.defense = 8; - item.accessory = true; + Item.width = 24; + Item.height = 28; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.defense = 8; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs index 86df2c6a93..9a56f48094 100644 --- a/Items/Accessories/DeificAmulet.cs +++ b/Items/Accessories/DeificAmulet.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.rare = ItemRarityID.Cyan; - item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.rare = ItemRarityID.Cyan; + Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -34,15 +34,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CharmofMyths); - recipe.AddIngredient(ItemID.StarVeil); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.MeteoriteBar, 10); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.CharmofMyths).AddIngredient(ItemID.StarVeil).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.MeteoriteBar, 10).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/DepthCharm.cs b/Items/Accessories/DepthCharm.cs index 3daf718845..508ed8d62f 100644 --- a/Items/Accessories/DepthCharm.cs +++ b/Items/Accessories/DepthCharm.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/DimensionalSoulArtifact.cs b/Items/Accessories/DimensionalSoulArtifact.cs index 7133641ac3..ea1e4ece90 100644 --- a/Items/Accessories/DimensionalSoulArtifact.cs +++ b/Items/Accessories/DimensionalSoulArtifact.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.accessory = true; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.width = 28; + Item.height = 28; + Item.accessory = true; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -36,13 +36,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index 59c7b08ea8..e5b88bb37f 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -14,17 +14,17 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Reduces the amount of defense damage you take by 50%\n" + "Standing still regenerates your life quickly, reduces your damage by 50% and boosts your defense by 75%\n" + "Nanomachines, son"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 11)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 11)); } public override void SetDefaults() { - item.width = 52; - item.height = 68; - item.accessory = true; - item.rare = ItemRarityID.Red; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 52; + Item.height = 68; + Item.accessory = true; + Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/DragonScales.cs b/Items/Accessories/DragonScales.cs index 57e19c6aa8..89c3f9cfed 100644 --- a/Items/Accessories/DragonScales.cs +++ b/Items/Accessories/DragonScales.cs @@ -18,12 +18,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 32; - item.height = 34; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Violet; - item.accessory = true; + Item.width = 32; + Item.height = 34; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/DukeScales.cs b/Items/Accessories/DukeScales.cs index 40978c7556..cd7eccced0 100644 --- a/Items/Accessories/DukeScales.cs +++ b/Items/Accessories/DukeScales.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 26; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 28; + Item.height = 26; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/DynamoStemCells.cs b/Items/Accessories/DynamoStemCells.cs index dc5b9aa110..5fa31b5f59 100644 --- a/Items/Accessories/DynamoStemCells.cs +++ b/Items/Accessories/DynamoStemCells.cs @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Dynamo Stem Cells"); Tooltip.SetDefault(@"10% increased movement speed Ranged weapons have a chance to fire mini swarmers"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5)); } public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.accessory = true; + Item.width = 20; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs index 603cf2fc48..34d139f8e8 100644 --- a/Items/Accessories/EclipseMirror.cs +++ b/Items/Accessories/EclipseMirror.cs @@ -27,12 +27,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 38; - item.height = 38; - item.rare = ItemRarityID.Purple; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.accessory = true; + Item.width = 38; + Item.height = 38; + Item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -50,13 +50,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/EldritchSoulArtifact.cs b/Items/Accessories/EldritchSoulArtifact.cs index 08601970d2..54798668a5 100644 --- a/Items/Accessories/EldritchSoulArtifact.cs +++ b/Items/Accessories/EldritchSoulArtifact.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 64; - item.height = 58; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; + Item.width = 64; + Item.height = 58; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -34,13 +34,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Accessories/ElectriciansGlove.cs b/Items/Accessories/ElectriciansGlove.cs index 4690be0a54..65ad33dc16 100644 --- a/Items/Accessories/ElectriciansGlove.cs +++ b/Items/Accessories/ElectriciansGlove.cs @@ -17,11 +17,11 @@ Stealth strikes also have +10 armor penetration, deal 10% more damage, and heal public override void SetDefaults() { - item.width = 24; - item.height = 40; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.accessory = true; - item.rare = ItemRarityID.Pink; + Item.width = 24; + Item.height = 40; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.accessory = true; + Item.rare = ItemRarityID.Pink; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -34,20 +34,8 @@ Stealth strikes also have +10 armor penetration, deal 10% more damage, and heal public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Wire, 100); - recipe.AddRecipeGroup("AnyMythrilBar", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Wire, 100); - recipe.AddRecipeGroup("AnyMythrilBar", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Wire, 100).AddRecipeGroup("AnyMythrilBar", 5).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Wire, 100).AddRecipeGroup("AnyMythrilBar", 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index 2e54a7fdd1..b2ffa1beef 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -22,11 +22,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 22; - item.height = 38; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 22; + Item.height = 38; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -37,15 +37,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FireGauntlet); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 8); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.FireGauntlet).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LunarBar, 8).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/ElementalQuiver.cs b/Items/Accessories/ElementalQuiver.cs index 9f4dfeffde..ee8cf28498 100644 --- a/Items/Accessories/ElementalQuiver.cs +++ b/Items/Accessories/ElementalQuiver.cs @@ -19,17 +19,17 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 28; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateAccessory(Player player, bool hideVisual) { - player.rangedDamage += 0.15f; - player.rangedCrit += 5; + player.GetDamage(DamageClass.Ranged) += 0.15f; + player.GetCritChance(DamageClass.Ranged) += 5; player.lifeRegen += 2; player.statDefense += 5; player.pickSpeed -= 0.15f; @@ -41,15 +41,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MagicQuiver); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 8); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.MagicQuiver).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LunarBar, 8).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index 8bd97f1607..3eb07d84ae 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -26,13 +26,13 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 48; - item.height = 42; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.defense = 18; - item.accessory = true; + Item.width = 48; + Item.height = 42; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.defense = 18; + Item.accessory = true; } public override void ModifyTooltips(List list) @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Accessories string hotkey = CalamityMod.AegisHotKey.TooltipHotkeyString(); foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip5") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip5") { line2.text = "Press " + hotkey + " to activate buffs to all damage, crit chance and defense"; } diff --git a/Items/Accessories/EnchantedPearl.cs b/Items/Accessories/EnchantedPearl.cs index a114742f19..f9c1aa5243 100644 --- a/Items/Accessories/EnchantedPearl.cs +++ b/Items/Accessories/EnchantedPearl.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -32,15 +32,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FishingPotion); - recipe.AddIngredient(ItemID.CratePotion, 8); - recipe.AddRecipeGroup("Boss2Material", 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.FishingPotion).AddIngredient(ItemID.CratePotion, 8).AddRecipeGroup("Boss2Material", 5).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/EtherealExtorter.cs b/Items/Accessories/EtherealExtorter.cs index e1243779c6..b7c5bad79a 100644 --- a/Items/Accessories/EtherealExtorter.cs +++ b/Items/Accessories/EtherealExtorter.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; + Item.width = 28; + Item.height = 32; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index e30a216a2c..4b91a0c754 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 28; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -37,22 +37,14 @@ namespace CalamityMod.Items.Accessories player.manaFlower = true; player.statManaMax2 += 150; - player.magicDamage += 0.15f; + player.GetDamage(DamageClass.Magic) += 0.15f; player.manaCost *= 0.9f; - player.magicCrit += 5; + player.GetCritChance(DamageClass.Magic) += 5; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.ManaFlower); - recipe.AddIngredient(ItemID.LunarBar, 8); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.ManaFlower).AddIngredient(ItemID.LunarBar, 8).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/EvasionScarf.cs b/Items/Accessories/EvasionScarf.cs index 1d556fb558..d0c2d3b62b 100644 --- a/Items/Accessories/EvasionScarf.cs +++ b/Items/Accessories/EvasionScarf.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.Calamity().donorItem = true; + Item.width = 26; + Item.height = 26; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.Calamity().donorItem = true; } public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().dodgeScarf; @@ -41,14 +41,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddIngredient(ItemID.SoulofLight, 5); - recipe.AddIngredient(ItemID.Silk, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofNight, 5).AddIngredient(ItemID.SoulofLight, 5).AddIngredient(ItemID.Silk, 15).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index df8f5f3892..a6402bb594 100644 --- a/Items/Accessories/EyeoftheStorm.cs +++ b/Items/Accessories/EyeoftheStorm.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 26; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 20; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) diff --git a/Items/Accessories/FabledTortoiseShell.cs b/Items/Accessories/FabledTortoiseShell.cs index a10c66138a..47e26ae0bb 100644 --- a/Items/Accessories/FabledTortoiseShell.cs +++ b/Items/Accessories/FabledTortoiseShell.cs @@ -18,12 +18,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 36; - item.width = 36; - item.height = 42; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.defense = 36; + Item.width = 36; + Item.height = 42; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/FeatherCrown.cs b/Items/Accessories/FeatherCrown.cs index 0c222672dd..f6753db2ba 100644 --- a/Items/Accessories/FeatherCrown.cs +++ b/Items/Accessories/FeatherCrown.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 44; - item.height = 38; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 44; + Item.height = 38; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -40,20 +40,8 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldCrown); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.Feather, 8); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PlatinumCrown); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.Feather, 8); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.GoldCrown).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.Feather, 8).AddTile(TileID.SkyMill).Register(); + CreateRecipe(1).AddIngredient(ItemID.PlatinumCrown).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.Feather, 8).AddTile(TileID.SkyMill).Register(); } } diff --git a/Items/Accessories/FilthyGlove.cs b/Items/Accessories/FilthyGlove.cs index 6ee3cc3f42..d6c6e2b637 100644 --- a/Items/Accessories/FilthyGlove.cs +++ b/Items/Accessories/FilthyGlove.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 24; - item.height = 38; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.accessory = true; - item.rare = ItemRarityID.Orange; + Item.width = 24; + Item.height = 38; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.accessory = true; + Item.rare = ItemRarityID.Orange; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -32,13 +32,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 4); - recipe.AddIngredient(ItemID.DemoniteBar, 4); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RottenChunk, 4).AddIngredient(ItemID.DemoniteBar, 4).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Accessories/FleshTotem.cs b/Items/Accessories/FleshTotem.cs index 282edcd22d..290637177d 100644 --- a/Items/Accessories/FleshTotem.cs +++ b/Items/Accessories/FleshTotem.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.rare = ItemRarityID.Yellow; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.rare = ItemRarityID.Yellow; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/FrigidBulwark.cs b/Items/Accessories/FrigidBulwark.cs index f397b16504..5f8c7506c9 100644 --- a/Items/Accessories/FrigidBulwark.cs +++ b/Items/Accessories/FrigidBulwark.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 34; - item.height = 40; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.defense = 13; - item.accessory = true; + Item.width = 34; + Item.height = 40; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.defense = 13; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -36,14 +36,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PaladinsShield); - recipe.AddIngredient(ItemID.FrozenTurtleShell); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.PaladinsShield).AddIngredient(ItemID.FrozenTurtleShell).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/FrostBarrier.cs b/Items/Accessories/FrostBarrier.cs index 0a0d992ff6..f4252ace32 100644 --- a/Items/Accessories/FrostBarrier.cs +++ b/Items/Accessories/FrostBarrier.cs @@ -16,12 +16,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 4; - item.width = 20; - item.height = 24; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.accessory = true; + Item.defense = 4; + Item.width = 20; + Item.height = 24; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/FrostFlare.cs b/Items/Accessories/FrostFlare.cs index 74903952fa..25a007f64b 100644 --- a/Items/Accessories/FrostFlare.cs +++ b/Items/Accessories/FrostFlare.cs @@ -16,16 +16,16 @@ namespace CalamityMod.Items.Accessories "Being above 75% life grants 10% increased damage\n" + "Being below 25% life grants 20 defense and 15% increased max movement speed and acceleration\n" + "Grants resistance against cold attacks"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 4)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 4)); } public override void SetDefaults() { - item.width = 20; - item.height = 24; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 20; + Item.height = 24; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/FungalCarapace.cs b/Items/Accessories/FungalCarapace.cs index b51615db5d..adea47d144 100644 --- a/Items/Accessories/FungalCarapace.cs +++ b/Items/Accessories/FungalCarapace.cs @@ -15,12 +15,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 6; - item.width = 20; - item.height = 24; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.accessory = true; + Item.defense = 6; + Item.width = 20; + Item.height = 24; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/FungalClump.cs b/Items/Accessories/FungalClump.cs index cb0e0d006f..77435cca04 100644 --- a/Items/Accessories/FungalClump.cs +++ b/Items/Accessories/FungalClump.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 26; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.accessory = true; + Item.width = 20; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().fungalClump; diff --git a/Items/Accessories/FungalSymbiote.cs b/Items/Accessories/FungalSymbiote.cs index c077c0f784..5520addd98 100644 --- a/Items/Accessories/FungalSymbiote.cs +++ b/Items/Accessories/FungalSymbiote.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 38; - item.height = 36; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 38; + Item.height = 36; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Gehenna.cs b/Items/Accessories/Gehenna.cs index 877926c245..18f82ed106 100644 --- a/Items/Accessories/Gehenna.cs +++ b/Items/Accessories/Gehenna.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/GiantPearl.cs b/Items/Accessories/GiantPearl.cs index d0b30097dc..e2f31979bf 100644 --- a/Items/Accessories/GiantPearl.cs +++ b/Items/Accessories/GiantPearl.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 42; - item.height = 32; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.accessory = true; + Item.width = 42; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/GiantShell.cs b/Items/Accessories/GiantShell.cs index 5b8e841a06..56943f54d6 100644 --- a/Items/Accessories/GiantShell.cs +++ b/Items/Accessories/GiantShell.cs @@ -17,12 +17,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 6; - item.width = 30; - item.height = 28; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.defense = 6; + Item.width = 30; + Item.height = 28; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/GiantTortoiseShell.cs b/Items/Accessories/GiantTortoiseShell.cs index 6ffae9ab7b..4f4cba5b18 100644 --- a/Items/Accessories/GiantTortoiseShell.cs +++ b/Items/Accessories/GiantTortoiseShell.cs @@ -15,12 +15,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 14; - item.width = 20; - item.height = 24; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.accessory = true; + Item.defense = 14; + Item.width = 20; + Item.height = 24; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/GladiatorsLocket.cs b/Items/Accessories/GladiatorsLocket.cs index 2eb3b03ee5..201b28ae53 100644 --- a/Items/Accessories/GladiatorsLocket.cs +++ b/Items/Accessories/GladiatorsLocket.cs @@ -18,12 +18,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 42; - item.height = 36; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.defense = 5; - item.accessory = true; + Item.width = 42; + Item.height = 36; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.defense = 5; + Item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) diff --git a/Items/Accessories/GloveOfRecklessness.cs b/Items/Accessories/GloveOfRecklessness.cs index 3a04b9c91d..81a7f4c62d 100644 --- a/Items/Accessories/GloveOfRecklessness.cs +++ b/Items/Accessories/GloveOfRecklessness.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 36; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.accessory = true; - item.rare = ItemRarityID.Lime; + Item.width = 28; + Item.height = 36; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.accessory = true; + Item.rare = ItemRarityID.Lime; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/GloveofPrecision.cs b/Items/Accessories/GloveofPrecision.cs index c0d92f0ea3..1bcad652c6 100644 --- a/Items/Accessories/GloveofPrecision.cs +++ b/Items/Accessories/GloveofPrecision.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 24; - item.height = 40; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.accessory = true; - item.rare = ItemRarityID.Lime; + Item.width = 24; + Item.height = 40; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.accessory = true; + Item.rare = ItemRarityID.Lime; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/GodlySoulArtifact.cs b/Items/Accessories/GodlySoulArtifact.cs index 471d0bf122..50ed183a58 100644 --- a/Items/Accessories/GodlySoulArtifact.cs +++ b/Items/Accessories/GodlySoulArtifact.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.accessory = true; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.width = 28; + Item.height = 28; + Item.accessory = true; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -35,13 +35,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Accessories/GrandGelatin.cs b/Items/Accessories/GrandGelatin.cs index 447016d7e8..b0d7067129 100644 --- a/Items/Accessories/GrandGelatin.cs +++ b/Items/Accessories/GrandGelatin.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 24; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 20; + Item.height = 24; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -39,15 +39,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofLight, 2); - recipe.AddIngredient(ItemID.SoulofNight, 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofLight, 2).AddIngredient(ItemID.SoulofNight, 2).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/GravistarSabaton.cs b/Items/Accessories/GravistarSabaton.cs index 2e82d343b6..5f2a6a64b3 100644 --- a/Items/Accessories/GravistarSabaton.cs +++ b/Items/Accessories/GravistarSabaton.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 22; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.accessory = true; - item.rare = ItemRarityID.Lime; + Item.width = 20; + Item.height = 22; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.accessory = true; + Item.rare = ItemRarityID.Lime; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/HallowedRune.cs b/Items/Accessories/HallowedRune.cs index 426faff59c..7d92aaa64d 100644 --- a/Items/Accessories/HallowedRune.cs +++ b/Items/Accessories/HallowedRune.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -30,15 +30,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.HallowedBar, 18); - recipe.AddIngredient(ItemID.SoulofFright, 5); - recipe.AddIngredient(ItemID.SoulofMight, 5); - recipe.AddIngredient(ItemID.SoulofSight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.HallowedBar, 18).AddIngredient(ItemID.SoulofFright, 5).AddIngredient(ItemID.SoulofMight, 5).AddIngredient(ItemID.SoulofSight, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/HarpyRing.cs b/Items/Accessories/HarpyRing.cs index 7b3ca849f8..a401158030 100644 --- a/Items/Accessories/HarpyRing.cs +++ b/Items/Accessories/HarpyRing.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 22; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 20; + Item.height = 22; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -32,13 +32,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Feather, 5); - recipe.AddIngredient(ItemID.FallenStar); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Feather, 5).AddIngredient(ItemID.FallenStar).AddTile(TileID.SkyMill).Register(); } } } diff --git a/Items/Accessories/HeartofDarkness.cs b/Items/Accessories/HeartofDarkness.cs index 284475c3fd..6379b3a8cf 100644 --- a/Items/Accessories/HeartofDarkness.cs +++ b/Items/Accessories/HeartofDarkness.cs @@ -17,16 +17,16 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("You constantly gain rage over time\n" + "Rage does not fade away when out of combat\n" + "Revengeance drop"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 4)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 4)); } public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 9ad08374cd..c1cb8897ae 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Heart of the Elements"); Tooltip.SetDefault("The heart of the world\n" + "Summons all elementals to protect you"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 8)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 8)); } public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = ItemRarityID.Cyan; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.Rainbow; + Item.width = 20; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.rare = ItemRarityID.Cyan; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.Rainbow; } public override bool CanEquipAccessory(Player player, int slot) @@ -96,15 +96,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemType()).AddIngredient(ItemType()).AddIngredient(ItemType()).AddIngredient(ItemType()).AddIngredient(ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/HideofAstrumDeus.cs b/Items/Accessories/HideofAstrumDeus.cs index be616e7d9c..40e7f6ee62 100644 --- a/Items/Accessories/HideofAstrumDeus.cs +++ b/Items/Accessories/HideofAstrumDeus.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = ItemRarityID.Cyan; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.rare = ItemRarityID.Cyan; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/HoneyDew.cs b/Items/Accessories/HoneyDew.cs index 81c3f45281..8d90e5d8eb 100644 --- a/Items/Accessories/HoneyDew.cs +++ b/Items/Accessories/HoneyDew.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 20; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -54,15 +54,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.BottledHoney, 10); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.ButterflyDust); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.BottledHoney, 10).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.ButterflyDust).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/HowlsHeart.cs b/Items/Accessories/HowlsHeart.cs index 95fa711276..dd0d7f6fbf 100644 --- a/Items/Accessories/HowlsHeart.cs +++ b/Items/Accessories/HowlsHeart.cs @@ -19,18 +19,18 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Howl's Heart"); Tooltip.SetDefault("Summons Howl to fight for you, Calcifer to light your way, and Turnip-Head to follow you around\n" + "Placing this accessory in vanity slots will summon the trio without the combat or exploration utilities"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 4)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 4)); } public override void SetDefaults() { - item.width = 20; - item.height = 26; - item.accessory = true; + Item.width = 20; + Item.height = 26; + Item.accessory = true; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().donorItem = true; } public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().howlsHeart; diff --git a/Items/Accessories/InkBomb.cs b/Items/Accessories/InkBomb.cs index 1cec68dfc8..181708d84e 100644 --- a/Items/Accessories/InkBomb.cs +++ b/Items/Accessories/InkBomb.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 22; - item.height = 50; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 22; + Item.height = 50; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/IronBoots.cs b/Items/Accessories/IronBoots.cs index a076e4a12f..9acb684065 100644 --- a/Items/Accessories/IronBoots.cs +++ b/Items/Accessories/IronBoots.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/JellyChargedBattery.cs b/Items/Accessories/JellyChargedBattery.cs index 2677a92e2d..0cee5a5776 100644 --- a/Items/Accessories/JellyChargedBattery.cs +++ b/Items/Accessories/JellyChargedBattery.cs @@ -16,30 +16,23 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 22; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.accessory = true; - item.rare = ItemRarityID.LightRed; + Item.width = 20; + Item.height = 22; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.accessory = true; + Item.rare = ItemRarityID.LightRed; } public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().voltaicJelly = true; player.Calamity().jellyChargedBattery = true; - player.minionDamage += 0.07f; + player.GetDamage(DamageClass.Summon) += 0.07f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/Laudanum.cs b/Items/Accessories/Laudanum.cs index c4c1269288..30657ad4a3 100644 --- a/Items/Accessories/Laudanum.cs +++ b/Items/Accessories/Laudanum.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/LeadCore.cs b/Items/Accessories/LeadCore.cs index 7408e2de37..42f377c336 100644 --- a/Items/Accessories/LeadCore.cs +++ b/Items/Accessories/LeadCore.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.rare = ItemRarityID.Pink; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.rare = ItemRarityID.Pink; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/LeviathanAmbergris.cs b/Items/Accessories/LeviathanAmbergris.cs index dd6117f8de..7ae7d6ce6f 100644 --- a/Items/Accessories/LeviathanAmbergris.cs +++ b/Items/Accessories/LeviathanAmbergris.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 20; - item.width = 20; - item.height = 22; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.accessory = true; - item.rare = ItemRarityID.Lime; + Item.defense = 20; + Item.width = 20; + Item.height = 22; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.accessory = true; + Item.rare = ItemRarityID.Lime; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/LifeJelly.cs b/Items/Accessories/LifeJelly.cs index 93bb76dda1..64d1900c5d 100644 --- a/Items/Accessories/LifeJelly.cs +++ b/Items/Accessories/LifeJelly.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 24; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.width = 20; + Item.height = 24; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/LivingDew.cs b/Items/Accessories/LivingDew.cs index 20202f13f4..80a0a7b4c9 100644 --- a/Items/Accessories/LivingDew.cs +++ b/Items/Accessories/LivingDew.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 20; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -36,13 +36,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bezoar); - recipe.AddIngredient(ItemID.Vine, 2); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Bezoar).AddIngredient(ItemID.Vine, 2).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/LumenousAmulet.cs b/Items/Accessories/LumenousAmulet.cs index 874b75e27e..b18d6a91b2 100644 --- a/Items/Accessories/LumenousAmulet.cs +++ b/Items/Accessories/LumenousAmulet.cs @@ -22,11 +22,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -39,14 +39,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/LureofEnthrallment.cs b/Items/Accessories/LureofEnthrallment.cs index 123282bf43..bb0d937773 100644 --- a/Items/Accessories/LureofEnthrallment.cs +++ b/Items/Accessories/LureofEnthrallment.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 56; - item.height = 56; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.accessory = true; + Item.width = 56; + Item.height = 56; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) diff --git a/Items/Accessories/LuxorsGift.cs b/Items/Accessories/LuxorsGift.cs index 83a142ad29..02f5d745dc 100644 --- a/Items/Accessories/LuxorsGift.cs +++ b/Items/Accessories/LuxorsGift.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 58; - item.height = 48; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 58; + Item.height = 48; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/MagicLevelMeter.cs b/Items/Accessories/MagicLevelMeter.cs index cd7f579dae..d09fe373bf 100644 --- a/Items/Accessories/MagicLevelMeter.cs +++ b/Items/Accessories/MagicLevelMeter.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = Item.buyPrice(0, 6, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void ModifyTooltips(List list) @@ -107,7 +107,7 @@ namespace CalamityMod.Items.Accessories } foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip0") { line2.text = "Tells you how high your magic proficiency is\n" + "While equipped you will gain magic proficiency faster\n" + diff --git a/Items/Accessories/ManaJelly.cs b/Items/Accessories/ManaJelly.cs index 445a991e43..fbce7d9511 100644 --- a/Items/Accessories/ManaJelly.cs +++ b/Items/Accessories/ManaJelly.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 24; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.width = 20; + Item.height = 24; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/ManaOverloader.cs b/Items/Accessories/ManaOverloader.cs index 3129c04444..f66f7f2216 100644 --- a/Items/Accessories/ManaOverloader.cs +++ b/Items/Accessories/ManaOverloader.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.accessory = true; + Item.width = 30; + Item.height = 30; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/MeleeLevelMeter.cs b/Items/Accessories/MeleeLevelMeter.cs index 4e93b1a7dc..bd3fe171d5 100644 --- a/Items/Accessories/MeleeLevelMeter.cs +++ b/Items/Accessories/MeleeLevelMeter.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = Item.buyPrice(0, 6, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void ModifyTooltips(List list) @@ -107,7 +107,7 @@ namespace CalamityMod.Items.Accessories } foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip0") { line2.text = "Tells you how high your melee proficiency is\n" + "While equipped you will gain melee proficiency faster\n" + diff --git a/Items/Accessories/MirageMirror.cs b/Items/Accessories/MirageMirror.cs index b269690673..970650dc2d 100644 --- a/Items/Accessories/MirageMirror.cs +++ b/Items/Accessories/MirageMirror.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 30; + Item.height = 30; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -34,21 +34,8 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MagicMirror); - recipe.AddIngredient(ItemID.BlackLens); - recipe.AddIngredient(ItemID.Bone, 50); - recipe.AddTile(TileID.TinkerersWorkbench); - recipe.SetResult(this); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IceMirror); - recipe.AddIngredient(ItemID.BlackLens); - recipe.AddIngredient(ItemID.Bone, 50); - recipe.AddTile(TileID.TinkerersWorkbench); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.MagicMirror).AddIngredient(ItemID.BlackLens).AddIngredient(ItemID.Bone, 50).AddTile(TileID.TinkerersWorkbench).Register(); + CreateRecipe(1).AddIngredient(ItemID.IceMirror).AddIngredient(ItemID.BlackLens).AddIngredient(ItemID.Bone, 50).AddTile(TileID.TinkerersWorkbench).Register(); } } } diff --git a/Items/Accessories/MomentumCapacitor.cs b/Items/Accessories/MomentumCapacitor.cs index b941544320..9b9eba4b81 100644 --- a/Items/Accessories/MomentumCapacitor.cs +++ b/Items/Accessories/MomentumCapacitor.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.value = Item.buyPrice(0, 36, 0, 0); - item.accessory = true; - item.rare = ItemRarityID.Pink; + Item.width = 28; + Item.height = 32; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.accessory = true; + Item.rare = ItemRarityID.Pink; } public override void ModifyTooltips(List list) @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories string hotkey = CalamityMod.MomentumCapacitatorHotkey.TooltipHotkeyString(); foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip0") { line2.text = "Press " + hotkey + " to consume 30% of your maximum stealth to create an energy field at the cursor position"; } diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs index 4880dd710b..2e8f61b15d 100644 --- a/Items/Accessories/MoonstoneCrown.cs +++ b/Items/Accessories/MoonstoneCrown.cs @@ -21,11 +21,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 46; - item.height = 40; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.accessory = true; + Item.width = 46; + Item.height = 40; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -44,13 +44,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LunarBar, 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } diff --git a/Items/Accessories/MutatedTruffle.cs b/Items/Accessories/MutatedTruffle.cs index 63c95db409..8d7ffb69b2 100644 --- a/Items/Accessories/MutatedTruffle.cs +++ b/Items/Accessories/MutatedTruffle.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 24; - item.height = 26; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.rare = ItemRarityID.Purple; - item.accessory = true; + Item.width = 24; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ItemRarityID.Purple; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index dc0f75f203..510868047e 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -25,11 +25,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 46; - item.height = 46; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 46; + Item.height = 46; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void ModifyTooltips(List list) @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Accessories int critLevel = Main.player[Main.myPlayer].Calamity().raiderStack; foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip7") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip7") { line2.text = "Rogue Crit Level: " + critLevel; } @@ -58,17 +58,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 8); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LunarBar, 8).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index 14bed7426c..0eba2d14bb 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -20,19 +20,19 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 16; - item.height = 14; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.rare = ItemRarityID.Purple; + Item.width = 16; + Item.height = 14; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ItemRarityID.Purple; } public override void Update(ref float gravity, ref float maxFallSpeed) { float num = Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.35f * num, 0.05f * num, 0.35f * num); + Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.35f * num, 0.05f * num, 0.35f * num); } public override void UpdateAccessory(Player player, bool hideVisual) @@ -72,7 +72,7 @@ namespace CalamityMod.Items.Accessories int num6 = (int)center.X / 16; int num7 = (int)center.Y / 16; bool flag = false; - if (Main.rand.NextBool(3) && Main.tile[num6, num7] != null && Main.tile[num6, num7].wall > 0) + if (Main.rand.NextBool(3) && Main.tile[num6, num7] != null && Main.tile[num6, num7].WallType > 0) { flag = true; } diff --git a/Items/Accessories/NecklaceofVexation.cs b/Items/Accessories/NecklaceofVexation.cs index dea5f3e123..628bc959e5 100644 --- a/Items/Accessories/NecklaceofVexation.cs +++ b/Items/Accessories/NecklaceofVexation.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 34; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.accessory = true; + Item.width = 26; + Item.height = 34; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -33,12 +33,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AvengerEmblem); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.AvengerEmblem).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/NuclearRod.cs b/Items/Accessories/NuclearRod.cs index 18efe78905..ac457a047e 100644 --- a/Items/Accessories/NuclearRod.cs +++ b/Items/Accessories/NuclearRod.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 28; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Nucleogenesis.cs b/Items/Accessories/Nucleogenesis.cs index a1535c0b4b..36499797c9 100644 --- a/Items/Accessories/Nucleogenesis.cs +++ b/Items/Accessories/Nucleogenesis.cs @@ -21,11 +21,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 28; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -37,20 +37,12 @@ namespace CalamityMod.Items.Accessories modPlayer.voltaicJelly = true; //electrified modPlayer.starTaintedGenerator = true; //astral infection and irradiated player.minionKB += 3f; - player.minionDamage += 0.15f; + player.GetDamage(DamageClass.Summon) += 0.15f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 8); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LunarBar, 8).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/OccultSkullCrown.cs b/Items/Accessories/OccultSkullCrown.cs index 0618e01010..ec4bf699c8 100644 --- a/Items/Accessories/OccultSkullCrown.cs +++ b/Items/Accessories/OccultSkullCrown.cs @@ -25,13 +25,13 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 82; - item.height = 62; - item.defense = 5; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.accessory = true; + Item.width = 82; + Item.height = 62; + Item.defense = 5; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.accessory = true; } public override void UpdateEquip(Player player) @@ -44,14 +44,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/OceanCrest.cs b/Items/Accessories/OceanCrest.cs index ad594f0245..20cd514aad 100644 --- a/Items/Accessories/OceanCrest.cs +++ b/Items/Accessories/OceanCrest.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 18; - item.height = 26; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.accessory = true; + Item.width = 18; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/OldDie.cs b/Items/Accessories/OldDie.cs index 778f88c9a6..e9fafa6191 100644 --- a/Items/Accessories/OldDie.cs +++ b/Items/Accessories/OldDie.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 24; - item.height = 26; - item.rare = ItemRarityID.Orange; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.accessory = true; + Item.width = 24; + Item.height = 26; + Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index de7c44d171..6715622cbe 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 36; - item.height = 32; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.defense = 8; - item.accessory = true; + Item.width = 36; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.defense = 8; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -44,12 +44,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.CrystalShard, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.CrystalShard, 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/PermafrostsConcoction.cs b/Items/Accessories/PermafrostsConcoction.cs index 4b01ac1478..1e86aed082 100644 --- a/Items/Accessories/PermafrostsConcoction.cs +++ b/Items/Accessories/PermafrostsConcoction.cs @@ -18,11 +18,11 @@ You are encased in an ice barrier for 3 seconds when revived"); public override void SetDefaults() { - item.accessory = true; - item.width = 36; - item.height = 34; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; + Item.accessory = true; + Item.width = 36; + Item.height = 34; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/PhantomicArtifact.cs b/Items/Accessories/PhantomicArtifact.cs index b3894285c1..2a43fcf660 100644 --- a/Items/Accessories/PhantomicArtifact.cs +++ b/Items/Accessories/PhantomicArtifact.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Items.Accessories "If you have the offensive boost, enemies hit by minions will sometimes be hit by phantomic knives\n" + "If you have the regenerative boost, a phantomic heart will occasionally materialise granting massive health regen\n" + "If you have the defensive boost, a phantomic bulwark will absorb 20% of the next projectile's damage that hits the bulwark, shattering it"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 7)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 7)); } public override void SetDefaults() { - item.width = 50; - item.height = 40; - item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.accessory = true; + Item.width = 50; + Item.height = 40; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -37,14 +37,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs index 7f3cad08b3..7ccd4073cb 100644 --- a/Items/Accessories/PlagueHive.cs +++ b/Items/Accessories/PlagueHive.cs @@ -17,21 +17,16 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 42; - item.height = 48; - item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = ItemRarityID.Cyan; - item.accessory = true; + Item.width = 42; + Item.height = 48; + Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.rare = ItemRarityID.Cyan; + Item.accessory = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.HoneyComb); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.HoneyComb).AddTile(TileID.LunarCraftingStation).Register(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/PlaguedFuelPack.cs b/Items/Accessories/PlaguedFuelPack.cs index 1719a4282f..489be1b7cd 100644 --- a/Items/Accessories/PlaguedFuelPack.cs +++ b/Items/Accessories/PlaguedFuelPack.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 36; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.accessory = true; + Item.width = 20; + Item.height = 36; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().hasJetpack; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Accessories string hotkey = CalamityMod.PlaguePackHotKey.TooltipHotkeyString(); foreach (TooltipLine line in list) { - if (line.mod == "Terraria" && line.Name == "Tooltip2") + if (line.Mod == "Terraria" && line.Name == "Tooltip2") { line.text = "Press " + hotkey + " to consume 25% of your maximum stealth to perform a swift upwards/diagonal dash which leaves a trail of plagued clouds"; } diff --git a/Items/Accessories/ProfanedSoulArtifact.cs b/Items/Accessories/ProfanedSoulArtifact.cs index 84a80167ad..6c5a05a9e4 100644 --- a/Items/Accessories/ProfanedSoulArtifact.cs +++ b/Items/Accessories/ProfanedSoulArtifact.cs @@ -19,17 +19,17 @@ namespace CalamityMod.Items.Accessories "Summons a defensive guardian if you have at least 10 minion slots, which boosts your movement speed and your damage resistance\n" + "Summons an offensive guardian if you are wearing the tarragon summon set (or stronger), which boosts your summon damage and your minion slots\n" + "If you get hit, most of their effects will disappear for 5 seconds"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); } public override void SetDefaults() { - item.width = 32; - item.height = 40; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().donorItem = true; + Item.width = 32; + Item.height = 40; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().donorItem = true; } public override bool CanEquipAccessory(Player player, int slot) @@ -45,13 +45,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index faa110e948..e56733abb7 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -9,6 +9,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Accessories { @@ -42,17 +43,17 @@ namespace CalamityMod.Items.Accessories "Provides buffs depending on the time of day\n" + "Thinking back, it was a boring life\n" + "[c/FFBF49:And so we burn it all in the name of purity]"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 4)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(8, 4)); } public override void SetDefaults() { - item.width = 50; - item.height = 50; - item.accessory = true; - item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.width = 50; + Item.height = 50; + Item.accessory = true; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } public override bool CanEquipAccessory(Player player, int slot) @@ -69,7 +70,7 @@ namespace CalamityMod.Items.Accessories int index = 0; foreach (TooltipLine line in tooltips) { - if (line.mod == "Terraria" && line.Name.StartsWith("Tooltip")) + if (line.Mod == "Terraria" && line.Name.StartsWith("Tooltip")) { if (line.Name == "Tooltip0") { @@ -80,7 +81,7 @@ namespace CalamityMod.Items.Accessories line.text = ""; } } - else if (line.mod == "Terraria" && line.text.Contains("Sell price")) + else if (line.Mod == "Terraria" && line.text.Contains("Sell price")) { line.text = ""; } @@ -94,7 +95,7 @@ namespace CalamityMod.Items.Accessories int manaCost = (int)(100 * Main.player[Main.myPlayer].manaCost); foreach (TooltipLine line in tooltips) { - if (line.mod == "Terraria" && line.Name == "Tooltip5") + if (line.Mod == "Terraria" && line.Name == "Tooltip5") { line.text = "[c/3a83e4:Transforms Magic attacks into a powerful splitting fireball for " + manaCost + " mana per cast]"; } @@ -146,14 +147,14 @@ namespace CalamityMod.Items.Accessories Projectile.NewProjectile(player.Center.X, player.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), (int)((shouldNerf ? 175 : 350) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f); spread -= Main.rand.Next(2, 4); - Main.PlaySound(SoundID.Item20, player.Center); + SoundEngine.PlaySound(SoundID.Item20, player.Center); } player.Calamity().profanedSoulWeaponUsage = 0; } else { Projectile.NewProjectile(player.Center, correctedVelocity * 6.9f, ModContent.ProjectileType(), (int)((shouldNerf ? 125 : 250) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f); - Main.PlaySound(SoundID.Item20, player.Center); + SoundEngine.PlaySound(SoundID.Item20, player.Center); } } @@ -186,7 +187,7 @@ namespace CalamityMod.Items.Accessories } if (projType > 1) { - Main.PlaySound(SoundID.Item20, player.Center); + SoundEngine.PlaySound(SoundID.Item20, player.Center); } } } @@ -209,7 +210,7 @@ namespace CalamityMod.Items.Accessories player.manaRegenDelay = (int)player.maxRegenDelay; player.statMana -= manaCost; correctedVelocity *= 25f; - Main.PlaySound(SoundID.Item20, player.Center); + SoundEngine.PlaySound(SoundID.Item20, player.Center); int dam = (int)((shouldNerf ? 450 : 900) * player.MinionDamage()); if (player.HasBuff(BuffID.ManaSickness)) { @@ -239,7 +240,7 @@ namespace CalamityMod.Items.Accessories int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 88 : 176) * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMinion = true; - Main.PlaySound(SoundID.Item20, player.Center); + SoundEngine.PlaySound(SoundID.Item20, player.Center); } player.Calamity().profanedSoulWeaponUsage = 0; } @@ -249,7 +250,7 @@ namespace CalamityMod.Items.Accessories int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 110 : 220) * player.MinionDamage()), 1f, player.whoAmI, 1f, 0f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMinion = true; - Main.PlaySound(SoundID.Item20, player.Center); + SoundEngine.PlaySound(SoundID.Item20, player.Center); } player.Calamity().profanedSoulWeaponUsage += enrage ? 1 : 2; if (!enrage && player.Calamity().profanedSoulWeaponUsage % 2 != 0) @@ -261,18 +262,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - PSCRecipe recipe = new PSCRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.ObsidianRose); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddIngredient(ModContent.ItemType(), 100); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.needLava = true; - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.ObsidianRose).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 50).AddIngredient(ModContent.ItemType(), 100).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } diff --git a/Items/Accessories/PsychoticAmulet.cs b/Items/Accessories/PsychoticAmulet.cs index abdff8c8b1..a09710ef85 100644 --- a/Items/Accessories/PsychoticAmulet.cs +++ b/Items/Accessories/PsychoticAmulet.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Accessories player.shroomiteStealth = true; modPlayer.throwingDamage += 0.05f; modPlayer.throwingCrit += 5; - player.rangedDamage += 0.05f; - player.rangedCrit += 5; + player.GetDamage(DamageClass.Ranged) += 0.05f; + player.GetCritChance(DamageClass.Ranged) += 5; } } } diff --git a/Items/Accessories/RadiantOoze.cs b/Items/Accessories/RadiantOoze.cs index d866cf7409..97f17d5bf5 100644 --- a/Items/Accessories/RadiantOoze.cs +++ b/Items/Accessories/RadiantOoze.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.accessory = true; + Item.width = 20; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 45); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 45).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index b6cc47d190..2aa87eacab 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 30; - item.height = 36; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.accessory = true; + Item.width = 30; + Item.height = 36; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; } public override void ModifyTooltips(List list) @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories int critLevel = Main.player[Main.myPlayer].Calamity().raiderStack; foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip3") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip3") { line2.text = "Rogue Crit Level: " + critLevel; } @@ -46,12 +46,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Leather, 5); - recipe.AddIngredient(ItemID.Obsidian, 20); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Leather, 5).AddIngredient(ItemID.Obsidian, 20).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index 51d2de898a..507a49af5c 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -23,12 +23,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 64; - item.height = 62; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.defense = 18; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 64; + Item.height = 62; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.defense = 18; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -43,16 +43,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/RangedLevelMeter.cs b/Items/Accessories/RangedLevelMeter.cs index b68fdde67f..05971b94a3 100644 --- a/Items/Accessories/RangedLevelMeter.cs +++ b/Items/Accessories/RangedLevelMeter.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = Item.buyPrice(0, 6, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void ModifyTooltips(List list) @@ -107,7 +107,7 @@ namespace CalamityMod.Items.Accessories } foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip0") { line2.text = "Tells you how high your ranged proficiency is\n" + "While equipped you will gain ranged proficiency faster\n" + diff --git a/Items/Accessories/ReaperToothNecklace.cs b/Items/Accessories/ReaperToothNecklace.cs index 61dea31ac2..2c59a1bec7 100644 --- a/Items/Accessories/ReaperToothNecklace.cs +++ b/Items/Accessories/ReaperToothNecklace.cs @@ -16,12 +16,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 44; - item.height = 50; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 44; + Item.height = 50; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -32,15 +32,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.TinkerersWorkbench); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.TinkerersWorkbench).Register(); } } } diff --git a/Items/Accessories/Regenator.cs b/Items/Accessories/Regenator.cs index 677eab3a26..dfe714bd84 100644 --- a/Items/Accessories/Regenator.cs +++ b/Items/Accessories/Regenator.cs @@ -15,12 +15,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 34; - item.height = 56; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.defense = 10; - item.accessory = true; + Item.width = 34; + Item.height = 56; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.defense = 10; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/RogueEmblem.cs b/Items/Accessories/RogueEmblem.cs index 6790e86014..641ff86a90 100644 --- a/Items/Accessories/RogueEmblem.cs +++ b/Items/Accessories/RogueEmblem.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 24; - item.height = 24; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.accessory = true; + Item.width = 24; + Item.height = 24; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/RogueLevelMeter.cs b/Items/Accessories/RogueLevelMeter.cs index 7777dec2a6..1572cea906 100644 --- a/Items/Accessories/RogueLevelMeter.cs +++ b/Items/Accessories/RogueLevelMeter.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = Item.buyPrice(0, 6, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void ModifyTooltips(List list) @@ -107,7 +107,7 @@ namespace CalamityMod.Items.Accessories } foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip0") { line2.text = "Tells you how high your rogue proficiency is\n" + "While equipped you will gain rogue proficiency faster\n" + diff --git a/Items/Accessories/RoseStone.cs b/Items/Accessories/RoseStone.cs index 18e1bc8318..43fee7bf73 100644 --- a/Items/Accessories/RoseStone.cs +++ b/Items/Accessories/RoseStone.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 20; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) diff --git a/Items/Accessories/RottenBrain.cs b/Items/Accessories/RottenBrain.cs index 37ef1cf4d7..bdcedb6ff7 100644 --- a/Items/Accessories/RottenBrain.cs +++ b/Items/Accessories/RottenBrain.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 34; - item.height = 34; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 34; + Item.height = 34; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/RottenDogtooth.cs b/Items/Accessories/RottenDogtooth.cs index b495dbb489..dc128d232e 100644 --- a/Items/Accessories/RottenDogtooth.cs +++ b/Items/Accessories/RottenDogtooth.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 14; - item.height = 22; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.width = 14; + Item.height = 22; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/RoverDrive.cs b/Items/Accessories/RoverDrive.cs index 2d6c51ec5e..6867ef7f4d 100644 --- a/Items/Accessories/RoverDrive.cs +++ b/Items/Accessories/RoverDrive.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 38; - item.height = 26; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.width = 38; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/RuinMedallion.cs b/Items/Accessories/RuinMedallion.cs index e0f6e3260d..dc818729f8 100644 --- a/Items/Accessories/RuinMedallion.cs +++ b/Items/Accessories/RuinMedallion.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 28; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 20; + Item.height = 28; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -34,13 +34,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs index 458d4d62d6..d655b53851 100644 --- a/Items/Accessories/RustyMedallion.cs +++ b/Items/Accessories/RustyMedallion.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 18; - item.height = 32; - item.rare = ItemRarityID.Blue; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.accessory = true; + Item.width = 18; + Item.height = 32; + Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.Accessories } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddRecipeGroup("IronBar", 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddRecipeGroup("IronBar", 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/SamuraiBadge.cs b/Items/Accessories/SamuraiBadge.cs index f8adb024e8..263f679a8e 100644 --- a/Items/Accessories/SamuraiBadge.cs +++ b/Items/Accessories/SamuraiBadge.cs @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Warbanner of the Sun"); Tooltip.SetDefault("Increases melee damage, true melee damage and melee speed the closer you are to enemies\n" + "Max boost is 20% increased melee damage, true melee damage and melee speed"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5)); } public override void SetDefaults() { - item.width = 32; - item.height = 78; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.accessory = true; + Item.width = 32; + Item.height = 78; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/SandCloak.cs b/Items/Accessories/SandCloak.cs index cd39a3e57e..0d23f7bdc8 100644 --- a/Items/Accessories/SandCloak.cs +++ b/Items/Accessories/SandCloak.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 30; - item.height = 44; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.accessory = true; + Item.width = 30; + Item.height = 44; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; } public override void ModifyTooltips(List list) @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories string hotkey = CalamityMod.SandCloakHotkey.TooltipHotkeyString(); foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip1") { line2.text = "Press " + hotkey + " to consume 25% of your maximum stealth to create a protective dust veil which provides +6 defense and +2 life regen"; } diff --git a/Items/Accessories/SandSharkToothNecklace.cs b/Items/Accessories/SandSharkToothNecklace.cs index 336a3a17c9..3bb16e93d2 100644 --- a/Items/Accessories/SandSharkToothNecklace.cs +++ b/Items/Accessories/SandSharkToothNecklace.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 32; - item.height = 44; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; + Item.width = 32; + Item.height = 44; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -30,13 +30,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SharkToothNecklace); - recipe.AddIngredient(ItemID.AvengerEmblem); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.TinkerersWorkbench); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SharkToothNecklace).AddIngredient(ItemID.AvengerEmblem).AddIngredient(ModContent.ItemType()).AddTile(TileID.TinkerersWorkbench).Register(); } } } diff --git a/Items/Accessories/ScuttlersJewel.cs b/Items/Accessories/ScuttlersJewel.cs index 7435ea1c4c..f0b50abe32 100644 --- a/Items/Accessories/ScuttlersJewel.cs +++ b/Items/Accessories/ScuttlersJewel.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/SeaShell.cs b/Items/Accessories/SeaShell.cs index b9c0194ea8..2110ac5df1 100644 --- a/Items/Accessories/SeaShell.cs +++ b/Items/Accessories/SeaShell.cs @@ -16,12 +16,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 3; - item.width = 20; - item.height = 24; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.accessory = true; + Item.defense = 3; + Item.width = 20; + Item.height = 24; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/ShatteredCommunity.cs b/Items/Accessories/ShatteredCommunity.cs index 083af91fd9..8022529ea4 100644 --- a/Items/Accessories/ShatteredCommunity.cs +++ b/Items/Accessories/ShatteredCommunity.cs @@ -8,6 +8,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; +using Terraria.Audio; namespace CalamityMod.Items.Accessories { @@ -39,18 +40,18 @@ namespace CalamityMod.Items.Accessories "Taking damage gives rage, this effect is not hindered by your defensive stats\n" + "While Rage Mode is active, taking damage gives only half as much rage\n" + "Deal damage with Rage Mode to further empower your wrath\n"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(7, 5)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(7, 5)); } public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.accessory = true; - item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.width = 20; + Item.height = 20; + Item.accessory = true; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } // Not overriding these Clones makes tooltips fail to function correctly due to HoverItem spaghetti. @@ -97,7 +98,7 @@ namespace CalamityMod.Items.Accessories public override void PostUpdate() { float brightness = Main.essScale; - Lighting.AddLight(item.Center, 0.92f * brightness, 0.42f * brightness, 0.92f * brightness); + Lighting.AddLight(Item.Center, 0.92f * brightness, 0.42f * brightness, 0.92f * brightness); } internal static void AccumulateRageDamage(Player player, CalamityPlayer mp, long damage) @@ -146,7 +147,7 @@ namespace CalamityMod.Items.Accessories // Play a weird dimensional lightning sound simultaneously. var extraSound = SoundID.DD2_EtherianPortalDryadTouch.WithVolume(1.4f); - Main.PlaySound(extraSound, player.Center); + SoundEngine.PlaySound(extraSound, player.Center); // Display a level up text notification. Rectangle textArea = new Rectangle((int)player.Center.X, (int)player.Center.Y, 1, 1); @@ -165,7 +166,7 @@ namespace CalamityMod.Items.Accessories sb.Append(" (+"); sb.Append(level); sb.Append("% Rage Mode damage)"); - tooltips.Add(new TooltipLine(mod, "Tooltip6", sb.ToString())); + tooltips.Add(new TooltipLine(Mod, "Tooltip6", sb.ToString())); sb.Clear(); if (level < MaxLevel) @@ -179,14 +180,14 @@ namespace CalamityMod.Items.Accessories sb.Append("Progress to next level: "); sb.Append(percent); sb.Append('%'); - tooltips.Add(new TooltipLine(mod, "Tooltip7", sb.ToString())); + tooltips.Add(new TooltipLine(Mod, "Tooltip7", sb.ToString())); sb.Clear(); } // Line 8: Total damage dealt sb.Append("Total Rage Mode damage: "); sb.Append(totalRageDamage); - tooltips.Add(new TooltipLine(mod, "Tooltip8", sb.ToString())); + tooltips.Add(new TooltipLine(Mod, "Tooltip8", sb.ToString())); } public override TagCompound Save() @@ -214,7 +215,7 @@ namespace CalamityMod.Items.Accessories writer.Write(totalRageDamage); } - public override void NetRecieve(BinaryReader reader) + public override void NetReceive(BinaryReader reader) { level = reader.ReadInt32(); totalRageDamage = reader.ReadInt64(); diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index d10f6e01ba..277d3af001 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -17,12 +17,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 24; - item.height = 28; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.defense = 2; - item.accessory = true; + Item.width = 24; + Item.height = 28; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.defense = 2; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -43,12 +43,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Coral, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Coral, 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/SigilofCalamitas.cs b/Items/Accessories/SigilofCalamitas.cs index 7f0f0c5006..d14ce1f129 100644 --- a/Items/Accessories/SigilofCalamitas.cs +++ b/Items/Accessories/SigilofCalamitas.cs @@ -14,37 +14,29 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("15% increased magic damage and 10% decreased mana usage\n" + "+100 max mana\n" + "Increases pickup range for mana stars"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 8)); } public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.accessory = true; + Item.width = 28; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { player.manaMagnet = true; player.statManaMax2 += 100; - player.magicDamage += 0.15f; + player.GetDamage(DamageClass.Magic) += 0.15f; player.manaCost *= 0.9f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CelestialEmblem); - recipe.AddRecipeGroup("AnyEvilWater", 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.CelestialEmblem).AddRecipeGroup("AnyEvilWater", 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/SilencingSheath.cs b/Items/Accessories/SilencingSheath.cs index cbd1c0b824..b204a28467 100644 --- a/Items/Accessories/SilencingSheath.cs +++ b/Items/Accessories/SilencingSheath.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 32; - item.height = 34; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 32; + Item.height = 34; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -33,13 +33,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyEvilBar", 8); - recipe.AddIngredient(ItemID.Silk, 10); - recipe.AddRecipeGroup("Boss2Material", 3); - recipe.AddTile(TileID.TinkerersWorkbench); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyEvilBar", 8).AddIngredient(ItemID.Silk, 10).AddRecipeGroup("Boss2Material", 3).AddTile(TileID.TinkerersWorkbench).Register(); } } } diff --git a/Items/Accessories/SirensHeart.cs b/Items/Accessories/SirensHeart.cs index 224722b784..ec7ed25ee4 100644 --- a/Items/Accessories/SirensHeart.cs +++ b/Items/Accessories/SirensHeart.cs @@ -22,11 +22,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; + Item.width = 18; + Item.height = 18; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/SpectralVeil.cs b/Items/Accessories/SpectralVeil.cs index fd515daa67..7e057b2c5d 100644 --- a/Items/Accessories/SpectralVeil.cs +++ b/Items/Accessories/SpectralVeil.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 30; - item.height = 38; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.accessory = true; + Item.width = 30; + Item.height = 38; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.accessory = true; } public override void ModifyTooltips(List list) @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories string hotkey = CalamityMod.SpectralVeilHotKey.TooltipHotkeyString(); foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip1") { line2.text = "Press " + hotkey + " to consume 25% of your maximum stealth to perform a mid-range teleport and render you momentarily invulnerable"; } diff --git a/Items/Accessories/SpiritGenerator.cs b/Items/Accessories/SpiritGenerator.cs index 3062604e38..16fa84cb30 100644 --- a/Items/Accessories/SpiritGenerator.cs +++ b/Items/Accessories/SpiritGenerator.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -31,13 +31,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Diamond, 5); - recipe.AddIngredient(ItemID.IronBar, 15); - recipe.anyIronBar = true; - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Diamond, 5).AddIngredient(ItemID.IronBar, 15).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/Sponge.cs b/Items/Accessories/Sponge.cs index 70def6adf2..5df0cf9f4b 100644 --- a/Items/Accessories/Sponge.cs +++ b/Items/Accessories/Sponge.cs @@ -25,17 +25,17 @@ namespace CalamityMod.Items.Accessories "Enemies take damage when they hit you\n" + "You emit a cloud of mushroom spores when you are hit\n" + "6.25% of the damage from enemy attacks is absorbed and converted into healing"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 30)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 30)); } public override void SetDefaults() { - item.defense = 20; - item.width = 20; - item.height = 20; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.defense = 20; + Item.width = 20; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -54,8 +54,8 @@ namespace CalamityMod.Items.Accessories { if (Texture == "CalamityMod/Items/Accessories/Sponge") { - Texture2D tex = ModContent.GetTexture("CalamityMod/Items/Accessories/SpongeShield"); - spriteBatch.Draw(tex, item.Center - Main.screenPosition + new Vector2(0f, 0f), Main.itemAnimations[item.type].GetFrame(tex), Color.Cyan * 0.5f, 0f, new Vector2(tex.Width / 2f, (tex.Height / 30f ) * 0.8f), 1f, SpriteEffects.None, 0); + Texture2D tex = ModContent.Request("CalamityMod/Items/Accessories/SpongeShield"); + spriteBatch.Draw(tex, Item.Center - Main.screenPosition + new Vector2(0f, 0f), Main.itemAnimations[Item.type].GetFrame(tex), Color.Cyan * 0.5f, 0f, new Vector2(tex.Width / 2f, (tex.Height / 30f ) * 0.8f), 1f, SpriteEffects.None, 0); } } @@ -63,22 +63,14 @@ namespace CalamityMod.Items.Accessories { if (Texture == "CalamityMod/Items/Accessories/Sponge") { - Texture2D tex = ModContent.GetTexture("CalamityMod/Items/Accessories/SpongeShield"); - spriteBatch.Draw(tex, position, Main.itemAnimations[item.type].GetFrame(tex), Color.Cyan * 0.4f, 0f, origin, scale, SpriteEffects.None, 0); + Texture2D tex = ModContent.Request("CalamityMod/Items/Accessories/SpongeShield"); + spriteBatch.Draw(tex, position, Main.itemAnimations[Item.type].GetFrame(tex), Color.Cyan * 0.4f, 0f, origin, scale, SpriteEffects.None, 0); } } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/StarTaintedGenerator.cs b/Items/Accessories/StarTaintedGenerator.cs index 4e2d55e9cf..86a6761636 100644 --- a/Items/Accessories/StarTaintedGenerator.cs +++ b/Items/Accessories/StarTaintedGenerator.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 22; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; + Item.width = 20; + Item.height = 22; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -29,19 +29,12 @@ namespace CalamityMod.Items.Accessories player.Calamity().voltaicJelly = true; player.Calamity().starbusterCore = true; player.Calamity().starTaintedGenerator = true; - player.minionDamage += 0.07f; + player.GetDamage(DamageClass.Summon) += 0.07f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/StarbusterCore.cs b/Items/Accessories/StarbusterCore.cs index f5868364ec..50f81235d9 100644 --- a/Items/Accessories/StarbusterCore.cs +++ b/Items/Accessories/StarbusterCore.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.accessory = true; + Item.width = 28; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index d197dfdaa5..631accd319 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -18,10 +18,10 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = ItemRarityID.Blue; + Item.width = 26; + Item.height = 26; + Item.value = Item.buyPrice(0, 6, 0, 0); + Item.rare = ItemRarityID.Blue; } public override void ModifyTooltips(List list) @@ -38,12 +38,12 @@ namespace CalamityMod.Items.Accessories // Replace the vanilla tooltip with a full stat readout foreach (TooltipLine l in list) { - if (l.mod == "Terraria" && l.Name == "Tooltip0") + if (l.Mod == "Terraria" && l.Name == "Tooltip0") l.text = CreateStatMeterTooltip(player, modPlayer, heldItem); } // To save screen space, favorited tooltips do not exist for the Stat Meter - list.RemoveAll(l => l.mod == "Terraria" && (l.Name == "Favorite" || l.Name == "FavoriteDesc")); + list.RemoveAll(l => l.Mod == "Terraria" && (l.Name == "Favorite" || l.Name == "FavoriteDesc")); } private string CreateStatMeterTooltip(Player player, CalamityPlayer modPlayer, Item heldItem) diff --git a/Items/Accessories/StatisBeltOfCurses.cs b/Items/Accessories/StatisBeltOfCurses.cs index bcb72f5712..2186c5491d 100644 --- a/Items/Accessories/StatisBeltOfCurses.cs +++ b/Items/Accessories/StatisBeltOfCurses.cs @@ -18,16 +18,16 @@ namespace CalamityMod.Items.Accessories "The dodge has a 90 second cooldown\n" + "This cooldown is shared with all other dodges and reflects\n" + "Dashes leave homing scythes in your wake"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 3)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(8, 3)); } public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 28; + Item.height = 32; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -44,14 +44,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - // This is not a mistake. Requiring only Nightmare Fuel is intentional for thematics. - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/StatisBlessing.cs b/Items/Accessories/StatisBlessing.cs index 4505b01bb1..fad5c5ab93 100644 --- a/Items/Accessories/StatisBlessing.cs +++ b/Items/Accessories/StatisBlessing.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.accessory = true; + Item.width = 28; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -31,20 +31,12 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.holyMinions = true; player.minionKB += 2.5f; - player.minionDamage += 0.1f; + player.GetDamage(DamageClass.Summon) += 0.1f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PapyrusScarab); - recipe.AddIngredient(ItemID.PygmyNecklace); - recipe.AddIngredient(ItemID.SummonerEmblem); - recipe.AddIngredient(ItemID.HolyWater, 30); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.PapyrusScarab).AddIngredient(ItemID.PygmyNecklace).AddIngredient(ItemID.SummonerEmblem).AddIngredient(ItemID.HolyWater, 30).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/StatisCurse.cs b/Items/Accessories/StatisCurse.cs index 609d92068a..d3683c3dc3 100644 --- a/Items/Accessories/StatisCurse.cs +++ b/Items/Accessories/StatisCurse.cs @@ -16,16 +16,16 @@ namespace CalamityMod.Items.Accessories "10% increased minion damage\n" + "Increased minion knockback\n" + "Minions inflict holy flames and shadowflames on hit"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 4)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(8, 4)); } public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.accessory = true; + Item.width = 28; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -34,18 +34,12 @@ namespace CalamityMod.Items.Accessories modPlayer.shadowMinions = true; modPlayer.holyMinions = true; player.minionKB += 2.75f; - player.minionDamage += 0.1f; + player.GetDamage(DamageClass.Summon) += 0.1f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.FragmentStardust, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.FragmentStardust, 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index b9de99d3c9..143ac51829 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.rare = ItemRarityID.Purple; - item.accessory = true; + Item.width = 28; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ItemRarityID.Purple; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -40,14 +40,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MasterNinjaGear); - recipe.AddIngredient(ItemID.FrogLeg); - recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.MasterNinjaGear).AddIngredient(ItemID.FrogLeg).AddIngredient(ModContent.ItemType(), 50).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/StressPills.cs b/Items/Accessories/StressPills.cs index 9e9011d3f5..98c60b82fc 100644 --- a/Items/Accessories/StressPills.cs +++ b/Items/Accessories/StressPills.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/SummonLevelMeter.cs b/Items/Accessories/SummonLevelMeter.cs index bfca6a8561..f691bfa93c 100644 --- a/Items/Accessories/SummonLevelMeter.cs +++ b/Items/Accessories/SummonLevelMeter.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = Item.buyPrice(0, 6, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void ModifyTooltips(List list) @@ -94,7 +94,7 @@ namespace CalamityMod.Items.Accessories } foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip0") { line2.text = "Tells you how high your summon proficiency is\n" + "While equipped you will gain summon proficiency faster\n" + diff --git a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs index 9836b71b4f..fd5ea91c19 100644 --- a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs +++ b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -37,21 +37,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AnglerHat); - recipe.AddIngredient(ItemID.AnglerVest); - recipe.AddIngredient(ItemID.AnglerPants); - recipe.AddIngredient(ItemID.AnglerTackleBag); - recipe.AddIngredient(ItemID.FishingPotion, 5); - recipe.AddIngredient(ItemID.CratePotion, 5); - recipe.AddIngredient(ItemID.SonarPotion, 5); - recipe.AddIngredient(ItemID.MasterBait, 5); - recipe.AddIngredient(ItemID.SoulofLight, 5); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.AnglerHat).AddIngredient(ItemID.AnglerVest).AddIngredient(ItemID.AnglerPants).AddIngredient(ItemID.AnglerTackleBag).AddIngredient(ItemID.FishingPotion, 5).AddIngredient(ItemID.CratePotion, 5).AddIngredient(ItemID.SonarPotion, 5).AddIngredient(ItemID.MasterBait, 5).AddIngredient(ItemID.SoulofLight, 5).AddIngredient(ItemID.SoulofNight, 5).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index 22935e4147..b00b8495b2 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -24,12 +24,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 10; - item.width = 20; - item.height = 24; - item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = ItemRarityID.Cyan; - item.accessory = true; + Item.defense = 10; + Item.width = 20; + Item.height = 24; + Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.rare = ItemRarityID.Cyan; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -45,34 +45,8 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); // mfw ingredient bloat - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 05185a3554..aff1f09073 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -19,17 +19,17 @@ namespace CalamityMod.Items.Accessories "15% increased damage\n" + "Shade rains down when you are hit\n" + "Nearby enemies receive a variety of debuffs when you are hit"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(9, 6)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(9, 6)); } public override void SetDefaults() { - item.width = 34; - item.height = 34; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.rare = ItemRarityID.Purple; + Item.width = 34; + Item.height = 34; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ItemRarityID.Purple; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -58,17 +58,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType(), 5); - recipe.AddIngredient(ItemType(), 10); - recipe.AddIngredient(ItemType(), 15); - recipe.AddIngredient(ItemType(), 15); - recipe.AddIngredient(ItemType(), 5); - recipe.AddIngredient(ItemType(), 4); - recipe.AddTile(TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemType()).AddIngredient(ItemType(), 5).AddIngredient(ItemType(), 10).AddIngredient(ItemType(), 15).AddIngredient(ItemType(), 15).AddIngredient(ItemType(), 5).AddIngredient(ItemType(), 4).AddTile(TileType()).Register(); } } } diff --git a/Items/Accessories/TheBee.cs b/Items/Accessories/TheBee.cs index 5c7fa10acc..34563f61dc 100644 --- a/Items/Accessories/TheBee.cs +++ b/Items/Accessories/TheBee.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 24; - item.height = 28; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 24; + Item.height = 28; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/TheCamper.cs b/Items/Accessories/TheCamper.cs index c3d8d3d808..7031ef1f23 100644 --- a/Items/Accessories/TheCamper.cs +++ b/Items/Accessories/TheCamper.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.accessory = true; - item.defense = 10; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; + Item.defense = 10; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -105,19 +105,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ShinyStone); - recipe.AddIngredient(ItemID.Campfire, 10); - recipe.AddIngredient(ItemID.HeartLantern, 5); - recipe.AddIngredient(ItemID.SharpeningStation); - recipe.AddIngredient(ItemID.CrystalBall); - recipe.AddIngredient(ItemID.AmmoBox); - recipe.AddIngredient(ItemID.BewitchingTable); - recipe.AddRecipeGroup("AnyFood", 50); - - recipe.AddTile(TileID.TinkerersWorkbench); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ShinyStone).AddIngredient(ItemID.Campfire, 10).AddIngredient(ItemID.HeartLantern, 5).AddIngredient(ItemID.SharpeningStation).AddIngredient(ItemID.CrystalBall).AddIngredient(ItemID.AmmoBox).AddIngredient(ItemID.BewitchingTable).AddRecipeGroup("AnyFood", 50).AddTile(TileID.TinkerersWorkbench).Register(); } } diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs index fb91a85183..1faa8041a3 100644 --- a/Items/Accessories/TheCommunity.cs +++ b/Items/Accessories/TheCommunity.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Accessories "The stat buffs become more powerful as you progress\n" + "Reduces the DoT effects of harmful debuffs inflicted on you\n" + "Thank you to all of my supporters who made this mod a reality"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 10)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 10)); } public override void SetDefaults() { - item.width = 34; - item.height = 64; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.Rainbow; + Item.width = 34; + Item.height = 64; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.Rainbow; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/TheEvolution.cs b/Items/Accessories/TheEvolution.cs index 794c26d991..4924f9b56a 100644 --- a/Items/Accessories/TheEvolution.cs +++ b/Items/Accessories/TheEvolution.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Accessories "This reflect has a 120 second cooldown which is shared with all other dodges and reflects\n" + "If this effect triggers you get a health regeneration boost for 5 seconds\n" + "If the same enemy projectile type hits you again you will resist its damage by 15%"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 10)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 10)); } public override void SetDefaults() { - item.width = 58; - item.height = 44; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.rare = ItemRarityID.Purple; - item.accessory = true; + Item.width = 58; + Item.height = 44; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ItemRarityID.Purple; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/TheFirstShadowflame.cs b/Items/Accessories/TheFirstShadowflame.cs index a0de6e4e40..83ae15f0cc 100644 --- a/Items/Accessories/TheFirstShadowflame.cs +++ b/Items/Accessories/TheFirstShadowflame.cs @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("It is said that in the past, Prometheus descended from the heavens to grant man fire.\n" + "If that were true, then it is surely the demons of hell that would have risen from below to do the same.\n" + "Increases max minions by 1 and minions inflict the Shadowflame debuff on enemies."); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); } public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/TheTransformer.cs b/Items/Accessories/TheTransformer.cs index 8167fa2ac1..0827d0d5fc 100644 --- a/Items/Accessories/TheTransformer.cs +++ b/Items/Accessories/TheTransformer.cs @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Taking damage releases a blast of sparks\n" + "Immunity to Electrified and you resist all electrical projectile and enemy damage\n" + "Enemy bullets do half damage to you and are reflected back at the enemy for 800% their original damage"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 16)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 16)); } public override void SetDefaults() { - item.width = 42; - item.height = 56; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.accessory = true; + Item.width = 42; + Item.height = 56; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/ThiefsDime.cs b/Items/Accessories/ThiefsDime.cs index e8cd7a35b9..0f7c3bea6f 100644 --- a/Items/Accessories/ThiefsDime.cs +++ b/Items/Accessories/ThiefsDime.cs @@ -10,17 +10,17 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Thief's Dime"); - Tooltip.SetDefault("Those scurvy dogs don’t know the first thing about making bank\n" + + Tooltip.SetDefault("Those scurvy dogs don’t know the first thing about making bank\n" + "Summons a coin that revolves around you and steals money from enemies"); } public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 20; + Item.height = 20; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) diff --git a/Items/Accessories/ToxicHeart.cs b/Items/Accessories/ToxicHeart.cs index 4c8c39dae6..cb61a81a1c 100644 --- a/Items/Accessories/ToxicHeart.cs +++ b/Items/Accessories/ToxicHeart.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.accessory = true; + Item.width = 28; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/TrinketofChi.cs b/Items/Accessories/TrinketofChi.cs index 1f72e3efc4..33ea7415be 100644 --- a/Items/Accessories/TrinketofChi.cs +++ b/Items/Accessories/TrinketofChi.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 34; - item.height = 32; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 34; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/UnstablePrism.cs b/Items/Accessories/UnstablePrism.cs index 00bb5af62e..91c08d691b 100644 --- a/Items/Accessories/UnstablePrism.cs +++ b/Items/Accessories/UnstablePrism.cs @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Unstable Granite Core"); Tooltip.SetDefault("Three sparks are released on critical hits"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(7, 5)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(7, 5)); } public override void SetDefaults() { - item.width = 40; - item.height = 44; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 40; + Item.height = 44; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/VampiricTalisman.cs b/Items/Accessories/VampiricTalisman.cs index 5ff5e2bafa..ba87d5bdc4 100644 --- a/Items/Accessories/VampiricTalisman.cs +++ b/Items/Accessories/VampiricTalisman.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 58; - item.height = 20; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.accessory = true; - item.rare = ItemRarityID.Lime; + Item.width = 58; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.accessory = true; + Item.rare = ItemRarityID.Lime; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -33,12 +33,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/Vanity/Popo.cs b/Items/Accessories/Vanity/Popo.cs index 71c6927386..c7224dc37b 100644 --- a/Items/Accessories/Vanity/Popo.cs +++ b/Items/Accessories/Vanity/Popo.cs @@ -16,12 +16,12 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetDefaults() { - item.width = 26; - item.height = 30; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.Calamity().devItem = true; + Item.width = 26; + Item.height = 30; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.Calamity().devItem = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/VeneratedLocket.cs b/Items/Accessories/VeneratedLocket.cs index c86c7a52a4..c830f99a05 100644 --- a/Items/Accessories/VeneratedLocket.cs +++ b/Items/Accessories/VeneratedLocket.cs @@ -18,12 +18,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 34; - item.height = 36; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.accessory = true; + Item.width = 34; + Item.height = 36; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/VitalJelly.cs b/Items/Accessories/VitalJelly.cs index 5853ae1dca..de0401f895 100644 --- a/Items/Accessories/VitalJelly.cs +++ b/Items/Accessories/VitalJelly.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 24; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.accessory = true; + Item.width = 20; + Item.height = 24; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index cdadc86858..d55c8d12a7 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -26,26 +26,18 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().calamityRing; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ObsidianRose); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ObsidianRose).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/VoltaicJelly.cs b/Items/Accessories/VoltaicJelly.cs index 4aa12fd87e..58ed192169 100644 --- a/Items/Accessories/VoltaicJelly.cs +++ b/Items/Accessories/VoltaicJelly.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 22; - item.value = Item.buyPrice(0, 2, 0, 0); - item.accessory = true; - item.rare = ItemRarityID.Green; + Item.width = 20; + Item.height = 22; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.accessory = true; + Item.rare = ItemRarityID.Green; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/WifeinaBottle.cs b/Items/Accessories/WifeinaBottle.cs index 3a4570156e..e50954ad54 100644 --- a/Items/Accessories/WifeinaBottle.cs +++ b/Items/Accessories/WifeinaBottle.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 26; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 20; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) diff --git a/Items/Accessories/WifeinaBottlewithBoobs.cs b/Items/Accessories/WifeinaBottlewithBoobs.cs index 4869715a10..b027198d45 100644 --- a/Items/Accessories/WifeinaBottlewithBoobs.cs +++ b/Items/Accessories/WifeinaBottlewithBoobs.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 26; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 20; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) diff --git a/Items/Accessories/Wings/AureateWings.cs b/Items/Accessories/Wings/AureateWings.cs index 0b2f652353..b78886577a 100644 --- a/Items/Accessories/Wings/AureateWings.cs +++ b/Items/Accessories/Wings/AureateWings.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Accessories.Wings { @@ -24,11 +25,11 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - item.width = 54; - item.height = 26; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.accessory = true; + Item.width = 54; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -45,7 +46,7 @@ namespace CalamityMod.Items.Accessories.Wings player.rocketDelay2--; if (player.rocketDelay2 <= 0) { - Main.PlaySound(SoundID.Item13, player.position); + SoundEngine.PlaySound(SoundID.Item13, player.position); player.rocketDelay2 = 60; } int num66 = 2; @@ -114,13 +115,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofFlight, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofFlight, 20).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/Wings/CelestialTracers.cs b/Items/Accessories/Wings/CelestialTracers.cs index 4761f031ab..d7ca9abfe3 100644 --- a/Items/Accessories/Wings/CelestialTracers.cs +++ b/Items/Accessories/Wings/CelestialTracers.cs @@ -31,11 +31,11 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - item.width = 36; - item.height = 32; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 36; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -88,13 +88,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/Wings/DiscordianWings.cs b/Items/Accessories/Wings/DiscordianWings.cs index dec781cea1..2841056973 100644 --- a/Items/Accessories/Wings/DiscordianWings.cs +++ b/Items/Accessories/Wings/DiscordianWings.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - item.width = 22; - item.height = 20; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.accessory = true; + Item.width = 22; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -78,13 +78,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofFlight, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofFlight, 20).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/Wings/DrewsWings.cs b/Items/Accessories/Wings/DrewsWings.cs index 89bf46f153..0b439cd8e1 100644 --- a/Items/Accessories/Wings/DrewsWings.cs +++ b/Items/Accessories/Wings/DrewsWings.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - item.width = 22; - item.height = 20; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; - item.accessory = true; + Item.width = 22; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Wings/ElysianTracers.cs b/Items/Accessories/Wings/ElysianTracers.cs index 6d926205e3..f7ec4761da 100644 --- a/Items/Accessories/Wings/ElysianTracers.cs +++ b/Items/Accessories/Wings/ElysianTracers.cs @@ -30,11 +30,11 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - item.width = 36; - item.height = 32; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 36; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -87,14 +87,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/Wings/ElysianWings.cs b/Items/Accessories/Wings/ElysianWings.cs index 36655e7bb8..ef05f53b3f 100644 --- a/Items/Accessories/Wings/ElysianWings.cs +++ b/Items/Accessories/Wings/ElysianWings.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - item.width = 36; - item.height = 32; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.accessory = true; + Item.width = 36; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Wings/HadarianWings.cs b/Items/Accessories/Wings/HadarianWings.cs index 52220f3673..2129708824 100644 --- a/Items/Accessories/Wings/HadarianWings.cs +++ b/Items/Accessories/Wings/HadarianWings.cs @@ -27,11 +27,11 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - item.width = 24; - item.height = 36; - item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = ItemRarityID.Cyan; - item.accessory = true; + Item.width = 24; + Item.height = 36; + Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.rare = ItemRarityID.Cyan; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -91,13 +91,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.SoulofFlight, 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.SoulofFlight, 20).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/Wings/InfinityBoots.cs b/Items/Accessories/Wings/InfinityBoots.cs index 5bc92c9d91..c62fd97fe8 100644 --- a/Items/Accessories/Wings/InfinityBoots.cs +++ b/Items/Accessories/Wings/InfinityBoots.cs @@ -29,11 +29,11 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - item.width = 36; - item.height = 32; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.accessory = true; + Item.width = 36; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -85,15 +85,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("WingsGroup"); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddRecipeGroup("WingsGroup").AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index 5d7ee4d266..3a0d411486 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Accessories.Wings { @@ -24,11 +25,11 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.value = CalamityGlobalItem.Rarity6BuyPrice; - item.rare = ItemRarityID.LightPurple; - item.accessory = true; + Item.width = 28; + Item.height = 32; + Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.rare = ItemRarityID.LightPurple; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Accessories.Wings player.rocketDelay2--; if (player.rocketDelay2 <= 0) { - Main.PlaySound(SoundID.Item13, player.position); + SoundEngine.PlaySound(SoundID.Item13, player.position); player.rocketDelay2 = 60; } int dustAmt = 2; @@ -112,17 +113,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FrogLeg); - recipe.AddIngredient(ItemID.BundleofBalloons); - recipe.AddIngredient(ItemID.LuckyHorseshoe); - recipe.AddIngredient(ItemID.Jetpack); - recipe.AddIngredient(ItemID.SoulofMight); - recipe.AddIngredient(ItemID.SoulofSight); - recipe.AddIngredient(ItemID.SoulofFright); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.FrogLeg).AddIngredient(ItemID.BundleofBalloons).AddIngredient(ItemID.LuckyHorseshoe).AddIngredient(ItemID.Jetpack).AddIngredient(ItemID.SoulofMight).AddIngredient(ItemID.SoulofSight).AddIngredient(ItemID.SoulofFright).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/Wings/SilvaWings.cs b/Items/Accessories/Wings/SilvaWings.cs index 9943b5ffba..c1decd35fa 100644 --- a/Items/Accessories/Wings/SilvaWings.cs +++ b/Items/Accessories/Wings/SilvaWings.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - item.width = 22; - item.height = 20; - item.rare = ItemRarityID.Purple; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.accessory = true; + Item.width = 22; + Item.height = 20; + Item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -79,14 +79,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddRecipeGroup("AnyGoldBar", 3); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddRecipeGroup("AnyGoldBar", 3).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Accessories/Wings/SkylineWings.cs b/Items/Accessories/Wings/SkylineWings.cs index 0ccb14f11a..9a12c9f1a1 100644 --- a/Items/Accessories/Wings/SkylineWings.cs +++ b/Items/Accessories/Wings/SkylineWings.cs @@ -21,11 +21,11 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - item.width = 22; - item.height = 20; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.accessory = true; + Item.width = 22; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -57,14 +57,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Feather, 5); - recipe.AddIngredient(ItemID.FallenStar, 5); - recipe.AddIngredient(ItemID.Bone, 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Feather, 5).AddIngredient(ItemID.FallenStar, 5).AddIngredient(ItemID.Bone, 15).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Accessories/Wings/SoulofCryogen.cs b/Items/Accessories/Wings/SoulofCryogen.cs index d7683f56cf..b017b1ef58 100644 --- a/Items/Accessories/Wings/SoulofCryogen.cs +++ b/Items/Accessories/Wings/SoulofCryogen.cs @@ -22,23 +22,23 @@ namespace CalamityMod.Items.Accessories.Wings "7% increase to all damage\n" + "All melee attacks and projectiles inflict frostburn\n" + "Icicles rain down as you fly"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 3)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 3)); } public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void Update(ref float gravity, ref float maxFallSpeed) { float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0f * num, 0.3f * num, 0.3f * num); + Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0f * num, 0.3f * num, 0.3f * num); } public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) diff --git a/Items/Accessories/Wings/StarlightWings.cs b/Items/Accessories/Wings/StarlightWings.cs index 597368a59e..160577e94d 100644 --- a/Items/Accessories/Wings/StarlightWings.cs +++ b/Items/Accessories/Wings/StarlightWings.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - item.width = 22; - item.height = 20; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.accessory = true; + Item.width = 22; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -78,13 +78,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofFlight, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofFlight, 20).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Accessories/Wings/TarragonWings.cs b/Items/Accessories/Wings/TarragonWings.cs index 91f9fec7dc..18fe22db41 100644 --- a/Items/Accessories/Wings/TarragonWings.cs +++ b/Items/Accessories/Wings/TarragonWings.cs @@ -25,12 +25,12 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - item.width = 22; - item.height = 20; - item.rare = ItemRarityID.Purple; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.accessory = true; + Item.width = 22; + Item.height = 20; + Item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -81,12 +81,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.SoulofFlight, 30); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.SoulofFlight, 30).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/Wings/XerocWings.cs b/Items/Accessories/Wings/XerocWings.cs index 8e15cdabfe..9122d8fb4f 100644 --- a/Items/Accessories/Wings/XerocWings.cs +++ b/Items/Accessories/Wings/XerocWings.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Items.Accessories.Wings public override void SetDefaults() { - item.width = 22; - item.height = 20; - item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = ItemRarityID.Red; - item.accessory = true; + Item.width = 22; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.rare = ItemRarityID.Red; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -76,12 +76,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Accessories/WulfrumBattery.cs b/Items/Accessories/WulfrumBattery.cs index d8313e4a25..63edec447d 100644 --- a/Items/Accessories/WulfrumBattery.cs +++ b/Items/Accessories/WulfrumBattery.cs @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 22; - item.value = Item.buyPrice(0, 1, 0, 0); - item.accessory = true; - item.rare = ItemRarityID.Blue; + Item.width = 20; + Item.height = 22; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.accessory = true; + Item.rare = ItemRarityID.Blue; } public override void UpdateAccessory(Player player, bool hideVisual) { - player.minionDamage += 0.07f; + player.GetDamage(DamageClass.Summon) += 0.07f; } } } diff --git a/Items/Accessories/YharimsGift.cs b/Items/Accessories/YharimsGift.cs index 7633ad650c..d8a05979e9 100644 --- a/Items/Accessories/YharimsGift.cs +++ b/Items/Accessories/YharimsGift.cs @@ -21,13 +21,13 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 30; - item.width = 20; - item.height = 22; - item.accessory = true; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; - item.rare = ItemRarityID.Purple; + Item.defense = 30; + Item.width = 20; + Item.height = 22; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ItemRarityID.Purple; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/YharimsInsignia.cs b/Items/Accessories/YharimsInsignia.cs index 8dabba636b..4036d46561 100644 --- a/Items/Accessories/YharimsInsignia.cs +++ b/Items/Accessories/YharimsInsignia.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 22; - item.height = 38; - item.rare = ItemRarityID.Purple; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 22; + Item.height = 38; + Item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.accessory = true; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -37,14 +37,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WarriorEmblem); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.WarriorEmblem).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Ammo/AccelerationBullet.cs b/Items/Ammo/AccelerationBullet.cs index 967b0c24d1..269e595d17 100644 --- a/Items/Ammo/AccelerationBullet.cs +++ b/Items/Ammo/AccelerationBullet.cs @@ -15,28 +15,23 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 11; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.25f; - item.value = Item.sellPrice(copper: 2); - item.rare = ItemRarityID.Green; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; - item.ammo = AmmoID.Bullet; + Item.damage = 11; + Item.DamageType = DamageClass.Ranged; + Item.width = 8; + Item.height = 8; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 1.25f; + Item.value = Item.sellPrice(copper: 2); + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; + Item.ammo = AmmoID.Bullet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 150); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 150); - recipe.AddRecipe(); + CreateRecipe(150).AddIngredient(ItemID.MusketBall, 150).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Ammo/AcidBullet.cs b/Items/Ammo/AcidBullet.cs index c8ca7bbced..ee5f9b6622 100644 --- a/Items/Ammo/AcidBullet.cs +++ b/Items/Ammo/AcidBullet.cs @@ -16,28 +16,23 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 20; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = Item.sellPrice(copper: 16); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.ammo = AmmoID.Bullet; + Item.damage = 20; + Item.DamageType = DamageClass.Ranged; + Item.width = 8; + Item.height = 8; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 1.5f; + Item.value = Item.sellPrice(copper: 16); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.ammo = AmmoID.Bullet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 150); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 150); - recipe.AddRecipe(); + CreateRecipe(150).AddIngredient(ItemID.MusketBall, 150).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Ammo/ArcticArrow.cs b/Items/Ammo/ArcticArrow.cs index 9c9cc2310a..55701a2a5b 100644 --- a/Items/Ammo/ArcticArrow.cs +++ b/Items/Ammo/ArcticArrow.cs @@ -16,27 +16,23 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 18; - item.ranged = true; - item.width = 22; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = Item.sellPrice(copper: 12); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; - item.ammo = AmmoID.Arrow; + Item.damage = 18; + Item.DamageType = DamageClass.Ranged; + Item.width = 22; + Item.height = 36; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 1.5f; + Item.value = Item.sellPrice(copper: 12); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13f; + Item.ammo = AmmoID.Arrow; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this, 250); - recipe.AddRecipe(); + CreateRecipe(250).AddIngredient(ModContent.ItemType()).AddTile(TileID.IceMachine).Register(); } } } diff --git a/Items/Ammo/AstralSolution.cs b/Items/Ammo/AstralSolution.cs index 33e4e9eb3a..cfe0f200ad 100644 --- a/Items/Ammo/AstralSolution.cs +++ b/Items/Ammo/AstralSolution.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.ammo = AmmoID.Solution; - item.shoot = ModContent.ProjectileType() - ProjectileID.PureSpray; - item.width = 10; - item.height = 12; - item.value = Item.buyPrice(0, 0, 5, 0); - item.rare = ItemRarityID.Orange; - item.maxStack = 999; - item.consumable = true; + Item.ammo = AmmoID.Solution; + Item.shoot = ModContent.ProjectileType() - ProjectileID.PureSpray; + Item.width = 10; + Item.height = 12; + Item.value = Item.buyPrice(0, 0, 5, 0); + Item.rare = ItemRarityID.Orange; + Item.maxStack = 999; + Item.consumable = true; return; } diff --git a/Items/Ammo/BloodRune.cs b/Items/Ammo/BloodRune.cs index 95908c8ee1..351fedfdff 100644 --- a/Items/Ammo/BloodRune.cs +++ b/Items/Ammo/BloodRune.cs @@ -15,20 +15,20 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 1; - item.width = 22; - item.height = 24; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 10f; + Item.damage = 1; + Item.width = 22; + Item.height = 24; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 10f; - item.value = Item.buyPrice(gold: 1); - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().donorItem = true; + Item.value = Item.buyPrice(gold: 1); + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 0f; - item.ammo = item.type; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 0f; + Item.ammo = Item.type; } } } diff --git a/Items/Ammo/BloodfireArrow.cs b/Items/Ammo/BloodfireArrow.cs index cbb76dbae1..2a2fd36ff3 100644 --- a/Items/Ammo/BloodfireArrow.cs +++ b/Items/Ammo/BloodfireArrow.cs @@ -16,28 +16,24 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 29; - item.ranged = true; - item.width = 14; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 3.5f; - item.value = Item.sellPrice(copper: 24); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.ammo = AmmoID.Arrow; + Item.damage = 29; + Item.DamageType = DamageClass.Ranged; + Item.width = 14; + Item.height = 36; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 3.5f; + Item.value = Item.sellPrice(copper: 24); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.ammo = AmmoID.Arrow; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 333); - recipe.AddRecipe(); + CreateRecipe(333).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Ammo/BloodfireBullet.cs b/Items/Ammo/BloodfireBullet.cs index b5cf71331d..e95cdd2464 100644 --- a/Items/Ammo/BloodfireBullet.cs +++ b/Items/Ammo/BloodfireBullet.cs @@ -16,28 +16,24 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 26; - item.ranged = true; - item.width = 14; - item.height = 30; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 4.5f; - item.value = Item.sellPrice(copper: 24); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 4.8f; - item.ammo = ItemID.MusketBall; + Item.damage = 26; + Item.DamageType = DamageClass.Ranged; + Item.width = 14; + Item.height = 30; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 4.5f; + Item.value = Item.sellPrice(copper: 24); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 4.8f; + Item.ammo = ItemID.MusketBall; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 333); - recipe.AddRecipe(); + CreateRecipe(333).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Ammo/ElysianArrow.cs b/Items/Ammo/ElysianArrow.cs index b25114767b..f64d9fff1e 100644 --- a/Items/Ammo/ElysianArrow.cs +++ b/Items/Ammo/ElysianArrow.cs @@ -15,28 +15,23 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 20; - item.ranged = true; - item.width = 22; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 3f; - item.value = Item.sellPrice(copper: 24); - item.rare = ItemRarityID.Purple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.ammo = AmmoID.Arrow; + Item.damage = 20; + Item.DamageType = DamageClass.Ranged; + Item.width = 22; + Item.height = 36; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 3f; + Item.value = Item.sellPrice(copper: 24); + Item.rare = ItemRarityID.Purple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.ammo = AmmoID.Arrow; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HolyArrow, 150); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 150); - recipe.AddRecipe(); + CreateRecipe(150).AddIngredient(ItemID.HolyArrow, 150).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Ammo/EnhancedNanoRound.cs b/Items/Ammo/EnhancedNanoRound.cs index 8e32645b65..6f601e86cf 100644 --- a/Items/Ammo/EnhancedNanoRound.cs +++ b/Items/Ammo/EnhancedNanoRound.cs @@ -15,28 +15,23 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 12; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 5.5f; - item.value = Item.sellPrice(copper: 16); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; - item.ammo = AmmoID.Bullet; + Item.damage = 12; + Item.DamageType = DamageClass.Ranged; + Item.width = 8; + Item.height = 8; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 5.5f; + Item.value = Item.sellPrice(copper: 16); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; + Item.ammo = AmmoID.Bullet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.NanoBullet, 250); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 250); - recipe.AddRecipe(); + CreateRecipe(250).AddIngredient(ItemID.NanoBullet, 250).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Ammo/FiniteUse/ExplosiveShells.cs b/Items/Ammo/FiniteUse/ExplosiveShells.cs index 87b8195cf1..0018b1f233 100644 --- a/Items/Ammo/FiniteUse/ExplosiveShells.cs +++ b/Items/Ammo/FiniteUse/ExplosiveShells.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Items.Ammo.FiniteUse public override void SetDefaults() { - item.damage = 30; - item.width = 18; - item.height = 18; - item.maxStack = 6; - item.consumable = true; - item.knockBack = 10f; - item.value = 15000; - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.ammo = ModContent.ItemType(); // CONSIDER -- Would item.type work here instead of a self reference? + Item.damage = 30; + Item.width = 18; + Item.height = 18; + Item.maxStack = 6; + Item.consumable = true; + Item.knockBack = 10f; + Item.value = 15000; + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.ammo = ModContent.ItemType(); // CONSIDER -- Would item.type work here instead of a self reference? } } } diff --git a/Items/Ammo/FiniteUse/GrenadeRounds.cs b/Items/Ammo/FiniteUse/GrenadeRounds.cs index f62c2e2bce..4f54594078 100644 --- a/Items/Ammo/FiniteUse/GrenadeRounds.cs +++ b/Items/Ammo/FiniteUse/GrenadeRounds.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Items.Ammo.FiniteUse public override void SetDefaults() { - item.damage = 200; - item.width = 18; - item.height = 18; - item.maxStack = 9; - item.consumable = true; - item.knockBack = 10f; - item.value = 15000; - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.ammo = ModContent.ItemType(); // CONSIDER -- Would item.type work here instead of a self reference? + Item.damage = 200; + Item.width = 18; + Item.height = 18; + Item.maxStack = 9; + Item.consumable = true; + Item.knockBack = 10f; + Item.value = 15000; + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.ammo = ModContent.ItemType(); // CONSIDER -- Would item.type work here instead of a self reference? } } } diff --git a/Items/Ammo/FiniteUse/MagnumRounds.cs b/Items/Ammo/FiniteUse/MagnumRounds.cs index 1c2ed01649..aa60b4d2d0 100644 --- a/Items/Ammo/FiniteUse/MagnumRounds.cs +++ b/Items/Ammo/FiniteUse/MagnumRounds.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Ammo.FiniteUse public override void SetDefaults() { - item.damage = 80; - item.crit += 4; - item.width = 18; - item.height = 18; - item.maxStack = 12; - item.consumable = true; - item.knockBack = 8f; - item.value = 10000; - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.ammo = ModContent.ItemType(); // CONSIDER -- Would item.type work here instead of a self reference? + Item.damage = 80; + Item.crit += 4; + Item.width = 18; + Item.height = 18; + Item.maxStack = 12; + Item.consumable = true; + Item.knockBack = 8f; + Item.value = 10000; + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.ammo = ModContent.ItemType(); // CONSIDER -- Would item.type work here instead of a self reference? } } } diff --git a/Items/Ammo/FlashBullet.cs b/Items/Ammo/FlashBullet.cs index 5aa9c75195..7a40219e23 100644 --- a/Items/Ammo/FlashBullet.cs +++ b/Items/Ammo/FlashBullet.cs @@ -14,28 +14,23 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 7; - item.ranged = true; - item.width = 12; - item.height = 18; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.15f; - item.value = Item.sellPrice(copper: 2); - item.rare = ItemRarityID.Blue; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.ammo = AmmoID.Bullet; + Item.damage = 7; + Item.DamageType = DamageClass.Ranged; + Item.width = 12; + Item.height = 18; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 1.15f; + Item.value = Item.sellPrice(copper: 2); + Item.rare = ItemRarityID.Blue; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.ammo = AmmoID.Bullet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Grenade); - recipe.AddIngredient(ItemID.Glass, 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 10); - recipe.AddRecipe(); + CreateRecipe(10).AddIngredient(ItemID.Grenade).AddIngredient(ItemID.Glass, 3).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Ammo/GodSlayerSlug.cs b/Items/Ammo/GodSlayerSlug.cs index 74836ad1f5..a44df64dfa 100644 --- a/Items/Ammo/GodSlayerSlug.cs +++ b/Items/Ammo/GodSlayerSlug.cs @@ -19,29 +19,24 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 28; - item.ranged = true; - item.width = 22; - item.height = 22; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 3f; - item.value = Item.sellPrice(copper: 28); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; - item.ammo = ItemID.MusketBall; + Item.damage = 28; + Item.DamageType = DamageClass.Ranged; + Item.width = 22; + Item.height = 22; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 3f; + Item.value = Item.sellPrice(copper: 28); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; + Item.ammo = ItemID.MusketBall; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.EmptyBullet, 999); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this, 999); - recipe.AddRecipe(); + CreateRecipe(999).AddIngredient(ItemID.EmptyBullet, 999).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Ammo/HolyFireBullet.cs b/Items/Ammo/HolyFireBullet.cs index f2fe00676a..2e0f9e2cd7 100644 --- a/Items/Ammo/HolyFireBullet.cs +++ b/Items/Ammo/HolyFireBullet.cs @@ -17,28 +17,23 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 22; - item.ranged = true; - item.width = 22; - item.height = 22; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 2f; - item.value = Item.sellPrice(copper: 24); - item.rare = ItemRarityID.Purple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; - item.ammo = AmmoID.Bullet; + Item.damage = 22; + Item.DamageType = DamageClass.Ranged; + Item.width = 22; + Item.height = 22; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 2f; + Item.value = Item.sellPrice(copper: 24); + Item.rare = ItemRarityID.Purple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; + Item.ammo = AmmoID.Bullet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ExplodingBullet, 100); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.ExplodingBullet, 100).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Ammo/HyperiusBullet.cs b/Items/Ammo/HyperiusBullet.cs index b25574f5e3..92c1127aab 100644 --- a/Items/Ammo/HyperiusBullet.cs +++ b/Items/Ammo/HyperiusBullet.cs @@ -16,28 +16,23 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 18; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = Item.sellPrice(copper: 16); - item.rare = ItemRarityID.Cyan; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.ammo = AmmoID.Bullet; + Item.damage = 18; + Item.DamageType = DamageClass.Ranged; + Item.width = 8; + Item.height = 8; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 1.5f; + Item.value = Item.sellPrice(copper: 16); + Item.rare = ItemRarityID.Cyan; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.ammo = AmmoID.Bullet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 150); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 150); - recipe.AddRecipe(); + CreateRecipe(150).AddIngredient(ItemID.MusketBall, 150).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Ammo/IcicleArrow.cs b/Items/Ammo/IcicleArrow.cs index ac17b39ed5..60e0afff57 100644 --- a/Items/Ammo/IcicleArrow.cs +++ b/Items/Ammo/IcicleArrow.cs @@ -15,18 +15,18 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 15; - item.ranged = true; - item.consumable = true; - item.width = 18; - item.height = 50; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 0, 0, 80); - item.rare = ItemRarityID.LightPurple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1.0f; - item.ammo = AmmoID.Arrow; - item.maxStack = 999; + Item.damage = 15; + Item.DamageType = DamageClass.Ranged; + Item.consumable = true; + Item.width = 18; + Item.height = 50; + Item.knockBack = 2.5f; + Item.value = Item.buyPrice(0, 0, 0, 80); + Item.rare = ItemRarityID.LightPurple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1.0f; + Item.ammo = AmmoID.Arrow; + Item.maxStack = 999; } } } diff --git a/Items/Ammo/IcyBullet.cs b/Items/Ammo/IcyBullet.cs index 4c728c826c..fc422ed17d 100644 --- a/Items/Ammo/IcyBullet.cs +++ b/Items/Ammo/IcyBullet.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Ammo } public override void SetDefaults() { - item.damage = 10; - item.ranged = true; - item.consumable = true; - item.width = 14; - item.height = 20; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 0, 0, 80); - item.rare = ItemRarityID.LightPurple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; - item.ammo = AmmoID.Bullet; - item.maxStack = 999; + Item.damage = 10; + Item.DamageType = DamageClass.Ranged; + Item.consumable = true; + Item.width = 14; + Item.height = 20; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 0, 0, 80); + Item.rare = ItemRarityID.LightPurple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; + Item.ammo = AmmoID.Bullet; + Item.maxStack = 999; } } } diff --git a/Items/Ammo/MortarRound.cs b/Items/Ammo/MortarRound.cs index 1db9803f76..304d72cf02 100644 --- a/Items/Ammo/MortarRound.cs +++ b/Items/Ammo/MortarRound.cs @@ -16,27 +16,22 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 20; - item.ranged = true; - item.width = 20; - item.height = 14; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 7.5f; - item.value = Item.sellPrice(copper: 20); - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.ammo = AmmoID.Bullet; - item.shoot = ModContent.ProjectileType(); + Item.damage = 20; + Item.DamageType = DamageClass.Ranged; + Item.width = 20; + Item.height = 14; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 7.5f; + Item.value = Item.sellPrice(copper: 20); + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.ammo = AmmoID.Bullet; + Item.shoot = ModContent.ProjectileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RocketIV, 100); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.RocketIV, 100).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Ammo/NapalmArrow.cs b/Items/Ammo/NapalmArrow.cs index 3c9130b0ae..05bf3735c1 100644 --- a/Items/Ammo/NapalmArrow.cs +++ b/Items/Ammo/NapalmArrow.cs @@ -15,29 +15,23 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 14; - item.ranged = true; - item.width = 22; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = Item.sellPrice(copper: 12); - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; - item.ammo = AmmoID.Arrow; + Item.damage = 14; + Item.DamageType = DamageClass.Ranged; + Item.width = 22; + Item.height = 36; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 1.5f; + Item.value = Item.sellPrice(copper: 12); + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13f; + Item.ammo = AmmoID.Arrow; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WoodenArrow, 250); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Torch); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 250); - recipe.AddRecipe(); + CreateRecipe(250).AddIngredient(ItemID.WoodenArrow, 250).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Torch).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Ammo/RubberMortarRound.cs b/Items/Ammo/RubberMortarRound.cs index 6702e34e1d..d759bf681f 100644 --- a/Items/Ammo/RubberMortarRound.cs +++ b/Items/Ammo/RubberMortarRound.cs @@ -16,27 +16,22 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 25; - item.ranged = true; - item.width = 20; - item.height = 14; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 7.5f; - item.value = Item.sellPrice(copper: 20); - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.ammo = AmmoID.Bullet; - item.shoot = ModContent.ProjectileType(); + Item.damage = 25; + Item.DamageType = DamageClass.Ranged; + Item.width = 20; + Item.height = 14; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 7.5f; + Item.value = Item.sellPrice(copper: 20); + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.ammo = AmmoID.Bullet; + Item.shoot = ModContent.ProjectileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 100); - recipe.AddIngredient(ItemID.PinkGel, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ModContent.ItemType(), 100).AddIngredient(ItemID.PinkGel, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Ammo/SuperballBullet.cs b/Items/Ammo/SuperballBullet.cs index 12745532e7..ab90cf8adc 100644 --- a/Items/Ammo/SuperballBullet.cs +++ b/Items/Ammo/SuperballBullet.cs @@ -15,28 +15,23 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 6; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = Item.sellPrice(copper: 2); - item.rare = ItemRarityID.Green; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; - item.ammo = AmmoID.Bullet; + Item.damage = 6; + Item.DamageType = DamageClass.Ranged; + Item.width = 8; + Item.height = 8; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 1.5f; + Item.value = Item.sellPrice(copper: 2); + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; + Item.ammo = AmmoID.Bullet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteorShot, 150); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 150); - recipe.AddRecipe(); + CreateRecipe(150).AddIngredient(ItemID.MeteorShot, 150).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Ammo/TerraArrow.cs b/Items/Ammo/TerraArrow.cs index aede5b64fa..720b1d85cb 100644 --- a/Items/Ammo/TerraArrow.cs +++ b/Items/Ammo/TerraArrow.cs @@ -16,28 +16,23 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 15; - item.ranged = true; - item.width = 22; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = Item.sellPrice(copper: 20); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.ammo = AmmoID.Arrow; + Item.damage = 15; + Item.DamageType = DamageClass.Ranged; + Item.width = 22; + Item.height = 36; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 1.5f; + Item.value = Item.sellPrice(copper: 20); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.ammo = AmmoID.Arrow; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WoodenArrow, 250); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 250); - recipe.AddRecipe(); + CreateRecipe(250).AddIngredient(ItemID.WoodenArrow, 250).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Ammo/TerraBullet.cs b/Items/Ammo/TerraBullet.cs index 3164e74a82..f2c7945cd7 100644 --- a/Items/Ammo/TerraBullet.cs +++ b/Items/Ammo/TerraBullet.cs @@ -15,28 +15,23 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 9; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.25f; - item.value = Item.sellPrice(copper: 16); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.ammo = AmmoID.Bullet; + Item.damage = 9; + Item.DamageType = DamageClass.Ranged; + Item.width = 8; + Item.height = 8; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 1.25f; + Item.value = Item.sellPrice(copper: 16); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.ammo = AmmoID.Bullet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalBullet, 100); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.CrystalBullet, 100).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Ammo/VanquisherArrow.cs b/Items/Ammo/VanquisherArrow.cs index 5fbdb18212..bf2776dd1d 100644 --- a/Items/Ammo/VanquisherArrow.cs +++ b/Items/Ammo/VanquisherArrow.cs @@ -20,32 +20,28 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 24; - item.ranged = true; - item.width = 22; - item.height = 46; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 3.5f; - item.value = Item.sellPrice(copper: 28); - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.ammo = AmmoID.Arrow; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.damage = 24; + Item.DamageType = DamageClass.Ranged; + Item.width = 22; + Item.height = 46; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 3.5f; + Item.value = Item.sellPrice(copper: 28); + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.ammo = AmmoID.Arrow; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Ammo/VanquisherArrowGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow")); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this, 999); - recipe.AddRecipe(); + CreateRecipe(999).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Ammo/VeriumBullet.cs b/Items/Ammo/VeriumBullet.cs index f9b2d277dd..38e1a28784 100644 --- a/Items/Ammo/VeriumBullet.cs +++ b/Items/Ammo/VeriumBullet.cs @@ -16,28 +16,23 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 8; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.25f; - item.value = Item.sellPrice(copper: 12); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.ammo = AmmoID.Bullet; + Item.damage = 8; + Item.DamageType = DamageClass.Ranged; + Item.width = 8; + Item.height = 8; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 1.25f; + Item.value = Item.sellPrice(copper: 12); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.ammo = AmmoID.Bullet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 100); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.MusketBall, 100).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/AntiCystOintment.cs b/Items/AntiCystOintment.cs index 1f07375ec6..efbc01bd42 100644 --- a/Items/AntiCystOintment.cs +++ b/Items/AntiCystOintment.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items } public override void SetDefaults() { - item.width = 44; - item.height = 34; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; + Item.width = 44; + Item.height = 34; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; } public override void UpdateInventory(Player player) { - if (item.favorited) + if (Item.favorited) player.Calamity().disablePerfCystSpawns = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrimtaneBar, 5); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.CrimtaneBar, 5).AddIngredient(ItemID.BottledWater).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/AntiTumorOintment.cs b/Items/AntiTumorOintment.cs index 6a7fcaba2e..c4114df672 100644 --- a/Items/AntiTumorOintment.cs +++ b/Items/AntiTumorOintment.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items } public override void SetDefaults() { - item.width = 44; - item.height = 34; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; + Item.width = 44; + Item.height = 34; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; } public override void UpdateInventory(Player player) { - if (item.favorited) + if (Item.favorited) player.Calamity().disableHiveCystSpawns = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DemoniteBar, 5); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.DemoniteBar, 5).AddIngredient(ItemID.BottledWater).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/AerospecBreastplate.cs b/Items/Armor/AerospecBreastplate.cs index ca48156401..712b84e117 100644 --- a/Items/Armor/AerospecBreastplate.cs +++ b/Items/Armor/AerospecBreastplate.cs @@ -16,31 +16,24 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.defense = 7; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.defense = 7; } public override void UpdateEquip(Player player) { - player.meleeCrit += 3; - player.rangedCrit += 3; - player.magicCrit += 3; + player.GetCritChance(DamageClass.Melee) += 3; + player.GetCritChance(DamageClass.Ranged) += 3; + player.GetCritChance(DamageClass.Magic) += 3; player.Calamity().throwingCrit += 3; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 11); - recipe.AddIngredient(ItemID.Cloud, 10); - recipe.AddIngredient(ItemID.RainCloud, 5); - recipe.AddIngredient(ItemID.Feather, 2); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 11).AddIngredient(ItemID.Cloud, 10).AddIngredient(ItemID.RainCloud, 5).AddIngredient(ItemID.Feather, 2).AddTile(TileID.SkyMill).Register(); } } } diff --git a/Items/Armor/AerospecHat.cs b/Items/Armor/AerospecHat.cs index 9b7ec3a73f..821d5c0a5c 100644 --- a/Items/Armor/AerospecHat.cs +++ b/Items/Armor/AerospecHat.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = ItemRarityID.Orange; - item.defense = 3; //15 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.defense = 3; //15 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -43,25 +43,18 @@ namespace CalamityMod.Items.Armor modPlayer.aeroSet = true; player.noFallDmg = true; player.moveSpeed += 0.05f; - player.magicCrit += 5; + player.GetCritChance(DamageClass.Magic) += 5; } public override void UpdateEquip(Player player) { - player.magicDamage += 0.08f; + player.GetDamage(DamageClass.Magic) += 0.08f; player.statManaMax2 += 20; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Cloud, 3); - recipe.AddIngredient(ItemID.RainCloud); - recipe.AddIngredient(ItemID.Feather); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Cloud, 3).AddIngredient(ItemID.RainCloud).AddIngredient(ItemID.Feather).AddTile(TileID.SkyMill).Register(); } } } diff --git a/Items/Armor/AerospecHeadgear.cs b/Items/Armor/AerospecHeadgear.cs index 8f4f657456..36c126efb5 100644 --- a/Items/Armor/AerospecHeadgear.cs +++ b/Items/Armor/AerospecHeadgear.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = ItemRarityID.Orange; - item.defense = 4; //17 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.defense = 4; //17 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -66,14 +66,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Cloud, 3); - recipe.AddIngredient(ItemID.RainCloud); - recipe.AddIngredient(ItemID.Feather); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Cloud, 3).AddIngredient(ItemID.RainCloud).AddIngredient(ItemID.Feather).AddTile(TileID.SkyMill).Register(); } } } diff --git a/Items/Armor/AerospecHelm.cs b/Items/Armor/AerospecHelm.cs index 52ee8df54d..e897a7ef61 100644 --- a/Items/Armor/AerospecHelm.cs +++ b/Items/Armor/AerospecHelm.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = ItemRarityID.Orange; - item.defense = 7; //20 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.defense = 7; //20 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -44,25 +44,18 @@ namespace CalamityMod.Items.Armor modPlayer.aeroSet = true; player.noFallDmg = true; player.moveSpeed += 0.05f; - player.meleeCrit += 5; + player.GetCritChance(DamageClass.Melee) += 5; player.aggro += 300; } public override void UpdateEquip(Player player) { - player.meleeDamage += 0.08f; + player.GetDamage(DamageClass.Melee) += 0.08f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Cloud, 3); - recipe.AddIngredient(ItemID.RainCloud); - recipe.AddIngredient(ItemID.Feather); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Cloud, 3).AddIngredient(ItemID.RainCloud).AddIngredient(ItemID.Feather).AddTile(TileID.SkyMill).Register(); } } } diff --git a/Items/Armor/AerospecHelmet.cs b/Items/Armor/AerospecHelmet.cs index 09d8d83294..8fb5900da8 100644 --- a/Items/Armor/AerospecHelmet.cs +++ b/Items/Armor/AerospecHelmet.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = ItemRarityID.Orange; - item.defense = 2; //13 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.defense = 2; //13 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -57,26 +57,19 @@ namespace CalamityMod.Items.Armor Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(20 * player.MinionDamage()), 0f, Main.myPlayer, 0f, 0f); } } - player.minionDamage += 0.11f; + player.GetDamage(DamageClass.Summon) += 0.11f; player.maxMinions++; } public override void UpdateEquip(Player player) { player.moveSpeed += 0.05f; - player.minionDamage += 0.05f; + player.GetDamage(DamageClass.Summon) += 0.05f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Cloud, 3); - recipe.AddIngredient(ItemID.RainCloud); - recipe.AddIngredient(ItemID.Feather); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Cloud, 3).AddIngredient(ItemID.RainCloud).AddIngredient(ItemID.Feather).AddTile(TileID.SkyMill).Register(); } } } diff --git a/Items/Armor/AerospecHood.cs b/Items/Armor/AerospecHood.cs index a2028c781a..b6100958e3 100644 --- a/Items/Armor/AerospecHood.cs +++ b/Items/Armor/AerospecHood.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = ItemRarityID.Orange; - item.defense = 5; //18 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.defense = 5; //18 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -43,24 +43,17 @@ namespace CalamityMod.Items.Armor modPlayer.aeroSet = true; player.noFallDmg = true; player.moveSpeed += 0.05f; - player.rangedCrit += 5; + player.GetCritChance(DamageClass.Ranged) += 5; } public override void UpdateEquip(Player player) { - player.rangedDamage += 0.08f; + player.GetDamage(DamageClass.Ranged) += 0.08f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Cloud, 3); - recipe.AddIngredient(ItemID.RainCloud); - recipe.AddIngredient(ItemID.Feather); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Cloud, 3).AddIngredient(ItemID.RainCloud).AddIngredient(ItemID.Feather).AddTile(TileID.SkyMill).Register(); } } } diff --git a/Items/Armor/AerospecLeggings.cs b/Items/Armor/AerospecLeggings.cs index 5bf1f5a93b..22dd0e1f19 100644 --- a/Items/Armor/AerospecLeggings.cs +++ b/Items/Armor/AerospecLeggings.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = ItemRarityID.Orange; - item.defense = 6; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 3, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.defense = 6; } public override void UpdateEquip(Player player) @@ -30,14 +30,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ItemID.Cloud, 6); - recipe.AddIngredient(ItemID.RainCloud, 3); - recipe.AddIngredient(ItemID.Feather, 2); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ItemID.Cloud, 6).AddIngredient(ItemID.RainCloud, 3).AddIngredient(ItemID.Feather, 2).AddTile(TileID.SkyMill).Register(); } } } diff --git a/Items/Armor/AstralBreastplate.cs b/Items/Armor/AstralBreastplate.cs index 3faabca2f3..78e239a874 100644 --- a/Items/Armor/AstralBreastplate.cs +++ b/Items/Armor/AstralBreastplate.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 32, 0, 0); - item.rare = ItemRarityID.Cyan; - item.defense = 25; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 32, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.defense = 25; } public override void UpdateEquip(Player player) @@ -33,12 +33,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ItemID.MeteoriteBar, 9); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ItemID.MeteoriteBar, 9).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/AstralHelm.cs b/Items/Armor/AstralHelm.cs index 3e74e26a5e..028be3866f 100644 --- a/Items/Armor/AstralHelm.cs +++ b/Items/Armor/AstralHelm.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 40, 0, 0); - item.rare = ItemRarityID.Cyan; - item.defense = 17; //63 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 40, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.defense = 17; //63 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -56,12 +56,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.MeteoriteBar, 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.MeteoriteBar, 6).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/AstralLeggings.cs b/Items/Armor/AstralLeggings.cs index 227431768f..c98761d990 100644 --- a/Items/Armor/AstralLeggings.cs +++ b/Items/Armor/AstralLeggings.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = ItemRarityID.Cyan; - item.defense = 21; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 24, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.defense = 21; } public override void UpdateEquip(Player player) @@ -32,12 +32,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.MeteoriteBar, 8); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.MeteoriteBar, 8).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/AtaxiaArmor.cs b/Items/Armor/AtaxiaArmor.cs index ecede12582..05bcf82cac 100644 --- a/Items/Armor/AtaxiaArmor.cs +++ b/Items/Armor/AtaxiaArmor.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = ItemRarityID.Yellow; - item.defense = 20; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 24, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.defense = 20; } public override void UpdateEquip(Player player) @@ -33,13 +33,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.HellstoneBar, 8); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.HellstoneBar, 8).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/AtaxiaHeadgear.cs b/Items/Armor/AtaxiaHeadgear.cs index 540b0a7e00..ac2961a62d 100644 --- a/Items/Armor/AtaxiaHeadgear.cs +++ b/Items/Armor/AtaxiaHeadgear.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = ItemRarityID.Yellow; - item.defense = 15; //53 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 30, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.defense = 15; //53 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -45,27 +45,21 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaBolt = true; - player.rangedDamage += 0.05f; + player.GetDamage(DamageClass.Ranged) += 0.05f; } public override void UpdateEquip(Player player) { player.ammoCost75 = true; - player.rangedDamage += 0.12f; - player.rangedCrit += 10; + player.GetDamage(DamageClass.Ranged) += 0.12f; + player.GetCritChance(DamageClass.Ranged) += 10; player.lavaMax += 240; player.buffImmune[BuffID.OnFire] = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ItemID.HellstoneBar, 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ItemID.HellstoneBar, 4).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/AtaxiaHelm.cs b/Items/Armor/AtaxiaHelm.cs index 8b9b902d4e..b3cb0071c7 100644 --- a/Items/Armor/AtaxiaHelm.cs +++ b/Items/Armor/AtaxiaHelm.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = ItemRarityID.Yellow; - item.defense = 33; //67 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 30, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.defense = 33; //67 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaGeyser = true; - player.meleeDamage += 0.05f; + player.GetDamage(DamageClass.Melee) += 0.05f; player.aggro += 700; } @@ -57,21 +57,15 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaFire = true; player.meleeSpeed += 0.18f; - player.meleeDamage += 0.12f; - player.meleeCrit += 10; + player.GetDamage(DamageClass.Melee) += 0.12f; + player.GetCritChance(DamageClass.Melee) += 10; player.lavaMax += 240; player.buffImmune[BuffID.OnFire] = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ItemID.HellstoneBar, 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ItemID.HellstoneBar, 4).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/AtaxiaHelmet.cs b/Items/Armor/AtaxiaHelmet.cs index b661e812e8..25d7a75b5c 100644 --- a/Items/Armor/AtaxiaHelmet.cs +++ b/Items/Armor/AtaxiaHelmet.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = ItemRarityID.Yellow; - item.defense = 6; //40 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 30, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.defense = 6; //40 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -58,13 +58,13 @@ namespace CalamityMod.Items.Armor Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(190f * player.MinionDamage()), 0f, Main.myPlayer, 38f, 0f); } } - player.minionDamage += 0.4f; + player.GetDamage(DamageClass.Summon) += 0.4f; player.maxMinions += 2; } public override void UpdateEquip(Player player) { - player.minionDamage += 0.05f; + player.GetDamage(DamageClass.Summon) += 0.05f; player.minionKB += 1.5f; player.lavaMax += 240; player.buffImmune[BuffID.OnFire] = true; @@ -72,13 +72,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ItemID.HellstoneBar, 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ItemID.HellstoneBar, 4).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/AtaxiaHood.cs b/Items/Armor/AtaxiaHood.cs index 584d210e0d..286c906475 100644 --- a/Items/Armor/AtaxiaHood.cs +++ b/Items/Armor/AtaxiaHood.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = ItemRarityID.Yellow; - item.defense = 12; //49 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 30, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.defense = 12; //49 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -67,13 +67,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ItemID.HellstoneBar, 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ItemID.HellstoneBar, 4).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/AtaxiaMask.cs b/Items/Armor/AtaxiaMask.cs index 68eec6f1fc..5a9a5a69d8 100644 --- a/Items/Armor/AtaxiaMask.cs +++ b/Items/Armor/AtaxiaMask.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = ItemRarityID.Yellow; - item.defense = 9; //45 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 30, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.defense = 9; //45 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -45,28 +45,22 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaMage = true; - player.magicDamage += 0.05f; + player.GetDamage(DamageClass.Magic) += 0.05f; player.manaCost *= 0.85f; } public override void UpdateEquip(Player player) { player.statManaMax2 += 100; - player.magicDamage += 0.12f; - player.magicCrit += 10; + player.GetDamage(DamageClass.Magic) += 0.12f; + player.GetCritChance(DamageClass.Magic) += 10; player.lavaMax += 240; player.buffImmune[BuffID.OnFire] = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ItemID.HellstoneBar, 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ItemID.HellstoneBar, 4).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/AtaxiaSubligar.cs b/Items/Armor/AtaxiaSubligar.cs index e306dc7655..950bb852fa 100644 --- a/Items/Armor/AtaxiaSubligar.cs +++ b/Items/Armor/AtaxiaSubligar.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = ItemRarityID.Yellow; - item.defense = 14; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 18, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.defense = 14; } public override void UpdateEquip(Player player) @@ -32,13 +32,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.HellstoneBar, 5).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/AuricTeslaBodyArmor.cs b/Items/Armor/AuricTeslaBodyArmor.cs index 54c7f3df62..124c2d6d76 100644 --- a/Items/Armor/AuricTeslaBodyArmor.cs +++ b/Items/Armor/AuricTeslaBodyArmor.cs @@ -21,11 +21,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 38; - item.height = 34; - item.value = Item.buyPrice(1, 44, 0, 0); - item.defense = 48; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 38; + Item.height = 34; + Item.value = Item.buyPrice(1, 44, 0, 0); + Item.defense = 48; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void UpdateEquip(Player player) @@ -40,25 +40,8 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 18).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 18).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/AuricTeslaCuisses.cs b/Items/Armor/AuricTeslaCuisses.cs index fca196b4f3..55ab46dd98 100644 --- a/Items/Armor/AuricTeslaCuisses.cs +++ b/Items/Armor/AuricTeslaCuisses.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(1, 8, 0, 0); - item.defense = 44; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(1, 8, 0, 0); + Item.defense = 44; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void UpdateEquip(Player player) @@ -36,25 +36,8 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.FlyingCarpet); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.FlyingCarpet); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.FlyingCarpet).AddIngredient(ModContent.ItemType(), 15).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.FlyingCarpet).AddIngredient(ModContent.ItemType(), 15).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/AuricTeslaHelm.cs b/Items/Armor/AuricTeslaHelm.cs index e42b960496..4ab9736d9b 100644 --- a/Items/Armor/AuricTeslaHelm.cs +++ b/Items/Armor/AuricTeslaHelm.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 54; //132 - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.defense = 54; //132 + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -68,21 +68,13 @@ namespace CalamityMod.Items.Armor { CalamityPlayer modPlayer = player.Calamity(); modPlayer.auricBoost = true; - player.meleeDamage += 0.2f; - player.meleeCrit += 20; + player.GetDamage(DamageClass.Melee) += 0.2f; + player.GetCritChance(DamageClass.Melee) += 20; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 12).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/AuricTeslaHoodedFacemask.cs b/Items/Armor/AuricTeslaHoodedFacemask.cs index 35a2a704be..ed1c1cc785 100644 --- a/Items/Armor/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/AuricTeslaHoodedFacemask.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 40; //132 - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.defense = 40; //132 + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -66,21 +66,13 @@ namespace CalamityMod.Items.Armor { CalamityPlayer modPlayer = player.Calamity(); modPlayer.auricBoost = true; - player.rangedDamage += 0.3f; - player.rangedCrit += 30; + player.GetDamage(DamageClass.Ranged) += 0.3f; + player.GetCritChance(DamageClass.Ranged) += 30; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 12).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/AuricTeslaPlumedHelm.cs b/Items/Armor/AuricTeslaPlumedHelm.cs index 9da39fdce5..28738e0097 100644 --- a/Items/Armor/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/AuricTeslaPlumedHelm.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 34; //132 - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.defense = 34; //132 + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -79,15 +79,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 12).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/AuricTeslaSpaceHelmet.cs b/Items/Armor/AuricTeslaSpaceHelmet.cs index 5077a530e9..792e6eb440 100644 --- a/Items/Armor/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/AuricTeslaSpaceHelmet.cs @@ -21,11 +21,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 12; //132 - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.defense = 12; //132 + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Armor player.lavaMax += 240; player.ignoreWater = true; player.crimsonRegen = true; - player.minionDamage += 0.75f; + player.GetDamage(DamageClass.Summon) += 0.75f; player.maxMinions += 6; if (player.lavaWet) { @@ -81,20 +81,12 @@ namespace CalamityMod.Items.Armor { CalamityPlayer modPlayer = player.Calamity(); modPlayer.auricBoost = true; - player.minionDamage += 0.15f; + player.GetDamage(DamageClass.Summon) += 0.15f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 12).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/AuricTeslaWireHemmedVisage.cs b/Items/Armor/AuricTeslaWireHemmedVisage.cs index fa340c955d..62ad12162a 100644 --- a/Items/Armor/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/AuricTeslaWireHemmedVisage.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 24; //132 - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.defense = 24; //132 + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -65,22 +65,14 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.auricBoost = true; player.manaCost *= 0.8f; - player.magicDamage += 0.3f; - player.magicCrit += 20; + player.GetDamage(DamageClass.Magic) += 0.3f; + player.GetCritChance(DamageClass.Magic) += 20; player.statManaMax2 += 100; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 12).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/BloodflareBodyArmor.cs b/Items/Armor/BloodflareBodyArmor.cs index f3ec7e1f44..6e3ddd9d2a 100644 --- a/Items/Armor/BloodflareBodyArmor.cs +++ b/Items/Armor/BloodflareBodyArmor.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 48, 0, 0); - item.defense = 35; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 48, 0, 0); + Item.defense = 35; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void UpdateEquip(Player player) @@ -39,12 +39,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/BloodflareCuisses.cs b/Items/Armor/BloodflareCuisses.cs index 72677e0e3b..0ffd03b7a9 100644 --- a/Items/Armor/BloodflareCuisses.cs +++ b/Items/Armor/BloodflareCuisses.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 36, 0, 0); - item.defense = 29; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.defense = 29; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void UpdateEquip(Player player) @@ -32,12 +32,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 13); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 13).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/BloodflareHelm.cs b/Items/Armor/BloodflareHelm.cs index 6f82f98d05..d98eb18da7 100644 --- a/Items/Armor/BloodflareHelm.cs +++ b/Items/Armor/BloodflareHelm.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 28; //85 - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.defense = 28; //85 + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -67,12 +67,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 11); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 11).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/BloodflareHelmet.cs b/Items/Armor/BloodflareHelmet.cs index 8fa565290c..07c10c9653 100644 --- a/Items/Armor/BloodflareHelmet.cs +++ b/Items/Armor/BloodflareHelmet.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 16; //85 - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.defense = 16; //85 + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Armor "At 90% life and above you gain 10% increased minion damage\n" + "At 50% life and below you gain 20 defense and 2 life regen"; player.crimsonRegen = true; - player.minionDamage += 0.5f; + player.GetDamage(DamageClass.Summon) += 0.5f; player.maxMinions += 3; } @@ -58,17 +58,12 @@ namespace CalamityMod.Items.Armor { player.lavaMax += 240; player.ignoreWater = true; - player.minionDamage += 0.05f; + player.GetDamage(DamageClass.Summon) += 0.05f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 11); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 11).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/BloodflareHornedHelm.cs b/Items/Armor/BloodflareHornedHelm.cs index 2311931140..40e90189ae 100644 --- a/Items/Armor/BloodflareHornedHelm.cs +++ b/Items/Armor/BloodflareHornedHelm.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 34; //85 - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.defense = 34; //85 + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -55,18 +55,13 @@ namespace CalamityMod.Items.Armor { player.lavaMax += 240; player.ignoreWater = true; - player.rangedDamage += 0.1f; - player.rangedCrit += 10; + player.GetDamage(DamageClass.Ranged) += 0.1f; + player.GetCritChance(DamageClass.Ranged) += 10; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 11); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 11).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/BloodflareHornedMask.cs b/Items/Armor/BloodflareHornedMask.cs index 82bd7c1593..1453e320de 100644 --- a/Items/Armor/BloodflareHornedMask.cs +++ b/Items/Armor/BloodflareHornedMask.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 22; //85 - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.defense = 22; //85 + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -54,19 +54,14 @@ namespace CalamityMod.Items.Armor player.manaCost *= 0.83f; player.lavaMax += 240; player.ignoreWater = true; - player.magicDamage += 0.2f; - player.magicCrit += 10; + player.GetDamage(DamageClass.Magic) += 0.2f; + player.GetCritChance(DamageClass.Magic) += 10; player.statManaMax2 += 100; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 11); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 11).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/BloodflareMask.cs b/Items/Armor/BloodflareMask.cs index 320785ee32..4c3826fccd 100644 --- a/Items/Armor/BloodflareMask.cs +++ b/Items/Armor/BloodflareMask.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 49; //85 - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.defense = 49; //85 + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -57,18 +57,13 @@ namespace CalamityMod.Items.Armor { player.lavaMax += 240; player.ignoreWater = true; - player.meleeDamage += 0.1f; - player.meleeCrit += 10; + player.GetDamage(DamageClass.Melee) += 0.1f; + player.GetCritChance(DamageClass.Melee) += 10; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 11); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 11).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/BrimflameBoots.cs b/Items/Armor/BrimflameBoots.cs index 87379f1972..2266913eb1 100644 --- a/Items/Armor/BrimflameBoots.cs +++ b/Items/Armor/BrimflameBoots.cs @@ -17,28 +17,23 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.defense = 15; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.defense = 15; } public override void UpdateEquip(Player player) { player.moveSpeed += 0.05f; - player.magicDamage += 0.05f; + player.GetDamage(DamageClass.Magic) += 0.05f; player.fireWalk = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/BrimflameRobes.cs b/Items/Armor/BrimflameRobes.cs index 74af359fa7..e32002d854 100644 --- a/Items/Armor/BrimflameRobes.cs +++ b/Items/Armor/BrimflameRobes.cs @@ -17,29 +17,23 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.defense = 15; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.defense = 15; } public override void UpdateEquip(Player player) { - player.magicDamage += 0.05f; - player.magicCrit += 5; + player.GetDamage(DamageClass.Magic) += 0.05f; + player.GetCritChance(DamageClass.Magic) += 5; player.lavaRose = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ObsidianRose); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ObsidianRose).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/BrimflameScowl.cs b/Items/Armor/BrimflameScowl.cs index fd91067c8f..99b66066fb 100644 --- a/Items/Armor/BrimflameScowl.cs +++ b/Items/Armor/BrimflameScowl.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.defense = 11; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.defense = 11; } private void UpdateFrenzy(Player player) @@ -51,8 +51,8 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.magicDamage += 0.05f; - player.magicCrit += 5; + player.GetDamage(DamageClass.Magic) += 0.05f; + player.GetCritChance(DamageClass.Magic) += 5; player.statManaMax2 += 70; // TODO -- oh god. player.manaCost -= 0.1f; player.manaCost *= 0.9f; @@ -76,8 +76,8 @@ namespace CalamityMod.Items.Armor { CalamityPlayer modPlayer = player.Calamity(); modPlayer.brimflameSet = true; - player.magicDamage += 0.15f; - player.magicCrit += 15; + player.GetDamage(DamageClass.Magic) += 0.15f; + player.GetCritChance(DamageClass.Magic) += 15; string hotkey = CalamityMod.TarraHotKey.TooltipHotkeyString(); player.setBonus = "Grants an additional 15% increased magic damage and crit\n" + "Press " + hotkey + " to trigger a brimflame frenzy effect\n" + @@ -88,12 +88,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/CirrusDress.cs b/Items/Armor/CirrusDress.cs index f1762655af..b5f7e48e38 100644 --- a/Items/Armor/CirrusDress.cs +++ b/Items/Armor/CirrusDress.cs @@ -22,26 +22,26 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; - item.defense = 8; + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; + Item.defense = 8; } public override void UpdateEquip(Player player) { player.Calamity().cirrusDress = true; - player.magicDamage += 0.05f; - player.magicCrit += 5; + player.GetDamage(DamageClass.Magic) += 0.05f; + player.GetCritChance(DamageClass.Magic) += 5; } public override void SetMatch(bool male, ref int equipSlot, ref bool robes) { robes = true; // The equipSlot is added in CalamityMod.cs --> Load hook - equipSlot = mod.GetEquipSlot("CirrusDress_Legs", EquipType.Legs); + equipSlot = Mod.GetEquipSlot("CirrusDress_Legs", EquipType.Legs); } public override void DrawHands(ref bool drawHands, ref bool drawArms) diff --git a/Items/Armor/DaedalusBreastplate.cs b/Items/Armor/DaedalusBreastplate.cs index d8dae05f5e..cc2873ddb6 100644 --- a/Items/Armor/DaedalusBreastplate.cs +++ b/Items/Armor/DaedalusBreastplate.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 20, 0, 0); - item.rare = ItemRarityID.Pink; - item.defense = 19; //41 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 20, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.defense = 19; //41 } public override void UpdateEquip(Player player) @@ -31,13 +31,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.CrystalShard, 6); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.CrystalShard, 6).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/DaedalusHat.cs b/Items/Armor/DaedalusHat.cs index 476fd8a114..2146c8ef9e 100644 --- a/Items/Armor/DaedalusHat.cs +++ b/Items/Armor/DaedalusHat.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = ItemRarityID.Pink; - item.defense = 5; //35 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 25, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.defense = 5; //35 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -43,26 +43,20 @@ namespace CalamityMod.Items.Armor "If you absorb an attack you are healed for 1/2 of that attack's damage"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.daedalusAbsorb = true; - player.magicDamage += 0.05f; + player.GetDamage(DamageClass.Magic) += 0.05f; } public override void UpdateEquip(Player player) { player.manaCost *= 0.9f; - player.magicDamage += 0.13f; - player.magicCrit += 7; + player.GetDamage(DamageClass.Magic) += 0.13f; + player.GetCritChance(DamageClass.Magic) += 7; player.statManaMax2 += 60; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.CrystalShard, 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.CrystalShard, 3).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/DaedalusHeadgear.cs b/Items/Armor/DaedalusHeadgear.cs index 8d1c39af69..2c32f13f93 100644 --- a/Items/Armor/DaedalusHeadgear.cs +++ b/Items/Armor/DaedalusHeadgear.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = ItemRarityID.Pink; - item.defense = 3; //33 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 25, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.defense = 3; //33 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -54,24 +54,18 @@ namespace CalamityMod.Items.Armor Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(95f * player.MinionDamage()), 0f, Main.myPlayer, 50f, 0f); } } - player.minionDamage += 0.2f; + player.GetDamage(DamageClass.Summon) += 0.2f; player.maxMinions += 2; } public override void UpdateEquip(Player player) { - player.minionDamage += 0.05f; + player.GetDamage(DamageClass.Summon) += 0.05f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.CrystalShard, 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.CrystalShard, 3).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/DaedalusHelm.cs b/Items/Armor/DaedalusHelm.cs index 82b0f9ff8c..f3e0ff53d7 100644 --- a/Items/Armor/DaedalusHelm.cs +++ b/Items/Armor/DaedalusHelm.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = ItemRarityID.Pink; - item.defense = 21; //51 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 25, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.defense = 21; //51 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -45,26 +45,20 @@ namespace CalamityMod.Items.Armor "This reflect has a 90 second cooldown which is shared with all other dodges and reflects"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.daedalusReflect = true; - player.meleeDamage += 0.05f; + player.GetDamage(DamageClass.Melee) += 0.05f; player.aggro += 500; } public override void UpdateEquip(Player player) { player.meleeSpeed += 0.15f; - player.meleeDamage += 0.1f; - player.meleeCrit += 10; + player.GetDamage(DamageClass.Melee) += 0.1f; + player.GetCritChance(DamageClass.Melee) += 10; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.CrystalShard, 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.CrystalShard, 3).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/DaedalusHelmet.cs b/Items/Armor/DaedalusHelmet.cs index 3517936501..be19736b35 100644 --- a/Items/Armor/DaedalusHelmet.cs +++ b/Items/Armor/DaedalusHelmet.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = ItemRarityID.Pink; - item.defense = 9; //39 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 25, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.defense = 9; //39 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -42,25 +42,19 @@ namespace CalamityMod.Items.Armor "Getting hit causes you to emit a blast of crystal shards"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.daedalusShard = true; - player.rangedDamage += 0.05f; + player.GetDamage(DamageClass.Ranged) += 0.05f; } public override void UpdateEquip(Player player) { player.ammoCost80 = true; - player.rangedDamage += 0.13f; - player.rangedCrit += 7; + player.GetDamage(DamageClass.Ranged) += 0.13f; + player.GetCritChance(DamageClass.Ranged) += 7; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.CrystalShard, 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.CrystalShard, 3).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/DaedalusLeggings.cs b/Items/Armor/DaedalusLeggings.cs index e46236dac6..2d8d15f06b 100644 --- a/Items/Armor/DaedalusLeggings.cs +++ b/Items/Armor/DaedalusLeggings.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = ItemRarityID.Pink; - item.defense = 15; //41 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 15, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.defense = 15; //41 } public override void UpdateEquip(Player player) @@ -32,13 +32,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.CrystalShard, 4); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.CrystalShard, 4).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/DaedalusVisor.cs b/Items/Armor/DaedalusVisor.cs index 4be0ac6992..689cebeace 100644 --- a/Items/Armor/DaedalusVisor.cs +++ b/Items/Armor/DaedalusVisor.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = ItemRarityID.Pink; - item.defense = 7; //37 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 25, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.defense = 7; //37 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -61,13 +61,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.CrystalShard, 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.CrystalShard, 3).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/DemonshadeBreastplate.cs b/Items/Armor/DemonshadeBreastplate.cs index c333eda127..989b6528e7 100644 --- a/Items/Armor/DemonshadeBreastplate.cs +++ b/Items/Armor/DemonshadeBreastplate.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.defense = 50; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.width = 18; + Item.height = 18; + Item.defense = 50; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } public override void UpdateEquip(Player player) @@ -42,11 +42,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/DemonshadeGreaves.cs b/Items/Armor/DemonshadeGreaves.cs index c6d61274c8..989d179698 100644 --- a/Items/Armor/DemonshadeGreaves.cs +++ b/Items/Armor/DemonshadeGreaves.cs @@ -17,13 +17,13 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.defense = 50; + Item.width = 18; + Item.height = 18; + Item.defense = 50; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } public override void UpdateEquip(Player player) @@ -35,11 +35,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/DemonshadeHelm.cs b/Items/Armor/DemonshadeHelm.cs index 9258371299..cb3e798f29 100644 --- a/Items/Armor/DemonshadeHelm.cs +++ b/Items/Armor/DemonshadeHelm.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.defense = 50; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.width = 18; + Item.height = 18; + Item.defense = 50; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Armor Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } - player.minionDamage += 1f; + player.GetDamage(DamageClass.Summon) += 1f; player.maxMinions += 10; } @@ -78,11 +78,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(ModContent.TileType()).Register(); } public string ExtensionTexture => "CalamityMod/Items/Armor/DemonshadeHelm_Extension"; diff --git a/Items/Armor/DesertProwlerHat.cs b/Items/Armor/DesertProwlerHat.cs index e355e4ad06..a0337780f6 100644 --- a/Items/Armor/DesertProwlerHat.cs +++ b/Items/Armor/DesertProwlerHat.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.defense = 1; //6 + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.defense = 1; //6 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -39,18 +39,13 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.rangedCrit += 4; + player.GetCritChance(DamageClass.Ranged) += 4; player.ammoCost80 = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Silk, 8); - recipe.AddTile(TileID.Loom); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Silk, 8).AddTile(TileID.Loom).Register(); } } } diff --git a/Items/Armor/DesertProwlerPants.cs b/Items/Armor/DesertProwlerPants.cs index 2ef9ef8c6b..3537c32d58 100644 --- a/Items/Armor/DesertProwlerPants.cs +++ b/Items/Armor/DesertProwlerPants.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.defense = 2; + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.defense = 2; } public override void UpdateEquip(Player player) @@ -31,12 +31,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.AddTile(TileID.Loom); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Silk, 5).AddTile(TileID.Loom).Register(); } } } diff --git a/Items/Armor/DesertProwlerShirt.cs b/Items/Armor/DesertProwlerShirt.cs index 7b341ee37c..1bf9960204 100644 --- a/Items/Armor/DesertProwlerShirt.cs +++ b/Items/Armor/DesertProwlerShirt.cs @@ -16,26 +16,21 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.defense = 3; + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.defense = 3; } public override void UpdateEquip(Player player) { - player.rangedCrit += 5; + player.GetCritChance(DamageClass.Ranged) += 5; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.Silk, 10); - recipe.AddTile(TileID.Loom); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.Silk, 10).AddTile(TileID.Loom).Register(); } } } diff --git a/Items/Armor/FathomSwarmerBoots.cs b/Items/Armor/FathomSwarmerBoots.cs index 559632249b..87e00ce7b5 100644 --- a/Items/Armor/FathomSwarmerBoots.cs +++ b/Items/Armor/FathomSwarmerBoots.cs @@ -19,16 +19,16 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = ItemRarityID.Lime; - item.defense = 15; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 18, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.defense = 15; } public override void UpdateEquip(Player player) { - player.minionDamage += 0.04f; + player.GetDamage(DamageClass.Summon) += 0.04f; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.moveSpeed += 0.4f; @@ -45,15 +45,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpiderGreaves); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpiderGreaves).AddIngredient(ModContent.ItemType(), 9).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/FathomSwarmerBreastplate.cs b/Items/Armor/FathomSwarmerBreastplate.cs index adfd4f13c9..9d7e7d4097 100644 --- a/Items/Armor/FathomSwarmerBreastplate.cs +++ b/Items/Armor/FathomSwarmerBreastplate.cs @@ -20,16 +20,16 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = ItemRarityID.Lime; - item.defense = 22; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 24, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.defense = 22; } public override void UpdateEquip(Player player) { - player.minionDamage += 0.06f; + player.GetDamage(DamageClass.Summon) += 0.06f; player.endurance += 0.06f; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { @@ -41,15 +41,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpiderBreastplate); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpiderBreastplate).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/FathomSwarmerVisage.cs b/Items/Armor/FathomSwarmerVisage.cs index c49c15b949..67978e956b 100644 --- a/Items/Armor/FathomSwarmerVisage.cs +++ b/Items/Armor/FathomSwarmerVisage.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = ItemRarityID.Lime; - item.defense = 10; //47 +10 underwater + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 30, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.defense = 10; //47 +10 underwater } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -41,17 +41,17 @@ namespace CalamityMod.Items.Armor modPlayer.fathomSwarmer = true; player.spikedBoots = 2; player.maxMinions += 2; - player.minionDamage += 0.1f; + player.GetDamage(DamageClass.Summon) += 0.1f; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - player.minionDamage += 0.3f; + player.GetDamage(DamageClass.Summon) += 0.3f; } } public override void UpdateEquip(Player player) { CalamityPlayer modPlayer = player.Calamity(); - player.minionDamage += 0.05f; + player.GetDamage(DamageClass.Summon) += 0.05f; if (player.breath <= player.breathMax + 2 && !modPlayer.ZoneAbyss) { player.breath = player.breathMax + 3; @@ -66,15 +66,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpiderMask); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 11); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpiderMask).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 11).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/FearmongerGreathelm.cs b/Items/Armor/FearmongerGreathelm.cs index 68e378ec16..f883504c5d 100644 --- a/Items/Armor/FearmongerGreathelm.cs +++ b/Items/Armor/FearmongerGreathelm.cs @@ -21,17 +21,17 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(gold: 75); - item.defense = 38; // 132 total - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(gold: 75); + Item.defense = 38; // 132 total + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateEquip(Player player) { player.statManaMax2 += 60; - player.minionDamage += 0.1f; + player.GetDamage(DamageClass.Summon) += 0.1f; player.manaCost *= 0.9f; } @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Armor // All-class armors count as rogue sets, but don't grant stealth bonuses player.Calamity().wearingRogueArmor = true; player.Calamity().WearingPostMLSummonerSet = true; - player.minionDamage += 0.2f; + player.GetDamage(DamageClass.Summon) += 0.2f; player.maxMinions += 2; int[] immuneDebuffs = { @@ -88,14 +88,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpookyHelmet); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.SoulofFright, 8); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpookyHelmet).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.SoulofFright, 8).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/FearmongerGreaves.cs b/Items/Armor/FearmongerGreaves.cs index fd28f06b18..1d371b1612 100644 --- a/Items/Armor/FearmongerGreaves.cs +++ b/Items/Armor/FearmongerGreaves.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(gold: 45); - item.defense = 44; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(gold: 45); + Item.defense = 44; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateEquip(Player player) @@ -37,14 +37,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpookyLeggings); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpookyLeggings).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.SoulofFright, 10).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/FearmongerPlateMail.cs b/Items/Armor/FearmongerPlateMail.cs index 1744dba575..47a20e5409 100644 --- a/Items/Armor/FearmongerPlateMail.cs +++ b/Items/Armor/FearmongerPlateMail.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(gold: 60); - item.defense = 50; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(gold: 60); + Item.defense = 50; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateEquip(Player player) @@ -35,14 +35,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpookyBreastplate); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ItemID.SoulofFright, 12); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpookyBreastplate).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ItemID.SoulofFright, 12).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index bedc612a96..c13f936dba 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -20,13 +20,13 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.defense = 1; + Item.width = 18; + Item.height = 18; + Item.defense = 1; // This item has the same rarity and sell price as Forbidden Mask - item.value = Item.buyPrice(gold: 25); - item.rare = ItemRarityID.Pink; - item.Calamity().donorItem = true; + Item.value = Item.buyPrice(gold: 25); + Item.rare = ItemRarityID.Pink; + Item.Calamity().donorItem = true; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -60,19 +60,14 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.minionDamage += 0.1f; + player.GetDamage(DamageClass.Summon) += 0.1f; player.Calamity().throwingVelocity += 0.15f; } public override void AddRecipes() { //Same recipe as Forbidden Mask - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyAdamantiteBar", 10); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyAdamantiteBar", 10).AddIngredient(ItemID.AncientBattleArmorMaterial).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/GemTechBodyArmor.cs b/Items/Armor/GemTechBodyArmor.cs index d9cede57e5..918000ddd4 100644 --- a/Items/Armor/GemTechBodyArmor.cs +++ b/Items/Armor/GemTechBodyArmor.cs @@ -17,26 +17,20 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 48; - item.height = 32; - item.defense = 31; - item.rare = ItemRarityID.Purple; + Item.width = 48; + Item.height = 32; + Item.defense = 31; + Item.rare = ItemRarityID.Purple; // Exact worth of the armor piece's constituents. - item.value = Item.sellPrice(platinum: 9, gold: 79, silver: 80); - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().donorItem = true; + Item.value = Item.sellPrice(platinum: 9, gold: 79, silver: 80); + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().donorItem = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/GemTechHeadgear.cs b/Items/Armor/GemTechHeadgear.cs index fc7cb59a54..20d6b74399 100644 --- a/Items/Armor/GemTechHeadgear.cs +++ b/Items/Armor/GemTechHeadgear.cs @@ -55,15 +55,15 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 40; - item.height = 32; - item.defense = 14; - item.rare = ItemRarityID.Purple; + Item.width = 40; + Item.height = 32; + Item.defense = 14; + Item.rare = ItemRarityID.Purple; // Exact worth of the armor piece's constituents. - item.value = Item.sellPrice(platinum: 6, gold: 14, silver: 88); - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().donorItem = true; + Item.value = Item.sellPrice(platinum: 6, gold: 14, silver: 88); + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().donorItem = true; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -102,13 +102,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/GemTechSchynbaulds.cs b/Items/Armor/GemTechSchynbaulds.cs index 727d81f4e4..2d3cb9e252 100644 --- a/Items/Armor/GemTechSchynbaulds.cs +++ b/Items/Armor/GemTechSchynbaulds.cs @@ -17,26 +17,20 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 28; - item.height = 26; - item.defense = 24; - item.rare = ItemRarityID.Purple; + Item.width = 28; + Item.height = 26; + Item.defense = 24; + Item.rare = ItemRarityID.Purple; // Exact worth of the armor piece's constituents. - item.value = Item.sellPrice(platinum: 7, gold: 35, silver: 84); - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().donorItem = true; + Item.value = Item.sellPrice(platinum: 7, gold: 35, silver: 84); + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().donorItem = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/GodSlayerChestplate.cs b/Items/Armor/GodSlayerChestplate.cs index 7dd324b8a7..40d035ed81 100644 --- a/Items/Armor/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayerChestplate.cs @@ -21,11 +21,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 41; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.defense = 41; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateEquip(Player player) @@ -39,12 +39,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 23); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 23).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/GodSlayerHelm.cs b/Items/Armor/GodSlayerHelm.cs index 7c5d1e0ab1..59ee3b910f 100644 --- a/Items/Armor/GodSlayerHelm.cs +++ b/Items/Armor/GodSlayerHelm.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 48; //96 - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 75, 0, 0); + Item.defense = 48; //96 + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -61,18 +61,13 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.meleeDamage += 0.14f; - player.meleeCrit += 14; + player.GetDamage(DamageClass.Melee) += 0.14f; + player.GetCritChance(DamageClass.Melee) += 14; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/GodSlayerHelmet.cs b/Items/Armor/GodSlayerHelmet.cs index a78e2f9632..2d7bfae950 100644 --- a/Items/Armor/GodSlayerHelmet.cs +++ b/Items/Armor/GodSlayerHelmet.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 35; //96 - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 75, 0, 0); + Item.defense = 35; //96 + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -56,18 +56,13 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.rangedDamage += 0.14f; - player.rangedCrit += 14; + player.GetDamage(DamageClass.Ranged) += 0.14f; + player.GetCritChance(DamageClass.Ranged) += 14; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/GodSlayerLeggings.cs b/Items/Armor/GodSlayerLeggings.cs index bdb7ae7c56..69ab6d4ecc 100644 --- a/Items/Armor/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayerLeggings.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 45, 0, 0); - item.defense = 35; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 45, 0, 0); + Item.defense = 35; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateEquip(Player player) @@ -33,12 +33,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/GodSlayerMask.cs b/Items/Armor/GodSlayerMask.cs index f8e0c32428..770d3be000 100644 --- a/Items/Armor/GodSlayerMask.cs +++ b/Items/Armor/GodSlayerMask.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 29; //96 - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 75, 0, 0); + Item.defense = 29; //96 + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -70,12 +70,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/MolluskShelleggings.cs b/Items/Armor/MolluskShelleggings.cs index 8e7a2265f8..54757cfb59 100644 --- a/Items/Armor/MolluskShelleggings.cs +++ b/Items/Armor/MolluskShelleggings.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 22; - item.height = 18; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = ItemRarityID.Pink; - item.defense = 15; + Item.width = 22; + Item.height = 18; + Item.value = Item.buyPrice(0, 15, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.defense = 15; } public override void UpdateEquip(Player player) @@ -34,12 +34,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/MolluskShellmet.cs b/Items/Armor/MolluskShellmet.cs index c0a272ecb8..d388984239 100644 --- a/Items/Armor/MolluskShellmet.cs +++ b/Items/Armor/MolluskShellmet.cs @@ -21,11 +21,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 22; - item.height = 22; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = ItemRarityID.Pink; - item.defense = 18; + Item.width = 22; + Item.height = 22; + Item.value = Item.buyPrice(0, 25, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.defense = 18; } public override void UpdateEquip(Player player) @@ -65,12 +65,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/MolluskShellplate.cs b/Items/Armor/MolluskShellplate.cs index 15f090ade1..0051394018 100644 --- a/Items/Armor/MolluskShellplate.cs +++ b/Items/Armor/MolluskShellplate.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 30; - item.height = 22; - item.value = Item.buyPrice(0, 20, 0, 0); - item.rare = ItemRarityID.Pink; - item.defense = 22; + Item.width = 30; + Item.height = 22; + Item.value = Item.buyPrice(0, 20, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.defense = 22; } public override void UpdateEquip(Player player) @@ -34,12 +34,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 25).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlueChestplate.cs index 7f8918d493..d170ac1614 100644 --- a/Items/Armor/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlueChestplate.cs @@ -20,12 +20,12 @@ No positive life regen"); public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.sellPrice(0, 38, 0, 0); - item.rare = ItemRarityID.Red; - item.defense = 28; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 18; + Item.height = 18; + Item.value = Item.sellPrice(0, 38, 0, 0); + Item.rare = ItemRarityID.Red; + Item.defense = 28; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void UpdateEquip(Player player) @@ -39,14 +39,7 @@ No positive life regen"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlueHelmet.cs index 5c0cf2cdd7..6a6d3c3175 100644 --- a/Items/Armor/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlueHelmet.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.sellPrice(0, 35, 0, 0); - item.rare = ItemRarityID.Red; - item.defense = 19; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 18; + Item.height = 18; + Item.value = Item.sellPrice(0, 35, 0, 0); + Item.rare = ItemRarityID.Red; + Item.defense = 19; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void UpdateEquip(Player player) @@ -79,14 +79,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } diff --git a/Items/Armor/OmegaBlueLeggings.cs b/Items/Armor/OmegaBlueLeggings.cs index ec0d1bb8fe..52530bc079 100644 --- a/Items/Armor/OmegaBlueLeggings.cs +++ b/Items/Armor/OmegaBlueLeggings.cs @@ -18,12 +18,12 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.sellPrice(0, 35, 25, 0); - item.rare = ItemRarityID.Red; - item.defense = 22; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 18; + Item.height = 18; + Item.value = Item.sellPrice(0, 35, 25, 0); + Item.rare = ItemRarityID.Red; + Item.defense = 22; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void UpdateEquip(Player player) @@ -35,14 +35,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/PlagueReaperMask.cs b/Items/Armor/PlagueReaperMask.cs index 23eac14dd1..2eeea6c9a9 100644 --- a/Items/Armor/PlagueReaperMask.cs +++ b/Items/Armor/PlagueReaperMask.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = ItemRarityID.Yellow; - item.defense = 9; //35 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 30, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.defense = 9; //35 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -55,8 +55,8 @@ namespace CalamityMod.Items.Armor player.blind = true; player.headcovered = true; player.blackout = true; - player.rangedDamage += 0.6f; //60% ranged dmg and 20% crit - player.rangedCrit += 20; + player.GetDamage(DamageClass.Ranged) += 0.6f; //60% ranged dmg and 20% crit + player.GetCritChance(DamageClass.Ranged) += 20; } if (player.whoAmI == Main.myPlayer) @@ -75,26 +75,14 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.rangedDamage += 0.1f; - player.rangedCrit += 8; + player.GetDamage(DamageClass.Ranged) += 0.1f; + player.GetCritChance(DamageClass.Ranged) += 8; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.NecroHelmet); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Nanites, 11); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientNecroHelmet); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Nanites, 11); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.NecroHelmet).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Nanites, 11).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1).AddIngredient(ItemID.AncientNecroHelmet).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Nanites, 11).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/PlagueReaperStriders.cs b/Items/Armor/PlagueReaperStriders.cs index 8291358694..b6a020128b 100644 --- a/Items/Armor/PlagueReaperStriders.cs +++ b/Items/Armor/PlagueReaperStriders.cs @@ -17,28 +17,22 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = ItemRarityID.Yellow; - item.defense = 11; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 18, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.defense = 11; } public override void UpdateEquip(Player player) { - player.rangedCrit += 3; + player.GetCritChance(DamageClass.Ranged) += 3; player.moveSpeed += 0.15f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.NecroGreaves); - recipe.AddIngredient(ModContent.ItemType(), 21); - recipe.AddIngredient(ItemID.Nanites, 17); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.NecroGreaves).AddIngredient(ModContent.ItemType(), 21).AddIngredient(ItemID.Nanites, 17).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/PlagueReaperVest.cs b/Items/Armor/PlagueReaperVest.cs index 20584b6a1e..a5f9b1fdd2 100644 --- a/Items/Armor/PlagueReaperVest.cs +++ b/Items/Armor/PlagueReaperVest.cs @@ -17,29 +17,23 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = ItemRarityID.Yellow; - item.defense = 14; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 24, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.defense = 14; } public override void UpdateEquip(Player player) { - player.rangedDamage += 0.15f; - player.rangedCrit += 5; + player.GetDamage(DamageClass.Ranged) += 0.15f; + player.GetCritChance(DamageClass.Ranged) += 5; player.Calamity().reducedPlagueDmg = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.NecroBreastplate); //I will instead change the position of the necro armor get trolled - recipe.AddIngredient(ModContent.ItemType(), 29); //I like prime numbers =) - recipe.AddIngredient(ItemID.Nanites, 19); //Change this to 30 and 20 and I will hunt you down - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.NecroBreastplate).AddIngredient(ModContent.ItemType(), 29).AddIngredient(ItemID.Nanites, 19).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/PlaguebringerCarapace.cs b/Items/Armor/PlaguebringerCarapace.cs index 5771218478..131e419d52 100644 --- a/Items/Armor/PlaguebringerCarapace.cs +++ b/Items/Armor/PlaguebringerCarapace.cs @@ -19,31 +19,24 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.defense = 17; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.Calamity().donorItem = true; + Item.width = 18; + Item.height = 18; + Item.defense = 17; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.Calamity().donorItem = true; } public override void UpdateEquip(Player player) { player.Calamity().plaguebringerCarapace = true; - player.minionDamage += 0.12f; + player.GetDamage(DamageClass.Summon) += 0.12f; player.Calamity().reducedPlagueDmg = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BeeBreastplate); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BeeBreastplate).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/PlaguebringerPistons.cs b/Items/Armor/PlaguebringerPistons.cs index f10129ed7b..e65d368ab7 100644 --- a/Items/Armor/PlaguebringerPistons.cs +++ b/Items/Armor/PlaguebringerPistons.cs @@ -19,17 +19,17 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.defense = 8; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.Calamity().donorItem = true; + Item.width = 18; + Item.height = 18; + Item.defense = 8; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.Calamity().donorItem = true; } public override void UpdateEquip(Player player) { - player.minionDamage += 0.13f; + player.GetDamage(DamageClass.Summon) += 0.13f; player.moveSpeed += 0.15f; player.Calamity().plaguebringerPistons = true; @@ -45,20 +45,20 @@ namespace CalamityMod.Items.Armor } if (!tile.active() && tile.liquid == 0 && Main.tile[x, y + 1] != null && WorldGen.SolidTile(x, y + 1)) { - tile.frameY = 0; + tile.TileFrameY = 0; tile.slope(0); tile.halfBrick(false); //On dirt blocks, there's a small chance to grow a dye plant - if (Main.tile[x, y + 1].type == TileID.Dirt) + if (Main.tile[x, y + 1].TileType == TileID.Dirt) { if (Main.rand.NextBool(1000)) { tile.active(true); - tile.type = TileID.DyePlants; - tile.frameX = (short)(34 * Main.rand.Next(1, 13)); - while (tile.frameX == 144) + tile.TileType = TileID.DyePlants; + tile.TileFrameX = (short)(34 * Main.rand.Next(1, 13)); + while (tile.TileFrameX == 144) { - tile.frameX = (short)(34 * Main.rand.Next(1, 13)); + tile.TileFrameX = (short)(34 * Main.rand.Next(1, 13)); } } if (Main.netMode == NetmodeID.MultiplayerClient) @@ -67,26 +67,26 @@ namespace CalamityMod.Items.Armor } } //On grass, grow flowers - if (Main.tile[x, y + 1].type == TileID.Grass) + if (Main.tile[x, y + 1].TileType == TileID.Grass) { if (Main.rand.NextBool(2)) { tile.active(true); - tile.type = TileID.Plants; - tile.frameX = (short)(18 * Main.rand.Next(6, 11)); - while (tile.frameX == 144) + tile.TileType = TileID.Plants; + tile.TileFrameX = (short)(18 * Main.rand.Next(6, 11)); + while (tile.TileFrameX == 144) { - tile.frameX = (short)(18 * Main.rand.Next(6, 11)); + tile.TileFrameX = (short)(18 * Main.rand.Next(6, 11)); } } else { tile.active(true); - tile.type = TileID.Plants2; - tile.frameX = (short)(18 * Main.rand.Next(6, 21)); - while (tile.frameX == 144) + tile.TileType = TileID.Plants2; + tile.TileFrameX = (short)(18 * Main.rand.Next(6, 21)); + while (tile.TileFrameX == 144) { - tile.frameX = (short)(18 * Main.rand.Next(6, 21)); + tile.TileFrameX = (short)(18 * Main.rand.Next(6, 21)); } } if (Main.netMode == NetmodeID.MultiplayerClient) @@ -95,26 +95,26 @@ namespace CalamityMod.Items.Armor } } //On hallowed grass, grow hallowed flowers - else if (Main.tile[x, y + 1].type == TileID.HallowedGrass) + else if (Main.tile[x, y + 1].TileType == TileID.HallowedGrass) { if (Main.rand.NextBool(2)) { tile.active(true); - tile.type = TileID.HallowedPlants; - tile.frameX = (short)(18 * Main.rand.Next(4, 7)); - while (tile.frameX == 90) + tile.TileType = TileID.HallowedPlants; + tile.TileFrameX = (short)(18 * Main.rand.Next(4, 7)); + while (tile.TileFrameX == 90) { - tile.frameX = (short)(18 * Main.rand.Next(4, 7)); + tile.TileFrameX = (short)(18 * Main.rand.Next(4, 7)); } } else { tile.active(true); - tile.type = TileID.HallowedPlants2; - tile.frameX = (short)(18 * Main.rand.Next(2, 8)); - while (tile.frameX == 90) + tile.TileType = TileID.HallowedPlants2; + tile.TileFrameX = (short)(18 * Main.rand.Next(2, 8)); + while (tile.TileFrameX == 90) { - tile.frameX = (short)(18 * Main.rand.Next(2, 8)); + tile.TileFrameX = (short)(18 * Main.rand.Next(2, 8)); } } if (Main.netMode == NetmodeID.MultiplayerClient) @@ -123,11 +123,11 @@ namespace CalamityMod.Items.Armor } } //On jungle grass, grow jungle flowers - else if (Main.tile[x, y + 1].type == TileID.JungleGrass) + else if (Main.tile[x, y + 1].TileType == TileID.JungleGrass) { tile.active(true); - tile.type = TileID.JunglePlants2; - tile.frameX = (short)(18 * Main.rand.Next(9, 17)); + tile.TileType = TileID.JunglePlants2; + tile.TileFrameX = (short)(18 * Main.rand.Next(9, 17)); if (Main.netMode == NetmodeID.MultiplayerClient) { NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); @@ -139,14 +139,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BeeGreaves); - recipe.AddIngredient(ItemID.FlowerBoots); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BeeGreaves).AddIngredient(ItemID.FlowerBoots).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/PlaguebringerVisor.cs b/Items/Armor/PlaguebringerVisor.cs index d2d3b07e0d..80b36fa454 100644 --- a/Items/Armor/PlaguebringerVisor.cs +++ b/Items/Armor/PlaguebringerVisor.cs @@ -21,17 +21,17 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.defense = 7; // 32 total - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.Calamity().donorItem = true; + Item.width = 18; + Item.height = 18; + Item.defense = 7; // 32 total + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.Calamity().donorItem = true; } public override void UpdateEquip(Player player) { - player.minionDamage += 0.15f; + player.GetDamage(DamageClass.Summon) += 0.15f; player.statLifeMax2 += 20; } @@ -73,13 +73,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BeeHeadgear); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BeeHeadgear).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/PrismaticGreaves.cs b/Items/Armor/PrismaticGreaves.cs index 54bdc0ec59..6481ab6e9e 100644 --- a/Items/Armor/PrismaticGreaves.cs +++ b/Items/Armor/PrismaticGreaves.cs @@ -19,35 +19,28 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.defense = 21; + Item.width = 18; + Item.height = 18; + Item.defense = 21; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().donorItem = true; } public override void UpdateEquip(Player player) { player.Calamity().prismaticGreaves = true; - player.magicDamage += 0.1f; - player.magicCrit += 12; + player.GetDamage(DamageClass.Magic) += 0.1f; + player.GetCritChance(DamageClass.Magic) += 12; player.jumpSpeedBoost += 0.1f; player.allDamage -= 0.2f; - player.magicDamage += 0.2f; + player.GetDamage(DamageClass.Magic) += 0.2f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.Nanites, 300); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.Nanites, 300).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/PrismaticHelmet.cs b/Items/Armor/PrismaticHelmet.cs index c8ccf3336b..ba698bb3dd 100644 --- a/Items/Armor/PrismaticHelmet.cs +++ b/Items/Armor/PrismaticHelmet.cs @@ -20,13 +20,13 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.defense = 18; //71 + Item.width = 18; + Item.height = 18; + Item.defense = 18; //71 - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().donorItem = true; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -57,21 +57,14 @@ namespace CalamityMod.Items.Armor { player.Calamity().prismaticHelmet = true; player.allDamage -= 0.2f; - player.magicDamage += 0.2f; - player.magicDamage += 0.18f; - player.magicCrit += 12; + player.GetDamage(DamageClass.Magic) += 0.2f; + player.GetDamage(DamageClass.Magic) += 0.18f; + player.GetCritChance(DamageClass.Magic) += 12; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Nanites, 300); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Nanites, 300).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/PrismaticRegalia.cs b/Items/Armor/PrismaticRegalia.cs index 524936a095..3ec17d5c30 100644 --- a/Items/Armor/PrismaticRegalia.cs +++ b/Items/Armor/PrismaticRegalia.cs @@ -20,13 +20,13 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.defense = 33; + Item.width = 18; + Item.height = 18; + Item.defense = 33; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().donorItem = true; } public override void UpdateEquip(Player player) @@ -34,22 +34,15 @@ namespace CalamityMod.Items.Armor player.Calamity().prismaticRegalia = true; player.statLifeMax2 += 20; player.statManaMax2 += 40; - player.magicDamage += 0.12f; - player.magicCrit += 15; + player.GetDamage(DamageClass.Magic) += 0.12f; + player.GetCritChance(DamageClass.Magic) += 15; player.allDamage -= 0.2f; - player.magicDamage += 0.2f; + player.GetDamage(DamageClass.Magic) += 0.2f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.Nanites, 300); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.Nanites, 300).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/ReaverCuisses.cs b/Items/Armor/ReaverCuisses.cs index eaf3866f9b..5826b14788 100644 --- a/Items/Armor/ReaverCuisses.cs +++ b/Items/Armor/ReaverCuisses.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 22; - item.height = 18; - item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = ItemRarityID.Lime; - item.defense = 14; + Item.width = 22; + Item.height = 18; + Item.value = Item.buyPrice(0, 18, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.defense = 14; } public override void UpdateEquip(Player player) @@ -32,13 +32,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.JungleSpores, 8); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.JungleSpores, 8).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/ReaverHeadgear.cs b/Items/Armor/ReaverHeadgear.cs index 8b933007f7..a0e78376eb 100644 --- a/Items/Armor/ReaverHeadgear.cs +++ b/Items/Armor/ReaverHeadgear.cs @@ -22,11 +22,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 22; - item.height = 22; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = ItemRarityID.Lime; - item.defense = 7; //40 + Item.width = 22; + Item.height = 22; + Item.value = Item.buyPrice(0, 30, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.defense = 7; //40 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -78,15 +78,15 @@ namespace CalamityMod.Items.Armor { bool shouldSparkle = false; //Check for the money piles - if (Main.tile[i, j].type == TileID.SmallPiles && Main.tile[i, j].frameY == 18) + if (Main.tile[i, j].TileType == TileID.SmallPiles && Main.tile[i, j].TileFrameY == 18) { - if (Main.tile[i, j].frameX >= 576 && Main.tile[i, j].frameX <= 882) + if (Main.tile[i, j].TileFrameX >= 576 && Main.tile[i, j].TileFrameX <= 882) shouldSparkle = true; } - else if (Main.tile[i, j].type == TileID.LargePiles && Main.tile[i, j].frameX >= 864 && Main.tile[i, j].frameX <= 1170) + else if (Main.tile[i, j].TileType == TileID.LargePiles && Main.tile[i, j].TileFrameX >= 864 && Main.tile[i, j].TileFrameX <= 1170) shouldSparkle = true; - if (shouldSparkle || Main.tileSpelunker[Main.tile[i, j].type] || Main.tileAlch[Main.tile[i, j].type] && Main.tile[i, j].type != TileID.ImmatureHerbs) + if (shouldSparkle || Main.tileSpelunker[Main.tile[i, j].TileType] || Main.tileAlch[Main.tile[i, j].TileType] && Main.tile[i, j].TileType != TileID.ImmatureHerbs) { int sparkle = Dust.NewDust(new Vector2((float)(i * 16), (float)(j * 16)), 16, 16, 204, 0f, 0f, 150, new Color(), 0.3f); Dust dust = Main.dust[sparkle]; @@ -111,13 +111,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.JungleSpores, 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.JungleSpores, 4).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/ReaverHelm.cs b/Items/Armor/ReaverHelm.cs index 977646eaa4..c62d4f5e75 100644 --- a/Items/Armor/ReaverHelm.cs +++ b/Items/Armor/ReaverHelm.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 28; - item.height = 30; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = ItemRarityID.Lime; - item.defense = 30; //63 => 73 w/ set bonus (+5 w/ Reaver Rage) + Item.width = 28; + Item.height = 30; + Item.value = Item.buyPrice(0, 30, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.defense = 30; //63 => 73 w/ set bonus (+5 w/ Reaver Rage) } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -68,13 +68,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.JungleSpores, 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.JungleSpores, 4).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/ReaverScaleMail.cs b/Items/Armor/ReaverScaleMail.cs index 93247c4be5..f5d08c1d55 100644 --- a/Items/Armor/ReaverScaleMail.cs +++ b/Items/Armor/ReaverScaleMail.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 34; - item.height = 22; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = ItemRarityID.Lime; - item.defense = 19; + Item.width = 34; + Item.height = 22; + Item.value = Item.buyPrice(0, 24, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.defense = 19; } public override void UpdateEquip(Player player) @@ -33,13 +33,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.JungleSpores, 12); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.JungleSpores, 12).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/ReaverVisage.cs b/Items/Armor/ReaverVisage.cs index 67e29fd5be..6920ffa27d 100644 --- a/Items/Armor/ReaverVisage.cs +++ b/Items/Armor/ReaverVisage.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 24; - item.height = 28; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = ItemRarityID.Lime; - item.defense = 13; //46 + Item.width = 24; + Item.height = 28; + Item.value = Item.buyPrice(0, 30, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.defense = 13; //46 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -59,13 +59,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.JungleSpores, 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.JungleSpores, 4).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/ShroomiteVisage.cs b/Items/Armor/ShroomiteVisage.cs index 38615b2a56..9c61781c4c 100644 --- a/Items/Armor/ShroomiteVisage.cs +++ b/Items/Armor/ShroomiteVisage.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 24; - item.height = 20; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = ItemRarityID.Yellow; - item.defense = 11; //62 + Item.width = 24; + Item.height = 20; + Item.value = Item.buyPrice(0, 30, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.defense = 11; //62 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -43,11 +43,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ShroomiteBar, 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ShroomiteBar, 12).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/SilvaArmor.cs b/Items/Armor/SilvaArmor.cs index 27e04c2218..607d5a4ff0 100644 --- a/Items/Armor/SilvaArmor.cs +++ b/Items/Armor/SilvaArmor.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 34; - item.height = 24; - item.value = Item.buyPrice(0, 72, 0, 0); - item.defense = 44; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 34; + Item.height = 24; + Item.value = Item.buyPrice(0, 72, 0, 0); + Item.defense = 44; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateEquip(Player player) @@ -36,14 +36,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddRecipeGroup("AnyGoldBar", 10); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddRecipeGroup("AnyGoldBar", 10).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/SilvaHelmet.cs b/Items/Armor/SilvaHelmet.cs index b0ce2e6a36..7772c4bcfc 100644 --- a/Items/Armor/SilvaHelmet.cs +++ b/Items/Armor/SilvaHelmet.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 28; - item.height = 24; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 13; //110 - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 28; + Item.height = 24; + Item.value = Item.buyPrice(0, 90, 0, 0); + Item.defense = 13; //110 + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -62,22 +62,15 @@ namespace CalamityMod.Items.Armor Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(600f * player.MinionDamage()), 0f, Main.myPlayer, -20f, 0f); } } - player.minionDamage += 0.65f; + player.GetDamage(DamageClass.Summon) += 0.65f; player.maxMinions += 5; } - public override void UpdateEquip(Player player) => player.minionDamage += 0.1f; + public override void UpdateEquip(Player player) => player.GetDamage(DamageClass.Summon) += 0.1f; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddRecipeGroup("AnyGoldBar", 5); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddRecipeGroup("AnyGoldBar", 5).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/SilvaLeggings.cs b/Items/Armor/SilvaLeggings.cs index 14479fc1db..f5fcccc96e 100644 --- a/Items/Armor/SilvaLeggings.cs +++ b/Items/Armor/SilvaLeggings.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 22; - item.height = 18; - item.value = Item.buyPrice(0, 54, 0, 0); - item.defense = 39; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 22; + Item.height = 18; + Item.value = Item.buyPrice(0, 54, 0, 0); + Item.defense = 39; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateEquip(Player player) @@ -36,14 +36,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddRecipeGroup("AnyGoldBar", 7); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddRecipeGroup("AnyGoldBar", 7).AddIngredient(ModContent.ItemType(), 9).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/SilvaMaskedCap.cs b/Items/Armor/SilvaMaskedCap.cs index 3090832094..16199c07e3 100644 --- a/Items/Armor/SilvaMaskedCap.cs +++ b/Items/Armor/SilvaMaskedCap.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 24; - item.height = 22; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 21; //110 - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 24; + Item.height = 22; + Item.value = Item.buyPrice(0, 90, 0, 0); + Item.defense = 21; //110 + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -53,21 +53,14 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.manaCost *= 0.81f; - player.magicDamage += 0.23f; - player.magicCrit += 13; + player.GetDamage(DamageClass.Magic) += 0.23f; + player.GetCritChance(DamageClass.Magic) += 13; player.statManaMax2 += 100; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddRecipeGroup("AnyGoldBar", 5); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddRecipeGroup("AnyGoldBar", 5).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/SnowRuffianChestplate.cs b/Items/Armor/SnowRuffianChestplate.cs index b08954ed54..3637fe19ee 100644 --- a/Items/Armor/SnowRuffianChestplate.cs +++ b/Items/Armor/SnowRuffianChestplate.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = ItemRarityID.Blue; - item.defense = 2; //4 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 0, 75, 0); + Item.rare = ItemRarityID.Blue; + Item.defense = 2; //4 } public override void UpdateEquip(Player player) @@ -29,13 +29,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnySnowBlock", 30); - recipe.AddRecipeGroup("AnyIceBlock", 15); - recipe.AddIngredient(ItemID.BorealWood, 45); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnySnowBlock", 30).AddRecipeGroup("AnyIceBlock", 15).AddIngredient(ItemID.BorealWood, 45).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/SnowRuffianGreaves.cs b/Items/Armor/SnowRuffianGreaves.cs index c826282d57..397599079c 100644 --- a/Items/Armor/SnowRuffianGreaves.cs +++ b/Items/Armor/SnowRuffianGreaves.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = ItemRarityID.Blue; - item.defense = 1; //4 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 0, 75, 0); + Item.rare = ItemRarityID.Blue; + Item.defense = 1; //4 } public override void UpdateEquip(Player player) @@ -29,13 +29,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnySnowBlock", 20); - recipe.AddRecipeGroup("AnyIceBlock", 10); - recipe.AddIngredient(ItemID.BorealWood, 30); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnySnowBlock", 20).AddRecipeGroup("AnyIceBlock", 10).AddIngredient(ItemID.BorealWood, 30).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/SnowRuffianMask.cs b/Items/Armor/SnowRuffianMask.cs index 9461de6580..0bbd95036e 100644 --- a/Items/Armor/SnowRuffianMask.cs +++ b/Items/Armor/SnowRuffianMask.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = ItemRarityID.Blue; - item.defense = 1; //4 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 0, 75, 0); + Item.rare = ItemRarityID.Blue; + Item.defense = 1; //4 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -67,13 +67,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnySnowBlock", 10); - recipe.AddRecipeGroup("AnyIceBlock", 5); - recipe.AddIngredient(ItemID.BorealWood, 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnySnowBlock", 10).AddRecipeGroup("AnyIceBlock", 5).AddIngredient(ItemID.BorealWood, 15).AddTile(TileID.Anvils).Register(); } } public class SnowRuffianWings : EquipTexture diff --git a/Items/Armor/StatigelArmor.cs b/Items/Armor/StatigelArmor.cs index ccc4414e4f..3c463a663b 100644 --- a/Items/Armor/StatigelArmor.cs +++ b/Items/Armor/StatigelArmor.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.LightRed; - item.defense = 10; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.defense = 10; } public override void UpdateEquip(Player player) @@ -31,12 +31,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.HellstoneBar, 13); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.HellstoneBar, 13).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/StatigelCap.cs b/Items/Armor/StatigelCap.cs index 3ce2c05c7c..7216aea57f 100644 --- a/Items/Armor/StatigelCap.cs +++ b/Items/Armor/StatigelCap.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = ItemRarityID.LightRed; - item.defense = 5; //22 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.defense = 5; //22 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -45,20 +45,15 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.magicDamage += 0.1f; - player.magicCrit += 7; + player.GetDamage(DamageClass.Magic) += 0.1f; + player.GetCritChance(DamageClass.Magic) += 7; player.manaCost *= 0.9f; player.statManaMax2 += 30; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.HellstoneBar, 9).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/StatigelGreaves.cs b/Items/Armor/StatigelGreaves.cs index 7b6f83532a..9f0c80966c 100644 --- a/Items/Armor/StatigelGreaves.cs +++ b/Items/Armor/StatigelGreaves.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = ItemRarityID.LightRed; - item.defense = 8; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 3, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.defense = 8; } public override void UpdateEquip(Player player) @@ -32,12 +32,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.HellstoneBar, 11); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.HellstoneBar, 11).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/StatigelHeadgear.cs b/Items/Armor/StatigelHeadgear.cs index a582051763..f466b434fd 100644 --- a/Items/Armor/StatigelHeadgear.cs +++ b/Items/Armor/StatigelHeadgear.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = ItemRarityID.LightRed; - item.defense = 7; //25 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.defense = 7; //25 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -45,18 +45,13 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.rangedDamage += 0.1f; - player.rangedCrit += 7; + player.GetDamage(DamageClass.Ranged) += 0.1f; + player.GetCritChance(DamageClass.Ranged) += 7; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.HellstoneBar, 9).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/StatigelHelm.cs b/Items/Armor/StatigelHelm.cs index 26d60bde8d..b2285eaa26 100644 --- a/Items/Armor/StatigelHelm.cs +++ b/Items/Armor/StatigelHelm.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = ItemRarityID.LightRed; - item.defense = 9; //27 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.defense = 9; //27 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -47,19 +47,14 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.meleeDamage += 0.1f; - player.meleeCrit += 7; + player.GetDamage(DamageClass.Melee) += 0.1f; + player.GetCritChance(DamageClass.Melee) += 7; player.meleeSpeed += 0.1f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.HellstoneBar, 9).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/StatigelHood.cs b/Items/Armor/StatigelHood.cs index f43d33fbdc..0fb0aa570d 100644 --- a/Items/Armor/StatigelHood.cs +++ b/Items/Armor/StatigelHood.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = ItemRarityID.LightRed; - item.defense = 4; //20 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.defense = 4; //20 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Armor modPlayer.statigelJump = true; Player.jumpHeight += 5; player.jumpSpeedBoost += 0.6f; - player.minionDamage += 0.18f; + player.GetDamage(DamageClass.Summon) += 0.18f; player.maxMinions++; if (player.whoAmI == Main.myPlayer) { @@ -55,11 +55,11 @@ namespace CalamityMod.Items.Armor } if (WorldGen.crimson && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(33f * (player.allDamage + player.minionDamage - 1f)), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(33f * (player.allDamage + player.GetDamage(DamageClass.Summon) - 1f)), 0f, Main.myPlayer, 0f, 0f); } else if (!WorldGen.crimson && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(33f * (player.allDamage + player.minionDamage - 1f)), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(33f * (player.allDamage + player.GetDamage(DamageClass.Summon) - 1f)), 0f, Main.myPlayer, 0f, 0f); } } } @@ -71,12 +71,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.HellstoneBar, 9).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/StatigelMask.cs b/Items/Armor/StatigelMask.cs index 6f7b7a1813..efc63a72b8 100644 --- a/Items/Armor/StatigelMask.cs +++ b/Items/Armor/StatigelMask.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = ItemRarityID.LightRed; - item.defense = 6; //23 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.defense = 6; //23 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -59,12 +59,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.HellstoneBar, 9).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Armor/SulfurBreastplate.cs b/Items/Armor/SulfurBreastplate.cs index d2717eccfe..2854724fa5 100644 --- a/Items/Armor/SulfurBreastplate.cs +++ b/Items/Armor/SulfurBreastplate.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 24; - item.height = 20; - item.value = Item.buyPrice(0, 1, 15, 0); - item.defense = 6; - item.rare = ItemRarityID.Green; + Item.width = 24; + Item.height = 20; + Item.value = Item.buyPrice(0, 1, 15, 0); + Item.defense = 6; + Item.rare = ItemRarityID.Green; } public override void UpdateEquip(Player player) @@ -33,15 +33,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 20); - - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 50).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/SulfurHelmet.cs b/Items/Armor/SulfurHelmet.cs index 2c18bd8e51..91d09f8a0f 100644 --- a/Items/Armor/SulfurHelmet.cs +++ b/Items/Armor/SulfurHelmet.cs @@ -21,11 +21,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Green; - item.defense = 5; + Item.width = 26; + Item.height = 26; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Green; + Item.defense = 5; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -59,15 +59,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/SulfurLeggings.cs b/Items/Armor/SulfurLeggings.cs index 981dfb8b9e..1eee6df267 100644 --- a/Items/Armor/SulfurLeggings.cs +++ b/Items/Armor/SulfurLeggings.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 22; - item.height = 16; - item.value = Item.buyPrice(0, 1, 0, 0); - item.defense = 5; - item.rare = ItemRarityID.Green; + Item.width = 22; + Item.height = 16; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.defense = 5; + Item.rare = ItemRarityID.Green; } public override void UpdateEquip(Player player) @@ -33,15 +33,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); - - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 30).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/TarragonBreastplate.cs b/Items/Armor/TarragonBreastplate.cs index 6a0d3b7278..198558242c 100644 --- a/Items/Armor/TarragonBreastplate.cs +++ b/Items/Armor/TarragonBreastplate.cs @@ -18,12 +18,12 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.lifeRegen = 2; - item.value = Item.buyPrice(0, 40, 0, 0); - item.defense = 37; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 18; + Item.height = 18; + Item.lifeRegen = 2; + Item.value = Item.buyPrice(0, 40, 0, 0); + Item.defense = 37; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void UpdateEquip(Player player) @@ -35,12 +35,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 18).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/TarragonHelm.cs b/Items/Armor/TarragonHelm.cs index b42529a8e3..804ec29872 100644 --- a/Items/Armor/TarragonHelm.cs +++ b/Items/Armor/TarragonHelm.cs @@ -21,11 +21,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 33; //98 - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 50, 0, 0); + Item.defense = 33; //98 + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -56,8 +56,8 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.meleeDamage += 0.1f; - player.meleeCrit += 10; + player.GetDamage(DamageClass.Melee) += 0.1f; + player.GetCritChance(DamageClass.Melee) += 10; player.endurance += 0.05f; player.lavaMax += 240; player.ignoreWater = true; @@ -65,12 +65,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/TarragonHelmet.cs b/Items/Armor/TarragonHelmet.cs index 83ceeca2a9..96245486f8 100644 --- a/Items/Armor/TarragonHelmet.cs +++ b/Items/Armor/TarragonHelmet.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 15; //98 - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 50, 0, 0); + Item.defense = 15; //98 + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -69,12 +69,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/TarragonHornedHelm.cs b/Items/Armor/TarragonHornedHelm.cs index 748aea4eea..2d232174c8 100644 --- a/Items/Armor/TarragonHornedHelm.cs +++ b/Items/Armor/TarragonHornedHelm.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 3; //98 - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 50, 0, 0); + Item.defense = 3; //98 + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -48,26 +48,21 @@ namespace CalamityMod.Items.Armor "Increased heart pickup range\n" + "Enemies have a chance to drop extra hearts on death\n" + "Summons a life aura around you that damages nearby enemies"; - player.minionDamage += 0.5f; + player.GetDamage(DamageClass.Summon) += 0.5f; player.maxMinions += 3; } public override void UpdateEquip(Player player) { player.endurance += 0.05f; - player.minionDamage += 0.05f; + player.GetDamage(DamageClass.Summon) += 0.05f; player.lavaMax += 240; player.ignoreWater = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/TarragonLeggings.cs b/Items/Armor/TarragonLeggings.cs index 600a886823..806e056abb 100644 --- a/Items/Armor/TarragonLeggings.cs +++ b/Items/Armor/TarragonLeggings.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.defense = 32; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 30, 0, 0); + Item.defense = 32; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void UpdateEquip(Player player) @@ -34,12 +34,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 11); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 11).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/TarragonMask.cs b/Items/Armor/TarragonMask.cs index 7871f2d7b5..dc00aa9649 100644 --- a/Items/Armor/TarragonMask.cs +++ b/Items/Armor/TarragonMask.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 10; //98 - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 50, 0, 0); + Item.defense = 10; //98 + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -54,8 +54,8 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.manaCost *= 0.85f; - player.magicDamage += 0.2f; - player.magicCrit += 10; + player.GetDamage(DamageClass.Magic) += 0.2f; + player.GetCritChance(DamageClass.Magic) += 10; player.endurance += 0.05f; player.lavaMax += 240; player.statManaMax2 += 100; @@ -64,12 +64,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/TarragonVisage.cs b/Items/Armor/TarragonVisage.cs index dce042d8c8..87a173f1cc 100644 --- a/Items/Armor/TarragonVisage.cs +++ b/Items/Armor/TarragonVisage.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 21; //98 - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 50, 0, 0); + Item.defense = 21; //98 + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -51,8 +51,8 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.rangedDamage += 0.1f; - player.rangedCrit += 10; + player.GetDamage(DamageClass.Ranged) += 0.1f; + player.GetCritChance(DamageClass.Ranged) += 10; player.endurance += 0.05f; player.lavaMax += 240; player.ignoreWater = true; @@ -60,12 +60,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/TitanHeartBoots.cs b/Items/Armor/TitanHeartBoots.cs index b09cb2a9f3..eeeb0b288f 100644 --- a/Items/Armor/TitanHeartBoots.cs +++ b/Items/Armor/TitanHeartBoots.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.defense = 14; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.defense = 14; } public override void UpdateEquip(Player player) @@ -33,12 +33,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/TitanHeartMantle.cs b/Items/Armor/TitanHeartMantle.cs index bc090360ac..8123f36237 100644 --- a/Items/Armor/TitanHeartMantle.cs +++ b/Items/Armor/TitanHeartMantle.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.defense = 17; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.defense = 17; } public override void UpdateEquip(Player player) @@ -34,12 +34,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/TitanHeartMask.cs b/Items/Armor/TitanHeartMask.cs index 66c3424c64..bfbe3a1413 100644 --- a/Items/Armor/TitanHeartMask.cs +++ b/Items/Armor/TitanHeartMask.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.defense = 12; //43 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.defense = 12; //43 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -57,12 +57,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/UmbraphileBoots.cs b/Items/Armor/UmbraphileBoots.cs index 86cdea58ee..6a484d9710 100644 --- a/Items/Armor/UmbraphileBoots.cs +++ b/Items/Armor/UmbraphileBoots.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 22; - item.height = 18; - item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = ItemRarityID.Lime; - item.defense = 12; + Item.width = 22; + Item.height = 18; + Item.value = Item.buyPrice(0, 18, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.defense = 12; } public override void UpdateEquip(Player player) @@ -33,12 +33,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ItemID.HallowedBar, 11); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddIngredient(ItemID.HallowedBar, 11).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/UmbraphileHood.cs b/Items/Armor/UmbraphileHood.cs index bfe13744ea..3fe8c4a935 100644 --- a/Items/Armor/UmbraphileHood.cs +++ b/Items/Armor/UmbraphileHood.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 22; - item.height = 20; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = ItemRarityID.Lime; - item.defense = 8; //36 + Item.width = 22; + Item.height = 20; + Item.value = Item.buyPrice(0, 30, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.defense = 8; //36 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -57,12 +57,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ItemID.HallowedBar, 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ItemID.HallowedBar, 8).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/UmbraphileRegalia.cs b/Items/Armor/UmbraphileRegalia.cs index b882f73bb3..34c71d1495 100644 --- a/Items/Armor/UmbraphileRegalia.cs +++ b/Items/Armor/UmbraphileRegalia.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 38; - item.height = 24; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = ItemRarityID.Lime; - item.defense = 16; + Item.width = 38; + Item.height = 24; + Item.value = Item.buyPrice(0, 24, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.defense = 16; } public override void UpdateEquip(Player player) @@ -31,12 +31,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ItemID.HallowedBar, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ItemID.HallowedBar, 15).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Armor/Vanity/AnahitaMask.cs b/Items/Armor/Vanity/AnahitaMask.cs index edc4569ad4..a3af312ceb 100644 --- a/Items/Armor/Vanity/AnahitaMask.cs +++ b/Items/Armor/Vanity/AnahitaMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() => false; diff --git a/Items/Armor/Vanity/AncientGodSlayerChestplate.cs b/Items/Armor/Vanity/AncientGodSlayerChestplate.cs index c1f2a160e7..4b4d0fff84 100644 --- a/Items/Armor/Vanity/AncientGodSlayerChestplate.cs +++ b/Items/Armor/Vanity/AncientGodSlayerChestplate.cs @@ -12,11 +12,11 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.Calamity().customRarity = (CalamityRarity)14; - item.vanity = true; - item.value = Item.buyPrice(0, 60, 0, 0); + Item.width = 28; + Item.height = 20; + Item.Calamity().customRarity = (CalamityRarity)14; + Item.vanity = true; + Item.value = Item.buyPrice(0, 60, 0, 0); } } } diff --git a/Items/Armor/Vanity/AncientGodSlayerHelm.cs b/Items/Armor/Vanity/AncientGodSlayerHelm.cs index c2991de7a5..d14002487f 100644 --- a/Items/Armor/Vanity/AncientGodSlayerHelm.cs +++ b/Items/Armor/Vanity/AncientGodSlayerHelm.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.Calamity().customRarity = (CalamityRarity)14; - item.value = Item.buyPrice(0, 75, 0, 0); - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.Calamity().customRarity = (CalamityRarity)14; + Item.value = Item.buyPrice(0, 75, 0, 0); + Item.vanity = true; } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/AncientGodSlayerLeggings.cs b/Items/Armor/Vanity/AncientGodSlayerLeggings.cs index 7058688781..aa85f472fd 100644 --- a/Items/Armor/Vanity/AncientGodSlayerLeggings.cs +++ b/Items/Armor/Vanity/AncientGodSlayerLeggings.cs @@ -12,11 +12,11 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.Calamity().customRarity = (CalamityRarity)14; - item.value = Item.buyPrice(0, 45, 0, 0); - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.Calamity().customRarity = (CalamityRarity)14; + Item.value = Item.buyPrice(0, 45, 0, 0); + Item.vanity = true; } } } diff --git a/Items/Armor/Vanity/ApolloMask.cs b/Items/Armor/Vanity/ApolloMask.cs index dd6d439108..1ccf18298c 100644 --- a/Items/Armor/Vanity/ApolloMask.cs +++ b/Items/Armor/Vanity/ApolloMask.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() => false; diff --git a/Items/Armor/Vanity/ApronOfAffection.cs b/Items/Armor/Vanity/ApronOfAffection.cs index 618659cf46..0d9fe4de26 100644 --- a/Items/Armor/Vanity/ApronOfAffection.cs +++ b/Items/Armor/Vanity/ApronOfAffection.cs @@ -15,25 +15,19 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 18; - item.height = 18; + Item.width = 18; + Item.height = 18; - item.value = Item.sellPrice(gold: 2); - item.rare = ItemRarityID.Blue; - item.Calamity().donorItem = true; + Item.value = Item.sellPrice(gold: 2); + Item.rare = ItemRarityID.Blue; + Item.Calamity().donorItem = true; - item.vanity = true; + Item.vanity = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Robe); - recipe.AddIngredient(ItemID.LovePotion, 10); - recipe.AddIngredient(ItemID.LifeCrystal); - recipe.AddTile(TileID.Loom); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Robe).AddIngredient(ItemID.LovePotion, 10).AddIngredient(ItemID.LifeCrystal).AddTile(TileID.Loom).Register(); } } } diff --git a/Items/Armor/Vanity/AquaticScourgeMask.cs b/Items/Armor/Vanity/AquaticScourgeMask.cs index c7b6839d0b..20b97c9cc0 100644 --- a/Items/Armor/Vanity/AquaticScourgeMask.cs +++ b/Items/Armor/Vanity/AquaticScourgeMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/AresMask.cs b/Items/Armor/Vanity/AresMask.cs index c840da136f..96ea3e98b2 100644 --- a/Items/Armor/Vanity/AresMask.cs +++ b/Items/Armor/Vanity/AresMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() => false; diff --git a/Items/Armor/Vanity/ArtemisMask.cs b/Items/Armor/Vanity/ArtemisMask.cs index 4215c99c55..e01d1d6f9c 100644 --- a/Items/Armor/Vanity/ArtemisMask.cs +++ b/Items/Armor/Vanity/ArtemisMask.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() => false; diff --git a/Items/Armor/Vanity/AshenHorns.cs b/Items/Armor/Vanity/AshenHorns.cs index ef4b0359fe..5a1add88b3 100644 --- a/Items/Armor/Vanity/AshenHorns.cs +++ b/Items/Armor/Vanity/AshenHorns.cs @@ -10,10 +10,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override void DrawHair(ref bool drawHair, ref bool drawAltHair) diff --git a/Items/Armor/Vanity/AstrumDeusMask.cs b/Items/Armor/Vanity/AstrumDeusMask.cs index e0d8a13632..84112ce1f4 100644 --- a/Items/Armor/Vanity/AstrumDeusMask.cs +++ b/Items/Armor/Vanity/AstrumDeusMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/AureusMask.cs b/Items/Armor/Vanity/AureusMask.cs index 47b8e9e753..5852d6fa80 100644 --- a/Items/Armor/Vanity/AureusMask.cs +++ b/Items/Armor/Vanity/AureusMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 30; - item.height = 28; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 30; + Item.height = 28; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/BrimstoneWaifuMask.cs b/Items/Armor/Vanity/BrimstoneWaifuMask.cs index dd0ddbb7af..84a2252fae 100644 --- a/Items/Armor/Vanity/BrimstoneWaifuMask.cs +++ b/Items/Armor/Vanity/BrimstoneWaifuMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 30; - item.height = 28; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 30; + Item.height = 28; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/BumblefuckMask.cs b/Items/Armor/Vanity/BumblefuckMask.cs index a970d4a275..3fa758b310 100644 --- a/Items/Armor/Vanity/BumblefuckMask.cs +++ b/Items/Armor/Vanity/BumblefuckMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/CalamitasMask.cs b/Items/Armor/Vanity/CalamitasMask.cs index 36e0471e94..4af7858507 100644 --- a/Items/Armor/Vanity/CalamitasMask.cs +++ b/Items/Armor/Vanity/CalamitasMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/CalamityHood.cs b/Items/Armor/Vanity/CalamityHood.cs index 1f1a28f7c1..6008a43799 100644 --- a/Items/Armor/Vanity/CalamityHood.cs +++ b/Items/Armor/Vanity/CalamityHood.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 26; - item.height = 24; - item.rare = ItemRarityID.Lime; - item.vanity = true; - item.Calamity().donorItem = true; - item.value = Item.sellPrice(gold: 2); + Item.width = 26; + Item.height = 24; + Item.rare = ItemRarityID.Lime; + Item.vanity = true; + Item.Calamity().donorItem = true; + Item.value = Item.sellPrice(gold: 2); } public override bool DrawHead() => false; diff --git a/Items/Armor/Vanity/CalamityRobes.cs b/Items/Armor/Vanity/CalamityRobes.cs index 48234d602d..3e1f43940d 100644 --- a/Items/Armor/Vanity/CalamityRobes.cs +++ b/Items/Armor/Vanity/CalamityRobes.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 26; - item.height = 20; - item.rare = ItemRarityID.Lime; - item.vanity = true; - item.Calamity().donorItem = true; - item.value = Item.sellPrice(gold: 2); + Item.width = 26; + Item.height = 20; + Item.rare = ItemRarityID.Lime; + Item.vanity = true; + Item.Calamity().donorItem = true; + Item.value = Item.sellPrice(gold: 2); } } } diff --git a/Items/Armor/Vanity/CeaselessVoidMask.cs b/Items/Armor/Vanity/CeaselessVoidMask.cs index a1264918db..90f0b28cac 100644 --- a/Items/Armor/Vanity/CeaselessVoidMask.cs +++ b/Items/Armor/Vanity/CeaselessVoidMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/CrabulonMask.cs b/Items/Armor/Vanity/CrabulonMask.cs index ea5c626239..e5079c3f45 100644 --- a/Items/Armor/Vanity/CrabulonMask.cs +++ b/Items/Armor/Vanity/CrabulonMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/CryogenMask.cs b/Items/Armor/Vanity/CryogenMask.cs index 9ecae4a9e6..adc5f6da7f 100644 --- a/Items/Armor/Vanity/CryogenMask.cs +++ b/Items/Armor/Vanity/CryogenMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/DesertScourgeMask.cs b/Items/Armor/Vanity/DesertScourgeMask.cs index 7edd4ed383..e51a7a2a3b 100644 --- a/Items/Armor/Vanity/DesertScourgeMask.cs +++ b/Items/Armor/Vanity/DesertScourgeMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/DevourerofGodsMask.cs b/Items/Armor/Vanity/DevourerofGodsMask.cs index f453926bb1..42cb8cb13b 100644 --- a/Items/Armor/Vanity/DevourerofGodsMask.cs +++ b/Items/Armor/Vanity/DevourerofGodsMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/DraedonMask.cs b/Items/Armor/Vanity/DraedonMask.cs index f876103d53..297cb92492 100644 --- a/Items/Armor/Vanity/DraedonMask.cs +++ b/Items/Armor/Vanity/DraedonMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() => false; diff --git a/Items/Armor/Vanity/GodSlayerHornedHelm.cs b/Items/Armor/Vanity/GodSlayerHornedHelm.cs index 8a38c44670..10105511e3 100644 --- a/Items/Armor/Vanity/GodSlayerHornedHelm.cs +++ b/Items/Armor/Vanity/GodSlayerHornedHelm.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 8, 0, 0); - item.vanity = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 8, 0, 0); + Item.vanity = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/GodSlayerVisage.cs b/Items/Armor/Vanity/GodSlayerVisage.cs index 4bbf59bbbf..697f16fced 100644 --- a/Items/Armor/Vanity/GodSlayerVisage.cs +++ b/Items/Armor/Vanity/GodSlayerVisage.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 8, 0, 0); - item.vanity = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 8, 0, 0); + Item.vanity = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/HiveMindMask.cs b/Items/Armor/Vanity/HiveMindMask.cs index cb228538d6..c1a88756b7 100644 --- a/Items/Armor/Vanity/HiveMindMask.cs +++ b/Items/Armor/Vanity/HiveMindMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/LeviathanMask.cs b/Items/Armor/Vanity/LeviathanMask.cs index 91f478362e..1265933268 100644 --- a/Items/Armor/Vanity/LeviathanMask.cs +++ b/Items/Armor/Vanity/LeviathanMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/OldDukeMask.cs b/Items/Armor/Vanity/OldDukeMask.cs index c28b303826..121876658b 100644 --- a/Items/Armor/Vanity/OldDukeMask.cs +++ b/Items/Armor/Vanity/OldDukeMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/PerforatorMask.cs b/Items/Armor/Vanity/PerforatorMask.cs index c8fbc3da6c..8301264525 100644 --- a/Items/Armor/Vanity/PerforatorMask.cs +++ b/Items/Armor/Vanity/PerforatorMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/PlaguebringerGoliathMask.cs b/Items/Armor/Vanity/PlaguebringerGoliathMask.cs index eae2440ad2..fd654ccb67 100644 --- a/Items/Armor/Vanity/PlaguebringerGoliathMask.cs +++ b/Items/Armor/Vanity/PlaguebringerGoliathMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/PolterghastMask.cs b/Items/Armor/Vanity/PolterghastMask.cs index b09662d202..d87302c8d7 100644 --- a/Items/Armor/Vanity/PolterghastMask.cs +++ b/Items/Armor/Vanity/PolterghastMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/ProfanedGuardianMask.cs b/Items/Armor/Vanity/ProfanedGuardianMask.cs index 9c6a2f2d00..76d3fe9082 100644 --- a/Items/Armor/Vanity/ProfanedGuardianMask.cs +++ b/Items/Armor/Vanity/ProfanedGuardianMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/ProvidenceMask.cs b/Items/Armor/Vanity/ProvidenceMask.cs index ba1350ea7a..3875cbf79f 100644 --- a/Items/Armor/Vanity/ProvidenceMask.cs +++ b/Items/Armor/Vanity/ProvidenceMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/RavagerMask.cs b/Items/Armor/Vanity/RavagerMask.cs index 02f0e71a0b..258fbccc06 100644 --- a/Items/Armor/Vanity/RavagerMask.cs +++ b/Items/Armor/Vanity/RavagerMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/SCalBoots.cs b/Items/Armor/Vanity/SCalBoots.cs index 5557bb0bdc..be94e6bf82 100644 --- a/Items/Armor/Vanity/SCalBoots.cs +++ b/Items/Armor/Vanity/SCalBoots.cs @@ -10,10 +10,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } } } diff --git a/Items/Armor/Vanity/SCalMask.cs b/Items/Armor/Vanity/SCalMask.cs index b5776465da..e5fa85a364 100644 --- a/Items/Armor/Vanity/SCalMask.cs +++ b/Items/Armor/Vanity/SCalMask.cs @@ -10,10 +10,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() => false; diff --git a/Items/Armor/Vanity/SCalRobes.cs b/Items/Armor/Vanity/SCalRobes.cs index 912ca647e9..7aede2c60e 100644 --- a/Items/Armor/Vanity/SCalRobes.cs +++ b/Items/Armor/Vanity/SCalRobes.cs @@ -10,10 +10,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } } } diff --git a/Items/Armor/Vanity/SignusMask.cs b/Items/Armor/Vanity/SignusMask.cs index e7c7ceca71..95d2655878 100644 --- a/Items/Armor/Vanity/SignusMask.cs +++ b/Items/Armor/Vanity/SignusMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/SilvaHelm.cs b/Items/Armor/Vanity/SilvaHelm.cs index ba566100d9..7b5c46e253 100644 --- a/Items/Armor/Vanity/SilvaHelm.cs +++ b/Items/Armor/Vanity/SilvaHelm.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 24; - item.height = 20; - item.value = Item.buyPrice(0, 8, 0, 0); - item.vanity = true; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 24; + Item.height = 20; + Item.value = Item.buyPrice(0, 8, 0, 0); + Item.vanity = true; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/SilvaHornedHelm.cs b/Items/Armor/Vanity/SilvaHornedHelm.cs index 1603cf3c9a..c7d8330ddf 100644 --- a/Items/Armor/Vanity/SilvaHornedHelm.cs +++ b/Items/Armor/Vanity/SilvaHornedHelm.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 26; - item.height = 24; - item.value = Item.buyPrice(0, 8, 0, 0); - item.vanity = true; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 26; + Item.height = 24; + Item.value = Item.buyPrice(0, 8, 0, 0); + Item.vanity = true; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/SilvaMask.cs b/Items/Armor/Vanity/SilvaMask.cs index 471d5cd418..ab797e2133 100644 --- a/Items/Armor/Vanity/SilvaMask.cs +++ b/Items/Armor/Vanity/SilvaMask.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 24; - item.height = 26; - item.value = Item.buyPrice(0, 8, 0, 0); - item.vanity = true; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 24; + Item.height = 26; + Item.value = Item.buyPrice(0, 8, 0, 0); + Item.vanity = true; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/SlimeGodMask.cs b/Items/Armor/Vanity/SlimeGodMask.cs index f61e00dc66..1a26223632 100644 --- a/Items/Armor/Vanity/SlimeGodMask.cs +++ b/Items/Armor/Vanity/SlimeGodMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/SlimeGodMask2.cs b/Items/Armor/Vanity/SlimeGodMask2.cs index a9479de988..597a049903 100644 --- a/Items/Armor/Vanity/SlimeGodMask2.cs +++ b/Items/Armor/Vanity/SlimeGodMask2.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/StormWeaverMask.cs b/Items/Armor/Vanity/StormWeaverMask.cs index d0480e7bdc..6de0a0b05d 100644 --- a/Items/Armor/Vanity/StormWeaverMask.cs +++ b/Items/Armor/Vanity/StormWeaverMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/Vanity/ThanatosMask.cs b/Items/Armor/Vanity/ThanatosMask.cs index 6a75359647..e7c6ed0905 100644 --- a/Items/Armor/Vanity/ThanatosMask.cs +++ b/Items/Armor/Vanity/ThanatosMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() => false; diff --git a/Items/Armor/Vanity/YharonMask.cs b/Items/Armor/Vanity/YharonMask.cs index 03b3d8e90a..05e7a3c5f5 100644 --- a/Items/Armor/Vanity/YharonMask.cs +++ b/Items/Armor/Vanity/YharonMask.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.vanity = true; + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; } public override bool DrawHead() diff --git a/Items/Armor/VictideBreastplate.cs b/Items/Armor/VictideBreastplate.cs index ac416cfe2e..112b259409 100644 --- a/Items/Armor/VictideBreastplate.cs +++ b/Items/Armor/VictideBreastplate.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Green; - item.defense = 5; //9 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Green; + Item.defense = 5; //9 } public override void UpdateEquip(Player player) @@ -37,11 +37,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/VictideHeadgear.cs b/Items/Armor/VictideHeadgear.cs index a0ec7969ce..83a286f95b 100644 --- a/Items/Armor/VictideHeadgear.cs +++ b/Items/Armor/VictideHeadgear.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = ItemRarityID.Green; - item.defense = 3; //10 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 1, 50, 0); + Item.rare = ItemRarityID.Green; + Item.defense = 3; //10 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -58,11 +58,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/VictideHelm.cs b/Items/Armor/VictideHelm.cs index 7f0897b6f2..ae50f8f2d8 100644 --- a/Items/Armor/VictideHelm.cs +++ b/Items/Armor/VictideHelm.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = ItemRarityID.Green; - item.defense = 4; //11 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 1, 50, 0); + Item.rare = ItemRarityID.Green; + Item.defense = 4; //11 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Armor player.ignoreWater = true; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - player.meleeDamage += 0.1f; + player.GetDamage(DamageClass.Melee) += 0.1f; player.lifeRegen += 3; } player.aggro += 200; @@ -49,16 +49,12 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.meleeDamage += 0.05f; + player.GetDamage(DamageClass.Melee) += 0.05f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/VictideHelmet.cs b/Items/Armor/VictideHelmet.cs index 295ef51def..ebfa5960d1 100644 --- a/Items/Armor/VictideHelmet.cs +++ b/Items/Armor/VictideHelmet.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = ItemRarityID.Green; - item.defense = 1; //8 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 1, 50, 0); + Item.rare = ItemRarityID.Green; + Item.defense = 1; //8 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -51,29 +51,25 @@ namespace CalamityMod.Items.Armor } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(7f * (player.allDamage + player.minionDamage - 1f)), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(7f * (player.allDamage + player.GetDamage(DamageClass.Summon) - 1f)), 0f, Main.myPlayer, 0f, 0f); } } player.ignoreWater = true; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - player.minionDamage += 0.1f; + player.GetDamage(DamageClass.Summon) += 0.1f; player.lifeRegen += 3; } } public override void UpdateEquip(Player player) { - player.minionDamage += 0.1f; + player.GetDamage(DamageClass.Summon) += 0.1f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/VictideLeggings.cs b/Items/Armor/VictideLeggings.cs index f52959f53a..7b62e05942 100644 --- a/Items/Armor/VictideLeggings.cs +++ b/Items/Armor/VictideLeggings.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = ItemRarityID.Green; - item.defense = 4; //9 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 0, 50, 0); + Item.rare = ItemRarityID.Green; + Item.defense = 4; //9 } public override void UpdateEquip(Player player) @@ -31,11 +31,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/VictideMask.cs b/Items/Armor/VictideMask.cs index 67003100a3..c1d8b6d011 100644 --- a/Items/Armor/VictideMask.cs +++ b/Items/Armor/VictideMask.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = ItemRarityID.Green; - item.defense = 2; //9 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 1, 50, 0); + Item.rare = ItemRarityID.Green; + Item.defense = 2; //9 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -40,23 +40,19 @@ namespace CalamityMod.Items.Armor player.ignoreWater = true; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - player.magicDamage += 0.1f; + player.GetDamage(DamageClass.Magic) += 0.1f; player.lifeRegen += 3; } } public override void UpdateEquip(Player player) { - player.magicDamage += 0.05f; + player.GetDamage(DamageClass.Magic) += 0.05f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/VictideVisage.cs b/Items/Armor/VictideVisage.cs index 10b87070a8..61efce7fac 100644 --- a/Items/Armor/VictideVisage.cs +++ b/Items/Armor/VictideVisage.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = ItemRarityID.Green; - item.defense = 3; //10 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 1, 50, 0); + Item.rare = ItemRarityID.Green; + Item.defense = 3; //10 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -40,23 +40,19 @@ namespace CalamityMod.Items.Armor player.ignoreWater = true; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - player.rangedDamage += 0.1f; + player.GetDamage(DamageClass.Ranged) += 0.1f; player.lifeRegen += 3; } } public override void UpdateEquip(Player player) { - player.rangedDamage += 0.05f; + player.GetDamage(DamageClass.Ranged) += 0.05f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/WulfrumArmor.cs b/Items/Armor/WulfrumArmor.cs index 89be15b7d2..b72682f6e4 100644 --- a/Items/Armor/WulfrumArmor.cs +++ b/Items/Armor/WulfrumArmor.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = ItemRarityID.Blue; - item.defense = 2; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 0, 50, 0); + Item.rare = ItemRarityID.Blue; + Item.defense = 2; } public override void UpdateEquip(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/WulfrumHeadgear.cs b/Items/Armor/WulfrumHeadgear.cs index d68bad61d0..c726210665 100644 --- a/Items/Armor/WulfrumHeadgear.cs +++ b/Items/Armor/WulfrumHeadgear.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = ItemRarityID.Blue; - item.defense = 2; //7 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 0, 75, 0); + Item.rare = ItemRarityID.Blue; + Item.defense = 2; //7 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -41,17 +41,12 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.rangedDamage += 0.1f; + player.GetDamage(DamageClass.Ranged) += 0.1f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/WulfrumHelm.cs b/Items/Armor/WulfrumHelm.cs index 973b2ffe21..b037443992 100644 --- a/Items/Armor/WulfrumHelm.cs +++ b/Items/Armor/WulfrumHelm.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = ItemRarityID.Blue; - item.defense = 3; //8 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 0, 75, 0); + Item.rare = ItemRarityID.Blue; + Item.defense = 3; //8 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -43,17 +43,12 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.meleeDamage += 0.1f; + player.GetDamage(DamageClass.Melee) += 0.1f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/WulfrumHelmet.cs b/Items/Armor/WulfrumHelmet.cs index 8241722f7e..c7e819daaa 100644 --- a/Items/Armor/WulfrumHelmet.cs +++ b/Items/Armor/WulfrumHelmet.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = ItemRarityID.Blue; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 0, 75, 0); + Item.rare = ItemRarityID.Blue; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -41,17 +41,12 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.minionDamage += 0.1f; + player.GetDamage(DamageClass.Summon) += 0.1f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/WulfrumHood.cs b/Items/Armor/WulfrumHood.cs index 8cabc9225c..725c7b3841 100644 --- a/Items/Armor/WulfrumHood.cs +++ b/Items/Armor/WulfrumHood.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = ItemRarityID.Blue; - item.defense = 1; //6 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 0, 75, 0); + Item.rare = ItemRarityID.Blue; + Item.defense = 1; //6 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -41,17 +41,12 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.magicDamage += 0.1f; + player.GetDamage(DamageClass.Magic) += 0.1f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/WulfrumLeggings.cs b/Items/Armor/WulfrumLeggings.cs index 1b8b6b7e25..f8235888b1 100644 --- a/Items/Armor/WulfrumLeggings.cs +++ b/Items/Armor/WulfrumLeggings.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 25, 0); - item.rare = ItemRarityID.Blue; - item.defense = 1; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 0, 25, 0); + Item.rare = ItemRarityID.Blue; + Item.defense = 1; } public override void UpdateEquip(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/WulfrumMask.cs b/Items/Armor/WulfrumMask.cs index 7390127864..8f2fa4be2e 100644 --- a/Items/Armor/WulfrumMask.cs +++ b/Items/Armor/WulfrumMask.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = ItemRarityID.Blue; - item.defense = 1; //6 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 0, 75, 0); + Item.rare = ItemRarityID.Blue; + Item.defense = 1; //6 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -54,12 +54,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Armor/XerocCuisses.cs b/Items/Armor/XerocCuisses.cs index 3a8e01bdb9..751e0a00f4 100644 --- a/Items/Armor/XerocCuisses.cs +++ b/Items/Armor/XerocCuisses.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = ItemRarityID.Red; - item.defense = 24; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 24, 0, 0); + Item.rare = ItemRarityID.Red; + Item.defense = 24; } public override void UpdateEquip(Player player) @@ -34,12 +34,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ItemID.LunarBar, 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ItemID.LunarBar, 12).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Armor/XerocMask.cs b/Items/Armor/XerocMask.cs index 94f59b7b8e..a334afc264 100644 --- a/Items/Armor/XerocMask.cs +++ b/Items/Armor/XerocMask.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 40, 0, 0); - item.rare = ItemRarityID.Red; - item.defense = 20; //71 + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 40, 0, 0); + Item.rare = ItemRarityID.Red; + Item.defense = 20; //71 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -71,12 +71,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ItemID.LunarBar, 8); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ItemID.LunarBar, 8).AddTile(TileID.LunarCraftingStation).Register(); } } diff --git a/Items/Armor/XerocPlateMail.cs b/Items/Armor/XerocPlateMail.cs index cf9e3cc40f..1c3a4e7b2f 100644 --- a/Items/Armor/XerocPlateMail.cs +++ b/Items/Armor/XerocPlateMail.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.Armor public override void SetDefaults() { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 32, 0, 0); - item.rare = ItemRarityID.Red; - item.defense = 27; + Item.width = 18; + Item.height = 18; + Item.value = Item.buyPrice(0, 32, 0, 0); + Item.rare = ItemRarityID.Red; + Item.defense = 27; } public override void UpdateEquip(Player player) @@ -34,12 +34,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 22); - recipe.AddIngredient(ItemID.LunarBar, 16); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 22).AddIngredient(ItemID.LunarBar, 16).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/BleachBall.cs b/Items/BleachBall.cs index 106dcf67da..c193af24e0 100644 --- a/Items/BleachBall.cs +++ b/Items/BleachBall.cs @@ -14,26 +14,21 @@ namespace CalamityMod.Items } public override void SetDefaults() { - item.width = 38; - item.height = 46; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; + Item.width = 38; + Item.height = 46; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; } public override void UpdateInventory(Player player) { - if (item.favorited) + if (Item.favorited) player.Calamity().disableNaturalScourgeSpawns = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.CalmingPotion); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.CalmingPotion).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/BrimstoneLocus.cs b/Items/BrimstoneLocus.cs index d30495e93c..30ca483be1 100644 --- a/Items/BrimstoneLocus.cs +++ b/Items/BrimstoneLocus.cs @@ -16,20 +16,16 @@ namespace CalamityMod.Items public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = 0; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = 0; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).Register(); } } } diff --git a/Items/BrokenWaterFilter.cs b/Items/BrokenWaterFilter.cs index 41053a2a71..2ea7161b39 100644 --- a/Items/BrokenWaterFilter.cs +++ b/Items/BrokenWaterFilter.cs @@ -13,25 +13,19 @@ namespace CalamityMod.Items } public override void SetDefaults() { - item.width = 32; - item.height = 34; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; + Item.width = 32; + Item.height = 34; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; } public override void UpdateInventory(Player player) { - if (item.favorited) + if (Item.favorited) player.Calamity().noStupidNaturalARSpawns = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.IronBar, 10); - recipe.anyIronBar = true; - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.IronBar, 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 1523bc5445..47b0c57cb7 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -28,6 +28,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; +using Terraria.Audio; namespace CalamityMod.Items { @@ -101,7 +102,7 @@ namespace CalamityMod.Items return myClone; } - public override bool NewPreReforge(Item item) + public override bool PreReforge(Item item) { StealthGenBonus = 1f; return true; @@ -178,7 +179,7 @@ namespace CalamityMod.Items if (Main.myPlayer == player.whoAmI && player.Calamity().cursedSummonsEnchant && NPC.CountNPCS(ModContent.NPCType()) < 2) { CalamityNetcode.NewNPC_ClientSide(Main.MouseWorld, ModContent.NPCType(), player); - Main.PlaySound(SoundID.DD2_DarkMageSummonSkeleton, Main.MouseWorld); + SoundEngine.PlaySound(SoundID.DD2_DarkMageSummonSkeleton, Main.MouseWorld); } bool belowHalfMana = player.statMana < player.statManaMax2 * 0.5f; @@ -337,7 +338,7 @@ namespace CalamityMod.Items int flareDamage = CalamityUtils.DamageSoftCap(damage * 0.5, 100); if (player.whoAmI == Main.myPlayer) { - Main.PlaySound(SoundID.Item20, player.Center); + SoundEngine.PlaySound(SoundID.Item20, player.Center); float spread = 45f * 0.0174f; double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; @@ -426,7 +427,7 @@ namespace CalamityMod.Items position += muzzleOffset; } Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - Main.PlaySound(SoundID.Item11.WithPitchVariance(0.05f), position); + SoundEngine.PlaySound(SoundID.Item11.WithPitchVariance(0.05f), position); return false; } if (item.type == ItemID.PearlwoodBow) @@ -580,7 +581,7 @@ namespace CalamityMod.Items #endregion #region Use Item Changes - public override bool UseItem(Item item, Player player) + public override bool? UseItem(Item item, Player player) { if (player.Calamity().evilSmasherBoost > 0) { @@ -878,7 +879,7 @@ namespace CalamityMod.Items { int x = (int)teleportLocation.X / 16; int y = (int)teleportLocation.Y / 16; - bool templeCheck = Main.tile[x, y].wall != WallID.LihzahrdBrickUnsafe || y <= Main.worldSurface || NPC.downedPlantBoss; + bool templeCheck = Main.tile[x, y].WallType != WallID.LihzahrdBrickUnsafe || y <= Main.worldSurface || NPC.downedPlantBoss; if (templeCheck && !Collision.SolidCollision(teleportLocation, player.width, player.height)) { int duration = CalamityPlayer.chaosStateDuration; @@ -985,50 +986,50 @@ namespace CalamityMod.Items if (set == "SquireTier2") { player.lifeRegen += 3; - player.minionDamage += 0.15f; - player.meleeCrit += 15; + player.GetDamage(DamageClass.Summon) += 0.15f; + player.GetCritChance(DamageClass.Melee) += 15; player.setBonus += "\nIncreases your life regeneration\n" + "15% increased minion damage and melee critical strike chance"; } else if (set == "HuntressTier2") { - player.minionDamage += 0.1f; - player.rangedDamage += 0.1f; + player.GetDamage(DamageClass.Summon) += 0.1f; + player.GetDamage(DamageClass.Ranged) += 0.1f; player.setBonus += "\n10% increased minion and ranged damage"; } else if (set == "ApprenticeTier2") { - player.minionDamage += 0.05f; - player.magicCrit += 15; + player.GetDamage(DamageClass.Summon) += 0.05f; + player.GetCritChance(DamageClass.Magic) += 15; player.setBonus += "\n5% increased minion damage and 15% increased magic critical strike chance"; } else if (set == "MonkTier3") { - player.minionDamage += 0.3f; + player.GetDamage(DamageClass.Summon) += 0.3f; player.meleeSpeed += 0.1f; - player.meleeDamage += 0.1f; - player.meleeCrit += 10; + player.GetDamage(DamageClass.Melee) += 0.1f; + player.GetCritChance(DamageClass.Melee) += 10; player.setBonus += "\n10% increased melee damage, melee critical strike chance and melee speed\n" + "30% increased minion damage"; } else if (set == "SquireTier3") { player.lifeRegen += 6; - player.minionDamage += 0.1f; - player.meleeCrit += 10; + player.GetDamage(DamageClass.Summon) += 0.1f; + player.GetCritChance(DamageClass.Melee) += 10; player.setBonus += "\nMassively increased life regeneration\n" + "10% increased minion damage and melee critical strike chance"; } else if (set == "HuntressTier3") { - player.minionDamage += 0.1f; - player.rangedDamage += 0.1f; + player.GetDamage(DamageClass.Summon) += 0.1f; + player.GetDamage(DamageClass.Ranged) += 0.1f; player.setBonus += "\n10% increased minion and ranged damage"; } else if (set == "ApprenticeTier3") { - player.minionDamage += 0.1f; - player.magicCrit += 15; + player.GetDamage(DamageClass.Summon) += 0.1f; + player.GetCritChance(DamageClass.Magic) += 15; player.setBonus += "\n10% increased minion damage and 15% increased magic critical strike chance"; } else if (set == "SolarFlare") @@ -1044,69 +1045,69 @@ namespace CalamityMod.Items switch (item.type) { case ItemID.MagicHat: - player.magicDamage -= 0.02f; - player.magicCrit -= 2; + player.GetDamage(DamageClass.Magic) -= 0.02f; + player.GetCritChance(DamageClass.Magic) -= 2; break; case ItemID.WizardHat: - player.magicDamage -= 0.1f; + player.GetDamage(DamageClass.Magic) -= 0.1f; break; case ItemID.SpectreHood: - player.magicDamage += 0.2f; + player.GetDamage(DamageClass.Magic) += 0.2f; break; case ItemID.SquireGreatHelm: player.lifeRegen -= 7; break; case ItemID.SquirePlating: - player.minionDamage -= 0.05f; - player.meleeDamage -= 0.05f; + player.GetDamage(DamageClass.Summon) -= 0.05f; + player.GetDamage(DamageClass.Melee) -= 0.05f; break; case ItemID.SquireGreaves: - player.minionDamage -= 0.1f; - player.meleeCrit -= 10; + player.GetDamage(DamageClass.Summon) -= 0.1f; + player.GetCritChance(DamageClass.Melee) -= 10; break; case ItemID.HuntressJerkin: - player.minionDamage -= 0.1f; - player.rangedDamage -= 0.1f; + player.GetDamage(DamageClass.Summon) -= 0.1f; + player.GetDamage(DamageClass.Ranged) -= 0.1f; break; case ItemID.ApprenticeTrousers: - player.minionDamage -= 0.05f; - player.magicCrit -= 15; + player.GetDamage(DamageClass.Summon) -= 0.05f; + player.GetCritChance(DamageClass.Magic) -= 15; break; case ItemID.SquireAltShirt: player.lifeRegen -= 14; break; case ItemID.SquireAltPants: - player.minionDamage -= 0.1f; - player.meleeCrit -= 10; + player.GetDamage(DamageClass.Summon) -= 0.1f; + player.GetCritChance(DamageClass.Melee) -= 10; break; case ItemID.MonkAltHead: - player.minionDamage -= 0.1f; - player.meleeDamage -= 0.1f; + player.GetDamage(DamageClass.Summon) -= 0.1f; + player.GetDamage(DamageClass.Melee) -= 0.1f; break; case ItemID.MonkAltShirt: - player.minionDamage -= 0.1f; + player.GetDamage(DamageClass.Summon) -= 0.1f; player.meleeSpeed -= 0.1f; break; case ItemID.MonkAltPants: - player.minionDamage -= 0.1f; - player.meleeCrit -= 10; + player.GetDamage(DamageClass.Summon) -= 0.1f; + player.GetCritChance(DamageClass.Melee) -= 10; break; case ItemID.HuntressAltShirt: - player.minionDamage -= 0.1f; - player.rangedDamage -= 0.1f; + player.GetDamage(DamageClass.Summon) -= 0.1f; + player.GetDamage(DamageClass.Ranged) -= 0.1f; break; case ItemID.ApprenticeAltPants: - player.minionDamage -= 0.1f; - player.magicCrit -= 15; + player.GetDamage(DamageClass.Summon) -= 0.1f; + player.GetCritChance(DamageClass.Magic) -= 15; break; } } @@ -1135,7 +1136,7 @@ namespace CalamityMod.Items if (item.type == ItemID.FireGauntlet) { - player.meleeDamage += 0.04f; + player.GetDamage(DamageClass.Melee) += 0.04f; player.meleeSpeed += 0.04f; } @@ -1173,9 +1174,9 @@ namespace CalamityMod.Items else if (item.type == ItemID.ButterflyWings) // Boost to magic stats { player.statManaMax2 += 20; - player.magicDamage += 0.05f; + player.GetDamage(DamageClass.Magic) += 0.05f; player.manaCost *= 0.95f; - player.magicCrit += 5; + player.GetCritChance(DamageClass.Magic) += 5; player.noFallDmg = true; } else if (item.type == ItemID.FairyWings) // Boost to max life @@ -1207,8 +1208,8 @@ namespace CalamityMod.Items player.body == ArmorIDs.Body.NecroBreastplate && player.legs == ArmorIDs.Legs.NecroGreaves) { player.moveSpeed += 0.1f; - player.rangedDamage += 0.1f; - player.rangedCrit += 10; + player.GetDamage(DamageClass.Ranged) += 0.1f; + player.GetCritChance(DamageClass.Ranged) += 10; player.statDefense += 30; } } @@ -1225,16 +1226,16 @@ namespace CalamityMod.Items player.noFallDmg = true; if (player.head == ArmorIDs.Head.FrostHelmet && player.body == ArmorIDs.Body.FrostBreastplate && player.legs == ArmorIDs.Legs.FrostLeggings) { - player.meleeDamage += 0.02f; - player.rangedDamage += 0.02f; - player.meleeCrit += 1; - player.rangedCrit += 1; + player.GetDamage(DamageClass.Melee) += 0.02f; + player.GetDamage(DamageClass.Ranged) += 0.02f; + player.GetCritChance(DamageClass.Melee) += 1; + player.GetCritChance(DamageClass.Ranged) += 1; } } else if (item.type == ItemID.FlameWings) // Bonus to melee stats { - player.meleeDamage += 0.05f; - player.meleeCrit += 5; + player.GetDamage(DamageClass.Melee) += 0.05f; + player.GetCritChance(DamageClass.Melee) += 5; player.noFallDmg = true; } else if (item.type == ItemID.GhostWings) // Bonus to mage stats while wearing spectre armor @@ -1249,8 +1250,8 @@ namespace CalamityMod.Items } else if (player.head == ArmorIDs.Head.SpectreMask) { - player.magicDamage += 0.05f; - player.magicCrit += 5; + player.GetDamage(DamageClass.Magic) += 0.05f; + player.GetCritChance(DamageClass.Magic) += 5; } } } @@ -1266,8 +1267,8 @@ namespace CalamityMod.Items } else if (player.body == ArmorIDs.Body.BeetleScaleMail) { - player.meleeDamage += 0.05f; - player.meleeCrit += 5; + player.GetDamage(DamageClass.Melee) += 0.05f; + player.GetCritChance(DamageClass.Melee) += 5; } } } @@ -1328,7 +1329,7 @@ namespace CalamityMod.Items if (player.head == ArmorIDs.Head.SpookyHelmet && player.body == ArmorIDs.Body.SpookyBreastplate && player.legs == ArmorIDs.Legs.SpookyLeggings) { player.minionKB += 2f; - player.minionDamage += 0.05f; + player.GetDamage(DamageClass.Summon) += 0.05f; } } else if (item.type == ItemID.TatteredFairyWings) @@ -1350,8 +1351,8 @@ namespace CalamityMod.Items player.noFallDmg = true; if (player.head == ArmorIDs.Head.SolarFlareHelmet && player.body == ArmorIDs.Body.SolarFlareBreastplate && player.legs == ArmorIDs.Legs.SolarFlareLeggings) { - player.meleeDamage += 0.07f; - player.meleeCrit += 3; + player.GetDamage(DamageClass.Melee) += 0.07f; + player.GetCritChance(DamageClass.Melee) += 3; } } else if (item.type == ItemID.WingsVortex) // Bonus to ranged stats while wearing vortex armor @@ -1359,8 +1360,8 @@ namespace CalamityMod.Items player.noFallDmg = true; if (player.head == ArmorIDs.Head.VortexHelmet && player.body == ArmorIDs.Body.VortexBreastplate && player.legs == ArmorIDs.Legs.VortexLeggings) { - player.rangedDamage += 0.03f; - player.rangedCrit += 7; + player.GetDamage(DamageClass.Ranged) += 0.03f; + player.GetCritChance(DamageClass.Ranged) += 7; } } else if (item.type == ItemID.WingsNebula) // Bonus to magic stats while wearing nebula armor @@ -1368,8 +1369,8 @@ namespace CalamityMod.Items player.noFallDmg = true; if (player.head == ArmorIDs.Head.NebulaHelmet && player.body == ArmorIDs.Body.NebulaBreastplate && player.legs == ArmorIDs.Legs.NebulaLeggings) { - player.magicDamage += 0.05f; - player.magicCrit += 5; + player.GetDamage(DamageClass.Magic) += 0.05f; + player.GetCritChance(DamageClass.Magic) += 5; player.statManaMax2 += 20; player.manaCost *= 0.95f; } @@ -1380,7 +1381,7 @@ namespace CalamityMod.Items if (player.head == ArmorIDs.Head.StardustHelmet && player.body == ArmorIDs.Body.StardustPlate && player.legs == ArmorIDs.Legs.StardustLeggings) { player.maxMinions++; - player.minionDamage += 0.05f; + player.GetDamage(DamageClass.Summon) += 0.05f; } } else if (item.type == ItemID.FishronWings || item.type == ItemID.BetsyWings || item.type == ItemID.Yoraiz0rWings || @@ -1739,7 +1740,7 @@ namespace CalamityMod.Items prefix = PrefixID.Wild; break; case 5: - prefix = mod.PrefixType("Quiet"); + prefix = Mod.Find("Quiet").Type; break; case 6: prefix = PrefixID.Guarding; @@ -1754,7 +1755,7 @@ namespace CalamityMod.Items prefix = PrefixID.Rash; break; case 10: - prefix = mod.PrefixType("Cloaked"); + prefix = Mod.Find("Cloaked").Type; break; case 11: prefix = PrefixID.Precise; @@ -1775,7 +1776,7 @@ namespace CalamityMod.Items prefix = PrefixID.Intrepid; break; case 17: - prefix = mod.PrefixType("Camouflaged"); + prefix = Mod.Find("Camouflaged").Type; break; case 18: prefix = PrefixID.Warding; @@ -1793,7 +1794,7 @@ namespace CalamityMod.Items prefix = PrefixID.Lucky; break; case 23: - prefix = mod.PrefixType("Silent"); + prefix = Mod.Find("Silent").Type; break; } } @@ -2323,40 +2324,40 @@ namespace CalamityMod.Items case -2: break; case 1: - prefix = mod.PrefixType("Radical"); + prefix = Mod.Find("Radical").Type; break; case 2: - prefix = mod.PrefixType("Pointy"); + prefix = Mod.Find("Pointy").Type; break; case 3: - prefix = mod.PrefixType("Sharp"); + prefix = Mod.Find("Sharp").Type; break; case 4: - prefix = mod.PrefixType("Glorious"); + prefix = Mod.Find("Glorious").Type; break; case 5: - prefix = mod.PrefixType("Feathered"); + prefix = Mod.Find("Feathered").Type; break; case 6: - prefix = mod.PrefixType("Sleek"); + prefix = Mod.Find("Sleek").Type; break; case 7: - prefix = mod.PrefixType("Hefty"); + prefix = Mod.Find("Hefty").Type; break; case 8: - prefix = mod.PrefixType("Mighty"); + prefix = Mod.Find("Mighty").Type; break; case 9: - prefix = mod.PrefixType("Serrated"); + prefix = Mod.Find("Serrated").Type; break; case 10: - prefix = mod.PrefixType("Vicious"); + prefix = Mod.Find("Vicious").Type; break; case 11: - prefix = mod.PrefixType("Lethal"); + prefix = Mod.Find("Lethal").Type; break; case 12: - prefix = mod.PrefixType("Flawless"); + prefix = Mod.Find("Flawless").Type; break; } } diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index a67298daba..62cc618f1f 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items public override void ModifyTooltips(Item item, List tooltips) { // Apply rarity coloration to the item's name. - TooltipLine nameLine = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.mod == "Terraria"); + TooltipLine nameLine = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.Mod == "Terraria"); if (nameLine != null) ApplyRarityColor(item, nameLine); @@ -47,7 +47,7 @@ namespace CalamityMod.Items // Adds "Does extra damage to enemies shot at point-blank range" to weapons capable of it. if (canFirePointBlankShots) { - TooltipLine line = new TooltipLine(mod, "PointBlankShot", "Does extra damage to enemies shot at point-blank range"); + TooltipLine line = new TooltipLine(Mod, "PointBlankShot", "Does extra damage to enemies shot at point-blank range"); tooltips.Add(line); } @@ -65,19 +65,19 @@ namespace CalamityMod.Items { // Convert current charge ratio into a percentage. float displayedPercent = ChargeRatio * 100f; - TooltipLine line = new TooltipLine(mod, "CalamityCharge", $"Current Charge: {displayedPercent:N1}%"); + TooltipLine line = new TooltipLine(Mod, "CalamityCharge", $"Current Charge: {displayedPercent:N1}%"); tooltips.Add(line); } // Adds "Donor Item" and "Developer Item" to donor items and developer items respectively. if (donorItem) { - TooltipLine line = new TooltipLine(mod, "CalamityDonor", CalamityUtils.ColorMessage("- Donor Item -", CalamityUtils.DonatorItemColor)); + TooltipLine line = new TooltipLine(Mod, "CalamityDonor", CalamityUtils.ColorMessage("- Donor Item -", CalamityUtils.DonatorItemColor)); tooltips.Add(line); } if (devItem) { - TooltipLine line = new TooltipLine(mod, "CalamityDev", CalamityUtils.ColorMessage("- Developer Item -", CalamityUtils.HotPinkRarityColor)); + TooltipLine line = new TooltipLine(Mod, "CalamityDev", CalamityUtils.ColorMessage("- Developer Item -", CalamityUtils.HotPinkRarityColor)); tooltips.Add(line); } } @@ -203,7 +203,7 @@ namespace CalamityMod.Items { foreach (string line in AppliedEnchantment.Value.Description.Split('\n')) { - TooltipLine descriptionLine = new TooltipLine(mod, "Enchantment", CalamityUtils.ColorMessage(line, Color.DarkRed)); + TooltipLine descriptionLine = new TooltipLine(Mod, "Enchantment", CalamityUtils.ColorMessage(line, Color.DarkRed)); tooltips.Add(descriptionLine); } } @@ -229,9 +229,9 @@ namespace CalamityMod.Items } // This function produces simple predicates to match a specific line of a tooltip, by number/index. - Func LineNum(int n) => (Item i, TooltipLine l) => l.mod == "Terraria" && l.Name == $"Tooltip{n}"; + Func LineNum(int n) => (Item i, TooltipLine l) => l.Mod == "Terraria" && l.Name == $"Tooltip{n}"; // This function produces simple predicates to match a specific line of a tooltip, by name. - Func LineName(string s) => (Item i, TooltipLine l) => l.mod == "Terraria" && l.Name == s; + Func LineName(string s) => (Item i, TooltipLine l) => l.Mod == "Terraria" && l.Name == s; // These functions are shorthand to invoke ApplyTooltipEdits using the above predicates. void EditTooltipByNum(int lineNum, Action action) => ApplyTooltipEdits(tooltips, LineNum(lineNum), action); @@ -252,7 +252,7 @@ namespace CalamityMod.Items // Mirrors and Recall Potions cannot be used while a boss is alive. if (item.type == ItemID.MagicMirror || item.type == ItemID.IceMirror || item.type == ItemID.CellPhone || item.type == ItemID.RecallPotion) ApplyTooltipEdits(tooltips, - (i, l) => l.mod == "Terraria" && l.Name == (i.type == ItemID.CellPhone ? "Tooltip1" : "Tooltip0"), + (i, l) => l.Mod == "Terraria" && l.Name == (i.type == ItemID.CellPhone ? "Tooltip1" : "Tooltip0"), (line) => line.text += "\nCannot be used while you have the Boss Effects buff"); // Rod of Discord cannot be used multiple times to hurt yourself @@ -913,7 +913,7 @@ namespace CalamityMod.Items #region True Melee Damage Tooltip private void TrueMeleeDamageTooltip(Item item, IList tooltips) { - TooltipLine line = tooltips.FirstOrDefault((l) => l.mod == "Terraria" && l.Name == "Damage"); + TooltipLine line = tooltips.FirstOrDefault((l) => l.Mod == "Terraria" && l.Name == "Damage"); // If there somehow isn't a damage tooltip line, do not try to perform any edits. if (line is null) @@ -946,7 +946,7 @@ namespace CalamityMod.Items float stealthGenBoost = item.Calamity().StealthGenBonus - 1f; if (stealthGenBoost > 0) { - TooltipLine StealthGen = new TooltipLine(mod, "PrefixStealthGenBoost", "+" + Math.Round(stealthGenBoost * 100f) + "% stealth generation") + TooltipLine StealthGen = new TooltipLine(Mod, "PrefixStealthGenBoost", "+" + Math.Round(stealthGenBoost * 100f) + "% stealth generation") { isModifier = true }; @@ -959,7 +959,7 @@ namespace CalamityMod.Items public override bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset) { // Special enchantment line color. - if (line.Name == "ItemName" && line.mod == "Terraria" && item.IsEnchanted()) + if (line.Name == "ItemName" && line.Mod == "Terraria" && item.IsEnchanted()) { Color rarityColor = line.overrideColor ?? line.color; Vector2 basePosition = new Vector2(line.X, line.Y); diff --git a/Items/Critters/BabyFlakHermit.cs b/Items/Critters/BabyFlakHermit.cs index 088b1ee608..9293c95775 100644 --- a/Items/Critters/BabyFlakHermit.cs +++ b/Items/Critters/BabyFlakHermit.cs @@ -14,20 +14,20 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { - item.useStyle = ItemUseStyleID.SwingThrow; - item.autoReuse = true; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.maxStack = 999; - item.consumable = true; - item.noUseGraphic = true; - item.value = Item.buyPrice(0, 0, 30, 0); + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); //item.CloneDefaults(2004); //Lightning Bug item - item.width = 26; - item.height = 24; - item.makeNPC = (short)ModContent.NPCType(); - item.rare = ItemRarityID.LightPurple; + Item.width = 26; + Item.height = 24; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.LightPurple; } } } diff --git a/Items/Critters/BabyGhostBellItem.cs b/Items/Critters/BabyGhostBellItem.cs index 2bb9ba1bd7..92743b10bd 100644 --- a/Items/Critters/BabyGhostBellItem.cs +++ b/Items/Critters/BabyGhostBellItem.cs @@ -14,20 +14,20 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { - item.useStyle = ItemUseStyleID.SwingThrow; - item.autoReuse = true; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.maxStack = 999; - item.consumable = true; - item.noUseGraphic = true; - item.value = Item.buyPrice(0, 0, 30, 0); + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); //item.CloneDefaults(2004); //Lightning Bug item - item.width = 26; - item.height = 24; - item.makeNPC = (short)ModContent.NPCType(); - item.rare = ItemRarityID.Green; + Item.width = 26; + Item.height = 24; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Critters/PiggyItem.cs b/Items/Critters/PiggyItem.cs index d7983ede97..f1dbae3a25 100644 --- a/Items/Critters/PiggyItem.cs +++ b/Items/Critters/PiggyItem.cs @@ -14,21 +14,21 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { - item.useStyle = ItemUseStyleID.SwingThrow; - item.autoReuse = true; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.maxStack = 999; - item.consumable = true; - item.noUseGraphic = true; - item.width = 26; - item.height = 24; - item.makeNPC = (short)ModContent.NPCType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.width = 26; + Item.height = 24; + Item.makeNPC = (short)ModContent.NPCType(); - item.value = Item.sellPrice(gold: 10); - item.rare = ItemRarityID.Blue; - item.Calamity().donorItem = true; + Item.value = Item.sellPrice(gold: 10); + Item.rare = ItemRarityID.Blue; + Item.Calamity().donorItem = true; } } } diff --git a/Items/Critters/SeaMinnowItem.cs b/Items/Critters/SeaMinnowItem.cs index 1f86ffd2c6..50d8cfe2dd 100644 --- a/Items/Critters/SeaMinnowItem.cs +++ b/Items/Critters/SeaMinnowItem.cs @@ -14,21 +14,21 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { - item.useStyle = ItemUseStyleID.SwingThrow; - item.autoReuse = true; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.maxStack = 999; - item.consumable = true; - item.noUseGraphic = true; - item.value = Item.buyPrice(0, 0, 30, 0); + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); //item.CloneDefaults(2004); //Lightning Bug item - item.width = 26; - item.height = 24; - item.bait = 20; - item.makeNPC = (short)ModContent.NPCType(); - item.rare = ItemRarityID.Green; + Item.width = 26; + Item.height = 24; + Item.bait = 20; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Critters/TwinklerItem.cs b/Items/Critters/TwinklerItem.cs index cb36e188db..3482c635fa 100644 --- a/Items/Critters/TwinklerItem.cs +++ b/Items/Critters/TwinklerItem.cs @@ -14,21 +14,21 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { - item.useStyle = ItemUseStyleID.SwingThrow; - item.autoReuse = true; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.maxStack = 999; - item.consumable = true; - item.noUseGraphic = true; - item.value = Item.buyPrice(0, 0, 40, 0); + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 40, 0); //item.CloneDefaults(2004); //Lightning Bug item - item.width = 26; - item.height = 24; - item.bait = 40; - item.makeNPC = (short)ModContent.NPCType(); - item.rare = ItemRarityID.Green; + Item.width = 26; + Item.height = 24; + Item.bait = 40; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/DifficultyItems/BallAndChain.cs b/Items/DifficultyItems/BallAndChain.cs index c1d6401f56..4144208cad 100644 --- a/Items/DifficultyItems/BallAndChain.cs +++ b/Items/DifficultyItems/BallAndChain.cs @@ -15,28 +15,22 @@ namespace CalamityMod.Items.DifficultyItems public override void SetDefaults() { - item.width = 32; - item.height = 50; - item.rare = ItemRarityID.Blue; + Item.width = 32; + Item.height = 50; + Item.rare = ItemRarityID.Blue; } public override bool CanUseItem(Player player) => false; public override void UpdateInventory(Player player) { - if (item.favorited) + if (Item.favorited) player.Calamity().blockAllDashes = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 10); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Chain); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.IronBar, 10).AddIngredient(ItemID.Chain).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/DifficultyItems/Death.cs b/Items/DifficultyItems/Death.cs index f32dc7b52a..bbbb017f75 100644 --- a/Items/DifficultyItems/Death.cs +++ b/Items/DifficultyItems/Death.cs @@ -37,21 +37,21 @@ namespace CalamityMod.Items.DifficultyItems public override void SetDefaults() { - item.expert = true; - item.rare = ItemRarityID.Purple; - item.width = 28; - item.height = 28; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item119; - item.consumable = false; + Item.expert = true; + Item.rare = ItemRarityID.Purple; + Item.width = 28; + Item.height = 28; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item119; + Item.consumable = false; } // Can only be used in Revengeance Mode. public override bool CanUseItem(Player player) => CalamityWorld.revenge || CalamityWorld.death; - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { // This world syncing code should only be run by one entity- the server, to prevent a race condition // with the packets. @@ -95,10 +95,7 @@ namespace CalamityMod.Items.DifficultyItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/DifficultyItems/Malice.cs b/Items/DifficultyItems/Malice.cs index def10a1466..08f4adc023 100644 --- a/Items/DifficultyItems/Malice.cs +++ b/Items/DifficultyItems/Malice.cs @@ -35,15 +35,15 @@ namespace CalamityMod.Items.DifficultyItems public override void SetDefaults() { - item.expert = true; - item.rare = ItemRarityID.Purple; - item.width = 82; - item.height = 66; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item119; - item.consumable = false; + Item.expert = true; + Item.rare = ItemRarityID.Purple; + Item.width = 82; + Item.height = 66; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item119; + Item.consumable = false; } public override void UseStyle(Player player) @@ -53,22 +53,22 @@ namespace CalamityMod.Items.DifficultyItems public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/DifficultyItems/Malice_Animated"); - spriteBatch.Draw(texture, position, item.GetCurrentFrame(ref frame, ref frameCounter, 8, 8), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/DifficultyItems/Malice_Animated"); + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 8, 8), Color.White, 0f, origin, scale, SpriteEffects.None, 0); return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/DifficultyItems/Malice_Animated"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 8, 8), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/DifficultyItems/Malice_Animated"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 8, 8), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } // Can only be used in Death Mode. public override bool CanUseItem(Player player) => CalamityWorld.death || CalamityWorld.malice; - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { // This world syncing code should only be run by one entity- the server, to prevent a race condition // with the packets. @@ -104,10 +104,7 @@ namespace CalamityMod.Items.DifficultyItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/DifficultyItems/Revenge.cs b/Items/DifficultyItems/Revenge.cs index 47d63c63a1..65498fa780 100644 --- a/Items/DifficultyItems/Revenge.cs +++ b/Items/DifficultyItems/Revenge.cs @@ -38,15 +38,15 @@ namespace CalamityMod.Items.DifficultyItems public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.expert = true; - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item119; - item.consumable = false; + Item.width = 28; + Item.height = 28; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.expert = true; + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item119; + Item.consumable = false; } public override void ModifyTooltips(List list) @@ -55,11 +55,11 @@ namespace CalamityMod.Items.DifficultyItems string adrenKey = CalamityMod.AdrenalineHotKey.TooltipHotkeyString(); foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip1") { line2.text = "Enables the Rage mechanic. When Rage is maxed press " + rageKey + " to activate Rage Mode."; } - if (line2.mod == "Terraria" && line2.Name == "Tooltip3") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip3") { line2.text = "Enables the Adrenaline mechanic. When Adrenaline is maxed press " + adrenKey + " to activate Adrenaline Mode."; } @@ -69,7 +69,7 @@ namespace CalamityMod.Items.DifficultyItems // Can only be used in Expert worlds. The Revengeance check is a failsafe that allows you to disable rev in normal mode worlds if it gets enabled for whatever reason. public override bool CanUseItem(Player player) => Main.expertMode || CalamityWorld.revenge; - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { // This world syncing code should only be run by one entity- the server, to prevent a race condition // with the packets. @@ -121,10 +121,7 @@ namespace CalamityMod.Items.DifficultyItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/DraedonMisc/AdvancedDisplay.cs b/Items/DraedonMisc/AdvancedDisplay.cs index c43631ec7e..6ec88393e0 100644 --- a/Items/DraedonMisc/AdvancedDisplay.cs +++ b/Items/DraedonMisc/AdvancedDisplay.cs @@ -20,16 +20,16 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.width = 52; - item.height = 52; - item.maxStack = 999; - item.consumable = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Yellow; - item.useTime = item.useAnimation = 15; + Item.width = 52; + Item.height = 52; + Item.maxStack = 999; + Item.consumable = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Yellow; + Item.useTime = Item.useAnimation = 15; } - public override bool UseItem(Player player) => true; + public override bool? UseItem(Player player) => true; public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); @@ -39,7 +39,7 @@ namespace CalamityMod.Items.DraedonMisc Tile tile = CalamityUtils.ParanoidTileRetrieval(placeTileCoords.X, placeTileCoords.Y); float checkDistance = ((Player.tileRangeX + Player.tileRangeY) / 2f + player.blockRange) * 16f; - if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.type == ModContent.TileType()) + if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.TileType == ModContent.TileType()) { TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsAdvancedDisplay) @@ -55,14 +55,7 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 3); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.Glass, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.Glass, 20).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/DraedonMisc/AuricQuantumCoolingCell.cs b/Items/DraedonMisc/AuricQuantumCoolingCell.cs index 433cb42608..ce01b75946 100644 --- a/Items/DraedonMisc/AuricQuantumCoolingCell.cs +++ b/Items/DraedonMisc/AuricQuantumCoolingCell.cs @@ -24,29 +24,29 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.width = 26; - item.height = 44; - item.maxStack = 999; - item.consumable = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Red; - item.useTime = item.useAnimation = 15; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 26; + Item.height = 44; + Item.maxStack = 999; + Item.consumable = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Red; + Item.useTime = Item.useAnimation = 15; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void ModifyTooltips(List tooltips) { - tooltips.FirstOrDefault(x => x.Name == "Tooltip2" && x.mod == "Terraria").overrideColor = Color.DarkRed; + tooltips.FirstOrDefault(x => x.Name == "Tooltip2" && x.Mod == "Terraria").overrideColor = Color.DarkRed; CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 5, true); } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 1.2f * brightness, 0.4f * brightness, 0.8f); + Lighting.AddLight(Item.Center, 1.2f * brightness, 0.4f * brightness, 0.8f); } - public override bool UseItem(Player player) => true; + public override bool? UseItem(Player player) => true; public override bool ConsumeItem(Player player) { @@ -54,7 +54,7 @@ namespace CalamityMod.Items.DraedonMisc Tile tile = CalamityUtils.ParanoidTileRetrieval(placeTileCoords.X, placeTileCoords.Y); float checkDistance = ((Player.tileRangeX + Player.tileRangeY) / 2f + player.blockRange) * 16f; - if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.type == ModContent.TileType()) + if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.TileType == ModContent.TileType()) { TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsCoolingCell || codebreakerTileEntity.DecryptionCountdown > 0) @@ -71,15 +71,7 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { // Old worlds can craft the cell immediately for the sake of being able to easily fight Draedon in endgame worlds. - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 5, true); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 40).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/DraedonMisc/CodebreakerBase.cs b/Items/DraedonMisc/CodebreakerBase.cs index a6d5d5f160..57fabe5f45 100644 --- a/Items/DraedonMisc/CodebreakerBase.cs +++ b/Items/DraedonMisc/CodebreakerBase.cs @@ -12,28 +12,22 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 42; - item.height = 32; - item.maxStack = 999; - item.rare = ItemRarityID.Orange; - item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 42; + Item.height = 32; + Item.maxStack = 999; + Item.rare = ItemRarityID.Orange; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 35); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 35).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/DraedonMisc/DecryptionComputer.cs b/Items/DraedonMisc/DecryptionComputer.cs index 676ab97432..19ce6e1999 100644 --- a/Items/DraedonMisc/DecryptionComputer.cs +++ b/Items/DraedonMisc/DecryptionComputer.cs @@ -22,16 +22,16 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.width = 42; - item.height = 40; - item.maxStack = 999; - item.consumable = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.useTime = item.useAnimation = 15; + Item.width = 42; + Item.height = 40; + Item.maxStack = 999; + Item.consumable = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.useTime = Item.useAnimation = 15; } - public override bool UseItem(Player player) => true; + public override bool? UseItem(Player player) => true; public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); @@ -41,7 +41,7 @@ namespace CalamityMod.Items.DraedonMisc Tile tile = CalamityUtils.ParanoidTileRetrieval(placeTileCoords.X, placeTileCoords.Y); float checkDistance = ((Player.tileRangeX + Player.tileRangeY) / 2f + player.blockRange) * 16f; - if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.type == ModContent.TileType()) + if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.TileType == ModContent.TileType()) { TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsDecryptionComputer) @@ -57,18 +57,7 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 1); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 10); - // You do not need the Decryption Computer for the Tier 1 (Sunken Sea) schematic. - // As such, its recipe can contain anything that is pre-Mechs (where Tier 2 is). - // Wires are thus fair game to include without causing any issues. - recipe.AddIngredient(ItemID.Wire, 100); - recipe.AddRecipeGroup("AnyCopperBar", 10); - recipe.AddIngredient(ItemID.Glass, 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.Wire, 100).AddRecipeGroup("AnyCopperBar", 10).AddIngredient(ItemID.Glass, 15).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/DraedonMisc/DraedonsLogHell.cs b/Items/DraedonMisc/DraedonsLogHell.cs index 6ea201e337..65328443b9 100644 --- a/Items/DraedonMisc/DraedonsLogHell.cs +++ b/Items/DraedonMisc/DraedonsLogHell.cs @@ -15,15 +15,15 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.useAnimation = item.useTime = 20; - item.useStyle = ItemUseStyleID.HoldingUp; + Item.width = 28; + Item.height = 28; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (Main.myPlayer == player.whoAmI) PopupGUIManager.FlipActivityOfGUIWithType(typeof(DraedonLogHellGUI)); diff --git a/Items/DraedonMisc/DraedonsLogJungle.cs b/Items/DraedonMisc/DraedonsLogJungle.cs index 5a99e49e91..e0db93e5f9 100644 --- a/Items/DraedonMisc/DraedonsLogJungle.cs +++ b/Items/DraedonMisc/DraedonsLogJungle.cs @@ -15,15 +15,15 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.useAnimation = item.useTime = 20; - item.useStyle = ItemUseStyleID.HoldingUp; + Item.width = 28; + Item.height = 28; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (Main.myPlayer == player.whoAmI) PopupGUIManager.FlipActivityOfGUIWithType(typeof(DraedonLogJungleGUI)); diff --git a/Items/DraedonMisc/DraedonsLogPlanetoid.cs b/Items/DraedonMisc/DraedonsLogPlanetoid.cs index 94ba49709f..dbe5cd2403 100644 --- a/Items/DraedonMisc/DraedonsLogPlanetoid.cs +++ b/Items/DraedonMisc/DraedonsLogPlanetoid.cs @@ -15,15 +15,15 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.useAnimation = item.useTime = 20; - item.useStyle = ItemUseStyleID.HoldingUp; + Item.width = 28; + Item.height = 28; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (Main.myPlayer == player.whoAmI) PopupGUIManager.FlipActivityOfGUIWithType(typeof(DraedonLogPlanetoidGUI)); diff --git a/Items/DraedonMisc/DraedonsLogSnowBiome.cs b/Items/DraedonMisc/DraedonsLogSnowBiome.cs index ed8cf5f94f..1fa7ec4b72 100644 --- a/Items/DraedonMisc/DraedonsLogSnowBiome.cs +++ b/Items/DraedonMisc/DraedonsLogSnowBiome.cs @@ -15,15 +15,15 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.useAnimation = item.useTime = 20; - item.useStyle = ItemUseStyleID.HoldingUp; + Item.width = 28; + Item.height = 28; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (Main.myPlayer == player.whoAmI) PopupGUIManager.FlipActivityOfGUIWithType(typeof(DraedonLogSnowBiomeGUI)); diff --git a/Items/DraedonMisc/DraedonsLogSunkenSea.cs b/Items/DraedonMisc/DraedonsLogSunkenSea.cs index 1fcb0e7007..63eb1db249 100644 --- a/Items/DraedonMisc/DraedonsLogSunkenSea.cs +++ b/Items/DraedonMisc/DraedonsLogSunkenSea.cs @@ -15,15 +15,15 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.useAnimation = item.useTime = 20; - item.useStyle = ItemUseStyleID.HoldingUp; + Item.width = 28; + Item.height = 28; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (Main.myPlayer == player.whoAmI) PopupGUIManager.FlipActivityOfGUIWithType(typeof(DraedonLogSunkenSeaGUI)); diff --git a/Items/DraedonMisc/EncryptedSchematicHell.cs b/Items/DraedonMisc/EncryptedSchematicHell.cs index c7ca9ae112..71f866dc34 100644 --- a/Items/DraedonMisc/EncryptedSchematicHell.cs +++ b/Items/DraedonMisc/EncryptedSchematicHell.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.width = 42; - item.height = 42; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.maxStack = 1; + Item.width = 42; + Item.height = 42; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.maxStack = 1; } public override void UpdateInventory(Player player) @@ -34,13 +34,7 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { - SchematicRecipe recipe = new SchematicRecipe(mod, "Hell"); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.Glass, 50); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.Glass, 50).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/DraedonMisc/EncryptedSchematicIce.cs b/Items/DraedonMisc/EncryptedSchematicIce.cs index 3a228efd52..486209fe2e 100644 --- a/Items/DraedonMisc/EncryptedSchematicIce.cs +++ b/Items/DraedonMisc/EncryptedSchematicIce.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.width = 42; - item.height = 42; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.maxStack = 1; + Item.width = 42; + Item.height = 42; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.maxStack = 1; } public override void UpdateInventory(Player player) @@ -34,13 +34,7 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { - SchematicRecipe recipe = new SchematicRecipe(mod, "Ice"); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.Glass, 50); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.Glass, 50).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/DraedonMisc/EncryptedSchematicJungle.cs b/Items/DraedonMisc/EncryptedSchematicJungle.cs index 20c1d203e1..37de82aec1 100644 --- a/Items/DraedonMisc/EncryptedSchematicJungle.cs +++ b/Items/DraedonMisc/EncryptedSchematicJungle.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.width = 42; - item.height = 42; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.maxStack = 1; + Item.width = 42; + Item.height = 42; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.maxStack = 1; } public override void UpdateInventory(Player player) @@ -34,13 +34,7 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { - SchematicRecipe recipe = new SchematicRecipe(mod, "Jungle"); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.Glass, 50); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.Glass, 50).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs index 15620da1e8..5ea2494a54 100644 --- a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs +++ b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.width = 42; - item.height = 42; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.maxStack = 1; + Item.width = 42; + Item.height = 42; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.maxStack = 1; } public override void UpdateInventory(Player player) @@ -34,13 +34,7 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { - SchematicRecipe recipe = new SchematicRecipe(mod, "Planetoid"); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.Glass, 50); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.Glass, 50).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs index 16cc2a0cf7..d88e0ed585 100644 --- a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs +++ b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.DraedonMisc Tooltip.SetDefault("Finely detailed diagrams of numerous devices and weaponry dance across the holographic screen.\n" + "The weaponry I supply to the workers of the laboratories is weak. Hardly suited for battle.\n" + "However, they suffice for self defense against any lab mechanisms or creations which may have gone rogue.\n" + - "Addendum: For those who think themselves powerful, search the upper bounds of this planet’s atmosphere for a structure similar to that of the Sunken Seas.\n" + + "Addendum: For those who think themselves powerful, search the upper bounds of this planet’s atmosphere for a structure similar to that of the Sunken Seas.\n" + "I will know by the end if you are worthy of battling my creations.\n" + "Picking up this item or holding it in your inventory permanently unlocks new recipes"); } public override void SetDefaults() { - item.width = 42; - item.height = 42; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.maxStack = 1; + Item.width = 42; + Item.height = 42; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.maxStack = 1; } public override void UpdateInventory(Player player) @@ -43,13 +43,7 @@ namespace CalamityMod.Items.DraedonMisc // Recipe exists for posierity. public override void AddRecipes() { - SchematicRecipe recipe = new SchematicRecipe(mod, "Sunken Sea"); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.Glass, 50); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.Glass, 50).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/DraedonMisc/LongRangedSensorArray.cs b/Items/DraedonMisc/LongRangedSensorArray.cs index 8943b1dbb4..7fc48f687c 100644 --- a/Items/DraedonMisc/LongRangedSensorArray.cs +++ b/Items/DraedonMisc/LongRangedSensorArray.cs @@ -20,16 +20,16 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.width = 52; - item.height = 52; - item.maxStack = 999; - item.consumable = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Pink; - item.useTime = item.useAnimation = 15; + Item.width = 52; + Item.height = 52; + Item.maxStack = 999; + Item.consumable = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Pink; + Item.useTime = Item.useAnimation = 15; } - public override bool UseItem(Player player) => true; + public override bool? UseItem(Player player) => true; public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); @@ -39,7 +39,7 @@ namespace CalamityMod.Items.DraedonMisc Tile tile = CalamityUtils.ParanoidTileRetrieval(placeTileCoords.X, placeTileCoords.Y); float checkDistance = ((Player.tileRangeX + Player.tileRangeY) / 2f + player.blockRange) * 16f; - if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.type == ModContent.TileType()) + if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.TileType == ModContent.TileType()) { TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsSensorArray) @@ -55,14 +55,7 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 2); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddRecipeGroup("AnyMythrilBar", 10); - recipe.AddIngredient(ItemID.Wire, 50); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddRecipeGroup("AnyMythrilBar", 10).AddIngredient(ItemID.Wire, 50).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/DraedonMisc/PowerCell.cs b/Items/DraedonMisc/PowerCell.cs index 7b24c2c58b..8914aa6de0 100644 --- a/Items/DraedonMisc/PowerCell.cs +++ b/Items/DraedonMisc/PowerCell.cs @@ -15,24 +15,24 @@ namespace CalamityMod.Items.DraedonMisc DisplayName.SetDefault("Draedon Power Cell"); Tooltip.SetDefault("Used to charge Draedon's weaponry at a Charging Station\n" + "Also can be processed by the Extractinator for spare parts"); - ItemID.Sets.ExtractinatorMode[item.type] = item.type; + ItemID.Sets.ExtractinatorMode[Item.type] = Item.type; } public override void SetDefaults() { - item.width = 26; - item.height = 14; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.maxStack = 999; + Item.width = 26; + Item.height = 14; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.maxStack = 999; - item.consumable = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = 10; - item.useTime = 2; - item.autoReuse = true; - item.useTurn = true; - item.value = Item.sellPrice(0, 0, 0, 20); + Item.consumable = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = 10; + Item.useTime = 2; + Item.autoReuse = true; + Item.useTurn = true; + Item.value = Item.sellPrice(0, 0, 0, 20); } public override void ExtractinatorUse(ref int resultType, ref int resultStack) diff --git a/Items/DraedonMisc/VoltageRegulationSystem.cs b/Items/DraedonMisc/VoltageRegulationSystem.cs index 2b49e9c6e6..0fb2ca40b9 100644 --- a/Items/DraedonMisc/VoltageRegulationSystem.cs +++ b/Items/DraedonMisc/VoltageRegulationSystem.cs @@ -20,17 +20,17 @@ namespace CalamityMod.Items.DraedonMisc public override void SetDefaults() { - item.width = 52; - item.height = 52; - item.maxStack = 999; - item.consumable = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.useTime = item.useAnimation = 15; + Item.width = 52; + Item.height = 52; + Item.maxStack = 999; + Item.consumable = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.useTime = Item.useAnimation = 15; } - public override bool UseItem(Player player) => true; + public override bool? UseItem(Player player) => true; public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4); @@ -40,7 +40,7 @@ namespace CalamityMod.Items.DraedonMisc Tile tile = CalamityUtils.ParanoidTileRetrieval(placeTileCoords.X, placeTileCoords.Y); float checkDistance = ((Player.tileRangeX + Player.tileRangeY) / 2f + player.blockRange) * 16f; - if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.type == ModContent.TileType()) + if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.active() && tile.TileType == ModContent.TileType()) { TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsVoltageRegulationSystem) @@ -56,14 +56,7 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 4); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Dyes/AerialiteDye.cs b/Items/Dyes/AerialiteDye.cs index 85dc95695c..3553be7a6f 100644 --- a/Items/Dyes/AerialiteDye.cs +++ b/Items/Dyes/AerialiteDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class AerialiteDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/AerialiteDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/AerialiteDyeShader").Value), "DyePass"). UseColor(new Color(153, 200, 193)).UseSecondaryColor(new Color(236, 244, 213)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,18 +19,13 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Orange; - item.value = Item.sellPrice(0, 0, 50, 0); + Item.rare = ItemRarityID.Orange; + Item.value = Item.sellPrice(0, 0, 50, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/AstralBlueDye.cs b/Items/Dyes/AstralBlueDye.cs index 7fad119062..6c95bbfe45 100644 --- a/Items/Dyes/AstralBlueDye.cs +++ b/Items/Dyes/AstralBlueDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class AstralBlueDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/AstralBlueDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/AstralBlueDyeShader").Value), "DyePass"). UseColor(new Color(109, 242, 197)).UseSecondaryColor(new Color(42, 147, 154)); public override void SafeSetStaticDefaults() { @@ -19,18 +19,13 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Cyan; - item.value = Item.sellPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.value = Item.sellPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/AstralDye.cs b/Items/Dyes/AstralDye.cs index f2cad53ca5..b32bc343d0 100644 --- a/Items/Dyes/AstralDye.cs +++ b/Items/Dyes/AstralDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class AstralDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/AstralDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/AstralDyeShader").Value), "DyePass"). UseColor(new Color(123, 99, 130)).UseSecondaryColor(new Color(189, 66, 84)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,18 +19,13 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.LightRed; - item.value = Item.sellPrice(0, 0, 65, 0); + Item.rare = ItemRarityID.LightRed; + Item.value = Item.sellPrice(0, 0, 65, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/AstralOrangeDye.cs b/Items/Dyes/AstralOrangeDye.cs index a5c9a75795..a6becfa914 100644 --- a/Items/Dyes/AstralOrangeDye.cs +++ b/Items/Dyes/AstralOrangeDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class AstralOrangeDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/AstralOrangeDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/AstralOrangeDyeShader").Value), "DyePass"). UseColor(new Color(255, 166, 94)).UseSecondaryColor(new Color(238, 93, 82)); public override void SafeSetStaticDefaults() { @@ -19,18 +19,13 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Cyan; - item.value = Item.sellPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.value = Item.sellPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/AstralSwirlDye.cs b/Items/Dyes/AstralSwirlDye.cs index fead19d169..fc88818eae 100644 --- a/Items/Dyes/AstralSwirlDye.cs +++ b/Items/Dyes/AstralSwirlDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class AstralSwirlDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/AstralSwirlDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/AstralSwirlDyeShader").Value), "DyePass"). UseColor(new Color(42, 147, 154)).UseSecondaryColor(new Color(238, 93, 82)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,19 +19,13 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Cyan; - item.value = Item.sellPrice(0, 3, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.value = Item.sellPrice(0, 3, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/AuricDye.cs b/Items/Dyes/AuricDye.cs index 5fe8dbcf4d..4f1a8476b1 100644 --- a/Items/Dyes/AuricDye.cs +++ b/Items/Dyes/AuricDye.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Dyes { public class AuricDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/AuricDyeShader")), "DyePass"). - UseColor(new Color(170, 96, 60)).UseSecondaryColor(new Color(226, 196, 106)).SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/SharpNoise")); + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/AuricDyeShader").Value), "DyePass"). + UseColor(new Color(170, 96, 60)).UseSecondaryColor(new Color(226, 196, 106)).SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/SharpNoise")); public override void SafeSetStaticDefaults() { DisplayName.SetDefault("Auric Dye"); @@ -19,19 +19,14 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = Item.sellPrice(0, 9, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = Item.sellPrice(0, 9, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/BaseDye.cs b/Items/Dyes/BaseDye.cs index 56a029cebd..5f85616fe6 100644 --- a/Items/Dyes/BaseDye.cs +++ b/Items/Dyes/BaseDye.cs @@ -15,15 +15,15 @@ namespace CalamityMod.Items.Dyes { if (!Main.dedServ) { - GameShaders.Armor.BindShader(item.type, ShaderDataToBind); + GameShaders.Armor.BindShader(Item.type, ShaderDataToBind); } SafeSetStaticDefaults(); } public sealed override void SetDefaults() { - byte dye = item.dye; - item.CloneDefaults(ItemID.GelDye); - item.dye = dye; + byte dye = Item.dye; + Item.CloneDefaults(ItemID.GelDye); + Item.dye = dye; SafeSetDefaults(); } /// diff --git a/Items/Dyes/BloodflareDye.cs b/Items/Dyes/BloodflareDye.cs index 101fdc53a4..01395d118b 100644 --- a/Items/Dyes/BloodflareDye.cs +++ b/Items/Dyes/BloodflareDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class BloodflareDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/BloodflareDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/BloodflareDyeShader").Value), "DyePass"). UseColor(new Color(122, 10, 60)).UseSecondaryColor(new Color(219, 102, 106)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,19 +19,14 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.value = Item.sellPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = Item.sellPrice(0, 4, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/BlueCosmicFlameDye.cs b/Items/Dyes/BlueCosmicFlameDye.cs index e42c24501d..d4806eb04a 100644 --- a/Items/Dyes/BlueCosmicFlameDye.cs +++ b/Items/Dyes/BlueCosmicFlameDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class BlueCosmicFlameDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/CosmicFlameShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/CosmicFlameShader").Value), "DyePass"). UseColor(new Color(52, 212, 229)).UseSecondaryColor(new Color(52, 212, 229)).UseImage("Images/Misc/Noise").UseSaturation(0f); public override void SafeSetStaticDefaults() { @@ -19,19 +19,14 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = Item.sellPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = Item.sellPrice(0, 5, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/BlueStatigelDye.cs b/Items/Dyes/BlueStatigelDye.cs index 6902b1886b..cc3e6a9dcd 100644 --- a/Items/Dyes/BlueStatigelDye.cs +++ b/Items/Dyes/BlueStatigelDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class BlueStatigelDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/SlimeGodDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/SlimeGodDyeShader").Value), "DyePass"). UseColor(new Color(80, 170, 206)).UseSecondaryColor(new Color(81, 87, 119)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,18 +19,13 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.LightRed; - item.value = Item.sellPrice(0, 0, 60, 0); + Item.rare = ItemRarityID.LightRed; + Item.value = Item.sellPrice(0, 0, 60, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/BrimflameDye.cs b/Items/Dyes/BrimflameDye.cs index 8822ef67e3..a6233686e0 100644 --- a/Items/Dyes/BrimflameDye.cs +++ b/Items/Dyes/BrimflameDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class BrimflameDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/BrimflameDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/BrimflameDyeShader").Value), "DyePass"). UseColor(new Color(252, 147, 34)).UseSecondaryColor(new Color(216, 41, 26)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,18 +19,13 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Pink; - item.value = Item.sellPrice(0, 0, 75, 0); + Item.rare = ItemRarityID.Pink; + Item.value = Item.sellPrice(0, 0, 75, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/CalamitousDye.cs b/Items/Dyes/CalamitousDye.cs index 452842c54a..8fe633bbd2 100644 --- a/Items/Dyes/CalamitousDye.cs +++ b/Items/Dyes/CalamitousDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class CalamitousDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/CalamitousDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/CalamitousDyeShader").Value), "DyePass"). UseColor(new Color(227, 79, 79)).UseSecondaryColor(new Color(145, 27, 135)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,19 +19,14 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = Item.sellPrice(0, 10, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = Item.sellPrice(0, 10, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 3); - recipe.AddRecipe(); + CreateRecipe(3).AddIngredient(ItemID.BottledWater, 3).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/CeaselessDye.cs b/Items/Dyes/CeaselessDye.cs index a32ad66b6c..9de678cfa9 100644 --- a/Items/Dyes/CeaselessDye.cs +++ b/Items/Dyes/CeaselessDye.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Dyes { public class CeaselessDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/CeaselessDyeShader")), "DyePass"); + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/CeaselessDyeShader").Value), "DyePass"); public override void SafeSetStaticDefaults() { DisplayName.SetDefault("Ceaseless Dye"); @@ -17,20 +17,14 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Red; //Shouldn't this be purple smh :/ - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.value = Item.sellPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Red; //Shouldn't this be purple smh :/ + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.value = Item.sellPrice(0, 4, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.VoidDye); - recipe.AddIngredient(ItemID.ShadowDye); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.VoidDye).AddIngredient(ItemID.ShadowDye).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/CosmiliteDye.cs b/Items/Dyes/CosmiliteDye.cs index 8e4a231ec7..e782c2d0df 100644 --- a/Items/Dyes/CosmiliteDye.cs +++ b/Items/Dyes/CosmiliteDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class CosmiliteDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/CosmiliteDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/CosmiliteDyeShader").Value), "DyePass"). UseColor(new Color(154, 140, 191)).UseSecondaryColor(new Color(249, 109, 235)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,19 +19,14 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = Item.sellPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = Item.sellPrice(0, 5, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/CryonicDye.cs b/Items/Dyes/CryonicDye.cs index 893212e432..e0f966411d 100644 --- a/Items/Dyes/CryonicDye.cs +++ b/Items/Dyes/CryonicDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class CryonicDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/CryonicDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/CryonicDyeShader").Value), "DyePass"). UseColor(new Color(138, 225, 255)).UseSecondaryColor(new Color(90, 90, 204)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,18 +19,13 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Pink; - item.value = Item.sellPrice(0, 0, 75, 0); + Item.rare = ItemRarityID.Pink; + Item.value = Item.sellPrice(0, 0, 75, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/DefiledFlameDye.cs b/Items/Dyes/DefiledFlameDye.cs index b22c299536..a83f4e48aa 100644 --- a/Items/Dyes/DefiledFlameDye.cs +++ b/Items/Dyes/DefiledFlameDye.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Dyes { public class DefiledFlameDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/DefiledFlameDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/DefiledFlameDyeShader").Value), "DyePass"). UseColor(new Color(106, 190, 48)).UseSecondaryColor(new Color(204, 248, 48)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.LightRed; - item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; } } } diff --git a/Items/Dyes/DragonSoulDye.cs b/Items/Dyes/DragonSoulDye.cs index 77cb8d8940..93cd0d9736 100644 --- a/Items/Dyes/DragonSoulDye.cs +++ b/Items/Dyes/DragonSoulDye.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Dyes { public class DragonSoulDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/DragonSoulDyeShader")), "DyePass"); + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/DragonSoulDyeShader").Value), "DyePass"); public override void SafeSetStaticDefaults() { DisplayName.SetDefault("Dragon Soul Dye"); @@ -17,19 +17,14 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = Item.sellPrice(0, 8, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = Item.sellPrice(0, 8, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/ElementalDye.cs b/Items/Dyes/ElementalDye.cs index 24f87755bc..24be861809 100644 --- a/Items/Dyes/ElementalDye.cs +++ b/Items/Dyes/ElementalDye.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Dyes { public class ElementalDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/ElementalDyeShader")), "DyePass").UseImage("Images/Misc/Perlin"); + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/ElementalDyeShader").Value), "DyePass").UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { DisplayName.SetDefault("Elemental Dye"); @@ -17,21 +17,13 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Purple; - item.value = Item.sellPrice(0, 2, 50, 0); + Item.rare = ItemRarityID.Purple; + Item.value = Item.sellPrice(0, 2, 50, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SolarDye); - recipe.AddIngredient(ItemID.VortexDye); - recipe.AddIngredient(ItemID.StardustDye); - recipe.AddIngredient(ItemID.NebulaDye); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 5); - recipe.AddRecipe(); + CreateRecipe(5).AddIngredient(ItemID.SolarDye).AddIngredient(ItemID.VortexDye).AddIngredient(ItemID.StardustDye).AddIngredient(ItemID.NebulaDye).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/EndothermicDye.cs b/Items/Dyes/EndothermicDye.cs index f12699e796..63ec351465 100644 --- a/Items/Dyes/EndothermicDye.cs +++ b/Items/Dyes/EndothermicDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class EndothermicDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/EndothermicDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/EndothermicDyeShader").Value), "DyePass"). UseColor(new Color(123, 205, 237)).UseSecondaryColor(new Color(85, 85, 171)); public override void SafeSetStaticDefaults() { @@ -19,19 +19,14 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = Item.sellPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = Item.sellPrice(0, 5, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/ExoDye.cs b/Items/Dyes/ExoDye.cs index 38be0f00f2..e89b7f6ff8 100644 --- a/Items/Dyes/ExoDye.cs +++ b/Items/Dyes/ExoDye.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Dyes { public override ArmorShaderData ShaderDataToBind { - get => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/ExoDyeShader")), "DyePass").UseImage("Images/Misc/Perlin"); + get => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/ExoDyeShader").Value), "DyePass").UseImage("Images/Misc/Perlin"); } public override void SafeSetStaticDefaults() @@ -21,19 +21,14 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = Item.sellPrice(0, 10, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = Item.sellPrice(0, 10, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 3); - recipe.AddRecipe(); + CreateRecipe(3).AddIngredient(ItemID.BottledWater, 3).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/HairDye/AdrenalineHairDye.cs b/Items/Dyes/HairDye/AdrenalineHairDye.cs index b3cf023f30..6cc4d2f262 100644 --- a/Items/Dyes/HairDye/AdrenalineHairDye.cs +++ b/Items/Dyes/HairDye/AdrenalineHairDye.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Items.Dyes.HairDye public override void SetDefaults() { - item.width = 20; - item.height = 26; - item.maxStack = 99; - item.value = Item.buyPrice(gold: 7, silver: 50); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item3; - item.useStyle = ItemUseStyleID.EatingUsing; - item.useTurn = true; - item.useAnimation = 17; - item.useTime = 17; - item.consumable = true; + Item.width = 20; + Item.height = 26; + Item.maxStack = 99; + Item.value = Item.buyPrice(gold: 7, silver: 50); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item3; + Item.useStyle = ItemUseStyleID.EatFood; + Item.useTurn = true; + Item.useAnimation = 17; + Item.useTime = 17; + Item.consumable = true; } } } diff --git a/Items/Dyes/HairDye/RageHairDye.cs b/Items/Dyes/HairDye/RageHairDye.cs index 95e3a33dd1..964ca64cce 100644 --- a/Items/Dyes/HairDye/RageHairDye.cs +++ b/Items/Dyes/HairDye/RageHairDye.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Items.Dyes.HairDye public override void SetDefaults() { - item.width = 20; - item.height = 26; - item.maxStack = 99; - item.value = Item.buyPrice(gold: 7, silver: 50); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item3; - item.useStyle = ItemUseStyleID.EatingUsing; - item.useTurn = true; - item.useAnimation = 17; - item.useTime = 17; - item.consumable = true; + Item.width = 20; + Item.height = 26; + Item.maxStack = 99; + Item.value = Item.buyPrice(gold: 7, silver: 50); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item3; + Item.useStyle = ItemUseStyleID.EatFood; + Item.useTurn = true; + Item.useAnimation = 17; + Item.useTime = 17; + Item.consumable = true; } } } diff --git a/Items/Dyes/HairDye/StealthHairDye.cs b/Items/Dyes/HairDye/StealthHairDye.cs index ac3b1cac76..bdfcade077 100644 --- a/Items/Dyes/HairDye/StealthHairDye.cs +++ b/Items/Dyes/HairDye/StealthHairDye.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Items.Dyes.HairDye public override void SetDefaults() { - item.width = 20; - item.height = 26; - item.maxStack = 99; - item.value = Item.buyPrice(gold: 5); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item3; - item.useStyle = ItemUseStyleID.EatingUsing; - item.useTurn = true; - item.useAnimation = 17; - item.useTime = 17; - item.consumable = true; + Item.width = 20; + Item.height = 26; + Item.maxStack = 99; + Item.value = Item.buyPrice(gold: 5); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item3; + Item.useStyle = ItemUseStyleID.EatFood; + Item.useTurn = true; + Item.useAnimation = 17; + Item.useTime = 17; + Item.consumable = true; } } } diff --git a/Items/Dyes/HairDye/WingTimeHairDye.cs b/Items/Dyes/HairDye/WingTimeHairDye.cs index cd731018ff..74e09f7f3f 100644 --- a/Items/Dyes/HairDye/WingTimeHairDye.cs +++ b/Items/Dyes/HairDye/WingTimeHairDye.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Items.Dyes.HairDye public override void SetDefaults() { - item.width = 20; - item.height = 26; - item.maxStack = 99; - item.value = Item.buyPrice(gold: 7, silver: 50); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item3; - item.useStyle = ItemUseStyleID.EatingUsing; - item.useTurn = true; - item.useAnimation = 17; - item.useTime = 17; - item.consumable = true; + Item.width = 20; + Item.height = 26; + Item.maxStack = 99; + Item.value = Item.buyPrice(gold: 7, silver: 50); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item3; + Item.useStyle = ItemUseStyleID.EatFood; + Item.useTurn = true; + Item.useAnimation = 17; + Item.useTime = 17; + Item.consumable = true; } } } diff --git a/Items/Dyes/NightmareDye.cs b/Items/Dyes/NightmareDye.cs index 1c6c26701f..d6f3083cc3 100644 --- a/Items/Dyes/NightmareDye.cs +++ b/Items/Dyes/NightmareDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class NightmareDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/NightmareDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/NightmareDyeShader").Value), "DyePass"). UseColor(new Color(249, 81, 0)).UseSecondaryColor(new Color(255, 203, 106)); public override void SafeSetStaticDefaults() { @@ -19,19 +19,14 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = Item.sellPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = Item.sellPrice(0, 5, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/PhantoplasmDye.cs b/Items/Dyes/PhantoplasmDye.cs index 74f44065b1..f1de816ae7 100644 --- a/Items/Dyes/PhantoplasmDye.cs +++ b/Items/Dyes/PhantoplasmDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class PhantoplasmDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/PhantoplasmDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/PhantoplasmDyeShader").Value), "DyePass"). UseColor(new Color(245, 143, 182)).UseSecondaryColor(new Color(119, 238, 255)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,18 +19,13 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Purple; - item.value = Item.sellPrice(0, 2, 50, 0); + Item.rare = ItemRarityID.Purple; + Item.value = Item.sellPrice(0, 2, 50, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/PinkCosmicFlameDye.cs b/Items/Dyes/PinkCosmicFlameDye.cs index c5885581f5..88740bbea0 100644 --- a/Items/Dyes/PinkCosmicFlameDye.cs +++ b/Items/Dyes/PinkCosmicFlameDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class PinkCosmicFlameDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/CosmicFlameShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/CosmicFlameShader").Value), "DyePass"). UseColor(new Color(255, 115, 221)).UseSecondaryColor(new Color(255, 115, 221)).UseImage("Images/Misc/Noise").UseSaturation(0f); public override void SafeSetStaticDefaults() { @@ -19,19 +19,14 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = Item.sellPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = Item.sellPrice(0, 5, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/PinkStatigelDye.cs b/Items/Dyes/PinkStatigelDye.cs index dd09159291..28f93f30b3 100644 --- a/Items/Dyes/PinkStatigelDye.cs +++ b/Items/Dyes/PinkStatigelDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class PinkStatigelDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/SlimeGodDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/SlimeGodDyeShader").Value), "DyePass"). UseColor(new Color(249, 129, 185)).UseSecondaryColor(new Color(131, 58, 103)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,18 +19,13 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.LightRed; - item.value = Item.sellPrice(0, 0, 60, 0); + Item.rare = ItemRarityID.LightRed; + Item.value = Item.sellPrice(0, 0, 60, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/ProfanedFlameDye.cs b/Items/Dyes/ProfanedFlameDye.cs index 16bc32c50f..4c65d63c2d 100644 --- a/Items/Dyes/ProfanedFlameDye.cs +++ b/Items/Dyes/ProfanedFlameDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class ProfanedFlameDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/ProfanedFlameDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/ProfanedFlameDyeShader").Value), "DyePass"). UseColor(new Color(255, 191, 73)).UseSecondaryColor(new Color(255, 255, 186)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,18 +19,13 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Purple; - item.value = Item.sellPrice(0, 2, 50, 0); + Item.rare = ItemRarityID.Purple; + Item.value = Item.sellPrice(0, 2, 50, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/ProfanedMoonlightDye.cs b/Items/Dyes/ProfanedMoonlightDye.cs index 6610e130b3..caf07da590 100644 --- a/Items/Dyes/ProfanedMoonlightDye.cs +++ b/Items/Dyes/ProfanedMoonlightDye.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Items.Dyes { public class ProfanedMoonlightDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/ProfanedMoonlightDye")), "DyePass"); + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/ProfanedMoonlightDye").Value), "DyePass"); public override void SafeSetStaticDefaults() { DisplayName.SetDefault("Profaned Moonlight Dye"); @@ -15,9 +15,9 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.value = Item.sellPrice(0, 10, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.value = Item.sellPrice(0, 10, 0, 0); } } } diff --git a/Items/Dyes/ReaverDye.cs b/Items/Dyes/ReaverDye.cs index 4cdc7d4b41..944f0a117b 100644 --- a/Items/Dyes/ReaverDye.cs +++ b/Items/Dyes/ReaverDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class ReaverDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/ReaverDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/ReaverDyeShader").Value), "DyePass"). UseColor(new Color(54, 164, 66)).UseSecondaryColor(new Color(224, 115, 65)); public override void SafeSetStaticDefaults() { @@ -19,18 +19,13 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Lime; - item.value = Item.sellPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.value = Item.sellPrice(0, 1, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/ShadowspecDye.cs b/Items/Dyes/ShadowspecDye.cs index 4d16a78120..af5476444b 100644 --- a/Items/Dyes/ShadowspecDye.cs +++ b/Items/Dyes/ShadowspecDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class ShadowspecDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/ShadowspecDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/ShadowspecDyeShader").Value), "DyePass"). UseColor(new Color(46, 27, 60)).UseSecondaryColor(new Color(132, 142, 191)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,19 +19,14 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.value = Item.sellPrice(0, 10, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.value = Item.sellPrice(0, 10, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/SlimeGodDye.cs b/Items/Dyes/SlimeGodDye.cs index a378642373..fbd3d87d8a 100644 --- a/Items/Dyes/SlimeGodDye.cs +++ b/Items/Dyes/SlimeGodDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class SlimeGodDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/SlimeGodDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/SlimeGodDyeShader").Value), "DyePass"). UseColor(new Color(80, 170, 206)).UseSecondaryColor(new Color(131, 58, 103)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -19,19 +19,13 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.LightRed; - item.value = Item.sellPrice(0, 0, 65, 0); + Item.rare = ItemRarityID.LightRed; + Item.value = Item.sellPrice(0, 0, 65, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/StratusDye.cs b/Items/Dyes/StratusDye.cs index cf220ac8f7..ac692613cc 100644 --- a/Items/Dyes/StratusDye.cs +++ b/Items/Dyes/StratusDye.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Dyes { public class StratusDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/StratusDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/StratusDyeShader").Value), "DyePass"). UseColor(new Color(36, 86, 163)).UseSecondaryColor(new Color(124, 204, 223)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { @@ -20,21 +20,14 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.value = Item.sellPrice(0, 4, 50, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = Item.sellPrice(0, 4, 50, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.BottledWater, 2).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Dyes/SwirlingCosmicFlameDye.cs b/Items/Dyes/SwirlingCosmicFlameDye.cs index 5d63f7ead5..5f12a5d8fd 100644 --- a/Items/Dyes/SwirlingCosmicFlameDye.cs +++ b/Items/Dyes/SwirlingCosmicFlameDye.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Dyes { public class SwirlingCosmicFlameDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/CosmicFlameShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(Mod.Assets.Request("Effects/Dyes/CosmicFlameShader").Value), "DyePass"). UseColor(new Color(52, 212, 229)).UseSecondaryColor(new Color(255, 115, 221)).UseImage("Images/Misc/Noise").UseSaturation(1f); public override void SafeSetStaticDefaults() { @@ -18,19 +18,14 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = Item.sellPrice(0, 7, 50, 0); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = Item.sellPrice(0, 7, 50, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.DyeVat).Register(); } } } diff --git a/Items/Fishing/AstralCatches/AldebaranAlewife.cs b/Items/Fishing/AstralCatches/AldebaranAlewife.cs index bd8907b518..28e075c4d5 100644 --- a/Items/Fishing/AstralCatches/AldebaranAlewife.cs +++ b/Items/Fishing/AstralCatches/AldebaranAlewife.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - item.width = 38; - item.height = 36; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 8); - item.rare = ItemRarityID.Blue; + Item.width = 38; + Item.height = 36; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 8); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/AstralCatches/ArcturusAstroidean.cs b/Items/Fishing/AstralCatches/ArcturusAstroidean.cs index bcf8eea95f..b810d2c7a6 100644 --- a/Items/Fishing/AstralCatches/ArcturusAstroidean.cs +++ b/Items/Fishing/AstralCatches/ArcturusAstroidean.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 10); - item.rare = ItemRarityID.Orange; - item.bait = 40; + Item.width = 20; + Item.height = 20; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Orange; + Item.bait = 40; } } } diff --git a/Items/Fishing/AstralCatches/AstralCrate.cs b/Items/Fishing/AstralCatches/AstralCrate.cs index c836b08d45..451885d1a0 100644 --- a/Items/Fishing/AstralCatches/AstralCrate.cs +++ b/Items/Fishing/AstralCatches/AstralCrate.cs @@ -27,18 +27,18 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 32; - item.height = 32; - item.rare = ItemRarityID.Green; - item.value = Item.sellPrice(gold: 1); - item.createTile = ModContent.TileType(); - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 32; + Item.height = 32; + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(gold: 1); + Item.createTile = ModContent.TileType(); + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; } public override bool CanRightClick() => true; diff --git a/Items/Fishing/AstralCatches/AstrophageItem.cs b/Items/Fishing/AstralCatches/AstrophageItem.cs index 04188af6b0..fce8b9da30 100644 --- a/Items/Fishing/AstralCatches/AstrophageItem.cs +++ b/Items/Fishing/AstralCatches/AstrophageItem.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - item.CloneDefaults(ItemID.ZephyrFish); - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); - item.rare = ItemRarityID.LightRed; + Item.CloneDefaults(ItemID.ZephyrFish); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); + Item.rare = ItemRarityID.LightRed; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Fishing/AstralCatches/GacruxianMollusk.cs b/Items/Fishing/AstralCatches/GacruxianMollusk.cs index 70b1d3cd54..3b586192a1 100644 --- a/Items/Fishing/AstralCatches/GacruxianMollusk.cs +++ b/Items/Fishing/AstralCatches/GacruxianMollusk.cs @@ -22,22 +22,22 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SafeSetDefaults() { - item.damage = BaseDamage; - item.knockBack = Knockback; - item.autoReuse = true; - item.useTime = 26; - item.useAnimation = 26; - item.useStyle = ItemUseStyleID.SwingThrow; - item.width = 24; - item.height = 22; - item.UseSound = SoundID.Item1; - item.noMelee = true; - item.noUseGraphic = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.Calamity().rogue = true; + Item.damage = BaseDamage; + Item.knockBack = Knockback; + Item.autoReuse = true; + Item.useTime = 26; + Item.useAnimation = 26; + Item.useStyle = ItemUseStyleID.Swing; + Item.width = 24; + Item.height = 22; + Item.UseSound = SoundID.Item1; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = Speed; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Fishing/AstralCatches/PolarisParrotfish.cs b/Items/Fishing/AstralCatches/PolarisParrotfish.cs index 123da8b970..9be3f4a87e 100644 --- a/Items/Fishing/AstralCatches/PolarisParrotfish.cs +++ b/Items/Fishing/AstralCatches/PolarisParrotfish.cs @@ -15,26 +15,26 @@ namespace CalamityMod.Items.Fishing.AstralCatches Tooltip.SetDefault("It carries the mark of the Northern Star\n" + "Projectile hits grant buffs to the weapon and the player\n" + "Buffs are removed on hit"); - Item.staff[item.type] = true; //so it doesn't look weird af when holding it + Item.staff[Item.type] = true; //so it doesn't look weird af when holding it } public override void SetDefaults() { - item.damage = 50; - item.ranged = true; - item.width = 38; - item.height = 34; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); //pew pew - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + Item.damage = 50; + Item.DamageType = DamageClass.Ranged; + Item.width = 38; + Item.height = 34; + Item.useTime = 21; + Item.useAnimation = 21; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); //pew pew + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Fishing/AstralCatches/ProcyonidPrawn.cs b/Items/Fishing/AstralCatches/ProcyonidPrawn.cs index bffd15e4c8..41ae507c22 100644 --- a/Items/Fishing/AstralCatches/ProcyonidPrawn.cs +++ b/Items/Fishing/AstralCatches/ProcyonidPrawn.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - item.width = 30; - item.height = 26; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 5); - item.rare = ItemRarityID.Blue; + Item.width = 30; + Item.height = 26; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 5); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/AstralCatches/TwinklingPollox.cs b/Items/Fishing/AstralCatches/TwinklingPollox.cs index bfd9113241..4648fe103e 100644 --- a/Items/Fishing/AstralCatches/TwinklingPollox.cs +++ b/Items/Fishing/AstralCatches/TwinklingPollox.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - item.width = 32; - item.height = 28; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 5); - item.rare = ItemRarityID.Blue; + Item.width = 32; + Item.height = 28; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 5); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/AstralCatches/UrsaSergeant.cs b/Items/Fishing/AstralCatches/UrsaSergeant.cs index 1de4d7c563..c49468f515 100644 --- a/Items/Fishing/AstralCatches/UrsaSergeant.cs +++ b/Items/Fishing/AstralCatches/UrsaSergeant.cs @@ -18,12 +18,12 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - item.defense = 20; - item.width = 36; - item.height = 26; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.accessory = true; + Item.defense = 20; + Item.width = 36; + Item.height = 26; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs b/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs index 88e094fedb..ad126e15ef 100644 --- a/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs +++ b/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs @@ -21,20 +21,20 @@ The life regen boost is stronger if below 75% health public override void SetDefaults() { - item.width = 44; - item.height = 36; - item.maxStack = 30; - item.useTurn = true; - item.value = Item.sellPrice(gold: 5); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.healLife = 240; - item.potion = true; + Item.width = 44; + Item.height = 36; + Item.maxStack = 30; + Item.useTurn = true; + Item.value = Item.sellPrice(gold: 5); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.healLife = 240; + Item.potion = true; } public override void OnConsumeItem(Player player) diff --git a/Items/Fishing/BrimstoneCragCatches/Brimlish.cs b/Items/Fishing/BrimstoneCragCatches/Brimlish.cs index dae832b165..244340cd13 100644 --- a/Items/Fishing/BrimstoneCragCatches/Brimlish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Brimlish.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetDefaults() { - item.questItem = true; - item.maxStack = 1; - item.width = 36; - item.height = 30; - item.uniqueStack = true; - item.rare = ItemRarityID.Quest; + Item.questItem = true; + Item.maxStack = 1; + Item.width = 36; + Item.height = 30; + Item.uniqueStack = true; + Item.rare = ItemRarityID.Quest; } public override bool IsQuestFish() diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs index 1d1e8f4f43..bb36177725 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs @@ -18,18 +18,18 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 32; - item.height = 32; - item.rare = ItemRarityID.Green; - item.value = Item.sellPrice(gold: 1); - item.createTile = ModContent.TileType(); - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 32; + Item.height = 32; + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(gold: 1); + Item.createTile = ModContent.TileType(); + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; } public override bool CanRightClick() => true; diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneFish.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneFish.cs index 27ff2c1a98..1a2d6e9156 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneFish.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneFish.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetDefaults() { - item.width = 28; - item.height = 30; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 8); - item.rare = ItemRarityID.Blue; + Item.width = 28; + Item.height = 30; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 8); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs b/Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs index 61b04dc2b4..1ffa8dd3f8 100644 --- a/Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs +++ b/Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetDefaults() { - item.width = 30; - item.height = 28; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 10); - item.rare = ItemRarityID.Green; + Item.width = 30; + Item.height = 28; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; } public override bool CanRightClick() diff --git a/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs b/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs index 243c70c394..fbabd14b8e 100644 --- a/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs +++ b/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetDefaults() { - item.width = 44; - item.height = 36; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 10); - item.rare = ItemRarityID.Orange; + Item.width = 44; + Item.height = 36; + Item.maxStack = 999; + Item.value = Item.sellPrice(gold: 10); + Item.rare = ItemRarityID.Orange; } } } diff --git a/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs b/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs index b73a630489..52c214028b 100644 --- a/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetDefaults() { - item.width = 30; - item.height = 28; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 8); - item.rare = ItemRarityID.Blue; + Item.width = 30; + Item.height = 28; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 8); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs b/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs index a1c7a71013..66ae058a1e 100644 --- a/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs +++ b/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetDefaults() { - item.width = 32; - item.height = 36; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 5); - item.rare = ItemRarityID.Blue; + Item.width = 32; + Item.height = 36; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 5); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs b/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs index 25036bcd38..997b01ca9e 100644 --- a/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs +++ b/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs @@ -14,26 +14,26 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Tooltip.SetDefault(@"Fires an inaccurate spread of fireballs The brimstone sac appears to contain fuel Revenge is a dish best served flaming hot"); - Item.staff[item.type] = true; //so it doesn't look weird af when holding it + Item.staff[Item.type] = true; //so it doesn't look weird af when holding it } public override void SetDefaults() { - item.damage = 20; - item.ranged = true; - item.width = 36; - item.height = 30; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11f; + Item.damage = 20; + Item.DamageType = DamageClass.Ranged; + Item.width = 36; + Item.height = 30; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; } public override Vector2? HoldoutOrigin() //so it looks normal when holding diff --git a/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs b/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs index 5d225b7aac..68b64424ba 100644 --- a/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 8); - item.rare = ItemRarityID.Blue; + Item.width = 28; + Item.height = 28; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 8); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/BrimstoneCragCatches/Slurpfish.cs b/Items/Fishing/BrimstoneCragCatches/Slurpfish.cs index 70a2b0e4e0..e7ffb3660f 100644 --- a/Items/Fishing/BrimstoneCragCatches/Slurpfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Slurpfish.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetDefaults() { - item.questItem = true; - item.maxStack = 1; - item.width = 30; - item.height = 30; - item.uniqueStack = true; - item.rare = ItemRarityID.Quest; + Item.questItem = true; + Item.maxStack = 1; + Item.width = 30; + Item.height = 30; + Item.uniqueStack = true; + Item.rare = ItemRarityID.Quest; } public override bool IsQuestFish() diff --git a/Items/Fishing/EnchantedStarfish.cs b/Items/Fishing/EnchantedStarfish.cs index 3b65be6909..36b049b6db 100644 --- a/Items/Fishing/EnchantedStarfish.cs +++ b/Items/Fishing/EnchantedStarfish.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - item.rare = ItemRarityID.Green; - item.width = 30; - item.height = 26; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item29; - item.consumable = true; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 50); + Item.rare = ItemRarityID.Green; + Item.width = 30; + Item.height = 26; + Item.useAnimation = 30; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item29; + Item.consumable = true; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 50); } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.itemAnimation > 0 && (player.statManaMax < 200 && player.itemTime == 0)) { diff --git a/Items/Fishing/FishingRods/ChaoticSpreadRod.cs b/Items/Fishing/FishingRods/ChaoticSpreadRod.cs index 077b1acca2..91323c15ba 100644 --- a/Items/Fishing/FishingRods/ChaoticSpreadRod.cs +++ b/Items/Fishing/FishingRods/ChaoticSpreadRod.cs @@ -18,17 +18,17 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - item.width = 24; - item.height = 28; - item.useAnimation = 8; - item.useTime = 8; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.fishingPole = 45; - item.shootSpeed = 17f; - item.shoot = ModContent.ProjectileType(); - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; + Item.width = 24; + Item.height = 28; + Item.useAnimation = 8; + Item.useTime = 8; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.fishingPole = 45; + Item.shootSpeed = 17f; + Item.shoot = ModContent.ProjectileType(); + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -44,12 +44,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HotlineFishingHook); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HotlineFishingHook).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Fishing/FishingRods/EarlyBloomRod.cs b/Items/Fishing/FishingRods/EarlyBloomRod.cs index af47b4661b..8cdcb041f9 100644 --- a/Items/Fishing/FishingRods/EarlyBloomRod.cs +++ b/Items/Fishing/FishingRods/EarlyBloomRod.cs @@ -17,18 +17,18 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - item.width = 24; - item.height = 28; - item.useAnimation = 8; - item.useTime = 8; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.fishingPole = 60; - item.shootSpeed = 18f; - item.shoot = ModContent.ProjectileType(); - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 24; + Item.height = 28; + Item.useAnimation = 8; + Item.useTime = 8; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.fishingPole = 60; + Item.shootSpeed = 18f; + Item.shoot = ModContent.ProjectileType(); + Item.value = Item.buyPrice(1, 20, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -44,12 +44,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WoodFishingPole); //wood -> fossilized wood - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.WoodFishingPole).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Fishing/FishingRods/FeralDoubleRod.cs b/Items/Fishing/FishingRods/FeralDoubleRod.cs index c67acdab73..59b9cc8077 100644 --- a/Items/Fishing/FishingRods/FeralDoubleRod.cs +++ b/Items/Fishing/FishingRods/FeralDoubleRod.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - item.width = 24; - item.height = 28; - item.useAnimation = 8; - item.useTime = 8; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.fishingPole = 40; - item.shootSpeed = 16f; - item.shoot = ModContent.ProjectileType(); - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; + Item.width = 24; + Item.height = 28; + Item.useAnimation = 8; + Item.useTime = 8; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.fishingPole = 40; + Item.shootSpeed = 16f; + Item.shoot = ModContent.ProjectileType(); + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -43,11 +43,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Fishing/FishingRods/HeronRod.cs b/Items/Fishing/FishingRods/HeronRod.cs index 1f962b167a..3fd6b08931 100644 --- a/Items/Fishing/FishingRods/HeronRod.cs +++ b/Items/Fishing/FishingRods/HeronRod.cs @@ -17,27 +17,22 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - item.width = 24; - item.height = 28; - item.useAnimation = 8; - item.useTime = 8; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.fishingPole = 25; - item.shootSpeed = 14.5f; - item.shoot = ModContent.ProjectileType(); - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; + Item.width = 24; + Item.height = 28; + Item.useAnimation = 8; + Item.useTime = 8; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.fishingPole = 25; + Item.shootSpeed = 14.5f; + Item.shoot = ModContent.ProjectileType(); + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ItemID.SunplateBlock, 5); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ItemID.SunplateBlock, 5).AddTile(TileID.SkyMill).Register(); } } } diff --git a/Items/Fishing/FishingRods/NavyFishingRod.cs b/Items/Fishing/FishingRods/NavyFishingRod.cs index 95099505a2..4661738364 100644 --- a/Items/Fishing/FishingRods/NavyFishingRod.cs +++ b/Items/Fishing/FishingRods/NavyFishingRod.cs @@ -17,27 +17,22 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - item.width = 24; - item.height = 28; - item.useAnimation = 8; - item.useTime = 8; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.fishingPole = 20; - item.shootSpeed = 13f; - item.shoot = ModContent.ProjectileType(); - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; + Item.width = 24; + Item.height = 28; + Item.useAnimation = 8; + Item.useTime = 8; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.fishingPole = 20; + Item.shootSpeed = 13f; + Item.shoot = ModContent.ProjectileType(); + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Fishing/FishingRods/SlurperPole.cs b/Items/Fishing/FishingRods/SlurperPole.cs index b22856012a..4bef6301ad 100644 --- a/Items/Fishing/FishingRods/SlurperPole.cs +++ b/Items/Fishing/FishingRods/SlurperPole.cs @@ -15,17 +15,17 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - item.width = 24; - item.height = 28; - item.useAnimation = 8; - item.useTime = 8; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.fishingPole = 25; - item.shootSpeed = 14f; - item.shoot = ModContent.ProjectileType(); - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; + Item.width = 24; + Item.height = 28; + Item.useAnimation = 8; + Item.useTime = 8; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.fishingPole = 25; + Item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; } } } diff --git a/Items/Fishing/FishingRods/TheDevourerofCods.cs b/Items/Fishing/FishingRods/TheDevourerofCods.cs index 25fe408bb1..edb65533dc 100644 --- a/Items/Fishing/FishingRods/TheDevourerofCods.cs +++ b/Items/Fishing/FishingRods/TheDevourerofCods.cs @@ -19,18 +19,18 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - item.width = 24; - item.height = 28; - item.useAnimation = 8; - item.useTime = 8; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.fishingPole = 75; - item.shootSpeed = 20f; - item.shoot = ModContent.ProjectileType(); - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 24; + Item.height = 28; + Item.useAnimation = 8; + Item.useTime = 8; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.fishingPole = 75; + Item.shootSpeed = 20f; + Item.shoot = ModContent.ProjectileType(); + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -46,11 +46,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs index 533c466513..cce8b0355c 100644 --- a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs +++ b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs @@ -16,26 +16,22 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - item.width = 24; - item.height = 28; - item.useAnimation = 8; - item.useTime = 8; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.fishingPole = 35; - item.shootSpeed = 15f; - item.shoot = ModContent.ProjectileType(); - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; + Item.width = 24; + Item.height = 28; + Item.useAnimation = 8; + Item.useTime = 8; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.fishingPole = 35; + Item.shootSpeed = 15f; + Item.shoot = ModContent.ProjectileType(); + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Fishing/FishingRods/WulfrumRod.cs b/Items/Fishing/FishingRods/WulfrumRod.cs index 9a6b380aa1..bef17aaa8c 100644 --- a/Items/Fishing/FishingRods/WulfrumRod.cs +++ b/Items/Fishing/FishingRods/WulfrumRod.cs @@ -15,26 +15,22 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - item.width = 24; - item.height = 28; - item.useAnimation = 8; - item.useTime = 8; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.rare = ItemRarityID.Blue; - item.fishingPole = 10; - item.shootSpeed = 10f; - item.shoot = ModContent.ProjectileType(); - item.value = Item.buyPrice(0, 1, 0, 0); + Item.width = 24; + Item.height = 28; + Item.useAnimation = 8; + Item.useTime = 8; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.rare = ItemRarityID.Blue; + Item.fishingPole = 10; + Item.shootSpeed = 10f; + Item.shoot = ModContent.ProjectileType(); + Item.value = Item.buyPrice(0, 1, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 9).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Fishing/FishofEleum.cs b/Items/Fishing/FishofEleum.cs index 30f762f0c6..f758753083 100644 --- a/Items/Fishing/FishofEleum.cs +++ b/Items/Fishing/FishofEleum.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - item.width = 30; - item.height = 28; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 10); - item.rare = ItemRarityID.Green; + Item.width = 30; + Item.height = 28; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; } public override bool CanRightClick() diff --git a/Items/Fishing/FishofFlight.cs b/Items/Fishing/FishofFlight.cs index c646954ae7..3c20c33bfc 100644 --- a/Items/Fishing/FishofFlight.cs +++ b/Items/Fishing/FishofFlight.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 30; - item.height = 30; - item.rare = ItemRarityID.Orange; - item.value = Item.sellPrice(gold: 1); + Item.maxStack = 999; + Item.consumable = true; + Item.width = 30; + Item.height = 30; + Item.rare = ItemRarityID.Orange; + Item.value = Item.sellPrice(gold: 1); } public override bool CanRightClick() diff --git a/Items/Fishing/FishofLight.cs b/Items/Fishing/FishofLight.cs index 197fe09605..3293c5db03 100644 --- a/Items/Fishing/FishofLight.cs +++ b/Items/Fishing/FishofLight.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 34; - item.height = 34; - item.rare = ItemRarityID.Orange; - item.value = Item.sellPrice(gold: 1); + Item.maxStack = 999; + Item.consumable = true; + Item.width = 34; + Item.height = 34; + Item.rare = ItemRarityID.Orange; + Item.value = Item.sellPrice(gold: 1); } public override bool CanRightClick() diff --git a/Items/Fishing/FishofNight.cs b/Items/Fishing/FishofNight.cs index 1125debafe..6310d09c00 100644 --- a/Items/Fishing/FishofNight.cs +++ b/Items/Fishing/FishofNight.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 34; - item.height = 34; - item.rare = ItemRarityID.Orange; - item.value = Item.sellPrice(gold: 1); + Item.maxStack = 999; + Item.consumable = true; + Item.width = 34; + Item.height = 34; + Item.rare = ItemRarityID.Orange; + Item.value = Item.sellPrice(gold: 1); } public override bool CanRightClick() diff --git a/Items/Fishing/GlimmeringGemfish.cs b/Items/Fishing/GlimmeringGemfish.cs index dc6f6d79c9..0c60820d0c 100644 --- a/Items/Fishing/GlimmeringGemfish.cs +++ b/Items/Fishing/GlimmeringGemfish.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 34; - item.height = 30; - item.rare = ItemRarityID.Green; - item.value = Item.sellPrice(silver: 50); + Item.maxStack = 999; + Item.consumable = true; + Item.width = 34; + Item.height = 30; + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(silver: 50); } public override bool CanRightClick() @@ -41,9 +41,9 @@ namespace CalamityMod.Items.Fishing Mod thorium = CalamityMod.Instance.thorium; if (thorium != null) { - DropHelper.DropItemChance(player, thorium.ItemType("Pearl"), 0.25f, gemMin, gemMax); - DropHelper.DropItemChance(player, thorium.ItemType("Opal"), 0.25f, gemMin, gemMax); - DropHelper.DropItemChance(player, thorium.ItemType("Onyx"), 0.25f, gemMin, gemMax); + DropHelper.DropItemChance(player, thorium.Find("Pearl").Type, 0.25f, gemMin, gemMax); + DropHelper.DropItemChance(player, thorium.Find("Opal").Type, 0.25f, gemMin, gemMax); + DropHelper.DropItemChance(player, thorium.Find("Onyx").Type, 0.25f, gemMin, gemMax); } } } diff --git a/Items/Fishing/Spadefish.cs b/Items/Fishing/Spadefish.cs index 4b4adbd7aa..13a2a02fe7 100644 --- a/Items/Fishing/Spadefish.cs +++ b/Items/Fishing/Spadefish.cs @@ -15,21 +15,21 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - item.damage = 15; - item.knockBack = 2f; - item.useTime = 7; - item.useAnimation = 20; - item.pick = 34; + Item.damage = 15; + Item.knockBack = 2f; + Item.useTime = 7; + Item.useAnimation = 20; + Item.pick = 34; - item.melee = true; - item.width = 46; - item.height = 44; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 46; + Item.height = 44; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } } } diff --git a/Items/Fishing/StuffedFish.cs b/Items/Fishing/StuffedFish.cs index 31ddac5f23..1e0be58c46 100644 --- a/Items/Fishing/StuffedFish.cs +++ b/Items/Fishing/StuffedFish.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 34; - item.height = 30; - item.rare = ItemRarityID.Green; - item.value = Item.sellPrice(silver: 50); + Item.maxStack = 999; + Item.consumable = true; + Item.width = 34; + Item.height = 30; + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(silver: 50); } public override bool CanRightClick() @@ -57,16 +57,16 @@ namespace CalamityMod.Items.Fishing Mod thorium = CalamityMod.Instance.thorium; if (thorium != null) { - DropHelper.DropItemChance(player, thorium.ItemType("MarineKelp"), 0.25f, herbMin, herbMax); - DropHelper.DropItemChance(player, thorium.ItemType("MarineKelpSeeds"), 0.1f, seedMin, seedMax); + DropHelper.DropItemChance(player, thorium.Find("MarineKelp").Type, 0.25f, herbMin, herbMax); + DropHelper.DropItemChance(player, thorium.Find("MarineKelpSeeds").Type, 0.1f, seedMin, seedMax); } Mod soa = CalamityMod.Instance.soa; if (soa != null) { - DropHelper.DropItemChance(player, soa.ItemType("Welkinbell"), 0.25f, herbMin, herbMax); - DropHelper.DropItemChance(player, soa.ItemType("WelkinbellSeeds"), 0.1f, seedMin, seedMax); - DropHelper.DropItemCondition(player, soa.ItemType("Illumifern"), Main.hardMode, 0.25f, herbMin, herbMax); - DropHelper.DropItemCondition(player, soa.ItemType("IllumifernSeeds"), Main.hardMode, 0.1f, seedMin, seedMax); + DropHelper.DropItemChance(player, soa.Find("Welkinbell").Type, 0.25f, herbMin, herbMax); + DropHelper.DropItemChance(player, soa.Find("WelkinbellSeeds").Type, 0.1f, seedMin, seedMax); + DropHelper.DropItemCondition(player, soa.Find("Illumifern").Type, Main.hardMode, 0.25f, herbMin, herbMax); + DropHelper.DropItemCondition(player, soa.Find("IllumifernSeeds").Type, Main.hardMode, 0.1f, seedMin, seedMax); // TODO -- There is no way to determine if SoA's Abaddon is dead without reflection. // Dan Yami has confirmed that downed calls will be added to SoA eventually. diff --git a/Items/Fishing/SulphurCatches/AbyssalCrate.cs b/Items/Fishing/SulphurCatches/AbyssalCrate.cs index 705e8d149e..4d79c621b7 100644 --- a/Items/Fishing/SulphurCatches/AbyssalCrate.cs +++ b/Items/Fishing/SulphurCatches/AbyssalCrate.cs @@ -28,18 +28,18 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 32; - item.height = 32; - item.rare = ItemRarityID.Green; - item.value = Item.sellPrice(gold: 1); - item.createTile = ModContent.TileType(); - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 32; + Item.height = 32; + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(gold: 1); + Item.createTile = ModContent.TileType(); + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; } public override bool CanRightClick() => true; diff --git a/Items/Fishing/SunbeamFish.cs b/Items/Fishing/SunbeamFish.cs index 04064781ac..648eae0375 100644 --- a/Items/Fishing/SunbeamFish.cs +++ b/Items/Fishing/SunbeamFish.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - item.width = 30; - item.height = 28; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 10); - item.rare = ItemRarityID.Green; + Item.width = 30; + Item.height = 28; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; } public override bool CanRightClick() diff --git a/Items/Fishing/SunkenSeaCatches/CoralskinFoolfish.cs b/Items/Fishing/SunkenSeaCatches/CoralskinFoolfish.cs index c95196ac98..771d428def 100644 --- a/Items/Fishing/SunkenSeaCatches/CoralskinFoolfish.cs +++ b/Items/Fishing/SunkenSeaCatches/CoralskinFoolfish.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 7); - item.rare = ItemRarityID.Green; + Item.width = 28; + Item.height = 28; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 7); + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs b/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs index 38c2df697d..7d39048b6d 100644 --- a/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs +++ b/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - item.questItem = true; - item.maxStack = 1; - item.width = 40; - item.height = 28; - item.uniqueStack = true; - item.rare = ItemRarityID.Quest; + Item.questItem = true; + Item.maxStack = 1; + Item.width = 40; + Item.height = 28; + Item.uniqueStack = true; + Item.rare = ItemRarityID.Quest; } public override bool IsQuestFish() @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void AnglerQuestChat(ref string description, ref string catchLocation) { - description = "You ever get to see what would happen if a lizard that lived in the desert scurried too deep underground? I did, and they sure are cool! But it’s way too slippery for me to get my hands on it now. You go and get it so I can keep it as a pet!"; + description = "You ever get to see what would happen if a lizard that lived in the desert scurried too deep underground? I did, and they sure are cool! But it’s way too slippery for me to get my hands on it now. You go and get it so I can keep it as a pet!"; catchLocation = "Caught in the Sunken Sea."; } } diff --git a/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs b/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs index f2e151f9ba..3696409034 100644 --- a/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs +++ b/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - item.width = 40; - item.height = 38; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 10); - item.rare = ItemRarityID.Orange; + Item.width = 40; + Item.height = 38; + Item.maxStack = 999; + Item.value = Item.sellPrice(gold: 10); + Item.rare = ItemRarityID.Orange; } } } diff --git a/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs b/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs index 04c2f65019..f357f2967d 100644 --- a/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs +++ b/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - item.width = 30; - item.height = 28; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 5); - item.rare = ItemRarityID.Green; + Item.width = 30; + Item.height = 28; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 5); + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Fishing/SunkenSeaCatches/RustedJingleBell.cs b/Items/Fishing/SunkenSeaCatches/RustedJingleBell.cs index 88ff6c0c70..d4cf66f786 100644 --- a/Items/Fishing/SunkenSeaCatches/RustedJingleBell.cs +++ b/Items/Fishing/SunkenSeaCatches/RustedJingleBell.cs @@ -17,18 +17,18 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - item.CloneDefaults(ItemID.WispinaBottle); - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); - item.value = Item.sellPrice(gold: 5); - item.rare = ItemRarityID.Orange; + Item.CloneDefaults(ItemID.WispinaBottle); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); + Item.value = Item.sellPrice(gold: 5); + Item.rare = ItemRarityID.Orange; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Fishing/SunkenSeaCatches/ScarredAngelfish.cs b/Items/Fishing/SunkenSeaCatches/ScarredAngelfish.cs index 70ca7d845d..3cc1eb2907 100644 --- a/Items/Fishing/SunkenSeaCatches/ScarredAngelfish.cs +++ b/Items/Fishing/SunkenSeaCatches/ScarredAngelfish.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - item.width = 28; - item.height = 26; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 7); - item.rare = ItemRarityID.Blue; + Item.width = 28; + Item.height = 26; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 7); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs b/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs index c9c90a612c..fc9f1c5b91 100644 --- a/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs +++ b/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs @@ -19,13 +19,13 @@ Pull Velocity: {SerpentsBiteHook.PullSpeed}"); public override void SetDefaults() { // Instead of copying these values, we can clone and modify the ones we want to copy - item.CloneDefaults(ItemID.AmethystHook); - item.shootSpeed = SerpentsBiteHook.LaunchSpeed; // how quickly the hook is shot. - item.shoot = ProjectileType(); - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.width = 30; - item.height = 32; + Item.CloneDefaults(ItemID.AmethystHook); + Item.shootSpeed = SerpentsBiteHook.LaunchSpeed; // how quickly the hook is shot. + Item.shoot = ProjectileType(); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.width = 30; + Item.height = 32; } } } diff --git a/Items/Fishing/SunkenSeaCatches/Serpentuna.cs b/Items/Fishing/SunkenSeaCatches/Serpentuna.cs index e4382d700e..61324b76d2 100644 --- a/Items/Fishing/SunkenSeaCatches/Serpentuna.cs +++ b/Items/Fishing/SunkenSeaCatches/Serpentuna.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - item.questItem = true; - item.maxStack = 1; - item.width = 36; - item.height = 40; - item.uniqueStack = true; - item.rare = ItemRarityID.Quest; + Item.questItem = true; + Item.maxStack = 1; + Item.width = 36; + Item.height = 40; + Item.uniqueStack = true; + Item.rare = ItemRarityID.Quest; } public override bool IsQuestFish() diff --git a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs index 9ed3d1cc76..f988257ac7 100644 --- a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs +++ b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs @@ -15,26 +15,26 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches DisplayName.SetDefault("Sparkling Empress"); Tooltip.SetDefault("Fires a concentrated laser to annihilate your foes\n" + "Defeated enemies explode into prism shards"); - Item.staff[item.type] = true; //so it doesn't look weird af when holding it + Item.staff[Item.type] = true; //so it doesn't look weird af when holding it } public override void SetDefaults() { - item.damage = BaseDamage; - item.noMelee = true; - item.magic = true; - item.channel = true; //Channel so that you can hold the weapon [Important] - item.rare = ItemRarityID.Green; - item.mana = 5; - item.width = 42; - item.height = 34; - item.useTime = 20; - item.useAnimation = 20; - item.UseSound = SoundID.Item13; - item.useStyle = ItemUseStyleID.HoldingOut; - item.shootSpeed = 14f; - item.shoot = ModContent.ProjectileType(); - item.value = Item.sellPrice(silver: 40); + Item.damage = BaseDamage; + Item.noMelee = true; + Item.DamageType = DamageClass.Magic; + Item.channel = true; //Channel so that you can hold the weapon [Important] + Item.rare = ItemRarityID.Green; + Item.mana = 5; + Item.width = 42; + Item.height = 34; + Item.useTime = 20; + Item.useAnimation = 20; + Item.UseSound = SoundID.Item13; + Item.useStyle = ItemUseStyleID.Shoot; + Item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.value = Item.sellPrice(silver: 40); } public override Vector2? HoldoutOrigin() //so it looks normal when holding diff --git a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs index 5582be1bd0..6fc3230c17 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs @@ -24,18 +24,18 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 32; - item.height = 32; - item.rare = ItemRarityID.Green; - item.value = Item.sellPrice(gold: 1); - item.createTile = ModContent.TileType(); - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 32; + Item.height = 32; + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(gold: 1); + Item.createTile = ModContent.TileType(); + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; } public override bool CanRightClick() => true; diff --git a/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs b/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs index 60b6f72f49..d79b3e8345 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs +++ b/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - item.width = 58; - item.height = 52; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 7); - item.rare = ItemRarityID.Green; + Item.width = 58; + Item.height = 52; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 7); + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Fishing/SunkenSeaCatches/SurfClam.cs b/Items/Fishing/SunkenSeaCatches/SurfClam.cs index 346f6833b6..0cb798181e 100644 --- a/Items/Fishing/SunkenSeaCatches/SurfClam.cs +++ b/Items/Fishing/SunkenSeaCatches/SurfClam.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - item.questItem = true; - item.maxStack = 1; - item.width = 20; - item.height = 20; - item.uniqueStack = true; - item.rare = ItemRarityID.Quest; + Item.questItem = true; + Item.maxStack = 1; + Item.width = 20; + Item.height = 20; + Item.uniqueStack = true; + Item.rare = ItemRarityID.Quest; } public override bool IsQuestFish() diff --git a/Items/Fishing/Xerocodile.cs b/Items/Fishing/Xerocodile.cs index b51b72304d..aeb4e6249e 100644 --- a/Items/Fishing/Xerocodile.cs +++ b/Items/Fishing/Xerocodile.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - item.width = 30; - item.height = 28; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 10); - item.rare = ItemRarityID.Green; + Item.width = 30; + Item.height = 28; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; } public override bool CanRightClick() diff --git a/Items/LabFinders/CyanSeekingMechanism.cs b/Items/LabFinders/CyanSeekingMechanism.cs index 268e979faf..ab91e0092e 100644 --- a/Items/LabFinders/CyanSeekingMechanism.cs +++ b/Items/LabFinders/CyanSeekingMechanism.cs @@ -17,28 +17,23 @@ namespace CalamityMod.Items.LabFinders public override void SetDefaults() { - item.width = 24; - item.height = 26; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = item.useAnimation = 36; - item.shoot = ModContent.ProjectileType(); - item.Calamity().MaxCharge = 100; - item.Calamity().ChargePerUse = 15; - item.Calamity().UsesCharge = true; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.width = 24; + Item.height = 26; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = Item.useAnimation = 36; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().MaxCharge = 100; + Item.Calamity().ChargePerUse = 15; + Item.Calamity().UsesCharge = true; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && CalamityWorld.SunkenSeaLabCenter != Vector2.Zero; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.SunkenSeaLabCenter != Vector2.Zero; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.WaterBucket).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/LabFinders/GreenSeekingMechanism.cs b/Items/LabFinders/GreenSeekingMechanism.cs index b1ce55d990..a47f059848 100644 --- a/Items/LabFinders/GreenSeekingMechanism.cs +++ b/Items/LabFinders/GreenSeekingMechanism.cs @@ -17,28 +17,23 @@ namespace CalamityMod.Items.LabFinders public override void SetDefaults() { - item.width = 24; - item.height = 26; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = item.useAnimation = 36; - item.shoot = ModContent.ProjectileType(); - item.Calamity().MaxCharge = 100; - item.Calamity().ChargePerUse = 15; - item.Calamity().UsesCharge = true; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.width = 24; + Item.height = 26; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = Item.useAnimation = 36; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().MaxCharge = 100; + Item.Calamity().ChargePerUse = 15; + Item.Calamity().UsesCharge = true; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && CalamityWorld.JungleLabCenter != Vector2.Zero; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.JungleLabCenter != Vector2.Zero; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Vine, 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Vine, 3).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/LabFinders/MysteriousMechanism.cs b/Items/LabFinders/MysteriousMechanism.cs index 73c75a3dba..770e69c185 100644 --- a/Items/LabFinders/MysteriousMechanism.cs +++ b/Items/LabFinders/MysteriousMechanism.cs @@ -14,21 +14,14 @@ namespace CalamityMod.Items.LabFinders public override void SetDefaults() { - item.width = 24; - item.height = 26; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.width = 24; + Item.height = 26; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.IronBar, 10); - recipe.anyIronBar = true; - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.IronBar, 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/LabFinders/PurpleSeekingMechanism.cs b/Items/LabFinders/PurpleSeekingMechanism.cs index f09ebbb682..09b6828c36 100644 --- a/Items/LabFinders/PurpleSeekingMechanism.cs +++ b/Items/LabFinders/PurpleSeekingMechanism.cs @@ -17,28 +17,23 @@ namespace CalamityMod.Items.LabFinders public override void SetDefaults() { - item.width = 24; - item.height = 26; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = item.useAnimation = 36; - item.shoot = ModContent.ProjectileType(); - item.Calamity().MaxCharge = 100; - item.Calamity().ChargePerUse = 15; - item.Calamity().UsesCharge = true; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.width = 24; + Item.height = 26; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = Item.useAnimation = 36; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().MaxCharge = 100; + Item.Calamity().ChargePerUse = 15; + Item.Calamity().UsesCharge = true; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && CalamityWorld.PlanetoidLabCenter != Vector2.Zero; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.PlanetoidLabCenter != Vector2.Zero; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Cloud, 20); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Cloud, 20).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/LabFinders/RedSeekingMechanism.cs b/Items/LabFinders/RedSeekingMechanism.cs index 6294e83d20..220b41fa95 100644 --- a/Items/LabFinders/RedSeekingMechanism.cs +++ b/Items/LabFinders/RedSeekingMechanism.cs @@ -17,28 +17,23 @@ namespace CalamityMod.Items.LabFinders public override void SetDefaults() { - item.width = 24; - item.height = 26; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = item.useAnimation = 36; - item.shoot = ModContent.ProjectileType(); - item.Calamity().MaxCharge = 100; - item.Calamity().ChargePerUse = 15; - item.Calamity().UsesCharge = true; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.width = 24; + Item.height = 26; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = Item.useAnimation = 36; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().MaxCharge = 100; + Item.Calamity().ChargePerUse = 15; + Item.Calamity().UsesCharge = true; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && CalamityWorld.HellLabCenter != Vector2.Zero; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.HellLabCenter != Vector2.Zero; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.HellstoneBar, 4); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.HellstoneBar, 4).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/LabFinders/YellowSeekingMechanism.cs b/Items/LabFinders/YellowSeekingMechanism.cs index 245eed0f52..903ccc24c6 100644 --- a/Items/LabFinders/YellowSeekingMechanism.cs +++ b/Items/LabFinders/YellowSeekingMechanism.cs @@ -17,28 +17,23 @@ namespace CalamityMod.Items.LabFinders public override void SetDefaults() { - item.width = 24; - item.height = 26; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = item.useAnimation = 36; - item.shoot = ModContent.ProjectileType(); - item.Calamity().MaxCharge = 100; - item.Calamity().ChargePerUse = 15; - item.Calamity().UsesCharge = true; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.width = 24; + Item.height = 26; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = Item.useAnimation = 36; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().MaxCharge = 100; + Item.Calamity().ChargePerUse = 15; + Item.Calamity().UsesCharge = true; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && CalamityWorld.IceLabCenter != Vector2.Zero; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.IceLabCenter != Vector2.Zero; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.IceBlock, 50); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.IceBlock, 50).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/LoreItems/KnowledgeAquaticScourge.cs b/Items/LoreItems/KnowledgeAquaticScourge.cs index fecd7d84a5..6f6f0a571a 100644 --- a/Items/LoreItems/KnowledgeAquaticScourge.cs +++ b/Items/LoreItems/KnowledgeAquaticScourge.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Pink; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeAstralInfection.cs b/Items/LoreItems/KnowledgeAstralInfection.cs index 4aa8c66429..1603cacc03 100644 --- a/Items/LoreItems/KnowledgeAstralInfection.cs +++ b/Items/LoreItems/KnowledgeAstralInfection.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Cyan; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Cyan; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeAstrumAureus.cs b/Items/LoreItems/KnowledgeAstrumAureus.cs index 0d51d1f8d5..f41ae1ed0c 100644 --- a/Items/LoreItems/KnowledgeAstrumAureus.cs +++ b/Items/LoreItems/KnowledgeAstrumAureus.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Lime; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Lime; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeAstrumDeus.cs b/Items/LoreItems/KnowledgeAstrumDeus.cs index e83f641dcb..f928d692b0 100644 --- a/Items/LoreItems/KnowledgeAstrumDeus.cs +++ b/Items/LoreItems/KnowledgeAstrumDeus.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Cyan; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Cyan; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeBloodMoon.cs b/Items/LoreItems/KnowledgeBloodMoon.cs index f17a603c66..2852085654 100644 --- a/Items/LoreItems/KnowledgeBloodMoon.cs +++ b/Items/LoreItems/KnowledgeBloodMoon.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Cyan; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Cyan; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.AncientCultistTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.AncientCultistTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeBrainofCthulhu.cs b/Items/LoreItems/KnowledgeBrainofCthulhu.cs index 24a90fa7ee..e33e2b0884 100644 --- a/Items/LoreItems/KnowledgeBrainofCthulhu.cs +++ b/Items/LoreItems/KnowledgeBrainofCthulhu.cs @@ -16,15 +16,15 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Green; - item.autoReuse = false; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = 20; - item.useTime = 20; - item.UseSound = SoundID.Item8; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.autoReuse = false; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = 20; + Item.useTime = 20; + Item.UseSound = SoundID.Item8; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -34,12 +34,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.BrainofCthulhuTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.BrainofCthulhuTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeBrimstoneCrag.cs b/Items/LoreItems/KnowledgeBrimstoneCrag.cs index 5d35401607..1776723d3f 100644 --- a/Items/LoreItems/KnowledgeBrimstoneCrag.cs +++ b/Items/LoreItems/KnowledgeBrimstoneCrag.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Pink; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeBrimstoneElemental.cs b/Items/LoreItems/KnowledgeBrimstoneElemental.cs index 394839c54e..782cbdb800 100644 --- a/Items/LoreItems/KnowledgeBrimstoneElemental.cs +++ b/Items/LoreItems/KnowledgeBrimstoneElemental.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Pink; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeBumblebirb.cs b/Items/LoreItems/KnowledgeBumblebirb.cs index 1ae55eaa63..3b51dc6ad0 100644 --- a/Items/LoreItems/KnowledgeBumblebirb.cs +++ b/Items/LoreItems/KnowledgeBumblebirb.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Purple; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Purple; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeCalamitas.cs b/Items/LoreItems/KnowledgeCalamitas.cs index 0f0c673392..cdeb4b9145 100644 --- a/Items/LoreItems/KnowledgeCalamitas.cs +++ b/Items/LoreItems/KnowledgeCalamitas.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Red; - item.consumable = false; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Red; + Item.consumable = false; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool CanUseItem(Player player) @@ -32,12 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeCalamitasClone.cs b/Items/LoreItems/KnowledgeCalamitasClone.cs index bcac5714fa..3d7f829250 100644 --- a/Items/LoreItems/KnowledgeCalamitasClone.cs +++ b/Items/LoreItems/KnowledgeCalamitasClone.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Pink; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeCorruption.cs b/Items/LoreItems/KnowledgeCorruption.cs index 3ae1371ac0..8a74f3ef9e 100644 --- a/Items/LoreItems/KnowledgeCorruption.cs +++ b/Items/LoreItems/KnowledgeCorruption.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Green; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.EaterofWorldsTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.EaterofWorldsTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeCrabulon.cs b/Items/LoreItems/KnowledgeCrabulon.cs index eeb512a32f..3c6716e64e 100644 --- a/Items/LoreItems/KnowledgeCrabulon.cs +++ b/Items/LoreItems/KnowledgeCrabulon.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Green; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeCrimson.cs b/Items/LoreItems/KnowledgeCrimson.cs index e72e23e9de..e37866f347 100644 --- a/Items/LoreItems/KnowledgeCrimson.cs +++ b/Items/LoreItems/KnowledgeCrimson.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Green; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.BrainofCthulhuTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.BrainofCthulhuTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeCryogen.cs b/Items/LoreItems/KnowledgeCryogen.cs index b7fcd15af6..6a8837936a 100644 --- a/Items/LoreItems/KnowledgeCryogen.cs +++ b/Items/LoreItems/KnowledgeCryogen.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Pink; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeDesertScourge.cs b/Items/LoreItems/KnowledgeDesertScourge.cs index 8e286bb374..8bf254ab93 100644 --- a/Items/LoreItems/KnowledgeDesertScourge.cs +++ b/Items/LoreItems/KnowledgeDesertScourge.cs @@ -18,10 +18,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -31,12 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeDestroyer.cs b/Items/LoreItems/KnowledgeDestroyer.cs index f09fa48043..3b4127ec53 100644 --- a/Items/LoreItems/KnowledgeDestroyer.cs +++ b/Items/LoreItems/KnowledgeDestroyer.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Pink; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.DestroyerTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.DestroyerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeDevourerofGods.cs b/Items/LoreItems/KnowledgeDevourerofGods.cs index c90ba6935d..f19867c514 100644 --- a/Items/LoreItems/KnowledgeDevourerofGods.cs +++ b/Items/LoreItems/KnowledgeDevourerofGods.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Items.LoreItems public override void SetStaticDefaults() { DisplayName.SetDefault("The Devourer of Gods"); - Tooltip.SetDefault("This serpent’s power to assimilate the abilities and energy of those it consumed is unique in almost all the known cosmos, save for its lesser brethren.\n" + + Tooltip.SetDefault("This serpent’s power to assimilate the abilities and energy of those it consumed is unique in almost all the known cosmos, save for its lesser brethren.\n" + "I would have soon had to eliminate it as a threat had it been given more time and creatures to feast upon."); } public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Red; - item.consumable = false; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Red; + Item.consumable = false; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool CanUseItem(Player player) @@ -31,12 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeDukeFishron.cs b/Items/LoreItems/KnowledgeDukeFishron.cs index a49154256d..e916589ba0 100644 --- a/Items/LoreItems/KnowledgeDukeFishron.cs +++ b/Items/LoreItems/KnowledgeDukeFishron.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Yellow; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Yellow; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.DukeFishronTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.DukeFishronTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeEaterofWorlds.cs b/Items/LoreItems/KnowledgeEaterofWorlds.cs index 7bab4cf417..cf92ee054b 100644 --- a/Items/LoreItems/KnowledgeEaterofWorlds.cs +++ b/Items/LoreItems/KnowledgeEaterofWorlds.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Green; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.EaterofWorldsTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.EaterofWorldsTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeExoMechs.cs b/Items/LoreItems/KnowledgeExoMechs.cs index da9684b23d..07c194dbab 100644 --- a/Items/LoreItems/KnowledgeExoMechs.cs +++ b/Items/LoreItems/KnowledgeExoMechs.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Red; - item.consumable = false; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Red; + Item.consumable = false; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool CanUseItem(Player player) => false; @@ -29,33 +29,10 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); - - r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); - - r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); - - r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeEyeofCthulhu.cs b/Items/LoreItems/KnowledgeEyeofCthulhu.cs index a4342feed6..c2b907d5a3 100644 --- a/Items/LoreItems/KnowledgeEyeofCthulhu.cs +++ b/Items/LoreItems/KnowledgeEyeofCthulhu.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.EyeofCthulhuTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.EyeofCthulhuTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeGolem.cs b/Items/LoreItems/KnowledgeGolem.cs index 294b10353f..785af11819 100644 --- a/Items/LoreItems/KnowledgeGolem.cs +++ b/Items/LoreItems/KnowledgeGolem.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Yellow; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Yellow; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.GolemTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.GolemTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeHiveMind.cs b/Items/LoreItems/KnowledgeHiveMind.cs index 6d02f0417a..e1e1f82019 100644 --- a/Items/LoreItems/KnowledgeHiveMind.cs +++ b/Items/LoreItems/KnowledgeHiveMind.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Orange; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Orange; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeKingSlime.cs b/Items/LoreItems/KnowledgeKingSlime.cs index a3abde01f7..170b645309 100644 --- a/Items/LoreItems/KnowledgeKingSlime.cs +++ b/Items/LoreItems/KnowledgeKingSlime.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Blue; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.KingSlimeTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.KingSlimeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeLeviathanandSiren.cs b/Items/LoreItems/KnowledgeLeviathanandSiren.cs index 9475c6584d..4d078812a2 100644 --- a/Items/LoreItems/KnowledgeLeviathanandSiren.cs +++ b/Items/LoreItems/KnowledgeLeviathanandSiren.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Lime; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Lime; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeLunaticCultist.cs b/Items/LoreItems/KnowledgeLunaticCultist.cs index ecb940d5f7..dad2701a7d 100644 --- a/Items/LoreItems/KnowledgeLunaticCultist.cs +++ b/Items/LoreItems/KnowledgeLunaticCultist.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Cyan; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Cyan; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.AncientCultistTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.AncientCultistTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeMechs.cs b/Items/LoreItems/KnowledgeMechs.cs index 38e780605a..afaa6b9ede 100644 --- a/Items/LoreItems/KnowledgeMechs.cs +++ b/Items/LoreItems/KnowledgeMechs.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Pink; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,33 +29,10 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.RetinazerTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); - - r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.SpazmatismTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); - - r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.DestroyerTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); - - r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.SkeletronPrimeTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.RetinazerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SpazmatismTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.DestroyerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SkeletronPrimeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeMoonLord.cs b/Items/LoreItems/KnowledgeMoonLord.cs index cfa258c212..b9557b1d02 100644 --- a/Items/LoreItems/KnowledgeMoonLord.cs +++ b/Items/LoreItems/KnowledgeMoonLord.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Red; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Red; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.MoonLordTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.MoonLordTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeOcean.cs b/Items/LoreItems/KnowledgeOcean.cs index 1f4d9f5695..cef4bdd826 100644 --- a/Items/LoreItems/KnowledgeOcean.cs +++ b/Items/LoreItems/KnowledgeOcean.cs @@ -17,22 +17,17 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Lime; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Lime; + Item.consumable = false; } public override bool CanUseItem(Player player) => false; public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeOldDuke.cs b/Items/LoreItems/KnowledgeOldDuke.cs index 31f4ada2f9..8394c1a1df 100644 --- a/Items/LoreItems/KnowledgeOldDuke.cs +++ b/Items/LoreItems/KnowledgeOldDuke.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgePerforators.cs b/Items/LoreItems/KnowledgePerforators.cs index a975dcd4ba..78de00c5d7 100644 --- a/Items/LoreItems/KnowledgePerforators.cs +++ b/Items/LoreItems/KnowledgePerforators.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Orange; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Orange; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs index 5ed6663fa7..737fca46df 100644 --- a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs +++ b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Yellow; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Yellow; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgePlantera.cs b/Items/LoreItems/KnowledgePlantera.cs index 20914afe80..62494a2d86 100644 --- a/Items/LoreItems/KnowledgePlantera.cs +++ b/Items/LoreItems/KnowledgePlantera.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.LightPurple; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.LightPurple; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.PlanteraTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.PlanteraTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgePolterghast.cs b/Items/LoreItems/KnowledgePolterghast.cs index 41bc94b7e9..e7d16fdea9 100644 --- a/Items/LoreItems/KnowledgePolterghast.cs +++ b/Items/LoreItems/KnowledgePolterghast.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Red; - item.consumable = false; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Red; + Item.consumable = false; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool CanUseItem(Player player) @@ -31,12 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeProfanedGuardians.cs b/Items/LoreItems/KnowledgeProfanedGuardians.cs index dc5e0e9e13..73ebb6eddf 100644 --- a/Items/LoreItems/KnowledgeProfanedGuardians.cs +++ b/Items/LoreItems/KnowledgeProfanedGuardians.cs @@ -18,10 +18,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Purple; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Purple; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -31,12 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeProvidence.cs b/Items/LoreItems/KnowledgeProvidence.cs index cfd24f48a8..7baa711ca1 100644 --- a/Items/LoreItems/KnowledgeProvidence.cs +++ b/Items/LoreItems/KnowledgeProvidence.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Red; - item.consumable = false; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Red; + Item.consumable = false; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool CanUseItem(Player player) @@ -31,12 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeQueenBee.cs b/Items/LoreItems/KnowledgeQueenBee.cs index 50a87ac513..bef9984d4c 100644 --- a/Items/LoreItems/KnowledgeQueenBee.cs +++ b/Items/LoreItems/KnowledgeQueenBee.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Orange; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Orange; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -28,12 +28,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.QueenBeeTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.QueenBeeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeRavager.cs b/Items/LoreItems/KnowledgeRavager.cs index a3e6480e5c..078fb463ee 100644 --- a/Items/LoreItems/KnowledgeRavager.cs +++ b/Items/LoreItems/KnowledgeRavager.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Yellow; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Yellow; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeSentinels.cs b/Items/LoreItems/KnowledgeSentinels.cs index 9afd1c40dd..e1e8136e26 100644 --- a/Items/LoreItems/KnowledgeSentinels.cs +++ b/Items/LoreItems/KnowledgeSentinels.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Sentinels of the Devourer"); Tooltip.SetDefault("Signus. The Void. The Weaver.\n" + - "Each represent one of the Devourer’s largest spheres of influence.\n" + + "Each represent one of the Devourer’s largest spheres of influence.\n" + "Dispatching them has most likely invoked its anger and marked you as a target for destruction."); } public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Red; - item.consumable = false; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Red; + Item.consumable = false; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool CanUseItem(Player player) @@ -32,26 +32,9 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); - - r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); - - r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeSkeletron.cs b/Items/LoreItems/KnowledgeSkeletron.cs index f9e8fe573c..21cc939172 100644 --- a/Items/LoreItems/KnowledgeSkeletron.cs +++ b/Items/LoreItems/KnowledgeSkeletron.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Orange; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Orange; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.SkeletronTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SkeletronTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeSkeletronPrime.cs b/Items/LoreItems/KnowledgeSkeletronPrime.cs index 9db68d5dbc..46d58412a6 100644 --- a/Items/LoreItems/KnowledgeSkeletronPrime.cs +++ b/Items/LoreItems/KnowledgeSkeletronPrime.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Pink; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.SkeletronPrimeTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SkeletronPrimeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeSlimeGod.cs b/Items/LoreItems/KnowledgeSlimeGod.cs index 19d51513be..62c8b5feb5 100644 --- a/Items/LoreItems/KnowledgeSlimeGod.cs +++ b/Items/LoreItems/KnowledgeSlimeGod.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.LightRed; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.LightRed; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeSulphurSea.cs b/Items/LoreItems/KnowledgeSulphurSea.cs index 62d8848606..7e1f10e49f 100644 --- a/Items/LoreItems/KnowledgeSulphurSea.cs +++ b/Items/LoreItems/KnowledgeSulphurSea.cs @@ -17,22 +17,17 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Pink; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; } public override bool CanUseItem(Player player) => false; public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeTwins.cs b/Items/LoreItems/KnowledgeTwins.cs index be494a8056..f1f31ed837 100644 --- a/Items/LoreItems/KnowledgeTwins.cs +++ b/Items/LoreItems/KnowledgeTwins.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Pink; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,19 +29,8 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.RetinazerTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); - - r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.SpazmatismTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.RetinazerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SpazmatismTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeUnderworld.cs b/Items/LoreItems/KnowledgeUnderworld.cs index 61eef92eb1..177ced9c7e 100644 --- a/Items/LoreItems/KnowledgeUnderworld.cs +++ b/Items/LoreItems/KnowledgeUnderworld.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.LightRed; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.LightRed; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,12 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.WallofFleshTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.WallofFleshTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeWallofFlesh.cs b/Items/LoreItems/KnowledgeWallofFlesh.cs index 44b2083a22..dcede7d756 100644 --- a/Items/LoreItems/KnowledgeWallofFlesh.cs +++ b/Items/LoreItems/KnowledgeWallofFlesh.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.LightRed; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.LightRed; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,12 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ItemID.WallofFleshTrophy); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.WallofFleshTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeYharon.cs b/Items/LoreItems/KnowledgeYharon.cs index 85c5e1680a..27cde18dcf 100644 --- a/Items/LoreItems/KnowledgeYharon.cs +++ b/Items/LoreItems/KnowledgeYharon.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.LoreItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Red; - item.consumable = false; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Red; + Item.consumable = false; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool CanUseItem(Player player) @@ -31,12 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddRecipe(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/Materials/AerialiteBar.cs b/Items/Materials/AerialiteBar.cs index f4c5a38c59..b63b829649 100644 --- a/Items/Materials/AerialiteBar.cs +++ b/Items/Materials/AerialiteBar.cs @@ -15,27 +15,23 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 30); - item.rare = ItemRarityID.Orange; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.width = 30; + Item.height = 24; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 30); + Item.rare = ItemRarityID.Orange; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.Furnaces); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.Furnaces).Register(); } } } diff --git a/Items/Materials/AncientBoneDust.cs b/Items/Materials/AncientBoneDust.cs index 421b595bd5..d0499a5659 100644 --- a/Items/Materials/AncientBoneDust.cs +++ b/Items/Materials/AncientBoneDust.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 1); - item.rare = ItemRarityID.Blue; + Item.width = 20; + Item.height = 20; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 1); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Materials/ArmoredShell.cs b/Items/Materials/ArmoredShell.cs index 08ab88d223..1f15533f15 100644 --- a/Items/Materials/ArmoredShell.cs +++ b/Items/Materials/ArmoredShell.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 46; - item.height = 34; - item.maxStack = 999; - item.value = Item.buyPrice(0, 7, 0, 0); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 46; + Item.height = 34; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 7, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } } } diff --git a/Items/Materials/AscendantSpiritEssence.cs b/Items/Materials/AscendantSpiritEssence.cs index 1395450cae..6865d469b6 100644 --- a/Items/Materials/AscendantSpiritEssence.cs +++ b/Items/Materials/AscendantSpiritEssence.cs @@ -15,48 +15,41 @@ namespace CalamityMod.Items.Materials { DisplayName.SetDefault("Ascendant Spirit Essence"); Tooltip.SetDefault("A catalyst of the highest caliber formed by fusing powerful souls"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); } public override void SetDefaults() { - item.width = 32; - item.height = 54; - item.maxStack = 999; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = Item.sellPrice(gold: 40); + Item.width = 32; + Item.height = 54; + Item.maxStack = 999; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = Item.sellPrice(gold: 40); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = Main.itemTexture[item.type]; - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = Main.itemTexture[Item.type]; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/AscendantSpiritEssenceGlow"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/AscendantSpiritEssenceGlow"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 1.2f * brightness, 0.4f * brightness, 0.8f); + Lighting.AddLight(Item.Center, 1.2f * brightness, 0.4f * brightness, 0.8f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Materials/AuricBar.cs b/Items/Materials/AuricBar.cs index 5b30482214..98f0a68b6f 100644 --- a/Items/Materials/AuricBar.cs +++ b/Items/Materials/AuricBar.cs @@ -21,18 +21,18 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.width = 50; - item.height = 30; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 60); - item.Calamity().customRarity = CalamityRarity.Violet; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.width = 50; + Item.height = 30; + Item.maxStack = 999; + Item.value = Item.sellPrice(gold: 60); + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; } public override void UseStyle(Player player) @@ -42,38 +42,33 @@ namespace CalamityMod.Items.Materials public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/AuricBar_Animated"); - spriteBatch.Draw(texture, position, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/AuricBar_Animated"); + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15), Color.White, 0f, origin, scale, SpriteEffects.None, 0); return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/AuricBar_Animated"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/AuricBar_Animated"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/AuricBarGlow"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/AuricBarGlow"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0.5f * brightness, 0.7f * brightness, 0f); + Lighting.AddLight(Item.Center, 0.5f * brightness, 0.7f * brightness, 0f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 60); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this, 5); - recipe.AddRecipe(); + CreateRecipe(5).AddIngredient(ModContent.ItemType(), 60).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Materials/BarofLife.cs b/Items/Materials/BarofLife.cs index 8b5de850f4..58f49c09cf 100644 --- a/Items/Materials/BarofLife.cs +++ b/Items/Materials/BarofLife.cs @@ -13,22 +13,16 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 3); - item.rare = ItemRarityID.Yellow; + Item.width = 30; + Item.height = 24; + Item.maxStack = 999; + Item.value = Item.sellPrice(gold: 3); + Item.rare = ItemRarityID.Yellow; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Materials/BeetleJuice.cs b/Items/Materials/BeetleJuice.cs index 605166a185..d1238b6484 100644 --- a/Items/Materials/BeetleJuice.cs +++ b/Items/Materials/BeetleJuice.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 16); - item.rare = ItemRarityID.LightRed; + Item.width = 20; + Item.height = 20; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 16); + Item.rare = ItemRarityID.LightRed; } } } diff --git a/Items/Materials/BlightedLens.cs b/Items/Materials/BlightedLens.cs index 3389fc76f6..a93bae0472 100644 --- a/Items/Materials/BlightedLens.cs +++ b/Items/Materials/BlightedLens.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 16; - item.height = 22; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 56); - item.rare = ItemRarityID.Pink; + Item.width = 16; + Item.height = 22; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 56); + Item.rare = ItemRarityID.Pink; } } } diff --git a/Items/Materials/BloodOrb.cs b/Items/Materials/BloodOrb.cs index 2e58842720..6d1f5791ae 100644 --- a/Items/Materials/BloodOrb.cs +++ b/Items/Materials/BloodOrb.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 10; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 1, copper: 20); - item.rare = ItemRarityID.Blue; + Item.width = 10; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 1, copper: 20); + Item.rare = ItemRarityID.Blue; } public override void Update(ref float gravity, ref float maxFallSpeed) { float num = Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (item.width / 2)) / 16f), (int)((item.position.Y + (item.height / 2)) / 16f), 0.75f * num, 0f, 0f); + Lighting.AddLight((int)((Item.position.X + (Item.width / 2)) / 16f), (int)((Item.position.Y + (Item.height / 2)) / 16f), 0.75f * num, 0f, 0f); } } } diff --git a/Items/Materials/BloodSample.cs b/Items/Materials/BloodSample.cs index 9fc3092e62..9c45d3e254 100644 --- a/Items/Materials/BloodSample.cs +++ b/Items/Materials/BloodSample.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 26; - item.height = 34; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = ItemRarityID.Orange; + Item.width = 26; + Item.height = 34; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 0, 50, 0); + Item.rare = ItemRarityID.Orange; } } } diff --git a/Items/Materials/Bloodstone.cs b/Items/Materials/Bloodstone.cs index be993f3852..243db9af20 100644 --- a/Items/Materials/Bloodstone.cs +++ b/Items/Materials/Bloodstone.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 60); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 60); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } } } diff --git a/Items/Materials/BloodstoneCore.cs b/Items/Materials/BloodstoneCore.cs index 1d46f0bb0d..d6631d230e 100644 --- a/Items/Materials/BloodstoneCore.cs +++ b/Items/Materials/BloodstoneCore.cs @@ -13,23 +13,17 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 4); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 15; + Item.height = 12; + Item.maxStack = 999; + Item.value = Item.sellPrice(gold: 4); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.AdamantiteForge).Register(); } } } diff --git a/Items/Materials/CalamitousEssence.cs b/Items/Materials/CalamitousEssence.cs index 3251382159..5ea6ea7e35 100644 --- a/Items/Materials/CalamitousEssence.cs +++ b/Items/Materials/CalamitousEssence.cs @@ -14,17 +14,17 @@ namespace CalamityMod.Items.Materials { DisplayName.SetDefault("Ashes of Annihilation"); Tooltip.SetDefault("The smoldering essence of the Witch's wrath"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(7, 6)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(7, 6)); } public override void SetDefaults() { - item.width = 54; - item.height = 56; - item.maxStack = 999; - item.rare = ItemRarityID.Purple; - item.value = Item.sellPrice(gold: 66, silver: 66, copper: 66); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 54; + Item.height = 56; + Item.maxStack = 999; + Item.rare = ItemRarityID.Purple; + Item.value = Item.sellPrice(gold: 66, silver: 66, copper: 66); + Item.Calamity().customRarity = CalamityRarity.Violet; } public void DrawPulsingAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Materials { float scale = baseScale * MathHelper.Lerp(1f, 1.45f, pulse); Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * outwardness - Vector2.UnitY * 2f; - spriteBatch.Draw(Main.itemTexture[item.type], drawPosition, frame, drawColor, item.velocity.X * 0.2f, frame.Size() * 0.5f, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(Main.itemTexture[Item.type], drawPosition, frame, drawColor, Item.velocity.X * 0.2f, frame.Size() * 0.5f, scale, SpriteEffects.None, 0f); } } @@ -49,15 +49,15 @@ namespace CalamityMod.Items.Materials public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Rectangle frame = Main.itemAnimations[item.type].GetFrame(Main.itemTexture[item.type]); - DrawPulsingAfterimage(spriteBatch, item.position - Main.screenPosition + frame.Size() * 0.5f, frame, scale); + Rectangle frame = Main.itemAnimations[Item.type].GetFrame(Main.itemTexture[Item.type]); + DrawPulsingAfterimage(spriteBatch, Item.position - Main.screenPosition + frame.Size() * 0.5f, frame, scale); return true; } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0.34f * brightness, 0.08f * brightness, 0.155f * brightness); + Lighting.AddLight(Item.Center, 0.34f * brightness, 0.08f * brightness, 0.155f * brightness); } } } diff --git a/Items/Materials/CalamityDust.cs b/Items/Materials/CalamityDust.cs index 451514ac6a..15f16da1d9 100644 --- a/Items/Materials/CalamityDust.cs +++ b/Items/Materials/CalamityDust.cs @@ -10,23 +10,23 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { DisplayName.SetDefault("Ashes of Calamity"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5)); } public override void SetDefaults() { - item.width = 26; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 4, 50, 0); - item.rare = ItemRarityID.Lime; + Item.width = 26; + Item.height = 20; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 4, 50, 0); + Item.rare = ItemRarityID.Lime; } public override void Update(ref float gravity, ref float maxFallSpeed) { float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.25f * num, 0.05f * num, 0.25f * num); + Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.25f * num, 0.05f * num, 0.25f * num); } } } diff --git a/Items/Materials/CoreofCalamity.cs b/Items/Materials/CoreofCalamity.cs index 9749c51e27..2329bb9580 100644 --- a/Items/Materials/CoreofCalamity.cs +++ b/Items/Materials/CoreofCalamity.cs @@ -15,28 +15,21 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 36; - item.height = 36; - item.maxStack = 99; - item.value = Item.sellPrice(gold: 4); - item.rare = ItemRarityID.Yellow; + Item.width = 36; + Item.height = 36; + Item.maxStack = 99; + Item.value = Item.sellPrice(gold: 4); + Item.rare = ItemRarityID.Yellow; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Materials/CoreofCalamityGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Materials/CoreofCalamityGlow")); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Materials/CoreofChaos.cs b/Items/Materials/CoreofChaos.cs index 99b7d5015e..6246e3ab06 100644 --- a/Items/Materials/CoreofChaos.cs +++ b/Items/Materials/CoreofChaos.cs @@ -15,32 +15,27 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 36; - item.height = 36; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 40); - item.rare = ItemRarityID.Yellow; + Item.width = 36; + Item.height = 36; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 40); + Item.rare = ItemRarityID.Yellow; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Materials/CoreofChaosGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Materials/CoreofChaosGlow")); } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0.5f * brightness, 0.3f * brightness, 0.05f * brightness); + Lighting.AddLight(Item.Center, 0.5f * brightness, 0.3f * brightness, 0.05f * brightness); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Ectoplasm); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 3); - recipe.AddRecipe(); + CreateRecipe(3).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Ectoplasm).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Materials/CoreofCinder.cs b/Items/Materials/CoreofCinder.cs index 4d39d70b24..aecc36f9b3 100644 --- a/Items/Materials/CoreofCinder.cs +++ b/Items/Materials/CoreofCinder.cs @@ -15,32 +15,27 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 34; - item.height = 34; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 40); - item.rare = ItemRarityID.Yellow; + Item.width = 34; + Item.height = 34; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 40); + Item.rare = ItemRarityID.Yellow; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Materials/CoreofCinderGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Materials/CoreofCinderGlow")); } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0.3f * brightness, 0.3f * brightness, 0.05f * brightness); + Lighting.AddLight(Item.Center, 0.3f * brightness, 0.3f * brightness, 0.05f * brightness); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Ectoplasm); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 3); - recipe.AddRecipe(); + CreateRecipe(3).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Ectoplasm).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Materials/CoreofEleum.cs b/Items/Materials/CoreofEleum.cs index b88aa4581b..9197f914da 100644 --- a/Items/Materials/CoreofEleum.cs +++ b/Items/Materials/CoreofEleum.cs @@ -15,32 +15,27 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 34; - item.height = 34; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 40); - item.rare = ItemRarityID.Yellow; + Item.width = 34; + Item.height = 34; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 40); + Item.rare = ItemRarityID.Yellow; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Materials/CoreofEleumGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Materials/CoreofEleumGlow")); } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0.15f * brightness, 0.05f * brightness, 0.5f * brightness); + Lighting.AddLight(Item.Center, 0.15f * brightness, 0.05f * brightness, 0.5f * brightness); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Ectoplasm); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 3); - recipe.AddRecipe(); + CreateRecipe(3).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Ectoplasm).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Materials/CorrodedFossil.cs b/Items/Materials/CorrodedFossil.cs index 08343ebfe1..111c013011 100644 --- a/Items/Materials/CorrodedFossil.cs +++ b/Items/Materials/CorrodedFossil.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 30; - item.height = 28; - item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = ItemRarityID.Pink; + Item.width = 30; + Item.height = 28; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 3, 0, 0); + Item.rare = ItemRarityID.Pink; } } } diff --git a/Items/Materials/CosmiliteBar.cs b/Items/Materials/CosmiliteBar.cs index a1177e0edb..a6c4a4dc5a 100644 --- a/Items/Materials/CosmiliteBar.cs +++ b/Items/Materials/CosmiliteBar.cs @@ -20,39 +20,39 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 20); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.width = 30; + Item.height = 24; + Item.maxStack = 999; + Item.value = Item.sellPrice(gold: 20); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/CosmiliteBar_Animated"); - spriteBatch.Draw(texture, position, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/CosmiliteBar_Animated"); + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), Color.White, 0f, origin, scale, SpriteEffects.None, 0); return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/CosmiliteBar_Animated"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/CosmiliteBar_Animated"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0.5f * brightness, 0f, 0.5f * brightness); + Lighting.AddLight(Item.Center, 0.5f * brightness, 0f, 0.5f * brightness); } } } diff --git a/Items/Materials/CruptixBar.cs b/Items/Materials/CruptixBar.cs index d284021faf..4d2e53c76e 100644 --- a/Items/Materials/CruptixBar.cs +++ b/Items/Materials/CruptixBar.cs @@ -20,41 +20,37 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 40; - item.height = 52; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 1, silver: 20); - item.rare = ItemRarityID.Yellow; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 40; + Item.height = 52; + Item.maxStack = 999; + Item.value = Item.sellPrice(gold: 1, silver: 20); + Item.rare = ItemRarityID.Yellow; } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/CruptixBar_Animated"); - spriteBatch.Draw(texture, position, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/CruptixBar_Animated"); + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), Color.White, 0f, origin, scale, SpriteEffects.None, 0); return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/CruptixBar_Animated"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/CruptixBar_Animated"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.AdamantiteForge).Register(); } } } diff --git a/Items/Materials/DarkPlasma.cs b/Items/Materials/DarkPlasma.cs index 138dd0e45d..ba8356a071 100644 --- a/Items/Materials/DarkPlasma.cs +++ b/Items/Materials/DarkPlasma.cs @@ -10,24 +10,24 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { DisplayName.SetDefault("Dark Plasma"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(7, 4)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(7, 4)); } public override void SetDefaults() { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = Item.buyPrice(0, 7, 0, 0); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 15; + Item.height = 12; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 7, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void Update(ref float gravity, ref float maxFallSpeed) { float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0f * num, 0.45f * num, 0.7f * num); + Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0f * num, 0.45f * num, 0.7f * num); } } } diff --git a/Items/Materials/DarksunFragment.cs b/Items/Materials/DarksunFragment.cs index ff79d29716..63297dd59a 100644 --- a/Items/Materials/DarksunFragment.cs +++ b/Items/Materials/DarksunFragment.cs @@ -15,36 +15,36 @@ namespace CalamityMod.Items.Materials { DisplayName.SetDefault("Darksun Fragment"); Tooltip.SetDefault("An impacted crystal suffused with opposing celestial energies"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 8)); } public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.maxStack = 999; - item.rare = ItemRarityID.Purple; - item.value = Item.sellPrice(gold: 12); - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 28; + Item.height = 32; + Item.maxStack = 999; + Item.rare = ItemRarityID.Purple; + Item.value = Item.sellPrice(gold: 12); + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = Main.itemTexture[item.type]; - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 8), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = Main.itemTexture[Item.type]; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 8), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/DarksunFragmentGlow"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 8, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/DarksunFragmentGlow"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 8, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0.5f * brightness, 0.5f * brightness, 0.5f * brightness); + Lighting.AddLight(Item.Center, 0.5f * brightness, 0.5f * brightness, 0.5f * brightness); } } } diff --git a/Items/Materials/DemonicBoneAsh.cs b/Items/Materials/DemonicBoneAsh.cs index acbf20e35c..e1b3599874 100644 --- a/Items/Materials/DemonicBoneAsh.cs +++ b/Items/Materials/DemonicBoneAsh.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 6); - item.rare = ItemRarityID.Orange; + Item.width = 20; + Item.height = 20; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 6); + Item.rare = ItemRarityID.Orange; } } } diff --git a/Items/Materials/DepthCells.cs b/Items/Materials/DepthCells.cs index 34fec7af2a..1126b76163 100644 --- a/Items/Materials/DepthCells.cs +++ b/Items/Materials/DepthCells.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 80); - item.rare = ItemRarityID.Lime; + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 80); + Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Materials/DesertFeather.cs b/Items/Materials/DesertFeather.cs index 12746ef145..8941b68933 100644 --- a/Items/Materials/DesertFeather.cs +++ b/Items/Materials/DesertFeather.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 24; - item.height = 24; - item.maxStack = 999; - item.value = Item.sellPrice(copper: 20); - item.rare = ItemRarityID.Blue; + Item.width = 24; + Item.height = 24; + Item.maxStack = 999; + Item.value = Item.sellPrice(copper: 20); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Materials/DivineGeode.cs b/Items/Materials/DivineGeode.cs index 8f691926c3..cbcdd4089e 100644 --- a/Items/Materials/DivineGeode.cs +++ b/Items/Materials/DivineGeode.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.rare = ItemRarityID.Purple; - item.value = Item.buyPrice(0, 6, 50, 0); - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 15; + Item.height = 12; + Item.maxStack = 999; + Item.rare = ItemRarityID.Purple; + Item.value = Item.buyPrice(0, 6, 50, 0); + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void Update(ref float gravity, ref float maxFallSpeed) { float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.45f * num, 0.3f * num, 0f * num); + Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.45f * num, 0.3f * num, 0f * num); } } } diff --git a/Items/Materials/DraedonBar.cs b/Items/Materials/DraedonBar.cs index 065a989158..4f511161cf 100644 --- a/Items/Materials/DraedonBar.cs +++ b/Items/Materials/DraedonBar.cs @@ -15,27 +15,23 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 1); - item.rare = ItemRarityID.Lime; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 30; + Item.height = 24; + Item.maxStack = 999; + Item.value = Item.sellPrice(gold: 1); + Item.rare = ItemRarityID.Lime; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.AdamantiteForge).Register(); } } } diff --git a/Items/Materials/DubiousPlating.cs b/Items/Materials/DubiousPlating.cs index 30d2dca04a..1f3f440bbb 100644 --- a/Items/Materials/DubiousPlating.cs +++ b/Items/Materials/DubiousPlating.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.value = Item.sellPrice(silver: 6); + Item.width = 30; + Item.height = 24; + Item.maxStack = 999; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.value = Item.sellPrice(silver: 6); } } } diff --git a/Items/Materials/EbonianGel.cs b/Items/Materials/EbonianGel.cs index 39b623f0b4..70018e0589 100644 --- a/Items/Materials/EbonianGel.cs +++ b/Items/Materials/EbonianGel.cs @@ -15,31 +15,31 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 16; - item.height = 18; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 6); - item.rare = ItemRarityID.Blue; + Item.width = 16; + Item.height = 18; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 6); + Item.rare = ItemRarityID.Blue; } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - if (item.notAmmo) + if (Item.notAmmo) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/EbonianGelRed"); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/EbonianGelRed"); spriteBatch.Draw(texture, position, frame, Color.White, 0f, origin, scale, SpriteEffects.None, 0); } - return !item.notAmmo; + return !Item.notAmmo; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - if (item.notAmmo) + if (Item.notAmmo) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/EbonianGelRed"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, new Rectangle(0, 0, item.width, item.height), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/EbonianGelRed"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, new Rectangle(0, 0, Item.width, Item.height), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } - return !item.notAmmo; + return !Item.notAmmo; } } } diff --git a/Items/Materials/EffulgentFeather.cs b/Items/Materials/EffulgentFeather.cs index 94c5b78f56..338eced1f0 100644 --- a/Items/Materials/EffulgentFeather.cs +++ b/Items/Materials/EffulgentFeather.cs @@ -11,16 +11,16 @@ namespace CalamityMod.Items.Materials { DisplayName.SetDefault("Effulgent Feather"); Tooltip.SetDefault("It vibrates with fluffy golden energy"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(3, 11)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(3, 11)); } public override void SetDefaults() { - item.width = 24; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 6, 50, 0); - item.rare = ItemRarityID.Purple; + Item.width = 24; + Item.height = 24; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 6, 50, 0); + Item.rare = ItemRarityID.Purple; } } } diff --git a/Items/Materials/EndothermicEnergy.cs b/Items/Materials/EndothermicEnergy.cs index 1777bc85ea..a8858cba2d 100644 --- a/Items/Materials/EndothermicEnergy.cs +++ b/Items/Materials/EndothermicEnergy.cs @@ -15,36 +15,36 @@ namespace CalamityMod.Items.Materials { DisplayName.SetDefault("Endothermic Energy"); Tooltip.SetDefault("Its deathly chill sucks the life from its surroundings"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); } public override void SetDefaults() { - item.width = 36; - item.height = 38; - item.maxStack = 999; - item.rare = ItemRarityID.Red; - item.value = Item.sellPrice(gold: 2); - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 36; + Item.height = 38; + Item.maxStack = 999; + Item.rare = ItemRarityID.Red; + Item.value = Item.sellPrice(gold: 2); + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = Main.itemTexture[item.type]; - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = Main.itemTexture[Item.type]; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/EndothermicEnergyGlow"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/EndothermicEnergyGlow"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0f, 0f, 1.2f * brightness); + Lighting.AddLight(Item.Center, 0f, 0f, 1.2f * brightness); } } } diff --git a/Items/Materials/EnergyCore.cs b/Items/Materials/EnergyCore.cs index bff9160689..8f5c856fff 100644 --- a/Items/Materials/EnergyCore.cs +++ b/Items/Materials/EnergyCore.cs @@ -14,10 +14,10 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = item.height = 22; - item.maxStack = 999; - item.value = Item.sellPrice(copper: 80); - item.rare = ItemRarityID.Blue; + Item.width = Item.height = 22; + Item.maxStack = 999; + Item.value = Item.sellPrice(copper: 80); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Materials/EssenceofChaos.cs b/Items/Materials/EssenceofChaos.cs index 0ad852d8eb..55120958ff 100644 --- a/Items/Materials/EssenceofChaos.cs +++ b/Items/Materials/EssenceofChaos.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 34; - item.height = 24; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 40); - item.rare = ItemRarityID.LightRed; + Item.width = 34; + Item.height = 24; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 40); + Item.rare = ItemRarityID.LightRed; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Main.itemTexture[item.type]); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Main.itemTexture[Item.type]); } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0.5f * brightness, 0.3f * brightness, 0.05f * brightness); + Lighting.AddLight(Item.Center, 0.5f * brightness, 0.3f * brightness, 0.05f * brightness); } } } diff --git a/Items/Materials/EssenceofCinder.cs b/Items/Materials/EssenceofCinder.cs index 0c16fb6b14..f00c6ba14c 100644 --- a/Items/Materials/EssenceofCinder.cs +++ b/Items/Materials/EssenceofCinder.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 40); - item.rare = ItemRarityID.LightRed; + Item.width = 30; + Item.height = 24; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 40); + Item.rare = ItemRarityID.LightRed; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Main.itemTexture[item.type]); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Main.itemTexture[Item.type]); } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0.3f * brightness, 0.3f * brightness, 0.05f * brightness); + Lighting.AddLight(Item.Center, 0.3f * brightness, 0.3f * brightness, 0.05f * brightness); } } } diff --git a/Items/Materials/EssenceofEleum.cs b/Items/Materials/EssenceofEleum.cs index b59908fea1..104c2fe2f2 100644 --- a/Items/Materials/EssenceofEleum.cs +++ b/Items/Materials/EssenceofEleum.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 34; - item.height = 26; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 40); - item.rare = ItemRarityID.LightRed; + Item.width = 34; + Item.height = 26; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 40); + Item.rare = ItemRarityID.LightRed; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Main.itemTexture[item.type]); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Main.itemTexture[Item.type]); } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0.15f * brightness, 0.05f * brightness, 0.5f * brightness); + Lighting.AddLight(Item.Center, 0.15f * brightness, 0.05f * brightness, 0.5f * brightness); } } } diff --git a/Items/Materials/ExoPrism.cs b/Items/Materials/ExoPrism.cs index 640a5fb3ec..e4cb8d4d2b 100644 --- a/Items/Materials/ExoPrism.cs +++ b/Items/Materials/ExoPrism.cs @@ -16,12 +16,12 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 32; - item.height = 52; - item.maxStack = 999; - item.rare = ItemRarityID.Purple; - item.value = Item.sellPrice(gold: 60); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 32; + Item.height = 52; + Item.maxStack = 999; + Item.rare = ItemRarityID.Purple; + Item.value = Item.sellPrice(gold: 60); + Item.Calamity().customRarity = CalamityRarity.Violet; } public void DrawBackAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) @@ -34,25 +34,25 @@ namespace CalamityMod.Items.Materials { float scale = baseScale * outwardnessFactor; Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 4f; - spriteBatch.Draw(Main.itemTexture[item.type], drawPosition, frame, drawColor, item.velocity.X * 0.2f, frame.Size() * 0.5f, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(Main.itemTexture[Item.type], drawPosition, frame, drawColor, Item.velocity.X * 0.2f, frame.Size() * 0.5f, scale, SpriteEffects.None, 0f); } } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Rectangle frame = Main.itemTexture[item.type].Frame(); - DrawBackAfterimage(spriteBatch, item.position - Main.screenPosition + frame.Size() * 0.5f, frame, scale); + Rectangle frame = Main.itemTexture[Item.type].Frame(); + DrawBackAfterimage(spriteBatch, Item.position - Main.screenPosition + frame.Size() * 0.5f, frame, scale); return true; } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0.6f * brightness, 0.64f * brightness, 0.6f * brightness); + Lighting.AddLight(Item.Center, 0.6f * brightness, 0.64f * brightness, 0.6f * brightness); if (Main.rand.NextBool(3)) { - Dust exoShine = Dust.NewDustDirect(item.position, (int)(item.width * item.scale), (int)(item.height * item.scale * 0.6f), 204); + Dust exoShine = Dust.NewDustDirect(Item.position, (int)(Item.width * Item.scale), (int)(Item.height * Item.scale * 0.6f), 204); exoShine.velocity = Vector2.Lerp(Main.rand.NextVector2Unit(), -Vector2.UnitY, 0.5f) * Main.rand.NextFloat(1.2f, 1.8f); exoShine.fadeIn = 0.7f; exoShine.noGravity = true; diff --git a/Items/Materials/GalacticaSingularity.cs b/Items/Materials/GalacticaSingularity.cs index 262f5e358d..626946466b 100644 --- a/Items/Materials/GalacticaSingularity.cs +++ b/Items/Materials/GalacticaSingularity.cs @@ -11,35 +11,28 @@ namespace CalamityMod.Items.Materials { DisplayName.SetDefault("Galactica Singularity"); Tooltip.SetDefault("A shard of the cosmos"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 24)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(4, 24)); } public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 96); - item.rare = ItemRarityID.Red; + Item.width = 28; + Item.height = 28; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 96); + Item.rare = ItemRarityID.Red; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FragmentSolar); - recipe.AddIngredient(ItemID.FragmentVortex); - recipe.AddIngredient(ItemID.FragmentStardust); - recipe.AddIngredient(ItemID.FragmentNebula); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.FragmentSolar).AddIngredient(ItemID.FragmentVortex).AddIngredient(ItemID.FragmentStardust).AddIngredient(ItemID.FragmentNebula).AddTile(TileID.LunarCraftingStation).Register(); } public override void Update(ref float gravity, ref float maxFallSpeed) { float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 1f * num, 0.3f * num, 0.3f * num); + Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 1f * num, 0.3f * num, 0.3f * num); } } } diff --git a/Items/Materials/GrandScale.cs b/Items/Materials/GrandScale.cs index dcac0f2a15..68efad1b2d 100644 --- a/Items/Materials/GrandScale.cs +++ b/Items/Materials/GrandScale.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = Item.buyPrice(0, 4, 50, 0); - item.rare = ItemRarityID.Lime; + Item.width = 15; + Item.height = 12; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 4, 50, 0); + Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Materials/HadarianMembrane.cs b/Items/Materials/HadarianMembrane.cs index c2d6f3f495..7e8f43ed06 100644 --- a/Items/Materials/HadarianMembrane.cs +++ b/Items/Materials/HadarianMembrane.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 22; - item.height = 22; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 50); - item.rare = ItemRarityID.Lime; + Item.width = 22; + Item.height = 22; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 50); + Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Materials/HellcasterFragment.cs b/Items/Materials/HellcasterFragment.cs index 0b16696df3..6345dcc38a 100644 --- a/Items/Materials/HellcasterFragment.cs +++ b/Items/Materials/HellcasterFragment.cs @@ -15,16 +15,16 @@ namespace CalamityMod.Items.Materials { float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.3f * num, 0.05f * num); + Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.5f * num, 0.3f * num, 0.05f * num); } public override void SetDefaults() { - item.width = 10; - item.height = 14; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 45); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 10; + Item.height = 14; + Item.maxStack = 999; + Item.value = Item.sellPrice(gold: 45); + Item.Calamity().customRarity = CalamityRarity.Violet; } } } diff --git a/Items/Materials/InfectedArmorPlating.cs b/Items/Materials/InfectedArmorPlating.cs index 415b8fa2b9..b18a9e53b1 100644 --- a/Items/Materials/InfectedArmorPlating.cs +++ b/Items/Materials/InfectedArmorPlating.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = ItemRarityID.Yellow; + Item.width = 20; + Item.height = 20; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.Yellow; } } } diff --git a/Items/Materials/LivingShard.cs b/Items/Materials/LivingShard.cs index 39bb070d74..48130ede58 100644 --- a/Items/Materials/LivingShard.cs +++ b/Items/Materials/LivingShard.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 14; - item.height = 14; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 80); - item.rare = ItemRarityID.Lime; + Item.width = 14; + Item.height = 14; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 80); + Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Materials/Lumenite.cs b/Items/Materials/Lumenite.cs index af3852439e..96d7df5d6c 100644 --- a/Items/Materials/Lumenite.cs +++ b/Items/Materials/Lumenite.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 80); - item.rare = ItemRarityID.Lime; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 80); + Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Materials/MeldBlob.cs b/Items/Materials/MeldBlob.cs index 0a65e0e636..facacdc77d 100644 --- a/Items/Materials/MeldBlob.cs +++ b/Items/Materials/MeldBlob.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 16; - item.height = 14; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 20); - item.rare = ItemRarityID.Cyan; + Item.width = 16; + Item.height = 14; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Cyan; } } } diff --git a/Items/Materials/MeldiateBar.cs b/Items/Materials/MeldiateBar.cs index 8f20d01c4c..18b288a4b9 100644 --- a/Items/Materials/MeldiateBar.cs +++ b/Items/Materials/MeldiateBar.cs @@ -13,21 +13,16 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 1, silver: 20); - item.rare = ItemRarityID.Cyan; + Item.width = 15; + Item.height = 12; + Item.maxStack = 999; + Item.value = Item.sellPrice(gold: 1, silver: 20); + Item.rare = ItemRarityID.Cyan; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 3); - recipe.AddRecipe(); + CreateRecipe(3).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Materials/MiracleMatter.cs b/Items/Materials/MiracleMatter.cs index 3cc51582b5..76494664b2 100644 --- a/Items/Materials/MiracleMatter.cs +++ b/Items/Materials/MiracleMatter.cs @@ -18,17 +18,17 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 46; - item.height = 64; - item.maxStack = 999; - item.rare = ItemRarityID.Purple; - item.value = Item.sellPrice(platinum: 6, gold: 50); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 46; + Item.height = 64; + Item.maxStack = 999; + Item.rare = ItemRarityID.Purple; + Item.value = Item.sellPrice(platinum: 6, gold: 50); + Item.Calamity().customRarity = CalamityRarity.Violet; } public void DrawBackAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) { - if (item.velocity.X != 0f) + if (Item.velocity.X != 0f) return; float pulse = (float)Math.Cos(1.61803398875f * Main.GlobalTime * 2f) + (float)Math.Cos(Math.E * Main.GlobalTime * 1.7f); @@ -44,21 +44,21 @@ namespace CalamityMod.Items.Materials for (int i = 0; i < 8; i++) { Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 8f).ToRotationVector2() * outwardnessFactor * baseScale * 8f; - spriteBatch.Draw(Main.itemTexture[item.type], drawPosition, frame, drawColor, 0f, Vector2.Zero, baseScale, SpriteEffects.None, 0f); + spriteBatch.Draw(Main.itemTexture[Item.type], drawPosition, frame, drawColor, 0f, Vector2.Zero, baseScale, SpriteEffects.None, 0f); } } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Rectangle frame = Main.itemTexture[item.type].Frame(); - DrawBackAfterimage(spriteBatch, item.position - Main.screenPosition, frame, scale); + Rectangle frame = Main.itemTexture[Item.type].Frame(); + DrawBackAfterimage(spriteBatch, Item.position - Main.screenPosition, frame, scale); return true; } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - item.velocity.X = 0f; + Item.velocity.X = 0f; DrawBackAfterimage(spriteBatch, position, frame, scale); return true; } @@ -66,11 +66,11 @@ namespace CalamityMod.Items.Materials public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0.94f * brightness, 0.95f * brightness, 0.56f * brightness); + Lighting.AddLight(Item.Center, 0.94f * brightness, 0.95f * brightness, 0.56f * brightness); if (Main.rand.NextBool(3)) { - Dust exoFlame = Dust.NewDustDirect(item.position, (int)(item.width * item.scale), (int)(item.height * item.scale * 0.6f), 6); + Dust exoFlame = Dust.NewDustDirect(Item.position, (int)(Item.width * Item.scale), (int)(Item.height * Item.scale * 0.6f), 6); exoFlame.velocity = Vector2.Lerp(Main.rand.NextVector2Unit(), -Vector2.UnitY, 0.5f) * Main.rand.NextFloat(1.8f, 2.6f); exoFlame.scale *= Main.rand.NextFloat(0.85f, 1.15f); exoFlame.fadeIn = 0.9f; @@ -80,16 +80,7 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Materials/MolluskHusk.cs b/Items/Materials/MolluskHusk.cs index 0223347bb8..c348caccf2 100644 --- a/Items/Materials/MolluskHusk.cs +++ b/Items/Materials/MolluskHusk.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 30; - item.height = 28; - item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = ItemRarityID.Pink; + Item.width = 30; + Item.height = 28; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 3, 0, 0); + Item.rare = ItemRarityID.Pink; } } } diff --git a/Items/Materials/MurkyPaste.cs b/Items/Materials/MurkyPaste.cs index 5d70cca14b..7c4fbeb846 100644 --- a/Items/Materials/MurkyPaste.cs +++ b/Items/Materials/MurkyPaste.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 2); - item.rare = ItemRarityID.Blue; + Item.width = 20; + Item.height = 20; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 2); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Materials/MysteriousCircuitry.cs b/Items/Materials/MysteriousCircuitry.cs index 374634ce67..413a6e21dc 100644 --- a/Items/Materials/MysteriousCircuitry.cs +++ b/Items/Materials/MysteriousCircuitry.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.value = Item.sellPrice(silver: 6); + Item.width = 30; + Item.height = 24; + Item.maxStack = 999; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.value = Item.sellPrice(silver: 6); } } } diff --git a/Items/Materials/NightmareFuel.cs b/Items/Materials/NightmareFuel.cs index 960ba7b30e..db21e053cd 100644 --- a/Items/Materials/NightmareFuel.cs +++ b/Items/Materials/NightmareFuel.cs @@ -15,36 +15,36 @@ namespace CalamityMod.Items.Materials { DisplayName.SetDefault("Nightmare Fuel"); Tooltip.SetDefault("May drain your sanity"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); } public override void SetDefaults() { - item.width = 38; - item.height = 36; - item.maxStack = 999; - item.rare = ItemRarityID.Red; - item.value = Item.sellPrice(gold: 2); - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 38; + Item.height = 36; + Item.maxStack = 999; + Item.rare = ItemRarityID.Red; + Item.value = Item.sellPrice(gold: 2); + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = Main.itemTexture[item.type]; - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = Main.itemTexture[Item.type]; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/NightmareFuelGlow"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/NightmareFuelGlow"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } public override void Update(ref float gravity, ref float maxFallSpeed) { float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); - Lighting.AddLight(item.Center, 0.7f * brightness, 0.7f * brightness, 0f); + Lighting.AddLight(Item.Center, 0.7f * brightness, 0.7f * brightness, 0f); } } } diff --git a/Items/Materials/Phantoplasm.cs b/Items/Materials/Phantoplasm.cs index 8294440c40..abcd65b46b 100644 --- a/Items/Materials/Phantoplasm.cs +++ b/Items/Materials/Phantoplasm.cs @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Materials { DisplayName.SetDefault("Phantoplasm"); Tooltip.SetDefault("It churns and seethes with ghastly malice"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 5)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 5)); } public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 1); - item.rare = ItemRarityID.Purple; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.value = Item.sellPrice(gold: 1); + Item.rare = ItemRarityID.Purple; } public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 0); diff --git a/Items/Materials/PlagueCellCluster.cs b/Items/Materials/PlagueCellCluster.cs index 12cc309e10..efda8b743f 100644 --- a/Items/Materials/PlagueCellCluster.cs +++ b/Items/Materials/PlagueCellCluster.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = ItemRarityID.Yellow; + Item.width = 20; + Item.height = 20; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 5, 0, 0); + Item.rare = ItemRarityID.Yellow; } } } diff --git a/Items/Materials/PlasmaDriveCore.cs b/Items/Materials/PlasmaDriveCore.cs index 213c8f762c..54190b68a6 100644 --- a/Items/Materials/PlasmaDriveCore.cs +++ b/Items/Materials/PlasmaDriveCore.cs @@ -18,17 +18,17 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.width = 30; + Item.height = 30; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 0, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D tex = Main.itemTexture[item.type]; + Texture2D tex = Main.itemTexture[Item.type]; //Give it an outline. Make it look really important and shiny. The player must not confuse this for a random material spriteBatch.End(); diff --git a/Items/Materials/PurifiedGel.cs b/Items/Materials/PurifiedGel.cs index 5af8fa8234..db869f58bb 100644 --- a/Items/Materials/PurifiedGel.cs +++ b/Items/Materials/PurifiedGel.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 16; - item.height = 14; - item.maxStack = 999; - item.value = Item.buyPrice(0, 2, 50, 0); - item.rare = ItemRarityID.LightRed; + Item.width = 16; + Item.height = 14; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 2, 50, 0); + Item.rare = ItemRarityID.LightRed; } } } diff --git a/Items/Materials/ReaperTooth.cs b/Items/Materials/ReaperTooth.cs index 62e367c9ee..2756c1968f 100644 --- a/Items/Materials/ReaperTooth.cs +++ b/Items/Materials/ReaperTooth.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.value = Item.buyPrice(0, 7, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 7, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } } } diff --git a/Items/Materials/RuinousSoul.cs b/Items/Materials/RuinousSoul.cs index e5c7030d4a..ff2db7b8ad 100644 --- a/Items/Materials/RuinousSoul.cs +++ b/Items/Materials/RuinousSoul.cs @@ -10,16 +10,16 @@ namespace CalamityMod.Items.Materials { DisplayName.SetDefault("Ruinous Soul"); Tooltip.SetDefault("A shard of the distant past"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); } public override void SetDefaults() { - item.width = 26; - item.height = 42; - item.maxStack = 999; - item.value = Item.buyPrice(0, 7, 0, 0); - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 26; + Item.height = 42; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 7, 0, 0); + Item.Calamity().customRarity = CalamityRarity.PureGreen; } } } diff --git a/Items/Materials/ShadowspecBar.cs b/Items/Materials/ShadowspecBar.cs index 93568afe8f..115063015e 100644 --- a/Items/Materials/ShadowspecBar.cs +++ b/Items/Materials/ShadowspecBar.cs @@ -21,45 +21,39 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.width = 38; - item.height = 40; - item.maxStack = 999; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.width = 38; + Item.height = 40; + Item.maxStack = 999; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; - item.value = Item.sellPrice(platinum: 1, gold: 92); - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = Item.sellPrice(platinum: 1, gold: 92); + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/ShadowspecBar_Animated"); - spriteBatch.Draw(texture, position, item.GetCurrentFrame(ref frame, ref frameCounter, 8, 8), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/ShadowspecBar_Animated"); + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 8, 8), Color.White, 0f, origin, scale, SpriteEffects.None, 0); return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/ShadowspecBar_Animated"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 8, 8), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/ShadowspecBar_Animated"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 8, 8), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Materials/SolarVeil.cs b/Items/Materials/SolarVeil.cs index 9aaad18d84..a9d3f93765 100644 --- a/Items/Materials/SolarVeil.cs +++ b/Items/Materials/SolarVeil.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 46; - item.height = 32; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 80); - item.rare = ItemRarityID.Lime; + Item.width = 46; + Item.height = 32; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 80); + Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Materials/Stardust.cs b/Items/Materials/Stardust.cs index 66138d541f..2e2e9ca8fe 100644 --- a/Items/Materials/Stardust.cs +++ b/Items/Materials/Stardust.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 26; - item.height = 18; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 3); - item.rare = ItemRarityID.LightRed; + Item.width = 26; + Item.height = 18; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 3); + Item.rare = ItemRarityID.LightRed; } } } diff --git a/Items/Materials/StormlionMandible.cs b/Items/Materials/StormlionMandible.cs index 45f3b367fd..906b08072b 100644 --- a/Items/Materials/StormlionMandible.cs +++ b/Items/Materials/StormlionMandible.cs @@ -10,16 +10,16 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { DisplayName.SetDefault("Stormlion Mandible"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 8)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 8)); } public override void SetDefaults() { - item.width = 36; - item.height = 38; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 1, copper: 40); - item.rare = ItemRarityID.Blue; + Item.width = 36; + Item.height = 38; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 1, copper: 40); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Materials/SulfuricScale.cs b/Items/Materials/SulfuricScale.cs index aa1364a680..8621c955bf 100644 --- a/Items/Materials/SulfuricScale.cs +++ b/Items/Materials/SulfuricScale.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 3); - item.rare = ItemRarityID.Green; + Item.width = 20; + Item.height = 20; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 3); + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Materials/SuspiciousScrap.cs b/Items/Materials/SuspiciousScrap.cs index f19f33f508..14cccdd9b4 100644 --- a/Items/Materials/SuspiciousScrap.cs +++ b/Items/Materials/SuspiciousScrap.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 0, 20); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.width = 30; + Item.height = 30; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 0, 0, 20); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D tex = Main.itemTexture[item.type]; + Texture2D tex = Main.itemTexture[Item.type]; Rectangle variant = new Rectangle(CalamityWorld.OreTypes[0] == TileID.Tin ? 0 : 32, CalamityWorld.OreTypes[1] == TileID.Lead ? 0 : 32, 30, 30); spriteBatch.Draw(tex, position, variant, drawColor, 0f, origin, scale * 2f, 0f, 0f); return false; @@ -35,11 +35,11 @@ namespace CalamityMod.Items.Materials public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D tex = Main.itemTexture[item.type]; + Texture2D tex = Main.itemTexture[Item.type]; Rectangle variant = new Rectangle(CalamityWorld.OreTypes[0] == TileID.Tin ? 0 : 32, CalamityWorld.OreTypes[1] == TileID.Lead ? 0 : 32, 30, 30); Vector2 positionDisplace = new Vector2( 16 , 16 ) * scale; - spriteBatch.Draw(tex, item.position + positionDisplace - Main.screenPosition, variant, lightColor, rotation, variant.Size() / 2f, scale, 0f, 0f); + spriteBatch.Draw(tex, Item.position + positionDisplace - Main.screenPosition, variant, lightColor, rotation, variant.Size() / 2f, scale, 0f, 0f); return false; } } diff --git a/Items/Materials/TitanHeart.cs b/Items/Materials/TitanHeart.cs index 473844c4a3..11c791fd56 100644 --- a/Items/Materials/TitanHeart.cs +++ b/Items/Materials/TitanHeart.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 10; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 1); - item.rare = ItemRarityID.LightRed; + Item.width = 10; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(gold: 1); + Item.rare = ItemRarityID.LightRed; } } } diff --git a/Items/Materials/TrapperBulb.cs b/Items/Materials/TrapperBulb.cs index 426978c76b..563589ae4b 100644 --- a/Items/Materials/TrapperBulb.cs +++ b/Items/Materials/TrapperBulb.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 16); - item.rare = ItemRarityID.LightRed; + Item.width = 20; + Item.height = 20; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 16); + Item.rare = ItemRarityID.LightRed; } } } diff --git a/Items/Materials/TrueShadowScale.cs b/Items/Materials/TrueShadowScale.cs index a49c95f611..0cc69bffff 100644 --- a/Items/Materials/TrueShadowScale.cs +++ b/Items/Materials/TrueShadowScale.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 28; - item.height = 32; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = ItemRarityID.Orange; + Item.width = 28; + Item.height = 32; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 0, 50, 0); + Item.rare = ItemRarityID.Orange; } } } diff --git a/Items/Materials/TwistingNether.cs b/Items/Materials/TwistingNether.cs index 8e0f08e4a8..5a1648c27e 100644 --- a/Items/Materials/TwistingNether.cs +++ b/Items/Materials/TwistingNether.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = Item.buyPrice(0, 7, 0, 0); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 15; + Item.height = 12; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 7, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void Update(ref float gravity, ref float maxFallSpeed) { float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.1f * num, 0.7f * num); + Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.5f * num, 0.1f * num, 0.7f * num); } } } diff --git a/Items/Materials/UeliaceBar.cs b/Items/Materials/UeliaceBar.cs index e8c0da1c73..3c95c52402 100644 --- a/Items/Materials/UeliaceBar.cs +++ b/Items/Materials/UeliaceBar.cs @@ -15,28 +15,24 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.rare = ItemRarityID.Red; - item.value = Item.sellPrice(gold: 3); - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.width = 15; + Item.height = 12; + Item.maxStack = 999; + Item.rare = ItemRarityID.Red; + Item.value = Item.sellPrice(gold: 3); + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.AdamantiteForge).Register(); } } } diff --git a/Items/Materials/UnholyCore.cs b/Items/Materials/UnholyCore.cs index f482f7224c..c3e5c281aa 100644 --- a/Items/Materials/UnholyCore.cs +++ b/Items/Materials/UnholyCore.cs @@ -14,21 +14,16 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 80); - item.rare = ItemRarityID.Pink; + Item.width = 15; + Item.height = 12; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 80); + Item.rare = ItemRarityID.Pink; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Hellstone, 4); - recipe.AddTile(TileID.Hellforge); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Hellstone, 4).AddTile(TileID.Hellforge).Register(); } } } diff --git a/Items/Materials/UnholyEssence.cs b/Items/Materials/UnholyEssence.cs index b9799b88aa..bd615eda99 100644 --- a/Items/Materials/UnholyEssence.cs +++ b/Items/Materials/UnholyEssence.cs @@ -11,23 +11,23 @@ namespace CalamityMod.Items.Materials { DisplayName.SetDefault("Unholy Essence"); Tooltip.SetDefault("The essence of profaned creatures"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5)); } public override void SetDefaults() { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.rare = ItemRarityID.Purple; - item.value = Item.buyPrice(0, 6, 50, 0); + Item.width = 15; + Item.height = 12; + Item.maxStack = 999; + Item.rare = ItemRarityID.Purple; + Item.value = Item.buyPrice(0, 6, 50, 0); } public override void Update(ref float gravity, ref float maxFallSpeed) { float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.45f * num, 0.3f * num, 0f * num); + Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.45f * num, 0.3f * num, 0f * num); } } } diff --git a/Items/Materials/VerstaltiteBar.cs b/Items/Materials/VerstaltiteBar.cs index 48db8ca087..beaa450a51 100644 --- a/Items/Materials/VerstaltiteBar.cs +++ b/Items/Materials/VerstaltiteBar.cs @@ -15,27 +15,23 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 60); - item.rare = ItemRarityID.Pink; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 30; + Item.height = 24; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 60); + Item.rare = ItemRarityID.Pink; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.AdamantiteForge).Register(); } } } diff --git a/Items/Materials/VictideBar.cs b/Items/Materials/VictideBar.cs index 6881cf5a47..21eec8f848 100644 --- a/Items/Materials/VictideBar.cs +++ b/Items/Materials/VictideBar.cs @@ -13,23 +13,16 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 6); - item.rare = ItemRarityID.Green; + Item.width = 30; + Item.height = 24; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 6); + Item.rare = ItemRarityID.Green; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Coral); - recipe.AddIngredient(ItemID.Starfish); - recipe.AddIngredient(ItemID.Seashell); - recipe.AddTile(TileID.Furnaces); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Coral).AddIngredient(ItemID.Starfish).AddIngredient(ItemID.Seashell).AddTile(TileID.Furnaces).Register(); } } } diff --git a/Items/Materials/VictoryShard.cs b/Items/Materials/VictoryShard.cs index b99dd809e1..2634731799 100644 --- a/Items/Materials/VictoryShard.cs +++ b/Items/Materials/VictoryShard.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 14; - item.height = 14; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 3); - item.rare = ItemRarityID.Green; + Item.width = 14; + Item.height = 14; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 3); + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Materials/WulfrumShard.cs b/Items/Materials/WulfrumShard.cs index 99fc03dca7..27827f0585 100644 --- a/Items/Materials/WulfrumShard.cs +++ b/Items/Materials/WulfrumShard.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(copper: 80); - item.rare = ItemRarityID.Blue; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(copper: 80); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Mounts/AlicornMount.cs b/Items/Mounts/AlicornMount.cs index bf2ece551b..c18e8e3d47 100644 --- a/Items/Mounts/AlicornMount.cs +++ b/Items/Mounts/AlicornMount.cs @@ -5,6 +5,8 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; namespace CalamityMod.Items.Mounts { @@ -61,7 +63,7 @@ namespace CalamityMod.Items.Mounts mountData.swimFrameStart = mountData.inAirFrameStart; if (Main.netMode != NetmodeID.Server) { - mountData.frontTextureExtra = ModContent.GetTexture("CalamityMod/Items/Mounts/AlicornMountExtra"); + mountData.frontTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/AlicornMountExtra"); mountData.textureWidth = mountData.backTexture.Width; mountData.textureHeight = mountData.backTexture.Height; } @@ -141,7 +143,7 @@ namespace CalamityMod.Items.Mounts if (player.mount.PlayerOffset == 28) { if (!player.flapSound) - Main.PlaySound(SoundID.Item32, player.position); + SoundEngine.PlaySound(SoundID.Item32, player.position); player.flapSound = true; } else diff --git a/Items/Mounts/BirdSeed.cs b/Items/Mounts/BirdSeed.cs index a5fadc3cab..8656adf0da 100644 --- a/Items/Mounts/BirdSeed.cs +++ b/Items/Mounts/BirdSeed.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Mounts public override void SetDefaults() { - item.width = 34; - item.height = 36; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; + Item.width = 34; + Item.height = 36; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; - item.value = Item.sellPrice(gold: 20); - item.rare = ItemRarityID.Purple; - item.Calamity().donorItem = true; + Item.value = Item.sellPrice(gold: 20); + Item.rare = ItemRarityID.Purple; + Item.Calamity().donorItem = true; - item.UseSound = SoundID.NPCHit51; - item.noMelee = true; - item.mountType = ModContent.MountType(); + Item.UseSound = SoundID.NPCHit51; + Item.noMelee = true; + Item.mountType = ModContent.MountType(); } } } diff --git a/Items/Mounts/Brimrose.cs b/Items/Mounts/Brimrose.cs index 2679ac078f..b64aa9261b 100644 --- a/Items/Mounts/Brimrose.cs +++ b/Items/Mounts/Brimrose.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Mounts public override void SetDefaults() { - item.width = 64; - item.height = 64; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item3; - item.noMelee = true; - item.mountType = ModContent.MountType(); + Item.width = 64; + Item.height = 64; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item3; + Item.noMelee = true; + Item.mountType = ModContent.MountType(); - item.value = Item.buyPrice(platinum: 1, gold: 50); - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().devItem = true; + Item.value = Item.buyPrice(platinum: 1, gold: 50); + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().devItem = true; } } } diff --git a/Items/Mounts/Crysthamyr.cs b/Items/Mounts/Crysthamyr.cs index f7f6bf2363..b5d97caaea 100644 --- a/Items/Mounts/Crysthamyr.cs +++ b/Items/Mounts/Crysthamyr.cs @@ -4,6 +4,8 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; namespace CalamityMod.Items.Mounts { @@ -67,7 +69,7 @@ namespace CalamityMod.Items.Mounts mountData.swimFrameStart = mountData.inAirFrameStart; if (Main.netMode != NetmodeID.Server) { - mountData.frontTextureExtra = ModContent.GetTexture("CalamityMod/Items/Mounts/CrysthamyrExtra"); + mountData.frontTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/CrysthamyrExtra"); mountData.textureWidth = mountData.backTexture.Width; mountData.textureHeight = mountData.backTexture.Height; } @@ -109,7 +111,7 @@ namespace CalamityMod.Items.Mounts if (player.mount.PlayerOffset == 38) { if (!player.flapSound) - Main.PlaySound(SoundID.Item32, player.position); + SoundEngine.PlaySound(SoundID.Item32, player.position); player.flapSound = true; } else diff --git a/Items/Mounts/DraedonGamerChairMount.cs b/Items/Mounts/DraedonGamerChairMount.cs index 607131ee27..acf30f9084 100644 --- a/Items/Mounts/DraedonGamerChairMount.cs +++ b/Items/Mounts/DraedonGamerChairMount.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Mounts mountData.swimFrameStart = 0; if (Main.netMode != NetmodeID.Server) { - mountData.frontTextureGlow = ModContent.GetTexture("CalamityMod/Items/Mounts/DraedonGamerChairMount_Glowmask"); + mountData.frontTextureGlow = ModContent.Request("CalamityMod/Items/Mounts/DraedonGamerChairMount_Glowmask"); mountData.textureWidth = mountData.frontTexture.Width; mountData.textureHeight = mountData.frontTexture.Height; } diff --git a/Items/Mounts/ExoThrone.cs b/Items/Mounts/ExoThrone.cs index 7ccda6c0ba..4bf063d1cd 100644 --- a/Items/Mounts/ExoThrone.cs +++ b/Items/Mounts/ExoThrone.cs @@ -17,16 +17,16 @@ namespace CalamityMod.Items.Mounts public override void SetDefaults() { - item.width = 32; - item.height = 34; - item.useTime = item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item94; - item.noMelee = true; - item.mountType = ModContent.MountType(); + Item.width = 32; + Item.height = 34; + Item.useTime = Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item94; + Item.noMelee = true; + Item.mountType = ModContent.MountType(); - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void ModifyTooltips(List list) @@ -35,9 +35,9 @@ namespace CalamityMod.Items.Mounts string hotkey2 = CalamityMod.ExoChairSlowdownHotkey.TooltipHotkeyString(); foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip1") line2.text = $"Hold {hotkey} while sitting in the throne to move much faster"; - if (line2.mod == "Terraria" && line2.Name == "Tooltip2") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip2") line2.text = $"And hold {hotkey2} to move much slower"; } } diff --git a/Items/Mounts/Fabsol.cs b/Items/Mounts/Fabsol.cs index 08e0acc438..de2290557f 100644 --- a/Items/Mounts/Fabsol.cs +++ b/Items/Mounts/Fabsol.cs @@ -15,18 +15,18 @@ namespace CalamityMod.Items.Mounts public override void SetDefaults() { - item.width = 16; - item.height = 16; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item3; - item.noMelee = true; - item.mountType = ModContent.MountType(); + Item.width = 16; + Item.height = 16; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item3; + Item.noMelee = true; + Item.mountType = ModContent.MountType(); - item.value = Item.buyPrice(platinum: 3); - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().devItem = true; + Item.value = Item.buyPrice(platinum: 3); + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().devItem = true; } } } diff --git a/Items/Mounts/GazeOfCrysthamyr.cs b/Items/Mounts/GazeOfCrysthamyr.cs index 032c9cc707..ff997dd9ee 100644 --- a/Items/Mounts/GazeOfCrysthamyr.cs +++ b/Items/Mounts/GazeOfCrysthamyr.cs @@ -16,31 +16,24 @@ namespace CalamityMod.Items.Mounts public override void SetDefaults() { - item.width = 16; - item.height = 16; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingUp; + Item.width = 16; + Item.height = 16; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.HoldUp; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().donorItem = true; - item.UseSound = SoundID.NPCHit56; - item.noMelee = true; - item.mountType = ModContent.MountType(); + Item.UseSound = SoundID.NPCHit56; + Item.noMelee = true; + Item.mountType = ModContent.MountType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DD2PetDragon); - recipe.AddIngredient(ItemID.SoulofNight, 100); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.DD2PetDragon).AddIngredient(ItemID.SoulofNight, 100).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 25).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Mounts/Minecarts/DoGCart.cs b/Items/Mounts/Minecarts/DoGCart.cs index d715135e6a..2af9839d62 100644 --- a/Items/Mounts/Minecarts/DoGCart.cs +++ b/Items/Mounts/Minecarts/DoGCart.cs @@ -12,31 +12,25 @@ namespace CalamityMod.Items.Mounts.Minecarts public override void SetDefaults() { - item.width = 34; - item.height = 36; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; + Item.width = 34; + Item.height = 36; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; - item.value = Item.sellPrice(gold: 30); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().donorItem = true; + Item.value = Item.sellPrice(gold: 30); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().donorItem = true; - item.UseSound = SoundID.Item68; - item.noMelee = true; - item.mountType = ModContent.MountType(); + Item.UseSound = SoundID.Item68; + Item.noMelee = true; + Item.mountType = ModContent.MountType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Wire, 60); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Wire, 60).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Mounts/Minecarts/DoGCartMount.cs b/Items/Mounts/Minecarts/DoGCartMount.cs index 0147709534..0b252fb47b 100644 --- a/Items/Mounts/Minecarts/DoGCartMount.cs +++ b/Items/Mounts/Minecarts/DoGCartMount.cs @@ -131,9 +131,9 @@ namespace CalamityMod.Items.Mounts.Minecarts if (segment is null) break; - Texture2D segmentTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/DoGCartBody"); + Texture2D segmentTexture = ModContent.Request("CalamityMod/ExtraTextures/DoGCartBody"); if (i == SegmentCount - 1) - segmentTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/DoGCartTail"); + segmentTexture = ModContent.Request("CalamityMod/ExtraTextures/DoGCartTail"); Vector2 segmentDrawPosition = rotationAdjustedPositions[i] + CalculateSegmentWaveOffset(i, drawPlayer); Color segmentColor = Lighting.GetColor((int)segmentDrawPosition.X / 16, (int)segmentDrawPosition.Y / 16); diff --git a/Items/Mounts/OnyxExcavator.cs b/Items/Mounts/OnyxExcavator.cs index 6f934de24d..63ed3520df 100644 --- a/Items/Mounts/OnyxExcavator.cs +++ b/Items/Mounts/OnyxExcavator.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Items.Mounts { @@ -57,8 +58,8 @@ namespace CalamityMod.Items.Mounts mountData.swimFrameStart = mountData.inAirFrameStart; if (Main.netMode != NetmodeID.Server) { - mountData.backTextureExtra = ModContent.GetTexture("CalamityMod/Items/Mounts/OnyxExcavatorExtra"); - mountData.frontTextureExtra = ModContent.GetTexture("CalamityMod/Items/Mounts/OnyxExcavatorExtra2"); + mountData.backTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/OnyxExcavatorExtra"); + mountData.frontTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/OnyxExcavatorExtra2"); mountData.textureWidth = mountData.backTexture.Width; mountData.textureHeight = mountData.backTexture.Height; } @@ -145,14 +146,14 @@ namespace CalamityMod.Items.Mounts Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); int pickReq = 0; - ModTile moddedTile = TileLoader.GetTile(tile.type); + ModTile moddedTile = TileLoader.GetTile(tile.TileType); if (moddedTile != null) { pickReq = moddedTile.minPick; } else { - switch (tile.type) + switch (tile.TileType) { case TileID.Chlorophyte: pickReq = 200; @@ -193,7 +194,7 @@ namespace CalamityMod.Items.Mounts break; } } - if (Main.tileDungeon[tile.type]) + if (Main.tileDungeon[tile.TileType]) { if (x < Main.maxTilesX * 0.35 || x > Main.maxTilesX * 0.65) pickReq = 65; @@ -203,7 +204,7 @@ namespace CalamityMod.Items.Mounts { bool t = 1 == 1; bool f = 1 == 2; - bool canBreakTileCheck = TileLoader.CanKillTile(x, y, tile.type, ref t) && TileLoader.CanKillTile(x, y, tile.type, ref f); + bool canBreakTileCheck = TileLoader.CanKillTile(x, y, tile.TileType, ref t) && TileLoader.CanKillTile(x, y, tile.TileType, ref f); List tileExcludeList = new List() { ModContent.TileType(), @@ -212,8 +213,8 @@ namespace CalamityMod.Items.Mounts TileID.ElderCrystalStand }; - if (tile.active() && !player.noBuilding && !Main.tileContainer[tile.type] && - tileExcludeList.TrueForAll(z => tile.type != z) && pickReq < highestPickPower && canBreakTileCheck) + if (tile.active() && !player.noBuilding && !Main.tileContainer[tile.TileType] && + tileExcludeList.TrueForAll(z => tile.TileType != z) && pickReq < highestPickPower && canBreakTileCheck) { WorldGen.KillTile(x, y, false, false, false); if (!Main.tile[x, y].active() && Main.netMode != NetmodeID.SinglePlayer) diff --git a/Items/Mounts/OnyxExcavatorKey.cs b/Items/Mounts/OnyxExcavatorKey.cs index 45d2f833b3..449f845f13 100644 --- a/Items/Mounts/OnyxExcavatorKey.cs +++ b/Items/Mounts/OnyxExcavatorKey.cs @@ -17,16 +17,16 @@ namespace CalamityMod.Items.Mounts public override void SetDefaults() { - item.width = 16; - item.height = 16; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingUp; - item.rare = ItemRarityID.Orange; - item.value = Item.buyPrice(0, 9, 0, 0); - item.UseSound = SoundID.Item23; - item.noMelee = true; - item.mountType = ModContent.MountType(); + Item.width = 16; + Item.height = 16; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.rare = ItemRarityID.Orange; + Item.value = Item.buyPrice(0, 9, 0, 0); + Item.UseSound = SoundID.Item23; + Item.noMelee = true; + Item.mountType = ModContent.MountType(); } } } diff --git a/Items/Mounts/SquishyBeanMount.cs b/Items/Mounts/SquishyBeanMount.cs index b63c30e790..8394886193 100644 --- a/Items/Mounts/SquishyBeanMount.cs +++ b/Items/Mounts/SquishyBeanMount.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Mounts public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item3; - item.noMelee = true; - item.mountType = ModContent.MountType(); + Item.width = 20; + Item.height = 20; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item3; + Item.noMelee = true; + Item.mountType = ModContent.MountType(); - item.value = Item.buyPrice(platinum: 1); - item.rare = ItemRarityID.Cyan; - item.Calamity().devItem = true; + Item.value = Item.buyPrice(platinum: 1); + Item.rare = ItemRarityID.Cyan; + Item.Calamity().devItem = true; } } } diff --git a/Items/Mounts/TundraLeash.cs b/Items/Mounts/TundraLeash.cs index b67278b246..89871ea990 100644 --- a/Items/Mounts/TundraLeash.cs +++ b/Items/Mounts/TundraLeash.cs @@ -14,16 +14,16 @@ namespace CalamityMod.Items.Mounts public override void SetDefaults() { - item.width = 16; - item.height = 16; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingUp; - item.rare = ItemRarityID.Orange; - item.value = Item.buyPrice(0, 9, 0, 0); - item.UseSound = SoundID.NPCHit56; - item.noMelee = true; - item.mountType = ModContent.MountType(); + Item.width = 16; + Item.height = 16; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.rare = ItemRarityID.Orange; + Item.value = Item.buyPrice(0, 9, 0, 0); + Item.UseSound = SoundID.NPCHit56; + Item.noMelee = true; + Item.mountType = ModContent.MountType(); } } } diff --git a/Items/NormalityRelocator.cs b/Items/NormalityRelocator.cs index d67ca50788..c1048d599f 100644 --- a/Items/NormalityRelocator.cs +++ b/Items/NormalityRelocator.cs @@ -19,16 +19,16 @@ namespace CalamityMod.Items "Fall speed is doubled for 30 frames after teleporting\n" + "Teleportation is disabled while Chaos State is active\n" + "Works while in the inventory"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 7)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 7)); } public override void SetDefaults() { - item.width = 38; - item.height = 38; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().donorItem = true; + Item.width = 38; + Item.height = 38; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().donorItem = true; } public override void ModifyTooltips(List list) @@ -36,7 +36,7 @@ namespace CalamityMod.Items string hotkey = CalamityMod.NormalityRelocatorHotKey.TooltipHotkeyString(); foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip1") { line2.text = "Press " + hotkey + " to teleport to the position of the mouse"; } @@ -51,14 +51,7 @@ namespace CalamityMod.Items public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RodofDiscord); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.FragmentStardust, 30); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RodofDiscord).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.FragmentStardust, 30).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/PermanentBoosters/BloodOrange.cs b/Items/PermanentBoosters/BloodOrange.cs index 440ba8ca27..2132627934 100644 --- a/Items/PermanentBoosters/BloodOrange.cs +++ b/Items/PermanentBoosters/BloodOrange.cs @@ -18,14 +18,14 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = ItemRarityID.LightPurple; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item4; - item.consumable = true; + Item.width = 20; + Item.height = 20; + Item.useAnimation = 30; + Item.rare = ItemRarityID.LightPurple; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item4; + Item.consumable = true; } public override bool CanUseItem(Player player) @@ -38,7 +38,7 @@ namespace CalamityMod.Items.PermanentBoosters return true; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.itemAnimation > 0 && player.itemTime == 0) { @@ -55,16 +55,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(ItemID.OrangeBloodroot); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.SoulofMight, 5); - recipe.AddIngredient(ItemID.SoulofSight, 5); - recipe.AddIngredient(ItemID.SoulofFright, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LifeFruit, 5).AddIngredient(ItemID.OrangeBloodroot).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.SoulofMight, 5).AddIngredient(ItemID.SoulofSight, 5).AddIngredient(ItemID.SoulofFright, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/PermanentBoosters/CometShard.cs b/Items/PermanentBoosters/CometShard.cs index 1181bf6b32..a6696483ec 100644 --- a/Items/PermanentBoosters/CometShard.cs +++ b/Items/PermanentBoosters/CometShard.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = ItemRarityID.LightRed; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item29; - item.consumable = true; + Item.width = 20; + Item.height = 20; + Item.useAnimation = 30; + Item.rare = ItemRarityID.LightRed; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item29; + Item.consumable = true; } public override bool CanUseItem(Player player) @@ -36,7 +36,7 @@ namespace CalamityMod.Items.PermanentBoosters return true; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.itemAnimation > 0 && player.itemTime == 0) { @@ -53,13 +53,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 10); - recipe.AddIngredient(ItemID.FallenStar, 20); - recipe.AddIngredient(ModContent.ItemType(), 150); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.MeteoriteBar, 10).AddIngredient(ItemID.FallenStar, 20).AddIngredient(ModContent.ItemType(), 150).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/PermanentBoosters/Dragonfruit.cs b/Items/PermanentBoosters/Dragonfruit.cs index f1e73dde93..a624898ce4 100644 --- a/Items/PermanentBoosters/Dragonfruit.cs +++ b/Items/PermanentBoosters/Dragonfruit.cs @@ -19,15 +19,15 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item4; - item.consumable = true; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 20; + Item.height = 20; + Item.useAnimation = 30; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item4; + Item.consumable = true; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool CanUseItem(Player player) @@ -40,7 +40,7 @@ namespace CalamityMod.Items.PermanentBoosters return true; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.itemAnimation > 0 && player.itemTime == 0) { @@ -57,15 +57,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(ItemID.SkyBlueFlower); - recipe.AddIngredient(ItemID.FragmentSolar, 15); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LifeFruit, 5).AddIngredient(ItemID.SkyBlueFlower).AddIngredient(ItemID.FragmentSolar, 15).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/PermanentBoosters/Ectoheart.cs b/Items/PermanentBoosters/Ectoheart.cs index a8d9d1ada8..00a0754533 100644 --- a/Items/PermanentBoosters/Ectoheart.cs +++ b/Items/PermanentBoosters/Ectoheart.cs @@ -20,40 +20,40 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetDefaults() { - item.width = 42; - item.height = 44; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item122; - item.consumable = true; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 42; + Item.height = 44; + Item.useAnimation = 30; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item122; + Item.consumable = true; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool CanUseItem(Player player) => !player.Calamity().adrenalineBoostThree; public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/Ectoheart_Animated"); - spriteBatch.Draw(texture, position, item.GetCurrentFrame(ref frame, ref frameCounter, 8, 3), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/PermanentBoosters/Ectoheart_Animated"); + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 8, 3), Color.White, 0f, origin, scale, SpriteEffects.None, 0); return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/Ectoheart_Animated"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 8, 3), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/PermanentBoosters/Ectoheart_Animated"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 8, 3), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/EctoheartGlow"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 8, 3, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/PermanentBoosters/EctoheartGlow"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 8, 3, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.itemAnimation > 0 && player.itemTime == 0) { diff --git a/Items/PermanentBoosters/Elderberry.cs b/Items/PermanentBoosters/Elderberry.cs index 4381176f38..20e6d3a0ab 100644 --- a/Items/PermanentBoosters/Elderberry.cs +++ b/Items/PermanentBoosters/Elderberry.cs @@ -18,15 +18,15 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item4; - item.consumable = true; + Item.width = 20; + Item.height = 20; + Item.useAnimation = 30; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item4; + Item.consumable = true; } public override bool CanUseItem(Player player) @@ -39,7 +39,7 @@ namespace CalamityMod.Items.PermanentBoosters return true; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.itemAnimation > 0 && player.itemTime == 0) { @@ -56,15 +56,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(ItemID.BlueBerries); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LifeFruit, 5).AddIngredient(ItemID.BlueBerries).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/PermanentBoosters/ElectrolyteGelPack.cs b/Items/PermanentBoosters/ElectrolyteGelPack.cs index 0c912b71ec..7dea9ee606 100644 --- a/Items/PermanentBoosters/ElectrolyteGelPack.cs +++ b/Items/PermanentBoosters/ElectrolyteGelPack.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = ItemRarityID.LightRed; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item122; - item.consumable = true; + Item.width = 20; + Item.height = 20; + Item.useAnimation = 30; + Item.rare = ItemRarityID.LightRed; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item122; + Item.consumable = true; } public override bool CanUseItem(Player player) @@ -36,7 +36,7 @@ namespace CalamityMod.Items.PermanentBoosters return true; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.itemAnimation > 0 && player.itemTime == 0) { diff --git a/Items/PermanentBoosters/EtherealCore.cs b/Items/PermanentBoosters/EtherealCore.cs index 0cd174d8e0..5346ebb687 100644 --- a/Items/PermanentBoosters/EtherealCore.cs +++ b/Items/PermanentBoosters/EtherealCore.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = ItemRarityID.Red; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item29; - item.consumable = true; + Item.width = 20; + Item.height = 20; + Item.useAnimation = 30; + Item.rare = ItemRarityID.Red; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item29; + Item.consumable = true; } public override bool CanUseItem(Player player) @@ -36,7 +36,7 @@ namespace CalamityMod.Items.PermanentBoosters return true; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.itemAnimation > 0 && player.itemTime == 0) { @@ -53,14 +53,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 25); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ItemID.FragmentNebula, 20); - recipe.AddIngredient(ItemID.FallenStar, 50); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.MeteoriteBar, 25).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ItemID.FragmentNebula, 20).AddIngredient(ItemID.FallenStar, 50).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/PermanentBoosters/InfernalBlood.cs b/Items/PermanentBoosters/InfernalBlood.cs index 9a47a6ab2f..738b6e22c4 100644 --- a/Items/PermanentBoosters/InfernalBlood.cs +++ b/Items/PermanentBoosters/InfernalBlood.cs @@ -16,19 +16,19 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = ItemRarityID.Yellow; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item122; - item.consumable = true; + Item.width = 20; + Item.height = 20; + Item.useAnimation = 30; + Item.rare = ItemRarityID.Yellow; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item122; + Item.consumable = true; } public override bool CanUseItem(Player player) => !player.Calamity().rageBoostTwo; - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.itemAnimation > 0 && player.itemTime == 0) { diff --git a/Items/PermanentBoosters/MLGRune2.cs b/Items/PermanentBoosters/MLGRune2.cs index f6e2ef5e19..acc611382d 100644 --- a/Items/PermanentBoosters/MLGRune2.cs +++ b/Items/PermanentBoosters/MLGRune2.cs @@ -17,15 +17,15 @@ Consuming it does something that cannot be reversed"); public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.rare = ItemRarityID.Red; - item.maxStack = 99; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item4; - item.consumable = true; + Item.width = 28; + Item.height = 28; + Item.rare = ItemRarityID.Red; + Item.maxStack = 99; + Item.useAnimation = 30; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item4; + Item.consumable = true; } public override bool CanUseItem(Player player) @@ -38,7 +38,7 @@ Consuming it does something that cannot be reversed"); return true; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { CalamityPlayer modPlayer = player.Calamity(); if (player.itemAnimation > 0 && !modPlayer.extraAccessoryML && player.itemTime == 0) diff --git a/Items/PermanentBoosters/MiracleFruit.cs b/Items/PermanentBoosters/MiracleFruit.cs index fdb5016e8e..1b5038610d 100644 --- a/Items/PermanentBoosters/MiracleFruit.cs +++ b/Items/PermanentBoosters/MiracleFruit.cs @@ -18,14 +18,14 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = ItemRarityID.Yellow; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item4; - item.consumable = true; + Item.width = 20; + Item.height = 20; + Item.useAnimation = 30; + Item.rare = ItemRarityID.Yellow; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item4; + Item.consumable = true; } public override bool CanUseItem(Player player) @@ -38,7 +38,7 @@ namespace CalamityMod.Items.PermanentBoosters return true; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.itemAnimation > 0 && player.itemTime == 0) { @@ -55,15 +55,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(ItemID.TealMushroom); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LifeFruit, 5).AddIngredient(ItemID.TealMushroom).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/PermanentBoosters/MushroomPlasmaRoot.cs b/Items/PermanentBoosters/MushroomPlasmaRoot.cs index 4dd9b8c833..682e15bb0b 100644 --- a/Items/PermanentBoosters/MushroomPlasmaRoot.cs +++ b/Items/PermanentBoosters/MushroomPlasmaRoot.cs @@ -16,19 +16,19 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = ItemRarityID.Green; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item122; - item.consumable = true; + Item.width = 20; + Item.height = 20; + Item.useAnimation = 30; + Item.rare = ItemRarityID.Green; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item122; + Item.consumable = true; } public override bool CanUseItem(Player player) => !player.Calamity().rageBoostOne; - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.itemAnimation > 0 && player.itemTime == 0) { diff --git a/Items/PermanentBoosters/PhantomHeart.cs b/Items/PermanentBoosters/PhantomHeart.cs index e50e1074d0..21b041a82e 100644 --- a/Items/PermanentBoosters/PhantomHeart.cs +++ b/Items/PermanentBoosters/PhantomHeart.cs @@ -16,15 +16,15 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item29; - item.consumable = true; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 20; + Item.height = 20; + Item.useAnimation = 30; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item29; + Item.consumable = true; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool CanUseItem(Player player) @@ -37,7 +37,7 @@ namespace CalamityMod.Items.PermanentBoosters return true; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.itemAnimation > 0 && player.itemTime == 0) { @@ -54,12 +54,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 100); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 100).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/PermanentBoosters/RedLightningContainer.cs b/Items/PermanentBoosters/RedLightningContainer.cs index 70902d9807..1d5f31ee6d 100644 --- a/Items/PermanentBoosters/RedLightningContainer.cs +++ b/Items/PermanentBoosters/RedLightningContainer.cs @@ -20,39 +20,39 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetDefaults() { - item.width = 30; - item.height = 40; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item122; - item.consumable = true; - item.rare = ItemRarityID.Purple; + Item.width = 30; + Item.height = 40; + Item.useAnimation = 30; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item122; + Item.consumable = true; + Item.rare = ItemRarityID.Purple; } public override bool CanUseItem(Player player) => !player.Calamity().rageBoostThree; public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/RedLightningContainer_Animated"); - spriteBatch.Draw(texture, position, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 6), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/PermanentBoosters/RedLightningContainer_Animated"); + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 6), Color.White, 0f, origin, scale, SpriteEffects.None, 0); return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/RedLightningContainer_Animated"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/PermanentBoosters/RedLightningContainer_Animated"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/RedLightningContainerGlow"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 6, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/PermanentBoosters/RedLightningContainerGlow"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 6, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.itemAnimation > 0 && player.itemTime == 0) { diff --git a/Items/PermanentBoosters/StarlightFuelCell.cs b/Items/PermanentBoosters/StarlightFuelCell.cs index 5b0c0722e7..f1316cb5af 100644 --- a/Items/PermanentBoosters/StarlightFuelCell.cs +++ b/Items/PermanentBoosters/StarlightFuelCell.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = ItemRarityID.Lime; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item122; - item.consumable = true; + Item.width = 20; + Item.height = 20; + Item.useAnimation = 30; + Item.rare = ItemRarityID.Lime; + Item.useTime = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item122; + Item.consumable = true; } public override bool CanUseItem(Player player) @@ -36,7 +36,7 @@ namespace CalamityMod.Items.PermanentBoosters return true; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.itemAnimation > 0 && player.itemTime == 0) { diff --git a/Items/Pets/BearEye.cs b/Items/Pets/BearEye.cs index e73c35e5a2..7dc03c3bff 100644 --- a/Items/Pets/BearEye.cs +++ b/Items/Pets/BearEye.cs @@ -15,28 +15,28 @@ namespace CalamityMod.Items.Pets } public override void SetDefaults() { - item.damage = 0; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = 20; - item.useTime = 20; - item.noMelee = true; - item.width = 30; - item.height = 30; + Item.damage = 0; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = 20; + Item.useTime = 20; + Item.noMelee = true; + Item.width = 30; + Item.height = 30; - item.value = Item.sellPrice(platinum: 1); - item.rare = ItemRarityID.Pink; - item.Calamity().devItem = true; + Item.value = Item.sellPrice(platinum: 1); + Item.rare = ItemRarityID.Pink; + Item.Calamity().devItem = true; - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); - item.UseSound = new Terraria.Audio.LegacySoundStyle(SoundID.Meowmere, 5); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); + Item.UseSound = new Terraria.Audio.LegacySoundStyle(SoundID.Meowmere, 5); } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 15, true); + player.AddBuff(Item.buffType, 15, true); } } } diff --git a/Items/Pets/BloodyVein.cs b/Items/Pets/BloodyVein.cs index 4457cf80dc..1f5cdaf1b4 100644 --- a/Items/Pets/BloodyVein.cs +++ b/Items/Pets/BloodyVein.cs @@ -16,27 +16,27 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.damage = 0; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.width = 24; - item.height = 48; - item.UseSound = SoundID.NPCHit9; - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); + Item.damage = 0; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.width = 24; + Item.height = 48; + Item.UseSound = SoundID.NPCHit9; + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); - item.value = Item.buyPrice(gold: 4); - item.rare = ItemRarityID.Orange; - item.Calamity().donorItem = true; + Item.value = Item.buyPrice(gold: 4); + Item.rare = ItemRarityID.Orange; + Item.Calamity().donorItem = true; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/BrimstoneJewel.cs b/Items/Pets/BrimstoneJewel.cs index 3ac5cbebb7..cad99d4871 100644 --- a/Items/Pets/BrimstoneJewel.cs +++ b/Items/Pets/BrimstoneJewel.cs @@ -17,20 +17,20 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.CloneDefaults(ItemID.ZephyrFish); - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); + Item.CloneDefaults(ItemID.ZephyrFish); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); - item.value = Item.sellPrice(gold: 40); - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().donorItem = true; + Item.value = Item.sellPrice(gold: 40); + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().donorItem = true; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/CharredRelic.cs b/Items/Pets/CharredRelic.cs index 69176bb256..865670efc3 100644 --- a/Items/Pets/CharredRelic.cs +++ b/Items/Pets/CharredRelic.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.CloneDefaults(ItemID.ZephyrFish); - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); + Item.CloneDefaults(ItemID.ZephyrFish); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); - item.value = Item.sellPrice(gold: 4); - item.rare = ItemRarityID.Red; - item.Calamity().devItem = true; + Item.value = Item.sellPrice(gold: 4); + Item.rare = ItemRarityID.Red; + Item.Calamity().devItem = true; - item.UseSound = SoundID.NPCHit51; + Item.UseSound = SoundID.NPCHit51; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/ChromaticOrb.cs b/Items/Pets/ChromaticOrb.cs index edc30f3fa7..a0e2a084d9 100644 --- a/Items/Pets/ChromaticOrb.cs +++ b/Items/Pets/ChromaticOrb.cs @@ -18,20 +18,20 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.CloneDefaults(ItemID.WispinaBottle); - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); + Item.CloneDefaults(ItemID.WispinaBottle); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); - item.value = Item.sellPrice(gold: 3); - item.rare = ItemRarityID.Cyan; - item.Calamity().donorItem = true; + Item.value = Item.sellPrice(gold: 3); + Item.rare = ItemRarityID.Cyan; + Item.Calamity().donorItem = true; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/CosmicPlushie.cs b/Items/Pets/CosmicPlushie.cs index 7a79b899ba..c1ee438c07 100644 --- a/Items/Pets/CosmicPlushie.cs +++ b/Items/Pets/CosmicPlushie.cs @@ -16,27 +16,27 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.damage = 0; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = 20; - item.useTime = 20; - item.noMelee = true; - item.width = 28; - item.height = 36; - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); - item.UseSound = new Terraria.Audio.LegacySoundStyle(SoundID.Meowmere, 5); + Item.damage = 0; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = 20; + Item.useTime = 20; + Item.noMelee = true; + Item.width = 28; + Item.height = 36; + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); + Item.UseSound = new Terraria.Audio.LegacySoundStyle(SoundID.Meowmere, 5); - item.value = Item.sellPrice(gold: 7); - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().devItem = true; + Item.value = Item.sellPrice(gold: 7); + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().devItem = true; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 15, true); + player.AddBuff(Item.buffType, 15, true); } } } diff --git a/Items/Pets/ForgottenDragonEgg.cs b/Items/Pets/ForgottenDragonEgg.cs index 37ec34c786..8f6d24fb93 100644 --- a/Items/Pets/ForgottenDragonEgg.cs +++ b/Items/Pets/ForgottenDragonEgg.cs @@ -16,20 +16,20 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.CloneDefaults(ItemID.ZephyrFish); - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); + Item.CloneDefaults(ItemID.ZephyrFish); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); - item.value = Item.sellPrice(gold: 30); - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().donorItem = true; + Item.value = Item.sellPrice(gold: 30); + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().donorItem = true; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/FoxDrive.cs b/Items/Pets/FoxDrive.cs index 313922cf1b..446dc53635 100644 --- a/Items/Pets/FoxDrive.cs +++ b/Items/Pets/FoxDrive.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.CloneDefaults(ItemID.ZephyrFish); - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); - item.expert = true; + Item.CloneDefaults(ItemID.ZephyrFish); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); + Item.expert = true; - item.value = Item.sellPrice(gold: 30); - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().devItem = true; + Item.value = Item.sellPrice(gold: 30); + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().devItem = true; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/GeyserShell.cs b/Items/Pets/GeyserShell.cs index ceb47df508..4dcb95cc0d 100644 --- a/Items/Pets/GeyserShell.cs +++ b/Items/Pets/GeyserShell.cs @@ -15,25 +15,25 @@ namespace CalamityMod.Items.Pets } public override void SetDefaults() { - item.damage = 0; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = 20; - item.useTime = 20; - item.noMelee = true; - item.width = 30; - item.height = 30; - item.value = Item.sellPrice(0, 1, 50, 0); - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); - item.rare = ItemRarityID.LightPurple; - item.UseSound = SoundID.Item2; + Item.damage = 0; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = 20; + Item.useTime = 20; + Item.noMelee = true; + Item.width = 30; + Item.height = 30; + Item.value = Item.sellPrice(0, 1, 50, 0); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); + Item.rare = ItemRarityID.LightPurple; + Item.UseSound = SoundID.Item2; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 15, true); + player.AddBuff(Item.buffType, 15, true); } } } diff --git a/Items/Pets/IbarakiBox.cs b/Items/Pets/IbarakiBox.cs index f6fc2535eb..2930fcbc57 100644 --- a/Items/Pets/IbarakiBox.cs +++ b/Items/Pets/IbarakiBox.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Pets { DisplayName.SetDefault("Hermit's Box of One Hundred Medicines"); Tooltip.SetDefault("As the ice melts in the springs\n" + - "And waves wash the old moss’ hair...\n" + + "And waves wash the old moss’ hair...\n" + "Thank you, Goodbye.\n" + "Summons the Third Sage\n" + "Use the item with right click in the hotbar to toggle the Third Sage's blessing.\n" + @@ -23,20 +23,20 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.damage = 0; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.width = 36; - item.height = 30; - item.UseSound = SoundID.Item3; - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); + Item.damage = 0; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.width = 36; + Item.height = 30; + Item.UseSound = SoundID.Item3; + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); - item.value = Item.buyPrice(gold: 5); - item.rare = ItemRarityID.LightRed; - item.Calamity().devItem = true; + Item.value = Item.buyPrice(gold: 5); + Item.rare = ItemRarityID.LightRed; + Item.Calamity().devItem = true; } public override bool AltFunctionUse(Player player) => true; @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Pets { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/JoyfulHeart.cs b/Items/Pets/JoyfulHeart.cs index cc7dcc9c31..e53d59c54f 100644 --- a/Items/Pets/JoyfulHeart.cs +++ b/Items/Pets/JoyfulHeart.cs @@ -15,28 +15,28 @@ namespace CalamityMod.Items.Pets } public override void SetDefaults() { - item.damage = 0; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = 20; - item.useTime = 20; - item.noMelee = true; - item.width = 30; - item.height = 30; + Item.damage = 0; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = 20; + Item.useTime = 20; + Item.noMelee = true; + Item.width = 30; + Item.height = 30; - item.value = Item.sellPrice(gold: 1); - item.rare = ItemRarityID.Pink; - item.Calamity().devItem = true; + Item.value = Item.sellPrice(gold: 1); + Item.rare = ItemRarityID.Pink; + Item.Calamity().devItem = true; - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); - item.UseSound = SoundID.Item2; + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); + Item.UseSound = SoundID.Item2; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 15, true); + player.AddBuff(Item.buffType, 15, true); } } } diff --git a/Items/Pets/Levi.cs b/Items/Pets/Levi.cs index a3a295afd8..bf445af055 100644 --- a/Items/Pets/Levi.cs +++ b/Items/Pets/Levi.cs @@ -16,20 +16,20 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.CloneDefaults(ItemID.ZephyrFish); - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); + Item.CloneDefaults(ItemID.ZephyrFish); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); - item.value = Item.sellPrice(gold: 40); - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().devItem = true; + Item.value = Item.sellPrice(gold: 40); + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().devItem = true; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/LittleLight.cs b/Items/Pets/LittleLight.cs index 2d0da30c40..adbd46caa7 100644 --- a/Items/Pets/LittleLight.cs +++ b/Items/Pets/LittleLight.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.CloneDefaults(ItemID.WispinaBottle); - item.UseSound = SoundID.Item83; - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); + Item.CloneDefaults(ItemID.WispinaBottle); + Item.UseSound = SoundID.Item83; + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); - item.value = Item.sellPrice(gold: 15); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.Calamity().donorItem = true; + Item.value = Item.sellPrice(gold: 15); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.Calamity().donorItem = true; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/McNuggets.cs b/Items/Pets/McNuggets.cs index e8dd237a37..fa31d4adf5 100644 --- a/Items/Pets/McNuggets.cs +++ b/Items/Pets/McNuggets.cs @@ -16,19 +16,19 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.CloneDefaults(ItemID.ZephyrFish); - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); + Item.CloneDefaults(ItemID.ZephyrFish); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); - item.value = Item.sellPrice(gold: 30); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = Item.sellPrice(gold: 30); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/PineapplePet.cs b/Items/Pets/PineapplePet.cs index 7f24fdf6e7..951cbbe6bf 100644 --- a/Items/Pets/PineapplePet.cs +++ b/Items/Pets/PineapplePet.cs @@ -16,27 +16,27 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.damage = 0; - item.useTime = item.useAnimation = 20; - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); + Item.damage = 0; + Item.useTime = Item.useAnimation = 20; + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); - item.width = 32; - item.height = 34; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.UseSound = SoundID.Item2; + Item.width = 32; + Item.height = 34; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.UseSound = SoundID.Item2; - item.value = Item.buyPrice(gold: 4); - item.rare = ItemRarityID.Orange; - item.Calamity().donorItem = true; + Item.value = Item.buyPrice(gold: 4); + Item.rare = ItemRarityID.Orange; + Item.Calamity().donorItem = true; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/PlagueCaller.cs b/Items/Pets/PlagueCaller.cs index c98a7efd84..d2d4668583 100644 --- a/Items/Pets/PlagueCaller.cs +++ b/Items/Pets/PlagueCaller.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.CloneDefaults(ItemID.ZephyrFish); - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); - item.rare = ItemRarityID.Lime; + Item.CloneDefaults(ItemID.ZephyrFish); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); + Item.rare = ItemRarityID.Lime; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/PrimroseKeepsake.cs b/Items/Pets/PrimroseKeepsake.cs index 662fe6c040..653affb5d9 100644 --- a/Items/Pets/PrimroseKeepsake.cs +++ b/Items/Pets/PrimroseKeepsake.cs @@ -18,27 +18,27 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.damage = 0; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = 20; - item.useTime = 20; - item.noMelee = true; - item.width = 30; - item.height = 30; - item.shoot = ProjectileID.None; // neither kendra nor bear is the direct "shoot" - item.buffType = ModContent.BuffType(); - item.UseSound = SoundID.Item44; + Item.damage = 0; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = 20; + Item.useTime = 20; + Item.noMelee = true; + Item.width = 30; + Item.height = 30; + Item.shoot = ProjectileID.None; // neither kendra nor bear is the direct "shoot" + Item.buffType = ModContent.BuffType(); + Item.UseSound = SoundID.Item44; - item.value = Item.sellPrice(platinum: 1); - item.rare = ItemRarityID.Purple; - item.Calamity().devItem = true; + Item.value = Item.sellPrice(platinum: 1); + Item.rare = ItemRarityID.Purple; + Item.Calamity().devItem = true; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 15, true); + player.AddBuff(Item.buffType, 15, true); } } @@ -52,13 +52,7 @@ namespace CalamityMod.Items.Pets public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LovePotion); - recipe.AddTile(TileID.TinkerersWorkbench); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LovePotion).AddTile(TileID.TinkerersWorkbench).Register(); } } } diff --git a/Items/Pets/RadiatingCrystal.cs b/Items/Pets/RadiatingCrystal.cs index 53994f4a0f..2a94cf5e03 100644 --- a/Items/Pets/RadiatingCrystal.cs +++ b/Items/Pets/RadiatingCrystal.cs @@ -18,18 +18,18 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.CloneDefaults(ItemID.WispinaBottle); - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); - item.value = Item.sellPrice(silver: 20); - item.rare = ItemRarityID.Orange; + Item.CloneDefaults(ItemID.WispinaBottle); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Orange; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/RomajedaOrchid.cs b/Items/Pets/RomajedaOrchid.cs index 4a9d4826cc..7b672456e2 100644 --- a/Items/Pets/RomajedaOrchid.cs +++ b/Items/Pets/RomajedaOrchid.cs @@ -16,27 +16,27 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.damage = 0; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = 20; - item.useTime = 20; - item.noMelee = true; - item.width = 30; - item.height = 30; - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); - item.UseSound = SoundID.Item44; + Item.damage = 0; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = 20; + Item.useTime = 20; + Item.noMelee = true; + Item.width = 30; + Item.height = 30; + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); + Item.UseSound = SoundID.Item44; - item.value = Item.buyPrice(gold: 40); - item.rare = ItemRarityID.Pink; - item.Calamity().devItem = true; + Item.value = Item.buyPrice(gold: 40); + Item.rare = ItemRarityID.Pink; + Item.Calamity().devItem = true; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 15, true); + player.AddBuff(Item.buffType, 15, true); } } } diff --git a/Items/Pets/RotomRemote.cs b/Items/Pets/RotomRemote.cs index 5b65ee46f9..9800851828 100644 --- a/Items/Pets/RotomRemote.cs +++ b/Items/Pets/RotomRemote.cs @@ -22,44 +22,38 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.damage = 0; - item.useTime = item.useAnimation = 20; - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); + Item.damage = 0; + Item.useTime = Item.useAnimation = 20; + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); - item.width = 30; - item.height = 34; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.UseSound = SoundID.Item113; + Item.width = 30; + Item.height = 34; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.UseSound = SoundID.Item113; - item.value = Item.buyPrice(gold: 4); - item.rare = ItemRarityID.Orange; - item.Calamity().devItem = true; + Item.value = Item.buyPrice(gold: 4); + Item.rare = ItemRarityID.Orange; + Item.Calamity().devItem = true; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Pets/RotomRemoteGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Pets/RotomRemoteGlow")); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddRecipeGroup("AnyGoldBar", 8); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddRecipeGroup("AnyGoldBar", 8).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Pets/RottingEyeball.cs b/Items/Pets/RottingEyeball.cs index 9632cefddb..0f09e0c2a7 100644 --- a/Items/Pets/RottingEyeball.cs +++ b/Items/Pets/RottingEyeball.cs @@ -18,24 +18,24 @@ namespace CalamityMod.Items.Pets { /*item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); item.rare = -13;*/ - item.value = Item.buyPrice(0, 4, 0, 0); - item.damage = 0; - item.useTime = item.useAnimation = 20; - item.useStyle = 1; - item.noMelee = true; - item.width = 16; - item.height = 30; - item.UseSound = SoundID.NPCHit2; - item.rare = 3; - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.damage = 0; + Item.useTime = Item.useAnimation = 20; + Item.useStyle = 1; + Item.noMelee = true; + Item.width = 16; + Item.height = 30; + Item.UseSound = SoundID.NPCHit2; + Item.rare = 3; + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/SparksSummon.cs b/Items/Pets/SparksSummon.cs index 4e1758cd38..ffec4f3c51 100644 --- a/Items/Pets/SparksSummon.cs +++ b/Items/Pets/SparksSummon.cs @@ -18,38 +18,26 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.CloneDefaults(ItemID.WispinaBottle); - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); + Item.CloneDefaults(ItemID.WispinaBottle); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); - item.value = Item.sellPrice(gold: 1); - item.rare = ItemRarityID.Pink; - item.Calamity().donorItem = true; + Item.value = Item.sellPrice(gold: 1); + Item.rare = ItemRarityID.Pink; + Item.Calamity().donorItem = true; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldButterfly); - recipe.AddIngredient(ItemID.MonarchButterfly); - recipe.AddIngredient(ItemID.PurpleEmperorButterfly); - recipe.AddIngredient(ItemID.RedAdmiralButterfly); - recipe.AddIngredient(ItemID.UlyssesButterfly); - recipe.AddIngredient(ItemID.SulphurButterfly); - recipe.AddIngredient(ItemID.TreeNymphButterfly); - recipe.AddIngredient(ItemID.ZebraSwallowtailButterfly); - recipe.AddIngredient(ItemID.JuliaButterfly); - recipe.AddTile(TileID.CrystalBall); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.GoldButterfly).AddIngredient(ItemID.MonarchButterfly).AddIngredient(ItemID.PurpleEmperorButterfly).AddIngredient(ItemID.RedAdmiralButterfly).AddIngredient(ItemID.UlyssesButterfly).AddIngredient(ItemID.SulphurButterfly).AddIngredient(ItemID.TreeNymphButterfly).AddIngredient(ItemID.ZebraSwallowtailButterfly).AddIngredient(ItemID.JuliaButterfly).AddTile(TileID.CrystalBall).Register(); } } } diff --git a/Items/Pets/StrangeOrb.cs b/Items/Pets/StrangeOrb.cs index 6a95995312..4471bc8b01 100644 --- a/Items/Pets/StrangeOrb.cs +++ b/Items/Pets/StrangeOrb.cs @@ -17,16 +17,16 @@ namespace CalamityMod.Items.Pets public override void SetDefaults() { - item.CloneDefaults(ItemID.WispinaBottle); - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); + Item.CloneDefaults(ItemID.WispinaBottle); + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 3600, true); + player.AddBuff(Item.buffType, 3600, true); } } } diff --git a/Items/Pets/TrashmanTrashcan.cs b/Items/Pets/TrashmanTrashcan.cs index 108984dc9f..d1aa1de0db 100644 --- a/Items/Pets/TrashmanTrashcan.cs +++ b/Items/Pets/TrashmanTrashcan.cs @@ -15,27 +15,27 @@ namespace CalamityMod.Items.Pets } public override void SetDefaults() { - item.damage = 0; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = 20; - item.useTime = 20; - item.noMelee = true; - item.width = 30; - item.height = 30; - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); - item.UseSound = SoundID.NPCDeath13; + Item.damage = 0; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = 20; + Item.useTime = 20; + Item.noMelee = true; + Item.width = 30; + Item.height = 30; + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); + Item.UseSound = SoundID.NPCDeath13; - item.value = Item.sellPrice(gold: 1); - item.rare = ItemRarityID.Pink; - item.Calamity().devItem = true; + Item.value = Item.sellPrice(gold: 1); + Item.rare = ItemRarityID.Pink; + Item.Calamity().devItem = true; } public override void UseStyle(Player player) { if (player.whoAmI == Main.myPlayer && player.itemTime == 0) { - player.AddBuff(item.buffType, 15, true); + player.AddBuff(Item.buffType, 15, true); } } } diff --git a/Items/Placeables/AbyssGravel.cs b/Items/Placeables/AbyssGravel.cs index e215445966..ea761b5b65 100644 --- a/Items/Placeables/AbyssGravel.cs +++ b/Items/Placeables/AbyssGravel.cs @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; } } } diff --git a/Items/Placeables/Acidwood.cs b/Items/Placeables/Acidwood.cs index 02433713a9..a6ff53dfb1 100644 --- a/Items/Placeables/Acidwood.cs +++ b/Items/Placeables/Acidwood.cs @@ -14,24 +14,21 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).Register(); } } } diff --git a/Items/Placeables/AerialiteBrick.cs b/Items/Placeables/AerialiteBrick.cs index c44738b77a..d58f47024b 100644 --- a/Items/Placeables/AerialiteBrick.cs +++ b/Items/Placeables/AerialiteBrick.cs @@ -12,31 +12,22 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddRecipeGroup("AnyStoneBlock"); - recipe.SetResult(this, 10); - recipe.AddTile(TileID.Furnaces); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(10).AddIngredient(ModContent.ItemType(), 1).AddRecipeGroup("AnyStoneBlock").AddTile(TileID.Furnaces).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/AstralBar.cs b/Items/Placeables/AstralBar.cs index c6cbf8dd90..54b1ce319b 100644 --- a/Items/Placeables/AstralBar.cs +++ b/Items/Placeables/AstralBar.cs @@ -16,28 +16,23 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 99; - item.rare = ItemRarityID.Cyan; - item.value = Item.sellPrice(gold: 1, silver: 20); + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 99; + Item.rare = ItemRarityID.Cyan; + Item.value = Item.sellPrice(gold: 1, silver: 20); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/AstralBrick.cs b/Items/Placeables/AstralBrick.cs index 9a25071526..dd1954b482 100644 --- a/Items/Placeables/AstralBrick.cs +++ b/Items/Placeables/AstralBrick.cs @@ -13,31 +13,22 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 10); - recipe.AddTile(TileID.Furnaces); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(10).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.Furnaces).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/AstralClay.cs b/Items/Placeables/AstralClay.cs index 53862c73bc..5e09d3ff55 100644 --- a/Items/Placeables/AstralClay.cs +++ b/Items/Placeables/AstralClay.cs @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } } } diff --git a/Items/Placeables/AstralDirt.cs b/Items/Placeables/AstralDirt.cs index 5d68b538a3..98ceeac2df 100644 --- a/Items/Placeables/AstralDirt.cs +++ b/Items/Placeables/AstralDirt.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(1).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType(), 4).Register(); } } } diff --git a/Items/Placeables/AstralFossil.cs b/Items/Placeables/AstralFossil.cs index 168a08d587..152ee562fe 100644 --- a/Items/Placeables/AstralFossil.cs +++ b/Items/Placeables/AstralFossil.cs @@ -16,27 +16,22 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - ItemID.Sets.ExtractinatorMode[item.type] = item.type; - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + ItemID.Sets.ExtractinatorMode[Item.type] = Item.type; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(1).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType(), 4).Register(); } public override void ExtractinatorUse(ref int resultType, ref int resultStack) diff --git a/Items/Placeables/AstralIce.cs b/Items/Placeables/AstralIce.cs index cc5fc01379..834ea56696 100644 --- a/Items/Placeables/AstralIce.cs +++ b/Items/Placeables/AstralIce.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(1).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType(), 4).Register(); } } } diff --git a/Items/Placeables/AstralMonolith.cs b/Items/Placeables/AstralMonolith.cs index 57742858f4..fa068a7478 100644 --- a/Items/Placeables/AstralMonolith.cs +++ b/Items/Placeables/AstralMonolith.cs @@ -14,29 +14,22 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).Register(); } } } diff --git a/Items/Placeables/AstralSand.cs b/Items/Placeables/AstralSand.cs index 8ee7e654df..716ad7ef5c 100644 --- a/Items/Placeables/AstralSand.cs +++ b/Items/Placeables/AstralSand.cs @@ -12,21 +12,21 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; // item.ammo = AmmoID.Sand; // item.shoot = ModContent.ProjectileType(); // item.notAmmo = true; // item.shootSpeed = 15f; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.noMelee = true; } } } diff --git a/Items/Placeables/AstralSandstone.cs b/Items/Placeables/AstralSandstone.cs index f0dc57708e..fb3a79281d 100644 --- a/Items/Placeables/AstralSandstone.cs +++ b/Items/Placeables/AstralSandstone.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(1).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType(), 4).Register(); } } } diff --git a/Items/Placeables/AstralSilt.cs b/Items/Placeables/AstralSilt.cs index 807dfcd11d..08d2189f28 100644 --- a/Items/Placeables/AstralSilt.cs +++ b/Items/Placeables/AstralSilt.cs @@ -15,17 +15,17 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - ItemID.Sets.ExtractinatorMode[item.type] = item.type; - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + ItemID.Sets.ExtractinatorMode[Item.type] = Item.type; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void ExtractinatorUse(ref int resultType, ref int resultStack) { diff --git a/Items/Placeables/AstralSnow.cs b/Items/Placeables/AstralSnow.cs index a127680e18..21ec069cc0 100644 --- a/Items/Placeables/AstralSnow.cs +++ b/Items/Placeables/AstralSnow.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(1).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType(), 4).Register(); } } } diff --git a/Items/Placeables/AstralStone.cs b/Items/Placeables/AstralStone.cs index c57d7de5c3..c4d5d6b551 100644 --- a/Items/Placeables/AstralStone.cs +++ b/Items/Placeables/AstralStone.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(1).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType(), 4).Register(); } } } diff --git a/Items/Placeables/Banners/AcidEelBanner.cs b/Items/Placeables/Banners/AcidEelBanner.cs index f7b0e3cff0..5e46f8c7d1 100644 --- a/Items/Placeables/Banners/AcidEelBanner.cs +++ b/Items/Placeables/Banners/AcidEelBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 115; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 115; } } } diff --git a/Items/Placeables/Banners/AeroSlimeBanner.cs b/Items/Placeables/Banners/AeroSlimeBanner.cs index 5884816700..77bd73c3b0 100644 --- a/Items/Placeables/Banners/AeroSlimeBanner.cs +++ b/Items/Placeables/Banners/AeroSlimeBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 90; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 90; } } } diff --git a/Items/Placeables/Banners/AmberCrawlerBanner.cs b/Items/Placeables/Banners/AmberCrawlerBanner.cs index a046d71568..8dbc61813b 100644 --- a/Items/Placeables/Banners/AmberCrawlerBanner.cs +++ b/Items/Placeables/Banners/AmberCrawlerBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 72; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 72; } } } diff --git a/Items/Placeables/Banners/AmethystCrawlerBanner.cs b/Items/Placeables/Banners/AmethystCrawlerBanner.cs index ec02151bba..85d8d3fa24 100644 --- a/Items/Placeables/Banners/AmethystCrawlerBanner.cs +++ b/Items/Placeables/Banners/AmethystCrawlerBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 66; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 66; } } } diff --git a/Items/Placeables/Banners/AngryDogBanner.cs b/Items/Placeables/Banners/AngryDogBanner.cs index 00d5d243c5..84894d7ece 100644 --- a/Items/Placeables/Banners/AngryDogBanner.cs +++ b/Items/Placeables/Banners/AngryDogBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 59; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 59; } } } diff --git a/Items/Placeables/Banners/AnthozoanCrabBanner.cs b/Items/Placeables/Banners/AnthozoanCrabBanner.cs index 9f871ab4de..7b8e496e39 100644 --- a/Items/Placeables/Banners/AnthozoanCrabBanner.cs +++ b/Items/Placeables/Banners/AnthozoanCrabBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 120; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 120; } } } diff --git a/Items/Placeables/Banners/AquaticAberrationBanner.cs b/Items/Placeables/Banners/AquaticAberrationBanner.cs index f0184c971d..650f4c26b1 100644 --- a/Items/Placeables/Banners/AquaticAberrationBanner.cs +++ b/Items/Placeables/Banners/AquaticAberrationBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 10; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 10; } } } diff --git a/Items/Placeables/Banners/AquaticParasiteBanner.cs b/Items/Placeables/Banners/AquaticParasiteBanner.cs index 4e545b7360..9ed64746e1 100644 --- a/Items/Placeables/Banners/AquaticParasiteBanner.cs +++ b/Items/Placeables/Banners/AquaticParasiteBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 0; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 0; } } } diff --git a/Items/Placeables/Banners/AquaticSeekerBanner.cs b/Items/Placeables/Banners/AquaticSeekerBanner.cs index 266ffa712d..3201ae5470 100644 --- a/Items/Placeables/Banners/AquaticSeekerBanner.cs +++ b/Items/Placeables/Banners/AquaticSeekerBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 6; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 6; } } } diff --git a/Items/Placeables/Banners/AquaticUrchinBanner.cs b/Items/Placeables/Banners/AquaticUrchinBanner.cs index 1832c2cd6a..b21ab9b2be 100644 --- a/Items/Placeables/Banners/AquaticUrchinBanner.cs +++ b/Items/Placeables/Banners/AquaticUrchinBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 7; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 7; } } } diff --git a/Items/Placeables/Banners/AriesBanner.cs b/Items/Placeables/Banners/AriesBanner.cs index a26ba6d725..c3b4c8e1a2 100644 --- a/Items/Placeables/Banners/AriesBanner.cs +++ b/Items/Placeables/Banners/AriesBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 34; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 34; } } } diff --git a/Items/Placeables/Banners/ArmoredDiggerBanner.cs b/Items/Placeables/Banners/ArmoredDiggerBanner.cs index 023fb40220..525410858e 100644 --- a/Items/Placeables/Banners/ArmoredDiggerBanner.cs +++ b/Items/Placeables/Banners/ArmoredDiggerBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 77; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 77; } } } diff --git a/Items/Placeables/Banners/AstralProbeBanner.cs b/Items/Placeables/Banners/AstralProbeBanner.cs index bb00675d7e..c8371715bb 100644 --- a/Items/Placeables/Banners/AstralProbeBanner.cs +++ b/Items/Placeables/Banners/AstralProbeBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 31; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 31; } } } diff --git a/Items/Placeables/Banners/AstralSlimeBanner.cs b/Items/Placeables/Banners/AstralSlimeBanner.cs index 3bd6c5f002..1029a4702e 100644 --- a/Items/Placeables/Banners/AstralSlimeBanner.cs +++ b/Items/Placeables/Banners/AstralSlimeBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 35; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 35; } } } diff --git a/Items/Placeables/Banners/AstralachneaBanner.cs b/Items/Placeables/Banners/AstralachneaBanner.cs index 10ca191141..52f137ce5e 100644 --- a/Items/Placeables/Banners/AstralachneaBanner.cs +++ b/Items/Placeables/Banners/AstralachneaBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 39; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 39; } } } diff --git a/Items/Placeables/Banners/AtlasBanner.cs b/Items/Placeables/Banners/AtlasBanner.cs index 80ce81c992..66544d530b 100644 --- a/Items/Placeables/Banners/AtlasBanner.cs +++ b/Items/Placeables/Banners/AtlasBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 36; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 36; } } } diff --git a/Items/Placeables/Banners/BOHLDOHRBanner.cs b/Items/Placeables/Banners/BOHLDOHRBanner.cs index ab1aa8f588..009726d727 100644 --- a/Items/Placeables/Banners/BOHLDOHRBanner.cs +++ b/Items/Placeables/Banners/BOHLDOHRBanner.cs @@ -15,19 +15,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 87; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 87; } } } diff --git a/Items/Placeables/Banners/BelchingCoralBanner.cs b/Items/Placeables/Banners/BelchingCoralBanner.cs index 0e05252e2c..afec9c24d9 100644 --- a/Items/Placeables/Banners/BelchingCoralBanner.cs +++ b/Items/Placeables/Banners/BelchingCoralBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 121; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 121; } } } diff --git a/Items/Placeables/Banners/BigSightseerBanner.cs b/Items/Placeables/Banners/BigSightseerBanner.cs index 326a86d7e7..b562aae513 100644 --- a/Items/Placeables/Banners/BigSightseerBanner.cs +++ b/Items/Placeables/Banners/BigSightseerBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 33; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 33; } } } diff --git a/Items/Placeables/Banners/BlightedEyeBanner.cs b/Items/Placeables/Banners/BlightedEyeBanner.cs index c7b3148a5a..cb91be1c85 100644 --- a/Items/Placeables/Banners/BlightedEyeBanner.cs +++ b/Items/Placeables/Banners/BlightedEyeBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 54; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 54; } } } diff --git a/Items/Placeables/Banners/BlindedAnglerBanner.cs b/Items/Placeables/Banners/BlindedAnglerBanner.cs index 2580415ef4..72598a662e 100644 --- a/Items/Placeables/Banners/BlindedAnglerBanner.cs +++ b/Items/Placeables/Banners/BlindedAnglerBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 104; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 104; } } } diff --git a/Items/Placeables/Banners/BloatfishBanner.cs b/Items/Placeables/Banners/BloatfishBanner.cs index 0179123842..d147270d1e 100644 --- a/Items/Placeables/Banners/BloatfishBanner.cs +++ b/Items/Placeables/Banners/BloatfishBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 28; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 28; } } } diff --git a/Items/Placeables/Banners/BloomSlimeBanner.cs b/Items/Placeables/Banners/BloomSlimeBanner.cs index 73beb83e7a..d437c954c5 100644 --- a/Items/Placeables/Banners/BloomSlimeBanner.cs +++ b/Items/Placeables/Banners/BloomSlimeBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 94; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 94; } } } diff --git a/Items/Placeables/Banners/BobbitWormBanner.cs b/Items/Placeables/Banners/BobbitWormBanner.cs index 4350819080..710b26c0bb 100644 --- a/Items/Placeables/Banners/BobbitWormBanner.cs +++ b/Items/Placeables/Banners/BobbitWormBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 29; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 29; } } } diff --git a/Items/Placeables/Banners/BoxJellyfishBanner.cs b/Items/Placeables/Banners/BoxJellyfishBanner.cs index 830d5d6c2d..153f906b1c 100644 --- a/Items/Placeables/Banners/BoxJellyfishBanner.cs +++ b/Items/Placeables/Banners/BoxJellyfishBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 13; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 13; } } } diff --git a/Items/Placeables/Banners/CalamityEyeBanner.cs b/Items/Placeables/Banners/CalamityEyeBanner.cs index de64cf7347..b12431545e 100644 --- a/Items/Placeables/Banners/CalamityEyeBanner.cs +++ b/Items/Placeables/Banners/CalamityEyeBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 55; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 55; } } } diff --git a/Items/Placeables/Banners/CatfishBanner.cs b/Items/Placeables/Banners/CatfishBanner.cs index 6d597856b4..bede874354 100644 --- a/Items/Placeables/Banners/CatfishBanner.cs +++ b/Items/Placeables/Banners/CatfishBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 4; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 4; } } } diff --git a/Items/Placeables/Banners/ChaoticPufferBanner.cs b/Items/Placeables/Banners/ChaoticPufferBanner.cs index 875f521438..a4d4e68d21 100644 --- a/Items/Placeables/Banners/ChaoticPufferBanner.cs +++ b/Items/Placeables/Banners/ChaoticPufferBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 30; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 30; } } } diff --git a/Items/Placeables/Banners/CharredSlimeBanner.cs b/Items/Placeables/Banners/CharredSlimeBanner.cs index 16abd4daf5..e803c7017a 100644 --- a/Items/Placeables/Banners/CharredSlimeBanner.cs +++ b/Items/Placeables/Banners/CharredSlimeBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 93; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 93; } } } diff --git a/Items/Placeables/Banners/ClamBanner.cs b/Items/Placeables/Banners/ClamBanner.cs index 92cf4dadf9..ad9212ca20 100644 --- a/Items/Placeables/Banners/ClamBanner.cs +++ b/Items/Placeables/Banners/ClamBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 99; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 99; } } } diff --git a/Items/Placeables/Banners/CloudElementalBanner.cs b/Items/Placeables/Banners/CloudElementalBanner.cs index d3578ce979..ee3a4f71a1 100644 --- a/Items/Placeables/Banners/CloudElementalBanner.cs +++ b/Items/Placeables/Banners/CloudElementalBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 58; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 58; } } } diff --git a/Items/Placeables/Banners/CnidrionBanner.cs b/Items/Placeables/Banners/CnidrionBanner.cs index 5b64ac680f..81d3f30ca6 100644 --- a/Items/Placeables/Banners/CnidrionBanner.cs +++ b/Items/Placeables/Banners/CnidrionBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 63; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 63; } } } diff --git a/Items/Placeables/Banners/ColossalSquidBanner.cs b/Items/Placeables/Banners/ColossalSquidBanner.cs index a0269d8b8d..8a95566542 100644 --- a/Items/Placeables/Banners/ColossalSquidBanner.cs +++ b/Items/Placeables/Banners/ColossalSquidBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 23; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 23; } } } diff --git a/Items/Placeables/Banners/CosmicElementalBanner.cs b/Items/Placeables/Banners/CosmicElementalBanner.cs index 241e3d6c4e..80f26c33b4 100644 --- a/Items/Placeables/Banners/CosmicElementalBanner.cs +++ b/Items/Placeables/Banners/CosmicElementalBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 75; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 75; } } } diff --git a/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs b/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs index 2888985e5a..75a704199f 100644 --- a/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs +++ b/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 89; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 89; } } } diff --git a/Items/Placeables/Banners/CryoSlimeBanner.cs b/Items/Placeables/Banners/CryoSlimeBanner.cs index 408e82814b..4d334bcbff 100644 --- a/Items/Placeables/Banners/CryoSlimeBanner.cs +++ b/Items/Placeables/Banners/CryoSlimeBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 91; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 91; } } } diff --git a/Items/Placeables/Banners/CryonBanner.cs b/Items/Placeables/Banners/CryonBanner.cs index cf201fba24..42cf665848 100644 --- a/Items/Placeables/Banners/CryonBanner.cs +++ b/Items/Placeables/Banners/CryonBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 60; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 60; } } } diff --git a/Items/Placeables/Banners/CrystalCrawlerBanner.cs b/Items/Placeables/Banners/CrystalCrawlerBanner.cs index b50efd0259..55c2c6ac4b 100644 --- a/Items/Placeables/Banners/CrystalCrawlerBanner.cs +++ b/Items/Placeables/Banners/CrystalCrawlerBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 73; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 73; } } } diff --git a/Items/Placeables/Banners/CultistAssassinBanner.cs b/Items/Placeables/Banners/CultistAssassinBanner.cs index ff63a31dc3..83eec1b9da 100644 --- a/Items/Placeables/Banners/CultistAssassinBanner.cs +++ b/Items/Placeables/Banners/CultistAssassinBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 95; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 95; } } } diff --git a/Items/Placeables/Banners/CuttlefishBanner.cs b/Items/Placeables/Banners/CuttlefishBanner.cs index 144bac4fca..23b14b5497 100644 --- a/Items/Placeables/Banners/CuttlefishBanner.cs +++ b/Items/Placeables/Banners/CuttlefishBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 16; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 16; } } } diff --git a/Items/Placeables/Banners/DespairStoneBanner.cs b/Items/Placeables/Banners/DespairStoneBanner.cs index 2720ae1187..7abae63a83 100644 --- a/Items/Placeables/Banners/DespairStoneBanner.cs +++ b/Items/Placeables/Banners/DespairStoneBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 46; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 46; } } } diff --git a/Items/Placeables/Banners/DevilFishBanner.cs b/Items/Placeables/Banners/DevilFishBanner.cs index eb34d6bfbf..56612317d9 100644 --- a/Items/Placeables/Banners/DevilFishBanner.cs +++ b/Items/Placeables/Banners/DevilFishBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 15; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 15; } } } diff --git a/Items/Placeables/Banners/DiamondCrawlerBanner.cs b/Items/Placeables/Banners/DiamondCrawlerBanner.cs index 4ffabc43d8..38c4624abd 100644 --- a/Items/Placeables/Banners/DiamondCrawlerBanner.cs +++ b/Items/Placeables/Banners/DiamondCrawlerBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 71; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 71; } } } diff --git a/Items/Placeables/Banners/EarthElementalBanner.cs b/Items/Placeables/Banners/EarthElementalBanner.cs index 4b28c9e7d9..d297359b7b 100644 --- a/Items/Placeables/Banners/EarthElementalBanner.cs +++ b/Items/Placeables/Banners/EarthElementalBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 76; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 76; } } } diff --git a/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs b/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs index a3482718d1..9d21c68cc4 100644 --- a/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs +++ b/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 88; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 88; } } } diff --git a/Items/Placeables/Banners/EidolistBanner.cs b/Items/Placeables/Banners/EidolistBanner.cs index bd68fe5250..f0dbabd113 100644 --- a/Items/Placeables/Banners/EidolistBanner.cs +++ b/Items/Placeables/Banners/EidolistBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 25; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 25; } } } diff --git a/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs b/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs index 5f437e16bb..7e7a221737 100644 --- a/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs +++ b/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 27; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 27; } } } diff --git a/Items/Placeables/Banners/EmeraldCrawlerBanner.cs b/Items/Placeables/Banners/EmeraldCrawlerBanner.cs index f4fe47440c..6ea4f62aff 100644 --- a/Items/Placeables/Banners/EmeraldCrawlerBanner.cs +++ b/Items/Placeables/Banners/EmeraldCrawlerBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 69; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 69; } } } diff --git a/Items/Placeables/Banners/EutrophicRayBanner.cs b/Items/Placeables/Banners/EutrophicRayBanner.cs index f3e987c7a1..22e1606497 100644 --- a/Items/Placeables/Banners/EutrophicRayBanner.cs +++ b/Items/Placeables/Banners/EutrophicRayBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 100; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 100; } } } diff --git a/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.cs b/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.cs index 4ebc5f21b5..1067838610 100644 --- a/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.cs +++ b/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.cs @@ -14,22 +14,22 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; - item.value = Item.buyPrice(silver: 10); - item.rare = ItemRarityID.Blue; - item.Calamity().donorItem = true; + Item.value = Item.buyPrice(silver: 10); + Item.rare = ItemRarityID.Blue; + Item.Calamity().donorItem = true; - item.createTile = ModContent.TileType(); - item.placeStyle = 109; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 109; } } } diff --git a/Items/Placeables/Banners/FlakBabyBanner.cs b/Items/Placeables/Banners/FlakBabyBanner.cs index e3c0329f20..cb90a5a926 100644 --- a/Items/Placeables/Banners/FlakBabyBanner.cs +++ b/Items/Placeables/Banners/FlakBabyBanner.cs @@ -15,19 +15,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 119; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 119; } } } diff --git a/Items/Placeables/Banners/FlakCrabBanner.cs b/Items/Placeables/Banners/FlakCrabBanner.cs index 2c7870cd47..b355206b03 100644 --- a/Items/Placeables/Banners/FlakCrabBanner.cs +++ b/Items/Placeables/Banners/FlakCrabBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 117; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 117; } } } diff --git a/Items/Placeables/Banners/FlounderBanner.cs b/Items/Placeables/Banners/FlounderBanner.cs index 1b02202785..0cc1de6412 100644 --- a/Items/Placeables/Banners/FlounderBanner.cs +++ b/Items/Placeables/Banners/FlounderBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 1; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 1; } } } diff --git a/Items/Placeables/Banners/FrogfishBanner.cs b/Items/Placeables/Banners/FrogfishBanner.cs index e5d2cea585..44ae3332bf 100644 --- a/Items/Placeables/Banners/FrogfishBanner.cs +++ b/Items/Placeables/Banners/FrogfishBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 8; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 8; } } } diff --git a/Items/Placeables/Banners/FusionFeederBanner.cs b/Items/Placeables/Banners/FusionFeederBanner.cs index 1a0240546c..7e4901986a 100644 --- a/Items/Placeables/Banners/FusionFeederBanner.cs +++ b/Items/Placeables/Banners/FusionFeederBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 42; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 42; } } } diff --git a/Items/Placeables/Banners/GammaSlimeBanner.cs b/Items/Placeables/Banners/GammaSlimeBanner.cs index 886dfcbc70..f4a6bf7a5b 100644 --- a/Items/Placeables/Banners/GammaSlimeBanner.cs +++ b/Items/Placeables/Banners/GammaSlimeBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 122; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 122; } } } diff --git a/Items/Placeables/Banners/GhostBellBanner.cs b/Items/Placeables/Banners/GhostBellBanner.cs index 64b34d478f..5182e48b85 100644 --- a/Items/Placeables/Banners/GhostBellBanner.cs +++ b/Items/Placeables/Banners/GhostBellBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 101; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 101; } } } diff --git a/Items/Placeables/Banners/GhostBellSmallBanner.cs b/Items/Placeables/Banners/GhostBellSmallBanner.cs index be8aa2c057..f61ebb0184 100644 --- a/Items/Placeables/Banners/GhostBellSmallBanner.cs +++ b/Items/Placeables/Banners/GhostBellSmallBanner.cs @@ -15,19 +15,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 102; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 102; } } } diff --git a/Items/Placeables/Banners/GiantClamBanner.cs b/Items/Placeables/Banners/GiantClamBanner.cs index 15f7b3436a..486950cfbd 100644 --- a/Items/Placeables/Banners/GiantClamBanner.cs +++ b/Items/Placeables/Banners/GiantClamBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 107; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 107; } } } diff --git a/Items/Placeables/Banners/GiantSquidBanner.cs b/Items/Placeables/Banners/GiantSquidBanner.cs index 44595ccf9b..c880d84c5d 100644 --- a/Items/Placeables/Banners/GiantSquidBanner.cs +++ b/Items/Placeables/Banners/GiantSquidBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 20; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 20; } } } diff --git a/Items/Placeables/Banners/GnasherBanner.cs b/Items/Placeables/Banners/GnasherBanner.cs index 3e28c54bd3..773bf50b07 100644 --- a/Items/Placeables/Banners/GnasherBanner.cs +++ b/Items/Placeables/Banners/GnasherBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 2; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 2; } } } diff --git a/Items/Placeables/Banners/GreatSandSharkBanner.cs b/Items/Placeables/Banners/GreatSandSharkBanner.cs index 932753a60d..3a9da03238 100644 --- a/Items/Placeables/Banners/GreatSandSharkBanner.cs +++ b/Items/Placeables/Banners/GreatSandSharkBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 65; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 65; } } } diff --git a/Items/Placeables/Banners/GulperEelBanner.cs b/Items/Placeables/Banners/GulperEelBanner.cs index 023b76e483..d7940ba159 100644 --- a/Items/Placeables/Banners/GulperEelBanner.cs +++ b/Items/Placeables/Banners/GulperEelBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 26; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 26; } } } diff --git a/Items/Placeables/Banners/HadarianBanner.cs b/Items/Placeables/Banners/HadarianBanner.cs index b8b1154f5a..f7983068ea 100644 --- a/Items/Placeables/Banners/HadarianBanner.cs +++ b/Items/Placeables/Banners/HadarianBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 43; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 43; } } } diff --git a/Items/Placeables/Banners/HeatSpiritBanner.cs b/Items/Placeables/Banners/HeatSpiritBanner.cs index 4496f1fde0..13be7e5f84 100644 --- a/Items/Placeables/Banners/HeatSpiritBanner.cs +++ b/Items/Placeables/Banners/HeatSpiritBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 44; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 44; } } } diff --git a/Items/Placeables/Banners/HiveBanner.cs b/Items/Placeables/Banners/HiveBanner.cs index 73738a115a..cc97873cf2 100644 --- a/Items/Placeables/Banners/HiveBanner.cs +++ b/Items/Placeables/Banners/HiveBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 40; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 40; } } } diff --git a/Items/Placeables/Banners/IceClasperBanner.cs b/Items/Placeables/Banners/IceClasperBanner.cs index 1642525390..d4ac656777 100644 --- a/Items/Placeables/Banners/IceClasperBanner.cs +++ b/Items/Placeables/Banners/IceClasperBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 61; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 61; } } } diff --git a/Items/Placeables/Banners/ImpiousImmolatorBanner.cs b/Items/Placeables/Banners/ImpiousImmolatorBanner.cs index 3dc7436e76..5d709c035e 100644 --- a/Items/Placeables/Banners/ImpiousImmolatorBanner.cs +++ b/Items/Placeables/Banners/ImpiousImmolatorBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 48; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 48; } } } diff --git a/Items/Placeables/Banners/IrradiatedSlimeBanner.cs b/Items/Placeables/Banners/IrradiatedSlimeBanner.cs index e64eaa875a..b8a86b3fab 100644 --- a/Items/Placeables/Banners/IrradiatedSlimeBanner.cs +++ b/Items/Placeables/Banners/IrradiatedSlimeBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 97; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 97; } } } diff --git a/Items/Placeables/Banners/LaserfishBanner.cs b/Items/Placeables/Banners/LaserfishBanner.cs index cb8d7f93b9..6019cebcbe 100644 --- a/Items/Placeables/Banners/LaserfishBanner.cs +++ b/Items/Placeables/Banners/LaserfishBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 21; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 21; } } } diff --git a/Items/Placeables/Banners/LuminousCorvinaBanner.cs b/Items/Placeables/Banners/LuminousCorvinaBanner.cs index bd400aaec3..2585f9048e 100644 --- a/Items/Placeables/Banners/LuminousCorvinaBanner.cs +++ b/Items/Placeables/Banners/LuminousCorvinaBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 19; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 19; } } } diff --git a/Items/Placeables/Banners/MantisBanner.cs b/Items/Placeables/Banners/MantisBanner.cs index a946a14ffd..070b8ad9a4 100644 --- a/Items/Placeables/Banners/MantisBanner.cs +++ b/Items/Placeables/Banners/MantisBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 37; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 37; } } } diff --git a/Items/Placeables/Banners/MantisShrimpBanner.cs b/Items/Placeables/Banners/MantisShrimpBanner.cs index f5a80b7424..f449669f14 100644 --- a/Items/Placeables/Banners/MantisShrimpBanner.cs +++ b/Items/Placeables/Banners/MantisShrimpBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 9; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 9; } } } diff --git a/Items/Placeables/Banners/MaulerBanner.cs b/Items/Placeables/Banners/MaulerBanner.cs index 8e2b7ffcb8..c5532beae4 100644 --- a/Items/Placeables/Banners/MaulerBanner.cs +++ b/Items/Placeables/Banners/MaulerBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 5; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 5; } } } diff --git a/Items/Placeables/Banners/MelterBanner.cs b/Items/Placeables/Banners/MelterBanner.cs index 4f64b19d36..1f16174c4c 100644 --- a/Items/Placeables/Banners/MelterBanner.cs +++ b/Items/Placeables/Banners/MelterBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 78; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 78; } } } diff --git a/Items/Placeables/Banners/MirageJellyBanner.cs b/Items/Placeables/Banners/MirageJellyBanner.cs index 52e33f1618..ab14e8411e 100644 --- a/Items/Placeables/Banners/MirageJellyBanner.cs +++ b/Items/Placeables/Banners/MirageJellyBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 24; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 24; } } } diff --git a/Items/Placeables/Banners/MorayEelBanner.cs b/Items/Placeables/Banners/MorayEelBanner.cs index c69702d242..7f31c1b748 100644 --- a/Items/Placeables/Banners/MorayEelBanner.cs +++ b/Items/Placeables/Banners/MorayEelBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 14; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 14; } } } diff --git a/Items/Placeables/Banners/NovaBanner.cs b/Items/Placeables/Banners/NovaBanner.cs index 42d2da9259..f77e61a700 100644 --- a/Items/Placeables/Banners/NovaBanner.cs +++ b/Items/Placeables/Banners/NovaBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 38; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 38; } } } diff --git a/Items/Placeables/Banners/NuclearToadBanner.cs b/Items/Placeables/Banners/NuclearToadBanner.cs index 75cde647a5..974e9953a0 100644 --- a/Items/Placeables/Banners/NuclearToadBanner.cs +++ b/Items/Placeables/Banners/NuclearToadBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 116; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 116; } } } diff --git a/Items/Placeables/Banners/OarfishBanner.cs b/Items/Placeables/Banners/OarfishBanner.cs index 61cdddd0d0..ef819eb696 100644 --- a/Items/Placeables/Banners/OarfishBanner.cs +++ b/Items/Placeables/Banners/OarfishBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 22; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 22; } } } diff --git a/Items/Placeables/Banners/OrthoceraBanner.cs b/Items/Placeables/Banners/OrthoceraBanner.cs index 8a46ea2112..cbe8c504f7 100644 --- a/Items/Placeables/Banners/OrthoceraBanner.cs +++ b/Items/Placeables/Banners/OrthoceraBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 112; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 112; } } } diff --git a/Items/Placeables/Banners/OverloadedSoldierBanner.cs b/Items/Placeables/Banners/OverloadedSoldierBanner.cs index ca1ecba7aa..8c5741a371 100644 --- a/Items/Placeables/Banners/OverloadedSoldierBanner.cs +++ b/Items/Placeables/Banners/OverloadedSoldierBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 85; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 85; } } } diff --git a/Items/Placeables/Banners/ParaseaBanner.cs b/Items/Placeables/Banners/ParaseaBanner.cs index e0ed32bb12..d3f14ac969 100644 --- a/Items/Placeables/Banners/ParaseaBanner.cs +++ b/Items/Placeables/Banners/ParaseaBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 11; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 11; } } } diff --git a/Items/Placeables/Banners/PerennialSlimeBanner.cs b/Items/Placeables/Banners/PerennialSlimeBanner.cs index 8ef94e53bf..cecdb1e6cc 100644 --- a/Items/Placeables/Banners/PerennialSlimeBanner.cs +++ b/Items/Placeables/Banners/PerennialSlimeBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 92; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 92; } } } diff --git a/Items/Placeables/Banners/PestilentSlimeBanner.cs b/Items/Placeables/Banners/PestilentSlimeBanner.cs index 4aab071c12..0c5f6da377 100644 --- a/Items/Placeables/Banners/PestilentSlimeBanner.cs +++ b/Items/Placeables/Banners/PestilentSlimeBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 79; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 79; } } } diff --git a/Items/Placeables/Banners/PhantomDebrisBanner.cs b/Items/Placeables/Banners/PhantomDebrisBanner.cs index c2449316cd..30a80f6fb1 100644 --- a/Items/Placeables/Banners/PhantomDebrisBanner.cs +++ b/Items/Placeables/Banners/PhantomDebrisBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 86; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 86; } } } diff --git a/Items/Placeables/Banners/PhantomSpiritBanner.cs b/Items/Placeables/Banners/PhantomSpiritBanner.cs index 9603bf7043..73fc4d1531 100644 --- a/Items/Placeables/Banners/PhantomSpiritBanner.cs +++ b/Items/Placeables/Banners/PhantomSpiritBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 84; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 84; } } } diff --git a/Items/Placeables/Banners/PiggyBanner.cs b/Items/Placeables/Banners/PiggyBanner.cs index 8752a0d2c6..4cc1226513 100644 --- a/Items/Placeables/Banners/PiggyBanner.cs +++ b/Items/Placeables/Banners/PiggyBanner.cs @@ -13,22 +13,22 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; - item.value = Item.buyPrice(silver: 10); - item.rare = ItemRarityID.Blue; - item.Calamity().donorItem = true; + Item.value = Item.buyPrice(silver: 10); + Item.rare = ItemRarityID.Blue; + Item.Calamity().donorItem = true; - item.createTile = ModContent.TileType(); - item.placeStyle = 108; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 108; } } } diff --git a/Items/Placeables/Banners/PitbullBanner.cs b/Items/Placeables/Banners/PitbullBanner.cs index 4496ebca0a..5756624809 100644 --- a/Items/Placeables/Banners/PitbullBanner.cs +++ b/Items/Placeables/Banners/PitbullBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 53; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 53; } } } diff --git a/Items/Placeables/Banners/PlagueChargerBanner.cs b/Items/Placeables/Banners/PlagueChargerBanner.cs index a0b0d4d31e..e878379758 100644 --- a/Items/Placeables/Banners/PlagueChargerBanner.cs +++ b/Items/Placeables/Banners/PlagueChargerBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 81; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 81; } } } diff --git a/Items/Placeables/Banners/PlaguebringerBanner.cs b/Items/Placeables/Banners/PlaguebringerBanner.cs index 66c44a86db..5b24407b96 100644 --- a/Items/Placeables/Banners/PlaguebringerBanner.cs +++ b/Items/Placeables/Banners/PlaguebringerBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 83; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 83; } } } diff --git a/Items/Placeables/Banners/PlagueshellBanner.cs b/Items/Placeables/Banners/PlagueshellBanner.cs index 3991867af1..a7323bd6e0 100644 --- a/Items/Placeables/Banners/PlagueshellBanner.cs +++ b/Items/Placeables/Banners/PlagueshellBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 80; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 80; } } } diff --git a/Items/Placeables/Banners/PrismTurtleBanner.cs b/Items/Placeables/Banners/PrismTurtleBanner.cs index 5bccc2a9f7..4bbc72b0f4 100644 --- a/Items/Placeables/Banners/PrismTurtleBanner.cs +++ b/Items/Placeables/Banners/PrismTurtleBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 98; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 98; } } } diff --git a/Items/Placeables/Banners/ProfanedEnergyBanner.cs b/Items/Placeables/Banners/ProfanedEnergyBanner.cs index 56389b349e..7852f94b0a 100644 --- a/Items/Placeables/Banners/ProfanedEnergyBanner.cs +++ b/Items/Placeables/Banners/ProfanedEnergyBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 50; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 50; } } } diff --git a/Items/Placeables/Banners/RadiatorBanner.cs b/Items/Placeables/Banners/RadiatorBanner.cs index 4c43b8cb1e..6338ca50e0 100644 --- a/Items/Placeables/Banners/RadiatorBanner.cs +++ b/Items/Placeables/Banners/RadiatorBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 110; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 110; } } } diff --git a/Items/Placeables/Banners/ReaperSharkBanner.cs b/Items/Placeables/Banners/ReaperSharkBanner.cs index e76c2204b9..ca8c14e292 100644 --- a/Items/Placeables/Banners/ReaperSharkBanner.cs +++ b/Items/Placeables/Banners/ReaperSharkBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 96; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 96; } } } diff --git a/Items/Placeables/Banners/RubyCrawlerBanner.cs b/Items/Placeables/Banners/RubyCrawlerBanner.cs index 2c988dbd98..0b14ea1ca0 100644 --- a/Items/Placeables/Banners/RubyCrawlerBanner.cs +++ b/Items/Placeables/Banners/RubyCrawlerBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 70; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 70; } } } diff --git a/Items/Placeables/Banners/SandTortoiseBanner.cs b/Items/Placeables/Banners/SandTortoiseBanner.cs index be57bcb2b5..9dbe2909d1 100644 --- a/Items/Placeables/Banners/SandTortoiseBanner.cs +++ b/Items/Placeables/Banners/SandTortoiseBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 64; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 64; } } } diff --git a/Items/Placeables/Banners/SapphireCrawlerBanner.cs b/Items/Placeables/Banners/SapphireCrawlerBanner.cs index 4537440f45..4469890889 100644 --- a/Items/Placeables/Banners/SapphireCrawlerBanner.cs +++ b/Items/Placeables/Banners/SapphireCrawlerBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 68; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 68; } } } diff --git a/Items/Placeables/Banners/ScornEaterBanner.cs b/Items/Placeables/Banners/ScornEaterBanner.cs index 72d9629269..c38f5b2780 100644 --- a/Items/Placeables/Banners/ScornEaterBanner.cs +++ b/Items/Placeables/Banners/ScornEaterBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 49; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 49; } } } diff --git a/Items/Placeables/Banners/ScryllarBanner.cs b/Items/Placeables/Banners/ScryllarBanner.cs index 40716440b3..119a1b8702 100644 --- a/Items/Placeables/Banners/ScryllarBanner.cs +++ b/Items/Placeables/Banners/ScryllarBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 45; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 45; } } } diff --git a/Items/Placeables/Banners/SeaFloatyBanner.cs b/Items/Placeables/Banners/SeaFloatyBanner.cs index 6d3137b41f..ace871e279 100644 --- a/Items/Placeables/Banners/SeaFloatyBanner.cs +++ b/Items/Placeables/Banners/SeaFloatyBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 103; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 103; } } } diff --git a/Items/Placeables/Banners/SeaMinnowBanner.cs b/Items/Placeables/Banners/SeaMinnowBanner.cs index de11659db6..e92fbc1b54 100644 --- a/Items/Placeables/Banners/SeaMinnowBanner.cs +++ b/Items/Placeables/Banners/SeaMinnowBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 105; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 105; } } } diff --git a/Items/Placeables/Banners/SeaSerpentBanner.cs b/Items/Placeables/Banners/SeaSerpentBanner.cs index de04487ccd..07ce7b73f5 100644 --- a/Items/Placeables/Banners/SeaSerpentBanner.cs +++ b/Items/Placeables/Banners/SeaSerpentBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 106; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 106; } } } diff --git a/Items/Placeables/Banners/SeaUrchinBanner.cs b/Items/Placeables/Banners/SeaUrchinBanner.cs index 0dd4e63a8b..40bf3da240 100644 --- a/Items/Placeables/Banners/SeaUrchinBanner.cs +++ b/Items/Placeables/Banners/SeaUrchinBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 12; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 12; } } } diff --git a/Items/Placeables/Banners/ShockstormShuttleBanner.cs b/Items/Placeables/Banners/ShockstormShuttleBanner.cs index 375d9c478b..bbe0f43aa0 100644 --- a/Items/Placeables/Banners/ShockstormShuttleBanner.cs +++ b/Items/Placeables/Banners/ShockstormShuttleBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 57; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 57; } } } diff --git a/Items/Placeables/Banners/SkyfinBanner.cs b/Items/Placeables/Banners/SkyfinBanner.cs index 2b6c92e057..72cc3cb12f 100644 --- a/Items/Placeables/Banners/SkyfinBanner.cs +++ b/Items/Placeables/Banners/SkyfinBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 113; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 113; } } } diff --git a/Items/Placeables/Banners/SmallSightseerBanner.cs b/Items/Placeables/Banners/SmallSightseerBanner.cs index 1666a304b8..250b92a2f0 100644 --- a/Items/Placeables/Banners/SmallSightseerBanner.cs +++ b/Items/Placeables/Banners/SmallSightseerBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 32; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 32; } } } diff --git a/Items/Placeables/Banners/SoulSluperBanner.cs b/Items/Placeables/Banners/SoulSluperBanner.cs index 7ccb178612..6b1c2c6f0e 100644 --- a/Items/Placeables/Banners/SoulSluperBanner.cs +++ b/Items/Placeables/Banners/SoulSluperBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 47; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 47; } } } diff --git a/Items/Placeables/Banners/StellarCulexBanner.cs b/Items/Placeables/Banners/StellarCulexBanner.cs index bb6350f46f..b95f663ff1 100644 --- a/Items/Placeables/Banners/StellarCulexBanner.cs +++ b/Items/Placeables/Banners/StellarCulexBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 41; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 41; } } } diff --git a/Items/Placeables/Banners/StormlionBanner.cs b/Items/Placeables/Banners/StormlionBanner.cs index 1dc8072cf8..edb9918ac7 100644 --- a/Items/Placeables/Banners/StormlionBanner.cs +++ b/Items/Placeables/Banners/StormlionBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 62; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 62; } } } diff --git a/Items/Placeables/Banners/SulfurousSkaterBanner.cs b/Items/Placeables/Banners/SulfurousSkaterBanner.cs index 6042436633..f08931a479 100644 --- a/Items/Placeables/Banners/SulfurousSkaterBanner.cs +++ b/Items/Placeables/Banners/SulfurousSkaterBanner.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 118; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 118; } } } diff --git a/Items/Placeables/Banners/SunBatBanner.cs b/Items/Placeables/Banners/SunBatBanner.cs index cdb6ee3275..97c149be23 100644 --- a/Items/Placeables/Banners/SunBatBanner.cs +++ b/Items/Placeables/Banners/SunBatBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 74; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 74; } } } diff --git a/Items/Placeables/Banners/SunskaterBanner.cs b/Items/Placeables/Banners/SunskaterBanner.cs index d1954e7c93..fab9447359 100644 --- a/Items/Placeables/Banners/SunskaterBanner.cs +++ b/Items/Placeables/Banners/SunskaterBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 56; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 56; } } } diff --git a/Items/Placeables/Banners/TopazCrawlerBanner.cs b/Items/Placeables/Banners/TopazCrawlerBanner.cs index 90d75a520d..af264b6d7a 100644 --- a/Items/Placeables/Banners/TopazCrawlerBanner.cs +++ b/Items/Placeables/Banners/TopazCrawlerBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 67; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 67; } } } diff --git a/Items/Placeables/Banners/ToxicMinnowBanner.cs b/Items/Placeables/Banners/ToxicMinnowBanner.cs index 89161c8bea..22cb613a6c 100644 --- a/Items/Placeables/Banners/ToxicMinnowBanner.cs +++ b/Items/Placeables/Banners/ToxicMinnowBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 17; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 17; } } } diff --git a/Items/Placeables/Banners/TrasherBanner.cs b/Items/Placeables/Banners/TrasherBanner.cs index 4de77b85b6..f2d08307fa 100644 --- a/Items/Placeables/Banners/TrasherBanner.cs +++ b/Items/Placeables/Banners/TrasherBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 3; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 3; } } } diff --git a/Items/Placeables/Banners/TrilobiteBanner.cs b/Items/Placeables/Banners/TrilobiteBanner.cs index 7b7927b262..b129e43fc4 100644 --- a/Items/Placeables/Banners/TrilobiteBanner.cs +++ b/Items/Placeables/Banners/TrilobiteBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 111; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 111; } } } diff --git a/Items/Placeables/Banners/ViperfishBanner.cs b/Items/Placeables/Banners/ViperfishBanner.cs index b7d4745a38..1ab6149678 100644 --- a/Items/Placeables/Banners/ViperfishBanner.cs +++ b/Items/Placeables/Banners/ViperfishBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 18; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 18; } } } diff --git a/Items/Placeables/Banners/VirulingBanner.cs b/Items/Placeables/Banners/VirulingBanner.cs index abb9f2c717..99649d6104 100644 --- a/Items/Placeables/Banners/VirulingBanner.cs +++ b/Items/Placeables/Banners/VirulingBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 82; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 82; } } } diff --git a/Items/Placeables/Banners/WaterLeechBanner.cs b/Items/Placeables/Banners/WaterLeechBanner.cs index d834b53f30..59e186a0c0 100644 --- a/Items/Placeables/Banners/WaterLeechBanner.cs +++ b/Items/Placeables/Banners/WaterLeechBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 114; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 114; } } } diff --git a/Items/Placeables/Banners/WulfrumDroneBanner.cs b/Items/Placeables/Banners/WulfrumDroneBanner.cs index fccd5bcdf0..2da7f38cc1 100644 --- a/Items/Placeables/Banners/WulfrumDroneBanner.cs +++ b/Items/Placeables/Banners/WulfrumDroneBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 52; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 52; } } } diff --git a/Items/Placeables/Banners/WulfrumGyratorBanner.cs b/Items/Placeables/Banners/WulfrumGyratorBanner.cs index c8df691dbd..72423bcdd6 100644 --- a/Items/Placeables/Banners/WulfrumGyratorBanner.cs +++ b/Items/Placeables/Banners/WulfrumGyratorBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 123; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 123; } } } diff --git a/Items/Placeables/Banners/WulfrumHovercraftBanner.cs b/Items/Placeables/Banners/WulfrumHovercraftBanner.cs index eddfc40141..b814a4f968 100644 --- a/Items/Placeables/Banners/WulfrumHovercraftBanner.cs +++ b/Items/Placeables/Banners/WulfrumHovercraftBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 124; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 124; } } } diff --git a/Items/Placeables/Banners/WulfrumPylonBanner.cs b/Items/Placeables/Banners/WulfrumPylonBanner.cs index 442b72f48a..a6e3475c1d 100644 --- a/Items/Placeables/Banners/WulfrumPylonBanner.cs +++ b/Items/Placeables/Banners/WulfrumPylonBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 126; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 126; } } } diff --git a/Items/Placeables/Banners/WulfrumRoverBanner.cs b/Items/Placeables/Banners/WulfrumRoverBanner.cs index 6f2b56edb1..ef36a41a35 100644 --- a/Items/Placeables/Banners/WulfrumRoverBanner.cs +++ b/Items/Placeables/Banners/WulfrumRoverBanner.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 125; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 125; } } } diff --git a/Items/Placeables/Banners/WulfrumSlimeBanner.cs b/Items/Placeables/Banners/WulfrumSlimeBanner.cs index 1931874629..404e375e9a 100644 --- a/Items/Placeables/Banners/WulfrumSlimeBanner.cs +++ b/Items/Placeables/Banners/WulfrumSlimeBanner.cs @@ -14,28 +14,23 @@ namespace CalamityMod.Items.Placeables.Banners public override void SetDefaults() { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.rare = ItemRarityID.Blue; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = ModContent.TileType(); - item.placeStyle = 51; + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 51; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Silk, 3); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.Loom); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Silk, 3).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.Loom).Register(); } } } diff --git a/Items/Placeables/BrimstoneSlag.cs b/Items/Placeables/BrimstoneSlag.cs index 3c67c407a4..0dacb2f416 100644 --- a/Items/Placeables/BrimstoneSlag.cs +++ b/Items/Placeables/BrimstoneSlag.cs @@ -13,27 +13,23 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = 1000; - item.rare = ItemRarityID.Orange; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = 1000; + Item.rare = ItemRarityID.Orange; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/ChaoticBrick.cs b/Items/Placeables/ChaoticBrick.cs index 26bef0fa97..9f6aa8354e 100644 --- a/Items/Placeables/ChaoticBrick.cs +++ b/Items/Placeables/ChaoticBrick.cs @@ -8,34 +8,24 @@ namespace CalamityMod.Items.Placeables { public override void SetDefaults() { - item.width = 24; - item.height = 25; - item.maxStack = 999; - item.value = 0; - item.rare = ItemRarityID.Blue; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 24; + Item.height = 25; + Item.maxStack = 999; + Item.value = 0; + Item.rare = ItemRarityID.Blue; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyStoneBlock"); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Furnaces); - recipe.SetResult(this, 10); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(10).AddRecipeGroup("AnyStoneBlock").AddIngredient(ModContent.ItemType()).AddTile(TileID.Furnaces).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/CryonicBrick.cs b/Items/Placeables/CryonicBrick.cs index 1bce29840f..f949d03bd0 100644 --- a/Items/Placeables/CryonicBrick.cs +++ b/Items/Placeables/CryonicBrick.cs @@ -12,31 +12,22 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("AnyStoneBlock"); - recipe.SetResult(this, 10); - recipe.AddTile(TileID.Furnaces); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(10).AddIngredient(ModContent.ItemType()).AddRecipeGroup("AnyStoneBlock").AddTile(TileID.Furnaces).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs index 15be843626..f1ab968142 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs @@ -14,27 +14,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs index bf7de02de5..f0a4ceb087 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs index 7a3567f5fb..7951ec4418 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs index c459f47d24..88ada8d45e 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 14; + Item.height = 28; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryElectricPanelItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryElectricPanelItem.cs index 00060e99f8..d63a5aad6c 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryElectricPanelItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryElectricPanelItem.cs @@ -14,27 +14,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs index 1cf9a75f4d..7c8ec7fcb4 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs index 9c91fdd271..08c093efed 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs @@ -14,27 +14,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs index 59e4b2d095..d2ba499c5a 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs b/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs index 2518a54e45..e1d25ffaac 100644 --- a/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs +++ b/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/AgedSecurityChest.cs b/Items/Placeables/DraedonStructures/AgedSecurityChest.cs index c6a7e40eff..6789b58b40 100644 --- a/Items/Placeables/DraedonStructures/AgedSecurityChest.cs +++ b/Items/Placeables/DraedonStructures/AgedSecurityChest.cs @@ -14,32 +14,24 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 32; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 14; - item.rare = ItemRarityID.Green; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 500; - item.createTile = ModContent.TileType(); + Item.width = 32; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 14; + Item.rare = ItemRarityID.Green; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 500; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.IronBar, 2).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/ChargingStationItem.cs b/Items/Placeables/DraedonStructures/ChargingStationItem.cs index 5fb7b19267..fa574b2775 100644 --- a/Items/Placeables/DraedonStructures/ChargingStationItem.cs +++ b/Items/Placeables/DraedonStructures/ChargingStationItem.cs @@ -16,19 +16,19 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = item.useTime = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = Item.useTime = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.value = Item.buyPrice(gold: 50); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.value = Item.buyPrice(gold: 50); } } } diff --git a/Items/Placeables/DraedonStructures/HazardChevronPanels.cs b/Items/Placeables/DraedonStructures/HazardChevronPanels.cs index b6b9f0fd84..515befeba1 100644 --- a/Items/Placeables/DraedonStructures/HazardChevronPanels.cs +++ b/Items/Placeables/DraedonStructures/HazardChevronPanels.cs @@ -11,32 +11,22 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.YellowPaint); - recipe.AddIngredient(ItemID.BlackPaint); - recipe.SetResult(this, 10); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.YellowPaint).AddIngredient(ItemID.BlackPaint).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs b/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs index 53b4998656..6ba0ddaab3 100644 --- a/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs +++ b/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs @@ -16,31 +16,24 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 22; - item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = Item.buyPrice(gold: 5); - item.rare = ItemRarityID.Orange; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.createTile = ModContent.TileType(); + Item.width = 22; + Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(gold: 5); + Item.rare = ItemRarityID.Orange; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs b/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs index 899b3bd591..c2ed20f82f 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs @@ -14,27 +14,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs b/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs index 6fdad7ca68..0377b41d7f 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs b/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs index 44221b4bbd..6f28a1c623 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs b/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs index ddaaf9e678..904699fbae 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 14; + Item.height = 28; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/LaboratoryElectricPanelItem.cs b/Items/Placeables/DraedonStructures/LaboratoryElectricPanelItem.cs index 37dabb0009..40e231a39d 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryElectricPanelItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryElectricPanelItem.cs @@ -14,27 +14,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/LaboratoryPanels.cs b/Items/Placeables/DraedonStructures/LaboratoryPanels.cs index 3edaee9952..ca6100f295 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryPanels.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryPanels.cs @@ -11,32 +11,22 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar); - recipe.anyIronBar = true; - recipe.AddRecipeGroup("AnyStoneBlock", 3); - recipe.SetResult(this, 25); - recipe.AddTile(TileID.HeavyWorkBench); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(25).AddIngredient(ItemID.IronBar).AddRecipeGroup("AnyStoneBlock", 3).AddTile(TileID.HeavyWorkBench).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs b/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs index 99f9509977..57a1669a4e 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs @@ -10,26 +10,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/LaboratoryPlating.cs b/Items/Placeables/DraedonStructures/LaboratoryPlating.cs index 3390c24207..7cfbc71c16 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryPlating.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryPlating.cs @@ -11,51 +11,26 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar); - recipe.anyIronBar = true; - recipe.AddRecipeGroup("AnyStoneBlock", 3); - recipe.SetResult(this, 25); - recipe.AddTile(TileID.HeavyWorkBench); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(25).AddIngredient(ItemID.IronBar).AddRecipeGroup("AnyStoneBlock", 3).AddTile(TileID.HeavyWorkBench).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs b/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs index 94e8bd4b2b..d259b66974 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs b/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs index 687df979e9..ba4f457fce 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs @@ -14,27 +14,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/LaboratoryShelf.cs b/Items/Placeables/DraedonStructures/LaboratoryShelf.cs index 5eba8902c7..61316c3278 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryShelf.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryShelf.cs @@ -10,28 +10,22 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs b/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs index f27005376f..1844fa1504 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs b/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs index 72d467535d..71767e33b8 100644 --- a/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs +++ b/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs @@ -15,19 +15,19 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = item.useTime = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = Item.useTime = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.value = Item.buyPrice(gold: 50); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.value = Item.buyPrice(gold: 50); } } } diff --git a/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs b/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs index d03d8367cf..9c18d13c45 100644 --- a/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs +++ b/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/RustedPipes.cs b/Items/Placeables/DraedonStructures/RustedPipes.cs index 66369d4061..396de1b7a6 100644 --- a/Items/Placeables/DraedonStructures/RustedPipes.cs +++ b/Items/Placeables/DraedonStructures/RustedPipes.cs @@ -10,26 +10,21 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar); - recipe.anyIronBar = true; - recipe.SetResult(this, 5); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(5).AddIngredient(ItemID.IronBar).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/RustedPlating.cs b/Items/Placeables/DraedonStructures/RustedPlating.cs index e11b268403..c25070550f 100644 --- a/Items/Placeables/DraedonStructures/RustedPlating.cs +++ b/Items/Placeables/DraedonStructures/RustedPlating.cs @@ -11,51 +11,26 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar); - recipe.anyIronBar = true; - recipe.AddRecipeGroup("AnyStoneBlock", 3); - recipe.SetResult(this, 25); - recipe.AddTile(TileID.HeavyWorkBench); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(25).AddIngredient(ItemID.IronBar).AddRecipeGroup("AnyStoneBlock", 3).AddTile(TileID.HeavyWorkBench).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/RustedShelf.cs b/Items/Placeables/DraedonStructures/RustedShelf.cs index 72f2406a19..d01f3157f9 100644 --- a/Items/Placeables/DraedonStructures/RustedShelf.cs +++ b/Items/Placeables/DraedonStructures/RustedShelf.cs @@ -10,28 +10,22 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/DraedonStructures/SecurityChest.cs b/Items/Placeables/DraedonStructures/SecurityChest.cs index 47dfe82ed9..a94d6d3405 100644 --- a/Items/Placeables/DraedonStructures/SecurityChest.cs +++ b/Items/Placeables/DraedonStructures/SecurityChest.cs @@ -14,32 +14,24 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void SetDefaults() { - item.width = 32; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 14; - item.rare = ItemRarityID.Orange; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 500; - item.createTile = ModContent.TileType(); + Item.width = 32; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 14; + Item.rare = ItemRarityID.Orange; + Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 500; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.IronBar, 2).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/EutrophicSand.cs b/Items/Placeables/EutrophicSand.cs index ee38234b3a..fd8985053d 100644 --- a/Items/Placeables/EutrophicSand.cs +++ b/Items/Placeables/EutrophicSand.cs @@ -13,30 +13,22 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Furniture/AstralBeaconItem.cs b/Items/Placeables/Furniture/AstralBeaconItem.cs index 241c5d33c0..17454d9a70 100644 --- a/Items/Placeables/Furniture/AstralBeaconItem.cs +++ b/Items/Placeables/Furniture/AstralBeaconItem.cs @@ -14,27 +14,21 @@ namespace CalamityMod.Items.Placeables.Furniture } public override void SetDefaults() { - item.width = 32; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 14; - item.rare = ItemRarityID.Cyan; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 32; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 14; + Item.rare = ItemRarityID.Cyan; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 30).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/Furniture/AstralChest.cs b/Items/Placeables/Furniture/AstralChest.cs index 00cc6bf3b8..7160a16e7f 100644 --- a/Items/Placeables/Furniture/AstralChest.cs +++ b/Items/Placeables/Furniture/AstralChest.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 500; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 500; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/AuricToilet.cs b/Items/Placeables/Furniture/AuricToilet.cs index ef70ecf3d9..583529c2ff 100644 --- a/Items/Placeables/Furniture/AuricToilet.cs +++ b/Items/Placeables/Furniture/AuricToilet.cs @@ -18,29 +18,22 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 12; - item.height = 30; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 12; + Item.height = 30; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/Furniture/BabyFlakHermitCage.cs b/Items/Placeables/Furniture/BabyFlakHermitCage.cs index 810f62463e..efb924b90b 100644 --- a/Items/Placeables/Furniture/BabyFlakHermitCage.cs +++ b/Items/Placeables/Furniture/BabyFlakHermitCage.cs @@ -14,25 +14,21 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 34; - item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 34; + Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Terrarium); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Terrarium).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/Furniture/BabyGhostBellJar.cs b/Items/Placeables/Furniture/BabyGhostBellJar.cs index 0f18113a4a..127d94c282 100644 --- a/Items/Placeables/Furniture/BabyGhostBellJar.cs +++ b/Items/Placeables/Furniture/BabyGhostBellJar.cs @@ -14,25 +14,21 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 34; - item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 34; + Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Bottle); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Bottle).Register(); } } } diff --git a/Items/Placeables/Furniture/BlueCandle.cs b/Items/Placeables/Furniture/BlueCandle.cs index 07b31fff17..af9bbf6207 100644 --- a/Items/Placeables/Furniture/BlueCandle.cs +++ b/Items/Placeables/Furniture/BlueCandle.cs @@ -15,18 +15,18 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 28; - item.height = 40; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = ItemRarityID.LightRed; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 40; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(0, 25, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/ChaosCandle.cs b/Items/Placeables/Furniture/ChaosCandle.cs index 09e7e6fb1f..5443990c9d 100644 --- a/Items/Placeables/Furniture/ChaosCandle.cs +++ b/Items/Placeables/Furniture/ChaosCandle.cs @@ -18,19 +18,19 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 16; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 500; - item.createTile = ModContent.TileType(); - item.flame = true; - item.holdStyle = 1; + Item.width = 16; + Item.height = 20; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 500; + Item.createTile = ModContent.TileType(); + Item.flame = true; + Item.holdStyle = 1; } public override void HoldItem(Player player) @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void PostUpdate() { - Lighting.AddLight((int)((item.position.X + item.width / 2) / 16f), (int)((item.position.Y + item.height / 2) / 16f), 0.85f, 0.25f, 0.25f); + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 0.85f, 0.25f, 0.25f); } public override void AutoLightSelect(ref bool dryTorch, ref bool wetTorch, ref bool glowstick) @@ -57,14 +57,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WaterCandle, 3); - recipe.AddIngredient(ItemID.SoulofNight, 3); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.WaterCandle, 3).AddIngredient(ItemID.SoulofNight, 3).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Furniture/CorruptionEffigy.cs b/Items/Placeables/Furniture/CorruptionEffigy.cs index 5b65f39fc3..34df9f55ed 100644 --- a/Items/Placeables/Furniture/CorruptionEffigy.cs +++ b/Items/Placeables/Furniture/CorruptionEffigy.cs @@ -15,18 +15,18 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 26; - item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = ItemRarityID.Orange; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(0, 9, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs b/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs index 5d2545b6e3..6ea5cfce57 100644 --- a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs @@ -12,28 +12,23 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs index 66a4c76f5c..945a66dfdc 100644 --- a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs index 512c19c5fd..4e77663546 100644 --- a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs +++ b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.JungleSpores, 5); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.JungleSpores, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs index e9635317aa..59f3d357ee 100644 --- a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs @@ -18,33 +18,25 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void SetDefaults() { - item.width = 62; - item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 62; + Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = Item.sellPrice(platinum: 2, gold: 50); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = Item.sellPrice(platinum: 2, gold: 50); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("HardmodeAnvil"); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.LunarBar, 10); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("HardmodeAnvil").AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.LunarBar, 10).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs index 780af11da4..656c083965 100644 --- a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs +++ b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs @@ -16,34 +16,25 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void SetDefaults() { - item.width = 58; - item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 58; + Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = Item.sellPrice(platinum: 27, gold: 50); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = Item.sellPrice(platinum: 27, gold: 50); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("HardmodeForge"); - recipe.AddIngredient(ItemID.TinkerersWorkshop); - recipe.AddIngredient(ItemID.LunarCraftingStation); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddRecipeGroup("HardmodeForge").AddIngredient(ItemID.TinkerersWorkshop).AddIngredient(ItemID.LunarCraftingStation).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 25).Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/EutrophicCrafting.cs b/Items/Placeables/Furniture/CraftingStations/EutrophicCrafting.cs index 1070f682b0..081694e001 100644 --- a/Items/Placeables/Furniture/CraftingStations/EutrophicCrafting.cs +++ b/Items/Placeables/Furniture/CraftingStations/EutrophicCrafting.cs @@ -11,28 +11,22 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void SetDefaults() { - item.SetNameOverride("Eutrophic Shelf"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Eutrophic Shelf"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/MonolithCrafting.cs b/Items/Placeables/Furniture/CraftingStations/MonolithCrafting.cs index 6c80fb13f3..e8e8bd8cb6 100644 --- a/Items/Placeables/Furniture/CraftingStations/MonolithCrafting.cs +++ b/Items/Placeables/Furniture/CraftingStations/MonolithCrafting.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void SetDefaults() { - item.SetNameOverride("Monolith Amalgam"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Amalgam"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs b/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs index c87cb398df..e2d34c29b9 100644 --- a/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs +++ b/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs @@ -12,27 +12,21 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 10); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.IronBar, 10).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/ProfanedBasin.cs b/Items/Placeables/Furniture/CraftingStations/ProfanedBasin.cs index a502089377..ad18ca4107 100644 --- a/Items/Placeables/Furniture/CraftingStations/ProfanedBasin.cs +++ b/Items/Placeables/Furniture/CraftingStations/ProfanedBasin.cs @@ -13,27 +13,22 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void SetDefaults() { - item.SetNameOverride("Profaned Crucible"); - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Profaned Crucible"); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs b/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs index 6fe2ecb430..5cd7faa84c 100644 --- a/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs +++ b/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs @@ -13,27 +13,22 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void SetDefaults() { - item.SetNameOverride("Effulgent Manipulator"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Effulgent Manipulator"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddRecipeGroup("AnyGoldBar", 5); - recipe.SetResult(this); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddRecipeGroup("AnyGoldBar", 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs index 3dbbe9a346..9b08396569 100644 --- a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs +++ b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Solidifier); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Solidifier).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs b/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs index 6e87338026..be6a41a046 100644 --- a/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs +++ b/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 25).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/Furniture/CrimsonEffigy.cs b/Items/Placeables/Furniture/CrimsonEffigy.cs index 657512104f..df5939174b 100644 --- a/Items/Placeables/Furniture/CrimsonEffigy.cs +++ b/Items/Placeables/Furniture/CrimsonEffigy.cs @@ -15,18 +15,18 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 22; - item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = ItemRarityID.Orange; - item.createTile = ModContent.TileType(); + Item.width = 22; + Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(0, 9, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/EffigyOfDecay.cs b/Items/Placeables/Furniture/EffigyOfDecay.cs index 77cdce5811..07a57b2286 100644 --- a/Items/Placeables/Furniture/EffigyOfDecay.cs +++ b/Items/Placeables/Furniture/EffigyOfDecay.cs @@ -18,27 +18,22 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 22; - item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = ItemRarityID.Orange; - item.createTile = ModContent.TileType(); + Item.width = 22; + Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(0, 9, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddRecipeGroup("IronBar", 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddRecipeGroup("IronBar", 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs index e8f9ec88f8..48313dd763 100644 --- a/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains public override void SetDefaults() { - item.width = 22; - item.height = 42; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.White; - item.createTile = ModContent.TileType(); + Item.width = 22; + Item.height = 42; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.White; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs b/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs index 3c7cfb6ab1..fd0343f62d 100644 --- a/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains public override void SetDefaults() { - item.width = 22; - item.height = 42; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.White; - item.createTile = ModContent.TileType(); + Item.width = 22; + Item.height = 42; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.White; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs b/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs index 2a91aba0f6..8907dad6aa 100644 --- a/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains public override void SetDefaults() { - item.width = 22; - item.height = 42; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.White; - item.createTile = ModContent.TileType(); + Item.width = 22; + Item.height = 42; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.White; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs b/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs index eeada78753..f128f0c592 100644 --- a/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs +++ b/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains public override void SetDefaults() { - item.width = 26; - item.height = 32; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.White; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 32; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.White; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/PiggyCage.cs b/Items/Placeables/Furniture/PiggyCage.cs index 5c99ea73e8..ba2fab87e9 100644 --- a/Items/Placeables/Furniture/PiggyCage.cs +++ b/Items/Placeables/Furniture/PiggyCage.cs @@ -14,27 +14,23 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 34; - item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 34; + Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); - item.Calamity().donorItem = true; + Item.Calamity().donorItem = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Terrarium); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Terrarium).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/Furniture/PinkCandle.cs b/Items/Placeables/Furniture/PinkCandle.cs index bb7eeb5caa..b0444afa7f 100644 --- a/Items/Placeables/Furniture/PinkCandle.cs +++ b/Items/Placeables/Furniture/PinkCandle.cs @@ -16,18 +16,18 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 28; - item.height = 40; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = ItemRarityID.LightRed; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 40; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(0, 25, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/PurpleCandle.cs b/Items/Placeables/Furniture/PurpleCandle.cs index f5136e87ef..ee653657bc 100644 --- a/Items/Placeables/Furniture/PurpleCandle.cs +++ b/Items/Placeables/Furniture/PurpleCandle.cs @@ -15,18 +15,18 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 28; - item.height = 40; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = ItemRarityID.LightRed; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 40; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(0, 25, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/RustyChest.cs b/Items/Placeables/Furniture/RustyChest.cs index 768833221d..2e54d6248e 100644 --- a/Items/Placeables/Furniture/RustyChest.cs +++ b/Items/Placeables/Furniture/RustyChest.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 500; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 500; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Chest); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Chest).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/Furniture/SCalAltarItem.cs b/Items/Placeables/Furniture/SCalAltarItem.cs index 6c4384fb4d..5d7aadbb96 100644 --- a/Items/Placeables/Furniture/SCalAltarItem.cs +++ b/Items/Placeables/Furniture/SCalAltarItem.cs @@ -18,28 +18,22 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 60; - item.height = 48; - item.maxStack = 999; - item.useStyle = ItemUseStyleID.SwingThrow; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.createTile = ModContent.TileType(); + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 60; + Item.height = 48; + Item.maxStack = 999; + Item.useStyle = ItemUseStyleID.Swing; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 30).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 1).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/Furniture/SeaMinnowJar.cs b/Items/Placeables/Furniture/SeaMinnowJar.cs index 42fcf92d32..3a352572db 100644 --- a/Items/Placeables/Furniture/SeaMinnowJar.cs +++ b/Items/Placeables/Furniture/SeaMinnowJar.cs @@ -14,25 +14,21 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 34; - item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 34; + Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Bottle); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Bottle).Register(); } } } diff --git a/Items/Placeables/Furniture/ThaumaticChair.cs b/Items/Placeables/Furniture/ThaumaticChair.cs index b76a409f38..16f57b0045 100644 --- a/Items/Placeables/Furniture/ThaumaticChair.cs +++ b/Items/Placeables/Furniture/ThaumaticChair.cs @@ -29,40 +29,23 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 16; - item.height = 34; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().donorItem = true; + Item.width = 16; + Item.height = 34; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().donorItem = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/Furniture/TranquilityCandle.cs b/Items/Placeables/Furniture/TranquilityCandle.cs index abd1eb4ff8..8aea821609 100644 --- a/Items/Placeables/Furniture/TranquilityCandle.cs +++ b/Items/Placeables/Furniture/TranquilityCandle.cs @@ -17,19 +17,19 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 16; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 500; - item.createTile = ModContent.TileType(); - item.flame = true; - item.holdStyle = 1; + Item.width = 16; + Item.height = 20; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 500; + Item.createTile = ModContent.TileType(); + Item.flame = true; + Item.holdStyle = 1; } public override void HoldItem(Player player) @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void PostUpdate() { - Lighting.AddLight((int)((item.position.X + item.width / 2) / 16f), (int)((item.position.Y + item.height / 2) / 16f), 1f, 0.55f, 1f); + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 1f, 0.55f, 1f); } public override void AutoLightSelect(ref bool dryTorch, ref bool wetTorch, ref bool glowstick) @@ -56,14 +56,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PeaceCandle, 3); - recipe.AddIngredient(ItemID.SoulofLight, 3); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.PeaceCandle, 3).AddIngredient(ItemID.SoulofLight, 3).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs index b436c27c57..5a228cb072 100644 --- a/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 27; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 27; } } } diff --git a/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs b/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs index 127189567f..7347d3228d 100644 --- a/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 28; + Item.width = Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 28; } } } diff --git a/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs b/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs index a2a0b39a41..6d8d7cc0a9 100644 --- a/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 23; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 23; } } } diff --git a/Items/Placeables/Furniture/Trophies/AresTrophy.cs b/Items/Placeables/Furniture/Trophies/AresTrophy.cs index 89fbb30fb5..01dc49c637 100644 --- a/Items/Placeables/Furniture/Trophies/AresTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AresTrophy.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 30; + Item.width = Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 30; } } } diff --git a/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs b/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs index 2453bcba64..2ef36adb3c 100644 --- a/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 29; + Item.width = Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 29; } } } diff --git a/Items/Placeables/Furniture/Trophies/AstrageldonTrophy.cs b/Items/Placeables/Furniture/Trophies/AstrageldonTrophy.cs index e9bee17a2e..9e50cd4496 100644 --- a/Items/Placeables/Furniture/Trophies/AstrageldonTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AstrageldonTrophy.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 19; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 19; } } } diff --git a/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs b/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs index b6e39d49e9..ab15363e5a 100644 --- a/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 20; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 20; } } } diff --git a/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs b/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs index 1e193c7965..06433d2687 100644 --- a/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 21; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 21; } } } diff --git a/Items/Placeables/Furniture/Trophies/BumblebirbTrophy.cs b/Items/Placeables/Furniture/Trophies/BumblebirbTrophy.cs index cd5f1b4d76..a2d9701cb6 100644 --- a/Items/Placeables/Furniture/Trophies/BumblebirbTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/BumblebirbTrophy.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 18; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 18; } } } diff --git a/Items/Placeables/Furniture/Trophies/CalamitasTrophy.cs b/Items/Placeables/Furniture/Trophies/CalamitasTrophy.cs index 2c6ffcd0f1..b7528e25ec 100644 --- a/Items/Placeables/Furniture/Trophies/CalamitasTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CalamitasTrophy.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 7; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 7; } } } diff --git a/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs b/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs index fc3f25b7b0..1ef4121b63 100644 --- a/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 16; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 16; } } } diff --git a/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs b/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs index 5d7d692455..236493451d 100644 --- a/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 15; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 15; } } } diff --git a/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs b/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs index cd774936eb..394fc36a4c 100644 --- a/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 13; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 13; } } } diff --git a/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs b/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs index 3f614145e0..bb9e215906 100644 --- a/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 9; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 9; } } } diff --git a/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs b/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs index d0438b84bf..1498d7a339 100644 --- a/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 3; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 3; } } } diff --git a/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs b/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs index 7a5d7a2c36..8634d11b0b 100644 --- a/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 0; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 0; } } } diff --git a/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs b/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs index da3dd9f98c..dcfec58e50 100644 --- a/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 14; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 14; } } } diff --git a/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs b/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs index 58b49843d5..1ddb636123 100644 --- a/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 8; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 8; } } } diff --git a/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs b/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs index 6141515b35..2967ac79ca 100644 --- a/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 5; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 5; } } } diff --git a/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs b/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs index a4234b71a1..8a846d8638 100644 --- a/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 24; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 24; } } } diff --git a/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs b/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs index 6e6ae210a7..688b9252a0 100644 --- a/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 1; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 1; } } } diff --git a/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs b/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs index e0cb5aaa23..14f305e18e 100644 --- a/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 4; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 4; } } } diff --git a/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs b/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs index 56307ef9ea..f7508af07d 100644 --- a/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 17; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 17; } } } diff --git a/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs b/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs index 82391b6e2d..fcc3533ac9 100644 --- a/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 25; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 25; } } } diff --git a/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs b/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs index 6603e8838e..ef8116a32f 100644 --- a/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 6; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 6; } } } diff --git a/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs b/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs index 2cbc00986e..3b184562b0 100644 --- a/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 22; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 22; } } } diff --git a/Items/Placeables/Furniture/Trophies/SignusTrophy.cs b/Items/Placeables/Furniture/Trophies/SignusTrophy.cs index 85eabcdd0e..04b8c07813 100644 --- a/Items/Placeables/Furniture/Trophies/SignusTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SignusTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 11; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 11; } } } diff --git a/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs b/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs index f5c3d3cb90..1952afaf4e 100644 --- a/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 2; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 2; } } } diff --git a/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs b/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs index a8d0d6862f..134916f91c 100644 --- a/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 26; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 26; } } } diff --git a/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs b/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs index 71548d0f3c..5584578142 100644 --- a/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 33; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 33; } } } diff --git a/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs b/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs index 259ed56abd..effee00b85 100644 --- a/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 32; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 32; } } } diff --git a/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs b/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs index 296fc30993..a90202fa26 100644 --- a/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 31; + Item.width = Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 31; } } } diff --git a/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs b/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs index 2b88d9e56d..a5e41e5c1f 100644 --- a/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 12; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 12; } } } diff --git a/Items/Placeables/Furniture/Trophies/YharonTrophy.cs b/Items/Placeables/Furniture/Trophies/YharonTrophy.cs index 7d0f145d0f..28822be03c 100644 --- a/Items/Placeables/Furniture/Trophies/YharonTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/YharonTrophy.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 50000; - item.rare = ItemRarityID.Blue; - item.createTile = ModContent.TileType(); - item.placeStyle = 10; + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + Item.placeStyle = 10; } } } diff --git a/Items/Placeables/Furniture/TwinklerInABottle.cs b/Items/Placeables/Furniture/TwinklerInABottle.cs index 2cba65fb3b..f169fd94d3 100644 --- a/Items/Placeables/Furniture/TwinklerInABottle.cs +++ b/Items/Placeables/Furniture/TwinklerInABottle.cs @@ -14,25 +14,21 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 34; - item.height = 32; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 34; + Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bottle); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Bottle).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/Furniture/YellowCandle.cs b/Items/Placeables/Furniture/YellowCandle.cs index b6010c3ff9..68432d95c5 100644 --- a/Items/Placeables/Furniture/YellowCandle.cs +++ b/Items/Placeables/Furniture/YellowCandle.cs @@ -16,18 +16,18 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - item.width = 28; - item.height = 40; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = ItemRarityID.LightRed; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 40; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(0, 25, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssBath.cs b/Items/Placeables/FurnitureAbyss/AbyssBath.cs index d446fa928c..9a49a87dd8 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBath.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBath.cs @@ -12,27 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.SetNameOverride("Abyss Bathtub"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Abyss Bathtub"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssBed.cs b/Items/Placeables/FurnitureAbyss/AbyssBed.cs index b584bdcea9..18e68c8168 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBed.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBed.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Silk, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs b/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs index dca2ce4fb2..c4b7c93d9c 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs b/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs index 7779ba0e0a..a56b0af6b6 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs @@ -13,27 +13,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssCandle.cs b/Items/Placeables/FurnitureAbyss/AbyssCandle.cs index eea6d78edb..7a9c82c286 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssCandle.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssCandle.cs @@ -13,27 +13,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssChair.cs b/Items/Placeables/FurnitureAbyss/AbyssChair.cs index 5676c78157..f66f9a4ed3 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssChair.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssChair.cs @@ -13,26 +13,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 12; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs b/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs index 27f096ca41..288138a4f9 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs @@ -12,28 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Chain).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssChest.cs b/Items/Placeables/FurnitureAbyss/AbyssChest.cs index c8d3f0fa23..75e92ddcd2 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssChest.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssChest.cs @@ -11,28 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.IronBar, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssClock.cs b/Items/Placeables/FurnitureAbyss/AbyssClock.cs index 21b2f3adfe..a57ab55f75 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssClock.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssClock.cs @@ -11,29 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.IronBar, 3).AddIngredient(ItemID.Glass, 6).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssDoor.cs b/Items/Placeables/FurnitureAbyss/AbyssDoor.cs index c76174dcb0..3464e7bd02 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssDoor.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssDoor.cs @@ -13,26 +13,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 14; + Item.height = 28; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssDresser.cs b/Items/Placeables/FurnitureAbyss/AbyssDresser.cs index 27212b3a30..90735d8765 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssDresser.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssDresser.cs @@ -12,26 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssLamp.cs b/Items/Placeables/FurnitureAbyss/AbyssLamp.cs index 26df1a487d..fd4d5f5e5a 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssLamp.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssLamp.cs @@ -13,27 +13,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssLantern.cs b/Items/Placeables/FurnitureAbyss/AbyssLantern.cs index d52c918963..ed0b079e8a 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssLantern.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssLantern.cs @@ -13,27 +13,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssPiano.cs b/Items/Placeables/FurnitureAbyss/AbyssPiano.cs index e05e1d20dd..763c3e8bb0 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssPiano.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssPiano.cs @@ -11,29 +11,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.SetNameOverride("Abyss Synth"); - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Abyss Synth"); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Bone, 4).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Book).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssSink.cs b/Items/Placeables/FurnitureAbyss/AbyssSink.cs index d8c2e690d5..f3959dc4c0 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssSink.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssSink.cs @@ -12,27 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.WaterBucket).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssSofa.cs b/Items/Placeables/FurnitureAbyss/AbyssSofa.cs index 972e7d9a7c..7973503b08 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssSofa.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssSofa.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Silk, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssTable.cs b/Items/Placeables/FurnitureAbyss/AbyssTable.cs index c156b11358..acefd16206 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssTable.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssTable.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); // This is Ozz's item of choice for placing hostile Lab Turrets for testing. It should not do this normally. // item.createTile = ModContent.TileType(); @@ -30,11 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs b/Items/Placeables/FurnitureAbyss/AbyssTorch.cs index 912e141407..014138c4ce 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssTorch.cs @@ -15,20 +15,20 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 10; - item.height = 12; - item.maxStack = 99; - item.holdStyle = 1; - item.noWet = false; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.flame = true; - item.value = 500; + Item.width = 10; + Item.height = 12; + Item.maxStack = 99; + Item.holdStyle = 1; + Item.noWet = false; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.flame = true; + Item.value = 500; } public override void HoldItem(Player player) @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void PostUpdate() { - Lighting.AddLight((int)((item.position.X + item.width / 2) / 16f), (int)((item.position.Y + item.height / 2) / 16f), 1f, 1f, 1f); + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 1f, 1f, 1f); } public override void AutoLightSelect(ref bool dryTorch, ref bool wetTorch, ref bool glowstick) @@ -53,11 +53,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Torch, 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 3); - recipe.AddRecipe(); + CreateRecipe(3).AddIngredient(ItemID.Torch, 3).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs b/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs index a6951a9822..07c8f12a62 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs @@ -12,18 +12,18 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.SetNameOverride("Abyss Work Bench"); - item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Abyss Work Bench"); + Item.width = 28; + Item.height = 14; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); // This is Ozz's item of choice for placing inactive Power Cell Factories for lab schematics. It should not do this normally. // item.createTile = ModContent.TileType(); @@ -31,11 +31,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.cs b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.cs index a8b13ce7b0..36a2f3d0c6 100644 --- a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.cs +++ b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.cs @@ -12,35 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs index 4b6c7ac9ba..bdc571f4de 100644 --- a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs +++ b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodBathtub.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodBathtub.cs index 05012b4408..4c936cfa31 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodBathtub.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodBathtub.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Bathtub"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Bathtub"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this); - recipe.AddTile(TileID.Sawmill); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(TileID.Sawmill).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodBed.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodBed.cs index 90217fe60b..9f95dfbdc0 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodBed.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodBed.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Bed"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Bed"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this); - recipe.AddTile(TileID.Sawmill); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Silk, 5).AddTile(TileID.Sawmill).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodBench.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodBench.cs index 2697958daa..a2ed1b1ade 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodBench.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodBench.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Bench"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Bench"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this); - recipe.AddTile(TileID.Sawmill); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.Sawmill).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodBookcase.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodBookcase.cs index 119daa6840..9146efc7d7 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodBookcase.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodBookcase.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Bookcase"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Bookcase"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this); - recipe.AddTile(TileID.Sawmill); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(TileID.Sawmill).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodCandelabra.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodCandelabra.cs index fad204ae18..f0834ceeb6 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodCandelabra.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodCandelabra.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Candelabra"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Candelabra"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Torch, 3); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Torch, 3).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodCandle.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodCandle.cs index d8237f350c..7ba773c05f 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodCandle.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodCandle.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Candle"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Candle"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Torch).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodChair.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodChair.cs index 5d546eaac6..1c02a41021 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodChair.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodChair.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Chair"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Chair"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodChandelier.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodChandelier.cs index 79d8fc44b9..8d8c5c2b59 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodChandelier.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodChandelier.cs @@ -11,28 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Chandelier"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Chandelier"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Torch, 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Torch, 4).AddIngredient(ItemID.Chain).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodChest.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodChest.cs index 1d168991d3..e2594aa0c0 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodChest.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodChest.cs @@ -11,28 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Chest"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Chest"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.IronBar, 2).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodClock.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodClock.cs index 82e5c63f11..2270341c94 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodClock.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodClock.cs @@ -11,29 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Clock"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Clock"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this); - recipe.AddTile(TileID.Sawmill); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.IronBar, 3).AddIngredient(ItemID.Glass, 6).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Sawmill).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodDoor.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodDoor.cs index 1a9bcbb6d1..b518cdf692 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodDoor.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodDoor.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Door"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Door"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodDresser.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodDresser.cs index d17c73a437..4935cb7df5 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodDresser.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodDresser.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Dresser"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Dresser"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this); - recipe.AddTile(TileID.Sawmill); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(TileID.Sawmill).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodLamp.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodLamp.cs index baacf6c62d..04bd80a87c 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodLamp.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodLamp.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Lamp"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Lamp"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.Torch).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodLantern.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodLantern.cs index ffc9a0f05a..8a3bf47f13 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodLantern.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodLantern.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Lantern"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Lantern"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.Torch).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodPiano.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodPiano.cs index 4e1dfb90de..7f0548e37b 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodPiano.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodPiano.cs @@ -11,28 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Piano"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Piano"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this); - recipe.AddTile(TileID.Sawmill); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Bone, 4).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Book).AddTile(TileID.Sawmill).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodPlatform.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodPlatform.cs index 31d2a18a6e..bc112a2bde 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodPlatform.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodPlatform.cs @@ -12,25 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Platform"); - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Platform"); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodSink.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodSink.cs index 75e6f084d4..926a5231f0 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodSink.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodSink.cs @@ -12,27 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Sink"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Sink"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.WaterBucket).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodTable.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodTable.cs index f126456a9d..d3a916f37c 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodTable.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodTable.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Table"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Table"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureAcidwood/AcidwoodWorkbench.cs b/Items/Placeables/FurnitureAcidwood/AcidwoodWorkbench.cs index c17a1cb6b8..063c202eea 100644 --- a/Items/Placeables/FurnitureAcidwood/AcidwoodWorkbench.cs +++ b/Items/Placeables/FurnitureAcidwood/AcidwoodWorkbench.cs @@ -11,25 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAcidwood public override void SetDefaults() { - item.SetNameOverride("Acidwood Work Bench"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Acidwood Work Bench"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientBasin.cs b/Items/Placeables/FurnitureAncient/AncientBasin.cs index 78453a775f..fc9ad075a7 100644 --- a/Items/Placeables/FurnitureAncient/AncientBasin.cs +++ b/Items/Placeables/FurnitureAncient/AncientBasin.cs @@ -14,28 +14,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientBath.cs b/Items/Placeables/FurnitureAncient/AncientBath.cs index a0ea3edd86..18c451264c 100644 --- a/Items/Placeables/FurnitureAncient/AncientBath.cs +++ b/Items/Placeables/FurnitureAncient/AncientBath.cs @@ -12,28 +12,24 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.SetNameOverride("Ancient Bathtub"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Ancient Bathtub"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientBed.cs b/Items/Placeables/FurnitureAncient/AncientBed.cs index 1050ad718e..819d83fc83 100644 --- a/Items/Placeables/FurnitureAncient/AncientBed.cs +++ b/Items/Placeables/FurnitureAncient/AncientBed.cs @@ -11,28 +11,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Silk, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientBookcase.cs b/Items/Placeables/FurnitureAncient/AncientBookcase.cs index e75298b755..c0235b8776 100644 --- a/Items/Placeables/FurnitureAncient/AncientBookcase.cs +++ b/Items/Placeables/FurnitureAncient/AncientBookcase.cs @@ -11,28 +11,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientChair.cs b/Items/Placeables/FurnitureAncient/AncientChair.cs index 2f43ce8666..922c812967 100644 --- a/Items/Placeables/FurnitureAncient/AncientChair.cs +++ b/Items/Placeables/FurnitureAncient/AncientChair.cs @@ -13,27 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.width = 12; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientChandelier.cs b/Items/Placeables/FurnitureAncient/AncientChandelier.cs index 2b23cb8c35..33da9005e7 100644 --- a/Items/Placeables/FurnitureAncient/AncientChandelier.cs +++ b/Items/Placeables/FurnitureAncient/AncientChandelier.cs @@ -12,29 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Chain).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientDoor.cs b/Items/Placeables/FurnitureAncient/AncientDoor.cs index b0b4b5e04f..5988e71e94 100644 --- a/Items/Placeables/FurnitureAncient/AncientDoor.cs +++ b/Items/Placeables/FurnitureAncient/AncientDoor.cs @@ -13,27 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 14; + Item.height = 28; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientDresser.cs b/Items/Placeables/FurnitureAncient/AncientDresser.cs index 78a13f85b8..1401343fa6 100644 --- a/Items/Placeables/FurnitureAncient/AncientDresser.cs +++ b/Items/Placeables/FurnitureAncient/AncientDresser.cs @@ -12,27 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientLamp.cs b/Items/Placeables/FurnitureAncient/AncientLamp.cs index 4d9539a46d..2eb5f8997c 100644 --- a/Items/Placeables/FurnitureAncient/AncientLamp.cs +++ b/Items/Placeables/FurnitureAncient/AncientLamp.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientLantern.cs b/Items/Placeables/FurnitureAncient/AncientLantern.cs index a877fd0edb..90904faae9 100644 --- a/Items/Placeables/FurnitureAncient/AncientLantern.cs +++ b/Items/Placeables/FurnitureAncient/AncientLantern.cs @@ -11,28 +11,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.Torch).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientMonolith.cs b/Items/Placeables/FurnitureAncient/AncientMonolith.cs index cc7987add8..6614b2bcb0 100644 --- a/Items/Placeables/FurnitureAncient/AncientMonolith.cs +++ b/Items/Placeables/FurnitureAncient/AncientMonolith.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 9).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientPiano.cs b/Items/Placeables/FurnitureAncient/AncientPiano.cs index 40eb255075..f09ebfdb50 100644 --- a/Items/Placeables/FurnitureAncient/AncientPiano.cs +++ b/Items/Placeables/FurnitureAncient/AncientPiano.cs @@ -11,30 +11,24 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.SetNameOverride("Ancient Pipe Organ"); - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Ancient Pipe Organ"); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Bone, 4).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Book).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientSink.cs b/Items/Placeables/FurnitureAncient/AncientSink.cs index 055eafc407..816ec504d5 100644 --- a/Items/Placeables/FurnitureAncient/AncientSink.cs +++ b/Items/Placeables/FurnitureAncient/AncientSink.cs @@ -12,28 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.LavaBucket); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.LavaBucket).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientSofa.cs b/Items/Placeables/FurnitureAncient/AncientSofa.cs index 4ca9b1e0b8..ff0969cb5b 100644 --- a/Items/Placeables/FurnitureAncient/AncientSofa.cs +++ b/Items/Placeables/FurnitureAncient/AncientSofa.cs @@ -11,28 +11,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Silk, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientTable.cs b/Items/Placeables/FurnitureAncient/AncientTable.cs index 726cc31688..b054242f16 100644 --- a/Items/Placeables/FurnitureAncient/AncientTable.cs +++ b/Items/Placeables/FurnitureAncient/AncientTable.cs @@ -13,27 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientWorkbench.cs b/Items/Placeables/FurnitureAncient/AncientWorkbench.cs index 46a493b91a..469a67844b 100644 --- a/Items/Placeables/FurnitureAncient/AncientWorkbench.cs +++ b/Items/Placeables/FurnitureAncient/AncientWorkbench.cs @@ -12,28 +12,24 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void SetDefaults() { - item.SetNameOverride("Ancient Work Bench"); - item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Ancient Work Bench"); + Item.width = 28; + Item.height = 14; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenBasin.cs b/Items/Placeables/FurnitureAshen/AshenBasin.cs index 5c7b3a1b53..d4dd6c8565 100644 --- a/Items/Placeables/FurnitureAshen/AshenBasin.cs +++ b/Items/Placeables/FurnitureAshen/AshenBasin.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenBath.cs b/Items/Placeables/FurnitureAshen/AshenBath.cs index 92ba7e57ef..c93b47c0e0 100644 --- a/Items/Placeables/FurnitureAshen/AshenBath.cs +++ b/Items/Placeables/FurnitureAshen/AshenBath.cs @@ -12,28 +12,24 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.SetNameOverride("Ashen Bathtub"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Ashen Bathtub"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenBed.cs b/Items/Placeables/FurnitureAshen/AshenBed.cs index e7b671274d..3e0179fa89 100644 --- a/Items/Placeables/FurnitureAshen/AshenBed.cs +++ b/Items/Placeables/FurnitureAshen/AshenBed.cs @@ -11,28 +11,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Silk, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenBookcase.cs b/Items/Placeables/FurnitureAshen/AshenBookcase.cs index 03c30a03ed..d880307a3d 100644 --- a/Items/Placeables/FurnitureAshen/AshenBookcase.cs +++ b/Items/Placeables/FurnitureAshen/AshenBookcase.cs @@ -11,28 +11,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenCandelabra.cs b/Items/Placeables/FurnitureAshen/AshenCandelabra.cs index a3f05994f9..12e8bbecd1 100644 --- a/Items/Placeables/FurnitureAshen/AshenCandelabra.cs +++ b/Items/Placeables/FurnitureAshen/AshenCandelabra.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenCandle.cs b/Items/Placeables/FurnitureAshen/AshenCandle.cs index 1efe4af2f0..beeb523151 100644 --- a/Items/Placeables/FurnitureAshen/AshenCandle.cs +++ b/Items/Placeables/FurnitureAshen/AshenCandle.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenChair.cs b/Items/Placeables/FurnitureAshen/AshenChair.cs index 06f48ba9c5..12f0ac7332 100644 --- a/Items/Placeables/FurnitureAshen/AshenChair.cs +++ b/Items/Placeables/FurnitureAshen/AshenChair.cs @@ -13,27 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 12; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.rare = ItemRarityID.Orange; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.rare = ItemRarityID.Orange; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenChandelier.cs b/Items/Placeables/FurnitureAshen/AshenChandelier.cs index 2acca65242..95c0a285e1 100644 --- a/Items/Placeables/FurnitureAshen/AshenChandelier.cs +++ b/Items/Placeables/FurnitureAshen/AshenChandelier.cs @@ -12,29 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Chain).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenChest.cs b/Items/Placeables/FurnitureAshen/AshenChest.cs index 36d9e654a3..ed8be3acbd 100644 --- a/Items/Placeables/FurnitureAshen/AshenChest.cs +++ b/Items/Placeables/FurnitureAshen/AshenChest.cs @@ -11,29 +11,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.IronBar, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenDoor.cs b/Items/Placeables/FurnitureAshen/AshenDoor.cs index 322bb7287e..3042e2d7cc 100644 --- a/Items/Placeables/FurnitureAshen/AshenDoor.cs +++ b/Items/Placeables/FurnitureAshen/AshenDoor.cs @@ -13,27 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 14; + Item.height = 28; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenDresser.cs b/Items/Placeables/FurnitureAshen/AshenDresser.cs index f2e93473c7..e1a1247efa 100644 --- a/Items/Placeables/FurnitureAshen/AshenDresser.cs +++ b/Items/Placeables/FurnitureAshen/AshenDresser.cs @@ -12,27 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenLamp.cs b/Items/Placeables/FurnitureAshen/AshenLamp.cs index 15579e6a23..dc6dc0e0d5 100644 --- a/Items/Placeables/FurnitureAshen/AshenLamp.cs +++ b/Items/Placeables/FurnitureAshen/AshenLamp.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenLantern.cs b/Items/Placeables/FurnitureAshen/AshenLantern.cs index 139b413a48..f3a48ea89c 100644 --- a/Items/Placeables/FurnitureAshen/AshenLantern.cs +++ b/Items/Placeables/FurnitureAshen/AshenLantern.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenMonolith.cs b/Items/Placeables/FurnitureAshen/AshenMonolith.cs index 7c1b13e34b..38fbf70249 100644 --- a/Items/Placeables/FurnitureAshen/AshenMonolith.cs +++ b/Items/Placeables/FurnitureAshen/AshenMonolith.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 9).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenPiano.cs b/Items/Placeables/FurnitureAshen/AshenPiano.cs index 84b23e4afd..673613803c 100644 --- a/Items/Placeables/FurnitureAshen/AshenPiano.cs +++ b/Items/Placeables/FurnitureAshen/AshenPiano.cs @@ -11,30 +11,24 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.SetNameOverride("Ashen Pipe Organ"); - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Ashen Pipe Organ"); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Bone, 4).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Book).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenPlatform.cs b/Items/Placeables/FurnitureAshen/AshenPlatform.cs index 7e9996df31..11dea2624b 100644 --- a/Items/Placeables/FurnitureAshen/AshenPlatform.cs +++ b/Items/Placeables/FurnitureAshen/AshenPlatform.cs @@ -12,26 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenSink.cs b/Items/Placeables/FurnitureAshen/AshenSink.cs index b10977c831..09725fee2d 100644 --- a/Items/Placeables/FurnitureAshen/AshenSink.cs +++ b/Items/Placeables/FurnitureAshen/AshenSink.cs @@ -12,28 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.LavaBucket); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.LavaBucket).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenSlab.cs b/Items/Placeables/FurnitureAshen/AshenSlab.cs index 88a5b9ca5e..0e194af276 100644 --- a/Items/Placeables/FurnitureAshen/AshenSlab.cs +++ b/Items/Placeables/FurnitureAshen/AshenSlab.cs @@ -13,32 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 5); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(5).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 1).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenSofa.cs b/Items/Placeables/FurnitureAshen/AshenSofa.cs index f473c6b30e..eca22906ac 100644 --- a/Items/Placeables/FurnitureAshen/AshenSofa.cs +++ b/Items/Placeables/FurnitureAshen/AshenSofa.cs @@ -11,28 +11,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Silk, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenTable.cs b/Items/Placeables/FurnitureAshen/AshenTable.cs index ea83e9873d..4bcf8d7594 100644 --- a/Items/Placeables/FurnitureAshen/AshenTable.cs +++ b/Items/Placeables/FurnitureAshen/AshenTable.cs @@ -12,27 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenWorkbench.cs b/Items/Placeables/FurnitureAshen/AshenWorkbench.cs index 9cd24d1e49..c293ade51a 100644 --- a/Items/Placeables/FurnitureAshen/AshenWorkbench.cs +++ b/Items/Placeables/FurnitureAshen/AshenWorkbench.cs @@ -12,28 +12,24 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.SetNameOverride("Ashen Work Bench"); - item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.value = 0; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Ashen Work Bench"); + Item.width = 28; + Item.height = 14; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.value = 0; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlag.cs b/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlag.cs index 49af824d1a..ad3992d208 100644 --- a/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlag.cs +++ b/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlag.cs @@ -12,36 +12,24 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithBathtub.cs b/Items/Placeables/FurnitureAstral/MonolithBathtub.cs index f205e2672d..9737d3cc81 100644 --- a/Items/Placeables/FurnitureAstral/MonolithBathtub.cs +++ b/Items/Placeables/FurnitureAstral/MonolithBathtub.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Bathtub"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Bathtub"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithBed.cs b/Items/Placeables/FurnitureAstral/MonolithBed.cs index fb9ece751c..4987678125 100644 --- a/Items/Placeables/FurnitureAstral/MonolithBed.cs +++ b/Items/Placeables/FurnitureAstral/MonolithBed.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Bed"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Bed"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Silk, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithBench.cs b/Items/Placeables/FurnitureAstral/MonolithBench.cs index 5b955bdcbb..3eab9d57ac 100644 --- a/Items/Placeables/FurnitureAstral/MonolithBench.cs +++ b/Items/Placeables/FurnitureAstral/MonolithBench.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Bench"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Bench"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Silk, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithBookcase.cs b/Items/Placeables/FurnitureAstral/MonolithBookcase.cs index e16c24294b..c7df2dd043 100644 --- a/Items/Placeables/FurnitureAstral/MonolithBookcase.cs +++ b/Items/Placeables/FurnitureAstral/MonolithBookcase.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Bookcase"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Bookcase"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithCandelabra.cs b/Items/Placeables/FurnitureAstral/MonolithCandelabra.cs index 5e020735b1..ebdf9d33fc 100644 --- a/Items/Placeables/FurnitureAstral/MonolithCandelabra.cs +++ b/Items/Placeables/FurnitureAstral/MonolithCandelabra.cs @@ -12,27 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Candelabra"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Candelabra"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithCandle.cs b/Items/Placeables/FurnitureAstral/MonolithCandle.cs index 76cc41ca9f..0393449370 100644 --- a/Items/Placeables/FurnitureAstral/MonolithCandle.cs +++ b/Items/Placeables/FurnitureAstral/MonolithCandle.cs @@ -12,27 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Candle"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Candle"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 1).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithChair.cs b/Items/Placeables/FurnitureAstral/MonolithChair.cs index e31227c30d..e9ab284c47 100644 --- a/Items/Placeables/FurnitureAstral/MonolithChair.cs +++ b/Items/Placeables/FurnitureAstral/MonolithChair.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Chair"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Chair"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithChandelier.cs b/Items/Placeables/FurnitureAstral/MonolithChandelier.cs index 5069aed9b1..2562fb97b1 100644 --- a/Items/Placeables/FurnitureAstral/MonolithChandelier.cs +++ b/Items/Placeables/FurnitureAstral/MonolithChandelier.cs @@ -12,27 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Chandelier"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Chandelier"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithChest.cs b/Items/Placeables/FurnitureAstral/MonolithChest.cs index 3933f5e17c..ce56116169 100644 --- a/Items/Placeables/FurnitureAstral/MonolithChest.cs +++ b/Items/Placeables/FurnitureAstral/MonolithChest.cs @@ -11,28 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Chest"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Chest"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.IronBar, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithClock.cs b/Items/Placeables/FurnitureAstral/MonolithClock.cs index 1b59c74b54..e337854033 100644 --- a/Items/Placeables/FurnitureAstral/MonolithClock.cs +++ b/Items/Placeables/FurnitureAstral/MonolithClock.cs @@ -11,29 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Clock"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Clock"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.IronBar, 3).AddIngredient(ItemID.Glass, 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithDoor.cs b/Items/Placeables/FurnitureAstral/MonolithDoor.cs index 6f71c58e3c..351f964a34 100644 --- a/Items/Placeables/FurnitureAstral/MonolithDoor.cs +++ b/Items/Placeables/FurnitureAstral/MonolithDoor.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Door"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Door"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithDresser.cs b/Items/Placeables/FurnitureAstral/MonolithDresser.cs index aae5bf9fa3..b3b178f370 100644 --- a/Items/Placeables/FurnitureAstral/MonolithDresser.cs +++ b/Items/Placeables/FurnitureAstral/MonolithDresser.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Dresser"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Dresser"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithLamp.cs b/Items/Placeables/FurnitureAstral/MonolithLamp.cs index 1592b86f07..cc19536643 100644 --- a/Items/Placeables/FurnitureAstral/MonolithLamp.cs +++ b/Items/Placeables/FurnitureAstral/MonolithLamp.cs @@ -12,27 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Lamp"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Lamp"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 9).AddIngredient(ModContent.ItemType(), 1).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithLantern.cs b/Items/Placeables/FurnitureAstral/MonolithLantern.cs index ffcb0023b3..79abd0b8a6 100644 --- a/Items/Placeables/FurnitureAstral/MonolithLantern.cs +++ b/Items/Placeables/FurnitureAstral/MonolithLantern.cs @@ -12,27 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Lantern"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Lantern"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 1).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithPiano.cs b/Items/Placeables/FurnitureAstral/MonolithPiano.cs index a6db0470a0..f8446a7a25 100644 --- a/Items/Placeables/FurnitureAstral/MonolithPiano.cs +++ b/Items/Placeables/FurnitureAstral/MonolithPiano.cs @@ -11,28 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Piano"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Piano"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Bone, 4).AddIngredient(ItemID.Book).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithPlatform.cs b/Items/Placeables/FurnitureAstral/MonolithPlatform.cs index 97ab9ad12e..951e6b9c3a 100644 --- a/Items/Placeables/FurnitureAstral/MonolithPlatform.cs +++ b/Items/Placeables/FurnitureAstral/MonolithPlatform.cs @@ -11,25 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Platform"); - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Platform"); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithSink.cs b/Items/Placeables/FurnitureAstral/MonolithSink.cs index 6d8bc9f389..7542d5006f 100644 --- a/Items/Placeables/FurnitureAstral/MonolithSink.cs +++ b/Items/Placeables/FurnitureAstral/MonolithSink.cs @@ -12,27 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Sink"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Sink"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.WaterBucket).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithTable.cs b/Items/Placeables/FurnitureAstral/MonolithTable.cs index d2f0e2900c..1de1a7f139 100644 --- a/Items/Placeables/FurnitureAstral/MonolithTable.cs +++ b/Items/Placeables/FurnitureAstral/MonolithTable.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Table"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Table"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAstral/MonolithWorkBench.cs b/Items/Placeables/FurnitureAstral/MonolithWorkBench.cs index 320ea87981..606699328f 100644 --- a/Items/Placeables/FurnitureAstral/MonolithWorkBench.cs +++ b/Items/Placeables/FurnitureAstral/MonolithWorkBench.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureAstral public override void SetDefaults() { - item.SetNameOverride("Monolith Work Bench"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Monolith Work Bench"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs b/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs index a260eb0b6f..3d59924cf7 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs @@ -12,26 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicBed.cs b/Items/Placeables/FurnitureBotanic/BotanicBed.cs index 50a3517ed9..0ab9b4409e 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBed.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBed.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Vine, 5); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Vine, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicBench.cs b/Items/Placeables/FurnitureBotanic/BotanicBench.cs index 491a96af76..1aeed196f2 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBench.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBench.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Vine, 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Vine, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs b/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs index 42e5d9a754..36ebfc40ab 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs b/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs index f96490b5a5..d835bf80e2 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.JungleSpores, 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.JungleSpores, 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicCandle.cs b/Items/Placeables/FurnitureBotanic/BotanicCandle.cs index 3e68f8d0d6..cdb63e6ea8 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicCandle.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicCandle.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.JungleSpores); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.JungleSpores).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicChair.cs b/Items/Placeables/FurnitureBotanic/BotanicChair.cs index 4c5ac4f8b7..ade67a7810 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChair.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChair.cs @@ -12,26 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs b/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs index 28490b2974..db93b65c7d 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.JungleSpores, 4); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.JungleSpores, 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicChest.cs b/Items/Placeables/FurnitureBotanic/BotanicChest.cs index af4aeae5b7..036c2a072a 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChest.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChest.cs @@ -11,28 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.IronBar, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicClock.cs b/Items/Placeables/FurnitureBotanic/BotanicClock.cs index aaf6d04614..42d57dc151 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicClock.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicClock.cs @@ -11,28 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.IronBar, 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicDoor.cs b/Items/Placeables/FurnitureBotanic/BotanicDoor.cs index 323366a583..01e4ce5bd6 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicDoor.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicDoor.cs @@ -13,26 +13,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicDresser.cs b/Items/Placeables/FurnitureBotanic/BotanicDresser.cs index ea02d06016..ad5c09a10b 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicDresser.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicDresser.cs @@ -12,26 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicLamp.cs b/Items/Placeables/FurnitureBotanic/BotanicLamp.cs index dc25fea0dd..e3b0091177 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicLamp.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicLamp.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.JungleSpores); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.JungleSpores).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicLantern.cs b/Items/Placeables/FurnitureBotanic/BotanicLantern.cs index b3256358d0..183ea710a3 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicLantern.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicLantern.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.JungleSpores); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.JungleSpores).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicPiano.cs b/Items/Placeables/FurnitureBotanic/BotanicPiano.cs index 14f94528e7..e76dcb3009 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicPiano.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicPiano.cs @@ -11,28 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Bone, 4).AddIngredient(ItemID.Book).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs b/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs index f2fb3d05aa..702de27ea3 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicSink.cs b/Items/Placeables/FurnitureBotanic/BotanicSink.cs index cabf3c0272..42d867da9d 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicSink.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicSink.cs @@ -12,27 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.HoneyBucket); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.HoneyBucket).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicTable.cs b/Items/Placeables/FurnitureBotanic/BotanicTable.cs index 6a69e6bea7..502c51333e 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicTable.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicTable.cs @@ -12,26 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs b/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs index 8f3ca3975c..453fee7ba6 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs @@ -12,26 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = 0; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = 0; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs index 0ce6d227cd..59f1b3ce54 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBasin.cs @@ -14,27 +14,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.IronBar, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs index af2661ee4c..3c410f4277 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs @@ -12,26 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.SetNameOverride("Cosmilite Bathtub"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Cosmilite Bathtub"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs index ea22e7266c..b546a4a5e1 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Silk, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs index 10a93b62d5..069e6562cc 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs index 78acdc0f16..0b2c537552 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs @@ -13,36 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddRecipeGroup("AnyStoneBlock", 20); - recipe.SetResult(this, 20); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(20).AddIngredient(ModContent.ItemType(), 1).AddRecipeGroup("AnyStoneBlock", 20).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs index 02f362ec3c..23c5f2d394 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Torch, 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Torch, 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs index bc4c4ead1f..c1a0d5ffd1 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Torch).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs index c476c460d8..63a4c6e569 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 12; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs index 71c42fd1b4..45325d562d 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs @@ -11,27 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Torch, 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Torch, 4).AddIngredient(ItemID.Chain).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs index 9ca21cb4f3..fe56356389 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs @@ -11,27 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.IronBar, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs index 8b0a05bbdf..8c84392674 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs @@ -12,28 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.IronBar, 3).AddIngredient(ItemID.Glass, 6).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs index 9d99653c81..988126bd2f 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 14; + Item.height = 28; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs index 9dfdcd4b76..bce181c27b 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs index 486a03073b..e7bbd49800 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Torch); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Torch).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs index e0d79c7a02..f2173cb6fc 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.Torch).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs b/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs index 09afdea1b2..18f671e001 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs @@ -11,27 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Bone, 4).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Book).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs b/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs index a8a98e921a..d47b99e0fb 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs index d7522e7b48..05c2344231 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.Torch, 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.Torch, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs index 8d93ba03c1..67f4004110 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.WaterBucket).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs index 81c0dd224b..8c650a0609 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Silk, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs index b25409c587..06556fbde5 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs index 8ea676306f..2152643bff 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs @@ -12,26 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void SetDefaults() { - item.SetNameOverride("Cosmilite Work Bench"); - item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Cosmilite Work Bench"); + Item.width = 28; + Item.height = 14; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs index be4945bdc5..35e48cbb9b 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs index c5326d5690..206f6e18b3 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Silk, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs index 6ca0c2309b..18f0152939 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs index 16c32e3d5e..6c34f00ae9 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs b/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs index 0ad861e738..4daef9e8cd 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs b/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs index cfc3e1ff86..36906675b4 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 1).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs index 00c21452d1..6295d08d43 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs index 093d4f3258..ef8a6b3dfb 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs @@ -12,27 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 1).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs index 2e0ead968c..316ecbc89c 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 1).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs b/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs index 9447bf2412..c6421bcd39 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs @@ -12,27 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs b/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs index 9f3f63e5b5..017d21b135 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs b/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs index f2c96961c8..56416f945f 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs b/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs index 812426332f..aae45fbf18 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 1).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs b/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs index 6a6026567f..078b8ea218 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 1).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs b/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs index e91d8ac3e6..59ae5140c1 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs @@ -11,27 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Bone, 4).AddIngredient(ItemID.Book).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs b/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs index 50c59b288b..57e9b1aa36 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs b/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs index 7ffc8fbd7d..10902dae99 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.WaterBucket).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs b/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs index 43b61bb2da..1b33589886 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs b/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs index 3a34ae6bff..44c5c52a2d 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs b/Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs index 4fe2d30933..73f072f83f 100644 --- a/Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs +++ b/Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs @@ -12,30 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoBathtub.cs b/Items/Placeables/FurnitureExo/ExoBathtub.cs index 43f67f6bce..53a627e06f 100644 --- a/Items/Placeables/FurnitureExo/ExoBathtub.cs +++ b/Items/Placeables/FurnitureExo/ExoBathtub.cs @@ -12,27 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Bathtub"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Bathtub"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoBed.cs b/Items/Placeables/FurnitureExo/ExoBed.cs index 8b520a0ed1..481473752d 100644 --- a/Items/Placeables/FurnitureExo/ExoBed.cs +++ b/Items/Placeables/FurnitureExo/ExoBed.cs @@ -12,28 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Bed"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Bed"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Silk, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoBookcase.cs b/Items/Placeables/FurnitureExo/ExoBookcase.cs index a1da33727a..40bcf490ee 100644 --- a/Items/Placeables/FurnitureExo/ExoBookcase.cs +++ b/Items/Placeables/FurnitureExo/ExoBookcase.cs @@ -12,28 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Bookcase"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Bookcase"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoCandelabra.cs b/Items/Placeables/FurnitureExo/ExoCandelabra.cs index df0043cb9e..19e96921b0 100644 --- a/Items/Placeables/FurnitureExo/ExoCandelabra.cs +++ b/Items/Placeables/FurnitureExo/ExoCandelabra.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Candelabra"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Candelabra"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoCandle.cs b/Items/Placeables/FurnitureExo/ExoCandle.cs index fd34d061e9..dffb46355e 100644 --- a/Items/Placeables/FurnitureExo/ExoCandle.cs +++ b/Items/Placeables/FurnitureExo/ExoCandle.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Candle"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Candle"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoChair.cs b/Items/Placeables/FurnitureExo/ExoChair.cs index 382a4a8c21..55c362e0f7 100644 --- a/Items/Placeables/FurnitureExo/ExoChair.cs +++ b/Items/Placeables/FurnitureExo/ExoChair.cs @@ -12,27 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Chair"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Chair"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoChandelier.cs b/Items/Placeables/FurnitureExo/ExoChandelier.cs index 79b0731cf1..20e9d61514 100644 --- a/Items/Placeables/FurnitureExo/ExoChandelier.cs +++ b/Items/Placeables/FurnitureExo/ExoChandelier.cs @@ -13,29 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Chandelier"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Chandelier"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Chain).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoChest.cs b/Items/Placeables/FurnitureExo/ExoChest.cs index bf65d363e6..60ab6ca309 100644 --- a/Items/Placeables/FurnitureExo/ExoChest.cs +++ b/Items/Placeables/FurnitureExo/ExoChest.cs @@ -12,29 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Chest"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Chest"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.IronBar, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoClock.cs b/Items/Placeables/FurnitureExo/ExoClock.cs index 54efd7e9ea..fae7aa6cd5 100644 --- a/Items/Placeables/FurnitureExo/ExoClock.cs +++ b/Items/Placeables/FurnitureExo/ExoClock.cs @@ -12,30 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Clock"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Clock"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.IronBar, 3).AddIngredient(ItemID.Glass, 6).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoConsole.cs b/Items/Placeables/FurnitureExo/ExoConsole.cs index 4bd20a5e18..a9917f9972 100644 --- a/Items/Placeables/FurnitureExo/ExoConsole.cs +++ b/Items/Placeables/FurnitureExo/ExoConsole.cs @@ -14,27 +14,22 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoDisplay.cs b/Items/Placeables/FurnitureExo/ExoDisplay.cs index 8f085087bf..0a762b2e8f 100644 --- a/Items/Placeables/FurnitureExo/ExoDisplay.cs +++ b/Items/Placeables/FurnitureExo/ExoDisplay.cs @@ -14,27 +14,22 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoDoor.cs b/Items/Placeables/FurnitureExo/ExoDoor.cs index 89b388f71a..35e99d4f93 100644 --- a/Items/Placeables/FurnitureExo/ExoDoor.cs +++ b/Items/Placeables/FurnitureExo/ExoDoor.cs @@ -12,27 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Door"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Door"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoDresser.cs b/Items/Placeables/FurnitureExo/ExoDresser.cs index e5d8696fc9..71c89f89ca 100644 --- a/Items/Placeables/FurnitureExo/ExoDresser.cs +++ b/Items/Placeables/FurnitureExo/ExoDresser.cs @@ -12,27 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Dresser"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Dresser"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoKeyboard.cs b/Items/Placeables/FurnitureExo/ExoKeyboard.cs index 403ecaab87..76f433a50e 100644 --- a/Items/Placeables/FurnitureExo/ExoKeyboard.cs +++ b/Items/Placeables/FurnitureExo/ExoKeyboard.cs @@ -12,29 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Keyboard"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Keyboard"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Bone, 4).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Book).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoLamp.cs b/Items/Placeables/FurnitureExo/ExoLamp.cs index 31f8a77b56..fb2a2cfa27 100644 --- a/Items/Placeables/FurnitureExo/ExoLamp.cs +++ b/Items/Placeables/FurnitureExo/ExoLamp.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Lamp"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Lamp"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoLantern.cs b/Items/Placeables/FurnitureExo/ExoLantern.cs index ebc1795f84..c13f5aea7b 100644 --- a/Items/Placeables/FurnitureExo/ExoLantern.cs +++ b/Items/Placeables/FurnitureExo/ExoLantern.cs @@ -13,28 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Lantern"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Lantern"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoPlatform.cs b/Items/Placeables/FurnitureExo/ExoPlatform.cs index bd542557ba..c40e88b694 100644 --- a/Items/Placeables/FurnitureExo/ExoPlatform.cs +++ b/Items/Placeables/FurnitureExo/ExoPlatform.cs @@ -12,26 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Platform"); - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Platform"); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoPlating.cs b/Items/Placeables/FurnitureExo/ExoPlating.cs index 14075ce581..47c365f8a7 100644 --- a/Items/Placeables/FurnitureExo/ExoPlating.cs +++ b/Items/Placeables/FurnitureExo/ExoPlating.cs @@ -16,41 +16,29 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Placeables/FurnitureExo/ExoPlating_Glow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Placeables/FurnitureExo/ExoPlating_Glow")); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyStoneBlock", 200); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 200); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(200).AddRecipeGroup("AnyStoneBlock", 200).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoPrismPanel.cs b/Items/Placeables/FurnitureExo/ExoPrismPanel.cs index be4f1d5e99..0e81d799ec 100644 --- a/Items/Placeables/FurnitureExo/ExoPrismPanel.cs +++ b/Items/Placeables/FurnitureExo/ExoPrismPanel.cs @@ -16,41 +16,29 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Placeables/FurnitureExo/ExoPrismPanel_Glow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Placeables/FurnitureExo/ExoPrismPanel_Glow")); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Glass, 200); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 200); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(200).AddIngredient(ItemID.Glass, 200).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoPrismPlatform.cs b/Items/Placeables/FurnitureExo/ExoPrismPlatform.cs index b470f2f4a1..e211334d87 100644 --- a/Items/Placeables/FurnitureExo/ExoPrismPlatform.cs +++ b/Items/Placeables/FurnitureExo/ExoPrismPlatform.cs @@ -14,31 +14,28 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Prism Platform"); - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Prism Platform"); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Placeables/FurnitureExo/ExoPrismPlatform_Glow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Placeables/FurnitureExo/ExoPrismPlatform_Glow")); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoScreen.cs b/Items/Placeables/FurnitureExo/ExoScreen.cs index bbb0e5fea6..42d3165e5d 100644 --- a/Items/Placeables/FurnitureExo/ExoScreen.cs +++ b/Items/Placeables/FurnitureExo/ExoScreen.cs @@ -14,27 +14,22 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoServer.cs b/Items/Placeables/FurnitureExo/ExoServer.cs index 73f51b760a..f961df6a59 100644 --- a/Items/Placeables/FurnitureExo/ExoServer.cs +++ b/Items/Placeables/FurnitureExo/ExoServer.cs @@ -14,27 +14,22 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 15).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoSink.cs b/Items/Placeables/FurnitureExo/ExoSink.cs index e71e63d2d0..a2d272a7f4 100644 --- a/Items/Placeables/FurnitureExo/ExoSink.cs +++ b/Items/Placeables/FurnitureExo/ExoSink.cs @@ -13,30 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Sink"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Sink"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.AddIngredient(ItemID.HoneyBucket); - recipe.AddIngredient(ItemID.LavaBucket); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.WaterBucket).AddIngredient(ItemID.HoneyBucket).AddIngredient(ItemID.LavaBucket).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoSofa.cs b/Items/Placeables/FurnitureExo/ExoSofa.cs index fc05931773..91430243fd 100644 --- a/Items/Placeables/FurnitureExo/ExoSofa.cs +++ b/Items/Placeables/FurnitureExo/ExoSofa.cs @@ -12,28 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Sofa"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Sofa"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Silk, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoTable.cs b/Items/Placeables/FurnitureExo/ExoTable.cs index 83804410e6..8de7573faf 100644 --- a/Items/Placeables/FurnitureExo/ExoTable.cs +++ b/Items/Placeables/FurnitureExo/ExoTable.cs @@ -12,27 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Table"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Table"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoTerminal.cs b/Items/Placeables/FurnitureExo/ExoTerminal.cs index 8db6b1f52a..cf555ed6ab 100644 --- a/Items/Placeables/FurnitureExo/ExoTerminal.cs +++ b/Items/Placeables/FurnitureExo/ExoTerminal.cs @@ -14,27 +14,22 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoToilet.cs b/Items/Placeables/FurnitureExo/ExoToilet.cs index d071558b23..ec1f1ae42b 100644 --- a/Items/Placeables/FurnitureExo/ExoToilet.cs +++ b/Items/Placeables/FurnitureExo/ExoToilet.cs @@ -12,27 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Toilet"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Toilet"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoWorkbench.cs b/Items/Placeables/FurnitureExo/ExoWorkbench.cs index b61d43601d..efcc0a2180 100644 --- a/Items/Placeables/FurnitureExo/ExoWorkbench.cs +++ b/Items/Placeables/FurnitureExo/ExoWorkbench.cs @@ -11,26 +11,23 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void SetDefaults() { - item.SetNameOverride("Exo Work Bench"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.SetNameOverride("Exo Work Bench"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultBathtub.cs b/Items/Placeables/FurnitureOccult/OccultBathtub.cs index 42b3460998..2132565b65 100644 --- a/Items/Placeables/FurnitureOccult/OccultBathtub.cs +++ b/Items/Placeables/FurnitureOccult/OccultBathtub.cs @@ -10,26 +10,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Bathtub"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Bathtub"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultBed.cs b/Items/Placeables/FurnitureOccult/OccultBed.cs index f911a8ef9c..1e3777f089 100644 --- a/Items/Placeables/FurnitureOccult/OccultBed.cs +++ b/Items/Placeables/FurnitureOccult/OccultBed.cs @@ -10,27 +10,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Bed"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Bed"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Silk, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultBookcase.cs b/Items/Placeables/FurnitureOccult/OccultBookcase.cs index a60631c54c..fc56e49347 100644 --- a/Items/Placeables/FurnitureOccult/OccultBookcase.cs +++ b/Items/Placeables/FurnitureOccult/OccultBookcase.cs @@ -10,27 +10,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Bookcase"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Bookcase"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultCandelabra.cs b/Items/Placeables/FurnitureOccult/OccultCandelabra.cs index cd5fdeafdd..cc0990597b 100644 --- a/Items/Placeables/FurnitureOccult/OccultCandelabra.cs +++ b/Items/Placeables/FurnitureOccult/OccultCandelabra.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Candelabra"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Candelabra"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultCandle.cs b/Items/Placeables/FurnitureOccult/OccultCandle.cs index 097b587dc2..96a52eee1a 100644 --- a/Items/Placeables/FurnitureOccult/OccultCandle.cs +++ b/Items/Placeables/FurnitureOccult/OccultCandle.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Candle"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Candle"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultChair.cs b/Items/Placeables/FurnitureOccult/OccultChair.cs index c266c51739..212a1774b9 100644 --- a/Items/Placeables/FurnitureOccult/OccultChair.cs +++ b/Items/Placeables/FurnitureOccult/OccultChair.cs @@ -10,26 +10,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Chair"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Chair"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultChandelier.cs b/Items/Placeables/FurnitureOccult/OccultChandelier.cs index ec3e568ab1..92246343fb 100644 --- a/Items/Placeables/FurnitureOccult/OccultChandelier.cs +++ b/Items/Placeables/FurnitureOccult/OccultChandelier.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Chandelier"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Chandelier"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultChest.cs b/Items/Placeables/FurnitureOccult/OccultChest.cs index 9df2f9375d..d7f4938275 100644 --- a/Items/Placeables/FurnitureOccult/OccultChest.cs +++ b/Items/Placeables/FurnitureOccult/OccultChest.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Chest"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Chest"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultClock.cs b/Items/Placeables/FurnitureOccult/OccultClock.cs index 80552c398d..9aef2dca8b 100644 --- a/Items/Placeables/FurnitureOccult/OccultClock.cs +++ b/Items/Placeables/FurnitureOccult/OccultClock.cs @@ -11,28 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Clock"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Clock"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.Glass, 6); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.Glass, 6).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultDoor.cs b/Items/Placeables/FurnitureOccult/OccultDoor.cs index 2422810188..25a5931677 100644 --- a/Items/Placeables/FurnitureOccult/OccultDoor.cs +++ b/Items/Placeables/FurnitureOccult/OccultDoor.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Door"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Door"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultDresser.cs b/Items/Placeables/FurnitureOccult/OccultDresser.cs index 19c7a2bacd..26c469363d 100644 --- a/Items/Placeables/FurnitureOccult/OccultDresser.cs +++ b/Items/Placeables/FurnitureOccult/OccultDresser.cs @@ -10,26 +10,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Dresser"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Dresser"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultLamp.cs b/Items/Placeables/FurnitureOccult/OccultLamp.cs index 79159d3ac6..9d1eea97b5 100644 --- a/Items/Placeables/FurnitureOccult/OccultLamp.cs +++ b/Items/Placeables/FurnitureOccult/OccultLamp.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Lamp"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Lamp"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 9).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultLantern.cs b/Items/Placeables/FurnitureOccult/OccultLantern.cs index da19d118ab..6c27edaaaa 100644 --- a/Items/Placeables/FurnitureOccult/OccultLantern.cs +++ b/Items/Placeables/FurnitureOccult/OccultLantern.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Lantern"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Lantern"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultPiano.cs b/Items/Placeables/FurnitureOccult/OccultPiano.cs index 3d868f0094..267342bbc4 100644 --- a/Items/Placeables/FurnitureOccult/OccultPiano.cs +++ b/Items/Placeables/FurnitureOccult/OccultPiano.cs @@ -10,28 +10,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Piano"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Piano"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Bone, 4).AddIngredient(ItemID.Book).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultPlatform.cs b/Items/Placeables/FurnitureOccult/OccultPlatform.cs index e8f471fcb5..d485dbc118 100644 --- a/Items/Placeables/FurnitureOccult/OccultPlatform.cs +++ b/Items/Placeables/FurnitureOccult/OccultPlatform.cs @@ -10,26 +10,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Platform"); - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Platform"); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultSink.cs b/Items/Placeables/FurnitureOccult/OccultSink.cs index 1b2fb0fc01..f0b2e66ade 100644 --- a/Items/Placeables/FurnitureOccult/OccultSink.cs +++ b/Items/Placeables/FurnitureOccult/OccultSink.cs @@ -11,27 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Sink"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Sink"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.WaterBucket).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultSofa.cs b/Items/Placeables/FurnitureOccult/OccultSofa.cs index 65167e7293..2971a02460 100644 --- a/Items/Placeables/FurnitureOccult/OccultSofa.cs +++ b/Items/Placeables/FurnitureOccult/OccultSofa.cs @@ -10,27 +10,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Sofa"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Sofa"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Silk, 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultStone.cs b/Items/Placeables/FurnitureOccult/OccultStone.cs index 8170e71953..1a1fc4b0f0 100644 --- a/Items/Placeables/FurnitureOccult/OccultStone.cs +++ b/Items/Placeables/FurnitureOccult/OccultStone.cs @@ -13,40 +13,24 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Stone"); - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Stone"); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyStoneBlock", 150); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Silk, 15); - recipe.SetResult(this, 150); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(150).AddRecipeGroup("AnyStoneBlock", 150).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Silk, 15).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultTable.cs b/Items/Placeables/FurnitureOccult/OccultTable.cs index 7ae0a18269..b26e863c5d 100644 --- a/Items/Placeables/FurnitureOccult/OccultTable.cs +++ b/Items/Placeables/FurnitureOccult/OccultTable.cs @@ -10,26 +10,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Table"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Table"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureOccult/OccultWorkBench.cs b/Items/Placeables/FurnitureOccult/OccultWorkBench.cs index 27ea99ef90..774f1735a8 100644 --- a/Items/Placeables/FurnitureOccult/OccultWorkBench.cs +++ b/Items/Placeables/FurnitureOccult/OccultWorkBench.cs @@ -10,26 +10,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult public override void SetDefaults() { - item.SetNameOverride("Otherworldly Work Bench"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Otherworldly Work Bench"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlate.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlate.cs index 7cc3dc8b97..5f66c8d8b4 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlate.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlate.cs @@ -14,36 +14,23 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyStoneBlock", 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 10); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(10).AddRecipeGroup("AnyStoneBlock", 10).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs index 66f0ef310f..2f70ebcfe1 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs @@ -13,27 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Wire, 5); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Wire, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs index 65b194e752..335dd0dd49 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs index 132eae8818..bce19bf02e 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -14,26 +14,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs index 89be8e8ec3..b0f973d0f9 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs @@ -13,27 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Book).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs index 71e19762f8..1979aa39e0 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs @@ -13,27 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Wire, 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Wire, 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs index 264761ec02..fc4bd8fc02 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs @@ -13,27 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Wire); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Wire).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs index df28250d21..7abf7baf80 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs index aa09e63626..a1553eb8e1 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs @@ -13,28 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Wire, 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Wire, 4).AddIngredient(ItemID.Chain).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs index 49cd6aee4c..c44cacff15 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs @@ -13,28 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.IronBar, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs index 7fe7bba469..9ff6631f94 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs @@ -13,29 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Glass, 6); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Glass, 6).AddIngredient(ItemID.IronBar, 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs index 5a25c2d8c0..e09149fba4 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs @@ -14,26 +14,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs index 1d60aed6c1..ac939cbde4 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs index 0460e4ff80..b15e3d4043 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs @@ -13,27 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Wire); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Wire).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs index 75cbe7350f..e13297c305 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs @@ -13,27 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Wire); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Wire).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs index d61adb766a..53829151cc 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs @@ -13,28 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Bone, 4).AddIngredient(ItemID.Book).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs index aab0b3074f..e5fba3d78c 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs index 80169a04ea..3ed23a19b0 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs @@ -14,27 +14,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.WaterBucket, 1); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.WaterBucket, 1).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs index 98500530b4..4ea844d5f9 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs @@ -13,27 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Silk, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs index 82034950b7..f070f8454c 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs index f15bc39e4d..92ccdb893d 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBath.cs b/Items/Placeables/FurnitureProfaned/ProfanedBath.cs index f07acdd0d2..8351421463 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBath.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBath.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.SetNameOverride("Profaned Bathtub"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Profaned Bathtub"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBed.cs b/Items/Placeables/FurnitureProfaned/ProfanedBed.cs index 70e9f683b4..d20ed85a9c 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBed.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBed.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Silk, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBench.cs b/Items/Placeables/FurnitureProfaned/ProfanedBench.cs index 59b1b4920b..5b62bc3d7b 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBench.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBench.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Silk, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs b/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs index 6419359076..5a54bef1e2 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs b/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs index 6538873a55..12ee560361 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Torch, 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Torch, 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs b/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs index dfa6f7b398..89155a8690 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Torch).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChair.cs b/Items/Placeables/FurnitureProfaned/ProfanedChair.cs index cec01ba444..4fff9e9a5d 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedChair.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedChair.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 12; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs b/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs index de1db867b7..78feffd974 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs @@ -11,27 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Torch, 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Torch, 4).AddIngredient(ItemID.Chain).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChest.cs b/Items/Placeables/FurnitureProfaned/ProfanedChest.cs index 55de5c3317..630b5540f1 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedChest.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedChest.cs @@ -11,27 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.IronBar, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedClock.cs b/Items/Placeables/FurnitureProfaned/ProfanedClock.cs index fec8da5c6a..95421d7dfa 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedClock.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedClock.cs @@ -11,28 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.IronBar, 3).AddIngredient(ItemID.Glass, 6).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs b/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs index fc32d06f9c..1940bce7ca 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs @@ -12,31 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Glass, 20); - recipe.SetResult(this, 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(20).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Glass, 20).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs b/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs index 8e1099bf2b..df05f7c185 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 14; + Item.height = 28; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs b/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs index cf8bdd5e5c..c4268c170c 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs b/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs index db6cfe1686..2881e1311d 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Torch); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Torch).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs b/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs index 560e15d6e7..8f39ad24fe 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.Torch).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs b/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs index ca608417e4..bfc24ca449 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs @@ -11,27 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Bone, 4).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Book).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs b/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs index 13c0112efa..524a3407c9 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs @@ -10,25 +10,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedRock.cs b/Items/Placeables/FurnitureProfaned/ProfanedRock.cs index 284e5ae356..55572526cc 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedRock.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedRock.cs @@ -12,36 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("AnyStoneBlock", 20); - recipe.SetResult(this, 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(20).AddIngredient(ModContent.ItemType()).AddRecipeGroup("AnyStoneBlock", 20).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedSink.cs b/Items/Placeables/FurnitureProfaned/ProfanedSink.cs index a7b2a7f625..c36b4691c6 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedSink.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedSink.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.LavaBucket); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.LavaBucket).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedSlab.cs b/Items/Placeables/FurnitureProfaned/ProfanedSlab.cs index 48d91afc89..75236f6232 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedSlab.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedSlab.cs @@ -11,30 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.SetResult(this, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedTable.cs b/Items/Placeables/FurnitureProfaned/ProfanedTable.cs index 0df753bff7..d0a5ff8827 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedTable.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedTable.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.cs b/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.cs index 2eb36ea337..e4077cebce 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.SetNameOverride("Profaned Work Bench"); - item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Profaned Work Bench"); + Item.width = 28; + Item.height = 14; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/RunicProfanedBrick.cs b/Items/Placeables/FurnitureProfaned/RunicProfanedBrick.cs index e9ded18620..bcfdda5a4b 100644 --- a/Items/Placeables/FurnitureProfaned/RunicProfanedBrick.cs +++ b/Items/Placeables/FurnitureProfaned/RunicProfanedBrick.cs @@ -12,31 +12,22 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(5).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaBathtub.cs b/Items/Placeables/FurnitureSilva/SilvaBathtub.cs index f2c69fbdaf..e9a9a0642b 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBathtub.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBathtub.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaBed.cs b/Items/Placeables/FurnitureSilva/SilvaBed.cs index 00e1f0ba74..2efba2974f 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBed.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBed.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Silk, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaBench.cs b/Items/Placeables/FurnitureSilva/SilvaBench.cs index 444e75d74c..e60662a3fd 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBench.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBench.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaBookcase.cs b/Items/Placeables/FurnitureSilva/SilvaBookcase.cs index c1399436b8..8191676fb9 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBookcase.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBookcase.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs b/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs index 8ef27911f3..97b942196f 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaCandle.cs b/Items/Placeables/FurnitureSilva/SilvaCandle.cs index 119316a107..ef85df4c13 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCandle.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCandle.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaChair.cs b/Items/Placeables/FurnitureSilva/SilvaChair.cs index 172ef47636..0fb4f0d764 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChair.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChair.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaChandelier.cs b/Items/Placeables/FurnitureSilva/SilvaChandelier.cs index 7bbac0f482..f46f9a4351 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChandelier.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChandelier.cs @@ -13,27 +13,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddRecipeGroup("AnyGoldBar"); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddRecipeGroup("AnyGoldBar").AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaChest.cs b/Items/Placeables/FurnitureSilva/SilvaChest.cs index 8a36ee6eeb..03c608b0c9 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChest.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChest.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddRecipeGroup("AnyGoldBar"); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddRecipeGroup("AnyGoldBar").AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaClock.cs b/Items/Placeables/FurnitureSilva/SilvaClock.cs index d3640d9bf1..8e20cb0979 100644 --- a/Items/Placeables/FurnitureSilva/SilvaClock.cs +++ b/Items/Placeables/FurnitureSilva/SilvaClock.cs @@ -11,28 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddRecipeGroup("AnyGoldBar", 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddRecipeGroup("AnyGoldBar", 3).AddIngredient(ItemID.Glass, 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaCrystal.cs b/Items/Placeables/FurnitureSilva/SilvaCrystal.cs index 492271d146..6854bbcc94 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCrystal.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCrystal.cs @@ -13,38 +13,23 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalBlock, 200); - recipe.AddRecipeGroup("AnyGoldBar", 25); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 400); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(400).AddIngredient(ItemID.CrystalBlock, 200).AddRecipeGroup("AnyGoldBar", 25).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaDoor.cs b/Items/Placeables/FurnitureSilva/SilvaDoor.cs index 7e53b496e3..4dda04c4e8 100644 --- a/Items/Placeables/FurnitureSilva/SilvaDoor.cs +++ b/Items/Placeables/FurnitureSilva/SilvaDoor.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaDresser.cs b/Items/Placeables/FurnitureSilva/SilvaDresser.cs index 39d2b02cde..eb4b96b873 100644 --- a/Items/Placeables/FurnitureSilva/SilvaDresser.cs +++ b/Items/Placeables/FurnitureSilva/SilvaDresser.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaLamp.cs b/Items/Placeables/FurnitureSilva/SilvaLamp.cs index df9109ffe7..31e3543e3e 100644 --- a/Items/Placeables/FurnitureSilva/SilvaLamp.cs +++ b/Items/Placeables/FurnitureSilva/SilvaLamp.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaLantern.cs b/Items/Placeables/FurnitureSilva/SilvaLantern.cs index 77cbfcdfc2..11926e52ce 100644 --- a/Items/Placeables/FurnitureSilva/SilvaLantern.cs +++ b/Items/Placeables/FurnitureSilva/SilvaLantern.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaPiano.cs b/Items/Placeables/FurnitureSilva/SilvaPiano.cs index e2c5fef227..e3c8cc9d29 100644 --- a/Items/Placeables/FurnitureSilva/SilvaPiano.cs +++ b/Items/Placeables/FurnitureSilva/SilvaPiano.cs @@ -11,27 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Bone, 4).AddIngredient(ItemID.Book).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaPlatform.cs b/Items/Placeables/FurnitureSilva/SilvaPlatform.cs index 0962b6ecf4..3c4f683d82 100644 --- a/Items/Placeables/FurnitureSilva/SilvaPlatform.cs +++ b/Items/Placeables/FurnitureSilva/SilvaPlatform.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaSink.cs b/Items/Placeables/FurnitureSilva/SilvaSink.cs index 1fd97c15a8..161d40e452 100644 --- a/Items/Placeables/FurnitureSilva/SilvaSink.cs +++ b/Items/Placeables/FurnitureSilva/SilvaSink.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.WaterBucket).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaTable.cs b/Items/Placeables/FurnitureSilva/SilvaTable.cs index c2cf2950ce..ba3244f85b 100644 --- a/Items/Placeables/FurnitureSilva/SilvaTable.cs +++ b/Items/Placeables/FurnitureSilva/SilvaTable.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs b/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs index bd60f93d00..8af2f42e83 100644 --- a/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs +++ b/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelBath.cs b/Items/Placeables/FurnitureStatigel/StatigelBath.cs index fa790183e4..9b803501af 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBath.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBath.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.SetNameOverride("Statigel Bathtub"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Statigel Bathtub"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelBed.cs b/Items/Placeables/FurnitureStatigel/StatigelBed.cs index aff3b833ad..165a37a9c2 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBed.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBed.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Silk, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelBlock.cs b/Items/Placeables/FurnitureStatigel/StatigelBlock.cs index 320200c996..9525867886 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBlock.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBlock.cs @@ -14,37 +14,23 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 10); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(10).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs b/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs index fc508cfd11..21a186069a 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs b/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs index 4bcade6253..f274ed1d2d 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Torch, 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Torch, 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelCandle.cs b/Items/Placeables/FurnitureStatigel/StatigelCandle.cs index 308f3deecc..6802d55a5e 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelCandle.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelCandle.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Torch).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelChair.cs b/Items/Placeables/FurnitureStatigel/StatigelChair.cs index 70a7324427..74a3a81186 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChair.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChair.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 12; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs b/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs index 6102484361..5869840416 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs @@ -11,27 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Torch, 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Torch, 4).AddIngredient(ItemID.Chain).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelChest.cs b/Items/Placeables/FurnitureStatigel/StatigelChest.cs index 79bdadbda8..c4c5d81d81 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChest.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChest.cs @@ -11,27 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.IronBar, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelClock.cs b/Items/Placeables/FurnitureStatigel/StatigelClock.cs index 8915eeb183..b188a3bf80 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelClock.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelClock.cs @@ -11,28 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 18; - item.height = 46; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 18; + Item.height = 46; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.IronBar, 3).AddIngredient(ItemID.Glass, 6).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelDoor.cs b/Items/Placeables/FurnitureStatigel/StatigelDoor.cs index fa381319b9..c5c9078fc8 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelDoor.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelDoor.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 14; + Item.height = 28; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelDresser.cs b/Items/Placeables/FurnitureStatigel/StatigelDresser.cs index 0a2b1c2279..0bd0fd1b04 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelDresser.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelDresser.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelLamp.cs b/Items/Placeables/FurnitureStatigel/StatigelLamp.cs index 59029dde11..0c4c46af6d 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelLamp.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelLamp.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Torch); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Torch).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelLantern.cs b/Items/Placeables/FurnitureStatigel/StatigelLantern.cs index 3adae2902a..6a6d99c54c 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelLantern.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelLantern.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.Torch); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.Torch).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelPiano.cs b/Items/Placeables/FurnitureStatigel/StatigelPiano.cs index 312716c25f..610160268a 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelPiano.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelPiano.cs @@ -11,27 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Bone, 4).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Book).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs b/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs index 9ae59c1247..2c177b7bd5 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelSink.cs b/Items/Placeables/FurnitureStatigel/StatigelSink.cs index c738bf1f5c..0d7d4170ab 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelSink.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelSink.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.WaterBucket).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelSofa.cs b/Items/Placeables/FurnitureStatigel/StatigelSofa.cs index 15d696c8d6..88e7ecd5fb 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelSofa.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelSofa.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Silk, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelTable.cs b/Items/Placeables/FurnitureStatigel/StatigelTable.cs index 3f1a96de16..341b21c9b9 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelTable.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelTable.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelWorkbench.cs b/Items/Placeables/FurnitureStatigel/StatigelWorkbench.cs index 803c5e57b0..6d37e53a03 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelWorkbench.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelWorkbench.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void SetDefaults() { - item.SetNameOverride("Statigel Work Bench"); - item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Statigel Work Bench"); + Item.width = 28; + Item.height = 14; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusBathtub.cs b/Items/Placeables/FurnitureStratus/StratusBathtub.cs index e224a99058..e05a28cc22 100644 --- a/Items/Placeables/FurnitureStratus/StratusBathtub.cs +++ b/Items/Placeables/FurnitureStratus/StratusBathtub.cs @@ -10,25 +10,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusBed.cs b/Items/Placeables/FurnitureStratus/StratusBed.cs index 714e66524d..336ac35f8d 100644 --- a/Items/Placeables/FurnitureStratus/StratusBed.cs +++ b/Items/Placeables/FurnitureStratus/StratusBed.cs @@ -10,26 +10,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Silk, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusBookcase.cs b/Items/Placeables/FurnitureStratus/StratusBookcase.cs index 9fa963130a..148d666a59 100644 --- a/Items/Placeables/FurnitureStratus/StratusBookcase.cs +++ b/Items/Placeables/FurnitureStratus/StratusBookcase.cs @@ -10,26 +10,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusBricks.cs b/Items/Placeables/FurnitureStratus/StratusBricks.cs index 0bf021d1b2..81a9279741 100644 --- a/Items/Placeables/FurnitureStratus/StratusBricks.cs +++ b/Items/Placeables/FurnitureStratus/StratusBricks.cs @@ -14,43 +14,24 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyStoneBlock", 50); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 50); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(50).AddRecipeGroup("AnyStoneBlock", 50).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusCandelabra.cs b/Items/Placeables/FurnitureStratus/StratusCandelabra.cs index f310ee57fd..bc9b4fd96e 100644 --- a/Items/Placeables/FurnitureStratus/StratusCandelabra.cs +++ b/Items/Placeables/FurnitureStratus/StratusCandelabra.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusCandle.cs b/Items/Placeables/FurnitureStratus/StratusCandle.cs index 4eec66e6d7..42b84dcdc4 100644 --- a/Items/Placeables/FurnitureStratus/StratusCandle.cs +++ b/Items/Placeables/FurnitureStratus/StratusCandle.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusChair.cs b/Items/Placeables/FurnitureStratus/StratusChair.cs index 03f57528a5..ccea53b2c3 100644 --- a/Items/Placeables/FurnitureStratus/StratusChair.cs +++ b/Items/Placeables/FurnitureStratus/StratusChair.cs @@ -10,25 +10,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusChandelier.cs b/Items/Placeables/FurnitureStratus/StratusChandelier.cs index cec16a72fd..970085f78a 100644 --- a/Items/Placeables/FurnitureStratus/StratusChandelier.cs +++ b/Items/Placeables/FurnitureStratus/StratusChandelier.cs @@ -11,27 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Chain).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusChest.cs b/Items/Placeables/FurnitureStratus/StratusChest.cs index e9da768598..0fe5c97d20 100644 --- a/Items/Placeables/FurnitureStratus/StratusChest.cs +++ b/Items/Placeables/FurnitureStratus/StratusChest.cs @@ -10,27 +10,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.IronBar, 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusClock.cs b/Items/Placeables/FurnitureStratus/StratusClock.cs index 1921261425..714c92a9be 100644 --- a/Items/Placeables/FurnitureStratus/StratusClock.cs +++ b/Items/Placeables/FurnitureStratus/StratusClock.cs @@ -10,28 +10,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.IronBar, 3).AddIngredient(ItemID.Glass, 6).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusDoor.cs b/Items/Placeables/FurnitureStratus/StratusDoor.cs index bb2bfbdf47..45233fd8d6 100644 --- a/Items/Placeables/FurnitureStratus/StratusDoor.cs +++ b/Items/Placeables/FurnitureStratus/StratusDoor.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusDresser.cs b/Items/Placeables/FurnitureStratus/StratusDresser.cs index 565f61a957..d1b5fe0ec6 100644 --- a/Items/Placeables/FurnitureStratus/StratusDresser.cs +++ b/Items/Placeables/FurnitureStratus/StratusDresser.cs @@ -10,25 +10,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusLamp.cs b/Items/Placeables/FurnitureStratus/StratusLamp.cs index f5ee7e3b66..bff08f4451 100644 --- a/Items/Placeables/FurnitureStratus/StratusLamp.cs +++ b/Items/Placeables/FurnitureStratus/StratusLamp.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusLantern.cs b/Items/Placeables/FurnitureStratus/StratusLantern.cs index 88d3542dc6..cf15d5132b 100644 --- a/Items/Placeables/FurnitureStratus/StratusLantern.cs +++ b/Items/Placeables/FurnitureStratus/StratusLantern.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusPiano.cs b/Items/Placeables/FurnitureStratus/StratusPiano.cs index 0602e8a58c..88afb7813e 100644 --- a/Items/Placeables/FurnitureStratus/StratusPiano.cs +++ b/Items/Placeables/FurnitureStratus/StratusPiano.cs @@ -10,27 +10,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ItemID.Book, 1); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Bone, 4).AddIngredient(ItemID.Book, 1).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusPlatform.cs b/Items/Placeables/FurnitureStratus/StratusPlatform.cs index f542a4b34a..e2b3cc8ab5 100644 --- a/Items/Placeables/FurnitureStratus/StratusPlatform.cs +++ b/Items/Placeables/FurnitureStratus/StratusPlatform.cs @@ -10,25 +10,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusSink.cs b/Items/Placeables/FurnitureStratus/StratusSink.cs index 4d88f2eae6..3f50eac1de 100644 --- a/Items/Placeables/FurnitureStratus/StratusSink.cs +++ b/Items/Placeables/FurnitureStratus/StratusSink.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.WaterBucket).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusSofa.cs b/Items/Placeables/FurnitureStratus/StratusSofa.cs index 6dd93a1b10..5920dac804 100644 --- a/Items/Placeables/FurnitureStratus/StratusSofa.cs +++ b/Items/Placeables/FurnitureStratus/StratusSofa.cs @@ -10,26 +10,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Silk, 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusStarPlatformItem.cs b/Items/Placeables/FurnitureStratus/StratusStarPlatformItem.cs index baa1443e78..2a09aed1e5 100644 --- a/Items/Placeables/FurnitureStratus/StratusStarPlatformItem.cs +++ b/Items/Placeables/FurnitureStratus/StratusStarPlatformItem.cs @@ -9,25 +9,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetStaticDefaults() => DisplayName.SetDefault("Stratus Star Platform"); public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusTable.cs b/Items/Placeables/FurnitureStratus/StratusTable.cs index a2b12a9c24..e0dadab719 100644 --- a/Items/Placeables/FurnitureStratus/StratusTable.cs +++ b/Items/Placeables/FurnitureStratus/StratusTable.cs @@ -10,25 +10,21 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusWorkbench.cs b/Items/Placeables/FurnitureStratus/StratusWorkbench.cs index 30ebb1cad4..ad13737743 100644 --- a/Items/Placeables/FurnitureStratus/StratusWorkbench.cs +++ b/Items/Placeables/FurnitureStratus/StratusWorkbench.cs @@ -10,26 +10,22 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void SetDefaults() { - item.SetNameOverride("Stratus Work Bench"); - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Stratus Work Bench"); + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/SmoothVoidstone.cs b/Items/Placeables/FurnitureVoid/SmoothVoidstone.cs index 369d7b9093..2df1df413e 100644 --- a/Items/Placeables/FurnitureVoid/SmoothVoidstone.cs +++ b/Items/Placeables/FurnitureVoid/SmoothVoidstone.cs @@ -12,35 +12,23 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs b/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs index ce8e8189d6..4580e1b613 100644 --- a/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs +++ b/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 8; + Item.height = 10; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 2); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidBath.cs b/Items/Placeables/FurnitureVoid/VoidBath.cs index 3be827d990..2688e3351c 100644 --- a/Items/Placeables/FurnitureVoid/VoidBath.cs +++ b/Items/Placeables/FurnitureVoid/VoidBath.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.SetNameOverride("Void Bathtub"); - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Void Bathtub"); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidBed.cs b/Items/Placeables/FurnitureVoid/VoidBed.cs index 1045ed8c01..9b026bed13 100644 --- a/Items/Placeables/FurnitureVoid/VoidBed.cs +++ b/Items/Placeables/FurnitureVoid/VoidBed.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Silk, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidBookcase.cs b/Items/Placeables/FurnitureVoid/VoidBookcase.cs index 65ac40cdef..27312fe7f3 100644 --- a/Items/Placeables/FurnitureVoid/VoidBookcase.cs +++ b/Items/Placeables/FurnitureVoid/VoidBookcase.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 28; - item.height = 20; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 28; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Book, 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Book, 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidCandelabra.cs b/Items/Placeables/FurnitureVoid/VoidCandelabra.cs index 5b043ce49f..0cde42a6e7 100644 --- a/Items/Placeables/FurnitureVoid/VoidCandelabra.cs +++ b/Items/Placeables/FurnitureVoid/VoidCandelabra.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidCandle.cs b/Items/Placeables/FurnitureVoid/VoidCandle.cs index 5cca74e980..c851a70e67 100644 --- a/Items/Placeables/FurnitureVoid/VoidCandle.cs +++ b/Items/Placeables/FurnitureVoid/VoidCandle.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidChair.cs b/Items/Placeables/FurnitureVoid/VoidChair.cs index f86f544367..4e139c5bb4 100644 --- a/Items/Placeables/FurnitureVoid/VoidChair.cs +++ b/Items/Placeables/FurnitureVoid/VoidChair.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 12; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidChandelier.cs b/Items/Placeables/FurnitureVoid/VoidChandelier.cs index 0a3beac57f..d3fc4d9ae5 100644 --- a/Items/Placeables/FurnitureVoid/VoidChandelier.cs +++ b/Items/Placeables/FurnitureVoid/VoidChandelier.cs @@ -12,27 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Chain); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Chain).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidChest.cs b/Items/Placeables/FurnitureVoid/VoidChest.cs index a611920294..f40b628065 100644 --- a/Items/Placeables/FurnitureVoid/VoidChest.cs +++ b/Items/Placeables/FurnitureVoid/VoidChest.cs @@ -11,27 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.IronBar, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidClock.cs b/Items/Placeables/FurnitureVoid/VoidClock.cs index 679d52d147..ee54e6e95d 100644 --- a/Items/Placeables/FurnitureVoid/VoidClock.cs +++ b/Items/Placeables/FurnitureVoid/VoidClock.cs @@ -11,29 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.SetNameOverride("Void Obelisk"); - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Void Obelisk"); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Glass, 6); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.IronBar, 3).AddIngredient(ItemID.Glass, 6).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidDoor.cs b/Items/Placeables/FurnitureVoid/VoidDoor.cs index e3aa493874..ce5a116fe4 100644 --- a/Items/Placeables/FurnitureVoid/VoidDoor.cs +++ b/Items/Placeables/FurnitureVoid/VoidDoor.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 14; + Item.height = 28; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidDresser.cs b/Items/Placeables/FurnitureVoid/VoidDresser.cs index 19cefccc9f..44a209cc9f 100644 --- a/Items/Placeables/FurnitureVoid/VoidDresser.cs +++ b/Items/Placeables/FurnitureVoid/VoidDresser.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidLamp.cs b/Items/Placeables/FurnitureVoid/VoidLamp.cs index 05b797734e..76f5a6e4ae 100644 --- a/Items/Placeables/FurnitureVoid/VoidLamp.cs +++ b/Items/Placeables/FurnitureVoid/VoidLamp.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidLantern.cs b/Items/Placeables/FurnitureVoid/VoidLantern.cs index 165bfa5d15..cbbaf5f18a 100644 --- a/Items/Placeables/FurnitureVoid/VoidLantern.cs +++ b/Items/Placeables/FurnitureVoid/VoidLantern.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidPiano.cs b/Items/Placeables/FurnitureVoid/VoidPiano.cs index f5b8ed450b..3e699406bc 100644 --- a/Items/Placeables/FurnitureVoid/VoidPiano.cs +++ b/Items/Placeables/FurnitureVoid/VoidPiano.cs @@ -11,27 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 4); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Book); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Bone, 4).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Book).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidSink.cs b/Items/Placeables/FurnitureVoid/VoidSink.cs index 621a0e86dc..a24c83a2f9 100644 --- a/Items/Placeables/FurnitureVoid/VoidSink.cs +++ b/Items/Placeables/FurnitureVoid/VoidSink.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.WaterBucket).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidSofa.cs b/Items/Placeables/FurnitureVoid/VoidSofa.cs index 3cb55dc521..82708d982f 100644 --- a/Items/Placeables/FurnitureVoid/VoidSofa.cs +++ b/Items/Placeables/FurnitureVoid/VoidSofa.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Silk, 2); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Silk, 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidTable.cs b/Items/Placeables/FurnitureVoid/VoidTable.cs index d2d2c94f41..f403a4fd72 100644 --- a/Items/Placeables/FurnitureVoid/VoidTable.cs +++ b/Items/Placeables/FurnitureVoid/VoidTable.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 26; + Item.height = 26; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidWorkbench.cs b/Items/Placeables/FurnitureVoid/VoidWorkbench.cs index 635049c9f6..80c46df77f 100644 --- a/Items/Placeables/FurnitureVoid/VoidWorkbench.cs +++ b/Items/Placeables/FurnitureVoid/VoidWorkbench.cs @@ -11,26 +11,22 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.SetNameOverride("Void Work Bench"); - item.width = 28; - item.height = 14; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.SetNameOverride("Void Work Bench"); + Item.width = 28; + Item.height = 14; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.SetResult(this, 1); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureVoid/VoidstoneSlab.cs b/Items/Placeables/FurnitureVoid/VoidstoneSlab.cs index 6f3c743e0b..dd276f234a 100644 --- a/Items/Placeables/FurnitureVoid/VoidstoneSlab.cs +++ b/Items/Placeables/FurnitureVoid/VoidstoneSlab.cs @@ -13,30 +13,22 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/HardenedAstralSand.cs b/Items/Placeables/HardenedAstralSand.cs index 7860ece387..8f06bf3bcc 100644 --- a/Items/Placeables/HardenedAstralSand.cs +++ b/Items/Placeables/HardenedAstralSand.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(1).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType(), 4).Register(); } } } diff --git a/Items/Placeables/HardenedSulphurousSandstone.cs b/Items/Placeables/HardenedSulphurousSandstone.cs index ce46f8634b..c3cd791fd5 100644 --- a/Items/Placeables/HardenedSulphurousSandstone.cs +++ b/Items/Placeables/HardenedSulphurousSandstone.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(1).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType(), 4).Register(); } } } diff --git a/Items/Placeables/LivingFire/LivingBrimstoneFireBlock.cs b/Items/Placeables/LivingFire/LivingBrimstoneFireBlock.cs index ddbaeba912..fdfe9c45a2 100644 --- a/Items/Placeables/LivingFire/LivingBrimstoneFireBlock.cs +++ b/Items/Placeables/LivingFire/LivingBrimstoneFireBlock.cs @@ -14,30 +14,26 @@ namespace CalamityMod.Items.Placeables.LivingFire public override void SetDefaults() { - item.width = 10; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 10; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void PostUpdate() { - Lighting.AddLight((int)((item.position.X + item.width / 2) / 16f), (int)((item.position.Y + item.height / 2) / 16f), 1f, 0f, 0f); + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 1f, 0f, 0f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LivingFireBlock, 20); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 20); - recipe.AddRecipe(); + CreateRecipe(20).AddIngredient(ItemID.LivingFireBlock, 20).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/LivingFire/LivingGodSlayerFireBlock.cs b/Items/Placeables/LivingFire/LivingGodSlayerFireBlock.cs index c5f042cdb9..fb39894d31 100644 --- a/Items/Placeables/LivingFire/LivingGodSlayerFireBlock.cs +++ b/Items/Placeables/LivingFire/LivingGodSlayerFireBlock.cs @@ -15,30 +15,26 @@ namespace CalamityMod.Items.Placeables.LivingFire public override void SetDefaults() { - item.width = 10; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 10; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void PostUpdate() { - Lighting.AddLight((int)((item.position.X + item.width / 2) / 16f), (int)((item.position.Y + item.height / 2) / 16f), 1f, 0f, 1f); + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 1f, 0f, 1f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LivingFireBlock, 20); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 20); - recipe.AddRecipe(); + CreateRecipe(20).AddIngredient(ItemID.LivingFireBlock, 20).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/LivingFire/LivingHolyFireBlock.cs b/Items/Placeables/LivingFire/LivingHolyFireBlock.cs index a7049a8776..f6cf5fcdd1 100644 --- a/Items/Placeables/LivingFire/LivingHolyFireBlock.cs +++ b/Items/Placeables/LivingFire/LivingHolyFireBlock.cs @@ -15,30 +15,26 @@ namespace CalamityMod.Items.Placeables.LivingFire public override void SetDefaults() { - item.width = 10; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 10; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void PostUpdate() { - Lighting.AddLight((int)((item.position.X + item.width / 2) / 16f), (int)((item.position.Y + item.height / 2) / 16f), 1f, 1f, 0f); + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 1f, 1f, 0f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LivingFireBlock, 20); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 20); - recipe.AddRecipe(); + CreateRecipe(20).AddIngredient(ItemID.LivingFireBlock, 20).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/Navystone.cs b/Items/Placeables/Navystone.cs index 21ec60bf42..27f06e1068 100644 --- a/Items/Placeables/Navystone.cs +++ b/Items/Placeables/Navystone.cs @@ -14,35 +14,23 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/Ores/AerialiteOre.cs b/Items/Placeables/Ores/AerialiteOre.cs index 6728c7cccc..2a614de906 100644 --- a/Items/Placeables/Ores/AerialiteOre.cs +++ b/Items/Placeables/Ores/AerialiteOre.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 6); - item.rare = ItemRarityID.Orange; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 6); + Item.rare = ItemRarityID.Orange; } } } diff --git a/Items/Placeables/Ores/AstralOre.cs b/Items/Placeables/Ores/AstralOre.cs index 7966323619..fe9f8a6f6e 100644 --- a/Items/Placeables/Ores/AstralOre.cs +++ b/Items/Placeables/Ores/AstralOre.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 36); - item.rare = ItemRarityID.Cyan; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 20; + Item.height = 20; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 36); + Item.rare = ItemRarityID.Cyan; } } } diff --git a/Items/Placeables/Ores/AuricOre.cs b/Items/Placeables/Ores/AuricOre.cs index f920a0d970..fa2fff52d1 100644 --- a/Items/Placeables/Ores/AuricOre.cs +++ b/Items/Placeables/Ores/AuricOre.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 10; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 4); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 10; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(gold: 4); + Item.Calamity().customRarity = CalamityRarity.Violet; } } } diff --git a/Items/Placeables/Ores/ChaoticOre.cs b/Items/Placeables/Ores/ChaoticOre.cs index 05f892f685..256b40efc7 100644 --- a/Items/Placeables/Ores/ChaoticOre.cs +++ b/Items/Placeables/Ores/ChaoticOre.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 10; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 24); - item.rare = ItemRarityID.Yellow; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 10; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 24); + Item.rare = ItemRarityID.Yellow; } } } diff --git a/Items/Placeables/Ores/CharredOre.cs b/Items/Placeables/Ores/CharredOre.cs index a92d327ab2..4cd426546e 100644 --- a/Items/Placeables/Ores/CharredOre.cs +++ b/Items/Placeables/Ores/CharredOre.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 12); - item.rare = ItemRarityID.Pink; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 12); + Item.rare = ItemRarityID.Pink; } } } diff --git a/Items/Placeables/Ores/CryonicOre.cs b/Items/Placeables/Ores/CryonicOre.cs index 5b69580343..559be377fc 100644 --- a/Items/Placeables/Ores/CryonicOre.cs +++ b/Items/Placeables/Ores/CryonicOre.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 12); - item.rare = ItemRarityID.Pink; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 12); + Item.rare = ItemRarityID.Pink; } } } diff --git a/Items/Placeables/Ores/ExodiumClusterOre.cs b/Items/Placeables/Ores/ExodiumClusterOre.cs index e07a97465b..0e1d27f457 100644 --- a/Items/Placeables/Ores/ExodiumClusterOre.cs +++ b/Items/Placeables/Ores/ExodiumClusterOre.cs @@ -15,31 +15,23 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 1, silver: 60); - item.rare = ItemRarityID.Red; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(gold: 1, silver: 60); + Item.rare = ItemRarityID.Red; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarOre, 3); - recipe.AddIngredient(ItemID.FragmentStardust); - recipe.AddIngredient(ItemID.FragmentSolar); - recipe.AddIngredient(ItemID.FragmentVortex); - recipe.AddIngredient(ItemID.FragmentNebula); - recipe.SetResult(this); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LunarOre, 3).AddIngredient(ItemID.FragmentStardust).AddIngredient(ItemID.FragmentSolar).AddIngredient(ItemID.FragmentVortex).AddIngredient(ItemID.FragmentNebula).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Placeables/Ores/HallowedOre.cs b/Items/Placeables/Ores/HallowedOre.cs index 1178a42cf0..33a1707f23 100644 --- a/Items/Placeables/Ores/HallowedOre.cs +++ b/Items/Placeables/Ores/HallowedOre.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 12); - item.rare = ItemRarityID.Pink; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 12); + Item.rare = ItemRarityID.Pink; } } } diff --git a/Items/Placeables/Ores/PerennialOre.cs b/Items/Placeables/Ores/PerennialOre.cs index eb630da67f..a181eaf923 100644 --- a/Items/Placeables/Ores/PerennialOre.cs +++ b/Items/Placeables/Ores/PerennialOre.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 12; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 18); - item.rare = ItemRarityID.Lime; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 12; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 18); + Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Placeables/Ores/UelibloomOre.cs b/Items/Placeables/Ores/UelibloomOre.cs index 849d4f9c43..e061a152bf 100644 --- a/Items/Placeables/Ores/UelibloomOre.cs +++ b/Items/Placeables/Ores/UelibloomOre.cs @@ -15,25 +15,25 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 10; - item.height = 10; - item.maxStack = 999; - item.rare = ItemRarityID.Red; - item.value = Item.sellPrice(silver: 50); + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 10; + Item.height = 10; + Item.maxStack = 999; + Item.rare = ItemRarityID.Red; + Item.value = Item.sellPrice(silver: 50); } public override void ModifyTooltips(List list) { foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "ItemName") + if (line2.Mod == "Terraria" && line2.Name == "ItemName") { line2.overrideColor = new Color(0, 255, 200); } diff --git a/Items/Placeables/PerennialBrick.cs b/Items/Placeables/PerennialBrick.cs index beffd22b16..a10c7bdfdb 100644 --- a/Items/Placeables/PerennialBrick.cs +++ b/Items/Placeables/PerennialBrick.cs @@ -12,31 +12,22 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("AnyStoneBlock"); - recipe.SetResult(this, 10); - recipe.AddTile(TileID.Furnaces); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(10).AddIngredient(ModContent.ItemType()).AddRecipeGroup("AnyStoneBlock").AddTile(TileID.Furnaces).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/PlantyMush.cs b/Items/Placeables/PlantyMush.cs index e7964f1b60..2fc7b168f8 100644 --- a/Items/Placeables/PlantyMush.cs +++ b/Items/Placeables/PlantyMush.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 6); - item.rare = ItemRarityID.Orange; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 6); + Item.rare = ItemRarityID.Orange; } public override void CaughtFishStack(ref int stack) diff --git a/Items/Placeables/Plates/Chaosplate.cs b/Items/Placeables/Plates/Chaosplate.cs index b387b742c0..6828206082 100644 --- a/Items/Placeables/Plates/Chaosplate.cs +++ b/Items/Placeables/Plates/Chaosplate.cs @@ -16,33 +16,24 @@ namespace CalamityMod.Items.Placeables.Plates public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 3); - item.rare = ItemRarityID.Orange; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 3); + Item.rare = ItemRarityID.Orange; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ItemID.Obsidian, 3); - recipe.SetResult(this, 3); - recipe.AddTile(TileID.Hellforge); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(3).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ItemID.Obsidian, 3).AddTile(TileID.Hellforge).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Plates/Cinderplate.cs b/Items/Placeables/Plates/Cinderplate.cs index ef9c105f86..53d30c4d2a 100644 --- a/Items/Placeables/Plates/Cinderplate.cs +++ b/Items/Placeables/Plates/Cinderplate.cs @@ -16,33 +16,24 @@ namespace CalamityMod.Items.Placeables.Plates public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 3); - item.rare = ItemRarityID.Orange; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 3); + Item.rare = ItemRarityID.Orange; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ItemID.Obsidian, 3); - recipe.SetResult(this, 3); - recipe.AddTile(TileID.Hellforge); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(3).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ItemID.Obsidian, 3).AddTile(TileID.Hellforge).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Plates/Elumplate.cs b/Items/Placeables/Plates/Elumplate.cs index dad221c1d9..33d637eb4a 100644 --- a/Items/Placeables/Plates/Elumplate.cs +++ b/Items/Placeables/Plates/Elumplate.cs @@ -16,33 +16,24 @@ namespace CalamityMod.Items.Placeables.Plates public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 3); - item.rare = ItemRarityID.Orange; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 3); + Item.rare = ItemRarityID.Orange; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ItemID.Obsidian, 3); - recipe.SetResult(this, 3); - recipe.AddTile(TileID.Hellforge); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(3).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ItemID.Obsidian, 3).AddTile(TileID.Hellforge).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Plates/Navyplate.cs b/Items/Placeables/Plates/Navyplate.cs index d003c62577..6b342a2dd9 100644 --- a/Items/Placeables/Plates/Navyplate.cs +++ b/Items/Placeables/Plates/Navyplate.cs @@ -15,33 +15,24 @@ namespace CalamityMod.Items.Placeables.Plates public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 3); - item.rare = ItemRarityID.Orange; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 3); + Item.rare = ItemRarityID.Orange; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ItemID.Obsidian, 3); - recipe.SetResult(this, 3); - recipe.AddTile(TileID.Hellforge); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(3).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ItemID.Obsidian, 3).AddTile(TileID.Hellforge).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Plates/PlagueContainmentCells.cs b/Items/Placeables/Plates/PlagueContainmentCells.cs index 75339f086a..c773637677 100644 --- a/Items/Placeables/Plates/PlagueContainmentCells.cs +++ b/Items/Placeables/Plates/PlagueContainmentCells.cs @@ -16,33 +16,24 @@ namespace CalamityMod.Items.Placeables.Plates public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 3); - item.rare = ItemRarityID.Orange; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 3); + Item.rare = ItemRarityID.Orange; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ItemID.Obsidian, 3); - recipe.SetResult(this, 3); - recipe.AddTile(TileID.Hellforge); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(3).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ItemID.Obsidian, 3).AddTile(TileID.Hellforge).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/PrismShard.cs b/Items/Placeables/PrismShard.cs index 67a30ff6f3..860136749e 100644 --- a/Items/Placeables/PrismShard.cs +++ b/Items/Placeables/PrismShard.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 3); - item.rare = ItemRarityID.Green; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 3); + Item.rare = ItemRarityID.Green; } } } diff --git a/Items/Placeables/SeaPrism.cs b/Items/Placeables/SeaPrism.cs index 7f4298ace6..9ad12a4437 100644 --- a/Items/Placeables/SeaPrism.cs +++ b/Items/Placeables/SeaPrism.cs @@ -13,27 +13,23 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 10); - item.rare = ItemRarityID.Green; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Green; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Placeables/SulphurousSand.cs b/Items/Placeables/SulphurousSand.cs index 7ac38dbc76..5eff4ad313 100644 --- a/Items/Placeables/SulphurousSand.cs +++ b/Items/Placeables/SulphurousSand.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(1).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType(), 4).Register(); } } } diff --git a/Items/Placeables/SulphurousSandstone.cs b/Items/Placeables/SulphurousSandstone.cs index bb6ee05063..5b36e51659 100644 --- a/Items/Placeables/SulphurousSandstone.cs +++ b/Items/Placeables/SulphurousSandstone.cs @@ -11,26 +11,21 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(1).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType(), 4).Register(); } } } diff --git a/Items/Placeables/Tenebris.cs b/Items/Placeables/Tenebris.cs index c94778d9f9..e72de9ed5a 100644 --- a/Items/Placeables/Tenebris.cs +++ b/Items/Placeables/Tenebris.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 8); - item.rare = ItemRarityID.Lime; + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 8); + Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Placeables/UelibloomBrick.cs b/Items/Placeables/UelibloomBrick.cs index ff9e49eff7..9ac0c94a0f 100644 --- a/Items/Placeables/UelibloomBrick.cs +++ b/Items/Placeables/UelibloomBrick.cs @@ -14,36 +14,23 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("AnyStoneBlock"); - recipe.SetResult(this, 10); - recipe.AddTile(TileID.AdamantiteForge); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(10).AddIngredient(ModContent.ItemType()).AddRecipeGroup("AnyStoneBlock").AddTile(TileID.AdamantiteForge).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/Voidstone.cs b/Items/Placeables/Voidstone.cs index db6a9ef38c..5d94b0eaf1 100644 --- a/Items/Placeables/Voidstone.cs +++ b/Items/Placeables/Voidstone.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/AbyssGravelWallItem.cs b/Items/Placeables/Walls/AbyssGravelWallItem.cs index 37dbd3a637..c80f21b179 100644 --- a/Items/Placeables/Walls/AbyssGravelWallItem.cs +++ b/Items/Placeables/Walls/AbyssGravelWallItem.cs @@ -13,31 +13,22 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 32; - item.height = 32; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 32; + Item.height = 32; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(ModContent.ItemType()); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(this, 4).AddTile(TileID.WorkBenches).ReplaceResult(ModContent.ItemType()); } } } diff --git a/Items/Placeables/Walls/AerialiteBrickWall.cs b/Items/Placeables/Walls/AerialiteBrickWall.cs index 38d0778f73..5439fb1c39 100644 --- a/Items/Placeables/Walls/AerialiteBrickWall.cs +++ b/Items/Placeables/Walls/AerialiteBrickWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/AshenSlabWall.cs b/Items/Placeables/Walls/AshenSlabWall.cs index d4558da685..25b9eb566a 100644 --- a/Items/Placeables/Walls/AshenSlabWall.cs +++ b/Items/Placeables/Walls/AshenSlabWall.cs @@ -13,26 +13,22 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/AstralBrickWall.cs b/Items/Placeables/Walls/AstralBrickWall.cs index 97093d3a49..5292d7f2aa 100644 --- a/Items/Placeables/Walls/AstralBrickWall.cs +++ b/Items/Placeables/Walls/AstralBrickWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/AstralDirtWall.cs b/Items/Placeables/Walls/AstralDirtWall.cs index 13b732276d..9c95c8920b 100644 --- a/Items/Placeables/Walls/AstralDirtWall.cs +++ b/Items/Placeables/Walls/AstralDirtWall.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.createWall = ModContent.WallType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 7; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createWall = ModContent.WallType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(4).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/Walls/AstralFossilWall.cs b/Items/Placeables/Walls/AstralFossilWall.cs index ac98d407a9..a8432c1dbb 100644 --- a/Items/Placeables/Walls/AstralFossilWall.cs +++ b/Items/Placeables/Walls/AstralFossilWall.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.createWall = ModContent.WallType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createWall = ModContent.WallType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(4).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/Walls/AstralGrassWall.cs b/Items/Placeables/Walls/AstralGrassWall.cs index 02a358b4ad..5df69ae4e2 100644 --- a/Items/Placeables/Walls/AstralGrassWall.cs +++ b/Items/Placeables/Walls/AstralGrassWall.cs @@ -13,16 +13,16 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.createWall = ModContent.WallType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createWall = ModContent.WallType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } } } diff --git a/Items/Placeables/Walls/AstralIceWall.cs b/Items/Placeables/Walls/AstralIceWall.cs index dea131be4e..8519714121 100644 --- a/Items/Placeables/Walls/AstralIceWall.cs +++ b/Items/Placeables/Walls/AstralIceWall.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.createWall = ModContent.WallType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createWall = ModContent.WallType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(4).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/Walls/AstralMonolithWall.cs b/Items/Placeables/Walls/AstralMonolithWall.cs index 36f9c4a6ce..7164a80926 100644 --- a/Items/Placeables/Walls/AstralMonolithWall.cs +++ b/Items/Placeables/Walls/AstralMonolithWall.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 4); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType(), 1).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/Walls/AstralSandstoneWall.cs b/Items/Placeables/Walls/AstralSandstoneWall.cs index 8f13f3330e..ac56e5b0fc 100644 --- a/Items/Placeables/Walls/AstralSandstoneWall.cs +++ b/Items/Placeables/Walls/AstralSandstoneWall.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.createWall = ModContent.WallType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createWall = ModContent.WallType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(4).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/Walls/AstralSnowWall.cs b/Items/Placeables/Walls/AstralSnowWall.cs index 46755c10cb..62a615901c 100644 --- a/Items/Placeables/Walls/AstralSnowWall.cs +++ b/Items/Placeables/Walls/AstralSnowWall.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.createWall = ModContent.WallType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createWall = ModContent.WallType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(4).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/Walls/AstralStoneWall.cs b/Items/Placeables/Walls/AstralStoneWall.cs index 04bc91380a..33b90b98b0 100644 --- a/Items/Placeables/Walls/AstralStoneWall.cs +++ b/Items/Placeables/Walls/AstralStoneWall.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.createWall = ModContent.WallType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createWall = ModContent.WallType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(4).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/Walls/BlueBrickWallUnsafe.cs b/Items/Placeables/Walls/BlueBrickWallUnsafe.cs index cc1486a84a..9f978e1f0e 100644 --- a/Items/Placeables/Walls/BlueBrickWallUnsafe.cs +++ b/Items/Placeables/Walls/BlueBrickWallUnsafe.cs @@ -6,16 +6,16 @@ namespace CalamityMod.Items.Placeables.Walls { public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = WallID.BlueDungeonUnsafe; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = WallID.BlueDungeonUnsafe; } } } diff --git a/Items/Placeables/Walls/BlueSlabWallUnsafe.cs b/Items/Placeables/Walls/BlueSlabWallUnsafe.cs index 3e96fc21d9..b2f6a38a68 100644 --- a/Items/Placeables/Walls/BlueSlabWallUnsafe.cs +++ b/Items/Placeables/Walls/BlueSlabWallUnsafe.cs @@ -6,16 +6,16 @@ namespace CalamityMod.Items.Placeables.Walls { public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = WallID.BlueDungeonSlabUnsafe; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = WallID.BlueDungeonSlabUnsafe; } } } diff --git a/Items/Placeables/Walls/BlueTiledWallUnsafe.cs b/Items/Placeables/Walls/BlueTiledWallUnsafe.cs index a67f1d2f53..ddeb4a6558 100644 --- a/Items/Placeables/Walls/BlueTiledWallUnsafe.cs +++ b/Items/Placeables/Walls/BlueTiledWallUnsafe.cs @@ -6,16 +6,16 @@ namespace CalamityMod.Items.Placeables.Walls { public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = WallID.BlueDungeonTileUnsafe; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = WallID.BlueDungeonTileUnsafe; } } } diff --git a/Items/Placeables/Walls/BrimstoneSlagWall.cs b/Items/Placeables/Walls/BrimstoneSlagWall.cs index af2e428daa..a66a55b50c 100644 --- a/Items/Placeables/Walls/BrimstoneSlagWall.cs +++ b/Items/Placeables/Walls/BrimstoneSlagWall.cs @@ -8,25 +8,21 @@ namespace CalamityMod.Items.Placeables.Walls { public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 4); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/ChaosplateWall.cs b/Items/Placeables/Walls/ChaosplateWall.cs index ca91319ed6..1909a4ce1d 100644 --- a/Items/Placeables/Walls/ChaosplateWall.cs +++ b/Items/Placeables/Walls/ChaosplateWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/ChaoticBrickWall.cs b/Items/Placeables/Walls/ChaoticBrickWall.cs index b95d9a77c5..d1e29c3e2b 100644 --- a/Items/Placeables/Walls/ChaoticBrickWall.cs +++ b/Items/Placeables/Walls/ChaoticBrickWall.cs @@ -8,25 +8,21 @@ namespace CalamityMod.Items.Placeables.Walls { public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 4); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/CinderplateWall.cs b/Items/Placeables/Walls/CinderplateWall.cs index 3956151d38..437b21f34e 100644 --- a/Items/Placeables/Walls/CinderplateWall.cs +++ b/Items/Placeables/Walls/CinderplateWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/CosmiliteBrickWall.cs b/Items/Placeables/Walls/CosmiliteBrickWall.cs index b482d874fa..432eebe6d1 100644 --- a/Items/Placeables/Walls/CosmiliteBrickWall.cs +++ b/Items/Placeables/Walls/CosmiliteBrickWall.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/CryonicBrickWall.cs b/Items/Placeables/Walls/CryonicBrickWall.cs index f6b0d9a336..428101c920 100644 --- a/Items/Placeables/Walls/CryonicBrickWall.cs +++ b/Items/Placeables/Walls/CryonicBrickWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs b/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs index 994bf1420d..8e2e3975d9 100644 --- a/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs +++ b/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs index ba1bf5921a..6b71b8636f 100644 --- a/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs index 686097e58c..38472bcf27 100644 --- a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs index 1be0e218b0..77ffe93746 100644 --- a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs index 2620e6c96c..fa3215a8c5 100644 --- a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs b/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs index 4b0b765206..826bd07bc1 100644 --- a/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs +++ b/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs b/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs index 97cdcb63af..2983cae77e 100644 --- a/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs +++ b/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs b/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs index 16cb93a1c1..630c50ca47 100644 --- a/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs +++ b/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls.DraedonStructures public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/ElumplateWall.cs b/Items/Placeables/Walls/ElumplateWall.cs index 3b66790a96..4e5f79d202 100644 --- a/Items/Placeables/Walls/ElumplateWall.cs +++ b/Items/Placeables/Walls/ElumplateWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/EutrophicSandWall.cs b/Items/Placeables/Walls/EutrophicSandWall.cs index 3ba0d230da..8fad646228 100644 --- a/Items/Placeables/Walls/EutrophicSandWall.cs +++ b/Items/Placeables/Walls/EutrophicSandWall.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 4); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/EutrophicSandWallSafe.cs b/Items/Placeables/Walls/EutrophicSandWallSafe.cs index 11483e8c03..1b329aadf8 100644 --- a/Items/Placeables/Walls/EutrophicSandWallSafe.cs +++ b/Items/Placeables/Walls/EutrophicSandWallSafe.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 4); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/ExoPlatingWallItem.cs b/Items/Placeables/Walls/ExoPlatingWallItem.cs index f78d7c7071..2b1f945d88 100644 --- a/Items/Placeables/Walls/ExoPlatingWallItem.cs +++ b/Items/Placeables/Walls/ExoPlatingWallItem.cs @@ -14,25 +14,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/ExoPrismPanelWallItem.cs b/Items/Placeables/Walls/ExoPrismPanelWallItem.cs index e7601ec56f..2dcf0941d1 100644 --- a/Items/Placeables/Walls/ExoPrismPanelWallItem.cs +++ b/Items/Placeables/Walls/ExoPrismPanelWallItem.cs @@ -14,25 +14,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/GreenBrickWallUnsafe.cs b/Items/Placeables/Walls/GreenBrickWallUnsafe.cs index 3a3cf6ceeb..987407fc2f 100644 --- a/Items/Placeables/Walls/GreenBrickWallUnsafe.cs +++ b/Items/Placeables/Walls/GreenBrickWallUnsafe.cs @@ -6,16 +6,16 @@ namespace CalamityMod.Items.Placeables.Walls { public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = WallID.GreenDungeonUnsafe; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = WallID.GreenDungeonUnsafe; } } } diff --git a/Items/Placeables/Walls/GreenSlabWallUnsafe.cs b/Items/Placeables/Walls/GreenSlabWallUnsafe.cs index 240b76f75d..e0de97bea9 100644 --- a/Items/Placeables/Walls/GreenSlabWallUnsafe.cs +++ b/Items/Placeables/Walls/GreenSlabWallUnsafe.cs @@ -6,16 +6,16 @@ namespace CalamityMod.Items.Placeables.Walls { public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = WallID.GreenDungeonSlabUnsafe; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = WallID.GreenDungeonSlabUnsafe; } } } diff --git a/Items/Placeables/Walls/GreenTiledWallUnsafe.cs b/Items/Placeables/Walls/GreenTiledWallUnsafe.cs index 91dc8d687f..a749bec7dc 100644 --- a/Items/Placeables/Walls/GreenTiledWallUnsafe.cs +++ b/Items/Placeables/Walls/GreenTiledWallUnsafe.cs @@ -6,16 +6,16 @@ namespace CalamityMod.Items.Placeables.Walls { public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = WallID.GreenDungeonTileUnsafe; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = WallID.GreenDungeonTileUnsafe; } } } diff --git a/Items/Placeables/Walls/HardenedAstralSandWall.cs b/Items/Placeables/Walls/HardenedAstralSandWall.cs index c6c3f06935..394436b8dc 100644 --- a/Items/Placeables/Walls/HardenedAstralSandWall.cs +++ b/Items/Placeables/Walls/HardenedAstralSandWall.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.createWall = ModContent.WallType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createWall = ModContent.WallType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(4).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs b/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs index df4ab65d7d..259b897a6b 100644 --- a/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs +++ b/Items/Placeables/Walls/HardenedSulphurousSandstoneWall.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.createWall = ModContent.WallType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createWall = ModContent.WallType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(4).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/Walls/NavyplateWall.cs b/Items/Placeables/Walls/NavyplateWall.cs index dae894decd..7491fda1d9 100644 --- a/Items/Placeables/Walls/NavyplateWall.cs +++ b/Items/Placeables/Walls/NavyplateWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/NavystoneWall.cs b/Items/Placeables/Walls/NavystoneWall.cs index fc026ef6bd..22c6215e95 100644 --- a/Items/Placeables/Walls/NavystoneWall.cs +++ b/Items/Placeables/Walls/NavystoneWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 4); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/NavystoneWallSafe.cs b/Items/Placeables/Walls/NavystoneWallSafe.cs index fa6ff7beca..f9ad04298e 100644 --- a/Items/Placeables/Walls/NavystoneWallSafe.cs +++ b/Items/Placeables/Walls/NavystoneWallSafe.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 4); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/OccultStoneWall.cs b/Items/Placeables/Walls/OccultStoneWall.cs index fe0c5b2a03..d6aeeff90c 100644 --- a/Items/Placeables/Walls/OccultStoneWall.cs +++ b/Items/Placeables/Walls/OccultStoneWall.cs @@ -12,26 +12,22 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.SetNameOverride("Otherworldly Stone Wall"); - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.SetNameOverride("Otherworldly Stone Wall"); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/PerennialBrickWall.cs b/Items/Placeables/Walls/PerennialBrickWall.cs index 36e36acf55..3a99428d83 100644 --- a/Items/Placeables/Walls/PerennialBrickWall.cs +++ b/Items/Placeables/Walls/PerennialBrickWall.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/PinkBrickWallUnsafe.cs b/Items/Placeables/Walls/PinkBrickWallUnsafe.cs index 1ebd084c02..18dd1d83ef 100644 --- a/Items/Placeables/Walls/PinkBrickWallUnsafe.cs +++ b/Items/Placeables/Walls/PinkBrickWallUnsafe.cs @@ -6,16 +6,16 @@ namespace CalamityMod.Items.Placeables.Walls { public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = WallID.PinkDungeonUnsafe; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = WallID.PinkDungeonUnsafe; } } } diff --git a/Items/Placeables/Walls/PinkSlabWallUnsafe.cs b/Items/Placeables/Walls/PinkSlabWallUnsafe.cs index 3d4f6f81f3..198e3bf2f1 100644 --- a/Items/Placeables/Walls/PinkSlabWallUnsafe.cs +++ b/Items/Placeables/Walls/PinkSlabWallUnsafe.cs @@ -6,16 +6,16 @@ namespace CalamityMod.Items.Placeables.Walls { public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = WallID.PinkDungeonSlabUnsafe; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = WallID.PinkDungeonSlabUnsafe; } } } diff --git a/Items/Placeables/Walls/PinkTiledWallUnsafe.cs b/Items/Placeables/Walls/PinkTiledWallUnsafe.cs index 2f73deb5c0..3b97af7121 100644 --- a/Items/Placeables/Walls/PinkTiledWallUnsafe.cs +++ b/Items/Placeables/Walls/PinkTiledWallUnsafe.cs @@ -6,16 +6,16 @@ namespace CalamityMod.Items.Placeables.Walls { public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = WallID.PinkDungeonTileUnsafe; + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = WallID.PinkDungeonTileUnsafe; } } } diff --git a/Items/Placeables/Walls/PlagueContainmentCellsWall.cs b/Items/Placeables/Walls/PlagueContainmentCellsWall.cs index 9198d675bc..836c189380 100644 --- a/Items/Placeables/Walls/PlagueContainmentCellsWall.cs +++ b/Items/Placeables/Walls/PlagueContainmentCellsWall.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/PlaguedPlateWall.cs b/Items/Placeables/Walls/PlaguedPlateWall.cs index 8543226234..2b752bc515 100644 --- a/Items/Placeables/Walls/PlaguedPlateWall.cs +++ b/Items/Placeables/Walls/PlaguedPlateWall.cs @@ -14,25 +14,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/Walls/ProfanedCrystalWall.cs b/Items/Placeables/Walls/ProfanedCrystalWall.cs index aaa21daa4c..1424b2f7d3 100644 --- a/Items/Placeables/Walls/ProfanedCrystalWall.cs +++ b/Items/Placeables/Walls/ProfanedCrystalWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/ProfanedRockWall.cs b/Items/Placeables/Walls/ProfanedRockWall.cs index 3cdca800e8..986f0ccd46 100644 --- a/Items/Placeables/Walls/ProfanedRockWall.cs +++ b/Items/Placeables/Walls/ProfanedRockWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/ProfanedSlabWall.cs b/Items/Placeables/Walls/ProfanedSlabWall.cs index fd97b87c70..4bc5a1b95b 100644 --- a/Items/Placeables/Walls/ProfanedSlabWall.cs +++ b/Items/Placeables/Walls/ProfanedSlabWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/RunicProfanedBrickWall.cs b/Items/Placeables/Walls/RunicProfanedBrickWall.cs index 254d803644..d74621e805 100644 --- a/Items/Placeables/Walls/RunicProfanedBrickWall.cs +++ b/Items/Placeables/Walls/RunicProfanedBrickWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/SilvaWall.cs b/Items/Placeables/Walls/SilvaWall.cs index d13ef6d3a4..e4a81f5a2c 100644 --- a/Items/Placeables/Walls/SilvaWall.cs +++ b/Items/Placeables/Walls/SilvaWall.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/Walls/SmoothAbyssGravelWall.cs b/Items/Placeables/Walls/SmoothAbyssGravelWall.cs index c5217f8a42..027c277854 100644 --- a/Items/Placeables/Walls/SmoothAbyssGravelWall.cs +++ b/Items/Placeables/Walls/SmoothAbyssGravelWall.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs b/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs index 35ad3e2e82..758f524025 100644 --- a/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs +++ b/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs @@ -12,26 +12,22 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = ItemRarityID.Orange; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/SmoothNavystoneWall.cs b/Items/Placeables/Walls/SmoothNavystoneWall.cs index df61a4a81f..0f45d353ae 100644 --- a/Items/Placeables/Walls/SmoothNavystoneWall.cs +++ b/Items/Placeables/Walls/SmoothNavystoneWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/SmoothVoidstoneWall.cs b/Items/Placeables/Walls/SmoothVoidstoneWall.cs index 4edad0bc01..fca7fc559c 100644 --- a/Items/Placeables/Walls/SmoothVoidstoneWall.cs +++ b/Items/Placeables/Walls/SmoothVoidstoneWall.cs @@ -14,25 +14,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/Walls/StatigelWall.cs b/Items/Placeables/Walls/StatigelWall.cs index b19e8c6fa4..404ac4660e 100644 --- a/Items/Placeables/Walls/StatigelWall.cs +++ b/Items/Placeables/Walls/StatigelWall.cs @@ -13,25 +13,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/Walls/StratusWall.cs b/Items/Placeables/Walls/StratusWall.cs index 1520125c5e..b4c013ac27 100644 --- a/Items/Placeables/Walls/StratusWall.cs +++ b/Items/Placeables/Walls/StratusWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/SulphurousSandWall.cs b/Items/Placeables/Walls/SulphurousSandWall.cs index 88c2d7d835..a08a55fcf1 100644 --- a/Items/Placeables/Walls/SulphurousSandWall.cs +++ b/Items/Placeables/Walls/SulphurousSandWall.cs @@ -12,27 +12,22 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.createWall = ModContent.WallType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createWall = ModContent.WallType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile( - TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(4).AddTile( + TileID.WorkBenches).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/Walls/SulphurousSandstoneWall.cs b/Items/Placeables/Walls/SulphurousSandstoneWall.cs index 1d63434216..cb9ce829f3 100644 --- a/Items/Placeables/Walls/SulphurousSandstoneWall.cs +++ b/Items/Placeables/Walls/SulphurousSandstoneWall.cs @@ -12,26 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.createWall = ModContent.WallType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; + Item.createWall = ModContent.WallType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.WorkBenches); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - base.AddRecipes(); + CreateRecipe(4).AddTile(TileID.WorkBenches).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/Walls/UelibloomBrickWall.cs b/Items/Placeables/Walls/UelibloomBrickWall.cs index fd8c45eae1..0dcd77f108 100644 --- a/Items/Placeables/Walls/UelibloomBrickWall.cs +++ b/Items/Placeables/Walls/UelibloomBrickWall.cs @@ -12,25 +12,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/Walls/VoidstoneSlabWall.cs b/Items/Placeables/Walls/VoidstoneSlabWall.cs index 50c4307646..91f2783494 100644 --- a/Items/Placeables/Walls/VoidstoneSlabWall.cs +++ b/Items/Placeables/Walls/VoidstoneSlabWall.cs @@ -14,25 +14,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(ModContent.TileType()); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/Walls/VoidstoneWall.cs b/Items/Placeables/Walls/VoidstoneWall.cs index 71e6cb8eed..7e8d0bafd5 100644 --- a/Items/Placeables/Walls/VoidstoneWall.cs +++ b/Items/Placeables/Walls/VoidstoneWall.cs @@ -11,25 +11,21 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.consumable = true; - item.createWall = ModContent.WallType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Potions/Alcohol/BloodyMary.cs b/Items/Potions/Alcohol/BloodyMary.cs index 25d11202b0..96b29033d7 100644 --- a/Items/Potions/Alcohol/BloodyMary.cs +++ b/Items/Potions/Alcohol/BloodyMary.cs @@ -17,19 +17,19 @@ Reduces life regen by 2 and defense by 4%"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Lime; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 2, 60, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Lime; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 2, 60, 0); } } } diff --git a/Items/Potions/Alcohol/CaribbeanRum.cs b/Items/Potions/Alcohol/CaribbeanRum.cs index b33625171e..74a0cc256b 100644 --- a/Items/Potions/Alcohol/CaribbeanRum.cs +++ b/Items/Potions/Alcohol/CaribbeanRum.cs @@ -17,19 +17,19 @@ Makes you floaty and reduces defense by 10%"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Lime; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 5, 30, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Lime; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 5, 30, 0); } } } diff --git a/Items/Potions/Alcohol/CinnamonRoll.cs b/Items/Potions/Alcohol/CinnamonRoll.cs index 2cfccf5dfd..d71b4d387b 100644 --- a/Items/Potions/Alcohol/CinnamonRoll.cs +++ b/Items/Potions/Alcohol/CinnamonRoll.cs @@ -17,19 +17,19 @@ Reduces defense by 10%"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Yellow; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 5, 30, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Yellow; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 5, 30, 0); } } } diff --git a/Items/Potions/Alcohol/Everclear.cs b/Items/Potions/Alcohol/Everclear.cs index a55a89d9d7..910292e7f4 100644 --- a/Items/Potions/Alcohol/Everclear.cs +++ b/Items/Potions/Alcohol/Everclear.cs @@ -17,19 +17,19 @@ Reduces life regen by 10 and defense by 30%"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Lime; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(60f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Lime; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(60f); + Item.value = Item.buyPrice(0, 2, 0, 0); } } } diff --git a/Items/Potions/Alcohol/EvergreenGin.cs b/Items/Potions/Alcohol/EvergreenGin.cs index 44771614fb..13860983fe 100644 --- a/Items/Potions/Alcohol/EvergreenGin.cs +++ b/Items/Potions/Alcohol/EvergreenGin.cs @@ -17,19 +17,19 @@ Reduces life regen by 1"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Lime; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 5, 30, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Lime; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 5, 30, 0); } } } diff --git a/Items/Potions/Alcohol/FabsolsVodka.cs b/Items/Potions/Alcohol/FabsolsVodka.cs index 8a288a5818..5f45661a75 100644 --- a/Items/Potions/Alcohol/FabsolsVodka.cs +++ b/Items/Potions/Alcohol/FabsolsVodka.cs @@ -18,38 +18,25 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.LightRed; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(900f); - item.value = Item.buyPrice(0, 2, 60, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.LightRed; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(900f); + Item.value = Item.buyPrice(0, 2, 60, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Ale); - recipe.AddIngredient(ItemID.PixieDust, 10); - recipe.AddIngredient(ItemID.CrystalShard, 5); - recipe.AddIngredient(ItemID.UnicornHorn); - recipe.AddTile(TileID.Kegs); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Ale); - recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddIngredient(ItemID.CrystalShard); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Ale).AddIngredient(ItemID.PixieDust, 10).AddIngredient(ItemID.CrystalShard, 5).AddIngredient(ItemID.UnicornHorn).AddTile(TileID.Kegs).Register(); + CreateRecipe(1).AddIngredient(ItemID.Ale).AddIngredient(ModContent.ItemType(), 40).AddIngredient(ItemID.CrystalShard).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/Alcohol/Fireball.cs b/Items/Potions/Alcohol/Fireball.cs index bf355aeb40..ebf9bda0bd 100644 --- a/Items/Potions/Alcohol/Fireball.cs +++ b/Items/Potions/Alcohol/Fireball.cs @@ -17,19 +17,19 @@ Reduces life regen by 1"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.LightRed; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.LightRed; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 2, 0, 0); } } } diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index 76f64046df..bea276080f 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -16,20 +16,20 @@ Reduces defense by 3% and movement speed by 5%"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.LightRed; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.healLife = 100; - item.healMana = 100; - item.consumable = true; - item.potion = true; - item.value = Item.buyPrice(0, 0, 20, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.LightRed; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.healLife = 100; + Item.healMana = 100; + Item.consumable = true; + Item.potion = true; + Item.value = Item.buyPrice(0, 0, 20, 0); } public override void OnConsumeItem(Player player) diff --git a/Items/Potions/Alcohol/Margarita.cs b/Items/Potions/Alcohol/Margarita.cs index 3a42797009..8f33b1ba4b 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -21,20 +21,20 @@ Reduces defense by 6% and life regen by 1 public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Lime; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.potion = true; - item.healLife = 200; - item.healMana = 200; - item.value = Item.buyPrice(0, 5, 30, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Lime; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.potion = true; + Item.healLife = 200; + Item.healMana = 200; + Item.value = Item.buyPrice(0, 5, 30, 0); } public override void OnConsumeItem(Player player) diff --git a/Items/Potions/Alcohol/Moonshine.cs b/Items/Potions/Alcohol/Moonshine.cs index eddf626d98..9709c131e6 100644 --- a/Items/Potions/Alcohol/Moonshine.cs +++ b/Items/Potions/Alcohol/Moonshine.cs @@ -17,19 +17,19 @@ Reduces life regen by 1"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Yellow; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 1, 30, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Yellow; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 1, 30, 0); } } } diff --git a/Items/Potions/Alcohol/MoscowMule.cs b/Items/Potions/Alcohol/MoscowMule.cs index 4de86ef284..715cefa961 100644 --- a/Items/Potions/Alcohol/MoscowMule.cs +++ b/Items/Potions/Alcohol/MoscowMule.cs @@ -17,19 +17,19 @@ Reduces life regen by 2"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Yellow; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 5, 30, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Yellow; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 5, 30, 0); } } } diff --git a/Items/Potions/Alcohol/OddMushroom.cs b/Items/Potions/Alcohol/OddMushroom.cs index fde1eb06f6..c03544bc76 100644 --- a/Items/Potions/Alcohol/OddMushroom.cs +++ b/Items/Potions/Alcohol/OddMushroom.cs @@ -17,19 +17,19 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { - item.width = 42; - item.height = 48; - item.useTurn = true; - item.maxStack = 30; - item.useAnimation = 17; - item.useTime = 17; - item.rare = ItemRarityID.LightRed; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item2; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(3600f); - item.value = Item.buyPrice(0, 50, 0, 0); + Item.width = 42; + Item.height = 48; + Item.useTurn = true; + Item.maxStack = 30; + Item.useAnimation = 17; + Item.useTime = 17; + Item.rare = ItemRarityID.LightRed; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item2; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(3600f); + Item.value = Item.buyPrice(0, 50, 0, 0); } } } diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index 30a542e2de..2f3a13fd41 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -16,24 +16,24 @@ Reduces life regen by 1"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.LightRed; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.healLife = 200; - item.consumable = true; - item.potion = true; - item.value = Item.buyPrice(0, 0, 65, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.LightRed; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.healLife = 200; + Item.consumable = true; + Item.potion = true; + Item.value = Item.buyPrice(0, 0, 65, 0); } public override bool CanUseItem(Player player) { - item.healLife = player.Calamity().baguette ? 250 : 200; + Item.healLife = player.Calamity().baguette ? 250 : 200; return base.CanUseItem(player); } diff --git a/Items/Potions/Alcohol/Rum.cs b/Items/Potions/Alcohol/Rum.cs index 0c472adbb2..75e0a9f6ee 100644 --- a/Items/Potions/Alcohol/Rum.cs +++ b/Items/Potions/Alcohol/Rum.cs @@ -17,19 +17,19 @@ Reduces defense by 5%"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.LightRed; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 1, 30, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.LightRed; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 1, 30, 0); } } } diff --git a/Items/Potions/Alcohol/Screwdriver.cs b/Items/Potions/Alcohol/Screwdriver.cs index b01a13cea0..ca580fe093 100644 --- a/Items/Potions/Alcohol/Screwdriver.cs +++ b/Items/Potions/Alcohol/Screwdriver.cs @@ -17,19 +17,19 @@ Reduces life regen by 1"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.LightPurple; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 4, 0, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.LightPurple; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 4, 0, 0); } } } diff --git a/Items/Potions/Alcohol/StarBeamRye.cs b/Items/Potions/Alcohol/StarBeamRye.cs index 3330e66f9c..40cc074b4d 100644 --- a/Items/Potions/Alcohol/StarBeamRye.cs +++ b/Items/Potions/Alcohol/StarBeamRye.cs @@ -18,19 +18,19 @@ Reduces defense by 6% and life regen by 1"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Lime; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 4, 0, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Lime; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 4, 0, 0); } } } diff --git a/Items/Potions/Alcohol/Tequila.cs b/Items/Potions/Alcohol/Tequila.cs index 6793fb7a9a..95da5c6e31 100644 --- a/Items/Potions/Alcohol/Tequila.cs +++ b/Items/Potions/Alcohol/Tequila.cs @@ -17,19 +17,19 @@ Reduces life regen by 1"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.LightRed; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 1, 30, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.LightRed; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 1, 30, 0); } } } diff --git a/Items/Potions/Alcohol/TequilaSunrise.cs b/Items/Potions/Alcohol/TequilaSunrise.cs index 16d6e23710..a306b2d5c1 100644 --- a/Items/Potions/Alcohol/TequilaSunrise.cs +++ b/Items/Potions/Alcohol/TequilaSunrise.cs @@ -17,19 +17,19 @@ Reduces life regen by 1"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Yellow; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 6, 60, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Yellow; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 6, 60, 0); } } } diff --git a/Items/Potions/Alcohol/Vodka.cs b/Items/Potions/Alcohol/Vodka.cs index d247979bef..77e6c60e34 100644 --- a/Items/Potions/Alcohol/Vodka.cs +++ b/Items/Potions/Alcohol/Vodka.cs @@ -17,19 +17,19 @@ Reduces life regen by 1 and defense by 5%"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.LightPurple; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 1, 30, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.LightPurple; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 1, 30, 0); } } } diff --git a/Items/Potions/Alcohol/Whiskey.cs b/Items/Potions/Alcohol/Whiskey.cs index 5eeaece951..6b503c2341 100644 --- a/Items/Potions/Alcohol/Whiskey.cs +++ b/Items/Potions/Alcohol/Whiskey.cs @@ -17,19 +17,19 @@ Reduces defense by 5%"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.LightRed; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 1, 30, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.LightRed; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 1, 30, 0); } } } diff --git a/Items/Potions/Alcohol/WhiteWine.cs b/Items/Potions/Alcohol/WhiteWine.cs index 115a68b157..9e8280febe 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -18,23 +18,23 @@ Reduces defense by 6% and life regen by 1"); public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.LightPurple; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.healMana = 400; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(300f); - item.value = Item.buyPrice(0, 4, 0, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.LightPurple; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.healMana = 400; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(300f); + Item.value = Item.buyPrice(0, 4, 0, 0); } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (PlayerInput.Triggers.JustPressed.QuickBuff) { diff --git a/Items/Potions/AnechoicCoating.cs b/Items/Potions/AnechoicCoating.cs index 2f3f3b505c..bd01fd5be9 100644 --- a/Items/Potions/AnechoicCoating.cs +++ b/Items/Potions/AnechoicCoating.cs @@ -16,29 +16,24 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Blue; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(240f); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(240f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/AstralInjection.cs b/Items/Potions/AstralInjection.cs index 3b10f5ab58..fe2eb36618 100644 --- a/Items/Potions/AstralInjection.cs +++ b/Items/Potions/AstralInjection.cs @@ -17,19 +17,19 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Lime; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(5f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Lime; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(5f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void OnConsumeItem(Player player) @@ -48,22 +48,8 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.alchemy = true; - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - // Blood orb recipes don't get the alchemy table effect - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 4); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this, 8); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ItemID.BottledWater, 4).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(8).AddIngredient(ItemID.BottledWater, 4).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/AstralJelly.cs b/Items/Potions/AstralJelly.cs index 17b55bc7a5..c522db9dfb 100644 --- a/Items/Potions/AstralJelly.cs +++ b/Items/Potions/AstralJelly.cs @@ -15,23 +15,23 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.useAnimation = 17; - item.useTime = 17; - item.rare = ItemRarityID.Lime; - item.useStyle = ItemUseStyleID.EatingUsing; - item.healMana = 200; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.value = Item.buyPrice(0, 4, 50, 0); - item.buffType = BuffID.MagicPower; - item.buffTime = CalamityUtils.SecondsToFrames(360f); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.useAnimation = 17; + Item.useTime = 17; + Item.rare = ItemRarityID.Lime; + Item.useStyle = ItemUseStyleID.EatFood; + Item.healMana = 200; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.value = Item.buyPrice(0, 4, 50, 0); + Item.buffType = BuffID.MagicPower; + Item.buffTime = CalamityUtils.SecondsToFrames(360f); } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (PlayerInput.Triggers.JustPressed.QuickBuff) { diff --git a/Items/Potions/Baguette.cs b/Items/Potions/Baguette.cs index c9735f2da2..67b71ec2f3 100644 --- a/Items/Potions/Baguette.cs +++ b/Items/Potions/Baguette.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.useTurn = true; - item.maxStack = 30; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item2; - item.consumable = true; + Item.width = 26; + Item.height = 26; + Item.useTurn = true; + Item.maxStack = 30; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item2; + Item.consumable = true; - item.value = Item.sellPrice(silver: 1); - item.rare = ItemRarityID.Blue; - item.Calamity().donorItem = true; + Item.value = Item.sellPrice(silver: 1); + Item.rare = ItemRarityID.Blue; + Item.Calamity().donorItem = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(300f); + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(300f); } public override void OnConsumeItem(Player player) @@ -44,11 +44,7 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Hay, 10); - recipe.AddTile(TileID.Furnaces); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Hay, 10).AddTile(TileID.Furnaces).Register(); } } } diff --git a/Items/Potions/BoundingPotion.cs b/Items/Potions/BoundingPotion.cs index 444b4a5679..913952438e 100644 --- a/Items/Potions/BoundingPotion.cs +++ b/Items/Potions/BoundingPotion.cs @@ -16,36 +16,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Blue; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(300f); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(300f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ItemID.Frog); - recipe.AddIngredient(ItemID.Vine); - recipe.AddTile(TileID.Bottles); - recipe.SetResult(this, 3); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(3).AddIngredient(ItemID.BottledWater).AddIngredient(ItemID.Frog).AddIngredient(ItemID.Vine).AddTile(TileID.Bottles).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/CadencePotion.cs b/Items/Potions/CadencePotion.cs index b13ac9ca1a..55cb34e7ca 100644 --- a/Items/Potions/CadencePotion.cs +++ b/Items/Potions/CadencePotion.cs @@ -18,37 +18,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 38; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Orange; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.rare = ItemRarityID.LightRed; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 28; + Item.height = 38; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Orange; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.rare = ItemRarityID.LightRed; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LovePotion); - recipe.AddIngredient(ItemID.HeartreachPotion); - recipe.AddIngredient(ItemID.LifeforcePotion); - recipe.AddIngredient(ItemID.RegenerationPotion); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LovePotion).AddIngredient(ItemID.HeartreachPotion).AddIngredient(ItemID.LifeforcePotion).AddIngredient(ItemID.RegenerationPotion).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 40).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/CalamitasBrew.cs b/Items/Potions/CalamitasBrew.cs index 5154e47971..b39a055c45 100644 --- a/Items/Potions/CalamitasBrew.cs +++ b/Items/Potions/CalamitasBrew.cs @@ -18,37 +18,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Lime; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(900f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 30; + Item.height = 30; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Lime; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(900f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.ImbuingStation); - recipe.SetResult(this, 3); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.ImbuingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(3).AddIngredient(ItemID.BottledWater, 3).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.ImbuingStation).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType()).AddTile(TileID.ImbuingStation).Register(); } } } diff --git a/Items/Potions/CalciumPotion.cs b/Items/Potions/CalciumPotion.cs index a393632482..515f9c8390 100644 --- a/Items/Potions/CalciumPotion.cs +++ b/Items/Potions/CalciumPotion.cs @@ -16,35 +16,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Blue; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(900f); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(900f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Bottles); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType()).AddTile(TileID.Bottles).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/CeaselessHungerPotion.cs b/Items/Potions/CeaselessHungerPotion.cs index eceb1fd13b..84230b3b36 100644 --- a/Items/Potions/CeaselessHungerPotion.cs +++ b/Items/Potions/CeaselessHungerPotion.cs @@ -16,40 +16,26 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(10f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(10f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.alchemy = true; - recipe.SetResult(this, 4); - recipe.AddRecipe(); - // Blood orb recipes don't get the Alchemy table effect - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 4); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this, 4); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ItemID.BottledWater, 4).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(4).AddIngredient(ItemID.BottledWater, 4).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/CrumblingPotion.cs b/Items/Potions/CrumblingPotion.cs index 7aed85d396..5e03db10fc 100644 --- a/Items/Potions/CrumblingPotion.cs +++ b/Items/Potions/CrumblingPotion.cs @@ -17,38 +17,24 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.LightRed; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.alchemy = true; - recipe.SetResult(this, 5); - recipe.AddRecipe(); - // Blood Orb recipes don't get the Alchemy Table effect - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(5).AddIngredient(ItemID.BottledWater, 5).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/DeliciousMeat.cs b/Items/Potions/DeliciousMeat.cs index 6b67cbf74e..4e781e6be2 100644 --- a/Items/Potions/DeliciousMeat.cs +++ b/Items/Potions/DeliciousMeat.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Potions } public override void SetDefaults() { - item.width = 32; - item.height = 30; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = ItemRarityID.Pink; - item.maxStack = 30; - item.consumable = true; - item.useAnimation = 17; - item.useTime = 17; - item.UseSound = SoundID.Item2; - item.useStyle = ItemUseStyleID.EatingUsing; - item.useTurn = true; - item.buffType = BuffID.WellFed; - item.buffTime = CalamityUtils.SecondsToFrames(1800f); + Item.width = 32; + Item.height = 30; + Item.value = Item.buyPrice(0, 0, 50, 0); + Item.rare = ItemRarityID.Pink; + Item.maxStack = 30; + Item.consumable = true; + Item.useAnimation = 17; + Item.useTime = 17; + Item.UseSound = SoundID.Item2; + Item.useStyle = ItemUseStyleID.EatFood; + Item.useTurn = true; + Item.buffType = BuffID.WellFed; + Item.buffTime = CalamityUtils.SecondsToFrames(1800f); } } } diff --git a/Items/Potions/DraconicElixir.cs b/Items/Potions/DraconicElixir.cs index 5f22d39f6a..9e2fe7b451 100644 --- a/Items/Potions/DraconicElixir.cs +++ b/Items/Potions/DraconicElixir.cs @@ -22,58 +22,42 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 50; - item.height = 44; - item.useTurn = true; - item.maxStack = 30; - item.Calamity().customRarity = CalamityRarity.Violet; - item.rare = ItemRarityID.Purple; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 50; + Item.height = 44; + Item.useTurn = true; + Item.maxStack = 30; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ItemRarityID.Purple; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override bool CanUseItem(Player player) => !player.HasCooldown(Cooldowns.DraconicElixir.ID); public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Potions/DraconicElixir_Animated"); - spriteBatch.Draw(texture, position, item.GetCurrentFrame(ref frame, ref frameCounter, 8, 10), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Potions/DraconicElixir_Animated"); + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 8, 10), Color.White, 0f, origin, scale, SpriteEffects.None, 0); return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Potions/DraconicElixir_Animated"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 8, 10), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Potions/DraconicElixir_Animated"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 8, 10), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Daybloom); - recipe.AddIngredient(ItemID.Moonglow); - recipe.AddIngredient(ItemID.Fireblossom); - recipe.AddTile(TileID.AlchemyTable); - recipe.alchemy = true; - recipe.SetResult(this); - recipe.AddRecipe(); - // Blood orb recipes don't get the Alchemy Table effect - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Daybloom).AddIngredient(ItemID.Moonglow).AddIngredient(ItemID.Fireblossom).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 50).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/GravityNormalizerPotion.cs b/Items/Potions/GravityNormalizerPotion.cs index 2d6e15e32a..cb043470e3 100644 --- a/Items/Potions/GravityNormalizerPotion.cs +++ b/Items/Potions/GravityNormalizerPotion.cs @@ -17,39 +17,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Lime; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Lime; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GravitationPotion); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.alchemy = true; - recipe.SetResult(this); - recipe.AddRecipe(); - // Blood orb recipes don't get the Alchemy Table effect - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.GravitationPotion).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/HolyWrathPotion.cs b/Items/Potions/HolyWrathPotion.cs index 224933323a..e1258ac960 100644 --- a/Items/Potions/HolyWrathPotion.cs +++ b/Items/Potions/HolyWrathPotion.cs @@ -17,39 +17,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 44; - item.height = 36; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Purple; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(300f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 44; + Item.height = 36; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Purple; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(300f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WrathPotion); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.alchemy = true; - recipe.SetResult(this); - recipe.AddRecipe(); - // Blood orb recipes don't get the alchemy table effect - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.WrathPotion).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 40).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/OmegaHealingPotion.cs b/Items/Potions/OmegaHealingPotion.cs index 363268ee70..db967a439b 100644 --- a/Items/Potions/OmegaHealingPotion.cs +++ b/Items/Potions/OmegaHealingPotion.cs @@ -15,30 +15,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 24; - item.height = 32; - item.useTurn = true; - item.maxStack = 30; - item.healLife = 300; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.potion = true; - item.value = Item.buyPrice(0, 7, 0, 0); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 24; + Item.height = 32; + Item.useTurn = true; + Item.maxStack = 30; + Item.healLife = 300; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.potion = true; + Item.value = Item.buyPrice(0, 7, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Potions/PenumbraPotion.cs b/Items/Potions/PenumbraPotion.cs index 8f33a27e07..12b6dbe613 100644 --- a/Items/Potions/PenumbraPotion.cs +++ b/Items/Potions/PenumbraPotion.cs @@ -18,39 +18,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 26; - item.height = 30; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Lime; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 26; + Item.height = 30; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Lime; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.LunarTabletFragment); - recipe.AddTile(TileID.AlchemyTable); - recipe.alchemy = true; - recipe.SetResult(this); - recipe.AddRecipe(); - // Blood orb recipes don't get the Alchemy Table effect - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.LunarTabletFragment).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 30).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/PhotosynthesisPotion.cs b/Items/Potions/PhotosynthesisPotion.cs index bd704521b4..ad8cf1487f 100644 --- a/Items/Potions/PhotosynthesisPotion.cs +++ b/Items/Potions/PhotosynthesisPotion.cs @@ -17,39 +17,24 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.LightRed; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.alchemy = true; - recipe.SetResult(this); - recipe.AddRecipe(); - // Blood orb recipes don't get the alchemy table effect - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 40).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/PotionofOmniscience.cs b/Items/Potions/PotionofOmniscience.cs index 95a3244c7e..0238b87ba1 100644 --- a/Items/Potions/PotionofOmniscience.cs +++ b/Items/Potions/PotionofOmniscience.cs @@ -17,36 +17,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Orange; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(900f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Orange; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(900f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HunterPotion); - recipe.AddIngredient(ItemID.SpelunkerPotion); - recipe.AddIngredient(ItemID.TrapsightPotion); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HunterPotion).AddIngredient(ItemID.SpelunkerPotion).AddIngredient(ItemID.TrapsightPotion).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/ProfanedRagePotion.cs b/Items/Potions/ProfanedRagePotion.cs index c0aada37fa..86c07b9f75 100644 --- a/Items/Potions/ProfanedRagePotion.cs +++ b/Items/Potions/ProfanedRagePotion.cs @@ -17,39 +17,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 34; - item.height = 42; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Purple; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(300f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 34; + Item.height = 42; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Purple; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(300f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RagePotion); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.alchemy = true; - recipe.SetResult(this); - recipe.AddRecipe(); - // Blood orb recipe = no alchemy table effect - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RagePotion).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 40).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/PurifiedJam.cs b/Items/Potions/PurifiedJam.cs index 681b4919c8..cb4223fe58 100644 --- a/Items/Potions/PurifiedJam.cs +++ b/Items/Potions/PurifiedJam.cs @@ -20,17 +20,17 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Orange; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Orange; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void ModifyTooltips(List list) @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Potions { foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip0") { line2.text = "Makes you immune to all damage and most debuffs for 5 seconds"; } @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Potions return player.FindBuffIndex(BuffID.PotionSickness) == -1; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { player.AddBuff(ModContent.BuffType(), (CalamityWorld.death || BossRushEvent.BossRushActive) ? 300 : 600); player.AddBuff(BuffID.PotionSickness, player.pStone ? 1500 : 1800); diff --git a/Items/Potions/RevivifyPotion.cs b/Items/Potions/RevivifyPotion.cs index 55ff9260f8..9e353d301a 100644 --- a/Items/Potions/RevivifyPotion.cs +++ b/Items/Potions/RevivifyPotion.cs @@ -17,40 +17,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 36; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Orange; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.LightRed; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(180f); + Item.width = 28; + Item.height = 36; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Orange; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(180f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HolyWater, 5); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.CrystalShard, 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.alchemy = true; - recipe.SetResult(this, 5); - recipe.AddRecipe(); - // Blood orb recipes no alch table effect - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HolyWater, 5); - recipe.AddIngredient(ModContent.ItemType(), 100); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this, 5); - recipe.AddRecipe(); + CreateRecipe(5).AddIngredient(ItemID.HolyWater, 5).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.CrystalShard, 5).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(5).AddIngredient(ItemID.HolyWater, 5).AddIngredient(ModContent.ItemType(), 100).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/ShadowPotion.cs b/Items/Potions/ShadowPotion.cs index 00685b6663..a53924e59d 100644 --- a/Items/Potions/ShadowPotion.cs +++ b/Items/Potions/ShadowPotion.cs @@ -20,37 +20,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Orange; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Orange; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.InvisibilityPotion); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.alchemy = true; - recipe.SetResult(this, 2); - recipe.AddRecipe(); - // blood orb recipes no alch table effect - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ItemID.InvisibilityPotion).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/ShatteringPotion.cs b/Items/Potions/ShatteringPotion.cs index 22ca491545..857728435b 100644 --- a/Items/Potions/ShatteringPotion.cs +++ b/Items/Potions/ShatteringPotion.cs @@ -18,38 +18,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Yellow; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Yellow; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.BeetleHusk); - recipe.AddTile(TileID.AlchemyTable); - recipe.alchemy = true; - recipe.SetResult(this); - recipe.AddRecipe(); - // Blood Orb recipes don't get the alchemy table effect - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddIngredient(ItemID.BeetleHusk); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.BeetleHusk).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 30).AddIngredient(ItemID.BeetleHusk).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/SoaringPotion.cs b/Items/Potions/SoaringPotion.cs index 871ea15cc8..17149fd0f6 100644 --- a/Items/Potions/SoaringPotion.cs +++ b/Items/Potions/SoaringPotion.cs @@ -19,39 +19,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Orange; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.LightRed; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(360f); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Orange; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(360f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ItemID.SoulofFlight); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.alchemy = true; - recipe.SetResult(this); - recipe.AddRecipe(); - // Blood orb recipes don't get the alchemy table effect - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddIngredient(ItemID.SoulofFlight); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ItemID.SoulofFlight).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 30).AddIngredient(ItemID.SoulofFlight).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/SulphurskinPotion.cs b/Items/Potions/SulphurskinPotion.cs index 369c0d271c..71ee91af0f 100644 --- a/Items/Potions/SulphurskinPotion.cs +++ b/Items/Potions/SulphurskinPotion.cs @@ -18,36 +18,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Green; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(150f); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Green; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(150f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 15); //possibly add herbs if added to sulph sea - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.Bottles); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.Bottles).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/SunkenStew.cs b/Items/Potions/SunkenStew.cs index d726e64f8f..55ab4eaef6 100644 --- a/Items/Potions/SunkenStew.cs +++ b/Items/Potions/SunkenStew.cs @@ -22,20 +22,20 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.useAnimation = 17; - item.useTime = 17; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.potion = true; - item.healLife = 120; - item.healMana = 150; + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.useAnimation = 17; + Item.useTime = 17; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.potion = true; + Item.healLife = 120; + Item.healMana = 150; } public override void ModifyTooltips(List list) @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Potions { foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip0") { line2.text = "Only gives 37 seconds of Potion Sickness"; } @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Potions return player.potionDelay <= 0 && player.Calamity().potionTimer <= 0; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { player.AddBuff(BuffType, BuffDuration); // fixes hardcoded potion sickness duration from quick heal (see CalamityPlayerMiscEffects.cs) @@ -67,22 +67,8 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Honeyfin); - recipe.AddIngredient(ItemID.Bowl, 2); - recipe.AddTile(TileID.CookingPots); - recipe.SetResult(this, 2); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Honeyfin); - recipe.AddIngredient(ItemID.Bowl, 2); - recipe.AddTile(TileID.CookingPots); - recipe.SetResult(this, 2); - recipe.AddRecipe(); + CreateRecipe(2).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Honeyfin).AddIngredient(ItemID.Bowl, 2).AddTile(TileID.CookingPots).Register(); + CreateRecipe(2).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Honeyfin).AddIngredient(ItemID.Bowl, 2).AddTile(TileID.CookingPots).Register(); } } } diff --git a/Items/Potions/SupremeHealingPotion.cs b/Items/Potions/SupremeHealingPotion.cs index af35a115f3..aca391854b 100644 --- a/Items/Potions/SupremeHealingPotion.cs +++ b/Items/Potions/SupremeHealingPotion.cs @@ -14,29 +14,24 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.healLife = 250; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.potion = true; - item.rare = ItemRarityID.Purple; - item.value = Item.buyPrice(0, 6, 50, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.healLife = 250; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.potion = true; + Item.rare = ItemRarityID.Purple; + Item.value = Item.buyPrice(0, 6, 50, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SuperHealingPotion); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SuperHealingPotion).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Potions/SupremeManaPotion.cs b/Items/Potions/SupremeManaPotion.cs index 59b7991aa3..f483244cdf 100644 --- a/Items/Potions/SupremeManaPotion.cs +++ b/Items/Potions/SupremeManaPotion.cs @@ -14,28 +14,23 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.healMana = 400; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.rare = ItemRarityID.Purple; - item.value = Item.buyPrice(0, 6, 50, 0); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 999; + Item.healMana = 400; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.rare = ItemRarityID.Purple; + Item.value = Item.buyPrice(0, 6, 50, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SuperManaPotion); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SuperManaPotion).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Potions/TeslaPotion.cs b/Items/Potions/TeslaPotion.cs index 0a6eceea06..dc602514f8 100644 --- a/Items/Potions/TeslaPotion.cs +++ b/Items/Potions/TeslaPotion.cs @@ -20,37 +20,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 24; - item.height = 26; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Orange; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 24; + Item.height = 26; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Orange; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Bottles); - recipe.SetResult(this, 5); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(5).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddTile(TileID.Bottles).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/TitanScalePotion.cs b/Items/Potions/TitanScalePotion.cs index 796eca82b7..61d4c44c5c 100644 --- a/Items/Potions/TitanScalePotion.cs +++ b/Items/Potions/TitanScalePotion.cs @@ -18,39 +18,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 24; - item.height = 34; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Yellow; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(480f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 24; + Item.height = 34; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Yellow; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(480f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitanPotion, 4); - recipe.AddIngredient(ItemID.BeetleHusk); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.alchemy = true; - recipe.SetResult(this, 4); - recipe.AddRecipe(); - // Alch table effect not on blood orb recipes - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 4); - recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddIngredient(ItemID.BeetleHusk); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this, 4); - recipe.AddRecipe(); + CreateRecipe(4).AddIngredient(ItemID.TitanPotion, 4).AddIngredient(ItemID.BeetleHusk).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(4).AddIngredient(ItemID.BottledWater, 4).AddIngredient(ModContent.ItemType(), 40).AddIngredient(ItemID.BeetleHusk).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/TriumphPotion.cs b/Items/Potions/TriumphPotion.cs index 66579d45b2..c79dae2844 100644 --- a/Items/Potions/TriumphPotion.cs +++ b/Items/Potions/TriumphPotion.cs @@ -16,35 +16,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(240f); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(240f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.Bottles); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.Bottles).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 30).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/YharimsStimulants.cs b/Items/Potions/YharimsStimulants.cs index 824857815f..bb9987285c 100644 --- a/Items/Potions/YharimsStimulants.cs +++ b/Items/Potions/YharimsStimulants.cs @@ -16,38 +16,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 40; - item.height = 40; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Orange; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(1800f); - item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 40; + Item.height = 40; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Orange; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.UseSound = SoundID.Item3; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(1800f); + Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyFood"); - recipe.AddIngredient(ItemID.EndurancePotion); - recipe.AddIngredient(ItemID.IronskinPotion); - recipe.AddIngredient(ItemID.SwiftnessPotion); - recipe.AddIngredient(ItemID.TitanPotion); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyFood").AddIngredient(ItemID.EndurancePotion).AddIngredient(ItemID.IronskinPotion).AddIngredient(ItemID.SwiftnessPotion).AddIngredient(ItemID.TitanPotion).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 50).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/ZenPotion.cs b/Items/Potions/ZenPotion.cs index 2dbf837856..fba1f3f064 100644 --- a/Items/Potions/ZenPotion.cs +++ b/Items/Potions/ZenPotion.cs @@ -16,42 +16,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Orange; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.LightRed; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(900f); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Orange; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(900f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.alchemy = true; - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.PinkGel); - recipe.AddIngredient(ItemID.Daybloom); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - - // Alternative recipe is not "alchemy" because none of the blood orb recipes are - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.PinkGel).AddIngredient(ItemID.Daybloom).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Potions/ZergPotion.cs b/Items/Potions/ZergPotion.cs index 3a34465f6e..dd30717c8e 100644 --- a/Items/Potions/ZergPotion.cs +++ b/Items/Potions/ZergPotion.cs @@ -16,41 +16,25 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = ItemRarityID.Orange; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.LightRed; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = CalamityUtils.SecondsToFrames(900f); + Item.width = 28; + Item.height = 18; + Item.useTurn = true; + Item.maxStack = 30; + Item.rare = ItemRarityID.Orange; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.EatFood; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.consumable = true; + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(900f); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.alchemy = true; - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - - // Alternative recipe is not "alchemy" because none of the blood orb recipes are - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType()).AddTile(TileID.AlchemyTable).Register(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/RelicOfConvergence.cs b/Items/RelicOfConvergence.cs index 31fff277d7..a9fd8e9387 100644 --- a/Items/RelicOfConvergence.cs +++ b/Items/RelicOfConvergence.cs @@ -17,20 +17,20 @@ namespace CalamityMod.Items public override void SetDefaults() { - item.width = 32; - item.height = 46; - item.useTime = item.useAnimation = 25; - item.reuseDelay = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.DD2_DarkMageCastHeal; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.shoot = ModContent.ProjectileType(); + Item.width = 32; + Item.height = 46; + Item.useTime = Item.useAnimation = 25; + Item.reuseDelay = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.DD2_DarkMageCastHeal; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.shoot = ModContent.ProjectileType(); } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; } } diff --git a/Items/Rock.cs b/Items/Rock.cs index 15d49b2633..9afde7c7af 100644 --- a/Items/Rock.cs +++ b/Items/Rock.cs @@ -15,16 +15,16 @@ namespace CalamityMod.Items public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 0, 0, 1); - item.createTile = ModContent.TileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; + Item.width = 20; + Item.height = 20; + Item.value = Item.buyPrice(0, 0, 0, 1); + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; } } } diff --git a/Items/SirenproofEarMuffs.cs b/Items/SirenproofEarMuffs.cs index 3ec928eddc..6598360a6d 100644 --- a/Items/SirenproofEarMuffs.cs +++ b/Items/SirenproofEarMuffs.cs @@ -14,26 +14,21 @@ namespace CalamityMod.Items } public override void SetDefaults() { - item.width = 44; - item.height = 34; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; + Item.width = 44; + Item.height = 34; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; } public override void UpdateInventory(Player player) { - if (item.favorited) + if (Item.favorited) player.Calamity().disableAnahitaSpawns = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Silk, 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/SummonItems/Abomination.cs b/Items/SummonItems/Abomination.cs index 008dd5e187..f150136e2c 100644 --- a/Items/SummonItems/Abomination.cs +++ b/Items/SummonItems/Abomination.cs @@ -4,6 +4,7 @@ using CalamityMod.NPCs.PlaguebringerGoliath; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -19,13 +20,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.rare = ItemRarityID.Yellow; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 28; + Item.height = 18; + Item.rare = ItemRarityID.Yellow; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -33,7 +34,7 @@ namespace CalamityMod.Items.SummonItems return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -46,15 +47,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.IronBar, 8); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Stinger, 5); - recipe.AddIngredient(ItemID.Obsidian, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.IronBar, 8).AddIngredient(ItemID.Stinger, 5).AddIngredient(ItemID.Obsidian, 3).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/SummonItems/AncientMedallion.cs b/Items/SummonItems/AncientMedallion.cs index c8227d26bc..ad92bcf874 100644 --- a/Items/SummonItems/AncientMedallion.cs +++ b/Items/SummonItems/AncientMedallion.cs @@ -3,6 +3,7 @@ using CalamityMod.NPCs.Ravager; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { public class AncientMedallion : ModItem @@ -17,13 +18,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Yellow; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Yellow; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -31,7 +32,7 @@ namespace CalamityMod.Items.SummonItems return !NPC.AnyNPCs(ModContent.NPCType()) && player.ZoneOverworldHeight && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 2); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -48,12 +49,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarTabletFragment, 15); - recipe.AddIngredient(ItemID.LihzahrdBrick, 25); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LunarTabletFragment, 15).AddIngredient(ItemID.LihzahrdBrick, 25).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/SummonItems/AstralChunk.cs b/Items/SummonItems/AstralChunk.cs index 8eee1f7f57..556d5fb628 100644 --- a/Items/SummonItems/AstralChunk.cs +++ b/Items/SummonItems/AstralChunk.cs @@ -4,6 +4,7 @@ using CalamityMod.NPCs.AstrumAureus; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -18,13 +19,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Lime; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Lime; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -32,7 +33,7 @@ namespace CalamityMod.Items.SummonItems return !Main.dayTime && player.Calamity().ZoneAstral && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -49,12 +50,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddIngredient(ItemID.FallenStar, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 30).AddIngredient(ItemID.FallenStar, 20).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/SummonItems/BirbPheromones.cs b/Items/SummonItems/BirbPheromones.cs index 29551e26e4..3f9aedd359 100644 --- a/Items/SummonItems/BirbPheromones.cs +++ b/Items/SummonItems/BirbPheromones.cs @@ -4,6 +4,7 @@ using CalamityMod.NPCs.Bumblebirb; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -19,13 +20,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.rare = ItemRarityID.Red; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 28; + Item.height = 18; + Item.rare = ItemRarityID.Red; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -33,7 +34,7 @@ namespace CalamityMod.Items.SummonItems return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -46,12 +47,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.FragmentSolar, 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.FragmentSolar, 20).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/SummonItems/BlightedEyeball.cs b/Items/SummonItems/BlightedEyeball.cs index 2439f1272c..fe0a097a86 100644 --- a/Items/SummonItems/BlightedEyeball.cs +++ b/Items/SummonItems/BlightedEyeball.cs @@ -4,6 +4,7 @@ using CalamityMod.NPCs.Calamitas; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -19,13 +20,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.rare = ItemRarityID.LightPurple; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 28; + Item.height = 18; + Item.rare = ItemRarityID.LightPurple; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -33,7 +34,7 @@ namespace CalamityMod.Items.SummonItems return !Main.dayTime && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -46,13 +47,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HellstoneBar, 10).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/SummonItems/BloodwormItem.cs b/Items/SummonItems/BloodwormItem.cs index a892b8a014..5ef082c972 100644 --- a/Items/SummonItems/BloodwormItem.cs +++ b/Items/SummonItems/BloodwormItem.cs @@ -14,20 +14,20 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.maxStack = 20; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.bait = 4444; - item.useStyle = ItemUseStyleID.SwingThrow; - item.autoReuse = true; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.consumable = true; - item.noUseGraphic = true; - item.makeNPC = (short)ModContent.NPCType(); + Item.width = 28; + Item.height = 28; + Item.maxStack = 20; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.bait = 4444; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.consumable = true; + Item.noUseGraphic = true; + Item.makeNPC = (short)ModContent.NPCType(); } } } diff --git a/Items/SummonItems/BloodyWormFood.cs b/Items/SummonItems/BloodyWormFood.cs index bab3800f65..7d737ba492 100644 --- a/Items/SummonItems/BloodyWormFood.cs +++ b/Items/SummonItems/BloodyWormFood.cs @@ -4,6 +4,7 @@ using CalamityMod.NPCs.Perforator; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -18,13 +19,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.rare = ItemRarityID.Orange; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 28; + Item.height = 18; + Item.rare = ItemRarityID.Orange; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -32,7 +33,7 @@ namespace CalamityMod.Items.SummonItems return player.ZoneCrimson && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -45,13 +46,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Vertebrae, 13); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ItemID.CrimtaneBar, 3); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Vertebrae, 13).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ItemID.CrimtaneBar, 3).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/SummonItems/BossRush.cs b/Items/SummonItems/BossRush.cs index b0ced86814..88a0ed14b4 100644 --- a/Items/SummonItems/BossRush.cs +++ b/Items/SummonItems/BossRush.cs @@ -17,16 +17,16 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.rare = ItemRarityID.Blue; - item.width = 28; - item.height = 28; - item.useAnimation = 45; - item.useTime = 45; - item.channel = true; - item.noUseGraphic = true; - item.shoot = ModContent.ProjectileType(); - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.rare = ItemRarityID.Blue; + Item.width = 28; + Item.height = 28; + Item.useAnimation = 45; + Item.useTime = 45; + Item.channel = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } } } diff --git a/Items/SummonItems/BulbofDoom.cs b/Items/SummonItems/BulbofDoom.cs index 1d83e75853..723230802f 100644 --- a/Items/SummonItems/BulbofDoom.cs +++ b/Items/SummonItems/BulbofDoom.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -17,13 +18,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.rare = ItemRarityID.Lime; - item.consumable = false; + Item.width = 28; + Item.height = 18; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.rare = ItemRarityID.Lime; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -31,7 +32,7 @@ namespace CalamityMod.Items.SummonItems return player.ZoneJungle && !NPC.AnyNPCs(NPCID.Plantera) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -44,16 +45,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.JungleSpores, 15); - recipe.AddIngredient(ItemID.SoulofNight, 10); - recipe.AddIngredient(ItemID.SoulofLight, 10); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.Vine); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.JungleSpores, 15).AddIngredient(ItemID.SoulofNight, 10).AddIngredient(ItemID.SoulofLight, 10).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.Vine).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/SummonItems/CharredIdol.cs b/Items/SummonItems/CharredIdol.cs index 65a2322ca8..a438f717a6 100644 --- a/Items/SummonItems/CharredIdol.cs +++ b/Items/SummonItems/CharredIdol.cs @@ -5,6 +5,7 @@ using CalamityMod.NPCs.BrimstoneElemental; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -20,13 +21,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.rare = ItemRarityID.Pink; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 28; + Item.height = 18; + Item.rare = ItemRarityID.Pink; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -35,7 +36,7 @@ namespace CalamityMod.Items.SummonItems return modPlayer.ZoneCalamity && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -48,13 +49,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.Hellforge); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SoulofNight, 5).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.Hellforge).Register(); } } } diff --git a/Items/SummonItems/ChickenEgg.cs b/Items/SummonItems/ChickenEgg.cs index 6681cd4a50..6d83dd39fb 100644 --- a/Items/SummonItems/ChickenEgg.cs +++ b/Items/SummonItems/ChickenEgg.cs @@ -4,6 +4,7 @@ using CalamityMod.NPCs.Yharon; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -19,14 +20,14 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 28; + Item.height = 18; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool CanUseItem(Player player) @@ -34,7 +35,7 @@ namespace CalamityMod.Items.SummonItems return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -47,12 +48,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/SummonItems/CosmicWorm.cs b/Items/SummonItems/CosmicWorm.cs index 3ed1d4eac6..91ed234252 100644 --- a/Items/SummonItems/CosmicWorm.cs +++ b/Items/SummonItems/CosmicWorm.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -22,21 +23,21 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 28; + Item.height = 18; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void ModifyTooltips(List list) { foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + if (line2.Mod == "Terraria" && line2.Name == "Tooltip1") { bool sentinelsNotDefeated = !CalamityWorld.downedSentinel1 || !CalamityWorld.downedSentinel2 || !CalamityWorld.downedSentinel3; line2.text = sentinelsNotDefeated ? "WARNING! Some sentinels have not been truly defeated yet and will spawn at full power during this fight!" : ""; @@ -49,7 +50,7 @@ namespace CalamityMod.Items.SummonItems return !NPC.AnyNPCs(ModContent.NPCType()) && CalamityWorld.DoGSecondStageCountdown <= 0 && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { string key = "Mods.CalamityMod.EdgyBossText12"; Color messageColor = Color.Cyan; @@ -66,24 +67,8 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 30); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.LunarBar, 10); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.SoulofLight, 20); - recipe.AddIngredient(ItemID.SoulofNight, 20); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1).AddIngredient(ItemID.IronBar, 30).AddIngredient(ItemID.LunarBar, 10).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.SoulofLight, 20).AddIngredient(ItemID.SoulofNight, 20).AddIngredient(ModContent.ItemType(), 30).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/SummonItems/CryoKey.cs b/Items/SummonItems/CryoKey.cs index ea02e9cf77..9c536d623b 100644 --- a/Items/SummonItems/CryoKey.cs +++ b/Items/SummonItems/CryoKey.cs @@ -4,6 +4,7 @@ using CalamityMod.NPCs.Cryogen; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -18,12 +19,12 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.rare = ItemRarityID.Pink; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; + Item.width = 28; + Item.height = 18; + Item.rare = ItemRarityID.Pink; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; } public override bool CanUseItem(Player player) @@ -31,7 +32,7 @@ namespace CalamityMod.Items.SummonItems return player.ZoneSnow && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -44,14 +45,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyIceBlock", 50); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddIngredient(ItemID.SoulofLight, 5); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyIceBlock", 50).AddIngredient(ItemID.SoulofNight, 5).AddIngredient(ItemID.SoulofLight, 5).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/SummonItems/DecapoditaSprout.cs b/Items/SummonItems/DecapoditaSprout.cs index 07d821f553..c0a8622c42 100644 --- a/Items/SummonItems/DecapoditaSprout.cs +++ b/Items/SummonItems/DecapoditaSprout.cs @@ -3,6 +3,7 @@ using CalamityMod.NPCs.Crabulon; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { public class DecapoditaSprout : ModItem @@ -16,13 +17,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.rare = ItemRarityID.Green; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 28; + Item.height = 18; + Item.rare = ItemRarityID.Green; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -30,7 +31,7 @@ namespace CalamityMod.Items.SummonItems return player.ZoneGlowshroom && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -47,11 +48,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GlowingMushroom, 50); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.GlowingMushroom, 50).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/SummonItems/DraedonsRemote.cs b/Items/SummonItems/DraedonsRemote.cs index 42231f371c..4e0746dad7 100644 --- a/Items/SummonItems/DraedonsRemote.cs +++ b/Items/SummonItems/DraedonsRemote.cs @@ -3,6 +3,7 @@ using CalamityMod.NPCs; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -17,13 +18,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.rare = ItemRarityID.Yellow; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 28; + Item.height = 28; + Item.rare = ItemRarityID.Yellow; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -31,7 +32,7 @@ namespace CalamityMod.Items.SummonItems return !Main.dayTime && !NPC.AnyNPCs(NPCID.TheDestroyer) && !NPC.AnyNPCs(NPCID.SkeletronPrime) && !NPC.AnyNPCs(NPCID.Spazmatism) && !NPC.AnyNPCs(NPCID.Retinazer) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { CalamityGlobalNPC.DraedonMayhem = true; CalamityNetcode.SyncWorld(); diff --git a/Items/SummonItems/DriedSeafood.cs b/Items/SummonItems/DriedSeafood.cs index 265cad3f59..1f98257e4c 100644 --- a/Items/SummonItems/DriedSeafood.cs +++ b/Items/SummonItems/DriedSeafood.cs @@ -5,6 +5,7 @@ using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -19,13 +20,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.rare = ItemRarityID.Green; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 28; + Item.height = 28; + Item.rare = ItemRarityID.Green; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -33,7 +34,7 @@ namespace CalamityMod.Items.SummonItems return player.ZoneDesert && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -59,14 +60,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SandBlock, 25); - recipe.AddIngredient(ItemID.Cactus, 15); - recipe.AddIngredient(ItemID.AntlionMandible, 4); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SandBlock, 25).AddIngredient(ItemID.Cactus, 15).AddIngredient(ItemID.AntlionMandible, 4).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/SummonItems/EidolonTablet.cs b/Items/SummonItems/EidolonTablet.cs index bc374668ca..9fd0060dce 100644 --- a/Items/SummonItems/EidolonTablet.cs +++ b/Items/SummonItems/EidolonTablet.cs @@ -17,13 +17,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Cyan; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Cyan; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -31,7 +31,7 @@ namespace CalamityMod.Items.SummonItems return !NPC.AnyNPCs(NPCID.CultistBoss) && !NPC.LunarApocalypseIsUp && !NPC.AnyNPCs(NPCID.CultistTablet) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (Main.netMode != NetmodeID.MultiplayerClient) { diff --git a/Items/SummonItems/EyeofExtinction.cs b/Items/SummonItems/EyeofExtinction.cs index 96314f7a4e..2b617430e0 100644 --- a/Items/SummonItems/EyeofExtinction.cs +++ b/Items/SummonItems/EyeofExtinction.cs @@ -14,19 +14,14 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 34; - item.height = 54; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 34; + Item.height = 54; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 15).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/SummonItems/Invasion/CausticTear.cs b/Items/SummonItems/Invasion/CausticTear.cs index 40e98432f4..93a80a7875 100644 --- a/Items/SummonItems/Invasion/CausticTear.cs +++ b/Items/SummonItems/Invasion/CausticTear.cs @@ -19,14 +19,14 @@ namespace CalamityMod.Items.SummonItems.Invasion public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.maxStack = 1; - item.rare = ItemRarityID.Green; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 28; + Item.height = 18; + Item.maxStack = 1; + Item.rare = ItemRarityID.Green; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -34,7 +34,7 @@ namespace CalamityMod.Items.SummonItems.Invasion return !CalamityWorld.rainingAcid; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { CalamityNetcode.SyncWorld(); AcidRainEvent.TryStartEvent(true); @@ -42,11 +42,7 @@ namespace CalamityMod.Items.SummonItems.Invasion } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.needWater = true; - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).Register(); } } } diff --git a/Items/SummonItems/Invasion/MartianDistressBeacon.cs b/Items/SummonItems/Invasion/MartianDistressBeacon.cs index 862249ff72..795dbddb6d 100644 --- a/Items/SummonItems/Invasion/MartianDistressBeacon.cs +++ b/Items/SummonItems/Invasion/MartianDistressBeacon.cs @@ -15,19 +15,19 @@ namespace CalamityMod.Items.SummonItems.Invasion public override void SetDefaults() { - item.width = 30; - item.height = 60; - item.maxStack = 1; - item.rare = ItemRarityID.Yellow; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 30; + Item.height = 60; + Item.maxStack = 1; + Item.rare = ItemRarityID.Yellow; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) => Main.invasionType == InvasionID.None; - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.StartInvasion(InvasionID.MartianMadness); return true; diff --git a/Items/SummonItems/NecroplasmicBeacon.cs b/Items/SummonItems/NecroplasmicBeacon.cs index 8c06e9b525..20ab9ef075 100644 --- a/Items/SummonItems/NecroplasmicBeacon.cs +++ b/Items/SummonItems/NecroplasmicBeacon.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -21,19 +22,19 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 42; - item.height = 58; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 42; + Item.height = 58; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/SummonItems/NecroplasmicBeaconGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/SummonItems/NecroplasmicBeaconGlow")); } public override bool CanUseItem(Player player) @@ -41,7 +42,7 @@ namespace CalamityMod.Items.SummonItems return player.ZoneDungeon && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -54,12 +55,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpookyWood, 25); - recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpookyWood, 25).AddIngredient(ModContent.ItemType(), 50).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/SummonItems/OldPowerCell.cs b/Items/SummonItems/OldPowerCell.cs index c00c881e0a..fd3b7d16d1 100644 --- a/Items/SummonItems/OldPowerCell.cs +++ b/Items/SummonItems/OldPowerCell.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -17,13 +18,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.rare = ItemRarityID.Lime; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 28; + Item.height = 18; + Item.rare = ItemRarityID.Lime; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -34,13 +35,13 @@ namespace CalamityMod.Items.SummonItems int num = (int)player.Center.X / 16; int num2 = (int)player.Center.Y / 16; Tile tile = Framing.GetTileSafely(num, num2); - if (tile.wall == 87) + if (tile.WallType == 87) canSummon = true; } return canSummon && !NPC.AnyNPCs(NPCID.Golem) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -53,12 +54,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarTabletFragment, 20); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LunarTabletFragment, 20).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/SummonItems/OverloadedSludge.cs b/Items/SummonItems/OverloadedSludge.cs index 944fa6fb3a..00a62a6fee 100644 --- a/Items/SummonItems/OverloadedSludge.cs +++ b/Items/SummonItems/OverloadedSludge.cs @@ -4,6 +4,7 @@ using CalamityMod.NPCs.SlimeGod; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -19,13 +20,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.LightRed; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.LightRed; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -34,7 +35,7 @@ namespace CalamityMod.Items.SummonItems !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -47,12 +48,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddRecipeGroup("AnyEvilBlock", 40); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 40).AddRecipeGroup("AnyEvilBlock", 40).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/SummonItems/ProfanedCoreUnlimited.cs b/Items/SummonItems/ProfanedCoreUnlimited.cs index 4f4b264d76..3587ff3855 100644 --- a/Items/SummonItems/ProfanedCoreUnlimited.cs +++ b/Items/SummonItems/ProfanedCoreUnlimited.cs @@ -3,6 +3,7 @@ using CalamityMod.NPCs.Providence; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -19,13 +20,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; - item.rare = ItemRarityID.Purple; + Item.width = 20; + Item.height = 20; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; + Item.rare = ItemRarityID.Purple; } public override bool CanUseItem(Player player) @@ -33,7 +34,7 @@ namespace CalamityMod.Items.SummonItems return !NPC.AnyNPCs(ModContent.NPCType()) && (player.ZoneHoly || player.ZoneUnderworldHeight) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceSpawn"), (int)player.position.X, (int)player.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) diff --git a/Items/SummonItems/ProfanedShard.cs b/Items/SummonItems/ProfanedShard.cs index 84b78db7e9..65d8e9f9d2 100644 --- a/Items/SummonItems/ProfanedShard.cs +++ b/Items/SummonItems/ProfanedShard.cs @@ -4,6 +4,7 @@ using CalamityMod.NPCs.ProfanedGuardians; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -19,13 +20,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; - item.rare = ItemRarityID.Purple; + Item.width = 20; + Item.height = 20; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; + Item.rare = ItemRarityID.Purple; } public override bool CanUseItem(Player player) @@ -33,7 +34,7 @@ namespace CalamityMod.Items.SummonItems return !NPC.AnyNPCs(ModContent.NPCType()) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -46,12 +47,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/SummonItems/RuneofCos.cs b/Items/SummonItems/RuneofCos.cs index 9da3051468..d8dd79b7d0 100644 --- a/Items/SummonItems/RuneofCos.cs +++ b/Items/SummonItems/RuneofCos.cs @@ -7,6 +7,7 @@ using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -23,15 +24,15 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item44; - item.consumable = false; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 20; + Item.height = 20; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item44; + Item.consumable = false; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool CanUseItem(Player player) @@ -41,7 +42,7 @@ namespace CalamityMod.Items.SummonItems CalamityWorld.DoGSecondStageCountdown <= 0 && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (player.ZoneDungeon) @@ -71,13 +72,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddIngredient(ItemID.FragmentSolar, 5); - recipe.AddIngredient(ItemID.LunarBar, 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 40).AddIngredient(ItemID.FragmentSolar, 5).AddIngredient(ItemID.LunarBar, 3).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/SummonItems/SandstormsCore.cs b/Items/SummonItems/SandstormsCore.cs index 3b4302b1dd..666e771c65 100644 --- a/Items/SummonItems/SandstormsCore.cs +++ b/Items/SummonItems/SandstormsCore.cs @@ -2,6 +2,7 @@ using CalamityMod.NPCs.GreatSandShark; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { public class SandstormsCore : ModItem @@ -15,13 +16,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Lime; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Lime; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -29,7 +30,7 @@ namespace CalamityMod.Items.SummonItems return player.ZoneDesert && !NPC.AnyNPCs(ModContent.NPCType()); } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -42,13 +43,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Ectoplasm, 10); - recipe.AddIngredient(ItemID.HallowedBar, 5); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Ectoplasm, 10).AddIngredient(ItemID.HallowedBar, 5).AddIngredient(ItemID.AncientBattleArmorMaterial, 3).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/SummonItems/Seafood.cs b/Items/SummonItems/Seafood.cs index 187be1cf65..4bd8321bd2 100644 --- a/Items/SummonItems/Seafood.cs +++ b/Items/SummonItems/Seafood.cs @@ -5,6 +5,7 @@ using CalamityMod.NPCs.AquaticScourge; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -19,13 +20,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 26; - item.height = 24; - item.rare = ItemRarityID.Pink; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 26; + Item.height = 24; + Item.rare = ItemRarityID.Pink; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -34,7 +35,7 @@ namespace CalamityMod.Items.SummonItems return modPlayer.ZoneSulphur && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -47,13 +48,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.Starfish, 10); - recipe.AddIngredient(ItemID.SharkFin, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Starfish, 10).AddIngredient(ItemID.SharkFin, 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/SummonItems/Starcore.cs b/Items/SummonItems/Starcore.cs index 18f8de8ca1..29955086e4 100644 --- a/Items/SummonItems/Starcore.cs +++ b/Items/SummonItems/Starcore.cs @@ -17,20 +17,14 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 34; - item.height = 40; - item.rare = ItemRarityID.Cyan; + Item.width = 34; + Item.height = 40; + Item.rare = ItemRarityID.Cyan; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/SummonItems/Teratoma.cs b/Items/SummonItems/Teratoma.cs index 481f1146eb..e1d40ffa6d 100644 --- a/Items/SummonItems/Teratoma.cs +++ b/Items/SummonItems/Teratoma.cs @@ -4,6 +4,7 @@ using CalamityMod.NPCs.HiveMind; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -18,13 +19,13 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 18; - item.rare = ItemRarityID.Orange; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + Item.width = 28; + Item.height = 18; + Item.rare = ItemRarityID.Orange; + Item.useAnimation = 45; + Item.useTime = 45; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -32,7 +33,7 @@ namespace CalamityMod.Items.SummonItems return player.ZoneCorrupt && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -45,13 +46,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 13); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ItemID.DemoniteBar, 3); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RottenChunk, 13).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ItemID.DemoniteBar, 3).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/SuperDummy.cs b/Items/SuperDummy.cs index 5ddc85de55..afd96b58b1 100644 --- a/Items/SuperDummy.cs +++ b/Items/SuperDummy.cs @@ -18,16 +18,16 @@ namespace CalamityMod.Items public override void SetDefaults() { - item.damage = 0; - item.width = 20; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.value = 0; - item.rare = ItemRarityID.Blue; - item.autoReuse = true; + Item.damage = 0; + Item.width = 20; + Item.height = 30; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.value = 0; + Item.rare = ItemRarityID.Blue; + Item.autoReuse = true; } public override bool AltFunctionUse(Player player) @@ -51,7 +51,7 @@ namespace CalamityMod.Items } } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (player.altFunctionUse == 2) { @@ -97,10 +97,7 @@ namespace CalamityMod.Items public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TargetDummy); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.TargetDummy).Register(); } } } diff --git a/Items/Tools/AbyssalWarhammer.cs b/Items/Tools/AbyssalWarhammer.cs index b61834b095..2bfb707131 100644 --- a/Items/Tools/AbyssalWarhammer.cs +++ b/Items/Tools/AbyssalWarhammer.cs @@ -15,31 +15,27 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 42; - item.knockBack = 8f; - item.useTime = 10; - item.useAnimation = 38; - item.hammer = 88; - item.tileBoost += 1; + Item.damage = 42; + Item.knockBack = 8f; + Item.useTime = 10; + Item.useAnimation = 38; + Item.hammer = 88; + Item.tileBoost += 1; - item.melee = true; - item.width = 70; - item.height = 70; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 70; + Item.height = 70; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Tools/AerialHamaxe.cs b/Items/Tools/AerialHamaxe.cs index 455a7bb142..e70d115bc6 100644 --- a/Items/Tools/AerialHamaxe.cs +++ b/Items/Tools/AerialHamaxe.cs @@ -15,33 +15,28 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 20; - item.knockBack = 7f; - item.useTime = 16; - item.useAnimation = 26; - item.hammer = 70; - item.axe = 125 / 5; - item.tileBoost += 1; + Item.damage = 20; + Item.knockBack = 7f; + Item.useTime = 16; + Item.useAnimation = 26; + Item.hammer = 70; + Item.axe = 125 / 5; + Item.tileBoost += 1; - item.melee = true; - item.width = 44; - item.height = 44; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 44; + Item.height = 44; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.SunplateBlock, 5); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.SunplateBlock, 5).AddTile(TileID.SkyMill).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Tools/AstralHamaxe.cs b/Items/Tools/AstralHamaxe.cs index 17043e2ae3..1393f7a4b1 100644 --- a/Items/Tools/AstralHamaxe.cs +++ b/Items/Tools/AstralHamaxe.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 80; - item.knockBack = 5f; - item.useTime = 5; - item.useAnimation = 20; - item.hammer = 100; - item.axe = 165 / 5; - item.tileBoost += 3; + Item.damage = 80; + Item.knockBack = 5f; + Item.useTime = 5; + Item.useAnimation = 20; + Item.hammer = 100; + Item.axe = 165 / 5; + Item.tileBoost += 3; - item.melee = true; - item.width = 60; - item.height = 70; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 60; + Item.height = 70; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -54,11 +54,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Tools/AstralPickaxe.cs b/Items/Tools/AstralPickaxe.cs index c6431f8ad4..f688eb704b 100644 --- a/Items/Tools/AstralPickaxe.cs +++ b/Items/Tools/AstralPickaxe.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 65; - item.knockBack = 5f; - item.useTime = 6; - item.useAnimation = 10; - item.pick = 220; - item.tileBoost += 3; + Item.damage = 65; + Item.knockBack = 5f; + Item.useTime = 6; + Item.useAnimation = 10; + Item.pick = 220; + Item.tileBoost += 3; - item.melee = true; - item.width = 50; - item.height = 60; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 50; + Item.height = 60; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -39,11 +39,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.LunarCraftingStation).Register(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Tools/BeastialPickaxe.cs b/Items/Tools/BeastialPickaxe.cs index 6edc62ece2..57184e84a1 100644 --- a/Items/Tools/BeastialPickaxe.cs +++ b/Items/Tools/BeastialPickaxe.cs @@ -15,30 +15,26 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 35; - item.knockBack = 4.5f; - item.useTime = 5; - item.useAnimation = 15; - item.pick = 200; + Item.damage = 35; + Item.knockBack = 4.5f; + Item.useTime = 5; + Item.useAnimation = 15; + Item.pick = 200; - item.melee = true; - item.width = 48; - item.height = 46; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 48; + Item.height = 46; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Tools/BerserkerWaraxe.cs b/Items/Tools/BerserkerWaraxe.cs index 7580ebbf64..9a3fb2a773 100644 --- a/Items/Tools/BerserkerWaraxe.cs +++ b/Items/Tools/BerserkerWaraxe.cs @@ -15,30 +15,26 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 51; - item.knockBack = 8f; - item.useTime = 5; - item.useAnimation = 13; - item.axe = 180 / 5; + Item.damage = 51; + Item.knockBack = 8f; + Item.useTime = 5; + Item.useAnimation = 13; + Item.axe = 180 / 5; - item.melee = true; - item.width = 66; - item.height = 56; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 66; + Item.height = 56; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 9).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Tools/BlossomPickaxe.cs b/Items/Tools/BlossomPickaxe.cs index c210c200db..3a02c06704 100644 --- a/Items/Tools/BlossomPickaxe.cs +++ b/Items/Tools/BlossomPickaxe.cs @@ -16,32 +16,28 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 92; - item.knockBack = 6.5f; - item.useTime = 4; - item.useAnimation = 12; - item.pick = 250; - item.tileBoost += 5; + Item.damage = 92; + Item.knockBack = 6.5f; + Item.useTime = 4; + Item.useAnimation = 12; + Item.pick = 250; + Item.tileBoost += 5; - item.melee = true; - item.width = 50; - item.height = 52; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.DamageType = DamageClass.Melee; + Item.width = 50; + Item.height = 52; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.LunarCraftingStation).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Tools/BobbitHook.cs b/Items/Tools/BobbitHook.cs index 4e36e3eca9..7d913ca614 100644 --- a/Items/Tools/BobbitHook.cs +++ b/Items/Tools/BobbitHook.cs @@ -22,14 +22,14 @@ Pull Velocity: {BobbitHead.PullSpeed}"); public override void SetDefaults() { // Instead of copying these values, we can clone and modify the ones we want to copy - item.CloneDefaults(ItemID.AmethystHook); - item.shootSpeed = BobbitHead.LaunchSpeed; // How quickly the hook is shot. - item.shoot = ProjectileType(); - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = (CalamityRarity)13; - item.width = 30; - item.height = 32; + Item.CloneDefaults(ItemID.AmethystHook); + Item.shootSpeed = BobbitHead.LaunchSpeed; // How quickly the hook is shot. + Item.shoot = ProjectileType(); + Item.value = Item.buyPrice(1, 40, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = (CalamityRarity)13; + Item.width = 30; + Item.height = 32; } } } diff --git a/Items/Tools/ChaoswarpedSlashaxe.cs b/Items/Tools/ChaoswarpedSlashaxe.cs index 73750dc7b6..c4cace393e 100644 --- a/Items/Tools/ChaoswarpedSlashaxe.cs +++ b/Items/Tools/ChaoswarpedSlashaxe.cs @@ -15,31 +15,27 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 68; - item.knockBack = 7f; - item.useTime = 6; - item.useAnimation = 17; - item.axe = 190 / 5; - item.tileBoost += 2; + Item.damage = 68; + Item.knockBack = 7f; + Item.useTime = 6; + Item.useAnimation = 17; + Item.axe = 190 / 5; + Item.tileBoost += 2; - item.melee = true; - item.width = 50; - item.height = 50; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 50; + Item.height = 50; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 9).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Tools/ClimateChange/AridArtifact.cs b/Items/Tools/ClimateChange/AridArtifact.cs index b47f47805a..6465356ec7 100644 --- a/Items/Tools/ClimateChange/AridArtifact.cs +++ b/Items/Tools/ClimateChange/AridArtifact.cs @@ -16,13 +16,13 @@ namespace CalamityMod.Items.Tools.ClimateChange public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Pink; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item66; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.useAnimation = 20; + Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item66; } public override bool CanUseItem(Player player) @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Tools.ClimateChange } // this is extremely ugly and has to be fully qualified because we add an item called Sandstorm - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (Terraria.GameContent.Events.Sandstorm.Happening) CalamityUtils.StopSandstorm(); @@ -42,14 +42,7 @@ namespace CalamityMod.Items.Tools.ClimateChange public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SandBlock, 50); - recipe.anySand = true; - recipe.AddRecipeGroup("AnyAdamantiteBar", 10); - recipe.AddIngredient(ItemID.AncientCloth, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SandBlock, 50).AddRecipeGroup("AnyAdamantiteBar", 10).AddIngredient(ItemID.AncientCloth, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Tools/ClimateChange/BloodIdol.cs b/Items/Tools/ClimateChange/BloodIdol.cs index 537ab93d2a..f3d79da61e 100644 --- a/Items/Tools/ClimateChange/BloodIdol.cs +++ b/Items/Tools/ClimateChange/BloodIdol.cs @@ -16,13 +16,13 @@ namespace CalamityMod.Items.Tools.ClimateChange public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Pink; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item66; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.useAnimation = 20; + Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item66; } public override bool CanUseItem(Player player) @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Tools.ClimateChange return !Main.bloodMoon && !Main.dayTime && !Main.pumpkinMoon && !Main.snowMoon; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { Main.bloodMoon = true; CalamityNetcode.SyncWorld(); @@ -39,14 +39,7 @@ namespace CalamityMod.Items.Tools.ClimateChange public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("EvilPowder", 20); - recipe.AddIngredient(ItemID.SoulofNight, 20); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("EvilPowder", 20).AddIngredient(ItemID.SoulofNight, 20).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Tools/ClimateChange/Cosmolight.cs b/Items/Tools/ClimateChange/Cosmolight.cs index e876ee13fa..93f99b028e 100644 --- a/Items/Tools/ClimateChange/Cosmolight.cs +++ b/Items/Tools/ClimateChange/Cosmolight.cs @@ -17,14 +17,14 @@ namespace CalamityMod.Items.Tools.ClimateChange public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.LightRed; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item60; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.LightRed; + Item.useAnimation = 20; + Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item60; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Tools.ClimateChange return !CalamityPlayer.areThereAnyDamnBosses; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -52,14 +52,7 @@ namespace CalamityMod.Items.Tools.ClimateChange public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FallenStar, 10); // Made it slightly more expensive than requested. - Merkalto - recipe.AddIngredient(ItemID.SoulofLight, 7); - recipe.AddIngredient(ItemID.SoulofNight, 7); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.FallenStar, 10).AddIngredient(ItemID.SoulofLight, 7).AddIngredient(ItemID.SoulofNight, 7).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Tools/ClimateChange/TorrentialTear.cs b/Items/Tools/ClimateChange/TorrentialTear.cs index efcc0d4229..9c19e3544d 100644 --- a/Items/Tools/ClimateChange/TorrentialTear.cs +++ b/Items/Tools/ClimateChange/TorrentialTear.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items.Tools.ClimateChange public override void SetDefaults() { - item.width = 20; - item.height = 20; - item.rare = ItemRarityID.Pink; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item66; - item.consumable = false; + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.useAnimation = 20; + Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item66; + Item.consumable = false; } public override bool CanUseItem(Player player) @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Tools.ClimateChange return !Main.slimeRain; } - public override bool UseItem(Player player) + public override bool? UseItem(Player player) { if (!Main.raining) { diff --git a/Items/Tools/CrystylCrusher.cs b/Items/Tools/CrystylCrusher.cs index ffa3f9db69..6d35b4ef44 100644 --- a/Items/Tools/CrystylCrusher.cs +++ b/Items/Tools/CrystylCrusher.cs @@ -19,36 +19,36 @@ namespace CalamityMod.Items.Tools DisplayName.SetDefault("Crystyl Crusher"); Tooltip.SetDefault("Gotta dig faster, gotta go deeper\n" + "Right click to swing normally"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 400; - item.knockBack = 9f; - item.useTime = 2; - item.useAnimation = 2; - item.pick = PickPower; + Item.damage = 400; + Item.knockBack = 9f; + Item.useTime = 2; + Item.useAnimation = 2; + Item.pick = PickPower; // tile boost intentionally missing, usually 50 - item.melee = true; - item.noMelee = true; - item.channel = true; - item.width = 70; - item.height = 70; - item.useStyle = ItemUseStyleID.HoldingOut; - item.shootSpeed = LaserSpeed; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"); - item.shoot = ModContent.ProjectileType(); + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.channel = true; + Item.width = 70; + Item.height = 70; + Item.useStyle = ItemUseStyleID.Shoot; + Item.shootSpeed = LaserSpeed; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"); + Item.shoot = ModContent.ProjectileType(); - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } public override Vector2? HoldoutOrigin() { - if (item.useStyle == ItemUseStyleID.SwingThrow) + if (Item.useStyle == ItemUseStyleID.Swing) return null; return new Vector2(10, 10); } @@ -65,35 +65,35 @@ namespace CalamityMod.Items.Tools if (player.Calamity().mouseRight && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) { - item.shoot = ProjectileID.None; - item.shootSpeed = 0f; - item.tileBoost = 50; - item.UseSound = SoundID.Item1; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.autoReuse = true; - item.noMelee = false; + Item.shoot = ProjectileID.None; + Item.shootSpeed = 0f; + Item.tileBoost = 50; + Item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.autoReuse = true; + Item.noMelee = false; } else { - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = LaserSpeed; - item.tileBoost = -6; - item.UseSound = null; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTurn = false; - item.autoReuse = false; - item.noMelee = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = LaserSpeed; + Item.tileBoost = -6; + Item.UseSound = null; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTurn = false; + Item.autoReuse = false; + Item.noMelee = true; } } public override void ModifyTooltips(List list) { - if (item.useStyle == ItemUseStyleID.HoldingOut) + if (Item.useStyle == ItemUseStyleID.Shoot) { foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "TileBoost") + if (line2.Mod == "Terraria" && line2.Name == "TileBoost") { line2.text = ""; } @@ -120,13 +120,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("LunarPickaxe"); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("LunarPickaxe").AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Tools/FellerofEvergreens.cs b/Items/Tools/FellerofEvergreens.cs index 9b8ac0a508..92db979393 100644 --- a/Items/Tools/FellerofEvergreens.cs +++ b/Items/Tools/FellerofEvergreens.cs @@ -13,42 +13,28 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 40; - item.knockBack = 5f; - item.useTime = 17; - item.useAnimation = 25; - item.axe = 100 / 5; + Item.damage = 40; + Item.knockBack = 5f; + Item.useTime = 17; + Item.useAnimation = 25; + Item.axe = 100 / 5; - item.melee = true; - item.width = 36; - item.height = 36; - item.scale = 1.5f; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 36; + Item.height = 36; + Item.scale = 1.5f; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TungstenAxe); - recipe.AddIngredient(ItemID.TungstenBar, 10); - recipe.AddIngredient(ItemID.Wood, 15); - recipe.anyWood = true; - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SilverAxe); - recipe.AddIngredient(ItemID.SilverBar, 10); - recipe.AddIngredient(ItemID.Wood, 15); - recipe.anyWood = true; - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.TungstenAxe).AddIngredient(ItemID.TungstenBar, 10).AddIngredient(ItemID.Wood, 15).AddTile(TileID.Anvils).Register(); + CreateRecipe(1).AddIngredient(ItemID.SilverAxe).AddIngredient(ItemID.SilverBar, 10).AddIngredient(ItemID.Wood, 15).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Tools/FlamebeakHampick.cs b/Items/Tools/FlamebeakHampick.cs index 7d08095e03..8ffa1ffda5 100644 --- a/Items/Tools/FlamebeakHampick.cs +++ b/Items/Tools/FlamebeakHampick.cs @@ -21,23 +21,23 @@ Right click to use as a hammer"); public override void SetDefaults() { - item.damage = 58; - item.knockBack = 8f; - item.useTime = 6; - item.useAnimation = 15; - item.pick = PickPower; - item.hammer = HammerPower; - item.tileBoost += 2; + Item.damage = 58; + Item.knockBack = 8f; + Item.useTime = 6; + Item.useAnimation = 15; + Item.pick = PickPower; + Item.hammer = HammerPower; + Item.tileBoost += 2; - item.melee = true; - item.width = 52; - item.height = 50; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 52; + Item.height = 50; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override bool AltFunctionUse(Player player) @@ -49,24 +49,20 @@ Right click to use as a hammer"); { if (player.altFunctionUse == 2) { - item.pick = 0; - item.hammer = HammerPower; + Item.pick = 0; + Item.hammer = HammerPower; } else { - item.pick = PickPower; - item.hammer = 0; + Item.pick = PickPower; + Item.hammer = 0; } return base.CanUseItem(player); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Tools/GallantPickaxe.cs b/Items/Tools/GallantPickaxe.cs index 8ed50fe806..48f6d531f8 100644 --- a/Items/Tools/GallantPickaxe.cs +++ b/Items/Tools/GallantPickaxe.cs @@ -17,33 +17,28 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { // These stats exactly match vanilla's Luminite pickaxes. - item.damage = 80; - item.knockBack = 5.5f; - item.useTime = 6; - item.useAnimation = 12; - item.pick = 225; - item.tileBoost += 4; + Item.damage = 80; + Item.knockBack = 5.5f; + Item.useTime = 6; + Item.useAnimation = 12; + Item.pick = 225; + Item.tileBoost += 4; - item.melee = true; - item.width = 84; - item.height = 80; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(1, 0, 0, 0); - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.useTurn = true; + Item.DamageType = DamageClass.Melee; + Item.width = 84; + Item.height = 80; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(1, 0, 0, 0); + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.useTurn = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.LunarBar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.LunarBar, 10).AddTile(TileID.LunarCraftingStation).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Tools/Gelpick.cs b/Items/Tools/Gelpick.cs index f66de7a5ca..21f82a7401 100644 --- a/Items/Tools/Gelpick.cs +++ b/Items/Tools/Gelpick.cs @@ -16,33 +16,27 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 12; - item.knockBack = 2.5f; - item.useTime = 10; - item.useAnimation = 20; - item.pick = 100; - item.tileBoost += 1; + Item.damage = 12; + Item.knockBack = 2.5f; + Item.useTime = 10; + Item.useAnimation = 20; + Item.pick = 100; + Item.tileBoost += 1; - item.melee = true; - item.width = 46; - item.height = 46; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.useTurn = true; + Item.DamageType = DamageClass.Melee; + Item.width = 46; + Item.height = 46; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.useTurn = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Gel, 30); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Gel, 30).AddIngredient(ItemID.HellstoneBar, 5).AddTile(ModContent.TileType()).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Tools/Grax.cs b/Items/Tools/Grax.cs index 071c273f93..4957243e25 100644 --- a/Items/Tools/Grax.cs +++ b/Items/Tools/Grax.cs @@ -20,25 +20,25 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 472; - item.knockBack = 8f; - item.useTime = 4; - item.useAnimation = 16; - item.hammer = HammerPower; - item.axe = AxePower; - item.tileBoost += 5; + Item.damage = 472; + Item.knockBack = 8f; + Item.useTime = 4; + Item.useAnimation = 16; + Item.hammer = HammerPower; + Item.axe = AxePower; + Item.tileBoost += 5; - item.width = 62; - item.height = 62; - item.scale = 1.5f; - item.melee = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 62; + Item.height = 62; + Item.scale = 1.5f; + Item.DamageType = DamageClass.Melee; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool AltFunctionUse(Player player) => true; @@ -47,28 +47,20 @@ namespace CalamityMod.Items.Tools { if (player.altFunctionUse == 2) { - item.axe = 0; - item.hammer = 0; + Item.axe = 0; + Item.hammer = 0; } else { - item.axe = AxePower; - item.hammer = HammerPower; + Item.axe = AxePower; + Item.hammer = HammerPower; } return base.CanUseItem(player); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("LunarHamaxe"); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddRecipeGroup("LunarHamaxe").AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Tools/GreatbayPickaxe.cs b/Items/Tools/GreatbayPickaxe.cs index 594681c745..c7456d09fa 100644 --- a/Items/Tools/GreatbayPickaxe.cs +++ b/Items/Tools/GreatbayPickaxe.cs @@ -15,30 +15,26 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 9; - item.knockBack = 2f; - item.useTime = 8; - item.useAnimation = 16; - item.pick = 55; + Item.damage = 9; + Item.knockBack = 2f; + Item.useTime = 8; + Item.useAnimation = 16; + Item.pick = 55; - item.melee = true; - item.width = 44; - item.height = 44; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 44; + Item.height = 44; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Tools/InfernaCutter.cs b/Items/Tools/InfernaCutter.cs index b66ae38b26..4e17ea5bef 100644 --- a/Items/Tools/InfernaCutter.cs +++ b/Items/Tools/InfernaCutter.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 110; - item.knockBack = 7f; - item.useTime = 8; - item.useAnimation = 12; - item.axe = 135 / 5; - item.tileBoost += 1; + Item.damage = 110; + Item.knockBack = 7f; + Item.useTime = 8; + Item.useAnimation = 12; + Item.axe = 135 / 5; + Item.tileBoost += 1; - item.melee = true; - item.width = 80; - item.height = 66; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 80; + Item.height = 66; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -47,13 +47,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofFright, 8); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofFright, 8).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -121,7 +115,7 @@ namespace CalamityMod.Items.Tools num340 *= 1.5f; num342 *= (float)player.direction; num341 *= player.gravDir; - int spark = Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, (float)player.direction * num340, num339 * player.gravDir, ProjectileID.Spark, (int)(item.damage * 0.2f * player.MeleeDamage()), 0f, player.whoAmI); + int spark = Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, (float)player.direction * num340, num339 * player.gravDir, ProjectileID.Spark, (int)(Item.damage * 0.2f * player.MeleeDamage()), 0f, player.whoAmI); if (spark.WithinBounds(Main.maxProjectiles)) Main.projectile[spark].Calamity().forceMelee = true; } diff --git a/Items/Tools/MarniteObliterator.cs b/Items/Tools/MarniteObliterator.cs index 4efaf1e66f..175476d7c9 100644 --- a/Items/Tools/MarniteObliterator.cs +++ b/Items/Tools/MarniteObliterator.cs @@ -12,38 +12,32 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 13; - item.knockBack = 1f; - item.useTime = 6; - item.useAnimation = 25; - item.pick = 50; - item.axe = 30 / 5; + Item.damage = 13; + Item.knockBack = 1f; + Item.useTime = 6; + Item.useAnimation = 25; + Item.pick = 50; + Item.axe = 30 / 5; - item.melee = true; - item.width = 36; - item.height = 18; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item23; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 40f; - item.Calamity().trueMelee = true; + Item.DamageType = DamageClass.Melee; + Item.width = 36; + Item.height = 18; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item23; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 40f; + Item.Calamity().trueMelee = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyGoldBar", 3); - recipe.AddIngredient(ItemID.Granite, 5); - recipe.AddIngredient(ItemID.Marble, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyGoldBar", 3).AddIngredient(ItemID.Granite, 5).AddIngredient(ItemID.Marble, 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Tools/PurityAxe.cs b/Items/Tools/PurityAxe.cs index 16f88a60d1..0266504bc4 100644 --- a/Items/Tools/PurityAxe.cs +++ b/Items/Tools/PurityAxe.cs @@ -19,28 +19,28 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 75; - item.knockBack = 5f; - item.useTime = 15; - item.useAnimation = 15; - item.axe = AxePower; + Item.damage = 75; + Item.knockBack = 5f; + Item.useTime = 15; + Item.useAnimation = 15; + Item.axe = AxePower; - item.melee = true; - item.width = 58; - item.height = 54; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 58; + Item.height = 54; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int powderDamage = (int)(0.85f * damage); int idx = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, powderDamage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[idx].melee = true; + Main.projectile[idx].DamageType = DamageClass.Melee; return false; } @@ -50,15 +50,15 @@ namespace CalamityMod.Items.Tools { if (player.altFunctionUse == 2) { - item.axe = 0; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = PowderSpeed; + Item.axe = 0; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = PowderSpeed; } else { - item.axe = AxePower; - item.shoot = ProjectileID.None; - item.shootSpeed = 0f; + Item.axe = AxePower; + Item.shoot = ProjectileID.None; + Item.shootSpeed = 0f; } return base.CanUseItem(player); } @@ -73,14 +73,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.PurificationPowder, 20); - recipe.AddIngredient(ItemID.PixieDust, 20); - recipe.AddIngredient(ItemID.CrystalShard, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.PurificationPowder, 20).AddIngredient(ItemID.PixieDust, 20).AddIngredient(ItemID.CrystalShard, 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Tools/ReefclawHamaxe.cs b/Items/Tools/ReefclawHamaxe.cs index 05d96438bc..ebf25ae438 100644 --- a/Items/Tools/ReefclawHamaxe.cs +++ b/Items/Tools/ReefclawHamaxe.cs @@ -14,31 +14,27 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 15; - item.knockBack = 6f; - item.useTime = 11; - item.useAnimation = 29; - item.hammer = 60; - item.axe = 55 / 5; + Item.damage = 15; + Item.knockBack = 6f; + Item.useTime = 11; + Item.useAnimation = 29; + Item.hammer = 60; + Item.axe = 55 / 5; - item.melee = true; - item.width = 44; - item.height = 44; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 44; + Item.height = 44; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Tools/ShardlightPickaxe.cs b/Items/Tools/ShardlightPickaxe.cs index 2f593bbc4d..21c82648d4 100644 --- a/Items/Tools/ShardlightPickaxe.cs +++ b/Items/Tools/ShardlightPickaxe.cs @@ -15,31 +15,27 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 28; - item.knockBack = 4f; - item.useTime = 8; - item.useAnimation = 15; - item.pick = 180; - item.tileBoost += 1; + Item.damage = 28; + Item.knockBack = 4f; + Item.useTime = 8; + Item.useAnimation = 15; + Item.pick = 180; + Item.tileBoost += 1; - item.melee = true; - item.width = 44; - item.height = 44; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 44; + Item.height = 44; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Tools/SkyfringePickaxe.cs b/Items/Tools/SkyfringePickaxe.cs index 40b70cf5b3..88a53e9e05 100644 --- a/Items/Tools/SkyfringePickaxe.cs +++ b/Items/Tools/SkyfringePickaxe.cs @@ -16,32 +16,27 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 12; - item.knockBack = 2.5f; - item.useTime = 9; - item.useAnimation = 16; - item.pick = 75; - item.tileBoost += 1; + Item.damage = 12; + Item.knockBack = 2.5f; + Item.useTime = 9; + Item.useAnimation = 16; + Item.pick = 75; + Item.tileBoost += 1; - item.melee = true; - item.width = 44; - item.height = 44; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 44; + Item.height = 44; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ItemID.SunplateBlock, 3); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ItemID.SunplateBlock, 3).AddTile(TileID.SkyMill).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Tools/WulfrumAxe.cs b/Items/Tools/WulfrumAxe.cs index 7872dd8c20..1a81099641 100644 --- a/Items/Tools/WulfrumAxe.cs +++ b/Items/Tools/WulfrumAxe.cs @@ -14,31 +14,27 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 5; - item.knockBack = 4.5f; - item.useTime = 15; - item.useAnimation = 26; - item.axe = 60 / 5; - item.tileBoost += 1; + Item.damage = 5; + Item.knockBack = 4.5f; + Item.useTime = 15; + Item.useAnimation = 26; + Item.axe = 60 / 5; + Item.tileBoost += 1; - item.melee = true; - item.width = 30; - item.height = 38; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 30; + Item.height = 38; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 14).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Tools/WulfrumHammer.cs b/Items/Tools/WulfrumHammer.cs index a304277dac..1cd4055c9c 100644 --- a/Items/Tools/WulfrumHammer.cs +++ b/Items/Tools/WulfrumHammer.cs @@ -14,31 +14,27 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 7; - item.knockBack = 5.5f; - item.useTime = 11; - item.useAnimation = 29; - item.hammer = 45; - item.tileBoost += 1; + Item.damage = 7; + Item.knockBack = 5.5f; + Item.useTime = 11; + Item.useAnimation = 29; + Item.hammer = 45; + Item.tileBoost += 1; - item.melee = true; - item.width = 28; - item.height = 38; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 28; + Item.height = 38; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 16).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Tools/WulfrumPickaxe.cs b/Items/Tools/WulfrumPickaxe.cs index 41a4e7fea8..383c9f10a4 100644 --- a/Items/Tools/WulfrumPickaxe.cs +++ b/Items/Tools/WulfrumPickaxe.cs @@ -14,31 +14,27 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 5; - item.knockBack = 2f; - item.useTime = 8; - item.useAnimation = 16; - item.pick = 40; - item.tileBoost += 1; + Item.damage = 5; + Item.knockBack = 2f; + Item.useTime = 8; + Item.useAnimation = 16; + Item.pick = 40; + Item.tileBoost += 1; - item.melee = true; - item.width = 46; - item.height = 38; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 46; + Item.height = 38; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/TreasureBags/AbyssalTreasure.cs b/Items/TreasureBags/AbyssalTreasure.cs index 96e2e8a87d..d711ea2e00 100644 --- a/Items/TreasureBags/AbyssalTreasure.cs +++ b/Items/TreasureBags/AbyssalTreasure.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Blue; //Blue for thematics + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Blue; //Blue for thematics } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/AquaticScourgeBag.cs b/Items/TreasureBags/AquaticScourgeBag.cs index f1c2e1d135..9c01388407 100644 --- a/Items/TreasureBags/AquaticScourgeBag.cs +++ b/Items/TreasureBags/AquaticScourgeBag.cs @@ -24,12 +24,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() @@ -37,7 +37,7 @@ namespace CalamityMod.Items.TreasureBags return true; } - public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(item); + public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(Item); public override void OpenBossBag(Player player) { diff --git a/Items/TreasureBags/AstrageldonBag.cs b/Items/TreasureBags/AstrageldonBag.cs index 0f904d08be..86772ee62f 100644 --- a/Items/TreasureBags/AstrageldonBag.cs +++ b/Items/TreasureBags/AstrageldonBag.cs @@ -29,12 +29,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = ItemRarityID.Cyan; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.expert = true; + Item.rare = ItemRarityID.Cyan; } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/AstrumDeusBag.cs b/Items/TreasureBags/AstrumDeusBag.cs index 2b512f1dcd..1ba7630680 100644 --- a/Items/TreasureBags/AstrumDeusBag.cs +++ b/Items/TreasureBags/AstrumDeusBag.cs @@ -26,17 +26,17 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = ItemRarityID.Cyan; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.expert = true; + Item.rare = ItemRarityID.Cyan; } public override bool CanRightClick() => true; - public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(item); + public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(Item); public override void OpenBossBag(Player player) { diff --git a/Items/TreasureBags/BleachedAnglingKit.cs b/Items/TreasureBags/BleachedAnglingKit.cs index c00db3076a..f8f7fc6d85 100644 --- a/Items/TreasureBags/BleachedAnglingKit.cs +++ b/Items/TreasureBags/BleachedAnglingKit.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Pink; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Pink; } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/BrimstoneWaifuBag.cs b/Items/TreasureBags/BrimstoneWaifuBag.cs index aada6b3b37..2a00cce362 100644 --- a/Items/TreasureBags/BrimstoneWaifuBag.cs +++ b/Items/TreasureBags/BrimstoneWaifuBag.cs @@ -27,12 +27,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = ItemRarityID.Cyan; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.expert = true; + Item.rare = ItemRarityID.Cyan; } public override bool CanRightClick() diff --git a/Items/TreasureBags/BumblebirbBag.cs b/Items/TreasureBags/BumblebirbBag.cs index b78110169d..cb307c22e6 100644 --- a/Items/TreasureBags/BumblebirbBag.cs +++ b/Items/TreasureBags/BumblebirbBag.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = ItemRarityID.Cyan; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.expert = true; + Item.rare = ItemRarityID.Cyan; } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/CalamitasBag.cs b/Items/TreasureBags/CalamitasBag.cs index ad23515da7..89b72097ad 100644 --- a/Items/TreasureBags/CalamitasBag.cs +++ b/Items/TreasureBags/CalamitasBag.cs @@ -25,12 +25,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() diff --git a/Items/TreasureBags/CeaselessVoidBag.cs b/Items/TreasureBags/CeaselessVoidBag.cs index 8a9b832d7e..2e38f2d315 100644 --- a/Items/TreasureBags/CeaselessVoidBag.cs +++ b/Items/TreasureBags/CeaselessVoidBag.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/CrabulonBag.cs b/Items/TreasureBags/CrabulonBag.cs index a7c76ff9bc..79f357bfb2 100644 --- a/Items/TreasureBags/CrabulonBag.cs +++ b/Items/TreasureBags/CrabulonBag.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() diff --git a/Items/TreasureBags/CryogenBag.cs b/Items/TreasureBags/CryogenBag.cs index 30e761de7b..943f737257 100644 --- a/Items/TreasureBags/CryogenBag.cs +++ b/Items/TreasureBags/CryogenBag.cs @@ -27,12 +27,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() diff --git a/Items/TreasureBags/DesertScourgeBag.cs b/Items/TreasureBags/DesertScourgeBag.cs index 9936fb48f6..5c225637bc 100644 --- a/Items/TreasureBags/DesertScourgeBag.cs +++ b/Items/TreasureBags/DesertScourgeBag.cs @@ -25,12 +25,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() diff --git a/Items/TreasureBags/DevourerofGodsBag.cs b/Items/TreasureBags/DevourerofGodsBag.cs index 45228a0f1b..1d12ac2706 100644 --- a/Items/TreasureBags/DevourerofGodsBag.cs +++ b/Items/TreasureBags/DevourerofGodsBag.cs @@ -30,22 +30,22 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 36; - item.height = 34; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 36; + Item.height = 34; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/TreasureBags/DevourerofGodsBagGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/TreasureBags/DevourerofGodsBagGlow")); } public override bool CanRightClick() => true; - public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(item); + public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(Item); public override void OpenBossBag(Player player) { diff --git a/Items/TreasureBags/DraedonTreasureBag.cs b/Items/TreasureBags/DraedonTreasureBag.cs index 50a6496654..12247c4fc8 100644 --- a/Items/TreasureBags/DraedonTreasureBag.cs +++ b/Items/TreasureBags/DraedonTreasureBag.cs @@ -25,17 +25,17 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() => true; - public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(item); + public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(Item); public override void OpenBossBag(Player player) { diff --git a/Items/TreasureBags/FleshyGeodeT1.cs b/Items/TreasureBags/FleshyGeodeT1.cs index 60c4b6619a..e89e4a1d1a 100644 --- a/Items/TreasureBags/FleshyGeodeT1.cs +++ b/Items/TreasureBags/FleshyGeodeT1.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Yellow; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Yellow; } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/FleshyGeodeT2.cs b/Items/TreasureBags/FleshyGeodeT2.cs index 7c17a95cac..3cf86ea53f 100644 --- a/Items/TreasureBags/FleshyGeodeT2.cs +++ b/Items/TreasureBags/FleshyGeodeT2.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/HiveMindBag.cs b/Items/TreasureBags/HiveMindBag.cs index 1b97e39b2d..16b0664fed 100644 --- a/Items/TreasureBags/HiveMindBag.cs +++ b/Items/TreasureBags/HiveMindBag.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() diff --git a/Items/TreasureBags/LeviathanBag.cs b/Items/TreasureBags/LeviathanBag.cs index 1e8db0aabb..9a28555f60 100644 --- a/Items/TreasureBags/LeviathanBag.cs +++ b/Items/TreasureBags/LeviathanBag.cs @@ -24,17 +24,17 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() => true; - public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(item); + public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(Item); public override void OpenBossBag(Player player) { diff --git a/Items/TreasureBags/OldDukeBag.cs b/Items/TreasureBags/OldDukeBag.cs index 9e88ca3b7b..beaf0774e7 100644 --- a/Items/TreasureBags/OldDukeBag.cs +++ b/Items/TreasureBags/OldDukeBag.cs @@ -24,12 +24,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = ItemRarityID.Red; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.expert = true; + Item.rare = ItemRarityID.Red; } public override bool CanRightClick() @@ -37,7 +37,7 @@ namespace CalamityMod.Items.TreasureBags return true; } - public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(item); + public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(Item); public override void OpenBossBag(Player player) { diff --git a/Items/TreasureBags/PerforatorBag.cs b/Items/TreasureBags/PerforatorBag.cs index 23e49e6a13..10b615e64a 100644 --- a/Items/TreasureBags/PerforatorBag.cs +++ b/Items/TreasureBags/PerforatorBag.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() diff --git a/Items/TreasureBags/PlaguebringerGoliathBag.cs b/Items/TreasureBags/PlaguebringerGoliathBag.cs index 7d568d86ac..73ea8ae644 100644 --- a/Items/TreasureBags/PlaguebringerGoliathBag.cs +++ b/Items/TreasureBags/PlaguebringerGoliathBag.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/PolterghastBag.cs b/Items/TreasureBags/PolterghastBag.cs index 9bb5802ae7..3f2d769eaf 100644 --- a/Items/TreasureBags/PolterghastBag.cs +++ b/Items/TreasureBags/PolterghastBag.cs @@ -29,17 +29,17 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 32; - item.height = 34; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 32; + Item.height = 34; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/TreasureBags/PolterghastBagGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/TreasureBags/PolterghastBagGlow")); } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/ProvidenceBag.cs b/Items/TreasureBags/ProvidenceBag.cs index 708ae4e029..1bf628c255 100644 --- a/Items/TreasureBags/ProvidenceBag.cs +++ b/Items/TreasureBags/ProvidenceBag.cs @@ -25,12 +25,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() diff --git a/Items/TreasureBags/RavagerBag.cs b/Items/TreasureBags/RavagerBag.cs index 71fdaf7ab0..d9d09507a4 100644 --- a/Items/TreasureBags/RavagerBag.cs +++ b/Items/TreasureBags/RavagerBag.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = ItemRarityID.Cyan; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.expert = true; + Item.rare = ItemRarityID.Cyan; } public override bool CanRightClick() diff --git a/Items/TreasureBags/SCalBag.cs b/Items/TreasureBags/SCalBag.cs index 35f7816689..781acb970e 100644 --- a/Items/TreasureBags/SCalBag.cs +++ b/Items/TreasureBags/SCalBag.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Purple; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Purple; + Item.expert = true; } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/SandyAnglingKit.cs b/Items/TreasureBags/SandyAnglingKit.cs index 8d43603ca4..87c14c6daa 100644 --- a/Items/TreasureBags/SandyAnglingKit.cs +++ b/Items/TreasureBags/SandyAnglingKit.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Blue; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Blue; } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/SignusBag.cs b/Items/TreasureBags/SignusBag.cs index b3f5a964ff..cb33da82d3 100644 --- a/Items/TreasureBags/SignusBag.cs +++ b/Items/TreasureBags/SignusBag.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/SlimeGodBag.cs b/Items/TreasureBags/SlimeGodBag.cs index a0e2767e20..07fba23300 100644 --- a/Items/TreasureBags/SlimeGodBag.cs +++ b/Items/TreasureBags/SlimeGodBag.cs @@ -25,12 +25,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() diff --git a/Items/TreasureBags/StarterBag.cs b/Items/TreasureBags/StarterBag.cs index 20c7bf2409..c7d6a5787c 100644 --- a/Items/TreasureBags/StarterBag.cs +++ b/Items/TreasureBags/StarterBag.cs @@ -18,10 +18,10 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Blue; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Blue; } public override bool CanRightClick() => true; @@ -62,7 +62,7 @@ namespace CalamityMod.Items.TreasureBags // Music box (if music mod installed) Mod musicMod = CalamityMod.Instance.musicMod; if (musicMod != null) - DropHelper.DropItem(player, musicMod.ItemType("CalamityMusicbox")); + DropHelper.DropItem(player, musicMod.Find("CalamityMusicbox").Type); } } } diff --git a/Items/TreasureBags/StormWeaverBag.cs b/Items/TreasureBags/StormWeaverBag.cs index 87d505e97d..c9b5d3815f 100644 --- a/Items/TreasureBags/StormWeaverBag.cs +++ b/Items/TreasureBags/StormWeaverBag.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/SulphuricTreasure.cs b/Items/TreasureBags/SulphuricTreasure.cs index 058ef047c7..7df3196aef 100644 --- a/Items/TreasureBags/SulphuricTreasure.cs +++ b/Items/TreasureBags/SulphuricTreasure.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Green; //Green for thematics + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Green; //Green for thematics } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/YharonBag.cs b/Items/TreasureBags/YharonBag.cs index ce17aa1601..66b2ce9212 100644 --- a/Items/TreasureBags/YharonBag.cs +++ b/Items/TreasureBags/YharonBag.cs @@ -28,12 +28,12 @@ namespace CalamityMod.Items.TreasureBags public override void SetDefaults() { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = ItemRarityID.Cyan; - item.expert = true; + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Cyan; + Item.expert = true; } public override bool CanRightClick() => true; diff --git a/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs b/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs index 6b0ebb551f..041a5953c8 100644 --- a/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs +++ b/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs @@ -41,13 +41,13 @@ namespace CalamityMod.Items.VanillaArmorChanges switch (player.armor[0].type) { case ItemID.AdamantiteHeadgear: - player.magicCrit += critBoost; + player.GetCritChance(DamageClass.Magic) += critBoost; break; case ItemID.AdamantiteHelmet: - player.meleeCrit += critBoost; + player.GetCritChance(DamageClass.Melee) += critBoost; break; case ItemID.AdamantiteMask: - player.rangedCrit += critBoost; + player.GetCritChance(DamageClass.Ranged) += critBoost; break; } player.Calamity().AdamantiteSet = true; diff --git a/Items/VanillaArmorChanges/MonkT2ArmorSetChange.cs b/Items/VanillaArmorChanges/MonkT2ArmorSetChange.cs index 853ecfb0e7..58d6c87f65 100644 --- a/Items/VanillaArmorChanges/MonkT2ArmorSetChange.cs +++ b/Items/VanillaArmorChanges/MonkT2ArmorSetChange.cs @@ -26,22 +26,22 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void ApplyBodyPieceEffect(Player player) { - player.minionDamage -= 0.1f; - player.meleeDamage -= 0.1f; + player.GetDamage(DamageClass.Summon) -= 0.1f; + player.GetDamage(DamageClass.Melee) -= 0.1f; } public override void ApplyLegPieceEffect(Player player) { - player.minionDamage -= 0.05f; - player.meleeCrit -= 10; + player.GetDamage(DamageClass.Summon) -= 0.05f; + player.GetCritChance(DamageClass.Melee) -= 10; } public override void ApplyArmorSetBonus(Player player) { - player.minionDamage += 0.15f; - player.meleeDamage += 0.1f; + player.GetDamage(DamageClass.Summon) += 0.15f; + player.GetDamage(DamageClass.Melee) += 0.1f; player.meleeSpeed += 0.1f; - player.meleeCrit += 10; + player.GetCritChance(DamageClass.Melee) += 10; } } } diff --git a/Items/VoodooDemonVoodooDoll.cs b/Items/VoodooDemonVoodooDoll.cs index 943ce7e713..eae6d7a04c 100644 --- a/Items/VoodooDemonVoodooDoll.cs +++ b/Items/VoodooDemonVoodooDoll.cs @@ -13,26 +13,21 @@ namespace CalamityMod.Items } public override void SetDefaults() { - item.width = 44; - item.height = 34; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; + Item.width = 44; + Item.height = 34; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; } public override void UpdateInventory(Player player) { - if (item.favorited) + if (Item.favorited) player.Calamity().disableVoodooSpawns = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddIngredient(ItemID.Silk, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HellstoneBar, 5).AddIngredient(ItemID.Silk, 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs index 0381a77ef3..112d83cd1a 100644 --- a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs +++ b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs @@ -23,34 +23,34 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SafeSetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.damage = 80; + Item.damage = 80; modItem.rogue = true; - item.noMelee = true; - item.noUseGraphic = true; - item.width = 26; - item.height = 44; - item.useTime = 56; - item.useAnimation = 56; - item.autoReuse = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 5f; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.width = 26; + Item.height = 44; + Item.useTime = 56; + Item.useAnimation = 56; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 5f; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.UseSound = SoundID.Item1; + Item.UseSound = SoundID.Item1; - item.shootSpeed = 16f; - item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.shoot = ModContent.ProjectileType(); modItem.UsesCharge = true; modItem.MaxCharge = 85f; modItem.ChargePerUse = 0.04f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void SafeModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); @@ -67,14 +67,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 2); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddRecipeGroup("AnyMythrilBar", 10); - recipe.AddIngredient(ItemID.SoulofSight, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 12).AddRecipeGroup("AnyMythrilBar", 10).AddIngredient(ItemID.SoulofSight, 20).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs index 689902e303..eeae9247c7 100644 --- a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs +++ b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs @@ -22,55 +22,48 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.width = 56; - item.height = 52; - item.damage = 100; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.melee = true; - item.useAnimation = 21; - item.useTime = 21; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.width = 56; + Item.height = 52; + Item.damage = 100; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 21; + Item.useTime = 21; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 9f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; - item.rare = ItemRarityID.Red; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 21f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 21f; modItem.UsesCharge = true; modItem.MaxCharge = 135f; modItem.ChargePerUse = 0.075f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float swingOffset = Main.rand.NextFloat(0.5f, 1f) * item.shootSpeed * 1.6f * player.direction; + float swingOffset = Main.rand.NextFloat(0.5f, 1f) * Item.shootSpeed * 1.6f * player.direction; Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, swingOffset); return false; } public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 3); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs index 914f4bb57e..5e647b5c25 100644 --- a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs +++ b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs @@ -22,37 +22,37 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.width = 43; - item.height = 24; - item.magic = true; - item.damage = 43; - item.knockBack = 1f; - item.useTime = 2; - item.useAnimation = 2; - item.noUseGraphic = true; - item.autoReuse = false; - item.channel = true; - item.mana = 6; + Item.width = 43; + Item.height = 24; + Item.DamageType = DamageClass.Magic; + Item.damage = 43; + Item.knockBack = 1f; + Item.useTime = 2; + Item.useAnimation = 2; + Item.noUseGraphic = true; + Item.autoReuse = false; + Item.channel = true; + Item.mana = 6; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GatlingLaserFireStart"); - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GatlingLaserFireStart"); + Item.noMelee = true; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; modItem.UsesCharge = true; modItem.MaxCharge = 135f; modItem.ChargePerUse = 0f; // This weapon is a holdout. Charge is consumed by the holdout projectile. } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); @@ -66,14 +66,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 3); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/GaussDagger.cs b/Items/Weapons/DraedonsArsenal/GaussDagger.cs index 6f25f05fbb..d4b6764f3a 100644 --- a/Items/Weapons/DraedonsArsenal/GaussDagger.cs +++ b/Items/Weapons/DraedonsArsenal/GaussDagger.cs @@ -21,25 +21,25 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal } public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.damage = 25; - item.melee = true; - item.width = 26; - item.height = 26; - item.scale = 1.5f; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.knockBack = 7f; + Item.damage = 25; + Item.DamageType = DamageClass.Melee; + Item.width = 26; + Item.height = 26; + Item.scale = 1.5f; + Item.useTime = 24; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.knockBack = 7f; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; modItem.UsesCharge = true; modItem.MaxCharge = 50f; @@ -66,14 +66,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 1); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.cs b/Items/Weapons/DraedonsArsenal/GaussPistol.cs index ec599d7291..a209df6b52 100644 --- a/Items/Weapons/DraedonsArsenal/GaussPistol.cs +++ b/Items/Weapons/DraedonsArsenal/GaussPistol.cs @@ -18,27 +18,27 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.width = 40; - item.height = 22; - item.magic = true; - item.mana = 6; - item.damage = 110; - item.knockBack = 11f; - item.useTime = item.useAnimation = 20; - item.autoReuse = true; + Item.width = 40; + Item.height = 22; + Item.DamageType = DamageClass.Magic; + Item.mana = 6; + Item.damage = 110; + Item.knockBack = 11f; + Item.useTime = Item.useAnimation = 20; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GaussWeaponFire"); - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GaussWeaponFire"); + Item.noMelee = true; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; modItem.MaxCharge = 85f; modItem.UsesCharge = true; @@ -49,14 +49,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 2); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddRecipeGroup("AnyMythrilBar", 10); - recipe.AddIngredient(ItemID.SoulofMight, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 8).AddRecipeGroup("AnyMythrilBar", 10).AddIngredient(ItemID.SoulofMight, 20).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/GaussRifle.cs b/Items/Weapons/DraedonsArsenal/GaussRifle.cs index 015d9c8b9f..e878b2807d 100644 --- a/Items/Weapons/DraedonsArsenal/GaussRifle.cs +++ b/Items/Weapons/DraedonsArsenal/GaussRifle.cs @@ -20,26 +20,26 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.width = 112; - item.height = 36; - item.ranged = true; - item.damage = 150; - item.knockBack = 30f; - item.useTime = item.useAnimation = 32; - item.autoReuse = true; + Item.width = 112; + Item.height = 36; + Item.DamageType = DamageClass.Ranged; + Item.damage = 150; + Item.knockBack = 30f; + Item.useTime = Item.useAnimation = 32; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GaussWeaponFire"); - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GaussWeaponFire"); + Item.noMelee = true; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 27f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 27f; modItem.UsesCharge = true; modItem.MaxCharge = 135f; @@ -56,14 +56,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 3); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs index 1148220120..42e891a4ef 100644 --- a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs +++ b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs @@ -22,29 +22,29 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.damage = 65; - item.knockBack = 12f; - item.useTime = 4; - item.useAnimation = 16; - item.hammer = 100; + Item.damage = 65; + Item.knockBack = 12f; + Item.useTime = 4; + Item.useAnimation = 16; + Item.hammer = 100; - item.useStyle = ItemUseStyleID.HoldingOut; - item.shootSpeed = 46f; - item.width = 56; - item.height = 24; - item.UseSound = SoundID.Item23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.shootSpeed = 46f; + Item.width = 56; + Item.height = 24; + Item.UseSound = SoundID.Item23; - item.shoot = ModContent.ProjectileType(); - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.noMelee = true; - item.noUseGraphic = true; - item.melee = true; - item.channel = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Melee; + Item.channel = true; modItem.trueMelee = true; modItem.UsesCharge = true; @@ -52,20 +52,13 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal modItem.ChargePerUse = 0f; // This weapon is a holdout. Charge is consumed by the holdout projectile. } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && item.Calamity().Charge > 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && Item.Calamity().Charge > 0; public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 2); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddRecipeGroup("AnyMythrilBar", 10); - recipe.AddIngredient(ItemID.SoulofSight, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 12).AddRecipeGroup("AnyMythrilBar", 10).AddIngredient(ItemID.SoulofSight, 20).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/LaserRifle.cs b/Items/Weapons/DraedonsArsenal/LaserRifle.cs index a9d8641509..c365fe1e53 100644 --- a/Items/Weapons/DraedonsArsenal/LaserRifle.cs +++ b/Items/Weapons/DraedonsArsenal/LaserRifle.cs @@ -19,27 +19,27 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.width = 84; - item.height = 28; - item.ranged = true; - item.damage = 185; - item.knockBack = 4f; - item.useTime = 25; - item.useAnimation = 25; - item.autoReuse = true; + Item.width = 84; + Item.height = 28; + Item.DamageType = DamageClass.Ranged; + Item.damage = 185; + Item.knockBack = 4f; + Item.useTime = 25; + Item.useAnimation = 25; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserRifleFire"); - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserRifleFire"); + Item.noMelee = true; - item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; modItem.UsesCharge = true; modItem.MaxCharge = 190f; @@ -72,14 +72,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 4); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.LunarBar, 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.LunarBar, 4).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/MatterModulator.cs b/Items/Weapons/DraedonsArsenal/MatterModulator.cs index e508f0c71b..53f7d2b3f9 100644 --- a/Items/Weapons/DraedonsArsenal/MatterModulator.cs +++ b/Items/Weapons/DraedonsArsenal/MatterModulator.cs @@ -21,26 +21,26 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.width = 40; - item.height = 22; - item.ranged = true; - item.damage = 84; - item.knockBack = 11f; - item.useTime = item.useAnimation = 33; - item.autoReuse = true; + Item.width = 40; + Item.height = 22; + Item.DamageType = DamageClass.Ranged; + Item.damage = 84; + Item.knockBack = 11f; + Item.useTime = Item.useAnimation = 33; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); + Item.noMelee = true; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7f; modItem.UsesCharge = true; modItem.MaxCharge = 85f; @@ -60,14 +60,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 2); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddRecipeGroup("AnyMythrilBar", 10); - recipe.AddIngredient(ItemID.SoulofFright, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 8).AddRecipeGroup("AnyMythrilBar", 10).AddIngredient(ItemID.SoulofFright, 20).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/MountedScanner.cs b/Items/Weapons/DraedonsArsenal/MountedScanner.cs index 5d01cf180b..ae1a8a3820 100644 --- a/Items/Weapons/DraedonsArsenal/MountedScanner.cs +++ b/Items/Weapons/DraedonsArsenal/MountedScanner.cs @@ -20,27 +20,27 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.width = 26; - item.height = 26; - item.summon = true; - item.damage = 41; - item.knockBack = 2f; - item.mana = 10; - item.useTime = item.useAnimation = 24; - item.autoReuse = true; + Item.width = 26; + Item.height = 26; + Item.DamageType = DamageClass.Summon; + Item.damage = 41; + Item.knockBack = 2f; + Item.mana = 10; + Item.useTime = Item.useAnimation = 24; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item15; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item15; + Item.noMelee = true; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; modItem.UsesCharge = true; modItem.MaxCharge = 85f; @@ -89,14 +89,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 2); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddRecipeGroup("AnyMythrilBar", 10); - recipe.AddIngredient(ItemID.SoulofFright, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddRecipeGroup("AnyMythrilBar", 10).AddIngredient(ItemID.SoulofFright, 20).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index 9bded24fc8..4051c21814 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -32,36 +32,36 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal } public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.damage = Damage; - item.melee = true; - item.width = 26; - item.height = 26; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTurn = false; - item.knockBack = 7f; + Item.damage = Damage; + Item.DamageType = DamageClass.Melee; + Item.width = 26; + Item.height = 26; + Item.useTime = 24; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTurn = false; + Item.knockBack = 7f; - item.noUseGraphic = true; + Item.noUseGraphic = true; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; modItem.customRarity = CalamityRarity.DraedonRust; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.channel = true; modItem.UsesCharge = true; modItem.MaxCharge = 250f; modItem.ChargePerUse = 0f; // This weapon is a holdout. Charge is consumed by the holdout projectile. } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && item.Calamity().Charge > 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && Item.Calamity().Charge > 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -74,14 +74,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 5); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index 1b65c7fd69..4738e45b0a 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -22,28 +22,28 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.width = 62; - item.height = 30; - item.magic = true; - item.damage = BaseDamage; - item.knockBack = 7f; - item.useTime = 45; - item.useAnimation = 45; - item.autoReuse = true; - item.mana = 24; + Item.width = 62; + Item.height = 30; + Item.DamageType = DamageClass.Magic; + Item.damage = BaseDamage; + Item.knockBack = 7f; + Item.useTime = 45; + Item.useAnimation = 45; + Item.autoReuse = true; + Item.mana = 24; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaCasterFire"); - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaCasterFire"); + Item.noMelee = true; - item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; modItem.UsesCharge = true; modItem.MaxCharge = 190f; @@ -100,14 +100,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 4); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.LunarBar, 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.LunarBar, 4).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs index adf8f7a3b7..0f04c48697 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs @@ -23,27 +23,27 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SafeSetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.width = 22; - item.height = 28; - item.damage = 1378; - item.noMelee = true; - item.noUseGraphic = true; - item.consumable = true; - item.maxStack = 999; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = item.useTime = 27; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.width = 22; + Item.height = 28; + Item.damage = 1378; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.consumable = true; + Item.maxStack = 999; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = Item.useTime = 27; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; - item.value = Item.sellPrice(silver: 10); - item.rare = ItemRarityID.Purple; + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Purple; modItem.customRarity = CalamityRarity.DraedonRust; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; modItem.rogue = true; } @@ -62,14 +62,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this, 999); - recipe.AddRecipe(); + CreateRecipe(999).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index 3a10cf0a30..7c7dd0f28e 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -22,27 +22,27 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.shootSpeed = 10f; - item.damage = 310; - item.mana = 12; - item.width = 38; - item.height = 24; - item.useTime = item.useAnimation = 9; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.knockBack = 8f; + Item.shootSpeed = 10f; + Item.damage = 310; + Item.mana = 12; + Item.width = 38; + Item.height = 24; + Item.useTime = Item.useAnimation = 9; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.knockBack = 8f; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; modItem.customRarity = CalamityRarity.DraedonRust; - item.UseSound = SoundID.Item15; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.UseSound = SoundID.Item15; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; modItem.UsesCharge = true; modItem.MaxCharge = 250f; @@ -87,14 +87,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 5); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/PulseDragon.cs b/Items/Weapons/DraedonsArsenal/PulseDragon.cs index 5532e48117..3edcd1899e 100644 --- a/Items/Weapons/DraedonsArsenal/PulseDragon.cs +++ b/Items/Weapons/DraedonsArsenal/PulseDragon.cs @@ -20,26 +20,26 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.damage = 300; - item.melee = true; - item.width = 30; - item.height = 10; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 8f; - item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - item.rare = ItemRarityID.Red; + Item.damage = 300; + Item.DamageType = DamageClass.Melee; + Item.width = 30; + Item.height = 10; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.knockBack = 8f; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.channel = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; modItem.UsesCharge = true; modItem.MaxCharge = 190f; @@ -63,14 +63,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 4); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.LunarBar, 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.LunarBar, 4).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.cs b/Items/Weapons/DraedonsArsenal/PulsePistol.cs index 1bb1c457d2..20d9d08f20 100644 --- a/Items/Weapons/DraedonsArsenal/PulsePistol.cs +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -20,26 +20,26 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.width = 62; - item.height = 22; - item.magic = true; - item.damage = 26; - item.knockBack = 0f; - item.useTime = item.useAnimation = 20; - item.autoReuse = true; + Item.width = 62; + Item.height = 22; + Item.DamageType = DamageClass.Magic; + Item.damage = 26; + Item.knockBack = 0f; + Item.useTime = Item.useAnimation = 20; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PulseRifleFire"); - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PulseRifleFire"); + Item.noMelee = true; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5.2f; // This may seem low but the shot has 10 extra updates. + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5.2f; // This may seem low but the shot has 10 extra updates. modItem.UsesCharge = true; modItem.MaxCharge = 50f; @@ -58,14 +58,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 1); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index a953c148de..9cbe7fd769 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -23,27 +23,27 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.width = 62; - item.height = 22; - item.ranged = true; - item.damage = BaseDamage; - item.knockBack = 0f; - item.useTime = 35; - item.useAnimation = 35; - item.autoReuse = true; + Item.width = 62; + Item.height = 22; + Item.DamageType = DamageClass.Ranged; + Item.damage = BaseDamage; + Item.knockBack = 0f; + Item.useTime = 35; + Item.useAnimation = 35; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PulseRifleFire"); - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PulseRifleFire"); + Item.noMelee = true; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; modItem.customRarity = CalamityRarity.DraedonRust; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; modItem.UsesCharge = true; modItem.MaxCharge = 250f; @@ -72,14 +72,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 5); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs index a6922abb88..1f8a895510 100644 --- a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs +++ b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs @@ -21,28 +21,28 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.width = 28; - item.height = 26; - item.summon = true; - item.sentry = true; - item.damage = 100; - item.knockBack = 0f; - item.mana = 10; - item.useTime = item.useAnimation = 24; - item.autoReuse = true; + Item.width = 28; + Item.height = 26; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; + Item.damage = 100; + Item.knockBack = 0f; + Item.mana = 10; + Item.useTime = Item.useAnimation = 24; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item15; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item15; + Item.noMelee = true; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; modItem.UsesCharge = true; modItem.MaxCharge = 135f; @@ -62,14 +62,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 3); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs index 2f18304e93..ab1d516d39 100644 --- a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -20,27 +20,27 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.shootSpeed = 10f; - item.damage = 36; - item.mana = 12; - item.width = 38; - item.height = 24; - item.useTime = item.useAnimation = 14; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.knockBack = 3f; + Item.shootSpeed = 10f; + Item.damage = 36; + Item.mana = 12; + Item.width = 38; + Item.height = 24; + Item.useTime = Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.knockBack = 3f; - item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.UseSound = SoundID.Item15; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.UseSound = SoundID.Item15; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; modItem.UsesCharge = true; modItem.MaxCharge = 190f; @@ -58,14 +58,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 4); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.LunarBar, 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.LunarBar, 4).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs index 5086b1dd4d..8f5b16bb86 100644 --- a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs +++ b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs @@ -21,25 +21,25 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.shootSpeed = 10f; - item.damage = 24; - item.mana = 10; - item.width = 18; - item.height = 28; - item.useTime = item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Red; + Item.shootSpeed = 10f; + Item.damage = 24; + Item.mana = 10; + Item.width = 18; + Item.height = 28; + Item.useTime = Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.UseSound = SoundID.Item15; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.UseSound = SoundID.Item15; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; modItem.UsesCharge = true; modItem.MaxCharge = 50f; @@ -61,14 +61,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 1); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/SystemBane.cs b/Items/Weapons/DraedonsArsenal/SystemBane.cs index 597a0cfba2..7a3938f687 100644 --- a/Items/Weapons/DraedonsArsenal/SystemBane.cs +++ b/Items/Weapons/DraedonsArsenal/SystemBane.cs @@ -24,33 +24,33 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SafeSetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.damage = 45; + Item.damage = 45; modItem.rogue = true; - item.noMelee = true; - item.noUseGraphic = true; - item.width = 42; - item.height = 36; - item.useTime = 15; - item.useAnimation = 15; - item.autoReuse = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4f; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Red; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.width = 42; + Item.height = 36; + Item.useTime = 15; + Item.useAnimation = 15; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4f; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.UseSound = SoundID.Item1; + Item.UseSound = SoundID.Item1; - item.shootSpeed = 16f; - item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.shoot = ModContent.ProjectileType(); modItem.UsesCharge = true; modItem.MaxCharge = 135f; modItem.ChargePerUse = 0.085f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] < MaxDeployedProjectiles; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < MaxDeployedProjectiles; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -64,14 +64,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 3); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/Taser.cs b/Items/Weapons/DraedonsArsenal/Taser.cs index b93bacb7f6..3d1961fb1e 100644 --- a/Items/Weapons/DraedonsArsenal/Taser.cs +++ b/Items/Weapons/DraedonsArsenal/Taser.cs @@ -20,46 +20,39 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.width = 50; - item.height = 26; - item.ranged = true; - item.damage = 22; - item.knockBack = 0f; - item.useTime = item.useAnimation = 28; - item.autoReuse = true; + Item.width = 50; + Item.height = 26; + Item.DamageType = DamageClass.Ranged; + Item.damage = 22; + Item.knockBack = 0f; + Item.useTime = Item.useAnimation = 28; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); + Item.noMelee = true; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; modItem.UsesCharge = true; modItem.MaxCharge = 50f; modItem.ChargePerUse = 0.05f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 1); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index 09270afd3f..c0983b97b1 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -23,28 +23,28 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.width = 78; - item.height = 28; - item.magic = true; - item.damage = BaseDamage; - item.knockBack = 10f; - item.useTime = 90; - item.useAnimation = 90; - item.autoReuse = true; - item.mana = 30; + Item.width = 78; + Item.height = 28; + Item.DamageType = DamageClass.Magic; + Item.damage = BaseDamage; + Item.knockBack = 10f; + Item.useTime = 90; + Item.useAnimation = 90; + Item.autoReuse = true; + Item.mana = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"); - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"); + Item.noMelee = true; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; modItem.customRarity = CalamityRarity.DraedonRust; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; modItem.UsesCharge = true; modItem.MaxCharge = 250f; @@ -73,14 +73,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 5); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs index bb81f12ed6..0edab6f418 100644 --- a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs +++ b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs @@ -22,30 +22,30 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal } public override void SafeSetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.damage = 25; + Item.damage = 25; modItem.rogue = true; - item.width = 30; - item.height = 34; - item.useTime = 42; - item.useAnimation = 42; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = false; - item.knockBack = 3f; + Item.width = 30; + Item.height = 34; + Item.useTime = 42; + Item.useAnimation = 42; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = false; + Item.knockBack = 3f; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.noUseGraphic = true; + Item.noUseGraphic = true; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; modItem.UsesCharge = true; modItem.MaxCharge = 50f; @@ -64,14 +64,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 1); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/WavePounder.cs b/Items/Weapons/DraedonsArsenal/WavePounder.cs index e28cbbc3c5..37e40186d9 100644 --- a/Items/Weapons/DraedonsArsenal/WavePounder.cs +++ b/Items/Weapons/DraedonsArsenal/WavePounder.cs @@ -22,28 +22,28 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SafeSetDefaults() { - CalamityGlobalItem modItem = item.Calamity(); + CalamityGlobalItem modItem = Item.Calamity(); - item.damage = 75; + Item.damage = 75; modItem.rogue = true; - item.noMelee = true; - item.noUseGraphic = true; - item.width = 26; - item.height = 44; - item.useTime = 56; - item.useAnimation = 56; - item.autoReuse = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 0f; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.width = 26; + Item.height = 44; + Item.useTime = 56; + Item.useAnimation = 56; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 0f; - item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ItemRarityID.Red; modItem.customRarity = CalamityRarity.DraedonRust; - item.UseSound = SoundID.Item1; + Item.UseSound = SoundID.Item1; - item.shootSpeed = 16f; - item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.shoot = ModContent.ProjectileType(); modItem.UsesCharge = true; modItem.MaxCharge = 190f; @@ -62,14 +62,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - ArsenalTierGatedRecipe recipe = new ArsenalTierGatedRecipe(mod, 4); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.LunarBar, 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.LunarBar, 4).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/AbyssShocker.cs b/Items/Weapons/Magic/AbyssShocker.cs index 984a2e011c..ac5b653968 100644 --- a/Items/Weapons/Magic/AbyssShocker.cs +++ b/Items/Weapons/Magic/AbyssShocker.cs @@ -16,30 +16,30 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 28; - item.noMelee = true; - item.magic = true; - item.channel = true; - item.width = 86; - item.height = 32; - item.useTime = 19; - item.useAnimation = 19; - item.UseSound = SoundID.Item13; - item.useStyle = ItemUseStyleID.HoldingOut; - item.mana = 10; + Item.damage = 28; + Item.noMelee = true; + Item.DamageType = DamageClass.Magic; + Item.channel = true; + Item.width = 86; + Item.height = 32; + Item.useTime = 19; + Item.useAnimation = 19; + Item.UseSound = SoundID.Item13; + Item.useStyle = ItemUseStyleID.Shoot; + Item.mana = 10; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.Calamity().donorItem = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/AbyssShocker_mask")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/AbyssShocker_mask")); } public override Vector2? HoldoutOffset() => new Vector2(-14, 0); diff --git a/Items/Weapons/Magic/AbyssalTome.cs b/Items/Weapons/Magic/AbyssalTome.cs index 6a43d8b290..d11189bf76 100644 --- a/Items/Weapons/Magic/AbyssalTome.cs +++ b/Items/Weapons/Magic/AbyssalTome.cs @@ -15,22 +15,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 33; - item.magic = true; - item.mana = 15; - item.width = 28; - item.height = 30; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + Item.damage = 33; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; + Item.width = 28; + Item.height = 30; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item8; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; } } } diff --git a/Items/Weapons/Magic/AcidGun.cs b/Items/Weapons/Magic/AcidGun.cs index 24e7aec2d8..1154be8b2b 100644 --- a/Items/Weapons/Magic/AcidGun.cs +++ b/Items/Weapons/Magic/AcidGun.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 17; - item.magic = true; - item.mana = 9; - item.width = 42; - item.height = 28; - item.useTime = item.useAnimation = 45; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item13; - item.autoReuse = true; - item.shootSpeed = 14f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 17; + Item.DamageType = DamageClass.Magic; + Item.mana = 9; + Item.width = 42; + Item.height = 28; + Item.useTime = Item.useAnimation = 45; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item13; + Item.autoReuse = true; + Item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); @@ -49,12 +49,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 35); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 35).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Magic/AlphaRay.cs b/Items/Weapons/Magic/AlphaRay.cs index bcf064f2a7..2a78dc8fd6 100644 --- a/Items/Weapons/Magic/AlphaRay.cs +++ b/Items/Weapons/Magic/AlphaRay.cs @@ -20,22 +20,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 130; - item.magic = true; - item.mana = 5; - item.width = 84; - item.height = 74; - item.useTime = item.useAnimation = 4; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 6f; - item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.damage = 130; + Item.DamageType = DamageClass.Magic; + Item.mana = 5; + Item.width = 84; + Item.height = 74; + Item.useTime = Item.useAnimation = 4; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item33; + Item.autoReuse = true; + Item.shootSpeed = 6f; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); @@ -85,14 +85,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/AlulaAustralis.cs b/Items/Weapons/Magic/AlulaAustralis.cs index 9c5537991d..340e246f64 100644 --- a/Items/Weapons/Magic/AlulaAustralis.cs +++ b/Items/Weapons/Magic/AlulaAustralis.cs @@ -12,27 +12,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Alula Australis"); Tooltip.SetDefault("Fires a beautiful aurora trailed by a star shower"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 99; - item.magic = true; - item.mana = 8; - item.width = 52; - item.height = 52; - item.useTime = 17; - item.useAnimation = 17; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; + Item.damage = 99; + Item.DamageType = DamageClass.Magic; + Item.mana = 8; + Item.width = 52; + Item.height = 52; + Item.useTime = 17; + Item.useAnimation = 17; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item9; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13f; } public override Vector2? HoldoutOrigin() diff --git a/Items/Weapons/Magic/ApoctosisArray.cs b/Items/Weapons/Magic/ApoctosisArray.cs index d5d8da02e9..56c8e0c428 100644 --- a/Items/Weapons/Magic/ApoctosisArray.cs +++ b/Items/Weapons/Magic/ApoctosisArray.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 99; - item.width = 98; - item.height = 34; - item.magic = true; - item.mana = 12; - item.useAnimation = 7; - item.useTime = 7; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item91; - item.autoReuse = true; - item.noMelee = true; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; + Item.damage = 99; + Item.width = 98; + Item.height = 34; + Item.DamageType = DamageClass.Magic; + Item.mana = 12; + Item.useAnimation = 7; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 6.75f; + Item.UseSound = SoundID.Item91; + Item.autoReuse = true; + Item.noMelee = true; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; } public override Vector2? HoldoutOffset() => new Vector2(-25, 0); @@ -56,12 +56,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/Apotheosis.cs b/Items/Weapons/Magic/Apotheosis.cs index eeecd55e66..004110b4a1 100644 --- a/Items/Weapons/Magic/Apotheosis.cs +++ b/Items/Weapons/Magic/Apotheosis.cs @@ -21,45 +21,35 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 77; - item.magic = true; - item.mana = 42; - item.width = 30; - item.height = 34; - item.useTime = item.useAnimation = 177; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 6.9f; + Item.damage = 77; + Item.DamageType = DamageClass.Magic; + Item.mana = 42; + Item.width = 30; + Item.height = 34; + Item.useTime = Item.useAnimation = 177; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTurn = false; + Item.noMelee = true; + Item.knockBack = 6.9f; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 42.0f; + Item.UseSound = SoundID.Item92; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 42.0f; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/ApotheosisGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/ApotheosisGlow")); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpellTome); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 11); - recipe.AddIngredient(ModContent.ItemType(), 33); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpellTome).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 11).AddIngredient(ModContent.ItemType(), 33).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/AquamarineStaff.cs b/Items/Weapons/Magic/AquamarineStaff.cs index 691703e9b1..61eb43cc8e 100644 --- a/Items/Weapons/Magic/AquamarineStaff.cs +++ b/Items/Weapons/Magic/AquamarineStaff.cs @@ -13,27 +13,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Aquamarine Staff"); Tooltip.SetDefault("Shoots two blue bolts"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 17; - item.magic = true; - item.mana = 3; - item.width = 38; - item.height = 38; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.damage = 17; + Item.DamageType = DamageClass.Magic; + Item.mana = 3; + Item.width = 38; + Item.height = 38; + Item.useTime = 22; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.5f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item43; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; } public override Vector2? HoldoutOrigin() @@ -56,20 +56,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RubyStaff); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DiamondStaff); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RubyStaff).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 25).AddTile(TileID.Anvils).Register(); + CreateRecipe(1).AddIngredient(ItemID.DiamondStaff).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 25).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Magic/ArchAmaryllis.cs b/Items/Weapons/Magic/ArchAmaryllis.cs index 0c5301df73..300d85c51f 100644 --- a/Items/Weapons/Magic/ArchAmaryllis.cs +++ b/Items/Weapons/Magic/ArchAmaryllis.cs @@ -12,27 +12,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Arch Amaryllis"); Tooltip.SetDefault("Casts a beaming flower that explodes into homing petals"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 75; - item.magic = true; - item.mana = 10; - item.width = 66; - item.height = 68; - item.useTime = 23; - item.useAnimation = 23; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; + Item.damage = 75; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 66; + Item.height = 68; + Item.useTime = 23; + Item.useAnimation = 23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7.5f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item109; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; } public override Vector2? HoldoutOrigin() @@ -42,12 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.FragmentNebula, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.FragmentNebula, 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/ArcticBearPaw.cs b/Items/Weapons/Magic/ArcticBearPaw.cs index 17ea08ae5a..88241218b7 100644 --- a/Items/Weapons/Magic/ArcticBearPaw.cs +++ b/Items/Weapons/Magic/ArcticBearPaw.cs @@ -15,23 +15,23 @@ Fires spiritual claws that ignore walls and confuse enemies"); } public override void SetDefaults() { - item.damage = 100; - item.magic = true; - item.mana = 18; - item.width = 28; - item.height = 24; - item.useTime = 28; - item.useAnimation = 28; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 10f; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = ItemRarityID.LightPurple; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 27f; + Item.damage = 100; + Item.DamageType = DamageClass.Magic; + Item.mana = 18; + Item.width = 28; + Item.height = 24; + Item.useTime = 28; + Item.useAnimation = 28; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTurn = false; + Item.noMelee = true; + Item.knockBack = 10f; + Item.value = Item.buyPrice(0, 48, 0, 0); + Item.rare = ItemRarityID.LightPurple; + Item.UseSound = SoundID.Item8; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 27f; } } } diff --git a/Items/Weapons/Magic/ArtAttack.cs b/Items/Weapons/Magic/ArtAttack.cs index 225e3158e3..e0f4a11e29 100644 --- a/Items/Weapons/Magic/ArtAttack.cs +++ b/Items/Weapons/Magic/ArtAttack.cs @@ -19,36 +19,29 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 52; - item.magic = true; - item.mana = 10; - item.width = 70; - item.height = 70; - item.useTime = item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item28; - item.autoReuse = true; - item.noUseGraphic = true; - item.shoot = ModContent.ProjectileType(); - item.channel = true; - item.shootSpeed = 12f; - item.Calamity().donorItem = true; + Item.damage = 52; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 70; + Item.height = 70; + Item.useTime = Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item28; + Item.autoReuse = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.channel = true; + Item.shootSpeed = 12f; + Item.Calamity().donorItem = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RainbowRod); - recipe.AddIngredient(ItemID.LargeRuby); - recipe.AddIngredient(ItemID.CrystalShard); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RainbowRod).AddIngredient(ItemID.LargeRuby).AddIngredient(ItemID.CrystalShard).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Magic/AsteroidStaff.cs b/Items/Weapons/Magic/AsteroidStaff.cs index 71668c9717..4e5902aced 100644 --- a/Items/Weapons/Magic/AsteroidStaff.cs +++ b/Items/Weapons/Magic/AsteroidStaff.cs @@ -13,35 +13,35 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Asteroid Staff"); Tooltip.SetDefault("Summons asteroids from the sky"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 145; - item.magic = true; - item.mana = 18; - item.width = 50; - item.height = 50; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item88; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; + Item.damage = 145; + Item.DamageType = DamageClass.Magic; + Item.mana = 18; + Item.width = 50; + Item.height = 50; + Item.useTime = 10; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6.75f; + Item.UseSound = SoundID.Item88; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; } public override Vector2? HoldoutOrigin() => new Vector2(2, 2); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -90,12 +90,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteorStaff); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.MeteorStaff).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/AstralStaff.cs b/Items/Weapons/Magic/AstralStaff.cs index 2519157290..f29028f601 100644 --- a/Items/Weapons/Magic/AstralStaff.cs +++ b/Items/Weapons/Magic/AstralStaff.cs @@ -13,27 +13,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Astral Staff"); Tooltip.SetDefault("Summons a large crystal from the sky that has a large area of effect on impact."); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 270; - item.magic = true; - item.mana = 26; - item.width = 86; - item.height = 72; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.UseSound = SoundID.Item105; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + Item.damage = 270; + Item.DamageType = DamageClass.Magic; + Item.mana = 26; + Item.width = 86; + Item.height = 72; + Item.useTime = 18; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.UseSound = SoundID.Item105; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; } // Terraria seems to really dislike high crit values in SetDefaults @@ -43,11 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.LunarCraftingStation).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/AstralachneaStaff.cs b/Items/Weapons/Magic/AstralachneaStaff.cs index 4fd9d328e1..ffb9c23f94 100644 --- a/Items/Weapons/Magic/AstralachneaStaff.cs +++ b/Items/Weapons/Magic/AstralachneaStaff.cs @@ -13,27 +13,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Astralachnea Staff"); Tooltip.SetDefault("Fires a spread of homing astral spider fangs"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 50; - item.magic = true; - item.mana = 19; - item.width = 52; - item.height = 52; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item46; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; + Item.damage = 50; + Item.DamageType = DamageClass.Magic; + Item.mana = 19; + Item.width = 52; + Item.height = 52; + Item.useTime = 21; + Item.useAnimation = 21; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item46; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13f; } public override Vector2? HoldoutOrigin() @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Magic { Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); int i = Main.myPlayer; - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; int num73 = damage; float num74 = knockBack; float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; diff --git a/Items/Weapons/Magic/Atlantis.cs b/Items/Weapons/Magic/Atlantis.cs index 255277c242..ab367460eb 100644 --- a/Items/Weapons/Magic/Atlantis.cs +++ b/Items/Weapons/Magic/Atlantis.cs @@ -12,27 +12,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Atlantis"); Tooltip.SetDefault("Casts aquatic spears that split as they travel"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 70; - item.magic = true; - item.mana = 12; - item.width = 28; - item.height = 30; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item34; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 32f; + Item.damage = 70; + Item.DamageType = DamageClass.Magic; + Item.mana = 12; + Item.width = 28; + Item.height = 30; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item34; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 32f; } public override Vector2? HoldoutOrigin() => new Vector2(15, 15); diff --git a/Items/Weapons/Magic/AuguroftheElements.cs b/Items/Weapons/Magic/AuguroftheElements.cs index fdd075b656..9330235a29 100644 --- a/Items/Weapons/Magic/AuguroftheElements.cs +++ b/Items/Weapons/Magic/AuguroftheElements.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 147; - item.magic = true; - item.mana = 11; - item.width = 28; - item.height = 30; - item.useTime = 2; - item.reuseDelay = 5; - item.useAnimation = 10; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item103; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 30f; + Item.damage = 147; + Item.DamageType = DamageClass.Magic; + Item.mana = 11; + Item.width = 28; + Item.height = 30; + Item.useTime = 2; + Item.reuseDelay = 5; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item103; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Magic value3.Normalize(); value2 = value2 * 6f + value3; value2.Normalize(); - value2 *= item.shootSpeed; + value2 *= Item.shootSpeed; float num91 = (float)Main.rand.Next(10, 50) * 0.001f; if (Main.rand.NextBool(2)) { @@ -64,15 +64,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.ShadowFlameHexDoll); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.ShadowFlameHexDoll).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/BelchingSaxophone.cs b/Items/Weapons/Magic/BelchingSaxophone.cs index cc97d02b33..78a71ef7da 100644 --- a/Items/Weapons/Magic/BelchingSaxophone.cs +++ b/Items/Weapons/Magic/BelchingSaxophone.cs @@ -21,22 +21,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = BaseDamage; - item.magic = true; - item.mana = 10; - item.width = 46; - item.height = 22; - item.useTime = 12; - item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); + Item.damage = BaseDamage; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 46; + Item.height = 22; + Item.useTime = 12; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); //If a saxophone actually fired reeds, I'd be concerned. - item.shootSpeed = 20f; + Item.shootSpeed = 20f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/BlackAnurian.cs b/Items/Weapons/Magic/BlackAnurian.cs index 9ec52b352c..a3558c631a 100644 --- a/Items/Weapons/Magic/BlackAnurian.cs +++ b/Items/Weapons/Magic/BlackAnurian.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 43; - item.magic = true; - item.mana = 10; - item.width = 58; - item.height = 38; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.75f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item111; - item.autoReuse = true; - item.shootSpeed = 8f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 43; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 58; + Item.height = 38; + Item.useTime = 14; + Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.75f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item111; + Item.autoReuse = true; + Item.shootSpeed = 8f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Magic/BloodBath.cs b/Items/Weapons/Magic/BloodBath.cs index b12f52d061..850a55f68b 100644 --- a/Items/Weapons/Magic/BloodBath.cs +++ b/Items/Weapons/Magic/BloodBath.cs @@ -14,27 +14,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Blood Bath"); Tooltip.SetDefault("Drenches your foes in blood"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 31; - item.magic = true; - item.mana = 10; - item.width = 52; - item.height = 50; - item.useTime = 15; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.75f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item21; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + Item.damage = 31; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 52; + Item.height = 50; + Item.useTime = 15; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.75f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item21; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; } public override Vector2? HoldoutOrigin() @@ -44,18 +44,12 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.Vertebrae, 3); - recipe.AddIngredient(ItemID.CrimtaneBar, 2); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.Vertebrae, 3).AddIngredient(ItemID.CrimtaneBar, 2).AddTile(TileID.DemonAltar).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Magic/BlushieStaff.cs b/Items/Weapons/Magic/BlushieStaff.cs index 444111f0ed..11323375f5 100644 --- a/Items/Weapons/Magic/BlushieStaff.cs +++ b/Items/Weapons/Magic/BlushieStaff.cs @@ -16,37 +16,31 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.width = item.height = 48; - item.useStyle = ItemUseStyleID.HoldingUp; - item.useAnimation = 30; - item.useTime = 30; - item.channel = true; - item.noMelee = true; - item.damage = 1; - item.knockBack = 1f; - item.autoReuse = false; - item.useTurn = false; - item.magic = true; + Item.width = Item.height = 48; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.useAnimation = 30; + Item.useTime = 30; + Item.channel = true; + Item.noMelee = true; + Item.damage = 1; + Item.knockBack = 1f; + Item.autoReuse = false; + Item.useTurn = false; + Item.DamageType = DamageClass.Magic; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; - item.UseSound = SoundID.Item1; - item.shoot = ModContent.ProjectileType(); - item.mana = 200; - item.shootSpeed = 0f; + Item.UseSound = SoundID.Item1; + Item.shoot = ModContent.ProjectileType(); + Item.mana = 200; + Item.shootSpeed = 0f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SapphireStaff); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SapphireStaff).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/BrimroseStaff.cs b/Items/Weapons/Magic/BrimroseStaff.cs index beacae1302..654595b079 100644 --- a/Items/Weapons/Magic/BrimroseStaff.cs +++ b/Items/Weapons/Magic/BrimroseStaff.cs @@ -13,27 +13,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Brimrose Staff"); Tooltip.SetDefault("Fires a spread of brimstone beams"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 20; - item.magic = true; - item.mana = 14; - item.width = 36; - item.height = 34; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; + Item.damage = 20; + Item.DamageType = DamageClass.Magic; + Item.mana = 14; + Item.width = 36; + Item.height = 34; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item43; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; } public override Vector2? HoldoutOrigin() @@ -43,11 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Magic/BurningSea.cs b/Items/Weapons/Magic/BurningSea.cs index 63b5b1443c..0f8f852c94 100644 --- a/Items/Weapons/Magic/BurningSea.cs +++ b/Items/Weapons/Magic/BurningSea.cs @@ -16,32 +16,27 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 72; - item.magic = true; - item.mana = 15; - item.width = 28; - item.height = 30; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + Item.damage = 72; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; + Item.width = 28; + Item.height = 30; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6.5f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpellTome); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpellTome).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/CalamitasInferno.cs b/Items/Weapons/Magic/CalamitasInferno.cs index 86f12a9afe..64186dcb8a 100644 --- a/Items/Weapons/Magic/CalamitasInferno.cs +++ b/Items/Weapons/Magic/CalamitasInferno.cs @@ -15,21 +15,21 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 65; - item.magic = true; - item.mana = 20; - item.width = 28; - item.height = 30; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + Item.damage = 65; + Item.DamageType = DamageClass.Magic; + Item.mana = 20; + Item.width = 28; + Item.height = 30; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7.5f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; } } } diff --git a/Items/Weapons/Magic/CarnageRay.cs b/Items/Weapons/Magic/CarnageRay.cs index bf47cd7782..9c75bc064a 100644 --- a/Items/Weapons/Magic/CarnageRay.cs +++ b/Items/Weapons/Magic/CarnageRay.cs @@ -14,27 +14,27 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Carnage Ray"); Tooltip.SetDefault("Fires a blood ray\n" + "The farther along the ray hit enemies are, the more damage they take"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 24; - item.magic = true; - item.mana = 10; - item.width = 46; - item.height = 46; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.25f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item72; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; + Item.damage = 24; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 46; + Item.height = 46; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.25f; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item72; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; } public override Vector2? HoldoutOrigin() @@ -44,16 +44,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrimsonRod); - recipe.AddIngredient(ItemID.MagicMissile); - recipe.AddIngredient(ItemID.WandofSparking); - recipe.AddIngredient(ItemID.AmberStaff); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.CrimsonRod).AddIngredient(ItemID.MagicMissile).AddIngredient(ItemID.WandofSparking).AddIngredient(ItemID.AmberStaff).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Magic/ClamorNoctus.cs b/Items/Weapons/Magic/ClamorNoctus.cs index 16daf38e5d..1913ad3461 100644 --- a/Items/Weapons/Magic/ClamorNoctus.cs +++ b/Items/Weapons/Magic/ClamorNoctus.cs @@ -16,28 +16,28 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Clamor Noctus"); Tooltip.SetDefault(@"Let the sky fall Fires night wyverns and stars from the sky that stick to enemies and tiles and explode"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 270; - item.magic = true; - item.mana = 12; - item.width = 52; - item.height = 74; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.2f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.UseSound = SoundID.Item105; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 25f; + Item.damage = 270; + Item.DamageType = DamageClass.Magic; + Item.mana = 12; + Item.width = 52; + Item.height = 74; + Item.useTime = 21; + Item.useAnimation = 21; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.2f; + Item.value = Item.buyPrice(1, 40, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.UseSound = SoundID.Item105; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 25f; } public override Vector2? HoldoutOrigin() @@ -47,7 +47,7 @@ Fires night wyverns and stars from the sky that stick to enemies and tiles and e public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -107,14 +107,7 @@ Fires night wyverns and stars from the sky that stick to enemies and tiles and e public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/Climax.cs b/Items/Weapons/Magic/Climax.cs index 5c8fe585ae..ae3215c85b 100644 --- a/Items/Weapons/Magic/Climax.cs +++ b/Items/Weapons/Magic/Climax.cs @@ -16,28 +16,28 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Voltaic Climax"); Tooltip.SetDefault("Conjures an octagon of supercharged magnet spheres around the cursor"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 100; - item.magic = true; - item.mana = 30; - item.width = 78; - item.height = 78; - item.useTime = 33; - item.useAnimation = 33; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.damage = 100; + Item.DamageType = DamageClass.Magic; + Item.mana = 30; + Item.width = 78; + Item.height = 78; + Item.useTime = 33; + Item.useAnimation = 33; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override Vector2? HoldoutOrigin() @@ -64,12 +64,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/ClothiersWrath.cs b/Items/Weapons/Magic/ClothiersWrath.cs index 6a8ec8adbe..2a7f54f479 100644 --- a/Items/Weapons/Magic/ClothiersWrath.cs +++ b/Items/Weapons/Magic/ClothiersWrath.cs @@ -15,22 +15,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 38; - item.magic = true; - item.mana = 15; - item.width = 28; - item.height = 30; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = ProjectileID.ClothiersCurse; - item.shootSpeed = 6f; + Item.damage = 38; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; + Item.width = 28; + Item.height = 30; + Item.useTime = 22; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item8; + Item.autoReuse = true; + Item.shoot = ProjectileID.ClothiersCurse; + Item.shootSpeed = 6f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/CoralSpout.cs b/Items/Weapons/Magic/CoralSpout.cs index f9481457c4..631164abe0 100644 --- a/Items/Weapons/Magic/CoralSpout.cs +++ b/Items/Weapons/Magic/CoralSpout.cs @@ -16,32 +16,27 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 17; - item.magic = true; - item.mana = 4; - item.width = 28; - item.height = 30; - item.useTime = 26; - item.useAnimation = 26; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item17; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.damage = 17; + Item.DamageType = DamageClass.Magic; + Item.mana = 4; + Item.width = 28; + Item.height = 30; + Item.useTime = 26; + Item.useAnimation = 26; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item17; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Coral, 5); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Coral, 5).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/CosmicRainbow.cs b/Items/Weapons/Magic/CosmicRainbow.cs index d312dba61f..9b969ebe63 100644 --- a/Items/Weapons/Magic/CosmicRainbow.cs +++ b/Items/Weapons/Magic/CosmicRainbow.cs @@ -17,35 +17,27 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 105; - item.magic = true; - item.mana = 30; - item.width = 26; - item.height = 64; - item.useTime = 35; - item.useAnimation = 35; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 0f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.UseSound = SoundID.Item67; - item.autoReuse = true; - item.shoot = ProjectileID.RainbowFront; - item.shootSpeed = 18f; + Item.damage = 105; + Item.DamageType = DamageClass.Magic; + Item.mana = 30; + Item.width = 26; + Item.height = 64; + Item.useTime = 35; + Item.useAnimation = 35; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 0f; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.UseSound = SoundID.Item67; + Item.autoReuse = true; + Item.shoot = ProjectileID.RainbowFront; + Item.shootSpeed = 18f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RainbowGun); - recipe.AddIngredient(ItemID.PearlwoodBow); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RainbowGun).AddIngredient(ItemID.PearlwoodBow).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -69,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Magic Main.projectile[rainbow].usesLocalNPCImmunity = true; Main.projectile[rainbow].localNPCHitCooldown = 10; } - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Magic/Cryophobia.cs b/Items/Weapons/Magic/Cryophobia.cs index ab99577618..523a3e3ab4 100644 --- a/Items/Weapons/Magic/Cryophobia.cs +++ b/Items/Weapons/Magic/Cryophobia.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 55; - item.magic = true; - item.mana = 18; - item.width = 56; - item.height = 34; - item.useTime = 28; - item.useAnimation = 28; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = CalamityGlobalItem.Rarity6BuyPrice; - item.rare = ItemRarityID.LightPurple; - item.UseSound = SoundID.Item117; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 55; + Item.DamageType = DamageClass.Magic; + Item.mana = 18; + Item.width = 56; + Item.height = 34; + Item.useTime = 28; + Item.useAnimation = 28; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.rare = ItemRarityID.LightPurple; + Item.UseSound = SoundID.Item117; + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Magic/CrystalFlareStaff.cs b/Items/Weapons/Magic/CrystalFlareStaff.cs index 11ce2deb0b..e529f6f1aa 100644 --- a/Items/Weapons/Magic/CrystalFlareStaff.cs +++ b/Items/Weapons/Magic/CrystalFlareStaff.cs @@ -14,27 +14,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Crystal Flare Staff"); Tooltip.SetDefault("Fires blue frost flames that explode"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 50; - item.magic = true; - item.mana = 15; - item.width = 44; - item.height = 46; - item.useTime = 10; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.25f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.damage = 50; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; + Item.width = 44; + Item.height = 46; + Item.useTime = 10; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.25f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; } public override Vector2? HoldoutOrigin() @@ -44,15 +44,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FrostStaff); - recipe.AddIngredient(ItemID.FrostCore); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.FrostStaff).AddIngredient(ItemID.FrostCore).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.IceMachine).Register(); } } } diff --git a/Items/Weapons/Magic/DarkSpark.cs b/Items/Weapons/Magic/DarkSpark.cs index 693cb510ba..d1daad87b3 100644 --- a/Items/Weapons/Magic/DarkSpark.cs +++ b/Items/Weapons/Magic/DarkSpark.cs @@ -15,34 +15,34 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Dark Spark"); Tooltip.SetDefault("And everything under the sun is in tune,\n" + "But the sun is eclipsed by the moon."); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 4)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 4)); } public override void SetDefaults() { - item.damage = 60; - item.magic = true; - item.mana = 10; - item.width = 16; - item.height = 16; - item.useTime = 10; - item.useAnimation = 10; - item.reuseDelay = 5; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item13; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 0f; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 30f; + Item.damage = 60; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 16; + Item.height = 16; + Item.useTime = 10; + Item.useAnimation = 10; + Item.reuseDelay = 5; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item13; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.knockBack = 0f; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.Calamity().donorItem = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -52,14 +52,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LastPrism); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LastPrism).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 30).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/DeathValley.cs b/Items/Weapons/Magic/DeathValley.cs index 5104ce1355..f47d39446b 100644 --- a/Items/Weapons/Magic/DeathValley.cs +++ b/Items/Weapons/Magic/DeathValley.cs @@ -16,35 +16,27 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 110; - item.magic = true; - item.mana = 9; - item.width = 36; - item.height = 40; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; + Item.damage = 110; + Item.DamageType = DamageClass.Magic; + Item.mana = 9; + Item.width = 36; + Item.height = 40; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("AnyAdamantiteBar", 5); // This is here to keep the Forbidden Fragment stuff on the same tier. - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); - recipe.AddIngredient(ItemID.FossilOre, 25); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddRecipeGroup("AnyAdamantiteBar", 5).AddIngredient(ItemID.AncientBattleArmorMaterial).AddIngredient(ItemID.FossilOre, 25).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/DeathhailStaff.cs b/Items/Weapons/Magic/DeathhailStaff.cs index de1ad0f35a..52b6720e3e 100644 --- a/Items/Weapons/Magic/DeathhailStaff.cs +++ b/Items/Weapons/Magic/DeathhailStaff.cs @@ -15,28 +15,28 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Deathhail Staff"); Tooltip.SetDefault("Rain death upon your foes!\n" + "Casts a storm of nebula lasers from the sky"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 328; - item.magic = true; - item.mana = 16; - item.width = 80; - item.height = 84; - item.useTime = 11; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.UseSound = SoundID.Item12; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; + Item.damage = 328; + Item.DamageType = DamageClass.Magic; + Item.mana = 16; + Item.width = 80; + Item.height = 84; + Item.useTime = 11; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4f; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.UseSound = SoundID.Item12; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; } /*public override Vector2? HoldoutOrigin() @@ -46,17 +46,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/DeathhailStaffGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/DeathhailStaffGlow")); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int i = Main.myPlayer; - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; int num73 = damage; float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; + num74 = player.GetWeaponKnockback(Item, num74); + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); Vector2 vector3 = Main.MouseWorld - vector2; diff --git a/Items/Weapons/Magic/DivineRetribution.cs b/Items/Weapons/Magic/DivineRetribution.cs index 4ed7b66c71..ff32f8a17d 100644 --- a/Items/Weapons/Magic/DivineRetribution.cs +++ b/Items/Weapons/Magic/DivineRetribution.cs @@ -14,37 +14,37 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Divine Retribution"); Tooltip.SetDefault("Mage is superior to rogue; look, we got a donor weapon to prove it!"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 39; - item.magic = true; - item.mana = 15; - item.width = 66; - item.height = 88; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; + Item.damage = 39; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; + Item.width = 66; + Item.height = 88; + Item.useTime = 12; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().donorItem = true; - item.UseSound = SoundID.Item73; - item.autoReuse = true; - item.shootSpeed = 19f; - item.shoot = ModContent.ProjectileType(); + Item.UseSound = SoundID.Item73; + Item.autoReuse = true; + Item.shootSpeed = 19f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOrigin() => new Vector2(15, 15); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -91,14 +91,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/Downpour.cs b/Items/Weapons/Magic/Downpour.cs index 50c75edfca..88d61ec442 100644 --- a/Items/Weapons/Magic/Downpour.cs +++ b/Items/Weapons/Magic/Downpour.cs @@ -12,27 +12,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Downpour"); Tooltip.SetDefault("Fires a spray of water that drips extra trails of water"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 43; - item.magic = true; - item.mana = 10; - item.width = 42; - item.height = 42; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item13; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.damage = 43; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 42; + Item.height = 42; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item13; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; } public override Vector2? HoldoutOrigin() diff --git a/Items/Weapons/Magic/Effervescence.cs b/Items/Weapons/Magic/Effervescence.cs index 3fc6732c1b..05e8b64c7d 100644 --- a/Items/Weapons/Magic/Effervescence.cs +++ b/Items/Weapons/Magic/Effervescence.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 49; - item.magic = true; - item.mana = 17; - item.width = 56; - item.height = 26; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.75f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item95; - item.autoReuse = true; - item.shootSpeed = 13f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 49; + Item.DamageType = DamageClass.Magic; + Item.mana = 17; + Item.width = 56; + Item.height = 26; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.75f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item95; + Item.autoReuse = true; + Item.shootSpeed = 13f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); @@ -50,14 +50,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BubbleGun); - recipe.AddIngredient(ItemID.Xenopopper); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BubbleGun).AddIngredient(ItemID.Xenopopper).AddIngredient(ItemID.LunarBar, 5).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/EidolicWail.cs b/Items/Weapons/Magic/EidolicWail.cs index 29524f1a11..41c6406cb3 100644 --- a/Items/Weapons/Magic/EidolicWail.cs +++ b/Items/Weapons/Magic/EidolicWail.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 126; - item.magic = true; - item.mana = 10; - item.width = 60; - item.height = 60; - item.useTime = 12; - item.reuseDelay = 30; - item.useAnimation = 36; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = ItemRarityID.Purple; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"); - item.autoReuse = true; - item.shootSpeed = 8f; - item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.damage = 126; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 60; + Item.height = 60; + Item.useTime = 12; + Item.reuseDelay = 30; + Item.useAnimation = 36; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1f; + Item.value = Item.buyPrice(1, 40, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"); + Item.autoReuse = true; + Item.shootSpeed = 8f; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); diff --git a/Items/Weapons/Magic/EldritchTome.cs b/Items/Weapons/Magic/EldritchTome.cs index 9e6c206394..10822c6f44 100644 --- a/Items/Weapons/Magic/EldritchTome.cs +++ b/Items/Weapons/Magic/EldritchTome.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 42; - item.magic = true; - item.mana = 7; - item.width = 28; - item.height = 30; - item.useTime = 7; - item.useAnimation = 21; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item103; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.damage = 42; + Item.DamageType = DamageClass.Magic; + Item.mana = 7; + Item.width = 28; + Item.height = 30; + Item.useTime = 7; + Item.useAnimation = 21; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item103; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } // Terraria seems to really dislike high crit values in SetDefaults @@ -42,8 +42,8 @@ namespace CalamityMod.Items.Weapons.Magic int i = Main.myPlayer; int num73 = damage; float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; + num74 = player.GetWeaponKnockback(Item, num74); + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Magic value3.Normalize(); value2 = value2 * 4f + value3; value2.Normalize(); - value2 *= item.shootSpeed; + value2 *= Item.shootSpeed; float num91 = (float)Main.rand.Next(10, 80) * 0.001f; if (Main.rand.NextBool(2)) { diff --git a/Items/Weapons/Magic/ElementalRay.cs b/Items/Weapons/Magic/ElementalRay.cs index 270f71c14a..8170eed835 100644 --- a/Items/Weapons/Magic/ElementalRay.cs +++ b/Items/Weapons/Magic/ElementalRay.cs @@ -17,28 +17,28 @@ namespace CalamityMod.Items.Weapons.Magic "Nebula beams sweep a little bit over time\n" + "Vortex beams act like fast lightning and electrify enemies on hit\n" + "Stardust beams release small stars that home on enemy hits"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 90; - item.magic = true; - item.mana = 18; - item.width = 62; - item.height = 62; - item.useTime = 4; - item.useAnimation = 16; - item.reuseDelay = 14; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = 1; - item.shootSpeed = 6f; + Item.damage = 90; + Item.DamageType = DamageClass.Magic; + Item.mana = 18; + Item.width = 62; + Item.height = 62; + Item.useTime = 4; + Item.useAnimation = 16; + Item.reuseDelay = 14; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7.5f; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item60; + Item.autoReuse = true; + Item.shoot = 1; + Item.shootSpeed = 6f; } public override Vector2? HoldoutOrigin() => new Vector2(15); @@ -49,19 +49,19 @@ namespace CalamityMod.Items.Weapons.Magic offsetAngle += MathHelper.PiOver4 + Main.rand.NextFloat(0f, 1.3f); float shootSpeed = 1f; - if (player.itemAnimation == item.useAnimation - 1f) + if (player.itemAnimation == Item.useAnimation - 1f) type = ModContent.ProjectileType(); - else if (player.itemAnimation == item.useAnimation - item.useTime - 1) + else if (player.itemAnimation == Item.useAnimation - Item.useTime - 1) { type = ModContent.ProjectileType(); offsetAngle -= NebulaElementalBeam.UniversalAngularSpeed * 0.5f; } - else if (player.itemAnimation == item.useAnimation - item.useTime * 2 - 1) + else if (player.itemAnimation == Item.useAnimation - Item.useTime * 2 - 1) { type = ModContent.ProjectileType(); shootSpeed = 2f; } - else if (player.itemAnimation == item.useAnimation - item.useTime * 3 - 1) + else if (player.itemAnimation == Item.useAnimation - Item.useTime * 3 - 1) type = ModContent.ProjectileType(); else return false; @@ -81,13 +81,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs index 3fe47c2742..9ab2b4887b 100644 --- a/Items/Weapons/Magic/Eternity.cs +++ b/Items/Weapons/Magic/Eternity.cs @@ -28,30 +28,30 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = BaseDamage; - item.magic = true; - item.mana = 30; - item.width = 38; - item.height = 40; - item.useTime = item.useAnimation = 120; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 0f; + Item.damage = BaseDamage; + Item.DamageType = DamageClass.Magic; + Item.mana = 30; + Item.width = 38; + Item.height = 40; + Item.useTime = Item.useAnimation = 120; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 0f; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; - item.autoReuse = true; - item.noUseGraphic = true; - item.shoot = ModContent.ProjectileType(); - item.channel = true; - item.shootSpeed = 0f; + Item.autoReuse = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.channel = true; + Item.shootSpeed = 0f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void ModifyTooltips(List tooltips) { - var tt2 = tooltips.FirstOrDefault(x => x.Name == "Tooltip1" && x.mod == "Terraria"); + var tt2 = tooltips.FirstOrDefault(x => x.Name == "Tooltip1" && x.Mod == "Terraria"); tt2.text = $"[" + DisoHex + "There's pictures of ponies in the book]"; } public static string DisoHex => "c/" + @@ -59,18 +59,7 @@ namespace CalamityMod.Items.Weapons.Magic + 108.ToString("X2") + 251.ToString("X2") + ":"; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ItemID.UnicornHorn, 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.UnicornHorn, 5).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/EventHorizon.cs b/Items/Weapons/Magic/EventHorizon.cs index 3a48d472ba..5026f05fa4 100644 --- a/Items/Weapons/Magic/EventHorizon.cs +++ b/Items/Weapons/Magic/EventHorizon.cs @@ -19,26 +19,26 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.width = 40; - item.height = 46; + Item.width = 40; + Item.height = 46; - item.damage = 275; - item.knockBack = 3.5f; - item.noMelee = true; - item.magic = true; - item.mana = 12; + Item.damage = 275; + Item.knockBack = 3.5f; + Item.noMelee = true; + Item.DamageType = DamageClass.Magic; + Item.mana = 12; - item.useTime = item.useAnimation = 32; - item.useStyle = ItemUseStyleID.HoldingOut; - item.autoReuse = true; + Item.useTime = Item.useAnimation = 32; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.UseSound = SoundID.Item84; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 25f; + Item.UseSound = SoundID.Item84; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 25f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -53,15 +53,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/EvergladeSpray.cs b/Items/Weapons/Magic/EvergladeSpray.cs index 4a1ae4ba7b..2ad774d7bc 100644 --- a/Items/Weapons/Magic/EvergladeSpray.cs +++ b/Items/Weapons/Magic/EvergladeSpray.cs @@ -16,38 +16,28 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 28; - item.magic = true; - item.mana = 8; - item.width = 34; - item.height = 30; - item.useTime = 6; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item13; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.damage = 28; + Item.DamageType = DamageClass.Magic; + Item.mana = 8; + Item.width = 34; + Item.height = 30; + Item.useTime = 6; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4.5f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item13; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldenShower); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CursedFlames); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.GoldenShower).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.Bookcases).Register(); + CreateRecipe(1).AddIngredient(ItemID.CursedFlames).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs index d3a8abe281..ae6aac6db7 100644 --- a/Items/Weapons/Magic/Fabstaff.cs +++ b/Items/Weapons/Magic/Fabstaff.cs @@ -14,30 +14,30 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Fabstaff"); Tooltip.SetDefault("Casts a bouncing beam that splits when enemies are near it"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 125; - item.magic = true; - item.mana = 50; - item.width = 84; - item.height = 84; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; + Item.damage = 125; + Item.DamageType = DamageClass.Magic; + Item.mana = 50; + Item.width = 84; + Item.height = 84; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13.5f; + Item.UseSound = SoundID.Item60; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13.5f; } public override Vector2? HoldoutOrigin() @@ -47,13 +47,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RainbowRod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RainbowRod).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/FaceMelter.cs b/Items/Weapons/Magic/FaceMelter.cs index 3201f0e701..1befc78a96 100644 --- a/Items/Weapons/Magic/FaceMelter.cs +++ b/Items/Weapons/Magic/FaceMelter.cs @@ -20,40 +20,32 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 140; - item.magic = true; - item.mana = 10; - item.width = 56; - item.height = 50; - item.useTime = 5; - item.useAnimation = 10; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; + Item.damage = 140; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 56; + Item.height = 50; + Item.useTime = 5; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.UseSound = SoundID.Item47; - item.autoReuse = true; - item.shootSpeed = 20f; + Item.shoot = ModContent.ProjectileType(); + Item.UseSound = SoundID.Item47; + Item.autoReuse = true; + Item.shootSpeed = 20f; } public override Vector2? HoldoutOffset() => new Vector2(-15, 0); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TheAxe); - recipe.AddIngredient(ItemID.MagicalHarp); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.TheAxe).AddIngredient(ItemID.MagicalHarp).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } public override bool AltFunctionUse(Player player) => true; @@ -62,13 +54,13 @@ namespace CalamityMod.Items.Weapons.Magic { if (player.altFunctionUse == 2) { - item.useTime = 20; - item.useAnimation = 20; + Item.useTime = 20; + Item.useAnimation = 20; } else { - item.useTime = 5; - item.useAnimation = 10; + Item.useTime = 5; + Item.useAnimation = 10; } return base.CanUseItem(player); } diff --git a/Items/Weapons/Magic/FatesReveal.cs b/Items/Weapons/Magic/FatesReveal.cs index 1e74e5475a..0458ff59a8 100644 --- a/Items/Weapons/Magic/FatesReveal.cs +++ b/Items/Weapons/Magic/FatesReveal.cs @@ -14,33 +14,33 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Fate's Reveal"); Tooltip.SetDefault("Spawns ghostly fireballs that follow the player"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 120; - item.magic = true; - item.mana = 20; - item.width = 80; - item.height = 86; - item.useTime = 16; - item.useAnimation = 16; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; + Item.damage = 120; + Item.DamageType = DamageClass.Magic; + Item.mana = 20; + Item.width = 80; + Item.height = 86; + Item.useTime = 16; + Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/FatesRevealGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/FatesRevealGlow")); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -57,11 +57,11 @@ namespace CalamityMod.Items.Weapons.Magic { num78 = (float)player.direction; num79 = 0f; - num80 = item.shootSpeed; + num80 = Item.shootSpeed; } else { - num80 = item.shootSpeed / num80; + num80 = Item.shootSpeed / num80; } vector += new Vector2(num78, num79); diff --git a/Items/Weapons/Magic/FlareBolt.cs b/Items/Weapons/Magic/FlareBolt.cs index 1c23ae885e..ef73fac788 100644 --- a/Items/Weapons/Magic/FlareBolt.cs +++ b/Items/Weapons/Magic/FlareBolt.cs @@ -15,34 +15,27 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 42; - item.magic = true; - item.mana = 12; - item.width = 28; - item.height = 30; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7.5f; + Item.damage = 42; + Item.DamageType = DamageClass.Magic; + Item.mana = 12; + Item.width = 28; + Item.height = 30; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7.5f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 6); - recipe.AddIngredient(ItemID.Obsidian, 9); - recipe.AddIngredient(ItemID.Fireblossom, 2); - recipe.AddIngredient(ItemID.LavaBucket); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HellstoneBar, 6).AddIngredient(ItemID.Obsidian, 9).AddIngredient(ItemID.Fireblossom, 2).AddIngredient(ItemID.LavaBucket).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/ForbiddenSun.cs b/Items/Weapons/Magic/ForbiddenSun.cs index 18d6a6dd32..dcdd3a83ad 100644 --- a/Items/Weapons/Magic/ForbiddenSun.cs +++ b/Items/Weapons/Magic/ForbiddenSun.cs @@ -16,31 +16,26 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 80; - item.magic = true; - item.mana = 33; - item.width = 28; - item.height = 30; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + Item.damage = 80; + Item.DamageType = DamageClass.Magic; + Item.mana = 33; + Item.width = 28; + Item.height = 30; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpellTome); //Living Fire Blocks were CRINGE! - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpellTome).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/FrigidflashBolt.cs b/Items/Weapons/Magic/FrigidflashBolt.cs index 9e5b10f31e..0f07f36dd3 100644 --- a/Items/Weapons/Magic/FrigidflashBolt.cs +++ b/Items/Weapons/Magic/FrigidflashBolt.cs @@ -15,34 +15,27 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 45; - item.magic = true; - item.mana = 13; - item.width = 28; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item21; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6.5f; + Item.damage = 45; + Item.DamageType = DamageClass.Magic; + Item.mana = 13; + Item.width = 28; + Item.height = 30; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item21; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6.5f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/FrostBolt.cs b/Items/Weapons/Magic/FrostBolt.cs index bfa73303f4..86e7466ec7 100644 --- a/Items/Weapons/Magic/FrostBolt.cs +++ b/Items/Weapons/Magic/FrostBolt.cs @@ -15,34 +15,27 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 14; - item.magic = true; - item.mana = 6; - item.width = 28; - item.height = 30; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; + Item.damage = 14; + Item.DamageType = DamageClass.Magic; + Item.mana = 6; + Item.width = 28; + Item.height = 30; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item8; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyIceBlock", 20); - recipe.AddIngredient(ItemID.Shiverthorn, 2); - recipe.AddRecipeGroup("AnySnowBlock", 10); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyIceBlock", 20).AddIngredient(ItemID.Shiverthorn, 2).AddRecipeGroup("AnySnowBlock", 10).AddIngredient(ItemID.WaterBucket).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/GammaFusillade.cs b/Items/Weapons/Magic/GammaFusillade.cs index 327973e85c..fd54cd7fe8 100644 --- a/Items/Weapons/Magic/GammaFusillade.cs +++ b/Items/Weapons/Magic/GammaFusillade.cs @@ -15,33 +15,28 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 80; - item.magic = true; - item.mana = 4; - item.width = 28; - item.height = 30; - item.useTime = 3; - item.useAnimation = 3; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.damage = 80; + Item.DamageType = DamageClass.Magic; + Item.mana = 4; + Item.width = 28; + Item.height = 30; + Item.useTime = 3; + Item.useAnimation = 3; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item33; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpellTome); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpellTome).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/Genisis.cs b/Items/Weapons/Magic/Genisis.cs index d7419c9ef4..2cd02036ce 100644 --- a/Items/Weapons/Magic/Genisis.cs +++ b/Items/Weapons/Magic/Genisis.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 56; - item.magic = true; - item.mana = 4; - item.width = 74; - item.height = 28; - item.useTime = 4; - item.useAnimation = 4; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 6f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 56; + Item.DamageType = DamageClass.Magic; + Item.mana = 4; + Item.width = 74; + Item.height = 28; + Item.useTime = 4; + Item.useAnimation = 4; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item33; + Item.autoReuse = true; + Item.shootSpeed = 6f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() @@ -56,13 +56,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LaserMachinegun); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LaserMachinegun).AddIngredient(ItemID.LunarBar, 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/GhastlyVisage.cs b/Items/Weapons/Magic/GhastlyVisage.cs index 9fb0b8a40c..49f0466c33 100644 --- a/Items/Weapons/Magic/GhastlyVisage.cs +++ b/Items/Weapons/Magic/GhastlyVisage.cs @@ -17,31 +17,31 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 80; - item.magic = true; - item.noUseGraphic = true; - item.channel = true; - item.mana = 20; - item.width = 32; - item.height = 36; - item.useTime = 27; - item.useAnimation = 27; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.shootSpeed = 9f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 80; + Item.DamageType = DamageClass.Magic; + Item.noUseGraphic = true; + Item.channel = true; + Item.mana = 20; + Item.width = 32; + Item.height = 36; + Item.useTime = 27; + Item.useAnimation = 27; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.shootSpeed = 9f; + Item.shoot = ModContent.ProjectileType(); - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } // This weapon uses a holdout projectile. - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/GhastlyVisageGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/GhastlyVisageGlow")); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/GleamingMagnolia.cs b/Items/Weapons/Magic/GleamingMagnolia.cs index b5b6f7f8c8..1f4344f43a 100644 --- a/Items/Weapons/Magic/GleamingMagnolia.cs +++ b/Items/Weapons/Magic/GleamingMagnolia.cs @@ -12,27 +12,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Gleaming Magnolia"); Tooltip.SetDefault("Casts a gleaming flower that explodes into petals"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 32; - item.magic = true; - item.mana = 11; - item.width = 52; - item.height = 54; - item.useTime = 27; - item.useAnimation = 27; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.damage = 32; + Item.DamageType = DamageClass.Magic; + Item.mana = 11; + Item.width = 52; + Item.height = 54; + Item.useTime = 27; + Item.useAnimation = 27; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item109; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; } public override Vector2? HoldoutOrigin() @@ -42,12 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.HallowedBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.HallowedBar, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Magic/GloriousEnd.cs b/Items/Weapons/Magic/GloriousEnd.cs index 29f361ea8a..ae6eb29cd9 100644 --- a/Items/Weapons/Magic/GloriousEnd.cs +++ b/Items/Weapons/Magic/GloriousEnd.cs @@ -21,25 +21,25 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 120; - item.knockBack = 10f; - item.useTime = item.useAnimation = 30; - item.mana = 20; - item.magic = true; - item.channel = true; - item.shootSpeed = 7f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 120; + Item.knockBack = 10f; + Item.useTime = Item.useAnimation = 30; + Item.mana = 20; + Item.DamageType = DamageClass.Magic; + Item.channel = true; + Item.shootSpeed = 7f; + Item.shoot = ModContent.ProjectileType(); - item.width = 30; - item.height = 58; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.UseSound = SoundID.Item9; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.Calamity().donorItem = true; + Item.width = 30; + Item.height = 58; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.UseSound = SoundID.Item9; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.Calamity().donorItem = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } } diff --git a/Items/Weapons/Magic/GruesomeEminence.cs b/Items/Weapons/Magic/GruesomeEminence.cs index 37609baa67..d89e61cc69 100644 --- a/Items/Weapons/Magic/GruesomeEminence.cs +++ b/Items/Weapons/Magic/GruesomeEminence.cs @@ -22,31 +22,31 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 888; - item.magic = true; - item.noUseGraphic = true; - item.channel = true; - item.mana = 8; - item.width = 42; - item.height = 74; - item.useTime = 27; - item.useAnimation = 27; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.shootSpeed = 9f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 888; + Item.DamageType = DamageClass.Magic; + Item.noUseGraphic = true; + Item.channel = true; + Item.mana = 8; + Item.width = 42; + Item.height = 74; + Item.useTime = 27; + Item.useAnimation = 27; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.shootSpeed = 9f; + Item.shoot = ModContent.ProjectileType(); - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; } // This weapon uses a holdout projectile. - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, item.shoot, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, Item.shoot, damage, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Magic/HadopelagicEcho.cs b/Items/Weapons/Magic/HadopelagicEcho.cs index 566ad47f78..36ebb6efe0 100644 --- a/Items/Weapons/Magic/HadopelagicEcho.cs +++ b/Items/Weapons/Magic/HadopelagicEcho.cs @@ -21,23 +21,23 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 500; - item.magic = true; - item.mana = 15; - item.width = 60; - item.height = 60; - item.useTime = 8; - item.reuseDelay = 20; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = ItemRarityID.Red; - item.autoReuse = true; - item.shootSpeed = 10f; - item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.Violet; + Item.damage = 500; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; + Item.width = 60; + Item.height = 60; + Item.useTime = 8; + Item.reuseDelay = 20; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.value = Item.buyPrice(2, 50, 0, 0); + Item.rare = ItemRarityID.Red; + Item.autoReuse = true; + Item.shootSpeed = 10f; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().customRarity = CalamityRarity.Violet; } public override Vector2? HoldoutOffset() @@ -56,15 +56,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/HarvestStaff.cs b/Items/Weapons/Magic/HarvestStaff.cs index ad90a2e18b..f038d163a1 100644 --- a/Items/Weapons/Magic/HarvestStaff.cs +++ b/Items/Weapons/Magic/HarvestStaff.cs @@ -12,28 +12,28 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Harvest Staff"); Tooltip.SetDefault("Casts flaming pumpkins"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 26; - item.magic = true; - item.mana = 5; - item.width = 46; - item.height = 44; - item.useTime = 23; - item.useAnimation = 23; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.scale = 0.9f; + Item.damage = 26; + Item.DamageType = DamageClass.Magic; + Item.mana = 5; + Item.width = 46; + Item.height = 44; + Item.useTime = 23; + Item.useAnimation = 23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.scale = 0.9f; } public override Vector2? HoldoutOrigin() @@ -43,12 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Pumpkin, 20); - recipe.AddIngredient(ItemID.FallenStar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Pumpkin, 20).AddIngredient(ItemID.FallenStar, 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index ca35862db6..d7f172d790 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -16,31 +16,31 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Helium Flash"); Tooltip.SetDefault("The power of a galaxy, if only for mere moments\n" + "Launches volatile star cores which erupt into colossal fusion blasts"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.width = 112; - item.height = 112; - item.magic = true; - item.damage = 2727; - item.knockBack = 9.5f; - item.mana = 26; - item.useAnimation = 40; - item.useTime = 40; - item.autoReuse = true; - item.noMelee = true; + Item.width = 112; + Item.height = 112; + Item.DamageType = DamageClass.Magic; + Item.damage = 2727; + Item.knockBack = 9.5f; + Item.mana = 26; + Item.useAnimation = 40; + Item.useTime = 40; + Item.autoReuse = true; + Item.noMelee = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item73; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item73; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; } // TODO -- Fancy visual flare doesn't work with resprited Helium Flash, adjust dust positions @@ -96,16 +96,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ItemID.FragmentSolar, 20); - r.AddIngredient(ItemID.FragmentNebula, 5); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddTile(ModContent.TileType()); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.FragmentSolar, 20).AddIngredient(ItemID.FragmentNebula, 5).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/HellBurst.cs b/Items/Weapons/Magic/HellBurst.cs index 979b5b2b30..be6a973dce 100644 --- a/Items/Weapons/Magic/HellBurst.cs +++ b/Items/Weapons/Magic/HellBurst.cs @@ -15,35 +15,27 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 30; - item.magic = true; - item.mana = 14; - item.width = 52; - item.height = 52; - item.useTime = 31; - item.useAnimation = 31; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item34; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 32f; + Item.damage = 30; + Item.DamageType = DamageClass.Magic; + Item.mana = 14; + Item.width = 52; + Item.height = 52; + Item.useTime = 31; + Item.useAnimation = 31; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 7f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item34; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 32f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Flamelash); - recipe.AddIngredient(ItemID.CrystalVileShard); - recipe.AddIngredient(ItemID.DarkShard, 2); - recipe.AddIngredient(ItemID.SoulofNight, 10); - recipe.AddIngredient(ItemID.SoulofFright, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Flamelash).AddIngredient(ItemID.CrystalVileShard).AddIngredient(ItemID.DarkShard, 2).AddIngredient(ItemID.SoulofNight, 10).AddIngredient(ItemID.SoulofFright, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Magic/HellwingStaff.cs b/Items/Weapons/Magic/HellwingStaff.cs index 9512987f23..506d647e17 100644 --- a/Items/Weapons/Magic/HellwingStaff.cs +++ b/Items/Weapons/Magic/HellwingStaff.cs @@ -13,27 +13,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Hellwing Staff"); Tooltip.SetDefault("Casts flaming bats"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 33; - item.magic = true; - item.mana = 18; - item.width = 54; - item.height = 52; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + Item.damage = 33; + Item.DamageType = DamageClass.Magic; + Item.mana = 18; + Item.width = 54; + Item.height = 52; + Item.useTime = 24; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item43; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; } public override Vector2? HoldoutOrigin() @@ -43,17 +43,12 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 7); - recipe.AddIngredient(ItemID.LavaBucket, 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HellstoneBar, 7).AddIngredient(ItemID.LavaBucket, 2).AddTile(TileID.Anvils).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; diff --git a/Items/Weapons/Magic/Hematemesis.cs b/Items/Weapons/Magic/Hematemesis.cs index 4d7d6b997b..ea9fe6a700 100644 --- a/Items/Weapons/Magic/Hematemesis.cs +++ b/Items/Weapons/Magic/Hematemesis.cs @@ -12,27 +12,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Hematemesis"); Tooltip.SetDefault("Casts a barrage of blood geysers from below"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 75; - item.magic = true; - item.mana = 14; - item.rare = ItemRarityID.Yellow; - item.width = 48; - item.height = 54; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.75f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.UseSound = SoundID.Item21; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.damage = 75; + Item.DamageType = DamageClass.Magic; + Item.mana = 14; + Item.rare = ItemRarityID.Yellow; + Item.width = 48; + Item.height = 54; + Item.useTime = 22; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.75f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.UseSound = SoundID.Item21; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override Vector2? HoldoutOrigin() => new Vector2(15, 15); diff --git a/Items/Weapons/Magic/Heresy.cs b/Items/Weapons/Magic/Heresy.cs index d8dd154d14..833d974f85 100644 --- a/Items/Weapons/Magic/Heresy.cs +++ b/Items/Weapons/Magic/Heresy.cs @@ -13,32 +13,32 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Heresy"); Tooltip.SetDefault("Releases fire and souls upward from a held book\n" + "As the book is held the power of both increases"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); } public override void SetDefaults() { - item.damage = 888; - item.magic = true; - item.mana = 10; - item.width = 38; - item.height = 40; - item.useTime = item.useAnimation = 120; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.UseSound = SoundID.DD2_EtherianPortalDryadTouch; - item.knockBack = 0f; + Item.damage = 888; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 38; + Item.height = 40; + Item.useTime = Item.useAnimation = 120; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.UseSound = SoundID.DD2_EtherianPortalDryadTouch; + Item.knockBack = 0f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; - item.autoReuse = true; - item.noUseGraphic = true; - item.shoot = ModContent.ProjectileType(); - item.channel = true; - item.shootSpeed = 0f; + Item.autoReuse = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.channel = true; + Item.shootSpeed = 0f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } } diff --git a/Items/Weapons/Magic/HyphaeRod.cs b/Items/Weapons/Magic/HyphaeRod.cs index 33683c0588..e1d2cf2627 100644 --- a/Items/Weapons/Magic/HyphaeRod.cs +++ b/Items/Weapons/Magic/HyphaeRod.cs @@ -11,34 +11,34 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Hyphae Rod"); Tooltip.SetDefault("Creates mushroom spores near the player"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 20; - item.magic = true; - item.mana = 7; - item.width = 34; - item.height = 34; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = ProjectileID.TruffleSpore; - item.shootSpeed = 1f; + Item.damage = 20; + Item.DamageType = DamageClass.Magic; + Item.mana = 7; + Item.width = 34; + Item.height = 34; + Item.useTime = 24; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item8; + Item.autoReuse = true; + Item.shoot = ProjectileID.TruffleSpore; + Item.shootSpeed = 1f; } public override Vector2? HoldoutOrigin() => new Vector2(15, 15); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float speed = item.shootSpeed; + float speed = Item.shootSpeed; Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); float xDist = (float)Main.mouseX + Main.screenPosition.X + source.X; float yDist = (float)Main.mouseY + Main.screenPosition.Y + source.Y; diff --git a/Items/Weapons/Magic/IceBarrage.cs b/Items/Weapons/Magic/IceBarrage.cs index 12ef782e39..779adefd8b 100644 --- a/Items/Weapons/Magic/IceBarrage.cs +++ b/Items/Weapons/Magic/IceBarrage.cs @@ -21,31 +21,31 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.width = 60; - item.height = 60; - item.useStyle = ItemUseStyleID.HoldingUp; - item.magic = true; - item.mana = 180; - item.noMelee = true; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/IceBarrageCast"); + Item.width = 60; + Item.height = 60; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.DamageType = DamageClass.Magic; + Item.mana = 180; + Item.noMelee = true; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/IceBarrageCast"); - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().donorItem = true; - item.damage = 2250; - item.knockBack = 6f; - item.useTime = 300; - item.useAnimation = 300; - item.reuseDelay = 60; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 2f; - item.useAmmo = ModContent.ItemType(); + Item.damage = 2250; + Item.knockBack = 6f; + Item.useTime = 300; + Item.useAnimation = 300; + Item.reuseDelay = 60; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 2f; + Item.useAmmo = ModContent.ItemType(); } public override bool CanUseItem(Player player) { - return CalamityGlobalItem.HasEnoughAmmo(player, item, 2); + return CalamityGlobalItem.HasEnoughAmmo(player, Item, 2); } public override bool ConsumeAmmo(Player player) @@ -60,23 +60,14 @@ namespace CalamityMod.Items.Weapons.Magic vector2.Y = Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); - CalamityGlobalItem.ConsumeAdditionalAmmo(player, item, 2); + CalamityGlobalItem.ConsumeAdditionalAmmo(player, Item, 2); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BlizzardStaff); - recipe.AddIngredient(ItemID.IceRod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BlizzardStaff).AddIngredient(ItemID.IceRod).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 40).AddIngredient(ModContent.ItemType(), 18).AddTile(TileID.IceMachine).Register(); } public override void UseStyle(Player player) diff --git a/Items/Weapons/Magic/IcicleStaff.cs b/Items/Weapons/Magic/IcicleStaff.cs index 35c8c0cb86..289f07f1af 100644 --- a/Items/Weapons/Magic/IcicleStaff.cs +++ b/Items/Weapons/Magic/IcicleStaff.cs @@ -13,27 +13,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Icicle Staff"); Tooltip.SetDefault("Casts icicles from the sky"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 10; - item.magic = true; - item.mana = 6; - item.width = 44; - item.height = 44; - item.useTime = 7; - item.useAnimation = 14; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11f; + Item.damage = 10; + Item.DamageType = DamageClass.Magic; + Item.mana = 6; + Item.width = 44; + Item.height = 44; + Item.useTime = 7; + Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item8; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; } public override Vector2? HoldoutOrigin() @@ -43,22 +43,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyIceBlock", 25); - recipe.AddIngredient(ItemID.Shiverthorn, 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyIceBlock", 25).AddIngredient(ItemID.Shiverthorn, 3).AddTile(TileID.Anvils).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = item.damage; - float num74 = item.knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; + float num72 = Item.shootSpeed; + int num73 = Item.damage; + float num74 = Item.knockBack; + num74 = player.GetWeaponKnockback(Item, num74); + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX - Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY - Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Magic/IcicleTrident.cs b/Items/Weapons/Magic/IcicleTrident.cs index d3f8dd24e2..03b3393d42 100644 --- a/Items/Weapons/Magic/IcicleTrident.cs +++ b/Items/Weapons/Magic/IcicleTrident.cs @@ -12,26 +12,26 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Icicle Trident"); Tooltip.SetDefault("Shoots piercing icicles"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 69; - item.magic = true; - item.mana = 21; - item.width = item.height = 44; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.damage = 69; + Item.DamageType = DamageClass.Magic; + Item.mana = 21; + Item.width = Item.height = 44; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTurn = false; + Item.noMelee = true; + Item.knockBack = 7f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item8; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override Vector2? HoldoutOrigin() diff --git a/Items/Weapons/Magic/InfernalRift.cs b/Items/Weapons/Magic/InfernalRift.cs index 36d71476c6..ba4007ea5c 100644 --- a/Items/Weapons/Magic/InfernalRift.cs +++ b/Items/Weapons/Magic/InfernalRift.cs @@ -13,28 +13,28 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Infernal Rift"); Tooltip.SetDefault("Summons infernal blades that spawn additional blades on enemy hits"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 40; - item.magic = true; - item.mana = 15; - item.width = 16; - item.height = 16; - item.useAnimation = 16; - item.useTime = 4; - item.reuseDelay = item.useAnimation + 6; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.damage = 40; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; + Item.width = 16; + Item.height = 16; + Item.useAnimation = 16; + Item.useTime = 4; + Item.reuseDelay = Item.useAnimation + 6; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item9; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; } // Terraria seems to really dislike high crit values in SetDefaults @@ -44,19 +44,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SkyFracture); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SkyFracture).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.SoulofFright, 10).AddTile(TileID.MythrilAnvil).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; float f = Main.rand.NextFloat() * 6.28318548f; diff --git a/Items/Weapons/Magic/IonBlaster.cs b/Items/Weapons/Magic/IonBlaster.cs index d3d8136d8f..b8b5f60a91 100644 --- a/Items/Weapons/Magic/IonBlaster.cs +++ b/Items/Weapons/Magic/IonBlaster.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 43; - item.width = 44; - item.height = 28; - item.magic = true; - item.mana = 6; - item.useAnimation = 10; - item.useTime = 10; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item91; - item.autoReuse = true; - item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 3f; + Item.damage = 43; + Item.width = 44; + Item.height = 28; + Item.DamageType = DamageClass.Magic; + Item.mana = 6; + Item.useAnimation = 10; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 5.5f; + Item.UseSound = SoundID.Item91; + Item.autoReuse = true; + Item.noMelee = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 3f; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); @@ -57,12 +57,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddRecipeGroup("AnyAdamantiteBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SoulofFright, 10).AddRecipeGroup("AnyAdamantiteBar", 7).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Magic/Judgement.cs b/Items/Weapons/Magic/Judgement.cs index b344f46bd7..6bac7a5b99 100644 --- a/Items/Weapons/Magic/Judgement.cs +++ b/Items/Weapons/Magic/Judgement.cs @@ -32,27 +32,27 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.width = 40; - item.height = 42; - item.damage = 415; - item.knockBack = 4f; - item.magic = true; - item.mana = 6; + Item.width = 40; + Item.height = 42; + Item.damage = 415; + Item.knockBack = 4f; + Item.DamageType = DamageClass.Magic; + Item.mana = 6; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 2; - item.useAnimation = 8; - item.reuseDelay = 5; - item.UseSound = SoundID.Item105; - item.autoReuse = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 2; + Item.useAnimation = 8; + Item.reuseDelay = 5; + Item.UseSound = SoundID.Item105; + Item.autoReuse = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -87,14 +87,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SkyFracture); - recipe.AddIngredient(ItemID.LunarFlareBook); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SkyFracture).AddIngredient(ItemID.LunarFlareBook).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/Keelhaul.cs b/Items/Weapons/Magic/Keelhaul.cs index 5940f9615e..4db8359a47 100644 --- a/Items/Weapons/Magic/Keelhaul.cs +++ b/Items/Weapons/Magic/Keelhaul.cs @@ -15,26 +15,26 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.width = 42; - item.height = 42; - item.damage = 55; - item.mana = 50; - item.magic = true; - item.noMelee = true; - item.useTime = 30; - item.useAnimation = 30; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 2f; - item.UseSound = SoundID.Item102; - item.autoReuse = true; + Item.width = 42; + Item.height = 42; + Item.damage = 55; + Item.mana = 50; + Item.DamageType = DamageClass.Magic; + Item.noMelee = true; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 2f; + Item.UseSound = SoundID.Item102; + Item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; } } } diff --git a/Items/Weapons/Magic/Lazhar.cs b/Items/Weapons/Magic/Lazhar.cs index f0c0714f50..689ec94e49 100644 --- a/Items/Weapons/Magic/Lazhar.cs +++ b/Items/Weapons/Magic/Lazhar.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 100; - item.magic = true; - item.mana = 4; - item.width = 42; - item.height = 20; - item.useTime = 7; - item.useAnimation = 7; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item12; - item.autoReuse = true; - item.shootSpeed = 15f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 100; + Item.DamageType = DamageClass.Magic; + Item.mana = 4; + Item.width = 42; + Item.height = 20; + Item.useTime = 7; + Item.useAnimation = 7; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item12; + Item.autoReuse = true; + Item.shootSpeed = 15f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); @@ -46,14 +46,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HeatRay); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddIngredient(ItemID.ChlorophyteBar, 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HeatRay).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.FragmentSolar, 10).AddIngredient(ItemID.ChlorophyteBar, 6).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/LightGodsBrilliance.cs b/Items/Weapons/Magic/LightGodsBrilliance.cs index a96c691fb6..62e2b41e12 100644 --- a/Items/Weapons/Magic/LightGodsBrilliance.cs +++ b/Items/Weapons/Magic/LightGodsBrilliance.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 64; - item.magic = true; - item.mana = 4; - item.width = 34; - item.height = 36; - item.useTime = item.useAnimation = 4; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().donorItem = true; - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 25f; + Item.damage = 64; + Item.DamageType = DamageClass.Magic; + Item.mana = 4; + Item.width = 34; + Item.height = 36; + Item.useTime = Item.useAnimation = 4; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().donorItem = true; + Item.UseSound = SoundID.Item9; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 25f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -49,17 +49,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.HolyWater, 10); - recipe.AddIngredient(ItemID.SoulofLight, 30); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.HolyWater, 10).AddIngredient(ItemID.SoulofLight, 30).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs index 159170ac99..027de6069f 100644 --- a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs +++ b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs @@ -35,27 +35,27 @@ namespace CalamityMod.Items.Weapons.Magic // Ozzatron 09FEB2021 public override void SetDefaults() { - item.width = 26; - item.height = 36; + Item.width = 26; + Item.height = 36; - item.damage = 182; - item.magic = true; - item.noUseGraphic = true; - item.mana = 12; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; + Item.damage = 182; + Item.DamageType = DamageClass.Magic; + Item.noUseGraphic = true; + Item.mana = 12; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; - item.UseSound = SoundID.Item106; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 19f; + Item.UseSound = SoundID.Item106; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 19f; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().donorItem = true; } public override bool AltFunctionUse(Player player) => true; @@ -77,16 +77,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ToxicFlask); - recipe.AddIngredient(ItemID.BottledWater, 15); - recipe.AddIngredient(ItemID.Leather, 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - // the recipe previously also used the individual cores for some reason - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ToxicFlask).AddIngredient(ItemID.BottledWater, 15).AddIngredient(ItemID.Leather, 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.AlchemyTable).Register(); } } } diff --git a/Items/Weapons/Magic/MagnaCannon.cs b/Items/Weapons/Magic/MagnaCannon.cs index 181429d4b7..618fa044e4 100644 --- a/Items/Weapons/Magic/MagnaCannon.cs +++ b/Items/Weapons/Magic/MagnaCannon.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 26; - item.magic = true; - item.mana = 12; - item.width = 56; - item.height = 34; - item.useTime = 32; - item.useAnimation = 32; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item117; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 26; + Item.DamageType = DamageClass.Magic; + Item.mana = 12; + Item.width = 56; + Item.height = 34; + Item.useTime = 32; + Item.useAnimation = 32; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item117; + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() @@ -50,14 +50,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpaceGun); - recipe.AddIngredient(ItemID.Granite, 25); - recipe.AddIngredient(ItemID.Obsidian, 15); - recipe.AddIngredient(ItemID.Amber, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpaceGun).AddIngredient(ItemID.Granite, 25).AddIngredient(ItemID.Obsidian, 15).AddIngredient(ItemID.Amber, 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Magic/MagneticMeltdown.cs b/Items/Weapons/Magic/MagneticMeltdown.cs index 08d72198d7..9eaa283394 100644 --- a/Items/Weapons/Magic/MagneticMeltdown.cs +++ b/Items/Weapons/Magic/MagneticMeltdown.cs @@ -13,28 +13,28 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Magnetic Meltdown"); Tooltip.SetDefault("Launches a diamond cross of supercharged magnet spheres"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 60; - item.magic = true; - item.mana = 40; - item.width = 78; - item.height = 78; - item.useTime = 49; - item.useAnimation = 49; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.damage = 60; + Item.DamageType = DamageClass.Magic; + Item.mana = 40; + Item.width = 78; + Item.height = 78; + Item.useTime = 49; + Item.useAnimation = 49; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override Vector2? HoldoutOrigin() => new Vector2(15, 15); @@ -54,13 +54,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpectreStaff); - recipe.AddIngredient(ItemID.MagnetSphere); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpectreStaff).AddIngredient(ItemID.MagnetSphere).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/ManaRose.cs b/Items/Weapons/Magic/ManaRose.cs index 5fe077b470..8d5c62619c 100644 --- a/Items/Weapons/Magic/ManaRose.cs +++ b/Items/Weapons/Magic/ManaRose.cs @@ -12,27 +12,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Mana Rose"); Tooltip.SetDefault("Casts a mana flower that explodes into petals"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 20; - item.magic = true; - item.mana = 8; - item.width = 38; - item.height = 38; - item.useTime = 38; - item.useAnimation = 38; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.25f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.damage = 20; + Item.DamageType = DamageClass.Magic; + Item.mana = 8; + Item.width = 38; + Item.height = 38; + Item.useTime = 38; + Item.useAnimation = 38; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.25f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item109; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override Vector2? HoldoutOrigin() @@ -42,13 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.NaturesGift); - recipe.AddIngredient(ItemID.JungleRose); - recipe.AddIngredient(ItemID.Moonglow, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.NaturesGift).AddIngredient(ItemID.JungleRose).AddIngredient(ItemID.Moonglow, 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Magic/Miasma.cs b/Items/Weapons/Magic/Miasma.cs index 692ca5cd0e..bb722ce8d2 100644 --- a/Items/Weapons/Magic/Miasma.cs +++ b/Items/Weapons/Magic/Miasma.cs @@ -13,26 +13,26 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Miasma"); Tooltip.SetDefault("Fires a spread of gas clouds that slow down after hitting an enemy"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 40; - item.magic = true; - item.mana = 16; - item.width = 50; - item.height = 64; - item.useTime = item.useAnimation = 27; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.damage = 40; + Item.DamageType = DamageClass.Magic; + Item.mana = 16; + Item.width = 50; + Item.height = 64; + Item.useTime = Item.useAnimation = 27; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item8; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -48,13 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.NimbusRod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.NimbusRod).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Magic/Mistlestorm.cs b/Items/Weapons/Magic/Mistlestorm.cs index 8e75f7779c..e7a5111bd0 100644 --- a/Items/Weapons/Magic/Mistlestorm.cs +++ b/Items/Weapons/Magic/Mistlestorm.cs @@ -13,28 +13,28 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Mistlestorm"); Tooltip.SetDefault("Casts a storm of pine needles and leaves"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 45; - item.magic = true; - item.mana = 5; - item.width = 48; - item.height = 48; - item.useTime = 6; - item.useAnimation = 6; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.shoot = ProjectileID.PineNeedleFriendly; - item.shootSpeed = 24f; + Item.damage = 45; + Item.DamageType = DamageClass.Magic; + Item.mana = 5; + Item.width = 48; + Item.height = 48; + Item.useTime = 6; + Item.useAnimation = 6; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.Item39; + Item.autoReuse = true; + Item.shoot = ProjectileID.PineNeedleFriendly; + Item.shootSpeed = 24f; } public override Vector2? HoldoutOrigin() @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Magic speedX += (float)Main.rand.Next(-35, 36) * num110; speedY += (float)Main.rand.Next(-35, 36) * num110; float num84 = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - num84 = item.shootSpeed / num84; + num84 = Item.shootSpeed / num84; speedX *= num84; speedY *= num84; Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, (float)Main.rand.Next(0, 10 * (num107 + 1)), 0f); @@ -62,14 +62,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Razorpine); - recipe.AddIngredient(ItemID.LeafBlower); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Razorpine).AddIngredient(ItemID.LeafBlower).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/NightsRay.cs b/Items/Weapons/Magic/NightsRay.cs index 2f35fa20f7..63e96def1b 100644 --- a/Items/Weapons/Magic/NightsRay.cs +++ b/Items/Weapons/Magic/NightsRay.cs @@ -14,27 +14,27 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Night's Ray"); Tooltip.SetDefault("Fires a dark ray\n" + "When hitting enemies, they are hit by several new beams from their sides"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 24; - item.magic = true; - item.mana = 10; - item.width = 50; - item.height = 50; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.25f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item72; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; + Item.damage = 24; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 50; + Item.height = 50; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.25f; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item72; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; } public override Vector2? HoldoutOrigin() @@ -44,16 +44,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Vilethorn); - recipe.AddIngredient(ItemID.MagicMissile); - recipe.AddIngredient(ItemID.WandofSparking); - recipe.AddIngredient(ItemID.AmberStaff); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Vilethorn).AddIngredient(ItemID.MagicMissile).AddIngredient(ItemID.WandofSparking).AddIngredient(ItemID.AmberStaff).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Magic/NuclearFury.cs b/Items/Weapons/Magic/NuclearFury.cs index 68b34ca46e..2769b8def9 100644 --- a/Items/Weapons/Magic/NuclearFury.cs +++ b/Items/Weapons/Magic/NuclearFury.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 114; - item.magic = true; - item.mana = 13; - item.width = 38; - item.height = 40; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item84; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.damage = 114; + Item.DamageType = DamageClass.Magic; + Item.mana = 13; + Item.width = 38; + Item.height = 40; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item84; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -54,16 +54,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RazorbladeTyphoon); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ItemID.SoulofSight, 10); - recipe.AddIngredient(ItemID.UnicornHorn, 5); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RazorbladeTyphoon).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LunarBar, 5).AddIngredient(ItemID.SoulofSight, 10).AddIngredient(ItemID.UnicornHorn, 5).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs index 23f5b851a7..7e04f9718c 100644 --- a/Items/Weapons/Magic/ParasiticSceptor.cs +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -12,33 +12,33 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Parasitic Scepter"); Tooltip.SetDefault("Fires a spread of water leeches that latch onto enemies, dealing a stacking damage over time"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 12; - item.knockBack = 3f; - item.mana = 10; - item.useTime = item.useAnimation = 35; - item.autoReuse = true; - item.magic = true; - item.shootSpeed = 10f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 12; + Item.knockBack = 3f; + Item.mana = 10; + Item.useTime = Item.useAnimation = 35; + Item.autoReuse = true; + Item.DamageType = DamageClass.Magic; + Item.shootSpeed = 10f; + Item.shoot = ModContent.ProjectileType(); - item.width = item.height = 52; - item.UseSound = SoundID.Item46; - item.noMelee = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.rare = ItemRarityID.Green; - item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.width = Item.height = 52; + Item.UseSound = SoundID.Item46; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.rare = ItemRarityID.Green; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; } public override Vector2? HoldoutOrigin() => new Vector2(15, 15); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float speed = item.shootSpeed; + float speed = Item.shootSpeed; Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); float xDist = Main.mouseX + Main.screenPosition.X - playerPos.X; float yDist = Main.mouseY + Main.screenPosition.Y - playerPos.Y; diff --git a/Items/Weapons/Magic/PhantasmalFury.cs b/Items/Weapons/Magic/PhantasmalFury.cs index fbb1210012..6b8fb65478 100644 --- a/Items/Weapons/Magic/PhantasmalFury.cs +++ b/Items/Weapons/Magic/PhantasmalFury.cs @@ -13,28 +13,28 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Phantasmal Fury"); Tooltip.SetDefault("Casts a phantasmal bolt that explodes into more bolts"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 182; - item.magic = true; - item.mana = 20; - item.width = 62; - item.height = 60; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.damage = 182; + Item.DamageType = DamageClass.Magic; + Item.mana = 20; + Item.width = 62; + Item.height = 60; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7.5f; + Item.value = Item.buyPrice(1, 40, 0, 0); + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item43; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override Vector2? HoldoutOrigin() @@ -44,13 +44,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpectreStaff); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpectreStaff).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/PhoenixFlameBarrage.cs b/Items/Weapons/Magic/PhoenixFlameBarrage.cs index 6a924d41bb..c7289fccb4 100644 --- a/Items/Weapons/Magic/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Magic/PhoenixFlameBarrage.cs @@ -14,28 +14,28 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Phoenix Flame Barrage"); Tooltip.SetDefault("Baptism by holy fire\n" + "Casts a barrage of fire from the sky"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 150; - item.magic = true; - item.mana = 20; - item.width = 106; - item.height = 140; - item.useTime = 15; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 30f; + Item.damage = 150; + Item.DamageType = DamageClass.Magic; + Item.mana = 20; + Item.width = 106; + Item.height = 140; + Item.useTime = 15; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; } public override Vector2? HoldoutOrigin() @@ -45,8 +45,8 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; - player.itemTime = item.useTime; + float num72 = Item.shootSpeed; + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Magic/PlagueStaff.cs b/Items/Weapons/Magic/PlagueStaff.cs index fb7f39ddff..9e6bc7ada7 100644 --- a/Items/Weapons/Magic/PlagueStaff.cs +++ b/Items/Weapons/Magic/PlagueStaff.cs @@ -13,27 +13,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Plague Staff"); Tooltip.SetDefault("Fires a spread of plague fangs"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 78; - item.magic = true; - item.mana = 22; - item.width = 46; - item.height = 46; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.damage = 78; + Item.DamageType = DamageClass.Magic; + Item.mana = 22; + Item.width = 46; + Item.height = 46; + Item.useTime = 21; + Item.useAnimation = 21; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 8f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item43; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; } public override Vector2? HoldoutOrigin() @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); diff --git a/Items/Weapons/Magic/PlasmaRifle.cs b/Items/Weapons/Magic/PlasmaRifle.cs index 07738ded8d..6f0fcfbe94 100644 --- a/Items/Weapons/Magic/PlasmaRifle.cs +++ b/Items/Weapons/Magic/PlasmaRifle.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 160; - item.mana = 40; - item.magic = true; - item.width = 72; - item.height = 20; - item.useTime = item.useAnimation = 8; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 160; + Item.mana = 40; + Item.DamageType = DamageClass.Magic; + Item.width = 72; + Item.height = 20; + Item.useTime = Item.useAnimation = 8; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -44,11 +44,11 @@ namespace CalamityMod.Items.Weapons.Magic { if (player.altFunctionUse == 2) { - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); } else { - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); } return base.CanUseItem(player); } @@ -80,20 +80,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ToxicFlask); - recipe.AddIngredient(ItemID.Musket); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ToxicFlask); - recipe.AddIngredient(ItemID.TheUndertaker); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ToxicFlask).AddIngredient(ItemID.Musket).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1).AddIngredient(ItemID.ToxicFlask).AddIngredient(ItemID.TheUndertaker).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/PlasmaRod.cs b/Items/Weapons/Magic/PlasmaRod.cs index f596e92bb9..9981846f31 100644 --- a/Items/Weapons/Magic/PlasmaRod.cs +++ b/Items/Weapons/Magic/PlasmaRod.cs @@ -14,27 +14,27 @@ namespace CalamityMod.Items.Weapons.Magic Tooltip.SetDefault("Casts a low-damage plasma bolt\n" + "Shooting a tile will cause several bolts with increased damage to fire\n" + "Shooting an enemy will inflict shadowflame for a long duration"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 8; - item.magic = true; - item.mana = 10; - item.width = 40; - item.height = 40; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11f; + Item.damage = 8; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 40; + Item.height = 40; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.5f; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item109; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; } public override Vector2? HoldoutOrigin() diff --git a/Items/Weapons/Magic/Poseidon.cs b/Items/Weapons/Magic/Poseidon.cs index 9337d5f241..937f4a9cfc 100644 --- a/Items/Weapons/Magic/Poseidon.cs +++ b/Items/Weapons/Magic/Poseidon.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 48; - item.magic = true; - item.mana = 12; - item.width = 28; - item.height = 32; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.UseSound = SoundID.Item84; - item.rare = ItemRarityID.Pink; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.damage = 48; + Item.DamageType = DamageClass.Magic; + Item.mana = 12; + Item.width = 28; + Item.height = 32; + Item.useTime = 22; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.UseSound = SoundID.Item84; + Item.rare = ItemRarityID.Pink; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/PrimordialAncient.cs b/Items/Weapons/Magic/PrimordialAncient.cs index 493f1a97e2..3ce3d03653 100644 --- a/Items/Weapons/Magic/PrimordialAncient.cs +++ b/Items/Weapons/Magic/PrimordialAncient.cs @@ -17,35 +17,28 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 170; - item.magic = true; - item.mana = 20; - item.width = 40; - item.height = 56; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.damage = 170; + Item.DamageType = DamageClass.Magic; + Item.mana = 20; + Item.width = 40; + Item.height = 56; + Item.useTime = 18; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 5); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.AncientBattleArmorMaterial, 5).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/PrimordialEarth.cs b/Items/Weapons/Magic/PrimordialEarth.cs index 84e34ef27a..671e4805e6 100644 --- a/Items/Weapons/Magic/PrimordialEarth.cs +++ b/Items/Weapons/Magic/PrimordialEarth.cs @@ -15,34 +15,27 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 60; - item.magic = true; - item.mana = 19; - item.width = 36; - item.height = 42; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 4f; + Item.damage = 60; + Item.DamageType = DamageClass.Magic; + Item.mana = 19; + Item.width = 36; + Item.height = 42; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 4f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 3); - recipe.AddIngredient(ItemID.MeteoriteBar, 5); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.AncientBattleArmorMaterial, 3).AddIngredient(ItemID.MeteoriteBar, 5).AddIngredient(ItemID.Ectoplasm, 5).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/Purge.cs b/Items/Weapons/Magic/Purge.cs index 9063216e79..311f102649 100644 --- a/Items/Weapons/Magic/Purge.cs +++ b/Items/Weapons/Magic/Purge.cs @@ -18,35 +18,29 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 73; - item.magic = true; - item.mana = 6; - item.width = 62; - item.height = 34; - item.useTime = item.useAnimation = UseTime; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 3f; - item.rare = ItemRarityID.Red; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.damage = 73; + Item.DamageType = DamageClass.Magic; + Item.mana = 6; + Item.width = 62; + Item.height = 34; + Item.useTime = Item.useAnimation = UseTime; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.knockBack = 3f; + Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LaserMachinegun); - recipe.AddIngredient(ItemID.FragmentVortex, 20); - recipe.AddIngredient(ItemID.Nanites, 100); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LaserMachinegun).AddIngredient(ItemID.FragmentVortex, 20).AddIngredient(ItemID.Nanites, 100).AddTile(TileID.LunarCraftingStation).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/PurgeGuzzler.cs b/Items/Weapons/Magic/PurgeGuzzler.cs index 16f745702b..2ca9c11c59 100644 --- a/Items/Weapons/Magic/PurgeGuzzler.cs +++ b/Items/Weapons/Magic/PurgeGuzzler.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.width = 58; - item.height = 44; - item.damage = 120; - item.magic = true; - item.mana = 22; - item.useTime = 24; - item.useAnimation = 24; - item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4.5f; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; + Item.width = 58; + Item.height = 44; + Item.damage = 120; + Item.DamageType = DamageClass.Magic; + Item.mana = 22; + Item.useTime = 24; + Item.useAnimation = 24; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4.5f; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/RainbowPartyCannon.cs b/Items/Weapons/Magic/RainbowPartyCannon.cs index 8fc5c79918..08a0baaf2a 100644 --- a/Items/Weapons/Magic/RainbowPartyCannon.cs +++ b/Items/Weapons/Magic/RainbowPartyCannon.cs @@ -30,50 +30,37 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 225; - item.magic = true; - item.mana = 25; - item.width = 52; - item.height = 30; - item.crit += 4; - item.useTime = item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.noUseGraphic = true; - item.shoot = ModContent.ProjectileType(); - item.channel = true; - item.shootSpeed = 20f; - item.Calamity().devItem = true; + Item.damage = 225; + Item.DamageType = DamageClass.Magic; + Item.mana = 25; + Item.width = 52; + Item.height = 30; + Item.crit += 4; + Item.useTime = Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; + Item.rare = 10; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.channel = true; + Item.shootSpeed = 20f; + Item.Calamity().devItem = true; } public override void ModifyTooltips(List tooltips) { - var tt2 = tooltips.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria"); + var tt2 = tooltips.FirstOrDefault(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); tt2.overrideColor = new Color((int)MathHelper.Lerp(156f, 255f, Main.DiscoR / 256f), 108, 251); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ConfettiCannon); - recipe.AddIngredient(ModContent.ItemType()); - - // This is the Celebration. The ItemID name is a bit unclear. - // TODO -- Replace this with Celebration MK2 in 1.4. - recipe.AddIngredient(ItemID.FireworksLauncher); - recipe.AddIngredient(ItemID.FlaskofParty, 5); - recipe.AddIngredient(ItemID.SoulofLight, 25); - recipe.AddIngredient(ItemID.Confetti, 50); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ConfettiCannon).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.FireworksLauncher).AddIngredient(ItemID.FlaskofParty, 5).AddIngredient(ItemID.SoulofLight, 25).AddIngredient(ItemID.Confetti, 50).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/Rancor.cs b/Items/Weapons/Magic/Rancor.cs index 8b618d1f30..9a42987ee3 100644 --- a/Items/Weapons/Magic/Rancor.cs +++ b/Items/Weapons/Magic/Rancor.cs @@ -21,31 +21,31 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 444; - item.magic = true; - item.noUseGraphic = true; - item.channel = true; - item.mana = 10; - item.width = 66; - item.height = 82; - item.useTime = 27; - item.useAnimation = 27; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.shootSpeed = 9f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 444; + Item.DamageType = DamageClass.Magic; + Item.noUseGraphic = true; + Item.channel = true; + Item.mana = 10; + Item.width = 66; + Item.height = 82; + Item.useTime = 27; + Item.useAnimation = 27; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.shootSpeed = 9f; + Item.shoot = ModContent.ProjectileType(); - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; } // This weapon uses a holdout projectile. - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, item.shoot, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, Item.shoot, damage, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Magic/RecitationoftheBeast.cs b/Items/Weapons/Magic/RecitationoftheBeast.cs index 0e9f731b73..292bdc0f0f 100644 --- a/Items/Weapons/Magic/RecitationoftheBeast.cs +++ b/Items/Weapons/Magic/RecitationoftheBeast.cs @@ -20,23 +20,23 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.mana = 24; - item.width = 38; - item.height = 54; - item.damage = 128; - item.noMelee = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 18; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.magic = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.mana = 24; + Item.width = 38; + Item.height = 54; + Item.damage = 128; + Item.noMelee = true; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 18; + Item.knockBack = 8.5f; + Item.UseSound = SoundID.Item8; + Item.autoReuse = true; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Magic; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } // Terraria seems to really dislike high crit values in SetDefaults @@ -60,14 +60,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DemonScythe); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.DemonScythe).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/RelicofRuin.cs b/Items/Weapons/Magic/RelicofRuin.cs index 4064bfe708..5d7fb6e464 100644 --- a/Items/Weapons/Magic/RelicofRuin.cs +++ b/Items/Weapons/Magic/RelicofRuin.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 20; - item.magic = true; - item.mana = 16; - item.width = 34; - item.height = 40; - item.useTime = 35; - item.useAnimation = 35; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4.25f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item84; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; + Item.damage = 20; + Item.DamageType = DamageClass.Magic; + Item.mana = 16; + Item.width = 34; + Item.height = 40; + Item.useTime = 35; + Item.useAnimation = 35; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4.25f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item84; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic float radians = MathHelper.TwoPi / totalProjectiles; for (int i = 0; i < totalProjectiles; i++) { - Vector2 vector = new Vector2(0f, -item.shootSpeed).RotatedBy(radians * i); + Vector2 vector = new Vector2(0f, -Item.shootSpeed).RotatedBy(radians * i); Projectile.NewProjectile(position, vector, type, damage, knockBack, Main.myPlayer); } return false; @@ -48,13 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpellTome); - recipe.AddRecipeGroup("AnyAdamantiteBar", 5); // This is here to keep the Forbidden Fragment stuff on the same tier. - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpellTome).AddRecipeGroup("AnyAdamantiteBar", 5).AddIngredient(ItemID.AncientBattleArmorMaterial, 2).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/RougeSlash.cs b/Items/Weapons/Magic/RougeSlash.cs index b1ecc32bf4..5a8b82f5cd 100644 --- a/Items/Weapons/Magic/RougeSlash.cs +++ b/Items/Weapons/Magic/RougeSlash.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 61; - item.magic = true; - item.mana = 30; - item.width = 28; - item.height = 32; - item.useTime = 19; - item.useAnimation = 19; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item91; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24f; + Item.damage = 61; + Item.DamageType = DamageClass.Magic; + Item.mana = 30; + Item.width = 28; + Item.height = 32; + Item.useTime = 19; + Item.useAnimation = 19; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7.5f; + Item.UseSound = SoundID.Item91; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/SHPC.cs b/Items/Weapons/Magic/SHPC.cs index 6da0f0a752..f87e33de85 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 18; - item.magic = true; - item.mana = 20; - item.width = 124; - item.height = 52; - item.useTime = item.useAnimation = 7; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.25f; - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; + Item.damage = 18; + Item.DamageType = DamageClass.Magic; + Item.mana = 20; + Item.width = 124; + Item.height = 52; + Item.useTime = Item.useAnimation = 7; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.25f; + Item.UseSound = SoundID.Item92; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; } public override Vector2? HoldoutOffset() @@ -50,11 +50,11 @@ namespace CalamityMod.Items.Weapons.Magic { if (player.altFunctionUse == 2) { - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); } else { - item.UseSound = SoundID.Item92; + Item.UseSound = SoundID.Item92; } return base.CanUseItem(player); } @@ -98,13 +98,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddRecipeGroup("AnyMythrilBar", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ModContent.ItemType(), 4).AddRecipeGroup("AnyMythrilBar", 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Magic/SanguineFlare.cs b/Items/Weapons/Magic/SanguineFlare.cs index 08799bb6a3..f042053656 100644 --- a/Items/Weapons/Magic/SanguineFlare.cs +++ b/Items/Weapons/Magic/SanguineFlare.cs @@ -13,28 +13,28 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Sanguine Flare"); Tooltip.SetDefault("Fires a blast of sanguine flares that drain enemy life"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 143; - item.magic = true; - item.mana = 22; - item.width = 56; - item.height = 60; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 8f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.damage = 143; + Item.DamageType = DamageClass.Magic; + Item.mana = 22; + Item.width = 56; + Item.height = 60; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 8f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; } public override Vector2? HoldoutOrigin() @@ -56,11 +56,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/SeethingDischarge.cs b/Items/Weapons/Magic/SeethingDischarge.cs index 911f7f1b77..53b1cb3fdb 100644 --- a/Items/Weapons/Magic/SeethingDischarge.cs +++ b/Items/Weapons/Magic/SeethingDischarge.cs @@ -15,22 +15,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 58; - item.magic = true; - item.mana = 15; - item.width = 28; - item.height = 32; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6.75f; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; + Item.damage = 58; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; + Item.width = 28; + Item.height = 32; + Item.useTime = 24; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6.75f; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/Serpentine.cs b/Items/Weapons/Magic/Serpentine.cs index a3d4d8e880..9679bf320b 100644 --- a/Items/Weapons/Magic/Serpentine.cs +++ b/Items/Weapons/Magic/Serpentine.cs @@ -17,29 +17,29 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 10; - item.magic = true; - item.mana = 20; - item.width = 28; - item.height = 32; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.damage = 10; + Item.DamageType = DamageClass.Magic; + Item.mana = 20; + Item.width = 28; + Item.height = 32; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int owner = player.whoAmI; - float num72 = item.shootSpeed; - player.itemTime = item.useTime; + float num72 = Item.shootSpeed; + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); Vector2 vector3 = Main.MouseWorld - vector2; diff --git a/Items/Weapons/Magic/ShadecrystalTome.cs b/Items/Weapons/Magic/ShadecrystalTome.cs index 7486ebcab9..06ed206b18 100644 --- a/Items/Weapons/Magic/ShadecrystalTome.cs +++ b/Items/Weapons/Magic/ShadecrystalTome.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 23; - item.magic = true; - item.mana = 4; - item.width = 28; - item.height = 30; - item.useTime = 6; - item.useAnimation = 6; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.damage = 23; + Item.DamageType = DamageClass.Magic; + Item.mana = 4; + Item.width = 28; + Item.height = 30; + Item.useTime = 6; + Item.useAnimation = 6; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item9; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -49,12 +49,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalStorm); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.CrystalStorm).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/ShaderainStaff.cs b/Items/Weapons/Magic/ShaderainStaff.cs index ab3f28bef7..5bef346bd6 100644 --- a/Items/Weapons/Magic/ShaderainStaff.cs +++ b/Items/Weapons/Magic/ShaderainStaff.cs @@ -18,26 +18,26 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 21; - item.magic = true; - item.mana = 10; - item.width = 42; - item.height = 42; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 0f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item66; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.damage = 21; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 42; + Item.height = 42; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 0f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item66; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -66,13 +66,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 2); - recipe.AddIngredient(ItemID.DemoniteBar, 3); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RottenChunk, 2).AddIngredient(ItemID.DemoniteBar, 3).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Magic/ShadowboltStaff.cs b/Items/Weapons/Magic/ShadowboltStaff.cs index 2105a5e618..773dbe8eb7 100644 --- a/Items/Weapons/Magic/ShadowboltStaff.cs +++ b/Items/Weapons/Magic/ShadowboltStaff.cs @@ -13,28 +13,28 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Shadowbolt Staff"); Tooltip.SetDefault("The more tiles and enemies the beam bounces off of or travels through the more damage the beam does"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 250; - item.magic = true; - item.mana = 20; - item.width = 58; - item.height = 56; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item72; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.damage = 250; + Item.DamageType = DamageClass.Magic; + Item.mana = 20; + Item.width = 58; + Item.height = 56; + Item.useTime = 14; + Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 8f; + Item.value = Item.buyPrice(1, 40, 0, 0); + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item72; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override Vector2? HoldoutOrigin() @@ -44,13 +44,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ShadowbeamStaff); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ShadowbeamStaff).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/ShadowdropStaff.cs b/Items/Weapons/Magic/ShadowdropStaff.cs index 36915de621..9d340f2ba0 100644 --- a/Items/Weapons/Magic/ShadowdropStaff.cs +++ b/Items/Weapons/Magic/ShadowdropStaff.cs @@ -14,27 +14,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Shadowdrop Staff"); Tooltip.SetDefault("Summons dark aura rain from the sky"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 25; - item.magic = true; - item.mana = 6; - item.width = 44; - item.height = 44; - item.useTime = 9; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item66; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.damage = 25; + Item.DamageType = DamageClass.Magic; + Item.mana = 6; + Item.width = 44; + Item.height = 44; + Item.useTime = 9; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item66; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; } public override Vector2? HoldoutOrigin() @@ -44,18 +44,12 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 5); - recipe.AddIngredient(ItemID.DemoniteBar, 5); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RottenChunk, 5).AddIngredient(ItemID.DemoniteBar, 5).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.DemonAltar).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index 4ecf5dce59..39e6ab7019 100644 --- a/Items/Weapons/Magic/ShiftingSands.cs +++ b/Items/Weapons/Magic/ShiftingSands.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 61; - item.knockBack = 5f; - item.useTime = item.useAnimation = 30; - item.mana = 20; - item.magic = true; - item.channel = true; - item.autoReuse = true; - item.shootSpeed = 7f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 61; + Item.knockBack = 5f; + Item.useTime = Item.useAnimation = 30; + Item.mana = 20; + Item.DamageType = DamageClass.Magic; + Item.channel = true; + Item.autoReuse = true; + Item.shootSpeed = 7f; + Item.shoot = ModContent.ProjectileType(); - item.width = item.height = 58; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.UseSound = SoundID.Item20; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; + Item.width = Item.height = 58; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.UseSound = SoundID.Item20; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; } public override bool CanUseItem(Player player) @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic for (int x = 0; x < Main.maxProjectiles; x++) { Projectile proj = Main.projectile[x]; - if (proj.active && proj.owner == player.whoAmI && proj.type == item.shoot && proj.ai[0] <= 0f) + if (proj.active && proj.owner == player.whoAmI && proj.type == Item.shoot && proj.ai[0] <= 0f) { projCount++; } @@ -50,14 +50,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MagicMissile); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.SpectreBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.MagicMissile).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.AncientBattleArmorMaterial, 2).AddIngredient(ItemID.SpectreBar, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Magic/SirensSong.cs b/Items/Weapons/Magic/SirensSong.cs index 6782c0c2a6..089da2273b 100644 --- a/Items/Weapons/Magic/SirensSong.cs +++ b/Items/Weapons/Magic/SirensSong.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 92; - item.magic = true; - item.mana = 7; - item.width = 56; - item.height = 50; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; + Item.damage = 92; + Item.DamageType = DamageClass.Magic; + Item.mana = 7; + Item.width = 56; + Item.height = 50; + Item.useTime = 18; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6.5f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13f; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); diff --git a/Items/Weapons/Magic/SkyGlaze.cs b/Items/Weapons/Magic/SkyGlaze.cs index d22cdf230d..f05599e395 100644 --- a/Items/Weapons/Magic/SkyGlaze.cs +++ b/Items/Weapons/Magic/SkyGlaze.cs @@ -13,27 +13,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Sky Glaze"); Tooltip.SetDefault("Fires feathers from the sky that stick to enemies and tiles and explode"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 15; - item.magic = true; - item.mana = 8; - item.width = 52; - item.height = 74; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + Item.damage = 15; + Item.DamageType = DamageClass.Magic; + Item.mana = 8; + Item.width = 52; + Item.height = 74; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item102; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; } public override Vector2? HoldoutOrigin() @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Magic/SlitheringEels.cs b/Items/Weapons/Magic/SlitheringEels.cs index da819d3a84..17aa4fd78d 100644 --- a/Items/Weapons/Magic/SlitheringEels.cs +++ b/Items/Weapons/Magic/SlitheringEels.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 80; - item.magic = true; - item.mana = 11; - item.width = 34; - item.height = 40; - item.useAnimation = item.useTime = 40; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.NPCHit13; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.damage = 80; + Item.DamageType = DamageClass.Magic; + Item.mana = 11; + Item.width = 34; + Item.height = 40; + Item.useAnimation = Item.useTime = 40; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.NPCHit13; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/SnowstormStaff.cs b/Items/Weapons/Magic/SnowstormStaff.cs index 161c6a5276..fb4a161c6a 100644 --- a/Items/Weapons/Magic/SnowstormStaff.cs +++ b/Items/Weapons/Magic/SnowstormStaff.cs @@ -15,22 +15,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 53; - item.magic = true; - item.channel = true; - item.mana = 13; - item.width = 66; - item.height = 66; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 5; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item46; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7f; + Item.damage = 53; + Item.DamageType = DamageClass.Magic; + Item.channel = true; + Item.mana = 13; + Item.width = 66; + Item.height = 66; + Item.useTime = 22; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 5; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item46; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7f; } } } diff --git a/Items/Weapons/Magic/SoulPiercer.cs b/Items/Weapons/Magic/SoulPiercer.cs index d9b59d5bfa..1b922f9b1a 100644 --- a/Items/Weapons/Magic/SoulPiercer.cs +++ b/Items/Weapons/Magic/SoulPiercer.cs @@ -15,27 +15,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Soul Piercer"); Tooltip.SetDefault("Casts a powerful ray that summons extra rays on enemy hits"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 115; - item.magic = true; - item.mana = 19; - item.width = 64; - item.height = 64; - item.useTime = item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item73; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.damage = 115; + Item.DamageType = DamageClass.Magic; + Item.mana = 19; + Item.width = 64; + Item.height = 64; + Item.useTime = Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 8f; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item73; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } /*public override Vector2? HoldoutOrigin() @@ -45,16 +45,12 @@ namespace CalamityMod.Items.Weapons.Magic public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow")); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/StardustStaff.cs b/Items/Weapons/Magic/StardustStaff.cs index 5228445f68..d9be72ad4c 100644 --- a/Items/Weapons/Magic/StardustStaff.cs +++ b/Items/Weapons/Magic/StardustStaff.cs @@ -14,28 +14,28 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Eidolon Staff"); Tooltip.SetDefault("The power of an ancient cultist resonates within this staff\n" + "Fires a spread of ancient light and has a chance to fire a spinning ice cluster"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 110; - item.magic = true; - item.mana = 20; - item.width = 56; - item.height = 56; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.damage = 110; + Item.DamageType = DamageClass.Magic; + Item.mana = 20; + Item.width = 56; + Item.height = 56; + Item.useTime = 18; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7f; + Item.value = Item.buyPrice(1, 40, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.UseSound = SoundID.Item43; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override Vector2? HoldoutOrigin() => new Vector2(15, 15); @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); diff --git a/Items/Weapons/Magic/Starfall.cs b/Items/Weapons/Magic/Starfall.cs index ca65ff12ac..ae4b16bc67 100644 --- a/Items/Weapons/Magic/Starfall.cs +++ b/Items/Weapons/Magic/Starfall.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 50; - item.magic = true; - item.mana = 15; - item.rare = ItemRarityID.Cyan; - item.width = 38; - item.height = 40; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.25f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.UseSound = SoundID.Item105; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.damage = 50; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; + Item.rare = ItemRarityID.Cyan; + Item.width = 38; + Item.height = 40; + Item.useTime = 14; + Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.25f; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.UseSound = SoundID.Item105; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } // Terraria seems to really dislike high crit values in SetDefaults @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Magic/StormSpray.cs b/Items/Weapons/Magic/StormSpray.cs index 1d34a82be4..8c31cff51b 100644 --- a/Items/Weapons/Magic/StormSpray.cs +++ b/Items/Weapons/Magic/StormSpray.cs @@ -12,27 +12,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Storm Spray"); Tooltip.SetDefault("Fires a spray of water that drips extra trails of water"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 14; - item.magic = true; - item.mana = 8; - item.width = 42; - item.height = 42; - item.useTime = 33; - item.useAnimation = 33; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item13; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.damage = 14; + Item.DamageType = DamageClass.Magic; + Item.mana = 8; + Item.width = 42; + Item.height = 42; + Item.useTime = 33; + Item.useAnimation = 33; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item13; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override Vector2? HoldoutOrigin() diff --git a/Items/Weapons/Magic/StratusSphere.cs b/Items/Weapons/Magic/StratusSphere.cs index 0d6b738777..92083c78b5 100644 --- a/Items/Weapons/Magic/StratusSphere.cs +++ b/Items/Weapons/Magic/StratusSphere.cs @@ -17,41 +17,34 @@ namespace CalamityMod.Items.Weapons.Magic } public override void SetDefaults() { - item.damage = 251; - item.noMelee = true; - item.magic = true; - item.width = 22; - item.height = 24; - item.useTime = 45; - item.useAnimation = 45; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7f; - item.useStyle = ItemUseStyleID.HoldingOut; - item.mana = 30; - item.knockBack = 2; - item.UseSound = SoundID.Item20; - item.rare = ItemRarityID.LightRed; - item.autoReuse = true; - item.useTurn = true; - item.noUseGraphic = true; - item.holdStyle = 3; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.damage = 251; + Item.noMelee = true; + Item.DamageType = DamageClass.Magic; + Item.width = 22; + Item.height = 24; + Item.useTime = 45; + Item.useAnimation = 45; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7f; + Item.useStyle = ItemUseStyleID.Shoot; + Item.mana = 30; + Item.knockBack = 2; + Item.UseSound = SoundID.Item20; + Item.rare = ItemRarityID.LightRed; + Item.autoReuse = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.holdStyle = 3; + Item.value = Item.buyPrice(1, 40, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 6; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 6; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.NebulaArcanum); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.NebulaArcanum).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index a6bca31c7c..d934468c4b 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -21,27 +21,27 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 242; - item.magic = true; - item.mana = 78; - item.width = 38; - item.height = 48; - item.UseSound = SoundID.Item84; - item.useTime = item.useAnimation = 60; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7f; + Item.damage = 242; + Item.DamageType = DamageClass.Magic; + Item.mana = 78; + Item.width = 38; + Item.height = 48; + Item.UseSound = SoundID.Item84; + Item.useTime = Item.useAnimation = 60; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7f; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow")); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -52,14 +52,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/T1000.cs b/Items/Weapons/Magic/T1000.cs index bdc4b5f221..fe4bcc0355 100644 --- a/Items/Weapons/Magic/T1000.cs +++ b/Items/Weapons/Magic/T1000.cs @@ -20,39 +20,31 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 247; - item.magic = true; - item.mana = 8; - item.width = 94; - item.height = 54; - item.useTime = item.useAnimation = UseTime; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 4f; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24f; + Item.damage = 247; + Item.DamageType = DamageClass.Magic; + Item.mana = 8; + Item.width = 94; + Item.height = 54; + Item.useTime = Item.useAnimation = UseTime; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.knockBack = 4f; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/TacticiansTrumpCard.cs b/Items/Weapons/Magic/TacticiansTrumpCard.cs index 198d07b7a6..2207bf3899 100644 --- a/Items/Weapons/Magic/TacticiansTrumpCard.cs +++ b/Items/Weapons/Magic/TacticiansTrumpCard.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.width = 74; - item.height = 70; - item.damage = 248; - item.knockBack = 7f; - item.magic = true; - item.useAnimation = item.useTime = 12; - item.mana = 20; - item.useTurn = true; - item.autoReuse = true; - item.shootSpeed = 13.5f; - item.shoot = ModContent.ProjectileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().donorItem = true; + Item.width = 74; + Item.height = 70; + Item.damage = 248; + Item.knockBack = 7f; + Item.DamageType = DamageClass.Magic; + Item.useAnimation = Item.useTime = 12; + Item.mana = 20; + Item.useTurn = true; + Item.autoReuse = true; + Item.shootSpeed = 13.5f; + Item.shoot = ModContent.ProjectileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().donorItem = true; } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -53,28 +53,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CopperShortsword); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TinShortsword); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.CopperShortsword).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1).AddIngredient(ItemID.TinShortsword).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/TearsofHeaven.cs b/Items/Weapons/Magic/TearsofHeaven.cs index 41e2061164..2e861000f7 100644 --- a/Items/Weapons/Magic/TearsofHeaven.cs +++ b/Items/Weapons/Magic/TearsofHeaven.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 64; - item.magic = true; - item.mana = 18; - item.width = 28; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5.5f; + Item.damage = 64; + Item.DamageType = DamageClass.Magic; + Item.mana = 18; + Item.width = 28; + Item.height = 30; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item8; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5.5f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -50,14 +50,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.WaterBolt); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.WaterBolt).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/TerraRay.cs b/Items/Weapons/Magic/TerraRay.cs index 2bf0859af7..0445c251be 100644 --- a/Items/Weapons/Magic/TerraRay.cs +++ b/Items/Weapons/Magic/TerraRay.cs @@ -14,27 +14,27 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Terra Ray"); Tooltip.SetDefault("Casts an energy ray that splits into energy on enemy hits\n" + "More energy is created the farther along the ray the hit enemy is"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 50; - item.magic = true; - item.mana = 10; - item.width = 54; - item.height = 54; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; + Item.damage = 50; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 54; + Item.height = 54; + Item.useTime = 24; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item60; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; } public override Vector2? HoldoutOrigin() @@ -52,20 +52,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Magic/ThePrince.cs b/Items/Weapons/Magic/ThePrince.cs index 3c80659f4b..8a61c64a10 100644 --- a/Items/Weapons/Magic/ThePrince.cs +++ b/Items/Weapons/Magic/ThePrince.cs @@ -16,28 +16,28 @@ namespace CalamityMod.Items.Weapons.Magic Tooltip.SetDefault($"Casts a holy fireball that explodes into {FlameSplitCount} flames\n" + "So you're telling me that the prince exploded, and then turned into a flower?\n" + "-Dain, the sailor druid"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 166; - item.knockBack = 4.25f; - item.shootSpeed = 23.5f; - item.magic = true; - item.noMelee = true; - item.mana = 12; - item.width = 102; - item.height = 112; - item.useTime = item.useAnimation = 21; - item.useStyle = ItemUseStyleID.HoldingOut; - item.autoReuse = true; - item.UseSound = SoundID.DD2_FlameburstTowerShot; - item.shoot = ModContent.ProjectileType(); - item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().donorItem = true; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.damage = 166; + Item.knockBack = 4.25f; + Item.shootSpeed = 23.5f; + Item.DamageType = DamageClass.Magic; + Item.noMelee = true; + Item.mana = 12; + Item.width = 102; + Item.height = 112; + Item.useTime = Item.useAnimation = 21; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.UseSound = SoundID.DD2_FlameburstTowerShot; + Item.shoot = ModContent.ProjectileType(); + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().donorItem = true; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override Vector2? HoldoutOrigin() @@ -56,13 +56,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/TheSwarmer.cs b/Items/Weapons/Magic/TheSwarmer.cs index 3f582f82e2..dfcd4b5645 100644 --- a/Items/Weapons/Magic/TheSwarmer.cs +++ b/Items/Weapons/Magic/TheSwarmer.cs @@ -15,21 +15,21 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 40; - item.magic = true; - item.mana = 7; - item.width = 60; - item.height = 52; - item.useTime = 8; - item.useAnimation = 8; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = ProjectileID.Wasp; - item.shootSpeed = 12f; + Item.damage = 40; + Item.DamageType = DamageClass.Magic; + Item.mana = 7; + Item.width = 60; + Item.height = 52; + Item.useTime = 8; + Item.useAnimation = 8; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shoot = ProjectileID.Wasp; + Item.shootSpeed = 12f; } public override Vector2? HoldoutOffset() @@ -39,13 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BeeGun); - recipe.AddIngredient(ItemID.WaspGun); - recipe.AddIngredient(ItemID.FragmentVortex, 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BeeGun).AddIngredient(ItemID.WaspGun).AddIngredient(ItemID.FragmentVortex, 20).AddTile(TileID.LunarCraftingStation).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -65,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX2 = speedX + (float)Main.rand.Next(-35, 36) * 0.05f; float SpeedY2 = speedY + (float)Main.rand.Next(-35, 36) * 0.05f; - int bees = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, player.beeType(), player.beeDamage(item.damage), player.beeKB(0f), player.whoAmI); + int bees = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, player.beeType(), player.beeDamage(Item.damage), player.beeKB(0f), player.whoAmI); if (bees.WithinBounds(Main.maxProjectiles)) { Main.projectile[bees].penetrate = 1; diff --git a/Items/Weapons/Magic/TheWand.cs b/Items/Weapons/Magic/TheWand.cs index a96f424ca0..5cd6a0d57a 100644 --- a/Items/Weapons/Magic/TheWand.cs +++ b/Items/Weapons/Magic/TheWand.cs @@ -16,29 +16,29 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("The Wand"); Tooltip.SetDefault("The ultimate wand"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.width = 40; - item.damage = 1; - item.mana = 150; - item.magic = true; - item.noMelee = true; - item.useAnimation = 19; - item.useTime = 19; - item.useTurn = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 0.5f; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.height = 36; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24f; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 40; + Item.damage = 1; + Item.mana = 150; + Item.DamageType = DamageClass.Magic; + Item.noMelee = true; + Item.useAnimation = 19; + Item.useTime = 19; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 0.5f; + Item.UseSound = SoundID.Item102; + Item.autoReuse = true; + Item.height = 36; + Item.value = Item.buyPrice(2, 50, 0, 0); + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool CanUseItem(Player player) @@ -59,12 +59,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WandofSparking); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.WandofSparking).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/ThornBlossom.cs b/Items/Weapons/Magic/ThornBlossom.cs index 112f1d9a50..43e5a9ba51 100644 --- a/Items/Weapons/Magic/ThornBlossom.cs +++ b/Items/Weapons/Magic/ThornBlossom.cs @@ -14,28 +14,28 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Thorn Blossom"); Tooltip.SetDefault("Every rose has its thorn"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 60; - item.magic = true; - item.mana = 10; - item.width = 66; - item.height = 68; - item.useTime = 23; - item.useAnimation = 23; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; + Item.damage = 60; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 66; + Item.height = 68; + Item.useTime = 23; + Item.useAnimation = 23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.Item109; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; } public override Vector2? HoldoutOrigin() => new Vector2(15, 15); @@ -59,13 +59,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/Thunderstorm.cs b/Items/Weapons/Magic/Thunderstorm.cs index 4cda9dc316..61aee590aa 100644 --- a/Items/Weapons/Magic/Thunderstorm.cs +++ b/Items/Weapons/Magic/Thunderstorm.cs @@ -14,23 +14,23 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 132; - item.mana = 50; - item.magic = true; - item.width = 48; - item.height = 22; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); - item.autoReuse = true; - item.shootSpeed = 6f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 132; + Item.mana = 50; + Item.DamageType = DamageClass.Magic; + Item.width = 48; + Item.height = 22; + Item.useTime = 24; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + Item.autoReuse = true; + Item.shootSpeed = 6f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Magic/TomeofFates.cs b/Items/Weapons/Magic/TomeofFates.cs index be6b59507d..dfe72a1510 100644 --- a/Items/Weapons/Magic/TomeofFates.cs +++ b/Items/Weapons/Magic/TomeofFates.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 110; - item.magic = true; - item.mana = 8; - item.width = 28; - item.height = 30; - item.useTime = 5; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.UseSound = SoundID.Item103; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 17f; + Item.damage = 110; + Item.DamageType = DamageClass.Magic; + Item.mana = 8; + Item.width = 28; + Item.height = 30; + Item.useTime = 5; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.UseSound = SoundID.Item103; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 17f; } // Terraria seems to really dislike high crit values in SetDefaults @@ -41,12 +41,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpellTome); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpellTome).AddIngredient(ModContent.ItemType(), 9).AddTile(TileID.Bookcases).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -54,8 +49,8 @@ namespace CalamityMod.Items.Weapons.Magic int i = Main.myPlayer; int num73 = damage; float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; + num74 = player.GetWeaponKnockback(Item, num74); + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -65,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Magic value3.Normalize(); value2 = value2 * 4f + value3; value2.Normalize(); - value2 *= item.shootSpeed; + value2 *= Item.shootSpeed; int projChoice = Main.rand.Next(7); float num91 = (float)Main.rand.Next(10, 160) * 0.001f; if (Main.rand.NextBool(2)) diff --git a/Items/Weapons/Magic/Tradewinds.cs b/Items/Weapons/Magic/Tradewinds.cs index 7ccfa13923..4973a31f44 100644 --- a/Items/Weapons/Magic/Tradewinds.cs +++ b/Items/Weapons/Magic/Tradewinds.cs @@ -16,33 +16,27 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 31; - item.magic = true; - item.mana = 5; - item.width = 28; - item.height = 30; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item7; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 25f; + Item.damage = 31; + Item.DamageType = DamageClass.Magic; + Item.mana = 5; + Item.width = 28; + Item.height = 30; + Item.useTime = 12; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item7; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 25f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.SunplateBlock, 5); - recipe.AddIngredient(ItemID.Feather, 3); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.SunplateBlock, 5).AddIngredient(ItemID.Feather, 3).AddTile(TileID.Bookcases).Register(); } } } diff --git a/Items/Weapons/Magic/UltraLiquidator.cs b/Items/Weapons/Magic/UltraLiquidator.cs index 8f12b82caa..9efa285228 100644 --- a/Items/Weapons/Magic/UltraLiquidator.cs +++ b/Items/Weapons/Magic/UltraLiquidator.cs @@ -15,27 +15,27 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Ultra Liquidator"); Tooltip.SetDefault("Summons liquidation blades that summon more blades on enemy hits\n" + "The blades inflict ichor, cursed inferno and brimstone flames"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 120; - item.knockBack = 5f; - item.useTime = 3; - item.reuseDelay = item.useAnimation = 15; - item.mana = 25; - item.magic = true; - item.autoReuse = true; - item.shootSpeed = 16f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 120; + Item.knockBack = 5f; + Item.useTime = 3; + Item.reuseDelay = Item.useAnimation = 15; + Item.mana = 25; + Item.DamageType = DamageClass.Magic; + Item.autoReuse = true; + Item.shootSpeed = 16f; + Item.shoot = ModContent.ProjectileType(); - item.width = item.height = 16; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.UseSound = SoundID.Item9; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; + Item.width = Item.height = 16; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.UseSound = SoundID.Item9; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; } // Terraria seems to really dislike high crit values in SetDefaults @@ -45,22 +45,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.AquaScepter); - recipe.AddRecipeGroup("CursedFlameIchor", 20); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.AquaScepter).AddRecipeGroup("CursedFlameIchor", 20).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float speed = item.shootSpeed; + float speed = Item.shootSpeed; float xVec = Main.mouseX + Main.screenPosition.X - playerPos.X; float yVec = Main.mouseY + Main.screenPosition.Y - playerPos.Y; float f = Main.rand.NextFloat() * MathHelper.TwoPi; diff --git a/Items/Weapons/Magic/UndinesRetribution.cs b/Items/Weapons/Magic/UndinesRetribution.cs index 2682203906..f722c59f07 100644 --- a/Items/Weapons/Magic/UndinesRetribution.cs +++ b/Items/Weapons/Magic/UndinesRetribution.cs @@ -15,27 +15,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Undine's Retribution"); Tooltip.SetDefault("Casts a swarm of homing spears"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 30; - item.magic = true; - item.mana = 15; - item.width = 64; - item.height = 64; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item66; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 30; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; + Item.width = 64; + Item.height = 64; + Item.useTime = 18; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item66; + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOrigin() @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -91,13 +91,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 30).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Magic/ValkyrieRay.cs b/Items/Weapons/Magic/ValkyrieRay.cs index 74c37d07bb..24cb12dff7 100644 --- a/Items/Weapons/Magic/ValkyrieRay.cs +++ b/Items/Weapons/Magic/ValkyrieRay.cs @@ -21,42 +21,33 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Valkyrie Ray"); Tooltip.SetDefault("Casts a devastating ray of holy power"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.width = 54; - item.height = 52; - item.damage = 73; - item.knockBack = 8.5f; - item.magic = true; - item.mana = 26; - item.useTime = ChargeFrames + CooldownFrames; - item.useAnimation = ChargeFrames + CooldownFrames; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.NPCDeath7; - item.useTurn = false; - item.noMelee = true; - item.noUseGraphic = true; - item.value = Item.buyPrice(gold: 36); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 25f; + Item.width = 54; + Item.height = 52; + Item.damage = 73; + Item.knockBack = 8.5f; + Item.DamageType = DamageClass.Magic; + Item.mana = 26; + Item.useTime = ChargeFrames + CooldownFrames; + Item.useAnimation = ChargeFrames + CooldownFrames; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.NPCDeath7; + Item.useTurn = false; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(gold: 36); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 25f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HallowedBar, 12); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.Ruby); - recipe.AddIngredient(ItemID.SoulofSight); - recipe.AddIngredient(ItemID.SoulofMight); - recipe.AddIngredient(ItemID.SoulofFright); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HallowedBar, 12).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.Ruby).AddIngredient(ItemID.SoulofSight).AddIngredient(ItemID.SoulofMight).AddIngredient(ItemID.SoulofFright).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Magic/Vehemenc.cs b/Items/Weapons/Magic/Vehemenc.cs index c8dddb28fe..e579396c8d 100644 --- a/Items/Weapons/Magic/Vehemenc.cs +++ b/Items/Weapons/Magic/Vehemenc.cs @@ -16,30 +16,30 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Vehemence"); Tooltip.SetDefault("Casts intense bolts of hellish power that explode into skulls\n" + "Direct hits inflict Demon Flames for an extended period of time"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = BaseDamage; - item.magic = true; - item.mana = 41; - item.width = 44; - item.height = 44; - item.useTime = item.useAnimation = 43; - item.noUseGraphic = true; - item.channel = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.75f; - item.UseSound = SoundID.Item73; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.damage = BaseDamage; + Item.DamageType = DamageClass.Magic; + Item.mana = 41; + Item.width = 44; + Item.height = 44; + Item.useTime = Item.useAnimation = 43; + Item.noUseGraphic = true; + Item.channel = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.75f; + Item.UseSound = SoundID.Item73; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; } public override Vector2? HoldoutOrigin() => new Vector2(25, 25); @@ -52,6 +52,6 @@ namespace CalamityMod.Items.Weapons.Magic return false; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } } diff --git a/Items/Weapons/Magic/VenusianTrident.cs b/Items/Weapons/Magic/VenusianTrident.cs index f4dcb37ae0..5653e46154 100644 --- a/Items/Weapons/Magic/VenusianTrident.cs +++ b/Items/Weapons/Magic/VenusianTrident.cs @@ -15,28 +15,28 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Venusian Trident"); Tooltip.SetDefault("Casts an infernal trident that erupts into a gigantic explosion of fire and magma shards"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = BaseDamage; - item.magic = true; - item.mana = 20; - item.width = 70; - item.height = 68; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 9f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item45; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 19f; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.damage = BaseDamage; + Item.DamageType = DamageClass.Magic; + Item.mana = 20; + Item.width = 70; + Item.height = 68; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 9f; + Item.value = Item.buyPrice(1, 40, 0, 0); + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item45; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 19f; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override Vector2? HoldoutOrigin() @@ -46,13 +46,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.InfernoFork); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.InfernoFork).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/Vesuvius.cs b/Items/Weapons/Magic/Vesuvius.cs index fcdbdf8bd0..74da9bdff6 100644 --- a/Items/Weapons/Magic/Vesuvius.cs +++ b/Items/Weapons/Magic/Vesuvius.cs @@ -15,27 +15,27 @@ namespace CalamityMod.Items.Weapons.Magic Tooltip.SetDefault("Asteroids give the Molten buff on enemy hits\n" + "Calls down a swarm of molten asteroids\n" + "Right click to fire a spread of molten asteroids from the staff"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.width = 62; - item.damage = 60; - item.mana = 6; - item.magic = true; - item.useAnimation = item.useTime = 15; - item.noMelee = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 3f; - item.UseSound = SoundID.Item88; - item.autoReuse = true; - item.height = 62; - item.shootSpeed = 20f; - item.shoot = ModContent.ProjectileType(); + Item.width = 62; + Item.damage = 60; + Item.mana = 6; + Item.DamageType = DamageClass.Magic; + Item.useAnimation = Item.useTime = 15; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item88; + Item.autoReuse = true; + Item.height = 62; + Item.shootSpeed = 20f; + Item.shoot = ModContent.ProjectileType(); - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; } public override bool AltFunctionUse(Player player) @@ -77,7 +77,7 @@ namespace CalamityMod.Items.Weapons.Magic } else { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Magic/Viscera.cs b/Items/Weapons/Magic/Viscera.cs index 090371ad19..23d1e5a173 100644 --- a/Items/Weapons/Magic/Viscera.cs +++ b/Items/Weapons/Magic/Viscera.cs @@ -14,28 +14,28 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Viscera"); Tooltip.SetDefault("Fires a blood beam that heals you on enemy hits\n" + "The more tiles and enemies the beam bounces off of or travels through the more healing the beam does"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 100; - item.magic = true; - item.mana = 15; - item.width = 50; - item.height = 52; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; + Item.damage = 100; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; + Item.width = 50; + Item.height = 52; + Item.useTime = 14; + Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; } public override Vector2? HoldoutOrigin() @@ -45,11 +45,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs index 332f98b66f..99ae4b9524 100644 --- a/Items/Weapons/Magic/VitriolicViper.cs +++ b/Items/Weapons/Magic/VitriolicViper.cs @@ -12,27 +12,27 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Vitriolic Viper"); Tooltip.SetDefault("Releases a volley of venomous fangs and spit"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 93; - item.magic = true; - item.mana = 15; - item.width = 60; - item.height = 62; - item.useTime = item.useAnimation = 16; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.UseSound = SoundID.Item46; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; + Item.damage = 93; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; + Item.width = 60; + Item.height = 62; + Item.useTime = Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item46; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index ee0473a354..1c83c5cdf2 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -18,29 +18,29 @@ namespace CalamityMod.Items.Weapons.Magic "summon an additonal laser from the sky,\n" + "or split into energy orbs\n" + "Its majesty inspires a stroke of unparalleled genius"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 155; - item.magic = true; - item.mana = 42; - item.width = 90; - item.height = 112; - item.useAnimation = 20; - item.useTime = 4; - item.reuseDelay = item.useAnimation; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.damage = 155; + Item.DamageType = DamageClass.Magic; + Item.mana = 42; + Item.width = 90; + Item.height = 112; + Item.useAnimation = 20; + Item.useTime = 4; + Item.reuseDelay = Item.useAnimation; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7.5f; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item60; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override Vector2? HoldoutOrigin() @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float speed = item.shootSpeed; + float speed = Item.shootSpeed; float xPos = (float)Main.mouseX + Main.screenPosition.X - playerPos.X; float yPos = (float)Main.mouseY + Main.screenPosition.Y - playerPos.Y; float f = Main.rand.NextFloat() * MathHelper.TwoPi; @@ -77,28 +77,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index 8169edba0c..fd383f2076 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -16,28 +16,28 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Void Vortex"); Tooltip.SetDefault("Conjures a swirling vortex of supercharged magnet spheres around the cursor"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 112; - item.magic = true; - item.mana = 60; - item.width = 130; - item.height = 130; - item.useTime = 80; - item.useAnimation = 80; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 0f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.damage = 112; + Item.DamageType = DamageClass.Magic; + Item.mana = 60; + Item.width = 130; + Item.height = 130; + Item.useTime = 80; + Item.useAnimation = 80; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 0f; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override Vector2? HoldoutOrigin() @@ -69,12 +69,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Magic/Waywasher.cs b/Items/Weapons/Magic/Waywasher.cs index 3c5ca7c2d3..78373e2b03 100644 --- a/Items/Weapons/Magic/Waywasher.cs +++ b/Items/Weapons/Magic/Waywasher.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 16; - item.magic = true; - item.mana = 4; - item.width = 30; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.damage = 16; + Item.DamageType = DamageClass.Magic; + Item.mana = 4; + Item.width = 30; + Item.height = 30; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.5f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item8; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/Wingman.cs b/Items/Weapons/Magic/Wingman.cs index c987348801..9a07d9489a 100644 --- a/Items/Weapons/Magic/Wingman.cs +++ b/Items/Weapons/Magic/Wingman.cs @@ -15,22 +15,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 49; - item.magic = true; - item.mana = 12; - item.width = 42; - item.height = 22; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 25f; - item.shoot = ProjectileID.LaserMachinegunLaser; + Item.damage = 49; + Item.DamageType = DamageClass.Magic; + Item.mana = 12; + Item.width = 42; + Item.height = 22; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item33; + Item.autoReuse = true; + Item.shootSpeed = 25f; + Item.shoot = ProjectileID.LaserMachinegunLaser; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/WintersFury.cs b/Items/Weapons/Magic/WintersFury.cs index 6ba3c33194..3a9d67c6e2 100644 --- a/Items/Weapons/Magic/WintersFury.cs +++ b/Items/Weapons/Magic/WintersFury.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Magic { @@ -17,24 +18,24 @@ namespace CalamityMod.Items.Weapons.Magic } public override void SetDefaults() { - item.damage = 59; - item.magic = true; - item.mana = 7; - item.width = 36; - item.height = 40; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item9; - item.scale = 0.9f; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + Item.damage = 59; + Item.DamageType = DamageClass.Magic; + Item.mana = 7; + Item.width = 36; + Item.height = 40; + Item.useTime = 12; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTurn = false; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item9; + Item.scale = 0.9f; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -50,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Magic } if (Main.rand.NextBool(4)) { - Main.PlaySound(SoundID.Item1, position); + SoundEngine.PlaySound(SoundID.Item1, position); Projectile.NewProjectile(position.X, position.Y, speedX * 1.2f, speedY * 1.2f, ModContent.ProjectileType(), damage, knockBack * 2f, player.whoAmI); } speedX += Main.rand.Next(-40, 41) * 0.05f; diff --git a/Items/Weapons/Magic/WrathoftheAncients.cs b/Items/Weapons/Magic/WrathoftheAncients.cs index a158d1f31c..44a9b498f5 100644 --- a/Items/Weapons/Magic/WrathoftheAncients.cs +++ b/Items/Weapons/Magic/WrathoftheAncients.cs @@ -15,21 +15,21 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 47; - item.magic = true; - item.mana = 20; - item.width = 28; - item.height = 30; - item.useTime = 38; - item.useAnimation = 38; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + Item.damage = 47; + Item.DamageType = DamageClass.Magic; + Item.mana = 20; + Item.width = 28; + Item.height = 30; + Item.useTime = 38; + Item.useAnimation = 38; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Magic/WulfrumStaff.cs b/Items/Weapons/Magic/WulfrumStaff.cs index 1e9c2bf5a4..79547e8606 100644 --- a/Items/Weapons/Magic/WulfrumStaff.cs +++ b/Items/Weapons/Magic/WulfrumStaff.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 13; - item.magic = true; - item.mana = 2; - item.width = 44; - item.height = 46; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + Item.damage = 13; + Item.DamageType = DamageClass.Magic; + Item.mana = 2; + Item.width = 44; + Item.height = 46; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item43; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; } //public override Vector2? HoldoutOrigin() => new Vector2(8, 15); @@ -42,11 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Magic/WyvernsCall.cs b/Items/Weapons/Magic/WyvernsCall.cs index ee9bb910a7..e4bd706f66 100644 --- a/Items/Weapons/Magic/WyvernsCall.cs +++ b/Items/Weapons/Magic/WyvernsCall.cs @@ -14,27 +14,27 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Wyvern's Call"); Tooltip.SetDefault(@"I call upon the mythical Wyvern to shower the lands with its grace Fires wyverns and colored feathers from the sky that stick to enemies and tiles and explode"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 35; - item.magic = true; - item.mana = 10; - item.width = 52; - item.height = 74; - item.useTime = 23; - item.useAnimation = 23; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4.75f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; + Item.damage = 35; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 52; + Item.height = 74; + Item.useTime = 23; + Item.useAnimation = 23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4.75f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item102; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; } public override Vector2? HoldoutOrigin() @@ -44,7 +44,7 @@ Fires wyverns and colored feathers from the sky that stick to enemies and tiles public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -117,13 +117,7 @@ Fires wyverns and colored feathers from the sky that stick to enemies and tiles public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofFlight, 15); - recipe.AddRecipeGroup("AnyMythrilBar", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofFlight, 15).AddRecipeGroup("AnyMythrilBar", 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Magic/YharimsCrystal.cs b/Items/Weapons/Magic/YharimsCrystal.cs index f866afdbbb..d592d156c9 100644 --- a/Items/Weapons/Magic/YharimsCrystal.cs +++ b/Items/Weapons/Magic/YharimsCrystal.cs @@ -15,28 +15,28 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 70; - item.magic = true; - item.mana = 15; - item.width = 16; - item.height = 16; - item.useTime = 10; - item.useAnimation = 10; - item.reuseDelay = 5; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item13; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 0f; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 30f; + Item.damage = 70; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; + Item.width = 16; + Item.height = 16; + Item.useTime = 10; + Item.useAnimation = 10; + Item.reuseDelay = 5; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item13; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.knockBack = 0f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; - item.rare = ItemRarityID.Purple; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } } diff --git a/Items/Weapons/Magic/Zapper.cs b/Items/Weapons/Magic/Zapper.cs index b37ab92eb9..fc6caa9c90 100644 --- a/Items/Weapons/Magic/Zapper.cs +++ b/Items/Weapons/Magic/Zapper.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 55; - item.magic = true; - item.mana = 4; - item.width = 46; - item.height = 22; - item.useTime = 7; - item.useAnimation = 7; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = ItemRarityID.LightPurple; - item.UseSound = SoundID.Item12; - item.autoReuse = true; - item.shoot = ProjectileID.PurpleLaser; - item.shootSpeed = 20f; + Item.damage = 55; + Item.DamageType = DamageClass.Magic; + Item.mana = 4; + Item.width = 46; + Item.height = 22; + Item.useTime = 7; + Item.useAnimation = 7; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 48, 0, 0); + Item.rare = ItemRarityID.LightPurple; + Item.UseSound = SoundID.Item12; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurpleLaser; + Item.shootSpeed = 20f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -53,16 +53,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpaceGun); - recipe.AddIngredient(ItemID.LaserRifle); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.SoulofSight); - recipe.AddIngredient(ItemID.SoulofMight); - recipe.AddIngredient(ItemID.SoulofFright); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpaceGun).AddIngredient(ItemID.LaserRifle).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.SoulofSight).AddIngredient(ItemID.SoulofMight).AddIngredient(ItemID.SoulofFright).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/AbsoluteZero.cs b/Items/Weapons/Melee/AbsoluteZero.cs index 861365a576..b7ebed1ebc 100644 --- a/Items/Weapons/Melee/AbsoluteZero.cs +++ b/Items/Weapons/Melee/AbsoluteZero.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Melee } public override void SetDefaults() { - item.damage = 120; - item.melee = true; - item.width = 58; - item.height = 58; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = false; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 3f; + Item.damage = 120; + Item.DamageType = DamageClass.Melee; + Item.width = 58; + Item.height = 58; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = false; + Item.knockBack = 4f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 3f; } public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) diff --git a/Items/Weapons/Melee/AbyssBlade.cs b/Items/Weapons/Melee/AbyssBlade.cs index a56b799a78..2ab619c466 100644 --- a/Items/Weapons/Melee/AbyssBlade.cs +++ b/Items/Weapons/Melee/AbyssBlade.cs @@ -21,21 +21,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 74; - item.height = 74; - item.damage = 90; - item.melee = true; - item.useAnimation = 26; - item.useTime = 26; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + Item.width = 74; + Item.height = 74; + Item.damage = 90; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 26; + Item.useTime = 26; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -46,15 +46,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.BrokenHeroSword).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/AegisBlade.cs b/Items/Weapons/Melee/AegisBlade.cs index a4084ac265..f9a33236e0 100644 --- a/Items/Weapons/Melee/AegisBlade.cs +++ b/Items/Weapons/Melee/AegisBlade.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 72; - item.height = 72; - item.scale = 1.2f; - item.damage = 108; - item.melee = true; - item.useAnimation = item.useTime = 15; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shootSpeed = 14f; + Item.width = 72; + Item.height = 72; + Item.scale = 1.2f; + Item.damage = 108; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = Item.useTime = 15; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shootSpeed = 14f; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; } public override bool AltFunctionUse(Player player) @@ -43,15 +43,15 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - item.noMelee = true; - item.UseSound = SoundID.Item73; - item.shoot = ModContent.ProjectileType(); + Item.noMelee = true; + Item.UseSound = SoundID.Item73; + Item.shoot = ModContent.ProjectileType(); } else { - item.noMelee = false; - item.UseSound = SoundID.Item1; - item.shoot = ProjectileID.None; + Item.noMelee = false; + Item.UseSound = SoundID.Item1; + Item.shoot = ProjectileID.None; } return base.CanUseItem(player); } @@ -88,7 +88,7 @@ namespace CalamityMod.Items.Weapons.Melee if (crit) damage /= 2; - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, Item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/Aftershock.cs b/Items/Weapons/Melee/Aftershock.cs index 3c23aa08e2..385349fce3 100644 --- a/Items/Weapons/Melee/Aftershock.cs +++ b/Items/Weapons/Melee/Aftershock.cs @@ -18,27 +18,27 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 65; - item.melee = true; - item.width = 54; - item.height = 58; - item.scale = 1.75f; - item.useTime = 28; - item.useAnimation = 28; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 7.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shootSpeed = 12f; + Item.damage = 65; + Item.DamageType = DamageClass.Melee; + Item.width = 54; + Item.height = 58; + Item.scale = 1.75f; + Item.useTime = 28; + Item.useAnimation = 28; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 7.5f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shootSpeed = 12f; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX - Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY - Main.screenPosition.Y - vector2.Y; @@ -77,13 +77,13 @@ namespace CalamityMod.Items.Weapons.Melee num79 *= num80; float speedX4 = num78; float speedY5 = num79 + (float)Main.rand.Next(-10, 11) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX - Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY - Main.screenPosition.Y - vector2.Y; @@ -122,7 +122,7 @@ namespace CalamityMod.Items.Weapons.Melee num79 *= num80; float speedX4 = num78; float speedY5 = num79 + (float)Main.rand.Next(-10, 11) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), Item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/AirSpinner.cs b/Items/Weapons/Melee/AirSpinner.cs index 2e3afe05d6..0bcb84b043 100644 --- a/Items/Weapons/Melee/AirSpinner.cs +++ b/Items/Weapons/Melee/AirSpinner.cs @@ -13,42 +13,38 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Air Spinner"); Tooltip.SetDefault("Fires feathers when enemies are near\n" + "A very agile yoyo"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 28; - item.height = 28; - item.melee = true; - item.damage = 26; - item.knockBack = 4f; - item.useTime = 22; - item.useAnimation = 22; - item.autoReuse = true; + Item.width = 28; + Item.height = 28; + Item.DamageType = DamageClass.Melee; + Item.damage = 26; + Item.knockBack = 4f; + Item.useTime = 22; + Item.useAnimation = 22; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; - item.rare = ItemRarityID.Orange; - item.value = Item.buyPrice(gold: 4); + Item.rare = ItemRarityID.Orange; + Item.value = Item.buyPrice(gold: 4); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.SkyMill).Register(); } } } diff --git a/Items/Weapons/Melee/AmidiasTrident.cs b/Items/Weapons/Melee/AmidiasTrident.cs index fae5545dd9..c24b30260d 100644 --- a/Items/Weapons/Melee/AmidiasTrident.cs +++ b/Items/Weapons/Melee/AmidiasTrident.cs @@ -15,25 +15,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 44; - item.damage = 12; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 17; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 17; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; + Item.width = 44; + Item.damage = 12; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 17; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 17; + Item.knockBack = 4.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 44; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } } diff --git a/Items/Weapons/Melee/AnarchyBlade.cs b/Items/Weapons/Melee/AnarchyBlade.cs index 55229f5aca..7b0da5fcd6 100644 --- a/Items/Weapons/Melee/AnarchyBlade.cs +++ b/Items/Weapons/Melee/AnarchyBlade.cs @@ -25,30 +25,24 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 94; - item.damage = BaseDamage; - item.melee = true; - item.useAnimation = 19; - item.useTime = 19; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 100; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; + Item.width = 94; + Item.damage = BaseDamage; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 19; + Item.useTime = 19; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 7.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 100; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BrokenHeroSword).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -89,7 +83,7 @@ namespace CalamityMod.Items.Weapons.Melee if (crit) damage /= 2; - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, Item.knockBack, Main.myPlayer); target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Items/Weapons/Melee/AncientShiv.cs b/Items/Weapons/Melee/AncientShiv.cs index 593cb0fb7a..d2fc717e2f 100644 --- a/Items/Weapons/Melee/AncientShiv.cs +++ b/Items/Weapons/Melee/AncientShiv.cs @@ -16,20 +16,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 12; - item.useTime = 12; - item.width = 30; - item.height = 30; - item.damage = 35; - item.melee = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 12; + Item.useTime = 12; + Item.width = 30; + Item.height = 30; + Item.damage = 35; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -40,12 +40,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * 0.5f * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * 0.5f * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * 0.5f * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * 0.5f * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), Item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/Animus.cs b/Items/Weapons/Melee/Animus.cs index 2ff88b71fb..8c5494e3c8 100644 --- a/Items/Weapons/Melee/Animus.cs +++ b/Items/Weapons/Melee/Animus.cs @@ -17,31 +17,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 82; - item.height = 84; - item.scale = 1.5f; - item.damage = 800; - item.melee = true; - item.useAnimation = 11; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 11; - item.useTurn = true; - item.knockBack = 20f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.HotPink; + Item.width = 82; + Item.height = 84; + Item.scale = 1.5f; + Item.damage = 800; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 11; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 11; + Item.useTurn = true; + Item.knockBack = 20f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(5, 0, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.HotPink; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) diff --git a/Items/Weapons/Melee/Aorta.cs b/Items/Weapons/Melee/Aorta.cs index da3370ed7e..0db825a064 100644 --- a/Items/Weapons/Melee/Aorta.cs +++ b/Items/Weapons/Melee/Aorta.cs @@ -13,44 +13,38 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Aorta"); Tooltip.SetDefault("Fires homing blood when enemies are near\n" + "An exceptionally agile yoyo"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 30; - item.height = 26; - item.melee = true; - item.damage = 29; - item.knockBack = 4.25f; - item.useTime = 22; - item.useAnimation = 22; - item.autoReuse = true; + Item.width = 30; + Item.height = 26; + Item.DamageType = DamageClass.Melee; + Item.damage = 29; + Item.knockBack = 4.25f; + Item.useTime = 22; + Item.useAnimation = 22; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; - item.rare = ItemRarityID.Orange; - item.value = Item.buyPrice(gold: 4); + Item.rare = ItemRarityID.Orange; + Item.value = Item.buyPrice(gold: 4); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.Vertebrae, 3); - recipe.AddIngredient(ItemID.CrimtaneBar, 3); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.Vertebrae, 3).AddIngredient(ItemID.CrimtaneBar, 3).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Melee/AquaticDischarge.cs b/Items/Weapons/Melee/AquaticDischarge.cs index c4abf5d56f..3f6e11a6fe 100644 --- a/Items/Weapons/Melee/AquaticDischarge.cs +++ b/Items/Weapons/Melee/AquaticDischarge.cs @@ -16,20 +16,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 12; - item.useTime = 12; - item.width = 32; - item.height = 32; - item.damage = 23; - item.melee = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 12; + Item.useTime = 12; + Item.width = 32; + Item.height = 32; + Item.damage = 23; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 5.5f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -40,12 +40,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * 0.5f * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * 0.5f * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * 0.5f * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * 0.5f * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), Item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/AquaticDissolution.cs b/Items/Weapons/Melee/AquaticDissolution.cs index fbf51f9bb1..4063293f51 100644 --- a/Items/Weapons/Melee/AquaticDissolution.cs +++ b/Items/Weapons/Melee/AquaticDissolution.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 50; - item.damage = 125; - item.melee = true; - item.useAnimation = 16; - item.useTime = 16; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6f; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.height = 72; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.width = 50; + Item.damage = 125; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 16; + Item.useTime = 16; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item60; + Item.autoReuse = true; + Item.height = 72; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -48,15 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/ArkoftheAncients.cs b/Items/Weapons/Melee/ArkoftheAncients.cs index 42fdd1be19..2f307e6f0f 100644 --- a/Items/Weapons/Melee/ArkoftheAncients.cs +++ b/Items/Weapons/Melee/ArkoftheAncients.cs @@ -42,29 +42,29 @@ namespace CalamityMod.Items.Weapons.Melee if (player is null) return; - var tooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria"); + var tooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); tooltip.text = ParryTooltip; tooltip.overrideColor = Color.CornflowerBlue; } public override void SetDefaults() { - item.width = item.height = 60; - item.damage = 80; - item.melee = true; - item.noUseGraphic = true; - item.noMelee = true; - item.useAnimation = 22; - item.useTime = 22; - item.useTurn = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 6.25f; - item.UseSound = null; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 15f; + Item.width = Item.height = 60; + Item.damage = 80; + Item.DamageType = DamageClass.Melee; + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useAnimation = 22; + Item.useTime = 22; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 6.25f; + Item.UseSound = null; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 15f; } public override void HoldItem(Player player) { @@ -126,29 +126,15 @@ namespace CalamityMod.Items.Weapons.Melee writer.Write(Charge); } - public override void NetRecieve(BinaryReader reader) + public override void NetReceive(BinaryReader reader) { Charge = reader.ReadSingle(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Starfury); - recipe.AddIngredient(ItemID.EnchantedSword); - recipe.AddIngredient(ItemType(), 5); - recipe.AddRecipeGroup("AnyCopperBar", 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Starfury); - recipe.AddIngredient(ItemID.Arkhalis); - recipe.AddIngredient(ItemType(), 5); - recipe.AddRecipeGroup("AnyCopperBar", 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Starfury).AddIngredient(ItemID.EnchantedSword).AddIngredient(ItemType(), 5).AddRecipeGroup("AnyCopperBar", 10).AddTile(TileID.Anvils).Register(); + CreateRecipe(1).AddIngredient(ItemID.Starfury).AddIngredient(ItemID.Arkhalis).AddIngredient(ItemType(), 5).AddRecipeGroup("AnyCopperBar", 10).AddTile(TileID.Anvils).Register(); } public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index 19ffcb0853..42453beb49 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -69,38 +69,38 @@ namespace CalamityMod.Items.Weapons.Melee if (player is null) return; - var comboTooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria"); + var comboTooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); comboTooltip.text = ComboTooltip; comboTooltip.overrideColor = Color.Lerp(Color.Gold, Color.Goldenrod, 0.5f + (float)Math.Sin(Main.GlobalTime) * 0.5f); - var parryTooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip1" && x.mod == "Terraria"); + var parryTooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip1" && x.Mod == "Terraria"); parryTooltip.text = ParryTooltip; parryTooltip.overrideColor = Color.Lerp(Color.Cyan, Color.DeepSkyBlue, 0.5f + (float)Math.Sin(Main.GlobalTime) * 0.75f); - var blastTooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip2" && x.mod == "Terraria"); + var blastTooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip2" && x.Mod == "Terraria"); blastTooltip.text = BlastTooltip; blastTooltip.overrideColor = Color.Lerp(Color.HotPink, Color.Crimson, 0.5f + (float)Math.Sin(Main.GlobalTime) * 0.625f); } public override void SetDefaults() { - item.width = item.height = 136; - item.damage = 2000; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useTime = 15; - item.useTurn = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 9.5f; - item.UseSound = null; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Purple; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 28f; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = Item.height = 136; + Item.damage = 2000; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 15; + Item.useTime = 15; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 9.5f; + Item.UseSound = null; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 28f; + Item.Calamity().customRarity = CalamityRarity.Violet; } // Terraria seems to really dislike high crit values in SetDefaults @@ -113,10 +113,10 @@ namespace CalamityMod.Items.Weapons.Melee player.Calamity().mouseWorldListener = true; if (CanUseItem(player) && Combo != 4) - item.channel = false; + Item.channel = false; if (Combo == 4) - item.channel = true; + Item.channel = true; } public override bool CanUseItem(Player player) { @@ -172,13 +172,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType(), 5); - recipe.AddTile(TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemType()).AddIngredient(ItemType()).AddIngredient(ItemType(), 5).AddTile(TileType()).Register(); } public override ModItem Clone(Item item) @@ -203,7 +197,7 @@ namespace CalamityMod.Items.Weapons.Melee writer.Write(Charge); } - public override void NetRecieve(BinaryReader reader) + public override void NetReceive(BinaryReader reader) { Charge = reader.ReadSingle(); } diff --git a/Items/Weapons/Melee/ArkoftheElements.cs b/Items/Weapons/Melee/ArkoftheElements.cs index 3269041524..1274bb9dbf 100644 --- a/Items/Weapons/Melee/ArkoftheElements.cs +++ b/Items/Weapons/Melee/ArkoftheElements.cs @@ -60,38 +60,38 @@ namespace CalamityMod.Items.Weapons.Melee if (player is null) return; - var comboTooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria"); + var comboTooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); comboTooltip.text = ComboTooltip; comboTooltip.overrideColor = Color.Crimson; - var parryTooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip1" && x.mod == "Terraria"); + var parryTooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip1" && x.Mod == "Terraria"); parryTooltip.text = ParryTooltip; parryTooltip.overrideColor = Color.Orange; - var blastTooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip2" && x.mod == "Terraria"); + var blastTooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip2" && x.Mod == "Terraria"); blastTooltip.text = BlastTooltip; blastTooltip.overrideColor = Color.Gold; } public override void SetDefaults() { - item.width = 112; - item.height = 172; - item.damage = 600; - item.melee = true; - item.noUseGraphic = true; - item.noMelee = true; - item.useAnimation = 20; - item.useTime = 20; - item.useTurn = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 8.5f; - item.UseSound = null; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 16f; + Item.width = 112; + Item.height = 172; + Item.damage = 600; + Item.DamageType = DamageClass.Melee; + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useAnimation = 20; + Item.useTime = 20; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 8.5f; + Item.UseSound = null; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 16f; } // Terraria seems to really dislike high crit values in SetDefaults @@ -104,10 +104,10 @@ namespace CalamityMod.Items.Weapons.Melee player.Calamity().mouseWorldListener = true; if (CanUseItem(player) && Combo != 4) - item.channel = false; + Item.channel = false; if (Combo == 4) - item.channel = true; + Item.channel = true; } public override bool CanUseItem(Player player) @@ -196,22 +196,14 @@ namespace CalamityMod.Items.Weapons.Melee writer.Write(Charge); } - public override void NetRecieve(BinaryReader reader) + public override void NetReceive(BinaryReader reader) { Charge = reader.ReadSingle(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType(), 5); - recipe.AddIngredient(ItemType(), 5); - recipe.AddIngredient(ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemType()).AddIngredient(ItemType(), 5).AddIngredient(ItemType(), 5).AddIngredient(ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) @@ -236,8 +228,8 @@ namespace CalamityMod.Items.Weapons.Melee Texture2D frontTexture = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheElements"); Texture2D backTexture = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheElementsBack"); - spriteBatch.Draw(backTexture, item.Center - Main.screenPosition, null, lightColor, rotation, item.Size * 0.5f, scale, SpriteEffects.None, 0f); - spriteBatch.Draw(frontTexture, item.Center - Main.screenPosition, null, lightColor, rotation, item.Size * 0.5f, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(backTexture, Item.Center - Main.screenPosition, null, lightColor, rotation, Item.Size * 0.5f, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(frontTexture, Item.Center - Main.screenPosition, null, lightColor, rotation, Item.Size * 0.5f, scale, SpriteEffects.None, 0f); return false; } diff --git a/Items/Weapons/Melee/AstralBlade.cs b/Items/Weapons/Melee/AstralBlade.cs index 9cebd10ace..e23bd763f2 100644 --- a/Items/Weapons/Melee/AstralBlade.cs +++ b/Items/Weapons/Melee/AstralBlade.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { public class AstralBlade : ModItem @@ -18,20 +19,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 85; - item.melee = true; - item.width = 80; - item.height = 80; - item.scale = 1.5f; - item.useTime = 9; - item.useAnimation = 9; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.damage = 85; + Item.DamageType = DamageClass.Melee; + Item.width = 80; + Item.height = 80; + Item.scale = 1.5f; + Item.useTime = 9; + Item.useAnimation = 9; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4f; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -39,11 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.LunarCraftingStation).Register(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -77,11 +74,11 @@ namespace CalamityMod.Items.Weapons.Melee knockBack *= multiplier; if (!crit) - crit = Main.rand.NextBool((int)MathHelper.Clamp((item.crit + player.meleeCrit) * multiplier, 0f, 99f), 100); + crit = Main.rand.NextBool((int)MathHelper.Clamp((Item.crit + player.GetCritChance(DamageClass.Melee)) * multiplier, 0f, 99f), 100); if (multiplier > 1.5f) { - Main.PlaySound(SoundID.Item105, Main.player[Main.myPlayer].position); + SoundEngine.PlaySound(SoundID.Item105, Main.player[Main.myPlayer].position); bool blue = Main.rand.NextBool(); float angleStart = Main.rand.NextFloat(0f, MathHelper.TwoPi); float var = 0.05f + (2f - multiplier); diff --git a/Items/Weapons/Melee/AstralPike.cs b/Items/Weapons/Melee/AstralPike.cs index 5ba246dfb1..ec058fe0db 100644 --- a/Items/Weapons/Melee/AstralPike.cs +++ b/Items/Weapons/Melee/AstralPike.cs @@ -16,24 +16,24 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 44; - item.damage = 90; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 13; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; - item.Calamity().trueMelee = true; + Item.width = 44; + Item.damage = 90; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 13; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 13; + Item.knockBack = 8.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 50; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13f; + Item.Calamity().trueMelee = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -41,13 +41,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.LunarCraftingStation).Register(); } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } } diff --git a/Items/Weapons/Melee/AstralScythe.cs b/Items/Weapons/Melee/AstralScythe.cs index 9fbabf19f9..635f1b748f 100644 --- a/Items/Weapons/Melee/AstralScythe.cs +++ b/Items/Weapons/Melee/AstralScythe.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 56; - item.height = 60; - item.damage = 120; - item.melee = true; - item.useTurn = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 6f; - item.UseSound = SoundID.Item71; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; + Item.width = 56; + Item.height = 60; + Item.damage = 120; + Item.DamageType = DamageClass.Melee; + Item.useTurn = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item71; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Melee/Ataraxia.cs b/Items/Weapons/Melee/Ataraxia.cs index d30c9f2335..ffe61eb896 100644 --- a/Items/Weapons/Melee/Ataraxia.cs +++ b/Items/Weapons/Melee/Ataraxia.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -19,32 +20,32 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 94; - item.height = 92; - item.melee = true; - item.damage = 710; - item.knockBack = 2.5f; - item.useAnimation = 19; - item.useTime = 19; - item.autoReuse = true; - item.useTurn = true; + Item.width = 94; + Item.height = 92; + Item.DamageType = DamageClass.Melee; + Item.damage = 710; + Item.knockBack = 2.5f; + Item.useAnimation = 19; + Item.useTime = 19; + Item.autoReuse = true; + Item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; } // Fires one large and two small projectiles which stay together in formation. public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { // Play the Terra Blade sound upon firing - Main.PlaySound(SoundID.Item60, position); + SoundEngine.PlaySound(SoundID.Item60, position); // Center projectile int centerID = ModContent.ProjectileType(); @@ -88,7 +89,7 @@ namespace CalamityMod.Items.Weapons.Melee // Individual true melee homing missiles deal 10% of the weapon's base damage. int numSplits = 5; int trueMeleeID = ModContent.ProjectileType(); - int trueMeleeDamage = (int)(0.1f * item.damage * player.MeleeDamage()); + int trueMeleeDamage = (int)(0.1f * Item.damage * player.MeleeDamage()); float angleVariance = MathHelper.TwoPi / (float)numSplits; float spinOffsetAngle = MathHelper.Pi / (2f * numSplits); Vector2 posVec = new Vector2(8f, 0f).RotatedByRandom(MathHelper.TwoPi); @@ -99,7 +100,7 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 velocity = new Vector2(posVec.X, posVec.Y).RotatedBy(spinOffsetAngle); velocity.Normalize(); velocity *= 8f; - Projectile.NewProjectile(targetPos + posVec, velocity, trueMeleeID, trueMeleeDamage, item.knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(targetPos + posVec, velocity, trueMeleeID, trueMeleeDamage, Item.knockBack, player.whoAmI, 0.0f, 0.0f); } } @@ -132,15 +133,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ItemID.BrokenHeroSword); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddIngredient(ModContent.ItemType(), 8); - r.AddIngredient(ModContent.ItemType(), 2); - r.AddIngredient(ModContent.ItemType(), 20); - r.AddTile(ModContent.TileType()); - r.SetResult(this); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BrokenHeroSword).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/Avalanche.cs b/Items/Weapons/Melee/Avalanche.cs index 1a9374b5df..52d2804969 100644 --- a/Items/Weapons/Melee/Avalanche.cs +++ b/Items/Weapons/Melee/Avalanche.cs @@ -17,20 +17,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 64; - item.height = 64; - item.scale = 1.5f; - item.damage = 100; - item.melee = true; - item.useAnimation = 35; - item.useTime = 35; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 7.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; + Item.width = 64; + Item.height = 64; + Item.scale = 1.5f; + Item.damage = 100; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 35; + Item.useTime = 35; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 7.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(target.Center, vector255, type, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center, vector255, type, (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), knockback, Main.myPlayer); } } @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(target.Center, vector255, type, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), 0f, Main.myPlayer); + Projectile.NewProjectile(target.Center, vector255, type, (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), 0f, Main.myPlayer); } } diff --git a/Items/Weapons/Melee/Azathoth.cs b/Items/Weapons/Melee/Azathoth.cs index c04f70007c..5926483495 100644 --- a/Items/Weapons/Melee/Azathoth.cs +++ b/Items/Weapons/Melee/Azathoth.cs @@ -15,46 +15,40 @@ namespace CalamityMod.Items.Weapons.Melee Tooltip.SetDefault("Fires cosmic orbs that blast nearby enemies with lasers\n" + "A very agile yoyo\n" + "Destroy the universe in the blink of an eye"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 40; - item.height = 54; - item.melee = true; - item.damage = 50; - item.knockBack = 6f; - item.useTime = 20; - item.useAnimation = 20; - item.autoReuse = true; + Item.width = 40; + Item.height = 54; + Item.DamageType = DamageClass.Melee; + Item.damage = 50; + Item.knockBack = 6f; + Item.useTime = 20; + Item.useAnimation = 20; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; - item.rare = ItemRarityID.Red; - item.autoReuse = true; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.value = Item.buyPrice(platinum: 5); + Item.rare = ItemRarityID.Red; + Item.autoReuse = true; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.value = Item.buyPrice(platinum: 5); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Terrarian); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Terrarian).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/BalefulHarvester.cs b/Items/Weapons/Melee/BalefulHarvester.cs index 02dbf30e15..16f3c7d64b 100644 --- a/Items/Weapons/Melee/BalefulHarvester.cs +++ b/Items/Weapons/Melee/BalefulHarvester.cs @@ -16,31 +16,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 90; - item.width = 66; - item.height = 66; - item.scale = 1.5f; - item.melee = true; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; + Item.damage = 90; + Item.width = 66; + Item.height = 66; + Item.scale = 1.5f; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 22; + Item.useTurn = true; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TheHorsemansBlade); - recipe.AddIngredient(ItemID.BookofSkulls); - recipe.AddIngredient(ItemID.FragmentSolar, 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.TheHorsemansBlade).AddIngredient(ItemID.BookofSkulls).AddIngredient(ItemID.FragmentSolar, 20).AddTile(TileID.LunarCraftingStation).Register(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -59,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Melee damage /= 2; int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ProjectileID.FlamingJack; - CalamityPlayer.HorsemansBladeOnHit(player, -1, (int)(damage * 1.5f), item.knockBack, 0, type); + CalamityPlayer.HorsemansBladeOnHit(player, -1, (int)(damage * 1.5f), Item.knockBack, 0, type); target.AddBuff(BuffID.OnFire, 300); } } diff --git a/Items/Weapons/Melee/BallOFugu.cs b/Items/Weapons/Melee/BallOFugu.cs index 628410fe0a..a2afa63bc3 100644 --- a/Items/Weapons/Melee/BallOFugu.cs +++ b/Items/Weapons/Melee/BallOFugu.cs @@ -15,23 +15,23 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 40; - item.melee = true; - item.width = 30; - item.height = 10; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.channel = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.damage = 40; + Item.DamageType = DamageClass.Melee; + Item.width = 30; + Item.height = 10; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.knockBack = 8f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } } } diff --git a/Items/Weapons/Melee/BansheeHook.cs b/Items/Weapons/Melee/BansheeHook.cs index c8cb24d072..80a794c804 100644 --- a/Items/Weapons/Melee/BansheeHook.cs +++ b/Items/Weapons/Melee/BansheeHook.cs @@ -18,32 +18,32 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 120; - item.damage = 238; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.melee = true; - item.useAnimation = 21; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 21; - item.knockBack = 8.5f; - item.UseSound = SoundID.DD2_GhastlyGlaivePierce; - item.autoReuse = true; - item.height = 108; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 42f; + Item.width = 120; + Item.damage = 238; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 21; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 21; + Item.knockBack = 8.5f; + Item.UseSound = SoundID.DD2_GhastlyGlaivePierce; + Item.autoReuse = true; + Item.height = 108; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 42f; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/BansheeHookGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/BansheeHookGlow")); } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -58,15 +58,15 @@ namespace CalamityMod.Items.Weapons.Melee { num82 = (float)player.direction; num83 = 0f; - num84 = item.shootSpeed; + num84 = Item.shootSpeed; } else { - num84 = item.shootSpeed / num84; + num84 = Item.shootSpeed / num84; } num82 *= num84; num83 *= num84; - float ai4 = Main.rand.NextFloat() * item.shootSpeed * 0.75f * (float)player.direction; + float ai4 = Main.rand.NextFloat() * Item.shootSpeed * 0.75f * (float)player.direction; Vector2 velocity = new Vector2(num82, num83); Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, ai4, 0.0f); return false; diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index f4c5a43b90..0d19837818 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -17,29 +17,24 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 56; - item.height = 60; - item.damage = 30; - item.scale = 1.05f; - item.melee = true; - item.useAnimation = item.useTime = 26; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.useTurn = true; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; + Item.width = 56; + Item.height = 60; + Item.damage = 30; + Item.scale = 1.05f; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = Item.useTime = 26; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.useTurn = true; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 30).AddTile(TileID.Anvils).Register(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/BiomeBlade.cs b/Items/Weapons/Melee/BiomeBlade.cs index d49f34d298..a024af1a56 100644 --- a/Items/Weapons/Melee/BiomeBlade.cs +++ b/Items/Weapons/Melee/BiomeBlade.cs @@ -71,9 +71,9 @@ namespace CalamityMod.Items.Weapons.Melee if (player is null) return; - var effectDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria"); - var mainAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip3" && x.mod == "Terraria"); - var secondaryAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip4" && x.mod == "Terraria"); + var effectDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); + var mainAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip3" && x.Mod == "Terraria"); + var secondaryAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip4" && x.Mod == "Terraria"); //Default stuff effectDescTooltip.text = "Does nothing..yet"; @@ -105,32 +105,24 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = item.height = 36; - item.damage = BaseDamage; - item.melee = true; - item.useAnimation = 30; - item.useTime = 30; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.shoot = ProjectileID.PurificationPowder; - item.knockBack = 5f; - item.autoReuse = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.shootSpeed = 12f; + Item.width = Item.height = 36; + Item.damage = BaseDamage; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 30; + Item.useTime = 30; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.shoot = ProjectileID.PurificationPowder; + Item.knockBack = 5f; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.shootSpeed = 12f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyWoodenSword"); - recipe.AddIngredient(ItemType(), 5); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddIngredient(ItemID.DirtBlock, 50); - recipe.AddIngredient(ItemID.StoneBlock, 50); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyWoodenSword").AddIngredient(ItemType(), 5).AddIngredient(ItemID.HellstoneBar, 5).AddIngredient(ItemID.DirtBlock, 50).AddIngredient(ItemID.StoneBlock, 50).AddTile(TileID.Anvils).Register(); } #region Saving and syncing attunements @@ -147,10 +139,10 @@ namespace CalamityMod.Items.Weapons.Melee (clone as BiomeBlade).secondaryAttunement = (item.modItem as BiomeBlade).secondaryAttunement; //As funny as a Broken Broken Biome Blade would be, its also quite funny to make it turn into that. This is only done for a new instance of the item since the goblin tinkerer changes prevent it from happening through reforging - if (clone.item.prefix == PrefixID.Broken) + if (clone.Item.prefix == PrefixID.Broken) { - clone.item.Prefix(PrefixID.Legendary); - clone.item.prefix = PrefixID.Legendary; + clone.Item.Prefix(PrefixID.Legendary); + clone.Item.prefix = PrefixID.Legendary; } return clone; @@ -163,10 +155,10 @@ namespace CalamityMod.Items.Weapons.Melee (clone as BiomeBlade).mainAttunement = mainAttunement; (clone as BiomeBlade).secondaryAttunement = secondaryAttunement; - if (clone.item.prefix == PrefixID.Broken) + if (clone.Item.prefix == PrefixID.Broken) { - clone.item.Prefix(PrefixID.Legendary); - clone.item.prefix = PrefixID.Legendary; + clone.Item.Prefix(PrefixID.Legendary); + clone.Item.prefix = PrefixID.Legendary; } return clone; @@ -204,7 +196,7 @@ namespace CalamityMod.Items.Weapons.Melee writer.Write(secondaryAttunement != null ? (byte)secondaryAttunement.id : Attunement.attunementArray.Length - 1); } - public override void NetRecieve(BinaryReader reader) + public override void NetReceive(BinaryReader reader) { mainAttunement = Attunement.attunementArray[reader.ReadInt32()]; secondaryAttunement = Attunement.attunementArray[reader.ReadInt32()]; @@ -240,18 +232,18 @@ namespace CalamityMod.Items.Weapons.Melee //Change the swords function based on its attunement if (mainAttunement == null) { - item.noUseGraphic = false; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = false; - item.channel = false; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 12f; - item.UseSound = SoundID.Item1; + Item.noUseGraphic = false; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = false; + Item.channel = false; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 12f; + Item.UseSound = SoundID.Item1; Combo = 0; } else - mainAttunement.ApplyStats(item); + mainAttunement.ApplyStats(Item); if (mainAttunement != null && mainAttunement.id != AttunementID.Cold) Combo = 0; @@ -307,8 +299,8 @@ namespace CalamityMod.Items.Weapons.Melee public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D itemTexture = Main.itemTexture[item.type]; - Rectangle itemFrame = (Main.itemAnimations[item.type] == null) ? itemTexture.Frame() : Main.itemAnimations[item.type].GetFrame(itemTexture); + Texture2D itemTexture = Main.itemTexture[Item.type]; + Rectangle itemFrame = (Main.itemAnimations[Item.type] == null) ? itemTexture.Frame() : Main.itemAnimations[Item.type].GetFrame(itemTexture); if (mainAttunement == null) return true; diff --git a/Items/Weapons/Melee/BladecrestOathsword.cs b/Items/Weapons/Melee/BladecrestOathsword.cs index 54bf3839e6..7d137b44f5 100644 --- a/Items/Weapons/Melee/BladecrestOathsword.cs +++ b/Items/Weapons/Melee/BladecrestOathsword.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 56; - item.height = 56; - item.damage = 25; - item.melee = true; - item.useAnimation = 21; - item.useTime = 21; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.noUseGraphic = true; - item.useTurn = true; - item.channel = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.shootSpeed = 6f; + Item.width = 56; + Item.height = 56; + Item.damage = 25; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 21; + Item.useTime = 21; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.noUseGraphic = true; + Item.useTurn = true; + Item.channel = true; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.shootSpeed = 6f; } public override bool CanUseItem(Player player) diff --git a/Items/Weapons/Melee/BladeofEnmity.cs b/Items/Weapons/Melee/BladeofEnmity.cs index ea01561a9c..dadf17f2c1 100644 --- a/Items/Weapons/Melee/BladeofEnmity.cs +++ b/Items/Weapons/Melee/BladeofEnmity.cs @@ -15,30 +15,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 60; - item.height = 64; - item.scale = 1.5f; - item.damage = 190; - item.melee = true; - item.useAnimation = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 10; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; + Item.width = 60; + Item.height = 64; + Item.scale = 1.5f; + Item.damage = 190; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 10; + Item.useTurn = true; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/BloodyEdge.cs b/Items/Weapons/Melee/BloodyEdge.cs index b40bca1128..93bbe3c791 100644 --- a/Items/Weapons/Melee/BloodyEdge.cs +++ b/Items/Weapons/Melee/BloodyEdge.cs @@ -17,40 +17,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 46; - item.damage = 70; - item.melee = true; - item.useAnimation = 23; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 23; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.useTurn = true; - item.height = 60; - item.scale = 1.25f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; + Item.width = 46; + Item.damage = 70; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 23; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 23; + Item.knockBack = 5.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.useTurn = true; + Item.height = 60; + Item.scale = 1.25f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LightsBane); - recipe.AddIngredient(ItemID.Muramasa); - recipe.AddIngredient(ItemID.BladeofGrass); - recipe.AddIngredient(ItemID.FieryGreatsword); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BloodButcherer); - recipe.AddIngredient(ItemID.Muramasa); - recipe.AddIngredient(ItemID.BladeofGrass); - recipe.AddIngredient(ItemID.FieryGreatsword); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LightsBane).AddIngredient(ItemID.Muramasa).AddIngredient(ItemID.BladeofGrass).AddIngredient(ItemID.FieryGreatsword).AddTile(TileID.DemonAltar).Register(); + CreateRecipe(1).AddIngredient(ItemID.BloodButcherer).AddIngredient(ItemID.Muramasa).AddIngredient(ItemID.BladeofGrass).AddIngredient(ItemID.FieryGreatsword).AddTile(TileID.DemonAltar).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/BloodyRupture.cs b/Items/Weapons/Melee/BloodyRupture.cs index 30316525eb..d44f481e8b 100644 --- a/Items/Weapons/Melee/BloodyRupture.cs +++ b/Items/Weapons/Melee/BloodyRupture.cs @@ -17,31 +17,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 15; - item.useTime = 15; - item.width = 24; - item.height = 24; - item.damage = 33; - item.melee = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 15; + Item.useTime = 15; + Item.width = 24; + Item.height = 24; + Item.damage = 33; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 5.5f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.Vertebrae, 2); - recipe.AddIngredient(ItemID.CrimtaneBar, 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ItemID.Vertebrae, 2).AddIngredient(ItemID.CrimtaneBar, 5).AddTile(TileID.DemonAltar).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -52,12 +46,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * 0.5f * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * 0.5f * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * 0.5f * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * 0.5f * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), Item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/Bonebreaker.cs b/Items/Weapons/Melee/Bonebreaker.cs index 8acdbdf2b1..190426d42e 100644 --- a/Items/Weapons/Melee/Bonebreaker.cs +++ b/Items/Weapons/Melee/Bonebreaker.cs @@ -18,33 +18,28 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = 15; - item.useTime = 15; - item.width = 32; - item.height = 32; - item.damage = BaseDamage; - item.melee = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.noMelee = true; - item.noUseGraphic = true; - item.shootSpeed = 12f; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = 15; + Item.useTime = 15; + Item.width = 32; + Item.height = 32; + Item.damage = BaseDamage; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.noMelee = true; + Item.noUseGraphic = true; + Item.shootSpeed = 12f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BoneJavelin, 150); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BoneJavelin, 150).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Melee/Brimlance.cs b/Items/Weapons/Melee/Brimlance.cs index 85b157d041..1157546de5 100644 --- a/Items/Weapons/Melee/Brimlance.cs +++ b/Items/Weapons/Melee/Brimlance.cs @@ -15,26 +15,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 56; - item.damage = 58; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 19; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 19; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 56; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().trueMelee = true; + Item.width = 56; + Item.damage = 58; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 19; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 19; + Item.knockBack = 7.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 56; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().trueMelee = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } } diff --git a/Items/Weapons/Melee/Brimlash.cs b/Items/Weapons/Melee/Brimlash.cs index 312e491fbf..5af2e2788b 100644 --- a/Items/Weapons/Melee/Brimlash.cs +++ b/Items/Weapons/Melee/Brimlash.cs @@ -19,31 +19,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = item.height = 54; - item.damage = 70; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.width = Item.height = 54; + Item.damage = 70; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 25; + Item.useTime = 25; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/BrimlashBuster.cs b/Items/Weapons/Melee/BrimlashBuster.cs index 02df521f38..9e0227de64 100644 --- a/Items/Weapons/Melee/BrimlashBuster.cs +++ b/Items/Weapons/Melee/BrimlashBuster.cs @@ -20,31 +20,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = item.height = 72; - item.damage = 126; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 8; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; + Item.width = Item.height = 72; + Item.damage = 126; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 25; + Item.useTime = 25; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 8; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.FragmentSolar, 10).AddTile(TileID.LunarCraftingStation).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/BrinyBaron.cs b/Items/Weapons/Melee/BrinyBaron.cs index 841e9442a2..931d7a7a3c 100644 --- a/Items/Weapons/Melee/BrinyBaron.cs +++ b/Items/Weapons/Melee/BrinyBaron.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 124; - item.knockBack = 4f; - item.useAnimation = item.useTime = 15; - item.melee = true; - item.useTurn = true; - item.autoReuse = true; - item.shootSpeed = 4f; + Item.damage = 124; + Item.knockBack = 4f; + Item.useAnimation = Item.useTime = 15; + Item.DamageType = DamageClass.Melee; + Item.useTurn = true; + Item.autoReuse = true; + Item.shootSpeed = 4f; - item.width = 100; - item.height = 102; - item.scale = 1.5f; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; + Item.width = 100; + Item.height = 102; + Item.scale = 1.5f; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; } public override bool AltFunctionUse(Player player) => true; @@ -41,17 +41,17 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - item.noMelee = true; - item.noUseGraphic = true; - item.UseSound = SoundID.Item84; - item.shoot = ModContent.ProjectileType(); + Item.noMelee = true; + Item.noUseGraphic = true; + Item.UseSound = SoundID.Item84; + Item.shoot = ModContent.ProjectileType(); } else { - item.noMelee = false; - item.noUseGraphic = false; - item.UseSound = SoundID.Item1; - item.shoot = ProjectileID.None; + Item.noMelee = false; + Item.noUseGraphic = false; + Item.UseSound = SoundID.Item1; + Item.shoot = ProjectileID.None; } return base.CanUseItem(player); } @@ -90,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Melee damage /= 2; if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, item.knockBack, player.whoAmI); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, Item.knockBack, player.whoAmI); } } } diff --git a/Items/Weapons/Melee/BurntSienna.cs b/Items/Weapons/Melee/BurntSienna.cs index e690791c7a..13338cb996 100644 --- a/Items/Weapons/Melee/BurntSienna.cs +++ b/Items/Weapons/Melee/BurntSienna.cs @@ -16,19 +16,19 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 42; - item.damage = 28; - item.melee = true; - item.useAnimation = item.useTime = 21; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 54; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.shootSpeed = 5f; + Item.width = 42; + Item.damage = 28; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = Item.useTime = 21; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 5.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 54; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.shootSpeed = 5f; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/Carnage.cs b/Items/Weapons/Melee/Carnage.cs index 0013515458..417c8dbd75 100644 --- a/Items/Weapons/Melee/Carnage.cs +++ b/Items/Weapons/Melee/Carnage.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -16,20 +17,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 46; - item.damage = 70; - item.melee = true; - item.useAnimation = 21; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 21; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.useTurn = true; - item.height = 60; - item.scale = 1.25f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; + Item.width = 46; + Item.damage = 70; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 21; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 21; + Item.knockBack = 5.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.useTurn = true; + Item.height = 60; + Item.scale = 1.25f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -47,14 +48,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - OnHitEffects(player, target.statLife <= 0, target.Center, target.width, target.height, item.knockBack); + OnHitEffects(player, target.statLife <= 0, target.Center, target.width, target.height, Item.knockBack); } private void OnHitEffects(Player player, bool health, Vector2 targetPos, int targetWidth, int targetHeight, float kBack) { if (health) { - Main.PlaySound(SoundID.Item74, targetPos); + SoundEngine.PlaySound(SoundID.Item74, targetPos); targetPos.X += (float)(targetWidth / 2); targetPos.Y += (float)(targetHeight / 2); targetPos.X -= (float)(targetWidth / 2); @@ -81,7 +82,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int i = 0; i < bloodAmt; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(targetPos, velocity, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), kBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(targetPos, velocity, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), kBack, player.whoAmI, 0f, 0f); } } } diff --git a/Items/Weapons/Melee/CatastropheClaymore.cs b/Items/Weapons/Melee/CatastropheClaymore.cs index 50acdb28a0..dc362b0cd1 100644 --- a/Items/Weapons/Melee/CatastropheClaymore.cs +++ b/Items/Weapons/Melee/CatastropheClaymore.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 56; - item.damage = 98; - item.melee = true; - item.useAnimation = 23; - item.useTime = 23; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 56; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = ItemRarityID.LightPurple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11f; + Item.width = 56; + Item.damage = 98; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 23; + Item.useTime = 23; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 56; + Item.value = Item.buyPrice(0, 48, 0, 0); + Item.rare = ItemRarityID.LightPurple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -48,17 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HallowedBar, 10); - recipe.AddIngredient(ItemID.CrystalShard, 7); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddRecipeGroup("CursedFlameIchor", 5); - recipe.AddIngredient(ItemID.SoulofMight, 3); - recipe.AddIngredient(ItemID.SoulofSight, 3); - recipe.AddIngredient(ItemID.SoulofFright, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HallowedBar, 10).AddIngredient(ItemID.CrystalShard, 7).AddIngredient(ItemID.SoulofNight, 5).AddRecipeGroup("CursedFlameIchor", 5).AddIngredient(ItemID.SoulofMight, 3).AddIngredient(ItemID.SoulofSight, 3).AddIngredient(ItemID.SoulofFright, 3).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/CausticEdge.cs b/Items/Weapons/Melee/CausticEdge.cs index 847ce05427..ccfedbcf1e 100644 --- a/Items/Weapons/Melee/CausticEdge.cs +++ b/Items/Weapons/Melee/CausticEdge.cs @@ -15,32 +15,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 46; - item.damage = 70; - item.scale = 1.4f; - item.melee = true; - item.useTurn = true; - item.useAnimation = 27; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 27; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 48; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; + Item.width = 46; + Item.damage = 70; + Item.scale = 1.4f; + Item.DamageType = DamageClass.Melee; + Item.useTurn = true; + Item.useAnimation = 27; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 27; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 48; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BladeofGrass); - recipe.AddIngredient(ItemID.LavaBucket); - recipe.AddRecipeGroup("Boss2Material", 3); - recipe.AddIngredient(ItemID.Deathweed, 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BladeofGrass).AddIngredient(ItemID.LavaBucket).AddRecipeGroup("Boss2Material", 3).AddIngredient(ItemID.Deathweed, 5).AddTile(TileID.DemonAltar).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/CelestialClaymore.cs b/Items/Weapons/Melee/CelestialClaymore.cs index 9f7f7ad21a..8f60f9914b 100644 --- a/Items/Weapons/Melee/CelestialClaymore.cs +++ b/Items/Weapons/Melee/CelestialClaymore.cs @@ -17,25 +17,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = item.height = 54; - item.damage = 70; - item.melee = true; - item.useAnimation = 19; - item.useTime = 19; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 0.1f; + Item.width = Item.height = 54; + Item.damage = 70; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 19; + Item.useTime = 19; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 5.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 0.1f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; diff --git a/Items/Weapons/Melee/Chaotrix.cs b/Items/Weapons/Melee/Chaotrix.cs index 0c9a41b895..cbcfb4c59f 100644 --- a/Items/Weapons/Melee/Chaotrix.cs +++ b/Items/Weapons/Melee/Chaotrix.cs @@ -13,42 +13,38 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Fault Line"); Tooltip.SetDefault("Explodes on enemy hits\n" + "A very agile yoyo"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 30; - item.height = 26; - item.melee = true; - item.damage = 88; // 110 pre-nerf - item.knockBack = 4f; - item.useTime = 22; - item.useAnimation = 22; - item.autoReuse = true; + Item.width = 30; + Item.height = 26; + Item.DamageType = DamageClass.Melee; + Item.damage = 88; // 110 pre-nerf + Item.knockBack = 4f; + Item.useTime = 22; + Item.useAnimation = 22; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; - item.rare = ItemRarityID.Yellow; - item.value = Item.buyPrice(gold: 80); + Item.rare = ItemRarityID.Yellow; + Item.value = Item.buyPrice(gold: 80); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/ClamCrusher.cs b/Items/Weapons/Melee/ClamCrusher.cs index 72a6ad3d0d..9676361950 100644 --- a/Items/Weapons/Melee/ClamCrusher.cs +++ b/Items/Weapons/Melee/ClamCrusher.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 150; - item.melee = true; - item.width = 40; - item.height = 60; - item.useTime = 50; - item.useAnimation = 50; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 10f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.channel = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; + Item.damage = 150; + Item.DamageType = DamageClass.Melee; + Item.width = 40; + Item.height = 60; + Item.useTime = 50; + Item.useAnimation = 50; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.knockBack = 10f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; } } } diff --git a/Items/Weapons/Melee/Cnidarian.cs b/Items/Weapons/Melee/Cnidarian.cs index 6b8e711144..801a1485e2 100644 --- a/Items/Weapons/Melee/Cnidarian.cs +++ b/Items/Weapons/Melee/Cnidarian.cs @@ -13,42 +13,38 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Cnidarian"); Tooltip.SetDefault("Fires a seashell when enemies are near\n" + "A very agile yoyo"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 30; - item.height = 26; - item.melee = true; - item.damage = 11; - item.knockBack = 3f; - item.useTime = 25; - item.useAnimation = 25; - item.autoReuse = true; + Item.width = 30; + Item.height = 26; + Item.DamageType = DamageClass.Melee; + Item.damage = 11; + Item.knockBack = 3f; + Item.useTime = 25; + Item.useAnimation = 25; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; - item.rare = ItemRarityID.Green; - item.value = Item.buyPrice(gold: 2); + Item.rare = ItemRarityID.Green; + Item.value = Item.buyPrice(gold: 2); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Melee/ColdheartIcicle.cs b/Items/Weapons/Melee/ColdheartIcicle.cs index 246f8f9f1b..496bb793f8 100644 --- a/Items/Weapons/Melee/ColdheartIcicle.cs +++ b/Items/Weapons/Melee/ColdheartIcicle.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Items.Weapons.Melee } public override void SetDefaults() { - item.damage = 1; - item.melee = true; - item.width = item.height = 24; - item.useTime = 27; - item.useAnimation = 27; - item.autoReuse = true; - item.useStyle = ItemUseStyleID.Stabbing; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; + Item.damage = 1; + Item.DamageType = DamageClass.Melee; + Item.width = Item.height = 24; + Item.useTime = 27; + Item.useAnimation = 27; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Thrust; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.knockBack = 3f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; } public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) diff --git a/Items/Weapons/Melee/CometQuasher.cs b/Items/Weapons/Melee/CometQuasher.cs index 606bde380d..62c9c150bd 100644 --- a/Items/Weapons/Melee/CometQuasher.cs +++ b/Items/Weapons/Melee/CometQuasher.cs @@ -17,26 +17,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 46; - item.height = 62; - item.scale = 1.5f; - item.damage = 90; - item.melee = true; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 7.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shootSpeed = 9f; + Item.width = 46; + Item.height = 62; + Item.scale = 1.5f; + Item.damage = 90; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 22; + Item.useTurn = true; + Item.knockBack = 7.75f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shootSpeed = 9f; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -87,7 +87,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -131,7 +131,7 @@ namespace CalamityMod.Items.Weapons.Melee num79 *= num80; float num114 = num78; float num115 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, ModContent.ProjectileType(), (int)(damage * 0.5f), item.knockBack, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, ModContent.ProjectileType(), (int)(damage * 0.5f), Item.knockBack, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); Main.projectile[proj].Calamity().lineColor = Main.rand.Next(3); } } @@ -146,12 +146,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 25); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.MeteoriteBar, 25).AddIngredient(ItemID.Ectoplasm, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/CorruptedCrusherBlade.cs b/Items/Weapons/Melee/CorruptedCrusherBlade.cs index fc42f2b21e..d2b8533fce 100644 --- a/Items/Weapons/Melee/CorruptedCrusherBlade.cs +++ b/Items/Weapons/Melee/CorruptedCrusherBlade.cs @@ -16,20 +16,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 42; - item.melee = true; - item.width = 66; - item.height = 80; - item.scale = 1.25f; - item.useTime = 26; - item.useAnimation = 26; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6.75f; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.damage = 42; + Item.DamageType = DamageClass.Melee; + Item.width = 66; + Item.height = 80; + Item.scale = 1.25f; + Item.useTime = 26; + Item.useAnimation = 26; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6.75f; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -52,15 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.EbonstoneBlock, 50); - recipe.AddIngredient(ItemID.ShadowScale, 5); - recipe.AddIngredient(ItemID.IronBar, 4); - recipe.anyIronBar = true; - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.EbonstoneBlock, 50).AddIngredient(ItemID.ShadowScale, 5).AddIngredient(ItemID.IronBar, 4).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Melee/CosmicDischarge.cs b/Items/Weapons/Melee/CosmicDischarge.cs index 593d74fa10..ccf2e566bb 100644 --- a/Items/Weapons/Melee/CosmicDischarge.cs +++ b/Items/Weapons/Melee/CosmicDischarge.cs @@ -17,25 +17,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 50; - item.height = 52; - item.damage = 400; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.autoReuse = true; - item.melee = true; - item.useAnimation = 15; - item.useTime = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 0.5f; - item.UseSound = SoundID.Item122; - item.shootSpeed = 24f; - item.shoot = ModContent.ProjectileType(); + Item.width = 50; + Item.height = 52; + Item.damage = 400; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 15; + Item.useTime = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 0.5f; + Item.UseSound = SoundID.Item122; + Item.shootSpeed = 24f; + Item.shoot = ModContent.ProjectileType(); - item.rare = ItemRarityID.Purple; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Melee/CosmicShiv.cs b/Items/Weapons/Melee/CosmicShiv.cs index 9e3853eb58..d1d7f851bc 100644 --- a/Items/Weapons/Melee/CosmicShiv.cs +++ b/Items/Weapons/Melee/CosmicShiv.cs @@ -21,44 +21,37 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 18; - item.useTime = 18; - item.width = 44; - item.height = 44; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 18; + Item.useTime = 18; + Item.width = 44; + Item.height = 44; - item.damage = 218; + Item.damage = 218; - item.melee = true; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 9f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().donorItem = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(ModContent.TileType()); - - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/CrescentMoon.cs b/Items/Weapons/Melee/CrescentMoon.cs index 4ba3fb522b..070eaa9392 100644 --- a/Items/Weapons/Melee/CrescentMoon.cs +++ b/Items/Weapons/Melee/CrescentMoon.cs @@ -19,24 +19,24 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 16; - item.height = 16; - item.damage = 300; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.autoReuse = true; - item.melee = true; - item.useAnimation = 18; - item.useTime = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 4f; - item.UseSound = SoundID.Item82; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.shootSpeed = 24f; - item.shoot = ModContent.ProjectileType(); + Item.width = 16; + Item.height = 16; + Item.damage = 300; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 18; + Item.useTime = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item82; + Item.value = Item.buyPrice(1, 40, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.shootSpeed = 24f; + Item.shoot = ModContent.ProjectileType(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -48,13 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 16); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 16).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Melee/CrimsonCrusherBlade.cs b/Items/Weapons/Melee/CrimsonCrusherBlade.cs index afe0b2f862..53438b5677 100644 --- a/Items/Weapons/Melee/CrimsonCrusherBlade.cs +++ b/Items/Weapons/Melee/CrimsonCrusherBlade.cs @@ -17,20 +17,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 40; - item.melee = true; - item.width = 70; - item.height = 80; - item.scale = 1.25f; - item.useTime = 28; - item.useAnimation = 28; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 7f; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.damage = 40; + Item.DamageType = DamageClass.Melee; + Item.width = 70; + Item.height = 80; + Item.scale = 1.25f; + Item.useTime = 28; + Item.useAnimation = 28; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 7f; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -59,15 +59,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.CrimstoneBlock, 50); - recipe.AddIngredient(ItemID.TissueSample, 5); - recipe.AddIngredient(ItemID.IronBar, 4); - recipe.anyIronBar = true; - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.CrimstoneBlock, 50).AddIngredient(ItemID.TissueSample, 5).AddIngredient(ItemID.IronBar, 4).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Melee/CrystalBlade.cs b/Items/Weapons/Melee/CrystalBlade.cs index c96bed9210..a71df2a9ce 100644 --- a/Items/Weapons/Melee/CrystalBlade.cs +++ b/Items/Weapons/Melee/CrystalBlade.cs @@ -15,33 +15,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 66; - item.damage = 45; - item.melee = true; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 25; - item.useTurn = true; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 66; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 3f; + Item.width = 66; + Item.damage = 45; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 25; + Item.useTurn = true; + Item.knockBack = 4.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 66; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 3f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalShard, 10); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddRecipeGroup("AnyCobaltBar", 8); - recipe.AddIngredient(ItemID.PixieDust, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.CrystalShard, 10).AddIngredient(ModContent.ItemType(), 15).AddRecipeGroup("AnyCobaltBar", 8).AddIngredient(ItemID.PixieDust, 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Melee/DarklightGreatsword.cs b/Items/Weapons/Melee/DarklightGreatsword.cs index 874745e86c..2b598de8cb 100644 --- a/Items/Weapons/Melee/DarklightGreatsword.cs +++ b/Items/Weapons/Melee/DarklightGreatsword.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 58; - item.damage = 123; - item.melee = true; - item.useAnimation = 36; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 36; - item.useTurn = true; - item.knockBack = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; - item.scale = 1.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 25f; + Item.width = 58; + Item.damage = 123; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 36; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 36; + Item.useTurn = true; + Item.knockBack = 5; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 60; + Item.scale = 1.5f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 25f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -44,14 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ItemID.FallenStar, 5); - recipe.AddIngredient(ItemID.SoulofNight); - recipe.AddIngredient(ItemID.SoulofLight); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ItemID.FallenStar, 5).AddIngredient(ItemID.SoulofNight).AddIngredient(ItemID.SoulofLight).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/DepthBlade.cs b/Items/Weapons/Melee/DepthBlade.cs index 0aeb7ea29b..9301069205 100644 --- a/Items/Weapons/Melee/DepthBlade.cs +++ b/Items/Weapons/Melee/DepthBlade.cs @@ -20,21 +20,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 36; - item.knockBack = 5.25f; - item.useTime = 17; - item.useAnimation = 22; - item.hammer = HammerPower; + Item.damage = 36; + Item.knockBack = 5.25f; + Item.useTime = 17; + Item.useAnimation = 22; + Item.hammer = HammerPower; - item.melee = true; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.width = 56; - item.height = 50; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; + Item.DamageType = DamageClass.Melee; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.width = 56; + Item.height = 50; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; } public override bool AltFunctionUse(Player player) => true; @@ -43,11 +43,11 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - item.hammer = 0; + Item.hammer = 0; } else { - item.hammer = HammerPower; + Item.hammer = HammerPower; } return base.CanUseItem(player); } diff --git a/Items/Weapons/Melee/Devastation.cs b/Items/Weapons/Melee/Devastation.cs index 0690be1bd2..69abf48af1 100644 --- a/Items/Weapons/Melee/Devastation.cs +++ b/Items/Weapons/Melee/Devastation.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 72; - item.damage = 132; - item.melee = true; - item.useAnimation = 24; - item.useTime = 24; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 72; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.width = 72; + Item.damage = 132; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 24; + Item.useTime = 24; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 72; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee break; } Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -103,14 +103,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.MeteoriteBar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LunarBar, 5).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.MeteoriteBar, 10).AddTile(TileID.LunarCraftingStation).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index 8e2e78ba52..efbfcd818d 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -7,6 +7,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -21,22 +22,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 118; - item.height = 118; - item.damage = 166; - item.melee = true; - item.useAnimation = 20; - item.useTime = 20; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 28f; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 118; + Item.height = 118; + Item.damage = 166; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 20; + Item.useTime = 20; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6.75f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 28f; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -50,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Melee } //Not actually sure what this middle code does - float speed = item.shootSpeed; + float speed = Item.shootSpeed; Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); float directionX = (float)Main.mouseX + Main.screenPosition.X - source.X; float directionY = (float)Main.mouseY + Main.screenPosition.Y - source.Y; @@ -104,14 +105,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -135,7 +129,7 @@ namespace CalamityMod.Items.Weapons.Melee float scalar3 = 2f; Vector2 value3 = (target.rotation - MathHelper.PiOver2).ToRotationVector2(); Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.position); for (int i = 0; i < 40; i++) { int dustInt = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 200, default, scalar1); @@ -175,7 +169,7 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(ModContent.BuffType(), 450); target.AddBuff(BuffID.OnFire, 900); - Main.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.position); } } } diff --git a/Items/Weapons/Melee/DevilsSunrise.cs b/Items/Weapons/Melee/DevilsSunrise.cs index 694331a188..55bb0b0232 100644 --- a/Items/Weapons/Melee/DevilsSunrise.cs +++ b/Items/Weapons/Melee/DevilsSunrise.cs @@ -19,26 +19,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 66; - item.height = 66; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.damage = BaseDamage; - item.knockBack = 4f; - item.useAnimation = 25; - item.useTime = 5; - item.autoReuse = false; - item.useStyle = ItemUseStyleID.HoldingOut; + Item.width = 66; + Item.height = 66; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.damage = BaseDamage; + Item.knockBack = 4f; + Item.useAnimation = 25; + Item.useTime = 5; + Item.autoReuse = false; + Item.useStyle = ItemUseStyleID.Shoot; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().donorItem = true; - item.Calamity().trueMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24f; + Item.Calamity().trueMelee = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; } // Terraria seems to really dislike high crit values in SetDefaults @@ -53,13 +53,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ItemID.Arkhalis); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddIngredient(ModContent.ItemType(), 25); - r.AddTile(TileID.LunarCraftingStation); - r.SetResult(this); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Arkhalis).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 25).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Melee/DiseasedPike.cs b/Items/Weapons/Melee/DiseasedPike.cs index a75c934412..fdbfbc147b 100644 --- a/Items/Weapons/Melee/DiseasedPike.cs +++ b/Items/Weapons/Melee/DiseasedPike.cs @@ -15,26 +15,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 62; - item.damage = 65; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 20; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 58; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.Calamity().trueMelee = true; + Item.width = 62; + Item.damage = 65; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 20; + Item.knockBack = 8.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 58; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.Calamity().trueMelee = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } } diff --git a/Items/Weapons/Melee/DivineHatchet.cs b/Items/Weapons/Melee/DivineHatchet.cs index b75d91d43a..3ee19a5d25 100644 --- a/Items/Weapons/Melee/DivineHatchet.cs +++ b/Items/Weapons/Melee/DivineHatchet.cs @@ -16,35 +16,28 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 60; - item.damage = 177; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 17; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 17; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 62; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 60; + Item.damage = 177; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useAnimation = 17; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 17; + Item.knockBack = 8.5f; + Item.UseSound = SoundID.Item1; + Item.DamageType = DamageClass.Melee; + Item.height = 62; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PossessedHatchet); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.PossessedHatchet).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 9).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Melee/DraconicDestruction.cs b/Items/Weapons/Melee/DraconicDestruction.cs index a33aa1bbff..f695a17303 100644 --- a/Items/Weapons/Melee/DraconicDestruction.cs +++ b/Items/Weapons/Melee/DraconicDestruction.cs @@ -19,35 +19,28 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 94; - item.damage = 80; - item.melee = true; - item.useAnimation = 24; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 24; - item.useTurn = true; - item.knockBack = 7.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 94; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.width = 94; + Item.damage = 80; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 24; + Item.useTurn = true; + Item.knockBack = 7.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 94; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.FragmentSolar, 10).AddTile(ModContent.TileType()).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/DraedonsExoblade.cs b/Items/Weapons/Melee/DraedonsExoblade.cs index 2496b82d26..080e846ee8 100644 --- a/Items/Weapons/Melee/DraedonsExoblade.cs +++ b/Items/Weapons/Melee/DraedonsExoblade.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -22,22 +23,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 80; - item.damage = 900; - item.useAnimation = 14; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 14; - item.useTurn = true; - item.melee = true; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 114; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 19f; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 80; + Item.damage = 900; + Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 14; + Item.useTurn = true; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 9f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 114; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 19f; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -55,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Main.myPlayer); target.ExoDebuffs(); - Main.PlaySound(SoundID.Item88, player.Center); + SoundEngine.PlaySound(SoundID.Item88, player.Center); float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); float yPos = player.position.Y + Main.rand.Next(-800, 801); Vector2 startPos = new Vector2(xPos, yPos); @@ -88,10 +89,10 @@ namespace CalamityMod.Items.Weapons.Melee damage /= 2; if (target.statLife <= (target.statLifeMax2 * 0.05f)) - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), damage, item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), damage, Item.knockBack, Main.myPlayer); target.ExoDebuffs(); - Main.PlaySound(SoundID.Item88, player.Center); + SoundEngine.PlaySound(SoundID.Item88, player.Center); float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); float yPos = player.position.Y + Main.rand.Next(-800, 801); Vector2 startPos = new Vector2(xPos, yPos); @@ -106,7 +107,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int comet = 0; comet < 2; comet++) { float ai1 = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), damage, item.knockBack, player.whoAmI, 0f, ai1); + Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), damage, Item.knockBack, player.whoAmI, 0f, ai1); } } @@ -120,16 +121,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/DragonPow.cs b/Items/Weapons/Melee/DragonPow.cs index dbe17614b3..780af1a7e5 100644 --- a/Items/Weapons/Melee/DragonPow.cs +++ b/Items/Weapons/Melee/DragonPow.cs @@ -25,44 +25,32 @@ Summons a barrage of petals and waterfalls on enemy hits"); public override void SetDefaults() { - item.width = 76; - item.height = 82; - item.melee = true; - item.damage = 660; - item.knockBack = 9f; - item.useAnimation = 20; - item.useTime = 20; - item.autoReuse = true; - item.noMelee = true; - item.noUseGraphic = true; + Item.width = 76; + Item.height = 82; + Item.DamageType = DamageClass.Melee; + Item.damage = 660; + Item.knockBack = 9f; + Item.useAnimation = 20; + Item.useTime = 20; + Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"); - item.channel = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"); + Item.channel = true; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = Speed; } public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ItemID.DaoofPow); - r.AddIngredient(ItemID.FlowerPow); - r.AddIngredient(ItemID.Flairon); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 4); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddTile(ModContent.TileType()); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.DaoofPow).AddIngredient(ItemID.FlowerPow).AddIngredient(ItemID.Flairon).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/DragonRage.cs b/Items/Weapons/Melee/DragonRage.cs index 294b611c21..9a64a279b4 100644 --- a/Items/Weapons/Melee/DragonRage.cs +++ b/Items/Weapons/Melee/DragonRage.cs @@ -15,25 +15,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 1275; - item.knockBack = 7.5f; - item.useAnimation = item.useTime = 25; - item.melee = true; - item.noMelee = true; - item.channel = true; - item.autoReuse = true; - item.shootSpeed = 14f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 1275; + Item.knockBack = 7.5f; + Item.useAnimation = Item.useTime = 25; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.channel = true; + Item.autoReuse = true; + Item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); - item.width = 128; - item.height = 140; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.DD2_SkyDragonsFurySwing; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().trueMelee = true; + Item.width = 128; + Item.height = 140; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.DD2_SkyDragonsFurySwing; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().trueMelee = true; } } } diff --git a/Items/Weapons/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index 732f262048..a9c08740aa 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -24,22 +24,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 92; - item.height = 104; - item.scale = 1.5f; - item.damage = 170; - item.melee = true; - item.useAnimation = 16; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 16; - item.useTurn = true; - item.knockBack = 9.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.width = 92; + Item.height = 104; + Item.scale = 1.5f; + Item.damage = 170; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 16; + Item.useTurn = true; + Item.knockBack = 9.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -86,7 +86,7 @@ namespace CalamityMod.Items.Weapons.Melee num79 *= num80; float speedX4 = num78; float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); } if (target.Calamity().miscDefenseLoss < target.defense) @@ -144,7 +144,7 @@ namespace CalamityMod.Items.Weapons.Melee num79 *= num80; float speedX4 = num78; float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), Item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); } if (player.moonLeech) @@ -157,13 +157,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/EarthenPike.cs b/Items/Weapons/Melee/EarthenPike.cs index 66cb16f138..9aec659608 100644 --- a/Items/Weapons/Melee/EarthenPike.cs +++ b/Items/Weapons/Melee/EarthenPike.cs @@ -16,25 +16,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 60; - item.damage = 90; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 25; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; + Item.width = 60; + Item.damage = 90; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 25; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 60; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } } diff --git a/Items/Weapons/Melee/ElementalExcalibur.cs b/Items/Weapons/Melee/ElementalExcalibur.cs index 40b455ff56..95441e03a3 100644 --- a/Items/Weapons/Melee/ElementalExcalibur.cs +++ b/Items/Weapons/Melee/ElementalExcalibur.cs @@ -26,22 +26,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = BaseDamage; - item.useAnimation = 14; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 14; - item.useTurn = true; - item.melee = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.width = 112; - item.height = 112; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = ItemRarityID.Purple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; - item.Calamity().customRarity = CalamityRarity.Rainbow; + Item.damage = BaseDamage; + Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 14; + Item.useTurn = true; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.width = 112; + Item.height = 112; + Item.value = Item.buyPrice(5, 0, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; + Item.Calamity().customRarity = CalamityRarity.Rainbow; } // Terraria seems to really dislike high crit values in SetDefaults @@ -64,13 +64,13 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - item.shoot = ProjectileID.None; - item.shootSpeed = 0f; + Item.shoot = ProjectileID.None; + Item.shootSpeed = 0f; } else { - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } return base.CanUseItem(player); @@ -171,20 +171,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.TrueExcalibur); - recipe.AddIngredient(ItemID.LargeDiamond); - recipe.AddIngredient(ItemID.LightShard, 3); - recipe.AddIngredient(ItemID.DarkShard, 3); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.SoulofLight, 20); - recipe.AddIngredient(ItemID.SoulofNight, 20); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.TrueExcalibur).AddIngredient(ItemID.LargeDiamond).AddIngredient(ItemID.LightShard, 3).AddIngredient(ItemID.DarkShard, 3).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.SoulofLight, 20).AddIngredient(ItemID.SoulofNight, 20).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/ElementalShortsword.cs b/Items/Weapons/Melee/ElementalShortsword.cs index 02f916ea36..945b8990e1 100644 --- a/Items/Weapons/Melee/ElementalShortsword.cs +++ b/Items/Weapons/Melee/ElementalShortsword.cs @@ -19,39 +19,33 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 10; - item.useTime = 10; - item.width = 44; - item.height = 44; - item.damage = 168; - item.melee = true; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 10; + Item.useTime = 10; + Item.width = 44; + Item.height = 44; + Item.damage = 168; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 8.5f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, (int)(damage * 0.5), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, (int)(damage * 0.5), knockBack, player.whoAmI, 0f, 0f); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/EmpyreanKnives.cs b/Items/Weapons/Melee/EmpyreanKnives.cs index 8f03327839..50f21f8cf8 100644 --- a/Items/Weapons/Melee/EmpyreanKnives.cs +++ b/Items/Weapons/Melee/EmpyreanKnives.cs @@ -19,28 +19,28 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 18; - item.damage = 230; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 3f; - item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.height = 20; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + Item.width = 18; + Item.damage = 230; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 15; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item39; + Item.autoReuse = true; + Item.height = 20; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); Vector2 vector3 = Main.MouseWorld - vector2; @@ -100,14 +100,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.VampireKnives); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.VampireKnives).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/EssenceFlayer.cs b/Items/Weapons/Melee/EssenceFlayer.cs index 03a4f8b4f2..c43acb5291 100644 --- a/Items/Weapons/Melee/EssenceFlayer.cs +++ b/Items/Weapons/Melee/EssenceFlayer.cs @@ -20,36 +20,32 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 100; - item.damage = 180; - item.melee = true; - item.useAnimation = 19; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 19; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item71; - item.autoReuse = true; - item.height = 78; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 21f; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 100; + Item.damage = 180; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 19; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 19; + Item.useTurn = true; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item71; + Item.autoReuse = true; + Item.height = 78; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 21f; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/EssenceFlayerGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/EssenceFlayerGlow")); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(ModContent.TileType()).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/EutrophicScimitar.cs b/Items/Weapons/Melee/EutrophicScimitar.cs index 0c894116c7..9bf5cad4fb 100644 --- a/Items/Weapons/Melee/EutrophicScimitar.cs +++ b/Items/Weapons/Melee/EutrophicScimitar.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 110; - item.melee = true; - item.width = 64; - item.height = 78; - item.useTime = 40; - item.useAnimation = 40; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 2; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 17; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.useTurn = true; + Item.damage = 110; + Item.DamageType = DamageClass.Melee; + Item.width = 64; + Item.height = 78; + Item.useTime = 40; + Item.useAnimation = 40; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 2; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 17; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.useTurn = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Melee/EutrophicShank.cs b/Items/Weapons/Melee/EutrophicShank.cs index cd7205c3d1..3399fc0c7f 100644 --- a/Items/Weapons/Melee/EutrophicShank.cs +++ b/Items/Weapons/Melee/EutrophicShank.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 14; - item.useTime = 14; - item.width = 42; - item.height = 38; - item.damage = 35; - item.melee = true; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 14; + Item.useTime = 14; + Item.width = 42; + Item.height = 38; + Item.damage = 35; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/EvilSmasher.cs b/Items/Weapons/Melee/EvilSmasher.cs index 163a13681d..1fbc6fac3b 100644 --- a/Items/Weapons/Melee/EvilSmasher.cs +++ b/Items/Weapons/Melee/EvilSmasher.cs @@ -18,19 +18,19 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 64; - item.height = 66; - item.scale = 2f; - item.damage = 100; - item.melee = true; - item.useAnimation = item.useTime = 38; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; + Item.width = 64; + Item.height = 66; + Item.scale = 2f; + Item.damage = 100; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = Item.useTime = 38; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; } public override float UseTimeMultiplier (Player player) => 1f + (player.Calamity().evilSmasherBoost * 0.1f); diff --git a/Items/Weapons/Melee/ExcaliburShortsword.cs b/Items/Weapons/Melee/ExcaliburShortsword.cs index 53108a6924..0d8f5091b3 100644 --- a/Items/Weapons/Melee/ExcaliburShortsword.cs +++ b/Items/Weapons/Melee/ExcaliburShortsword.cs @@ -15,29 +15,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 10; - item.useTime = 10; - item.width = 40; - item.height = 40; - item.damage = 70; - item.melee = true; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 10; + Item.useTime = 10; + Item.width = 40; + Item.height = 40; + Item.damage = 70; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 5.25f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HallowedBar, 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HallowedBar, 7).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/Excelsus.cs b/Items/Weapons/Melee/Excelsus.cs index 0eb5e8a9a5..084b5b5d45 100644 --- a/Items/Weapons/Melee/Excelsus.cs +++ b/Items/Weapons/Melee/Excelsus.cs @@ -18,27 +18,27 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 78; - item.damage = 279; - item.melee = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 94; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.width = 78; + Item.damage = 279; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 15; + Item.useTurn = true; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 94; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ExcelsusGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/ExcelsusGlow")); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Melee/ExoGladius.cs b/Items/Weapons/Melee/ExoGladius.cs index 89c89c2695..01a766b953 100644 --- a/Items/Weapons/Melee/ExoGladius.cs +++ b/Items/Weapons/Melee/ExoGladius.cs @@ -22,41 +22,34 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 12; - item.useTime = 12; - item.width = 56; - item.height = 56; - item.damage = 690; - item.melee = true; - item.knockBack = 9.9f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 19f; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 12; + Item.useTime = 12; + Item.width = 56; + Item.height = 56; + Item.damage = 690; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 9.9f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 19f; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/ExsanguinationLance.cs b/Items/Weapons/Melee/ExsanguinationLance.cs index a792d8b1fb..d07fb2ae4f 100644 --- a/Items/Weapons/Melee/ExsanguinationLance.cs +++ b/Items/Weapons/Melee/ExsanguinationLance.cs @@ -16,35 +16,31 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 44; - item.damage = 90; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 22; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.Calamity().trueMelee = true; + Item.width = 44; + Item.damage = 90; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 22; + Item.knockBack = 6.75f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 44; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.Calamity().trueMelee = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/FeralthornClaymore.cs b/Items/Weapons/Melee/FeralthornClaymore.cs index c0aa985957..d54f9f783a 100644 --- a/Items/Weapons/Melee/FeralthornClaymore.cs +++ b/Items/Weapons/Melee/FeralthornClaymore.cs @@ -17,28 +17,24 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 68; - item.damage = 80; - item.melee = true; - item.useAnimation = 13; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 13; - item.useTurn = true; - item.knockBack = 7.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 66; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; + Item.width = 68; + Item.damage = 80; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 13; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 13; + Item.useTurn = true; + Item.knockBack = 7.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 66; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/FlameburstShortsword.cs b/Items/Weapons/Melee/FlameburstShortsword.cs index 44f5a7d8ab..ab723eab63 100644 --- a/Items/Weapons/Melee/FlameburstShortsword.cs +++ b/Items/Weapons/Melee/FlameburstShortsword.cs @@ -16,29 +16,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 15; - item.useTime = 15; - item.width = 30; - item.height = 30; - item.damage = 35; - item.melee = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 15; + Item.useTime = 15; + Item.width = 30; + Item.height = 30; + Item.damage = 35; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 5.5f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 7); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HellstoneBar, 7).AddTile(TileID.Anvils).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -49,14 +45,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - int boom = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * 0.75f * player.MeleeDamage()), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int boom = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * 0.75f * player.MeleeDamage()), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (boom.WithinBounds(Main.maxProjectiles)) Main.projectile[boom].Calamity().forceMelee = true; } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - int boom = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * 0.75f * player.MeleeDamage()), item.knockBack, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int boom = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * 0.75f * player.MeleeDamage()), Item.knockBack, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (boom.WithinBounds(Main.maxProjectiles)) Main.projectile[boom].Calamity().forceMelee = true; } diff --git a/Items/Weapons/Melee/FlarefrostBlade.cs b/Items/Weapons/Melee/FlarefrostBlade.cs index 5b59f39bbc..007751a38a 100644 --- a/Items/Weapons/Melee/FlarefrostBlade.cs +++ b/Items/Weapons/Melee/FlarefrostBlade.cs @@ -17,32 +17,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 64; - item.damage = 95; - item.melee = true; - item.useAnimation = 24; - item.useTime = 24; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 66; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11f; + Item.width = 64; + Item.damage = 95; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 24; + Item.useTime = 24; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 66; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.HellstoneBar, 8); - recipe.AddIngredient(ItemID.SoulofLight, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.HellstoneBar, 8).AddIngredient(ItemID.SoulofLight, 3).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/Floodtide.cs b/Items/Weapons/Melee/Floodtide.cs index 62aaba7b73..05d2dfbc87 100644 --- a/Items/Weapons/Melee/Floodtide.cs +++ b/Items/Weapons/Melee/Floodtide.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 89; - item.melee = true; - item.width = 80; - item.height = 92; - item.useTime = 21; - item.useAnimation = 21; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; + Item.damage = 89; + Item.DamageType = DamageClass.Melee; + Item.width = 80; + Item.height = 92; + Item.useTime = 21; + Item.useAnimation = 21; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; } public override void UseStyle(Player player) @@ -63,16 +63,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.SharkFin, 2); - recipe.AddRecipeGroup("AnyAdamantiteBar", 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.SharkFin, 2).AddRecipeGroup("AnyAdamantiteBar", 5).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index cd082e0ce8..7b2b3e06b9 100644 --- a/Items/Weapons/Melee/ForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ForbiddenOathblade.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -17,33 +18,27 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 74; - item.height = 74; - item.scale = 1.5f; - item.damage = 110; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.width = 74; + Item.height = 74; + Item.scale = 1.5f; + Item.damage = 110; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 25; + Item.useTime = 25; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofFright, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofFright, 5).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -60,13 +55,13 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(BuffID.ShadowFlame, 360); target.AddBuff(BuffID.OnFire, 720); - player.ApplyDamageToNPC(target, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)) * 2, 0f, 0, false); + player.ApplyDamageToNPC(target, (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)) * 2, 0f, 0, false); float num50 = 1.7f; float num51 = 0.8f; float num52 = 2f; Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.position); int num3; for (int num53 = 0; num53 < 40; num53 = num3 + 1) { @@ -109,7 +104,7 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(ModContent.BuffType(), 360); target.AddBuff(BuffID.OnFire, 720); - Main.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.position); } } } diff --git a/Items/Weapons/Melee/ForsakenSaber.cs b/Items/Weapons/Melee/ForsakenSaber.cs index 039cdd503e..4432c93ab5 100644 --- a/Items/Weapons/Melee/ForsakenSaber.cs +++ b/Items/Weapons/Melee/ForsakenSaber.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 46; - item.damage = 65; - item.melee = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 6; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 56; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + Item.width = 46; + Item.damage = 65; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.useTurn = true; + Item.knockBack = 6; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 56; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -46,12 +46,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyAdamantiteBar", 5); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyAdamantiteBar", 5).AddIngredient(ItemID.AncientBattleArmorMaterial, 2).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/FourSeasonsGalaxia.cs b/Items/Weapons/Melee/FourSeasonsGalaxia.cs index e112df0b30..6d9f0117cd 100644 --- a/Items/Weapons/Melee/FourSeasonsGalaxia.cs +++ b/Items/Weapons/Melee/FourSeasonsGalaxia.cs @@ -93,10 +93,10 @@ namespace CalamityMod.Items.Weapons.Melee if (player is null) return; - var effectDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria"); - var passiveDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip1" && x.mod == "Terraria"); - var mainAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip4" && x.mod == "Terraria"); - var blessingTooltip = list.FirstOrDefault(x => x.Name == "Tooltip5" && x.mod == "Terraria"); + var effectDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); + var passiveDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip1" && x.Mod == "Terraria"); + var mainAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip4" && x.Mod == "Terraria"); + var blessingTooltip = list.FirstOrDefault(x => x.Name == "Tooltip5" && x.Mod == "Terraria"); //Default stuff gets skipped here. MainAttunement is set to true in SafeCheckAttunements() above @@ -123,32 +123,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = item.height = 128; - item.damage = BaseDamage; - item.melee = true; - item.useAnimation = 18; - item.useTime = 18; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 24f; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = Item.height = 128; + Item.damage = BaseDamage; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 18; + Item.useTime = 18; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 9f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 24f; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType(), 8); - recipe.AddIngredient(ItemType(), 8); - recipe.AddTile(TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemType()).AddIngredient(ItemType(), 8).AddIngredient(ItemType(), 8).AddTile(TileType()).Register(); } #region saving and syncing attunements @@ -194,7 +188,7 @@ namespace CalamityMod.Items.Weapons.Melee writer.Write(mainAttunement != null ? (byte)mainAttunement.id : Attunement.attunementArray.Length - 1); } - public override void NetRecieve(BinaryReader reader) + public override void NetReceive(BinaryReader reader) { mainAttunement = Attunement.attunementArray[reader.ReadInt32()]; } @@ -241,7 +235,7 @@ namespace CalamityMod.Items.Weapons.Melee SafeCheckAttunements(); - mainAttunement.ApplyStats(item); + mainAttunement.ApplyStats(Item); //Passive effects only jappen player side haha if (player.whoAmI != Main.myPlayer) @@ -312,13 +306,13 @@ namespace CalamityMod.Items.Weapons.Melee spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, null, null, null, Main.UIScaleMatrix); - spriteBatch.Draw(outlineTexture, item.Center - Main.screenPosition, animFrame, lightColor, rotation, item.Size * 0.5f, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(outlineTexture, Item.Center - Main.screenPosition, animFrame, lightColor, rotation, Item.Size * 0.5f, scale, SpriteEffects.None, 0f); spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Main.UIScaleMatrix); - spriteBatch.Draw(itemTexture, item.Center - Main.screenPosition, animFrame, lightColor, rotation, item.Size * 0.5f, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(itemTexture, Item.Center - Main.screenPosition, animFrame, lightColor, rotation, Item.Size * 0.5f, scale, SpriteEffects.None, 0f); return false; } } diff --git a/Items/Weapons/Melee/FulgurationHalberd.cs b/Items/Weapons/Melee/FulgurationHalberd.cs index 70732fcc5a..ea36befaf8 100644 --- a/Items/Weapons/Melee/FulgurationHalberd.cs +++ b/Items/Weapons/Melee/FulgurationHalberd.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 60; - item.height = 64; - item.scale = 1.5f; - item.damage = 70; - item.melee = true; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shootSpeed = 8f; - item.Calamity().trueMelee = true; + Item.width = 60; + Item.height = 64; + Item.scale = 1.5f; + Item.damage = 70; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 22; + Item.useTurn = true; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shootSpeed = 8f; + Item.Calamity().trueMelee = true; } public override bool AltFunctionUse(Player player) @@ -45,18 +45,18 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.shoot = ModContent.ProjectileType(); - return player.ownedProjectileCounts[item.shoot] <= 0; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.shoot = ModContent.ProjectileType(); + return player.ownedProjectileCounts[Item.shoot] <= 0; } else { - item.noMelee = false; - item.noUseGraphic = false; - item.useStyle = ItemUseStyleID.SwingThrow; - item.shoot = ProjectileID.None; + Item.noMelee = false; + Item.noUseGraphic = false; + Item.useStyle = ItemUseStyleID.Swing; + Item.shoot = ProjectileID.None; return base.CanUseItem(player); } } @@ -79,12 +79,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyAdamantiteBar", 10); - recipe.AddIngredient(ItemID.CrystalShard, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyAdamantiteBar", 10).AddIngredient(ItemID.CrystalShard, 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index f91ea3db3f..9703a18fac 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -4,7 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.Items.Weapons.Melee { @@ -41,23 +41,23 @@ namespace CalamityMod.Items.Weapons.Melee //NOTE: GetWeaponDamage is in the CalamityPlayer file public override void SetDefaults() { - item.width = 88; - item.height = 84; - item.damage = BaseDamage; - item.melee = true; - item.useAnimation = item.useTime = 12; - item.useTurn = true; - item.knockBack = 9; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.width = 88; + Item.height = 84; + Item.damage = BaseDamage; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = Item.useTime = 12; + Item.useTurn = true; + Item.knockBack = 9; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().devItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.useStyle = ItemUseStyleID.SwingThrow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.useStyle = ItemUseStyleID.Swing; } public override Vector2? HoldoutOffset() => new Vector2(12, 12); @@ -86,8 +86,8 @@ namespace CalamityMod.Items.Weapons.Melee { float r = (float)Math.Sqrt(Main.rand.NextDouble()); float t = Main.rand.NextFloat() * MathHelper.TwoPi; - Vector2 dustSpawn = t.ToRotationVector2() * r * item.Size; - if (dustSpawn.X > item.width / 2) + Vector2 dustSpawn = t.ToRotationVector2() * r * Item.Size; + if (dustSpawn.X > Item.width / 2) { Dust.NewDustPerfect(player.MountedCenter + dustSpawn.RotatedBy(player.itemRotation) * player.direction, 218, Vector2.Zero).noGravity = true; } @@ -102,7 +102,7 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(player.MountedCenter + dustSpawn.RotatedBy(player.itemRotation) * player.direction, Vector2.Zero, ModContent.ProjectileType(), - (int)(item.damage * player.MeleeDamage()), + (int)(Item.damage * player.MeleeDamage()), 0f, player.whoAmI); } diff --git a/Items/Weapons/Melee/GalacticaBlade.cs b/Items/Weapons/Melee/GalacticaBlade.cs index 78c3763430..4a7cfa83c1 100644 --- a/Items/Weapons/Melee/GalacticaBlade.cs +++ b/Items/Weapons/Melee/GalacticaBlade.cs @@ -20,42 +20,32 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 60; - item.damage = 84; - item.melee = true; - item.useAnimation = 17; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 17; - item.useTurn = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item105; - item.autoReuse = true; - item.height = 58; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 23f; + Item.width = 60; + Item.damage = 84; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 17; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 17; + Item.useTurn = true; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item105; + Item.autoReuse = true; + Item.height = 58; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 23f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.StarWrath); - recipe.AddIngredient(ItemID.SoulofMight, 20); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ItemID.DarkShard); - recipe.AddIngredient(ItemID.LightShard); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.StarWrath).AddIngredient(ItemID.SoulofMight, 20).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddIngredient(ItemID.DarkShard).AddIngredient(ItemID.LightShard).AddTile(TileID.LunarCraftingStation).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Melee/GalaxySmasherMelee.cs b/Items/Weapons/Melee/GalaxySmasherMelee.cs index a7762cb416..364de40c28 100644 --- a/Items/Weapons/Melee/GalaxySmasherMelee.cs +++ b/Items/Weapons/Melee/GalaxySmasherMelee.cs @@ -21,26 +21,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 86; - item.height = 72; - item.melee = true; - item.damage = BaseDamage; - item.knockBack = 9f; - item.useAnimation = 13; - item.useTime = 13; - item.autoReuse = true; - item.noMelee = true; - item.noUseGraphic = true; + Item.width = 86; + Item.height = 72; + Item.DamageType = DamageClass.Melee; + Item.damage = BaseDamage; + Item.knockBack = 9f; + Item.useAnimation = 13; + Item.useTime = 13; + Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = Item.buyPrice(platinum: 1, gold: 80); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = Item.buyPrice(platinum: 1, gold: 80); - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = Speed; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -51,12 +51,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddTile(ModContent.TileType()); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/GalileoGladius.cs b/Items/Weapons/Melee/GalileoGladius.cs index 2e5db9a154..a87313fa7e 100644 --- a/Items/Weapons/Melee/GalileoGladius.cs +++ b/Items/Weapons/Melee/GalileoGladius.cs @@ -21,41 +21,35 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 10; - item.useTime = 10; - item.width = 44; - item.height = 44; - item.damage = 110; - item.melee = true; - item.knockBack = 10f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 10; + Item.useTime = 10; + Item.width = 44; + Item.height = 44; + Item.damage = 110; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 10f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int moonDamage = (int)(damage * 0.3333f); - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, moonDamage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, moonDamage, knockBack, player.whoAmI, 0f, 0f); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.LunarCraftingStation).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/GeliticBlade.cs b/Items/Weapons/Melee/GeliticBlade.cs index c80695d124..8ec317b35b 100644 --- a/Items/Weapons/Melee/GeliticBlade.cs +++ b/Items/Weapons/Melee/GeliticBlade.cs @@ -18,32 +18,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 62; - item.damage = 38; - item.melee = true; - item.useAnimation = 30; - item.useTime = 30; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + Item.width = 62; + Item.damage = 38; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 30; + Item.useTime = 30; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 5.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 62; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddIngredient(ItemID.Gel, 35); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 30).AddIngredient(ItemID.Gel, 35).AddIngredient(ItemID.HellstoneBar, 10).AddTile(ModContent.TileType()).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/GildedProboscis.cs b/Items/Weapons/Melee/GildedProboscis.cs index c357fb1217..20f900330e 100644 --- a/Items/Weapons/Melee/GildedProboscis.cs +++ b/Items/Weapons/Melee/GildedProboscis.cs @@ -15,26 +15,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 66; - item.damage = 315; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 19; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 19; - item.knockBack = 8.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 66; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; - item.Calamity().trueMelee = true; + Item.width = 66; + Item.damage = 315; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 19; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 19; + Item.knockBack = 8.75f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 66; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13f; + Item.Calamity().trueMelee = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } } diff --git a/Items/Weapons/Melee/GlacialCrusher.cs b/Items/Weapons/Melee/GlacialCrusher.cs index d6df380344..c6a234afc2 100644 --- a/Items/Weapons/Melee/GlacialCrusher.cs +++ b/Items/Weapons/Melee/GlacialCrusher.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 60; - item.damage = 120; - item.melee = true; - item.useAnimation = 27; - item.useTime = 27; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 58; - item.scale = 2f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.width = 60; + Item.damage = 120; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 27; + Item.useTime = 27; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 58; + Item.scale = 2f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/GoldplumeSpear.cs b/Items/Weapons/Melee/GoldplumeSpear.cs index 38273af846..e1b68ebe71 100644 --- a/Items/Weapons/Melee/GoldplumeSpear.cs +++ b/Items/Weapons/Melee/GoldplumeSpear.cs @@ -16,35 +16,30 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 54; - item.damage = 48; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 23; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 23; - item.knockBack = 5.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 54; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; + Item.width = 54; + Item.damage = 48; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 23; + Item.knockBack = 5.75f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 54; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.SunplateBlock, 4); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.SunplateBlock, 4).AddTile(TileID.SkyMill).Register(); } } } diff --git a/Items/Weapons/Melee/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index cd69c1fcb0..f0d7a6e9f7 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -22,20 +22,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 130; - item.height = 130; - item.damage = 150; - item.melee = true; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(1, 0, 0, 0); - item.rare = ItemRarityID.Red; - item.shootSpeed = 12f; + Item.width = 130; + Item.height = 130; + Item.damage = 150; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 22; + Item.useTurn = true; + Item.knockBack = 8.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(1, 0, 0, 0); + Item.rare = ItemRarityID.Red; + Item.shootSpeed = 12f; } public override void UseStyle(Player player) @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - OnHitEffects(player, target.Center, target.statLife, target.statLifeMax2, item.knockBack, damage, crit); + OnHitEffects(player, target.Center, target.statLife, target.statLifeMax2, Item.knockBack, damage, crit); } private void OnHitEffects(Player player, Vector2 targetPos, int targetLife, int targetMaxLife, float knockback, int damage, bool crit) @@ -97,13 +97,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.FragmentSolar, 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Melee/GreatswordofBlah.cs b/Items/Weapons/Melee/GreatswordofBlah.cs index 089f46dc4d..5124e9c7e7 100644 --- a/Items/Weapons/Melee/GreatswordofBlah.cs +++ b/Items/Weapons/Melee/GreatswordofBlah.cs @@ -20,32 +20,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = item.height = 102; - item.damage = 138; - item.melee = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; + Item.width = Item.height = 102; + Item.damage = 138; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.useTurn = true; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/GreatswordofJudgement.cs b/Items/Weapons/Melee/GreatswordofJudgement.cs index 45b7704d5f..1bf7290739 100644 --- a/Items/Weapons/Melee/GreatswordofJudgement.cs +++ b/Items/Weapons/Melee/GreatswordofJudgement.cs @@ -18,30 +18,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 78; - item.damage = 48; - item.melee = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 78; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.width = 78; + Item.damage = 48; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.useTurn = true; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 78; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarBar, 7); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LunarBar, 7).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Melee/Greentide.cs b/Items/Weapons/Melee/Greentide.cs index fbef373a83..889152b601 100644 --- a/Items/Weapons/Melee/Greentide.cs +++ b/Items/Weapons/Melee/Greentide.cs @@ -17,30 +17,30 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 95; - item.melee = true; - item.width = 62; - item.height = 62; - item.scale = 1.5f; - item.useTime = 24; - item.useAnimation = 24; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 7; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shootSpeed = 18f; + Item.damage = 95; + Item.DamageType = DamageClass.Melee; + Item.width = 62; + Item.height = 62; + Item.scale = 1.5f; + Item.useTime = 24; + Item.useAnimation = 24; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 7; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shootSpeed = 18f; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { int i = Main.myPlayer; - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; float num74 = knockback; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; + num74 = player.GetWeaponKnockback(Item, num74); + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX - Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY - Main.screenPosition.Y - vector2.Y; @@ -81,17 +81,17 @@ namespace CalamityMod.Items.Weapons.Melee num79 *= num80; float speedX4 = num78; float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), num74, i, 0f, (float)Main.rand.Next(10)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), num74, i, 0f, (float)Main.rand.Next(10)); } } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { int i = Main.myPlayer; - float num72 = item.shootSpeed; - float num74 = item.knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; + float num72 = Item.shootSpeed; + float num74 = Item.knockBack; + num74 = player.GetWeaponKnockback(Item, num74); + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX - Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY - Main.screenPosition.Y - vector2.Y; @@ -133,7 +133,7 @@ namespace CalamityMod.Items.Weapons.Melee num79 *= num80; float speedX4 = num78; float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), num74, i, 0f, (float)Main.rand.Next(10)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), num74, i, 0f, (float)Main.rand.Next(10)); } } diff --git a/Items/Weapons/Melee/HellfireFlamberge.cs b/Items/Weapons/Melee/HellfireFlamberge.cs index dc5c72208d..4ac445e2c6 100644 --- a/Items/Weapons/Melee/HellfireFlamberge.cs +++ b/Items/Weapons/Melee/HellfireFlamberge.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -17,26 +18,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 58; - item.damage = 90; - item.melee = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.useTurn = true; - item.knockBack = 7.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; + Item.width = 58; + Item.damage = 90; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.useTurn = true; + Item.knockBack = 7.75f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 60; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Main.PlaySound(SoundID.Item20, player.position); + SoundEngine.PlaySound(SoundID.Item20, player.position); for (int index = 0; index < 3; ++index) { float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; @@ -62,11 +63,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/HellionFlowerSpear.cs b/Items/Weapons/Melee/HellionFlowerSpear.cs index 11c9527ae9..fbfd4bc16a 100644 --- a/Items/Weapons/Melee/HellionFlowerSpear.cs +++ b/Items/Weapons/Melee/HellionFlowerSpear.cs @@ -17,34 +17,30 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 64; - item.damage = 135; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 20; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 64; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; + Item.width = 64; + Item.damage = 135; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 20; + Item.knockBack = 7.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 64; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/Hellkite.cs b/Items/Weapons/Melee/Hellkite.cs index cef0d9bb13..1b8138d0ef 100644 --- a/Items/Weapons/Melee/Hellkite.cs +++ b/Items/Weapons/Melee/Hellkite.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -17,29 +18,24 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 84; - item.damage = 180; - item.melee = true; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 30; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 84; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; + Item.width = 84; + Item.damage = 180; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 30; + Item.useTurn = true; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 84; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FieryGreatsword); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.FieryGreatsword).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -51,13 +47,13 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.OnFire, 300); - player.ApplyDamageToNPC(target, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), 0f, 0, false); + player.ApplyDamageToNPC(target, (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), 0f, 0, false); float num50 = 1.7f; float num51 = 0.8f; float num52 = 2f; Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.position); int num3; for (int num53 = 0; num53 < 40; num53 = num3 + 1) { @@ -94,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(BuffID.OnFire, 300); - Main.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.position); } } } diff --git a/Items/Weapons/Melee/HolyCollider.cs b/Items/Weapons/Melee/HolyCollider.cs index b4f3e47b7d..98e78dc371 100644 --- a/Items/Weapons/Melee/HolyCollider.cs +++ b/Items/Weapons/Melee/HolyCollider.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -16,54 +17,54 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 94; - item.height = 80; - item.scale = 1.5f; - item.damage = 270; - item.melee = true; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 7.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shootSpeed = 10f; + Item.width = 94; + Item.height = 80; + Item.scale = 1.5f; + Item.damage = 270; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 22; + Item.useTurn = true; + Item.knockBack = 7.75f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shootSpeed = 10f; - item.rare = ItemRarityID.Purple; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.position); float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed) - spread / 2; + double startAngle = Math.Atan2(Item.shootSpeed, Item.shootSpeed) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; for (i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.3), knockback, Main.myPlayer); - Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.3), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f) * 0.3), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f) * 0.3), knockback, Main.myPlayer); } } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Main.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.position); float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed) - spread / 2; + double startAngle = Math.Atan2(Item.shootSpeed, Item.shootSpeed) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; for (i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.3), item.knockBack, Main.myPlayer); - Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.3), item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f) * 0.3), Item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f) * 0.3), Item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/InsidiousImpaler.cs b/Items/Weapons/Melee/InsidiousImpaler.cs index 1cdcf1af99..bad6c729cc 100644 --- a/Items/Weapons/Melee/InsidiousImpaler.cs +++ b/Items/Weapons/Melee/InsidiousImpaler.cs @@ -15,26 +15,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 66; - item.damage = 210; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 20; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 70; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; + Item.width = 66; + Item.damage = 210; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 20; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 70; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } } diff --git a/Items/Weapons/Melee/Lacerator.cs b/Items/Weapons/Melee/Lacerator.cs index 50f3e46b18..10cdbd4c5b 100644 --- a/Items/Weapons/Melee/Lacerator.cs +++ b/Items/Weapons/Melee/Lacerator.cs @@ -13,43 +13,39 @@ namespace CalamityMod.Items.Weapons.Melee Tooltip.SetDefault("Enemies that are hit by the yoyo will have their life drained\n" + "A very agile yoyo\n" + "Someone thought this was a viable weapon against DoG at one point lol"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 30; - item.height = 26; - item.melee = true; - item.damage = 107; - item.knockBack = 7f; - item.useTime = 20; - item.useAnimation = 20; - item.autoReuse = true; + Item.width = 30; + Item.height = 26; + Item.DamageType = DamageClass.Melee; + Item.damage = 107; + Item.knockBack = 7f; + Item.useTime = 20; + Item.useAnimation = 20; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Melee/LeechingDagger.cs b/Items/Weapons/Melee/LeechingDagger.cs index b5141a0f47..9a83493d8c 100644 --- a/Items/Weapons/Melee/LeechingDagger.cs +++ b/Items/Weapons/Melee/LeechingDagger.cs @@ -17,31 +17,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 15; - item.useTime = 15; - item.width = 26; - item.height = 26; - item.damage = 33; - item.melee = true; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 15; + Item.useTime = 15; + Item.width = 26; + Item.height = 26; + Item.damage = 33; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 5.25f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 2); - recipe.AddIngredient(ItemID.DemoniteBar, 5); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RottenChunk, 2).AddIngredient(ItemID.DemoniteBar, 5).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.DemonAltar).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -52,12 +46,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * 0.5f * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * 0.5f * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * 0.5f * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * 0.5f * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), Item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/LifefruitScythe.cs b/Items/Weapons/Melee/LifefruitScythe.cs index fe58f2da53..15f00733b2 100644 --- a/Items/Weapons/Melee/LifefruitScythe.cs +++ b/Items/Weapons/Melee/LifefruitScythe.cs @@ -17,31 +17,27 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 62; - item.damage = 156; - item.melee = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item71; - item.autoReuse = true; - item.height = 72; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.width = 62; + Item.damage = 156; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.useTurn = true; + Item.knockBack = 7.5f; + Item.UseSound = SoundID.Item71; + Item.autoReuse = true; + Item.height = 72; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.LunarCraftingStation).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/LionHeart.cs b/Items/Weapons/Melee/LionHeart.cs index f9e34836a3..b4ca353b49 100644 --- a/Items/Weapons/Melee/LionHeart.cs +++ b/Items/Weapons/Melee/LionHeart.cs @@ -20,33 +20,33 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 60; - item.height = 62; + Item.width = 60; + Item.height = 62; - item.damage = 323; - item.knockBack = 5.5f; - item.scale = 1.5f; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = 15; - item.useTime = 15; - item.shootSpeed = 0f; + Item.damage = 323; + Item.knockBack = 5.5f; + Item.scale = 1.5f; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = 15; + Item.useTime = 15; + Item.shootSpeed = 0f; - item.melee = true; - item.useTurn = true; - item.autoReuse = true; - item.UseSound = SoundID.Item1; + Item.DamageType = DamageClass.Melee; + Item.useTurn = true; + Item.autoReuse = true; + Item.UseSound = SoundID.Item1; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.Calamity().donorItem = true; } public override bool AltFunctionUse(Player player) => true; public override bool CanUseItem(Player player) { - item.shoot = player.altFunctionUse == 2 ? ModContent.ProjectileType() : ProjectileID.None; + Item.shoot = player.altFunctionUse == 2 ? ModContent.ProjectileType() : ProjectileID.None; return base.CanUseItem(player); } @@ -83,7 +83,7 @@ namespace CalamityMod.Items.Weapons.Melee if (crit) damage /= 2; - int explosion = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, item.knockBack, player.whoAmI); + int explosion = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, Item.knockBack, player.whoAmI); if (explosion.WithinBounds(Main.maxProjectiles)) Main.projectile[explosion].Calamity().forceMelee = true; } diff --git a/Items/Weapons/Melee/Lucrecia.cs b/Items/Weapons/Melee/Lucrecia.cs index 0b39dd316a..6eb2e6d92f 100644 --- a/Items/Weapons/Melee/Lucrecia.cs +++ b/Items/Weapons/Melee/Lucrecia.cs @@ -21,40 +21,33 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 25; - item.useTime = 25; - item.width = 58; - item.height = 58; - item.damage = 90; - item.melee = true; - item.knockBack = 8.25f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 32f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 25; + Item.useTime = 25; + Item.width = 58; + Item.height = 58; + Item.damage = 90; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 8.25f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 32f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.SoulofLight, 5); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.SoulofLight, 5).AddIngredient(ItemID.SoulofNight, 5).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -81,7 +74,7 @@ namespace CalamityMod.Items.Weapons.Melee if (!isImmune) { player.immune = true; - player.immuneTime = item.useTime / 5; + player.immuneTime = Item.useTime / 5; } } } diff --git a/Items/Weapons/Melee/MajesticGuard.cs b/Items/Weapons/Melee/MajesticGuard.cs index abf453a1a8..acc656f591 100644 --- a/Items/Weapons/Melee/MajesticGuard.cs +++ b/Items/Weapons/Melee/MajesticGuard.cs @@ -15,20 +15,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 100; - item.height = 100; - item.scale = 1.5f; - item.damage = 70; - item.melee = true; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; + Item.width = 100; + Item.height = 100; + Item.scale = 1.5f; + Item.damage = 70; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 22; + Item.useTurn = true; + Item.knockBack = 7.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -49,18 +49,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AdamantiteSword); - recipe.AddIngredient(ItemID.SoulofMight, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitaniumSword); - recipe.AddIngredient(ItemID.SoulofMight, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.AdamantiteSword).AddIngredient(ItemID.SoulofMight, 15).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1).AddIngredient(ItemID.TitaniumSword).AddIngredient(ItemID.SoulofMight, 15).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/MandibleClaws.cs b/Items/Weapons/Melee/MandibleClaws.cs index 214d4185a0..38108ddf5d 100644 --- a/Items/Weapons/Melee/MandibleClaws.cs +++ b/Items/Weapons/Melee/MandibleClaws.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 26; - item.damage = 13; - item.melee = true; - item.useAnimation = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 7; - item.useTurn = true; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 18; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; + Item.width = 26; + Item.damage = 13; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 7; + Item.useTurn = true; + Item.knockBack = 3.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 18; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Weapons/Melee/MantisClaws.cs b/Items/Weapons/Melee/MantisClaws.cs index 2c47e493ce..b838f8dfe8 100644 --- a/Items/Weapons/Melee/MantisClaws.cs +++ b/Items/Weapons/Melee/MantisClaws.cs @@ -16,19 +16,19 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 26; - item.damage = 88; - item.melee = true; - item.useAnimation = 6; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 6; - item.useTurn = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 20; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; + Item.width = 26; + Item.damage = 88; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 6; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 6; + Item.useTurn = true; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 20; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/Mariana.cs b/Items/Weapons/Melee/Mariana.cs index 33fa376894..6472583ad3 100644 --- a/Items/Weapons/Melee/Mariana.cs +++ b/Items/Weapons/Melee/Mariana.cs @@ -19,35 +19,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 90; - item.width = 54; - item.height = 62; - item.scale = 1.5f; - item.melee = true; - item.useAnimation = 24; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 24; - item.useTurn = true; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; + Item.damage = 90; + Item.width = 54; + Item.height = 62; + Item.scale = 1.5f; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 24; + Item.useTurn = true; + Item.knockBack = 6.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ChlorophyteClaymore); - recipe.AddIngredient(ItemID.Coral, 3); - recipe.AddIngredient(ItemID.Starfish, 3); - recipe.AddIngredient(ItemID.Seashell, 3); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ChlorophyteClaymore).AddIngredient(ItemID.Coral, 3).AddIngredient(ItemID.Starfish, 3).AddIngredient(ItemID.Seashell, 3).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -62,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee } value15.Normalize(); value15 *= Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), knockback, player.whoAmI, 0f, 0f); } for (int num621 = 0; num621 < 30; num621++) { @@ -96,7 +86,7 @@ namespace CalamityMod.Items.Weapons.Melee } value15.Normalize(); value15 *= Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), Item.knockBack, player.whoAmI, 0f, 0f); } for (int num621 = 0; num621 < 30; num621++) { diff --git a/Items/Weapons/Melee/MarniteSpear.cs b/Items/Weapons/Melee/MarniteSpear.cs index 4034b044fe..379237350a 100644 --- a/Items/Weapons/Melee/MarniteSpear.cs +++ b/Items/Weapons/Melee/MarniteSpear.cs @@ -14,37 +14,31 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 50; - item.damage = 26; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 21; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 21; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; - item.Calamity().trueMelee = true; + Item.width = 50; + Item.damage = 26; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 21; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 21; + Item.knockBack = 5.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 50; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; + Item.Calamity().trueMelee = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyGoldBar", 5); - recipe.AddIngredient(ItemID.Granite, 9); - recipe.AddIngredient(ItemID.Marble, 9); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyGoldBar", 5).AddIngredient(ItemID.Granite, 9).AddIngredient(ItemID.Marble, 9).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index 6f1814ec50..363cadc1a1 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 52; - item.damage = baseDamage; - item.melee = true; - item.useAnimation = 12; - item.useTime = 12; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shootSpeed = 9f; - item.shoot = ModContent.ProjectileType(); + Item.width = 52; + Item.damage = baseDamage; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 12; + Item.useTime = 12; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 62; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.shootSpeed = 9f; + Item.shoot = ModContent.ProjectileType(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee { conDamage = 750; } - item.damage = conDamage; + Item.damage = conDamage; } } } diff --git a/Items/Weapons/Melee/MonstrousKnives.cs b/Items/Weapons/Melee/MonstrousKnives.cs index 09cfe0db0f..f6e2802f2f 100644 --- a/Items/Weapons/Melee/MonstrousKnives.cs +++ b/Items/Weapons/Melee/MonstrousKnives.cs @@ -17,30 +17,30 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 18; - item.damage = 4; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 21; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 21; - item.knockBack = 3f; - item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.height = 20; + Item.width = 18; + Item.damage = 4; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 21; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 21; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item39; + Item.autoReuse = true; + Item.height = 20; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float speed = item.shootSpeed; + float speed = Item.shootSpeed; Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); float xDist = Main.mouseX + Main.screenPosition.X - playerPos.X; float yDist = Main.mouseY + Main.screenPosition.Y - playerPos.Y; @@ -99,14 +99,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ThrowingKnife, 200); - recipe.AddIngredient(ItemID.LifeCrystal); - recipe.AddIngredient(ItemID.LesserHealingPotion, 5); //I considered making a recipe group for any healing potion but Merchant sells these - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ThrowingKnife, 200).AddIngredient(ItemID.LifeCrystal).AddIngredient(ItemID.LesserHealingPotion, 5).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Melee/Mourningstar.cs b/Items/Weapons/Melee/Mourningstar.cs index 93e87923de..9600561957 100644 --- a/Items/Weapons/Melee/Mourningstar.cs +++ b/Items/Weapons/Melee/Mourningstar.cs @@ -17,36 +17,29 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 16; - item.height = 16; - item.damage = 127; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.autoReuse = true; - item.melee = true; - item.useAnimation = 10; - item.useTime = 10; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item116; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shootSpeed = 24f; - item.shoot = ModContent.ProjectileType(); + Item.width = 16; + Item.height = 16; + Item.damage = 127; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 10; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 2.5f; + Item.UseSound = SoundID.Item116; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.shootSpeed = 24f; + Item.shoot = ModContent.ProjectileType(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SolarEruption); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 6);//Quantities may or may not be intentional hue - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SolarEruption).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.LunarCraftingStation).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index 13a9addd9c..48afdab4cb 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -19,30 +19,30 @@ namespace CalamityMod.Items.Weapons.Melee Tooltip.SetDefault("There will be blood!\n" + "ID and power-level locked\n" + "Prove your strength or have the correct user ID to wield this sword"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 13)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 13)); } public override void SetDefaults() { - item.height = 128; - item.width = 56; - item.damage = 3001; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 5; - item.knockBack = 6.5f; - item.autoReuse = false; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24f; - item.Calamity().customRarity = CalamityRarity.Violet; - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 14)); - item.Calamity().trueMelee = true; + Item.height = 128; + Item.width = 56; + Item.damage = 3001; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 5; + Item.knockBack = 6.5f; + Item.autoReuse = false; + Item.value = Item.buyPrice(2, 50, 0, 0); + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; + Item.Calamity().customRarity = CalamityRarity.Violet; + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 14)); + Item.Calamity().trueMelee = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -51,27 +51,27 @@ namespace CalamityMod.Items.Weapons.Melee public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { //0 = 6 frames, 8 = 3 frames] - Texture2D texture = ModContent.GetTexture(Texture); - spriteBatch.Draw(texture, position, item.GetCurrentFrame(ref frame, ref frameCounter, frame == 0 ? 36 : frame == 8 ? 24 : 6, 13), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request(Texture); + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, frame == 0 ? 36 : frame == 8 ? 24 : 6, 13), Color.White, 0f, origin, scale, SpriteEffects.None, 0); return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture(Texture); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, frame == 0 ? 36 : frame == 8 ? 24 : 6, 13), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request(Texture); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, frame == 0 ? 36 : frame == 8 ? 24 : 6, 13), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/MurasamaGlow"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, frame == 0 ? 36 : frame == 8 ? 24 : 6, 13, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/MurasamaGlow"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, frame == 0 ? 36 : frame == 8 ? 24 : 6, 13, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } public override bool CanUseItem(Player player) { - if (player.ownedProjectileCounts[item.shoot] > 0) + if (player.ownedProjectileCounts[Item.shoot] > 0) return false; return CalamityWorld.downedYharon || player.name == "Jetstream Sam" || player.name == "Samuel Rodrigues"; } diff --git a/Items/Weapons/Melee/MycelialClaws.cs b/Items/Weapons/Melee/MycelialClaws.cs index 6c026eadc3..d991655a17 100644 --- a/Items/Weapons/Melee/MycelialClaws.cs +++ b/Items/Weapons/Melee/MycelialClaws.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 22; - item.damage = 20; - item.melee = true; - item.useAnimation = 7; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 7; - item.useTurn = true; - item.knockBack = 3.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 24; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; + Item.width = 22; + Item.damage = 20; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 7; + Item.useTurn = true; + Item.knockBack = 3.75f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 24; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/Nadir.cs b/Items/Weapons/Melee/Nadir.cs index b639822bf1..63d1ecf9ab 100644 --- a/Items/Weapons/Melee/Nadir.cs +++ b/Items/Weapons/Melee/Nadir.cs @@ -21,40 +21,33 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 144; - item.height = 144; - item.noUseGraphic = true; - item.melee = true; - item.damage = BaseDamage; - item.knockBack = 8f; - item.useAnimation = 18; - item.useTime = 18; - item.autoReuse = true; - item.noMelee = true; + Item.width = 144; + Item.height = 144; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Melee; + Item.damage = BaseDamage; + Item.knockBack = 8f; + Item.useAnimation = 18; + Item.useTime = 18; + Item.autoReuse = true; + Item.noMelee = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = ShootSpeed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = ShootSpeed; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/Nebulash.cs b/Items/Weapons/Melee/Nebulash.cs index e57f98fb83..82f36b79c1 100644 --- a/Items/Weapons/Melee/Nebulash.cs +++ b/Items/Weapons/Melee/Nebulash.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 16; - item.height = 16; - item.damage = 60; - item.rare = ItemRarityID.Lime; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.autoReuse = true; - item.melee = true; - item.useAnimation = 18; - item.useTime = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 2f; - item.UseSound = SoundID.Item117; - item.value = Item.buyPrice(0, 60, 0, 0); - item.shootSpeed = 24f; - item.shoot = ModContent.ProjectileType(); + Item.width = 16; + Item.height = 16; + Item.damage = 60; + Item.rare = ItemRarityID.Lime; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 18; + Item.useTime = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 2f; + Item.UseSound = SoundID.Item117; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.shootSpeed = 24f; + Item.shoot = ModContent.ProjectileType(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Melee/NeptunesBounty.cs b/Items/Weapons/Melee/NeptunesBounty.cs index 27cecf8234..f7544c394c 100644 --- a/Items/Weapons/Melee/NeptunesBounty.cs +++ b/Items/Weapons/Melee/NeptunesBounty.cs @@ -21,36 +21,27 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 122; - item.height = 122; - item.damage = 251; - item.melee = true; - item.useAnimation = 22; - item.useTime = 22; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.width = 122; + Item.height = 122; + Item.damage = 251; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 22; + Item.useTime = 22; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 9f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/NightsStabber.cs b/Items/Weapons/Melee/NightsStabber.cs index f5e44856c5..56c0222ab9 100644 --- a/Items/Weapons/Melee/NightsStabber.cs +++ b/Items/Weapons/Melee/NightsStabber.cs @@ -17,40 +17,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 15; - item.useTime = 15; - item.width = 28; - item.height = 34; - item.damage = 60; - item.melee = true; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 15; + Item.useTime = 15; + Item.width = 28; + Item.height = 34; + Item.damage = 60; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 6.5f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.DemonAltar).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(TileID.DemonAltar).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -61,12 +47,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), Item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/OldLordOathsword.cs b/Items/Weapons/Melee/OldLordOathsword.cs index 3e45726306..424416f15a 100644 --- a/Items/Weapons/Melee/OldLordOathsword.cs +++ b/Items/Weapons/Melee/OldLordOathsword.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 60; - item.width = 70; - item.height = 70; - item.melee = true; - item.useAnimation = 34; - item.useTime = 34; - item.channel = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.noUseGraphic = true; - item.channel = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; + Item.damage = 60; + Item.width = 70; + Item.height = 70; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 34; + Item.useTime = 34; + Item.channel = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; } public override bool AltFunctionUse(Player player) => true; diff --git a/Items/Weapons/Melee/OmegaBiomeBlade.cs b/Items/Weapons/Melee/OmegaBiomeBlade.cs index ed95e5f867..4b1e073e16 100644 --- a/Items/Weapons/Melee/OmegaBiomeBlade.cs +++ b/Items/Weapons/Melee/OmegaBiomeBlade.cs @@ -116,10 +116,10 @@ namespace CalamityMod.Items.Weapons.Melee return; - var effectDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria"); - var passiveDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip1" && x.mod == "Terraria"); - var mainAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip4" && x.mod == "Terraria"); - var secondaryAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip5" && x.mod == "Terraria"); + var effectDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); + var passiveDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip1" && x.Mod == "Terraria"); + var mainAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip4" && x.Mod == "Terraria"); + var secondaryAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip5" && x.Mod == "Terraria"); //Default stuff effectDescTooltip.text = "Does nothing..yet\nIt seems that upgrading the blade expanded the scope of the previous attunements"; @@ -159,32 +159,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = item.height = 92; - item.damage = BaseDamage; - item.melee = true; - item.useAnimation = 18; - item.useTime = 18; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 8; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = ItemRarityID.Cyan; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 15f; + Item.width = Item.height = 92; + Item.damage = BaseDamage; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 18; + Item.useTime = 18; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 8; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.rare = ItemRarityID.Cyan; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 15f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType(), 3); - recipe.AddIngredient(ItemType(), 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemType()).AddIngredient(ItemType()).AddIngredient(ItemType(), 3).AddIngredient(ItemType(), 3).AddTile(TileID.LunarCraftingStation).Register(); } #region Saving and syncing attunements @@ -242,7 +235,7 @@ namespace CalamityMod.Items.Weapons.Melee writer.Write(secondaryAttunement != null ? (byte)secondaryAttunement.id : Attunement.attunementArray.Length - 1); } - public override void NetRecieve(BinaryReader reader) + public override void NetReceive(BinaryReader reader) { mainAttunement = Attunement.attunementArray[reader.ReadInt32()]; secondaryAttunement = Attunement.attunementArray[reader.ReadInt32()]; @@ -285,17 +278,17 @@ namespace CalamityMod.Items.Weapons.Melee if (mainAttunement == null) { - item.noUseGraphic = false; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = false; - item.channel = false; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 12f; - item.UseSound = SoundID.Item1; + Item.noUseGraphic = false; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = false; + Item.channel = false; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 12f; + Item.UseSound = SoundID.Item1; } else - mainAttunement.ApplyStats(item); + mainAttunement.ApplyStats(Item); if (player.whoAmI != Main.myPlayer) @@ -358,7 +351,7 @@ namespace CalamityMod.Items.Weapons.Melee position.Y -= 6f * scale; Texture2D itemTexture = GetTexture("CalamityMod/Items/Weapons/Melee/OmegaBiomeBladeExtra"); - Rectangle itemFrame = (Main.itemAnimations[item.type] == null) ? itemTexture.Frame() : Main.itemAnimations[item.type].GetFrame(itemTexture); + Rectangle itemFrame = (Main.itemAnimations[Item.type] == null) ? itemTexture.Frame() : Main.itemAnimations[Item.type].GetFrame(itemTexture); // Draw all particles. @@ -389,7 +382,7 @@ namespace CalamityMod.Items.Weapons.Melee //Draw the charged version if you can Texture2D itemTexture = GetTexture("CalamityMod/Items/Weapons/Melee/OmegaBiomeBladeExtra"); - spriteBatch.Draw(itemTexture, item.Center - Main.screenPosition, null, lightColor, rotation, item.Size * 0.5f, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(itemTexture, Item.Center - Main.screenPosition, null, lightColor, rotation, Item.Size * 0.5f, scale, SpriteEffects.None, 0f); return false; } } diff --git a/Items/Weapons/Melee/Omniblade.cs b/Items/Weapons/Melee/Omniblade.cs index a6ee7bc00a..101fb8ae5b 100644 --- a/Items/Weapons/Melee/Omniblade.cs +++ b/Items/Weapons/Melee/Omniblade.cs @@ -16,41 +16,35 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 64; - item.damage = 100; - item.melee = true; - item.useAnimation = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 10; - item.useTurn = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 146; - item.value = Item.buyPrice(0, 80, 0, 0); - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24f; - item.rare = ItemRarityID.Yellow; - item.Calamity().trueMelee = true; + Item.width = 64; + Item.damage = 100; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 10; + Item.useTurn = true; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 146; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; + Item.rare = ItemRarityID.Yellow; + Item.Calamity().trueMelee = true; } // Terraria seems to really dislike high crit values in SetDefaults public override void GetWeaponCrit(Player player, ref int crit) => crit += 45; - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Katana); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Katana).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/Oracle.cs b/Items/Weapons/Melee/Oracle.cs index 6af86b608a..bb789ea9eb 100644 --- a/Items/Weapons/Melee/Oracle.cs +++ b/Items/Weapons/Melee/Oracle.cs @@ -22,34 +22,34 @@ namespace CalamityMod.Items.Weapons.Melee "Fires auric orbs when supercharged\n" + "An exceptionally agile yoyo\n"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 58; - item.height = 50; - item.melee = true; - item.damage = YoyoBaseDamage; - item.knockBack = 4f; - item.useTime = 20; - item.useAnimation = 20; - item.autoReuse = true; + Item.width = 58; + Item.height = 50; + Item.DamageType = DamageClass.Melee; + Item.damage = YoyoBaseDamage; + Item.knockBack = 4f; + Item.useTime = 20; + Item.useAnimation = 20; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().donorItem = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -60,13 +60,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddTile(ModContent.TileType()); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/PerfectDark.cs b/Items/Weapons/Melee/PerfectDark.cs index 31b760b341..7507995aca 100644 --- a/Items/Weapons/Melee/PerfectDark.cs +++ b/Items/Weapons/Melee/PerfectDark.cs @@ -16,32 +16,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 50; - item.damage = 48; - item.melee = true; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 25; - item.useTurn = true; - item.knockBack = 4.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.width = 50; + Item.damage = 48; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 25; + Item.useTurn = true; + Item.knockBack = 4.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 50; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 5); - recipe.AddIngredient(ItemID.DemoniteBar, 5); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RottenChunk, 5).AddIngredient(ItemID.DemoniteBar, 5).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Melee/PhoenixBlade.cs b/Items/Weapons/Melee/PhoenixBlade.cs index 98bb09fa95..369375dac4 100644 --- a/Items/Weapons/Melee/PhoenixBlade.cs +++ b/Items/Weapons/Melee/PhoenixBlade.cs @@ -18,20 +18,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 106; - item.damage = 160; - item.melee = true; - item.useAnimation = 27; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 27; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 106; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = ItemRarityID.LightPurple; - item.shootSpeed = 12f; + Item.width = 106; + Item.damage = 160; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 27; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 27; + Item.useTurn = true; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 106; + Item.value = Item.buyPrice(0, 48, 0, 0); + Item.rare = ItemRarityID.LightPurple; + Item.shootSpeed = 12f; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { if (target.statLife <= 0) - OnHitEffects(player, target.Center, item.knockBack, damage, crit); + OnHitEffects(player, target.Center, Item.knockBack, damage, crit); } private void OnHitEffects(Player player, Vector2 targetPos, float kBack, int damage, bool crit) @@ -69,16 +69,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BreakerBlade); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofMight, 3); - recipe.AddIngredient(ItemID.SoulofSight, 3); - recipe.AddIngredient(ItemID.SoulofFright, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BreakerBlade).AddIngredient(ItemID.HellstoneBar, 10).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofMight, 3).AddIngredient(ItemID.SoulofSight, 3).AddIngredient(ItemID.SoulofFright, 3).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/PhosphorescentGauntlet.cs b/Items/Weapons/Melee/PhosphorescentGauntlet.cs index 2678487564..e55c7fa33c 100644 --- a/Items/Weapons/Melee/PhosphorescentGauntlet.cs +++ b/Items/Weapons/Melee/PhosphorescentGauntlet.cs @@ -20,29 +20,29 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = item.height = 40; - item.damage = 2705; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.useAnimation = item.useTime = 40; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.Calamity().trueMelee = true; + Item.width = Item.height = 40; + Item.damage = 2705; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.useAnimation = Item.useTime = 40; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 9f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.Calamity().trueMelee = true; } // Terraria seems to really dislike high crit values in SetDefaults. public override void GetWeaponCrit(Player player, ref int crit) => crit += 10; - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Melee/PhotonRipper.cs b/Items/Weapons/Melee/PhotonRipper.cs index ca83611f00..e8f41798c8 100644 --- a/Items/Weapons/Melee/PhotonRipper.cs +++ b/Items/Weapons/Melee/PhotonRipper.cs @@ -17,35 +17,35 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 3725; - item.knockBack = 12f; - item.useTime = 5; - item.useAnimation = 25; + Item.damage = 3725; + Item.knockBack = 12f; + Item.useTime = 5; + Item.useAnimation = 25; // In-game, the displayed axe power is 5x the value set here. // This corrects for trees having 500% hardness internally. // So that the axe power in the code looks like the axe power you see on screen, divide by 5. - item.axe = 3000 / 5; + Item.axe = 3000 / 5; // Photon Ripper's axe power is entirely for show. Its projectiles instantly one shot trees. - item.height = 134; - item.width = 54; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.autoReuse = false; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; + Item.height = 134; + Item.width = 54; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = false; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } public override void GetWeaponCrit(Player player, ref int crit) => crit += 18; - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Melee/PlagueKeeper.cs b/Items/Weapons/Melee/PlagueKeeper.cs index 632ad05c54..0bdd301426 100644 --- a/Items/Weapons/Melee/PlagueKeeper.cs +++ b/Items/Weapons/Melee/PlagueKeeper.cs @@ -18,34 +18,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 74; - item.damage = 80; - item.melee = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.useTurn = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 90; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + Item.width = 74; + Item.damage = 80; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.useTurn = true; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 90; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.BeeKeeper); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.BeeKeeper).AddIngredient(ItemID.FragmentSolar, 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index b26c27508d..4caf3aa9e2 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -47,26 +47,26 @@ namespace CalamityMod.Items.Weapons.Melee "Fire to charge for a powerful rainbow laser\n" + "Right click to instead swing the sword and fire rainbow colored waves\n" + "The sword is boosted by both melee and ranged damage"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 662; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = item.useAnimation = 13; - item.useTurn = true; - item.melee = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.width = 50; - item.height = 50; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().donorItem = true; + Item.damage = 662; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = Item.useAnimation = 13; + Item.useTurn = true; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.width = 50; + Item.height = 50; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().donorItem = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -76,13 +76,13 @@ namespace CalamityMod.Items.Weapons.Melee //all damage boosts should still apply public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { - float damageMult = (player.meleeDamage + player.rangedDamage - 2f) / 2f; - add += damageMult - player.meleeDamage + 1f; + float damageMult = (player.GetDamage(DamageClass.Melee) + player.GetDamage(DamageClass.Ranged) - 2f) / 2f; + add += damageMult - player.GetDamage(DamageClass.Melee) + 1f; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow")); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -104,21 +104,21 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - item.UseSound = SoundID.Item1; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.autoReuse = true; - item.noMelee = false; - item.channel = false; + Item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.autoReuse = true; + Item.noMelee = false; + Item.channel = false; } else { - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"); - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTurn = false; - item.autoReuse = false; - item.noMelee = true; - item.channel = true; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"); + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTurn = false; + Item.autoReuse = false; + Item.noMelee = true; + Item.channel = true; } return base.CanUseItem(player); } @@ -146,15 +146,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/ProfanedSword.cs b/Items/Weapons/Melee/ProfanedSword.cs index ae9fcb0994..bef209774d 100644 --- a/Items/Weapons/Melee/ProfanedSword.cs +++ b/Items/Weapons/Melee/ProfanedSword.cs @@ -20,20 +20,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 100; - item.melee = true; - item.width = item.height = 52; - item.scale = 1.5f; - item.useTime = 23; - item.useAnimation = 23; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 7.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shootSpeed = 20f; + Item.damage = 100; + Item.DamageType = DamageClass.Melee; + Item.width = Item.height = 52; + Item.scale = 1.5f; + Item.useTime = 23; + Item.useAnimation = 23; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 7.5f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shootSpeed = 20f; } public override bool AltFunctionUse(Player player) @@ -45,15 +45,15 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - item.noMelee = true; - item.noUseGraphic = true; - item.shoot = ModContent.ProjectileType(); + Item.noMelee = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); } else { - item.noMelee = false; - item.noUseGraphic = false; - item.shoot = ProjectileID.None; + Item.noMelee = false; + Item.noUseGraphic = false; + Item.shoot = ProjectileID.None; } return base.CanUseItem(player); } @@ -79,7 +79,7 @@ namespace CalamityMod.Items.Weapons.Melee damage /= 2; target.AddBuff(ModContent.BuffType(), 300); - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, Item.knockBack, Main.myPlayer); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -90,11 +90,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/PwnagehammerMelee.cs b/Items/Weapons/Melee/PwnagehammerMelee.cs index 44b64b1b2f..a6da158987 100644 --- a/Items/Weapons/Melee/PwnagehammerMelee.cs +++ b/Items/Weapons/Melee/PwnagehammerMelee.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 66; - item.damage = 210; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = item.useTime = 48; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 10f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 66; - item.value = Item.buyPrice(gold: 48); - item.rare = ItemRarityID.LightPurple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24.4f; + Item.width = 66; + Item.damage = 210; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useAnimation = Item.useTime = 48; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 10f; + Item.UseSound = SoundID.Item1; + Item.DamageType = DamageClass.Melee; + Item.height = 66; + Item.value = Item.buyPrice(gold: 48); + Item.rare = ItemRarityID.LightPurple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24.4f; } // Terraria seems to really dislike high crit values in SetDefaults @@ -52,15 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Pwnhammer); - recipe.AddIngredient(ItemID.HallowedBar, 7); - recipe.AddIngredient(ItemID.SoulofMight, 3); - recipe.AddIngredient(ItemID.SoulofSight, 3); - recipe.AddIngredient(ItemID.SoulofFright, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Pwnhammer).AddIngredient(ItemID.HallowedBar, 7).AddIngredient(ItemID.SoulofMight, 3).AddIngredient(ItemID.SoulofSight, 3).AddIngredient(ItemID.SoulofFright, 3).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/Quagmire.cs b/Items/Weapons/Melee/Quagmire.cs index 09906dec0b..5ba883c921 100644 --- a/Items/Weapons/Melee/Quagmire.cs +++ b/Items/Weapons/Melee/Quagmire.cs @@ -12,42 +12,38 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Quagmire"); Tooltip.SetDefault("Fires spore clouds"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 30; - item.height = 36; - item.melee = true; - item.damage = 52; - item.knockBack = 3.5f; - item.useTime = 22; - item.useAnimation = 22; - item.autoReuse = true; + Item.width = 30; + Item.height = 36; + Item.DamageType = DamageClass.Melee; + Item.damage = 52; + Item.knockBack = 3.5f; + Item.useTime = 22; + Item.useAnimation = 22; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; - item.rare = ItemRarityID.Lime; - item.value = Item.buyPrice(gold: 60); + Item.rare = ItemRarityID.Lime; + Item.value = Item.buyPrice(gold: 60); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/RedSun.cs b/Items/Weapons/Melee/RedSun.cs index d617d8a032..abf019c36b 100644 --- a/Items/Weapons/Melee/RedSun.cs +++ b/Items/Weapons/Melee/RedSun.cs @@ -21,41 +21,34 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 62; - item.height = 62; - item.damage = 500; - item.melee = true; - item.useTime = 5; - item.reuseDelay = 20; - item.useAnimation = 30; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + Item.width = 62; + Item.height = 62; + Item.damage = 500; + Item.DamageType = DamageClass.Melee; + Item.useTime = 5; + Item.reuseDelay = 20; + Item.useAnimation = 30; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AntlionClaw); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.AntlionClaw).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); Vector2 vector3 = Main.MouseWorld - vector2; diff --git a/Items/Weapons/Melee/RedtideSword.cs b/Items/Weapons/Melee/RedtideSword.cs index 168a6c34d2..1fcde221d4 100644 --- a/Items/Weapons/Melee/RedtideSword.cs +++ b/Items/Weapons/Melee/RedtideSword.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 42; - item.damage = 35; - item.melee = true; - item.useAnimation = 19; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 19; - item.useTurn = true; - item.knockBack = 4; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 42; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + Item.width = 42; + Item.damage = 35; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 19; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 19; + Item.useTurn = true; + Item.knockBack = 4; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 42; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -42,11 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Melee/RemsRevenge.cs b/Items/Weapons/Melee/RemsRevenge.cs index f70f381d5e..a2a6326d2a 100644 --- a/Items/Weapons/Melee/RemsRevenge.cs +++ b/Items/Weapons/Melee/RemsRevenge.cs @@ -16,35 +16,29 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 375; - item.melee = true; - item.width = 44; - item.height = 34; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 10f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.channel = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().donorItem = true; + Item.damage = 375; + Item.DamageType = DamageClass.Melee; + Item.width = 44; + Item.height = 34; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.knockBack = 10f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().donorItem = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BlueMoon); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BlueMoon).AddIngredient(ItemID.LunarBar, 5).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Melee/Roxcalibur.cs b/Items/Weapons/Melee/Roxcalibur.cs index 604a2ba9b8..64718fcc4b 100644 --- a/Items/Weapons/Melee/Roxcalibur.cs +++ b/Items/Weapons/Melee/Roxcalibur.cs @@ -1,9 +1,10 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -27,23 +28,23 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 200; - item.knockBack = 13; - item.melee = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.NPCHit42; - item.width = 100; - item.height = 100; - item.autoReuse = true; - item.useAnimation = 45; - item.useTime = 45; + Item.damage = 200; + Item.knockBack = 13; + Item.DamageType = DamageClass.Melee; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.NPCHit42; + Item.width = 100; + Item.height = 100; + Item.autoReuse = true; + Item.useAnimation = 45; + Item.useTime = 45; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.Calamity().donorItem = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -51,16 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 25); - recipe.AddIngredient(ItemID.SoulofNight, 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Obsidian, 10); - recipe.AddIngredient(ItemID.StoneBlock, 100); - recipe.AddIngredient(ItemID.Amethyst, 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HellstoneBar, 25).AddIngredient(ItemID.SoulofNight, 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Obsidian, 10).AddIngredient(ItemID.StoneBlock, 100).AddIngredient(ItemID.Amethyst, 2).AddTile(TileID.Anvils).Register(); } public override void UpdateInventory(Player player) @@ -77,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Melee Main.dust[d].noGravity = true; Main.dust[d].position = player.Center; } - Main.PlaySound(SoundID.Item70, player.position); + SoundEngine.PlaySound(SoundID.Item70, player.position); } // Resets the weapon usage if the alt fire collides with the ground if (RoxAlt && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) @@ -110,7 +102,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool AltFunctionUse(Player player) { - return RoxCanAlt >= item.useAnimation + 5 && player.position.Y != player.oldPosition.Y && !player.mount.Active && player.gravDir != -1; + return RoxCanAlt >= Item.useAnimation + 5 && player.position.Y != player.oldPosition.Y && !player.mount.Active && player.gravDir != -1; } public override void UseStyle(Player player) @@ -120,14 +112,14 @@ namespace CalamityMod.Items.Weapons.Melee { player.itemLocation.X -= 32f * player.direction; player.itemLocation.Y -= 60f; - item.useStyle = ItemUseStyleID.HoldingUp; + Item.useStyle = ItemUseStyleID.HoldUp; RoxAlt = true; } //Modifies to use style and hold out of the main fire mode else { player.itemLocation += new Vector2(-7.5f * player.direction, 8.5f * player.gravDir).RotatedBy(player.itemRotation); - item.useStyle = ItemUseStyleID.SwingThrow; + Item.useStyle = ItemUseStyleID.Swing; RoxAlt = false; } } @@ -210,11 +202,11 @@ namespace CalamityMod.Items.Weapons.Melee 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 (item.useStyle == ItemUseStyleID.HoldingUp) + if (Item.useStyle == ItemUseStyleID.HoldUp) { //Spawns a projectile on the tip of the sword in the alt fire float positionx; - float positiony = position.Y + (item.height / 2) + 23; + float positiony = position.Y + (Item.height / 2) + 23; int cooldown = 0; //Check if the entire cooldown has passed @@ -258,7 +250,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { - if (item.useStyle == ItemUseStyleID.HoldingUp) + if (Item.useStyle == ItemUseStyleID.HoldUp) { if (player.whoAmI == Main.myPlayer) { @@ -281,7 +273,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - if (item.useStyle == ItemUseStyleID.HoldingUp) + if (Item.useStyle == ItemUseStyleID.HoldUp) { if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Weapons/Melee/RoyalKnivesMelee.cs b/Items/Weapons/Melee/RoyalKnivesMelee.cs index a9eb098d25..098332c115 100644 --- a/Items/Weapons/Melee/RoyalKnivesMelee.cs +++ b/Items/Weapons/Melee/RoyalKnivesMelee.cs @@ -19,30 +19,30 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 44; - item.damage = 400; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 12; - item.knockBack = 3f; - item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.height = 62; + Item.width = 44; + Item.damage = 400; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 12; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item39; + Item.autoReuse = true; + Item.height = 62; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); Vector2 vector3 = Main.MouseWorld - vector2; @@ -102,13 +102,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/SausageMaker.cs b/Items/Weapons/Melee/SausageMaker.cs index 05aab76c8f..a1f215ff3f 100644 --- a/Items/Weapons/Melee/SausageMaker.cs +++ b/Items/Weapons/Melee/SausageMaker.cs @@ -16,37 +16,31 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 44; - item.damage = 36; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 20; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 42; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; - item.Calamity().trueMelee = true; + Item.width = 44; + Item.damage = 36; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 20; + Item.knockBack = 6.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 42; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; + Item.Calamity().trueMelee = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.Vertebrae, 4); - recipe.AddIngredient(ItemID.CrimtaneBar, 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.Vertebrae, 4).AddIngredient(ItemID.CrimtaneBar, 5).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Melee/ScourgeoftheCosmos.cs b/Items/Weapons/Melee/ScourgeoftheCosmos.cs index 0be8bbd7fb..77c2c00720 100644 --- a/Items/Weapons/Melee/ScourgeoftheCosmos.cs +++ b/Items/Weapons/Melee/ScourgeoftheCosmos.cs @@ -16,33 +16,27 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = item.height = 64; - item.damage = 478; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 20; - item.knockBack = 5f; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + Item.width = Item.height = 64; + Item.damage = 478; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 20; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item109; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ScourgeoftheCorruptor); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ScourgeoftheCorruptor).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/SeashineSword.cs b/Items/Weapons/Melee/SeashineSword.cs index 0dffad7822..bdb9f79d44 100644 --- a/Items/Weapons/Melee/SeashineSword.cs +++ b/Items/Weapons/Melee/SeashineSword.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.CloneDefaults(ItemID.EnchantedSword); - item.useTime = 30; - item.damage = 26; - item.melee = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.width = 38; - item.height = 38; - item.knockBack = 2; - item.shootSpeed = 11; - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item1; + Item.CloneDefaults(ItemID.EnchantedSword); + Item.useTime = 30; + Item.damage = 26; + Item.DamageType = DamageClass.Melee; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.width = 38; + Item.height = 38; + Item.knockBack = 2; + Item.shootSpeed = 11; + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item1; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -38,12 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Melee/Shimmerspark.cs b/Items/Weapons/Melee/Shimmerspark.cs index be27df15ac..ed590ee69e 100644 --- a/Items/Weapons/Melee/Shimmerspark.cs +++ b/Items/Weapons/Melee/Shimmerspark.cs @@ -13,42 +13,38 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Shimmerspark"); Tooltip.SetDefault("Fires stars when enemies are near\n" + "A very agile yoyo"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 50; - item.height = 36; - item.melee = true; - item.damage = 41; - item.knockBack = 3.5f; - item.useTime = 25; - item.useAnimation = 25; - item.autoReuse = true; + Item.width = 50; + Item.height = 36; + Item.DamageType = DamageClass.Melee; + Item.damage = 41; + Item.knockBack = 3.5f; + Item.useTime = 25; + Item.useAnimation = 25; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; - item.rare = ItemRarityID.Pink; - item.value = Item.buyPrice(gold: 36); + Item.rare = ItemRarityID.Pink; + Item.value = Item.buyPrice(gold: 36); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/SolarFlare.cs b/Items/Weapons/Melee/SolarFlare.cs index 4f6693beff..63742ad823 100644 --- a/Items/Weapons/Melee/SolarFlare.cs +++ b/Items/Weapons/Melee/SolarFlare.cs @@ -11,34 +11,34 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Solar Flare"); Tooltip.SetDefault("Emits large holy explosions on hit\n" + "A very agile yoyo"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 40; - item.height = 38; - item.melee = true; - item.damage = 71; - item.knockBack = 7.5f; - item.useTime = 20; - item.useAnimation = 20; - item.autoReuse = true; + Item.width = 40; + Item.height = 38; + Item.DamageType = DamageClass.Melee; + Item.damage = 71; + Item.knockBack = 7.5f; + Item.useTime = 20; + Item.useAnimation = 20; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } } } diff --git a/Items/Weapons/Melee/SolsticeClaymore.cs b/Items/Weapons/Melee/SolsticeClaymore.cs index 8359f1237d..efbd7e897c 100644 --- a/Items/Weapons/Melee/SolsticeClaymore.cs +++ b/Items/Weapons/Melee/SolsticeClaymore.cs @@ -20,33 +20,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 86; - item.damage = 300; - item.melee = true; - item.useAnimation = 16; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 16; - item.useTurn = true; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 86; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.width = 86; + Item.damage = 300; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 16; + Item.useTurn = true; + Item.knockBack = 6.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 86; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BeamSword); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BeamSword).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/SoulEdge.cs b/Items/Weapons/Melee/SoulEdge.cs index 98a6c533c9..61b33d8e0e 100644 --- a/Items/Weapons/Melee/SoulEdge.cs +++ b/Items/Weapons/Melee/SoulEdge.cs @@ -22,22 +22,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 88; - item.height = 88; - item.damage = 174; - item.melee = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 23; - item.useAnimation = 23; - item.useTurn = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.width = 88; + Item.height = 88; + Item.damage = 174; + Item.DamageType = DamageClass.Melee; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 23; + Item.useAnimation = 23; + Item.useTurn = true; + Item.knockBack = 5.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Melee/SoulHarvester.cs b/Items/Weapons/Melee/SoulHarvester.cs index 42f3b9d485..06220fa637 100644 --- a/Items/Weapons/Melee/SoulHarvester.cs +++ b/Items/Weapons/Melee/SoulHarvester.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -19,32 +20,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 62; - item.damage = 98; - item.melee = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item71; - item.autoReuse = true; - item.height = 64; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; + Item.width = 62; + Item.damage = 98; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.useTurn = true; + Item.knockBack = 7.5f; + Item.UseSound = SoundID.Item71; + Item.autoReuse = true; + Item.height = 64; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DeathSickle); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.CursedFlame, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.DeathSickle).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.CursedFlame, 20).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -61,8 +56,8 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.CursedInferno, 120); if (target.life <= (target.lifeMax * 0.15f)) { - Main.PlaySound(SoundID.Item14, target.position); - player.ApplyDamageToNPC(target, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), 0f, 0, false); + SoundEngine.PlaySound(SoundID.Item14, target.position); + player.ApplyDamageToNPC(target, (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), 0f, 0, false); for (int num621 = 0; num621 < 10; num621++) { int num622 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 2f); @@ -90,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.CursedInferno, 120); if (target.statLife <= (target.statLifeMax * 0.15f)) { - Main.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.position); for (int num621 = 0; num621 < 10; num621++) { int num622 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 2f); diff --git a/Items/Weapons/Melee/SpatialLance.cs b/Items/Weapons/Melee/SpatialLance.cs index 29bae9772a..3de74758f8 100644 --- a/Items/Weapons/Melee/SpatialLance.cs +++ b/Items/Weapons/Melee/SpatialLance.cs @@ -17,37 +17,30 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 88; - item.damage = 160; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 30; - item.knockBack = 9.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 88; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.width = 88; + Item.damage = 160; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 30; + Item.knockBack = 9.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 88; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.NorthPole); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.NorthPole).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Melee/SpineOfThanatos.cs b/Items/Weapons/Melee/SpineOfThanatos.cs index 4f1b9a089e..d86e3ffb88 100644 --- a/Items/Weapons/Melee/SpineOfThanatos.cs +++ b/Items/Weapons/Melee/SpineOfThanatos.cs @@ -18,25 +18,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = item.height = 28; - item.damage = 260; - item.rare = ItemRarityID.Red; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.autoReuse = true; - item.melee = true; - item.useAnimation = item.useTime = 24; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 8f; - item.UseSound = SoundID.Item68; - item.shootSpeed = 1f; - item.shoot = ModContent.ProjectileType(); + Item.width = Item.height = 28; + Item.damage = 260; + Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = Item.useTime = 24; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item68; + Item.shootSpeed = 1f; + Item.shoot = ModContent.ProjectileType(); } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Melee/SporeKnife.cs b/Items/Weapons/Melee/SporeKnife.cs index 715353c52e..8a8618dead 100644 --- a/Items/Weapons/Melee/SporeKnife.cs +++ b/Items/Weapons/Melee/SporeKnife.cs @@ -15,30 +15,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 12; - item.useTime = 12; - item.width = 32; - item.height = 32; - item.damage = 33; - item.melee = true; - item.knockBack = 5.75f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 12; + Item.useTime = 12; + Item.width = 32; + Item.height = 32; + Item.damage = 33; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 5.75f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.JungleSpores, 10); - recipe.AddIngredient(ItemID.Stinger, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.JungleSpores, 10).AddIngredient(ItemID.Stinger, 5).AddTile(TileID.Anvils).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -49,14 +44,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - int proj = Projectile.NewProjectile(target.Center, Vector2.Zero, Main.rand.Next(569, 572), (int)(item.damage * 0.5f * player.MeleeDamage()), knockback, Main.myPlayer); + int proj = Projectile.NewProjectile(target.Center, Vector2.Zero, Main.rand.Next(569, 572), (int)(Item.damage * 0.5f * player.MeleeDamage()), knockback, Main.myPlayer); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMelee = true; } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - int proj = Projectile.NewProjectile(target.Center, Vector2.Zero, Main.rand.Next(569, 572), (int)(item.damage * 0.5f * player.MeleeDamage()), item.knockBack, Main.myPlayer); + int proj = Projectile.NewProjectile(target.Center, Vector2.Zero, Main.rand.Next(569, 572), (int)(Item.damage * 0.5f * player.MeleeDamage()), Item.knockBack, Main.myPlayer); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMelee = true; } diff --git a/Items/Weapons/Melee/StarnightLance.cs b/Items/Weapons/Melee/StarnightLance.cs index f2d30b2ddd..117e4734dd 100644 --- a/Items/Weapons/Melee/StarnightLance.cs +++ b/Items/Weapons/Melee/StarnightLance.cs @@ -16,34 +16,30 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 72; - item.damage = 110; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 23; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 23; - item.knockBack = 6; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 72; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; + Item.width = 72; + Item.damage = 110; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 23; + Item.knockBack = 6; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 72; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/StellarContemptMelee.cs b/Items/Weapons/Melee/StellarContemptMelee.cs index 7438ddb351..b328cd8b1d 100644 --- a/Items/Weapons/Melee/StellarContemptMelee.cs +++ b/Items/Weapons/Melee/StellarContemptMelee.cs @@ -19,37 +19,30 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 74; - item.height = 74; - item.melee = true; - item.damage = BaseDamage; - item.knockBack = 9f; - item.useTime = 13; - item.useAnimation = 13; - item.autoReuse = true; - item.noMelee = true; - item.noUseGraphic = true; + Item.width = 74; + Item.height = 74; + Item.DamageType = DamageClass.Melee; + Item.damage = BaseDamage; + Item.knockBack = 9f; + Item.useTime = 13; + Item.useAnimation = 13; + Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = Speed; } public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ItemID.LunarBar, 5); - r.AddIngredient(ItemID.FragmentSolar, 10); - r.AddIngredient(ItemID.FragmentNebula, 10); - r.AddTile(TileID.LunarCraftingStation); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LunarBar, 5).AddIngredient(ItemID.FragmentSolar, 10).AddIngredient(ItemID.FragmentNebula, 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index d343184673..acb4269aaa 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -16,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 84; - item.height = 90; - item.scale = 1.5f; - item.damage = 480; - item.melee = true; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 25; - item.useTurn = true; - item.knockBack = 7.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.shootSpeed = 12f; + Item.width = 84; + Item.height = 90; + Item.scale = 1.5f; + Item.damage = 480; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 25; + Item.useTurn = true; + Item.knockBack = 7.75f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.shootSpeed = 12f; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -42,14 +43,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { if (player.whoAmI == Main.myPlayer) - SpawnFlares(player, item.knockBack, damage, crit); + SpawnFlares(player, Item.knockBack, damage, crit); } private void SpawnFlares(Player player, float knockBack, int damage, bool crit) { - Main.PlaySound(SoundID.Item88, player.position); + SoundEngine.PlaySound(SoundID.Item88, player.position); int i = Main.myPlayer; - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -110,12 +111,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Melee/StormRuler.cs b/Items/Weapons/Melee/StormRuler.cs index d503d9abc2..894220f994 100644 --- a/Items/Weapons/Melee/StormRuler.cs +++ b/Items/Weapons/Melee/StormRuler.cs @@ -19,33 +19,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 74; - item.damage = 80; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 82; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; + Item.width = 74; + Item.damage = 80; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 25; + Item.useTime = 25; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 82; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.FragmentSolar, 10).AddTile(TileID.LunarCraftingStation).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/StormSaber.cs b/Items/Weapons/Melee/StormSaber.cs index 70c5d24f4b..44584fc9ee 100644 --- a/Items/Weapons/Melee/StormSaber.cs +++ b/Items/Weapons/Melee/StormSaber.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 58; - item.damage = 66; - item.melee = true; - item.useAnimation = 23; - item.useTime = 23; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 64; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.width = 58; + Item.damage = 66; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 23; + Item.useTime = 23; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 64; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Melee/StreamGouge.cs b/Items/Weapons/Melee/StreamGouge.cs index e3c3193763..ed69fae96c 100644 --- a/Items/Weapons/Melee/StreamGouge.cs +++ b/Items/Weapons/Melee/StreamGouge.cs @@ -27,41 +27,37 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 100; - item.height = 100; - item.damage = 300; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.channel = true; - item.useAnimation = 19; - item.useTime = 19; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 9.75f; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 100; + Item.height = 100; + Item.damage = 300; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.useAnimation = 19; + Item.useTime = 19; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 9.75f; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/StreamGougeGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/StreamGougeGlow")); } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/SubmarineShocker.cs b/Items/Weapons/Melee/SubmarineShocker.cs index 81433e938f..235a86e132 100644 --- a/Items/Weapons/Melee/SubmarineShocker.cs +++ b/Items/Weapons/Melee/SubmarineShocker.cs @@ -16,20 +16,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 10; - item.useTime = 10; - item.width = 32; - item.height = 32; - item.damage = 60; - item.melee = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 10; + Item.useTime = 10; + Item.width = 32; + Item.height = 32; + Item.damage = 60; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Melee if (crit) damage /= 2; - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * 0.7f), item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * 0.7f), Item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/SulphurousGrabber.cs b/Items/Weapons/Melee/SulphurousGrabber.cs index 7f9a560304..d25eadc411 100644 --- a/Items/Weapons/Melee/SulphurousGrabber.cs +++ b/Items/Weapons/Melee/SulphurousGrabber.cs @@ -13,32 +13,32 @@ namespace CalamityMod.Items.Weapons.Melee Tooltip.SetDefault("Occasionally releases a ring of colored bubbles\n" + "The yoyo powers up after touching a green bubble\n" + "A very agile yoyo"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 50; - item.height = 36; - item.melee = true; - item.damage = 82; - item.knockBack = 3.5f; - item.useTime = 25; - item.useAnimation = 25; + Item.width = 50; + Item.height = 36; + Item.DamageType = DamageClass.Melee; + Item.damage = 82; + Item.knockBack = 3.5f; + Item.useTime = 25; + Item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; - item.rare = ItemRarityID.Pink; - item.value = Item.buyPrice(gold: 36); + Item.rare = ItemRarityID.Pink; + Item.value = Item.buyPrice(gold: 36); } } } diff --git a/Items/Weapons/Melee/Swordsplosion.cs b/Items/Weapons/Melee/Swordsplosion.cs index e3f9146165..19a1940b93 100644 --- a/Items/Weapons/Melee/Swordsplosion.cs +++ b/Items/Weapons/Melee/Swordsplosion.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 88; - item.damage = 48; - item.melee = true; - item.useAnimation = 30; - item.useTime = 30; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 7f; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.height = 90; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.width = 88; + Item.damage = 48; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 30; + Item.useTime = 30; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item60; + Item.autoReuse = true; + Item.height = 90; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Melee/TeardropCleaver.cs b/Items/Weapons/Melee/TeardropCleaver.cs index f1a22e8771..a892b640c5 100644 --- a/Items/Weapons/Melee/TeardropCleaver.cs +++ b/Items/Weapons/Melee/TeardropCleaver.cs @@ -15,19 +15,19 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 56; - item.damage = 24; - item.melee = true; - item.useAnimation = 24; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 24; - item.useTurn = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 66; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; + Item.width = 56; + Item.damage = 24; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 24; + Item.useTurn = true; + Item.knockBack = 5.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 66; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/TemporalFloeSword.cs b/Items/Weapons/Melee/TemporalFloeSword.cs index 932fb9efc2..61199e0659 100644 --- a/Items/Weapons/Melee/TemporalFloeSword.cs +++ b/Items/Weapons/Melee/TemporalFloeSword.cs @@ -21,21 +21,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 52; - item.damage = 95; - item.melee = true; - item.useAnimation = 16; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 16; - item.useTurn = true; - item.knockBack = 6; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.width = 52; + Item.damage = 95; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 16; + Item.useTurn = true; + Item.knockBack = 6; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 60; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -46,13 +46,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.Ectoplasm, 5).AddTile(TileID.IceMachine).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/TenebreusTides.cs b/Items/Weapons/Melee/TenebreusTides.cs index 6bb492b2ae..3386509770 100644 --- a/Items/Weapons/Melee/TenebreusTides.cs +++ b/Items/Weapons/Melee/TenebreusTides.cs @@ -20,40 +20,31 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 80; - item.knockBack = 4.5f; - item.melee = true; - item.useAnimation = item.useTime = 14; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.damage = 80; + Item.knockBack = 4.5f; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = Item.useTime = 14; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; - item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = ItemRarityID.Cyan; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.rare = ItemRarityID.Cyan; + Item.Calamity().donorItem = true; - item.width = item.height = 68; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; + Item.width = Item.height = 68; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.InfluxWaver); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.InfluxWaver).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 50).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Melee/TerraEdge.cs b/Items/Weapons/Melee/TerraEdge.cs index 598be68852..8eeca44471 100644 --- a/Items/Weapons/Melee/TerraEdge.cs +++ b/Items/Weapons/Melee/TerraEdge.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 58; - item.height = 58; - item.scale = 1.5f; - item.damage = 112; - item.melee = true; - item.useAnimation = 17; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 17; - item.useTurn = true; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.width = 58; + Item.height = 58; + Item.scale = 1.5f; + Item.damage = 112; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 17; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 17; + Item.useTurn = true; + Item.knockBack = 6.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -44,20 +44,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.TrueExcalibur); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TrueNightsEdge); - recipe.AddIngredient(ItemID.TrueExcalibur); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.TrueExcalibur).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1).AddIngredient(ItemID.TrueNightsEdge).AddIngredient(ItemID.TrueExcalibur).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/TerraLance.cs b/Items/Weapons/Melee/TerraLance.cs index 58165c7268..1b3fb6d0b9 100644 --- a/Items/Weapons/Melee/TerraLance.cs +++ b/Items/Weapons/Melee/TerraLance.cs @@ -16,37 +16,30 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 44; - item.damage = 88; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 17; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 17; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11f; + Item.width = 44; + Item.damage = 88; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 17; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 17; + Item.knockBack = 8.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 44; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ChlorophytePartisan); - recipe.AddIngredient(ItemID.DarkLance); - recipe.AddIngredient(ItemID.Gungnir); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ChlorophytePartisan).AddIngredient(ItemID.DarkLance).AddIngredient(ItemID.Gungnir).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/TerraShiv.cs b/Items/Weapons/Melee/TerraShiv.cs index bd439804f6..cf02d548c7 100644 --- a/Items/Weapons/Melee/TerraShiv.cs +++ b/Items/Weapons/Melee/TerraShiv.cs @@ -17,39 +17,33 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 13; - item.useTime = 13; - item.width = 42; - item.height = 42; - item.damage = 140; - item.melee = true; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 13; + Item.useTime = 13; + Item.width = 42; + Item.height = 42; + Item.damage = 140; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 6.5f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/Terracotta.cs b/Items/Weapons/Melee/Terracotta.cs index a7d9e7597a..8fe1749a44 100644 --- a/Items/Weapons/Melee/Terracotta.cs +++ b/Items/Weapons/Melee/Terracotta.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 50; - item.height = 62; - item.scale = 1.5f; - item.damage = 110; - item.melee = true; - item.useAnimation = 15; - item.useTime = 15; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shootSpeed = 5f; + Item.width = 50; + Item.height = 62; + Item.scale = 1.5f; + Item.damage = 110; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 15; + Item.useTime = 15; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shootSpeed = 5f; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI, player.whoAmI); Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI, player.whoAmI); } - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), knockback, player.whoAmI); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI, player.whoAmI); Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI, player.whoAmI); } - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), Item.knockBack, player.whoAmI); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index 1f44eb5560..1a434eca89 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -20,22 +20,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 60; - item.damage = 260; - item.melee = true; - item.useAnimation = 21; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 21; - item.useTurn = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 66; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; + Item.width = 60; + Item.damage = 260; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 21; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 21; + Item.useTurn = true; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 66; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -52,24 +52,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.TerraBlade); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.TerraBlade).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/TerrorBlade.cs b/Items/Weapons/Melee/TerrorBlade.cs index 0f134e8ae2..820f7583be 100644 --- a/Items/Weapons/Melee/TerrorBlade.cs +++ b/Items/Weapons/Melee/TerrorBlade.cs @@ -20,27 +20,27 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 88; - item.damage = 630; - item.melee = true; - item.useAnimation = 18; - item.useTime = 18; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 80; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; + Item.width = 88; + Item.damage = 630; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 18; + Item.useTime = 18; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 8.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 80; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow")); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/TheBurningSky.cs b/Items/Weapons/Melee/TheBurningSky.cs index 62946d2afd..e513f9fece 100644 --- a/Items/Weapons/Melee/TheBurningSky.cs +++ b/Items/Weapons/Melee/TheBurningSky.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -16,37 +17,37 @@ namespace CalamityMod.Items.Weapons.Melee Tooltip.SetDefault("Hold the blade to the sky, and witness Armageddon"); // Visually a sword, but with no true melee capability. The Burning Sky is held out like a staff. - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.width = 102; - item.height = 146; - item.damage = 244; - item.knockBack = 2.5f; + Item.width = 102; + Item.height = 146; + Item.damage = 244; + Item.knockBack = 2.5f; - item.melee = true; - item.noMelee = true; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; - item.useTime = 9; - item.useAnimation = 9; - item.useStyle = ItemUseStyleID.HoldingOut; - item.autoReuse = true; - item.UseSound = SoundID.Item105; + Item.useTime = 9; + Item.useAnimation = 9; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.UseSound = SoundID.Item105; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { // Every time the item spawns more meteors, play a violent, bass heavy sound to add onto Star Wrath's use sound. - Main.PlaySound(SoundID.Item70, player.Center); + SoundEngine.PlaySound(SoundID.Item70, player.Center); Vector2 originalVelocity = new Vector2(speedX, speedY); float speed = originalVelocity.Length(); diff --git a/Items/Weapons/Melee/TheEnforcer.cs b/Items/Weapons/Melee/TheEnforcer.cs index a97f820084..2e7d3a5c3b 100644 --- a/Items/Weapons/Melee/TheEnforcer.cs +++ b/Items/Weapons/Melee/TheEnforcer.cs @@ -7,6 +7,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -20,34 +21,34 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 100; - item.height = 100; - item.scale = 1.5f; - item.damage = 890; - item.melee = true; - item.useAnimation = 17; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 17; - item.useTurn = true; - item.knockBack = 9f; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 100; + Item.height = 100; + Item.scale = 1.5f; + Item.damage = 890; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 17; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 17; + Item.useTurn = true; + Item.knockBack = 9f; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow")); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(SoundID.Item73, player.position); + SoundEngine.PlaySound(SoundID.Item73, player.position); int i = Main.myPlayer; float num72 = 3f; - player.itemTime = item.useTime; + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = Main.mouseX + Main.screenPosition.X + vector2.X; float num79 = Main.mouseY + Main.screenPosition.Y + vector2.Y; @@ -85,16 +86,16 @@ namespace CalamityMod.Items.Weapons.Melee } num80 = (float)Math.Sqrt(num78 * num78 + num79 * num79); num80 = num72 / num80; - Projectile.NewProjectile(vector2, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.25f), 0f, i, 0f, Main.rand.Next(3)); + Projectile.NewProjectile(vector2, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f) * 0.25f), 0f, i, 0f, Main.rand.Next(3)); } } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Main.PlaySound(SoundID.Item73, player.position); + SoundEngine.PlaySound(SoundID.Item73, player.position); int i = Main.myPlayer; float num72 = 3f; - player.itemTime = item.useTime; + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = Main.mouseX + Main.screenPosition.X + vector2.X; float num79 = Main.mouseY + Main.screenPosition.Y + vector2.Y; @@ -132,7 +133,7 @@ namespace CalamityMod.Items.Weapons.Melee } num80 = (float)Math.Sqrt(num78 * num78 + num79 * num79); num80 = num72 / num80; - Projectile.NewProjectile(vector2, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.25f), 0f, i, 0f, Main.rand.Next(3)); + Projectile.NewProjectile(vector2, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f) * 0.25f), 0f, i, 0f, Main.rand.Next(3)); } } @@ -144,11 +145,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/TheEyeofCalamitas.cs b/Items/Weapons/Melee/TheEyeofCalamitas.cs index c381b19273..6f41a4ccb2 100644 --- a/Items/Weapons/Melee/TheEyeofCalamitas.cs +++ b/Items/Weapons/Melee/TheEyeofCalamitas.cs @@ -12,33 +12,33 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Oblivion"); Tooltip.SetDefault("Fires brimstone lasers when enemies are near\n" + "A very agile yoyo"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 28; - item.height = 38; - item.melee = true; - item.damage = 55; - item.knockBack = 4f; - item.useTime = 22; - item.useAnimation = 22; - item.autoReuse = true; + Item.width = 28; + Item.height = 38; + Item.DamageType = DamageClass.Melee; + Item.damage = 55; + Item.knockBack = 4f; + Item.useTime = 22; + Item.useAnimation = 22; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; - item.rare = ItemRarityID.Lime; - item.value = Item.buyPrice(gold: 60); + Item.rare = ItemRarityID.Lime; + Item.value = Item.buyPrice(gold: 60); } } } diff --git a/Items/Weapons/Melee/TheGodsGambit.cs b/Items/Weapons/Melee/TheGodsGambit.cs index 5f52a38b9a..866fd6ae6f 100644 --- a/Items/Weapons/Melee/TheGodsGambit.cs +++ b/Items/Weapons/Melee/TheGodsGambit.cs @@ -14,42 +14,38 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("The God's Gambit"); Tooltip.SetDefault("Fires a stream of slime when enemies are near\n" + "A very agile yoyo"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 40; - item.height = 26; - item.melee = true; - item.damage = 29; - item.knockBack = 3.5f; - item.useTime = 21; - item.useAnimation = 21; - item.autoReuse = true; + Item.width = 40; + Item.height = 26; + Item.DamageType = DamageClass.Melee; + Item.damage = 29; + Item.knockBack = 3.5f; + Item.useTime = 21; + Item.useAnimation = 21; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; - item.rare = ItemRarityID.LightRed; - item.value = Item.buyPrice(gold: 12); + Item.rare = ItemRarityID.LightRed; + Item.value = Item.buyPrice(gold: 12); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 30).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/TheLastMourning.cs b/Items/Weapons/Melee/TheLastMourning.cs index 6967497e0c..958dfe37a2 100644 --- a/Items/Weapons/Melee/TheLastMourning.cs +++ b/Items/Weapons/Melee/TheLastMourning.cs @@ -19,24 +19,24 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 94; - item.height = 94; - item.scale = 1.5f; - item.melee = true; - item.damage = 360; - item.knockBack = 8.5f; - item.useAnimation = 20; - item.useTime = 20; - item.autoReuse = true; - item.useTurn = true; + Item.width = 94; + Item.height = 94; + Item.scale = 1.5f; + Item.DamageType = DamageClass.Melee; + Item.damage = 360; + Item.knockBack = 8.5f; + Item.useAnimation = 20; + Item.useTime = 20; + Item.autoReuse = true; + Item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.Calamity().donorItem = true; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -57,8 +57,8 @@ namespace CalamityMod.Items.Weapons.Melee if (crit) damage /= 2; - CalamityPlayer.HorsemansBladeOnHit(player, -1, damage, item.knockBack, 0, ModContent.ProjectileType()); - CalamityPlayer.HorsemansBladeOnHit(player, -1, damage, item.knockBack, 1); + CalamityPlayer.HorsemansBladeOnHit(player, -1, damage, Item.knockBack, 0, ModContent.ProjectileType()); + CalamityPlayer.HorsemansBladeOnHit(player, -1, damage, Item.knockBack, 1); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -87,14 +87,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ItemID.SoulofNight, 30); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddIngredient(ModContent.ItemType(), 3); - r.AddTile(TileID.LunarCraftingStation); - r.SetResult(this); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofNight, 30).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Melee/TheMicrowave.cs b/Items/Weapons/Melee/TheMicrowave.cs index 44b954fb0d..9a5411fc1d 100644 --- a/Items/Weapons/Melee/TheMicrowave.cs +++ b/Items/Weapons/Melee/TheMicrowave.cs @@ -13,33 +13,33 @@ namespace CalamityMod.Items.Weapons.Melee Tooltip.SetDefault("Fries nearby enemies with radiation\n" + "A very agile yoyo\n" + "Cooking, Astral Infection style"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 34; - item.height = 34; - item.melee = true; - item.damage = 65; - item.knockBack = 3f; - item.useTime = 22; - item.useAnimation = 22; - item.autoReuse = true; + Item.width = 34; + Item.height = 34; + Item.DamageType = DamageClass.Melee; + Item.damage = 65; + Item.knockBack = 3f; + Item.useTime = 22; + Item.useAnimation = 22; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; - item.rare = ItemRarityID.Cyan; - item.value = Item.buyPrice(gold: 95); + Item.rare = ItemRarityID.Cyan; + Item.value = Item.buyPrice(gold: 95); } } } diff --git a/Items/Weapons/Melee/TheMutilator.cs b/Items/Weapons/Melee/TheMutilator.cs index 159e44f4af..44d275c443 100644 --- a/Items/Weapons/Melee/TheMutilator.cs +++ b/Items/Weapons/Melee/TheMutilator.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -18,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 90; - item.height = 90; - item.scale = 1.5f; - item.damage = 483; - item.melee = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shootSpeed = 10f; + Item.width = 90; + Item.height = 90; + Item.scale = 1.5f; + Item.damage = 483; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.useTurn = true; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shootSpeed = 10f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -48,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, 58, 1, false, 0, false, false); } } - Main.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.position); target.position.X += target.width / 2; target.position.Y += target.height / 2; target.position.X -= target.width / 2; @@ -76,11 +77,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Melee/TheObliterator.cs b/Items/Weapons/Melee/TheObliterator.cs index 9f45373a5d..84cefc14cb 100644 --- a/Items/Weapons/Melee/TheObliterator.cs +++ b/Items/Weapons/Melee/TheObliterator.cs @@ -11,34 +11,34 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("The Obliterator"); Tooltip.SetDefault("Ruins nearby enemies with death lasers\n" + "An exceptionally agile yoyo"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 42; - item.height = 40; - item.melee = true; - item.damage = 255; - item.knockBack = 7.5f; - item.useTime = 20; - item.useAnimation = 20; - item.autoReuse = true; + Item.width = 42; + Item.height = 40; + Item.DamageType = DamageClass.Melee; + Item.damage = 255; + Item.knockBack = 7.5f; + Item.useTime = 20; + Item.useAnimation = 20; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } } } diff --git a/Items/Weapons/Melee/ThePlaguebringer.cs b/Items/Weapons/Melee/ThePlaguebringer.cs index b611f134d1..2a3e7d1218 100644 --- a/Items/Weapons/Melee/ThePlaguebringer.cs +++ b/Items/Weapons/Melee/ThePlaguebringer.cs @@ -12,33 +12,33 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Pandemic"); Tooltip.SetDefault("Fires plague seekers when enemies are near\n" + "A very agile yoyo"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 30; - item.height = 32; - item.melee = true; - item.damage = 66; - item.knockBack = 2.5f; - item.useTime = 22; - item.useAnimation = 22; - item.autoReuse = true; + Item.width = 30; + Item.height = 32; + Item.DamageType = DamageClass.Melee; + Item.damage = 66; + Item.knockBack = 2.5f; + Item.useTime = 22; + Item.useAnimation = 22; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; - item.rare = ItemRarityID.Yellow; - item.value = Item.buyPrice(gold: 80); + Item.rare = ItemRarityID.Yellow; + Item.value = Item.buyPrice(gold: 80); } } } diff --git a/Items/Weapons/Melee/TitanArm.cs b/Items/Weapons/Melee/TitanArm.cs index 304de01ac6..1ddce50758 100644 --- a/Items/Weapons/Melee/TitanArm.cs +++ b/Items/Weapons/Melee/TitanArm.cs @@ -16,19 +16,19 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 46; - item.height = 58; - item.damage = 69; - item.scale = 1.75f; - item.knockBack = 20f; //This number doesn't mean anything, but it's not 9001f because that caused bugs. - item.useAnimation = item.useTime = 12; - item.melee = true; - item.useTurn = true; - item.autoReuse = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.rare = ItemRarityID.Lime; - item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.width = 46; + Item.height = 58; + Item.damage = 69; + Item.scale = 1.75f; + Item.knockBack = 20f; //This number doesn't mean anything, but it's not 9001f because that caused bugs. + Item.useAnimation = Item.useTime = 12; + Item.DamageType = DamageClass.Melee; + Item.useTurn = true; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.rare = ItemRarityID.Lime; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; } // Boosting crit in SetDefaults along with knockback seemed to severely inflate the reforging price. Guaranteed crits for more knockback. @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Melee // This is modified vanilla code from StrikeNPC method in NPC.cs // Extra Note: Will cause an out of bounds error on enemies that don't despawn and are affected. See Blue Cultist Archer. // Extra (extra) Note: Fails in ModifyHitNPC if the enemy has too much health due to velocity clamping if you don't do enough damage. - float kbAmt = player.GetWeaponKnockback(item, item.knockBack) * 9001f * target.knockBackResist; //That obligatory over 9000 reference + float kbAmt = player.GetWeaponKnockback(Item, Item.knockBack) * 9001f * target.knockBackResist; //That obligatory over 9000 reference if (crit) kbAmt *= 1.4f; float kbAmtY = target.noGravity ? kbAmt * -0.5f : kbAmt * -0.75f; diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs index ac89398f1f..e435f2001f 100644 --- a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs +++ b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs @@ -16,35 +16,29 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 160; - item.height = 160; - item.damage = 2000; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 10; - item.knockBack = 50f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 25f; + Item.width = 160; + Item.height = 160; + Item.damage = 2000; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 10; + Item.knockBack = 50f; + Item.UseSound = SoundID.Item1; + Item.DamageType = DamageClass.Melee; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 25f; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofMight, 30); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofMight, 30).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Melee/Trinity.cs b/Items/Weapons/Melee/Trinity.cs index cc7c8360d3..665374344f 100644 --- a/Items/Weapons/Melee/Trinity.cs +++ b/Items/Weapons/Melee/Trinity.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 44; - item.damage = 50; - item.melee = true; - item.useAnimation = 18; - item.useTime = 18; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 54; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ProjectileID.RubyBolt; - item.shootSpeed = 11f; + Item.width = 44; + Item.damage = 50; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 18; + Item.useTime = 18; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 54; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ProjectileID.RubyBolt; + Item.shootSpeed = 11f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -57,11 +57,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 9).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/TrueArkoftheAncients.cs b/Items/Weapons/Melee/TrueArkoftheAncients.cs index 58f37c20c7..3558e2f87d 100644 --- a/Items/Weapons/Melee/TrueArkoftheAncients.cs +++ b/Items/Weapons/Melee/TrueArkoftheAncients.cs @@ -49,29 +49,29 @@ namespace CalamityMod.Items.Weapons.Melee if (player is null) return; - var tooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria"); + var tooltip = tooltips.FirstOrDefault(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); tooltip.text = ParryTooltip; tooltip.overrideColor = Color.CornflowerBlue; } public override void SetDefaults() { - item.width = item.height = 72; - item.damage = 188; - item.melee = true; - item.noUseGraphic = true; - item.noMelee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 6.5f; - item.UseSound = null; - item.autoReuse = true; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 12f; + Item.width = Item.height = 72; + Item.damage = 188; + Item.DamageType = DamageClass.Melee; + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useAnimation = 25; + Item.useTime = 25; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 6.5f; + Item.UseSound = null; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 12f; } public override bool AltFunctionUse(Player player) => true; @@ -159,21 +159,14 @@ namespace CalamityMod.Items.Weapons.Melee writer.Write(Charge); } - public override void NetRecieve(BinaryReader reader) + public override void NetReceive(BinaryReader reader) { Charge = reader.ReadSingle(); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemID.TrueExcalibur); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemType()).AddIngredient(ItemID.TrueExcalibur).AddIngredient(ItemType()).AddIngredient(ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index fc811c35c8..0941a9c8c6 100644 --- a/Items/Weapons/Melee/TrueBiomeBlade.cs +++ b/Items/Weapons/Melee/TrueBiomeBlade.cs @@ -99,9 +99,9 @@ namespace CalamityMod.Items.Weapons.Melee if (player is null) return; - var effectDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria"); - var mainAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip3" && x.mod == "Terraria"); - var secondaryAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip4" && x.mod == "Terraria"); + var effectDescTooltip = list.FirstOrDefault(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); + var mainAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip3" && x.Mod == "Terraria"); + var secondaryAttunementTooltip = list.FirstOrDefault(x => x.Name == "Tooltip4" && x.Mod == "Terraria"); //Default stuff effectDescTooltip.text = "Does nothing..yet\nRepairing the blade seems to have improved its attuning capacities"; @@ -134,34 +134,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = item.height = 68; - item.damage = BaseDamage; - item.melee = true; - item.useAnimation = 21; - item.useTime = 21; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity6BuyPrice; - item.rare = ItemRarityID.LightPurple; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 12f; + Item.width = Item.height = 68; + Item.damage = BaseDamage; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 21; + Item.useTime = 21; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 7.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.rare = ItemRarityID.LightPurple; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 12f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemID.SoulofFright, 1); - recipe.AddIngredient(ItemID.SoulofMight, 1); - recipe.AddIngredient(ItemID.SoulofSight, 1); - recipe.AddIngredient(ItemID.PixieDust, 2); - recipe.AddIngredient(ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemType()).AddIngredient(ItemID.SoulofFright, 1).AddIngredient(ItemID.SoulofMight, 1).AddIngredient(ItemID.SoulofSight, 1).AddIngredient(ItemID.PixieDust, 2).AddIngredient(ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } #region Saving and syncing attunements @@ -219,7 +210,7 @@ namespace CalamityMod.Items.Weapons.Melee writer.Write(secondaryAttunement != null ? (byte)secondaryAttunement.id : Attunement.attunementArray.Length - 1); } - public override void NetRecieve(BinaryReader reader) + public override void NetReceive(BinaryReader reader) { mainAttunement = Attunement.attunementArray[reader.ReadInt32()]; secondaryAttunement = Attunement.attunementArray[reader.ReadInt32()]; @@ -258,13 +249,13 @@ namespace CalamityMod.Items.Weapons.Melee if (mainAttunement == null) { - item.noUseGraphic = false; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = false; - item.channel = false; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 12f; - item.UseSound = SoundID.Item1; + Item.noUseGraphic = false; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = false; + Item.channel = false; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 12f; + Item.UseSound = SoundID.Item1; Combo = 0; Combo = 0; @@ -272,7 +263,7 @@ namespace CalamityMod.Items.Weapons.Melee } else - mainAttunement.ApplyStats(item); + mainAttunement.ApplyStats(Item); if (mainAttunement != null && mainAttunement.id != AttunementID.TrueCold && mainAttunement.id != AttunementID.TrueTropical) Combo = 0; @@ -382,7 +373,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { Texture2D itemTexture = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade"); //Use the "projectile" sprite which is flipped so its consistent in lighting with the rest of the line, since its actual sprite is flipped so the swings may look normal - spriteBatch.Draw(itemTexture, item.Center - Main.screenPosition, null, lightColor, rotation, item.Size * 0.5f, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(itemTexture, Item.Center - Main.screenPosition, null, lightColor, rotation, Item.Size * 0.5f, scale, SpriteEffects.None, 0f); return false; } } diff --git a/Items/Weapons/Melee/TrueBloodyEdge.cs b/Items/Weapons/Melee/TrueBloodyEdge.cs index 6bfdf46c90..81746fc5ac 100644 --- a/Items/Weapons/Melee/TrueBloodyEdge.cs +++ b/Items/Weapons/Melee/TrueBloodyEdge.cs @@ -19,31 +19,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 48; - item.damage = 75; - item.melee = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 64; - item.scale = 1.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11f; + Item.width = 48; + Item.damage = 75; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 64; + Item.scale = 1.5f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.BrokenHeroSword).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/TrueCausticEdge.cs b/Items/Weapons/Melee/TrueCausticEdge.cs index 326ce57000..b77d5cdd3b 100644 --- a/Items/Weapons/Melee/TrueCausticEdge.cs +++ b/Items/Weapons/Melee/TrueCausticEdge.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 64; - item.damage = 150; - item.melee = true; - item.useAnimation = 28; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 28; - item.useTurn = true; - item.knockBack = 5.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 74; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.width = 64; + Item.damage = 150; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 28; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 28; + Item.useTurn = true; + Item.knockBack = 5.75f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 74; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -42,14 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("AnyEvilFlask", 5); - recipe.AddIngredient(ItemID.FlaskofPoison, 5); - recipe.AddIngredient(ItemID.Deathweed, 3); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddRecipeGroup("AnyEvilFlask", 5).AddIngredient(ItemID.FlaskofPoison, 5).AddIngredient(ItemID.Deathweed, 3).AddTile(TileID.DemonAltar).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/TrueExcaliburShortsword.cs b/Items/Weapons/Melee/TrueExcaliburShortsword.cs index eab6eb145c..d904356399 100644 --- a/Items/Weapons/Melee/TrueExcaliburShortsword.cs +++ b/Items/Weapons/Melee/TrueExcaliburShortsword.cs @@ -16,38 +16,33 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 12; - item.useTime = 12; - item.width = 42; - item.height = 42; - item.damage = 130; - item.melee = true; - item.knockBack = 5.75f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 12; + Item.useTime = 12; + Item.width = 42; + Item.height = 42; + Item.damage = 130; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 5.75f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.BrokenHeroSword).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/TrueForbiddenOathblade.cs b/Items/Weapons/Melee/TrueForbiddenOathblade.cs index 66578e5063..fe06313087 100644 --- a/Items/Weapons/Melee/TrueForbiddenOathblade.cs +++ b/Items/Weapons/Melee/TrueForbiddenOathblade.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -19,21 +20,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 88; - item.height = 88; - item.damage = 150; - item.melee = true; - item.useAnimation = 23; - item.useTime = 23; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 3f; + Item.width = 88; + Item.height = 88; + Item.damage = 150; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 23; + Item.useTime = 23; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 7.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 3f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -49,14 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.BrokenHeroSword).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -79,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Melee float num52 = 2f; Vector2 value3 = (target.rotation - MathHelper.PiOver2).ToRotationVector2(); Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.Center); + SoundEngine.PlaySound(SoundID.Item14, target.Center); for (int num53 = 0; num53 < 40; num53++) { int num54 = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 200, default, num50); @@ -119,7 +113,7 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(ModContent.BuffType(), 450); target.AddBuff(BuffID.OnFire, 900); - Main.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.position); } } } diff --git a/Items/Weapons/Melee/TrueNightsStabber.cs b/Items/Weapons/Melee/TrueNightsStabber.cs index 1d5ccb3053..755fc9bb4e 100644 --- a/Items/Weapons/Melee/TrueNightsStabber.cs +++ b/Items/Weapons/Melee/TrueNightsStabber.cs @@ -16,38 +16,33 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 16; - item.useTime = 16; - item.width = 40; - item.height = 40; - item.damage = 310; - item.melee = true; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 25f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; + Item.useStyle = ItemUseStyleID.Thrust; + Item.useTurn = false; + Item.useAnimation = 16; + Item.useTime = 16; + Item.width = 40; + Item.height = 40; + Item.damage = 310; + Item.DamageType = DamageClass.Melee; + Item.knockBack = 6.25f; + Item.UseSound = SoundID.Item1; + Item.useTurn = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 25f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.BrokenHeroSword).AddTile(TileID.MythrilAnvil).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/TruePaladinsHammerMelee.cs b/Items/Weapons/Melee/TruePaladinsHammerMelee.cs index 4137554fed..b59d549d66 100644 --- a/Items/Weapons/Melee/TruePaladinsHammerMelee.cs +++ b/Items/Weapons/Melee/TruePaladinsHammerMelee.cs @@ -16,35 +16,27 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 14; - item.damage = 87; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 13; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 13; - item.knockBack = 20f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 28; - item.value = Item.buyPrice(gold: 80); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.width = 14; + Item.damage = 87; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useAnimation = 13; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 13; + Item.knockBack = 20f; + Item.UseSound = SoundID.Item1; + Item.DamageType = DamageClass.Melee; + Item.height = 28; + Item.value = Item.buyPrice(gold: 80); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PaladinsHammer); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.PaladinsHammer).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs b/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs index 41a82e08b8..de5a33ed8e 100644 --- a/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs +++ b/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs @@ -20,22 +20,22 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 102; - item.damage = 112; - item.melee = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 102; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.width = 102; + Item.damage = 112; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.useTurn = true; + Item.knockBack = 7.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 102; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -61,13 +61,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.DemonAltar).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/Tumbleweed.cs b/Items/Weapons/Melee/Tumbleweed.cs index d7084a7f19..c791ddc726 100644 --- a/Items/Weapons/Melee/Tumbleweed.cs +++ b/Items/Weapons/Melee/Tumbleweed.cs @@ -16,34 +16,28 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 125; - item.melee = true; - item.width = 30; - item.height = 10; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.channel = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.damage = 125; + Item.DamageType = DamageClass.Melee; + Item.width = 30; + Item.height = 10; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.knockBack = 8f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Sunfury); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofMight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Sunfury).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofMight, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/TyphonsGreed.cs b/Items/Weapons/Melee/TyphonsGreed.cs index 876d536d87..0fe2b6f637 100644 --- a/Items/Weapons/Melee/TyphonsGreed.cs +++ b/Items/Weapons/Melee/TyphonsGreed.cs @@ -17,34 +17,28 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 65; - item.melee = true; - item.width = 16; - item.height = 16; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.DD2_SkyDragonsFurySwing; - item.autoReuse = true; - item.channel = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24f; + Item.damage = 65; + Item.DamageType = DamageClass.Melee; + Item.width = 16; + Item.height = 16; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.knockBack = 5f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.DD2_SkyDragonsFurySwing; + Item.autoReuse = true; + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 30).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Melee/TyrantYharimsUltisword.cs b/Items/Weapons/Melee/TyrantYharimsUltisword.cs index 7dc4601dd6..38349c482e 100644 --- a/Items/Weapons/Melee/TyrantYharimsUltisword.cs +++ b/Items/Weapons/Melee/TyrantYharimsUltisword.cs @@ -19,33 +19,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 88; - item.damage = 64; - item.melee = true; - item.useAnimation = 26; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 26; - item.useTurn = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 88; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.width = 88; + Item.damage = 64; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 26; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 26; + Item.useTurn = true; + Item.knockBack = 5.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 88; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddIngredient(ItemID.FlaskofVenom, 5); - recipe.AddIngredient(ItemID.ChlorophyteBar, 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.BrokenHeroSword).AddIngredient(ItemID.FlaskofVenom, 5).AddIngredient(ItemID.ChlorophyteBar, 15).AddTile(TileID.DemonAltar).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/UltimusCleaver.cs b/Items/Weapons/Melee/UltimusCleaver.cs index 91467ddb18..bcd528dd8c 100644 --- a/Items/Weapons/Melee/UltimusCleaver.cs +++ b/Items/Weapons/Melee/UltimusCleaver.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -17,32 +18,32 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 130; - item.melee = true; - item.useTurn = true; - item.rare = ItemRarityID.Yellow; - item.width = 72; - item.height = 62; - item.scale = 1.5f; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.autoReuse = true; - item.UseSound = SoundID.Item1; + Item.damage = 130; + Item.DamageType = DamageClass.Melee; + Item.useTurn = true; + Item.rare = ItemRarityID.Yellow; + Item.width = 72; + Item.height = 62; + Item.scale = 1.5f; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 8f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.autoReuse = true; + Item.UseSound = SoundID.Item1; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.OnFire, 360); - player.ApplyDamageToNPC(target, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), 0f, 0, false); + player.ApplyDamageToNPC(target, (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Melee) - 1f)), 0f, 0, false); float num50 = 1.7f; float num51 = 0.8f; float num52 = 2f; Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.position); int num3; for (int num53 = 0; num53 < 40; num53 = num3 + 1) { @@ -142,7 +143,7 @@ namespace CalamityMod.Items.Weapons.Melee num342 *= (float)player.direction; num341 *= player.gravDir; Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, - (float)player.direction * num340, num339 * player.gravDir, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.1), 0f, player.whoAmI, 0f, 0f); + (float)player.direction * num340, num339 * player.gravDir, ModContent.ProjectileType(), (int)(Item.damage * player.MeleeDamage() * 0.1), 0f, player.whoAmI, 0f, 0f); } } } diff --git a/Items/Weapons/Melee/UrchinFlail.cs b/Items/Weapons/Melee/UrchinFlail.cs index 5af85676ab..635179e9bc 100644 --- a/Items/Weapons/Melee/UrchinFlail.cs +++ b/Items/Weapons/Melee/UrchinFlail.cs @@ -15,23 +15,23 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 33; - item.melee = true; - item.width = 44; - item.height = 36; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.channel = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.damage = 33; + Item.DamageType = DamageClass.Melee; + Item.width = 44; + Item.height = 36; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.knockBack = 6f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } } } diff --git a/Items/Weapons/Melee/UrchinSpear.cs b/Items/Weapons/Melee/UrchinSpear.cs index b219f343c1..ecbb1030f9 100644 --- a/Items/Weapons/Melee/UrchinSpear.cs +++ b/Items/Weapons/Melee/UrchinSpear.cs @@ -16,34 +16,30 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 56; - item.damage = 28; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 25; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 56; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 4f; + Item.width = 56; + Item.damage = 28; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 25; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 56; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 4f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Melee/VeinBurster.cs b/Items/Weapons/Melee/VeinBurster.cs index f9ac71b8ca..1b97c08745 100644 --- a/Items/Weapons/Melee/VeinBurster.cs +++ b/Items/Weapons/Melee/VeinBurster.cs @@ -16,32 +16,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 52; - item.damage = 71; - item.melee = true; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 37; - item.useTurn = true; - item.knockBack = 4.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.width = 52; + Item.damage = 71; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 37; + Item.useTurn = true; + Item.knockBack = 4.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 50; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Vertebrae, 5); - recipe.AddIngredient(ItemID.CrimtaneBar, 5); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Vertebrae, 5).AddIngredient(ItemID.CrimtaneBar, 5).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Melee/Verdant.cs b/Items/Weapons/Melee/Verdant.cs index 8af804a4d3..9797b11eb6 100644 --- a/Items/Weapons/Melee/Verdant.cs +++ b/Items/Weapons/Melee/Verdant.cs @@ -12,44 +12,40 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Verdant"); Tooltip.SetDefault("Fires crystal leaves when enemies are near\n" + "A very agile yoyo"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.melee = true; - item.damage = 86; - item.knockBack = 6f; - item.useTime = 22; - item.useAnimation = 22; - item.autoReuse = true; + Item.width = 30; + Item.height = 30; + Item.DamageType = DamageClass.Melee; + Item.damage = 86; + Item.knockBack = 6f; + Item.useTime = 22; + Item.useAnimation = 22; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Melee/Violence.cs b/Items/Weapons/Melee/Violence.cs index a0d64c77cb..550cad606b 100644 --- a/Items/Weapons/Melee/Violence.cs +++ b/Items/Weapons/Melee/Violence.cs @@ -16,27 +16,27 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.height = item.width = 142; - item.damage = 404; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 25; - item.useTime = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.channel = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + Item.height = Item.width = 142; + Item.damage = 404; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 25; + Item.useTime = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 9f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; } - public override bool CanUseItem(Player player) => player.altFunctionUse == 2 || player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.altFunctionUse == 2 || player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Melee/VirulentKatana.cs b/Items/Weapons/Melee/VirulentKatana.cs index 47a696d740..8c7dd6c2b5 100644 --- a/Items/Weapons/Melee/VirulentKatana.cs +++ b/Items/Weapons/Melee/VirulentKatana.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 96; - item.knockBack = 5.5f; - item.useAnimation = item.useTime = 15; - item.melee = true; - item.useTurn = true; - item.autoReuse = true; - item.shootSpeed = 9f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 96; + Item.knockBack = 5.5f; + Item.useAnimation = Item.useTime = 15; + Item.DamageType = DamageClass.Melee; + Item.useTurn = true; + Item.autoReuse = true; + Item.shootSpeed = 9f; + Item.shoot = ModContent.ProjectileType(); - item.width = 48; - item.height = 62; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; + Item.width = 48; + Item.height = 62; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Melee/Waraxe.cs b/Items/Weapons/Melee/Waraxe.cs index dad561509a..e6b3afe70c 100644 --- a/Items/Weapons/Melee/Waraxe.cs +++ b/Items/Weapons/Melee/Waraxe.cs @@ -15,20 +15,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 26; - item.knockBack = 5.25f; - item.useTime = 18; - item.useAnimation = 22; - item.axe = 85 / 5; + Item.damage = 26; + Item.knockBack = 5.25f; + Item.useTime = 18; + Item.useAnimation = 22; + Item.axe = 85 / 5; - item.melee = true; - item.width = 32; - item.height = 40; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 1, 0, 0); - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.DamageType = DamageClass.Melee; + Item.width = 32; + Item.height = 40; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/Warblade.cs b/Items/Weapons/Melee/Warblade.cs index 911198d694..ba4cde053f 100644 --- a/Items/Weapons/Melee/Warblade.cs +++ b/Items/Weapons/Melee/Warblade.cs @@ -15,19 +15,19 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 27; - item.melee = true; - item.width = 32; - item.height = 48; - item.useTime = 19; - item.useAnimation = 19; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4.25f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + Item.damage = 27; + Item.DamageType = DamageClass.Melee; + Item.width = 32; + Item.height = 48; + Item.useTime = 19; + Item.useAnimation = 19; + Item.useTurn = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4.25f; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/Whirlpool.cs b/Items/Weapons/Melee/Whirlpool.cs index f4e4b4d8c9..baf2db22e5 100644 --- a/Items/Weapons/Melee/Whirlpool.cs +++ b/Items/Weapons/Melee/Whirlpool.cs @@ -13,43 +13,38 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Riptide"); Tooltip.SetDefault("Sprays a spiral of aqua streams in random directions\n" + "A very agile yoyo"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 30; - item.height = 44; - item.melee = true; - item.damage = 16; - item.knockBack = 1f; - item.useTime = 25; - item.useAnimation = 25; - item.autoReuse = true; + Item.width = 30; + Item.height = 44; + Item.DamageType = DamageClass.Melee; + Item.damage = 16; + Item.knockBack = 1f; + Item.useTime = 25; + Item.useAnimation = 25; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; - item.rare = ItemRarityID.Green; - item.value = Item.buyPrice(gold: 2); + Item.rare = ItemRarityID.Green; + Item.value = Item.buyPrice(gold: 2); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Melee/WindBlade.cs b/Items/Weapons/Melee/WindBlade.cs index 2acc2f7121..a5ffe5b799 100644 --- a/Items/Weapons/Melee/WindBlade.cs +++ b/Items/Weapons/Melee/WindBlade.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 58; - item.damage = 41; - item.melee = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.useTurn = true; - item.knockBack = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 58; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 3f; + Item.width = 58; + Item.damage = 41; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.useTurn = true; + Item.knockBack = 5; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 58; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 3f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -42,12 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddIngredient(ItemID.SunplateBlock, 3); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 9).AddIngredient(ItemID.SunplateBlock, 3).AddTile(TileID.SkyMill).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/WulfrumBlade.cs b/Items/Weapons/Melee/WulfrumBlade.cs index 30b4da78e1..c13dbb716f 100644 --- a/Items/Weapons/Melee/WulfrumBlade.cs +++ b/Items/Weapons/Melee/WulfrumBlade.cs @@ -15,19 +15,19 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 32; - item.height = 46; - item.damage = 12; - item.melee = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.useTurn = true; - item.knockBack = 3.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; + Item.width = 32; + Item.height = 46; + Item.damage = 12; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.useTurn = true; + Item.knockBack = 3.75f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; } public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) @@ -37,11 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Melee/XerocsGreatsword.cs b/Items/Weapons/Melee/XerocsGreatsword.cs index 9cd5bfb37f..277b6f6c72 100644 --- a/Items/Weapons/Melee/XerocsGreatsword.cs +++ b/Items/Weapons/Melee/XerocsGreatsword.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 130; - item.height = 106; - item.damage = 90; - item.melee = true; - item.useAnimation = 26; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 26; - item.useTurn = true; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.width = 130; + Item.height = 106; + Item.damage = 90; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 26; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 26; + Item.useTurn = true; + Item.knockBack = 5.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) @@ -70,11 +70,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.LunarCraftingStation).Register(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/YateveoBloom.cs b/Items/Weapons/Melee/YateveoBloom.cs index ec75ebfabd..0b96f6cc5a 100644 --- a/Items/Weapons/Melee/YateveoBloom.cs +++ b/Items/Weapons/Melee/YateveoBloom.cs @@ -23,29 +23,29 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 42; - item.height = 62; - item.damage = BaseDamage; - item.knockBack = 5f; - item.useAnimation = item.useTime = 22; + Item.width = 42; + Item.height = 62; + Item.damage = BaseDamage; + Item.knockBack = 5f; + Item.useAnimation = Item.useTime = 22; - item.noUseGraphic = true; - item.melee = true; - item.noMelee = true; - item.channel = true; - item.autoReuse = true; - item.useTurn = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.channel = true; + Item.autoReuse = true; + Item.useTurn = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = ShootSpeed; - item.Calamity().trueMelee = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = ShootSpeed; + Item.Calamity().trueMelee = true; } public override bool AltFunctionUse(Player player) => true; @@ -62,16 +62,16 @@ namespace CalamityMod.Items.Weapons.Melee // Spear if (player.altFunctionUse == 2) { - item.channel = false; - item.autoReuse = true; + Item.channel = false; + Item.autoReuse = true; } // Flail else { - item.channel = true; - item.autoReuse = false; + Item.channel = true; + Item.autoReuse = false; } - return player.ownedProjectileCounts[item.shoot] + player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + return player.ownedProjectileCounts[Item.shoot] + player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -86,15 +86,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.JungleRose); - recipe.AddIngredient(ItemID.RichMahogany, 15); - recipe.AddIngredient(ItemID.JungleSpores, 12); - recipe.AddIngredient(ItemID.Stinger, 4); - recipe.AddIngredient(ItemID.Vine, 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.JungleRose).AddIngredient(ItemID.RichMahogany, 15).AddIngredient(ItemID.JungleSpores, 12).AddIngredient(ItemID.Stinger, 4).AddIngredient(ItemID.Vine, 2).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Melee/YinYo.cs b/Items/Weapons/Melee/YinYo.cs index 459ba67961..50b951d939 100644 --- a/Items/Weapons/Melee/YinYo.cs +++ b/Items/Weapons/Melee/YinYo.cs @@ -12,43 +12,38 @@ namespace CalamityMod.Items.Weapons.Melee Tooltip.SetDefault("Fires light or dark shards when enemies are near\n" + "Shards fly back and forth\n" + "A very agile yoyo"); - ItemID.Sets.Yoyo[item.type] = true; - ItemID.Sets.GamepadExtraRange[item.type] = 15; - ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; } public override void SetDefaults() { - item.width = 26; - item.height = 24; - item.melee = true; - item.damage = 50; - item.knockBack = 3.5f; - item.useTime = 25; - item.useAnimation = 25; - item.autoReuse = true; + Item.width = 26; + Item.height = 24; + Item.DamageType = DamageClass.Melee; + Item.damage = 50; + Item.knockBack = 3.5f; + Item.useTime = 25; + Item.useAnimation = 25; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item1; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DarkShard); - recipe.AddIngredient(ItemID.LightShard); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.DarkShard).AddIngredient(ItemID.LightShard).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/AMR.cs b/Items/Weapons/Ranged/AMR.cs index f9bb470e76..40378c32b7 100644 --- a/Items/Weapons/Ranged/AMR.cs +++ b/Items/Weapons/Ranged/AMR.cs @@ -19,24 +19,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 3240; - item.ranged = true; - item.width = 154; - item.height = 40; - item.useTime = 60; - item.useAnimation = 60; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 9.5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); - item.autoReuse = true; - item.shoot = ProjectileID.Bullet; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 3240; + Item.DamageType = DamageClass.Ranged; + Item.width = 154; + Item.height = 40; + Item.useTime = 60; + Item.useAnimation = 60; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 9.5f; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); + Item.autoReuse = true; + Item.shoot = ProjectileID.Bullet; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-30, 0); @@ -46,12 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs index 25423a610a..389d0430ec 100644 --- a/Items/Weapons/Ranged/AcesHigh.cs +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -21,26 +21,26 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 325; - item.ranged = true; - item.width = 48; - item.height = 30; - item.useTime = 3; - item.reuseDelay = 8; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6f; + Item.damage = 325; + Item.DamageType = DamageClass.Ranged; + Item.width = 48; + Item.height = 30; + Item.useTime = 3; + Item.reuseDelay = 8; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().donorItem = true; - item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Bullet; + Item.UseSound = SoundID.Item36; + Item.autoReuse = true; + Item.shootSpeed = 24f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() @@ -50,14 +50,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Revolver); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 52); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Revolver).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 52).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index c301c3f691..f1ff5db2d8 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -20,24 +20,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 165; - item.ranged = true; - item.width = 62; - item.height = 90; - item.useTime = 15; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.WoodenArrowFriendly; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 165; + Item.DamageType = DamageClass.Ranged; + Item.width = 62; + Item.height = 90; + Item.useTime = 15; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4f; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.WoodenArrowFriendly; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -92,17 +92,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/AngelicShotgun.cs b/Items/Weapons/Ranged/AngelicShotgun.cs index 030450980b..aa436705ca 100644 --- a/Items/Weapons/Ranged/AngelicShotgun.cs +++ b/Items/Weapons/Ranged/AngelicShotgun.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -23,28 +24,28 @@ Fighting 'til the war's won"); public override void SetDefaults() { - item.damage = BaseDamage; - item.knockBack = 3f; - item.ranged = true; - item.noMelee = true; - item.autoReuse = true; + Item.damage = BaseDamage; + Item.knockBack = 3f; + Item.DamageType = DamageClass.Ranged; + Item.noMelee = true; + Item.autoReuse = true; - item.width = 44; - item.height = 7; + Item.width = 44; + Item.height = 7; - item.useTime = 24; - item.useAnimation = 24; - item.UseSound = SoundID.Item38; - item.useStyle = ItemUseStyleID.HoldingOut; + Item.useTime = 24; + Item.useAnimation = 24; + Item.UseSound = SoundID.Item38; + Item.useStyle = ItemUseStyleID.Shoot; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().donorItem = true; - item.shootSpeed = BulletSpeed; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.shootSpeed = BulletSpeed; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -114,21 +115,14 @@ Fighting 'til the war's won"); Projectile.NewProjectile(rrp, new Vector2(mouseDX, mouseDY + Main.rand.NextFloat(-0.8f, 0.8f)), ModContent.ProjectileType(), laserDamage, laserKB, player.whoAmI); // Play the sound of the laser beam - Main.PlaySound(SoundID.Item72, player.Center); + SoundEngine.PlaySound(SoundID.Item72, player.Center); return false; } public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ItemID.SunplateBlock, 75); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddIngredient(ModContent.ItemType(), 15); - r.AddIngredient(ModContent.ItemType(), 7); - r.AddTile(TileID.LunarCraftingStation); - r.SetResult(this); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SunplateBlock, 75).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.LunarCraftingStation).Register(); } } diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 2f4c0137ac..aae82f7f5e 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -17,24 +17,24 @@ Right click to fire a burst of bullets"); public override void SetDefaults() { - item.damage = 25; - item.ranged = true; - item.width = 70; - item.height = 18; - item.useTime = 4; - item.reuseDelay = 15; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 11f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 25; + Item.DamageType = DamageClass.Ranged; + Item.width = 70; + Item.height = 18; + Item.useTime = 4; + Item.reuseDelay = 15; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item31; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 11f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -51,19 +51,19 @@ Right click to fire a burst of bullets"); { if (player.altFunctionUse == 2) { - item.useTime = 4; - item.reuseDelay = 13; - item.useAnimation = 12; - item.UseSound = SoundID.Item31; - item.shootSpeed = 10f; + Item.useTime = 4; + Item.reuseDelay = 13; + Item.useAnimation = 12; + Item.UseSound = SoundID.Item31; + Item.shootSpeed = 10f; } else { - item.useTime = 35; - item.reuseDelay = 0; - item.useAnimation = 35; - item.UseSound = SoundID.Item40; - item.shootSpeed = 15f; + Item.useTime = 35; + Item.reuseDelay = 0; + Item.useAnimation = 35; + Item.UseSound = SoundID.Item40; + Item.shootSpeed = 15f; } return base.CanUseItem(player); } diff --git a/Items/Weapons/Ranged/AquashardShotgun.cs b/Items/Weapons/Ranged/AquashardShotgun.cs index aa4a6b01b2..a4ed039613 100644 --- a/Items/Weapons/Ranged/AquashardShotgun.cs +++ b/Items/Weapons/Ranged/AquashardShotgun.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 14; - item.ranged = true; - item.width = 62; - item.height = 26; - item.useTime = 26; - item.useAnimation = 26; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item61; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 22f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 14; + Item.DamageType = DamageClass.Ranged; + Item.width = 62; + Item.height = 26; + Item.useTime = 26; + Item.useAnimation = 26; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item61; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 22f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -63,15 +63,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Boomstick); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Boomstick).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/Arbalest.cs b/Items/Weapons/Ranged/Arbalest.cs index f8175595a5..9f10e0505a 100644 --- a/Items/Weapons/Ranged/Arbalest.cs +++ b/Items/Weapons/Ranged/Arbalest.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -20,24 +21,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 29; - item.ranged = true; - item.width = 82; - item.height = 34; - item.useTime = 7; - item.reuseDelay = 30; - item.useAnimation = 28; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.UseSound = null; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 29; + Item.DamageType = DamageClass.Ranged; + Item.width = 82; + Item.height = 34; + Item.useTime = 7; + Item.reuseDelay = 30; + Item.useAnimation = 28; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4f; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.UseSound = null; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -45,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Main.PlaySound(SoundID.Item5, (int)player.Center.X, (int)player.Center.Y); + SoundEngine.PlaySound(SoundID.Item5, (int)player.Center.X, (int)player.Center.Y); if (totalProjectiles > 4) { diff --git a/Items/Weapons/Ranged/Archerfish.cs b/Items/Weapons/Ranged/Archerfish.cs index f9bb7b4297..9200ffc0db 100644 --- a/Items/Weapons/Ranged/Archerfish.cs +++ b/Items/Weapons/Ranged/Archerfish.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 23; - item.ranged = true; - item.width = 78; - item.height = 36; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 23; + Item.DamageType = DamageClass.Ranged; + Item.width = 78; + Item.height = 36; + Item.useTime = 10; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index f74e50ee45..411013e00a 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -19,38 +19,34 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 128; - item.ranged = true; - item.width = 44; - item.height = 100; - item.useTime = 3; - item.reuseDelay = 10; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4.25f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 30f; - item.useAmmo = AmmoID.Arrow; + Item.damage = 128; + Item.DamageType = DamageClass.Ranged; + Item.width = 44; + Item.height = 100; + Item.useTime = 3; + Item.reuseDelay = 10; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4.25f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.Item102; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.useAmmo = AmmoID.Arrow; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Ranged/AstralBlaster.cs b/Items/Weapons/Ranged/AstralBlaster.cs index 7d679dc49c..f69bbe9413 100644 --- a/Items/Weapons/Ranged/AstralBlaster.cs +++ b/Items/Weapons/Ranged/AstralBlaster.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 120; - item.ranged = true; - item.width = 40; - item.height = 24; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.75f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 120; + Item.DamageType = DamageClass.Ranged; + Item.width = 40; + Item.height = 24; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.75f; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.UseSound = SoundID.Item41; + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -53,11 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/AstralRepeater.cs b/Items/Weapons/Ranged/AstralRepeater.cs index f77c15bd4f..c47130ef7b 100644 --- a/Items/Weapons/Ranged/AstralRepeater.cs +++ b/Items/Weapons/Ranged/AstralRepeater.cs @@ -15,24 +15,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 99; - item.ranged = true; - item.width = 38; - item.height = 78; - item.useTime = 5; - item.reuseDelay = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.WoodenArrowFriendly; - item.shootSpeed = 16f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 99; + Item.DamageType = DamageClass.Ranged; + Item.width = 38; + Item.height = 78; + Item.useTime = 5; + Item.reuseDelay = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.5f; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.WoodenArrowFriendly; + Item.shootSpeed = 16f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -40,11 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/AstrealDefeat.cs b/Items/Weapons/Ranged/AstrealDefeat.cs index 6ffd8c23a4..1489954aff 100644 --- a/Items/Weapons/Ranged/AstrealDefeat.cs +++ b/Items/Weapons/Ranged/AstrealDefeat.cs @@ -20,23 +20,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 153; - item.ranged = true; - item.width = 40; - item.height = 78; - item.useTime = 4; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 4f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 153; + Item.DamageType = DamageClass.Ranged; + Item.width = 40; + Item.height = 78; + Item.useTime = 4; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item102; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 4f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged // Always fires Astreal Arrows, regardless of ammo chosen. // Normally we like to allow bows to fire normal arrows but this weapon is incredibly overpowered when that is allowed. - type = item.shoot; + type = Item.shoot; float aiVar = Main.rand.Next(4); Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI, aiVar); @@ -57,17 +57,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpiritFlame); - recipe.AddIngredient(ItemID.ShadowFlameBow); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpiritFlame).AddIngredient(ItemID.ShadowFlameBow).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/Auralis.cs b/Items/Weapons/Ranged/Auralis.cs index 8e3913bc71..8997ba63ff 100644 --- a/Items/Weapons/Ranged/Auralis.cs +++ b/Items/Weapons/Ranged/Auralis.cs @@ -28,24 +28,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 695; - item.ranged = true; - item.useTime = item.useAnimation = 30; - item.knockBack = 10f; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7.5f; - item.useAmmo = AmmoID.Bullet; + Item.damage = 695; + Item.DamageType = DamageClass.Ranged; + Item.useTime = Item.useAnimation = 30; + Item.knockBack = 10f; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7.5f; + Item.useAmmo = AmmoID.Bullet; - item.width = 96; - item.height = 34; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().donorItem = true; - item.Calamity().canFirePointBlankShots = true; + Item.width = 96; + Item.height = 34; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().donorItem = true; + Item.Calamity().canFirePointBlankShots = true; } public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) @@ -56,13 +56,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), item.shoot, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), Item.shoot, damage, knockBack, player.whoAmI); return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/AuralisGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Ranged/AuralisGlow")); } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -71,14 +71,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SniperRifle); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SniperRifle).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 50).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/AuroraBlazer.cs b/Items/Weapons/Ranged/AuroraBlazer.cs index 41d94c7105..9947099008 100644 --- a/Items/Weapons/Ranged/AuroraBlazer.cs +++ b/Items/Weapons/Ranged/AuroraBlazer.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 49; - item.ranged = true; - item.useTime = 18; - item.useAnimation = 18; - item.knockBack = 2f; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7.5f; - item.useAmmo = AmmoID.Gel; + Item.damage = 49; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 18; + Item.useAnimation = 18; + Item.knockBack = 2f; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7.5f; + Item.useAmmo = AmmoID.Gel; - item.width = 68; - item.height = 36; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.UseSound = SoundID.Item34; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; + Item.width = 68; + Item.height = 36; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.UseSound = SoundID.Item34; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/AuroraBlazerGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Ranged/AuroraBlazerGlow")); } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); diff --git a/Items/Weapons/Ranged/Barinade.cs b/Items/Weapons/Ranged/Barinade.cs index 859982ecce..98bed2f98d 100644 --- a/Items/Weapons/Ranged/Barinade.cs +++ b/Items/Weapons/Ranged/Barinade.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 9; - item.ranged = true; - item.width = 30; - item.height = 44; - item.useTime = 26; - item.useAnimation = 26; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 9; + Item.DamageType = DamageClass.Ranged; + Item.width = 30; + Item.height = 44; + Item.useTime = 26; + Item.useAnimation = 26; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/Barinautical.cs b/Items/Weapons/Ranged/Barinautical.cs index baf2b046dd..ec028e6fe9 100644 --- a/Items/Weapons/Ranged/Barinautical.cs +++ b/Items/Weapons/Ranged/Barinautical.cs @@ -16,24 +16,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 28; - item.ranged = true; - item.width = 30; - item.height = 42; - item.useTime = 4; - item.reuseDelay = 20; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 28; + Item.DamageType = DamageClass.Ranged; + Item.width = 30; + Item.height = 42; + Item.useTime = 4; + Item.reuseDelay = 20; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/BarracudaGun.cs b/Items/Weapons/Ranged/BarracudaGun.cs index 65fddbd1ab..f15ca0f1bf 100644 --- a/Items/Weapons/Ranged/BarracudaGun.cs +++ b/Items/Weapons/Ranged/BarracudaGun.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 63; - item.channel = true; - item.ranged = true; - item.width = 54; - item.height = 28; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item10; - item.autoReuse = true; - item.shootSpeed = 15f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 63; + Item.channel = true; + Item.DamageType = DamageClass.Ranged; + Item.width = 54; + Item.height = 28; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item10; + Item.autoReuse = true; + Item.shootSpeed = 15f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() @@ -54,15 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PiranhaGun); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.SharkFin, 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.PiranhaGun).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.SharkFin, 2).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/BladedgeGreatbow.cs b/Items/Weapons/Ranged/BladedgeGreatbow.cs index 3c3c4ff9ab..d5180ad45e 100644 --- a/Items/Weapons/Ranged/BladedgeGreatbow.cs +++ b/Items/Weapons/Ranged/BladedgeGreatbow.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 28; - item.ranged = true; - item.width = 74; - item.height = 24; - item.useTime = 26; - item.useAnimation = 26; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 14f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 28; + Item.DamageType = DamageClass.Ranged; + Item.width = 74; + Item.height = 24; + Item.useTime = 26; + Item.useAnimation = 26; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 14f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -74,11 +74,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/BlissfulBombardier.cs b/Items/Weapons/Ranged/BlissfulBombardier.cs index e94de44a0a..49b376fd7b 100644 --- a/Items/Weapons/Ranged/BlissfulBombardier.cs +++ b/Items/Weapons/Ranged/BlissfulBombardier.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 80; - item.ranged = true; - item.width = 76; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Rocket; + Item.damage = 80; + Item.DamageType = DamageClass.Ranged; + Item.width = 76; + Item.height = 30; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7.5f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shootSpeed = 24f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Rocket; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); diff --git a/Items/Weapons/Ranged/BloodBoiler.cs b/Items/Weapons/Ranged/BloodBoiler.cs index c554807c27..42df3c6f5a 100644 --- a/Items/Weapons/Ranged/BloodBoiler.cs +++ b/Items/Weapons/Ranged/BloodBoiler.cs @@ -19,21 +19,21 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 250; - item.ranged = true; - item.width = 60; - item.height = 30; - item.useTime = 5; - item.useAnimation = 15; - item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 250; + Item.DamageType = DamageClass.Ranged; + Item.width = 60; + Item.height = 30; + Item.useTime = 5; + Item.useAnimation = 15; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); @@ -53,11 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/BlossomFlux.cs b/Items/Weapons/Ranged/BlossomFlux.cs index 5b1e038464..f038889a2e 100644 --- a/Items/Weapons/Ranged/BlossomFlux.cs +++ b/Items/Weapons/Ranged/BlossomFlux.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 20; - item.ranged = true; - item.width = 38; - item.height = 68; - item.useTime = 4; - item.useAnimation = 16; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 0.15f; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.useAmmo = AmmoID.Arrow; + Item.damage = 20; + Item.DamageType = DamageClass.Ranged; + Item.width = 38; + Item.height = 68; + Item.useTime = 4; + Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 0.15f; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.useAmmo = AmmoID.Arrow; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.Calamity().canFirePointBlankShots = true; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.Calamity().canFirePointBlankShots = true; } public override bool AltFunctionUse(Player player) @@ -46,15 +46,15 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - item.useTime = 25; - item.useAnimation = 25; - item.UseSound = SoundID.Item77; + Item.useTime = 25; + Item.useAnimation = 25; + Item.UseSound = SoundID.Item77; } else { - item.useTime = 2; - item.useAnimation = 16; - item.UseSound = SoundID.Item5; + Item.useTime = 2; + Item.useAnimation = 16; + Item.UseSound = SoundID.Item5; } return base.CanUseItem(player); } diff --git a/Items/Weapons/Ranged/BrimstoneFlameblaster.cs b/Items/Weapons/Ranged/BrimstoneFlameblaster.cs index bcd5d9e084..e4f49ed3e6 100644 --- a/Items/Weapons/Ranged/BrimstoneFlameblaster.cs +++ b/Items/Weapons/Ranged/BrimstoneFlameblaster.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 64; - item.ranged = true; - item.width = 50; - item.height = 18; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.useAmmo = AmmoID.Gel; + Item.damage = 64; + Item.DamageType = DamageClass.Ranged; + Item.width = 50; + Item.height = 18; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.UseSound = SoundID.Item34; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/BrimstoneFlamesprayer.cs b/Items/Weapons/Ranged/BrimstoneFlamesprayer.cs index 18471e68b8..85f2503edd 100644 --- a/Items/Weapons/Ranged/BrimstoneFlamesprayer.cs +++ b/Items/Weapons/Ranged/BrimstoneFlamesprayer.cs @@ -15,22 +15,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 59; - item.ranged = true; - item.width = 50; - item.height = 18; - item.useTime = 9; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.5f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8.5f; - item.useAmmo = AmmoID.Gel; + Item.damage = 59; + Item.DamageType = DamageClass.Ranged; + Item.width = 50; + Item.height = 18; + Item.useTime = 9; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.UseSound = SoundID.Item34; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8.5f; + Item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/BrimstoneFury.cs b/Items/Weapons/Ranged/BrimstoneFury.cs index 161d4b374e..bcec442883 100644 --- a/Items/Weapons/Ranged/BrimstoneFury.cs +++ b/Items/Weapons/Ranged/BrimstoneFury.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 39; - item.ranged = true; - item.width = 30; - item.height = 58; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.75f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 39; + Item.DamageType = DamageClass.Ranged; + Item.width = 30; + Item.height = 58; + Item.useTime = 22; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.75f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -57,11 +57,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/BulletFilledShotgun.cs b/Items/Weapons/Ranged/BulletFilledShotgun.cs index 5a830f4168..2d7ee0721e 100644 --- a/Items/Weapons/Ranged/BulletFilledShotgun.cs +++ b/Items/Weapons/Ranged/BulletFilledShotgun.cs @@ -18,36 +18,36 @@ namespace CalamityMod.Items.Weapons.Ranged } public override void SetDefaults() { - item.damage = 1; - item.knockBack = 0f; - item.useTime = item.useAnimation = 45; - item.ranged = true; - item.noMelee = true; - item.autoReuse = true; - item.useAmmo = AmmoID.Bullet; - item.shootSpeed = 9f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 1; + Item.knockBack = 0f; + Item.useTime = Item.useAnimation = 45; + Item.DamageType = DamageClass.Ranged; + Item.noMelee = true; + Item.autoReuse = true; + Item.useAmmo = AmmoID.Bullet; + Item.shootSpeed = 9f; + Item.shoot = ModContent.ProjectileType(); - item.width = 64; - item.height = 24; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item38; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.Calamity().donorItem = true; - item.Calamity().canFirePointBlankShots = true; + Item.width = 64; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item38; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.Calamity().donorItem = true; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-7, 0); - public override bool CanUseItem(Player player) => CalamityGlobalItem.HasEnoughAmmo(player, item, 5); + public override bool CanUseItem(Player player) => CalamityGlobalItem.HasEnoughAmmo(player, Item, 5); // Disable vanilla ammo consumption public override bool ConsumeAmmo(Player player) => false; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - type = item.shoot; + type = Item.shoot; int bulletAmt = Main.rand.Next(25,35); for (int i = 0; i < bulletAmt; i++) { @@ -57,20 +57,13 @@ namespace CalamityMod.Items.Weapons.Ranged } // Consume 5 ammo per shot - CalamityGlobalItem.ConsumeAdditionalAmmo(player, item, 5); + CalamityGlobalItem.ConsumeAdditionalAmmo(player, Item, 5); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 100); - recipe.AddIngredient(ItemID.IronBar, 7); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.MusketBall, 100).AddIngredient(ItemID.IronBar, 7).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/Butcher.cs b/Items/Weapons/Ranged/Butcher.cs index 9605ef6973..10406aea23 100644 --- a/Items/Weapons/Ranged/Butcher.cs +++ b/Items/Weapons/Ranged/Butcher.cs @@ -17,28 +17,28 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 18; - item.width = 20; - item.height = 12; - item.useTime = 40; - item.useAnimation = 40; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 1f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item38; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 18; + Item.width = 20; + Item.height = 12; + Item.useTime = 40; + Item.useAnimation = 40; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 1f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item38; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Ranged; + Item.channel = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -48,14 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Shotgun); - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddRecipeGroup("AnyCobaltBar", 5); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Shotgun).AddIngredient(ItemID.IllegalGunParts).AddRecipeGroup("AnyCobaltBar", 5).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/ChargedDartRifle.cs b/Items/Weapons/Ranged/ChargedDartRifle.cs index df66c54b21..ab055f7096 100644 --- a/Items/Weapons/Ranged/ChargedDartRifle.cs +++ b/Items/Weapons/Ranged/ChargedDartRifle.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 100; - item.ranged = true; - item.width = 74; - item.height = 40; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.autoReuse = true; - item.shootSpeed = 22f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Dart; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 100; + Item.DamageType = DamageClass.Ranged; + Item.width = 74; + Item.height = 40; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + Item.autoReuse = true; + Item.shootSpeed = 22f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Dart; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -70,22 +70,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DartRifle); - recipe.AddIngredient(ItemID.MartianConduitPlating, 25); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.FragmentVortex, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DartPistol); - recipe.AddIngredient(ItemID.MartianConduitPlating, 25); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.FragmentVortex, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.DartRifle).AddIngredient(ItemID.MartianConduitPlating, 25).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.FragmentVortex, 5).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1).AddIngredient(ItemID.DartPistol).AddIngredient(ItemID.MartianConduitPlating, 25).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.FragmentVortex, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/ChickenCannon.cs b/Items/Weapons/Ranged/ChickenCannon.cs index 6b400dc45b..ab1ecaa356 100644 --- a/Items/Weapons/Ranged/ChickenCannon.cs +++ b/Items/Weapons/Ranged/ChickenCannon.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -17,29 +18,29 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 416; - item.ranged = true; - item.width = 126; - item.height = 42; - item.useTime = item.useAnimation = 33; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.damage = 416; + Item.DamageType = DamageClass.Ranged; + Item.width = 126; + Item.height = 42; + Item.useTime = Item.useAnimation = 33; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; // No use sound is intentional - item.autoReuse = true; - item.shootSpeed = 14.5f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Rocket; - item.channel = true; + Item.autoReuse = true; + Item.shootSpeed = 14.5f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Rocket; + Item.channel = true; } public override void HoldItem(Player player) { - item.channel = player.altFunctionUse != 2; - item.noUseGraphic = player.altFunctionUse != 2; + Item.channel = player.altFunctionUse != 2; + Item.noUseGraphic = player.altFunctionUse != 2; } public override Vector2? HoldoutOffset() => new Vector2(-20, 0); @@ -56,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Ranged // Play a sound and detonate all in-flight rockets, but don't shoot anything. if (player.altFunctionUse == 2) { - Main.PlaySound(SoundID.Item110, position); + SoundEngine.PlaySound(SoundID.Item110, position); DetonateRockets(player); return false; } @@ -73,7 +74,7 @@ namespace CalamityMod.Items.Weapons.Ranged for (int i = 0; i < Main.maxProjectiles; ++i) { Projectile p = Main.projectile[i]; - if (!p.active || p.owner != player.whoAmI || p.type != item.shoot) + if (!p.active || p.owner != player.whoAmI || p.type != Item.shoot) continue; // All rockets will instantly explode on the next frame and send packets to indicate as such. diff --git a/Items/Weapons/Ranged/ClamorRifle.cs b/Items/Weapons/Ranged/ClamorRifle.cs index 2d9bde56c1..7c8b4ac1da 100644 --- a/Items/Weapons/Ranged/ClamorRifle.cs +++ b/Items/Weapons/Ranged/ClamorRifle.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 23; - item.ranged = true; - item.width = 64; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); - item.autoReuse = true; - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 23; + Item.DamageType = DamageClass.Ranged; + Item.width = 64; + Item.height = 30; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.5f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); + Item.autoReuse = true; + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); diff --git a/Items/Weapons/Ranged/ClaretCannon.cs b/Items/Weapons/Ranged/ClaretCannon.cs index 3e657a1138..a181a1a7d7 100644 --- a/Items/Weapons/Ranged/ClaretCannon.cs +++ b/Items/Weapons/Ranged/ClaretCannon.cs @@ -18,36 +18,32 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 140; - item.ranged = true; - item.width = 48; - item.height = 30; - item.useTime = 3; - item.reuseDelay = 10; - item.useAnimation = 9; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item40; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 140; + Item.DamageType = DamageClass.Ranged; + Item.width = 48; + Item.height = 30; + Item.useTime = 3; + Item.reuseDelay = 10; + Item.useAnimation = 9; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.Item40; + Item.autoReuse = true; + Item.shootSpeed = 24f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.LunarCraftingStation).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/CleansingBlaze.cs b/Items/Weapons/Ranged/CleansingBlaze.cs index 3eef254804..86cb376a69 100644 --- a/Items/Weapons/Ranged/CleansingBlaze.cs +++ b/Items/Weapons/Ranged/CleansingBlaze.cs @@ -19,28 +19,28 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 130; - item.ranged = true; - item.width = 64; - item.height = 32; - item.useTime = 3; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; - item.useAmmo = AmmoID.Gel; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.damage = 130; + Item.DamageType = DamageClass.Ranged; + Item.width = 64; + Item.height = 32; + Item.useTime = 3; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item34; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.useAmmo = AmmoID.Gel; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow")); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -69,11 +69,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/ClockGatlignum.cs b/Items/Weapons/Ranged/ClockGatlignum.cs index ca7cf124a4..c7d7799166 100644 --- a/Items/Weapons/Ranged/ClockGatlignum.cs +++ b/Items/Weapons/Ranged/ClockGatlignum.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 55; - item.ranged = true; - item.width = 66; - item.height = 34; - item.useTime = 3; - item.reuseDelay = 12; - item.useAnimation = 9; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.75f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 20f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 55; + Item.DamageType = DamageClass.Ranged; + Item.width = 66; + Item.height = 34; + Item.useTime = 3; + Item.reuseDelay = 12; + Item.useAnimation = 9; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.75f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item31; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 20f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); @@ -61,15 +61,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Gatligator); - recipe.AddIngredient(ItemID.VenusMagnum); - recipe.AddIngredient(ItemID.ClockworkAssaultRifle); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Gatligator).AddIngredient(ItemID.VenusMagnum).AddIngredient(ItemID.ClockworkAssaultRifle).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.Ectoplasm, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/ClockworkBow.cs b/Items/Weapons/Ranged/ClockworkBow.cs index c004344a71..38d8acf0bd 100644 --- a/Items/Weapons/Ranged/ClockworkBow.cs +++ b/Items/Weapons/Ranged/ClockworkBow.cs @@ -18,34 +18,29 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 808; - item.ranged = true; - item.width = 48; - item.height = 96; - item.useTime = 60; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.channel = true; - item.knockBack = 4.25f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.noUseGraphic = true; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 15f; - item.useAmmo = AmmoID.Arrow; + Item.damage = 808; + Item.DamageType = DamageClass.Ranged; + Item.width = 48; + Item.height = 96; + Item.useTime = 60; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.channel = true; + Item.knockBack = 4.25f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.noUseGraphic = true; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 15f; + Item.useAmmo = AmmoID.Arrow; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ItemID.Cog, 50); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LunarBar, 5).AddIngredient(ItemID.Cog, 50).AddTile(TileID.LunarCraftingStation).Register(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; diff --git a/Items/Weapons/Ranged/Condemnation.cs b/Items/Weapons/Ranged/Condemnation.cs index 1fa7699a38..2951e9cabb 100644 --- a/Items/Weapons/Ranged/Condemnation.cs +++ b/Items/Weapons/Ranged/Condemnation.cs @@ -20,23 +20,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 1914; - item.ranged = true; - item.width = 130; - item.height = 42; - item.useTime = item.useAnimation = 23; - item.useStyle = ItemUseStyleID.HoldingOut; - item.channel = true; - item.noMelee = true; - item.knockBack = 5f; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14.5f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 1914; + Item.DamageType = DamageClass.Ranged; + Item.width = 130; + Item.height = 42; + Item.useTime = Item.useAnimation = 23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.channel = true; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14.5f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-50f, 0f); @@ -50,11 +50,11 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.Calamity().mouseRight && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) { - item.noUseGraphic = false; + Item.noUseGraphic = false; } else { - item.noUseGraphic = true; + Item.noUseGraphic = true; } } @@ -71,7 +71,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.Calamity().mouseRight) { Vector2 tipPosition = position + shootDirection * 110f; - Projectile.NewProjectile(tipPosition, shootVelocity, item.shoot, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(tipPosition, shootVelocity, Item.shoot, damage, knockBack, player.whoAmI); } // Charge-up. Done via a holdout projectile. diff --git a/Items/Weapons/Ranged/Contagion.cs b/Items/Weapons/Ranged/Contagion.cs index 8c2c809f2f..a32972169c 100644 --- a/Items/Weapons/Ranged/Contagion.cs +++ b/Items/Weapons/Ranged/Contagion.cs @@ -18,39 +18,33 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 880; - item.ranged = true; - item.width = 22; - item.height = 50; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 5f; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.useAmmo = AmmoID.Arrow; + Item.damage = 880; + Item.DamageType = DamageClass.Ranged; + Item.width = 22; + Item.height = 50; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.knockBack = 5f; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.useAmmo = AmmoID.Arrow; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; - item.Calamity().canFirePointBlankShots = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; + Item.Calamity().canFirePointBlankShots = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/CoralCannon.cs b/Items/Weapons/Ranged/CoralCannon.cs index 9b29516543..8136c97371 100644 --- a/Items/Weapons/Ranged/CoralCannon.cs +++ b/Items/Weapons/Ranged/CoralCannon.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 20; - item.ranged = true; - item.width = 52; - item.height = 40; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item61; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 20; + Item.DamageType = DamageClass.Ranged; + Item.width = 52; + Item.height = 40; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7.5f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item61; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Ranged/CorrodedCaustibow.cs b/Items/Weapons/Ranged/CorrodedCaustibow.cs index cd7d1ec356..7c7fc16ca7 100644 --- a/Items/Weapons/Ranged/CorrodedCaustibow.cs +++ b/Items/Weapons/Ranged/CorrodedCaustibow.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 88; - item.ranged = true; - item.width = 30; - item.height = 38; - item.useTime = 45; - item.useAnimation = 45; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 88; + Item.DamageType = DamageClass.Ranged; + Item.width = 30; + Item.height = 38; + Item.useTime = 45; + Item.useAnimation = 45; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -51,13 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddTile(TileID.Anvils); - r.SetResult(this); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/CosmicBolter.cs b/Items/Weapons/Ranged/CosmicBolter.cs index aa6d48c325..19d9d3379e 100644 --- a/Items/Weapons/Ranged/CosmicBolter.cs +++ b/Items/Weapons/Ranged/CosmicBolter.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 39; - item.ranged = true; - item.width = 40; - item.height = 76; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.75f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item75; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 39; + Item.DamageType = DamageClass.Ranged; + Item.width = 40; + Item.height = 76; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.75f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item75; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -66,14 +66,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.HallowedBar, 5); - recipe.AddIngredient(ItemID.SoulofSight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.HallowedBar, 5).AddIngredient(ItemID.SoulofSight, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/CursedCapper.cs b/Items/Weapons/Ranged/CursedCapper.cs index 84e64132a4..351858cf48 100644 --- a/Items/Weapons/Ranged/CursedCapper.cs +++ b/Items/Weapons/Ranged/CursedCapper.cs @@ -15,23 +15,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 35; - item.ranged = true; - item.width = 52; - item.height = 32; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shootSpeed = 14f; - item.shoot = ProjectileID.CursedBullet; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 35; + Item.DamageType = DamageClass.Ranged; + Item.width = 52; + Item.height = 32; + Item.useTime = 10; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item41; + Item.autoReuse = true; + Item.shootSpeed = 14f; + Item.shoot = ProjectileID.CursedBullet; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -42,12 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PhoenixBlaster); - recipe.AddIngredient(ItemID.CursedFlame, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.PhoenixBlaster).AddIngredient(ItemID.CursedFlame, 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/DaemonsFlame.cs b/Items/Weapons/Ranged/DaemonsFlame.cs index cfea8adc69..6295dc2964 100644 --- a/Items/Weapons/Ranged/DaemonsFlame.cs +++ b/Items/Weapons/Ranged/DaemonsFlame.cs @@ -17,33 +17,33 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 135; - item.width = 62; - item.height = 128; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 4f; - item.UseSound = SoundID.Item5; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.useAmmo = AmmoID.Arrow; + Item.damage = 135; + Item.width = 62; + Item.height = 128; + Item.useTime = 12; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item5; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Ranged; + Item.channel = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.useAmmo = AmmoID.Arrow; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.Calamity().canFirePointBlankShots = true; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.Calamity().canFirePointBlankShots = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/DaemonsFlameGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Ranged/DaemonsFlameGlow")); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/DarkechoGreatbow.cs b/Items/Weapons/Ranged/DarkechoGreatbow.cs index 9e3c7ce1c9..d753327f59 100644 --- a/Items/Weapons/Ranged/DarkechoGreatbow.cs +++ b/Items/Weapons/Ranged/DarkechoGreatbow.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 37; - item.ranged = true; - item.width = 34; - item.height = 62; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 37; + Item.DamageType = DamageClass.Ranged; + Item.width = 34; + Item.height = 62; + Item.useTime = 22; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -52,11 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/Deathwind.cs b/Items/Weapons/Ranged/Deathwind.cs index b3239f7dc7..fb1b95342c 100644 --- a/Items/Weapons/Ranged/Deathwind.cs +++ b/Items/Weapons/Ranged/Deathwind.cs @@ -18,29 +18,29 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 248; - item.ranged = true; - item.width = 40; - item.height = 82; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 248; + Item.DamageType = DamageClass.Ranged; + Item.width = 40; + Item.height = 82; + Item.useTime = 14; + Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/DeathwindGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Ranged/DeathwindGlow")); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/DodusHandcannon.cs b/Items/Weapons/Ranged/DodusHandcannon.cs index c8f9cbed03..c5c31e115a 100644 --- a/Items/Weapons/Ranged/DodusHandcannon.cs +++ b/Items/Weapons/Ranged/DodusHandcannon.cs @@ -18,34 +18,34 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.width = 62; - item.height = 34; - item.damage = 857; - item.ranged = true; - item.useTime = 30; - item.useAnimation = 30; - item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6f; + Item.width = 62; + Item.height = 34; + Item.damage = 857; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 30; + Item.useAnimation = 30; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6f; // Reduce volume to 30% so it stops destroying people's ears. - var sound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); - item.UseSound = sound?.WithVolume(0.3f); + var sound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); + Item.UseSound = sound?.WithVolume(0.3f); - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; - item.useAmmo = AmmoID.Bullet; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13f; + Item.useAmmo = AmmoID.Bullet; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.Calamity().donorItem = true; - item.Calamity().canFirePointBlankShots = true; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.Calamity().donorItem = true; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - type = item.shoot; + type = Item.shoot; return true; } @@ -53,13 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 15).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/DragonsBreath.cs b/Items/Weapons/Ranged/DragonsBreath.cs index d97854384d..a1cb90e5c2 100644 --- a/Items/Weapons/Ranged/DragonsBreath.cs +++ b/Items/Weapons/Ranged/DragonsBreath.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -28,27 +29,27 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 198; - item.ranged = true; - item.width = 124; - item.height = 78; + Item.damage = 198; + Item.DamageType = DamageClass.Ranged; + Item.width = 124; + Item.height = 78; - item.useTime = 9; - item.useAnimation = 18; - item.reuseDelay = BetweenShotsPause; - item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; + Item.useTime = 9; + Item.useAnimation = 18; + Item.reuseDelay = BetweenShotsPause; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Shoot; - item.noMelee = true; - item.knockBack = 6.5f; + Item.noMelee = true; + Item.knockBack = 6.5f; // item.UseSound = SoundID.Item38; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; } public override bool ConsumeAmmo(Player player) => Main.rand.NextFloat() > 0.66f; @@ -58,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool CanUseItem(Player player) { - item.reuseDelay = player.altFunctionUse == 2 ? 0 : BetweenShotsPause; + Item.reuseDelay = player.altFunctionUse == 2 ? 0 : BetweenShotsPause; return base.CanUseItem(player); } @@ -66,7 +67,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Main.PlaySound(SoundID.Item38, position); + SoundEngine.PlaySound(SoundID.Item38, position); bool doDust = false; Vector2 vel = new Vector2(speedX, speedY); int[] bulletIDs = new int[PelletsPerShot]; @@ -83,9 +84,9 @@ namespace CalamityMod.Items.Weapons.Ranged while (dragonsBreathAdded < PelletsPerShot / 2) { int i = Main.rand.Next(PelletsPerShot); - if (bulletIDs[i] == item.shoot) + if (bulletIDs[i] == Item.shoot) continue; - bulletIDs[i] = item.shoot; + bulletIDs[i] = Item.shoot; ++dragonsBreathAdded; } @@ -100,9 +101,9 @@ namespace CalamityMod.Items.Weapons.Ranged // Left click second shot: Six Dragon's Breath Rounds, very low spread. Extra sound and dust blast. else { - Main.PlaySound(SoundID.Item74, position); + SoundEngine.PlaySound(SoundID.Item74, position); for (int i = 0; i < PelletsPerShot; ++i) - bulletIDs[i] = item.shoot; + bulletIDs[i] = Item.shoot; spreadFactor = 0.5f; doDust = true; @@ -124,7 +125,7 @@ namespace CalamityMod.Items.Weapons.Ranged private void SpawnDragonsBreathDust(Vector2 pos, Vector2 velocity) { - pos += velocity.SafeNormalize(Vector2.Zero) * item.width * item.scale * 0.71f; + pos += velocity.SafeNormalize(Vector2.Zero) * Item.width * Item.scale * 0.71f; for (int i = 0; i < 30; ++i) { // Pick a random type of smoke (there's a little fire mixed in) diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index cc4148c454..406a4be7b6 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -24,27 +24,27 @@ Right click to fire two devastating barrages of five empowered fireballs. public override void SetDefaults() { - item.damage = 129; - item.knockBack = 1f; - item.shootSpeed = 18f; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useAnimation = 24; - item.useTime = 12; - item.reuseDelay = 48; - item.width = 64; - item.height = 84; - item.UseSound = SoundID.Item5; - item.shoot = ModContent.ProjectileType(); - item.value = Item.buyPrice(platinum: 2, gold: 50); - item.rare = ItemRarityID.Red; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.useTurn = false; - item.useAmmo = AmmoID.Arrow; - item.autoReuse = true; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.damage = 129; + Item.knockBack = 1f; + Item.shootSpeed = 18f; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useAnimation = 24; + Item.useTime = 12; + Item.reuseDelay = 48; + Item.width = 64; + Item.height = 84; + Item.UseSound = SoundID.Item5; + Item.shoot = ModContent.ProjectileType(); + Item.value = Item.buyPrice(platinum: 2, gold: 50); + Item.rare = ItemRarityID.Red; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Ranged; + Item.channel = true; + Item.useTurn = false; + Item.useAmmo = AmmoID.Arrow; + Item.autoReuse = true; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool AltFunctionUse(Player player) @@ -56,12 +56,12 @@ Right click to fire two devastating barrages of five empowered fireballs. { if (player.altFunctionUse == 2) { - item.noUseGraphic = false; + Item.noUseGraphic = false; } else { - item.noUseGraphic = true; - if (player.ownedProjectileCounts[item.shoot] > 0) + Item.noUseGraphic = true; + if (player.ownedProjectileCounts[Item.shoot] > 0) { return false; } @@ -103,14 +103,7 @@ Right click to fire two devastating barrages of five empowered fireballs. public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/Dualpoon.cs b/Items/Weapons/Ranged/Dualpoon.cs index db956b26ce..a2c9f0ded3 100644 --- a/Items/Weapons/Ranged/Dualpoon.cs +++ b/Items/Weapons/Ranged/Dualpoon.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 70; - item.ranged = true; - item.width = 56; - item.height = 28; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item10; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = ModContent.ProjectileType(); - item.Calamity().canFirePointBlankShots = true; + Item.damage = 70; + Item.DamageType = DamageClass.Ranged; + Item.width = 56; + Item.height = 28; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6.5f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item10; + Item.autoReuse = true; + Item.shootSpeed = 20f; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -64,13 +64,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Harpoon, 2); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.SoulofMight, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Harpoon, 2).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.SoulofMight, 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/EffluviumBow.cs b/Items/Weapons/Ranged/EffluviumBow.cs index c43d39581b..a7aacb47bb 100644 --- a/Items/Weapons/Ranged/EffluviumBow.cs +++ b/Items/Weapons/Ranged/EffluviumBow.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 56; - item.ranged = true; - item.width = 26; - item.height = 70; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 56; + Item.DamageType = DamageClass.Ranged; + Item.width = 26; + Item.height = 70; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/ElementalBlaster.cs b/Items/Weapons/Ranged/ElementalBlaster.cs index e72e79d38d..a8403fc083 100644 --- a/Items/Weapons/Ranged/ElementalBlaster.cs +++ b/Items/Weapons/Ranged/ElementalBlaster.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 50; - item.ranged = true; - item.width = 104; - item.height = 42; - item.useTime = 2; - item.useAnimation = 6; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.75f; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; + Item.damage = 50; + Item.DamageType = DamageClass.Ranged; + Item.width = 104; + Item.height = 42; + Item.useTime = 2; + Item.useAnimation = 6; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.75f; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; } public override Vector2? HoldoutOffset() @@ -41,15 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/ElementalEruption.cs b/Items/Weapons/Ranged/ElementalEruption.cs index 42032e469b..62d6ede0d7 100644 --- a/Items/Weapons/Ranged/ElementalEruption.cs +++ b/Items/Weapons/Ranged/ElementalEruption.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 77; - item.ranged = true; - item.width = 64; - item.height = 34; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item34; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.useAmmo = AmmoID.Gel; + Item.damage = 77; + Item.DamageType = DamageClass.Ranged; + Item.width = 64; + Item.height = 34; + Item.useTime = 14; + Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.UseSound = SoundID.Item34; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -54,16 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/EternalBlizzard.cs b/Items/Weapons/Ranged/EternalBlizzard.cs index f8f6608d70..fb7c1def01 100644 --- a/Items/Weapons/Ranged/EternalBlizzard.cs +++ b/Items/Weapons/Ranged/EternalBlizzard.cs @@ -15,24 +15,24 @@ namespace CalamityMod.Items.Weapons.Ranged } public override void SetDefaults() { - item.damage = 80; - item.ranged = true; - item.width = 38; - item.height = 62; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.useAmmo = AmmoID.Arrow; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11f; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 80; + Item.DamageType = DamageClass.Ranged; + Item.width = 38; + Item.height = 62; + Item.useTime = 18; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTurn = false; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.useAmmo = AmmoID.Arrow; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/Eviscerator.cs b/Items/Weapons/Ranged/Eviscerator.cs index 8f0bafdeca..7b23b2a433 100644 --- a/Items/Weapons/Ranged/Eviscerator.cs +++ b/Items/Weapons/Ranged/Eviscerator.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 65; - item.ranged = true; - item.width = 58; - item.height = 22; - item.useTime = 60; - item.useAnimation = 60; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item40; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 22f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 65; + Item.DamageType = DamageClass.Ranged; + Item.width = 58; + Item.height = 22; + Item.useTime = 60; + Item.useAnimation = 60; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7.5f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item40; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 22f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -53,13 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.Vertebrae, 4); - recipe.AddIngredient(ItemID.CrimtaneBar, 4); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.Vertebrae, 4).AddIngredient(ItemID.CrimtaneBar, 4).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index 17152af4d3..d981f0320e 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -17,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 129; - item.ranged = true; - item.width = 76; - item.height = 46; - item.useTime = item.useAnimation = 6; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 16f; - item.useAmmo = AmmoID.Bullet; + Item.damage = 129; + Item.DamageType = DamageClass.Ranged; + Item.width = 76; + Item.height = 46; + Item.useTime = Item.useAnimation = 6; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 16f; + Item.useAmmo = AmmoID.Bullet; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.Calamity().canFirePointBlankShots = true; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.Calamity().canFirePointBlankShots = true; } public override bool ConsumeAmmo(Player player) => Main.rand.Next(100) > 40; @@ -55,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.Calamity().soundCooldown <= 0) { // WoF vomit sound. - Main.PlaySound(SoundID.NPCKilled, (int)position.X, (int)position.Y, 13, 0.5f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)position.X, (int)position.Y, 13, 0.5f, 0f); player.Calamity().soundCooldown = 120; } return false; diff --git a/Items/Weapons/Ranged/FirestormCannon.cs b/Items/Weapons/Ranged/FirestormCannon.cs index 64356fd6e5..a0ced23e3b 100644 --- a/Items/Weapons/Ranged/FirestormCannon.cs +++ b/Items/Weapons/Ranged/FirestormCannon.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 9; - item.ranged = true; - item.width = 56; - item.height = 28; - item.useTime = 9; - item.useAnimation = 9; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = ProjectileID.Flare; - item.shootSpeed = 5.5f; - item.useAmmo = AmmoID.Flare; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 9; + Item.DamageType = DamageClass.Ranged; + Item.width = 56; + Item.height = 28; + Item.useTime = 9; + Item.useAnimation = 9; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shoot = ProjectileID.Flare; + Item.shootSpeed = 5.5f; + Item.useAmmo = AmmoID.Flare; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -89,14 +89,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FlareGun); - recipe.AddIngredient(ItemID.Boomstick); - recipe.AddRecipeGroup("AnyGoldBar", 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.FlareGun).AddIngredient(ItemID.Boomstick).AddRecipeGroup("AnyGoldBar", 10).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/FlakKraken.cs b/Items/Weapons/Ranged/FlakKraken.cs index 742e214d34..cc6a28f458 100644 --- a/Items/Weapons/Ranged/FlakKraken.cs +++ b/Items/Weapons/Ranged/FlakKraken.cs @@ -18,26 +18,26 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 54; - item.ranged = true; - item.width = 152; - item.height = 58; - item.useTime = 10; - item.useAnimation = 10; - item.reuseDelay = 5; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 0f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 30f; //30 + Item.damage = 54; + Item.DamageType = DamageClass.Ranged; + Item.width = 152; + Item.height = 58; + Item.useTime = 10; + Item.useAnimation = 10; + Item.reuseDelay = 5; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.knockBack = 0f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; //30 } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -47,14 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/FlakToxicannon.cs b/Items/Weapons/Ranged/FlakToxicannon.cs index 782f56d146..d4d137262e 100644 --- a/Items/Weapons/Ranged/FlakToxicannon.cs +++ b/Items/Weapons/Ranged/FlakToxicannon.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Items.Weapons.Ranged } public override void SetDefaults() { - item.damage = 50; - item.ranged = true; - item.width = 88; - item.height = 28; - item.useTime = item.useAnimation = 16; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + Item.damage = 50; + Item.DamageType = DamageClass.Ranged; + Item.width = 88; + Item.height = 28; + Item.useTime = Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTurn = false; + Item.noMelee = true; + Item.knockBack = 7f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item109; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Ranged/FlarewingBow.cs b/Items/Weapons/Ranged/FlarewingBow.cs index b25c06b9cb..9f25583d28 100644 --- a/Items/Weapons/Ranged/FlarewingBow.cs +++ b/Items/Weapons/Ranged/FlarewingBow.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 17; - item.ranged = true; - item.width = 40; - item.height = 72; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.WoodenArrowFriendly; - item.shootSpeed = 16f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 17; + Item.DamageType = DamageClass.Ranged; + Item.width = 40; + Item.height = 72; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.WoodenArrowFriendly; + Item.shootSpeed = 16f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -70,14 +70,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellwingBow); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LivingFireBlock, 50); - recipe.AddIngredient(ItemID.Obsidian, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HellwingBow).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LivingFireBlock, 50).AddIngredient(ItemID.Obsidian, 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/FlurrystormCannon.cs b/Items/Weapons/Ranged/FlurrystormCannon.cs index 8855cf8230..0f90274efa 100644 --- a/Items/Weapons/Ranged/FlurrystormCannon.cs +++ b/Items/Weapons/Ranged/FlurrystormCannon.cs @@ -19,31 +19,31 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 12; - item.width = 68; - item.height = 38; - item.useTime = 8; - item.useAnimation = 8; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 1.2f; + Item.damage = 12; + Item.width = 68; + Item.height = 38; + Item.useTime = 8; + Item.useAnimation = 8; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 1.2f; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.Calamity().donorItem = true; - item.UseSound = SoundID.Item11; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Snowball; - item.shootSpeed = 18f; - item.Calamity().canFirePointBlankShots = true; + Item.UseSound = SoundID.Item11; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Ranged; + Item.channel = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Snowball; + Item.shootSpeed = 18f; + Item.Calamity().canFirePointBlankShots = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -60,16 +60,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SnowballCannon); - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.Bone, 50); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ItemID.WaterBucket, 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SnowballCannon).AddIngredient(ItemID.IllegalGunParts).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.Bone, 50).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ItemID.WaterBucket, 3).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/FrostbiteBlaster.cs b/Items/Weapons/Ranged/FrostbiteBlaster.cs index efebf4605a..99b0bc3c51 100644 --- a/Items/Weapons/Ranged/FrostbiteBlaster.cs +++ b/Items/Weapons/Ranged/FrostbiteBlaster.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -16,30 +17,30 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 55; - item.ranged = true; - item.width = 56; - item.height = 22; - item.useTime = 7; - item.useAnimation = 21; - item.reuseDelay = 54; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.useAmmo = AmmoID.Bullet; - item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shoot = ProjectileID.Blizzard; - item.shootSpeed = 9f; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 55; + Item.DamageType = DamageClass.Ranged; + Item.width = 56; + Item.height = 22; + Item.useTime = 7; + Item.useAnimation = 21; + Item.reuseDelay = 54; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTurn = false; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.useAmmo = AmmoID.Bullet; + Item.UseSound = SoundID.Item36; + Item.autoReuse = true; + Item.shoot = ProjectileID.Blizzard; + Item.shootSpeed = 9f; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Main.PlaySound(SoundID.Item36, position); + SoundEngine.PlaySound(SoundID.Item36, position); for (int i = 0; i < 2; i++) { float newSpeedX = speedX + Main.rand.Next(-40, 41) * 0.06f; @@ -48,8 +49,8 @@ namespace CalamityMod.Items.Weapons.Ranged if (type == ProjectileID.Bullet) { int p = Projectile.NewProjectile(position.X, position.Y, newSpeedX, newSpeedY, ProjectileID.Blizzard, damage, knockBack, player.whoAmI); - Main.projectile[p].magic = false; - Main.projectile[p].ranged = true; + // Main.projectile[p].magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + Main.projectile[p].DamageType = DamageClass.Ranged; } else Projectile.NewProjectile(position.X, position.Y, newSpeedX, newSpeedY, type, damage, knockBack, player.whoAmI); diff --git a/Items/Weapons/Ranged/Fungicide.cs b/Items/Weapons/Ranged/Fungicide.cs index eedb13dc08..b8dd19628f 100644 --- a/Items/Weapons/Ranged/Fungicide.cs +++ b/Items/Weapons/Ranged/Fungicide.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 15; - item.ranged = true; - item.width = 40; - item.height = 26; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item61; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 15; + Item.DamageType = DamageClass.Ranged; + Item.width = 40; + Item.height = 26; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.5f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item61; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Galeforce.cs b/Items/Weapons/Ranged/Galeforce.cs index d6ff788e0f..b61f766a27 100644 --- a/Items/Weapons/Ranged/Galeforce.cs +++ b/Items/Weapons/Ranged/Galeforce.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 18; - item.ranged = true; - item.width = 32; - item.height = 52; - item.useTime = 17; - item.useAnimation = 17; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.WoodenArrowFriendly; - item.shootSpeed = 20f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 18; + Item.DamageType = DamageClass.Ranged; + Item.width = 32; + Item.height = 52; + Item.useTime = 17; + Item.useAnimation = 17; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.WoodenArrowFriendly; + Item.shootSpeed = 20f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -48,12 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.SunplateBlock, 3); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.SunplateBlock, 3).AddTile(TileID.SkyMill).Register(); } } } diff --git a/Items/Weapons/Ranged/GoldenEagle.cs b/Items/Weapons/Ranged/GoldenEagle.cs index be25b628af..96e81be9df 100644 --- a/Items/Weapons/Ranged/GoldenEagle.cs +++ b/Items/Weapons/Ranged/GoldenEagle.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 85; - item.ranged = true; - item.noMelee = true; - item.width = 46; - item.height = 30; - item.useTime = 19; - item.useAnimation = 19; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 3f; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shoot = ProjectileID.Bullet; - item.shootSpeed = 20f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 85; + Item.DamageType = DamageClass.Ranged; + Item.noMelee = true; + Item.width = 46; + Item.height = 30; + Item.useTime = 19; + Item.useAnimation = 19; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 3f; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item41; + Item.autoReuse = true; + Item.shoot = ProjectileID.Bullet; + Item.shootSpeed = 20f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); diff --git a/Items/Weapons/Ranged/Goobow.cs b/Items/Weapons/Ranged/Goobow.cs index 5bcb0ed366..f0b456bc12 100644 --- a/Items/Weapons/Ranged/Goobow.cs +++ b/Items/Weapons/Ranged/Goobow.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 33; - item.ranged = true; - item.width = 30; - item.height = 50; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.WoodenArrowFriendly; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 33; + Item.DamageType = DamageClass.Ranged; + Item.width = 30; + Item.height = 50; + Item.useTime = 22; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.WoodenArrowFriendly; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -66,13 +66,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ItemID.Gel, 30); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ItemID.Gel, 30).AddIngredient(ItemID.HellstoneBar, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/GreatbowofTurmoil.cs b/Items/Weapons/Ranged/GreatbowofTurmoil.cs index 0135828382..1338e77f0b 100644 --- a/Items/Weapons/Ranged/GreatbowofTurmoil.cs +++ b/Items/Weapons/Ranged/GreatbowofTurmoil.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 34; - item.ranged = true; - item.width = 18; - item.height = 36; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.WoodenArrowFriendly; - item.shootSpeed = 17f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 34; + Item.DamageType = DamageClass.Ranged; + Item.width = 18; + Item.height = 36; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.WoodenArrowFriendly; + Item.shootSpeed = 17f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -81,11 +81,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/GunkShot.cs b/Items/Weapons/Ranged/GunkShot.cs index db3d417ea7..cf642224d1 100644 --- a/Items/Weapons/Ranged/GunkShot.cs +++ b/Items/Weapons/Ranged/GunkShot.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 30; - item.ranged = true; - item.width = 44; - item.height = 30; - item.useTime = 32; - item.useAnimation = 32; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 5f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 30; + Item.DamageType = DamageClass.Ranged; + Item.width = 44; + Item.height = 30; + Item.useTime = 32; + Item.useAnimation = 32; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item36; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 5f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -55,13 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ItemID.Gel, 15); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ItemID.Gel, 15).AddIngredient(ItemID.HellstoneBar, 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/HalibutCannon.cs b/Items/Weapons/Ranged/HalibutCannon.cs index e05478b1ad..6947016cc6 100644 --- a/Items/Weapons/Ranged/HalibutCannon.cs +++ b/Items/Weapons/Ranged/HalibutCannon.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -15,30 +16,30 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 50; - item.ranged = true; - item.width = 108; - item.height = 54; - item.useTime = 10; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.rare = ItemRarityID.Red; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(1, 0, 0, 0); - item.UseSound = null; - item.autoReuse = true; - item.shoot = ProjectileID.Bullet; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 50; + Item.DamageType = DamageClass.Ranged; + Item.width = 108; + Item.height = 54; + Item.useTime = 10; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.rare = ItemRarityID.Red; + Item.noMelee = true; + Item.knockBack = 1f; + Item.value = Item.buyPrice(1, 0, 0, 0); + Item.UseSound = null; + Item.autoReuse = true; + Item.shoot = ProjectileID.Bullet; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-15, 0); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Main.PlaySound(SoundID.Item38, (int)player.Center.X, (int)player.Center.Y); + SoundEngine.PlaySound(SoundID.Item38, (int)player.Center.X, (int)player.Center.Y); int bulletAmt = Main.rand.Next(25, 36); for (int index = 0; index < bulletAmt; ++index) diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index 588f7ca2b1..d419d88332 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -21,23 +21,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 1350; - item.knockBack = 5f; - item.ranged = true; - item.useTime = item.useAnimation = 30; - item.autoReuse = true; - item.useAmmo = AmmoID.Gel; - item.shootSpeed = 14.6f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 1350; + Item.knockBack = 5f; + Item.DamageType = DamageClass.Ranged; + Item.useTime = Item.useAnimation = 30; + Item.autoReuse = true; + Item.useAmmo = AmmoID.Gel; + Item.shootSpeed = 14.6f; + Item.shoot = ModContent.ProjectileType(); - item.width = 84; - item.height = 34; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 84; + Item.height = 34; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.UseSound = SoundID.Item34; + Item.value = Item.buyPrice(1, 40, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } // Terraria seems to really dislike high crit values in SetDefaults @@ -49,14 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SniperScope); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SniperScope).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/HandheldTank.cs b/Items/Weapons/Ranged/HandheldTank.cs index dd68a0ad2e..f5ef5ec967 100644 --- a/Items/Weapons/Ranged/HandheldTank.cs +++ b/Items/Weapons/Ranged/HandheldTank.cs @@ -16,26 +16,26 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.width = 110; - item.height = 46; - item.ranged = true; - item.damage = 940; - item.knockBack = 16f; - item.useTime = 71; - item.useAnimation = 71; - item.autoReuse = true; + Item.width = 110; + Item.height = 46; + Item.DamageType = DamageClass.Ranged; + Item.damage = 940; + Item.knockBack = 16f; + Item.useTime = 71; + Item.useAnimation = 71; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TankCannon"); - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TankCannon"); + Item.noMelee = true; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; - item.useAmmo = AmmoID.Rocket; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; + Item.useAmmo = AmmoID.Rocket; } // Terraria seems to really dislike high crit values in SetDefaults @@ -51,15 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ItemID.IronBar, 50); - r.anyIronBar = true; - r.AddIngredient(ModContent.ItemType(), 5); - r.AddIngredient(ItemID.TigerSkin); - r.AddTile(TileID.LunarCraftingStation); - r.SetResult(this); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.IronBar, 50).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.TigerSkin).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index 8b0be3da8a..3032c420b1 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -36,23 +36,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 198; - item.ranged = true; - item.width = 44; - item.height = 58; - item.useTime = 15; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.WoodenArrowFriendly; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 198; + Item.DamageType = DamageClass.Ranged; + Item.width = 44; + Item.height = 58; + Item.useTime = 15; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.WoodenArrowFriendly; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -103,17 +103,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddTile(TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemType()).AddIngredient(ItemType()).AddIngredient(ItemType()).AddIngredient(ItemType()).AddIngredient(ItemType()).AddIngredient(ItemType()).AddIngredient(ItemType()).AddTile(TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index 3149745025..ab0151ca9d 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -19,22 +20,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 7; - item.ranged = true; - item.width = 66; - item.height = 34; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 2f; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 7; + Item.DamageType = DamageClass.Ranged; + Item.width = 66; + Item.height = 34; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 2f; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override float UseTimeMultiplier(Player player) => 1f + (player.Calamity().hellbornBoost * (1f / 600f)); @@ -68,13 +69,13 @@ namespace CalamityMod.Items.Weapons.Ranged { player.Calamity().hellbornBoost = 600; damage *= 10; - player.ApplyDamageToNPC(target, (int)(item.damage * (player.allDamage + player.rangedDamage - 1f)), 0f, 0, false); + player.ApplyDamageToNPC(target, (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Ranged) - 1f)), 0f, 0, false); float num50 = 3.4f; float num51 = 1.6f; float num52 = 4f; Vector2 value3 = (target.rotation - MathHelper.PiOver2).ToRotationVector2(); Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.position); for (int num53 = 0; num53 < 80; num53++) { int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 200, default, num50); diff --git a/Items/Weapons/Ranged/Helstorm.cs b/Items/Weapons/Ranged/Helstorm.cs index 716f28811b..e2e2917122 100644 --- a/Items/Weapons/Ranged/Helstorm.cs +++ b/Items/Weapons/Ranged/Helstorm.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 31; - item.ranged = true; - item.width = 50; - item.height = 24; - item.useTime = 7; - item.useAnimation = 7; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 11.5f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 31; + Item.DamageType = DamageClass.Ranged; + Item.width = 50; + Item.height = 24; + Item.useTime = 7; + Item.useAnimation = 7; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 2.5f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 11.5f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -53,11 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.MythrilAnvil).Register(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Ranged/Impaler.cs b/Items/Weapons/Ranged/Impaler.cs index 07d8a7d995..ebb34ff4cd 100644 --- a/Items/Weapons/Ranged/Impaler.cs +++ b/Items/Weapons/Ranged/Impaler.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 120; - item.ranged = true; - item.width = 40; - item.height = 26; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.useAmmo = AmmoID.Stake; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 120; + Item.DamageType = DamageClass.Ranged; + Item.width = 40; + Item.height = 26; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.useAmmo = AmmoID.Stake; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -59,14 +59,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.StakeLauncher); - recipe.AddIngredient(ItemID.ExplosivePowder, 100); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LivingFireBlock, 75); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.StakeLauncher).AddIngredient(ItemID.ExplosivePowder, 100).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LivingFireBlock, 75).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index d4e3267c6f..353c21516c 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -22,25 +22,25 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 45; - item.ranged = true; - item.width = 56; - item.height = 24; - item.useTime = 2; - item.reuseDelay = 6; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 45; + Item.DamageType = DamageClass.Ranged; + Item.width = 56; + Item.height = 24; + Item.useTime = 2; + Item.reuseDelay = 6; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1f; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.UseSound = SoundID.Item31; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -114,12 +114,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/Interfacer.cs b/Items/Weapons/Ranged/Interfacer.cs index 95ee1a73c1..fb5459cd1e 100644 --- a/Items/Weapons/Ranged/Interfacer.cs +++ b/Items/Weapons/Ranged/Interfacer.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 52; - item.ranged = true; - item.width = 66; - item.height = 24; - item.useTime = 23; - item.useAnimation = 23; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4.5f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item38; - item.autoReuse = true; - item.shootSpeed = 13f; - item.shoot = ProjectileID.PurificationPowder; - item.useAmmo = AmmoID.Bullet; + Item.damage = 52; + Item.DamageType = DamageClass.Ranged; + Item.width = 66; + Item.height = 24; + Item.useTime = 23; + Item.useAnimation = 23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4.5f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item38; + Item.autoReuse = true; + Item.shootSpeed = 13f; + Item.shoot = ProjectileID.PurificationPowder; + Item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() @@ -92,7 +92,7 @@ namespace CalamityMod.Items.Weapons.Ranged vector2.X = (vector2.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); vector2.Y -= 100 * j; - Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[j]].Center - vector2) * item.shootSpeed; + Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[j]].Center - vector2) * Item.shootSpeed; int proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); Main.projectile[proj].extraUpdates += 2; @@ -103,7 +103,7 @@ namespace CalamityMod.Items.Weapons.Ranged vector2.X = (vector2.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); vector2.Y += 100 * j; - velocity2 = Vector2.Normalize(Main.npc[targets[j]].Center - vector2) * item.shootSpeed; + velocity2 = Vector2.Normalize(Main.npc[targets[j]].Center - vector2) * Item.shootSpeed; proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); Main.projectile[proj].extraUpdates += 2; @@ -123,7 +123,7 @@ namespace CalamityMod.Items.Weapons.Ranged vector2.X = (vector2.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); vector2.Y -= 100 * randomTarget; - Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - vector2) * item.shootSpeed; + Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - vector2) * Item.shootSpeed; int proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); Main.projectile[proj].extraUpdates += 2; @@ -134,7 +134,7 @@ namespace CalamityMod.Items.Weapons.Ranged vector2.X = (vector2.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); vector2.Y += 100 * randomTarget; - velocity2 = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - vector2) * item.shootSpeed; + velocity2 = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - vector2) * Item.shootSpeed; proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); Main.projectile[proj].extraUpdates += 2; @@ -147,12 +147,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/Karasawa.cs b/Items/Weapons/Ranged/Karasawa.cs index a75fa0cf70..778e918668 100644 --- a/Items/Weapons/Ranged/Karasawa.cs +++ b/Items/Weapons/Ranged/Karasawa.cs @@ -18,31 +18,31 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.width = 94; - item.height = 44; - item.ranged = true; - item.damage = 900; - item.knockBack = 12f; - item.useTime = 52; - item.useAnimation = 52; - item.autoReuse = true; + Item.width = 94; + Item.height = 44; + Item.DamageType = DamageClass.Ranged; + Item.damage = 900; + Item.knockBack = 12f; + Item.useTime = 52; + Item.useAnimation = 52; + Item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/MechGaussRifle"); - item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/MechGaussRifle"); + Item.noMelee = true; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; - item.useAmmo = AmmoID.Bullet; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; + Item.useAmmo = AmmoID.Bullet; } public override bool CanUseItem(Player player) { - return CalamityGlobalItem.HasEnoughAmmo(player, item, 5); + return CalamityGlobalItem.HasEnoughAmmo(player, Item, 5); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Ranged Projectile.NewProjectile(position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); // Consume 5 ammo per shot - CalamityGlobalItem.ConsumeAdditionalAmmo(player, item, 5); + CalamityGlobalItem.ConsumeAdditionalAmmo(player, Item, 5); return false; } @@ -74,16 +74,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ItemID.LargeRuby); - r.AddIngredient(ModContent.ItemType(), 15); - r.AddIngredient(ModContent.ItemType(), 25); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddIngredient(ModContent.ItemType(), 8); - r.AddIngredient(ModContent.ItemType(), 20); - r.AddTile(ModContent.TileType()); - r.SetResult(this); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.LargeRuby).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/Leviatitan.cs b/Items/Weapons/Ranged/Leviatitan.cs index 69e8d2d2a2..0d58c2b68b 100644 --- a/Items/Weapons/Ranged/Leviatitan.cs +++ b/Items/Weapons/Ranged/Leviatitan.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 80; - item.ranged = true; - item.width = 82; - item.height = 28; - item.useTime = 9; - item.useAnimation = 9; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 80; + Item.DamageType = DamageClass.Ranged; + Item.width = 82; + Item.height = 28; + Item.useTime = 9; + Item.useAnimation = 9; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item92; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/LunarianBow.cs b/Items/Weapons/Ranged/LunarianBow.cs index 46b38daff4..73002136c7 100644 --- a/Items/Weapons/Ranged/LunarianBow.cs +++ b/Items/Weapons/Ranged/LunarianBow.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 32; - item.ranged = true; - item.width = 32; - item.height = 62; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item75; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 32; + Item.DamageType = DamageClass.Ranged; + Item.width = 32; + Item.height = 62; + Item.useTime = 22; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item75; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -66,22 +66,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DemonBow); - recipe.AddIngredient(ItemID.BeesKnees); - recipe.AddIngredient(ItemID.MoltenFury); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TendonBow); - recipe.AddIngredient(ItemID.BeesKnees); - recipe.AddIngredient(ItemID.MoltenFury); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.DemonBow).AddIngredient(ItemID.BeesKnees).AddIngredient(ItemID.MoltenFury).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.DemonAltar).Register(); + CreateRecipe(1).AddIngredient(ItemID.TendonBow).AddIngredient(ItemID.BeesKnees).AddIngredient(ItemID.MoltenFury).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Ranged/MagnaStriker.cs b/Items/Weapons/Ranged/MagnaStriker.cs index ada40dd626..84474c6858 100644 --- a/Items/Weapons/Ranged/MagnaStriker.cs +++ b/Items/Weapons/Ranged/MagnaStriker.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 35; - item.ranged = true; - item.width = 72; - item.height = 38; - item.useTime = 5; - item.reuseDelay = 6; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike"); - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 35; + Item.DamageType = DamageClass.Ranged; + Item.width = 72; + Item.height = 38; + Item.useTime = 5; + Item.reuseDelay = 6; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike"); + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -58,14 +58,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("AnyAdamantiteBar", 6); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddRecipeGroup("AnyAdamantiteBar", 6).AddIngredient(ItemID.Ectoplasm, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/MagnomalyCannon.cs b/Items/Weapons/Ranged/MagnomalyCannon.cs index 2ff8e40de2..b204ede7e6 100644 --- a/Items/Weapons/Ranged/MagnomalyCannon.cs +++ b/Items/Weapons/Ranged/MagnomalyCannon.cs @@ -21,23 +21,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 357; - item.ranged = true; - item.width = 84; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 9.5f; - item.UseSound = SoundID.Item11; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = ItemRarityID.Red; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.useAmmo = AmmoID.Rocket; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.damage = 357; + Item.DamageType = DamageClass.Ranged; + Item.width = 84; + Item.height = 30; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 9.5f; + Item.UseSound = SoundID.Item11; + Item.value = Item.buyPrice(2, 50, 0, 0); + Item.rare = ItemRarityID.Red; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.useAmmo = AmmoID.Rocket; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override Vector2? HoldoutOffset() @@ -60,15 +60,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); // This weapon has two donor weapons - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.ElectrosphereLauncher); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.ElectrosphereLauncher).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/Malevolence.cs b/Items/Weapons/Ranged/Malevolence.cs index b07c34cd23..aabdb5167c 100644 --- a/Items/Weapons/Ranged/Malevolence.cs +++ b/Items/Weapons/Ranged/Malevolence.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 56; - item.ranged = true; - item.width = 36; - item.height = 58; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item97; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 56; + Item.DamageType = DamageClass.Ranged; + Item.width = 36; + Item.height = 58; + Item.useTime = 18; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item97; + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/MandibleBow.cs b/Items/Weapons/Ranged/MandibleBow.cs index 79b5055833..125022d9f1 100644 --- a/Items/Weapons/Ranged/MandibleBow.cs +++ b/Items/Weapons/Ranged/MandibleBow.cs @@ -13,23 +13,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 14; - item.ranged = true; - item.width = 22; - item.height = 40; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item5; - item.autoReuse = false; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 15f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 14; + Item.DamageType = DamageClass.Ranged; + Item.width = 22; + Item.height = 40; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item5; + Item.autoReuse = false; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 15f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } } } diff --git a/Items/Weapons/Ranged/MarksmanBow.cs b/Items/Weapons/Ranged/MarksmanBow.cs index 8b713a23f9..1dbb6e30aa 100644 --- a/Items/Weapons/Ranged/MarksmanBow.cs +++ b/Items/Weapons/Ranged/MarksmanBow.cs @@ -16,25 +16,25 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 30; - item.ranged = true; - item.width = 36; - item.height = 110; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.JestersArrow; - item.shootSpeed = 10f; - item.useAmmo = AmmoID.Arrow; + Item.damage = 30; + Item.DamageType = DamageClass.Ranged; + Item.width = 36; + Item.height = 110; + Item.useTime = 18; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.JestersArrow; + Item.shootSpeed = 10f; + Item.useAmmo = AmmoID.Arrow; - item.value = Item.buyPrice(gold: 80); // crafted out of nothing but 31 ectoplasm so it has unique pricing - item.rare = ItemRarityID.Yellow; - item.Calamity().donorItem = true; - item.Calamity().canFirePointBlankShots = true; + Item.value = Item.buyPrice(gold: 80); // crafted out of nothing but 31 ectoplasm so it has unique pricing + Item.rare = ItemRarityID.Yellow; + Item.Calamity().donorItem = true; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -67,11 +67,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Ectoplasm, 31); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Ectoplasm, 31).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/MarniteRifleSpear.cs b/Items/Weapons/Ranged/MarniteRifleSpear.cs index 915b43e067..dd0b2ee93f 100644 --- a/Items/Weapons/Ranged/MarniteRifleSpear.cs +++ b/Items/Weapons/Ranged/MarniteRifleSpear.cs @@ -13,33 +13,27 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 20; - item.ranged = true; - item.width = 72; - item.height = 20; - item.useTime = 28; - item.useAnimation = 28; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 2.25f; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shootSpeed = 22f; - item.useAmmo = AmmoID.Bullet; - item.shoot = ProjectileID.PurificationPowder; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 20; + Item.DamageType = DamageClass.Ranged; + Item.width = 72; + Item.height = 20; + Item.useTime = 28; + Item.useAnimation = 28; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 2.25f; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item41; + Item.autoReuse = true; + Item.shootSpeed = 22f; + Item.useAmmo = AmmoID.Bullet; + Item.shoot = ProjectileID.PurificationPowder; + Item.Calamity().canFirePointBlankShots = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyGoldBar", 7); - recipe.AddIngredient(ItemID.Granite, 5); - recipe.AddIngredient(ItemID.Marble, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyGoldBar", 7).AddIngredient(ItemID.Granite, 5).AddIngredient(ItemID.Marble, 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/Megafleet.cs b/Items/Weapons/Ranged/Megafleet.cs index 469df03241..d50c3c42fa 100644 --- a/Items/Weapons/Ranged/Megafleet.cs +++ b/Items/Weapons/Ranged/Megafleet.cs @@ -22,25 +22,25 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 200; - item.ranged = true; - item.width = 96; - item.height = 38; - item.useTime = 5; - item.useAnimation = 5; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 18f; - item.useAmmo = AmmoID.Bullet; + Item.damage = 200; + Item.DamageType = DamageClass.Ranged; + Item.width = 96; + Item.height = 38; + Item.useTime = 5; + Item.useAnimation = 5; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 18f; + Item.useAmmo = AmmoID.Bullet; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; - item.Calamity().canFirePointBlankShots = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -77,13 +77,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofFright, 30); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofFright, 30).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index 9606eef67f..3d677c576d 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -21,23 +21,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 34; - item.ranged = true; - item.width = 72; - item.height = 32; - item.useTime = 6; - item.useAnimation = 6; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 16f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 34; + Item.DamageType = DamageClass.Ranged; + Item.width = 72; + Item.height = 32; + Item.useTime = 6; + Item.useAnimation = 6; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.5f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 16f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -72,15 +72,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Megashark); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Megashark).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/Meowthrower.cs b/Items/Weapons/Ranged/Meowthrower.cs index 9f9bf292e0..256410dbed 100644 --- a/Items/Weapons/Ranged/Meowthrower.cs +++ b/Items/Weapons/Ranged/Meowthrower.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 28; - item.ranged = true; - item.width = 74; - item.height = 24; - item.useTime = 10; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.25f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5.5f; - item.useAmmo = AmmoID.Gel; + Item.damage = 28; + Item.DamageType = DamageClass.Ranged; + Item.width = 74; + Item.height = 24; + Item.useTime = 10; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.25f; + Item.UseSound = SoundID.Item34; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5.5f; + Item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/MepheticSprayer.cs b/Items/Weapons/Ranged/MepheticSprayer.cs index 3f89face49..e5656e5aa6 100644 --- a/Items/Weapons/Ranged/MepheticSprayer.cs +++ b/Items/Weapons/Ranged/MepheticSprayer.cs @@ -15,22 +15,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 110; - item.ranged = true; - item.width = 76; - item.height = 36; - item.useTime = 10; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7.5f; - item.useAmmo = AmmoID.Gel; + Item.damage = 110; + Item.DamageType = DamageClass.Ranged; + Item.width = 76; + Item.height = 36; + Item.useTime = 10; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.UseSound = SoundID.Item34; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7.5f; + Item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/MineralMortar.cs b/Items/Weapons/Ranged/MineralMortar.cs index 2e39a377c1..5a6f840a04 100644 --- a/Items/Weapons/Ranged/MineralMortar.cs +++ b/Items/Weapons/Ranged/MineralMortar.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 30; - item.ranged = true; - item.width = 58; - item.height = 26; - item.useTime = 33; - item.useAnimation = 33; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 14f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Rocket; + Item.damage = 30; + Item.DamageType = DamageClass.Ranged; + Item.width = 58; + Item.height = 26; + Item.useTime = 33; + Item.useAnimation = 33; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Rocket; } public override Vector2? HoldoutOffset() @@ -47,12 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyAdamantiteBar", 13); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyAdamantiteBar", 13).AddIngredient(ItemID.AncientBattleArmorMaterial, 2).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/Minigun.cs b/Items/Weapons/Ranged/Minigun.cs index 6e933da318..63eb9b05fb 100644 --- a/Items/Weapons/Ranged/Minigun.cs +++ b/Items/Weapons/Ranged/Minigun.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 275; - item.ranged = true; - item.width = 92; - item.height = 44; - item.useTime = 3; - item.useAnimation = 3; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 22f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 275; + Item.DamageType = DamageClass.Ranged; + Item.width = 92; + Item.height = 44; + Item.useTime = 3; + Item.useAnimation = 3; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.5f; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item41; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 22f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -54,13 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ChainGun); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ChainGun).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/MolecularManipulator.cs b/Items/Weapons/Ranged/MolecularManipulator.cs index a7292f6164..6c58b9e305 100644 --- a/Items/Weapons/Ranged/MolecularManipulator.cs +++ b/Items/Weapons/Ranged/MolecularManipulator.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 580; - item.ranged = true; - item.width = 56; - item.height = 34; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 8f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 25f; - item.shoot = ModContent.ProjectileType(); - item.Calamity().canFirePointBlankShots = true; + Item.damage = 580; + Item.DamageType = DamageClass.Ranged; + Item.width = 56; + Item.height = 34; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 8f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.Item33; + Item.autoReuse = true; + Item.shootSpeed = 25f; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -50,13 +50,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/Monsoon.cs b/Items/Weapons/Ranged/Monsoon.cs index 5abebce4dc..f8e1376126 100644 --- a/Items/Weapons/Ranged/Monsoon.cs +++ b/Items/Weapons/Ranged/Monsoon.cs @@ -19,23 +19,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 121; - item.ranged = true; - item.width = 46; - item.height = 78; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.WoodenArrowFriendly; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 121; + Item.DamageType = DamageClass.Ranged; + Item.width = 46; + Item.height = 78; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.5f; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.WoodenArrowFriendly; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -87,17 +87,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Tsunami); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ItemID.SharkFin, 2); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Tsunami).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ItemID.SharkFin, 2).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/Needler.cs b/Items/Weapons/Ranged/Needler.cs index ea666beee0..b8e491e523 100644 --- a/Items/Weapons/Ranged/Needler.cs +++ b/Items/Weapons/Ranged/Needler.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 45; - item.ranged = true; - item.width = 44; - item.height = 26; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item108; - item.autoReuse = true; - item.shootSpeed = 9f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Bullet; + Item.damage = 45; + Item.DamageType = DamageClass.Ranged; + Item.width = 44; + Item.height = 26; + Item.useTime = 18; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item108; + Item.autoReuse = true; + Item.shootSpeed = 9f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/NettlelineGreatbow.cs b/Items/Weapons/Ranged/NettlelineGreatbow.cs index d6f1143939..26429bdb35 100644 --- a/Items/Weapons/Ranged/NettlelineGreatbow.cs +++ b/Items/Weapons/Ranged/NettlelineGreatbow.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 73; - item.ranged = true; - item.width = 36; - item.height = 64; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 16f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 73; + Item.DamageType = DamageClass.Ranged; + Item.width = 36; + Item.height = 64; + Item.useTime = 18; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 16f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -80,11 +80,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/Norfleet.cs b/Items/Weapons/Ranged/Norfleet.cs index 8c0266a853..3e2c009eed 100644 --- a/Items/Weapons/Ranged/Norfleet.cs +++ b/Items/Weapons/Ranged/Norfleet.cs @@ -16,30 +16,30 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 354; - item.knockBack = 15f; - item.shootSpeed = 30f; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useAnimation = 75; - item.useTime = 75; - item.reuseDelay = 0; - item.width = 140; - item.height = 42; - item.UseSound = SoundID.Item92; - item.shoot = ModContent.ProjectileType(); - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.useTurn = false; - item.useAmmo = AmmoID.FallenStar; - item.autoReuse = true; + Item.damage = 354; + Item.knockBack = 15f; + Item.shootSpeed = 30f; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useAnimation = 75; + Item.useTime = 75; + Item.reuseDelay = 0; + Item.width = 140; + Item.height = 42; + Item.UseSound = SoundID.Item92; + Item.shoot = ModContent.ProjectileType(); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Ranged; + Item.channel = true; + Item.useTurn = false; + Item.useAmmo = AmmoID.FallenStar; + Item.autoReuse = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Ranged/NullificationRifle.cs b/Items/Weapons/Ranged/NullificationRifle.cs index 978fe91d6e..23aa9adff1 100644 --- a/Items/Weapons/Ranged/NullificationRifle.cs +++ b/Items/Weapons/Ranged/NullificationRifle.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 135; - item.ranged = true; - item.width = 52; - item.height = 28; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 25f; - item.shoot = ModContent.ProjectileType(); - item.Calamity().canFirePointBlankShots = true; + Item.damage = 135; + Item.DamageType = DamageClass.Ranged; + Item.width = 52; + Item.height = 28; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item33; + Item.autoReuse = true; + Item.shootSpeed = 25f; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/OnyxChainBlaster.cs b/Items/Weapons/Ranged/OnyxChainBlaster.cs index cc301f6a0a..00dae3bdc3 100644 --- a/Items/Weapons/Ranged/OnyxChainBlaster.cs +++ b/Items/Weapons/Ranged/OnyxChainBlaster.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 40; - item.ranged = true; - item.width = 64; - item.height = 32; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4.5f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shoot = ProjectileID.BlackBolt; - item.shootSpeed = 24f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 40; + Item.DamageType = DamageClass.Ranged; + Item.width = 64; + Item.height = 32; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4.5f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item36; + Item.autoReuse = true; + Item.shoot = ProjectileID.BlackBolt; + Item.shootSpeed = 24f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -69,13 +69,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.OnyxBlaster); - recipe.AddIngredient(ItemID.ChainGun); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.OnyxBlaster).AddIngredient(ItemID.ChainGun).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index b07f964234..279cb0b49d 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -20,23 +20,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 90; - item.ranged = true; - item.width = 84; - item.height = 34; - item.useTime = item.useAnimation = 10; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4.5f; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shoot = ProjectileID.BlackBolt; - item.shootSpeed = 28f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 90; + Item.DamageType = DamageClass.Ranged; + Item.width = 84; + Item.height = 34; + Item.useTime = Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4.5f; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.UseSound = SoundID.Item36; + Item.autoReuse = true; + Item.shoot = ProjectileID.BlackBolt; + Item.shootSpeed = 28f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -77,13 +77,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 8); - r.AddIngredient(ModContent.ItemType(), 8); - r.AddTile(ModContent.TileType()); - r.SetResult(this); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/OpalStriker.cs b/Items/Weapons/Ranged/OpalStriker.cs index 0c8150aa35..e782558d03 100644 --- a/Items/Weapons/Ranged/OpalStriker.cs +++ b/Items/Weapons/Ranged/OpalStriker.cs @@ -16,24 +16,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 9; - item.ranged = true; - item.width = 46; - item.height = 30; - item.useTime = 5; - item.reuseDelay = 25; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 0f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike"); - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 9; + Item.DamageType = DamageClass.Ranged; + Item.width = 46; + Item.height = 30; + Item.useTime = 5; + Item.reuseDelay = 25; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 0f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike"); + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -46,14 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Marble, 20); - recipe.AddIngredient(ItemID.Amber, 5); - recipe.AddIngredient(ItemID.Diamond, 3); - recipe.AddIngredient(ItemID.FlintlockPistol); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Marble, 20).AddIngredient(ItemID.Amber, 5).AddIngredient(ItemID.Diamond, 3).AddIngredient(ItemID.FlintlockPistol).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/OverloadedBlaster.cs b/Items/Weapons/Ranged/OverloadedBlaster.cs index a27af79b2e..2410ee8692 100644 --- a/Items/Weapons/Ranged/OverloadedBlaster.cs +++ b/Items/Weapons/Ranged/OverloadedBlaster.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 16; - item.ranged = true; - item.width = 42; - item.height = 34; - item.useTime = 17; - item.useAnimation = 17; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shootSpeed = 6.5f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Gel; + Item.damage = 16; + Item.DamageType = DamageClass.Ranged; + Item.width = 42; + Item.height = 34; + Item.useTime = 17; + Item.useAnimation = 17; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item9; + Item.autoReuse = true; + Item.shootSpeed = 6.5f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/P90.cs b/Items/Weapons/Ranged/P90.cs index c6ad413195..25efb951fa 100644 --- a/Items/Weapons/Ranged/P90.cs +++ b/Items/Weapons/Ranged/P90.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 8; - item.ranged = true; - item.width = 60; - item.height = 28; - item.useTime = 5; - item.useAnimation = 5; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = ProjectileID.Bullet; - item.shootSpeed = 7f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 8; + Item.DamageType = DamageClass.Ranged; + Item.width = 60; + Item.height = 28; + Item.useTime = 5; + Item.useAnimation = 5; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shoot = ProjectileID.Bullet; + Item.shootSpeed = 7f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/PaintballBlaster.cs b/Items/Weapons/Ranged/PaintballBlaster.cs index b4c0d11856..dd16a1e3de 100644 --- a/Items/Weapons/Ranged/PaintballBlaster.cs +++ b/Items/Weapons/Ranged/PaintballBlaster.cs @@ -16,28 +16,28 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 26; - item.ranged = true; - item.width = 54; - item.height = 26; - item.useAnimation = 24; - item.reuseDelay = 9; - item.useTime = 4; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = null; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = ProjectileID.PainterPaintball; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 26; + Item.DamageType = DamageClass.Ranged; + Item.width = 54; + Item.height = 26; + Item.useAnimation = 24; + Item.reuseDelay = 9; + Item.useTime = 4; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = null; + Item.autoReuse = true; + Item.shootSpeed = 20f; + Item.shoot = ProjectileID.PainterPaintball; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -69,12 +69,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PainterPaintballGun); - recipe.AddIngredient(ItemID.SoulofSight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.PainterPaintballGun).AddIngredient(ItemID.SoulofSight, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/PearlGod.cs b/Items/Weapons/Ranged/PearlGod.cs index faed226645..f5182bf7be 100644 --- a/Items/Weapons/Ranged/PearlGod.cs +++ b/Items/Weapons/Ranged/PearlGod.cs @@ -22,23 +22,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 32; - item.ranged = true; - item.width = 80; - item.height = 46; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 32; + Item.DamageType = DamageClass.Ranged; + Item.width = 80; + Item.height = 46; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item41; + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -103,13 +103,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SpectreBar, 5); - recipe.AddIngredient(ItemID.ShroomiteBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SpectreBar, 5).AddIngredient(ItemID.ShroomiteBar, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/PestilentDefiler.cs b/Items/Weapons/Ranged/PestilentDefiler.cs index 4ec1975f6b..9194ed7674 100644 --- a/Items/Weapons/Ranged/PestilentDefiler.cs +++ b/Items/Weapons/Ranged/PestilentDefiler.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 135; - item.ranged = true; - item.width = 46; - item.height = 20; - item.useTime = 37; - item.useAnimation = 37; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 9.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item40; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 135; + Item.DamageType = DamageClass.Ranged; + Item.width = 46; + Item.height = 20; + Item.useTime = 37; + Item.useAnimation = 37; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 9.5f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item40; + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Phangasm.cs b/Items/Weapons/Ranged/Phangasm.cs index 1137124739..82b79768f9 100644 --- a/Items/Weapons/Ranged/Phangasm.cs +++ b/Items/Weapons/Ranged/Phangasm.cs @@ -18,29 +18,29 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 110; - item.width = 20; - item.height = 12; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 3f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item5; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 110; + Item.width = 20; + Item.height = 12; + Item.useTime = 12; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 3f; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item5; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Ranged; + Item.channel = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().canFirePointBlankShots = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -50,14 +50,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Phantasm); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Phantasm).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 32dafa8eb0..0f96a50b44 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -23,23 +23,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 230; - item.ranged = true; - item.width = 84; - item.height = 30; - item.useTime = 2; - item.useAnimation = 10; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.UseSound = SoundID.Item34; - item.autoReuse = true; - item.shootSpeed = 18f; - item.useAmmo = AmmoID.Gel; + Item.damage = 230; + Item.DamageType = DamageClass.Ranged; + Item.width = 84; + Item.height = 30; + Item.useTime = 2; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.UseSound = SoundID.Item34; + Item.autoReuse = true; + Item.shootSpeed = 18f; + Item.useAmmo = AmmoID.Gel; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } public override bool AltFunctionUse(Player player) => true; @@ -48,14 +48,14 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - item.shoot = ModContent.ProjectileType(); - item.useTime = item.useAnimation = 27; + Item.shoot = ModContent.ProjectileType(); + Item.useTime = Item.useAnimation = 27; } else { - item.useTime = 2; - item.useAnimation = 10; - item.shoot = ModContent.ProjectileType(); + Item.useTime = 2; + Item.useAnimation = 10; + Item.shoot = ModContent.ProjectileType(); } return base.CanUseItem(player); } @@ -105,14 +105,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs index 2b90178150..563cf8e53f 100644 --- a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs +++ b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 58; - item.ranged = true; - item.width = 58; - item.height = 102; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item75; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Arrow; + Item.damage = 58; + Item.DamageType = DamageClass.Ranged; + Item.width = 58; + Item.height = 102; + Item.useTime = 22; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item75; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Arrow; } public override Vector2? HoldoutOffset() @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -105,14 +105,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.DaedalusStormbow); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.DaedalusStormbow).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs b/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs index d373bbb1f8..72d9a1dd99 100644 --- a/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs +++ b/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs @@ -25,26 +25,26 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 86; - item.ranged = true; - item.width = 68; - item.height = 32; - item.useTime = 5; - item.useAnimation = 5; - item.autoReuse = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1f; + Item.damage = 86; + Item.DamageType = DamageClass.Ranged; + Item.width = 68; + Item.height = 32; + Item.useTime = 5; + Item.useAnimation = 5; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1f; - item.UseSound = SoundID.Item11; - item.shoot = ProjectileID.Bullet; - item.useAmmo = AmmoID.Bullet; - item.shootSpeed = 15f; + Item.UseSound = SoundID.Item11; + Item.shoot = ProjectileID.Bullet; + Item.useAmmo = AmmoID.Bullet; + Item.shootSpeed = 15f; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().donorItem = true; - item.Calamity().canFirePointBlankShots = true; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().donorItem = true; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-12, -6); @@ -70,18 +70,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Uzi); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ItemID.FragmentVortex, 10); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Uzi).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LunarBar, 5).AddIngredient(ItemID.FragmentVortex, 10).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 25).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index a3e1285c4e..468254cb5d 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -22,24 +22,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = BaseDamage; - item.ranged = true; - item.width = 100; - item.height = 46; - item.useTime = 3; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.UseSound = SoundID.Item34; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11f; - item.useAmmo = AmmoID.Gel; + Item.damage = BaseDamage; + Item.DamageType = DamageClass.Ranged; + Item.width = 100; + Item.height = 46; + Item.useTime = 3; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item34; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; + Item.useAmmo = AmmoID.Gel; - item.rare = ItemRarityID.Purple; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override Vector2? HoldoutOffset() => new Vector2(-25, -10); @@ -50,13 +50,13 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - item.useTime = 5; - item.useAnimation = 20; + Item.useTime = 5; + Item.useAnimation = 20; } else { - item.useTime = 3; - item.useAnimation = 15; + Item.useTime = 3; + Item.useAnimation = 15; } return base.CanUseItem(player); } @@ -84,22 +84,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/PristineFury_Animated"); - spriteBatch.Draw(texture, position, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 4), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/PristineFury_Animated"); + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 4), Color.White, 0f, origin, scale, SpriteEffects.None, 0); return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/PristineFury_Animated"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 4), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/PristineFury_Animated"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 4), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/PristineFuryGlow"); - spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 5, 4, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/PristineFuryGlow"); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 4, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } } } diff --git a/Items/Weapons/Ranged/ProporsePistol.cs b/Items/Weapons/Ranged/ProporsePistol.cs index 566b27ccf5..4286a239b1 100644 --- a/Items/Weapons/Ranged/ProporsePistol.cs +++ b/Items/Weapons/Ranged/ProporsePistol.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 90; - item.ranged = true; - item.width = 40; - item.height = 20; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = ModContent.ProjectileType(); - item.Calamity().canFirePointBlankShots = true; + Item.damage = 90; + Item.DamageType = DamageClass.Ranged; + Item.width = 40; + Item.height = 20; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item33; + Item.autoReuse = true; + Item.shootSpeed = 20f; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index 1b3731fe47..1580ae8737 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -18,24 +18,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 27; - item.ranged = true; - item.width = 72; - item.height = 34; - item.useTime = 60; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.25f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.noUseGraphic = true; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.channel = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 11f; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 27; + Item.DamageType = DamageClass.Ranged; + Item.width = 72; + Item.height = 34; + Item.useTime = 60; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.25f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.noUseGraphic = true; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.channel = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 11f; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-30f, 0f); @@ -54,13 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddIngredient(ItemID.Pumpkin, 30); - recipe.AddIngredient(ItemID.PumpkinSeed, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.IllegalGunParts).AddIngredient(ItemID.Pumpkin, 30).AddIngredient(ItemID.PumpkinSeed, 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/RaidersGlory.cs b/Items/Weapons/Ranged/RaidersGlory.cs index aa17b06832..a05722b9ed 100644 --- a/Items/Weapons/Ranged/RaidersGlory.cs +++ b/Items/Weapons/Ranged/RaidersGlory.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 44; - item.ranged = true; - item.width = 50; - item.height = 22; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 15f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 44; + Item.DamageType = DamageClass.Ranged; + Item.width = 50; + Item.height = 22; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 15f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Ranged/RealmRavager.cs b/Items/Weapons/Ranged/RealmRavager.cs index f6b63062eb..f9ff21111c 100644 --- a/Items/Weapons/Ranged/RealmRavager.cs +++ b/Items/Weapons/Ranged/RealmRavager.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 50; - item.ranged = true; - item.width = 76; - item.height = 32; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item38; - item.autoReuse = true; - item.shootSpeed = 30f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 50; + Item.DamageType = DamageClass.Ranged; + Item.width = 76; + Item.height = 32; + Item.useTime = 22; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item38; + Item.autoReuse = true; + Item.shootSpeed = 30f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); diff --git a/Items/Weapons/Ranged/RubicoPrime.cs b/Items/Weapons/Ranged/RubicoPrime.cs index cc76f1ca79..af102d6b4d 100644 --- a/Items/Weapons/Ranged/RubicoPrime.cs +++ b/Items/Weapons/Ranged/RubicoPrime.cs @@ -19,26 +19,26 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 1178; - item.ranged = true; - item.knockBack = 10f; - item.useTime = 30; - item.useAnimation = 300; - item.autoReuse = false; + Item.damage = 1178; + Item.DamageType = DamageClass.Ranged; + Item.knockBack = 10f; + Item.useTime = 30; + Item.useAnimation = 300; + Item.autoReuse = false; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.width = 82; - item.height = 28; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.width = 82; + Item.height = 28; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Bullet; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Bullet; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().donorItem = true; - item.Calamity().canFirePointBlankShots = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().donorItem = true; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -48,13 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/SDFMG.cs b/Items/Weapons/Ranged/SDFMG.cs index b60d92a89a..9cf1241047 100644 --- a/Items/Weapons/Ranged/SDFMG.cs +++ b/Items/Weapons/Ranged/SDFMG.cs @@ -20,24 +20,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 100; - item.ranged = true; - item.width = 74; - item.height = 34; - item.useTime = 2; - item.useAnimation = 2; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.75f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 16f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 100; + Item.DamageType = DamageClass.Ranged; + Item.width = 74; + Item.height = 34; + Item.useTime = 2; + Item.useAnimation = 2; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.75f; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 16f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -66,18 +66,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SDMG); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SDMG).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/SandstormGun.cs b/Items/Weapons/Ranged/SandstormGun.cs index 161a197fc4..0458b8314a 100644 --- a/Items/Weapons/Ranged/SandstormGun.cs +++ b/Items/Weapons/Ranged/SandstormGun.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 80; - item.ranged = true; - item.width = 62; - item.height = 26; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Sand; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 80; + Item.DamageType = DamageClass.Ranged; + Item.width = 62; + Item.height = 26; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Sand; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -57,14 +57,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Sandgun); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Amber, 5); - recipe.AddIngredient(ItemID.SandBlock, 50); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Sandgun).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Amber, 5).AddIngredient(ItemID.SandBlock, 50).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/ScorchedEarth.cs b/Items/Weapons/Ranged/ScorchedEarth.cs index 26f8c0fa47..b25a1cb131 100644 --- a/Items/Weapons/Ranged/ScorchedEarth.cs +++ b/Items/Weapons/Ranged/ScorchedEarth.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -21,24 +22,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 500; - item.ranged = true; - item.useTime = 8; - item.useAnimation = 32; // 4 shots in just over half a second - item.reuseDelay = 60; // 1 second recharge - item.width = 104; - item.height = 44; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 8.7f; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.autoReuse = true; - item.shootSpeed = 12.6f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Rocket; - item.Calamity().donorItem = true; + Item.damage = 500; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 8; + Item.useAnimation = 32; // 4 shots in just over half a second + Item.reuseDelay = 60; // 1 second recharge + Item.width = 104; + Item.height = 44; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 8.7f; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.autoReuse = true; + Item.shootSpeed = 12.6f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Rocket; + Item.Calamity().donorItem = true; } // Consume two ammo per fire @@ -52,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (counter == 0) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ScorchedEarthShot" + Main.rand.Next(1,4)), position); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ScorchedEarthShot" + Main.rand.Next(1,4)), position); } counter++; @@ -63,14 +64,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.FragmentSolar, 50); - recipe.AddRecipeGroup("AnyAdamantiteBar", 15); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.FragmentSolar, 50).AddRecipeGroup("AnyAdamantiteBar", 15).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/Scorpion.cs b/Items/Weapons/Ranged/Scorpion.cs index e23c603bcb..2355b7a680 100644 --- a/Items/Weapons/Ranged/Scorpion.cs +++ b/Items/Weapons/Ranged/Scorpion.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 80; - item.ranged = true; - item.width = 58; - item.height = 26; - item.useTime = 13; - item.reuseDelay = 30; - item.useAnimation = 39; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6.5f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = null; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Rocket; + Item.damage = 80; + Item.DamageType = DamageClass.Ranged; + Item.width = 58; + Item.height = 26; + Item.useTime = 13; + Item.reuseDelay = 30; + Item.useAnimation = 39; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6.5f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = null; + Item.autoReuse = true; + Item.shootSpeed = 20f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Rocket; } public override Vector2? HoldoutOffset() @@ -75,14 +75,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SnowmanCannon); - recipe.AddIngredient(ItemID.GrenadeLauncher); - recipe.AddIngredient(ItemID.RocketLauncher); - recipe.AddIngredient(ItemID.FragmentVortex, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SnowmanCannon).AddIngredient(ItemID.GrenadeLauncher).AddIngredient(ItemID.RocketLauncher).AddIngredient(ItemID.FragmentVortex, 20).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/Seabow.cs b/Items/Weapons/Ranged/Seabow.cs index 79aca6ca84..3d0e9b7d03 100644 --- a/Items/Weapons/Ranged/Seabow.cs +++ b/Items/Weapons/Ranged/Seabow.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 12; - item.ranged = true; - item.width = 22; - item.height = 46; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 16f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 12; + Item.DamageType = DamageClass.Ranged; + Item.width = 22; + Item.height = 46; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.5f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 16f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -46,11 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/Seadragon.cs b/Items/Weapons/Ranged/Seadragon.cs index 1919b50e8c..61e9f2bda7 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -23,24 +23,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 70; - item.ranged = true; - item.width = 90; - item.height = 38; - item.useTime = 5; - item.useAnimation = 5; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 16f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 70; + Item.DamageType = DamageClass.Ranged; + Item.width = 90; + Item.height = 38; + Item.useTime = 5; + Item.useAnimation = 5; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.5f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 16f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -86,17 +86,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 9).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/SeasSearing.cs b/Items/Weapons/Ranged/SeasSearing.cs index cfcb09daaf..6a0d73c368 100644 --- a/Items/Weapons/Ranged/SeasSearing.cs +++ b/Items/Weapons/Ranged/SeasSearing.cs @@ -19,23 +19,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = BaseDamage; - item.ranged = true; - item.width = 88; - item.height = 44; - item.useTime = 5; - item.useAnimation = 15; - item.reuseDelay = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11f; + Item.damage = BaseDamage; + Item.DamageType = DamageClass.Ranged; + Item.width = 88; + Item.height = 44; + Item.useTime = 5; + Item.useAnimation = 15; + Item.reuseDelay = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; } public override Vector2? HoldoutOffset() @@ -52,15 +52,15 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - item.useTime = 30; - item.useAnimation = 30; - item.reuseDelay = 0; + Item.useTime = 30; + Item.useAnimation = 30; + Item.reuseDelay = 0; } else { - item.useTime = 5; - item.useAnimation = 15; - item.reuseDelay = 20; + Item.useTime = 5; + Item.useAnimation = 15; + Item.reuseDelay = 20; } return base.CanUseItem(player); } diff --git a/Items/Weapons/Ranged/SepticSkewer.cs b/Items/Weapons/Ranged/SepticSkewer.cs index 933ecc105c..3e62094f38 100644 --- a/Items/Weapons/Ranged/SepticSkewer.cs +++ b/Items/Weapons/Ranged/SepticSkewer.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 272; - item.ranged = true; - item.width = 46; - item.height = 24; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item10; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 272; + Item.DamageType = DamageClass.Ranged; + Item.width = 46; + Item.height = 24; + Item.useTime = 12; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7.5f; + Item.UseSound = SoundID.Item10; + Item.autoReuse = true; + Item.shootSpeed = 20f; + Item.shoot = ModContent.ProjectileType(); - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.Calamity().canFirePointBlankShots = true; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); diff --git a/Items/Weapons/Ranged/Shadethrower.cs b/Items/Weapons/Ranged/Shadethrower.cs index 8d4671a5f6..f57266291b 100644 --- a/Items/Weapons/Ranged/Shadethrower.cs +++ b/Items/Weapons/Ranged/Shadethrower.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 16; - item.ranged = true; - item.width = 76; - item.height = 30; - item.useTime = 10; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.5f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5.5f; - item.useAmmo = AmmoID.Gel; + Item.damage = 16; + Item.DamageType = DamageClass.Ranged; + Item.width = 76; + Item.height = 30; + Item.useTime = 10; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.UseSound = SoundID.Item34; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5.5f; + Item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() @@ -49,13 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 3); - recipe.AddIngredient(ItemID.DemoniteBar, 7); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RottenChunk, 3).AddIngredient(ItemID.DemoniteBar, 7).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Ranged/Shellshooter.cs b/Items/Weapons/Ranged/Shellshooter.cs index 8485edfeb8..bf84aa898a 100644 --- a/Items/Weapons/Ranged/Shellshooter.cs +++ b/Items/Weapons/Ranged/Shellshooter.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 33; - item.ranged = true; - item.width = 30; - item.height = 38; - item.useTime = 70; - item.useAnimation = 70; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1.5f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 33; + Item.DamageType = DamageClass.Ranged; + Item.width = 30; + Item.height = 38; + Item.useTime = 70; + Item.useAnimation = 70; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1.5f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Ranged/Shredder.cs b/Items/Weapons/Ranged/Shredder.cs index b8a48fc74e..d636b9380d 100644 --- a/Items/Weapons/Ranged/Shredder.cs +++ b/Items/Weapons/Ranged/Shredder.cs @@ -19,24 +19,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 27; - item.ranged = true; - item.width = 56; - item.height = 24; - item.useTime = 4; - item.reuseDelay = 12; - item.useAnimation = 32; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shoot = ProjectileID.Bullet; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 27; + Item.DamageType = DamageClass.Ranged; + Item.width = 56; + Item.height = 24; + Item.useTime = 4; + Item.reuseDelay = 12; + Item.useAnimation = 32; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item31; + Item.autoReuse = true; + Item.shoot = ProjectileID.Bullet; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); @@ -73,16 +73,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Shotgun); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Shotgun).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/Shroomer.cs b/Items/Weapons/Ranged/Shroomer.cs index eae78a77f4..4d678db918 100644 --- a/Items/Weapons/Ranged/Shroomer.cs +++ b/Items/Weapons/Ranged/Shroomer.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 150; - item.ranged = true; - item.width = 90; - item.height = 28; - item.useTime = 27; - item.useAnimation = 27; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 9.75f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item40; - item.autoReuse = true; - item.shoot = ProjectileID.Bullet; - item.shootSpeed = 10f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 150; + Item.DamageType = DamageClass.Ranged; + Item.width = 90; + Item.height = 28; + Item.useTime = 27; + Item.useAnimation = 27; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 9.75f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item40; + Item.autoReuse = true; + Item.shoot = ProjectileID.Bullet; + Item.shootSpeed = 10f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -48,13 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SniperRifle); - recipe.AddIngredient(ItemID.ShroomiteBar, 11); - recipe.AddIngredient(ItemID.FragmentVortex, 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SniperRifle).AddIngredient(ItemID.ShroomiteBar, 11).AddIngredient(ItemID.FragmentVortex, 15).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/SlagMagnum.cs b/Items/Weapons/Ranged/SlagMagnum.cs index e2e011213b..009d37a0dd 100644 --- a/Items/Weapons/Ranged/SlagMagnum.cs +++ b/Items/Weapons/Ranged/SlagMagnum.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 24; - item.ranged = true; - item.width = 58; - item.height = 24; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 24; + Item.DamageType = DamageClass.Ranged; + Item.width = 58; + Item.height = 24; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item41; + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/SomaPrime.cs b/Items/Weapons/Ranged/SomaPrime.cs index 66532b46c4..99821949dd 100644 --- a/Items/Weapons/Ranged/SomaPrime.cs +++ b/Items/Weapons/Ranged/SomaPrime.cs @@ -25,24 +25,24 @@ Replaces standard bullets with High Velocity Bullets public override void SetDefaults() { - item.damage = 130; - item.ranged = true; - item.width = 94; - item.height = 34; - item.useTime = item.useAnimation = 5; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.UseSound = SoundID.Item40; - item.autoReuse = true; - item.shoot = ProjectileID.BulletHighVelocity; - item.shootSpeed = 9f; - item.useAmmo = AmmoID.Bullet; + Item.damage = 130; + Item.DamageType = DamageClass.Ranged; + Item.width = 94; + Item.height = 34; + Item.useTime = Item.useAnimation = 5; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.UseSound = SoundID.Item40; + Item.autoReuse = true; + Item.shoot = ProjectileID.BulletHighVelocity; + Item.shootSpeed = 9f; + Item.useAmmo = AmmoID.Bullet; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; - item.Calamity().canFirePointBlankShots = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -52,13 +52,7 @@ Replaces standard bullets with High Velocity Bullets public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/SparkSpreader.cs b/Items/Weapons/Ranged/SparkSpreader.cs index 7a4645a6e0..b899229d69 100644 --- a/Items/Weapons/Ranged/SparkSpreader.cs +++ b/Items/Weapons/Ranged/SparkSpreader.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 7; - item.knockBack = 1f; - item.ranged = true; - item.autoReuse = true; - item.useTime = 10; - item.useAnimation = 30; - item.useAmmo = AmmoID.Gel; - item.shootSpeed = 5f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 7; + Item.knockBack = 1f; + Item.DamageType = DamageClass.Ranged; + Item.autoReuse = true; + Item.useTime = 10; + Item.useAnimation = 30; + Item.useAmmo = AmmoID.Gel; + Item.shootSpeed = 5f; + Item.shoot = ModContent.ProjectileType(); - item.width = 52; - item.height = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; + Item.width = 52; + Item.height = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.UseSound = SoundID.Item34; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; } public override Vector2? HoldoutOffset() => new Vector2(-4, 0); @@ -41,13 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FlareGun); - recipe.AddIngredient(ItemID.Ruby); - recipe.AddIngredient(ItemID.Gel, 12); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.FlareGun).AddIngredient(ItemID.Ruby).AddIngredient(ItemID.Gel, 12).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/SpectralstormCannon.cs b/Items/Weapons/Ranged/SpectralstormCannon.cs index fba5da3023..1c56c2ed5a 100644 --- a/Items/Weapons/Ranged/SpectralstormCannon.cs +++ b/Items/Weapons/Ranged/SpectralstormCannon.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 48; - item.ranged = true; - item.width = 66; - item.height = 26; - item.useTime = 4; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = ProjectileID.Flare; - item.shootSpeed = 9.5f; - item.useAmmo = AmmoID.Flare; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 48; + Item.DamageType = DamageClass.Ranged; + Item.width = 66; + Item.height = 26; + Item.useTime = 4; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 1.5f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shoot = ProjectileID.Flare; + Item.shootSpeed = 9.5f; + Item.useAmmo = AmmoID.Flare; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -70,13 +70,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.FragmentVortex, 20); - recipe.AddIngredient(ItemID.Ectoplasm, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.FragmentVortex, 20).AddIngredient(ItemID.Ectoplasm, 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/SpectreRifle.cs b/Items/Weapons/Ranged/SpectreRifle.cs index b7099f03a5..7c42341872 100644 --- a/Items/Weapons/Ranged/SpectreRifle.cs +++ b/Items/Weapons/Ranged/SpectreRifle.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 150; - item.ranged = true; - item.width = 88; - item.height = 30; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item40; - item.autoReuse = false; - item.shoot = ProjectileID.LostSoulFriendly; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 150; + Item.DamageType = DamageClass.Ranged; + Item.width = 88; + Item.height = 30; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item40; + Item.autoReuse = false; + Item.shoot = ProjectileID.LostSoulFriendly; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -56,12 +56,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpectreBar, 7); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpectreBar, 7).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/Spyker.cs b/Items/Weapons/Ranged/Spyker.cs index 46b30f43bb..53bdf86e07 100644 --- a/Items/Weapons/Ranged/Spyker.cs +++ b/Items/Weapons/Ranged/Spyker.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 150; - item.ranged = true; - item.width = 44; - item.height = 26; - item.useTime = 13; - item.useAnimation = 13; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item108; - item.autoReuse = true; - item.shootSpeed = 9f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Bullet; + Item.damage = 150; + Item.DamageType = DamageClass.Ranged; + Item.width = 44; + Item.height = 26; + Item.useTime = 13; + Item.useAnimation = 13; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.Item108; + Item.autoReuse = true; + Item.shootSpeed = 9f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() @@ -53,13 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Stynger); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Stynger).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/StarCannonEX.cs b/Items/Weapons/Ranged/StarCannonEX.cs index a71b428b51..9c48ba82db 100644 --- a/Items/Weapons/Ranged/StarCannonEX.cs +++ b/Items/Weapons/Ranged/StarCannonEX.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 95; - item.ranged = true; - item.width = 74; - item.height = 24; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = ItemUseStyleID.HoldingOut; - item.rare = ItemRarityID.Lime; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.useAmmo = AmmoID.FallenStar; + Item.damage = 95; + Item.DamageType = DamageClass.Ranged; + Item.width = 74; + Item.height = 24; + Item.useTime = 10; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Shoot; + Item.rare = ItemRarityID.Lime; + Item.noMelee = true; + Item.knockBack = 8f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.UseSound = SoundID.Item9; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.useAmmo = AmmoID.FallenStar; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); @@ -61,13 +61,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.StarCannon); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.StarCannon).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 25).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/StarSputter.cs b/Items/Weapons/Ranged/StarSputter.cs index b48a29f7c5..6951dc0e30 100644 --- a/Items/Weapons/Ranged/StarSputter.cs +++ b/Items/Weapons/Ranged/StarSputter.cs @@ -20,23 +20,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 112; - item.ranged = true; - item.width = 80; - item.height = 26; - item.useTime = 8; - item.reuseDelay = 15; - item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 15f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.useAmmo = AmmoID.FallenStar; + Item.damage = 112; + Item.DamageType = DamageClass.Ranged; + Item.width = 80; + Item.height = 26; + Item.useTime = 8; + Item.reuseDelay = 15; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 15f; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.UseSound = SoundID.Item92; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.useAmmo = AmmoID.FallenStar; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Starfleet.cs b/Items/Weapons/Ranged/Starfleet.cs index 843af6a66b..10b4939f04 100644 --- a/Items/Weapons/Ranged/Starfleet.cs +++ b/Items/Weapons/Ranged/Starfleet.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 68; - item.ranged = true; - item.width = 76; - item.height = 36; - item.useTime = 55; - item.useAnimation = 55; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 15f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.useAmmo = AmmoID.FallenStar; + Item.damage = 68; + Item.DamageType = DamageClass.Ranged; + Item.width = 76; + Item.height = 36; + Item.useTime = 55; + Item.useAnimation = 55; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 15f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item92; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.FallenStar; } public override Vector2? HoldoutOffset() @@ -52,13 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.ElectrosphereLauncher); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.ElectrosphereLauncher).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/StarfleetMK2.cs b/Items/Weapons/Ranged/StarfleetMK2.cs index 4a994de9b3..09a582a1a5 100644 --- a/Items/Weapons/Ranged/StarfleetMK2.cs +++ b/Items/Weapons/Ranged/StarfleetMK2.cs @@ -19,30 +19,30 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 135; - item.knockBack = 15f; - item.shootSpeed = 16f; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useAnimation = 27; - item.useTime = 27; - item.reuseDelay = 0; - item.width = 122; - item.height = 50; - item.UseSound = SoundID.Item92; - item.shoot = ModContent.ProjectileType(); - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.useTurn = false; - item.useAmmo = AmmoID.FallenStar; - item.autoReuse = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.damage = 135; + Item.knockBack = 15f; + Item.shootSpeed = 16f; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useAnimation = 27; + Item.useTime = 27; + Item.reuseDelay = 0; + Item.width = 122; + Item.height = 50; + Item.UseSound = SoundID.Item92; + Item.shoot = ModContent.ProjectileType(); + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Ranged; + Item.channel = true; + Item.useTurn = false; + Item.useAmmo = AmmoID.FallenStar; + Item.autoReuse = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override Vector2? HoldoutOffset() { @@ -57,15 +57,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/StellarCannon.cs b/Items/Weapons/Ranged/StellarCannon.cs index b1cbb29080..bd90072c15 100644 --- a/Items/Weapons/Ranged/StellarCannon.cs +++ b/Items/Weapons/Ranged/StellarCannon.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 175; - item.ranged = true; - item.width = 50; - item.height = 30; - item.useTime = 40; - item.useAnimation = 40; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 2f; + Item.damage = 175; + Item.DamageType = DamageClass.Ranged; + Item.width = 50; + Item.height = 30; + Item.useTime = 40; + Item.useAnimation = 40; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item92; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 2f; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/StormDragoon.cs b/Items/Weapons/Ranged/StormDragoon.cs index 8afe54e6ba..5aa7087c7b 100644 --- a/Items/Weapons/Ranged/StormDragoon.cs +++ b/Items/Weapons/Ranged/StormDragoon.cs @@ -16,25 +16,25 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 62; - item.ranged = true; - item.width = 74; - item.height = 34; - item.useTime = 2; - item.reuseDelay = 10; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.25f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 18f; - item.useAmmo = AmmoID.Bullet; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 62; + Item.DamageType = DamageClass.Ranged; + Item.width = 74; + Item.height = 34; + Item.useTime = 2; + Item.reuseDelay = 10; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.25f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.Item31; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 18f; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/StormSurge.cs b/Items/Weapons/Ranged/StormSurge.cs index 92e3e3e4bf..2fd7d32f71 100644 --- a/Items/Weapons/Ranged/StormSurge.cs +++ b/Items/Weapons/Ranged/StormSurge.cs @@ -19,21 +19,21 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 22; - item.ranged = true; - item.width = 58; - item.height = 22; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.UseSound = SoundID.Item122; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.autoReuse = true; //GRRRRRRRRRRRRRRRR false begone - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.damage = 22; + Item.DamageType = DamageClass.Ranged; + Item.width = 58; + Item.height = 22; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item122; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.autoReuse = true; //GRRRRRRRRRRRRRRRR false begone + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override Vector2? HoldoutOffset() @@ -43,13 +43,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/SulphuricAcidCannon.cs b/Items/Weapons/Ranged/SulphuricAcidCannon.cs index 0b72f82ba8..5bdfed92dd 100644 --- a/Items/Weapons/Ranged/SulphuricAcidCannon.cs +++ b/Items/Weapons/Ranged/SulphuricAcidCannon.cs @@ -15,22 +15,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 144; - item.ranged = true; - item.width = 90; - item.height = 30; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 6f; - item.autoReuse = true; - item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item95; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.damage = 144; + Item.DamageType = DamageClass.Ranged; + Item.width = 90; + Item.height = 30; + Item.useTime = 18; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 6f; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item95; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override Vector2? HoldoutOffset() => Vector2.UnitX * -15f; diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs index d99a80afcc..609337cd52 100644 --- a/Items/Weapons/Ranged/SurgeDriver.cs +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 156; - item.ranged = true; - item.width = 164; - item.height = 58; - item.useTime = item.useAnimation = 56; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.channel = true; - item.knockBack = 8f; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11f; - item.useAmmo = AmmoID.Bullet; + Item.damage = 156; + Item.DamageType = DamageClass.Ranged; + Item.width = 164; + Item.height = 58; + Item.useTime = Item.useAnimation = 56; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.channel = true; + Item.knockBack = 8f; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; + Item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() => new Vector2(-50f, -8f); @@ -47,13 +47,13 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.Calamity().mouseRight && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) { - item.noUseGraphic = false; - item.reuseDelay = 0; + Item.noUseGraphic = false; + Item.reuseDelay = 0; } else { - item.noUseGraphic = true; - item.reuseDelay = 28; + Item.noUseGraphic = true; + Item.reuseDelay = 28; } } @@ -65,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Vector2 shootVelocity = new Vector2(speedX, speedY); Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); - Vector2 gunTip = position + shootDirection * item.scale * 126f; + Vector2 gunTip = position + shootDirection * Item.scale * 126f; gunTip.Y -= 6f; // Large bullet/rocket releasing. @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Vector2 newShootVelocity = shootVelocity * Main.rand.NextFloat(1f, 1.45f); newShootVelocity = newShootVelocity.RotatedByRandom(0.15f); - Projectile.NewProjectile(gunTip, newShootVelocity, item.shoot, (int)(damage * 1.08), knockBack, player.whoAmI); + Projectile.NewProjectile(gunTip, newShootVelocity, Item.shoot, (int)(damage * 1.08), knockBack, player.whoAmI); } } diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index 37b9a3dbc3..406fc5936c 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -19,26 +19,26 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 150; - item.ranged = true; - item.width = 60; - item.height = 26; - item.useAnimation = 24; - item.reuseDelay = 10; - item.useTime = 2; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; + Item.damage = 150; + Item.DamageType = DamageClass.Ranged; + Item.width = 60; + Item.height = 26; + Item.useAnimation = 24; + Item.reuseDelay = 10; + Item.useTime = 2; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ProjectileID.PurificationPowder; - item.useAmmo = AmmoID.Bullet; + Item.UseSound = SoundID.Item31; + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ProjectileID.PurificationPowder; + Item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() @@ -56,10 +56,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int i = Main.myPlayer; - float sSpeed = item.shootSpeed; + float sSpeed = Item.shootSpeed; float knockback = knockBack; - knockback = player.GetWeaponKnockback(item, knockback); - player.itemTime = item.useTime; + knockback = player.GetWeaponKnockback(Item, knockback); + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -98,15 +98,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofMight, 10); - recipe.AddIngredient(ItemID.SoulofSight, 10); - recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofMight, 10).AddIngredient(ItemID.SoulofSight, 10).AddIngredient(ItemID.SoulofFright, 10).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/TelluricGlare.cs b/Items/Weapons/Ranged/TelluricGlare.cs index 739e9290ac..6f80b794bf 100644 --- a/Items/Weapons/Ranged/TelluricGlare.cs +++ b/Items/Weapons/Ranged/TelluricGlare.cs @@ -16,27 +16,27 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 176; - item.ranged = true; - item.width = 54; - item.height = 92; - item.useTime = 5; - item.useAnimation = 20; - item.reuseDelay = 23; - item.knockBack = 7.5f; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; + Item.damage = 176; + Item.DamageType = DamageClass.Ranged; + Item.width = 54; + Item.height = 92; + Item.useTime = 5; + Item.useAnimation = 20; + Item.reuseDelay = 23; + Item.knockBack = 7.5f; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.UseSound = SoundID.Item102; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-14f, 0f); @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { // Always fires Radiant Arrows regardless of ammo used - type = item.shoot; + type = Item.shoot; // The arrow appears from a random location "on the bow". // They are also moved backwards so that they have some time to build up past positions. This helps make them not appear out of thin air. diff --git a/Items/Weapons/Ranged/TerraFlameburster.cs b/Items/Weapons/Ranged/TerraFlameburster.cs index e4e01279e5..9299899556 100644 --- a/Items/Weapons/Ranged/TerraFlameburster.cs +++ b/Items/Weapons/Ranged/TerraFlameburster.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 43; - item.ranged = true; - item.width = 68; - item.height = 22; - item.useTime = 3; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.25f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7.5f; - item.useAmmo = AmmoID.Gel; + Item.damage = 43; + Item.DamageType = DamageClass.Ranged; + Item.width = 68; + Item.height = 22; + Item.useTime = 3; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.25f; + Item.UseSound = SoundID.Item34; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7.5f; + Item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() @@ -49,13 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Flamethrower); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Flamethrower).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/TheBallista.cs b/Items/Weapons/Ranged/TheBallista.cs index 530d0a6f2f..04bdb94fe3 100644 --- a/Items/Weapons/Ranged/TheBallista.cs +++ b/Items/Weapons/Ranged/TheBallista.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 99; - item.ranged = true; - item.width = 40; - item.height = 70; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 99; + Item.DamageType = DamageClass.Ranged; + Item.width = 40; + Item.height = 70; + Item.useTime = 22; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 8f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -47,13 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Marrow); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); - recipe.AddIngredient(ItemID.Ectoplasm, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Marrow).AddIngredient(ItemID.AncientBattleArmorMaterial).AddIngredient(ItemID.Ectoplasm, 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/TheEmpyrean.cs b/Items/Weapons/Ranged/TheEmpyrean.cs index f5058c8201..ead183a1a3 100644 --- a/Items/Weapons/Ranged/TheEmpyrean.cs +++ b/Items/Weapons/Ranged/TheEmpyrean.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 80; - item.ranged = true; - item.width = 70; - item.height = 24; - item.useTime = 6; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; - item.useAmmo = AmmoID.Gel; + Item.damage = 80; + Item.DamageType = DamageClass.Ranged; + Item.width = 70; + Item.height = 24; + Item.useTime = 6; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.UseSound = SoundID.Item34; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; + Item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() @@ -49,11 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/TheHive.cs b/Items/Weapons/Ranged/TheHive.cs index 7342831ce4..3a84e42d28 100644 --- a/Items/Weapons/Ranged/TheHive.cs +++ b/Items/Weapons/Ranged/TheHive.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 80; - item.ranged = true; - item.width = 62; - item.height = 30; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item61; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; - item.useAmmo = AmmoID.Rocket; + Item.damage = 80; + Item.DamageType = DamageClass.Ranged; + Item.width = 62; + Item.height = 30; + Item.useTime = 21; + Item.useAnimation = 21; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item61; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13f; + Item.useAmmo = AmmoID.Rocket; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); diff --git a/Items/Weapons/Ranged/TheJailor.cs b/Items/Weapons/Ranged/TheJailor.cs index c6e9cd92cc..c40de0b7a2 100644 --- a/Items/Weapons/Ranged/TheJailor.cs +++ b/Items/Weapons/Ranged/TheJailor.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 360; - item.ranged = true; - item.width = 102; - item.height = 70; - item.useTime = item.useAnimation = 28; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 8f; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.UseSound = SoundID.Item14; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14.5f; - item.useAmmo = AmmoID.Bullet; + Item.damage = 360; + Item.DamageType = DamageClass.Ranged; + Item.width = 102; + Item.height = 70; + Item.useTime = Item.useAnimation = 28; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 8f; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.UseSound = SoundID.Item14; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14.5f; + Item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() => new Vector2(-40f, -16f); @@ -40,9 +40,9 @@ namespace CalamityMod.Items.Weapons.Ranged { Vector2 shootVelocity = new Vector2(speedX, speedY); Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); - Vector2 gunTip = position + shootDirection * item.scale * 45f; + Vector2 gunTip = position + shootDirection * Item.scale * 45f; - Projectile.NewProjectile(gunTip, shootVelocity, item.shoot, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(gunTip, shootVelocity, Item.shoot, damage, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/TheMaelstrom.cs b/Items/Weapons/Ranged/TheMaelstrom.cs index 2c8a58dfb4..e12b479172 100644 --- a/Items/Weapons/Ranged/TheMaelstrom.cs +++ b/Items/Weapons/Ranged/TheMaelstrom.cs @@ -18,25 +18,25 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 397; - item.width = 20; - item.height = 12; - item.useTime = 45; - item.useAnimation = 45; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 3f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 397; + Item.width = 20; + Item.height = 12; + Item.useTime = 45; + Item.useAnimation = 45; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 3f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Ranged; + Item.channel = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -47,14 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 50).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/ThePack.cs b/Items/Weapons/Ranged/ThePack.cs index d74a78ba1b..ebfa542ab2 100644 --- a/Items/Weapons/Ranged/ThePack.cs +++ b/Items/Weapons/Ranged/ThePack.cs @@ -18,24 +18,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 1000; - item.ranged = true; - item.width = 96; - item.height = 40; - item.useTime = 52; - item.useAnimation = 52; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Rocket; + Item.damage = 1000; + Item.DamageType = DamageClass.Ranged; + Item.width = 96; + Item.height = 40; + Item.useTime = 52; + Item.useAnimation = 52; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7.5f; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shootSpeed = 24f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Rocket; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().donorItem = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -51,15 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.MarbleBlock, 50); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.MarbleBlock, 50).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/TheStorm.cs b/Items/Weapons/Ranged/TheStorm.cs index db94a77d51..73c293ff52 100644 --- a/Items/Weapons/Ranged/TheStorm.cs +++ b/Items/Weapons/Ranged/TheStorm.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 24; - item.ranged = true; - item.width = 34; - item.height = 50; - item.useTime = 7; - item.useAnimation = 14; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item122; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 28f; - item.useAmmo = AmmoID.Arrow; + Item.damage = 24; + Item.DamageType = DamageClass.Ranged; + Item.width = 34; + Item.height = 50; + Item.useTime = 7; + Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.Item122; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 28f; + Item.useAmmo = AmmoID.Arrow; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -42,8 +42,8 @@ namespace CalamityMod.Items.Weapons.Ranged int i = Main.myPlayer; float num72 = Main.rand.Next(25, 30); float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; + num74 = player.GetWeaponKnockback(Item, num74); + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Ranged/TitaniumRailgun.cs b/Items/Weapons/Ranged/TitaniumRailgun.cs index e8e2e65b88..087270b42c 100644 --- a/Items/Weapons/Ranged/TitaniumRailgun.cs +++ b/Items/Weapons/Ranged/TitaniumRailgun.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 100; - item.ranged = true; - item.width = 62; - item.height = 32; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item72; - item.autoReuse = true; - item.shootSpeed = 6f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 100; + Item.DamageType = DamageClass.Ranged; + Item.width = 62; + Item.height = 32; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item72; + Item.autoReuse = true; + Item.shootSpeed = 6f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() @@ -41,18 +41,14 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 velocity = Vector2.Normalize(new Vector2(speedX, speedY)); - velocity *= item.shootSpeed; + velocity *= Item.shootSpeed; Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitaniumBar, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.TitaniumBar, 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/Toxibow.cs b/Items/Weapons/Ranged/Toxibow.cs index 15db136023..b00804c3c0 100644 --- a/Items/Weapons/Ranged/Toxibow.cs +++ b/Items/Weapons/Ranged/Toxibow.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 9; - item.ranged = true; - item.width = 20; - item.height = 54; - item.useTime = item.useAnimation = 35; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 15f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 9; + Item.DamageType = DamageClass.Ranged; + Item.width = 20; + Item.height = 54; + Item.useTime = Item.useAnimation = 35; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item5; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 15f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -48,12 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Ranged/Triploon.cs b/Items/Weapons/Ranged/Triploon.cs index 3bd5c23094..68c2eaa5b1 100644 --- a/Items/Weapons/Ranged/Triploon.cs +++ b/Items/Weapons/Ranged/Triploon.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 70; - item.ranged = true; - item.width = 46; - item.height = 24; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item10; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = ModContent.ProjectileType(); - item.Calamity().canFirePointBlankShots = true; + Item.damage = 70; + Item.DamageType = DamageClass.Ranged; + Item.width = 46; + Item.height = 24; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 7.5f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item10; + Item.autoReuse = true; + Item.shootSpeed = 20f; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -65,15 +65,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Harpoon); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Harpoon).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Ranged/TrueConferenceCall.cs b/Items/Weapons/Ranged/TrueConferenceCall.cs index 7e29994d07..5c56f5432f 100644 --- a/Items/Weapons/Ranged/TrueConferenceCall.cs +++ b/Items/Weapons/Ranged/TrueConferenceCall.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 32; - item.ranged = true; - item.width = 66; - item.height = 26; - item.useTime = 32; - item.useAnimation = 32; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4.5f; - item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = ItemRarityID.Cyan; - item.UseSound = SoundID.Item38; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ProjectileID.PurificationPowder; - item.useAmmo = AmmoID.Bullet; + Item.damage = 32; + Item.DamageType = DamageClass.Ranged; + Item.width = 66; + Item.height = 26; + Item.useTime = 32; + Item.useAnimation = 32; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4.5f; + Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.rare = ItemRarityID.Cyan; + Item.UseSound = SoundID.Item38; + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ProjectileID.PurificationPowder; + Item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() @@ -92,7 +92,7 @@ namespace CalamityMod.Items.Weapons.Ranged vector2.X = (vector2.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); vector2.Y -= 100 * j; - Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[j]].Center - vector2) * item.shootSpeed; + Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[j]].Center - vector2) * Item.shootSpeed; int proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); Main.projectile[proj].extraUpdates += 2; @@ -112,7 +112,7 @@ namespace CalamityMod.Items.Weapons.Ranged vector2.X = (vector2.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); vector2.Y -= 100 * randomTarget; - Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - vector2) * item.shootSpeed; + Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - vector2) * Item.shootSpeed; int proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); Main.projectile[proj].extraUpdates += 2; @@ -125,12 +125,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TacticalShotgun); - recipe.AddIngredient(ItemID.FragmentVortex, 7); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.TacticalShotgun).AddIngredient(ItemID.FragmentVortex, 7).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs index c75bbe04e5..15ca59fd4d 100644 --- a/Items/Weapons/Ranged/TyrannysEnd.cs +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -20,26 +20,26 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 2250; - item.knockBack = 9.5f; - item.ranged = true; - item.useTime = 55; - item.useAnimation = 55; - item.shoot = ProjectileID.BulletHighVelocity; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Bullet; - item.autoReuse = true; + Item.damage = 2250; + Item.knockBack = 9.5f; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 55; + Item.useAnimation = 55; + Item.shoot = ProjectileID.BulletHighVelocity; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Bullet; + Item.autoReuse = true; - item.width = 94; - item.height = 32; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); + Item.width = 94; + Item.height = 32; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().donorItem = true; - item.Calamity().canFirePointBlankShots = true; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().donorItem = true; + Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -49,13 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index 8091eaa700..223ccd272a 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -23,27 +23,27 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 116; - item.ranged = true; - item.width = 44; - item.height = 58; - item.useTime = item.useAnimation = 8; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; - item.useAmmo = AmmoID.Arrow; - item.channel = true; - item.useTurn = false; - item.autoReuse = true; - item.noUseGraphic = true; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().donorItem = true; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 116; + Item.DamageType = DamageClass.Ranged; + Item.width = 44; + Item.height = 58; + Item.useTime = Item.useAnimation = 8; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.UseSound = SoundID.Item33; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; + Item.useAmmo = AmmoID.Arrow; + Item.channel = true; + Item.useTurn = false; + Item.autoReuse = true; + Item.noUseGraphic = true; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().donorItem = true; + Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -55,17 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool ConsumeAmmo(Player player) => Main.rand.Next(0, 100) >= 90; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PulseBow); - recipe.AddIngredient(ItemID.LaserRifle); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.PulseBow).AddIngredient(ItemID.LaserRifle).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/UniversalGenesis.cs b/Items/Weapons/Ranged/UniversalGenesis.cs index 507afacced..4874f7763c 100644 --- a/Items/Weapons/Ranged/UniversalGenesis.cs +++ b/Items/Weapons/Ranged/UniversalGenesis.cs @@ -23,25 +23,25 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 192; - item.ranged = true; - item.useTime = item.useAnimation = 26; - item.knockBack = 6.5f; - item.useAmmo = AmmoID.Bullet; - item.shoot = ProjectileID.Bullet; - item.shootSpeed = 20f; - item.autoReuse = true; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 192; + Item.DamageType = DamageClass.Ranged; + Item.useTime = Item.useAnimation = 26; + Item.knockBack = 6.5f; + Item.useAmmo = AmmoID.Bullet; + Item.shoot = ProjectileID.Bullet; + Item.shootSpeed = 20f; + Item.autoReuse = true; + Item.Calamity().canFirePointBlankShots = true; - item.width = 158; - item.height = 60; - item.noMelee = true; - item.UseSound = SoundID.Item38; - item.useStyle = ItemUseStyleID.HoldingOut; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().donorItem = true; - item.Calamity().canFirePointBlankShots = true; + Item.width = 158; + Item.height = 60; + Item.noMelee = true; + Item.UseSound = SoundID.Item38; + Item.useStyle = ItemUseStyleID.Shoot; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().donorItem = true; + Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-50f, -8f); @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Vector2 shootVelocity = new Vector2(speedX, speedY); Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); - Vector2 gunTip = position + shootDirection * item.scale * 100f; + Vector2 gunTip = position + shootDirection * Item.scale * 100f; gunTip.Y -= 10f; float tightness = 1f; if (type == ProjectileID.Bullet) @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Ranged } // Stars from above - float speed = item.shootSpeed; + float speed = Item.shootSpeed; Vector2 spawnPos = player.RotatedRelativePoint(player.MountedCenter, true); int starAmt = 6; int starDmg = (int)(damage * 0.4); @@ -98,25 +98,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.StarCloak, 3); // and that's how you know it's a donor item - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - // but why - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.StarCloak, 3); // and that's how you know it's a donor item - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.StarCloak, 3).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.StarCloak, 3).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Ranged/Vortexpopper.cs b/Items/Weapons/Ranged/Vortexpopper.cs index 4f0e6c22cf..1b1d01a7f3 100644 --- a/Items/Weapons/Ranged/Vortexpopper.cs +++ b/Items/Weapons/Ranged/Vortexpopper.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 30; - item.ranged = true; - item.width = 46; - item.height = 22; - item.useTime = 16; - item.useAnimation = 16; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.25f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item95; - item.autoReuse = true; - item.shootSpeed = 50f; - item.shoot = ProjectileID.Xenopopper; - item.useAmmo = AmmoID.Bullet; + Item.damage = 30; + Item.DamageType = DamageClass.Ranged; + Item.width = 46; + Item.height = 22; + Item.useTime = 16; + Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.25f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item95; + Item.autoReuse = true; + Item.shootSpeed = 50f; + Item.shoot = ProjectileID.Xenopopper; + Item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Ranged } num78 *= num80; num79 *= num80; - Vector2 value6 = Vector2.Normalize(new Vector2(num78, num79)) * 40f * item.scale; + Vector2 value6 = Vector2.Normalize(new Vector2(num78, num79)) * 40f * Item.scale; if (Collision.CanHit(vector2, 0, 0, vector2 + value6, 0, 0)) { } @@ -106,12 +106,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Xenopopper); - recipe.AddIngredient(ItemID.FragmentVortex, 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Xenopopper).AddIngredient(ItemID.FragmentVortex, 20).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Ranged/WulfrumBow.cs b/Items/Weapons/Ranged/WulfrumBow.cs index ea6ea2de5a..c03e3c8fc0 100644 --- a/Items/Weapons/Ranged/WulfrumBow.cs +++ b/Items/Weapons/Ranged/WulfrumBow.cs @@ -14,32 +14,28 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 11; - item.ranged = true; - item.width = 27; - item.height = 38; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item5; - item.autoReuse = false; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 12f; - item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; + Item.damage = 11; + Item.DamageType = DamageClass.Ranged; + Item.width = 27; + Item.height = 38; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item5; + Item.autoReuse = false; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Arrow; + Item.Calamity().canFirePointBlankShots = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/AccretionDisk.cs b/Items/Weapons/Rogue/AccretionDisk.cs index 10fc56876b..d570a0c637 100644 --- a/Items/Weapons/Rogue/AccretionDisk.cs +++ b/Items/Weapons/Rogue/AccretionDisk.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 38; - item.damage = 100; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.height = 38; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; - item.Calamity().rogue = true; + Item.width = 38; + Item.damage = 100; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 15; + Item.knockBack = 9f; + Item.UseSound = SoundID.Item1; + Item.height = 38; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -56,16 +56,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Rogue/AcidicRainBarrel.cs b/Items/Weapons/Rogue/AcidicRainBarrel.cs index a2c36d4323..83c0c2f8a4 100644 --- a/Items/Weapons/Rogue/AcidicRainBarrel.cs +++ b/Items/Weapons/Rogue/AcidicRainBarrel.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 48; - item.height = 48; - item.damage = 43; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = 22; - item.useTime = 22; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; - item.Calamity().rogue = true; + Item.width = 48; + Item.height = 48; + Item.damage = 43; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = 22; + Item.useTime = 22; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -47,13 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs index da5343961b..87aa437492 100644 --- a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs +++ b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs @@ -15,24 +15,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 26; - item.damage = 44; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 12; - item.knockBack = 3.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 30; - item.maxStack = 999; - item.value = 1600; - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 26; + Item.damage = 44; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 12; + Item.knockBack = 3.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 30; + Item.maxStack = 999; + Item.value = 1600; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -52,11 +52,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AdamantiteBar); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.AdamantiteBar).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/AlphaVirus.cs b/Items/Weapons/Rogue/AlphaVirus.cs index eecf7c2c8f..2786c0bd6a 100644 --- a/Items/Weapons/Rogue/AlphaVirus.cs +++ b/Items/Weapons/Rogue/AlphaVirus.cs @@ -18,31 +18,31 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 333; - item.width = 44; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 31; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 31; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; - item.maxStack = 1; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 4f; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().rogue = true; + Item.damage = 333; + Item.width = 44; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 31; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 31; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 44; + Item.maxStack = 1; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 4f; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().rogue = true; } 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.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, item.shootSpeed, 0f); + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, Item.shootSpeed, 0f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; @@ -53,13 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index 5760d02d8e..e75131a990 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -21,22 +21,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 120; - item.shootSpeed = 15f; - item.shoot = ModContent.ProjectileType(); - item.width = 66; - item.height = 64; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 10f; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item1; - item.noMelee = true; - item.noUseGraphic = true; - item.Calamity().rogue = true; - item.autoReuse = true; + Item.damage = 120; + Item.shootSpeed = 15f; + Item.shoot = ModContent.ProjectileType(); + Item.width = 66; + Item.height = 64; + Item.useTime = 24; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 10f; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item1; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.Calamity().rogue = true; + Item.autoReuse = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -57,19 +57,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 100); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 100).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.MythrilAnvil).Register(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ApoctolithGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/ApoctolithGlow")); } } } diff --git a/Items/Weapons/Rogue/AshenStalactite.cs b/Items/Weapons/Rogue/AshenStalactite.cs index 4860f2b041..dd8bcb3187 100644 --- a/Items/Weapons/Rogue/AshenStalactite.cs +++ b/Items/Weapons/Rogue/AshenStalactite.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 36; - item.height = 34; - item.damage = 37; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.maxStack = 1; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Orange; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().rogue = true; + Item.width = 36; + Item.height = 34; + Item.damage = 37; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.maxStack = 1; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/AuroradicalThrow.cs b/Items/Weapons/Rogue/AuroradicalThrow.cs index 05cc49b363..0992859e6f 100644 --- a/Items/Weapons/Rogue/AuroradicalThrow.cs +++ b/Items/Weapons/Rogue/AuroradicalThrow.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 34; - item.height = 58; - item.damage = 32; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 30; - item.knockBack = 6f; - item.UseSound = SoundID.Item117; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.Calamity().rogue = true; + Item.width = 34; + Item.height = 58; + Item.damage = 32; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 30; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item117; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Main.itemTexture[item.type]); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Main.itemTexture[Item.type]); } } } diff --git a/Items/Weapons/Rogue/BallisticPoisonBomb.cs b/Items/Weapons/Rogue/BallisticPoisonBomb.cs index d9a0b82c6f..ff616310cf 100644 --- a/Items/Weapons/Rogue/BallisticPoisonBomb.cs +++ b/Items/Weapons/Rogue/BallisticPoisonBomb.cs @@ -20,22 +20,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 30; - item.damage = 50; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 26; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 26; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 38; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 30; + Item.damage = 50; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 26; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 26; + Item.knockBack = 6.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 38; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -58,14 +58,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/BlastBarrel.cs b/Items/Weapons/Rogue/BlastBarrel.cs index e4162e3b86..565438d191 100644 --- a/Items/Weapons/Rogue/BlastBarrel.cs +++ b/Items/Weapons/Rogue/BlastBarrel.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 48; - item.height = 48; - item.damage = BaseDamage; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = 22; - item.useTime = 22; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 12, 0, 0); //2 gold 40 silver sellprice - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 48; + Item.height = 48; + Item.damage = BaseDamage; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useAnimation = 22; + Item.useTime = 22; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 12, 0, 0); //2 gold 40 silver sellprice + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Rogue/BlazingStar.cs b/Items/Weapons/Rogue/BlazingStar.cs index 4856d6e514..bb94c35516 100644 --- a/Items/Weapons/Rogue/BlazingStar.cs +++ b/Items/Weapons/Rogue/BlazingStar.cs @@ -19,23 +19,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 129; - item.Calamity().rogue = true; - item.noMelee = true; - item.noUseGraphic = true; - item.width = 1; - item.height = 1; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item1; - item.maxStack = 4; + Item.damage = 129; + Item.Calamity().rogue = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.width = 1; + Item.height = 1; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item1; + Item.maxStack = 4; - item.shootSpeed = Speed; - item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = Speed; + Item.shoot = ModContent.ProjectileType(); } // Terraria seems to really dislike high crit values in SetDefaults @@ -45,13 +45,13 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - if (item.stack != 1) + if (Item.stack != 1) { damage = (int)(damage * 1.55f); - for (int i = 0; i < item.stack; i++) + for (int i = 0; i < Item.stack; i++) { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-MathHelper.ToRadians(8f), MathHelper.ToRadians(8f), i / (float)(item.stack - 1))); + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-MathHelper.ToRadians(8f), MathHelper.ToRadians(8f), i / (float)(Item.stack - 1))); Projectile proj = Projectile.NewProjectileDirect(position, perturbedSpeed, type, damage, knockBack, player.whoAmI); if (proj.whoAmI.WithinBounds(Main.maxProjectiles)) proj.Calamity().stealthStrike = true; @@ -70,16 +70,10 @@ namespace CalamityMod.Items.Weapons.Rogue return true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] < item.stack; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < Item.stack; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ItemID.HellstoneBar, 3); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ItemID.HellstoneBar, 3).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/BloodsoakedCrasher.cs b/Items/Weapons/Rogue/BloodsoakedCrasher.cs index 90f87a74ca..21ab5add3c 100644 --- a/Items/Weapons/Rogue/BloodsoakedCrasher.cs +++ b/Items/Weapons/Rogue/BloodsoakedCrasher.cs @@ -19,23 +19,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 245; - item.knockBack = 3f; - item.autoReuse = true; - item.Calamity().rogue = true; - item.useAnimation = item.useTime = 24; - item.shootSpeed = 9f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 245; + Item.knockBack = 3f; + Item.autoReuse = true; + Item.Calamity().rogue = true; + Item.useAnimation = Item.useTime = 24; + Item.shootSpeed = 9f; + Item.shoot = ModContent.ProjectileType(); - item.width = 66; - item.height = 64; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 66; + Item.height = 64; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -48,12 +48,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Rogue/BouncingBetty.cs b/Items/Weapons/Rogue/BouncingBetty.cs index 8a2cae0daf..32665d720c 100644 --- a/Items/Weapons/Rogue/BouncingBetty.cs +++ b/Items/Weapons/Rogue/BouncingBetty.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = BaseDamage; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 24; - item.useTime = 24; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.width = 16; - item.height = 22; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 4, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().rogue = true; + Item.damage = BaseDamage; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 24; + Item.useTime = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.width = 16; + Item.height = 22; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 0, 4, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Rogue/BouncingEyeball.cs b/Items/Weapons/Rogue/BouncingEyeball.cs index d0743247df..bf836541aa 100644 --- a/Items/Weapons/Rogue/BouncingEyeball.cs +++ b/Items/Weapons/Rogue/BouncingEyeball.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Items.Weapons.Rogue } public override void SafeSetDefaults() { - item.damage = BaseDamage; - item.width = 26; - item.height = 26; - item.useTime = 23; - item.useAnimation = 23; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 3.5f; - item.rare = ItemRarityID.Green; - item.value = Item.buyPrice(0, 2, 0, 0); - item.Calamity().rogue = true; - item.noUseGraphic = true; - item.UseSound = SoundID.Item1; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.autoReuse = true; + Item.damage = BaseDamage; + Item.width = 26; + Item.height = 26; + Item.useTime = 23; + Item.useAnimation = 23; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 3.5f; + Item.rare = ItemRarityID.Green; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.Calamity().rogue = true; + Item.noUseGraphic = true; + Item.UseSound = SoundID.Item1; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.autoReuse = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Rogue/BouncySpikyBall.cs b/Items/Weapons/Rogue/BouncySpikyBall.cs index b56c1aa236..10a4dadf4a 100644 --- a/Items/Weapons/Rogue/BouncySpikyBall.cs +++ b/Items/Weapons/Rogue/BouncySpikyBall.cs @@ -18,24 +18,24 @@ Stealth strikes provide a bigger boost after richocheting"); public override void SafeSetDefaults() { - item.width = 14; - item.damage = 10; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.consumable = true; - item.maxStack = 999; - item.height = 14; - item.value = Item.buyPrice(0, 0, 1, 0); - item.rare = ItemRarityID.Blue; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; - item.Calamity().rogue = true; + Item.width = 14; + Item.damage = 10; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.consumable = true; + Item.maxStack = 999; + Item.height = 14; + Item.value = Item.buyPrice(0, 0, 1, 0); + Item.rare = ItemRarityID.Blue; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -52,12 +52,7 @@ Stealth strikes provide a bigger boost after richocheting"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpikyBall, 20); - recipe.AddIngredient(ItemID.PinkGel); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 20); - recipe.AddRecipe(); + CreateRecipe(20).AddIngredient(ItemID.SpikyBall, 20).AddIngredient(ItemID.PinkGel).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Weapons/Rogue/BrackishFlask.cs b/Items/Weapons/Rogue/BrackishFlask.cs index 856abca3ab..6581dcdd04 100644 --- a/Items/Weapons/Rogue/BrackishFlask.cs +++ b/Items/Weapons/Rogue/BrackishFlask.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 28; - item.damage = 60; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 35; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 35; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item106; - item.autoReuse = true; - item.height = 30; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 28; + Item.damage = 60; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 35; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 35; + Item.knockBack = 6.5f; + Item.UseSound = SoundID.Item106; + Item.autoReuse = true; + Item.height = 30; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/Brimblade.cs b/Items/Weapons/Rogue/Brimblade.cs index 5d24032ad3..8046193a96 100644 --- a/Items/Weapons/Rogue/Brimblade.cs +++ b/Items/Weapons/Rogue/Brimblade.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 26; - item.damage = 28; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.height = 26; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 26; + Item.damage = 28; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.knockBack = 6.5f; + Item.UseSound = SoundID.Item1; + Item.height = 26; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -59,11 +59,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/BurningStrife.cs b/Items/Weapons/Rogue/BurningStrife.cs index 765ab79438..28804a155a 100644 --- a/Items/Weapons/Rogue/BurningStrife.cs +++ b/Items/Weapons/Rogue/BurningStrife.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 16; - item.height = 28; - item.UseSound = SoundID.Item1; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.autoReuse = true; - item.noUseGraphic = true; - item.noMelee = true; + Item.width = 16; + Item.height = 28; + Item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.autoReuse = true; + Item.noUseGraphic = true; + Item.noMelee = true; - item.useAnimation = 25; - item.useTime = 25; - item.damage = 96; - item.shootSpeed = 8f; - item.shoot = ModContent.ProjectileType(); + Item.useAnimation = 25; + Item.useTime = 25; + Item.damage = 96; + Item.shootSpeed = 8f; + Item.shoot = ModContent.ProjectileType(); - item.Calamity().rogue = true; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Rogue/CelestialReaper.cs b/Items/Weapons/Rogue/CelestialReaper.cs index ad21a8f0b4..734515a4e2 100644 --- a/Items/Weapons/Rogue/CelestialReaper.cs +++ b/Items/Weapons/Rogue/CelestialReaper.cs @@ -20,22 +20,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = BaseDamage; - item.width = 66; - item.height = 76; - item.useAnimation = 31; - item.useTime = 31; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6f; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item71; - item.autoReuse = true; - item.value = Item.buyPrice(platinum: 1); //sell price of 20 gold - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.Calamity().rogue = true; + Item.damage = BaseDamage; + Item.width = 66; + Item.height = 76; + Item.useAnimation = 31; + Item.useTime = 31; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6f; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item71; + Item.autoReuse = true; + Item.value = Item.buyPrice(platinum: 1); //sell price of 20 gold + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/Celestus.cs b/Items/Weapons/Rogue/Celestus.cs index 9eeb21e24a..97e642d958 100644 --- a/Items/Weapons/Rogue/Celestus.cs +++ b/Items/Weapons/Rogue/Celestus.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 280; - item.knockBack = 6f; - item.useAnimation = item.useTime = 22; - item.Calamity().rogue = true; - item.autoReuse = true; - item.shootSpeed = 25f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 280; + Item.knockBack = 6f; + Item.useAnimation = Item.useTime = 22; + Item.Calamity().rogue = true; + Item.autoReuse = true; + Item.shootSpeed = 25f; + Item.shoot = ModContent.ProjectileType(); - item.width = item.height = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.noMelee = true; - item.noUseGraphic = true; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = Item.height = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -50,16 +50,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Rogue/Cinquedea.cs b/Items/Weapons/Rogue/Cinquedea.cs index d72772bf9e..1b2213367d 100644 --- a/Items/Weapons/Rogue/Cinquedea.cs +++ b/Items/Weapons/Rogue/Cinquedea.cs @@ -20,22 +20,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = BaseDamage; - item.rare = ItemRarityID.Orange; - item.knockBack = Knockback; - item.autoReuse = true; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.width = 32; - item.height = 32; - item.UseSound = SoundID.Item1; - item.noMelee = true; - item.noUseGraphic = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; - item.value = Item.buyPrice(0, 4, 0, 0); - item.Calamity().rogue = true; + Item.damage = BaseDamage; + Item.rare = ItemRarityID.Orange; + Item.knockBack = Knockback; + Item.autoReuse = true; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.width = 32; + Item.height = 32; + Item.UseSound = SoundID.Item1; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = Speed; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Rogue/CobaltKunai.cs b/Items/Weapons/Rogue/CobaltKunai.cs index f532b471c0..fb61051941 100644 --- a/Items/Weapons/Rogue/CobaltKunai.cs +++ b/Items/Weapons/Rogue/CobaltKunai.cs @@ -15,24 +15,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 18; - item.damage = 50; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 12; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 40; - item.maxStack = 999; - item.value = 900; - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 18; + Item.damage = 50; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 12; + Item.knockBack = 2.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 40; + Item.maxStack = 999; + Item.value = 900; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -55,11 +55,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CobaltBar); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.CobaltBar).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/ConsecratedWater.cs b/Items/Weapons/Rogue/ConsecratedWater.cs index ec0e3526fb..837e12c46d 100644 --- a/Items/Weapons/Rogue/ConsecratedWater.cs +++ b/Items/Weapons/Rogue/ConsecratedWater.cs @@ -21,22 +21,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = BaseDamage; - item.width = 22; - item.height = 24; - item.useAnimation = 29; - item.useTime = 29; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4.5f; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item106; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().rogue = true; + Item.damage = BaseDamage; + Item.width = 22; + Item.height = 24; + Item.useAnimation = 29; + Item.useTime = 29; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4.5f; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item106; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -51,14 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HolyWater, 100); - recipe.AddRecipeGroup("AnyAdamantiteBar", 5); - recipe.AddIngredient(ItemID.CrystalShard, 10); - recipe.AddIngredient(ItemID.SoulofLight, 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HolyWater, 100).AddRecipeGroup("AnyAdamantiteBar", 5).AddIngredient(ItemID.CrystalShard, 10).AddIngredient(ItemID.SoulofLight, 7).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/ContaminatedBile.cs b/Items/Weapons/Rogue/ContaminatedBile.cs index f315d7b0e7..991a41961f 100644 --- a/Items/Weapons/Rogue/ContaminatedBile.cs +++ b/Items/Weapons/Rogue/ContaminatedBile.cs @@ -18,20 +18,20 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 9; - item.width = item.height = 24; - item.useAnimation = item.useTime = 31; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4.5f; - item.rare = ItemRarityID.Green; - item.value = Item.buyPrice(0, 2, 0, 0); - item.UseSound = SoundID.Item106; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().rogue = true; + Item.damage = 9; + Item.width = Item.height = 24; + Item.useAnimation = Item.useTime = 31; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4.5f; + Item.rare = ItemRarityID.Green; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.UseSound = SoundID.Item106; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -43,12 +43,7 @@ namespace CalamityMod.Items.Weapons.Rogue } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.Bottles); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.BottledWater).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Bottles).Register(); } } } diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index 825bb590c1..3d6315bc6a 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -21,23 +21,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 18; - item.height = 32; - item.damage = 98; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(gold: 80); - item.rare = ItemRarityID.Yellow; - item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8.5f; - item.Calamity().rogue = true; + Item.width = 18; + Item.height = 32; + Item.damage = 98; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 15; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(gold: 80); + Item.rare = ItemRarityID.Yellow; + Item.Calamity().donorItem = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8.5f; + Item.Calamity().rogue = true; } // Gains 10% of missing health as base damage. diff --git a/Items/Weapons/Rogue/CosmicKunai.cs b/Items/Weapons/Rogue/CosmicKunai.cs index 13d9ac27e4..701b62de1a 100644 --- a/Items/Weapons/Rogue/CosmicKunai.cs +++ b/Items/Weapons/Rogue/CosmicKunai.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Rogue { @@ -19,24 +20,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 26; - item.damage = 92; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 2; - item.useAnimation = 10; - item.reuseDelay = 1; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 5f; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.height = 48; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 28f; - item.Calamity().rogue = true; + Item.width = 26; + Item.damage = 92; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useTime = 2; + Item.useAnimation = 10; + Item.reuseDelay = 1; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item109; + Item.autoReuse = true; + Item.height = 48; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 28f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -46,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue { damage = (int)(damage * 3.21); Main.projectile[stealth].Calamity().stealthStrike = true; - Main.PlaySound(SoundID.Item73, player.position); + SoundEngine.PlaySound(SoundID.Item73, player.position); for (float i = 0; i < 5; i++) { float angle = MathHelper.TwoPi / 5f * i; @@ -55,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Rogue } counter++; - if (counter >= item.useAnimation / item.useTime) + if (counter >= Item.useAnimation / Item.useTime) counter = 0; return false; } diff --git a/Items/Weapons/Rogue/CraniumSmasher.cs b/Items/Weapons/Rogue/CraniumSmasher.cs index 061b1ac8fe..abf8de41ab 100644 --- a/Items/Weapons/Rogue/CraniumSmasher.cs +++ b/Items/Weapons/Rogue/CraniumSmasher.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 50; - item.height = 50; - item.damage = 120; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.Calamity().rogue = true; + Item.width = 50; + Item.height = 50; + Item.damage = 120; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 15; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item1; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/CrushsawCrasher.cs b/Items/Weapons/Rogue/CrushsawCrasher.cs index 1b71f1c3a6..5c8f257dc9 100644 --- a/Items/Weapons/Rogue/CrushsawCrasher.cs +++ b/Items/Weapons/Rogue/CrushsawCrasher.cs @@ -19,20 +19,20 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 38; - item.damage = 65; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 22; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11f; - item.Calamity().rogue = true; + Item.width = 38; + Item.damage = 65; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 22; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/CrystalPiercer.cs b/Items/Weapons/Rogue/CrystalPiercer.cs index c639d66dde..8bb0d10f05 100644 --- a/Items/Weapons/Rogue/CrystalPiercer.cs +++ b/Items/Weapons/Rogue/CrystalPiercer.cs @@ -18,24 +18,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 62; - item.damage = 52; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 17; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 17; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; - item.maxStack = 999; - item.value = 2500; - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.Calamity().rogue = true; + Item.width = 62; + Item.damage = 52; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 17; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 17; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 62; + Item.maxStack = 999; + Item.value = 2500; + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -57,11 +57,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/Crystalline.cs b/Items/Weapons/Rogue/Crystalline.cs index 5df04ff611..fefd183c32 100644 --- a/Items/Weapons/Rogue/Crystalline.cs +++ b/Items/Weapons/Rogue/Crystalline.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 44; - item.damage = 16; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.Calamity().rogue = true; + Item.width = 44; + Item.damage = 16; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 44; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -40,13 +40,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddIngredient(ItemID.Diamond, 3); - recipe.AddIngredient(ItemID.FallenStar, 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 50).AddIngredient(ItemID.Diamond, 3).AddIngredient(ItemID.FallenStar, 3).AddTile(TileID.Anvils).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/CursedDagger.cs b/Items/Weapons/Rogue/CursedDagger.cs index bba4375662..a4a5f52ff0 100644 --- a/Items/Weapons/Rogue/CursedDagger.cs +++ b/Items/Weapons/Rogue/CursedDagger.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 34; - item.damage = 34; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 16; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 16; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 34; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 34; + Item.damage = 34; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 16; + Item.knockBack = 4.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 34; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/DeepSeaDumbbell.cs b/Items/Weapons/Rogue/DeepSeaDumbbell.cs index 652f1c21c7..9995c17ad4 100644 --- a/Items/Weapons/Rogue/DeepSeaDumbbell.cs +++ b/Items/Weapons/Rogue/DeepSeaDumbbell.cs @@ -21,25 +21,25 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 38; - item.height = 24; - item.damage = 466; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 25; - item.useAnimation = 25; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.useTurn = false; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.Calamity().rogue = true; + Item.width = 38; + Item.height = 24; + Item.damage = 466; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 25; + Item.useAnimation = 25; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.useTurn = false; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.Calamity().rogue = true; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.Calamity().donorItem = true; } public override bool AltFunctionUse(Player player) => true; @@ -48,19 +48,19 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.altFunctionUse == 2) { - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = false; - item.noUseGraphic = false; - item.autoReuse = false; - item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = false; + Item.noUseGraphic = false; + Item.autoReuse = false; + Item.UseSound = SoundID.Item1; } else { - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.UseSound = SoundID.Item1; } return base.CanUseItem(player); } diff --git a/Items/Weapons/Rogue/DeepWounder.cs b/Items/Weapons/Rogue/DeepWounder.cs index 98862c6e5e..5b45298109 100644 --- a/Items/Weapons/Rogue/DeepWounder.cs +++ b/Items/Weapons/Rogue/DeepWounder.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 52; - item.damage = 106; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 23; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 23; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 48; - item.maxStack = 1; - item.rare = ItemRarityID.Lime; - item.value = Item.buyPrice(0, 60, 0, 0); - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; - item.Calamity().rogue = true; + Item.width = 52; + Item.damage = 106; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 23; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 23; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 48; + Item.maxStack = 1; + Item.rare = ItemRarityID.Lime; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Rogue float stealthSpeedMult = 1.5f; Vector2 velocity = new Vector2(speedX, speedY); velocity.Normalize(); - velocity *= item.shootSpeed * stealthSpeedMult; + velocity *= Item.shootSpeed * stealthSpeedMult; int p = Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) diff --git a/Items/Weapons/Rogue/DefectiveSphere.cs b/Items/Weapons/Rogue/DefectiveSphere.cs index 74035864c3..1310b9c3c6 100644 --- a/Items/Weapons/Rogue/DefectiveSphere.cs +++ b/Items/Weapons/Rogue/DefectiveSphere.cs @@ -21,37 +21,37 @@ Stealth strikes launch all 4 sphere types at once"); public override void SafeSetDefaults() { - item.width = 42; - item.height = 44; - item.damage = BaseDamage; - item.knockBack = 5f; - item.useAnimation = 13; - item.useTime = 13; - item.autoReuse = true; - item.noMelee = true; - item.noUseGraphic = true; - item.maxStack = 5; + Item.width = 42; + Item.height = 44; + Item.damage = BaseDamage; + Item.knockBack = 5f; + Item.useAnimation = 13; + Item.useTime = 13; + Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.maxStack = 5; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item15; //phaseblade sound effect + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item15; //phaseblade sound effect - item.value = Item.buyPrice(0, 16, 0, 0); - item.rare = ItemRarityID.Yellow; + Item.value = Item.buyPrice(0, 16, 0, 0); + Item.rare = ItemRarityID.Yellow; - item.Calamity().rogue = true; - item.shoot = ProjectileType(); - item.shootSpeed = Speed; + Item.Calamity().rogue = true; + Item.shoot = ProjectileType(); + Item.shootSpeed = Speed; } public override bool CanUseItem(Player player) { - int UseMax = item.stack; + int UseMax = Item.stack; if (player.Calamity().StealthStrikeAvailable()) { return true; } - else if ((player.ownedProjectileCounts[item.shoot] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()]) >= UseMax) + else if ((player.ownedProjectileCounts[Item.shoot] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()]) >= UseMax) { return false; } diff --git a/Items/Weapons/Rogue/DeificThunderbolt.cs b/Items/Weapons/Rogue/DeificThunderbolt.cs index 02867ed53b..55d7535c99 100644 --- a/Items/Weapons/Rogue/DeificThunderbolt.cs +++ b/Items/Weapons/Rogue/DeificThunderbolt.cs @@ -20,25 +20,25 @@ Stealth strikes summon more lightning and travel faster"); public override void SafeSetDefaults() { - item.damage = 466; - item.knockBack = 10f; + Item.damage = 466; + Item.knockBack = 10f; - item.width = 56; - item.height = 56; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.noUseGraphic = true; + Item.width = 56; + Item.height = 56; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.noUseGraphic = true; - item.useTime = 21; - item.useAnimation = 21; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().rogue = true; + Item.useTime = 21; + Item.useAnimation = 21; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().rogue = true; - item.autoReuse = true; - item.shootSpeed = 13.69f; - item.shoot = ModContent.ProjectileType(); + Item.autoReuse = true; + Item.shootSpeed = 13.69f; + Item.shoot = ModContent.ProjectileType(); } // Terraria seems to really dislike high crit values in SetDefaults @@ -63,14 +63,7 @@ Stealth strikes summon more lightning and travel faster"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Rogue/DesecratedWater.cs b/Items/Weapons/Rogue/DesecratedWater.cs index d7374ae0b7..cfe7e389ac 100644 --- a/Items/Weapons/Rogue/DesecratedWater.cs +++ b/Items/Weapons/Rogue/DesecratedWater.cs @@ -18,22 +18,22 @@ Stealth strikes spawn additional bubbles that inflict Ichor and Cursed Inferno") public override void SafeSetDefaults() { - item.damage = BaseDamage; - item.width = 22; - item.height = 24; - item.useAnimation = 29; - item.useTime = 29; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4.5f; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item106; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.damage = BaseDamage; + Item.width = 22; + Item.height = 24; + Item.useAnimation = 29; + Item.useTime = 29; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4.5f; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item106; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -50,14 +50,7 @@ Stealth strikes spawn additional bubbles that inflict Ichor and Cursed Inferno") public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyEvilWater", 100); - recipe.AddRecipeGroup("AnyAdamantiteBar", 5); - recipe.AddRecipeGroup("CursedFlameIchor", 5); - recipe.AddIngredient(ItemID.SoulofNight, 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyEvilWater", 100).AddRecipeGroup("AnyAdamantiteBar", 5).AddRecipeGroup("CursedFlameIchor", 5).AddIngredient(ItemID.SoulofNight, 7).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/DukesDecapitator.cs b/Items/Weapons/Rogue/DukesDecapitator.cs index 01c16a05bc..a5c2bf669d 100644 --- a/Items/Weapons/Rogue/DukesDecapitator.cs +++ b/Items/Weapons/Rogue/DukesDecapitator.cs @@ -12,28 +12,28 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Duke's Decapitator"); Tooltip.SetDefault("Throws a hydro axe which shreds enemies when it comes into contact with them\n" - +"The faster it’s spinning, the more times it hits before disappearing\n" + +"The faster it’s spinning, the more times it hits before disappearing\n" +"Stealth Strikes make it emit short-ranged bubbles."); } public override void SafeSetDefaults() { - item.width = 60; - item.height = 64; - item.damage = 90; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 30; - item.knockBack = 2f; - item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().rogue = true; + Item.width = 60; + Item.height = 64; + Item.damage = 90; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 30; + Item.knockBack = 2f; + Item.UseSound = SoundID.Item1; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/DuneHopper.cs b/Items/Weapons/Rogue/DuneHopper.cs index f993510105..f4f3c34919 100644 --- a/Items/Weapons/Rogue/DuneHopper.cs +++ b/Items/Weapons/Rogue/DuneHopper.cs @@ -20,22 +20,22 @@ Stealth strikes throw three high speed spears"); public override void SafeSetDefaults() { - item.width = 44; - item.damage = 50; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 22; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 44; + Item.damage = 50; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 22; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 44; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -58,14 +58,7 @@ Stealth strikes throw three high speed spears"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/DuststormInABottle.cs b/Items/Weapons/Rogue/DuststormInABottle.cs index 26eb9aa4e7..af7fdc6b36 100644 --- a/Items/Weapons/Rogue/DuststormInABottle.cs +++ b/Items/Weapons/Rogue/DuststormInABottle.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 20; - item.damage = 47; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 25; - item.knockBack = 5f; - item.UseSound = SoundID.Item106; - item.autoReuse = true; - item.height = 24; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 20; + Item.damage = 47; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 25; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item106; + Item.autoReuse = true; + Item.height = 24; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -50,13 +50,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SandstorminaBottle); - recipe.AddIngredient(ItemID.HolyWater, 20); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SandstorminaBottle).AddIngredient(ItemID.HolyWater, 20).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 0da6b9b7dc..57b5d730c4 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -20,22 +20,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 564; - item.knockBack = 3.5f; - item.useAnimation = item.useTime = 21; - item.autoReuse = true; - item.Calamity().rogue = true; - item.shootSpeed = 15f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 564; + Item.knockBack = 3.5f; + Item.useAnimation = Item.useTime = 21; + Item.autoReuse = true; + Item.Calamity().rogue = true; + Item.shootSpeed = 15f; + Item.shoot = ModContent.ProjectileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.width = item.height = 72; - item.noMelee = true; - item.noUseGraphic = true; - item.UseSound = SoundID.Item1; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.useStyle = ItemUseStyleID.Swing; + Item.width = Item.height = 72; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.UseSound = SoundID.Item1; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -51,14 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Rogue/EnchantedAxe.cs b/Items/Weapons/Rogue/EnchantedAxe.cs index dc3aeb6d3a..a395f449ab 100644 --- a/Items/Weapons/Rogue/EnchantedAxe.cs +++ b/Items/Weapons/Rogue/EnchantedAxe.cs @@ -19,24 +19,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 40; - item.damage = 20; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 36; - item.maxStack = 1; - item.value = 1000; - item.rare = ItemRarityID.Orange; - item.value = Item.buyPrice(0, 4, 0, 0); - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 30f; - item.Calamity().rogue = true; + Item.width = 40; + Item.damage = 20; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 15; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 36; + Item.maxStack = 1; + Item.value = 1000; + Item.rare = ItemRarityID.Orange; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -53,22 +53,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 100); - recipe.AddIngredient(ItemID.FallenStar, 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.Bone, 30); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 100); - recipe.AddIngredient(ItemID.FallenStar, 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.Bone, 30); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 100).AddIngredient(ItemID.FallenStar, 5).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.Bone, 30).AddTile(TileID.Anvils).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 100).AddIngredient(ItemID.FallenStar, 5).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.Bone, 30).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/EpidemicShredder.cs b/Items/Weapons/Rogue/EpidemicShredder.cs index f0d979c024..8fa78e34fb 100644 --- a/Items/Weapons/Rogue/EpidemicShredder.cs +++ b/Items/Weapons/Rogue/EpidemicShredder.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 34; - item.height = 34; - item.damage = 80; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 16; - item.useTime = 16; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; - item.Calamity().rogue = true; + Item.width = 34; + Item.height = 34; + Item.damage = 80; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useAnimation = 16; + Item.useTime = 16; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4.5f; + Item.UseSound = SoundID.Item1; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -49,13 +49,7 @@ namespace CalamityMod.Items.Weapons.Rogue } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ChlorophyteBar, 20); - recipe.AddIngredient(ItemID.Nanites, 150); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.ChlorophyteBar, 20).AddIngredient(ItemID.Nanites, 150).AddIngredient(ModContent.ItemType(), 15).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/Equanimity.cs b/Items/Weapons/Rogue/Equanimity.cs index 733e0155aa..f337037440 100644 --- a/Items/Weapons/Rogue/Equanimity.cs +++ b/Items/Weapons/Rogue/Equanimity.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 40; - item.damage = 40; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 36; - item.maxStack = 1; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 30f; - item.Calamity().rogue = true; + Item.width = 40; + Item.damage = 40; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 36; + Item.maxStack = 1; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -51,14 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Flamarang); - recipe.AddIngredient(ItemID.IceBoomerang); - recipe.AddIngredient(ItemID.LightShard); - recipe.AddIngredient(ItemID.DarkShard); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Flamarang).AddIngredient(ItemID.IceBoomerang).AddIngredient(ItemID.LightShard).AddIngredient(ItemID.DarkShard).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/Eradicator.cs b/Items/Weapons/Rogue/Eradicator.cs index ca7fc7209e..4aaa496cdb 100644 --- a/Items/Weapons/Rogue/Eradicator.cs +++ b/Items/Weapons/Rogue/Eradicator.cs @@ -20,23 +20,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 38; - item.damage = 563; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 33; - item.useAnimation = 33; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.height = 54; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; - item.Calamity().rogue = true; + Item.width = 38; + Item.damage = 563; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 33; + Item.useAnimation = 33; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.height = 54; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = Speed; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/EradicatorGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/EradicatorGlow")); } } } diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index 70f4a249ec..ffea2434a8 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -22,38 +22,34 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 64; - item.damage = 200; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 3; - item.useAnimation = 9; - item.reuseDelay = 1; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item73; - item.autoReuse = true; - item.height = 64; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 26f; - item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.width = 64; + Item.damage = 200; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useTime = 3; + Item.useAnimation = 9; + Item.reuseDelay = 1; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6.75f; + Item.UseSound = SoundID.Item73; + Item.autoReuse = true; + Item.height = 64; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 26f; + Item.Calamity().rogue = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ExecutionersBladeGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/ExecutionersBladeGlow")); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(ModContent.TileType()).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -67,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Rogue Main.projectile[stealth].Calamity().stealthStrike = true; counter++; - if (counter >= item.useAnimation / item.useTime) + if (counter >= Item.useAnimation / Item.useTime) counter = 0; return false; } diff --git a/Items/Weapons/Rogue/Exorcism.cs b/Items/Weapons/Rogue/Exorcism.cs index e2771293a6..d5cccbc85f 100644 --- a/Items/Weapons/Rogue/Exorcism.cs +++ b/Items/Weapons/Rogue/Exorcism.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 34; - item.damage = 55; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 42; - item.maxStack = 1; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.Calamity().rogue = true; + Item.width = 34; + Item.damage = 55; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 42; + Item.maxStack = 1; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -54,15 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HolyWater, 10); - recipe.AddIngredient(ItemID.HallowedBar, 12); - recipe.AddIngredient(ItemID.SoulofMight, 6); - recipe.AddIngredient(ItemID.SoulofSight, 6); - recipe.AddIngredient(ItemID.SoulofFright, 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HolyWater, 10).AddIngredient(ItemID.HallowedBar, 12).AddIngredient(ItemID.SoulofMight, 6).AddIngredient(ItemID.SoulofSight, 6).AddIngredient(ItemID.SoulofFright, 6).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/FantasyTalisman.cs b/Items/Weapons/Rogue/FantasyTalisman.cs index 4e40f8a249..66ca4028e2 100644 --- a/Items/Weapons/Rogue/FantasyTalisman.cs +++ b/Items/Weapons/Rogue/FantasyTalisman.cs @@ -19,24 +19,24 @@ Stealth strikes release more souls and leave behind souls as they travel"); public override void SafeSetDefaults() { - item.width = 34; - item.damage = 93; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 16; - item.useTime = 16; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 60, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; - item.Calamity().rogue = true; + Item.width = 34; + Item.damage = 93; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 16; + Item.useTime = 16; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 62; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 0, 60, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -53,13 +53,7 @@ Stealth strikes release more souls and leave behind souls as they travel"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.Silk); - recipe.AddIngredient(ItemID.Ectoplasm); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ItemID.Silk).AddIngredient(ItemID.Ectoplasm).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index 557c58e41a..fbb9f47b32 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -18,34 +18,30 @@ Stealth strike throws a volley of knives"); public override void SafeSetDefaults() { - item.width = 18; - item.damage = 25; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 11; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.knockBack = 2f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 32; - item.maxStack = 999; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 25f; - item.Calamity().rogue = true; + Item.width = 18; + Item.damage = 25; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 11; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.knockBack = 2f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 32; + Item.maxStack = 999; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 25f; + Item.Calamity().rogue = true; - item.value = Item.sellPrice(copper: 60); - item.rare = ItemRarityID.Orange; + Item.value = Item.sellPrice(copper: 60); + Item.rare = ItemRarityID.Orange; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ModContent.ItemType()).AddTile(TileID.SkyMill).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/FinalDawn.cs b/Items/Weapons/Rogue/FinalDawn.cs index 53eb33ad6b..043309eec3 100644 --- a/Items/Weapons/Rogue/FinalDawn.cs +++ b/Items/Weapons/Rogue/FinalDawn.cs @@ -19,28 +19,28 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 1500; - item.Calamity().rogue = true; - item.width = 78; - item.height = 66; - item.noMelee = true; - item.useTime = item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4; + Item.damage = 1500; + Item.Calamity().rogue = true; + Item.width = 78; + Item.height = 66; + Item.noMelee = true; + Item.useTime = Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.Calamity().donorItem = true; - item.autoReuse = false; - item.shoot = ProjectileType(); - item.shootSpeed = 1f; - item.useTurn = false; - item.channel = true; - item.noUseGraphic = true; + Item.autoReuse = false; + Item.shoot = ProjectileType(); + Item.shootSpeed = 1f; + Item.useTurn = false; + Item.channel = true; + Item.noUseGraphic = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] + diff --git a/Items/Weapons/Rogue/FlameScythe.cs b/Items/Weapons/Rogue/FlameScythe.cs index cec270b0fa..d88f95ebd2 100644 --- a/Items/Weapons/Rogue/FlameScythe.cs +++ b/Items/Weapons/Rogue/FlameScythe.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 50; - item.height = 48; - item.damage = 90; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.useAnimation = 20; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(gold: 80); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().rogue = true; + Item.width = 50; + Item.height = 48; + Item.damage = 90; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.useAnimation = 20; + Item.knockBack = 8.5f; + Item.UseSound = SoundID.Item1; + Item.value = Item.buyPrice(gold: 80); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -46,11 +46,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 9).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/FrostcrushValari.cs b/Items/Weapons/Rogue/FrostcrushValari.cs index 5f8ab95286..649592c4ac 100644 --- a/Items/Weapons/Rogue/FrostcrushValari.cs +++ b/Items/Weapons/Rogue/FrostcrushValari.cs @@ -22,23 +22,23 @@ Stealth strikes throw three short ranged boomerangs along with a spread of icicl public override void SafeSetDefaults() { - item.damage = 100; - item.knockBack = 12; - item.thrown = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.useTime = 19; - item.useAnimation = 19; - item.width = 32; - item.height = 46; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shootSpeed = Speed; - item.shoot = ModContent.ProjectileType(); - item.noMelee = true; - item.noUseGraphic = true; - item.Calamity().rogue = true; + Item.damage = 100; + Item.knockBack = 12; + Item.DamageType = DamageClass.Throwing; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.useTime = 19; + Item.useAnimation = 19; + Item.width = 32; + Item.height = 46; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shootSpeed = Speed; + Item.shoot = ModContent.ProjectileType(); + Item.noMelee = true; + Item.noUseGraphic = true; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -74,14 +74,7 @@ Stealth strikes throw three short ranged boomerangs along with a spread of icicl public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 40).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.IceMachine).Register(); } } } diff --git a/Items/Weapons/Rogue/FrostyFlare.cs b/Items/Weapons/Rogue/FrostyFlare.cs index 461536ea97..d2c8da0145 100644 --- a/Items/Weapons/Rogue/FrostyFlare.cs +++ b/Items/Weapons/Rogue/FrostyFlare.cs @@ -19,25 +19,25 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 32; - item.noUseGraphic = true; - item.noMelee = true; - item.width = 10; - item.height = 22; - item.useTime = 16; - item.useAnimation = 16; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = false; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 0, 8, 0); - item.rare = ItemRarityID.LightPurple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 22f; - item.maxStack = 999; - item.consumable = true; - item.Calamity().rogue = true; + Item.damage = 32; + Item.noUseGraphic = true; + Item.noMelee = true; + Item.width = 10; + Item.height = 22; + Item.useTime = 16; + Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = false; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 0, 8, 0); + Item.rare = ItemRarityID.LightPurple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 22f; + Item.maxStack = 999; + Item.consumable = true; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/GelDart.cs b/Items/Weapons/Rogue/GelDart.cs index 556b150001..d9451ba326 100644 --- a/Items/Weapons/Rogue/GelDart.cs +++ b/Items/Weapons/Rogue/GelDart.cs @@ -18,24 +18,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 14; - item.damage = 28; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 11; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 11; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 28; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 2, 50); - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; - item.Calamity().rogue = true; + Item.width = 14; + Item.damage = 28; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 11; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 11; + Item.knockBack = 2.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 28; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 0, 2, 50); + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/GhoulishGouger.cs b/Items/Weapons/Rogue/GhoulishGouger.cs index e3ae13baf5..ef72586ff6 100644 --- a/Items/Weapons/Rogue/GhoulishGouger.cs +++ b/Items/Weapons/Rogue/GhoulishGouger.cs @@ -18,30 +18,30 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 74; - item.height = 68; + Item.width = 74; + Item.height = 68; - item.damage = 166; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 6; - item.useAnimation = 24; - item.reuseDelay = 11; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().rogue = true; + Item.damage = 166; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useTime = 6; + Item.useAnimation = 24; + Item.reuseDelay = 11; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 7.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.Calamity().rogue = true; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/GhoulishGougerGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/GhoulishGougerGlow")); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/GildedDagger.cs b/Items/Weapons/Rogue/GildedDagger.cs index 46ce03eaff..72d20715c8 100644 --- a/Items/Weapons/Rogue/GildedDagger.cs +++ b/Items/Weapons/Rogue/GildedDagger.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 32; - item.damage = 14; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 26; - item.maxStack = 1; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().rogue = true; + Item.width = 32; + Item.damage = 14; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 26; + Item.maxStack = 1; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -54,12 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldBar, 12); - recipe.AddIngredient(ItemID.ThrowingKnife, 250); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.GoldBar, 12).AddIngredient(ItemID.ThrowingKnife, 250).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/Glaive.cs b/Items/Weapons/Rogue/Glaive.cs index eb89994092..eb36dfba3e 100644 --- a/Items/Weapons/Rogue/Glaive.cs +++ b/Items/Weapons/Rogue/Glaive.cs @@ -22,23 +22,23 @@ Stealth strikes are super fast and pierce infinitely"); public override void SafeSetDefaults() { - item.damage = BaseDamage; - item.Calamity().rogue = true; - item.noMelee = true; - item.noUseGraphic = true; - item.width = 1; - item.height = 1; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = Knockback; - item.value = Item.buyPrice(0, 1, 40, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item1; - item.maxStack = 3; + Item.damage = BaseDamage; + Item.Calamity().rogue = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.width = 1; + Item.height = 1; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = Knockback; + Item.value = Item.buyPrice(0, 1, 40, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item1; + Item.maxStack = 3; - item.shootSpeed = Speed; - item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = Speed; + Item.shoot = ModContent.ProjectileType(); } // Terraria seems to really dislike high crit values in SetDefaults @@ -62,7 +62,7 @@ Stealth strikes are super fast and pierce infinitely"); public override bool CanUseItem(Player player) { - return player.ownedProjectileCounts[item.shoot] < item.stack; + return player.ownedProjectileCounts[Item.shoot] < Item.stack; } } diff --git a/Items/Weapons/Rogue/GleamingDagger.cs b/Items/Weapons/Rogue/GleamingDagger.cs index 0de383e16a..29c30692db 100644 --- a/Items/Weapons/Rogue/GleamingDagger.cs +++ b/Items/Weapons/Rogue/GleamingDagger.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 32; - item.damage = 14; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 26; - item.maxStack = 1; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().rogue = true; + Item.width = 32; + Item.damage = 14; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 26; + Item.maxStack = 1; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -54,12 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PlatinumBar, 12); - recipe.AddIngredient(ItemID.ThrowingKnife, 250); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.PlatinumBar, 12).AddIngredient(ItemID.ThrowingKnife, 250).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index cff7db5e37..00fce5d392 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -25,25 +25,25 @@ Right click to delete all existing spiky balls"); public override void SafeSetDefaults() { - item.damage = damage; - item.Calamity().rogue = true; - item.noMelee = true; - item.noUseGraphic = true; - item.width = 1; - item.height = 1; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = knockBack; - item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.maxStack = 10; + Item.damage = damage; + Item.Calamity().rogue = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.width = 1; + Item.height = 1; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = knockBack; + Item.value = Item.buyPrice(0, 18, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.maxStack = 10; - item.shootSpeed = 5f; - item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; + Item.shoot = ModContent.ProjectileType(); } @@ -51,15 +51,15 @@ Right click to delete all existing spiky balls"); { if (player.altFunctionUse == 2) { - item.shoot = ProjectileID.None; - item.shootSpeed = 0f; + Item.shoot = ProjectileID.None; + Item.shootSpeed = 0f; return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; } else { - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; - int UseMax = item.stack; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; + int UseMax = Item.stack; return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; } } @@ -88,13 +88,7 @@ Right click to delete all existing spiky balls"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - - recipe.AddIngredient(ItemID.SpikyBall, 200); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpikyBall, 200).AddIngredient(ModContent.ItemType(), 1).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Rogue/HardenedHoneycomb.cs b/Items/Weapons/Rogue/HardenedHoneycomb.cs index 7475d4708d..9c63feaf90 100644 --- a/Items/Weapons/Rogue/HardenedHoneycomb.cs +++ b/Items/Weapons/Rogue/HardenedHoneycomb.cs @@ -18,24 +18,24 @@ Stealth strikes can bounce off walls and enemies"); public override void SafeSetDefaults() { - item.width = 30; - item.damage = 25; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 21; - item.useTime = 21; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 32; - item.maxStack = 999; - item.value = 300; - item.rare = ItemRarityID.Orange; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.Calamity().rogue = true; + Item.width = 30; + Item.damage = 25; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 21; + Item.useTime = 21; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 32; + Item.maxStack = 999; + Item.value = 300; + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -55,13 +55,7 @@ Stealth strikes can bounce off walls and enemies"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Hive); - recipe.AddIngredient(ItemID.CrispyHoneyBlock); - recipe.AddIngredient(ItemID.BeeWax); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 20); - recipe.AddRecipe(); + CreateRecipe(20).AddIngredient(ItemID.Hive).AddIngredient(ItemID.CrispyHoneyBlock).AddIngredient(ItemID.BeeWax).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/HeavenfallenStardisk.cs b/Items/Weapons/Rogue/HeavenfallenStardisk.cs index c50f14c3b2..b691453de5 100644 --- a/Items/Weapons/Rogue/HeavenfallenStardisk.cs +++ b/Items/Weapons/Rogue/HeavenfallenStardisk.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 44; - item.height = 48; - item.damage = 115; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 25; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.Calamity().rogue = true; + Item.width = 44; + Item.height = 48; + Item.damage = 115; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 25; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Rogue/HellsSun.cs b/Items/Weapons/Rogue/HellsSun.cs index 7540665e24..cfa0b8cd5f 100644 --- a/Items/Weapons/Rogue/HellsSun.cs +++ b/Items/Weapons/Rogue/HellsSun.cs @@ -26,39 +26,39 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = damage; - item.Calamity().rogue = true; - item.noMelee = true; - item.noUseGraphic = true; - item.width = 1; - item.height = 1; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = knockBack; - item.value = Item.sellPrice(0, 2, 40, 0); - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.maxStack = 10; + Item.damage = damage; + Item.Calamity().rogue = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.width = 1; + Item.height = 1; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = knockBack; + Item.value = Item.sellPrice(0, 2, 40, 0); + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.maxStack = 10; - item.shootSpeed = 5f; - item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; + Item.shoot = ModContent.ProjectileType(); } public override bool CanUseItem(Player player) { if (player.altFunctionUse == 2) { - item.shoot = ProjectileID.None; - item.shootSpeed = 0f; + Item.shoot = ProjectileID.None; + Item.shootSpeed = 0f; return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; } else { - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; - int UseMax = item.stack; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; + int UseMax = Item.stack; return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; } } @@ -90,13 +90,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - - recipe.AddIngredient(ItemID.SpikyBall, 100); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpikyBall, 100).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index 7814dc3772..1c18da969f 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -22,26 +22,26 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 46; - item.height = 32; - item.autoReuse = true; - item.noUseGraphic = true; - item.noMelee = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item7; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; + Item.width = 46; + Item.height = 32; + Item.autoReuse = true; + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item7; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; - item.damage = 200; - item.useAnimation = 21; - item.useTime = 3; - item.reuseDelay = 1; - item.knockBack = 3f; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; + Item.damage = 200; + Item.useAnimation = 21; + Item.useTime = 3; + Item.reuseDelay = 1; + Item.knockBack = 3f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().rogue = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -81,14 +81,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IceBlock, 100); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.IceBlock, 100).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Rogue/IceStar.cs b/Items/Weapons/Rogue/IceStar.cs index 5af7dfe50e..755e489b8f 100644 --- a/Items/Weapons/Rogue/IceStar.cs +++ b/Items/Weapons/Rogue/IceStar.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 45; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 12; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.width = item.height = 66; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 5, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; - item.Calamity().rogue = true; + Item.damage = 45; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 12; + Item.knockBack = 2.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.width = Item.height = 66; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 0, 5, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Rogue/Icebreaker.cs b/Items/Weapons/Rogue/Icebreaker.cs index 4f2ce81809..b8c8c5ecad 100644 --- a/Items/Weapons/Rogue/Icebreaker.cs +++ b/Items/Weapons/Rogue/Icebreaker.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 60; - item.damage = 60; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 14; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 14; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 60; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().rogue = true; + Item.width = 60; + Item.damage = 60; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 14; + Item.knockBack = 6.75f; + Item.UseSound = SoundID.Item1; + Item.DamageType = DamageClass.Melee; + Item.height = 60; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/IchorSpear.cs b/Items/Weapons/Rogue/IchorSpear.cs index d9e84f553b..3eb1bb7126 100644 --- a/Items/Weapons/Rogue/IchorSpear.cs +++ b/Items/Weapons/Rogue/IchorSpear.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 52; - item.damage = 76; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 52; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.Calamity().rogue = true; + Item.width = 52; + Item.damage = 76; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 52; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/InfernalKris.cs b/Items/Weapons/Rogue/InfernalKris.cs index 6a26b153a0..fc4b1fb991 100644 --- a/Items/Weapons/Rogue/InfernalKris.cs +++ b/Items/Weapons/Rogue/InfernalKris.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 32; - item.damage = 24; - item.noMelee = true; - item.noUseGraphic = true; - item.consumable = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 30; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 5, 0); - item.rare = ItemRarityID.Orange; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().rogue = true; + Item.width = 32; + Item.damage = 24; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.consumable = true; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 30; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 0, 5, 0); + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -51,12 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar); - recipe.AddIngredient(ItemID.Obsidian, 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.HellstoneBar).AddIngredient(ItemID.Obsidian, 2).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/IronFrancisca.cs b/Items/Weapons/Rogue/IronFrancisca.cs index e4446e1e36..5b09718f8b 100644 --- a/Items/Weapons/Rogue/IronFrancisca.cs +++ b/Items/Weapons/Rogue/IronFrancisca.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 40; - item.damage = 7; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 36; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 1, 0); - item.rare = ItemRarityID.White; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 40; + Item.damage = 7; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 15; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = false; + Item.height = 36; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 0, 1, 0); + Item.rare = ItemRarityID.White; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -51,13 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Wood); - recipe.anyWood = true; - recipe.AddIngredient(ItemID.IronBar); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.Wood).AddIngredient(ItemID.IronBar).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/JawsOfOblivion.cs b/Items/Weapons/Rogue/JawsOfOblivion.cs index f0e3ca3140..01b484f78d 100644 --- a/Items/Weapons/Rogue/JawsOfOblivion.cs +++ b/Items/Weapons/Rogue/JawsOfOblivion.cs @@ -19,23 +19,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 42; - item.height = 40; - item.damage = 159; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 25f; - item.Calamity().rogue = true; + Item.width = 42; + Item.height = 40; + Item.damage = 159; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 15; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 25f; + Item.Calamity().rogue = true; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -65,14 +65,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Rogue/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index 4d455dca21..9a3365a049 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -21,23 +21,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 20; - item.damage = 60; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 30; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.height = 20; - item.value = Item.buyPrice(gold: 36); - item.rare = ItemRarityID.Pink; - item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; - item.Calamity().rogue = true; + Item.width = 20; + Item.damage = 60; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 30; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item1; + Item.height = 20; + Item.value = Item.buyPrice(gold: 36); + Item.rare = ItemRarityID.Pink; + Item.Calamity().donorItem = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -50,17 +50,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 100); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 100).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.IceMachine).Register(); } } } diff --git a/Items/Weapons/Rogue/Kylie.cs b/Items/Weapons/Rogue/Kylie.cs index bc08cad7c6..2f80cd8ce5 100644 --- a/Items/Weapons/Rogue/Kylie.cs +++ b/Items/Weapons/Rogue/Kylie.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 63; - item.knockBack = 12; - item.thrown = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.useTime = 25; - item.useAnimation = 25; - item.width = 32; - item.height = 46; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.shootSpeed = Speed; - item.shoot = ModContent.ProjectileType(); - item.noMelee = true; - item.noUseGraphic = true; - item.Calamity().rogue = true; + Item.damage = 63; + Item.knockBack = 12; + Item.DamageType = DamageClass.Throwing; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.useTime = 25; + Item.useAnimation = 25; + Item.width = 32; + Item.height = 46; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.shootSpeed = Speed; + Item.shoot = ModContent.ProjectileType(); + Item.noMelee = true; + Item.noUseGraphic = true; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Rogue/LatcherMine.cs b/Items/Weapons/Rogue/LatcherMine.cs index 94a2beb08d..84c971dae5 100644 --- a/Items/Weapons/Rogue/LatcherMine.cs +++ b/Items/Weapons/Rogue/LatcherMine.cs @@ -20,23 +20,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.height = 32; - item.width = 26; - item.damage = BaseDamage; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = item.useTime = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 3, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.Calamity().rogue = true; + Item.height = 32; + Item.width = 26; + Item.damage = BaseDamage; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = Item.useTime = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 0, 3, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/LeadTomahawk.cs b/Items/Weapons/Rogue/LeadTomahawk.cs index e71013fc87..01c09c54cd 100644 --- a/Items/Weapons/Rogue/LeadTomahawk.cs +++ b/Items/Weapons/Rogue/LeadTomahawk.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 40; - item.damage = 7; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 36; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 1, 0); - item.rare = ItemRarityID.White; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 40; + Item.damage = 7; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 15; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = false; + Item.height = 36; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 0, 1, 0); + Item.rare = ItemRarityID.White; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -51,13 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Wood); - recipe.anyWood = true; - recipe.AddIngredient(ItemID.LeadBar); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.Wood).AddIngredient(ItemID.LeadBar).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/LeonidProgenitor.cs b/Items/Weapons/Rogue/LeonidProgenitor.cs index 519a265ae8..7a4b051a0d 100644 --- a/Items/Weapons/Rogue/LeonidProgenitor.cs +++ b/Items/Weapons/Rogue/LeonidProgenitor.cs @@ -22,23 +22,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 64; - item.Calamity().rogue = true; - item.knockBack = 3f; - item.useTime = item.useAnimation = 15; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.damage = 64; + Item.Calamity().rogue = true; + Item.knockBack = 3f; + Item.useTime = Item.useAnimation = 15; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; - item.width = 32; - item.height = 48; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.noUseGraphic = true; - item.UseSound = SoundID.Item61; + Item.width = 32; + Item.height = 48; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.UseSound = SoundID.Item61; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; } public override bool AltFunctionUse(Player player) => true; @@ -47,13 +47,13 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) { - item.UseSound = SoundID.Item61; - item.shoot = ModContent.ProjectileType(); + Item.UseSound = SoundID.Item61; + Item.shoot = ModContent.ProjectileType(); } else { - item.UseSound = SoundID.Item88; - item.shoot = ModContent.ProjectileType(); + Item.UseSound = SoundID.Item88; + Item.shoot = ModContent.ProjectileType(); } return base.CanUseItem(player); } @@ -90,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/LeonidProgenitorGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/LeonidProgenitorGlow")); } } } diff --git a/Items/Weapons/Rogue/LeviathanTeeth.cs b/Items/Weapons/Rogue/LeviathanTeeth.cs index fde5f61e7f..a9bb9e4413 100644 --- a/Items/Weapons/Rogue/LeviathanTeeth.cs +++ b/Items/Weapons/Rogue/LeviathanTeeth.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 36; - item.damage = 50; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 10; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 38; - item.maxStack = 1; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 36; + Item.damage = 50; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 10; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 38; + Item.maxStack = 1; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/Lionfish.cs b/Items/Weapons/Rogue/Lionfish.cs index 9254fec701..907fc096ca 100644 --- a/Items/Weapons/Rogue/Lionfish.cs +++ b/Items/Weapons/Rogue/Lionfish.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 40; - item.damage = 45; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 22; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 40; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 40; + Item.damage = 45; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 22; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 22; + Item.knockBack = 2.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 40; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/LuminousStriker.cs b/Items/Weapons/Rogue/LuminousStriker.cs index 57838e2611..2d52342008 100644 --- a/Items/Weapons/Rogue/LuminousStriker.cs +++ b/Items/Weapons/Rogue/LuminousStriker.cs @@ -20,22 +20,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 86; - item.height = 102; - item.damage = 149; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 30; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(1, 0, 0, 0); - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.Calamity().rogue = true; + Item.width = 86; + Item.height = 102; + Item.damage = 149; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 30; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(1, 0, 0, 0); + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -48,15 +48,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.FragmentStardust, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.FragmentStardust, 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Rogue/LunarKunai.cs b/Items/Weapons/Rogue/LunarKunai.cs index 14071eabcc..3168e58c32 100644 --- a/Items/Weapons/Rogue/LunarKunai.cs +++ b/Items/Weapons/Rogue/LunarKunai.cs @@ -19,29 +19,29 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 38; - item.height = 38; - item.damage = 120; - item.maxStack = 999; - item.consumable = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 10; - item.knockBack = 2f; - item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.value = Item.sellPrice(copper: 24); - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 22f; - item.Calamity().rogue = true; + Item.width = 38; + Item.height = 38; + Item.damage = 120; + Item.maxStack = 999; + Item.consumable = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 10; + Item.knockBack = 2f; + Item.UseSound = SoundID.Item39; + Item.autoReuse = true; + Item.value = Item.sellPrice(copper: 24); + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 22f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -105,11 +105,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 333); - recipe.AddRecipe(); + CreateRecipe(333).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Rogue/Malachite.cs b/Items/Weapons/Rogue/Malachite.cs index 8578433a9b..679a76f434 100644 --- a/Items/Weapons/Rogue/Malachite.cs +++ b/Items/Weapons/Rogue/Malachite.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 26; - item.damage = 50; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = item.useAnimation = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 1.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 58; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.Calamity().rogue = true; + Item.width = 26; + Item.damage = 50; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useTime = Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 1.25f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 58; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.Calamity().rogue = true; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; } public override bool AltFunctionUse(Player player) => true; @@ -42,18 +42,18 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - item.UseSound = SoundID.Item109; - item.shoot = ModContent.ProjectileType(); + Item.UseSound = SoundID.Item109; + Item.shoot = ModContent.ProjectileType(); } else if (player.altFunctionUse == 2) { - item.UseSound = SoundID.Item109; - item.shoot = ModContent.ProjectileType(); + Item.UseSound = SoundID.Item109; + Item.shoot = ModContent.ProjectileType(); } else { - item.UseSound = SoundID.Item1; - item.shoot = ModContent.ProjectileType(); + Item.UseSound = SoundID.Item1; + Item.shoot = ModContent.ProjectileType(); } return base.CanUseItem(player); } diff --git a/Items/Weapons/Rogue/MangroveChakram.cs b/Items/Weapons/Rogue/MangroveChakram.cs index 41b9b67ab6..813eed513b 100644 --- a/Items/Weapons/Rogue/MangroveChakram.cs +++ b/Items/Weapons/Rogue/MangroveChakram.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 38; - item.damage = 84; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 14; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 14; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.height = 38; - item.value = Item.buyPrice(gold: 60); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().rogue = true; + Item.width = 38; + Item.damage = 84; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 14; + Item.knockBack = 7.5f; + Item.UseSound = SoundID.Item1; + Item.height = 38; + Item.value = Item.buyPrice(gold: 60); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -48,11 +48,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/MetalMonstrosity.cs b/Items/Weapons/Rogue/MetalMonstrosity.cs index c10f74ca2f..4a998f0caf 100644 --- a/Items/Weapons/Rogue/MetalMonstrosity.cs +++ b/Items/Weapons/Rogue/MetalMonstrosity.cs @@ -18,24 +18,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 32; - item.height = 32; - item.useStyle = ItemUseStyleID.SwingThrow; - item.autoReuse = true; - item.noUseGraphic = true; - item.noMelee = true; - item.UseSound = SoundID.Item1; - item.rare = ItemRarityID.Orange; - item.value = Item.buyPrice(0, 4, 0, 0); + Item.width = 32; + Item.height = 32; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.noUseGraphic = true; + Item.noMelee = true; + Item.UseSound = SoundID.Item1; + Item.rare = ItemRarityID.Orange; + Item.value = Item.buyPrice(0, 4, 0, 0); - item.damage = 30; - item.useAnimation = 40; - item.useTime = 40; - item.knockBack = 7f; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7f; + Item.damage = 30; + Item.useAnimation = 40; + Item.useTime = 40; + Item.knockBack = 7f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7f; - item.Calamity().rogue = true; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -48,12 +48,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpikyBall, 500); - recipe.AddIngredient(ItemID.Spike, 80); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpikyBall, 500).AddIngredient(ItemID.Spike, 80).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/MeteorFist.cs b/Items/Weapons/Rogue/MeteorFist.cs index 5b1fe77328..7139d04e82 100644 --- a/Items/Weapons/Rogue/MeteorFist.cs +++ b/Items/Weapons/Rogue/MeteorFist.cs @@ -17,32 +17,28 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 22; - item.damage = 15; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 30; - item.knockBack = 5.75f; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.height = 28; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; - item.Calamity().rogue = true; + Item.width = 22; + Item.damage = 15; + Item.noMelee = true; + Item.useTurn = true; + Item.noUseGraphic = true; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 30; + Item.knockBack = 5.75f; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.height = 28; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; + Item.Calamity().rogue = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.MeteoriteBar, 10).AddTile(TileID.Anvils).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/MoltenAmputator.cs b/Items/Weapons/Rogue/MoltenAmputator.cs index 38696d21fa..aa45ec57f9 100644 --- a/Items/Weapons/Rogue/MoltenAmputator.cs +++ b/Items/Weapons/Rogue/MoltenAmputator.cs @@ -19,23 +19,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 60; - item.damage = 166; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.height = 60; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; - item.Calamity().rogue = true; + Item.width = 60; + Item.damage = 166; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.knockBack = 9f; + Item.UseSound = SoundID.Item1; + Item.height = 60; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = Speed; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/MonkeyDarts.cs b/Items/Weapons/Rogue/MonkeyDarts.cs index 68a210b2fe..f44d467cb4 100644 --- a/Items/Weapons/Rogue/MonkeyDarts.cs +++ b/Items/Weapons/Rogue/MonkeyDarts.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 150; - item.knockBack = 4; - item.noMelee = true; - item.noUseGraphic = true; - item.consumable = true; - item.maxStack = 999; - item.width = 27; - item.height = 27; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.useTime = 20; - item.useAnimation = 20; - item.value = Item.buyPrice(0, 0, 4, 0); - item.rare = ItemRarityID.Lime; - item.shootSpeed = 8f; - item.shoot = ModContent.ProjectileType(); - item.autoReuse = true; - item.Calamity().rogue = true; + Item.damage = 150; + Item.knockBack = 4; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.consumable = true; + Item.maxStack = 999; + Item.width = 27; + Item.height = 27; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.useTime = 20; + Item.useAnimation = 20; + Item.value = Item.buyPrice(0, 0, 4, 0); + Item.rare = ItemRarityID.Lime; + Item.shootSpeed = 8f; + Item.shoot = ModContent.ProjectileType(); + Item.autoReuse = true; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Rogue/Mycoroot.cs b/Items/Weapons/Rogue/Mycoroot.cs index 1e2857eb1c..4914ced72f 100644 --- a/Items/Weapons/Rogue/Mycoroot.cs +++ b/Items/Weapons/Rogue/Mycoroot.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 32; - item.damage = 10; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 5; - item.useAnimation = 5; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 1.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 32; - item.rare = ItemRarityID.Green; - item.value = Item.buyPrice(0, 2, 0, 0); - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.Calamity().rogue = true; + Item.width = 32; + Item.damage = 10; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useTime = 5; + Item.useAnimation = 5; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 1.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 32; + Item.rare = ItemRarityID.Green; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/MythrilKnife.cs b/Items/Weapons/Rogue/MythrilKnife.cs index cb3c93b286..5115762940 100644 --- a/Items/Weapons/Rogue/MythrilKnife.cs +++ b/Items/Weapons/Rogue/MythrilKnife.cs @@ -15,24 +15,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 12; - item.damage = 40; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 10; - item.knockBack = 1.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 30; - item.maxStack = 999; - item.value = 1100; - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 12; + Item.damage = 40; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 10; + Item.knockBack = 1.75f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 30; + Item.maxStack = 999; + Item.value = 1100; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -49,11 +49,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MythrilBar); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.MythrilBar).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/NanoblackReaperRogue.cs b/Items/Weapons/Rogue/NanoblackReaperRogue.cs index 9fd0879e63..769f3dfa35 100644 --- a/Items/Weapons/Rogue/NanoblackReaperRogue.cs +++ b/Items/Weapons/Rogue/NanoblackReaperRogue.cs @@ -25,26 +25,26 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 78; - item.height = 64; - item.damage = BaseDamage; - item.knockBack = Knockback; - item.useTime = 6; - item.useAnimation = 6; - item.autoReuse = true; - item.noMelee = true; - item.noUseGraphic = true; + Item.width = 78; + Item.height = 64; + Item.damage = BaseDamage; + Item.knockBack = Knockback; + Item.useTime = 6; + Item.useAnimation = 6; + Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item18; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item18; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; - item.Calamity().rogue = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; + Item.Calamity().rogue = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = Speed; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -62,16 +62,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 40); - r.AddIngredient(ModContent.ItemType(), 20); - r.AddIngredient(ItemID.Nanites, 400); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddTile(ModContent.TileType()); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 40).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.Nanites, 400).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Rogue/NastyCholla.cs b/Items/Weapons/Rogue/NastyCholla.cs index c99ff47fcc..78b6cb5f03 100644 --- a/Items/Weapons/Rogue/NastyCholla.cs +++ b/Items/Weapons/Rogue/NastyCholla.cs @@ -21,23 +21,23 @@ Stealth strikes throw five at once"); public override void SafeSetDefaults() { - item.width = 20; - item.damage = BaseDamage; - item.noMelee = true; - item.noUseGraphic = true; - item.maxStack = 999; - item.consumable = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.height = 18; - item.value = Item.buyPrice(0, 0, 0, 50); - item.rare = ItemRarityID.White; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; - item.Calamity().rogue = true; + Item.width = 20; + Item.damage = BaseDamage; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.maxStack = 999; + Item.consumable = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item1; + Item.height = 18; + Item.value = Item.buyPrice(0, 0, 0, 50); + Item.rare = ItemRarityID.White; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -60,11 +60,7 @@ Stealth strikes throw five at once"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Cactus, 3); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 15); - recipe.AddRecipe(); + CreateRecipe(15).AddIngredient(ItemID.Cactus, 3).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Weapons/Rogue/NightsGaze.cs b/Items/Weapons/Rogue/NightsGaze.cs index 229b54a115..0cdf250a21 100644 --- a/Items/Weapons/Rogue/NightsGaze.cs +++ b/Items/Weapons/Rogue/NightsGaze.cs @@ -21,23 +21,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 82; - item.damage = 531; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 82; - item.maxStack = 1; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 30f; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.Calamity().rogue = true; + Item.width = 82; + Item.damage = 531; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 82; + Item.maxStack = 1; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -55,19 +55,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/NightsGazeGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/NightsGazeGlow")); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DayBreak); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 1); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.DayBreak).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Rogue/Nychthemeron.cs b/Items/Weapons/Rogue/Nychthemeron.cs index a5eda8dcd4..f9468fd514 100644 --- a/Items/Weapons/Rogue/Nychthemeron.cs +++ b/Items/Weapons/Rogue/Nychthemeron.cs @@ -21,23 +21,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 18; - item.damage = 60; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 18; - item.maxStack = 10; - item.value = Item.buyPrice(0, 3, 60, 0); - item.rare = ItemRarityID.LightPurple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; - item.Calamity().rogue = true; + Item.width = 18; + Item.damage = 60; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 18; + Item.maxStack = 10; + Item.value = Item.buyPrice(0, 3, 60, 0); + Item.rare = ItemRarityID.LightPurple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; + Item.Calamity().rogue = true; } public override bool AltFunctionUse(Player player) @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { - for (int j = 0; j < item.stack - player.ownedProjectileCounts[ModContent.ProjectileType()]; j++) + for (int j = 0; j < Item.stack - player.ownedProjectileCounts[ModContent.ProjectileType()]; j++) { float spread = 2; int pIndex = Projectile.NewProjectile(position.X, position.Y, speedX + Main.rand.NextFloat(-spread, spread), speedY + Main.rand.NextFloat(-spread, spread), type, Math.Max(damage / 3, 1), knockBack, player.whoAmI, 0f, 1f); @@ -85,29 +85,22 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.altFunctionUse == 2) { - item.shoot = ProjectileID.None; - item.shootSpeed = 0f; + Item.shoot = ProjectileID.None; + Item.shootSpeed = 0f; return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; } else { - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; - int UseMax = item.stack; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; + int UseMax = Item.stack; return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; } } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpikyBall, 30); - recipe.AddIngredient(ItemID.LightShard); - recipe.AddIngredient(ItemID.DarkShard); - recipe.AddRecipeGroup("AnyMythrilBar", 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpikyBall, 30).AddIngredient(ItemID.LightShard).AddIngredient(ItemID.DarkShard).AddRecipeGroup("AnyMythrilBar", 2).AddTile(TileID.MythrilAnvil).Register(); } private static void CreateOrbs(Vector2 position, int damage, float knockBack, int projectileID, Player player, bool stealth) diff --git a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs index ae59bfabcd..c0c7d83b04 100644 --- a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs +++ b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs @@ -15,25 +15,25 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 14; - item.damage = 37; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 13; - item.knockBack = 2f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 24; - item.shoot = ProjectileID.StarAnise; - item.maxStack = 999; - item.value = 1200; - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 14; + Item.damage = 37; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 13; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 13; + Item.knockBack = 2f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 24; + Item.shoot = ProjectileID.StarAnise; + Item.maxStack = 999; + Item.value = 1200; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -55,11 +55,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.OrichalcumBar); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.OrichalcumBar).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/PalladiumJavelin.cs b/Items/Weapons/Rogue/PalladiumJavelin.cs index 3a8b5596d8..2038007069 100644 --- a/Items/Weapons/Rogue/PalladiumJavelin.cs +++ b/Items/Weapons/Rogue/PalladiumJavelin.cs @@ -15,25 +15,25 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 44; - item.damage = 68; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 19; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 19; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; - item.shoot = ProjectileID.StarAnise; - item.maxStack = 999; - item.value = 1200; - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().rogue = true; + Item.width = 44; + Item.damage = 68; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 19; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 19; + Item.knockBack = 5.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 44; + Item.shoot = ProjectileID.StarAnise; + Item.maxStack = 999; + Item.value = 1200; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -53,11 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PalladiumBar); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.PalladiumBar).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/Penumbra.cs b/Items/Weapons/Rogue/Penumbra.cs index 6b0ef572b0..451ab21370 100644 --- a/Items/Weapons/Rogue/Penumbra.cs +++ b/Items/Weapons/Rogue/Penumbra.cs @@ -20,25 +20,25 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 46; - item.height = 32; - item.autoReuse = true; - item.noUseGraphic = true; - item.noMelee = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item103; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = ItemRarityID.Red; + Item.width = 46; + Item.height = 32; + Item.autoReuse = true; + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item103; + Item.value = Item.buyPrice(1, 80, 0, 0); + Item.rare = ItemRarityID.Red; - item.damage = 1008; - item.useAnimation = 40; - item.useTime = 40; - item.knockBack = 8f; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = ShootSpeed; + Item.damage = 1008; + Item.useAnimation = 40; + Item.useTime = 40; + Item.knockBack = 8f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = ShootSpeed; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.Calamity().rogue = true; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -71,13 +71,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Rogue/PhantasmalRuin.cs b/Items/Weapons/Rogue/PhantasmalRuin.cs index f2d76609db..fbc7b40427 100644 --- a/Items/Weapons/Rogue/PhantasmalRuin.cs +++ b/Items/Weapons/Rogue/PhantasmalRuin.cs @@ -19,24 +19,24 @@ Stealth strikes continuously leave spectral clones in their wake"); public override void SafeSetDefaults() { - item.damage = 955; - item.knockBack = 8f; + Item.damage = 955; + Item.knockBack = 8f; - item.width = 102; - item.height = 98; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 35; - item.useAnimation = 35; - item.autoReuse = true; - item.shootSpeed = 14.5f; - item.shoot = ModContent.ProjectileType(); - item.UseSound = SoundID.Item1; - item.Calamity().rogue = true; + Item.width = 102; + Item.height = 98; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useTime = 35; + Item.useAnimation = 35; + Item.autoReuse = true; + Item.shootSpeed = 14.5f; + Item.shoot = ModContent.ProjectileType(); + Item.UseSound = SoundID.Item1; + Item.Calamity().rogue = true; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -54,14 +54,7 @@ Stealth strikes continuously leave spectral clones in their wake"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 500); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 500).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Rogue/PhantomLance.cs b/Items/Weapons/Rogue/PhantomLance.cs index b3966815ae..320db831d0 100644 --- a/Items/Weapons/Rogue/PhantomLance.cs +++ b/Items/Weapons/Rogue/PhantomLance.cs @@ -20,27 +20,27 @@ Stealth strikes don't slow down and souls always deal full damage"); public override void SafeSetDefaults() { - item.damage = 70; - item.knockBack = 5f; + Item.damage = 70; + Item.knockBack = 5f; - item.width = 62; - item.height = 68; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.noUseGraphic = true; + Item.width = 62; + Item.height = 68; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.noUseGraphic = true; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = ItemRarityID.Yellow; - item.useTime = 23; - item.useAnimation = 23; - item.maxStack = 999; - item.UseSound = SoundID.Item1; - item.consumable = true; - item.Calamity().rogue = true; + Item.value = Item.buyPrice(0, 0, 50, 0); + Item.rare = ItemRarityID.Yellow; + Item.useTime = 23; + Item.useAnimation = 23; + Item.maxStack = 999; + Item.UseSound = SoundID.Item1; + Item.consumable = true; + Item.Calamity().rogue = true; - item.autoReuse = true; - item.shootSpeed = 10f; - item.shoot = ModContent.ProjectileType(); + Item.autoReuse = true; + Item.shootSpeed = 10f; + Item.shoot = ModContent.ProjectileType(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -57,13 +57,7 @@ Stealth strikes don't slow down and souls always deal full damage"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpectreBar, 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.SpectreBar, 2).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/Plaguenade.cs b/Items/Weapons/Rogue/Plaguenade.cs index ab158c5f4d..d0965c7421 100644 --- a/Items/Weapons/Rogue/Plaguenade.cs +++ b/Items/Weapons/Rogue/Plaguenade.cs @@ -18,25 +18,25 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 20; - item.damage = 63; - item.noMelee = true; - item.noUseGraphic = true; - item.consumable = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 1.5f; - item.maxStack = 999; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 28; - item.value = Item.buyPrice(gold: 1); - item.rare = ItemRarityID.Yellow; - item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 20; + Item.damage = 63; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.consumable = true; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 15; + Item.knockBack = 1.5f; + Item.maxStack = 999; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 28; + Item.value = Item.buyPrice(gold: 1); + Item.rare = ItemRarityID.Yellow; + Item.Calamity().donorItem = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -53,12 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Beenade, 20); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.Beenade, 20).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/PoisonPack.cs b/Items/Weapons/Rogue/PoisonPack.cs index aa002a7804..4c0ed90166 100644 --- a/Items/Weapons/Rogue/PoisonPack.cs +++ b/Items/Weapons/Rogue/PoisonPack.cs @@ -22,23 +22,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = baseDamage; - item.Calamity().rogue = true; - item.noMelee = true; - item.noUseGraphic = true; - item.width = 14; - item.height = 14; - item.useTime = 19; - item.useAnimation = 19; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = baseKnockback; - item.value = Item.buyPrice(0, 0, 33, 0); - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item1; - item.maxStack = 3; + Item.damage = baseDamage; + Item.Calamity().rogue = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.width = 14; + Item.height = 14; + Item.useTime = 19; + Item.useAnimation = 19; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = baseKnockback; + Item.value = Item.buyPrice(0, 0, 33, 0); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item1; + Item.maxStack = 3; - item.shootSpeed = 7f; - item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7f; + Item.shoot = ModContent.ProjectileType(); } // Terraria seems to really dislike high crit values in SetDefaults @@ -48,15 +48,15 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.altFunctionUse == 2) { - item.shoot = ProjectileID.None; - item.shootSpeed = 0f; + Item.shoot = ProjectileID.None; + Item.shootSpeed = 0f; return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; } else { - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7f; - int UseMax = item.stack; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7f; + int UseMax = Item.stack; return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; } } @@ -84,13 +84,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - - recipe.AddIngredient(ItemID.SpikyBall, 50); - recipe.AddIngredient(ItemID.JungleSpores, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpikyBall, 50).AddIngredient(ItemID.JungleSpores, 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/Prismalline.cs b/Items/Weapons/Rogue/Prismalline.cs index 7813bde34f..7e0cf738a0 100644 --- a/Items/Weapons/Rogue/Prismalline.cs +++ b/Items/Weapons/Rogue/Prismalline.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 46; - item.damage = 24; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 16; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 16; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 46; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().rogue = true; + Item.width = 46; + Item.damage = 24; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 16; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 46; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -54,13 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/ProfanedPartisan.cs b/Items/Weapons/Rogue/ProfanedPartisan.cs index 96fcd96bc1..10c4668350 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -18,26 +18,26 @@ Stealth strikes spawn smaller spears to fly along side it"); public override void SafeSetDefaults() { - item.damage = 322; - item.knockBack = 8f; + Item.damage = 322; + Item.knockBack = 8f; - item.width = 56; - item.height = 56; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.noUseGraphic = true; + Item.width = 56; + Item.height = 56; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.noUseGraphic = true; - item.useTime = 18; - item.useAnimation = 18; - item.UseSound = SoundID.Item1; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().rogue = true; + Item.useTime = 18; + Item.useAnimation = 18; + Item.UseSound = SoundID.Item1; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().rogue = true; - item.autoReuse = true; - item.shootSpeed = 6f; - item.shoot = ModContent.ProjectileType(); + Item.autoReuse = true; + Item.shootSpeed = 6f; + Item.shoot = ModContent.ProjectileType(); } // Terraria seems to really dislike high crit values in SetDefaults @@ -58,14 +58,7 @@ Stealth strikes spawn smaller spears to fly along side it"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 500); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType (), 25); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 500).AddIngredient(ModContent.ItemType(), 6).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType (), 25).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Rogue/ProfanedTrident.cs b/Items/Weapons/Rogue/ProfanedTrident.cs index 3f96779b2e..79fb68a305 100644 --- a/Items/Weapons/Rogue/ProfanedTrident.cs +++ b/Items/Weapons/Rogue/ProfanedTrident.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 152; - item.height = 148; - item.damage = 592; - item.knockBack = 5f; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = item.useAnimation = 13; - item.autoReuse = true; - item.UseSound = SoundID.Item1; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 28f; - item.Calamity().rogue = true; + Item.width = 152; + Item.height = 148; + Item.damage = 592; + Item.knockBack = 5f; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = Item.useAnimation = 13; + Item.autoReuse = true; + Item.UseSound = SoundID.Item1; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 28f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/RadiantStar.cs b/Items/Weapons/Rogue/RadiantStar.cs index 9afa81ef80..b85fa11cf4 100644 --- a/Items/Weapons/Rogue/RadiantStar.cs +++ b/Items/Weapons/Rogue/RadiantStar.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 52; - item.damage = 55; //33 - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 12; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 48; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.Calamity().rogue = true; + Item.width = 52; + Item.damage = 55; //33 + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 12; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 48; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -42,14 +42,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.FallenStar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.FallenStar, 10).AddTile(TileID.LunarCraftingStation).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/RefractionRotor.cs b/Items/Weapons/Rogue/RefractionRotor.cs index ed74c60309..f6e802384b 100644 --- a/Items/Weapons/Rogue/RefractionRotor.cs +++ b/Items/Weapons/Rogue/RefractionRotor.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = item.height = 120; - item.damage = 616; - item.knockBack = 8.5f; - item.useAnimation = item.useTime = 17; - item.Calamity().rogue = true; - item.autoReuse = true; - item.shootSpeed = 18f; - item.shoot = ModContent.ProjectileType(); + Item.width = Item.height = 120; + Item.damage = 616; + Item.knockBack = 8.5f; + Item.useAnimation = Item.useTime = 17; + Item.Calamity().rogue = true; + Item.autoReuse = true; + Item.shootSpeed = 18f; + Item.shoot = ModContent.ProjectileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.noMelee = true; - item.noUseGraphic = true; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/RegulusRiot.cs b/Items/Weapons/Rogue/RegulusRiot.cs index bfa4f4e584..b5218894b3 100644 --- a/Items/Weapons/Rogue/RegulusRiot.cs +++ b/Items/Weapons/Rogue/RegulusRiot.cs @@ -17,25 +17,25 @@ Stealth strikes explode into energy stars"); public override void SafeSetDefaults() { - item.damage = 116; - item.knockBack = 4.5f; + Item.damage = 116; + Item.knockBack = 4.5f; - item.width = 28; - item.height = 34; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.noUseGraphic = true; + Item.width = 28; + Item.height = 34; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.noUseGraphic = true; - item.value = Item.buyPrice(0, 95, 0, 0); - item.useTime = 26; - item.useAnimation = 26; - item.UseSound = SoundID.Item1; - item.rare = ItemRarityID.Cyan; - item.Calamity().rogue = true; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.useTime = 26; + Item.useAnimation = 26; + Item.UseSound = SoundID.Item1; + Item.rare = ItemRarityID.Cyan; + Item.Calamity().rogue = true; - item.autoReuse = true; - item.shootSpeed = 8f; - item.shoot = ModContent.ProjectileType(); + Item.autoReuse = true; + Item.shootSpeed = 8f; + Item.shoot = ModContent.ProjectileType(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/RogueWeapon.cs b/Items/Weapons/Rogue/RogueWeapon.cs index b829e2df3e..65674fc8eb 100644 --- a/Items/Weapons/Rogue/RogueWeapon.cs +++ b/Items/Weapons/Rogue/RogueWeapon.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue newPrefix.Add("Flimsy", 1); newPrefix.Add("Unbalanced", 1); newPrefix.Add("Atrocious", 1); - return mod.GetPrefix(newPrefix).Type; + return Mod.GetPrefix(newPrefix).Type; } public override bool NewPreReforge() @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool? PrefixChance(int pre, UnifiedRandom rand) { - if (item.maxStack > 1) + if (Item.maxStack > 1) { return false; } @@ -68,11 +68,11 @@ namespace CalamityMod.Items.Weapons.Rogue public sealed override void SetDefaults() { SafeSetDefaults(); - item.melee = false; - item.ranged = false; - item.magic = false; - item.thrown = true; - item.summon = false; + // item.melee = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + // item.ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + // item.magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + Item.DamageType = DamageClass.Throwing; + // item.summon = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; } // Add both the player's dedicated rogue damage and stealth strike damage as applicable. @@ -88,7 +88,7 @@ namespace CalamityMod.Items.Weapons.Rogue add += mp.throwingDamage + mp.stealthDamage - 1f; // Boost (or lower) the weapon's damage if it has a stealth strike available and an associated prefix - if (mp.StealthStrikeAvailable() && item.prefix > 0) + if (mp.StealthStrikeAvailable() && Item.prefix > 0) mult += StealthStrikePrefixBonus - 1f; } @@ -105,7 +105,7 @@ namespace CalamityMod.Items.Weapons.Rogue { float baseMultiplier = SafeSetUseTimeMultiplier(player); float rogueAS = baseMultiplier == -1f ? 1f : baseMultiplier; - if (item.useTime == item.useAnimation) + if (Item.useTime == Item.useAnimation) { rogueAS += player.Calamity().rogueUseSpeedFactor; } @@ -120,7 +120,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void ModifyTooltips(List tooltips) { - TooltipLine damageTooltip = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria"); + TooltipLine damageTooltip = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.Mod == "Terraria"); if (damageTooltip != null) { // Replace the word "throwing" with "rogue" in the item's damage line. @@ -137,7 +137,7 @@ namespace CalamityMod.Items.Weapons.Rogue string restOfTooltip = text.Substring(damageNumberSubstringIndex); int damageWithStealth = int.Parse(text.Substring(0, damageNumberSubstringIndex)); - int damageWithoutStealth = (int)(item.damage * (p.allDamage + p.thrownDamage + mp.throwingDamage - 2f)); + int damageWithoutStealth = (int)(Item.damage * (p.allDamage + p.GetDamage(DamageClass.Throwing) + mp.throwingDamage - 2f)); text = damageWithoutStealth + restOfTooltip + " : " + damageWithStealth + " stealth strike damage"; } } @@ -146,14 +146,14 @@ namespace CalamityMod.Items.Weapons.Rogue } // Add a tooltip line for the stealth strike damage bonus of the item's prefix, if applicable. - if (item.prefix > 0) + if (Item.prefix > 0) { float ssDmgBoost = StealthStrikePrefixBonus - 1f; if (ssDmgBoost != 0f) { bool badModifier = ssDmgBoost < 0f; string txt = (badModifier ? "-" : "+") + Math.Round(Math.Abs(ssDmgBoost) * 100f) + "% stealth strike damage"; - TooltipLine stealthTooltip = new TooltipLine(mod, "PrefixSSDmg", txt) + TooltipLine stealthTooltip = new TooltipLine(Mod, "PrefixSSDmg", txt) { isModifier = true, isModifierBad = badModifier diff --git a/Items/Weapons/Rogue/RotBall.cs b/Items/Weapons/Rogue/RotBall.cs index 57cc10981c..33467b8a4b 100644 --- a/Items/Weapons/Rogue/RotBall.cs +++ b/Items/Weapons/Rogue/RotBall.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 30; - item.damage = 26; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 13; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 30; - item.maxStack = 999; - item.value = 1000; - item.rare = ItemRarityID.Orange; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().rogue = true; + Item.width = 30; + Item.damage = 26; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 13; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 13; + Item.knockBack = 2.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 30; + Item.maxStack = 999; + Item.value = 1000; + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -57,13 +57,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.RottenChunk); - recipe.AddIngredient(ItemID.DemoniteBar); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.RottenChunk).AddIngredient(ItemID.DemoniteBar).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Rogue/Sacrifice.cs b/Items/Weapons/Rogue/Sacrifice.cs index fee365b546..72d2c00570 100644 --- a/Items/Weapons/Rogue/Sacrifice.cs +++ b/Items/Weapons/Rogue/Sacrifice.cs @@ -20,25 +20,25 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 290; - item.width = item.height = 68; - item.useAnimation = item.useTime = 9; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.damage = 290; + Item.width = Item.height = 68; + Item.useAnimation = Item.useTime = 9; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } - public override bool AltFunctionUse(Player player) => player.ownedProjectileCounts[item.shoot] > 0; + public override bool AltFunctionUse(Player player) => player.ownedProjectileCounts[Item.shoot] > 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Rogue/SandDollar.cs b/Items/Weapons/Rogue/SandDollar.cs index 9484b5ed1f..8e844392a1 100644 --- a/Items/Weapons/Rogue/SandDollar.cs +++ b/Items/Weapons/Rogue/SandDollar.cs @@ -18,31 +18,31 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 30; - item.height = 28; - item.damage = 26; - item.thrown = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.maxStack = 2; - item.knockBack = 3.5f; - item.autoReuse = true; - item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Green; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; - item.Calamity().rogue = true; + Item.width = 30; + Item.height = 28; + Item.damage = 26; + Item.DamageType = DamageClass.Throwing; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.maxStack = 2; + Item.knockBack = 3.5f; + Item.autoReuse = true; + Item.UseSound = SoundID.Item1; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.Calamity().rogue = true; } public override bool CanUseItem(Player player) { - int UseMax = item.stack - 1; + int UseMax = Item.stack - 1; - if (player.ownedProjectileCounts[item.shoot] > UseMax && !player.Calamity().StealthStrikeAvailable()) + if (player.ownedProjectileCounts[Item.shoot] > UseMax && !player.Calamity().StealthStrikeAvailable()) { return false; } diff --git a/Items/Weapons/Rogue/Sandslasher.cs b/Items/Weapons/Rogue/Sandslasher.cs index 77975c031c..b15fdbb610 100644 --- a/Items/Weapons/Rogue/Sandslasher.cs +++ b/Items/Weapons/Rogue/Sandslasher.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 40; - item.height = 40; - item.damage = 115; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7f; - item.Calamity().rogue = true; + Item.width = 40; + Item.height = 40; + Item.damage = 115; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -51,14 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddRecipeGroup("AnyGoldBar", 10); - recipe.AddIngredient(ItemID.HardenedSand, 25); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 6).AddRecipeGroup("AnyGoldBar", 10).AddIngredient(ItemID.HardenedSand, 25).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/ScarletDevil.cs b/Items/Weapons/Rogue/ScarletDevil.cs index 0f4dc56507..53bde0443a 100644 --- a/Items/Weapons/Rogue/ScarletDevil.cs +++ b/Items/Weapons/Rogue/ScarletDevil.cs @@ -21,23 +21,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 108; - item.height = 108; - item.damage = 8000; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = item.useTime = 81; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 8f; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 30f; - item.Calamity().rogue = true; + Item.width = 108; + Item.height = 108; + Item.damage = 8000; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = Item.useTime = 81; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item60; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.Calamity().rogue = true; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -53,15 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.SoulofNight, 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.SoulofNight, 15).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Rogue/ScourgeoftheDesert.cs b/Items/Weapons/Rogue/ScourgeoftheDesert.cs index 00c77de07b..b45533b181 100644 --- a/Items/Weapons/Rogue/ScourgeoftheDesert.cs +++ b/Items/Weapons/Rogue/ScourgeoftheDesert.cs @@ -17,22 +17,22 @@ Stealth strikes gain damage as they damage enemies"); public override void SafeSetDefaults() { - item.width = 44; - item.damage = 16; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 44; + Item.damage = 16; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 3.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 44; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/ScourgeoftheSeas.cs b/Items/Weapons/Rogue/ScourgeoftheSeas.cs index 3246ab5208..442141ac91 100644 --- a/Items/Weapons/Rogue/ScourgeoftheSeas.cs +++ b/Items/Weapons/Rogue/ScourgeoftheSeas.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 45; - item.knockBack = 3.5f; - item.useAnimation = item.useTime = 20; - item.autoReuse = true; - item.Calamity().rogue = true; - item.shootSpeed = 8f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 45; + Item.knockBack = 3.5f; + Item.useAnimation = Item.useTime = 20; + Item.autoReuse = true; + Item.Calamity().rogue = true; + Item.shootSpeed = 8f; + Item.shoot = ModContent.ProjectileType(); - item.width = 64; - item.height = 66; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.rare = ItemRarityID.Pink; - item.value = Item.buyPrice(0, 36, 0, 0); + Item.width = 64; + Item.height = 66; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.rare = ItemRarityID.Pink; + Item.value = Item.buyPrice(0, 36, 0, 0); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/SeafoamBomb.cs b/Items/Weapons/Rogue/SeafoamBomb.cs index 40ac008327..e4c42d3c0a 100644 --- a/Items/Weapons/Rogue/SeafoamBomb.cs +++ b/Items/Weapons/Rogue/SeafoamBomb.cs @@ -18,32 +18,27 @@ Stealth strikes are faster and explode into 5 bubbles"); public override void SafeSetDefaults() { - item.width = 26; - item.height = 44; - item.damage = 12; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 25; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; - item.Calamity().rogue = true; + Item.width = 26; + Item.height = 44; + Item.damage = 12; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 25; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; + Item.Calamity().rogue = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bomb, 25); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Bomb, 25).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/SealedSingularity.cs b/Items/Weapons/Rogue/SealedSingularity.cs index 7e2c0f6b56..60d6134ebe 100644 --- a/Items/Weapons/Rogue/SealedSingularity.cs +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 260; - item.knockBack = 5f; - item.useAnimation = item.useTime = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.Calamity().rogue = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; + Item.damage = 260; + Item.knockBack = 5f; + Item.useAnimation = Item.useTime = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.Calamity().rogue = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; - item.noMelee = item.noUseGraphic = true; - item.height = item.width = 34; - item.UseSound = SoundID.Item106; + Item.noMelee = Item.noUseGraphic = true; + Item.height = Item.width = 34; + Item.UseSound = SoundID.Item106; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.Calamity().donorItem = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -52,12 +52,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Rogue/SearedPan.cs b/Items/Weapons/Rogue/SearedPan.cs index 82ef99fe57..081d58eee5 100644 --- a/Items/Weapons/Rogue/SearedPan.cs +++ b/Items/Weapons/Rogue/SearedPan.cs @@ -27,23 +27,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 60; - item.height = 36; - item.damage = 2222; - item.Calamity().rogue = true; - item.knockBack = 10f; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = item.useAnimation = 25; - item.reuseDelay = 1; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().donorItem = true; + Item.width = 60; + Item.height = 36; + Item.damage = 2222; + Item.Calamity().rogue = true; + Item.knockBack = 10f; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = Item.useAnimation = 25; + Item.reuseDelay = 1; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.Calamity().donorItem = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -71,16 +71,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.Bacon, 4); - recipe.AddIngredient(ItemID.LifeCrystal); - recipe.AddIngredient(ItemID.ManaCrystal); - recipe.AddIngredient(ItemID.Bone, 92); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Bacon, 4).AddIngredient(ItemID.LifeCrystal).AddIngredient(ItemID.ManaCrystal).AddIngredient(ItemID.Bone, 92).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Rogue/SeashellBoomerang.cs b/Items/Weapons/Rogue/SeashellBoomerang.cs index d0110856d6..5b3d647923 100644 --- a/Items/Weapons/Rogue/SeashellBoomerang.cs +++ b/Items/Weapons/Rogue/SeashellBoomerang.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 18; - item.damage = 15; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.height = 34; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11.5f; - item.Calamity().rogue = true; + Item.width = 18; + Item.damage = 15; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 15; + Item.knockBack = 5.5f; + Item.UseSound = SoundID.Item1; + Item.height = 34; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11.5f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -44,11 +44,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/Seraphim.cs b/Items/Weapons/Rogue/Seraphim.cs index f190284c95..03569bc0a0 100644 --- a/Items/Weapons/Rogue/Seraphim.cs +++ b/Items/Weapons/Rogue/Seraphim.cs @@ -23,33 +23,28 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 82; - item.height = 82; - item.damage = 300; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.useTime = 13; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = SeraphimProjectile.InitialSpeed; - item.Calamity().rogue = true; + Item.width = 82; + Item.height = 82; + Item.damage = 300; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 13; + Item.useTime = 13; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = SeraphimProjectile.InitialSpeed; + Item.Calamity().rogue = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/ShatteredSun.cs b/Items/Weapons/Rogue/ShatteredSun.cs index cab1b57b14..d1d971cb88 100644 --- a/Items/Weapons/Rogue/ShatteredSun.cs +++ b/Items/Weapons/Rogue/ShatteredSun.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 56; - item.height = 56; - item.damage = 80; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 12; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 25f; - item.Calamity().rogue = true; + Item.width = 56; + Item.height = 56; + Item.damage = 80; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 12; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 12; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 25f; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -42,12 +42,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.LunarCraftingStation).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/ShinobiBlade.cs b/Items/Weapons/Rogue/ShinobiBlade.cs index 50ef87df8f..ebded0e6cc 100644 --- a/Items/Weapons/Rogue/ShinobiBlade.cs +++ b/Items/Weapons/Rogue/ShinobiBlade.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 16; - item.height = 42; - item.damage = 15; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.maxStack = 1; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.Calamity().rogue = true; + Item.width = 16; + Item.height = 42; + Item.damage = 15; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 15; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.maxStack = 1; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/ShockGrenade.cs b/Items/Weapons/Rogue/ShockGrenade.cs index 4830e28981..5d44dde0e9 100644 --- a/Items/Weapons/Rogue/ShockGrenade.cs +++ b/Items/Weapons/Rogue/ShockGrenade.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 14; - item.damage = 90; - item.noMelee = true; - item.noUseGraphic = true; - item.consumable = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.knockBack = 1f; - item.autoReuse = true; - item.height = 30; - item.maxStack = 999; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Yellow; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12.5f; - item.Calamity().rogue = true; + Item.width = 14; + Item.damage = 90; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.consumable = true; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.knockBack = 1f; + Item.autoReuse = true; + Item.height = 30; + Item.maxStack = 999; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12.5f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -51,18 +51,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ShockGrenadeGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/ShockGrenadeGlow")); } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Grenade, 20); - recipe.AddIngredient(ItemID.MartianConduitPlating, 5); - recipe.AddIngredient(ItemID.Nanites, 5); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.Grenade, 20).AddIngredient(ItemID.MartianConduitPlating, 5).AddIngredient(ItemID.Nanites, 5).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Weapons/Rogue/Shroomerang.cs b/Items/Weapons/Rogue/Shroomerang.cs index 97dfa83c5b..f32fa2bbf1 100644 --- a/Items/Weapons/Rogue/Shroomerang.cs +++ b/Items/Weapons/Rogue/Shroomerang.cs @@ -17,21 +17,21 @@ Stealth strikes grant the Mushy buff to the user on enemy hits and summon homing public override void SafeSetDefaults() { - item.width = 26; - item.damage = 18; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 1.5f; - item.UseSound = SoundID.Item1; - item.height = 50; - item.rare = ItemRarityID.Green; - item.value = Item.buyPrice(0, 2, 0, 0); - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().rogue = true; + Item.width = 26; + Item.damage = 18; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 1.5f; + Item.UseSound = SoundID.Item1; + Item.height = 50; + Item.rare = ItemRarityID.Green; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/SkyStabber.cs b/Items/Weapons/Rogue/SkyStabber.cs index fbfc5c6c90..7b7a978cd8 100644 --- a/Items/Weapons/Rogue/SkyStabber.cs +++ b/Items/Weapons/Rogue/SkyStabber.cs @@ -23,23 +23,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = damage; - item.Calamity().rogue = true; - item.noMelee = true; - item.noUseGraphic = true; - item.width = 1; - item.height = 1; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = knockBack; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item1; - item.maxStack = 4; + Item.damage = damage; + Item.Calamity().rogue = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.width = 1; + Item.height = 1; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = knockBack; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item1; + Item.maxStack = 4; - item.shootSpeed = 2f; - item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 2f; + Item.shoot = ModContent.ProjectileType(); } // Terraria seems to really dislike high crit values in SetDefaults @@ -49,15 +49,15 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.altFunctionUse == 2) { - item.shoot = ProjectileID.None; - item.shootSpeed = 0f; + Item.shoot = ProjectileID.None; + Item.shootSpeed = 0f; return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; } else { - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 2f; - int UseMax = item.stack; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 2f; + int UseMax = Item.stack; return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; } } @@ -85,14 +85,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - - recipe.AddIngredient(ItemID.SpikyBall, 100); - recipe.AddIngredient(ItemID.Cloud, 10); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SpikyBall, 100).AddIngredient(ItemID.Cloud, 10).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.SkyMill).Register(); } } diff --git a/Items/Weapons/Rogue/SkyfinBombers.cs b/Items/Weapons/Rogue/SkyfinBombers.cs index 84cb194a03..026d7fd76d 100644 --- a/Items/Weapons/Rogue/SkyfinBombers.cs +++ b/Items/Weapons/Rogue/SkyfinBombers.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 28; - item.damage = 46; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 35; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 35; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.height = 30; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 28; + Item.damage = 46; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 35; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 35; + Item.knockBack = 6.5f; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.height = 30; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/SlickCane.cs b/Items/Weapons/Rogue/SlickCane.cs index 141dfe50c4..cbdba9754f 100644 --- a/Items/Weapons/Rogue/SlickCane.cs +++ b/Items/Weapons/Rogue/SlickCane.cs @@ -18,31 +18,31 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 42; - item.height = 36; - item.damage = 27; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.melee = true; - item.useAnimation = 26; - item.useTime = 26; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 5f; - item.UseSound = SoundID.DD2_GhastlyGlaivePierce; - item.autoReuse = true; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 22f; - item.Calamity().rogue = true; + Item.width = 42; + Item.height = 36; + Item.damage = 27; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = 26; + Item.useTime = 26; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 5f; + Item.UseSound = SoundID.DD2_GhastlyGlaivePierce; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 22f; + Item.Calamity().rogue = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float ai0 = Main.rand.NextFloat() * item.shootSpeed * 0.75f * (float)player.direction; + float ai0 = Main.rand.NextFloat() * Item.shootSpeed * 0.75f * (float)player.direction; int projectileIndex = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, ai0, 0f); if (projectileIndex.WithinBounds(Main.maxProjectiles)) Main.projectile[projectileIndex].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); diff --git a/Items/Weapons/Rogue/SludgeSplotch.cs b/Items/Weapons/Rogue/SludgeSplotch.cs index 6f139c257e..a3c257d7ae 100644 --- a/Items/Weapons/Rogue/SludgeSplotch.cs +++ b/Items/Weapons/Rogue/SludgeSplotch.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Rogue { @@ -18,28 +19,28 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 32; - item.damage = 30; - item.noMelee = true; - item.noUseGraphic = true; - item.consumable = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.knockBack = 1f; - item.autoReuse = true; - item.height = 30; - item.maxStack = 999; - item.value = Item.sellPrice(0, 0, 0, 40); - item.rare = ItemRarityID.Green; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.Calamity().rogue = true; + Item.width = 32; + Item.damage = 30; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.consumable = true; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.knockBack = 1f; + Item.autoReuse = true; + Item.height = 30; + Item.maxStack = 999; + Item.value = Item.sellPrice(0, 0, 0, 40); + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Main.PlaySound(SoundID.NPCKilled, (int)player.position.X, (int)player.position.Y, 9, 2, 0); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)player.position.X, (int)player.position.Y, 9, 2, 0); if (player.Calamity().StealthStrikeAvailable()) { @@ -53,11 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddRecipeGroup("Boss2Material"); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ModContent.ItemType(), 15).AddRecipeGroup("Boss2Material").Register(); } } } diff --git a/Items/Weapons/Rogue/SnapClam.cs b/Items/Weapons/Rogue/SnapClam.cs index 3a2ca3ed62..ec39686f2f 100644 --- a/Items/Weapons/Rogue/SnapClam.cs +++ b/Items/Weapons/Rogue/SnapClam.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 26; - item.height = 16; - item.damage = 14; - item.thrown = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 26; + Item.height = 16; + Item.damage = 14; + Item.DamageType = DamageClass.Throwing; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/SpearofDestiny.cs b/Items/Weapons/Rogue/SpearofDestiny.cs index 3259e42949..da9fbe03bc 100644 --- a/Items/Weapons/Rogue/SpearofDestiny.cs +++ b/Items/Weapons/Rogue/SpearofDestiny.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 52; - item.damage = 26; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 2f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 52; - item.value = CalamityGlobalItem.Rarity6BuyPrice; - item.rare = ItemRarityID.LightPurple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.Calamity().rogue = true; + Item.width = 52; + Item.damage = 26; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 2f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 52; + Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.rare = ItemRarityID.LightPurple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -51,13 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HallowedBar, 7); - recipe.AddIngredient(ItemID.SoulofLight, 5); - recipe.AddIngredient(ItemID.SoulofFright, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HallowedBar, 7).AddIngredient(ItemID.SoulofLight, 5).AddIngredient(ItemID.SoulofFright, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/SpearofPaleolith.cs b/Items/Weapons/Rogue/SpearofPaleolith.cs index 28c6fbcee9..24a244b4aa 100644 --- a/Items/Weapons/Rogue/SpearofPaleolith.cs +++ b/Items/Weapons/Rogue/SpearofPaleolith.cs @@ -18,32 +18,27 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 54; - item.damage = 65; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 27; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 27; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 54; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 35f; - item.Calamity().rogue = true; + Item.width = 54; + Item.damage = 65; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 27; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 27; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 54; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 35f; + Item.Calamity().rogue = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddRecipeGroup("AnyAdamantiteBar", 4); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.AncientBattleArmorMaterial, 2).AddRecipeGroup("AnyAdamantiteBar", 4).AddTile(TileID.MythrilAnvil).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/SpentFuelContainer.cs b/Items/Weapons/Rogue/SpentFuelContainer.cs index 09e52b7ceb..f5b6ea2113 100644 --- a/Items/Weapons/Rogue/SpentFuelContainer.cs +++ b/Items/Weapons/Rogue/SpentFuelContainer.cs @@ -20,22 +20,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 50; - item.width = 22; - item.height = 24; - item.useAnimation = 35; - item.useTime = 35; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4.5f; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item106; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().rogue = true; + Item.damage = 50; + Item.width = 22; + Item.height = 24; + Item.useAnimation = 35; + Item.useTime = 35; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4.5f; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item106; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index 78e3873e05..cd2ba9cb1e 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -19,21 +19,21 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = item.height = 94; - item.damage = 150; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 38; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 38; - item.knockBack = 10f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; - item.Calamity().rogue = true; + Item.width = Item.height = 94; + Item.damage = 150; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 38; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 38; + Item.knockBack = 10f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -50,11 +50,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Rogue/StellarKnife.cs b/Items/Weapons/Rogue/StellarKnife.cs index fe004803f1..a0cbcfdefb 100644 --- a/Items/Weapons/Rogue/StellarKnife.cs +++ b/Items/Weapons/Rogue/StellarKnife.cs @@ -20,22 +20,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 32; - item.height = 34; - item.damage = 50; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 9; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 9; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.Calamity().rogue = true; + Item.width = 32; + Item.height = 34; + Item.damage = 50; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 9; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 9; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -43,13 +43,13 @@ namespace CalamityMod.Items.Weapons.Rogue 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.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[item.shoot] < knifeLimit) + if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[Item.shoot] < knifeLimit) { damage = (int)(damage * 1.1f); int knifeAmt = knifeCount; - if ((player.ownedProjectileCounts[item.shoot] + knifeCount) >= knifeLimit) - knifeAmt = knifeLimit - player.ownedProjectileCounts[item.shoot]; + if ((player.ownedProjectileCounts[Item.shoot] + knifeCount) >= knifeLimit) + knifeAmt = knifeLimit - player.ownedProjectileCounts[Item.shoot]; if (knifeAmt <= 0) { int knife = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); diff --git a/Items/Weapons/Rogue/StickySpikyBall.cs b/Items/Weapons/Rogue/StickySpikyBall.cs index 8bbcd1006e..42aca75eb6 100644 --- a/Items/Weapons/Rogue/StickySpikyBall.cs +++ b/Items/Weapons/Rogue/StickySpikyBall.cs @@ -17,23 +17,23 @@ Stealth strikes throw seven at once and last a lot longer"); public override void SafeSetDefaults() { - item.width = 14; - item.damage = 10; - item.noMelee = true; - item.noUseGraphic = true; - item.maxStack = 999; - item.consumable = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.height = 14; - item.value = Item.buyPrice(0, 0, 1, 0); - item.rare = ItemRarityID.Blue; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; - item.Calamity().rogue = true; + Item.width = 14; + Item.damage = 10; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.maxStack = 999; + Item.consumable = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item1; + Item.height = 14; + Item.value = Item.buyPrice(0, 0, 1, 0); + Item.rare = ItemRarityID.Blue; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -60,12 +60,7 @@ Stealth strikes throw seven at once and last a lot longer"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpikyBall, 20); - recipe.AddIngredient(ItemID.Gel); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 20); - recipe.AddRecipe(); + CreateRecipe(20).AddIngredient(ItemID.SpikyBall, 20).AddIngredient(ItemID.Gel).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Weapons/Rogue/StormfrontRazor.cs b/Items/Weapons/Rogue/StormfrontRazor.cs index 1570b67959..0d8beb6270 100644 --- a/Items/Weapons/Rogue/StormfrontRazor.cs +++ b/Items/Weapons/Rogue/StormfrontRazor.cs @@ -16,27 +16,27 @@ namespace CalamityMod.Items.Weapons.Rogue DisplayName.SetDefault("Stormfront Razor"); Tooltip.SetDefault("Throws a throwing knife that leaves sparks as it travels.\n" + "Stealth strikes cause the knife to be faster and leave a huge shower of sparks as it travels"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 4)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 4)); } public override void SafeSetDefaults() { - item.width = 38; - item.height = 38; - item.noMelee = true; - item.noUseGraphic = true; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.useAnimation = 15; - item.useTime = 15; - item.damage = 50; - item.knockBack = 7f; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7f; - item.Calamity().rogue = true; + Item.width = 38; + Item.height = 38; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.useAnimation = 15; + Item.useTime = 15; + Item.damage = 50; + Item.knockBack = 7f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7f; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -44,15 +44,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("AnyMythrilBar", 6); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddRecipeGroup("AnyMythrilBar", 6).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.MythrilAnvil).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index ce3aba61f0..5d7024e1d5 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -20,23 +20,23 @@ Stealth strikes release energy as they fly"); public override void SafeSetDefaults() { - item.width = 34; - item.damage = 675; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 24; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 24; - item.knockBack = 8f; - item.UseSound = SoundID.Item15; - item.autoReuse = true; - item.height = 36; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Red; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.width = 34; + Item.damage = 675; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 24; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item15; + Item.autoReuse = true; + Item.height = 36; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Red; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.Calamity().rogue = true; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -54,18 +54,7 @@ Stealth strikes release energy as they fly"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 200); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 200).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Rogue/SylvanSlasher.cs b/Items/Weapons/Rogue/SylvanSlasher.cs index 18fc774372..7da5182f43 100644 --- a/Items/Weapons/Rogue/SylvanSlasher.cs +++ b/Items/Weapons/Rogue/SylvanSlasher.cs @@ -17,23 +17,23 @@ Does not consume stealth and cannot stealth strike"); public override void SafeSetDefaults() { - item.width = 72; - item.damage = 52; - item.Calamity().rogue = true; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 5; - item.knockBack = 3f; - item.autoReuse = false; - item.height = 78; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24f; + Item.width = 72; + Item.damage = 52; + Item.Calamity().rogue = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = 5; + Item.knockBack = 3f; + Item.autoReuse = false; + Item.height = 78; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/TarragonThrowingDart.cs b/Items/Weapons/Rogue/TarragonThrowingDart.cs index e9aeb499f6..3d4ae62fde 100644 --- a/Items/Weapons/Rogue/TarragonThrowingDart.cs +++ b/Items/Weapons/Rogue/TarragonThrowingDart.cs @@ -18,25 +18,25 @@ Stealth strikes erupt into thorns on enemy hits"); public override void SafeSetDefaults() { - item.width = 34; - item.damage = 380; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 11; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 11; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 34; - item.maxStack = 999; - item.value = Item.sellPrice(copper: 30); - item.rare = ItemRarityID.Purple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 34; + Item.damage = 380; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 11; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 11; + Item.knockBack = 4.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 34; + Item.maxStack = 999; + Item.value = Item.sellPrice(copper: 30); + Item.rare = ItemRarityID.Purple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -53,11 +53,7 @@ Stealth strikes erupt into thorns on enemy hits"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 333); - recipe.AddRecipe(); + CreateRecipe(333).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Rogue/TerraDisk.cs b/Items/Weapons/Rogue/TerraDisk.cs index abb02beeaf..d4e91a1ed1 100644 --- a/Items/Weapons/Rogue/TerraDisk.cs +++ b/Items/Weapons/Rogue/TerraDisk.cs @@ -22,25 +22,25 @@ Stealth strikes travel slower and are rapidly orbited by the smaller disks"); public override void SafeSetDefaults() { - item.width = 46; - item.height = 46; - item.damage = BaseDamage; - item.knockBack = 4f; - item.useAnimation = 16; - item.useTime = 16; - item.autoReuse = true; - item.noMelee = true; - item.noUseGraphic = true; + Item.width = 46; + Item.height = 46; + Item.damage = BaseDamage; + Item.knockBack = 4f; + Item.useAnimation = 16; + Item.useTime = 16; + Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(gold: 80); - item.rare = ItemRarityID.Yellow; + Item.value = Item.buyPrice(gold: 80); + Item.rare = ItemRarityID.Yellow; - item.Calamity().rogue = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; + Item.Calamity().rogue = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = Speed; } public override bool CanUseItem(Player player) @@ -52,7 +52,7 @@ Stealth strikes travel slower and are rapidly orbited by the smaller disks"); Projectile proj = Main.projectile[p]; if (!proj.active || proj.owner != player.whoAmI) continue; - if (proj.type == item.shoot && !proj.Calamity().stealthStrike) + if (proj.type == Item.shoot && !proj.Calamity().stealthStrike) { terraDiskCount++; } @@ -80,14 +80,7 @@ Stealth strikes travel slower and are rapidly orbited by the smaller disks"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.SetResult(this); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.ThornChakram); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.ThornChakram).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/TerrorTalons.cs b/Items/Weapons/Rogue/TerrorTalons.cs index 2bb1be56b2..e3dfb84e7c 100644 --- a/Items/Weapons/Rogue/TerrorTalons.cs +++ b/Items/Weapons/Rogue/TerrorTalons.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 40; - item.damage = 47; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 7; - item.useAnimation = 7; - item.knockBack = 3f; - item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.height = 24; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = ItemRarityID.LightPurple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10.5f; - item.Calamity().rogue = true; + Item.width = 40; + Item.damage = 47; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 7; + Item.useAnimation = 7; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item39; + Item.autoReuse = true; + Item.height = 24; + Item.value = Item.buyPrice(0, 48, 0, 0); + Item.rare = ItemRarityID.LightPurple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10.5f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -57,13 +57,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FeralClaws); - recipe.AddIngredient(ItemID.ChlorophyteBar, 5); - recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.FeralClaws).AddIngredient(ItemID.ChlorophyteBar, 5).AddIngredient(ItemID.SoulofFright, 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/TheAtomSplitter.cs b/Items/Weapons/Rogue/TheAtomSplitter.cs index d28e79f11e..bf98f0f2e7 100644 --- a/Items/Weapons/Rogue/TheAtomSplitter.cs +++ b/Items/Weapons/Rogue/TheAtomSplitter.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = item.height = 128; - item.damage = 320; - item.knockBack = 7f; - item.useAnimation = item.useTime = 25; - item.Calamity().rogue = true; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = ModContent.ProjectileType(); + Item.width = Item.height = 128; + Item.damage = 320; + Item.knockBack = 7f; + Item.useAnimation = Item.useTime = 25; + Item.Calamity().rogue = true; + Item.autoReuse = true; + Item.shootSpeed = 24f; + Item.shoot = ModContent.ProjectileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - item.noMelee = true; - item.noUseGraphic = true; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/TheReaper.cs b/Items/Weapons/Rogue/TheReaper.cs index ef967f8909..f41e71a7eb 100644 --- a/Items/Weapons/Rogue/TheReaper.cs +++ b/Items/Weapons/Rogue/TheReaper.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 106; - item.damage = 122; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 22; - item.useTime = 22; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 104; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.Calamity().rogue = true; + Item.width = 106; + Item.damage = 122; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 22; + Item.useTime = 22; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 104; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.Calamity().rogue = true; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ItemRarityID.Purple; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/TheSyringe.cs b/Items/Weapons/Rogue/TheSyringe.cs index d4b08f3f65..c633369cdd 100644 --- a/Items/Weapons/Rogue/TheSyringe.cs +++ b/Items/Weapons/Rogue/TheSyringe.cs @@ -23,22 +23,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = BaseDamage; - item.knockBack = Knockback; - item.autoReuse = true; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.width = 14; - item.height = 50; - item.UseSound = SoundID.Item106; - item.noMelee = true; - item.noUseGraphic = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.Calamity().rogue = true; + Item.damage = BaseDamage; + Item.knockBack = Knockback; + Item.autoReuse = true; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.width = 14; + Item.height = 50; + Item.UseSound = SoundID.Item106; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = Speed; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/ThrowingBrick.cs b/Items/Weapons/Rogue/ThrowingBrick.cs index 93fe2bc40f..bcacbb22cf 100644 --- a/Items/Weapons/Rogue/ThrowingBrick.cs +++ b/Items/Weapons/Rogue/ThrowingBrick.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Rogue } public override void SafeSetDefaults() { - item.damage = 14; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); - item.width = 26; - item.height = 20; - item.useTime = item.useAnimation = 40; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 0, 0, 50); - item.rare = ItemRarityID.White; - item.maxStack = 999; - item.UseSound = SoundID.Item1; - item.consumable = true; - item.noMelee = true; - item.noUseGraphic = true; - item.Calamity().rogue = true; + Item.damage = 14; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.width = 26; + Item.height = 20; + Item.useTime = Item.useAnimation = 40; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 5f; + Item.value = Item.buyPrice(0, 0, 0, 50); + Item.rare = ItemRarityID.White; + Item.maxStack = 999; + Item.UseSound = SoundID.Item1; + Item.consumable = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -51,11 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RedBrick, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 20); - recipe.AddRecipe(); + CreateRecipe(20).AddIngredient(ItemID.RedBrick, 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Rogue/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index 1f220218c9..36415e21de 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -18,24 +18,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 24; - item.height = 46; - item.damage = 432; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().rogue = true; + Item.width = 24; + Item.height = 46; + Item.damage = 432; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.Calamity().donorItem = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -54,14 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.FastClock); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.FastClock).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Rogue/TitaniumShuriken.cs b/Items/Weapons/Rogue/TitaniumShuriken.cs index 7a3d87a2b3..cd504fb49f 100644 --- a/Items/Weapons/Rogue/TitaniumShuriken.cs +++ b/Items/Weapons/Rogue/TitaniumShuriken.cs @@ -15,24 +15,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 38; - item.damage = 37; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 9; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 9; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 38; - item.maxStack = 999; - item.value = 2000; - item.rare = ItemRarityID.LightRed; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().rogue = true; + Item.width = 38; + Item.damage = 37; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 9; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 9; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 38; + Item.maxStack = 999; + Item.value = 2000; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -57,11 +57,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitaniumBar); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ItemID.TitaniumBar).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/ToothBall.cs b/Items/Weapons/Rogue/ToothBall.cs index e003f6d94d..faf5083ae0 100644 --- a/Items/Weapons/Rogue/ToothBall.cs +++ b/Items/Weapons/Rogue/ToothBall.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 30; - item.damage = 26; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 13; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 30; - item.maxStack = 999; - item.value = 1000; - item.rare = ItemRarityID.Orange; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().rogue = true; + Item.width = 30; + Item.damage = 26; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 13; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 13; + Item.knockBack = 2.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 30; + Item.maxStack = 999; + Item.value = 1000; + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.Calamity().rogue = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -57,13 +57,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Vertebrae); - recipe.AddIngredient(ItemID.CrimtaneBar); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Vertebrae).AddIngredient(ItemID.CrimtaneBar).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Rogue/TotalityBreakers.cs b/Items/Weapons/Rogue/TotalityBreakers.cs index 82c7221af3..29cd5d0eb1 100644 --- a/Items/Weapons/Rogue/TotalityBreakers.cs +++ b/Items/Weapons/Rogue/TotalityBreakers.cs @@ -19,22 +19,22 @@ Stealth strikes leak tar as they fly"); public override void SafeSetDefaults() { - item.width = 32; - item.damage = 55; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 28; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 28; - item.knockBack = 5f; - item.UseSound = SoundID.Item106; - item.autoReuse = true; - item.height = 42; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 32; + Item.damage = 55; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 28; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 28; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item106; + Item.autoReuse = true; + Item.height = 42; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -51,15 +51,7 @@ Stealth strikes leak tar as they fly"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MolotovCocktail, 50); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.MolotovCocktail, 50).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index f2ac0a33b1..506035316d 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 42; - item.height = 46; - item.damage = 323; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = item.useTime = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; - item.Calamity().rogue = true; + Item.width = 42; + Item.height = 46; + Item.damage = 323; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; + Item.Calamity().rogue = true; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/Turbulance.cs b/Items/Weapons/Rogue/Turbulance.cs index f68e33ec53..add584ec7d 100644 --- a/Items/Weapons/Rogue/Turbulance.cs +++ b/Items/Weapons/Rogue/Turbulance.cs @@ -19,22 +19,22 @@ Stealth strikes are trailed by homing wind slashes"); public override void SafeSetDefaults() { - item.width = 14; - item.damage = 18; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 14; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 14; + Item.damage = 18; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 18; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 18; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 14; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -51,13 +51,7 @@ Stealth strikes are trailed by homing wind slashes"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.SunplateBlock, 3); - recipe.AddIngredient(ItemID.Cloud, 4); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.SunplateBlock, 3).AddIngredient(ItemID.Cloud, 4).AddTile(TileID.SkyMill).Register(); } } } diff --git a/Items/Weapons/Rogue/UrchinStinger.cs b/Items/Weapons/Rogue/UrchinStinger.cs index be1b217dd7..439ddf074c 100644 --- a/Items/Weapons/Rogue/UrchinStinger.cs +++ b/Items/Weapons/Rogue/UrchinStinger.cs @@ -15,24 +15,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 10; - item.damage = 17; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 14; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 14; - item.knockBack = 1.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 26; - item.maxStack = 999; - item.value = 200; - item.rare = ItemRarityID.Blue; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 10; + Item.damage = 17; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 14; + Item.knockBack = 1.5f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 26; + Item.maxStack = 999; + Item.value = 200; + Item.rare = ItemRarityID.Blue; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/UtensilPoker.cs b/Items/Weapons/Rogue/UtensilPoker.cs index 4ed157dadc..71a41e71a3 100644 --- a/Items/Weapons/Rogue/UtensilPoker.cs +++ b/Items/Weapons/Rogue/UtensilPoker.cs @@ -21,23 +21,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 44; - item.height = 66; - item.damage = 333; - item.Calamity().rogue = true; - item.knockBack = 8f; - item.noMelee = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.reuseDelay = 15; - item.useAnimation = 45; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.width = 44; + Item.height = 66; + Item.damage = 333; + Item.Calamity().rogue = true; + Item.knockBack = 8f; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 15; + Item.reuseDelay = 15; + Item.useAnimation = 45; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -55,13 +55,13 @@ namespace CalamityMod.Items.Weapons.Rogue } else { - int utensil = item.shoot; + int utensil = Item.shoot; double dmgMult = 1D; float kbMult = 1f; switch (Main.rand.Next(3)) { case 0: - utensil = item.shoot; + utensil = Item.shoot; dmgMult = 1.1; kbMult = 2f; break; diff --git a/Items/Weapons/Rogue/Valediction.cs b/Items/Weapons/Rogue/Valediction.cs index cfb719cc8d..7d66c3aad4 100644 --- a/Items/Weapons/Rogue/Valediction.cs +++ b/Items/Weapons/Rogue/Valediction.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 80; - item.height = 64; - item.damage = 243; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.Calamity().rogue = true; + Item.width = 80; + Item.height = 64; + Item.damage = 243; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 17; + Item.useTime = 17; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 7f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; + Item.Calamity().rogue = true; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/WebBall.cs b/Items/Weapons/Rogue/WebBall.cs index 729fecd6a9..1e12f62249 100644 --- a/Items/Weapons/Rogue/WebBall.cs +++ b/Items/Weapons/Rogue/WebBall.cs @@ -17,23 +17,23 @@ Stealth strikes slow enemies down longer"); public override void SafeSetDefaults() { - item.width = 20; - item.damage = 8; - item.noMelee = true; - item.noUseGraphic = true; - item.maxStack = 999; - item.consumable = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.height = 18; - item.value = Item.buyPrice(0, 0, 0, 30); - item.rare = ItemRarityID.White; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6.5f; - item.Calamity().rogue = true; + Item.width = 20; + Item.damage = 8; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.maxStack = 999; + Item.consumable = true; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 20; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item1; + Item.height = 18; + Item.value = Item.buyPrice(0, 0, 0, 30); + Item.rare = ItemRarityID.White; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6.5f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -50,10 +50,7 @@ Stealth strikes slow enemies down longer"); public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Cobweb, 5); - recipe.SetResult(this, 20); - recipe.AddRecipe(); + CreateRecipe(20).AddIngredient(ItemID.Cobweb, 5).Register(); } } } diff --git a/Items/Weapons/Rogue/WulfrumKnife.cs b/Items/Weapons/Rogue/WulfrumKnife.cs index 3b05bd5fb3..d376279fd0 100644 --- a/Items/Weapons/Rogue/WulfrumKnife.cs +++ b/Items/Weapons/Rogue/WulfrumKnife.cs @@ -17,33 +17,29 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 22; - item.damage = 11; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 38; - item.maxStack = 999; - item.value = Item.sellPrice(0, 0, 0, 5); - item.rare = ItemRarityID.Blue; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + Item.width = 22; + Item.damage = 11; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 15; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 38; + Item.maxStack = 999; + Item.value = Item.sellPrice(0, 0, 0, 5); + Item.rare = ItemRarityID.Blue; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.Calamity().rogue = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/XerocPitchfork.cs b/Items/Weapons/Rogue/XerocPitchfork.cs index 4113846d81..78d8e41e51 100644 --- a/Items/Weapons/Rogue/XerocPitchfork.cs +++ b/Items/Weapons/Rogue/XerocPitchfork.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 48; - item.damage = 280; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 19; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 19; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 48; - item.maxStack = 999; - item.value = 10000; - item.rare = ItemRarityID.Cyan; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24f; - item.Calamity().rogue = true; + Item.width = 48; + Item.damage = 280; + Item.noMelee = true; + Item.consumable = true; + Item.noUseGraphic = true; + Item.useAnimation = 19; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 19; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 48; + Item.maxStack = 999; + Item.value = 10000; + Item.rare = ItemRarityID.Cyan; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; + Item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -50,11 +50,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 100); - recipe.AddRecipe(); + CreateRecipe(100).AddIngredient(ModContent.ItemType()).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Summon/AbandonedSlimeStaff.cs b/Items/Weapons/Summon/AbandonedSlimeStaff.cs index 2be2e612ea..80be41272e 100644 --- a/Items/Weapons/Summon/AbandonedSlimeStaff.cs +++ b/Items/Weapons/Summon/AbandonedSlimeStaff.cs @@ -22,23 +22,23 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.width = 62; - item.height = 62; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.UseSound = SoundID.Item44; + Item.width = 62; + Item.height = 62; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.UseSound = SoundID.Item44; - item.summon = true; - item.mana = 40; - item.damage = 56; - item.knockBack = 3f; - item.useTime = item.useAnimation = 20; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.mana = 40; + Item.damage = 56; + Item.knockBack = 3f; + Item.useTime = Item.useAnimation = 20; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.Calamity().donorItem = true; } public override void HoldItem(Player player) diff --git a/Items/Weapons/Summon/AncientIceChunk.cs b/Items/Weapons/Summon/AncientIceChunk.cs index d9dd22c34a..579c8a710a 100644 --- a/Items/Weapons/Summon/AncientIceChunk.cs +++ b/Items/Weapons/Summon/AncientIceChunk.cs @@ -17,27 +17,27 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 35; - item.mana = 10; - item.width = 30; - item.height = 30; - item.useTime = item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item30; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 35; + Item.mana = 10; + Item.width = 30; + Item.height = 30; + Item.useTime = Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item30; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) { - float num72 = item.shootSpeed; - player.itemTime = item.useTime; + float num72 = Item.shootSpeed; + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Summon/AngryChickenStaff.cs b/Items/Weapons/Summon/AngryChickenStaff.cs index 4a441036f0..c9a03f82d8 100644 --- a/Items/Weapons/Summon/AngryChickenStaff.cs +++ b/Items/Weapons/Summon/AngryChickenStaff.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = Damage; - item.mana = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.width = 80; - item.height = 74; - item.useTime = item.useAnimation = 10; - item.noMelee = true; - item.knockBack = 7f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = Damage; + Item.mana = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.width = 80; + Item.height = 74; + Item.useTime = Item.useAnimation = 10; + Item.noMelee = true; + Item.knockBack = 7f; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs index 46dd263154..b92732f800 100644 --- a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs +++ b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 5; - item.mana = 10; - item.width = 40; - item.height = 42; - item.useTime = item.useAnimation = 35; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 5; + Item.mana = 10; + Item.width = 40; + Item.height = 42; + Item.useTime = Item.useAnimation = 35; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 1f; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) { @@ -39,14 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Vine, 4); - recipe.AddIngredient(ItemID.JungleSpores, 5); - recipe.AddIngredient(ItemID.Stinger, 8); - recipe.AddIngredient(ItemID.RichMahogany, 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Vine, 4).AddIngredient(ItemID.JungleSpores, 5).AddIngredient(ItemID.Stinger, 8).AddIngredient(ItemID.RichMahogany, 25).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Summon/BensUmbrella.cs b/Items/Weapons/Summon/BensUmbrella.cs index dbafc104cf..26905971bf 100644 --- a/Items/Weapons/Summon/BensUmbrella.cs +++ b/Items/Weapons/Summon/BensUmbrella.cs @@ -21,25 +21,25 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 193; - item.knockBack = 1f; - item.mana = 99; - item.useTime = item.useAnimation = 10; - item.summon = true; - item.shootSpeed = 0f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 193; + Item.knockBack = 1f; + Item.mana = 99; + Item.useTime = Item.useAnimation = 10; + Item.DamageType = DamageClass.Summon; + Item.shootSpeed = 0f; + Item.shoot = ModContent.ProjectileType(); - item.useStyle = ItemUseStyleID.SwingThrow; - item.width = 74; - item.height = 72; - item.noMelee = true; - item.UseSound = SoundID.Item68; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.width = 74; + Item.height = 72; + Item.noMelee = true; + Item.UseSound = SoundID.Item68; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 5; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 5; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -50,15 +50,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Umbrella); - recipe.AddIngredient(ItemID.TopHat); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Umbrella).AddIngredient(ItemID.TopHat).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Summon/BlackHawkRemote.cs b/Items/Weapons/Summon/BlackHawkRemote.cs index e3cca5f82e..d7dd23636e 100644 --- a/Items/Weapons/Summon/BlackHawkRemote.cs +++ b/Items/Weapons/Summon/BlackHawkRemote.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 32; - item.mana = 10; - item.width = 46; - item.height = 28; - item.useTime = item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.UseSound = SoundID.Item15; //phaseblade sound effect - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; - item.rare = ItemRarityID.LightRed; + Item.damage = 32; + Item.mana = 10; + Item.width = 46; + Item.height = 28; + Item.useTime = Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.knockBack = 1f; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.UseSound = SoundID.Item15; //phaseblade sound effect + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.rare = ItemRarityID.LightRed; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/BlightedEyeStaff.cs b/Items/Weapons/Summon/BlightedEyeStaff.cs index a017fad1ce..b3b6a17d85 100644 --- a/Items/Weapons/Summon/BlightedEyeStaff.cs +++ b/Items/Weapons/Summon/BlightedEyeStaff.cs @@ -18,30 +18,30 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 40; - item.mana = 10; - item.width = 52; - item.height = 52; - item.useTime = item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item82; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 40; + Item.mana = 10; + Item.width = 52; + Item.height = 52; + Item.useTime = Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item82; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) { int i = Main.myPlayer; - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; + num74 = player.GetWeaponKnockback(Item, num74); + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Summon/BloodClotStaff.cs b/Items/Weapons/Summon/BloodClotStaff.cs index 948f6fb161..b8667cfe71 100644 --- a/Items/Weapons/Summon/BloodClotStaff.cs +++ b/Items/Weapons/Summon/BloodClotStaff.cs @@ -17,32 +17,26 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 7; - item.mana = 10; - item.width = 58; - item.height = 64; - item.useTime = item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 7; + Item.mana = 10; + Item.width = 58; + Item.height = 64; + Item.useTime = Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Vertebrae, 4); - recipe.AddIngredient(ItemID.CrimtaneBar, 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Vertebrae, 4).AddIngredient(ItemID.CrimtaneBar, 5).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.DemonAltar).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/BorealisBomber.cs b/Items/Weapons/Summon/BorealisBomber.cs index 0964b66593..8ffa425502 100644 --- a/Items/Weapons/Summon/BorealisBomber.cs +++ b/Items/Weapons/Summon/BorealisBomber.cs @@ -14,26 +14,26 @@ namespace CalamityMod.Items.Weapons.Summon Tooltip.SetDefault("Summons aureus bombers to fight for you\n" + "Aureus bombers explode on enemy impact\n" + "Does not consume minion slots"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 35; - item.mana = 10; - item.width = 48; - item.height = 56; - item.useTime = item.useAnimation = 19; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item44; + Item.damage = 35; + Item.mana = 10; + Item.width = 48; + Item.height = 56; + Item.useTime = Item.useAnimation = 19; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item44; //item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; } public override Vector2? HoldoutOrigin() diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs index 62df9fb9fd..822bce77d4 100644 --- a/Items/Weapons/Summon/CadaverousCarrion.cs +++ b/Items/Weapons/Summon/CadaverousCarrion.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 384; - item.mana = 10; - item.summon = true; - item.sentry = true; - item.width = 54; - item.height = 56; - item.useTime = item.useAnimation = 14; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.autoReuse = true; - item.knockBack = 4f; - item.UseSound = SoundID.NPCDeath13; - item.shoot = ModContent.ProjectileType(); + Item.damage = 384; + Item.mana = 10; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; + Item.width = 54; + Item.height = 56; + Item.useTime = Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.autoReuse = true; + Item.knockBack = 4f; + Item.UseSound = SoundID.NPCDeath13; + Item.shoot = ModContent.ProjectileType(); - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/CalamarisLament.cs b/Items/Weapons/Summon/CalamarisLament.cs index 47f3d41d16..4050ed279d 100644 --- a/Items/Weapons/Summon/CalamarisLament.cs +++ b/Items/Weapons/Summon/CalamarisLament.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 95; - item.mana = 10; - item.width = 62; - item.height = 62; - item.useTime = item.useAnimation = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item83; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.damage = 95; + Item.mana = 10; + Item.width = 62; + Item.height = 62; + Item.useTime = Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2.5f; + Item.value = Item.buyPrice(1, 40, 0, 0); + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item83; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/CausticCroakerStaff.cs b/Items/Weapons/Summon/CausticCroakerStaff.cs index 54e8bfd5e2..1cdd065243 100644 --- a/Items/Weapons/Summon/CausticCroakerStaff.cs +++ b/Items/Weapons/Summon/CausticCroakerStaff.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 8; - item.mana = 10; - item.width = 36; - item.height = 42; - item.useTime = item.useAnimation = 35; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 0f; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 8; + Item.mana = 10; + Item.width = 36; + Item.height = 42; + Item.useTime = Item.useAnimation = 35; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 0f; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/CausticStaff.cs b/Items/Weapons/Summon/CausticStaff.cs index 3735d9e839..bb7d38d507 100644 --- a/Items/Weapons/Summon/CausticStaff.cs +++ b/Items/Weapons/Summon/CausticStaff.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.mana = 10; - item.damage = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.shootSpeed = 10f; - item.shoot = ModContent.ProjectileType(); - item.width = 26; - item.height = 28; - item.UseSound = SoundID.Item77; - item.useAnimation = item.useTime = 25; + Item.mana = 10; + Item.damage = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.shootSpeed = 10f; + Item.shoot = ModContent.ProjectileType(); + Item.width = 26; + Item.height = 28; + Item.UseSound = SoundID.Item77; + Item.useAnimation = Item.useTime = 25; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.Calamity().donorItem = true; - item.noMelee = true; - item.knockBack = 2f; - item.summon = true; - item.autoReuse = true; + Item.noMelee = true; + Item.knockBack = 2f; + Item.DamageType = DamageClass.Summon; + Item.autoReuse = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -48,14 +48,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyEvilFlask", 5); - recipe.AddIngredient(ItemID.Deathweed, 2); - recipe.AddIngredient(ItemID.SoulofNight, 10); - recipe.AddRecipeGroup("AnyEvilBar", 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyEvilFlask", 5).AddIngredient(ItemID.Deathweed, 2).AddIngredient(ItemID.SoulofNight, 10).AddRecipeGroup("AnyEvilBar", 10).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Summon/CinderBlossomStaff.cs b/Items/Weapons/Summon/CinderBlossomStaff.cs index bc7c51bc0f..e8f436d3d0 100644 --- a/Items/Weapons/Summon/CinderBlossomStaff.cs +++ b/Items/Weapons/Summon/CinderBlossomStaff.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 25; - item.mana = 10; - item.width = 46; - item.height = 46; - item.useTime = item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item34; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 25; + Item.mana = 10; + Item.width = 46; + Item.height = 46; + Item.useTime = Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item34; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityUtils.KillShootProjectiles(true, type, player); @@ -41,13 +41,7 @@ namespace CalamityMod.Items.Weapons.Summon } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Fireblossom, 5); - recipe.AddIngredient(ItemID.LavaBucket, 2); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Fireblossom, 5).AddIngredient(ItemID.LavaBucket, 2).AddIngredient(ItemID.HellstoneBar, 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Summon/CindersOfLament.cs b/Items/Weapons/Summon/CindersOfLament.cs index 55b1f1e203..a675524022 100644 --- a/Items/Weapons/Summon/CindersOfLament.cs +++ b/Items/Weapons/Summon/CindersOfLament.cs @@ -22,22 +22,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.mana = 10; - item.damage = 1666; - item.useStyle = ItemUseStyleID.SwingThrow; - item.width = 86; - item.height = 92; - item.useTime = item.useAnimation = 30; // 29 because of useStyle 1 - item.autoReuse = true; - item.noMelee = true; - item.knockBack = 0f; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Violet; - item.UseSound = SoundID.DD2_BetsySummon; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.mana = 10; + Item.damage = 1666; + Item.useStyle = ItemUseStyleID.Swing; + Item.width = 86; + Item.height = 92; + Item.useTime = Item.useAnimation = 30; // 29 because of useStyle 1 + Item.autoReuse = true; + Item.noMelee = true; + Item.knockBack = 0f; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.UseSound = SoundID.DD2_BetsySummon; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/ColdDivinity.cs b/Items/Weapons/Summon/ColdDivinity.cs index d16e867a0e..d393126cd1 100644 --- a/Items/Weapons/Summon/ColdDivinity.cs +++ b/Items/Weapons/Summon/ColdDivinity.cs @@ -21,22 +21,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 48; - item.mana = 10; - item.width = 52; - item.height = 50; - item.useTime = item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item30; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 48; + Item.mana = 10; + Item.width = 52; + Item.height = 50; + Item.useTime = Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.knockBack = 4.5f; + Item.UseSound = SoundID.Item30; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/CorroslimeStaff.cs b/Items/Weapons/Summon/CorroslimeStaff.cs index 049c722d19..9100e89508 100644 --- a/Items/Weapons/Summon/CorroslimeStaff.cs +++ b/Items/Weapons/Summon/CorroslimeStaff.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 24; - item.mana = 10; - item.width = 52; - item.height = 54; - item.useTime = item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 24; + Item.mana = 10; + Item.width = 52; + Item.height = 54; + Item.useTime = Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index f4e6f1aa3e..c90968ce49 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -19,23 +19,23 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.width = 54; - item.height = 52; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.UseSound = SoundID.DD2_BetsyFlyingCircleAttack; - item.summon = true; - item.mana = 10; - item.damage = 114; - item.knockBack = 2f; - item.autoReuse = true; - item.useTime = item.useAnimation = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; + Item.width = 54; + Item.height = 52; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.UseSound = SoundID.DD2_BetsyFlyingCircleAttack; + Item.DamageType = DamageClass.Summon; + Item.mana = 10; + Item.damage = 114; + Item.knockBack = 2f; + Item.autoReuse = true; + Item.useTime = Item.useAnimation = 10; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = Item.buyPrice(2, 50, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -49,13 +49,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RavenStaff); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RavenStaff).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index d1c63c4e25..2a1168b873 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -22,24 +22,24 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.mana = 10; - item.damage = 560; - item.useStyle = ItemUseStyleID.SwingThrow; - item.width = 74; - item.height = 72; - item.useTime = item.useAnimation = 10; - item.noMelee = true; - item.knockBack = 0f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item60; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.mana = 10; + Item.damage = 560; + Item.useStyle = ItemUseStyleID.Swing; + Item.width = 74; + Item.height = 72; + Item.useTime = Item.useAnimation = 10; + Item.noMelee = true; + Item.knockBack = 0f; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item60; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.Calamity().customRarity = CalamityRarity.Violet; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 10; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 10; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -52,15 +52,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index f76be4ceee..c5b98cbb6a 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -20,22 +20,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 138; - item.mana = 10; - item.width = 46; - item.height = 28; - item.useTime = item.useAnimation = 9; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item15; //phaseblade sound effect - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 138; + Item.mana = 10; + Item.width = 46; + Item.height = 28; + Item.useTime = Item.useAnimation = 9; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.knockBack = 6f; + Item.UseSound = SoundID.Item15; //phaseblade sound effect + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -43,10 +43,10 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { int i = Main.myPlayer; - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; float knockback = knockBack; - knockback = player.GetWeaponKnockback(item, knockback); - player.itemTime = item.useTime; + knockback = player.GetWeaponKnockback(Item, knockback); + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -78,13 +78,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 10).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Summon/Cosmilamp.cs b/Items/Weapons/Summon/Cosmilamp.cs index f40fd09661..9f9998d006 100644 --- a/Items/Weapons/Summon/Cosmilamp.cs +++ b/Items/Weapons/Summon/Cosmilamp.cs @@ -18,29 +18,29 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 89; - item.mana = 10; - item.width = 42; - item.height = 60; - item.useTime = item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 4f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 89; + Item.mana = 10; + Item.width = 42; + Item.height = 60; + Item.useTime = Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 4f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; } public override bool CanUseItem(Player player) => player.maxMinions >= 2; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Summon/CrimslimeStaff.cs b/Items/Weapons/Summon/CrimslimeStaff.cs index 6da34911c3..b906a8dea0 100644 --- a/Items/Weapons/Summon/CrimslimeStaff.cs +++ b/Items/Weapons/Summon/CrimslimeStaff.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 24; - item.mana = 10; - item.width = 52; - item.height = 52; - item.useTime = item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 24; + Item.mana = 10; + Item.width = 52; + Item.height = 52; + Item.useTime = Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 12, 0, 0); + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/CryogenicStaff.cs b/Items/Weapons/Summon/CryogenicStaff.cs index 0b2dec1526..cfd1c4a0c9 100644 --- a/Items/Weapons/Summon/CryogenicStaff.cs +++ b/Items/Weapons/Summon/CryogenicStaff.cs @@ -17,24 +17,24 @@ Fire rate and range increase the longer it targets an enemy"); public override void SetDefaults() { - item.damage = 50; - item.mana = 10; - item.summon = true; - item.sentry = true; - item.width = 82; - item.height = 84; - item.useTime = item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.autoReuse = true; - item.knockBack = 4f; + Item.damage = 50; + Item.mana = 10; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; + Item.width = 82; + Item.height = 84; + Item.useTime = Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.autoReuse = true; + Item.knockBack = 4f; - item.value = CalamityGlobalItem.Rarity6BuyPrice; - item.rare = ItemRarityID.LightPurple; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.rare = ItemRarityID.LightPurple; + Item.Calamity().devItem = true; - item.UseSound = SoundID.Item78; - item.shoot = ModContent.ProjectileType(); + Item.UseSound = SoundID.Item78; + Item.shoot = ModContent.ProjectileType(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/DaedalusGolemStaff.cs b/Items/Weapons/Summon/DaedalusGolemStaff.cs index 2360407978..0998b0e758 100644 --- a/Items/Weapons/Summon/DaedalusGolemStaff.cs +++ b/Items/Weapons/Summon/DaedalusGolemStaff.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 70; - item.mana = 10; - item.width = item.height = 32; - item.useTime = item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 3f; - item.UseSound = SoundID.Item67; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 70; + Item.mana = 10; + Item.width = Item.height = 32; + Item.useTime = Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item67; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -44,11 +44,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index 1f4d29ea1f..ab48de2610 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -17,33 +17,27 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 7; - item.mana = 10; - item.width = 58; - item.height = 58; - item.useTime = item.useAnimation = 30; - item.scale = 0.85f; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 7; + Item.mana = 10; + Item.width = 58; + Item.height = 58; + Item.useTime = Item.useAnimation = 30; + Item.scale = 0.85f; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 3); - recipe.AddIngredient(ItemID.DemoniteBar, 8); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.RottenChunk, 3).AddIngredient(ItemID.DemoniteBar, 8).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.DemonAltar).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 0c9fc8490f..ad87e00747 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.width = 54; - item.height = 52; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.UseSound = SoundID.DD2_DarkMageHealImpact; - item.summon = true; - item.mana = 10; - item.damage = 56; - item.knockBack = 2f; - item.autoReuse = true; - item.useTime = item.useAnimation = 15; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; + Item.width = 54; + Item.height = 52; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.UseSound = SoundID.DD2_DarkMageHealImpact; + Item.DamageType = DamageClass.Summon; + Item.mana = 10; + Item.damage = 56; + Item.knockBack = 2f; + Item.autoReuse = true; + Item.useTime = Item.useAnimation = 15; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -45,9 +45,9 @@ namespace CalamityMod.Items.Weapons.Summon if (CalamityUtils.CountProjectiles(type) == 1) angleMax = 0f; float index = 1f; - if (player.ownedProjectileCounts[item.shoot] > 8) + if (player.ownedProjectileCounts[Item.shoot] > 8) { - angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[item.shoot] - 8) * 2.5f); + angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 8) * 2.5f); } angleMax = angleMax > MathHelper.ToRadians(105f) ? MathHelper.ToRadians(105f) : angleMax; // More intuative than using a min function for (int i = 0; i < Main.projectile.Length; i++) diff --git a/Items/Weapons/Summon/DeathstareRod.cs b/Items/Weapons/Summon/DeathstareRod.cs index d8011a5341..47b62b76ba 100644 --- a/Items/Weapons/Summon/DeathstareRod.cs +++ b/Items/Weapons/Summon/DeathstareRod.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 33; - item.mana = 10; - item.width = item.height = 42; - item.useTime = item.useAnimation = 35; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.NPCHit8; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 33; + Item.mana = 10; + Item.width = Item.height = 42; + Item.useTime = Item.useAnimation = 35; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.NPCHit8; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityUtils.KillShootProjectiles(true, type, player); diff --git a/Items/Weapons/Summon/DeepseaStaff.cs b/Items/Weapons/Summon/DeepseaStaff.cs index f36bc1f1e2..8f9f6ac578 100644 --- a/Items/Weapons/Summon/DeepseaStaff.cs +++ b/Items/Weapons/Summon/DeepseaStaff.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 42; - item.mana = 10; - item.width = 46; - item.height = 46; - item.useTime = item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 42; + Item.mana = 10; + Item.width = 46; + Item.height = 46; + Item.useTime = Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/DormantBrimseeker.cs b/Items/Weapons/Summon/DormantBrimseeker.cs index 8b8f1312ba..a43b99a3b5 100644 --- a/Items/Weapons/Summon/DormantBrimseeker.cs +++ b/Items/Weapons/Summon/DormantBrimseeker.cs @@ -20,22 +20,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 42; - item.mana = 10; - item.width = item.height = 32; - item.useTime = item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 3f; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 42; + Item.mana = 10; + Item.width = Item.height = 32; + Item.useTime = Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item20; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index 097102aa57..851e1c982c 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -19,21 +19,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 160; - item.mana = 10; - item.width = 64; - item.height = 62; - item.useTime = item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 4f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.UseSound = SoundID.DD2_SkeletonDeath; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 160; + Item.mana = 10; + Item.width = 64; + Item.height = 62; + Item.useTime = Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 4f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.UseSound = SoundID.DD2_SkeletonDeath; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) @@ -42,15 +42,11 @@ namespace CalamityMod.Items.Weapons.Summon return false; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 5; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 5; public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ModContent.ItemType(), 12); - r.AddTile(TileID.LunarCraftingStation); - r.SetResult(this); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Summon/DreadmineStaff.cs b/Items/Weapons/Summon/DreadmineStaff.cs index f7ca9734ed..622ec774cd 100644 --- a/Items/Weapons/Summon/DreadmineStaff.cs +++ b/Items/Weapons/Summon/DreadmineStaff.cs @@ -18,22 +18,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 60; - item.mana = 10; - item.width = 44; - item.height = 44; - item.useTime = item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 4.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item113; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; - item.sentry = true; + Item.damage = 60; + Item.mana = 10; + Item.width = 44; + Item.height = 44; + Item.useTime = Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 4.5f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item113; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -46,13 +46,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 30).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Summon/ElementalAxe.cs b/Items/Weapons/Summon/ElementalAxe.cs index 9cf8b969d0..dda30f718a 100644 --- a/Items/Weapons/Summon/ElementalAxe.cs +++ b/Items/Weapons/Summon/ElementalAxe.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 50; - item.summon = true; - item.mana = 10; - item.width = 36; - item.height = 36; - item.useTime = item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 5f; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.damage = 50; + Item.DamageType = DamageClass.Summon; + Item.mana = 10; + Item.width = 36; + Item.height = 36; + Item.useTime = Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -48,15 +48,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs index c5123dc0ff..21c2b40ba6 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -19,23 +19,23 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.width = 58; - item.height = 60; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.UseSound = SoundID.Item60; - item.summon = true; - item.mana = 10; - item.damage = 225; - item.knockBack = 3f; - item.autoReuse = true; - item.useTime = item.useAnimation = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.width = 58; + Item.height = 60; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.UseSound = SoundID.Item60; + Item.DamageType = DamageClass.Summon; + Item.mana = 10; + Item.damage = 225; + Item.knockBack = 3f; + Item.autoReuse = true; + Item.useTime = Item.useAnimation = 10; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = Item.buyPrice(2, 50, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -76,13 +76,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.StaffoftheFrostHydra); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.StaffoftheFrostHydra).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index 4f51ebcc00..e0e8f8e278 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -29,24 +29,24 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.width = 80; - item.height = 80; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.UseSound = SoundID.Item78; + Item.width = 80; + Item.height = 80; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.UseSound = SoundID.Item78; - item.summon = true; - item.mana = 80; - item.damage = 1300; - item.knockBack = 4f; - item.autoReuse = true; - item.useTime = item.useAnimation = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.mana = 80; + Item.damage = 1300; + Item.knockBack = 4f; + Item.autoReuse = true; + Item.useTime = Item.useAnimation = 10; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } public override bool CanUseItem(Player player) => player.maxMinions >= 10f; @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - player.itemTime = item.useTime; + player.itemTime = Item.useTime; CalamityUtils.KillShootProjectileMany(player, new int[] { type, @@ -94,15 +94,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.BlizzardStaff); - recipe.AddIngredient(ModContent.ItemType(), 100); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.BlizzardStaff).AddIngredient(ModContent.ItemType(), 100).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Summon/EnergyStaff.cs b/Items/Weapons/Summon/EnergyStaff.cs index da78003b86..0b152a5661 100644 --- a/Items/Weapons/Summon/EnergyStaff.cs +++ b/Items/Weapons/Summon/EnergyStaff.cs @@ -12,25 +12,25 @@ namespace CalamityMod.Items.Weapons.Summon { DisplayName.SetDefault("Energy Staff"); Tooltip.SetDefault("Summons a profaned energy turret to fight for you"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 128; - item.summon = true; - item.sentry = true; - item.mana = 10; - item.width = 66; - item.height = 68; - item.useTime = item.useAnimation = 14; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); + Item.damage = 128; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; + Item.mana = 10; + Item.width = 66; + Item.height = 68; + Item.useTime = Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/EtherealSubjugator.cs b/Items/Weapons/Summon/EtherealSubjugator.cs index ea867d501d..204125b963 100644 --- a/Items/Weapons/Summon/EtherealSubjugator.cs +++ b/Items/Weapons/Summon/EtherealSubjugator.cs @@ -19,27 +19,27 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 45; - item.mana = 10; - item.width = 66; - item.height = 70; - item.useTime = item.useAnimation = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item82; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.damage = 45; + Item.mana = 10; + Item.width = 66; + Item.height = 70; + Item.useTime = Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 1f; + Item.value = Item.buyPrice(1, 40, 0, 0); + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item82; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow")); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow")); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -47,10 +47,10 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { int i = Main.myPlayer; - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; + num74 = player.GetWeaponKnockback(Item, num74); + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Summon/EyeOfNight.cs b/Items/Weapons/Summon/EyeOfNight.cs index 104c3d5b80..1bbf5a2eaa 100644 --- a/Items/Weapons/Summon/EyeOfNight.cs +++ b/Items/Weapons/Summon/EyeOfNight.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 24; - item.mana = 10; - item.width = item.height = 36; - item.useTime = item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 1f; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; + Item.damage = 24; + Item.mana = 10; + Item.width = Item.height = 36; + Item.useTime = Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 1f; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.NPCHit1; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.UseSound = SoundID.NPCHit1; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) @@ -42,14 +42,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.ImpStaff); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.ImpStaff).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Summon/FleshOfInfidelity.cs b/Items/Weapons/Summon/FleshOfInfidelity.cs index c030c545f1..aeffc1b04a 100644 --- a/Items/Weapons/Summon/FleshOfInfidelity.cs +++ b/Items/Weapons/Summon/FleshOfInfidelity.cs @@ -15,34 +15,27 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 23; - item.mana = 10; - item.width = item.height = 48; - item.useTime = item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 1f; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; + Item.damage = 23; + Item.mana = 10; + Item.width = Item.height = 48; + Item.useTime = Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 1f; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; // SoundID has no Zombie24 sound instance, so we must create one ourselves. - item.UseSound = new TerrariaAudio.LegacySoundStyle(SoundID.Zombie, 24, TerrariaAudio.SoundType.Sound); - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.UseSound = new TerrariaAudio.LegacySoundStyle(SoundID.Zombie, 24, TerrariaAudio.SoundType.Sound); + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.ImpStaff); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.ImpStaff).AddTile(TileID.DemonAltar).Register(); } } } diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs index 374497f9cc..d1811df304 100644 --- a/Items/Weapons/Summon/FlowersOfMortality.cs +++ b/Items/Weapons/Summon/FlowersOfMortality.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 140; - item.summon = true; - item.mana = 10; - item.width = 36; - item.height = 36; - item.useTime = item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 5f; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.UseSound = SoundID.Item44; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.damage = 140; + Item.DamageType = DamageClass.Summon; + Item.mana = 10; + Item.width = 36; + Item.height = 36; + Item.useTime = Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.UseSound = SoundID.Item44; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] < 5; //If you already have all 5, no need to resummon + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 5; //If you already have all 5, no need to resummon public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -49,15 +49,7 @@ namespace CalamityMod.Items.Weapons.Summon } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.LunarBar, 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Summon/ForgottenApexWand.cs b/Items/Weapons/Summon/ForgottenApexWand.cs index 2aeac9950d..6392f94f96 100644 --- a/Items/Weapons/Summon/ForgottenApexWand.cs +++ b/Items/Weapons/Summon/ForgottenApexWand.cs @@ -17,40 +17,34 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.width = 44; - item.height = 48; - item.useStyle = ItemUseStyleID.SwingThrow; - item.summon = true; - item.UseSound = SoundID.Item89; - item.noMelee = true; - item.rare = ItemRarityID.Pink; - item.value = Item.buyPrice(0, 36, 0, 0); - item.autoReuse = true; + Item.width = 44; + Item.height = 48; + Item.useStyle = ItemUseStyleID.Swing; + Item.DamageType = DamageClass.Summon; + Item.UseSound = SoundID.Item89; + Item.noMelee = true; + Item.rare = ItemRarityID.Pink; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.autoReuse = true; - item.knockBack = 4f; - item.mana = 10; - item.damage = 28; - item.useTime = item.useAnimation = 25; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.knockBack = 4f; + Item.mana = 10; + Item.damage = 28; + Item.useTime = Item.useAnimation = 25; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyAdamantiteBar", 5); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.Amethyst, 4); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddRecipeGroup("AnyAdamantiteBar", 5).AddIngredient(ItemID.AncientBattleArmorMaterial, 2).AddIngredient(ItemID.Amethyst, 4).AddTile(TileID.MythrilAnvil).Register(); } 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) { - player.itemTime = item.useTime; + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); vector2.X = Main.mouseX + Main.screenPosition.X; vector2.Y = Main.mouseY + Main.screenPosition.Y; diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index bae48b4531..f9d8278194 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 10; - item.mana = 10; - item.width = 34; - item.height = 24; - item.useTime = item.useAnimation = 35; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item28; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 10; + Item.mana = 10; + Item.width = 34; + Item.height = 24; + Item.useTime = Item.useAnimation = 35; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item28; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityUtils.KillShootProjectiles(true, type, player); @@ -41,13 +41,7 @@ namespace CalamityMod.Items.Weapons.Summon } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Shiverthorn, 5); - recipe.AddRecipeGroup("AnySnowBlock", 50); - recipe.AddRecipeGroup("AnyIceBlock", 50); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Shiverthorn, 5).AddRecipeGroup("AnySnowBlock", 50).AddRecipeGroup("AnyIceBlock", 50).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Summon/FuelCellBundle.cs b/Items/Weapons/Summon/FuelCellBundle.cs index c84933dbdb..181b464e36 100644 --- a/Items/Weapons/Summon/FuelCellBundle.cs +++ b/Items/Weapons/Summon/FuelCellBundle.cs @@ -15,22 +15,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.mana = 10; - item.damage = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.width = 32; - item.height = 32; - item.useTime = item.useAnimation = 20; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item106; - item.autoReuse = true; - item.noUseGraphic = true; - item.shoot = ModContent.ProjectileType(); //not the flask, so this weapon works w/ minion targetting - item.shootSpeed = 11f; - item.summon = true; + Item.mana = 10; + Item.damage = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.width = 32; + Item.height = 32; + Item.useTime = Item.useAnimation = 20; + Item.noMelee = true; + Item.knockBack = 7f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item106; + Item.autoReuse = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); //not the flask, so this weapon works w/ minion targetting + Item.shootSpeed = 11f; + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/GammaHeart.cs b/Items/Weapons/Summon/GammaHeart.cs index 341814385a..89de8c6804 100644 --- a/Items/Weapons/Summon/GammaHeart.cs +++ b/Items/Weapons/Summon/GammaHeart.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.width = 58; - item.height = 60; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.UseSound = SoundID.Item42; - item.summon = true; - item.mana = 10; - item.damage = 173; - item.knockBack = 3f; - item.autoReuse = true; - item.useTime = item.useAnimation = 14; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.width = 58; + Item.height = 60; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.UseSound = SoundID.Item42; + Item.DamageType = DamageClass.Summon; + Item.mana = 10; + Item.damage = 173; + Item.knockBack = 3f; + Item.autoReuse = true; + Item.useTime = Item.useAnimation = 14; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/GastricBelcherStaff.cs b/Items/Weapons/Summon/GastricBelcherStaff.cs index 4f6fa85b2a..07809c81a0 100644 --- a/Items/Weapons/Summon/GastricBelcherStaff.cs +++ b/Items/Weapons/Summon/GastricBelcherStaff.cs @@ -18,28 +18,28 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 60; - item.mana = 10; - item.width = 66; - item.height = 70; - item.useTime = item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 1f; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item76; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; - item.autoReuse = true; + Item.damage = 60; + Item.mana = 10; + Item.width = 66; + Item.height = 70; + Item.useTime = Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 1f; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item76; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.autoReuse = true; } 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) { - player.itemTime = item.useTime; + player.itemTime = Item.useTime; Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); float directionX = Main.mouseX + Main.screenPosition.X - playerPos.X; float directionY = Main.mouseY + Main.screenPosition.Y - playerPos.Y; @@ -53,11 +53,11 @@ namespace CalamityMod.Items.Weapons.Summon { spinningpoint.X = player.direction; spinningpoint.Y = 0f; - dist = item.shootSpeed; + dist = Item.shootSpeed; } else { - dist = item.shootSpeed / dist; + dist = Item.shootSpeed / dist; } spinningpoint.X *= dist; spinningpoint.Y *= dist; diff --git a/Items/Weapons/Summon/GodspawnHelixStaff.cs b/Items/Weapons/Summon/GodspawnHelixStaff.cs index cb5bd64bce..0c59e4446b 100644 --- a/Items/Weapons/Summon/GodspawnHelixStaff.cs +++ b/Items/Weapons/Summon/GodspawnHelixStaff.cs @@ -16,20 +16,20 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 60; - item.mana = 10; - item.width = 50; - item.height = 50; - item.useTime = item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 1.25f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = ItemRarityID.Cyan; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.summon = true; + Item.damage = 60; + Item.mana = 10; + Item.width = 50; + Item.height = 50; + Item.useTime = Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 1.25f; + Item.value = Item.buyPrice(0, 95, 0, 0); + Item.rare = ItemRarityID.Cyan; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index 0f41631c53..b9f11a9c2c 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 25; - item.mana = 10; - item.width = 52; - item.height = 52; - item.useTime = item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.knockBack = 3f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 25; + Item.mana = 10; + Item.width = 52; + Item.height = 52; + Item.useTime = Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item60; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) @@ -48,15 +48,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Wood, 10); - recipe.anyWood = true; - recipe.AddIngredient(ItemID.SoulofLight, 5); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddIngredient(ItemID.Bowl); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Wood, 10).AddIngredient(ItemID.SoulofLight, 5).AddIngredient(ItemID.SoulofNight, 5).AddIngredient(ItemID.Bowl).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index a6ba33bee2..97a4c27b22 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -17,20 +17,20 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 20; - item.mana = 10; - item.width = item.height = 48; - item.useTime = item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 1.25f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item21; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 20; + Item.mana = 10; + Item.width = Item.height = 48; + Item.useTime = Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 1.25f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item21; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/HivePod.cs b/Items/Weapons/Summon/HivePod.cs index 341c0285ff..ac39b3404d 100644 --- a/Items/Weapons/Summon/HivePod.cs +++ b/Items/Weapons/Summon/HivePod.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 75; - item.mana = 10; - item.summon = true; - item.sentry = true; - item.autoReuse = true; - item.width = 46; - item.height = 50; - item.useTime = item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item78; - item.shoot = ModContent.ProjectileType(); + Item.damage = 75; + Item.mana = 10; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; + Item.autoReuse = true; + Item.width = 46; + Item.height = 50; + Item.useTime = Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 4f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item78; + Item.shoot = ModContent.ProjectileType(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index 4a778da526..5adb1aa742 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -14,26 +14,26 @@ namespace CalamityMod.Items.Weapons.Summon DisplayName.SetDefault("Igneous Exaltation"); Tooltip.SetDefault("Summons an orbiting blade\n" + "Right click to launch all blades towards the cursor"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 34; - item.mana = 10; - item.width = 52; - item.height = 50; - item.useTime = item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item71; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 34; + Item.mana = 10; + Item.width = 52; + Item.height = 50; + Item.useTime = Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 4.5f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item71; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) { @@ -89,12 +89,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(this); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Summon/InfectedRemote.cs b/Items/Weapons/Summon/InfectedRemote.cs index bc7341793e..81222064af 100644 --- a/Items/Weapons/Summon/InfectedRemote.cs +++ b/Items/Weapons/Summon/InfectedRemote.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; using Terraria; @@ -23,22 +23,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 75; - item.mana = 10; - item.width = 46; - item.height = 28; - item.useTime = item.useAnimation = 19; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.knockBack = 5f; - item.UseSound = SoundID.Item15; //phaseblade sound effect - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 75; + Item.mana = 10; + Item.width = 46; + Item.height = 28; + Item.useTime = Item.useAnimation = 19; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.knockBack = 5f; + Item.UseSound = SoundID.Item15; //phaseblade sound effect + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.Calamity().donorItem = true; } public override void HoldItem(Player player) @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool CanUseItem(Player player) { - return viruliSlots >= 1 && player.ownedProjectileCounts[item.shoot] <= 0; + return viruliSlots >= 1 && player.ownedProjectileCounts[Item.shoot] <= 0; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/LanternoftheSoul.cs b/Items/Weapons/Summon/LanternoftheSoul.cs index 4ff573cc76..0738f9b43c 100644 --- a/Items/Weapons/Summon/LanternoftheSoul.cs +++ b/Items/Weapons/Summon/LanternoftheSoul.cs @@ -17,22 +17,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 188; - item.summon = true; - item.sentry = true; - item.mana = 10; - item.width = 42; - item.height = 60; - item.useTime = item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 5f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.rare = ItemRarityID.Purple; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.UseSound = SoundID.Item44; + Item.damage = 188; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; + Item.mana = 10; + Item.width = 42; + Item.height = 60; + Item.useTime = Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ItemRarityID.Purple; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.UseSound = SoundID.Item44; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/MagicalConch.cs b/Items/Weapons/Summon/MagicalConch.cs index 752c22a1ce..999ad15a5f 100644 --- a/Items/Weapons/Summon/MagicalConch.cs +++ b/Items/Weapons/Summon/MagicalConch.cs @@ -17,31 +17,31 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 20; - item.mana = 10; - item.width = 34; - item.height = 24; - item.useTime = item.useAnimation = 35; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 20; + Item.mana = 10; + Item.width = 34; + Item.height = 24; + Item.useTime = Item.useAnimation = 35; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) { int i = Main.myPlayer; - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; int num73 = damage; float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; + num74 = player.GetWeaponKnockback(Item, num74); + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; diff --git a/Items/Weapons/Summon/Metastasis.cs b/Items/Weapons/Summon/Metastasis.cs index b27a261369..f6d59ad19d 100644 --- a/Items/Weapons/Summon/Metastasis.cs +++ b/Items/Weapons/Summon/Metastasis.cs @@ -23,24 +23,24 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 666; - item.mana = 10; - item.width = 66; - item.height = 78; - item.useTime = item.useAnimation = 10; // 9 because of useStyle 1 - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; - item.UseSound = SoundID.DD2_BetsySummon; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 666; + Item.mana = 10; + Item.width = 66; + Item.height = 78; + Item.useTime = Item.useAnimation = 10; // 9 because of useStyle 1 + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; + Item.UseSound = SoundID.DD2_BetsySummon; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index 7bdf3ca282..782c3b3389 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -20,23 +20,23 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 191; - item.mana = 10; - item.width = item.height = 32; - item.useTime = item.useAnimation = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 1f; - item.UseSound = SoundID.Item90; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 191; + Item.mana = 10; + Item.width = Item.height = 32; + Item.useTime = Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.knockBack = 1f; + Item.UseSound = SoundID.Item90; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -45,13 +45,7 @@ namespace CalamityMod.Items.Weapons.Summon } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.XenoStaff); - recipe.AddIngredient(ItemID.MoonlordTurretStaff); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.XenoStaff).AddIngredient(ItemID.MoonlordTurretStaff).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Summon/OrthoceraShell.cs b/Items/Weapons/Summon/OrthoceraShell.cs index 01db61efe2..e426aff785 100644 --- a/Items/Weapons/Summon/OrthoceraShell.cs +++ b/Items/Weapons/Summon/OrthoceraShell.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 53; - item.mana = 10; - item.width = 34; - item.height = 34; - item.useTime = item.useAnimation = 24; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item42; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 0f; - item.summon = true; + Item.damage = 53; + Item.mana = 10; + Item.width = 34; + Item.height = 34; + Item.useTime = Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item42; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 0f; + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/Perdition.cs b/Items/Weapons/Summon/Perdition.cs index c7d2506d15..ebff12307b 100644 --- a/Items/Weapons/Summon/Perdition.cs +++ b/Items/Weapons/Summon/Perdition.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Summon { @@ -18,23 +19,23 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 444; - item.mana = 10; - item.width = item.height = 56; - item.useTime = item.useAnimation = 10; // 9 because of useStyle 1 - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 4f; - item.UseSound = SoundID.DD2_EtherianPortalOpen; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; - item.sentry = true; + Item.damage = 444; + Item.mana = 10; + Item.width = Item.height = 56; + Item.useTime = Item.useAnimation = 10; // 9 because of useStyle 1 + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 4f; + Item.UseSound = SoundID.DD2_EtherianPortalOpen; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool AltFunctionUse(Player player) => true; @@ -50,8 +51,8 @@ namespace CalamityMod.Items.Weapons.Summon else { // Play some demonic noises prior to a target being selected. - Main.PlaySound(SoundID.Zombie, player.Center, 93); - Main.PlaySound(SoundID.Item119, player.Center); + SoundEngine.PlaySound(SoundID.Zombie, player.Center, 93); + SoundEngine.PlaySound(SoundID.Item119, player.Center); } return false; } diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index 6a8109c65a..fe8e149e5e 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -20,42 +20,28 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 55; - item.mana = 10; - item.width = 66; - item.height = 70; - item.useTime = item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item76; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 55; + Item.mana = 10; + Item.width = 66; + Item.height = 70; + Item.useTime = Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 1f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item76; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 3; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 3; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.OpticStaff); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.OpticStaff); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.OpticStaff).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.OpticStaff).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.MythrilAnvil).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -64,8 +50,8 @@ namespace CalamityMod.Items.Weapons.Summon { CalamityUtils.KillShootProjectileMany(player, new int[] { type, ModContent.ProjectileType() }); - float speed = item.shootSpeed; - player.itemTime = item.useTime; + float speed = Item.shootSpeed; + player.itemTime = Item.useTime; Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); float directionX = (float)Main.mouseX + Main.screenPosition.X - playerPos.X; float directionY = (float)Main.mouseY + Main.screenPosition.Y - playerPos.Y; diff --git a/Items/Weapons/Summon/PolypLauncher.cs b/Items/Weapons/Summon/PolypLauncher.cs index 0c0d7327fc..5f7153a115 100644 --- a/Items/Weapons/Summon/PolypLauncher.cs +++ b/Items/Weapons/Summon/PolypLauncher.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 12; - item.mana = 10; - item.width = 10; - item.height = 32; - item.useTime = item.useAnimation = 35; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 0f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 12; + Item.mana = 10; + Item.width = 10; + Item.height = 32; + Item.useTime = Item.useAnimation = 35; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 0f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = 2; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/PrototypeAndromechaRing.cs b/Items/Weapons/Summon/PrototypeAndromechaRing.cs index 4ad2c5cef3..abd223685f 100644 --- a/Items/Weapons/Summon/PrototypeAndromechaRing.cs +++ b/Items/Weapons/Summon/PrototypeAndromechaRing.cs @@ -8,6 +8,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Summon { @@ -31,36 +32,28 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.mana = 200; - item.damage = 1999; - item.useStyle = ItemUseStyleID.HoldingUp; - item.width = item.height = 28; - item.useTime = item.useAnimation = 9; - item.noMelee = true; - item.knockBack = 1f; + Item.mana = 200; + Item.damage = 1999; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.width = Item.height = 28; + Item.useTime = Item.useAnimation = 9; + Item.noMelee = true; + Item.knockBack = 1f; - item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; - item.UseSound = SoundID.Item117; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; - item.Calamity().CannotBeEnchanted = true; + Item.UseSound = SoundID.Item117; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.Calamity().CannotBeEnchanted = true; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.WingsVortex); - recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.WingsVortex).AddIngredient(ModContent.ItemType(), 40).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } public override bool CanUseItem(Player player) => !(player.Calamity().andromedaCripple > 0 && CalamityPlayer.areThereAnyDamnBosses); @@ -68,12 +61,12 @@ 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 the player has any robots, kill them all. - if (player.ownedProjectileCounts[item.shoot] > 0) + if (player.ownedProjectileCounts[Item.shoot] > 0) { for (int i = 0; i < Main.projectile.Length; i++) { if (Main.projectile[i].active && - Main.projectile[i].type == item.shoot && + Main.projectile[i].type == Item.shoot && Main.projectile[i].owner == player.whoAmI) { Main.projectile[i].Kill(); @@ -83,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Summon { player.Calamity().andromedaCripple = CrippleTime; player.AddBuff(ModContent.BuffType(), player.Calamity().andromedaCripple); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AndromedaCripple"), position); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AndromedaCripple"), position); } return false; } diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index 87ee2c0ba7..b8918e028f 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -20,33 +20,33 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 65; - item.mana = 10; - item.width = 46; - item.height = 46; - item.useTime = item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 1f; + Item.damage = 65; + Item.mana = 10; + Item.width = 46; + Item.height = 46; + Item.useTime = Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 1f; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.Calamity().donorItem = true; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) { int i = Main.myPlayer; - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; + num74 = player.GetWeaponKnockback(Item, num74); + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -79,14 +79,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ItemID.Silk, 40); - r.AddIngredient(ItemID.Ectoplasm, 20); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddIngredient(ItemID.ButterflyDust, 2); - r.AddTile(TileID.Loom); - r.SetResult(this); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Silk, 40).AddIngredient(ItemID.Ectoplasm, 20).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.ButterflyDust, 2).AddTile(TileID.Loom).Register(); } } } diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index 1fa998a1bf..bf819fcbd0 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -19,20 +19,20 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.mana = 10; - item.width = 28; - item.height = 20; - item.useTime = item.useAnimation = 34; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.knockBack = 0.5f; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item15; // Phaseblade sound effect - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.mana = 10; + Item.width = 28; + Item.height = 20; + Item.useTime = Item.useAnimation = 34; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.knockBack = 0.5f; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item15; // Phaseblade sound effect + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) { @@ -44,12 +44,7 @@ namespace CalamityMod.Items.Weapons.Summon } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod);; - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddRecipeGroup("IronBar", 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddRecipeGroup("IronBar", 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index 2a59c3c760..8264bcb36c 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 35; - item.mana = 10; - item.width = 48; - item.height = 56; - item.useTime = item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 35; + Item.mana = 10; + Item.width = 48; + Item.height = 56; + Item.useTime = Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 60, 0, 0); + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) @@ -48,14 +48,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.AncientCloth, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.AncientCloth, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index ad07758adb..41f9757304 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -23,23 +23,23 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.width = 56; - item.height = 56; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.UseSound = SoundID.DD2_BetsyFlameBreath; + Item.width = 56; + Item.height = 56; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.UseSound = SoundID.DD2_BetsyFlameBreath; - item.summon = true; - item.mana = 10; - item.damage = 171; - item.knockBack = 4f; - item.useTime = item.useAnimation = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.mana = 10; + Item.damage = 171; + Item.knockBack = 4f; + Item.useTime = Item.useAnimation = 10; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void HoldItem(Player player) @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Summon for (int j = 0; j < Main.projectile.Length; j++) { Projectile proj = Main.projectile[j]; - if (proj.active && proj.owner == player.whoAmI && proj.minion && proj.type != item.shoot) + if (proj.active && proj.owner == player.whoAmI && proj.minion && proj.type != Item.shoot) { minionCount += proj.minionSlots; } @@ -70,13 +70,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 8).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Summon/ScabRipper.cs b/Items/Weapons/Summon/ScabRipper.cs index 708433fd6d..54122777ea 100644 --- a/Items/Weapons/Summon/ScabRipper.cs +++ b/Items/Weapons/Summon/ScabRipper.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 15; - item.mana = 10; - item.width = 66; - item.height = 70; - item.useTime = item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 0.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item83; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 15; + Item.mana = 10; + Item.width = 66; + Item.height = 70; + Item.useTime = Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 0.5f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item83; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) @@ -47,13 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrimtaneBar, 5); - recipe.AddIngredient(ItemID.TissueSample, 9); - recipe.AddIngredient(ItemID.Shadewood, 20); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.CrimtaneBar, 5).AddIngredient(ItemID.TissueSample, 9).AddIngredient(ItemID.Shadewood, 20).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Summon/SeaboundStaff.cs b/Items/Weapons/Summon/SeaboundStaff.cs index 118f88cae1..a156d8760b 100644 --- a/Items/Weapons/Summon/SeaboundStaff.cs +++ b/Items/Weapons/Summon/SeaboundStaff.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 11; - item.mana = 10; - item.width = 32; - item.height = 32; - item.useTime = item.useAnimation = 35; - item.scale = 0.75f; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 11; + Item.mana = 10; + Item.width = 32; + Item.height = 32; + Item.useTime = Item.useAnimation = 35; + Item.scale = 0.75f; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/ShellfishStaff.cs b/Items/Weapons/Summon/ShellfishStaff.cs index b624a01951..bd0b8242f9 100644 --- a/Items/Weapons/Summon/ShellfishStaff.cs +++ b/Items/Weapons/Summon/ShellfishStaff.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 70; - item.mana = 10; - item.width = 50; - item.height = 50; - item.useTime = item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 70; + Item.mana = 10; + Item.width = 50; + Item.height = 50; + Item.useTime = Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index de8136f35a..edb184044b 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -22,23 +22,23 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.width = 62; - item.height = 62; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.UseSound = SoundID.Item44; + Item.width = 62; + Item.height = 62; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.UseSound = SoundID.Item44; - item.summon = true; - item.mana = 10; - item.damage = 160; - item.knockBack = 3f; - item.useTime = item.useAnimation = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.mana = 10; + Item.damage = 160; + Item.knockBack = 3f; + Item.useTime = Item.useAnimation = 10; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = Item.buyPrice(1, 40, 0, 0); + Item.rare = ItemRarityID.Red; + Item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void HoldItem(Player player) @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon for (int j = 0; j < Main.projectile.Length; j++) { Projectile proj = Main.projectile[j]; - if (proj.active && proj.owner == player.whoAmI && proj.minion && proj.type != item.shoot) + if (proj.active && proj.owner == player.whoAmI && proj.minion && proj.type != Item.shoot) { minionCount += proj.minionSlots; } @@ -69,14 +69,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Summon/SlimePuppetStaff.cs b/Items/Weapons/Summon/SlimePuppetStaff.cs index 1687318675..e188558665 100644 --- a/Items/Weapons/Summon/SlimePuppetStaff.cs +++ b/Items/Weapons/Summon/SlimePuppetStaff.cs @@ -14,25 +14,25 @@ namespace CalamityMod.Items.Weapons.Summon Tooltip.SetDefault("Summons a slime ball that follows you\n" + "The ball flies toward nearby enemies and explodes into slime on enemy hits\n" + "Does not consume minion slots"); // In other words, bootleg mage :TaxEvasion: - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 26; - item.mana = 10; - item.width = 48; - item.height = 56; - item.useTime = item.useAnimation = 29; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3.6f; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SlimeGodPossession"); - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 26; + Item.mana = 10; + Item.width = 48; + Item.height = 56; + Item.useTime = Item.useAnimation = 29; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3.6f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SlimeGodPossession"); + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; } public override Vector2? HoldoutOrigin() => new Vector2(12f); diff --git a/Items/Weapons/Summon/SpikecragStaff.cs b/Items/Weapons/Summon/SpikecragStaff.cs index 2f68237582..025b8f0ffc 100644 --- a/Items/Weapons/Summon/SpikecragStaff.cs +++ b/Items/Weapons/Summon/SpikecragStaff.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 56; - item.mana = 10; - item.summon = true; - item.sentry = true; - item.width = 50; - item.height = 50; - item.useTime = item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.autoReuse = true; - item.shootSpeed = 20f; - item.UseSound = SoundID.Item78; - item.shoot = ModContent.ProjectileType(); + Item.damage = 56; + Item.mana = 10; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; + Item.width = 50; + Item.height = 50; + Item.useTime = Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.autoReuse = true; + Item.shootSpeed = 20f; + Item.UseSound = SoundID.Item78; + Item.shoot = ModContent.ProjectileType(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/SquirrelSquireStaff.cs b/Items/Weapons/Summon/SquirrelSquireStaff.cs index f68304606e..2455107975 100644 --- a/Items/Weapons/Summon/SquirrelSquireStaff.cs +++ b/Items/Weapons/Summon/SquirrelSquireStaff.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 8; - item.mana = 10; - item.width = 52; - item.height = 52; - item.useTime = item.useAnimation = 35; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 0.5f; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = ItemRarityID.White; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; - item.sentry = true; + Item.damage = 8; + Item.mana = 10; + Item.width = 52; + Item.height = 52; + Item.useTime = Item.useAnimation = 35; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 0.5f; + Item.value = Item.buyPrice(0, 0, 50, 0); + Item.rare = ItemRarityID.White; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -51,13 +51,7 @@ namespace CalamityMod.Items.Weapons.Summon //in case you lose it and want another for some bizzare reason public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Wood, 10); - recipe.anyWood = true; - recipe.AddIngredient(ItemID.Acorn); - recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Wood, 10).AddIngredient(ItemID.Acorn).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs index e9965b5e1a..f4d3e8afdf 100644 --- a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs +++ b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 31; - item.mana = 10; - item.width = 52; - item.height = 54; - item.useTime = item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 31; + Item.mana = 10; + Item.width = 52; + Item.height = 54; + Item.useTime = Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 3.5f; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index 08ac5ca82e..7f4d18399e 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -19,22 +19,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = BaseDamage; - item.mana = 10; - item.width = 68; - item.height = 68; - item.useTime = item.useAnimation = 10; // 9 because of useStyle 1 - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.UseSound = SoundID.Item113; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = BaseDamage; + Item.mana = 10; + Item.width = 68; + Item.height = 68; + Item.useTime = Item.useAnimation = 10; // 9 because of useStyle 1 + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.UseSound = SoundID.Item113; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; } public override bool CanUseItem(Player player) diff --git a/Items/Weapons/Summon/StormjawStaff.cs b/Items/Weapons/Summon/StormjawStaff.cs index 92fdeaa521..8ff375a1cf 100644 --- a/Items/Weapons/Summon/StormjawStaff.cs +++ b/Items/Weapons/Summon/StormjawStaff.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 8; - item.mana = 10; - item.width = 32; - item.height = 32; - item.useTime = item.useAnimation = 35; - item.scale = 0.75f; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.NPCDeath34; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 8; + Item.mana = 10; + Item.width = 32; + Item.height = 32; + Item.useTime = Item.useAnimation = 35; + Item.scale = 0.75f; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.NPCDeath34; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) diff --git a/Items/Weapons/Summon/SunGodStaff.cs b/Items/Weapons/Summon/SunGodStaff.cs index 2c2996fea3..4079bf4f07 100644 --- a/Items/Weapons/Summon/SunGodStaff.cs +++ b/Items/Weapons/Summon/SunGodStaff.cs @@ -18,34 +18,26 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 60; - item.mana = 10; - item.width = 72; - item.height = 72; - item.useTime = item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 1.25f; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = ItemRarityID.LightPurple; - item.UseSound = SoundID.Item44; - item.shoot = ModContent.ProjectileType(); - item.summon = true; + Item.damage = 60; + Item.mana = 10; + Item.width = 72; + Item.height = 72; + Item.useTime = Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 1.25f; + Item.value = Item.buyPrice(0, 48, 0, 0); + Item.rare = ItemRarityID.LightPurple; + Item.UseSound = SoundID.Item44; + Item.shoot = ModContent.ProjectileType(); + Item.DamageType = DamageClass.Summon; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.SoulofMight, 3); - recipe.AddIngredient(ItemID.SoulofSight, 3); - recipe.AddIngredient(ItemID.SoulofFright, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.SoulofMight, 3).AddIngredient(ItemID.SoulofSight, 3).AddIngredient(ItemID.SoulofFright, 3).AddTile(TileID.MythrilAnvil).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/SunSpiritStaff.cs b/Items/Weapons/Summon/SunSpiritStaff.cs index 934c007f5e..e7c8b3ce08 100644 --- a/Items/Weapons/Summon/SunSpiritStaff.cs +++ b/Items/Weapons/Summon/SunSpiritStaff.cs @@ -18,31 +18,26 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 12; - item.mana = 10; - item.width = 44; - item.height = 48; - item.useTime = item.useAnimation = 35; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 1.15f; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item44; - item.shoot = ModContent.ProjectileType(); - item.summon = true; + Item.damage = 12; + Item.mana = 10; + Item.width = 44; + Item.height = 48; + Item.useTime = Item.useAnimation = 35; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 1.15f; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item44; + Item.shoot = ModContent.ProjectileType(); + Item.DamageType = DamageClass.Summon; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SandstoneBrick, 20); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.SandstoneBrick, 20).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.Anvils).Register(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index 0d245e7958..1e493b6ca7 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -19,21 +19,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 52; - item.mana = 10; - item.width = 28; - item.height = 20; - item.useTime = item.useAnimation = 14; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.knockBack = 0.5f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item14; - item.autoReuse = true; - item.summon = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; + Item.damage = 52; + Item.mana = 10; + Item.width = 28; + Item.height = 20; + Item.useTime = Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.knockBack = 0.5f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = SoundID.Item14; + Item.autoReuse = true; + Item.DamageType = DamageClass.Summon; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -45,16 +45,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index 6bd3b1dc2c..678ad2204a 100644 --- a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs +++ b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 45; - item.mana = 10; - item.width = 52; - item.height = 60; - item.useTime = item.useAnimation = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 3f; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item46; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 45; + Item.mana = 10; + Item.width = 52; + Item.height = 60; + Item.useTime = Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; + Item.UseSound = SoundID.Item46; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] < 3; //If you already have all 3, no need to resummon + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 3; //If you already have all 3, no need to resummon public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -48,13 +48,7 @@ namespace CalamityMod.Items.Weapons.Summon } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofLight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.SoulofLight, 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Summon/UniverseSplitter.cs b/Items/Weapons/Summon/UniverseSplitter.cs index 65c5f9a075..6b95d2988a 100644 --- a/Items/Weapons/Summon/UniverseSplitter.cs +++ b/Items/Weapons/Summon/UniverseSplitter.cs @@ -23,32 +23,32 @@ namespace CalamityMod.Items.Weapons.Summon "Attempting to use this item during the cooldown will cause it to short circuit and do damage to you.\n" + "An ancient artifact from a previous age, it waits for your command...\n" + "This is a terrible idea, but it isn't yours anyways... right?"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 14)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 14)); } public override void SetDefaults() { - item.width = 54; - item.height = 76; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.UseSound = SoundID.Item122; + Item.width = 54; + Item.height = 76; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.UseSound = SoundID.Item122; - item.summon = true; - item.mana = 300; - item.damage = 18000; - item.knockBack = 7f; - item.useTime = item.useAnimation = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.noUseGraphic = true; + Item.DamageType = DamageClass.Summon; + Item.mana = 300; + Item.damage = 18000; + Item.knockBack = 7f; + Item.useTime = Item.useAnimation = 10; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.noUseGraphic = true; - item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - item.Calamity().customRarity = CalamityRarity.HotPink; - item.Calamity().devItem = true; + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; + Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.Calamity().devItem = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -77,13 +77,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Summon/Vigilance.cs b/Items/Weapons/Summon/Vigilance.cs index 135577f6f4..1a629d6aba 100644 --- a/Items/Weapons/Summon/Vigilance.cs +++ b/Items/Weapons/Summon/Vigilance.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 150; - item.mana = 10; - item.width = item.height = 32; - item.useTime = item.useAnimation = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 4f; - item.UseSound = SoundID.DD2_BetsySummon; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 150; + Item.mana = 10; + Item.width = Item.height = 32; + Item.useTime = Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 4f; + Item.UseSound = SoundID.DD2_BetsySummon; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Violet; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Summon/VileFeeder.cs b/Items/Weapons/Summon/VileFeeder.cs index eee049dd82..e05defc231 100644 --- a/Items/Weapons/Summon/VileFeeder.cs +++ b/Items/Weapons/Summon/VileFeeder.cs @@ -19,21 +19,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = BaseDamage; - item.mana = 10; - item.width = 66; - item.height = 70; - item.useTime = item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 0.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item2; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = BaseDamage; + Item.mana = 10; + Item.width = 66; + Item.height = 70; + Item.useTime = Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 0.5f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item2; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) @@ -41,10 +41,10 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { int i = Main.myPlayer; - float num72 = item.shootSpeed; + float num72 = Item.shootSpeed; float knockback = knockBack; - knockback = player.GetWeaponKnockback(item, knockback); - player.itemTime = item.useTime; + knockback = player.GetWeaponKnockback(Item, knockback); + player.itemTime = Item.useTime; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -76,13 +76,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DemoniteBar, 5); - recipe.AddIngredient(ItemID.ShadowScale, 9); - recipe.AddIngredient(ItemID.Ebonwood, 20); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.DemoniteBar, 5).AddIngredient(ItemID.ShadowScale, 9).AddIngredient(ItemID.Ebonwood, 20).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Summon/ViralSprout.cs b/Items/Weapons/Summon/ViralSprout.cs index 7f6aaadaad..60aba68c79 100644 --- a/Items/Weapons/Summon/ViralSprout.cs +++ b/Items/Weapons/Summon/ViralSprout.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 24; - item.mana = 10; - item.width = 48; - item.height = 56; - item.useTime = item.useAnimation = 19; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.knockBack = 2f; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = ItemRarityID.Lime; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 24; + Item.mana = 10; + Item.width = 48; + Item.height = 56; + Item.useTime = Item.useAnimation = 19; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.UseSound = SoundID.Item44; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) @@ -57,11 +57,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index 95590df969..c06bbcb1ff 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -14,26 +14,26 @@ namespace CalamityMod.Items.Weapons.Summon Tooltip.SetDefault("Summons 2 blades that rotate around you\n" + "Each pair of blades take up three minion slots\n" + "Right clicking prompts all blades to fly upward and redirect towards the mouse"); - Item.staff[item.type] = true; + Item.staff[Item.type] = true; } public override void SetDefaults() { - item.damage = 280; - item.summon = true; - item.sentry = true; - item.mana = 10; - item.width = 26; - item.height = 36; - item.useTime = item.useAnimation = 14; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.knockBack = 5f; - item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - item.rare = 10; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.damage = 280; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; + Item.mana = 10; + Item.width = 26; + Item.height = 36; + Item.useTime = Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.knockBack = 5f; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = 10; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -100,12 +100,7 @@ namespace CalamityMod.Items.Weapons.Summon } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Summon/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs index e56ec7a81d..0b763b30fa 100644 --- a/Items/Weapons/Summon/VoidConcentrationStaff.cs +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -21,21 +21,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.width = 52; - item.height = 72; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.UseSound = SoundID.DD2_EtherianPortalOpen; - item.summon = true; - item.mana = 10; - item.damage = 150; - item.knockBack = 4f; - item.useTime = item.useAnimation = 15; // 14 because of useStyle 1 - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.width = 52; + Item.height = 72; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.UseSound = SoundID.DD2_EtherianPortalOpen; + Item.DamageType = DamageClass.Summon; + Item.mana = 10; + Item.damage = 150; + Item.knockBack = 4f; + Item.useTime = Item.useAnimation = 15; // 14 because of useStyle 1 + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool CanUseItem(Player player) diff --git a/Items/Weapons/Summon/WitherBlossomsStaff.cs b/Items/Weapons/Summon/WitherBlossomsStaff.cs index 5ac2398371..d94885f590 100644 --- a/Items/Weapons/Summon/WitherBlossomsStaff.cs +++ b/Items/Weapons/Summon/WitherBlossomsStaff.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 61; - item.mana = 10; - item.width = 52; - item.height = 60; - item.useTime = item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 3f; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.UseSound = SoundID.Item46; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 61; + Item.mana = 10; + Item.width = 52; + Item.height = 60; + Item.useTime = Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.UseSound = SoundID.Item46; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] < 4; //If you already have all 4, no need to resummon + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 4; //If you already have all 4, no need to resummon public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -49,14 +49,7 @@ namespace CalamityMod.Items.Weapons.Summon } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs index 28c4a57548..1eabb874a3 100644 --- a/Items/Weapons/Summon/WulfrumController.cs +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 10; - item.mana = 10; - item.width = 28; - item.height = 20; - item.useTime = item.useAnimation = 34; - item.useStyle = ItemUseStyleID.HoldingUp; - item.noMelee = true; - item.knockBack = 0.5f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = ItemRarityID.Blue; - item.UseSound = SoundID.Item15; //phaseblade sound effect - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; + Item.damage = 10; + Item.mana = 10; + Item.width = 28; + Item.height = 20; + Item.useTime = Item.useAnimation = 34; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noMelee = true; + Item.knockBack = 0.5f; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item15; //phaseblade sound effect + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.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) @@ -48,11 +48,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 9).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Typeless/AeroDynamite.cs b/Items/Weapons/Typeless/AeroDynamite.cs index 90f5ce05ac..449679fa57 100644 --- a/Items/Weapons/Typeless/AeroDynamite.cs +++ b/Items/Weapons/Typeless/AeroDynamite.cs @@ -20,20 +20,20 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetDefaults() { - item.useTime = item.useAnimation = 40; - item.maxStack = 999; - item.consumable = true; - item.shootSpeed = 5f; - item.shoot = ModContent.ProjectileType(); + Item.useTime = Item.useAnimation = 40; + Item.maxStack = 999; + Item.consumable = true; + Item.shootSpeed = 5f; + Item.shoot = ModContent.ProjectileType(); - item.width = 8; - item.height = 28; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.noUseGraphic = true; - item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(0, 0, 40, 0); // Crafted 10 at a time - item.rare = ItemRarityID.Orange; + Item.width = 8; + Item.height = 28; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.UseSound = SoundID.Item1; + Item.value = Item.buyPrice(0, 0, 40, 0); // Crafted 10 at a time + Item.rare = ItemRarityID.Orange; } public override void UpdateInventory(Player player) @@ -45,12 +45,7 @@ namespace CalamityMod.Items.Weapons.Typeless public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Dynamite, 10); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this, 10); - recipe.AddRecipe(); + CreateRecipe(10).AddIngredient(ItemID.Dynamite, 10).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.SkyMill).Register(); } } } diff --git a/Items/Weapons/Typeless/Aestheticus.cs b/Items/Weapons/Typeless/Aestheticus.cs index 989cb16fce..1c7b0f30ca 100644 --- a/Items/Weapons/Typeless/Aestheticus.cs +++ b/Items/Weapons/Typeless/Aestheticus.cs @@ -20,32 +20,32 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetDefaults() { - item.width = 58; - item.damage = 8; - item.useAnimation = 25; - item.useTime = 25; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 3f; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.height = 58; + Item.width = 58; + Item.damage = 8; + Item.useAnimation = 25; + Item.useTime = 25; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item109; + Item.autoReuse = true; + Item.height = 58; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = ItemRarityID.Orange; - item.Calamity().donorItem = true; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; } // Aestheticus scales off of all damage types simultaneously (meaning it scales 5x from universal damage boosts). public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { float formula = 5f * (player.allDamage - 1f); - formula += player.meleeDamage - 1f; - formula += player.rangedDamage - 1f; - formula += player.magicDamage - 1f; - formula += player.minionDamage - 1f; + formula += player.GetDamage(DamageClass.Melee) - 1f; + formula += player.GetDamage(DamageClass.Ranged) - 1f; + formula += player.GetDamage(DamageClass.Magic) - 1f; + formula += player.GetDamage(DamageClass.Summon) - 1f; formula += player.Calamity().throwingDamage - 1f; add += formula; } @@ -58,17 +58,7 @@ namespace CalamityMod.Items.Weapons.Typeless public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddIngredient(ItemID.MeteoriteBar, 10); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.Glass, 20); - recipe.AddIngredient(ItemID.Gel, 15); - recipe.AddIngredient(ItemID.FallenStar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HellstoneBar, 10).AddIngredient(ItemID.MeteoriteBar, 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.Glass, 20).AddIngredient(ItemID.Gel, 15).AddIngredient(ItemID.FallenStar, 5).AddTile(TileID.Anvils).Register(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) diff --git a/Items/Weapons/Typeless/AethersWhisper.cs b/Items/Weapons/Typeless/AethersWhisper.cs index f4b10321a6..529a6ba598 100644 --- a/Items/Weapons/Typeless/AethersWhisper.cs +++ b/Items/Weapons/Typeless/AethersWhisper.cs @@ -22,23 +22,23 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetDefaults() { - item.damage = 504; - item.knockBack = 5.5f; - item.useTime = item.useAnimation = 24; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); - item.mana = 30; - item.magic = true; - item.autoReuse = true; + Item.damage = 504; + Item.knockBack = 5.5f; + Item.useTime = Item.useAnimation = 24; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.mana = 30; + Item.DamageType = DamageClass.Magic; + Item.autoReuse = true; - item.width = 134; - item.height = 44; - item.noMelee = true; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + Item.width = 134; + Item.height = 44; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -49,21 +49,21 @@ namespace CalamityMod.Items.Weapons.Typeless { if (player.altFunctionUse == 2) { - item.ranged = true; - item.magic = false; + Item.DamageType = DamageClass.Ranged; + // item.magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; } else { - item.ranged = false; - item.magic = true; + // item.ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + Item.DamageType = DamageClass.Magic; } return base.CanUseItem(player); } public override bool OnPickup(Player player) { - item.ranged = false; - item.magic = true; + // item.ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + Item.DamageType = DamageClass.Magic; return true; } @@ -72,8 +72,8 @@ namespace CalamityMod.Items.Weapons.Typeless // Reset to magic if not using an item to prevent sorting bugs. if (player.itemAnimation <= 0) { - item.ranged = false; - item.magic = true; + // item.ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + Item.DamageType = DamageClass.Magic; } } @@ -94,14 +94,7 @@ namespace CalamityMod.Items.Weapons.Typeless public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Typeless/EyeofMagnus.cs b/Items/Weapons/Typeless/EyeofMagnus.cs index 637ca91cbc..bb06a2db53 100644 --- a/Items/Weapons/Typeless/EyeofMagnus.cs +++ b/Items/Weapons/Typeless/EyeofMagnus.cs @@ -18,20 +18,20 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetDefaults() { - item.width = 80; - item.damage = 32; - item.rare = ItemRarityID.Cyan; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 5f; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.autoReuse = true; - item.noMelee = true; - item.height = 50; - item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.width = 80; + Item.damage = 32; + Item.rare = ItemRarityID.Cyan; + Item.useAnimation = 20; + Item.useTime = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 5f; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + Item.autoReuse = true; + Item.noMelee = true; + Item.height = 50; + Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override Vector2? HoldoutOffset() @@ -43,22 +43,17 @@ namespace CalamityMod.Items.Weapons.Typeless public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { float formula = 5f * (player.allDamage - 1f); - formula += player.meleeDamage - 1f; - formula += player.rangedDamage - 1f; - formula += player.magicDamage - 1f; - formula += player.minionDamage - 1f; + formula += player.GetDamage(DamageClass.Melee) - 1f; + formula += player.GetDamage(DamageClass.Ranged) - 1f; + formula += player.GetDamage(DamageClass.Magic) - 1f; + formula += player.GetDamage(DamageClass.Summon) - 1f; formula += player.Calamity().throwingDamage - 1f; add += formula; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.FragmentNebula, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.FragmentNebula, 10).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Typeless/FiniteUse/Bazooka.cs b/Items/Weapons/Typeless/FiniteUse/Bazooka.cs index cf731b21a5..ced912450c 100644 --- a/Items/Weapons/Typeless/FiniteUse/Bazooka.cs +++ b/Items/Weapons/Typeless/FiniteUse/Bazooka.cs @@ -19,36 +19,36 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void SetDefaults() { - item.damage = 500; - item.width = 66; - item.height = 26; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 10f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = ItemRarityID.Pink; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/BazookaFull"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = ModContent.ItemType(); + Item.damage = 500; + Item.width = 66; + Item.height = 26; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 10f; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/BazookaFull"); + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = ModContent.ItemType(); if (CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 2; + Item.Calamity().timesUsed = 2; } public override bool OnPickup(Player player) { if (CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 2; + Item.Calamity().timesUsed = 2; return true; } public override bool CanUseItem(Player player) { - return item.Calamity().timesUsed < 2; + return Item.Calamity().timesUsed < 2; } public override Vector2? HoldoutOffset() @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void UpdateInventory(Player player) { if (!CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 0; + Item.Calamity().timesUsed = 0; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -69,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse player.HeldItem.Calamity().timesUsed++; for (int i = 0; i < Main.maxInventory; i++) { - if (player.inventory[i].type == item.type && player.inventory[i] != player.HeldItem) + if (player.inventory[i].type == Item.type && player.inventory[i] != player.HeldItem) player.inventory[i].Calamity().timesUsed++; } } @@ -78,14 +78,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddIngredient(ItemID.IronBar, 20); - recipe.anyIronBar = true; - recipe.AddRecipeGroup("AnyAdamantiteBar", 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.IllegalGunParts).AddIngredient(ItemID.IronBar, 20).AddRecipeGroup("AnyAdamantiteBar", 15).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs b/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs index 7c15189718..0efb4511ba 100644 --- a/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs +++ b/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs @@ -19,23 +19,23 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void SetDefaults() { - item.damage = 2000; - item.width = 56; - item.height = 26; - item.useTime = 19; - item.useAnimation = 19; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 8f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = ModContent.ItemType(); + Item.damage = 2000; + Item.width = 56; + Item.height = 26; + Item.useTime = 19; + Item.useAnimation = 19; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 8f; + Item.value = CalamityGlobalItem.Rarity10BuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = ModContent.ItemType(); if (CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 3; + Item.Calamity().timesUsed = 3; } // Terraria seems to really dislike high crit values in SetDefaults @@ -44,19 +44,19 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override bool OnPickup(Player player) { if (CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 3; + Item.Calamity().timesUsed = 3; return true; } - public override bool CanUseItem(Player player) => item.Calamity().timesUsed < 3; + public override bool CanUseItem(Player player) => Item.Calamity().timesUsed < 3; public override Vector2? HoldoutOffset() => new Vector2(-5, 0); public override void UpdateInventory(Player player) { if (!CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 0; + Item.Calamity().timesUsed = 0; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse player.HeldItem.Calamity().timesUsed++; for (int i = 0; i < Main.maxInventory; i++) { - if (player.inventory[i].type == item.type && player.inventory[i] != player.HeldItem) + if (player.inventory[i].type == Item.type && player.inventory[i] != player.HeldItem) player.inventory[i].Calamity().timesUsed++; } } @@ -75,13 +75,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddIngredient(ItemID.LunarBar, 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.IllegalGunParts).AddIngredient(ItemID.LunarBar, 15).AddTile(TileID.LunarCraftingStation).Register(); } } } diff --git a/Items/Weapons/Typeless/FiniteUse/Hydra.cs b/Items/Weapons/Typeless/FiniteUse/Hydra.cs index d77a5b522d..9137eaa0f1 100644 --- a/Items/Weapons/Typeless/FiniteUse/Hydra.cs +++ b/Items/Weapons/Typeless/FiniteUse/Hydra.cs @@ -19,36 +19,36 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void SetDefaults() { - item.damage = 120; - item.width = 66; - item.height = 30; - item.useTime = 33; - item.useAnimation = 33; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 10f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = ItemRarityID.Yellow; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Hydra"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = ModContent.ItemType(); + Item.damage = 120; + Item.width = 66; + Item.height = 30; + Item.useTime = 33; + Item.useAnimation = 33; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 10f; + Item.value = Item.buyPrice(0, 80, 0, 0); + Item.rare = ItemRarityID.Yellow; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Hydra"); + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = ModContent.ItemType(); if (CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 1; + Item.Calamity().timesUsed = 1; } public override bool OnPickup(Player player) { if (CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 1; + Item.Calamity().timesUsed = 1; return true; } public override bool CanUseItem(Player player) { - return item.Calamity().timesUsed < 1; + return Item.Calamity().timesUsed < 1; } public override Vector2? HoldoutOffset() @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void UpdateInventory(Player player) { if (!CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 0; + Item.Calamity().timesUsed = 0; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -76,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse player.HeldItem.Calamity().timesUsed++; for (int i = 0; i < Main.maxInventory; i++) { - if (player.inventory[i].type == item.type && player.inventory[i] != player.HeldItem) + if (player.inventory[i].type == Item.type && player.inventory[i] != player.HeldItem) player.inventory[i].Calamity().timesUsed++; } } @@ -86,15 +86,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Shotgun); - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddIngredient(ItemID.IronBar, 20); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Ectoplasm, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Shotgun).AddIngredient(ItemID.IllegalGunParts).AddIngredient(ItemID.IronBar, 20).AddIngredient(ItemID.Ectoplasm, 20).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs b/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs index 9077afaa6f..94a2fd9b14 100644 --- a/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs +++ b/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs @@ -19,23 +19,23 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void SetDefaults() { - item.damage = 400; - item.width = 50; - item.height = 28; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = ItemRarityID.LightPurple; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = ModContent.ItemType(); + Item.damage = 400; + Item.width = 50; + Item.height = 28; + Item.useTime = 21; + Item.useAnimation = 21; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 8f; + Item.value = Item.buyPrice(0, 48, 0, 0); + Item.rare = ItemRarityID.LightPurple; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = ModContent.ItemType(); if (CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 3; + Item.Calamity().timesUsed = 3; } // Terraria seems to really dislike high crit values in SetDefaults @@ -44,19 +44,19 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override bool OnPickup(Player player) { if (CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 3; + Item.Calamity().timesUsed = 3; return true; } - public override bool CanUseItem(Player player) => item.Calamity().timesUsed < 3; + public override bool CanUseItem(Player player) => Item.Calamity().timesUsed < 3; public override Vector2? HoldoutOffset() => new Vector2(-5, 0); public override void UpdateInventory(Player player) { if (!CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 0; + Item.Calamity().timesUsed = 0; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse player.HeldItem.Calamity().timesUsed++; for (int i = 0; i < Main.maxInventory; i++) { - if (player.inventory[i].type == item.type && player.inventory[i] != player.HeldItem) + if (player.inventory[i].type == Item.type && player.inventory[i] != player.HeldItem) player.inventory[i].Calamity().timesUsed++; } } @@ -75,16 +75,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddIngredient(ItemID.SoulofMight, 20); - recipe.AddIngredient(ItemID.SoulofSight, 20); - recipe.AddIngredient(ItemID.SoulofFright, 20); - recipe.AddIngredient(ItemID.HallowedBar, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.IllegalGunParts).AddIngredient(ItemID.SoulofMight, 20).AddIngredient(ItemID.SoulofSight, 20).AddIngredient(ItemID.SoulofFright, 20).AddIngredient(ItemID.HallowedBar, 10).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/Items/Weapons/Typeless/FiniteUse/Magnum.cs b/Items/Weapons/Typeless/FiniteUse/Magnum.cs index e38964799b..c8366c4404 100644 --- a/Items/Weapons/Typeless/FiniteUse/Magnum.cs +++ b/Items/Weapons/Typeless/FiniteUse/Magnum.cs @@ -19,23 +19,23 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void SetDefaults() { - item.damage = 80; - item.width = 52; - item.height = 28; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = ModContent.ItemType(); + Item.damage = 80; + Item.width = 52; + Item.height = 28; + Item.useTime = 25; + Item.useAnimation = 25; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 8f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = ModContent.ItemType(); if (CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 3; + Item.Calamity().timesUsed = 3; } // Terraria seems to really dislike high crit values in SetDefaults @@ -44,19 +44,19 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override bool OnPickup(Player player) { if (CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 3; + Item.Calamity().timesUsed = 3; return true; } - public override bool CanUseItem(Player player) => item.Calamity().timesUsed < 3; + public override bool CanUseItem(Player player) => Item.Calamity().timesUsed < 3; public override Vector2? HoldoutOffset() => new Vector2(-5, 0); public override void UpdateInventory(Player player) { if (!CalamityPlayer.areThereAnyDamnBosses) - item.Calamity().timesUsed = 0; + Item.Calamity().timesUsed = 0; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse player.HeldItem.Calamity().timesUsed++; for (int i = 0; i < Main.maxInventory; i++) { - if (player.inventory[i].type == item.type && player.inventory[i] != player.HeldItem) + if (player.inventory[i].type == Item.type && player.inventory[i] != player.HeldItem) player.inventory[i].Calamity().timesUsed++; } } @@ -75,14 +75,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FlintlockPistol); - recipe.AddIngredient(ItemID.IronBar, 10); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Diamond, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.FlintlockPistol).AddIngredient(ItemID.IronBar, 10).AddIngredient(ItemID.Diamond, 5).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Typeless/GoldenGun.cs b/Items/Weapons/Typeless/GoldenGun.cs index 9e3da5e5bc..52357497fb 100644 --- a/Items/Weapons/Typeless/GoldenGun.cs +++ b/Items/Weapons/Typeless/GoldenGun.cs @@ -16,20 +16,20 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetDefaults() { - item.damage = 5; - item.width = 78; - item.height = 36; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = ItemRarityID.Orange; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.damage = 5; + Item.width = 78; + Item.height = 36; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.value = Item.buyPrice(0, 4, 0, 0); + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item11; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override Vector2? HoldoutOffset() @@ -45,12 +45,7 @@ namespace CalamityMod.Items.Weapons.Typeless public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Ichor, 15); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Ichor, 15).AddIngredient(ItemID.HellstoneBar, 10).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Typeless/LunicEye.cs b/Items/Weapons/Typeless/LunicEye.cs index b737e9d3df..600fbe5bf5 100644 --- a/Items/Weapons/Typeless/LunicEye.cs +++ b/Items/Weapons/Typeless/LunicEye.cs @@ -19,20 +19,20 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetDefaults() { - item.width = 80; - item.damage = 9; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = ItemRarityID.LightRed; - item.useAnimation = 15; - item.useTime = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 4.5f; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.autoReuse = true; - item.noMelee = true; - item.height = 50; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + Item.width = 80; + Item.damage = 9; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.useAnimation = 15; + Item.useTime = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 4.5f; + Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + Item.autoReuse = true; + Item.noMelee = true; + Item.height = 50; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; } public override Vector2? HoldoutOffset() @@ -44,24 +44,17 @@ namespace CalamityMod.Items.Weapons.Typeless public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { float formula = 5f * (player.allDamage - 1f); - formula += player.meleeDamage - 1f; - formula += player.rangedDamage - 1f; - formula += player.magicDamage - 1f; - formula += player.minionDamage - 1f; + formula += player.GetDamage(DamageClass.Melee) - 1f; + formula += player.GetDamage(DamageClass.Ranged) - 1f; + formula += player.GetDamage(DamageClass.Magic) - 1f; + formula += player.GetDamage(DamageClass.Summon) - 1f; formula += player.Calamity().throwingDamage - 1f; add += formula; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.SunplateBlock, 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.SunplateBlock, 15).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Typeless/MarkedMagnum.cs b/Items/Weapons/Typeless/MarkedMagnum.cs index beffd897ee..e1399b0c23 100644 --- a/Items/Weapons/Typeless/MarkedMagnum.cs +++ b/Items/Weapons/Typeless/MarkedMagnum.cs @@ -17,20 +17,20 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetDefaults() { - item.damage = 4; - item.width = 54; - item.height = 20; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item33; - item.autoReuse = false; - item.shootSpeed = 12f; - item.shoot = ModContent.ProjectileType(); + Item.damage = 4; + Item.width = 54; + Item.height = 20; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item33; + Item.autoReuse = false; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() @@ -42,10 +42,10 @@ namespace CalamityMod.Items.Weapons.Typeless public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { float formula = 5f * (player.allDamage - 1f); - formula += player.meleeDamage - 1f; - formula += player.rangedDamage - 1f; - formula += player.magicDamage - 1f; - formula += player.minionDamage - 1f; + formula += player.GetDamage(DamageClass.Melee) - 1f; + formula += player.GetDamage(DamageClass.Ranged) - 1f; + formula += player.GetDamage(DamageClass.Magic) - 1f; + formula += player.GetDamage(DamageClass.Summon) - 1f; formula += player.Calamity().throwingDamage - 1f; add += formula; } @@ -58,13 +58,7 @@ namespace CalamityMod.Items.Weapons.Typeless public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 7); - recipe.AddIngredient(ItemID.Obsidian, 15); - recipe.AddIngredient(ItemID.GlowingMushroom, 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.HellstoneBar, 7).AddIngredient(ItemID.Obsidian, 15).AddIngredient(ItemID.GlowingMushroom, 15).AddTile(TileID.Anvils).Register(); } } } diff --git a/Items/Weapons/Typeless/RelicOfDeliverance.cs b/Items/Weapons/Typeless/RelicOfDeliverance.cs index 1aac787078..7246c21f9e 100644 --- a/Items/Weapons/Typeless/RelicOfDeliverance.cs +++ b/Items/Weapons/Typeless/RelicOfDeliverance.cs @@ -18,25 +18,25 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetDefaults() { - item.width = 32; - item.height = 46; - item.damage = 1350; - item.useTime = item.useAnimation = 25; - item.reuseDelay = 15; - item.useStyle = ItemUseStyleID.HoldingOut; - item.UseSound = SoundID.Item46; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.shoot = ModContent.ProjectileType(); - item.Calamity().CannotBeEnchanted = true; + Item.width = 32; + Item.height = 46; + Item.damage = 1350; + Item.useTime = Item.useAnimation = 25; + Item.reuseDelay = 15; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item46; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().CannotBeEnchanted = true; } // Terraria seems to really dislike high crit values in SetDefaults public override void GetWeaponCrit(Player player, ref int crit) => crit += 16; - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } } diff --git a/Items/Weapons/Typeless/RelicOfResilience.cs b/Items/Weapons/Typeless/RelicOfResilience.cs index 1ffc78211c..c116497c3e 100644 --- a/Items/Weapons/Typeless/RelicOfResilience.cs +++ b/Items/Weapons/Typeless/RelicOfResilience.cs @@ -27,20 +27,20 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetDefaults() { - item.width = 40; - item.height = 34; - item.useAnimation = item.useTime = 28; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item45; - item.autoReuse = true; - item.noMelee = true; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 0f; + Item.width = 40; + Item.height = 34; + Item.useAnimation = Item.useTime = 28; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item45; + Item.autoReuse = true; + Item.noMelee = true; + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 0f; } public override bool CanUseItem(Player player) => !player.HasCooldown(Cooldowns.RelicOfResilience.ID); - public override bool UseItem(Player player) => true; + public override bool? UseItem(Player player) => true; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { player.AddCooldown(Cooldowns.RelicOfResilience.ID, CalamityUtils.SecondsToFrames(CooldownSeconds)); @@ -53,11 +53,11 @@ namespace CalamityMod.Items.Weapons.Typeless ModContent.ProjectileType(), ModContent.ProjectileType(), }; - if (player.ownedProjectileCounts[item.shoot] > 0) + if (player.ownedProjectileCounts[Item.shoot] > 0) { for (int i = 0; i < Main.projectile.Length; i++) { - if (Main.projectile[i].type == item.shoot) + if (Main.projectile[i].type == Item.shoot) { Main.projectile[i].Center = Main.MouseWorld; Main.projectile[i].netUpdate = true; diff --git a/Items/Weapons/Typeless/StarStruckWater.cs b/Items/Weapons/Typeless/StarStruckWater.cs index a0790aa944..c96da7fa76 100644 --- a/Items/Weapons/Typeless/StarStruckWater.cs +++ b/Items/Weapons/Typeless/StarStruckWater.cs @@ -15,32 +15,27 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetDefaults() { - item.useStyle = ItemUseStyleID.SwingThrow; - item.shootSpeed = 14f; - item.rare = ItemRarityID.Orange; - item.damage = 20; - item.shoot = ModContent.ProjectileType(); - item.width = 18; - item.height = 20; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.useAnimation = 15; - item.useTime = 15; - item.noUseGraphic = true; - item.noMelee = true; - item.value = 200; + Item.useStyle = ItemUseStyleID.Swing; + Item.shootSpeed = 14f; + Item.rare = ItemRarityID.Orange; + Item.damage = 20; + Item.shoot = ModContent.ProjectileType(); + Item.width = 18; + Item.height = 20; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 3f; + Item.UseSound = SoundID.Item1; + Item.useAnimation = 15; + Item.useTime = 15; + Item.noUseGraphic = true; + Item.noMelee = true; + Item.value = 200; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater, 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.SetResult(this, 10); - recipe.AddRecipe(); + CreateRecipe(10).AddIngredient(ItemID.BottledWater, 10).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Weapons/Typeless/YanmeisKnife.cs b/Items/Weapons/Typeless/YanmeisKnife.cs index 26eb37f694..ff17d2932b 100644 --- a/Items/Weapons/Typeless/YanmeisKnife.cs +++ b/Items/Weapons/Typeless/YanmeisKnife.cs @@ -20,21 +20,21 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetDefaults() { - item.height = 44; - item.width = 48; - item.damage = 8; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = item.useTime = 32; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 4.5f; - item.autoReuse = false; - item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = ItemRarityID.Yellow; - item.Calamity().donorItem = true; - item.UseSound = SoundID.Item71; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24f; + Item.height = 44; + Item.width = 48; + Item.damage = 8; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = Item.useTime = 32; + Item.useStyle = ItemUseStyleID.Shoot; + Item.knockBack = 4.5f; + Item.autoReuse = false; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.Calamity().donorItem = true; + Item.UseSound = SoundID.Item71; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; } // Terraria seems to really dislike high crit values in SetDefaults @@ -56,15 +56,7 @@ namespace CalamityMod.Items.Weapons.Typeless public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PsychoKnife); - recipe.AddIngredient(ItemID.Obsidian, 10); - recipe.AddIngredient(ItemID.IronBar, 20); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.PsychoKnife).AddIngredient(ItemID.Obsidian, 10).AddIngredient(ItemID.IronBar, 20).AddIngredient(ModContent.ItemType(), 50).AddTile(TileID.MythrilAnvil).Register(); } } } diff --git a/NPCs/Abyss/Bloatfish.cs b/NPCs/Abyss/Bloatfish.cs index 614f190cae..2108a80291 100644 --- a/NPCs/Abyss/Bloatfish.cs +++ b/NPCs/Abyss/Bloatfish.cs @@ -15,88 +15,88 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Bloatfish"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.noGravity = true; - npc.lavaImmune = true; - npc.damage = 5; - npc.width = 74; - npc.height = 94; - npc.defense = 100; - npc.lifeMax = 7200; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.lavaImmune = true; + NPC.damage = 5; + NPC.width = 74; + NPC.height = 94; + NPC.defense = 100; + NPC.lifeMax = 7200; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 30, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.9f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 30, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.9f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - npc.noGravity = true; - if (npc.direction == 0) + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + NPC.noGravity = true; + if (NPC.direction == 0) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - if (npc.wet) + if (NPC.wet) { - npc.TargetClosest(false); - if (npc.collideX) + NPC.TargetClosest(false); + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; + NPC.netUpdate = true; } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -0.2f || npc.velocity.X > 0.2f) + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -0.2f || NPC.velocity.X > 0.2f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num258 = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int num259 = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; if (Main.tile[num258, num259 - 1] == null) { Main.tile[num258, num259 - 1] = new Tile(); @@ -113,43 +113,43 @@ namespace CalamityMod.NPCs.Abyss { if (Main.tile[num258, num259 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num258, num259 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) { - npc.velocity.Y = npc.velocity.Y * 0.95f; + NPC.velocity.Y = NPC.velocity.Y * 0.95f; } } else { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + NPC.velocity.X = NPC.velocity.X * 0.94f; + if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) { - npc.velocity.X = 0f; + NPC.velocity.X = 0f; } } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 3f) + NPC.velocity.Y = NPC.velocity.Y + 0.3f; + if (NPC.velocity.Y > 3f) { - npc.velocity.Y = 3f; + NPC.velocity.Y = 3f; } - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) + NPC.rotation = NPC.velocity.Y * (float)NPC.direction * 0.1f; + if ((double)NPC.rotation < -0.2) { - npc.rotation = -0.2f; + NPC.rotation = -0.2f; } - if ((double)npc.rotation > 0.2) + if ((double)NPC.rotation > 0.2) { - npc.rotation = 0.2f; + NPC.rotation = 0.2f; return; } } @@ -169,20 +169,20 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { - if (!npc.wet) + if (!NPC.wet) { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; return; } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && NPC.CountNPCS(ModContent.NPCType()) < 3) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && NPC.CountNPCS(ModContent.NPCType()) < 3) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } @@ -191,28 +191,28 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); + DropHelper.DropItem(NPC, ModContent.ItemType(), 10, 20); int minCells = Main.expertMode ? 7 : 5; int maxCells = Main.expertMode ? 10 : 7; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 5, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 5, hitDirection, -1f, 0, default, 1f); } } - if (npc.scale < 2f) + if (NPC.scale < 2f) { - npc.scale += 0.05f; + NPC.scale += 0.05f; } } } diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index fd85238eb6..81622b5e91 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -17,193 +17,193 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Bobbit Worm"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.lavaImmune = true; - npc.Calamity().canBreakPlayerDefense = true; - npc.aiStyle = -1; - npc.damage = 150; - npc.width = 80; - npc.height = 40; - npc.defense = 50; - npc.DR_NERD(0.25f); - npc.lifeMax = 6000; - npc.knockBackResist = 0f; + NPC.lavaImmune = true; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.aiStyle = -1; + NPC.damage = 150; + NPC.width = 80; + NPC.height = 40; + NPC.defense = 50; + NPC.DR_NERD(0.25f); + NPC.lifeMax = 6000; + NPC.knockBackResist = 0f; aiType = -1; - npc.noGravity = true; - npc.value = Item.buyPrice(0, 0, 50, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.noGravity = true; + NPC.value = Item.buyPrice(0, 0, 50, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - if (!Main.npc[(int)npc.ai[2]].active || (int)npc.ai[2] < 0) + if (!Main.npc[(int)NPC.ai[2]].active || (int)NPC.ai[2] < 0) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.noTileCollide = true; + NPC.noTileCollide = true; float num659 = 14f; - Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); - float num660 = Main.npc[(int)npc.ai[2]].Center.X - vector79.X; - float num661 = Main.npc[(int)npc.ai[2]].Center.Y - vector79.Y; + Vector2 vector79 = new Vector2(NPC.Center.X, NPC.Center.Y); + float num660 = Main.npc[(int)NPC.ai[2]].Center.X - vector79.X; + float num661 = Main.npc[(int)NPC.ai[2]].Center.Y - vector79.Y; float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); if (num662 < 11f + num659) { - npc.rotation = 0f; - npc.velocity.X = num660; - npc.velocity.Y = num661; - npc.ai[1] += 1f; - if (npc.ai[1] >= 60f) + NPC.rotation = 0f; + NPC.velocity.X = num660; + NPC.velocity.Y = num661; + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 60f) { - npc.TargetClosest(true); + NPC.TargetClosest(true); //if (npc.Center.Y + ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 50f : 100f) > Main.player[npc.target].Center.Y && - if (npc.Center.Y + Main.player[npc.target].Calamity().GetAbyssAggro(100f, 50f) > Main.player[npc.target].Center.Y && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (NPC.Center.Y + Main.player[NPC.target].Calamity().GetAbyssAggro(100f, 50f) > Main.player[NPC.target].Center.Y && + Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - npc.ai[1] = 0f; - npc.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[0] = 1f; return; } - npc.ai[1] = 0f; + NPC.ai[1] = 0f; return; } } else { num662 = num659 / num662; - npc.velocity.X = num660 * num662; - npc.velocity.Y = num661 * num662; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + NPC.velocity.X = num660 * num662; + NPC.velocity.Y = num661 * num662; + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) - 1.57f; } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - npc.noTileCollide = true; - npc.collideX = false; - npc.collideY = false; + NPC.noTileCollide = true; + NPC.collideX = false; + NPC.collideY = false; float num663 = 16f; - Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); - float num664 = Main.player[npc.target].Center.X - vector80.X; - float num665 = Main.player[npc.target].Center.Y - vector80.Y; + Vector2 vector80 = new Vector2(NPC.Center.X, NPC.Center.Y); + float num664 = Main.player[NPC.target].Center.X - vector80.X; + float num665 = Main.player[NPC.target].Center.Y - vector80.Y; float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); num666 = num663 / num666; - npc.velocity.X = num664 * num666; - npc.velocity.Y = num665 * num666; - npc.ai[0] = 2f; - npc.rotation = (float)Math.Atan2((double)-(double)npc.velocity.Y, (double)-(double)npc.velocity.X) - 1.57f; + NPC.velocity.X = num664 * num666; + NPC.velocity.Y = num665 * num666; + NPC.ai[0] = 2f; + NPC.rotation = (float)Math.Atan2((double)-(double)NPC.velocity.Y, (double)-(double)NPC.velocity.X) - 1.57f; } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + if (Math.Abs(NPC.velocity.X) > Math.Abs(NPC.velocity.Y)) { - if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) + if (NPC.velocity.X > 0f && NPC.Center.X > Main.player[NPC.target].Center.X) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } - if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) + if (NPC.velocity.X < 0f && NPC.Center.X < Main.player[NPC.target].Center.X) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } } else { - if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) + if (NPC.velocity.Y > 0f && NPC.Center.Y > Main.player[NPC.target].Center.Y) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } - if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) + if (NPC.velocity.Y < 0f && NPC.Center.Y < Main.player[NPC.target].Center.Y) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } } - Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); - float num667 = Main.npc[(int)npc.ai[2]].Center.X - vector81.X; - float num668 = Main.npc[(int)npc.ai[2]].Center.Y - vector81.Y; + Vector2 vector81 = new Vector2(NPC.Center.X, NPC.Center.Y); + float num667 = Main.npc[(int)NPC.ai[2]].Center.X - vector81.X; + float num668 = Main.npc[(int)NPC.ai[2]].Center.Y - vector81.Y; float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); - if (num669 > 700f || npc.collideX || npc.collideY) + if (num669 > 700f || NPC.collideX || NPC.collideY) { - npc.noTileCollide = true; - npc.ai[0] = 0f; + NPC.noTileCollide = true; + NPC.ai[0] = 0f; return; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - npc.noTileCollide = true; + NPC.noTileCollide = true; float num671 = 16f; float num672 = 0.25f; - Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); - float num673 = Main.player[npc.target].Center.X - vector82.X; - float num674 = Main.player[npc.target].Center.Y - vector82.Y; + Vector2 vector82 = new Vector2(NPC.Center.X, NPC.Center.Y); + float num673 = Main.player[NPC.target].Center.X - vector82.X; + float num674 = Main.player[NPC.target].Center.Y - vector82.Y; float num675 = (float)Math.Sqrt((double)(num673 * num673 + num674 * num674)); num675 = num671 / num675; num673 *= num675; num674 *= num675; - if (npc.velocity.X < num673) + if (NPC.velocity.X < num673) { - npc.velocity.X = npc.velocity.X + num672; - if (npc.velocity.X < 0f && num673 > 0f) + NPC.velocity.X = NPC.velocity.X + num672; + if (NPC.velocity.X < 0f && num673 > 0f) { - npc.velocity.X = npc.velocity.X + num672 * 2f; + NPC.velocity.X = NPC.velocity.X + num672 * 2f; } } - else if (npc.velocity.X > num673) + else if (NPC.velocity.X > num673) { - npc.velocity.X = npc.velocity.X - num672; - if (npc.velocity.X > 0f && num673 < 0f) + NPC.velocity.X = NPC.velocity.X - num672; + if (NPC.velocity.X > 0f && num673 < 0f) { - npc.velocity.X = npc.velocity.X - num672 * 2f; + NPC.velocity.X = NPC.velocity.X - num672 * 2f; } } - if (npc.velocity.Y < num674) + if (NPC.velocity.Y < num674) { - npc.velocity.Y = npc.velocity.Y + num672; - if (npc.velocity.Y < 0f && num674 > 0f) + NPC.velocity.Y = NPC.velocity.Y + num672; + if (NPC.velocity.Y < 0f && num674 > 0f) { - npc.velocity.Y = npc.velocity.Y + num672 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num672 * 2f; } } - else if (npc.velocity.Y > num674) + else if (NPC.velocity.Y > num674) { - npc.velocity.Y = npc.velocity.Y - num672; - if (npc.velocity.Y > 0f && num674 < 0f) + NPC.velocity.Y = NPC.velocity.Y - num672; + if (NPC.velocity.Y > 0f && num674 < 0f) { - npc.velocity.Y = npc.velocity.Y - num672 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num672 * 2f; } } - npc.rotation = (float)Math.Atan2((double)-(double)npc.velocity.Y, (double)-(double)npc.velocity.X); + NPC.rotation = (float)Math.Atan2((double)-(double)NPC.velocity.Y, (double)-(double)NPC.velocity.X); } } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.1f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - float drawPositionX = Main.npc[(int)npc.ai[2]].Center.X - center.X; - float drawPositionY = Main.npc[(int)npc.ai[2]].Center.Y - center.Y; + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + float drawPositionX = Main.npc[(int)NPC.ai[2]].Center.X - center.X; + float drawPositionY = Main.npc[(int)NPC.ai[2]].Center.Y - center.Y; float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; bool draw = true; while (draw) @@ -220,13 +220,13 @@ namespace CalamityMod.NPCs.Abyss drawPositionY *= totalDrawDistance; center.X += drawPositionX; center.Y += drawPositionY; - drawPositionX = Main.npc[(int)npc.ai[2]].Center.X - center.X; - drawPositionY = Main.npc[(int)npc.ai[2]].Center.Y - center.Y; + drawPositionX = Main.npc[(int)NPC.ai[2]].Center.X - center.X; + drawPositionY = Main.npc[(int)NPC.ai[2]].Center.Y - center.Y; drawPositionY += 4f; Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/BobbitWormSegment"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, ModContent.GetTexture("CalamityMod/NPCs/Abyss/BobbitWormSegment").Width, ModContent.GetTexture("CalamityMod/NPCs/Abyss/BobbitWormSegment").Height)), color, rotation, - new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/BobbitWormSegment").Width * 0.5f, (float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/BobbitWormSegment").Height * 0.5f), 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/BobbitWormSegment"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), + new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Abyss/BobbitWormSegment").Width, ModContent.Request("CalamityMod/NPCs/Abyss/BobbitWormSegment").Height)), color, rotation, + new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/BobbitWormSegment").Width * 0.5f, (float)ModContent.Request("CalamityMod/NPCs/Abyss/BobbitWormSegment").Height * 0.5f), 1f, SpriteEffects.None, 0f); } } return true; @@ -241,26 +241,26 @@ namespace CalamityMod.NPCs.Abyss { int minCells = Main.expertMode ? 7 : 5; int maxCells = Main.expertMode ? 10 : 7; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/BobbitWorm"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/BobbitWorm2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/BobbitWorm3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/BobbitWorm4"), 1f); } } } diff --git a/NPCs/Abyss/BobbitWormSegment.cs b/NPCs/Abyss/BobbitWormSegment.cs index 0292204ae4..341f2011f2 100644 --- a/NPCs/Abyss/BobbitWormSegment.cs +++ b/NPCs/Abyss/BobbitWormSegment.cs @@ -14,31 +14,31 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.lavaImmune = true; - npc.aiStyle = -1; - npc.damage = 0; - npc.alpha = 255; - npc.width = 26; - npc.height = 26; - npc.defense = 0; - npc.lifeMax = 100; - npc.knockBackResist = 0f; + NPC.lavaImmune = true; + NPC.aiStyle = -1; + NPC.damage = 0; + NPC.alpha = 255; + NPC.width = 26; + NPC.height = 26; + NPC.defense = 0; + NPC.lifeMax = 100; + NPC.knockBackResist = 0f; aiType = -1; - npc.dontTakeDamage = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + NPC.dontTakeDamage = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; } public override void AI() { - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { for (int i = 0; i < CalamityGlobalNPC.bobbitWormBottom.Length; i++) { if (CalamityGlobalNPC.bobbitWormBottom[i] == -1) { - CalamityGlobalNPC.bobbitWormBottom[i] = npc.whoAmI; - npc.ai[0] = (float)i; + CalamityGlobalNPC.bobbitWormBottom[i] = NPC.whoAmI; + NPC.ai[0] = (float)i; break; } } @@ -46,25 +46,25 @@ namespace CalamityMod.NPCs.Abyss if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.ai[1] == 0f) + if (NPC.ai[1] == 0f) { - npc.ai[1] = 1f; - int spawnedNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[spawnedNPC].ai[2] = (float)CalamityGlobalNPC.bobbitWormBottom[(int)npc.ai[0]]; - npc.ai[2] = (float)spawnedNPC; + NPC.ai[1] = 1f; + int spawnedNPC = NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[spawnedNPC].ai[2] = (float)CalamityGlobalNPC.bobbitWormBottom[(int)NPC.ai[0]]; + NPC.ai[2] = (float)spawnedNPC; } } - if (!Main.npc[(int)npc.ai[2]].active || Main.npc[(int)npc.ai[2]].life <= 0) + if (!Main.npc[(int)NPC.ai[2]].active || Main.npc[(int)NPC.ai[2]].life <= 0) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer4 && spawnInfo.water) { if (CalamityGlobalNPC.bobbitWormBottom.Contains(-1)) return SpawnCondition.CaveJellyfish.Chance * 0.3f; diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index 3bbf89540a..b96e79603e 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -14,130 +14,130 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Box Jellyfish"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.noGravity = true; - npc.damage = 44; - npc.width = 30; - npc.height = 33; - npc.defense = 5; - npc.lifeMax = 90; - npc.alpha = 20; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.damage = 44; + NPC.width = 30; + NPC.height = 33; + NPC.defense = 5; + NPC.lifeMax = 90; + NPC.alpha = 20; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit25; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 0, 80); + NPC.HitSound = SoundID.NPCHit25; + NPC.DeathSound = SoundID.NPCDeath28; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - if (npc.direction == 0) + if (NPC.direction == 0) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - if (!npc.wet) + if (!NPC.wet) { - npc.rotation += npc.velocity.X * 0.1f; - if (npc.velocity.Y == 0f) + NPC.rotation += NPC.velocity.X * 0.1f; + if (NPC.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.98f; - if (npc.velocity.X > -0.01 && npc.velocity.X < 0.01) + NPC.velocity.X = NPC.velocity.X * 0.98f; + if (NPC.velocity.X > -0.01 && NPC.velocity.X < 0.01) { - npc.velocity.X = 0f; + NPC.velocity.X = 0f; } } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 10f) + NPC.velocity.Y = NPC.velocity.Y + 0.2f; + if (NPC.velocity.Y > 10f) { - npc.velocity.Y = 10f; + NPC.velocity.Y = 10f; } - npc.ai[0] = 1f; + NPC.ai[0] = 1f; return; } - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; } - if (npc.collideY) + if (NPC.collideY) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } bool flag16 = false; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.TargetClosest(false); + if (Main.player[NPC.target].wet && !Main.player[NPC.target].dead && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { flag16 = true; } if (flag16) { - npc.localAI[2] = 1f; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f; - npc.velocity *= 0.975f; + NPC.localAI[2] = 1f; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + 1.57f; + NPC.velocity *= 0.975f; float num263 = 0.8f; - if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) + if (NPC.velocity.X > -num263 && NPC.velocity.X < num263 && NPC.velocity.Y > -num263 && NPC.velocity.Y < num263) { - npc.TargetClosest(true); + NPC.TargetClosest(true); float num264 = CalamityWorld.death ? 12f : 8f; - Vector2 vector31 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num265 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector31.X; - float num266 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector31.Y; + Vector2 vector31 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num265 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - vector31.X; + float num266 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - vector31.Y; float num267 = (float)Math.Sqrt(num265 * num265 + num266 * num266); num267 = num264 / num267; num265 *= num267; num266 *= num267; - npc.velocity.X = num265; - npc.velocity.Y = num266; + NPC.velocity.X = num265; + NPC.velocity.Y = num266; } } else { - npc.localAI[2] = 0f; - npc.velocity.X = npc.velocity.X + npc.direction * 0.02f; - npc.rotation = npc.velocity.X * 0.4f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) + NPC.localAI[2] = 0f; + NPC.velocity.X = NPC.velocity.X + NPC.direction * 0.02f; + NPC.rotation = NPC.velocity.X * 0.4f; + if (NPC.velocity.X < -1f || NPC.velocity.X > 1f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if (npc.velocity.Y < -1f) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if (NPC.velocity.Y < -1f) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if (npc.velocity.Y > 1f) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if (NPC.velocity.Y > 1f) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - int num268 = (int)(npc.position.X + (npc.width / 2)) / 16; - int num269 = (int)(npc.position.Y + (npc.height / 2)) / 16; + int num268 = (int)(NPC.position.X + (NPC.width / 2)) / 16; + int num269 = (int)(NPC.position.Y + (NPC.height / 2)) / 16; if (Main.tile[num268, num269 - 1] == null) { Main.tile[num268, num269 - 1] = new Tile(); @@ -154,39 +154,39 @@ namespace CalamityMod.NPCs.Abyss { if (Main.tile[num268, num269 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num268, num269 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } else { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - if (npc.velocity.Y > 1.2 || npc.velocity.Y < -1.2) + if (NPC.velocity.Y > 1.2 || NPC.velocity.Y < -1.2) { - npc.velocity.Y = npc.velocity.Y * 0.99f; + NPC.velocity.Y = NPC.velocity.Y * 0.99f; } } } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur) { return 0f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } @@ -202,13 +202,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } @@ -216,8 +216,8 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { int abyssShockerChance = Main.expertMode ? 40 : 50; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss3, abyssShockerChance, 1, 1); - DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, 0.01f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), NPC.downedBoss3, abyssShockerChance, 1, 1); + DropHelper.DropItemChance(NPC, ItemID.JellyfishNecklace, 0.01f); } } } diff --git a/NPCs/Abyss/ChaoticPuffer.cs b/NPCs/Abyss/ChaoticPuffer.cs index ea1705047e..04458483a4 100644 --- a/NPCs/Abyss/ChaoticPuffer.cs +++ b/NPCs/Abyss/ChaoticPuffer.cs @@ -7,6 +7,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Abyss { @@ -21,38 +22,38 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Chaotic Puffer"); - Main.npcFrameCount[npc.type] = 11; + Main.npcFrameCount[NPC.type] = 11; } public override void SetDefaults() { - npc.noGravity = true; - npc.lavaImmune = true; - npc.width = 78; - npc.height = 70; - npc.defense = 50; - npc.lifeMax = 5625; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.lavaImmune = true; + NPC.width = 78; + NPC.height = 70; + NPC.defense = 50; + NPC.lifeMax = 5625; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 30, 0); - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 30, 0); + NPC.HitSound = SoundID.NPCHit23; + NPC.DeathSound = SoundID.NPCDeath28; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.03f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.03f; + NPC.TargetClosest(true); + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.03f; + NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * 0.03f; - npc.damage = puffedUp ? (Main.expertMode ? 175 : 100) : 0; + NPC.damage = puffedUp ? (Main.expertMode ? 175 : 100) : 0; if (!puffing || !unpuffing) @@ -99,107 +100,107 @@ namespace CalamityMod.NPCs.Abyss } - if (npc.velocity.X >= 1 || npc.velocity.X <= -1) + if (NPC.velocity.X >= 1 || NPC.velocity.X <= -1) { - npc.velocity.X = npc.velocity.X * 0.97f; + NPC.velocity.X = NPC.velocity.X * 0.97f; } - if (npc.velocity.Y >= 1 || npc.velocity.Y <= -1) + if (NPC.velocity.Y >= 1 || NPC.velocity.Y <= -1) { - npc.velocity.Y = npc.velocity.Y * 0.97f; + NPC.velocity.Y = NPC.velocity.Y * 0.97f; } - npc.rotation += npc.velocity.X * 0.05f; + NPC.rotation += NPC.velocity.X * 0.05f; } public void Boom() { - Main.PlaySound(SoundID.NPCDeath14, (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(SoundID.NPCDeath14, (int)NPC.position.X, (int)NPC.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient && puffedUp) { int damageBoom = 45; int projectileType = ModContent.ProjectileType(); - int boom = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + int boom = Projectile.NewProjectile(NPC.Center.X, NPC.Center.Y, 0, 0, projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); } - npc.netUpdate = true; + NPC.netUpdate = true; } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/ChaoticPufferGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/ChaoticPufferGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Yellow); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/ChaoticPufferGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/ChaoticPufferGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/ChaoticPufferGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Yellow); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/ChaoticPufferGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void FindFrame(int frameHeight) { - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 6.0) { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; if (!unpuffing) { - npc.frame.Y = npc.frame.Y + frameHeight; + NPC.frame.Y = NPC.frame.Y + frameHeight; } else { - npc.frame.Y = npc.frame.Y - frameHeight; + NPC.frame.Y = NPC.frame.Y - frameHeight; } } if (puffing) { - if (npc.frame.Y < frameHeight * 3) + if (NPC.frame.Y < frameHeight * 3) { - npc.frame.Y = frameHeight * 3; + NPC.frame.Y = frameHeight * 3; } - if (npc.frame.Y > frameHeight * 6) + if (NPC.frame.Y > frameHeight * 6) { - npc.frame.Y = frameHeight * 3; + NPC.frame.Y = frameHeight * 3; } } else if (unpuffing) { - if (npc.frame.Y > frameHeight * 6) + if (NPC.frame.Y > frameHeight * 6) { - npc.frame.Y = frameHeight * 6; + NPC.frame.Y = frameHeight * 6; } - if (npc.frame.Y < frameHeight * 3) + if (NPC.frame.Y < frameHeight * 3) { - npc.frame.Y = frameHeight * 6; + NPC.frame.Y = frameHeight * 6; } } else if (!puffedUp) { - if (npc.frame.Y > frameHeight * 3) + if (NPC.frame.Y > frameHeight * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } else { - if (npc.frame.Y < frameHeight * 7) + if (NPC.frame.Y < frameHeight * 7) { - npc.frame.Y = frameHeight * 7; + NPC.frame.Y = frameHeight * 7; } - if (npc.frame.Y > frameHeight * 10) + if (NPC.frame.Y > frameHeight * 10) { - npc.frame.Y = frameHeight * 7; + NPC.frame.Y = frameHeight * 7; } } @@ -207,11 +208,11 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.4f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } @@ -220,7 +221,7 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedGolemBoss, 1f, 10, 26); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), NPC.downedGolemBoss, 1f, 10, 26); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -230,29 +231,29 @@ namespace CalamityMod.NPCs.Abyss if (puffedUp) { Boom(); - npc.active = false; + NPC.active = false; } } public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - npc.velocity.X = projectile.velocity.X; - npc.velocity.Y = projectile.velocity.Y; + NPC.velocity.X = projectile.velocity.X; + NPC.velocity.Y = projectile.velocity.Y; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { Boom(); for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index 12ad94eb58..682fbf391f 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -12,6 +12,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Abyss { @@ -22,394 +23,394 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Colossal Squid"); - Main.npcFrameCount[npc.type] = 11; + Main.npcFrameCount[NPC.type] = 11; } public override void SetDefaults() { - npc.npcSlots = 9f; - npc.noGravity = true; - npc.damage = 150; - npc.width = 180; - npc.height = 180; - npc.defense = 50; - npc.DR_NERD(0.05f); - npc.lifeMax = 130000; // Previously 220,000 - npc.aiStyle = -1; + NPC.npcSlots = 9f; + NPC.noGravity = true; + NPC.damage = 150; + NPC.width = 180; + NPC.height = 180; + NPC.defense = 50; + NPC.DR_NERD(0.05f); + NPC.lifeMax = 130000; // Previously 220,000 + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.timeLeft = NPC.activeTime * 30; - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.HitSound = SoundID.NPCHit20; - npc.DeathSound = SoundID.NPCDeath23; - npc.rarity = 2; - banner = npc.type; + NPC.knockBackResist = 0f; + NPC.timeLeft = NPC.activeTime * 30; + NPC.value = Item.buyPrice(0, 25, 0, 0); + NPC.HitSound = SoundID.NPCHit20; + NPC.DeathSound = SoundID.NPCDeath23; + NPC.rarity = 2; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.chaseable); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); } public override void ReceiveExtraAI(BinaryReader reader) { hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.chaseable = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); } public override void AI() { - if (npc.localAI[1] == 1f) + if (NPC.localAI[1] == 1f) { - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 180f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + NPC.localAI[3] += 1f; + if (NPC.localAI[3] >= 180f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; - npc.localAI[3] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; + NPC.localAI[3] = 0f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } if (Main.rand.NextBool(300)) { - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 34); + SoundEngine.PlaySound(SoundID.Zombie, (int)NPC.position.X, (int)NPC.position.Y, 34); } - npc.noTileCollide = false; - if (npc.ai[0] == 0f) + NPC.noTileCollide = false; + if (NPC.ai[0] == 0f) { - npc.TargetClosest(true); - if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + NPC.TargetClosest(true); + if (Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1)) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } else { - Vector2 value29 = Main.player[npc.target].Center - npc.Center; - value29.Y -= (float)(Main.player[npc.target].height / 4); + Vector2 value29 = Main.player[NPC.target].Center - NPC.Center; + value29.Y -= (float)(Main.player[NPC.target].height / 4); float num1310 = value29.Length(); if (num1310 > 800f) { - npc.ai[0] = 2f; + NPC.ai[0] = 2f; } else { - Vector2 center26 = npc.Center; - center26.X = Main.player[npc.target].Center.X; - Vector2 vector230 = center26 - npc.Center; - if (vector230.Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center26, 1, 1)) + Vector2 center26 = NPC.Center; + center26.X = Main.player[NPC.target].Center.X; + Vector2 vector230 = center26 - NPC.Center; + if (vector230.Length() > 8f && Collision.CanHit(NPC.Center, 1, 1, center26, 1, 1)) { - npc.ai[0] = 3f; - npc.ai[1] = center26.X; - npc.ai[2] = center26.Y; - Vector2 center27 = npc.Center; - center27.Y = Main.player[npc.target].Center.Y; - if (vector230.Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center27, 1, 1) && Collision.CanHit(center27, 1, 1, Main.player[npc.target].position, 1, 1)) + NPC.ai[0] = 3f; + NPC.ai[1] = center26.X; + NPC.ai[2] = center26.Y; + Vector2 center27 = NPC.Center; + center27.Y = Main.player[NPC.target].Center.Y; + if (vector230.Length() > 8f && Collision.CanHit(NPC.Center, 1, 1, center27, 1, 1) && Collision.CanHit(center27, 1, 1, Main.player[NPC.target].position, 1, 1)) { - npc.ai[0] = 3f; - npc.ai[1] = center27.X; - npc.ai[2] = center27.Y; + NPC.ai[0] = 3f; + NPC.ai[1] = center27.X; + NPC.ai[2] = center27.Y; } } else { - center26 = npc.Center; - center26.Y = Main.player[npc.target].Center.Y; - if ((center26 - npc.Center).Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center26, 1, 1)) + center26 = NPC.Center; + center26.Y = Main.player[NPC.target].Center.Y; + if ((center26 - NPC.Center).Length() > 8f && Collision.CanHit(NPC.Center, 1, 1, center26, 1, 1)) { - npc.ai[0] = 3f; - npc.ai[1] = center26.X; - npc.ai[2] = center26.Y; + NPC.ai[0] = 3f; + NPC.ai[1] = center26.X; + NPC.ai[2] = center26.Y; } } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; value29.Normalize(); value29 *= 0.5f; - npc.velocity += value29; - npc.ai[0] = 4f; - npc.ai[1] = 0f; + NPC.velocity += value29; + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; } } } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - npc.rotation += (float)npc.direction * 0.1f; - Vector2 value30 = Main.player[npc.target].Top - npc.Center; + NPC.rotation += (float)NPC.direction * 0.1f; + Vector2 value30 = Main.player[NPC.target].Top - NPC.Center; float num1311 = value30.Length(); float num1312 = 5f; num1312 += num1311 / 100f; int num1313 = 50; value30.Normalize(); value30 *= num1312; - npc.velocity = (npc.velocity * (float)(num1313 - 1) + value30) / (float)num1313; - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + NPC.velocity = (NPC.velocity * (float)(num1313 - 1) + value30) / (float)num1313; + if (!Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1)) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; } - if (num1311 < 160f && Main.player[npc.target].active && !Main.player[npc.target].dead) + if (num1311 < 160f && Main.player[NPC.target].active && !Main.player[NPC.target].dead) { - npc.Center = Main.player[npc.target].Top; - npc.velocity = Vector2.Zero; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.Center = Main.player[NPC.target].Top; + NPC.velocity = Vector2.Zero; + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - npc.rotation = npc.velocity.X * 0.05f; - npc.noTileCollide = true; - Vector2 value31 = Main.player[npc.target].Center - npc.Center; + NPC.rotation = NPC.velocity.X * 0.05f; + NPC.noTileCollide = true; + Vector2 value31 = Main.player[NPC.target].Center - NPC.Center; float num1315 = value31.Length(); float scaleFactor11 = 3f; int num1316 = 3; value31.Normalize(); value31 *= scaleFactor11; - npc.velocity = (npc.velocity * (float)(num1316 - 1) + value31) / (float)num1316; - if (num1315 < 600f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + NPC.velocity = (NPC.velocity * (float)(num1316 - 1) + value31) / (float)num1316; + if (num1315 < 600f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.ai[0] = 0f; + NPC.ai[0] = 0f; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - npc.rotation = npc.velocity.X * 0.05f; - Vector2 value32 = new Vector2(npc.ai[1], npc.ai[2]); - Vector2 value33 = value32 - npc.Center; + NPC.rotation = NPC.velocity.X * 0.05f; + Vector2 value32 = new Vector2(NPC.ai[1], NPC.ai[2]); + Vector2 value33 = value32 - NPC.Center; float num1317 = value33.Length(); float num1318 = 2f; float num1319 = 3f; value33.Normalize(); value33 *= num1318; - npc.velocity = (npc.velocity * (num1319 - 1f) + value33) / num1319; - if (npc.collideX || npc.collideY) + NPC.velocity = (NPC.velocity * (num1319 - 1f) + value33) / num1319; + if (NPC.collideX || NPC.collideY) { - npc.ai[0] = 4f; - npc.ai[1] = 0f; + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; } - if (num1317 < num1318 || num1317 > 800f || Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + if (num1317 < num1318 || num1317 > 800f || Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1)) { - npc.ai[0] = 0f; + NPC.ai[0] = 0f; } } - else if (npc.ai[0] == 4f) + else if (NPC.ai[0] == 4f) { - npc.rotation = npc.velocity.X * 0.05f; - if (npc.collideX) + NPC.rotation = NPC.velocity.X * 0.05f; + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -0.8f; + NPC.velocity.X = NPC.velocity.X * -0.8f; } - if (npc.collideY) + if (NPC.collideY) { - npc.velocity.Y = npc.velocity.Y * -0.8f; + NPC.velocity.Y = NPC.velocity.Y * -0.8f; } Vector2 value34; - if (npc.velocity.X == 0f && npc.velocity.Y == 0f) + if (NPC.velocity.X == 0f && NPC.velocity.Y == 0f) { - value34 = Main.player[npc.target].Center - npc.Center; - value34.Y -= (float)(Main.player[npc.target].height / 4); + value34 = Main.player[NPC.target].Center - NPC.Center; + value34.Y -= (float)(Main.player[NPC.target].height / 4); value34.Normalize(); - npc.velocity = value34 * 0.1f; + NPC.velocity = value34 * 0.1f; } float scaleFactor12 = 2f; float num1320 = 20f; - value34 = npc.velocity; + value34 = NPC.velocity; value34.Normalize(); value34 *= scaleFactor12; - npc.velocity = (npc.velocity * (num1320 - 1f) + value34) / num1320; - npc.ai[1] += 1f; - if (npc.ai[1] > 180f) + NPC.velocity = (NPC.velocity * (num1320 - 1f) + value34) / num1320; + NPC.ai[1] += 1f; + if (NPC.ai[1] > 180f) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; } - if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + if (Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1)) { - npc.ai[0] = 0f; + NPC.ai[0] = 0f; } - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 5f && !Collision.SolidCollision(npc.position - new Vector2(10f, 10f), npc.width + 20, npc.height + 20)) + NPC.localAI[0] += 1f; + if (NPC.localAI[0] >= 5f && !Collision.SolidCollision(NPC.position - new Vector2(10f, 10f), NPC.width + 20, NPC.height + 20)) { - npc.localAI[0] = 0f; - Vector2 center28 = npc.Center; - center28.X = Main.player[npc.target].Center.X; - if (Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(Main.player[npc.target].Center, 1, 1, center28, 1, 1)) + NPC.localAI[0] = 0f; + Vector2 center28 = NPC.Center; + center28.X = Main.player[NPC.target].Center.X; + if (Collision.CanHit(NPC.Center, 1, 1, center28, 1, 1) && Collision.CanHit(NPC.Center, 1, 1, center28, 1, 1) && Collision.CanHit(Main.player[NPC.target].Center, 1, 1, center28, 1, 1)) { - npc.ai[0] = 3f; - npc.ai[1] = center28.X; - npc.ai[2] = center28.Y; + NPC.ai[0] = 3f; + NPC.ai[1] = center28.X; + NPC.ai[2] = center28.Y; } else { - center28 = npc.Center; - center28.Y = Main.player[npc.target].Center.Y; - if (Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(Main.player[npc.target].Center, 1, 1, center28, 1, 1)) + center28 = NPC.Center; + center28.Y = Main.player[NPC.target].Center.Y; + if (Collision.CanHit(NPC.Center, 1, 1, center28, 1, 1) && Collision.CanHit(Main.player[NPC.target].Center, 1, 1, center28, 1, 1)) { - npc.ai[0] = 3f; - npc.ai[1] = center28.X; - npc.ai[2] = center28.Y; + NPC.ai[0] = 3f; + NPC.ai[1] = center28.X; + NPC.ai[2] = center28.Y; } } } } - else if (npc.ai[0] == 5f) + else if (NPC.ai[0] == 5f) { - Player player7 = Main.player[npc.target]; + Player player7 = Main.player[NPC.target]; if (!player7.active || player7.dead) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } else { - npc.Center = ((player7.gravDir == 1f) ? player7.Top : player7.Bottom) + new Vector2((float)(player7.direction * 4), 0f); - npc.gfxOffY = player7.gfxOffY; - npc.velocity = Vector2.Zero; + NPC.Center = ((player7.gravDir == 1f) ? player7.Top : player7.Bottom) + new Vector2((float)(player7.direction * 4), 0f); + NPC.gfxOffY = player7.gfxOffY; + NPC.velocity = Vector2.Zero; player7.AddBuff(163, 59, true); } } - npc.rotation = npc.velocity.X * 0.05f; + NPC.rotation = NPC.velocity.X * 0.05f; } else { - if (npc.direction == 0) + if (NPC.direction == 0) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - if (!npc.noTileCollide) + if (!NPC.noTileCollide) { - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; } - if (npc.collideY) + if (NPC.collideY) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } } - npc.TargetClosest(false); - if ((Main.player[npc.target].wet && !Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + NPC.TargetClosest(false); + if ((Main.player[NPC.target].wet && !Main.player[NPC.target].dead && + Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 300f) * //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) || - (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(300f, 150f)) || - npc.justHit) + (Main.player[NPC.target].Center - NPC.Center).Length() < Main.player[NPC.target].Calamity().GetAbyssAggro(300f, 150f)) || + NPC.justHit) { hasBeenHit = true; } - npc.chaseable = hasBeenHit; + NPC.chaseable = hasBeenHit; if (hasBeenHit) { if (Main.rand.NextBool(300)) { - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 34); + SoundEngine.PlaySound(SoundID.Zombie, (int)NPC.position.X, (int)NPC.position.Y, 34); } - if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (NPC.ai[3] > 0f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - npc.ai[3] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[3] = 0f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[3] == 0f) + else if (NPC.ai[3] == 0f) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } - if (npc.ai[1] >= 120f) + if (NPC.ai[1] >= 120f) { - npc.ai[3] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[3] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } - if (npc.ai[3] == 0f) + if (NPC.ai[3] == 0f) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } else { - npc.noTileCollide = true; + NPC.noTileCollide = true; } - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 420f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + NPC.localAI[3] += 1f; + if (NPC.localAI[3] >= 420f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.localAI[0] = 0f; - npc.localAI[1] = 1f; - npc.localAI[2] = 0f; - npc.localAI[3] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 1f; + NPC.localAI[2] = 0f; + NPC.localAI[3] = 0f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; return; } - npc.localAI[2] = 1f; - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 150f) + NPC.localAI[2] = 1f; + NPC.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= 150f) { - npc.localAI[0] = 0f; - npc.netUpdate = true; + NPC.localAI[0] = 0f; + NPC.netUpdate = true; int damage = 70; if (Main.expertMode) { damage = 55; } - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 111); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y + 60, 0f, 2f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + SoundEngine.PlaySound(SoundID.Item, (int)NPC.position.X, (int)NPC.position.Y, 111); + Projectile.NewProjectile(NPC.Center.X, NPC.Center.Y + 60, 0f, 2f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } - npc.rotation = npc.velocity.X * 0.05f; - npc.velocity *= 0.975f; + NPC.rotation = NPC.velocity.X * 0.05f; + NPC.velocity *= 0.975f; float num263 = 2.5f; - if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) + if (NPC.velocity.X > -num263 && NPC.velocity.X < num263 && NPC.velocity.Y > -num263 && NPC.velocity.Y < num263) { - npc.TargetClosest(true); + NPC.TargetClosest(true); float num264 = 20f; - Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; - float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; + Vector2 vector31 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num265 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - vector31.X; + float num266 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - vector31.Y; float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); num267 = num264 / num267; num265 *= num267; num266 *= num267; - npc.velocity.X = num265; - npc.velocity.Y = num266; + NPC.velocity.X = num265; + NPC.velocity.Y = num266; return; } } @@ -417,33 +418,33 @@ namespace CalamityMod.NPCs.Abyss { if (Main.rand.NextBool(300)) { - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 35); + SoundEngine.PlaySound(SoundID.Zombie, (int)NPC.position.X, (int)NPC.position.Y, 35); } - npc.localAI[2] = 0f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; - npc.rotation = npc.velocity.X * 0.2f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) + NPC.localAI[2] = 0f; + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.02f; + NPC.rotation = NPC.velocity.X * 0.2f; + if (NPC.velocity.X < -1f || NPC.velocity.X > 1f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if (npc.velocity.Y < -1f) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if (NPC.velocity.Y < -1f) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if (npc.velocity.Y > 1f) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if (NPC.velocity.Y > 1f) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num268 = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int num269 = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; if (Main.tile[num268, num269 - 1] == null) { Main.tile[num268, num269 - 1] = new Tile(); @@ -460,33 +461,33 @@ namespace CalamityMod.NPCs.Abyss { if (Main.tile[num268, num269 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num268, num269 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } else { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) + if ((double)NPC.velocity.Y > 1.2 || (double)NPC.velocity.Y < -1.2) { - npc.velocity.Y = npc.velocity.Y * 0.99f; + NPC.velocity.Y = NPC.velocity.Y * 0.99f; return; } } } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f) + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 6400f) { - npc.active = false; + NPC.active = false; } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - if (npc.ai[0] == 5f) + if (NPC.ai[0] == 5f) { return false; } @@ -495,25 +496,25 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - if (npc.ai[0] == 5f) + if (NPC.ai[0] == 5f) { - Color color = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, - (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Color color = Lighting.GetColor((int)((double)NPC.position.X + (double)NPC.width * 0.5) / 16, + (int)(((double)NPC.position.Y + (double)NPC.height * 0.5) / 16.0)); SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; player.invis = true; player.aggro = -750; if (player.gravDir == -1f) { spriteEffects |= SpriteEffects.FlipVertically; } - Main.spriteBatch.Draw(Main.npcTexture[npc.type], + Main.spriteBatch.Draw(Main.npcTexture[NPC.type], new Vector2((float)(player.direction * 4), player.gfxOffY) + ((player.gravDir == 1f) ? player.Top : player.Bottom) - Main.screenPosition, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), npc.GetAlpha(color), npc.rotation, npc.frame.Size() / 2f, npc.scale, spriteEffects, 0f); + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), NPC.GetAlpha(color), NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, spriteEffects, 0f); } } @@ -528,15 +529,15 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { - npc.frameCounter += hasBeenHit ? 0.15f : 0.075f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += hasBeenHit ? 0.15f : 0.075f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if ((spawnInfo.player.Calamity().ZoneAbyssLayer3 || spawnInfo.player.Calamity().ZoneAbyssLayer4) && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) + if ((spawnInfo.Player.Calamity().ZoneAbyssLayer3 || spawnInfo.Player.Calamity().ZoneAbyssLayer4) && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } @@ -550,30 +551,30 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItem(npc, ItemID.BlackInk, 3, 5); + DropHelper.DropItem(NPC, ItemID.BlackInk, 3, 5); int minCells = Main.expertMode ? 31 : 26; int maxCells = Main.expertMode ? 45 : 38; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10, 1, 1); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 30; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ColossalSquid"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ColossalSquid2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ColossalSquid3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ColossalSquid4"), 1f); } } } diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index c031fd7dea..b2528c9092 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -15,93 +15,93 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Cuttlefish"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.noGravity = true; - npc.chaseable = false; - npc.damage = 34; - npc.width = 50; - npc.height = 28; - npc.defense = 8; - npc.lifeMax = 110; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.chaseable = false; + NPC.damage = 34; + NPC.width = 50; + NPC.height = 28; + NPC.defense = 8; + NPC.lifeMax = 110; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath28; - npc.knockBackResist = 0.3f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.HitSound = SoundID.NPCHit33; + NPC.DeathSound = SoundID.NPCDeath28; + NPC.knockBackResist = 0.3f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; int num = 200; - if (npc.ai[2] == 0f) + if (NPC.ai[2] == 0f) { - npc.alpha = num; - npc.TargetClosest(true); - if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.alpha = num; + NPC.TargetClosest(true); + if (!Main.player[NPC.target].dead && (Main.player[NPC.target].Center - NPC.Center).Length() < 170f && + Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - npc.ai[2] = -16f; + NPC.ai[2] = -16f; } - if (npc.justHit) + if (NPC.justHit) { - npc.ai[2] = -16f; + NPC.ai[2] = -16f; } - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; } - if (npc.collideY) + if (NPC.collideY) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } - npc.velocity.X = npc.velocity.X + npc.direction * 0.02f; - npc.rotation = npc.velocity.X * 0.4f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) + NPC.velocity.X = NPC.velocity.X + NPC.direction * 0.02f; + NPC.rotation = NPC.velocity.X * 0.4f; + if (NPC.velocity.X < -1f || NPC.velocity.X > 1f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if (npc.velocity.Y < -1f) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if (NPC.velocity.Y < -1f) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if (npc.velocity.Y > 1f) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if (NPC.velocity.Y > 1f) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - int num268 = (int)(npc.position.X + (npc.width / 2)) / 16; - int num269 = (int)(npc.position.Y + (npc.height / 2)) / 16; + int num268 = (int)(NPC.position.X + (NPC.width / 2)) / 16; + int num269 = (int)(NPC.position.Y + (NPC.height / 2)) / 16; if (Main.tile[num268, num269 - 1] == null) { Main.tile[num268, num269 - 1] = new Tile(); @@ -118,167 +118,167 @@ namespace CalamityMod.NPCs.Abyss { if (Main.tile[num268, num269 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num268, num269 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } else { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - if (npc.velocity.Y > 1.2 || npc.velocity.Y < -1.2) + if (NPC.velocity.Y > 1.2 || NPC.velocity.Y < -1.2) { - npc.velocity.Y = npc.velocity.Y * 0.99f; + NPC.velocity.Y = NPC.velocity.Y * 0.99f; } return; } - if (npc.ai[2] < 0f) + if (NPC.ai[2] < 0f) { - if (npc.alpha > 0) + if (NPC.alpha > 0) { - npc.alpha -= num / 16; - if (npc.alpha < 0) + NPC.alpha -= num / 16; + if (NPC.alpha < 0) { - npc.alpha = 0; + NPC.alpha = 0; } } - npc.ai[2] += 1f; - if (npc.ai[2] == 0f) + NPC.ai[2] += 1f; + if (NPC.ai[2] == 0f) { - npc.ai[0] = 0f; - npc.ai[2] = 1f; - npc.velocity.X = npc.direction * 2; + NPC.ai[0] = 0f; + NPC.ai[2] = 1f; + NPC.velocity.X = NPC.direction * 2; } return; } - if (npc.ai[2] == 1f) + if (NPC.ai[2] == 1f) { - npc.chaseable = true; - if (npc.direction == 0) + NPC.chaseable = true; + if (NPC.direction == 0) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - if (npc.wet || npc.noTileCollide) + if (NPC.wet || NPC.noTileCollide) { bool flag14 = false; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead) + NPC.TargetClosest(false); + if (Main.player[NPC.target].wet && !Main.player[NPC.target].dead) { flag14 = true; } if (!flag14) { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (!Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; + NPC.netUpdate = true; } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } } if (flag14) { - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (NPC.ai[3] > 0f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.ai[3] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[3] = 0f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[3] == 0f) + else if (NPC.ai[3] == 0f) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } - if (npc.ai[1] >= 150f) + if (NPC.ai[1] >= 150f) { - npc.ai[3] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[3] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } - if (npc.ai[3] == 0f) + if (NPC.ai[3] == 0f) { - npc.alpha = 0; - npc.noTileCollide = false; + NPC.alpha = 0; + NPC.noTileCollide = false; } else { - npc.alpha = 200; - npc.noTileCollide = true; + NPC.alpha = 200; + NPC.noTileCollide = true; } - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.2f; - if (npc.velocity.X > 9f) + NPC.TargetClosest(true); + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.2f; + NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * 0.2f; + if (NPC.velocity.X > 9f) { - npc.velocity.X = 9f; + NPC.velocity.X = 9f; } - if (npc.velocity.X < -9f) + if (NPC.velocity.X < -9f) { - npc.velocity.X = -9f; + NPC.velocity.X = -9f; } - if (npc.velocity.Y > 7f) + if (NPC.velocity.Y > 7f) { - npc.velocity.Y = 7f; + NPC.velocity.Y = 7f; } - if (npc.velocity.Y < -7f) + if (NPC.velocity.Y < -7f) { - npc.velocity.Y = -7f; + NPC.velocity.Y = -7f; } } else { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (!Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -1f || NPC.velocity.X > 1f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num258 = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int num259 = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; if (Main.tile[num258, num259 - 1] == null) { Main.tile[num258, num259 - 1] = new Tile(); @@ -295,43 +295,43 @@ namespace CalamityMod.NPCs.Abyss { if (Main.tile[num258, num259 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num258, num259 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) { - npc.velocity.Y = npc.velocity.Y * 0.95f; + NPC.velocity.Y = NPC.velocity.Y * 0.95f; } } else { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + NPC.velocity.X = NPC.velocity.X * 0.94f; + if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) { - npc.velocity.X = 0f; + NPC.velocity.X = 0f; } } - npc.velocity.Y = npc.velocity.Y + 0.25f; - if (npc.velocity.Y > 7f) + NPC.velocity.Y = NPC.velocity.Y + 0.25f; + if (NPC.velocity.Y > 7f) { - npc.velocity.Y = 7f; + NPC.velocity.Y = 7f; } - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) + NPC.rotation = NPC.velocity.Y * (float)NPC.direction * 0.1f; + if ((double)NPC.rotation < -0.2) { - npc.rotation = -0.2f; + NPC.rotation = -0.2f; } - if ((double)npc.rotation > 0.2) + if ((double)NPC.rotation > 0.2) { - npc.rotation = 0.2f; + NPC.rotation = 0.2f; return; } } @@ -339,32 +339,32 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { - if (!npc.wet && !npc.noTileCollide) + if (!NPC.wet && !NPC.noTileCollide) { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; return; } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/CuttlefishGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/CuttlefishGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/CuttlefishGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/CuttlefishGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/CuttlefishGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/CuttlefishGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -374,11 +374,11 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } @@ -387,22 +387,22 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 2); int inkBombDropRate = Main.expertMode ? 50 : 100; - DropHelper.DropItemChance(npc, ModContent.ItemType(), inkBombDropRate, 1, 1); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), inkBombDropRate, 1, 1); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index 08ef74869f..ca0ab5d496 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -10,6 +10,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Abyss { public class DevilFish : ModNPC @@ -20,157 +21,157 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Devil Fish"); - Main.npcFrameCount[npc.type] = 16; + Main.npcFrameCount[NPC.type] = 16; } public override void SetDefaults() { - npc.noGravity = true; - npc.lavaImmune = true; - npc.Calamity().canBreakPlayerDefense = true; - npc.damage = 90; - npc.width = 126; - npc.height = 66; - npc.defense = 999999; - npc.lifeMax = 400; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.lavaImmune = true; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 90; + NPC.width = 126; + NPC.height = 66; + NPC.defense = 999999; + NPC.lifeMax = 400; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.85f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.85f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(brokenMask); writer.Write(hitCounter); - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { brokenMask = reader.ReadBoolean(); hitCounter = reader.ReadInt32(); - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; float speedBoost = brokenMask ? 1.5f : 1; - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - npc.noGravity = true; - if (npc.direction == 0) + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + NPC.noGravity = true; + if (NPC.direction == 0) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - npc.chaseable = brokenMask; + NPC.chaseable = brokenMask; if (hitCounter >= 5 && !brokenMask) { brokenMask = true; - npc.HitSound = SoundID.NPCHit1; - npc.defense = 15; + NPC.HitSound = SoundID.NPCHit1; + NPC.defense = 15; for(int i = 1; i < 4; i++) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask" + i), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/DevilFishMask" + i), 1f); } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/DevilMaskBreak"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/DevilMaskBreak"), (int)NPC.position.X, (int)NPC.position.Y); } - if (npc.wet) + if (NPC.wet) { bool flag14 = brokenMask; - npc.TargetClosest(false); + NPC.TargetClosest(false); if (player.statLife <= player.statLifeMax2 / 4) { flag14 = true; } - if ((!player.wet || player.dead || !Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) && flag14) + if ((!player.wet || player.dead || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) && flag14) { flag14 = false; } if (!flag14) { - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; + NPC.netUpdate = true; } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } } if (flag14) { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * (CalamityWorld.death ? 0.5f : 0.25f) * speedBoost; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * (CalamityWorld.death ? 0.3f : 0.15f) * speedBoost; + NPC.TargetClosest(true); + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * (CalamityWorld.death ? 0.5f : 0.25f) * speedBoost; + NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * (CalamityWorld.death ? 0.3f : 0.15f) * speedBoost; float velocity = CalamityWorld.death ? 12f : 6f; - if (npc.velocity.X > velocity * speedBoost) + if (NPC.velocity.X > velocity * speedBoost) { - npc.velocity.X = velocity * speedBoost; + NPC.velocity.X = velocity * speedBoost; } - if (npc.velocity.X < -velocity * speedBoost) + if (NPC.velocity.X < -velocity * speedBoost) { - npc.velocity.X = -velocity * speedBoost; + NPC.velocity.X = -velocity * speedBoost; } - if (npc.velocity.Y > velocity * speedBoost) + if (NPC.velocity.Y > velocity * speedBoost) { - npc.velocity.Y = velocity * speedBoost; + NPC.velocity.Y = velocity * speedBoost; } - if (npc.velocity.Y < -velocity * speedBoost) + if (NPC.velocity.Y < -velocity * speedBoost) { - npc.velocity.Y = -velocity * speedBoost; + NPC.velocity.Y = -velocity * speedBoost; } } else { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -2.5f || NPC.velocity.X > 2.5f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num258 = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int num259 = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; if (Main.tile[num258, num259 - 1] == null) { Main.tile[num258, num259 - 1] = new Tile(); @@ -187,43 +188,43 @@ namespace CalamityMod.NPCs.Abyss { if (Main.tile[num258, num259 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num258, num259 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) { - npc.velocity.Y = npc.velocity.Y * 0.95f; + NPC.velocity.Y = NPC.velocity.Y * 0.95f; } } else { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + NPC.velocity.X = NPC.velocity.X * 0.94f; + if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) { - npc.velocity.X = 0f; + NPC.velocity.X = 0f; } } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 10f) + NPC.velocity.Y = NPC.velocity.Y + 0.3f; + if (NPC.velocity.Y > 10f) { - npc.velocity.Y = 10f; + NPC.velocity.Y = 10f; } - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) + NPC.rotation = NPC.velocity.Y * (float)NPC.direction * 0.1f; + if ((double)NPC.rotation < -0.2) { - npc.rotation = -0.2f; + NPC.rotation = -0.2f; } - if ((double)npc.rotation > 0.2) + if ((double)NPC.rotation > 0.2) { - npc.rotation = 0.2f; + NPC.rotation = 0.2f; } } @@ -238,29 +239,29 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { - if (!npc.wet) + if (!NPC.wet) { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; return; } - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 6.0) { - npc.frameCounter = 0.0; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y += frameHeight; } if (!brokenMask) { - if (npc.frame.Y > frameHeight * 7) + if (NPC.frame.Y > frameHeight * 7) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } else { - if (npc.frame.Y < frameHeight * 8 || npc.frame.Y > frameHeight * 15) + if (NPC.frame.Y < frameHeight * 8 || NPC.frame.Y > frameHeight * 15) { - npc.frame.Y = frameHeight * 8; + NPC.frame.Y = frameHeight * 8; } } } @@ -268,18 +269,18 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/DevilFishGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/DevilFishGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/DevilFishGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -289,11 +290,11 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.225f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } @@ -302,24 +303,24 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); int minCells = Main.expertMode ? 2 : 1; int maxCells = Main.expertMode ? 3 : 2; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedGolemBoss, 1f, 3, 9); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), NPC.downedGolemBoss, 1f, 3, 9); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index 59a44daf01..4171116be3 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -10,6 +10,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Abyss { public class DevilFishAlt : ModNPC @@ -20,157 +21,157 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Devil Fish"); - Main.npcFrameCount[npc.type] = 16; + Main.npcFrameCount[NPC.type] = 16; } public override void SetDefaults() { - npc.noGravity = true; - npc.lavaImmune = true; - npc.Calamity().canBreakPlayerDefense = true; - npc.damage = 90; - npc.width = 126; - npc.height = 66; - npc.defense = 999999; - npc.lifeMax = 400; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.lavaImmune = true; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 90; + NPC.width = 126; + NPC.height = 66; + NPC.defense = 999999; + NPC.lifeMax = 400; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.85f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.85f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(brokenMask); writer.Write(hitCounter); - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { brokenMask = reader.ReadBoolean(); hitCounter = reader.ReadInt32(); - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; float speedBoost = brokenMask ? 1.5f : 1; - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - npc.noGravity = true; - if (npc.direction == 0) + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + NPC.noGravity = true; + if (NPC.direction == 0) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - npc.chaseable = brokenMask; + NPC.chaseable = brokenMask; if (hitCounter >= 5 && !brokenMask) { brokenMask = true; - npc.HitSound = SoundID.NPCHit1; - npc.defense = 15; + NPC.HitSound = SoundID.NPCHit1; + NPC.defense = 15; for (int i = 1; i < 4; i++) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask" + i + (i == 3 ? "Alt" : "")), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/DevilFishMask" + i + (i == 3 ? "Alt" : "")), 1f); } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/DevilMaskBreak"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/DevilMaskBreak"), (int)NPC.position.X, (int)NPC.position.Y); } - if (npc.wet) + if (NPC.wet) { bool flag14 = brokenMask; - npc.TargetClosest(false); + NPC.TargetClosest(false); if (player.statLife <= player.statLifeMax2 / 4) { flag14 = true; } - if ((!player.wet || player.dead || !Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) && flag14) + if ((!player.wet || player.dead || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) && flag14) { flag14 = false; } if (!flag14) { - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; + NPC.netUpdate = true; } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } } if (flag14) { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * (CalamityWorld.death ? 0.5f : 0.25f) * speedBoost; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * (CalamityWorld.death ? 0.3f : 0.15f) * speedBoost; + NPC.TargetClosest(true); + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * (CalamityWorld.death ? 0.5f : 0.25f) * speedBoost; + NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * (CalamityWorld.death ? 0.3f : 0.15f) * speedBoost; float velocity = CalamityWorld.death ? 12f : 6f; - if (npc.velocity.X > velocity * speedBoost) + if (NPC.velocity.X > velocity * speedBoost) { - npc.velocity.X = velocity * speedBoost; + NPC.velocity.X = velocity * speedBoost; } - if (npc.velocity.X < -velocity * speedBoost) + if (NPC.velocity.X < -velocity * speedBoost) { - npc.velocity.X = -velocity * speedBoost; + NPC.velocity.X = -velocity * speedBoost; } - if (npc.velocity.Y > velocity * speedBoost) + if (NPC.velocity.Y > velocity * speedBoost) { - npc.velocity.Y = velocity * speedBoost; + NPC.velocity.Y = velocity * speedBoost; } - if (npc.velocity.Y < -velocity * speedBoost) + if (NPC.velocity.Y < -velocity * speedBoost) { - npc.velocity.Y = -velocity * speedBoost; + NPC.velocity.Y = -velocity * speedBoost; } } else { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -2.5f || NPC.velocity.X > 2.5f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num258 = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int num259 = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; if (Main.tile[num258, num259 - 1] == null) { Main.tile[num258, num259 - 1] = new Tile(); @@ -187,43 +188,43 @@ namespace CalamityMod.NPCs.Abyss { if (Main.tile[num258, num259 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num258, num259 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) { - npc.velocity.Y = npc.velocity.Y * 0.95f; + NPC.velocity.Y = NPC.velocity.Y * 0.95f; } } else { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + NPC.velocity.X = NPC.velocity.X * 0.94f; + if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) { - npc.velocity.X = 0f; + NPC.velocity.X = 0f; } } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 10f) + NPC.velocity.Y = NPC.velocity.Y + 0.3f; + if (NPC.velocity.Y > 10f) { - npc.velocity.Y = 10f; + NPC.velocity.Y = 10f; } - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) + NPC.rotation = NPC.velocity.Y * (float)NPC.direction * 0.1f; + if ((double)NPC.rotation < -0.2) { - npc.rotation = -0.2f; + NPC.rotation = -0.2f; } - if ((double)npc.rotation > 0.2) + if ((double)NPC.rotation > 0.2) { - npc.rotation = 0.2f; + NPC.rotation = 0.2f; } } @@ -238,29 +239,29 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { - if (!npc.wet) + if (!NPC.wet) { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; return; } - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 6.0) { - npc.frameCounter = 0.0; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y += frameHeight; } if (!brokenMask) { - if (npc.frame.Y > frameHeight * 7) + if (NPC.frame.Y > frameHeight * 7) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } else { - if (npc.frame.Y < frameHeight * 8 || npc.frame.Y > frameHeight * 15) + if (NPC.frame.Y < frameHeight * 8 || NPC.frame.Y > frameHeight * 15) { - npc.frame.Y = frameHeight * 8; + NPC.frame.Y = frameHeight * 8; } } } @@ -268,18 +269,18 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/DevilFishGlowAlt").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/DevilFishGlowAlt").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/DevilFishGlowAlt"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlowAlt").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlowAlt").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlowAlt"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -289,11 +290,11 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.225f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } @@ -302,24 +303,24 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); int minCells = Main.expertMode ? 2 : 1; int maxCells = Main.expertMode ? 3 : 2; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedGolemBoss, 1f, 3, 9); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), NPC.downedGolemBoss, 1f, 3, 9); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/Abyss/EidolonWyrmBody.cs b/NPCs/Abyss/EidolonWyrmBody.cs index 864dd7e138..5d73837535 100644 --- a/NPCs/Abyss/EidolonWyrmBody.cs +++ b/NPCs/Abyss/EidolonWyrmBody.cs @@ -15,24 +15,24 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 100; //70 - npc.width = 48; //36 - npc.height = 58; - npc.defense = 0; - npc.lifeMax = 160000; - npc.aiStyle = -1; //new + NPC.damage = 100; //70 + NPC.width = 48; //36 + NPC.height = 58; + NPC.defense = 0; + NPC.lifeMax = 160000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.dontCountMe = true; - npc.dontTakeDamage = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath6; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.dontTakeDamage = true; + NPC.chaseable = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -42,10 +42,10 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - npc.damage = 0; + NPC.damage = 0; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -59,29 +59,29 @@ namespace CalamityMod.NPCs.Abyss } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -89,48 +89,48 @@ namespace CalamityMod.NPCs.Abyss num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override bool CheckActive() @@ -145,13 +145,13 @@ namespace CalamityMod.NPCs.Abyss public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/Wyrm2"), 1f); + Gore.NewGore(NPC.Center, NPC.velocity, Mod.GetGoreSlot("Gores/Wyrm2"), 1f); } } } diff --git a/NPCs/Abyss/EidolonWyrmBodyAlt.cs b/NPCs/Abyss/EidolonWyrmBodyAlt.cs index 6d4f228fec..e65cb9b81b 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAlt.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAlt.cs @@ -15,24 +15,24 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 100; //70 - npc.width = 48; //36 - npc.height = 58; - npc.defense = 0; - npc.lifeMax = 160000; - npc.aiStyle = -1; //new + NPC.damage = 100; //70 + NPC.width = 48; //36 + NPC.height = 58; + NPC.defense = 0; + NPC.lifeMax = 160000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.dontCountMe = true; - npc.dontTakeDamage = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath6; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.dontTakeDamage = true; + NPC.chaseable = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -42,10 +42,10 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - npc.damage = 0; + NPC.damage = 0; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -59,29 +59,29 @@ namespace CalamityMod.NPCs.Abyss } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -89,48 +89,48 @@ namespace CalamityMod.NPCs.Abyss num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override bool CheckActive() @@ -145,13 +145,13 @@ namespace CalamityMod.NPCs.Abyss public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/Wyrm3"), 1f); + Gore.NewGore(NPC.Center, NPC.velocity, Mod.GetGoreSlot("Gores/Wyrm3"), 1f); } } } diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index 4b4df09588..488e5c8381 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -12,6 +12,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Abyss { @@ -32,45 +33,45 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 8f; - npc.damage = 170; - npc.width = 126; //36 - npc.height = 76; //20 - npc.defense = 70; - npc.DR_NERD(0.15f); - npc.lifeMax = 160000; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 8f; + NPC.damage = 170; + NPC.width = 126; //36 + NPC.height = 76; //20 + NPC.defense = 70; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 160000; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.rarity = 2; - banner = npc.type; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 25, 0, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath6; + NPC.netAlways = true; + NPC.rarity = 2; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { writer.WriteVector2(patrolSpot); writer.Write(detectsPlayer); - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { patrolSpot = reader.ReadVector2(); detectsPlayer = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() @@ -81,44 +82,44 @@ namespace CalamityMod.NPCs.Abyss if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) adultWyrmAlive = true; } - if (npc.justHit || detectsPlayer || Main.player[npc.target].chaosState || adultWyrmAlive) + if (NPC.justHit || detectsPlayer || Main.player[NPC.target].chaosState || adultWyrmAlive) { detectsPlayer = true; - npc.damage = Main.expertMode ? 340 : 170; + NPC.damage = Main.expertMode ? 340 : 170; } else { - npc.damage = 0; + NPC.damage = 0; } - npc.chaseable = detectsPlayer; + NPC.chaseable = detectsPlayer; if (detectsPlayer) { - if (npc.soundDelay <= 0) + if (NPC.soundDelay <= 0) { - npc.soundDelay = 420; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)npc.position.X, (int)npc.position.Y); + NPC.soundDelay = 420; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)NPC.position.X, (int)NPC.position.Y); } } else { if (Main.rand.NextBool(900)) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)NPC.position.X, (int)NPC.position.Y); } } - if (npc.ai[2] > 0f) + if (NPC.ai[2] > 0f) { - npc.realLife = (int)npc.ai[2]; + NPC.realLife = (int)NPC.ai[2]; } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!TailSpawned && npc.ai[0] == 0f) + if (!TailSpawned && NPC.ai[0] == 0f) { - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { int lol; @@ -126,19 +127,19 @@ namespace CalamityMod.NPCs.Abyss { if (num36 % 2 == 0) { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } else { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } } else { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = (float)NPC.whoAmI; Main.npc[lol].ai[1] = (float)Previous; Main.npc[Previous].ai[0] = (float)lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); @@ -148,15 +149,15 @@ namespace CalamityMod.NPCs.Abyss } if (detectsPlayer) { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 300f) + NPC.localAI[0] += 1f; + if (NPC.localAI[0] >= 300f) { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; + NPC.localAI[0] = 0f; + NPC.TargetClosest(true); + NPC.netUpdate = true; int damage = adultWyrmAlive ? (Main.expertMode ? 150 : 200) : (Main.expertMode ? 60 : 80); - float xPos = Main.rand.NextBool(2) ? npc.position.X + 200f : npc.position.X - 200f; - Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-200, 201)); + float xPos = Main.rand.NextBool(2) ? NPC.position.X + 200f : NPC.position.X - 200f; + Vector2 vector2 = new Vector2(xPos, NPC.position.Y + Main.rand.Next(-200, 201)); int randomAmt = adultWyrmAlive ? 2 : 3; int random = Main.rand.Next(randomAmt); if (random == 0) @@ -165,19 +166,19 @@ namespace CalamityMod.NPCs.Abyss } else if (random == 1) { - Vector2 vec = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitX * npc.direction); + Vector2 vec = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitX * NPC.direction); Vector2 vector4 = vec * (adultWyrmAlive ? 6f : 4f); Projectile.NewProjectile(vector2, vector4, ProjectileID.CultistBossIceMist, damage, 0f, Main.myPlayer, 0f, 1f); } else { - if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f || Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) + if (Math.Abs(Main.player[NPC.target].velocity.X) > 0.1f || Math.Abs(Main.player[NPC.target].velocity.Y) > 0.1f) { - Main.PlaySound(SoundID.Item117, Main.player[npc.target].position); + SoundEngine.PlaySound(SoundID.Item117, Main.player[NPC.target].position); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Main.player[NPC.target].position.X, Main.player[NPC.target].position.Y), + Main.player[NPC.target].width, Main.player[NPC.target].height, 185, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 0.6f; if (Main.rand.NextBool(2)) { @@ -187,77 +188,77 @@ namespace CalamityMod.NPCs.Abyss } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Main.player[NPC.target].position.X, Main.player[NPC.target].position.Y), + Main.player[NPC.target].width, Main.player[NPC.target].height, 185, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Main.player[NPC.target].position.X, Main.player[NPC.target].position.Y), + Main.player[NPC.target].width, Main.player[NPC.target].height, 185, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 0.2f; } - if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f) + if (Math.Abs(Main.player[NPC.target].velocity.X) > 0.1f) { - Main.player[npc.target].velocity.X = -Main.player[npc.target].velocity.X * 1.5f; + Main.player[NPC.target].velocity.X = -Main.player[NPC.target].velocity.X * 1.5f; } - if (Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) + if (Math.Abs(Main.player[NPC.target].velocity.Y) > 0.1f) { - Main.player[npc.target].velocity.Y = -Main.player[npc.target].velocity.Y * 1.5f; + Main.player[NPC.target].velocity.Y = -Main.player[NPC.target].velocity.Y * 1.5f; } } } } } } - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } - else if (npc.velocity.X > 0f) + else if (NPC.velocity.X > 0f) { - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } - if (Main.player[npc.target].dead) + if (Main.player[NPC.target].dead) { - npc.TargetClosest(false); + NPC.TargetClosest(false); - npc.velocity.Y += 3f; - if (npc.position.Y > Main.worldSurface * 16.0) - npc.velocity.Y += 3f; + NPC.velocity.Y += 3f; + if (NPC.position.Y > Main.worldSurface * 16.0) + NPC.velocity.Y += 3f; - if (npc.position.Y > (Main.maxTilesY - 200) * 16.0) + if (NPC.position.Y > (Main.maxTilesY - 200) * 16.0) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) Main.npc[a].active = false; } } } - npc.alpha -= 42; - if (npc.alpha < 0) + NPC.alpha -= 42; + if (NPC.alpha < 0) { - npc.alpha = 0; + NPC.alpha = 0; } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f) + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 6400f) { - npc.active = false; + NPC.active = false; } float num188 = speed; float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); if (patrolSpot == Vector2.Zero) - patrolSpot = Main.player[npc.target].Center; + patrolSpot = Main.player[NPC.target].Center; - float num191 = detectsPlayer ? Main.player[npc.target].Center.X : patrolSpot.X; - float num192 = detectsPlayer ? Main.player[npc.target].Center.Y : patrolSpot.Y; + float num191 = detectsPlayer ? Main.player[NPC.target].Center.X : patrolSpot.X; + float num192 = detectsPlayer ? Main.player[NPC.target].Center.Y : patrolSpot.Y; if (!detectsPlayer) { num192 += 800; - if (Math.Abs(npc.Center.X - num191) < 400f) //500 + if (Math.Abs(NPC.Center.X - num191) < 400f) //500 { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { num191 += 500f; } @@ -271,14 +272,14 @@ namespace CalamityMod.NPCs.Abyss { num188 = 7.5f; num189 = 0.125f; - if (!Main.player[npc.target].wet) + if (!Main.player[NPC.target].wet) { num188 = 15f; num189 = 0.25f; } if (adultWyrmAlive) { - if (!Main.player[npc.target].Calamity().ZoneAbyssLayer4) + if (!Main.player[NPC.target].Calamity().ZoneAbyssLayer4) { num188 = 22.5f; num189 = 0.375f; @@ -287,18 +288,18 @@ namespace CalamityMod.NPCs.Abyss } float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); + float num50 = NPC.velocity.Length(); if (num50 > 0f) { if (num50 > num48) { - npc.velocity.Normalize(); - npc.velocity *= num48; + NPC.velocity.Normalize(); + NPC.velocity *= num48; } else if (num50 < num49) { - npc.velocity.Normalize(); - npc.velocity *= num49; + NPC.velocity.Normalize(); + NPC.velocity *= num49; } } num191 = (float)((int)(num191 / 16f) * 16); @@ -313,50 +314,50 @@ namespace CalamityMod.NPCs.Abyss float num198 = num188 / num193; num191 *= num198; num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - if (npc.velocity.X > num191) + if (NPC.velocity.X > num191) { - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - if (npc.velocity.Y > num192) + if (NPC.velocity.Y > num192) { - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num189 * 2f; } else { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 2f; } } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X + num189 * 2f; //changed from 2 } else { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X - num189 * 2f; //changed from 2 } } } @@ -364,50 +365,50 @@ namespace CalamityMod.NPCs.Abyss { if (num196 > num197) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X + num189 * 1.1f; //changed from 1.1 } - else if (npc.velocity.X > num191) + else if (NPC.velocity.X > num191) { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X - num189 * 1.1f; //changed from 1.1 } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)num188 * 0.5) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } } else { - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + num189 * 1.1f; } - else if (npc.velocity.Y > num192) + else if (NPC.velocity.Y > num192) { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 1.1f; } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)num188 * 0.5) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } } } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -424,10 +425,10 @@ namespace CalamityMod.NPCs.Abyss Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -452,28 +453,28 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType()) && + if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType())) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } @@ -494,35 +495,35 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 30, 40); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 10, 1, 1); + DropHelper.DropItem(NPC, ModContent.ItemType(), 30, 40); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast, 10, 1, 1); int minLumenyl = Main.expertMode ? 8 : 6; int maxLumenyl = Main.expertMode ? 11 : 8; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1f, minLumenyl, maxLumenyl); - DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 8, 12); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1f, minLumenyl, maxLumenyl); + DropHelper.DropItemCondition(NPC, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 8, 12); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Wyrm"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Wyrm"), 1f); } } public override bool CheckActive() { - if (detectsPlayer && !Main.player[npc.target].dead) + if (detectsPlayer && !Main.player[NPC.target].dead) { return false; } diff --git a/NPCs/Abyss/EidolonWyrmTail.cs b/NPCs/Abyss/EidolonWyrmTail.cs index 90f7774c04..a6c22c578d 100644 --- a/NPCs/Abyss/EidolonWyrmTail.cs +++ b/NPCs/Abyss/EidolonWyrmTail.cs @@ -15,24 +15,24 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 100; //70 - npc.width = 46; //28 - npc.height = 66; //28 - npc.defense = 0; - npc.lifeMax = 160000; - npc.aiStyle = -1; //new + NPC.damage = 100; //70 + NPC.width = 46; //28 + NPC.height = 66; //28 + NPC.defense = 0; + NPC.lifeMax = 160000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.dontCountMe = true; - npc.dontTakeDamage = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath6; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.dontTakeDamage = true; + NPC.chaseable = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -42,10 +42,10 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - npc.damage = 0; + NPC.damage = 0; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -59,29 +59,29 @@ namespace CalamityMod.NPCs.Abyss } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -89,48 +89,48 @@ namespace CalamityMod.NPCs.Abyss num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override bool CheckActive() @@ -145,13 +145,13 @@ namespace CalamityMod.NPCs.Abyss public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/Wyrm4"), 1f); + Gore.NewGore(NPC.Center, NPC.velocity, Mod.GetGoreSlot("Gores/Wyrm4"), 1f); } } } diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index 22078eb740..14c83e4124 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -20,146 +20,146 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Giant Squid"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.noGravity = true; - npc.damage = 100; - npc.width = 50; - npc.height = 220; - npc.defense = 18; - npc.lifeMax = 800; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.damage = 100; + NPC.width = 50; + NPC.height = 220; + NPC.defense = 18; + NPC.lifeMax = 800; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 15, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 15, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(hasBeenHit); - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - if (npc.direction == 0) + if (NPC.direction == 0) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - if (!npc.wet) + if (!NPC.wet) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.98f; - if (npc.velocity.X > -0.01 && npc.velocity.X < 0.01) + NPC.velocity.X = NPC.velocity.X * 0.98f; + if (NPC.velocity.X > -0.01 && NPC.velocity.X < 0.01) { - npc.velocity.X = 0f; + NPC.velocity.X = 0f; } } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 10f) + NPC.velocity.Y = NPC.velocity.Y + 0.2f; + if (NPC.velocity.Y > 10f) { - npc.velocity.Y = 10f; + NPC.velocity.Y = 10f; } - npc.ai[0] = 1f; + NPC.ai[0] = 1f; return; } - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; } - if (npc.collideY) + if (NPC.collideY) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } - npc.TargetClosest(false); - if ((Main.player[npc.target].wet && !Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + NPC.TargetClosest(false); + if ((Main.player[NPC.target].wet && !Main.player[NPC.target].dead && + Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 300f : 500f) * //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) || - (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(500f, 300f)) || - npc.justHit) + (Main.player[NPC.target].Center - NPC.Center).Length() < Main.player[NPC.target].Calamity().GetAbyssAggro(500f, 300f)) || + NPC.justHit) { hasBeenHit = true; } - npc.chaseable = hasBeenHit; - npc.rotation = npc.velocity.X * 0.02f; + NPC.chaseable = hasBeenHit; + NPC.rotation = NPC.velocity.X * 0.02f; if (hasBeenHit) { - npc.localAI[2] = 1f; - npc.velocity *= 0.975f; + NPC.localAI[2] = 1f; + NPC.velocity *= 0.975f; float num263 = 1.6f; - if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) + if (NPC.velocity.X > -num263 && NPC.velocity.X < num263 && NPC.velocity.Y > -num263 && NPC.velocity.Y < num263) { - npc.TargetClosest(true); + NPC.TargetClosest(true); float num264 = CalamityWorld.death ? 24f : 16f; - Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; - float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; + Vector2 vector31 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num265 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - vector31.X; + float num266 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - vector31.Y; float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); num267 = num264 / num267; num265 *= num267; num266 *= num267; - npc.velocity.X = num265; - npc.velocity.Y = num266; + NPC.velocity.X = num265; + NPC.velocity.Y = num266; return; } } else { - npc.localAI[2] = 0f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) + NPC.localAI[2] = 0f; + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.02f; + if (NPC.velocity.X < -1f || NPC.velocity.X > 1f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if (npc.velocity.Y < -1f) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if (NPC.velocity.Y < -1f) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if (npc.velocity.Y > 1f) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if (NPC.velocity.Y > 1f) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num268 = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int num269 = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; if (Main.tile[num268, num269 - 1] == null) { Main.tile[num268, num269 - 1] = new Tile(); @@ -176,20 +176,20 @@ namespace CalamityMod.NPCs.Abyss { if (Main.tile[num268, num269 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num268, num269 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } else { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) + if ((double)NPC.velocity.Y > 1.2 || (double)NPC.velocity.Y < -1.2) { - npc.velocity.Y = npc.velocity.Y * 0.99f; + NPC.velocity.Y = NPC.velocity.Y * 0.99f; } } } @@ -205,36 +205,36 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { - npc.frameCounter += hasBeenHit ? 0.15f : 0.075f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += hasBeenHit ? 0.15f : 0.075f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/GiantSquidGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/GiantSquidGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Cyan); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/GiantSquidGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GiantSquidGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GiantSquidGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Cyan); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GiantSquidGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } @@ -249,30 +249,30 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); int minCells = Main.expertMode ? 3 : 2; int maxCells = Main.expertMode ? 6 : 4; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); int inkBombDropRate = Main.expertMode ? 25 : 40; - DropHelper.DropItemChance(npc, ModContent.ItemType(), inkBombDropRate, 1, 1); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), inkBombDropRate, 1, 1); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 30; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/GiantSquid"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/GiantSquid2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/GiantSquid3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/GiantSquid4"), 1f); } } } diff --git a/NPCs/Abyss/GulperEelBody.cs b/NPCs/Abyss/GulperEelBody.cs index 4c105a2983..15ace4c231 100644 --- a/NPCs/Abyss/GulperEelBody.cs +++ b/NPCs/Abyss/GulperEelBody.cs @@ -17,29 +17,29 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 90; //70 - npc.width = 56; //36 - npc.height = 36; - npc.defense = 30; - npc.lifeMax = 60000; - npc.aiStyle = -1; //new + NPC.damage = 90; //70 + NPC.width = 56; //36 + NPC.height = 36; + NPC.defense = 30; + NPC.lifeMax = 60000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit9; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit9; + NPC.DeathSound = SoundID.NPCDeath13; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -49,8 +49,8 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -64,29 +64,29 @@ namespace CalamityMod.NPCs.Abyss } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -94,48 +94,48 @@ namespace CalamityMod.NPCs.Abyss num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/GulperEelBodyGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override bool CheckActive() @@ -152,16 +152,16 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/GulperEel2"), 1f); - Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/GulperEel3"), 1f); + Gore.NewGore(NPC.Center, NPC.velocity, Mod.GetGoreSlot("Gores/GulperEel2"), 1f); + Gore.NewGore(NPC.Center, NPC.velocity, Mod.GetGoreSlot("Gores/GulperEel3"), 1f); } } diff --git a/NPCs/Abyss/GulperEelBodyAlt.cs b/NPCs/Abyss/GulperEelBodyAlt.cs index e1871a5917..e2a993dc72 100644 --- a/NPCs/Abyss/GulperEelBodyAlt.cs +++ b/NPCs/Abyss/GulperEelBodyAlt.cs @@ -17,29 +17,29 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 90; //70 - npc.width = 36; //36 - npc.height = 36; - npc.defense = 30; - npc.lifeMax = 60000; - npc.aiStyle = -1; //new + NPC.damage = 90; //70 + NPC.width = 36; //36 + NPC.height = 36; + NPC.defense = 30; + NPC.lifeMax = 60000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit9; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit9; + NPC.DeathSound = SoundID.NPCDeath13; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -49,8 +49,8 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -64,29 +64,29 @@ namespace CalamityMod.NPCs.Abyss } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -94,48 +94,48 @@ namespace CalamityMod.NPCs.Abyss num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyAltGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override bool CheckActive() @@ -152,16 +152,16 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/GulperEel2"), 1f); - Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/GulperEel3"), 1f); + Gore.NewGore(NPC.Center, NPC.velocity, Mod.GetGoreSlot("Gores/GulperEel2"), 1f); + Gore.NewGore(NPC.Center, NPC.velocity, Mod.GetGoreSlot("Gores/GulperEel3"), 1f); } } diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index 5065c136a3..28b0dbf6d3 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -29,42 +29,42 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.damage = 135; - npc.width = 66; //36 - npc.height = 86; //20 - npc.defense = 10; - npc.lifeMax = 48000; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 135; + NPC.width = 66; //36 + NPC.height = 86; //20 + NPC.defense = 10; + NPC.lifeMax = 48000; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 50, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit9; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - banner = npc.type; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 50, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit9; + NPC.DeathSound = SoundID.NPCDeath13; + NPC.netAlways = true; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { writer.WriteVector2(patrolSpot); writer.Write(detectsPlayer); - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { patrolSpot = reader.ReadVector2(); detectsPlayer = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() @@ -72,25 +72,25 @@ namespace CalamityMod.NPCs.Abyss //if ((Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 100f : 600f) * // (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f) || - if ((Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(600f, 100f) || - npc.justHit) + if ((Main.player[NPC.target].Center - NPC.Center).Length() < Main.player[NPC.target].Calamity().GetAbyssAggro(600f, 100f) || + NPC.justHit) { detectsPlayer = true; } - npc.chaseable = detectsPlayer; - if (npc.ai[2] > 0f) + NPC.chaseable = detectsPlayer; + if (NPC.ai[2] > 0f) { - npc.realLife = (int)npc.ai[2]; + NPC.realLife = (int)NPC.ai[2]; } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!TailSpawned && npc.ai[0] == 0f) + if (!TailSpawned && NPC.ai[0] == 0f) { - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { int lol; @@ -98,19 +98,19 @@ namespace CalamityMod.NPCs.Abyss { if (num36 == 0) { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } else { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } } else { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = (float)NPC.whoAmI; Main.npc[lol].ai[1] = (float)Previous; Main.npc[Previous].ai[0] = (float)lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); @@ -119,44 +119,44 @@ namespace CalamityMod.NPCs.Abyss TailSpawned = true; } } - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } - else if (npc.velocity.X > 0f) + else if (NPC.velocity.X > 0f) { - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } - if (Main.player[npc.target].dead) + if (Main.player[NPC.target].dead) { - npc.TargetClosest(false); + NPC.TargetClosest(false); } - npc.alpha -= 42; - if (npc.alpha < 0) + NPC.alpha -= 42; + if (NPC.alpha < 0) { - npc.alpha = 0; + NPC.alpha = 0; } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f) + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) { - npc.active = false; + NPC.active = false; } float num188 = speed; float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); if (patrolSpot == Vector2.Zero) - patrolSpot = Main.player[npc.target].Center; + patrolSpot = Main.player[NPC.target].Center; - float num191 = detectsPlayer ? Main.player[npc.target].Center.X : patrolSpot.X; - float num192 = detectsPlayer ? Main.player[npc.target].Center.Y : patrolSpot.Y; + float num191 = detectsPlayer ? Main.player[NPC.target].Center.X : patrolSpot.X; + float num192 = detectsPlayer ? Main.player[NPC.target].Center.Y : patrolSpot.Y; if (!detectsPlayer) { num192 += 500; - if (Math.Abs(npc.Center.X - num191) < 300f) //500 + if (Math.Abs(NPC.Center.X - num191) < 300f) //500 { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { num191 += 400f; } @@ -173,18 +173,18 @@ namespace CalamityMod.NPCs.Abyss } float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); + float num50 = NPC.velocity.Length(); if (num50 > 0f) { if (num50 > num48) { - npc.velocity.Normalize(); - npc.velocity *= num48; + NPC.velocity.Normalize(); + NPC.velocity *= num48; } else if (num50 < num49) { - npc.velocity.Normalize(); - npc.velocity *= num49; + NPC.velocity.Normalize(); + NPC.velocity *= num49; } } num191 = (float)((int)(num191 / 16f) * 16); @@ -199,50 +199,50 @@ namespace CalamityMod.NPCs.Abyss float num198 = num188 / num193; num191 *= num198; num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - if (npc.velocity.X > num191) + if (NPC.velocity.X > num191) { - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - if (npc.velocity.Y > num192) + if (NPC.velocity.Y > num192) { - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num189 * 2f; } else { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 2f; } } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X + num189 * 2f; //changed from 2 } else { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X - num189 * 2f; //changed from 2 } } } @@ -250,50 +250,50 @@ namespace CalamityMod.NPCs.Abyss { if (num196 > num197) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X + num189 * 1.1f; //changed from 1.1 } - else if (npc.velocity.X > num191) + else if (NPC.velocity.X > num191) { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X - num189 * 1.1f; //changed from 1.1 } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)num188 * 0.5) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } } else { - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + num189 * 1.1f; } - else if (npc.velocity.Y > num192) + else if (NPC.velocity.Y > num192) { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 1.1f; } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)num188 * 0.5) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } } } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; } public override bool? CanBeHitByProjectile(Projectile projectile) @@ -308,27 +308,27 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/GulperEelHeadGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/GulperEelHeadGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/GulperEelHeadGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelHeadGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelHeadGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelHeadGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } @@ -339,25 +339,25 @@ namespace CalamityMod.NPCs.Abyss { int minLumenyl = Main.expertMode ? 3 : 2; int maxLumenyl = Main.expertMode ? 4 : 3; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minLumenyl, maxLumenyl); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minLumenyl, maxLumenyl); int minCells = Main.expertMode ? 8 : 6; int maxCells = Main.expertMode ? 11 : 8; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/GulperEel"), 1f); } } diff --git a/NPCs/Abyss/GulperEelTail.cs b/NPCs/Abyss/GulperEelTail.cs index 4f79d40c22..d9e084f8ad 100644 --- a/NPCs/Abyss/GulperEelTail.cs +++ b/NPCs/Abyss/GulperEelTail.cs @@ -17,29 +17,29 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 65; //70 - npc.width = 54; //28 - npc.height = 76; //28 - npc.defense = 50; - npc.lifeMax = 60000; - npc.aiStyle = -1; //new + NPC.damage = 65; //70 + NPC.width = 54; //28 + NPC.height = 76; //28 + NPC.defense = 50; + NPC.lifeMax = 60000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit9; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit9; + NPC.DeathSound = SoundID.NPCDeath13; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -49,8 +49,8 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -64,29 +64,29 @@ namespace CalamityMod.NPCs.Abyss } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -94,48 +94,48 @@ namespace CalamityMod.NPCs.Abyss num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/GulperEelTailGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/GulperEelTailGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/GulperEelTailGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelTailGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelTailGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelTailGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override bool CheckActive() @@ -152,15 +152,15 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/GulperEel4"), 1f); + Gore.NewGore(NPC.Center, NPC.velocity, Mod.GetGoreSlot("Gores/GulperEel4"), 1f); } } diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index 1e5e82ac8b..effe307f6e 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -15,96 +15,96 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Laserfish"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.noGravity = true; - npc.damage = 40; - npc.width = 60; - npc.height = 26; - npc.defense = 15; - npc.lifeMax = 480; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.damage = 40; + NPC.width = 60; + NPC.height = 26; + NPC.defense = 15; + NPC.lifeMax = 480; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit51; - npc.DeathSound = SoundID.NPCDeath26; - npc.knockBackResist = 0.65f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.HitSound = SoundID.NPCHit51; + NPC.DeathSound = SoundID.NPCDeath26; + NPC.knockBackResist = 0.65f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.chaseable = false; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - npc.damage = 0; + NPC.damage = 0; - CalamityAI.PassiveSwimmingAI(npc, mod, 0, Main.player[npc.target].Calamity().GetAbyssAggro(400f, 200f), 0.15f, 0.15f, 4f, 4f, 0.1f); + CalamityAI.PassiveSwimmingAI(NPC, Mod, 0, Main.player[NPC.target].Calamity().GetAbyssAggro(400f, 200f), 0.15f, 0.15f, 4f, 4f, 0.1f); } public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { - return npc.chaseable; + return NPC.chaseable; } return null; } public override void FindFrame(int frameHeight) { - if (!npc.wet) + if (!NPC.wet) { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; return; } - npc.frameCounter += npc.chaseable ? 0.15f : 0.075f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += NPC.chaseable ? 0.15f : 0.075f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/LaserfishGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/LaserfishGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Yellow); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/LaserfishGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/LaserfishGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/LaserfishGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Yellow); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/LaserfishGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } @@ -113,24 +113,24 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Laserfish"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Laserfish2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Laserfish3"), 1f); } } } diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index bf70eacf06..c6aaecb770 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -11,6 +11,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Abyss { @@ -22,67 +23,67 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Luminous Corvina"); - Main.npcFrameCount[npc.type] = 8; + Main.npcFrameCount[NPC.type] = 8; } public override void SetDefaults() { - npc.noGravity = true; - npc.damage = 10; - npc.width = 74; - npc.height = 56; - npc.defense = 12; - npc.lifeMax = 800; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.damage = 10; + NPC.width = 74; + NPC.height = 56; + NPC.defense = 12; + NPC.lifeMax = 800; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 15, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.85f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 15, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.85f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(hasBeenHit); writer.Write(screamTimer); - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { hasBeenHit = reader.ReadBoolean(); screamTimer = reader.ReadInt32(); - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - npc.noGravity = true; - if (npc.direction == 0) + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + NPC.noGravity = true; + if (NPC.direction == 0) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - if (npc.justHit) + if (NPC.justHit) { hasBeenHit = true; } - npc.chaseable = hasBeenHit; - if (npc.wet) + NPC.chaseable = hasBeenHit; + if (NPC.wet) { bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if ((Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height) && ((npc.Center.X - 15f < Main.player[npc.target].Center.X && - npc.direction == 1) || (npc.Center.X + 15f > Main.player[npc.target].Center.X && npc.direction == -1))) || - (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height) && flag14)) + NPC.TargetClosest(false); + if ((Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, + Main.player[NPC.target].width, Main.player[NPC.target].height) && ((NPC.Center.X - 15f < Main.player[NPC.target].Center.X && + NPC.direction == 1) || (NPC.Center.X + 15f > Main.player[NPC.target].Center.X && NPC.direction == -1))) || + (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, + Main.player[NPC.target].width, Main.player[NPC.target].height) && flag14)) { ++screamTimer; @@ -91,12 +92,12 @@ namespace CalamityMod.NPCs.Abyss { if (screamTimer == screamLimit) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/CorvinaScream"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/CorvinaScream"), (int)NPC.position.X, (int)NPC.position.Y); if (Main.netMode != NetmodeID.Server) { - if (!Main.player[npc.target].dead && Main.player[npc.target].active) + if (!Main.player[NPC.target].dead && Main.player[NPC.target].active) { - Main.player[npc.target].AddBuff(ModContent.BuffType(), 360, true); + Main.player[NPC.target].AddBuff(ModContent.BuffType(), 360, true); } } } @@ -107,54 +108,54 @@ namespace CalamityMod.NPCs.Abyss return; } } - if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) + if ((!Main.player[NPC.target].wet || Main.player[NPC.target].dead) && flag14) { } - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; + NPC.netUpdate = true; } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -0.2f || npc.velocity.X > 0.2f) + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -0.2f || NPC.velocity.X > 0.2f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num258 = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int num259 = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; if (Main.tile[num258, num259 - 1] == null) { Main.tile[num258, num259 - 1] = new Tile(); @@ -171,43 +172,43 @@ namespace CalamityMod.NPCs.Abyss { if (Main.tile[num258, num259 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num258, num259 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) { - npc.velocity.Y = npc.velocity.Y * 0.95f; + NPC.velocity.Y = NPC.velocity.Y * 0.95f; } } else { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + NPC.velocity.X = NPC.velocity.X * 0.94f; + if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) { - npc.velocity.X = 0f; + NPC.velocity.X = 0f; } } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 10f) + NPC.velocity.Y = NPC.velocity.Y + 0.3f; + if (NPC.velocity.Y > 10f) { - npc.velocity.Y = 10f; + NPC.velocity.Y = 10f; } - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) + NPC.rotation = NPC.velocity.Y * (float)NPC.direction * 0.1f; + if ((double)NPC.rotation < -0.2) { - npc.rotation = -0.2f; + NPC.rotation = -0.2f; } - if ((double)npc.rotation > 0.2) + if ((double)NPC.rotation > 0.2) { - npc.rotation = 0.2f; + NPC.rotation = 0.2f; } } @@ -222,33 +223,33 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { - if (!npc.wet) + if (!NPC.wet) { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; return; } - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 6.0) { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; } if (screamTimer <= (CalamityWorld.death ? 120 : 180)) { - if (npc.frame.Y > frameHeight * 5) + if (NPC.frame.Y > frameHeight * 5) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } else { - if (npc.frame.Y < frameHeight * 6) + if (NPC.frame.Y < frameHeight * 6) { - npc.frame.Y = frameHeight * 6; + NPC.frame.Y = frameHeight * 6; } - if (npc.frame.Y > frameHeight * 7) + if (NPC.frame.Y > frameHeight * 7) { - npc.frame.Y = frameHeight * 6; + NPC.frame.Y = frameHeight * 6; } } @@ -257,18 +258,18 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/LuminousCorvinaGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/LuminousCorvinaGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/LuminousCorvinaGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/LuminousCorvinaGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/LuminousCorvinaGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/LuminousCorvinaGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -278,7 +279,7 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } @@ -287,24 +288,24 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 8, 15); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); + DropHelper.DropItem(NPC, ModContent.ItemType(), 8, 15); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); int minCells = Main.expertMode ? 2 : 1; int maxCells = Main.expertMode ? 3 : 2; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 139, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 139, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 139, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 139, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index b8b9e63e2e..501786c1a0 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -21,30 +21,30 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Mirage Jelly"); - Main.npcFrameCount[npc.type] = 7; + Main.npcFrameCount[NPC.type] = 7; } public override void SetDefaults() { - npc.noGravity = true; - npc.noTileCollide = true; - npc.damage = 100; - npc.width = 70; - npc.height = 162; - npc.defense = 10; - npc.lifeMax = 6000; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.damage = 100; + NPC.width = 70; + NPC.height = 162; + NPC.defense = 10; + NPC.lifeMax = 6000; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 25, 0); - npc.HitSound = SoundID.NPCHit25; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 25, 0); + NPC.HitSound = SoundID.NPCHit25; + NPC.DeathSound = SoundID.NPCDeath28; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = false; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = false; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) @@ -52,7 +52,7 @@ namespace CalamityMod.NPCs.Abyss writer.Write(hasBeenHit); writer.Write(teleporting); writer.Write(rephasing); - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) @@ -60,19 +60,19 @@ namespace CalamityMod.NPCs.Abyss hasBeenHit = reader.ReadBoolean(); teleporting = reader.ReadBoolean(); rephasing = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - npc.TargetClosest(true); - Player player = Main.player[npc.target]; - npc.velocity *= 0.985f; - if (npc.velocity.Y > -0.3f) + NPC.TargetClosest(true); + Player player = Main.player[NPC.target]; + NPC.velocity *= 0.985f; + if (NPC.velocity.Y > -0.3f) { - npc.velocity.Y = -3f; + NPC.velocity.Y = -3f; } - if (npc.justHit) + if (NPC.justHit) { if (Main.rand.NextBool(10)) { @@ -80,15 +80,15 @@ namespace CalamityMod.NPCs.Abyss } hasBeenHit = true; } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.chaseable = true; + NPC.chaseable = true; if (Main.netMode != NetmodeID.MultiplayerClient) { if (teleporting) { teleporting = false; - npc.TargetClosest(true); + NPC.TargetClosest(true); int num1249 = 0; int num1250; int num1251; @@ -121,39 +121,39 @@ namespace CalamityMod.NPCs.Abyss goto Block; } } - npc.ai[0] = 1f; - npc.ai[1] = (float)num1250; - npc.ai[2] = (float)num1251; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = (float)num1250; + NPC.ai[2] = (float)num1251; + NPC.netUpdate = true; Block: ; } } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - npc.damage = 0; - npc.chaseable = false; - npc.alpha += 5; - if (npc.alpha >= 255) + NPC.damage = 0; + NPC.chaseable = false; + NPC.alpha += 5; + if (NPC.alpha >= 255) { - npc.alpha = 255; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - npc.ai[0] = 2f; - npc.netUpdate = true; + NPC.alpha = 255; + NPC.position.X = NPC.ai[1] * 16f - (float)(NPC.width / 2); + NPC.position.Y = NPC.ai[2] * 16f - (float)(NPC.height / 2); + NPC.ai[0] = 2f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - npc.alpha -= 5; - if (npc.alpha <= 0) + NPC.alpha -= 5; + if (NPC.alpha <= 0) { - npc.damage = Main.expertMode ? 200 : 100; - npc.chaseable = true; - npc.alpha = 0; - npc.ai[0] = 0f; - npc.netUpdate = true; + NPC.damage = Main.expertMode ? 200 : 100; + NPC.chaseable = true; + NPC.alpha = 0; + NPC.ai[0] = 0f; + NPC.netUpdate = true; } } } @@ -170,31 +170,31 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/MirageJellyGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/MirageJellyGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Purple); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/MirageJellyGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/MirageJellyGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/MirageJellyGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Purple); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/MirageJellyGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void FindFrame(int frameHeight) { - npc.frameCounter += hasBeenHit ? 0.15f : 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += hasBeenHit ? 0.15f : 0.1f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } @@ -203,14 +203,14 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss3, 10, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), NPC.downedBoss3, 10, 1, 1); int minCells = Main.expertMode ? 10 : 5; int maxCells = Main.expertMode ? 14 : 7; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); - DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, 0.01f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), Main.expertMode ? 5 : 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), Main.expertMode ? 5 : 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), Main.expertMode ? 5 : 7); + DropHelper.DropItemChance(NPC, ItemID.JellyfishNecklace, 0.01f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -223,13 +223,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index 4ef95b4280..b36a7b1ba6 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -12,62 +12,62 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Moray Eel"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.noGravity = true; - npc.damage = 55; - npc.width = 136; - npc.height = 40; - npc.defense = 8; - npc.lifeMax = 360; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.damage = 55; + NPC.width = 136; + NPC.height = 40; + NPC.defense = 8; + NPC.lifeMax = 360; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.75f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.75f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.chaseable = false; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - CalamityAI.PassiveSwimmingAI(npc, mod, 0, Main.player[npc.target].Calamity().GetAbyssAggro(300f, 250f), 0.15f, 0.1f, 6f, 4f, 0.1f); + CalamityAI.PassiveSwimmingAI(NPC, Mod, 0, Main.player[NPC.target].Calamity().GetAbyssAggro(300f, 250f), 0.15f, 0.1f, 6f, 4f, 0.1f); } public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { - return npc.chaseable; + return NPC.chaseable; } return null; } public override void FindFrame(int frameHeight) { - npc.frameCounter += npc.chaseable ? 0.15f : 0.075f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += NPC.chaseable ? 0.15f : 0.075f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -77,11 +77,11 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur) { return 0f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } @@ -90,21 +90,21 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 10 : 15); - DropHelper.DropItemChance(npc, ItemID.Flipper, 20); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), Main.expertMode ? 10 : 15); + DropHelper.DropItemChance(NPC, ItemID.Flipper, 20); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/OarfishBody.cs b/NPCs/Abyss/OarfishBody.cs index eda28aefba..2bc1510606 100644 --- a/NPCs/Abyss/OarfishBody.cs +++ b/NPCs/Abyss/OarfishBody.cs @@ -15,29 +15,29 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 30; //70 - npc.width = 16; //28 - npc.height = 16; //28 - npc.defense = 20; - npc.lifeMax = 4000; - npc.aiStyle = -1; //new + NPC.damage = 30; //70 + NPC.width = 16; //28 + NPC.height = 16; //28 + NPC.defense = 20; + NPC.lifeMax = 4000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -47,8 +47,8 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -62,29 +62,29 @@ namespace CalamityMod.NPCs.Abyss } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -92,30 +92,30 @@ namespace CalamityMod.NPCs.Abyss num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } @@ -133,13 +133,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index e1ea3cbbe9..ae691c894d 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -28,74 +28,74 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 60; - npc.width = 59; - npc.height = 38; - npc.defense = 10; - npc.lifeMax = 4000; - npc.aiStyle = -1; + NPC.damage = 60; + NPC.width = 59; + NPC.height = 38; + NPC.defense = 10; + NPC.lifeMax = 4000; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - banner = npc.type; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { writer.WriteVector2(patrolSpot); writer.Write(detectsPlayer); - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { patrolSpot = reader.ReadVector2(); detectsPlayer = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - if ((Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(250f, 150f) || npc.justHit) + if ((Main.player[NPC.target].Center - NPC.Center).Length() < Main.player[NPC.target].Calamity().GetAbyssAggro(250f, 150f) || NPC.justHit) detectsPlayer = true; - npc.chaseable = detectsPlayer; + NPC.chaseable = detectsPlayer; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead) + NPC.TargetClosest(true); if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!TailSpawned && npc.ai[0] == 0f) + if (!TailSpawned && NPC.ai[0] == 0f) { - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { int lol; if (num36 >= 0 && num36 < minLength) { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } else { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = (float)NPC.whoAmI; Main.npc[lol].ai[1] = (float)Previous; Main.npc[Previous].ai[0] = (float)lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); @@ -105,37 +105,37 @@ namespace CalamityMod.NPCs.Abyss } } - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; - else if (npc.velocity.X > 0f) - npc.spriteDirection = 1; + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; - if (Main.player[npc.target].dead) - npc.TargetClosest(false); + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f) - npc.active = false; + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) + NPC.active = false; float num188 = speed; float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); if (patrolSpot == Vector2.Zero) - patrolSpot = Main.player[npc.target].Center; + patrolSpot = Main.player[NPC.target].Center; - float num191 = detectsPlayer ? Main.player[npc.target].Center.X : patrolSpot.X; - float num192 = detectsPlayer ? Main.player[npc.target].Center.Y : patrolSpot.Y; + float num191 = detectsPlayer ? Main.player[NPC.target].Center.X : patrolSpot.X; + float num192 = detectsPlayer ? Main.player[NPC.target].Center.Y : patrolSpot.Y; if (!detectsPlayer) { num192 += 300; - if (Math.Abs(npc.Center.X - num191) < 250f) //500 + if (Math.Abs(NPC.Center.X - num191) < 250f) //500 { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { num191 += 300f; } @@ -152,18 +152,18 @@ namespace CalamityMod.NPCs.Abyss } float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); + float num50 = NPC.velocity.Length(); if (num50 > 0f) { if (num50 > num48) { - npc.velocity.Normalize(); - npc.velocity *= num48; + NPC.velocity.Normalize(); + NPC.velocity *= num48; } else if (num50 < num49) { - npc.velocity.Normalize(); - npc.velocity *= num49; + NPC.velocity.Normalize(); + NPC.velocity *= num49; } } num191 = (float)((int)(num191 / 16f) * 16); @@ -178,50 +178,50 @@ namespace CalamityMod.NPCs.Abyss float num198 = num188 / num193; num191 *= num198; num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - if (npc.velocity.X > num191) + if (NPC.velocity.X > num191) { - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - if (npc.velocity.Y > num192) + if (NPC.velocity.Y > num192) { - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num189 * 2f; } else { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 2f; } } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X + num189 * 2f; //changed from 2 } else { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X - num189 * 2f; //changed from 2 } } } @@ -229,50 +229,50 @@ namespace CalamityMod.NPCs.Abyss { if (num196 > num197) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X + num189 * 1.1f; //changed from 1.1 } - else if (npc.velocity.X > num191) + else if (NPC.velocity.X > num191) { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X - num189 * 1.1f; //changed from 1.1 } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)num188 * 0.5) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } } else { - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + num189 * 1.1f; } - else if (npc.velocity.Y > num192) + else if (NPC.velocity.Y > num192) { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 1.1f; } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)num188 * 0.5) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } } } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; } public override bool? CanBeHitByProjectile(Projectile projectile) @@ -286,11 +286,11 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } @@ -301,20 +301,20 @@ namespace CalamityMod.NPCs.Abyss { int minCells = Main.expertMode ? 4 : 3; int maxCells = Main.expertMode ? 7 : 5; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/OarfishTail.cs b/NPCs/Abyss/OarfishTail.cs index d56c8cdc1b..70a823e0f1 100644 --- a/NPCs/Abyss/OarfishTail.cs +++ b/NPCs/Abyss/OarfishTail.cs @@ -15,29 +15,29 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 15; //70 - npc.width = 14; //28 - npc.height = 16; //28 - npc.defense = 30; - npc.lifeMax = 4000; - npc.aiStyle = -1; //new + NPC.damage = 15; //70 + NPC.width = 14; //28 + NPC.height = 16; //28 + NPC.defense = 30; + NPC.lifeMax = 4000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -47,8 +47,8 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -62,29 +62,29 @@ namespace CalamityMod.NPCs.Abyss } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -92,30 +92,30 @@ namespace CalamityMod.NPCs.Abyss num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } @@ -133,13 +133,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/Reaper.cs b/NPCs/Abyss/Reaper.cs index 03ed832b26..ebd07f855a 100644 --- a/NPCs/Abyss/Reaper.cs +++ b/NPCs/Abyss/Reaper.cs @@ -11,6 +11,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Abyss { @@ -23,34 +24,34 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Reaper Shark"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 6f; - npc.noGravity = true; - npc.lavaImmune = true; - npc.damage = 160; - npc.width = 280; - npc.height = 150; - npc.defense = 70; - npc.lifeMax = 100000; // Previously 190,000 - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 6f; + NPC.noGravity = true; + NPC.lavaImmune = true; + NPC.damage = 160; + NPC.width = 280; + NPC.height = 150; + NPC.defense = 70; + NPC.lifeMax = 100000; // Previously 190,000 + NPC.aiStyle = -1; aiType = -1; - npc.timeLeft = NPC.activeTime * 30; - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.HitSound = SoundID.NPCHit56; - npc.DeathSound = SoundID.NPCDeath60; - npc.knockBackResist = 0f; - npc.rarity = 2; - banner = npc.type; + NPC.timeLeft = NPC.activeTime * 30; + NPC.value = Item.buyPrice(0, 25, 0, 0); + NPC.HitSound = SoundID.NPCHit56; + NPC.DeathSound = SoundID.NPCDeath60; + NPC.knockBackResist = 0f; + NPC.rarity = 2; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) @@ -58,9 +59,9 @@ namespace CalamityMod.NPCs.Abyss writer.Write(reset); writer.Write(reset2); writer.Write(hasBeenHit); - writer.Write(npc.localAI[0]); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) @@ -68,202 +69,202 @@ namespace CalamityMod.NPCs.Abyss reset = reader.ReadBoolean(); reset2 = reader.ReadBoolean(); hasBeenHit = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - bool phase1 = npc.life > npc.lifeMax * 0.5; - bool phase2 = npc.life <= npc.lifeMax * 0.5; - bool phase3 = npc.life <= npc.lifeMax * 0.1; - npc.chaseable = hasBeenHit; - if (npc.soundDelay <= 0) + bool phase1 = NPC.life > NPC.lifeMax * 0.5; + bool phase2 = NPC.life <= NPC.lifeMax * 0.5; + bool phase3 = NPC.life <= NPC.lifeMax * 0.1; + NPC.chaseable = hasBeenHit; + if (NPC.soundDelay <= 0) { - npc.soundDelay = 360; + NPC.soundDelay = 360; if (hasBeenHit) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperEnragedRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperEnragedRoar"), (int)NPC.position.X, (int)NPC.position.Y); } else { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperSearchRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperSearchRoar"), (int)NPC.position.X, (int)NPC.position.Y); } } if (phase3 || phase1) { if (!reset2 && phase3) { - npc.damage /= 2; - npc.noTileCollide = true; - npc.netAlways = true; - npc.localAI[0] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = -16f; - npc.ai[3] = 0f; + NPC.damage /= 2; + NPC.noTileCollide = true; + NPC.netAlways = true; + NPC.localAI[0] = 0f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = -16f; + NPC.ai[3] = 0f; reset2 = true; - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.spriteDirection = (npc.direction > 0) ? -1 : 1; - if (npc.ai[2] == 0f) + NPC.spriteDirection = (NPC.direction > 0) ? -1 : 1; + if (NPC.ai[2] == 0f) { - npc.TargetClosest(true); - if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.TargetClosest(true); + if (!Main.player[NPC.target].dead && (Main.player[NPC.target].Center - NPC.Center).Length() < 170f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - npc.ai[2] = -16f; + NPC.ai[2] = -16f; } - if (npc.justHit || npc.localAI[0] >= 420f) + if (NPC.justHit || NPC.localAI[0] >= 420f) { - npc.ai[2] = -16f; + NPC.ai[2] = -16f; } return; } - if (npc.ai[2] < 0f) + if (NPC.ai[2] < 0f) { - npc.ai[2] += 1f; - if (npc.ai[2] == 0f) + NPC.ai[2] += 1f; + if (NPC.ai[2] == 0f) { - npc.ai[2] = 1f; - npc.velocity.X = npc.direction * 2; + NPC.ai[2] = 1f; + NPC.velocity.X = NPC.direction * 2; } return; } - if (npc.ai[2] == 1f) + if (NPC.ai[2] == 1f) { - if (npc.direction == 0) + if (NPC.direction == 0) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - if (npc.wet || npc.noTileCollide) + if (NPC.wet || NPC.noTileCollide) { bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if ((!Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + NPC.TargetClosest(false); + if ((!Main.player[NPC.target].dead && + Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 300f : 500f) * //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) - (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].Calamity().GetAbyssAggro(500f, 300f)) || - npc.justHit) + (Main.player[NPC.target].Center - NPC.Center).Length() < Main.player[NPC.target].Calamity().GetAbyssAggro(500f, 300f)) || + NPC.justHit) { hasBeenHit = true; } if (!flag14) { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (!Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; + NPC.netUpdate = true; } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } } if (flag14) { - if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (NPC.ai[3] > 0f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - npc.ai[3] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[3] = 0f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[3] == 0f) + else if (NPC.ai[3] == 0f) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } - if (npc.ai[1] >= 90f) + if (NPC.ai[1] >= 90f) { - npc.ai[3] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[3] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } - if (npc.ai[3] == 0f) + if (NPC.ai[3] == 0f) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } else { - npc.noTileCollide = true; + NPC.noTileCollide = true; } - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.3f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.2f; + NPC.TargetClosest(true); + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.3f; + NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * 0.2f; float speedX = phase3 ? 3f : 12f; float speedY = phase3 ? 2.25f : 9f; - if (npc.velocity.X > speedX) + if (NPC.velocity.X > speedX) { - npc.velocity.X = speedX; + NPC.velocity.X = speedX; } - if (npc.velocity.X < -speedX) + if (NPC.velocity.X < -speedX) { - npc.velocity.X = -speedX; + NPC.velocity.X = -speedX; } - if (npc.velocity.Y > speedY) + if (NPC.velocity.Y > speedY) { - npc.velocity.Y = speedY; + NPC.velocity.Y = speedY; } - if (npc.velocity.Y < -speedY) + if (NPC.velocity.Y < -speedY) { - npc.velocity.Y = -speedY; + NPC.velocity.Y = -speedY; } } else { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (!Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; - if (npc.velocity.X < -4f || npc.velocity.X > 4f) + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.2f; + if (NPC.velocity.X < -4f || NPC.velocity.X > 4f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num258 = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int num259 = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; if (Main.tile[num258, num259 - 1] == null) { Main.tile[num258, num259 - 1] = new Tile(); @@ -280,44 +281,44 @@ namespace CalamityMod.NPCs.Abyss { if (Main.tile[num258, num259 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num258, num259 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) { - npc.velocity.Y = npc.velocity.Y * 0.95f; + NPC.velocity.Y = NPC.velocity.Y * 0.95f; } } else { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.velocity.Y = (float)Main.rand.Next(-250, -180) * 0.1f; //50 20 - npc.velocity.X = (float)Main.rand.Next(-50, 50) * 0.1f; //20 20 - npc.netUpdate = true; + NPC.velocity.Y = (float)Main.rand.Next(-250, -180) * 0.1f; //50 20 + NPC.velocity.X = (float)Main.rand.Next(-50, 50) * 0.1f; //20 20 + NPC.netUpdate = true; } } - npc.velocity.Y = npc.velocity.Y + 0.4f; - if (npc.velocity.Y > 16f) + NPC.velocity.Y = NPC.velocity.Y + 0.4f; + if (NPC.velocity.Y > 16f) { - npc.velocity.Y = 16f; + NPC.velocity.Y = 16f; } - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) + NPC.rotation = NPC.velocity.Y * (float)NPC.direction * 0.1f; + if ((double)NPC.rotation < -0.2) { - npc.rotation = -0.2f; + NPC.rotation = -0.2f; } - if ((double)npc.rotation > 0.2) + if ((double)NPC.rotation > 0.2) { - npc.rotation = 0.2f; + NPC.rotation = 0.2f; return; } } @@ -326,15 +327,15 @@ namespace CalamityMod.NPCs.Abyss { if (!reset) { - npc.noTileCollide = true; - npc.netAlways = true; - npc.localAI[0] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.noTileCollide = true; + NPC.netAlways = true; + NPC.localAI[0] = 0f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; reset = true; - npc.netUpdate = true; + NPC.netUpdate = true; } bool expertMode = Main.expertMode; int num2 = 30; @@ -344,37 +345,37 @@ namespace CalamityMod.NPCs.Abyss float num5 = expertMode ? 12f : 11f; int num9 = 90; int num16 = 75; - Vector2 vector = npc.Center; - Player player = Main.player[npc.target]; - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + Vector2 vector = NPC.Center; + Player player = Main.player[NPC.target]; + if (NPC.target < 0 || NPC.target == 255 || player.dead || !player.active) { - npc.TargetClosest(true); - player = Main.player[npc.target]; - npc.netUpdate = true; + NPC.TargetClosest(true); + player = Main.player[NPC.target]; + NPC.netUpdate = true; } if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) { - npc.velocity.Y = npc.velocity.Y + 0.4f; - if (npc.timeLeft > 10) + NPC.velocity.Y = NPC.velocity.Y + 0.4f; + if (NPC.timeLeft > 10) { - npc.timeLeft = 10; + NPC.timeLeft = 10; } - npc.ai[0] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 0f; + NPC.ai[2] = 0f; } - if (npc.localAI[0] == 0f) + if (NPC.localAI[0] == 0f) { - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; + NPC.localAI[0] = 1f; + NPC.alpha = 255; + NPC.rotation = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[0] = -1f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.netUpdate = true; } } float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { num17 += 3.14159274f; } @@ -386,227 +387,227 @@ namespace CalamityMod.NPCs.Abyss { num17 -= 6.28318548f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { num17 = 0f; } float num18 = 0.04f; - if (npc.ai[0] == 1f) + if (NPC.ai[0] == 1f) { num18 = 0f; } - if (npc.rotation < num17) + if (NPC.rotation < num17) { - if ((double)(num17 - npc.rotation) > 3.1415926535897931) + if ((double)(num17 - NPC.rotation) > 3.1415926535897931) { - npc.rotation -= num18; + NPC.rotation -= num18; } else { - npc.rotation += num18; + NPC.rotation += num18; } } - if (npc.rotation > num17) + if (NPC.rotation > num17) { - if ((double)(npc.rotation - num17) > 3.1415926535897931) + if ((double)(NPC.rotation - num17) > 3.1415926535897931) { - npc.rotation += num18; + NPC.rotation += num18; } else { - npc.rotation -= num18; + NPC.rotation -= num18; } } - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + if (NPC.rotation > num17 - num18 && NPC.rotation < num17 + num18) { - npc.rotation = num17; + NPC.rotation = num17; } - if (npc.rotation < 0f) + if (NPC.rotation < 0f) { - npc.rotation += 6.28318548f; + NPC.rotation += 6.28318548f; } - if (npc.rotation > 6.28318548f) + if (NPC.rotation > 6.28318548f) { - npc.rotation -= 6.28318548f; + NPC.rotation -= 6.28318548f; } - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + if (NPC.rotation > num17 - num18 && NPC.rotation < num17 + num18) { - npc.rotation = num17; + NPC.rotation = num17; } - if (npc.ai[0] != -1f) + if (NPC.ai[0] != -1f) { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.alpha += 15; + NPC.alpha += 15; } else { - npc.alpha -= 15; + NPC.alpha -= 15; } - if (npc.alpha < 0) + if (NPC.alpha < 0) { - npc.alpha = 0; + NPC.alpha = 0; } - if (npc.alpha > 150) + if (NPC.alpha > 150) { - npc.alpha = 150; + NPC.alpha = 150; } } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.velocity *= 0.98f; + NPC.dontTakeDamage = true; + NPC.chaseable = false; + NPC.velocity *= 0.98f; int num19 = Math.Sign(player.Center.X - vector.X); if (num19 != 0) { - npc.direction = num19; - npc.spriteDirection = -npc.direction; + NPC.direction = num19; + NPC.spriteDirection = -NPC.direction; } - if (npc.ai[2] > 20f) + if (NPC.ai[2] > 20f) { - npc.velocity.Y = -2f; - npc.alpha -= 5; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + NPC.velocity.Y = -2f; + NPC.alpha -= 5; + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.alpha += 15; + NPC.alpha += 15; } - if (npc.alpha < 0) + if (NPC.alpha < 0) { - npc.alpha = 0; + NPC.alpha = 0; } - if (npc.alpha > 150) + if (NPC.alpha > 150) { - npc.alpha = 150; + NPC.alpha = 150; } } - if (npc.ai[2] == (float)(num9 - 30)) + if (NPC.ai[2] == (float)(num9 - 30)) { int num20 = 36; for (int i = 0; i < num20; i++) { - Vector2 expr_80F = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f).RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default) + npc.Center; - Vector2 vector2 = expr_80F - npc.Center; + Vector2 expr_80F = (Vector2.Normalize(NPC.velocity) * new Vector2((float)NPC.width / 2f, (float)NPC.height) * 0.75f * 0.5f).RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default) + NPC.Center; + Vector2 vector2 = expr_80F - NPC.Center; int num21 = Dust.NewDust(expr_80F + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); Main.dust[num21].noGravity = true; Main.dust[num21].noLight = true; Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperEnragedRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperEnragedRoar"), (int)NPC.position.X, (int)NPC.position.Y); } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num16) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= (float)num16) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; return; } } - else if (npc.ai[0] == 0f && !player.dead) + else if (NPC.ai[0] == 0f && !player.dead) { - npc.dontTakeDamage = false; - npc.chaseable = true; - if (npc.ai[1] == 0f) + NPC.dontTakeDamage = false; + NPC.chaseable = true; + if (NPC.ai[1] == 0f) { - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + NPC.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); } - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector3.X) + Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(NPC.ai[1], -200f) - vector - NPC.velocity) * scaleFactor; + if (NPC.velocity.X < vector3.X) { - npc.velocity.X = npc.velocity.X + num3; - if (npc.velocity.X < 0f && vector3.X > 0f) + NPC.velocity.X = NPC.velocity.X + num3; + if (NPC.velocity.X < 0f && vector3.X > 0f) { - npc.velocity.X = npc.velocity.X + num3; + NPC.velocity.X = NPC.velocity.X + num3; } } - else if (npc.velocity.X > vector3.X) + else if (NPC.velocity.X > vector3.X) { - npc.velocity.X = npc.velocity.X - num3; - if (npc.velocity.X > 0f && vector3.X < 0f) + NPC.velocity.X = NPC.velocity.X - num3; + if (NPC.velocity.X > 0f && vector3.X < 0f) { - npc.velocity.X = npc.velocity.X - num3; + NPC.velocity.X = NPC.velocity.X - num3; } } - if (npc.velocity.Y < vector3.Y) + if (NPC.velocity.Y < vector3.Y) { - npc.velocity.Y = npc.velocity.Y + num3; - if (npc.velocity.Y < 0f && vector3.Y > 0f) + NPC.velocity.Y = NPC.velocity.Y + num3; + if (NPC.velocity.Y < 0f && vector3.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num3; + NPC.velocity.Y = NPC.velocity.Y + num3; } } - else if (npc.velocity.Y > vector3.Y) + else if (NPC.velocity.Y > vector3.Y) { - npc.velocity.Y = npc.velocity.Y - num3; - if (npc.velocity.Y > 0f && vector3.Y < 0f) + NPC.velocity.Y = NPC.velocity.Y - num3; + if (NPC.velocity.Y > 0f && vector3.Y < 0f) { - npc.velocity.Y = npc.velocity.Y - num3; + NPC.velocity.Y = NPC.velocity.Y - num3; } } int num22 = Math.Sign(player.Center.X - vector.X); if (num22 != 0) { - if (npc.ai[2] == 0f && num22 != npc.direction) + if (NPC.ai[2] == 0f && num22 != NPC.direction) { - npc.rotation += 3.14159274f; + NPC.rotation += 3.14159274f; } - npc.direction = num22; - if (npc.spriteDirection != -npc.direction) + NPC.direction = num22; + if (NPC.spriteDirection != -NPC.direction) { - npc.rotation += 3.14159274f; + NPC.rotation += 3.14159274f; } - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= (float)num2) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vector) * num5; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.velocity = Vector2.Normalize(player.Center - vector) * num5; + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X); if (num22 != 0) { - npc.direction = num22; - if (npc.spriteDirection == 1) + NPC.direction = num22; + if (NPC.spriteDirection == 1) { - npc.rotation += 3.14159274f; + NPC.rotation += 3.14159274f; } - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } - npc.netUpdate = true; + NPC.netUpdate = true; return; } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { int num24 = 7; for (int j = 0; j < num24; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)(float)num24, default) + vector; + Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((float)(NPC.width + 50) / 2f, (float)NPC.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)(float)num24, default) + vector; Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); Main.dust[num25].noGravity = true; Main.dust[num25].noLight = true; Main.dust[num25].velocity /= 4f; - Main.dust[num25].velocity -= npc.velocity; + Main.dust[num25].velocity -= NPC.velocity; } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num4) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= (float)num4) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; return; } } } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f) + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 6400f) { - npc.active = false; + NPC.active = false; } } @@ -621,10 +622,10 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { - npc.frameCounter += hasBeenHit ? 0.15f : 0.075f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += hasBeenHit ? 0.15f : 0.075f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -634,12 +635,12 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType()) && + if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType())) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } @@ -648,16 +649,16 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 40, 50); - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); + DropHelper.DropItem(NPC, ModContent.ItemType(), 40, 50); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); int minCells = Main.expertMode ? 14 : 10; int maxCells = Main.expertMode ? 22 : 17; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 1f, 3, 4); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast, 1f, 3, 4); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); if (CalamityWorld.downedPolterghast) { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3); } } @@ -665,13 +666,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 40; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index 52fe87219e..ffcee8df6e 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -9,6 +9,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Abyss { @@ -17,69 +18,69 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Toxic Minnow"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.noGravity = true; - npc.damage = 20; - npc.width = 80; - npc.height = 40; - npc.defense = 20; - npc.lifeMax = 240; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.damage = 20; + NPC.width = 80; + NPC.height = 40; + NPC.defense = 20; + NPC.lifeMax = 240; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.15f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.15f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.chaseable = false; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - CalamityAI.PassiveSwimmingAI(npc, mod, 2, 0f, 0f, 0f, 0f, 0f, 0.1f); + CalamityAI.PassiveSwimmingAI(NPC, Mod, 2, 0f, 0f, 0f, 0f, 0f, 0.1f); } public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { - return npc.chaseable; + return NPC.chaseable; } return null; } public override bool CheckDead() { - Main.PlaySound(SoundID.NPCDeath14, npc.position); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = npc.height = 40; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + SoundEngine.PlaySound(SoundID.NPCDeath14, NPC.position); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = NPC.height = 40; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + Vector2 valueBoom = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); float spreadBoom = 15f * 0.0174f; - double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; + double startAngleBoom = Math.Atan2(NPC.velocity.X, NPC.velocity.Y) - spreadBoom / 2; double deltaAngleBoom = spreadBoom / 8f; double offsetAngleBoom; int iBoom; @@ -92,25 +93,25 @@ namespace CalamityMod.NPCs.Abyss int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); } } - npc.netUpdate = true; + NPC.netUpdate = true; return true; } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/ToxicMinnowGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/ToxicMinnowGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightGreen); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/ToxicMinnowGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/ToxicMinnowGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/ToxicMinnowGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightGreen); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/ToxicMinnowGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -120,28 +121,28 @@ namespace CalamityMod.NPCs.Abyss public override void FindFrame(int frameHeight) { - if (!npc.wet) + if (!NPC.wet) { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; return; } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.9f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } @@ -152,20 +153,20 @@ namespace CalamityMod.NPCs.Abyss { int minCells = Main.expertMode ? 4 : 2; int maxCells = Main.expertMode ? 6 : 3; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 40, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 40, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 40, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 40, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index dd8e5e419a..08da683773 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -16,84 +16,84 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Viperfish"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.noGravity = true; - npc.damage = 75; - npc.width = 72; - npc.height = 30; - npc.defense = 10; - npc.lifeMax = 320; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.damage = 75; + NPC.width = 72; + NPC.height = 30; + NPC.defense = 10; + NPC.lifeMax = 320; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.85f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.85f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.chaseable = false; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - CalamityAI.PassiveSwimmingAI(npc, mod, 0, Main.player[npc.target].Calamity().GetAbyssAggro(600f, 200f), 0.25f, 0.15f, 6f, 6f, 0.1f); + CalamityAI.PassiveSwimmingAI(NPC, Mod, 0, Main.player[NPC.target].Calamity().GetAbyssAggro(600f, 200f), 0.25f, 0.15f, 6f, 6f, 0.1f); } public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { - return npc.chaseable; + return NPC.chaseable; } return null; } public override void FindFrame(int frameHeight) { - if (!npc.wet) + if (!NPC.wet) { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; return; } - npc.frameCounter += npc.chaseable ? 0.15f : 0.075f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += NPC.chaseable ? 0.15f : 0.075f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/ViperfishGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/ViperfishGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/ViperfishGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/ViperfishGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/ViperfishGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/ViperfishGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -103,11 +103,11 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } @@ -116,26 +116,26 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.25f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.25f); int minCells = Main.expertMode ? 2 : 1; int maxCells = Main.expertMode ? 3 : 2; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ViperFish"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ViperFish2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ViperFish"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ViperFish2"), 1f); } } } diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index b8325fe278..ce168dccc4 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -10,81 +10,82 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using System; +using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { public class AcidEel : ModNPC { - public Player Target => Main.player[npc.target]; + public Player Target => Main.player[NPC.target]; public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Eel"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; - NPCID.Sets.TrailCacheLength[npc.type] = 7; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailCacheLength[NPC.type] = 7; } public override void SetDefaults() { - npc.width = 72; - npc.height = 18; + NPC.width = 72; + NPC.height = 18; - npc.damage = 20; - npc.lifeMax = 80; - npc.defense = 4; - npc.knockBackResist = 0.9f; + NPC.damage = 20; + NPC.lifeMax = 80; + NPC.defense = 4; + NPC.knockBackResist = 0.9f; if (CalamityWorld.downedPolterghast) { - npc.DR_NERD(0.05f); - npc.damage = 100; - npc.lifeMax = 3300; - npc.defense = 20; - npc.knockBackResist = 0.7f; + NPC.DR_NERD(0.05f); + NPC.damage = 100; + NPC.lifeMax = 3300; + NPC.defense = 20; + NPC.knockBackResist = 0.7f; } else if (CalamityWorld.downedAquaticScourge) { - npc.damage = 50; - npc.lifeMax = 240; + NPC.damage = 50; + NPC.lifeMax = 240; } - npc.value = Item.buyPrice(0, 0, 3, 32); - npc.aiStyle = -1; + NPC.value = Item.buyPrice(0, 0, 3, 32); + NPC.aiStyle = -1; aiType = -1; - npc.lavaImmune = false; - npc.noGravity = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.lavaImmune = false; + NPC.noGravity = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.TargetClosest(false); + NPC.TargetClosest(false); // Fall through platforms. - npc.Calamity().ShouldFallThroughPlatforms = true; + NPC.Calamity().ShouldFallThroughPlatforms = true; // Play a slither sound from time to time. if (Main.rand.NextBool(480)) - Main.PlaySound(SoundID.Zombie, npc.Center, 32); + SoundEngine.PlaySound(SoundID.Zombie, NPC.Center, 32); - if (npc.wet) + if (NPC.wet) { SwimTowardsTarget(); return; } // Do nothing on land. - npc.rotation = npc.rotation.AngleLerp(0f, 0.1f); - npc.velocity.X *= 0.95f; - if (npc.velocity.Y < 14f) - npc.velocity.Y += 0.15f; + NPC.rotation = NPC.rotation.AngleLerp(0f, 0.1f); + NPC.velocity.X *= 0.95f; + if (NPC.velocity.Y < 14f) + NPC.velocity.Y += 0.15f; } public void SwimTowardsTarget() @@ -99,7 +100,7 @@ namespace CalamityMod.NPCs.AcidRain bool waterAbove = false; for (int dy = -160; dy < 0; dy += 8) { - if (Collision.WetCollision(npc.position + Vector2.UnitY * dy, npc.width, 16)) + if (Collision.WetCollision(NPC.position + Vector2.UnitY * dy, NPC.width, 16)) { waterAbove = true; break; @@ -107,67 +108,67 @@ namespace CalamityMod.NPCs.AcidRain } if (waterAbove) - npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y - 0.25f, -14f, 14f); + NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y - 0.25f, -14f, 14f); else - npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y + 0.4f, -4f, 8f); + NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y + 0.4f, -4f, 8f); // Coast in a single direction until hitting something. - if (npc.direction == 0) + if (NPC.direction == 0) { - npc.direction = Main.rand.NextBool().ToDirectionInt(); - npc.netUpdate = true; + NPC.direction = Main.rand.NextBool().ToDirectionInt(); + NPC.netUpdate = true; } // Rebound on impending collision or when near the world edge. - bool nearWorldEdge = npc.Center.X < (Main.offLimitBorderTiles + 2f) * 16f || npc.Center.X > (Main.maxTilesX - Main.offLimitBorderTiles - 2f) * 16f; - if ((CalamityUtils.DistanceToTileCollisionHit(npc.Center, Vector2.UnitX * npc.direction, 20) ?? 20f) < 5f || nearWorldEdge) + bool nearWorldEdge = NPC.Center.X < (Main.offLimitBorderTiles + 2f) * 16f || NPC.Center.X > (Main.maxTilesX - Main.offLimitBorderTiles - 2f) * 16f; + if ((CalamityUtils.DistanceToTileCollisionHit(NPC.Center, Vector2.UnitX * NPC.direction, 20) ?? 20f) < 5f || nearWorldEdge) { - npc.direction *= -1; + NPC.direction *= -1; if (nearWorldEdge) - npc.position.X += Math.Sign(Main.maxTilesX * 8f - npc.position.X) * 12f; + NPC.position.X += Math.Sign(Main.maxTilesX * 8f - NPC.position.X) * 12f; - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.velocity.X = (npc.velocity.X * 24f + npc.direction * swimSpeed) / 25f; + NPC.velocity.X = (NPC.velocity.X * 24f + NPC.direction * swimSpeed) / 25f; } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAquaticScourge, 0.05f); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 2, 1, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAquaticScourge, 0.05f); } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter >= 5) + NPC.frameCounter++; + if (NPC.frameCounter >= 5) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) - npc.frame.Y = 0; + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + NPC.frame.Y = 0; } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - CalamityGlobalNPC.DrawGlowmask(npc, spriteBatch, ModContent.GetTexture(Texture + "Glow")); - if (npc.velocity.Length() > 1.5f) - CalamityGlobalNPC.DrawAfterimage(npc, spriteBatch, drawColor, Color.Transparent, directioning: true); + CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow")); + if (NPC.velocity.Length() > 1.5f) + CalamityGlobalNPC.DrawAfterimage(NPC, spriteBatch, drawColor, Color.Transparent, directioning: true); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 8; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/AcidEelGore"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/AcidEelGore2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/AcidEelGore3"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/AcidEelGore"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/AcidEelGore2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/AcidEelGore3"), NPC.scale); for (int k = 0; k < 20; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/AcidRain/BloodwormFleeing.cs b/NPCs/AcidRain/BloodwormFleeing.cs index 04cce37700..41478909a3 100644 --- a/NPCs/AcidRain/BloodwormFleeing.cs +++ b/NPCs/AcidRain/BloodwormFleeing.cs @@ -10,49 +10,49 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { DisplayName.SetDefault("Bloodworm"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.damage = 0; - npc.width = 12; - npc.height = 42; - npc.defense = 0; - npc.lifeMax = 5; - npc.knockBackResist = 0f; - npc.lavaImmune = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit20; - npc.DeathSound = SoundID.NPCDeath12; + NPC.damage = 0; + NPC.width = 12; + NPC.height = 42; + NPC.defense = 0; + NPC.lifeMax = 5; + NPC.knockBackResist = 0f; + NPC.lavaImmune = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit20; + NPC.DeathSound = SoundID.NPCDeath12; } public override void AI() { - Player player = Main.player[Player.FindClosest(npc.Center, 1, 1)]; - if (npc.velocity == Vector2.Zero) - npc.velocity = Vector2.UnitY * 12f; + Player player = Main.player[Player.FindClosest(NPC.Center, 1, 1)]; + if (NPC.velocity == Vector2.Zero) + NPC.velocity = Vector2.UnitY * 12f; float intertia = 24f; // Attempt to flee from the nearest player. - npc.velocity = (npc.velocity * intertia - npc.SafeDirectionTo(player.Center) * 12f) / (intertia + 1f); + NPC.velocity = (NPC.velocity * intertia - NPC.SafeDirectionTo(player.Center) * 12f) / (intertia + 1f); // But always dig downward. - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.rotation = NPC.velocity.ToRotation() - MathHelper.PiOver2; } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter >= 5) + NPC.frameCounter++; + if (NPC.frameCounter >= 5) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) - npc.frame.Y = 0; + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + NPC.frame.Y = 0; } } @@ -60,7 +60,7 @@ namespace CalamityMod.NPCs.AcidRain { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/AcidRain/BloodwormNormal.cs b/NPCs/AcidRain/BloodwormNormal.cs index 8cb9c19eb6..979cd9cd45 100644 --- a/NPCs/AcidRain/BloodwormNormal.cs +++ b/NPCs/AcidRain/BloodwormNormal.cs @@ -12,79 +12,79 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { DisplayName.SetDefault("Bloodworm"); - Main.npcFrameCount[npc.type] = 7; - Main.npcCatchable[npc.type] = true; + Main.npcFrameCount[NPC.type] = 7; + Main.npcCatchable[NPC.type] = true; } public override void SetDefaults() { - npc.damage = 0; - npc.width = 36; - npc.height = 16; - npc.defense = 0; - npc.lifeMax = 5; - npc.knockBackResist = 0f; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.catchItem = (short)ModContent.ItemType(); - npc.dontTakeDamageFromHostiles = true; - npc.rarity = 4; + NPC.damage = 0; + NPC.width = 36; + NPC.height = 16; + NPC.defense = 0; + NPC.lifeMax = 5; + NPC.knockBackResist = 0f; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.catchItem = (short)ModContent.ItemType(); + NPC.dontTakeDamageFromHostiles = true; + NPC.rarity = 4; } public override void AI() { - if (npc.collideY) + if (NPC.collideY) { - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.ai[0] = Main.rand.NextBool(2).ToDirectionInt(); - npc.netUpdate = true; + NPC.ai[0] = Main.rand.NextBool(2).ToDirectionInt(); + NPC.netUpdate = true; } - if (npc.collideX) + if (NPC.collideX) { - npc.ai[0] *= -1; + NPC.ai[0] *= -1; } } float xSpeed = 3f; - npc.velocity.X = xSpeed * npc.ai[0]; - npc.spriteDirection = (int)npc.ai[0]; + NPC.velocity.X = xSpeed * NPC.ai[0]; + NPC.spriteDirection = (int)NPC.ai[0]; bool flee = false; for (int i = 0; i < Main.player.Length; i++) { Player player = Main.player[i]; - if (player.active && !player.dead && Vector2.Distance(player.Center, npc.Center) <= 220f) + if (player.active && !player.dead && Vector2.Distance(player.Center, NPC.Center) <= 220f) { flee = true; break; } } int timeBeforeFlee = 60; - if (flee && npc.ai[1] < timeBeforeFlee) + if (flee && NPC.ai[1] < timeBeforeFlee) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } - if (npc.ai[1] == timeBeforeFlee && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.ai[1] == timeBeforeFlee && Main.netMode != NetmodeID.MultiplayerClient) { - npc.position.Y += 16f; - npc.Transform(ModContent.NPCType()); - npc.netUpdate = true; + NPC.position.Y += 16f; + NPC.Transform(ModContent.NPCType()); + NPC.netUpdate = true; return; } } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter >= 6) + NPC.frameCounter++; + if (NPC.frameCounter >= 6) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } @@ -93,17 +93,17 @@ namespace CalamityMod.NPCs.AcidRain { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (!spawnInfo.player.Calamity().ZoneSulphur || CalamityWorld.rainingAcid) + if (!spawnInfo.Player.Calamity().ZoneSulphur || CalamityWorld.rainingAcid) return 0f; // Increase bloodworm spawn rate relative to the number of existing bloodworms, parabolic multiplier ranging from 5x spawn rate with 0 blood worms to 1x with 5 or more - int bloodwormAmt = NPC.CountNPCS(npc.type); + int bloodwormAmt = NPC.CountNPCS(NPC.type); float spawnMult = bloodwormAmt > 5 ? 1f : (float)(0.16 * Math.Pow(5 - bloodwormAmt, 2)) + 1f; float baseSpawnRate = CalamityWorld.encounteredOldDuke ? 2.569f : 5.138f; float spawnRate = SpawnCondition.WormCritter.Chance * baseSpawnRate * spawnMult; diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index 14faa021ed..b78a050bf9 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -10,7 +10,8 @@ using Terraria.ModLoader; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Rogue; using Terraria.Utilities; -using Terraria.World.Generation; +using Terraria.WorldBuilding; +using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { @@ -24,82 +25,82 @@ namespace CalamityMod.NPCs.AcidRain CreateVibeCheckTether } - public Player Target => Main.player[npc.target]; + public Player Target => Main.player[NPC.target]; public CragmawAttackState CurrentAttack { - get => (CragmawAttackState)(int)npc.ai[0]; - set => npc.ai[0] = (int)value; + get => (CragmawAttackState)(int)NPC.ai[0]; + set => NPC.ai[0] = (int)value; } - public ref float AttackTimer => ref npc.ai[1]; + public ref float AttackTimer => ref NPC.ai[1]; public bool HasMadeShellBreakGore { - get => npc.localAI[0] == 1f; - set => npc.localAI[0] = value.ToInt(); + get => NPC.localAI[0] == 1f; + set => NPC.localAI[0] = value.ToInt(); } public bool InPhase2 { get { float phase2CeilingRatio = CalamityWorld.revenge ? 0.85f : 0.7f; - return npc.life / (float)npc.lifeMax < phase2CeilingRatio && CalamityWorld.downedPolterghast; + return NPC.life / (float)NPC.lifeMax < phase2CeilingRatio && CalamityWorld.downedPolterghast; } } public override void SetStaticDefaults() { DisplayName.SetDefault("Cragmaw Mire"); - Main.npcFrameCount[npc.type] = 2; + Main.npcFrameCount[NPC.type] = 2; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; + NPC.Calamity().canBreakPlayerDefense = true; - npc.width = 68; - npc.height = 54; - npc.aiStyle = aiType = -1; + NPC.width = 68; + NPC.height = 54; + NPC.aiStyle = aiType = -1; - npc.damage = 66; - npc.lifeMax = 4000; - npc.defense = 25; + NPC.damage = 66; + NPC.lifeMax = 4000; + NPC.defense = 25; if (CalamityWorld.downedPolterghast) { - npc.damage = 160; - npc.lifeMax = 80630; - npc.defense = 80; + NPC.damage = 160; + NPC.lifeMax = 80630; + NPC.defense = 80; } - npc.behindTiles = true; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 3, 60, 0); - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.behindTiles = true; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 3, 60, 0); + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.TargetClosest(false); + NPC.TargetClosest(false); // Reset things every frame. They may be changed in the attack states below. - npc.noGravity = false; - npc.noTileCollide = false; - npc.dontTakeDamage = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.dontTakeDamage = false; // Handle the phase 2 transition. if (InPhase2 && !HasMadeShellBreakGore) { - Main.PlaySound(SoundID.DD2_ExplosiveTrapExplode, npc.Center); - Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP1Gore"), npc.scale); - Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP1Gore2"), npc.scale); - Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP1Gore3"), npc.scale); + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, NPC.Center); + Gore.NewGore(NPC.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, Mod.GetGoreSlot("Gores/AcidRain/CragmawMireP1Gore"), NPC.scale); + Gore.NewGore(NPC.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, Mod.GetGoreSlot("Gores/AcidRain/CragmawMireP1Gore2"), NPC.scale); + Gore.NewGore(NPC.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, Mod.GetGoreSlot("Gores/AcidRain/CragmawMireP1Gore3"), NPC.scale); HasMadeShellBreakGore = true; } @@ -139,8 +140,8 @@ namespace CalamityMod.NPCs.AcidRain burstShootRate -= 10; } - if (Collision.SolidCollision(npc.position, npc.width, npc.height - 6)) - npc.position.Y -= 4f; + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height - 6)) + NPC.position.Y -= 4f; // Release bursts of spikes and play a fire sound. float wrappedAttackTimer = AttackTimer % burstShootRate; @@ -150,9 +151,9 @@ namespace CalamityMod.NPCs.AcidRain { for (int i = 0; i < 4; i++) { - Dust rock = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Circular(75f, 75f), 1); + Dust rock = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Circular(75f, 75f), 1); rock.color = Color.Yellow; - rock.velocity = (npc.Center - rock.position) * Main.rand.NextFloat(0.06f, 0.09f); + rock.velocity = (NPC.Center - rock.position) * Main.rand.NextFloat(0.06f, 0.09f); rock.scale = Main.rand.NextFloat(1f, 1.3f); rock.noGravity = true; } @@ -161,7 +162,7 @@ namespace CalamityMod.NPCs.AcidRain if (wrappedAttackTimer == burstShootRate - 1f) { // Play the sound. - Main.PlaySound(SoundID.Item92, npc.Center); + SoundEngine.PlaySound(SoundID.Item92, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -170,7 +171,7 @@ namespace CalamityMod.NPCs.AcidRain for (int i = 0; i < spikesPerBurst; i++) { Vector2 spikeShootVelocity = (MathHelper.TwoPi * i / spikesPerBurst + shootOffsetAngle).ToRotationVector2() * burstSpeed; - Projectile.NewProjectile(npc.Center + spikeShootVelocity * 1.6f, spikeShootVelocity, ModContent.ProjectileType(), damage, 0f); + Projectile.NewProjectile(NPC.Center + spikeShootVelocity * 1.6f, spikeShootVelocity, ModContent.ProjectileType(), damage, 0f); } } } @@ -199,88 +200,88 @@ namespace CalamityMod.NPCs.AcidRain maxSlamSpeed += 1.15f; } - ref float attackSubstate = ref npc.ai[2]; - ref float slamCounter = ref npc.ai[3]; + ref float attackSubstate = ref NPC.ai[2]; + ref float slamCounter = ref NPC.ai[3]; switch ((int)attackSubstate) { // Dig in anticipation of the slam teleport. case 0: // Disable tile collision and normal gravity, as the cragmaw will dig into the ground. - npc.noTileCollide = true; - npc.noGravity = true; + NPC.noTileCollide = true; + NPC.noGravity = true; // Dig into the ground. - npc.position.Y += 3f; + NPC.position.Y += 3f; // Fade out. - npc.Opacity = MathHelper.Clamp(npc.Opacity - opacityFadeoutIncrement * 0.6f, 0f, 1f); + NPC.Opacity = MathHelper.Clamp(NPC.Opacity - opacityFadeoutIncrement * 0.6f, 0f, 1f); // Stop taking damage. - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; // Teleport once completely transparent. - if (npc.Opacity <= 0f) + if (NPC.Opacity <= 0f) { attackSubstate = 1f; - npc.Center = Target.Center - Vector2.UnitY * verticalTeleportOffset; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; + NPC.Center = Target.Center - Vector2.UnitY * verticalTeleportOffset; + NPC.velocity = Vector2.Zero; + NPC.netUpdate = true; } break; // Fade in again. case 1: // Disable default gravity and tile collision, as it is expected that the cragmaw is in the air at the moment. - npc.noGravity = true; - npc.noTileCollide = true; + NPC.noGravity = true; + NPC.noTileCollide = true; // Disable contact damage. This is done to prevent cheap hits from the teleport, either in multiplayer or due to fast upward movement. - npc.damage = 0; + NPC.damage = 0; // Fade in. - npc.Opacity = MathHelper.Clamp(npc.Opacity + opacityFadeoutIncrement, 0f, 1f); + NPC.Opacity = MathHelper.Clamp(NPC.Opacity + opacityFadeoutIncrement, 0f, 1f); // Do the slam once completely faded in. - if (npc.Opacity >= 1f) + if (NPC.Opacity >= 1f) { attackSubstate = 2f; AttackTimer = 0f; - npc.velocity = Vector2.UnitY * maxSlamSpeed * 0.251f; - npc.netUpdate = true; + NPC.velocity = Vector2.UnitY * maxSlamSpeed * 0.251f; + NPC.netUpdate = true; } break; // Do the slam. case 2: // Disable default gravity and tile collision. Both of them will be calculated manually. - npc.noGravity = true; - npc.noTileCollide = true; + NPC.noGravity = true; + NPC.noTileCollide = true; // Slam downward. - npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y + slamAcceleration, 0f, maxSlamSpeed); + NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y + slamAcceleration, 0f, maxSlamSpeed); // Register ground collision from the slam. // Once it has been hit a nuke explosion projectile is created on the ground, along with homing nuclear drops. - if ((npc.Bottom.Y > Target.Bottom.Y && Collision.SolidCollision(npc.BottomLeft, npc.width, 1)) || AttackTimer > 180f) + if ((NPC.Bottom.Y > Target.Bottom.Y && Collision.SolidCollision(NPC.BottomLeft, NPC.width, 1)) || AttackTimer > 180f) { - npc.velocity = Vector2.Zero; + NPC.velocity = Vector2.Zero; if (AttackTimer == 1f) { - Main.PlaySound(SoundID.DD2_ExplosiveTrapExplode, npc.Center); + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int nukeDamage = CalamityWorld.downedPolterghast ? 72 : 38; int dropletDamage = (int)(nukeDamage * 0.6f); - int explosion = Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType(), nukeDamage, 0f); + int explosion = Projectile.NewProjectile(NPC.Center, Vector2.Zero, ModContent.ProjectileType(), nukeDamage, 0f); if (Main.projectile.IndexInRange(explosion)) - Main.projectile[explosion].Bottom = npc.Bottom + Vector2.UnitY * 4f; + Main.projectile[explosion].Bottom = NPC.Bottom + Vector2.UnitY * 4f; for (int i = 0; i < 12; i++) { Vector2 dropletVelocity = -Vector2.UnitY.RotatedByRandom(0.71f) * Main.rand.NextFloat(8f, 12f); - Projectile.NewProjectile(npc.Center, dropletVelocity, ModContent.ProjectileType(), dropletDamage, 0f); + Projectile.NewProjectile(NPC.Center, dropletVelocity, ModContent.ProjectileType(), dropletDamage, 0f); } } } @@ -298,7 +299,7 @@ namespace CalamityMod.NPCs.AcidRain else { attackSubstate = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } break; @@ -321,37 +322,37 @@ namespace CalamityMod.NPCs.AcidRain opacityFadeoutIncrement += 0.01f; } - ref float attackSubstate = ref npc.ai[2]; + ref float attackSubstate = ref NPC.ai[2]; switch ((int)attackSubstate) { // Dig to reposition. case 0: // Disable tile collision and normal gravity, as the cragmaw will dig into the ground. - npc.noTileCollide = true; - npc.noGravity = true; + NPC.noTileCollide = true; + NPC.noGravity = true; // Dig into the ground. - npc.position.Y += 3f; + NPC.position.Y += 3f; // Fade out. - npc.Opacity = MathHelper.Clamp(npc.Opacity - opacityFadeoutIncrement * 0.6f, 0f, 1f); + NPC.Opacity = MathHelper.Clamp(NPC.Opacity - opacityFadeoutIncrement * 0.6f, 0f, 1f); // Stop taking damage. - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; // Teleport once completely transparent. - if (npc.Opacity <= 0f) + if (NPC.Opacity <= 0f) { attackSubstate = 1f; if (WorldUtils.Find(Target.Center.ToTileCoordinates(), Searches.Chain(new Searches.Down(1000), new CustomConditions.SolidOrPlatform()), out Point teleportPosition)) - npc.Bottom = teleportPosition.ToWorldCoordinates() + Vector2.UnitY * digReapperTime * digReapperSpeed; + NPC.Bottom = teleportPosition.ToWorldCoordinates() + Vector2.UnitY * digReapperTime * digReapperSpeed; else SelectNextAttack(); AttackTimer = 0f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; + NPC.velocity = Vector2.Zero; + NPC.netUpdate = true; } break; @@ -360,21 +361,21 @@ namespace CalamityMod.NPCs.AcidRain // Come out of the ground. if (AttackTimer < digReapperTime) { - npc.noTileCollide = true; - npc.noGravity = true; - npc.position.Y -= digReapperSpeed; + NPC.noTileCollide = true; + NPC.noGravity = true; + NPC.position.Y -= digReapperSpeed; } if (AttackTimer == digReapperTime) - npc.netUpdate = true; + NPC.netUpdate = true; // Fade in. - npc.Opacity = MathHelper.Clamp(npc.Opacity + opacityFadeoutIncrement, 0f, 1f); + NPC.Opacity = MathHelper.Clamp(NPC.Opacity + opacityFadeoutIncrement, 0f, 1f); // Create some charge dust. if (AttackTimer > digReapperTime && AttackTimer < digReapperTime + chargeupTelegraphTime) { - Dust chargeupDust = Dust.NewDustPerfect(npc.Center, 267); - chargeupDust.position -= Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * npc.height * 0.4f; + Dust chargeupDust = Dust.NewDustPerfect(NPC.Center, 267); + chargeupDust.position -= Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * NPC.height * 0.4f; chargeupDust.velocity = -Vector2.UnitY.RotatedByRandom(0.31f) * Main.rand.NextFloat(2f, 6f); chargeupDust.color = Color.Lerp(Color.Green, Color.Yellow, Main.rand.NextFloat()); chargeupDust.scale = Main.rand.NextFloat(0.95f, 1.35f); @@ -385,10 +386,10 @@ namespace CalamityMod.NPCs.AcidRain if (AttackTimer == digReapperTime + chargeupTelegraphTime) { // Play a sound and create dust. - Main.PlaySound(SoundID.Zombie, npc.Center, 104); + SoundEngine.PlaySound(SoundID.Zombie, NPC.Center, 104); for (int i = 0; i < 40; i++) { - Dust burstDust = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Circular(75f, 75f), 267); + Dust burstDust = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Circular(75f, 75f), 267); burstDust.velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(2f, 6f); burstDust.color = Color.Lerp(Color.Green, Color.Yellow, Main.rand.NextFloat()); burstDust.scale = Main.rand.NextFloat(1.1f, 1.45f); @@ -398,7 +399,7 @@ namespace CalamityMod.NPCs.AcidRain if (Main.netMode != NetmodeID.MultiplayerClient) { int laserbeamDamage = CalamityWorld.downedPolterghast ? 120 : 40; - Projectile.NewProjectile(npc.Center, -Vector2.UnitY, ModContent.ProjectileType(), laserbeamDamage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(NPC.Center, -Vector2.UnitY, ModContent.ProjectileType(), laserbeamDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } @@ -411,7 +412,7 @@ namespace CalamityMod.NPCs.AcidRain public void DoBehavior_CreateVibeCheckTether() { if (Main.netMode != NetmodeID.MultiplayerClient && AttackTimer == 30f) - Projectile.NewProjectile(npc.Center, -Vector2.UnitY * 4f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, npc.whoAmI, npc.target); + Projectile.NewProjectile(NPC.Center, -Vector2.UnitY * 4f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, NPC.whoAmI, NPC.target); if (AttackTimer > CragmawVibeCheckChain.Lifetime + 30f) SelectNextAttack(); } @@ -420,8 +421,8 @@ namespace CalamityMod.NPCs.AcidRain { // Reset the attack timer and optional attack variables. AttackTimer = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; CragmawAttackState oldAttack = CurrentAttack; WeightedRandom attackSelector = new WeightedRandom(Main.rand); @@ -437,40 +438,40 @@ namespace CalamityMod.NPCs.AcidRain CurrentAttack = attackSelector.Get(); while (oldAttack == CurrentAttack); - npc.netUpdate = true; + NPC.netUpdate = true; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * 0.85f); } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Texture2D texture = InPhase2 ? ModContent.GetTexture("CalamityMod/NPCs/AcidRain/CragmawMire2") : ModContent.GetTexture("CalamityMod/NPCs/AcidRain/CragmawMire"); - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, npc.GetAlpha(drawColor), true); + Texture2D texture = InPhase2 ? ModContent.Request("CalamityMod/NPCs/AcidRain/CragmawMire2") : ModContent.Request("CalamityMod/NPCs/AcidRain/CragmawMire"); + CalamityMod.DrawTexture(spriteBatch, texture, 0, NPC, NPC.GetAlpha(drawColor), true); return false; } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter % 6 == 5) - npc.frame.Y += frameHeight; - if (npc.frame.Y >= frameHeight * 2) - npc.frame.Y = 0; + NPC.frameCounter++; + if (NPC.frameCounter % 6 == 5) + NPC.frame.Y += frameHeight; + if (NPC.frame.Y >= frameHeight * 2) + NPC.frame.Y = 0; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + if (NPC.life <= 0) { - Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP2Gore"), npc.scale); - Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP2Gore2"), npc.scale); - Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP2Gore3"), npc.scale); + Gore.NewGore(NPC.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, Mod.GetGoreSlot("Gores/AcidRain/CragmawMireP2Gore"), NPC.scale); + Gore.NewGore(NPC.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, Mod.GetGoreSlot("Gores/AcidRain/CragmawMireP2Gore2"), NPC.scale); + Gore.NewGore(NPC.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, Mod.GetGoreSlot("Gores/AcidRain/CragmawMireP2Gore3"), NPC.scale); } } @@ -478,8 +479,8 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast ? 0.1f : 1f); - DropHelper.DropItemChance(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast ? 0.1f : 1f); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast ? 0.1f : 1f); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast ? 0.1f : 1f); } } } diff --git a/NPCs/AcidRain/FlakBaby.cs b/NPCs/AcidRain/FlakBaby.cs index 25a5819d83..fdb9db98ab 100644 --- a/NPCs/AcidRain/FlakBaby.cs +++ b/NPCs/AcidRain/FlakBaby.cs @@ -15,44 +15,44 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { DisplayName.SetDefault("Baby Flak Crab"); - Main.npcFrameCount[npc.type] = 6; - Main.npcCatchable[npc.type] = true; + Main.npcFrameCount[NPC.type] = 6; + Main.npcCatchable[NPC.type] = true; } public override void SetDefaults() { - npc.width = 26; - npc.height = 32; + NPC.width = 26; + NPC.height = 32; - npc.damage = 0; - npc.lifeMax = 5; - npc.defense = 5; + NPC.damage = 0; + NPC.lifeMax = 5; + NPC.defense = 5; - npc.value = Item.buyPrice(0, 0, 5, 55); - npc.lavaImmune = true; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.DD2_WitherBeastDeath; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 5, 55); + NPC.lavaImmune = true; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit41; + NPC.DeathSound = SoundID.DD2_WitherBeastDeath; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.dontTakeDamageFromHostiles = true; - npc.catchItem = (short)ModContent.ItemType(); + NPC.dontTakeDamageFromHostiles = true; + NPC.catchItem = (short)ModContent.ItemType(); } public override void AI() { - if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { if (Main.rand.NextBool(20)) - npc.catchItem = (short)ModContent.ItemType(); - npc.localAI[0] = 1f; - npc.velocity.Y = -3f; - npc.netUpdate = true; + NPC.catchItem = (short)ModContent.ItemType(); + NPC.localAI[0] = 1f; + NPC.velocity.Y = -3f; + NPC.netUpdate = true; } - if (Main.rand.NextBool(8) && npc.catchItem == (short)ModContent.ItemType()) + if (Main.rand.NextBool(8) && NPC.catchItem == (short)ModContent.ItemType()) { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, (int)CalamityDusts.SulfurousSeaAcid, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 200, default, 1f); + int dust = Dust.NewDust(NPC.position - new Vector2(2f, 2f), NPC.width + 4, NPC.height + 4, (int)CalamityDusts.SulfurousSeaAcid, NPC.velocity.X * 0.4f, NPC.velocity.Y * 0.4f, 200, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.1f; Main.dust[dust].velocity.Y += 0.25f; @@ -63,64 +63,64 @@ namespace CalamityMod.NPCs.AcidRain Main.dust[dust].scale *= 0.5f; } } - Player closest = Main.player[Player.FindClosest(npc.Top, 0, 0)]; - if (Math.Abs(closest.Center.X - npc.Center.X) > 600f) + Player closest = Main.player[Player.FindClosest(NPC.Top, 0, 0)]; + if (Math.Abs(closest.Center.X - NPC.Center.X) > 600f) { - npc.ai[1] = 90; + NPC.ai[1] = 90; } - if (npc.ai[1] > 0f) + if (NPC.ai[1] > 0f) { - npc.velocity.X *= 0.935f; - npc.ai[1]--; + NPC.velocity.X *= 0.935f; + NPC.ai[1]--; } else { - if (npc.velocity.Y == 0f && npc.collideX) + if (NPC.velocity.Y == 0f && NPC.collideX) { - npc.velocity.Y = -13f; + NPC.velocity.Y = -13f; } else { - npc.velocity.Y += 0.15f; + NPC.velocity.Y += 0.15f; } - npc.spriteDirection = (closest.Center.X - npc.Center.X < 0).ToDirectionInt(); - if (Math.Abs(npc.velocity.X) < 35f) + NPC.spriteDirection = (closest.Center.X - NPC.Center.X < 0).ToDirectionInt(); + if (Math.Abs(NPC.velocity.X) < 35f) { - npc.velocity.X += npc.spriteDirection * 0.2f; + NPC.velocity.X += NPC.spriteDirection * 0.2f; } } } public override void FindFrame(int frameHeight) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) { - if (npc.ai[0]++ % 4 == 3) + if (NPC.ai[0]++ % 4 == 3) { - npc.frame.Y += frameHeight; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) { - npc.frame.Y = frameHeight * 2; + NPC.frame.Y = frameHeight * 2; } } else { - if (npc.ai[0]++ % 6 == 5) + if (NPC.ai[0]++ % 6 == 5) { - npc.frame.Y -= frameHeight; + NPC.frame.Y -= frameHeight; } - if (npc.frame.Y <= 0) + if (NPC.frame.Y <= 0) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur || !CalamityWorld.downedAquaticScourge) + if (spawnInfo.playerSafe || !spawnInfo.Player.Calamity().ZoneSulphur || !CalamityWorld.downedAquaticScourge) { return 0f; } @@ -142,17 +142,17 @@ namespace CalamityMod.NPCs.AcidRain { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/FlakCrab"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/FlakCrab2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/FlakCrab3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/FlakCrab"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/FlakCrab2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/FlakCrab3"), 1f); } } } diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index f7eab0d95d..badde93094 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -15,49 +15,49 @@ namespace CalamityMod.NPCs.AcidRain { public class FlakCrab : ModNPC { - public Player Target => Main.player[npc.target]; - public ref float ChasabilityTimer => ref npc.ai[0]; - public ref float AcidShootTimer => ref npc.ai[1]; - public ref float HopTimer => ref npc.ai[2]; - public ref float HopCounter => ref npc.ai[3]; - public ref float FleeCountdownTimer => ref npc.localAI[0]; - public ref float TotalHits => ref npc.localAI[1]; + public Player Target => Main.player[NPC.target]; + public ref float ChasabilityTimer => ref NPC.ai[0]; + public ref float AcidShootTimer => ref NPC.ai[1]; + public ref float HopTimer => ref NPC.ai[2]; + public ref float HopCounter => ref NPC.ai[3]; + public ref float FleeCountdownTimer => ref NPC.localAI[0]; + public ref float TotalHits => ref NPC.localAI[1]; public const int TotalHitsNeededToDoDamage = 10; public override void SetStaticDefaults() { DisplayName.SetDefault("Flak Crab"); - Main.npcFrameCount[npc.type] = 7; + Main.npcFrameCount[NPC.type] = 7; } public override void SetDefaults() { - npc.width = 28; - npc.height = 70; + NPC.width = 28; + NPC.height = 70; - npc.damage = 10; - npc.lifeMax = 300; + NPC.damage = 10; + NPC.lifeMax = 300; - npc.aiStyle = aiType = -1; + NPC.aiStyle = aiType = -1; if (CalamityWorld.downedPolterghast) { - npc.lifeMax = 4125; - npc.DR_NERD(0.2f); + NPC.lifeMax = 4125; + NPC.DR_NERD(0.2f); } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 5, 55); - npc.lavaImmune = true; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.DD2_WitherBeastDeath; - banner = npc.type; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 5, 55); + NPC.lavaImmune = true; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit41; + NPC.DeathSound = SoundID.DD2_WitherBeastDeath; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) @@ -75,45 +75,45 @@ namespace CalamityMod.NPCs.AcidRain public override void AI() { // Enables expert scaling, if damage is 0 in set defaults expert scaling will not happen. - npc.damage = 0; + NPC.damage = 0; ChasabilityTimer++; - npc.defense = TotalHits < TotalHitsNeededToDoDamage ? 999999 : 20; + NPC.defense = TotalHits < TotalHitsNeededToDoDamage ? 999999 : 20; - if (npc.justHit) + if (NPC.justHit) { FleeCountdownTimer = 240; - npc.netUpdate = true; + NPC.netUpdate = true; } if (FleeCountdownTimer == 0f || TotalHits < TotalHitsNeededToDoDamage) { if (ChasabilityTimer < 300f) { - npc.chaseable = false; - npc.knockBackResist = 0f; + NPC.chaseable = false; + NPC.knockBackResist = 0f; } AcidShootTimer++; - Player closestTargetToTop = Main.player[Player.FindClosest(npc.Top, 0, 0)]; - if (Math.Abs(closestTargetToTop.Center.X - npc.Center.X) < 320f && closestTargetToTop.Center.Y - npc.Top.Y < -60f && AcidShootTimer >= Main.rand.Next(90, 135)) + Player closestTargetToTop = Main.player[Player.FindClosest(NPC.Top, 0, 0)]; + if (Math.Abs(closestTargetToTop.Center.X - NPC.Center.X) < 320f && closestTargetToTop.Center.Y - NPC.Top.Y < -60f && AcidShootTimer >= Main.rand.Next(90, 135)) ShootFlakAcidAtTarget(closestTargetToTop); - npc.velocity.X *= 0.97f; + NPC.velocity.X *= 0.97f; } else { FleeCountdownTimer--; - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { HopTimer++; - npc.knockBackResist = 0.6f; - npc.TargetClosest(true); - npc.velocity.X *= 0.85f; + NPC.knockBackResist = 0.6f; + NPC.TargetClosest(true); + NPC.velocity.X *= 0.85f; - float hopRate = MathHelper.Lerp(25f, 10f, 1f - npc.life / (float)npc.lifeMax); + float hopRate = MathHelper.Lerp(25f, 10f, 1f - NPC.life / (float)NPC.lifeMax); float lungeForwardSpeed = 10f; float jumpSpeed = 9f; - if (Collision.CanHit(npc.Center, 1, 1, Target.Center, 1, 1)) + if (Collision.CanHit(NPC.Center, 1, 1, Target.Center, 1, 1)) lungeForwardSpeed *= 1.5f; if (Main.netMode != NetmodeID.MultiplayerClient && HopTimer > hopRate) @@ -125,21 +125,21 @@ namespace CalamityMod.NPCs.AcidRain lungeForwardSpeed *= 1.5f; HopTimer = 0f; - npc.velocity.Y -= jumpSpeed; - npc.velocity.X = lungeForwardSpeed * -npc.direction; - npc.netUpdate = true; + NPC.velocity.Y -= jumpSpeed; + NPC.velocity.X = lungeForwardSpeed * -NPC.direction; + NPC.netUpdate = true; } } else { - npc.knockBackResist = 0.2f; - npc.velocity.X *= 0.995f; + NPC.knockBackResist = 0.2f; + NPC.velocity.X *= 0.995f; } - npc.chaseable = true; + NPC.chaseable = true; } - if (ChasabilityTimer >= 300f && !npc.chaseable) - npc.chaseable = true; + if (ChasabilityTimer >= 300f && !NPC.chaseable) + NPC.chaseable = true; } public void ShootFlakAcidAtTarget(Player closestTargetToTop) @@ -151,12 +151,12 @@ namespace CalamityMod.NPCs.AcidRain speed *= Main.rand.NextFloat(0.8f, 1.2f); int damage = Main.expertMode ? CalamityWorld.downedPolterghast ? 32 : 18 : CalamityWorld.downedPolterghast ? 42 : 23; - Vector2 spawnPosition = npc.Top + Vector2.UnitY * 6f; + Vector2 spawnPosition = NPC.Top + Vector2.UnitY * 6f; Vector2 shootVelocity = (closestTargetToTop.Center - spawnPosition).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.25f) * speed; Projectile.NewProjectile(spawnPosition, shootVelocity, ModContent.ProjectileType(), damage, 2f); AcidShootTimer = 0; - npc.netUpdate = true; + NPC.netUpdate = true; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -169,54 +169,54 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3 * (CalamityWorld.downedPolterghast ? 5 : 1), 1, 3); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.05f); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3 * (CalamityWorld.downedPolterghast ? 5 : 1), 1, 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.05f); } public override void FindFrame(int frameHeight) { if (TotalHits < TotalHitsNeededToDoDamage) { - npc.frame.Y = 0; + NPC.frame.Y = 0; return; } if (FleeCountdownTimer > 0f) { - if (npc.frameCounter++ % 6 == 5) + if (NPC.frameCounter++ % 6 == 5) { - npc.frame.Y += frameHeight; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type]) + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) { - npc.frame.Y = frameHeight * 3; // Frames 1 and 2 are for transitioning. Frame 0 is sitting still, and the rest are walking frames + NPC.frame.Y = frameHeight * 3; // Frames 1 and 2 are for transitioning. Frame 0 is sitting still, and the rest are walking frames } if (FleeCountdownTimer <= 8) - npc.frame.Y = frameHeight; + NPC.frame.Y = frameHeight; } else - npc.frame.Y = 0; + NPC.frame.Y = 0; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/FlakCrab"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/FlakCrab2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/FlakCrab3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/FlakCrab"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/FlakCrab2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/FlakCrab3"), 1f); } TotalHits++; - npc.netUpdate = true; + NPC.netUpdate = true; } } } diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index c11a5c0c2b..a1debf1d96 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -9,6 +9,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { @@ -16,66 +17,66 @@ namespace CalamityMod.NPCs.AcidRain { public float DustAngleMultiplier1; public float DustAngleMultiplier2; - public Player Target => Main.player[npc.target]; + public Player Target => Main.player[NPC.target]; public float LaserTelegraphPower => Utils.InverseLerp(540f, 480f, LaserShootCountdown, true); public float LaserTelegraphLength => MathHelper.Lerp(20f, 550f, LaserTelegraphPower); public float LaserTelegraphOpacity => MathHelper.Lerp(0.3f, 0.9f, LaserTelegraphPower); - public ref float GammaAcidShootTimer => ref npc.ai[0]; - public ref float LaserShootCountdown => ref npc.ai[1]; + public ref float GammaAcidShootTimer => ref NPC.ai[0]; + public ref float LaserShootCountdown => ref NPC.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Gamma Slime"); - Main.npcFrameCount[npc.type] = 2; + Main.npcFrameCount[NPC.type] = 2; } public override void SetDefaults() { - npc.width = 40; - npc.height = 44; + NPC.width = 40; + NPC.height = 44; - npc.damage = 110; - npc.lifeMax = 5060; - npc.DR_NERD(0.15f); - npc.defense = 25; + NPC.damage = 110; + NPC.lifeMax = 5060; + NPC.DR_NERD(0.15f); + NPC.defense = 25; - npc.aiStyle = aiType = -1; + NPC.aiStyle = aiType = -1; - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; animationType = NPCID.CorruptSlime; - npc.value = Item.buyPrice(0, 0, 8, 30); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 8, 30); + NPC.alpha = 50; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { // Release green light at the position of the slime. - Lighting.AddLight((int)npc.Center.X / 16, (int)npc.Center.Y / 16, 0.6f, 0.8f, 0.6f); + Lighting.AddLight((int)NPC.Center.X / 16, (int)NPC.Center.Y / 16, 0.6f, 0.8f, 0.6f); - npc.TargetClosest(false); + NPC.TargetClosest(false); - if (npc.velocity.Y == 0f && LaserShootCountdown <= 0f && !Target.npcTypeNoAggro[npc.type]) + if (NPC.velocity.Y == 0f && LaserShootCountdown <= 0f && !Target.npcTypeNoAggro[NPC.type]) { - npc.velocity.X *= 0.8f; + NPC.velocity.X *= 0.8f; GammaAcidShootTimer++; // Jump into the air and release gamma acid upward. if (GammaAcidShootTimer % 30f == 29f) { - npc.velocity.Y -= MathHelper.Clamp(Math.Abs(Target.Center.Y - npc.Center.Y) / 16f, 5f, 15f); - npc.velocity.X = npc.SafeDirectionTo(Target.Center).X * 16f; + NPC.velocity.Y -= MathHelper.Clamp(Math.Abs(Target.Center.Y - NPC.Center.Y) / 16f, 5f, 15f); + NPC.velocity.X = NPC.SafeDirectionTo(Target.Center).X * 16f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -84,14 +85,14 @@ namespace CalamityMod.NPCs.AcidRain float angle = MathHelper.TwoPi / 5f * i; if (GammaAcidShootTimer % 60f == 58f) angle += MathHelper.PiOver2; - Projectile.NewProjectile(npc.Center, angle.ToRotationVector2() * 7f, ModContent.ProjectileType(), Main.expertMode ? 36 : 45, 3f); + Projectile.NewProjectile(NPC.Center, angle.ToRotationVector2() * 7f, ModContent.ProjectileType(), Main.expertMode ? 36 : 45, 3f); } } - npc.netUpdate = true; + NPC.netUpdate = true; } } else - npc.velocity.X *= 0.9935f; + NPC.velocity.X *= 0.9935f; if (LaserShootCountdown > 0f) LaserShootCountdown--; @@ -99,15 +100,15 @@ namespace CalamityMod.NPCs.AcidRain // Stop moving for a bit after the laser. if (LaserShootCountdown > 240f) { - npc.velocity.X *= 0.95f; - npc.velocity.Y += 0.2f; + NPC.velocity.X *= 0.95f; + NPC.velocity.Y += 0.2f; } // Hold energy for laser if (LaserShootCountdown > 480f) { float scale = LaserShootCountdown < 530f ? 2.25f : 1.65f; - Vector2 destination = npc.Top + new Vector2(0f, 6f); + Vector2 destination = NPC.Top + new Vector2(0f, 6f); Dust dust = Dust.NewDustPerfect(destination + Main.rand.NextVector2CircularEdge(12f, 12f), (int)CalamityDusts.SulfurousSeaAcid); dust.velocity = Vector2.Normalize(destination - dust.position) * 3f; dust.scale = scale; @@ -115,10 +116,10 @@ namespace CalamityMod.NPCs.AcidRain if (LaserShootCountdown <= 540f) { - for (float i = npc.Top.Y + 4f; i >= npc.Top.Y + 4f - LaserTelegraphLength; i -= 8f) + for (float i = NPC.Top.Y + 4f; i >= NPC.Top.Y + 4f - LaserTelegraphLength; i -= 8f) { float angle = i / 24f; - Vector2 spawnPosition = new Vector2(npc.Center.X, i); + Vector2 spawnPosition = new Vector2(NPC.Center.X, i); dust = Dust.NewDustPerfect(spawnPosition, (int)CalamityDusts.SulfurousSeaAcid); dust.scale = 1.5f; dust.velocity = Vector2.UnitX * (float)Math.Cos(angle) * (1f - LaserTelegraphPower) * 4f; @@ -134,10 +135,10 @@ namespace CalamityMod.NPCs.AcidRain DustAngleMultiplier2 = Main.rand.NextFloat(4f); if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 104); - Projectile.NewProjectile(npc.Center, -Vector2.UnitY, ModContent.ProjectileType(), Main.expertMode ? 96 : 120, 4f, Main.myPlayer, 0f, npc.whoAmI); + SoundEngine.PlaySound(SoundID.Zombie, (int)NPC.position.X, (int)NPC.position.Y, 104); + Projectile.NewProjectile(NPC.Center, -Vector2.UnitY, ModContent.ProjectileType(), Main.expertMode ? 96 : 120, 4f, Main.myPlayer, 0f, NPC.whoAmI); } - npc.netUpdate = true; + NPC.netUpdate = true; } // Very complex particle effects while releasing the beam @@ -147,36 +148,36 @@ namespace CalamityMod.NPCs.AcidRain float horizontalSpeed = (float)Math.Sin(angle * DustAngleMultiplier1) * (float)Math.Cos(angle) * 4.5f; float verticalSpeed = (float)Math.Cos(angle * DustAngleMultiplier1) * (float)Math.Sin(angle) * 2f; Vector2 velocity = new Vector2(horizontalSpeed, verticalSpeed); - Dust dust = Dust.NewDustPerfect(npc.Center + angle.ToRotationVector2() * 8f, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(NPC.Center + angle.ToRotationVector2() * 8f, (int)CalamityDusts.SulfurousSeaAcid); dust.velocity = velocity; dust.scale = (float)Math.Cos(angle) + 2f; dust.noGravity = true; - dust = Dust.NewDustPerfect(npc.Center + angle.ToRotationVector2() * 8f, (int)CalamityDusts.SulfurousSeaAcid); + dust = Dust.NewDustPerfect(NPC.Center + angle.ToRotationVector2() * 8f, (int)CalamityDusts.SulfurousSeaAcid); dust.velocity = -velocity; dust.scale = (float)Math.Cos(angle) + 2f; dust.noGravity = true; } // Randomly prepare to shoot a laser. - if (Main.netMode != NetmodeID.MultiplayerClient && Math.Abs(Target.Center.X - npc.Center.X) < 250f && Target.Center.X < npc.Center.X && - LaserShootCountdown == 0f && Main.rand.NextBool(110) && !Target.npcTypeNoAggro[npc.type]) + if (Main.netMode != NetmodeID.MultiplayerClient && Math.Abs(Target.Center.X - NPC.Center.X) < 250f && Target.Center.X < NPC.Center.X && + LaserShootCountdown == 0f && Main.rand.NextBool(110) && !Target.npcTypeNoAggro[NPC.type]) { LaserShootCountdown = 600f; - npc.netUpdate = true; + NPC.netUpdate = true; } } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 10; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/GammaSlimeGore"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/GammaSlimeGore2"), npc.scale); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/GammaSlimeGore"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/GammaSlimeGore2"), NPC.scale); } } @@ -184,14 +185,14 @@ namespace CalamityMod.NPCs.AcidRain { if (LaserShootCountdown >= 480f && LaserShootCountdown <= 540f) { - Vector2 laserBottom = npc.Top + Vector2.UnitY * 4f; + Vector2 laserBottom = NPC.Top + Vector2.UnitY * 4f; Vector2 laserTop = laserBottom - Vector2.UnitY * LaserTelegraphLength; Utils.DrawLine(spriteBatch, laserBottom, laserTop, Color.Lerp(Color.Lime, Color.Transparent, LaserTelegraphOpacity)); } - CalamityGlobalNPC.DrawGlowmask(npc, spriteBatch, ModContent.GetTexture(Texture + "Glow")); + CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow")); } - public override void NPCLoot() => DropHelper.DropItemChance(npc, ModContent.ItemType(), 30); + public override void NPCLoot() => DropHelper.DropItemChance(NPC, ModContent.ItemType(), 30); public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); } diff --git a/NPCs/AcidRain/IrradiatedSlime.cs b/NPCs/AcidRain/IrradiatedSlime.cs index 9634a3bcd0..4e09504689 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -17,72 +17,72 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { DisplayName.SetDefault("Irradiated Slime"); - Main.npcFrameCount[npc.type] = 2; + Main.npcFrameCount[NPC.type] = 2; } public override void SetDefaults() { - npc.width = 40; - npc.height = 30; + NPC.width = 40; + NPC.height = 30; - npc.damage = 42; - npc.lifeMax = 220; - npc.defense = 5; + NPC.damage = 42; + NPC.lifeMax = 220; + NPC.defense = 5; - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; animationType = NPCID.CorruptSlime; aiType = NPCID.ToxicSludge; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.alpha = 50; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(Falling); - writer.Write(npc.aiStyle); + writer.Write(NPC.aiStyle); } public override void ReceiveExtraAI(BinaryReader reader) { Falling = reader.ReadBoolean(); - npc.aiStyle = reader.ReadInt32(); + NPC.aiStyle = reader.ReadInt32(); } public override void AI() { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.8f, 0.6f); + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.6f, 0.8f, 0.6f); if (Falling) { - npc.TargetClosest(false); - Player player = Main.player[npc.target]; - npc.aiStyle = aiType = -1; + NPC.TargetClosest(false); + Player player = Main.player[NPC.target]; + NPC.aiStyle = aiType = -1; - npc.noTileCollide = npc.noGravity = true; - if (player.Top.Y < npc.Bottom.Y) + NPC.noTileCollide = NPC.noGravity = true; + if (player.Top.Y < NPC.Bottom.Y) { - npc.noTileCollide = npc.noGravity = false; + NPC.noTileCollide = NPC.noGravity = false; Falling = false; - npc.netUpdate = true; + NPC.netUpdate = true; } else { - npc.velocity = Vector2.UnitY * 6f; + NPC.velocity = Vector2.UnitY * 6f; } } else { - npc.aiStyle = 1; + NPC.aiStyle = 1; } } @@ -90,27 +90,27 @@ namespace CalamityMod.NPCs.AcidRain { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/IrradiatedSlime"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/IrradiatedSlime2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/IrradiatedSlime"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/IrradiatedSlime2"), 1f); } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - CalamityGlobalNPC.DrawGlowmask(npc, spriteBatch, ModContent.GetTexture(Texture + "Glow")); + CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow")); } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 30); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 30); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/NPCs/AcidRain/Mauler.cs b/NPCs/AcidRain/Mauler.cs index 265a54b8d4..3331d85571 100644 --- a/NPCs/AcidRain/Mauler.cs +++ b/NPCs/AcidRain/Mauler.cs @@ -10,7 +10,8 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Utilities; -using Terraria.World.Generation; +using Terraria.WorldBuilding; +using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { @@ -24,59 +25,59 @@ namespace CalamityMod.NPCs.AcidRain BigChargeupDash } - public bool InWater => Collision.DrownCollision(npc.Center, 1, 1); - public Player Target => Main.player[npc.target]; + public bool InWater => Collision.DrownCollision(NPC.Center, 1, 1); + public Player Target => Main.player[NPC.target]; public MaulerAttackState CurrentAttack { - get => (MaulerAttackState)(int)npc.ai[0]; - set => npc.ai[0] = (int)value; + get => (MaulerAttackState)(int)NPC.ai[0]; + set => NPC.ai[0] = (int)value; } - public ref float AttackTimer => ref npc.ai[1]; + public ref float AttackTimer => ref NPC.ai[1]; public int CurrentFrame { - get => (int)npc.localAI[0]; - set => npc.localAI[0] = value; + get => (int)NPC.localAI[0]; + set => NPC.localAI[0] = value; } public override void SetStaticDefaults() { DisplayName.SetDefault("Mauler"); - Main.npcFrameCount[npc.type] = 8; + Main.npcFrameCount[NPC.type] = 8; } public override void SetDefaults() { - npc.noGravity = true; - npc.damage = 135; - npc.width = 180; - npc.height = 90; - npc.defense = 50; - npc.DR_NERD(0.05f); - npc.lifeMax = 88500; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.damage = 135; + NPC.width = 180; + NPC.height = 90; + NPC.defense = 50; + NPC.DR_NERD(0.05f); + NPC.lifeMax = 88500; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath60; - npc.knockBackResist = 0f; - npc.rarity = 2; - banner = npc.type; + NPC.value = Item.buyPrice(0, 25, 0, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath60; + NPC.knockBackResist = 0f; + NPC.rarity = 2; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.RemoveWaterSlowness(); - npc.Calamity().canBreakPlayerDefense = true; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.RemoveWaterSlowness(); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.TargetClosest(false); + NPC.TargetClosest(false); // Reset things every frame. They may be changed in the attack states below. - npc.noTileCollide = false; - npc.noGravity = InWater; + NPC.noTileCollide = false; + NPC.noGravity = InWater; switch (CurrentAttack) { @@ -92,16 +93,16 @@ namespace CalamityMod.NPCs.AcidRain } // Emit radioactive light. - Vector2 left = npc.Center - Vector2.UnitX * 15f; - Vector2 right = npc.Center + Vector2.UnitX * 15f; + Vector2 left = NPC.Center - Vector2.UnitX * 15f; + Vector2 right = NPC.Center + Vector2.UnitX * 15f; DelegateMethods.v3_1 = Color.Lime.ToVector3(); Utils.PlotTileLine(left, right, 10f, DelegateMethods.CastLightOpen); // Drift away from the world border. - if (npc.Center.X < (Main.offLimitBorderTiles + 6f) * 16f || npc.Center.X >= (Main.maxTilesX - Main.offLimitBorderTiles - 6f) * 16f) + if (NPC.Center.X < (Main.offLimitBorderTiles + 6f) * 16f || NPC.Center.X >= (Main.maxTilesX - Main.offLimitBorderTiles - 6f) * 16f) { - npc.velocity *= 0.9f; - npc.Center = npc.Center.MoveTowards(Target.Center, 12f); + NPC.velocity *= 0.9f; + NPC.Center = NPC.Center.MoveTowards(Target.Center, 12f); } AttackTimer++; @@ -117,11 +118,11 @@ namespace CalamityMod.NPCs.AcidRain float wrappedAttackTimer = (AttackTimer - roarDelay - shootDelay) % burstShootRate; // Slow down. If necessary, fall. - npc.velocity *= 0.94f; + NPC.velocity *= 0.94f; if (!InWater) { - npc.noTileCollide = true; - npc.position.Y += 6f; + NPC.noTileCollide = true; + NPC.position.Y += 6f; } // Roar prior to releasing bubbles. @@ -131,11 +132,11 @@ namespace CalamityMod.NPCs.AcidRain // Animate as usual a bit after roaring. else if (AttackTimer >= roarDelay + shootDelay) { - npc.frameCounter++; - if (npc.frameCounter >= 5) + NPC.frameCounter++; + if (NPC.frameCounter >= 5) { - CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[npc.type]; - npc.frameCounter = 0; + CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[NPC.type]; + NPC.frameCounter = 0; } // Open the mouth prior to creating bubbles. @@ -143,30 +144,30 @@ namespace CalamityMod.NPCs.AcidRain CurrentFrame = 4; } if (AttackTimer == roarDelay) - Main.PlaySound(SoundID.Zombie, Target.Center, 97); + SoundEngine.PlaySound(SoundID.Zombie, Target.Center, 97); // Rotate towards the target. - int previousSpriteDirection = npc.spriteDirection; - float idealRotation = npc.AngleTo(Target.Center); + int previousSpriteDirection = NPC.spriteDirection; + float idealRotation = NPC.AngleTo(Target.Center); if (previousSpriteDirection == 1) idealRotation += MathHelper.Pi; - npc.spriteDirection = (Target.Center.X < npc.Center.X).ToDirectionInt(); - if (previousSpriteDirection != npc.spriteDirection) - npc.rotation += MathHelper.Pi; + NPC.spriteDirection = (Target.Center.X < NPC.Center.X).ToDirectionInt(); + if (previousSpriteDirection != NPC.spriteDirection) + NPC.rotation += MathHelper.Pi; - npc.rotation = npc.rotation.AngleTowards(idealRotation, 0.125f).AngleLerp(idealRotation, 0.075f); + NPC.rotation = NPC.rotation.AngleTowards(idealRotation, 0.125f).AngleLerp(idealRotation, 0.075f); // Fire the bubble bursts. bool shouldShootBubbles = AttackTimer >= roarDelay + shootDelay && wrappedAttackTimer == burstShootRate - 1f; if (shouldShootBubbles) { - Vector2 mouthPosition = npc.Center + new Vector2(npc.spriteDirection * -56f, 22f).RotatedBy(npc.rotation); - Main.PlaySound(SoundID.Item96, mouthPosition); + Vector2 mouthPosition = NPC.Center + new Vector2(NPC.spriteDirection * -56f, 22f).RotatedBy(NPC.rotation); + SoundEngine.PlaySound(SoundID.Item96, mouthPosition); if (Main.netMode != NetmodeID.MultiplayerClient) { int bubbleShootType = ModContent.ProjectileType(); - int bubbleDamage = npc.GetProjectileDamage(bubbleShootType); - Vector2 baseBubbleShootVelocity = npc.SafeDirectionTo(mouthPosition) * 13.5f; + int bubbleDamage = NPC.GetProjectileDamage(bubbleShootType); + Vector2 baseBubbleShootVelocity = NPC.SafeDirectionTo(mouthPosition) * 13.5f; for (int i = 0; i < bubblesPerBurst; i++) { Vector2 bubbleShootVelocity = baseBubbleShootVelocity + Main.rand.NextVector2Circular(4f, 4f); @@ -174,9 +175,9 @@ namespace CalamityMod.NPCs.AcidRain } // Get launched back after firing. This only happens if in water and there's no obstacles behind. - if (InWater && Collision.CanHit(npc.Center, 1, 1, npc.Center - baseBubbleShootVelocity.SafeNormalize(Vector2.Zero) * 100f, 1, 1)) - npc.velocity -= baseBubbleShootVelocity * 0.62f; - npc.netUpdate = true; + if (InWater && Collision.CanHit(NPC.Center, 1, 1, NPC.Center - baseBubbleShootVelocity.SafeNormalize(Vector2.Zero) * 100f, 1, 1)) + NPC.velocity -= baseBubbleShootVelocity * 0.62f; + NPC.netUpdate = true; } } @@ -192,45 +193,45 @@ namespace CalamityMod.NPCs.AcidRain int chargeTime = 72; int acidShootRate = 4; float chargeSpeed = 24.5f; - ref float stuckTimer = ref npc.ai[2]; - ref float chargeDirection = ref npc.ai[3]; + ref float stuckTimer = ref NPC.ai[2]; + ref float chargeDirection = ref NPC.ai[3]; // Select frames. - npc.frameCounter++; - if (npc.frameCounter >= 5) + NPC.frameCounter++; + if (NPC.frameCounter >= 5) { - CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[npc.type]; - npc.frameCounter = 0; + CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[NPC.type]; + NPC.frameCounter = 0; } // Decide the rotation and direction. - npc.rotation = npc.velocity.X * 0.0125f; - if (Math.Abs(npc.velocity.X) > 0.1f) - npc.spriteDirection = (npc.velocity.X < 0f).ToDirectionInt(); + NPC.rotation = NPC.velocity.X * 0.0125f; + if (Math.Abs(NPC.velocity.X) > 0.1f) + NPC.spriteDirection = (NPC.velocity.X < 0f).ToDirectionInt(); if (AttackTimer < chargeDelay + chargePreparationTime) - npc.spriteDirection = (Target.Center.X < npc.Center.X).ToDirectionInt(); + NPC.spriteDirection = (Target.Center.X < NPC.Center.X).ToDirectionInt(); // Move through tiles and attempt to reach water if stuck on land. - Vector2 idealPosition = Target.Center + Vector2.UnitX * (Target.Center.X < npc.Center.X).ToDirectionInt() * 480f; + Vector2 idealPosition = Target.Center + Vector2.UnitX * (Target.Center.X < NPC.Center.X).ToDirectionInt() * 480f; if (!InWater && AttackTimer < chargeDelay) { - npc.noTileCollide = true; - npc.noGravity = true; + NPC.noTileCollide = true; + NPC.noGravity = true; AttackTimer = 0f; if (WorldUtils.Find(idealPosition.ToTileCoordinates(), Searches.Chain(new Searches.Down(1500), new CustomConditions.IsWater()), out Point hitPoint)) idealPosition = hitPoint.ToWorldCoordinates(); - Vector2 idealVelocity = npc.SafeDirectionTo(idealPosition) * 20f; + Vector2 idealVelocity = NPC.SafeDirectionTo(idealPosition) * 20f; // Move towards the ideal position. - if (!npc.WithinRange(idealPosition, 120f)) - npc.velocity = Vector2.Lerp(npc.velocity, idealVelocity, 0.05f); + if (!NPC.WithinRange(idealPosition, 120f)) + NPC.velocity = Vector2.Lerp(NPC.velocity, idealVelocity, 0.05f); // Give up and do another attack if unable to find water. stuckTimer++; if (stuckTimer >= stuckGiveupTime) { - npc.Opacity = 1f; + NPC.Opacity = 1f; SelectNextAttack(); } } @@ -238,7 +239,7 @@ namespace CalamityMod.NPCs.AcidRain stuckTimer = 0f; // Handle opacity. When not in water, become almost completely transparent. - npc.Opacity = MathHelper.Clamp(npc.Opacity + InWater.ToDirectionInt() * 0.04f, 0.33f, 1f); + NPC.Opacity = MathHelper.Clamp(NPC.Opacity + InWater.ToDirectionInt() * 0.04f, 0.33f, 1f); // Charge and release homing acid upward. if (AttackTimer >= chargeDelay && AttackTimer < chargeDelay + chargePreparationTime) @@ -246,39 +247,39 @@ namespace CalamityMod.NPCs.AcidRain // Define the charge direction. if (chargeDirection == 0f) { - chargeDirection = (Target.Center.X > npc.Center.X).ToDirectionInt(); - npc.netUpdate = true; + chargeDirection = (Target.Center.X > NPC.Center.X).ToDirectionInt(); + NPC.netUpdate = true; } - npc.position.Y += npc.SafeDirectionTo(Target.Center).Y * 8f; - npc.velocity = Vector2.Lerp(npc.velocity, Vector2.UnitX * chargeDirection * chargeSpeed, 0.075f); + NPC.position.Y += NPC.SafeDirectionTo(Target.Center).Y * 8f; + NPC.velocity = Vector2.Lerp(NPC.velocity, Vector2.UnitX * chargeDirection * chargeSpeed, 0.075f); } bool isCharging = AttackTimer >= chargeDelay + chargePreparationTime && AttackTimer < chargeDelay + chargePreparationTime + chargeTime; bool shouldShootAcid = isCharging && AttackTimer % acidShootRate == acidShootRate - 1f; if (shouldShootAcid) { - Main.PlaySound(SoundID.Item95, npc.Center); + SoundEngine.PlaySound(SoundID.Item95, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int acidShootType = ModContent.ProjectileType(); - int acidDamage = npc.GetProjectileDamage(acidShootType); - Vector2 acidSpawnPosition = npc.Center + Main.rand.NextVector2Circular(30f, 10f).RotatedBy(npc.rotation); + int acidDamage = NPC.GetProjectileDamage(acidShootType); + Vector2 acidSpawnPosition = NPC.Center + Main.rand.NextVector2Circular(30f, 10f).RotatedBy(NPC.rotation); Vector2 acidShootVelocity = -Vector2.UnitY.RotatedByRandom(0.33f) * Main.rand.NextFloat(8f, 10.5f); Projectile.NewProjectile(acidSpawnPosition, acidShootVelocity, acidShootType, acidDamage, 0f); - npc.netUpdate = true; + NPC.netUpdate = true; } } - if (npc.velocity.Length() < 0.4f) - npc.velocity = Vector2.Zero; + if (NPC.velocity.Length() < 0.4f) + NPC.velocity = Vector2.Zero; - Vector2 aheadPosition = npc.position + npc.velocity.SafeNormalize(Vector2.UnitX * -npc.spriteDirection) * 150f; - bool stuckWhileCharging = !Collision.CanHit(npc.position, npc.width, npc.height, aheadPosition, npc.width, npc.height) || - Collision.SolidCollision(npc.position, npc.width, npc.height); + Vector2 aheadPosition = NPC.position + NPC.velocity.SafeNormalize(Vector2.UnitX * -NPC.spriteDirection) * 150f; + bool stuckWhileCharging = !Collision.CanHit(NPC.position, NPC.width, NPC.height, aheadPosition, NPC.width, NPC.height) || + Collision.SolidCollision(NPC.position, NPC.width, NPC.height); stuckWhileCharging &= isCharging; if (AttackTimer >= chargeDelay + chargePreparationTime + chargeTime || stuckWhileCharging) { - npc.velocity *= 0.5f; + NPC.velocity *= 0.5f; SelectNextAttack(); } } @@ -288,59 +289,59 @@ namespace CalamityMod.NPCs.AcidRain int chargeDelay = 105; int telegraphTime = 60; int chargeTime = 50; - float chargeSpeed = MathHelper.Clamp(npc.Distance(Target.Center) / chargeTime * 1.35f, 29f, 45f); + float chargeSpeed = MathHelper.Clamp(NPC.Distance(Target.Center) / chargeTime * 1.35f, 29f, 45f); bool hasCharged = AttackTimer >= chargeDelay; // Slow down at first. If necessary, fall. if (!hasCharged) { - npc.velocity *= 0.94f; - npc.noGravity = true; + NPC.velocity *= 0.94f; + NPC.noGravity = true; } // Select frames. - npc.frameCounter++; - if (npc.frameCounter >= (hasCharged ? 4 : 7)) + NPC.frameCounter++; + if (NPC.frameCounter >= (hasCharged ? 4 : 7)) { - CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[npc.type]; - npc.frameCounter = 0; + CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[NPC.type]; + NPC.frameCounter = 0; } // Open the mouth if close to the target after charging. - if (CurrentFrame < 4 && npc.WithinRange(Target.Center, 200f) && AttackTimer > chargeDelay) + if (CurrentFrame < 4 && NPC.WithinRange(Target.Center, 200f) && AttackTimer > chargeDelay) CurrentFrame = 4; // Rotate towards the target at first. - int previousSpriteDirection = npc.spriteDirection; - float idealRotation = npc.AngleTo(Target.Center); + int previousSpriteDirection = NPC.spriteDirection; + float idealRotation = NPC.AngleTo(Target.Center); if (previousSpriteDirection == 1) idealRotation += MathHelper.Pi; // Roar as a telegraph. The placement of the sound is offset such that the player and ideally determine the determine where the charge will come from. if (AttackTimer == chargeDelay - telegraphTime) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), Target.Center + Target.SafeDirectionTo(npc.Center) * 300f); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), Target.Center + Target.SafeDirectionTo(NPC.Center) * 300f); // Charge. if (AttackTimer == chargeDelay) { - Main.PlaySound(SoundID.DD2_FlameburstTowerShot, Target.Center); - npc.velocity = npc.SafeDirectionTo(Target.Center) * chargeSpeed; - npc.netUpdate = true; + SoundEngine.PlaySound(SoundID.DD2_FlameburstTowerShot, Target.Center); + NPC.velocity = NPC.SafeDirectionTo(Target.Center) * chargeSpeed; + NPC.netUpdate = true; } if (!hasCharged) { - npc.spriteDirection = (Target.Center.X < npc.Center.X).ToDirectionInt(); - if (previousSpriteDirection != npc.spriteDirection) - npc.rotation += MathHelper.Pi; + NPC.spriteDirection = (Target.Center.X < NPC.Center.X).ToDirectionInt(); + if (previousSpriteDirection != NPC.spriteDirection) + NPC.rotation += MathHelper.Pi; - npc.rotation = npc.rotation.AngleTowards(idealRotation, 0.18f).AngleLerp(idealRotation, 0.08f); + NPC.rotation = NPC.rotation.AngleTowards(idealRotation, 0.18f).AngleLerp(idealRotation, 0.08f); } else { - npc.noGravity = npc.noTileCollide = true; - npc.rotation = npc.velocity.ToRotation(); + NPC.noGravity = NPC.noTileCollide = true; + NPC.rotation = NPC.velocity.ToRotation(); if (previousSpriteDirection == 1) - npc.rotation += MathHelper.Pi; + NPC.rotation += MathHelper.Pi; } if (AttackTimer >= chargeDelay + chargeTime) @@ -351,14 +352,14 @@ namespace CalamityMod.NPCs.AcidRain { // Reset the attack timer and optional attack variables. AttackTimer = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; MaulerAttackState oldAttack = CurrentAttack; bool targetDefinitelyNotNearWater = false; - bool isInCrampedPosition = Collision.SolidCollision(npc.Center - Vector2.One * 150f, 300, 300) && InWater; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + bool isInCrampedPosition = Collision.SolidCollision(NPC.Center - Vector2.One * 150f, 300, 300) && InWater; + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) isInCrampedPosition = true; // Register the target as not near water if they have left the ocean. @@ -389,25 +390,25 @@ namespace CalamityMod.NPCs.AcidRain if (targetDefinitelyNotNearWater || isInCrampedPosition) CurrentAttack = MaulerAttackState.BigChargeupDash; - npc.netUpdate = true; + NPC.netUpdate = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Texture2D texture = Main.npcTexture[npc.type]; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/NPCs/AcidRain/MaulerGlowmask"); - Vector2 drawPosition = npc.Center - Main.screenPosition + Vector2.UnitY * npc.gfxOffY; - Vector2 origin = npc.frame.Size() * 0.5f; - SpriteEffects direction = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Main.npcTexture[NPC.type]; + Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/AcidRain/MaulerGlowmask"); + Vector2 drawPosition = NPC.Center - Main.screenPosition + Vector2.UnitY * NPC.gfxOffY; + Vector2 origin = NPC.frame.Size() * 0.5f; + SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - spriteBatch.Draw(texture, drawPosition, npc.frame, npc.GetAlpha(drawColor), npc.rotation, origin, npc.scale, direction, 0f); - spriteBatch.Draw(glowmask, drawPosition, npc.frame, npc.GetAlpha(Color.White), npc.rotation, origin, npc.scale, direction, 0f); + spriteBatch.Draw(texture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, direction, 0f); + spriteBatch.Draw(glowmask, drawPosition, NPC.frame, NPC.GetAlpha(Color.White), NPC.rotation, origin, NPC.scale, direction, 0f); return false; } public override void FindFrame(int frameHeight) { - npc.frame.Y = CurrentFrame * frameHeight; + NPC.frame.Y = CurrentFrame * frameHeight; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -417,10 +418,10 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3); // Drop shark fins. They are specially colored to match the color of maulers. - int item = Item.NewItem(npc.Center, npc.Size, ItemID.SharkFin, Main.rand.Next(2, 5), false, 0, false, false); + int item = Item.NewItem(NPC.Center, NPC.Size, ItemID.SharkFin, Main.rand.Next(2, 5), false, 0, false, false); Main.item[item].color = new Color(151, 115, 57, 255); NetMessage.SendData(MessageID.ItemTweaker, -1, -1, null, item, 1f, 0f, 0f, 0, 0, 0); } @@ -428,16 +429,16 @@ namespace CalamityMod.NPCs.AcidRain public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 30; k++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Mauler"), NPC.scale); for (int i = 2; i <= 5; i++) - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot($"Gores/Mauler{i}"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot($"Gores/Mauler{i}"), NPC.scale); } } } diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index 879ff0793a..d79ceebcdd 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -10,6 +10,7 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; +using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { @@ -28,20 +29,20 @@ namespace CalamityMod.NPCs.AcidRain public bool Walking = false; public float JumpTimer = 0f; public Vector2 ShootPosition; - public Player Target => Main.player[npc.target]; - public ref float AttackTime => ref npc.ai[0]; - public ref float TeleportCountdown => ref npc.ai[1]; + public Player Target => Main.player[NPC.target]; + public ref float AttackTime => ref NPC.ai[0]; + public ref float TeleportCountdown => ref NPC.ai[1]; public Vector2 TeleportLocation { - get => new Vector2(npc.ai[2], npc.ai[3]); + get => new Vector2(NPC.ai[2], NPC.ai[3]); set { - npc.ai[2] = value.X; - npc.ai[3] = value.Y; + NPC.ai[2] = value.X; + NPC.ai[3] = value.Y; } } - public ref float HorizontalCollisionCounterDelay => ref npc.localAI[0]; - public ref float HorizontalCollisionSpamCounter => ref npc.localAI[1]; + public ref float HorizontalCollisionCounterDelay => ref NPC.localAI[0]; + public ref float HorizontalCollisionSpamCounter => ref NPC.localAI[1]; public static readonly SpecialAttackState[] PhaseArray = new SpecialAttackState[] { SpecialAttackState.ShotgunBurstOfBullets, @@ -70,38 +71,38 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { DisplayName.SetDefault("Nuclear Terror"); - Main.npcFrameCount[npc.type] = 14; - NPCID.Sets.TrailCacheLength[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 14; + NPCID.Sets.TrailCacheLength[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; + NPC.Calamity().canBreakPlayerDefense = true; - npc.width = 176; - npc.height = 138; - npc.aiStyle = aiType = -1; + NPC.width = 176; + NPC.height = 138; + NPC.aiStyle = aiType = -1; - npc.lifeMax = 90000; - npc.defense = 50; - npc.damage = 135; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 20, 0, 0); - npc.DR_NERD(0.3f); - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit56; - npc.DeathSound = SoundID.NPCDeath60; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.lifeMax = 90000; + NPC.defense = 50; + NPC.damage = 135; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 20, 0, 0); + NPC.DR_NERD(0.3f); + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit56; + NPC.DeathSound = SoundID.NPCDeath60; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); writer.Write(Dying); writer.Write(Walking); writer.Write(AttackIndex); @@ -111,7 +112,7 @@ namespace CalamityMod.NPCs.AcidRain } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); Dying = reader.ReadBoolean(); Walking = reader.ReadBoolean(); AttackIndex = reader.ReadInt32(); @@ -122,31 +123,31 @@ namespace CalamityMod.NPCs.AcidRain public override void AI() { - Lighting.AddLight(npc.Center, (Dying ? Color.Lime.ToVector3() : Color.White.ToVector3()) * 2f); + Lighting.AddLight(NPC.Center, (Dying ? Color.Lime.ToVector3() : Color.White.ToVector3()) * 2f); if (Dying) return; - bool phase2 = npc.life / (float)npc.lifeMax < 0.5f; + bool phase2 = NPC.life / (float)NPC.lifeMax < 0.5f; if (DelayTime > 0) { DelayTime--; - npc.velocity.X *= 0.9f; - if (npc.velocity.Y < 18f) - npc.velocity.Y += 0.35f; + NPC.velocity.X *= 0.9f; + if (NPC.velocity.Y < 18f) + NPC.velocity.Y += 0.35f; return; } - if (npc.target < 0 || npc.target >= 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + if (NPC.target < 0 || NPC.target >= 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) { - npc.TargetClosest(false); - npc.netUpdate = true; + NPC.TargetClosest(false); + NPC.netUpdate = true; } if (TeleportCountdown > -TeleportCooldown) TeleportEffects(); - npc.defDamage = 170; - npc.damage = Dying ? 0 : npc.defDamage; + NPC.defDamage = 170; + NPC.damage = Dying ? 0 : NPC.defDamage; TeleportCheck(); AttackTime++; @@ -155,7 +156,7 @@ namespace CalamityMod.NPCs.AcidRain Walking = false; // Teleport if spam-collisions are done, they are pretty good indicators of being stuck. - if (npc.collideX) + if (NPC.collideX) { if (HorizontalCollisionCounterDelay > 0) HorizontalCollisionSpamCounter++; @@ -167,56 +168,56 @@ namespace CalamityMod.NPCs.AcidRain if (wrappedAttackTime < 240f) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { JumpTimer++; - npc.velocity.X *= 0.8f; + NPC.velocity.X *= 0.8f; // Jump towards the target if enough time has passed or they're not in this enemy's line of sight. - if (JumpTimer >= 70f || !Collision.CanHit(npc.position, npc.width, npc.height, Target.position, Target.width, Target.height)) + if (JumpTimer >= 70f || !Collision.CanHit(NPC.position, NPC.width, NPC.height, Target.position, Target.width, Target.height)) { JumpTimer = 0f; - npc.velocity.Y -= MathHelper.Clamp(Math.Abs(Target.Center.Y - npc.Center.Y) / 12.5f, 8f, 18f); - npc.velocity.X = npc.SafeDirectionTo(Target.Center).X * 18f; - npc.netUpdate = true; + NPC.velocity.Y -= MathHelper.Clamp(Math.Abs(Target.Center.Y - NPC.Center.Y) / 12.5f, 8f, 18f); + NPC.velocity.X = NPC.SafeDirectionTo(Target.Center).X * 18f; + NPC.netUpdate = true; } else { - if (Walking != Math.Abs(npc.velocity.X) > 4f) + if (Walking != Math.Abs(NPC.velocity.X) > 4f) { - Walking = Math.Abs(npc.velocity.X) > 4f; - npc.netUpdate = true; + Walking = Math.Abs(NPC.velocity.X) > 4f; + NPC.netUpdate = true; } // Force a jump the next frame to overcome any horizontal obstacles if they exist. - if (npc.collideX) + if (NPC.collideX) { JumpTimer = 50; - npc.netUpdate = true; + NPC.netUpdate = true; } // Otherwise walk towards the target if they're not super close. - else if (Math.Abs(Target.Center.X - npc.Center.X) > 125f) + else if (Math.Abs(Target.Center.X - NPC.Center.X) > 125f) { - npc.velocity.X += Math.Sign(npc.SafeDirectionTo(Target.Center).X) * 3f; - npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -28f, 28f); + NPC.velocity.X += Math.Sign(NPC.SafeDirectionTo(Target.Center).X) * 3f; + NPC.velocity.X = MathHelper.Clamp(NPC.velocity.X, -28f, 28f); } // If they are close though, slow down horizontally. else - npc.velocity.X *= 0.99f; + NPC.velocity.X *= 0.99f; } } - npc.spriteDirection = (npc.velocity.X < 0).ToDirectionInt(); + NPC.spriteDirection = (NPC.velocity.X < 0).ToDirectionInt(); } else { - npc.velocity.X *= 0.96f; + NPC.velocity.X *= 0.96f; if (wrappedAttackTime == 255f) { ShootPosition = Target.Center; - npc.netUpdate = true; - npc.spriteDirection = (ShootPosition.X - npc.Center.X < 0).ToDirectionInt(); + NPC.netUpdate = true; + NPC.spriteDirection = (ShootPosition.X - NPC.Center.X < 0).ToDirectionInt(); } PerformSpecialAttack(wrappedAttackTime); @@ -231,16 +232,16 @@ namespace CalamityMod.NPCs.AcidRain } public void TeleportCheck() { - float distanceFromTarget = npc.Distance(Target.Center); + float distanceFromTarget = NPC.Distance(Target.Center); bool targetIsFarOff = distanceFromTarget > 900f; - bool targetNotInLineOfSight = !Collision.CanHit(npc.position, npc.width, npc.height, Target.position, Target.width, Target.height); + bool targetNotInLineOfSight = !Collision.CanHit(NPC.position, NPC.width, NPC.height, Target.position, Target.width, Target.height); if (TeleportCountdown <= -TeleportCooldown) { - if (distanceFromTarget <= 2700f && !(targetIsFarOff && targetNotInLineOfSight) && !StuckOnPlatform() && !npc.wet && HorizontalCollisionSpamCounter <= 5f) + if (distanceFromTarget <= 2700f && !(targetIsFarOff && targetNotInLineOfSight) && !StuckOnPlatform() && !NPC.wet && HorizontalCollisionSpamCounter <= 5f) return; Point playerPositionTileCoords = Target.position.ToTileCoordinates(); - Point npcPositionTileCoords = npc.position.ToTileCoordinates(); + Point npcPositionTileCoords = NPC.position.ToTileCoordinates(); for (int tries = 0; tries < 250; tries++) { @@ -257,7 +258,7 @@ namespace CalamityMod.NPCs.AcidRain Tile tileBelow = CalamityUtils.ParanoidTileRetrieval(x, y - 1); bool veryCloseToTarget = Math.Abs(y - playerPositionTileCoords.Y) < 12 || Math.Abs(x - playerPositionTileCoords.X) < 12; bool veryCloseToSelf = Math.Abs(y - npcPositionTileCoords.Y) < 12 || Math.Abs(x - npcPositionTileCoords.X) < 12; - bool solidGround = (Main.tileSolid[tileBelow.type] || Main.tileSolidTop[tileBelow.type]) && tileBelow.active(); + bool solidGround = (Main.tileSolid[tileBelow.TileType] || Main.tileSolidTop[tileBelow.TileType]) && tileBelow.active(); if (!veryCloseToTarget && !veryCloseToSelf && solidGround) { // If the below tile has lava, skip it. @@ -278,7 +279,7 @@ namespace CalamityMod.NPCs.AcidRain TeleportCountdown = TeleportTime; TeleportLocation = new Vector2(x, y - 6f); HorizontalCollisionSpamCounter = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; return; Continue: @@ -298,27 +299,27 @@ namespace CalamityMod.NPCs.AcidRain { if (TeleportCountdown == 0f && TeleportLocation != Vector2.Zero) { - npc.position = TeleportLocation.ToWorldCoordinates(8f, 0f) - npc.Size; - npc.netUpdate = true; - npc.velocity = Vector2.Zero; + NPC.position = TeleportLocation.ToWorldCoordinates(8f, 0f) - NPC.Size; + NPC.netUpdate = true; + NPC.velocity = Vector2.Zero; } else { - npc.Opacity = TeleportCountdown / TeleportTime; + NPC.Opacity = TeleportCountdown / TeleportTime; - int totalDust = (int)(30 * npc.alpha / 255f); + int totalDust = (int)(30 * NPC.alpha / 255f); for (int i = 0; i < totalDust; i++) { - Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid); dust.noGravity = true; - dust.velocity = npc.DirectionFrom(dust.position) * 2f; + dust.velocity = NPC.DirectionFrom(dust.position) * 2f; dust.scale = 1.6f; } // Fall and slow down horizontally. - npc.velocity.X *= 0.95f; - if (npc.velocity.Y < 18f) - npc.velocity.Y += 0.35f; + NPC.velocity.X *= 0.95f; + if (NPC.velocity.Y < 18f) + NPC.velocity.Y += 0.35f; } return; } @@ -326,14 +327,14 @@ namespace CalamityMod.NPCs.AcidRain // Release some dust before going back to normal. if (TeleportCountdown >= -TeleportFadeinTime) { - npc.Opacity = TeleportCountdown / -TeleportFadeinTime; + NPC.Opacity = TeleportCountdown / -TeleportFadeinTime; if (TeleportCountdown == -TeleportFadeinTime) { for (int i = 0; i < 48; i++) { - Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid); dust.noGravity = true; - dust.velocity = npc.DirectionFrom(dust.position) * Main.rand.NextFloat(2f, 3.6f); + dust.velocity = NPC.DirectionFrom(dust.position) * Main.rand.NextFloat(2f, 3.6f); dust.scale = 1.8f; } } @@ -344,8 +345,8 @@ namespace CalamityMod.NPCs.AcidRain { for (int i = -12; i < 12; i++) { - Point bottom = (npc.Bottom + Vector2.UnitY * i).ToTileCoordinates(); - if (TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(bottom.X, bottom.Y).type] && Target.Top.Y > npc.Bottom.Y + 48) + Point bottom = (NPC.Bottom + Vector2.UnitY * i).ToTileCoordinates(); + if (TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(bottom.X, bottom.Y).TileType] && Target.Top.Y > NPC.Bottom.Y + 48) return true; } return false; @@ -353,16 +354,16 @@ namespace CalamityMod.NPCs.AcidRain public void PerformSpecialAttack(float wrappedAttackTime) { - Vector2 mouthPosition = npc.Center - Vector2.UnitY * 26f; - mouthPosition.X += npc.spriteDirection * -54f; + Vector2 mouthPosition = NPC.Center - Vector2.UnitY * 26f; + mouthPosition.X += NPC.spriteDirection * -54f; TeleportCountdown = -TeleportCooldown; - Vector2 directionToTarget = (Target.Center - mouthPosition).SafeNormalize(Vector2.UnitX * npc.spriteDirection); - Vector2 directionToShootPosition = (ShootPosition - mouthPosition).SafeNormalize(Vector2.UnitX * npc.spriteDirection); + Vector2 directionToTarget = (Target.Center - mouthPosition).SafeNormalize(Vector2.UnitX * NPC.spriteDirection); + Vector2 directionToShootPosition = (ShootPosition - mouthPosition).SafeNormalize(Vector2.UnitX * NPC.spriteDirection); switch (PhaseArray[AttackIndex]) { case SpecialAttackState.DivergingBullets: - npc.velocity.X *= 0.9f; + NPC.velocity.X *= 0.9f; float shootAdjustedTime = wrappedAttackTime - (AttackCycleTime - SpecialAttackTime); bool shouldShoot = shootAdjustedTime >= 20f; shouldShoot &= (shootAdjustedTime - 20f) % 30f < 12f; @@ -377,8 +378,8 @@ namespace CalamityMod.NPCs.AcidRain int bullet = Projectile.NewProjectile(mouthPosition, directionToShootPosition.RotatedBy(angle) * 14f, ModContent.ProjectileType(), 48, 4f); Main.projectile[bullet].localAI[0] = angle; } - npc.spriteDirection = (ShootPosition.X - npc.Center.X < 0).ToDirectionInt(); - Main.PlaySound(SoundID.NPCDeath13, mouthPosition); + NPC.spriteDirection = (ShootPosition.X - NPC.Center.X < 0).ToDirectionInt(); + SoundEngine.PlaySound(SoundID.NPCDeath13, mouthPosition); } if (wrappedAttackTime >= (AttackCycleTime - SpecialAttackTime + 35f) && AttackTime % 10f == 9f) Projectile.NewProjectile(mouthPosition, directionToTarget * 12f, ModContent.ProjectileType(), 48, 3f); @@ -392,7 +393,7 @@ namespace CalamityMod.NPCs.AcidRain Projectile.NewProjectile(mouthPosition, directionToTarget.RotatedBy(angle) * 16f, ModContent.ProjectileType(), 48, 4.5f); Projectile.NewProjectile(mouthPosition, directionToTarget.RotatedBy(-angle) * 16f, ModContent.ProjectileType(), 48, 4.5f); } - npc.spriteDirection = (Target.Center.X - npc.Center.X < 0).ToDirectionInt(); + NPC.spriteDirection = (Target.Center.X - NPC.Center.X < 0).ToDirectionInt(); } break; case SpecialAttackState.ShotgunBurstOfBullets: @@ -406,7 +407,7 @@ namespace CalamityMod.NPCs.AcidRain Projectile.NewProjectile(mouthPosition, directionToShootPosition.RotatedBy(angle) * 13f, ModContent.ProjectileType(), 48, 4f); } } - npc.spriteDirection = (ShootPosition.X - npc.Center.X < 0).ToDirectionInt(); + NPC.spriteDirection = (ShootPosition.X - NPC.Center.X < 0).ToDirectionInt(); } break; } @@ -414,26 +415,26 @@ namespace CalamityMod.NPCs.AcidRain public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * 0.85f); } public override void FindFrame(int frameHeight) { - npc.frameCounter++; + NPC.frameCounter++; int frameChangeRate = Dying ? 7 : 6; // Walk faster the faster this thing is moving. if (Walking) - frameChangeRate = 8 - (int)Math.Ceiling(Math.Abs(npc.velocity.X) / 5f); + frameChangeRate = 8 - (int)Math.Ceiling(Math.Abs(NPC.velocity.X) / 5f); - if (npc.frameCounter >= frameChangeRate) + if (NPC.frameCounter >= frameChangeRate) { - npc.frame.Y += frameHeight; - npc.frameCounter = 0; + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0; } if (Dying) { - if (npc.frame.Y < frameHeight * 8) + if (NPC.frame.Y < frameHeight * 8) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -441,33 +442,33 @@ namespace CalamityMod.NPCs.AcidRain { int type = Main.rand.NextBool(4) ? ModContent.ProjectileType() : ModContent.ProjectileType(); float angle = MathHelper.TwoPi / 16f * i; - Projectile.NewProjectile(npc.Center, angle.ToRotationVector2() * Main.rand.NextFloat(4f, 11f), type, 48, 3f); + Projectile.NewProjectile(NPC.Center, angle.ToRotationVector2() * Main.rand.NextFloat(4f, 11f), type, 48, 3f); } } for (int i = 0; i < 60; i++) { - Dust dust = Dust.NewDustDirect(npc.Center, 45, 45, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustDirect(NPC.Center, 45, 45, (int)CalamityDusts.SulfurousSeaAcid); dust.velocity = Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(4f, 15f); dust.noGravity = true; dust.scale = Main.rand.NextFloat(2f, 3f); } - npc.frame.Y = frameHeight * 8; + NPC.frame.Y = frameHeight * 8; } - if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type]) - npc.StrikeNPCNoInteraction(9999, 0f, 0); + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + NPC.StrikeNPCNoInteraction(9999, 0f, 0); } - else if (npc.frame.Y >= (Walking ? 8 : 4) * frameHeight) - npc.frame.Y = Walking ? 4 * frameHeight : 0; + else if (NPC.frame.Y >= (Walking ? 8 : 4) * frameHeight) + NPC.frame.Y = Walking ? 4 * frameHeight : 0; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - if (npc.velocity.Length() > 0f) + if (NPC.velocity.Length() > 0f) { Color endColor = Color.DarkOliveGreen; endColor.A = Color.Transparent.A; - CalamityGlobalNPC.DrawAfterimage(npc, spriteBatch, drawColor, endColor, directioning: true, invertedDirection: true); + CalamityGlobalNPC.DrawAfterimage(NPC, spriteBatch, drawColor, endColor, directioning: true, invertedDirection: true); } - CalamityGlobalNPC.DrawGlowmask(npc, spriteBatch, null, true); + CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, null, true); return false; } @@ -476,11 +477,11 @@ namespace CalamityMod.NPCs.AcidRain if (!Dying) { Dying = true; - npc.active = true; - npc.life = 1; - npc.dontTakeDamage = true; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; + NPC.active = true; + NPC.life = 1; + NPC.dontTakeDamage = true; + NPC.velocity = Vector2.Zero; + NPC.netUpdate = true; return false; } return Dying; @@ -489,15 +490,15 @@ namespace CalamityMod.NPCs.AcidRain public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 10; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3); } } } diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index 8a279405a7..85da12a02f 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -10,93 +10,94 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { public class NuclearToad : ModNPC { - public Player Target => Main.player[npc.target]; + public Player Target => Main.player[NPC.target]; public override void SetStaticDefaults() { DisplayName.SetDefault("Nuclear Toad"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.width = 62; - npc.height = 34; - npc.defense = 4; + NPC.width = 62; + NPC.height = 34; + NPC.defense = 4; - npc.aiStyle = aiType = -1; + NPC.aiStyle = aiType = -1; - npc.damage = 15; - npc.lifeMax = 60; - npc.defense = 3; + NPC.damage = 15; + NPC.lifeMax = 60; + NPC.defense = 3; if (CalamityWorld.downedPolterghast) { - npc.damage = 80; - npc.lifeMax = 2750; - npc.defense = 15; + NPC.damage = 80; + NPC.lifeMax = 2750; + NPC.defense = 15; } else if (CalamityWorld.downedAquaticScourge) { - npc.damage = 35; - npc.lifeMax = 200; + NPC.damage = 35; + NPC.lifeMax = 200; } - npc.knockBackResist = 0.7f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.lavaImmune = false; - npc.noGravity = true; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.knockBackResist = 0.7f; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.lavaImmune = false; + NPC.noGravity = true; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.TargetClosest(false); + NPC.TargetClosest(false); // Slow down over time on the X axis (to prevent endless sliding as a result of KB). - npc.velocity.X *= 0.96f; + NPC.velocity.X *= 0.96f; // Bob on the top of the water. - if (npc.wet) + if (NPC.wet) { - if (npc.velocity.Y > 2f) - npc.velocity.Y *= 0.9f; - npc.velocity.Y -= 0.16f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; + if (NPC.velocity.Y > 2f) + NPC.velocity.Y *= 0.9f; + NPC.velocity.Y -= 0.16f; + if (NPC.velocity.Y < -4f) + NPC.velocity.Y = -4f; } else { - if (npc.velocity.Y < -2f) - npc.velocity.Y *= 0.9f; - npc.velocity.Y += 0.16f; - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.ai[0] = 5f; + if (NPC.velocity.Y < -2f) + NPC.velocity.Y *= 0.9f; + NPC.velocity.Y += 0.16f; + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.ai[0] = 5f; } // Make a frog croak sound from time to time. if (Main.rand.NextBool(480)) - Main.PlaySound(SoundID.Zombie, npc.Center, 13); + SoundEngine.PlaySound(SoundID.Zombie, NPC.Center, 13); float explodeDistance = CalamityWorld.downedAquaticScourge ? 295f : 195f; if (CalamityWorld.downedPolterghast) explodeDistance = 470f; // Explode if a player gets too close. - if (npc.WithinRange(Target.Center, explodeDistance)) + if (NPC.WithinRange(Target.Center, explodeDistance)) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -109,53 +110,53 @@ namespace CalamityMod.NPCs.AcidRain } for (int i = 0; i < 7; i++) - Projectile.NewProjectile(npc.Center, Main.rand.NextVector2CircularEdge(speed, speed), ModContent.ProjectileType(), damage, 1f); + Projectile.NewProjectile(NPC.Center, Main.rand.NextVector2CircularEdge(speed, speed), ModContent.ProjectileType(), damage, 1f); } - Main.PlaySound(SoundID.DD2_KoboldExplosion, npc.Center); - npc.life = 0; - npc.HitEffect(); - npc.active = false; - npc.netUpdate = true; + SoundEngine.PlaySound(SoundID.DD2_KoboldExplosion, NPC.Center); + NPC.life = 0; + NPC.HitEffect(); + NPC.active = false; + NPC.netUpdate = true; } } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter >= 4) + NPC.frameCounter++; + if (NPC.frameCounter >= 4) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) - npc.frame.Y = 0; + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + NPC.frame.Y = 0; } } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 8; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/NuclearToadGore1"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/NuclearToadGore2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/NuclearToadGore3"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/NuclearToadGore4"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/NuclearToadGore1"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/NuclearToadGore2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/NuclearToadGore3"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/NuclearToadGore4"), NPC.scale); for (int i = 0; i < 25; i++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, Main.rand.NextFloat(-2f, 2f), -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, Main.rand.NextFloat(-2f, 2f), -1f, 0, default, 1f); } } public override void NPCLoot() { float dropChance = CalamityWorld.downedAquaticScourge ? 0.01f : 0.05f; - DropHelper.DropItemChance(npc, ModContent.ItemType(), dropChance); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), dropChance); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 2, 1, 3); } public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) => CalamityGlobalNPC.DrawGlowmask(npc, spriteBatch, ModContent.GetTexture(Texture + "Glow"), true); + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) => CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow"), true); } } diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index e1b810329a..2ca23fc364 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -15,73 +15,73 @@ namespace CalamityMod.NPCs.AcidRain { public class Orthocera : ModNPC { - public ref float FallDelay => ref npc.ai[0]; - public ref float Time => ref npc.ai[1]; - public ref float HorizontalSpeed => ref npc.ai[2]; + public ref float FallDelay => ref NPC.ai[0]; + public ref float Time => ref NPC.ai[1]; + public ref float HorizontalSpeed => ref NPC.ai[2]; public bool PerformingJump { - get => npc.ai[3] == 1f; + get => NPC.ai[3] == 1f; set { if (Main.netMode == NetmodeID.Server && value != PerformingJump) - npc.netUpdate = true; - npc.ai[3] = value.ToInt(); + NPC.netUpdate = true; + NPC.ai[3] = value.ToInt(); } } public override void SetStaticDefaults() { DisplayName.SetDefault("Orthocera"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.width = 62; - npc.height = 34; - npc.aiStyle = aiType = -1; + NPC.width = 62; + NPC.height = 34; + NPC.aiStyle = aiType = -1; - npc.damage = 45; - npc.lifeMax = 280; - npc.defense = 15; - npc.DR_NERD(0.075f); + NPC.damage = 45; + NPC.lifeMax = 280; + NPC.defense = 15; + NPC.DR_NERD(0.075f); if (CalamityWorld.downedPolterghast) { - npc.damage = 120; - npc.lifeMax = 3850; - npc.defense = 35; - npc.DR_NERD(0.15f); + NPC.damage = 120; + NPC.lifeMax = 3850; + NPC.defense = 35; + NPC.DR_NERD(0.15f); } - npc.knockBackResist = 0.6f; - npc.value = Item.buyPrice(0, 0, 4, 20); - npc.lavaImmune = false; - npc.noGravity = true; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath13; - banner = npc.type; + NPC.knockBackResist = 0.6f; + NPC.value = Item.buyPrice(0, 0, 4, 20); + NPC.lavaImmune = false; + NPC.noGravity = true; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit41; + NPC.DeathSound = SoundID.NPCDeath13; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { Time++; - npc.TargetClosest(false); + NPC.TargetClosest(false); float maxSpeed = CalamityWorld.downedPolterghast ? 12.8f : 10.5f; - if (!Main.player.IndexInRange(npc.target)) + if (!Main.player.IndexInRange(NPC.target)) return; - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; // Swim. if (Time % 250f < 180f) { - if (npc.wet) + if (NPC.wet) { // Reset to allow a jumps. if (PerformingJump) @@ -89,19 +89,19 @@ namespace CalamityMod.NPCs.AcidRain // Swim towards the player if we're not too close. // If close, simply resume current movement. - if (!npc.WithinRange(player.Center, 150f)) + if (!NPC.WithinRange(player.Center, 150f)) { - npc.velocity = (npc.velocity * 17f + npc.SafeDirectionTo(player.Center, -Vector2.UnitY) * maxSpeed) / 18f; + NPC.velocity = (NPC.velocity * 17f + NPC.SafeDirectionTo(player.Center, -Vector2.UnitY) * maxSpeed) / 18f; if (FallDelay != 12f) { FallDelay = 12f; - npc.netUpdate = true; + NPC.netUpdate = true; } } // Store for horizontal movement for later. // It seems to slow down for some dumb reason in the jump phase without this value. - HorizontalSpeed = npc.velocity.X; + HorizontalSpeed = NPC.velocity.X; // Make sure the value isn't 0 since we're relying on multiplication if (HorizontalSpeed == 0f) @@ -111,54 +111,54 @@ namespace CalamityMod.NPCs.AcidRain HorizontalSpeed = Math.Abs(HorizontalSpeed) * 7f; if (Math.Abs(HorizontalSpeed) > 16f) HorizontalSpeed = Math.Abs(HorizontalSpeed) * 16f; - HorizontalSpeed = Math.Abs(HorizontalSpeed) * (player.Center.X - npc.Center.X > 0).ToDirectionInt(); + HorizontalSpeed = Math.Abs(HorizontalSpeed) * (player.Center.X - NPC.Center.X > 0).ToDirectionInt(); } else { if (FallDelay <= 0f) - npc.velocity.Y += 0.2f; + NPC.velocity.Y += 0.2f; else FallDelay--; } - npc.direction = npc.spriteDirection = (npc.velocity.X > 0).ToDirectionInt(); + NPC.direction = NPC.spriteDirection = (NPC.velocity.X > 0).ToDirectionInt(); } // And jump/shoot. else if (Time % 220f > 180f) { float verticalAcceleration = CalamityWorld.downedPolterghast ? 0.07f : 0.05f; if (Time % 220f < 200f) - npc.velocity.Y -= verticalAcceleration; + NPC.velocity.Y -= verticalAcceleration; else - npc.velocity.Y += verticalAcceleration; + NPC.velocity.Y += verticalAcceleration; if (Time % 220f == 219f) PerformingJump = true; - if (!npc.wet) - npc.velocity.X = HorizontalSpeed; + if (!NPC.wet) + NPC.velocity.X = HorizontalSpeed; } // Don't jump mid-air. if (Time % 220f > 180f && PerformingJump) { Time = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver4 + MathHelper.PiOver2 + MathHelper.Pi; + NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver4 + MathHelper.PiOver2 + MathHelper.Pi; - if (npc.spriteDirection == -1) - npc.rotation -= MathHelper.PiOver2; + if (NPC.spriteDirection == -1) + NPC.rotation -= MathHelper.PiOver2; // If sitting on land, slow down and, if in the middle of a jump, release a stream of acid. - if (!npc.wet) + if (!NPC.wet) { - npc.velocity.X *= 0.92f; + NPC.velocity.X *= 0.92f; // Spit out a stream of acid based on the rotation of this NPC. if (Main.netMode != NetmodeID.MultiplayerClient && Time % 220f == 195f) { - float spitDirection = npc.rotation - MathHelper.TwoPi * 0.875f; - if (npc.spriteDirection == -1) + float spitDirection = NPC.rotation - MathHelper.TwoPi * 0.875f; + if (NPC.spriteDirection == -1) spitDirection += MathHelper.PiOver2; int damage = CalamityWorld.downedPolterghast ? 40 : CalamityWorld.downedAquaticScourge ? 26 : 18; @@ -171,45 +171,45 @@ namespace CalamityMod.NPCs.AcidRain for (int i = 0; i < 2; i++) { float offsetAngle = MathHelper.Lerp(-0.3f, 0.3f, i / 2f); - Projectile.NewProjectile(npc.Center, (spitDirection + offsetAngle).ToRotationVector2() * 10f, ModContent.ProjectileType(), damage, 2f); + Projectile.NewProjectile(NPC.Center, (spitDirection + offsetAngle).ToRotationVector2() * 10f, ModContent.ProjectileType(), damage, 2f); } } - Projectile.NewProjectile(npc.Center, spitDirection.ToRotationVector2() * 12f, ModContent.ProjectileType(), damage, 2f); + Projectile.NewProjectile(NPC.Center, spitDirection.ToRotationVector2() * 12f, ModContent.ProjectileType(), damage, 2f); } } // Prevent yeeting into the sky at the speed of light. - npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-maxSpeed), new Vector2(maxSpeed)); + NPC.velocity = Vector2.Clamp(NPC.velocity, new Vector2(-maxSpeed), new Vector2(maxSpeed)); } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3 * (CalamityWorld.downedPolterghast ? 5 : 1), 1, 3); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 20); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3 * (CalamityWorld.downedPolterghast ? 5 : 1), 1, 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 20); } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter >= 6) + NPC.frameCounter++; + if (NPC.frameCounter >= 6) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) - npc.frame.Y = 0; + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + NPC.frame.Y = 0; } } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/OrthoceraGore"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/OrthoceraGore2"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/OrthoceraGore"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/OrthoceraGore2"), NPC.scale); for (int k = 0; k < 10; k++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/AcidRain/Radiator.cs b/NPCs/AcidRain/Radiator.cs index abefc16534..bb01a15160 100644 --- a/NPCs/AcidRain/Radiator.cs +++ b/NPCs/AcidRain/Radiator.cs @@ -15,55 +15,55 @@ namespace CalamityMod.NPCs.AcidRain public override void SetStaticDefaults() { DisplayName.SetDefault("Radiator"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.aiStyle = 67; - npc.damage = 10; - npc.width = 24; - npc.height = 24; - npc.defense = 5; - npc.lifeMax = 50; + NPC.aiStyle = 67; + NPC.damage = 10; + NPC.width = 24; + NPC.height = 24; + NPC.defense = 5; + NPC.lifeMax = 50; if (CalamityWorld.downedPolterghast) { - npc.damage = 60; - npc.lifeMax = 3250; - npc.defense = 20; + NPC.damage = 60; + NPC.lifeMax = 3250; + NPC.defense = 20; } else if (CalamityWorld.downedAquaticScourge) { - npc.damage = 30; - npc.lifeMax = 130; - npc.defense = 10; + NPC.damage = 30; + NPC.lifeMax = 130; + NPC.defense = 10; } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; aiType = NPCID.GlowingSnail; - banner = npc.type; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.catchItem = (short)ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.catchItem = (short)ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - Lighting.AddLight(npc.Center, 0.3f, 1.5f, 0.3f); + Lighting.AddLight(NPC.Center, 0.3f, 1.5f, 0.3f); int auraSize = 200; //roughly 12 blocks (half the size of Wither Beast aura) Player player = Main.player[Main.myPlayer]; - if (!player.dead && player.active && (double) (player.Center - npc.Center).Length() < auraSize) + if (!player.dead && player.active && (double) (player.Center - NPC.Center).Length() < auraSize) { player.AddBuff(ModContent.BuffType(), 3, false); player.AddBuff(BuffID.Poisoned, 2, false); @@ -77,14 +77,14 @@ namespace CalamityMod.NPCs.AcidRain public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter > 8) + NPC.frameCounter++; + if (NPC.frameCounter > 8) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y > frameHeight * 2) + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y > frameHeight * 2) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } @@ -93,7 +93,7 @@ namespace CalamityMod.NPCs.AcidRain { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } } @@ -110,7 +110,7 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 2, 1, 3); } } } diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 6b375afb14..b24dc1b6ee 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -8,93 +8,94 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { public class Skyfin : ModNPC { - public ref float AttackState => ref npc.ai[0]; - public ref float AttackTimer => ref npc.ai[1]; - public Player Target => Main.player[npc.target]; + public ref float AttackState => ref NPC.ai[0]; + public ref float AttackTimer => ref NPC.ai[1]; + public Player Target => Main.player[NPC.target]; public override void SetStaticDefaults() { DisplayName.SetDefault("Skyfin"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.width = 46; - npc.height = 22; - npc.aiStyle = aiType = -1; + NPC.width = 46; + NPC.height = 22; + NPC.aiStyle = aiType = -1; - npc.damage = 12; - npc.lifeMax = 70; - npc.defense = 6; - npc.knockBackResist = 1f; + NPC.damage = 12; + NPC.lifeMax = 70; + NPC.defense = 6; + NPC.knockBackResist = 1f; if (CalamityWorld.downedPolterghast) { - npc.knockBackResist = 0.8f; - npc.damage = 88; - npc.lifeMax = 3025; - npc.defense = 18; - npc.DR_NERD(0.05f); + NPC.knockBackResist = 0.8f; + NPC.damage = 88; + NPC.lifeMax = 3025; + NPC.defense = 18; + NPC.DR_NERD(0.05f); } else if (CalamityWorld.downedAquaticScourge) { - npc.damage = 38; - npc.lifeMax = 220; - npc.DR_NERD(0.05f); + NPC.damage = 38; + NPC.lifeMax = 220; + NPC.DR_NERD(0.05f); } - npc.value = Item.buyPrice(0, 0, 3, 65); - npc.lavaImmune = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 3, 65); + NPC.lavaImmune = false; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.TargetClosest(false); - int idealDirection = (npc.velocity.X > 0).ToDirectionInt(); - npc.spriteDirection = idealDirection; + NPC.TargetClosest(false); + int idealDirection = (NPC.velocity.X > 0).ToDirectionInt(); + NPC.spriteDirection = idealDirection; switch ((int)AttackState) { // Rise upward. case 0: - Vector2 flyDestination = Target.Center + new Vector2((Target.Center.X < npc.Center.X).ToDirectionInt() * 400f, -240f); - Vector2 idealVelocity = npc.SafeDirectionTo(flyDestination) * 12f; - npc.velocity = (npc.velocity * 29f + idealVelocity) / 29f; - npc.velocity = npc.velocity.MoveTowards(idealVelocity, 1.5f); + Vector2 flyDestination = Target.Center + new Vector2((Target.Center.X < NPC.Center.X).ToDirectionInt() * 400f, -240f); + Vector2 idealVelocity = NPC.SafeDirectionTo(flyDestination) * 12f; + NPC.velocity = (NPC.velocity * 29f + idealVelocity) / 29f; + NPC.velocity = NPC.velocity.MoveTowards(idealVelocity, 1.5f); // Decide rotation. - npc.rotation = npc.velocity.ToRotation() + (npc.spriteDirection > 0).ToInt() * MathHelper.Pi; + NPC.rotation = NPC.velocity.ToRotation() + (NPC.spriteDirection > 0).ToInt() * MathHelper.Pi; - if (npc.WithinRange(flyDestination, 40f) || AttackTimer > 150f) + if (NPC.WithinRange(flyDestination, 40f) || AttackTimer > 150f) { AttackState = 1f; - npc.velocity *= 0.65f; - npc.netUpdate = true; + NPC.velocity *= 0.65f; + NPC.netUpdate = true; } break; // Slow down and look at the target. case 1: - npc.spriteDirection = (Target.Center.X > npc.Center.X).ToDirectionInt(); - npc.velocity *= 0.97f; - npc.velocity = npc.velocity.MoveTowards(Vector2.Zero, 0.25f); - npc.rotation = npc.rotation.AngleTowards(npc.AngleTo(Target.Center) + (npc.spriteDirection > 0).ToInt() * MathHelper.Pi, 0.2f); + NPC.spriteDirection = (Target.Center.X > NPC.Center.X).ToDirectionInt(); + NPC.velocity *= 0.97f; + NPC.velocity = NPC.velocity.MoveTowards(Vector2.Zero, 0.25f); + NPC.rotation = NPC.rotation.AngleTowards(NPC.AngleTo(Target.Center) + (NPC.spriteDirection > 0).ToInt() * MathHelper.Pi, 0.2f); // Charge once sufficiently slowed down. float chargeSpeed = 11.5f; @@ -102,12 +103,12 @@ namespace CalamityMod.NPCs.AcidRain chargeSpeed += 4f; if (CalamityWorld.downedPolterghast) chargeSpeed += 3.5f; - if (npc.velocity.Length() < 1.25f) + if (NPC.velocity.Length() < 1.25f) { - Main.PlaySound(SoundID.DD2_WyvernDiveDown, npc.Center); + SoundEngine.PlaySound(SoundID.DD2_WyvernDiveDown, NPC.Center); for (int i = 0; i < 36; i++) { - Dust acid = Dust.NewDustPerfect(npc.Center, (int)CalamityDusts.SulfurousSeaAcid); + Dust acid = Dust.NewDustPerfect(NPC.Center, (int)CalamityDusts.SulfurousSeaAcid); acid.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * 6f; acid.scale = 1.1f; acid.noGravity = true; @@ -115,31 +116,31 @@ namespace CalamityMod.NPCs.AcidRain AttackState = 2f; AttackTimer = 0f; - npc.velocity = npc.SafeDirectionTo(Target.Center) * chargeSpeed; - npc.netUpdate = true; + NPC.velocity = NPC.SafeDirectionTo(Target.Center) * chargeSpeed; + NPC.netUpdate = true; } break; // Charge and swoop. case 2: float angularTurnSpeed = MathHelper.Pi / 300f; - idealVelocity = npc.SafeDirectionTo(Target.Center); - Vector2 leftVelocity = npc.velocity.RotatedBy(-angularTurnSpeed); - Vector2 rightVelocity = npc.velocity.RotatedBy(angularTurnSpeed); + idealVelocity = NPC.SafeDirectionTo(Target.Center); + Vector2 leftVelocity = NPC.velocity.RotatedBy(-angularTurnSpeed); + Vector2 rightVelocity = NPC.velocity.RotatedBy(angularTurnSpeed); if (leftVelocity.AngleBetween(idealVelocity) < rightVelocity.AngleBetween(idealVelocity)) - npc.velocity = leftVelocity; + NPC.velocity = leftVelocity; else - npc.velocity = rightVelocity; + NPC.velocity = rightVelocity; // Decide rotation. - npc.rotation = npc.velocity.ToRotation() + (npc.spriteDirection > 0).ToInt() * MathHelper.Pi; + NPC.rotation = NPC.velocity.ToRotation() + (NPC.spriteDirection > 0).ToInt() * MathHelper.Pi; if (AttackTimer > 50f) { AttackState = 0f; AttackTimer = 0f; - npc.velocity = Vector2.Lerp(npc.velocity, -Vector2.UnitY * 8f, 0.14f); - npc.netUpdate = true; + NPC.velocity = Vector2.Lerp(NPC.velocity, -Vector2.UnitY * 8f, 0.14f); + NPC.netUpdate = true; } break; } @@ -148,33 +149,33 @@ namespace CalamityMod.NPCs.AcidRain public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter >= 5) + NPC.frameCounter++; + if (NPC.frameCounter >= 5) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) - npc.frame.Y = 0; + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + NPC.frame.Y = 0; } } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAquaticScourge, 0.05f); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 2, 1, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAquaticScourge, 0.05f); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 8; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/SkyfinGore"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/SkyfinGore2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/SkyfinGore3"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/SkyfinGore"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/SkyfinGore2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/SkyfinGore3"), NPC.scale); for (int k = 0; k < 20; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/AcidRain/SulfurousSkater.cs b/NPCs/AcidRain/SulfurousSkater.cs index 78e6190089..8c7cb218d3 100644 --- a/NPCs/AcidRain/SulfurousSkater.cs +++ b/NPCs/AcidRain/SulfurousSkater.cs @@ -18,15 +18,15 @@ namespace CalamityMod.NPCs.AcidRain public class SulfurousSkater : ModNPC { public bool Flying = false; - public Player Target => Main.player[npc.target]; - public ref float JumpTimer => ref npc.ai[0]; + public Player Target => Main.player[NPC.target]; + public ref float JumpTimer => ref NPC.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurous Skater"); - Main.npcFrameCount[npc.type] = 5; - NPCID.Sets.TrailingMode[npc.type] = 1; - NPCID.Sets.TrailCacheLength[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 5; + NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailCacheLength[NPC.type] = 6; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(Flying); @@ -35,40 +35,40 @@ namespace CalamityMod.NPCs.AcidRain public override void SetDefaults() { - npc.width = 48; - npc.height = 48; + NPC.width = 48; + NPC.height = 48; - npc.damage = 48; - npc.lifeMax = 280; - npc.defense = 3; + NPC.damage = 48; + NPC.lifeMax = 280; + NPC.defense = 3; if (CalamityWorld.downedPolterghast) { - npc.damage = 85; - npc.lifeMax = 3850; - npc.defense = 15; + NPC.damage = 85; + NPC.lifeMax = 3850; + NPC.defense = 15; } - npc.knockBackResist = 0.8f; - npc.value = Item.buyPrice(0, 0, 5, 25); - npc.lavaImmune = false; - npc.noGravity = true; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.knockBackResist = 0.8f; + NPC.value = Item.buyPrice(0, 0, 5, 25); + NPC.lavaImmune = false; + NPC.noGravity = true; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.aiStyle = aiType = -1; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.aiStyle = aiType = -1; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.TargetClosest(false); + NPC.TargetClosest(false); if (!Flying) JumpToDestination(); else @@ -77,9 +77,9 @@ namespace CalamityMod.NPCs.AcidRain public void JumpToDestination() { - npc.knockBackResist = 0.8f; - npc.DR_NERD(0.35f); - npc.noGravity = false; + NPC.knockBackResist = 0.8f; + NPC.DR_NERD(0.35f); + NPC.noGravity = false; Projectile closestBubble = SearchForNearestBubble(out float distanceToBubbele); Vector2 destination = Target.Center; @@ -89,72 +89,72 @@ namespace CalamityMod.NPCs.AcidRain destination = closestBubble.Center; // Stay on water instead of falling into it - if (npc.wet && npc.velocity.Y >= 0f) - npc.velocity.Y = -3f; + if (NPC.wet && NPC.velocity.Y >= 0f) + NPC.velocity.Y = -3f; // If close to the bubble, try to fall onto it. if (closestBubble != null && distanceToBubbele < 200f) { - npc.velocity.Y += 0.2f; + NPC.velocity.Y += 0.2f; - if (closestBubble.Hitbox.Intersects(npc.Hitbox)) + if (closestBubble.Hitbox.Intersects(NPC.Hitbox)) { Flying = true; - npc.netSpam = 0; - npc.netUpdate = true; + NPC.netSpam = 0; + NPC.netUpdate = true; closestBubble.Kill(); } } // Wait for a small amount of time and jump if there is little motion. - if (npc.velocity.Y == 0f || npc.wet) + if (NPC.velocity.Y == 0f || NPC.wet) { - npc.TargetClosest(false); + NPC.TargetClosest(false); // Rapidly zero out horizontal movement. - npc.velocity.X *= 0.85f; + NPC.velocity.X *= 0.85f; JumpTimer++; float lungeForwardSpeed = 15f; float jumpSpeed = 4f; - if (Collision.CanHit(npc.Center, 1, 1, Target.Center, 1, 1)) + if (Collision.CanHit(NPC.Center, 1, 1, Target.Center, 1, 1)) lungeForwardSpeed *= 1.2f; // Jump after a short amount of time. if (JumpTimer >= 17) { JumpTimer = 0f; - npc.velocity.Y -= jumpSpeed; - npc.velocity.X = lungeForwardSpeed * (npc.Center.X - destination.X < 0).ToDirectionInt(); - npc.spriteDirection = (npc.Center.X - destination.X > 0).ToDirectionInt(); - npc.netSpam = 0; - npc.netUpdate = true; + NPC.velocity.Y -= jumpSpeed; + NPC.velocity.X = lungeForwardSpeed * (NPC.Center.X - destination.X < 0).ToDirectionInt(); + NPC.spriteDirection = (NPC.Center.X - destination.X > 0).ToDirectionInt(); + NPC.netSpam = 0; + NPC.netUpdate = true; } } else - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; } public void DoFlyMovement() { - npc.knockBackResist = 0.5f; - npc.DR_NERD(0f); + NPC.knockBackResist = 0.5f; + NPC.DR_NERD(0f); float flySpeed = CalamityWorld.downedPolterghast ? 17f : 14f; float flyInertia = CalamityWorld.downedPolterghast ? 20f : 24.5f; // Fly more sharply if close to the target. - if (npc.WithinRange(Target.Center, 200f)) + if (NPC.WithinRange(Target.Center, 200f)) flyInertia *= 0.667f; - npc.velocity = (npc.velocity * flyInertia + npc.SafeDirectionTo(Target.Center, Vector2.UnitY) * flySpeed) / (flyInertia + 1f); - npc.spriteDirection = (npc.velocity.X < 0).ToDirectionInt(); + NPC.velocity = (NPC.velocity * flyInertia + NPC.SafeDirectionTo(Target.Center, Vector2.UnitY) * flySpeed) / (flyInertia + 1f); + NPC.spriteDirection = (NPC.velocity.X < 0).ToDirectionInt(); // Have the bubble pop and stop flying if within the circular hitbox area of the player. - if (npc.WithinRange(Target.Center, Target.Size.Length())) + if (NPC.WithinRange(Target.Center, Target.Size.Length())) { Flying = false; - npc.netSpam = 0; - npc.netUpdate = true; + NPC.netSpam = 0; + NPC.netUpdate = true; } } @@ -169,14 +169,14 @@ namespace CalamityMod.NPCs.AcidRain if (Main.projectile[i].type != bubbleType || !Main.projectile[i].active) continue; - if (Math.Abs(npc.Center.X - Main.projectile[i].Center.X) >= minimumDistance || - Main.projectile[i].Center.Y <= npc.Bottom.Y || - !Collision.CanHit(npc.position, npc.width, npc.height, Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height)) + if (Math.Abs(NPC.Center.X - Main.projectile[i].Center.X) >= minimumDistance || + Main.projectile[i].Center.Y <= NPC.Bottom.Y || + !Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height)) { continue; } - minimumDistance = npc.Distance(Main.projectile[i].Center); + minimumDistance = NPC.Distance(Main.projectile[i].Center); closestBubble = Main.projectile[i]; } @@ -187,44 +187,44 @@ namespace CalamityMod.NPCs.AcidRain public override void FindFrame(int frameHeight) { if (!Flying) - npc.frame.Y = 0; + NPC.frame.Y = 0; else { - npc.frameCounter++; - if (npc.frameCounter >= 4) + NPC.frameCounter++; + if (NPC.frameCounter >= 4) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) - npc.frame.Y = frameHeight; + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + NPC.frame.Y = frameHeight; } } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - CalamityGlobalNPC.DrawGlowmask(npc, spriteBatch, ModContent.GetTexture(Texture + "Glow"), true, Vector2.UnitY * 4f); - CalamityGlobalNPC.DrawAfterimage(npc, spriteBatch, drawColor, Color.Transparent, directioning: true, invertedDirection: true); + CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow"), true, Vector2.UnitY * 4f); + CalamityGlobalNPC.DrawAfterimage(NPC, spriteBatch, drawColor, Color.Transparent, directioning: true, invertedDirection: true); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/SulfurousSkaterGore"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/SulfurousSkaterGore2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/SulfurousSkaterGore3"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/SulfurousSkaterGore"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/SulfurousSkaterGore2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/SulfurousSkaterGore3"), NPC.scale); } } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3 * (CalamityWorld.downedPolterghast ? 5 : 1), 1, 3); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 20); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3 * (CalamityWorld.downedPolterghast ? 5 : 1), 1, 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 20); } public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index 2eca32d08d..69e98b4aae 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -10,89 +10,90 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.StatDebuffs; +using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { public class Trilobite : ModNPC { - public Player Target => Main.player[npc.target]; - public ref float SpikeShootCountdown => ref npc.ai[0]; + public Player Target => Main.player[NPC.target]; + public ref float SpikeShootCountdown => ref NPC.ai[0]; public const float MinSpeedLungePrompt = 0.5f; public override void SetStaticDefaults() { DisplayName.SetDefault("Trilobite"); - Main.npcFrameCount[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - NPCID.Sets.TrailCacheLength[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 8; + NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailCacheLength[NPC.type] = 5; } public override void SetDefaults() { - npc.width = 36; - npc.height = 38; - npc.aiStyle = aiType = -1; + NPC.width = 36; + NPC.height = 38; + NPC.aiStyle = aiType = -1; - npc.damage = 45; - npc.lifeMax = 300; - npc.defense = 15; - npc.DR_NERD(0.25f); + NPC.damage = 45; + NPC.lifeMax = 300; + NPC.defense = 15; + NPC.DR_NERD(0.25f); if (CalamityWorld.downedPolterghast) { - npc.damage = 80; - npc.lifeMax = 4125; - npc.defense = 30; + NPC.damage = 80; + NPC.lifeMax = 4125; + NPC.defense = 30; } - npc.knockBackResist = 0.2f; - npc.value = Item.buyPrice(0, 0, 4, 0); - npc.lavaImmune = false; - npc.noGravity = true; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit42; - npc.DeathSound = SoundID.NPCDeath27; - banner = npc.type; + NPC.knockBackResist = 0.2f; + NPC.value = Item.buyPrice(0, 0, 4, 0); + NPC.lavaImmune = false; + NPC.noGravity = true; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit42; + NPC.DeathSound = SoundID.NPCDeath27; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.TargetClosest(false); - if (!npc.wet) + NPC.TargetClosest(false); + if (!NPC.wet) { GetStuckOnLand(); return; } // If this NPC doesn't have enough momentum, lunge towards its target. - if (npc.velocity.Length() < MinSpeedLungePrompt) + if (NPC.velocity.Length() < MinSpeedLungePrompt) { - npc.TargetClosest(); + NPC.TargetClosest(); float lungeSpeed = CalamityWorld.downedPolterghast ? 18.5f : 15f; - npc.velocity = npc.SafeDirectionTo(Target.Center, -Vector2.UnitY) * lungeSpeed; - npc.velocity.X *= 1.6f; - npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; - npc.netUpdate = true; + NPC.velocity = NPC.SafeDirectionTo(Target.Center, -Vector2.UnitY) * lungeSpeed; + NPC.velocity.X *= 1.6f; + NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; + NPC.netUpdate = true; return; } // Accelerate quickly through the water horizontally. - if (Math.Abs(npc.velocity.X) < 20f) - npc.velocity.X += npc.direction * 0.02f; + if (Math.Abs(NPC.velocity.X) < 20f) + NPC.velocity.X += NPC.direction * 0.02f; - npc.rotation = npc.velocity.X * 0.4f; + NPC.rotation = NPC.velocity.X * 0.4f; // Slow down in terms of horizontal speed if there is little vertical speed. - if (Math.Abs(npc.velocity.Y) < 0.9f) - npc.velocity.X *= 0.96f; + if (Math.Abs(NPC.velocity.Y) < 0.9f) + NPC.velocity.X *= 0.96f; // Lunge towards the target if there is little horizontal speed but also a little bit of vertical speed. - else if (Main.netMode != NetmodeID.MultiplayerClient && Math.Abs(npc.velocity.X) < 3.5f) + else if (Main.netMode != NetmodeID.MultiplayerClient && Math.Abs(NPC.velocity.X) < 3.5f) { float speedX = 18f; float speedY = 9f; @@ -101,45 +102,45 @@ namespace CalamityMod.NPCs.AcidRain speedX = 22f; speedY = 11f; } - npc.velocity = npc.SafeDirectionTo(Target.Center, -Vector2.UnitY) * new Vector2(speedX, speedY); - npc.netUpdate = true; + NPC.velocity = NPC.SafeDirectionTo(Target.Center, -Vector2.UnitY) * new Vector2(speedX, speedY); + NPC.netUpdate = true; } - npc.velocity.Y *= 0.98f; + NPC.velocity.Y *= 0.98f; } public void GetStuckOnLand() { if (SpikeShootCountdown > 0) SpikeShootCountdown--; - npc.rotation += npc.velocity.X * 0.1f; + NPC.rotation += NPC.velocity.X * 0.1f; // If not moving vertically, slow down hotizontally. - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.velocity.X *= 0.99f; - if (Math.Abs(npc.velocity.X) < 0.01f) - npc.velocity.X = 0f; + NPC.velocity.X *= 0.99f; + if (Math.Abs(NPC.velocity.X) < 0.01f) + NPC.velocity.X = 0f; } // Fall and cap the vertical speed. - if (npc.velocity.Y > 13f) + if (NPC.velocity.Y > 13f) { - npc.velocity.Y = 13f; - npc.netUpdate = true; + NPC.velocity.Y = 13f; + NPC.netUpdate = true; } else - npc.velocity.Y += 0.3f; + NPC.velocity.Y += 0.3f; } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3 * (CalamityWorld.downedPolterghast ? 5 : 1), 1, 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3 * (CalamityWorld.downedPolterghast ? 5 : 1), 1, 3); } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - if (npc.velocity.Length() > 0.5f) - CalamityGlobalNPC.DrawAfterimage(npc, spriteBatch, drawColor, Color.Transparent, directioning: true); + if (NPC.velocity.Length() > 0.5f) + CalamityGlobalNPC.DrawAfterimage(NPC, spriteBatch, drawColor, Color.Transparent, directioning: true); } public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) @@ -147,27 +148,27 @@ namespace CalamityMod.NPCs.AcidRain // No need for a netmode check- this code is only called by 1 client, the owner of the projectile that hit the NPC. if (SpikeShootCountdown <= 0f) { - Main.PlaySound(SoundID.NPCDeath11, npc.Center); + SoundEngine.PlaySound(SoundID.NPCDeath11, NPC.Center); int projDamage = CalamityWorld.downedPolterghast ? 35 : CalamityWorld.downedAquaticScourge ? 29 : 21; if (Main.expertMode) projDamage = (int)Math.Round(projDamage * 0.8); - Vector2 spikeVelocity = -npc.velocity.RotatedByRandom(0.18f); - Projectile.NewProjectile(npc.Center + Main.rand.NextVector2Unit() * npc.Size * 0.7f, spikeVelocity, ModContent.ProjectileType(), projDamage, 3f); + Vector2 spikeVelocity = -NPC.velocity.RotatedByRandom(0.18f); + Projectile.NewProjectile(NPC.Center + Main.rand.NextVector2Unit() * NPC.Size * 0.7f, spikeVelocity, ModContent.ProjectileType(), projDamage, 3f); SpikeShootCountdown = Main.rand.Next(50, 65); - npc.netUpdate = true; + NPC.netUpdate = true; } } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter >= 4) + NPC.frameCounter++; + if (NPC.frameCounter >= 4) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) - npc.frame.Y = 0; + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + NPC.frame.Y = 0; } } @@ -175,16 +176,16 @@ namespace CalamityMod.NPCs.AcidRain { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/TrilobiteGore"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/TrilobiteGore2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/TrilobiteGore3"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/TrilobiteGore"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/TrilobiteGore2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/TrilobiteGore3"), NPC.scale); for (int k = 0; k < 30; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs index a84ffd8dbf..44f1077f34 100644 --- a/NPCs/AcidRain/WaterLeech.cs +++ b/NPCs/AcidRain/WaterLeech.cs @@ -13,62 +13,62 @@ namespace CalamityMod.NPCs.AcidRain { public class WaterLeech : ModNPC { - public Player Target => Main.player[npc.target]; + public Player Target => Main.player[NPC.target]; public bool LatchingOntoTarget { - get => npc.ai[0] == 1f; - set => npc.ai[0] = value.ToInt(); + get => NPC.ai[0] == 1f; + set => NPC.ai[0] = value.ToInt(); } - public ref float LackOfWaterDeathTimer => ref npc.ai[2]; + public ref float LackOfWaterDeathTimer => ref NPC.ai[2]; public const float ChasePromptDistance = 55f; public const float ChaseMaxDistance = 140f; public override void SetStaticDefaults() { DisplayName.SetDefault("Water Leech"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.width = 26; - npc.height = 14; + NPC.width = 26; + NPC.height = 14; - npc.lifeMax = 30; - npc.damage = 0; + NPC.lifeMax = 30; + NPC.damage = 0; if (CalamityWorld.downedPolterghast) { - npc.lifeMax = 1235; - npc.defense = 10; + NPC.lifeMax = 1235; + NPC.defense = 10; } else if (CalamityWorld.downedAquaticScourge) - npc.lifeMax = 90; + NPC.lifeMax = 90; - npc.value = Item.buyPrice(0, 0, 2, 5); - npc.lavaImmune = false; - npc.noGravity = true; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 2, 5); + NPC.lavaImmune = false; + NPC.noGravity = true; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit33; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } - public override void SendExtraAI(BinaryWriter writer) => writer.Write(npc.dontTakeDamage); + public override void SendExtraAI(BinaryWriter writer) => writer.Write(NPC.dontTakeDamage); - public override void ReceiveExtraAI(BinaryReader reader) => npc.dontTakeDamage = reader.ReadBoolean(); + public override void ReceiveExtraAI(BinaryReader reader) => NPC.dontTakeDamage = reader.ReadBoolean(); public override void AI() { - if (npc.localAI[0] == 0f) + if (NPC.localAI[0] == 0f) { - npc.TargetClosest(); - npc.localAI[0] = 1f; + NPC.TargetClosest(); + NPC.localAI[0] = 1f; } bool playerAlreadyTargeted = false; @@ -78,17 +78,17 @@ namespace CalamityMod.NPCs.AcidRain // Only one leech is allowed to target one player at a time. for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].type != npc.type || !Main.npc[i].active || Main.npc[i].whoAmI == npc.whoAmI) + if (Main.npc[i].type != NPC.type || !Main.npc[i].active || Main.npc[i].whoAmI == NPC.whoAmI) continue; - if (Main.npc[i].target == npc.target && !playerAlreadyTargeted) + if (Main.npc[i].target == NPC.target && !playerAlreadyTargeted) playerAlreadyTargeted = true; - if (Main.npc[i].Hitbox.Intersects(npc.Hitbox)) - npc.velocity += npc.DirectionFrom(Main.npc[i].Center) * antiStickyAcceleration; + if (Main.npc[i].Hitbox.Intersects(NPC.Hitbox)) + NPC.velocity += NPC.DirectionFrom(Main.npc[i].Center) * antiStickyAcceleration; } if (!playerAlreadyTargeted || Target.Calamity().waterLeechTarget == -1) - Target.Calamity().waterLeechTarget = npc.whoAmI; + Target.Calamity().waterLeechTarget = NPC.whoAmI; if (LatchingOntoTarget) { @@ -96,26 +96,26 @@ namespace CalamityMod.NPCs.AcidRain return; } - npc.direction = npc.spriteDirection = (npc.velocity.X > 0).ToDirectionInt(); + NPC.direction = NPC.spriteDirection = (NPC.velocity.X > 0).ToDirectionInt(); // If the leech is not in water, fall and quickly cease horizontal movement. // After some time, if still not in water, die due to a lack of water. - if (!npc.wet) + if (!NPC.wet) { - npc.velocity.X *= 0.97f; - npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y + 0.4f, -4f, 16f); + NPC.velocity.X *= 0.97f; + NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y + 0.4f, -4f, 16f); LackOfWaterDeathTimer++; if (LackOfWaterDeathTimer >= 300f) { - npc.life = 0; - npc.HitEffect(); - npc.active = false; - npc.netUpdate = true; + NPC.life = 0; + NPC.HitEffect(); + NPC.active = false; + NPC.netUpdate = true; } } // Swim towards the target if they are in water. - else if (Target.wet && Target.Calamity().waterLeechTarget == npc.whoAmI) + else if (Target.wet && Target.Calamity().waterLeechTarget == NPC.whoAmI) { float swimSpeed = Target.wet ? 23f : 17f; float swimIntertia = 24f; @@ -124,77 +124,77 @@ namespace CalamityMod.NPCs.AcidRain swimSpeed *= 1.6f; swimIntertia = 17f; } - npc.velocity = (npc.velocity * (swimIntertia - 1f) + npc.SafeDirectionTo(Target.Center, -Vector2.UnitY) * swimSpeed) / swimIntertia; + NPC.velocity = (NPC.velocity * (swimIntertia - 1f) + NPC.SafeDirectionTo(Target.Center, -Vector2.UnitY) * swimSpeed) / swimIntertia; } // Rapidly slow down if the target is not in water. else if (!Target.wet) - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; - if (npc.WithinRange(Target.Top, ChasePromptDistance) && Target.active && !Target.dead) + if (NPC.WithinRange(Target.Top, ChasePromptDistance) && Target.active && !Target.dead) { LatchingOntoTarget = true; - npc.netUpdate = true; + NPC.netUpdate = true; } // If the target is not in water, become invincible. bool shouldNotTakeDamage = !Target.wet; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.dontTakeDamage != shouldNotTakeDamage) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.dontTakeDamage != shouldNotTakeDamage) { - npc.dontTakeDamage = shouldNotTakeDamage; - npc.netUpdate = true; + NPC.dontTakeDamage = shouldNotTakeDamage; + NPC.netUpdate = true; } } public void LatchOntoTarget() { - if (Main.netMode != NetmodeID.MultiplayerClient && npc.dontTakeDamage) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.dontTakeDamage) { - npc.dontTakeDamage = false; - npc.netUpdate = true; + NPC.dontTakeDamage = false; + NPC.netUpdate = true; } // If the target moved far enough away, stop attempting to attach to them. - if (!npc.WithinRange(Target.Center, ChaseMaxDistance)) + if (!NPC.WithinRange(Target.Center, ChaseMaxDistance)) { LatchingOntoTarget = false; - npc.netUpdate = true; + NPC.netUpdate = true; return; } Vector2 destination = (Target.gravDir == 1f ? Target.Top : Target.Bottom) + Target.direction * Vector2.UnitX * 4f; - float speed = MathHelper.Lerp(7f, 23f, Utils.InverseLerp(10f, ChaseMaxDistance, npc.Distance(destination), true)); - npc.velocity = npc.SafeDirectionTo(destination) * speed; + float speed = MathHelper.Lerp(7f, 23f, Utils.InverseLerp(10f, ChaseMaxDistance, NPC.Distance(destination), true)); + NPC.velocity = NPC.SafeDirectionTo(destination) * speed; - if (npc.WithinRange(destination, 45f)) + if (NPC.WithinRange(destination, 45f)) { Target.AddBuff(BuffID.Bleeding, 180, true); Target.AddBuff(ModContent.BuffType(), 30, true); } // Stop searching if the target is not in water anymore and they're not close. - else if (!npc.wet && !npc.WithinRange(destination, 85f)) + else if (!NPC.wet && !NPC.WithinRange(destination, 85f)) { LatchingOntoTarget = false; - npc.netUpdate = true; + NPC.netUpdate = true; } } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter >= 4) + NPC.frameCounter++; + if (NPC.frameCounter >= 4) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) - npc.frame.Y = 0; + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) + NPC.frame.Y = 0; } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur || !Main.raining) + if (spawnInfo.playerSafe || !spawnInfo.Player.Calamity().ZoneSulphur || !Main.raining) return 0f; return 0.115f; @@ -203,13 +203,13 @@ namespace CalamityMod.NPCs.AcidRain public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 8; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } public override void NPCLoot() { float dropChance = CalamityWorld.downedAquaticScourge ? 0.01f : 0.05f; - DropHelper.DropItemChance(npc, ModContent.ItemType(), dropChance); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), dropChance); } } } diff --git a/NPCs/AdultEidolonWyrm/EidolonWyrmBodyAltHuge.cs b/NPCs/AdultEidolonWyrm/EidolonWyrmBodyAltHuge.cs index 6e7b4a4d3a..e7b5f629d5 100644 --- a/NPCs/AdultEidolonWyrm/EidolonWyrmBodyAltHuge.cs +++ b/NPCs/AdultEidolonWyrm/EidolonWyrmBodyAltHuge.cs @@ -18,43 +18,43 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public override void SetDefaults() { - npc.damage = 100; - npc.width = 60; - npc.height = 88; - npc.defense = 0; - npc.LifeMaxNERB(2415000, 2898000); + NPC.damage = 100; + NPC.width = 60; + NPC.height = 88; + NPC.defense = 0; + NPC.LifeMaxNERB(2415000, 2898000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.Opacity = 0f; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.dontCountMe = true; - npc.dontTakeDamage = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.Opacity = 0f; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath6; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.dontTakeDamage = true; + NPC.chaseable = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.localAI[0]); + writer.Write(NPC.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.localAI[0] = reader.ReadSingle(); + NPC.localAI[0] = reader.ReadSingle(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { - npc.damage = 0; + NPC.damage = 0; // Difficulty modes bool malice = CalamityWorld.malice; @@ -62,8 +62,8 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm bool revenge = CalamityWorld.revenge; bool expertMode = Main.expertMode; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -77,20 +77,20 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); float chargePhaseGateValue = malice ? 120f : death ? 180f : revenge ? 210f : expertMode ? 240f : 300f; float lightningChargePhaseGateValue = malice ? 90f : death ? 120f : revenge ? 135f : expertMode ? 150f : 180f; @@ -100,47 +100,47 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm bool invisiblePhase = calamityGlobalNPC_Head.newAI[0] == 1f || calamityGlobalNPC_Head.newAI[0] == 5f || calamityGlobalNPC_Head.newAI[0] == 7f; if (!invisiblePartOfChargePhase && !invisiblePartOfLightningChargePhase && !invisiblePhase) { - if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + if (Main.npc[(int)NPC.ai[1]].Opacity > 0.5f) { - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } } else { - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } bool shootShadowFireballs = (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ShadowFireballSpin && calamityGlobalNPC_Head.newAI[2] > 0f) || (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.FinalPhase && calamityGlobalNPC_Head.newAI[1] > 0f); if (shootShadowFireballs && Main.netMode != NetmodeID.MultiplayerClient) { - if (Vector2.Distance(npc.Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) > 160f) + if (Vector2.Distance(NPC.Center, Main.player[Main.npc[(int)NPC.ai[2]].target].Center) > 160f) { - npc.localAI[0] += 1f; + NPC.localAI[0] += 1f; float shootShadowFireballGateValue = malice ? 60f : death ? 70f : revenge ? 75f : expertMode ? 80f : 90f; float divisor = 2f; - if (npc.ai[3] % divisor == 0f && npc.localAI[0] >= shootShadowFireballGateValue) + if (NPC.ai[3] % divisor == 0f && NPC.localAI[0] >= shootShadowFireballGateValue) { - npc.localAI[0] = 0f; - float distanceVelocityBoost = MathHelper.Clamp((Vector2.Distance(Main.npc[(int)npc.ai[2]].Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) - 1600f) * 0.025f, 0f, 16f); - float fireballVelocity = (Main.player[Main.npc[(int)npc.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 6f : 8f) + distanceVelocityBoost; - Vector2 destination = Main.player[Main.npc[(int)npc.ai[2]].target].Center - npc.Center; + NPC.localAI[0] = 0f; + float distanceVelocityBoost = MathHelper.Clamp((Vector2.Distance(Main.npc[(int)NPC.ai[2]].Center, Main.player[Main.npc[(int)NPC.ai[2]].target].Center) - 1600f) * 0.025f, 0f, 16f); + float fireballVelocity = (Main.player[Main.npc[(int)NPC.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 6f : 8f) + distanceVelocityBoost; + Vector2 destination = Main.player[Main.npc[(int)NPC.ai[2]].target].Center - NPC.Center; Vector2 velocity = Vector2.Normalize(destination) * fireballVelocity; int type = ProjectileID.CultistBossFireBallClone; - int damage = npc.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(npc.Center, velocity, type, damage, 0f, Main.myPlayer); + int damage = NPC.GetProjectileDamage(type); + int proj = Projectile.NewProjectile(NPC.Center, velocity, type, damage, 0f, Main.myPlayer); Main.projectile[proj].tileCollide = false; } } } - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; @@ -149,44 +149,44 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm num192 -= vector18.Y; float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2(ModContent.GetTexture("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmBodyAltGlowHuge").Width, ModContent.GetTexture("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmBodyAltGlowHuge").Height) * 0.5f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmBodyAltGlowHuge"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), Color.White, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2(ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmBodyAltGlowHuge").Width, ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmBodyAltGlowHuge").Height) * 0.5f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmBodyAltGlowHuge"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), Color.White, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override bool CheckActive() => false; @@ -195,12 +195,12 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); - Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult3"), 1f); + Gore.NewGore(NPC.Center, NPC.velocity, Mod.GetGoreSlot("Gores/WyrmAdult3"), 1f); } } } diff --git a/NPCs/AdultEidolonWyrm/EidolonWyrmBodyHuge.cs b/NPCs/AdultEidolonWyrm/EidolonWyrmBodyHuge.cs index 36d3549680..c835a435c9 100644 --- a/NPCs/AdultEidolonWyrm/EidolonWyrmBodyHuge.cs +++ b/NPCs/AdultEidolonWyrm/EidolonWyrmBodyHuge.cs @@ -18,43 +18,43 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public override void SetDefaults() { - npc.damage = 100; - npc.width = 60; - npc.height = 88; - npc.defense = 0; - npc.LifeMaxNERB(2415000, 2898000); + NPC.damage = 100; + NPC.width = 60; + NPC.height = 88; + NPC.defense = 0; + NPC.LifeMaxNERB(2415000, 2898000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.Opacity = 0f; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.dontCountMe = true; - npc.dontTakeDamage = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.Opacity = 0f; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath6; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.dontTakeDamage = true; + NPC.chaseable = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.localAI[0]); + writer.Write(NPC.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.localAI[0] = reader.ReadSingle(); + NPC.localAI[0] = reader.ReadSingle(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { - npc.damage = 0; + NPC.damage = 0; // Difficulty modes bool malice = CalamityWorld.malice; @@ -62,8 +62,8 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm bool revenge = CalamityWorld.revenge; bool expertMode = Main.expertMode; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -77,20 +77,20 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); float chargePhaseGateValue = malice ? 120f : death ? 180f : revenge ? 210f : expertMode ? 240f : 300f; float lightningChargePhaseGateValue = malice ? 90f : death ? 120f : revenge ? 135f : expertMode ? 150f : 180f; @@ -100,47 +100,47 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm bool invisiblePhase = calamityGlobalNPC_Head.newAI[0] == 1f || calamityGlobalNPC_Head.newAI[0] == 5f || calamityGlobalNPC_Head.newAI[0] == 7f; if (!invisiblePartOfChargePhase && !invisiblePartOfLightningChargePhase && !invisiblePhase) { - if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + if (Main.npc[(int)NPC.ai[1]].Opacity > 0.5f) { - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } } else { - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } bool spawnAncientLights = (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ShadowFireballSpin && calamityGlobalNPC_Head.newAI[2] > 0f) || (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.FinalPhase && calamityGlobalNPC_Head.newAI[1] > 0f); if (spawnAncientLights && Main.netMode != NetmodeID.MultiplayerClient) { - if (Vector2.Distance(npc.Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) > 160f) + if (Vector2.Distance(NPC.Center, Main.player[Main.npc[(int)NPC.ai[2]].target].Center) > 160f) { - npc.localAI[0] += 1f; + NPC.localAI[0] += 1f; float spawnAncientLightGateValue = malice ? 90f : death ? 100f : revenge ? 105f : expertMode ? 110f : 120f; float divisor = 4f; - if (npc.ai[3] % divisor == 0f && npc.localAI[0] >= spawnAncientLightGateValue) + if (NPC.ai[3] % divisor == 0f && NPC.localAI[0] >= spawnAncientLightGateValue) { - npc.localAI[0] = 0f; - float distanceVelocityBoost = MathHelper.Clamp((Vector2.Distance(Main.npc[(int)npc.ai[2]].Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) - 1600f) * 0.025f, 0f, 16f); - float lightVelocity = (Main.player[Main.npc[(int)npc.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 6f : 8f) + distanceVelocityBoost; - Vector2 destination = Main.player[Main.npc[(int)npc.ai[2]].target].Center - npc.Center; + NPC.localAI[0] = 0f; + float distanceVelocityBoost = MathHelper.Clamp((Vector2.Distance(Main.npc[(int)NPC.ai[2]].Center, Main.player[Main.npc[(int)NPC.ai[2]].target].Center) - 1600f) * 0.025f, 0f, 16f); + float lightVelocity = (Main.player[Main.npc[(int)NPC.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 6f : 8f) + distanceVelocityBoost; + Vector2 destination = Main.player[Main.npc[(int)NPC.ai[2]].target].Center - NPC.Center; Vector2 velocity = Vector2.Normalize(destination) * lightVelocity; int type = NPCID.AncientLight; float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; - int light = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, type, 0, 0f, ai, velocity.X, velocity.Y, 255); + int light = NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y, type, 0, 0f, ai, velocity.X, velocity.Y, 255); Main.npc[light].velocity = velocity; } } } - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; @@ -149,44 +149,44 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm num192 -= vector18.Y; float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2(ModContent.GetTexture("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmBodyGlowHuge").Width, ModContent.GetTexture("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmBodyGlowHuge").Height) * 0.5f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmBodyGlowHuge"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), Color.White, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2(ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmBodyGlowHuge").Width, ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmBodyGlowHuge").Height) * 0.5f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmBodyGlowHuge"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), Color.White, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override bool CheckActive() => false; @@ -195,12 +195,12 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); - Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult2"), 1f); + Gore.NewGore(NPC.Center, NPC.velocity, Mod.GetGoreSlot("Gores/WyrmAdult2"), 1f); } } } diff --git a/NPCs/AdultEidolonWyrm/EidolonWyrmHeadHuge.cs b/NPCs/AdultEidolonWyrm/EidolonWyrmHeadHuge.cs index fbb8e30a84..d0b2440778 100644 --- a/NPCs/AdultEidolonWyrm/EidolonWyrmHeadHuge.cs +++ b/NPCs/AdultEidolonWyrm/EidolonWyrmHeadHuge.cs @@ -16,6 +16,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.AdultEidolonWyrm { @@ -39,8 +40,8 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public float AIState { - get => npc.Calamity().newAI[0]; - set => npc.Calamity().newAI[0] = value; + get => NPC.Calamity().newAI[0]; + set => NPC.Calamity().newAI[0] = value; } // Base distance from the target for most attacks @@ -81,33 +82,33 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 50f; - npc.GetNPCDamage(); - npc.width = 254; - npc.height = 138; - npc.defense = 100; - npc.DR_NERD(0.4f); - npc.LifeMaxNERB(2415000, 2898000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 50f; + NPC.GetNPCDamage(); + NPC.width = 254; + NPC.height = 138; + NPC.defense = 100; + NPC.DR_NERD(0.4f); + NPC.LifeMaxNERB(2415000, 2898000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.Opacity = 0f; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(10, 0, 0, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.boss = true; + NPC.Opacity = 0f; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(10, 0, 0, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath6; + NPC.netAlways = true; + NPC.boss = true; music = CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ?? MusicID.Boss3; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) @@ -115,12 +116,12 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm writer.WriteVector2(chargeDestination); writer.Write(rotationDirection); writer.Write(chargeVelocityScalar); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -128,19 +129,19 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm chargeDestination = reader.ReadVector2(); rotationDirection = reader.ReadInt32(); chargeVelocityScalar = reader.ReadSingle(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - CalamityGlobalNPC.adultEidolonWyrmHead = npc.whoAmI; + CalamityGlobalNPC.adultEidolonWyrmHead = NPC.whoAmI; // Difficulty modes bool malice = CalamityWorld.malice; @@ -149,7 +150,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm bool expertMode = Main.expertMode; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Phases bool phase2 = lifeRatio < 0.8f; @@ -159,53 +160,53 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm bool phase6 = lifeRatio < 0.05f; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); // Target variable - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; bool targetDownDeep = player.Calamity().ZoneAbyssLayer4; bool targetOnMount = player.mount.Active; // Check whether enraged for the sake of the HP bar UI - npc.Calamity().CurrentlyEnraged = !targetDownDeep || malice; + NPC.Calamity().CurrentlyEnraged = !targetDownDeep || malice; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Play spawn sound - if (!TailSpawned && npc.ai[0] == 0f) + if (!TailSpawned && NPC.ai[0] == 0f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Scare"), Main.player[Main.myPlayer].Center); + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Scare"), Main.player[Main.myPlayer].Center); } // Spawn segments if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!TailSpawned && npc.ai[0] == 0f) + if (!TailSpawned && NPC.ai[0] == 0f) { - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; for (int i = 0; i < maxLength; i++) { int lol; if (i >= 0 && i < minLength) { if (i % 2 == 0) - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); else - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } else - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = NPC.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); @@ -220,31 +221,31 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm bool targetDead = false; if (player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (player.dead) { targetDead = true; - npc.ai[3] = 0f; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; - npc.localAI[3] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; + NPC.localAI[3] = 0f; AIState = (float)Phase.ChargeOne; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; chargeVelocityScalar = 0f; rotationDirection = 0; - npc.velocity.Y += 3f; - if (npc.position.Y > Main.worldSurface * 16.0) - npc.velocity.Y += 3f; + NPC.velocity.Y += 3f; + if (NPC.position.Y > Main.worldSurface * 16.0) + NPC.velocity.Y += 3f; - if (npc.position.Y > Main.rockLayer * 16.0) + if (NPC.position.Y > Main.rockLayer * 16.0) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) Main.npc[a].active = false; } } @@ -288,16 +289,16 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm // Adjust slowing debuff immunity bool immuneToSlowingDebuffs = AIState == (float)Phase.FinalPhase || AIState == (float)Phase.ShadowFireballSpin; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; // Adjust opacity bool invisiblePartOfChargePhase = calamityGlobalNPC.newAI[2] >= chargePhaseGateValue && calamityGlobalNPC.newAI[2] <= chargePhaseGateValue + 1f && (AIState == (float)Phase.ChargeOne || AIState == (float)Phase.ChargeTwo || AIState == (float)Phase.FastCharge); @@ -305,23 +306,23 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm bool invisiblePhase = AIState == (float)Phase.LightningRain || AIState == (float)Phase.IceMist || AIState == (float)Phase.AncientDoomSummon; if (!invisiblePartOfChargePhase && !invisiblePartOfLightningChargePhase && !invisiblePhase) { - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } else { - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } // Rotation and direction - npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; - int direction = npc.direction; - npc.direction = npc.spriteDirection = (npc.velocity.X > 0f) ? 1 : (-1); - if (direction != npc.direction) - npc.netUpdate = true; + NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; + int direction = NPC.direction; + NPC.direction = NPC.spriteDirection = (NPC.velocity.X > 0f) ? 1 : (-1); + if (direction != NPC.direction) + NPC.netUpdate = true; // Default vector to swim to Vector2 destination = player.Center; @@ -394,12 +395,12 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm float maxAncientDoomRings = 3f; // Lightning charge variables - Vector2 lightningChargeVector = npc.localAI[2] == 0f ? new Vector2(baseDistance, 0f) : new Vector2(-baseDistance, 0f); + Vector2 lightningChargeVector = NPC.localAI[2] == 0f ? new Vector2(baseDistance, 0f) : new Vector2(-baseDistance, 0f); float lightningChargeLocationDistance = baseAttackTriggerDistance; Vector2 lightningChargeLocation = destination + lightningChargeVector; Vector2 lightningChargeVectorFlipped = lightningChargeVector * -1f; float lightningSpawnY = 540f; - Vector2 lightningSpawnLocation = new Vector2(npc.Center.X, npc.Center.Y - lightningSpawnY); + Vector2 lightningSpawnLocation = new Vector2(NPC.Center.X, NPC.Center.Y - lightningSpawnY); int numLightningBolts = malice ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; float distanceBetweenBolts = lightningSpawnY * 2f / numLightningBolts; @@ -425,7 +426,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm { calamityGlobalNPC.newAI[3] = 0f; - Main.PlaySound(SoundID.Item117, player.position); + SoundEngine.PlaySound(SoundID.Item117, player.position); for (int i = 0; i < 20; i++) { @@ -471,35 +472,35 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm turnSpeed *= normalChargeTurnSpeedMult; turnDistance = chargeLocationDistance; - if ((chargeLocation - npc.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) + if ((chargeLocation - NPC.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) { calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center); + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center); chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; - npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; - npc.netUpdate = true; - npc.netSpam -= 5; + NPC.velocity = Vector2.Normalize(chargeDestination - NPC.Center) * baseVelocity; + NPC.netUpdate = true; + NPC.netSpam -= 5; } else { // Charge // Become totally visible - npc.Opacity = 1f; + NPC.Opacity = 1f; destination = chargeDestination; - if ((destination - npc.Center).Length() < chargeLocationDistance) + if ((destination - NPC.Center).Length() < chargeLocationDistance) { - npc.ai[3] += 1f; + NPC.ai[3] += 1f; float maxCharges = phase4 ? 1 : phase2 ? 2 : 3; - if (npc.ai[3] >= maxCharges) + if (NPC.ai[3] >= maxCharges) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; AIState = phase4 ? (float)Phase.ShadowFireballSpin : (float)Phase.LightningRain; } else if (phase2) @@ -512,7 +513,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm calamityGlobalNPC.newAI[2] = 0f; chargeVelocityScalar = 0f; FinalPhaseCheck(); - npc.TargetClosest(); + NPC.TargetClosest(); } } } @@ -539,12 +540,12 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm baseVelocity *= invisiblePhaseVelocityMult; turnSpeed *= invisiblePhaseTurnSpeedMult; - if ((destination - npc.Center).Length() < lightningRainLocationDistance || calamityGlobalNPC.newAI[2] > 0f) + if ((destination - NPC.Center).Length() < lightningRainLocationDistance || calamityGlobalNPC.newAI[2] > 0f) { if (calamityGlobalNPC.newAI[2] % 30f == 0f && calamityGlobalNPC.newAI[2] < lightningRainDuration) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), Main.player[Main.myPlayer].Center); + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), Main.player[Main.myPlayer].Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -560,7 +561,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm continue; Vector2 playerCenter = Main.player[i].Center; - float distance = Vector2.Distance(playerCenter, npc.Center); + float distance = Vector2.Distance(playerCenter, NPC.Center); if (distance < maxDistance) { whoAmIArray[numProjectiles] = i; @@ -578,26 +579,26 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm for (int i = 0; i < numProjectiles; i++) { // Predictive bolt - Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center; + Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt - NPC.Center; float ai = Main.rand.Next(100); Vector2 projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; int type = ProjectileID.CultistBossLightningOrbArc; - int damage = npc.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + int damage = NPC.GetProjectileDamage(type); + int proj = Projectile.NewProjectile(NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); Main.projectile[proj].tileCollide = false; // Opposite bolt - projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center; + projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - NPC.Center; ai = Main.rand.Next(100); projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; - proj = Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + proj = Projectile.NewProjectile(NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); Main.projectile[proj].tileCollide = false; // Normal bolt - projectileDestination = targetCenterArray[i] - npc.Center; + projectileDestination = targetCenterArray[i] - NPC.Center; ai = Main.rand.Next(100); projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; - proj = Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + proj = Projectile.NewProjectile(NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); Main.projectile[proj].tileCollide = false; } } @@ -605,30 +606,30 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm calamityGlobalNPC.newAI[2] += 1f; - Lighting.AddLight(npc.Center, 0.4f, 0.85f, 0.9f); + Lighting.AddLight(NPC.Center, 0.4f, 0.85f, 0.9f); float rotation = MathHelper.Clamp((float)Main.rand.NextDouble() * 1f - 0.5f, -0.5f, 0.5f); - Vector2 dustPosition = new Vector2(-npc.width * 0.2f * npc.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); - int dust = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 226, (0f - npc.velocity.X) / 3f, (0f - npc.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); - Main.dust[dust].position = npc.Center + dustPosition; - Main.dust[dust].velocity = Vector2.Normalize(Main.dust[dust].position - npc.Center) * 2f; + Vector2 dustPosition = new Vector2(-NPC.width * 0.2f * NPC.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(NPC.velocity.ToRotation()); + int dust = Dust.NewDust(NPC.Center - Vector2.One * 5f, 10, 10, 226, (0f - NPC.velocity.X) / 3f, (0f - NPC.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); + Main.dust[dust].position = NPC.Center + dustPosition; + Main.dust[dust].velocity = Vector2.Normalize(Main.dust[dust].position - NPC.Center) * 2f; Main.dust[dust].noGravity = true; rotation = MathHelper.Clamp((float)Main.rand.NextDouble() * 1f - 0.5f, -0.5f, 0.5f); - dustPosition = new Vector2(-npc.width * 0.6f * npc.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); - dust = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 226, (0f - npc.velocity.X) / 3f, (0f - npc.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); + dustPosition = new Vector2(-NPC.width * 0.6f * NPC.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(NPC.velocity.ToRotation()); + dust = Dust.NewDust(NPC.Center - Vector2.One * 5f, 10, 10, 226, (0f - NPC.velocity.X) / 3f, (0f - NPC.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); Main.dust[dust].velocity = Vector2.Zero; - Main.dust[dust].position = npc.Center + dustPosition; + Main.dust[dust].position = NPC.Center + dustPosition; Main.dust[dust].noGravity = true; if (calamityGlobalNPC.newAI[2] >= lightningRainDuration) { - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; AIState = (float)Phase.FastCharge; calamityGlobalNPC.newAI[2] = fastChargeGateValue; chargeVelocityScalar = 0f; FinalPhaseCheck(); - npc.TargetClosest(); + NPC.TargetClosest(); } } @@ -650,42 +651,42 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm turnSpeed *= fastChargeTurnSpeedMult; turnDistance = chargeLocationDistance; - if ((chargeLocation - npc.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) + if ((chargeLocation - NPC.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) { calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center); + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center); chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; - npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; - npc.netUpdate = true; - npc.netSpam -= 5; + NPC.velocity = Vector2.Normalize(chargeDestination - NPC.Center) * baseVelocity; + NPC.netUpdate = true; + NPC.netSpam -= 5; } else { // Charge very quickly // Become totally visible - npc.Opacity = 1f; + NPC.Opacity = 1f; destination = chargeDestination; - if ((destination - npc.Center).Length() < chargeLocationDistance) + if ((destination - NPC.Center).Length() < chargeLocationDistance) { if (!phase5) { - AIState = npc.localAI[0] == 0f ? (float)Phase.EidolonWyrmSpawn : (float)Phase.EidolistSpawn; + AIState = NPC.localAI[0] == 0f ? (float)Phase.EidolonWyrmSpawn : (float)Phase.EidolistSpawn; calamityGlobalNPC.newAI[2] = 0f; } else { - npc.ai[3] += 1f; - if (npc.ai[3] >= 2f) + NPC.ai[3] += 1f; + if (NPC.ai[3] >= 2f) { - npc.ai[3] = 0f; - AIState = npc.localAI[0] == 0f ? (float)Phase.ChargeTwo : (float)Phase.ChargeOne; + NPC.ai[3] = 0f; + AIState = NPC.localAI[0] == 0f ? (float)Phase.ChargeTwo : (float)Phase.ChargeOne; calamityGlobalNPC.newAI[2] = 0f; } else @@ -698,7 +699,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm chargeVelocityScalar = 0f; FinalPhaseCheck(); - npc.TargetClosest(); + NPC.TargetClosest(); } } } @@ -722,10 +723,10 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm { if (!NPC.AnyNPCs(ModContent.NPCType())) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), Main.player[Main.myPlayer].Center); + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), Main.player[Main.myPlayer].Center); - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); } } } @@ -737,7 +738,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm AIState = (float)Phase.ChargeTwo; calamityGlobalNPC.newAI[2] = 0f; FinalPhaseCheck(); - npc.TargetClosest(); + NPC.TargetClosest(); } break; @@ -758,35 +759,35 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm turnSpeed *= normalChargeTurnSpeedMult; turnDistance = chargeLocationDistance; - if ((chargeLocation - npc.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) + if ((chargeLocation - NPC.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) { calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center); + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center); chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; - npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; - npc.netUpdate = true; - npc.netSpam -= 5; + NPC.velocity = Vector2.Normalize(chargeDestination - NPC.Center) * baseVelocity; + NPC.netUpdate = true; + NPC.netSpam -= 5; } else { // Charge // Become totally visible - npc.Opacity = 1f; + NPC.Opacity = 1f; destination = chargeDestination; - if ((destination - npc.Center).Length() < chargeLocationDistance) + if ((destination - NPC.Center).Length() < chargeLocationDistance) { - npc.ai[3] += 1f; + NPC.ai[3] += 1f; float maxCharges = phase4 ? 1 : phase3 ? 2 : 3; - if (npc.ai[3] >= maxCharges) + if (NPC.ai[3] >= maxCharges) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; AIState = phase4 ? (float)Phase.AncientDoomSummon : (float)Phase.IceMist; } else if (phase3) @@ -799,7 +800,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm calamityGlobalNPC.newAI[2] = 0f; chargeVelocityScalar = 0f; FinalPhaseCheck(); - npc.TargetClosest(); + NPC.TargetClosest(); } } } @@ -826,7 +827,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm baseVelocity *= invisiblePhaseVelocityMult; turnSpeed *= invisiblePhaseTurnSpeedMult; - if ((destination - npc.Center).Length() < iceMistLocationDistance || calamityGlobalNPC.newAI[2] > 0f) + if ((destination - NPC.Center).Length() < iceMistLocationDistance || calamityGlobalNPC.newAI[2] > 0f) { if (calamityGlobalNPC.newAI[2] % 60f == 0f && calamityGlobalNPC.newAI[2] < iceMistDuration && Main.netMode != NetmodeID.MultiplayerClient) { @@ -842,7 +843,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm continue; Vector2 playerCenter = Main.player[i].Center; - float distance = Vector2.Distance(playerCenter, npc.Center); + float distance = Vector2.Distance(playerCenter, NPC.Center); if (distance < maxDistance) { whoAmIArray[numProjectiles] = i; @@ -860,50 +861,50 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm for (int i = 0; i < numProjectiles; i++) { // Predictive mist - Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center; + Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt - NPC.Center; Vector2 projectileVelocity = Vector2.Normalize(projectileDestination) * iceMistVelocity; int type = ProjectileID.CultistBossIceMist; - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); // Opposite mist - projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center; + projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - NPC.Center; projectileVelocity = Vector2.Normalize(projectileDestination) * iceMistVelocity; - Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); // Normal bolt - projectileDestination = targetCenterArray[i] - npc.Center; + projectileDestination = targetCenterArray[i] - NPC.Center; projectileVelocity = Vector2.Normalize(projectileDestination) * iceMistVelocity; - Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); } } calamityGlobalNPC.newAI[2] += 1f; - Lighting.AddLight(npc.Center, 0.3f, 0.75f, 0.9f); + Lighting.AddLight(NPC.Center, 0.3f, 0.75f, 0.9f); float rotation = MathHelper.Clamp((float)Main.rand.NextDouble() * 1f - 0.5f, -0.5f, 0.5f); - Vector2 dustPosition = new Vector2(-npc.width * 0.2f * npc.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); - int dust = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 197, 0f, 0f, 100, Color.Transparent); - Main.dust[dust].position = npc.Center + dustPosition; - Main.dust[dust].velocity = Vector2.Normalize(Main.dust[dust].position - npc.Center) * 2f; + Vector2 dustPosition = new Vector2(-NPC.width * 0.2f * NPC.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(NPC.velocity.ToRotation()); + int dust = Dust.NewDust(NPC.Center - Vector2.One * 5f, 10, 10, 197, 0f, 0f, 100, Color.Transparent); + Main.dust[dust].position = NPC.Center + dustPosition; + Main.dust[dust].velocity = Vector2.Normalize(Main.dust[dust].position - NPC.Center) * 2f; Main.dust[dust].noGravity = true; rotation = MathHelper.Clamp((float)Main.rand.NextDouble() * 1f - 0.5f, -0.5f, 0.5f); - dustPosition = new Vector2(-npc.width * 0.6f * npc.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); - dust = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 197, 0f, 0f, 100, Color.Transparent); + dustPosition = new Vector2(-NPC.width * 0.6f * NPC.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(NPC.velocity.ToRotation()); + dust = Dust.NewDust(NPC.Center - Vector2.One * 5f, 10, 10, 197, 0f, 0f, 100, Color.Transparent); Main.dust[dust].velocity = Vector2.Zero; - Main.dust[dust].position = npc.Center + dustPosition; + Main.dust[dust].position = NPC.Center + dustPosition; Main.dust[dust].noGravity = true; if (calamityGlobalNPC.newAI[2] >= iceMistDuration) { - npc.localAI[0] = 1f; + NPC.localAI[0] = 1f; AIState = (float)Phase.FastCharge; calamityGlobalNPC.newAI[2] = fastChargeGateValue; chargeVelocityScalar = 0f; FinalPhaseCheck(); - npc.TargetClosest(); + NPC.TargetClosest(); } } @@ -925,7 +926,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm turnSpeed *= invisiblePhaseTurnSpeedMult; // Spin around target - if ((destination - npc.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[2] > 0f) + if ((destination - NPC.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[2] > 0f) { calamityGlobalNPC.newAI[2] += 1f; @@ -933,21 +934,21 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm if (rotationDirection == 0) { // Set spin direction - if (Main.player[npc.target].velocity.X > 0f) + if (Main.player[NPC.target].velocity.X > 0f) rotationDirection = 1; - else if (Main.player[npc.target].velocity.X < 0f) + else if (Main.player[NPC.target].velocity.X < 0f) rotationDirection = -1; else rotationDirection = player.direction; // Set spin velocity - npc.velocity.X = MathHelper.Pi * spinRadius / spinVelocityDivisor; - npc.velocity *= -rotationDirection; - npc.netUpdate = true; + NPC.velocity.X = MathHelper.Pi * spinRadius / spinVelocityDivisor; + NPC.velocity *= -rotationDirection; + NPC.netUpdate = true; } else { - npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / spinVelocityDivisor * -rotationDirection); + NPC.velocity = NPC.velocity.RotatedBy(MathHelper.Pi / spinVelocityDivisor * -rotationDirection); if (calamityGlobalNPC.newAI[2] >= spinPhaseDuration) { @@ -956,7 +957,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm calamityGlobalNPC.newAI[2] = 0f; chargeVelocityScalar = 0f; FinalPhaseCheck(); - npc.TargetClosest(); + NPC.TargetClosest(); } } @@ -973,7 +974,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm destination += ancientDoomLocation; turnDistance = ancientDoomLocationDistance; - if (npc.localAI[1] < maxAncientDoomRings) + if (NPC.localAI[1] < maxAncientDoomRings) { calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] >= ancientDoomPhaseGateValue) @@ -992,25 +993,25 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm { float ai2 = i * ancientDoomDegrees; NPC.NewNPC((int)(player.Center.X + (float)(Math.Sin(i * ancientDoomDegrees) * ancientDoomDistance)), (int)(player.Center.Y + (float)(Math.Cos(i * ancientDoomDegrees) * ancientDoomDistance)), - NPCID.AncientDoom, 0, npc.whoAmI, 0f, ai2, 0f, Main.maxPlayers); + NPCID.AncientDoom, 0, NPC.whoAmI, 0f, ai2, 0f, Main.maxPlayers); } - npc.localAI[1] += 1f; - npc.TargetClosest(); + NPC.localAI[1] += 1f; + NPC.TargetClosest(); } } } } - if (npc.localAI[1] >= maxAncientDoomRings) + if (NPC.localAI[1] >= maxAncientDoomRings) { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= ancientDoomGateValue + maxAncientDoomRings) + NPC.localAI[1] += 1f; + if (NPC.localAI[1] >= ancientDoomGateValue + maxAncientDoomRings) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; AIState = phase4 ? (float)Phase.LightningCharge : (float)Phase.ChargeTwo; calamityGlobalNPC.newAI[2] = 0f; FinalPhaseCheck(); - npc.TargetClosest(); + NPC.TargetClosest(); } } @@ -1032,42 +1033,42 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm turnSpeed *= fastChargeTurnSpeedMult; turnDistance = lightningChargeLocationDistance; - if ((lightningChargeLocation - npc.Center).Length() < lightningChargeLocationDistance || calamityGlobalNPC.newAI[2] > lightningChargePhaseGateValue) + if ((lightningChargeLocation - NPC.Center).Length() < lightningChargeLocationDistance || calamityGlobalNPC.newAI[2] > lightningChargePhaseGateValue) { calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] == lightningChargePhaseGateValue + 1f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center); + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center); chargeDestination = destination + lightningChargeVectorFlipped + player.velocity * chargePredictionAmt; - npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; - npc.netUpdate = true; - npc.netSpam -= 5; + NPC.velocity = Vector2.Normalize(chargeDestination - NPC.Center) * baseVelocity; + NPC.netUpdate = true; + NPC.netSpam -= 5; } else { // Charge // Become totally visible - npc.Opacity = 1f; + NPC.Opacity = 1f; destination = chargeDestination; // Lightning barrage - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[3] == 0f) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[3] == 0f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), Main.player[Main.myPlayer].Center); + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), Main.player[Main.myPlayer].Center); - npc.localAI[3] = 1f; + NPC.localAI[3] = 1f; int type = ProjectileID.CultistBossLightningOrbArc; - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); for (int i = 0; i < numLightningBolts; i++) { Vector2 projectileDestination = player.Center - lightningSpawnLocation; float ai = Main.rand.Next(100); - int proj = Projectile.NewProjectile(lightningSpawnLocation, npc.velocity * 0.5f, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + int proj = Projectile.NewProjectile(lightningSpawnLocation, NPC.velocity * 0.5f, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); Main.projectile[proj].tileCollide = false; lightningSpawnLocation.Y += distanceBetweenBolts; if (i == numLightningBolts / 2) @@ -1075,19 +1076,19 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm } } - if ((destination - npc.Center).Length() < lightningChargeLocationDistance) + if ((destination - NPC.Center).Length() < lightningChargeLocationDistance) { - AIState = npc.localAI[2] == 0f ? (float)Phase.LightningRain : (float)Phase.IceMist; + AIState = NPC.localAI[2] == 0f ? (float)Phase.LightningRain : (float)Phase.IceMist; calamityGlobalNPC.newAI[2] = 0f; - npc.localAI[2] += 1f; - if (npc.localAI[2] > 1f) - npc.localAI[2] = 0f; + NPC.localAI[2] += 1f; + if (NPC.localAI[2] > 1f) + NPC.localAI[2] = 0f; - npc.localAI[3] = 0f; + NPC.localAI[3] = 0f; chargeVelocityScalar = 0f; FinalPhaseCheck(); - npc.TargetClosest(); + NPC.TargetClosest(); } } } @@ -1109,15 +1110,15 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm { if (!NPC.AnyNPCs(ModContent.NPCType())) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/EidolistDeath"), Main.player[Main.myPlayer].Center); + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/EidolistDeath"), Main.player[Main.myPlayer].Center); // Spawn Eidolists randomly around the target for (int i = 0; i < maxEidolists; i++) { - Point npcCenter = npc.Center.ToTileCoordinates(); + Point npcCenter = NPC.Center.ToTileCoordinates(); Point playerCenter = player.Center.ToTileCoordinates(); - Vector2 distance = player.Center - npc.Center; + Vector2 distance = player.Center - NPC.Center; int baseSpawnDistance = 60; int minDistance = 3; @@ -1153,7 +1154,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm AIState = (float)Phase.ChargeOne; calamityGlobalNPC.newAI[2] = 0f; FinalPhaseCheck(); - npc.TargetClosest(); + NPC.TargetClosest(); } break; @@ -1179,13 +1180,13 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm { float ai2 = i * ancientDoomDegrees; NPC.NewNPC((int)(player.Center.X + (float)(Math.Sin(i * ancientDoomDegrees) * ancientDoomDistance)), (int)(player.Center.Y + (float)(Math.Cos(i * ancientDoomDegrees) * ancientDoomDistance)), - NPCID.AncientDoom, 0, npc.whoAmI, 0f, ai2, 0f, Main.maxPlayers); + NPCID.AncientDoom, 0, NPC.whoAmI, 0f, ai2, 0f, Main.maxPlayers); } if (calamityGlobalNPC.newAI[2] >= 240f) calamityGlobalNPC.newAI[2] = -90f; - npc.TargetClosest(); + NPC.TargetClosest(); } } } @@ -1203,28 +1204,28 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm turnSpeed *= invisiblePhaseTurnSpeedMult; // Spin around target - if ((destination - npc.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[1] > 0f) + if ((destination - NPC.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[1] > 0f) { calamityGlobalNPC.newAI[1] += 1f; float spinVelocityDivisor = targetDownDeep ? 90f : 60f; if (rotationDirection == 0) { // Set spin direction - if (Main.player[npc.target].velocity.X > 0f) + if (Main.player[NPC.target].velocity.X > 0f) rotationDirection = 1; - else if (Main.player[npc.target].velocity.X < 0f) + else if (Main.player[NPC.target].velocity.X < 0f) rotationDirection = -1; else rotationDirection = player.direction; // Set spin velocity - npc.velocity.X = MathHelper.Pi * spinRadius / spinVelocityDivisor; - npc.velocity *= -rotationDirection; - npc.netUpdate = true; + NPC.velocity.X = MathHelper.Pi * spinRadius / spinVelocityDivisor; + NPC.velocity *= -rotationDirection; + NPC.netUpdate = true; } else { - npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / spinVelocityDivisor * -rotationDirection); + NPC.velocity = NPC.velocity.RotatedBy(MathHelper.Pi / spinVelocityDivisor * -rotationDirection); // Swim above target again if enough time has passed if (calamityGlobalNPC.newAI[1] >= spinPhaseDuration) @@ -1234,7 +1235,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm chargeVelocityScalar = 0f; rotationDirection = 0; - npc.TargetClosest(); + NPC.TargetClosest(); } } @@ -1249,7 +1250,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm { if (phase6) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; AIState = (float)Phase.FinalPhase; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; @@ -1260,35 +1261,35 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm if (!targetDead) { // Increase velocity if velocity is ever zero - if (npc.velocity == Vector2.Zero) - npc.velocity = Vector2.Normalize(player.Center - npc.Center).SafeNormalize(Vector2.Zero) * baseVelocity; + if (NPC.velocity == Vector2.Zero) + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center).SafeNormalize(Vector2.Zero) * baseVelocity; // Acceleration - if (!((destination - npc.Center).Length() < turnDistance)) + if (!((destination - NPC.Center).Length() < turnDistance)) { - float targetAngle = npc.AngleTo(destination); - float f = npc.velocity.ToRotation().AngleTowards(targetAngle, turnSpeed); - npc.velocity = f.ToRotationVector2() * baseVelocity; + float targetAngle = NPC.AngleTo(destination); + float f = NPC.velocity.ToRotation().AngleTowards(targetAngle, turnSpeed); + NPC.velocity = f.ToRotationVector2() * baseVelocity; } } // Velocity upper limit - if (npc.velocity.Length() > baseVelocity) - npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * baseVelocity; + if (NPC.velocity.Length() > baseVelocity) + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.Zero) * baseVelocity; } private void ChargeDust(int dustAmt, float pie) { for (int num1474 = 0; num1474 < dustAmt; num1474++) { - Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; - vector171 = vector171.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)pie / (float)dustAmt) + npc.Center; + Vector2 vector171 = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; + vector171 = vector171.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)pie / (float)dustAmt) + NPC.Center; Vector2 value18 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 172, value18.X * 2f, value18.Y * 2f, 100, default, 1.4f); Main.dust[num1475].noGravity = true; Main.dust[num1475].noLight = true; Main.dust[num1475].velocity /= 4f; - Main.dust[num1475].velocity -= npc.velocity; + Main.dust[num1475].velocity -= NPC.velocity; } } @@ -1298,10 +1299,10 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -1311,7 +1312,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm if (dist4 < minDist) minDist = dist4; - return minDist <= 70f && npc.Opacity == 1f; + return minDist <= 70f && NPC.Opacity == 1f; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -1322,14 +1323,14 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 center = npc.Center; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 center = NPC.Center; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2(ModContent.GetTexture("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmHeadGlowHuge").Width, ModContent.GetTexture("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmHeadGlowHuge").Height) * 0.5f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmHeadGlowHuge"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), Color.White, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2(ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmHeadGlowHuge").Width, ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmHeadGlowHuge").Height) * 0.5f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmHeadGlowHuge"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), Color.White, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void BossLoot(ref string name, ref int potionType) @@ -1339,17 +1340,17 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropItem(npc, ModContent.ItemType(), 80, 100); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType(), 80, 100); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); int minLumenyl = Main.expertMode ? 65 : 50; int maxLumenyl = Main.expertMode ? 135 : 108; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1f, minLumenyl, maxLumenyl); - DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1f, minLumenyl, maxLumenyl); + DropHelper.DropItemCondition(NPC, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32); // Mark Adult Eidolon Wyrm as defeated CalamityWorld.downedAdultEidolonWyrm = true; @@ -1359,14 +1360,14 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/WyrmAdult"), 1f); } } @@ -1374,13 +1375,13 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) { - if (npc.Opacity == 1f) + if (NPC.Opacity == 1f) player.AddBuff(ModContent.BuffType(), 600, true); } } diff --git a/NPCs/AdultEidolonWyrm/EidolonWyrmTailHuge.cs b/NPCs/AdultEidolonWyrm/EidolonWyrmTailHuge.cs index 2e6e4d2d33..73699442ca 100644 --- a/NPCs/AdultEidolonWyrm/EidolonWyrmTailHuge.cs +++ b/NPCs/AdultEidolonWyrm/EidolonWyrmTailHuge.cs @@ -17,33 +17,33 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public override void SetDefaults() { - npc.damage = 100; - npc.width = 86; - npc.height = 120; - npc.defense = 0; - npc.LifeMaxNERB(2415000, 2898000); + NPC.damage = 100; + NPC.width = 86; + NPC.height = 120; + NPC.defense = 0; + NPC.LifeMaxNERB(2415000, 2898000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.Opacity = 0f; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.dontCountMe = true; - npc.dontTakeDamage = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.Opacity = 0f; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath6; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.dontTakeDamage = true; + NPC.chaseable = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { - npc.damage = 0; + NPC.damage = 0; // Difficulty modes bool malice = CalamityWorld.malice; @@ -51,8 +51,8 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm bool revenge = CalamityWorld.revenge; bool expertMode = Main.expertMode; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -66,20 +66,20 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); float chargePhaseGateValue = malice ? 120f : death ? 180f : revenge ? 210f : expertMode ? 240f : 300f; float lightningChargePhaseGateValue = malice ? 90f : death ? 120f : revenge ? 135f : expertMode ? 150f : 180f; @@ -89,23 +89,23 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm bool invisiblePhase = calamityGlobalNPC_Head.newAI[0] == 1f || calamityGlobalNPC_Head.newAI[0] == 5f || calamityGlobalNPC_Head.newAI[0] == 7f; if (!invisiblePartOfChargePhase && !invisiblePartOfLightningChargePhase && !invisiblePhase) { - if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + if (Main.npc[(int)NPC.ai[1]].Opacity > 0.5f) { - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } } else { - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; @@ -114,44 +114,44 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm num192 -= vector18.Y; float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2(ModContent.GetTexture("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmTailGlowHuge").Width, ModContent.GetTexture("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmTailGlowHuge").Height) * 0.5f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmTailGlowHuge"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), Color.White, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2(ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmTailGlowHuge").Width, ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmTailGlowHuge").Height) * 0.5f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/EidolonWyrmTailGlowHuge"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), Color.White, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override bool CheckActive() => false; @@ -160,12 +160,12 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); - Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult4"), 1f); + Gore.NewGore(NPC.Center, NPC.velocity, Mod.GetGoreSlot("Gores/WyrmAdult4"), 1f); } } } diff --git a/NPCs/AquaticScourge/AquaticParasite.cs b/NPCs/AquaticScourge/AquaticParasite.cs index be7297ecd3..730dcf4ebe 100644 --- a/NPCs/AquaticScourge/AquaticParasite.cs +++ b/NPCs/AquaticScourge/AquaticParasite.cs @@ -17,130 +17,130 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.noGravity = true; - npc.damage = Main.hardMode ? 35 : 15; - npc.width = 28; - npc.height = 28; - npc.defense = 5; - npc.LifeMaxNERB(Main.hardMode ? 200 : 30); - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.damage = Main.hardMode ? 35 : 15; + NPC.width = 28; + NPC.height = 28; + NPC.defense = 5; + NPC.LifeMaxNERB(Main.hardMode ? 200 : 30); + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 0, 60); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 0, 60); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { bool flag15 = false; - if (npc.wet && npc.ai[1] == 1f) + if (NPC.wet && NPC.ai[1] == 1f) { flag15 = true; } - if (npc.direction == 0) + if (NPC.direction == 0) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } if (flag15) { return; } - if (!npc.wet) + if (!NPC.wet) { - npc.rotation += npc.velocity.X * 0.1f; - if (npc.velocity.Y == 0f) + NPC.rotation += NPC.velocity.X * 0.1f; + if (NPC.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.98f; - if ((double)npc.velocity.X > -0.01 && (double)npc.velocity.X < 0.01) + NPC.velocity.X = NPC.velocity.X * 0.98f; + if ((double)NPC.velocity.X > -0.01 && (double)NPC.velocity.X < 0.01) { - npc.velocity.X = 0f; + NPC.velocity.X = 0f; } } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 10f) + NPC.velocity.Y = NPC.velocity.Y + 0.2f; + if (NPC.velocity.Y > 10f) { - npc.velocity.Y = 10f; + NPC.velocity.Y = 10f; } - npc.ai[0] = 1f; + NPC.ai[0] = 1f; return; } - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; } - if (npc.collideY) + if (NPC.collideY) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } bool flag16 = false; - if (!Main.player[npc.target].dead) + if (!Main.player[NPC.target].dead) { flag16 = true; } if (flag16) { - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - npc.velocity *= 0.975f; + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; + NPC.velocity *= 0.975f; float num263 = 2f; - if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) + if (NPC.velocity.X > -num263 && NPC.velocity.X < num263 && NPC.velocity.Y > -num263 && NPC.velocity.Y < num263) { - npc.TargetClosest(true); + NPC.TargetClosest(true); float num264 = 12f; - Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; - float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; + Vector2 vector31 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num265 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - vector31.X; + float num266 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - vector31.Y; float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); num267 = num264 / num267; num265 *= num267; num266 *= num267; - npc.velocity.X = num265; - npc.velocity.Y = num266; + NPC.velocity.X = num265; + NPC.velocity.Y = num266; } } else { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; - npc.rotation = npc.velocity.X * 0.4f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.02f; + NPC.rotation = NPC.velocity.X * 0.4f; + if (NPC.velocity.X < -1f || NPC.velocity.X > 1f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if (npc.velocity.Y < -1f) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if (NPC.velocity.Y < -1f) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if (npc.velocity.Y > 1f) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if (NPC.velocity.Y > 1f) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num268 = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int num269 = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; if (Main.tile[num268, num269 - 1] == null) { Main.tile[num268, num269 - 1] = new Tile(); @@ -157,30 +157,30 @@ namespace CalamityMod.NPCs.AquaticScourge { if (Main.tile[num268, num269 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num268, num269 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } else { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) + if ((double)NPC.velocity.Y > 1.2 || (double)NPC.velocity.Y < -1.2) { - npc.velocity.Y = npc.velocity.Y * 0.99f; + NPC.velocity.Y = NPC.velocity.Y * 0.99f; } } } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -189,7 +189,7 @@ namespace CalamityMod.NPCs.AquaticScourge { return 0f; } - if (spawnInfo.player.InSulphur() && spawnInfo.water) + if (spawnInfo.Player.InSulphur() && spawnInfo.water) { return 0.2f; } @@ -205,16 +205,16 @@ namespace CalamityMod.NPCs.AquaticScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticParasite1"), 1f); - Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticParasite2"), 1f); + Gore.NewGore(NPC.Center, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticParasite1"), 1f); + Gore.NewGore(NPC.Center, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticParasite2"), 1f); } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index 007b371ff0..dc1f4dd123 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -19,56 +19,56 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.width = 32; - npc.height = 32; - npc.defense = 20; - npc.DR_NERD(0.1f); - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.width = 32; + NPC.height = 32; + NPC.defense = 20; + NPC.DR_NERD(0.1f); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.LifeMaxNERB(77000, 92000, 1000000); + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.LifeMaxNERB(77000, 92000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - npc.canGhostHeal = false; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + NPC.canGhostHeal = false; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -78,32 +78,32 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - CalamityAI.AquaticScourgeAI(npc, mod, false); + CalamityAI.AquaticScourgeAI(NPC, Mod, false); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - Color color = npc.GetAlpha(lightColor); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Color color = NPC.GetAlpha(lightColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (Main.npc[(int)npc.ai[2]].Calamity().newAI[3] > 480f) - color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[3] - 480f) / 180f, 0f, 1f)); - else if (Main.npc[(int)npc.ai[2]].localAI[3] > 0f) - color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)npc.ai[2]].localAI[3] / 90f, 0f, 1f)); + if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] > 480f) + color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] - 480f) / 180f, 0f, 1f)); + else if (Main.npc[(int)NPC.ai[2]].localAI[3] > 0f) + color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 90f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -112,7 +112,7 @@ namespace CalamityMod.NPCs.AquaticScourge { if (projectile.minion) { - return npc.Calamity().newAI[0] == 1f; + return NPC.Calamity().newAI[0] == 1f; } return null; } @@ -129,26 +129,26 @@ namespace CalamityMod.NPCs.AquaticScourge public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody3"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody4"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody3"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody4"), NPC.scale); } } diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index 4341dacb97..f09960ccd3 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -19,55 +19,55 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.GetNPCDamage(); - npc.width = 32; - npc.height = 32; - npc.defense = 15; - npc.DR_NERD(0.1f); - npc.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 32; + NPC.height = 32; + NPC.defense = 15; + NPC.DR_NERD(0.1f); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.LifeMaxNERB(77000, 92000, 1000000); + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.LifeMaxNERB(77000, 92000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - npc.canGhostHeal = false; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + NPC.canGhostHeal = false; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -77,32 +77,32 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - CalamityAI.AquaticScourgeAI(npc, mod, false); + CalamityAI.AquaticScourgeAI(NPC, Mod, false); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - Color color = npc.GetAlpha(lightColor); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Color color = NPC.GetAlpha(lightColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (Main.npc[(int)npc.ai[2]].Calamity().newAI[3] > 480f) - color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[3] - 480f) / 180f, 0f, 1f)); - else if (Main.npc[(int)npc.ai[2]].localAI[3] > 0f) - color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)npc.ai[2]].localAI[3] / 90f, 0f, 1f)); + if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] > 480f) + color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] - 480f) / 180f, 0f, 1f)); + else if (Main.npc[(int)NPC.ai[2]].localAI[3] > 0f) + color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 90f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.AquaticScourge { if (projectile.minion) { - return npc.Calamity().newAI[0] == 1f; + return NPC.Calamity().newAI[0] == 1f; } return null; } @@ -128,25 +128,25 @@ namespace CalamityMod.NPCs.AquaticScourge public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt3"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt3"), NPC.scale); } } diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 7f95d73ba6..ed3d6eab6d 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -19,6 +19,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items.Armor.Vanity; +using Terraria.Audio; namespace CalamityMod.NPCs.AquaticScourge { @@ -32,95 +33,95 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.npcSlots = 16f; - npc.GetNPCDamage(); - npc.Calamity().canBreakPlayerDefense = true; - npc.width = 90; - npc.height = 90; - npc.defense = 10; - npc.DR_NERD(0.05f); - npc.aiStyle = -1; + NPC.npcSlots = 16f; + NPC.GetNPCDamage(); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.width = 90; + NPC.height = 90; + NPC.defense = 10; + NPC.DR_NERD(0.05f); + NPC.aiStyle = -1; aiType = -1; - npc.LifeMaxNERB(77000, 92000, 1000000); + NPC.LifeMaxNERB(77000, 92000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 40, 0, 0); - npc.behindTiles = true; - npc.chaseable = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 40, 0, 0); + NPC.behindTiles = true; + NPC.chaseable = false; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; bossBag = ModContent.ItemType(); if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.chaseable); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.chaseable = reader.ReadBoolean(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - if (npc.justHit || npc.life <= npc.lifeMax * 0.999 || BossRushEvent.BossRushActive) + if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || BossRushEvent.BossRushActive) music = CalamityMod.Instance.GetMusicFromMusicMod("AquaticScourge") ?? MusicID.Boss2; - CalamityAI.AquaticScourgeAI(npc, mod, true); + CalamityAI.AquaticScourgeAI(NPC, Mod, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - Color color = npc.GetAlpha(lightColor); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Color color = NPC.GetAlpha(lightColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.Calamity().newAI[3] > 480f) - color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((npc.Calamity().newAI[3] - 480f) / 180f, 0f, 1f)); - else if (npc.localAI[3] > 0f) - color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(npc.localAI[3] / 90f, 0f, 1f)); + if (NPC.Calamity().newAI[3] > 480f) + color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((NPC.Calamity().newAI[3] - 480f) / 180f, 0f, 1f)); + else if (NPC.localAI[3] > 0f) + color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(NPC.localAI[3] / 90f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -129,10 +130,10 @@ namespace CalamityMod.NPCs.AquaticScourge { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -148,20 +149,20 @@ namespace CalamityMod.NPCs.AquaticScourge public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) - return npc.Calamity().newAI[0] == 1f; + return NPC.Calamity().newAI[0] == 1f; return null; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().disableNaturalScourgeSpawns) + if (spawnInfo.Player.Calamity().disableNaturalScourgeSpawns) return 0f; if (spawnInfo.playerSafe) return 0f; - if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.water) { if (!NPC.AnyNPCs(ModContent.NPCType())) return 0.01f; @@ -177,25 +178,25 @@ namespace CalamityMod.NPCs.AquaticScourge public override bool SpecialNPCLoot() { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + int closestSegmentID = DropHelper.FindClosestWormSegment(NPC, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()); - npc.position = Main.npc[closestSegmentID].position; + NPC.position = Main.npc[closestSegmentID].position; return false; } public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItem(npc, ItemID.GreaterHealingPotion, 8, 14); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedAquaticScourge); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedAquaticScourge); + DropHelper.DropItem(NPC, ItemID.GreaterHealingPotion, 8, 14); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedAquaticScourge); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedAquaticScourge); CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedAquaticScourge); @@ -204,7 +205,7 @@ namespace CalamityMod.NPCs.AquaticScourge { // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -214,23 +215,23 @@ namespace CalamityMod.NPCs.AquaticScourge ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); // Fishing - DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // If Aquatic Scourge has not yet been killed, notify players of buffed Acid Rain if (!CalamityWorld.downedAquaticScourge) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); string sulfSeaBoostKey = "Mods.CalamityMod.WetWormBossText"; Color sulfSeaBoostColor = AcidRainEvent.TextColor; @@ -247,27 +248,27 @@ namespace CalamityMod.NPCs.AquaticScourge public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASHead"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/ASHead"), NPC.scale); } } public override bool CheckActive() { - if (npc.Calamity().newAI[0] == 1f && !Main.player[npc.target].dead && npc.Calamity().newAI[1] != 1f) + if (NPC.Calamity().newAI[0] == 1f && !Main.player[NPC.target].dead && NPC.Calamity().newAI[1] != 1f) return false; return true; diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 0ceff75ace..05702d9591 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -19,55 +19,55 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.GetNPCDamage(); - npc.width = 32; - npc.height = 32; - npc.defense = 25; - npc.DR_NERD(0.15f); - npc.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 32; + NPC.height = 32; + NPC.defense = 25; + NPC.DR_NERD(0.15f); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.LifeMaxNERB(77000, 92000, 1000000); + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.LifeMaxNERB(77000, 92000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - npc.canGhostHeal = false; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + NPC.canGhostHeal = false; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -77,32 +77,32 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - CalamityAI.AquaticScourgeAI(npc, mod, false); + CalamityAI.AquaticScourgeAI(NPC, Mod, false); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - Color color = npc.GetAlpha(lightColor); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Color color = NPC.GetAlpha(lightColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (Main.npc[(int)npc.ai[2]].Calamity().newAI[3] > 480f) - color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[3] - 480f) / 180f, 0f, 1f)); - else if (Main.npc[(int)npc.ai[2]].localAI[3] > 0f) - color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)npc.ai[2]].localAI[3] / 90f, 0f, 1f)); + if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] > 480f) + color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] - 480f) / 180f, 0f, 1f)); + else if (Main.npc[(int)NPC.ai[2]].localAI[3] > 0f) + color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 90f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.AquaticScourge { if (projectile.minion) { - return npc.Calamity().newAI[0] == 1f; + return NPC.Calamity().newAI[0] == 1f; } return null; } @@ -128,24 +128,24 @@ namespace CalamityMod.NPCs.AquaticScourge public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASTail"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASTail2"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/ASTail"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/ASTail2"), NPC.scale); } } diff --git a/NPCs/AquaticScourge/AquaticSeekerBody.cs b/NPCs/AquaticScourge/AquaticSeekerBody.cs index 2a74e50460..d0413eaa8d 100644 --- a/NPCs/AquaticScourge/AquaticSeekerBody.cs +++ b/NPCs/AquaticScourge/AquaticSeekerBody.cs @@ -15,28 +15,28 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.damage = 15; - npc.width = 16; - npc.height = 16; - npc.defense = 10; - npc.lifeMax = 60; - npc.aiStyle = -1; + NPC.damage = 15; + NPC.width = 16; + NPC.height = 16; + NPC.defense = 10; + NPC.lifeMax = 60; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -46,11 +46,11 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead) + NPC.TargetClosest(true); // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -64,32 +64,32 @@ namespace CalamityMod.NPCs.AquaticScourge } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - if (Main.player[npc.target].dead) - npc.TargetClosest(false); + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -97,30 +97,30 @@ namespace CalamityMod.NPCs.AquaticScourge num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; else if (num191 > 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } } @@ -138,15 +138,15 @@ namespace CalamityMod.NPCs.AquaticScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerBody"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerBody"), 1f); } } } diff --git a/NPCs/AquaticScourge/AquaticSeekerHead.cs b/NPCs/AquaticScourge/AquaticSeekerHead.cs index 8aeaae2e86..1d8dca2da2 100644 --- a/NPCs/AquaticScourge/AquaticSeekerHead.cs +++ b/NPCs/AquaticScourge/AquaticSeekerHead.cs @@ -23,57 +23,57 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.damage = 20; - npc.width = 22; - npc.height = 28; - npc.defense = 5; - npc.lifeMax = 60; - npc.aiStyle = -1; + NPC.damage = 20; + NPC.width = 22; + NPC.height = 28; + NPC.defense = 5; + NPC.lifeMax = 60; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - banner = npc.type; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 0, 80); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - if (npc.ai[2] > 0f) + if (NPC.ai[2] > 0f) { - npc.realLife = (int)npc.ai[2]; + NPC.realLife = (int)NPC.ai[2]; } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!TailSpawned && npc.ai[0] == 0f) + if (!TailSpawned && NPC.ai[0] == 0f) { - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { int lol; if (num36 >= 0 && num36 < minLength) { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } else { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = (float)NPC.whoAmI; Main.npc[lol].ai[1] = (float)Previous; Main.npc[Previous].ai[0] = (float)lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); @@ -82,61 +82,61 @@ namespace CalamityMod.NPCs.AquaticScourge TailSpawned = true; } } - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } - else if (npc.velocity.X > 0f) + else if (NPC.velocity.X > 0f) { - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } - if (Main.player[npc.target].dead) + if (Main.player[NPC.target].dead) { - npc.TargetClosest(false); + NPC.TargetClosest(false); } - npc.alpha -= 42; - if (npc.alpha < 0) + NPC.alpha -= 42; + if (NPC.alpha < 0) { - npc.alpha = 0; + NPC.alpha = 0; } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f) + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) { - npc.active = false; + NPC.active = false; } float num188 = speed * (Main.hardMode ? 3f : 1f); float num189 = turnSpeed * (Main.hardMode ? 3f : 1f); - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - if ((Main.player[npc.target].Center - npc.Center).Length() > 200f) + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + if ((Main.player[NPC.target].Center - NPC.Center).Length() > 200f) { num192 -= 160; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) + if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 250f) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - num191 = Main.player[npc.target].Center.X + 300f; + num191 = Main.player[NPC.target].Center.X + 300f; } else { - num191 = Main.player[npc.target].Center.X - 300f; + num191 = Main.player[NPC.target].Center.X - 300f; } } } float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); + float num50 = NPC.velocity.Length(); if (num50 > 0f) { if (num50 > num48) { - npc.velocity.Normalize(); - npc.velocity *= num48; + NPC.velocity.Normalize(); + NPC.velocity *= num48; } else if (num50 < num49) { - npc.velocity.Normalize(); - npc.velocity *= num49; + NPC.velocity.Normalize(); + NPC.velocity *= num49; } } num191 = (float)((int)(num191 / 16f) * 16); @@ -151,50 +151,50 @@ namespace CalamityMod.NPCs.AquaticScourge float num198 = num188 / num193; num191 *= num198; num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - if (npc.velocity.X > num191) + if (NPC.velocity.X > num191) { - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - if (npc.velocity.Y > num192) + if (NPC.velocity.Y > num192) { - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num189 * 2f; } else { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 2f; } } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X + num189 * 2f; //changed from 2 } else { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X - num189 * 2f; //changed from 2 } } } @@ -202,50 +202,50 @@ namespace CalamityMod.NPCs.AquaticScourge { if (num196 > num197) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X + num189 * 1.1f; //changed from 1.1 } - else if (npc.velocity.X > num191) + else if (NPC.velocity.X > num191) { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X - num189 * 1.1f; //changed from 1.1 } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)num188 * 0.5) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } } else { - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + num189 * 1.1f; } - else if (npc.velocity.Y > num192) + else if (NPC.velocity.Y > num192) { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 1.1f; } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)num188 * 0.5) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } } } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -254,7 +254,7 @@ namespace CalamityMod.NPCs.AquaticScourge { return 0f; } - if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.water) { if (!NPC.AnyNPCs(ModContent.NPCType())) return 0.01f; @@ -266,15 +266,15 @@ namespace CalamityMod.NPCs.AquaticScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerHead"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerHead"), 1f); } } diff --git a/NPCs/AquaticScourge/AquaticSeekerTail.cs b/NPCs/AquaticScourge/AquaticSeekerTail.cs index 28c3c5a14c..08dbe6db0d 100644 --- a/NPCs/AquaticScourge/AquaticSeekerTail.cs +++ b/NPCs/AquaticScourge/AquaticSeekerTail.cs @@ -15,28 +15,28 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.damage = 5; - npc.width = 16; - npc.height = 22; - npc.defense = 20; - npc.lifeMax = 60; - npc.aiStyle = -1; + NPC.damage = 5; + NPC.width = 16; + NPC.height = 22; + NPC.defense = 20; + NPC.lifeMax = 60; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -46,11 +46,11 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead) + NPC.TargetClosest(true); // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -64,32 +64,32 @@ namespace CalamityMod.NPCs.AquaticScourge } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - if (Main.player[npc.target].dead) - npc.TargetClosest(false); + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -97,30 +97,30 @@ namespace CalamityMod.NPCs.AquaticScourge num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; else if (num191 > 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } } @@ -138,15 +138,15 @@ namespace CalamityMod.NPCs.AquaticScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerTail"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerTail"), 1f); } } } diff --git a/NPCs/AquaticScourge/AquaticUrchin.cs b/NPCs/AquaticScourge/AquaticUrchin.cs index 4d9a769eb6..368e8bbd84 100644 --- a/NPCs/AquaticScourge/AquaticUrchin.cs +++ b/NPCs/AquaticScourge/AquaticUrchin.cs @@ -16,29 +16,29 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.damage = Main.hardMode ? 50 : 25; - npc.width = 40; - npc.height = 40; - npc.defense = 10; - npc.lifeMax = Main.hardMode ? 300 : 50; - npc.knockBackResist = 0.8f; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath15; - npc.behindTiles = true; - banner = npc.type; + NPC.damage = Main.hardMode ? 50 : 25; + NPC.width = 40; + NPC.height = 40; + NPC.defense = 10; + NPC.lifeMax = Main.hardMode ? 300 : 50; + NPC.knockBackResist = 0.8f; + NPC.value = Item.buyPrice(0, 0, 0, 80); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath15; + NPC.behindTiles = true; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - CalamityAI.UnicornAI(npc, mod, true, npc.wet ? 12f : 4f, npc.wet ? 7f : 3f, npc.wet ? 0.12f : 0.05f, npc.wet ? -16f : -7.5f, npc.wet ? -14f : -6.5f, npc.wet ? -13f : -6f, npc.wet ? -12f : -5f, npc.wet ? -15f : -7f); + CalamityAI.UnicornAI(NPC, Mod, true, NPC.wet ? 12f : 4f, NPC.wet ? 7f : 3f, NPC.wet ? 0.12f : 0.05f, NPC.wet ? -16f : -7.5f, NPC.wet ? -14f : -6.5f, NPC.wet ? -13f : -6f, NPC.wet ? -12f : -5f, NPC.wet ? -15f : -7f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -52,7 +52,7 @@ namespace CalamityMod.NPCs.AquaticScourge { return 0f; } - if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water && NPC.CountNPCS(ModContent.NPCType()) < 2) + if (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.water && NPC.CountNPCS(ModContent.NPCType()) < 2) { return 0.2f; } @@ -61,24 +61,24 @@ namespace CalamityMod.NPCs.AquaticScourge public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 15, 25); + DropHelper.DropItem(NPC, ModContent.ItemType(), 15, 25); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin3"), 1f); } } } diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index ce678627ed..e1354f3d8e 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -8,6 +8,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Astral { @@ -18,96 +19,96 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { DisplayName.SetDefault("Aries"); - Main.npcFrameCount[npc.type] = 8; + Main.npcFrameCount[NPC.type] = 8; if (!Main.dedServ) - glowmask = ModContent.GetTexture("CalamityMod/NPCs/Astral/AriesGlow"); + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AriesGlow"); } public override void SetDefaults() { - npc.damage = 50; - npc.width = 66; - npc.height = 64; - npc.aiStyle = 41; - npc.defense = 14; - npc.DR_NERD(0.15f); - npc.lifeMax = 300; - npc.knockBackResist = 0.6f; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - banner = npc.type; + NPC.damage = 50; + NPC.width = 66; + NPC.height = 64; + NPC.aiStyle = 41; + NPC.defense = 14; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 300; + NPC.knockBackResist = 0.6f; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + banner = NPC.type; bannerItem = ModContent.ItemType(); if (CalamityWorld.downedAstrageldon) { - npc.damage = 85; - npc.defense = 24; - npc.knockBackResist = 0.5f; - npc.lifeMax = 450; + NPC.damage = 85; + NPC.defense = 24; + NPC.knockBackResist = 0.5f; + NPC.lifeMax = 450; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) { - CalamityGlobalNPC.SpawnDustOnNPC(npc, 66, frameHeight, ModContent.DustType(), new Rectangle(44, 18, 12, 12)); - if (npc.velocity.Y == 0f) + CalamityGlobalNPC.SpawnDustOnNPC(NPC, 66, frameHeight, ModContent.DustType(), new Rectangle(44, 18, 12, 12)); + if (NPC.velocity.Y == 0f) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } - else if ((double)npc.velocity.Y < -1.5) + else if ((double)NPC.velocity.Y < -1.5) { - npc.frame.Y = frameHeight * 7; + NPC.frame.Y = frameHeight * 7; } - else if ((double)npc.velocity.Y < 0) + else if ((double)NPC.velocity.Y < 0) { - npc.frame.Y = frameHeight * 4; + NPC.frame.Y = frameHeight * 4; } - else if ((double)npc.velocity.Y > 1.5) + else if ((double)NPC.velocity.Y > 1.5) { - npc.frame.Y = frameHeight * 6; + NPC.frame.Y = frameHeight * 6; } else { - npc.frame.Y = frameHeight * 5; + NPC.frame.Y = frameHeight * 5; } } public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 15; + NPC.soundDelay = 15; switch (Main.rand.Next(3)) { case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), NPC.Center); break; case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), NPC.Center); break; case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), NPC.Center); break; } } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, ModContent.DustType(), 1f, 4, 24); + CalamityGlobalNPC.DoHitDust(NPC, hitDirection, ModContent.DustType(), 1f, 4, 24); } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { //draw glowmask - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition, npc.frame, Color.White * 0.6f, npc.rotation, new Vector2(33, 31), 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask, NPC.Center - Main.screenPosition, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(33, 31), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) { return 0f; } - else if (spawnInfo.player.InAstral(1)) + else if (spawnInfo.Player.InAstral(1)) { return 0.15f; } @@ -121,9 +122,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.5f, 1, 2); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.5f, 1, 2); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index 862739994c..d16b210ad7 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -9,6 +9,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Astral { @@ -21,46 +22,46 @@ namespace CalamityMod.NPCs.Astral public override void SetDefaults() { - npc.damage = 20; - npc.width = 30; //324 - npc.height = 30; //216 - npc.defense = 10; - npc.DR_NERD(0.15f); - npc.lifeMax = 50; - npc.aiStyle = -1; + NPC.damage = 20; + NPC.width = 30; //324 + NPC.height = 30; //216 + NPC.defense = 10; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 50; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0.95f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.noGravity = true; - npc.noTileCollide = true; - npc.DeathSound = SoundID.NPCDeath14; - banner = npc.type; + NPC.knockBackResist = 0.95f; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.DeathSound = SoundID.NPCDeath14; + banner = NPC.type; bannerItem = ModContent.ItemType(); if (CalamityWorld.downedAstrageldon) { - npc.damage = 30; - npc.defense = 20; - npc.knockBackResist = 0.85f; - npc.lifeMax = 70; + NPC.damage = 30; + NPC.defense = 20; + NPC.knockBackResist = 0.85f; + NPC.lifeMax = 70; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void AI() { // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - npc.damage = 0; + NPC.damage = 0; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } float num = CalamityWorld.death ? 7.5f : 5f; float num2 = CalamityWorld.death ? 0.075f : 0.05f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num4 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num5 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num4 = (float)((int)(num4 / 8f) * 8); num5 = (float)((int)(num5 / 8f) * 8); vector.X = (float)((int)(vector.X / 8f) * 8); @@ -76,8 +77,8 @@ namespace CalamityMod.NPCs.Astral } if (num6 == 0f) { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; + num4 = NPC.velocity.X; + num5 = NPC.velocity.Y; } else { @@ -87,58 +88,58 @@ namespace CalamityMod.NPCs.Astral } if (num7 > 100f) { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) + NPC.ai[0] += 1f; + if (NPC.ai[0] > 0f) { - npc.velocity.Y = npc.velocity.Y + 0.023f; + NPC.velocity.Y = NPC.velocity.Y + 0.023f; } else { - npc.velocity.Y = npc.velocity.Y - 0.023f; + NPC.velocity.Y = NPC.velocity.Y - 0.023f; } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) + if (NPC.ai[0] < -100f || NPC.ai[0] > 100f) { - npc.velocity.X = npc.velocity.X + 0.023f; + NPC.velocity.X = NPC.velocity.X + 0.023f; } else { - npc.velocity.X = npc.velocity.X - 0.023f; + NPC.velocity.X = NPC.velocity.X - 0.023f; } - if (npc.ai[0] > 200f) + if (NPC.ai[0] > 200f) { - npc.ai[0] = -200f; + NPC.ai[0] = -200f; } } - if (Main.player[npc.target].dead) + if (Main.player[NPC.target].dead) { - num4 = (float)npc.direction * num / 2f; + num4 = (float)NPC.direction * num / 2f; num5 = -num / 2f; } - if (npc.velocity.X < num4) + if (NPC.velocity.X < num4) { - npc.velocity.X = npc.velocity.X + num2; + NPC.velocity.X = NPC.velocity.X + num2; } - else if (npc.velocity.X > num4) + else if (NPC.velocity.X > num4) { - npc.velocity.X = npc.velocity.X - num2; + NPC.velocity.X = NPC.velocity.X - num2; } - if (npc.velocity.Y < num5) + if (NPC.velocity.Y < num5) { - npc.velocity.Y = npc.velocity.Y + num2; + NPC.velocity.Y = NPC.velocity.Y + num2; } - else if (npc.velocity.Y > num5) + else if (NPC.velocity.Y > num5) { - npc.velocity.Y = npc.velocity.Y - num2; + NPC.velocity.Y = NPC.velocity.Y - num2; } - npc.localAI[0] += 1f; - if (npc.justHit && !CalamityWorld.death) + NPC.localAI[0] += 1f; + if (NPC.justHit && !CalamityWorld.death) { - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 200f) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= 200f) { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.localAI[0] = 0f; + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { int num8 = Main.expertMode ? 14 : 18; if (CalamityWorld.downedAstrageldon) @@ -148,119 +149,119 @@ namespace CalamityMod.NPCs.Astral Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); } } - int num10 = (int)npc.position.X + npc.width / 2; - int num11 = (int)npc.position.Y + npc.height / 2; + int num10 = (int)NPC.position.X + NPC.width / 2; + int num11 = (int)NPC.position.Y + NPC.height / 2; num10 /= 16; num11 /= 16; if (!WorldGen.SolidTile(num10, num11)) { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.3f, 0f, 0.25f); } if (num4 > 0f) { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4); + NPC.spriteDirection = 1; + NPC.rotation = (float)Math.Atan2((double)num5, (double)num4); } if (num4 < 0f) { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; + NPC.spriteDirection = -1; + NPC.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; } float num12 = 0.7f; - if (npc.collideX) + if (NPC.collideX) { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num12; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + NPC.netUpdate = true; + NPC.velocity.X = NPC.oldVelocity.X * -num12; + if (NPC.direction == -1 && NPC.velocity.X > 0f && NPC.velocity.X < 2f) { - npc.velocity.X = 2f; + NPC.velocity.X = 2f; } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + if (NPC.direction == 1 && NPC.velocity.X < 0f && NPC.velocity.X > -2f) { - npc.velocity.X = -2f; + NPC.velocity.X = -2f; } } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + NPC.netUpdate = true; + NPC.velocity.Y = NPC.oldVelocity.Y * -num12; + if (NPC.velocity.Y > 0f && (double)NPC.velocity.Y < 1.5) { - npc.velocity.Y = 2f; + NPC.velocity.Y = 2f; } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + if (NPC.velocity.Y < 0f && (double)NPC.velocity.Y > -1.5) { - npc.velocity.Y = -2f; + NPC.velocity.Y = -2f; } } if (flag) { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) + if ((NPC.velocity.X > 0f && num4 > 0f) || (NPC.velocity.X < 0f && num4 < 0f)) { - if (Math.Abs(npc.velocity.X) < 12f) + if (Math.Abs(NPC.velocity.X) < 12f) { - npc.velocity.X = npc.velocity.X * 1.05f; + NPC.velocity.X = NPC.velocity.X * 1.05f; } } else { - npc.velocity.X = npc.velocity.X * 0.9f; + NPC.velocity.X = NPC.velocity.X * 0.9f; } } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) { - npc.netUpdate = true; + NPC.netUpdate = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Astral/AstralProbeGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Astral/AstralProbeGlow"); - spriteBatch.Draw(texture2D15, vector43, npc.frame, Color.White * 0.6f, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, Color.White * 0.6f, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 15; + NPC.soundDelay = 15; switch (Main.rand.Next(3)) { case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), NPC.Center); break; case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), NPC.Center); break; case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), NPC.Center); break; } } - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position = npc.Center; - npc.width = npc.height = 30; - npc.Center = npc.position; + NPC.position = NPC.Center; + NPC.width = NPC.height = 30; + NPC.Center = NPC.position; for (int d = 0; d < 5; d++) { - int purple = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int purple = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[purple].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -270,29 +271,29 @@ namespace CalamityMod.NPCs.Astral } for (int d = 0; d < 10; d++) { - int cosmos = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int cosmos = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[cosmos].noGravity = true; Main.dust[cosmos].velocity *= 5f; - cosmos = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + cosmos = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[cosmos].velocity *= 2f; } - CalamityUtils.ExplosionGores(npc.Center, 3); + CalamityUtils.ExplosionGores(NPC.Center, 3); } } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.5f, 1, 2); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.5f, 1, 2); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) { return 0f; } - else if (spawnInfo.player.InAstral()) + else if (spawnInfo.Player.InAstral()) { return 0.1f; } diff --git a/NPCs/Astral/AstralSlime.cs b/NPCs/Astral/AstralSlime.cs index 321a47551b..74ce77f897 100644 --- a/NPCs/Astral/AstralSlime.cs +++ b/NPCs/Astral/AstralSlime.cs @@ -17,39 +17,39 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Slime"); - Main.npcFrameCount[npc.type] = 2; + Main.npcFrameCount[NPC.type] = 2; } public override void SetDefaults() { - npc.damage = 40; - npc.width = 36; - npc.height = 31; - npc.aiStyle = 1; - npc.defense = 8; - npc.lifeMax = 200; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.alpha = 60; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + NPC.damage = 40; + NPC.width = 36; + NPC.height = 31; + NPC.aiStyle = 1; + NPC.defense = 8; + NPC.lifeMax = 200; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.alpha = 60; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; animationType = NPCID.BlueSlime; - banner = npc.type; + banner = NPC.type; bannerItem = ModContent.ItemType(); if (CalamityWorld.downedAstrageldon) { - npc.damage = 65; - npc.defense = 18; - npc.lifeMax = 310; + NPC.damage = 65; + NPC.defense = 18; + NPC.lifeMax = 310; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) { //DO DUST - Dust d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 44, frameHeight, ModContent.DustType(), new Rectangle(4, 4, 36, 24), Vector2.Zero, 0.15f, true); + Dust d = CalamityGlobalNPC.SpawnDustOnNPC(NPC, 44, frameHeight, ModContent.DustType(), new Rectangle(4, 4, 36, 24), Vector2.Zero, 0.15f, true); if (d != null) { d.customData = 0.04f; @@ -58,16 +58,16 @@ namespace CalamityMod.NPCs.Astral public override void HitEffect(int hitDirection, double damage) { - CalamityGlobalNPC.DoHitDust(npc, hitDirection, ModContent.DustType(), 1f, 4, 24); + CalamityGlobalNPC.DoHitDust(NPC, hitDirection, ModContent.DustType(), 1f, 4, 24); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) { return 0f; } - else if (spawnInfo.player.InAstral(1)) + else if (spawnInfo.Player.InAstral(1)) { return 0.21f; } @@ -81,11 +81,11 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 1 : 2, 1, 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), Main.expertMode ? 1 : 2, 1, 3); int oreMin = Main.expertMode ? 11 : 8; int oreMax = Main.expertMode ? 16 : 12; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedStarGod, oreMin, oreMax); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 0.05f, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedStarGod, oreMin, oreMax); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 0.05f, 1, 1); } } } diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index 6d70780c8d..242ad887bd 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -10,6 +10,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Astral { @@ -21,54 +22,54 @@ namespace CalamityMod.NPCs.Astral { DisplayName.SetDefault("Astralachnea"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; if (!Main.dedServ) - glowmask = ModContent.GetTexture("CalamityMod/NPCs/Astral/AstralachneaGroundGlow"); + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaGroundGlow"); base.SetStaticDefaults(); } public override void SetDefaults() { - npc.width = 70; - npc.height = 34; - npc.aiStyle = 3; - npc.damage = 55; - npc.defense = 20; - npc.DR_NERD(0.15f); - npc.lifeMax = 500; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - npc.knockBackResist = 0.38f; - npc.value = Item.buyPrice(0, 0, 20, 0); - npc.timeLeft = NPC.activeTime * 2; + NPC.width = 70; + NPC.height = 34; + NPC.aiStyle = 3; + NPC.damage = 55; + NPC.defense = 20; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 500; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + NPC.knockBackResist = 0.38f; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.timeLeft = NPC.activeTime * 2; animationType = NPCID.WallCreeper; - banner = npc.type; + banner = NPC.type; bannerItem = ModContent.ItemType(); if (CalamityWorld.downedAstrageldon) { - npc.damage = 90; - npc.defense = 30; - npc.knockBackResist = 0.28f; - npc.lifeMax = 750; + NPC.damage = 90; + NPC.defense = 30; + NPC.knockBackResist = 0.28f; + NPC.lifeMax = 750; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void AI() { - npc.TargetClosest(); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.velocity.Y == 0f) + NPC.TargetClosest(); + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.velocity.Y == 0f) { - int x = (int)npc.Center.X / 16; - int y = (int)npc.Center.Y / 16; + int x = (int)NPC.Center.X / 16; + int y = (int)NPC.Center.Y / 16; bool transform = false; for (int i = x - 1; i <= x + 1; i++) { for (int j = y - 1; j <= y + 1; j++) { - if (Main.tile[i, j] != null && Main.tile[i, j].wall > 0) + if (Main.tile[i, j] != null && Main.tile[i, j].WallType > 0) { transform = true; } @@ -76,7 +77,7 @@ namespace CalamityMod.NPCs.Astral } if (transform) { - npc.Transform(ModContent.NPCType()); + NPC.Transform(ModContent.NPCType()); } } } @@ -84,7 +85,7 @@ namespace CalamityMod.NPCs.Astral public override void FindFrame(int frameHeight) { //DO DUST - int frame = npc.frame.Y / frameHeight; + int frame = NPC.frame.Y / frameHeight; Rectangle rect = new Rectangle(62, 4, 14, 6); switch (frame) { @@ -101,7 +102,7 @@ namespace CalamityMod.NPCs.Astral rect = new Rectangle(58, 6, 20, 8); break; } - Dust d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 80, frameHeight, ModContent.DustType(), rect, Vector2.Zero, 0.45f, true); + Dust d = CalamityGlobalNPC.SpawnDustOnNPC(NPC, 80, frameHeight, ModContent.DustType(), rect, Vector2.Zero, 0.45f, true); if (d != null) { d.customData = 0.04f; @@ -110,31 +111,31 @@ namespace CalamityMod.NPCs.Astral public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 15; + NPC.soundDelay = 15; switch (Main.rand.Next(3)) { case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), NPC.Center); break; case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), NPC.Center); break; case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), NPC.Center); break; } } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : ModContent.DustType(), 1f, 4, 22); + CalamityGlobalNPC.DoHitDust(NPC, hitDirection, (Main.rand.Next(0, Math.Max(0, NPC.life)) == 0) ? 5 : ModContent.DustType(), 1f, 4, 22); //if dead do gores - if (npc.life <= 0) + if (NPC.life <= 0) { for (int i = 0; i < 6; i++) { - Gore.NewGore(npc.Center, npc.velocity * 0.3f, mod.GetGoreSlot("Gores/Astralachnea/AstralachneaGore" + i)); + Gore.NewGore(NPC.Center, NPC.velocity * 0.3f, Mod.GetGoreSlot("Gores/Astralachnea/AstralachneaGore" + i)); } } } @@ -142,16 +143,16 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { Vector2 origin = new Vector2(40f, 21f); - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition, npc.frame, Color.White * 0.6f, npc.rotation, origin, 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask, NPC.Center - Main.screenPosition, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) { return 0f; } - else if (spawnInfo.player.InAstral(2)) + else if (spawnInfo.Player.InAstral(2)) { return 0.17f; } @@ -165,9 +166,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index d36b001a47..c00b66f536 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -10,6 +10,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Astral { @@ -21,50 +22,50 @@ namespace CalamityMod.NPCs.Astral { DisplayName.SetDefault("Astralachnea"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; if (!Main.dedServ) - glowmask = ModContent.GetTexture("CalamityMod/NPCs/Astral/AstralachneaWallGlow"); + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AstralachneaWallGlow"); base.SetStaticDefaults(); } public override void SetDefaults() { - npc.width = 60; - npc.height = 60; - npc.aiStyle = -1; - npc.damage = 55; - npc.defense = 20; - npc.DR_NERD(0.15f); - npc.lifeMax = 500; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.value = Item.buyPrice(0, 0, 20, 0); - npc.timeLeft = NPC.activeTime * 2; + NPC.width = 60; + NPC.height = 60; + NPC.aiStyle = -1; + NPC.damage = 55; + NPC.defense = 20; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 500; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.timeLeft = NPC.activeTime * 2; animationType = NPCID.BlackRecluseWall; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); if (CalamityWorld.downedAstrageldon) { - npc.damage = 90; - npc.defense = 30; - npc.lifeMax = 750; + NPC.damage = 90; + NPC.defense = 30; + NPC.lifeMax = 750; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void AI() { - CalamityGlobalNPC.DoSpiderWallAI(npc, ModContent.NPCType(), (CalamityWorld.death ? 3.6f : 2.4f), (CalamityWorld.death ? 0.15f : 0.1f)); + CalamityGlobalNPC.DoSpiderWallAI(NPC, ModContent.NPCType(), (CalamityWorld.death ? 3.6f : 2.4f), (CalamityWorld.death ? 0.15f : 0.1f)); } public override void FindFrame(int frameHeight) { //DO DUST - int frame = npc.frame.Y / frameHeight; + int frame = NPC.frame.Y / frameHeight; Rectangle rect = new Rectangle(12, 24, 18, 10); Rectangle rect2 = new Rectangle(12, 44, 18, 10); switch (frame) @@ -82,8 +83,8 @@ namespace CalamityMod.NPCs.Astral rect2 = new Rectangle(16, 44, 16, 10); break; } - Dust d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 80, frameHeight, ModContent.DustType(), rect, Vector2.Zero, 0.225f, true); - Dust d2 = CalamityGlobalNPC.SpawnDustOnNPC(npc, 80, frameHeight, ModContent.DustType(), rect2, Vector2.Zero, 0.225f, true); + Dust d = CalamityGlobalNPC.SpawnDustOnNPC(NPC, 80, frameHeight, ModContent.DustType(), rect, Vector2.Zero, 0.225f, true); + Dust d2 = CalamityGlobalNPC.SpawnDustOnNPC(NPC, 80, frameHeight, ModContent.DustType(), rect2, Vector2.Zero, 0.225f, true); if (d != null) { d.customData = 0.04f; @@ -96,31 +97,31 @@ namespace CalamityMod.NPCs.Astral public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 15; + NPC.soundDelay = 15; switch (Main.rand.Next(3)) { case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), NPC.Center); break; case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), NPC.Center); break; case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), NPC.Center); break; } } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : ModContent.DustType(), 1f, 4, 22); + CalamityGlobalNPC.DoHitDust(NPC, hitDirection, (Main.rand.Next(0, Math.Max(0, NPC.life)) == 0) ? 5 : ModContent.DustType(), 1f, 4, 22); //if dead do gores - if (npc.life <= 0) + if (NPC.life <= 0) { for (int i = 0; i < 6; i++) { - Gore.NewGore(npc.Center, npc.velocity * 0.3f, mod.GetGoreSlot("Gores/Astralachnea/AstralachneaGore" + i)); + Gore.NewGore(NPC.Center, NPC.velocity * 0.3f, Mod.GetGoreSlot("Gores/Astralachnea/AstralachneaGore" + i)); } } } @@ -128,7 +129,7 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { Vector2 origin = new Vector2(40f, 40f); - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition - new Vector2(0, 8f), npc.frame, Color.White * 0.6f, npc.rotation, origin, 1f, SpriteEffects.None, 0); + spriteBatch.Draw(glowmask, NPC.Center - Main.screenPosition - new Vector2(0, 8f), NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, SpriteEffects.None, 0); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -138,9 +139,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 107a40b2b4..0a06bdf76a 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -11,6 +11,7 @@ using System.IO; using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Astral { @@ -47,42 +48,42 @@ namespace CalamityMod.NPCs.Astral { get { - return npc.ai[0]; + return NPC.ai[0]; } set { - npc.ai[0] = value; + NPC.ai[0] = value; } } private float target_counter { get { - return npc.ai[1]; + return NPC.ai[1]; } set { - npc.ai[1] = value; + NPC.ai[1] = value; } } private float grounded_counter { get { - return npc.ai[2]; + return NPC.ai[2]; } set { - npc.ai[2] = value; + NPC.ai[2] = value; } } private Player Target { get { - if (npc.HasValidTarget) + if (NPC.HasValidTarget) { - return Main.player[npc.target]; + return Main.player[NPC.target]; } return null; } @@ -91,51 +92,51 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { DisplayName.SetDefault("Atlas"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; //not really important seeing as custom drawing, but for heights sake, 6 //also it's visuals are messed up on npc spawners etc. because the sheet is 3 wide. //not much we can do. looks fine in-game so /shrug if (!Main.dedServ) - glowmask = ModContent.GetTexture("CalamityMod/NPCs/Astral/AtlasGlow"); + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/AtlasGlow"); } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.lavaImmune = true; - npc.width = 78; - npc.height = 88; - npc.damage = 70; - npc.defense = 40; - npc.DR_NERD(0.15f); - npc.lifeMax = 1200; - npc.knockBackResist = 0.08f; - npc.value = Item.buyPrice(0, 1, 0, 0); - npc.aiStyle = -1; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AtlasDeath"); - banner = npc.type; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.lavaImmune = true; + NPC.width = 78; + NPC.height = 88; + NPC.damage = 70; + NPC.defense = 40; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 1200; + NPC.knockBackResist = 0.08f; + NPC.value = Item.buyPrice(0, 1, 0, 0); + NPC.aiStyle = -1; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AtlasDeath"); + banner = NPC.type; bannerItem = ModContent.ItemType(); if (CalamityWorld.downedAstrageldon) { - npc.damage = 100; - npc.defense = 50; - npc.knockBackResist = 0.04f; - npc.lifeMax = 1600; + NPC.damage = 100; + NPC.defense = 50; + NPC.knockBackResist = 0.04f; + NPC.lifeMax = 1600; } if (NPC.downedAncientCultist) { - npc.damage = 150; - npc.defense = 75; - npc.knockBackResist = 0f; - npc.lifeMax = 2400; + NPC.damage = 150; + NPC.defense = 75; + NPC.knockBackResist = 0f; + NPC.lifeMax = 2400; } if (CalamityWorld.death) { target_walkAcceleration = 0.18f; target_walkMaxSpeed = 3.2f; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) @@ -163,28 +164,28 @@ namespace CalamityMod.NPCs.Astral public override void AI() { //PICK A TARGET - if (!npc.HasValidTarget || idling) + if (!NPC.HasValidTarget || idling) { //target and reset - npc.TargetClosest(false); + NPC.TargetClosest(false); idling = false; - if (!npc.HasValidTarget) //if we don't have valid target + if (!NPC.HasValidTarget) //if we don't have valid target { idling = true; } - else if (!Collision.CanHit(npc.position + Vector2.UnitY * 8, 15, 15, Target.position, Target.width, Target.height)) //else if we do but can't see them + else if (!Collision.CanHit(NPC.position + Vector2.UnitY * 8, 15, 15, Target.position, Target.width, Target.height)) //else if we do but can't see them { idling = true; } else { //PLAY SOUND (SAD) *but this time it has a target. more like an indicator. he sad because he has to kill you now :c - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AtlasSad0"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AtlasSad0"), NPC.Center); } } - if (npc.velocity.Y == 0) + if (NPC.velocity.Y == 0) { grounded_counter++; } @@ -208,32 +209,32 @@ namespace CalamityMod.NPCs.Astral DoTargetAI(); } - npc.stepSpeed = 0.75f; + NPC.stepSpeed = 0.75f; - if (npc.velocity.Y >= 0f) + if (NPC.velocity.Y >= 0f) { - Collision.StepUp(ref npc.position, ref npc.velocity, npc.width, npc.height, ref npc.stepSpeed, ref npc.gfxOffY, 1, false, 1); + Collision.StepUp(ref NPC.position, ref NPC.velocity, NPC.width, NPC.height, ref NPC.stepSpeed, ref NPC.gfxOffY, 1, false, 1); } } private void DoSwingUpdate() { - npc.velocity.X *= 0.84f; + NPC.velocity.X *= 0.84f; swing_counter++; if (swing_counter == swing_playSoundOnFrame) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AtlasSwing"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AtlasSwing"), NPC.Center); } if (swing_counter >= swing_minCounterHit && swing_counter <= swing_maxCounterHit) { - int centerX = (int)npc.Center.X; - int centerY = (int)npc.Center.Y; + int centerX = (int)NPC.Center.X; + int centerY = (int)NPC.Center.Y; int width = (int)swing_minXDistance; int height = 142; Rectangle hitbox = new Rectangle( - centerX + (npc.direction == -1 ? -width : 0), + centerX + (NPC.direction == -1 ? -width : 0), centerY - height / 2, width, height); @@ -242,7 +243,7 @@ namespace CalamityMod.NPCs.Astral if (Main.player[i].active && !Main.player[i].dead && Main.player[i].getRect().Intersects(hitbox)) { Vector2 before = Main.player[i].velocity; - Main.player[i].Hurt(PlayerDeathReason.ByNPC(npc.whoAmI), npc.damage, npc.direction); + Main.player[i].Hurt(PlayerDeathReason.ByNPC(NPC.whoAmI), NPC.damage, NPC.direction); Vector2 after = Main.player[i].velocity; Vector2 difference = after - before; @@ -276,7 +277,7 @@ namespace CalamityMod.NPCs.Astral { //idling, so I should mostly just walk around and do nothing useful with my life //oh hey, it's just me haha - if (HoleBelow() || (npc.collideX && npc.oldPosition.X == npc.position.X)) + if (HoleBelow() || (NPC.collideX && NPC.oldPosition.X == NPC.position.X)) { idle_impulseWalk = false; idle_blocked = true; @@ -287,13 +288,13 @@ namespace CalamityMod.NPCs.Astral { if (idle_counter == 4) { - npc.frame.Y = startWalkFrameY; //reset frame to start walk animation. + NPC.frame.Y = startWalkFrameY; //reset frame to start walk animation. } - npc.velocity.X += idle_walkAcceleration * (idle_walkLeft ? -1 : 1); - if (Math.Abs(npc.velocity.X) > idle_walkMaxSpeed) + NPC.velocity.X += idle_walkAcceleration * (idle_walkLeft ? -1 : 1); + if (Math.Abs(NPC.velocity.X) > idle_walkMaxSpeed) { - npc.velocity.X = idle_walkLeft ? -idle_walkMaxSpeed : idle_walkMaxSpeed; + NPC.velocity.X = idle_walkLeft ? -idle_walkMaxSpeed : idle_walkMaxSpeed; } idle_impulseWalk = idle_impulseWalk && idle_counter > 20 && Main.rand.Next(150) != 0; if (!idle_impulseWalk) @@ -301,7 +302,7 @@ namespace CalamityMod.NPCs.Astral idle_counter = 0; } - npc.direction = idle_walkLeft ? -1 : 1; + NPC.direction = idle_walkLeft ? -1 : 1; } else { @@ -318,17 +319,17 @@ namespace CalamityMod.NPCs.Astral { idle_walkLeft = Main.rand.NextBool(); //pick direction } - npc.frameCounter = 0; // reset framecounter to start walk. + NPC.frameCounter = 0; // reset framecounter to start walk. //PLAY SOUND (IDLE) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AtlasIdle" + Main.rand.Next(2)), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AtlasIdle" + Main.rand.Next(2)), NPC.Center); } else { - npc.velocity.X *= 0.9f; - if (Math.Abs(npc.velocity.X) < 0.1f) + NPC.velocity.X *= 0.9f; + if (Math.Abs(NPC.velocity.X) < 0.1f) { - npc.velocity.X = 0f; + NPC.velocity.X = 0f; } } } @@ -337,27 +338,27 @@ namespace CalamityMod.NPCs.Astral private void DoTargetAI() { //got a target, so I'm gonna chase them down and smack em. - bool targetToLeft = Target.Center.X < npc.Center.X; + bool targetToLeft = Target.Center.X < NPC.Center.X; int mult = targetToLeft ? -1 : 1; - npc.velocity.X += target_walkAcceleration * mult; - if (Math.Abs(npc.velocity.X) > target_walkMaxSpeed) + NPC.velocity.X += target_walkAcceleration * mult; + if (Math.Abs(NPC.velocity.X) > target_walkMaxSpeed) { - npc.velocity.X = target_walkMaxSpeed * mult; + NPC.velocity.X = target_walkMaxSpeed * mult; } //based on velocity, as he a big hunk and he can't walk backwards whilst facing target - npc.direction = npc.velocity.X < 0f ? -1 : 1; + NPC.direction = NPC.velocity.X < 0f ? -1 : 1; //if have been on ground for at least 1.5 seonds, and are hitting wall or there is a hole - if (grounded_counter > 90 && (HoleBelow() || (npc.collideX && npc.position.X == npc.oldPosition.X))) + if (grounded_counter > 90 && (HoleBelow() || (NPC.collideX && NPC.position.X == NPC.oldPosition.X))) { //jump - npc.velocity.Y = -6f; + NPC.velocity.Y = -6f; target_counter++; } - bool canHitTarget = Collision.CanHit(npc.position + Vector2.UnitY * 8, 15, 15, Target.position, Target.width, Target.height); + bool canHitTarget = Collision.CanHit(NPC.position + Vector2.UnitY * 8, 15, 15, Target.position, Target.width, Target.height); if (target_counter > 0 && !canHitTarget) { @@ -374,12 +375,12 @@ namespace CalamityMod.NPCs.Astral target_counter = 0; //PLAY SOUND (SAD) he sad cos he lost his target :C - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AtlasSad1"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AtlasSad1"), NPC.Center); } - else if (target_counter == 0 && npc.velocity.Y == 0) + else if (target_counter == 0 && NPC.velocity.Y == 0) { //check if we can swing at the target - Vector2 distance = npc.Center - Target.Center; + Vector2 distance = NPC.Center - Target.Center; if (swing_untilNext < 0 && canHitTarget && Math.Abs(distance.X) < swing_minXDistance && Math.Abs(distance.Y) < swing_minYDistance) { StartSwing(); @@ -391,12 +392,12 @@ namespace CalamityMod.NPCs.Astral { //width of npc in tiles int tileWidth = 5; - int tileX = (int)(npc.Center.X / 16f) - tileWidth; - if (npc.velocity.X > 0) //if moving right + int tileX = (int)(NPC.Center.X / 16f) - tileWidth; + if (NPC.velocity.X > 0) //if moving right { tileX += tileWidth; } - int tileY = (int)((npc.position.Y + npc.height) / 16f); + int tileY = (int)((NPC.position.Y + NPC.height) / 16f); for (int y = tileY; y < tileY + 2; y++) { for (int x = tileX; x < tileX + tileWidth; x++) @@ -420,38 +421,38 @@ namespace CalamityMod.NPCs.Astral public override void HitEffect(int hitDirection, double damage) { //play sound - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 15; + NPC.soundDelay = 15; switch (Main.rand.Next(3)) { case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt0"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt0"), NPC.Center); break; case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt1"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt1"), NPC.Center); break; case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt2"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt2"), NPC.Center); break; } } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : ModContent.DustType(), 1f, 3, 30); + CalamityGlobalNPC.DoHitDust(NPC, hitDirection, (Main.rand.Next(0, Math.Max(0, NPC.life)) == 0) ? 5 : ModContent.DustType(), 1f, 3, 30); //if dead do gores - if (npc.life <= 0) + if (NPC.life <= 0) { //head - Gore.NewGore(npc.Top, npc.velocity * 0.5f, mod.GetGoreSlot("Gores/Atlas/AtlasGore4")); + Gore.NewGore(NPC.Top, NPC.velocity * 0.5f, Mod.GetGoreSlot("Gores/Atlas/AtlasGore4")); //hand - Gore.NewGore(npc.direction == 1 ? npc.Right : npc.Left, npc.velocity * 0.5f, mod.GetGoreSlot("Gores/Atlas/AtlasGore2")); + Gore.NewGore(NPC.direction == 1 ? NPC.Right : NPC.Left, NPC.velocity * 0.5f, Mod.GetGoreSlot("Gores/Atlas/AtlasGore2")); //rest - Gore.NewGore(npc.Center, npc.velocity * 0.5f, mod.GetGoreSlot("Gores/Atlas/AtlasGore0")); - Gore.NewGore(npc.Center, npc.velocity * 0.5f, mod.GetGoreSlot("Gores/Atlas/AtlasGore1")); - Gore.NewGore(npc.Center, npc.velocity * 0.5f, mod.GetGoreSlot("Gores/Atlas/AtlasGore3")); - Gore.NewGore(npc.Center, npc.velocity * 0.5f, mod.GetGoreSlot("Gores/Atlas/AtlasGore5")); - Gore.NewGore(npc.Center, npc.velocity * 0.5f, mod.GetGoreSlot("Gores/Atlas/AtlasGore6")); + Gore.NewGore(NPC.Center, NPC.velocity * 0.5f, Mod.GetGoreSlot("Gores/Atlas/AtlasGore0")); + Gore.NewGore(NPC.Center, NPC.velocity * 0.5f, Mod.GetGoreSlot("Gores/Atlas/AtlasGore1")); + Gore.NewGore(NPC.Center, NPC.velocity * 0.5f, Mod.GetGoreSlot("Gores/Atlas/AtlasGore3")); + Gore.NewGore(NPC.Center, NPC.velocity * 0.5f, Mod.GetGoreSlot("Gores/Atlas/AtlasGore5")); + Gore.NewGore(NPC.Center, NPC.velocity * 0.5f, Mod.GetGoreSlot("Gores/Atlas/AtlasGore6")); } } @@ -461,66 +462,66 @@ namespace CalamityMod.NPCs.Astral int height = 142; //ensure width and height are set. - npc.frame.Width = width; - npc.frame.Height = height; + NPC.frame.Width = width; + NPC.frame.Height = height; if (idling) { - npc.frameCounter++; + NPC.frameCounter++; if (!idle_impulseWalk) { - npc.frame.X = 0; - if (npc.frameCounter > 9) + NPC.frame.X = 0; + if (NPC.frameCounter > 9) { - npc.frameCounter = 0; - npc.frame.Y += height; - if (npc.frame.Y >= sheetHeight) + NPC.frameCounter = 0; + NPC.frame.Y += height; + if (NPC.frame.Y >= sheetHeight) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } else { - npc.frame.X = width; - if (npc.frameCounter > 8) + NPC.frame.X = width; + if (NPC.frameCounter > 8) { - npc.frameCounter = 0; - npc.frame.Y += height; - if (npc.frame.Y >= sheetHeight) + NPC.frameCounter = 0; + NPC.frame.Y += height; + if (NPC.frame.Y >= sheetHeight) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } } else if (swinging) { - npc.frameCounter = 0; - npc.frame.X = width * 2; + NPC.frameCounter = 0; + NPC.frame.X = width * 2; if (swing_counter < 8) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } else if (swing_counter < 16) { - npc.frame.Y = height; + NPC.frame.Y = height; } else if (swing_counter < 23) { - npc.frame.Y = height * 2; + NPC.frame.Y = height * 2; } else if (swing_counter < 30) { - npc.frame.Y = height * 3; + NPC.frame.Y = height * 3; } else if (swing_counter < 38) { - npc.frame.Y = height * 4; + NPC.frame.Y = height * 4; } else if (swing_counter < 46) { - npc.frame.Y = height * 5; + NPC.frame.Y = height * 5; } else { @@ -532,40 +533,40 @@ namespace CalamityMod.NPCs.Astral else { //if walking - npc.frameCounter++; - npc.frame.X = width; - if (npc.frameCounter > 7) + NPC.frameCounter++; + NPC.frame.X = width; + if (NPC.frameCounter > 7) { - npc.frameCounter = 0; - npc.frame.Y += height; - if (npc.frame.Y >= sheetHeight) + NPC.frameCounter = 0; + NPC.frame.Y += height; + if (NPC.frame.Y >= sheetHeight) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } //if we're in the air - if (npc.velocity.Y != 0) + if (NPC.velocity.Y != 0) { - npc.frame.X = width; - npc.frame.Y = height * 4; //5th frame down + NPC.frame.X = width; + NPC.frame.Y = height * 4; //5th frame down } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Vector2 position = npc.position - new Vector2(30, 48) - Main.screenPosition; - SpriteEffects effect = npc.direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 position = NPC.position - new Vector2(30, 48) - Main.screenPosition; + SpriteEffects effect = NPC.direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; //draw actual sprite - spriteBatch.Draw(Main.npcTexture[npc.type], position, npc.frame, + spriteBatch.Draw(Main.npcTexture[NPC.type], position, NPC.frame, drawColor, 0f, default, 1f, //color, rotation, origin, scale effect, 0f); //effect, drawlayer //draw glowmask spriteBatch.Draw( - glowmask, position, npc.frame, + glowmask, position, NPC.frame, Color.White * 0.65f, 0f, default, 1f, //color, rotation, origin, scale effect, 0f); //effect, drawlayer @@ -576,7 +577,7 @@ namespace CalamityMod.NPCs.Astral { int x = 0; int y = 0; - switch (npc.frame.Y) + switch (NPC.frame.Y) { case 0: x = 45; @@ -603,7 +604,7 @@ namespace CalamityMod.NPCs.Astral y = 81; break; } - if (npc.direction == 1) + if (NPC.direction == 1) { x = 142 - x; } @@ -612,15 +613,15 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) { return 0f; } - else if (spawnInfo.player.InAstral(1) && NPC.downedAncientCultist && !CalamityWorld.downedStarGod) + else if (spawnInfo.Player.InAstral(1) && NPC.downedAncientCultist && !CalamityWorld.downedStarGod) { return 0.27f; } - else if (spawnInfo.player.InAstral(1)) + else if (spawnInfo.Player.InAstral(1)) { return 0.09f; } @@ -636,10 +637,10 @@ namespace CalamityMod.NPCs.Astral { int minStardust = Main.expertMode ? 7 : 6; int maxStardust = Main.expertMode ? 9 : 8; - DropHelper.DropItem(npc, ModContent.ItemType(), minStardust, maxStardust); + DropHelper.DropItem(NPC, ModContent.ItemType(), minStardust, maxStardust); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); - DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItem(NPC, ModContent.ItemType()); } } } diff --git a/NPCs/Astral/BigSightseer.cs b/NPCs/Astral/BigSightseer.cs index 598c825e46..1792680e50 100644 --- a/NPCs/Astral/BigSightseer.cs +++ b/NPCs/Astral/BigSightseer.cs @@ -9,6 +9,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Astral { @@ -19,52 +20,52 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { DisplayName.SetDefault("Big Sightseer"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; if (!Main.dedServ) - glowmask = ModContent.GetTexture("CalamityMod/NPCs/Astral/BigSightseerGlow"); + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/BigSightseerGlow"); } public override void SetDefaults() { - npc.width = 64; - npc.height = 56; - npc.damage = 50; - npc.defense = 20; - npc.DR_NERD(0.15f); - npc.lifeMax = 430; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - npc.noGravity = true; - npc.knockBackResist = 0.8f; - npc.value = Item.buyPrice(0, 0, 20, 0); - npc.aiStyle = -1; - banner = npc.type; + NPC.width = 64; + NPC.height = 56; + NPC.damage = 50; + NPC.defense = 20; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 430; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + NPC.noGravity = true; + NPC.knockBackResist = 0.8f; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.aiStyle = -1; + banner = NPC.type; bannerItem = ModContent.ItemType(); if (CalamityWorld.downedAstrageldon) { - npc.damage = 85; - npc.defense = 30; - npc.knockBackResist = 0.7f; - npc.lifeMax = 640; + NPC.damage = 85; + NPC.defense = 30; + NPC.knockBackResist = 0.7f; + NPC.lifeMax = 640; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.05f + npc.velocity.Length() * 0.667f; - if (npc.frameCounter >= 8) + NPC.frameCounter += 0.05f + NPC.velocity.Length() * 0.667f; + if (NPC.frameCounter >= 8) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y > npc.height * 3) + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y > NPC.height * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } //DO DUST - Dust d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 118, frameHeight, ModContent.DustType(), new Rectangle(70, 18, 48, 18), Vector2.Zero, 0.45f, true); + Dust d = CalamityGlobalNPC.SpawnDustOnNPC(NPC, 118, frameHeight, ModContent.DustType(), new Rectangle(70, 18, 48, 18), Vector2.Zero, 0.45f, true); if (d != null) { d.customData = 0.04f; @@ -73,37 +74,37 @@ namespace CalamityMod.NPCs.Astral public override void AI() { - CalamityGlobalNPC.DoFlyingAI(npc, 4f, 0.025f, 300f); + CalamityGlobalNPC.DoFlyingAI(NPC, 4f, 0.025f, 300f); - npc.ai[1]++; - Player target = Main.player[npc.target]; + NPC.ai[1]++; + Player target = Main.player[NPC.target]; - if (npc.justHit || target.dead) + if (NPC.justHit || target.dead) { //reset if hit - npc.ai[1] = 0; + NPC.ai[1] = 0; } //if can see target and waited long enough - if (Collision.CanHit(target.position, target.width, target.height, npc.position, npc.width, npc.height)) + if (Collision.CanHit(target.position, target.width, target.height, NPC.position, NPC.width, NPC.height)) { - Vector2 vector = target.Center - npc.Center; + Vector2 vector = target.Center - NPC.Center; vector.Normalize(); - Vector2 spawnPoint = npc.Center + vector * 42f; + Vector2 spawnPoint = NPC.Center + vector * 42f; - if (npc.ai[1] >= (CalamityWorld.death ? 120f : 160f)) + if (NPC.ai[1] >= (CalamityWorld.death ? 120f : 160f)) { - npc.ai[1] = 0f; + NPC.ai[1] = 0f; int n = NPC.NewNPC((int)spawnPoint.X, (int)spawnPoint.Y, ModContent.NPCType()); Main.npc[n].Center = spawnPoint; Main.npc[n].velocity = vector * (CalamityWorld.death ? 12f : 10f); } - else if (npc.ai[1] >= 140f) //oozin dust at the "mouth" + else if (NPC.ai[1] >= 140f) //oozin dust at the "mouth" { int dustType = Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(); int d = Dust.NewDust(spawnPoint - new Vector2(5), 10, 10, dustType); - Main.dust[d].velocity = npc.velocity * 0.3f; + Main.dust[d].velocity = NPC.velocity * 0.3f; Main.dust[d].customData = true; } } @@ -111,50 +112,50 @@ namespace CalamityMod.NPCs.Astral public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 15; + NPC.soundDelay = 15; switch (Main.rand.Next(3)) { case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), NPC.Center); break; case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), NPC.Center); break; case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), NPC.Center); break; } } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : ModContent.DustType(), 1f, 4, 22); + CalamityGlobalNPC.DoHitDust(NPC, hitDirection, (Main.rand.Next(0, Math.Max(0, NPC.life)) == 0) ? 5 : ModContent.DustType(), 1f, 4, 22); //if dead do gores - if (npc.life <= 0) + if (NPC.life <= 0) { for (int i = 0; i < 5; i++) { float rand = Main.rand.NextFloat(-0.18f, 0.18f); - Gore.NewGore(npc.position + new Vector2(Main.rand.NextFloat(0f, npc.width), Main.rand.NextFloat(0f, npc.height)), npc.velocity * rand, mod.GetGoreSlot("Gores/BigSightseer/BigSightseerGore" + i)); + Gore.NewGore(NPC.position + new Vector2(Main.rand.NextFloat(0f, NPC.width), Main.rand.NextFloat(0f, NPC.height)), NPC.velocity * rand, Mod.GetGoreSlot("Gores/BigSightseer/BigSightseerGore" + i)); } } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition + new Vector2(0, 4f), npc.frame, Color.White * 0.75f, npc.rotation, new Vector2(59f, 28f), npc.scale, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(glowmask, NPC.Center - Main.screenPosition + new Vector2(0, 4f), NPC.frame, Color.White * 0.75f, NPC.rotation, new Vector2(59f, 28f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) { return 0f; } - else if (spawnInfo.player.InAstral(1)) + else if (spawnInfo.Player.InAstral(1)) { - return spawnInfo.player.ZoneDesert ? 0.14f : 0.17f; + return spawnInfo.Player.ZoneDesert ? 0.14f : 0.17f; } return 0f; } @@ -166,8 +167,8 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); } } @@ -176,44 +177,44 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { DisplayName.SetDefault("Seeker Spit"); - Main.npcFrameCount[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 1; } public override void SetDefaults() { - npc.width = 16; - npc.height = 16; - npc.damage = 45; - npc.defense = 0; - npc.lifeMax = 1; - npc.HitSound = null; - npc.DeathSound = SoundID.NPCDeath9; - npc.noGravity = true; - npc.knockBackResist = 0f; - npc.noTileCollide = true; - npc.alpha = 80; - npc.aiStyle = -1; + NPC.width = 16; + NPC.height = 16; + NPC.damage = 45; + NPC.defense = 0; + NPC.lifeMax = 1; + NPC.HitSound = null; + NPC.DeathSound = SoundID.NPCDeath9; + NPC.noGravity = true; + NPC.knockBackResist = 0f; + NPC.noTileCollide = true; + NPC.alpha = 80; + NPC.aiStyle = -1; if (CalamityWorld.downedAstrageldon) { - npc.damage = 75; + NPC.damage = 75; } } public override void AI() { //DUST - npc.ai[0] += 0.18f; - float angle = npc.velocity.ToRotation() + MathHelper.PiOver2; - float pulse = (float)Math.Sin(npc.ai[0]); + NPC.ai[0] += 0.18f; + float angle = NPC.velocity.ToRotation() + MathHelper.PiOver2; + float pulse = (float)Math.Sin(NPC.ai[0]); float radius = 5.8f; Vector2 offset = angle.ToRotationVector2() * pulse * radius; - Dust pink = Dust.NewDustPerfect(npc.Center + offset, ModContent.DustType(), Vector2.Zero); - Dust blue = Dust.NewDustPerfect(npc.Center - offset, ModContent.DustType(), Vector2.Zero); + Dust pink = Dust.NewDustPerfect(NPC.Center + offset, ModContent.DustType(), Vector2.Zero); + Dust blue = Dust.NewDustPerfect(NPC.Center - offset, ModContent.DustType(), Vector2.Zero); //kill on tile collide - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.StrikeNPCNoInteraction(9999, 0, 0); + NPC.StrikeNPCNoInteraction(9999, 0, 0); } } @@ -221,7 +222,7 @@ namespace CalamityMod.NPCs.Astral { if (damage > 0) { - npc.StrikeNPCNoInteraction(9999, 0, 0); + NPC.StrikeNPCNoInteraction(9999, 0, 0); } } @@ -229,7 +230,7 @@ namespace CalamityMod.NPCs.Astral { if (damage > 0) { - npc.StrikeNPCNoInteraction(9999, 0, 0); + NPC.StrikeNPCNoInteraction(9999, 0, 0); } } @@ -259,7 +260,7 @@ namespace CalamityMod.NPCs.Astral { Vector2 vel = (angle + Main.rand.NextFloat(-0.04f, 0.04f)).ToRotationVector2(); int dustType = Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(); - Dust d = Dust.NewDustPerfect(npc.Center, dustType, vel * Main.rand.NextFloat(1.8f, 2.2f)); + Dust d = Dust.NewDustPerfect(NPC.Center, dustType, vel * Main.rand.NextFloat(1.8f, 2.2f)); d.customData = npc; angle += rotPerIter; diff --git a/NPCs/Astral/EnchantedNightcrawler.cs b/NPCs/Astral/EnchantedNightcrawler.cs index 2626890ffc..ad6847ab54 100644 --- a/NPCs/Astral/EnchantedNightcrawler.cs +++ b/NPCs/Astral/EnchantedNightcrawler.cs @@ -9,20 +9,20 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { DisplayName.SetDefault("Enchanted Nightcrawler"); - Main.npcFrameCount[npc.type] = 2; - Main.npcCatchable[npc.type] = true; + Main.npcFrameCount[NPC.type] = 2; + Main.npcCatchable[NPC.type] = true; } public override void SetDefaults() { - npc.CloneDefaults(NPCID.EnchantedNightcrawler); //ID is 484 + NPC.CloneDefaults(NPCID.EnchantedNightcrawler); //ID is 484 aiType = NPCID.EnchantedNightcrawler; animationType = NPCID.EnchantedNightcrawler; } public override bool PreAI() { - npc.type = NPCID.EnchantedNightcrawler; //Make it immediately turn into vanilla critter + NPC.type = NPCID.EnchantedNightcrawler; //Make it immediately turn into vanilla critter return true; } @@ -38,11 +38,11 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) { return 0f; } - else if (spawnInfo.player.InAstral()) + else if (spawnInfo.Player.InAstral()) { return SpawnCondition.TownCritter.Chance; } diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 0887dd01cb..d70dd38616 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -9,6 +9,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Astral { @@ -20,42 +21,42 @@ namespace CalamityMod.NPCs.Astral { DisplayName.SetDefault("Fusion Feeder"); if (!Main.dedServ) - glowmask = ModContent.GetTexture("CalamityMod/NPCs/Astral/FusionFeederGlow"); - Main.npcFrameCount[npc.type] = 4; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/FusionFeederGlow"); + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.noGravity = true; - npc.width = 120; - npc.height = 24; - npc.damage = 45; - npc.aiStyle = 103; - npc.lifeMax = 400; - npc.defense = 12; - npc.DR_NERD(0.15f); - npc.value = Item.buyPrice(0, 0, 20, 0); - npc.knockBackResist = 0.8f; - npc.behindTiles = true; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + NPC.noGravity = true; + NPC.width = 120; + NPC.height = 24; + NPC.damage = 45; + NPC.aiStyle = 103; + NPC.lifeMax = 400; + NPC.defense = 12; + NPC.DR_NERD(0.15f); + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.knockBackResist = 0.8f; + NPC.behindTiles = true; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); animationType = NPCID.SandShark; - banner = npc.type; + banner = NPC.type; bannerItem = ModContent.ItemType(); if (CalamityWorld.downedAstrageldon) { - npc.damage = 65; - npc.defense = 22; - npc.knockBackResist = 0.7f; - npc.lifeMax = 600; + NPC.damage = 65; + NPC.defense = 22; + NPC.knockBackResist = 0.7f; + NPC.lifeMax = 600; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) { //DO DUST - Dust d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 134, frameHeight, ModContent.DustType(), new Rectangle(46, 4, 60, 6), Vector2.Zero, 0.55f, true); + Dust d = CalamityGlobalNPC.SpawnDustOnNPC(NPC, 134, frameHeight, ModContent.DustType(), new Rectangle(46, 4, 60, 6), Vector2.Zero, 0.55f, true); if (d != null) { d.customData = 0.04f; @@ -64,32 +65,32 @@ namespace CalamityMod.NPCs.Astral public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 15; + NPC.soundDelay = 15; switch (Main.rand.Next(3)) { case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), NPC.Center); break; case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), NPC.Center); break; case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), NPC.Center); break; } } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : ModContent.DustType(), 1f, 4, 25); + CalamityGlobalNPC.DoHitDust(NPC, hitDirection, (Main.rand.Next(0, Math.Max(0, NPC.life)) == 0) ? 5 : ModContent.DustType(), 1f, 4, 25); //if dead do gores - if (npc.life <= 0) + if (NPC.life <= 0) { for (int i = 0; i < 6; i++) { float rand = Main.rand.NextFloat(-0.18f, 0.18f); - Gore.NewGore(npc.position + new Vector2(Main.rand.NextFloat(0f, npc.width), Main.rand.NextFloat(0f, npc.height)), npc.velocity * rand, mod.GetGoreSlot("Gores/FusionFeeder/FusionFeederGore" + i)); + Gore.NewGore(NPC.position + new Vector2(Main.rand.NextFloat(0f, NPC.width), Main.rand.NextFloat(0f, NPC.height)), NPC.velocity * rand, Mod.GetGoreSlot("Gores/FusionFeeder/FusionFeederGore" + i)); } } } @@ -100,21 +101,21 @@ namespace CalamityMod.NPCs.Astral Vector2 origin = new Vector2(67f, 23f); //draw shark - spriteBatch.Draw(Main.npcTexture[npc.type], npc.Center - Main.screenPosition + offset, npc.frame, drawColor, npc.rotation, origin, 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(Main.npcTexture[NPC.type], NPC.Center - Main.screenPosition + offset, NPC.frame, drawColor, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); //draw glowmask - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition + offset, npc.frame, Color.White * 0.6f, npc.rotation, origin, 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask, NPC.Center - Main.screenPosition + offset, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) { return 0f; } - else if (spawnInfo.player.InAstral(3)) + else if (spawnInfo.Player.InAstral(3)) { return 0.14f; } @@ -128,8 +129,8 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); } } } diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index f8f64d65d2..f2a97659ad 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -10,6 +10,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Astral { @@ -21,77 +22,77 @@ namespace CalamityMod.NPCs.Astral { DisplayName.SetDefault("Hadarian"); if (!Main.dedServ) - glowmask = ModContent.GetTexture("CalamityMod/NPCs/Astral/HadarianGlow"); - Main.npcFrameCount[npc.type] = 7; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HadarianGlow"); + Main.npcFrameCount[NPC.type] = 7; } public override void SetDefaults() { - npc.width = 50; - npc.height = 40; - npc.aiStyle = -1; - npc.damage = 50; - npc.defense = 8; - npc.DR_NERD(0.15f); - npc.lifeMax = 330; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - npc.knockBackResist = 0.75f; - npc.value = Item.buyPrice(0, 0, 15, 0); - banner = npc.type; + NPC.width = 50; + NPC.height = 40; + NPC.aiStyle = -1; + NPC.damage = 50; + NPC.defense = 8; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 330; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + NPC.knockBackResist = 0.75f; + NPC.value = Item.buyPrice(0, 0, 15, 0); + banner = NPC.type; bannerItem = ModContent.ItemType(); if (CalamityWorld.downedAstrageldon) { - npc.damage = 80; - npc.defense = 18; - npc.knockBackResist = 0.65f; - npc.lifeMax = 490; + NPC.damage = 80; + NPC.defense = 18; + NPC.knockBackResist = 0.65f; + NPC.lifeMax = 490; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void AI() { - CalamityGlobalNPC.DoVultureAI(npc, (CalamityWorld.death ? 0.225f : 0.15f), (CalamityWorld.death ? 5.25f : 3.5f), 32, 50, 150, 150); + CalamityGlobalNPC.DoVultureAI(NPC, (CalamityWorld.death ? 0.225f : 0.15f), (CalamityWorld.death ? 5.25f : 3.5f), 32, 50, 150, 150); //usually done in framing but I put it here because it makes more sense to. - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; } public override void FindFrame(int frameHeight) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.spriteDirection = npc.direction; + NPC.spriteDirection = NPC.direction; } else { - if ((double)npc.velocity.X > 0.5) + if ((double)NPC.velocity.X > 0.5) { - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } - if ((double)npc.velocity.X < -0.5) + if ((double)NPC.velocity.X < -0.5) { - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } } - if (npc.velocity.X == 0f && npc.velocity.Y == 0f) + if (NPC.velocity.X == 0f && NPC.velocity.Y == 0f) { - npc.frame.Y = 0; - npc.frameCounter = 0.0; + NPC.frame.Y = 0; + NPC.frameCounter = 0.0; } else { - npc.frameCounter++; - if (npc.frameCounter > 5) + NPC.frameCounter++; + if (NPC.frameCounter > 5) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y > frameHeight * 6 || npc.frame.Y == 0) + if (NPC.frame.Y > frameHeight * 6 || NPC.frame.Y == 0) { - npc.frame.Y = frameHeight; + NPC.frame.Y = frameHeight; } } @@ -100,21 +101,21 @@ namespace CalamityMod.NPCs.Astral private void DoWingDust(int frameHeight) { - int frame = npc.frame.Y / frameHeight; + int frame = NPC.frame.Y / frameHeight; Dust d = null; switch (frame) { case 1: - d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 82, frameHeight, ModContent.DustType(), new Rectangle(38, 16, 22, 20), Vector2.Zero, 0.35f); + d = CalamityGlobalNPC.SpawnDustOnNPC(NPC, 82, frameHeight, ModContent.DustType(), new Rectangle(38, 16, 22, 20), Vector2.Zero, 0.35f); break; case 2: - d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 82, frameHeight, ModContent.DustType(), new Rectangle(38, 24, 30, 14), Vector2.Zero); + d = CalamityGlobalNPC.SpawnDustOnNPC(NPC, 82, frameHeight, ModContent.DustType(), new Rectangle(38, 24, 30, 14), Vector2.Zero); break; case 3: - d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 82, frameHeight, ModContent.DustType(), new Rectangle(44, 28, 32, 20), Vector2.Zero); + d = CalamityGlobalNPC.SpawnDustOnNPC(NPC, 82, frameHeight, ModContent.DustType(), new Rectangle(44, 28, 32, 20), Vector2.Zero); break; case 4: - d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 82, frameHeight, ModContent.DustType(), new Rectangle(42, 36, 18, 30), Vector2.Zero, 0.3f); + d = CalamityGlobalNPC.SpawnDustOnNPC(NPC, 82, frameHeight, ModContent.DustType(), new Rectangle(42, 36, 18, 30), Vector2.Zero, 0.3f); break; } @@ -126,14 +127,14 @@ namespace CalamityMod.NPCs.Astral public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - Vector2 position = npc.Bottom - new Vector2(19f, 42f); + Vector2 position = NPC.Bottom - new Vector2(19f, 42f); //20 34 38 42 Rectangle src = new Rectangle(20, 34, 38, 42); - spriteBatch.Draw(Main.npcTexture[npc.type], position - Main.screenPosition, src, drawColor, npc.rotation, default, 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(Main.npcTexture[NPC.type], position - Main.screenPosition, src, drawColor, NPC.rotation, default, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); //draw glowmask - spriteBatch.Draw(glowmask, position - Main.screenPosition, src, Color.White * 0.6f, npc.rotation, default, 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask, position - Main.screenPosition, src, Color.White * 0.6f, NPC.rotation, default, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; } return true; @@ -141,42 +142,42 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - if (npc.ai[0] != 0f) + if (NPC.ai[0] != 0f) { Vector2 origin = new Vector2(41f, 39f); //draw glowmask - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition - new Vector2(0f, 12f), npc.frame, Color.White * 0.6f, npc.rotation, origin, 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask, NPC.Center - Main.screenPosition - new Vector2(0f, 12f), NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } } public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 15; + NPC.soundDelay = 15; switch (Main.rand.Next(3)) { case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), NPC.Center); break; case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), NPC.Center); break; case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), NPC.Center); break; } } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : ModContent.DustType(), 1f, 3, 20); + CalamityGlobalNPC.DoHitDust(NPC, hitDirection, (Main.rand.Next(0, Math.Max(0, NPC.life)) == 0) ? 5 : ModContent.DustType(), 1f, 3, 20); //if dead do gores - if (npc.life <= 0) + if (NPC.life <= 0) { for (int i = 0; i < 5; i++) { - Gore.NewGore(npc.Center, npc.velocity * 0.3f, mod.GetGoreSlot("Gores/Hadarian/HadarianGore" + i)); + Gore.NewGore(NPC.Center, NPC.velocity * 0.3f, Mod.GetGoreSlot("Gores/Hadarian/HadarianGore" + i)); } } } @@ -184,11 +185,11 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) { return 0f; } - else if (spawnInfo.player.InAstral(3) && spawnInfo.spawnTileType == ModContent.TileType() && tile.wall == WallID.None) + else if (spawnInfo.Player.InAstral(3) && spawnInfo.spawnTileType == ModContent.TileType() && tile.WallType == WallID.None) { return 0.25f; } @@ -202,9 +203,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 2, 2, 3); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 2, 2, 3); } } } diff --git a/NPCs/Astral/Hive.cs b/NPCs/Astral/Hive.cs index 8c83ed041f..76e1351d59 100644 --- a/NPCs/Astral/Hive.cs +++ b/NPCs/Astral/Hive.cs @@ -9,6 +9,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Astral { @@ -20,45 +21,45 @@ namespace CalamityMod.NPCs.Astral { DisplayName.SetDefault("Hive"); if (!Main.dedServ) - glowmask = ModContent.GetTexture("CalamityMod/NPCs/Astral/HiveGlow"); - Main.npcFrameCount[npc.type] = 6; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HiveGlow"); + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.width = 38; - npc.height = 62; - npc.aiStyle = -1; - npc.damage = 55; - npc.defense = 15; - npc.DR_NERD(0.15f); - npc.lifeMax = 470; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 15, 0); - banner = npc.type; + NPC.width = 38; + NPC.height = 62; + NPC.aiStyle = -1; + NPC.damage = 55; + NPC.defense = 15; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 470; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 15, 0); + banner = NPC.type; bannerItem = ModContent.ItemType(); if (CalamityWorld.downedAstrageldon) { - npc.damage = 90; - npc.defense = 25; - npc.lifeMax = 700; + NPC.damage = 90; + NPC.defense = 25; + NPC.lifeMax = 700; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void AI() { - npc.ai[0]++; - if (npc.ai[0] > (CalamityWorld.death ? 120f : 180f)) + NPC.ai[0]++; + if (NPC.ai[0] > (CalamityWorld.death ? 120f : 180f)) { if (Main.rand.NextBool(100) && NPC.CountNPCS(ModContent.NPCType()) < 10) { - npc.ai[0] = 0; + NPC.ai[0] = 0; //spawn hiveling, it's ai[0] is the hive npc index. - int n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), 0, npc.whoAmI); + int n = NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 0, NPC.whoAmI); Main.npc[n].velocity.X = Main.rand.NextFloat(-0.4f, 0.4f); Main.npc[n].velocity.Y = Main.rand.NextFloat(-0.5f, -0.05f); } @@ -67,14 +68,14 @@ namespace CalamityMod.NPCs.Astral public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter > 10) + NPC.frameCounter++; + if (NPC.frameCounter > 10) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y > frameHeight * 4) + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y > frameHeight * 4) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } @@ -82,32 +83,32 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { //draw glowmask - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition, npc.frame, Color.White * 0.6f, npc.rotation, new Vector2(19, 30), 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask, NPC.Center - Main.screenPosition, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(19, 30), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 15; + NPC.soundDelay = 15; switch (Main.rand.Next(3)) { case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), NPC.Center); break; case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), NPC.Center); break; case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), NPC.Center); break; } } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : ModContent.DustType(), 1f, 3, 20); + CalamityGlobalNPC.DoHitDust(NPC, hitDirection, (Main.rand.Next(0, Math.Max(0, NPC.life)) == 0) ? 5 : ModContent.DustType(), 1f, 3, 20); //if dead do gores - if (npc.life <= 0) + if (NPC.life <= 0) { int type = ModContent.NPCType(); for (int i = 0; i < 200; i++) @@ -122,11 +123,11 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player) || NPC.AnyNPCs(npc.type)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player) || NPC.AnyNPCs(NPC.type)) { return 0f; } - else if (spawnInfo.player.InAstral(2)) + else if (spawnInfo.Player.InAstral(2)) { return 0.17f; } @@ -140,9 +141,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/Hiveling.cs b/NPCs/Astral/Hiveling.cs index 0efee48996..fc90422e5c 100644 --- a/NPCs/Astral/Hiveling.cs +++ b/NPCs/Astral/Hiveling.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Astral { @@ -17,84 +18,84 @@ namespace CalamityMod.NPCs.Astral { DisplayName.SetDefault("Hiveling"); if (!Main.dedServ) - glowmask = ModContent.GetTexture("CalamityMod/NPCs/Astral/HivelingGlow"); - Main.npcFrameCount[npc.type] = 4; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HivelingGlow"); + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.width = 50; - npc.height = 40; - npc.aiStyle = -1; - npc.damage = 30; - npc.defense = 0; - npc.lifeMax = 150; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - npc.knockBackResist = 0.5f; - npc.noGravity = true; - npc.value = Item.buyPrice(0, 0, 5, 0); + NPC.width = 50; + NPC.height = 40; + NPC.aiStyle = -1; + NPC.damage = 30; + NPC.defense = 0; + NPC.lifeMax = 150; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + NPC.knockBackResist = 0.5f; + NPC.noGravity = true; + NPC.value = Item.buyPrice(0, 0, 5, 0); if (CalamityWorld.downedAstrageldon) { - npc.damage = 50; - npc.defense = 8; - npc.knockBackResist = 0.4f; - npc.lifeMax = 220; + NPC.damage = 50; + NPC.defense = 8; + NPC.knockBackResist = 0.4f; + NPC.lifeMax = 220; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void AI() { - if (npc.ai[1] == 0f) + if (NPC.ai[1] == 0f) { - npc.velocity *= 0.97f; + NPC.velocity *= 0.97f; - npc.TargetClosest(false); - if (Main.player[npc.target].dead) + NPC.TargetClosest(false); + if (Main.player[NPC.target].dead) { - npc.TargetClosest(false); + NPC.TargetClosest(false); } - Player targ = Main.player[npc.target]; + Player targ = Main.player[NPC.target]; - if (Collision.CanHit(npc.position, npc.width, npc.height, targ.position, targ.width, targ.height) || Vector2.Distance(npc.Center, targ.MountedCenter) < 320f) + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, targ.position, targ.width, targ.height) || Vector2.Distance(NPC.Center, targ.MountedCenter) < 320f) { - npc.ai[1] = 1f; + NPC.ai[1] = 1f; } } else { - CalamityGlobalNPC.DoFlyingAI(npc, (CalamityWorld.death ? 4.5f : 3f), (CalamityWorld.death ? 0.075f : 0.05f), 200f); - Player myTarget = Main.player[npc.target]; - Vector2 toTarget = myTarget.Center - npc.Center; + CalamityGlobalNPC.DoFlyingAI(NPC, (CalamityWorld.death ? 4.5f : 3f), (CalamityWorld.death ? 0.075f : 0.05f), 200f); + Player myTarget = Main.player[NPC.target]; + Vector2 toTarget = myTarget.Center - NPC.Center; if (!myTarget.dead && myTarget.active) { - npc.spriteDirection = npc.direction = (toTarget.X > 0).ToDirectionInt(); + NPC.spriteDirection = NPC.direction = (toTarget.X > 0).ToDirectionInt(); } else { - npc.spriteDirection = npc.direction = (npc.velocity.X > 0).ToDirectionInt(); + NPC.spriteDirection = NPC.direction = (NPC.velocity.X > 0).ToDirectionInt(); } - if (npc.spriteDirection == 1) - npc.rotation += MathHelper.Pi; + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; } } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.05f + npc.velocity.Length() * 0.667f; - if (npc.frameCounter >= 8) + NPC.frameCounter += 0.05f + NPC.velocity.Length() * 0.667f; + if (NPC.frameCounter >= 8) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y > npc.height * 2) + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y > NPC.height * 2) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } //DO DUST - Dust d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 30, frameHeight, ModContent.DustType(), new Rectangle(16, 8, 6, 6), Vector2.Zero, 0.3f, true); + Dust d = CalamityGlobalNPC.SpawnDustOnNPC(NPC, 30, frameHeight, ModContent.DustType(), new Rectangle(16, 8, 6, 6), Vector2.Zero, 0.3f, true); if (d != null) { d.customData = 0.04f; @@ -104,29 +105,29 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { //draw glowmask - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition + new Vector2(0, 12), npc.frame, Color.White * 0.6f, npc.rotation, new Vector2(15, 10), 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask, NPC.Center - Main.screenPosition + new Vector2(0, 12), NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(15, 10), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 15; + NPC.soundDelay = 15; switch (Main.rand.Next(3)) { case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), NPC.Center); break; case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), NPC.Center); break; case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), NPC.Center); break; } } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : ModContent.DustType(), 1f, 3, 20); + CalamityGlobalNPC.DoHitDust(NPC, hitDirection, (Main.rand.Next(0, Math.Max(0, NPC.life)) == 0) ? 5 : ModContent.DustType(), 1f, 3, 20); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index e65eabd0a4..5ceae2de94 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -11,6 +11,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Astral { @@ -21,121 +22,121 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { DisplayName.SetDefault("Mantis"); - Main.npcFrameCount[npc.type] = 14; + Main.npcFrameCount[NPC.type] = 14; if (!Main.dedServ) - glowmask = ModContent.GetTexture("CalamityMod/NPCs/Astral/MantisGlow"); + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/MantisGlow"); } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.damage = 55; - npc.width = 60; - npc.height = 58; - npc.aiStyle = -1; - npc.defense = 6; - npc.DR_NERD(0.15f); - npc.lifeMax = 340; - npc.knockBackResist = 0.2f; - npc.value = Item.buyPrice(0, 0, 15, 0); - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - banner = npc.type; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 55; + NPC.width = 60; + NPC.height = 58; + NPC.aiStyle = -1; + NPC.defense = 6; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 340; + NPC.knockBackResist = 0.2f; + NPC.value = Item.buyPrice(0, 0, 15, 0); + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + banner = NPC.type; bannerItem = ModContent.ItemType(); if (CalamityWorld.downedAstrageldon) { - npc.damage = 85; - npc.defense = 16; - npc.knockBackResist = 0.1f; - npc.lifeMax = 510; + NPC.damage = 85; + NPC.defense = 16; + NPC.knockBackResist = 0.1f; + NPC.lifeMax = 510; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void AI() { - npc.TargetClosest(false); + NPC.TargetClosest(false); - Player target = Main.player[npc.target]; + Player target = Main.player[NPC.target]; - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { float acceleration = CalamityWorld.death ? 0.07f : 0.045f; float maxSpeed = CalamityWorld.death ? 10.5f : 6.8f; - if (npc.Center.X > target.Center.X) + if (NPC.Center.X > target.Center.X) { - npc.velocity.X -= acceleration; - if (npc.velocity.X > 0) - npc.velocity.X -= acceleration; - if (npc.velocity.X < -maxSpeed) - npc.velocity.X = -maxSpeed; + NPC.velocity.X -= acceleration; + if (NPC.velocity.X > 0) + NPC.velocity.X -= acceleration; + if (NPC.velocity.X < -maxSpeed) + NPC.velocity.X = -maxSpeed; } else { - npc.velocity.X += acceleration; - if (npc.velocity.X < 0) - npc.velocity.X += acceleration; - if (npc.velocity.X > maxSpeed) - npc.velocity.X = maxSpeed; + NPC.velocity.X += acceleration; + if (NPC.velocity.X < 0) + NPC.velocity.X += acceleration; + if (NPC.velocity.X > maxSpeed) + NPC.velocity.X = maxSpeed; } //if need to jump - if (npc.velocity.Y == 0f && (HoleBelow() || (npc.collideX && npc.position.X == npc.oldPosition.X))) + if (NPC.velocity.Y == 0f && (HoleBelow() || (NPC.collideX && NPC.position.X == NPC.oldPosition.X))) { - npc.velocity.Y = CalamityWorld.death ? -7f : -5f; + NPC.velocity.Y = CalamityWorld.death ? -7f : -5f; } //check if we can shoot at target. - Vector2 vector = npc.Center - target.Center; - if (vector.Length() < 480f && Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) + Vector2 vector = NPC.Center - target.Center; + if (vector.Length() < 480f && Collision.CanHit(NPC.position, NPC.width, NPC.height, target.position, target.width, target.height)) { - npc.ai[1] += 1f; - if (npc.ai[1] >= (CalamityWorld.death ? 60f : 120f)) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= (CalamityWorld.death ? 60f : 120f)) { //fire projectile - npc.ai[0] = 1f; - npc.ai[1] = npc.ai[2] = 0f; - npc.frame.Y = 400; - npc.frameCounter = 0; + NPC.ai[0] = 1f; + NPC.ai[1] = NPC.ai[2] = 0f; + NPC.frame.Y = 400; + NPC.frameCounter = 0; } } else - npc.ai[1] -= 0.5f; + NPC.ai[1] -= 0.5f; - if (npc.justHit) - npc.ai[1] -= 60f; + if (NPC.justHit) + NPC.ai[1] -= 60f; - if (npc.ai[1] < 0f) - npc.ai[1] = 0f; + if (NPC.ai[1] < 0f) + NPC.ai[1] = 0f; } else { - npc.ai[2] += 1f; - npc.velocity.X *= 0.95f; - if (npc.ai[2] == 20f) //Don't do >= 20f or it'll cause a wave of scythes + NPC.ai[2] += 1f; + NPC.velocity.X *= 0.95f; + if (NPC.ai[2] == 20f) //Don't do >= 20f or it'll cause a wave of scythes { - Main.PlaySound(SoundID.Item71, npc.position); - Vector2 vector = Main.player[npc.target].Center - npc.Center; + SoundEngine.PlaySound(SoundID.Item71, NPC.position); + Vector2 vector = Main.player[NPC.target].Center - NPC.Center; vector.Normalize(); int damage = CalamityWorld.downedAstrageldon ? 55 : 45; - Projectile.NewProjectile(npc.Center + (npc.Center.X < target.Center.X ? -14f : 14f) * Vector2.UnitX, vector * 7f, ModContent.ProjectileType(), damage, 0f); + Projectile.NewProjectile(NPC.Center + (NPC.Center.X < target.Center.X ? -14f : 14f) * Vector2.UnitX, vector * 7f, ModContent.ProjectileType(), damage, 0f); } } - npc.direction = npc.Center.X > target.Center.X ? 0 : 1; - npc.spriteDirection = npc.direction; + NPC.direction = NPC.Center.X > target.Center.X ? 0 : 1; + NPC.spriteDirection = NPC.direction; } private bool HoleBelow() { //width of npc in tiles int tileWidth = 4; - int tileX = (int)(npc.Center.X / 16f) - tileWidth; - if (npc.velocity.X > 0) //if moving right + int tileX = (int)(NPC.Center.X / 16f) - tileWidth; + if (NPC.velocity.X > 0) //if moving right { tileX += tileWidth; } - int tileY = (int)((npc.position.Y + npc.height) / 16f); + int tileY = (int)((NPC.position.Y + NPC.height) / 16f); for (int y = tileY; y < tileY + 2; y++) { for (int x = tileX; x < tileX + tileWidth; x++) @@ -151,39 +152,39 @@ namespace CalamityMod.NPCs.Astral public override void FindFrame(int frameHeight) { - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - if (npc.velocity.Y != 0) + if (NPC.velocity.Y != 0) { - npc.frame.Y = frameHeight * 13; - npc.frameCounter = 20; + NPC.frame.Y = frameHeight * 13; + NPC.frameCounter = 20; } else { - npc.frameCounter += 0.8f + Math.Abs(npc.velocity.X) * 0.5f; - if (npc.frameCounter > 10.0) + NPC.frameCounter += 0.8f + Math.Abs(NPC.velocity.X) * 0.5f; + if (NPC.frameCounter > 10.0) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y > frameHeight * 5) + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y > frameHeight * 5) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } } else { - npc.frameCounter++; - if (npc.frameCounter > 4) + NPC.frameCounter++; + if (NPC.frameCounter > 4) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y >= frameHeight * 13) + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y >= frameHeight * 13) { - npc.frame.Y = 0; - npc.frameCounter = 0; - npc.ai[0] = 0f; + NPC.frame.Y = 0; + NPC.frameCounter = 0; + NPC.ai[0] = 0f; } } } @@ -191,39 +192,39 @@ namespace CalamityMod.NPCs.Astral public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 15; + NPC.soundDelay = 15; switch (Main.rand.Next(3)) { case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), NPC.Center); break; case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), NPC.Center); break; case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), NPC.Center); break; } } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, ModContent.DustType(), 1f, 4, 24); + CalamityGlobalNPC.DoHitDust(NPC, hitDirection, ModContent.DustType(), 1f, 4, 24); } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { //draw glowmask - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition - new Vector2(0, 8), npc.frame, Color.White * 0.6f, npc.rotation, new Vector2(70, 40), 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask, NPC.Center - Main.screenPosition - new Vector2(0, 8), NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(70, 40), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) { return 0f; } - else if (spawnInfo.player.InAstral(1)) + else if (spawnInfo.Player.InAstral(1)) { return 0.16f; } @@ -237,9 +238,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index fda528223c..44fd2fd1d9 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -12,6 +12,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Astral { @@ -28,73 +29,73 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { DisplayName.SetDefault("Nova"); - Main.npcFrameCount[npc.type] = 8; + Main.npcFrameCount[NPC.type] = 8; if (!Main.dedServ) - glowmask = ModContent.GetTexture("CalamityMod/NPCs/Astral/NovaGlow"); + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/NovaGlow"); } public override void SetDefaults() { - npc.width = 78; - npc.height = 50; - npc.damage = 45; - npc.defense = 15; - npc.DR_NERD(0.15f); - npc.lifeMax = 230; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - npc.noGravity = true; - npc.knockBackResist = 0.5f; - npc.value = Item.buyPrice(0, 0, 20, 0); - npc.aiStyle = -1; - banner = npc.type; + NPC.width = 78; + NPC.height = 50; + NPC.damage = 45; + NPC.defense = 15; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 230; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + NPC.noGravity = true; + NPC.knockBackResist = 0.5f; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.aiStyle = -1; + banner = NPC.type; bannerItem = ModContent.ItemType(); if (CalamityWorld.downedAstrageldon) { - npc.damage = 75; - npc.defense = 25; - npc.knockBackResist = 0.4f; - npc.lifeMax = 350; + NPC.damage = 75; + NPC.defense = 25; + NPC.knockBackResist = 0.4f; + NPC.lifeMax = 350; } if (CalamityWorld.death) { travelAcceleration = 0.3f; targetTime = 60f; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.ai[3] >= 0f) + NPC.frameCounter++; + if (NPC.ai[3] >= 0f) { - if (npc.frameCounter >= 8) + if (NPC.frameCounter >= 8) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y >= frameHeight * 4) + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y >= frameHeight * 4) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } else { - if (npc.frameCounter >= 7) + if (NPC.frameCounter >= 7) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y >= frameHeight * 8) + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y >= frameHeight * 8) { - npc.frame.Y = frameHeight * 4; + NPC.frame.Y = frameHeight * 4; } } } //DO DUST - Dust d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 114, frameHeight, ModContent.DustType(), new Rectangle(78, 34, 36, 18), Vector2.Zero, 0.45f, true); + Dust d = CalamityGlobalNPC.SpawnDustOnNPC(NPC, 114, frameHeight, ModContent.DustType(), new Rectangle(78, 34, 36, 18), Vector2.Zero, 0.45f, true); if (d != null) { d.customData = 0.04f; @@ -103,82 +104,82 @@ namespace CalamityMod.NPCs.Astral public override void AI() { - Player target = Main.player[npc.target]; - if (npc.ai[3] >= 0) + Player target = Main.player[NPC.target]; + if (NPC.ai[3] >= 0) { - CalamityGlobalNPC.DoFlyingAI(npc, (CalamityWorld.death ? 8.25f : 5.5f), (CalamityWorld.death ? 0.0525f : 0.035f), 400f, 150, false); + CalamityGlobalNPC.DoFlyingAI(NPC, (CalamityWorld.death ? 8.25f : 5.5f), (CalamityWorld.death ? 0.0525f : 0.035f), 400f, 150, false); - if (Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, target.position, target.width, target.height)) { - npc.ai[3]++; + NPC.ai[3]++; } else { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; } - Vector2 between = target.Center - npc.Center; + Vector2 between = target.Center - NPC.Center; //after locking target for x amount of time and being far enough away int random = CalamityWorld.death ? 90 : 180; - if (between.Length() > 150 && npc.ai[3] >= targetTime && Main.rand.NextBool(random)) + if (between.Length() > 150 && NPC.ai[3] >= targetTime && Main.rand.NextBool(random)) { //set ai mode to target and travel - npc.ai[3] = -1f; + NPC.ai[3] = -1f; } return; } else { - npc.ai[3]--; - Vector2 between = target.Center - npc.Center; + NPC.ai[3]--; + Vector2 between = target.Center - NPC.Center; - if (npc.ai[3] < -waitBeforeTravel) + if (NPC.ai[3] < -waitBeforeTravel) { - if (npc.collideX || npc.collideY || npc.ai[3] < -maxTravelTime) + if (NPC.collideX || NPC.collideY || NPC.ai[3] < -maxTravelTime) { Explode(); } - npc.velocity += new Vector2(npc.ai[1], npc.ai[2]) * travelAcceleration; //acceleration per frame + NPC.velocity += new Vector2(NPC.ai[1], NPC.ai[2]) * travelAcceleration; //acceleration per frame //rotation - npc.rotation = npc.velocity.ToRotation(); + NPC.rotation = NPC.velocity.ToRotation(); } - else if (npc.ai[3] == -waitBeforeTravel) + else if (NPC.ai[3] == -waitBeforeTravel) { between.Normalize(); - npc.ai[1] = between.X; - npc.ai[2] = between.Y; + NPC.ai[1] = between.X; + NPC.ai[2] = between.Y; //rotation - npc.rotation = between.ToRotation(); - npc.velocity = Vector2.Zero; + NPC.rotation = between.ToRotation(); + NPC.velocity = Vector2.Zero; } else { //slowdown - npc.velocity *= slowdown; + NPC.velocity *= slowdown; //rotation - npc.rotation = between.ToRotation(); + NPC.rotation = between.ToRotation(); } - npc.rotation += MathHelper.Pi; + NPC.rotation += MathHelper.Pi; } } private void Explode() { //kill NPC - Main.PlaySound(SoundID.Item14, npc.Center); + SoundEngine.PlaySound(SoundID.Item14, NPC.Center); //change stuffs - Vector2 center = npc.Center; - npc.width = 200; - npc.height = 200; - npc.Center = center; + Vector2 center = NPC.Center; + NPC.width = 200; + NPC.height = 200; + NPC.Center = center; - Rectangle myRect = npc.getRect(); + Rectangle myRect = NPC.getRect(); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -186,89 +187,89 @@ namespace CalamityMod.NPCs.Astral { if (Main.player[i].getRect().Intersects(myRect)) { - int direction = npc.Center.X - Main.player[i].Center.X < 0 ? -1 : 1; - Main.player[i].Hurt(PlayerDeathReason.ByNPC(npc.whoAmI), npc.damage, direction); + int direction = NPC.Center.X - Main.player[i].Center.X < 0 ? -1 : 1; + Main.player[i].Hurt(PlayerDeathReason.ByNPC(NPC.whoAmI), NPC.damage, direction); } } } //other things - npc.ai[3] = -20000f; - npc.value = 0f; - npc.extraValue = 0f; - npc.StrikeNPCNoInteraction(9999, 1f, 1); + NPC.ai[3] = -20000f; + NPC.value = 0f; + NPC.extraValue = 0f; + NPC.StrikeNPCNoInteraction(9999, 1f, 1); int size = 30; Vector2 off = new Vector2(size / -2f); for (int i = 0; i < 45; i++) { - int dust = Dust.NewDust(npc.Center - off, size, size, ModContent.DustType(), Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-3f, 3f), 0, default, Main.rand.NextFloat(1f, 2f)); + int dust = Dust.NewDust(NPC.Center - off, size, size, ModContent.DustType(), Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-3f, 3f), 0, default, Main.rand.NextFloat(1f, 2f)); Main.dust[dust].velocity *= 1.4f; } for (int i = 0; i < 15; i++) { - int dust = Dust.NewDust(npc.Center - off, size, size, 31, 0f, 0f, 100, default, 1.7f); + int dust = Dust.NewDust(NPC.Center - off, size, size, 31, 0f, 0f, 100, default, 1.7f); Main.dust[dust].velocity *= 1.4f; } for (int i = 0; i < 27; i++) { - int dust = Dust.NewDust(npc.Center - off, size, size, 6, 0f, 0f, 100, default, 2.4f); + int dust = Dust.NewDust(NPC.Center - off, size, size, 6, 0f, 0f, 100, default, 2.4f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 5f; - dust = Dust.NewDust(npc.Center - off, size, size, 6, 0f, 0f, 100, default, 1.6f); + dust = Dust.NewDust(NPC.Center - off, size, size, 6, 0f, 0f, 100, default, 1.6f); Main.dust[dust].velocity *= 3f; } } public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 15; + NPC.soundDelay = 15; switch (Main.rand.Next(3)) { case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), NPC.Center); break; case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), NPC.Center); break; case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), NPC.Center); break; } } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : ModContent.DustType(), 1f, 3, 40); + CalamityGlobalNPC.DoHitDust(NPC, hitDirection, (Main.rand.Next(0, Math.Max(0, NPC.life)) == 0) ? 5 : ModContent.DustType(), 1f, 3, 40); //if dead do gores - if (npc.life <= 0) + if (NPC.life <= 0) { for (int i = 0; i < 7; i++) { - Gore.NewGore(npc.Center, npc.velocity * 0.3f, mod.GetGoreSlot("Gores/Nova/NovaGore" + i)); + Gore.NewGore(NPC.Center, NPC.velocity * 0.3f, Mod.GetGoreSlot("Gores/Nova/NovaGore" + i)); } } } public override bool PreNPCLoot() { - return npc.ai[3] > -10000; + return NPC.ai[3] > -10000; } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition - new Vector2(0, 4f), npc.frame, Color.White * 0.75f, npc.rotation, new Vector2(57f, 37f), npc.scale, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(glowmask, NPC.Center - Main.screenPosition - new Vector2(0, 4f), NPC.frame, Color.White * 0.75f, NPC.rotation, new Vector2(57f, 37f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) { return 0f; } - else if (spawnInfo.player.InAstral(1)) + else if (spawnInfo.Player.InAstral(1)) { return 0.19f; } @@ -282,10 +283,10 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7, 1, 1); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7, 1, 1); } } } diff --git a/NPCs/Astral/SmallSightseer.cs b/NPCs/Astral/SmallSightseer.cs index 949cebc579..4521327793 100644 --- a/NPCs/Astral/SmallSightseer.cs +++ b/NPCs/Astral/SmallSightseer.cs @@ -8,6 +8,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Astral { @@ -18,53 +19,53 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { DisplayName.SetDefault("Small Sightseer"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; if (!Main.dedServ) - glowmask = ModContent.GetTexture("CalamityMod/NPCs/Astral/SmallSightseerGlow"); + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/SmallSightseerGlow"); } public override void SetDefaults() { - npc.width = 48; - npc.height = 40; - npc.damage = 38; - npc.defense = 16; - npc.DR_NERD(0.15f); - npc.lifeMax = 310; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - npc.noGravity = true; - npc.knockBackResist = 0.58f; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.aiStyle = -1; - banner = npc.type; + NPC.width = 48; + NPC.height = 40; + NPC.damage = 38; + NPC.defense = 16; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 310; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + NPC.noGravity = true; + NPC.knockBackResist = 0.58f; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.aiStyle = -1; + banner = NPC.type; bannerItem = ModContent.ItemType(); if (CalamityWorld.downedAstrageldon) { - npc.damage = 58; - npc.defense = 26; - npc.knockBackResist = 0.48f; - npc.lifeMax = 460; + NPC.damage = 58; + NPC.defense = 26; + NPC.knockBackResist = 0.48f; + NPC.lifeMax = 460; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.05f + npc.velocity.Length() * 0.667f; - if (npc.frameCounter >= 8) + NPC.frameCounter += 0.05f + NPC.velocity.Length() * 0.667f; + if (NPC.frameCounter >= 8) { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y > npc.height * 2) + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y > NPC.height * 2) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } //DO DUST - Dust d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 80, frameHeight, ModContent.DustType(), new Rectangle(16, 8, 6, 6), Vector2.Zero, 0.45f, true); + Dust d = CalamityGlobalNPC.SpawnDustOnNPC(NPC, 80, frameHeight, ModContent.DustType(), new Rectangle(16, 8, 6, 6), Vector2.Zero, 0.45f, true); if (d != null) { d.customData = 0.04f; @@ -73,55 +74,55 @@ namespace CalamityMod.NPCs.Astral public override void AI() { - CalamityGlobalNPC.DoFlyingAI(npc, (CalamityWorld.death ? 8.7f : 5.8f), (CalamityWorld.death ? 0.045f : 0.03f), 350f); + CalamityGlobalNPC.DoFlyingAI(NPC, (CalamityWorld.death ? 8.7f : 5.8f), (CalamityWorld.death ? 0.045f : 0.03f), 350f); } public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 15; + NPC.soundDelay = 15; switch (Main.rand.Next(3)) { case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), NPC.Center); break; case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), NPC.Center); break; case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), NPC.Center); break; } } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : ModContent.DustType(), 1f, 4, 22); + CalamityGlobalNPC.DoHitDust(NPC, hitDirection, (Main.rand.Next(0, Math.Max(0, NPC.life)) == 0) ? 5 : ModContent.DustType(), 1f, 4, 22); //if dead do gores - if (npc.life <= 0) + if (NPC.life <= 0) { for (int i = 0; i < 5; i++) { float rand = Main.rand.NextFloat(-0.18f, 0.18f); - Gore.NewGore(npc.position + new Vector2(Main.rand.NextFloat(0f, npc.width), Main.rand.NextFloat(0f, npc.height)), npc.velocity * rand, mod.GetGoreSlot("Gores/SmallSightseer/SmallSightseerGore" + i)); + Gore.NewGore(NPC.position + new Vector2(Main.rand.NextFloat(0f, NPC.width), Main.rand.NextFloat(0f, NPC.height)), NPC.velocity * rand, Mod.GetGoreSlot("Gores/SmallSightseer/SmallSightseerGore" + i)); } } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition + new Vector2(0, 4f), new Rectangle(0, npc.frame.Y, 80, npc.frame.Height), Color.White * 0.75f, npc.rotation, new Vector2(40f, 20f), npc.scale, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(glowmask, NPC.Center - Main.screenPosition + new Vector2(0, 4f), new Rectangle(0, NPC.frame.Y, 80, NPC.frame.Height), Color.White * 0.75f, NPC.rotation, new Vector2(40f, 20f), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) { return 0f; } - else if (spawnInfo.player.InAstral(1)) + else if (spawnInfo.Player.InAstral(1)) { - return spawnInfo.player.ZoneDesert ? 0.16f : 0.2f; + return spawnInfo.Player.ZoneDesert ? 0.16f : 0.2f; } return 0f; } @@ -133,8 +134,8 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.5f, 1, 2); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.5f, 1, 2); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); } } } diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index 5544fa4540..d83f43e2f3 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -10,6 +10,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Astral { @@ -21,42 +22,42 @@ namespace CalamityMod.NPCs.Astral { DisplayName.SetDefault("Stellar Culex"); if (!Main.dedServ) - glowmask = ModContent.GetTexture("CalamityMod/NPCs/Astral/StellarCulexGlow"); - Main.npcFrameCount[npc.type] = 4; + glowmask = ModContent.Request("CalamityMod/NPCs/Astral/StellarCulexGlow"); + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.width = 60; - npc.height = 50; - npc.aiStyle = 14; //bats - npc.npcSlots = 0.5f; //needed? - npc.damage = 55; - npc.defense = 18; - npc.DR_NERD(0.15f); - npc.knockBackResist = 0.65f; - npc.lifeMax = 210; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + NPC.width = 60; + NPC.height = 50; + NPC.aiStyle = 14; //bats + NPC.npcSlots = 0.5f; //needed? + NPC.damage = 55; + NPC.defense = 18; + NPC.DR_NERD(0.15f); + NPC.knockBackResist = 0.65f; + NPC.lifeMax = 210; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); animationType = NPCID.GiantFlyingFox; - banner = npc.type; + banner = NPC.type; bannerItem = ModContent.ItemType(); if (CalamityWorld.downedAstrageldon) { - npc.damage = 90; - npc.defense = 28; - npc.knockBackResist = 0.55f; - npc.lifeMax = 320; + NPC.damage = 90; + NPC.defense = 28; + NPC.knockBackResist = 0.55f; + NPC.lifeMax = 320; } - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) { //DO DUST - int frame = npc.frame.Y / frameHeight; - Dust d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 100, frameHeight, ModContent.DustType(), new Rectangle(66, 10, (frame == 0 || frame == 3) ? 32 : 24, 16), Vector2.Zero, 0.45f, true); + int frame = NPC.frame.Y / frameHeight; + Dust d = CalamityGlobalNPC.SpawnDustOnNPC(NPC, 100, frameHeight, ModContent.DustType(), new Rectangle(66, 10, (frame == 0 || frame == 3) ? 32 : 24, 16), Vector2.Zero, 0.45f, true); if (d != null) { d.customData = 0.04f; @@ -65,31 +66,31 @@ namespace CalamityMod.NPCs.Astral public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 15; + NPC.soundDelay = 15; switch (Main.rand.Next(3)) { case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), NPC.Center); break; case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), NPC.Center); break; case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), NPC.Center); break; } } - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : ModContent.DustType(), 1f, 4, 22); + CalamityGlobalNPC.DoHitDust(NPC, hitDirection, (Main.rand.Next(0, Math.Max(0, NPC.life)) == 0) ? 5 : ModContent.DustType(), 1f, 4, 22); //if dead do gores - if (npc.life <= 0) + if (NPC.life <= 0) { for (int i = 0; i < 6; i++) { - Gore.NewGore(npc.Center, npc.velocity * 0.3f, mod.GetGoreSlot("Gores/StellarCulex/StellarCulexGore" + i)); + Gore.NewGore(NPC.Center, NPC.velocity * 0.3f, Mod.GetGoreSlot("Gores/StellarCulex/StellarCulexGore" + i)); } } } @@ -97,16 +98,16 @@ namespace CalamityMod.NPCs.Astral public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { Vector2 origin = new Vector2(50, 30f); - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition, npc.frame, Color.White * 0.6f, npc.rotation, origin, 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(glowmask, NPC.Center - Main.screenPosition, NPC.frame, Color.White * 0.6f, NPC.rotation, origin, 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) { return 0f; } - else if (spawnInfo.player.InAstral(2)) + else if (spawnInfo.Player.InAstral(2)) { return 0.16f; } @@ -120,9 +121,9 @@ namespace CalamityMod.NPCs.Astral public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.5f, 1, 2); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.5f, 1, 2); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/Twinkler.cs b/NPCs/Astral/Twinkler.cs index 7bd5f49a0e..87ba309888 100644 --- a/NPCs/Astral/Twinkler.cs +++ b/NPCs/Astral/Twinkler.cs @@ -11,19 +11,19 @@ namespace CalamityMod.NPCs.Astral public override void SetStaticDefaults() { DisplayName.SetDefault("Twinkler"); - Main.npcFrameCount[npc.type] = 8; - Main.npcCatchable[npc.type] = true; + Main.npcFrameCount[NPC.type] = 8; + Main.npcCatchable[NPC.type] = true; } public override void SetDefaults() { - npc.CloneDefaults(NPCID.LightningBug); //ID is 358 - npc.width = 7; - npc.height = 5; + NPC.CloneDefaults(NPCID.LightningBug); //ID is 358 + NPC.width = 7; + NPC.height = 5; aiType = NPCID.LightningBug; animationType = NPCID.LightningBug; - npc.catchItem = (short)ModContent.ItemType(); - npc.friendly = true; // prevents critter from getting slagged + NPC.catchItem = (short)ModContent.ItemType(); + NPC.friendly = true; // prevents critter from getting slagged //banner = npc.type; //bannerItem = ModContent.ItemType(); } @@ -34,19 +34,19 @@ namespace CalamityMod.NPCs.Astral public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int i = 0; i < 6; i++) { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), 2 * hitDirection, -2f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 2 * hitDirection, -2f); if (Main.rand.NextBool(2)) { Main.dust[dust].noGravity = true; - Main.dust[dust].scale = 1.2f * npc.scale; + Main.dust[dust].scale = 1.2f * NPC.scale; } else { - Main.dust[dust].scale = 0.7f * npc.scale; + Main.dust[dust].scale = 0.7f * NPC.scale; } } } @@ -54,11 +54,11 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) { return 0f; } - else if (spawnInfo.player.InAstral()) + else if (spawnInfo.Player.InAstral()) { return SpawnCondition.TownCritter.Chance; } diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 6f7d2cd113..cfb787aead 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -22,6 +22,7 @@ using System.Threading; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.AstrumAureus { @@ -33,91 +34,91 @@ namespace CalamityMod.NPCs.AstrumAureus public override void SetStaticDefaults() { DisplayName.SetDefault("Astrum Aureus"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.lavaImmune = true; - npc.noGravity = true; - npc.npcSlots = 15f; - npc.GetNPCDamage(); - npc.Calamity().canBreakPlayerDefense = true; - npc.width = 374; - npc.height = 374; - npc.defense = 40; - npc.DR_NERD(0.5f); - npc.LifeMaxNERB(NPC.downedMoonlord ? 196000 : 98000, NPC.downedMoonlord ? 235200 : 117600, 740000); // 30 seconds in boss rush - npc.aiStyle = -1; + NPC.lavaImmune = true; + NPC.noGravity = true; + NPC.npcSlots = 15f; + NPC.GetNPCDamage(); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.width = 374; + NPC.height = 374; + NPC.defense = 40; + NPC.DR_NERD(0.5f); + NPC.LifeMaxNERB(NPC.downedMoonlord ? 196000 : 98000, NPC.downedMoonlord ? 235200 : 117600, 740000); // 30 seconds in boss rush + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 60, 0, 0); - npc.boss = true; - npc.DeathSound = SoundID.NPCDeath14; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 60, 0, 0); + NPC.boss = true; + NPC.DeathSound = SoundID.NPCDeath14; music = CalamityMod.Instance.GetMusicFromMusicMod("AstrumAureus") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(stomping); - writer.Write(npc.alpha); - writer.Write(npc.localAI[2]); + writer.Write(NPC.alpha); + writer.Write(NPC.localAI[2]); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { stomping = reader.ReadBoolean(); - npc.alpha = reader.ReadInt32(); - npc.localAI[2] = reader.ReadSingle(); + NPC.alpha = reader.ReadInt32(); + NPC.localAI[2] = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityAI.AstrumAureusAI(npc, mod); + CalamityAI.AstrumAureusAI(NPC, Mod); } public override void FindFrame(int frameHeight) { - if (npc.ai[0] == 3f || npc.ai[0] == 4f) + if (NPC.ai[0] == 3f || NPC.ai[0] == 4f) { - if (npc.velocity.Y == 0f && npc.ai[1] >= 0f && npc.ai[0] == 3f) //idle before jump + if (NPC.velocity.Y == 0f && NPC.ai[1] >= 0f && NPC.ai[0] == 3f) //idle before jump { if (stomping) { stomping = false; } - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 12.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 6) + if (NPC.frame.Y >= frameHeight * 6) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } - else if (npc.velocity.Y <= 0f || npc.ai[1] < 0f) //prepare to jump and then jump + else if (NPC.velocity.Y <= 0f || NPC.ai[1] < 0f) //prepare to jump and then jump { - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 12.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 5) + if (NPC.frame.Y >= frameHeight * 5) { - npc.frame.Y = frameHeight * 5; + NPC.frame.Y = frameHeight * 5; } } else //stomping @@ -125,51 +126,51 @@ namespace CalamityMod.NPCs.AstrumAureus if (!stomping) { stomping = true; - npc.frameCounter = 0.0; - npc.frame.Y = 0; + NPC.frameCounter = 0.0; + NPC.frame.Y = 0; } - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 12.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 5) + if (NPC.frame.Y >= frameHeight * 5) { - npc.frame.Y = frameHeight * 5; + NPC.frame.Y = frameHeight * 5; } } } - else if (npc.ai[0] >= 5f) + else if (NPC.ai[0] >= 5f) { if (stomping) { stomping = false; } - if (npc.velocity.Y == 0f) //idle before teleport + if (NPC.velocity.Y == 0f) //idle before teleport { - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 12.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 6) + if (NPC.frame.Y >= frameHeight * 6) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } else //in-air { - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 12.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 5) + if (NPC.frame.Y >= frameHeight * 5) { - npc.frame.Y = frameHeight * 5; + NPC.frame.Y = frameHeight * 5; } } } @@ -179,83 +180,83 @@ namespace CalamityMod.NPCs.AstrumAureus { stomping = false; } - npc.frameCounter += 1.0; - if (npc.frameCounter > 8.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 8.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 6) + if (NPC.frame.Y >= frameHeight * 6) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Texture2D NPCTexture = Main.npcTexture[npc.type]; - Texture2D GlowMaskTexture = Main.npcTexture[npc.type]; + Texture2D NPCTexture = Main.npcTexture[NPC.type]; + Texture2D GlowMaskTexture = Main.npcTexture[NPC.type]; SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - NPCTexture = Main.npcTexture[npc.type]; - GlowMaskTexture = ModContent.GetTexture("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow"); + NPCTexture = Main.npcTexture[NPC.type]; + GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow"); } - else if (npc.ai[0] == 1f) //nothing special done here + else if (NPC.ai[0] == 1f) //nothing special done here { - NPCTexture = ModContent.GetTexture("CalamityMod/NPCs/AstrumAureus/AstrumAureusRecharge"); + NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusRecharge"); } - else if (npc.ai[0] == 2f) //nothing special done here + else if (NPC.ai[0] == 2f) //nothing special done here { - NPCTexture = ModContent.GetTexture("CalamityMod/NPCs/AstrumAureus/AstrumAureusWalk"); - GlowMaskTexture = ModContent.GetTexture("CalamityMod/NPCs/AstrumAureus/AstrumAureusWalkGlow"); + NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusWalk"); + GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusWalkGlow"); } - else if (npc.ai[0] == 3f || npc.ai[0] == 4f) //needs to have an in-air frame + else if (NPC.ai[0] == 3f || NPC.ai[0] == 4f) //needs to have an in-air frame { - if (npc.velocity.Y == 0f && npc.ai[1] >= 0f && npc.ai[0] == 3f) //idle before jump + if (NPC.velocity.Y == 0f && NPC.ai[1] >= 0f && NPC.ai[0] == 3f) //idle before jump { - NPCTexture = Main.npcTexture[npc.type]; //idle frames - GlowMaskTexture = ModContent.GetTexture("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow"); + NPCTexture = Main.npcTexture[NPC.type]; //idle frames + GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow"); } - else if (npc.velocity.Y <= 0f || npc.ai[1] < 0f) //jump frames if flying upward or if about to jump + else if (NPC.velocity.Y <= 0f || NPC.ai[1] < 0f) //jump frames if flying upward or if about to jump { - NPCTexture = ModContent.GetTexture("CalamityMod/NPCs/AstrumAureus/AstrumAureusJump"); - GlowMaskTexture = ModContent.GetTexture("CalamityMod/NPCs/AstrumAureus/AstrumAureusJumpGlow"); + NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJump"); + GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJumpGlow"); } else //stomping { - NPCTexture = ModContent.GetTexture("CalamityMod/NPCs/AstrumAureus/AstrumAureusStomp"); - GlowMaskTexture = ModContent.GetTexture("CalamityMod/NPCs/AstrumAureus/AstrumAureusStompGlow"); + NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusStomp"); + GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusStompGlow"); } } - else if (npc.ai[0] >= 5f) //needs to have an in-air frame + else if (NPC.ai[0] >= 5f) //needs to have an in-air frame { - if (npc.velocity.Y == 0f) //idle before teleport + if (NPC.velocity.Y == 0f) //idle before teleport { - NPCTexture = Main.npcTexture[npc.type]; //idle frames - GlowMaskTexture = ModContent.GetTexture("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow"); + NPCTexture = Main.npcTexture[NPC.type]; //idle frames + GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow"); } else //in-air frames { - NPCTexture = ModContent.GetTexture("CalamityMod/NPCs/AstrumAureus/AstrumAureusJump"); - GlowMaskTexture = ModContent.GetTexture("CalamityMod/NPCs/AstrumAureus/AstrumAureusJumpGlow"); + NPCTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJump"); + GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusJumpGlow"); } } - int frameCount = Main.npcFrameCount[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / frameCount / 2); - Rectangle frame = npc.frame; - float scale = npc.scale; - float rotation = npc.rotation; - float offsetY = npc.gfxOffY; + int frameCount = Main.npcFrameCount[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / frameCount / 2); + Rectangle frame = NPC.frame; + float scale = NPC.scale; + float rotation = NPC.rotation; + float offsetY = NPC.gfxOffY; Color color36 = Color.White; float amount9 = 0.5f; int num153 = 7; - if (npc.ai[0] == 3f || npc.ai[0] == 4f) + if (NPC.ai[0] == 3f || NPC.ai[0] == 4f) num153 = 10; if (CalamityConfig.Instance.Afterimages) @@ -264,23 +265,23 @@ namespace CalamityMod.NPCs.AstrumAureus { Color color38 = drawColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; vector41 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; vector41 += vector11 * scale + new Vector2(0f, 4f + offsetY); spriteBatch.Draw(NPCTexture, vector41, frame, color38, rotation, vector11, scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; + Vector2 vector43 = NPC.Center - Main.screenPosition; vector43 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; vector43 += vector11 * scale + new Vector2(0f, 4f + offsetY); - spriteBatch.Draw(NPCTexture, vector43, frame, npc.GetAlpha(drawColor), rotation, vector11, scale, spriteEffects, 0f); + spriteBatch.Draw(NPCTexture, vector43, frame, NPC.GetAlpha(drawColor), rotation, vector11, scale, spriteEffects, 0f); - if (npc.ai[0] != 1) //draw only if not recharging + if (NPC.ai[0] != 1) //draw only if not recharging { - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Color.Gold); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Gold); Color color40 = Color.Lerp(Color.White, color, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -289,9 +290,9 @@ namespace CalamityMod.NPCs.AstrumAureus { Color color41 = color40; color41 = Color.Lerp(color41, color36, amount9); - color41 = npc.GetAlpha(color41); + color41 = NPC.GetAlpha(color41); color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; vector44 -= new Vector2(GlowMaskTexture.Width, GlowMaskTexture.Height / frameCount) * scale / 2f; vector44 += vector11 * scale + new Vector2(0f, 4f + offsetY); spriteBatch.Draw(GlowMaskTexture, vector44, frame, color41, rotation, vector11, scale, spriteEffects, 0f); @@ -311,12 +312,12 @@ namespace CalamityMod.NPCs.AstrumAureus public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedAstrageldon); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedAstrageldon); CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Wizard, ModContent.NPCType() }, CalamityWorld.downedAstrageldon); @@ -324,12 +325,12 @@ namespace CalamityMod.NPCs.AstrumAureus if (!Main.expertMode) { // Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 20, 30, 2); - DropHelper.DropItemSpray(npc, ItemID.FallenStar, 18, 24, 2); + DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 20, 30, 2); + DropHelper.DropItemSpray(NPC, ItemID.FallenStar, 18, 24, 2); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -338,20 +339,20 @@ namespace CalamityMod.NPCs.AstrumAureus ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedMoonlord); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), NPC.downedMoonlord); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); // Other - DropHelper.DropItem(npc, ModContent.ItemType(), 9, 12); + DropHelper.DropItem(NPC, ModContent.ItemType(), 9, 12); } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // Other - DropHelper.DropItemChance(npc, ItemID.HallowedKey, 3); + DropHelper.DropItemChance(NPC, ItemID.HallowedKey, 3); // Drop an Astral Meteor if applicable ThreadPool.QueueUserWorkItem(_ => AstralBiome.PlaceAstralMeteor()); @@ -374,27 +375,27 @@ namespace CalamityMod.NPCs.AstrumAureus public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 20; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstrumAureusHit"), npc.Center); + NPC.soundDelay = 20; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstrumAureusHit"), NPC.Center); } for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 150; - npc.height = 100; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 150; + NPC.height = 100; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 50; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -404,10 +405,10 @@ namespace CalamityMod.NPCs.AstrumAureus } for (int num623 = 0; num623 < 100; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -415,18 +416,18 @@ namespace CalamityMod.NPCs.AstrumAureus public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } // Can only hit the target if within certain distance public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - Vector2 npcCenter = npc.Center; + Vector2 npcCenter = NPC.Center; // NOTE: Right and left hitboxes are interchangeable, each hitbox is the same size and is located to the right or left of the center hitbox. Rectangle leftHitbox = new Rectangle((int)(npcCenter.X - 93f - 5f + 4f), (int)(npcCenter.Y + 33f - 5f), 10, 10); - Rectangle bodyHitbox = new Rectangle((int)(npcCenter.X - (npc.width / 4f)), (int)(npcCenter.Y - (npc.height / 2f) + 24f), npc.width / 2, npc.height); + Rectangle bodyHitbox = new Rectangle((int)(npcCenter.X - (NPC.width / 4f)), (int)(npcCenter.Y - (NPC.height / 2f) + 24f), NPC.width / 2, NPC.height); Rectangle rightHitbox = new Rectangle((int)(npcCenter.X + 93f - 5f - 4f), (int)(npcCenter.Y + 33f - 5f), 10, 10); Vector2 leftHitboxCenter = new Vector2(leftHitbox.X + (leftHitbox.Width / 2), leftHitbox.Y + (leftHitbox.Height / 2)); @@ -480,7 +481,7 @@ namespace CalamityMod.NPCs.AstrumAureus bool insideRightHitbox = minRightDist <= 120f; - return (insideLeftHitbox || insideBodyHitbox || insideRightHitbox) && npc.alpha == 0 && npc.ai[0] > 1f; + return (insideLeftHitbox || insideBodyHitbox || insideRightHitbox) && NPC.alpha == 0 && NPC.ai[0] > 1f; } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index f20c19cf92..8c51528e26 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -10,6 +10,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.AstrumAureus { @@ -18,99 +19,99 @@ namespace CalamityMod.NPCs.AstrumAureus public override void SetStaticDefaults() { DisplayName.SetDefault("Aureus Spawn"); - Main.npcFrameCount[npc.type] = 4; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 4; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.aiStyle = -1; aiType = -1; - npc.GetNPCDamage(); - npc.width = 90; - npc.height = 60; - npc.alpha = 255; - npc.defense = 10; - npc.lifeMax = NPC.downedMoonlord ? 8250 : 3000; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.GetNPCDamage(); + NPC.width = 90; + NPC.height = 60; + NPC.alpha = 255; + NPC.defense = 10; + NPC.lifeMax = NPC.downedMoonlord ? 8250 : 3000; + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); } public override void AI() { - npc.damage = 0; + NPC.damage = 0; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.25f, 0f); + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.6f, 0.25f, 0f); - npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.04f; + NPC.rotation = Math.Abs(NPC.velocity.X) * (float)NPC.direction * 0.04f; - npc.spriteDirection = npc.direction; + NPC.spriteDirection = NPC.direction; - if (npc.alpha > 0) + if (NPC.alpha > 0) { - npc.alpha -= 5; + NPC.alpha -= 5; int num; for (int num245 = 0; num245 < 10; num245 = num + 1) { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 0.8f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), NPC.velocity.X, NPC.velocity.Y, 255, default, 0.8f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.5f; num = num245; } } - npc.TargetClosest(); + NPC.TargetClosest(); // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; if (lifeRatio <= 0.5f || Main.dayTime) { - npc.ai[1] += 1f; - npc.dontTakeDamage = true; - Vector2 vector = Main.player[npc.target].Center - npc.Center; - Point point15 = npc.Center.ToTileCoordinates(); + NPC.ai[1] += 1f; + NPC.dontTakeDamage = true; + Vector2 vector = Main.player[NPC.target].Center - NPC.Center; + Point point15 = NPC.Center.ToTileCoordinates(); Tile tileSafely = Framing.GetTileSafely(point15); - bool flag121 = tileSafely.nactive() && Main.tileSolid[tileSafely.type] && !Main.tileSolidTop[tileSafely.type] && !TileID.Sets.Platforms[tileSafely.type]; - if (npc.ai[1] > ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 600f : 300f)) + bool flag121 = tileSafely.nactive() && Main.tileSolid[tileSafely.TileType] && !Main.tileSolidTop[tileSafely.TileType] && !TileID.Sets.Platforms[tileSafely.TileType]; + if (NPC.ai[1] > ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 600f : 300f)) { - npc.Calamity().newAI[0] += 1f; - npc.scale = MathHelper.Lerp(1f, 2f, npc.Calamity().newAI[0] / 45f); + NPC.Calamity().newAI[0] += 1f; + NPC.scale = MathHelper.Lerp(1f, 2f, NPC.Calamity().newAI[0] / 45f); } - if (vector.Length() < 60f || flag121 || npc.Calamity().newAI[0] >= 45f) + if (vector.Length() < 60f || flag121 || NPC.Calamity().newAI[0] >= 45f) { - npc.dontTakeDamage = false; + NPC.dontTakeDamage = false; CheckDead(); - npc.life = 0; + NPC.life = 0; return; } float num1372 = 18f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; - float num1374 = Main.player[npc.target].Center.Y - vector167.Y; + Vector2 vector167 = new Vector2(NPC.Center.X + (float)(NPC.direction * 20), NPC.Center.Y + 6f); + float num1373 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector167.X; + float num1374 = Main.player[NPC.target].Center.Y - vector167.Y; float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); float num1376 = num1372 / num1375; num1373 *= num1376; num1374 *= num1376; - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f; + NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f; if (CalamityWorld.death || BossRushEvent.BossRushActive) { @@ -119,19 +120,19 @@ namespace CalamityMod.NPCs.AstrumAureus { if (Main.npc[i].active) { - if (i != npc.whoAmI && Main.npc[i].type == npc.type) + if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) { - if (Vector2.Distance(npc.Center, Main.npc[i].Center) < 320f) + if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 320f) { - if (npc.position.X < Main.npc[i].position.X) - npc.velocity.X = npc.velocity.X - pushVelocity; + if (NPC.position.X < Main.npc[i].position.X) + NPC.velocity.X = NPC.velocity.X - pushVelocity; else - npc.velocity.X = npc.velocity.X + pushVelocity; + NPC.velocity.X = NPC.velocity.X + pushVelocity; - if (npc.position.Y < Main.npc[i].position.Y) - npc.velocity.Y = npc.velocity.Y - pushVelocity; + if (NPC.position.Y < Main.npc[i].position.Y) + NPC.velocity.Y = NPC.velocity.Y - pushVelocity; else - npc.velocity.Y = npc.velocity.Y + pushVelocity; + NPC.velocity.Y = NPC.velocity.Y + pushVelocity; } } } @@ -143,42 +144,42 @@ namespace CalamityMod.NPCs.AstrumAureus float num1446 = 7f; int num1447 = 480; - if (npc.localAI[1] == 1f) + if (NPC.localAI[1] == 1f) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; if (Main.rand.NextBool(4)) { - npc.ai[0] = num1447; + NPC.ai[0] = num1447; } } if (CalamityWorld.death || BossRushEvent.BossRushActive) { - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 180f) + NPC.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= 180f) { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.localAI[0] = 0f; + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 109); + SoundEngine.PlaySound(SoundID.Item, (int)NPC.position.X, (int)NPC.position.Y, 109); float speed = 5f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y; + Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)(NPC.height / 2)); + float num6 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector.X; + float num7 = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - vector.Y; float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); num8 = speed / num8; num6 *= num8; num7 *= num8; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, type, damage, 0f, Main.myPlayer); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.Center.X, NPC.Center.Y, num6, num7, type, damage, 0f, Main.myPlayer); } } } - Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); - Vector2 vector251 = Main.player[npc.target].Center - value53; - bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + Vector2 value53 = NPC.Center + new Vector2((float)(NPC.direction * 20), 6f); + Vector2 vector251 = Main.player[NPC.target].Center - value53; + bool flag104 = Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1); if (vector251.Length() > 400f || !flag104) { Vector2 value54 = vector251; @@ -188,34 +189,34 @@ namespace CalamityMod.NPCs.AstrumAureus value54 *= num1446; } int num1448 = 30; - npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; + NPC.velocity = (NPC.velocity * (float)(num1448 - 1) + value54) / (float)num1448; } else { - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; } - if (npc.ai[2] != 0f && npc.ai[3] != 0f) + if (NPC.ai[2] != 0f && NPC.ai[3] != 0f) { - Main.PlaySound(SoundID.Item8, npc.Center); + SoundEngine.PlaySound(SoundID.Item8, NPC.Center); int num; for (int num1449 = 0; num1449 < 20; num1449 = num + 1) { - int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), 0f, 0f, 100, Color.Transparent, 0.6f); + int num1450 = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, Color.Transparent, 0.6f); Dust dust = Main.dust[num1450]; dust.velocity *= 3f; Main.dust[num1450].noGravity = true; Main.dust[num1450].scale = 2.5f; num = num1449; } - npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); - npc.velocity = Vector2.Zero; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - Main.PlaySound(SoundID.Item8, npc.Center); + NPC.Center = new Vector2(NPC.ai[2] * 16f, NPC.ai[3] * 16f); + NPC.velocity = Vector2.Zero; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + SoundEngine.PlaySound(SoundID.Item8, NPC.Center); for (int num1451 = 0; num1451 < 20; num1451 = num + 1) { - int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), 0f, 0f, 100, Color.Transparent, 0.6f); + int num1452 = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, Color.Transparent, 0.6f); Dust dust = Main.dust[num1452]; dust.velocity *= 3f; Main.dust[num1452].noGravity = true; @@ -224,12 +225,12 @@ namespace CalamityMod.NPCs.AstrumAureus } } - npc.ai[0] += 1f; - if (npc.ai[0] >= num1447 && Main.netMode != NetmodeID.MultiplayerClient) + NPC.ai[0] += 1f; + if (NPC.ai[0] >= num1447 && Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[0] = 0f; - Point point12 = npc.Center.ToTileCoordinates(); - Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); + NPC.ai[0] = 0f; + Point point12 = NPC.Center.ToTileCoordinates(); + Point point13 = Main.player[NPC.target].Center.ToTileCoordinates(); int num1453 = 20; int num1454 = 3; int num1455 = 10; @@ -258,32 +259,32 @@ namespace CalamityMod.NPCs.AstrumAureus } if (flag107) { - npc.ai[2] = (float)num1458; - npc.ai[3] = (float)num1459; + NPC.ai[2] = (float)num1458; + NPC.ai[3] = (float)num1459; break; } } } - npc.netUpdate = true; + NPC.netUpdate = true; } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.5f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.5f * bossLifeScale); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (npc.Calamity().newAI[0] >= 45f) + if (NPC.Calamity().newAI[0] >= 45f) return false; SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 10; @@ -294,21 +295,21 @@ namespace CalamityMod.NPCs.AstrumAureus { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/AstrumAureus/AureusSpawnGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AureusSpawnGlow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -318,37 +319,37 @@ namespace CalamityMod.NPCs.AstrumAureus Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 173, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 173, hitDirection, -1f, 0, default, 1f); } } } @@ -362,16 +363,16 @@ namespace CalamityMod.NPCs.AstrumAureus public override bool CheckDead() { - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 14); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.damage = (NPC.downedMoonlord && !BossRushEvent.BossRushActive) ? npc.defDamage * 2 : npc.defDamage; - npc.width = npc.height = 432; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + SoundEngine.PlaySound(SoundID.Item, (int)NPC.position.X, (int)NPC.position.Y, 14); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.damage = (NPC.downedMoonlord && !BossRushEvent.BossRushActive) ? NPC.defDamage * 2 : NPC.defDamage; + NPC.width = NPC.height = 432; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 30; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -382,10 +383,10 @@ namespace CalamityMod.NPCs.AstrumAureus } for (int num623 = 0; num623 < 60; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; Main.dust[num624].noGravity = true; } diff --git a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs index a75810d95d..8edceb3970 100644 --- a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs @@ -16,60 +16,60 @@ namespace CalamityMod.NPCs.AstrumDeus public override void SetStaticDefaults() { DisplayName.SetDefault("Astrum Deus"); - NPCID.Sets.TrailingMode[npc.type] = 1; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 38; - npc.height = 44; - npc.defense = 35; - npc.DR_NERD(0.2f); - npc.LifeMaxNERB(200000, 240000, 650000); + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 38; + NPC.height = 44; + NPC.defense = 35; + NPC.DR_NERD(0.2f); + NPC.LifeMaxNERB(200000, 240000, 650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.5f; + NPC.scale = 1.5f; else if (CalamityWorld.death) - npc.scale = 1.4f; + NPC.scale = 1.4f; else if (CalamityWorld.revenge) - npc.scale = 1.35f; + NPC.scale = 1.35f; else if (Main.expertMode) - npc.scale = 1.2f; + NPC.scale = 1.2f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath"); - npc.netAlways = true; - npc.boss = true; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath"); + NPC.netAlways = true; + NPC.boss = true; music = CalamityMod.Instance.GetMusicFromMusicMod("AstrumDeus") ?? MusicID.Boss3; - npc.dontCountMe = true; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.dontCountMe = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -79,23 +79,23 @@ namespace CalamityMod.NPCs.AstrumDeus public override void AI() { - CalamityAI.AstrumDeusAI(npc, mod, false); + CalamityAI.AstrumDeusAI(NPC, Mod, false); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - bool altBodyTextures = npc.localAI[3] == 1f; - bool drawCyan = npc.Calamity().newAI[3] >= 600f; - bool deathModeEnragePhase = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 3f; - bool doubleWormPhase = npc.Calamity().newAI[0] != 0f && !deathModeEnragePhase; + bool altBodyTextures = NPC.localAI[3] == 1f; + bool drawCyan = NPC.Calamity().newAI[3] >= 600f; + bool deathModeEnragePhase = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; + bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D texture2D15 = altBodyTextures ? ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral") : Main.npcTexture[npc.type]; - Texture2D texture2D16 = ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow2"); - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Texture2D texture2D15 = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral") : Main.npcTexture[NPC.type]; + Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow2"); + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = deathModeEnragePhase ? 10 : 5; @@ -106,29 +106,29 @@ namespace CalamityMod.NPCs.AstrumDeus { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = altBodyTextures ? ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow") : ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow"); + texture2D15 = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow") : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow"); Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) { - texture2D15 = drawCyan ? texture2D15 : (altBodyTextures ? ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow2") : ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow3")); - texture2D16 = drawCyan ? ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow4") : texture2D16; + texture2D15 = drawCyan ? texture2D15 : (altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow2") : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow3")); + texture2D16 = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow4") : texture2D16; } - Color color37 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : npc.Opacity); - Color color42 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : npc.Opacity); + Color color37 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); + Color color42 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); if (CalamityConfig.Instance.Afterimages) { @@ -137,30 +137,30 @@ namespace CalamityMod.NPCs.AstrumDeus Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); if (!altBodyTextures) { Color color43 = color42; color43 = Color.Lerp(color43, color36, amount9); color43 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture2D16, vector44, npc.frame, color43, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } } int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 1 : 2; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); if (!altBodyTextures) { timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } return false; @@ -168,7 +168,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - return !npc.dontTakeDamage; + return !NPC.dontTakeDamage; } public override bool CheckActive() @@ -183,17 +183,17 @@ namespace CalamityMod.NPCs.AstrumDeus public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 50; + NPC.height = 50; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -203,10 +203,10 @@ namespace CalamityMod.NPCs.AstrumDeus } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -219,8 +219,8 @@ namespace CalamityMod.NPCs.AstrumDeus public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index e44c6d78d1..479a920018 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -29,66 +29,66 @@ namespace CalamityMod.NPCs.AstrumDeus public override void SetStaticDefaults() { DisplayName.SetDefault("Astrum Deus"); - NPCID.Sets.TrailingMode[npc.type] = 1; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 56; - npc.height = 56; - npc.defense = 20; - npc.DR_NERD(0.1f); - npc.LifeMaxNERB(200000, 240000, 650000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 56; + NPC.height = 56; + NPC.defense = 20; + NPC.DR_NERD(0.1f); + NPC.LifeMaxNERB(200000, 240000, 650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.5f; + NPC.scale = 1.5f; else if (CalamityWorld.death) - npc.scale = 1.4f; + NPC.scale = 1.4f; else if (CalamityWorld.revenge) - npc.scale = 1.35f; + NPC.scale = 1.35f; else if (Main.expertMode) - npc.scale = 1.2f; + NPC.scale = 1.2f; - npc.boss = true; - npc.value = Item.buyPrice(1, 0, 0, 0); - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath"); - npc.netAlways = true; + NPC.boss = true; + NPC.value = Item.buyPrice(1, 0, 0, 0); + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath"); + NPC.netAlways = true; music = CalamityMod.Instance.GetMusicFromMusicMod("AstrumDeus") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityAI.AstrumDeusAI(npc, mod, true); + CalamityAI.AstrumDeusAI(NPC, Mod, true); } public override bool CheckActive() @@ -99,16 +99,16 @@ namespace CalamityMod.NPCs.AstrumDeus public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - bool drawCyan = npc.Calamity().newAI[3] >= 600f; - bool deathModeEnragePhase = npc.Calamity().newAI[0] == 3f; - bool doubleWormPhase = npc.Calamity().newAI[0] != 0f && !deathModeEnragePhase; + bool drawCyan = NPC.Calamity().newAI[3] >= 600f; + bool deathModeEnragePhase = NPC.Calamity().newAI[0] == 3f; + bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Texture2D texture2D16 = ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow2"); - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow2"); + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = deathModeEnragePhase ? 10 : 5; @@ -119,29 +119,29 @@ namespace CalamityMod.NPCs.AstrumDeus { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow"); Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) { - texture2D15 = drawCyan ? texture2D15 : ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow3"); - texture2D16 = drawCyan ? ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow4") : texture2D16; + texture2D15 = drawCyan ? texture2D15 : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow3"); + texture2D16 = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow4") : texture2D16; } - Color color37 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : npc.Opacity); - Color color42 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : npc.Opacity); + Color color37 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); + Color color42 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); if (CalamityConfig.Instance.Afterimages) { @@ -150,42 +150,42 @@ namespace CalamityMod.NPCs.AstrumDeus Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); Color color43 = color42; color43 = Color.Lerp(color43, color36, amount9); color43 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture2D16, vector44, npc.frame, color43, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 1 : 2; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 50; + NPC.height = 50; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -195,10 +195,10 @@ namespace CalamityMod.NPCs.AstrumDeus } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -208,14 +208,14 @@ namespace CalamityMod.NPCs.AstrumDeus public override bool SpecialNPCLoot() { - if (npc.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && npc.Calamity().newAI[0] != 3f)) + if (NPC.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && NPC.Calamity().newAI[0] != 3f)) return false; - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + int closestSegmentID = DropHelper.FindClosestWormSegment(NPC, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()); - npc.position = Main.npc[closestSegmentID].position; + NPC.position = Main.npc[closestSegmentID].position; return false; } @@ -223,14 +223,14 @@ namespace CalamityMod.NPCs.AstrumDeus public override bool PreNPCLoot() { // Unsplit Deus does not drop anything when killed/despawned. - if (npc.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && npc.Calamity().newAI[0] != 3f)) + if (NPC.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && NPC.Calamity().newAI[0] != 3f)) return false; // Killing ANY split Deus makes all other Deus heads die immediately. for (int i = 0; i < Main.maxNPCs; ++i) { NPC otherWormHead = Main.npc[i]; - if (otherWormHead.active && otherWormHead.type == npc.type) + if (otherWormHead.active && otherWormHead.type == NPC.type) { // Kill the other worm head after setting it to not drop loot. otherWormHead.Calamity().newAI[0] = 0f; @@ -245,32 +245,32 @@ namespace CalamityMod.NPCs.AstrumDeus public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItem(npc, ItemID.GreaterHealingPotion, 8, 14); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !CalamityWorld.downedStarGod); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !CalamityWorld.downedStarGod); + DropHelper.DropItem(NPC, ItemID.GreaterHealingPotion, 8, 14); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !CalamityWorld.downedStarGod); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !CalamityWorld.downedStarGod); // Drop a large spray of all 4 lunar fragments int minFragments = Main.expertMode ? 20 : 16; int maxFragments = Main.expertMode ? 32 : 24; - DropHelper.DropItemSpray(npc, ItemID.FragmentSolar, minFragments, maxFragments, 4); - DropHelper.DropItemSpray(npc, ItemID.FragmentVortex, minFragments, maxFragments, 4); - DropHelper.DropItemSpray(npc, ItemID.FragmentNebula, minFragments, maxFragments, 4); - DropHelper.DropItemSpray(npc, ItemID.FragmentStardust, minFragments, maxFragments, 4); + DropHelper.DropItemSpray(NPC, ItemID.FragmentSolar, minFragments, maxFragments, 4); + DropHelper.DropItemSpray(NPC, ItemID.FragmentVortex, minFragments, maxFragments, 4); + DropHelper.DropItemSpray(NPC, ItemID.FragmentNebula, minFragments, maxFragments, 4); + DropHelper.DropItemSpray(NPC, ItemID.FragmentStardust, minFragments, maxFragments, 4); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 50, 80, 5); - DropHelper.DropItemSpray(npc, ItemID.FallenStar, 25, 40, 5); + DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 50, 80, 5); + DropHelper.DropItemSpray(NPC, ItemID.FallenStar, 25, 40, 5); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -279,11 +279,11 @@ namespace CalamityMod.NPCs.AstrumDeus ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 5); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); } // Notify players that Astral Ore can be mined if Deus has never been killed yet @@ -306,7 +306,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); } } } diff --git a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs index 6f13b4c99e..2aac9bf446 100644 --- a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs @@ -16,60 +16,60 @@ namespace CalamityMod.NPCs.AstrumDeus public override void SetStaticDefaults() { DisplayName.SetDefault("Astrum Deus"); - NPCID.Sets.TrailingMode[npc.type] = 1; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 52; - npc.height = 68; - npc.defense = 50; - npc.DR_NERD(0.3f); - npc.LifeMaxNERB(200000, 240000, 650000); + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 52; + NPC.height = 68; + NPC.defense = 50; + NPC.DR_NERD(0.3f); + NPC.LifeMaxNERB(200000, 240000, 650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.5f; + NPC.scale = 1.5f; else if (CalamityWorld.death) - npc.scale = 1.4f; + NPC.scale = 1.4f; else if (CalamityWorld.revenge) - npc.scale = 1.35f; + NPC.scale = 1.35f; else if (Main.expertMode) - npc.scale = 1.2f; + NPC.scale = 1.2f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath"); - npc.netAlways = true; - npc.boss = true; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath"); + NPC.netAlways = true; + NPC.boss = true; music = CalamityMod.Instance.GetMusicFromMusicMod("AstrumDeus") ?? MusicID.Boss3; - npc.dontCountMe = true; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.dontCountMe = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -79,21 +79,21 @@ namespace CalamityMod.NPCs.AstrumDeus public override void AI() { - CalamityAI.AstrumDeusAI(npc, mod, false); + CalamityAI.AstrumDeusAI(NPC, Mod, false); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - bool drawCyan = npc.Calamity().newAI[3] >= 600f; - bool deathModeEnragePhase = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 3f; - bool doubleWormPhase = npc.Calamity().newAI[0] != 0f && !deathModeEnragePhase; + bool drawCyan = NPC.Calamity().newAI[3] >= 600f; + bool deathModeEnragePhase = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; + bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = deathModeEnragePhase ? 10 : 5; @@ -104,27 +104,27 @@ namespace CalamityMod.NPCs.AstrumDeus { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow"); Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) { - texture2D15 = drawCyan ? ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow2") : texture2D15; + texture2D15 = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow2") : texture2D15; } - Color color37 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : npc.Opacity); + Color color37 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); if (CalamityConfig.Instance.Afterimages) { @@ -133,38 +133,38 @@ namespace CalamityMod.NPCs.AstrumDeus Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - return !npc.dontTakeDamage; + return !NPC.dontTakeDamage; } public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 50; + NPC.height = 50; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -174,10 +174,10 @@ namespace CalamityMod.NPCs.AstrumDeus } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -200,8 +200,8 @@ namespace CalamityMod.NPCs.AstrumDeus public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index c6d1e05e78..890743f768 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.BrimstoneElemental { @@ -20,107 +21,107 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void SetStaticDefaults() { DisplayName.SetDefault("Brimling"); - Main.npcFrameCount[npc.type] = 8; + Main.npcFrameCount[NPC.type] = 8; } public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 0; - npc.width = 60; - npc.height = 60; - npc.defense = 0; - npc.DR_NERD(normalDR); - npc.lifeMax = 2000; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath39; + NPC.damage = 0; + NPC.width = 60; + NPC.height = 60; + NPC.defense = 0; + NPC.DR_NERD(normalDR); + NPC.lifeMax = 2000; + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit23; + NPC.DeathSound = SoundID.NPCDeath39; if (CalamityWorld.downedProvidence) { - npc.lifeMax = 26000; + NPC.lifeMax = 26000; } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 10000; + NPC.lifeMax = 10000; } - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(boostDR); - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { boostDR = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1f, 0f, 0f); + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 1f, 0f, 0f); if (CalamityGlobalNPC.brimstoneElemental < 0 || !Main.npc[CalamityGlobalNPC.brimstoneElemental].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } - bool goIntoShell = npc.life <= npc.lifeMax * 0.25; + bool goIntoShell = NPC.life <= NPC.lifeMax * 0.25; bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; if (goIntoShell || Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] == 4f) { boostDR = true; - npc.chaseable = false; + NPC.chaseable = false; } else { boostDR = false; - npc.chaseable = true; + NPC.chaseable = true; } // Set DR based on boost status - npc.Calamity().DR = boostDR ? boostedDR : normalDR; + NPC.Calamity().DR = boostDR ? boostedDR : normalDR; float num1446 = goIntoShell ? 1f : 6f; int num1447 = 480; - if (npc.localAI[1] == 1f) + if (NPC.localAI[1] == 1f) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; if (Main.rand.NextBool(4)) { - npc.ai[0] = (float)num1447; + NPC.ai[0] = (float)num1447; } } - npc.TargetClosest(true); - npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.1f; - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); - Vector2 vector251 = Main.player[npc.target].Center - value53; - bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 180f : 360f) && Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] != 4f) + NPC.TargetClosest(true); + NPC.rotation = Math.Abs(NPC.velocity.X) * (float)NPC.direction * 0.1f; + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + Vector2 value53 = NPC.Center + new Vector2((float)(NPC.direction * 20), 6f); + Vector2 vector251 = Main.player[NPC.target].Center - value53; + bool flag104 = Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1); + NPC.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 180f : 360f) && Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] != 4f) { - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; float speed = 5f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y; + Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)(NPC.height / 2)); + float num6 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector.X; + float num7 = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - vector.Y; float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); num8 = speed / num8; num6 *= num8; num7 *= num8; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, Main.player[npc.target].Center.X, Main.player[npc.target].Center.Y); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.Center.X, NPC.Center.Y, num6, num7, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, Main.player[NPC.target].Center.X, Main.player[NPC.target].Center.Y); } if (vector251.Length() > 400f || !flag104) { @@ -131,49 +132,49 @@ namespace CalamityMod.NPCs.BrimstoneElemental value54 *= num1446; } int num1448 = 30; - npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; + NPC.velocity = (NPC.velocity * (float)(num1448 - 1) + value54) / (float)num1448; } else { - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; } - if (npc.ai[2] != 0f && npc.ai[3] != 0f) + if (NPC.ai[2] != 0f && NPC.ai[3] != 0f) { - Main.PlaySound(SoundID.Item8, npc.Center); + SoundEngine.PlaySound(SoundID.Item8, NPC.Center); for (int num1449 = 0; num1449 < 20; num1449++) { - int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, 0f, 100, Color.Transparent, 1f); + int num1450 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f); Dust dust = Main.dust[num1450]; dust.velocity *= 3f; Main.dust[num1450].noGravity = true; Main.dust[num1450].scale = 2.5f; } - npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); - npc.velocity = Vector2.Zero; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - if (npc.localAI[0] > 240f) //Lower firing cooldown to prevent firing so quickly after a teleport - npc.localAI[0] = 240f; - Main.PlaySound(SoundID.Item8, npc.Center); + NPC.Center = new Vector2(NPC.ai[2] * 16f, NPC.ai[3] * 16f); + NPC.velocity = Vector2.Zero; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + if (NPC.localAI[0] > 240f) //Lower firing cooldown to prevent firing so quickly after a teleport + NPC.localAI[0] = 240f; + SoundEngine.PlaySound(SoundID.Item8, NPC.Center); for (int num1451 = 0; num1451 < 20; num1451++) { - int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, 0f, 100, Color.Transparent, 1f); + int num1452 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f); Dust dust = Main.dust[num1452]; dust.velocity *= 3f; Main.dust[num1452].noGravity = true; Main.dust[num1452].scale = 2.5f; } } - npc.ai[0] += 1f; - if (npc.ai[0] >= (float)num1447 && Main.netMode != NetmodeID.MultiplayerClient) + NPC.ai[0] += 1f; + if (NPC.ai[0] >= (float)num1447 && Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.localAI[0] > 260f) + if (NPC.localAI[0] > 260f) { - npc.localAI[0] -= 60f; + NPC.localAI[0] -= 60f; } - npc.ai[0] = 0f; - Point point12 = npc.Center.ToTileCoordinates(); - Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); + NPC.ai[0] = 0f; + Point point12 = NPC.Center.ToTileCoordinates(); + Point point13 = Main.player[NPC.target].Center.ToTileCoordinates(); int num1453 = 20; int num1454 = 3; int num1455 = 10; @@ -202,45 +203,45 @@ namespace CalamityMod.NPCs.BrimstoneElemental } if (flag107) { - npc.ai[2] = (float)num1458; - npc.ai[3] = (float)num1459; + NPC.ai[2] = (float)num1458; + NPC.ai[3] = (float)num1459; break; } } } - npc.netUpdate = true; + NPC.netUpdate = true; } } public override void FindFrame(int frameHeight) { - npc.frameCounter += 1.0; + NPC.frameCounter += 1.0; if (!boostDR) { - if (npc.frameCounter > 12.0) + if (NPC.frameCounter > 12.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 4) + if (NPC.frame.Y >= frameHeight * 4) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } else { - if (npc.frameCounter > 12.0) + if (NPC.frameCounter > 12.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y < frameHeight * 4) + if (NPC.frame.Y < frameHeight * 4) { - npc.frame.Y = frameHeight * 4; + NPC.frame.Y = frameHeight * 4; } - if (npc.frame.Y >= frameHeight * 8) + if (NPC.frame.Y >= frameHeight * 8) { - npc.frame.Y = frameHeight * 4; + NPC.frame.Y = frameHeight * 4; } } } @@ -249,9 +250,9 @@ namespace CalamityMod.NPCs.BrimstoneElemental { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(4) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } } @@ -259,13 +260,13 @@ namespace CalamityMod.NPCs.BrimstoneElemental { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index cbcd64170c..f6ad328582 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -27,67 +27,67 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Elemental"); - Main.npcFrameCount[npc.type] = 12; + Main.npcFrameCount[NPC.type] = 12; } public override void SetDefaults() { - npc.npcSlots = 64f; - npc.GetNPCDamage(); - npc.width = 100; - npc.height = 150; - npc.defense = 15; - npc.value = Item.buyPrice(0, 40, 0, 0); - npc.LifeMaxNERB(41000, 49200, 780000); - npc.DR_NERD(0.15f); + NPC.npcSlots = 64f; + NPC.GetNPCDamage(); + NPC.width = 100; + NPC.height = 150; + NPC.defense = 15; + NPC.value = Item.buyPrice(0, 40, 0, 0); + NPC.LifeMaxNERB(41000, 49200, 780000); + NPC.DR_NERD(0.15f); if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.damage *= 3; - npc.defense *= 4; - npc.lifeMax *= 5; - npc.value *= 3f; + NPC.damage *= 3; + NPC.defense *= 4; + NPC.lifeMax *= 5; + NPC.value *= 3f; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.aiStyle = -1; aiType = -1; - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath39; + NPC.boss = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.netAlways = true; + NPC.HitSound = SoundID.NPCHit23; + NPC.DeathSound = SoundID.NPCDeath39; music = CalamityMod.Instance.GetMusicFromMusicMod("BrimstoneElemental") ?? MusicID.Boss4; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.chaseable); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[3]); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.chaseable = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityAI.BrimstoneElementalAI(npc, mod); + CalamityAI.BrimstoneElementalAI(NPC, Mod); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -97,49 +97,49 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void FindFrame(int frameHeight) // 9 total frames { - npc.frameCounter += 1.0; - if (npc.ai[0] <= 2f) + NPC.frameCounter += 1.0; + if (NPC.ai[0] <= 2f) { - if (npc.frameCounter > 12.0) + if (NPC.frameCounter > 12.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 4) + if (NPC.frame.Y >= frameHeight * 4) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } - else if (npc.ai[0] == 3f || npc.ai[0] == 5f) + else if (NPC.ai[0] == 3f || NPC.ai[0] == 5f) { - if (npc.frameCounter > 12.0) + if (NPC.frameCounter > 12.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y < frameHeight * 4) + if (NPC.frame.Y < frameHeight * 4) { - npc.frame.Y = frameHeight * 4; + NPC.frame.Y = frameHeight * 4; } - if (npc.frame.Y >= frameHeight * 8) + if (NPC.frame.Y >= frameHeight * 8) { - npc.frame.Y = frameHeight * 4; + NPC.frame.Y = frameHeight * 4; } } else { - if (npc.frameCounter > 12.0) + if (NPC.frameCounter > 12.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y < frameHeight * 8) + if (NPC.frame.Y < frameHeight * 8) { - npc.frame.Y = frameHeight * 8; + NPC.frame.Y = frameHeight * 8; } - if (npc.frame.Y >= frameHeight * 12) + if (NPC.frame.Y >= frameHeight * 12) { - npc.frame.Y = frameHeight * 8; + NPC.frame.Y = frameHeight * 8; } } } @@ -151,26 +151,26 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedBrimstoneElemental); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedBrimstoneElemental); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedBrimstoneElemental); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedBrimstoneElemental); CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Wizard }, CalamityWorld.downedBrimstoneElemental); if (!Main.expertMode) { //Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 4, 8); + DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 4, 8); if (CalamityWorld.downedProvidence) - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 20, 30, 2); + DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 20, 30, 2); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -178,16 +178,16 @@ namespace CalamityMod.NPCs.BrimstoneElemental ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); - DropHelper.DropItem(npc, ModContent.ItemType(), true); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // mark brimmy as dead CalamityWorld.downedBrimstoneElemental = true; @@ -196,27 +196,27 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 200; - npc.height = 150; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 200; + NPC.height = 150; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -226,17 +226,17 @@ namespace CalamityMod.NPCs.BrimstoneElemental } for (int num623 = 0; num623 < 60; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/BrimstoneGore1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/BrimstoneGore2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/BrimstoneGore3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/BrimstoneGore4"), 1f); } } } diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 075e731a6a..3b3a951203 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -27,8 +27,8 @@ namespace CalamityMod.NPCs.Bumblebirb public override void SetStaticDefaults() { DisplayName.SetDefault("The Dragonfolly"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; @@ -36,57 +36,57 @@ namespace CalamityMod.NPCs.Bumblebirb public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 32f; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 32f; + NPC.aiStyle = -1; aiType = -1; - npc.GetNPCDamage(); - npc.width = 130; - npc.height = 100; - npc.defense = 40; - npc.DR_NERD(0.1f); - npc.LifeMaxNERB(190200, 228240, 300000); // Old HP - 227500, 252500 + NPC.GetNPCDamage(); + NPC.width = 130; + NPC.height = 100; + NPC.defense = 40; + NPC.DR_NERD(0.1f); + NPC.LifeMaxNERB(190200, 228240, 300000); // Old HP - 227500, 252500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.boss = true; - npc.noTileCollide = true; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.boss = true; + NPC.noTileCollide = true; music = CalamityMod.Instance.GetMusicFromMusicMod("Dragonfolly") ?? MusicID.Boss4; - npc.lavaImmune = true; - npc.noGravity = true; - npc.value = Item.buyPrice(1, 25, 0, 0); - npc.HitSound = SoundID.NPCHit51; - npc.DeathSound = SoundID.NPCDeath46; + NPC.lavaImmune = true; + NPC.noGravity = true; + NPC.value = Item.buyPrice(1, 25, 0, 0); + NPC.HitSound = SoundID.NPCHit51; + NPC.DeathSound = SoundID.NPCDeath46; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityAI.BumblebirbAI(npc, mod); + CalamityAI.BumblebirbAI(NPC, Mod); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -97,18 +97,18 @@ namespace CalamityMod.NPCs.Bumblebirb public override void FindFrame(int frameHeight) { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Phases bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f); - bool birbSpawn = npc.ai[0] == 4f && npc.ai[1] > 0f; + bool birbSpawn = NPC.ai[0] == 4f && NPC.ai[1] > 0f; float newPhaseTimer = 180f; bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || @@ -116,79 +116,79 @@ namespace CalamityMod.NPCs.Bumblebirb if (phaseSwitchPhase || birbSpawn) { - float frameGateValue = birbSpawn ? npc.ai[1] : phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]; + float frameGateValue = birbSpawn ? NPC.ai[1] : phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]; int num116 = 180; if (frameGateValue < (num116 - 60) || frameGateValue > (num116 - 20)) { - npc.frameCounter += 1D; - if (npc.frameCounter > 5D) + NPC.frameCounter += 1D; + if (NPC.frameCounter > 5D) { - npc.frameCounter = 0D; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y >= frameHeight * 5) + if (NPC.frame.Y >= frameHeight * 5) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } else { - npc.frame.Y = frameHeight * 4; + NPC.frame.Y = frameHeight * 4; if (frameGateValue > (num116 - 50) && frameGateValue < (num116 - 25)) { - npc.frame.Y = frameHeight * 5; + NPC.frame.Y = frameHeight * 5; } } } - else if (npc.ai[0] == 5f) + else if (NPC.ai[0] == 5f) { int num115 = 120; - if (npc.ai[1] < (num115 - 50) || npc.ai[1] > (num115 - 10)) + if (NPC.ai[1] < (num115 - 50) || NPC.ai[1] > (num115 - 10)) { - npc.frameCounter += 1D; - if (npc.frameCounter > 5D) + NPC.frameCounter += 1D; + if (NPC.frameCounter > 5D) { - npc.frameCounter = 0D; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y >= frameHeight * 5) + if (NPC.frame.Y >= frameHeight * 5) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } else { - npc.frame.Y = frameHeight * 4; - if (npc.ai[1] > (num115 - 40) && npc.ai[1] < (num115 - 15)) + NPC.frame.Y = frameHeight * 4; + if (NPC.ai[1] > (num115 - 40) && NPC.ai[1] < (num115 - 15)) { - npc.frame.Y = frameHeight * 5; + NPC.frame.Y = frameHeight * 5; } } } else { - npc.frameCounter += (npc.ai[0] == 3.2f ? 1.5 : 1D); - if (npc.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base + NPC.frameCounter += (NPC.ai[0] == 3.2f ? 1.5 : 1D); + if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base { - npc.frameCounter = 0D; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y >= frameHeight * 5) + if (NPC.frame.Y >= frameHeight * 5) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Phases bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; @@ -199,11 +199,11 @@ namespace CalamityMod.NPCs.Bumblebirb (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Color color = lightColor; Color color36 = Color.White; @@ -228,15 +228,15 @@ namespace CalamityMod.NPCs.Bumblebirb int num153 = 10; int num154 = 2; - if (npc.ai[0] == 0f || npc.ai[0] == 3.1f || npc.ai[0] == 4f || npc.ai[0] == 4.2f) + if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f) { num153 = 4; } - if (npc.ai[0] == 1f || npc.ai[0] == 3f || npc.ai[0] == 4.1f) + if (NPC.ai[0] == 1f || NPC.ai[0] == 3f || NPC.ai[0] == 4.1f) { num153 = 7; } - if (npc.ai[0] == 2f || npc.ai[0] == 3.2f || (phase2 && calamityGlobalNPC.newAI[2] == 1f)) + if (NPC.ai[0] == 2f || NPC.ai[0] == 3.2f || (phase2 && calamityGlobalNPC.newAI[2] == 1f)) { color36 = Color.Yellow; amount9 = 0.5f; @@ -252,12 +252,12 @@ namespace CalamityMod.NPCs.Bumblebirb { Color color38 = color; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } @@ -265,19 +265,19 @@ namespace CalamityMod.NPCs.Bumblebirb float num157 = 0f; float scaleFactor9 = 0f; - if (npc.ai[0] == 0f || npc.ai[0] == 3.1f || npc.ai[0] == 4f || npc.ai[0] == 4.2f) + if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f) { num156 = 4; } - if (npc.ai[0] == 5f) + if (NPC.ai[0] == 5f) { int num158 = 60; int num159 = 30; - if (npc.ai[1] > (float)num158) + if (NPC.ai[1] > (float)num158) { num156 = 6; - num157 = 1f - (float)Math.Cos((double)((npc.ai[1] - (float)num158) / (float)num159 * MathHelper.TwoPi)); + num157 = 1f - (float)Math.Cos((double)((NPC.ai[1] - (float)num158) / (float)num159 * MathHelper.TwoPi)); num157 /= 3f; scaleFactor9 = 40f; } @@ -307,26 +307,26 @@ namespace CalamityMod.NPCs.Bumblebirb { Color color39 = lightColor; color39 = Color.Lerp(color39, color36, amount9); - color39 = npc.GetAlpha(color39); + color39 = NPC.GetAlpha(color39); color39 *= 1f - num157; - Vector2 vector42 = npc.Center + ((float)num160 / (float)num156 * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; - vector42 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector42 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector42, npc.frame, color39, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector42 = NPC.Center + ((float)num160 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; + vector42 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector42 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector42, NPC.frame, color39, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } Color color2 = lightColor; color2 = Color.Lerp(color2, color36, amount9); - color2 = npc.GetAlpha(color2); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? color2 : npc.GetAlpha(lightColor)), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + color2 = NPC.GetAlpha(color2); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? color2 : NPC.GetAlpha(lightColor)), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); if (phase2) { - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Bumblebirb/BirbGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow"); Color color40 = Color.Lerp(Color.White, Color.Red, 0.5f); color36 = Color.Red; @@ -350,26 +350,26 @@ namespace CalamityMod.NPCs.Bumblebirb Color color41 = color40; color41 = Color.Lerp(color41, color36, amount9); color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } for (int num164 = 1; num164 < num156; num164++) { Color color42 = color40; color42 = Color.Lerp(color42, color36, amount9); - color42 = npc.GetAlpha(color42); + color42 = NPC.GetAlpha(color42); color42 *= 1f - num157; - Vector2 vector45 = npc.Center + ((float)num164 / (float)num156 * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; - vector45 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector45 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector45, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector45 = NPC.Center + ((float)num164 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; + vector45 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector45 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector45, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color40, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color40, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } return false; @@ -392,22 +392,22 @@ namespace CalamityMod.NPCs.Bumblebirb public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedBumble); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedBumble); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { // Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 11, 17); + DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 11, 17); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -415,13 +415,13 @@ namespace CalamityMod.NPCs.Bumblebirb ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // Mark The Dragonfolly as dead CalamityWorld.downedBumble = true; @@ -430,28 +430,28 @@ namespace CalamityMod.NPCs.Bumblebirb public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 244, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 244, hitDirection, -1f, 0, default, 1f); } for (int i = 0; i < 6; i++) // 1 head, 1 wing, 4 legs = 6. one wing due to them being chonky boyes now { string gore = "Gores/Bumble"; float randomSpread = Main.rand.Next(-200, 201) / 100f; gore += i == 0 ? "Head" : i > 1 ? "Leg" : "Wing"; - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot(gore), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot(gore), 1f); } } } diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index 5e8f210141..cba6f8e653 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -12,37 +12,37 @@ namespace CalamityMod.NPCs.Bumblebirb public override void SetStaticDefaults() { DisplayName.SetDefault("Draconic Swarmer"); - Main.npcFrameCount[npc.type] = 5; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 5; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly"; public override void SetDefaults() { - npc.npcSlots = 1f; - npc.aiStyle = -1; + NPC.npcSlots = 1f; + NPC.aiStyle = -1; aiType = -1; - npc.GetNPCDamage(); - npc.width = 120; - npc.height = 80; - npc.defense = 20; - npc.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000 - npc.knockBackResist = 0f; - npc.lavaImmune = true; - npc.noTileCollide = true; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit51; - npc.DeathSound = SoundID.NPCDeath46; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.GetNPCDamage(); + NPC.width = 120; + NPC.height = 80; + NPC.defense = 20; + NPC.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000 + NPC.knockBackResist = 0f; + NPC.lavaImmune = true; + NPC.noTileCollide = true; + NPC.noGravity = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit51; + NPC.DeathSound = SoundID.NPCDeath46; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedMoonlord || spawnInfo.player.Calamity().ZoneSunkenSea || NPC.AnyNPCs(npc.type)) + if (spawnInfo.playerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneSunkenSea || NPC.AnyNPCs(NPC.type)) { return 0f; } @@ -51,45 +51,45 @@ namespace CalamityMod.NPCs.Bumblebirb public override void AI() { - CalamityAI.Bumblebirb2AI(npc, mod, true); + CalamityAI.Bumblebirb2AI(NPC, Mod, true); } public override bool PreNPCLoot() { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(4) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } return false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += npc.ai[0] == 2.1f ? 1.5 : 1D; - if (npc.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base + NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D; + if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base { - npc.frameCounter = 0D; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y >= frameHeight * 4) + if (NPC.frame.Y >= frameHeight * 4) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); Color color36 = Color.Gold; float amount9 = 0.5f; - int num153 = npc.ai[0] == 2.1f ? 7 : 0; + int num153 = NPC.ai[0] == 2.1f ? 7 : 0; if (CalamityConfig.Instance.Afterimages) { @@ -97,19 +97,19 @@ namespace CalamityMod.NPCs.Bumblebirb { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -124,13 +124,13 @@ namespace CalamityMod.NPCs.Bumblebirb { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 244, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 244, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs index 3a44016281..32c8a739d9 100644 --- a/NPCs/Calamitas/CalamitasRun.cs +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -19,78 +19,78 @@ namespace CalamityMod.NPCs.Calamitas public override void SetStaticDefaults() { DisplayName.SetDefault("Cataclysm"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 120; - npc.height = 120; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 120; + NPC.height = 120; if (CalamityWorld.death || BossRushEvent.BossRushActive) - npc.scale = 1.2f; + NPC.scale = 1.2f; - npc.defense = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 15 : 10; - npc.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.225f : 0.15f); - npc.LifeMaxNERB(11000, 13200, 80000); + NPC.defense = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 15 : 10; + NPC.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.225f : 0.15f); + NPC.LifeMaxNERB(11000, 13200, 80000); if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.damage *= 3; - npc.defense *= 5; - npc.lifeMax *= 5; + NPC.damage *= 3; + NPC.defense *= 5; + NPC.lifeMax *= 5; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; music = CalamityMod.Instance.GetMusicFromMusicMod("Calamitas") ?? MusicID.Boss2; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) { for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - CalamityAI.CataclysmAI(npc, mod); + CalamityAI.CataclysmAI(NPC, Mod); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 7; @@ -101,21 +101,21 @@ namespace CalamityMod.NPCs.Calamitas { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Calamitas/CalamitasRunGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Calamitas/CalamitasRunGlow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -125,21 +125,21 @@ namespace CalamityMod.NPCs.Calamitas Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } public override bool CheckActive() { - return npc.Calamity().newAI[0] == 1f; + return NPC.Calamity().newAI[0] == 1f; } public override void NPCLoot() @@ -148,36 +148,36 @@ namespace CalamityMod.NPCs.Calamitas { int heartAmt = Main.rand.Next(3) + 3; for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), Main.expertMode ? 4 : 5); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), Main.expertMode ? 4 : 5); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm3"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm4"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm5"), npc.scale); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm3"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm4"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm5"), NPC.scale); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 100; + NPC.height = 100; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -187,10 +187,10 @@ namespace CalamityMod.NPCs.Calamitas } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs index 782256fa6b..f368af6ef0 100644 --- a/NPCs/Calamitas/CalamitasRun2.cs +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -19,78 +19,78 @@ namespace CalamityMod.NPCs.Calamitas public override void SetStaticDefaults() { DisplayName.SetDefault("Catastrophe"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 120; - npc.height = 120; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 120; + NPC.height = 120; if (CalamityWorld.death || BossRushEvent.BossRushActive) - npc.scale = 1.2f; + NPC.scale = 1.2f; - npc.defense = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 15 : 10; - npc.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.225f : 0.15f); - npc.LifeMaxNERB(9200, 11025, 80000); + NPC.defense = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 15 : 10; + NPC.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.225f : 0.15f); + NPC.LifeMaxNERB(9200, 11025, 80000); if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.damage *= 3; - npc.defense *= 5; - npc.lifeMax *= 5; + NPC.damage *= 3; + NPC.defense *= 5; + NPC.lifeMax *= 5; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; music = CalamityMod.Instance.GetMusicFromMusicMod("Calamitas") ?? MusicID.Boss2; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) { for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - CalamityAI.CatastropheAI(npc, mod); + CalamityAI.CatastropheAI(NPC, Mod); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 7; @@ -101,21 +101,21 @@ namespace CalamityMod.NPCs.Calamitas { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Calamitas/CalamitasRun2Glow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Calamitas/CalamitasRun2Glow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -125,21 +125,21 @@ namespace CalamityMod.NPCs.Calamitas Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } public override bool CheckActive() { - return npc.Calamity().newAI[0] == 1f; + return NPC.Calamity().newAI[0] == 1f; } public override void NPCLoot() @@ -148,35 +148,35 @@ namespace CalamityMod.NPCs.Calamitas { int heartAmt = Main.rand.Next(3) + 3; for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), Main.expertMode ? 4 : 5); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe3"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe4"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe5"), npc.scale); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe3"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe4"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe5"), NPC.scale); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 100; + NPC.height = 100; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -186,10 +186,10 @@ namespace CalamityMod.NPCs.Calamitas } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index c51b061c11..ec3cbede44 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -19,6 +19,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Calamitas { @@ -28,92 +29,92 @@ namespace CalamityMod.NPCs.Calamitas public override void SetStaticDefaults() { DisplayName.SetDefault("Calamitas"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 14f; - npc.width = 120; - npc.height = 120; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 14f; + NPC.width = 120; + NPC.height = 120; if (CalamityWorld.death || BossRushEvent.BossRushActive) - npc.scale = 0.8f; + NPC.scale = 0.8f; - npc.defense = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 12 : 25; - npc.value = Item.buyPrice(0, 50, 0, 0); - npc.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.075f : 0.15f); - npc.LifeMaxNERB(37500, 45000, 520000); + NPC.defense = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 12 : 25; + NPC.value = Item.buyPrice(0, 50, 0, 0); + NPC.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.075f : 0.15f); + NPC.LifeMaxNERB(37500, 45000, 520000); if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.damage *= 3; - npc.defense *= 3; - npc.lifeMax *= 2; - npc.value *= 2.5f; + NPC.damage *= 3; + NPC.defense *= 3; + NPC.lifeMax *= 2; + NPC.value *= 2.5f; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; + NPC.knockBackResist = 0f; + NPC.boss = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; music = CalamityMod.Instance.GetMusicFromMusicMod("Calamitas") ?? MusicID.Boss2; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - CalamityAI.CalamitasCloneAI(npc, mod); + CalamityAI.CalamitasCloneAI(NPC, Mod); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture = Main.npcTexture[NPC.type]; + Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[NPC.type] / 2)); Color white = Color.White; float colorLerpAmt = 0.5f; int afterimageAmt = 7; @@ -124,21 +125,21 @@ namespace CalamityMod.NPCs.Calamitas { Color color1 = lightColor; color1 = Color.Lerp(color1, white, colorLerpAmt); - color1 = npc.GetAlpha(color1); + color1 = NPC.GetAlpha(color1); color1 *= (float)(afterimageAmt - i) / 15f; - Vector2 offset = npc.oldPos[i] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - offset += origin * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, offset, npc.frame, color1, npc.rotation, origin, npc.scale, spriteEffects, 0f); + Vector2 offset = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + offset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, offset, NPC.frame, color1, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } } - Vector2 npcOffset = npc.Center - Main.screenPosition; - npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - npcOffset += origin * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, npcOffset, npc.frame, npc.GetAlpha(lightColor), npc.rotation, origin, npc.scale, spriteEffects, 0f); + Vector2 npcOffset = NPC.Center - Main.screenPosition; + npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.GetTexture("CalamityMod/NPCs/Calamitas/CalamitasRun3Glow"); + texture = ModContent.Request("CalamityMod/NPCs/Calamitas/CalamitasRun3Glow"); Color color = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -148,41 +149,41 @@ namespace CalamityMod.NPCs.Calamitas Color color2 = color; color2 = Color.Lerp(color2, white, colorLerpAmt); color2 *= (float)(afterimageAmt - i) / 15f; - Vector2 offset = npc.oldPos[i] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - offset += origin * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, offset, npc.frame, color2, npc.rotation, origin, npc.scale, spriteEffects, 0f); + Vector2 offset = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + offset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, offset, NPC.frame, color2, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture, npcOffset, npc.frame, color, npc.rotation, origin, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, npcOffset, NPC.frame, color, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); return false; } public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItem(npc, ItemID.BrokenHeroSword, true); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !CalamityWorld.downedCalamitas); + DropHelper.DropItem(NPC, ItemID.BrokenHeroSword, true); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !CalamityWorld.downedCalamitas); CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedCalamitas); if (!Main.expertMode) { //Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 4, 8); - DropHelper.DropItem(npc, ModContent.ItemType(), 9, 14); - DropHelper.DropItem(npc, ModContent.ItemType(), 1, 2); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 1f, 30, 40); + DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 4, 8); + DropHelper.DropItem(NPC, ModContent.ItemType(), 9, 14); + DropHelper.DropItem(NPC, ModContent.ItemType(), 1, 2); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 1f, 30, 40); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -191,18 +192,18 @@ namespace CalamityMod.NPCs.Calamitas ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); if (Main.rand.NextBool(10)) { - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); } } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // Abyss awakens after killing Calamitas string key = "Mods.CalamityMod.PlantBossText"; @@ -211,7 +212,7 @@ namespace CalamityMod.NPCs.Calamitas if (!CalamityWorld.downedCalamitas) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); CalamityUtils.DisplayLocalizedText(key, messageColor); } @@ -231,25 +232,25 @@ namespace CalamityMod.NPCs.Calamitas { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas3"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas4"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas5"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas6"), npc.scale); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Calamitas"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Calamitas2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Calamitas3"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Calamitas4"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Calamitas5"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/Calamitas6"), NPC.scale); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 100; + NPC.height = 100; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -259,10 +260,10 @@ namespace CalamityMod.NPCs.Calamitas } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -270,8 +271,8 @@ namespace CalamityMod.NPCs.Calamitas public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs index 4ae7c25032..38a0ca34f6 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -19,53 +19,53 @@ namespace CalamityMod.NPCs.Calamitas public override void SetStaticDefaults() { DisplayName.SetDefault("Soul Seeker"); - Main.npcFrameCount[npc.type] = 5; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 5; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.width = 40; - npc.height = 40; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.damage = 40; - npc.defense = 10; - npc.DR_NERD(0.1f); - npc.lifeMax = CalamityWorld.death ? 1500 : 2500; + NPC.width = 40; + NPC.height = 40; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.damage = 40; + NPC.defense = 10; + NPC.DR_NERD(0.1f); + NPC.lifeMax = CalamityWorld.death ? 1500 : 2500; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 15000; + NPC.lifeMax = 15000; } - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override bool PreAI() { // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - npc.damage = 0; + NPC.damage = 0; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return false; } @@ -74,18 +74,18 @@ namespace CalamityMod.NPCs.Calamitas { for (int d = 0; d < 15; d++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); } - npc.ai[1] = npc.ai[0]; + NPC.ai[1] = NPC.ai[0]; start = false; } - npc.TargetClosest(); + NPC.TargetClosest(); - Vector2 velocity = Main.player[npc.target].Center - npc.Center; + Vector2 velocity = Main.player[NPC.target].Center - NPC.Center; velocity.Normalize(); velocity *= 9f; - npc.rotation = velocity.ToRotation() + MathHelper.Pi; + NPC.rotation = velocity.ToRotation() + MathHelper.Pi; timer++; if (timer >= 180) @@ -93,21 +93,21 @@ namespace CalamityMod.NPCs.Calamitas if (Main.netMode != NetmodeID.MultiplayerClient && parent.ai[1] < 2f && parent.Calamity().newAI[2] <= 0f) { for (int d = 0; d < 3; d++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center, velocity, type, damage, 1f, npc.target, 1f, 0f); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.Center, velocity, type, damage, 1f, NPC.target, 1f, 0f); } timer = 0; } - double deg = npc.ai[1]; + double deg = NPC.ai[1]; double rad = deg * (Math.PI / 180); double dist = death ? 180 : 150; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += death ? 0.5f : 2f; + NPC.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - NPC.width / 2; + NPC.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - NPC.height / 2; + NPC.ai[1] += death ? 0.5f : 2f; return false; } @@ -115,19 +115,19 @@ namespace CalamityMod.NPCs.Calamitas { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSeeker"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSeeker2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSeeker3"), 1f); - npc.position = npc.Center; - npc.width = npc.height = 50; - npc.Center = npc.position; + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/SoulSeeker"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/SoulSeeker2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CalamitasGores/SoulSeeker3"), 1f); + NPC.position = NPC.Center; + NPC.width = NPC.height = 50; + NPC.Center = NPC.position; for (int d = 0; d < 20; d++) { - int red = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int red = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[red].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -137,10 +137,10 @@ namespace CalamityMod.NPCs.Calamitas } for (int d = 0; d < 40; d++) { - int red = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int red = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[red].noGravity = true; Main.dust[red].velocity *= 5f; - red = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + red = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[red].velocity *= 2f; } } @@ -150,9 +150,9 @@ namespace CalamityMod.NPCs.Calamitas { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(4) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } } @@ -161,11 +161,11 @@ namespace CalamityMod.NPCs.Calamitas public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / Main.npcFrameCount[npc.type] / 2f); + Texture2D texture = Main.npcTexture[NPC.type]; + Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / Main.npcFrameCount[NPC.type] / 2f); Color white = Color.White; float colorLerpAmt = 0.5f; int afterImageAmt = 5; @@ -176,21 +176,21 @@ namespace CalamityMod.NPCs.Calamitas { Color afterImageColor = lightColor; afterImageColor = Color.Lerp(afterImageColor, white, colorLerpAmt); - afterImageColor = npc.GetAlpha(afterImageColor); + afterImageColor = NPC.GetAlpha(afterImageColor); afterImageColor *= (afterImageAmt - a) / 15f; - Vector2 afterimagePos = npc.oldPos[a] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - afterimagePos += origin * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimagePos, npc.frame, afterImageColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + Vector2 afterimagePos = NPC.oldPos[a] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, afterimagePos, NPC.frame, afterImageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } } - Vector2 drawPos = npc.Center - Main.screenPosition; - drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - drawPos += origin * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, drawPos, npc.frame, npc.GetAlpha(lightColor), npc.rotation, origin, npc.scale, spriteEffects, 0f); + Vector2 drawPos = NPC.Center - Main.screenPosition; + drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, drawPos, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.GetTexture("CalamityMod/NPCs/Calamitas/SoulSeekerGlow"); + texture = ModContent.Request("CalamityMod/NPCs/Calamitas/SoulSeekerGlow"); Color glow = Color.Lerp(Color.White, Color.Red, colorLerpAmt); if (CalamityConfig.Instance.Afterimages) @@ -200,14 +200,14 @@ namespace CalamityMod.NPCs.Calamitas Color glowColor = glow; glowColor = Color.Lerp(glowColor, white, colorLerpAmt); glowColor *= (afterImageAmt - a) / 15f; - Vector2 afterimagePos = npc.oldPos[a] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - afterimagePos += origin * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimagePos, npc.frame, glowColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + Vector2 afterimagePos = NPC.oldPos[a] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimagePos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, afterimagePos, NPC.frame, glowColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture, drawPos, npc.frame, white, npc.rotation, origin, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawPos, NPC.frame, white, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 00eda7a84d..7116a24524 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -25,6 +25,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs { @@ -128,7 +129,7 @@ namespace CalamityMod.NPCs float barfDivisor = malice ? 30f : expertMode ? 40f : 60f; if (calamityGlobalNPC.newAI[3] % barfDivisor == 0f) { - Main.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 13); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 13); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -267,7 +268,7 @@ namespace CalamityMod.NPCs { npc.localAI[0] = 0f; npc.netUpdate = true; - Main.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 13); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 13); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -324,7 +325,7 @@ namespace CalamityMod.NPCs npc.TargetClosest(); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 17); + SoundEngine.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 17); Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); float num942 = player.position.X + player.width * 0.5f - vector104.X; float num943 = player.position.Y + player.height * 0.5f - vector104.Y; @@ -898,7 +899,7 @@ namespace CalamityMod.NPCs { NPC.NewNPC((int)vectorCenter.X, (int)vectorCenter.Y, ModContent.NPCType()); } - Main.PlaySound(SoundID.Item8, vectorCenter); + SoundEngine.PlaySound(SoundID.Item8, vectorCenter); npc.alpha = 255; npc.position = position; for (int n = 0; n < 15; n++) @@ -1165,7 +1166,7 @@ namespace CalamityMod.NPCs { if (npc.ai[1] == 180f) { - Main.PlaySound(SoundID.Item68, source); + SoundEngine.PlaySound(SoundID.Item68, source); Vector2 laserVelocity2 = new Vector2(npc.localAI[0], npc.localAI[1]); laserVelocity2.Normalize(); int type = ModContent.ProjectileType(); @@ -1197,7 +1198,7 @@ namespace CalamityMod.NPCs } if (npc.ai[1] % playSoundTimer == 0f) - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 20); + SoundEngine.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 20); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1258,7 +1259,7 @@ namespace CalamityMod.NPCs { if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 74); + SoundEngine.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 74); int seekerAmt = death ? 10 : 5; int seekerSpread = 360 / seekerAmt; int seekerDistance = death ? 180 : 150; @@ -1291,7 +1292,7 @@ namespace CalamityMod.NPCs calamityGlobalNPC.newAI[0] = npc.life; if (calamityGlobalNPC.newAI[0] <= (float)npc.lifeMax * 0.1) { - Main.PlaySound(SoundID.Item109, npc.Center); + SoundEngine.PlaySound(SoundID.Item109, npc.Center); calamityGlobalNPC.newAI[2] = 2f; SpawnDust(); } @@ -1308,7 +1309,7 @@ namespace CalamityMod.NPCs } else { - Main.PlaySound(SoundID.Item109, npc.Center); + SoundEngine.PlaySound(SoundID.Item109, npc.Center); calamityGlobalNPC.newAI[2] = 1f; SpawnDust(); } @@ -2059,7 +2060,7 @@ namespace CalamityMod.NPCs if (npc.localAI[2] > 22f) { npc.localAI[2] = 0f; - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 34); + SoundEngine.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 34); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -2095,7 +2096,7 @@ namespace CalamityMod.NPCs { if (npc.ai[1] == 1f) { - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0); npc.rotation = num842; float num870 = 14f + (death ? 4f * (1f - lifeRatio) : 0f); @@ -2340,7 +2341,7 @@ namespace CalamityMod.NPCs if (npc.localAI[2] > 36f) { npc.localAI[2] = 0f; - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 34); + SoundEngine.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 34); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -2376,7 +2377,7 @@ namespace CalamityMod.NPCs { if (npc.ai[1] == 1f) { - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0); npc.rotation = num842; float num870 = (NPC.AnyNPCs(ModContent.NPCType()) ? 12f : 16f) + (death ? 4f * (1f - lifeRatio) : 0f); @@ -2538,7 +2539,7 @@ namespace CalamityMod.NPCs if (npc.ai[0] >= 5f && npc.ai[0] != 7) { npc.localAI[0] = 0f; - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 109); + SoundEngine.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 109); float velocity = death ? (8f + npc.localAI[2] * 0.025f) : 7f; int type = ModContent.ProjectileType(); @@ -2562,7 +2563,7 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 2f) { npc.localAI[0] = 0f; - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 33); + SoundEngine.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 33); float num179 = death ? 20f : 18.5f; int maxProjectiles = malice ? 8 : death ? 6 : 4; @@ -2809,7 +2810,7 @@ namespace CalamityMod.NPCs if (npc.velocity.Y == 0f) { // Play stomp sound - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LegStomp"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LegStomp"), (int)npc.position.X, (int)npc.position.Y); // Stomp and jump again, if stomped twice then reset and set AI to next phase (Teleport or Idle) npc.TargetClosest(); @@ -2843,7 +2844,7 @@ namespace CalamityMod.NPCs } // Fire lasers on stomp - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 33); + SoundEngine.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 33); if (Main.netMode != NetmodeID.MultiplayerClient) { float num179 = death ? 20f : 18.5f; @@ -3050,7 +3051,7 @@ namespace CalamityMod.NPCs if (npc.soundDelay == 0) { npc.soundDelay = 15; - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 109); + SoundEngine.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 109); } // Emit dust to make the teleport pretty @@ -3101,7 +3102,7 @@ namespace CalamityMod.NPCs if (npc.soundDelay == 0) { npc.soundDelay = 15; - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 109); + SoundEngine.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 109); } // Emit dust to make the teleport pretty @@ -3220,7 +3221,7 @@ namespace CalamityMod.NPCs { if (calamityGlobalNPC.newAI[0] != 3f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstrumDeusSplit"), player.Center); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstrumDeusSplit"), player.Center); calamityGlobalNPC.newAI[0] = 3f; npc.defense = 12; calamityGlobalNPC.DR = 0.075f; @@ -3337,7 +3338,7 @@ namespace CalamityMod.NPCs netMessage.Send(); } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstrumDeusSplit"), player.Center); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstrumDeusSplit"), player.Center); } return; } @@ -3476,7 +3477,7 @@ namespace CalamityMod.NPCs { for (int l = num14; l < num15; l++) { - if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[Main.tile[k, l].type] || (Main.tileSolidTop[Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) + if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].liquid > 64)) { Vector2 vector2; vector2.X = k * 16; @@ -3790,7 +3791,7 @@ namespace CalamityMod.NPCs if (Vector2.Distance(player.Center, npc.Center) > 80f) { - Main.PlaySound((phase2 || deathModeEnragePhase_BodyAndTail) ? SoundID.Item91 : SoundID.Item12, npc.Center); + SoundEngine.PlaySound((phase2 || deathModeEnragePhase_BodyAndTail) ? SoundID.Item91 : SoundID.Item12, npc.Center); float num941 = (death ? 16f : revenge ? 14f : 13f) + enrageScale * 4f; Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); float num942 = player.position.X + player.width * 0.5f - vector104.X; @@ -4239,7 +4240,7 @@ namespace CalamityMod.NPCs int succPhaseGateValue = (int)(totalDarkEnergyMaxHP * 0.2); if (totalDarkEnergyHP < succPhaseGateValue) { - Main.PlaySound(SoundID.NPCDeath44, vector); + SoundEngine.PlaySound(SoundID.NPCDeath44, vector); // Kill all Dark Energies for (int i = 0; i < Main.maxNPCs; i++) @@ -4588,7 +4589,7 @@ namespace CalamityMod.NPCs // Sound if (calamityGlobalNPC.newAI[1] == newPhaseTimer - 60f) { - SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_BetsyScream, (int)npc.position.X, (int)npc.position.Y); + SoundEffectInstance sound = SoundEngine.PlaySound(SoundID.DD2_BetsyScream, (int)npc.position.X, (int)npc.position.Y); if (sound != null) { sound.Pitch = 0.25f; @@ -4614,7 +4615,7 @@ namespace CalamityMod.NPCs // Sound if (calamityGlobalNPC.newAI[0] == newPhaseTimer - 60f) { - SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_BetsyScream, (int)npc.position.X, (int)npc.position.Y); + SoundEffectInstance sound = SoundEngine.PlaySound(SoundID.DD2_BetsyScream, (int)npc.position.X, (int)npc.position.Y); if (sound != null) { sound.Pitch = 0.25f; @@ -4762,7 +4763,7 @@ namespace CalamityMod.NPCs if (phase2 && npc.ai[3] == 0f) { npc.ai[3] = 3f; - Main.PlaySound(SoundID.Item102, (int)player.position.X, (int)player.position.Y); + SoundEngine.PlaySound(SoundID.Item102, (int)player.position.X, (int)player.position.Y); int totalProjectiles = 40; float radians = MathHelper.TwoPi / totalProjectiles; int distance = 800; @@ -4811,7 +4812,7 @@ namespace CalamityMod.NPCs if (npc.ai[3] == 0f) { npc.ai[3] = 3f; - Main.PlaySound(SoundID.Item102, (int)player.position.X, (int)player.position.Y); + SoundEngine.PlaySound(SoundID.Item102, (int)player.position.X, (int)player.position.Y); int totalProjectiles = phase2 ? 40 : 48; float radians = MathHelper.TwoPi / totalProjectiles; int distance = phase2 ? 1200 : 1320; @@ -5073,7 +5074,7 @@ namespace CalamityMod.NPCs // Sound if (npc.ai[1] == birbSpawnPhaseTimer - 60f) { - SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_BetsyScream, (int)npc.position.X, (int)npc.position.Y); + SoundEffectInstance sound = SoundEngine.PlaySound(SoundID.DD2_BetsyScream, (int)npc.position.X, (int)npc.position.Y); if (sound != null) { sound.Pitch = 0.25f; @@ -5116,7 +5117,7 @@ namespace CalamityMod.NPCs float aiGateValue = 120f; if (npc.ai[1] == aiGateValue - 30f) { - Main.PlaySound(SoundID.DD2_BetsyFireballShot, (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -5522,7 +5523,7 @@ namespace CalamityMod.NPCs // Play tired sound if (calamityGlobalNPC.newAI[0] % 60f == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeHuff"), player.Center); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeHuff"), player.Center); calamityGlobalNPC.newAI[0] -= malice ? 1.5f : 1f; if (calamityGlobalNPC.newAI[0] <= 0f) @@ -5723,7 +5724,7 @@ namespace CalamityMod.NPCs Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); } npc.ai[2] += 1f; @@ -5888,12 +5889,12 @@ namespace CalamityMod.NPCs // Play sounds and spawn Tooth Balls if (npc.ai[2] == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); if (npc.ai[2] % toothBallBelchPhaseDivisor == 0f) { if (npc.ai[2] % 40f == 0f && npc.ai[2] != 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -5933,7 +5934,7 @@ namespace CalamityMod.NPCs // Play sound and spawn sharks if (npc.ai[2] == num9 - 30) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); if (npc.ai[2] >= num9 - 90) { @@ -5967,7 +5968,7 @@ namespace CalamityMod.NPCs // Sound if (npc.ai[2] == num10 - 60) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); if (npc.ai[2] >= num10 - 60) { @@ -6152,7 +6153,7 @@ namespace CalamityMod.NPCs // Play sounds and spawn Tooth Balls and a Vortex if (npc.ai[2] == 0f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); @@ -6166,7 +6167,7 @@ namespace CalamityMod.NPCs if (npc.ai[2] % toothBallSpinPhaseDivisor == 0f) { if (npc.ai[2] % 45f == 0f && npc.ai[2] != 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -6205,7 +6206,7 @@ namespace CalamityMod.NPCs // Play sound if (npc.ai[2] == num9 - 30) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -6254,7 +6255,7 @@ namespace CalamityMod.NPCs // Sound if (npc.ai[2] == num10 - 60) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); if (npc.ai[2] >= num10 - 60) { @@ -6462,7 +6463,7 @@ namespace CalamityMod.NPCs // Play sound if (npc.ai[2] == num12 / 2) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num12 / 2) { @@ -6517,7 +6518,7 @@ namespace CalamityMod.NPCs // Play sound if (npc.ai[2] == num9 - 30) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -6563,7 +6564,7 @@ namespace CalamityMod.NPCs // Play sounds and spawn Tooth Balls and a Vortex if (npc.ai[2] == 0f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); @@ -6577,7 +6578,7 @@ namespace CalamityMod.NPCs if (npc.ai[2] % toothBallSpinPhaseDivisor == 0f) { if (npc.ai[2] % 45f == 0f && npc.ai[2] != 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -7043,7 +7044,7 @@ namespace CalamityMod.NPCs { if (npc.ai[1] == 180f) { - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 104); + SoundEngine.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 104); Vector2 laserVelocity2 = new Vector2(npc.localAI[0], npc.localAI[1]); laserVelocity2.Normalize(); @@ -7084,7 +7085,7 @@ namespace CalamityMod.NPCs } if (npc.ai[1] % playSoundTimer == 0f) - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 20); + SoundEngine.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 20); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -7258,7 +7259,7 @@ namespace CalamityMod.NPCs { Main.tile[x, y + 1] = new Tile(); } - if ((float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X && ((Main.tile[x, y].nactive() && !Main.tile[x, y].topSlope() && !Main.tile[x, y - 1].topSlope() && Main.tileSolid[(int)Main.tile[x, y].type] && !Main.tileSolidTop[(int)Main.tile[x, y].type]) || (Main.tile[x, y - 1].halfBrick() && Main.tile[x, y - 1].nactive())) && (!Main.tile[x, y - 1].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 1].type] || Main.tileSolidTop[(int)Main.tile[x, y - 1].type] || (Main.tile[x, y - 1].halfBrick() && (!Main.tile[x, y - 4].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 4].type] || Main.tileSolidTop[(int)Main.tile[x, y - 4].type]))) && (!Main.tile[x, y - 2].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 2].type] || Main.tileSolidTop[(int)Main.tile[x, y - 2].type]) && (!Main.tile[x, y - 3].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 3].type] || Main.tileSolidTop[(int)Main.tile[x, y - 3].type]) && (!Main.tile[x - num9, y - 3].nactive() || !Main.tileSolid[(int)Main.tile[x - num9, y - 3].type])) + if ((float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X && ((Main.tile[x, y].nactive() && !Main.tile[x, y].topSlope() && !Main.tile[x, y - 1].topSlope() && Main.tileSolid[(int)Main.tile[x, y].TileType] && !Main.tileSolidTop[(int)Main.tile[x, y].TileType]) || (Main.tile[x, y - 1].halfBrick() && Main.tile[x, y - 1].nactive())) && (!Main.tile[x, y - 1].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 1].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 1].TileType] || (Main.tile[x, y - 1].halfBrick() && (!Main.tile[x, y - 4].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 4].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 4].TileType]))) && (!Main.tile[x, y - 2].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 2].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 2].TileType]) && (!Main.tile[x, y - 3].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 3].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 3].TileType]) && (!Main.tile[x - num9, y - 3].nactive() || !Main.tileSolid[(int)Main.tile[x - num9, y - 3].TileType])) { float npcBottom = (float)(y * 16); if (Main.tile[x, y].halfBrick()) @@ -7414,7 +7415,7 @@ namespace CalamityMod.NPCs npc.velocity.Y -= bounciness; if (npc.type == ModContent.NPCType()) { - Main.PlaySound(SoundID.Item, npc.Center, 14); + SoundEngine.PlaySound(SoundID.Item, npc.Center, 14); for (int k = 0; k < 10; k++) { Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, -1f, 0, default, 1f); @@ -7422,7 +7423,7 @@ namespace CalamityMod.NPCs } if (npc.type == ModContent.NPCType()) { - Main.PlaySound(SoundID.NPCHit, npc.Center, 7); + SoundEngine.PlaySound(SoundID.NPCHit, npc.Center, 7); } if (DogPhase2) { @@ -7542,7 +7543,7 @@ namespace CalamityMod.NPCs { Main.tile[x, y + 1] = new Tile(); } - if ((float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X && ((Main.tile[x, y].nactive() && !Main.tile[x, y].topSlope() && !Main.tile[x, y - 1].topSlope() && Main.tileSolid[(int)Main.tile[x, y].type] && !Main.tileSolidTop[(int)Main.tile[x, y].type]) || (Main.tile[x, y - 1].halfBrick() && Main.tile[x, y - 1].nactive())) && (!Main.tile[x, y - 1].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 1].type] || Main.tileSolidTop[(int)Main.tile[x, y - 1].type] || (Main.tile[x, y - 1].halfBrick() && (!Main.tile[x, y - 4].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 4].type] || Main.tileSolidTop[(int)Main.tile[x, y - 4].type]))) && (!Main.tile[x, y - 2].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 2].type] || Main.tileSolidTop[(int)Main.tile[x, y - 2].type]) && (!Main.tile[x, y - 3].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 3].type] || Main.tileSolidTop[(int)Main.tile[x, y - 3].type]) && (!Main.tile[x - num10, y - 3].nactive() || !Main.tileSolid[(int)Main.tile[x - num10, y - 3].type])) + if ((float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X && ((Main.tile[x, y].nactive() && !Main.tile[x, y].topSlope() && !Main.tile[x, y - 1].topSlope() && Main.tileSolid[(int)Main.tile[x, y].TileType] && !Main.tileSolidTop[(int)Main.tile[x, y].TileType]) || (Main.tile[x, y - 1].halfBrick() && Main.tile[x, y - 1].nactive())) && (!Main.tile[x, y - 1].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 1].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 1].TileType] || (Main.tile[x, y - 1].halfBrick() && (!Main.tile[x, y - 4].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 4].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 4].TileType]))) && (!Main.tile[x, y - 2].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 2].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 2].TileType]) && (!Main.tile[x, y - 3].nactive() || !Main.tileSolid[(int)Main.tile[x, y - 3].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 3].TileType]) && (!Main.tile[x - num10, y - 3].nactive() || !Main.tileSolid[(int)Main.tile[x - num10, y - 3].TileType])) { float num13 = (float)(y * 16); if (Main.tile[x, y].halfBrick()) @@ -7613,9 +7614,9 @@ namespace CalamityMod.NPCs if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) { float num18 = 3f; - if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) + if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].TileType]) { - if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) + if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].TileType]) { npc.velocity.Y = bouncy1; npc.netUpdate = true; @@ -7626,17 +7627,17 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } } - else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) + else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].TileType]) { npc.velocity.Y = bouncy3; npc.netUpdate = true; } - else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) + else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].TileType]) { npc.velocity.Y = bouncy4; npc.netUpdate = true; } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].TileType]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].TileType]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].TileType])) { npc.velocity.Y = bouncy5; npc.netUpdate = true; diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 667c88bc19..f88eff7818 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -179,7 +179,7 @@ namespace CalamityMod.NPCs { for (int y = tileCoordsY - 1; y <= tileCoordsY + 1; y++) { - if (Main.tile[x, y].wall > 0) + if (Main.tile[x, y].WallType > 0) { climbWalls = true; } @@ -465,7 +465,7 @@ namespace CalamityMod.NPCs float time = npc.ai[2] + maxTime + turnToStoneTime; if (time == 1f) { - Main.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 17, 1f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 17, 1f, 0f); } if (time < turnToStoneTime) { @@ -661,7 +661,7 @@ namespace CalamityMod.NPCs { Main.tile[tileAtCenterX, tileAtBottom] = new Tile(); } - if (Main.tile[i, tileAtBottom].active() && Main.tileSolid[(int)Main.tile[i, tileAtBottom].type]) + if (Main.tile[i, tileAtBottom].active() && Main.tileSolid[(int)Main.tile[i, tileAtBottom].TileType]) { ableToRestart = true; } @@ -1015,7 +1015,7 @@ namespace CalamityMod.NPCs { npc.velocity *= 0f; npc.ai[3] = 0f; - Main.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.position); float distX = npc.oldPos[2].X + (float)npc.width * 0.5f - npc.Center.X; float distY = npc.oldPos[2].Y + (float)npc.height * 0.5f - npc.Center.Y; float num38 = (float)Math.Sqrt((distX * distX + distY * distY)); @@ -1215,7 +1215,7 @@ namespace CalamityMod.NPCs { for (int y = centerTileY - 1; y <= centerTileY + 1; y++) { - if (Main.tile[x, y] != null && Main.tile[x, y].wall > 0) + if (Main.tile[x, y] != null && Main.tile[x, y].WallType > 0) { spiderAI = true; break; @@ -1288,31 +1288,31 @@ namespace CalamityMod.NPCs { if ((npcType == NPCID.Zombie || npcType == NPCID.ZombieXmas || npcType == NPCID.ZombieSweater || npcType == NPCID.Skeleton || (npcType >= NPCID.BoneThrowingSkeleton && npcType <= NPCID.BoneThrowingSkeleton4) || npcType == NPCID.AngryBones || npcType == NPCID.AngryBonesBig || npcType == NPCID.AngryBonesBigHelmet || npcType == NPCID.AngryBonesBigMuscle || npcType == NPCID.ArmoredSkeleton || npcType == NPCID.SkeletonArcher || npcType == NPCID.BaldZombie || npcType == NPCID.UndeadViking || npcType == NPCID.ZombieEskimo || npcType == NPCID.Frankenstein || npcType == NPCID.PincushionZombie || npcType == NPCID.SlimedZombie || npcType == NPCID.SwampZombie || npcType == NPCID.TwiggyZombie || npcType == NPCID.ArmoredViking || npcType == NPCID.FemaleZombie || npcType == NPCID.HeadacheSkeleton || npcType == NPCID.MisassembledSkeleton || npcType == NPCID.PantlessSkeleton || npcType == NPCID.ZombieRaincoat || npcType == NPCID.SkeletonSniper || npcType == NPCID.TacticalSkeleton || npcType == NPCID.SkeletonCommando || npcType == NPCID.ZombieSuperman || npcType == NPCID.ZombiePixie || npcType == NPCID.ZombieDoctor || npcType == NPCID.GreekSkeleton) && Main.rand.Next(1000) == 0) { - Main.PlaySound(SoundID.ZombieMoan, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.ZombieMoan, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); } if (npcType == NPCID.BloodZombie && Main.rand.Next(800) == 0) { - Main.PlaySound(SoundID.ZombieMoan, (int)npc.position.X, (int)npc.position.Y, npcType, 1f, 0f); + SoundEngine.PlaySound(SoundID.ZombieMoan, (int)npc.position.X, (int)npc.position.Y, npcType, 1f, 0f); } if ((npcType == NPCID.Mummy || npcType == NPCID.DarkMummy || npcType == NPCID.LightMummy) && Main.rand.Next(500) == 0) { - Main.PlaySound(SoundID.Mummy, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.Mummy, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); } if (npcType == NPCID.Vampire && Main.rand.Next(500) == 0) { - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 7, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 7, 1f, 0f); } if (npcType == NPCID.Frankenstein && Main.rand.Next(500) == 0) { - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 6, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 6, 1f, 0f); } if (npcType == NPCID.FaceMonster && Main.rand.Next(500) == 0) { - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 8, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 8, 1f, 0f); } if (npcType >= 269 && npcType <= 280 && Main.rand.Next(1000) == 0) { - Main.PlaySound(SoundID.ZombieMoan, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.ZombieMoan, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); } npc.TargetClosest(true); } @@ -2398,7 +2398,7 @@ namespace CalamityMod.NPCs { notLava = false; } - if (notLava && Main.tileSolid[(int)Main.tile[turretSpawnX, y].type] && !Collision.SolidTiles(turretSpawnX - 1, turretSpawnX + 1, y - 4, y - 1)) + if (notLava && Main.tileSolid[(int)Main.tile[turretSpawnX, y].TileType] && !Collision.SolidTiles(turretSpawnX - 1, turretSpawnX + 1, y - 4, y - 1)) { int turretIdx = NPC.NewNPC(turretSpawnX * 16 - npc.width / 2, y * 16, NPCID.MartianTurret, 0, 0f, 0f, 0f, 0f, 255); Main.npc[turretIdx].position.Y = (float)(y * 16 - Main.npc[turretIdx].height); @@ -3118,7 +3118,7 @@ namespace CalamityMod.NPCs { return false; } - if (Main.tile[i, j].nactive() && Main.tileSolid[Main.tile[i, j].type]) + if (Main.tile[i, j].nactive() && Main.tileSolid[Main.tile[i, j].TileType]) { canOpenDoors = true; break; @@ -3171,24 +3171,24 @@ namespace CalamityMod.NPCs if (x * 16 < positionDelta.X + (float)npc.width && (x + 1) * 16 > positionDelta.X && ((Main.tile[x, y].nactive() && !Main.tile[x, y].topSlope() && !Main.tile[x, y - 1].topSlope() && - Main.tileSolid[(int)Main.tile[x, y].type] && - !Main.tileSolidTop[(int)Main.tile[x, y].type]) || + Main.tileSolid[(int)Main.tile[x, y].TileType] && + !Main.tileSolidTop[(int)Main.tile[x, y].TileType]) || (Main.tile[x, y - 1].halfBrick() && Main.tile[x, y - 1].nactive())) && (!Main.tile[x, y - 1].nactive() || - !Main.tileSolid[(int)Main.tile[x, y - 1].type] || - Main.tileSolidTop[(int)Main.tile[x, y - 1].type] || + !Main.tileSolid[(int)Main.tile[x, y - 1].TileType] || + Main.tileSolidTop[(int)Main.tile[x, y - 1].TileType] || (Main.tile[x, y - 1].halfBrick() && (!Main.tile[x, y - 4].nactive() || - !Main.tileSolid[(int)Main.tile[x, y - 4].type] || - Main.tileSolidTop[(int)Main.tile[x, y - 4].type]))) && + !Main.tileSolid[(int)Main.tile[x, y - 4].TileType] || + Main.tileSolidTop[(int)Main.tile[x, y - 4].TileType]))) && (!Main.tile[x, y - 2].nactive() || - !Main.tileSolid[(int)Main.tile[x, y - 2].type] || - Main.tileSolidTop[(int)Main.tile[x, y - 2].type]) && + !Main.tileSolid[(int)Main.tile[x, y - 2].TileType] || + Main.tileSolidTop[(int)Main.tile[x, y - 2].TileType]) && (!Main.tile[x, y - 3].nactive() || - !Main.tileSolid[(int)Main.tile[x, y - 3].type] || - Main.tileSolidTop[(int)Main.tile[x, y - 3].type]) && + !Main.tileSolid[(int)Main.tile[x, y - 3].TileType] || + Main.tileSolidTop[(int)Main.tile[x, y - 3].TileType]) && (!Main.tile[x - velocitySign, y - 3].nactive() || - !Main.tileSolid[(int)Main.tile[x - velocitySign, y - 3].type])) + !Main.tileSolid[(int)Main.tile[x - velocitySign, y - 3].TileType])) { float yAdjust = y * 16f; if (Main.tile[x, y].halfBrick()) @@ -3265,8 +3265,8 @@ namespace CalamityMod.NPCs } Main.tile[x, y + 1].halfBrick(); if ((Main.tile[x, y - 1].nactive() && - (Main.tile[x, y - 1].type == TileID.ClosedDoor || - Main.tile[x, y - 1].type == TileID.TallGateClosed)) & reset) + (Main.tile[x, y - 1].TileType == TileID.ClosedDoor || + Main.tile[x, y - 1].TileType == TileID.TallGateClosed)) & reset) { npc.ai[2] += 1f; npc.ai[3] = 0f; @@ -3274,7 +3274,7 @@ namespace CalamityMod.NPCs { npc.velocity.X = -0.5f * npc.direction; int timerIncrement = 5; - if (Main.tile[x, y - 1].type == TileID.TallGateClosed) + if (Main.tile[x, y - 1].TileType == TileID.TallGateClosed) { timerIncrement = 2; } @@ -3312,7 +3312,7 @@ namespace CalamityMod.NPCs } else { - if (Main.tile[x, y - 1].type == TileID.ClosedDoor) + if (Main.tile[x, y - 1].TileType == TileID.ClosedDoor) { bool flag24 = WorldGen.OpenDoor(x, y - 1, npc.direction); if (!flag24) @@ -3325,7 +3325,7 @@ namespace CalamityMod.NPCs NetMessage.SendData(MessageID.ChangeDoor, -1, -1, null, 0, (float)x, (float)(y - 1), (float)npc.direction, 0, 0, 0); } } - if (Main.tile[x, y - 1].type == TileID.TallGateClosed) + if (Main.tile[x, y - 1].TileType == TileID.TallGateClosed) { bool flag25 = WorldGen.ShiftTallGate(x, y - 1, false); if (!flag25) @@ -3351,9 +3351,9 @@ namespace CalamityMod.NPCs } if ((npc.velocity.X < 0f && alteredDirection == -1) || (npc.velocity.X > 0f && alteredDirection == 1)) { - if (npc.height >= 32 && Main.tile[x, y - 2].nactive() && Main.tileSolid[(int)Main.tile[x, y - 2].type]) + if (npc.height >= 32 && Main.tile[x, y - 2].nactive() && Main.tileSolid[(int)Main.tile[x, y - 2].TileType]) { - if (Main.tile[x, y - 3].nactive() && Main.tileSolid[(int)Main.tile[x, y - 3].type]) + if (Main.tile[x, y - 3].nactive() && Main.tileSolid[(int)Main.tile[x, y - 3].TileType]) { npc.velocity.Y = -9f; npc.netUpdate = true; @@ -3364,17 +3364,17 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } } - else if (Main.tile[x, y - 1].nactive() && Main.tileSolid[(int)Main.tile[x, y - 1].type]) + else if (Main.tile[x, y - 1].nactive() && Main.tileSolid[(int)Main.tile[x, y - 1].TileType]) { npc.velocity.Y = -7f; npc.netUpdate = true; } - else if (npc.position.Y + (float)npc.height - (float)(y * 16) > 20f && Main.tile[x, y].nactive() && !Main.tile[x, y].topSlope() && Main.tileSolid[(int)Main.tile[x, y].type]) + else if (npc.position.Y + (float)npc.height - (float)(y * 16) > 20f && Main.tile[x, y].nactive() && !Main.tile[x, y].topSlope() && Main.tileSolid[(int)Main.tile[x, y].TileType]) { npc.velocity.Y = -6f; npc.netUpdate = true; } - else if (npc.directionY < 0 && npcType != 67 && (!Main.tile[x, y + 1].nactive() || !Main.tileSolid[(int)Main.tile[x, y + 1].type]) && (!Main.tile[x + npc.direction, y + 1].nactive() || !Main.tileSolid[(int)Main.tile[x + npc.direction, y + 1].type])) + else if (npc.directionY < 0 && npcType != 67 && (!Main.tile[x, y + 1].nactive() || !Main.tileSolid[(int)Main.tile[x, y + 1].TileType]) && (!Main.tile[x + npc.direction, y + 1].nactive() || !Main.tileSolid[(int)Main.tile[x + npc.direction, y + 1].TileType])) { npc.velocity.Y = -9f; npc.velocity.X *= 2f; @@ -3457,7 +3457,7 @@ namespace CalamityMod.NPCs bool foundGoodTeleport = true; // I don't understand why the hell this exists if it's only for Chaos Elementals, but I suppose I'll // Leave it here - if (npcType == NPCID.DarkCaster && Main.tile[randX, num181 - 1].wall == WallID.None) + if (npcType == NPCID.DarkCaster && Main.tile[randX, num181 - 1].WallType == WallID.None) { foundGoodTeleport = false; } @@ -3465,7 +3465,7 @@ namespace CalamityMod.NPCs { foundGoodTeleport = false; } - if (foundGoodTeleport && Main.tileSolid[(int)Main.tile[randX, num181].type] && !Collision.SolidTiles(randX - 1, randX + 1, num181 - 4, num181 - 1)) + if (foundGoodTeleport && Main.tileSolid[(int)Main.tile[randX, num181].TileType] && !Collision.SolidTiles(randX - 1, randX + 1, num181 - 4, num181 - 1)) { npc.position.X = (float)(randX * 16 - npc.width / 2); npc.position.Y = (float)(num181 * 16 - npc.height); @@ -3824,7 +3824,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.LeechHead && npc.localAI[1] == 0f) { npc.localAI[1] = 1f; - Main.PlaySound(SoundID.NPCDeath13, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath13, npc.position); int num = 1; if (npc.velocity.X < 0f) { @@ -4143,7 +4143,7 @@ namespace CalamityMod.NPCs { for (int num34 = num31; num34 < num32; num34++) { - if (Main.tile[num33, num34] != null && ((Main.tile[num33, num34].nactive() && (Main.tileSolid[(int)Main.tile[num33, num34].type] || (Main.tileSolidTop[(int)Main.tile[num33, num34].type] && Main.tile[num33, num34].frameY == 0))) || Main.tile[num33, num34].liquid > 64)) + if (Main.tile[num33, num34] != null && ((Main.tile[num33, num34].nactive() && (Main.tileSolid[(int)Main.tile[num33, num34].TileType] || (Main.tileSolidTop[(int)Main.tile[num33, num34].TileType] && Main.tile[num33, num34].TileFrameY == 0))) || Main.tile[num33, num34].liquid > 64)) { Vector2 vector; vector.X = (float)(num33 * 16); @@ -4507,7 +4507,7 @@ namespace CalamityMod.NPCs num54 = 20f; } npc.soundDelay = (int)num54; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); } num52 = (float)Math.Sqrt((double)(num39 * num39 + num40 * num40)); @@ -4713,7 +4713,7 @@ namespace CalamityMod.NPCs { npc.alpha = 255; } - Main.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.position); int num; for (int num68 = 0; num68 < 50; num68 = num + 1) { @@ -4784,7 +4784,7 @@ namespace CalamityMod.NPCs npc.velocity.Y = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - Main.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.position); for (int num77 = 0; num77 < 50; num77 = num + 1) { if (npc.type == NPCID.GoblinSorcerer || npc.type == NPCID.Tim) @@ -4929,7 +4929,7 @@ namespace CalamityMod.NPCs if ((num94 < num87 - 4 || num94 > num87 + 4 || num92 < num86 - 4 || num92 > num86 + 4) && (num94 < num89 - 1 || num94 > num89 + 1 || num92 < num88 - 1 || num92 > num88 + 1) && Main.tile[num92, num94].nactive()) { bool flag5 = true; - if ((npc.type == NPCID.DarkCaster || (npc.type >= NPCID.RaggedCaster && npc.type <= NPCID.DiabolistWhite)) && !Main.wallDungeon[(int)Main.tile[num92, num94 - 1].wall]) + if ((npc.type == NPCID.DarkCaster || (npc.type >= NPCID.RaggedCaster && npc.type <= NPCID.DiabolistWhite)) && !Main.wallDungeon[(int)Main.tile[num92, num94 - 1].WallType]) { flag5 = false; } @@ -4937,7 +4937,7 @@ namespace CalamityMod.NPCs { flag5 = false; } - if (flag5 && Main.tileSolid[(int)Main.tile[num92, num94].type] && !Collision.SolidTiles(num92 - 1, num92 + 1, num94 - 4, num94 - 1)) + if (flag5 && Main.tileSolid[(int)Main.tile[num92, num94].TileType] && !Collision.SolidTiles(num92 - 1, num92 + 1, num94 - 4, num94 - 1)) { npc.ai[1] = 20f; npc.ai[2] = (float)num92; @@ -4958,7 +4958,7 @@ namespace CalamityMod.NPCs { if (npc.ai[1] % 30f == 0f && npc.ai[1] / 30f < 5f) { - Main.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.position); if (Main.netMode != NetmodeID.MultiplayerClient) { Point point = npc.Center.ToTileCoordinates(); @@ -5053,7 +5053,7 @@ namespace CalamityMod.NPCs { if (npc.type != NPCID.RuneWizard) { - Main.PlaySound(SoundID.Item8, npc.position); + SoundEngine.PlaySound(SoundID.Item8, npc.position); } if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -6201,7 +6201,7 @@ namespace CalamityMod.NPCs { if (npc.ai[0] == 200f) { - Main.PlaySound(SoundID.NPCDeath13, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath13, npc.position); } npc.ai[0] -= 1f; } @@ -6256,7 +6256,7 @@ namespace CalamityMod.NPCs { Main.tile[xLeft, y] = new Tile(); } - if ((Main.tile[xLeft, y].nactive() && Main.tileSolid[(int)Main.tile[xLeft, y].type]) || (Main.tile[xCenter, y].nactive() && Main.tileSolid[(int)Main.tile[xCenter, y].type]) || (Main.tile[xRight, y].nactive() && Main.tileSolid[(int)Main.tile[xRight, y].type])) + if ((Main.tile[xLeft, y].nactive() && Main.tileSolid[(int)Main.tile[xLeft, y].TileType]) || (Main.tile[xCenter, y].nactive() && Main.tileSolid[(int)Main.tile[xCenter, y].TileType]) || (Main.tile[xRight, y].nactive() && Main.tileSolid[(int)Main.tile[xRight, y].TileType])) { tileClimbing = true; } @@ -6587,7 +6587,7 @@ namespace CalamityMod.NPCs if (Main.rand.Next(40) == 0) { - Main.PlaySound(SoundID.Pixie, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.Pixie, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); } } else if (npc.type == NPCID.IceElemental) @@ -6723,7 +6723,7 @@ namespace CalamityMod.NPCs { Main.tile[num288, num316] = new Tile(); } - if ((Main.tile[num288, num316].nactive() && Main.tileSolid[(int)Main.tile[num288, num316].type]) || Main.tile[num288, num316].liquid > 0) + if ((Main.tile[num288, num316].nactive() && Main.tileSolid[(int)Main.tile[num288, num316].TileType]) || Main.tile[num288, num316].liquid > 0) { if (num316 <= num289 + 1) { @@ -6743,7 +6743,7 @@ namespace CalamityMod.NPCs { Main.tile[num288, num317] = new Tile(); } - if ((Main.tile[num288, num317].nactive() && Main.tileSolid[(int)Main.tile[num288, num317].type]) || Main.tile[num288, num317].liquid > 0) + if ((Main.tile[num288, num317].nactive() && Main.tileSolid[(int)Main.tile[num288, num317].TileType]) || Main.tile[num288, num317].liquid > 0) { flag25 = true; break; @@ -6760,7 +6760,7 @@ namespace CalamityMod.NPCs { Main.tile[num288, num318] = new Tile(); } - if ((Main.tile[num288, num318].nactive() && Main.tileSolid[(int)Main.tile[num288, num318].type]) || Main.tile[num288, num318].liquid > 0) + if ((Main.tile[num288, num318].nactive() && Main.tileSolid[(int)Main.tile[num288, num318].TileType]) || Main.tile[num288, num318].liquid > 0) { flag24 = false; flag19 = true; @@ -7371,7 +7371,7 @@ namespace CalamityMod.NPCs else if (npc.type == NPCID.Tumbleweed && npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) { npc.velocity.Y -= 6f; - Main.PlaySound(SoundID.NPCHit, npc.Center, 11); + SoundEngine.PlaySound(SoundID.NPCHit, npc.Center, 11); } if (npc.ai[3] < (float)num) @@ -7576,7 +7576,7 @@ namespace CalamityMod.NPCs Main.tile[num10, num11 + 1] = new Tile(); } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].TileType] && !Main.tileSolidTop[(int)Main.tile[num10, num11].TileType]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].TileType] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].TileType] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].TileType] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].TileType]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].TileType] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].TileType]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].TileType] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].TileType]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].TileType])) { float num12 = (float)(num11 * 16); if (Main.tile[num10, num11].halfBrick()) @@ -7657,9 +7657,9 @@ namespace CalamityMod.NPCs bool flag6 = npc.type == NPCID.StardustSpiderSmall || npc.type == NPCID.NebulaBeast; float num17 = 3f; - if (Main.tile[num14, num15 - 2].nactive() && Main.tileSolid[(int)Main.tile[num14, num15 - 2].type]) + if (Main.tile[num14, num15 - 2].nactive() && Main.tileSolid[(int)Main.tile[num14, num15 - 2].TileType]) { - if (Main.tile[num14, num15 - 3].nactive() && Main.tileSolid[(int)Main.tile[num14, num15 - 3].type]) + if (Main.tile[num14, num15 - 3].nactive() && Main.tileSolid[(int)Main.tile[num14, num15 - 3].TileType]) { npc.velocity.Y = -10.5f; npc.netUpdate = true; @@ -7670,17 +7670,17 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } } - else if (Main.tile[num14, num15 - 1].nactive() && !Main.tile[num14, num15 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num14, num15 - 1].type]) + else if (Main.tile[num14, num15 - 1].nactive() && !Main.tile[num14, num15 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num14, num15 - 1].TileType]) { npc.velocity.Y = -9f; npc.netUpdate = true; } - else if (npc.position.Y + (float)npc.height - (float)(num15 * 16) > 20f && Main.tile[num14, num15].nactive() && !Main.tile[num14, num15].topSlope() && Main.tileSolid[(int)Main.tile[num14, num15].type]) + else if (npc.position.Y + (float)npc.height - (float)(num15 * 16) > 20f && Main.tile[num14, num15].nactive() && !Main.tile[num14, num15].topSlope() && Main.tileSolid[(int)Main.tile[num14, num15].TileType]) { npc.velocity.Y = -7f; npc.netUpdate = true; } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num17) && (!flag6 || !Main.tile[num14, num15 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num14, num15 + 1].type]) && (!Main.tile[num14, num15 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num14, num15 + 2].type]) && (!Main.tile[num14 + npc.direction, num15 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num14 + npc.direction, num15 + 3].type])) + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num17) && (!flag6 || !Main.tile[num14, num15 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num14, num15 + 1].TileType]) && (!Main.tile[num14, num15 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num14, num15 + 2].TileType]) && (!Main.tile[num14 + npc.direction, num15 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num14 + npc.direction, num15 + 3].TileType])) { npc.velocity.Y = -10f; npc.netUpdate = true; @@ -7739,7 +7739,7 @@ namespace CalamityMod.NPCs int num533 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num532)) / 16f); int num534 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if ((float)(num533 * 16) < position.X + (float)npc.width && (float)(num533 * 16 + 16) > position.X && ((Main.tile[num533, num534].nactive() && !Main.tile[num533, num534].topSlope() && !Main.tile[num533, num534 - 1].topSlope() && ((Main.tileSolid[(int)Main.tile[num533, num534].type] && !Main.tileSolidTop[(int)Main.tile[num533, num534].type]) || (flag31 && Main.tileSolidTop[(int)Main.tile[num533, num534].type] && (!Main.tileSolid[(int)Main.tile[num533, num534 - 1].type] || !Main.tile[num533, num534 - 1].nactive()) && Main.tile[num533, num534].type != 16 && Main.tile[num533, num534].type != 18 && Main.tile[num533, num534].type != 134))) || (Main.tile[num533, num534 - 1].halfBrick() && Main.tile[num533, num534 - 1].nactive())) && (!Main.tile[num533, num534 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num533, num534 - 1].type] || Main.tileSolidTop[(int)Main.tile[num533, num534 - 1].type] || (Main.tile[num533, num534 - 1].halfBrick() && (!Main.tile[num533, num534 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num533, num534 - 4].type] || Main.tileSolidTop[(int)Main.tile[num533, num534 - 4].type]))) && (!Main.tile[num533, num534 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num533, num534 - 2].type] || Main.tileSolidTop[(int)Main.tile[num533, num534 - 2].type]) && (!Main.tile[num533, num534 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num533, num534 - 3].type] || Main.tileSolidTop[(int)Main.tile[num533, num534 - 3].type]) && (!Main.tile[num533 - num532, num534 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num533 - num532, num534 - 3].type] || Main.tileSolidTop[(int)Main.tile[num533 - num532, num534 - 3].type])) + if ((float)(num533 * 16) < position.X + (float)npc.width && (float)(num533 * 16 + 16) > position.X && ((Main.tile[num533, num534].nactive() && !Main.tile[num533, num534].topSlope() && !Main.tile[num533, num534 - 1].topSlope() && ((Main.tileSolid[(int)Main.tile[num533, num534].TileType] && !Main.tileSolidTop[(int)Main.tile[num533, num534].TileType]) || (flag31 && Main.tileSolidTop[(int)Main.tile[num533, num534].TileType] && (!Main.tileSolid[(int)Main.tile[num533, num534 - 1].TileType] || !Main.tile[num533, num534 - 1].nactive()) && Main.tile[num533, num534].TileType != 16 && Main.tile[num533, num534].TileType != 18 && Main.tile[num533, num534].TileType != 134))) || (Main.tile[num533, num534 - 1].halfBrick() && Main.tile[num533, num534 - 1].nactive())) && (!Main.tile[num533, num534 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num533, num534 - 1].TileType] || Main.tileSolidTop[(int)Main.tile[num533, num534 - 1].TileType] || (Main.tile[num533, num534 - 1].halfBrick() && (!Main.tile[num533, num534 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num533, num534 - 4].TileType] || Main.tileSolidTop[(int)Main.tile[num533, num534 - 4].TileType]))) && (!Main.tile[num533, num534 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num533, num534 - 2].TileType] || Main.tileSolidTop[(int)Main.tile[num533, num534 - 2].TileType]) && (!Main.tile[num533, num534 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num533, num534 - 3].TileType] || Main.tileSolidTop[(int)Main.tile[num533, num534 - 3].TileType]) && (!Main.tile[num533 - num532, num534 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num533 - num532, num534 - 3].TileType] || Main.tileSolidTop[(int)Main.tile[num533 - num532, num534 - 3].TileType])) { float num535 = (float)(num534 * 16); if (Main.tile[num533, num534].halfBrick()) @@ -7871,7 +7871,7 @@ namespace CalamityMod.NPCs { for (int num546 = num543; num546 <= num544; num546++) { - if (Main.tile[num545, num546] != null && Main.tile[num545, num546].nactive() && Main.tileSolid[(int)Main.tile[num545, num546].type]) + if (Main.tile[num545, num546] != null && Main.tile[num545, num546].nactive() && Main.tileSolid[(int)Main.tile[num545, num546].TileType]) { flag33 = true; } @@ -8483,7 +8483,7 @@ namespace CalamityMod.NPCs { return false; } - if (Main.tile[i, j].wall > 0) + if (Main.tile[i, j].WallType > 0) { climbingWall = true; } @@ -9446,7 +9446,7 @@ namespace CalamityMod.NPCs npc.ai[1] += 1f; if (npc.ai[1] >= 3f) { - Main.PlaySound(SoundID.Item14, npc.position); + SoundEngine.PlaySound(SoundID.Item14, npc.position); npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; @@ -9984,7 +9984,7 @@ namespace CalamityMod.NPCs { if (animationCountdown <= 0f) animationCountdown = 120f; - Main.PlaySound(SoundID.DD2_DarkMageHealImpact); + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact); } // As well as some indicator text. diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 81e2b86095..084b023513 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -460,7 +460,7 @@ namespace CalamityMod.NPCs } Item heldItem = Main.player[owner].ActiveItem(); - int totalDamage = (int)(150 * Main.player[owner].minionDamage); + int totalDamage = (int)(150 * Main.player[owner].GetDamage(DamageClass.Summon)); bool forbidden = Main.player[owner].head == ArmorIDs.Head.AncientBattleArmor && Main.player[owner].body == ArmorIDs.Body.AncientBattleArmor && Main.player[owner].legs == ArmorIDs.Legs.AncientBattleArmor; bool reducedNerf = Main.player[owner].Calamity().fearmongerSet || (forbidden && heldItem.magic); @@ -874,7 +874,7 @@ namespace CalamityMod.NPCs BaseVanillaBossHPAdjustments(npc); if (BossRushEvent.BossRushActive) - BossRushStatChanges(npc, mod); + BossRushStatChanges(npc, Mod); BossValueChanges(npc); @@ -882,13 +882,13 @@ namespace CalamityMod.NPCs DraedonMechaMayhemStatChanges(npc); if (CalamityWorld.revenge) - RevDeathStatChanges(npc, mod); + RevDeathStatChanges(npc, Mod); OtherStatChanges(npc); VulnerabilitiesAndResistances(npc); - BoundNPCSafety(mod, npc); + BoundNPCSafety(Mod, npc); } #endregion @@ -2274,7 +2274,7 @@ namespace CalamityMod.NPCs bool countsAsBoss = npc.boss || NPCID.Sets.TechnicallyABoss[npc.type]; bool scalesLikeBoss = countsAsBoss || CalamityLists.bossHPScaleList.Contains(npc.type); - bool isCalamityNPC = npc.modNPC != null && npc.modNPC.mod == CalamityMod.Instance; + bool isCalamityNPC = npc.modNPC != null && npc.modNPC.Mod == CalamityMod.Instance; // All bosses, NPCs that are supposed to scale like bosses, and Calamity NPCs follow these rules. if (scalesLikeBoss || isCalamityNPC) @@ -2569,7 +2569,7 @@ namespace CalamityMod.NPCs if (VulnerabilityHexFireDrawer != null) VulnerabilityHexFireDrawer.Update(); - SetPatreonTownNPCName(npc, mod); + SetPatreonTownNPCName(npc, Mod); // Decrement each immune timer if it's greater than 0. for (int i = 0; i < maxPlayerImmunities; i++) @@ -2626,7 +2626,7 @@ namespace CalamityMod.NPCs npc.buffImmune[BuffType()] = false; if (BossRushEvent.BossRushActive && !npc.friendly && !npc.townNPC && !npc.Calamity().DoesNotDisappearInBossRush) - BossRushForceDespawnOtherNPCs(npc, mod); + BossRushForceDespawnOtherNPCs(npc, Mod); if (NPC.LunarApocalypseIsUp) PillarEventProgressionEdit(npc); @@ -2635,7 +2635,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.AncientDoom) { if (Main.npc[(int)npc.ai[0]].type == NPCType()) - return CultistAI.BuffedAncientDoomAI(npc, mod); + return CultistAI.BuffedAncientDoomAI(npc, Mod); } // Disable teleports for hardmode dungeon casters if they get hit @@ -2649,76 +2649,76 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.KingSlime: - return KingSlimeAI.BuffedKingSlimeAI(npc, mod); + return KingSlimeAI.BuffedKingSlimeAI(npc, Mod); case NPCID.EyeofCthulhu: - return EyeOfCthulhuAI.BuffedEyeofCthulhuAI(npc, mod); + return EyeOfCthulhuAI.BuffedEyeofCthulhuAI(npc, Mod); case NPCID.EaterofWorldsHead: case NPCID.EaterofWorldsBody: case NPCID.EaterofWorldsTail: - return EaterOfWorldsAI.BuffedEaterofWorldsAI(npc, mod); + return EaterOfWorldsAI.BuffedEaterofWorldsAI(npc, Mod); case NPCID.BrainofCthulhu: - return BrainOfCthulhuAI.BuffedBrainofCthulhuAI(npc, mod); + return BrainOfCthulhuAI.BuffedBrainofCthulhuAI(npc, Mod); case NPCID.Creeper: - return BrainOfCthulhuAI.BuffedCreeperAI(npc, mod); + return BrainOfCthulhuAI.BuffedCreeperAI(npc, Mod); case NPCID.QueenBee: - return QueenBeeAI.BuffedQueenBeeAI(npc, mod); + return QueenBeeAI.BuffedQueenBeeAI(npc, Mod); case NPCID.SkeletronHand: - return SkeletronAI.BuffedSkeletronHandAI(npc, mod); + return SkeletronAI.BuffedSkeletronHandAI(npc, Mod); case NPCID.SkeletronHead: - return SkeletronAI.BuffedSkeletronAI(npc, mod); + return SkeletronAI.BuffedSkeletronAI(npc, Mod); case NPCID.WallofFlesh: - return WallOfFleshAI.BuffedWallofFleshAI(npc, mod); + return WallOfFleshAI.BuffedWallofFleshAI(npc, Mod); case NPCID.WallofFleshEye: - return WallOfFleshAI.BuffedWallofFleshEyeAI(npc, mod); + return WallOfFleshAI.BuffedWallofFleshEyeAI(npc, Mod); case NPCID.TheDestroyer: case NPCID.TheDestroyerBody: case NPCID.TheDestroyerTail: - return DestroyerAI.BuffedDestroyerAI(npc, mod); + return DestroyerAI.BuffedDestroyerAI(npc, Mod); case NPCID.Probe: - return DestroyerAI.BuffedProbeAI(npc, mod); + return DestroyerAI.BuffedProbeAI(npc, Mod); case NPCID.Retinazer: - return TwinsAI.BuffedRetinazerAI(npc, mod); + return TwinsAI.BuffedRetinazerAI(npc, Mod); case NPCID.Spazmatism: - return TwinsAI.BuffedSpazmatismAI(npc, mod); + return TwinsAI.BuffedSpazmatismAI(npc, Mod); case NPCID.SkeletronPrime: - return SkeletronPrimeAI.BuffedSkeletronPrimeAI(npc, mod); + return SkeletronPrimeAI.BuffedSkeletronPrimeAI(npc, Mod); case NPCID.PrimeLaser: - return SkeletronPrimeAI.BuffedPrimeLaserAI(npc, mod); + return SkeletronPrimeAI.BuffedPrimeLaserAI(npc, Mod); case NPCID.PrimeCannon: - return SkeletronPrimeAI.BuffedPrimeCannonAI(npc, mod); + return SkeletronPrimeAI.BuffedPrimeCannonAI(npc, Mod); case NPCID.PrimeVice: - return SkeletronPrimeAI.BuffedPrimeViceAI(npc, mod); + return SkeletronPrimeAI.BuffedPrimeViceAI(npc, Mod); case NPCID.PrimeSaw: - return SkeletronPrimeAI.BuffedPrimeSawAI(npc, mod); + return SkeletronPrimeAI.BuffedPrimeSawAI(npc, Mod); case NPCID.Plantera: - return PlanteraAI.BuffedPlanteraAI(npc, mod); + return PlanteraAI.BuffedPlanteraAI(npc, Mod); case NPCID.PlanterasHook: - return PlanteraAI.BuffedPlanterasHookAI(npc, mod); + return PlanteraAI.BuffedPlanterasHookAI(npc, Mod); case NPCID.PlanterasTentacle: - return PlanteraAI.BuffedPlanterasTentacleAI(npc, mod); + return PlanteraAI.BuffedPlanterasTentacleAI(npc, Mod); case NPCID.Golem: - return GolemAI.BuffedGolemAI(npc, mod); + return GolemAI.BuffedGolemAI(npc, Mod); case NPCID.GolemFistLeft: case NPCID.GolemFistRight: - return GolemAI.BuffedGolemFistAI(npc, mod); + return GolemAI.BuffedGolemFistAI(npc, Mod); case NPCID.GolemHead: - return GolemAI.BuffedGolemHeadAI(npc, mod); + return GolemAI.BuffedGolemHeadAI(npc, Mod); case NPCID.GolemHeadFree: - return GolemAI.BuffedGolemHeadFreeAI(npc, mod); + return GolemAI.BuffedGolemHeadFreeAI(npc, Mod); case NPCID.DukeFishron: - return DukeFishronAI.BuffedDukeFishronAI(npc, mod); + return DukeFishronAI.BuffedDukeFishronAI(npc, Mod); case NPCID.Pumpking: if (CalamityWorld.downedDoG) @@ -2754,18 +2754,18 @@ namespace CalamityMod.NPCs case NPCID.CultistBoss: case NPCID.CultistBossClone: - return CultistAI.BuffedCultistAI(npc, mod); + return CultistAI.BuffedCultistAI(npc, Mod); case NPCID.AncientLight: - return CultistAI.BuffedAncientLightAI(npc, mod); + return CultistAI.BuffedAncientLightAI(npc, Mod); case NPCID.AncientDoom: - return CultistAI.BuffedAncientDoomAI(npc, mod); + return CultistAI.BuffedAncientDoomAI(npc, Mod); case NPCID.MoonLordCore: case NPCID.MoonLordHand: case NPCID.MoonLordHead: case NPCID.MoonLordFreeEye: case NPCID.MoonLordLeechBlob: - return MoonLordAI.BuffedMoonLordAI(npc, mod); + return MoonLordAI.BuffedMoonLordAI(npc, Mod); default: break; @@ -2784,7 +2784,7 @@ namespace CalamityMod.NPCs npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType()) { - return SlimeAI.BuffedSlimeAI(npc, mod); + return SlimeAI.BuffedSlimeAI(npc, Mod); } else { @@ -2811,14 +2811,14 @@ namespace CalamityMod.NPCs case NPCID.SlimeRibbonRed: case NPCID.SlimeSpiked: case NPCID.SandSlime: - return SlimeAI.BuffedSlimeAI(npc, mod); + return SlimeAI.BuffedSlimeAI(npc, Mod); } } break; case 2: if (npc.type == NPCType() || npc.type == NPCType()) { - return DemonEyeAI.BuffedDemonEyeAI(npc, mod); + return DemonEyeAI.BuffedDemonEyeAI(npc, Mod); } else { @@ -2837,7 +2837,7 @@ namespace CalamityMod.NPCs case NPCID.PurpleEye: case NPCID.DemonEyeOwl: case NPCID.DemonEyeSpaceship: - return DemonEyeAI.BuffedDemonEyeAI(npc, mod); + return DemonEyeAI.BuffedDemonEyeAI(npc, Mod); } } break; @@ -2845,7 +2845,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType()) { - return CalamityGlobalAI.BuffedFighterAI(npc, mod); + return CalamityGlobalAI.BuffedFighterAI(npc, Mod); } else { @@ -3031,7 +3031,7 @@ namespace CalamityMod.NPCs case NPCID.MartianWalker: case NPCID.DemonTaxCollector: case NPCID.TheBride: - return CalamityGlobalAI.BuffedFighterAI(npc, mod); + return CalamityGlobalAI.BuffedFighterAI(npc, Mod); } } break; @@ -3045,7 +3045,7 @@ namespace CalamityMod.NPCs case NPCID.Crimera: case NPCID.Moth: case NPCID.Parrot: - return CalamityGlobalAI.BuffedFlyingAI(npc, mod); + return CalamityGlobalAI.BuffedFlyingAI(npc, Mod); } break; case 6: @@ -3085,7 +3085,7 @@ namespace CalamityMod.NPCs case NPCID.SolarCrawltipedeHead: case NPCID.SolarCrawltipedeBody: case NPCID.SolarCrawltipedeTail: - return CalamityGlobalAI.BuffedWormAI(npc, mod); + return CalamityGlobalAI.BuffedWormAI(npc, Mod); } break; case 8: @@ -3103,7 +3103,7 @@ namespace CalamityMod.NPCs case NPCID.DiabolistWhite: case NPCID.DesertDjinn: case NPCID.GoblinSorcerer: - return CalamityGlobalAI.BuffedCasterAI(npc, mod); + return CalamityGlobalAI.BuffedCasterAI(npc, Mod); } break; case 13: @@ -3115,13 +3115,13 @@ namespace CalamityMod.NPCs case NPCID.AngryTrapper: case NPCID.FungiBulb: case NPCID.GiantFungiBulb: - return CalamityGlobalAI.BuffedPlantAI(npc, mod); + return CalamityGlobalAI.BuffedPlantAI(npc, Mod); } break; case 14: if (npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType()) { - return CalamityGlobalAI.BuffedBatAI(npc, mod); + return CalamityGlobalAI.BuffedBatAI(npc, Mod); } else { @@ -3142,7 +3142,7 @@ namespace CalamityMod.NPCs case NPCID.RedDevil: case NPCID.FlyingSnake: case NPCID.VampireBat: - return CalamityGlobalAI.BuffedBatAI(npc, mod); + return CalamityGlobalAI.BuffedBatAI(npc, Mod); } } break; @@ -3156,7 +3156,7 @@ namespace CalamityMod.NPCs case NPCID.Arapaima: case NPCID.BloodFeeder: case NPCID.CrimsonGoldfish: - return CalamityGlobalAI.BuffedSwimmingAI(npc, mod); + return CalamityGlobalAI.BuffedSwimmingAI(npc, Mod); } break; case 18: @@ -3168,28 +3168,28 @@ namespace CalamityMod.NPCs case NPCID.Squid: case NPCID.BloodJelly: case NPCID.FungoFish: - return CalamityGlobalAI.BuffedJellyfishAI(npc, mod); + return CalamityGlobalAI.BuffedJellyfishAI(npc, Mod); } break; case 19: switch (npc.type) { case NPCID.Antlion: - return CalamityGlobalAI.BuffedAntlionAI(npc, mod); + return CalamityGlobalAI.BuffedAntlionAI(npc, Mod); } break; case 20: switch (npc.type) { case NPCID.SpikeBall: - return CalamityGlobalAI.BuffedSpikeBallAI(npc, mod); + return CalamityGlobalAI.BuffedSpikeBallAI(npc, Mod); } break; case 21: switch (npc.type) { case NPCID.BlazingWheel: - return CalamityGlobalAI.BuffedBlazingWheelAI(npc, mod); + return CalamityGlobalAI.BuffedBlazingWheelAI(npc, Mod); } break; case 22: @@ -3205,7 +3205,7 @@ namespace CalamityMod.NPCs case NPCID.Poltergeist: case NPCID.Drippler: case NPCID.Reaper: - return CalamityGlobalAI.BuffedHoveringAI(npc, mod); + return CalamityGlobalAI.BuffedHoveringAI(npc, Mod); } break; case 23: @@ -3214,7 +3214,7 @@ namespace CalamityMod.NPCs case NPCID.CursedHammer: case NPCID.EnchantedSword: case NPCID.CrimsonAxe: - return CalamityGlobalAI.BuffedFlyingWeaponAI(npc, mod); + return CalamityGlobalAI.BuffedFlyingWeaponAI(npc, Mod); } break; case 25: @@ -3222,13 +3222,13 @@ namespace CalamityMod.NPCs { case NPCID.Mimic: case NPCID.PresentMimic: - return CalamityGlobalAI.BuffedMimicAI(npc, mod); + return CalamityGlobalAI.BuffedMimicAI(npc, Mod); } break; case 26: if (npc.type == NPCType()) { - return CalamityGlobalAI.BuffedUnicornAI(npc, mod); + return CalamityGlobalAI.BuffedUnicornAI(npc, Mod); } else { @@ -3241,14 +3241,14 @@ namespace CalamityMod.NPCs case NPCID.StardustSpiderSmall: case NPCID.NebulaBeast: case NPCID.Tumbleweed: - return CalamityGlobalAI.BuffedUnicornAI(npc, mod); + return CalamityGlobalAI.BuffedUnicornAI(npc, Mod); } } break; case 39: if (npc.type == NPCType() || npc.type == NPCType()) { - return CalamityGlobalAI.BuffedTortoiseAI(npc, mod); + return CalamityGlobalAI.BuffedTortoiseAI(npc, Mod); } else { @@ -3259,7 +3259,7 @@ namespace CalamityMod.NPCs case NPCID.GiantShelly: case NPCID.GiantShelly2: case NPCID.SolarSroller: - return CalamityGlobalAI.BuffedTortoiseAI(npc, mod); + return CalamityGlobalAI.BuffedTortoiseAI(npc, Mod); } } break; @@ -3271,13 +3271,13 @@ namespace CalamityMod.NPCs case NPCID.JungleCreeperWall: case NPCID.BloodCrawlerWall: case NPCID.DesertScorpionWall: - return CalamityGlobalAI.BuffedSpiderAI(npc, mod); + return CalamityGlobalAI.BuffedSpiderAI(npc, Mod); } break; case 41: if (npc.type == NPCType()) { - return CalamityGlobalAI.BuffedHerplingAI(npc, mod); + return CalamityGlobalAI.BuffedHerplingAI(npc, Mod); } else { @@ -3285,7 +3285,7 @@ namespace CalamityMod.NPCs { case NPCID.Herpling: case NPCID.Derpling: - return CalamityGlobalAI.BuffedHerplingAI(npc, mod); + return CalamityGlobalAI.BuffedHerplingAI(npc, Mod); } } break; @@ -3294,14 +3294,14 @@ namespace CalamityMod.NPCs { case NPCID.FlyingFish: case NPCID.FlyingAntlion: - return CalamityGlobalAI.BuffedFlyingFishAI(npc, mod); + return CalamityGlobalAI.BuffedFlyingFishAI(npc, Mod); } break; case 49: switch (npc.type) { case NPCID.AngryNimbus: - return CalamityGlobalAI.BuffedAngryNimbusAI(npc, mod); + return CalamityGlobalAI.BuffedAngryNimbusAI(npc, Mod); } break; case 50: @@ -3309,14 +3309,14 @@ namespace CalamityMod.NPCs { case NPCID.FungiSpore: case NPCID.Spore: - return CalamityGlobalAI.BuffedSporeAI(npc, mod); + return CalamityGlobalAI.BuffedSporeAI(npc, Mod); } break; case 73: switch (npc.type) { case NPCID.MartianTurret: - return CalamityGlobalAI.BuffedTeslaTurretAI(npc, mod); + return CalamityGlobalAI.BuffedTeslaTurretAI(npc, Mod); } break; case 74: @@ -3324,34 +3324,34 @@ namespace CalamityMod.NPCs { case NPCID.MartianDrone: case NPCID.SolarCorite: - return CalamityGlobalAI.BuffedCoriteAI(npc, mod); + return CalamityGlobalAI.BuffedCoriteAI(npc, Mod); } break; case 80: switch (npc.type) { case NPCID.MartianProbe: - return CalamityGlobalAI.BuffedMartianProbeAI(npc, mod); + return CalamityGlobalAI.BuffedMartianProbeAI(npc, Mod); } break; case 89: switch (npc.type) { case NPCID.MothronEgg: - return CalamityGlobalAI.BuffedMothronEggAI(npc, mod); + return CalamityGlobalAI.BuffedMothronEggAI(npc, Mod); } break; case 91: if (npc.type == NPCType()) { - return CalamityGlobalAI.BuffedGraniteElementalAI(npc, mod); + return CalamityGlobalAI.BuffedGraniteElementalAI(npc, Mod); } else { switch (npc.type) { case NPCID.GraniteFlyer: - return CalamityGlobalAI.BuffedGraniteElementalAI(npc, mod); + return CalamityGlobalAI.BuffedGraniteElementalAI(npc, Mod); } } break; @@ -3362,7 +3362,7 @@ namespace CalamityMod.NPCs else if (Main.expertMode) { if (npc.type == NPCID.FungiSpore || npc.type == NPCID.Spore) - return CalamityGlobalAI.BuffedSporeAI(npc, mod); + return CalamityGlobalAI.BuffedSporeAI(npc, Mod); } if (npc.type == NPCID.DD2LanePortal) @@ -3912,7 +3912,7 @@ namespace CalamityMod.NPCs Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - MakeTownNPCsTakeMoreDamage(npc, projectile, mod, ref damage); + MakeTownNPCsTakeMoreDamage(npc, projectile, Mod, ref damage); // Supercrits var cgp = projectile.Calamity(); @@ -3920,13 +3920,13 @@ namespace CalamityMod.NPCs { int critOver100 = 0; if (projectile.melee) - critOver100 = player.meleeCrit - 100; + critOver100 = player.GetCritChance(DamageClass.Melee) - 100; else if (projectile.ranged) - critOver100 = player.rangedCrit - 100; + critOver100 = player.GetCritChance(DamageClass.Ranged) - 100; else if (projectile.magic) - critOver100 = player.magicCrit - 100; + critOver100 = player.GetCritChance(DamageClass.Magic) - 100; else if (projectile.thrown) // Also covers rogue - critOver100 = player.thrownCrit - 100; + critOver100 = player.GetCritChance(DamageClass.Throwing) - 100; // Supercrits can "supercrit" over and over for each extra 100% critical strike chance. // For example if you have 716% critical strike chance, you are guaranteed +700% damage and then have a 16% chance for +800% damage instead. @@ -4080,7 +4080,7 @@ namespace CalamityMod.NPCs { int maxValue = Main.expertMode ? 4 : 6; - if (Main.rand.NextBool(maxValue) && Main.wallDungeon[Main.tile[(int)npc.Center.X / 16, (int)npc.Center.Y / 16].wall]) + if (Main.rand.NextBool(maxValue) && Main.wallDungeon[Main.tile[(int)npc.Center.X / 16, (int)npc.Center.Y / 16].WallType]) { int randomType = Utils.SelectRandom(Main.rand, new int[] { @@ -4370,8 +4370,8 @@ namespace CalamityMod.NPCs nearLab |= CalamityUtils.ManhattanDistance(checkPosition, CalamityWorld.HellLabCenter / 16f) < 180f; nearLab |= CalamityUtils.ManhattanDistance(checkPosition, CalamityWorld.IceLabCenter / 16f) < 180f; - bool isLabWall = aboveSpawnTile.wall == WallType() || aboveSpawnTile.wall == WallType() || aboveSpawnTile.wall == WallType(); - isLabWall |= aboveSpawnTile.wall == WallType() || aboveSpawnTile.wall == WallType() || aboveSpawnTile.wall == WallType(); + bool isLabWall = aboveSpawnTile.WallType == WallType() || aboveSpawnTile.WallType == WallType() || aboveSpawnTile.WallType == WallType(); + isLabWall |= aboveSpawnTile.WallType == WallType() || aboveSpawnTile.WallType == WallType() || aboveSpawnTile.WallType == WallType(); if (!isLabWall || !nearLab || Collision.SolidCollision((checkPosition - new Vector2(2f, 2f)).ToWorldCoordinates(), 4, 4) || player.activeNPCs >= maxSpawnCount || !Main.rand.NextBool(spawnRate)) continue; @@ -4395,14 +4395,14 @@ namespace CalamityMod.NPCs public override void EditSpawnPool(IDictionary pool, NPCSpawnInfo spawnInfo) { - bool calamityBiomeZone = spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneCalamity || - spawnInfo.player.Calamity().ZoneSulphur || - spawnInfo.player.Calamity().ZoneSunkenSea || - (spawnInfo.player.Calamity().ZoneAstral && !NPC.LunarApocalypseIsUp); + bool calamityBiomeZone = spawnInfo.Player.Calamity().ZoneAbyss || + spawnInfo.Player.Calamity().ZoneCalamity || + spawnInfo.Player.Calamity().ZoneSulphur || + spawnInfo.Player.Calamity().ZoneSunkenSea || + (spawnInfo.Player.Calamity().ZoneAstral && !NPC.LunarApocalypseIsUp); // Spawn Green Jellyfish in prehm and Blue Jellyfish in hardmode - if (spawnInfo.player.ZoneRockLayerHeight && spawnInfo.water && !calamityBiomeZone) + if (spawnInfo.Player.ZoneRockLayerHeight && spawnInfo.water && !calamityBiomeZone) { if (!Main.hardMode) pool[NPCID.GreenJellyfish] = SpawnCondition.CaveJellyfish.Chance * 0.5f; @@ -4411,7 +4411,7 @@ namespace CalamityMod.NPCs } // Add Truffle Worm spawns to surface mushroom biome - if (spawnInfo.player.ZoneGlowshroom && Main.hardMode && (spawnInfo.player.ZoneOverworldHeight || spawnInfo.player.ZoneSkyHeight)) + if (spawnInfo.Player.ZoneGlowshroom && Main.hardMode && (spawnInfo.Player.ZoneOverworldHeight || spawnInfo.Player.ZoneSkyHeight)) { if (NPC.CountNPCS(NPCID.TruffleWorm) < 2) pool[NPCID.TruffleWorm] = SpawnCondition.OverworldMushroom.Chance * 0.5f; @@ -4422,7 +4422,7 @@ namespace CalamityMod.NPCs pool[0] = 0f; } - if (spawnInfo.player.Calamity().ZoneSulphur && !spawnInfo.player.Calamity().ZoneAbyss && CalamityWorld.rainingAcid) + if (spawnInfo.Player.Calamity().ZoneSulphur && !spawnInfo.Player.Calamity().ZoneAbyss && CalamityWorld.rainingAcid) { pool.Clear(); @@ -4498,13 +4498,13 @@ namespace CalamityMod.NPCs if (spawnInfo.playerSafe) return; - if (!Main.hardMode && spawnInfo.player.ZoneUnderworldHeight && !calamityBiomeZone) + if (!Main.hardMode && spawnInfo.Player.ZoneUnderworldHeight && !calamityBiomeZone) { if (!NPC.AnyNPCs(NPCID.VoodooDemon)) pool[NPCID.VoodooDemon] = SpawnCondition.Underworld.Chance * 0.75f; } - if (spawnInfo.player.Calamity().disableVoodooSpawns && pool.ContainsKey(NPCID.VoodooDemon)) + if (spawnInfo.Player.Calamity().disableVoodooSpawns && pool.ContainsKey(NPCID.VoodooDemon)) pool.Remove(NPCID.VoodooDemon); } #endregion @@ -5040,7 +5040,7 @@ namespace CalamityMod.NPCs } } - TownNPCAlertSystem(npc, mod, spriteBatch); + TownNPCAlertSystem(npc, Mod, spriteBatch); if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { @@ -6000,7 +6000,7 @@ namespace CalamityMod.NPCs return; } - if (Main.tile[i, j].wall > 0) + if (Main.tile[i, j].WallType > 0) { flag = true; } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 09986773f9..e0cb20bf16 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -22,6 +22,7 @@ using System.Threading; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs { @@ -33,14 +34,14 @@ namespace CalamityMod.NPCs // No bosses drop loot in Boss Rush. Progress the event instead. if (BossRushEvent.BossRushActive) { - BossRushEvent.OnBossKill(npc, mod); + BossRushEvent.OnBossKill(npc, Mod); return false; } - if (AbyssLootCancel(npc, mod)) + if (AbyssLootCancel(npc, Mod)) return false; - if (CalamityWorld.death && !SplittingWormLootBlockWrapper(npc, mod)) + if (CalamityWorld.death && !SplittingWormLootBlockWrapper(npc, Mod)) return false; // Do not provide free hearts for certain boss NPCs in Rev+. @@ -820,7 +821,7 @@ namespace CalamityMod.NPCs { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); } diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index d8345bacf9..06b4e34bfb 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -15,6 +15,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using System.IO; +using Terraria.Audio; namespace CalamityMod.NPCs.CeaselessVoid { @@ -24,28 +25,28 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void SetStaticDefaults() { DisplayName.SetDefault("Ceaseless Void"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 36f; - npc.width = 100; - npc.height = 100; - npc.defense = 80; - CalamityGlobalNPC global = npc.Calamity(); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 36f; + NPC.width = 100; + NPC.height = 100; + NPC.defense = 80; + CalamityGlobalNPC global = NPC.Calamity(); global.DR = 0.5f; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1; - npc.LifeMaxNERB(notDoGFight ? 64400 : 16100, notDoGFight ? 77280 : 19320, 72000); + NPC.LifeMaxNERB(notDoGFight ? 64400 : 16100, notDoGFight ? 77280 : 19320, 72000); // If fought alone, Ceaseless Void plays its own theme if (notDoGFight) { - npc.value = Item.buyPrice(2, 0, 0, 0); + NPC.value = Item.buyPrice(2, 0, 0, 0); music = CalamityMod.Instance.GetMusicFromMusicMod("Void") ?? MusicID.Boss3; } // If fought as a DoG interlude, keep the DoG music playing @@ -53,51 +54,51 @@ namespace CalamityMod.NPCs.CeaselessVoid music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.boss = true; - npc.DeathSound = SoundID.NPCDeath14; + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.boss = true; + NPC.DeathSound = SoundID.NPCDeath14; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - CalamityAI.CeaselessVoidAI(npc, mod); + CalamityAI.CeaselessVoidAI(NPC, Mod); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -106,10 +107,10 @@ namespace CalamityMod.NPCs.CeaselessVoid Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -125,11 +126,11 @@ namespace CalamityMod.NPCs.CeaselessVoid public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 7; @@ -140,21 +141,21 @@ namespace CalamityMod.NPCs.CeaselessVoid { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/CeaselessVoid/CeaselessVoidGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/CeaselessVoidGlow"); Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -164,14 +165,14 @@ namespace CalamityMod.NPCs.CeaselessVoid Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -182,34 +183,34 @@ namespace CalamityMod.NPCs.CeaselessVoid bool fullStrength = !CalamityWorld.downedSentinel1 || CalamityWorld.DoGSecondStageCountdown <= 0; if (fullStrength) { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); bool lastSentinelKilled = !CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, lastSentinelKilled); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, lastSentinelKilled); if (!Main.expertMode) { // Materials - DropHelper.DropItem(npc, ModContent.ItemType(), true, 2, 3); + DropHelper.DropItem(NPC, ModContent.ItemType(), true, 2, 3); // Weapons float dropChance = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropItemChance(npc, ModContent.ItemType(), dropChance); - DropHelper.DropItemChance(npc, ModContent.ItemType(), dropChance); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), dropChance); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), dropChance); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); if (Main.rand.NextBool(20)) { - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); } } } @@ -220,7 +221,7 @@ namespace CalamityMod.NPCs.CeaselessVoid CalamityWorld.DoGSecondStageCountdown = 14460; if (Main.netMode == NetmodeID.Server) { - var netMessage = mod.GetPacket(); + var netMessage = Mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); @@ -237,7 +238,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); } public override void BossLoot(ref string name, ref int potionType) @@ -247,29 +248,29 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 8; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), npc.Center); + NPC.soundDelay = 8; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), NPC.Center); } for (int k = 0; k < 5; k++) { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); Main.dust[dust].noGravity = true; } - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 100; + NPC.height = 100; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -280,20 +281,20 @@ namespace CalamityMod.NPCs.CeaselessVoid } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 2f; } float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/CeaselessVoid"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/CeaselessVoid2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/CeaselessVoid2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/CeaselessVoid3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/CeaselessVoid3"), 1f); } } } diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index d4d4644af8..4078c6248a 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -22,38 +22,38 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void SetStaticDefaults() { DisplayName.SetDefault("Dark Energy"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.aiStyle = -1; aiType = -1; - npc.GetNPCDamage(); - npc.dontTakeDamage = true; - npc.width = 80; - npc.height = 80; - npc.defense = 50; - npc.lifeMax = 3000; + NPC.GetNPCDamage(); + NPC.dontTakeDamage = true; + NPC.width = 80; + NPC.height = 80; + NPC.defense = 50; + NPC.lifeMax = 3000; if (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) { - npc.lifeMax = 12000; + NPC.lifeMax = 12000; } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 4400; + NPC.lifeMax = 4400; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - npc.Calamity().VulnerableToSickness = false; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit53; + NPC.DeathSound = SoundID.NPCDeath44; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) @@ -61,9 +61,9 @@ namespace CalamityMod.NPCs.CeaselessVoid writer.Write(invinceTime); writer.Write(start); writer.Write(distance); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -71,17 +71,17 @@ namespace CalamityMod.NPCs.CeaselessVoid invinceTime = reader.ReadInt32(); start = reader.ReadBoolean(); distance = reader.ReadDouble(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() @@ -90,32 +90,32 @@ namespace CalamityMod.NPCs.CeaselessVoid if (start) { start = false; - npc.ai[3] = npc.ai[0]; + NPC.ai[3] = NPC.ai[0]; } // Stay invincible for 3 seconds to avoid being instantly killed if (invinceTime > 0) { - npc.damage = 0; + NPC.damage = 0; invinceTime--; } else { - npc.damage = npc.defDamage; - npc.dontTakeDamage = false; + NPC.damage = NPC.defDamage; + NPC.dontTakeDamage = false; } // Force despawn if Ceaseless Void isn't active if (CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } // Set time left just in case something dumb happens with despawning - if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -129,14 +129,14 @@ namespace CalamityMod.NPCs.CeaselessVoid // Distance from Ceaseless Void double maxDistance = malice ? 1200D : death ? 1040D : revenge ? 960D : expertMode ? 880D : minMaxDistance; double rateOfChangeIncrease = (maxDistance / minMaxDistance) - 1D; - double rateOfChange = (npc.ai[1] * 0.5f) + 2D + (tileEnrageMult - 1f) + rateOfChangeIncrease; - if (npc.Calamity().newAI[0] == 0f) + double rateOfChange = (NPC.ai[1] * 0.5f) + 2D + (tileEnrageMult - 1f) + rateOfChangeIncrease; + if (NPC.Calamity().newAI[0] == 0f) { distance += rateOfChange; if (distance >= maxDistance) { distance = maxDistance; - npc.Calamity().newAI[0] = 1f; + NPC.Calamity().newAI[0] = 1f; } } else @@ -145,42 +145,42 @@ namespace CalamityMod.NPCs.CeaselessVoid if (distance <= minDistance) { distance = minDistance; - npc.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[0] = 0f; } } // Rotation velocity float minRotationVelocity = 0.5f + tileEnrageMult - 1f; float rotationVelocityIncrease = death ? 0.2f : revenge ? 0.15f : expertMode ? 0.1f : 0f; - rotationVelocityIncrease += rotationVelocityIncrease * (npc.ai[1] * 0.5f); + rotationVelocityIncrease += rotationVelocityIncrease * (NPC.ai[1] * 0.5f); // Rotate around Ceaseless Void NPC parent = Main.npc[NPC.FindFirstNPC(ModContent.NPCType())]; - double degrees = npc.ai[3]; + double degrees = NPC.ai[3]; double radians = degrees * (Math.PI / 180); - npc.position.X = parent.Center.X - (int)(Math.Cos(radians) * distance) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(radians) * distance) - npc.height / 2; - npc.ai[3] += minRotationVelocity + rotationVelocityIncrease; + NPC.position.X = parent.Center.X - (int)(Math.Cos(radians) * distance) - NPC.width / 2; + NPC.position.Y = parent.Center.Y - (int)(Math.Sin(radians) * distance) - NPC.height / 2; + NPC.ai[3] += minRotationVelocity + rotationVelocityIncrease; // Flash and pulse effect - if (npc.ai[2] == 0f) + if (NPC.ai[2] == 0f) { - npc.scale -= 0.01f; - npc.alpha += 15; - if (npc.alpha >= 125) + NPC.scale -= 0.01f; + NPC.alpha += 15; + if (NPC.alpha >= 125) { - npc.alpha = 130; - npc.ai[2] = 1f; + NPC.alpha = 130; + NPC.ai[2] = 1f; } } else { - npc.scale += 0.01f; - npc.alpha -= 15; - if (npc.alpha <= 0) + NPC.scale += 0.01f; + NPC.alpha -= 15; + if (NPC.alpha <= 0) { - npc.alpha = 0; - npc.ai[2] = 0f; + NPC.alpha = 0; + NPC.ai[2] = 0f; } } } @@ -188,19 +188,19 @@ namespace CalamityMod.NPCs.CeaselessVoid public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Texture2D texture2D16 = ModContent.GetTexture("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow2"); - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow2"); + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); if (CalamityConfig.Instance.Afterimages) { @@ -208,18 +208,18 @@ namespace CalamityMod.NPCs.CeaselessVoid { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow"); Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); Color color42 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); @@ -229,31 +229,31 @@ namespace CalamityMod.NPCs.CeaselessVoid { Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); - color41 = npc.GetAlpha(color41); + color41 = NPC.GetAlpha(color41); color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); Color color43 = color42; color43 = Color.Lerp(color43, color36, amount9); - color43 = npc.GetAlpha(color43); + color43 = NPC.GetAlpha(color43); color43 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture2D16, vector44, npc.frame, color43, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.5f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.5f * bossLifeScale); } public override bool CheckActive() => false; @@ -269,10 +269,10 @@ namespace CalamityMod.NPCs.CeaselessVoid Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -289,11 +289,11 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); Main.dust[dust].noGravity = true; } } diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index e8a7d60218..8c5c1f39a5 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -13,94 +13,94 @@ namespace CalamityMod.NPCs.Crabulon public override void SetStaticDefaults() { DisplayName.SetDefault("Crab Shroom"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.aiStyle = -1; - npc.GetNPCDamage(); - npc.width = 14; - npc.height = 14; - npc.lifeMax = 25; + NPC.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 14; + NPC.height = 14; + NPC.lifeMax = 25; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 15000; + NPC.lifeMax = 15000; } aiType = -1; - npc.knockBackResist = 0.75f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.knockBackResist = 0.75f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0.2f, 0.4f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0f, 0.2f, 0.4f); bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; float xVelocityLimit = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 7.5f : 5f; float yVelocityLimit = revenge ? 1.25f : 1f; - Player player = Main.player[npc.target]; - npc.velocity.Y += 0.02f; - if (npc.velocity.Y > yVelocityLimit) + Player player = Main.player[NPC.target]; + NPC.velocity.Y += 0.02f; + if (NPC.velocity.Y > yVelocityLimit) { - npc.velocity.Y = yVelocityLimit; + NPC.velocity.Y = yVelocityLimit; } - npc.TargetClosest(); - if (npc.position.X + npc.width < player.position.X) + NPC.TargetClosest(); + if (NPC.position.X + NPC.width < player.position.X) { - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.velocity.X *= 0.98f; + NPC.velocity.X *= 0.98f; } - npc.velocity.X += 0.1f; + NPC.velocity.X += 0.1f; } - else if (npc.position.X > player.position.X + player.width) + else if (NPC.position.X > player.position.X + player.width) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X *= 0.98f; + NPC.velocity.X *= 0.98f; } - npc.velocity.X -= 0.1f; + NPC.velocity.X -= 0.1f; } - if (npc.velocity.X > xVelocityLimit || npc.velocity.X < -xVelocityLimit) + if (NPC.velocity.X > xVelocityLimit || NPC.velocity.X < -xVelocityLimit) { - npc.velocity.X *= 0.97f; + NPC.velocity.X *= 0.97f; } - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Crabulon/CrabShroomGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabShroomGlow"); Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -109,9 +109,9 @@ namespace CalamityMod.NPCs.Crabulon { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(8) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } return false; @@ -121,13 +121,13 @@ namespace CalamityMod.NPCs.Crabulon { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 56, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 56, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index dd3888415f..d9321e646a 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -18,6 +18,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Crabulon { [AutoloadBossHead] @@ -29,111 +30,111 @@ namespace CalamityMod.NPCs.Crabulon public override void SetStaticDefaults() { DisplayName.SetDefault("Crabulon"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 14f; - npc.GetNPCDamage(); - npc.width = 196; - npc.height = 196; - npc.defense = 8; - npc.LifeMaxNERB(3350, 4000, 1100000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 14f; + NPC.GetNPCDamage(); + NPC.width = 196; + NPC.height = 196; + NPC.defense = 8; + NPC.LifeMaxNERB(3350, 4000, 1100000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.noGravity = false; - npc.noTileCollide = false; + NPC.noGravity = false; + NPC.noTileCollide = false; music = CalamityMod.Instance.GetMusicFromMusicMod("Crabulon") ?? MusicID.Boss4; - npc.boss = true; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 10, 0, 0); - npc.HitSound = SoundID.NPCHit45; - npc.DeathSound = SoundID.NPCDeath1; + NPC.boss = true; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 10, 0, 0); + NPC.HitSound = SoundID.NPCHit45; + NPC.DeathSound = SoundID.NPCDeath1; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(biomeEnrageTimer); - writer.Write(npc.localAI[0]); + writer.Write(NPC.localAI[0]); writer.Write(shotSpacing); } public override void ReceiveExtraAI(BinaryReader reader) { biomeEnrageTimer = reader.ReadInt32(); - npc.localAI[0] = reader.ReadSingle(); + NPC.localAI[0] = reader.ReadSingle(); shotSpacing = reader.ReadInt32(); } public override void AI() { - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0.3f, 0.7f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0f, 0.3f, 0.7f); bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - npc.spriteDirection = npc.direction; + NPC.spriteDirection = NPC.direction; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Phases bool phase2 = lifeRatio < 0.66f && expertMode; bool phase3 = lifeRatio < 0.33f && expertMode; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; if (!player.active || player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (!player.active || player.dead) { - npc.noTileCollide = true; + NPC.noTileCollide = true; - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - npc.velocity.Y += 0.1f; - if (npc.velocity.Y > 12f) - npc.velocity.Y = 12f; + if (NPC.velocity.Y < -3f) + NPC.velocity.Y = -3f; + NPC.velocity.Y += 0.1f; + if (NPC.velocity.Y > 12f) + NPC.velocity.Y = 12f; - if (npc.timeLeft > 60) - npc.timeLeft = 60; + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; - if (npc.ai[0] != 1f) + if (NPC.ai[0] != 1f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; shotSpacing = 1000; - npc.netUpdate = true; + NPC.netUpdate = true; } return; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; // Enrage - if ((!player.ZoneGlowshroom || (npc.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) + if ((!player.ZoneGlowshroom || (NPC.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) { if (biomeEnrageTimer > 0) biomeEnrageTimer--; @@ -144,56 +145,56 @@ namespace CalamityMod.NPCs.Crabulon bool biomeEnraged = biomeEnrageTimer <= 0 || malice; float enrageScale = BossRushEvent.BossRushActive ? 1f : 0f; - if (biomeEnraged && ((npc.position.Y / 16f) < Main.worldSurface || malice)) + if (biomeEnraged && ((NPC.position.Y / 16f) < Main.worldSurface || malice)) { - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; } if (biomeEnraged && (!player.ZoneGlowshroom || malice)) { - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; } - if (npc.ai[0] != 0f && npc.ai[0] < 3f) + if (NPC.ai[0] != 0f && NPC.ai[0] < 3f) { - Vector2 vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector34 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num349 = player.position.X + (player.width / 2) - vector34.X; float num350 = player.position.Y + (player.height / 2) - vector34.Y; float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); if (Main.netMode != NetmodeID.MultiplayerClient) { int num352 = 1; - npc.localAI[3] += 2f; + NPC.localAI[3] += 2f; if (phase2) { - npc.localAI[3] += 1f; + NPC.localAI[3] += 1f; num352 += 2; } if (phase3) { - npc.localAI[3] += 2f; + NPC.localAI[3] += 2f; num352 += 3; } - if (npc.ai[3] == 0f) + if (NPC.ai[3] == 0f) { - if (npc.localAI[3] > 600f) + if (NPC.localAI[3] > 600f) { - npc.ai[3] = 1f; - npc.localAI[3] = 0f; + NPC.ai[3] = 1f; + NPC.localAI[3] = 0f; } } - else if (npc.localAI[3] > 45f) + else if (NPC.localAI[3] > 45f) { - npc.localAI[3] = 0f; - npc.ai[3] += 1f; - if (npc.ai[3] >= num352) + NPC.localAI[3] = 0f; + NPC.ai[3] += 1f; + if (NPC.ai[3] >= num352) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; } float num353 = 10f; int type = ModContent.ProjectileType(); - Main.PlaySound(SoundID.Item42, (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(SoundID.Item42, (int)NPC.position.X, (int)NPC.position.Y); if (phase2) { num353 += 1f; @@ -202,7 +203,7 @@ namespace CalamityMod.NPCs.Crabulon { num353 += 1f; } - vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + vector34 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); num349 = player.position.X + player.width * 0.5f - vector34.X; num350 = player.position.Y + player.height * 0.5f - vector34.Y; num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); @@ -211,43 +212,43 @@ namespace CalamityMod.NPCs.Crabulon num350 *= num351; vector34.X += num349; vector34.Y += num350; - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350 - 5f, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350 - 5f, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, 0f); } } } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { if (Main.netMode != NetmodeID.Server) { - if (!player.dead && player.active && (player.Center - npc.Center).Length() < 800f) + if (!player.dead && player.active && (player.Center - NPC.Center).Length() < 800f) player.AddBuff(ModContent.BuffType(), 2); } - int sporeDust = Dust.NewDust(npc.position, npc.width, npc.height, 56, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), 1.2f); + int sporeDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 56, NPC.velocity.X, NPC.velocity.Y, 255, new Color(0, 80, 255, 80), 1.2f); Main.dust[sporeDust].noGravity = true; Main.dust[sporeDust].velocity *= 0.5f; - npc.ai[1] += 1f; - if (npc.justHit) + NPC.ai[1] += 1f; + if (NPC.justHit) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - npc.velocity *= 0.98f; - npc.ai[1] += 1f; - if (npc.ai[1] >= (death ? 5f : revenge ? 10f : 15f)) + NPC.velocity *= 0.98f; + NPC.ai[1] += 1f; + if (NPC.ai[1] >= (death ? 5f : revenge ? 10f : 15f)) { - npc.TargetClosest(); - npc.noGravity = true; - npc.noTileCollide = true; - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.TargetClosest(); + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.ai[0] = 2f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { float num823 = 1f; if (phase2) @@ -259,135 +260,135 @@ namespace CalamityMod.NPCs.Crabulon num823 += 4f * enrageScale; bool flag51 = false; - if (Math.Abs(npc.Center.X - player.Center.X) < 50f) + if (Math.Abs(NPC.Center.X - player.Center.X) < 50f) flag51 = true; if (flag51) { - npc.velocity.X *= 0.9f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; + NPC.velocity.X *= 0.9f; + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; } else { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; - if (npc.direction > 0) - npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; - if (npc.direction < 0) - npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; + if (NPC.direction > 0) + NPC.velocity.X = (NPC.velocity.X * 20f + num823) / 21f; + if (NPC.direction < 0) + NPC.velocity.X = (NPC.velocity.X * 20f - num823) / 21f; } - if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height) && player.position.Y <= npc.position.Y + npc.height) + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && player.position.Y <= NPC.position.Y + NPC.height) { - npc.noGravity = false; - npc.noTileCollide = false; + NPC.noGravity = false; + NPC.noTileCollide = false; } else { - npc.noGravity = true; - npc.noTileCollide = true; + NPC.noGravity = true; + NPC.noTileCollide = true; int num854 = 80; int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (num854 / 2), npc.position.Y + npc.height - num855); + Vector2 position2 = new Vector2(NPC.Center.X - (num854 / 2), NPC.position.Y + NPC.height - num855); - bool fallDownOnTopOfTarget = npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f; + bool fallDownOnTopOfTarget = NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width && NPC.position.Y + NPC.height < player.position.Y + player.height - 16f; if (fallDownOnTopOfTarget) { - npc.velocity.Y += 0.5f; + NPC.velocity.Y += 0.5f; } else if (Collision.SolidCollision(position2, num854, num855)) { - if (npc.velocity.Y > 0f) - npc.velocity.Y = 0f; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y = 0f; - if (npc.velocity.Y > -0.2f) - npc.velocity.Y -= 0.025f; + if (NPC.velocity.Y > -0.2f) + NPC.velocity.Y -= 0.025f; else - npc.velocity.Y -= 0.2f; + NPC.velocity.Y -= 0.2f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; + if (NPC.velocity.Y < -4f) + NPC.velocity.Y = -4f; } else { - if (npc.velocity.Y < 0f) - npc.velocity.Y = 0f; + if (NPC.velocity.Y < 0f) + NPC.velocity.Y = 0f; - if (npc.velocity.Y < 0.1f) - npc.velocity.Y += 0.025f; + if (NPC.velocity.Y < 0.1f) + NPC.velocity.Y += 0.025f; else - npc.velocity.Y += 0.5f; + NPC.velocity.Y += 0.5f; } } - npc.ai[1] += 1f; - if (npc.ai[1] >= (360f - (death ? 120f * (1f - lifeRatio) : 0f))) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= (360f - (death ? 120f * (1f - lifeRatio) : 0f))) { - npc.TargetClosest(); - npc.noGravity = false; - npc.noTileCollide = false; - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.TargetClosest(); + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.ai[0] = 3f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } - if (npc.velocity.Y > 10f) - npc.velocity.Y = 10f; + if (NPC.velocity.Y > 10f) + NPC.velocity.Y = 10f; } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - npc.noTileCollide = false; - if (npc.velocity.Y == 0f) + NPC.noTileCollide = false; + if (NPC.velocity.Y == 0f) { - npc.velocity.X *= 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] % 15f == 14f) - npc.netUpdate = true; + NPC.velocity.X *= 0.8f; + NPC.ai[1] += 1f; + if (NPC.ai[1] % 15f == 14f) + NPC.netUpdate = true; - if (npc.ai[1] > 0f) + if (NPC.ai[1] > 0f) { if (revenge) { - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { case 0: break; case 1: case 2: - npc.ai[1] += 3f; + NPC.ai[1] += 3f; break; case 3: - npc.ai[1] += 6f; + NPC.ai[1] += 6f; break; default: break; } } if (phase2) - npc.ai[1] += !revenge ? 4f : 1f; + NPC.ai[1] += !revenge ? 4f : 1f; if (phase3) - npc.ai[1] += !revenge ? 4f : 1f; + NPC.ai[1] += !revenge ? 4f : 1f; } float jumpGateValue = (malice ? 30f : 240f) / (enrageScale + 1f); - if (npc.ai[1] >= jumpGateValue) + if (NPC.ai[1] >= jumpGateValue) { - npc.ai[1] = -20f; + NPC.ai[1] = -20f; } - else if (npc.ai[1] == -1f) + else if (NPC.ai[1] == -1f) { int velocityX = 4; float velocityY = -12f; - float distanceBelowTarget = npc.position.Y - (player.position.Y + 80f); + float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); float speedMult = 1f; if (revenge) { - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { case 0: // Normal break; @@ -416,41 +417,41 @@ namespace CalamityMod.NPCs.Crabulon if (expertMode) { - if (player.position.Y < npc.Bottom.Y) - npc.velocity.Y = velocityY; + if (player.position.Y < NPC.Bottom.Y) + NPC.velocity.Y = velocityY; else - npc.velocity.Y = 1f; + NPC.velocity.Y = 1f; - npc.noTileCollide = true; + NPC.noTileCollide = true; } else - npc.velocity.Y = velocityY; + NPC.velocity.Y = velocityY; - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; - npc.velocity.X = velocityX * npc.direction; + NPC.velocity.X = velocityX * NPC.direction; - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } } } else { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - Main.PlaySound(SoundID.Item14, npc.position); + SoundEngine.PlaySound(SoundID.Item14, NPC.position); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); - if (npc.ai[2] % 2f == 0f && phase2 && revenge) + if (NPC.ai[2] % 2f == 0f && phase2 && revenge) { if (Main.netMode != NetmodeID.MultiplayerClient) { - float velocityX = npc.ai[2] == 0f ? -4f : 4f; + float velocityX = NPC.ai[2] == 0f ? -4f : 4f; int totalMushrooms = malice ? 50 : 20; int shotSpacingDecrement = malice ? 80 : 100; if (malice) @@ -458,7 +459,7 @@ namespace CalamityMod.NPCs.Crabulon for (int x = 0; x < totalMushrooms; x++) { - Projectile.NewProjectile(npc.Center.X + shotSpacing, npc.Center.Y - 1000f, velocityX, 0f, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.Center.X + shotSpacing, NPC.Center.Y - 1000f, velocityX, 0f, type, damage, 0f, Main.myPlayer, 0f, 0f); shotSpacing -= shotSpacingDecrement; } @@ -466,43 +467,43 @@ namespace CalamityMod.NPCs.Crabulon } } - npc.TargetClosest(); - npc.ai[2] += 1f; - if (npc.ai[2] >= (phase2 ? 4f : 3f)) + NPC.TargetClosest(); + NPC.ai[2] += 1f; + if (NPC.ai[2] >= (phase2 ? 4f : 3f)) { if (Main.netMode != NetmodeID.MultiplayerClient && revenge && !phase2) { for (int x = 0; x < 20; x++) { - Projectile.NewProjectile(npc.Center.X + shotSpacing, npc.Center.Y - 1000f, 0f, 0f, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.Center.X + shotSpacing, NPC.Center.Y - 1000f, 0f, 0f, type, damage, 0f, Main.myPlayer, 0f, 0f); shotSpacing -= 100; } shotSpacing = 1000; } - npc.ai[0] = 1f; - npc.ai[2] = 0f; + NPC.ai[0] = 1f; + NPC.ai[2] = 0f; if (revenge) - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } else { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; - npc.ai[0] = 3f; + NPC.ai[0] = 3f; if (revenge) - npc.ai[3] += 1f; + NPC.ai[3] += 1f; - npc.netUpdate = true; + NPC.netUpdate = true; } - for (int num622 = (int)npc.position.X - 20; num622 < (int)npc.position.X + npc.width + 40; num622 += 20) + for (int num622 = (int)NPC.position.X - 20; num622 < (int)NPC.position.X + NPC.width + 40; num622 += 20) { for (int num623 = 0; num623 < 4; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + npc.height), npc.width + 20, 4, 56, 0f, 0f, 100, default, 1.5f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, 56, 0f, 0f, 100, default, 1.5f); Main.dust[num624].velocity *= 0.2f; } } @@ -511,16 +512,16 @@ namespace CalamityMod.NPCs.Crabulon { if (!player.dead && expertMode) { - if ((player.position.Y > npc.Bottom.Y && npc.velocity.Y > 0f) || (player.position.Y < npc.Bottom.Y && npc.velocity.Y < 0f)) - npc.noTileCollide = true; - else if ((npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) || (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height))) - npc.noTileCollide = false; + if ((player.position.Y > NPC.Bottom.Y && NPC.velocity.Y > 0f) || (player.position.Y < NPC.Bottom.Y && NPC.velocity.Y < 0f)) + NPC.noTileCollide = true; + else if ((NPC.velocity.Y > 0f && NPC.Bottom.Y > Main.player[NPC.target].Top.Y) || (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height))) + NPC.noTileCollide = false; } - if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width) + if (NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width) { - npc.velocity.X *= 0.9f; - npc.velocity.Y += death ? 0.18f : 0.15f; + NPC.velocity.X *= 0.9f; + NPC.velocity.Y += death ? 0.18f : 0.15f; } else { @@ -530,10 +531,10 @@ namespace CalamityMod.NPCs.Crabulon (death ? 0.02f : 0f); velocityX += 0.05f * enrageScale; - if (npc.direction < 0) - npc.velocity.X -= velocityX; - else if (npc.direction > 0) - npc.velocity.X += velocityX; + if (NPC.direction < 0) + NPC.velocity.X -= velocityX; + else if (NPC.direction > 0) + NPC.velocity.X += velocityX; float num626 = 2.5f; num626 += enrageScale; @@ -549,35 +550,35 @@ namespace CalamityMod.NPCs.Crabulon { num626 += 1f; } - if (npc.velocity.X < -num626) + if (NPC.velocity.X < -num626) { - npc.velocity.X = -num626; + NPC.velocity.X = -num626; } - if (npc.velocity.X > num626) + if (NPC.velocity.X > num626) { - npc.velocity.X = num626; + NPC.velocity.X = num626; } } } } - if (npc.localAI[0] == 0f && npc.life > 0) + if (NPC.localAI[0] == 0f && NPC.life > 0) { - npc.localAI[0] = npc.lifeMax; + NPC.localAI[0] = NPC.lifeMax; } - if (npc.life > 0) + if (NPC.life > 0) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)(npc.lifeMax * 0.05); - if ((npc.life + num660) < npc.localAI[0]) + int num660 = (int)(NPC.lifeMax * 0.05); + if ((NPC.life + num660) < NPC.localAI[0]) { - npc.localAI[0] = npc.life; + NPC.localAI[0] = NPC.life; int num661 = death ? 3 : expertMode ? Main.rand.Next(2, 4) : 2; for (int num662 = 0; num662 < num661; num662++) { - int x = (int)(npc.position.X + Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 32)); + int x = (int)(NPC.position.X + Main.rand.Next(NPC.width - 32)); + int y = (int)(NPC.position.Y + Main.rand.Next(NPC.height - 32)); int num663 = ModContent.NPCType(); int num664 = NPC.NewNPC(x, y, num663); Main.npc[num664].SetDefaults(num663, -1f); @@ -596,12 +597,12 @@ namespace CalamityMod.NPCs.Crabulon // Can only hit the target if within certain distance public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - Vector2 npcCenter = npc.Center; + Vector2 npcCenter = NPC.Center; // NOTE: Right and left hitboxes are interchangeable, each hitbox is the same size and is located to the right or left of the center hitbox. - Rectangle leftHitbox = new Rectangle((int)(npcCenter.X - (npc.width / 2f) + 6f), (int)(npcCenter.Y - (npc.height / 4f)), npc.width / 4, npc.height / 2); - Rectangle bodyHitbox = new Rectangle((int)(npcCenter.X - (npc.width / 4f)), (int)(npcCenter.Y - (npc.height / 2f)), npc.width / 2, npc.height); - Rectangle rightHitbox = new Rectangle((int)(npcCenter.X + (npc.width / 4f) - 6f), (int)(npcCenter.Y - (npc.height / 4f)), npc.width / 4, npc.height / 2); + Rectangle leftHitbox = new Rectangle((int)(npcCenter.X - (NPC.width / 2f) + 6f), (int)(npcCenter.Y - (NPC.height / 4f)), NPC.width / 4, NPC.height / 2); + Rectangle bodyHitbox = new Rectangle((int)(npcCenter.X - (NPC.width / 4f)), (int)(npcCenter.Y - (NPC.height / 2f)), NPC.width / 2, NPC.height); + Rectangle rightHitbox = new Rectangle((int)(npcCenter.X + (NPC.width / 4f) - 6f), (int)(npcCenter.Y - (NPC.height / 4f)), NPC.width / 4, NPC.height / 2); Vector2 leftHitboxCenter = new Vector2(leftHitbox.X + (leftHitbox.Width / 2), leftHitbox.Y + (leftHitbox.Height / 2)); Vector2 bodyHitboxCenter = new Vector2(bodyHitbox.X + (bodyHitbox.Width / 2), bodyHitbox.Y + (bodyHitbox.Height / 2)); @@ -654,62 +655,62 @@ namespace CalamityMod.NPCs.Crabulon bool insideRightHitbox = minRightDist <= 45f; - return (insideLeftHitbox || insideBodyHitbox || insideRightHitbox) && npc.ai[0] > 1f; + return (insideLeftHitbox || insideBodyHitbox || insideRightHitbox) && NPC.ai[0] > 1f; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D glow = ModContent.GetTexture("CalamityMod/NPCs/Crabulon/CrabulonIdleGlow"); - Texture2D texture = ModContent.GetTexture("CalamityMod/NPCs/Crabulon/CrabulonIdleAlt"); - Texture2D textureGlow = ModContent.GetTexture("CalamityMod/NPCs/Crabulon/CrabulonIdleAltGlow"); - Texture2D textureAttack = ModContent.GetTexture("CalamityMod/NPCs/Crabulon/CrabulonAttack"); - Texture2D textureAttackGlow = ModContent.GetTexture("CalamityMod/NPCs/Crabulon/CrabulonAttackGlow"); + Texture2D glow = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonIdleGlow"); + Texture2D texture = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonIdleAlt"); + Texture2D textureGlow = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonIdleAltGlow"); + Texture2D textureAttack = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAttack"); + Texture2D textureAttackGlow = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAttackGlow"); - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(Main.npcTexture[npc.type].Width, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(Main.npcTexture[NPC.type].Width, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - if (npc.ai[0] > 2f) + if (NPC.ai[0] > 2f) { vector11 = new Vector2(textureAttack.Width / 2, textureAttack.Height / 2); - vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(textureAttack.Width, textureAttack.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(textureAttack.Width, textureAttack.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(textureAttack, vector43, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(textureAttack, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(textureAttackGlow, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(textureAttackGlow, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { vector11 = new Vector2(texture.Width / 2, texture.Height / 2); - vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, vector43, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(textureGlow, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(textureGlow, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } else { - spriteBatch.Draw(Main.npcTexture[npc.type], vector43, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(Main.npcTexture[NPC.type], vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(glow, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(glow, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } return false; @@ -717,23 +718,23 @@ namespace CalamityMod.NPCs.Crabulon public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedCrabulon); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedCrabulon); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { // Materials - DropHelper.DropItem(npc, ItemID.GlowingMushroom, 20, 30); - DropHelper.DropItem(npc, ItemID.MushroomGrassSeeds, 3, 6); + DropHelper.DropItem(NPC, ItemID.GlowingMushroom, 20, 30); + DropHelper.DropItem(NPC, ItemID.MushroomGrassSeeds, 3, 6); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -742,10 +743,10 @@ namespace CalamityMod.NPCs.Crabulon ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); } // Mark Crabulon as dead @@ -755,27 +756,27 @@ namespace CalamityMod.NPCs.Crabulon public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 56, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 200; - npc.height = 100; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 200; + NPC.height = 100; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -785,20 +786,20 @@ namespace CalamityMod.NPCs.Crabulon } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } float randomSpread = Main.rand.Next(-200, 200) / 100; - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon5"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon6"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon7"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/Crabulon"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/Crabulon2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/Crabulon3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/Crabulon4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/Crabulon5"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/Crabulon6"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/Crabulon7"), 1f); } } } diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index 2d6d87dc6c..0449d2b2c9 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -13,84 +13,84 @@ namespace CalamityMod.NPCs.Crags public override void SetStaticDefaults() { DisplayName.SetDefault("Calamity Eye"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.lavaImmune = true; - npc.aiStyle = 2; - npc.damage = 40; - npc.width = 30; - npc.height = 30; - npc.defense = 12; - npc.lifeMax = 140; - npc.knockBackResist = 0f; + NPC.lavaImmune = true; + NPC.aiStyle = 2; + NPC.damage = 40; + NPC.width = 30; + NPC.height = 30; + NPC.defense = 12; + NPC.lifeMax = 140; + NPC.knockBackResist = 0f; animationType = NPCID.DemonEye; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; if (CalamityWorld.downedProvidence) { - npc.damage = 80; - npc.defense = 20; - npc.lifeMax = 3000; + NPC.damage = 80; + NPC.defense = 20; + NPC.lifeMax = 3000; } - banner = npc.type; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { - if (npc.life < npc.lifeMax * 0.5) + if (NPC.life < NPC.lifeMax * 0.5) { - if (npc.direction == -1 && npc.velocity.X > -6f) + if (NPC.direction == -1 && NPC.velocity.X > -6f) { - npc.velocity.X -= 0.1f; - if (npc.velocity.X > 6f) - npc.velocity.X -= 0.1f; - else if (npc.velocity.X > 0f) - npc.velocity.X += 0.05f; - if (npc.velocity.X < -6f) - npc.velocity.X = -6f; + NPC.velocity.X -= 0.1f; + if (NPC.velocity.X > 6f) + NPC.velocity.X -= 0.1f; + else if (NPC.velocity.X > 0f) + NPC.velocity.X += 0.05f; + if (NPC.velocity.X < -6f) + NPC.velocity.X = -6f; } - else if (npc.direction == 1 && npc.velocity.X < 6f) + else if (NPC.direction == 1 && NPC.velocity.X < 6f) { - npc.velocity.X += 0.1f; - if (npc.velocity.X < -6f) - npc.velocity.X += 0.1f; - else if (npc.velocity.X < 0f) - npc.velocity.X -= 0.05f; - if (npc.velocity.X > 6f) - npc.velocity.X = 6f; + NPC.velocity.X += 0.1f; + if (NPC.velocity.X < -6f) + NPC.velocity.X += 0.1f; + else if (NPC.velocity.X < 0f) + NPC.velocity.X -= 0.05f; + if (NPC.velocity.X > 6f) + NPC.velocity.X = 6f; } - if (npc.directionY == -1 && npc.velocity.Y > -4f) + if (NPC.directionY == -1 && NPC.velocity.Y > -4f) { - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y > 4f) - npc.velocity.Y -= 0.1f; - else if (npc.velocity.Y > 0f) - npc.velocity.Y += 0.05f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; + NPC.velocity.Y -= 0.1f; + if (NPC.velocity.Y > 4f) + NPC.velocity.Y -= 0.1f; + else if (NPC.velocity.Y > 0f) + NPC.velocity.Y += 0.05f; + if (NPC.velocity.Y < -4f) + NPC.velocity.Y = -4f; } - else if (npc.directionY == 1 && npc.velocity.Y < 4f) + else if (NPC.directionY == 1 && NPC.velocity.Y < 4f) { - npc.velocity.Y += 0.1f; - if (npc.velocity.Y < -4f) - npc.velocity.Y += 0.1f; - else if (npc.velocity.Y < 0f) - npc.velocity.Y -= 0.05f; - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; + NPC.velocity.Y += 0.1f; + if (NPC.velocity.Y < -4f) + NPC.velocity.Y += 0.1f; + else if (NPC.velocity.Y < 0f) + NPC.velocity.Y -= 0.05f; + if (NPC.velocity.Y > 4f) + NPC.velocity.Y = 4f; } } if (Main.rand.NextBool(40)) { - int index = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5), DustID.Blood, npc.velocity.X, 2f, 0, new Color(), 1f); + int index = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y + NPC.height * 0.25f), NPC.width, (int)(NPC.height * 0.5), DustID.Blood, NPC.velocity.X, 2f, 0, new Color(), 1f); Main.dust[index].velocity.X *= 0.5f; Main.dust[index].velocity.Y *= 0.1f; } @@ -100,20 +100,20 @@ namespace CalamityMod.NPCs.Crags { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; + return spawnInfo.Player.Calamity().ZoneCalamity ? 0.25f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -123,10 +123,10 @@ namespace CalamityMod.NPCs.Crags public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 3, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 2, 1, 1); - DropHelper.DropItemChance(npc, ItemID.Lens, 2); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 2, 1, 1); + DropHelper.DropItemChance(NPC, ItemID.Lens, 2); } } } diff --git a/NPCs/Crags/CharredSlime.cs b/NPCs/Crags/CharredSlime.cs index 8bbd199ced..a7a19fbdb3 100644 --- a/NPCs/Crags/CharredSlime.cs +++ b/NPCs/Crags/CharredSlime.cs @@ -14,38 +14,38 @@ namespace CalamityMod.NPCs.Crags public override void SetStaticDefaults() { DisplayName.SetDefault("Charred Slime"); - Main.npcFrameCount[npc.type] = 2; + Main.npcFrameCount[NPC.type] = 2; } public override void SetDefaults() { - npc.aiStyle = 1; + NPC.aiStyle = 1; aiType = NPCID.LavaSlime; - npc.damage = 40; - npc.width = 40; - npc.height = 30; - npc.defense = 10; - npc.lifeMax = 250; - npc.knockBackResist = 0f; + NPC.damage = 40; + NPC.width = 40; + NPC.height = 30; + NPC.defense = 10; + NPC.lifeMax = 250; + NPC.knockBackResist = 0f; animationType = NPCID.CorruptSlime; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.alpha = 50; - npc.lavaImmune = true; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.alpha = 50; + NPC.lavaImmune = true; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; if (CalamityWorld.downedProvidence) { - npc.damage = 80; - npc.defense = 20; - npc.lifeMax = 3500; + NPC.damage = 80; + NPC.defense = 20; + NPC.lifeMax = 3500; } - banner = npc.type; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -54,7 +54,7 @@ namespace CalamityMod.NPCs.Crags { return 0f; } - return spawnInfo.player.Calamity().ZoneCalamity ? 0.08f : 0f; + return spawnInfo.Player.Calamity().ZoneCalamity ? 0.08f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -66,22 +66,22 @@ namespace CalamityMod.NPCs.Crags { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 10, 26); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3, 1, 1); + DropHelper.DropItem(NPC, ModContent.ItemType(), 10, 26); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3, 1, 1); } } } diff --git a/NPCs/Crags/CultistAssassin.cs b/NPCs/Crags/CultistAssassin.cs index 8dd10b22f1..6f0f76137d 100644 --- a/NPCs/Crags/CultistAssassin.cs +++ b/NPCs/Crags/CultistAssassin.cs @@ -12,41 +12,41 @@ namespace CalamityMod.NPCs.Crags public override void SetStaticDefaults() { DisplayName.SetDefault("Cultist Assassin"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.lavaImmune = true; - npc.aiStyle = 3; - npc.damage = 50; - npc.width = 18; - npc.height = 40; - npc.defense = 16; - npc.lifeMax = 80; - npc.knockBackResist = 0.5f; + NPC.lavaImmune = true; + NPC.aiStyle = 3; + NPC.damage = 50; + NPC.width = 18; + NPC.height = 40; + NPC.defense = 16; + NPC.lifeMax = 80; + NPC.knockBackResist = 0.5f; animationType = NPCID.ZombieXmas; aiType = NPCID.ChaosElemental; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath50; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath50; if (CalamityWorld.downedProvidence) { - npc.damage = 100; - npc.defense = 30; - npc.lifeMax = 3000; + NPC.damage = 100; + NPC.defense = 30; + NPC.lifeMax = 3000; } - banner = npc.type; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return (spawnInfo.player.Calamity().ZoneCalamity || spawnInfo.player.ZoneDungeon) && Main.hardMode ? 0.04f : 0f; + return (spawnInfo.Player.Calamity().ZoneCalamity || spawnInfo.Player.ZoneDungeon) && Main.hardMode ? 0.04f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -58,24 +58,24 @@ namespace CalamityMod.NPCs.Crags { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CultistAssassinGores/CultistAssassin"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CultistAssassinGores/CultistAssassin2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CultistAssassinGores/CultistAssassin3"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CultistAssassinGores/CultistAssassin"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CultistAssassinGores/CultistAssassin2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CultistAssassinGores/CultistAssassin3"), NPC.scale); } } public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 3, 1, 1); } } } diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index 2e4d8abed1..fb8f0df5c1 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -17,47 +17,47 @@ namespace CalamityMod.NPCs.Crags public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 40; - npc.width = 72; - npc.height = 72; - npc.defense = 38; - npc.DR_NERD(0.35f); - npc.lifeMax = 120; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - npc.behindTiles = true; - npc.lavaImmune = true; + NPC.damage = 40; + NPC.width = 72; + NPC.height = 72; + NPC.defense = 38; + NPC.DR_NERD(0.35f); + NPC.lifeMax = 120; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit41; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.behindTiles = true; + NPC.lavaImmune = true; if (CalamityWorld.downedProvidence) { - npc.damage = 80; - npc.defense = 50; - npc.lifeMax = 3000; + NPC.damage = 80; + NPC.defense = 50; + NPC.lifeMax = 3000; } - banner = npc.type; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { - CalamityAI.UnicornAI(npc, mod, true, CalamityWorld.death ? 6f : 4f, 5f, 0.2f); + CalamityAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 6f : 4f, 5f, 0.2f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; + return spawnInfo.Player.Calamity().ZoneCalamity ? 0.25f : 0f; } public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 3, 1, 1); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -69,16 +69,16 @@ namespace CalamityMod.NPCs.Crags { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 40; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DespairStoneGores/DespairStone"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DespairStoneGores/DespairStone2"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/DespairStoneGores/DespairStone"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/DespairStoneGores/DespairStone2"), NPC.scale); } } } diff --git a/NPCs/Crags/HeatSpirit.cs b/NPCs/Crags/HeatSpirit.cs index 64bf158a0f..23f7e84b8e 100644 --- a/NPCs/Crags/HeatSpirit.cs +++ b/NPCs/Crags/HeatSpirit.cs @@ -13,61 +13,61 @@ namespace CalamityMod.NPCs.Crags public override void SetStaticDefaults() { DisplayName.SetDefault("Heat Spirit"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.aiStyle = 86; - npc.damage = 33; - npc.width = 40; - npc.height = 40; - npc.defense = 8; - npc.lifeMax = 50; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - banner = npc.type; + NPC.aiStyle = 86; + NPC.damage = 33; + NPC.width = 40; + NPC.height = 40; + NPC.defense = 8; + NPC.lifeMax = 50; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.HitSound = SoundID.NPCHit52; + NPC.DeathSound = SoundID.NPCDeath55; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.Calamity().ZoneCalamity ? 0.125f : 0f; + return spawnInfo.Player.Calamity().ZoneCalamity ? 0.125f : 0f; } public override void FindFrame(int frameHeight) { - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.direction = -1; + NPC.direction = -1; } else { - npc.direction = 1; + NPC.direction = 1; } - if (npc.direction == 1) + if (NPC.direction == 1) { - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } - if (npc.direction == -1) + if (NPC.direction == -1) { - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } - npc.rotation = (float)Math.Atan2((double)(npc.velocity.Y * (float)npc.direction), (double)(npc.velocity.X * (float)npc.direction)); - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.rotation = (float)Math.Atan2((double)(NPC.velocity.Y * (float)NPC.direction), (double)(NPC.velocity.X * (float)NPC.direction)); + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.5f, 0f, 0.05f); + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.5f, 0f, 0.05f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -79,20 +79,20 @@ namespace CalamityMod.NPCs.Crags { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 4, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 4, 1, 1); } } } diff --git a/NPCs/Crags/Scryllar.cs b/NPCs/Crags/Scryllar.cs index 30e059fdc7..c0fb2659e4 100644 --- a/NPCs/Crags/Scryllar.cs +++ b/NPCs/Crags/Scryllar.cs @@ -19,91 +19,91 @@ namespace CalamityMod.NPCs.Crags public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 50; - npc.width = 80; - npc.height = 80; - npc.defense = 18; - npc.lifeMax = 90; - npc.alpha = 100; - npc.knockBackResist = 0.7f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit49; - npc.DeathSound = SoundID.NPCDeath51; - npc.noGravity = true; - npc.noTileCollide = true; - npc.lavaImmune = true; + NPC.damage = 50; + NPC.width = 80; + NPC.height = 80; + NPC.defense = 18; + NPC.lifeMax = 90; + NPC.alpha = 100; + NPC.knockBackResist = 0.7f; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit49; + NPC.DeathSound = SoundID.NPCDeath51; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.lavaImmune = true; if (CalamityWorld.downedProvidence) { - npc.damage = 90; - npc.defense = 30; - npc.lifeMax = 2500; + NPC.damage = 90; + NPC.defense = 30; + NPC.lifeMax = 2500; } - banner = npc.type; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + NPC.rotation = NPC.velocity.X * 0.04f; + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; bool flag19 = false; - if (npc.justHit) + if (NPC.justHit) { - npc.ai[2] = 0f; + NPC.ai[2] = 0f; } - if (npc.ai[2] >= 0f) + if (NPC.ai[2] >= 0f) { int num282 = 16; bool flag21 = false; bool flag22 = false; - if (npc.position.X > npc.ai[0] - (float)num282 && npc.position.X < npc.ai[0] + (float)num282) + if (NPC.position.X > NPC.ai[0] - (float)num282 && NPC.position.X < NPC.ai[0] + (float)num282) { flag21 = true; } - else if ((npc.velocity.X < 0f && npc.direction > 0) || (npc.velocity.X > 0f && npc.direction < 0)) + else if ((NPC.velocity.X < 0f && NPC.direction > 0) || (NPC.velocity.X > 0f && NPC.direction < 0)) { flag21 = true; } num282 += 24; - if (npc.position.Y > npc.ai[1] - (float)num282 && npc.position.Y < npc.ai[1] + (float)num282) + if (NPC.position.Y > NPC.ai[1] - (float)num282 && NPC.position.Y < NPC.ai[1] + (float)num282) { flag22 = true; } if (flag21 && flag22) { - npc.ai[2] += 1f; - if (npc.ai[2] >= 30f && num282 == 16) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 30f && num282 == 16) { flag19 = true; } - if (npc.ai[2] >= 60f) + if (NPC.ai[2] >= 60f) { - npc.ai[2] = -200f; - npc.direction *= -1; - npc.velocity.X = npc.velocity.X * -1f; - npc.collideX = false; + NPC.ai[2] = -200f; + NPC.direction *= -1; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.collideX = false; } } else { - npc.ai[0] = npc.position.X; - npc.ai[1] = npc.position.Y; - npc.ai[2] = 0f; + NPC.ai[0] = NPC.position.X; + NPC.ai[1] = NPC.position.Y; + NPC.ai[2] = 0f; } - npc.TargetClosest(true); + NPC.TargetClosest(true); } else { - npc.TargetClosest(true); - npc.ai[2] += 2f; + NPC.TargetClosest(true); + NPC.ai[2] += 2f; } - int num283 = (int)((npc.position.X + (float)(npc.width / 2)) / 16f) + npc.direction * 2; - int num284 = (int)((npc.position.Y + (float)npc.height) / 16f); + int num283 = (int)((NPC.position.X + (float)(NPC.width / 2)) / 16f) + NPC.direction * 2; + int num284 = (int)((NPC.position.Y + (float)NPC.height) / 16f); bool flag23 = true; int num285 = 3; for (int num308 = num284; num308 < num284 + num285; num308++) @@ -112,13 +112,13 @@ namespace CalamityMod.NPCs.Crags { Main.tile[num283, num308] = new Tile(); } - if ((Main.tile[num283, num308].nactive() && Main.tileSolid[(int)Main.tile[num283, num308].type]) || Main.tile[num283, num308].liquid > 0) + if ((Main.tile[num283, num308].nactive() && Main.tileSolid[(int)Main.tile[num283, num308].TileType]) || Main.tile[num283, num308].liquid > 0) { flag23 = false; break; } } - if (Main.player[npc.target].npcTypeNoAggro[npc.type]) + if (Main.player[NPC.target].npcTypeNoAggro[NPC.type]) { bool flag25 = false; for (int num309 = num284; num309 < num284 + num285 - 2; num309++) @@ -127,13 +127,13 @@ namespace CalamityMod.NPCs.Crags { Main.tile[num283, num309] = new Tile(); } - if ((Main.tile[num283, num309].nactive() && Main.tileSolid[(int)Main.tile[num283, num309].type]) || Main.tile[num283, num309].liquid > 0) + if ((Main.tile[num283, num309].nactive() && Main.tileSolid[(int)Main.tile[num283, num309].TileType]) || Main.tile[num283, num309].liquid > 0) { flag25 = true; break; } } - npc.directionY = (!flag25).ToDirectionInt(); + NPC.directionY = (!flag25).ToDirectionInt(); } if (flag19) { @@ -141,125 +141,125 @@ namespace CalamityMod.NPCs.Crags } if (flag23) { - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y > 3f) + NPC.velocity.Y = NPC.velocity.Y + 0.1f; + if (NPC.velocity.Y > 3f) { - npc.velocity.Y = 3f; + NPC.velocity.Y = 3f; } } else { - if (npc.directionY < 0 && npc.velocity.Y > 0f) + if (NPC.directionY < 0 && NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y - 0.1f; + NPC.velocity.Y = NPC.velocity.Y - 0.1f; } - if (npc.velocity.Y < -4f) + if (NPC.velocity.Y < -4f) { - npc.velocity.Y = -4f; + NPC.velocity.Y = -4f; } } - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.oldVelocity.X * -0.4f; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 1f) + NPC.velocity.X = NPC.oldVelocity.X * -0.4f; + if (NPC.direction == -1 && NPC.velocity.X > 0f && NPC.velocity.X < 1f) { - npc.velocity.X = 1f; + NPC.velocity.X = 1f; } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -1f) + if (NPC.direction == 1 && NPC.velocity.X < 0f && NPC.velocity.X > -1f) { - npc.velocity.X = -1f; + NPC.velocity.X = -1f; } } - if (npc.collideY) + if (NPC.collideY) { - npc.velocity.Y = npc.oldVelocity.Y * -0.25f; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1f) + NPC.velocity.Y = NPC.oldVelocity.Y * -0.25f; + if (NPC.velocity.Y > 0f && NPC.velocity.Y < 1f) { - npc.velocity.Y = 1f; + NPC.velocity.Y = 1f; } - if (npc.velocity.Y < 0f && npc.velocity.Y > -1f) + if (NPC.velocity.Y < 0f && NPC.velocity.Y > -1f) { - npc.velocity.Y = -1f; + NPC.velocity.Y = -1f; } } float num311 = 4f; - if (npc.direction == -1 && npc.velocity.X > -num311) + if (NPC.direction == -1 && NPC.velocity.X > -num311) { - npc.velocity.X = npc.velocity.X - 0.1f; - if (npc.velocity.X > num311) + NPC.velocity.X = NPC.velocity.X - 0.1f; + if (NPC.velocity.X > num311) { - npc.velocity.X = npc.velocity.X - 0.1f; + NPC.velocity.X = NPC.velocity.X - 0.1f; } - else if (npc.velocity.X > 0f) + else if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + 0.05f; + NPC.velocity.X = NPC.velocity.X + 0.05f; } - if (npc.velocity.X < -num311) + if (NPC.velocity.X < -num311) { - npc.velocity.X = -num311; + NPC.velocity.X = -num311; } } - else if (npc.direction == 1 && npc.velocity.X < num311) + else if (NPC.direction == 1 && NPC.velocity.X < num311) { - npc.velocity.X = npc.velocity.X + 0.1f; - if (npc.velocity.X < -num311) + NPC.velocity.X = NPC.velocity.X + 0.1f; + if (NPC.velocity.X < -num311) { - npc.velocity.X = npc.velocity.X + 0.1f; + NPC.velocity.X = NPC.velocity.X + 0.1f; } - else if (npc.velocity.X < 0f) + else if (NPC.velocity.X < 0f) { - npc.velocity.X = npc.velocity.X - 0.05f; + NPC.velocity.X = NPC.velocity.X - 0.05f; } - if (npc.velocity.X > num311) + if (NPC.velocity.X > num311) { - npc.velocity.X = num311; + NPC.velocity.X = num311; } } num311 = 1.5f; - if (npc.directionY == -1 && npc.velocity.Y > -num311) + if (NPC.directionY == -1 && NPC.velocity.Y > -num311) { - npc.velocity.Y = npc.velocity.Y - 0.04f; - if (npc.velocity.Y > num311) + NPC.velocity.Y = NPC.velocity.Y - 0.04f; + if (NPC.velocity.Y > num311) { - npc.velocity.Y = npc.velocity.Y - 0.05f; + NPC.velocity.Y = NPC.velocity.Y - 0.05f; } - else if (npc.velocity.Y > 0f) + else if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + 0.03f; + NPC.velocity.Y = NPC.velocity.Y + 0.03f; } - if (npc.velocity.Y < -num311) + if (NPC.velocity.Y < -num311) { - npc.velocity.Y = -num311; + NPC.velocity.Y = -num311; } } - else if (npc.directionY == 1 && npc.velocity.Y < num311) + else if (NPC.directionY == 1 && NPC.velocity.Y < num311) { - npc.velocity.Y = npc.velocity.Y + 0.04f; - if (npc.velocity.Y < -num311) + NPC.velocity.Y = NPC.velocity.Y + 0.04f; + if (NPC.velocity.Y < -num311) { - npc.velocity.Y = npc.velocity.Y + 0.05f; + NPC.velocity.Y = NPC.velocity.Y + 0.05f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = npc.velocity.Y - 0.03f; + NPC.velocity.Y = NPC.velocity.Y - 0.03f; } - if (npc.velocity.Y > num311) + if (NPC.velocity.Y > num311) { - npc.velocity.Y = num311; + NPC.velocity.Y = num311; } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; + return spawnInfo.Player.Calamity().ZoneCalamity ? 0.25f : 0f; } public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 20, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 20, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 3, 1, 1); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -271,15 +271,15 @@ namespace CalamityMod.NPCs.Crags { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 40; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScryllarGores/Scryllar"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScryllarGores/Scryllar"), NPC.scale); } } } diff --git a/NPCs/Crags/ScryllarRage.cs b/NPCs/Crags/ScryllarRage.cs index 7c6d76f1c9..e23edbc31e 100644 --- a/NPCs/Crags/ScryllarRage.cs +++ b/NPCs/Crags/ScryllarRage.cs @@ -19,91 +19,91 @@ namespace CalamityMod.NPCs.Crags public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 65; - npc.width = 80; - npc.height = 80; - npc.defense = 10; - npc.lifeMax = 50; - npc.alpha = 100; - npc.knockBackResist = 0.9f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit49; - npc.DeathSound = SoundID.NPCDeath51; - npc.noGravity = true; - npc.noTileCollide = true; - npc.lavaImmune = true; + NPC.damage = 65; + NPC.width = 80; + NPC.height = 80; + NPC.defense = 10; + NPC.lifeMax = 50; + NPC.alpha = 100; + NPC.knockBackResist = 0.9f; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit49; + NPC.DeathSound = SoundID.NPCDeath51; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.lavaImmune = true; if (CalamityWorld.downedProvidence) { - npc.damage = 110; - npc.defense = 20; - npc.lifeMax = 1500; + NPC.damage = 110; + NPC.defense = 20; + NPC.lifeMax = 1500; } banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + NPC.rotation = NPC.velocity.X * 0.04f; + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; bool flag19 = false; - if (npc.justHit) + if (NPC.justHit) { - npc.ai[2] = 0f; + NPC.ai[2] = 0f; } - if (npc.ai[2] >= 0f) + if (NPC.ai[2] >= 0f) { int num282 = 16; bool flag21 = false; bool flag22 = false; - if (npc.position.X > npc.ai[0] - (float)num282 && npc.position.X < npc.ai[0] + (float)num282) + if (NPC.position.X > NPC.ai[0] - (float)num282 && NPC.position.X < NPC.ai[0] + (float)num282) { flag21 = true; } - else if ((npc.velocity.X < 0f && npc.direction > 0) || (npc.velocity.X > 0f && npc.direction < 0)) + else if ((NPC.velocity.X < 0f && NPC.direction > 0) || (NPC.velocity.X > 0f && NPC.direction < 0)) { flag21 = true; } num282 += 24; - if (npc.position.Y > npc.ai[1] - (float)num282 && npc.position.Y < npc.ai[1] + (float)num282) + if (NPC.position.Y > NPC.ai[1] - (float)num282 && NPC.position.Y < NPC.ai[1] + (float)num282) { flag22 = true; } if (flag21 && flag22) { - npc.ai[2] += 1f; - if (npc.ai[2] >= 30f && num282 == 16) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 30f && num282 == 16) { flag19 = true; } - if (npc.ai[2] >= 60f) + if (NPC.ai[2] >= 60f) { - npc.ai[2] = -200f; - npc.direction *= -1; - npc.velocity.X = npc.velocity.X * -1f; - npc.collideX = false; + NPC.ai[2] = -200f; + NPC.direction *= -1; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.collideX = false; } } else { - npc.ai[0] = npc.position.X; - npc.ai[1] = npc.position.Y; - npc.ai[2] = 0f; + NPC.ai[0] = NPC.position.X; + NPC.ai[1] = NPC.position.Y; + NPC.ai[2] = 0f; } - npc.TargetClosest(true); + NPC.TargetClosest(true); } else { - npc.TargetClosest(true); - npc.ai[2] += 2f; + NPC.TargetClosest(true); + NPC.ai[2] += 2f; } - int num283 = (int)((npc.position.X + (float)(npc.width / 2)) / 16f) + npc.direction * 2; - int num284 = (int)((npc.position.Y + (float)npc.height) / 16f); + int num283 = (int)((NPC.position.X + (float)(NPC.width / 2)) / 16f) + NPC.direction * 2; + int num284 = (int)((NPC.position.Y + (float)NPC.height) / 16f); bool flag23 = true; int num285 = 3; for (int num308 = num284; num308 < num284 + num285; num308++) @@ -112,13 +112,13 @@ namespace CalamityMod.NPCs.Crags { Main.tile[num283, num308] = new Tile(); } - if ((Main.tile[num283, num308].nactive() && Main.tileSolid[(int)Main.tile[num283, num308].type]) || Main.tile[num283, num308].liquid > 0) + if ((Main.tile[num283, num308].nactive() && Main.tileSolid[(int)Main.tile[num283, num308].TileType]) || Main.tile[num283, num308].liquid > 0) { flag23 = false; break; } } - if (Main.player[npc.target].npcTypeNoAggro[npc.type]) + if (Main.player[NPC.target].npcTypeNoAggro[NPC.type]) { bool flag25 = false; for (int num309 = num284; num309 < num284 + num285 - 2; num309++) @@ -127,13 +127,13 @@ namespace CalamityMod.NPCs.Crags { Main.tile[num283, num309] = new Tile(); } - if ((Main.tile[num283, num309].nactive() && Main.tileSolid[(int)Main.tile[num283, num309].type]) || Main.tile[num283, num309].liquid > 0) + if ((Main.tile[num283, num309].nactive() && Main.tileSolid[(int)Main.tile[num283, num309].TileType]) || Main.tile[num283, num309].liquid > 0) { flag25 = true; break; } } - npc.directionY = (!flag25).ToDirectionInt(); + NPC.directionY = (!flag25).ToDirectionInt(); } if (flag19) { @@ -141,125 +141,125 @@ namespace CalamityMod.NPCs.Crags } if (flag23) { - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y > 3f) + NPC.velocity.Y = NPC.velocity.Y + 0.1f; + if (NPC.velocity.Y > 3f) { - npc.velocity.Y = 3f; + NPC.velocity.Y = 3f; } } else { - if (npc.directionY < 0 && npc.velocity.Y > 0f) + if (NPC.directionY < 0 && NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y - 0.1f; + NPC.velocity.Y = NPC.velocity.Y - 0.1f; } - if (npc.velocity.Y < -4f) + if (NPC.velocity.Y < -4f) { - npc.velocity.Y = -4f; + NPC.velocity.Y = -4f; } } - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.oldVelocity.X * -0.4f; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 1f) + NPC.velocity.X = NPC.oldVelocity.X * -0.4f; + if (NPC.direction == -1 && NPC.velocity.X > 0f && NPC.velocity.X < 1f) { - npc.velocity.X = 1f; + NPC.velocity.X = 1f; } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -1f) + if (NPC.direction == 1 && NPC.velocity.X < 0f && NPC.velocity.X > -1f) { - npc.velocity.X = -1f; + NPC.velocity.X = -1f; } } - if (npc.collideY) + if (NPC.collideY) { - npc.velocity.Y = npc.oldVelocity.Y * -0.25f; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1f) + NPC.velocity.Y = NPC.oldVelocity.Y * -0.25f; + if (NPC.velocity.Y > 0f && NPC.velocity.Y < 1f) { - npc.velocity.Y = 1f; + NPC.velocity.Y = 1f; } - if (npc.velocity.Y < 0f && npc.velocity.Y > -1f) + if (NPC.velocity.Y < 0f && NPC.velocity.Y > -1f) { - npc.velocity.Y = -1f; + NPC.velocity.Y = -1f; } } float num311 = 7f; - if (npc.direction == -1 && npc.velocity.X > -num311) + if (NPC.direction == -1 && NPC.velocity.X > -num311) { - npc.velocity.X = npc.velocity.X - 0.1f; - if (npc.velocity.X > num311) + NPC.velocity.X = NPC.velocity.X - 0.1f; + if (NPC.velocity.X > num311) { - npc.velocity.X = npc.velocity.X - 0.1f; + NPC.velocity.X = NPC.velocity.X - 0.1f; } - else if (npc.velocity.X > 0f) + else if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + 0.05f; + NPC.velocity.X = NPC.velocity.X + 0.05f; } - if (npc.velocity.X < -num311) + if (NPC.velocity.X < -num311) { - npc.velocity.X = -num311; + NPC.velocity.X = -num311; } } - else if (npc.direction == 1 && npc.velocity.X < num311) + else if (NPC.direction == 1 && NPC.velocity.X < num311) { - npc.velocity.X = npc.velocity.X + 0.1f; - if (npc.velocity.X < -num311) + NPC.velocity.X = NPC.velocity.X + 0.1f; + if (NPC.velocity.X < -num311) { - npc.velocity.X = npc.velocity.X + 0.1f; + NPC.velocity.X = NPC.velocity.X + 0.1f; } - else if (npc.velocity.X < 0f) + else if (NPC.velocity.X < 0f) { - npc.velocity.X = npc.velocity.X - 0.05f; + NPC.velocity.X = NPC.velocity.X - 0.05f; } - if (npc.velocity.X > num311) + if (NPC.velocity.X > num311) { - npc.velocity.X = num311; + NPC.velocity.X = num311; } } num311 = 1.5f; - if (npc.directionY == -1 && npc.velocity.Y > -num311) + if (NPC.directionY == -1 && NPC.velocity.Y > -num311) { - npc.velocity.Y = npc.velocity.Y - 0.04f; - if (npc.velocity.Y > num311) + NPC.velocity.Y = NPC.velocity.Y - 0.04f; + if (NPC.velocity.Y > num311) { - npc.velocity.Y = npc.velocity.Y - 0.05f; + NPC.velocity.Y = NPC.velocity.Y - 0.05f; } - else if (npc.velocity.Y > 0f) + else if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + 0.03f; + NPC.velocity.Y = NPC.velocity.Y + 0.03f; } - if (npc.velocity.Y < -num311) + if (NPC.velocity.Y < -num311) { - npc.velocity.Y = -num311; + NPC.velocity.Y = -num311; } } - else if (npc.directionY == 1 && npc.velocity.Y < num311) + else if (NPC.directionY == 1 && NPC.velocity.Y < num311) { - npc.velocity.Y = npc.velocity.Y + 0.04f; - if (npc.velocity.Y < -num311) + NPC.velocity.Y = NPC.velocity.Y + 0.04f; + if (NPC.velocity.Y < -num311) { - npc.velocity.Y = npc.velocity.Y + 0.05f; + NPC.velocity.Y = NPC.velocity.Y + 0.05f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = npc.velocity.Y - 0.03f; + NPC.velocity.Y = NPC.velocity.Y - 0.03f; } - if (npc.velocity.Y > num311) + if (NPC.velocity.Y > num311) { - npc.velocity.Y = num311; + NPC.velocity.Y = num311; } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.Calamity().ZoneCalamity ? 0.125f : 0f; + return spawnInfo.Player.Calamity().ZoneCalamity ? 0.125f : 0f; } public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 20, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 20, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 3, 1, 1); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -271,16 +271,16 @@ namespace CalamityMod.NPCs.Crags { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 40; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScryllarGores/ScryllarRage"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScryllarGores/ScryllarRage2"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScryllarGores/ScryllarRage"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScryllarGores/ScryllarRage2"), NPC.scale); } } } diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index b306014d2d..02749103ff 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -18,55 +18,55 @@ namespace CalamityMod.NPCs.Crags public override void SetStaticDefaults() { DisplayName.SetDefault("Soul Slurper"); - NPCID.Sets.TrailingMode[npc.type] = 1; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.npcSlots = 1f; - npc.damage = 30; - npc.width = 60; - npc.height = 40; - npc.defense = 30; - npc.DR_NERD(0.15f); - npc.lifeMax = 60; - npc.knockBackResist = 0.65f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.noGravity = true; - npc.lavaImmune = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; + NPC.npcSlots = 1f; + NPC.damage = 30; + NPC.width = 60; + NPC.height = 40; + NPC.defense = 30; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 60; + NPC.knockBackResist = 0.65f; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.noGravity = true; + NPC.lavaImmune = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; if (CalamityWorld.downedProvidence) { - npc.damage = 60; - npc.defense = 45; - npc.lifeMax = 2000; + NPC.damage = 60; + NPC.defense = 45; + NPC.lifeMax = 2000; } - banner = npc.type; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; + return spawnInfo.Player.Calamity().ZoneCalamity ? 0.25f : 0f; } public override void AI() { bool provy = CalamityWorld.downedProvidence; - Player target = Main.player[npc.target]; - if (npc.target < 0 || npc.target == 255 || target.dead) + Player target = Main.player[NPC.target]; + if (NPC.target < 0 || NPC.target == 255 || target.dead) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } float num = 5f; float num2 = 0.07f; - Vector2 source = npc.Center; + Vector2 source = NPC.Center; float num4 = target.Center.X; float num5 = target.Center.Y; num4 = (float)((int)(num4 / 8f) * 8); @@ -84,8 +84,8 @@ namespace CalamityMod.NPCs.Crags } if (num6 == 0f) { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; + num4 = NPC.velocity.X; + num5 = NPC.velocity.Y; } else { @@ -95,58 +95,58 @@ namespace CalamityMod.NPCs.Crags } if (num7 > 100f) { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) + NPC.ai[0] += 1f; + if (NPC.ai[0] > 0f) { - npc.velocity.Y += 0.023f; + NPC.velocity.Y += 0.023f; } else { - npc.velocity.Y -= 0.023f; + NPC.velocity.Y -= 0.023f; } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) + if (NPC.ai[0] < -100f || NPC.ai[0] > 100f) { - npc.velocity.X += 0.023f; + NPC.velocity.X += 0.023f; } else { - npc.velocity.X -= 0.023f; + NPC.velocity.X -= 0.023f; } - if (npc.ai[0] > 200f) + if (NPC.ai[0] > 200f) { - npc.ai[0] = -200f; + NPC.ai[0] = -200f; } } if (target.dead) { - num4 = (float)npc.direction * num / 2f; + num4 = (float)NPC.direction * num / 2f; num5 = -num / 2f; } - if (npc.velocity.X < num4) + if (NPC.velocity.X < num4) { - npc.velocity.X += num2; + NPC.velocity.X += num2; } - else if (npc.velocity.X > num4) + else if (NPC.velocity.X > num4) { - npc.velocity.X -= num2; + NPC.velocity.X -= num2; } - if (npc.velocity.Y < num5) + if (NPC.velocity.Y < num5) { - npc.velocity.Y += num2; + NPC.velocity.Y += num2; } - else if (npc.velocity.Y > num5) + else if (NPC.velocity.Y > num5) { - npc.velocity.Y -= num2; + NPC.velocity.Y -= num2; } - npc.localAI[0] += 1f; - if (npc.justHit) + NPC.localAI[0] += 1f; + if (NPC.justHit) { - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= 120f) { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) + NPC.localAI[0] = 0f; + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, target.position, target.width, target.height)) { int dmg = 30; if (Main.expertMode) @@ -157,78 +157,78 @@ namespace CalamityMod.NPCs.Crags Projectile.NewProjectile(source.X, source.Y, num4, num5, projType, dmg + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); } } - int num10 = (int)npc.Center.X; - int num11 = (int)npc.Center.Y; + int num10 = (int)NPC.Center.X; + int num11 = (int)NPC.Center.Y; num10 /= 16; num11 /= 16; if (!WorldGen.SolidTile(num10, num11)) { - Lighting.AddLight((int)npc.Center.X / 16, (int)npc.Center.Y / 16, 0.75f, 0f, 0f); + Lighting.AddLight((int)NPC.Center.X / 16, (int)NPC.Center.Y / 16, 0.75f, 0f, 0f); } if (num4 > 0f) { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4); + NPC.spriteDirection = 1; + NPC.rotation = (float)Math.Atan2((double)num5, (double)num4); } if (num4 < 0f) { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + MathHelper.Pi; + NPC.spriteDirection = -1; + NPC.rotation = (float)Math.Atan2((double)num5, (double)num4) + MathHelper.Pi; } float num12 = 0.7f; - if (npc.collideX) + if (NPC.collideX) { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num12; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + NPC.netUpdate = true; + NPC.velocity.X = NPC.oldVelocity.X * -num12; + if (NPC.direction == -1 && NPC.velocity.X > 0f && NPC.velocity.X < 2f) { - npc.velocity.X = 2f; + NPC.velocity.X = 2f; } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + if (NPC.direction == 1 && NPC.velocity.X < 0f && NPC.velocity.X > -2f) { - npc.velocity.X = -2f; + NPC.velocity.X = -2f; } } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5f) + NPC.netUpdate = true; + NPC.velocity.Y = NPC.oldVelocity.Y * -num12; + if (NPC.velocity.Y > 0f && NPC.velocity.Y < 1.5f) { - npc.velocity.Y = 2f; + NPC.velocity.Y = 2f; } - if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5f) + if (NPC.velocity.Y < 0f && NPC.velocity.Y > -1.5f) { - npc.velocity.Y = -2f; + NPC.velocity.Y = -2f; } } if (flag) { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) + if ((NPC.velocity.X > 0f && num4 > 0f) || (NPC.velocity.X < 0f && num4 < 0f)) { - if (Math.Abs(npc.velocity.X) < 12f) + if (Math.Abs(NPC.velocity.X) < 12f) { - npc.velocity.X *= 1.05f; + NPC.velocity.X *= 1.05f; } } else { - npc.velocity.X *= 0.9f; + NPC.velocity.X *= 0.9f; } } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) { - npc.netUpdate = true; + NPC.netUpdate = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Main.npcTexture[npc.type]; + Texture2D texture = Main.npcTexture[NPC.type]; Vector2 vector11 = new Vector2((float)(texture.Width / 2), (float)(texture.Height / 2)); Color color36 = Color.White; float amount9 = 0.5f; @@ -240,21 +240,21 @@ namespace CalamityMod.NPCs.Crags { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture.Width, (float)(texture.Height)) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture.Width, (float)(texture.Height)) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture.Width, (float)(texture.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture.Width, (float)(texture.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture = ModContent.GetTexture("CalamityMod/NPCs/Crags/SoulSlurperGlow"); + texture = ModContent.Request("CalamityMod/NPCs/Crags/SoulSlurperGlow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -264,23 +264,23 @@ namespace CalamityMod.NPCs.Crags Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture.Width, (float)(texture.Height)) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, npc.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2((float)texture.Width, (float)(texture.Height)) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); } } - spriteBatch.Draw(texture, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, npc.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); + spriteBatch.Draw(texture, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); return false; } public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 3, 1, 1); - DropHelper.DropItemChance(npc, ModContent.ItemType(), (Main.hardMode ? 30 : 10)); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 3, 1, 1); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), (Main.hardMode ? 30 : 10)); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -292,22 +292,22 @@ namespace CalamityMod.NPCs.Crags { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SoulSlurperGores/SoulSlurper"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SoulSlurperGores/SoulSlurper2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SoulSlurperGores/SoulSlurper3"), npc.scale); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SoulSlurperGores/SoulSlurper"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SoulSlurperGores/SoulSlurper2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SoulSlurperGores/SoulSlurper3"), NPC.scale); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 50; + NPC.height = 50; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -317,10 +317,10 @@ namespace CalamityMod.NPCs.Crags } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 2adc6464d7..fe6de01b54 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -23,6 +23,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Cryogen { @@ -44,30 +45,30 @@ namespace CalamityMod.NPCs.Cryogen public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 24f; - npc.GetNPCDamage(); - npc.width = 86; - npc.height = 88; - npc.defense = 12; - npc.DR_NERD(0.3f); - npc.LifeMaxNERB(30000, 36000, 300000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 24f; + NPC.GetNPCDamage(); + NPC.width = 86; + NPC.height = 88; + NPC.defense = 12; + NPC.DR_NERD(0.3f); + NPC.LifeMaxNERB(30000, 36000, 300000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 40, 0, 0); - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath15; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 40, 0, 0); + NPC.boss = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit5; + NPC.DeathSound = SoundID.NPCDeath15; music = CalamityMod.Instance.GetMusicFromMusicMod("Cryogen") ?? MusicID.FrostMoon; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = false; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = false; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) @@ -76,9 +77,9 @@ namespace CalamityMod.NPCs.Cryogen writer.Write(time); writer.Write(iceShard); writer.Write(teleportLocationX); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -87,26 +88,26 @@ namespace CalamityMod.NPCs.Cryogen time = reader.ReadInt32(); iceShard = reader.ReadInt32(); teleportLocationX = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 1f, 1f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0f, 1f, 1f); // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; @@ -127,7 +128,7 @@ namespace CalamityMod.NPCs.Cryogen float enrageScale = death ? 0.5f : 0f; if (biomeEnraged) { - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 2f; } @@ -138,7 +139,7 @@ namespace CalamityMod.NPCs.Cryogen enrageScale = 3f; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Phases bool phase2 = lifeRatio < (revenge ? 0.85f : 0.8f) || death; @@ -148,80 +149,80 @@ namespace CalamityMod.NPCs.Cryogen bool phase6 = lifeRatio < (death ? 0.35f : 0.25f) && revenge; bool phase7 = lifeRatio < (death ? 0.25f : 0.15f) && revenge; - if ((int)npc.ai[0] + 1 > currentPhase) - HandlePhaseTransition((int)npc.ai[0] + 1); + if ((int)NPC.ai[0] + 1 > currentPhase) + HandlePhaseTransition((int)NPC.ai[0] + 1); - if (npc.ai[2] == 0f && npc.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient && (npc.ai[0] < 3f || BossRushEvent.BossRushActive || (death && npc.ai[0] > 3f))) //spawn shield for phase 0 1 2, not 3 4 5 + if (NPC.ai[2] == 0f && NPC.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient && (NPC.ai[0] < 3f || BossRushEvent.BossRushActive || (death && NPC.ai[0] > 3f))) //spawn shield for phase 0 1 2, not 3 4 5 { - int num6 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); - npc.ai[2] = num6 + 1; - npc.localAI[1] = -1f; - npc.netUpdate = true; - Main.npc[num6].ai[0] = npc.whoAmI; + int num6 = NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[2] = num6 + 1; + NPC.localAI[1] = -1f; + NPC.netUpdate = true; + Main.npc[num6].ai[0] = NPC.whoAmI; Main.npc[num6].netUpdate = true; } - int num7 = (int)npc.ai[2] - 1; + int num7 = (int)NPC.ai[2] - 1; if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType()) { - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; } else { - npc.dontTakeDamage = false; - npc.ai[2] = 0f; + NPC.dontTakeDamage = false; + NPC.ai[2] = 0f; - if (npc.localAI[1] == -1f) - npc.localAI[1] = death ? 540f : expertMode ? 720f : 1080f; - if (npc.localAI[1] > 0f) - npc.localAI[1] -= 1f; + if (NPC.localAI[1] == -1f) + NPC.localAI[1] = death ? 540f : expertMode ? 720f : 1080f; + if (NPC.localAI[1] > 0f) + NPC.localAI[1] -= 1f; } CalamityMod.StopRain(); if (!player.active || player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (!player.active || player.dead) { - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.1f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; - if (npc.timeLeft > 60) - npc.timeLeft = 60; + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; - if (npc.ai[1] != 0f) + if (NPC.ai[1] != 0f) { - npc.ai[1] = 0f; + NPC.ai[1] = 0f; teleportLocationX = 0; iceShard = 0; - npc.netUpdate = true; + NPC.netUpdate = true; } return; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; float chargeGateValue = malice ? 240f : 360f; - bool charging = npc.ai[1] >= chargeGateValue; + bool charging = NPC.ai[1] >= chargeGateValue; - if (Main.netMode != NetmodeID.MultiplayerClient && expertMode && (npc.ai[0] < 5f || !phase6) && !charging) + if (Main.netMode != NetmodeID.MultiplayerClient && expertMode && (NPC.ai[0] < 5f || !phase6) && !charging) { time++; if (time >= (malice ? 480 : 600)) { time = 0; - Main.PlaySound(SoundID.Item28, npc.Center); + SoundEngine.PlaySound(SoundID.Item28, NPC.Center); int totalProjectiles = 3; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float velocity = 2f + npc.ai[0]; + int damage = NPC.GetProjectileDamage(type); + float velocity = 2f + NPC.ai[0]; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); @@ -229,41 +230,41 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, npc.ai[0] * 0.5f); + Projectile.NewProjectile(NPC.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, NPC.ai[0] * 0.5f); } } } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) + NPC.localAI[0] += 1f; + if (NPC.localAI[0] >= 120f) { - npc.localAI[0] = 0f; - npc.TargetClosest(); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + NPC.localAI[0] = 0f; + NPC.TargetClosest(); + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - Main.PlaySound(SoundID.Item28, npc.Center); + SoundEngine.PlaySound(SoundID.Item28, NPC.Center); int totalProjectiles = malice ? 24 : 16; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float velocity = 9f + enrageScale; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.Center, vector255, type, damage, 0f, Main.myPlayer); } } } } - Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector142 = new Vector2(NPC.Center.X, NPC.Center.Y); float num1243 = player.Center.X - vector142.X; float num1244 = player.Center.Y - vector142.Y; float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244); @@ -274,45 +275,45 @@ namespace CalamityMod.NPCs.Cryogen num1245 = num1246 / num1245; num1243 *= num1245; num1244 *= num1245; - npc.velocity.X = (npc.velocity.X * 50f + num1243) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; + NPC.velocity.X = (NPC.velocity.X * 50f + num1243) / 51f; + NPC.velocity.Y = (NPC.velocity.Y * 50f + num1244) / 51f; if (phase2) { - npc.TargetClosest(); - npc.ai[0] = 1f; - npc.localAI[0] = 0f; - npc.netUpdate = true; + NPC.TargetClosest(); + NPC.ai[0] = 1f; + NPC.localAI[0] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - if (npc.ai[1] < chargeGateValue) + if (NPC.ai[1] < chargeGateValue) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) + NPC.localAI[0] += 1f; + if (NPC.localAI[0] >= 120f) { - npc.localAI[0] = 0f; - npc.TargetClosest(); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + NPC.localAI[0] = 0f; + NPC.TargetClosest(); + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - Main.PlaySound(SoundID.Item28, npc.Center); + SoundEngine.PlaySound(SoundID.Item28, NPC.Center); int totalProjectiles = malice ? 18 : 12; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float velocity2 = 9f + enrageScale; Vector2 spinningPoint = new Vector2(0f, -velocity2); for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.Center, vector255, type, damage, 0f, Main.myPlayer); } } } @@ -323,75 +324,75 @@ namespace CalamityMod.NPCs.Cryogen velocity -= enrageScale * 0.8f; acceleration += 0.07f * enrageScale; - if (npc.position.Y > player.position.Y - 375f) + if (NPC.position.Y > player.position.Y - 375f) { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y *= 0.98f; - npc.velocity.Y -= acceleration; + NPC.velocity.Y -= acceleration; - if (npc.velocity.Y > velocity) - npc.velocity.Y = velocity; + if (NPC.velocity.Y > velocity) + NPC.velocity.Y = velocity; } - else if (npc.position.Y < player.position.Y - 425f) + else if (NPC.position.Y < player.position.Y - 425f) { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= 0.98f; - npc.velocity.Y += acceleration; + NPC.velocity.Y += acceleration; - if (npc.velocity.Y < -velocity) - npc.velocity.Y = -velocity; + if (NPC.velocity.Y < -velocity) + NPC.velocity.Y = -velocity; } - if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 300f) + if (NPC.position.X + (NPC.width / 2) > player.position.X + (player.width / 2) + 300f) { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; + if (NPC.velocity.X > 0f) + NPC.velocity.X *= 0.98f; - npc.velocity.X -= acceleration; + NPC.velocity.X -= acceleration; - if (npc.velocity.X > velocity) - npc.velocity.X = velocity; + if (NPC.velocity.X > velocity) + NPC.velocity.X = velocity; } - if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 300f) + if (NPC.position.X + (NPC.width / 2) < player.position.X + (player.width / 2) - 300f) { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; + if (NPC.velocity.X < 0f) + NPC.velocity.X *= 0.98f; - npc.velocity.X += acceleration; + NPC.velocity.X += acceleration; - if (npc.velocity.X < -velocity) - npc.velocity.X = -velocity; + if (NPC.velocity.X < -velocity) + NPC.velocity.X = -velocity; } } - else if (npc.ai[1] < chargeGateValue + 30f) + else if (NPC.ai[1] < chargeGateValue + 30f) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; calamityGlobalNPC.newAI[0] += 0.025f; if (calamityGlobalNPC.newAI[0] > 0.5f) calamityGlobalNPC.newAI[0] = 0.5f; - npc.rotation += calamityGlobalNPC.newAI[0]; - npc.velocity *= 0.98f; + NPC.rotation += calamityGlobalNPC.newAI[0]; + NPC.velocity *= 0.98f; } else { - if (npc.ai[1] == chargeGateValue + 30f) + if (NPC.ai[1] == chargeGateValue + 30f) { - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * (18f + enrageScale * 2f); + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (18f + enrageScale * 2f); - npc.ai[1] = chargeGateValue + 90f; + NPC.ai[1] = chargeGateValue + 90f; calamityGlobalNPC.newAI[0] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - Main.PlaySound(SoundID.Item28, npc.Center); + SoundEngine.PlaySound(SoundID.Item28, NPC.Center); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float velocity = 9f + enrageScale; for (int i = 0; i < 2; i++) { @@ -405,77 +406,77 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); + Projectile.NewProjectile(NPC.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); } } } } } - npc.ai[1] -= 1f; - if (npc.ai[1] == chargeGateValue + 30f) + NPC.ai[1] -= 1f; + if (NPC.ai[1] == chargeGateValue + 30f) { - npc.TargetClosest(); + NPC.TargetClosest(); - npc.ai[1] = 0f; - npc.localAI[0] = 0f; + NPC.ai[1] = 0f; + NPC.localAI[0] = 0f; - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; } - else if (npc.ai[1] <= chargeGateValue + 45f) + else if (NPC.ai[1] <= chargeGateValue + 45f) { - npc.velocity *= 0.95f; - npc.rotation = npc.velocity.X * 0.15f; + NPC.velocity *= 0.95f; + NPC.rotation = NPC.velocity.X * 0.15f; } else - npc.rotation += npc.direction * 0.5f; + NPC.rotation += NPC.direction * 0.5f; } if (phase3) { - npc.TargetClosest(); - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.localAI[0] = 0f; + NPC.TargetClosest(); + NPC.ai[0] = 2f; + NPC.ai[1] = 0f; + NPC.localAI[0] = 0f; calamityGlobalNPC.newAI[0] = 0f; iceShard = 0; - npc.netUpdate = true; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - if (npc.ai[1] < chargeGateValue) + if (NPC.ai[1] < chargeGateValue) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) + NPC.localAI[0] += 1f; + if (NPC.localAI[0] >= 120f) { - npc.localAI[0] = 0f; - npc.TargetClosest(); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + NPC.localAI[0] = 0f; + NPC.TargetClosest(); + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - Main.PlaySound(SoundID.Item28, npc.Center); + SoundEngine.PlaySound(SoundID.Item28, NPC.Center); int totalProjectiles = malice ? 18 : 12; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float velocity = 9f + enrageScale; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.Center, vector255, type, damage, 0f, Main.myPlayer); } } } } - Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector142 = new Vector2(NPC.Center.X, NPC.Center.Y); float num1243 = player.Center.X - vector142.X; float num1244 = player.Center.Y - vector142.Y; float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244); @@ -486,36 +487,36 @@ namespace CalamityMod.NPCs.Cryogen num1245 = num1246 / num1245; num1243 *= num1245; num1244 *= num1245; - npc.velocity.X = (npc.velocity.X * 50f + num1243) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; + NPC.velocity.X = (NPC.velocity.X * 50f + num1243) / 51f; + NPC.velocity.Y = (NPC.velocity.Y * 50f + num1244) / 51f; } - else if (npc.ai[1] < chargeGateValue + 20f) + else if (NPC.ai[1] < chargeGateValue + 20f) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; calamityGlobalNPC.newAI[0] += 0.025f; if (calamityGlobalNPC.newAI[0] > 0.5f) calamityGlobalNPC.newAI[0] = 0.5f; - npc.rotation += calamityGlobalNPC.newAI[0]; - npc.velocity *= 0.98f; + NPC.rotation += calamityGlobalNPC.newAI[0]; + NPC.velocity *= 0.98f; } else { - if (npc.ai[1] == chargeGateValue + 20f) + if (NPC.ai[1] == chargeGateValue + 20f) { - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * (18f + enrageScale * 2f); + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (18f + enrageScale * 2f); - npc.ai[1] = chargeGateValue + 80f; + NPC.ai[1] = chargeGateValue + 80f; calamityGlobalNPC.newAI[0] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - Main.PlaySound(SoundID.Item28, npc.Center); + SoundEngine.PlaySound(SoundID.Item28, NPC.Center); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float velocity = 9f + enrageScale; for (int i = 0; i < 3; i++) { @@ -529,77 +530,77 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); + Projectile.NewProjectile(NPC.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); } } } } } - npc.ai[1] -= 1f; - if (npc.ai[1] == chargeGateValue + 20f) + NPC.ai[1] -= 1f; + if (NPC.ai[1] == chargeGateValue + 20f) { - npc.TargetClosest(); + NPC.TargetClosest(); calamityGlobalNPC.newAI[1] += 1f; if (calamityGlobalNPC.newAI[1] > 1f) { - npc.ai[1] = 0f; - npc.localAI[0] = 0f; + NPC.ai[1] = 0f; + NPC.localAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; } - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; } - else if (npc.ai[1] <= chargeGateValue + 35f) + else if (NPC.ai[1] <= chargeGateValue + 35f) { - npc.velocity *= 0.95f; - npc.rotation = npc.velocity.X * 0.15f; + NPC.velocity *= 0.95f; + NPC.rotation = NPC.velocity.X * 0.15f; } else - npc.rotation += npc.direction * 0.5f; + NPC.rotation += NPC.direction * 0.5f; } if (phase4) { - npc.TargetClosest(); - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.localAI[0] = 0f; + NPC.TargetClosest(); + NPC.ai[0] = 3f; + NPC.ai[1] = 0f; + NPC.localAI[0] = 0f; calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 90f && npc.Opacity == 1f) + NPC.localAI[0] += 1f; + if (NPC.localAI[0] >= 90f && NPC.Opacity == 1f) { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + NPC.localAI[0] = 0f; + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - Main.PlaySound(SoundID.Item28, npc.Center); + SoundEngine.PlaySound(SoundID.Item28, NPC.Center); int totalProjectiles = malice ? 18 : 12; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float velocity = 10f + enrageScale; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.Center, vector255, type, damage, 0f, Main.myPlayer); } } } } - Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector142 = new Vector2(NPC.Center.X, NPC.Center.Y); float num1243 = player.Center.X - vector142.X; float num1244 = player.Center.Y - vector142.Y; float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244); @@ -610,18 +611,18 @@ namespace CalamityMod.NPCs.Cryogen num1245 = speed / num1245; num1243 *= num1245; num1244 *= num1245; - npc.velocity.X = (npc.velocity.X * 50f + num1243) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; + NPC.velocity.X = (NPC.velocity.X * 50f + num1243) / 51f; + NPC.velocity.Y = (NPC.velocity.Y * 50f + num1244) / 51f; - if (npc.ai[1] == 0f) + if (NPC.ai[1] == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 180f) + NPC.localAI[2] += 1f; + if (NPC.localAI[2] >= 180f) { - npc.TargetClosest(); - npc.localAI[2] = 0f; + NPC.TargetClosest(); + NPC.localAI[2] = 0f; int num1249 = 0; int num1250; int num1251; @@ -650,44 +651,44 @@ namespace CalamityMod.NPCs.Cryogen if (num1249 > 100) goto Block; } - npc.ai[1] = 1f; + NPC.ai[1] = 1f; teleportLocationX = num1250; iceShard = num1251; - npc.netUpdate = true; + NPC.netUpdate = true; Block: ; } } } - else if (npc.ai[1] == 1f) + else if (NPC.ai[1] == 1f) { - Vector2 position = new Vector2(teleportLocationX * 16f - (npc.width / 2), iceShard * 16f - (npc.height / 2)); + Vector2 position = new Vector2(teleportLocationX * 16f - (NPC.width / 2), iceShard * 16f - (NPC.height / 2)); for (int m = 0; m < 5; m++) { - int dust = Dust.NewDust(position, npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(position, NPC.width, NPC.height, 67, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; } - npc.Opacity -= 0.008f; - if (npc.Opacity <= 0f) + NPC.Opacity -= 0.008f; + if (NPC.Opacity <= 0f) { - npc.Opacity = 0f; - npc.position = position; + NPC.Opacity = 0f; + NPC.position = position; for (int n = 0; n < 15; n++) { - int num39 = Dust.NewDust(npc.position, npc.width, npc.height, 67, 0f, 0f, 100, default, 3f); + int num39 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, 0f, 0f, 100, default, 3f); Main.dust[num39].noGravity = true; } if (Main.netMode != NetmodeID.MultiplayerClient) { - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - npc.localAI[0] = 0f; - Main.PlaySound(SoundID.Item28, npc.Center); + NPC.localAI[0] = 0f; + SoundEngine.PlaySound(SoundID.Item28, NPC.Center); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float velocity = 9f + enrageScale; for (int i = 0; i < 3; i++) { @@ -705,39 +706,39 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); + Projectile.NewProjectile(NPC.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); } } } } - npc.ai[1] = 2f; - npc.netUpdate = true; + NPC.ai[1] = 2f; + NPC.netUpdate = true; } } - else if (npc.ai[1] == 2f) + else if (NPC.ai[1] == 2f) { - npc.Opacity += 0.2f; - if (npc.Opacity >= 1f) + NPC.Opacity += 0.2f; + if (NPC.Opacity >= 1f) { - npc.Opacity = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.Opacity = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } } if (phase5) { - npc.TargetClosest(); - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[3] = 0f; - npc.localAI[0] = 0f; - npc.localAI[2] = 0f; - npc.Opacity = 1f; + NPC.TargetClosest(); + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[2] = 0f; + NPC.Opacity = 1f; teleportLocationX = 0; iceShard = 0; - npc.netUpdate = true; + NPC.netUpdate = true; int chance = 100; if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1) @@ -751,25 +752,25 @@ namespace CalamityMod.NPCs.Cryogen } } } - else if (npc.ai[0] == 4f) + else if (NPC.ai[0] == 4f) { - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; if (phase6) { - if (npc.ai[1] == 60f) + if (NPC.ai[1] == 60f) { - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * (18f + enrageScale * 2f); + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (18f + enrageScale * 2f); if (phase7) { if (Main.netMode != NetmodeID.MultiplayerClient) { - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - Main.PlaySound(SoundID.Item28, npc.Center); + SoundEngine.PlaySound(SoundID.Item28, NPC.Center); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float velocity = 9f + enrageScale; for (int i = 0; i < 4; i++) { @@ -787,7 +788,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); + Projectile.NewProjectile(NPC.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); } } } @@ -795,39 +796,39 @@ namespace CalamityMod.NPCs.Cryogen } } - npc.ai[1] -= 1f; - if (npc.ai[1] <= 0f) + NPC.ai[1] -= 1f; + if (NPC.ai[1] <= 0f) { - npc.ai[3] += 1f; - npc.TargetClosest(); - if (npc.ai[3] > 2f) + NPC.ai[3] += 1f; + NPC.TargetClosest(); + if (NPC.ai[3] > 2f) { - npc.damage = 0; - npc.defense = 0; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[3] = 0f; + NPC.damage = 0; + NPC.defense = 0; + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.ai[3] = 0f; time = 0; } else - npc.ai[1] = 60f; + NPC.ai[1] = 60f; - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; } - else if (npc.ai[1] <= 15f) + else if (NPC.ai[1] <= 15f) { - npc.velocity *= 0.95f; - npc.rotation = npc.velocity.X * 0.15f; + NPC.velocity *= 0.95f; + NPC.rotation = NPC.velocity.X * 0.15f; } else - npc.rotation += npc.direction * 0.5f; + NPC.rotation += NPC.direction * 0.5f; return; } float num1372 = 16f + enrageScale * 2f; - Vector2 vector167 = new Vector2(npc.Center.X + (npc.direction * 20), npc.Center.Y + 6f); + Vector2 vector167 = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); float num1373 = player.position.X + player.width * 0.5f - vector167.X; float num1374 = player.Center.Y - vector167.Y; float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); @@ -841,38 +842,38 @@ namespace CalamityMod.NPCs.Cryogen if (num1375 < 200f) iceShard = 20; - npc.rotation += npc.direction * 0.3f; + NPC.rotation += NPC.direction * 0.3f; return; } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f; + NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f; if (num1375 < 350f) { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + NPC.velocity.X = (NPC.velocity.X * 10f + num1373) / 11f; + NPC.velocity.Y = (NPC.velocity.Y * 10f + num1374) / 11f; } if (num1375 < 300f) { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + NPC.velocity.X = (NPC.velocity.X * 7f + num1373) / 8f; + NPC.velocity.Y = (NPC.velocity.Y * 7f + num1374) / 8f; } - npc.rotation = npc.velocity.X * 0.15f; + NPC.rotation = NPC.velocity.X * 0.15f; } else { - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; time++; if (time >= (malice ? 50 : 75)) { time = 0; - Main.PlaySound(SoundID.Item28, npc.Center); + SoundEngine.PlaySound(SoundID.Item28, NPC.Center); int totalProjectiles = 4; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float velocity2 = 6f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; @@ -881,19 +882,19 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, 1f); } } - npc.ai[1] += 1f; - if (npc.ai[1] >= (malice ? 120f : 180f)) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= (malice ? 120f : 180f)) { - npc.TargetClosest(); - npc.ai[0] = 4f; - npc.ai[1] = 60f; + NPC.TargetClosest(); + NPC.ai[0] = 4f; + NPC.ai[1] = 60f; time = 0; iceShard = 0; - npc.netUpdate = true; + NPC.netUpdate = true; } float velocity = revenge ? 5f : 6f; @@ -901,56 +902,56 @@ namespace CalamityMod.NPCs.Cryogen velocity -= enrageScale; acceleration += 0.07f * enrageScale; - if (npc.position.Y > player.position.Y - 375f) + if (NPC.position.Y > player.position.Y - 375f) { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y *= 0.98f; - npc.velocity.Y -= acceleration; + NPC.velocity.Y -= acceleration; - if (npc.velocity.Y > velocity) - npc.velocity.Y = velocity; + if (NPC.velocity.Y > velocity) + NPC.velocity.Y = velocity; } - else if (npc.position.Y < player.position.Y - 400f) + else if (NPC.position.Y < player.position.Y - 400f) { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= 0.98f; - npc.velocity.Y += acceleration; + NPC.velocity.Y += acceleration; - if (npc.velocity.Y < -velocity) - npc.velocity.Y = -velocity; + if (NPC.velocity.Y < -velocity) + NPC.velocity.Y = -velocity; } - if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 350f) + if (NPC.position.X + (NPC.width / 2) > player.position.X + (player.width / 2) + 350f) { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; + if (NPC.velocity.X > 0f) + NPC.velocity.X *= 0.98f; - npc.velocity.X -= acceleration; + NPC.velocity.X -= acceleration; - if (npc.velocity.X > velocity) - npc.velocity.X = velocity; + if (NPC.velocity.X > velocity) + NPC.velocity.X = velocity; } - if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 350f) + if (NPC.position.X + (NPC.width / 2) < player.position.X + (player.width / 2) - 350f) { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; + if (NPC.velocity.X < 0f) + NPC.velocity.X *= 0.98f; - npc.velocity.X += acceleration; + NPC.velocity.X += acceleration; - if (npc.velocity.X < -velocity) - npc.velocity.X = -velocity; + if (NPC.velocity.X < -velocity) + NPC.velocity.X = -velocity; } } } private void HandlePhaseTransition(int newPhase) { - Main.PlaySound(SoundID.NPCDeath15, npc.Center); + SoundEngine.PlaySound(SoundID.NPCDeath15, NPC.Center); int chipGoreAmount = newPhase >= 5 ? 3 : newPhase >= 3 ? 2 : 1; for (int i = 1; i < chipGoreAmount; i++) - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CryoChipGore" + i), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CryoChipGore" + i), 1f); currentPhase = newPhase; @@ -960,17 +961,17 @@ namespace CalamityMod.NPCs.Cryogen case 1: break; case 2: - npc.Calamity().DR = 0.27f; + NPC.Calamity().DR = 0.27f; break; case 3: - npc.Calamity().DR = 0.21f; + NPC.Calamity().DR = 0.21f; break; case 4: - npc.Calamity().DR = 0.12f; + NPC.Calamity().DR = 0.12f; break; case 5: case 6: - npc.Calamity().DR = 0f; + NPC.Calamity().DR = 0f; break; } } @@ -980,17 +981,17 @@ namespace CalamityMod.NPCs.Cryogen if (currentPhase > 1) { string phase = "CalamityMod/NPCs/Cryogen/Cryogen_Phase" + currentPhase; - Texture2D texture = ModContent.GetTexture(phase); + Texture2D texture = ModContent.Request(phase); SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Vector2 origin = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); - Vector2 drawPos = npc.Center - Main.screenPosition; - drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - drawPos += origin * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, drawPos, npc.frame, npc.GetAlpha(drawColor), npc.rotation, origin, npc.scale, spriteEffects, 0f); + Vector2 origin = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 drawPos = NPC.Center - Main.screenPosition; + drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); return false; } return true; @@ -998,21 +999,21 @@ namespace CalamityMod.NPCs.Cryogen public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 67, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -1022,17 +1023,17 @@ namespace CalamityMod.NPCs.Cryogen } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 67, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 67, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } float randomSpread = Main.rand.Next(-200, 200) / 100; for (int i = 1; i < 4; i++) { - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoDeathGore" + i), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoChipGore" + i), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/CryoDeathGore" + i), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/CryoChipGore" + i), 1f); } } } @@ -1044,21 +1045,21 @@ namespace CalamityMod.NPCs.Cryogen public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedCryogen); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedCryogen); if (!Main.expertMode) { // Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 4, 8); + DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 4, 8); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -1069,22 +1070,22 @@ namespace CalamityMod.NPCs.Cryogen ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // Other - DropHelper.DropItemChance(npc, ItemID.FrozenKey, 3); + DropHelper.DropItemChance(NPC, ItemID.FrozenKey, 3); // Spawn Permafrost if he isn't in the world int permafrostNPC = NPC.FindFirstNPC(ModContent.NPCType()); if (permafrostNPC == -1 && Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); } // If Cryogen has not been killed, notify players about Cryonic Ore @@ -1107,10 +1108,10 @@ namespace CalamityMod.NPCs.Cryogen { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) diff --git a/NPCs/Cryogen/CryogenIce.cs b/NPCs/Cryogen/CryogenIce.cs index f2e27337b7..529347dbb3 100644 --- a/NPCs/Cryogen/CryogenIce.cs +++ b/NPCs/Cryogen/CryogenIce.cs @@ -18,51 +18,51 @@ namespace CalamityMod.NPCs.Cryogen public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.aiStyle = -1; aiType = -1; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.GetNPCDamage(); - npc.width = 216; - npc.height = 216; - npc.scale = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.8f : 1f; - npc.DR_NERD(0.4f); - npc.lifeMax = CalamityWorld.death ? 700 : 1400; + NPC.canGhostHeal = false; + NPC.noTileCollide = true; + NPC.GetNPCDamage(); + NPC.width = 216; + NPC.height = 216; + NPC.scale = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.8f : 1f; + NPC.DR_NERD(0.4f); + NPC.lifeMax = CalamityWorld.death ? 700 : 1400; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 10000; + NPC.lifeMax = 10000; } - npc.alpha = 255; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = false; - npc.Calamity().VulnerableToSickness = false; + NPC.alpha = 255; + NPC.HitSound = SoundID.NPCHit5; + NPC.DeathSound = SoundID.NPCDeath7; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = false; + NPC.Calamity().VulnerableToSickness = false; } public override void AI() { - npc.alpha -= 3; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 3; + if (NPC.alpha < 0) + NPC.alpha = 0; - npc.rotation += 0.15f; + NPC.rotation += 0.15f; - if (npc.type == ModContent.NPCType()) + if (NPC.type == ModContent.NPCType()) { - int num989 = (int)npc.ai[0]; + int num989 = (int)NPC.ai[0]; if (Main.npc[num989].active && Main.npc[num989].type == ModContent.NPCType()) { - npc.velocity = Vector2.Zero; - npc.position = Main.npc[num989].Center; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.velocity = Vector2.Zero; + NPC.position = Main.npc[num989].Center; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); return; } - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.active = false; } } @@ -71,10 +71,10 @@ namespace CalamityMod.NPCs.Cryogen { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -84,7 +84,7 @@ namespace CalamityMod.NPCs.Cryogen if (dist4 < minDist) minDist = dist4; - return minDist <= 100f * npc.scale && npc.alpha == 0; + return minDist <= 100f * NPC.scale && NPC.alpha == 0; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -95,7 +95,7 @@ namespace CalamityMod.NPCs.Cryogen public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.5f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.5f * bossLifeScale); } public override bool PreNPCLoot() => false; @@ -104,13 +104,13 @@ namespace CalamityMod.NPCs.Cryogen { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num621 = 0; num621 < 25; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 67, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -121,10 +121,10 @@ namespace CalamityMod.NPCs.Cryogen for (int num623 = 0; num623 < 50; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 67, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 67, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } @@ -133,7 +133,7 @@ namespace CalamityMod.NPCs.Cryogen int totalProjectiles = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 6 : 4; double radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage2 = npc.GetProjectileDamage(type); + int damage2 = NPC.GetProjectileDamage(type); float velocity = 9f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; @@ -142,7 +142,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.Center, vector255, type, damage2, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(NPC.Center, vector255, type, damage2, 0f, Main.myPlayer); Main.projectile[proj].timeLeft = 300; } } @@ -152,7 +152,7 @@ namespace CalamityMod.NPCs.Cryogen { randomSpread = Main.rand.Next(-200, 200) / 100; for (int x = 0; x < 4; x++) - Gore.NewGore(npc.Center, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoShieldGore" + x), 1f); + Gore.NewGore(NPC.Center, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/CryoShieldGore" + x), 1f); } } } diff --git a/NPCs/DesertScourge/DesertNuisanceBody.cs b/NPCs/DesertScourge/DesertNuisanceBody.cs index 31f11058df..0a14955344 100644 --- a/NPCs/DesertScourge/DesertNuisanceBody.cs +++ b/NPCs/DesertScourge/DesertNuisanceBody.cs @@ -12,26 +12,26 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - npc.GetNPCDamage(); - npc.width = 40; - npc.height = 40; - npc.defense = 4; - npc.lifeMax = BossRushEvent.BossRushActive ? 35000 : 800; - npc.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 40; + NPC.height = 40; + NPC.defense = 4; + NPC.lifeMax = BossRushEvent.BossRushActive ? 35000 : 800; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToWater = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -41,11 +41,11 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(true); bool shouldDespawn = true; for (int i = 0; i < Main.maxNPCs; i++) @@ -58,32 +58,32 @@ namespace CalamityMod.NPCs.DesertScourge } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - if (Main.player[npc.target].dead) - npc.TargetClosest(false); + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -91,31 +91,31 @@ namespace CalamityMod.NPCs.DesertScourge num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; else if (num191 > 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } } @@ -133,24 +133,24 @@ namespace CalamityMod.NPCs.DesertScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody"), 0.65f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody2"), 0.65f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody3"), 0.65f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/ScourgeBody"), 0.65f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/ScourgeBody2"), 0.65f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/ScourgeBody3"), 0.65f); for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.7f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index 3e3e622917..9040bfeb07 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.DesertScourge { @@ -19,46 +20,46 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.defense = 2; - npc.width = 60; - npc.height = 60; - npc.lifeMax = BossRushEvent.BossRushActive ? 35000 : 800; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.defense = 2; + NPC.width = 60; + NPC.height = 60; + NPC.lifeMax = BossRushEvent.BossRushActive ? 35000 : 800; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToWater = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(true); - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { if (!TailSpawned) { - npc.ai[2] = (float)npc.whoAmI; - npc.realLife = npc.whoAmI; - int num2 = npc.whoAmI; + NPC.ai[2] = (float)NPC.whoAmI; + NPC.realLife = NPC.whoAmI; + int num2 = NPC.whoAmI; int num3 = maxLength; for (int j = 0; j <= num3; j++) { @@ -67,9 +68,9 @@ namespace CalamityMod.NPCs.DesertScourge { num4 = ModContent.NPCType(); } - int num5 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), num4, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num5].ai[2] = (float)npc.whoAmI; - Main.npc[num5].realLife = npc.whoAmI; + int num5 = NPC.NewNPC((int)(NPC.position.X + (float)(NPC.width / 2)), (int)(NPC.position.Y + (float)NPC.height), num4, NPC.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num5].ai[2] = (float)NPC.whoAmI; + Main.npc[num5].realLife = NPC.whoAmI; Main.npc[num5].ai[1] = (float)num2; Main.npc[num2].ai[0] = (float)num5; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num5, 0f, 0f, 0f, 0, 0, 0); @@ -78,10 +79,10 @@ namespace CalamityMod.NPCs.DesertScourge TailSpawned = true; } } - int num12 = (int)(npc.position.X / 16f) - 1; - int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num14 = (int)(npc.position.Y / 16f) - 1; - int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + int num12 = (int)(NPC.position.X / 16f) - 1; + int num13 = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; + int num14 = (int)(NPC.position.Y / 16f) - 1; + int num15 = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; if (num12 < 0) { num12 = 0; @@ -105,12 +106,12 @@ namespace CalamityMod.NPCs.DesertScourge { for (int l = num14; l < num15; l++) { - if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) + if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].liquid > 64)) { Vector2 vector2; vector2.X = (float)(k * 16); vector2.Y = (float)(l * 16); - if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) + if (NPC.position.X + (float)NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + (float)NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f) { flag2 = true; break; @@ -121,11 +122,11 @@ namespace CalamityMod.NPCs.DesertScourge } if (!flag2) { - npc.localAI[1] = 1f; - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + NPC.localAI[1] = 1f; + Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); int num16 = 1000; bool flag3 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) + if (NPC.position.Y > Main.player[NPC.target].position.Y) { for (int m = 0; m < 255; m++) { @@ -147,19 +148,19 @@ namespace CalamityMod.NPCs.DesertScourge } else { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; } float num17 = 16f; - if (Main.player[npc.target].dead) + if (Main.player[NPC.target].dead) { flag2 = false; - npc.velocity.Y = npc.velocity.Y + 1f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) + NPC.velocity.Y = NPC.velocity.Y + 1f; + if ((double)NPC.position.Y > Main.worldSurface * 16.0) { - npc.velocity.Y = npc.velocity.Y + 1f; + NPC.velocity.Y = NPC.velocity.Y + 1f; num17 = 32f; } - if ((double)npc.position.Y > Main.rockLayer * 16.0) + if ((double)NPC.position.Y > Main.rockLayer * 16.0) { for (int a = 0; a < 200; a++) { @@ -173,9 +174,9 @@ namespace CalamityMod.NPCs.DesertScourge } float num18 = speed; float num19 = turnSpeed; - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num20 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num21 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num20 = (float)((int)(num20 / 16f) * 16); num21 = (float)((int)(num21 / 16f) * 16); vector3.X = (float)((int)(vector3.X / 16f) * 16); @@ -185,49 +186,49 @@ namespace CalamityMod.NPCs.DesertScourge float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); if (!flag2) { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + 0.15f; - if (npc.velocity.Y > num17) + NPC.TargetClosest(true); + NPC.velocity.Y = NPC.velocity.Y + 0.15f; + if (NPC.velocity.Y > num17) { - npc.velocity.Y = num17; + NPC.velocity.Y = num17; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4) { - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; } else { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; } } - else if (npc.velocity.Y == num17) + else if (NPC.velocity.Y == num17) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } } - else if (npc.velocity.Y > 4f) + else if (NPC.velocity.Y > 4f) { - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.velocity.X = npc.velocity.X + num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X + num18 * 0.9f; } else { - npc.velocity.X = npc.velocity.X - num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X - num18 * 0.9f; } } } else { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { float num24 = num22 / 40f; if (num24 < 10f) @@ -238,8 +239,8 @@ namespace CalamityMod.NPCs.DesertScourge { num24 = 20f; } - npc.soundDelay = (int)num24; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + NPC.soundDelay = (int)num24; + SoundEngine.PlaySound(SoundID.Roar, (int)NPC.position.X, (int)NPC.position.Y, 1, 1f, 0f); } num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); float num25 = Math.Abs(num20); @@ -247,131 +248,131 @@ namespace CalamityMod.NPCs.DesertScourge float num27 = num17 / num22; num20 *= num27; num21 *= num27; - if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) + if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num19; + NPC.velocity.X = NPC.velocity.X + num19; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num19; + NPC.velocity.X = NPC.velocity.X - num19; } - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num19; + NPC.velocity.Y = NPC.velocity.Y + num19; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num19; + NPC.velocity.Y = NPC.velocity.Y - num19; } } - if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) + if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + num18; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - num18; } - if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f))) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num18 * 2f; } else { - npc.velocity.Y = npc.velocity.Y - num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num18 * 2f; } } - if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f))) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num18 * 2f; + NPC.velocity.X = NPC.velocity.X + num18 * 2f; } else { - npc.velocity.X = npc.velocity.X - num18 * 2f; + NPC.velocity.X = NPC.velocity.X - num18 * 2f; } } } else if (num25 > num26) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + num18; } else { - npc.velocity.Y = npc.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - num18; } } } else { - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } else { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } } } } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; if (flag2) { - if (npc.localAI[0] != 1f) + if (NPC.localAI[0] != 1f) { - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.localAI[0] = 1f; + NPC.localAI[0] = 1f; } else { - if (npc.localAI[0] != 0f) + if (NPC.localAI[0] != 0f) { - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) { - npc.netUpdate = true; + NPC.netUpdate = true; } } @@ -381,22 +382,22 @@ namespace CalamityMod.NPCs.DesertScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead"), 0.65f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead2"), 0.65f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScourgeHead"), 0.65f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScourgeHead2"), 0.65f); for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.7f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/DesertScourge/DesertNuisanceTail.cs b/NPCs/DesertScourge/DesertNuisanceTail.cs index f8a30b46be..7dfb0792cc 100644 --- a/NPCs/DesertScourge/DesertNuisanceTail.cs +++ b/NPCs/DesertScourge/DesertNuisanceTail.cs @@ -12,26 +12,26 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - npc.GetNPCDamage(); - npc.width = 32; - npc.height = 32; - npc.defense = 7; - npc.lifeMax = BossRushEvent.BossRushActive ? 35000 : 800; - npc.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 32; + NPC.height = 32; + NPC.defense = 7; + NPC.lifeMax = BossRushEvent.BossRushActive ? 35000 : 800; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToWater = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -41,11 +41,11 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(true); bool shouldDespawn = true; for (int i = 0; i < Main.maxNPCs; i++) @@ -58,32 +58,32 @@ namespace CalamityMod.NPCs.DesertScourge } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - if (Main.player[npc.target].dead) - npc.TargetClosest(false); + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -91,31 +91,31 @@ namespace CalamityMod.NPCs.DesertScourge num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; else if (num191 > 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } } @@ -123,14 +123,14 @@ namespace CalamityMod.NPCs.DesertScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeTail"), 0.65f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScourgeTail"), 0.65f); for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } @@ -147,7 +147,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.7f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 1ce5d1109e..dfd8d68e3c 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -18,41 +18,41 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - npc.GetNPCDamage(); - npc.width = 32; - npc.height = 36; - npc.defense = 6; - npc.DR_NERD(0.05f); - npc.LifeMaxNERB(2500, 3000, 1650000); + NPC.GetNPCDamage(); + NPC.width = 32; + NPC.height = 36; + NPC.defense = 6; + NPC.DR_NERD(0.05f); + NPC.LifeMaxNERB(2500, 3000, 1650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.boss = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.boss = true; music = CalamityMod.Instance.GetMusicFromMusicMod("DesertScourge") ?? MusicID.Boss1; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -62,18 +62,18 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; float burrowTimeGateValue = death ? 420f : 540f; - bool burrow = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] >= burrowTimeGateValue; + bool burrow = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] >= burrowTimeGateValue; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(true); bool shouldDespawn = true; for (int i = 0; i < Main.maxNPCs; i++) @@ -86,38 +86,38 @@ namespace CalamityMod.NPCs.DesertScourge } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - if (Main.player[npc.target].dead) - npc.TargetClosest(false); + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); if (Main.netMode != NetmodeID.MultiplayerClient && revenge && !burrow) { - npc.localAI[0] += malice ? 6f : Main.rand.Next(4); - if (npc.localAI[0] >= Main.rand.Next(1400, 26001)) + NPC.localAI[0] += malice ? 6f : Main.rand.Next(4); + if (NPC.localAI[0] >= Main.rand.Next(1400, 26001)) { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + NPC.localAI[0] = 0f; + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + Vector2 vector104 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)(NPC.height / 2)); float num942 = player.position.X + (float)player.width * 0.5f - vector104.X; float num943 = player.position.Y + (float)player.height * 0.5f - vector104.Y; float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); @@ -130,16 +130,16 @@ namespace CalamityMod.NPCs.DesertScourge vector104.Y += num943 * 5f; if (Main.rand.NextBool(2) || malice) { - Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, npc.GetProjectileDamage(projectileType), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, NPC.GetProjectileDamage(projectileType), 0f, Main.myPlayer, 0f, 0f); } - npc.netUpdate = true; + NPC.netUpdate = true; } } } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -147,31 +147,31 @@ namespace CalamityMod.NPCs.DesertScourge num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; else if (num191 > 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } } @@ -188,22 +188,22 @@ namespace CalamityMod.NPCs.DesertScourge public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody"), npc.scale); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody3"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/ScourgeBody"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/ScourgeBody2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/ScourgeBody3"), NPC.scale); for (int k = 0; k < 10; k++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 7af015611e..4001aa38c7 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -18,6 +18,7 @@ using System.Reflection; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.DesertScourge { @@ -35,42 +36,42 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.defense = 4; - npc.npcSlots = 12f; - npc.width = 32; - npc.height = 80; - npc.LifeMaxNERB(2500, 3000, 1650000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.defense = 4; + NPC.npcSlots = 12f; + NPC.width = 32; + NPC.height = 80; + NPC.LifeMaxNERB(2500, 3000, 1650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.boss = true; - npc.value = Item.buyPrice(0, 5, 0, 0); - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; + NPC.knockBackResist = 0f; + NPC.boss = true; + NPC.value = Item.buyPrice(0, 5, 0, 0); + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; bossBag = ModContent.ItemType(); music = CalamityMod.Instance.GetMusicFromMusicMod("DesertScourge") ?? MusicID.Boss1; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) @@ -78,7 +79,7 @@ namespace CalamityMod.NPCs.DesertScourge writer.Write(biomeEnrageTimer); writer.Write(playRoarSound); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -86,7 +87,7 @@ namespace CalamityMod.NPCs.DesertScourge biomeEnrageTimer = reader.ReadInt32(); playRoarSound = reader.ReadBoolean(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() @@ -97,14 +98,14 @@ namespace CalamityMod.NPCs.DesertScourge bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; // Enrage if (!player.ZoneDesert && !BossRushEvent.BossRushActive) @@ -120,21 +121,21 @@ namespace CalamityMod.NPCs.DesertScourge float enrageScale = BossRushEvent.BossRushActive ? 1f : 0f; if (biomeEnraged) { - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 2f; } // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; if (revenge || lifeRatio < (expertMode ? 0.75f : 0.5f)) - npc.Calamity().newAI[0] += 1f; + NPC.Calamity().newAI[0] += 1f; float burrowTimeGateValue = death ? 420f : 540f; - bool burrow = npc.Calamity().newAI[0] >= burrowTimeGateValue; - bool resetTime = npc.Calamity().newAI[0] >= burrowTimeGateValue + 600f; - bool lungeUpward = burrow && npc.Calamity().newAI[1] == 1f; - bool quickFall = npc.Calamity().newAI[1] == 2f; + bool burrow = NPC.Calamity().newAI[0] >= burrowTimeGateValue; + bool resetTime = NPC.Calamity().newAI[0] >= burrowTimeGateValue + 600f; + bool lungeUpward = burrow && NPC.Calamity().newAI[1] == 1f; + bool quickFall = NPC.Calamity().newAI[1] == 2f; float speed = 0.09f; float turnSpeed = 0.06f; @@ -156,32 +157,32 @@ namespace CalamityMod.NPCs.DesertScourge turnSpeed *= 1.5f; } - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!TailSpawned && npc.ai[0] == 0f) + if (!TailSpawned && NPC.ai[0] == 0f) { - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; int minLength = death ? 40 : revenge ? 35 : expertMode ? 30 : 25; for (int num36 = 0; num36 < minLength + 1; num36++) { int lol; if (num36 >= 0 && num36 < minLength) { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } else { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } - Main.npc[lol].ai[2] = npc.whoAmI; - Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = NPC.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); @@ -191,10 +192,10 @@ namespace CalamityMod.NPCs.DesertScourge } } - int num12 = (int)(npc.position.X / 16f) - 1; - int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num14 = (int)(npc.position.Y / 16f) - 1; - int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + int num12 = (int)(NPC.position.X / 16f) - 1; + int num13 = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; + int num14 = (int)(NPC.position.Y / 16f) - 1; + int num15 = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; if (num12 < 0) { num12 = 0; @@ -218,12 +219,12 @@ namespace CalamityMod.NPCs.DesertScourge { for (int l = num14; l < num15; l++) { - if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) + if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].liquid > 64)) { Vector2 vector2; vector2.X = (float)(k * 16); vector2.Y = (float)(l * 16); - if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) + if (NPC.position.X + (float)NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + (float)NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f) { flag2 = true; break; @@ -234,14 +235,14 @@ namespace CalamityMod.NPCs.DesertScourge } if (!flag2) { - npc.localAI[1] = 1f; - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + NPC.localAI[1] = 1f; + Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); int num954 = 1000; if (enrageScale > 0f) num954 = 100; bool flag3 = true; - if (npc.position.Y > player.position.Y) + if (NPC.position.Y > player.position.Y) { int rectWidth = num954 * 2; int rectHeight = num954 * 2; @@ -267,20 +268,20 @@ namespace CalamityMod.NPCs.DesertScourge } else { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; } float num17 = 16f; if (player.dead) { flag2 = false; - npc.velocity.Y += 1f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) + NPC.velocity.Y += 1f; + if ((double)NPC.position.Y > Main.worldSurface * 16.0) { - npc.velocity.Y += 1f; + NPC.velocity.Y += 1f; num17 = 32f; } - if ((double)npc.position.Y > Main.rockLayer * 16.0) + if ((double)NPC.position.Y > Main.rockLayer * 16.0) { for (int a = 0; a < 200; a++) { @@ -298,7 +299,7 @@ namespace CalamityMod.NPCs.DesertScourge float burrowDistance = malice ? 500f : 800f; float burrowTarget = player.Center.Y + burrowDistance; float lungeTarget = player.Center.Y - 600f; - Vector2 vector3 = npc.Center; + Vector2 vector3 = NPC.Center; float num20 = player.Center.X; float num21 = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y; num20 = (float)((int)(num20 / 16f) * 16); @@ -310,32 +311,32 @@ namespace CalamityMod.NPCs.DesertScourge float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); // Lunge up towards target - if (burrow && npc.Center.Y >= burrowTarget - 16f) + if (burrow && NPC.Center.Y >= burrowTarget - 16f) { - npc.Calamity().newAI[1] = 1f; + NPC.Calamity().newAI[1] = 1f; if (!playRoarSound) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DesertScourgeRoar"), player.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DesertScourgeRoar"), player.Center); playRoarSound = true; } } // Quickly fall back down once above target - if (lungeUpward && npc.Center.Y <= player.Center.Y - 420f) + if (lungeUpward && NPC.Center.Y <= player.Center.Y - 420f) { - npc.TargetClosest(); - npc.Calamity().newAI[1] = 2f; + NPC.TargetClosest(); + NPC.Calamity().newAI[1] = 2f; playRoarSound = false; } // Quickly fall and reset variables once at target's Y position if (quickFall) { - npc.velocity.Y += 0.5f; - if (npc.Center.Y >= player.Center.Y) + NPC.velocity.Y += 0.5f; + if (NPC.Center.Y >= player.Center.Y) { - npc.Calamity().newAI[0] = 0f; - npc.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; playRoarSound = false; } } @@ -343,55 +344,55 @@ namespace CalamityMod.NPCs.DesertScourge // Reset variables if the burrow and lunge attack is taking too long if (resetTime) { - npc.Calamity().newAI[0] = 0f; - npc.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; } if (!flag2) { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + 0.15f; - if (npc.velocity.Y > num17) + NPC.TargetClosest(true); + NPC.velocity.Y = NPC.velocity.Y + 0.15f; + if (NPC.velocity.Y > num17) { - npc.velocity.Y = num17; + NPC.velocity.Y = num17; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4) { - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; } else { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; } } - else if (npc.velocity.Y == num17) + else if (NPC.velocity.Y == num17) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } } - else if (npc.velocity.Y > 4f) + else if (NPC.velocity.Y > 4f) { - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.velocity.X = npc.velocity.X + num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X + num18 * 0.9f; } else { - npc.velocity.X = npc.velocity.X - num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X - num18 * 0.9f; } } } else { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { float num24 = num22 / 40f; if (num24 < 10f) @@ -402,8 +403,8 @@ namespace CalamityMod.NPCs.DesertScourge { num24 = 20f; } - npc.soundDelay = (int)num24; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + NPC.soundDelay = (int)num24; + SoundEngine.PlaySound(SoundID.Roar, (int)NPC.position.X, (int)NPC.position.Y, 1, 1f, 0f); } num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); float num25 = Math.Abs(num20); @@ -411,131 +412,131 @@ namespace CalamityMod.NPCs.DesertScourge float num27 = num17 / num22; num20 *= num27; num21 *= num27; - if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) + if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num19; + NPC.velocity.X = NPC.velocity.X + num19; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num19; + NPC.velocity.X = NPC.velocity.X - num19; } - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num19; + NPC.velocity.Y = NPC.velocity.Y + num19; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num19; + NPC.velocity.Y = NPC.velocity.Y - num19; } } - if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) + if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + num18; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - num18; } - if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f))) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num18 * 2f; } else { - npc.velocity.Y = npc.velocity.Y - num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num18 * 2f; } } - if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f))) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num18 * 2f; + NPC.velocity.X = NPC.velocity.X + num18 * 2f; } else { - npc.velocity.X = npc.velocity.X - num18 * 2f; + NPC.velocity.X = NPC.velocity.X - num18 * 2f; } } } else if (num25 > num26) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + num18; } else { - npc.velocity.Y = npc.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - num18; } } } else { - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } else { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } } } } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; if (flag2) { - if (npc.localAI[0] != 1f) + if (NPC.localAI[0] != 1f) { - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.localAI[0] = 1f; + NPC.localAI[0] = 1f; } else { - if (npc.localAI[0] != 0f) + if (NPC.localAI[0] != 0f) { - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) { - npc.netUpdate = true; + NPC.netUpdate = true; } } @@ -547,37 +548,37 @@ namespace CalamityMod.NPCs.DesertScourge public override bool SpecialNPCLoot() { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + int closestSegmentID = DropHelper.FindClosestWormSegment(NPC, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()); - npc.position = Main.npc[closestSegmentID].position; + NPC.position = Main.npc[closestSegmentID].position; return false; } public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItem(npc, ItemID.LesserHealingPotion, 8, 14); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedDesertScourge); + DropHelper.DropItem(NPC, ItemID.LesserHealingPotion, 8, 14); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedDesertScourge); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { // Materials - DropHelper.DropItem(npc, ModContent.ItemType(), 7, 14); - DropHelper.DropItem(npc, ItemID.Coral, 5, 9); - DropHelper.DropItem(npc, ItemID.Seashell, 5, 9); - DropHelper.DropItem(npc, ItemID.Starfish, 5, 9); + DropHelper.DropItem(NPC, ModContent.ItemType(), 7, 14); + DropHelper.DropItem(NPC, ItemID.Coral, 5, 9); + DropHelper.DropItem(NPC, ItemID.Seashell, 5, 9); + DropHelper.DropItem(NPC, ItemID.Starfish, 5, 9); // Weapons // Set up the base drop set, which includes Scourge of the Desert at its normal drop chance. float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -588,13 +589,13 @@ namespace CalamityMod.NPCs.DesertScourge ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); // Fishing - DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); } // If Desert Scourge has not been killed yet, notify players that the Sunken Sea is open and Sandstorms can happen @@ -622,23 +623,23 @@ namespace CalamityMod.NPCs.DesertScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead2"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScourgeHead"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScourgeHead2"), NPC.scale); for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index de8b378c04..e7b259eaee 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -16,41 +16,41 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - npc.GetNPCDamage(); - npc.width = 32; - npc.height = 48; - npc.defense = 9; - npc.DR_NERD(0.1f); - npc.LifeMaxNERB(2500, 3000, 1650000); + NPC.GetNPCDamage(); + NPC.width = 32; + NPC.height = 48; + NPC.defense = 9; + NPC.DR_NERD(0.1f); + NPC.LifeMaxNERB(2500, 3000, 1650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.boss = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.boss = true; music = CalamityMod.Instance.GetMusicFromMusicMod("DesertScourge") ?? MusicID.Boss1; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -60,11 +60,11 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(true); bool shouldDespawn = true; for (int i = 0; i < Main.maxNPCs; i++) @@ -77,32 +77,32 @@ namespace CalamityMod.NPCs.DesertScourge } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - if (Main.player[npc.target].dead) - npc.TargetClosest(false); + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -110,31 +110,31 @@ namespace CalamityMod.NPCs.DesertScourge num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; else if (num191 > 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } } @@ -142,14 +142,14 @@ namespace CalamityMod.NPCs.DesertScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeTail"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScourgeTail"), NPC.scale); for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } @@ -166,7 +166,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index e82c50d84c..878ac87774 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -37,33 +37,33 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 56; - npc.height = 56; - npc.defense = 70; - CalamityGlobalNPC global = npc.Calamity(); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 56; + NPC.height = 56; + NPC.defense = 70; + CalamityGlobalNPC global = NPC.Calamity(); global.DR = 0.925f; global.unbreakableDR = true; - npc.LifeMaxNERB(888750, 1066500, 1500000); // Phase 1 is 371250, Phase 2 is 517500 + NPC.LifeMaxNERB(888750, 1066500, 1500000); // Phase 1 is 371250, Phase 2 is 517500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.Opacity = 0f; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.chaseable = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; + NPC.knockBackResist = 0f; + NPC.Opacity = 0f; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.chaseable = false; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.boss = true; music = CalamityMod.Instance.GetMusicFromMusicMod("DevourerOfGodsP1") ?? MusicID.Boss3; - npc.dontCountMe = true; + NPC.dontCountMe = true; } public override void BossHeadSlot(ref int index) @@ -85,34 +85,34 @@ namespace CalamityMod.NPCs.DevourerofGods if (head is null || modNPC.AwaitingPhase2Teleport || !modNPC.Phase2Started) return; - rotation = npc.rotation; + rotation = NPC.rotation; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(phase2Started); writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); writer.Write(setOpacity); - writer.Write(npc.Opacity); + writer.Write(NPC.Opacity); writer.Write(SegmentIndex); - writer.Write(npc.frame.X); - writer.Write(npc.frame.Y); - writer.Write(npc.frame.Width); - writer.Write(npc.frame.Height); + writer.Write(NPC.frame.X); + writer.Write(NPC.frame.Y); + writer.Write(NPC.frame.Width); + writer.Write(NPC.frame.Height); } public override void ReceiveExtraAI(BinaryReader reader) { phase2Started = reader.ReadBoolean(); invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); setOpacity = reader.ReadBoolean(); - npc.Opacity = reader.ReadSingle(); + NPC.Opacity = reader.ReadSingle(); SegmentIndex = reader.ReadInt32(); Rectangle frame = new Rectangle(reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32()); if (frame.Width > 0 && frame.Height > 0) - npc.frame = frame; + NPC.frame = frame; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -122,13 +122,13 @@ namespace CalamityMod.NPCs.DevourerofGods public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; - if (npc.life / (float)npc.lifeMax < 0.6f) + if (NPC.life / (float)NPC.lifeMax < 0.6f) { phase2Started = true; @@ -139,33 +139,33 @@ namespace CalamityMod.NPCs.DevourerofGods // Once before DoG spawns, set new size if (CalamityWorld.DoGSecondStageCountdown == 60) { - npc.position = npc.Center; - npc.width = 70; - npc.height = 70; - npc.frame = new Rectangle(0, 0, 114, 88); - npc.position -= npc.Size * 0.5f; - npc.netUpdate = true; + NPC.position = NPC.Center; + NPC.width = 70; + NPC.height = 70; + NPC.frame = new Rectangle(0, 0, 114, 88); + NPC.position -= NPC.Size * 0.5f; + NPC.netUpdate = true; } } - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); if (invinceTime > 0) { invinceTime--; - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; } else - npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; + NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; - if (Main.npc[(int)npc.ai[2]].dontTakeDamage) + if (Main.npc[(int)NPC.ai[2]].dontTakeDamage) invinceTime = 240; // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -179,42 +179,42 @@ namespace CalamityMod.NPCs.DevourerofGods } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].Opacity >= 0.5f && (!setOpacity || (CalamityWorld.DoGSecondStageCountdown <= 60 && CalamityWorld.DoGSecondStageCountdown > 0))) + if (Main.npc[(int)NPC.ai[1]].Opacity >= 0.5f && (!setOpacity || (CalamityWorld.DoGSecondStageCountdown <= 60 && CalamityWorld.DoGSecondStageCountdown > 0))) { - npc.Opacity += 0.165f; - if (npc.Opacity >= 1f && invinceTime <= 0) + NPC.Opacity += 0.165f; + if (NPC.Opacity >= 1f && invinceTime <= 0) { setOpacity = true; - npc.Opacity = 1f; + NPC.Opacity = 1f; } } else { - if (Main.npc[(int)npc.ai[2]].ModNPC()?.AttemptingToEnterPortal ?? false) + if (Main.npc[(int)NPC.ai[2]].ModNPC()?.AttemptingToEnterPortal ?? false) { if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile portal = Main.projectile[Main.npc[(int)npc.ai[2]].ModNPC().PortalIndex]; - float newOpacity = 1f - Utils.InverseLerp(270f, 100f, npc.Distance(portal.Center), true); - if (newOpacity > 0f && npc.Opacity > newOpacity) + Projectile portal = Main.projectile[Main.npc[(int)NPC.ai[2]].ModNPC().PortalIndex]; + float newOpacity = 1f - Utils.InverseLerp(270f, 100f, NPC.Distance(portal.Center), true); + if (newOpacity > 0f && NPC.Opacity > newOpacity) { - npc.Opacity = newOpacity; + NPC.Opacity = newOpacity; // Create dust at the portal position. - if (Vector2.Dot((npc.rotation - MathHelper.PiOver2).ToRotationVector2(), Main.npc[(int)npc.ai[2]].velocity) > 0f) + if (Vector2.Dot((NPC.rotation - MathHelper.PiOver2).ToRotationVector2(), Main.npc[(int)NPC.ai[2]].velocity) > 0f) { for (int i = 0; i < 2; i++) { @@ -225,18 +225,18 @@ namespace CalamityMod.NPCs.DevourerofGods } } - if (npc.Opacity < 0.2f) - npc.Opacity = 0f; + if (NPC.Opacity < 0.2f) + NPC.Opacity = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } } else - npc.Opacity = Main.npc[(int)npc.ai[2]].Opacity; + NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity; } - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num191 = player.position.X + (player.width / 2); float num192 = player.position.Y + (player.height / 2); num191 = (int)(num191 / 16f) * 16; @@ -246,73 +246,73 @@ namespace CalamityMod.NPCs.DevourerofGods num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - float disintegrationFactor = Main.npc[npc.realLife].ModNPC().DeathAnimationTimer / 640f; + float disintegrationFactor = Main.npc[NPC.realLife].ModNPC().DeathAnimationTimer / 640f; if (disintegrationFactor > 0f) { spriteBatch.EnterShaderRegion(); GameShaders.Misc["CalamityMod:DoGDisintegration"].UseOpacity(disintegrationFactor); - GameShaders.Misc["CalamityMod:DoGDisintegration"].UseSaturation(npc.whoAmI); + GameShaders.Misc["CalamityMod:DoGDisintegration"].UseSaturation(NPC.whoAmI); GameShaders.Misc["CalamityMod:DoGDisintegration"].UseImage("Images/Misc/Perlin"); GameShaders.Misc["CalamityMod:DoGDisintegration"].Apply(); } SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = phase2Started && CalamityWorld.DoGSecondStageCountdown <= 60; - Texture2D texture2D15 = useOtherTextures ? ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyS") : Main.npcTexture[npc.type]; + Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyS") : Main.npcTexture[NPC.type]; Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - if (!npc.dontTakeDamage) + if (!NPC.dontTakeDamage) { if (useOtherTextures) { - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodySGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodySGlow"); Color color36 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color36, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color36, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } - texture2D15 = useOtherTextures ? ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodySGlow2") : ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyGlow"); + texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodySGlow2") : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyGlow"); Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } if (disintegrationFactor > 0f) @@ -327,10 +327,10 @@ namespace CalamityMod.NPCs.DevourerofGods Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -340,26 +340,26 @@ namespace CalamityMod.NPCs.DevourerofGods if (dist4 < minDist) minDist = dist4; - return minDist <= (phase2Started ? 55f : 40f) && npc.Opacity >= 1f && invinceTime <= 0; + return minDist <= (phase2Started ? 55f : 40f) && NPC.Opacity >= 1f && invinceTime <= 0; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if ((damage * (crit ? 2D : 1D)) >= npc.life || (npc.realLife >= 0 && Main.npc[npc.realLife].ModNPC().Dying)) + if ((damage * (crit ? 2D : 1D)) >= NPC.life || (NPC.realLife >= 0 && Main.npc[NPC.realLife].ModNPC().Dying)) { - if (npc.realLife >= 0) + if (NPC.realLife >= 0) { damage = 0D; - npc.dontTakeDamage = true; - Main.npc[npc.realLife].dontTakeDamage = true; - Main.npc[npc.realLife].life = 1; + NPC.dontTakeDamage = true; + Main.npc[NPC.realLife].dontTakeDamage = true; + Main.npc[NPC.realLife].life = 1; - if (!Main.npc[npc.realLife].ModNPC().Dying) + if (!Main.npc[NPC.realLife].ModNPC().Dying) { - Main.npc[npc.realLife].ModNPC().Dying = true; - Main.npc[npc.realLife].dontTakeDamage = true; - Main.npc[npc.realLife].active = true; - Main.npc[npc.realLife].netUpdate = true; + Main.npc[NPC.realLife].ModNPC().Dying = true; + Main.npc[NPC.realLife].dontTakeDamage = true; + Main.npc[NPC.realLife].active = true; + Main.npc[NPC.realLife].netUpdate = true; } } return false; @@ -369,8 +369,8 @@ namespace CalamityMod.NPCs.DevourerofGods public override bool CheckDead() { - if (npc.realLife >= 0) - Main.npc[npc.realLife].checkDead(); + if (NPC.realLife >= 0) + Main.npc[NPC.realLife].checkDead(); return base.CheckDead(); } @@ -386,19 +386,19 @@ namespace CalamityMod.NPCs.DevourerofGods public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { float randomSpread = Main.rand.Next(-100, 100) / 100; - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGS6"), 1f); - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/DoGS6"), 1f); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 50; + NPC.height = 50; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -408,10 +408,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -419,8 +419,8 @@ namespace CalamityMod.NPCs.DevourerofGods public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/DevourerofGods/DevourerofGodsBody2.cs b/NPCs/DevourerofGods/DevourerofGodsBody2.cs index ada111c172..f3773b92fa 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody2.cs @@ -19,38 +19,38 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - npc.GetNPCDamage(); - npc.width = 34; - npc.height = 34; - npc.defense = 60; - CalamityGlobalNPC global = npc.Calamity(); + NPC.GetNPCDamage(); + NPC.width = 34; + NPC.height = 34; + NPC.defense = 60; + CalamityGlobalNPC global = NPC.Calamity(); global.DR = 0.5f; global.unbreakableDR = true; - npc.lifeMax = 50000; - npc.aiStyle = -1; + NPC.lifeMax = 50000; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.dontCountMe = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) { invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -60,22 +60,22 @@ namespace CalamityMod.NPCs.DevourerofGods public override void AI() { - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); if (invinceTime > 0) { invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; + NPC.damage = 0; + NPC.dontTakeDamage = true; } else { - npc.damage = npc.defDamage; - npc.dontTakeDamage = false; + NPC.damage = NPC.defDamage; + NPC.dontTakeDamage = false; } - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -89,36 +89,36 @@ namespace CalamityMod.NPCs.DevourerofGods } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - if (npc.alpha != 0) + if (NPC.alpha != 0) { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + int num935 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); Main.dust[num935].noGravity = true; Main.dust[num935].noLight = true; } - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; @@ -126,47 +126,47 @@ namespace CalamityMod.NPCs.DevourerofGods num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBody2Glow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBody2Glow"); Color color37 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -189,22 +189,22 @@ namespace CalamityMod.NPCs.DevourerofGods public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT5"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/DoT2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/DoT3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/DoT4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/DoT5"), 1f); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 50; + NPC.height = 50; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -214,10 +214,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 9a8de1565a..63819bf5d8 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -31,6 +31,7 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.DevourerofGods { @@ -139,27 +140,27 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 104; - npc.height = 104; - npc.defense = 50; - npc.LifeMaxNERB(888750, 1066500, 1500000); // Phase 1 is 371250, Phase 2 is 517500 + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 104; + NPC.height = 104; + NPC.defense = 50; + NPC.LifeMaxNERB(888750, 1066500, 1500000); // Phase 1 is 371250, Phase 2 is 517500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.takenDamageMultiplier = 1.1f; - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.takenDamageMultiplier = 1.1f; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.boss = true; - npc.value = Item.buyPrice(6, 0, 0, 0); - npc.Opacity = 0f; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; + NPC.knockBackResist = 0f; + NPC.boss = true; + NPC.value = Item.buyPrice(6, 0, 0, 0); + NPC.Opacity = 0f; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; music = CalamityMod.Instance.GetMusicFromMusicMod("DevourerOfGodsP1") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); } @@ -177,7 +178,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void BossHeadRotation(ref float rotation) { if (Phase2Started && CalamityWorld.DoGSecondStageCountdown <= 60) - rotation = npc.rotation; + rotation = NPC.rotation; } public override void SendExtraAI(BinaryWriter writer) @@ -185,7 +186,7 @@ namespace CalamityMod.NPCs.DevourerofGods bool wasDyingBefore = Dying; // Phase 1 syncs - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); writer.Write(spawnedGuardians); writer.Write(spawnedGuardians2); writer.Write(spawnedGuardians3); @@ -197,7 +198,7 @@ namespace CalamityMod.NPCs.DevourerofGods writer.Write(laserWallType); writer.Write(PortalIndex); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); // Phase 2 syncs writer.Write(shotSpacing_Phase2[0]); @@ -210,7 +211,7 @@ namespace CalamityMod.NPCs.DevourerofGods writer.Write(postTeleportTimer); writer.Write(preventBullshitHitsAtStartofFinalPhaseTimer); writer.Write(teleportTimer); - writer.Write(npc.Opacity); + writer.Write(NPC.Opacity); // Death animation syncs writer.Write(Dying); @@ -218,23 +219,23 @@ namespace CalamityMod.NPCs.DevourerofGods writer.Write(DestroyedSegmentCount); // Frame syncs - writer.Write(npc.frame.X); - writer.Write(npc.frame.Y); - writer.Write(npc.frame.Width); - writer.Write(npc.frame.Height); + writer.Write(NPC.frame.X); + writer.Write(NPC.frame.Y); + writer.Write(NPC.frame.Width); + writer.Write(NPC.frame.Height); // Be sure to inform clients of the fact that The Devourer of Gods is dying if only the server recieved this packet. if (Main.netMode == NetmodeID.Server && !wasDyingBefore && Dying) { - npc.netSpam = 0; - npc.netUpdate = true; + NPC.netSpam = 0; + NPC.netUpdate = true; } } public override void ReceiveExtraAI(BinaryReader reader) { // Phase 1 syncs - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); spawnedGuardians = reader.ReadBoolean(); spawnedGuardians2 = reader.ReadBoolean(); spawnedGuardians3 = reader.ReadBoolean(); @@ -246,7 +247,7 @@ namespace CalamityMod.NPCs.DevourerofGods laserWallType = reader.ReadInt32(); PortalIndex = reader.ReadInt32(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); // Phase 2 syncs shotSpacing_Phase2[0] = reader.ReadInt32(); @@ -259,7 +260,7 @@ namespace CalamityMod.NPCs.DevourerofGods postTeleportTimer = reader.ReadInt32(); preventBullshitHitsAtStartofFinalPhaseTimer = reader.ReadInt32(); teleportTimer = reader.ReadInt32(); - npc.Opacity = reader.ReadSingle(); + NPC.Opacity = reader.ReadSingle(); // Death animation syncs Dying = reader.ReadBoolean(); @@ -269,40 +270,40 @@ namespace CalamityMod.NPCs.DevourerofGods // Frame syncs Rectangle frame = new Rectangle(reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32()); if (frame.Width > 0 && frame.Height > 0) - npc.frame = frame; + NPC.frame = frame; } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); // whoAmI variable - CalamityGlobalNPC.DoGHead = npc.whoAmI; + CalamityGlobalNPC.DoGHead = NPC.whoAmI; // Stop rain CalamityMod.StopRain(); // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; // Variables - Vector2 vector = npc.Center; - bool flies = npc.ai[3] == 0f; + Vector2 vector = NPC.Center; + bool flies = NPC.ai[3] == 0f; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Phase 1 phases bool phase2 = lifeRatio < 0.9f; @@ -338,11 +339,11 @@ namespace CalamityMod.NPCs.DevourerofGods if (expertMode) groundPhaseTurnSpeed += 0.1f * (1f - lifeRatio); - groundPhaseTurnSpeed += Vector2.Distance(player.Center, npc.Center) * 0.0002f; + groundPhaseTurnSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.0002f; // How long it takes before swapping phases int phaseLimit = death ? 600 : 900; - if (expertMode && npc.ai[3] == 0f) + if (expertMode && NPC.ai[3] == 0f) { phaseLimit /= 1 + (int)((death ? 4f : 5f) * (1f - lifeRatio)); if (phaseLimit < 180) @@ -353,29 +354,29 @@ namespace CalamityMod.NPCs.DevourerofGods AttemptingToEnterPortal = false; // Light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); // Worm variable - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Despawn if (player.dead) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.velocity.Y -= 3f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 3f; + NPC.velocity.Y -= 3f; + if ((double)NPC.position.Y < Main.topWorld + 16f) + NPC.velocity.Y -= 3f; int bodyType = ModContent.NPCType(); int tailType = ModContent.NPCType(); - if ((double)npc.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type != npc.type && Main.npc[a].type != bodyType && Main.npc[a].type != tailType) + if (Main.npc[a].type != NPC.type && Main.npc[a].type != bodyType && Main.npc[a].type != tailType) continue; Main.npc[a].active = false; @@ -392,14 +393,14 @@ namespace CalamityMod.NPCs.DevourerofGods if (distanceFromTarget > takeLessDamageDistance) { float damageTakenScalar = MathHelper.Clamp(1f - ((distanceFromTarget - takeLessDamageDistance) / takeLessDamageDistance), 0f, 1f); - npc.takenDamageMultiplier = MathHelper.Lerp(1f, 1.1f, damageTakenScalar); + NPC.takenDamageMultiplier = MathHelper.Lerp(1f, 1.1f, damageTakenScalar); } else - npc.takenDamageMultiplier = 1.1f; + NPC.takenDamageMultiplier = 1.1f; // Close DoG's HP bar if busy with sentinels or a P2 transition. if (CalamityWorld.DoGSecondStageCountdown > 0) - npc.Calamity().ShouldCloseHPBar = true; + NPC.Calamity().ShouldCloseHPBar = true; // Teleport after the Phase 2 animation. if (CalamityWorld.DoGSecondStageCountdown == 61) @@ -410,8 +411,8 @@ namespace CalamityMod.NPCs.DevourerofGods // Once the teleport happens he will be in position and this effect stops. if (Phase2Started && AwaitingPhase2Teleport && CalamityWorld.DoGSecondStageCountdown < 60) { - npc.Opacity = 0f; - npc.dontTakeDamage = true; + NPC.Opacity = 0f; + NPC.dontTakeDamage = true; } // Start sentinel phases, only run things that have to happen once in here @@ -424,18 +425,18 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.netMode != NetmodeID.MultiplayerClient) { // Reset important shit - npc.ai[3] = 0f; + NPC.ai[3] = 0f; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.netSpam = 0; - npc.netUpdate = true; + NPC.netSpam = 0; + NPC.netUpdate = true; } // Skip the sentinel phase entirely if DoG has already been killed CalamityWorld.DoGSecondStageCountdown = (CalamityWorld.downedDoG || CalamityWorld.downedSecondSentinels || BossRushEvent.BossRushActive) ? 600 : 21600; if (Main.netMode == NetmodeID.Server) { - var netMessage = mod.GetPacket(); + var netMessage = Mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); @@ -449,12 +450,12 @@ namespace CalamityMod.NPCs.DevourerofGods // Once before DoG spawns, set new size and become visible again. if (CalamityWorld.DoGSecondStageCountdown == 60) { - npc.position = npc.Center; - npc.width = 186; - npc.height = 186; - npc.position -= npc.Size * 0.5f; - npc.frame = new Rectangle(0, 0, 134, 196); - npc.netUpdate = true; + NPC.position = NPC.Center; + NPC.width = 186; + NPC.height = 186; + NPC.position -= NPC.Size * 0.5f; + NPC.frame = new Rectangle(0, 0, 134, 196); + NPC.netUpdate = true; } // Dialogue the moment the second phase starts @@ -473,44 +474,44 @@ namespace CalamityMod.NPCs.DevourerofGods if (CalamityWorld.DoGSecondStageCountdown > 5) { // Don't take damage - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; // Adjust movement speed. Direction is unaltered unless DoG is close to the top of the world, in which case he moves horizontally. // A portal will be created ahead of where DoG is moving that he will enter before Phase 2 begins. float idealFlySpeed = 14f; - float oldVelocity = npc.velocity.Length(); - float horizontalInterpolant = Utils.InverseLerp(1200f, 600f, npc.Center.Y, true); - Vector2 idealDirection = npc.velocity.SafeNormalize(-Vector2.UnitY); + float oldVelocity = NPC.velocity.Length(); + float horizontalInterpolant = Utils.InverseLerp(1200f, 600f, NPC.Center.Y, true); + Vector2 idealDirection = NPC.velocity.SafeNormalize(-Vector2.UnitY); idealDirection = Vector2.Lerp(idealDirection, Vector2.UnitX * Math.Sign(idealDirection.X), horizontalInterpolant); - npc.velocity = idealDirection * MathHelper.Lerp(oldVelocity, idealFlySpeed, 0.1f); - npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + NPC.velocity = idealDirection * MathHelper.Lerp(oldVelocity, idealFlySpeed, 0.1f); + NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; if (PortalIndex != -1) { Projectile portal = Main.projectile[PortalIndex]; - float newOpacity = 1f - Utils.InverseLerp(200f, 130f, npc.Distance(portal.Center), true); - if (Main.netMode != NetmodeID.MultiplayerClient && newOpacity > 0f && npc.Opacity > newOpacity) + float newOpacity = 1f - Utils.InverseLerp(200f, 130f, NPC.Distance(portal.Center), true); + if (Main.netMode != NetmodeID.MultiplayerClient && newOpacity > 0f && NPC.Opacity > newOpacity) { - npc.Opacity = newOpacity; - npc.netUpdate = true; + NPC.Opacity = newOpacity; + NPC.netUpdate = true; } - if (npc.Opacity < 0.2f) - npc.Opacity = 0f; + if (NPC.Opacity < 0.2f) + NPC.Opacity = 0f; // Ensure the portal is pointing in the direction of the head at first, to prevent direction offsets. if (CalamityWorld.DoGSecondStageCountdown > 360) - Main.projectile[PortalIndex].Center = npc.Center + npc.SafeDirectionTo(Main.projectile[PortalIndex].Center) * npc.Distance(Main.projectile[PortalIndex].Center); + Main.projectile[PortalIndex].Center = NPC.Center + NPC.SafeDirectionTo(Main.projectile[PortalIndex].Center) * NPC.Distance(Main.projectile[PortalIndex].Center); } if (Main.netMode != NetmodeID.MultiplayerClient && !hasCreatedPhase1Portal) { - Vector2 portalSpawnPosition = npc.Center + npc.velocity.SafeNormalize(-Vector2.UnitY) * 1000f; + Vector2 portalSpawnPosition = NPC.Center + NPC.velocity.SafeNormalize(-Vector2.UnitY) * 1000f; PortalIndex = Projectile.NewProjectile(portalSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); hasCreatedPhase1Portal = true; - npc.netUpdate = true; + NPC.netUpdate = true; } AttemptingToEnterPortal = true; @@ -520,7 +521,7 @@ namespace CalamityMod.NPCs.DevourerofGods else { // Immunity after teleport and when dying - npc.dontTakeDamage = postTeleportTimer > 0 || preventBullshitHitsAtStartofFinalPhaseTimer > 0 || Dying; + NPC.dontTakeDamage = postTeleportTimer > 0 || preventBullshitHitsAtStartofFinalPhaseTimer > 0 || Dying; // Teleport if (teleportTimer >= 0) @@ -556,13 +557,13 @@ namespace CalamityMod.NPCs.DevourerofGods teleportTimer = -1; } - npc.Opacity = 1f - (MathHelper.Clamp((calamityGlobalNPC.newAI[3] - alphaGateValue) * 5f, 0f, 255f) / 255f); + NPC.Opacity = 1f - (MathHelper.Clamp((calamityGlobalNPC.newAI[3] - alphaGateValue) * 5f, 0f, 255f) / 255f); } // Fire laser walls every 12 seconds after a laser wall phase ends if (calamityGlobalNPC.newAI[3] >= 720f) { - npc.Opacity = 0f; + NPC.Opacity = 0f; // Reset laser wall timer to 0 calamityGlobalNPC.newAI[1] = 0f; @@ -585,10 +586,10 @@ namespace CalamityMod.NPCs.DevourerofGods else if (laserWallPhase == (int)LaserWallPhase.End) { // End laser wall phase after 4.25 seconds - npc.Opacity += 0.004f; - if (npc.Opacity >= 1f) + NPC.Opacity += 0.004f; + if (NPC.Opacity >= 1f) { - npc.Opacity = 1f; + NPC.Opacity = 1f; laserWallPhase = (int)LaserWallPhase.SetUp; } } @@ -602,13 +603,13 @@ namespace CalamityMod.NPCs.DevourerofGods if (postTeleportTimer < 0) postTeleportTimer = 0; - npc.Opacity = 1f - (postTeleportTimer / 255f); + NPC.Opacity = 1f - (postTeleportTimer / 255f); } else { - npc.Opacity += 0.024f; - if (npc.Opacity >= 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.024f; + if (NPC.Opacity >= 1f) + NPC.Opacity = 1f; } // This exists so that DoG doesn't sometimes instantly kill the player when he goes to final phase @@ -616,8 +617,8 @@ namespace CalamityMod.NPCs.DevourerofGods { preventBullshitHitsAtStartofFinalPhaseTimer--; - if (npc.Opacity > 0.996f) - npc.Opacity = 0.996f; + if (NPC.Opacity > 0.996f) + NPC.Opacity = 0.996f; } // Reset laser wall phase @@ -639,10 +640,10 @@ namespace CalamityMod.NPCs.DevourerofGods // Summon Thots if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); for (int i = 0; i < 3; i++) - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); } spawnedGuardians3 = true; @@ -653,12 +654,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.netMode != NetmodeID.MultiplayerClient) { // Fireballs - if (npc.Opacity >= 1f && distanceFromTarget > 500f) + if (NPC.Opacity >= 1f && distanceFromTarget > 500f) { calamityGlobalNPC.newAI[0] += 1f; if (calamityGlobalNPC.newAI[0] >= 150f && calamityGlobalNPC.newAI[0] % (phase7 ? 20f : 40f) == 0f) { - Vector2 vector44 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector44 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num427 = player.position.X + (player.width / 2) - vector44.X; float num428 = player.position.Y + (player.height / 2) - vector44.Y; float num430 = 8f; @@ -666,13 +667,13 @@ namespace CalamityMod.NPCs.DevourerofGods num429 = num430 / num429; num427 *= num429; num428 *= num429; - num428 += npc.velocity.Y * 0.5f; - num427 += npc.velocity.X * 0.5f; + num428 += NPC.velocity.Y * 0.5f; + num427 += NPC.velocity.X * 0.5f; vector44.X -= num427; vector44.Y -= num428; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(vector44.X, vector44.Y, num427, num428, type, damage, 0f, Main.myPlayer); } } @@ -687,12 +688,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (calamityGlobalNPC.newAI[1] % divisor == 0f) { - Main.PlaySound(SoundID.Item12, player.position); + SoundEngine.PlaySound(SoundID.Item12, player.position); // Side walls float targetPosY = player.position.Y; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); int halfTotalDiagonalShots = totalDiagonalShots / 2; Vector2 start = default; Vector2 velocity = default; @@ -848,10 +849,10 @@ namespace CalamityMod.NPCs.DevourerofGods } // Movement - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + npc.height) / 16f) + 2; + int num180 = (int)(NPC.position.X / 16f) - 1; + int num181 = (int)((NPC.position.X + NPC.width) / 16f) + 2; + int num182 = (int)(NPC.position.Y / 16f) - 1; + int num183 = (int)((NPC.position.Y + NPC.height) / 16f) + 2; if (num180 < 0) num180 = 0; @@ -862,13 +863,13 @@ namespace CalamityMod.NPCs.DevourerofGods if (num183 > Main.maxTilesY) num183 = Main.maxTilesY; - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; - else if (npc.velocity.X > 0f) - npc.spriteDirection = 1; + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; // Flight - if (npc.ai[3] == 0f) + if (NPC.ai[3] == 0f) { if (Main.netMode != NetmodeID.Server) { @@ -879,13 +880,13 @@ namespace CalamityMod.NPCs.DevourerofGods // Charge in a direction for a second until the timer is back at 0 if (postTeleportTimer > 0) { - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; return; } calamityGlobalNPC.newAI[2] += 1f; - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; // Go to ground phase sooner if (increaseSpeedMore) @@ -900,7 +901,7 @@ namespace CalamityMod.NPCs.DevourerofGods float num188 = speed; float num189 = turnSpeed; - Vector2 vector18 = npc.Center; + Vector2 vector18 = NPC.Center; float num191 = player.Center.X; float num192 = player.Center.Y; int num42 = -1; @@ -933,9 +934,9 @@ namespace CalamityMod.NPCs.DevourerofGods if (player.position.Y > num47) { num192 = num47; - if (Math.Abs(npc.Center.X - player.Center.X) < 500f) + if (Math.Abs(NPC.Center.X - player.Center.X) < 500f) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) num191 = player.Center.X + 600f; else num191 = player.Center.X - 600f; @@ -949,23 +950,23 @@ namespace CalamityMod.NPCs.DevourerofGods num189 = homingTurnSpeed; } - num188 += Vector2.Distance(player.Center, npc.Center) * 0.005f; - num189 += Vector2.Distance(player.Center, npc.Center) * 0.00025f; + num188 += Vector2.Distance(player.Center, NPC.Center) * 0.005f; + num189 += Vector2.Distance(player.Center, NPC.Center) * 0.00025f; float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); + float num50 = NPC.velocity.Length(); if (num50 > 0f) { if (num50 > num48) { - npc.velocity.Normalize(); - npc.velocity *= num48; + NPC.velocity.Normalize(); + NPC.velocity *= num48; } else if (num50 < num49) { - npc.velocity.Normalize(); - npc.velocity *= num49; + NPC.velocity.Normalize(); + NPC.velocity *= num49; } } @@ -982,82 +983,82 @@ namespace CalamityMod.NPCs.DevourerofGods num191 *= num198; num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) { - if (npc.velocity.X < num191) - npc.velocity.X += num189; + if (NPC.velocity.X < num191) + NPC.velocity.X += num189; else { - if (npc.velocity.X > num191) - npc.velocity.X -= num189; + if (NPC.velocity.X > num191) + NPC.velocity.X -= num189; } - if (npc.velocity.Y < num192) - npc.velocity.Y += num189; + if (NPC.velocity.Y < num192) + NPC.velocity.Y += num189; else { - if (npc.velocity.Y > num192) - npc.velocity.Y -= num189; + if (NPC.velocity.Y > num192) + NPC.velocity.Y -= num189; } - if (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(num192) < num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num189 * 2f; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += num189 * 2f; else - npc.velocity.Y -= num189 * 2f; + NPC.velocity.Y -= num189 * 2f; } - if (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(num191) < num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) { - if (npc.velocity.X > 0f) - npc.velocity.X += num189 * 2f; + if (NPC.velocity.X > 0f) + NPC.velocity.X += num189 * 2f; else - npc.velocity.X -= num189 * 2f; + NPC.velocity.X -= num189 * 2f; } } else { if (num196 > num197) { - if (npc.velocity.X < num191) - npc.velocity.X += num189 * 1.1f; - else if (npc.velocity.X > num191) - npc.velocity.X -= num189 * 1.1f; + if (NPC.velocity.X < num191) + NPC.velocity.X += num189 * 1.1f; + else if (NPC.velocity.X > num191) + NPC.velocity.X -= num189 * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num189; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += num189; else - npc.velocity.Y -= num189; + NPC.velocity.Y -= num189; } } else { - if (npc.velocity.Y < num192) - npc.velocity.Y += num189 * 1.1f; - else if (npc.velocity.Y > num192) - npc.velocity.Y -= num189 * 1.1f; + if (NPC.velocity.Y < num192) + NPC.velocity.Y += num189 * 1.1f; + else if (NPC.velocity.Y > num192) + NPC.velocity.Y -= num189 * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) { - if (npc.velocity.X > 0f) - npc.velocity.X += num189; + if (NPC.velocity.X > 0f) + NPC.velocity.X += num189; else - npc.velocity.X -= num189; + NPC.velocity.X -= num189; } } } - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; if (calamityGlobalNPC.newAI[2] > phaseLimit) { - npc.ai[3] = 1f; + NPC.ai[3] = 1f; calamityGlobalNPC.newAI[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.TargetClosest(); + NPC.netUpdate = true; } } @@ -1073,7 +1074,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Charge in a direction for a second until the timer is back at 0 if (postTeleportTimer > 0) { - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; return; } @@ -1098,12 +1099,12 @@ namespace CalamityMod.NPCs.DevourerofGods { for (int num953 = num182; num953 < num183; num953++) { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[Main.tile[num952, num953].type] || (Main.tileSolidTop[Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[Main.tile[num952, num953].TileType] || (Main.tileSolidTop[Main.tile[num952, num953].TileType] && Main.tile[num952, num953].TileFrameY == 0))) || Main.tile[num952, num953].liquid > 64)) { Vector2 vector105; vector105.X = num952 * 16; vector105.Y = num953 * 16; - if (npc.position.X + npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + if (NPC.position.X + NPC.width > vector105.X && NPC.position.X < vector105.X + 16f && NPC.position.Y + NPC.height > vector105.Y && NPC.position.Y < vector105.Y + 16f) { flies = true; break; @@ -1115,9 +1116,9 @@ namespace CalamityMod.NPCs.DevourerofGods if (!flies) { - npc.localAI[1] = 1f; + NPC.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + Rectangle rectangle12 = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); int num954 = death ? 1125 : 1200; @@ -1128,7 +1129,7 @@ namespace CalamityMod.NPCs.DevourerofGods num954 = 1050; bool flag95 = true; - if (npc.position.Y > player.position.Y) + if (NPC.position.Y > player.position.Y) { for (int num955 = 0; num955 < Main.maxPlayers; num955++) { @@ -1147,10 +1148,10 @@ namespace CalamityMod.NPCs.DevourerofGods } } else - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; float num189 = groundPhaseTurnSpeed; - Vector2 vector18 = npc.Center; + Vector2 vector18 = NPC.Center; float num191 = player.Center.X; float num192 = player.Center.Y; num191 = (int)(num191 / 16f) * 16; @@ -1162,30 +1163,30 @@ namespace CalamityMod.NPCs.DevourerofGods if (!flies) { - npc.velocity.Y += groundPhaseTurnSpeed; - if (npc.velocity.Y > fallSpeed) - npc.velocity.Y = fallSpeed; + NPC.velocity.Y += groundPhaseTurnSpeed; + if (NPC.velocity.Y > fallSpeed) + NPC.velocity.Y = fallSpeed; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 2.2) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 2.2) { - if (npc.velocity.X < 0f) - npc.velocity.X -= num189 * 1.1f; + if (NPC.velocity.X < 0f) + NPC.velocity.X -= num189 * 1.1f; else - npc.velocity.X += num189 * 1.1f; + NPC.velocity.X += num189 * 1.1f; } - else if (npc.velocity.Y == fallSpeed) + else if (NPC.velocity.Y == fallSpeed) { - if (npc.velocity.X < num191) - npc.velocity.X += num189; - else if (npc.velocity.X > num191) - npc.velocity.X -= num189; + if (NPC.velocity.X < num191) + NPC.velocity.X += num189; + else if (NPC.velocity.X > num191) + NPC.velocity.X -= num189; } - else if (npc.velocity.Y > 4f) + else if (NPC.velocity.Y > 4f) { - if (npc.velocity.X < 0f) - npc.velocity.X += num189 * 0.9f; + if (NPC.velocity.X < 0f) + NPC.velocity.X += num189 * 0.9f; else - npc.velocity.X -= num189 * 0.9f; + NPC.velocity.X -= num189 * 0.9f; } } else @@ -1206,105 +1207,105 @@ namespace CalamityMod.NPCs.DevourerofGods num191 *= num27; num192 *= num27; - if (((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f)) && ((npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))) + if (((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f)) && ((NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f))) { - if (npc.velocity.X < num191) - npc.velocity.X += groundPhaseTurnSpeed * 1.5f; - else if (npc.velocity.X > num191) - npc.velocity.X -= groundPhaseTurnSpeed * 1.5f; + if (NPC.velocity.X < num191) + NPC.velocity.X += groundPhaseTurnSpeed * 1.5f; + else if (NPC.velocity.X > num191) + NPC.velocity.X -= groundPhaseTurnSpeed * 1.5f; - if (npc.velocity.Y < num192) - npc.velocity.Y += groundPhaseTurnSpeed * 1.5f; - else if (npc.velocity.Y > num192) - npc.velocity.Y -= groundPhaseTurnSpeed * 1.5f; + if (NPC.velocity.Y < num192) + NPC.velocity.Y += groundPhaseTurnSpeed * 1.5f; + else if (NPC.velocity.Y > num192) + NPC.velocity.Y -= groundPhaseTurnSpeed * 1.5f; } - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) { - if (npc.velocity.X < num191) - npc.velocity.X += groundPhaseTurnSpeed; - else if (npc.velocity.X > num191) - npc.velocity.X -= groundPhaseTurnSpeed; + if (NPC.velocity.X < num191) + NPC.velocity.X += groundPhaseTurnSpeed; + else if (NPC.velocity.X > num191) + NPC.velocity.X -= groundPhaseTurnSpeed; - if (npc.velocity.Y < num192) - npc.velocity.Y += groundPhaseTurnSpeed; - else if (npc.velocity.Y > num192) - npc.velocity.Y -= groundPhaseTurnSpeed; + if (NPC.velocity.Y < num192) + NPC.velocity.Y += groundPhaseTurnSpeed; + else if (NPC.velocity.Y > num192) + NPC.velocity.Y -= groundPhaseTurnSpeed; - if (Math.Abs(num192) < fallSpeed * maximumSpeed1 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(num192) < fallSpeed * maximumSpeed1 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) { - if (npc.velocity.Y > 0f) - npc.velocity.Y += groundPhaseTurnSpeed * 2f; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += groundPhaseTurnSpeed * 2f; else - npc.velocity.Y -= groundPhaseTurnSpeed * 2f; + NPC.velocity.Y -= groundPhaseTurnSpeed * 2f; } - if (Math.Abs(num191) < fallSpeed * maximumSpeed1 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(num191) < fallSpeed * maximumSpeed1 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) { - if (npc.velocity.X > 0f) - npc.velocity.X += groundPhaseTurnSpeed * 2f; + if (NPC.velocity.X > 0f) + NPC.velocity.X += groundPhaseTurnSpeed * 2f; else - npc.velocity.X -= groundPhaseTurnSpeed * 2f; + NPC.velocity.X -= groundPhaseTurnSpeed * 2f; } } else if (num25 > num26) { - if (npc.velocity.X < num191) - npc.velocity.X += groundPhaseTurnSpeed * 1.1f; - else if (npc.velocity.X > num191) - npc.velocity.X -= groundPhaseTurnSpeed * 1.1f; + if (NPC.velocity.X < num191) + NPC.velocity.X += groundPhaseTurnSpeed * 1.1f; + else if (NPC.velocity.X > num191) + NPC.velocity.X -= groundPhaseTurnSpeed * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * maximumSpeed2) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2) { - if (npc.velocity.Y > 0f) - npc.velocity.Y += groundPhaseTurnSpeed; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += groundPhaseTurnSpeed; else - npc.velocity.Y -= groundPhaseTurnSpeed; + NPC.velocity.Y -= groundPhaseTurnSpeed; } } else { - if (npc.velocity.Y < num192) - npc.velocity.Y += groundPhaseTurnSpeed * 1.1f; - else if (npc.velocity.Y > num192) - npc.velocity.Y -= groundPhaseTurnSpeed * 1.1f; + if (NPC.velocity.Y < num192) + NPC.velocity.Y += groundPhaseTurnSpeed * 1.1f; + else if (NPC.velocity.Y > num192) + NPC.velocity.Y -= groundPhaseTurnSpeed * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * maximumSpeed2) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2) { - if (npc.velocity.X > 0f) - npc.velocity.X += groundPhaseTurnSpeed; + if (NPC.velocity.X > 0f) + NPC.velocity.X += groundPhaseTurnSpeed; else - npc.velocity.X -= groundPhaseTurnSpeed; + NPC.velocity.X -= groundPhaseTurnSpeed; } } } - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; if (flies) { - if (npc.localAI[0] != 1f) - npc.netUpdate = true; + if (NPC.localAI[0] != 1f) + NPC.netUpdate = true; - npc.localAI[0] = 1f; + NPC.localAI[0] = 1f; } else { - if (npc.localAI[0] != 0f) - npc.netUpdate = true; + if (NPC.localAI[0] != 0f) + NPC.netUpdate = true; - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.netUpdate = true; + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) + NPC.netUpdate = true; if (calamityGlobalNPC.newAI[2] > phaseLimit) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.TargetClosest(); + NPC.netUpdate = true; } } } @@ -1323,7 +1324,7 @@ namespace CalamityMod.NPCs.DevourerofGods Color messageColor = Color.Cyan; CalamityUtils.DisplayLocalizedText(key, messageColor); - npc.TargetClosest(); + NPC.TargetClosest(); spawnedGuardians = true; } @@ -1332,10 +1333,10 @@ namespace CalamityMod.NPCs.DevourerofGods spawnDoGCountdown--; if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); for (int i = 0; i < 2; i++) - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); } } } @@ -1354,37 +1355,37 @@ namespace CalamityMod.NPCs.DevourerofGods spawnDoGCountdown--; if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); } } } // Alpha - npc.Opacity += 0.047f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.047f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; // Spawn segments if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!tail && npc.ai[0] == 0f) + if (!tail && NPC.ai[0] == 0f) { - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) { int segment; if (segmentSpawn >= 0 && segmentSpawn < minLength) { - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + segment = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); Main.npc[segment].ModNPC().SegmentIndex = maxLength - segmentSpawn; } else - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + segment = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); - Main.npc[segment].realLife = npc.whoAmI; - Main.npc[segment].ai[2] = npc.whoAmI; + Main.npc[segment].realLife = NPC.whoAmI; + Main.npc[segment].ai[2] = NPC.whoAmI; Main.npc[segment].ai[1] = Previous; Main.npc[Previous].ai[0] = segment; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment, 0f, 0f, 0f, 0); @@ -1400,11 +1401,11 @@ namespace CalamityMod.NPCs.DevourerofGods if (calamityGlobalNPC.newAI[1] % divisor == 0f) { - Main.PlaySound(SoundID.Item12, player.position); + SoundEngine.PlaySound(SoundID.Item12, player.position); // Side walls int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Vector2 start = default; Vector2 velocity = default; Vector2 aim = expertMode ? player.Center + player.velocity * 20f : Vector2.Zero; @@ -1530,10 +1531,10 @@ namespace CalamityMod.NPCs.DevourerofGods } // Movement - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + npc.height) / 16f) + 2; + int num180 = (int)(NPC.position.X / 16f) - 1; + int num181 = (int)((NPC.position.X + NPC.width) / 16f) + 2; + int num182 = (int)(NPC.position.Y / 16f) - 1; + int num183 = (int)((NPC.position.Y + NPC.height) / 16f) + 2; if (num180 < 0) num180 = 0; @@ -1544,13 +1545,13 @@ namespace CalamityMod.NPCs.DevourerofGods if (num183 > Main.maxTilesY) num183 = Main.maxTilesY; - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; - else if (npc.velocity.X > 0f) - npc.spriteDirection = 1; + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; // Flight - if (npc.ai[3] == 0f) + if (NPC.ai[3] == 0f) { if (Main.netMode != NetmodeID.Server) { @@ -1559,7 +1560,7 @@ namespace CalamityMod.NPCs.DevourerofGods } // Flying movement - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; calamityGlobalNPC.newAI[2] += 1f; @@ -1571,7 +1572,7 @@ namespace CalamityMod.NPCs.DevourerofGods float num188 = speed; float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num191 = player.position.X + (player.width / 2); float num192 = player.position.Y + (player.height / 2); int num42 = -1; @@ -1599,9 +1600,9 @@ namespace CalamityMod.NPCs.DevourerofGods if (player.position.Y > num47) { num192 = num47; - if (Math.Abs(npc.Center.X - player.Center.X) < 500f) + if (Math.Abs(NPC.Center.X - player.Center.X) < 500f) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) num191 = player.Center.X + 600f; else num191 = player.Center.X - 600f; @@ -1622,18 +1623,18 @@ namespace CalamityMod.NPCs.DevourerofGods float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); + float num50 = NPC.velocity.Length(); if (num50 > 0f) { if (num50 > num48) { - npc.velocity.Normalize(); - npc.velocity *= num48; + NPC.velocity.Normalize(); + NPC.velocity *= num48; } else if (num50 < num49) { - npc.velocity.Normalize(); - npc.velocity *= num49; + NPC.velocity.Normalize(); + NPC.velocity *= num49; } } @@ -1650,82 +1651,82 @@ namespace CalamityMod.NPCs.DevourerofGods num191 *= num198; num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) { - if (npc.velocity.X < num191) - npc.velocity.X += num189; + if (NPC.velocity.X < num191) + NPC.velocity.X += num189; else { - if (npc.velocity.X > num191) - npc.velocity.X -= num189; + if (NPC.velocity.X > num191) + NPC.velocity.X -= num189; } - if (npc.velocity.Y < num192) - npc.velocity.Y += num189; + if (NPC.velocity.Y < num192) + NPC.velocity.Y += num189; else { - if (npc.velocity.Y > num192) - npc.velocity.Y -= num189; + if (NPC.velocity.Y > num192) + NPC.velocity.Y -= num189; } - if (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(num192) < num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num189 * 2f; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += num189 * 2f; else - npc.velocity.Y -= num189 * 2f; + NPC.velocity.Y -= num189 * 2f; } - if (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(num191) < num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) { - if (npc.velocity.X > 0f) - npc.velocity.X += num189 * 2f; + if (NPC.velocity.X > 0f) + NPC.velocity.X += num189 * 2f; else - npc.velocity.X -= num189 * 2f; + NPC.velocity.X -= num189 * 2f; } } else { if (num196 > num197) { - if (npc.velocity.X < num191) - npc.velocity.X += num189 * 1.1f; - else if (npc.velocity.X > num191) - npc.velocity.X -= num189 * 1.1f; + if (NPC.velocity.X < num191) + NPC.velocity.X += num189 * 1.1f; + else if (NPC.velocity.X > num191) + NPC.velocity.X -= num189 * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num189; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += num189; else - npc.velocity.Y -= num189; + NPC.velocity.Y -= num189; } } else { - if (npc.velocity.Y < num192) - npc.velocity.Y += num189 * 1.1f; - else if (npc.velocity.Y > num192) - npc.velocity.Y -= num189 * 1.1f; + if (NPC.velocity.Y < num192) + NPC.velocity.Y += num189 * 1.1f; + else if (NPC.velocity.Y > num192) + NPC.velocity.Y -= num189 * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) { - if (npc.velocity.X > 0f) - npc.velocity.X += num189; + if (NPC.velocity.X > 0f) + NPC.velocity.X += num189; else - npc.velocity.X -= num189; + NPC.velocity.X -= num189; } } } - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; if (calamityGlobalNPC.newAI[2] > phaseLimit) { - npc.ai[3] = 1f; + NPC.ai[3] = 1f; calamityGlobalNPC.newAI[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.TargetClosest(); + NPC.netUpdate = true; } } @@ -1752,12 +1753,12 @@ namespace CalamityMod.NPCs.DevourerofGods { for (int num953 = num182; num953 < num183; num953++) { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[Main.tile[num952, num953].type] || (Main.tileSolidTop[Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[Main.tile[num952, num953].TileType] || (Main.tileSolidTop[Main.tile[num952, num953].TileType] && Main.tile[num952, num953].TileFrameY == 0))) || Main.tile[num952, num953].liquid > 64)) { Vector2 vector105; vector105.X = num952 * 16; vector105.Y = num953 * 16; - if (npc.position.X + npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + if (NPC.position.X + NPC.width > vector105.X && NPC.position.X < vector105.X + 16f && NPC.position.Y + NPC.height > vector105.Y && NPC.position.Y < vector105.Y + 16f) { flies = true; break; @@ -1769,9 +1770,9 @@ namespace CalamityMod.NPCs.DevourerofGods if (!flies) { - npc.localAI[1] = 1f; + NPC.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + Rectangle rectangle12 = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); int num954 = death ? 1125 : 1200; @@ -1782,7 +1783,7 @@ namespace CalamityMod.NPCs.DevourerofGods num954 = 1050; bool flag95 = true; - if (npc.position.Y > player.position.Y) + if (NPC.position.Y > player.position.Y) { for (int num955 = 0; num955 < 255; num955++) { @@ -1801,10 +1802,10 @@ namespace CalamityMod.NPCs.DevourerofGods } } else - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; float num189 = groundPhaseTurnSpeed; - Vector2 vector18 = npc.Center; + Vector2 vector18 = NPC.Center; float num191 = player.Center.X; float num192 = player.Center.Y; num191 = (int)(num191 / 16f) * 16; @@ -1816,30 +1817,30 @@ namespace CalamityMod.NPCs.DevourerofGods if (!flies) { - npc.velocity.Y += groundPhaseTurnSpeed; - if (npc.velocity.Y > fallSpeed) - npc.velocity.Y = fallSpeed; + NPC.velocity.Y += groundPhaseTurnSpeed; + if (NPC.velocity.Y > fallSpeed) + NPC.velocity.Y = fallSpeed; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 2.2) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 2.2) { - if (npc.velocity.X < 0f) - npc.velocity.X -= num189 * 1.1f; + if (NPC.velocity.X < 0f) + NPC.velocity.X -= num189 * 1.1f; else - npc.velocity.X += num189 * 1.1f; + NPC.velocity.X += num189 * 1.1f; } - else if (npc.velocity.Y == fallSpeed) + else if (NPC.velocity.Y == fallSpeed) { - if (npc.velocity.X < num191) - npc.velocity.X += num189; - else if (npc.velocity.X > num191) - npc.velocity.X -= num189; + if (NPC.velocity.X < num191) + NPC.velocity.X += num189; + else if (NPC.velocity.X > num191) + NPC.velocity.X -= num189; } - else if (npc.velocity.Y > 4f) + else if (NPC.velocity.Y > 4f) { - if (npc.velocity.X < 0f) - npc.velocity.X += num189 * 0.9f; + if (NPC.velocity.X < 0f) + NPC.velocity.X += num189 * 0.9f; else - npc.velocity.X -= num189 * 0.9f; + NPC.velocity.X -= num189 * 0.9f; } } else @@ -1860,111 +1861,111 @@ namespace CalamityMod.NPCs.DevourerofGods num191 *= num27; num192 *= num27; - if (((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f)) && ((npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))) + if (((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f)) && ((NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f))) { - if (npc.velocity.X < num191) - npc.velocity.X += groundPhaseTurnSpeed * 1.5f; - else if (npc.velocity.X > num191) - npc.velocity.X -= groundPhaseTurnSpeed * 1.5f; + if (NPC.velocity.X < num191) + NPC.velocity.X += groundPhaseTurnSpeed * 1.5f; + else if (NPC.velocity.X > num191) + NPC.velocity.X -= groundPhaseTurnSpeed * 1.5f; - if (npc.velocity.Y < num192) - npc.velocity.Y += groundPhaseTurnSpeed * 1.5f; - else if (npc.velocity.Y > num192) - npc.velocity.Y -= groundPhaseTurnSpeed * 1.5f; + if (NPC.velocity.Y < num192) + NPC.velocity.Y += groundPhaseTurnSpeed * 1.5f; + else if (NPC.velocity.Y > num192) + NPC.velocity.Y -= groundPhaseTurnSpeed * 1.5f; } - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) { - if (npc.velocity.X < num191) - npc.velocity.X += groundPhaseTurnSpeed; - else if (npc.velocity.X > num191) - npc.velocity.X -= groundPhaseTurnSpeed; + if (NPC.velocity.X < num191) + NPC.velocity.X += groundPhaseTurnSpeed; + else if (NPC.velocity.X > num191) + NPC.velocity.X -= groundPhaseTurnSpeed; - if (npc.velocity.Y < num192) - npc.velocity.Y += groundPhaseTurnSpeed; - else if (npc.velocity.Y > num192) - npc.velocity.Y -= groundPhaseTurnSpeed; + if (NPC.velocity.Y < num192) + NPC.velocity.Y += groundPhaseTurnSpeed; + else if (NPC.velocity.Y > num192) + NPC.velocity.Y -= groundPhaseTurnSpeed; - if (Math.Abs(num192) < fallSpeed * maximumSpeed1 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(num192) < fallSpeed * maximumSpeed1 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) { - if (npc.velocity.Y > 0f) - npc.velocity.Y += groundPhaseTurnSpeed * 2f; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += groundPhaseTurnSpeed * 2f; else - npc.velocity.Y -= groundPhaseTurnSpeed * 2f; + NPC.velocity.Y -= groundPhaseTurnSpeed * 2f; } - if (Math.Abs(num191) < fallSpeed * maximumSpeed1 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(num191) < fallSpeed * maximumSpeed1 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) { - if (npc.velocity.X > 0f) - npc.velocity.X += groundPhaseTurnSpeed * 2f; + if (NPC.velocity.X > 0f) + NPC.velocity.X += groundPhaseTurnSpeed * 2f; else - npc.velocity.X -= groundPhaseTurnSpeed * 2f; + NPC.velocity.X -= groundPhaseTurnSpeed * 2f; } } else if (num25 > num26) { - if (npc.velocity.X < num191) - npc.velocity.X += groundPhaseTurnSpeed * 1.1f; - else if (npc.velocity.X > num191) - npc.velocity.X -= groundPhaseTurnSpeed * 1.1f; + if (NPC.velocity.X < num191) + NPC.velocity.X += groundPhaseTurnSpeed * 1.1f; + else if (NPC.velocity.X > num191) + NPC.velocity.X -= groundPhaseTurnSpeed * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * maximumSpeed2) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2) { - if (npc.velocity.Y > 0f) - npc.velocity.Y += groundPhaseTurnSpeed; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += groundPhaseTurnSpeed; else - npc.velocity.Y -= groundPhaseTurnSpeed; + NPC.velocity.Y -= groundPhaseTurnSpeed; } } else { - if (npc.velocity.Y < num192) - npc.velocity.Y += groundPhaseTurnSpeed * 1.1f; - else if (npc.velocity.Y > num192) - npc.velocity.Y -= groundPhaseTurnSpeed * 1.1f; + if (NPC.velocity.Y < num192) + NPC.velocity.Y += groundPhaseTurnSpeed * 1.1f; + else if (NPC.velocity.Y > num192) + NPC.velocity.Y -= groundPhaseTurnSpeed * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * maximumSpeed2) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2) { - if (npc.velocity.X > 0f) - npc.velocity.X += groundPhaseTurnSpeed; + if (NPC.velocity.X > 0f) + NPC.velocity.X += groundPhaseTurnSpeed; else - npc.velocity.X -= groundPhaseTurnSpeed; + NPC.velocity.X -= groundPhaseTurnSpeed; } } } - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; if (flies) { - if (npc.localAI[0] != 1f) - npc.netUpdate = true; + if (NPC.localAI[0] != 1f) + NPC.netUpdate = true; - npc.localAI[0] = 1f; + NPC.localAI[0] = 1f; } else { - if (npc.localAI[0] != 0f) - npc.netUpdate = true; + if (NPC.localAI[0] != 0f) + NPC.netUpdate = true; - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.netUpdate = true; + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) + NPC.netUpdate = true; if (calamityGlobalNPC.newAI[2] > phaseLimit) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.TargetClosest(); + NPC.netUpdate = true; } } } - if (npc.life > Main.npc[(int)npc.ai[0]].life) - npc.life = Main.npc[(int)npc.ai[0]].life; + if (NPC.life > Main.npc[(int)NPC.ai[0]].life) + NPC.life = Main.npc[(int)NPC.ai[0]].life; } private void SpawnTeleportLocation(Player player) @@ -1978,8 +1979,8 @@ namespace CalamityMod.NPCs.DevourerofGods int randomRange = 48; float distance = 640f; Vector2 targetVector = player.Center + player.velocity.SafeNormalize(Vector2.UnitX) * distance + new Vector2(Main.rand.Next(-randomRange, randomRange + 1), Main.rand.Next(-randomRange, randomRange + 1)); - Main.PlaySound(SoundID.Item109, player.Center); - Projectile.NewProjectile(targetVector, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, npc.whoAmI); + SoundEngine.PlaySound(SoundID.Item109, player.Center); + Projectile.NewProjectile(targetVector, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, NPC.whoAmI); } } @@ -1990,7 +1991,7 @@ namespace CalamityMod.NPCs.DevourerofGods int randomRange = 48; float distance = 1080f; Vector2 targetVector = player.Center + player.velocity.SafeNormalize(Vector2.UnitX) * distance + new Vector2(Main.rand.Next(-randomRange, randomRange + 1), Main.rand.Next(-randomRange, randomRange + 1)); - Projectile.NewProjectile(targetVector, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, npc.whoAmI); + Projectile.NewProjectile(targetVector, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, NPC.whoAmI); } Vector2 newPosition = GetRiftLocation(true); @@ -2003,7 +2004,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float finalVelocity = 10f; int totalSpreads = revenge ? 6 : 3; float mult = revenge ? 1.5f : 3f; @@ -2027,15 +2028,15 @@ namespace CalamityMod.NPCs.DevourerofGods } } - npc.TargetClosest(); - npc.position = newPosition; + NPC.TargetClosest(); + NPC.position = newPosition; float chargeVelocity = malice ? 30f : death ? 26f : revenge ? 24f : expertMode ? 22f : 20f; float maxChargeDistance = 1600f; postTeleportTimer = (int)Math.Round(maxChargeDistance / chargeVelocity); AwaitingPhase2Teleport = false; - npc.Opacity = 1f - (postTeleportTimer / 255f); - npc.velocity = Vector2.Normalize(player.Center + player.velocity * 40f - npc.Center) * chargeVelocity; - npc.netUpdate = true; + NPC.Opacity = 1f - (postTeleportTimer / 255f); + NPC.velocity = Vector2.Normalize(player.Center + player.velocity * 40f - NPC.Center) * chargeVelocity; + NPC.netUpdate = true; for (int i = 0; i < Main.maxNPCs; i++) { @@ -2050,7 +2051,7 @@ namespace CalamityMod.NPCs.DevourerofGods } } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), player.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), player.Center); } public void DoDeathAnimation() @@ -2058,20 +2059,20 @@ namespace CalamityMod.NPCs.DevourerofGods // Play a sound at the start. if (DeathAnimationTimer == 1f) { - var soundInstance = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), npc.Center); + var soundInstance = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), NPC.Center); CalamityUtils.SafeVolumeChange(ref soundInstance, 1.6f); } // Close the health bar, fade in, and stop doing contact damage. - npc.Calamity().CanHaveBossHealthBar = false; - npc.Opacity = MathHelper.Clamp(npc.Opacity + 0.1f, 0f, 1f); - npc.dontTakeDamage = true; - npc.damage = 0; + NPC.Calamity().CanHaveBossHealthBar = false; + NPC.Opacity = MathHelper.Clamp(NPC.Opacity + 0.1f, 0f, 1f); + NPC.dontTakeDamage = true; + NPC.damage = 0; void destroySegment(int index, ref int destroyedSegments) { if (Main.rand.NextBool(5)) - Main.PlaySound(SoundID.Item94, npc.Center); + SoundEngine.PlaySound(SoundID.Item94, NPC.Center); List segments = new List() { @@ -2103,14 +2104,14 @@ namespace CalamityMod.NPCs.DevourerofGods // Slow down but maintain a specific direction. float idealSpeed = MathHelper.Lerp(8.4f, 4f, Utils.InverseLerp(15f, 210f, DeathAnimationTimer, true)); - if (npc.velocity.Length() != idealSpeed) - npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY) * MathHelper.Lerp(npc.velocity.Length(), idealSpeed, 0.08f); + if (NPC.velocity.Length() != idealSpeed) + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY) * MathHelper.Lerp(NPC.velocity.Length(), idealSpeed, 0.08f); // Stay within the world. - if (npc.Center.X < 300f || npc.Center.X > Main.maxTilesX * 16f - 300f) - npc.velocity.X *= -1f; - if (npc.Center.Y < 300f || npc.Center.Y > Main.maxTilesY * 16f - 300f) - npc.velocity.Y *= -1f; + if (NPC.Center.X < 300f || NPC.Center.X > Main.maxTilesX * 16f - 300f) + NPC.velocity.X *= -1f; + if (NPC.Center.Y < 300f || NPC.Center.Y > Main.maxTilesY * 16f - 300f) + NPC.velocity.Y *= -1f; if (DeathAnimationTimer >= 120f && DeathAnimationTimer < 370f && DeathAnimationTimer % 3f == 0f) { @@ -2121,16 +2122,16 @@ namespace CalamityMod.NPCs.DevourerofGods if (DeathAnimationTimer == 452f) { if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); if (Main.netMode != NetmodeID.Server) { - var soundInstance = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), npc.Center); + var soundInstance = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), NPC.Center); CalamityUtils.SafeVolumeChange(ref soundInstance, 1.6f); for (int i = 0; i < 3; i++) { - soundInstance = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), npc.Center); + soundInstance = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), NPC.Center); if (soundInstance != null) { soundInstance.Pitch = -MathHelper.Lerp(0.1f, 0.4f, i / 3f); @@ -2151,11 +2152,11 @@ namespace CalamityMod.NPCs.DevourerofGods if (DeathAnimationTimer >= 485f) { - npc.life = 0; - npc.HitEffect(); - npc.NPCLoot(); - npc.active = false; - npc.netUpdate = true; + NPC.life = 0; + NPC.HitEffect(); + NPC.NPCLoot(); + NPC.active = false; + NPC.netUpdate = true; } DeathAnimationTimer++; } @@ -2183,35 +2184,35 @@ namespace CalamityMod.NPCs.DevourerofGods { spriteBatch.EnterShaderRegion(); GameShaders.Misc["CalamityMod:DoGDisintegration"].UseOpacity(disintegrationFactor); - GameShaders.Misc["CalamityMod:DoGDisintegration"].UseSaturation(npc.whoAmI); + GameShaders.Misc["CalamityMod:DoGDisintegration"].UseSaturation(NPC.whoAmI); GameShaders.Misc["CalamityMod:DoGDisintegration"].UseImage("Images/Misc/Perlin"); GameShaders.Misc["CalamityMod:DoGDisintegration"].Apply(); } SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = Phase2Started && CalamityWorld.DoGSecondStageCountdown <= 60; - Texture2D texture2D15 = useOtherTextures ? ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadS") : Main.npcTexture[npc.type]; + Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadS") : Main.npcTexture[NPC.type]; Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - if (!npc.dontTakeDamage) + if (!NPC.dontTakeDamage) { - texture2D15 = useOtherTextures ? ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadSGlow") : ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadGlow"); + texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadSGlow") : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadGlow"); Color color37 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = useOtherTextures ? ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadSGlow2") : ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadGlow2"); + texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadSGlow2") : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadGlow2"); color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } if (disintegrationFactor > 0f) @@ -2227,11 +2228,11 @@ namespace CalamityMod.NPCs.DevourerofGods public override bool SpecialNPCLoot() { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + int closestSegmentID = DropHelper.FindClosestWormSegment(NPC, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()); - npc.position = Main.npc[closestSegmentID].position; + NPC.position = Main.npc[closestSegmentID].position; return false; } @@ -2240,30 +2241,30 @@ namespace CalamityMod.NPCs.DevourerofGods // Stop the countdown -- if you kill DoG in less than 60 frames, this will stop another one from spawning. CalamityWorld.DoGSecondStageCountdown = 0; - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItem(npc, ModContent.ItemType(), 5, 15); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedDoG); + DropHelper.DropItem(NPC, ModContent.ItemType(), 5, 15); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedDoG); CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedDoG); // Mount - CalamityPlayer mp = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Calamity(); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, mp.fabsolVodka); + CalamityPlayer mp = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Calamity(); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, mp.fabsolVodka); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { // Materials - DropHelper.DropItem(npc, ModContent.ItemType(), 25, 35); - DropHelper.DropItem(npc, ModContent.ItemType(), 150, 250); + DropHelper.DropItem(NPC, ModContent.ItemType(), 25, 35); + DropHelper.DropItem(NPC, ModContent.ItemType(), 150, 250); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -2273,14 +2274,14 @@ namespace CalamityMod.NPCs.DevourerofGods ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // If DoG has not been killed yet, notify players that the holiday moons are buffed if (!CalamityWorld.downedDoG) @@ -2308,10 +2309,10 @@ namespace CalamityMod.NPCs.DevourerofGods Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -2321,12 +2322,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (dist4 < minDist) minDist = dist4; - return minDist <= (Phase2Started ? 80f : 55f) && (npc.Opacity >= 1f || postTeleportTimer > 0) && preventBullshitHitsAtStartofFinalPhaseTimer <= 0; + return minDist <= (Phase2Started ? 80f : 55f) && (NPC.Opacity >= 1f || postTeleportTimer > 0) && preventBullshitHitsAtStartofFinalPhaseTimer <= 0; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (!Dying && (damage * (crit ? 2D : 1D)) >= npc.life) + if (!Dying && (damage * (crit ? 2D : 1D)) >= NPC.life) { damage = 0D; CheckDead(); @@ -2352,35 +2353,35 @@ namespace CalamityMod.NPCs.DevourerofGods if (!Dying) { Dying = true; - npc.life = 1; - npc.dontTakeDamage = true; - npc.active = true; - npc.netUpdate = true; + NPC.life = 1; + NPC.dontTakeDamage = true; + NPC.active = true; + NPC.netUpdate = true; } return false; } public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 8; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), npc.Center); + NPC.soundDelay = 8; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), NPC.Center); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS5"), 1f); - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/DoGS"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/DoGS2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/DoGS5"), 1f); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 50; + NPC.height = 50; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -2390,10 +2391,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -2401,7 +2402,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -2420,7 +2421,7 @@ namespace CalamityMod.NPCs.DevourerofGods "Mods.CalamityMod.EdgyBossText7" }); Color messageColor = Color.Cyan; - Rectangle location = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + Rectangle location = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); CombatText.NewText(location, messageColor, Language.GetTextValue(text), true); player.Calamity().dogTextCooldown = 60; } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead2.cs b/NPCs/DevourerofGods/DevourerofGodsHead2.cs index cadac6cd29..e4d058939d 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead2.cs @@ -25,122 +25,122 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.width = 64; - npc.height = 76; - npc.defense = 40; - npc.lifeMax = 50000; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.width = 64; + NPC.height = 76; + NPC.defense = 40; + NPC.lifeMax = 50000; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) { invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); } public override void AI() { // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(true); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; if (invinceTime > 0) { invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; + NPC.damage = 0; + NPC.dontTakeDamage = true; } else { - npc.damage = npc.defDamage; - npc.dontTakeDamage = false; + NPC.damage = NPC.defDamage; + NPC.dontTakeDamage = false; } - Vector2 vector = npc.Center; + Vector2 vector = NPC.Center; bool increaseSpeed = Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles; bool increaseSpeedMore = Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance350Tiles; - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.alpha != 0) + if (NPC.alpha != 0) { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + int num935 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); Main.dust[num935].noGravity = true; Main.dust[num935].noLight = true; } - npc.alpha -= 12; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 12; + if (NPC.alpha < 0) + NPC.alpha = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!tail && npc.ai[0] == 0f) + if (!tail && NPC.ai[0] == 0f) { - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) { int segment; if (segmentSpawn >= 0 && segmentSpawn < minLength) { - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + segment = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } else { - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + segment = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } - Main.npc[segment].realLife = npc.whoAmI; - Main.npc[segment].ai[2] = npc.whoAmI; + Main.npc[segment].realLife = NPC.whoAmI; + Main.npc[segment].ai[2] = NPC.whoAmI; Main.npc[segment].ai[1] = Previous; Main.npc[Previous].ai[0] = segment; - npc.netUpdate = true; + NPC.netUpdate = true; Previous = segment; } tail = true; } - if (!npc.active && Main.netMode == NetmodeID.Server) + if (!NPC.active && Main.netMode == NetmodeID.Server) { - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } } if (player.dead || CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) { - npc.TargetClosest(false); - npc.velocity.Y -= 3f; - if ((double)npc.position.Y < Main.topWorld + 16f) + NPC.TargetClosest(false); + NPC.velocity.Y -= 3f; + if ((double)NPC.position.Y < Main.topWorld + 16f) { - npc.velocity.Y -= 3f; + NPC.velocity.Y -= 3f; } - if ((double)npc.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) { Main.npc[a].active = false; } @@ -148,9 +148,9 @@ namespace CalamityMod.NPCs.DevourerofGods } } - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); float num188 = CalamityWorld.malice ? 18f : CalamityWorld.revenge ? 16f : 14f; float num189 = CalamityWorld.malice ? 0.17f : CalamityWorld.revenge ? 0.15f : 0.13f; @@ -161,9 +161,9 @@ namespace CalamityMod.NPCs.DevourerofGods for (int num52 = 0; num52 < Main.maxNPCs; num52++) { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + if (Main.npc[num52].active && Main.npc[num52].type == NPC.type && num52 != NPC.whoAmI) { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; + Vector2 vector4 = Main.npc[num52].Center - NPC.Center; if (vector4.Length() < 60f) { vector4.Normalize(); @@ -176,18 +176,18 @@ namespace CalamityMod.NPCs.DevourerofGods float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); + float num50 = NPC.velocity.Length(); if (num50 > 0f) { if (num50 > num48) { - npc.velocity.Normalize(); - npc.velocity *= num48; + NPC.velocity.Normalize(); + NPC.velocity *= num48; } else if (num50 < num49) { - npc.velocity.Normalize(); - npc.velocity *= num49; + NPC.velocity.Normalize(); + NPC.velocity *= num49; } } @@ -203,50 +203,50 @@ namespace CalamityMod.NPCs.DevourerofGods float num198 = num188 / num193; num191 *= num198; num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - if (npc.velocity.X > num191) + if (NPC.velocity.X > num191) { - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - if (npc.velocity.Y > num192) + if (NPC.velocity.Y > num192) { - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } - if (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(num192) < num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num189 * 2f; } else { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 2f; } } - if (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(num191) < num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X + num189 * 2f; //changed from 2 } else { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X - num189 * 2f; //changed from 2 } } } @@ -254,75 +254,75 @@ namespace CalamityMod.NPCs.DevourerofGods { if (num196 > num197) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X + num189 * 1.1f; //changed from 1.1 } - else if (npc.velocity.X > num191) + else if (NPC.velocity.X > num191) { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X - num189 * 1.1f; //changed from 1.1 } - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } } else { - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + num189 * 1.1f; } - else if (npc.velocity.Y > num192) + else if (NPC.velocity.Y > num192) { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 1.1f; } - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } } } - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + 1.57f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead2Glow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead2Glow"); Color color37 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead2Glow2"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead2Glow2"); color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -333,7 +333,7 @@ namespace CalamityMod.NPCs.DevourerofGods { int heartAmt = Main.rand.Next(3) + 3; for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } } @@ -356,18 +356,18 @@ namespace CalamityMod.NPCs.DevourerofGods public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoT"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/DoT"), 1f); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 50; + NPC.height = 50; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -377,10 +377,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index dac9fceedb..ef2af00a3f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -10,6 +10,7 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.DevourerofGods { @@ -46,29 +47,29 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 66; - npc.height = 66; - npc.defense = 50; - npc.LifeMaxNERB(888750, 1066500, 1500000); // Phase 1 is 371250, Phase 2 is 517500 + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 66; + NPC.height = 66; + NPC.defense = 50; + NPC.LifeMaxNERB(888750, 1066500, 1500000); // Phase 1 is 371250, Phase 2 is 517500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.Opacity = 0f; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; - npc.takenDamageMultiplier = 1.25f; + NPC.knockBackResist = 0f; + NPC.Opacity = 0f; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.boss = true; + NPC.takenDamageMultiplier = 1.25f; music = CalamityMod.Instance.GetMusicFromMusicMod("DevourerOfGodsP1") ?? MusicID.Boss3; - npc.dontCountMe = true; + NPC.dontCountMe = true; } public override void BossHeadSlot(ref int index) @@ -97,7 +98,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (head != null || modNPC.AwaitingPhase2Teleport || !modNPC.Phase2Started) return; - rotation = npc.rotation; + rotation = NPC.rotation; } public override void SendExtraAI(BinaryWriter writer) @@ -105,12 +106,12 @@ namespace CalamityMod.NPCs.DevourerofGods writer.Write(phase2Started); writer.Write(invinceTime); writer.Write(setOpacity); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.Opacity); - writer.Write(npc.frame.X); - writer.Write(npc.frame.Y); - writer.Write(npc.frame.Width); - writer.Write(npc.frame.Height); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.Opacity); + writer.Write(NPC.frame.X); + writer.Write(NPC.frame.Y); + writer.Write(NPC.frame.Width); + writer.Write(NPC.frame.Height); } public override void ReceiveExtraAI(BinaryReader reader) @@ -118,11 +119,11 @@ namespace CalamityMod.NPCs.DevourerofGods phase2Started = reader.ReadBoolean(); invinceTime = reader.ReadInt32(); setOpacity = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.Opacity = reader.ReadSingle(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.Opacity = reader.ReadSingle(); Rectangle frame = new Rectangle(reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32()); if (frame.Width > 0 && frame.Height > 0) - npc.frame = frame; + NPC.frame = frame; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -132,13 +133,13 @@ namespace CalamityMod.NPCs.DevourerofGods public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; - if (npc.life / (float)npc.lifeMax < 0.6f) + if (NPC.life / (float)NPC.lifeMax < 0.6f) { phase2Started = true; @@ -149,43 +150,43 @@ namespace CalamityMod.NPCs.DevourerofGods // Once before DoG spawns, set new size if (CalamityWorld.DoGSecondStageCountdown == 60) { - npc.position = npc.Center; - npc.width = 80; - npc.height = 140; - npc.frame = new Rectangle(0, 0, 86, 148); - npc.position -= npc.Size * 0.5f; - npc.netUpdate = true; + NPC.position = NPC.Center; + NPC.width = 80; + NPC.height = 140; + NPC.frame = new Rectangle(0, 0, 86, 148); + NPC.position -= NPC.Size * 0.5f; + NPC.netUpdate = true; } } - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); if (invinceTime > 0) { invinceTime--; - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; } else - npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; + NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; - if (Main.npc[(int)npc.ai[2]].dontTakeDamage) + if (Main.npc[(int)NPC.ai[2]].dontTakeDamage) invinceTime = 240; // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; - float distanceFromTarget = Vector2.Distance(player.Center, npc.Center); + float distanceFromTarget = Vector2.Distance(player.Center, NPC.Center); float takeLessDamageDistance = 1600f; if (distanceFromTarget > takeLessDamageDistance) { float damageTakenScalar = MathHelper.Clamp(1f - ((distanceFromTarget - takeLessDamageDistance) / takeLessDamageDistance), 0f, 1f); - npc.takenDamageMultiplier = MathHelper.Lerp(1f, 1.25f, damageTakenScalar); + NPC.takenDamageMultiplier = MathHelper.Lerp(1f, 1.25f, damageTakenScalar); } else - npc.takenDamageMultiplier = 1.25f; + NPC.takenDamageMultiplier = 1.25f; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -199,42 +200,42 @@ namespace CalamityMod.NPCs.DevourerofGods } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].Opacity >= 0.5f && (!setOpacity || (CalamityWorld.DoGSecondStageCountdown <= 60 && CalamityWorld.DoGSecondStageCountdown > 0))) + if (Main.npc[(int)NPC.ai[1]].Opacity >= 0.5f && (!setOpacity || (CalamityWorld.DoGSecondStageCountdown <= 60 && CalamityWorld.DoGSecondStageCountdown > 0))) { - npc.Opacity += 0.165f; - if (npc.Opacity >= 1f && invinceTime <= 0) + NPC.Opacity += 0.165f; + if (NPC.Opacity >= 1f && invinceTime <= 0) { setOpacity = true; - npc.Opacity = 1f; + NPC.Opacity = 1f; } } else { - if (Main.npc[(int)npc.ai[2]].ModNPC()?.AttemptingToEnterPortal ?? false) + if (Main.npc[(int)NPC.ai[2]].ModNPC()?.AttemptingToEnterPortal ?? false) { if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile portal = Main.projectile[Main.npc[(int)npc.ai[2]].ModNPC().PortalIndex]; - float newOpacity = 1f - Utils.InverseLerp(270f, 100f, npc.Distance(portal.Center), true); - if (newOpacity > 0f && npc.Opacity > newOpacity) + Projectile portal = Main.projectile[Main.npc[(int)NPC.ai[2]].ModNPC().PortalIndex]; + float newOpacity = 1f - Utils.InverseLerp(270f, 100f, NPC.Distance(portal.Center), true); + if (newOpacity > 0f && NPC.Opacity > newOpacity) { - npc.Opacity = newOpacity; + NPC.Opacity = newOpacity; // Create dust at the portal position. - if (Vector2.Dot((npc.rotation - MathHelper.PiOver2).ToRotationVector2(), Main.npc[(int)npc.ai[2]].velocity) > 0f) + if (Vector2.Dot((NPC.rotation - MathHelper.PiOver2).ToRotationVector2(), Main.npc[(int)NPC.ai[2]].velocity) > 0f) { for (int i = 0; i < 2; i++) { @@ -245,18 +246,18 @@ namespace CalamityMod.NPCs.DevourerofGods } } - if (npc.Opacity < 0.2f) - npc.Opacity = 0f; + if (NPC.Opacity < 0.2f) + NPC.Opacity = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } } else - npc.Opacity = Main.npc[(int)npc.ai[2]].Opacity; + NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity; } - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num191 = player.position.X + (player.width / 2); float num192 = player.position.Y + (player.height / 2); num191 = (int)(num191 / 16f) * 16; @@ -266,69 +267,69 @@ namespace CalamityMod.NPCs.DevourerofGods num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2(num192, num191) + MathHelper.PiOver2; + NPC.rotation = (float)System.Math.Atan2(num192, num191) + MathHelper.PiOver2; num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - float disintegrationFactor = Main.npc[npc.realLife].ModNPC().DeathAnimationTimer / 640f; + float disintegrationFactor = Main.npc[NPC.realLife].ModNPC().DeathAnimationTimer / 640f; if (disintegrationFactor > 0f) { spriteBatch.EnterShaderRegion(); GameShaders.Misc["CalamityMod:DoGDisintegration"].UseOpacity(disintegrationFactor); - GameShaders.Misc["CalamityMod:DoGDisintegration"].UseSaturation(npc.whoAmI); + GameShaders.Misc["CalamityMod:DoGDisintegration"].UseSaturation(NPC.whoAmI); GameShaders.Misc["CalamityMod:DoGDisintegration"].UseImage("Images/Misc/Perlin"); GameShaders.Misc["CalamityMod:DoGDisintegration"].Apply(); } SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; bool useOtherTextures = phase2Started && CalamityWorld.DoGSecondStageCountdown <= 60; - Texture2D texture2D15 = useOtherTextures ? ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailS") : Main.npcTexture[npc.type]; + Texture2D texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailS") : Main.npcTexture[NPC.type]; Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - if (!npc.dontTakeDamage) + if (!NPC.dontTakeDamage) { - texture2D15 = useOtherTextures ? ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailSGlow") : ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailGlow"); + texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailSGlow") : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailGlow"); Color color37 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = useOtherTextures ? ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailSGlow2") : ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailGlow2"); + texture2D15 = useOtherTextures ? ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailSGlow2") : ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailGlow2"); color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } if (disintegrationFactor > 0f) @@ -342,10 +343,10 @@ namespace CalamityMod.NPCs.DevourerofGods Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -355,29 +356,29 @@ namespace CalamityMod.NPCs.DevourerofGods if (dist4 < minDist) minDist = dist4; - return minDist <= (phase2Started ? 70f : 35f) && npc.Opacity >= 1f; + return minDist <= (phase2Started ? 70f : 35f) && NPC.Opacity >= 1f; } public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 8; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), npc.Center); + NPC.soundDelay = 8; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), NPC.Center); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS4"), 1f); - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/DoGS3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/DoGS4"), 1f); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 50; + NPC.height = 50; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -387,10 +388,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -398,21 +399,21 @@ namespace CalamityMod.NPCs.DevourerofGods public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if ((damage * (crit ? 2D : 1D)) >= npc.life || (npc.realLife >= 0 && Main.npc[npc.realLife].ModNPC().Dying)) + if ((damage * (crit ? 2D : 1D)) >= NPC.life || (NPC.realLife >= 0 && Main.npc[NPC.realLife].ModNPC().Dying)) { - if (npc.realLife >= 0) + if (NPC.realLife >= 0) { damage = 0D; - npc.dontTakeDamage = true; - Main.npc[npc.realLife].dontTakeDamage = true; - Main.npc[npc.realLife].life = 1; + NPC.dontTakeDamage = true; + Main.npc[NPC.realLife].dontTakeDamage = true; + Main.npc[NPC.realLife].life = 1; - if (!Main.npc[npc.realLife].ModNPC().Dying) + if (!Main.npc[NPC.realLife].ModNPC().Dying) { - Main.npc[npc.realLife].ModNPC().Dying = true; - Main.npc[npc.realLife].dontTakeDamage = true; - Main.npc[npc.realLife].active = true; - Main.npc[npc.realLife].netUpdate = true; + Main.npc[NPC.realLife].ModNPC().Dying = true; + Main.npc[NPC.realLife].dontTakeDamage = true; + Main.npc[NPC.realLife].active = true; + Main.npc[NPC.realLife].netUpdate = true; } } return false; @@ -422,8 +423,8 @@ namespace CalamityMod.NPCs.DevourerofGods public override bool CheckDead() { - if (npc.realLife >= 0) - Main.npc[npc.realLife].checkDead(); + if (NPC.realLife >= 0) + Main.npc[NPC.realLife].checkDead(); return base.CheckDead(); } @@ -439,8 +440,8 @@ namespace CalamityMod.NPCs.DevourerofGods public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -456,7 +457,7 @@ namespace CalamityMod.NPCs.DevourerofGods "Mods.CalamityMod.EdgyBossText9" }); Color messageColor = Color.Cyan; - Rectangle location = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + Rectangle location = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); CombatText.NewText(location, messageColor, Language.GetTextValue(text), true); player.Calamity().dogTextCooldown = 60; } diff --git a/NPCs/DevourerofGods/DevourerofGodsTail2.cs b/NPCs/DevourerofGods/DevourerofGodsTail2.cs index 0e8ba6c0cc..14bd5f2083 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail2.cs @@ -19,35 +19,35 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - npc.GetNPCDamage(); - npc.width = 30; - npc.height = 50; - npc.defense = 70; - npc.lifeMax = 50000; - npc.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 30; + NPC.height = 50; + NPC.defense = 70; + NPC.lifeMax = 50000; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.dontCountMe = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) { invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -57,22 +57,22 @@ namespace CalamityMod.NPCs.DevourerofGods public override void AI() { - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); if (invinceTime > 0) { invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; + NPC.damage = 0; + NPC.dontTakeDamage = true; } else { - npc.damage = npc.defDamage; - npc.dontTakeDamage = false; + NPC.damage = NPC.defDamage; + NPC.dontTakeDamage = false; } - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -86,36 +86,36 @@ namespace CalamityMod.NPCs.DevourerofGods } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - if (npc.alpha != 0) + if (NPC.alpha != 0) { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + int num935 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); Main.dust[num935].noGravity = true; Main.dust[num935].noLight = true; } - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; @@ -123,47 +123,47 @@ namespace CalamityMod.NPCs.DevourerofGods num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTail2Glow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTail2Glow"); Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -176,22 +176,22 @@ namespace CalamityMod.NPCs.DevourerofGods public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT5"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/DoT2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/DoT3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/DoT4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/DoT5"), 1f); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 50; + NPC.height = 50; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -201,10 +201,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DraedonLabThings/RepairUnitCritter.cs b/NPCs/DraedonLabThings/RepairUnitCritter.cs index f5e56fb0c8..a55ed02c91 100644 --- a/NPCs/DraedonLabThings/RepairUnitCritter.cs +++ b/NPCs/DraedonLabThings/RepairUnitCritter.cs @@ -22,49 +22,49 @@ namespace CalamityMod.NPCs.DraedonLabThings public BehaviorState CurrentState { - get => (BehaviorState)(int)npc.ai[0]; - set => npc.ai[0] = (int)value; + get => (BehaviorState)(int)NPC.ai[0]; + set => NPC.ai[0] = (int)value; } - public ref float StuckCount => ref npc.ai[1]; + public ref float StuckCount => ref NPC.ai[1]; public bool Initialized { - get => npc.ai[2] == 1f; - set => npc.ai[2] = value.ToInt(); + get => NPC.ai[2] == 1f; + set => NPC.ai[2] = value.ToInt(); } public bool WantsToClimbOnSomeWall { - get => npc.ai[3] == 1f; - set => npc.ai[3] = value.ToInt(); + get => NPC.ai[3] == 1f; + set => NPC.ai[3] = value.ToInt(); } - public ref float CurrentFrame => ref npc.localAI[0]; - public ref float Time => ref npc.localAI[1]; - public ref float ClimbTime => ref npc.localAI[2]; + public ref float CurrentFrame => ref NPC.localAI[0]; + public ref float Time => ref NPC.localAI[1]; + public ref float ClimbTime => ref NPC.localAI[2]; public const float Gravity = 0.4f; public override void SetStaticDefaults() { DisplayName.SetDefault("Repair Unit"); - Main.npcFrameCount[npc.type] = 17; + Main.npcFrameCount[NPC.type] = 17; } public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 0; - npc.width = 20; - npc.height = 22; - npc.lifeMax = 80; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = false; - npc.friendly = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath44; + NPC.damage = 0; + NPC.width = 20; + NPC.height = 22; + NPC.lifeMax = 80; + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = false; + NPC.friendly = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath44; } public override void SendExtraAI(BinaryWriter writer) @@ -89,11 +89,11 @@ namespace CalamityMod.NPCs.DraedonLabThings { if (!Initialized) { - npc.velocity = Vector2.UnitX * Main.rand.NextBool(2).ToDirectionInt() * 1.5f; + NPC.velocity = Vector2.UnitX * Main.rand.NextBool(2).ToDirectionInt() * 1.5f; Initialized = true; } - npc.Calamity().ShouldFallThroughPlatforms = false; + NPC.Calamity().ShouldFallThroughPlatforms = false; switch (CurrentState) { case BehaviorState.WalkAround: @@ -112,110 +112,110 @@ namespace CalamityMod.NPCs.DraedonLabThings { // Fall onto the ground if mid-air. - Tile tileBelow = CalamityUtils.ParanoidTileRetrieval((int)(npc.Bottom.X / 16f), (int)(npc.Bottom.Y / 16f)); - bool onSolidGround = WorldGen.SolidTile(tileBelow) || (tileBelow.active() && Main.tileSolidTop[tileBelow.type]); - float directionSign = Math.Sign(npc.velocity.X); + Tile tileBelow = CalamityUtils.ParanoidTileRetrieval((int)(NPC.Bottom.X / 16f), (int)(NPC.Bottom.Y / 16f)); + bool onSolidGround = WorldGen.SolidTile(tileBelow) || (tileBelow.active() && Main.tileSolidTop[tileBelow.TileType]); + float directionSign = Math.Sign(NPC.velocity.X); if (directionSign == 0f) - directionSign = npc.spriteDirection; - if (Math.Abs(npc.velocity.X) > 0.5f && onSolidGround) - npc.velocity.X = MathHelper.Lerp(npc.velocity.X, directionSign * 5f, 0.05f); + directionSign = NPC.spriteDirection; + if (Math.Abs(NPC.velocity.X) > 0.5f && onSolidGround) + NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, directionSign * 5f, 0.05f); // Using walking frames if on solid ground. // If not on solid ground, use the first frame. if (onSolidGround) - npc.frameCounter += npc.velocity.Length() + 0.4f; + NPC.frameCounter += NPC.velocity.Length() + 0.4f; else CurrentFrame = 0f; // Enforce gravity. - npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y + Gravity, -15f, 15f); + NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y + Gravity, -15f, 15f); // Handle directioning. - if (Math.Abs(npc.velocity.X) > 0.4f) - npc.spriteDirection = (npc.velocity.X > 0f).ToDirectionInt(); + if (Math.Abs(NPC.velocity.X) > 0.4f) + NPC.spriteDirection = (NPC.velocity.X > 0f).ToDirectionInt(); // Attempt to jump over gaps if they aren't too big. - Vector2 checkPosition = npc.Bottom + new Vector2(Math.Sign(npc.velocity.X) * 24f, 12f); + Vector2 checkPosition = NPC.Bottom + new Vector2(Math.Sign(NPC.velocity.X) * 24f, 12f); float? distanceToAheadBelowTile = CalamityUtils.DistanceToTileCollisionHit(checkPosition, Vector2.UnitX * directionSign); - if (onSolidGround && distanceToAheadBelowTile.HasValue && distanceToAheadBelowTile.Value >= 2 && distanceToAheadBelowTile.Value < 9 && npc.velocity.Y == Gravity) + if (onSolidGround && distanceToAheadBelowTile.HasValue && distanceToAheadBelowTile.Value >= 2 && distanceToAheadBelowTile.Value < 9 && NPC.velocity.Y == Gravity) { - Vector2 jumpDestination = npc.Center + Vector2.UnitX * npc.spriteDirection * (distanceToAheadBelowTile.Value * 16f + 12f); - npc.velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(npc.Center, jumpDestination, Gravity, 10f); + Vector2 jumpDestination = NPC.Center + Vector2.UnitX * NPC.spriteDirection * (distanceToAheadBelowTile.Value * 16f + 12f); + NPC.velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(NPC.Center, jumpDestination, Gravity, 10f); } // Attempt to jump over vertical obstacles. - bool obstacleInWay = !Collision.CanHit(npc.Center - Vector2.UnitX * directionSign * 8f, 2, 2, npc.Center + Vector2.UnitX * directionSign * 50f, 8, 8); + bool obstacleInWay = !Collision.CanHit(NPC.Center - Vector2.UnitX * directionSign * 8f, 2, 2, NPC.Center + Vector2.UnitX * directionSign * 50f, 8, 8); if (onSolidGround && obstacleInWay) { - Vector2 jumpDestination = npc.Center + Vector2.UnitX * npc.spriteDirection * 132f; - float? distanceToObstacle = CalamityUtils.DistanceToTileCollisionHit(npc.Center, Vector2.UnitX * directionSign); + Vector2 jumpDestination = NPC.Center + Vector2.UnitX * NPC.spriteDirection * 132f; + float? distanceToObstacle = CalamityUtils.DistanceToTileCollisionHit(NPC.Center, Vector2.UnitX * directionSign); float obstacleHeight = 0f; for (int i = 0; i < 10; i++) { - if (WorldGen.SolidTile((int)(npc.Center.X / 16 + (distanceToObstacle ?? 0) * npc.spriteDirection), (int)(npc.Center.Y / 16) - i)) + if (WorldGen.SolidTile((int)(NPC.Center.X / 16 + (distanceToObstacle ?? 0) * NPC.spriteDirection), (int)(NPC.Center.Y / 16) - i)) obstacleHeight++; } // Just turn back if the obstacle is ridiculously tall. if (obstacleHeight >= 10) - npc.velocity.X = -npc.spriteDirection * 3f; + NPC.velocity.X = -NPC.spriteDirection * 3f; // Otherwise try to jump over it. else - npc.velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(npc.Center, jumpDestination, Gravity, 9f + StuckCount * 0.7f + obstacleHeight * 0.4f); + NPC.velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(NPC.Center, jumpDestination, Gravity, 9f + StuckCount * 0.7f + obstacleHeight * 0.4f); - if (MathHelper.Distance(npc.position.X, npc.oldPosition.X) < 0.2f) + if (MathHelper.Distance(NPC.position.X, NPC.oldPosition.X) < 0.2f) { StuckCount++; if (StuckCount > 1f && !WantsToClimbOnSomeWall) WantsToClimbOnSomeWall = true; if (StuckCount > 2f) { - npc.velocity.X *= -0.56f; + NPC.velocity.X *= -0.56f; StuckCount = 0f; } - PreviousStuckPosition = npc.Center; + PreviousStuckPosition = NPC.Center; } - npc.netUpdate = true; + NPC.netUpdate = true; } - bool closeObstacleInWay = !Collision.CanHit(npc.Center, 2, 2, npc.Center + Vector2.UnitX * directionSign * 34f, 8, 8); + bool closeObstacleInWay = !Collision.CanHit(NPC.Center, 2, 2, NPC.Center + Vector2.UnitX * directionSign * 34f, 8, 8); if (onSolidGround && closeObstacleInWay) { - npc.velocity.X *= -0.7f; - npc.netUpdate = true; + NPC.velocity.X *= -0.7f; + NPC.netUpdate = true; } // Reset the stuck counter if the NPC has become sufficiently far away from the previous stuck postion, indicating that // it is in fact, no longer stuck. - if (!npc.WithinRange(PreviousStuckPosition, 180f) && StuckCount > 0f) + if (!NPC.WithinRange(PreviousStuckPosition, 180f) && StuckCount > 0f) { StuckCount = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } // Handle walking frames. - if (npc.frameCounter >= 11f && Math.Abs(npc.velocity.Y) < 1f) + if (NPC.frameCounter >= 11f && Math.Abs(NPC.velocity.Y) < 1f) { CurrentFrame = (CurrentFrame + 1f) % 8f; - npc.frameCounter = 0; + NPC.frameCounter = 0; } if (Time % 300f == 299f && !WantsToClimbOnSomeWall) { WantsToClimbOnSomeWall = true; - npc.netUpdate = true; + NPC.netUpdate = true; } // If there are walls to clime on and this NPC wants to climb on some, do so. - if (WantsToClimbOnSomeWall && CalamityUtils.ParanoidTileRetrieval((int)npc.Center.X / 16, (int)npc.Center.Y / 16).wall > 0) + if (WantsToClimbOnSomeWall && CalamityUtils.ParanoidTileRetrieval((int)NPC.Center.X / 16, (int)NPC.Center.Y / 16).WallType > 0) { CurrentState = BehaviorState.WalkOnWalls; StuckCount = 0f; WantsToClimbOnSomeWall = false; - npc.position.Y -= 10f; - npc.netUpdate = true; + NPC.position.Y -= 10f; + NPC.netUpdate = true; } } @@ -223,102 +223,102 @@ namespace CalamityMod.NPCs.DraedonLabThings { StuckCount = 0f; WantsToClimbOnSomeWall = false; - npc.Calamity().ShouldFallThroughPlatforms = true; + NPC.Calamity().ShouldFallThroughPlatforms = true; // Generate unusual movement patterns based on sines. float offsetAngle = CalamityUtils.AperiodicSin(Time / 360f, 0f, 1f) * 0.006f; - Vector2 currentDirection = npc.velocity.SafeNormalize((npc.rotation - MathHelper.PiOver2).ToRotationVector2()); + Vector2 currentDirection = NPC.velocity.SafeNormalize((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()); // Turn much more quickly if there's no wall ahead. - Vector2 aheadCheckPosition = npc.Center + currentDirection * 120f; + Vector2 aheadCheckPosition = NPC.Center + currentDirection * 120f; Tile aheadTile = CalamityUtils.ParanoidTileRetrieval((int)(aheadCheckPosition.X / 16), (int)(aheadCheckPosition.Y / 16)); - bool aboutToCollideWithSomething = CalamityUtils.DistanceToTileCollisionHit(npc.Center - currentDirection * 5f, currentDirection) < 6f; + bool aboutToCollideWithSomething = CalamityUtils.DistanceToTileCollisionHit(NPC.Center - currentDirection * 5f, currentDirection) < 6f; bool almostReadyToWalkAgain = ClimbTime > 445f; - if (((aheadTile.wall == WallID.None || WorldGen.SolidTile(aheadTile)) && !almostReadyToWalkAgain) || aboutToCollideWithSomething) + if (((aheadTile.WallType == WallID.None || WorldGen.SolidTile(aheadTile)) && !almostReadyToWalkAgain) || aboutToCollideWithSomething) { - float distanceToCollisionLeft = CalamityUtils.DistanceToTileCollisionHit(npc.Center - currentDirection.RotatedBy(MathHelper.PiOver2) * 5f, currentDirection.RotatedBy(MathHelper.PiOver2)) ?? 10000f; - float distanceToCollisionRight = CalamityUtils.DistanceToTileCollisionHit(npc.Center - currentDirection.RotatedBy(-MathHelper.PiOver2) * 5f, currentDirection.RotatedBy(-MathHelper.PiOver2)) ?? 10000f; + float distanceToCollisionLeft = CalamityUtils.DistanceToTileCollisionHit(NPC.Center - currentDirection.RotatedBy(MathHelper.PiOver2) * 5f, currentDirection.RotatedBy(MathHelper.PiOver2)) ?? 10000f; + float distanceToCollisionRight = CalamityUtils.DistanceToTileCollisionHit(NPC.Center - currentDirection.RotatedBy(-MathHelper.PiOver2) * 5f, currentDirection.RotatedBy(-MathHelper.PiOver2)) ?? 10000f; float steerRotation = distanceToCollisionLeft > distanceToCollisionRight ? MathHelper.PiOver2 : -MathHelper.PiOver2; - Vector2 idealVelocity = npc.velocity.RotatedBy(steerRotation); - npc.velocity = npc.velocity.MoveTowards(idealVelocity, 0.15f); + Vector2 idealVelocity = NPC.velocity.RotatedBy(steerRotation); + NPC.velocity = NPC.velocity.MoveTowards(idealVelocity, 0.15f); } else - npc.velocity = npc.velocity.RotatedBy(offsetAngle); - npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * 1.56f; + NPC.velocity = NPC.velocity.RotatedBy(offsetAngle); + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.Zero) * 1.56f; // Rebound on collision. - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X *= -0.8f; - npc.Center += npc.velocity * 2f; + NPC.velocity.X *= -0.8f; + NPC.Center += NPC.velocity * 2f; } - if (npc.collideY) + if (NPC.collideY) { - npc.velocity.Y *= -0.8f; - npc.Center += npc.velocity * 2f; + NPC.velocity.Y *= -0.8f; + NPC.Center += NPC.velocity * 2f; } - if (npc.velocity.Length() > 1.4f) - npc.rotation = npc.rotation.AngleLerp(npc.velocity.ToRotation() + MathHelper.PiOver2, 0.2f); + if (NPC.velocity.Length() > 1.4f) + NPC.rotation = NPC.rotation.AngleLerp(NPC.velocity.ToRotation() + MathHelper.PiOver2, 0.2f); - if (Collision.SolidCollision(npc.position + Vector2.One * 24f, npc.width - 12, npc.height - 12)) + if (Collision.SolidCollision(NPC.position + Vector2.One * 24f, NPC.width - 12, NPC.height - 12)) { - npc.velocity *= -1f; - npc.position.Y -= 5f; + NPC.velocity *= -1f; + NPC.position.Y -= 5f; } // Handle climbing frames. - npc.frameCounter++; - if (npc.frameCounter >= 4f) + NPC.frameCounter++; + if (NPC.frameCounter >= 4f) { if (CurrentFrame < 9) CurrentFrame = 9f; CurrentFrame++; - if (CurrentFrame >= Main.npcFrameCount[npc.type]) + if (CurrentFrame >= Main.npcFrameCount[NPC.type]) CurrentFrame = 9f; - npc.frameCounter = 0; + NPC.frameCounter = 0; } - if (CalamityUtils.ParanoidTileRetrieval((int)(npc.Center.X / 16), (int)(npc.Center.Y / 16)).wall == WallID.None || ClimbTime > 620f) + if (CalamityUtils.ParanoidTileRetrieval((int)(NPC.Center.X / 16), (int)(NPC.Center.Y / 16)).WallType == WallID.None || ClimbTime > 620f) { CurrentState = BehaviorState.WalkAround; - npc.velocity = new Vector2(Main.rand.NextBool(2).ToDirectionInt() * 1.2f, 3f); - npc.rotation = 0f; - npc.netUpdate = true; + NPC.velocity = new Vector2(Main.rand.NextBool(2).ToDirectionInt() * 1.2f, 3f); + NPC.rotation = 0f; + NPC.netUpdate = true; } } public override void HitEffect(int hitDirection, double damage) { for (int i = 0; i < 6; i++) - Dust.NewDustDirect(npc.position, npc.width, npc.height, 226); - if (npc.life <= 0) + Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 226); + if (NPC.life <= 0) { for (int i = 1; i <= 3; i++) - Gore.NewGorePerfect(npc.Center, npc.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.7f, 1f), mod.GetGoreSlot($"Gores/DraedonLabCritters/RepairUnit{i}")); + Gore.NewGorePerfect(NPC.Center, NPC.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.7f, 1f), Mod.GetGoreSlot($"Gores/DraedonLabCritters/RepairUnit{i}")); } } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 2, 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 2, 2, 4); } public override void FindFrame(int frameHeight) { - npc.frame.Y = (int)(CurrentFrame * frameHeight); + NPC.frame.Y = (int)(CurrentFrame * frameHeight); } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Texture2D critterTexture = Main.npcTexture[npc.type]; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/NPCs/DraedonLabThings/RepairUnitCritterGlowmask"); - Vector2 drawPosition = npc.Center - Main.screenPosition + Vector2.UnitY * npc.gfxOffY; - SpriteEffects direction = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - spriteBatch.Draw(critterTexture, drawPosition, npc.frame, npc.GetAlpha(drawColor), npc.rotation, npc.frame.Size() * 0.5f, npc.scale, direction, 0f); - spriteBatch.Draw(glowmask, drawPosition, npc.frame, npc.GetAlpha(Color.White), npc.rotation, npc.frame.Size() * 0.5f, npc.scale, direction, 0f); + Texture2D critterTexture = Main.npcTexture[NPC.type]; + Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/DraedonLabThings/RepairUnitCritterGlowmask"); + Vector2 drawPosition = NPC.Center - Main.screenPosition + Vector2.UnitY * NPC.gfxOffY; + SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + spriteBatch.Draw(critterTexture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); + spriteBatch.Draw(glowmask, drawPosition, NPC.frame, NPC.GetAlpha(Color.White), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); return false; } } diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 221c29eee6..f65a88d1fc 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; using Terraria.Graphics.Shaders; using System.Collections.Generic; using CalamityMod.Skies; +using Terraria.Audio; namespace CalamityMod.NPCs.ExoMechs.Apollo { @@ -46,8 +47,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public float AIState { - get => npc.Calamity().newAI[0]; - set => npc.Calamity().newAI[0] = value; + get => NPC.Calamity().newAI[0]; + set => NPC.Calamity().newAI[0] = value; } public enum SecondaryPhase @@ -59,8 +60,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public float SecondaryAIState { - get => npc.Calamity().newAI[1]; - set => npc.Calamity().newAI[1] = value; + get => NPC.Calamity().newAI[1]; + set => NPC.Calamity().newAI[1] = value; } // Variable used to scale up velocity if too far from destination @@ -120,44 +121,44 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public override void SetStaticDefaults() { DisplayName.SetDefault(NameToDisplay); - NPCID.Sets.TrailingMode[npc.type] = 3; - NPCID.Sets.TrailCacheLength[npc.type] = 15; + NPCID.Sets.TrailingMode[NPC.type] = 3; + NPCID.Sets.TrailCacheLength[NPC.type] = 15; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 5f; - npc.GetNPCDamage(); - npc.width = 204; - npc.height = 226; - npc.defense = 80; - npc.DR_NERD(0.25f); - npc.LifeMaxNERB(1250000, 1495000, 500000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 5f; + NPC.GetNPCDamage(); + NPC.width = 204; + NPC.height = 226; + NPC.defense = 80; + NPC.DR_NERD(0.25f); + NPC.LifeMaxNERB(1250000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.Opacity = 0f; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(15, 0, 0, 0); - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; + NPC.Opacity = 0f; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(15, 0, 0, 0); + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.boss = true; music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void BossHeadSlot(ref int index) { if (SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune) index = -1; - else if (npc.life / (float)npc.lifeMax < 0.6f) + else if (NPC.life / (float)NPC.lifeMax < 0.6f) index = phase2IconIndex; else index = phase1IconIndex; @@ -169,14 +170,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo writer.Write(frameX); writer.Write(frameY); writer.Write(pickNewLocation); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); for (int i = 0; i < 4; i++) { - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); writer.WriteVector2(chargeLocations[i]); } } @@ -187,25 +188,25 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); pickNewLocation = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) { - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); chargeLocations[i] = reader.ReadVector2(); } } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - CalamityGlobalNPC.draedonExoMechTwinGreen = npc.whoAmI; + CalamityGlobalNPC.draedonExoMechTwinGreen = NPC.whoAmI; - npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + NPC.frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -214,15 +215,15 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); // Target variable - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; // Check if the other exo mechs are alive int otherExoMechsAlive = 0; @@ -236,8 +237,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo exoMechTwinRedAlive = true; // Link the HP of both twins - if (npc.life > Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life) - npc.life = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life; + if (NPC.life > Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life) + NPC.life = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life; } } if (CalamityGlobalNPC.draedonExoMechWorm != -1) @@ -264,7 +265,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // These are 5 by default to avoid triggering passive phases after the other mechs are dead float exoWormLifeRatio = defaultLifeRatio; @@ -311,17 +312,17 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Prevent mechs from being respawned if (otherExoMechWasFirst) { - if (npc.ai[3] < 1f) - npc.ai[3] = 1f; + if (NPC.ai[3] < 1f) + NPC.ai[3] = 1f; } // Decrement the timer used to stop Artemis from firing lasers - if (npc.ai[3] > 1f) - npc.ai[3] -= 1f; + if (NPC.ai[3] > 1f) + NPC.ai[3] -= 1f; // Phases bool phase2 = lifeRatio < 0.6f; - bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f; + bool spawnOtherExoMechs = lifeRatio < 0.7f && NPC.ai[3] == 0f; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -332,18 +333,18 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk; // Spawn Artemis if it doesn't exist after the first 10 frames have passed - if (npc.ai[0] < 10f) + if (NPC.ai[0] < 10f) { - npc.ai[0] += 1f; - if (npc.ai[0] == 10f && !NPC.AnyNPCs(ModContent.NPCType())) + NPC.ai[0] += 1f; + if (NPC.ai[0] == 10f && !NPC.AnyNPCs(ModContent.NPCType())) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); } else { if (!NPC.AnyNPCs(ModContent.NPCType())) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; } } @@ -423,11 +424,11 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo int numRockets = nerfedAttacks ? 2 : 3; // Default vector to fly to - bool flyRight = npc.ai[0] % 2f == 0f || npc.ai[0] < 10f || !revenge; + bool flyRight = NPC.ai[0] % 2f == 0f || NPC.ai[0] < 10f || !revenge; float destinationX = flyRight ? 750f : -750f; float destinationY = player.Center.Y; float chargeComboXOffset = flyRight ? -500f : 500f; - float chargeComboYOffset = npc.ai[2] % 2f == 0f ? 400f : -400f; + float chargeComboYOffset = NPC.ai[2] % 2f == 0f ? 400f : -400f; Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X + destinationX * 1.6f, destinationY) : SecondaryAIState == (float)SecondaryPhase.Passive ? new Vector2(player.Center.X + destinationX, destinationY + 360f) : AIState == (float)Phase.LineUpChargeCombo ? new Vector2(player.Center.X + destinationX, destinationY + chargeComboYOffset) : @@ -438,26 +439,26 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { pickNewLocation = false; - npc.localAI[0] = Main.rand.Next(-50, 51); - npc.localAI[1] = Main.rand.Next(-250, 251); + NPC.localAI[0] = Main.rand.Next(-50, 51); + NPC.localAI[1] = Main.rand.Next(-250, 251); if (AIState == (float)Phase.RocketBarrage || SecondaryAIState == (float)SecondaryPhase.Passive) { - npc.localAI[0] *= 0.5f; - npc.localAI[1] *= 0.5f; + NPC.localAI[0] *= 0.5f; + NPC.localAI[1] *= 0.5f; } - npc.netUpdate = true; + NPC.netUpdate = true; } // Add a bit of randomness to the destination, but only in specific phases where it's necessary if (AIState == (float)Phase.Normal || AIState == (float)Phase.RocketBarrage || AIState == (float)Phase.PhaseTransition) { - destination.X += npc.localAI[0]; - destination.Y += npc.localAI[1]; + destination.X += NPC.localAI[0]; + destination.Y += NPC.localAI[1]; } // Scale up velocity over time if too far from destination - Vector2 distanceFromDestination = destination - npc.Center; + Vector2 distanceFromDestination = destination - NPC.Center; if (distanceFromDestination.Length() > movementDistanceGateValue && AIState != (float)Phase.ChargeCombo) { if (velocityBoostMult < 1f) @@ -471,66 +472,66 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo baseVelocity *= 1f + velocityBoostMult; // If Apollo can fire projectiles, cannot fire if too close to the target - bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f; + bool canFire = Vector2.Distance(NPC.Center, player.Center) > 320f; // Rotation Vector2 predictionVector = player.velocity * predictionAmt; - Vector2 aimedVector = player.Center + predictionVector - npc.Center; + Vector2 aimedVector = player.Center + predictionVector - NPC.Center; float rateOfRotation = 0.1f; - Vector2 rotateTowards = player.Center - npc.Center; - bool readyToCharge = AIState == (float)Phase.LineUpChargeCombo && (Vector2.Distance(npc.Center, destination) <= chargeLocationDistanceGateValue || calamityGlobalNPC.newAI[2] > 0f); + Vector2 rotateTowards = player.Center - NPC.Center; + bool readyToCharge = AIState == (float)Phase.LineUpChargeCombo && (Vector2.Distance(NPC.Center, destination) <= chargeLocationDistanceGateValue || calamityGlobalNPC.newAI[2] > 0f); if (AIState == (int)Phase.ChargeCombo) { rateOfRotation = 0f; - npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; } else if (AIState == (float)Phase.LineUpChargeCombo && chargeLocations[1] != default) { - float x = chargeLocations[1].X - npc.Center.X; - float y = chargeLocations[1].Y - npc.Center.Y; + float x = chargeLocations[1].X - NPC.Center.X; + float y = chargeLocations[1].Y - NPC.Center.Y; rotateTowards = Vector2.Normalize(new Vector2(x, y)) * baseVelocity; } else { - float x = player.Center.X + predictionVector.X - npc.Center.X; - float y = player.Center.Y + predictionVector.Y - npc.Center.Y; + float x = player.Center.X + predictionVector.X - NPC.Center.X; + float y = player.Center.Y + predictionVector.Y - NPC.Center.Y; rotateTowards = Vector2.Normalize(new Vector2(x, y)) * baseVelocity; } // Do not set this during charge or deathray phases if (rateOfRotation != 0f) - npc.rotation = npc.rotation.AngleTowards((float)Math.Atan2(rotateTowards.Y, rotateTowards.X) + MathHelper.PiOver2, rateOfRotation); + NPC.rotation = NPC.rotation.AngleTowards((float)Math.Atan2(rotateTowards.Y, rotateTowards.X) + MathHelper.PiOver2, rateOfRotation); // Light - Lighting.AddLight(npc.Center, 0.05f * npc.Opacity, 0.25f * npc.Opacity, 0.15f * npc.Opacity); + Lighting.AddLight(NPC.Center, 0.05f * NPC.Opacity, 0.25f * NPC.Opacity, 0.15f * NPC.Opacity); // Despawn if target is dead if (player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (player.dead) { AIState = (float)Phase.Normal; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; for (int i = 0; i < maxCharges; i++) chargeLocations[i] = default; - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; - npc.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 1f; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) + NPC.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || @@ -552,16 +553,16 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo ChargeComboFlash = MathHelper.Clamp(ChargeComboFlash - 0.1f, 0f, 1f); // Set to transition to phase 2 if it hasn't happened yet - if (phase2 && npc.localAI[3] == 0f) + if (phase2 && NPC.localAI[3] == 0f) { AIState = (float)Phase.PhaseTransition; - npc.localAI[3] = 1f; + NPC.localAI[3] = 1f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; // Set frames to phase transition frames, which begin on frame 30 // Reset the frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // X = 3 sets to frame 27 frameX = 3; @@ -614,23 +615,23 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } // Reset everything - if (npc.ai[0] < 10f) - npc.ai[0] = 10f; - npc.ai[0] += 1f; + if (NPC.ai[0] < 10f) + NPC.ai[0] = 10f; + NPC.ai[0] += 1f; - if (npc.ai[3] < 1f) - npc.ai[3] = 1f; + if (NPC.ai[3] < 1f) + NPC.ai[3] = 1f; SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; for (int i = 0; i < maxCharges; i++) chargeLocations[i] = default; - npc.TargetClosest(); + NPC.TargetClosest(); // Draedon text for the start of phase 2 if (draedonAlive) @@ -669,15 +670,15 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Tells Apollo to return to the battle in passive state and reset everything SecondaryAIState = (float)SecondaryPhase.Passive; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; for (int i = 0; i < maxCharges; i++) chargeLocations[i] = default; - npc.TargetClosest(); + NPC.TargetClosest(); } // Go passive and immune if one of the other mechs is berserk @@ -716,20 +717,20 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } // Reset everything - if (npc.ai[0] < 10f) - npc.ai[0] = 10f; - npc.ai[0] += 1f; + if (NPC.ai[0] < 10f) + NPC.ai[0] = 10f; + NPC.ai[0] += 1f; SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; for (int i = 0; i < maxCharges; i++) chargeLocations[i] = default; - npc.TargetClosest(); + NPC.TargetClosest(); // Phase 6, when 1 mech goes berserk and the other one leaves if (draedonAlive) @@ -786,20 +787,20 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } // Reset everything - if (npc.ai[0] < 10f) - npc.ai[0] = 10f; - npc.ai[0] += 1f; + if (NPC.ai[0] < 10f) + NPC.ai[0] = 10f; + NPC.ai[0] += 1f; SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; for (int i = 0; i < maxCharges; i++) chargeLocations[i] = default; - npc.TargetClosest(); + NPC.TargetClosest(); } // If Artemis and Apollo are the first mechs to go berserk @@ -819,15 +820,15 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } // Reset everything - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; for (int i = 0; i < maxCharges; i++) chargeLocations[i] = default; - npc.TargetClosest(); + NPC.TargetClosest(); // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; @@ -876,15 +877,15 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Tells Artemis and Apollo to return to the battle in passive state and reset everything // Return to normal phases if one or more mechs have been downed SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; for (int i = 0; i < maxCharges; i++) chargeLocations[i] = default; - npc.TargetClosest(); + NPC.TargetClosest(); // Phase 3, when all 3 mechs attack at the same time if (exoWormAlive && exoPrimeAlive) @@ -914,15 +915,15 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } // Reset everything - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; for (int i = 0; i < maxCharges; i++) chargeLocations[i] = default; - npc.TargetClosest(); + NPC.TargetClosest(); // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; @@ -933,18 +934,18 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Adjust opacity bool invisiblePhase = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = invisiblePhase || AIState == (float)Phase.PhaseTransition; + NPC.dontTakeDamage = invisiblePhase || AIState == (float)Phase.PhaseTransition; if (!invisiblePhase) { - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } else { - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } // Attacking phases @@ -954,7 +955,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo case (int)Phase.Normal: // Smooth movement towards the location Apollo is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); // Default animation for 60 frames and then go to telegraph animation // newAI[3] tells Apollo what animation state it's currently in @@ -975,15 +976,15 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (plasmaTimer % divisor == 0f && canFire) { pickNewLocation = true; - npc.ai[2] += 1f; + NPC.ai[2] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaCasterFire"), npc.Center); + int damage = NPC.GetProjectileDamage(type); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaCasterFire"), NPC.Center); Vector2 plasmaVelocity = Vector2.Normalize(aimedVector) * projectileVelocity; Vector2 offset = Vector2.Normalize(plasmaVelocity) * 70f; - Projectile.NewProjectile(npc.Center + offset, plasmaVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + Projectile.NewProjectile(NPC.Center + offset, plasmaVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); } } } @@ -1004,16 +1005,16 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo for (int i = 0; i < maxCharges; i++) chargeLocations[i] = default; - npc.TargetClosest(); + NPC.TargetClosest(); } else if (doBigAttack) { - pickNewLocation = npc.localAI[2] == 0f; + pickNewLocation = NPC.localAI[2] == 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; if (phase2) - AIState = npc.localAI[2] == 1f ? (float)Phase.LineUpChargeCombo : (float)Phase.RocketBarrage; + AIState = NPC.localAI[2] == 1f ? (float)Phase.LineUpChargeCombo : (float)Phase.RocketBarrage; else AIState = (float)Phase.RocketBarrage; } @@ -1026,7 +1027,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo case (int)Phase.RocketBarrage: // Smooth movement towards the location Apollo is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] % (rocketPhaseDuration / numRockets) == 0f && canFire) @@ -1035,11 +1036,11 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Main.PlaySound(SoundID.Item36, npc.Center); + int damage = NPC.GetProjectileDamage(type); + SoundEngine.PlaySound(SoundID.Item36, NPC.Center); Vector2 rocketVelocity = Vector2.Normalize(aimedVector) * projectileVelocity * 1.2f; Vector2 offset = Vector2.Normalize(rocketVelocity) * 70f; - Projectile.NewProjectile(npc.Center + offset, rocketVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + Projectile.NewProjectile(NPC.Center + offset, rocketVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); } } @@ -1048,9 +1049,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { // Go back to normal phase AIState = (float)Phase.Normal; - npc.localAI[2] = shouldGetBuffedByBerserkPhase ? 1f : 0f; + NPC.localAI[2] = shouldGetBuffedByBerserkPhase ? 1f : 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.TargetClosest(); + NPC.TargetClosest(); } break; @@ -1063,7 +1064,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (!readyToCharge) { // Smooth movement towards the location Apollo is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); } else { @@ -1077,7 +1078,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo switch (i) { case 0: - chargeLocations[i] = npc.Center; + chargeLocations[i] = NPC.Center; break; case 1: chargeLocations[i] = chargeLocations[0] + new Vector2(chargeComboXOffset, -chargeComboYOffset * 2f); @@ -1097,7 +1098,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Draw telegraph beams if (Main.netMode != NetmodeID.MultiplayerClient) { - int telegraph = Projectile.NewProjectile(chargeLocations[0], Vector2.Zero, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + int telegraph = Projectile.NewProjectile(chargeLocations[0], Vector2.Zero, type, 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); if (Main.projectile.IndexInRange(telegraph)) { Main.projectile[telegraph].ModProjectile().ChargePositions = chargeLocations; @@ -1106,13 +1107,13 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } // Play a charge sound - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), NPC.Center); } } } // Don't move - npc.velocity = Vector2.Zero; + NPC.velocity = Vector2.Zero; // Go to charge phase, create lightning bolts in the sky, and reset calamityGlobalNPC.newAI[2] += 1f; @@ -1121,7 +1122,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo ExoMechsSky.CreateLightningBolt(10); AIState = (float)Phase.ChargeCombo; - npc.localAI[2] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; } } @@ -1132,13 +1133,13 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo case (int)Phase.ChargeCombo: // Set charge velocity and fire halos of plasma bolts - if (npc.localAI[2] == 0f) + if (NPC.localAI[2] == 0f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ELRFire"), npc.Center); - npc.velocity = Vector2.Normalize(chargeLocations[(int)calamityGlobalNPC.newAI[2] + 1] - chargeLocations[(int)calamityGlobalNPC.newAI[2]]) * chargeVelocity; - npc.localAI[2] = 1f; - npc.netUpdate = true; - npc.netSpam -= 5; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ELRFire"), NPC.Center); + NPC.velocity = Vector2.Normalize(chargeLocations[(int)calamityGlobalNPC.newAI[2] + 1] - chargeLocations[(int)calamityGlobalNPC.newAI[2]]) * chargeVelocity; + NPC.localAI[2] = 1f; + NPC.netUpdate = true; + NPC.netSpam -= 5; // Plasma bolts on charge if (Main.netMode != NetmodeID.MultiplayerClient) @@ -1146,7 +1147,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo int totalProjectiles = CalamityWorld.malice ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = (int)(npc.GetProjectileDamage(ModContent.ProjectileType()) * 0.8); + int damage = (int)(NPC.GetProjectileDamage(ModContent.ProjectileType()) * 0.8); float velocity = 1f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; @@ -1155,7 +1156,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, velocity2, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.Center, velocity2, type, damage, 0f, Main.myPlayer); } } @@ -1170,7 +1171,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (i < 50) dustVelocity = 4f; - int dust1 = Dust.NewDust(npc.Center, 6, 6, Main.rand.NextBool(2) ? 107 : 110, 0f, 0f, 100, default, 1f); + int dust1 = Dust.NewDust(NPC.Center, 6, 6, Main.rand.NextBool(2) ? 107 : 110, 0f, 0f, 100, default, 1f); float dustVelX = Main.dust[dust1].velocity.X; float dustVelY = Main.dust[dust1].velocity.Y; @@ -1215,15 +1216,15 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (calamityGlobalNPC.newAI[3] >= chargeTime) { // Set Apollo's location to the next charge location - npc.Center = chargeLocations[(int)calamityGlobalNPC.newAI[2] + 1]; + NPC.Center = chargeLocations[(int)calamityGlobalNPC.newAI[2] + 1]; // Reset velocity to 0 - npc.velocity = Vector2.Zero; + NPC.velocity = Vector2.Zero; // Increase newAI[2] whenever a charge ends calamityGlobalNPC.newAI[2] += 1f; calamityGlobalNPC.newAI[3] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[2] = 0f; } // Reset phase and variables @@ -1231,25 +1232,25 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { pickNewLocation = true; AIState = (float)Phase.Normal; - npc.localAI[2] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; for (int i = 0; i < maxCharges; i++) chargeLocations[i] = default; ChargeComboFlash = 0f; // Tell Apollo and Artemis to swap positions - if (npc.ai[0] < 10f) - npc.ai[0] = 10f; - npc.ai[0] += 1f; + if (NPC.ai[0] < 10f) + NPC.ai[0] = 10f; + NPC.ai[0] += 1f; // Change Y offset for the next charge combo - npc.ai[2] = Main.rand.Next(2); + NPC.ai[2] = Main.rand.Next(2); // Tell Artemis to not fire lasers for a short time while swapping positions - npc.ai[3] = 61f; + NPC.ai[3] = 61f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.TargetClosest(); + NPC.netUpdate = true; } break; @@ -1258,17 +1259,17 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo case (int)Phase.PhaseTransition: // Smooth movement towards the location Apollo is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); // Shoot lens gore at the target at the proper time if (calamityGlobalNPC.newAI[2] == lensPopTime) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), NPC.Center); Vector2 lensDirection = Vector2.Normalize(aimedVector); Vector2 offset = lensDirection * 70f; if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.Center + offset, lensDirection * 24f, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(NPC.Center + offset, lensDirection * 24f, ModContent.ProjectileType(), 0, 0f); } // Reset phase and variables @@ -1277,11 +1278,11 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { pickNewLocation = true; AIState = (float)Phase.Normal; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; - npc.TargetClosest(); + NPC.TargetClosest(); } break; @@ -1294,10 +1295,10 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -1307,7 +1308,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (dist4 < minDist) minDist = dist4; - return minDist <= 100f && npc.Opacity == 1f && AIState == (float)Phase.ChargeCombo; + return minDist <= 100f && NPC.Opacity == 1f && AIState == (float)Phase.ChargeCombo; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -1319,14 +1320,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public override void FindFrame(int frameHeight) { // Use telegraph frames before each attack - bool phase2 = npc.life / (float)npc.lifeMax < 0.6f; - npc.frameCounter += 1D; + bool phase2 = NPC.life / (float)NPC.lifeMax < 0.6f; + NPC.frameCounter += 1D; if (AIState == (float)Phase.PhaseTransition) { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -1343,13 +1344,13 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { if (AIState == (float)Phase.Normal) { - int frameLimit = phase2 ? (npc.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase2 : npc.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase2 : attackFrameLimit_Phase2) : - (npc.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase1 : npc.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase1 : attackFrameLimit_Phase1); + int frameLimit = phase2 ? (NPC.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase2 : NPC.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase2 : attackFrameLimit_Phase2) : + (NPC.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase1 : NPC.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase1 : attackFrameLimit_Phase1); - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -1364,16 +1365,16 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Reset the frames int currentFrame = (frameX * maxFramesY) + frameY; if (currentFrame > frameLimit) - frameX = frameY = phase2 ? (npc.Calamity().newAI[3] == 0f ? 6 : npc.Calamity().newAI[3] == 1f ? 7 : 8) : (npc.Calamity().newAI[3] == 0f ? 0 : npc.Calamity().newAI[3] == 1f ? 1 : 2); + frameX = frameY = phase2 ? (NPC.Calamity().newAI[3] == 0f ? 6 : NPC.Calamity().newAI[3] == 1f ? 7 : 8) : (NPC.Calamity().newAI[3] == 0f ? 0 : NPC.Calamity().newAI[3] == 1f ? 1 : 2); } } else if (AIState == (float)Phase.RocketBarrage || AIState == (float)Phase.LineUpChargeCombo || AIState == (float)Phase.ChargeCombo) { int frameLimit = phase2 ? attackFrameLimit_Phase2 : attackFrameLimit_Phase1; - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -1429,7 +1430,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { Color startingColor = new Color(34, 40, 48); Color endColor = new Color(40, 160, 32); - return Color.Lerp(startingColor, endColor, (float)Math.Pow(completionRatio, 1.5D)) * npc.Opacity; + return Color.Lerp(startingColor, endColor, (float)Math.Pow(completionRatio, 1.5D)) * NPC.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) @@ -1445,13 +1446,13 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo RibbonTrail = new PrimitiveTrail(RibbonTrailWidthFunction, RibbonTrailColorFunction); // Prepare the flame trail shader with its map texture. - GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/ScarletDevilStreak")); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/ScarletDevilStreak")); int numAfterimages = ChargeComboFlash > 0f ? 0 : 5; - Texture2D texture = Main.npcTexture[npc.type]; - Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); - Vector2 origin = npc.Size * 0.5f; - Vector2 center = npc.Center - Main.screenPosition; + Texture2D texture = Main.npcTexture[NPC.type]; + Rectangle frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); + Vector2 origin = NPC.Size * 0.5f; + Vector2 center = NPC.Center - Main.screenPosition; Color afterimageBaseColor = Color.White; // Draws a single instance of a regular, non-glowmask based Artemis. @@ -1464,42 +1465,42 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { Color afterimageColor = baseColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; - afterimageCenter += origin * npc.scale + new Vector2(0f, npc.gfxOffY); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * NPC.scale / 2f; + afterimageCenter += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); afterimageCenter += drawOffset; - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, origin, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, afterimageCenter, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, SpriteEffects.None, 0f); } } - spriteBatch.Draw(texture, center + drawOffset, frame, npc.GetAlpha(baseColor), npc.rotation, origin, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, center + drawOffset, frame, NPC.GetAlpha(baseColor), NPC.rotation, origin, NPC.scale, SpriteEffects.None, 0f); } // Draw ribbons near the main thruster for (int direction = -1; direction <= 1; direction += 2) { - Vector2 ribbonOffset = -Vector2.UnitY.RotatedBy(npc.rotation) * 14f; - ribbonOffset += Vector2.UnitX.RotatedBy(npc.rotation) * direction * 26f; + Vector2 ribbonOffset = -Vector2.UnitY.RotatedBy(NPC.rotation) * 14f; + ribbonOffset += Vector2.UnitX.RotatedBy(NPC.rotation) * direction * 26f; - float currentSegmentRotation = npc.rotation; + float currentSegmentRotation = NPC.rotation; List ribbonDrawPositions = new List(); for (int i = 0; i < 12; i++) { float ribbonCompletionRatio = i / 12f; - float wrappedAngularOffset = MathHelper.WrapAngle(npc.oldRot[i + 1] - currentSegmentRotation) * 0.3f; + float wrappedAngularOffset = MathHelper.WrapAngle(NPC.oldRot[i + 1] - currentSegmentRotation) * 0.3f; float segmentRotationOffset = MathHelper.Clamp(wrappedAngularOffset, -0.12f, 0.12f); // Add a sinusoidal offset that goes based on time and completion ratio to create a waving-flag-like effect. // This is dampened for the first few points to prevent weird offsets. It is also dampened by high velocity. float sinusoidalRotationOffset = (float)Math.Sin(ribbonCompletionRatio * 2.22f + Main.GlobalTime * 3.4f) * 1.36f; float sinusoidalRotationOffsetFactor = Utils.InverseLerp(0f, 0.37f, ribbonCompletionRatio, true) * direction * 24f; - sinusoidalRotationOffsetFactor *= Utils.InverseLerp(24f, 16f, npc.velocity.Length(), true); + sinusoidalRotationOffsetFactor *= Utils.InverseLerp(24f, 16f, NPC.velocity.Length(), true); - Vector2 sinusoidalOffset = Vector2.UnitY.RotatedBy(npc.rotation + sinusoidalRotationOffset) * sinusoidalRotationOffsetFactor; + Vector2 sinusoidalOffset = Vector2.UnitY.RotatedBy(NPC.rotation + sinusoidalRotationOffset) * sinusoidalRotationOffsetFactor; Vector2 ribbonSegmentOffset = Vector2.UnitY.RotatedBy(currentSegmentRotation) * ribbonCompletionRatio * 540f + sinusoidalOffset; - ribbonDrawPositions.Add(npc.Center + ribbonSegmentOffset + ribbonOffset); + ribbonDrawPositions.Add(NPC.Center + ribbonSegmentOffset + ribbonOffset); currentSegmentRotation += segmentRotationOffset; } @@ -1524,23 +1525,23 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } } - texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Apollo/ApolloGlow"); + texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Apollo/ApolloGlow"); if (CalamityConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { Color afterimageColor = drawColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; - afterimageCenter += origin * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, origin, npc.scale, SpriteEffects.None, 0f); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * NPC.scale / 2f; + afterimageCenter += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, SpriteEffects.None, 0f); } } - spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, origin, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, center, frame, Color.White * NPC.Opacity, NPC.rotation, origin, NPC.scale, SpriteEffects.None, 0f); spriteBatch.ExitShaderRegion(); @@ -1549,12 +1550,12 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { for (int direction = -1; direction <= 1; direction++) { - Vector2 baseDrawOffset = new Vector2(0f, direction == 0f ? 18f : 60f).RotatedBy(npc.rotation); - baseDrawOffset += new Vector2(direction * 64f, 0f).RotatedBy(npc.rotation); + Vector2 baseDrawOffset = new Vector2(0f, direction == 0f ? 18f : 60f).RotatedBy(NPC.rotation); + baseDrawOffset += new Vector2(direction * 64f, 0f).RotatedBy(NPC.rotation); float backFlameLength = direction == 0f ? 700f : 190f; - Vector2 drawStart = npc.Center + baseDrawOffset; - Vector2 drawEnd = drawStart - (npc.rotation - MathHelper.PiOver2).ToRotationVector2() * ChargeComboFlash * backFlameLength; + Vector2 drawStart = NPC.Center + baseDrawOffset; + Vector2 drawEnd = drawStart - (NPC.rotation - MathHelper.PiOver2).ToRotationVector2() * ChargeComboFlash * backFlameLength; Vector2[] drawPositions = new Vector2[] { drawStart, @@ -1579,10 +1580,10 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public override bool SpecialNPCLoot() { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + int closestSegmentID = DropHelper.FindClosestWormSegment(NPC, ModContent.NPCType(), ModContent.NPCType()); - npc.position = Main.npc[closestSegmentID].position; + NPC.position = Main.npc[closestSegmentID].position; return false; } @@ -1637,36 +1638,36 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Mark Exo Mechs as dead and drop loot else - AresBody.DropExoMechLoot(npc, (int)AresBody.MechType.ArtemisAndApollo); + AresBody.DropExoMechLoot(NPC, (int)AresBody.MechType.ArtemisAndApollo); } // Needs edits public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Apollo/Apollo1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Apollo/Apollo2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Apollo/Apollo3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Apollo/Apollo4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Apollo/Apollo5"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Apollo/Apollo1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Apollo/Apollo2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Apollo/Apollo3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Apollo/Apollo4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Apollo/Apollo5"), 1f); } } @@ -1691,8 +1692,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 9b34f391d0..cafeb5c1ed 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -23,6 +23,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.ExoMechs.Ares { @@ -45,8 +46,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public float AIState { - get => npc.Calamity().newAI[0]; - set => npc.Calamity().newAI[0] = value; + get => NPC.Calamity().newAI[0]; + set => NPC.Calamity().newAI[0] = value; } public enum SecondaryPhase @@ -58,8 +59,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public float SecondaryAIState { - get => npc.Calamity().newAI[1]; - set => npc.Calamity().newAI[1] = value; + get => NPC.Calamity().newAI[1]; + set => NPC.Calamity().newAI[1] = value; } public enum Enraged @@ -70,14 +71,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public float EnragedState { - get => npc.localAI[1]; - set => npc.localAI[1] = value; + get => NPC.localAI[1]; + set => NPC.localAI[1] = value; } public float VelocityBoostMult { - get => npc.localAI[2]; - set => npc.localAI[2] = value; + get => NPC.localAI[2]; + set => NPC.localAI[2] = value; } public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); @@ -132,36 +133,36 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void SetStaticDefaults() { DisplayName.SetDefault("XF-09 Ares"); - NPCID.Sets.TrailingMode[npc.type] = 3; - NPCID.Sets.TrailCacheLength[npc.type] = npc.oldPos.Length; + NPCID.Sets.TrailingMode[NPC.type] = 3; + NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; } public override void SetDefaults() { - npc.npcSlots = 5f; - npc.damage = 100; - npc.width = 220; - npc.height = 252; - npc.defense = 100; - npc.DR_NERD(0.35f); - npc.LifeMaxNERB(1250000, 1495000, 500000); + NPC.npcSlots = 5f; + NPC.damage = 100; + NPC.width = 220; + NPC.height = 252; + NPC.defense = 100; + NPC.DR_NERD(0.35f); + NPC.LifeMaxNERB(1250000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.Opacity = 0f; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(15, 0, 0, 0); - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; + NPC.Opacity = 0f; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(15, 0, 0, 0); + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.boss = true; music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void BossHeadSlot(ref int index) @@ -175,12 +176,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares writer.Write(frameX); writer.Write(frameY); writer.Write(armsSpawned); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -188,21 +189,21 @@ namespace CalamityMod.NPCs.ExoMechs.Ares frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); armsSpawned = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - CalamityGlobalNPC.draedonExoMechPrime = npc.whoAmI; + CalamityGlobalNPC.draedonExoMechPrime = NPC.whoAmI; - npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + NPC.frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -210,41 +211,41 @@ namespace CalamityMod.NPCs.ExoMechs.Ares bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Spawn arms if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!armsSpawned && npc.ai[0] == 0f) + if (!armsSpawned && NPC.ai[0] == 0f) { int totalArms = 4; - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; for (int i = 0; i < totalArms; i++) { int lol = 0; switch (i) { case 0: - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); break; case 1: - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); Main.npc[lol].Calamity().newAI[1] = plasmaArmStartTimer; break; case 2: - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); Main.npc[lol].Calamity().newAI[1] = teslaArmStartTimer; break; case 3: - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); break; default: break; } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = NPC.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); @@ -254,11 +255,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } - if (npc.life > Main.npc[(int)npc.ai[0]].life) - npc.life = Main.npc[(int)npc.ai[0]].life; + if (NPC.life > Main.npc[(int)NPC.ai[0]].life) + NPC.life = Main.npc[(int)NPC.ai[0]].life; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Check if the other exo mechs are alive int otherExoMechsAlive = 0; @@ -321,12 +322,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Prevent mechs from being respawned if (otherExoMechWasFirst) { - if (npc.ai[3] < 1f) - npc.ai[3] = 1f; + if (NPC.ai[3] < 1f) + NPC.ai[3] = 1f; } // Phases - bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f; + bool spawnOtherExoMechs = lifeRatio < 0.7f && NPC.ai[3] == 0f; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -337,15 +338,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); // Target variable - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; // General AI pattern // 0 - Fly above target @@ -377,41 +378,41 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Phase 7 - 1, 2 // Rotation - npc.rotation = npc.velocity.X * 0.003f; + NPC.rotation = NPC.velocity.X * 0.003f; // Light and enrage check if (EnragedState == (float)Enraged.Yes) { - Lighting.AddLight(npc.Center, 0.5f * npc.Opacity, 0f, 0f); - npc.Calamity().CurrentlyEnraged = true; + Lighting.AddLight(NPC.Center, 0.5f * NPC.Opacity, 0f, 0f); + NPC.Calamity().CurrentlyEnraged = true; } else { float lightScale = 510f; - Lighting.AddLight(npc.Center, Main.DiscoR / lightScale * npc.Opacity, Main.DiscoG / lightScale * npc.Opacity, Main.DiscoB / lightScale * npc.Opacity); + Lighting.AddLight(NPC.Center, Main.DiscoR / lightScale * NPC.Opacity, Main.DiscoG / lightScale * NPC.Opacity, Main.DiscoB / lightScale * NPC.Opacity); } // Despawn if target is dead if (player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (player.dead) { AIState = (float)Phase.Normal; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; - npc.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 1f; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) + NPC.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || @@ -437,7 +438,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares float movementDistanceGateValue = 50f; // Scale up velocity over time if too far from destination - Vector2 distanceFromDestination = destination - npc.Center; + Vector2 distanceFromDestination = destination - NPC.Center; if (distanceFromDestination.Length() > movementDistanceGateValue && AIState != (float)Phase.Deathrays) { if (VelocityBoostMult < 1f) @@ -451,7 +452,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares baseVelocity *= 1f + VelocityBoostMult; // Distance from target - float distanceFromTarget = Vector2.Distance(npc.Center, player.Center); + float distanceFromTarget = Vector2.Distance(NPC.Center, player.Center); // Gate values float deathrayPhaseGateValue = lastMechAlive ? 420f : 600f; @@ -466,14 +467,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (EnragedState == (float)Enraged.Yes) { SmokeDrawer.ParticleSpawnRate = ventCloudSpawnRate; - SmokeDrawer.BaseMoveRotation = npc.rotation + MathHelper.PiOver2; + SmokeDrawer.BaseMoveRotation = NPC.rotation + MathHelper.PiOver2; SmokeDrawer.SpawnAreaCompactness = 80f; // Increase DR during enrage - npc.Calamity().DR = 0.85f; + NPC.Calamity().DR = 0.85f; } else - npc.Calamity().DR = 0.35f; + NPC.Calamity().DR = 0.35f; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = EnragedState == (float)Enraged.Yes; @@ -490,11 +491,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (spawnOtherExoMechs) { // Reset everything - if (npc.ai[3] < 1f) - npc.ai[3] = 1f; + if (NPC.ai[3] < 1f) + NPC.ai[3] = 1f; SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; - npc.TargetClosest(); + NPC.TargetClosest(); // Draedon text for the start of phase 2 if (draedonAlive) @@ -521,7 +522,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { // Tells Ares to return to the battle in passive state and reset everything SecondaryAIState = (float)SecondaryPhase.Passive; - npc.TargetClosest(); + NPC.TargetClosest(); } // Go passive and immune if one of the other mechs is berserk @@ -530,11 +531,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (otherMechIsBerserk && !berserk) { // Reset everything - if (npc.ai[3] < 2f) - npc.ai[3] = 2f; + if (NPC.ai[3] < 2f) + NPC.ai[3] = 2f; SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; - npc.TargetClosest(); + NPC.TargetClosest(); // Phase 6, when 1 mech goes berserk and the other one leaves if (draedonAlive) @@ -554,18 +555,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (otherMechIsBerserk) { // Reset everything - if (npc.ai[3] < 2f) - npc.ai[3] = 2f; + if (NPC.ai[3] < 2f) + NPC.ai[3] = 2f; SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; - npc.TargetClosest(); + NPC.TargetClosest(); } // If Ares is the first mech to go berserk if (berserk) { // Reset everything - npc.TargetClosest(); + NPC.TargetClosest(); // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; @@ -592,7 +593,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Tells Ares to return to the battle in passive state and reset everything // Return to normal phases if one or more mechs have been downed SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive; - npc.TargetClosest(); + NPC.TargetClosest(); // Phase 3, when all 3 mechs attack at the same time if (exoWormAlive && exoTwinsAlive) @@ -609,7 +610,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (berserk) { // Reset everything - npc.TargetClosest(); + NPC.TargetClosest(); // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; @@ -620,18 +621,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Adjust opacity bool invisiblePhase = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = invisiblePhase; + NPC.dontTakeDamage = invisiblePhase; if (!invisiblePhase) { - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } else { - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } // Attacking phases @@ -641,7 +642,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares case (int)Phase.Normal: // Smooth movement towards the location Ares is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); if (shouldGetBuffedByBerserkPhase) { @@ -691,7 +692,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (distanceFromTarget > deathrayDistanceGateValue && calamityGlobalNPC.newAI[3] == 0f) { Vector2 desiredVelocity2 = Vector2.Normalize(distanceFromDestination) * baseVelocity; - npc.SimpleFlyMovement(desiredVelocity2, baseAcceleration); + NPC.SimpleFlyMovement(desiredVelocity2, baseAcceleration); } else { @@ -699,9 +700,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (distanceFromTarget > 2480f && EnragedState == (float)Enraged.No) { // Play enrage sound - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AresEnraged"), + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AresEnraged"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); } @@ -714,11 +715,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } calamityGlobalNPC.newAI[3] = 1f; - npc.velocity *= decelerationVelocityMult; + NPC.velocity *= decelerationVelocityMult; int totalProjectiles = malice ? 12 : death ? 10 : revenge ? 9 : expertMode ? 8 : 6; float radians = MathHelper.TwoPi / totalProjectiles; - bool normalLaserRotation = npc.localAI[0] % 2f == 0f; + bool normalLaserRotation = NPC.localAI[0] % 2f == 0f; float velocity = 6f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; @@ -763,7 +764,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Set frames to deathray charge up frames, which begin on frame 12 // Reset the frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // X = 1 sets to frame 8 frameX = 1; @@ -776,13 +777,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), NPC.Center); int type = ModContent.ProjectileType(); - Vector2 spawnPoint = npc.Center + new Vector2(-1f, 23f); + Vector2 spawnPoint = NPC.Center + new Vector2(-1f, 23f); for (int k = 0; k < totalProjectiles; k++) { Vector2 laserVelocity = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 17f, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 17f, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -794,14 +795,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), NPC.Center); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 spawnPoint = npc.Center + new Vector2(-1f, 23f); + int damage = NPC.GetProjectileDamage(type); + Vector2 spawnPoint = NPC.Center + new Vector2(-1f, 23f); for (int k = 0; k < totalProjectiles; k++) { Vector2 laserVelocity = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 35f, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 35f, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -823,20 +824,20 @@ namespace CalamityMod.NPCs.ExoMechs.Ares */ if (revenge) { - npc.ai[3] += 1f + Main.rand.Next(2); - if (npc.ai[3] > 5f) - npc.ai[3] -= 4f; + NPC.ai[3] += 1f + Main.rand.Next(2); + if (NPC.ai[3] > 5f) + NPC.ai[3] -= 4f; } else if (expertMode) { - npc.ai[3] += Main.rand.Next(2); - if (npc.ai[3] > 3f) - npc.ai[3] -= 2f; + NPC.ai[3] += Main.rand.Next(2); + if (NPC.ai[3] > 3f) + NPC.ai[3] -= 2f; } - npc.localAI[0] += 1f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.localAI[0] += 1f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } @@ -855,13 +856,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void FindFrame(int frameHeight) { // Use telegraph frames when using deathrays - npc.frameCounter += 1D; - if (AIState == (float)Phase.Normal || npc.Calamity().newAI[3] == 0f) + NPC.frameCounter += 1D; + if (AIState == (float)Phase.Normal || NPC.Calamity().newAI[3] == 0f) { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -880,10 +881,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } else { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -905,7 +906,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { // Draw the enrage smoke behind Ares - SmokeDrawer.DrawSet(npc.Center); + SmokeDrawer.DrawSet(NPC.Center); // Draw arms. int laserArm = NPC.FindFirstNPC(ModContent.NPCType()); @@ -933,7 +934,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Swap out arm positions as necessary. // Normal Position: Laser, Tesla, Plasma, Laser - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { case 0: if (AIState == (int)Phase.Deathrays) @@ -986,9 +987,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (plasmaArm != -1) DrawArm(spriteBatch, Main.npc[plasmaArm].Center, armGlowmaskColor, armProperties[3].Item1, armProperties[3].Item2); - Texture2D texture = Main.npcTexture[npc.type]; - Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); - Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); + Texture2D texture = Main.npcTexture[NPC.type]; + Rectangle frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); + Vector2 vector = new Vector2(NPC.width / 2, NPC.height / 2); int numAfterimages = 5; if (CalamityConfig.Instance.Afterimages) @@ -997,19 +998,19 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { Color afterimageColor = drawColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, SpriteEffects.None, 0f); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * NPC.scale / 2f; + afterimageCenter += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, NPC.frame, afterimageColor, NPC.oldRot[i], vector, NPC.scale, SpriteEffects.None, 0f); } } - Vector2 center = npc.Center - Main.screenPosition; - spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + Vector2 center = NPC.Center - Main.screenPosition; + spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, SpriteEffects.None, 0f); - texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Ares/AresBodyGlow"); + texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresBodyGlow"); if (CalamityConfig.Instance.Afterimages) { @@ -1017,22 +1018,22 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { Color afterimageColor = drawColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, SpriteEffects.None, 0f); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * NPC.scale / 2f; + afterimageCenter += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, NPC.frame, afterimageColor, NPC.oldRot[i], vector, NPC.scale, SpriteEffects.None, 0f); } } - spriteBatch.Draw(texture, center, frame, afterimageBaseColor * npc.Opacity, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, center, frame, afterimageBaseColor * NPC.Opacity, NPC.rotation, vector, NPC.scale, SpriteEffects.None, 0f); return false; } internal float WidthFunction(float completionRatio) { - return MathHelper.Lerp(0.5f, 1.3f, (float)Math.Sin(MathHelper.Pi * completionRatio)) * npc.scale; + return MathHelper.Lerp(0.5f, 1.3f, (float)Math.Sin(MathHelper.Pi * completionRatio)) * NPC.scale; } internal Color ColorFunction(float completionRatio) @@ -1044,7 +1045,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Color baseColor = Color.Lerp(baseColor1, Color.White, fadeToWhite); Color color = Color.Lerp(baseColor, baseColor2, ((float)Math.Sin(MathHelper.Pi * completionRatio + Main.GlobalTime * 4f) * 0.5f + 0.5f) * 0.8f) * 0.65f; color.A = 84; - if (npc.Opacity <= 0f) + if (NPC.Opacity <= 0f) return Color.Transparent; return color; } @@ -1054,7 +1055,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public Color BackgroundColorFunction(float completionRatio) { Color backgroundColor = EnragedState == (float)Enraged.Yes ? Color.Crimson : Color.CornflowerBlue; - Color color = backgroundColor * npc.Opacity * 0.4f; + Color color = backgroundColor * NPC.Opacity * 0.4f; return color; } @@ -1066,22 +1067,22 @@ namespace CalamityMod.NPCs.ExoMechs.Ares LightningBackgroundDrawer = new PrimitiveTrail(BackgroundWidthFunction, BackgroundColorFunction, PrimitiveTrail.RigidPointRetreivalFunction); SpriteEffects spriteDirection = direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - float distanceFromHand = npc.Distance(handPosition); + float distanceFromHand = NPC.Distance(handPosition); float frameTime = Main.GlobalTime * 0.9f % 1f; // Draw back arms. if (backArm) { - Texture2D shoulderTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AresArmTopShoulder"); - Texture2D armTexture1 = ModContent.GetTexture("CalamityMod/ExtraTextures/AresArmTopPart1"); - Texture2D armSegmentTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AresArmTopSegment"); - Texture2D armTexture2 = ModContent.GetTexture("CalamityMod/ExtraTextures/AresArmTopPart2"); + Texture2D shoulderTexture = ModContent.Request("CalamityMod/ExtraTextures/AresArmTopShoulder"); + Texture2D armTexture1 = ModContent.Request("CalamityMod/ExtraTextures/AresArmTopPart1"); + Texture2D armSegmentTexture = ModContent.Request("CalamityMod/ExtraTextures/AresArmTopSegment"); + Texture2D armTexture2 = ModContent.Request("CalamityMod/ExtraTextures/AresArmTopPart2"); - Texture2D shoulderGlowmask = ModContent.GetTexture("CalamityMod/ExtraTextures/AresArmTopShoulderGlow"); - Texture2D armSegmentGlowmask = ModContent.GetTexture("CalamityMod/ExtraTextures/AresArmTopSegmentGlow"); - Texture2D armGlowmask2 = ModContent.GetTexture("CalamityMod/ExtraTextures/AresArmTopPart2Glow"); + Texture2D shoulderGlowmask = ModContent.Request("CalamityMod/ExtraTextures/AresArmTopShoulderGlow"); + Texture2D armSegmentGlowmask = ModContent.Request("CalamityMod/ExtraTextures/AresArmTopSegmentGlow"); + Texture2D armGlowmask2 = ModContent.Request("CalamityMod/ExtraTextures/AresArmTopPart2Glow"); - Vector2 shoulderDrawPosition = npc.Center + new Vector2(direction * 176f, -100f); + Vector2 shoulderDrawPosition = NPC.Center + new Vector2(direction * 176f, -100f); Vector2 arm1DrawPosition = shoulderDrawPosition + new Vector2(direction * (shoulderTexture.Width + 16f), 10f); Vector2 armSegmentDrawPosition = arm1DrawPosition; @@ -1107,14 +1108,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares arm2DrawPosition += (arm2Rotation - MathHelper.PiOver2).ToRotationVector2() * 14f; // Calculate colors. - Color shoulderLightColor = npc.GetAlpha(Lighting.GetColor((int)shoulderDrawPosition.X / 16, (int)shoulderDrawPosition.Y / 16)); - Color arm1LightColor = npc.GetAlpha(Lighting.GetColor((int)arm1DrawPosition.X / 16, (int)arm1DrawPosition.Y / 16)); - Color armSegmentLightColor = npc.GetAlpha(Lighting.GetColor((int)armSegmentDrawPosition.X / 16, (int)armSegmentDrawPosition.Y / 16)); - Color arm2LightColor = npc.GetAlpha(Lighting.GetColor((int)arm2DrawPosition.X / 16, (int)arm2DrawPosition.Y / 16)); - Color glowmaskAlphaColor = npc.GetAlpha(glowmaskColor); + Color shoulderLightColor = NPC.GetAlpha(Lighting.GetColor((int)shoulderDrawPosition.X / 16, (int)shoulderDrawPosition.Y / 16)); + Color arm1LightColor = NPC.GetAlpha(Lighting.GetColor((int)arm1DrawPosition.X / 16, (int)arm1DrawPosition.Y / 16)); + Color armSegmentLightColor = NPC.GetAlpha(Lighting.GetColor((int)armSegmentDrawPosition.X / 16, (int)armSegmentDrawPosition.Y / 16)); + Color arm2LightColor = NPC.GetAlpha(Lighting.GetColor((int)arm2DrawPosition.X / 16, (int)arm2DrawPosition.Y / 16)); + Color glowmaskAlphaColor = NPC.GetAlpha(glowmaskColor); // Draw electricity between arms. - if (npc.Opacity > 0f) + if (NPC.Opacity > 0f) { List arm2ElectricArcPoints = AresTeslaOrb.DetermineElectricArcPoints(armSegmentDrawPosition, arm2DrawPosition + arm2Rotation.ToRotationVector2() * -direction * 20f, 250290787); LightningBackgroundDrawer.Draw(arm2ElectricArcPoints, -Main.screenPosition, 90); @@ -1126,31 +1127,31 @@ namespace CalamityMod.NPCs.ExoMechs.Ares LightningDrawer.Draw(handElectricArcPoints, -Main.screenPosition, 90); } - shoulderDrawPosition += Vector2.UnitY * npc.gfxOffY - Main.screenPosition; - arm1DrawPosition += Vector2.UnitY * npc.gfxOffY - Main.screenPosition; - armSegmentDrawPosition += Vector2.UnitY * npc.gfxOffY - Main.screenPosition; - arm2DrawPosition += Vector2.UnitY * npc.gfxOffY - Main.screenPosition; + shoulderDrawPosition += Vector2.UnitY * NPC.gfxOffY - Main.screenPosition; + arm1DrawPosition += Vector2.UnitY * NPC.gfxOffY - Main.screenPosition; + armSegmentDrawPosition += Vector2.UnitY * NPC.gfxOffY - Main.screenPosition; + arm2DrawPosition += Vector2.UnitY * NPC.gfxOffY - Main.screenPosition; - spriteBatch.Draw(armTexture1, arm1DrawPosition, null, arm1LightColor, arm1Rotation, arm1Origin, npc.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); - spriteBatch.Draw(shoulderTexture, shoulderDrawPosition, shoulderFrame, shoulderLightColor, 0f, shoulderFrame.Size() * 0.5f, npc.scale, spriteDirection, 0f); - spriteBatch.Draw(shoulderGlowmask, shoulderDrawPosition, shoulderFrame, glowmaskAlphaColor, 0f, shoulderFrame.Size() * 0.5f, npc.scale, spriteDirection, 0f); - spriteBatch.Draw(armSegmentTexture, armSegmentDrawPosition, armSegmentFrame, armSegmentLightColor, armSegmentRotation, armSegmentFrame.Size() * 0.5f, npc.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); - spriteBatch.Draw(armSegmentGlowmask, armSegmentDrawPosition, armSegmentFrame, glowmaskAlphaColor, armSegmentRotation, armSegmentFrame.Size() * 0.5f, npc.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); - spriteBatch.Draw(armTexture2, arm2DrawPosition, arm2Frame, arm2LightColor, arm2Rotation, arm2Origin, npc.scale, spriteDirection ^ SpriteEffects.FlipVertically, 0f); - spriteBatch.Draw(armGlowmask2, arm2DrawPosition, arm2Frame, glowmaskAlphaColor, arm2Rotation, arm2Origin, npc.scale, spriteDirection ^ SpriteEffects.FlipVertically, 0f); + spriteBatch.Draw(armTexture1, arm1DrawPosition, null, arm1LightColor, arm1Rotation, arm1Origin, NPC.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); + spriteBatch.Draw(shoulderTexture, shoulderDrawPosition, shoulderFrame, shoulderLightColor, 0f, shoulderFrame.Size() * 0.5f, NPC.scale, spriteDirection, 0f); + spriteBatch.Draw(shoulderGlowmask, shoulderDrawPosition, shoulderFrame, glowmaskAlphaColor, 0f, shoulderFrame.Size() * 0.5f, NPC.scale, spriteDirection, 0f); + spriteBatch.Draw(armSegmentTexture, armSegmentDrawPosition, armSegmentFrame, armSegmentLightColor, armSegmentRotation, armSegmentFrame.Size() * 0.5f, NPC.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); + spriteBatch.Draw(armSegmentGlowmask, armSegmentDrawPosition, armSegmentFrame, glowmaskAlphaColor, armSegmentRotation, armSegmentFrame.Size() * 0.5f, NPC.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); + spriteBatch.Draw(armTexture2, arm2DrawPosition, arm2Frame, arm2LightColor, arm2Rotation, arm2Origin, NPC.scale, spriteDirection ^ SpriteEffects.FlipVertically, 0f); + spriteBatch.Draw(armGlowmask2, arm2DrawPosition, arm2Frame, glowmaskAlphaColor, arm2Rotation, arm2Origin, NPC.scale, spriteDirection ^ SpriteEffects.FlipVertically, 0f); } else { - Texture2D shoulderTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AresBottomArmShoulder"); - Texture2D connectorTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AresBottomArmConnector"); - Texture2D armTexture1 = ModContent.GetTexture("CalamityMod/ExtraTextures/AresBottomArmPart1"); - Texture2D armTexture2 = ModContent.GetTexture("CalamityMod/ExtraTextures/AresBottomArmPart2"); + Texture2D shoulderTexture = ModContent.Request("CalamityMod/ExtraTextures/AresBottomArmShoulder"); + Texture2D connectorTexture = ModContent.Request("CalamityMod/ExtraTextures/AresBottomArmConnector"); + Texture2D armTexture1 = ModContent.Request("CalamityMod/ExtraTextures/AresBottomArmPart1"); + Texture2D armTexture2 = ModContent.Request("CalamityMod/ExtraTextures/AresBottomArmPart2"); - Texture2D shoulderGlowmask = ModContent.GetTexture("CalamityMod/ExtraTextures/AresBottomArmShoulderGlow"); - Texture2D armTexture1Glowmask = ModContent.GetTexture("CalamityMod/ExtraTextures/AresBottomArmPart1Glow"); - Texture2D armTexture2Glowmask = ModContent.GetTexture("CalamityMod/ExtraTextures/AresBottomArmPart2Glow"); + Texture2D shoulderGlowmask = ModContent.Request("CalamityMod/ExtraTextures/AresBottomArmShoulderGlow"); + Texture2D armTexture1Glowmask = ModContent.Request("CalamityMod/ExtraTextures/AresBottomArmPart1Glow"); + Texture2D armTexture2Glowmask = ModContent.Request("CalamityMod/ExtraTextures/AresBottomArmPart2Glow"); - Vector2 shoulderDrawPosition = npc.Center + new Vector2(direction * 110f, -54f); + Vector2 shoulderDrawPosition = NPC.Center + new Vector2(direction * 110f, -54f); Vector2 connectorDrawPosition = shoulderDrawPosition + new Vector2(direction * 20f, 32f); Vector2 arm1DrawPosition = shoulderDrawPosition + Vector2.UnitX * direction * 20f; @@ -1170,13 +1171,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 arm2DrawPosition = arm1DrawPosition + arm2Rotation.ToRotationVector2() * direction * (armTexture2.Width + 16f) - Vector2.UnitY * 16f; // Calculate colors. - Color shoulderLightColor = npc.GetAlpha(Lighting.GetColor((int)shoulderDrawPosition.X / 16, (int)shoulderDrawPosition.Y / 16)); - Color arm1LightColor = npc.GetAlpha(Lighting.GetColor((int)arm1DrawPosition.X / 16, (int)arm1DrawPosition.Y / 16)); - Color arm2LightColor = npc.GetAlpha(Lighting.GetColor((int)arm2DrawPosition.X / 16, (int)arm2DrawPosition.Y / 16)); - Color glowmaskAlphaColor = npc.GetAlpha(glowmaskColor); + Color shoulderLightColor = NPC.GetAlpha(Lighting.GetColor((int)shoulderDrawPosition.X / 16, (int)shoulderDrawPosition.Y / 16)); + Color arm1LightColor = NPC.GetAlpha(Lighting.GetColor((int)arm1DrawPosition.X / 16, (int)arm1DrawPosition.Y / 16)); + Color arm2LightColor = NPC.GetAlpha(Lighting.GetColor((int)arm2DrawPosition.X / 16, (int)arm2DrawPosition.Y / 16)); + Color glowmaskAlphaColor = NPC.GetAlpha(glowmaskColor); // Draw electricity between arms. - if (npc.Opacity > 0f) + if (NPC.Opacity > 0f) { List arm2ElectricArcPoints = AresTeslaOrb.DetermineElectricArcPoints(arm1DrawPosition - arm2Rotation.ToRotationVector2() * direction * 10f, arm1DrawPosition + arm2Rotation.ToRotationVector2() * direction * 20f, 31416); LightningBackgroundDrawer.Draw(arm2ElectricArcPoints, -Main.screenPosition, 90); @@ -1188,18 +1189,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares LightningDrawer.Draw(handElectricArcPoints, -Main.screenPosition, 90); } - shoulderDrawPosition += Vector2.UnitY * npc.gfxOffY - Main.screenPosition; - connectorDrawPosition += Vector2.UnitY * npc.gfxOffY - Main.screenPosition; - arm1DrawPosition += Vector2.UnitY * npc.gfxOffY - Main.screenPosition; - arm2DrawPosition += Vector2.UnitY * npc.gfxOffY - Main.screenPosition; + shoulderDrawPosition += Vector2.UnitY * NPC.gfxOffY - Main.screenPosition; + connectorDrawPosition += Vector2.UnitY * NPC.gfxOffY - Main.screenPosition; + arm1DrawPosition += Vector2.UnitY * NPC.gfxOffY - Main.screenPosition; + arm2DrawPosition += Vector2.UnitY * NPC.gfxOffY - Main.screenPosition; - spriteBatch.Draw(shoulderTexture, shoulderDrawPosition, shoulderFrame, shoulderLightColor, arm1Rotation, shoulderFrame.Size() * 0.5f, npc.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); - spriteBatch.Draw(shoulderGlowmask, shoulderDrawPosition, shoulderFrame, glowmaskAlphaColor, arm1Rotation, shoulderFrame.Size() * 0.5f, npc.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); - spriteBatch.Draw(connectorTexture, connectorDrawPosition, null, shoulderLightColor, 0f, connectorTexture.Size() * 0.5f, npc.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); - spriteBatch.Draw(armTexture1, arm1DrawPosition, arm1Frame, arm1LightColor, arm1Rotation, arm1Origin, npc.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); - spriteBatch.Draw(armTexture1Glowmask, arm1DrawPosition, arm1Frame, glowmaskAlphaColor, arm1Rotation, arm1Origin, npc.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); - spriteBatch.Draw(armTexture2, arm2DrawPosition, arm2Frame, arm2LightColor, arm2Rotation, arm2Origin, npc.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); - spriteBatch.Draw(armTexture2Glowmask, arm2DrawPosition, arm2Frame, glowmaskAlphaColor, arm2Rotation, arm2Origin, npc.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); + spriteBatch.Draw(shoulderTexture, shoulderDrawPosition, shoulderFrame, shoulderLightColor, arm1Rotation, shoulderFrame.Size() * 0.5f, NPC.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); + spriteBatch.Draw(shoulderGlowmask, shoulderDrawPosition, shoulderFrame, glowmaskAlphaColor, arm1Rotation, shoulderFrame.Size() * 0.5f, NPC.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); + spriteBatch.Draw(connectorTexture, connectorDrawPosition, null, shoulderLightColor, 0f, connectorTexture.Size() * 0.5f, NPC.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); + spriteBatch.Draw(armTexture1, arm1DrawPosition, arm1Frame, arm1LightColor, arm1Rotation, arm1Origin, NPC.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); + spriteBatch.Draw(armTexture1Glowmask, arm1DrawPosition, arm1Frame, glowmaskAlphaColor, arm1Rotation, arm1Origin, NPC.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); + spriteBatch.Draw(armTexture2, arm2DrawPosition, arm2Frame, arm2LightColor, arm2Rotation, arm2Origin, NPC.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); + spriteBatch.Draw(armTexture2Glowmask, arm2DrawPosition, arm2Frame, glowmaskAlphaColor, arm2Rotation, arm2Origin, NPC.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); } } @@ -1254,7 +1255,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Mark Exo Mechs as dead and drop loot else - DropExoMechLoot(npc, (int)MechType.Ares); + DropExoMechLoot(NPC, (int)MechType.Ares); } public static void DropExoMechLoot(NPC npc, int mechType) @@ -1357,31 +1358,31 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody5"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody6"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresBody7"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresBody1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresBody2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresBody3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresBody4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresBody5"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresBody6"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresBody7"), 1f); } } @@ -1389,8 +1390,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * 0.8f); } } } diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 5a0e0d0336..60d221c4d8 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -11,6 +11,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.ExoMechs.Ares { @@ -25,13 +26,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public float AIState { - get => npc.Calamity().newAI[0]; - set => npc.Calamity().newAI[0] = value; + get => NPC.Calamity().newAI[0]; + set => NPC.Calamity().newAI[0] = value; } public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); public AresCannonChargeParticleSet EnergyDrawer = new AresCannonChargeParticleSet(-1, 15, 40f, Color.Yellow); - public Vector2 CoreSpritePosition => npc.Center + npc.spriteDirection * npc.rotation.ToRotationVector2() * 35f + (npc.rotation + MathHelper.PiOver2).ToRotationVector2() * 5f; + public Vector2 CoreSpritePosition => NPC.Center + NPC.spriteDirection * NPC.rotation.ToRotationVector2() * 35f + (NPC.rotation + MathHelper.PiOver2).ToRotationVector2() * 5f; // Number of frames on the X and Y axis private const int maxFramesX = 9; @@ -60,68 +61,68 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void SetStaticDefaults() { DisplayName.SetDefault("XF-09 Ares Gauss Nuke"); - NPCID.Sets.TrailingMode[npc.type] = 3; - NPCID.Sets.TrailCacheLength[npc.type] = npc.oldPos.Length; + NPCID.Sets.TrailingMode[NPC.type] = 3; + NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; } public override void SetDefaults() { - npc.npcSlots = 5f; - npc.damage = 100; - npc.width = 170; - npc.height = 120; - npc.defense = 80; - npc.DR_NERD(0.35f); - npc.LifeMaxNERB(1250000, 1495000, 500000); + NPC.npcSlots = 5f; + NPC.damage = 100; + NPC.width = 170; + NPC.height = 120; + NPC.defense = 80; + NPC.DR_NERD(0.35f); + NPC.LifeMaxNERB(1250000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.Opacity = 0f; - npc.knockBackResist = 0f; - npc.canGhostHeal = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; - npc.hide = true; + NPC.Opacity = 0f; + NPC.knockBackResist = 0f; + NPC.canGhostHeal = false; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.boss = true; + NPC.hide = true; music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(frameX); writer.Write(frameY); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + NPC.frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; return; } @@ -181,34 +182,34 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Target variable Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; - CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity(); + CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)NPC.ai[2]].Calamity(); // Passive phase check bool passivePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.Passive; // Enrage check - bool enraged = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes; + bool enraged = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes; // Adjust opacity bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = invisiblePhase; + NPC.dontTakeDamage = invisiblePhase; if (!invisiblePhase) { - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } else { - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } // Predictiveness @@ -219,7 +220,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares predictionAmt *= 0.5f; Vector2 predictionVector = player.velocity * predictionAmt; - Vector2 rotationVector = player.Center + predictionVector - npc.Center; + Vector2 rotationVector = player.Center + predictionVector - NPC.Center; float projectileVelocity = passivePhase ? 9.6f : 12f; if (lastMechAlive) @@ -231,32 +232,32 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 lookAt = Vector2.Normalize(rotationVector) * projectileVelocity; float rotation = (float)Math.Atan2(lookAt.Y, lookAt.X); - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) rotation += MathHelper.Pi; if (rotation < 0f) rotation += MathHelper.TwoPi; if (rotation > MathHelper.TwoPi) rotation -= MathHelper.TwoPi; - npc.rotation = npc.rotation.AngleTowards(rotation, rateOfRotation); + NPC.rotation = NPC.rotation.AngleTowards(rotation, rateOfRotation); // Direction - int direction = Math.Sign(player.Center.X - npc.Center.X); + int direction = Math.Sign(player.Center.X - NPC.Center.X); if (direction != 0) { - npc.direction = direction; + NPC.direction = direction; - if (npc.spriteDirection != -npc.direction) - npc.rotation += MathHelper.Pi; + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } // Light if (enraged) - Lighting.AddLight(npc.Center, 0.5f * npc.Opacity, 0f, 0f); + Lighting.AddLight(NPC.Center, 0.5f * NPC.Opacity, 0f, 0f); else - Lighting.AddLight(npc.Center, 0.2f * npc.Opacity, 0.25f * npc.Opacity, 0.05f * npc.Opacity); + Lighting.AddLight(NPC.Center, 0.2f * NPC.Opacity, 0.25f * NPC.Opacity, 0.05f * NPC.Opacity); // Despawn if target is dead if (player.dead) @@ -267,17 +268,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIState = (float)Phase.Nothing; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; - npc.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 1f; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) + NPC.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || @@ -315,9 +316,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Velocity and acceleration values float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult; - baseVelocity *= 1f + Main.npc[(int)npc.ai[2]].localAI[2]; + baseVelocity *= 1f + Main.npc[(int)NPC.ai[2]].localAI[2]; - Vector2 distanceFromDestination = destination - npc.Center; + Vector2 distanceFromDestination = destination - NPC.Center; // Distance where Ares Nuke Arm stops moving float movementDistanceGateValue = 50f; @@ -345,14 +346,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (enraged) { SmokeDrawer.ParticleSpawnRate = AresBody.ventCloudSpawnRate; - SmokeDrawer.BaseMoveRotation = npc.rotation + MathHelper.Pi; + SmokeDrawer.BaseMoveRotation = NPC.rotation + MathHelper.Pi; SmokeDrawer.SpawnAreaCompactness = 40f; // Increase DR during enrage - npc.Calamity().DR = 0.85f; + NPC.Calamity().DR = 0.85f; } else - npc.Calamity().DR = 0.35f; + NPC.Calamity().DR = 0.35f; SmokeDrawer.Update(); @@ -383,7 +384,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (calamityGlobalNPC.newAI[2] == 1f) { // Reset the frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // X = 1 sets to frame 12 frameX = 1; @@ -399,15 +400,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), NPC.Center); Vector2 gaussNukeVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float offset = 40f; - Projectile.NewProjectile(npc.Center + Vector2.Normalize(gaussNukeVelocity) * offset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + Projectile.NewProjectile(NPC.Center + Vector2.Normalize(gaussNukeVelocity) * offset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); // Recoil - npc.velocity -= gaussNukeVelocity; + NPC.velocity -= gaussNukeVelocity; } } @@ -423,7 +424,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] = 0f; // Reset the frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // X = 1 sets to frame 48 frameX = 4; @@ -456,7 +457,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares EnergyDrawer.Update(); // Smooth movement towards the location Ares Gauss Nuke is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; @@ -464,14 +465,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void FindFrame(int frameHeight) { // Use telegraph frames when using gauss nuke - npc.frameCounter += 1D; - double frameTime = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? 3D : 6D; + NPC.frameCounter += 1D; + double frameTime = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? 3D : 6D; if (AIState == (float)Phase.Nothing) { - if (npc.frameCounter >= frameTime) + if (NPC.frameCounter >= frameTime) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -490,10 +491,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } else { - if (npc.frameCounter >= frameTime) + if (NPC.frameCounter >= frameTime) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -515,16 +516,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { // Draw the enrage smoke behind Ares - SmokeDrawer.DrawSet(npc.Center); + SmokeDrawer.DrawSet(NPC.Center); SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Main.npcTexture[npc.type]; - Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); - Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); - Color afterimageBaseColor = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; + Texture2D texture = Main.npcTexture[NPC.type]; + Rectangle frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); + Vector2 vector = new Vector2(NPC.width / 2, NPC.height / 2); + Color afterimageBaseColor = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; if (CalamityConfig.Instance.Afterimages) @@ -533,25 +534,25 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { Color afterimageColor = drawColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * NPC.scale / 2f; + afterimageCenter += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, NPC.frame, afterimageColor, NPC.oldRot[i], vector, NPC.scale, spriteEffects, 0f); } } - Vector2 center = npc.Center - Main.screenPosition; + Vector2 center = NPC.Center - Main.screenPosition; - float telegraphDuration = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? (gaussNukeTelegraphDuration * 0.5f) : gaussNukeTelegraphDuration; + float telegraphDuration = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? (gaussNukeTelegraphDuration * 0.5f) : gaussNukeTelegraphDuration; //Draw an outline to the arm when it charges up - if ((npc.Calamity().newAI[2] < telegraphDuration) && AIState == (float)Phase.GaussNuke) + if ((NPC.Calamity().newAI[2] < telegraphDuration) && AIState == (float)Phase.GaussNuke) { CalamityUtils.EnterShaderRegion(spriteBatch); - Color outlineColor = Color.Lerp(Color.Yellow, Color.White, npc.Calamity().newAI[2] / telegraphDuration); + Color outlineColor = Color.Lerp(Color.Yellow, Color.White, NPC.Calamity().newAI[2] / telegraphDuration); Vector3 outlineHSL = Main.rgbToHsl(outlineColor); //BasicTint uses the opposite hue i guess? or smth is fucked with the way shaders get their colors. anyways, we invert it - float outlineThickness = MathHelper.Clamp(npc.Calamity().newAI[2] / telegraphDuration * 4f, 0f, 3f); + float outlineThickness = MathHelper.Clamp(NPC.Calamity().newAI[2] / telegraphDuration * 4f, 0f, 3f); GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1 - outlineHSL.X, outlineHSL.Y, outlineHSL.Z)); @@ -559,14 +560,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares for (float i = 0; i < 1; i += 0.125f) { - spriteBatch.Draw(texture, center + (i * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * outlineThickness, frame, outlineColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center + (i * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * outlineThickness, frame, outlineColor, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); } CalamityUtils.ExitShaderRegion(spriteBatch); } - spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Ares/AresGaussNukeGlow"); + Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresGaussNukeGlow"); if (CalamityConfig.Instance.Afterimages) { @@ -574,29 +575,29 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { Color afterimageColor = drawColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(glowTexture.Width, glowTexture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(glowTexture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(glowTexture.Width, glowTexture.Height) / new Vector2(maxFramesX, maxFramesY) * NPC.scale / 2f; + afterimageCenter += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(glowTexture, afterimageCenter, NPC.frame, afterimageColor, NPC.oldRot[i], vector, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture, center, frame, afterimageBaseColor * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, frame, afterimageBaseColor * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters //Draw a pulsing version of the cannon above the real one - if ((npc.Calamity().newAI[2] < telegraphDuration) && AIState == (float)Phase.GaussNuke) + if ((NPC.Calamity().newAI[2] < telegraphDuration) && AIState == (float)Phase.GaussNuke) { - float pulseRatio = (npc.Calamity().newAI[2] % (telegraphDuration / 5f)) / (telegraphDuration / 5f); - float pulseSize = MathHelper.Lerp(0.1f, 0.6f, (float)Math.Floor(npc.Calamity().newAI[2] / (telegraphDuration / 5f)) / 4f); - float pulseOpacity = MathHelper.Clamp((float)Math.Floor(npc.Calamity().newAI[2] / (telegraphDuration / 5f)) * 0.3f, 1f, 2f); - spriteBatch.Draw(texture, center, frame, Color.Yellow * MathHelper.Lerp(1f, 0f, pulseRatio) * pulseOpacity, npc.rotation, vector, npc.scale + pulseRatio * pulseSize, spriteEffects, 0f); + float pulseRatio = (NPC.Calamity().newAI[2] % (telegraphDuration / 5f)) / (telegraphDuration / 5f); + float pulseSize = MathHelper.Lerp(0.1f, 0.6f, (float)Math.Floor(NPC.Calamity().newAI[2] / (telegraphDuration / 5f)) / 4f); + float pulseOpacity = MathHelper.Clamp((float)Math.Floor(NPC.Calamity().newAI[2] / (telegraphDuration / 5f)) * 0.3f, 1f, 2f); + spriteBatch.Draw(texture, center, frame, Color.Yellow * MathHelper.Lerp(1f, 0f, pulseRatio) * pulseOpacity, NPC.rotation, vector, NPC.scale + pulseRatio * pulseSize, spriteEffects, 0f); //Draw the bloom EnergyDrawer.DrawBloom(CoreSpritePosition); @@ -622,30 +623,30 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresGaussNuke1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresGaussNuke2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresGaussNuke3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresGaussNuke1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresGaussNuke2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresGaussNuke3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresHandBase1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresHandBase2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresHandBase3"), 1f); } } @@ -653,8 +654,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * 0.8f); } } } diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 28d8eee726..7f425ee7e3 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -11,6 +11,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.ExoMechs.Ares { @@ -24,13 +25,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public float AIState { - get => npc.Calamity().newAI[0]; - set => npc.Calamity().newAI[0] = value; + get => NPC.Calamity().newAI[0]; + set => NPC.Calamity().newAI[0] = value; } public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); public AresCannonChargeParticleSet EnergyDrawer = new AresCannonChargeParticleSet(-1, 15, 40f, Color.OrangeRed); - public Vector2 CoreSpritePosition => npc.Center + npc.spriteDirection * npc.rotation.ToRotationVector2() * 30f + (npc.rotation + MathHelper.PiOver2).ToRotationVector2() * 15f; + public Vector2 CoreSpritePosition => NPC.Center + NPC.spriteDirection * NPC.rotation.ToRotationVector2() * 30f + (NPC.rotation + MathHelper.PiOver2).ToRotationVector2() * 15f; // Number of frames on the X and Y axis private const int maxFramesX = 6; @@ -58,68 +59,68 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void SetStaticDefaults() { DisplayName.SetDefault("XF-09 Ares Laser Cannon"); - NPCID.Sets.TrailingMode[npc.type] = 3; - NPCID.Sets.TrailCacheLength[npc.type] = npc.oldPos.Length; + NPCID.Sets.TrailingMode[NPC.type] = 3; + NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; } public override void SetDefaults() { - npc.npcSlots = 5f; - npc.damage = 100; - npc.width = 154; - npc.height = 90; - npc.defense = 80; - npc.DR_NERD(0.35f); - npc.LifeMaxNERB(1250000, 1495000, 500000); + NPC.npcSlots = 5f; + NPC.damage = 100; + NPC.width = 154; + NPC.height = 90; + NPC.defense = 80; + NPC.DR_NERD(0.35f); + NPC.LifeMaxNERB(1250000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.Opacity = 0f; - npc.knockBackResist = 0f; - npc.canGhostHeal = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; - npc.hide = true; + NPC.Opacity = 0f; + NPC.knockBackResist = 0f; + NPC.canGhostHeal = false; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.boss = true; + NPC.hide = true; music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(frameX); writer.Write(frameY); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + NPC.frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; return; } @@ -179,34 +180,34 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Target variable Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; - CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity(); + CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)NPC.ai[2]].Calamity(); // Passive phase check bool passivePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.Passive; // Enrage check - bool enraged = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes; + bool enraged = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes; // Adjust opacity bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = invisiblePhase; + NPC.dontTakeDamage = invisiblePhase; if (!invisiblePhase) { - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } else { - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } // Variable to fire normal lasers @@ -242,35 +243,35 @@ namespace CalamityMod.NPCs.ExoMechs.Ares bool horizontalLaserSweep = calamityGlobalNPC.newAI[3] == 0f; float rateOfRotation = AIState == (int)Phase.Deathray ? 0.08f : 0.04f; float lookAtX = flyLeft ? 1000f : -1000f; - Vector2 lookAt = AIState == (int)Phase.Deathray && !fireNormalLasers ? (horizontalLaserSweep ? new Vector2(npc.Center.X, npc.Center.Y + 1000f) : new Vector2(npc.Center.X + lookAtX, npc.Center.Y)) : player.Center; + Vector2 lookAt = AIState == (int)Phase.Deathray && !fireNormalLasers ? (horizontalLaserSweep ? new Vector2(NPC.Center.X, NPC.Center.Y + 1000f) : new Vector2(NPC.Center.X + lookAtX, NPC.Center.Y)) : player.Center; - float rotation = (float)Math.Atan2(lookAt.Y - npc.Center.Y, lookAt.X - npc.Center.X); - if (npc.spriteDirection == 1) + float rotation = (float)Math.Atan2(lookAt.Y - NPC.Center.Y, lookAt.X - NPC.Center.X); + if (NPC.spriteDirection == 1) rotation += MathHelper.Pi; if (rotation < 0f) rotation += MathHelper.TwoPi; if (rotation > MathHelper.TwoPi) rotation -= MathHelper.TwoPi; - npc.rotation = npc.rotation.AngleTowards(rotation, rateOfRotation); + NPC.rotation = NPC.rotation.AngleTowards(rotation, rateOfRotation); // Direction - int direction = Math.Sign(((AIState == (int)Phase.Deathray && !horizontalLaserSweep) || fireNormalLasers ? lookAt.X : player.Center.X) - npc.Center.X); + int direction = Math.Sign(((AIState == (int)Phase.Deathray && !horizontalLaserSweep) || fireNormalLasers ? lookAt.X : player.Center.X) - NPC.Center.X); if (direction != 0) { - npc.direction = direction; + NPC.direction = direction; - if (npc.spriteDirection != -npc.direction) - npc.rotation += MathHelper.Pi; + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } // Light if (enraged) - Lighting.AddLight(npc.Center, 0.5f * npc.Opacity, 0f, 0f); + Lighting.AddLight(NPC.Center, 0.5f * NPC.Opacity, 0f, 0f); else - Lighting.AddLight(npc.Center, 0.25f * npc.Opacity, 0.1f * npc.Opacity, 0.1f * npc.Opacity); + Lighting.AddLight(NPC.Center, 0.25f * NPC.Opacity, 0.1f * NPC.Opacity, 0.1f * NPC.Opacity); // Despawn if target is dead if (player.dead) @@ -281,17 +282,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIState = (float)Phase.Nothing; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; - npc.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 1f; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) + NPC.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || @@ -307,15 +308,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Velocity and acceleration values float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult; - baseVelocity *= 1f + Main.npc[(int)npc.ai[2]].localAI[2]; + baseVelocity *= 1f + Main.npc[(int)NPC.ai[2]].localAI[2]; float baseAcceleration = shouldGetBuffedByBerserkPhase ? 1.25f : 1f; - Vector2 distanceFromDestination = destination - npc.Center; + Vector2 distanceFromDestination = destination - NPC.Center; Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination) * baseVelocity; // Whether Ares Laser Arm should move to its spot or not float movementDistanceGateValue = 50f; - bool moveToLocation = Vector2.Distance(npc.Center, destination) > movementDistanceGateValue; + bool moveToLocation = Vector2.Distance(NPC.Center, destination) > movementDistanceGateValue; // Gate values float deathrayPhaseGateValue = 450f; @@ -333,7 +334,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares deathrayPhaseVelocity *= 1.1f; // If Laser Cannon can fire normal lasers, cannot fire if too close to the target and in deathray spiral phase - bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f || !fireNormalLasers; + bool canFire = Vector2.Distance(NPC.Center, player.Center) > 320f || !fireNormalLasers; // Telegraph duration for deathray spiral float deathraySpiralTelegraphDuration = malice ? AresBody.deathrayTelegraphDuration_Malice : death ? AresBody.deathrayTelegraphDuration_Death : @@ -356,14 +357,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (enraged) { SmokeDrawer.ParticleSpawnRate = AresBody.ventCloudSpawnRate; - SmokeDrawer.BaseMoveRotation = npc.rotation + MathHelper.Pi; + SmokeDrawer.BaseMoveRotation = NPC.rotation + MathHelper.Pi; SmokeDrawer.SpawnAreaCompactness = 40f; // Increase DR during enrage - npc.Calamity().DR = 0.85f; + NPC.Calamity().DR = 0.85f; } else - npc.Calamity().DR = 0.35f; + NPC.Calamity().DR = 0.35f; SmokeDrawer.Update(); @@ -375,7 +376,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares case (int)Phase.Nothing: // Smooth movement towards the location Ares Laser Cannon is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); calamityGlobalNPC.newAI[1] += 1f; if (calamityGlobalNPC.newAI[1] >= deathrayPhaseGateValue) @@ -394,16 +395,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { // Play a charge up sound so that the player knows when it's about to fire the deathray if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration - 100f && !fireNormalLasers) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"), NPC.Center); // Smooth movement towards the location Ares Laser Cannon is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); // Set frames to deathray charge up frames, which begin on frame 12 if (calamityGlobalNPC.newAI[2] == 1f) { // Reset the frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // X = 1 sets to frame 8 frameX = 1; @@ -422,7 +423,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (fireNormalLasers) { // Smooth movement towards the location Ares Laser Cannon is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); // Fire Thanatos lasers int numLasers = enraged ? 9 : lastMechAlive ? 3 : 2; @@ -433,11 +434,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); - Vector2 laserVelocity = Vector2.Normalize(player.Center - npc.Center); + int damage = NPC.GetProjectileDamage(type); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), NPC.Center); + Vector2 laserVelocity = Vector2.Normalize(player.Center - NPC.Center); Vector2 offset = laserVelocity * 70f + Vector2.UnitY * 16f; - Projectile.NewProjectile(npc.Center + offset, player.Center, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(NPC.Center + offset, player.Center, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -451,12 +452,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares else desiredVelocity.Y = 0f; - npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); + NPC.SimpleFlyMovement(desiredVelocity, baseAcceleration); float velocityX = flyLeft ? deathrayPhaseVelocity : -deathrayPhaseVelocity; - npc.velocity = horizontalLaserSweep ? new Vector2(velocityX, npc.velocity.Y) : new Vector2(npc.velocity.X, deathrayPhaseVelocity * 0.75f); + NPC.velocity = horizontalLaserSweep ? new Vector2(velocityX, NPC.velocity.Y) : new Vector2(NPC.velocity.X, deathrayPhaseVelocity * 0.75f); - npc.netUpdate = true; - npc.netSpam -= 5; + NPC.netUpdate = true; + NPC.netSpam -= 5; // Fire deathray if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) @@ -464,16 +465,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float offset = 84f; float offset2 = 16f; - Vector2 source = horizontalLaserSweep ? new Vector2(npc.Center.X - offset2 * npc.direction, npc.Center.Y + offset) : new Vector2(npc.Center.X + offset * npc.direction, npc.Center.Y + offset2); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), source); + Vector2 source = horizontalLaserSweep ? new Vector2(NPC.Center.X - offset2 * NPC.direction, NPC.Center.Y + offset) : new Vector2(NPC.Center.X + offset * NPC.direction, NPC.Center.Y + offset2); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), source); Vector2 laserVelocity = Vector2.Normalize(lookAt - source); if (laserVelocity.HasNaNs()) laserVelocity = -Vector2.UnitY; - Projectile.NewProjectile(source, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(source, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -508,13 +509,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void FindFrame(int frameHeight) { // Use telegraph frames when using deathrays - npc.frameCounter += 1D; + NPC.frameCounter += 1D; if (AIState == (float)Phase.Nothing) { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -533,10 +534,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } else { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -558,16 +559,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { // Draw the enrage smoke behind Ares - SmokeDrawer.DrawSet(npc.Center); + SmokeDrawer.DrawSet(NPC.Center); SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Main.npcTexture[npc.type]; - Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); - Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); - Color afterimageBaseColor = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; + Texture2D texture = Main.npcTexture[NPC.type]; + Rectangle frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); + Vector2 vector = new Vector2(NPC.width / 2, NPC.height / 2); + Color afterimageBaseColor = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; if (CalamityConfig.Instance.Afterimages) @@ -576,24 +577,24 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { Color afterimageColor = drawColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * NPC.scale / 2f; + afterimageCenter += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, NPC.frame, afterimageColor, NPC.oldRot[i], vector, NPC.scale, spriteEffects, 0f); } } - Vector2 center = npc.Center - Main.screenPosition; + Vector2 center = NPC.Center - Main.screenPosition; //Draw an outline to the arm when it charges up - if ((npc.Calamity().newAI[2] < deathrayTelegraphDuration) && AIState == (float)Phase.Deathray) + if ((NPC.Calamity().newAI[2] < deathrayTelegraphDuration) && AIState == (float)Phase.Deathray) { CalamityUtils.EnterShaderRegion(spriteBatch); - Color outlineColor = Color.Lerp(Color.OrangeRed, Color.White, npc.Calamity().newAI[2] / deathrayTelegraphDuration); + Color outlineColor = Color.Lerp(Color.OrangeRed, Color.White, NPC.Calamity().newAI[2] / deathrayTelegraphDuration); Vector3 outlineHSL = Main.rgbToHsl(outlineColor); //BasicTint uses the opposite hue i guess? or smth is fucked with the way shaders get their colors. anyways, we invert it - float outlineThickness = MathHelper.Clamp(npc.Calamity().newAI[2] / deathrayTelegraphDuration * 4f, 0f, 3f); + float outlineThickness = MathHelper.Clamp(NPC.Calamity().newAI[2] / deathrayTelegraphDuration * 4f, 0f, 3f); GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1 - outlineHSL.X, outlineHSL.Y, outlineHSL.Z)); @@ -601,14 +602,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares for (float i = 0; i < 1; i += 0.125f) { - spriteBatch.Draw(texture, center + (i * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * outlineThickness, frame, outlineColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center + (i * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * outlineThickness, frame, outlineColor, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); } CalamityUtils.ExitShaderRegion(spriteBatch); } - spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Ares/AresLaserCannonGlow"); + Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresLaserCannonGlow"); if (CalamityConfig.Instance.Afterimages) { @@ -616,16 +617,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { Color afterimageColor = drawColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(glowTexture.Width, glowTexture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(glowTexture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(glowTexture.Width, glowTexture.Height) / new Vector2(maxFramesX, maxFramesY) * NPC.scale / 2f; + afterimageCenter += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(glowTexture, afterimageCenter, NPC.frame, afterimageColor, NPC.oldRot[i], vector, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(glowTexture, center, frame, afterimageBaseColor * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(glowTexture, center, frame, afterimageBaseColor * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -634,17 +635,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares //Draw a pulsing version of the cannon above the real one. - if ((npc.Calamity().newAI[2] < deathrayTelegraphDuration) && AIState == (float)Phase.Deathray) + if ((NPC.Calamity().newAI[2] < deathrayTelegraphDuration) && AIState == (float)Phase.Deathray) { //Also draw a telegraph line aha - Texture2D lineTex = ModContent.GetTexture("CalamityMod/Particles/BloomLine"); - Color outlineColor = Color.Lerp(Color.OrangeRed, Color.White, npc.Calamity().newAI[2] / deathrayTelegraphDuration); - spriteBatch.Draw(lineTex, CoreSpritePosition - npc.rotation.ToRotationVector2() * npc.spriteDirection * 104 - Main.screenPosition, null, outlineColor, npc.rotation - MathHelper.PiOver2 * npc.spriteDirection, new Vector2(lineTex.Width / 2f, lineTex.Height), new Vector2(1f * npc.Calamity().newAI[2] / deathrayTelegraphDuration, 2000f), spriteEffects, 0f); + Texture2D lineTex = ModContent.Request("CalamityMod/Particles/BloomLine"); + Color outlineColor = Color.Lerp(Color.OrangeRed, Color.White, NPC.Calamity().newAI[2] / deathrayTelegraphDuration); + spriteBatch.Draw(lineTex, CoreSpritePosition - NPC.rotation.ToRotationVector2() * NPC.spriteDirection * 104 - Main.screenPosition, null, outlineColor, NPC.rotation - MathHelper.PiOver2 * NPC.spriteDirection, new Vector2(lineTex.Width / 2f, lineTex.Height), new Vector2(1f * NPC.Calamity().newAI[2] / deathrayTelegraphDuration, 2000f), spriteEffects, 0f); - float pulseRatio = (npc.Calamity().newAI[2] % (deathrayTelegraphDuration / 5f)) / (deathrayTelegraphDuration / 5f); - float pulseSize = MathHelper.Lerp(0.1f, 0.6f, (float)Math.Floor(npc.Calamity().newAI[2] / (deathrayTelegraphDuration / 5f)) / 4f); - float pulseOpacity = MathHelper.Clamp((float)Math.Floor(npc.Calamity().newAI[2] / (deathrayTelegraphDuration / 5f)) * 0.3f, 1f, 2f); - spriteBatch.Draw(texture, center, frame, Color.OrangeRed * MathHelper.Lerp(1f, 0f, pulseRatio) * pulseOpacity, npc.rotation, vector, npc.scale + pulseRatio * pulseSize, spriteEffects, 0f); + float pulseRatio = (NPC.Calamity().newAI[2] % (deathrayTelegraphDuration / 5f)) / (deathrayTelegraphDuration / 5f); + float pulseSize = MathHelper.Lerp(0.1f, 0.6f, (float)Math.Floor(NPC.Calamity().newAI[2] / (deathrayTelegraphDuration / 5f)) / 4f); + float pulseOpacity = MathHelper.Clamp((float)Math.Floor(NPC.Calamity().newAI[2] / (deathrayTelegraphDuration / 5f)) * 0.3f, 1f, 2f); + spriteBatch.Draw(texture, center, frame, Color.OrangeRed * MathHelper.Lerp(1f, 0f, pulseRatio) * pulseOpacity, NPC.rotation, vector, NPC.scale + pulseRatio * pulseSize, spriteEffects, 0f); //Draw the bloom EnergyDrawer.DrawBloom(CoreSpritePosition); @@ -670,29 +671,29 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresLaserCannon1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresLaserCannon2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresLaserCannon1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresLaserCannon2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresHandBase1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresHandBase2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresHandBase3"), 1f); } } @@ -700,8 +701,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * 0.8f); } } } diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index 5c36e1db2c..35a07751e1 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -11,6 +11,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.ExoMechs.Ares { @@ -24,13 +25,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public float AIState { - get => npc.Calamity().newAI[0]; - set => npc.Calamity().newAI[0] = value; + get => NPC.Calamity().newAI[0]; + set => NPC.Calamity().newAI[0] = value; } public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); public AresCannonChargeParticleSet EnergyDrawer = new AresCannonChargeParticleSet(-1, 15, 40f, Color.GreenYellow); - public Vector2 CoreSpritePosition => npc.Center + npc.spriteDirection * npc.rotation.ToRotationVector2() * 30f + (npc.rotation + MathHelper.PiOver2).ToRotationVector2() * 15f; + public Vector2 CoreSpritePosition => NPC.Center + NPC.spriteDirection * NPC.rotation.ToRotationVector2() * 30f + (NPC.rotation + MathHelper.PiOver2).ToRotationVector2() * 15f; // Number of frames on the X and Y axis private const int maxFramesX = 6; @@ -58,70 +59,70 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void SetStaticDefaults() { DisplayName.SetDefault("XF-09 Ares Plasma Cannon"); - NPCID.Sets.TrailingMode[npc.type] = 3; - NPCID.Sets.TrailCacheLength[npc.type] = npc.oldPos.Length; + NPCID.Sets.TrailingMode[NPC.type] = 3; + NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; } public override void SetDefaults() { - npc.npcSlots = 5f; - npc.damage = 100; - npc.width = 152; - npc.height = 90; - npc.defense = 80; - npc.DR_NERD(0.35f); - npc.LifeMaxNERB(1250000, 1495000, 500000); + NPC.npcSlots = 5f; + NPC.damage = 100; + NPC.width = 152; + NPC.height = 90; + NPC.defense = 80; + NPC.DR_NERD(0.35f); + NPC.LifeMaxNERB(1250000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.Opacity = 0f; - npc.knockBackResist = 0f; - npc.canGhostHeal = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; - npc.hide = true; + NPC.Opacity = 0f; + NPC.knockBackResist = 0f; + NPC.canGhostHeal = false; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.boss = true; + NPC.hide = true; music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(frameX); writer.Write(frameY); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - CalamityGlobalNPC.draedonExoMechPrimePlasmaCannon = npc.whoAmI; + CalamityGlobalNPC.draedonExoMechPrimePlasmaCannon = NPC.whoAmI; - npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + NPC.frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; return; } @@ -181,34 +182,34 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Target variable Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; - CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity(); + CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)NPC.ai[2]].Calamity(); // Passive phase check bool passivePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.Passive; // Enrage check - bool enraged = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes; + bool enraged = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes; // Adjust opacity bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = invisiblePhase; + NPC.dontTakeDamage = invisiblePhase; if (!invisiblePhase) { - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } else { - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } // Predictiveness @@ -219,7 +220,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares predictionAmt *= 0.5f; Vector2 predictionVector = player.velocity * predictionAmt; - Vector2 rotationVector = player.Center + predictionVector - npc.Center; + Vector2 rotationVector = player.Center + predictionVector - NPC.Center; float projectileVelocity = passivePhase ? 9.6f : 12f; if (lastMechAlive) @@ -231,32 +232,32 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 lookAt = Vector2.Normalize(rotationVector) * projectileVelocity; float rotation = (float)Math.Atan2(lookAt.Y, lookAt.X); - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) rotation += MathHelper.Pi; if (rotation < 0f) rotation += MathHelper.TwoPi; if (rotation > MathHelper.TwoPi) rotation -= MathHelper.TwoPi; - npc.rotation = npc.rotation.AngleTowards(rotation, rateOfRotation); + NPC.rotation = NPC.rotation.AngleTowards(rotation, rateOfRotation); // Direction - int direction = Math.Sign(player.Center.X - npc.Center.X); + int direction = Math.Sign(player.Center.X - NPC.Center.X); if (direction != 0) { - npc.direction = direction; + NPC.direction = direction; - if (npc.spriteDirection != -npc.direction) - npc.rotation += MathHelper.Pi; + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } // Light if (enraged) - Lighting.AddLight(npc.Center, 0.5f * npc.Opacity, 0f, 0f); + Lighting.AddLight(NPC.Center, 0.5f * NPC.Opacity, 0f, 0f); else - Lighting.AddLight(npc.Center, 0.1f * npc.Opacity, 0.25f * npc.Opacity, 0.05f * npc.Opacity); + Lighting.AddLight(NPC.Center, 0.1f * NPC.Opacity, 0.25f * NPC.Opacity, 0.05f * NPC.Opacity); // Gate values bool fireMoreBolts = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays; @@ -280,17 +281,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIState = (float)Phase.Nothing; calamityGlobalNPC.newAI[1] = setTimerTo; calamityGlobalNPC.newAI[2] = 0f; - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; - npc.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 1f; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) + NPC.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || @@ -328,9 +329,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Velocity and acceleration values float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult; - baseVelocity *= 1f + Main.npc[(int)npc.ai[2]].localAI[2]; + baseVelocity *= 1f + Main.npc[(int)NPC.ai[2]].localAI[2]; - Vector2 distanceFromDestination = destination - npc.Center; + Vector2 distanceFromDestination = destination - NPC.Center; // Distance where Ares Plasma Arm stops moving float movementDistanceGateValue = 50f; @@ -339,7 +340,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares bool boltsSplitLess = fireMoreBolts && !lastMechAlive; // If Plasma Cannon can fire projectiles, cannot fire if too close to the target and in deathray spiral phase - bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f || calamityGlobalNPC_Body.newAI[0] != (float)AresBody.Phase.Deathrays; + bool canFire = Vector2.Distance(NPC.Center, player.Center) > 320f || calamityGlobalNPC_Body.newAI[0] != (float)AresBody.Phase.Deathrays; // Telegraph duration for deathray spiral float deathrayTelegraphDuration = malice ? AresBody.deathrayTelegraphDuration_Malice : death ? AresBody.deathrayTelegraphDuration_Death : @@ -362,14 +363,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (enraged) { SmokeDrawer.ParticleSpawnRate = AresBody.ventCloudSpawnRate; - SmokeDrawer.BaseMoveRotation = npc.rotation + MathHelper.Pi; + SmokeDrawer.BaseMoveRotation = NPC.rotation + MathHelper.Pi; SmokeDrawer.SpawnAreaCompactness = 40f; // Increase DR during enrage - npc.Calamity().DR = 0.85f; + NPC.Calamity().DR = 0.85f; } else - npc.Calamity().DR = 0.35f; + NPC.Calamity().DR = 0.35f; SmokeDrawer.Update(); @@ -400,7 +401,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (calamityGlobalNPC.newAI[2] == 1f) { // Reset the frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // X = 1 sets to frame 8 frameX = 1; @@ -421,19 +422,19 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if ((calamityGlobalNPC.newAI[2] - plasmaBoltTelegraphDuration) % divisor == 0f && canFire) { - npc.ai[3] += 1f; + NPC.ai[3] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaCasterFire"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaCasterFire"), NPC.Center); Vector2 plasmaBoltVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Vector2 offset = Vector2.Normalize(plasmaBoltVelocity) * 40f + Vector2.UnitY * 16f; if (boltsSplitLess) - Projectile.NewProjectile(npc.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, -1f); + Projectile.NewProjectile(NPC.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, -1f); else - Projectile.NewProjectile(npc.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + Projectile.NewProjectile(NPC.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); } } } @@ -456,7 +457,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares EnergyDrawer.Update(); // Smooth movement towards the location Ares Plasma Flamethrower is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; @@ -464,13 +465,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void FindFrame(int frameHeight) { // Use telegraph frames when using plasma bolts - npc.frameCounter += 1D; + NPC.frameCounter += 1D; if (AIState == (float)Phase.Nothing) { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -489,10 +490,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } else { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -514,16 +515,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { // Draw the enrage smoke behind Ares - SmokeDrawer.DrawSet(npc.Center); + SmokeDrawer.DrawSet(NPC.Center); SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Main.npcTexture[npc.type]; - Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); - Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); - Color afterimageBaseColor = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; + Texture2D texture = Main.npcTexture[NPC.type]; + Rectangle frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); + Vector2 vector = new Vector2(NPC.width / 2, NPC.height / 2); + Color afterimageBaseColor = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; if (CalamityConfig.Instance.Afterimages) @@ -532,24 +533,24 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { Color afterimageColor = drawColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * NPC.scale / 2f; + afterimageCenter += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, NPC.frame, afterimageColor, NPC.oldRot[i], vector, NPC.scale, spriteEffects, 0f); } } - Vector2 center = npc.Center - Main.screenPosition; + Vector2 center = NPC.Center - Main.screenPosition; //Draw an outline to the arm when it charges up - if ((npc.Calamity().newAI[2] < plasmaBoltTelegraphDuration) && AIState == (float)Phase.PlasmaBolts) + if ((NPC.Calamity().newAI[2] < plasmaBoltTelegraphDuration) && AIState == (float)Phase.PlasmaBolts) { CalamityUtils.EnterShaderRegion(spriteBatch); - Color outlineColor = Color.Lerp(Color.GreenYellow, Color.White, npc.Calamity().newAI[2] / plasmaBoltTelegraphDuration); + Color outlineColor = Color.Lerp(Color.GreenYellow, Color.White, NPC.Calamity().newAI[2] / plasmaBoltTelegraphDuration); Vector3 outlineHSL = Main.rgbToHsl(outlineColor); //BasicTint uses the opposite hue i guess? or smth is fucked with the way shaders get their colors. anyways, we invert it - float outlineThickness = MathHelper.Clamp(npc.Calamity().newAI[2] / plasmaBoltTelegraphDuration * 4f, 0f, 3f); + float outlineThickness = MathHelper.Clamp(NPC.Calamity().newAI[2] / plasmaBoltTelegraphDuration * 4f, 0f, 3f); GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1 - outlineHSL.X, outlineHSL.Y, outlineHSL.Z)); @@ -557,14 +558,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares for (float i = 0; i < 1; i += 0.125f) { - spriteBatch.Draw(texture, center + (i * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * outlineThickness, frame, outlineColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center + (i * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * outlineThickness, frame, outlineColor, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); } CalamityUtils.ExitShaderRegion(spriteBatch); } - spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Ares/AresPlasmaFlamethrowerGlow"); + Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresPlasmaFlamethrowerGlow"); if (CalamityConfig.Instance.Afterimages) { @@ -572,16 +573,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { Color afterimageColor = drawColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(glowTexture.Width, glowTexture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(glowTexture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(glowTexture.Width, glowTexture.Height) / new Vector2(maxFramesX, maxFramesY) * NPC.scale / 2f; + afterimageCenter += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(glowTexture, afterimageCenter, NPC.frame, afterimageColor, NPC.oldRot[i], vector, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(glowTexture, center, frame, afterimageBaseColor * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(glowTexture, center, frame, afterimageBaseColor * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); spriteBatch.End(); @@ -589,13 +590,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares //Update the parameters //Draw a pulsing version of the cannon above the real one - if ((npc.Calamity().newAI[2] < plasmaBoltTelegraphDuration) && AIState == (float)Phase.PlasmaBolts) + if ((NPC.Calamity().newAI[2] < plasmaBoltTelegraphDuration) && AIState == (float)Phase.PlasmaBolts) { - float pulseRatio = (npc.Calamity().newAI[2] % (plasmaBoltTelegraphDuration / 5f)) / (plasmaBoltTelegraphDuration / 5f); - float pulseSize = MathHelper.Lerp(0.1f, 0.6f, (float)Math.Floor(npc.Calamity().newAI[2] / (plasmaBoltTelegraphDuration / 5f)) / 4f); - float pulseOpacity = MathHelper.Clamp((float)Math.Floor(npc.Calamity().newAI[2] / (plasmaBoltTelegraphDuration / 5f)) * 0.3f, 1f, 2f); - spriteBatch.Draw(texture, center, frame, Color.GreenYellow * MathHelper.Lerp(1f, 0f, pulseRatio) * pulseOpacity, npc.rotation, vector, npc.scale + pulseRatio * pulseSize, spriteEffects, 0f); + float pulseRatio = (NPC.Calamity().newAI[2] % (plasmaBoltTelegraphDuration / 5f)) / (plasmaBoltTelegraphDuration / 5f); + float pulseSize = MathHelper.Lerp(0.1f, 0.6f, (float)Math.Floor(NPC.Calamity().newAI[2] / (plasmaBoltTelegraphDuration / 5f)) / 4f); + float pulseOpacity = MathHelper.Clamp((float)Math.Floor(NPC.Calamity().newAI[2] / (plasmaBoltTelegraphDuration / 5f)) * 0.3f, 1f, 2f); + spriteBatch.Draw(texture, center, frame, Color.GreenYellow * MathHelper.Lerp(1f, 0f, pulseRatio) * pulseOpacity, NPC.rotation, vector, NPC.scale + pulseRatio * pulseSize, spriteEffects, 0f); //Draw the bloom EnergyDrawer.DrawBloom(CoreSpritePosition); @@ -621,29 +622,29 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresPlasmaFlamethrower1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresPlasmaFlamethrower2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresPlasmaFlamethrower1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresPlasmaFlamethrower2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresHandBase1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresHandBase2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresHandBase3"), 1f); } } @@ -651,8 +652,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * 0.8f); } } } diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index b185e72892..d57e81b5fd 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -11,6 +11,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.ExoMechs.Ares { @@ -24,13 +25,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public float AIState { - get => npc.Calamity().newAI[0]; - set => npc.Calamity().newAI[0] = value; + get => NPC.Calamity().newAI[0]; + set => NPC.Calamity().newAI[0] = value; } public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); public AresCannonChargeParticleSet EnergyDrawer = new AresCannonChargeParticleSet(-1, 15, 40f, Color.Aqua); - public Vector2 CoreSpritePosition => npc.Center + npc.spriteDirection * npc.rotation.ToRotationVector2() * 35f + (npc.rotation + MathHelper.PiOver2).ToRotationVector2() * 5f; + public Vector2 CoreSpritePosition => NPC.Center + NPC.spriteDirection * NPC.rotation.ToRotationVector2() * 35f + (NPC.rotation + MathHelper.PiOver2).ToRotationVector2() * 5f; // Number of frames on the X and Y axis private const int maxFramesX = 6; @@ -58,68 +59,68 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void SetStaticDefaults() { DisplayName.SetDefault("XF-09 Ares Tesla Cannon"); - NPCID.Sets.TrailingMode[npc.type] = 3; - NPCID.Sets.TrailCacheLength[npc.type] = npc.oldPos.Length; + NPCID.Sets.TrailingMode[NPC.type] = 3; + NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; } public override void SetDefaults() { - npc.npcSlots = 5f; - npc.damage = 100; - npc.width = 172; - npc.height = 108; - npc.defense = 80; - npc.DR_NERD(0.35f); - npc.LifeMaxNERB(1250000, 1495000, 500000); + NPC.npcSlots = 5f; + NPC.damage = 100; + NPC.width = 172; + NPC.height = 108; + NPC.defense = 80; + NPC.DR_NERD(0.35f); + NPC.LifeMaxNERB(1250000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.Opacity = 0f; - npc.knockBackResist = 0f; - npc.canGhostHeal = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; - npc.hide = true; + NPC.Opacity = 0f; + NPC.knockBackResist = 0f; + NPC.canGhostHeal = false; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.boss = true; + NPC.hide = true; music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(frameX); writer.Write(frameY); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + NPC.frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; return; } @@ -179,34 +180,34 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Target variable Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; - CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity(); + CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)NPC.ai[2]].Calamity(); // Passive phase check bool passivePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.Passive; // Enrage check - bool enraged = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes; + bool enraged = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes; // Adjust opacity bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = invisiblePhase; + NPC.dontTakeDamage = invisiblePhase; if (!invisiblePhase) { - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } else { - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } // Predictiveness @@ -219,7 +220,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares predictionAmt *= 1.5f; Vector2 predictionVector = player.velocity * predictionAmt; - Vector2 rotationVector = player.Center + predictionVector - npc.Center; + Vector2 rotationVector = player.Center + predictionVector - NPC.Center; bool fireMoreOrbs = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays; float projectileVelocity = (passivePhase || fireMoreOrbs) ? 5.2f : 7.8f; @@ -232,32 +233,32 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 lookAt = Vector2.Normalize(rotationVector) * projectileVelocity; float rotation = (float)Math.Atan2(lookAt.Y, lookAt.X); - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) rotation += MathHelper.Pi; if (rotation < 0f) rotation += MathHelper.TwoPi; if (rotation > MathHelper.TwoPi) rotation -= MathHelper.TwoPi; - npc.rotation = npc.rotation.AngleTowards(rotation, rateOfRotation); + NPC.rotation = NPC.rotation.AngleTowards(rotation, rateOfRotation); // Direction - int direction = Math.Sign(player.Center.X - npc.Center.X); + int direction = Math.Sign(player.Center.X - NPC.Center.X); if (direction != 0) { - npc.direction = direction; + NPC.direction = direction; - if (npc.spriteDirection != -npc.direction) - npc.rotation += MathHelper.Pi; + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } // Light if (enraged) - Lighting.AddLight(npc.Center, 0.5f * npc.Opacity, 0f, 0f); + Lighting.AddLight(NPC.Center, 0.5f * NPC.Opacity, 0f, 0f); else - Lighting.AddLight(npc.Center, 0.1f * npc.Opacity, 0.25f * npc.Opacity, 0.25f * npc.Opacity); + Lighting.AddLight(NPC.Center, 0.1f * NPC.Opacity, 0.25f * NPC.Opacity, 0.25f * NPC.Opacity); // Gate values float teslaOrbPhaseGateValue = fireMoreOrbs ? 120f : 270f; @@ -280,17 +281,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIState = (float)Phase.Nothing; calamityGlobalNPC.newAI[1] = setTimerTo; calamityGlobalNPC.newAI[2] = 0f; - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; - npc.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 1f; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) + NPC.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || @@ -328,15 +329,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Velocity and acceleration values float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (malice ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult; - baseVelocity *= 1f + Main.npc[(int)npc.ai[2]].localAI[2]; + baseVelocity *= 1f + Main.npc[(int)NPC.ai[2]].localAI[2]; - Vector2 distanceFromDestination = destination - npc.Center; + Vector2 distanceFromDestination = destination - NPC.Center; // Distance where Ares Tesla Arm stops moving float movementDistanceGateValue = 50f; // If Tesla Cannon can fire projectiles, cannot fire if too close to the target and in deathray spiral phase - bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f || calamityGlobalNPC_Body.newAI[0] != (float)AresBody.Phase.Deathrays; + bool canFire = Vector2.Distance(NPC.Center, player.Center) > 320f || calamityGlobalNPC_Body.newAI[0] != (float)AresBody.Phase.Deathrays; // Telegraph duration for deathray spiral float deathrayTelegraphDuration = malice ? AresBody.deathrayTelegraphDuration_Malice : death ? AresBody.deathrayTelegraphDuration_Death : @@ -359,14 +360,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (enraged) { SmokeDrawer.ParticleSpawnRate = AresBody.ventCloudSpawnRate; - SmokeDrawer.BaseMoveRotation = npc.rotation + MathHelper.Pi; + SmokeDrawer.BaseMoveRotation = NPC.rotation + MathHelper.Pi; SmokeDrawer.SpawnAreaCompactness = 40f; // Increase DR during enrage - npc.Calamity().DR = 0.85f; + NPC.Calamity().DR = 0.85f; } else - npc.Calamity().DR = 0.35f; + NPC.Calamity().DR = 0.35f; SmokeDrawer.Update(); @@ -396,7 +397,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (calamityGlobalNPC.newAI[2] == 1f) { // Reset the frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // X = 1 sets to frame 8 frameX = 1; @@ -420,13 +421,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"), NPC.Center); Vector2 teslaOrbVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Vector2 offset = Vector2.Normalize(teslaOrbVelocity) * 40f + Vector2.UnitY * 8f; float identity = fireMoreOrbs ? -2f : calamityGlobalNPC.newAI[3] + (calamityGlobalNPC.newAI[2] - teslaOrbTelegraphDuration) / divisor; - Projectile.NewProjectile(npc.Center + offset, teslaOrbVelocity, type, damage, 0f, Main.myPlayer, identity); + Projectile.NewProjectile(NPC.Center + offset, teslaOrbVelocity, type, damage, 0f, Main.myPlayer, identity); } } } @@ -450,7 +451,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares EnergyDrawer.Update(); // Smooth movement towards the location Ares Tesla Cannon is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; @@ -458,13 +459,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void FindFrame(int frameHeight) { // Use telegraph frames when using tesla orbs - npc.frameCounter += 1D; + NPC.frameCounter += 1D; if (AIState == (float)Phase.Nothing) { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -483,10 +484,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } else { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -508,16 +509,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { // Draw the enrage smoke behind Ares - SmokeDrawer.DrawSet(npc.Center); + SmokeDrawer.DrawSet(NPC.Center); SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Main.npcTexture[npc.type]; - Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); - Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); - Color afterimageBaseColor = Main.npc[(int)npc.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; + Texture2D texture = Main.npcTexture[NPC.type]; + Rectangle frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); + Vector2 vector = new Vector2(NPC.width / 2, NPC.height / 2); + Color afterimageBaseColor = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; if (CalamityConfig.Instance.Afterimages) @@ -526,23 +527,23 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { Color afterimageColor = drawColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * NPC.scale / 2f; + afterimageCenter += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, NPC.frame, afterimageColor, NPC.oldRot[i], vector, NPC.scale, spriteEffects, 0f); } } - Vector2 center = npc.Center - Main.screenPosition; + Vector2 center = NPC.Center - Main.screenPosition; //Draw an outline to the arm when it charges up - if ((npc.Calamity().newAI[2] < teslaOrbTelegraphDuration) && AIState == (float)Phase.TeslaOrbs) + if ((NPC.Calamity().newAI[2] < teslaOrbTelegraphDuration) && AIState == (float)Phase.TeslaOrbs) { CalamityUtils.EnterShaderRegion(spriteBatch); - Color outlineColor = Color.Lerp(Color.Aqua, Color.White, npc.Calamity().newAI[2] / teslaOrbTelegraphDuration); - float outlineThickness = MathHelper.Clamp(npc.Calamity().newAI[2] / teslaOrbTelegraphDuration * 4f, 0f, 3f); + Color outlineColor = Color.Lerp(Color.Aqua, Color.White, NPC.Calamity().newAI[2] / teslaOrbTelegraphDuration); + float outlineThickness = MathHelper.Clamp(NPC.Calamity().newAI[2] / teslaOrbTelegraphDuration * 4f, 0f, 3f); GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); GameShaders.Misc["CalamityMod:BasicTint"].UseColor(outlineColor); @@ -550,14 +551,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares for (float i = 0; i < 1; i += 0.125f) { - spriteBatch.Draw(texture, center + (i * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * outlineThickness, frame, outlineColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center + (i * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * outlineThickness, frame, outlineColor, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); } CalamityUtils.ExitShaderRegion(spriteBatch); } - spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - Texture2D glowTexture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Ares/AresTeslaCannonGlow"); + Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresTeslaCannonGlow"); if (CalamityConfig.Instance.Afterimages) { @@ -565,29 +566,29 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { Color afterimageColor = drawColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(glowTexture.Width, glowTexture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(glowTexture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(glowTexture.Width, glowTexture.Height) / new Vector2(maxFramesX, maxFramesY) * NPC.scale / 2f; + afterimageCenter += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(glowTexture, afterimageCenter, NPC.frame, afterimageColor, NPC.oldRot[i], vector, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(glowTexture, center, frame, afterimageBaseColor * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(glowTexture, center, frame, afterimageBaseColor * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters //Draw a pulsing version of the thing above the arm - if ((npc.Calamity().newAI[2] < teslaOrbTelegraphDuration) && AIState == (float)Phase.TeslaOrbs) + if ((NPC.Calamity().newAI[2] < teslaOrbTelegraphDuration) && AIState == (float)Phase.TeslaOrbs) { - float pulseRatio = (npc.Calamity().newAI[2] % (teslaOrbTelegraphDuration / 5f)) / (teslaOrbTelegraphDuration / 5f); - float pulseSize = MathHelper.Lerp(0.1f, 0.6f, (float)Math.Floor(npc.Calamity().newAI[2] / (teslaOrbTelegraphDuration / 5f)) / 4f); - float pulseOpacity = MathHelper.Clamp((float)Math.Floor(npc.Calamity().newAI[2] / (teslaOrbTelegraphDuration / 5f)) * 0.3f, 1f, 2f); - spriteBatch.Draw(texture, center, frame, Color.Aqua * MathHelper.Lerp(1f, 0f, pulseRatio) * pulseOpacity, npc.rotation, vector, npc.scale + pulseRatio * pulseSize, spriteEffects, 0f); + float pulseRatio = (NPC.Calamity().newAI[2] % (teslaOrbTelegraphDuration / 5f)) / (teslaOrbTelegraphDuration / 5f); + float pulseSize = MathHelper.Lerp(0.1f, 0.6f, (float)Math.Floor(NPC.Calamity().newAI[2] / (teslaOrbTelegraphDuration / 5f)) / 4f); + float pulseOpacity = MathHelper.Clamp((float)Math.Floor(NPC.Calamity().newAI[2] / (teslaOrbTelegraphDuration / 5f)) * 0.3f, 1f, 2f); + spriteBatch.Draw(texture, center, frame, Color.Aqua * MathHelper.Lerp(1f, 0f, pulseRatio) * pulseOpacity, NPC.rotation, vector, NPC.scale + pulseRatio * pulseSize, spriteEffects, 0f); //Draw the bloom EnergyDrawer.DrawBloom(CoreSpritePosition); @@ -614,29 +615,29 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresTeslaCannon1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresTeslaCannon2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresTeslaCannon1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresTeslaCannon2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresHandBase1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresHandBase2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Ares/AresHandBase3"), 1f); } } @@ -644,8 +645,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * 0.8f); } } } diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index 7a4d7a8705..c11e6eaa2a 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -13,6 +13,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.ExoMechs.Artemis { @@ -44,8 +45,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public float AIState { - get => npc.Calamity().newAI[0]; - set => npc.Calamity().newAI[0] = value; + get => NPC.Calamity().newAI[0]; + set => NPC.Calamity().newAI[0] = value; } public enum SecondaryPhase @@ -57,8 +58,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public float SecondaryAIState { - get => npc.Calamity().newAI[1]; - set => npc.Calamity().newAI[1] = value; + get => NPC.Calamity().newAI[1]; + set => NPC.Calamity().newAI[1] = value; } // Variable used to scale up velocity if too far from destination @@ -132,42 +133,42 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void SetStaticDefaults() { DisplayName.SetDefault(NameToDisplay); - NPCID.Sets.TrailingMode[npc.type] = 3; - NPCID.Sets.TrailCacheLength[npc.type] = 15; + NPCID.Sets.TrailingMode[NPC.type] = 3; + NPCID.Sets.TrailCacheLength[NPC.type] = 15; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 5f; - npc.GetNPCDamage(); - npc.width = 204; - npc.height = 226; - npc.defense = 80; - npc.DR_NERD(0.25f); - npc.LifeMaxNERB(1250000, 1495000, 500000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 5f; + NPC.GetNPCDamage(); + NPC.width = 204; + NPC.height = 226; + NPC.defense = 80; + NPC.DR_NERD(0.25f); + NPC.LifeMaxNERB(1250000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.Opacity = 0f; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; + NPC.Opacity = 0f; + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.boss = true; music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void BossHeadSlot(ref int index) { if (SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune) index = -1; - else if (npc.life / (float)npc.lifeMax < 0.6f) + else if (NPC.life / (float)NPC.lifeMax < 0.6f) index = phase2IconIndex; else index = phase1IconIndex; @@ -183,13 +184,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis writer.Write(pickNewLocation); writer.Write(rotationDirection); writer.WriteVector2(spinningPoint); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -202,22 +203,22 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis pickNewLocation = reader.ReadBoolean(); rotationDirection = reader.ReadInt32(); spinningPoint = reader.ReadVector2(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - CalamityGlobalNPC.draedonExoMechTwinRed = npc.whoAmI; + CalamityGlobalNPC.draedonExoMechTwinRed = NPC.whoAmI; - npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + NPC.frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -226,15 +227,15 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); // Target variable - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; // Check if the other exo mechs are alive int otherExoMechsAlive = 0; @@ -249,8 +250,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].target]; // Link the HP of both twins - if (npc.life > Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life) - npc.life = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life; + if (NPC.life > Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life) + NPC.life = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life; exoTwinGreenAlive = true; } @@ -279,7 +280,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // These are 5 by default to avoid triggering passive phases after the other mechs are dead float exoWormLifeRatio = defaultLifeRatio; @@ -318,8 +319,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis canFireLasers = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].ai[3] <= 1f; // Set movement according to Apollo - if (npc.ai[0] >= 10f) - npc.ai[0] = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].ai[0]; + if (NPC.ai[0] >= 10f) + NPC.ai[0] = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].ai[0]; } // Check if any of the other mechs were spawned first @@ -334,13 +335,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Prevent mechs from being respawned if (otherExoMechWasFirst) { - if (npc.ai[3] < 1f) - npc.ai[3] = 1f; + if (NPC.ai[3] < 1f) + NPC.ai[3] = 1f; } // Phases bool phase2 = lifeRatio < 0.6f; - bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f; + bool spawnOtherExoMechs = lifeRatio < 0.7f && NPC.ai[3] == 0f; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -351,18 +352,18 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk; // Spawn Apollo if it doesn't exist after the first 10 frames have passed - if (npc.ai[0] < 10f) + if (NPC.ai[0] < 10f) { - npc.ai[0] += 1f; - if (npc.ai[0] == 10f && !NPC.AnyNPCs(ModContent.NPCType())) + NPC.ai[0] += 1f; + if (NPC.ai[0] == 10f && !NPC.AnyNPCs(ModContent.NPCType())) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); } else { if (!NPC.AnyNPCs(ModContent.NPCType())) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; } } @@ -416,7 +417,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis float spinRadius = 500f; float spinLocationDistance = 50f; Vector2 spinLocation = player.Center; - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { // Laser from top case 0: @@ -461,26 +462,26 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis float laserShotgunDuration = lastMechAlive ? 120f : 90f; // If Artemis can fire projectiles, cannot fire if too close to the target - bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f && canFireLasers; + bool canFire = Vector2.Distance(NPC.Center, player.Center) > 320f && canFireLasers; // Add some random distance to the destination after certain attacks if (pickNewLocation) { pickNewLocation = false; - npc.localAI[0] = Main.rand.Next(-50, 51); - npc.localAI[1] = Main.rand.Next(-250, 251); + NPC.localAI[0] = Main.rand.Next(-50, 51); + NPC.localAI[1] = Main.rand.Next(-250, 251); if (SecondaryAIState == (float)SecondaryPhase.Passive) { - npc.localAI[0] *= 0.5f; - npc.localAI[1] *= 0.5f; + NPC.localAI[0] *= 0.5f; + NPC.localAI[1] *= 0.5f; } - npc.netUpdate = true; + NPC.netUpdate = true; } // Default vector to fly to - bool flyLeft = npc.ai[0] % 2f == 0f || npc.ai[0] < 10f || !revenge; + bool flyLeft = NPC.ai[0] % 2f == 0f || NPC.ai[0] < 10f || !revenge; float destinationX = flyLeft ? -750f : 750f; float destinationY = player.Center.Y; Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X + destinationX * 1.6f, destinationY) : @@ -491,12 +492,12 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Add a bit of randomness to the destination, but only in specific phases where it's necessary if (AIState == (float)Phase.Normal || AIState == (float)Phase.LaserShotgun || AIState == (float)Phase.PhaseTransition) { - destination.X += npc.localAI[0]; - destination.Y += npc.localAI[1]; + destination.X += NPC.localAI[0]; + destination.Y += NPC.localAI[1]; } // Scale up velocity over time if too far from destination - Vector2 distanceFromDestination = destination - npc.Center; + Vector2 distanceFromDestination = destination - NPC.Center; if (distanceFromDestination.Length() > movementDistanceGateValue && AIState != (float)Phase.Charge) { if (velocityBoostMult < 1f) @@ -511,69 +512,69 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Rotation Vector2 predictionVector = AIState == (float)Phase.Deathray ? Vector2.Zero : player.velocity * predictionAmt; - Vector2 aimedVector = player.Center + predictionVector - npc.Center; + Vector2 aimedVector = player.Center + predictionVector - NPC.Center; float rateOfRotation = 0.1f; - Vector2 rotateTowards = player.Center - npc.Center; + Vector2 rotateTowards = player.Center - NPC.Center; bool stopRotatingAndSlowDown = !phase2 && AIState == (float)Phase.Normal && lineUpAttack; if (!stopRotatingAndSlowDown) { if (AIState == (int)Phase.Charge) { rateOfRotation = 0f; - npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; } else if (spinningPoint != default) { rateOfRotation = 0f; - float x = spinningPoint.X - npc.Center.X; - float y = spinningPoint.Y - npc.Center.Y; - npc.rotation = (float)Math.Atan2(y, x) + MathHelper.PiOver2; + float x = spinningPoint.X - NPC.Center.X; + float y = spinningPoint.Y - NPC.Center.Y; + NPC.rotation = (float)Math.Atan2(y, x) + MathHelper.PiOver2; } else { - float x = player.Center.X + predictionVector.X - npc.Center.X; - float y = player.Center.Y + predictionVector.Y - npc.Center.Y; + float x = player.Center.X + predictionVector.X - NPC.Center.X; + float y = player.Center.Y + predictionVector.Y - NPC.Center.Y; rotateTowards = Vector2.Normalize(new Vector2(x, y)) * baseVelocity; } // Do not set this during charge or deathray phases if (rateOfRotation != 0f) - npc.rotation = npc.rotation.AngleTowards((float)Math.Atan2(rotateTowards.Y, rotateTowards.X) + MathHelper.PiOver2, rateOfRotation); + NPC.rotation = NPC.rotation.AngleTowards((float)Math.Atan2(rotateTowards.Y, rotateTowards.X) + MathHelper.PiOver2, rateOfRotation); } // Light - Lighting.AddLight(npc.Center, 0.25f * npc.Opacity, 0.15f * npc.Opacity, 0.05f * npc.Opacity); + Lighting.AddLight(NPC.Center, 0.25f * NPC.Opacity, 0.15f * NPC.Opacity, 0.05f * NPC.Opacity); // Despawn if target is dead if (player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (player.dead) { AIState = (float)Phase.Normal; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; rotationDirection = 0; chargeVelocityNormalized = default; spinningPoint = default; spinVelocity = default; - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; - npc.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 1f; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) + NPC.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || @@ -591,16 +592,16 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis float spinTime = 120f - 320f * (baseVelocityMult - 1.25f); // Set to transition to phase 2 if it hasn't happened yet - if (phase2 && npc.localAI[3] == 0f) + if (phase2 && NPC.localAI[3] == 0f) { AIState = (float)Phase.PhaseTransition; - npc.localAI[3] = 1f; + NPC.localAI[3] = 1f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; // Set frames to phase transition frames, which begin on frame 30 // Reset the frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // X = 3 sets to frame 27 frameX = 3; @@ -629,18 +630,18 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Adjust opacity bool invisiblePhase = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = invisiblePhase || AIState == (float)Phase.PhaseTransition; + NPC.dontTakeDamage = invisiblePhase || AIState == (float)Phase.PhaseTransition; if (!invisiblePhase) { - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } else { - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } // Attacking phases @@ -655,7 +656,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis chargeVelocityNormalized = default; // Smooth movement towards the location Artemis is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); } else { @@ -664,7 +665,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis chargeVelocityNormalized = Vector2.Normalize(aimedVector); // Decelerate - npc.velocity *= decelerationVelocityMult; + NPC.velocity *= decelerationVelocityMult; } // Default animation for 60 frames and then go to telegraph animation @@ -689,13 +690,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + int damage = NPC.GetProjectileDamage(type); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), NPC.Center); Vector2 laserVelocity = Vector2.Normalize(aimedVector); Vector2 projectileDestination = player.Center + predictionVector; Vector2 offset = laserVelocity * 70f; float setVelocityInAI = 6.5f; - Projectile.NewProjectile(npc.Center + offset, projectileDestination, type, damage, 0f, Main.myPlayer, setVelocityInAI, npc.whoAmI); + Projectile.NewProjectile(NPC.Center + offset, projectileDestination, type, damage, 0f, Main.myPlayer, setVelocityInAI, NPC.whoAmI); } } } @@ -727,10 +728,10 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), NPC.Center); Vector2 laserVelocity = Vector2.Normalize(aimedVector); Vector2 offset = laserVelocity * 50f; - Projectile.NewProjectile(npc.Center + offset, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(NPC.Center + offset, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } @@ -740,12 +741,12 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Vector2 laserVelocity = chargeVelocityNormalized * 10f; int numLasersPerSpread = malice ? 10 : death ? 8 : expertMode ? 6 : 4; int spread = malice ? 30 : death ? 26 : expertMode ? 21 : 15; float rotation = MathHelper.ToRadians(spread); - float distanceFromTarget = Vector2.Distance(npc.Center, npc.Center + chargeVelocityNormalized * chargeDistance); + float distanceFromTarget = Vector2.Distance(NPC.Center, NPC.Center + chargeVelocityNormalized * chargeDistance); float setVelocityInAI = 6.5f; for (int i = 0; i < numLasersPerSpread + 1; i++) @@ -754,9 +755,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Vector2 normalizedPerturbedSpeed = Vector2.Normalize(perturbedSpeed); Vector2 offset = normalizedPerturbedSpeed * 70f; - Vector2 newCenter = npc.Center + offset; + Vector2 newCenter = NPC.Center + offset; - Projectile.NewProjectile(newCenter, newCenter + normalizedPerturbedSpeed * distanceFromTarget, type, damage, 0f, Main.myPlayer, setVelocityInAI, npc.whoAmI); + Projectile.NewProjectile(newCenter, newCenter + normalizedPerturbedSpeed * distanceFromTarget, type, damage, 0f, Main.myPlayer, setVelocityInAI, NPC.whoAmI); } } } @@ -766,16 +767,16 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis calamityGlobalNPC.newAI[3] = 0f; if (phase2) { - AIState = npc.localAI[2] == 1f ? (float)Phase.Deathray : (float)Phase.LaserShotgun; + AIState = NPC.localAI[2] == 1f ? (float)Phase.Deathray : (float)Phase.LaserShotgun; } else { // Charge until a certain distance is reached and then return to normal phase - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ELRFire"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ELRFire"), NPC.Center); AIState = (float)Phase.Charge; // Set charge velocity - npc.velocity = chargeVelocityNormalized * chargeVelocity; + NPC.velocity = chargeVelocityNormalized * chargeVelocity; chargeVelocityNormalized = default; } } @@ -796,7 +797,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (calamityGlobalNPC.newAI[2] >= chargeDuration) { // Decelerate - npc.velocity *= decelerationVelocityMult; + NPC.velocity *= decelerationVelocityMult; // Go back to normal phase if (calamityGlobalNPC.newAI[2] >= chargeDuration + 10f) @@ -813,7 +814,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis case (int)Phase.LaserShotgun: // Smooth movement towards the location Artemis is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); // Fire lasers int numSpreads = lastMechAlive ? 3 : 2; @@ -824,8 +825,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + int damage = NPC.GetProjectileDamage(type); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), NPC.Center); Vector2 laserVelocity = Vector2.Normalize(aimedVector) * 10f; /* Spread: @@ -838,7 +839,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis int baseSpread = ((nerfedAttacks || nerfedLaserShotgun) ? 9 : lastMechAlive ? 20 : 15) + numLasersAddedByDifficulty * 2; int spread = baseSpread + (int)(calamityGlobalNPC.newAI[2] / divisor2) * (baseSpread / 4); float rotation = MathHelper.ToRadians(spread); - float distanceFromTarget = Vector2.Distance(npc.Center, player.Center + predictionVector); + float distanceFromTarget = Vector2.Distance(NPC.Center, player.Center + predictionVector); float setVelocityInAI = 6.5f; for (int i = 0; i < numLasersPerSpread + 1; i++) @@ -847,9 +848,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Vector2 normalizedPerturbedSpeed = Vector2.Normalize(perturbedSpeed); Vector2 offset = normalizedPerturbedSpeed * 70f; - Vector2 newCenter = npc.Center + offset; + Vector2 newCenter = NPC.Center + offset; - Projectile.NewProjectile(newCenter, newCenter + normalizedPerturbedSpeed * distanceFromTarget, type, damage, 0f, Main.myPlayer, setVelocityInAI, npc.whoAmI); + Projectile.NewProjectile(newCenter, newCenter + normalizedPerturbedSpeed * distanceFromTarget, type, damage, 0f, Main.myPlayer, setVelocityInAI, NPC.whoAmI); } } } @@ -860,7 +861,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { pickNewLocation = true; AIState = (float)Phase.Normal; - npc.localAI[2] = shouldGetBuffedByBerserkPhase ? 1f : 0f; + NPC.localAI[2] = shouldGetBuffedByBerserkPhase ? 1f : 0f; calamityGlobalNPC.newAI[2] = 0f; } @@ -871,50 +872,50 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Fly above, stop doing this if in the proper position // Stop rotating and spin around a target point - if ((destination - npc.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[2] > 0f) + if ((destination - NPC.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[2] > 0f) { // Draw telegraph for deathray if (calamityGlobalNPC.newAI[2] == 0f) { - npc.velocity = Vector2.Zero; + NPC.velocity = Vector2.Zero; - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { // Laser from top case 0: case 1: - spinningPoint = npc.Center + Vector2.UnitY * spinRadius; + spinningPoint = NPC.Center + Vector2.UnitY * spinRadius; break; // Laser from bottom case 2: - spinningPoint = npc.Center - Vector2.UnitY * spinRadius; + spinningPoint = NPC.Center - Vector2.UnitY * spinRadius; break; // Laser from left case 3: - spinningPoint = npc.Center + Vector2.UnitX * spinRadius; + spinningPoint = NPC.Center + Vector2.UnitX * spinRadius; break; // Laser from right case 4: - spinningPoint = npc.Center - Vector2.UnitX * spinRadius; + spinningPoint = NPC.Center - Vector2.UnitX * spinRadius; break; } - npc.ai[1] = spinningPoint.X; - npc.ai[2] = spinningPoint.Y; + NPC.ai[1] = spinningPoint.X; + NPC.ai[2] = spinningPoint.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); - Vector2 laserVelocity = Vector2.Normalize(spinningPoint - npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), NPC.Center); + Vector2 laserVelocity = Vector2.Normalize(spinningPoint - NPC.Center); Vector2 offset = laserVelocity * 70f; - Projectile.NewProjectile(npc.Center + offset, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(NPC.Center + offset, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); } - npc.netUpdate = true; + NPC.netUpdate = true; } // Fire deathray and spin @@ -927,12 +928,12 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis spinVelocity.X = MathHelper.Pi * spinRadius / spinTime; // Set spin direction - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { // Laser from top case 0: case 1: - if (player.Center.X >= npc.Center.X) + if (player.Center.X >= NPC.Center.X) rotationDirection = 1; else rotationDirection = -1; @@ -940,7 +941,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Laser from bottom case 2: - if (player.Center.X >= npc.Center.X) + if (player.Center.X >= NPC.Center.X) rotationDirection = -1; else rotationDirection = 1; @@ -949,7 +950,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Laser from left case 3: - if (player.Center.Y >= npc.Center.Y) + if (player.Center.Y >= NPC.Center.Y) rotationDirection = -1; else rotationDirection = 1; @@ -958,7 +959,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Laser from right case 4: - if (player.Center.Y >= npc.Center.Y) + if (player.Center.Y >= NPC.Center.Y) rotationDirection = 1; else rotationDirection = -1; @@ -967,7 +968,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } spinVelocity *= -rotationDirection; - npc.netUpdate = true; + NPC.netUpdate = true; // Create a bunch of lightning bolts in the sky ExoMechsSky.CreateLightningBolt(12); @@ -976,12 +977,12 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - Main.PlaySound(29, (int)npc.Center.X, (int)npc.Center.Y, 104); - int damage = npc.GetProjectileDamage(type); - int laser = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.whoAmI); + SoundEngine.PlaySound(29, (int)NPC.Center.X, (int)NPC.Center.Y, 104); + int damage = NPC.GetProjectileDamage(type); + int laser = Projectile.NewProjectile(NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, NPC.whoAmI); if (Main.projectile.IndexInRange(laser)) { - Main.projectile[laser].ai[0] = npc.whoAmI; + Main.projectile[laser].ai[0] = NPC.whoAmI; Main.projectile[laser].ai[1] = rotationDirection; } } @@ -994,7 +995,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { // The radians moved per frame during the spin double radiansOfRotation = MathHelper.Pi / spinTime * -rotationDirection; - npc.velocity = npc.velocity.RotatedBy(radiansOfRotation); + NPC.velocity = NPC.velocity.RotatedBy(radiansOfRotation); } else { @@ -1002,7 +1003,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // The radians moved are reduced early on to avoid spinning too fucking fast float decelerationMult = rotationMult * rotationMult; double radiansOfRotation = MathHelper.Pi / spinTime * -rotationDirection * decelerationMult; - npc.velocity = (spinVelocity * decelerationMult).RotatedBy(radiansOfRotation); + NPC.velocity = (spinVelocity * decelerationMult).RotatedBy(radiansOfRotation); } } } @@ -1010,7 +1011,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis else { // Smooth movement towards the location Artemis is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); } // Reset phase and variables @@ -1021,38 +1022,38 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis spinningPoint = default; pickNewLocation = true; AIState = (float)Phase.Normal; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; if (revenge) { // Can use all 4 types of lasers in rev+ - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { case 0: case 1: - npc.ai[3] = 3f + Main.rand.Next(2); + NPC.ai[3] = 3f + Main.rand.Next(2); break; case 2: - npc.ai[3] = 3f + Main.rand.Next(2); + NPC.ai[3] = 3f + Main.rand.Next(2); break; case 3: - npc.ai[3] = 1f + Main.rand.Next(2); + NPC.ai[3] = 1f + Main.rand.Next(2); break; case 4: - npc.ai[3] = 1f + Main.rand.Next(2); + NPC.ai[3] = 1f + Main.rand.Next(2); break; } } else if (expertMode) { // Can only use the top and bottom lasers in expert - npc.ai[3] += 1f; - if (npc.ai[3] > 2f) - npc.ai[3] = 1f; + NPC.ai[3] += 1f; + if (NPC.ai[3] > 2f) + NPC.ai[3] = 1f; } - npc.localAI[2] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } break; @@ -1061,17 +1062,17 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis case (int)Phase.PhaseTransition: // Smooth movement towards the location Artemis is meant to be at - CalamityGlobalNPC.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity); + CalamityGlobalNPC.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity); // Shoot lens gore at the target at the proper time if (calamityGlobalNPC.newAI[2] == lensPopTime) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), NPC.Center); Vector2 lensDirection = Vector2.Normalize(aimedVector); Vector2 offset = lensDirection * 70f; if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.Center + offset, lensDirection * 24f, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(NPC.Center + offset, lensDirection * 24f, ModContent.ProjectileType(), 0, 0f); } // Reset phase and variables @@ -1080,8 +1081,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { pickNewLocation = true; AIState = (float)Phase.Normal; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; chargeVelocityNormalized = default; @@ -1100,10 +1101,10 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -1113,7 +1114,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (dist4 < minDist) minDist = dist4; - return minDist <= 100f && npc.Opacity == 1f && AIState == (float)Phase.Charge; + return minDist <= 100f && NPC.Opacity == 1f && AIState == (float)Phase.Charge; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -1125,14 +1126,14 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void FindFrame(int frameHeight) { // Use telegraph frames before each attack - bool phase2 = npc.life / (float)npc.lifeMax < 0.6f; - npc.frameCounter += 1D; + bool phase2 = NPC.life / (float)NPC.lifeMax < 0.6f; + NPC.frameCounter += 1D; if (AIState == (float)Phase.PhaseTransition) { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -1149,13 +1150,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { if (AIState == (float)Phase.Normal) { - int frameLimit = phase2 ? (npc.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase2 : npc.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase2 : attackFrameLimit_Phase2) : - (npc.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase1 : npc.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase1 : attackFrameLimit_Phase1); + int frameLimit = phase2 ? (NPC.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase2 : NPC.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase2 : attackFrameLimit_Phase2) : + (NPC.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase1 : NPC.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase1 : attackFrameLimit_Phase1); - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -1170,16 +1171,16 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Reset the frames int currentFrame = (frameX * maxFramesY) + frameY; if (currentFrame > frameLimit) - frameX = frameY = phase2 ? (npc.Calamity().newAI[3] == 0f ? 6 : npc.Calamity().newAI[3] == 1f ? 7 : 8) : (npc.Calamity().newAI[3] == 0f ? 0 : npc.Calamity().newAI[3] == 1f ? 1 : 2); + frameX = frameY = phase2 ? (NPC.Calamity().newAI[3] == 0f ? 6 : NPC.Calamity().newAI[3] == 1f ? 7 : 8) : (NPC.Calamity().newAI[3] == 0f ? 0 : NPC.Calamity().newAI[3] == 1f ? 1 : 2); } } else if (AIState == (float)Phase.Charge || AIState == (float)Phase.LaserShotgun || AIState == (float)Phase.Deathray) { int frameLimit = phase2 ? attackFrameLimit_Phase2 : attackFrameLimit_Phase1; - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -1235,7 +1236,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { Color startingColor = new Color(34, 40, 48); Color endColor = new Color(219, 82, 28); - return Color.Lerp(startingColor, endColor, (float)Math.Pow(completionRatio, 1.5D)) * npc.Opacity; + return Color.Lerp(startingColor, endColor, (float)Math.Pow(completionRatio, 1.5D)) * NPC.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) @@ -1251,13 +1252,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis RibbonTrail = new PrimitiveTrail(RibbonTrailWidthFunction, RibbonTrailColorFunction); // Prepare the flame trail shader with its map texture. - GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/ScarletDevilStreak")); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/ScarletDevilStreak")); int numAfterimages = ChargeFlash > 0f ? 0 : 5; - Texture2D texture = Main.npcTexture[npc.type]; - Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); - Vector2 origin = npc.Size * 0.5f; - Vector2 center = npc.Center - Main.screenPosition; + Texture2D texture = Main.npcTexture[NPC.type]; + Rectangle frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); + Vector2 origin = NPC.Size * 0.5f; + Vector2 center = NPC.Center - Main.screenPosition; Color afterimageBaseColor = Color.White; // Draws a single instance of a regular, non-glowmask based Artemis. @@ -1270,42 +1271,42 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { Color afterimageColor = baseColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; - afterimageCenter += origin * npc.scale + new Vector2(0f, npc.gfxOffY); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * NPC.scale / 2f; + afterimageCenter += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); afterimageCenter += drawOffset; - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, afterimageCenter, NPC.frame, afterimageColor, NPC.oldRot[i], origin, NPC.scale, SpriteEffects.None, 0f); } } - spriteBatch.Draw(texture, center + drawOffset, frame, npc.GetAlpha(baseColor), npc.rotation, origin, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, center + drawOffset, frame, NPC.GetAlpha(baseColor), NPC.rotation, origin, NPC.scale, SpriteEffects.None, 0f); } // Draw ribbons near the main thruster for (int direction = -1; direction <= 1; direction += 2) { - Vector2 ribbonOffset = -Vector2.UnitY.RotatedBy(npc.rotation) * 14f; - ribbonOffset += Vector2.UnitX.RotatedBy(npc.rotation) * direction * 26f; + Vector2 ribbonOffset = -Vector2.UnitY.RotatedBy(NPC.rotation) * 14f; + ribbonOffset += Vector2.UnitX.RotatedBy(NPC.rotation) * direction * 26f; - float currentSegmentRotation = npc.rotation; + float currentSegmentRotation = NPC.rotation; List ribbonDrawPositions = new List(); for (int i = 0; i < 12; i++) { float ribbonCompletionRatio = i / 12f; - float wrappedAngularOffset = MathHelper.WrapAngle(npc.oldRot[i + 1] - currentSegmentRotation) * 0.3f; + float wrappedAngularOffset = MathHelper.WrapAngle(NPC.oldRot[i + 1] - currentSegmentRotation) * 0.3f; float segmentRotationOffset = MathHelper.Clamp(wrappedAngularOffset, -0.12f, 0.12f); // Add a sinusoidal offset that goes based on time and completion ratio to create a waving-flag-like effect. // This is dampened for the first few points to prevent weird offsets. It is also dampened by high velocity. float sinusoidalRotationOffset = (float)Math.Sin(ribbonCompletionRatio * 2.22f + Main.GlobalTime * 3.4f) * 1.36f; float sinusoidalRotationOffsetFactor = Utils.InverseLerp(0f, 0.37f, ribbonCompletionRatio, true) * direction * 24f; - sinusoidalRotationOffsetFactor *= Utils.InverseLerp(24f, 16f, npc.velocity.Length(), true); + sinusoidalRotationOffsetFactor *= Utils.InverseLerp(24f, 16f, NPC.velocity.Length(), true); - Vector2 sinusoidalOffset = Vector2.UnitY.RotatedBy(npc.rotation + sinusoidalRotationOffset) * sinusoidalRotationOffsetFactor; + Vector2 sinusoidalOffset = Vector2.UnitY.RotatedBy(NPC.rotation + sinusoidalRotationOffset) * sinusoidalRotationOffsetFactor; Vector2 ribbonSegmentOffset = Vector2.UnitY.RotatedBy(currentSegmentRotation) * ribbonCompletionRatio * 540f + sinusoidalOffset; - ribbonDrawPositions.Add(npc.Center + ribbonSegmentOffset + ribbonOffset); + ribbonDrawPositions.Add(NPC.Center + ribbonSegmentOffset + ribbonOffset); currentSegmentRotation += segmentRotationOffset; } @@ -1330,23 +1331,23 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } } - texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Artemis/ArtemisGlow"); + texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Artemis/ArtemisGlow"); if (CalamityConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { Color afterimageColor = drawColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * npc.scale / 2f; - afterimageCenter += origin * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0f); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX, maxFramesY) * NPC.scale / 2f; + afterimageCenter += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, NPC.frame, afterimageColor, NPC.oldRot[i], origin, NPC.scale, SpriteEffects.None, 0f); } } - spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, origin, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, center, frame, Color.White * NPC.Opacity, NPC.rotation, origin, NPC.scale, SpriteEffects.None, 0f); spriteBatch.ExitShaderRegion(); @@ -1355,12 +1356,12 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { for (int direction = -1; direction <= 1; direction++) { - Vector2 baseDrawOffset = new Vector2(0f, direction == 0f ? 18f : 60f).RotatedBy(npc.rotation); - baseDrawOffset += new Vector2(direction * 64f, 0f).RotatedBy(npc.rotation); + Vector2 baseDrawOffset = new Vector2(0f, direction == 0f ? 18f : 60f).RotatedBy(NPC.rotation); + baseDrawOffset += new Vector2(direction * 64f, 0f).RotatedBy(NPC.rotation); float backFlameLength = direction == 0f ? 700f : 190f; - Vector2 drawStart = npc.Center + baseDrawOffset; - Vector2 drawEnd = drawStart - (npc.rotation - MathHelper.PiOver2).ToRotationVector2() * ChargeFlash * backFlameLength; + Vector2 drawStart = NPC.Center + baseDrawOffset; + Vector2 drawEnd = drawStart - (NPC.rotation - MathHelper.PiOver2).ToRotationVector2() * ChargeFlash * backFlameLength; Vector2[] drawPositions = new Vector2[] { drawStart, @@ -1389,29 +1390,29 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Artemis/Artemis1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Artemis/Artemis2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Artemis/Artemis3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Artemis/Artemis4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Artemis/Artemis5"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Artemis/Artemis1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Artemis/Artemis2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Artemis/Artemis3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Artemis/Artemis4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Artemis/Artemis5"), 1f); } } @@ -1436,8 +1437,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/ExoMechs/Draedon.cs b/NPCs/ExoMechs/Draedon.cs index 6b96aef72b..10038d8d92 100644 --- a/NPCs/ExoMechs/Draedon.cs +++ b/NPCs/ExoMechs/Draedon.cs @@ -12,6 +12,7 @@ using Terraria.ModLoader; using ApolloBoss = CalamityMod.NPCs.ExoMechs.Apollo.Apollo; using ArtemisBoss = CalamityMod.NPCs.ExoMechs.Artemis.Artemis; +using Terraria.Audio; namespace CalamityMod.NPCs.ExoMechs { @@ -21,24 +22,24 @@ namespace CalamityMod.NPCs.ExoMechs public bool ShouldStartStandingUp; public Vector2 HoverDestinationOffset { - get => new Vector2(npc.ai[1], npc.ai[2]); + get => new Vector2(NPC.ai[1], NPC.ai[2]); set { - npc.ai[1] = value.X; - npc.ai[2] = value.Y; + NPC.ai[1] = value.X; + NPC.ai[2] = value.Y; } } - public Player PlayerToFollow => Main.player[npc.target]; - public ref float TalkTimer => ref npc.ai[0]; - public ref float GeneralTimer => ref npc.ai[3]; - public ref float DialogueType => ref npc.localAI[0]; - public ref float HologramEffectTimer => ref npc.localAI[1]; + public Player PlayerToFollow => Main.player[NPC.target]; + public ref float TalkTimer => ref NPC.ai[0]; + public ref float GeneralTimer => ref NPC.ai[3]; + public ref float DialogueType => ref NPC.localAI[0]; + public ref float HologramEffectTimer => ref NPC.localAI[1]; public bool HasBeenKilled { - get => npc.localAI[2] == 1f; - set => npc.localAI[2] = value.ToInt(); + get => NPC.localAI[2] == 1f; + set => NPC.localAI[2] = value.ToInt(); } - public ref float KillReappearDelay => ref npc.localAI[3]; + public ref float KillReappearDelay => ref NPC.localAI[3]; public static bool ExoMechIsPresent { get @@ -67,22 +68,22 @@ namespace CalamityMod.NPCs.ExoMechs public override void SetStaticDefaults() { DisplayName.SetDefault("Draedon"); - Main.npcFrameCount[npc.type] = 12; + Main.npcFrameCount[NPC.type] = 12; } public override void SetDefaults() { - npc.damage = 0; - npc.width = npc.height = 86; - npc.defense = 100; - npc.lifeMax = 16000; - npc.noGravity = true; - npc.noTileCollide = true; - npc.dontTakeDamage = true; - npc.aiStyle = aiType = -1; - npc.knockBackResist = 0f; - npc.DeathSound = SoundID.NPCDeath14; - npc.Calamity().DoesNotGenerateRage = true; + NPC.damage = 0; + NPC.width = NPC.height = 86; + NPC.defense = 100; + NPC.lifeMax = 16000; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.dontTakeDamage = true; + NPC.aiStyle = aiType = -1; + NPC.knockBackResist = 0f; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.Calamity().DoesNotGenerateRage = true; } public override void SendExtraAI(BinaryWriter writer) @@ -108,41 +109,41 @@ namespace CalamityMod.NPCs.ExoMechs public override void AI() { // Set the whoAmI variable. - CalamityGlobalNPC.draedon = npc.whoAmI; + CalamityGlobalNPC.draedon = NPC.whoAmI; // Prevent stupid natural despawns. - npc.timeLeft = 3600; + NPC.timeLeft = 3600; // Decide an initial target and play a teleport sound on the first frame. if (TalkTimer == 0f) { - npc.TargetClosest(false); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DraedonTeleport"), PlayerToFollow.Center); + NPC.TargetClosest(false); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DraedonTeleport"), PlayerToFollow.Center); } // Pick someone else to pay attention to if the old target is gone. if (PlayerToFollow.dead || !PlayerToFollow.active) { - npc.TargetClosest(false); + NPC.TargetClosest(false); // Fuck off if no living target exists. if (PlayerToFollow.dead || !PlayerToFollow.active) { - npc.life = 0; - npc.active = false; + NPC.life = 0; + NPC.active = false; return; } } // Stay within the world. - npc.position.Y = MathHelper.Clamp(npc.position.Y, 150f, Main.maxTilesY * 16f - 150f); + NPC.position.Y = MathHelper.Clamp(NPC.position.Y, 150f, Main.maxTilesY * 16f - 150f); - npc.spriteDirection = (PlayerToFollow.Center.X < npc.Center.X).ToDirectionInt(); + NPC.spriteDirection = (PlayerToFollow.Center.X < NPC.Center.X).ToDirectionInt(); // Handle delays when re-appearing after being killed. if (KillReappearDelay > 0f) { - npc.Opacity = 0f; + NPC.Opacity = 0f; KillReappearDelay--; if (KillReappearDelay <= 0f) CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndKillAttemptText", TextColor); @@ -154,7 +155,7 @@ namespace CalamityMod.NPCs.ExoMechs if (TalkTimer <= HologramFadeinTime) { HologramEffectTimer = TalkTimer; - npc.Opacity = Utils.InverseLerp(0f, 8f, TalkTimer, true); + NPC.Opacity = Utils.InverseLerp(0f, 8f, TalkTimer, true); } // Play the stand up animation after teleportation. @@ -165,31 +166,31 @@ namespace CalamityMod.NPCs.ExoMechs if (CalamityWorld.TalkedToDraedon && TalkTimer > 70 && TalkTimer < TalkDelay * 4f - 25f) { TalkTimer = TalkDelay * 4f - 25f; - npc.netUpdate = true; + NPC.netUpdate = true; } if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText1", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText2", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine * 2f) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText3", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine * 3f) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText4", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } // Inform the player who summoned draedon they may choose the first mech and cause a selection UI to appear over their head. @@ -207,7 +208,7 @@ namespace CalamityMod.NPCs.ExoMechs CalamityNetcode.SyncWorld(); } - npc.netUpdate = true; + NPC.netUpdate = true; } // Wait for the player to select an exo mech. @@ -239,7 +240,7 @@ namespace CalamityMod.NPCs.ExoMechs if (Main.netMode != NetmodeID.Server) { - var sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"), PlayerToFollow.Center); + var sound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"), PlayerToFollow.Center); CalamityUtils.SafeVolumeChange(ref sound, 1.55f); } } @@ -252,13 +253,13 @@ namespace CalamityMod.NPCs.ExoMechs if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase1Text1", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase1Text2", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } break; @@ -267,18 +268,18 @@ namespace CalamityMod.NPCs.ExoMechs if (TalkTimer == ExoMechPhaseDialogueTime) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DraedonLaugh"), PlayerToFollow.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DraedonLaugh"), PlayerToFollow.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase2Text1", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } } if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase2Text2", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } break; @@ -288,16 +289,16 @@ namespace CalamityMod.NPCs.ExoMechs if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase3Text1", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } if (TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DraedonLaugh"), PlayerToFollow.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DraedonLaugh"), PlayerToFollow.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase3Text2", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } } @@ -308,13 +309,13 @@ namespace CalamityMod.NPCs.ExoMechs if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase4Text1", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase4Text2", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } break; @@ -324,13 +325,13 @@ namespace CalamityMod.NPCs.ExoMechs if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase5Text1", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase5Text2", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } break; @@ -340,22 +341,22 @@ namespace CalamityMod.NPCs.ExoMechs if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase6Text1", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase6Text2", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } if (TalkTimer == ExoMechPhaseDialogueTime + DelayPerDialogLine * 2f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DraedonLaugh"), PlayerToFollow.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DraedonLaugh"), PlayerToFollow.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonExoPhase6Text3", TextColor); - npc.netUpdate = true; + NPC.netUpdate = true; } } @@ -369,7 +370,7 @@ namespace CalamityMod.NPCs.ExoMechs } if (!ExoMechIsPresent && DefeatTimer <= 0f) - music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DraedonAmbience"); + music = Mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DraedonAmbience"); if (ExoMechIsPresent) music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; @@ -383,14 +384,14 @@ namespace CalamityMod.NPCs.ExoMechs if (Main.netMode != NetmodeID.MultiplayerClient && HoverDestinationOffset == Vector2.Zero) { HoverDestinationOffset = -Vector2.UnitY * 700f; - npc.netUpdate = true; + NPC.netUpdate = true; } // Switch hover destinations from time to time. if (Main.netMode != NetmodeID.MultiplayerClient && GeneralTimer % 480f == 479f) { Vector2 offsetDirection; - Vector2 directionToTarget = npc.SafeDirectionTo(PlayerToFollow.Center); + Vector2 directionToTarget = NPC.SafeDirectionTo(PlayerToFollow.Center); // Reroll the offset direction if its direction noticably contrasts the current direction from the target. // This is done to prevent Draedon from selecting a position to zoom to that would make him have to move @@ -400,33 +401,33 @@ namespace CalamityMod.NPCs.ExoMechs while (Vector2.Dot(directionToTarget, offsetDirection) > 0.2f); HoverDestinationOffset = offsetDirection * Main.rand.NextFloat(750f, 1100f); - npc.netUpdate = true; + NPC.netUpdate = true; } // Always hover to the side of the target when defeated. if (DefeatTimer > 5f) - HoverDestinationOffset = Vector2.UnitX * (PlayerToFollow.Center.X < npc.Center.X).ToDirectionInt() * 325f; + HoverDestinationOffset = Vector2.UnitX * (PlayerToFollow.Center.X < NPC.Center.X).ToDirectionInt() * 325f; Vector2 hoverDestination = PlayerToFollow.Center + HoverDestinationOffset; // Decide sprite direction based on movement if not close enough to the desination. // Not deciding this here results in Draedon using the default of looking at the target he's following. - if (npc.WithinRange(hoverDestination, 300f)) + if (NPC.WithinRange(hoverDestination, 300f)) { - npc.velocity *= 0.96f; + NPC.velocity *= 0.96f; - float moveSpeed = MathHelper.Lerp(2f, 8f, Utils.InverseLerp(45f, 275f, npc.Distance(hoverDestination), true)); - npc.Center = npc.Center.MoveTowards(hoverDestination, moveSpeed); + float moveSpeed = MathHelper.Lerp(2f, 8f, Utils.InverseLerp(45f, 275f, NPC.Distance(hoverDestination), true)); + NPC.Center = NPC.Center.MoveTowards(hoverDestination, moveSpeed); } else { if (DefeatTimer < DelayBeforeDefeatStandup) - npc.spriteDirection = (npc.velocity.X < 0f).ToDirectionInt(); + NPC.spriteDirection = (NPC.velocity.X < 0f).ToDirectionInt(); float flySpeed = DefeatTimer > 5f ? 14f : 32f; - Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * flySpeed; - npc.SimpleFlyMovement(idealVelocity, flySpeed / 400f); - npc.velocity = Vector2.Lerp(npc.velocity, idealVelocity, 0.045f); + Vector2 idealVelocity = NPC.SafeDirectionTo(hoverDestination) * flySpeed; + NPC.SimpleFlyMovement(idealVelocity, flySpeed / 400f); + NPC.velocity = Vector2.Lerp(NPC.velocity, idealVelocity, 0.045f); } } @@ -461,9 +462,9 @@ namespace CalamityMod.NPCs.ExoMechs public void HandleDefeatStuff() { // Become vulnerable after being defeated after a certain point. - npc.dontTakeDamage = DefeatTimer < TalkDelay * 2f + 50f || HasBeenKilled; - npc.Calamity().CanHaveBossHealthBar = !npc.dontTakeDamage; - npc.Calamity().ShouldCloseHPBar = HasBeenKilled; + NPC.dontTakeDamage = DefeatTimer < TalkDelay * 2f + 50f || HasBeenKilled; + NPC.Calamity().CanHaveBossHealthBar = !NPC.dontTakeDamage; + NPC.Calamity().ShouldCloseHPBar = HasBeenKilled; bool leaving = DefeatTimer > DelayBeforeDefeatStandup + TalkDelay * 7f + 200f; @@ -472,7 +473,7 @@ namespace CalamityMod.NPCs.ExoMechs { HologramEffectTimer = MathHelper.Clamp(HologramEffectTimer - 1f, 0f, HologramFadeinTime); if (HologramEffectTimer <= 0f) - npc.active = false; + NPC.active = false; } // Fade back in as a hologram if the player tried to kill Draedon. @@ -480,9 +481,9 @@ namespace CalamityMod.NPCs.ExoMechs HologramEffectTimer = MathHelper.Clamp(HologramEffectTimer + 1f, 0f, HologramFadeinTime - 5f); // Adjust opacity. - npc.Opacity = HologramEffectTimer / HologramFadeinTime; + NPC.Opacity = HologramEffectTimer / HologramFadeinTime; if (HasBeenKilled) - npc.Opacity *= 0.67f; + NPC.Opacity *= 0.67f; // Stand up in awe after a small amount of time has passed. if (DefeatTimer > DelayBeforeDefeatStandup && DefeatTimer < TalkDelay * 2f + 50f) @@ -528,16 +529,16 @@ namespace CalamityMod.NPCs.ExoMechs Color color = Color.Lerp(drawColor, Color.Cyan, 1f - (float)Math.Pow(teleportFade, 5D)); color.A = (byte)(int)(teleportFade * 255f); - return color * npc.Opacity; + return color * NPC.Opacity; } public override void FindFrame(int frameHeight) { - npc.frame.Width = 100; + NPC.frame.Width = 100; - int xFrame = npc.frame.X / npc.frame.Width; - int yFrame = npc.frame.Y / frameHeight; - int frame = xFrame * Main.npcFrameCount[npc.type] + yFrame; + int xFrame = NPC.frame.X / NPC.frame.Width; + int yFrame = NPC.frame.Y / frameHeight; + int frame = xFrame * Main.npcFrameCount[NPC.type] + yFrame; // Prepare to stand up if called for and not already doing so. if (ShouldStartStandingUp && frame > 23) @@ -546,8 +547,8 @@ namespace CalamityMod.NPCs.ExoMechs int frameChangeDelay = 7; bool shouldNotSitDown = DefeatTimer > DelayBeforeDefeatStandup && DefeatTimer < TalkDelay * 2f + 10f; - npc.frameCounter++; - if (npc.frameCounter >= frameChangeDelay) + NPC.frameCounter++; + if (NPC.frameCounter >= frameChangeDelay) { frame++; @@ -564,21 +565,21 @@ namespace CalamityMod.NPCs.ExoMechs ShouldStartStandingUp = false; } - npc.frameCounter = 0; + NPC.frameCounter = 0; } - npc.frame.X = frame / Main.npcFrameCount[npc.type] * npc.frame.Width; - npc.frame.Y = frame % Main.npcFrameCount[npc.type] * frameHeight; + NPC.frame.X = frame / Main.npcFrameCount[NPC.type] * NPC.frame.Width; + NPC.frame.Y = frame % Main.npcFrameCount[NPC.type] * frameHeight; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = 16000; + NPC.lifeMax = 16000; } public override void HitEffect(int hitDirection, double damage) { - if (npc.life > 0) + if (NPC.life > 0) return; for (int i = 1; i <= 4; i++) @@ -586,10 +587,10 @@ namespace CalamityMod.NPCs.ExoMechs Vector2 goreSpawnOffset = Main.rand.NextVector2Circular(12f, 12f); Vector2 draedonPieceVelocity = Main.rand.NextVector2CircularEdge(7f, 7f) - Vector2.UnitY * 8f; Vector2 chairPieceVelocity = Vector2.UnitY.RotatedByRandom(0.13f) * Main.rand.NextFloat(4.45f, 5.4f); - Gore.NewGoreDirect(npc.Center + goreSpawnOffset, draedonPieceVelocity, mod.GetGoreSlot($"Gores/Draedon/Draedon{i}")); + Gore.NewGoreDirect(NPC.Center + goreSpawnOffset, draedonPieceVelocity, Mod.GetGoreSlot($"Gores/Draedon/Draedon{i}")); goreSpawnOffset = Main.rand.NextVector2Circular(18f, 18f); - Gore.NewGoreDirect(npc.Center + goreSpawnOffset, chairPieceVelocity, mod.GetGoreSlot($"Gores/Draedon/Chair{i}")); + Gore.NewGoreDirect(NPC.Center + goreSpawnOffset, chairPieceVelocity, Mod.GetGoreSlot($"Gores/Draedon/Chair{i}")); } } @@ -599,11 +600,11 @@ namespace CalamityMod.NPCs.ExoMechs { HologramEffectTimer = 0f; KillReappearDelay = 90f; - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; HasBeenKilled = true; - npc.life = npc.lifeMax; - npc.active = true; - npc.netUpdate = true; + NPC.life = NPC.lifeMax; + NPC.active = true; + NPC.netUpdate = true; } return false; } @@ -612,8 +613,8 @@ namespace CalamityMod.NPCs.ExoMechs public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { damage *= 56D; - if (damage < npc.lifeMax) - damage = npc.lifeMax + Main.rand.NextFloat(50f, 750f); + if (damage < NPC.lifeMax) + damage = NPC.lifeMax + Main.rand.NextFloat(50f, 750f); crit = true; return true; } @@ -622,26 +623,26 @@ namespace CalamityMod.NPCs.ExoMechs { spriteBatch.EnterShaderRegion(); - Texture2D texture = Main.npcTexture[npc.type]; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/DraedonGlowmask"); - Rectangle frame = npc.frame; + Texture2D texture = Main.npcTexture[NPC.type]; + Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/DraedonGlowmask"); + Rectangle frame = NPC.frame; - Vector2 drawPosition = npc.Center - Main.screenPosition - Vector2.UnitY * 38f; + Vector2 drawPosition = NPC.Center - Main.screenPosition - Vector2.UnitY * 38f; Vector2 origin = frame.Size() * 0.5f; - Color color = npc.GetAlpha(drawColor); - SpriteEffects direction = npc.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Color color = NPC.GetAlpha(drawColor); + SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; GameShaders.Misc["CalamityMod:TeleportDisplacement"].UseOpacity(MathHelper.Clamp(1f - HologramEffectTimer / HologramFadeinTime, 0f, 1f) * 0.38f); GameShaders.Misc["CalamityMod:TeleportDisplacement"].UseSecondaryColor(color); GameShaders.Misc["CalamityMod:TeleportDisplacement"].UseSaturation(color.A / 255f); - GameShaders.Misc["CalamityMod:TeleportDisplacement"].Shader.Parameters["frameCount"].SetValue(new Vector2(16f, Main.npcFrameCount[npc.type])); + GameShaders.Misc["CalamityMod:TeleportDisplacement"].Shader.Parameters["frameCount"].SetValue(new Vector2(16f, Main.npcFrameCount[NPC.type])); GameShaders.Misc["CalamityMod:TeleportDisplacement"].Apply(); - spriteBatch.Draw(texture, drawPosition, frame, drawColor * npc.Opacity, npc.rotation, origin, npc.scale, direction, 0f); + spriteBatch.Draw(texture, drawPosition, frame, drawColor * NPC.Opacity, NPC.rotation, origin, NPC.scale, direction, 0f); spriteBatch.ExitShaderRegion(); if (HologramEffectTimer >= HologramFadeinTime) - spriteBatch.Draw(glowmask, drawPosition, frame, Color.White * npc.Opacity, npc.rotation, origin, npc.scale, direction, 0f); + spriteBatch.Draw(glowmask, drawPosition, frame, Color.White * NPC.Opacity, NPC.rotation, origin, NPC.scale, direction, 0f); return false; } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index f0d61452fb..b6b7dfb82f 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -10,6 +10,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.ExoMechs.Thanatos { @@ -48,43 +49,43 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void SetStaticDefaults() { DisplayName.SetDefault("XM-05 Thanatos"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 5f; - npc.GetNPCDamage(); - npc.width = 88; - npc.height = 88; - npc.defense = 100; - npc.DR_NERD(0.9999f); - npc.Calamity().unbreakableDR = true; - npc.LifeMaxNERB(960000, 1150000, 500000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 5f; + NPC.GetNPCDamage(); + NPC.width = 88; + NPC.height = 88; + NPC.defense = 100; + NPC.DR_NERD(0.9999f); + NPC.Calamity().unbreakableDR = true; + NPC.LifeMaxNERB(960000, 1150000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.Opacity = 0f; - npc.canGhostHeal = false; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - npc.boss = true; + NPC.knockBackResist = 0f; + NPC.Opacity = 0f; + NPC.canGhostHeal = false; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + NPC.boss = true; music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void BossHeadSlot(ref int index) { - if (Main.npc[(int)npc.ai[2]].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune) + if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune) index = -1; else if (vulnerable) index = vulnerableIconIndex; @@ -94,40 +95,40 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void BossHeadRotation(ref float rotation) { - rotation = npc.rotation; + rotation = NPC.rotation; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.chaseable); + writer.Write(NPC.dontTakeDamage); writer.Write(noContactDamageTimer); writer.Write(vulnerable); - writer.Write(npc.localAI[0]); + writer.Write(NPC.localAI[0]); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); noContactDamageTimer = reader.ReadInt32(); vulnerable = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); + NPC.localAI[0] = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -147,37 +148,37 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; return; } // Set vulnerable to false by default vulnerable = false; - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; + NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; if (!invisiblePhase) { - if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + if (Main.npc[(int)NPC.ai[1]].Opacity > 0.5f) { if (noContactDamageTimer > 0) noContactDamageTimer--; - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } else { @@ -190,16 +191,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Deal no contact damage for 3 seconds after becoming visible noContactDamageTimer = 185; - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } // Number of body segments int numSegments = ThanatosHead.minLength; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Check if the other exo mechs are alive int otherExoMechsAlive = 0; @@ -249,8 +250,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.netMode != NetmodeID.MultiplayerClient) { // Only charge up lasers if not venting or firing lasers - if (npc.Calamity().newAI[0] == 0f) - npc.ai[3] += 1f; + if (NPC.Calamity().newAI[0] == 0f) + NPC.ai[3] += 1f; double numSegmentsAbleToFire = malice ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D; if (shouldGetBuffedByBerserkPhase) @@ -261,18 +262,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge) { float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 90f; - if ((npc.ai[3] % divisor == 0f && npc.ai[0] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) + if ((NPC.ai[3] % divisor == 0f && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers vulnerable = true; - if (npc.Calamity().newAI[1] == 0f) + if (NPC.Calamity().newAI[1] == 0f) { - npc.Calamity().newAI[0] += 1f; - if (npc.Calamity().newAI[0] >= timeToOpenAndFireLasers) + NPC.Calamity().newAI[0] += 1f; + if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers) { - npc.ai[3] = 0f; - npc.Calamity().newAI[1] = 1f; + NPC.ai[3] = 0f; + NPC.Calamity().newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { int maxTargets = 3; @@ -287,7 +288,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos continue; Vector2 playerCenter = Main.player[i].Center; - float distance = Vector2.Distance(playerCenter, npc.Center); + float distance = Vector2.Distance(playerCenter, NPC.Center); if (distance < maxDistance) { whoAmIArray[numProjectiles] = i; @@ -299,7 +300,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - SoundEffectInstance sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + SoundEffectInstance sound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), NPC.Center); if (sound != null) sound.Volume *= 0.1f; @@ -307,38 +308,38 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Normal laser int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } } else { - npc.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; - if (npc.Calamity().newAI[0] <= 0f) + NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; + if (NPC.Calamity().newAI[0] <= 0f) { - npc.Calamity().newAI[0] = 0f; - npc.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; } } } } else { - float divisor = npc.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300 - if ((npc.ai[3] == divisor && npc.ai[0] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) + float divisor = NPC.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300 + if ((NPC.ai[3] == divisor && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers vulnerable = true; - if (npc.Calamity().newAI[1] == 0f) + if (NPC.Calamity().newAI[1] == 0f) { - npc.Calamity().newAI[0] += 1f; - if (npc.Calamity().newAI[0] >= timeToOpenAndFireLasers) + NPC.Calamity().newAI[0] += 1f; + if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers) { - npc.ai[3] = 0f; - npc.Calamity().newAI[1] = 1f; + NPC.ai[3] = 0f; + NPC.Calamity().newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { int maxTargets = 3; @@ -353,7 +354,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos continue; Vector2 playerCenter = Main.player[i].Center; - float distance = Vector2.Distance(playerCenter, npc.Center); + float distance = Vector2.Distance(playerCenter, NPC.Center); if (distance < maxDistance) { whoAmIArray[numProjectiles] = i; @@ -366,33 +367,33 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } float predictionAmt = malice ? 24f : death ? 20f : revenge ? 18f : expertMode ? 16f : 12f; - if (npc.ai[0] % 3f == 0f) + if (NPC.ai[0] % 3f == 0f) predictionAmt *= 0.5f; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + int damage = NPC.GetProjectileDamage(type); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), NPC.Center); for (int i = 0; i < numProjectiles; i++) { // Fire normal lasers if head is in passive state if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive) { // Normal laser - Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } else { // Normal laser - if (shouldGetBuffedByBerserkPhase && npc.ai[0] % 3f == 0f) - Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + if (shouldGetBuffedByBerserkPhase && NPC.ai[0] % 3f == 0f) + Projectile.NewProjectile(NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); // Predictive laser Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt; - Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); // Opposite laser projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt; - Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -400,11 +401,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - npc.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; - if (npc.Calamity().newAI[0] <= 0f) + NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; + if (NPC.Calamity().newAI[0] <= 0f) { - npc.Calamity().newAI[0] = 0f; - npc.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; } } } @@ -413,14 +414,14 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - if (npc.ai[3] > 0f) - npc.ai[3] = 0f; + if (NPC.ai[3] > 0f) + NPC.ai[3] = 0f; - npc.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; - if (npc.Calamity().newAI[0] <= 0f) + NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; + if (NPC.Calamity().newAI[0] <= 0f) { - npc.Calamity().newAI[0] = 0f; - npc.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; } else { @@ -430,64 +431,64 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } // Do not deal contact damage for 5 seconds after spawning - if (npc.Calamity().newAI[2] == 0f) + if (NPC.Calamity().newAI[2] == 0f) noContactDamageTimer = 300; - if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) - npc.Calamity().newAI[2] += 1f; + if (NPC.Calamity().newAI[2] < ThanatosHead.immunityTime) + NPC.Calamity().newAI[2] += 1f; // Homing only works if vulnerable is true - npc.chaseable = vulnerable; + NPC.chaseable = vulnerable; // Adjust DR based on vulnerable - npc.Calamity().DR = vulnerable ? 0f : 0.9999f; - npc.Calamity().unbreakableDR = !vulnerable; + NPC.Calamity().DR = vulnerable ? 0f : 0.9999f; + NPC.Calamity().unbreakableDR = !vulnerable; // Increase overall damage taken while vulnerable float damageMult = malice ? 1.1f : death ? 1.2f : revenge ? 1.25f : expertMode ? 1.3f : 1.4f; if (shouldGetBuffedByBerserkPhase) damageMult -= malice ? 0.1f : death ? 0.175f : revenge ? 0.2f : expertMode ? 0.225f : 0.3f; - npc.takenDamageMultiplier = vulnerable ? damageMult : 1f; + NPC.takenDamageMultiplier = vulnerable ? damageMult : 1f; // Vent noise and steam SmokeDrawer.ParticleSpawnRate = 9999999; if (vulnerable) { // Light - Lighting.AddLight(npc.Center, 0.35f * npc.Opacity, 0.05f * npc.Opacity, 0.05f * npc.Opacity); + Lighting.AddLight(NPC.Center, 0.35f * NPC.Opacity, 0.05f * NPC.Opacity, 0.05f * NPC.Opacity); // Noise float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.1f : 1f; - if (npc.localAI[0] == 0f) + if (NPC.localAI[0] == 0f) { - SoundEffectInstance sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center); + SoundEffectInstance sound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), NPC.Center); if (sound != null) sound.Volume *= volume; } // Steam - npc.localAI[0] += 1f; + NPC.localAI[0] += 1f; float actualVentDuration = lastMechAlive ? 90f : shouldGetBuffedByBerserkPhase ? 120f : ThanatosHead.ventDuration; - if (npc.localAI[0] < actualVentDuration) + if (NPC.localAI[0] < actualVentDuration) { - SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2; + SmokeDrawer.BaseMoveRotation = NPC.rotation - MathHelper.PiOver2; SmokeDrawer.ParticleSpawnRate = ThanatosHead.ventCloudSpawnRate; } } else { // Light - Lighting.AddLight(npc.Center, 0.05f * npc.Opacity, 0.2f * npc.Opacity, 0.2f * npc.Opacity); + Lighting.AddLight(NPC.Center, 0.05f * NPC.Opacity, 0.2f * NPC.Opacity, 0.2f * NPC.Opacity); - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; } SmokeDrawer.Update(); Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; - Vector2 npcCenter = npc.Center; + Vector2 npcCenter = NPC.Center; float targetCenterX = player.Center.X; float targetCenterY = player.Center.Y; targetCenterX = (int)(targetCenterX / 16f) * 16; @@ -498,30 +499,30 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos targetCenterY -= npcCenter.Y; float distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - npcCenter = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - targetCenterX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - npcCenter.X; - targetCenterY = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - npcCenter.Y; + npcCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + targetCenterX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - npcCenter.X; + targetCenterY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - npcCenter.Y; } catch { } - npc.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); - distanceFromTarget = (distanceFromTarget - npc.width) / distanceFromTarget; + distanceFromTarget = (distanceFromTarget - NPC.width) / distanceFromTarget; targetCenterX *= distanceFromTarget; targetCenterY *= distanceFromTarget; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + targetCenterX; - npc.position.Y = npc.position.Y + targetCenterY; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetCenterX; + NPC.position.Y = NPC.position.Y + targetCenterY; if (targetCenterX < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (targetCenterX > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } @@ -531,10 +532,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -544,12 +545,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (dist4 < minDist) minDist = dist4; - return minDist <= 50f && npc.Opacity == 1f && noContactDamageTimer <= 0; + return minDist <= 50f && NPC.Opacity == 1f && noContactDamageTimer <= 0; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) + if (NPC.Calamity().newAI[2] < ThanatosHead.immunityTime) damage *= 0.01; return true; @@ -557,55 +558,55 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void FindFrame(int frameHeight) // 5 total frames { - if (!Main.npc[(int)npc.ai[2]].active || Main.npc[(int)npc.ai[2]].life <= 0) + if (!Main.npc[(int)NPC.ai[2]].active || Main.npc[(int)NPC.ai[2]].life <= 0) return; // Swap between venting and non-venting frames - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; - npc.frameCounter += 1D; - if (npc.Calamity().newAI[0] > 0f) + NPC.frameCounter += 1D; + if (NPC.Calamity().newAI[0] > 0f) { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { - npc.frame.Y += frameHeight; - npc.frameCounter = 0D; + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; } - int finalFrame = Main.npcFrameCount[npc.type] - 1; - if (npc.frame.Y > frameHeight * finalFrame) - npc.frame.Y = frameHeight * finalFrame; + int finalFrame = Main.npcFrameCount[NPC.type] - 1; + if (NPC.frame.Y > frameHeight * finalFrame) + NPC.frame.Y = frameHeight * finalFrame; } else { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { - npc.frame.Y -= frameHeight; - npc.frameCounter = 0D; + NPC.frame.Y -= frameHeight; + NPC.frameCounter = 0D; } - if (npc.frame.Y < 0) - npc.frame.Y = 0; + if (NPC.frame.Y < 0) + NPC.frame.Y = 0; } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 vector = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture = Main.npcTexture[NPC.type]; + Vector2 vector = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); - Vector2 center = npc.Center - Main.screenPosition; - center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - center += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, center, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + Vector2 center = NPC.Center - Main.screenPosition; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosBody1Glow"); - spriteBatch.Draw(texture, center, npc.frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosBody1Glow"); + spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - SmokeDrawer.DrawSet(npc.Center); + SmokeDrawer.DrawSet(NPC.Center); return false; } @@ -616,46 +617,46 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 8; + NPC.soundDelay = 8; if (vulnerable) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), NPC.Center); else - Main.PlaySound(SoundID.NPCHit4, npc.Center); + SoundEngine.PlaySound(SoundID.NPCHit4, NPC.Center); } int baseDust = vulnerable ? 3 : 1; for (int k = 0; k < baseDust; k++) - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody1_2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody1_3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Thanatos/ThanatosBody1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Thanatos/ThanatosBody1_2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Thanatos/ThanatosBody1_3"), 1f); } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 3144d6392c..5bd35b9f10 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -10,6 +10,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.ExoMechs.Thanatos { @@ -48,43 +49,43 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void SetStaticDefaults() { DisplayName.SetDefault("XM-05 Thanatos"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 5f; - npc.GetNPCDamage(); - npc.width = 90; - npc.height = 90; - npc.defense = 100; - npc.DR_NERD(0.9999f); - npc.Calamity().unbreakableDR = true; - npc.LifeMaxNERB(960000, 1150000, 500000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 5f; + NPC.GetNPCDamage(); + NPC.width = 90; + NPC.height = 90; + NPC.defense = 100; + NPC.DR_NERD(0.9999f); + NPC.Calamity().unbreakableDR = true; + NPC.LifeMaxNERB(960000, 1150000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.Opacity = 0f; - npc.canGhostHeal = false; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - npc.boss = true; + NPC.knockBackResist = 0f; + NPC.Opacity = 0f; + NPC.canGhostHeal = false; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + NPC.boss = true; music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void BossHeadSlot(ref int index) { - if (Main.npc[(int)npc.ai[2]].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune) + if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune) index = -1; else if (vulnerable) index = vulnerableIconIndex; @@ -94,40 +95,40 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void BossHeadRotation(ref float rotation) { - rotation = npc.rotation; + rotation = NPC.rotation; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.chaseable); + writer.Write(NPC.dontTakeDamage); writer.Write(noContactDamageTimer); writer.Write(vulnerable); - writer.Write(npc.localAI[0]); + writer.Write(NPC.localAI[0]); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); noContactDamageTimer = reader.ReadInt32(); vulnerable = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); + NPC.localAI[0] = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -147,37 +148,37 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; return; } // Set vulnerable to false by default vulnerable = false; - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; + NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; if (!invisiblePhase) { - if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + if (Main.npc[(int)NPC.ai[1]].Opacity > 0.5f) { if (noContactDamageTimer > 0) noContactDamageTimer--; - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } else { @@ -190,16 +191,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Deal no contact damage for 3 seconds after becoming visible noContactDamageTimer = 185; - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } // Number of body segments int numSegments = ThanatosHead.minLength; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Check if the other exo mechs are alive int otherExoMechsAlive = 0; @@ -249,8 +250,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.netMode != NetmodeID.MultiplayerClient) { // Only charge up lasers if not venting or firing lasers - if (npc.Calamity().newAI[0] == 0f) - npc.ai[3] += 1f; + if (NPC.Calamity().newAI[0] == 0f) + NPC.ai[3] += 1f; double numSegmentsAbleToFire = malice ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D; if (shouldGetBuffedByBerserkPhase) @@ -261,18 +262,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge) { float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 90f; - if ((npc.ai[3] % divisor == 0f && npc.ai[0] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) + if ((NPC.ai[3] % divisor == 0f && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers vulnerable = true; - if (npc.Calamity().newAI[1] == 0f) + if (NPC.Calamity().newAI[1] == 0f) { - npc.Calamity().newAI[0] += 1f; - if (npc.Calamity().newAI[0] >= timeToOpenAndFireLasers) + NPC.Calamity().newAI[0] += 1f; + if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers) { - npc.ai[3] = 0f; - npc.Calamity().newAI[1] = 1f; + NPC.ai[3] = 0f; + NPC.Calamity().newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { int maxTargets = 3; @@ -287,7 +288,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos continue; Vector2 playerCenter = Main.player[i].Center; - float distance = Vector2.Distance(playerCenter, npc.Center); + float distance = Vector2.Distance(playerCenter, NPC.Center); if (distance < maxDistance) { whoAmIArray[numProjectiles] = i; @@ -299,7 +300,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - SoundEffectInstance sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + SoundEffectInstance sound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), NPC.Center); if (sound != null) sound.Volume *= 0.1f; @@ -307,38 +308,38 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Normal laser int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } } else { - npc.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; - if (npc.Calamity().newAI[0] <= 0f) + NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; + if (NPC.Calamity().newAI[0] <= 0f) { - npc.Calamity().newAI[0] = 0f; - npc.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; } } } } else { - float divisor = npc.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300 - if ((npc.ai[3] == divisor && npc.ai[0] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) + float divisor = NPC.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300 + if ((NPC.ai[3] == divisor && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers vulnerable = true; - if (npc.Calamity().newAI[1] == 0f) + if (NPC.Calamity().newAI[1] == 0f) { - npc.Calamity().newAI[0] += 1f; - if (npc.Calamity().newAI[0] >= timeToOpenAndFireLasers) + NPC.Calamity().newAI[0] += 1f; + if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers) { - npc.ai[3] = 0f; - npc.Calamity().newAI[1] = 1f; + NPC.ai[3] = 0f; + NPC.Calamity().newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { int maxTargets = 3; @@ -353,7 +354,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos continue; Vector2 playerCenter = Main.player[i].Center; - float distance = Vector2.Distance(playerCenter, npc.Center); + float distance = Vector2.Distance(playerCenter, NPC.Center); if (distance < maxDistance) { whoAmIArray[numProjectiles] = i; @@ -366,33 +367,33 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } float predictionAmt = malice ? 24f : death ? 20f : revenge ? 18f : expertMode ? 16f : 12f; - if (npc.ai[0] % 3f == 0f) + if (NPC.ai[0] % 3f == 0f) predictionAmt *= 0.5f; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + int damage = NPC.GetProjectileDamage(type); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), NPC.Center); for (int i = 0; i < numProjectiles; i++) { // Fire normal lasers if head is in passive state if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive) { // Normal laser - Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } else { // Normal laser - if (shouldGetBuffedByBerserkPhase && npc.ai[0] % 3f == 0f) - Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + if (shouldGetBuffedByBerserkPhase && NPC.ai[0] % 3f == 0f) + Projectile.NewProjectile(NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); // Predictive laser Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt; - Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); // Opposite laser projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt; - Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -400,11 +401,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - npc.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; - if (npc.Calamity().newAI[0] <= 0f) + NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; + if (NPC.Calamity().newAI[0] <= 0f) { - npc.Calamity().newAI[0] = 0f; - npc.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; } } } @@ -413,14 +414,14 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - if (npc.ai[3] > 0f) - npc.ai[3] = 0f; + if (NPC.ai[3] > 0f) + NPC.ai[3] = 0f; - npc.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; - if (npc.Calamity().newAI[0] <= 0f) + NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; + if (NPC.Calamity().newAI[0] <= 0f) { - npc.Calamity().newAI[0] = 0f; - npc.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; } else { @@ -430,64 +431,64 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } // Do not deal contact damage for 5 seconds after spawning - if (npc.Calamity().newAI[2] == 0f) + if (NPC.Calamity().newAI[2] == 0f) noContactDamageTimer = 300; - if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) - npc.Calamity().newAI[2] += 1f; + if (NPC.Calamity().newAI[2] < ThanatosHead.immunityTime) + NPC.Calamity().newAI[2] += 1f; // Homing only works if vulnerable is true - npc.chaseable = vulnerable; + NPC.chaseable = vulnerable; // Adjust DR based on vulnerable - npc.Calamity().DR = vulnerable ? 0f : 0.9999f; - npc.Calamity().unbreakableDR = !vulnerable; + NPC.Calamity().DR = vulnerable ? 0f : 0.9999f; + NPC.Calamity().unbreakableDR = !vulnerable; // Increase overall damage taken while vulnerable float damageMult = malice ? 1.1f : death ? 1.2f : revenge ? 1.25f : expertMode ? 1.3f : 1.4f; if (shouldGetBuffedByBerserkPhase) damageMult -= malice ? 0.1f : death ? 0.175f : revenge ? 0.2f : expertMode ? 0.225f : 0.3f; - npc.takenDamageMultiplier = vulnerable ? damageMult : 1f; + NPC.takenDamageMultiplier = vulnerable ? damageMult : 1f; // Vent noise and steam SmokeDrawer.ParticleSpawnRate = 9999999; if (vulnerable) { // Light - Lighting.AddLight(npc.Center, 0.35f * npc.Opacity, 0.05f * npc.Opacity, 0.05f * npc.Opacity); + Lighting.AddLight(NPC.Center, 0.35f * NPC.Opacity, 0.05f * NPC.Opacity, 0.05f * NPC.Opacity); // Noise float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.1f : 1f; - if (npc.localAI[0] == 0f) + if (NPC.localAI[0] == 0f) { - SoundEffectInstance sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center); + SoundEffectInstance sound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), NPC.Center); if (sound != null) sound.Volume *= volume; } // Steam - npc.localAI[0] += 1f; + NPC.localAI[0] += 1f; float actualVentDuration = lastMechAlive ? 90f : shouldGetBuffedByBerserkPhase ? 120f : ThanatosHead.ventDuration; - if (npc.localAI[0] < actualVentDuration) + if (NPC.localAI[0] < actualVentDuration) { - SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2; + SmokeDrawer.BaseMoveRotation = NPC.rotation - MathHelper.PiOver2; SmokeDrawer.ParticleSpawnRate = ThanatosHead.ventCloudSpawnRate; } } else { // Light - Lighting.AddLight(npc.Center, 0.05f * npc.Opacity, 0.2f * npc.Opacity, 0.2f * npc.Opacity); + Lighting.AddLight(NPC.Center, 0.05f * NPC.Opacity, 0.2f * NPC.Opacity, 0.2f * NPC.Opacity); - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; } SmokeDrawer.Update(); Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; - Vector2 npcCenter = npc.Center; + Vector2 npcCenter = NPC.Center; float targetCenterX = player.Center.X; float targetCenterY = player.Center.Y; targetCenterX = (int)(targetCenterX / 16f) * 16; @@ -498,31 +499,31 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos targetCenterY -= npcCenter.Y; float distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - npcCenter = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - targetCenterX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - npcCenter.X; - targetCenterY = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - npcCenter.Y; + npcCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + targetCenterX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - npcCenter.X; + targetCenterY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - npcCenter.Y; } catch { } - npc.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); - distanceFromTarget = (distanceFromTarget - npc.width) / distanceFromTarget; + distanceFromTarget = (distanceFromTarget - NPC.width) / distanceFromTarget; targetCenterX *= distanceFromTarget; targetCenterY *= distanceFromTarget; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + targetCenterX; - npc.position.Y = npc.position.Y + targetCenterY; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetCenterX; + NPC.position.Y = NPC.position.Y + targetCenterY; if (targetCenterX < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (targetCenterX > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } @@ -532,10 +533,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -545,12 +546,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (dist4 < minDist) minDist = dist4; - return minDist <= 50f && npc.Opacity == 1f && noContactDamageTimer <= 0; + return minDist <= 50f && NPC.Opacity == 1f && noContactDamageTimer <= 0; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) + if (NPC.Calamity().newAI[2] < ThanatosHead.immunityTime) damage *= 0.01; return true; @@ -558,55 +559,55 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void FindFrame(int frameHeight) // 5 total frames { - if (!Main.npc[(int)npc.ai[2]].active || Main.npc[(int)npc.ai[2]].life <= 0) + if (!Main.npc[(int)NPC.ai[2]].active || Main.npc[(int)NPC.ai[2]].life <= 0) return; // Swap between venting and non-venting frames - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; - npc.frameCounter += 1D; - if (npc.Calamity().newAI[0] > 0f) + NPC.frameCounter += 1D; + if (NPC.Calamity().newAI[0] > 0f) { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { - npc.frame.Y += frameHeight; - npc.frameCounter = 0D; + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; } - int finalFrame = Main.npcFrameCount[npc.type] - 1; - if (npc.frame.Y > frameHeight * finalFrame) - npc.frame.Y = frameHeight * finalFrame; + int finalFrame = Main.npcFrameCount[NPC.type] - 1; + if (NPC.frame.Y > frameHeight * finalFrame) + NPC.frame.Y = frameHeight * finalFrame; } else { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { - npc.frame.Y -= frameHeight; - npc.frameCounter = 0D; + NPC.frame.Y -= frameHeight; + NPC.frameCounter = 0D; } - if (npc.frame.Y < 0) - npc.frame.Y = 0; + if (NPC.frame.Y < 0) + NPC.frame.Y = 0; } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 vector = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture = Main.npcTexture[NPC.type]; + Vector2 vector = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); - Vector2 center = npc.Center - Main.screenPosition; - center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - center += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, center, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + Vector2 center = NPC.Center - Main.screenPosition; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosBody2Glow"); - spriteBatch.Draw(texture, center, npc.frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosBody2Glow"); + spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - SmokeDrawer.DrawSet(npc.Center); + SmokeDrawer.DrawSet(NPC.Center); return false; } @@ -617,46 +618,46 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 8; + NPC.soundDelay = 8; if (vulnerable) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), NPC.Center); else - Main.PlaySound(SoundID.NPCHit4, npc.Center); + SoundEngine.PlaySound(SoundID.NPCHit4, NPC.Center); } int baseDust = vulnerable ? 3 : 1; for (int k = 0; k < baseDust; k++) - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody2_2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody2_3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Thanatos/ThanatosBody2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Thanatos/ThanatosBody2_2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Thanatos/ThanatosBody2_3"), 1f); } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 56c3038e61..6836759869 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -13,6 +13,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Skies; +using Terraria.Audio; namespace CalamityMod.NPCs.ExoMechs.Thanatos { @@ -42,8 +43,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public float AIState { - get => npc.Calamity().newAI[0]; - set => npc.Calamity().newAI[0] = value; + get => NPC.Calamity().newAI[0]; + set => NPC.Calamity().newAI[0] = value; } public enum SecondaryPhase @@ -55,8 +56,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public float SecondaryAIState { - get => npc.Calamity().newAI[1]; - set => npc.Calamity().newAI[1] = value; + get => NPC.Calamity().newAI[1]; + set => NPC.Calamity().newAI[1] = value; } public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); @@ -107,41 +108,41 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void SetStaticDefaults() { DisplayName.SetDefault("XM-05 Thanatos"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; // Ensure that the reticle is not culled due to the player being very far from Thanatos. - NPCID.Sets.MustAlwaysDraw[npc.type] = true; + NPCID.Sets.MustAlwaysDraw[NPC.type] = true; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 5f; - npc.GetNPCDamage(); - npc.width = 164; - npc.height = 164; - npc.defense = 80; - npc.DR_NERD(0.9999f); - npc.Calamity().unbreakableDR = true; - npc.LifeMaxNERB(960000, 1150000, 500000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 5f; + NPC.GetNPCDamage(); + NPC.width = 164; + NPC.height = 164; + NPC.defense = 80; + NPC.DR_NERD(0.9999f); + NPC.Calamity().unbreakableDR = true; + NPC.LifeMaxNERB(960000, 1150000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.Opacity = 0f; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(15, 0, 0, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.boss = true; - npc.chaseable = false; + NPC.Opacity = 0f; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(15, 0, 0, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.boss = true; + NPC.chaseable = false; music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void BossHeadSlot(ref int index) @@ -156,37 +157,37 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void BossHeadRotation(ref float rotation) { - rotation = npc.rotation; + rotation = NPC.rotation; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.chaseable); + writer.Write(NPC.dontTakeDamage); writer.Write(noContactDamageTimer); writer.Write(chargeVelocityScalar); writer.Write(vulnerable); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); noContactDamageTimer = reader.ReadInt32(); chargeVelocityScalar = reader.ReadSingle(); vulnerable = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public float GetSlowdownAreaEdgeRadius(bool lastMechAlive) => @@ -223,9 +224,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - CalamityGlobalNPC.draedonExoMechWorm = npc.whoAmI; + CalamityGlobalNPC.draedonExoMechWorm = NPC.whoAmI; // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -234,18 +235,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); // Target variable - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; // Check if the other exo mechs are alive int otherExoMechsAlive = CheckForOtherMechs(ref player, out bool exoPrimeAlive, out bool exoTwinsAlive); @@ -288,12 +289,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Prevent mechs from being respawned if (otherExoMechWasFirst) { - if (npc.ai[3] < 1f) - npc.ai[3] = 1f; + if (NPC.ai[3] < 1f) + NPC.ai[3] = 1f; } // Phases - bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f; + bool spawnOtherExoMechs = lifeRatio < 0.7f && NPC.ai[3] == 0f; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; @@ -306,30 +307,30 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Whether Thanatos should be buffed while in berserk phase bool shouldGetBuffedByBerserkPhase = berserk && !otherMechIsBerserk; - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Spawn segments if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!tailSpawned && npc.ai[0] == 0f) + if (!tailSpawned && NPC.ai[0] == 0f) { - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { int lol; if (num36 >= 0 && num36 < minLength) { if (num36 % 2 == 0) - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); else - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } else - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = NPC.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); @@ -339,8 +340,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - if (npc.life > Main.npc[(int)npc.ai[0]].life) - npc.life = Main.npc[(int)npc.ai[0]].life; + if (NPC.life > Main.npc[(int)NPC.ai[0]].life) + NPC.life = Main.npc[(int)NPC.ai[0]].life; // General AI pattern // 0 - Fly towards the target for 7 seconds, gradually speeding up for the first 5 seconds and slowing down for the last 2 seconds, fire lasers from segments that are venting @@ -382,28 +383,28 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos bool targetDead = false; if (player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (player.dead) { targetDead = true; AIState = (float)Phase.Charge; - npc.localAI[0] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; chargeVelocityScalar = 0f; - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; - npc.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 1f; + NPC.velocity.Y -= 1f; + if ((double)NPC.position.Y < Main.topWorld + 16f) + NPC.velocity.Y -= 1f; - if ((double)npc.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || @@ -415,25 +416,25 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } // Rotation and direction - npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; - int direction = npc.direction; - npc.direction = npc.spriteDirection = (npc.velocity.X > 0f) ? 1 : (-1); - if (direction != npc.direction) - npc.netUpdate = true; + NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; + int direction = NPC.direction; + NPC.direction = NPC.spriteDirection = (NPC.velocity.X > 0f) ? 1 : (-1); + if (direction != NPC.direction) + NPC.netUpdate = true; // Default vector to fly to Vector2 destination = player.Center; // Move destination to somewhere far below the target for the first 3 seconds so that Thanatos can fully uncoil quickly bool speedUp = false; - if (npc.localAI[3] < 180f) + if (NPC.localAI[3] < 180f) { speedUp = true; destination += new Vector2(0f, 2400f); } // Distance from target - float distanceFromTarget = Vector2.Distance(npc.Center, destination); + float distanceFromTarget = Vector2.Distance(NPC.Center, destination); // Increase speed if too far from target float increaseSpeedMult = 1f; @@ -450,7 +451,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Laser Barrage variables float laserBarrageLocationBaseDistance = SecondaryAIState == (int)SecondaryPhase.PassiveAndImmune ? baseDistance * 2f : baseDistance; - Vector2 laserBarrageLocation = new Vector2(0f, npc.ai[1] % 2f == 0f ? laserBarrageLocationBaseDistance : -laserBarrageLocationBaseDistance); + Vector2 laserBarrageLocation = new Vector2(0f, NPC.ai[1] % 2f == 0f ? laserBarrageLocationBaseDistance : -laserBarrageLocationBaseDistance); float laserBarrageLocationDistance = turnDistance * 3f; // Velocity and turn speed values @@ -495,16 +496,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (spawnOtherExoMechs) { // Reset everything - if (npc.ai[3] < 1f) - npc.ai[3] = 1f; + if (NPC.ai[3] < 1f) + NPC.ai[3] = 1f; SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; - npc.localAI[0] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; chargeVelocityScalar = 0f; - npc.TargetClosest(); + NPC.TargetClosest(); // Draedon text for the start of phase 2 if (draedonAlive) @@ -531,12 +532,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Tells Thanatos to return to the battle in passive state and reset everything SecondaryAIState = (float)SecondaryPhase.Passive; - npc.localAI[0] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; chargeVelocityScalar = 0f; - npc.TargetClosest(); + NPC.TargetClosest(); } // Go passive and immune if one of the other mechs is berserk @@ -546,12 +547,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Reset everything SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; - npc.localAI[0] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; chargeVelocityScalar = 0f; - npc.TargetClosest(); + NPC.TargetClosest(); // Phase 6, when 1 mech goes berserk and the other one leaves if (draedonAlive) @@ -575,12 +576,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Reset everything SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; - npc.localAI[0] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; chargeVelocityScalar = 0f; - npc.TargetClosest(); + NPC.TargetClosest(); } // If Thanatos is the first mech to go berserk @@ -588,12 +589,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Reset everything AIState = (float)Phase.Charge; - npc.localAI[0] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; chargeVelocityScalar = 0f; - npc.TargetClosest(); + NPC.TargetClosest(); // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; @@ -623,12 +624,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Tells Thanatos to return to the battle in passive state and reset everything // Return to normal phases if one or more mechs have been downed SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive; - npc.localAI[0] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; chargeVelocityScalar = 0f; - npc.TargetClosest(); + NPC.TargetClosest(); // Phase 3, when all 3 mechs attack at the same time if (exoPrimeAlive && exoTwinsAlive) @@ -646,12 +647,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Reset everything AIState = (float)Phase.Charge; - npc.localAI[0] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; chargeVelocityScalar = 0f; - npc.TargetClosest(); + NPC.TargetClosest(); // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; @@ -662,24 +663,24 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Adjust opacity bool invisiblePhase = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = invisiblePhase; + NPC.dontTakeDamage = invisiblePhase; if (!invisiblePhase) { if (noContactDamageTimer > 0) noContactDamageTimer--; - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } else { // Deal no contact damage for 3 seconds after becoming visible noContactDamageTimer = 185; - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } // Attacking phases @@ -717,11 +718,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) { - AIState = npc.localAI[0] == 1f ? (float)Phase.Deathray : (float)Phase.UndergroundLaserBarrage; + AIState = NPC.localAI[0] == 1f ? (float)Phase.Deathray : (float)Phase.UndergroundLaserBarrage; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; chargeVelocityScalar = 0f; - npc.TargetClosest(); + NPC.TargetClosest(); } break; @@ -744,7 +745,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos baseVelocity *= laserBarragePhaseVelocityMult; turnSpeed *= laserBarragePhaseTurnSpeedMult; - if ((destination - npc.Center).Length() < laserBarrageLocationDistance || calamityGlobalNPC.newAI[2] > 0f) + if ((destination - NPC.Center).Length() < laserBarrageLocationDistance || calamityGlobalNPC.newAI[2] > 0f) { calamityGlobalNPC.newAI[2] += 1f; @@ -760,13 +761,13 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos calamityGlobalNPC.newAI[3] += 1f; if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime) { - npc.ai[1] += (shouldGetBuffedByBerserkPhase && revenge) ? 1f : 0f; - npc.localAI[0] = shouldGetBuffedByBerserkPhase ? 1f : 0f; + NPC.ai[1] += (shouldGetBuffedByBerserkPhase && revenge) ? 1f : 0f; + NPC.localAI[0] = shouldGetBuffedByBerserkPhase ? 1f : 0f; AIState = (float)Phase.Charge; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; chargeVelocityScalar = 0f; - npc.TargetClosest(); + NPC.TargetClosest(); } } } @@ -784,7 +785,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos float slowDownDistance = GetSlowdownAreaEdgeRadius(lastMechAlive); bool readyToFireDeathray = distanceFromTarget < slowDownDistance; if (readyToFireDeathray) - npc.localAI[2] = 1f; + NPC.localAI[2] = 1f; // Use a lerp to smoothly scale up velocity and turn speed if (calamityGlobalNPC.newAI[3] == 0f) @@ -795,7 +796,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos chargeVelocityScalar = 1f; // If ready to fire deathray, start reducing the velocity scalar - if (npc.localAI[2] == 1f) + if (NPC.localAI[2] == 1f) calamityGlobalNPC.newAI[3] = 1f; } } @@ -812,7 +813,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos turnDistance = chargeLocationDistance; // Gradually turn and move slower if within 50 tiles of the target - if (npc.localAI[2] == 1f) + if (NPC.localAI[2] == 1f) { // Exponentially scale down velocity if close to the target float velocityScale = distanceFromTarget / slowDownDistance; @@ -828,9 +829,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Fire deathray telegraph beams if (calamityGlobalNPC.newAI[2] == 1f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/THanosLaser"), + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/THanosLaser"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); } @@ -842,20 +843,20 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos int type = ModContent.ProjectileType(); for (int b = 0; b < 6; b++) { - int beam = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, 0, 0f, 255, npc.whoAmI); + int beam = Projectile.NewProjectile(NPC.Center, Vector2.Zero, type, 0, 0f, 255, NPC.whoAmI); // Determine the initial offset angle of telegraph. It will be smoothened to give a "stretch" effect. if (Main.projectile.IndexInRange(beam)) { float squishedRatio = (float)Math.Pow((float)Math.Sin(MathHelper.Pi * b / 6f), 2D); float smoothenedRatio = MathHelper.SmoothStep(0f, 1f, squishedRatio); - Main.projectile[beam].ai[0] = npc.whoAmI; + Main.projectile[beam].ai[0] = NPC.whoAmI; Main.projectile[beam].ai[1] = MathHelper.Lerp(-0.74f, 0.74f, smoothenedRatio); } } - int beam2 = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, 0, 0f, 255, npc.whoAmI); + int beam2 = Projectile.NewProjectile(NPC.Center, Vector2.Zero, type, 0, 0f, 255, NPC.whoAmI); if (Main.projectile.IndexInRange(beam2)) - Main.projectile[beam2].ai[0] = npc.whoAmI; + Main.projectile[beam2].ai[0] = NPC.whoAmI; } } } @@ -867,21 +868,21 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) { - npc.localAI[0] = 0f; - npc.localAI[2] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[2] = 0f; AIState = (float)Phase.Charge; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; chargeVelocityScalar = 0f; - npc.TargetClosest(); + NPC.TargetClosest(); } } @@ -889,47 +890,47 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } // Do not deal contact damage for 5 seconds after spawning - if (npc.localAI[3] == 0f) + if (NPC.localAI[3] == 0f) noContactDamageTimer = 300; - if (npc.localAI[3] < immunityTime) - npc.localAI[3] += 1f; + if (NPC.localAI[3] < immunityTime) + NPC.localAI[3] += 1f; // Homing only works if vulnerable is true - npc.chaseable = vulnerable; + NPC.chaseable = vulnerable; // Adjust DR based on vulnerable - npc.Calamity().DR = vulnerable ? 0f : 0.9999f; - npc.Calamity().unbreakableDR = !vulnerable; + NPC.Calamity().DR = vulnerable ? 0f : 0.9999f; + NPC.Calamity().unbreakableDR = !vulnerable; // Increase overall damage taken while vulnerable - npc.takenDamageMultiplier = vulnerable ? 1.1f : 1f; + NPC.takenDamageMultiplier = vulnerable ? 1.1f : 1f; // Vent noise and steam SmokeDrawer.ParticleSpawnRate = 9999999; if (vulnerable) { // Light - Lighting.AddLight(npc.Center, 0.35f * npc.Opacity, 0.05f * npc.Opacity, 0.05f * npc.Opacity); + Lighting.AddLight(NPC.Center, 0.35f * NPC.Opacity, 0.05f * NPC.Opacity, 0.05f * NPC.Opacity); // Noise - if (npc.localAI[1] == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center); + if (NPC.localAI[1] == 0f) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), NPC.Center); // Steam - npc.localAI[1] += 1f; - if (npc.localAI[1] < ventDuration) + NPC.localAI[1] += 1f; + if (NPC.localAI[1] < ventDuration) { - SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2; + SmokeDrawer.BaseMoveRotation = NPC.rotation - MathHelper.PiOver2; SmokeDrawer.ParticleSpawnRate = ventCloudSpawnRate; } } else { // Light - Lighting.AddLight(npc.Center, 0.05f * npc.Opacity, 0.2f * npc.Opacity, 0.2f * npc.Opacity); + Lighting.AddLight(NPC.Center, 0.05f * NPC.Opacity, 0.2f * NPC.Opacity, 0.2f * NPC.Opacity); - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; } SmokeDrawer.Update(); @@ -937,21 +938,21 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (!targetDead) { // Increase velocity if velocity is ever zero - if (npc.velocity == Vector2.Zero) - npc.velocity = Vector2.Normalize(player.Center - npc.Center).SafeNormalize(Vector2.Zero) * baseVelocity; + if (NPC.velocity == Vector2.Zero) + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center).SafeNormalize(Vector2.Zero) * baseVelocity; // Acceleration - if (!((destination - npc.Center).Length() < turnDistance)) + if (!((destination - NPC.Center).Length() < turnDistance)) { - float targetAngle = npc.AngleTo(destination); - float f = npc.velocity.ToRotation().AngleTowards(targetAngle, turnSpeed); - npc.velocity = f.ToRotationVector2() * baseVelocity; + float targetAngle = NPC.AngleTo(destination); + float f = NPC.velocity.ToRotation().AngleTowards(targetAngle, turnSpeed); + NPC.velocity = f.ToRotationVector2() * baseVelocity; } } // Velocity upper limit - if (npc.velocity.Length() > baseVelocity) - npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * baseVelocity; + if (NPC.velocity.Length() > baseVelocity) + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.Zero) * baseVelocity; } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -960,10 +961,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -973,12 +974,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (dist4 < minDist) minDist = dist4; - return minDist <= 50f && npc.Opacity == 1f && noContactDamageTimer <= 0; + return minDist <= 50f && NPC.Opacity == 1f && noContactDamageTimer <= 0; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (npc.localAI[3] < immunityTime) + if (NPC.localAI[3] < immunityTime) damage *= 0.01; return true; @@ -993,48 +994,48 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void FindFrame(int frameHeight) // 5 total frames { // Swap between venting and non-venting frames - npc.frameCounter += 1D; + NPC.frameCounter += 1D; if (AIState == (float)Phase.Charge || AIState == (float)Phase.UndergroundLaserBarrage) { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { - npc.frame.Y -= frameHeight; - npc.frameCounter = 0D; + NPC.frame.Y -= frameHeight; + NPC.frameCounter = 0D; } - if (npc.frame.Y < 0) - npc.frame.Y = 0; + if (NPC.frame.Y < 0) + NPC.frame.Y = 0; } else { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { - npc.frame.Y += frameHeight; - npc.frameCounter = 0D; + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; } - int finalFrame = Main.npcFrameCount[npc.type] - 1; - if (npc.frame.Y >= frameHeight * finalFrame) - npc.frame.Y = frameHeight * finalFrame; + int finalFrame = Main.npcFrameCount[NPC.type] - 1; + if (NPC.frame.Y >= frameHeight * finalFrame) + NPC.frame.Y = frameHeight * finalFrame; } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 vector = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture = Main.npcTexture[NPC.type]; + Vector2 vector = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); - Vector2 center = npc.Center - Main.screenPosition; - center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - center += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, center, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + Vector2 center = NPC.Center - Main.screenPosition; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow"); - spriteBatch.Draw(texture, center, npc.frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow"); + spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - SmokeDrawer.DrawSet(npc.Center); + SmokeDrawer.DrawSet(NPC.Center); // Draw a white indicator aura and reticle before and while a death ray is being fired. // This is done to give a visual indicator that players should move near the head (which results in slower movement and thus easier dodging capabilities). @@ -1043,9 +1044,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos spriteBatch.SetBlendState(BlendState.Additive); // A large, faded circle. Is rescaled to fit the radius of the slowdown area. - Texture2D auraTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/THanosAura"); + Texture2D auraTexture = ModContent.Request("CalamityMod/ExtraTextures/THanosAura"); - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Yes, this is bizarre as fuck. Player completelyUseless = null; @@ -1053,8 +1054,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // A general factor for the aura. // Used to cause fade-ins/outs as the attack starts/stops. - float auraGeneralPower = Utils.InverseLerp(0f, deathrayTelegraphDuration * 0.333f, npc.Calamity().newAI[2], true); - auraGeneralPower *= Utils.InverseLerp(deathrayTelegraphDuration + deathrayDuration, deathrayTelegraphDuration + deathrayDuration, npc.Calamity().newAI[2], true); + float auraGeneralPower = Utils.InverseLerp(0f, deathrayTelegraphDuration * 0.333f, NPC.Calamity().newAI[2], true); + auraGeneralPower *= Utils.InverseLerp(deathrayTelegraphDuration + deathrayDuration, deathrayTelegraphDuration + deathrayDuration, NPC.Calamity().newAI[2], true); // Determine the characteristics of the aura. This requires intermediate computations to determine if Thanatos is in its final phase as well as for pulsing. bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); @@ -1073,21 +1074,21 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos spriteBatch.SetBlendState(BlendState.AlphaBlend); // Draw the reticle depending on how close the player is. This drawcode terminates early if Thanatos has no target. - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) return false; - Player target = Main.player[npc.target]; + Player target = Main.player[NPC.target]; - Texture2D leftReticleTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/ThanatosReticleLeft"); - Texture2D rightReticleTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/ThanatosReticleRight"); - Texture2D topReticleTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/ThanatosReticleTop"); - Texture2D bottomReticleTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/ThanatosReticleHead"); - Texture2D leftReticleProngTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/ThanatosReticleProngLeft"); - Texture2D rightReticleProngTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/ThanatosReticleProngRight"); + Texture2D leftReticleTexture = ModContent.Request("CalamityMod/ExtraTextures/ThanatosReticleLeft"); + Texture2D rightReticleTexture = ModContent.Request("CalamityMod/ExtraTextures/ThanatosReticleRight"); + Texture2D topReticleTexture = ModContent.Request("CalamityMod/ExtraTextures/ThanatosReticleTop"); + Texture2D bottomReticleTexture = ModContent.Request("CalamityMod/ExtraTextures/ThanatosReticleHead"); + Texture2D leftReticleProngTexture = ModContent.Request("CalamityMod/ExtraTextures/ThanatosReticleProngLeft"); + Texture2D rightReticleProngTexture = ModContent.Request("CalamityMod/ExtraTextures/ThanatosReticleProngRight"); // The reticle fades away and moves farther away from the target the closer they are to the aura. // Once far away, the reticle will flash between red and white as an indicator. - float targetHeadDistance = npc.Distance(target.Center); + float targetHeadDistance = NPC.Distance(target.Center); float reticleOpacity = Utils.InverseLerp(auraRadius * 0.5f - 40f, auraRadius * 0.5f + 100f, targetHeadDistance, true); float reticleOffsetDistance = MathHelper.SmoothStep(300f, 0f, reticleOpacity); float reticleFadeToWhite = ((float)Math.Cos(Main.GlobalTime * 6.8f) * 0.5f + 0.5f) * reticleOpacity * 0.67f; @@ -1119,12 +1120,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override bool SpecialNPCLoot() { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + int closestSegmentID = DropHelper.FindClosestWormSegment(NPC, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()); - npc.position = Main.npc[closestSegmentID].position; + NPC.position = Main.npc[closestSegmentID].position; return false; } @@ -1174,43 +1175,43 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Mark Exo Mechs as dead and drop loot else - AresBody.DropExoMechLoot(npc, (int)AresBody.MechType.Thanatos); + AresBody.DropExoMechLoot(NPC, (int)AresBody.MechType.Thanatos); } public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 8; + NPC.soundDelay = 8; if (vulnerable) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), NPC.Center); else - Main.PlaySound(SoundID.NPCHit4, npc.Center); + SoundEngine.PlaySound(SoundID.NPCHit4, NPC.Center); } for (int k = 0; k < 3; k++) - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosHead"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosHead2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosHead3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Thanatos/ThanatosHead"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Thanatos/ThanatosHead2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Thanatos/ThanatosHead3"), 1f); } } @@ -1218,8 +1219,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index ad3962e99e..5260db0b73 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -10,6 +10,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.ExoMechs.Thanatos { @@ -48,43 +49,43 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void SetStaticDefaults() { DisplayName.SetDefault("XM-05 Thanatos"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 5f; - npc.GetNPCDamage(); - npc.width = 76; - npc.height = 110; - npc.defense = 120; - npc.DR_NERD(0.9999f); - npc.Calamity().unbreakableDR = true; - npc.LifeMaxNERB(960000, 1150000, 500000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 5f; + NPC.GetNPCDamage(); + NPC.width = 76; + NPC.height = 110; + NPC.defense = 120; + NPC.DR_NERD(0.9999f); + NPC.Calamity().unbreakableDR = true; + NPC.LifeMaxNERB(960000, 1150000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.Opacity = 0f; - npc.canGhostHeal = false; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - npc.boss = true; + NPC.knockBackResist = 0f; + NPC.Opacity = 0f; + NPC.canGhostHeal = false; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + NPC.boss = true; music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void BossHeadSlot(ref int index) { - if (Main.npc[(int)npc.ai[2]].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune) + if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune) index = -1; else if (vulnerable) index = vulnerableIconIndex; @@ -94,40 +95,40 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void BossHeadRotation(ref float rotation) { - rotation = npc.rotation; + rotation = NPC.rotation; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.chaseable); + writer.Write(NPC.dontTakeDamage); writer.Write(noContactDamageTimer); writer.Write(vulnerable); - writer.Write(npc.localAI[0]); + writer.Write(NPC.localAI[0]); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); noContactDamageTimer = reader.ReadInt32(); vulnerable = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); + NPC.localAI[0] = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -147,37 +148,37 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; return; } // Set vulnerable to false by default vulnerable = false; - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; - npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; + NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; if (!invisiblePhase) { - if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + if (Main.npc[(int)NPC.ai[1]].Opacity > 0.5f) { if (noContactDamageTimer > 0) noContactDamageTimer--; - npc.Opacity += 0.2f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; } else { @@ -190,16 +191,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Deal no contact damage for 3 seconds after becoming visible noContactDamageTimer = 185; - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.05f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } // Number of body segments int numSegments = ThanatosHead.minLength; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Check if the other exo mechs are alive int otherExoMechsAlive = 0; @@ -249,8 +250,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.netMode != NetmodeID.MultiplayerClient) { // Only charge up lasers if not venting or firing lasers - if (npc.Calamity().newAI[0] == 0f) - npc.ai[3] += 1f; + if (NPC.Calamity().newAI[0] == 0f) + NPC.ai[3] += 1f; double numSegmentsAbleToFire = malice ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D; if (shouldGetBuffedByBerserkPhase) @@ -261,18 +262,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge) { float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 90f; - if ((npc.ai[3] % divisor == 0f && npc.ai[0] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) + if ((NPC.ai[3] % divisor == 0f && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers vulnerable = true; - if (npc.Calamity().newAI[1] == 0f) + if (NPC.Calamity().newAI[1] == 0f) { - npc.Calamity().newAI[0] += 1f; - if (npc.Calamity().newAI[0] >= timeToOpenAndFireLasers) + NPC.Calamity().newAI[0] += 1f; + if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers) { - npc.ai[3] = 0f; - npc.Calamity().newAI[1] = 1f; + NPC.ai[3] = 0f; + NPC.Calamity().newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { int maxTargets = 3; @@ -287,7 +288,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos continue; Vector2 playerCenter = Main.player[i].Center; - float distance = Vector2.Distance(playerCenter, npc.Center); + float distance = Vector2.Distance(playerCenter, NPC.Center); if (distance < maxDistance) { whoAmIArray[numProjectiles] = i; @@ -299,7 +300,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - SoundEffectInstance sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + SoundEffectInstance sound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), NPC.Center); if (sound != null) sound.Volume *= 0.1f; @@ -307,38 +308,38 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Normal laser int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } } else { - npc.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; - if (npc.Calamity().newAI[0] <= 0f) + NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; + if (NPC.Calamity().newAI[0] <= 0f) { - npc.Calamity().newAI[0] = 0f; - npc.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; } } } } else { - float divisor = npc.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300 - if ((npc.ai[3] == divisor && npc.ai[0] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) + float divisor = NPC.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300 + if ((NPC.ai[3] == divisor && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers vulnerable = true; - if (npc.Calamity().newAI[1] == 0f) + if (NPC.Calamity().newAI[1] == 0f) { - npc.Calamity().newAI[0] += 1f; - if (npc.Calamity().newAI[0] >= timeToOpenAndFireLasers) + NPC.Calamity().newAI[0] += 1f; + if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers) { - npc.ai[3] = 0f; - npc.Calamity().newAI[1] = 1f; + NPC.ai[3] = 0f; + NPC.Calamity().newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { int maxTargets = 3; @@ -353,7 +354,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos continue; Vector2 playerCenter = Main.player[i].Center; - float distance = Vector2.Distance(playerCenter, npc.Center); + float distance = Vector2.Distance(playerCenter, NPC.Center); if (distance < maxDistance) { whoAmIArray[numProjectiles] = i; @@ -366,33 +367,33 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } float predictionAmt = malice ? 24f : death ? 20f : revenge ? 18f : expertMode ? 16f : 12f; - if (npc.ai[0] % 3f == 0f) + if (NPC.ai[0] % 3f == 0f) predictionAmt *= 0.5f; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + int damage = NPC.GetProjectileDamage(type); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), NPC.Center); for (int i = 0; i < numProjectiles; i++) { // Fire normal lasers if head is in passive state if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive) { // Normal laser - Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } else { // Normal laser - if (shouldGetBuffedByBerserkPhase && npc.ai[0] % 3f == 0f) - Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + if (shouldGetBuffedByBerserkPhase && NPC.ai[0] % 3f == 0f) + Projectile.NewProjectile(NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); // Predictive laser Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt; - Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); // Opposite laser projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt; - Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -400,11 +401,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - npc.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; - if (npc.Calamity().newAI[0] <= 0f) + NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; + if (NPC.Calamity().newAI[0] <= 0f) { - npc.Calamity().newAI[0] = 0f; - npc.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; } } } @@ -413,14 +414,14 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - if (npc.ai[3] > 0f) - npc.ai[3] = 0f; + if (NPC.ai[3] > 0f) + NPC.ai[3] = 0f; - npc.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; - if (npc.Calamity().newAI[0] <= 0f) + NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar; + if (NPC.Calamity().newAI[0] <= 0f) { - npc.Calamity().newAI[0] = 0f; - npc.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; } else { @@ -430,64 +431,64 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } // Do not deal contact damage for 5 seconds after spawning - if (npc.Calamity().newAI[2] == 0f) + if (NPC.Calamity().newAI[2] == 0f) noContactDamageTimer = 300; - if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) - npc.Calamity().newAI[2] += 1f; + if (NPC.Calamity().newAI[2] < ThanatosHead.immunityTime) + NPC.Calamity().newAI[2] += 1f; // Homing only works if vulnerable is true - npc.chaseable = vulnerable; + NPC.chaseable = vulnerable; // Adjust DR based on vulnerable - npc.Calamity().DR = vulnerable ? 0f : 0.9999f; - npc.Calamity().unbreakableDR = !vulnerable; + NPC.Calamity().DR = vulnerable ? 0f : 0.9999f; + NPC.Calamity().unbreakableDR = !vulnerable; // Increase overall damage taken while vulnerable float damageMult = malice ? 1.1f : death ? 1.2f : revenge ? 1.25f : expertMode ? 1.3f : 1.4f; if (shouldGetBuffedByBerserkPhase) damageMult -= malice ? 0.1f : death ? 0.175f : revenge ? 0.2f : expertMode ? 0.225f : 0.3f; - npc.takenDamageMultiplier = vulnerable ? damageMult : 1f; + NPC.takenDamageMultiplier = vulnerable ? damageMult : 1f; // Vent noise and steam SmokeDrawer.ParticleSpawnRate = 9999999; if (vulnerable) { // Light - Lighting.AddLight(npc.Center, 0.35f * npc.Opacity, 0.05f * npc.Opacity, 0.05f * npc.Opacity); + Lighting.AddLight(NPC.Center, 0.35f * NPC.Opacity, 0.05f * NPC.Opacity, 0.05f * NPC.Opacity); // Noise float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.1f : 1f; - if (npc.localAI[0] == 0f) + if (NPC.localAI[0] == 0f) { - SoundEffectInstance sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center); + SoundEffectInstance sound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), NPC.Center); if (sound != null) sound.Volume *= volume; } // Steam - npc.localAI[0] += 1f; + NPC.localAI[0] += 1f; float actualVentDuration = lastMechAlive ? 90f : shouldGetBuffedByBerserkPhase ? 120f : ThanatosHead.ventDuration; - if (npc.localAI[0] < actualVentDuration) + if (NPC.localAI[0] < actualVentDuration) { - SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2; + SmokeDrawer.BaseMoveRotation = NPC.rotation - MathHelper.PiOver2; SmokeDrawer.ParticleSpawnRate = ThanatosHead.ventCloudSpawnRate; } } else { // Light - Lighting.AddLight(npc.Center, 0.05f * npc.Opacity, 0.2f * npc.Opacity, 0.2f * npc.Opacity); + Lighting.AddLight(NPC.Center, 0.05f * NPC.Opacity, 0.2f * NPC.Opacity, 0.2f * NPC.Opacity); - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; } SmokeDrawer.Update(); Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; - Vector2 npcCenter = npc.Center; + Vector2 npcCenter = NPC.Center; float targetCenterX = player.Center.X; float targetCenterY = player.Center.Y; targetCenterX = (int)(targetCenterX / 16f) * 16; @@ -498,31 +499,31 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos targetCenterY -= npcCenter.Y; float distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - npcCenter = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - targetCenterX = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - npcCenter.X; - targetCenterY = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - npcCenter.Y; + npcCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + targetCenterX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - npcCenter.X; + targetCenterY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - npcCenter.Y; } catch { } - npc.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); - distanceFromTarget = (distanceFromTarget - npc.width) / distanceFromTarget; + distanceFromTarget = (distanceFromTarget - NPC.width) / distanceFromTarget; targetCenterX *= distanceFromTarget; targetCenterY *= distanceFromTarget; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + targetCenterX; - npc.position.Y = npc.position.Y + targetCenterY; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetCenterX; + NPC.position.Y = NPC.position.Y + targetCenterY; if (targetCenterX < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (targetCenterX > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } @@ -532,10 +533,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -545,12 +546,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (dist4 < minDist) minDist = dist4; - return minDist <= 45f && npc.Opacity == 1f && noContactDamageTimer <= 0; + return minDist <= 45f && NPC.Opacity == 1f && noContactDamageTimer <= 0; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) + if (NPC.Calamity().newAI[2] < ThanatosHead.immunityTime) damage *= 0.01; return true; @@ -558,55 +559,55 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void FindFrame(int frameHeight) // 5 total frames { - if (!Main.npc[(int)npc.ai[2]].active || Main.npc[(int)npc.ai[2]].life <= 0) + if (!Main.npc[(int)NPC.ai[2]].active || Main.npc[(int)NPC.ai[2]].life <= 0) return; // Swap between venting and non-venting frames - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; - npc.frameCounter += 1D; - if (npc.Calamity().newAI[0] > 0f) + NPC.frameCounter += 1D; + if (NPC.Calamity().newAI[0] > 0f) { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { - npc.frame.Y += frameHeight; - npc.frameCounter = 0D; + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; } - int finalFrame = Main.npcFrameCount[npc.type] - 1; - if (npc.frame.Y > frameHeight * finalFrame) - npc.frame.Y = frameHeight * finalFrame; + int finalFrame = Main.npcFrameCount[NPC.type] - 1; + if (NPC.frame.Y > frameHeight * finalFrame) + NPC.frame.Y = frameHeight * finalFrame; } else { - if (npc.frameCounter >= 6D) + if (NPC.frameCounter >= 6D) { - npc.frame.Y -= frameHeight; - npc.frameCounter = 0D; + NPC.frame.Y -= frameHeight; + NPC.frameCounter = 0D; } - if (npc.frame.Y < 0) - npc.frame.Y = 0; + if (NPC.frame.Y < 0) + NPC.frame.Y = 0; } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 vector = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture = Main.npcTexture[NPC.type]; + Vector2 vector = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); - Vector2 center = npc.Center - Main.screenPosition; - center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - center += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, center, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + Vector2 center = NPC.Center - Main.screenPosition; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosTailGlow"); - spriteBatch.Draw(texture, center, npc.frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + texture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosTailGlow"); + spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - SmokeDrawer.DrawSet(npc.Center); + SmokeDrawer.DrawSet(NPC.Center); return false; } @@ -617,47 +618,47 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 8; + NPC.soundDelay = 8; if (vulnerable) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), NPC.Center); else - Main.PlaySound(SoundID.NPCHit4, npc.Center); + SoundEngine.PlaySound(SoundID.NPCHit4, NPC.Center); } int baseDust = vulnerable ? 3 : 1; for (int k = 0; k < baseDust; k++) - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosTail"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosTail2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosTail3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosTail4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Thanatos/ThanatosTail"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Thanatos/ThanatosTail2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Thanatos/ThanatosTail3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Thanatos/ThanatosTail4"), 1f); } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index af8a63f847..8d73f2f452 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -9,6 +9,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.GreatSandShark { [AutoloadBossHead] @@ -19,55 +20,55 @@ namespace CalamityMod.NPCs.GreatSandShark public override void SetStaticDefaults() { DisplayName.SetDefault("Great Sand Shark"); - Main.npcFrameCount[npc.type] = 8; + Main.npcFrameCount[NPC.type] = 8; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.npcSlots = 15f; - npc.damage = 100; - npc.width = 300; - npc.height = 120; - npc.defense = 40; - npc.DR_NERD(0.25f); - npc.LifeMaxNERB(9200, 11000); - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.npcSlots = 15f; + NPC.damage = 100; + NPC.width = 300; + NPC.height = 120; + NPC.defense = 40; + NPC.DR_NERD(0.25f); + NPC.LifeMaxNERB(9200, 11000); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 5, 0, 0); - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - npc.behindTiles = true; - npc.netAlways = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.timeLeft = NPC.activeTime * 30; - banner = npc.type; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 5, 0, 0); + NPCID.Sets.TrailCacheLength[NPC.type] = 8; + NPCID.Sets.TrailingMode[NPC.type] = 1; + NPC.behindTiles = true; + NPC.netAlways = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.timeLeft = NPC.activeTime * 30; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(resetAI); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); } public override void ReceiveExtraAI(BinaryReader reader) { resetAI = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); } public override void AI() @@ -75,9 +76,9 @@ namespace CalamityMod.NPCs.GreatSandShark bool expertMode = Main.expertMode; bool revenge = CalamityWorld.revenge; bool death = CalamityWorld.death; - bool lowLife = npc.life <= npc.lifeMax * (expertMode ? 0.75 : 0.5); - bool lowerLife = npc.life <= npc.lifeMax * (expertMode ? 0.35 : 0.2); - bool youMustDie = !Main.player[npc.target].ZoneDesert; + bool lowLife = NPC.life <= NPC.lifeMax * (expertMode ? 0.75 : 0.5); + bool lowerLife = NPC.life <= NPC.lifeMax * (expertMode ? 0.35 : 0.2); + bool youMustDie = !Main.player[NPC.target].ZoneDesert; if (!Terraria.GameContent.Events.Sandstorm.Happening) { @@ -85,22 +86,22 @@ namespace CalamityMod.NPCs.GreatSandShark CalamityNetcode.SyncWorld(); } - if (npc.soundDelay <= 0) + if (NPC.soundDelay <= 0) { - npc.soundDelay = 480; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/GreatSandSharkRoar"), (int)npc.position.X, (int)npc.position.Y); + NPC.soundDelay = 480; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/GreatSandSharkRoar"), (int)NPC.position.X, (int)NPC.position.Y); } - if (npc.localAI[3] >= 1f || Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 1000f) + if (NPC.localAI[3] >= 1f || Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 1000f) { if (!resetAI) { - npc.localAI[0] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.localAI[0] = 0f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; resetAI = true; - npc.netUpdate = true; + NPC.netUpdate = true; } int num2 = expertMode ? 35 : 50; @@ -129,28 +130,28 @@ namespace CalamityMod.NPCs.GreatSandShark num4 = 20; } - Vector2 vector = npc.Center; - Player player = Main.player[npc.target]; + Vector2 vector = NPC.Center; + Player player = Main.player[NPC.target]; - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + if (NPC.target < 0 || NPC.target == 255 || player.dead || !player.active) { - npc.TargetClosest(); - player = Main.player[npc.target]; - npc.netUpdate = true; + NPC.TargetClosest(); + player = Main.player[NPC.target]; + NPC.netUpdate = true; } if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) { - npc.velocity.Y += 0.4f; - if (npc.timeLeft > 10) - npc.timeLeft = 10; + NPC.velocity.Y += 0.4f; + if (NPC.timeLeft > 10) + NPC.timeLeft = 10; - npc.ai[0] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 0f; + NPC.ai[2] = 0f; } float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X); - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) num17 += MathHelper.Pi; if (num17 < 0f) num17 += MathHelper.TwoPi; @@ -158,114 +159,114 @@ namespace CalamityMod.NPCs.GreatSandShark num17 -= MathHelper.TwoPi; float num18 = 0.04f; - if (npc.ai[0] == 1f) + if (NPC.ai[0] == 1f) num18 = 0f; - if (npc.rotation < num17) + if (NPC.rotation < num17) { - if ((double)(num17 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num18; + if ((double)(num17 - NPC.rotation) > MathHelper.Pi) + NPC.rotation -= num18; else - npc.rotation += num18; + NPC.rotation += num18; } - if (npc.rotation > num17) + if (NPC.rotation > num17) { - if ((double)(npc.rotation - num17) > MathHelper.Pi) - npc.rotation += num18; + if ((double)(NPC.rotation - num17) > MathHelper.Pi) + NPC.rotation += num18; else - npc.rotation -= num18; + NPC.rotation -= num18; } - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - npc.rotation = num17; + if (NPC.rotation > num17 - num18 && NPC.rotation < num17 + num18) + NPC.rotation = num17; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; + if (NPC.rotation < 0f) + NPC.rotation += MathHelper.TwoPi; + if (NPC.rotation > MathHelper.TwoPi) + NPC.rotation -= MathHelper.TwoPi; - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - npc.rotation = num17; + if (NPC.rotation > num17 - num18 && NPC.rotation < num17 + num18) + NPC.rotation = num17; - if (npc.ai[0] == 0f && !player.dead) + if (NPC.ai[0] == 0f && !player.dead) { - if (npc.ai[1] == 0f) - npc.ai[1] = 300 * Math.Sign((vector - player.Center).X); + if (NPC.ai[1] == 0f) + NPC.ai[1] = 300 * Math.Sign((vector - player.Center).X); - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector3.X) + Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(NPC.ai[1], -200f) - vector - NPC.velocity) * scaleFactor; + if (NPC.velocity.X < vector3.X) { - npc.velocity.X += num3; - if (npc.velocity.X < 0f && vector3.X > 0f) - npc.velocity.X += num3; + NPC.velocity.X += num3; + if (NPC.velocity.X < 0f && vector3.X > 0f) + NPC.velocity.X += num3; } - else if (npc.velocity.X > vector3.X) + else if (NPC.velocity.X > vector3.X) { - npc.velocity.X -= num3; - if (npc.velocity.X > 0f && vector3.X < 0f) - npc.velocity.X -= num3; + NPC.velocity.X -= num3; + if (NPC.velocity.X > 0f && vector3.X < 0f) + NPC.velocity.X -= num3; } - if (npc.velocity.Y < vector3.Y) + if (NPC.velocity.Y < vector3.Y) { - npc.velocity.Y += num3; - if (npc.velocity.Y < 0f && vector3.Y > 0f) - npc.velocity.Y += num3; + NPC.velocity.Y += num3; + if (NPC.velocity.Y < 0f && vector3.Y > 0f) + NPC.velocity.Y += num3; } - else if (npc.velocity.Y > vector3.Y) + else if (NPC.velocity.Y > vector3.Y) { - npc.velocity.Y -= num3; - if (npc.velocity.Y > 0f && vector3.Y < 0f) - npc.velocity.Y -= num3; + NPC.velocity.Y -= num3; + if (NPC.velocity.Y > 0f && vector3.Y < 0f) + NPC.velocity.Y -= num3; } int num22 = Math.Sign(player.Center.X - vector.X); if (num22 != 0) { - if (npc.ai[2] == 0f && num22 != npc.direction) - npc.rotation += MathHelper.Pi; + if (NPC.ai[2] == 0f && num22 != NPC.direction) + NPC.rotation += MathHelper.Pi; - npc.direction = num22; - if (npc.spriteDirection != -npc.direction) - npc.rotation += MathHelper.Pi; + NPC.direction = num22; + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } - npc.ai[2] += 1f; - if (npc.ai[2] >= num2) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= num2) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vector) * num5; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.velocity = Vector2.Normalize(player.Center - vector) * num5; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); if (num22 != 0) { - npc.direction = num22; - if (npc.spriteDirection == 1) - npc.rotation += MathHelper.Pi; + NPC.direction = num22; + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } - npc.netUpdate = true; + NPC.netUpdate = true; return; } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - npc.ai[2] += 1f; - if (npc.ai[2] >= num4) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= num4) { - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 2f) - npc.localAI[3] = 0f; + NPC.localAI[3] += 1f; + if (NPC.localAI[3] >= 2f) + NPC.localAI[3] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; return; } } @@ -273,86 +274,86 @@ namespace CalamityMod.NPCs.GreatSandShark else { resetAI = false; - if (npc.direction == 0) - npc.TargetClosest(); + if (NPC.direction == 0) + NPC.TargetClosest(); - Point point15 = npc.Center.ToTileCoordinates(); + Point point15 = NPC.Center.ToTileCoordinates(); Tile tileSafely = Framing.GetTileSafely(point15); bool flag121 = tileSafely.nactive() || tileSafely.liquid > 0; bool flag122 = false; - npc.TargetClosest(false); + NPC.TargetClosest(false); - Vector2 vector260 = npc.targetRect.Center.ToVector2(); - if (Main.player[npc.target].velocity.Y > -0.1f && !Main.player[npc.target].dead && npc.Distance(vector260) > 150f) + Vector2 vector260 = NPC.targetRect.Center.ToVector2(); + if (Main.player[NPC.target].velocity.Y > -0.1f && !Main.player[NPC.target].dead && NPC.Distance(vector260) > 150f) flag122 = true; - npc.localAI[1] += 1f; + NPC.localAI[1] += 1f; if (lowLife) { - bool spawnFlag = npc.localAI[1] == 150f; + bool spawnFlag = NPC.localAI[1] == 150f; if (NPC.CountNPCS(NPCID.SandShark) > 2) spawnFlag = false; if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 50, NPCID.SandShark, 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/GreatSandSharkRoar"), (int)npc.position.X, (int)npc.position.Y); + NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y + 50, NPCID.SandShark, 0, 0f, 0f, 0f, 0f, 255); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/GreatSandSharkRoar"), (int)NPC.position.X, (int)NPC.position.Y); } } - if (npc.localAI[1] >= 300f) + if (NPC.localAI[1] >= 300f) { - npc.localAI[1] = 0f; - if (npc.localAI[2] > 0f) - npc.localAI[2] = 0f; + NPC.localAI[1] = 0f; + if (NPC.localAI[2] > 0f) + NPC.localAI[2] = 0f; switch (Main.rand.Next(3)) { case 0: - npc.ai[3] = 0f; + NPC.ai[3] = 0f; break; case 1: - npc.ai[3] = 1f; + NPC.ai[3] = 1f; break; case 2: - npc.ai[3] = 2f; + NPC.ai[3] = 2f; break; } int random = lowerLife ? 5 : 9; if (lowLife && Main.rand.Next(random) == 0) - npc.localAI[3] = 1f; + NPC.localAI[3] = 1f; - npc.netUpdate = true; + NPC.netUpdate = true; } - if (npc.localAI[0] == -1f && !flag121) - npc.localAI[0] = 20f; - if (npc.localAI[0] > 0f) - npc.localAI[0] -= 1f; + if (NPC.localAI[0] == -1f && !flag121) + NPC.localAI[0] = 20f; + if (NPC.localAI[0] > 0f) + NPC.localAI[0] -= 1f; if (flag121) { - float num1534 = npc.ai[1]; + float num1534 = NPC.ai[1]; bool flag123 = false; - point15 = (npc.Center + new Vector2(0f, 24f)).ToTileCoordinates(); + point15 = (NPC.Center + new Vector2(0f, 24f)).ToTileCoordinates(); tileSafely = Framing.GetTileSafely(point15.X, point15.Y - 2); if (tileSafely.nactive()) flag123 = true; - npc.ai[1] = flag123.ToInt(); - if (npc.ai[2] < 30f) - npc.ai[2] += 1f; + NPC.ai[1] = flag123.ToInt(); + if (NPC.ai[2] < 30f) + NPC.ai[2] += 1f; if (flag122) { - npc.TargetClosest(); - npc.velocity.X += npc.direction * 0.15f; - npc.velocity.Y += npc.directionY * 0.15f; + NPC.TargetClosest(); + NPC.velocity.X += NPC.direction * 0.15f; + NPC.velocity.Y += NPC.directionY * 0.15f; float velocityX = 8f; float velocityY = 6f; - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { case 0: velocityX = 10f; @@ -377,21 +378,21 @@ namespace CalamityMod.NPCs.GreatSandShark velocityX *= 1.5f; velocityY *= 1.5f; } - npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -velocityX, velocityX); - npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y, -velocityY, velocityY); - Vector2 vec4 = npc.Center + npc.velocity.SafeNormalize(Vector2.Zero) * npc.Size.Length() / 2f + npc.velocity; + NPC.velocity.X = MathHelper.Clamp(NPC.velocity.X, -velocityX, velocityX); + NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y, -velocityY, velocityY); + Vector2 vec4 = NPC.Center + NPC.velocity.SafeNormalize(Vector2.Zero) * NPC.Size.Length() / 2f + NPC.velocity; point15 = vec4.ToTileCoordinates(); tileSafely = Framing.GetTileSafely(point15); bool flag124 = tileSafely.nactive(); - if (!flag124 && Math.Sign(npc.velocity.X) == npc.direction && (npc.Distance(vector260) < 600f || youMustDie) && (npc.ai[2] >= 30f || npc.ai[2] < 0f)) + if (!flag124 && Math.Sign(NPC.velocity.X) == NPC.direction && (NPC.Distance(vector260) < 600f || youMustDie) && (NPC.ai[2] >= 30f || NPC.ai[2] < 0f)) { - if (npc.localAI[0] == 0f) + if (NPC.localAI[0] == 0f) { - Main.PlaySound(SoundID.NPCDeath15, npc.position); - npc.localAI[0] = -1f; + SoundEngine.PlaySound(SoundID.NPCDeath15, NPC.position); + NPC.localAI[0] = -1f; for (int num621 = 0; num621 < 25; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 32, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 32, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity.Y *= 6f; Main.dust[num622].velocity.X *= 3f; if (Main.rand.NextBool(2)) @@ -402,73 +403,73 @@ namespace CalamityMod.NPCs.GreatSandShark } for (int num623 = 0; num623 < 50; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 85, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 85, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity.Y *= 10f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 268, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 268, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity.X *= 2f; } - int spawnX = (int)(npc.width / 2); + int spawnX = (int)(NPC.width / 2); for (int sand = 0; sand < 5; sand++) - Projectile.NewProjectile(npc.Center.X + (float)Main.rand.Next(-spawnX, spawnX), npc.Center.Y, + Projectile.NewProjectile(NPC.Center.X + (float)Main.rand.Next(-spawnX, spawnX), NPC.Center.Y, (float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), ModContent.ProjectileType(), 40, 0f, Main.myPlayer, 0f, 0f); } - npc.ai[2] = -30f; + NPC.ai[2] = -30f; - Vector2 upwardChargeDirection = npc.SafeDirectionTo(vector260 + new Vector2(0f, -80f), -Vector2.UnitY); - npc.velocity = upwardChargeDirection * 18f; + Vector2 upwardChargeDirection = NPC.SafeDirectionTo(vector260 + new Vector2(0f, -80f), -Vector2.UnitY); + NPC.velocity = upwardChargeDirection * 18f; } } else { float num1535 = 6f; - npc.velocity.X += npc.direction * 0.1f; - if (npc.velocity.X < -num1535 || npc.velocity.X > num1535) - npc.velocity.X *= 0.95f; + NPC.velocity.X += NPC.direction * 0.1f; + if (NPC.velocity.X < -num1535 || NPC.velocity.X > num1535) + NPC.velocity.X *= 0.95f; if (flag123) - npc.ai[0] = -1f; + NPC.ai[0] = -1f; else - npc.ai[0] = 1f; + NPC.ai[0] = 1f; float num1536 = 0.06f; float num1537 = 0.01f; - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y -= num1537; - if (npc.velocity.Y < -num1536) - npc.ai[0] = 1f; + NPC.velocity.Y -= num1537; + if (NPC.velocity.Y < -num1536) + NPC.ai[0] = 1f; } else { - npc.velocity.Y += num1537; - if (npc.velocity.Y > num1536) - npc.ai[0] = -1f; + NPC.velocity.Y += num1537; + if (NPC.velocity.Y > num1536) + NPC.ai[0] = -1f; } - if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) - npc.velocity.Y *= 0.95f; + if (NPC.velocity.Y > 0.4f || NPC.velocity.Y < -0.4f) + NPC.velocity.Y *= 0.95f; } } else { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { if (flag122) - npc.TargetClosest(); + NPC.TargetClosest(); float num1538 = 1f; - npc.velocity.X += npc.direction * 0.1f; - if (npc.velocity.X < -num1538 || npc.velocity.X > num1538) - npc.velocity.X *= 0.95f; + NPC.velocity.X += NPC.direction * 0.1f; + if (NPC.velocity.X < -num1538 || NPC.velocity.X > num1538) + NPC.velocity.X *= 0.95f; } - if (npc.localAI[2] == 0f) + if (NPC.localAI[2] == 0f) { - npc.localAI[2] = 1f; + NPC.localAI[2] = 1f; float velocityX = 12f; float velocityY = 12f; - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { case 0: velocityX = 12f; @@ -493,46 +494,46 @@ namespace CalamityMod.NPCs.GreatSandShark velocityX *= 1.5f; velocityY *= 1.5f; } - npc.velocity.Y = -velocityY; - npc.velocity.X = velocityX * npc.direction; - npc.netUpdate = true; + NPC.velocity.Y = -velocityY; + NPC.velocity.X = velocityX * NPC.direction; + NPC.netUpdate = true; } - npc.velocity.Y += 0.4f; - if (npc.velocity.Y > 10f) - npc.velocity.Y = 10f; + NPC.velocity.Y += 0.4f; + if (NPC.velocity.Y > 10f) + NPC.velocity.Y = 10f; - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - npc.rotation = npc.velocity.Y * npc.direction * 0.1f; - npc.rotation = MathHelper.Clamp(npc.rotation, -0.1f, 0.1f); + NPC.rotation = NPC.velocity.Y * NPC.direction * 0.1f; + NPC.rotation = MathHelper.Clamp(NPC.rotation, -0.1f, 0.1f); } } public override void FindFrame(int frameHeight) { - if (npc.localAI[3] == 0f) + if (NPC.localAI[3] == 0f) { - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Color color24 = npc.GetAlpha(drawColor); - Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; + Color color24 = NPC.GetAlpha(drawColor); + Color color25 = Lighting.GetColor((int)((double)NPC.position.X + (double)NPC.width * 0.5) / 16, (int)(((double)NPC.position.Y + (double)NPC.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[NPC.type]; + int num156 = Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type]; + int y3 = num156 * (int)NPC.frameCounter; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num156); Vector2 origin2 = rectangle.Size() / 2f; int num157 = 8; @@ -542,7 +543,7 @@ namespace CalamityMod.NPCs.GreatSandShark int num161 = num159; while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && CalamityConfig.Instance.Afterimages) { - Color color26 = npc.GetAlpha(color25); + Color color26 = NPC.GetAlpha(color25); { goto IL_6899; } @@ -555,14 +556,14 @@ namespace CalamityMod.NPCs.GreatSandShark { num164 = (float)(num159 - num161); } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = npc.oldPos[num161]; - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[NPC.type] * 1.5f); + Vector2 value4 = NPC.oldPos[num161]; + float num165 = NPC.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + NPC.Size / 2f - Main.screenPosition + new Vector2(0, NPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + NPC.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, NPC.scale, spriteEffects, 0f); goto IL_6881; } - var something = npc.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + var something = NPC.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY), NPC.frame, color24, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); return false; } @@ -570,13 +571,13 @@ namespace CalamityMod.NPCs.GreatSandShark { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num621 = 0; num621 < 50; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -586,10 +587,10 @@ namespace CalamityMod.NPCs.GreatSandShark } for (int num623 = 0; num623 < 100; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -597,9 +598,9 @@ namespace CalamityMod.NPCs.GreatSandShark public override void NPCLoot() { - DropHelper.DropItem(npc, ItemID.AncientBattleArmorMaterial, 1, 1); - DropHelper.DropItem(npc, ModContent.ItemType(), 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, 3, 1, 1); + DropHelper.DropItem(NPC, ItemID.AncientBattleArmorMaterial, 1, 1); + DropHelper.DropItem(NPC, ModContent.ItemType(), 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode, 3, 1, 1); // Mark Great Sand Shark as dead CalamityWorld.downedGSS = true; @@ -608,8 +609,8 @@ namespace CalamityMod.NPCs.GreatSandShark public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * 0.8f); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 59c41a9110..416c3a6b0e 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -18,76 +18,76 @@ namespace CalamityMod.NPCs.HiveMind public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.width = 70; - npc.height = 70; - npc.defense = 6; - npc.lifeMax = 90; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.width = 70; + NPC.height = 70; + NPC.defense = 6; + NPC.lifeMax = 90; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 2000; + NPC.lifeMax = 2000; } - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.3f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.3f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void AI() { - npc.TargetClosest(); + NPC.TargetClosest(); bool revenge = CalamityWorld.revenge; float speed = revenge ? 12f : 11f; if (BossRushEvent.BossRushActive || CalamityWorld.malice) speed = 18f; - if (npc.ai[1] < 90f) - npc.ai[1] += 1f; - speed = MathHelper.Lerp(3f, speed, npc.ai[1] / 90f); + if (NPC.ai[1] < 90f) + NPC.ai[1] += 1f; + speed = MathHelper.Lerp(3f, speed, NPC.ai[1] / 90f); - Vector2 vector167 = new Vector2(npc.Center.X + (npc.direction * 20), npc.Center.Y + 6f); - float num1373 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector167.X; - float num1374 = Main.player[npc.target].Center.Y - vector167.Y; + Vector2 vector167 = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); + float num1373 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector167.X; + float num1374 = Main.player[NPC.target].Center.Y - vector167.Y; float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); float num1376 = speed / num1375; num1373 *= num1376; num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) + NPC.ai[0] -= 1f; + if (num1375 < 200f || NPC.ai[0] > 0f) { if (num1375 < 200f) { - npc.ai[0] = 20f; + NPC.ai[0] = 20f; } - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.direction = -1; + NPC.direction = -1; } else { - npc.direction = 1; + NPC.direction = 1; } return; } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f; + NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f; if (num1375 < 350f) { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + NPC.velocity.X = (NPC.velocity.X * 10f + num1373) / 11f; + NPC.velocity.Y = (NPC.velocity.Y * 10f + num1374) / 11f; } if (num1375 < 300f) { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + NPC.velocity.X = (NPC.velocity.X * 7f + num1373) / 8f; + NPC.velocity.Y = (NPC.velocity.Y * 7f + num1374) / 8f; } } @@ -95,17 +95,17 @@ namespace CalamityMod.NPCs.HiveMind { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 13, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 13, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 13, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 13, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore3"), 1f); } } @@ -113,16 +113,16 @@ namespace CalamityMod.NPCs.HiveMind { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(4) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } if ((Main.expertMode || BossRushEvent.BossRushActive) && Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); } return false; diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index fa58bbc2ec..a57f26945d 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -14,45 +14,45 @@ namespace CalamityMod.NPCs.HiveMind public override void SetStaticDefaults() { DisplayName.SetDefault("Dark Heart"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.damage = 0; - npc.width = 32; - npc.height = 32; - npc.defense = 2; - npc.lifeMax = 150; + NPC.damage = 0; + NPC.width = 32; + NPC.height = 32; + NPC.defense = 2; + NPC.lifeMax = 150; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 1800; + NPC.lifeMax = 1800; } - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.4f; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath21; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.4f; + NPC.noGravity = true; + NPC.canGhostHeal = false; + NPC.chaseable = false; + NPC.HitSound = SoundID.NPCHit13; + NPC.DeathSound = SoundID.NPCDeath21; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - npc.TargetClosest(); + NPC.TargetClosest(); float num1164 = revenge ? 4.5f : 4f; float num1165 = revenge ? 0.8f : 0.75f; if (BossRushEvent.BossRushActive || CalamityWorld.malice) @@ -61,14 +61,14 @@ namespace CalamityMod.NPCs.HiveMind num1165 *= 2f; } - Vector2 vector133 = new Vector2(npc.Center.X, npc.Center.Y); - float num1166 = Main.player[npc.target].Center.X - vector133.X; - float num1167 = Main.player[npc.target].Center.Y - vector133.Y - 400f; + Vector2 vector133 = new Vector2(NPC.Center.X, NPC.Center.Y); + float num1166 = Main.player[NPC.target].Center.X - vector133.X; + float num1167 = Main.player[NPC.target].Center.Y - vector133.Y - 400f; float num1168 = (float)Math.Sqrt(num1166 * num1166 + num1167 * num1167); if (num1168 < 20f) { - num1166 = npc.velocity.X; - num1167 = npc.velocity.Y; + num1166 = NPC.velocity.X; + num1167 = NPC.velocity.Y; } else { @@ -76,48 +76,48 @@ namespace CalamityMod.NPCs.HiveMind num1166 *= num1168; num1167 *= num1168; } - if (npc.velocity.X < num1166) + if (NPC.velocity.X < num1166) { - npc.velocity.X = npc.velocity.X + num1165; - if (npc.velocity.X < 0f && num1166 > 0f) + NPC.velocity.X = NPC.velocity.X + num1165; + if (NPC.velocity.X < 0f && num1166 > 0f) { - npc.velocity.X = npc.velocity.X + num1165 * 2f; + NPC.velocity.X = NPC.velocity.X + num1165 * 2f; } } - else if (npc.velocity.X > num1166) + else if (NPC.velocity.X > num1166) { - npc.velocity.X = npc.velocity.X - num1165; - if (npc.velocity.X > 0f && num1166 < 0f) + NPC.velocity.X = NPC.velocity.X - num1165; + if (NPC.velocity.X > 0f && num1166 < 0f) { - npc.velocity.X = npc.velocity.X - num1165 * 2f; + NPC.velocity.X = NPC.velocity.X - num1165 * 2f; } } - if (npc.velocity.Y < num1167) + if (NPC.velocity.Y < num1167) { - npc.velocity.Y = npc.velocity.Y + num1165; - if (npc.velocity.Y < 0f && num1167 > 0f) + NPC.velocity.Y = NPC.velocity.Y + num1165; + if (NPC.velocity.Y < 0f && num1167 > 0f) { - npc.velocity.Y = npc.velocity.Y + num1165 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num1165 * 2f; } } - else if (npc.velocity.Y > num1167) + else if (NPC.velocity.Y > num1167) { - npc.velocity.Y = npc.velocity.Y - num1165; - if (npc.velocity.Y > 0f && num1167 < 0f) + NPC.velocity.Y = NPC.velocity.Y - num1165; + if (NPC.velocity.Y > 0f && num1167 < 0f) { - npc.velocity.Y = npc.velocity.Y - num1165 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num1165 * 2f; } } - if (npc.position.X + npc.width > Main.player[npc.target].position.X && npc.position.X < Main.player[npc.target].position.X + Main.player[npc.target].width && npc.position.Y + npc.height < Main.player[npc.target].position.Y && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.position.X + NPC.width > Main.player[NPC.target].position.X && NPC.position.X < Main.player[NPC.target].position.X + Main.player[NPC.target].width && NPC.position.Y + NPC.height < Main.player[NPC.target].position.Y && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[0] += 1f; - if (npc.ai[0] >= 30f) + NPC.ai[0] += 1f; + if (NPC.ai[0] >= 30f) { - npc.ai[0] = 0f; - int num1169 = (int)(npc.position.X + 10f + Main.rand.Next(npc.width - 20)); - int num1170 = (int)(npc.position.Y + npc.height + 4f); + NPC.ai[0] = 0f; + int num1169 = (int)(NPC.position.X + 10f + Main.rand.Next(NPC.width - 20)); + int num1170 = (int)(NPC.position.Y + NPC.height + 4f); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(num1169, num1170, 0f, 4f, type, damage, 0f, Main.myPlayer, 0f, 0f); } } @@ -127,9 +127,9 @@ namespace CalamityMod.NPCs.HiveMind { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(4) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } } @@ -137,13 +137,13 @@ namespace CalamityMod.NPCs.HiveMind { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index 4171dc09f6..0a42da357c 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -18,27 +18,27 @@ namespace CalamityMod.NPCs.HiveMind public override void SetDefaults() { - npc.npcSlots = 0.1f; - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 25; - npc.height = 25; - npc.lifeMax = 100; + NPC.npcSlots = 0.1f; + NPC.aiStyle = -1; + NPC.damage = 0; + NPC.width = 25; + NPC.height = 25; + NPC.lifeMax = 100; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 1300; + NPC.lifeMax = 1300; } - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; aiType = -1; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.chaseable = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void AI() @@ -50,104 +50,104 @@ namespace CalamityMod.NPCs.HiveMind int num750 = CalamityGlobalNPC.hiveMind; if (num750 < 0 || !Main.npc[num750].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } - if (npc.ai[3] > 0f) - num750 = (int)npc.ai[3] - 1; + if (NPC.ai[3] > 0f) + num750 = (int)NPC.ai[3] - 1; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] -= 1f; - if (npc.localAI[0] <= 0f) + NPC.localAI[0] -= 1f; + if (NPC.localAI[0] <= 0f) { - npc.localAI[0] = Main.rand.Next(180, 361); - npc.ai[0] = Main.rand.Next(-100, 101); - npc.ai[1] = Main.rand.Next(-100, 101); - npc.netUpdate = true; + NPC.localAI[0] = Main.rand.Next(180, 361); + NPC.ai[0] = Main.rand.Next(-100, 101); + NPC.ai[1] = Main.rand.Next(-100, 101); + NPC.netUpdate = true; } } - npc.TargetClosest(true); + NPC.TargetClosest(true); float num751 = death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; float num752 = 128f; - Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); - float num189 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - (npc.width / 2) - vector22.X; - float num190 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - (npc.height / 2) - vector22.Y; + Vector2 vector22 = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f); + float num189 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - (NPC.width / 2) - vector22.X; + float num190 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - (NPC.height / 2) - vector22.Y; float num191 = (float)Math.Sqrt(num189 * num189 + num190 * num190); float num754 = Main.npc[num750].position.X + (Main.npc[num750].width / 2); float num755 = Main.npc[num750].position.Y + (Main.npc[num750].height / 2); Vector2 vector93 = new Vector2(num754, num755); - float num756 = num754 + npc.ai[0]; - float num757 = num755 + npc.ai[1]; + float num756 = num754 + NPC.ai[0]; + float num757 = num755 + NPC.ai[1]; float num758 = num756 - vector93.X; float num759 = num757 - vector93.Y; float num760 = (float)Math.Sqrt(num758 * num758 + num759 * num759); num760 = num752 / num760; num758 *= num760; num759 *= num760; - if (npc.position.X < num754 + num758) + if (NPC.position.X < num754 + num758) { - npc.velocity.X = npc.velocity.X + num751; - if (npc.velocity.X < 0f && num758 > 0f) - npc.velocity.X = npc.velocity.X * 0.8f; + NPC.velocity.X = NPC.velocity.X + num751; + if (NPC.velocity.X < 0f && num758 > 0f) + NPC.velocity.X = NPC.velocity.X * 0.8f; } - else if (npc.position.X > num754 + num758) + else if (NPC.position.X > num754 + num758) { - npc.velocity.X = npc.velocity.X - num751; - if (npc.velocity.X > 0f && num758 < 0f) - npc.velocity.X = npc.velocity.X * 0.8f; + NPC.velocity.X = NPC.velocity.X - num751; + if (NPC.velocity.X > 0f && num758 < 0f) + NPC.velocity.X = NPC.velocity.X * 0.8f; } - if (npc.position.Y < num755 + num759) + if (NPC.position.Y < num755 + num759) { - npc.velocity.Y = npc.velocity.Y + num751; - if (npc.velocity.Y < 0f && num759 > 0f) - npc.velocity.Y = npc.velocity.Y * 0.8f; + NPC.velocity.Y = NPC.velocity.Y + num751; + if (NPC.velocity.Y < 0f && num759 > 0f) + NPC.velocity.Y = NPC.velocity.Y * 0.8f; } - else if (npc.position.Y > num755 + num759) + else if (NPC.position.Y > num755 + num759) { - npc.velocity.Y = npc.velocity.Y - num751; - if (npc.velocity.Y > 0f && num759 < 0f) - npc.velocity.Y = npc.velocity.Y * 0.8f; + NPC.velocity.Y = NPC.velocity.Y - num751; + if (NPC.velocity.Y > 0f && num759 < 0f) + NPC.velocity.Y = NPC.velocity.Y * 0.8f; } float velocityLimit = 8f; - if (npc.velocity.X > velocityLimit) - npc.velocity.X = velocityLimit; - if (npc.velocity.X < -velocityLimit) - npc.velocity.X = -velocityLimit; - if (npc.velocity.Y > velocityLimit) - npc.velocity.Y = velocityLimit; - if (npc.velocity.Y < -velocityLimit) - npc.velocity.Y = -velocityLimit; + if (NPC.velocity.X > velocityLimit) + NPC.velocity.X = velocityLimit; + if (NPC.velocity.X < -velocityLimit) + NPC.velocity.X = -velocityLimit; + if (NPC.velocity.Y > velocityLimit) + NPC.velocity.Y = velocityLimit; + if (NPC.velocity.Y < -velocityLimit) + NPC.velocity.Y = -velocityLimit; if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - npc.localAI[1] = 180f; + if (!Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) + NPC.localAI[1] = 180f; - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 360f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 80f) + NPC.localAI[1] += 1f; + if (NPC.localAI[1] >= 360f && Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 80f) { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.localAI[1] = 0f; + NPC.TargetClosest(true); + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { float num941 = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3.5f; - Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); - float num942 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector104.X; - float num943 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector104.Y; + Vector2 vector104 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + (NPC.height / 2)); + float num942 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector104.X; + float num943 = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - vector104.Y; float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); num944 = num941 / num944; num942 *= num944; num943 *= num944; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, type, damage, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; + NPC.netUpdate = true; } } } @@ -157,9 +157,9 @@ namespace CalamityMod.NPCs.HiveMind { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(8) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } } @@ -172,13 +172,13 @@ namespace CalamityMod.NPCs.HiveMind { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index 467e5249cc..729c6e7e36 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -18,27 +18,27 @@ namespace CalamityMod.NPCs.HiveMind public override void SetDefaults() { - npc.npcSlots = 0.1f; - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 25; - npc.height = 25; - npc.lifeMax = 150; + NPC.npcSlots = 0.1f; + NPC.aiStyle = -1; + NPC.damage = 0; + NPC.width = 25; + NPC.height = 25; + NPC.lifeMax = 150; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 1300; + NPC.lifeMax = 1300; } - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; aiType = -1; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.chaseable = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void AI() @@ -50,104 +50,104 @@ namespace CalamityMod.NPCs.HiveMind int num750 = CalamityGlobalNPC.hiveMind; if (num750 < 0 || !Main.npc[num750].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } - if (npc.ai[3] > 0f) - num750 = (int)npc.ai[3] - 1; + if (NPC.ai[3] > 0f) + num750 = (int)NPC.ai[3] - 1; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] -= 1f; - if (npc.localAI[0] <= 0f) + NPC.localAI[0] -= 1f; + if (NPC.localAI[0] <= 0f) { - npc.localAI[0] = Main.rand.Next(180, 361); - npc.ai[0] = Main.rand.Next(-100, 101); - npc.ai[1] = Main.rand.Next(-100, 101); - npc.netUpdate = true; + NPC.localAI[0] = Main.rand.Next(180, 361); + NPC.ai[0] = Main.rand.Next(-100, 101); + NPC.ai[1] = Main.rand.Next(-100, 101); + NPC.netUpdate = true; } } - npc.TargetClosest(true); + NPC.TargetClosest(true); float num751 = death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; float num752 = 96f; - Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); - float num189 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - (npc.width / 2) - vector22.X; - float num190 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - (npc.height / 2) - vector22.Y; + Vector2 vector22 = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f); + float num189 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - (NPC.width / 2) - vector22.X; + float num190 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - (NPC.height / 2) - vector22.Y; float num191 = (float)Math.Sqrt(num189 * num189 + num190 * num190); float num754 = Main.npc[num750].position.X + (Main.npc[num750].width / 2); float num755 = Main.npc[num750].position.Y + (Main.npc[num750].height / 2); Vector2 vector93 = new Vector2(num754, num755); - float num756 = num754 + npc.ai[0]; - float num757 = num755 + npc.ai[1]; + float num756 = num754 + NPC.ai[0]; + float num757 = num755 + NPC.ai[1]; float num758 = num756 - vector93.X; float num759 = num757 - vector93.Y; float num760 = (float)Math.Sqrt(num758 * num758 + num759 * num759); num760 = num752 / num760; num758 *= num760; num759 *= num760; - if (npc.position.X < num754 + num758) + if (NPC.position.X < num754 + num758) { - npc.velocity.X = npc.velocity.X + num751; - if (npc.velocity.X < 0f && num758 > 0f) - npc.velocity.X = npc.velocity.X * 0.8f; + NPC.velocity.X = NPC.velocity.X + num751; + if (NPC.velocity.X < 0f && num758 > 0f) + NPC.velocity.X = NPC.velocity.X * 0.8f; } - else if (npc.position.X > num754 + num758) + else if (NPC.position.X > num754 + num758) { - npc.velocity.X = npc.velocity.X - num751; - if (npc.velocity.X > 0f && num758 < 0f) - npc.velocity.X = npc.velocity.X * 0.8f; + NPC.velocity.X = NPC.velocity.X - num751; + if (NPC.velocity.X > 0f && num758 < 0f) + NPC.velocity.X = NPC.velocity.X * 0.8f; } - if (npc.position.Y < num755 + num759) + if (NPC.position.Y < num755 + num759) { - npc.velocity.Y = npc.velocity.Y + num751; - if (npc.velocity.Y < 0f && num759 > 0f) - npc.velocity.Y = npc.velocity.Y * 0.8f; + NPC.velocity.Y = NPC.velocity.Y + num751; + if (NPC.velocity.Y < 0f && num759 > 0f) + NPC.velocity.Y = NPC.velocity.Y * 0.8f; } - else if (npc.position.Y > num755 + num759) + else if (NPC.position.Y > num755 + num759) { - npc.velocity.Y = npc.velocity.Y - num751; - if (npc.velocity.Y > 0f && num759 < 0f) - npc.velocity.Y = npc.velocity.Y * 0.8f; + NPC.velocity.Y = NPC.velocity.Y - num751; + if (NPC.velocity.Y > 0f && num759 < 0f) + NPC.velocity.Y = NPC.velocity.Y * 0.8f; } float velocityLimit = 8f; - if (npc.velocity.X > velocityLimit) - npc.velocity.X = velocityLimit; - if (npc.velocity.X < -velocityLimit) - npc.velocity.X = -velocityLimit; - if (npc.velocity.Y > velocityLimit) - npc.velocity.Y = velocityLimit; - if (npc.velocity.Y < -velocityLimit) - npc.velocity.Y = -velocityLimit; + if (NPC.velocity.X > velocityLimit) + NPC.velocity.X = velocityLimit; + if (NPC.velocity.X < -velocityLimit) + NPC.velocity.X = -velocityLimit; + if (NPC.velocity.Y > velocityLimit) + NPC.velocity.Y = velocityLimit; + if (NPC.velocity.Y < -velocityLimit) + NPC.velocity.Y = -velocityLimit; if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - npc.localAI[1] = 180f; + if (!Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) + NPC.localAI[1] = 180f; - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 360f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 80f) + NPC.localAI[1] += 1f; + if (NPC.localAI[1] >= 360f && Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 80f) { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.localAI[1] = 0f; + NPC.TargetClosest(true); + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { float num941 = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3.5f; - Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); - float num942 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector104.X; - float num943 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector104.Y; + Vector2 vector104 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + (NPC.height / 2)); + float num942 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector104.X; + float num943 = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - vector104.Y; float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); num944 = num941 / num944; num942 *= num944; num943 *= num944; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, type, damage, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; + NPC.netUpdate = true; } } } @@ -157,9 +157,9 @@ namespace CalamityMod.NPCs.HiveMind { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(8) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } } @@ -172,13 +172,13 @@ namespace CalamityMod.NPCs.HiveMind { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/HiveMind/HiveCyst.cs b/NPCs/HiveMind/HiveCyst.cs index 6abbf53083..c787ae3ced 100644 --- a/NPCs/HiveMind/HiveCyst.cs +++ b/NPCs/HiveMind/HiveCyst.cs @@ -11,45 +11,45 @@ namespace CalamityMod.NPCs.HiveMind public override void SetStaticDefaults() { DisplayName.SetDefault("Hive Cyst"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.npcSlots = 0f; - npc.aiStyle = -1; + NPC.npcSlots = 0f; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 0; - npc.width = 30; //324 - npc.height = 30; //216 - npc.defense = 0; - npc.lifeMax = 1000; - npc.knockBackResist = 0f; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit1; - npc.rarity = 2; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.damage = 0; + NPC.width = 30; //324 + NPC.height = 30; //216 + NPC.defense = 0; + NPC.lifeMax = 1000; + NPC.knockBackResist = 0f; + NPC.chaseable = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.rarity = 2; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) return 0f; - if (spawnInfo.player.Calamity().disableHiveCystSpawns) + if (spawnInfo.Player.Calamity().disableHiveCystSpawns) return 0f; bool anyBossElements = NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()); - bool corrupt = TileID.Sets.Corrupt[spawnInfo.spawnTileType] || spawnInfo.spawnTileType == TileID.Demonite && spawnInfo.player.ZoneCorrupt; + bool corrupt = TileID.Sets.Corrupt[spawnInfo.spawnTileType] || spawnInfo.spawnTileType == TileID.Demonite && spawnInfo.Player.ZoneCorrupt; if (anyBossElements || spawnInfo.playerSafe || !corrupt) return 0f; @@ -61,25 +61,25 @@ namespace CalamityMod.NPCs.HiveMind public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = 2000; - npc.damage = 0; + NPC.lifeMax = 2000; + NPC.damage = 0; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(ModContent.NPCType()) < 1) { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + Vector2 spawnAt = NPC.Center + new Vector2(0f, (float)NPC.height / 2f); NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType()); } } diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index b5f56cbb7a..607009bdff 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -20,6 +20,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; /* states: * 0 = slow drift * 1 = reelback and teleport after spawn enemy @@ -82,29 +83,29 @@ namespace CalamityMod.NPCs.HiveMind public override void SetStaticDefaults() { DisplayName.SetDefault("The Hive Mind"); - Main.npcFrameCount[npc.type] = 16; - NPCID.Sets.TrailingMode[npc.type] = 1; - NPCID.Sets.TrailCacheLength[npc.type] = npc.oldPos.Length; + Main.npcFrameCount[NPC.type] = 16; + NPCID.Sets.TrailingMode[NPC.type] = 1; + NPCID.Sets.TrailCacheLength[NPC.type] = NPC.oldPos.Length; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 5f; - npc.GetNPCDamage(); - npc.width = 178; - npc.height = 122; - npc.defense = 8; - npc.LifeMaxNERB(8500, 10200, 350000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 5f; + NPC.GetNPCDamage(); + NPC.width = 178; + NPC.height = 122; + NPC.defense = 8; + NPC.LifeMaxNERB(8500, 10200, 350000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 15, 0, 0); - npc.boss = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 15, 0, 0); + NPC.boss = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; music = CalamityMod.Instance.GetMusicFromMusicMod("HiveMind") ?? MusicID.Boss2; bossBag = ModContent.ItemType(); @@ -146,14 +147,14 @@ namespace CalamityMod.NPCs.HiveMind phase2timer = minimumDriftTime; rotationIncrement = 0.0246399424 * lungeRots * lungeFade; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void BossHeadSlot(ref int index) { - if (npc.life / (float)npc.lifeMax < 0.8f) + if (NPC.life / (float)NPC.lifeMax < 0.8f) index = phase2IconIndex; else index = normalIconIndex; @@ -162,12 +163,12 @@ namespace CalamityMod.NPCs.HiveMind public override void SendExtraAI(BinaryWriter writer) { writer.Write(biomeEnrageTimer); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.noTileCollide); - writer.Write(npc.noGravity); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.noTileCollide); + writer.Write(NPC.noGravity); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[3]); writer.Write(burrowTimer); writer.Write(state); writer.Write(nextState); @@ -184,12 +185,12 @@ namespace CalamityMod.NPCs.HiveMind public override void ReceiveExtraAI(BinaryReader reader) { biomeEnrageTimer = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.noTileCollide = reader.ReadBoolean(); - npc.noGravity = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.noTileCollide = reader.ReadBoolean(); + NPC.noGravity = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); burrowTimer = reader.ReadInt32(); state = reader.ReadInt32(); nextState = reader.ReadInt32(); @@ -206,15 +207,15 @@ namespace CalamityMod.NPCs.HiveMind public override void FindFrame(int frameHeight) { // When Hive Mind starts flying around - bool phase2 = npc.life / (float)npc.lifeMax < 0.8f; + bool phase2 = NPC.life / (float)NPC.lifeMax < 0.8f; if (phase2) { - npc.frameCounter++; - if (npc.frameCounter >= 6D) + NPC.frameCounter++; + if (NPC.frameCounter >= 6D) { // Reset frame counter - npc.frameCounter = 0D; + NPC.frameCounter = 0D; // Increment the Y frame frameY++; @@ -233,24 +234,24 @@ namespace CalamityMod.NPCs.HiveMind } else { - npc.frameCounter += 1f / 6f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 1f / 6f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { // When Hive Mind starts flying around - bool phase2 = npc.life / (float)npc.lifeMax < 0.8f; + bool phase2 = NPC.life / (float)NPC.lifeMax < 0.8f; if (phase2) { - SpriteEffects spriteEffects = npc.direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.GetTexture("CalamityMod/NPCs/HiveMind/HiveMindP2"); - Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); - Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); + SpriteEffects spriteEffects = NPC.direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = ModContent.Request("CalamityMod/NPCs/HiveMind/HiveMindP2"); + Rectangle frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); + Vector2 vector = new Vector2(NPC.width / 2, NPC.height / 2); Color afterimageBaseColor = Color.White; int numAfterimages = 5; @@ -260,17 +261,17 @@ namespace CalamityMod.NPCs.HiveMind { Color afterimageColor = drawColor; afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); - afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (numAfterimages - i) / 15f; - Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX_Phase2, maxFramesY_Phase2) * npc.scale / 2f; - afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.oldRot[i], vector, npc.scale, spriteEffects, 0f); + Vector2 afterimageCenter = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height) / new Vector2(maxFramesX_Phase2, maxFramesY_Phase2) * NPC.scale / 2f; + afterimageCenter += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, NPC.frame, afterimageColor, NPC.oldRot[i], vector, NPC.scale, spriteEffects, 0f); } } - Vector2 center = npc.Center - Main.screenPosition; - spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + Vector2 center = NPC.Center - Main.screenPosition; + spriteBatch.Draw(texture, center, frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; } @@ -308,20 +309,20 @@ namespace CalamityMod.NPCs.HiveMind while (NPC.AnyNPCs(type) && choice < 5); if (choice < 5) - NPC.NewNPC((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), type); + NPC.NewNPC((int)NPC.position.X + Main.rand.Next(NPC.width), (int)NPC.position.Y + Main.rand.Next(NPC.height), type); } } private void ReelBack() { - npc.alpha = 0; + NPC.alpha = 0; phase2timer = 0; - deceleration = npc.velocity / 255f * reelbackFade; + deceleration = NPC.velocity / 255f * reelbackFade; if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { state = 2; - Main.PlaySound(SoundID.ForceRoar, (int)npc.Center.X, (int)npc.Center.Y, -1, 1f, 0f); + SoundEngine.PlaySound(SoundID.ForceRoar, (int)NPC.Center.X, (int)NPC.Center.Y, -1, 1f, 0f); } else { @@ -332,23 +333,23 @@ namespace CalamityMod.NPCs.HiveMind nextState = 0; if (state == 2) - Main.PlaySound(SoundID.Roar, (int)npc.Center.X, (int)npc.Center.Y, 0); + SoundEngine.PlaySound(SoundID.Roar, (int)NPC.Center.X, (int)NPC.Center.Y, 0); else - Main.PlaySound(SoundID.ForceRoar, (int)npc.Center.X, (int)npc.Center.Y, -1, 1f, 0f); + SoundEngine.PlaySound(SoundID.ForceRoar, (int)NPC.Center.X, (int)NPC.Center.Y, -1, 1f, 0f); } } public override void AI() { // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; @@ -356,10 +357,10 @@ namespace CalamityMod.NPCs.HiveMind bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Enrage - if ((!player.ZoneCorrupt || (npc.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) + if ((!player.ZoneCorrupt || (NPC.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) { if (biomeEnrageTimer > 0) biomeEnrageTimer--; @@ -372,12 +373,12 @@ namespace CalamityMod.NPCs.HiveMind float enrageScale = BossRushEvent.BossRushActive ? 1f : 0f; if (biomeEnraged && (!player.ZoneCorrupt || malice)) { - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; } - if (biomeEnraged && ((npc.position.Y / 16f) < Main.worldSurface || malice)) + if (biomeEnraged && ((NPC.position.Y / 16f) < Main.worldSurface || malice)) { - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; } @@ -388,53 +389,53 @@ namespace CalamityMod.NPCs.HiveMind if (phase2) { // Spawn gores, play sound and reset every crucial variable at the start - if (npc.localAI[1] == 0f) + if (NPC.localAI[1] == 0f) { - npc.localAI[1] = 1f; + NPC.localAI[1] = 1f; int goreAmount = 7; for (int i = 1; i <= goreAmount; i++) - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore" + i), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore" + i), 1f); - Main.PlaySound(SoundID.NPCDeath1, (int)npc.Center.X, (int)npc.Center.Y); + SoundEngine.PlaySound(SoundID.NPCDeath1, (int)NPC.Center.X, (int)NPC.Center.Y); - npc.position = npc.Center; - npc.height = height_Phase2; - npc.position -= npc.Size * 0.5f; + NPC.position = NPC.Center; + NPC.height = height_Phase2; + NPC.position -= NPC.Size * 0.5f; - npc.frame.Y = 0; - npc.noGravity = true; - npc.noTileCollide = true; - npc.scale = 1f; - npc.alpha = 0; - npc.dontTakeDamage = false; - npc.damage = npc.defDamage; + NPC.frame.Y = 0; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.scale = 1f; + NPC.alpha = 0; + NPC.dontTakeDamage = false; + NPC.damage = NPC.defDamage; } - npc.frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + NPC.frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); } else { - CalamityGlobalNPC.hiveMind = npc.whoAmI; + CalamityGlobalNPC.hiveMind = NPC.whoAmI; if (!player.active || player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (!player.active || player.dead) { - if (npc.timeLeft > 60) - npc.timeLeft = 60; + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; - if (npc.localAI[3] < 120f) - npc.localAI[3] += 1f; + if (NPC.localAI[3] < 120f) + NPC.localAI[3] += 1f; - if (npc.localAI[3] > 60f) + if (NPC.localAI[3] > 60f) { - npc.velocity.Y += (npc.localAI[3] - 60f) * 0.5f; + NPC.velocity.Y += (NPC.localAI[3] - 60f) * 0.5f; - npc.noGravity = true; - npc.noTileCollide = true; + NPC.noGravity = true; + NPC.noTileCollide = true; if (burrowTimer > 30) burrowTimer = 30; @@ -443,48 +444,48 @@ namespace CalamityMod.NPCs.HiveMind return; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; - if (npc.localAI[3] > 0f) + if (NPC.localAI[3] > 0f) { - npc.localAI[3] -= 1f; + NPC.localAI[3] -= 1f; return; } - npc.noGravity = false; - npc.noTileCollide = false; + NPC.noGravity = false; + NPC.noTileCollide = false; if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.localAI[0] == 0f) + if (NPC.localAI[0] == 0f) { - npc.localAI[0] = 1f; + NPC.localAI[0] = 1f; int maxBlobs = death ? 15 : revenge ? 7 : expertMode ? 6 : 5; for (int i = 0; i < maxBlobs; i++) - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); + NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); } } - if (npc.ai[3] == 0f && npc.life > 0) - npc.ai[3] = npc.lifeMax; + if (NPC.ai[3] == 0f && NPC.life > 0) + NPC.ai[3] = NPC.lifeMax; - if (npc.life > 0) + if (NPC.life > 0) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)(npc.lifeMax * 0.05); - if ((npc.life + num660) < npc.ai[3]) + int num660 = (int)(NPC.lifeMax * 0.05); + if ((NPC.life + num660) < NPC.ai[3]) { - npc.ai[3] = npc.life; + NPC.ai[3] = NPC.life; int maxSpawns = malice ? 10 : death ? 5 : revenge ? 4 : expertMode ? Main.rand.Next(3, 5) : Main.rand.Next(2, 4); int maxDankSpawns = malice ? 4 : death ? Main.rand.Next(2, 4) : revenge ? 2 : expertMode ? Main.rand.Next(1, 3) : 1; for (int num662 = 0; num662 < maxSpawns; num662++) { - int x = (int)(npc.position.X + Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 32)); + int x = (int)(NPC.position.X + Main.rand.Next(NPC.width - 32)); + int y = (int)(NPC.position.Y + Main.rand.Next(NPC.height - 32)); int type = ModContent.NPCType(); if (NPC.CountNPCS(ModContent.NPCType()) < maxDankSpawns) @@ -508,17 +509,17 @@ namespace CalamityMod.NPCs.HiveMind if (burrowTimer < 30) burrowTimer = 30; - npc.scale = 1f; - npc.alpha = 0; - npc.dontTakeDamage = false; - npc.damage = npc.defDamage; + NPC.scale = 1f; + NPC.alpha = 0; + NPC.dontTakeDamage = false; + NPC.damage = NPC.defDamage; } else if (burrowTimer < -60) { - npc.scale += 0.0165f; - npc.alpha -= 4; + NPC.scale += 0.0165f; + NPC.alpha -= 4; - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 2.5f * npc.scale); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); Main.dust[num622].velocity *= 2f; if (Main.rand.NextBool(2)) { @@ -528,42 +529,42 @@ namespace CalamityMod.NPCs.HiveMind for (int i = 0; i < 2; i++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 3.5f * npc.scale); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 3.5f * NPC.scale); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 3.5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 2.5f * npc.scale); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); Main.dust[num624].velocity *= 1f; } } else if (burrowTimer == -60) { - npc.scale = 0.01f; + NPC.scale = 0.01f; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.Center = player.Center; - npc.position.Y = player.position.Y - npc.height; - int tilePosX = (int)npc.Center.X / 16; - int tilePosY = (int)(npc.position.Y + npc.height) / 16 + 1; + NPC.Center = player.Center; + NPC.position.Y = player.position.Y - NPC.height; + int tilePosX = (int)NPC.Center.X / 16; + int tilePosY = (int)(NPC.position.Y + NPC.height) / 16 + 1; if (Main.tile[tilePosX, tilePosY] == null) Main.tile[tilePosX, tilePosY] = new Tile(); - while (!(Main.tile[tilePosX, tilePosY].nactive() && Main.tileSolid[Main.tile[tilePosX, tilePosY].type])) + while (!(Main.tile[tilePosX, tilePosY].nactive() && Main.tileSolid[Main.tile[tilePosX, tilePosY].TileType])) { tilePosY++; - npc.position.Y += 16; + NPC.position.Y += 16; if (Main.tile[tilePosX, tilePosY] == null) Main.tile[tilePosX, tilePosY] = new Tile(); } } - npc.netUpdate = true; + NPC.netUpdate = true; } else if (burrowTimer < 0) { - npc.scale -= 0.0165f; - npc.alpha += 4; + NPC.scale -= 0.0165f; + NPC.alpha += 4; - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 2.5f * npc.scale); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); Main.dust[num622].velocity *= 2f; if (Main.rand.NextBool(2)) { @@ -573,10 +574,10 @@ namespace CalamityMod.NPCs.HiveMind for (int i = 0; i < 2; i++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 3.5f * npc.scale); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 3.5f * NPC.scale); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 3.5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default, 2.5f * npc.scale); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale); Main.dust[num624].velocity *= 1f; } } @@ -588,33 +589,33 @@ namespace CalamityMod.NPCs.HiveMind } else { - npc.TargetClosest(); - npc.dontTakeDamage = true; - npc.damage = 0; + NPC.TargetClosest(); + NPC.dontTakeDamage = true; + NPC.damage = 0; } } return; } - if (npc.alpha != 0) + if (NPC.alpha != 0) { - if (npc.damage != 0) - npc.damage = 0; + if (NPC.damage != 0) + NPC.damage = 0; } else - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; switch (state) { case 0: // Slowdrift - if (npc.alpha > 0) - npc.alpha -= 3; + if (NPC.alpha > 0) + NPC.alpha -= 3; if (nextState == 0) { - npc.TargetClosest(); + NPC.TargetClosest(); if (revenge && lifeRatio < 0.53f) { if (death) @@ -657,85 +658,85 @@ namespace CalamityMod.NPCs.HiveMind else nextState = 1; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } } if (nextState == 3) rotation = MathHelper.ToRadians(Main.rand.Next(360)); - npc.netUpdate = true; + NPC.netUpdate = true; } - if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 5000f) + if (!player.active || player.dead || Vector2.Distance(NPC.Center, player.Center) > 5000f) { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 5000f) + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + if (!player.active || player.dead || Vector2.Distance(NPC.Center, player.Center) > 5000f) { - if (npc.timeLeft > 60) - npc.timeLeft = 60; + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; - if (npc.localAI[3] < 120f) - npc.localAI[3] += 1f; + if (NPC.localAI[3] < 120f) + NPC.localAI[3] += 1f; - if (npc.localAI[3] > 60f) - npc.velocity.Y += (npc.localAI[3] - 60f) * 0.5f; + if (NPC.localAI[3] > 60f) + NPC.velocity.Y += (NPC.localAI[3] - 60f) * 0.5f; return; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; - if (npc.localAI[3] > 0f) + if (NPC.localAI[3] > 0f) { - npc.localAI[3] -= 1f; + NPC.localAI[3] -= 1f; return; } - npc.velocity = player.Center - npc.Center; + NPC.velocity = player.Center - NPC.Center; phase2timer--; if (phase2timer <= -180) // No stalling drift mode forever { - npc.velocity *= 2f / 255f * (reelbackFade + 2 * (int)enrageScale); + NPC.velocity *= 2f / 255f * (reelbackFade + 2 * (int)enrageScale); ReelBack(); - npc.netUpdate = true; + NPC.netUpdate = true; } else { - npc.velocity.Normalize(); + NPC.velocity.Normalize(); if (expertMode) // Variable velocity in expert and up - npc.velocity *= driftSpeed + enrageScale + driftBoost * lifeRatio; + NPC.velocity *= driftSpeed + enrageScale + driftBoost * lifeRatio; else - npc.velocity *= driftSpeed + enrageScale; + NPC.velocity *= driftSpeed + enrageScale; } break; case 1: // Reelback and teleport - npc.alpha += reelbackFade + 2 * (int)enrageScale; - npc.velocity -= deceleration; + NPC.alpha += reelbackFade + 2 * (int)enrageScale; + NPC.velocity -= deceleration; - if (npc.alpha >= 255) + if (NPC.alpha >= 255) { - npc.alpha = 255; - npc.velocity = Vector2.Zero; + NPC.alpha = 255; + NPC.velocity = Vector2.Zero; state = 0; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] != 0f && npc.ai[2] != 0f) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[1] != 0f && NPC.ai[2] != 0f) { - npc.position.X = npc.ai[1] * 16 - npc.width / 2; - npc.position.Y = npc.ai[2] * 16 - npc.height / 2; + NPC.position.X = NPC.ai[1] * 16 - NPC.width / 2; + NPC.position.Y = NPC.ai[2] * 16 - NPC.height / 2; } phase2timer = minimumDriftTime + Main.rand.Next(121); - npc.netUpdate = true; + NPC.netUpdate = true; } - else if (npc.ai[1] == 0f && npc.ai[2] == 0f) + else if (NPC.ai[1] == 0f && NPC.ai[2] == 0f) { for (int i = 0; i < 10; i++) { @@ -743,9 +744,9 @@ namespace CalamityMod.NPCs.HiveMind int posY = (int)player.Center.Y / 16 + Main.rand.Next(15, 46) * (Main.rand.NextBool(2) ? -1 : 1); if (!WorldGen.SolidTile(posX, posY) && Collision.CanHit(new Vector2(posX * 16, posY * 16), 1, 1, player.position, player.width, player.height)) { - npc.ai[1] = posX; - npc.ai[2] = posY; - npc.netUpdate = true; + NPC.ai[1] = posX; + NPC.ai[2] = posY; + NPC.netUpdate = true; break; } } @@ -755,13 +756,13 @@ namespace CalamityMod.NPCs.HiveMind case 2: // Reelback for lunge + death legacy - npc.alpha += reelbackFade + 2 * (int)enrageScale; - npc.velocity -= deceleration; + NPC.alpha += reelbackFade + 2 * (int)enrageScale; + NPC.velocity -= deceleration; - if (npc.alpha >= 255) + if (NPC.alpha >= 255) { - npc.alpha = 255; - npc.velocity = Vector2.Zero; + NPC.alpha = 255; + NPC.velocity = Vector2.Zero; dashStarted = false; if (revenge && lifeRatio < 0.53f) @@ -785,13 +786,13 @@ namespace CalamityMod.NPCs.HiveMind case 3: // Lunge - npc.netUpdate = true; - if (npc.alpha > 0) + NPC.netUpdate = true; + if (NPC.alpha > 0) { - npc.alpha -= lungeFade; + NPC.alpha -= lungeFade; if (Main.netMode != NetmodeID.MultiplayerClient) - npc.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); + NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); rotation += rotationIncrement * rotationDirection; phase2timer = lungeDelay; @@ -804,16 +805,16 @@ namespace CalamityMod.NPCs.HiveMind if (phase2timer <= 0) { phase2timer = lungeTime - 4 * (int)enrageScale; - npc.velocity = player.Center + (malice ? player.velocity * 20f : Vector2.Zero) - npc.Center; - npc.velocity.Normalize(); - npc.velocity *= teleportRadius / (lungeTime - (int)enrageScale); + NPC.velocity = player.Center + (malice ? player.velocity * 20f : Vector2.Zero) - NPC.Center; + NPC.velocity.Normalize(); + NPC.velocity *= teleportRadius / (lungeTime - (int)enrageScale); dashStarted = true; - Main.PlaySound(SoundID.Roar, (int)npc.Center.X, (int)npc.Center.Y, 0); + SoundEngine.PlaySound(SoundID.Roar, (int)NPC.Center.X, (int)NPC.Center.Y, 0); } else { if (Main.netMode != NetmodeID.MultiplayerClient) - npc.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); + NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); rotation += rotationIncrement * rotationDirection * phase2timer / lungeDelay; } @@ -824,7 +825,7 @@ namespace CalamityMod.NPCs.HiveMind { state = 6; phase2timer = 0; - deceleration = npc.velocity / decelerationTime; + deceleration = NPC.velocity / decelerationTime; } } } @@ -833,53 +834,53 @@ namespace CalamityMod.NPCs.HiveMind case 4: // Enemy spawn arc - if (npc.alpha > 0) + if (NPC.alpha > 0) { - npc.alpha -= 5; + NPC.alpha -= 5; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.Center = player.Center; - npc.position.Y += teleportRadius; + NPC.Center = player.Center; + NPC.position.Y += teleportRadius; } - npc.netUpdate = true; + NPC.netUpdate = true; } else { if (!dashStarted) { dashStarted = true; - Main.PlaySound(SoundID.Roar, (int)npc.Center.X, (int)npc.Center.Y, 0); - npc.velocity.X = MathHelper.Pi * teleportRadius / arcTime; - npc.velocity *= rotationDirection; - npc.netUpdate = true; + SoundEngine.PlaySound(SoundID.Roar, (int)NPC.Center.X, (int)NPC.Center.Y, 0); + NPC.velocity.X = MathHelper.Pi * teleportRadius / arcTime; + NPC.velocity *= rotationDirection; + NPC.netUpdate = true; } else { - npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / arcTime * -rotationDirection); + NPC.velocity = NPC.velocity.RotatedBy(MathHelper.Pi / arcTime * -rotationDirection); phase2timer++; if (phase2timer == (int)arcTime / 6) { phase2timer = 0; - npc.ai[0]++; - if (Main.netMode != NetmodeID.MultiplayerClient && Collision.CanHit(npc.Center, 1, 1, player.position, player.width, player.height)) + NPC.ai[0]++; + if (Main.netMode != NetmodeID.MultiplayerClient && Collision.CanHit(NPC.Center, 1, 1, player.position, player.width, player.height)) { - if (npc.ai[0] == 2 || npc.ai[0] == 4) + if (NPC.ai[0] == 2 || NPC.ai[0] == 4) { if (expertMode && !NPC.AnyNPCs(ModContent.NPCType())) - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType()); + NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); } else if (!NPC.AnyNPCs(NPCID.EaterofSouls)) - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.EaterofSouls); + NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y, NPCID.EaterofSouls); } - if (npc.ai[0] == 6) + if (NPC.ai[0] == 6) { - npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / arcTime * -rotationDirection); + NPC.velocity = NPC.velocity.RotatedBy(MathHelper.Pi / arcTime * -rotationDirection); SpawnStuff(); state = 6; - npc.ai[0] = 0; - deceleration = npc.velocity / decelerationTime; + NPC.ai[0] = 0; + deceleration = NPC.velocity / decelerationTime; } } } @@ -889,26 +890,26 @@ namespace CalamityMod.NPCs.HiveMind case 5: // Rain dash - if (npc.alpha > 0) + if (NPC.alpha > 0) { - npc.alpha -= 5; + NPC.alpha -= 5; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.Center = player.Center; - npc.position.Y -= teleportRadius; - npc.position.X += teleportRadius * rotationDirection; + NPC.Center = player.Center; + NPC.position.Y -= teleportRadius; + NPC.position.X += teleportRadius * rotationDirection; } - npc.netUpdate = true; + NPC.netUpdate = true; } else { if (!dashStarted) { dashStarted = true; - Main.PlaySound(SoundID.Roar, (int)npc.Center.X, (int)npc.Center.Y, 0); - npc.velocity.X = teleportRadius / arcTime * 3; - npc.velocity *= -rotationDirection; - npc.netUpdate = true; + SoundEngine.PlaySound(SoundID.Roar, (int)NPC.Center.X, (int)NPC.Center.Y, 0); + NPC.velocity.X = teleportRadius / arcTime * 3; + NPC.velocity *= -rotationDirection; + NPC.netUpdate = true; } else { @@ -916,19 +917,19 @@ namespace CalamityMod.NPCs.HiveMind if (phase2timer == (int)arcTime / 20) { phase2timer = 0; - npc.ai[0]++; + NPC.ai[0]++; if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height), 0, 0, type, damage, 0, Main.myPlayer, 11, 0); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.position.X + Main.rand.Next(NPC.width), NPC.position.Y + Main.rand.Next(NPC.height), 0, 0, type, damage, 0, Main.myPlayer, 11, 0); } - if (npc.ai[0] == 10) + if (NPC.ai[0] == 10) { state = 6; - npc.ai[0] = 0; - deceleration = npc.velocity / decelerationTime; + NPC.ai[0] = 0; + deceleration = NPC.velocity / decelerationTime; } } } @@ -938,30 +939,30 @@ namespace CalamityMod.NPCs.HiveMind case 6: // Deceleration - npc.velocity -= deceleration; + NPC.velocity -= deceleration; phase2timer++; if (phase2timer == decelerationTime) { phase2timer = minimumDriftTime + Main.rand.Next(121); state = 0; - npc.netUpdate = true; + NPC.netUpdate = true; } break; } } - public override bool? CanHitNPC(NPC target) => npc.alpha == 0; // Can only be hit while fully visible + public override bool? CanHitNPC(NPC target) => NPC.alpha == 0; // Can only be hit while fully visible // Can only hit the target if within certain distance public override bool CanHitPlayer(Player target, ref int cooldownSlot) { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -971,41 +972,41 @@ namespace CalamityMod.NPCs.HiveMind if (dist4 < minDist) minDist = dist4; - return minDist <= 60f && npc.alpha == 0 && npc.scale == 1f; // No damage while not fully visible or shrunk + return minDist <= 60f && NPC.alpha == 0 && NPC.scale == 1f; // No damage while not fully visible or shrunk } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => npc.scale == 1f; // Only draw HP bar while at full size + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => NPC.scale == 1f; // Only draw HP bar while at full size public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { if (phase2timer < 0 && damage > 1) { - npc.velocity *= -4f; + NPC.velocity *= -4f; ReelBack(); - npc.netUpdate = true; + NPC.netUpdate = true; } return true; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < damage / npc.lifeMax * 100.0; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + for (int k = 0; k < damage / NPC.lifeMax * 100.0; k++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hitDirection, -1f, 0, default, 1f); // When Hive Mind starts flying around - bool phase2 = npc.life / (float)npc.lifeMax < 0.8f; + bool phase2 = NPC.life / (float)NPC.lifeMax < 0.8f; if (phase2) { if (Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(15) && NPC.CountNPCS(ModContent.NPCType()) < 2) { - Vector2 spawnAt = npc.Center + new Vector2(0f, npc.height / 2f); + Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType()); } } @@ -1015,33 +1016,33 @@ namespace CalamityMod.NPCs.HiveMind { if (Main.rand.NextBool(60) && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 spawnAt = npc.Center + new Vector2(0f, npc.height / 2f); + Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, NPCID.EaterofSouls); } if (Main.rand.NextBool(150) && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 spawnAt = npc.Center + new Vector2(0f, npc.height / 2f); + Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, NPCID.DevourerHead); } } } - if (npc.life <= 0) + if (NPC.life <= 0) { int goreAmount = 10; for (int i = 1; i <= goreAmount; i++) - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore" + i), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore" + i), 1f); - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 200; - npc.height = 150; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 200; + NPC.height = 150; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 14, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -1051,10 +1052,10 @@ namespace CalamityMod.NPCs.HiveMind } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 14, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 14, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -1067,12 +1068,12 @@ namespace CalamityMod.NPCs.HiveMind public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedHiveMind); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedHiveMind); CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Dryad }, CalamityWorld.downedHiveMind); @@ -1080,16 +1081,16 @@ namespace CalamityMod.NPCs.HiveMind if (!Main.expertMode) { // Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 25, 30, 5); - DropHelper.DropItemSpray(npc, ItemID.DemoniteBar, 8, 12, 2); - DropHelper.DropItemSpray(npc, ItemID.RottenChunk, 9, 15, 3); + DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 25, 30, 5); + DropHelper.DropItemSpray(NPC, ItemID.DemoniteBar, 8, 12, 2); + DropHelper.DropItemSpray(NPC, ItemID.RottenChunk, 9, 15, 3); if (Main.hardMode) - DropHelper.DropItemSpray(npc, ItemID.CursedFlame, 10, 20, 2); - DropHelper.DropItem(npc, ItemID.CorruptSeeds, 10, 15); + DropHelper.DropItemSpray(NPC, ItemID.CursedFlame, 10, 20, 2); + DropHelper.DropItem(NPC, ItemID.CorruptSeeds, 10, 15); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -1101,11 +1102,11 @@ namespace CalamityMod.NPCs.HiveMind ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } // If neither The Hive Mind nor The Perforator Hive have been killed yet, notify players of Aerialite Ore diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index efc5eb654e..5d874ecb86 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -14,51 +14,51 @@ namespace CalamityMod.NPCs.Leviathan public override void SetStaticDefaults() { DisplayName.SetDefault("Aquatic Aberration"); - Main.npcFrameCount[npc.type] = 7; + Main.npcFrameCount[NPC.type] = 7; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.aiStyle = -1; - npc.GetNPCDamage(); - npc.width = 50; - npc.height = 50; - npc.defense = 14; - npc.lifeMax = 800; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 50; + NPC.height = 50; + NPC.defense = 14; + NPC.lifeMax = 800; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 10000; + NPC.lifeMax = 10000; } - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; aiType = -1; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { if (CalamityGlobalNPC.leviathan < 0 || !Main.npc[CalamityGlobalNPC.leviathan].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } @@ -67,16 +67,16 @@ namespace CalamityMod.NPCs.Leviathan bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - npc.TargetClosest(false); + NPC.TargetClosest(false); - npc.rotation = npc.velocity.ToRotation(); - if (Math.Sign(npc.velocity.X) != 0) - npc.spriteDirection = -Math.Sign(npc.velocity.X); - if (npc.rotation < -MathHelper.PiOver2) - npc.rotation += MathHelper.Pi; - if (npc.rotation > MathHelper.PiOver2) - npc.rotation -= MathHelper.Pi; - npc.spriteDirection = Math.Sign(npc.velocity.X); + NPC.rotation = NPC.velocity.ToRotation(); + if (Math.Sign(NPC.velocity.X) != 0) + NPC.spriteDirection = -Math.Sign(NPC.velocity.X); + if (NPC.rotation < -MathHelper.PiOver2) + NPC.rotation += MathHelper.Pi; + if (NPC.rotation > MathHelper.PiOver2) + NPC.rotation -= MathHelper.Pi; + NPC.spriteDirection = Math.Sign(NPC.velocity.X); // Percent life remaining float lifeRatio = Main.npc[CalamityGlobalNPC.leviathan].life / (float)Main.npc[CalamityGlobalNPC.leviathan].lifeMax; @@ -102,21 +102,21 @@ namespace CalamityMod.NPCs.Leviathan inertia *= 0.75f; float num1006 = 0.111111117f * inertia; - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { float scaleFactor6 = malice ? 14f : death ? 12f : revenge ? 11f : expertMode ? 10f : 8f; if (!sirenAlive || leviathanInPhase4) scaleFactor6 *= 1.25f; - Vector2 center4 = npc.Center; - Vector2 center5 = Main.player[npc.target].Center; + Vector2 center4 = NPC.Center; + Vector2 center5 = Main.player[NPC.target].Center; Vector2 vector126 = center5 - center4; Vector2 vector127 = vector126 - Vector2.UnitY * 300f; float num1013 = vector126.Length(); vector126 = Vector2.Normalize(vector126) * scaleFactor6; vector127 = Vector2.Normalize(vector127) * scaleFactor6; - bool flag64 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - if (npc.ai[3] >= 120f) + bool flag64 = Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1); + if (NPC.ai[3] >= 120f) { flag64 = true; } @@ -124,80 +124,80 @@ namespace CalamityMod.NPCs.Leviathan flag64 = flag64 && vector126.ToRotation() > MathHelper.Pi / num1014 && vector126.ToRotation() < MathHelper.Pi - MathHelper.Pi / num1014; if (num1013 > 800f || !flag64) { - npc.velocity.X = (npc.velocity.X * (inertia - 1f) + vector127.X) / inertia; - npc.velocity.Y = (npc.velocity.Y * (inertia - 1f) + vector127.Y) / inertia; + NPC.velocity.X = (NPC.velocity.X * (inertia - 1f) + vector127.X) / inertia; + NPC.velocity.Y = (NPC.velocity.Y * (inertia - 1f) + vector127.Y) / inertia; if (!flag64) { - npc.ai[3] += 1f; - if (npc.ai[3] == 120f) + NPC.ai[3] += 1f; + if (NPC.ai[3] == 120f) { - npc.netUpdate = true; + NPC.netUpdate = true; } } else { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; } } else { - npc.ai[0] = 1f; - npc.ai[2] = vector126.X; - npc.ai[3] = vector126.Y; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[2] = vector126.X; + NPC.ai[3] = vector126.Y; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - npc.velocity *= 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 5f) + NPC.velocity *= 0.8f; + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 5f) { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]); + NPC.ai[0] = 2f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + Vector2 velocity = new Vector2(NPC.ai[2], NPC.ai[3]); velocity.Normalize(); velocity *= (!sirenAlive || leviathanInPhase4) ? 12f : 10f; - npc.velocity = velocity; + NPC.velocity = velocity; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - npc.ai[1] += 1f; - bool flag65 = npc.Center.Y + 50f > Main.player[npc.target].Center.Y; - if ((npc.ai[1] >= 90f && flag65) || npc.velocity.Length() < ((!sirenAlive || leviathanInPhase4) ? 10f : 8f)) + NPC.ai[1] += 1f; + bool flag65 = NPC.Center.Y + 50f > Main.player[NPC.target].Center.Y; + if ((NPC.ai[1] >= 90f && flag65) || NPC.velocity.Length() < ((!sirenAlive || leviathanInPhase4) ? 10f : 8f)) { - npc.ai[0] = 3f; - npc.ai[1] = 45f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.velocity /= 2f; - npc.netUpdate = true; + NPC.ai[0] = 3f; + NPC.ai[1] = 45f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.velocity /= 2f; + NPC.netUpdate = true; } else { - Vector2 center6 = npc.Center; - Vector2 center7 = Main.player[npc.target].Center; + Vector2 center6 = NPC.Center; + Vector2 center7 = Main.player[NPC.target].Center; Vector2 vec2 = center7 - center6; vec2.Normalize(); if (vec2.HasNaNs()) { - vec2 = new Vector2((float)npc.direction, 0f); + vec2 = new Vector2((float)NPC.direction, 0f); } - npc.velocity = (npc.velocity * (inertia - 1f) + vec2 * (npc.velocity.Length() + num1006)) / inertia; + NPC.velocity = (NPC.velocity * (inertia - 1f) + vec2 * (NPC.velocity.Length() + num1006)) / inertia; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - npc.ai[1] -= (!sirenAlive || leviathanInPhase4) ? 1.5f : 1f; - if (npc.ai[1] <= 0f) + NPC.ai[1] -= (!sirenAlive || leviathanInPhase4) ? 1.5f : 1f; + if (NPC.ai[1] <= 0f) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; } if (death) @@ -207,19 +207,19 @@ namespace CalamityMod.NPCs.Leviathan { if (Main.npc[i].active) { - if (i != npc.whoAmI && Main.npc[i].type == npc.type) + if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) { - if (Vector2.Distance(npc.Center, Main.npc[i].Center) < 80f) + if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 80f) { - if (npc.position.X < Main.npc[i].position.X) - npc.velocity.X -= pushVelocity; + if (NPC.position.X < Main.npc[i].position.X) + NPC.velocity.X -= pushVelocity; else - npc.velocity.X += pushVelocity; + NPC.velocity.X += pushVelocity; - if (npc.position.Y < Main.npc[i].position.Y) - npc.velocity.Y -= pushVelocity; + if (NPC.position.Y < Main.npc[i].position.Y) + NPC.velocity.Y -= pushVelocity; else - npc.velocity.Y += pushVelocity; + NPC.velocity.Y += pushVelocity; } } } @@ -231,9 +231,9 @@ namespace CalamityMod.NPCs.Leviathan { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(4) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } return false; @@ -241,7 +241,7 @@ namespace CalamityMod.NPCs.Leviathan public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur || (!NPC.downedPlantBoss && !CalamityWorld.downedCalamitas)) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur || (!NPC.downedPlantBoss && !CalamityWorld.downedCalamitas)) { return 0f; } @@ -257,13 +257,13 @@ namespace CalamityMod.NPCs.Leviathan { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index e227cee4a8..137e819767 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -20,6 +20,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Leviathan { @@ -35,81 +36,81 @@ namespace CalamityMod.NPCs.Leviathan public override void SetStaticDefaults() { DisplayName.SetDefault("The Leviathan"); - Main.npcFrameCount[npc.type] = 3; + Main.npcFrameCount[NPC.type] = 3; if (!Main.dedServ) - AttackTexture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanAttack"); + AttackTexture = ModContent.Request("CalamityMod/NPCs/Leviathan/LeviathanAttack"); } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 20f; - npc.GetNPCDamage(); - npc.width = 900; - npc.height = 450; - npc.defense = 40; - npc.DR_NERD(0.35f); - npc.LifeMaxNERB(60500, 72560, 600000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 20f; + NPC.GetNPCDamage(); + NPC.width = 900; + NPC.height = 450; + NPC.defense = 40; + NPC.DR_NERD(0.35f); + NPC.LifeMaxNERB(60500, 72560, 600000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.aiStyle = -1; aiType = -1; - npc.Opacity = 0f; - npc.value = Item.buyPrice(0, 60, 0, 0); - npc.HitSound = SoundID.NPCHit56; - npc.DeathSound = SoundID.NPCDeath60; - npc.noTileCollide = true; - npc.noGravity = true; - npc.boss = true; - npc.netAlways = true; + NPC.Opacity = 0f; + NPC.value = Item.buyPrice(0, 60, 0, 0); + NPC.HitSound = SoundID.NPCHit56; + NPC.DeathSound = SoundID.NPCDeath60; + NPC.noTileCollide = true; + NPC.noGravity = true; + NPC.boss = true; + NPC.netAlways = true; music = CalamityMod.Instance.GetMusicFromMusicMod("LeviathanAndAnahita") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(biomeEnrageTimer); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); writer.Write(soundDelay); - writer.Write(npc.Calamity().newAI[3]); + writer.Write(NPC.Calamity().newAI[3]); } public override void ReceiveExtraAI(BinaryReader reader) { biomeEnrageTimer = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); soundDelay = reader.ReadInt32(); - npc.Calamity().newAI[3] = reader.ReadSingle(); + NPC.Calamity().newAI[3] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - CalamityGlobalNPC.leviathan = npc.whoAmI; + CalamityGlobalNPC.leviathan = NPC.whoAmI; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - Vector2 vector = npc.Center; + Vector2 vector = NPC.Center; // Is in spawning animation float spawnAnimationTime = 180f; bool spawnAnimation = calamityGlobalNPC.newAI[3] < spawnAnimationTime; // Don't do damage during spawn animation - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; if (spawnAnimation) - npc.damage = 0; + NPC.damage = 0; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Phases bool phase2 = (lifeRatio < 0.7f || death) && expertMode; @@ -141,17 +142,17 @@ namespace CalamityMod.NPCs.Leviathan soundDelay--; if (Main.rand.NextBool(600) && !spawnAnimation) - Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, (sirenAlive && !death) ? soundChoice : soundChoiceRage); + SoundEngine.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, (sirenAlive && !death) ? soundChoice : soundChoiceRage); // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; bool notOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); @@ -169,38 +170,38 @@ namespace CalamityMod.NPCs.Leviathan float enrageScale = BossRushEvent.BossRushActive ? 1f : 0f; if (biomeEnraged) { - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 2f; } - npc.dontTakeDamage = spawnAnimation; + NPC.dontTakeDamage = spawnAnimation; // Adjust slowing debuff immunity - bool immuneToSlowingDebuffs = npc.ai[0] == 2f; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + bool immuneToSlowingDebuffs = NPC.ai[0] == 2f; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) { - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - npc.velocity.Y += 0.2f; - if (npc.velocity.Y > 16f) - npc.velocity.Y = 16f; + if (NPC.velocity.Y < -3f) + NPC.velocity.Y = -3f; + NPC.velocity.Y += 0.2f; + if (NPC.velocity.Y > 16f) + NPC.velocity.Y = 16f; - if (npc.position.Y > Main.worldSurface * 16.0) + if (NPC.position.Y > Main.worldSurface * 16.0) { for (int x = 0; x < Main.maxNPCs; x++) { @@ -210,16 +211,16 @@ namespace CalamityMod.NPCs.Leviathan Main.npc[x].netUpdate = true; } } - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; } - if (npc.ai[0] != 0f) + if (NPC.ai[0] != 0f) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; } return; @@ -233,19 +234,19 @@ namespace CalamityMod.NPCs.Leviathan float minSpawnVelocity = 0.4f; float maxSpawnVelocity = 4f; float velocityY = maxSpawnVelocity - MathHelper.Lerp(minSpawnVelocity, maxSpawnVelocity, calamityGlobalNPC.newAI[3] / spawnAnimationTime); - npc.velocity = new Vector2(0f, -velocityY); + NPC.velocity = new Vector2(0f, -velocityY); if (calamityGlobalNPC.newAI[3] == 10f) - Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, soundChoiceRage); + SoundEngine.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, soundChoiceRage); - npc.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f); + NPC.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f); calamityGlobalNPC.newAI[3] += 1f; return; } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { float num412 = (sirenAlive && !phase4) ? 3.5f : 7f; float num413 = (sirenAlive && !phase4) ? 0.1f : 0.2f; @@ -270,70 +271,70 @@ namespace CalamityMod.NPCs.Leviathan num415 *= num417; num416 *= num417; - if (npc.velocity.X < num415) + if (NPC.velocity.X < num415) { - npc.velocity.X += num413; - if (npc.velocity.X < 0f && num415 > 0f) - npc.velocity.X += num413; + NPC.velocity.X += num413; + if (NPC.velocity.X < 0f && num415 > 0f) + NPC.velocity.X += num413; } - else if (npc.velocity.X > num415) + else if (NPC.velocity.X > num415) { - npc.velocity.X -= num413; - if (npc.velocity.X > 0f && num415 < 0f) - npc.velocity.X -= num413; + NPC.velocity.X -= num413; + if (NPC.velocity.X > 0f && num415 < 0f) + NPC.velocity.X -= num413; } - if (npc.velocity.Y < num416) + if (NPC.velocity.Y < num416) { - npc.velocity.Y += num413; - if (npc.velocity.Y < 0f && num416 > 0f) - npc.velocity.Y += num413; + NPC.velocity.Y += num413; + if (NPC.velocity.Y < 0f && num416 > 0f) + NPC.velocity.Y += num413; } - else if (npc.velocity.Y > num416) + else if (NPC.velocity.Y > num416) { - npc.velocity.Y -= num413; - if (npc.velocity.Y > 0f && num416 < 0f) - npc.velocity.Y -= num413; + NPC.velocity.Y -= num413; + if (NPC.velocity.Y > 0f && num416 < 0f) + NPC.velocity.Y -= num413; } float playerLocation = vector.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; - npc.ai[1] += 1f; + NPC.ai[1] += 1f; float phaseTimer = 240f; if (!sirenAlive || phase4) phaseTimer -= 120f * (1f - lifeRatio); - if (npc.ai[1] >= phaseTimer) + if (NPC.ai[1] >= phaseTimer) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } else { if (!player.dead) { - npc.ai[2] += 1f; + NPC.ai[2] += 1f; if (!sirenAlive || phase4) - npc.ai[2] += 1f; + NPC.ai[2] += 1f; } - if (npc.ai[2] >= 75f) + if (NPC.ai[2] >= 75f) { - npc.ai[2] = 0f; + NPC.ai[2] = 0f; vector40 = new Vector2(vector.X, vector.Y + 20f); - num415 = vector40.X + 1000f * npc.direction - vector40.X; + num415 = vector40.X + 1000f * NPC.direction - vector40.X; num416 = player.Center.Y - vector40.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { float speed = (sirenAlive && !phase4 && !death) ? 13.5f : 16f; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); if (expertMode) speed = (sirenAlive && !phase4 && !death) ? 14f : 17f; @@ -353,42 +354,42 @@ namespace CalamityMod.NPCs.Leviathan if (soundDelay <= 0) { soundDelay = 120; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LeviathanRoarMeteor"), vector); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LeviathanRoarMeteor"), vector); } } } } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - Vector2 vector119 = new Vector2(vector.X, npc.position.Y + npc.height * 0.8f); + Vector2 vector119 = new Vector2(vector.X, NPC.position.Y + NPC.height * 0.8f); Vector2 vector120 = vector; float num1058 = player.Center.X - vector120.X; float num1059 = player.Center.Y - vector120.Y; float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); - npc.ai[1] += 1f; + NPC.ai[1] += 1f; int num638 = 0; for (int num639 = 0; num639 < Main.maxPlayers; num639++) { if (Main.player[num639].active && !Main.player[num639].dead && (vector - Main.player[num639].Center).Length() < 1000f) num638++; } - npc.ai[1] += num638 / 2; + NPC.ai[1] += num638 / 2; bool flag103 = false; float num640 = (!sirenAlive || phase4) ? 30f : 60f; - if (npc.ai[1] > num640) + if (NPC.ai[1] > num640) { - npc.ai[1] = 0f; - npc.ai[2] += 1f; + NPC.ai[1] = 0f; + NPC.ai[2] += 1f; flag103 = true; } int spawnLimit = (sirenAlive && !phase4) ? 2 : (death ? 3 : 4); if (flag103 && NPC.CountNPCS(ModContent.NPCType()) < spawnLimit) { - Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, soundChoice); + SoundEngine.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, soundChoice); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType()); } @@ -405,58 +406,58 @@ namespace CalamityMod.NPCs.Leviathan num1058 = player.Center.X - vector120.X; num1059 = player.Center.Y - vector120.Y; - if (npc.velocity.X < num1058) + if (NPC.velocity.X < num1058) { - npc.velocity.X += num1064; - if (npc.velocity.X < 0f && num1058 > 0f) - npc.velocity.X += num1064; + NPC.velocity.X += num1064; + if (NPC.velocity.X < 0f && num1058 > 0f) + NPC.velocity.X += num1064; } - else if (npc.velocity.X > num1058) + else if (NPC.velocity.X > num1058) { - npc.velocity.X -= num1064; - if (npc.velocity.X > 0f && num1058 < 0f) - npc.velocity.X -= num1064; + NPC.velocity.X -= num1064; + if (NPC.velocity.X > 0f && num1058 < 0f) + NPC.velocity.X -= num1064; } - if (npc.velocity.Y < num1059) + if (NPC.velocity.Y < num1059) { - npc.velocity.Y += num1064; - if (npc.velocity.Y < 0f && num1059 > 0f) - npc.velocity.Y += num1064; + NPC.velocity.Y += num1064; + if (NPC.velocity.Y < 0f && num1059 > 0f) + NPC.velocity.Y += num1064; } - else if (npc.velocity.Y > num1059) + else if (NPC.velocity.Y > num1059) { - npc.velocity.Y -= num1064; - if (npc.velocity.Y > 0f && num1059 < 0f) - npc.velocity.Y -= num1064; + NPC.velocity.Y -= num1064; + if (NPC.velocity.Y > 0f && num1059 < 0f) + NPC.velocity.Y -= num1064; } } else - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; float playerLocation = vector.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; - if (npc.ai[2] > ((sirenAlive && !phase4) ? 2f : 4f)) + if (NPC.ai[2] > ((sirenAlive && !phase4) ? 2f : 4f)) { - npc.ai[0] = (((phase2 || phase3) && !sirenAlive) || phase4 || death) ? 2f : 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = (((phase2 || phase3) && !sirenAlive) || phase4 || death) ? 2f : 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { Vector2 distFromPlayer = player.Center - vector; float chargeAmt = death ? (phase4 ? 3f : phase3 ? 2f : 1f) : 1f; - if (npc.ai[1] >= chargeAmt * 2f || distFromPlayer.Length() > 2400f) + if (NPC.ai[1] >= chargeAmt * 2f || distFromPlayer.Length() > 2400f) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; return; } @@ -465,24 +466,24 @@ namespace CalamityMod.NPCs.Leviathan if (!sirenAlive || phase4) chargeDistance -= 250f * (1f - lifeRatio); - if (npc.ai[1] % 2f == 0f) + if (NPC.ai[1] % 2f == 0f) { int num24 = 7; for (int j = 0; j < num24; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24) + vector; + Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24) + vector; Vector2 vector4 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); Main.dust[num25].noGravity = true; Main.dust[num25].noLight = true; Main.dust[num25].velocity /= 4f; - Main.dust[num25].velocity -= npc.velocity; + Main.dust[num25].velocity -= NPC.velocity; } - if (Math.Abs(npc.position.Y + (npc.height / 2) - (player.position.Y + (player.height / 2))) < 20f) + if (Math.Abs(NPC.position.Y + (NPC.height / 2) - (player.position.Y + (player.height / 2))) < 20f) { - npc.ai[1] += 1f; - npc.ai[2] = 0f; + NPC.ai[1] += 1f; + NPC.ai[2] = 0f; float num1044 = revenge ? 20f : 18f; num1044 += 2f * enrageScale; @@ -495,14 +496,14 @@ namespace CalamityMod.NPCs.Leviathan float num1046 = player.Center.Y - vector117.Y; float num1047 = (float)Math.Sqrt(num1045 * num1045 + num1046 * num1046); num1047 = num1044 / num1047; - npc.velocity.X = num1045 * num1047; - npc.velocity.Y = num1046 * num1047; + NPC.velocity.X = num1045 * num1047; + NPC.velocity.Y = num1046 * num1047; float playerLocation = vector.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LeviathanRoarCharge"), vector); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LeviathanRoarCharge"), vector); return; } @@ -519,68 +520,68 @@ namespace CalamityMod.NPCs.Leviathan } if (vector.Y < player.Center.Y) - npc.velocity.Y += num1049; + NPC.velocity.Y += num1049; else - npc.velocity.Y -= num1049; + NPC.velocity.Y -= num1049; - if (npc.velocity.Y < -num1048) - npc.velocity.Y = -num1048; - if (npc.velocity.Y > num1048) - npc.velocity.Y = num1048; + if (NPC.velocity.Y < -num1048) + NPC.velocity.Y = -num1048; + if (NPC.velocity.Y > num1048) + NPC.velocity.Y = num1048; if (Math.Abs(vector.X - player.Center.X) > chargeDistance + 200f) - npc.velocity.X += num1049 * npc.direction; + NPC.velocity.X += num1049 * NPC.direction; else if (Math.Abs(vector.X - player.Center.X) < chargeDistance) - npc.velocity.X -= num1049 * npc.direction; + NPC.velocity.X -= num1049 * NPC.direction; else - npc.velocity.X *= 0.8f; + NPC.velocity.X *= 0.8f; - if (npc.velocity.X < -num1048) - npc.velocity.X = -num1048; - if (npc.velocity.X > num1048) - npc.velocity.X = num1048; + if (NPC.velocity.X < -num1048) + NPC.velocity.X = -num1048; + if (NPC.velocity.X > num1048) + NPC.velocity.X = num1048; float playerLocation2 = vector.X - player.Center.X; - npc.direction = playerLocation2 < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation2 < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; } else { - if (npc.velocity.X < 0f) - npc.direction = -1; + if (NPC.velocity.X < 0f) + NPC.direction = -1; else - npc.direction = 1; + NPC.direction = 1; - npc.spriteDirection = npc.direction; + NPC.spriteDirection = NPC.direction; int num1051 = 1; if (vector.X < player.Center.X) num1051 = -1; - if (npc.direction == num1051 && Math.Abs(vector.X - player.Center.X) > chargeDistance) - npc.ai[2] = 1f; + if (NPC.direction == num1051 && Math.Abs(vector.X - player.Center.X) > chargeDistance) + NPC.ai[2] = 1f; - if (npc.ai[2] != 1f) + if (NPC.ai[2] != 1f) return; float playerLocation = vector.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; float num1052 = revenge ? 0.11f : 0.1f; num1052 += 0.02f * enrageScale; if (revenge && (!sirenAlive || phase4)) { - npc.velocity *= death ? MathHelper.Lerp(0.75f, 1f, lifeRatio) : MathHelper.Lerp(0.81f, 1f, lifeRatio); + NPC.velocity *= death ? MathHelper.Lerp(0.75f, 1f, lifeRatio) : MathHelper.Lerp(0.81f, 1f, lifeRatio); num1052 += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio); } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < num1052) { - npc.ai[2] = 0f; - npc.ai[1] += 1f; - npc.TargetClosest(); + NPC.ai[2] = 0f; + NPC.ai[1] += 1f; + NPC.TargetClosest(); } } } @@ -590,15 +591,15 @@ namespace CalamityMod.NPCs.Leviathan // Can only hit the target if within certain distance. public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - Vector2 npcCenter = npc.Center; + Vector2 npcCenter = NPC.Center; // NOTE: Tail and mouth hitboxes are interchangeable, each hitbox is the same size and is located to the right or left of the body hitbox. // Width = 225, Height = 225 - Rectangle mouthHitbox = new Rectangle((int)(npcCenter.X - (npc.width / 2f)), (int)(npcCenter.Y - (npc.height / 4f)), npc.width / 4, npc.height / 2); + Rectangle mouthHitbox = new Rectangle((int)(npcCenter.X - (NPC.width / 2f)), (int)(npcCenter.Y - (NPC.height / 4f)), NPC.width / 4, NPC.height / 2); // Width = 450, Height = 450 - Rectangle bodyHitbox = new Rectangle((int)(npcCenter.X - (npc.width / 4f)), (int)(npcCenter.Y - (npc.height / 2f)), npc.width / 2, npc.height); + Rectangle bodyHitbox = new Rectangle((int)(npcCenter.X - (NPC.width / 4f)), (int)(npcCenter.Y - (NPC.height / 2f)), NPC.width / 2, NPC.height); // Width = 225, Height = 225 - Rectangle tailHitbox = new Rectangle((int)(npcCenter.X + (npc.width / 4f)), (int)(npcCenter.Y - (npc.height / 4f)), npc.width / 4, npc.height / 2); + Rectangle tailHitbox = new Rectangle((int)(npcCenter.X + (NPC.width / 4f)), (int)(npcCenter.Y - (NPC.height / 4f)), NPC.width / 4, NPC.height / 2); Vector2 mouthHitboxCenter = new Vector2(mouthHitbox.X + (mouthHitbox.Width / 2), mouthHitbox.Y + (mouthHitbox.Height / 2)); Vector2 bodyHitboxCenter = new Vector2(bodyHitbox.X + (bodyHitbox.Width / 2), bodyHitbox.Y + (bodyHitbox.Height / 2)); @@ -658,17 +659,17 @@ namespace CalamityMod.NPCs.Leviathan { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -678,17 +679,17 @@ namespace CalamityMod.NPCs.Leviathan } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } float randomSpread = Main.rand.Next(-200, 200) / 100; - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/LeviathanGores/LeviGore"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/LeviathanGores/LeviGore2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/LeviathanGores/LeviGore3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/LeviathanGores/LeviGore4"), 1f); } } @@ -701,10 +702,10 @@ namespace CalamityMod.NPCs.Leviathan public override void NPCLoot() { //Trophy dropped regardless of Anahita, precedent of Twins - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); if (!NPC.AnyNPCs(ModContent.NPCType())) - DropSirenLeviLoot(npc); + DropSirenLeviLoot(NPC); } // This loot code is shared with Anahita. @@ -769,20 +770,20 @@ namespace CalamityMod.NPCs.Leviathan public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { Texture2D texture = AttackTexture; - if (npc.ai[0] == 1f || npc.Calamity().newAI[3] < 180f) + if (NPC.ai[0] == 1f || NPC.Calamity().newAI[3] < 180f) { - texture = Main.npcTexture[npc.type]; + texture = Main.npcTexture[NPC.type]; } SpriteEffects spriteEffects = SpriteEffects.FlipHorizontally; float xOffset = -50f; - if (npc.spriteDirection == -1) + if (NPC.spriteDirection == -1) { spriteEffects = SpriteEffects.None; xOffset *= -1f; } - Rectangle rectangle = new Rectangle(npc.frame.X, npc.frame.Y, texture.Width / 2, texture.Height / 3); + Rectangle rectangle = new Rectangle(NPC.frame.X, NPC.frame.Y, texture.Width / 2, texture.Height / 3); Vector2 origin = rectangle.Size() / 2f; - spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(xOffset, npc.gfxOffY), rectangle, npc.GetAlpha(drawColor), npc.rotation, origin, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, NPC.Center - Main.screenPosition + new Vector2(xOffset, NPC.gfxOffY), rectangle, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); return false; } @@ -794,35 +795,35 @@ namespace CalamityMod.NPCs.Leviathan if (!initialised) { counter = 3; - npc.frameCounter = 8D; + NPC.frameCounter = 8D; initialised = true; } - npc.frameCounter += 1D; - if (npc.frameCounter >= 8D) + NPC.frameCounter += 1D; + if (NPC.frameCounter >= 8D) { - npc.frameCounter = 0D; + NPC.frameCounter = 0D; counter++; - npc.frame.X = counter >= 3 ? width + 3 : 0; + NPC.frame.X = counter >= 3 ? width + 3 : 0; if (counter == 3) - npc.frame.Y = 0; + NPC.frame.Y = 0; else - npc.frame.Y += height; + NPC.frame.Y += height; } if (counter == 6) { counter = 1; - npc.frame.Y = 0; - npc.frame.X = 0; + NPC.frame.Y = 0; + NPC.frame.X = 0; } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index 3168ee25c2..de3b91de60 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -14,109 +14,109 @@ namespace CalamityMod.NPCs.Leviathan public override void SetStaticDefaults() { DisplayName.SetDefault("???"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 0; - npc.width = 100; - npc.height = 100; - npc.defense = 0; - npc.lifeMax = 1000; - npc.knockBackResist = 0f; - npc.Opacity = 0f; - npc.noGravity = true; - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = null; - npc.rarity = 2; + NPC.damage = 0; + NPC.width = 100; + NPC.height = 100; + NPC.defense = 0; + NPC.lifeMax = 1000; + NPC.knockBackResist = 0f; + NPC.Opacity = 0f; + NPC.noGravity = true; + NPC.dontTakeDamage = true; + NPC.chaseable = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = null; + NPC.rarity = 2; music = CalamityMod.Instance.GetMusicFromMusicMod("AnahitaPreboss") ?? -1; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.1f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - npc.TargetClosest(true); + NPC.TargetClosest(true); - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; + float playerLocation = NPC.Center.X - Main.player[NPC.target].Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 560f) + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) < 560f) { - if (npc.ai[0] < 90f) - npc.ai[0] += 1f; + if (NPC.ai[0] < 90f) + NPC.ai[0] += 1f; } - else if (npc.ai[0] > 0f) - npc.ai[0] -= 1f; + else if (NPC.ai[0] > 0f) + NPC.ai[0] -= 1f; - npc.dontTakeDamage = npc.ai[0] != 90f; + NPC.dontTakeDamage = NPC.ai[0] != 90f; - npc.Opacity = MathHelper.Clamp(npc.ai[0] / 90f, 0f, 1f); + NPC.Opacity = MathHelper.Clamp(NPC.ai[0] / 90f, 0f, 1f); - Lighting.AddLight((int)npc.Center.X / 16, (int)npc.Center.Y / 16, 0f, 0f, 0.8f * npc.Opacity); + Lighting.AddLight((int)NPC.Center.X / 16, (int)NPC.Center.Y / 16, 0f, 0f, 0.8f * NPC.Opacity); if (CalamityPlayer.areThereAnyDamnBosses) - npc.active = false; + NPC.active = false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D drawTex = Main.npcTexture[npc.type]; + Texture2D drawTex = Main.npcTexture[NPC.type]; Vector2 origin = new Vector2(drawTex.Width / 2, drawTex.Height / 2); - Vector2 drawPos = npc.Center - Main.screenPosition; - drawPos -= new Vector2(drawTex.Width, drawTex.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - drawPos += origin * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(drawTex, drawPos, npc.frame, npc.GetAlpha(lightColor), npc.rotation, origin, npc.scale, spriteEffects, 0f); + Vector2 drawPos = NPC.Center - Main.screenPosition; + drawPos -= new Vector2(drawTex.Width, drawTex.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(drawTex, drawPos, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - drawTex = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanStartGlow"); + drawTex = ModContent.Request("CalamityMod/NPCs/Leviathan/LeviathanStartGlow"); - spriteBatch.Draw(drawTex, drawPos, npc.frame, Color.White, npc.rotation, origin, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(drawTex, drawPos, NPC.frame, Color.White, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); return false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().disableAnahitaSpawns) + if (spawnInfo.Player.Calamity().disableAnahitaSpawns) return 0f; if (spawnInfo.playerSafe || NPC.AnyNPCs(NPCID.DukeFishron) || - NPC.AnyNPCs(npc.type) || + NPC.AnyNPCs(NPC.type) || NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()) || - spawnInfo.player.Calamity().ZoneSulphur || + spawnInfo.Player.Calamity().ZoneSulphur || NPC.LunarApocalypseIsUp) { return 0f; @@ -133,21 +133,21 @@ namespace CalamityMod.NPCs.Leviathan public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.25f); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.25f); } public override void HitEffect(int hitDirection, double damage) { - if (npc.life > 0) + if (NPC.life > 0) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } else if (Main.netMode != NetmodeID.MultiplayerClient) { - int siren = NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); + int siren = NPC.NewNPC((int)NPC.Center.X, (int)NPC.position.Y + NPC.height, ModContent.NPCType(), NPC.whoAmI); CalamityUtils.BossAwakenMessage(siren); } } diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index 9f6e6572ec..c0621e2507 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -10,6 +10,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Leviathan { @@ -37,35 +38,35 @@ namespace CalamityMod.NPCs.Leviathan public override void SetStaticDefaults() { DisplayName.SetDefault("Anahita"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.GetNPCDamage(); - npc.npcSlots = 16f; - npc.width = 100; - npc.height = 100; - npc.defense = 20; - npc.DR_NERD(0.2f); - npc.LifeMaxNERB(34700, 41600, 260000); + NPC.GetNPCDamage(); + NPC.npcSlots = 16f; + NPC.width = 100; + NPC.height = 100; + NPC.defense = 20; + NPC.DR_NERD(0.2f); + NPC.LifeMaxNERB(34700, 41600, 260000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.aiStyle = -1; aiType = -1; - npc.boss = true; - npc.value = Item.buyPrice(0, 60, 0, 0); - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + NPC.boss = true; + NPC.value = Item.buyPrice(0, 60, 0, 0); + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; music = CalamityMod.Instance.GetMusicFromMusicMod("Anahita") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) @@ -73,12 +74,12 @@ namespace CalamityMod.NPCs.Leviathan writer.Write(biomeEnrageTimer); writer.Write(spawnedLevi); writer.Write(forceChargeFrames); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); writer.Write(frameUsed); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.Calamity().newAI[0]); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.Calamity().newAI[0]); writer.Write(HasBegunSummoningLeviathan); } @@ -87,33 +88,33 @@ namespace CalamityMod.NPCs.Leviathan biomeEnrageTimer = reader.ReadInt32(); spawnedLevi = reader.ReadBoolean(); forceChargeFrames = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); frameUsed = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.Calamity().newAI[0] = reader.ReadSingle(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.Calamity().newAI[0] = reader.ReadSingle(); HasBegunSummoningLeviathan = reader.ReadBoolean(); } public override void AI() { // whoAmI variable - CalamityGlobalNPC.siren = npc.whoAmI; + CalamityGlobalNPC.siren = NPC.whoAmI; // Set to false so she doesn't do it constantly - npc.Calamity().canBreakPlayerDefense = false; + NPC.Calamity().canBreakPlayerDefense = false; // Light - Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0f, 0.5f, 0.3f); + Lighting.AddLight((int)(NPC.Center.X / 16f), (int)(NPC.Center.Y / 16f), 0f, 0.5f, 0.3f); // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); // Check for Leviathan bool leviAlive = false; @@ -121,7 +122,7 @@ namespace CalamityMod.NPCs.Leviathan leviAlive = Main.npc[CalamityGlobalNPC.leviathan].active; // Variables - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; @@ -142,20 +143,20 @@ namespace CalamityMod.NPCs.Leviathan float enrageScale = BossRushEvent.BossRushActive ? 0.5f : 0f; if (biomeEnraged) { - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1.5f; } - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; float bubbleVelocity = death ? 9f : revenge ? 7f : expertMode ? 6f : 5f; bubbleVelocity += 4f * enrageScale; if (!leviAlive) bubbleVelocity += 2f * (1f - lifeRatio); - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; - Vector2 vector = npc.Center; + Vector2 vector = NPC.Center; // Phases bool phase2 = lifeRatio < 0.7f; @@ -168,45 +169,45 @@ namespace CalamityMod.NPCs.Leviathan if (!HasBegunSummoningLeviathan) { // Use charging frames. - npc.ai[0] = 3f; + NPC.ai[0] = 3f; // Look towards the ocean. - npc.direction = (npc.Center.X < Main.maxTilesX * 8f).ToDirectionInt(); + NPC.direction = (NPC.Center.X < Main.maxTilesX * 8f).ToDirectionInt(); // Prevent Anahita from leaving the world when doing her dive. // If she leaves the world entity summons will fail and Levi will simply not spawn. - npc.position.X = MathHelper.Clamp(npc.position.X, 150f, Main.maxTilesX * 16f - 150f); + NPC.position.X = MathHelper.Clamp(NPC.position.X, 150f, Main.maxTilesX * 16f - 150f); - if (npc.alpha <= 0) + if (NPC.alpha <= 0) { float moveDirection = 1f; - if (Math.Abs(npc.Center.X - Main.maxTilesX * 16f) > Math.Abs(npc.Center.X)) + if (Math.Abs(NPC.Center.X - Main.maxTilesX * 16f) > Math.Abs(NPC.Center.X)) moveDirection = -1f; - npc.velocity.X = moveDirection * 6f; - npc.spriteDirection = (int)-moveDirection; - npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y + 0.2f, -3f, 16f); + NPC.velocity.X = moveDirection * 6f; + NPC.spriteDirection = (int)-moveDirection; + NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y + 0.2f, -3f, 16f); } - float idealRotation = npc.velocity.ToRotation(); - if (npc.spriteDirection == 1) + float idealRotation = NPC.velocity.ToRotation(); + if (NPC.spriteDirection == 1) idealRotation += MathHelper.Pi; - npc.rotation = npc.rotation.AngleTowards(idealRotation, 0.08f); + NPC.rotation = NPC.rotation.AngleTowards(idealRotation, 0.08f); - if (BossRushEvent.BossRushActive || Collision.WetCollision(npc.position, npc.width, npc.height) || npc.position.Y > (Main.worldSurface - 125f) * 16f) + if (BossRushEvent.BossRushActive || Collision.WetCollision(NPC.position, NPC.width, NPC.height) || NPC.position.Y > (Main.worldSurface - 125f) * 16f) { - int oldAlpha = npc.alpha; - npc.alpha = Utils.Clamp(npc.alpha + 9, 0, 255); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.alpha >= 255 && oldAlpha < 255) + int oldAlpha = NPC.alpha; + NPC.alpha = Utils.Clamp(NPC.alpha + 9, 0, 255); + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.alpha >= 255 && oldAlpha < 255) { - Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); HasBegunSummoningLeviathan = true; - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; } - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; return; } } @@ -216,40 +217,40 @@ namespace CalamityMod.NPCs.Leviathan music = CalamityMod.Instance.GetMusicFromMusicMod("LeviathanAndAnahita") ?? MusicID.Boss3; // Ice Shield - if (npc.localAI[2] < 3f) + if (NPC.localAI[2] < 3f) { - if (npc.ai[3] == 0f && npc.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.ai[3] == 0f && NPC.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - int num6 = NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), npc.whoAmI); - npc.ai[3] = num6 + 1; - npc.localAI[1] = -1f; - npc.localAI[2] += 1f; - npc.netUpdate = true; - Main.npc[num6].ai[0] = npc.whoAmI; + int num6 = NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[3] = num6 + 1; + NPC.localAI[1] = -1f; + NPC.localAI[2] += 1f; + NPC.netUpdate = true; + Main.npc[num6].ai[0] = NPC.whoAmI; Main.npc[num6].netUpdate = true; } - int num7 = (int)npc.ai[3] - 1; + int num7 = (int)NPC.ai[3] - 1; if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType()) - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; else { - npc.dontTakeDamage = false; - npc.ai[3] = 0f; + NPC.dontTakeDamage = false; + NPC.ai[3] = 0f; - if (npc.localAI[1] == -1f) - npc.localAI[1] = 1f; + if (NPC.localAI[1] == -1f) + NPC.localAI[1] = 1f; else { - switch ((int)npc.localAI[2]) + switch ((int)NPC.localAI[2]) { case 1: if (phase2) - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; break; case 2: if (phase3) - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; break; } } @@ -257,11 +258,11 @@ namespace CalamityMod.NPCs.Leviathan } else { - npc.dontTakeDamage = false; + NPC.dontTakeDamage = false; - int num7 = (int)npc.ai[3] - 1; + int num7 = (int)NPC.ai[3] - 1; if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType()) - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; } // Hover near the target, invisible if the Leviathan is present and not sufficiently injured. @@ -270,66 +271,66 @@ namespace CalamityMod.NPCs.Leviathan ChargeRotation(player, vector); ChargeLocation(player, vector, false, true); - npc.alpha += 3; - if (npc.alpha >= 255) - npc.alpha = 255; + NPC.alpha += 3; + if (NPC.alpha >= 255) + NPC.alpha = 255; else { for (int k = 0; k < 3; k++) { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, 172, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 172, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; } } - npc.dontTakeDamage = true; - npc.damage = 0; + NPC.dontTakeDamage = true; + NPC.damage = 0; - if (npc.ai[0] != -1f) + if (NPC.ai[0] != -1f) { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.localAI[0] = 0f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.localAI[0] = 0f; + NPC.netUpdate = true; } return; } // Alpha - if (npc.damage != 0) + if (NPC.damage != 0) { - npc.alpha -= 5; - if (npc.alpha <= 0) - npc.alpha = 0; + NPC.alpha -= 5; + if (NPC.alpha <= 0) + NPC.alpha = 0; } // Play sound if (Main.rand.NextBool(300)) - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 35); + SoundEngine.PlaySound(SoundID.Zombie, (int)NPC.position.X, (int)NPC.position.Y, 35); // Time left - if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; // Despawn if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) { - npc.rotation = npc.velocity.X * 0.02f; + NPC.rotation = NPC.velocity.X * 0.02f; - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - npc.velocity.Y += 0.2f; - if (npc.velocity.Y > 16f) - npc.velocity.Y = 16f; + if (NPC.velocity.Y < -3f) + NPC.velocity.Y = -3f; + NPC.velocity.Y += 0.2f; + if (NPC.velocity.Y > 16f) + NPC.velocity.Y = 16f; - if (npc.position.Y > Main.worldSurface * 16.0) + if (NPC.position.Y > Main.worldSurface * 16.0) { for (int x = 0; x < Main.maxNPCs; x++) { @@ -339,17 +340,17 @@ namespace CalamityMod.NPCs.Leviathan Main.npc[x].netUpdate = true; } } - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; } - if (npc.ai[0] != -1f) + if (NPC.ai[0] != -1f) { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.localAI[0] = 0f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.localAI[0] = 0f; + NPC.netUpdate = true; } return; @@ -357,52 +358,52 @@ namespace CalamityMod.NPCs.Leviathan } // Rotation when charging - if (npc.ai[0] > 2f) + if (NPC.ai[0] > 2f) ChargeRotation(player, vector); // Phase switch - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { int random = ((phase2 && expertMode && !leviAlive) || phase4 || death) ? 4 : 3; int num618; do num618 = Main.rand.Next(random); - while (num618 == npc.ai[1] || num618 == 1); + while (num618 == NPC.ai[1] || num618 == 1); - npc.ai[0] = num618; + NPC.ai[0] = num618; - if (npc.ai[0] != 3f) + if (NPC.ai[0] != 3f) { forceChargeFrames = false; float playerLocation = vector.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; } else ChargeRotation(player, vector); - npc.TargetClosest(); - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.TargetClosest(); + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } // Get in position for bubble spawn - else if (npc.ai[0] == 0f) + else if (NPC.ai[0] == 0f) { - npc.rotation = npc.velocity.X * 0.02f; - npc.spriteDirection = npc.direction; + NPC.rotation = NPC.velocity.X * 0.02f; + NPC.spriteDirection = NPC.direction; - Vector2 vector118 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector118 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num1055 = player.position.X + (player.width / 2) - vector118.X; float num1056 = player.position.Y + (player.height / 2) - 200f - vector118.Y; float num1057 = (float)Math.Sqrt(num1055 * num1055 + num1056 * num1056); - npc.Calamity().newAI[0] += 1f; - if (num1057 < 600f || npc.Calamity().newAI[0] >= 180f) + NPC.Calamity().newAI[0] += 1f; + if (num1057 < 600f || NPC.Calamity().newAI[0] >= 180f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.Calamity().newAI[0] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.netUpdate = true; return; } @@ -411,80 +412,80 @@ namespace CalamityMod.NPCs.Leviathan maxVelocityY -= enrageScale; maxVelocityX -= 2f * enrageScale; - if (npc.position.Y > player.position.Y - 350f) + if (NPC.position.Y > player.position.Y - 350f) { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y -= death ? 0.12f : 0.1f; - if (npc.velocity.Y > maxVelocityY) - npc.velocity.Y = maxVelocityY; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y *= 0.98f; + NPC.velocity.Y -= death ? 0.12f : 0.1f; + if (NPC.velocity.Y > maxVelocityY) + NPC.velocity.Y = maxVelocityY; } - else if (npc.position.Y < player.position.Y - 450f) + else if (NPC.position.Y < player.position.Y - 450f) { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y += death ? 0.12f : 0.1f; - if (npc.velocity.Y < -maxVelocityY) - npc.velocity.Y = -maxVelocityY; + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= 0.98f; + NPC.velocity.Y += death ? 0.12f : 0.1f; + if (NPC.velocity.Y < -maxVelocityY) + NPC.velocity.Y = -maxVelocityY; } - if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 100f) + if (NPC.position.X + (NPC.width / 2) > player.position.X + (player.width / 2) + 100f) { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; - npc.velocity.X -= death ? 0.12f : 0.1f; - if (npc.velocity.X > maxVelocityX) - npc.velocity.X = maxVelocityX; + if (NPC.velocity.X > 0f) + NPC.velocity.X *= 0.98f; + NPC.velocity.X -= death ? 0.12f : 0.1f; + if (NPC.velocity.X > maxVelocityX) + NPC.velocity.X = maxVelocityX; } - if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 100f) + if (NPC.position.X + (NPC.width / 2) < player.position.X + (player.width / 2) - 100f) { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; - npc.velocity.X += death ? 0.12f : 0.1f; - if (npc.velocity.X < -maxVelocityX) - npc.velocity.X = -maxVelocityX; + if (NPC.velocity.X < 0f) + NPC.velocity.X *= 0.98f; + NPC.velocity.X += death ? 0.12f : 0.1f; + if (NPC.velocity.X < -maxVelocityX) + NPC.velocity.X = -maxVelocityX; } } // Bubble spawn - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - npc.rotation = npc.velocity.X * 0.02f; - Vector2 vector119 = new Vector2(npc.position.X + (npc.width / 2) + (15 * npc.direction), npc.position.Y + 30); - Vector2 vector120 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + NPC.rotation = NPC.velocity.X * 0.02f; + Vector2 vector119 = new Vector2(NPC.position.X + (NPC.width / 2) + (15 * NPC.direction), NPC.position.Y + 30); + Vector2 vector120 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num1058 = player.position.X + (player.width / 2) - vector120.X; float num1059 = player.position.Y + (player.height / 2) - vector120.Y; float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); - npc.ai[1] += 1f; + NPC.ai[1] += 1f; int num638 = 0; for (int num639 = 0; num639 < 255; num639++) { if (Main.player[num639].active && !Main.player[num639].dead && (vector - Main.player[num639].Center).Length() < 1000f) num638++; } - npc.ai[1] += num638 / 2; + NPC.ai[1] += num638 / 2; bool flag103 = false; float num640 = 20f; if (!leviAlive || phase4) num640 -= death ? 15f * (1f - lifeRatio) : 12f * (1f - lifeRatio); - if (npc.ai[1] > num640) + if (NPC.ai[1] > num640) { - npc.ai[1] = 0f; - npc.ai[2] += 1f; + NPC.ai[1] = 0f; + NPC.ai[2] += 1f; flag103 = true; } if (Collision.CanHit(vector119, 1, 1, player.position, player.width, player.height) && flag103) { - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 85); + SoundEngine.PlaySound(SoundID.Item, (int)NPC.position.X, (int)NPC.position.Y, 85); if (Main.netMode != NetmodeID.MultiplayerClient) { int spawn = NPC.NewNPC((int)vector119.X, (int)vector119.Y, NPCID.DetonatingBubble); - Main.npc[spawn].target = npc.target; + Main.npc[spawn].target = NPC.target; Main.npc[spawn].velocity = player.Center - vector119; Main.npc[spawn].velocity.Normalize(); Main.npc[spawn].velocity *= bubbleVelocity; @@ -500,79 +501,79 @@ namespace CalamityMod.NPCs.Leviathan maxVelocityY -= enrageScale; maxVelocityX -= 2f * enrageScale; - if (npc.position.Y > player.position.Y - 350f) + if (NPC.position.Y > player.position.Y - 350f) { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y -= death ? 0.12f : 0.1f; - if (npc.velocity.Y > maxVelocityY) - npc.velocity.Y = maxVelocityY; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y *= 0.98f; + NPC.velocity.Y -= death ? 0.12f : 0.1f; + if (NPC.velocity.Y > maxVelocityY) + NPC.velocity.Y = maxVelocityY; } - else if (npc.position.Y < player.position.Y - 450f) + else if (NPC.position.Y < player.position.Y - 450f) { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y += death ? 0.12f : 0.1f; - if (npc.velocity.Y < -maxVelocityY) - npc.velocity.Y = -maxVelocityY; + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= 0.98f; + NPC.velocity.Y += death ? 0.12f : 0.1f; + if (NPC.velocity.Y < -maxVelocityY) + NPC.velocity.Y = -maxVelocityY; } - if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 100f) + if (NPC.position.X + (NPC.width / 2) > player.position.X + (player.width / 2) + 100f) { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; - npc.velocity.X -= death ? 0.12f : 0.1f; - if (npc.velocity.X > maxVelocityX) - npc.velocity.X = maxVelocityX; + if (NPC.velocity.X > 0f) + NPC.velocity.X *= 0.98f; + NPC.velocity.X -= death ? 0.12f : 0.1f; + if (NPC.velocity.X > maxVelocityX) + NPC.velocity.X = maxVelocityX; } - if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 100f) + if (NPC.position.X + (NPC.width / 2) < player.position.X + (player.width / 2) - 100f) { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; - npc.velocity.X += death ? 0.12f : 0.1f; - if (npc.velocity.X < -maxVelocityX) - npc.velocity.X = -maxVelocityX; + if (NPC.velocity.X < 0f) + NPC.velocity.X *= 0.98f; + NPC.velocity.X += death ? 0.12f : 0.1f; + if (NPC.velocity.X < -maxVelocityX) + NPC.velocity.X = -maxVelocityX; } } else - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; - npc.spriteDirection = npc.direction; + NPC.spriteDirection = NPC.direction; float maxBubbleSpawn = death ? 3f : 4f; - if (npc.ai[2] > maxBubbleSpawn) + if (NPC.ai[2] > maxBubbleSpawn) { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; } } // Fly near target and summon projectiles - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - npc.rotation = npc.velocity.X * 0.02f; + NPC.rotation = NPC.velocity.X * 0.02f; Vector2 targetVector = player.Center + new Vector2(0f, -350f); float velocity = death ? 13.5f : 12f; velocity += 6f * enrageScale; - Vector2 vector3 = Vector2.Normalize(targetVector - vector - npc.velocity) * velocity; + Vector2 vector3 = Vector2.Normalize(targetVector - vector - NPC.velocity) * velocity; float acceleration = death ? 0.28f : 0.25f; acceleration += 0.2f * enrageScale; - if (Math.Abs(npc.Center.Y - targetVector.Y) > 50f || Math.Abs(npc.Center.X - player.Center.X) > 350f) - npc.SimpleFlyMovement(vector3, acceleration); + if (Math.Abs(NPC.Center.Y - targetVector.Y) > 50f || Math.Abs(NPC.Center.X - player.Center.X) > 350f) + NPC.SimpleFlyMovement(vector3, acceleration); - npc.ai[1] += 1f; + NPC.ai[1] += 1f; float divisor = 140f; divisor -= (int)(30f * enrageScale); if (!leviAlive || phase4) divisor -= (float)Math.Ceiling(50f * (1f - lifeRatio)); - bool shootProjectiles = npc.ai[1] % divisor == 0f; + bool shootProjectiles = NPC.ai[1] % divisor == 0f; if (Main.netMode != NetmodeID.MultiplayerClient && shootProjectiles) { float projectileVelocity = expertMode ? 3f : 2f; @@ -583,33 +584,33 @@ namespace CalamityMod.NPCs.Leviathan int totalProjectiles = 8; int projectileDistance = 600; int type = ModContent.ProjectileType(); - switch ((int)npc.localAI[3]) + switch ((int)NPC.localAI[3]) { case 0: - Main.PlaySound(SoundID.Item21, player.position); + SoundEngine.PlaySound(SoundID.Item21, player.position); break; case 1: totalProjectiles = 3; type = ModContent.ProjectileType(); - Main.PlaySound(SoundID.Item30, player.position); + SoundEngine.PlaySound(SoundID.Item30, player.position); break; case 2: totalProjectiles = 6; type = ModContent.ProjectileType(); float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; Main.harpNote = soundPitch; - Main.PlaySound(SoundID.Item26, player.position); + SoundEngine.PlaySound(SoundID.Item26, player.position); break; } - npc.localAI[3] += 1f; - if (npc.localAI[3] > 2f) - npc.localAI[3] = 0f; + NPC.localAI[3] += 1f; + if (NPC.localAI[3] > 2f) + NPC.localAI[3] = 0f; if ((phase2 && !leviAlive) || phase4) totalProjectiles += totalProjectiles / 2; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); for (int i = 0; i < totalProjectiles; i++) { Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -projectileVelocity).RotatedBy(radians * i)) * projectileDistance; @@ -618,11 +619,11 @@ namespace CalamityMod.NPCs.Leviathan } } - if (Math.Abs(npc.Center.X - player.Center.X) > 10f) + if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { float playerLocation = vector.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; } float phaseTimer = 300f; @@ -630,28 +631,28 @@ namespace CalamityMod.NPCs.Leviathan if (!leviAlive || phase4) phaseTimer -= 150f * (1f - lifeRatio); - if (npc.ai[1] >= phaseTimer) + if (NPC.ai[1] >= phaseTimer) { - npc.ai[0] = -1f; - npc.ai[1] = 2f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.ai[1] = 2f; + NPC.netUpdate = true; } } // Set up charge - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { ChargeLocation(player, vector, leviAlive && !phase4, revenge); - npc.ai[1] += 1f; + NPC.ai[1] += 1f; - if (npc.ai[1] >= (revenge ? 45f : 60f)) + if (NPC.ai[1] >= (revenge ? 45f : 60f)) { forceChargeFrames = true; float aiInterval = (leviAlive && !phase4) ? 2f : 3f; - npc.ai[0] = (npc.ai[2] >= aiInterval) ? -1f : 4f; - npc.ai[1] = (npc.ai[2] >= aiInterval) ? 3f : 0f; - npc.localAI[0] = 0f; + NPC.ai[0] = (NPC.ai[2] >= aiInterval) ? -1f : 4f; + NPC.ai[1] = (NPC.ai[2] >= aiInterval) ? 3f : 0f; + NPC.localAI[0] = 0f; // Velocity and rotation float chargeVelocity = (leviAlive && !phase4) ? 21f : 26f; @@ -660,49 +661,49 @@ namespace CalamityMod.NPCs.Leviathan if (revenge) chargeVelocity += 2f + (death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio)); - npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); // Direction int num22 = Math.Sign(player.Center.X - vector.X); if (num22 != 0) { - npc.direction = num22; + NPC.direction = num22; - if (npc.spriteDirection == 1) - npc.rotation += MathHelper.Pi; + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } } } // Charge - else if (npc.ai[0] == 4f) + else if (NPC.ai[0] == 4f) { - npc.Calamity().canBreakPlayerDefense = true; - npc.damage = (int)(npc.defDamage * 1.5); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = (int)(NPC.defDamage * 1.5); // Spawn dust int num24 = 7; for (int j = 0; j < num24; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24) + vector; + Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24) + vector; Vector2 vector4 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); Main.dust[num25].noGravity = true; Main.dust[num25].noLight = true; Main.dust[num25].velocity /= 4f; - Main.dust[num25].velocity -= npc.velocity; + Main.dust[num25].velocity -= NPC.velocity; } - npc.ai[1] += 1f; - if (npc.ai[1] >= ((leviAlive && !phase4) ? 50f : 35f)) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= ((leviAlive && !phase4) ? 50f : 35f)) { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] += 1f; - npc.netUpdate = true; + NPC.ai[0] = 3f; + NPC.ai[1] = 0f; + NPC.ai[2] += 1f; + NPC.netUpdate = true; } } } @@ -711,7 +712,7 @@ namespace CalamityMod.NPCs.Leviathan private void ChargeRotation(Player player, Vector2 vector) { float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X); - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) num17 += MathHelper.Pi; if (num17 < 0f) num17 += MathHelper.TwoPi; @@ -719,11 +720,11 @@ namespace CalamityMod.NPCs.Leviathan num17 -= MathHelper.TwoPi; float num18 = 0.04f; - if (npc.ai[0] == 4f) + if (NPC.ai[0] == 4f) num18 = 0f; if (num18 != 0f) - npc.rotation = npc.rotation.AngleTowards(num17, num18); + NPC.rotation = NPC.rotation.AngleTowards(num17, num18); } // Move to charge location @@ -732,79 +733,79 @@ namespace CalamityMod.NPCs.Leviathan float distance = leviAlive ? 600f : 500f; // Velocity - if (npc.localAI[0] == 0f) - npc.localAI[0] = (int)distance * Math.Sign((vector - player.Center).X); + if (NPC.localAI[0] == 0f) + NPC.localAI[0] = (int)distance * Math.Sign((vector - player.Center).X); - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.localAI[0], -distance) - vector - npc.velocity) * 12f; + Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(NPC.localAI[0], -distance) - vector - NPC.velocity) * 12f; float acceleration = revenge ? 0.75f : 0.5f; - npc.SimpleFlyMovement(vector3, acceleration); + NPC.SimpleFlyMovement(vector3, acceleration); // Rotation int num22 = Math.Sign(player.Center.X - vector.X); if (num22 != 0) { - if (npc.ai[1] == 0f && num22 != npc.direction) - npc.rotation += MathHelper.Pi; + if (NPC.ai[1] == 0f && num22 != NPC.direction) + NPC.rotation += MathHelper.Pi; - npc.direction = num22; + NPC.direction = num22; - if (npc.spriteDirection != -npc.direction) - npc.rotation += MathHelper.Pi; + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 187, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 187, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 50; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 187, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 187, hitDirection, -1f, 0, default, 1f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Texture2D texture = Main.npcTexture[npc.type]; + Texture2D texture = Main.npcTexture[NPC.type]; switch (frameUsed) { case 0: - texture = Main.npcTexture[npc.type]; + texture = Main.npcTexture[NPC.type]; break; case 1: - texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/SirenStabbing"); + texture = ModContent.Request("CalamityMod/NPCs/Leviathan/SirenStabbing"); break; } - bool charging = npc.ai[0] > 2f || forceChargeFrames; - int height = texture.Height / Main.npcFrameCount[npc.type]; + bool charging = NPC.ai[0] > 2f || forceChargeFrames; + int height = texture.Height / Main.npcFrameCount[NPC.type]; int width = texture.Width; SpriteEffects spriteEffects = charging ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - if (npc.spriteDirection == -1) + if (NPC.spriteDirection == -1) spriteEffects = charging ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0f, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, new Vector2((float)width / 2f, (float)height / 2f), npc.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, NPC.Center - Main.screenPosition + new Vector2(0f, NPC.gfxOffY), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2((float)width / 2f, (float)height / 2f), NPC.scale, spriteEffects, 0f); return false; } public override void FindFrame(int frameHeight) { - if (npc.ai[0] > 2f || forceChargeFrames) + if (NPC.ai[0] > 2f || forceChargeFrames) frameUsed = 1; else frameUsed = 0; int timeBetweenFrames = 8; - npc.frameCounter++; - if (npc.frameCounter > timeBetweenFrames * Main.npcFrameCount[npc.type]) - npc.frameCounter = 0; + NPC.frameCounter++; + if (NPC.frameCounter > timeBetweenFrames * Main.npcFrameCount[NPC.type]) + NPC.frameCounter = 0; - npc.frame.Y = frameHeight * (int)(npc.frameCounter / timeBetweenFrames); - if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type]) - npc.frame.Y = 0; + NPC.frame.Y = frameHeight * (int)(NPC.frameCounter / timeBetweenFrames); + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + NPC.frame.Y = 0; //100x1140 //200x636 @@ -819,10 +820,10 @@ namespace CalamityMod.NPCs.Leviathan public override void NPCLoot() { //Trophy dropped regardless of Levi, precedent of Twins - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); if (!NPC.AnyNPCs(ModContent.NPCType())) - Leviathan.DropSirenLeviLoot(npc); + Leviathan.DropSirenLeviLoot(NPC); } public override bool CheckActive() @@ -832,8 +833,8 @@ namespace CalamityMod.NPCs.Leviathan public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/Leviathan/SirenIce.cs b/NPCs/Leviathan/SirenIce.cs index e42f528175..37b70ddff1 100644 --- a/NPCs/Leviathan/SirenIce.cs +++ b/NPCs/Leviathan/SirenIce.cs @@ -16,70 +16,70 @@ namespace CalamityMod.NPCs.Leviathan public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.GetNPCDamage(); - npc.width = 100; - npc.height = 100; - npc.defense = 10; - npc.DR_NERD(0.5f); - npc.lifeMax = 650; + NPC.canGhostHeal = false; + NPC.noTileCollide = true; + NPC.GetNPCDamage(); + NPC.width = 100; + NPC.height = 100; + NPC.defense = 10; + NPC.DR_NERD(0.5f); + NPC.lifeMax = 650; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 1000; + NPC.lifeMax = 1000; } - npc.alpha = 255; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = false; - npc.Calamity().VulnerableToSickness = false; + NPC.alpha = 255; + NPC.HitSound = SoundID.NPCHit5; + NPC.DeathSound = SoundID.NPCDeath7; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = false; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); } public override void AI() { - int num989 = (int)npc.ai[0]; + int num989 = (int)NPC.ai[0]; if (Main.npc[num989].active && Main.npc[num989].type == ModContent.NPCType()) { - if (npc.alpha > 100 && npc.ai[1] == 0f) - npc.alpha -= 2; + if (NPC.alpha > 100 && NPC.ai[1] == 0f) + NPC.alpha -= 2; if (Main.npc[num989].damage == 0) - npc.ai[1] = 1f; + NPC.ai[1] = 1f; else - npc.ai[1] = 0f; + NPC.ai[1] = 0f; - if (npc.ai[1] == 1f) - npc.alpha = Main.npc[num989].alpha; + if (NPC.ai[1] == 1f) + NPC.alpha = Main.npc[num989].alpha; - npc.dontTakeDamage = Main.npc[num989].damage == 0; - npc.rotation = Main.npc[num989].rotation; - npc.spriteDirection = Main.npc[num989].direction; - npc.velocity = Vector2.Zero; - npc.position = Main.npc[num989].Center; - npc.position.X = npc.position.X - (npc.width / 2) + ((npc.spriteDirection == 1) ? -20f : 20f); - npc.position.Y = npc.position.Y - (npc.height / 2) - 30; - npc.gfxOffY = Main.npc[num989].gfxOffY; - Lighting.AddLight((int)npc.Center.X / 16, (int)npc.Center.Y / 16, 0f, 0.8f, 1.1f); + NPC.dontTakeDamage = Main.npc[num989].damage == 0; + NPC.rotation = Main.npc[num989].rotation; + NPC.spriteDirection = Main.npc[num989].direction; + NPC.velocity = Vector2.Zero; + NPC.position = Main.npc[num989].Center; + NPC.position.X = NPC.position.X - (NPC.width / 2) + ((NPC.spriteDirection == 1) ? -20f : 20f); + NPC.position.Y = NPC.position.Y - (NPC.height / 2) - 30; + NPC.gfxOffY = Main.npc[num989].gfxOffY; + Lighting.AddLight((int)NPC.Center.X / 16, (int)NPC.Center.Y / 16, 0f, 0.8f, 1.1f); return; } - npc.dontTakeDamage = false; - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; + NPC.dontTakeDamage = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.active = false; } public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) @@ -97,19 +97,19 @@ namespace CalamityMod.NPCs.Leviathan } } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) => npc.ai[1] == 0f; + public override bool CanHitPlayer(Player target, ref int cooldownSlot) => NPC.ai[1] == 0f; public override Color? GetAlpha(Color drawColor) { - if (npc.ai[1] == 1f) + if (NPC.ai[1] == 1f) return Color.Transparent; - return new Color(200, 200, 200, npc.alpha); + return new Color(200, 200, 200, NPC.alpha); } public override void OnHitPlayer(Player player, int damage, bool crit) { - if (npc.ai[1] == 1f) + if (NPC.ai[1] == 1f) return; player.AddBuff(BuffID.Frostburn, 240, true); @@ -121,13 +121,13 @@ namespace CalamityMod.NPCs.Leviathan { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index f18a5ab29c..4fd59dfb36 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -11,36 +11,36 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Aero Slime"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.aiStyle = 14; - npc.damage = 18; - npc.width = 40; - npc.height = 30; - npc.defense = 6; - npc.lifeMax = 50; - npc.knockBackResist = 0f; + NPC.aiStyle = 14; + NPC.damage = 18; + NPC.width = 40; + NPC.height = 30; + NPC.defense = 6; + NPC.lifeMax = 50; + NPC.knockBackResist = 0f; animationType = NPCID.Slimer; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.alpha = 50; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) || spawnInfo.Player.Calamity().ZoneAbyss || + spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -51,20 +51,20 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 59, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 59, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 59, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 59, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 10, 26); + DropHelper.DropItem(NPC, ModContent.ItemType(), 10, 26); } } } diff --git a/NPCs/NormalNPCs/AngryDog.cs b/NPCs/NormalNPCs/AngryDog.cs index 43824507c0..d598963576 100644 --- a/NPCs/NormalNPCs/AngryDog.cs +++ b/NPCs/NormalNPCs/AngryDog.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.NormalNPCs { public class AngryDog : ModNPC @@ -14,35 +15,35 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Angry Dog"); - Main.npcFrameCount[npc.type] = 9; + Main.npcFrameCount[NPC.type] = 9; } public override void SetDefaults() { - npc.aiStyle = -1; - npc.damage = 10; - npc.width = 56; - npc.height = 56; - npc.defense = 4; - npc.lifeMax = 50; + NPC.aiStyle = -1; + NPC.damage = 10; + NPC.width = 56; + NPC.height = 56; + NPC.defense = 4; + NPC.lifeMax = 50; if (CalamityWorld.downedCryogen) { - npc.damage = 60; - npc.defense = 10; - npc.lifeMax = 1000; + NPC.damage = 60; + NPC.defense = 10; + NPC.lifeMax = 1000; } - npc.knockBackResist = 0.3f; + NPC.knockBackResist = 0.3f; animationType = NPCID.Hellhound; aiType = -1; - npc.value = Item.buyPrice(0, 0, 3, 0); - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AngryDogHit"); - npc.DeathSound = SoundID.NPCDeath5; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 3, 0); + NPC.HitSound = Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AngryDogHit"); + NPC.DeathSound = SoundID.NPCDeath5; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.coldDamage = true; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = false; - npc.Calamity().VulnerableToSickness = true; + NPC.coldDamage = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = false; + NPC.Calamity().VulnerableToSickness = true; } public override void SendExtraAI(BinaryWriter writer) @@ -59,70 +60,70 @@ namespace CalamityMod.NPCs.NormalNPCs { if (Main.rand.NextBool(900)) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AngryDogGrowl"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AngryDogGrowl"), (int)NPC.position.X, (int)NPC.position.Y); } - bool phase2 = (double)npc.life <= (double)npc.lifeMax * (CalamityWorld.death ? 0.9 : 0.5); + bool phase2 = (double)NPC.life <= (double)NPC.lifeMax * (CalamityWorld.death ? 0.9 : 0.5); if (phase2) { if (!reset) { - npc.ai[0] = 0f; - npc.ai[3] = 0f; + NPC.ai[0] = 0f; + NPC.ai[3] = 0f; reset = true; - npc.netUpdate = true; + NPC.netUpdate = true; } - if (npc.ai[1] < 7f) + if (NPC.ai[1] < 7f) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } - CalamityAI.UnicornAI(npc, mod, true, CalamityWorld.death ? 6f : 4f, 5f, 0.2f); + CalamityAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 6f : 4f, 5f, 0.2f); return; } - CalamityAI.UnicornAI(npc, mod, false, CalamityWorld.death ? 6f : 4f, 6f, CalamityWorld.death ? 0.1f : 0.07f); + CalamityAI.UnicornAI(NPC, Mod, false, CalamityWorld.death ? 6f : 4f, 6f, CalamityWorld.death ? 0.1f : 0.07f); } public override void FindFrame(int frameHeight) { - if (npc.ai[1] < 7f && npc.ai[1] > 0f) + if (NPC.ai[1] < 7f && NPC.ai[1] > 0f) { - npc.frame.Y = frameHeight * 7; - npc.frameCounter = 0.0; + NPC.frame.Y = frameHeight * 7; + NPC.frameCounter = 0.0; return; } - if (npc.ai[1] >= 7f) + if (NPC.ai[1] >= 7f) { - npc.frame.Y = frameHeight * 8; - npc.frameCounter = 0.0; + NPC.frame.Y = frameHeight * 8; + NPC.frameCounter = 0.0; return; } - if (npc.velocity.Y > 0f || npc.velocity.Y < 0f) + if (NPC.velocity.Y > 0f || NPC.velocity.Y < 0f) { - npc.frame.Y = frameHeight * 5; - npc.frameCounter = 0.0; + NPC.frame.Y = frameHeight * 5; + NPC.frameCounter = 0.0; } else { - npc.spriteDirection = npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 16f); - if (npc.frameCounter > 12.0) + NPC.spriteDirection = NPC.direction; + NPC.frameCounter += (double)(NPC.velocity.Length() / 16f); + if (NPC.frameCounter > 12.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 6) + if (NPC.frame.Y >= frameHeight * 6) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.ZoneSnow && - !spawnInfo.player.PillarZone() && - !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.InSunkenSea() && - !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.012f : 0f; + return spawnInfo.Player.ZoneSnow && + !spawnInfo.Player.PillarZone() && + !spawnInfo.Player.ZoneDungeon && + !spawnInfo.Player.InSunkenSea() && + !spawnInfo.playerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.012f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -134,21 +135,21 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ItemID.Leather, 1, 1, 2); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCryogen, 3, 1, 1); + DropHelper.DropItemChance(NPC, ItemID.Leather, 1, 1, 2); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCryogen, 3, 1, 1); } } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index aa8d56285d..f05c92e985 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -16,26 +16,26 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - npc.damage = 70; - npc.width = 38; - npc.height = 38; - npc.defense = 20; - npc.DR_NERD(0.2f); - npc.lifeMax = 20000; - npc.knockBackResist = 0f; - npc.aiStyle = -1; + NPC.damage = 70; + NPC.width = 38; + NPC.height = 38; + NPC.defense = 20; + NPC.DR_NERD(0.2f); + NPC.lifeMax = 20000; + NPC.knockBackResist = 0f; + NPC.aiStyle = -1; aiType = -1; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.dontCountMe = true; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -45,43 +45,43 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - if (npc.ai[3] > 0f) + if (NPC.ai[3] > 0f) { - npc.realLife = (int)npc.ai[3]; + NPC.realLife = (int)NPC.ai[3]; } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } bool flag = false; - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) { flag = true; } - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) { flag = true; } if (flag) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); } if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.localAI[0] >= (float)Main.rand.Next(1800, 26000)) + NPC.localAI[0] += (float)Main.rand.Next(4); + if (NPC.localAI[0] >= (float)Main.rand.Next(1800, 26000)) { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.localAI[0] = 0f; + NPC.TargetClosest(true); + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, + Main.player[NPC.target].width, Main.player[NPC.target].height)) { float speed = 7f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); + Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)(NPC.height / 2)); + float num6 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); + float num7 = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); num8 = speed / num8; num6 *= num8; @@ -91,13 +91,13 @@ namespace CalamityMod.NPCs.NormalNPCs vector.X += num6 * 5f; vector.Y += num7 * 5f; Projectile.NewProjectile(vector.X, vector.Y, num6, num7, num10, num9, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; + NPC.netUpdate = true; } } } - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num20 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num21 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num20 = (float)((int)(num20 / 16f) * 16); num21 = (float)((int)(num21 / 16f) * 16); vector3.X = (float)((int)(vector3.X / 16f) * 16); @@ -105,25 +105,25 @@ namespace CalamityMod.NPCs.NormalNPCs num20 -= vector3.X; num21 -= vector3.Y; float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num20 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; - num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; + vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num20 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector3.X; + num21 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector3.Y; } catch { } - npc.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; + NPC.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - int num23 = (int)(44f * npc.scale); + int num23 = (int)(44f * NPC.scale); num22 = (num22 - (float)num23) / num22; num20 *= num22; num21 *= num22; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num20; - npc.position.Y = npc.position.Y + num21; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num20; + NPC.position.Y = NPC.position.Y + num21; } } @@ -131,13 +131,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 5f0fc073dd..678af5585d 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -7,6 +7,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.NormalNPCs { @@ -21,48 +22,48 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.damage = 90; - npc.npcSlots = 10f; - npc.width = 54; - npc.height = 54; - npc.defense = 10; - npc.DR_NERD(0.1f); - npc.lifeMax = 20000; - npc.knockBackResist = 0f; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 90; + NPC.npcSlots = 10f; + NPC.width = 54; + NPC.height = 54; + NPC.defense = 10; + NPC.DR_NERD(0.1f); + NPC.lifeMax = 20000; + NPC.knockBackResist = 0f; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 5, 0, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - banner = npc.type; + NPC.value = Item.buyPrice(0, 5, 0, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void AI() { bool death = CalamityWorld.death; - if (npc.ai[3] > 0f) + if (NPC.ai[3] > 0f) { - npc.realLife = (int)npc.ai[3]; + NPC.realLife = (int)NPC.ai[3]; } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } if (Main.netMode != NetmodeID.MultiplayerClient) { if (!TailSpawned) { - npc.ai[3] = (float)npc.whoAmI; - npc.realLife = npc.whoAmI; - int num2 = npc.whoAmI; + NPC.ai[3] = (float)NPC.whoAmI; + NPC.realLife = NPC.whoAmI; + int num2 = NPC.whoAmI; int num3 = 30; for (int j = 0; j <= num3; j++) { @@ -71,9 +72,9 @@ namespace CalamityMod.NPCs.NormalNPCs { num4 = ModContent.NPCType(); } - int num5 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), num4, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num5].ai[3] = (float)npc.whoAmI; - Main.npc[num5].realLife = npc.whoAmI; + int num5 = NPC.NewNPC((int)(NPC.position.X + (float)(NPC.width / 2)), (int)(NPC.position.Y + (float)NPC.height), num4, NPC.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num5].ai[3] = (float)NPC.whoAmI; + Main.npc[num5].realLife = NPC.whoAmI; Main.npc[num5].ai[1] = (float)num2; Main.npc[num2].ai[0] = (float)num5; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num5, 0f, 0f, 0f, 0, 0, 0); @@ -82,10 +83,10 @@ namespace CalamityMod.NPCs.NormalNPCs TailSpawned = true; } } - int num12 = (int)(npc.position.X / 16f) - 1; - int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num14 = (int)(npc.position.Y / 16f) - 1; - int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + int num12 = (int)(NPC.position.X / 16f) - 1; + int num13 = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; + int num14 = (int)(NPC.position.Y / 16f) - 1; + int num15 = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; if (num12 < 0) { num12 = 0; @@ -109,12 +110,12 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int l = num14; l < num15; l++) { - if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) + if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].liquid > 64)) { Vector2 vector2; vector2.X = (float)(k * 16); vector2.Y = (float)(l * 16); - if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) + if (NPC.position.X + (float)NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + (float)NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f) { flag2 = true; break; @@ -125,11 +126,11 @@ namespace CalamityMod.NPCs.NormalNPCs } if (!flag2) { - npc.localAI[1] = 1f; - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + NPC.localAI[1] = 1f; + Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); int num16 = 1000; bool flag3 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) + if (NPC.position.Y > Main.player[NPC.target].position.Y) { for (int m = 0; m < 255; m++) { @@ -151,19 +152,19 @@ namespace CalamityMod.NPCs.NormalNPCs } else { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; } float num17 = death ? 13.5f : 10f; - if (Main.player[npc.target].dead || (double)Main.player[npc.target].position.Y < Main.rockLayer * 16.0) + if (Main.player[NPC.target].dead || (double)Main.player[NPC.target].position.Y < Main.rockLayer * 16.0) { flag2 = false; - npc.velocity.Y = npc.velocity.Y + 1f; - if ((double)npc.position.Y > Main.rockLayer * 16.0) + NPC.velocity.Y = NPC.velocity.Y + 1f; + if ((double)NPC.position.Y > Main.rockLayer * 16.0) { - npc.velocity.Y = npc.velocity.Y + 1f; + NPC.velocity.Y = NPC.velocity.Y + 1f; num17 = death ? 27f : 20f; } - if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) + if ((double)NPC.position.Y > (double)((Main.maxTilesY - 200) * 16)) { for (int a = 0; a < 200; a++) { @@ -177,9 +178,9 @@ namespace CalamityMod.NPCs.NormalNPCs } float num18 = death ? 0.0675f : 0.05f; float num19 = death ? 0.10125f : 0.075f; - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num20 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num21 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num20 = (float)((int)(num20 / 16f) * 16); num21 = (float)((int)(num21 / 16f) * 16); vector3.X = (float)((int)(vector3.X / 16f) * 16); @@ -189,49 +190,49 @@ namespace CalamityMod.NPCs.NormalNPCs float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); if (!flag2) { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + 0.15f; - if (npc.velocity.Y > num17) + NPC.TargetClosest(true); + NPC.velocity.Y = NPC.velocity.Y + 0.15f; + if (NPC.velocity.Y > num17) { - npc.velocity.Y = num17; + NPC.velocity.Y = num17; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4) { - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; } else { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; } } - else if (npc.velocity.Y == num17) + else if (NPC.velocity.Y == num17) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } } - else if (npc.velocity.Y > 4f) + else if (NPC.velocity.Y > 4f) { - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.velocity.X = npc.velocity.X + num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X + num18 * 0.9f; } else { - npc.velocity.X = npc.velocity.X - num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X - num18 * 0.9f; } } } else { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { float num24 = num22 / 40f; if (num24 < 10f) @@ -242,8 +243,8 @@ namespace CalamityMod.NPCs.NormalNPCs { num24 = 20f; } - npc.soundDelay = (int)num24; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + NPC.soundDelay = (int)num24; + SoundEngine.PlaySound(SoundID.Roar, (int)NPC.position.X, (int)NPC.position.Y, 1, 1f, 0f); } num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); float num25 = Math.Abs(num20); @@ -251,131 +252,131 @@ namespace CalamityMod.NPCs.NormalNPCs float num27 = num17 / num22; num20 *= num27; num21 *= num27; - if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) + if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num19; + NPC.velocity.X = NPC.velocity.X + num19; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num19; + NPC.velocity.X = NPC.velocity.X - num19; } - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num19; + NPC.velocity.Y = NPC.velocity.Y + num19; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num19; + NPC.velocity.Y = NPC.velocity.Y - num19; } } - if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) + if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + num18; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - num18; } - if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f))) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num18 * 2f; } else { - npc.velocity.Y = npc.velocity.Y - num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num18 * 2f; } } - if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f))) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num18 * 2f; + NPC.velocity.X = NPC.velocity.X + num18 * 2f; } else { - npc.velocity.X = npc.velocity.X - num18 * 2f; + NPC.velocity.X = NPC.velocity.X - num18 * 2f; } } } else if (num25 > num26) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + num18; } else { - npc.velocity.Y = npc.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - num18; } } } else { - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } else { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } } } } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; if (flag2) { - if (npc.localAI[0] != 1f) + if (NPC.localAI[0] != 1f) { - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.localAI[0] = 1f; + NPC.localAI[0] = 1f; } else { - if (npc.localAI[0] != 0f) + if (NPC.localAI[0] != 0f) { - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) { - npc.netUpdate = true; + NPC.netUpdate = true; } } @@ -393,33 +394,33 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } } } public override bool SpecialNPCLoot() { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + int closestSegmentID = DropHelper.FindClosestWormSegment(NPC, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()); - npc.position = Main.npc[closestSegmentID].position; + NPC.position = Main.npc[closestSegmentID].position; return false; } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 4); - DropHelper.DropItem(npc, ModContent.ItemType(), 4, 8); - DropHelper.DropItem(npc, ModContent.ItemType(), 4, 8); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 4); + DropHelper.DropItem(NPC, ModContent.ItemType(), 4, 8); + DropHelper.DropItem(NPC, ModContent.ItemType(), 4, 8); } } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index f19c6946ea..c400b6cb69 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -16,26 +16,26 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - npc.damage = 55; - npc.width = 34; - npc.height = 34; - npc.defense = 30; - npc.DR_NERD(0.3f); - npc.lifeMax = 20000; - npc.knockBackResist = 0f; - npc.aiStyle = -1; + NPC.damage = 55; + NPC.width = 34; + NPC.height = 34; + NPC.defense = 30; + NPC.DR_NERD(0.3f); + NPC.lifeMax = 20000; + NPC.knockBackResist = 0f; + NPC.aiStyle = -1; aiType = -1; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.dontCountMe = true; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -45,32 +45,32 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - if (npc.ai[3] > 0f) + if (NPC.ai[3] > 0f) { - npc.realLife = (int)npc.ai[3]; + NPC.realLife = (int)NPC.ai[3]; } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } bool flag = false; - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) { flag = true; } - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) { flag = true; } if (flag) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); } - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num20 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num21 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num20 = (float)((int)(num20 / 16f) * 16); num21 = (float)((int)(num21 / 16f) * 16); vector3.X = (float)((int)(vector3.X / 16f) * 16); @@ -78,25 +78,25 @@ namespace CalamityMod.NPCs.NormalNPCs num20 -= vector3.X; num21 -= vector3.Y; float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num20 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; - num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; + vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num20 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector3.X; + num21 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector3.Y; } catch { } - npc.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; + NPC.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - int num23 = (int)(44f * npc.scale); + int num23 = (int)(44f * NPC.scale); num22 = (num22 - (float)num23) / num22; num20 *= num22; num21 *= num22; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num20; - npc.position.Y = npc.position.Y + num21; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num20; + NPC.position.Y = NPC.position.Y + num21; } } @@ -114,13 +114,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/BlightedEye.cs b/NPCs/NormalNPCs/BlightedEye.cs index ea77f392ce..6a7eb13690 100644 --- a/NPCs/NormalNPCs/BlightedEye.cs +++ b/NPCs/NormalNPCs/BlightedEye.cs @@ -10,48 +10,48 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Blighted Eye"); - Main.npcFrameCount[npc.type] = 2; + Main.npcFrameCount[NPC.type] = 2; } public override void SetDefaults() { - npc.aiStyle = 2; + NPC.aiStyle = 2; aiType = NPCID.TheHungryII; - npc.damage = 32; - npc.width = 30; - npc.height = 32; - npc.defense = 8; - npc.lifeMax = 120; - npc.knockBackResist = 0.6f; + NPC.damage = 32; + NPC.width = 30; + NPC.height = 32; + NPC.defense = 8; + NPC.lifeMax = 120; + NPC.knockBackResist = 0.6f; animationType = NPCID.DemonEye; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneSulphur) + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.Player.Calamity().ZoneSulphur) { return 0f; } @@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.5f); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.5f); } } } diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs index e858d61bfa..f9ad60b15c 100644 --- a/NPCs/NormalNPCs/BloomSlime.cs +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -12,37 +12,37 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Bloom Slime"); - Main.npcFrameCount[npc.type] = 2; + Main.npcFrameCount[NPC.type] = 2; } public override void SetDefaults() { - npc.aiStyle = 1; + NPC.aiStyle = 1; aiType = NPCID.ToxicSludge; - npc.damage = 80; - npc.width = 40; - npc.height = 30; - npc.defense = 25; - npc.lifeMax = 1000; - npc.knockBackResist = 0f; + NPC.damage = 80; + NPC.width = 40; + NPC.height = 30; + NPC.defense = 25; + NPC.lifeMax = 1000; + NPC.knockBackResist = 0f; animationType = NPCID.CorruptSlime; - npc.value = Item.buyPrice(0, 0, 25, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 25, 0); + NPC.alpha = 50; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !CalamityWorld.downedProvidence || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || !CalamityWorld.downedProvidence || spawnInfo.Player.Calamity().ZoneAbyss || + spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -53,20 +53,20 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 10, 26); + DropHelper.DropItem(NPC, ModContent.ItemType(), 10, 26); } } } diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index 274a0081d7..36d3b1dda0 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -14,28 +14,28 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 80; - npc.width = 40; - npc.height = 40; - npc.defense = 18; - npc.lifeMax = 300; - npc.knockBackResist = 0.95f; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit7; - npc.DeathSound = SoundID.NPCDeath35; - npc.behindTiles = true; - banner = npc.type; + NPC.damage = 80; + NPC.width = 40; + NPC.height = 40; + NPC.defense = 18; + NPC.lifeMax = 300; + NPC.knockBackResist = 0.95f; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.HitSound = SoundID.NPCHit7; + NPC.DeathSound = SoundID.NPCDeath35; + NPC.behindTiles = true; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { - CalamityAI.UnicornAI(npc, mod, true, CalamityWorld.death ? 6f : 4f, 5f, 0.2f); + CalamityAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 6f : 4f, 5f, 0.2f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -51,13 +51,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 155, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 155, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 155, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 155, hitDirection, -1f, 0, default, 1f); } } } @@ -69,9 +69,9 @@ namespace CalamityMod.NPCs.NormalNPCs // RIP LORDE // DropHelper.DropItem(npc, ModContent.ItemType()); } - DropHelper.DropItem(npc, ItemID.LihzahrdBrick, 10, 30); - DropHelper.DropItemChance(npc, ItemID.LunarTabletFragment, 7, 1, 3); //solar tablet fragment - DropHelper.DropItemChance(npc, ItemID.LihzahrdPowerCell, 50); + DropHelper.DropItem(NPC, ItemID.LihzahrdBrick, 10, 30); + DropHelper.DropItemChance(NPC, ItemID.LunarTabletFragment, 7, 1, 3); //solar tablet fragment + DropHelper.DropItemChance(NPC, ItemID.LihzahrdPowerCell, 50); } } } diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index 13d3a261a3..861630f12a 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -15,45 +15,45 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Cnidrion"); - Main.npcFrameCount[npc.type] = 10; + Main.npcFrameCount[NPC.type] = 10; } public override void SetDefaults() { - npc.npcSlots = 3f; - npc.aiStyle = -1; - npc.damage = 20; - npc.width = 160; - npc.height = 80; - npc.defense = 6; - npc.noGravity = true; - npc.noTileCollide = true; - npc.DR_NERD(0.05f); - npc.lifeMax = 280; - npc.knockBackResist = 0.05f; + NPC.npcSlots = 3f; + NPC.aiStyle = -1; + NPC.damage = 20; + NPC.width = 160; + NPC.height = 80; + NPC.defense = 6; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.DR_NERD(0.05f); + NPC.lifeMax = 280; + NPC.knockBackResist = 0.05f; aiType = -1; - npc.value = Item.buyPrice(0, 0, 25, 0); - npc.HitSound = SoundID.NPCHit12; - npc.DeathSound = SoundID.NPCDeath18; - npc.rarity = 2; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 25, 0); + NPC.HitSound = SoundID.NPCHit12; + NPC.DeathSound = SoundID.NPCDeath18; + NPC.rarity = 2; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone() || - spawnInfo.player.InAstral() || - spawnInfo.player.ZoneCorrupt || - spawnInfo.player.ZoneCrimson || - spawnInfo.player.ZoneOldOneArmy || - spawnInfo.player.ZoneSkyHeight || + if (spawnInfo.Player.PillarZone() || + spawnInfo.Player.InAstral() || + spawnInfo.Player.ZoneCorrupt || + spawnInfo.Player.ZoneCrimson || + spawnInfo.Player.ZoneOldOneArmy || + spawnInfo.Player.ZoneSkyHeight || spawnInfo.playerSafe || - !spawnInfo.player.ZoneDesert || - !spawnInfo.player.ZoneOverworldHeight || + !spawnInfo.Player.ZoneDesert || + !spawnInfo.Player.ZoneOverworldHeight || Main.eclipse || Main.snowMoon || Main.pumpkinMoon || @@ -66,69 +66,69 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.1f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; bool expertMode = Main.expertMode; - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; float num823 = 1f; - npc.TargetClosest(true); + NPC.TargetClosest(true); bool flag51 = false; int offsetX = 80; int projectileDamage = expertMode ? 9 : 12; - if (npc.life < npc.lifeMax * 0.33 || (CalamityWorld.death && npc.life < npc.lifeMax * 0.6)) + if (NPC.life < NPC.lifeMax * 0.33 || (CalamityWorld.death && NPC.life < NPC.lifeMax * 0.6)) { num823 = 2f; } - if (npc.life < npc.lifeMax * 0.1) + if (NPC.life < NPC.lifeMax * 0.1) { num823 = 4f; } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.ai[1] += 1f; - if (npc.life < npc.lifeMax * 0.33 || (CalamityWorld.death && npc.life < npc.lifeMax * 0.6)) + NPC.ai[1] += 1f; + if (NPC.life < NPC.lifeMax * 0.33 || (CalamityWorld.death && NPC.life < NPC.lifeMax * 0.6)) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } - if (npc.life < npc.lifeMax * 0.1) + if (NPC.life < NPC.lifeMax * 0.1) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } - if (npc.ai[1] >= 300f && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.ai[1] >= 300f && Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[1] = 0f; - if (npc.life < npc.lifeMax * 0.25) + NPC.ai[1] = 0f; + if (NPC.life < NPC.lifeMax * 0.25) { - npc.ai[0] = Main.rand.Next(3, 5); + NPC.ai[0] = Main.rand.Next(3, 5); } - else if (CalamityWorld.death && npc.life < npc.lifeMax * 0.6) + else if (CalamityWorld.death && NPC.life < NPC.lifeMax * 0.6) { - npc.ai[0] = Main.rand.Next(1, 5); + NPC.ai[0] = Main.rand.Next(1, 5); } else { - npc.ai[0] = Main.rand.Next(1, 3); + NPC.ai[0] = Main.rand.Next(1, 3); } - npc.netUpdate = true; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { flag51 = true; - npc.ai[1] += 1f; - if (npc.ai[1] % 30f == 0f) + NPC.ai[1] += 1f; + if (NPC.ai[1] % 30f == 0f) { - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += offsetX * npc.direction; - float num829 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector18.X; - float num830 = Main.player[npc.target].position.Y - vector18.Y; + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + 20f); + vector18.X += offsetX * NPC.direction; + float num829 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector18.X; + float num830 = Main.player[NPC.target].position.Y - vector18.Y; float num831 = (float)Math.Sqrt(num829 * num829 + num830 * num830); float num832 = 6f; num831 = num832 / num831; @@ -138,22 +138,22 @@ namespace CalamityMod.NPCs.NormalNPCs num830 *= 1f + Main.rand.Next(-10, 11) * 0.01f; Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer); } - if (npc.ai[1] >= 120f) + if (NPC.ai[1] >= 120f) { - npc.ai[1] = 0f; - npc.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[0] = 0f; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { flag51 = true; - npc.ai[1] += 1f; - if (npc.ai[1] > 60f && npc.ai[1] < 240f && npc.ai[1] % 16f == 0f) + NPC.ai[1] += 1f; + if (NPC.ai[1] > 60f && NPC.ai[1] < 240f && NPC.ai[1] % 16f == 0f) { - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += offsetX * npc.direction; - float num829 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector18.X; - float num830 = Main.player[npc.target].position.Y - vector18.Y; + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + 20f); + vector18.X += offsetX * NPC.direction; + float num829 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector18.X; + float num830 = Main.player[NPC.target].position.Y - vector18.Y; float num831 = (float)Math.Sqrt(num829 * num829 + num830 * num830); float num832 = 8f; num831 = num832 / num831; @@ -163,22 +163,22 @@ namespace CalamityMod.NPCs.NormalNPCs num830 *= 1f + Main.rand.Next(-15, 16) * 0.01f; Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer); } - if (npc.ai[1] >= 300f) + if (NPC.ai[1] >= 300f) { - npc.ai[1] = 0f; - npc.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[0] = 0f; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { num823 = 4f; - npc.ai[1] += 1f; - if (npc.ai[1] % 30f == 0f) + NPC.ai[1] += 1f; + if (NPC.ai[1] % 30f == 0f) { - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += offsetX * npc.direction; - float num844 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector18.X; - float num845 = Main.player[npc.target].position.Y - vector18.Y; + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + 20f); + vector18.X += offsetX * NPC.direction; + float num844 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector18.X; + float num845 = Main.player[NPC.target].position.Y - vector18.Y; float num846 = (float)Math.Sqrt(num844 * num844 + num845 * num845); float num847 = 10f; num846 = num847 / num846; @@ -188,22 +188,22 @@ namespace CalamityMod.NPCs.NormalNPCs num845 *= 1f + Main.rand.Next(-10, 11) * 0.001f; int num848 = Projectile.NewProjectile(vector18.X, vector18.Y, num844, num845, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer); } - if (npc.ai[1] >= 120f) + if (NPC.ai[1] >= 120f) { - npc.ai[1] = 0f; - npc.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[0] = 0f; } } - else if (npc.ai[0] == 4f) + else if (NPC.ai[0] == 4f) { num823 = 4f; - npc.ai[1] += 1f; - if (npc.ai[1] % 20f == 0f) + NPC.ai[1] += 1f; + if (NPC.ai[1] % 20f == 0f) { - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += offsetX * npc.direction; - float num829 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector18.X; - float num830 = Main.player[npc.target].position.Y - vector18.Y; + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + 20f); + vector18.X += offsetX * NPC.direction; + float num829 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector18.X; + float num830 = Main.player[NPC.target].position.Y - vector18.Y; float num831 = (float)Math.Sqrt(num829 * num829 + num830 * num830); float num832 = 11f; num831 = num832 / num831; @@ -213,69 +213,69 @@ namespace CalamityMod.NPCs.NormalNPCs num830 *= 1f + Main.rand.Next(-5, 6) * 0.01f; int num833 = Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer); } - if (npc.ai[1] >= 240f) + if (NPC.ai[1] >= 240f) { - npc.ai[1] = 0f; - npc.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[0] = 0f; } } - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 50f) + if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 50f) flag51 = true; if (flag51) { - npc.velocity.X = npc.velocity.X * 0.9f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; + NPC.velocity.X = NPC.velocity.X * 0.9f; + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; } else { - if (npc.direction > 0) - npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; + if (NPC.direction > 0) + NPC.velocity.X = (NPC.velocity.X * 20f + num823) / 21f; - if (npc.direction < 0) - npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; + if (NPC.direction < 0) + NPC.velocity.X = (NPC.velocity.X * 20f - num823) / 21f; } int num854 = 80; int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (num854 / 2), npc.position.Y + npc.height - num855); + Vector2 position2 = new Vector2(NPC.Center.X - (num854 / 2), NPC.position.Y + NPC.height - num855); bool flag52 = false; - if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + npc.width > Main.player[npc.target].position.X + Main.player[npc.target].width && npc.position.Y + npc.height < Main.player[npc.target].position.Y + Main.player[npc.target].height - 16f) + if (NPC.position.X < Main.player[NPC.target].position.X && NPC.position.X + NPC.width > Main.player[NPC.target].position.X + Main.player[NPC.target].width && NPC.position.Y + NPC.height < Main.player[NPC.target].position.Y + Main.player[NPC.target].height - 16f) flag52 = true; if (flag52) { - npc.velocity.Y += 0.5f; - if (npc.velocity.Y > 10f) - npc.velocity.Y = 10f; + NPC.velocity.Y += 0.5f; + if (NPC.velocity.Y > 10f) + NPC.velocity.Y = 10f; } else if (Collision.SolidCollision(position2, num854, num855)) { - if (npc.velocity.Y > 0f) - npc.velocity.Y = 0f; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y = 0f; - if (npc.velocity.Y > -0.2f) - npc.velocity.Y -= 0.025f; + if (NPC.velocity.Y > -0.2f) + NPC.velocity.Y -= 0.025f; else - npc.velocity.Y -= 0.2f; + NPC.velocity.Y -= 0.2f; - if (npc.velocity.Y < -2f) - npc.velocity.Y = -2f; + if (NPC.velocity.Y < -2f) + NPC.velocity.Y = -2f; } else { - if (npc.velocity.Y < 0f) - npc.velocity.Y = 0f; + if (NPC.velocity.Y < 0f) + NPC.velocity.Y = 0f; - if (npc.velocity.Y < 0.5) - npc.velocity.Y += 0.025f; + if (NPC.velocity.Y < 0.5) + NPC.velocity.Y += 0.025f; else - npc.velocity.Y += 0.25f; + NPC.velocity.Y += 0.25f; - if (npc.velocity.Y > 2f) - npc.velocity.Y = 2f; + if (NPC.velocity.Y > 2f) + NPC.velocity.Y = 2f; } } @@ -283,20 +283,20 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 40; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 2f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 5, hitDirection, -1f, 0, default, 2f); } } } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 4); } } } diff --git a/NPCs/NormalNPCs/CosmicElemental.cs b/NPCs/NormalNPCs/CosmicElemental.cs index b8811b3f40..fb795f426b 100644 --- a/NPCs/NormalNPCs/CosmicElemental.cs +++ b/NPCs/NormalNPCs/CosmicElemental.cs @@ -12,67 +12,67 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Elemental"); - Main.npcFrameCount[npc.type] = 11; + Main.npcFrameCount[NPC.type] = 11; } public override void SetDefaults() { - npc.npcSlots = 0.5f; - npc.aiStyle = 91; - npc.damage = 20; - npc.width = npc.height = 30; - npc.defense = 10; - npc.lifeMax = 25; - npc.knockBackResist = 0.5f; - npc.value = Item.buyPrice(0, 0, 3, 0); - npc.HitSound = SoundID.NPCHit7; - npc.DeathSound = SoundID.NPCDeath6; - banner = npc.type; + NPC.npcSlots = 0.5f; + NPC.aiStyle = 91; + NPC.damage = 20; + NPC.width = NPC.height = 30; + NPC.defense = 10; + NPC.lifeMax = 25; + NPC.knockBackResist = 0.5f; + NPC.value = Item.buyPrice(0, 0, 3, 0); + NPC.HitSound = SoundID.NPCHit7; + NPC.DeathSound = SoundID.NPCDeath6; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter > 6) + NPC.frameCounter++; + if (NPC.frameCounter > 6) { - npc.frame.Y += frameHeight; - npc.frameCounter = 0; + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - if (npc.frame.Y >= frameHeight * 11) - npc.frame.Y = frameHeight * 10; - else if (npc.frame.Y <= frameHeight * 5) - npc.frame.Y = frameHeight * 6; - npc.rotation += npc.velocity.X * 0.2f; + if (NPC.frame.Y >= frameHeight * 11) + NPC.frame.Y = frameHeight * 10; + else if (NPC.frame.Y <= frameHeight * 5) + NPC.frame.Y = frameHeight * 6; + NPC.rotation += NPC.velocity.X * 0.2f; } else { - if (npc.frame.Y >= frameHeight * 6) - npc.frame.Y = 0; - npc.rotation = npc.velocity.X * 0.1f; + if (NPC.frame.Y >= frameHeight * 6) + NPC.frame.Y = 0; + NPC.rotation = NPC.velocity.X * 0.1f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Texture2D texture = Main.npcTexture[npc.type]; - int height = texture.Height / Main.npcFrameCount[npc.type]; + Texture2D texture = Main.npcTexture[NPC.type]; + int height = texture.Height / Main.npcFrameCount[NPC.type]; int width = texture.Width; SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == -1) + if (NPC.spriteDirection == -1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0f, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, new Vector2(width / 2f, height / 2f), npc.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, NPC.Center - Main.screenPosition + new Vector2(0f, NPC.gfxOffY), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(width / 2f, height / 2f), NPC.scale, spriteEffects, 0f); return false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -88,13 +88,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 70, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 70, hitDirection, -1f, 0, default, 1f); } } } @@ -109,7 +109,7 @@ namespace CalamityMod.NPCs.NormalNPCs // Only one sword will ever drop at a time. if (Main.rand.NextBool(10)) { - DropHelper.DropItemFromWeightedSet(npc, + DropHelper.DropItemFromWeightedSet(NPC, DropHelper.WeightStack(ItemID.BoneSword, 5f, 1), DropHelper.WeightStack(ItemID.Starfury, 2f, 1), DropHelper.WeightStack(ItemID.EnchantedSword, 2f, 1), diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index 9003015d91..4013e7ae56 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -13,28 +13,28 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Amber Crawler"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; + NPC.npcSlots = 0.3f; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 25; - npc.width = 44; - npc.height = 34; - npc.defense = 10; - npc.lifeMax = 90; - npc.knockBackResist = 0.3f; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; + NPC.damage = 25; + NPC.width = 44; + NPC.height = 34; + NPC.defense = 10; + NPC.lifeMax = 90; + NPC.knockBackResist = 0.3f; + NPC.value = Item.buyPrice(0, 0, 0, 80); + NPC.HitSound = SoundID.NPCHit33; + NPC.DeathSound = SoundID.NPCDeath36; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) @@ -51,38 +51,38 @@ namespace CalamityMod.NPCs.NormalNPCs { if (!detected) { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; + NPC.frame.Y = frameHeight * 4; + NPC.frameCounter = 0.0; return; } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) + NPC.spriteDirection = -NPC.direction; + NPC.frameCounter += (double)(NPC.velocity.Length() / 8f); + if (NPC.frameCounter > 2.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 3) + if (NPC.frame.Y >= frameHeight * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } public override void AI() { if (!detected) - npc.TargetClosest(); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + NPC.TargetClosest(); + if (((Main.player[NPC.target].Center - NPC.Center).Length() < 100f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, + Main.player[NPC.target].width, Main.player[NPC.target].height)) || NPC.justHit) detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(npc, mod, 5f, 0.05f); + CalamityAI.GemCrawlerAI(NPC, Mod, 5f, 0.05f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -93,21 +93,21 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 32, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 32, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 32, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 32, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ItemID.Amber, 2, 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItem(NPC, ItemID.Amber, 2, 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index 3e9a6a869c..bbf29bd731 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -13,28 +13,28 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Amethyst Crawler"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 15; - npc.width = 44; - npc.height = 34; - npc.defense = 4; - npc.lifeMax = 60; - npc.knockBackResist = 0.75f; + NPC.npcSlots = 0.3f; + NPC.aiStyle = -1; + NPC.damage = 15; + NPC.width = 44; + NPC.height = 34; + NPC.defense = 4; + NPC.lifeMax = 60; + NPC.knockBackResist = 0.75f; aiType = -1; - npc.value = Item.buyPrice(0, 0, 0, 30); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 0, 30); + NPC.HitSound = SoundID.NPCHit33; + NPC.DeathSound = SoundID.NPCDeath36; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SendExtraAI(BinaryWriter writer) @@ -51,38 +51,38 @@ namespace CalamityMod.NPCs.NormalNPCs { if (!detected) { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; + NPC.frame.Y = frameHeight * 4; + NPC.frameCounter = 0.0; return; } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) + NPC.spriteDirection = -NPC.direction; + NPC.frameCounter += (double)(NPC.velocity.Length() / 8f); + if (NPC.frameCounter > 2.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 3) + if (NPC.frame.Y >= frameHeight * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } public override void AI() { if (!detected) - npc.TargetClosest(); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + NPC.TargetClosest(); + if (((Main.player[NPC.target].Center - NPC.Center).Length() < 100f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, + Main.player[NPC.target].width, Main.player[NPC.target].height)) || NPC.justHit) detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(npc, mod, 4.5f, 0.045f); + CalamityAI.GemCrawlerAI(NPC, Mod, 4.5f, 0.045f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -93,21 +93,21 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 70, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 70, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ItemID.Amethyst, 2, 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItem(NPC, ItemID.Amethyst, 2, 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index 41c88d4b52..ff30e625ef 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -14,28 +14,28 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal Crawler"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 35; - npc.width = 44; - npc.height = 34; - npc.defense = 12; - npc.lifeMax = 300; - npc.knockBackResist = 0.15f; + NPC.npcSlots = 0.3f; + NPC.aiStyle = -1; + NPC.damage = 35; + NPC.width = 44; + NPC.height = 34; + NPC.defense = 12; + NPC.lifeMax = 300; + NPC.knockBackResist = 0.15f; aiType = -1; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit33; + NPC.DeathSound = SoundID.NPCDeath36; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SendExtraAI(BinaryWriter writer) @@ -52,38 +52,38 @@ namespace CalamityMod.NPCs.NormalNPCs { if (!detected) { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; + NPC.frame.Y = frameHeight * 4; + NPC.frameCounter = 0.0; return; } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) + NPC.spriteDirection = -NPC.direction; + NPC.frameCounter += (double)(NPC.velocity.Length() / 8f); + if (NPC.frameCounter > 2.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 3) + if (NPC.frame.Y >= frameHeight * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } public override void AI() { if (!detected) - npc.TargetClosest(); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + NPC.TargetClosest(); + if (((Main.player[NPC.target].Center - NPC.Center).Length() < 100f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, + Main.player[NPC.target].width, Main.player[NPC.target].height)) || NPC.justHit) detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(npc, mod, 7f, 0.07f); + CalamityAI.GemCrawlerAI(NPC, Mod, 7f, 0.07f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -94,22 +94,22 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ItemID.CrystalShard, 2, 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItem(NPC, ItemID.CrystalShard, 2, 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 5); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index 6ada901a35..4a7348b856 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -13,28 +13,28 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Diamond Crawler"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 24; - npc.width = 44; - npc.height = 34; - npc.defense = 8; - npc.lifeMax = 150; - npc.knockBackResist = 0.35f; + NPC.npcSlots = 0.3f; + NPC.aiStyle = -1; + NPC.damage = 24; + NPC.width = 44; + NPC.height = 34; + NPC.defense = 8; + NPC.lifeMax = 150; + NPC.knockBackResist = 0.35f; aiType = -1; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.HitSound = SoundID.NPCHit33; + NPC.DeathSound = SoundID.NPCDeath36; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SendExtraAI(BinaryWriter writer) @@ -51,38 +51,38 @@ namespace CalamityMod.NPCs.NormalNPCs { if (!detected) { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; + NPC.frame.Y = frameHeight * 4; + NPC.frameCounter = 0.0; return; } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) + NPC.spriteDirection = -NPC.direction; + NPC.frameCounter += (double)(NPC.velocity.Length() / 8f); + if (NPC.frameCounter > 2.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 3) + if (NPC.frame.Y >= frameHeight * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } public override void AI() { if (!detected) - npc.TargetClosest(); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + NPC.TargetClosest(); + if (((Main.player[NPC.target].Center - NPC.Center).Length() < 100f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, + Main.player[NPC.target].width, Main.player[NPC.target].height)) || NPC.justHit) detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(npc, mod, 6f, 0.06f); + CalamityAI.GemCrawlerAI(NPC, Mod, 6f, 0.06f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -93,21 +93,21 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 91, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 91, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 91, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 91, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ItemID.Diamond, 2, 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItem(NPC, ItemID.Diamond, 2, 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index 6032f8650d..db6d909c76 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -13,28 +13,28 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Emerald Crawler"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 20; - npc.width = 44; - npc.height = 34; - npc.defense = 6; - npc.lifeMax = 105; - npc.knockBackResist = 0.55f; + NPC.npcSlots = 0.3f; + NPC.aiStyle = -1; + NPC.damage = 20; + NPC.width = 44; + NPC.height = 34; + NPC.defense = 6; + NPC.lifeMax = 105; + NPC.knockBackResist = 0.55f; aiType = -1; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.HitSound = SoundID.NPCHit33; + NPC.DeathSound = SoundID.NPCDeath36; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SendExtraAI(BinaryWriter writer) @@ -51,38 +51,38 @@ namespace CalamityMod.NPCs.NormalNPCs { if (!detected) { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; + NPC.frame.Y = frameHeight * 4; + NPC.frameCounter = 0.0; return; } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) + NPC.spriteDirection = -NPC.direction; + NPC.frameCounter += (double)(NPC.velocity.Length() / 8f); + if (NPC.frameCounter > 2.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 3) + if (NPC.frame.Y >= frameHeight * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } public override void AI() { if (!detected) - npc.TargetClosest(); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + NPC.TargetClosest(); + if (((Main.player[NPC.target].Center - NPC.Center).Length() < 100f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, + Main.player[NPC.target].width, Main.player[NPC.target].height)) || NPC.justHit) detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(npc, mod, 5.5f, 0.055f); + CalamityAI.GemCrawlerAI(NPC, Mod, 5.5f, 0.055f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -93,21 +93,21 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 89, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 89, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 89, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 89, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ItemID.Emerald, 2, 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItem(NPC, ItemID.Emerald, 2, 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index 3f59e7bcb4..0e7e6deebb 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -13,28 +13,28 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Ruby Crawler"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 23; - npc.width = 44; - npc.height = 34; - npc.defense = 8; - npc.lifeMax = 135; - npc.knockBackResist = 0.45f; + NPC.npcSlots = 0.3f; + NPC.aiStyle = -1; + NPC.damage = 23; + NPC.width = 44; + NPC.height = 34; + NPC.defense = 8; + NPC.lifeMax = 135; + NPC.knockBackResist = 0.45f; aiType = -1; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.HitSound = SoundID.NPCHit33; + NPC.DeathSound = SoundID.NPCDeath36; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SendExtraAI(BinaryWriter writer) @@ -51,38 +51,38 @@ namespace CalamityMod.NPCs.NormalNPCs { if (!detected) { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; + NPC.frame.Y = frameHeight * 4; + NPC.frameCounter = 0.0; return; } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) + NPC.spriteDirection = -NPC.direction; + NPC.frameCounter += (double)(NPC.velocity.Length() / 8f); + if (NPC.frameCounter > 2.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 3) + if (NPC.frame.Y >= frameHeight * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } public override void AI() { if (!detected) - npc.TargetClosest(); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + NPC.TargetClosest(); + if (((Main.player[NPC.target].Center - NPC.Center).Length() < 100f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, + Main.player[NPC.target].width, Main.player[NPC.target].height)) || NPC.justHit) detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(npc, mod, 6f, 0.06f); + CalamityAI.GemCrawlerAI(NPC, Mod, 6f, 0.06f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -93,21 +93,21 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 12, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 12, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 12, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 12, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ItemID.Ruby, 2, 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItem(NPC, ItemID.Ruby, 2, 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index f93b7e5595..53ce5f7feb 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -13,28 +13,28 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Sapphire Crawler"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 18; - npc.width = 44; - npc.height = 34; - npc.defense = 6; - npc.lifeMax = 90; - npc.knockBackResist = 0.65f; + NPC.npcSlots = 0.3f; + NPC.aiStyle = -1; + NPC.damage = 18; + NPC.width = 44; + NPC.height = 34; + NPC.defense = 6; + NPC.lifeMax = 90; + NPC.knockBackResist = 0.65f; aiType = -1; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.HitSound = SoundID.NPCHit33; + NPC.DeathSound = SoundID.NPCDeath36; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SendExtraAI(BinaryWriter writer) @@ -51,38 +51,38 @@ namespace CalamityMod.NPCs.NormalNPCs { if (!detected) { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; + NPC.frame.Y = frameHeight * 4; + NPC.frameCounter = 0.0; return; } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) + NPC.spriteDirection = -NPC.direction; + NPC.frameCounter += (double)(NPC.velocity.Length() / 8f); + if (NPC.frameCounter > 2.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 3) + if (NPC.frame.Y >= frameHeight * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } public override void AI() { if (!detected) - npc.TargetClosest(); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + NPC.TargetClosest(); + if (((Main.player[NPC.target].Center - NPC.Center).Length() < 100f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, + Main.player[NPC.target].width, Main.player[NPC.target].height)) || NPC.justHit) detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(npc, mod, 5.5f, 0.055f); + CalamityAI.GemCrawlerAI(NPC, Mod, 5.5f, 0.055f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -93,21 +93,21 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ItemID.Sapphire, 2, 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItem(NPC, ItemID.Sapphire, 2, 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index e4f25645e4..2d1b7b94fa 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -13,28 +13,28 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Topaz Crawler"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 12; - npc.width = 44; - npc.height = 34; - npc.defense = 4; - npc.lifeMax = 45; - npc.knockBackResist = 0.85f; + NPC.npcSlots = 0.3f; + NPC.aiStyle = -1; + NPC.damage = 12; + NPC.width = 44; + NPC.height = 34; + NPC.defense = 4; + NPC.lifeMax = 45; + NPC.knockBackResist = 0.85f; aiType = -1; - npc.value = Item.buyPrice(0, 0, 0, 30); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 0, 30); + NPC.HitSound = SoundID.NPCHit33; + NPC.DeathSound = SoundID.NPCDeath36; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SendExtraAI(BinaryWriter writer) @@ -51,38 +51,38 @@ namespace CalamityMod.NPCs.NormalNPCs { if (!detected) { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; + NPC.frame.Y = frameHeight * 4; + NPC.frameCounter = 0.0; return; } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) + NPC.spriteDirection = -NPC.direction; + NPC.frameCounter += (double)(NPC.velocity.Length() / 8f); + if (NPC.frameCounter > 2.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 3) + if (NPC.frame.Y >= frameHeight * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } public override void AI() { if (!detected) - npc.TargetClosest(); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + NPC.TargetClosest(); + if (((Main.player[NPC.target].Center - NPC.Center).Length() < 100f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, + Main.player[NPC.target].width, Main.player[NPC.target].height)) || NPC.justHit) detected = true; if (!detected) return; - CalamityAI.GemCrawlerAI(npc, mod, 4.5f, 0.045f); + CalamityAI.GemCrawlerAI(NPC, Mod, 4.5f, 0.045f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -93,21 +93,21 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 147, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 147, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 147, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 147, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ItemID.Topaz, 2, 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItem(NPC, ItemID.Topaz, 2, 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index 6e93895428..ec2e193681 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -10,36 +10,36 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Crimulan Blight Slime"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.aiStyle = 1; + NPC.aiStyle = 1; aiType = NPCID.DungeonSlime; - npc.damage = 30; - npc.width = 60; - npc.height = 42; - npc.defense = 8; - npc.lifeMax = 130; - npc.knockBackResist = 0.3f; + NPC.damage = 30; + NPC.width = 60; + NPC.height = 42; + NPC.defense = 8; + NPC.lifeMax = 130; + NPC.knockBackResist = 0.3f; animationType = NPCID.RainbowSlime; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.alpha = 105; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.alpha = 105; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneAbyss) { return 0f; } @@ -50,13 +50,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 40; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } @@ -68,11 +68,11 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - int item = Item.NewItem(npc.Center, npc.Size, ModContent.ItemType(), Main.rand.Next(15, 21), false, 0, false, false); + int item = Item.NewItem(NPC.Center, NPC.Size, ModContent.ItemType(), Main.rand.Next(15, 21), false, 0, false, false); Main.item[item].notAmmo = true; NetMessage.SendData(MessageID.ItemTweaker, -1, -1, null, item, 1f, 0f, 0f, 0, 0, 0); - DropHelper.DropItem(npc, ItemID.Gel, 10, 14); + DropHelper.DropItem(NPC, ItemID.Gel, 10, 14); } } } diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index 55d9482e53..c30334b759 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -11,38 +11,38 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Cryo Slime"); - Main.npcFrameCount[npc.type] = 2; + Main.npcFrameCount[NPC.type] = 2; } public override void SetDefaults() { - npc.aiStyle = 1; + NPC.aiStyle = 1; aiType = NPCID.DungeonSlime; - npc.damage = 30; - npc.width = 40; - npc.height = 30; - npc.defense = 8; - npc.lifeMax = 120; - npc.knockBackResist = 0f; + NPC.damage = 30; + NPC.width = 40; + NPC.height = 30; + NPC.defense = 8; + NPC.lifeMax = 120; + NPC.knockBackResist = 0f; animationType = NPCID.CorruptSlime; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.alpha = 50; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = false; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = false; + NPC.Calamity().VulnerableToSickness = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !CalamityWorld.downedCryogen || (!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1) || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || !CalamityWorld.downedCryogen || (!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1) || spawnInfo.Player.Calamity().ZoneAbyss || + spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -61,20 +61,20 @@ namespace CalamityMod.NPCs.NormalNPCs int dustType = 91; for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, dustType, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, dustType, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 10, 26); + DropHelper.DropItem(NPC, ModContent.ItemType(), 10, 26); } } } diff --git a/NPCs/NormalNPCs/Cryocore.cs b/NPCs/NormalNPCs/Cryocore.cs index 7d0bde08d9..8110603e0f 100644 --- a/NPCs/NormalNPCs/Cryocore.cs +++ b/NPCs/NormalNPCs/Cryocore.cs @@ -12,89 +12,89 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Cryocore"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.damage = 35; - npc.width = 40; - npc.height = 40; - npc.defense = 6; - npc.lifeMax = 220; - npc.aiStyle = -1; + NPC.damage = 35; + NPC.width = 40; + NPC.height = 40; + NPC.defense = 6; + NPC.lifeMax = 220; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 3, 50); - npc.knockBackResist = 0.75f; - npc.noGravity = true; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath15; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = false; - npc.Calamity().VulnerableToSickness = false; + NPC.value = Item.buyPrice(0, 0, 3, 50); + NPC.knockBackResist = 0.75f; + NPC.noGravity = true; + NPC.HitSound = SoundID.NPCHit5; + NPC.DeathSound = SoundID.NPCDeath15; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = false; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.02f, 0.5f, 0.5f); - npc.TargetClosest(); + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.02f, 0.5f, 0.5f); + NPC.TargetClosest(); float speed = 11f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; - float num1374 = Main.player[npc.target].Center.Y - vector167.Y; + Vector2 vector167 = new Vector2(NPC.Center.X + (float)(NPC.direction * 20), NPC.Center.Y + 6f); + float num1373 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector167.X; + float num1374 = Main.player[NPC.target].Center.Y - vector167.Y; float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); float num1376 = speed / num1375; num1373 *= num1376; num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) + NPC.ai[0] -= 1f; + if (num1375 < 200f || NPC.ai[0] > 0f) { if (num1375 < 200f) { - npc.ai[0] = 20f; + NPC.ai[0] = 20f; } - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.direction = -1; + NPC.direction = -1; } else { - npc.direction = 1; + NPC.direction = 1; } - npc.rotation += (float)npc.direction * 0.3f; + NPC.rotation += (float)NPC.direction * 0.3f; return; } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f; + NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f; if (num1375 < 350f) { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + NPC.velocity.X = (NPC.velocity.X * 10f + num1373) / 11f; + NPC.velocity.Y = (NPC.velocity.Y * 10f + num1374) / 11f; } if (num1375 < 300f) { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + NPC.velocity.X = (NPC.velocity.X * 7f + num1373) / 8f; + NPC.velocity.Y = (NPC.velocity.Y * 7f + num1374) / 8f; } - npc.rotation = npc.velocity.X * 0.15f; + NPC.rotation = NPC.velocity.X * 0.15f; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.ZoneSnow && - spawnInfo.player.ZoneOverworldHeight && - !spawnInfo.player.PillarZone() && - !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.InSunkenSea() && - Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.01f : 0f; + return spawnInfo.Player.ZoneSnow && + spawnInfo.Player.ZoneOverworldHeight && + !spawnInfo.Player.PillarZone() && + !spawnInfo.Player.ZoneDungeon && + !spawnInfo.Player.InSunkenSea() && + Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.01f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -107,21 +107,21 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Cryocore"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Cryocore"), 1f); } } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.33f); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.33f); } } } diff --git a/NPCs/NormalNPCs/Cryocore2.cs b/NPCs/NormalNPCs/Cryocore2.cs index d2d7cf467f..17856687d4 100644 --- a/NPCs/NormalNPCs/Cryocore2.cs +++ b/NPCs/NormalNPCs/Cryocore2.cs @@ -12,89 +12,89 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Cryocore"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.damage = 40; - npc.width = 66; - npc.height = 66; - npc.defense = 10; - npc.lifeMax = 300; - npc.aiStyle = -1; + NPC.damage = 40; + NPC.width = 66; + NPC.height = 66; + NPC.defense = 10; + NPC.lifeMax = 300; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.knockBackResist = 0.5f; - npc.noGravity = true; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath15; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = false; - npc.Calamity().VulnerableToSickness = false; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.knockBackResist = 0.5f; + NPC.noGravity = true; + NPC.HitSound = SoundID.NPCHit5; + NPC.DeathSound = SoundID.NPCDeath15; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = false; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.02f, 0.5f, 0.5f); - npc.TargetClosest(); + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.02f, 0.5f, 0.5f); + NPC.TargetClosest(); float speed = 12f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; - float num1374 = Main.player[npc.target].Center.Y - vector167.Y; + Vector2 vector167 = new Vector2(NPC.Center.X + (float)(NPC.direction * 20), NPC.Center.Y + 6f); + float num1373 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector167.X; + float num1374 = Main.player[NPC.target].Center.Y - vector167.Y; float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); float num1376 = speed / num1375; num1373 *= num1376; num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) + NPC.ai[0] -= 1f; + if (num1375 < 200f || NPC.ai[0] > 0f) { if (num1375 < 200f) { - npc.ai[0] = 20f; + NPC.ai[0] = 20f; } - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.direction = -1; + NPC.direction = -1; } else { - npc.direction = 1; + NPC.direction = 1; } - npc.rotation += (float)npc.direction * 0.3f; + NPC.rotation += (float)NPC.direction * 0.3f; return; } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f; + NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f; if (num1375 < 350f) { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + NPC.velocity.X = (NPC.velocity.X * 10f + num1373) / 11f; + NPC.velocity.Y = (NPC.velocity.Y * 10f + num1374) / 11f; } if (num1375 < 300f) { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + NPC.velocity.X = (NPC.velocity.X * 7f + num1373) / 8f; + NPC.velocity.Y = (NPC.velocity.Y * 7f + num1374) / 8f; } - npc.rotation = npc.velocity.X * 0.15f; + NPC.rotation = NPC.velocity.X * 0.15f; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.ZoneSnow && - spawnInfo.player.ZoneOverworldHeight && - !spawnInfo.player.PillarZone() && - !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.InSunkenSea() && - Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.01f : 0f; + return spawnInfo.Player.ZoneSnow && + spawnInfo.Player.ZoneOverworldHeight && + !spawnInfo.Player.PillarZone() && + !spawnInfo.Player.ZoneDungeon && + !spawnInfo.Player.InSunkenSea() && + Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.01f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -107,21 +107,21 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Cryocore2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Cryocore2"), 1f); } } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.5f); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.5f); } } } diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index 98849c42cf..06f7792637 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -12,67 +12,67 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Cryon"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 42; - npc.width = 50; - npc.height = 64; - npc.defense = 10; - npc.DR_NERD(0.1f); - npc.lifeMax = 300; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - banner = npc.type; + NPC.damage = 42; + NPC.width = 50; + NPC.height = 64; + NPC.defense = 10; + NPC.DR_NERD(0.1f); + NPC.lifeMax = 300; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit5; + NPC.DeathSound = SoundID.NPCDeath7; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.coldDamage = true; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = false; - npc.Calamity().VulnerableToSickness = false; + NPC.coldDamage = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = false; + NPC.Calamity().VulnerableToSickness = false; } public override void AI() { - CalamityAI.UnicornAI(npc, mod, false, CalamityWorld.death ? 6f : 4f, 5f, CalamityWorld.death ? 0.15f : 0.1f); + CalamityAI.UnicornAI(NPC, Mod, false, CalamityWorld.death ? 6f : 4f, 5f, CalamityWorld.death ? 0.15f : 0.1f); } public override void FindFrame(int frameHeight) { - if (npc.velocity.Y > 0f || npc.velocity.Y < 0f) + if (NPC.velocity.Y > 0f || NPC.velocity.Y < 0f) { - npc.spriteDirection = npc.direction; - npc.frame.Y = frameHeight * 5; - npc.frameCounter = 0.0; + NPC.spriteDirection = NPC.direction; + NPC.frame.Y = frameHeight * 5; + NPC.frameCounter = 0.0; } else { - npc.spriteDirection = npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 2f); - if (npc.frameCounter > 12.0) + NPC.spriteDirection = NPC.direction; + NPC.frameCounter += (double)(NPC.velocity.Length() / 2f); + if (NPC.frameCounter > 12.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 4) + if (NPC.frame.Y >= frameHeight * 4) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.ZoneSnow && - !spawnInfo.player.PillarZone() && - !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.InSunkenSea() && - Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.015f : 0f; + return spawnInfo.Player.ZoneSnow && + !spawnInfo.Player.PillarZone() && + !spawnInfo.Player.ZoneDungeon && + !spawnInfo.Player.InSunkenSea() && + Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.015f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -85,20 +85,20 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 92, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 92, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 92, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 92, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.5f); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.5f); } } } diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index c7ce9bf318..872a3f423a 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -10,51 +10,51 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Ebonian Blight Slime"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.aiStyle = 1; + NPC.aiStyle = 1; aiType = NPCID.DungeonSlime; - npc.damage = 30; - npc.width = 60; - npc.height = 42; - npc.defense = 8; - npc.lifeMax = 130; - npc.knockBackResist = 0.3f; + NPC.damage = 30; + NPC.width = 60; + NPC.height = 42; + NPC.defense = 8; + NPC.lifeMax = 130; + NPC.knockBackResist = 0.3f; animationType = NPCID.RainbowSlime; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.alpha = 105; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.alpha = 105; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 40; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hitDirection, -1f, 0, default, 1f); } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneAbyss) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneAbyss) { return 0f; } @@ -68,8 +68,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 15, 20); - DropHelper.DropItem(npc, ItemID.Gel, 10, 14); + DropHelper.DropItem(NPC, ModContent.ItemType(), 15, 20); + DropHelper.DropItem(NPC, ItemID.Gel, 10, 14); } } } diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index 02d28289e6..caf20786a8 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.NormalNPCs { @@ -18,43 +19,43 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Eidolist"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 0; - npc.width = 60; - npc.height = 80; - npc.lifeMax = 10000; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 1, 0, 0); - npc.Opacity = 0f; - npc.noGravity = true; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/EidolistDeath"); - npc.timeLeft = NPC.activeTime * 2; - banner = npc.type; + NPC.damage = 0; + NPC.width = 60; + NPC.height = 80; + NPC.lifeMax = 10000; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 1, 0, 0); + NPC.Opacity = 0f; + NPC.noGravity = true; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit13; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/EidolistDeath"); + NPC.timeLeft = NPC.activeTime * 2; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(hasBeenHit); - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() @@ -66,95 +67,95 @@ namespace CalamityMod.NPCs.NormalNPCs adultWyrmAlive = true; } - npc.Opacity += 0.15f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; + NPC.Opacity += 0.15f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; - Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0f, 0.4f, 0.5f); - if (npc.justHit || adultWyrmAlive) + Lighting.AddLight((int)(NPC.Center.X / 16f), (int)(NPC.Center.Y / 16f), 0f, 0.4f, 0.5f); + if (NPC.justHit || adultWyrmAlive) { hasBeenHit = true; } - npc.chaseable = hasBeenHit; + NPC.chaseable = hasBeenHit; if (!hasBeenHit) { - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; + NPC.netUpdate = true; } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.localAI[2] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.localAI[2] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.localAI[2] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.localAI[2] = 1f; } } - npc.velocity.X += npc.direction * 0.1f; - if (npc.velocity.X < -2f || npc.velocity.X > 2f) + NPC.velocity.X += NPC.direction * 0.1f; + if (NPC.velocity.X < -2f || NPC.velocity.X > 2f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.localAI[2] == -1f) + if (NPC.localAI[2] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if (npc.velocity.Y < -0.3f) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if (NPC.velocity.Y < -0.3f) { - npc.localAI[2] = 1f; + NPC.localAI[2] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if (npc.velocity.Y > 0.3f) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if (NPC.velocity.Y > 0.3f) { - npc.localAI[2] = -1f; + NPC.localAI[2] = -1f; } } - if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) + if (NPC.velocity.Y > 0.4f || NPC.velocity.Y < -0.4f) { - npc.velocity.Y *= 0.95f; + NPC.velocity.Y *= 0.95f; } return; } - npc.noTileCollide = true; + NPC.noTileCollide = true; float num1446 = adultWyrmAlive ? 14f : 7f; float num1447 = 480f; - if (npc.localAI[1] == 1f) + if (NPC.localAI[1] == 1f) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; if (Main.rand.NextBool(4)) { - npc.ai[0] = num1447; + NPC.ai[0] = num1447; } } - npc.TargetClosest(true); - npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.1f; - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); - Vector2 vector251 = Main.player[npc.target].Center - value53; - bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= Main.rand.Next(90, 601)) + NPC.TargetClosest(true); + NPC.rotation = Math.Abs(NPC.velocity.X) * (float)NPC.direction * 0.1f; + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + Vector2 value53 = NPC.Center + new Vector2((float)(NPC.direction * 20), 6f); + Vector2 vector251 = Main.player[NPC.target].Center - value53; + bool flag104 = Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1); + NPC.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= Main.rand.Next(90, 601)) { - npc.localAI[0] = -90f; - npc.netUpdate = true; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.localAI[0] = -90f; + NPC.netUpdate = true; + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { float speed = adultWyrmAlive ? 10f : 5f; - Vector2 vector = new Vector2(npc.Center.X, npc.Center.Y); - float xDist = Main.player[npc.target].Center.X - vector.X + Main.rand.NextFloat(-10f, 10f); - float yDist = Main.player[npc.target].Center.Y - vector.Y + Main.rand.NextFloat(-10f, 10f); + Vector2 vector = new Vector2(NPC.Center.X, NPC.Center.Y); + float xDist = Main.player[NPC.target].Center.X - vector.X + Main.rand.NextFloat(-10f, 10f); + float yDist = Main.player[NPC.target].Center.Y - vector.Y + Main.rand.NextFloat(-10f, 10f); Vector2 targetVec = new Vector2(yDist, yDist); float targetDist = targetVec.Length(); targetDist = speed / targetDist; @@ -163,20 +164,20 @@ namespace CalamityMod.NPCs.NormalNPCs int damage = adultWyrmAlive ? (Main.expertMode ? 150 : 200) : (Main.expertMode ? 30 : 40); if (Main.rand.NextBool(2)) { - Projectile.NewProjectile(npc.Center, targetVec, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.Center, targetVec, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); } else { - Vector2 vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); - vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center + Main.player[npc.target].velocity * 20f); + Vector2 vec = Vector2.Normalize(Main.player[NPC.target].Center - NPC.Center); + vec = Vector2.Normalize(Main.player[NPC.target].Center - NPC.Center + Main.player[NPC.target].velocity * 20f); if (vec.HasNaNs()) { - vec = new Vector2((float)npc.direction, 0f); + vec = new Vector2((float)NPC.direction, 0f); } for (int n = 0; n < 1; n++) { Vector2 vector4 = vec * 4f; - Projectile.NewProjectile(npc.Center, vector4, ProjectileID.CultistBossIceMist, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.Center, vector4, ProjectileID.CultistBossIceMist, damage, 0f, Main.myPlayer, 0f, 1f); } } } @@ -190,43 +191,43 @@ namespace CalamityMod.NPCs.NormalNPCs value54 *= num1446; } int num1448 = 30; - npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; + NPC.velocity = (NPC.velocity * (float)(num1448 - 1) + value54) / (float)num1448; } else { - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; } - if (npc.ai[2] != 0f && npc.ai[3] != 0f) + if (NPC.ai[2] != 0f && NPC.ai[3] != 0f) { - Main.PlaySound(SoundID.Item8, npc.Center); + SoundEngine.PlaySound(SoundID.Item8, NPC.Center); for (int num1449 = 0; num1449 < 20; num1449++) { - int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, 20, 0f, 0f, 100, Color.Transparent, 1f); + int num1450 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 20, 0f, 0f, 100, Color.Transparent, 1f); Dust dust = Main.dust[num1450]; dust.velocity *= 3f; dust.noGravity = true; dust.scale = 2.5f; } - npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); - npc.velocity = Vector2.Zero; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - Main.PlaySound(SoundID.Item8, npc.Center); + NPC.Center = new Vector2(NPC.ai[2] * 16f, NPC.ai[3] * 16f); + NPC.velocity = Vector2.Zero; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + SoundEngine.PlaySound(SoundID.Item8, NPC.Center); for (int num1451 = 0; num1451 < 20; num1451++) { - int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, 20, 0f, 0f, 100, Color.Transparent, 1f); + int num1452 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 20, 0f, 0f, 100, Color.Transparent, 1f); Dust dust = Main.dust[num1452]; dust.velocity *= 3f; dust.noGravity = true; dust.scale = 2.5f; } } - npc.ai[0] += 1f; - if (npc.ai[0] >= num1447 && Main.netMode != NetmodeID.MultiplayerClient) + NPC.ai[0] += 1f; + if (NPC.ai[0] >= num1447 && Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[0] = 0f; - Point point12 = npc.Center.ToTileCoordinates(); - Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); + NPC.ai[0] = 0f; + Point point12 = NPC.Center.ToTileCoordinates(); + Point point13 = Main.player[NPC.target].Center.ToTileCoordinates(); int num1453 = 20; int num1454 = 3; int num1455 = 10; @@ -255,13 +256,13 @@ namespace CalamityMod.NPCs.NormalNPCs } if (flag107) { - npc.ai[2] = (float)num1458; - npc.ai[3] = (float)num1459; + NPC.ai[2] = (float)num1458; + NPC.ai[3] = (float)num1459; break; } } } - npc.netUpdate = true; + NPC.netUpdate = true; } } @@ -276,10 +277,10 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - npc.frameCounter += hasBeenHit ? 0.15f : 0.075f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += hasBeenHit ? 0.15f : 0.075f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -288,7 +289,7 @@ namespace CalamityMod.NPCs.NormalNPCs { return 0f; } - if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) { return 0.05f; } @@ -299,18 +300,18 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EidiolistGores/Eidolist"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EidiolistGores/Eidolist2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EidiolistGores/Eidolist3"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EidiolistGores/Eidolist4"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/EidiolistGores/Eidolist"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/EidiolistGores/Eidolist2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/EidiolistGores/Eidolist3"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/EidiolistGores/Eidolist4"), NPC.scale); } } @@ -330,14 +331,14 @@ namespace CalamityMod.NPCs.NormalNPCs { if (Main.rand.NextBool(10)) { - DropHelper.DropItem(npc, ItemID.BlueLunaticHood); - DropHelper.DropItem(npc, ItemID.BlueLunaticRobe); + DropHelper.DropItem(NPC, ItemID.BlueLunaticHood); + DropHelper.DropItem(NPC, ItemID.BlueLunaticRobe); } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !NPC.LunarApocalypseIsUp, 0.25f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !NPC.LunarApocalypseIsUp, 0.25f); int minLumenyl = Main.expertMode ? 10 : 8; int maxLumenyl = Main.expertMode ? 14 : 10; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1f, minLumenyl, maxLumenyl); - DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1f, 3, 5); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1f, minLumenyl, maxLumenyl); + DropHelper.DropItemCondition(NPC, ItemID.Ectoplasm, NPC.downedPlantBoss, 1f, 3, 5); } } } diff --git a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index b5245f1d8d..3bb6c66cf4 100644 --- a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs +++ b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs @@ -15,162 +15,162 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Fearless Goldfish Warrior"); - Main.npcFrameCount[npc.type] = 10; + Main.npcFrameCount[NPC.type] = 10; } public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.damage = Main.hardMode ? 100 : 30; - npc.width = 36; - npc.height = 32; - npc.defense = Main.hardMode ? 10 : 2; - npc.lifeMax = Main.hardMode ? 150 : 50; - npc.knockBackResist = Main.hardMode ? 0.2f : 0.5f; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.damage = Main.hardMode ? 100 : 30; + NPC.width = 36; + NPC.height = 32; + NPC.defense = Main.hardMode ? 10 : 2; + NPC.lifeMax = Main.hardMode ? 150 : 50; + NPC.knockBackResist = Main.hardMode ? 0.2f : 0.5f; + NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { bool flag3 = false; - if (npc.velocity.X == 0f) + if (NPC.velocity.X == 0f) { flag3 = true; } - if (npc.justHit) + if (NPC.justHit) { flag3 = false; } bool flag4 = false; bool flag5 = false; int num35 = 60; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + if (NPC.velocity.Y == 0f && ((NPC.velocity.X > 0f && NPC.direction < 0) || (NPC.velocity.X < 0f && NPC.direction > 0))) { flag4 = true; } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num35) | flag4) + if ((NPC.position.X == NPC.oldPosition.X || NPC.ai[3] >= (float)num35) | flag4) { - npc.ai[3] += 1f; + NPC.ai[3] += 1f; } - else if ((double)Math.Abs(npc.velocity.X) > 0.9 && npc.ai[3] > 0f) + else if ((double)Math.Abs(NPC.velocity.X) > 0.9 && NPC.ai[3] > 0f) { - npc.ai[3] -= 1f; + NPC.ai[3] -= 1f; } - if (npc.ai[3] > (float)(num35 * 10)) + if (NPC.ai[3] > (float)(num35 * 10)) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; } - if (npc.justHit) + if (NPC.justHit) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; } - if (npc.ai[3] == (float)num35) + if (NPC.ai[3] == (float)num35) { - npc.netUpdate = true; + NPC.netUpdate = true; } - if (npc.ai[3] < (float)num35) + if (NPC.ai[3] < (float)num35) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - else if (npc.ai[2] <= 0f) + else if (NPC.ai[2] <= 0f) { - if (npc.velocity.X == 0f) + if (NPC.velocity.X == 0f) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) + NPC.ai[0] += 1f; + if (NPC.ai[0] >= 2f) { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; + NPC.direction *= -1; + NPC.spriteDirection = NPC.direction; + NPC.ai[0] = 0f; } } } else { - npc.ai[0] = 0f; + NPC.ai[0] = 0f; } - if (npc.direction == 0) + if (NPC.direction == 0) { - npc.direction = 1; + NPC.direction = 1; } } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 18f) + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) < 18f) { - npc.ai[3] = 0f; - npc.velocity.X = npc.velocity.X * 0.9f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; + NPC.ai[3] = 0f; + NPC.velocity.X = NPC.velocity.X * 0.9f; + if ((double)NPC.velocity.X > -0.1 && (double)NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; return; } float num65 = CalamityWorld.death ? 3f : 1f; float num66 = CalamityWorld.death ? 0.28f : 0.08f; if (!CalamityWorld.death) { - num65 += (1f - (float)npc.life / (float)npc.lifeMax) * 2f; - num66 += (1f - (float)npc.life / (float)npc.lifeMax) * 0.2f; + num65 += (1f - (float)NPC.life / (float)NPC.lifeMax) * 2f; + num66 += (1f - (float)NPC.life / (float)NPC.lifeMax) * 0.2f; } - if (npc.velocity.X < -num65 || npc.velocity.X > num65) + if (NPC.velocity.X < -num65 || NPC.velocity.X > num65) { - if (npc.velocity.Y == 0f) - npc.velocity *= 0.7f; + if (NPC.velocity.Y == 0f) + NPC.velocity *= 0.7f; } - else if (npc.velocity.X < num65 && npc.direction == 1) + else if (NPC.velocity.X < num65 && NPC.direction == 1) { - npc.velocity.X = npc.velocity.X + num66; - if (npc.velocity.X > num65) - npc.velocity.X = num65; + NPC.velocity.X = NPC.velocity.X + num66; + if (NPC.velocity.X > num65) + NPC.velocity.X = num65; } - else if (npc.velocity.X > -num65 && npc.direction == -1) + else if (NPC.velocity.X > -num65 && NPC.direction == -1) { - npc.velocity.X = npc.velocity.X - num66; - if (npc.velocity.X < -num65) - npc.velocity.X = -num65; + NPC.velocity.X = NPC.velocity.X - num66; + if (NPC.velocity.X < -num65) + NPC.velocity.X = -num65; } bool flag22 = false; - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - int num161 = (int)(npc.position.Y + (float)npc.height + 7f) / 16; - int arg_A8FB_0 = (int)npc.position.X / 16; - int num162 = (int)(npc.position.X + (float)npc.width) / 16; + int num161 = (int)(NPC.position.Y + (float)NPC.height + 7f) / 16; + int arg_A8FB_0 = (int)NPC.position.X / 16; + int num162 = (int)(NPC.position.X + (float)NPC.width) / 16; for (int num163 = arg_A8FB_0; num163 <= num162; num163++) { if (Main.tile[num163, num161] == null) { return; } - if (Main.tile[num163, num161].nactive() && Main.tileSolid[(int)Main.tile[num163, num161].type]) + if (Main.tile[num163, num161].nactive() && Main.tileSolid[(int)Main.tile[num163, num161].TileType]) { flag22 = true; break; } } } - if (npc.velocity.Y >= 0f) + if (NPC.velocity.Y >= 0f) { int num164 = 0; - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { num164 = -1; } - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { num164 = 1; } - Vector2 position2 = npc.position; - position2.X += npc.velocity.X; - int num165 = (int)((position2.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num164)) / 16f); - int num166 = (int)((position2.Y + (float)npc.height - 1f) / 16f); + Vector2 position2 = NPC.position; + position2.X += NPC.velocity.X; + int num165 = (int)((position2.X + (float)(NPC.width / 2) + (float)((NPC.width / 2 + 1) * num164)) / 16f); + int num166 = (int)((position2.Y + (float)NPC.height - 1f) / 16f); if (Main.tile[num165, num166] == null) { Main.tile[num165, num166] = new Tile(); @@ -195,7 +195,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Main.tile[num165 - num164, num166 - 3] = new Tile(); } - if ((float)(num165 * 16) < position2.X + (float)npc.width && (float)(num165 * 16 + 16) > position2.X && ((Main.tile[num165, num166].nactive() && !Main.tile[num165, num166].topSlope() && !Main.tile[num165, num166 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num165, num166].type] && !Main.tileSolidTop[(int)Main.tile[num165, num166].type]) || (Main.tile[num165, num166 - 1].halfBrick() && Main.tile[num165, num166 - 1].nactive())) && (!Main.tile[num165, num166 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 1].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 1].type] || (Main.tile[num165, num166 - 1].halfBrick() && (!Main.tile[num165, num166 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 4].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 4].type]))) && (!Main.tile[num165, num166 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 2].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 2].type]) && (!Main.tile[num165, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 3].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 3].type]) && (!Main.tile[num165 - num164, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165 - num164, num166 - 3].type])) + if ((float)(num165 * 16) < position2.X + (float)NPC.width && (float)(num165 * 16 + 16) > position2.X && ((Main.tile[num165, num166].nactive() && !Main.tile[num165, num166].topSlope() && !Main.tile[num165, num166 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num165, num166].TileType] && !Main.tileSolidTop[(int)Main.tile[num165, num166].TileType]) || (Main.tile[num165, num166 - 1].halfBrick() && Main.tile[num165, num166 - 1].nactive())) && (!Main.tile[num165, num166 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 1].TileType] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 1].TileType] || (Main.tile[num165, num166 - 1].halfBrick() && (!Main.tile[num165, num166 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 4].TileType] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 4].TileType]))) && (!Main.tile[num165, num166 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 2].TileType] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 2].TileType]) && (!Main.tile[num165, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 3].TileType] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 3].TileType]) && (!Main.tile[num165 - num164, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165 - num164, num166 - 3].TileType])) { float num167 = (float)(num166 * 16); if (Main.tile[num165, num166].halfBrick()) @@ -206,21 +206,21 @@ namespace CalamityMod.NPCs.NormalNPCs { num167 -= 8f; } - if (num167 < position2.Y + (float)npc.height) + if (num167 < position2.Y + (float)NPC.height) { - float num168 = position2.Y + (float)npc.height - num167; + float num168 = position2.Y + (float)NPC.height - num167; float num169 = 16.1f; if (num168 <= num169) { - npc.gfxOffY += npc.position.Y + (float)npc.height - num167; - npc.position.Y = num167 - (float)npc.height; + NPC.gfxOffY += NPC.position.Y + (float)NPC.height - num167; + NPC.position.Y = num167 - (float)NPC.height; if (num168 < 9f) { - npc.stepSpeed = 1f; + NPC.stepSpeed = 1f; } else { - npc.stepSpeed = 2f; + NPC.stepSpeed = 2f; } } } @@ -228,8 +228,8 @@ namespace CalamityMod.NPCs.NormalNPCs } if (flag22) { - int num170 = (int)((npc.position.X + (float)(npc.width / 2) + (float)(15 * npc.direction)) / 16f); - int num171 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + int num170 = (int)((NPC.position.X + (float)(NPC.width / 2) + (float)(15 * NPC.direction)) / 16f); + int num171 = (int)((NPC.position.Y + (float)NPC.height - 15f) / 16f); if (Main.tile[num170, num171] == null) { Main.tile[num170, num171] = new Tile(); @@ -250,62 +250,62 @@ namespace CalamityMod.NPCs.NormalNPCs { Main.tile[num170, num171 + 1] = new Tile(); } - if (Main.tile[num170 + npc.direction, num171 - 1] == null) + if (Main.tile[num170 + NPC.direction, num171 - 1] == null) { - Main.tile[num170 + npc.direction, num171 - 1] = new Tile(); + Main.tile[num170 + NPC.direction, num171 - 1] = new Tile(); } - if (Main.tile[num170 + npc.direction, num171 + 1] == null) + if (Main.tile[num170 + NPC.direction, num171 + 1] == null) { - Main.tile[num170 + npc.direction, num171 + 1] = new Tile(); + Main.tile[num170 + NPC.direction, num171 + 1] = new Tile(); } - if (Main.tile[num170 - npc.direction, num171 + 1] == null) + if (Main.tile[num170 - NPC.direction, num171 + 1] == null) { - Main.tile[num170 - npc.direction, num171 + 1] = new Tile(); + Main.tile[num170 - NPC.direction, num171 + 1] = new Tile(); } Main.tile[num170, num171 + 1].halfBrick(); - if ((Main.tile[num170, num171 - 1].nactive() && (Main.tile[num170, num171 - 1].type == 10 || Main.tile[num170, num171 - 1].type == 388)) & flag5) + if ((Main.tile[num170, num171 - 1].nactive() && (Main.tile[num170, num171 - 1].TileType == 10 || Main.tile[num170, num171 - 1].TileType == 388)) & flag5) { - npc.ai[2] += 1f; - npc.ai[3] = 0f; - if (npc.ai[2] >= 60f) + NPC.ai[2] += 1f; + NPC.ai[3] = 0f; + if (NPC.ai[2] >= 60f) { - npc.velocity.X = 0.5f * (float)-(float)npc.direction; + NPC.velocity.X = 0.5f * (float)-(float)NPC.direction; int num172 = 5; - if (Main.tile[num170, num171 - 1].type == 388) + if (Main.tile[num170, num171 - 1].TileType == 388) { num172 = 2; } - npc.ai[1] += (float)num172; - npc.ai[2] = 0f; + NPC.ai[1] += (float)num172; + NPC.ai[2] = 0f; bool flag23 = false; - if (npc.ai[1] >= 10f) + if (NPC.ai[1] >= 10f) { flag23 = true; - npc.ai[1] = 10f; + NPC.ai[1] = 10f; } WorldGen.KillTile(num170, num171 - 1, true, false, false); if ((Main.netMode != NetmodeID.MultiplayerClient || !flag23) && flag23 && Main.netMode != NetmodeID.MultiplayerClient) { - if (Main.tile[num170, num171 - 1].type == 10) + if (Main.tile[num170, num171 - 1].TileType == 10) { - bool flag24 = WorldGen.OpenDoor(num170, num171 - 1, npc.direction); + bool flag24 = WorldGen.OpenDoor(num170, num171 - 1, NPC.direction); if (!flag24) { - npc.ai[3] = (float)num35; - npc.netUpdate = true; + NPC.ai[3] = (float)num35; + NPC.netUpdate = true; } if (Main.netMode == NetmodeID.Server & flag24) { - NetMessage.SendData(MessageID.ChangeDoor, -1, -1, null, 0, (float)num170, (float)(num171 - 1), (float)npc.direction, 0, 0, 0); + NetMessage.SendData(MessageID.ChangeDoor, -1, -1, null, 0, (float)num170, (float)(num171 - 1), (float)NPC.direction, 0, 0, 0); } } - if (Main.tile[num170, num171 - 1].type == 388) + if (Main.tile[num170, num171 - 1].TileType == 388) { bool flag25 = WorldGen.ShiftTallGate(num170, num171 - 1, false); if (!flag25) { - npc.ai[3] = (float)num35; - npc.netUpdate = true; + NPC.ai[3] = (float)num35; + NPC.netUpdate = true; } if (Main.netMode == NetmodeID.Server & flag25) { @@ -317,109 +317,109 @@ namespace CalamityMod.NPCs.NormalNPCs } else { - int num173 = npc.spriteDirection; - if ((npc.velocity.X < 0f && num173 == -1) || (npc.velocity.X > 0f && num173 == 1)) + int num173 = NPC.spriteDirection; + if ((NPC.velocity.X < 0f && num173 == -1) || (NPC.velocity.X > 0f && num173 == 1)) { - if (npc.height >= 32 && Main.tile[num170, num171 - 2].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 2].type]) + if (NPC.height >= 32 && Main.tile[num170, num171 - 2].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 2].TileType]) { - if (Main.tile[num170, num171 - 3].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 3].type]) + if (Main.tile[num170, num171 - 3].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 3].TileType]) { - npc.velocity.Y = -8f; - npc.netUpdate = true; + NPC.velocity.Y = -8f; + NPC.netUpdate = true; } else { - npc.velocity.Y = -7f; - npc.netUpdate = true; + NPC.velocity.Y = -7f; + NPC.netUpdate = true; } } - else if (Main.tile[num170, num171 - 1].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 1].type]) + else if (Main.tile[num170, num171 - 1].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 1].TileType]) { - npc.velocity.Y = -6f; - npc.netUpdate = true; + NPC.velocity.Y = -6f; + NPC.netUpdate = true; } - else if (npc.position.Y + (float)npc.height - (float)(num171 * 16) > 20f && Main.tile[num170, num171].nactive() && !Main.tile[num170, num171].topSlope() && Main.tileSolid[(int)Main.tile[num170, num171].type]) + else if (NPC.position.Y + (float)NPC.height - (float)(num171 * 16) > 20f && Main.tile[num170, num171].nactive() && !Main.tile[num170, num171].topSlope() && Main.tileSolid[(int)Main.tile[num170, num171].TileType]) { - npc.velocity.Y = -5f; - npc.netUpdate = true; + NPC.velocity.Y = -5f; + NPC.netUpdate = true; } - else if (npc.directionY < 0 && (!Main.tile[num170, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170, num171 + 1].type]) && (!Main.tile[num170 + npc.direction, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170 + npc.direction, num171 + 1].type])) + else if (NPC.directionY < 0 && (!Main.tile[num170, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170, num171 + 1].TileType]) && (!Main.tile[num170 + NPC.direction, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170 + NPC.direction, num171 + 1].TileType])) { - npc.velocity.Y = -8f; - npc.velocity.X = npc.velocity.X * 1.5f; - npc.netUpdate = true; + NPC.velocity.Y = -8f; + NPC.velocity.X = NPC.velocity.X * 1.5f; + NPC.netUpdate = true; } else if (flag5) { - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } - if ((npc.velocity.Y == 0f & flag3) && npc.ai[3] == 1f) + if ((NPC.velocity.Y == 0f & flag3) && NPC.ai[3] == 1f) { - npc.velocity.Y = -5f; + NPC.velocity.Y = -5f; } } } } else if (flag5) { - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } } public override void FindFrame(int frameHeight) { - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 18f) + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) < 18f) { - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 6.0) { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; } - if (npc.frame.Y < frameHeight * 5) - npc.frame.Y = frameHeight * 5; - if (npc.frame.Y > frameHeight * 9) - npc.frame.Y = frameHeight * 5; + if (NPC.frame.Y < frameHeight * 5) + NPC.frame.Y = frameHeight * 5; + if (NPC.frame.Y > frameHeight * 9) + NPC.frame.Y = frameHeight * 5; } else { - npc.frameCounter += (double)Math.Abs(npc.velocity.X); - if (npc.frameCounter > 6.0) + NPC.frameCounter += (double)Math.Abs(NPC.velocity.X); + if (NPC.frameCounter > 6.0) { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; } - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - if (npc.direction == 1) - npc.spriteDirection = 1; - if (npc.direction == -1) - npc.spriteDirection = -1; + if (NPC.direction == 1) + NPC.spriteDirection = 1; + if (NPC.direction == -1) + NPC.spriteDirection = -1; } else { - npc.frameCounter = 0.0; - npc.frame.Y = frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y = frameHeight; return; } - if (npc.velocity.X == 0f) + if (NPC.velocity.X == 0f) { - npc.frameCounter = 0.0; - npc.frame.Y = 0; + NPC.frameCounter = 0.0; + NPC.frame.Y = 0; } else { - if (npc.frame.Y > frameHeight * 4) - npc.frame.Y = 0; + if (NPC.frame.Y > frameHeight * 4) + NPC.frame.Y = 0; } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.raining || spawnInfo.player.Calamity().ZoneSulphur) + if (spawnInfo.playerSafe || !Main.raining || spawnInfo.Player.Calamity().ZoneSulphur) { return 0f; } @@ -430,13 +430,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } @@ -461,8 +461,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItem(npc, ItemID.TinHelmet); - DropHelper.DropItemCondition(npc, ItemID.MagicDagger, Main.hardMode); + DropHelper.DropItem(NPC, ItemID.TinHelmet); + DropHelper.DropItemCondition(NPC, ItemID.MagicDagger, Main.hardMode); } } } diff --git a/NPCs/NormalNPCs/Frogfish.cs b/NPCs/NormalNPCs/Frogfish.cs index fe5d9be700..238011723a 100644 --- a/NPCs/NormalNPCs/Frogfish.cs +++ b/NPCs/NormalNPCs/Frogfish.cs @@ -11,74 +11,74 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Frogfish"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.chaseable = false; - npc.damage = 25; - npc.width = 60; - npc.height = 50; - npc.defense = 10; - npc.lifeMax = 80; - npc.aiStyle = -1; + NPC.chaseable = false; + NPC.damage = 25; + NPC.width = 60; + NPC.height = 50; + NPC.defense = 10; + NPC.lifeMax = 80; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.5f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 0, 80); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.5f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.chaseable = false; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; int num = 200; - if (npc.ai[2] == 0f) + if (NPC.ai[2] == 0f) { - npc.alpha = num; - npc.TargetClosest(true); - if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.alpha = num; + NPC.TargetClosest(true); + if (!Main.player[NPC.target].dead && (Main.player[NPC.target].Center - NPC.Center).Length() < 170f && + Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - npc.ai[2] = -16f; + NPC.ai[2] = -16f; } - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit) + if (NPC.velocity.X != 0f || NPC.velocity.Y < 0f || NPC.velocity.Y > 2f || NPC.justHit) { - npc.ai[2] = -16f; + NPC.ai[2] = -16f; } return; } - if (npc.ai[2] < 0f) + if (NPC.ai[2] < 0f) { - if (npc.alpha > 0) + if (NPC.alpha > 0) { - npc.alpha -= num / 16; - if (npc.alpha < 0) + NPC.alpha -= num / 16; + if (NPC.alpha < 0) { - npc.alpha = 0; + NPC.alpha = 0; } } - npc.ai[2] += 1f; - if (npc.ai[2] == 0f) + NPC.ai[2] += 1f; + if (NPC.ai[2] == 0f) { - npc.ai[2] = 1f; - npc.velocity.X = (float)(npc.direction * 2); + NPC.ai[2] = 1f; + NPC.velocity.X = (float)(NPC.direction * 2); } return; } - npc.alpha = 0; - if (npc.ai[2] == 1f) + NPC.alpha = 0; + if (NPC.ai[2] == 1f) { - npc.chaseable = true; - CalamityAI.PassiveSwimmingAI(npc, mod, 0, 0f, 0.15f, 0.15f, 3.5f, 1.5f, 0.1f); + NPC.chaseable = true; + CalamityAI.PassiveSwimmingAI(NPC, Mod, 0, 0f, 0.15f, 0.15f, 3.5f, 1.5f, 0.1f); } } @@ -89,20 +89,20 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - if (!npc.wet) + if (!NPC.wet) { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; return; } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur) { return 0f; } @@ -111,20 +111,20 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 1); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 2, 1, 1); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index 4f1c96d07e..a6cc8b8fb7 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -9,6 +9,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.NormalNPCs { public class Horse : ModNPC @@ -16,48 +17,48 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Earth Elemental"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 3f; - npc.damage = 50; - npc.width = 230; - npc.height = 230; - npc.defense = 20; - npc.DR_NERD(0.1f); - npc.lifeMax = 3800; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 3f; + NPC.damage = 50; + NPC.width = 230; + NPC.height = 230; + NPC.defense = 20; + NPC.DR_NERD(0.1f); + NPC.lifeMax = 3800; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 1, 50, 0); - npc.dontTakeDamage = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.rarity = 2; - banner = npc.type; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 1, 50, 0); + NPC.dontTakeDamage = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.rarity = 2; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea || NPC.AnyNPCs(npc.type)) + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.Player.Calamity().ZoneAbyss || + spawnInfo.Player.Calamity().ZoneSunkenSea || NPC.AnyNPCs(NPC.type)) { return 0f; } @@ -66,14 +67,14 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) return; - npc.frameCounter++; - if (npc.frameCounter >= 8) + NPC.frameCounter++; + if (NPC.frameCounter >= 8) { - npc.frame.Y = (npc.frame.Y + frameHeight) % (Main.npcFrameCount[npc.type] * frameHeight); - npc.frameCounter = 0; + NPC.frame.Y = (NPC.frame.Y + frameHeight) % (Main.npcFrameCount[NPC.type] * frameHeight); + NPC.frameCounter = 0; } } @@ -81,7 +82,7 @@ namespace CalamityMod.NPCs.NormalNPCs { // Weapons float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w) @@ -92,20 +93,20 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 31, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 31, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Main.PlaySound(SoundID.Item14, npc.position); - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 160; - npc.height = 160; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + SoundEngine.PlaySound(SoundID.Item14, NPC.position); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 160; + NPC.height = 160; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -115,63 +116,63 @@ namespace CalamityMod.NPCs.NormalNPCs } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Fire, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Fire, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Fire, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(npc.Center, 3); + CalamityUtils.ExplosionGores(NPC.Center, 3); } } public override bool PreAI() { // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); - if (Vector2.Distance(npc.Center, Main.player[npc.target].Center) < 480f) + if (Vector2.Distance(NPC.Center, Main.player[NPC.target].Center) < 480f) { - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.ai[0] = 1f; - npc.dontTakeDamage = false; + NPC.ai[0] = 1f; + NPC.dontTakeDamage = false; } } else - npc.TargetClosest(); + NPC.TargetClosest(); - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) return false; - if (Main.player[npc.target].dead || !Main.player[npc.target].active) + if (Main.player[NPC.target].dead || !Main.player[NPC.target].active) { - if (npc.velocity.Y < -2f) - npc.velocity.Y = -2f; - npc.velocity.Y += 0.1f; - if (npc.velocity.Y > 12f) - npc.velocity.Y = 12f; + if (NPC.velocity.Y < -2f) + NPC.velocity.Y = -2f; + NPC.velocity.Y += 0.1f; + if (NPC.velocity.Y > 12f) + NPC.velocity.Y = 12f; - if (npc.timeLeft > 60) - npc.timeLeft = 60; + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; } if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 300f) + NPC.localAI[0] += 1f; + if (NPC.localAI[0] >= 300f) { - npc.localAI[0] = 0f; - Main.PlaySound(SoundID.NPCHit43, npc.Center); - npc.TargetClosest(); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.localAI[0] = 0f; + SoundEngine.PlaySound(SoundID.NPCHit43, NPC.Center); + NPC.TargetClosest(); + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { float num179 = 4f; - Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - value9.X; + Vector2 value9 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num180 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - value9.Y - num181; + float num182 = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - value9.Y - num181; float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num179 / num183; num180 *= num183; @@ -183,8 +184,8 @@ namespace CalamityMod.NPCs.NormalNPCs for (int num186 = 0; num186 < 4; num186++) { num185 = Main.rand.NextBool(4) ? ModContent.ProjectileType() : ModContent.ProjectileType(); - num180 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - value9.Y; + num180 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - value9.X; + num182 = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - value9.Y; num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num179 / num183; num180 += Main.rand.Next(-40, 41); @@ -197,25 +198,25 @@ namespace CalamityMod.NPCs.NormalNPCs } } - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + float playerLocation = NPC.Center.X - Main.player[NPC.target].Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; - Vector2 direction = Main.player[npc.target].Center - npc.Center; + Vector2 direction = Main.player[NPC.target].Center - NPC.Center; direction.Normalize(); - npc.ai[1] += Main.expertMode ? 2f : 1f; - if (npc.ai[1] >= 600f) + NPC.ai[1] += Main.expertMode ? 2f : 1f; + if (NPC.ai[1] >= 600f) { direction *= 6f; - npc.velocity = direction; - npc.ai[1] = 0f; + NPC.velocity = direction; + NPC.ai[1] = 0f; } - if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) > 1) - npc.velocity *= 0.985f; + if (Math.Sqrt((NPC.velocity.X * NPC.velocity.X) + (NPC.velocity.Y * NPC.velocity.Y)) > 1) + NPC.velocity *= 0.985f; - if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) <= 1 * 1.15) - npc.velocity = direction * 1; + if (Math.Sqrt((NPC.velocity.X * NPC.velocity.X) + (NPC.velocity.Y * NPC.velocity.Y)) <= 1 * 1.15) + NPC.velocity = direction * 1; return false; } diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index fdbb32acfd..dfae9dc332 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -15,40 +15,40 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Ice Clasper"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.npcSlots = 3f; - npc.noGravity = true; - npc.damage = 32; - npc.width = 40; - npc.height = 40; - npc.defense = 12; - npc.lifeMax = 600; - npc.knockBackResist = 0.35f; - npc.aiStyle = -1; + NPC.npcSlots = 3f; + NPC.noGravity = true; + NPC.damage = 32; + NPC.width = 40; + NPC.height = 40; + NPC.defense = 12; + NPC.lifeMax = 600; + NPC.knockBackResist = 0.35f; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 25, 0); - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - npc.coldDamage = true; - npc.rarity = 2; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 25, 0); + NPC.HitSound = SoundID.NPCHit5; + NPC.DeathSound = SoundID.NPCDeath7; + NPC.coldDamage = true; + NPC.rarity = 2; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.coldDamage = true; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = false; - npc.Calamity().VulnerableToSickness = false; + NPC.coldDamage = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = false; + NPC.Calamity().VulnerableToSickness = false; } public override void AI() { bool revenge = CalamityWorld.revenge; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } float num = revenge ? 7f : 6f; float num2 = revenge ? 0.07f : 0.06f; @@ -57,9 +57,9 @@ namespace CalamityMod.NPCs.NormalNPCs num *= 1.5f; num2 *= 1.5f; } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num4 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num5 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num4 = (float)((int)(num4 / 8f) * 8); num5 = (float)((int)(num5 / 8f) * 8); vector.X = (float)((int)(vector.X / 8f) * 8); @@ -75,8 +75,8 @@ namespace CalamityMod.NPCs.NormalNPCs } if (num6 == 0f) { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; + num4 = NPC.velocity.X; + num5 = NPC.velocity.Y; } else { @@ -86,164 +86,164 @@ namespace CalamityMod.NPCs.NormalNPCs } if (num7 > 100f) { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) + NPC.ai[0] += 1f; + if (NPC.ai[0] > 0f) { - npc.velocity.Y = npc.velocity.Y + 0.023f; + NPC.velocity.Y = NPC.velocity.Y + 0.023f; } else { - npc.velocity.Y = npc.velocity.Y - 0.023f; + NPC.velocity.Y = NPC.velocity.Y - 0.023f; } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) + if (NPC.ai[0] < -100f || NPC.ai[0] > 100f) { - npc.velocity.X = npc.velocity.X + 0.023f; + NPC.velocity.X = NPC.velocity.X + 0.023f; } else { - npc.velocity.X = npc.velocity.X - 0.023f; + NPC.velocity.X = NPC.velocity.X - 0.023f; } - if (npc.ai[0] > 200f) + if (NPC.ai[0] > 200f) { - npc.ai[0] = -200f; + NPC.ai[0] = -200f; } } - if (Main.player[npc.target].dead) + if (Main.player[NPC.target].dead) { - num4 = (float)npc.direction * num / 2f; + num4 = (float)NPC.direction * num / 2f; num5 = -num / 2f; } - if (npc.velocity.X < num4) + if (NPC.velocity.X < num4) { - npc.velocity.X = npc.velocity.X + num2; + NPC.velocity.X = NPC.velocity.X + num2; } - else if (npc.velocity.X > num4) + else if (NPC.velocity.X > num4) { - npc.velocity.X = npc.velocity.X - num2; + NPC.velocity.X = NPC.velocity.X - num2; } - if (npc.velocity.Y < num5) + if (NPC.velocity.Y < num5) { - npc.velocity.Y = npc.velocity.Y + num2; + NPC.velocity.Y = NPC.velocity.Y + num2; } - else if (npc.velocity.Y > num5) + else if (NPC.velocity.Y > num5) { - npc.velocity.Y = npc.velocity.Y - num2; + NPC.velocity.Y = NPC.velocity.Y - num2; } - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 150f) + NPC.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= 150f) { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.localAI[0] = 0f; + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { int num9 = ProjectileID.FrostBlastHostile; int beam = Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, 45, 0f, Main.myPlayer, 0f, 0f); Main.projectile[beam].timeLeft = 300; } } - int num10 = (int)npc.position.X + npc.width / 2; - int num11 = (int)npc.position.Y + npc.height / 2; + int num10 = (int)NPC.position.X + NPC.width / 2; + int num11 = (int)NPC.position.Y + NPC.height / 2; num10 /= 16; num11 /= 16; if (!WorldGen.SolidTile(num10, num11)) { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.6f, 0.75f); + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0f, 0.6f, 0.75f); } - Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); - float num740 = Main.player[npc.target].Center.X - vector92.X; - float num741 = Main.player[npc.target].Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + Vector2 vector92 = new Vector2(NPC.Center.X, NPC.Center.Y); + float num740 = Main.player[NPC.target].Center.X - vector92.X; + float num741 = Main.player[NPC.target].Center.Y - vector92.Y; + NPC.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - if (npc.ai[2] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (NPC.ai[2] > 0f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.ai[2] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[2] = 0f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[2] == 0f) + else if (NPC.ai[2] == 0f) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } - if (npc.ai[1] >= 150f) + if (NPC.ai[1] >= 150f) { - npc.ai[2] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[2] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } - if (npc.ai[2] == 0f) + if (NPC.ai[2] == 0f) { - npc.alpha = 0; - npc.noTileCollide = false; + NPC.alpha = 0; + NPC.noTileCollide = false; } else { - npc.wet = false; - npc.alpha = 200; - npc.noTileCollide = true; + NPC.wet = false; + NPC.alpha = 200; + NPC.noTileCollide = true; } float num12 = 0.7f; - if (npc.collideX) + if (NPC.collideX) { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num12; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + NPC.netUpdate = true; + NPC.velocity.X = NPC.oldVelocity.X * -num12; + if (NPC.direction == -1 && NPC.velocity.X > 0f && NPC.velocity.X < 2f) { - npc.velocity.X = 2f; + NPC.velocity.X = 2f; } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + if (NPC.direction == 1 && NPC.velocity.X < 0f && NPC.velocity.X > -2f) { - npc.velocity.X = -2f; + NPC.velocity.X = -2f; } } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + NPC.netUpdate = true; + NPC.velocity.Y = NPC.oldVelocity.Y * -num12; + if (NPC.velocity.Y > 0f && (double)NPC.velocity.Y < 1.5) { - npc.velocity.Y = 2f; + NPC.velocity.Y = 2f; } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + if (NPC.velocity.Y < 0f && (double)NPC.velocity.Y > -1.5) { - npc.velocity.Y = -2f; + NPC.velocity.Y = -2f; } } if (flag) { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) + if ((NPC.velocity.X > 0f && num4 > 0f) || (NPC.velocity.X < 0f && num4 < 0f)) { - if (Math.Abs(npc.velocity.X) < 12f) + if (Math.Abs(NPC.velocity.X) < 12f) { - npc.velocity.X = npc.velocity.X * 1.05f; + NPC.velocity.X = NPC.velocity.X * 1.05f; } } else { - npc.velocity.X = npc.velocity.X * 0.9f; + NPC.velocity.X = NPC.velocity.X * 0.9f; } } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) { - npc.netUpdate = true; + NPC.netUpdate = true; } } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.ZoneSnow && - !spawnInfo.player.PillarZone() && - !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.InSunkenSea() && - Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.007f : 0f; + return spawnInfo.Player.ZoneSnow && + !spawnInfo.Player.PillarZone() && + !spawnInfo.Player.ZoneDungeon && + !spawnInfo.Player.InSunkenSea() && + Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.007f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -256,22 +256,22 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 92, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 92, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 92, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 92, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3); } } } diff --git a/NPCs/NormalNPCs/IceMass.cs b/NPCs/NormalNPCs/IceMass.cs index 8760dc4ae1..f991f41043 100644 --- a/NPCs/NormalNPCs/IceMass.cs +++ b/NPCs/NormalNPCs/IceMass.cs @@ -11,25 +11,25 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Aurora Spirit"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.aiStyle = 86; - npc.damage = 40; - npc.width = 40; - npc.height = 24; - npc.defense = 8; - npc.alpha = 100; - npc.lifeMax = 50; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.knockBackResist = 0f; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath15; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = false; - npc.Calamity().VulnerableToSickness = false; + NPC.aiStyle = 86; + NPC.damage = 40; + NPC.width = 40; + NPC.height = 24; + NPC.defense = 8; + NPC.alpha = 100; + NPC.lifeMax = 50; + NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.knockBackResist = 0f; + NPC.HitSound = SoundID.NPCHit5; + NPC.DeathSound = SoundID.NPCDeath15; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = false; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) @@ -37,37 +37,37 @@ namespace CalamityMod.NPCs.NormalNPCs int num1 = 1; if (!Main.dedServ) { - if (!Main.NPCLoaded[npc.type] || Main.npcTexture[npc.type] == null) + if (!Main.NPCLoaded[NPC.type] || Main.npcTexture[NPC.type] == null) return; - num1 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + num1 = Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type]; } - if (npc.velocity.X < 0f) - npc.direction = -1; + if (NPC.velocity.X < 0f) + NPC.direction = -1; else - npc.direction = 1; - if (npc.direction == 1) - npc.spriteDirection = 1; - if (npc.direction == -1) - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y * (double)npc.direction, (double)npc.velocity.X * (double)npc.direction); - npc.frameCounter++; - if (npc.frameCounter > 4) + NPC.direction = 1; + if (NPC.direction == 1) + NPC.spriteDirection = 1; + if (NPC.direction == -1) + NPC.spriteDirection = -1; + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y * (double)NPC.direction, (double)NPC.velocity.X * (double)NPC.direction); + NPC.frameCounter++; + if (NPC.frameCounter > 4) { - npc.frame.Y += num1; - npc.frameCounter = 0; + NPC.frame.Y += num1; + NPC.frameCounter = 0; } - if (npc.frame.Y / num1 >= Main.npcFrameCount[npc.type]) - npc.frame.Y = 0; + if (NPC.frame.Y / num1 >= Main.npcFrameCount[NPC.type]) + NPC.frame.Y = 0; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return spawnInfo.player.ZoneSnow && - spawnInfo.player.ZoneOverworldHeight && - !spawnInfo.player.PillarZone() && - !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.InSunkenSea() && - Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.01f : 0f; + return spawnInfo.Player.ZoneSnow && + spawnInfo.Player.ZoneOverworldHeight && + !spawnInfo.Player.PillarZone() && + !spawnInfo.Player.ZoneDungeon && + !spawnInfo.Player.InSunkenSea() && + Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.01f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -78,28 +78,28 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.02f, 0.7f, 0.7f); + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.02f, 0.7f, 0.7f); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CryoSpirit"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/CryoSpirit"), 1f); } } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.25f); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.25f); } } } diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index 799b650f2e..ab26b96217 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -19,122 +19,122 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Impious Immolator"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.noGravity = true; - npc.lavaImmune = true; - npc.damage = 0; - npc.width = 60; - npc.height = 60; - npc.defense = 30; - npc.lifeMax = 5775; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.lavaImmune = true; + NPC.damage = 0; + NPC.width = 60; + NPC.height = 60; + NPC.defense = 30; + NPC.lifeMax = 5775; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 50, 0); - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - npc.knockBackResist = 0.2f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 50, 0); + NPC.HitSound = SoundID.NPCHit5; + NPC.DeathSound = SoundID.NPCDeath7; + NPC.knockBackResist = 0.2f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(hasBeenHit); - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - npc.noGravity = true; - if (npc.direction == 0) + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + NPC.noGravity = true; + if (NPC.direction == 0) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - if (npc.justHit) + if (NPC.justHit) { hasBeenHit = true; } - npc.chaseable = hasBeenHit; - if (!npc.wet) + NPC.chaseable = hasBeenHit; + if (!NPC.wet) { bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if ((Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) + NPC.TargetClosest(false); + if ((Main.player[NPC.target].wet || Main.player[NPC.target].dead) && flag14) { flag14 = false; } if (!flag14) { - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; + NPC.netUpdate = true; } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } } if (flag14) { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.2f; + NPC.TargetClosest(true); + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.2f; + NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * 0.2f; float velocityMax = CalamityWorld.death ? 16f : 12f; - if (npc.velocity.X > velocityMax) + if (NPC.velocity.X > velocityMax) { - npc.velocity.X = velocityMax; + NPC.velocity.X = velocityMax; } - if (npc.velocity.X < -velocityMax) + if (NPC.velocity.X < -velocityMax) { - npc.velocity.X = -velocityMax; + NPC.velocity.X = -velocityMax; } - if (npc.velocity.Y > velocityMax) + if (NPC.velocity.Y > velocityMax) { - npc.velocity.Y = velocityMax; + NPC.velocity.Y = velocityMax; } - if (npc.velocity.Y < -velocityMax) + if (NPC.velocity.Y < -velocityMax) { - npc.velocity.Y = -velocityMax; + NPC.velocity.Y = -velocityMax; } - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= (CalamityWorld.death ? 60f : 90f)) + NPC.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= (CalamityWorld.death ? 60f : 90f)) { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.localAI[0] = 0f; + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { float speed = 12f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); + Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)(NPC.height / 2)); + float num6 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); + float num7 = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); num8 = speed / num8; num6 *= num8; @@ -144,37 +144,37 @@ namespace CalamityMod.NPCs.NormalNPCs { damage = 42; } - int beam = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + int beam = Projectile.NewProjectile(NPC.Center.X, NPC.Center.Y, num6, num7, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[beam].tileCollide = true; } } } else { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -3f || npc.velocity.X > 3f) + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -3f || NPC.velocity.X > 3f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num258 = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int num259 = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; if (Main.tile[num258, num259 - 1] == null) { Main.tile[num258, num259 - 1] = new Tile(); @@ -191,43 +191,43 @@ namespace CalamityMod.NPCs.NormalNPCs { if (Main.tile[num258, num259 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num258, num259 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) { - npc.velocity.Y = npc.velocity.Y * 0.95f; + NPC.velocity.Y = NPC.velocity.Y * 0.95f; } } else { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + NPC.velocity.X = NPC.velocity.X * 0.94f; + if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) { - npc.velocity.X = 0f; + NPC.velocity.X = 0f; } } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 5f) + NPC.velocity.Y = NPC.velocity.Y + 0.3f; + if (NPC.velocity.Y > 5f) { - npc.velocity.Y = 5f; + NPC.velocity.Y = 5f; } - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.1) + NPC.rotation = NPC.velocity.Y * (float)NPC.direction * 0.1f; + if ((double)NPC.rotation < -0.1) { - npc.rotation = -0.1f; + NPC.rotation = -0.1f; } - if ((double)npc.rotation > 0.1) + if ((double)NPC.rotation > 0.1) { - npc.rotation = 0.1f; + NPC.rotation = 0.1f; } } @@ -242,10 +242,10 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - npc.frameCounter += hasBeenHit ? 0.25f : 0.125f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += hasBeenHit ? 0.25f : 0.125f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -263,21 +263,21 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 15); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 15); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/KingSlimeJewel.cs b/NPCs/NormalNPCs/KingSlimeJewel.cs index 6bdce03ce5..3e80a19f1e 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.NormalNPCs { @@ -17,98 +18,98 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 0; - npc.width = 22; - npc.height = 22; - npc.defense = 10; - npc.DR_NERD(0.1f); - npc.lifeMax = 280; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath15; - npc.Calamity().VulnerableToSickness = false; + NPC.damage = 0; + NPC.width = 22; + NPC.height = 22; + NPC.defense = 10; + NPC.DR_NERD(0.1f); + NPC.lifeMax = 280; + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit5; + NPC.DeathSound = SoundID.NPCDeath15; + NPC.Calamity().VulnerableToSickness = false; } public override void AI() { // Red light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1f, 0f, 0f); + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 1f, 0f, 0f); // Despawn if (!NPC.AnyNPCs(NPCID.KingSlime)) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } // Float around the player - npc.rotation = npc.velocity.X / 15f; + NPC.rotation = NPC.velocity.X / 15f; - npc.TargetClosest(true); + NPC.TargetClosest(true); float velocity = 2f; float acceleration = 0.1f; - if (npc.position.Y > Main.player[npc.target].position.Y - 350f) + if (NPC.position.Y > Main.player[NPC.target].position.Y - 350f) { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y *= 0.98f; - npc.velocity.Y -= acceleration; + NPC.velocity.Y -= acceleration; - if (npc.velocity.Y > velocity) - npc.velocity.Y = velocity; + if (NPC.velocity.Y > velocity) + NPC.velocity.Y = velocity; } - else if (npc.position.Y < Main.player[npc.target].position.Y - 400f) + else if (NPC.position.Y < Main.player[NPC.target].position.Y - 400f) { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= 0.98f; - npc.velocity.Y += acceleration; + NPC.velocity.Y += acceleration; - if (npc.velocity.Y < -velocity) - npc.velocity.Y = -velocity; + if (NPC.velocity.Y < -velocity) + NPC.velocity.Y = -velocity; } - if (npc.Center.X > Main.player[npc.target].Center.X + 100f) + if (NPC.Center.X > Main.player[NPC.target].Center.X + 100f) { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; + if (NPC.velocity.X > 0f) + NPC.velocity.X *= 0.98f; - npc.velocity.X -= acceleration; + NPC.velocity.X -= acceleration; - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; + if (NPC.velocity.X > 8f) + NPC.velocity.X = 8f; } - if (npc.Center.X < Main.player[npc.target].Center.X - 100f) + if (NPC.Center.X < Main.player[NPC.target].Center.X - 100f) { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; + if (NPC.velocity.X < 0f) + NPC.velocity.X *= 0.98f; - npc.velocity.X += acceleration; + NPC.velocity.X += acceleration; - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; + if (NPC.velocity.X < -8f) + NPC.velocity.X = -8f; } // Fire projectiles if (Main.netMode != NetmodeID.MultiplayerClient) { // Fire bolt every 1.5 seconds - npc.localAI[0] += 1f; - if (npc.localAI[0] >= ((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 45f : CalamityWorld.death ? 60f : 75f)) + NPC.localAI[0] += 1f; + if (NPC.localAI[0] >= ((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 45f : CalamityWorld.death ? 60f : 75f)) { - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; - Vector2 npcPos = new Vector2(npc.Center.X, npc.Center.Y); - float xDist = Main.player[npc.target].Center.X - npcPos.X; - float yDist = Main.player[npc.target].Center.Y - npcPos.Y; + Vector2 npcPos = new Vector2(NPC.Center.X, NPC.Center.Y); + float xDist = Main.player[NPC.target].Center.X - npcPos.X; + float yDist = Main.player[NPC.target].Center.Y - npcPos.Y; Vector2 projVector = new Vector2(xDist, yDist); float projLength = projVector.Length(); @@ -125,7 +126,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Vector2 dustVel = projVector; dustVel.Normalize(); - int ruby = Dust.NewDust(npc.Center, npc.width, npc.height, 90, dustVel.X, dustVel.Y, 100, default, 2f); + int ruby = Dust.NewDust(NPC.Center, NPC.width, NPC.height, 90, dustVel.X, dustVel.Y, 100, default, 2f); Main.dust[ruby].velocity *= 1.5f; Main.dust[ruby].noGravity = true; if (Main.rand.NextBool(2)) @@ -135,8 +136,8 @@ namespace CalamityMod.NPCs.NormalNPCs } } - Main.PlaySound(SoundID.Item8, npc.position); - int damage = npc.GetProjectileDamage(type); + SoundEngine.PlaySound(SoundID.Item8, NPC.position); + int damage = NPC.GetProjectileDamage(type); if (CalamityWorld.death || BossRushEvent.BossRushActive) { int numProj = 2; @@ -165,18 +166,18 @@ namespace CalamityMod.NPCs.NormalNPCs public override void HitEffect(int hitDirection, double damage) { - Dust.NewDust(npc.position, npc.width, npc.height, 90, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + Dust.NewDust(NPC.position, NPC.width, NPC.height, 90, hitDirection, -1f, 0, default, 1f); + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 45; - npc.height = 45; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 45; + NPC.height = 45; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 2; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 90, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 90, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -186,10 +187,10 @@ namespace CalamityMod.NPCs.NormalNPCs } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 90, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 90, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 90, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 90, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/NormalNPCs/MantisShrimp.cs b/NPCs/NormalNPCs/MantisShrimp.cs index 642ea37d44..6d1fa39fc7 100644 --- a/NPCs/NormalNPCs/MantisShrimp.cs +++ b/NPCs/NormalNPCs/MantisShrimp.cs @@ -13,34 +13,34 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Mantis Shrimp"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.damage = 200; - npc.width = 40; - npc.height = 24; - npc.defense = 10; - npc.DR_NERD(0.1f); - npc.lifeMax = 30; - npc.aiStyle = 3; + NPC.damage = 200; + NPC.width = 40; + NPC.height = 24; + NPC.defense = 10; + NPC.DR_NERD(0.1f); + NPC.lifeMax = 30; + NPC.aiStyle = 3; aiType = NPCID.Crab; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.spriteDirection = (npc.direction > 0) ? -1 : 1; - float num79 = (Main.player[npc.target].Center - npc.Center).Length(); + NPC.spriteDirection = (NPC.direction > 0) ? -1 : 1; + float num79 = (Main.player[NPC.target].Center - NPC.Center).Length(); num79 *= 0.0025f; if ((double)num79 > 1.5) { @@ -56,27 +56,27 @@ namespace CalamityMod.NPCs.NormalNPCs num78 = 2.5f - num79; } num78 *= (CalamityWorld.death ? 1.2f : 0.8f); - if (npc.velocity.X < -num78 || npc.velocity.X > num78) + if (NPC.velocity.X < -num78 || NPC.velocity.X > num78) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.velocity *= 0.8f; + NPC.velocity *= 0.8f; } } - else if (npc.velocity.X < num78 && npc.direction == 1) + else if (NPC.velocity.X < num78 && NPC.direction == 1) { - npc.velocity.X = npc.velocity.X + 1f; - if (npc.velocity.X > num78) + NPC.velocity.X = NPC.velocity.X + 1f; + if (NPC.velocity.X > num78) { - npc.velocity.X = num78; + NPC.velocity.X = num78; } } - else if (npc.velocity.X > -num78 && npc.direction == -1) + else if (NPC.velocity.X > -num78 && NPC.direction == -1) { - npc.velocity.X = npc.velocity.X - 1f; - if (npc.velocity.X < -num78) + NPC.velocity.X = NPC.velocity.X - 1f; + if (NPC.velocity.X < -num78) { - npc.velocity.X = -num78; + NPC.velocity.X = -num78; } } } @@ -89,15 +89,15 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneSulphur) + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.Player.Calamity().ZoneSulphur) return 0f; return SpawnCondition.OceanMonster.Chance * 0.2f; @@ -105,20 +105,20 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedPlantBoss, 0.2f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), NPC.downedPlantBoss, 0.2f); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index 37b7cff803..5b5e5be8d2 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -16,129 +16,129 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Overloaded Soldier"); - Main.npcFrameCount[npc.type] = 14; + Main.npcFrameCount[NPC.type] = 14; } public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.damage = NPC.downedMoonlord ? 84 : 42; - npc.width = 18; - npc.height = 40; - npc.defense = 18; - npc.DR_NERD(0.15f); - npc.lifeMax = NPC.downedMoonlord ? 1350 : 135; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit2; - npc.DeathSound = SoundID.NPCDeath2; - banner = npc.type; + NPC.damage = NPC.downedMoonlord ? 84 : 42; + NPC.width = 18; + NPC.height = 40; + NPC.defense = 18; + NPC.DR_NERD(0.15f); + NPC.lifeMax = NPC.downedMoonlord ? 1350 : 135; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.HitSound = SoundID.NPCHit2; + NPC.DeathSound = SoundID.NPCDeath2; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void FindFrame(int frameHeight) { - npc.frameCounter += (double)Math.Abs(npc.velocity.X); - if (npc.frameCounter > 6.0) + NPC.frameCounter += (double)Math.Abs(NPC.velocity.X); + if (NPC.frameCounter > 6.0) { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; } - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - if (npc.direction == 1) - npc.spriteDirection = 1; - if (npc.direction == -1) - npc.spriteDirection = -1; + if (NPC.direction == 1) + NPC.spriteDirection = 1; + if (NPC.direction == -1) + NPC.spriteDirection = -1; } else { - npc.frameCounter = 0.0; - npc.frame.Y = 0; + NPC.frameCounter = 0.0; + NPC.frame.Y = 0; return; } - if (npc.velocity.X == 0f) + if (NPC.velocity.X == 0f) { - npc.frameCounter = 0.0; - npc.frame.Y = 0; + NPC.frameCounter = 0.0; + NPC.frame.Y = 0; } else { - if (npc.frame.Y < frameHeight) - npc.frame.Y = frameHeight; - if (npc.frame.Y > frameHeight * 13) - npc.frame.Y = frameHeight; + if (NPC.frame.Y < frameHeight) + NPC.frame.Y = frameHeight; + if (NPC.frame.Y > frameHeight * 13) + NPC.frame.Y = frameHeight; } } public override void AI() { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.35f, 0f, 0.15f); + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.35f, 0f, 0.15f); bool flag3 = false; - if (npc.velocity.X == 0f) + if (NPC.velocity.X == 0f) { flag3 = true; } - if (npc.justHit) + if (NPC.justHit) { flag3 = false; } bool flag4 = false; bool flag5 = false; int num35 = 60; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + if (NPC.velocity.Y == 0f && ((NPC.velocity.X > 0f && NPC.direction < 0) || (NPC.velocity.X < 0f && NPC.direction > 0))) { flag4 = true; } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num35) | flag4) + if ((NPC.position.X == NPC.oldPosition.X || NPC.ai[3] >= (float)num35) | flag4) { - npc.ai[3] += 1f; + NPC.ai[3] += 1f; } - else if ((double)Math.Abs(npc.velocity.X) > 0.9 && npc.ai[3] > 0f) + else if ((double)Math.Abs(NPC.velocity.X) > 0.9 && NPC.ai[3] > 0f) { - npc.ai[3] -= 1f; + NPC.ai[3] -= 1f; } - if (npc.ai[3] > (float)(num35 * 10)) + if (NPC.ai[3] > (float)(num35 * 10)) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; } - if (npc.justHit) + if (NPC.justHit) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; } - if (npc.ai[3] == (float)num35) + if (NPC.ai[3] == (float)num35) { - npc.netUpdate = true; + NPC.netUpdate = true; } - if (npc.ai[3] < (float)num35) + if (NPC.ai[3] < (float)num35) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - else if (npc.ai[2] <= 0f) + else if (NPC.ai[2] <= 0f) { - if (npc.velocity.X == 0f) + if (NPC.velocity.X == 0f) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) + NPC.ai[0] += 1f; + if (NPC.ai[0] >= 2f) { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; + NPC.direction *= -1; + NPC.spriteDirection = NPC.direction; + NPC.ai[0] = 0f; } } } else { - npc.ai[0] = 0f; + NPC.ai[0] = 0f; } - if (npc.direction == 0) + if (NPC.direction == 0) { - npc.direction = 1; + NPC.direction = 1; } } float num65 = 1.5f; @@ -148,61 +148,61 @@ namespace CalamityMod.NPCs.NormalNPCs num65 *= 1.5f; num66 *= 1.5f; } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 400f) + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) < 400f) { - num65 += (CalamityWorld.death ? 6f : 4f) - ((Main.player[npc.target].Center - npc.Center).Length() * 0.01f); + num65 += (CalamityWorld.death ? 6f : 4f) - ((Main.player[NPC.target].Center - NPC.Center).Length() * 0.01f); } - if (npc.velocity.X < -num65 || npc.velocity.X > num65) + if (NPC.velocity.X < -num65 || NPC.velocity.X > num65) { - if (npc.velocity.Y == 0f) - npc.velocity *= 0.7f; + if (NPC.velocity.Y == 0f) + NPC.velocity *= 0.7f; } - else if (npc.velocity.X < num65 && npc.direction == 1) + else if (NPC.velocity.X < num65 && NPC.direction == 1) { - npc.velocity.X = npc.velocity.X + num66; - if (npc.velocity.X > num65) - npc.velocity.X = num65; + NPC.velocity.X = NPC.velocity.X + num66; + if (NPC.velocity.X > num65) + NPC.velocity.X = num65; } - else if (npc.velocity.X > -num65 && npc.direction == -1) + else if (NPC.velocity.X > -num65 && NPC.direction == -1) { - npc.velocity.X = npc.velocity.X - num66; - if (npc.velocity.X < -num65) - npc.velocity.X = -num65; + NPC.velocity.X = NPC.velocity.X - num66; + if (NPC.velocity.X < -num65) + NPC.velocity.X = -num65; } bool flag22 = false; - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - int num161 = (int)(npc.position.Y + (float)npc.height + 7f) / 16; - int arg_A8FB_0 = (int)npc.position.X / 16; - int num162 = (int)(npc.position.X + (float)npc.width) / 16; + int num161 = (int)(NPC.position.Y + (float)NPC.height + 7f) / 16; + int arg_A8FB_0 = (int)NPC.position.X / 16; + int num162 = (int)(NPC.position.X + (float)NPC.width) / 16; for (int num163 = arg_A8FB_0; num163 <= num162; num163++) { if (Main.tile[num163, num161] == null) { return; } - if (Main.tile[num163, num161].nactive() && Main.tileSolid[(int)Main.tile[num163, num161].type]) + if (Main.tile[num163, num161].nactive() && Main.tileSolid[(int)Main.tile[num163, num161].TileType]) { flag22 = true; break; } } } - if (npc.velocity.Y >= 0f) + if (NPC.velocity.Y >= 0f) { int num164 = 0; - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { num164 = -1; } - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { num164 = 1; } - Vector2 position2 = npc.position; - position2.X += npc.velocity.X; - int num165 = (int)((position2.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num164)) / 16f); - int num166 = (int)((position2.Y + (float)npc.height - 1f) / 16f); + Vector2 position2 = NPC.position; + position2.X += NPC.velocity.X; + int num165 = (int)((position2.X + (float)(NPC.width / 2) + (float)((NPC.width / 2 + 1) * num164)) / 16f); + int num166 = (int)((position2.Y + (float)NPC.height - 1f) / 16f); if (Main.tile[num165, num166] == null) { Main.tile[num165, num166] = new Tile(); @@ -227,7 +227,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Main.tile[num165 - num164, num166 - 3] = new Tile(); } - if ((float)(num165 * 16) < position2.X + (float)npc.width && (float)(num165 * 16 + 16) > position2.X && ((Main.tile[num165, num166].nactive() && !Main.tile[num165, num166].topSlope() && !Main.tile[num165, num166 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num165, num166].type] && !Main.tileSolidTop[(int)Main.tile[num165, num166].type]) || (Main.tile[num165, num166 - 1].halfBrick() && Main.tile[num165, num166 - 1].nactive())) && (!Main.tile[num165, num166 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 1].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 1].type] || (Main.tile[num165, num166 - 1].halfBrick() && (!Main.tile[num165, num166 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 4].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 4].type]))) && (!Main.tile[num165, num166 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 2].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 2].type]) && (!Main.tile[num165, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 3].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 3].type]) && (!Main.tile[num165 - num164, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165 - num164, num166 - 3].type])) + if ((float)(num165 * 16) < position2.X + (float)NPC.width && (float)(num165 * 16 + 16) > position2.X && ((Main.tile[num165, num166].nactive() && !Main.tile[num165, num166].topSlope() && !Main.tile[num165, num166 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num165, num166].TileType] && !Main.tileSolidTop[(int)Main.tile[num165, num166].TileType]) || (Main.tile[num165, num166 - 1].halfBrick() && Main.tile[num165, num166 - 1].nactive())) && (!Main.tile[num165, num166 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 1].TileType] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 1].TileType] || (Main.tile[num165, num166 - 1].halfBrick() && (!Main.tile[num165, num166 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 4].TileType] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 4].TileType]))) && (!Main.tile[num165, num166 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 2].TileType] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 2].TileType]) && (!Main.tile[num165, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 3].TileType] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 3].TileType]) && (!Main.tile[num165 - num164, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165 - num164, num166 - 3].TileType])) { float num167 = (float)(num166 * 16); if (Main.tile[num165, num166].halfBrick()) @@ -238,21 +238,21 @@ namespace CalamityMod.NPCs.NormalNPCs { num167 -= 8f; } - if (num167 < position2.Y + (float)npc.height) + if (num167 < position2.Y + (float)NPC.height) { - float num168 = position2.Y + (float)npc.height - num167; + float num168 = position2.Y + (float)NPC.height - num167; float num169 = 16.1f; if (num168 <= num169) { - npc.gfxOffY += npc.position.Y + (float)npc.height - num167; - npc.position.Y = num167 - (float)npc.height; + NPC.gfxOffY += NPC.position.Y + (float)NPC.height - num167; + NPC.position.Y = num167 - (float)NPC.height; if (num168 < 9f) { - npc.stepSpeed = 1f; + NPC.stepSpeed = 1f; } else { - npc.stepSpeed = 2f; + NPC.stepSpeed = 2f; } } } @@ -260,8 +260,8 @@ namespace CalamityMod.NPCs.NormalNPCs } if (flag22) { - int num170 = (int)((npc.position.X + (float)(npc.width / 2) + (float)(15 * npc.direction)) / 16f); - int num171 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + int num170 = (int)((NPC.position.X + (float)(NPC.width / 2) + (float)(15 * NPC.direction)) / 16f); + int num171 = (int)((NPC.position.Y + (float)NPC.height - 15f) / 16f); if (Main.tile[num170, num171] == null) { Main.tile[num170, num171] = new Tile(); @@ -282,62 +282,62 @@ namespace CalamityMod.NPCs.NormalNPCs { Main.tile[num170, num171 + 1] = new Tile(); } - if (Main.tile[num170 + npc.direction, num171 - 1] == null) + if (Main.tile[num170 + NPC.direction, num171 - 1] == null) { - Main.tile[num170 + npc.direction, num171 - 1] = new Tile(); + Main.tile[num170 + NPC.direction, num171 - 1] = new Tile(); } - if (Main.tile[num170 + npc.direction, num171 + 1] == null) + if (Main.tile[num170 + NPC.direction, num171 + 1] == null) { - Main.tile[num170 + npc.direction, num171 + 1] = new Tile(); + Main.tile[num170 + NPC.direction, num171 + 1] = new Tile(); } - if (Main.tile[num170 - npc.direction, num171 + 1] == null) + if (Main.tile[num170 - NPC.direction, num171 + 1] == null) { - Main.tile[num170 - npc.direction, num171 + 1] = new Tile(); + Main.tile[num170 - NPC.direction, num171 + 1] = new Tile(); } Main.tile[num170, num171 + 1].halfBrick(); - if ((Main.tile[num170, num171 - 1].nactive() && (Main.tile[num170, num171 - 1].type == 10 || Main.tile[num170, num171 - 1].type == 388)) & flag5) + if ((Main.tile[num170, num171 - 1].nactive() && (Main.tile[num170, num171 - 1].TileType == 10 || Main.tile[num170, num171 - 1].TileType == 388)) & flag5) { - npc.ai[2] += 1f; - npc.ai[3] = 0f; - if (npc.ai[2] >= 60f) + NPC.ai[2] += 1f; + NPC.ai[3] = 0f; + if (NPC.ai[2] >= 60f) { - npc.velocity.X = 0.5f * (float)-(float)npc.direction; + NPC.velocity.X = 0.5f * (float)-(float)NPC.direction; int num172 = 5; - if (Main.tile[num170, num171 - 1].type == 388) + if (Main.tile[num170, num171 - 1].TileType == 388) { num172 = 2; } - npc.ai[1] += (float)num172; - npc.ai[2] = 0f; + NPC.ai[1] += (float)num172; + NPC.ai[2] = 0f; bool flag23 = false; - if (npc.ai[1] >= 10f) + if (NPC.ai[1] >= 10f) { flag23 = true; - npc.ai[1] = 10f; + NPC.ai[1] = 10f; } WorldGen.KillTile(num170, num171 - 1, true, false, false); if ((Main.netMode != NetmodeID.MultiplayerClient || !flag23) && flag23 && Main.netMode != NetmodeID.MultiplayerClient) { - if (Main.tile[num170, num171 - 1].type == 10) + if (Main.tile[num170, num171 - 1].TileType == 10) { - bool flag24 = WorldGen.OpenDoor(num170, num171 - 1, npc.direction); + bool flag24 = WorldGen.OpenDoor(num170, num171 - 1, NPC.direction); if (!flag24) { - npc.ai[3] = (float)num35; - npc.netUpdate = true; + NPC.ai[3] = (float)num35; + NPC.netUpdate = true; } if (Main.netMode == NetmodeID.Server & flag24) { - NetMessage.SendData(MessageID.ChangeDoor, -1, -1, null, 0, (float)num170, (float)(num171 - 1), (float)npc.direction, 0, 0, 0); + NetMessage.SendData(MessageID.ChangeDoor, -1, -1, null, 0, (float)num170, (float)(num171 - 1), (float)NPC.direction, 0, 0, 0); } } - if (Main.tile[num170, num171 - 1].type == 388) + if (Main.tile[num170, num171 - 1].TileType == 388) { bool flag25 = WorldGen.ShiftTallGate(num170, num171 - 1, false); if (!flag25) { - npc.ai[3] = (float)num35; - npc.netUpdate = true; + NPC.ai[3] = (float)num35; + NPC.netUpdate = true; } if (Main.netMode == NetmodeID.Server & flag25) { @@ -349,61 +349,61 @@ namespace CalamityMod.NPCs.NormalNPCs } else { - int num173 = npc.spriteDirection; - if ((npc.velocity.X < 0f && num173 == -1) || (npc.velocity.X > 0f && num173 == 1)) + int num173 = NPC.spriteDirection; + if ((NPC.velocity.X < 0f && num173 == -1) || (NPC.velocity.X > 0f && num173 == 1)) { - if (npc.height >= 32 && Main.tile[num170, num171 - 2].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 2].type]) + if (NPC.height >= 32 && Main.tile[num170, num171 - 2].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 2].TileType]) { - if (Main.tile[num170, num171 - 3].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 3].type]) + if (Main.tile[num170, num171 - 3].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 3].TileType]) { - npc.velocity.Y = -8f; - npc.netUpdate = true; + NPC.velocity.Y = -8f; + NPC.netUpdate = true; } else { - npc.velocity.Y = -7f; - npc.netUpdate = true; + NPC.velocity.Y = -7f; + NPC.netUpdate = true; } } - else if (Main.tile[num170, num171 - 1].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 1].type]) + else if (Main.tile[num170, num171 - 1].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 1].TileType]) { - npc.velocity.Y = -6f; - npc.netUpdate = true; + NPC.velocity.Y = -6f; + NPC.netUpdate = true; } - else if (npc.position.Y + (float)npc.height - (float)(num171 * 16) > 20f && Main.tile[num170, num171].nactive() && !Main.tile[num170, num171].topSlope() && Main.tileSolid[(int)Main.tile[num170, num171].type]) + else if (NPC.position.Y + (float)NPC.height - (float)(num171 * 16) > 20f && Main.tile[num170, num171].nactive() && !Main.tile[num170, num171].topSlope() && Main.tileSolid[(int)Main.tile[num170, num171].TileType]) { - npc.velocity.Y = -5f; - npc.netUpdate = true; + NPC.velocity.Y = -5f; + NPC.netUpdate = true; } - else if (npc.directionY < 0 && (!Main.tile[num170, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170, num171 + 1].type]) && (!Main.tile[num170 + npc.direction, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170 + npc.direction, num171 + 1].type])) + else if (NPC.directionY < 0 && (!Main.tile[num170, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170, num171 + 1].TileType]) && (!Main.tile[num170 + NPC.direction, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170 + NPC.direction, num171 + 1].TileType])) { - npc.velocity.Y = -8f; - npc.velocity.X = npc.velocity.X * 1.5f; - npc.netUpdate = true; + NPC.velocity.Y = -8f; + NPC.velocity.X = NPC.velocity.X * 1.5f; + NPC.netUpdate = true; } else if (flag5) { - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } - if ((npc.velocity.Y == 0f & flag3) && npc.ai[3] == 1f) + if ((NPC.velocity.Y == 0f & flag3) && NPC.ai[3] == 1f) { - npc.velocity.Y = -5f; + NPC.velocity.Y = -5f; } } } } else if (flag5) { - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.Player.Calamity().ZoneAbyss || + spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -419,21 +419,21 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedMoonlord); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), NPC.downedMoonlord); } } } diff --git a/NPCs/NormalNPCs/Parasea.cs b/NPCs/NormalNPCs/Parasea.cs index a763e7e72d..ceaac688e2 100644 --- a/NPCs/NormalNPCs/Parasea.cs +++ b/NPCs/NormalNPCs/Parasea.cs @@ -13,40 +13,40 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Parasea"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.noGravity = true; - npc.damage = 50; - npc.width = npc.height = 30; - npc.defense = 8; - npc.lifeMax = 400; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 6, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.noGravity = true; + NPC.damage = 50; + NPC.width = NPC.height = 30; + NPC.defense = 8; + NPC.lifeMax = 400; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 6, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { bool death = CalamityWorld.death; float speed = death ? 16f : 13f; - CalamityAI.DungeonSpiritAI(npc, mod, speed, MathHelper.Pi); + CalamityAI.DungeonSpiritAI(NPC, Mod, speed, MathHelper.Pi); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur || (!NPC.downedPlantBoss && !CalamityWorld.downedCalamitas)) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur || (!NPC.downedPlantBoss && !CalamityWorld.downedCalamitas)) { return 0f; } @@ -55,21 +55,21 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Texture2D texture = Main.npcTexture[npc.type]; - int height = texture.Height / Main.npcFrameCount[npc.type]; + Texture2D texture = Main.npcTexture[NPC.type]; + int height = texture.Height / Main.npcFrameCount[NPC.type]; int width = texture.Width; SpriteEffects spriteEffects = SpriteEffects.FlipHorizontally; - if (npc.spriteDirection == -1) + if (NPC.spriteDirection == -1) spriteEffects = SpriteEffects.None; - Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0f, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, new Vector2((float)width / 2f, (float)height / 2f), npc.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, NPC.Center - Main.screenPosition + new Vector2(0f, NPC.gfxOffY), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2((float)width / 2f, (float)height / 2f), NPC.scale, spriteEffects, 0f); return false; } @@ -82,13 +82,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/PerennialSlime.cs b/NPCs/NormalNPCs/PerennialSlime.cs index 3391d2dd0c..b5036e5da4 100644 --- a/NPCs/NormalNPCs/PerennialSlime.cs +++ b/NPCs/NormalNPCs/PerennialSlime.cs @@ -10,37 +10,37 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Perennial Slime"); - Main.npcFrameCount[npc.type] = 2; + Main.npcFrameCount[NPC.type] = 2; } public override void SetDefaults() { - npc.aiStyle = 1; + NPC.aiStyle = 1; aiType = NPCID.ToxicSludge; - npc.damage = 35; - npc.width = 40; - npc.height = 30; - npc.defense = 12; - npc.lifeMax = 150; - npc.knockBackResist = 0f; + NPC.damage = 35; + NPC.width = 40; + NPC.height = 30; + NPC.defense = 12; + NPC.lifeMax = 150; + NPC.knockBackResist = 0f; animationType = NPCID.CorruptSlime; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.alpha = 50; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.Player.Calamity().ZoneAbyss || + spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -53,20 +53,20 @@ namespace CalamityMod.NPCs.NormalNPCs int dustType = 115; for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, dustType, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, dustType, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 10, 26); + DropHelper.DropItem(NPC, ModContent.ItemType(), 10, 26); } } } diff --git a/NPCs/NormalNPCs/PhantomDebris.cs b/NPCs/NormalNPCs/PhantomDebris.cs index a636b61611..a263f84ba9 100644 --- a/NPCs/NormalNPCs/PhantomDebris.cs +++ b/NPCs/NormalNPCs/PhantomDebris.cs @@ -16,187 +16,187 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Phantom Debris"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.damage = NPC.downedMoonlord ? 60 : 30; - npc.width = 44; - npc.height = 22; - npc.defense = 20; - npc.DR_NERD(0.1f); - npc.lifeMax = NPC.downedMoonlord ? 1200 : 120; - npc.aiStyle = -1; + NPC.damage = NPC.downedMoonlord ? 60 : 30; + NPC.width = 44; + NPC.height = 22; + NPC.defense = 20; + NPC.DR_NERD(0.1f); + NPC.lifeMax = NPC.downedMoonlord ? 1200 : 120; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit2; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.HitSound = SoundID.NPCHit2; + NPC.DeathSound = SoundID.NPCDeath36; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void FindFrame(int frameHeight) { - npc.frameCounter += (double)Math.Abs(npc.velocity.X); - if (npc.frameCounter > 6.0) + NPC.frameCounter += (double)Math.Abs(NPC.velocity.X); + if (NPC.frameCounter > 6.0) { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; } - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - if (npc.direction == 1) - npc.spriteDirection = 1; - if (npc.direction == -1) - npc.spriteDirection = -1; + if (NPC.direction == 1) + NPC.spriteDirection = 1; + if (NPC.direction == -1) + NPC.spriteDirection = -1; } else { - npc.frameCounter = 0.0; - npc.frame.Y = 0; + NPC.frameCounter = 0.0; + NPC.frame.Y = 0; return; } - if (npc.velocity.X == 0f) + if (NPC.velocity.X == 0f) { - npc.frameCounter = 0.0; - npc.frame.Y = 0; + NPC.frameCounter = 0.0; + NPC.frame.Y = 0; } else { - if (npc.frame.Y > frameHeight * 3) - npc.frame.Y = 0; + if (NPC.frame.Y > frameHeight * 3) + NPC.frame.Y = 0; } } public override void AI() { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.35f, 0f, 0.15f); + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.35f, 0f, 0.15f); bool flag3 = false; - if (npc.velocity.X == 0f) + if (NPC.velocity.X == 0f) { flag3 = true; } - if (npc.justHit) + if (NPC.justHit) { flag3 = false; } bool flag4 = false; bool flag5 = false; int num35 = 60; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + if (NPC.velocity.Y == 0f && ((NPC.velocity.X > 0f && NPC.direction < 0) || (NPC.velocity.X < 0f && NPC.direction > 0))) { flag4 = true; } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num35) | flag4) + if ((NPC.position.X == NPC.oldPosition.X || NPC.ai[3] >= (float)num35) | flag4) { - npc.ai[3] += 1f; + NPC.ai[3] += 1f; } - else if ((double)Math.Abs(npc.velocity.X) > 0.9 && npc.ai[3] > 0f) + else if ((double)Math.Abs(NPC.velocity.X) > 0.9 && NPC.ai[3] > 0f) { - npc.ai[3] -= 1f; + NPC.ai[3] -= 1f; } - if (npc.ai[3] > (float)(num35 * 10)) + if (NPC.ai[3] > (float)(num35 * 10)) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; } - if (npc.justHit) + if (NPC.justHit) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; } - if (npc.ai[3] == (float)num35) + if (NPC.ai[3] == (float)num35) { - npc.netUpdate = true; + NPC.netUpdate = true; } - if (npc.ai[3] < (float)num35) + if (NPC.ai[3] < (float)num35) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - else if (npc.ai[2] <= 0f) + else if (NPC.ai[2] <= 0f) { - if (npc.velocity.X == 0f) + if (NPC.velocity.X == 0f) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) + NPC.ai[0] += 1f; + if (NPC.ai[0] >= 2f) { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; + NPC.direction *= -1; + NPC.spriteDirection = NPC.direction; + NPC.ai[0] = 0f; } } } else { - npc.ai[0] = 0f; + NPC.ai[0] = 0f; } - if (npc.direction == 0) + if (NPC.direction == 0) { - npc.direction = 1; + NPC.direction = 1; } } - float num65 = 1.2f + ((Main.player[npc.target].Center - npc.Center).Length() * 0.005f); - float num66 = 0.12f + ((Main.player[npc.target].Center - npc.Center).Length() * 0.0005f); + float num65 = 1.2f + ((Main.player[NPC.target].Center - NPC.Center).Length() * 0.005f); + float num66 = 0.12f + ((Main.player[NPC.target].Center - NPC.Center).Length() * 0.0005f); if (CalamityWorld.death) { num65 *= 1.5f; num66 *= 1.5f; } - if (npc.velocity.X < -num65 || npc.velocity.X > num65) + if (NPC.velocity.X < -num65 || NPC.velocity.X > num65) { - if (npc.velocity.Y == 0f) - npc.velocity *= 0.7f; + if (NPC.velocity.Y == 0f) + NPC.velocity *= 0.7f; } - else if (npc.velocity.X < num65 && npc.direction == 1) + else if (NPC.velocity.X < num65 && NPC.direction == 1) { - npc.velocity.X = npc.velocity.X + num66; - if (npc.velocity.X > num65) - npc.velocity.X = num65; + NPC.velocity.X = NPC.velocity.X + num66; + if (NPC.velocity.X > num65) + NPC.velocity.X = num65; } - else if (npc.velocity.X > -num65 && npc.direction == -1) + else if (NPC.velocity.X > -num65 && NPC.direction == -1) { - npc.velocity.X = npc.velocity.X - num66; - if (npc.velocity.X < -num65) - npc.velocity.X = -num65; + NPC.velocity.X = NPC.velocity.X - num66; + if (NPC.velocity.X < -num65) + NPC.velocity.X = -num65; } bool flag22 = false; - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - int num161 = (int)(npc.position.Y + (float)npc.height + 7f) / 16; - int arg_A8FB_0 = (int)npc.position.X / 16; - int num162 = (int)(npc.position.X + (float)npc.width) / 16; + int num161 = (int)(NPC.position.Y + (float)NPC.height + 7f) / 16; + int arg_A8FB_0 = (int)NPC.position.X / 16; + int num162 = (int)(NPC.position.X + (float)NPC.width) / 16; for (int num163 = arg_A8FB_0; num163 <= num162; num163++) { if (Main.tile[num163, num161] == null) { return; } - if (Main.tile[num163, num161].nactive() && Main.tileSolid[(int)Main.tile[num163, num161].type]) + if (Main.tile[num163, num161].nactive() && Main.tileSolid[(int)Main.tile[num163, num161].TileType]) { flag22 = true; break; } } } - if (npc.velocity.Y >= 0f) + if (NPC.velocity.Y >= 0f) { int num164 = 0; - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { num164 = -1; } - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { num164 = 1; } - Vector2 position2 = npc.position; - position2.X += npc.velocity.X; - int num165 = (int)((position2.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num164)) / 16f); - int num166 = (int)((position2.Y + (float)npc.height - 1f) / 16f); + Vector2 position2 = NPC.position; + position2.X += NPC.velocity.X; + int num165 = (int)((position2.X + (float)(NPC.width / 2) + (float)((NPC.width / 2 + 1) * num164)) / 16f); + int num166 = (int)((position2.Y + (float)NPC.height - 1f) / 16f); if (Main.tile[num165, num166] == null) { Main.tile[num165, num166] = new Tile(); @@ -221,7 +221,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Main.tile[num165 - num164, num166 - 3] = new Tile(); } - if ((float)(num165 * 16) < position2.X + (float)npc.width && (float)(num165 * 16 + 16) > position2.X && ((Main.tile[num165, num166].nactive() && !Main.tile[num165, num166].topSlope() && !Main.tile[num165, num166 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num165, num166].type] && !Main.tileSolidTop[(int)Main.tile[num165, num166].type]) || (Main.tile[num165, num166 - 1].halfBrick() && Main.tile[num165, num166 - 1].nactive())) && (!Main.tile[num165, num166 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 1].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 1].type] || (Main.tile[num165, num166 - 1].halfBrick() && (!Main.tile[num165, num166 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 4].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 4].type]))) && (!Main.tile[num165, num166 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 2].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 2].type]) && (!Main.tile[num165, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 3].type] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 3].type]) && (!Main.tile[num165 - num164, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165 - num164, num166 - 3].type])) + if ((float)(num165 * 16) < position2.X + (float)NPC.width && (float)(num165 * 16 + 16) > position2.X && ((Main.tile[num165, num166].nactive() && !Main.tile[num165, num166].topSlope() && !Main.tile[num165, num166 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num165, num166].TileType] && !Main.tileSolidTop[(int)Main.tile[num165, num166].TileType]) || (Main.tile[num165, num166 - 1].halfBrick() && Main.tile[num165, num166 - 1].nactive())) && (!Main.tile[num165, num166 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 1].TileType] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 1].TileType] || (Main.tile[num165, num166 - 1].halfBrick() && (!Main.tile[num165, num166 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 4].TileType] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 4].TileType]))) && (!Main.tile[num165, num166 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 2].TileType] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 2].TileType]) && (!Main.tile[num165, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165, num166 - 3].TileType] || Main.tileSolidTop[(int)Main.tile[num165, num166 - 3].TileType]) && (!Main.tile[num165 - num164, num166 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num165 - num164, num166 - 3].TileType])) { float num167 = (float)(num166 * 16); if (Main.tile[num165, num166].halfBrick()) @@ -232,21 +232,21 @@ namespace CalamityMod.NPCs.NormalNPCs { num167 -= 8f; } - if (num167 < position2.Y + (float)npc.height) + if (num167 < position2.Y + (float)NPC.height) { - float num168 = position2.Y + (float)npc.height - num167; + float num168 = position2.Y + (float)NPC.height - num167; float num169 = 16.1f; if (num168 <= num169) { - npc.gfxOffY += npc.position.Y + (float)npc.height - num167; - npc.position.Y = num167 - (float)npc.height; + NPC.gfxOffY += NPC.position.Y + (float)NPC.height - num167; + NPC.position.Y = num167 - (float)NPC.height; if (num168 < 9f) { - npc.stepSpeed = 1f; + NPC.stepSpeed = 1f; } else { - npc.stepSpeed = 2f; + NPC.stepSpeed = 2f; } } } @@ -254,8 +254,8 @@ namespace CalamityMod.NPCs.NormalNPCs } if (flag22) { - int num170 = (int)((npc.position.X + (float)(npc.width / 2) + (float)(15 * npc.direction)) / 16f); - int num171 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + int num170 = (int)((NPC.position.X + (float)(NPC.width / 2) + (float)(15 * NPC.direction)) / 16f); + int num171 = (int)((NPC.position.Y + (float)NPC.height - 15f) / 16f); if (Main.tile[num170, num171] == null) { Main.tile[num170, num171] = new Tile(); @@ -276,62 +276,62 @@ namespace CalamityMod.NPCs.NormalNPCs { Main.tile[num170, num171 + 1] = new Tile(); } - if (Main.tile[num170 + npc.direction, num171 - 1] == null) + if (Main.tile[num170 + NPC.direction, num171 - 1] == null) { - Main.tile[num170 + npc.direction, num171 - 1] = new Tile(); + Main.tile[num170 + NPC.direction, num171 - 1] = new Tile(); } - if (Main.tile[num170 + npc.direction, num171 + 1] == null) + if (Main.tile[num170 + NPC.direction, num171 + 1] == null) { - Main.tile[num170 + npc.direction, num171 + 1] = new Tile(); + Main.tile[num170 + NPC.direction, num171 + 1] = new Tile(); } - if (Main.tile[num170 - npc.direction, num171 + 1] == null) + if (Main.tile[num170 - NPC.direction, num171 + 1] == null) { - Main.tile[num170 - npc.direction, num171 + 1] = new Tile(); + Main.tile[num170 - NPC.direction, num171 + 1] = new Tile(); } Main.tile[num170, num171 + 1].halfBrick(); - if ((Main.tile[num170, num171 - 1].nactive() && (Main.tile[num170, num171 - 1].type == 10 || Main.tile[num170, num171 - 1].type == 388)) & flag5) + if ((Main.tile[num170, num171 - 1].nactive() && (Main.tile[num170, num171 - 1].TileType == 10 || Main.tile[num170, num171 - 1].TileType == 388)) & flag5) { - npc.ai[2] += 1f; - npc.ai[3] = 0f; - if (npc.ai[2] >= 60f) + NPC.ai[2] += 1f; + NPC.ai[3] = 0f; + if (NPC.ai[2] >= 60f) { - npc.velocity.X = 0.5f * (float)-(float)npc.direction; + NPC.velocity.X = 0.5f * (float)-(float)NPC.direction; int num172 = 5; - if (Main.tile[num170, num171 - 1].type == 388) + if (Main.tile[num170, num171 - 1].TileType == 388) { num172 = 2; } - npc.ai[1] += (float)num172; - npc.ai[2] = 0f; + NPC.ai[1] += (float)num172; + NPC.ai[2] = 0f; bool flag23 = false; - if (npc.ai[1] >= 10f) + if (NPC.ai[1] >= 10f) { flag23 = true; - npc.ai[1] = 10f; + NPC.ai[1] = 10f; } WorldGen.KillTile(num170, num171 - 1, true, false, false); if ((Main.netMode != NetmodeID.MultiplayerClient || !flag23) && flag23 && Main.netMode != NetmodeID.MultiplayerClient) { - if (Main.tile[num170, num171 - 1].type == 10) + if (Main.tile[num170, num171 - 1].TileType == 10) { - bool flag24 = WorldGen.OpenDoor(num170, num171 - 1, npc.direction); + bool flag24 = WorldGen.OpenDoor(num170, num171 - 1, NPC.direction); if (!flag24) { - npc.ai[3] = (float)num35; - npc.netUpdate = true; + NPC.ai[3] = (float)num35; + NPC.netUpdate = true; } if (Main.netMode == NetmodeID.Server & flag24) { - NetMessage.SendData(MessageID.ChangeDoor, -1, -1, null, 0, (float)num170, (float)(num171 - 1), (float)npc.direction, 0, 0, 0); + NetMessage.SendData(MessageID.ChangeDoor, -1, -1, null, 0, (float)num170, (float)(num171 - 1), (float)NPC.direction, 0, 0, 0); } } - if (Main.tile[num170, num171 - 1].type == 388) + if (Main.tile[num170, num171 - 1].TileType == 388) { bool flag25 = WorldGen.ShiftTallGate(num170, num171 - 1, false); if (!flag25) { - npc.ai[3] = (float)num35; - npc.netUpdate = true; + NPC.ai[3] = (float)num35; + NPC.netUpdate = true; } if (Main.netMode == NetmodeID.Server & flag25) { @@ -343,61 +343,61 @@ namespace CalamityMod.NPCs.NormalNPCs } else { - int num173 = npc.spriteDirection; - if ((npc.velocity.X < 0f && num173 == -1) || (npc.velocity.X > 0f && num173 == 1)) + int num173 = NPC.spriteDirection; + if ((NPC.velocity.X < 0f && num173 == -1) || (NPC.velocity.X > 0f && num173 == 1)) { - if (npc.height >= 32 && Main.tile[num170, num171 - 2].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 2].type]) + if (NPC.height >= 32 && Main.tile[num170, num171 - 2].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 2].TileType]) { - if (Main.tile[num170, num171 - 3].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 3].type]) + if (Main.tile[num170, num171 - 3].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 3].TileType]) { - npc.velocity.Y = -8f; - npc.netUpdate = true; + NPC.velocity.Y = -8f; + NPC.netUpdate = true; } else { - npc.velocity.Y = -7f; - npc.netUpdate = true; + NPC.velocity.Y = -7f; + NPC.netUpdate = true; } } - else if (Main.tile[num170, num171 - 1].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 1].type]) + else if (Main.tile[num170, num171 - 1].nactive() && Main.tileSolid[(int)Main.tile[num170, num171 - 1].TileType]) { - npc.velocity.Y = -6f; - npc.netUpdate = true; + NPC.velocity.Y = -6f; + NPC.netUpdate = true; } - else if (npc.position.Y + (float)npc.height - (float)(num171 * 16) > 20f && Main.tile[num170, num171].nactive() && !Main.tile[num170, num171].topSlope() && Main.tileSolid[(int)Main.tile[num170, num171].type]) + else if (NPC.position.Y + (float)NPC.height - (float)(num171 * 16) > 20f && Main.tile[num170, num171].nactive() && !Main.tile[num170, num171].topSlope() && Main.tileSolid[(int)Main.tile[num170, num171].TileType]) { - npc.velocity.Y = -5f; - npc.netUpdate = true; + NPC.velocity.Y = -5f; + NPC.netUpdate = true; } - else if (npc.directionY < 0 && (!Main.tile[num170, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170, num171 + 1].type]) && (!Main.tile[num170 + npc.direction, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170 + npc.direction, num171 + 1].type])) + else if (NPC.directionY < 0 && (!Main.tile[num170, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170, num171 + 1].TileType]) && (!Main.tile[num170 + NPC.direction, num171 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num170 + NPC.direction, num171 + 1].TileType])) { - npc.velocity.Y = -8f; - npc.velocity.X = npc.velocity.X * 1.5f; - npc.netUpdate = true; + NPC.velocity.Y = -8f; + NPC.velocity.X = NPC.velocity.X * 1.5f; + NPC.netUpdate = true; } else if (flag5) { - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } - if ((npc.velocity.Y == 0f & flag3) && npc.ai[3] == 1f) + if ((NPC.velocity.Y == 0f & flag3) && NPC.ai[3] == 1f) { - npc.velocity.Y = -5f; + NPC.velocity.Y = -5f; } } } } else if (flag5) { - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.Player.Calamity().ZoneAbyss || + spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -413,21 +413,21 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedMoonlord); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), NPC.downedMoonlord); } } } diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs index 190c4dc6fa..ffaf005d0a 100644 --- a/NPCs/NormalNPCs/PhantomSpirit.cs +++ b/NPCs/NormalNPCs/PhantomSpirit.cs @@ -13,35 +13,35 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Phantom Spirit"); - Main.npcFrameCount[npc.type] = 3; + Main.npcFrameCount[NPC.type] = 3; } public override void SetDefaults() { - npc.aiStyle = -1; - npc.damage = 70; - npc.width = 16; - npc.height = 16; - npc.defense = 10; - npc.lifeMax = 1000; - npc.knockBackResist = 0.1f; + NPC.aiStyle = -1; + NPC.damage = 70; + NPC.width = 16; + NPC.height = 16; + NPC.defense = 10; + NPC.lifeMax = 1000; + NPC.knockBackResist = 0.1f; animationType = NPCID.DungeonSpirit; aiType = -1; - npc.value = Item.buyPrice(0, 0, 20, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = true; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.HitSound = SoundID.NPCHit36; + NPC.DeathSound = SoundID.NPCDeath39; + NPC.noGravity = true; + NPC.noTileCollide = true; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToSickness = false; } public override void AI() { float speed = CalamityWorld.death ? 22f : 17f; - CalamityAI.DungeonSpiritAI(npc, mod, speed, -MathHelper.PiOver2); - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); + CalamityAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); + int num822 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -52,13 +52,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num288 = 0; num288 < 50; num288++) { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, npc.velocity.X, npc.velocity.Y, 0, default, 1f); + int num289 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); Dust dust = Main.dust[num289]; dust.velocity *= 2f; dust.noGravity = true; @@ -74,7 +74,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); } } } diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs index af0b8339b9..dbc486cc5f 100644 --- a/NPCs/NormalNPCs/PhantomSpiritL.cs +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -17,79 +17,79 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Phantom Spirit"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.aiStyle = -1; - npc.damage = 100; - npc.width = 32; - npc.height = 80; - npc.scale = 1.2f; - npc.defense = 30; - npc.lifeMax = 3000; - npc.knockBackResist = 0f; + NPC.aiStyle = -1; + NPC.damage = 100; + NPC.width = 32; + NPC.height = 80; + NPC.scale = 1.2f; + NPC.defense = 30; + NPC.lifeMax = 3000; + NPC.knockBackResist = 0f; aiType = -1; - npc.value = Item.buyPrice(0, 0, 60, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = true; + NPC.value = Item.buyPrice(0, 0, 60, 0); + NPC.HitSound = SoundID.NPCHit36; + NPC.DeathSound = SoundID.NPCDeath39; + NPC.noGravity = true; + NPC.noTileCollide = true; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { float speed = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 16f : 12f; - CalamityAI.DungeonSpiritAI(npc, mod, speed, -MathHelper.PiOver2); - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); + CalamityAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); + int num822 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; dust.scale = 1.3f; dust.noGravity = true; - Vector2 vector17 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num147 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector17.X; - float num148 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector17.Y; + Vector2 vector17 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num147 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - vector17.X; + float num148 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - vector17.Y; float num149 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); if (num149 > 800f) { - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; return; } - npc.ai[2] += 1f; - if (npc.ai[3] == 0f) + NPC.ai[2] += 1f; + if (NPC.ai[3] == 0f) { - if (npc.ai[2] > 120f) + if (NPC.ai[2] > 120f) { - npc.ai[2] = 0f; - npc.ai[3] = 1f; - npc.netUpdate = true; + NPC.ai[2] = 0f; + NPC.ai[3] = 1f; + NPC.netUpdate = true; return; } } else { - if (npc.ai[2] > 40f) + if (NPC.ai[2] > 40f) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == 20f) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == 20f) { float num151 = 10f; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); num149 = num151 / num149; num147 *= num149; num148 *= num149; @@ -102,13 +102,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num288 = 0; num288 < 50; num288++) { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, npc.velocity.X, npc.velocity.Y, 0, default, 1f); + int num289 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); Dust dust = Main.dust[num289]; dust.velocity *= 2f; dust.noGravity = true; @@ -124,7 +124,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 4); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 4); } } } diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs index b607b950f4..068d8a4a57 100644 --- a/NPCs/NormalNPCs/PhantomSpiritM.cs +++ b/NPCs/NormalNPCs/PhantomSpiritM.cs @@ -13,43 +13,43 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Phantom Spirit"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.aiStyle = -1; - npc.damage = 90; - npc.width = 32; - npc.height = 80; - npc.scale = 1.1f; - npc.defense = 25; - npc.lifeMax = 2000; - npc.knockBackResist = 0.1f; + NPC.aiStyle = -1; + NPC.damage = 90; + NPC.width = 32; + NPC.height = 80; + NPC.scale = 1.1f; + NPC.defense = 25; + NPC.lifeMax = 2000; + NPC.knockBackResist = 0.1f; aiType = -1; - npc.value = Item.buyPrice(0, 0, 40, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = true; + NPC.value = Item.buyPrice(0, 0, 40, 0); + NPC.HitSound = SoundID.NPCHit36; + NPC.DeathSound = SoundID.NPCDeath39; + NPC.noGravity = true; + NPC.noTileCollide = true; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { float speed = CalamityWorld.death ? 18f : 13.5f; - CalamityAI.DungeonSpiritAI(npc, mod, speed, -MathHelper.PiOver2); - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); + CalamityAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); + int num822 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -61,13 +61,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num288 = 0; num288 < 50; num288++) { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, npc.velocity.X, npc.velocity.Y, 0, default, 1f); + int num289 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); Dust dust = Main.dust[num289]; dust.velocity *= 2f; dust.noGravity = true; @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 1, 3); + DropHelper.DropItem(NPC, ModContent.ItemType(), 1, 3); } } } diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs index 0fddf1bfc7..cbe75c34cf 100644 --- a/NPCs/NormalNPCs/PhantomSpiritS.cs +++ b/NPCs/NormalNPCs/PhantomSpiritS.cs @@ -13,42 +13,42 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Phantom Spirit"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.aiStyle = -1; - npc.damage = 80; - npc.width = 32; - npc.height = 80; - npc.defense = 20; - npc.lifeMax = 1500; - npc.knockBackResist = 0.1f; + NPC.aiStyle = -1; + NPC.damage = 80; + NPC.width = 32; + NPC.height = 80; + NPC.defense = 20; + NPC.lifeMax = 1500; + NPC.knockBackResist = 0.1f; aiType = -1; - npc.value = Item.buyPrice(0, 0, 30, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = true; + NPC.value = Item.buyPrice(0, 0, 30, 0); + NPC.HitSound = SoundID.NPCHit36; + NPC.DeathSound = SoundID.NPCDeath39; + NPC.noGravity = true; + NPC.noTileCollide = true; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { float speed = CalamityWorld.death ? 20f : 15f; - CalamityAI.DungeonSpiritAI(npc, mod, speed, -MathHelper.PiOver2); - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); + CalamityAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); + int num822 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -59,13 +59,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int num288 = 0; num288 < 50; num288++) { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, npc.velocity.X, npc.velocity.Y, 0, default, 1f); + int num289 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, NPC.velocity.X, NPC.velocity.Y, 0, default, 1f); Dust dust = Main.dust[num289]; dust.velocity *= 2f; dust.noGravity = true; @@ -81,7 +81,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 1, 2); + DropHelper.DropItem(NPC, ModContent.ItemType(), 1, 2); } } } diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index 53879f6307..64788a55d3 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -11,34 +11,34 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Piggy"); - Main.npcFrameCount[npc.type] = 5; - Main.npcCatchable[npc.type] = true; + Main.npcFrameCount[NPC.type] = 5; + Main.npcCatchable[NPC.type] = true; } public override void SetDefaults() { - npc.chaseable = false; - npc.damage = 0; - npc.width = 26; - npc.height = 26; - npc.lifeMax = 2000; - npc.aiStyle = 7; + NPC.chaseable = false; + NPC.damage = 0; + NPC.width = 26; + NPC.height = 26; + NPC.lifeMax = 2000; + NPC.aiStyle = 7; aiType = NPCID.Squirrel; - npc.knockBackResist = 0.99f; - npc.value = Item.buyPrice(0, 2, 0, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.knockBackResist = 0.99f; + NPC.value = Item.buyPrice(0, 2, 0, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.catchItem = (short)ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.catchItem = (short)ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneSulphur || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.Player.Calamity().ZoneSulphur || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -47,57 +47,57 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - if (npc.direction == 1) + if (NPC.direction == 1) { - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } - if (npc.direction == -1) + if (NPC.direction == -1) { - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } - if (npc.velocity.X == 0f) + if (NPC.velocity.X == 0f) { - npc.frame.Y = 0; - npc.frameCounter = 0.0; + NPC.frame.Y = 0; + NPC.frameCounter = 0.0; return; } - npc.frameCounter += (double)(Math.Abs(npc.velocity.X) * 0.25f); - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) + NPC.frameCounter += (double)(Math.Abs(NPC.velocity.X) * 0.25f); + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 12.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y / frameHeight >= Main.npcFrameCount[npc.type] - 1) + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[NPC.type] - 1) { - npc.frame.Y = frameHeight; + NPC.frame.Y = frameHeight; } } else { - npc.frameCounter = 0.0; - npc.frame.Y = frameHeight * 2; + NPC.frameCounter = 0.0; + NPC.frame.Y = frameHeight * 2; } } public override void NPCLoot() { - DropHelper.DropItem(npc, ItemID.Bacon, 1, 1); + DropHelper.DropItem(NPC, ItemID.Bacon, 1, 1); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index 03d3717a28..29b204c97e 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyBody.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.cs @@ -15,40 +15,40 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - npc.aiStyle = -1; - npc.damage = 0; - npc.npcSlots = 3f; - npc.width = 72; - npc.height = 36; - npc.defense = 50; - npc.DR_NERD(0.1f); - npc.lifeMax = 4500; - npc.knockBackResist = 0f; + NPC.aiStyle = -1; + NPC.damage = 0; + NPC.npcSlots = 3f; + NPC.width = 72; + NPC.height = 36; + NPC.defense = 50; + NPC.DR_NERD(0.1f); + NPC.lifeMax = 4500; + NPC.knockBackResist = 0f; aiType = -1; - npc.value = Item.buyPrice(0, 0, 50, 0); - npc.lavaImmune = true; - npc.noGravity = true; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 50, 0); + NPC.lavaImmune = true; + NPC.noGravity = true; + NPC.HitSound = SoundID.NPCHit52; + NPC.DeathSound = SoundID.NPCDeath55; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { - CalamityGlobalNPC.energyFlame = npc.whoAmI; + CalamityGlobalNPC.energyFlame = NPC.whoAmI; if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.localAI[0] == 0f) + if (NPC.localAI[0] == 0f) { - npc.localAI[0] = 1f; + NPC.localAI[0] = 1f; for (int num723 = 0; num723 < 2; num723++) { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI, 0f, 0f, 0f, 0f, 255); } } } @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedMoonlord || NPC.AnyNPCs(npc.type)) + if (spawnInfo.playerSafe || !NPC.downedMoonlord || NPC.AnyNPCs(NPC.type)) { return 0f; } @@ -71,20 +71,20 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 4); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 4); } } } diff --git a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs index 6d485f8fd4..7fd333b95b 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs @@ -14,51 +14,51 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Profaned Energy"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.npcSlots = 1f; - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 30; - npc.height = 30; - npc.lifeMax = 1; + NPC.npcSlots = 1f; + NPC.aiStyle = -1; + NPC.damage = 0; + NPC.width = 30; + NPC.height = 30; + NPC.lifeMax = 1; aiType = -1; - npc.lavaImmune = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.dontTakeDamage = true; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; + NPC.lavaImmune = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.dontTakeDamage = true; + NPC.HitSound = SoundID.NPCHit52; + NPC.DeathSound = SoundID.NPCDeath55; } public override void AI() { if (CalamityGlobalNPC.energyFlame < 0 || !Main.npc[CalamityGlobalNPC.energyFlame].active) { - npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); - npc.netUpdate = true; + NPC.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); + NPC.netUpdate = true; return; } int num750 = CalamityGlobalNPC.energyFlame; - if (npc.ai[3] > 0f) + if (NPC.ai[3] > 0f) { - num750 = (int)npc.ai[3] - 1; + num750 = (int)NPC.ai[3] - 1; } if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] -= 1f; - if (npc.localAI[0] <= 0f) + NPC.localAI[0] -= 1f; + if (NPC.localAI[0] <= 0f) { - npc.localAI[0] = (float)Main.rand.Next(120, 480); - npc.ai[0] = (float)Main.rand.Next(-100, 101); - npc.ai[1] = (float)Main.rand.Next(-100, 101); - npc.netUpdate = true; + NPC.localAI[0] = (float)Main.rand.Next(120, 480); + NPC.ai[0] = (float)Main.rand.Next(-100, 101); + NPC.ai[1] = (float)Main.rand.Next(-100, 101); + NPC.netUpdate = true; } } - npc.TargetClosest(true); + NPC.TargetClosest(true); float num751 = 0.1f; float num752 = 500f; if ((double)Main.npc[CalamityGlobalNPC.energyFlame].life < (double)Main.npc[CalamityGlobalNPC.energyFlame].lifeMax * 0.25) @@ -71,106 +71,106 @@ namespace CalamityMod.NPCs.NormalNPCs } if (Main.expertMode) { - float num753 = 1f - (float)npc.life / (float)npc.lifeMax; + float num753 = 1f - (float)NPC.life / (float)NPC.lifeMax; num752 += num753 * 200f; num751 += 0.15f; } if (!Main.npc[num750].active || CalamityGlobalNPC.energyFlame < 0) { - npc.active = false; + NPC.active = false; return; } - Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); - float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; - float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; + Vector2 vector22 = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f); + float num189 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - (float)(NPC.width / 2) - vector22.X; + float num190 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - (float)(NPC.height / 2) - vector22.Y; float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); Vector2 vector93 = new Vector2(num754, num755); - float num756 = num754 + npc.ai[0]; - float num757 = num755 + npc.ai[1]; + float num756 = num754 + NPC.ai[0]; + float num757 = num755 + NPC.ai[1]; float num758 = num756 - vector93.X; float num759 = num757 - vector93.Y; float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); num760 = num752 / num760; num758 *= num760; num759 *= num760; - if (npc.position.X < num754 + num758) + if (NPC.position.X < num754 + num758) { - npc.velocity.X = npc.velocity.X + num751; - if (npc.velocity.X < 0f && num758 > 0f) + NPC.velocity.X = NPC.velocity.X + num751; + if (NPC.velocity.X < 0f && num758 > 0f) { - npc.velocity.X = npc.velocity.X * 0.9f; + NPC.velocity.X = NPC.velocity.X * 0.9f; } } - else if (npc.position.X > num754 + num758) + else if (NPC.position.X > num754 + num758) { - npc.velocity.X = npc.velocity.X - num751; - if (npc.velocity.X > 0f && num758 < 0f) + NPC.velocity.X = NPC.velocity.X - num751; + if (NPC.velocity.X > 0f && num758 < 0f) { - npc.velocity.X = npc.velocity.X * 0.9f; + NPC.velocity.X = NPC.velocity.X * 0.9f; } } - if (npc.position.Y < num755 + num759) + if (NPC.position.Y < num755 + num759) { - npc.velocity.Y = npc.velocity.Y + num751; - if (npc.velocity.Y < 0f && num759 > 0f) + NPC.velocity.Y = NPC.velocity.Y + num751; + if (NPC.velocity.Y < 0f && num759 > 0f) { - npc.velocity.Y = npc.velocity.Y * 0.9f; + NPC.velocity.Y = NPC.velocity.Y * 0.9f; } } - else if (npc.position.Y > num755 + num759) + else if (NPC.position.Y > num755 + num759) { - npc.velocity.Y = npc.velocity.Y - num751; - if (npc.velocity.Y > 0f && num759 < 0f) + NPC.velocity.Y = NPC.velocity.Y - num751; + if (NPC.velocity.Y > 0f && num759 < 0f) { - npc.velocity.Y = npc.velocity.Y * 0.9f; + NPC.velocity.Y = NPC.velocity.Y * 0.9f; } } - if (npc.velocity.X > 8f) + if (NPC.velocity.X > 8f) { - npc.velocity.X = 8f; + NPC.velocity.X = 8f; } - if (npc.velocity.X < -8f) + if (NPC.velocity.X < -8f) { - npc.velocity.X = -8f; + NPC.velocity.X = -8f; } - if (npc.velocity.Y > 8f) + if (NPC.velocity.Y > 8f) { - npc.velocity.Y = 8f; + NPC.velocity.Y = 8f; } - if (npc.velocity.Y < -8f) + if (NPC.velocity.Y < -8f) { - npc.velocity.Y = -8f; + NPC.velocity.Y = -8f; } if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!Main.player[npc.target].dead) + if (!Main.player[NPC.target].dead) { - npc.localAI[1] += (float)Main.rand.Next(1, 6); - if (npc.localAI[1] >= 600f) + NPC.localAI[1] += (float)Main.rand.Next(1, 6); + if (NPC.localAI[1] >= 600f) { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (!Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { float num196 = 11f; - vector22 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num189 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector22.X + (float)Main.rand.Next(-10, 11); + vector22 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num189 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector22.X + (float)Main.rand.Next(-10, 11); float num197 = Math.Abs(num189 * 0.1f); if (num190 > 0f) { num197 = 0f; } - num190 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector22.Y + (float)Main.rand.Next(-10, 11) - num197; + num190 = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - vector22.Y + (float)Main.rand.Next(-10, 11) - num197; num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); num191 = num196 / num191; num189 *= num191; num190 *= num191; int num9 = ModContent.ProjectileType(); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num189, num190, num9, 40, 0f, Main.myPlayer, 0f, 0f); - npc.localAI[1] = 0f; + Projectile.NewProjectile(NPC.Center.X, NPC.Center.Y, num189, num190, num9, 40, 0f, Main.myPlayer, 0f, 0f); + NPC.localAI[1] = 0f; return; } - npc.localAI[1] = 250f; + NPC.localAI[1] = 250f; } } } @@ -178,17 +178,17 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { if (CalamityGlobalNPC.energyFlame != -1) { - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); float drawPositionX = Main.npc[CalamityGlobalNPC.energyFlame].Center.X - center.X; float drawPositionY = Main.npc[CalamityGlobalNPC.energyFlame].Center.Y - center.Y; drawPositionY += 10f; @@ -212,7 +212,7 @@ namespace CalamityMod.NPCs.NormalNPCs drawPositionY = Main.npc[CalamityGlobalNPC.energyFlame].Center.Y - center.Y; drawPositionY -= 10f; Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Texture2D chain = ModContent.GetTexture("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment"); + Texture2D chain = ModContent.Request("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment"); Main.spriteBatch.Draw(chain, new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, chain.Width, chain.Height)), color, rotation, new Vector2((float)chain.Width * 0.5f, (float)chain.Height * 0.5f), 1f, SpriteEffects.None, 0f); @@ -224,11 +224,11 @@ namespace CalamityMod.NPCs.NormalNPCs public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/Rotdog.cs b/NPCs/NormalNPCs/Rotdog.cs index 890ed7aca9..f6589fc727 100644 --- a/NPCs/NormalNPCs/Rotdog.cs +++ b/NPCs/NormalNPCs/Rotdog.cs @@ -10,33 +10,33 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Rotdog"); - Main.npcFrameCount[npc.type] = 10; + Main.npcFrameCount[NPC.type] = 10; } public override void SetDefaults() { - npc.aiStyle = 26; - npc.damage = 18; - npc.width = 46; - npc.height = 30; - npc.defense = 4; - npc.lifeMax = 60; - npc.knockBackResist = 0.3f; + NPC.aiStyle = 26; + NPC.damage = 18; + NPC.width = 46; + NPC.height = 30; + NPC.defense = 4; + NPC.lifeMax = 60; + NPC.knockBackResist = 0.3f; animationType = NPCID.Hellhound; aiType = NPCID.Wolf; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath5; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath5; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedBoss1 || spawnInfo.player.Calamity().ZoneSulphur) + if (spawnInfo.playerSafe || !NPC.downedBoss1 || spawnInfo.Player.Calamity().ZoneSulphur) { return 0f; } @@ -52,13 +52,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } @@ -66,8 +66,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { float bandageDropRate = Main.expertMode ? 0.02f : 0.01f; - DropHelper.DropItemChance(npc, ItemID.AdhesiveBandage, bandageDropRate); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 8); + DropHelper.DropItemChance(NPC, ItemID.AdhesiveBandage, bandageDropRate); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 8); } } } diff --git a/NPCs/NormalNPCs/SandTortoise.cs b/NPCs/NormalNPCs/SandTortoise.cs index 7cd11e77a2..cb608cff17 100644 --- a/NPCs/NormalNPCs/SandTortoise.cs +++ b/NPCs/NormalNPCs/SandTortoise.cs @@ -9,51 +9,51 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Sand Tortoise"); - Main.npcFrameCount[npc.type] = 8; + Main.npcFrameCount[NPC.type] = 8; } public override void SetDefaults() { - npc.npcSlots = 2f; - npc.damage = 70; - npc.aiStyle = 39; - npc.width = 46; - npc.height = 32; - npc.defense = 30; - npc.DR_NERD(0.25f); - npc.scale = 1.5f; - npc.lifeMax = 580; - npc.knockBackResist = 0.2f; + NPC.npcSlots = 2f; + NPC.damage = 70; + NPC.aiStyle = 39; + NPC.width = 46; + NPC.height = 32; + NPC.defense = 30; + NPC.DR_NERD(0.25f); + NPC.scale = 1.5f; + NPC.lifeMax = 580; + NPC.knockBackResist = 0.2f; animationType = NPCID.GiantTortoise; - npc.value = Item.buyPrice(0, 0, 15, 0); - npc.HitSound = SoundID.NPCHit24; - npc.DeathSound = SoundID.NPCDeath27; - npc.noGravity = false; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 15, 0); + NPC.HitSound = SoundID.NPCHit24; + NPC.DeathSound = SoundID.NPCDeath27; + NPC.noGravity = false; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItemChance(npc, ItemID.TurtleShell, 0.1f); + DropHelper.DropItemChance(NPC, ItemID.TurtleShell, 0.1f); } } } diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index 95874fdd22..02ca0ae911 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -6,6 +6,7 @@ using CalamityMod.World; using System; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.NormalNPCs { public class ScornEater : ModNPC @@ -13,46 +14,46 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Scorn Eater"); - Main.npcFrameCount[npc.type] = 7; + Main.npcFrameCount[NPC.type] = 7; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 3f; - npc.aiStyle = -1; - npc.damage = 90; - npc.width = 160; - npc.height = 160; - npc.defense = 38; - npc.DR_NERD(0.05f); - npc.lifeMax = 9000; - npc.knockBackResist = 0f; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 3f; + NPC.aiStyle = -1; + NPC.damage = 90; + NPC.width = 160; + NPC.height = 160; + NPC.defense = 38; + NPC.DR_NERD(0.05f); + NPC.lifeMax = 9000; + NPC.knockBackResist = 0f; aiType = -1; - npc.lavaImmune = true; - npc.value = Item.buyPrice(0, 0, 50, 0); - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/ScornDeath"); - banner = npc.type; + NPC.lavaImmune = true; + NPC.value = Item.buyPrice(0, 0, 50, 0); + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/ScornDeath"); + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { - npc.TargetClosest(true); - if ((Main.player[npc.target].position.Y > npc.position.Y + (float)npc.height && npc.velocity.Y > 0f) || (Main.player[npc.target].position.Y < npc.position.Y + (float)npc.height && npc.velocity.Y < 0f)) - npc.noTileCollide = true; + NPC.TargetClosest(true); + if ((Main.player[NPC.target].position.Y > NPC.position.Y + (float)NPC.height && NPC.velocity.Y > 0f) || (Main.player[NPC.target].position.Y < NPC.position.Y + (float)NPC.height && NPC.velocity.Y < 0f)) + NPC.noTileCollide = true; else - npc.noTileCollide = false; + NPC.noTileCollide = false; - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.ai[2] += 1f; + NPC.ai[2] += 1f; int num321 = 20; - if (npc.ai[1] == 0f) + if (NPC.ai[1] == 0f) { num321 = 12; } @@ -60,90 +61,90 @@ namespace CalamityMod.NPCs.NormalNPCs { num321 /= 4; } - if (npc.ai[2] < (float)num321) + if (NPC.ai[2] < (float)num321) { - npc.velocity.X = npc.velocity.X * 0.9f; + NPC.velocity.X = NPC.velocity.X * 0.9f; return; } - npc.ai[2] = 0f; - if (npc.direction == 0) + NPC.ai[2] = 0f; + if (NPC.direction == 0) { - npc.direction = -1; + NPC.direction = -1; } - npc.spriteDirection = npc.direction; - npc.ai[1] += 1f; - npc.ai[3] += 1f; - if (npc.ai[3] >= 4f) + NPC.spriteDirection = NPC.direction; + NPC.ai[1] += 1f; + NPC.ai[3] += 1f; + if (NPC.ai[3] >= 4f) { - npc.ai[3] = 0f; - npc.noTileCollide = true; - if (npc.ai[1] == 2f) + NPC.ai[3] = 0f; + NPC.noTileCollide = true; + if (NPC.ai[1] == 2f) { - npc.velocity.X = (float)npc.direction * 15f; + NPC.velocity.X = (float)NPC.direction * 15f; - if (Main.player[npc.target].position.Y < npc.position.Y + (float)npc.height) - npc.velocity.Y = -12f; + if (Main.player[NPC.target].position.Y < NPC.position.Y + (float)NPC.height) + NPC.velocity.Y = -12f; else - npc.velocity.Y = 12f; + NPC.velocity.Y = 12f; - npc.ai[1] = 0f; + NPC.ai[1] = 0f; } else { - npc.velocity.X = (float)npc.direction * 21f; + NPC.velocity.X = (float)NPC.direction * 21f; - if (Main.player[npc.target].position.Y < npc.position.Y + (float)npc.height) - npc.velocity.Y = -6f; + if (Main.player[NPC.target].position.Y < NPC.position.Y + (float)NPC.height) + NPC.velocity.Y = -6f; else - npc.velocity.Y = 12f; + NPC.velocity.Y = 12f; } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScornJump"), (int)npc.Center.X, (int)npc.Center.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScornJump"), (int)NPC.Center.X, (int)NPC.Center.Y); } - npc.netUpdate = true; + NPC.netUpdate = true; } else { - if (npc.direction == 1 && npc.velocity.X < 1f) + if (NPC.direction == 1 && NPC.velocity.X < 1f) { - npc.velocity.X = npc.velocity.X + 0.1f; + NPC.velocity.X = NPC.velocity.X + 0.1f; return; } - if (npc.direction == -1 && npc.velocity.X > -1f) + if (NPC.direction == -1 && NPC.velocity.X > -1f) { - npc.velocity.X = npc.velocity.X - 0.1f; + NPC.velocity.X = NPC.velocity.X - 0.1f; } } } public override void FindFrame(int frameHeight) { - npc.frameCounter += 1.0; - if (Math.Abs(npc.velocity.X) <= 1f) + NPC.frameCounter += 1.0; + if (Math.Abs(NPC.velocity.X) <= 1f) { - if (npc.frameCounter > 9.0) + if (NPC.frameCounter > 9.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 5) + if (NPC.frame.Y >= frameHeight * 5) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } else { - if (npc.frameCounter > 9.0) + if (NPC.frameCounter > 9.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y < frameHeight * 5) + if (NPC.frame.Y < frameHeight * 5) { - npc.frame.Y = frameHeight * 5; + NPC.frame.Y = frameHeight * 5; } - if (npc.frame.Y >= frameHeight * 7) + if (NPC.frame.Y >= frameHeight * 7) { - npc.frame.Y = frameHeight * 5; + NPC.frame.Y = frameHeight * 5; } } } @@ -168,33 +169,33 @@ namespace CalamityMod.NPCs.NormalNPCs public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { - npc.soundDelay = 7; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/ScornHurt"), npc.Center); + NPC.soundDelay = 7; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/ScornHurt"), NPC.Center); } for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater5"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater6"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScornEater"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScornEater2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScornEater3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScornEater4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScornEater5"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScornEater6"), 1f); } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 4); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 4); } } } diff --git a/NPCs/NormalNPCs/SeaUrchin.cs b/NPCs/NormalNPCs/SeaUrchin.cs index 8f2cc29309..7bb8224c07 100644 --- a/NPCs/NormalNPCs/SeaUrchin.cs +++ b/NPCs/NormalNPCs/SeaUrchin.cs @@ -15,29 +15,29 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 20; - npc.width = 40; - npc.height = 40; - npc.defense = 10; - npc.lifeMax = 30; - npc.knockBackResist = 0.8f; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath15; - npc.behindTiles = true; - banner = npc.type; + NPC.damage = 20; + NPC.width = 40; + NPC.height = 40; + NPC.defense = 10; + NPC.lifeMax = 30; + NPC.knockBackResist = 0.8f; + NPC.value = Item.buyPrice(0, 0, 0, 80); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath15; + NPC.behindTiles = true; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - CalamityAI.UnicornAI(npc, mod, true, npc.wet ? 9f : 4f, npc.wet ? 5.5f : 2.2f, npc.wet ? 0.09f : 0.04f, npc.wet ? -14f : -6.5f, npc.wet ? -12f : -6f, npc.wet ? -11f : -5f, npc.wet ? -10f : -4f, npc.wet ? -13f : -6f); + CalamityAI.UnicornAI(NPC, Mod, true, NPC.wet ? 9f : 4f, NPC.wet ? 5.5f : 2.2f, NPC.wet ? 0.09f : 0.04f, NPC.wet ? -14f : -6.5f, NPC.wet ? -12f : -6f, NPC.wet ? -11f : -5f, NPC.wet ? -10f : -4f, NPC.wet ? -13f : -6f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur) { return 0f; } @@ -56,20 +56,20 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 15, 25); + DropHelper.DropItem(NPC, ModContent.ItemType(), 15, 25); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 54ea70557a..e1dddcfcd6 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -14,47 +14,47 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Shockstorm Shuttle"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.npcSlots = 3f; - npc.damage = 30; - npc.width = 64; - npc.height = 38; - npc.defense = 15; - npc.DR_NERD(0.15f); - npc.lifeMax = 150; - npc.aiStyle = -1; + NPC.npcSlots = 3f; + NPC.damage = 30; + NPC.width = 64; + NPC.height = 38; + NPC.defense = 15; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 150; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = true; - banner = npc.type; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.noGravity = true; + NPC.noTileCollide = true; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void AI() { if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 60f) + NPC.localAI[0] += 1f; + if (NPC.localAI[0] >= 60f) { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.localAI[0] = 0f; + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { float projSpeed = 12f; - Vector2 npcPos = npc.Center; - float targetX = Main.player[npc.target].Center.X - npcPos.X; + Vector2 npcPos = NPC.Center; + float targetX = Main.player[NPC.target].Center.X - npcPos.X; float YAdjust = Math.Abs(targetX) * 0.1f; - float targetY = Main.player[npc.target].Center.Y - npcPos.Y - YAdjust; + float targetY = Main.player[NPC.target].Center.Y - npcPos.Y - YAdjust; Vector2 velocity = new Vector2(targetX, targetY); float targetDist = velocity.Length(); targetDist = projSpeed / targetDist; @@ -74,7 +74,7 @@ namespace CalamityMod.NPCs.NormalNPCs npcPos.Y += velocity.Y; for (int num186 = 0; num186 < 2; num186++) { - velocity = Main.player[npc.target].Center - npcPos; + velocity = Main.player[NPC.target].Center - npcPos; targetDist = velocity.Length(); targetDist = projSpeed / targetDist; velocity.X += Main.rand.Next(-20, 21); @@ -86,94 +86,94 @@ namespace CalamityMod.NPCs.NormalNPCs } } } - if (npc.localAI[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.localAI[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[3] = 1f; + NPC.localAI[3] = 1f; } - Vector2 center16 = npc.Center; - Player player8 = Main.player[npc.target]; - if (npc.target < 0 || npc.target == Main.maxPlayers || player8.dead || !player8.active) + Vector2 center16 = NPC.Center; + Player player8 = Main.player[NPC.target]; + if (NPC.target < 0 || NPC.target == Main.maxPlayers || player8.dead || !player8.active) { - npc.TargetClosest(); - player8 = Main.player[npc.target]; - npc.netUpdate = true; + NPC.TargetClosest(); + player8 = Main.player[NPC.target]; + NPC.netUpdate = true; } - if ((player8.dead || Vector2.Distance(player8.Center, center16) > 3200f) && npc.ai[0] != 1f) + if ((player8.dead || Vector2.Distance(player8.Center, center16) > 3200f) && NPC.ai[0] != 1f) { - npc.ai[0] = -1f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.netUpdate = true; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.4f; - if (npc.timeLeft > 10) + NPC.velocity.Y = NPC.velocity.Y - 0.4f; + if (NPC.timeLeft > 10) { - npc.timeLeft = 10; + NPC.timeLeft = 10; } if (!player8.dead) { - npc.timeLeft = 300; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.timeLeft = 300; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; return; } } - else if (npc.ai[0] == 0f) + else if (NPC.ai[0] == 0f) { int num1580 = 0; - if (npc.ai[3] >= 580f) + if (NPC.ai[3] >= 580f) { num1580 = 0; } - else if (npc.ai[3] >= 440f) + else if (NPC.ai[3] >= 440f) { num1580 = 5; } - else if (npc.ai[3] >= 420f) + else if (NPC.ai[3] >= 420f) { num1580 = 4; } - else if (npc.ai[3] >= 280f) + else if (NPC.ai[3] >= 280f) { num1580 = 3; } - else if (npc.ai[3] >= 260f) + else if (NPC.ai[3] >= 260f) { num1580 = 2; } - else if (npc.ai[3] >= 20f) + else if (NPC.ai[3] >= 20f) { num1580 = 1; } - npc.ai[3] += 1f; - if (npc.ai[3] >= 600f) + NPC.ai[3] += 1f; + if (NPC.ai[3] >= 600f) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; } int num1581 = num1580; - if (npc.ai[3] >= 580f) + if (NPC.ai[3] >= 580f) { num1580 = 0; } - else if (npc.ai[3] >= 440f) + else if (NPC.ai[3] >= 440f) { num1580 = 5; } - else if (npc.ai[3] >= 420f) + else if (NPC.ai[3] >= 420f) { num1580 = 4; } - else if (npc.ai[3] >= 280f) + else if (NPC.ai[3] >= 280f) { num1580 = 3; } - else if (npc.ai[3] >= 260f) + else if (NPC.ai[3] >= 260f) { num1580 = 2; } - else if (npc.ai[3] >= 20f) + else if (NPC.ai[3] >= 20f) { num1580 = 1; } @@ -181,41 +181,41 @@ namespace CalamityMod.NPCs.NormalNPCs { if (num1580 == 0) { - npc.ai[2] = 0f; + NPC.ai[2] = 0f; } if (num1580 == 1) { - npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); + NPC.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); } if (num1580 == 2) { - npc.ai[2] = 0f; + NPC.ai[2] = 0f; } - npc.netUpdate = true; + NPC.netUpdate = true; } if (num1580 == 0) { - if (npc.ai[2] == 0f) + if (NPC.ai[2] == 0f) { - npc.ai[2] = (float)(-600 * Math.Sign((center16 - player8.Center).X)); + NPC.ai[2] = (float)(-600 * Math.Sign((center16 - player8.Center).X)); } - Vector2 vector196 = player8.Center + new Vector2(npc.ai[2], -250f) - center16; + Vector2 vector196 = player8.Center + new Vector2(NPC.ai[2], -250f) - center16; if (vector196.Length() < 50f) { - npc.ai[3] = 19f; + NPC.ai[3] = 19f; } else { vector196.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector196 * 16f, 0.1f); + NPC.velocity = Vector2.Lerp(NPC.velocity, vector196 * 16f, 0.1f); } } if (num1580 == 1) { - int num1582 = (int)npc.Center.X / 16; - int num1583 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1582 = (int)NPC.Center.X / 16; + int num1583 = (int)(NPC.position.Y + (float)NPC.height) / 16; int num1584 = 0; - bool flag149 = Main.tile[num1582, num1583].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1583].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1583].type]; + bool flag149 = Main.tile[num1582, num1583].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1583].TileType] && !Main.tileSolidTop[(int)Main.tile[num1582, num1583].TileType]; if (flag149) { num1584 = 1; @@ -225,7 +225,7 @@ namespace CalamityMod.NPCs.NormalNPCs while (num1584 < 150 && num1583 + num1584 < Main.maxTilesY) { int num1585 = num1583 + num1584; - bool flag150 = Main.tile[num1582, num1585].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1585].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1585].type]; + bool flag150 = Main.tile[num1582, num1585].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1585].TileType] && !Main.tileSolidTop[(int)Main.tile[num1582, num1585].TileType]; if (flag150) { num1584--; @@ -243,25 +243,25 @@ namespace CalamityMod.NPCs.NormalNPCs { num1588 = -num1586; } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1588, 0.05f); + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, num1588, 0.05f); } else { - npc.velocity.Y = npc.velocity.Y * 0.95f; + NPC.velocity.Y = NPC.velocity.Y * 0.95f; } - npc.velocity.X = 3.5f * npc.ai[2]; + NPC.velocity.X = 3.5f * NPC.ai[2]; } if (num1580 == 2) { - if (npc.ai[2] == 0f) + if (NPC.ai[2] == 0f) { - npc.ai[2] = (float)(300 * Math.Sign((center16 - player8.Center).X)); + NPC.ai[2] = (float)(300 * Math.Sign((center16 - player8.Center).X)); } - Vector2 vector197 = player8.Center + new Vector2(npc.ai[2], -170f) - center16; - int num1589 = (int)npc.Center.X / 16; - int num1590 = (int)(npc.position.Y + (float)npc.height) / 16; + Vector2 vector197 = player8.Center + new Vector2(NPC.ai[2], -170f) - center16; + int num1589 = (int)NPC.Center.X / 16; + int num1590 = (int)(NPC.position.Y + (float)NPC.height) / 16; int num1591 = 0; - bool flag151 = Main.tile[num1589, num1590].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1590].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1590].type]; + bool flag151 = Main.tile[num1589, num1590].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1590].TileType] && !Main.tileSolidTop[(int)Main.tile[num1589, num1590].TileType]; if (flag151) { num1591 = 1; @@ -271,7 +271,7 @@ namespace CalamityMod.NPCs.NormalNPCs while (num1591 < 150 && num1590 + num1591 < Main.maxTilesY) { int num1592 = num1590 + num1591; - bool flag152 = Main.tile[num1589, num1592].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1592].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1592].type]; + bool flag152 = Main.tile[num1589, num1592].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1592].TileType] && !Main.tileSolidTop[(int)Main.tile[num1589, num1592].TileType]; if (flag152) { num1591--; @@ -288,21 +288,21 @@ namespace CalamityMod.NPCs.NormalNPCs } if (vector197.Length() < 70f) { - npc.ai[3] = 279f; + NPC.ai[3] = 279f; } else { vector197.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector197 * 20f, 0.1f); + NPC.velocity = Vector2.Lerp(NPC.velocity, vector197 * 20f, 0.1f); } } else if (num1580 == 3) { float num1595 = 0.85f; - int num1596 = (int)npc.Center.X / 16; - int num1597 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1596 = (int)NPC.Center.X / 16; + int num1597 = (int)(NPC.position.Y + (float)NPC.height) / 16; int num1598 = 0; - bool flag153 = Main.tile[num1596, num1597].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1597].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1597].type]; + bool flag153 = Main.tile[num1596, num1597].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1597].TileType] && !Main.tileSolidTop[(int)Main.tile[num1596, num1597].TileType]; if (flag153) { num1598 = 1; @@ -312,7 +312,7 @@ namespace CalamityMod.NPCs.NormalNPCs while (num1598 < 150 && num1597 + num1598 < Main.maxTilesY) { int num1599 = num1597 + num1598; - bool flag154 = Main.tile[num1596, num1599].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1599].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1599].type]; + bool flag154 = Main.tile[num1596, num1599].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1599].TileType] && !Main.tileSolidTop[(int)Main.tile[num1596, num1599].TileType]; if (flag154) { num1598--; @@ -330,29 +330,29 @@ namespace CalamityMod.NPCs.NormalNPCs { num1602 = -num1600; } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1602, 0.05f); + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, num1602, 0.05f); } else { - npc.velocity.Y = npc.velocity.Y * num1595; + NPC.velocity.Y = NPC.velocity.Y * num1595; } - npc.velocity.X = npc.velocity.X * num1595; + NPC.velocity.X = NPC.velocity.X * num1595; } if (num1580 == 4) { Vector2 vector198 = player8.Center + new Vector2(0f, -250f) - center16; if (vector198.Length() < 50f) { - npc.ai[3] = 439f; + NPC.ai[3] = 439f; return; } vector198.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector198 * 16f, 0.1f); + NPC.velocity = Vector2.Lerp(NPC.velocity, vector198 * 16f, 0.1f); return; } else if (num1580 == 5) { - npc.velocity *= 0.85f; + NPC.velocity *= 0.85f; return; } } @@ -360,23 +360,23 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 234, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 234, hitDirection, -1f, 0, default, 1f); } } } @@ -392,9 +392,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ItemID.MartianConduitPlating, NPC.downedGolemBoss, 1, 10, 30); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ItemID.MartianConduitPlating, NPC.downedGolemBoss, 1, 10, 30); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/StormlionCharger.cs b/NPCs/NormalNPCs/StormlionCharger.cs index 19970b6109..a40760e2c5 100644 --- a/NPCs/NormalNPCs/StormlionCharger.cs +++ b/NPCs/NormalNPCs/StormlionCharger.cs @@ -11,52 +11,52 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Stormlion"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.damage = 20; - npc.aiStyle = 3; - npc.width = 33; - npc.height = 31; - npc.defense = 8; - npc.lifeMax = 80; - npc.knockBackResist = 0.2f; + NPC.damage = 20; + NPC.aiStyle = 3; + NPC.width = 33; + NPC.height = 31; + NPC.defense = 8; + NPC.lifeMax = 80; + NPC.knockBackResist = 0.2f; animationType = NPCID.WalkingAntlion; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit31; - npc.DeathSound = SoundID.NPCDeath34; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.HitSound = SoundID.NPCHit31; + NPC.DeathSound = SoundID.NPCDeath34; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = false; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = false; + NPC.Calamity().VulnerableToWater = true; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/StormlionGores/Stormlion"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/StormlionGores/Stormlion2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/StormlionGores/Stormlion3"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/StormlionGores/Stormlion4"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/StormlionGores/Stormlion"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/StormlionGores/Stormlion2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/StormlionGores/Stormlion3"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/StormlionGores/Stormlion4"), NPC.scale); } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -70,8 +70,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.2f, 1, 1); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 1f, 1, 1); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.2f, 1, 1); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 1f, 1, 1); } } } diff --git a/NPCs/NormalNPCs/SunBat.cs b/NPCs/NormalNPCs/SunBat.cs index 8ef4c9db44..358f05461d 100644 --- a/NPCs/NormalNPCs/SunBat.cs +++ b/NPCs/NormalNPCs/SunBat.cs @@ -11,55 +11,55 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Sun Bat"); - Main.npcFrameCount[npc.type] = 7; + Main.npcFrameCount[NPC.type] = 7; } public override void SetDefaults() { - npc.lavaImmune = true; - npc.aiStyle = -1; + NPC.lavaImmune = true; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 35; - npc.width = 26; - npc.height = 20; - npc.defense = 10; - npc.lifeMax = 200; - npc.knockBackResist = 0.65f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath4; - banner = npc.type; + NPC.damage = 35; + NPC.width = 26; + NPC.height = 20; + NPC.defense = 10; + NPC.lifeMax = 200; + NPC.knockBackResist = 0.65f; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath4; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { - CalamityGlobalAI.BuffedBatAI(npc, mod); + CalamityGlobalAI.BuffedBatAI(NPC, Mod); } public override void FindFrame(int frameHeight) { - if (npc.velocity.X > 0f) - npc.spriteDirection = 1; - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; + if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.Player.Calamity().ZoneAbyss || + spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -75,20 +75,20 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 64, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 64, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3); } } } diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index 4fca8e71bf..62c83a8b9c 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -16,124 +16,124 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Sunskater"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.noGravity = true; - npc.lavaImmune = true; - npc.damage = 20; - npc.width = 58; - npc.height = 22; - npc.defense = 4; - npc.lifeMax = 100; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.lavaImmune = true; + NPC.damage = 20; + NPC.width = 58; + NPC.height = 22; + NPC.defense = 4; + NPC.lifeMax = 100; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit50; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/Sunskater"); - npc.knockBackResist = 0.7f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit50; + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/Sunskater"); + NPC.knockBackResist = 0.7f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(hasBeenHit); - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - npc.noGravity = true; - if (npc.direction == 0) + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + NPC.noGravity = true; + if (NPC.direction == 0) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - if (npc.justHit) + if (NPC.justHit) { hasBeenHit = true; } - npc.chaseable = hasBeenHit; - if (!npc.wet) + NPC.chaseable = hasBeenHit; + if (!NPC.wet) { bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if ((Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) + NPC.TargetClosest(false); + if ((Main.player[NPC.target].wet || Main.player[NPC.target].dead) && flag14) { flag14 = false; } if (!flag14) { - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; + NPC.netUpdate = true; } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } } if (flag14) { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.15f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; - npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -10f, 10f); - npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y, -10f, 10f); + NPC.TargetClosest(true); + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.15f; + NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * 0.15f; + NPC.velocity.X = MathHelper.Clamp(NPC.velocity.X, -10f, 10f); + NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y, -10f, 10f); } else { - npc.velocity.X += (float)npc.direction * 0.1f; - if (npc.velocity.X < -2f || npc.velocity.X > 2f) + NPC.velocity.X += (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -2f || NPC.velocity.X > 2f) { - npc.velocity.X *= 0.95f; + NPC.velocity.X *= 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y -= 0.01f; - if (npc.velocity.Y < -0.3f) + NPC.velocity.Y -= 0.01f; + if (NPC.velocity.Y < -0.3f) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y += 0.01f; - if (npc.velocity.Y > 0.3f) + NPC.velocity.Y += 0.01f; + if (NPC.velocity.Y > 0.3f) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num258 = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int num259 = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; if (Main.tile[num258, num259 - 1] == null) { Main.tile[num258, num259 - 1] = new Tile(); @@ -150,43 +150,43 @@ namespace CalamityMod.NPCs.NormalNPCs { if (Main.tile[num258, num259 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num258, num259 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) + if (NPC.velocity.Y > 0.4f || NPC.velocity.Y < -0.4f) { - npc.velocity.Y *= 0.95f; + NPC.velocity.Y *= 0.95f; } } else { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.velocity.X *= 0.94f; - if (npc.velocity.X > -0.2f && npc.velocity.X < 0.2f) + NPC.velocity.X *= 0.94f; + if (NPC.velocity.X > -0.2f && NPC.velocity.X < 0.2f) { - npc.velocity.X = 0f; + NPC.velocity.X = 0f; } } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 5f) + NPC.velocity.Y = NPC.velocity.Y + 0.3f; + if (NPC.velocity.Y > 5f) { - npc.velocity.Y = 5f; + NPC.velocity.Y = 5f; } - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.1) + NPC.rotation = NPC.velocity.Y * (float)NPC.direction * 0.1f; + if ((double)NPC.rotation < -0.1) { - npc.rotation = -0.1f; + NPC.rotation = -0.1f; } - if ((double)npc.rotation > 0.1) + if ((double)NPC.rotation > 0.1) { - npc.rotation = 0.1f; + NPC.rotation = 0.1f; return; } } @@ -202,10 +202,10 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - npc.frameCounter += hasBeenHit ? 0.15f : 0.075f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += hasBeenHit ? 0.15f : 0.075f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -224,20 +224,20 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 3, 1, 1); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 64, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 64, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/SuperDummyNPC.cs b/NPCs/NormalNPCs/SuperDummyNPC.cs index 34ae1fb189..744c1a3b20 100644 --- a/NPCs/NormalNPCs/SuperDummyNPC.cs +++ b/NPCs/NormalNPCs/SuperDummyNPC.cs @@ -12,22 +12,22 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - npc.width = 18; - npc.height = 48; - npc.damage = 0; - npc.defense = 0; - npc.lifeMax = 9999999; - npc.HitSound = SoundID.NPCHit15; - npc.DeathSound = SoundID.NPCDeath2; - npc.value = 0f; - npc.knockBackResist = 0f; - npc.netAlways = true; - npc.aiStyle = 0; + NPC.width = 18; + NPC.height = 48; + NPC.damage = 0; + NPC.defense = 0; + NPC.lifeMax = 9999999; + NPC.HitSound = SoundID.NPCHit15; + NPC.DeathSound = SoundID.NPCDeath2; + NPC.value = 0f; + NPC.knockBackResist = 0f; + NPC.netAlways = true; + NPC.aiStyle = 0; } public override void UpdateLifeRegen(ref int damage) { - npc.lifeRegen += 2000000; + NPC.lifeRegen += 2000000; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -37,9 +37,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override bool CheckDead() { - if (npc.lifeRegen < 0) + if (NPC.lifeRegen < 0) { - npc.life = npc.lifeMax; + NPC.life = NPC.lifeMax; return false; } return true; diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index a5e0ce1fd4..c5818c5123 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -10,6 +10,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.NormalNPCs { @@ -25,60 +26,60 @@ namespace CalamityMod.NPCs.NormalNPCs NimbusSummon } - public Player Target => Main.player[npc.target]; + public Player Target => Main.player[NPC.target]; public AttackState CurrentAttackState { - get => (AttackState)(int)npc.ai[0]; + get => (AttackState)(int)NPC.ai[0]; set { - if (npc.ai[0] != (int)value) + if (NPC.ai[0] != (int)value) { - npc.ai[0] = (int)value; - npc.netUpdate = true; + NPC.ai[0] = (int)value; + NPC.netUpdate = true; } } } - public bool Phase2 => npc.life < npc.lifeMax * 0.5f; - public ref float AttackTimer => ref npc.ai[1]; + public bool Phase2 => NPC.life < NPC.lifeMax * 0.5f; + public ref float AttackTimer => ref NPC.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Cloud Elemental"); - Main.npcFrameCount[npc.type] = 8; + Main.npcFrameCount[NPC.type] = 8; } public override void SetDefaults() { - npc.npcSlots = 3f; - npc.damage = 38; - npc.width = 80; - npc.height = 140; - npc.defense = 18; - npc.DR_NERD(0.05f); - npc.lifeMax = 6000; - npc.knockBackResist = 0.05f; - npc.value = Item.buyPrice(0, 1, 50, 0); - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = true; - npc.rarity = 2; - banner = npc.type; + NPC.npcSlots = 3f; + NPC.damage = 38; + NPC.width = 80; + NPC.height = 140; + NPC.defense = 18; + NPC.DR_NERD(0.05f); + NPC.lifeMax = 6000; + NPC.knockBackResist = 0.05f; + NPC.value = Item.buyPrice(0, 1, 50, 0); + NPC.HitSound = SoundID.NPCHit23; + NPC.DeathSound = SoundID.NPCDeath39; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.rarity = 2; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = false; - npc.Calamity().VulnerableToWater = false; - npc.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = false; + NPC.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; } public override void AI() { // Emit light. - Lighting.AddLight((int)(npc.Center.X / 16), (int)(npc.Center.Y / 16), 0.375f, 0.5f, 0.625f); + Lighting.AddLight((int)(NPC.Center.X / 16), (int)(NPC.Center.Y / 16), 0.375f, 0.5f, 0.625f); // Get a new target if the current one is dead. - if (Target.dead || !Target.active || !Main.player.IndexInRange(npc.target)) - npc.TargetClosest(); + if (Target.dead || !Target.active || !Main.player.IndexInRange(NPC.target)) + NPC.TargetClosest(); switch (CurrentAttackState) { @@ -106,7 +107,7 @@ namespace CalamityMod.NPCs.NormalNPCs public void DoBehavior_Hover() { - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; int hoverTime = (int)MathHelper.Lerp(330f, 180f, 1f - lifeRatio); float hoverAcceleration = MathHelper.Lerp(0.2f, 0.425f, 1f - lifeRatio); Vector2 hoverSpeed = new Vector2(8.5f, 4.5f); @@ -115,7 +116,7 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int i = 0; i < 2; i++) { - Dust cloudDust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 16); + Dust cloudDust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 16); cloudDust.velocity = Main.rand.NextVector2CircularEdge(4f, 4f); cloudDust.velocity.Y /= 3f; cloudDust.scale = Main.rand.NextFloat(1.15f, 1.35f); @@ -125,16 +126,16 @@ namespace CalamityMod.NPCs.NormalNPCs if (AttackTimer < hoverTime - 30) { - Vector2 idealVelocity = npc.SafeDirectionTo(Target.Center) * hoverSpeed; + Vector2 idealVelocity = NPC.SafeDirectionTo(Target.Center) * hoverSpeed; - if (Math.Abs(npc.Center.X - Target.Center.X) > 30f) + if (Math.Abs(NPC.Center.X - Target.Center.X) > 30f) { - npc.SimpleFlyMovement(idealVelocity, hoverAcceleration); - npc.spriteDirection = (npc.velocity.X > 0).ToDirectionInt(); + NPC.SimpleFlyMovement(idealVelocity, hoverAcceleration); + NPC.spriteDirection = (NPC.velocity.X > 0).ToDirectionInt(); } } else - npc.velocity *= 0.95f; + NPC.velocity *= 0.95f; if (AttackTimer >= hoverTime) { @@ -161,7 +162,7 @@ namespace CalamityMod.NPCs.NormalNPCs CurrentAttackState = Main.rand.Next(potentialAttackStates); AttackTimer = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } @@ -175,17 +176,17 @@ namespace CalamityMod.NPCs.NormalNPCs { float fadeoutCompletion = Utils.InverseLerp(0f, teleportFadeoutTime, AttackTimer, true); float particleSpawnRate = MathHelper.Clamp(fadeoutCompletion + 0.6f, 0.5f, 1f); - npc.Opacity = MathHelper.Lerp(1f, 0f, fadeoutCompletion); + NPC.Opacity = MathHelper.Lerp(1f, 0f, fadeoutCompletion); if (Main.rand.NextFloat() < particleSpawnRate && !Main.dedServ) { - Dust.NewDustDirect(npc.position, npc.width, npc.height, 16); + Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 16); if (Main.rand.NextBool(15)) { int smokeType = Utils.SelectRandom(Main.rand, GoreID.ChimneySmoke1, GoreID.ChimneySmoke2, GoreID.ChimneySmoke3); Vector2 smokeVelocity = Main.rand.NextVector2CircularEdge(6f, 6f); - Gore.NewGorePerfect(npc.Center + Main.rand.NextVector2Circular(40f, 40f), smokeVelocity, smokeType); + Gore.NewGorePerfect(NPC.Center + Main.rand.NextVector2Circular(40f, 40f), smokeVelocity, smokeType); } } } @@ -194,8 +195,8 @@ namespace CalamityMod.NPCs.NormalNPCs if (AttackTimer == teleportFadeoutTime) { float teleportRadius = 420f; - npc.Center = Target.Center + Main.rand.NextVector2CircularEdge(teleportRadius, teleportRadius); - npc.netUpdate = true; + NPC.Center = Target.Center + Main.rand.NextVector2CircularEdge(teleportRadius, teleportRadius); + NPC.netUpdate = true; } // Fade in and release some particles. @@ -203,17 +204,17 @@ namespace CalamityMod.NPCs.NormalNPCs { float fadeinCompletion = Utils.InverseLerp(teleportFadeoutTime, teleportFadeoutTime + teleportFadeinTime, AttackTimer, true); float particleSpawnRate = MathHelper.Clamp(fadeinCompletion + 0.6f, 0.5f, 1f); - npc.Opacity = fadeinCompletion; + NPC.Opacity = fadeinCompletion; if (Main.rand.NextFloat() < particleSpawnRate && !Main.dedServ) - Dust.NewDustDirect(npc.position, npc.width, npc.height, 16); + Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 16); } if (AttackTimer >= teleportFadeoutTime + teleportFadeinTime) { CurrentAttackState = AttackState.Hover; AttackTimer = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } @@ -231,7 +232,7 @@ namespace CalamityMod.NPCs.NormalNPCs } // Slow down. - npc.velocity *= 0.96f; + NPC.velocity *= 0.96f; // And create lightning clouds. if (AttackTimer > cloudSummonDelay) @@ -241,9 +242,9 @@ namespace CalamityMod.NPCs.NormalNPCs int projectileType = ModContent.ProjectileType(); float cloudSpawnOutwardness = (AttackTimer - cloudSummonDelay) / cloudSummonRate * 50f; - Vector2 spawnPosition = npc.Top + new Vector2(cloudSpawnOutwardness, -36); + Vector2 spawnPosition = NPC.Top + new Vector2(cloudSpawnOutwardness, -36); Projectile.NewProjectileDirect(spawnPosition, Vector2.Zero, projectileType, lightningDamage, 0f, Main.myPlayer); - spawnPosition = npc.Top + new Vector2(-cloudSpawnOutwardness, -36); + spawnPosition = NPC.Top + new Vector2(-cloudSpawnOutwardness, -36); Projectile.NewProjectileDirect(spawnPosition, Vector2.Zero, projectileType, lightningDamage, 0f, Main.myPlayer); } } @@ -252,7 +253,7 @@ namespace CalamityMod.NPCs.NormalNPCs { CurrentAttackState = AttackState.Hover; AttackTimer = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } @@ -262,7 +263,7 @@ namespace CalamityMod.NPCs.NormalNPCs int totalTornadosToSummon = Phase2 ? 8 : 5; // Slow down. - npc.velocity *= 0.96f; + NPC.velocity *= 0.96f; // And create tornadoes. if (Main.netMode != NetmodeID.MultiplayerClient && AttackTimer == tornadoSpawnDelay) @@ -280,7 +281,7 @@ namespace CalamityMod.NPCs.NormalNPCs { CurrentAttackState = AttackState.Hover; AttackTimer = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } @@ -297,16 +298,16 @@ namespace CalamityMod.NPCs.NormalNPCs // Slow down in anticipation of the summoning. if (AttackTimer < nimbusSummonDelay) - npc.velocity *= 0.92f; + NPC.velocity *= 0.92f; // Summon a circle of nimbi. else if ((AttackTimer - nimbusSummonDelay) % nimbusSummonRate == nimbusSummonRate - 1) { - Point spawnPosition = (npc.Center + npc.ai[2].ToRotationVector2() * 300f).ToPoint(); + Point spawnPosition = (NPC.Center + NPC.ai[2].ToRotationVector2() * 300f).ToPoint(); if (Main.netMode != NetmodeID.MultiplayerClient) { Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(spawnPosition.X, spawnPosition.Y); - if (!(tileAtPosition.active() && Main.tileSolid[tileAtPosition.type])) + if (!(tileAtPosition.active() && Main.tileSolid[tileAtPosition.TileType])) NPC.NewNPC(spawnPosition.X, spawnPosition.Y, NPCID.AngryNimbus); } @@ -316,18 +317,18 @@ namespace CalamityMod.NPCs.NormalNPCs for (int i = 0; i < 20; i++) Dust.NewDustDirect(spawnPosition.ToVector2(), -20, 20, 16); - Main.PlaySound(SoundID.Item122, spawnPosition.ToVector2()); + SoundEngine.PlaySound(SoundID.Item122, spawnPosition.ToVector2()); } - npc.ai[2] += MathHelper.TwoPi / totalNimbiToSummon; + NPC.ai[2] += MathHelper.TwoPi / totalNimbiToSummon; } // Return to hovering after the nimbi have been summoned. if (AttackTimer >= nimbusSummonRate * totalNimbiToSummon) { - npc.ai[2] = 0f; + NPC.ai[2] = 0f; CurrentAttackState = AttackState.Hover; AttackTimer = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } @@ -340,47 +341,47 @@ namespace CalamityMod.NPCs.NormalNPCs // Slow down. if (AttackTimer % (sliceChargeTime + sliceChargeDelay) < sliceChargeDelay) - npc.velocity *= 0.92f; + NPC.velocity *= 0.92f; // And charge. if (AttackTimer % (sliceChargeTime + sliceChargeDelay) == sliceChargeDelay) { - npc.damage = npc.defDamage * 2; - npc.velocity = npc.SafeDirectionTo(Target.Center) * sliceChargeSpeed; - npc.spriteDirection = (npc.velocity.X > 0).ToDirectionInt(); - npc.netUpdate = true; + NPC.damage = NPC.defDamage * 2; + NPC.velocity = NPC.SafeDirectionTo(Target.Center) * sliceChargeSpeed; + NPC.spriteDirection = (NPC.velocity.X > 0).ToDirectionInt(); + NPC.netUpdate = true; } if (AttackTimer >= (sliceChargeTime + sliceChargeDelay) * totalSlices) { - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; CurrentAttackState = AttackState.Hover; AttackTimer = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Texture2D texture = ModContent.GetTexture("CalamityMod/NPCs/NormalNPCs/ThiccWaifuAttack"); + Texture2D texture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/ThiccWaifuAttack"); if (CurrentAttackState != AttackState.Hover) - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); + CalamityMod.DrawTexture(spriteBatch, texture, 0, NPC, drawColor); else - CalamityMod.DrawTexture(spriteBatch, Main.npcTexture[npc.type], 0, npc, drawColor); + CalamityMod.DrawTexture(spriteBatch, Main.npcTexture[NPC.type], 0, NPC, drawColor); return false; } public override void FindFrame(int frameHeight) { - npc.frameCounter = npc.frameCounter + MathHelper.Max(npc.velocity.Length() * 0.1f, 0.6f) + 1.0; - if (npc.frameCounter >= (CurrentAttackState != AttackState.Hover ? 16.0 : 8.0)) + NPC.frameCounter = NPC.frameCounter + MathHelper.Max(NPC.velocity.Length() * 0.1f, 0.6f) + 1.0; + if (NPC.frameCounter >= (CurrentAttackState != AttackState.Hover ? 16.0 : 8.0)) { - npc.frame.Y += frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 8) - npc.frame.Y = 0; + if (NPC.frame.Y >= frameHeight * 8) + NPC.frame.Y = 0; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -399,20 +400,20 @@ namespace CalamityMod.NPCs.NormalNPCs public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 16, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 16, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 50; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 16, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 16, hitDirection, -1f, 0, default, 1f); } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), Main.expertMode ? 3 : 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 5); } } } diff --git a/NPCs/NormalNPCs/WildBumblefuck.cs b/NPCs/NormalNPCs/WildBumblefuck.cs index 2e61ec12db..47581b9621 100644 --- a/NPCs/NormalNPCs/WildBumblefuck.cs +++ b/NPCs/NormalNPCs/WildBumblefuck.cs @@ -12,37 +12,37 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Draconic Swarmer"); - Main.npcFrameCount[npc.type] = 5; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 5; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly"; public override void SetDefaults() { - npc.npcSlots = 1f; - npc.aiStyle = -1; + NPC.npcSlots = 1f; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 90; - npc.width = 120; - npc.height = 80; - npc.defense = 20; - npc.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000 - npc.knockBackResist = 0f; - npc.lavaImmune = true; - npc.noTileCollide = true; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit51; - npc.DeathSound = SoundID.NPCDeath46; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.damage = 90; + NPC.width = 120; + NPC.height = 80; + NPC.defense = 20; + NPC.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000 + NPC.knockBackResist = 0f; + NPC.lavaImmune = true; + NPC.noTileCollide = true; + NPC.noGravity = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit51; + NPC.DeathSound = SoundID.NPCDeath46; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedMoonlord || spawnInfo.player.Calamity().ZoneSunkenSea || NPC.AnyNPCs(npc.type)) + if (spawnInfo.playerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneSunkenSea || NPC.AnyNPCs(NPC.type)) { return 0f; } @@ -51,40 +51,40 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - CalamityAI.Bumblebirb2AI(npc, mod, false); + CalamityAI.Bumblebirb2AI(NPC, Mod, false); } public override bool PreNPCLoot() { - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 2, 4); + DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 2, 4); return false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += npc.ai[0] == 2.1f ? 1.5 : 1D; - if (npc.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base + NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D; + if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base { - npc.frameCounter = 0D; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y >= frameHeight * 4) + if (NPC.frame.Y >= frameHeight * 4) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); Color color36 = Color.Gold; float amount9 = 0.5f; - int num153 = npc.ai[0] == 2.1f ? 7 : 0; + int num153 = NPC.ai[0] == 2.1f ? 7 : 0; if (CalamityConfig.Instance.Afterimages) { @@ -92,19 +92,19 @@ namespace CalamityMod.NPCs.NormalNPCs { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -119,13 +119,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 244, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 244, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index 47a505aac6..93b7f4e317 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -19,57 +19,57 @@ namespace CalamityMod.NPCs.NormalNPCs { internal DroneAIState AIState { - get => (DroneAIState)(int)npc.ai[0]; - set => npc.ai[0] = (int)value; + get => (DroneAIState)(int)NPC.ai[0]; + set => NPC.ai[0] = (int)value; } public float HorizontalChargeTime { - get => npc.ai[1]; - set => npc.ai[1] = value; + get => NPC.ai[1]; + set => NPC.ai[1] = value; } public float Time { - get => npc.ai[2]; - set => npc.ai[2] = value; + get => NPC.ai[2]; + set => NPC.ai[2] = value; } public float SuperchargeTimer { - get => npc.ai[3]; - set => npc.ai[3] = value; + get => NPC.ai[3]; + set => NPC.ai[3] = value; } public bool Supercharged => SuperchargeTimer > 0; - public ref float FlyAwayTimer => ref npc.localAI[0]; + public ref float FlyAwayTimer => ref NPC.localAI[0]; public const float TotalHorizontalChargeTime = 75f; public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Drone"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { aiType = -1; - npc.aiStyle = -1; - npc.damage = 16; - npc.width = 32; - npc.height = 32; - npc.defense = 4; - npc.lifeMax = 21; - npc.knockBackResist = 0.35f; - npc.value = Item.buyPrice(0, 0, 1, 20); - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - banner = npc.type; + NPC.aiStyle = -1; + NPC.damage = 16; + NPC.width = 32; + NPC.height = 32; + NPC.defense = 4; + NPC.lifeMax = 21; + NPC.knockBackResist = 0.35f; + NPC.value = Item.buyPrice(0, 0, 1, 20); + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(FlyAwayTimer); @@ -78,32 +78,32 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - npc.TargetClosest(false); + NPC.TargetClosest(false); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; - bool farFromPlayer = npc.Distance(player.Center) > 960f; - bool obstanceInFrontOfPlayer = !Collision.CanHitLine(npc.position, npc.width, npc.height, player.position, player.width, player.height); + bool farFromPlayer = NPC.Distance(player.Center) > 960f; + bool obstanceInFrontOfPlayer = !Collision.CanHitLine(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); - if (npc.target < 0 || npc.target >= 255 || farFromPlayer || obstanceInFrontOfPlayer || player.dead || !player.active) + if (NPC.target < 0 || NPC.target >= 255 || farFromPlayer || obstanceInFrontOfPlayer || player.dead || !player.active) { - npc.TargetClosest(false); - player = Main.player[npc.target]; - farFromPlayer = npc.Distance(player.Center) > 960f; - obstanceInFrontOfPlayer = !Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height); + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + farFromPlayer = NPC.Distance(player.Center) > 960f; + obstanceInFrontOfPlayer = !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); // Fly away if there is no living target, or the closest target is too far away. if (player.dead || !player.active || farFromPlayer || obstanceInFrontOfPlayer) { if (FlyAwayTimer > 360) { - npc.velocity = Vector2.Lerp(npc.velocity, Vector2.UnitY * -8f, 0.1f); - npc.rotation = npc.rotation.AngleTowards(0f, MathHelper.ToRadians(15f)); - npc.noTileCollide = true; + NPC.velocity = Vector2.Lerp(NPC.velocity, Vector2.UnitY * -8f, 0.1f); + NPC.rotation = NPC.rotation.AngleTowards(0f, MathHelper.ToRadians(15f)); + NPC.noTileCollide = true; } else { - npc.velocity *= 0.96f; - npc.rotation = npc.rotation.AngleTowards(0f, MathHelper.ToRadians(15f)); + NPC.velocity *= 0.96f; + NPC.rotation = NPC.rotation.AngleTowards(0f, MathHelper.ToRadians(15f)); FlyAwayTimer++; } return; @@ -112,7 +112,7 @@ namespace CalamityMod.NPCs.NormalNPCs FlyAwayTimer = Utils.Clamp(FlyAwayTimer - 3, 0, 180); - npc.noTileCollide = !farFromPlayer; + NPC.noTileCollide = !farFromPlayer; if (Supercharged) { @@ -121,47 +121,47 @@ namespace CalamityMod.NPCs.NormalNPCs if (AIState == DroneAIState.Searching) { - if (npc.direction == 0) - npc.direction = 1; + if (NPC.direction == 0) + NPC.direction = 1; - Vector2 destination = player.Center + new Vector2(300f * npc.direction, -90f); - npc.velocity = Vector2.Lerp(npc.velocity, npc.SafeDirectionTo(destination) * 6f, 0.1f); - if (npc.Distance(destination) < 40f) + Vector2 destination = player.Center + new Vector2(300f * NPC.direction, -90f); + NPC.velocity = Vector2.Lerp(NPC.velocity, NPC.SafeDirectionTo(destination) * 6f, 0.1f); + if (NPC.Distance(destination) < 40f) { Time++; - npc.velocity *= 0.95f; + NPC.velocity *= 0.95f; if (Time >= 40f) { AIState = DroneAIState.Charging; - npc.netUpdate = true; + NPC.netUpdate = true; } } } else { if (HorizontalChargeTime < 25) - npc.velocity = Vector2.Lerp(npc.velocity, npc.SafeDirectionTo(player.Center) * 6f, 0.1f); + NPC.velocity = Vector2.Lerp(NPC.velocity, NPC.SafeDirectionTo(player.Center) * 6f, 0.1f); if (Supercharged && Main.netMode != NetmodeID.MultiplayerClient && HorizontalChargeTime % 30f == 29f) - Projectile.NewProjectile(npc.Center + Vector2.UnitX * 6f * npc.spriteDirection, npc.SafeDirectionTo(player.Center, Vector2.UnitY) * 6f, ProjectileID.SaucerLaser, 12, 0f); + Projectile.NewProjectile(NPC.Center + Vector2.UnitX * 6f * NPC.spriteDirection, NPC.SafeDirectionTo(player.Center, Vector2.UnitY) * 6f, ProjectileID.SaucerLaser, 12, 0f); HorizontalChargeTime++; if (HorizontalChargeTime > TotalHorizontalChargeTime) { AIState = DroneAIState.Searching; HorizontalChargeTime = 0f; - npc.direction = (player.Center.X - npc.Center.X < 0).ToDirectionInt(); - npc.netUpdate = true; + NPC.direction = (player.Center.X - NPC.Center.X < 0).ToDirectionInt(); + NPC.netUpdate = true; } } - npc.spriteDirection = (npc.velocity.X < 0).ToDirectionInt(); - npc.rotation = npc.velocity.X / 25f; + NPC.spriteDirection = (NPC.velocity.X < 0).ToDirectionInt(); + NPC.rotation = NPC.velocity.X / 25f; // Generate idle dust if (!Main.dedServ) { - Dust dust = Dust.NewDustPerfect(npc.Bottom, 229); + Dust dust = Dust.NewDustPerfect(NPC.Bottom, 229); dust.color = Color.Green; dust.scale = 0.675f; } @@ -169,18 +169,18 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - npc.frameCounter++; - int frame = (int)(npc.frameCounter / 5) % (Main.npcFrameCount[npc.type] / 2); + NPC.frameCounter++; + int frame = (int)(NPC.frameCounter / 5) % (Main.npcFrameCount[NPC.type] / 2); if (Supercharged) - frame += Main.npcFrameCount[npc.type] / 2; + frame += Main.npcFrameCount[NPC.type] / 2; - npc.frame.Y = frame * frameHeight; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur) return 0f; return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.010f : 0.1f) * pylonMult; @@ -190,23 +190,23 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.GrassBlades, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GrassBlades, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.GrassBlades, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GrassBlades, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 1, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.07f); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Supercharged); + DropHelper.DropItem(NPC, ModContent.ItemType(), 1, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.07f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Supercharged); } } } diff --git a/NPCs/NormalNPCs/WulfrumGyrator.cs b/NPCs/NormalNPCs/WulfrumGyrator.cs index 7210cd45b6..d33247d5c7 100644 --- a/NPCs/NormalNPCs/WulfrumGyrator.cs +++ b/NPCs/NormalNPCs/WulfrumGyrator.cs @@ -13,14 +13,14 @@ namespace CalamityMod.NPCs.NormalNPCs { public float TimeSpentStuck { - get => npc.ai[0]; - set => npc.ai[0] = value; + get => NPC.ai[0]; + set => NPC.ai[0] = value; } public float SuperchargeTimer { - get => npc.ai[3]; - set => npc.ai[3] = value; + get => NPC.ai[3]; + set => NPC.ai[3] = value; } public bool Supercharged => SuperchargeTimer > 0; @@ -35,114 +35,114 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Gyrator"); - Main.npcFrameCount[npc.type] = 10; + Main.npcFrameCount[NPC.type] = 10; } public override void SetDefaults() { aiType = -1; - npc.aiStyle = -1; - npc.damage = 15; - npc.width = 40; - npc.height = 40; - npc.defense = 5; - npc.lifeMax = 18; - npc.knockBackResist = 0.15f; - npc.value = Item.buyPrice(0, 0, 1, 15); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - banner = npc.type; + NPC.aiStyle = -1; + NPC.damage = 15; + NPC.width = 40; + NPC.height = 40; + NPC.defense = 5; + NPC.lifeMax = 18; + NPC.knockBackResist = 0.15f; + NPC.value = Item.buyPrice(0, 0, 1, 15); + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - int frame = (int)(npc.frameCounter / 5) % (Main.npcFrameCount[npc.type] / 2); + NPC.frameCounter++; + int frame = (int)(NPC.frameCounter / 5) % (Main.npcFrameCount[NPC.type] / 2); if (Supercharged) - frame += Main.npcFrameCount[npc.type] / 2; + frame += Main.npcFrameCount[NPC.type] / 2; - npc.frame.Y = frame * frameHeight; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - npc.TargetClosest(false); + NPC.TargetClosest(false); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; if (Supercharged) { float chargeJumpSpeed = -12f; - float maxHeight = chargeJumpSpeed * chargeJumpSpeed * (float)Math.Pow(Math.Sin(npc.AngleTo(player.Center)), 2) / (4f * NPCGravity); - bool jumpWouldHitPlayer = maxHeight > Math.Abs(player.Center.Y - npc.Center.Y) && maxHeight < Math.Abs(player.Center.Y - npc.Center.Y) + player.height; + float maxHeight = chargeJumpSpeed * chargeJumpSpeed * (float)Math.Pow(Math.Sin(NPC.AngleTo(player.Center)), 2) / (4f * NPCGravity); + bool jumpWouldHitPlayer = maxHeight > Math.Abs(player.Center.Y - NPC.Center.Y) && maxHeight < Math.Abs(player.Center.Y - NPC.Center.Y) + player.height; - if (Main.netMode != NetmodeID.MultiplayerClient && jumpWouldHitPlayer && npc.collideY && npc.velocity.Y == 0f) + if (Main.netMode != NetmodeID.MultiplayerClient && jumpWouldHitPlayer && NPC.collideY && NPC.velocity.Y == 0f) { - npc.velocity.Y = chargeJumpSpeed; - npc.netSpam = 0; - npc.netUpdate = true; + NPC.velocity.Y = chargeJumpSpeed; + NPC.netSpam = 0; + NPC.netUpdate = true; } SuperchargeTimer--; } // Jump if there's an obstacle ahead. - if (Main.netMode != NetmodeID.MultiplayerClient && HoleAtPosition(npc.Center.X + npc.velocity.X * 4f) && npc.collideY && npc.velocity.Y == 0f) + if (Main.netMode != NetmodeID.MultiplayerClient && HoleAtPosition(NPC.Center.X + NPC.velocity.X * 4f) && NPC.collideY && NPC.velocity.Y == 0f) { - npc.velocity.Y = JumpSpeed; - npc.netSpam = 0; - npc.netUpdate = true; + NPC.velocity.Y = JumpSpeed; + NPC.netSpam = 0; + NPC.netUpdate = true; } - if (Collision.CanHitLine(player.position, player.width, player.height, npc.position, npc.width, npc.height) && - Math.Abs(player.Center.X - npc.Center.X) < PlayerSearchDistance && - Math.Abs(player.Center.X - npc.Center.X) > PlayerTargetingThreshold) + if (Collision.CanHitLine(player.position, player.width, player.height, NPC.position, NPC.width, NPC.height) && + Math.Abs(player.Center.X - NPC.Center.X) < PlayerSearchDistance && + Math.Abs(player.Center.X - NPC.Center.X) > PlayerTargetingThreshold) { - int direction = Math.Sign(player.Center.X - npc.Center.X) * (npc.confused ? -1 : 1); - if (npc.direction != direction) + int direction = Math.Sign(player.Center.X - NPC.Center.X) * (NPC.confused ? -1 : 1); + if (NPC.direction != direction) { - npc.direction = direction; - npc.netSpam = 0; - npc.netUpdate = true; + NPC.direction = direction; + NPC.netSpam = 0; + NPC.netUpdate = true; } } - else if (Main.netMode != NetmodeID.MultiplayerClient && npc.collideX && npc.collideY && npc.velocity.Y == 0f) + else if (Main.netMode != NetmodeID.MultiplayerClient && NPC.collideX && NPC.collideY && NPC.velocity.Y == 0f) { - npc.velocity.Y = JumpSpeed; - npc.netSpam = 0; - npc.netUpdate = true; + NPC.velocity.Y = JumpSpeed; + NPC.netSpam = 0; + NPC.netUpdate = true; } - if (npc.oldPosition == npc.position) + if (NPC.oldPosition == NPC.position) { TimeSpentStuck++; if (Main.netMode != NetmodeID.MultiplayerClient && TimeSpentStuck > StuckJumpPromptTime) { - npc.velocity.Y = JumpSpeed; + NPC.velocity.Y = JumpSpeed; TimeSpentStuck = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } else TimeSpentStuck = 0f; - npc.velocity.X = MathHelper.Lerp(npc.velocity.X, MaxMovementSpeedX * npc.direction * (Supercharged ? 1.25f : 1f), Supercharged ? 0.02f : 0.0125f); - Vector4 adjustedVectors = Collision.WalkDownSlope(npc.position, npc.velocity, npc.width, npc.height, NPCGravity); - npc.position = adjustedVectors.XY(); - npc.velocity = adjustedVectors.ZW(); + NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, MaxMovementSpeedX * NPC.direction * (Supercharged ? 1.25f : 1f), Supercharged ? 0.02f : 0.0125f); + Vector4 adjustedVectors = Collision.WalkDownSlope(NPC.position, NPC.velocity, NPC.width, NPC.height, NPCGravity); + NPC.position = adjustedVectors.XY(); + NPC.velocity = adjustedVectors.ZW(); } private bool HoleAtPosition(float xPosition) { - int tileWidth = npc.width / 16; + int tileWidth = NPC.width / 16; xPosition = (int)(xPosition / 16f) - tileWidth; - if (npc.velocity.X > 0) + if (NPC.velocity.X > 0) xPosition += tileWidth; - int tileY = (int)((npc.position.Y + npc.height) / 16f); + int tileY = (int)((NPC.position.Y + NPC.height) / 16f); for (int y = tileY; y < tileY + 2; y++) { for (int x = (int)xPosition; x < xPosition + tileWidth; x++) @@ -158,7 +158,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur) return 0f; return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.020f : 0.115f) * pylonMult; } @@ -169,13 +169,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 3, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 3, hitDirection, -1f, 0, default, 1f); } } } @@ -183,9 +183,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 1, 2); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Supercharged); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.07f); + DropHelper.DropItem(NPC, ModContent.ItemType(), 1, 2); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Supercharged); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.07f); } } } diff --git a/NPCs/NormalNPCs/WulfrumHovercraft.cs b/NPCs/NormalNPCs/WulfrumHovercraft.cs index e2b2301755..2ccd9ff999 100644 --- a/NPCs/NormalNPCs/WulfrumHovercraft.cs +++ b/NPCs/NormalNPCs/WulfrumHovercraft.cs @@ -24,30 +24,30 @@ namespace CalamityMod.NPCs.NormalNPCs internal HovercraftAIState AIState { - get => (HovercraftAIState)(int)npc.ai[0]; - set => npc.ai[0] = (int)value; + get => (HovercraftAIState)(int)NPC.ai[0]; + set => NPC.ai[0] = (int)value; } public float SubphaseTime { - get => npc.ai[1]; - set => npc.ai[1] = value; + get => NPC.ai[1]; + set => NPC.ai[1] = value; } public float SearchDirection { - get => npc.ai[2]; - set => npc.ai[2] = value; + get => NPC.ai[2]; + set => NPC.ai[2] = value; } public float SuperchargeTimer { - get => npc.ai[3]; - set => npc.ai[3] = value; + get => NPC.ai[3]; + set => NPC.ai[3] = value; } public bool Supercharged => SuperchargeTimer > 0; - public ref float FlyAwayTimer => ref npc.localAI[0]; + public ref float FlyAwayTimer => ref NPC.localAI[0]; public const float StunTimeMax = 45f; public const float SearchXOffset = 345f; @@ -56,27 +56,27 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Hovercraft"); - Main.npcFrameCount[npc.type] = 12; + Main.npcFrameCount[NPC.type] = 12; } public override void SetDefaults() { aiType = -1; - npc.aiStyle = -1; - npc.damage = 15; - npc.width = 40; - npc.height = 38; - npc.defense = 4; - npc.lifeMax = 20; - npc.value = Item.buyPrice(0, 0, 1, 50); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = true; - banner = npc.type; + NPC.aiStyle = -1; + NPC.damage = 15; + NPC.width = 40; + NPC.height = 38; + NPC.defense = 4; + NPC.lifeMax = 20; + NPC.value = Item.buyPrice(0, 0, 1, 50); + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.noGravity = true; + NPC.noTileCollide = true; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void SendExtraAI(BinaryWriter writer) @@ -93,42 +93,42 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - npc.frameCounter++; - int frame = (int)(npc.frameCounter / 5) % (Main.npcFrameCount[npc.type] / 2); + NPC.frameCounter++; + int frame = (int)(NPC.frameCounter / 5) % (Main.npcFrameCount[NPC.type] / 2); if (Supercharged) - frame += Main.npcFrameCount[npc.type] / 2; + frame += Main.npcFrameCount[NPC.type] / 2; - npc.frame.Y = frame * frameHeight; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - npc.knockBackResist = 0.1f; + NPC.knockBackResist = 0.1f; - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; - bool farFromPlayer = npc.Distance(player.Center) > 960f; - bool obstanceInFrontOfPlayer = !Collision.CanHitLine(npc.position, npc.width, npc.height, player.position, player.width, player.height); + bool farFromPlayer = NPC.Distance(player.Center) > 960f; + bool obstanceInFrontOfPlayer = !Collision.CanHitLine(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); - if (npc.target < 0 || npc.target >= 255 || farFromPlayer || obstanceInFrontOfPlayer || player.dead || !player.active) + if (NPC.target < 0 || NPC.target >= 255 || farFromPlayer || obstanceInFrontOfPlayer || player.dead || !player.active) { - npc.TargetClosest(false); - player = Main.player[npc.target]; - farFromPlayer = npc.Distance(player.Center) > 960f; - obstanceInFrontOfPlayer = !Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height); + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + farFromPlayer = NPC.Distance(player.Center) > 960f; + obstanceInFrontOfPlayer = !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); // Fly away if there is no living target, or the closest target is too far away. if (player.dead || !player.active || farFromPlayer || obstanceInFrontOfPlayer) { if (FlyAwayTimer > 360) { - npc.velocity = Vector2.Lerp(npc.velocity, Vector2.UnitY * -8f, 0.1f); - npc.rotation = npc.rotation.AngleTowards(0f, MathHelper.ToRadians(15f)); - npc.noTileCollide = true; + NPC.velocity = Vector2.Lerp(NPC.velocity, Vector2.UnitY * -8f, 0.1f); + NPC.rotation = NPC.rotation.AngleTowards(0f, MathHelper.ToRadians(15f)); + NPC.noTileCollide = true; } else { - npc.velocity *= 0.96f; - npc.rotation = npc.rotation.AngleTowards(0f, MathHelper.ToRadians(15f)); + NPC.velocity *= 0.96f; + NPC.rotation = NPC.rotation.AngleTowards(0f, MathHelper.ToRadians(15f)); FlyAwayTimer++; } return; @@ -137,9 +137,9 @@ namespace CalamityMod.NPCs.NormalNPCs FlyAwayTimer = Utils.Clamp(FlyAwayTimer - 3, 0, 180); - npc.noTileCollide = !farFromPlayer; + NPC.noTileCollide = !farFromPlayer; - Lighting.AddLight(npc.Center - Vector2.UnitY * 8f, Color.Lime.ToVector3() * 1.5f); + Lighting.AddLight(NPC.Center - Vector2.UnitY * 8f, Color.Lime.ToVector3() * 1.5f); if (StunTime > 0) { @@ -147,15 +147,15 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int i = 0; i < 2; i++) { - Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Circular(8f, 8f), 226).scale = 0.7f; + Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Circular(8f, 8f), 226).scale = 0.7f; } } - npc.rotation = npc.rotation.AngleTowards(0f, MathHelper.ToRadians(15f)); + NPC.rotation = NPC.rotation.AngleTowards(0f, MathHelper.ToRadians(15f)); if (StunTime > StunTimeMax - 15) - npc.velocity *= 0.6f; + NPC.velocity *= 0.6f; else - npc.knockBackResist = 2.4f; + NPC.knockBackResist = 2.4f; StunTime--; return; @@ -163,26 +163,26 @@ namespace CalamityMod.NPCs.NormalNPCs if (SearchDirection == 0f) { - if (Math.Abs(player.Center.X + SearchXOffset - npc.Center.X) < Math.Abs(player.Center.X - SearchXOffset - npc.Center.X)) + if (Math.Abs(player.Center.X + SearchXOffset - NPC.Center.X) < Math.Abs(player.Center.X - SearchXOffset - NPC.Center.X)) SearchDirection = 1f; else SearchDirection = -1f; - npc.netUpdate = true; + NPC.netUpdate = true; } if (AIState == HovercraftAIState.Searching || AIState == HovercraftAIState.Hover) { Vector2 destination = player.Center + new Vector2(SearchXOffset * SearchDirection, -160f); - npc.velocity = npc.SafeDirectionTo(destination, Vector2.UnitY) * (Supercharged ? 7f : 5f); + NPC.velocity = NPC.SafeDirectionTo(destination, Vector2.UnitY) * (Supercharged ? 7f : 5f); if (AIState == HovercraftAIState.Hover) { destination = player.Center + new Vector2(SearchXOffset * -SearchDirection, -160f); - npc.velocity = npc.SafeDirectionTo(destination, Vector2.UnitY) * (Supercharged ? 5.5f : 4f); + NPC.velocity = NPC.SafeDirectionTo(destination, Vector2.UnitY) * (Supercharged ? 5.5f : 4f); } - npc.rotation = npc.velocity.X / 16f; - if (npc.Distance(destination) < 50f) + NPC.rotation = NPC.velocity.X / 16f; + if (NPC.Distance(destination) < 50f) { if (AIState == HovercraftAIState.Searching) { @@ -192,7 +192,7 @@ namespace CalamityMod.NPCs.NormalNPCs { AIState = HovercraftAIState.SwoopDownward; } - npc.netUpdate = true; + NPC.netUpdate = true; } } @@ -201,19 +201,19 @@ namespace CalamityMod.NPCs.NormalNPCs SubphaseTime++; if (SubphaseTime < 30f) { - npc.velocity *= 0.96f; + NPC.velocity *= 0.96f; } else { AIState = HovercraftAIState.Hover; SubphaseTime = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } if (AIState == HovercraftAIState.SwoopDownward) { - npc.rotation = 0f; + NPC.rotation = 0f; float swoopType = Supercharged ? TotalSubphaseTime - 40f : TotalSubphaseTime; float swoopSlowdownTime = Supercharged ? 10f : 45f; Vector2 swoopVelocity = Vector2.UnitY.RotatedBy(MathHelper.Pi * SubphaseTime / swoopType * -SearchDirection) * (Supercharged ? 11f : 8.5f); @@ -229,26 +229,26 @@ namespace CalamityMod.NPCs.NormalNPCs } swoopVelocity.Y *= 0.5f; - npc.velocity = Vector2.Lerp(npc.velocity, swoopVelocity, 0.2f); + NPC.velocity = Vector2.Lerp(NPC.velocity, swoopVelocity, 0.2f); if (SubphaseTime >= swoopType) { AIState = HovercraftAIState.Searching; SearchDirection = 0f; SubphaseTime = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.rotation = npc.velocity.X / 12f; + NPC.rotation = NPC.velocity.X / 12f; } - npc.spriteDirection = (npc.velocity.X < 0).ToDirectionInt(); + NPC.spriteDirection = (NPC.velocity.X < 0).ToDirectionInt(); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur) return 0f; return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.015f : 0.1f) * pylonMult; @@ -260,13 +260,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 3, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 3, hitDirection, -1f, 0, default, 1f); } } } @@ -275,14 +275,14 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitByItem(Player player, Item item, int damage, float knockback, bool crit) { StunTime = StunTimeMax; - npc.netUpdate = true; + NPC.netUpdate = true; } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Supercharged); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.07f); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Supercharged); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.07f); } } } diff --git a/NPCs/NormalNPCs/WulfrumPylon.cs b/NPCs/NormalNPCs/WulfrumPylon.cs index 473c426c21..5084209d69 100644 --- a/NPCs/NormalNPCs/WulfrumPylon.cs +++ b/NPCs/NormalNPCs/WulfrumPylon.cs @@ -14,13 +14,13 @@ namespace CalamityMod.NPCs.NormalNPCs { public bool Charging { - get => npc.ai[0] != 0f; - set => npc.ai[0] = value.ToInt(); + get => NPC.ai[0] != 0f; + set => NPC.ai[0] = value.ToInt(); } public float ChargeRadius { - get => npc.ai[1]; - set => npc.ai[1] = value; + get => NPC.ai[1]; + set => NPC.ai[1] = value; } public static List SuperchargableEnemies = new List() { @@ -33,37 +33,37 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Pylon"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { aiType = -1; - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 44; - npc.height = 44; - npc.defense = 4; - npc.lifeMax = 92; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 1, 50); - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - banner = npc.type; + NPC.aiStyle = -1; + NPC.damage = 0; + NPC.width = 44; + NPC.height = 44; + NPC.defense = 4; + NPC.lifeMax = 92; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 1, 50); + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void AI() { - npc.TargetClosest(false); + NPC.TargetClosest(false); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; - if (Main.netMode != NetmodeID.MultiplayerClient && !Charging && npc.Distance(player.Center) < ChargeRadiusMax * 0.667f) + if (Main.netMode != NetmodeID.MultiplayerClient && !Charging && NPC.Distance(player.Center) < ChargeRadiusMax * 0.667f) { // Spawn some off-screen enemies to act as threats if the player enters the field. int enemiesToSpawn = CalamityWorld.death ? 2 : 1; @@ -89,7 +89,7 @@ namespace CalamityMod.NPCs.NormalNPCs } } Charging = true; - npc.netUpdate = true; + NPC.netUpdate = true; } else if (Charging) { @@ -101,11 +101,11 @@ namespace CalamityMod.NPCs.NormalNPCs for (int i = 0; i < dustCount; i++) { float angle = MathHelper.TwoPi * i / dustCount; - Dust dust = Dust.NewDustPerfect(npc.Center, 229); - dust.position = npc.Center + angle.ToRotationVector2() * ChargeRadius; + Dust dust = Dust.NewDustPerfect(NPC.Center, 229); + dust.position = NPC.Center + angle.ToRotationVector2() * ChargeRadius; dust.scale = 0.7f; dust.noGravity = true; - dust.velocity = npc.velocity; + dust.velocity = NPC.velocity; } } @@ -122,7 +122,7 @@ namespace CalamityMod.NPCs.NormalNPCs continue; if (npcAtIndex.ai[3] > 0f) continue; - if (npc.Distance(npcAtIndex.Center) > ChargeRadius) + if (NPC.Distance(npcAtIndex.Center) > ChargeRadius) continue; npcAtIndex.ai[3] = SuperchargeTime; // Supercharge the npc for a while if isn't already supercharged. @@ -144,17 +144,17 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - npc.frameCounter++; - int frame = (int)(npc.frameCounter / 8) % Main.npcFrameCount[npc.type]; + NPC.frameCounter++; + int frame = (int)(NPC.frameCounter / 8) % Main.npcFrameCount[NPC.type]; - npc.frame.Y = frame * frameHeight; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { float pylonMult = !NPC.AnyNPCs(ModContent.NPCType()) ? 1.3f : 1f; - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur) return 0f; // Spawn less frequently in the inner third of the world. @@ -168,22 +168,22 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.GrassBlades, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GrassBlades, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.GrassBlades, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GrassBlades, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.07f); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.07f); } } } diff --git a/NPCs/NormalNPCs/WulfrumRover.cs b/NPCs/NormalNPCs/WulfrumRover.cs index ad37416066..d5bd6f8bef 100644 --- a/NPCs/NormalNPCs/WulfrumRover.cs +++ b/NPCs/NormalNPCs/WulfrumRover.cs @@ -14,14 +14,14 @@ namespace CalamityMod.NPCs.NormalNPCs { public float TimeSpentStuck { - get => npc.ai[0]; - set => npc.ai[0] = value; + get => NPC.ai[0]; + set => NPC.ai[0] = value; } public float SuperchargeTimer { - get => npc.ai[3]; - set => npc.ai[3] = value; + get => NPC.ai[3]; + set => NPC.ai[3] = value; } public const float PlayerTargetingThreshold = 90f; @@ -34,91 +34,91 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Rover"); - Main.npcFrameCount[npc.type] = 16; + Main.npcFrameCount[NPC.type] = 16; } public override void SetDefaults() { aiType = -1; - npc.aiStyle = -1; - npc.damage = 10; - npc.width = 40; - npc.height = 40; - npc.defense = 4; - npc.lifeMax = 32; - npc.knockBackResist = 0.15f; - npc.value = Item.buyPrice(0, 0, 1, 15); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - banner = npc.type; + NPC.aiStyle = -1; + NPC.damage = 10; + NPC.width = 40; + NPC.height = 40; + NPC.defense = 4; + NPC.lifeMax = 32; + NPC.knockBackResist = 0.15f; + NPC.value = Item.buyPrice(0, 0, 1, 15); + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - int frame = (int)(npc.frameCounter / 5) % (Main.npcFrameCount[npc.type] / 2); + NPC.frameCounter++; + int frame = (int)(NPC.frameCounter / 5) % (Main.npcFrameCount[NPC.type] / 2); if (Supercharged) - frame += Main.npcFrameCount[npc.type] / 2; + frame += Main.npcFrameCount[NPC.type] / 2; - npc.frame.Y = frame * frameHeight; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - npc.TargetClosest(false); + NPC.TargetClosest(false); if (Supercharged) { SuperchargeTimer--; - npc.defense = 13; + NPC.defense = 13; } else if (!Supercharged) { - npc.defense = 4; + NPC.defense = 4; } - Player player = Main.player[npc.target]; - if (Collision.CanHitLine(player.position, player.width, player.height, npc.position, npc.width, npc.height) && - Math.Abs(player.Center.X - npc.Center.X) < PlayerSearchDistance && - Math.Abs(player.Center.X - npc.Center.X) > PlayerTargetingThreshold) + Player player = Main.player[NPC.target]; + if (Collision.CanHitLine(player.position, player.width, player.height, NPC.position, NPC.width, NPC.height) && + Math.Abs(player.Center.X - NPC.Center.X) < PlayerSearchDistance && + Math.Abs(player.Center.X - NPC.Center.X) > PlayerTargetingThreshold) { - int direction = Math.Sign(player.Center.X - npc.Center.X) * (npc.confused ? -1 : 1); - if (npc.direction != direction) + int direction = Math.Sign(player.Center.X - NPC.Center.X) * (NPC.confused ? -1 : 1); + if (NPC.direction != direction) { - npc.direction = direction; - npc.netUpdate = true; + NPC.direction = direction; + NPC.netUpdate = true; } } - else if (npc.collideX) + else if (NPC.collideX) { - npc.direction *= -1; - npc.netUpdate = true; + NPC.direction *= -1; + NPC.netUpdate = true; } - if (npc.oldPosition == npc.position) + if (NPC.oldPosition == NPC.position) { TimeSpentStuck++; if (Main.netMode != NetmodeID.MultiplayerClient && TimeSpentStuck > StuckJumpPromptTime) { - npc.velocity.Y = JumpSpeed; + NPC.velocity.Y = JumpSpeed; TimeSpentStuck = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } else TimeSpentStuck = 0f; - npc.spriteDirection = -npc.direction; - npc.velocity.X = MathHelper.Lerp(npc.velocity.X, MaxMovementSpeedX * npc.direction, 0.0125f); + NPC.spriteDirection = -NPC.direction; + NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, MaxMovementSpeedX * NPC.direction, 0.0125f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur) return 0f; return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.010f : 0.135f) * pylonMult; } @@ -129,13 +129,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 4; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 3, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 3, hitDirection, -1f, 0, default, 1f); } } } @@ -145,15 +145,15 @@ namespace CalamityMod.NPCs.NormalNPCs { if (Supercharged) { - Texture2D shieldTexture = ModContent.GetTexture("CalamityMod/NPCs/NormalNPCs/WulfrumRoverShield"); + Texture2D shieldTexture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/WulfrumRoverShield"); Rectangle frame = shieldTexture.Frame(1, 11, 0, (int)(Main.GlobalTime * 8) % 11); spriteBatch.Draw(shieldTexture, - npc.Center - Main.screenPosition + Vector2.UnitY * (npc.gfxOffY + 6f), + NPC.Center - Main.screenPosition + Vector2.UnitY * (NPC.gfxOffY + 6f), frame, Color.White * 0.625f, - npc.rotation, + NPC.rotation, shieldTexture.Size() * 0.5f / new Vector2(1f, 11f), - npc.scale + (float)Math.Cos(Main.GlobalTime) * 0.1f, + NPC.scale + (float)Math.Cos(Main.GlobalTime) * 0.1f, SpriteEffects.None, 0f); } @@ -161,10 +161,10 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Supercharged); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.07f); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Supercharged); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.07f); } } } diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 16bea12d70..2641e9bc34 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -29,147 +29,147 @@ namespace CalamityMod.NPCs.OldDuke public override void SetStaticDefaults() { DisplayName.SetDefault("The Old Duke"); - Main.npcFrameCount[npc.type] = 7; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 7; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.width = 150; - npc.height = 100; - npc.aiStyle = -1; + NPC.width = 150; + NPC.height = 100; + NPC.aiStyle = -1; aiType = -1; - npc.GetNPCDamage(); - npc.defense = 90; - npc.DR_NERD(0.5f, null, null, null, true); - npc.LifeMaxNERB(495000, 594000, 400000); + NPC.GetNPCDamage(); + NPC.defense = 90; + NPC.DR_NERD(0.5f, null, null, null, true); + NPC.LifeMaxNERB(495000, 594000, 400000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.noTileCollide = true; - npc.noGravity = true; - npc.npcSlots = 15f; - npc.HitSound = SoundID.NPCHit14; - npc.DeathSound = SoundID.NPCDeath20; - npc.value = Item.buyPrice(4, 0, 0, 0); - npc.boss = true; - npc.netAlways = true; - npc.timeLeft = NPC.activeTime * 30; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.noTileCollide = true; + NPC.noGravity = true; + NPC.npcSlots = 15f; + NPC.HitSound = SoundID.NPCHit14; + NPC.DeathSound = SoundID.NPCDeath20; + NPC.value = Item.buyPrice(4, 0, 0, 0); + NPC.boss = true; + NPC.netAlways = true; + NPC.timeLeft = NPC.activeTime * 30; music = CalamityMod.Instance.GetMusicFromMusicMod("BoomerDuke") ?? MusicID.Boss1; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.rotation); - writer.Write(npc.spriteDirection); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.rotation); + writer.Write(NPC.spriteDirection); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.rotation = reader.ReadSingle(); - npc.spriteDirection = reader.ReadInt32(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.rotation = reader.ReadSingle(); + NPC.spriteDirection = reader.ReadInt32(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityAI.OldDukeAI(npc, mod); + CalamityAI.OldDukeAI(NPC, Mod); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void FindFrame(int frameHeight) { - bool tired = npc.Calamity().newAI[1] == 1f; - if (npc.ai[0] == 0f || npc.ai[0] == 5f || npc.ai[0] == 10f || npc.ai[0] == 12f) + bool tired = NPC.Calamity().newAI[1] == 1f; + if (NPC.ai[0] == 0f || NPC.ai[0] == 5f || NPC.ai[0] == 10f || NPC.ai[0] == 12f) { int num114 = tired ? 14 : 7; - if (npc.ai[0] == 5f || npc.ai[0] == 12f) + if (NPC.ai[0] == 5f || NPC.ai[0] == 12f) { num114 = tired ? 12 : 6; } - npc.frameCounter += 1D; - if (npc.frameCounter > num114) + NPC.frameCounter += 1D; + if (NPC.frameCounter > num114) { - npc.frameCounter = 0D; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y >= frameHeight * 6) + if (NPC.frame.Y >= frameHeight * 6) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } - if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 11f) + if (NPC.ai[0] == 1f || NPC.ai[0] == 6f || NPC.ai[0] == 11f) { - npc.frame.Y = frameHeight * 2; + NPC.frame.Y = frameHeight * 2; } - if (npc.ai[0] == 2f || npc.ai[0] == 7f || npc.ai[0] == 14f) + if (NPC.ai[0] == 2f || NPC.ai[0] == 7f || NPC.ai[0] == 14f) { - npc.frame.Y = frameHeight * 6; + NPC.frame.Y = frameHeight * 6; } - if (npc.ai[0] == 3f || npc.ai[0] == 8f || npc.ai[0] == 13f || npc.ai[0] == -1f) + if (NPC.ai[0] == 3f || NPC.ai[0] == 8f || NPC.ai[0] == 13f || NPC.ai[0] == -1f) { int num115 = 120; - if (npc.ai[2] < (num115 - 50) || npc.ai[2] > (num115 - 10)) + if (NPC.ai[2] < (num115 - 50) || NPC.ai[2] > (num115 - 10)) { - npc.frameCounter += 1D; - if (npc.frameCounter > 7D) + NPC.frameCounter += 1D; + if (NPC.frameCounter > 7D) { - npc.frameCounter = 0D; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y >= frameHeight * 6) + if (NPC.frame.Y >= frameHeight * 6) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } else { - npc.frame.Y = frameHeight * 5; - if (npc.ai[2] > (num115 - 40) && npc.ai[2] < (num115 - 15)) + NPC.frame.Y = frameHeight * 5; + if (NPC.ai[2] > (num115 - 40) && NPC.ai[2] < (num115 - 15)) { - npc.frame.Y = frameHeight * 6; + NPC.frame.Y = frameHeight * 6; } } } - if (npc.ai[0] == 4f || npc.ai[0] == 9f) + if (NPC.ai[0] == 4f || NPC.ai[0] == 9f) { int num116 = 180; - if (npc.ai[2] < (num116 - 60) || npc.ai[2] > (num116 - 20)) + if (NPC.ai[2] < (num116 - 60) || NPC.ai[2] > (num116 - 20)) { - npc.frameCounter += 1D; - if (npc.frameCounter > 7D) + NPC.frameCounter += 1D; + if (NPC.frameCounter > 7D) { - npc.frameCounter = 0D; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y >= frameHeight * 6) + if (NPC.frame.Y >= frameHeight * 6) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } else { - npc.frame.Y = frameHeight * 5; - if (npc.ai[2] > (num116 - 50) && npc.ai[2] < (num116 - 25)) + NPC.frame.Y = frameHeight * 5; + if (NPC.ai[2] > (num116 - 50) && NPC.ai[2] < (num116 - 25)) { - npc.frame.Y = frameHeight * 6; + NPC.frame.Y = frameHeight * 6; } } } @@ -178,17 +178,17 @@ namespace CalamityMod.NPCs.OldDuke public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2); Color color = lightColor; Color color36 = Color.White; float amount9 = 0f; - bool flag8 = npc.ai[0] > 4f; - bool flag9 = npc.ai[0] > 9f && npc.ai[0] <= 12f; + bool flag8 = NPC.ai[0] > 4f; + bool flag9 = NPC.ai[0] > 9f && NPC.ai[0] <= 12f; int num150 = 120; int num151 = 60; if (flag9) @@ -199,24 +199,24 @@ namespace CalamityMod.NPCs.OldDuke { color = CalamityGlobalNPC.buffColor(color, 0.5f, 0.7f, 0.5f, 1f); } - else if (npc.ai[0] == 4f && npc.ai[2] > num150) + else if (NPC.ai[0] == 4f && NPC.ai[2] > num150) { - float num152 = npc.ai[2] - num150; + float num152 = NPC.ai[2] - num150; num152 /= num151; color = CalamityGlobalNPC.buffColor(color, 1f - 0.5f * num152, 1f - 0.3f * num152, 1f - 0.5f * num152, 1f); } int num153 = 10; int num154 = 2; - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { num153 = 0; } - if (npc.ai[0] == 0f || npc.ai[0] == 5f || npc.ai[0] == 10f || npc.ai[0] == 12f) + if (NPC.ai[0] == 0f || NPC.ai[0] == 5f || NPC.ai[0] == 10f || NPC.ai[0] == 12f) { num153 = 7; } - if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] > 9f) + if (NPC.ai[0] == 1f || NPC.ai[0] == 6f || NPC.ai[0] > 9f) { color36 = Color.Lime; amount9 = 0.5f; @@ -232,12 +232,12 @@ namespace CalamityMod.NPCs.OldDuke { Color color38 = color; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } @@ -245,36 +245,36 @@ namespace CalamityMod.NPCs.OldDuke float num157 = 0f; float scaleFactor9 = 0f; - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { num156 = 0; } - if (npc.ai[0] == 3f || npc.ai[0] == 8f || npc.ai[0] == 13f) + if (NPC.ai[0] == 3f || NPC.ai[0] == 8f || NPC.ai[0] == 13f) { int num158 = 60; int num159 = 30; - if (npc.ai[2] > num158) + if (NPC.ai[2] > num158) { num156 = 6; - num157 = 1f - (float)Math.Cos((npc.ai[2] - num158) / num159 * MathHelper.TwoPi); + num157 = 1f - (float)Math.Cos((NPC.ai[2] - num158) / num159 * MathHelper.TwoPi); num157 /= 3f; scaleFactor9 = 40f; } } - if ((npc.ai[0] == 4f || npc.ai[0] == 9f) && npc.ai[2] > num150) + if ((NPC.ai[0] == 4f || NPC.ai[0] == 9f) && NPC.ai[2] > num150) { num156 = 6; - num157 = 1f - (float)Math.Cos((npc.ai[2] - num150) / num151 * MathHelper.TwoPi); + num157 = 1f - (float)Math.Cos((NPC.ai[2] - num150) / num151 * MathHelper.TwoPi); num157 /= 3f; scaleFactor9 = 60f; } - if (npc.ai[0] == 12f) + if (NPC.ai[0] == 12f) { num156 = 6; - num157 = 1f - (float)Math.Cos(npc.ai[2] / 30f * MathHelper.TwoPi); + num157 = 1f - (float)Math.Cos(NPC.ai[2] / 30f * MathHelper.TwoPi); num157 /= 3f; scaleFactor9 = 20f; } @@ -285,26 +285,26 @@ namespace CalamityMod.NPCs.OldDuke { Color color39 = lightColor; color39 = Color.Lerp(color39, color36, amount9); - color39 = npc.GetAlpha(color39); + color39 = NPC.GetAlpha(color39); color39 *= 1f - num157; - Vector2 vector42 = npc.Center + (num160 / (float)num156 * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; - vector42 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector42 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector42, npc.frame, color39, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector42 = NPC.Center + (num160 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; + vector42 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector42 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector42, NPC.frame, color39, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } Color color2 = lightColor; color2 = Color.Lerp(color2, color36, amount9); - color2 = npc.GetAlpha(color2); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, (npc.ai[0] > 9f ? color2 : npc.GetAlpha(lightColor)), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + color2 = NPC.GetAlpha(color2); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, (NPC.ai[0] > 9f ? color2 : NPC.GetAlpha(lightColor)), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - if (npc.ai[0] >= 4f && npc.Calamity().newAI[1] != 1f) + if (NPC.ai[0] >= 4f && NPC.Calamity().newAI[1] != 1f) { - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/OldDuke/OldDukeGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/OldDuke/OldDukeGlow"); Color color40 = Color.Lerp(Color.White, Color.Yellow, 0.5f); color36 = Color.Yellow; @@ -313,17 +313,17 @@ namespace CalamityMod.NPCs.OldDuke scaleFactor9 = 10f; num154 = 1; - if (npc.ai[0] == 4f || npc.ai[0] == 9f) + if (NPC.ai[0] == 4f || NPC.ai[0] == 9f) { - float num161 = npc.ai[2] - num150; + float num161 = NPC.ai[2] - num150; num161 /= num151; color36 *= num161; color40 *= num161; } - if (npc.ai[0] == 12f) + if (NPC.ai[0] == 12f) { - float num162 = npc.ai[2]; + float num162 = NPC.ai[2]; num162 /= 30f; if (num162 > 0.5f) { @@ -342,26 +342,26 @@ namespace CalamityMod.NPCs.OldDuke Color color41 = color40; color41 = Color.Lerp(color41, color36, amount9); color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } for (int num164 = 1; num164 < num156; num164++) { Color color42 = color40; color42 = Color.Lerp(color42, color36, amount9); - color42 = npc.GetAlpha(color42); + color42 = NPC.GetAlpha(color42); color42 *= 1f - num157; - Vector2 vector45 = npc.Center + (num164 / (float)num156 * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; - vector45 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector45 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector45, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector45 = NPC.Center + (num164 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; + vector45 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector45 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector45, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color40, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color40, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } return false; @@ -374,12 +374,12 @@ namespace CalamityMod.NPCs.OldDuke public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedBoomerDuke); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedBoomerDuke); CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedBoomerDuke); @@ -388,7 +388,7 @@ namespace CalamityMod.NPCs.OldDuke { // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -399,13 +399,13 @@ namespace CalamityMod.NPCs.OldDuke ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // Mark Old Duke as dead CalamityWorld.downedBoomerDuke = true; @@ -428,12 +428,12 @@ namespace CalamityMod.NPCs.OldDuke public override void HitEffect(int hitDirection, double damage) { - if (npc.life > 0) + if (NPC.life > 0) { int num211 = 0; - while (num211 < damage / npc.lifeMax * 100.0) + while (num211 < damage / NPC.lifeMax * 100.0) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); num211++; } } @@ -441,13 +441,13 @@ namespace CalamityMod.NPCs.OldDuke { for (int num212 = 0; num212 < 150; num212++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, 2 * hitDirection, -2f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 2 * hitDirection, -2f, 0, default, 1f); } - Gore.NewGore(npc.Center + Vector2.UnitX * 20f * npc.direction, npc.velocity, mod.GetGoreSlot("Gores/OldDuke/OldDukeGore"), npc.scale); - Gore.NewGore(npc.Center + Vector2.UnitX * 20f * npc.direction, npc.velocity, mod.GetGoreSlot("Gores/OldDuke/OldDukeGore2"), npc.scale); - Gore.NewGore(npc.Center - Vector2.UnitX * 20f * npc.direction, npc.velocity, mod.GetGoreSlot("Gores/OldDuke/OldDukeGore3"), npc.scale); - Gore.NewGore(npc.Center - Vector2.UnitX * 20f * npc.direction, npc.velocity, mod.GetGoreSlot("Gores/OldDuke/OldDukeGore4"), npc.scale); + Gore.NewGore(NPC.Center + Vector2.UnitX * 20f * NPC.direction, NPC.velocity, Mod.GetGoreSlot("Gores/OldDuke/OldDukeGore"), NPC.scale); + Gore.NewGore(NPC.Center + Vector2.UnitX * 20f * NPC.direction, NPC.velocity, Mod.GetGoreSlot("Gores/OldDuke/OldDukeGore2"), NPC.scale); + Gore.NewGore(NPC.Center - Vector2.UnitX * 20f * NPC.direction, NPC.velocity, Mod.GetGoreSlot("Gores/OldDuke/OldDukeGore3"), NPC.scale); + Gore.NewGore(NPC.Center - Vector2.UnitX * 20f * NPC.direction, NPC.velocity, Mod.GetGoreSlot("Gores/OldDuke/OldDukeGore4"), NPC.scale); } } } diff --git a/NPCs/OldDuke/OldDukeSharkron.cs b/NPCs/OldDuke/OldDukeSharkron.cs index ae7528c6b5..0ac27a0ad5 100644 --- a/NPCs/OldDuke/OldDukeSharkron.cs +++ b/NPCs/OldDuke/OldDukeSharkron.cs @@ -10,6 +10,7 @@ using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using CalamityMod.Events; using CalamityMod.World; +using Terraria.Audio; namespace CalamityMod.NPCs.OldDuke { @@ -19,47 +20,47 @@ namespace CalamityMod.NPCs.OldDuke public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurous Sharkron"); - NPCID.Sets.TrailingMode[npc.type] = 1; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.aiStyle = -1; aiType = -1; - npc.width = 44; - npc.height = 44; - npc.GetNPCDamage(); - npc.defense = 100; - npc.lifeMax = 6000; + NPC.width = 44; + NPC.height = 44; + NPC.GetNPCDamage(); + NPC.defense = 100; + NPC.lifeMax = 6000; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 10000; + NPC.lifeMax = 10000; } - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.noGravity = true; - npc.dontTakeDamage = true; - npc.noTileCollide = true; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.noGravity = true; + NPC.dontTakeDamage = true; + NPC.noTileCollide = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); - writer.Write(npc.noGravity); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.noGravity); writer.Write(spawnedProjectiles); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); - npc.noGravity = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.noGravity = reader.ReadBoolean(); spawnedProjectiles = reader.ReadBoolean(); } @@ -70,35 +71,35 @@ namespace CalamityMod.NPCs.OldDuke bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead) { - npc.TargetClosest(false); - npc.netUpdate = true; + NPC.TargetClosest(false); + NPC.netUpdate = true; } - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); + NPC.spriteDirection = -1; + NPC.rotation = (float)Math.Atan2(-NPC.velocity.Y, -NPC.velocity.X); } else { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.spriteDirection = 1; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); } - npc.alpha -= 6; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 6; + if (NPC.alpha < 0) + NPC.alpha = 0; // Fly towards Old Duke - bool normalAI = npc.ai[3] == 0f; + bool normalAI = NPC.ai[3] == 0f; // Fly up - bool upwardAI = npc.ai[3] < 0f; + bool upwardAI = NPC.ai[3] < 0f; // Fly down - bool downwardAI = npc.ai[3] > 0f; + bool downwardAI = NPC.ai[3] > 0f; float flyTowardTargetGateValue = malice ? 60f : death ? 70f : revenge ? 75f : expertMode ? 80f : 90f; float extraTime = malice ? 90f : death ? 100f : revenge ? 105f : expertMode ? 110f : 120f; @@ -109,76 +110,76 @@ namespace CalamityMod.NPCs.OldDuke float fallDownGateValue = aiGateValue + extraTime * 0.5f; float maxVelocity = malice ? 24f : death ? 22f : revenge ? 21f : expertMode ? 20f : 18f; - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { // Set velocity to fly towards a specified location on the first frame - if (npc.ai[1] == 0f) + if (NPC.ai[1] == 0f) { if (normalAI) - npc.velocity = Vector2.Normalize(Main.npc[(int)npc.ai[2]].Center - npc.Center) * (maxVelocity - 6f); + NPC.velocity = Vector2.Normalize(Main.npc[(int)NPC.ai[2]].Center - NPC.Center) * (maxVelocity - 6f); else - npc.velocity = new Vector2(npc.ai[2], npc.ai[3]); + NPC.velocity = new Vector2(NPC.ai[2], NPC.ai[3]); - Main.PlaySound(SoundID.NPCDeath19, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath19, NPC.position); } // Fly towards a target after a certain time has passed - npc.ai[1] += 1f; - if (npc.ai[1] >= flyTowardTargetGateValue) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= flyTowardTargetGateValue) { // Start second part of AI if not inside tiles and a certain time has passed - if (!Collision.SolidCollision(npc.position, npc.width, npc.height) && npc.ai[1] >= aiGateValue) - npc.ai[0] = 1f; + if (!Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && NPC.ai[1] >= aiGateValue) + NPC.ai[0] = 1f; // If not set to fly towards Old Duke from the start, accelerate if (!normalAI) { - if (npc.velocity.Length() < maxVelocity) - npc.velocity *= 1.01f; + if (NPC.velocity.Length() < maxVelocity) + NPC.velocity *= 1.01f; } // Fly towards the target - float scaleFactor2 = npc.velocity.Length(); - Vector2 vector17 = Main.player[npc.target].Center - npc.Center; + float scaleFactor2 = NPC.velocity.Length(); + Vector2 vector17 = Main.player[NPC.target].Center - NPC.Center; vector17.Normalize(); vector17 *= scaleFactor2; float inertia = malice ? 16f : death ? 18f : revenge ? 20f : expertMode ? 22f : 25f; - npc.velocity = (npc.velocity * (inertia - 1f) + vector17) / inertia; - npc.velocity.Normalize(); - npc.velocity *= scaleFactor2; + NPC.velocity = (NPC.velocity * (inertia - 1f) + vector17) / inertia; + NPC.velocity.Normalize(); + NPC.velocity *= scaleFactor2; } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { // Move slower if set to fly upward from the start if (upwardAI) maxVelocity -= 6f; // Decrease velocity if moving faster than max - if (npc.velocity.Length() > maxVelocity) - npc.velocity *= 0.99f; + if (NPC.velocity.Length() > maxVelocity) + NPC.velocity *= 0.99f; - npc.dontTakeDamage = false; + NPC.dontTakeDamage = false; // Explode into gores if colliding with tiles or after a certain time has passed - npc.ai[1] += 1f; - if (Collision.SolidCollision(npc.position, npc.width, npc.height) || npc.ai[1] >= explodeIntoGoreGateValue) + NPC.ai[1] += 1f; + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height) || NPC.ai[1] >= explodeIntoGoreGateValue) { - if (npc.DeathSound != null) - Main.PlaySound(npc.DeathSound, npc.position); + if (NPC.DeathSound != null) + SoundEngine.PlaySound(NPC.DeathSound, NPC.position); - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; return; } // Fall down after a certain time has passed - if (npc.ai[1] >= fallDownGateValue) + if (NPC.ai[1] >= fallDownGateValue) { - npc.noGravity = false; - npc.velocity.Y += 0.3f; + NPC.noGravity = false; + NPC.velocity.Y += 0.3f; } } } @@ -187,9 +188,9 @@ namespace CalamityMod.NPCs.OldDuke { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(8) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } return false; @@ -197,17 +198,17 @@ namespace CalamityMod.NPCs.OldDuke public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.FlipHorizontally; - if (npc.spriteDirection == -1) + if (NPC.spriteDirection == -1) spriteEffects = SpriteEffects.None; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); Color color36 = Color.Lime; float amount9 = 0.5f; int num153 = 10; @@ -218,19 +219,19 @@ namespace CalamityMod.NPCs.OldDuke { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -238,7 +239,7 @@ namespace CalamityMod.NPCs.OldDuke public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 1; - return npc.alpha == 0; + return NPC.alpha == 0; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -248,17 +249,17 @@ namespace CalamityMod.NPCs.OldDuke public override bool CheckDead() { - Main.PlaySound(SoundID.NPCDeath12, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath12, NPC.position); - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = npc.height = 96; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = NPC.height = 96; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity.Y *= 6f; Main.dust[num622].velocity.X *= 3f; if (Main.rand.NextBool(2)) @@ -270,21 +271,21 @@ namespace CalamityMod.NPCs.OldDuke for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity.Y *= 10f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity.X *= 2f; } if (Main.netMode != NetmodeID.MultiplayerClient && !spawnedProjectiles) { spawnedProjectiles = true; - int spawnX = npc.width / 2; + int spawnX = NPC.width / 2; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); for (int i = 0; i < 2; i++) - Projectile.NewProjectile(npc.Center.X + Main.rand.Next(-spawnX, spawnX), npc.Center.Y, + Projectile.NewProjectile(NPC.Center.X + Main.rand.Next(-spawnX, spawnX), NPC.Center.Y, Main.rand.Next(-3, 4), Main.rand.Next(-12, -6), type, damage, 0f, Main.myPlayer); } @@ -295,13 +296,13 @@ namespace CalamityMod.NPCs.OldDuke { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index cabb69ee2b..40ce367360 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -9,6 +9,7 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Dusts; using CalamityMod.Events; +using Terraria.Audio; namespace CalamityMod.NPCs.OldDuke { @@ -22,39 +23,39 @@ namespace CalamityMod.NPCs.OldDuke public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.aiStyle = -1; aiType = -1; - npc.GetNPCDamage(); - npc.width = 40; - npc.height = 40; - npc.defense = 0; - npc.lifeMax = 3750; + NPC.GetNPCDamage(); + NPC.width = 40; + NPC.height = 40; + NPC.defense = 0; + NPC.lifeMax = 3750; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 7500; + NPC.lifeMax = 7500; } - npc.alpha = 255; - npc.knockBackResist = 0f; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath11; - npc.noGravity = true; - npc.noTileCollide = true; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.alpha = 255; + NPC.knockBackResist = 0f; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath11; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); writer.Write(spawnedProjectiles); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); spawnedProjectiles = reader.ReadBoolean(); } @@ -65,44 +66,44 @@ namespace CalamityMod.NPCs.OldDuke bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - npc.rotation += npc.velocity.X * 0.05f; + NPC.rotation += NPC.velocity.X * 0.05f; - if (npc.alpha > 0) - npc.alpha -= 15; + if (NPC.alpha > 0) + NPC.alpha -= 15; - npc.TargetClosest(false); - Player player = Main.player[npc.target]; + NPC.TargetClosest(false); + Player player = Main.player[NPC.target]; if (!player.active || player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (!player.active || player.dead) { - if (npc.timeLeft > 10) - npc.timeLeft = 10; + if (NPC.timeLeft > 10) + NPC.timeLeft = 10; return; } } - else if (npc.timeLeft < 600) - npc.timeLeft = 600; + else if (NPC.timeLeft < 600) + NPC.timeLeft = 600; - Vector2 vector = player.Center - npc.Center; - if (vector.Length() < 40f || npc.ai[3] >= 900f) + Vector2 vector = player.Center - NPC.Center; + if (vector.Length() < 40f || NPC.ai[3] >= 900f) { - npc.dontTakeDamage = false; - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.dontTakeDamage = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; return; } - npc.ai[3] += 1f; - npc.dontTakeDamage = npc.ai[3] >= 600f ? false : true; - if (npc.ai[3] >= 480f) + NPC.ai[3] += 1f; + NPC.dontTakeDamage = NPC.ai[3] >= 600f ? false : true; + if (NPC.ai[3] >= 480f) { - npc.velocity *= 0.985f; + NPC.velocity *= 0.985f; return; } @@ -110,45 +111,45 @@ namespace CalamityMod.NPCs.OldDuke if (expertMode) { float speedUpMult = BossRushEvent.BossRushActive ? 0.015f : CalamityWorld.malice ? 0.0125f : 0.01f; - num1372 += Vector2.Distance(player.Center, npc.Center) * speedUpMult; + num1372 += Vector2.Distance(player.Center, NPC.Center) * speedUpMult; } - Vector2 vector167 = new Vector2(npc.Center.X + npc.direction * 20, npc.Center.Y + 6f); + Vector2 vector167 = new Vector2(NPC.Center.X + NPC.direction * 20, NPC.Center.Y + 6f); float num1373 = player.position.X + player.width * 0.5f - vector167.X; float num1374 = player.Center.Y - vector167.Y; float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); float num1376 = num1372 / num1375; num1373 *= num1376; num1374 *= num1376; - npc.ai[0] -= Main.rand.Next(6); - if (num1375 < 300f || npc.ai[0] > 0f) + NPC.ai[0] -= Main.rand.Next(6); + if (num1375 < 300f || NPC.ai[0] > 0f) { if (num1375 < 300f) { - npc.ai[0] = 100f; + NPC.ai[0] = 100f; } - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.direction = -1; + NPC.direction = -1; } else { - npc.direction = 1; + NPC.direction = 1; } return; } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f; + NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f; if (num1375 < 350f) { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + NPC.velocity.X = (NPC.velocity.X * 10f + num1373) / 11f; + NPC.velocity.Y = (NPC.velocity.Y * 10f + num1374) / 11f; } if (num1375 < 300f) { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + NPC.velocity.X = (NPC.velocity.X * 7f + num1373) / 8f; + NPC.velocity.Y = (NPC.velocity.Y * 7f + num1374) / 8f; } float num1247 = CalamityWorld.malice ? 0.65f : 0.5f; @@ -156,19 +157,19 @@ namespace CalamityMod.NPCs.OldDuke { if (Main.npc[num1248].active) { - if (num1248 != npc.whoAmI && Main.npc[num1248].type == npc.type) + if (num1248 != NPC.whoAmI && Main.npc[num1248].type == NPC.type) { - if (Vector2.Distance(npc.Center, Main.npc[num1248].Center) < 48f) + if (Vector2.Distance(NPC.Center, Main.npc[num1248].Center) < 48f) { - if (npc.position.X < Main.npc[num1248].position.X) - npc.velocity.X -= num1247; + if (NPC.position.X < Main.npc[num1248].position.X) + NPC.velocity.X -= num1247; else - npc.velocity.X += num1247; + NPC.velocity.X += num1247; - if (npc.position.Y < Main.npc[num1248].position.Y) - npc.velocity.Y -= num1247; + if (NPC.position.Y < Main.npc[num1248].position.Y) + NPC.velocity.Y -= num1247; else - npc.velocity.Y += num1247; + NPC.velocity.Y += num1247; } } } @@ -179,9 +180,9 @@ namespace CalamityMod.NPCs.OldDuke { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(8) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } return false; @@ -189,13 +190,13 @@ namespace CalamityMod.NPCs.OldDuke public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 1; - return npc.alpha == 0; + return NPC.alpha == 0; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -205,17 +206,17 @@ namespace CalamityMod.NPCs.OldDuke public override bool CheckDead() { - Main.PlaySound(SoundID.Item14, npc.position); + SoundEngine.PlaySound(SoundID.Item14, NPC.position); - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = npc.height = 96; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = NPC.height = 96; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.Next(2) == 0) { @@ -227,10 +228,10 @@ namespace CalamityMod.NPCs.OldDuke for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; Main.dust[num624].noGravity = true; } @@ -241,18 +242,18 @@ namespace CalamityMod.NPCs.OldDuke int totalProjectiles = 4; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); for (int k = 0; k < totalProjectiles; k++) { float velocity = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? Main.rand.Next(6, 10) : Main.rand.Next(7, 11); Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(NPC.Center, vector255, type, damage, 0f, Main.myPlayer); Main.projectile[proj].timeLeft = 360; } type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); + damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); } return true; @@ -262,13 +263,13 @@ namespace CalamityMod.NPCs.OldDuke { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Other/CalamitasEnchantDemon.cs b/NPCs/Other/CalamitasEnchantDemon.cs index 4e829be630..3c4ae56334 100644 --- a/NPCs/Other/CalamitasEnchantDemon.cs +++ b/NPCs/Other/CalamitasEnchantDemon.cs @@ -8,39 +8,39 @@ namespace CalamityMod.NPCs.Other { public class CalamitasEnchantDemon : ModNPC { - public Player Target => Main.player[npc.target]; - public ref float AttackTimer => ref npc.ai[0]; - public ref float FadeAwayTimer => ref npc.ai[1]; + public Player Target => Main.player[NPC.target]; + public ref float AttackTimer => ref NPC.ai[0]; + public ref float FadeAwayTimer => ref NPC.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Demon"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.width = 68; - npc.height = 68; - npc.damage = 270; - npc.defense = 0; + NPC.width = 68; + NPC.height = 68; + NPC.damage = 270; + NPC.defense = 0; // This is meant to be created after SCal is defeated and should be at least a little challenging. - npc.lifeMax = 101010; - npc.HitSound = SoundID.NPCHit47; - npc.DeathSound = SoundID.NPCDeath18; - npc.noGravity = true; - npc.noTileCollide = true; - npc.value = 0f; - npc.knockBackResist = 0f; - npc.netAlways = true; - npc.aiStyle = 0; - npc.Calamity().DoesNotDisappearInBossRush = true; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.lifeMax = 101010; + NPC.HitSound = SoundID.NPCHit47; + NPC.DeathSound = SoundID.NPCDeath18; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.value = 0f; + NPC.knockBackResist = 0f; + NPC.netAlways = true; + NPC.aiStyle = 0; + NPC.Calamity().DoesNotDisappearInBossRush = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 101010; + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => NPC.lifeMax = 101010; public override void AI() { @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.Other // This npc should not attempt to locate other targets. The only one it will accept is the // player who summoned it in the first place. - if (!Main.projectile.IndexInRange(npc.target) || Target.dead || !Target.active) + if (!Main.projectile.IndexInRange(NPC.target) || Target.dead || !Target.active) { FadeAway(); return; @@ -65,18 +65,18 @@ namespace CalamityMod.NPCs.Other public void FadeAway() { - npc.dontTakeDamage = true; - npc.Opacity = Utils.InverseLerp(50f, 0f, FadeAwayTimer, true); + NPC.dontTakeDamage = true; + NPC.Opacity = Utils.InverseLerp(50f, 0f, FadeAwayTimer, true); // Become inactive after fading away completely. - if (npc.Opacity <= 0f) + if (NPC.Opacity <= 0f) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; } // Slow down and fade away. - npc.velocity = Vector2.Lerp(npc.velocity, Vector2.UnitY * npc.Opacity * -2f, 0.125f); + NPC.velocity = Vector2.Lerp(NPC.velocity, Vector2.UnitY * NPC.Opacity * -2f, 0.125f); FadeAwayTimer++; @@ -86,7 +86,7 @@ namespace CalamityMod.NPCs.Other // Create some fade dust. for (int i = 0; i < 3; i++) { - Dust magic = Dust.NewDustDirect(npc.position, npc.width, npc.height, 223); + Dust magic = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 223); magic.velocity = -Vector2.UnitY * Main.rand.NextFloat(2.8f, 3.5f); magic.scale = Main.rand.NextFloat(1f, 1.125f); magic.fadeIn = 0.4f; @@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.Other { for (int i = 0; i < 50; i++) { - Dust magic = Dust.NewDustDirect(npc.position, npc.width, npc.height, 223); + Dust magic = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 223); magic.velocity = -Vector2.UnitY * Main.rand.NextFloat(2.8f, 3.5f); magic.scale = Main.rand.NextFloat(1f, 1.125f); magic.fadeIn = 0.7f; @@ -112,44 +112,44 @@ namespace CalamityMod.NPCs.Other } // Rise upward. - npc.velocity = Vector2.UnitX * MathHelper.Lerp(-0.1f, -3.5f, FadeAwayTimer / 15f); + NPC.velocity = Vector2.UnitX * MathHelper.Lerp(-0.1f, -3.5f, FadeAwayTimer / 15f); } public void AttackTarget() { // Slow down prior to a charge. if (AttackTimer % 120f > 90f) - npc.velocity *= 0.94f; + NPC.velocity *= 0.94f; // Otherwise attempt to move towards the player. - else if (!npc.WithinRange(Target.Center, 150f)) + else if (!NPC.WithinRange(Target.Center, 150f)) { - Vector2 idealVelocity = npc.SafeDirectionTo(Target.Center) * 16f; - npc.velocity = (npc.velocity * 29f + idealVelocity) / 30f; - npc.velocity = Vector2.Lerp(npc.velocity, idealVelocity, 0.025f); + Vector2 idealVelocity = NPC.SafeDirectionTo(Target.Center) * 16f; + NPC.velocity = (NPC.velocity * 29f + idealVelocity) / 30f; + NPC.velocity = Vector2.Lerp(NPC.velocity, idealVelocity, 0.025f); } // Charge. if (AttackTimer % 120f == 119f) - npc.velocity = npc.SafeDirectionTo(Target.Center) * 23.5f; + NPC.velocity = NPC.SafeDirectionTo(Target.Center) * 23.5f; - npc.spriteDirection = (npc.velocity.X < 0f).ToDirectionInt(); + NPC.spriteDirection = (NPC.velocity.X < 0f).ToDirectionInt(); } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter % 5f == 4f) - npc.frame.Y += frameHeight; + NPC.frameCounter++; + if (NPC.frameCounter % 5f == 4f) + NPC.frame.Y += frameHeight; - if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type]) - npc.frame.Y = 0; + if (NPC.frame.Y >= frameHeight * Main.npcFrameCount[NPC.type]) + NPC.frame.Y = 0; } public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) - Utils.PoofOfSmoke(npc.Center); + if (NPC.life <= 0) + Utils.PoofOfSmoke(NPC.Center); } public override void NPCLoot() @@ -157,8 +157,8 @@ namespace CalamityMod.NPCs.Other // Release 4 healing projectiles towards the target. for (int i = 0; i < 4; i++) { - Vector2 shootVelocity = npc.SafeDirectionTo(Target.Center).RotatedByRandom(0.6f) * Main.rand.NextFloat(12f, 14f); - Projectile.NewProjectile(npc.Center, shootVelocity, ModContent.ProjectileType(), 0, 0f, npc.target); + Vector2 shootVelocity = NPC.SafeDirectionTo(Target.Center).RotatedByRandom(0.6f) * Main.rand.NextFloat(12f, 14f); + Projectile.NewProjectile(NPC.Center, shootVelocity, ModContent.ProjectileType(), 0, 0f, NPC.target); } } } diff --git a/NPCs/Other/DemonPortal.cs b/NPCs/Other/DemonPortal.cs index f23f4c2050..2af947b8e9 100644 --- a/NPCs/Other/DemonPortal.cs +++ b/NPCs/Other/DemonPortal.cs @@ -4,53 +4,54 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Other { public class DemonPortal : ModNPC { - public ref float Time => ref npc.ai[0]; + public ref float Time => ref NPC.ai[0]; public override void SetStaticDefaults() => DisplayName.SetDefault("Mysterious Portal"); public override void SetDefaults() { - npc.width = npc.height = 60; - npc.damage = 0; - npc.defense = 0; - npc.lifeMax = 24660; - npc.noGravity = true; - npc.noTileCollide = true; - npc.value = 0f; - npc.knockBackResist = 0f; - npc.netAlways = true; - npc.aiStyle = -1; - npc.Calamity().DoesNotGenerateRage = true; - npc.Calamity().DoesNotDisappearInBossRush = true; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.width = NPC.height = 60; + NPC.damage = 0; + NPC.defense = 0; + NPC.lifeMax = 24660; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.value = 0f; + NPC.knockBackResist = 0f; + NPC.netAlways = true; + NPC.aiStyle = -1; + NPC.Calamity().DoesNotGenerateRage = true; + NPC.Calamity().DoesNotDisappearInBossRush = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 24660; + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => NPC.lifeMax = 24660; public override void AI() { - npc.rotation += 0.18f; - npc.Opacity = Utils.InverseLerp(0f, 30f, Time, true) * Utils.InverseLerp(420f, 390f, Time, true); - npc.velocity = Vector2.Zero; - npc.scale = npc.Opacity; + NPC.rotation += 0.18f; + NPC.Opacity = Utils.InverseLerp(0f, 30f, Time, true) * Utils.InverseLerp(420f, 390f, Time, true); + NPC.velocity = Vector2.Zero; + NPC.scale = NPC.Opacity; if (Time == 300f) { - if (Main.myPlayer == npc.target) + if (Main.myPlayer == NPC.target) ReleaseThings(); - Main.PlaySound(SoundID.DD2_EtherianPortalOpen, npc.Center); + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalOpen, NPC.Center); } if (Main.netMode != NetmodeID.MultiplayerClient && Time >= 420f) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; } Time++; @@ -58,10 +59,10 @@ namespace CalamityMod.NPCs.Other public void ReleaseThings() { - bool friendly = npc.life == 1; + bool friendly = NPC.life == 1; for (int i = 0; i < 6; i++) { - int demon = Projectile.NewProjectile(npc.Center, Main.rand.NextVector2CircularEdge(4f, 4f), ModContent.ProjectileType(), 17000, 0f, npc.target); + int demon = Projectile.NewProjectile(NPC.Center, Main.rand.NextVector2CircularEdge(4f, 4f), ModContent.ProjectileType(), 17000, 0f, NPC.target); if (Main.projectile.IndexInRange(demon)) { Main.projectile[demon].ai[1] = Main.rand.Next(-40, 0); @@ -82,13 +83,13 @@ namespace CalamityMod.NPCs.Other public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - bool wouldDie = npc.life - (damage * (crit ? 2D : 1D)) <= 0; + bool wouldDie = NPC.life - (damage * (crit ? 2D : 1D)) <= 0; if (wouldDie) { - npc.immortal = true; + NPC.immortal = true; // Enrage demons if hit when already at 1 health. - if (npc.life == 1) + if (NPC.life == 1) { int demonType = ModContent.ProjectileType(); for (int i = 0; i < Main.maxProjectiles; i++) @@ -102,7 +103,7 @@ namespace CalamityMod.NPCs.Other } } - npc.life = 1; + NPC.life = 1; damage = 0D; return false; } @@ -111,7 +112,7 @@ namespace CalamityMod.NPCs.Other public override bool CheckDead() { - npc.life = 1; + NPC.life = 1; return false; } @@ -119,23 +120,23 @@ namespace CalamityMod.NPCs.Other { spriteBatch.SetBlendState(BlendState.AlphaBlend); - Texture2D portalTexture = Main.npcTexture[npc.type]; - Vector2 drawPosition = npc.Center - Main.screenPosition; + Texture2D portalTexture = Main.npcTexture[NPC.type]; + Vector2 drawPosition = NPC.Center - Main.screenPosition; Vector2 origin = portalTexture.Size() * 0.5f; Color baseColor = Color.White; // Purple-black portal. - Color color = Color.Lerp(baseColor, Color.Black, 0.55f) * npc.Opacity * 1.8f; - spriteBatch.Draw(portalTexture, drawPosition, null, color, npc.rotation, origin, npc.scale * 1.2f, SpriteEffects.None, 0f); - spriteBatch.Draw(portalTexture, drawPosition, null, color, -npc.rotation, origin, npc.scale * 1.2f, SpriteEffects.None, 0f); + Color color = Color.Lerp(baseColor, Color.Black, 0.55f) * NPC.Opacity * 1.8f; + spriteBatch.Draw(portalTexture, drawPosition, null, color, NPC.rotation, origin, NPC.scale * 1.2f, SpriteEffects.None, 0f); + spriteBatch.Draw(portalTexture, drawPosition, null, color, -NPC.rotation, origin, NPC.scale * 1.2f, SpriteEffects.None, 0f); // Purple portal. - color = Color.Lerp(Color.Lerp(baseColor, Color.Purple, 0.55f), Color.Black, 0.66f) * npc.Opacity * 1.6f; - spriteBatch.Draw(portalTexture, drawPosition, null, color, npc.rotation * 0.6f, origin, npc.scale * 1.2f, SpriteEffects.None, 0f); + color = Color.Lerp(Color.Lerp(baseColor, Color.Purple, 0.55f), Color.Black, 0.66f) * NPC.Opacity * 1.6f; + spriteBatch.Draw(portalTexture, drawPosition, null, color, NPC.rotation * 0.6f, origin, NPC.scale * 1.2f, SpriteEffects.None, 0f); // Red portal. - color = Color.Lerp(baseColor, Color.Red, 0.55f) * npc.Opacity * 1.6f; - spriteBatch.Draw(portalTexture, drawPosition, null, color, npc.rotation * -0.6f, origin, npc.scale * 1.2f, SpriteEffects.None, 0f); + color = Color.Lerp(baseColor, Color.Red, 0.55f) * NPC.Opacity * 1.6f; + spriteBatch.Draw(portalTexture, drawPosition, null, color, NPC.rotation * -0.6f, origin, NPC.scale * 1.2f, SpriteEffects.None, 0f); spriteBatch.SetBlendState(BlendState.AlphaBlend); return false; diff --git a/NPCs/Other/ExhumedHeart.cs b/NPCs/Other/ExhumedHeart.cs index a21b97f5ce..236488ba88 100644 --- a/NPCs/Other/ExhumedHeart.cs +++ b/NPCs/Other/ExhumedHeart.cs @@ -9,58 +9,58 @@ namespace CalamityMod.NPCs.Other { public class ExhumedHeart : ModNPC { - public ref float Time => ref npc.ai[0]; + public ref float Time => ref NPC.ai[0]; public Player Owner { get { - if (npc.target >= 255 || npc.target < 0) - npc.TargetClosest(); - return Main.player[npc.target]; + if (NPC.target >= 255 || NPC.target < 0) + NPC.TargetClosest(); + return Main.player[NPC.target]; } } public override void SetStaticDefaults() { DisplayName.SetDefault("Exhumed Brimstone Heart"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.width = npc.height = 38; - npc.damage = 0; - npc.defense = 0; - npc.lifeMax = 51740; - npc.noGravity = true; - npc.noTileCollide = true; - npc.value = 0f; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0f; - npc.netAlways = true; - npc.aiStyle = -1; - npc.Calamity().DoesNotGenerateRage = true; - npc.Calamity().DoesNotDisappearInBossRush = true; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.width = NPC.height = 38; + NPC.damage = 0; + NPC.defense = 0; + NPC.lifeMax = 51740; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.value = 0f; + NPC.HitSound = SoundID.NPCHit13; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0f; + NPC.netAlways = true; + NPC.aiStyle = -1; + NPC.Calamity().DoesNotGenerateRage = true; + NPC.Calamity().DoesNotDisappearInBossRush = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 51740; + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => NPC.lifeMax = 51740; public override void AI() { - npc.Opacity = Utils.InverseLerp(0f, 25f, Time, true); - npc.Center = Owner.Center + (MathHelper.TwoPi * Time / 540f).ToRotationVector2() * 350f; - npc.velocity = Vector2.Zero; + NPC.Opacity = Utils.InverseLerp(0f, 25f, Time, true); + NPC.Center = Owner.Center + (MathHelper.TwoPi * Time / 540f).ToRotationVector2() * 350f; + NPC.velocity = Vector2.Zero; if (!Owner.active || Owner.dead || Owner.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) { - npc.life = 0; - npc.HitEffect(); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(); + NPC.checkDead(); + NPC.active = false; } Time++; @@ -71,7 +71,7 @@ namespace CalamityMod.NPCs.Other float widthInterpolant = Utils.InverseLerp(0f, 0.16f, completionRatio, true) * Utils.InverseLerp(1f, 0.84f, completionRatio, true); widthInterpolant = (float)Math.Pow(widthInterpolant, 8D); float baseWidth = MathHelper.Lerp(4f, 1f, widthInterpolant); - float pulseWidth = MathHelper.Lerp(0f, 3.2f, (float)Math.Pow(Math.Sin(Main.GlobalTime * 2.6f + npc.whoAmI * 1.3f + completionRatio), 16D)); + float pulseWidth = MathHelper.Lerp(0f, 3.2f, (float)Math.Pow(Math.Sin(Main.GlobalTime * 2.6f + NPC.whoAmI * 1.3f + completionRatio), 16D)); return baseWidth + pulseWidth; } @@ -83,13 +83,13 @@ namespace CalamityMod.NPCs.Other public override void FindFrame(int frameHeight) { - npc.frameCounter++; - npc.frame.Y = (int)(npc.frameCounter / 5) % Main.npcFrameCount[npc.type] * frameHeight; + NPC.frameCounter++; + NPC.frame.Y = (int)(NPC.frameCounter / 5) % Main.npcFrameCount[NPC.type] * frameHeight; } public override Color? GetAlpha(Color drawColor) { - Color color = Color.Purple * npc.Opacity; + Color color = Color.Purple * NPC.Opacity; color.A = 127; return color; } diff --git a/NPCs/Other/LecherousOrb.cs b/NPCs/Other/LecherousOrb.cs index bd2068bd8d..0c714e3e34 100644 --- a/NPCs/Other/LecherousOrb.cs +++ b/NPCs/Other/LecherousOrb.cs @@ -8,74 +8,74 @@ namespace CalamityMod.NPCs.Other { public class LecherousOrb : ModNPC { - public ref float Time => ref npc.ai[0]; - public ref float Frame => ref npc.localAI[0]; + public ref float Time => ref NPC.ai[0]; + public ref float Frame => ref NPC.localAI[0]; public Player Owner { get { - if (npc.target >= 255 || npc.target < 0) - npc.TargetClosest(); - return Main.player[npc.target]; + if (NPC.target >= 255 || NPC.target < 0) + NPC.TargetClosest(); + return Main.player[NPC.target]; } } public override void SetStaticDefaults() => DisplayName.SetDefault("Lecherous Orb"); public override void SetDefaults() { - npc.width = npc.height = 28; - npc.damage = 0; - npc.defense = 0; - npc.lifeMax = 181445; - npc.noGravity = true; - npc.noTileCollide = true; - npc.value = 0f; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath7; - npc.knockBackResist = 0f; - npc.netAlways = true; - npc.aiStyle = -1; - npc.canGhostHeal = false; - npc.Calamity().DoesNotGenerateRage = true; - npc.Calamity().DoesNotDisappearInBossRush = true; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToWater = true; + NPC.width = NPC.height = 28; + NPC.damage = 0; + NPC.defense = 0; + NPC.lifeMax = 181445; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.value = 0f; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath7; + NPC.knockBackResist = 0f; + NPC.netAlways = true; + NPC.aiStyle = -1; + NPC.canGhostHeal = false; + NPC.Calamity().DoesNotGenerateRage = true; + NPC.Calamity().DoesNotDisappearInBossRush = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 181445; + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => NPC.lifeMax = 181445; public override void AI() { - npc.Opacity = Utils.InverseLerp(0f, 15f, Time, true); - npc.velocity = Vector2.Zero; + NPC.Opacity = Utils.InverseLerp(0f, 15f, Time, true); + NPC.velocity = Vector2.Zero; - if (Main.myPlayer == npc.target) + if (Main.myPlayer == NPC.target) { // Disappear if the player no longer has the enchanted weapon. if (!Owner.Calamity().lecherousOrbEnchant) { - npc.active = false; - npc.life = 0; - npc.HitEffect(); - npc.checkDead(); - npc.netUpdate = true; + NPC.active = false; + NPC.life = 0; + NPC.HitEffect(); + NPC.checkDead(); + NPC.netUpdate = true; } // Notify the owner that the orb has indeed spawned. Owner.Calamity().awaitingLecherousOrbSpawn = false; Vector2 destination = Vector2.Lerp(Owner.Center, Main.MouseWorld, 0.625f); - npc.Center = Vector2.Lerp(npc.Center, destination, 0.035f).MoveTowards(destination, 8f); - if (npc.WithinRange(destination, 5f)) - npc.Center = destination; + NPC.Center = Vector2.Lerp(NPC.Center, destination, 0.035f).MoveTowards(destination, 8f); + if (NPC.WithinRange(destination, 5f)) + NPC.Center = destination; - if (!npc.WithinRange(destination, 2000f)) - npc.Center = Owner.Center; + if (!NPC.WithinRange(destination, 2000f)) + NPC.Center = Owner.Center; - bool wasNotAtDestinationBefore = Vector2.Distance(npc.position + npc.Size * 0.5f, destination) < 0.1f && Vector2.Distance(npc.oldPosition + npc.Size * 0.5f, destination) > 0.1f; - if (Vector2.Distance(npc.position, npc.oldPosition) > 30f || wasNotAtDestinationBefore) - npc.SyncMotionToServer(); + bool wasNotAtDestinationBefore = Vector2.Distance(NPC.position + NPC.Size * 0.5f, destination) < 0.1f && Vector2.Distance(NPC.oldPosition + NPC.Size * 0.5f, destination) > 0.1f; + if (Vector2.Distance(NPC.position, NPC.oldPosition) > 30f || wasNotAtDestinationBefore) + NPC.SyncMotionToServer(); } // Randomly start animations. @@ -85,7 +85,7 @@ namespace CalamityMod.NPCs.Other Frame = 8f; // Face the owner. - npc.spriteDirection = (Owner.Center.X > npc.Center.X).ToDirectionInt(); + NPC.spriteDirection = (Owner.Center.X > NPC.Center.X).ToDirectionInt(); Time++; } @@ -94,7 +94,7 @@ namespace CalamityMod.NPCs.Other { for (int i = 0; i < 3; i++) { - Dust magic = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Circular(12f, 12f), 264); + Dust magic = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Circular(12f, 12f), 264); magic.color = Color.Red; magic.velocity = Main.rand.NextVector2Circular(3f, 3f); magic.fadeIn = 0.9f; @@ -102,11 +102,11 @@ namespace CalamityMod.NPCs.Other magic.noGravity = true; } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int i = 0; i < 15; i++) { - Dust magic = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Circular(12f, 12f), 264); + Dust magic = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Circular(12f, 12f), 264); magic.color = Color.Red; magic.velocity = Main.rand.NextVector2Circular(6f, 6f); magic.fadeIn = 1.25f; @@ -115,19 +115,19 @@ namespace CalamityMod.NPCs.Other } for (int i = 1; i <= 4; i++) - Gore.NewGoreDirect(npc.Center, Main.rand.NextVector2Circular(3f, 3f), mod.GetGoreSlot($"Gores/LecherousOrb/LecherousGore{i}")); + Gore.NewGoreDirect(NPC.Center, Main.rand.NextVector2Circular(3f, 3f), Mod.GetGoreSlot($"Gores/LecherousOrb/LecherousGore{i}")); } } public override void FindFrame(int frameHeight) { if (Frame != 0f) - npc.frameCounter++; + NPC.frameCounter++; else - npc.frameCounter = 0f; + NPC.frameCounter = 0f; // Perform the blink animation. - if (Frame >= 1f && Frame < 8f && npc.frameCounter % 6f == 5f) + if (Frame >= 1f && Frame < 8f && NPC.frameCounter % 6f == 5f) { Frame++; if (Frame >= 8f) @@ -135,7 +135,7 @@ namespace CalamityMod.NPCs.Other } // Perform the turning inside-out animation. - if (Frame >= 8f && Frame < 25f && npc.frameCounter % 5f == 4f) + if (Frame >= 8f && Frame < 25f && NPC.frameCounter % 5f == 4f) { Frame++; if (Frame >= 25f) @@ -144,32 +144,32 @@ namespace CalamityMod.NPCs.Other int verticalFrame = (int)Frame % 22; int horizontalFrame = (int)Frame / 22; - npc.frame.X = horizontalFrame * 64; - npc.frame.Y = verticalFrame * 90; - npc.frame.Width = 64; - npc.frame.Height = 90; + NPC.frame.X = horizontalFrame * 64; + NPC.frame.Y = verticalFrame * 90; + NPC.frame.Width = 64; + NPC.frame.Height = 90; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 drawPosition = npc.Center - Main.screenPosition; - SpriteEffects direction = npc.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Texture2D texture = Main.npcTexture[NPC.type]; + Vector2 drawPosition = NPC.Center - Main.screenPosition; + SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; // Draw a faded version of the heart behind the main one that pulses. float pulse = Main.GlobalTime * 1.9f % 1f; - float pulseScale = npc.scale * (1f + pulse * 0.33f); - Color pulseColor = npc.GetAlpha(Color.Red) * (1f - pulse) * 0.44f; - spriteBatch.Draw(texture, drawPosition, npc.frame, pulseColor, npc.rotation, npc.frame.Size() * 0.5f, pulseScale, direction, 0f); + float pulseScale = NPC.scale * (1f + pulse * 0.33f); + Color pulseColor = NPC.GetAlpha(Color.Red) * (1f - pulse) * 0.44f; + spriteBatch.Draw(texture, drawPosition, NPC.frame, pulseColor, NPC.rotation, NPC.frame.Size() * 0.5f, pulseScale, direction, 0f); - spriteBatch.Draw(texture, drawPosition, npc.frame, npc.GetAlpha(drawColor), npc.rotation, npc.frame.Size() * 0.5f, npc.scale, direction, 0f); + spriteBatch.Draw(texture, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0f); return false; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (Main.myPlayer == npc.target) - npc.SyncMotionToServer(); + if (Main.myPlayer == NPC.target) + NPC.SyncMotionToServer(); return base.StrikeNPC(ref damage, defense, ref knockback, hitDirection, ref crit); } @@ -178,9 +178,9 @@ namespace CalamityMod.NPCs.Other { int heartsToGive = (int)MathHelper.Lerp(0f, 7f, Utils.InverseLerp(45f, 540f, Time, true)); for (int i = 0; i < heartsToGive; i++) - DropHelper.DropItem(npc, ItemID.Heart); + DropHelper.DropItem(NPC, ItemID.Heart); } - public override Color? GetAlpha(Color drawColor) => Color.White * npc.Opacity; + public override Color? GetAlpha(Color drawColor) => Color.White * NPC.Opacity; } } diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index db934428d6..3e15e96e7c 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -18,38 +18,38 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.GetNPCDamage(); - npc.width = 60; - npc.height = 60; - npc.defense = 8; - npc.LifeMaxNERB(2250, 2700, 80000); + NPC.GetNPCDamage(); + NPC.width = 60; + NPC.height = 60; + NPC.defense = 8; + NPC.LifeMaxNERB(2250, 2700, 80000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -59,11 +59,11 @@ namespace CalamityMod.NPCs.Perforator public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(true); bool shouldDespawn = true; for (int i = 0; i < Main.maxNPCs; i++) @@ -76,32 +76,32 @@ namespace CalamityMod.NPCs.Perforator } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - if (Main.player[npc.target].dead) - npc.TargetClosest(false); + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -109,52 +109,52 @@ namespace CalamityMod.NPCs.Perforator num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; else if (num191 > 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = npc.localAI[3] == 1f ? ModContent.GetTexture("CalamityMod/NPCs/Perforator/PerforatorBodyLargeAlt") : Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = NPC.localAI[3] == 1f ? ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeAlt") : Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = npc.localAI[3] == 1f ? ModContent.GetTexture("CalamityMod/NPCs/Perforator/PerforatorBodyLargeAltGlow") : ModContent.GetTexture("CalamityMod/NPCs/Perforator/PerforatorBodyLargeGlow"); + texture2D15 = NPC.localAI[3] == 1f ? ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeAltGlow") : ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyLargeGlow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -173,17 +173,17 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf3"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf4"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/LargePerf2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/LargePerf3"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/LargePerf4"), NPC.scale); } } diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 6832b77066..b18efe7942 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -19,117 +19,117 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 40; - npc.height = 40; - npc.defense = 6; - npc.LifeMaxNERB(150, 180, 7000); + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 40; + NPC.height = 40; + NPC.defense = 6; + NPC.LifeMaxNERB(150, 180, 7000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().SplittingWorm = true; + NPC.Calamity().SplittingWorm = true; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void AI() { - npc.realLife = -1; + NPC.realLife = -1; // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(true); - if (Main.player[npc.target].dead) - npc.TargetClosest(false); + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - if (npc.ai[2] > 0f) - npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + if (NPC.ai[2] > 0f) + NPC.ai[0] = NPC.NewNPC((int)(NPC.position.X + (NPC.width / 2)), (int)(NPC.position.Y + NPC.height), NPC.type, NPC.whoAmI, 0f, 0f, 0f, 0f, 255); else - npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.ai[0] = NPC.NewNPC((int)(NPC.position.X + (NPC.width / 2)), (int)(NPC.position.Y + NPC.height), ModContent.NPCType(), NPC.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[(int)npc.ai[0]].ai[1] = npc.whoAmI; - Main.npc[(int)npc.ai[0]].ai[2] = npc.ai[2] - 1f; - npc.netUpdate = true; + Main.npc[(int)NPC.ai[0]].ai[1] = NPC.whoAmI; + Main.npc[(int)NPC.ai[0]].ai[2] = NPC.ai[2] - 1f; + NPC.netUpdate = true; } // Splitting effect - if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) + if (!Main.npc[(int)NPC.ai[1]].active && !Main.npc[(int)NPC.ai[0]].active) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle) + if (!Main.npc[(int)NPC.ai[1]].active || Main.npc[(int)NPC.ai[1]].aiStyle != NPC.aiStyle) { - npc.type = ModContent.NPCType(); - int whoAmI = npc.whoAmI; - float num25 = npc.life / (float)npc.lifeMax; - float num26 = npc.ai[0]; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)(npc.lifeMax * num25); - npc.ai[0] = num26; - npc.TargetClosest(true); - npc.netUpdate = true; - npc.whoAmI = whoAmI; + NPC.type = ModContent.NPCType(); + int whoAmI = NPC.whoAmI; + float num25 = NPC.life / (float)NPC.lifeMax; + float num26 = NPC.ai[0]; + NPC.SetDefaultsKeepPlayerInteraction(NPC.type); + NPC.life = (int)(NPC.lifeMax * num25); + NPC.ai[0] = num26; + NPC.TargetClosest(true); + NPC.netUpdate = true; + NPC.whoAmI = whoAmI; } - if (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle) + if (!Main.npc[(int)NPC.ai[0]].active || Main.npc[(int)NPC.ai[0]].aiStyle != NPC.aiStyle) { - int whoAmI2 = npc.whoAmI; - float num27 = npc.life / (float)npc.lifeMax; - float num28 = npc.ai[1]; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)(npc.lifeMax * num27); - npc.ai[1] = num28; - npc.TargetClosest(true); - npc.netUpdate = true; - npc.whoAmI = whoAmI2; + int whoAmI2 = NPC.whoAmI; + float num27 = NPC.life / (float)NPC.lifeMax; + float num28 = NPC.ai[1]; + NPC.SetDefaultsKeepPlayerInteraction(NPC.type); + NPC.life = (int)(NPC.lifeMax * num27); + NPC.ai[1] = num28; + NPC.TargetClosest(true); + NPC.netUpdate = true; + NPC.whoAmI = whoAmI2; } - if (!npc.active && Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + if (!NPC.active && Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - Vector2 vector2 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num39 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num40 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + Vector2 vector2 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num39 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float num40 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); num39 = (int)(num39 / 16f) * 16; num40 = (int)(num40 / 16f) * 16; @@ -139,49 +139,49 @@ namespace CalamityMod.NPCs.Perforator num40 -= vector2.Y; float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector2 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num39 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector2.X; - num40 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector2.Y; + vector2 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + num39 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector2.X; + num40 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector2.Y; } catch { } - npc.rotation = (float)Math.Atan2(num40, num39) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(num40, num39) + MathHelper.PiOver2; num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); - int num53 = npc.width; - num53 = (int)(num53 * npc.scale); + int num53 = NPC.width; + num53 = (int)(num53 * NPC.scale); num52 = (num52 - num53) / num52; num39 *= num52; num40 *= num52; - npc.velocity = Vector2.Zero; - npc.position.X += num39; - npc.position.Y += num40; + NPC.velocity = Vector2.Zero; + NPC.position.X += num39; + NPC.position.Y += num40; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Perforator/PerforatorBodyMediumGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodyMediumGlow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -195,9 +195,9 @@ namespace CalamityMod.NPCs.Perforator { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(4) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } return false; @@ -207,16 +207,16 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf3"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/MediumPerf2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/MediumPerf3"), NPC.scale); } } diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 868803bfce..363a61700f 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -18,38 +18,38 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.GetNPCDamage(); - npc.width = 42; - npc.height = 42; - npc.defense = 4; - npc.LifeMaxNERB(1000, 1200, 50000); + NPC.GetNPCDamage(); + NPC.width = 42; + NPC.height = 42; + NPC.defense = 4; + NPC.LifeMaxNERB(1000, 1200, 50000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -59,11 +59,11 @@ namespace CalamityMod.NPCs.Perforator public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(true); bool shouldDespawn = true; for (int i = 0; i < Main.maxNPCs; i++) @@ -76,32 +76,32 @@ namespace CalamityMod.NPCs.Perforator } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - if (Main.player[npc.target].dead) - npc.TargetClosest(false); + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -109,52 +109,52 @@ namespace CalamityMod.NPCs.Perforator num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; else if (num191 > 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Perforator/PerforatorBodySmallGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorBodySmallGlow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -173,15 +173,15 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf2"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SmallPerf2"), NPC.scale); } } diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs index b0a93d1221..9a5437dee6 100644 --- a/NPCs/Perforator/PerforatorCyst.cs +++ b/NPCs/Perforator/PerforatorCyst.cs @@ -12,67 +12,67 @@ namespace CalamityMod.NPCs.Perforator public override void SetStaticDefaults() { DisplayName.SetDefault("Perforator Cyst"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.npcSlots = 0.1f; - npc.aiStyle = -1; + NPC.npcSlots = 0.1f; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 0; - npc.width = 30; //324 - npc.height = 26; //216 - npc.defense = 0; - npc.lifeMax = 1000; - npc.knockBackResist = 0f; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit13; - npc.rarity = 2; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.damage = 0; + NPC.width = 30; //324 + NPC.height = 26; //216 + NPC.defense = 0; + NPC.lifeMax = 1000; + NPC.knockBackResist = 0f; + NPC.chaseable = false; + NPC.HitSound = SoundID.NPCHit13; + NPC.rarity = 2; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Perforator/PerforatorCystGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorCystGlow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) return 0f; - if (spawnInfo.player.Calamity().disablePerfCystSpawns) + if (spawnInfo.Player.Calamity().disablePerfCystSpawns) return 0f; bool anyBossElements = NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()); - bool crimson = TileID.Sets.Crimson[spawnInfo.spawnTileType] || spawnInfo.spawnTileType == TileID.Crimtane && spawnInfo.player.ZoneCrimson; + bool crimson = TileID.Sets.Crimson[spawnInfo.spawnTileType] || spawnInfo.spawnTileType == TileID.Crimtane && spawnInfo.Player.ZoneCrimson; if (spawnInfo.playerSafe || anyBossElements || !crimson) return 0f; @@ -84,25 +84,25 @@ namespace CalamityMod.NPCs.Perforator public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = 2000; - npc.damage = 0; + NPC.lifeMax = 2000; + NPC.damage = 0; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(ModContent.NPCType()) < 1) { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + Vector2 spawnAt = NPC.Center + new Vector2(0f, (float)NPC.height / 2f); NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType()); } } diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 8e615fbcf9..5f133c21c7 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using System.IO; +using Terraria.Audio; namespace CalamityMod.NPCs.Perforator { @@ -24,52 +25,52 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 70; - npc.height = 84; - npc.defense = 4; - npc.LifeMaxNERB(2250, 2700, 80000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 70; + NPC.height = 84; + NPC.defense = 4; + NPC.LifeMaxNERB(2250, 2700, 80000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(biomeEnrageTimer); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { biomeEnrageTimer = reader.ReadInt32(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() @@ -80,7 +81,7 @@ namespace CalamityMod.NPCs.Perforator bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Enrage - if ((!Main.player[npc.target].ZoneCrimson || (npc.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) + if ((!Main.player[NPC.target].ZoneCrimson || (NPC.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) { if (biomeEnrageTimer > 0) biomeEnrageTimer--; @@ -91,22 +92,22 @@ namespace CalamityMod.NPCs.Perforator bool biomeEnraged = biomeEnrageTimer <= 0 || malice; float enrageScale = BossRushEvent.BossRushActive ? 1f : 0f; - if (biomeEnraged && (!Main.player[npc.target].ZoneCrimson || malice)) + if (biomeEnraged && (!Main.player[NPC.target].ZoneCrimson || malice)) enrageScale += 1f; - if (biomeEnraged && ((npc.position.Y / 16f) < Main.worldSurface || malice)) + if (biomeEnraged && ((NPC.position.Y / 16f) < Main.worldSurface || malice)) enrageScale += 1f; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; if (revenge || lifeRatio < (expertMode ? 0.75f : 0.5f)) - npc.Calamity().newAI[0] += 1f; + NPC.Calamity().newAI[0] += 1f; float burrowTimeGateValue = death ? 480f : 600f; - bool burrow = npc.Calamity().newAI[0] >= burrowTimeGateValue; - bool resetTime = npc.Calamity().newAI[0] >= burrowTimeGateValue + 600f; - bool lungeUpward = burrow && npc.Calamity().newAI[1] == 1f; - bool quickFall = npc.Calamity().newAI[1] == 2f; + bool burrow = NPC.Calamity().newAI[0] >= burrowTimeGateValue; + bool resetTime = NPC.Calamity().newAI[0] >= burrowTimeGateValue + 600f; + bool lungeUpward = burrow && NPC.Calamity().newAI[1] == 1f; + bool quickFall = NPC.Calamity().newAI[1] == 2f; float speed = 0.09f; float turnSpeed = 0.06f; @@ -125,46 +126,46 @@ namespace CalamityMod.NPCs.Perforator turnSpeed *= 1.5f; } - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { if (!TailSpawned) { - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; int maxLength = death ? 27 : revenge ? 24 : expertMode ? 21 : 15; for (int num36 = 0; num36 < maxLength; num36++) { int lol; if (num36 >= 0 && num36 < maxLength - 1) { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } else { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } if (num36 % 2 == 0) { Main.npc[lol].localAI[3] = 1f; } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = NPC.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); @@ -174,10 +175,10 @@ namespace CalamityMod.NPCs.Perforator } } - int num12 = (int)(npc.position.X / 16f) - 1; - int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num14 = (int)(npc.position.Y / 16f) - 1; - int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + int num12 = (int)(NPC.position.X / 16f) - 1; + int num13 = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; + int num14 = (int)(NPC.position.Y / 16f) - 1; + int num15 = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; if (num12 < 0) { num12 = 0; @@ -201,12 +202,12 @@ namespace CalamityMod.NPCs.Perforator { for (int l = num14; l < num15; l++) { - if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) + if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].liquid > 64)) { Vector2 vector2; vector2.X = (float)(k * 16); vector2.Y = (float)(l * 16); - if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) + if (NPC.position.X + (float)NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + (float)NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f) { flag2 = true; break; @@ -217,11 +218,11 @@ namespace CalamityMod.NPCs.Perforator } if (!flag2) { - npc.localAI[1] = 1f; - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + NPC.localAI[1] = 1f; + Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); int num16 = death ? 160 : revenge ? 200 : expertMode ? 240 : 300; bool flag3 = true; - if (npc.position.Y > player.position.Y) + if (NPC.position.Y > player.position.Y) { for (int m = 0; m < 255; m++) { @@ -243,20 +244,20 @@ namespace CalamityMod.NPCs.Perforator } else { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; } float num17 = 16f; if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) { flag2 = false; - npc.velocity.Y += 1f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) + NPC.velocity.Y += 1f; + if ((double)NPC.position.Y > Main.worldSurface * 16.0) { - npc.velocity.Y += 1f; + NPC.velocity.Y += 1f; num17 = 32f; } - if ((double)npc.position.Y > Main.rockLayer * 16.0) + if ((double)NPC.position.Y > Main.rockLayer * 16.0) { for (int a = 0; a < 200; a++) { @@ -274,7 +275,7 @@ namespace CalamityMod.NPCs.Perforator float burrowDistance = malice ? 500f : 800f; float burrowTarget = player.Center.Y + burrowDistance; float lungeTarget = player.Center.Y - 600f; - Vector2 vector3 = npc.Center; + Vector2 vector3 = NPC.Center; float num20 = player.Center.X; float num21 = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y; num20 = (float)((int)(num20 / 16f) * 16); @@ -286,79 +287,79 @@ namespace CalamityMod.NPCs.Perforator float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); // Lunge up towards target - if (burrow && npc.Center.Y >= burrowTarget - 16f) - npc.Calamity().newAI[1] = 1f; + if (burrow && NPC.Center.Y >= burrowTarget - 16f) + NPC.Calamity().newAI[1] = 1f; // Quickly fall back down once above target - if (lungeUpward && npc.Center.Y <= player.Center.Y - 420f) + if (lungeUpward && NPC.Center.Y <= player.Center.Y - 420f) { - npc.TargetClosest(); - npc.Calamity().newAI[1] = 2f; + NPC.TargetClosest(); + NPC.Calamity().newAI[1] = 2f; } // Quickly fall and reset variables once at target's Y position if (quickFall) { - npc.velocity.Y += 0.5f; - if (npc.Center.Y >= player.Center.Y) + NPC.velocity.Y += 0.5f; + if (NPC.Center.Y >= player.Center.Y) { - npc.Calamity().newAI[0] = 0f; - npc.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; } } // Reset variables if the burrow and lunge attack is taking too long if (resetTime) { - npc.Calamity().newAI[0] = 0f; - npc.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; } if (!flag2) { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + 0.15f; - if (npc.velocity.Y > num17) + NPC.TargetClosest(true); + NPC.velocity.Y = NPC.velocity.Y + 0.15f; + if (NPC.velocity.Y > num17) { - npc.velocity.Y = num17; + NPC.velocity.Y = num17; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4) { - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; } else { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; } } - else if (npc.velocity.Y == num17) + else if (NPC.velocity.Y == num17) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } } - else if (npc.velocity.Y > 4f) + else if (NPC.velocity.Y > 4f) { - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.velocity.X = npc.velocity.X + num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X + num18 * 0.9f; } else { - npc.velocity.X = npc.velocity.X - num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X - num18 * 0.9f; } } } else { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { float num24 = num22 / 40f; if (num24 < 10f) @@ -369,8 +370,8 @@ namespace CalamityMod.NPCs.Perforator { num24 = 20f; } - npc.soundDelay = (int)num24; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + NPC.soundDelay = (int)num24; + SoundEngine.PlaySound(SoundID.Roar, (int)NPC.position.X, (int)NPC.position.Y, 1, 1f, 0f); } num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); float num25 = Math.Abs(num20); @@ -378,152 +379,152 @@ namespace CalamityMod.NPCs.Perforator float num27 = num17 / num22; num20 *= num27; num21 *= num27; - if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) + if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num19; + NPC.velocity.X = NPC.velocity.X + num19; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num19; + NPC.velocity.X = NPC.velocity.X - num19; } - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num19; + NPC.velocity.Y = NPC.velocity.Y + num19; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num19; + NPC.velocity.Y = NPC.velocity.Y - num19; } } - if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) + if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + num18; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - num18; } - if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f))) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num18 * 2f; } else { - npc.velocity.Y = npc.velocity.Y - num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num18 * 2f; } } - if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f))) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num18 * 2f; + NPC.velocity.X = NPC.velocity.X + num18 * 2f; } else { - npc.velocity.X = npc.velocity.X - num18 * 2f; + NPC.velocity.X = NPC.velocity.X - num18 * 2f; } } } else if (num25 > num26) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + num18; } else { - npc.velocity.Y = npc.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - num18; } } } else { - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } else { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } } } } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; if (flag2) { - if (npc.localAI[0] != 1f) + if (NPC.localAI[0] != 1f) { - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.localAI[0] = 1f; + NPC.localAI[0] = 1f; } else { - if (npc.localAI[0] != 0f) + if (NPC.localAI[0] != 0f) { - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) { - npc.netUpdate = true; + NPC.netUpdate = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Perforator/PerforatorHeadLargeGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadLargeGlow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -537,16 +538,16 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf2"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/LargePerf"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/LargePerf2"), NPC.scale); } } @@ -558,11 +559,11 @@ namespace CalamityMod.NPCs.Perforator public override bool SpecialNPCLoot() { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + int closestSegmentID = DropHelper.FindClosestWormSegment(NPC, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()); - npc.position = Main.npc[closestSegmentID].position; + NPC.position = Main.npc[closestSegmentID].position; return false; } @@ -572,7 +573,7 @@ namespace CalamityMod.NPCs.Perforator { int heartAmt = Main.rand.Next(3) + 3; for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } } diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 622238bef7..56bcab7251 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -7,6 +7,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Perforator { @@ -20,40 +21,40 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 58; - npc.height = 68; - npc.defense = 2; - npc.LifeMaxNERB(150, 180, 7000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 58; + NPC.height = 68; + NPC.defense = 2; + NPC.LifeMaxNERB(150, 180, 7000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().SplittingWorm = true; + NPC.Calamity().SplittingWorm = true; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void AI() @@ -64,13 +65,13 @@ namespace CalamityMod.NPCs.Perforator bool death = CalamityWorld.death || BossRushEvent.BossRushActive; float enrageScale = BossRushEvent.BossRushActive ? 1f : 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || malice) + if ((NPC.position.Y / 16f) < Main.worldSurface || malice) enrageScale += 1f; - if (!Main.player[npc.target].ZoneCrimson || malice) + if (!Main.player[NPC.target].ZoneCrimson || malice) enrageScale += 1f; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; float speed = 0.08f; float turnSpeed = 0.06f; @@ -83,61 +84,61 @@ namespace CalamityMod.NPCs.Perforator turnSpeed += accelerationScale * (1f - lifeRatio); } - npc.realLife = -1; + NPC.realLife = -1; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { int totalSegments = death ? 14 : revenge ? 13 : expertMode ? 12 : 10; - npc.ai[2] = totalSegments; - npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[(int)npc.ai[0]].ai[1] = npc.whoAmI; - Main.npc[(int)npc.ai[0]].ai[2] = npc.ai[2] - 1f; - npc.netUpdate = true; + NPC.ai[2] = totalSegments; + NPC.ai[0] = NPC.NewNPC((int)(NPC.position.X + (NPC.width / 2)), (int)(NPC.position.Y + NPC.height), ModContent.NPCType(), NPC.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[(int)NPC.ai[0]].ai[1] = NPC.whoAmI; + Main.npc[(int)NPC.ai[0]].ai[2] = NPC.ai[2] - 1f; + NPC.netUpdate = true; } // Splitting effect - if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) + if (!Main.npc[(int)NPC.ai[1]].active && !Main.npc[(int)NPC.ai[0]].active) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - if (!Main.npc[(int)npc.ai[0]].active) + if (!Main.npc[(int)NPC.ai[0]].active) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - if (!npc.active && Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + if (!NPC.active && Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } // Movement - int num29 = (int)(npc.position.X / 16f) - 1; - int num30 = (int)((npc.position.X + npc.width) / 16f) + 2; - int num31 = (int)(npc.position.Y / 16f) - 1; - int num32 = (int)((npc.position.Y + npc.height) / 16f) + 2; + int num29 = (int)(NPC.position.X / 16f) - 1; + int num30 = (int)((NPC.position.X + NPC.width) / 16f) + 2; + int num31 = (int)(NPC.position.Y / 16f) - 1; + int num32 = (int)((NPC.position.Y + NPC.height) / 16f) + 2; if (num29 < 0) num29 = 0; if (num30 > Main.maxTilesX) @@ -155,12 +156,12 @@ namespace CalamityMod.NPCs.Perforator { for (int num34 = num31; num34 < num32; num34++) { - if (Main.tile[num33, num34] != null && ((Main.tile[num33, num34].nactive() && (Main.tileSolid[Main.tile[num33, num34].type] || (Main.tileSolidTop[Main.tile[num33, num34].type] && Main.tile[num33, num34].frameY == 0))) || Main.tile[num33, num34].liquid > 64)) + if (Main.tile[num33, num34] != null && ((Main.tile[num33, num34].nactive() && (Main.tileSolid[Main.tile[num33, num34].TileType] || (Main.tileSolidTop[Main.tile[num33, num34].TileType] && Main.tile[num33, num34].TileFrameY == 0))) || Main.tile[num33, num34].liquid > 64)) { Vector2 vector; vector.X = num33 * 16; vector.Y = num34 * 16; - if (npc.position.X + npc.width > vector.X && npc.position.X < vector.X + 16f && npc.position.Y + npc.height > vector.Y && npc.position.Y < vector.Y + 16f) + if (NPC.position.X + NPC.width > vector.X && NPC.position.X < vector.X + 16f && NPC.position.Y + NPC.height > vector.Y && NPC.position.Y < vector.Y + 16f) { flag2 = true; if (Main.rand.NextBool(100) && Main.tile[num33, num34].nactive()) @@ -174,7 +175,7 @@ namespace CalamityMod.NPCs.Perforator } if (!flag2) { - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); int num35 = death ? 160 : revenge ? 200 : expertMode ? 240 : 300; bool flag3 = true; for (int num36 = 0; num36 < Main.maxPlayers; num36++) @@ -196,19 +197,19 @@ namespace CalamityMod.NPCs.Perforator float fallSpeed = 16f; if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) { - npc.TargetClosest(false); + NPC.TargetClosest(false); flag2 = false; - npc.velocity.Y += 1f; - if (npc.position.Y > Main.worldSurface * 16.0) + NPC.velocity.Y += 1f; + if (NPC.position.Y > Main.worldSurface * 16.0) { - npc.velocity.Y += 1f; + NPC.velocity.Y += 1f; fallSpeed = 32f; } - if (npc.position.Y > Main.rockLayer * 16.0) + if (NPC.position.Y > Main.rockLayer * 16.0) { for (int num957 = 0; num957 < Main.maxNPCs; num957++) { - if (Main.npc[num957].type == npc.type || Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType()) + if (Main.npc[num957].type == NPC.type || Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType()) { Main.npc[num957].active = false; } @@ -220,7 +221,7 @@ namespace CalamityMod.NPCs.Perforator float num37 = speed; float num38 = turnSpeed; - Vector2 vector2 = npc.Center; + Vector2 vector2 = NPC.Center; float num39 = player.Center.X; float num40 = player.Center.Y; @@ -233,46 +234,46 @@ namespace CalamityMod.NPCs.Perforator float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); // Prevent new heads from being slowed when they spawn - if (npc.Calamity().newAI[1] < 3f) + if (NPC.Calamity().newAI[1] < 3f) { - npc.Calamity().newAI[1] += 1f; + NPC.Calamity().newAI[1] += 1f; // Set velocity for when a new head spawns - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * (num37 * (death ? 0.3f : 0.2f)); + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (num37 * (death ? 0.3f : 0.2f)); } if (!flag2) { - npc.velocity.Y += 0.15f; - if (npc.velocity.Y > fallSpeed) - npc.velocity.Y = fallSpeed; + NPC.velocity.Y += 0.15f; + if (NPC.velocity.Y > fallSpeed) + NPC.velocity.Y = fallSpeed; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.4) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 0.4) { - if (npc.velocity.X < 0f) - npc.velocity.X -= num38 * 1.1f; + if (NPC.velocity.X < 0f) + NPC.velocity.X -= num38 * 1.1f; else - npc.velocity.X += num38 * 1.1f; + NPC.velocity.X += num38 * 1.1f; } - else if (npc.velocity.Y == fallSpeed) + else if (NPC.velocity.Y == fallSpeed) { - if (npc.velocity.X < num39) - npc.velocity.X += num38; - else if (npc.velocity.X > num39) - npc.velocity.X -= num38; + if (NPC.velocity.X < num39) + NPC.velocity.X += num38; + else if (NPC.velocity.X > num39) + NPC.velocity.X -= num38; } - else if (npc.velocity.Y > 4f) + else if (NPC.velocity.Y > 4f) { - if (npc.velocity.X < 0f) - npc.velocity.X += num38 * 0.9f; + if (NPC.velocity.X < 0f) + NPC.velocity.X += num38 * 0.9f; else - npc.velocity.X -= num38 * 0.9f; + NPC.velocity.X -= num38 * 0.9f; } } else { // Sound - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { float num54 = num52 / 40f; if (num54 < 10f) @@ -280,8 +281,8 @@ namespace CalamityMod.NPCs.Perforator if (num54 > 20f) num54 = 20f; - npc.soundDelay = (int)num54; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + NPC.soundDelay = (int)num54; + SoundEngine.PlaySound(SoundID.Roar, (int)NPC.position.X, (int)NPC.position.Y, 1, 1f, 0f); } num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); @@ -291,117 +292,117 @@ namespace CalamityMod.NPCs.Perforator num39 *= num57; num40 *= num57; - if (((npc.velocity.X > 0f && num39 > 0f) || (npc.velocity.X < 0f && num39 < 0f)) && ((npc.velocity.Y > 0f && num40 > 0f) || (npc.velocity.Y < 0f && num40 < 0f))) + if (((NPC.velocity.X > 0f && num39 > 0f) || (NPC.velocity.X < 0f && num39 < 0f)) && ((NPC.velocity.Y > 0f && num40 > 0f) || (NPC.velocity.Y < 0f && num40 < 0f))) { - if (npc.velocity.X < num39) - npc.velocity.X += num38; - else if (npc.velocity.X > num39) - npc.velocity.X -= num38; + if (NPC.velocity.X < num39) + NPC.velocity.X += num38; + else if (NPC.velocity.X > num39) + NPC.velocity.X -= num38; - if (npc.velocity.Y < num40) - npc.velocity.Y += num38; - else if (npc.velocity.Y > num40) - npc.velocity.Y -= num38; + if (NPC.velocity.Y < num40) + NPC.velocity.Y += num38; + else if (NPC.velocity.Y > num40) + NPC.velocity.Y -= num38; } - if ((npc.velocity.X > 0f && num39 > 0f) || (npc.velocity.X < 0f && num39 < 0f) || (npc.velocity.Y > 0f && num40 > 0f) || (npc.velocity.Y < 0f && num40 < 0f)) + if ((NPC.velocity.X > 0f && num39 > 0f) || (NPC.velocity.X < 0f && num39 < 0f) || (NPC.velocity.Y > 0f && num40 > 0f) || (NPC.velocity.Y < 0f && num40 < 0f)) { - if (npc.velocity.X < num39) - npc.velocity.X += num37; - else if (npc.velocity.X > num39) - npc.velocity.X -= num37; + if (NPC.velocity.X < num39) + NPC.velocity.X += num37; + else if (NPC.velocity.X > num39) + NPC.velocity.X -= num37; - if (npc.velocity.Y < num40) - npc.velocity.Y += num37; - else if (npc.velocity.Y > num40) - npc.velocity.Y -= num37; + if (NPC.velocity.Y < num40) + NPC.velocity.Y += num37; + else if (NPC.velocity.Y > num40) + NPC.velocity.Y -= num37; - if (Math.Abs(num40) < fallSpeed * 0.2 && ((npc.velocity.X > 0f && num39 < 0f) || (npc.velocity.X < 0f && num39 > 0f))) + if (Math.Abs(num40) < fallSpeed * 0.2 && ((NPC.velocity.X > 0f && num39 < 0f) || (NPC.velocity.X < 0f && num39 > 0f))) { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num37 * 2f; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += num37 * 2f; else - npc.velocity.Y -= num37 * 2f; + NPC.velocity.Y -= num37 * 2f; } - if (Math.Abs(num39) < fallSpeed * 0.2 && ((npc.velocity.Y > 0f && num40 < 0f) || (npc.velocity.Y < 0f && num40 > 0f))) + if (Math.Abs(num39) < fallSpeed * 0.2 && ((NPC.velocity.Y > 0f && num40 < 0f) || (NPC.velocity.Y < 0f && num40 > 0f))) { - if (npc.velocity.X > 0f) - npc.velocity.X += num37 * 2f; + if (NPC.velocity.X > 0f) + NPC.velocity.X += num37 * 2f; else - npc.velocity.X -= num37 * 2f; + NPC.velocity.X -= num37 * 2f; } } else if (num55 > num56) { - if (npc.velocity.X < num39) - npc.velocity.X += num37 * 1.1f; - else if (npc.velocity.X > num39) - npc.velocity.X -= num37 * 1.1f; + if (NPC.velocity.X < num39) + NPC.velocity.X += num37 * 1.1f; + else if (NPC.velocity.X > num39) + NPC.velocity.X -= num37 * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 0.5) { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num37; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += num37; else - npc.velocity.Y -= num37; + NPC.velocity.Y -= num37; } } else { - if (npc.velocity.Y < num40) - npc.velocity.Y += num37 * 1.1f; - else if (npc.velocity.Y > num40) - npc.velocity.Y -= num37 * 1.1f; + if (NPC.velocity.Y < num40) + NPC.velocity.Y += num37 * 1.1f; + else if (NPC.velocity.Y > num40) + NPC.velocity.Y -= num37 * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 0.5) { - if (npc.velocity.X > 0f) - npc.velocity.X += num37; + if (NPC.velocity.X > 0f) + NPC.velocity.X += num37; else - npc.velocity.X -= num37; + NPC.velocity.X -= num37; } } } - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; if (flag2) { - if (npc.localAI[0] != 1f) - npc.netUpdate = true; + if (NPC.localAI[0] != 1f) + NPC.netUpdate = true; - npc.localAI[0] = 1f; + NPC.localAI[0] = 1f; } else { - if (npc.localAI[0] != 0f) - npc.netUpdate = true; + if (NPC.localAI[0] != 0f) + NPC.netUpdate = true; - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.netUpdate = true; + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) + NPC.netUpdate = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Perforator/PerforatorHeadMediumGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadMediumGlow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -415,16 +416,16 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf2"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/MediumPerf"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/MediumPerf2"), NPC.scale); } } @@ -432,14 +433,14 @@ namespace CalamityMod.NPCs.Perforator { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(4) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } for (int i = 0; i < Main.maxNPCs; i++) { - if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == npc.type || Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType())) + if (i != NPC.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPC.type || Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType())) return false; } @@ -454,11 +455,11 @@ namespace CalamityMod.NPCs.Perforator public override bool SpecialNPCLoot() { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, - npc.type, + int closestSegmentID = DropHelper.FindClosestWormSegment(NPC, + NPC.type, ModContent.NPCType(), ModContent.NPCType()); - npc.position = Main.npc[closestSegmentID].position; + NPC.position = Main.npc[closestSegmentID].position; return false; } diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index d1078daca1..9a40a6255c 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Perforator { @@ -25,37 +26,37 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 42; - npc.height = 62; - npc.LifeMaxNERB(1000, 1200, 50000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 42; + NPC.height = 62; + NPC.LifeMaxNERB(1000, 1200, 50000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SendExtraAI(BinaryWriter writer) @@ -76,7 +77,7 @@ namespace CalamityMod.NPCs.Perforator bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Enrage - if ((!Main.player[npc.target].ZoneCrimson || (npc.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) + if ((!Main.player[NPC.target].ZoneCrimson || (NPC.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) { if (biomeEnrageTimer > 0) biomeEnrageTimer--; @@ -87,13 +88,13 @@ namespace CalamityMod.NPCs.Perforator bool biomeEnraged = biomeEnrageTimer <= 0 || malice; float enrageScale = BossRushEvent.BossRushActive ? 1f : 0f; - if (biomeEnraged && (!Main.player[npc.target].ZoneCrimson || malice)) + if (biomeEnraged && (!Main.player[NPC.target].ZoneCrimson || malice)) enrageScale += 1f; - if (biomeEnraged && ((npc.position.Y / 16f) < Main.worldSurface || malice)) + if (biomeEnraged && ((NPC.position.Y / 16f) < Main.worldSurface || malice)) enrageScale += 1f; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; float speed = 0.15f; float turnSpeed = 0.1f; @@ -106,42 +107,42 @@ namespace CalamityMod.NPCs.Perforator turnSpeed += accelerationScale * (1f - lifeRatio); } - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { if (!TailSpawned) { - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; int maxLength = death ? 9 : revenge ? 8 : expertMode ? 7 : 5; for (int num36 = 0; num36 < maxLength; num36++) { int lol; if (num36 >= 0 && num36 < maxLength - 1) { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } else { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = NPC.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; NetMessage.SendData(MsgType, -1, -1, null, lol, 0f, 0f, 0f, 0); @@ -151,10 +152,10 @@ namespace CalamityMod.NPCs.Perforator } } - int num12 = (int)(npc.position.X / 16f) - 1; - int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num14 = (int)(npc.position.Y / 16f) - 1; - int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + int num12 = (int)(NPC.position.X / 16f) - 1; + int num13 = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; + int num14 = (int)(NPC.position.Y / 16f) - 1; + int num15 = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; if (num12 < 0) { num12 = 0; @@ -178,12 +179,12 @@ namespace CalamityMod.NPCs.Perforator { for (int l = num14; l < num15; l++) { - if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) + if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].liquid > 64)) { Vector2 vector2; vector2.X = (float)(k * 16); vector2.Y = (float)(l * 16); - if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) + if (NPC.position.X + (float)NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + (float)NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f) { flag2 = true; break; @@ -194,11 +195,11 @@ namespace CalamityMod.NPCs.Perforator } if (!flag2) { - npc.localAI[1] = 1f; - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + NPC.localAI[1] = 1f; + Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); int num16 = death ? 160 : revenge ? 200 : expertMode ? 240 : 300; bool flag3 = true; - if (npc.position.Y > player.position.Y) + if (NPC.position.Y > player.position.Y) { for (int m = 0; m < 255; m++) { @@ -220,19 +221,19 @@ namespace CalamityMod.NPCs.Perforator } else { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; } float num17 = 16f; if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) { flag2 = false; - npc.velocity.Y += 1f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) + NPC.velocity.Y += 1f; + if ((double)NPC.position.Y > Main.worldSurface * 16.0) { - npc.velocity.Y += 1f; + NPC.velocity.Y += 1f; num17 = 32f; } - if ((double)npc.position.Y > Main.rockLayer * 16.0) + if ((double)NPC.position.Y > Main.rockLayer * 16.0) { for (int a = 0; a < 200; a++) { @@ -246,7 +247,7 @@ namespace CalamityMod.NPCs.Perforator } float num18 = speed; float num19 = turnSpeed; - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); float num20 = player.position.X + (float)(player.width / 2); float num21 = player.position.Y + (float)(player.height / 2); num20 = (float)((int)(num20 / 16f) * 16); @@ -258,49 +259,49 @@ namespace CalamityMod.NPCs.Perforator float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); if (!flag2) { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + 0.15f; - if (npc.velocity.Y > num17) + NPC.TargetClosest(true); + NPC.velocity.Y = NPC.velocity.Y + 0.15f; + if (NPC.velocity.Y > num17) { - npc.velocity.Y = num17; + NPC.velocity.Y = num17; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4) { - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; } else { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; } } - else if (npc.velocity.Y == num17) + else if (NPC.velocity.Y == num17) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } } - else if (npc.velocity.Y > 4f) + else if (NPC.velocity.Y > 4f) { - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.velocity.X = npc.velocity.X + num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X + num18 * 0.9f; } else { - npc.velocity.X = npc.velocity.X - num18 * 0.9f; + NPC.velocity.X = NPC.velocity.X - num18 * 0.9f; } } } else { - if (npc.soundDelay == 0) + if (NPC.soundDelay == 0) { float num24 = num22 / 40f; if (num24 < 10f) @@ -311,8 +312,8 @@ namespace CalamityMod.NPCs.Perforator { num24 = 20f; } - npc.soundDelay = (int)num24; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + NPC.soundDelay = (int)num24; + SoundEngine.PlaySound(SoundID.Roar, (int)NPC.position.X, (int)NPC.position.Y, 1, 1f, 0f); } num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); float num25 = Math.Abs(num20); @@ -320,152 +321,152 @@ namespace CalamityMod.NPCs.Perforator float num27 = num17 / num22; num20 *= num27; num21 *= num27; - if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) + if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num19; + NPC.velocity.X = NPC.velocity.X + num19; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num19; + NPC.velocity.X = NPC.velocity.X - num19; } - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num19; + NPC.velocity.Y = NPC.velocity.Y + num19; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num19; + NPC.velocity.Y = NPC.velocity.Y - num19; } } - if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) + if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + num18; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - num18; } - if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f))) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num18 * 2f; } else { - npc.velocity.Y = npc.velocity.Y - num18 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num18 * 2f; } } - if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f))) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num18 * 2f; + NPC.velocity.X = NPC.velocity.X + num18 * 2f; } else { - npc.velocity.X = npc.velocity.X - num18 * 2f; + NPC.velocity.X = NPC.velocity.X - num18 * 2f; } } } else if (num25 > num26) { - if (npc.velocity.X < num20) + if (NPC.velocity.X < num20) { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; } - else if (npc.velocity.X > num20) + else if (NPC.velocity.X > num20) { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; + NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num18; + NPC.velocity.Y = NPC.velocity.Y + num18; } else { - npc.velocity.Y = npc.velocity.Y - num18; + NPC.velocity.Y = NPC.velocity.Y - num18; } } } else { - if (npc.velocity.Y < num21) + if (NPC.velocity.Y < num21) { - npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f; } - else if (npc.velocity.Y > num21) + else if (NPC.velocity.Y > num21) { - npc.velocity.Y = npc.velocity.Y - num18 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f; } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num18; + NPC.velocity.X = NPC.velocity.X + num18; } else { - npc.velocity.X = npc.velocity.X - num18; + NPC.velocity.X = NPC.velocity.X - num18; } } } } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; if (flag2) { - if (npc.localAI[0] != 1f) + if (NPC.localAI[0] != 1f) { - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.localAI[0] = 1f; + NPC.localAI[0] = 1f; } else { - if (npc.localAI[0] != 0f) + if (NPC.localAI[0] != 0f) { - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) { - npc.netUpdate = true; + NPC.netUpdate = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Perforator/PerforatorHeadSmallGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHeadSmallGlow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -479,15 +480,15 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SmallPerf"), NPC.scale); } } @@ -499,11 +500,11 @@ namespace CalamityMod.NPCs.Perforator public override bool SpecialNPCLoot() { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + int closestSegmentID = DropHelper.FindClosestWormSegment(NPC, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()); - npc.position = Main.npc[closestSegmentID].position; + NPC.position = Main.npc[closestSegmentID].position; return false; } @@ -513,7 +514,7 @@ namespace CalamityMod.NPCs.Perforator { int heartAmt = Main.rand.Next(3) + 3; for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index f65437882e..f74af00074 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -22,6 +22,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Perforator { @@ -36,42 +37,42 @@ namespace CalamityMod.NPCs.Perforator public override void SetStaticDefaults() { DisplayName.SetDefault("The Perforator Hive"); - Main.npcFrameCount[npc.type] = 10; + Main.npcFrameCount[NPC.type] = 10; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 18f; - npc.GetNPCDamage(); - npc.width = 110; - npc.height = 100; - npc.defense = 4; - npc.LifeMaxNERB(5000, 6000, 270000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 18f; + NPC.GetNPCDamage(); + NPC.width = 110; + NPC.height = 100; + NPC.defense = 4; + NPC.LifeMaxNERB(5000, 6000, 270000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 15, 0, 0); - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath19; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 15, 0, 0); + NPC.boss = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit13; + NPC.DeathSound = SoundID.NPCDeath19; music = CalamityMod.Instance.GetMusicFromMusicMod("Perforators") ?? MusicID.Boss2; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void SendExtraAI(BinaryWriter writer) @@ -86,15 +87,15 @@ namespace CalamityMod.NPCs.Perforator public override void AI() { - CalamityGlobalNPC.perfHive = npc.whoAmI; + CalamityGlobalNPC.perfHive = NPC.whoAmI; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; @@ -103,28 +104,28 @@ namespace CalamityMod.NPCs.Perforator // Variables for ichor spore phase float sporePhaseGateValue = malice ? 450f : 600f; - bool floatAboveToFireBlobs = npc.ai[2] >= sporePhaseGateValue - 120f; + bool floatAboveToFireBlobs = NPC.ai[2] >= sporePhaseGateValue - 120f; // Don't deal damage for 3 seconds after spawning or while firing blobs - npc.damage = npc.defDamage; - if (npc.ai[1] < 180f || floatAboveToFireBlobs) + NPC.damage = NPC.defDamage; + if (NPC.ai[1] < 180f || floatAboveToFireBlobs) { - if (npc.ai[1] < 180f) - npc.ai[1] += 1f; + if (NPC.ai[1] < 180f) + NPC.ai[1] += 1f; - npc.damage = 0; + NPC.damage = 0; } - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Phases based on life percentage bool phase2 = lifeRatio < 0.7f; // Enrage - if ((!player.ZoneCrimson || (npc.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) + if ((!player.ZoneCrimson || (NPC.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) { if (biomeEnrageTimer > 0) biomeEnrageTimer--; @@ -137,37 +138,37 @@ namespace CalamityMod.NPCs.Perforator float enrageScale = BossRushEvent.BossRushActive ? 1f : 0f; if (biomeEnraged && (!player.ZoneCrimson || malice)) { - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; } - if (biomeEnraged && ((npc.position.Y / 16f) < Main.worldSurface || malice)) + if (biomeEnraged && ((NPC.position.Y / 16f) < Main.worldSurface || malice)) { - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; } - if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) { - npc.rotation = npc.velocity.X * 0.04f; + NPC.rotation = NPC.velocity.X * 0.04f; - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - npc.velocity.Y += 0.1f; - if (npc.velocity.Y > 12f) - npc.velocity.Y = 12f; + if (NPC.velocity.Y < -3f) + NPC.velocity.Y = -3f; + NPC.velocity.Y += 0.1f; + if (NPC.velocity.Y > 12f) + NPC.velocity.Y = 12f; - if (npc.timeLeft > 60) - npc.timeLeft = 60; + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; return; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; int wormsAlive = 0; if (NPC.AnyNPCs(ModContent.NPCType())) @@ -177,18 +178,18 @@ namespace CalamityMod.NPCs.Perforator if (NPC.AnyNPCs(ModContent.NPCType())) wormsAlive++; - if (npc.ai[3] == 0f && npc.life > 0) - npc.ai[3] = npc.lifeMax; + if (NPC.ai[3] == 0f && NPC.life > 0) + NPC.ai[3] = NPC.lifeMax; bool canSpawnWorms = !small || !medium || !large; - if (npc.life > 0 && canSpawnWorms) + if (NPC.life > 0 && canSpawnWorms) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)(npc.lifeMax * 0.25); - if ((npc.life + num660) < npc.ai[3]) + int num660 = (int)(NPC.lifeMax * 0.25); + if ((NPC.life + num660) < NPC.ai[3]) { - npc.ai[3] = npc.life; + NPC.ai[3] = NPC.life; int wormType = ModContent.NPCType(); if (!small) { @@ -204,14 +205,14 @@ namespace CalamityMod.NPCs.Perforator large = true; wormType = ModContent.NPCType(); } - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, wormType, 1); - npc.TargetClosest(); + NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y, wormType, 1); + NPC.TargetClosest(); - Main.PlaySound(SoundID.NPCDeath23, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath23, NPC.position); for (int num621 = 0; num621 < 16; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 170, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 2f; if (Main.rand.NextBool(2)) { @@ -222,49 +223,49 @@ namespace CalamityMod.NPCs.Perforator for (int num623 = 0; num623 < 32; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1.5f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1.5f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 3f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } } } - if (Math.Abs(npc.Center.X - player.Center.X) > 10f) + if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; } - npc.rotation = npc.velocity.X * 0.04f; + NPC.rotation = NPC.velocity.X * 0.04f; // Emit ichor blobs if (phase2) { if (wormsAlive == 0 || malice || floatAboveToFireBlobs) { - npc.ai[2] += 1f; - if (npc.ai[2] >= sporePhaseGateValue) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= sporePhaseGateValue) { - if (npc.ai[2] < sporePhaseGateValue + 300f) + if (NPC.ai[2] < sporePhaseGateValue + 300f) { - if (npc.velocity.Length() > 0.5f) - npc.velocity *= malice ? 0.94f : 0.96f; + if (NPC.velocity.Length() > 0.5f) + NPC.velocity *= malice ? 0.94f : 0.96f; else - npc.ai[2] = sporePhaseGateValue + 300f; + NPC.ai[2] = sporePhaseGateValue + 300f; } else { - npc.ai[2] = 0f; + NPC.ai[2] = 0f; - Main.PlaySound(SoundID.NPCDeath23, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath23, NPC.position); for (int num621 = 0; num621 < 32; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 170, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f); float dustVelocityYAdd = Math.Abs(Main.dust[num622].velocity.Y) * 0.5f; if (Main.dust[num622].velocity.Y < 0f) Main.dust[num622].velocity.Y = 2f + dustVelocityYAdd; @@ -277,7 +278,7 @@ namespace CalamityMod.NPCs.Perforator int numBlobs = expertMode ? 6 : 3; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); for (int i = 0; i < numBlobs; i++) { @@ -289,7 +290,7 @@ namespace CalamityMod.NPCs.Perforator if (blobVelocity.Y < 2f) blobVelocity.Y = 2f + sporeVelocityYAdd; - Projectile.NewProjectile(npc.Center, blobVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + Projectile.NewProjectile(NPC.Center, blobVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); } } @@ -315,15 +316,15 @@ namespace CalamityMod.NPCs.Perforator if (Main.netMode != NetmodeID.MultiplayerClient) { int shoot = (revenge ? 6 : 4) - wormsAlive; - npc.localAI[0] += Main.rand.Next(shoot); - if (npc.localAI[0] >= Main.rand.Next(300, 901) && npc.position.Y + npc.height < player.position.Y && Vector2.Distance(player.Center, npc.Center) > 80f) + NPC.localAI[0] += Main.rand.Next(shoot); + if (NPC.localAI[0] >= Main.rand.Next(300, 901) && NPC.position.Y + NPC.height < player.position.Y && Vector2.Distance(player.Center, NPC.Center) > 80f) { - npc.localAI[0] = 0f; - Main.PlaySound(SoundID.NPCHit20, npc.position); + NPC.localAI[0] = 0f; + SoundEngine.PlaySound(SoundID.NPCHit20, NPC.position); for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 170, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -334,25 +335,25 @@ namespace CalamityMod.NPCs.Perforator for (int num623 = 0; num623 < 16; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1.5f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1.5f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); int totalProjectiles = death ? 16 : revenge ? 14 : expertMode ? 12 : 10; float maxVelocity = 8f; float velocityAdjustment = maxVelocity * 1.5f / totalProjectiles; - Vector2 start = new Vector2(npc.Center.X, npc.Center.Y + 30f); + Vector2 start = new Vector2(NPC.Center.X, NPC.Center.Y + 30f); Vector2 destination = wormsAlive > 0 ? new Vector2(Vector2.Normalize(player.Center - start).X, 0f) * maxVelocity * 0.4f : Vector2.Zero; Vector2 velocity = destination + Vector2.UnitY * -maxVelocity; for (int i = 0; i < totalProjectiles + 1; i++) { Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); - velocity.X += velocityAdjustment * npc.direction; + velocity.X += velocityAdjustment * NPC.direction; } } } @@ -388,7 +389,7 @@ namespace CalamityMod.NPCs.Perforator Vector2 destination = new Vector2(target.Center.X, target.Center.Y - y); // How far Perf Hive is from where it's supposed to be - Vector2 distanceFromDestination = destination - npc.Center; + Vector2 distanceFromDestination = destination - NPC.Center; // Inverse lerp returns the percentage of progress between A and B float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); @@ -406,27 +407,27 @@ namespace CalamityMod.NPCs.Perforator maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; Vector2 desiredVelocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); - npc.SimpleFlyMovement(desiredVelocity, acceleration); + NPC.SimpleFlyMovement(desiredVelocity, acceleration); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Perforator/PerforatorHiveGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorHiveGlow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -442,8 +443,8 @@ namespace CalamityMod.NPCs.Perforator public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void BossLoot(ref string name, ref int potionType) @@ -453,12 +454,12 @@ namespace CalamityMod.NPCs.Perforator public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedPerforator); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedPerforator); CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Dryad }, CalamityWorld.downedPerforator); @@ -466,16 +467,16 @@ namespace CalamityMod.NPCs.Perforator if (!Main.expertMode) { // Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 35, 45, 5); - DropHelper.DropItemSpray(npc, ItemID.CrimtaneBar, 12, 15); - DropHelper.DropItemSpray(npc, ItemID.Vertebrae, 12, 15); + DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 35, 45, 5); + DropHelper.DropItemSpray(NPC, ItemID.CrimtaneBar, 12, 15); + DropHelper.DropItemSpray(NPC, ItemID.Vertebrae, 12, 15); if (Main.hardMode) - DropHelper.DropItemSpray(npc, ItemID.Ichor, 10, 20, 2); - DropHelper.DropItem(npc, ItemID.CrimsonSeeds, 10, 15); + DropHelper.DropItemSpray(NPC, ItemID.Ichor, 10, 20, 2); + DropHelper.DropItem(NPC, ItemID.CrimsonSeeds, 10, 15); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -488,11 +489,11 @@ namespace CalamityMod.NPCs.Perforator ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } // If neither The Hive Mind nor The Perforator Hive have been killed yet, notify players of Aerialite Ore @@ -517,25 +518,25 @@ namespace CalamityMod.NPCs.Perforator public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < damage / npc.lifeMax * 100.0; k++) + for (int k = 0; k < damage / NPC.lifeMax * 100.0; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive4"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Hive"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Hive2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Hive3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Hive4"), 1f); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 100; + NPC.height = 100; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -545,10 +546,10 @@ namespace CalamityMod.NPCs.Perforator } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index 9580b42e94..277a118e79 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -18,38 +18,38 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.GetNPCDamage(); - npc.width = 60; - npc.height = 78; - npc.defense = 12; - npc.LifeMaxNERB(2250, 2700, 80000); + NPC.GetNPCDamage(); + NPC.width = 60; + NPC.height = 78; + NPC.defense = 12; + NPC.LifeMaxNERB(2250, 2700, 80000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -59,11 +59,11 @@ namespace CalamityMod.NPCs.Perforator public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(true); bool shouldDespawn = true; for (int i = 0; i < Main.maxNPCs; i++) @@ -76,32 +76,32 @@ namespace CalamityMod.NPCs.Perforator } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - if (Main.player[npc.target].dead) - npc.TargetClosest(false); + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -109,52 +109,52 @@ namespace CalamityMod.NPCs.Perforator num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; else if (num191 > 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Perforator/PerforatorTailLargeGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailLargeGlow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -163,16 +163,16 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf4"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf5"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/LargePerf4"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/LargePerf5"), NPC.scale); } } diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index 5ea93c28e6..5d20bfc1b5 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -19,88 +19,88 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 40; - npc.height = 50; - npc.defense = 10; - npc.LifeMaxNERB(150, 180, 7000); + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 40; + NPC.height = 50; + NPC.defense = 10; + NPC.LifeMaxNERB(150, 180, 7000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().SplittingWorm = true; + NPC.Calamity().SplittingWorm = true; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void AI() { - npc.realLife = -1; + NPC.realLife = -1; // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(true); - if (Main.player[npc.target].dead) - npc.TargetClosest(false); + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } if (Main.netMode != NetmodeID.MultiplayerClient) { // Splitting effect - if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) + if (!Main.npc[(int)NPC.ai[1]].active && !Main.npc[(int)NPC.ai[0]].active) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - if (!Main.npc[(int)npc.ai[1]].active) + if (!Main.npc[(int)NPC.ai[1]].active) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - if (!npc.active && Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + if (!NPC.active && Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - Vector2 vector2 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num39 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num40 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + Vector2 vector2 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num39 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float num40 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); num39 = (int)(num39 / 16f) * 16; num40 = (int)(num40 / 16f) * 16; @@ -110,49 +110,49 @@ namespace CalamityMod.NPCs.Perforator num40 -= vector2.Y; float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector2 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num39 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector2.X; - num40 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector2.Y; + vector2 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + num39 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector2.X; + num40 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector2.Y; } catch { } - npc.rotation = (float)Math.Atan2(num40, num39) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(num40, num39) + MathHelper.PiOver2; num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); - int num53 = npc.width; - num53 = (int)(num53 * npc.scale); + int num53 = NPC.width; + num53 = (int)(num53 * NPC.scale); num52 = (num52 - num53) / num52; num39 *= num52; num40 *= num52; - npc.velocity = Vector2.Zero; - npc.position.X += num39; - npc.position.Y += num40; + NPC.velocity = Vector2.Zero; + NPC.position.X += num39; + NPC.position.Y += num40; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Perforator/PerforatorTailMediumGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailMediumGlow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -161,16 +161,16 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf3"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf4"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/MediumPerf3"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/MediumPerf4"), NPC.scale); } } @@ -183,9 +183,9 @@ namespace CalamityMod.NPCs.Perforator { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(4) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } return false; diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index f9ad162ef0..69625ea1ae 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -18,38 +18,38 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.GetNPCDamage(); - npc.width = 40; - npc.height = 34; - npc.defense = 8; - npc.LifeMaxNERB(1000, 1200, 50000); + NPC.GetNPCDamage(); + NPC.width = 40; + NPC.height = 34; + NPC.defense = 8; + NPC.LifeMaxNERB(1000, 1200, 50000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -59,11 +59,11 @@ namespace CalamityMod.NPCs.Perforator public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(true); bool shouldDespawn = true; for (int i = 0; i < Main.maxNPCs; i++) @@ -76,32 +76,32 @@ namespace CalamityMod.NPCs.Perforator } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - if (Main.player[npc.target].dead) - npc.TargetClosest(false); + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -109,52 +109,52 @@ namespace CalamityMod.NPCs.Perforator num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; else if (num191 > 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Perforator/PerforatorTailSmallGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Perforator/PerforatorTailSmallGlow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -163,15 +163,15 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf3"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SmallPerf3"), NPC.scale); } } diff --git a/NPCs/PlagueEnemies/PlagueBee.cs b/NPCs/PlagueEnemies/PlagueBee.cs index 999c6c944f..eb4b2e2d79 100644 --- a/NPCs/PlagueEnemies/PlagueBee.cs +++ b/NPCs/PlagueEnemies/PlagueBee.cs @@ -7,6 +7,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.PlagueEnemies { @@ -15,40 +16,40 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Charger"); - Main.npcFrameCount[npc.type] = 4; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 4; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.damage = 37; - npc.width = 36; - npc.height = 30; - npc.defense = 20; - npc.scale = 0.5f; - npc.lifeMax = 200; - npc.aiStyle = 5; + NPC.damage = 37; + NPC.width = 36; + NPC.height = 30; + NPC.defense = 20; + NPC.scale = 0.5f; + NPC.lifeMax = 200; + NPC.aiStyle = 5; aiType = NPCID.Bee; - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; animationType = NPCID.Bee; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit4; - npc.noGravity = true; - npc.noTileCollide = false; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit4; + NPC.noGravity = true; + NPC.noTileCollide = false; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -59,21 +60,21 @@ namespace CalamityMod.NPCs.PlagueEnemies { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/PlagueEnemies/PlagueBeeGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/PlagueEnemies/PlagueBeeGlow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -83,27 +84,27 @@ namespace CalamityMod.NPCs.PlagueEnemies Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ItemID.Stinger, Main.expertMode ? 0.5f : 0.25f); - DropHelper.DropItem(npc, ModContent.ItemType(), 1, 2); + DropHelper.DropItemChance(NPC, ItemID.Stinger, Main.expertMode ? 0.5f : 0.25f); + DropHelper.DropItem(NPC, ModContent.ItemType(), 1, 2); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -119,14 +120,14 @@ namespace CalamityMod.NPCs.PlagueEnemies { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), NPC.Center); for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/PlagueEnemies/PlagueBeeLarge.cs b/NPCs/PlagueEnemies/PlagueBeeLarge.cs index 4e3a37a8b1..27a6ac4a52 100644 --- a/NPCs/PlagueEnemies/PlagueBeeLarge.cs +++ b/NPCs/PlagueEnemies/PlagueBeeLarge.cs @@ -7,6 +7,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.PlagueEnemies { @@ -15,40 +16,40 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Charger"); - Main.npcFrameCount[npc.type] = 4; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 4; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.damage = 45; - npc.width = 36; - npc.height = 30; - npc.defense = 25; - npc.scale = 0.75f; - npc.lifeMax = 300; - npc.aiStyle = 5; + NPC.damage = 45; + NPC.width = 36; + NPC.height = 30; + NPC.defense = 25; + NPC.scale = 0.75f; + NPC.lifeMax = 300; + NPC.aiStyle = 5; aiType = NPCID.Bee; - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; animationType = NPCID.Bee; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit4; - npc.noGravity = true; - npc.noTileCollide = false; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.HitSound = SoundID.NPCHit4; + NPC.noGravity = true; + NPC.noTileCollide = false; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -59,21 +60,21 @@ namespace CalamityMod.NPCs.PlagueEnemies { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/PlagueEnemies/PlagueBeeGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/PlagueEnemies/PlagueBeeGlow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -83,27 +84,27 @@ namespace CalamityMod.NPCs.PlagueEnemies Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ItemID.Stinger, Main.expertMode ? 0.5f : 0.25f); - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); + DropHelper.DropItemChance(NPC, ItemID.Stinger, Main.expertMode ? 0.5f : 0.25f); + DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -119,14 +120,14 @@ namespace CalamityMod.NPCs.PlagueEnemies { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), NPC.Center); for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/PlagueEnemies/PlaguebringerShade.cs b/NPCs/PlagueEnemies/PlaguebringerShade.cs index a53b3d8e77..11909e42c5 100644 --- a/NPCs/PlagueEnemies/PlaguebringerShade.cs +++ b/NPCs/PlagueEnemies/PlaguebringerShade.cs @@ -12,6 +12,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.PlagueEnemies { @@ -20,92 +21,92 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void SetStaticDefaults() { DisplayName.SetDefault("Plaguebringer"); - Main.npcFrameCount[npc.type] = 12; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 12; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.damage = 70; - npc.npcSlots = 8f; - npc.width = 66; - npc.height = 66; - npc.defense = 24; - npc.DR_NERD(0.2f); - npc.lifeMax = 3000; - npc.value = Item.buyPrice(0, 1, 50, 0); - npc.knockBackResist = 0f; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 70; + NPC.npcSlots = 8f; + NPC.width = 66; + NPC.height = 66; + NPC.defense = 24; + NPC.DR_NERD(0.2f); + NPC.lifeMax = 3000; + NPC.value = Item.buyPrice(0, 1, 50, 0); + NPC.knockBackResist = 0f; + NPC.aiStyle = -1; aiType = -1; animationType = NPCID.QueenBee; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - banner = npc.type; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void AI() { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.1f, 0.3f, 0f); + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.1f, 0.3f, 0f); bool flag113 = false; - if (!Main.player[npc.target].ZoneJungle) + if (!Main.player[NPC.target].ZoneJungle) { flag113 = true; - if (npc.timeLeft > 150) + if (NPC.timeLeft > 150) { - npc.timeLeft = 150; + NPC.timeLeft = 150; } } else { - if (npc.timeLeft < 750) + if (NPC.timeLeft < 750) { - npc.timeLeft = 750; + NPC.timeLeft = 750; } } int num1038 = 0; for (int num1039 = 0; num1039 < 255; num1039++) { - if (Main.player[num1039].active && !Main.player[num1039].dead && (npc.Center - Main.player[num1039].Center).Length() < 1000f) + if (Main.player[num1039].active && !Main.player[num1039].dead && (NPC.Center - Main.player[num1039].Center).Length() < 1000f) { num1038++; } } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) { - npc.TargetClosest(); + NPC.TargetClosest(); } - bool dead4 = Main.player[npc.target].dead; + bool dead4 = Main.player[NPC.target].dead; if (dead4 && Main.expertMode) { - if ((double)npc.position.Y < Main.worldSurface * 16.0 + 2000.0) + if ((double)NPC.position.Y < Main.worldSurface * 16.0 + 2000.0) { - npc.velocity.Y = npc.velocity.Y + 0.04f; + NPC.velocity.Y = NPC.velocity.Y + 0.04f; } - if (npc.position.X < (float)(Main.maxTilesX * 8)) + if (NPC.position.X < (float)(Main.maxTilesX * 8)) { - npc.velocity.X = npc.velocity.X - 0.04f; + NPC.velocity.X = NPC.velocity.X - 0.04f; } else { - npc.velocity.X = npc.velocity.X + 0.04f; + NPC.velocity.X = NPC.velocity.X + 0.04f; } - if (npc.timeLeft > 10) + if (NPC.timeLeft > 10) { - npc.timeLeft = 10; + NPC.timeLeft = 10; return; } } - else if (npc.ai[0] == -1f) + else if (NPC.ai[0] == -1f) { if (Main.netMode != NetmodeID.MultiplayerClient) { - float num1041 = npc.ai[1]; + float num1041 = NPC.ai[1]; int num1042; do { @@ -120,52 +121,52 @@ namespace CalamityMod.NPCs.PlagueEnemies } } while ((float)num1042 == num1041); - npc.ai[0] = (float)num1042; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = (float)num1042; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; return; } } - else if (npc.ai[0] == 0f) + else if (NPC.ai[0] == 0f) { int num1043 = 2; //2 if (flag113) { num1043 += 1; } - if (npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) + if (NPC.ai[1] > (float)(2 * num1043) && NPC.ai[1] % 2f == 0f) { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; return; } - if (npc.ai[1] % 2f == 0f) + if (NPC.ai[1] % 2f == 0f) { - npc.TargetClosest(true); - if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) < 20f) + NPC.TargetClosest(true); + if (Math.Abs(NPC.position.Y + (float)(NPC.height / 2) - (Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2))) < 20f) { - npc.localAI[0] = 1f; - npc.ai[1] += 1f; - npc.ai[2] = 0f; + NPC.localAI[0] = 1f; + NPC.ai[1] += 1f; + NPC.ai[2] = 0f; float num1044 = 15f; if (flag113) { num1044 += 2f; } - Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; - float num1046 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector117.Y; + Vector2 vector117 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num1045 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - vector117.X; + float num1046 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - vector117.Y; float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); num1047 = num1044 / num1047; - npc.velocity.X = num1045 * num1047; - npc.velocity.Y = num1046 * num1047; - npc.spriteDirection = npc.direction; - Main.PlaySound(SoundID.Roar, npc.position); + NPC.velocity.X = num1045 * num1047; + NPC.velocity.Y = num1046 * num1047; + NPC.spriteDirection = NPC.direction; + SoundEngine.PlaySound(SoundID.Roar, NPC.position); return; } - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; float num1048 = 12.25f; float num1049 = 0.155f; if (flag113) @@ -173,163 +174,163 @@ namespace CalamityMod.NPCs.PlagueEnemies num1048 += 1f; num1049 += 0.075f; } - if (npc.position.Y + (float)(npc.height / 2) < Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2)) + if (NPC.position.Y + (float)(NPC.height / 2) < Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2)) { - npc.velocity.Y = npc.velocity.Y + num1049; + NPC.velocity.Y = NPC.velocity.Y + num1049; } else { - npc.velocity.Y = npc.velocity.Y - num1049; + NPC.velocity.Y = NPC.velocity.Y - num1049; } - if (npc.velocity.Y < -12f) + if (NPC.velocity.Y < -12f) { - npc.velocity.Y = -num1048; + NPC.velocity.Y = -num1048; } - if (npc.velocity.Y > 12f) + if (NPC.velocity.Y > 12f) { - npc.velocity.Y = num1048; + NPC.velocity.Y = num1048; } - if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) + if (Math.Abs(NPC.position.X + (float)(NPC.width / 2) - (Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2))) > 600f) { - npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; + NPC.velocity.X = NPC.velocity.X + 0.15f * (float)NPC.direction; } - else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) + else if (Math.Abs(NPC.position.X + (float)(NPC.width / 2) - (Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2))) < 300f) { - npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; + NPC.velocity.X = NPC.velocity.X - 0.15f * (float)NPC.direction; } else { - npc.velocity.X = npc.velocity.X * 0.8f; + NPC.velocity.X = NPC.velocity.X * 0.8f; } - if (npc.velocity.X < -16f) + if (NPC.velocity.X < -16f) { - npc.velocity.X = -16f; + NPC.velocity.X = -16f; } - if (npc.velocity.X > 16f) + if (NPC.velocity.X > 16f) { - npc.velocity.X = 16f; + NPC.velocity.X = 16f; } - npc.spriteDirection = npc.direction; + NPC.spriteDirection = NPC.direction; } else { - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.direction = -1; + NPC.direction = -1; } else { - npc.direction = 1; + NPC.direction = 1; } - npc.spriteDirection = npc.direction; + NPC.spriteDirection = NPC.direction; int num1050 = 500; int num1051 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) + if (NPC.position.X + (float)(NPC.width / 2) < Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2)) { num1051 = -1; } - if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) + if (NPC.direction == num1051 && Math.Abs(NPC.position.X + (float)(NPC.width / 2) - (Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2))) > (float)num1050) { - npc.ai[2] = 1f; + NPC.ai[2] = 1f; } - if (npc.ai[2] != 1f) + if (NPC.ai[2] != 1f) { - npc.localAI[0] = 1f; + NPC.localAI[0] = 1f; return; } - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - npc.localAI[0] = 0f; - npc.velocity *= 0.9f; + NPC.TargetClosest(true); + NPC.spriteDirection = NPC.direction; + NPC.localAI[0] = 0f; + NPC.velocity *= 0.9f; float num1052 = 0.105f; if (flag113) { - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; num1052 += 0.075f; } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < num1052) { - npc.ai[2] = 0f; - npc.ai[1] += 1f; + NPC.ai[2] = 0f; + NPC.ai[1] += 1f; } } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; + NPC.TargetClosest(true); + NPC.spriteDirection = NPC.direction; float num1053 = 12f; float num1054 = 0.1f; if (flag113) { num1054 = 0.12f; } - Vector2 vector118 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1055 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector118.X; - float num1056 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector118.Y; + Vector2 vector118 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num1055 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - vector118.X; + float num1056 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - 200f - vector118.Y; float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); if (num1057 < 400f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; return; } num1057 = num1053 / num1057; - if (npc.velocity.X < num1055) + if (NPC.velocity.X < num1055) { - npc.velocity.X = npc.velocity.X + num1054; - if (npc.velocity.X < 0f && num1055 > 0f) + NPC.velocity.X = NPC.velocity.X + num1054; + if (NPC.velocity.X < 0f && num1055 > 0f) { - npc.velocity.X = npc.velocity.X + num1054; + NPC.velocity.X = NPC.velocity.X + num1054; } } - else if (npc.velocity.X > num1055) + else if (NPC.velocity.X > num1055) { - npc.velocity.X = npc.velocity.X - num1054; - if (npc.velocity.X > 0f && num1055 < 0f) + NPC.velocity.X = NPC.velocity.X - num1054; + if (NPC.velocity.X > 0f && num1055 < 0f) { - npc.velocity.X = npc.velocity.X - num1054; + NPC.velocity.X = NPC.velocity.X - num1054; } } - if (npc.velocity.Y < num1056) + if (NPC.velocity.Y < num1056) { - npc.velocity.Y = npc.velocity.Y + num1054; - if (npc.velocity.Y < 0f && num1056 > 0f) + NPC.velocity.Y = NPC.velocity.Y + num1054; + if (NPC.velocity.Y < 0f && num1056 > 0f) { - npc.velocity.Y = npc.velocity.Y + num1054; + NPC.velocity.Y = NPC.velocity.Y + num1054; } } - else if (npc.velocity.Y > num1056) + else if (NPC.velocity.Y > num1056) { - npc.velocity.Y = npc.velocity.Y - num1054; - if (npc.velocity.Y > 0f && num1056 < 0f) + NPC.velocity.Y = NPC.velocity.Y - num1054; + if (NPC.velocity.Y > 0f && num1056 < 0f) { - npc.velocity.Y = npc.velocity.Y - num1054; + NPC.velocity.Y = NPC.velocity.Y - num1054; } } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(40 * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; - float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; + NPC.localAI[0] = 0f; + NPC.TargetClosest(true); + Vector2 vector119 = new Vector2(NPC.position.X + (float)(NPC.width / 2) + (float)(40 * NPC.direction), NPC.position.Y + (float)NPC.height * 0.8f); + Vector2 vector120 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num1058 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - vector120.X; + float num1059 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - vector120.Y; float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - npc.ai[1] += 1f; - npc.ai[1] += (float)(num1038 / 2); + NPC.ai[1] += 1f; + NPC.ai[1] += (float)(num1038 / 2); bool flag103 = false; - if (npc.ai[1] > 10f) + if (NPC.ai[1] > 10f) { - npc.ai[1] = 0f; - npc.ai[2] += 1f; + NPC.ai[1] = 0f; + NPC.ai[2] += 1f; flag103 = true; } - if (Collision.CanHit(vector119, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag103) + if (Collision.CanHit(vector119, 1, 1, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && flag103) { - Main.PlaySound(SoundID.NPCHit8, npc.position); + SoundEngine.PlaySound(SoundID.NPCHit8, NPC.position); if (Main.netMode != NetmodeID.MultiplayerClient) { int num1061; @@ -351,61 +352,61 @@ namespace CalamityMod.NPCs.PlagueEnemies } } } - if (num1060 > 400f || !Collision.CanHit(new Vector2(vector119.X, vector119.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (num1060 > 400f || !Collision.CanHit(new Vector2(vector119.X, vector119.Y - 30f), 1, 1, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { float num1063 = 14.5f; float num1064 = 0.105f; vector120 = vector119; - num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; - num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; + num1058 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - vector120.X; + num1059 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - vector120.Y; num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); num1060 = num1063 / num1060; - if (npc.velocity.X < num1058) + if (NPC.velocity.X < num1058) { - npc.velocity.X = npc.velocity.X + num1064; - if (npc.velocity.X < 0f && num1058 > 0f) + NPC.velocity.X = NPC.velocity.X + num1064; + if (NPC.velocity.X < 0f && num1058 > 0f) { - npc.velocity.X = npc.velocity.X + num1064; + NPC.velocity.X = NPC.velocity.X + num1064; } } - else if (npc.velocity.X > num1058) + else if (NPC.velocity.X > num1058) { - npc.velocity.X = npc.velocity.X - num1064; - if (npc.velocity.X > 0f && num1058 < 0f) + NPC.velocity.X = NPC.velocity.X - num1064; + if (NPC.velocity.X > 0f && num1058 < 0f) { - npc.velocity.X = npc.velocity.X - num1064; + NPC.velocity.X = NPC.velocity.X - num1064; } } - if (npc.velocity.Y < num1059) + if (NPC.velocity.Y < num1059) { - npc.velocity.Y = npc.velocity.Y + num1064; - if (npc.velocity.Y < 0f && num1059 > 0f) + NPC.velocity.Y = NPC.velocity.Y + num1064; + if (NPC.velocity.Y < 0f && num1059 > 0f) { - npc.velocity.Y = npc.velocity.Y + num1064; + NPC.velocity.Y = NPC.velocity.Y + num1064; } } - else if (npc.velocity.Y > num1059) + else if (NPC.velocity.Y > num1059) { - npc.velocity.Y = npc.velocity.Y - num1064; - if (npc.velocity.Y > 0f && num1059 < 0f) + NPC.velocity.Y = NPC.velocity.Y - num1064; + if (NPC.velocity.Y > 0f && num1059 < 0f) { - npc.velocity.Y = npc.velocity.Y - num1064; + NPC.velocity.Y = NPC.velocity.Y - num1064; } } } else { - npc.velocity *= 0.9f; //changed from 0.9 + NPC.velocity *= 0.9f; //changed from 0.9 } - npc.spriteDirection = npc.direction; - if (npc.ai[2] > 2f) + NPC.spriteDirection = NPC.direction; + if (NPC.ai[2] > 2f) { - npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.ai[1] = 1f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { float num1065 = 7f; float num1066 = 0.075f; @@ -414,20 +415,20 @@ namespace CalamityMod.NPCs.PlagueEnemies num1066 = 0.09f; num1065 = 8f; } - Vector2 vector121 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(40 * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector122 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1067 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector122.X; - float num1068 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector122.Y; + Vector2 vector121 = new Vector2(NPC.position.X + (float)(NPC.width / 2) + (float)(40 * NPC.direction), NPC.position.Y + (float)NPC.height * 0.8f); + Vector2 vector122 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num1067 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - vector122.X; + float num1068 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - 300f - vector122.Y; float num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); - npc.ai[1] += 1f; + NPC.ai[1] += 1f; bool flag104 = false; - if (npc.ai[1] % 35f == 34f) + if (NPC.ai[1] % 35f == 34f) { flag104 = true; } - if (flag104 && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector121, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (flag104 && NPC.position.Y + (float)NPC.height < Main.player[NPC.target].position.Y && Collision.CanHit(vector121, 1, 1, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - Main.PlaySound(SoundID.Item42, npc.position); + SoundEngine.PlaySound(SoundID.Item42, NPC.position); if (Main.netMode != NetmodeID.MultiplayerClient) { float num1070 = 6f; @@ -435,8 +436,8 @@ namespace CalamityMod.NPCs.PlagueEnemies { num1070 += 2f; } - float num1071 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector121.X; - float num1072 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector121.Y; + float num1071 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector121.X; + float num1072 = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - vector121.Y; float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); num1073 = num1070 / num1073; num1071 *= num1073; @@ -450,109 +451,109 @@ namespace CalamityMod.NPCs.PlagueEnemies Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, type, damage, 0f, Main.myPlayer, 0f, 0f); } } - if (!Collision.CanHit(new Vector2(vector121.X, vector121.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (!Collision.CanHit(new Vector2(vector121.X, vector121.Y - 30f), 1, 1, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { num1066 = 0.105f; vector122 = vector121; - num1067 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector122.X; - num1068 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector122.Y; - if (npc.velocity.X < num1067) + num1067 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - vector122.X; + num1068 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - vector122.Y; + if (NPC.velocity.X < num1067) { - npc.velocity.X = npc.velocity.X + num1066; - if (npc.velocity.X < 0f && num1067 > 0f) + NPC.velocity.X = NPC.velocity.X + num1066; + if (NPC.velocity.X < 0f && num1067 > 0f) { - npc.velocity.X = npc.velocity.X + num1066; + NPC.velocity.X = NPC.velocity.X + num1066; } } - else if (npc.velocity.X > num1067) + else if (NPC.velocity.X > num1067) { - npc.velocity.X = npc.velocity.X - num1066; - if (npc.velocity.X > 0f && num1067 < 0f) + NPC.velocity.X = NPC.velocity.X - num1066; + if (NPC.velocity.X > 0f && num1067 < 0f) { - npc.velocity.X = npc.velocity.X - num1066; + NPC.velocity.X = NPC.velocity.X - num1066; } } - if (npc.velocity.Y < num1068) + if (NPC.velocity.Y < num1068) { - npc.velocity.Y = npc.velocity.Y + num1066; - if (npc.velocity.Y < 0f && num1068 > 0f) + NPC.velocity.Y = NPC.velocity.Y + num1066; + if (NPC.velocity.Y < 0f && num1068 > 0f) { - npc.velocity.Y = npc.velocity.Y + num1066; + NPC.velocity.Y = NPC.velocity.Y + num1066; } } - else if (npc.velocity.Y > num1068) + else if (NPC.velocity.Y > num1068) { - npc.velocity.Y = npc.velocity.Y - num1066; - if (npc.velocity.Y > 0f && num1068 < 0f) + NPC.velocity.Y = NPC.velocity.Y - num1066; + if (NPC.velocity.Y > 0f && num1068 < 0f) { - npc.velocity.Y = npc.velocity.Y - num1066; + NPC.velocity.Y = NPC.velocity.Y - num1066; } } } else if (num1069 > 100f) { - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; + NPC.TargetClosest(true); + NPC.spriteDirection = NPC.direction; num1069 = num1065 / num1069; - if (npc.velocity.X < num1067) + if (NPC.velocity.X < num1067) { - npc.velocity.X = npc.velocity.X + num1066; - if (npc.velocity.X < 0f && num1067 > 0f) + NPC.velocity.X = NPC.velocity.X + num1066; + if (NPC.velocity.X < 0f && num1067 > 0f) { - npc.velocity.X = npc.velocity.X + num1066 * 2f; + NPC.velocity.X = NPC.velocity.X + num1066 * 2f; } } - else if (npc.velocity.X > num1067) + else if (NPC.velocity.X > num1067) { - npc.velocity.X = npc.velocity.X - num1066; - if (npc.velocity.X > 0f && num1067 < 0f) + NPC.velocity.X = NPC.velocity.X - num1066; + if (NPC.velocity.X > 0f && num1067 < 0f) { - npc.velocity.X = npc.velocity.X - num1066 * 2f; + NPC.velocity.X = NPC.velocity.X - num1066 * 2f; } } - if (npc.velocity.Y < num1068) + if (NPC.velocity.Y < num1068) { - npc.velocity.Y = npc.velocity.Y + num1066; - if (npc.velocity.Y < 0f && num1068 > 0f) + NPC.velocity.Y = NPC.velocity.Y + num1066; + if (NPC.velocity.Y < 0f && num1068 > 0f) { - npc.velocity.Y = npc.velocity.Y + num1066 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num1066 * 2f; } } - else if (npc.velocity.Y > num1068) + else if (NPC.velocity.Y > num1068) { - npc.velocity.Y = npc.velocity.Y - num1066; - if (npc.velocity.Y > 0f && num1068 < 0f) + NPC.velocity.Y = NPC.velocity.Y - num1066; + if (NPC.velocity.Y > 0f && num1068 < 0f) { - npc.velocity.Y = npc.velocity.Y - num1066 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num1066 * 2f; } } } - if (npc.ai[1] > 600f) + if (NPC.ai[1] > 600f) { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.ai[1] = 3f; + NPC.netUpdate = true; } } if (Main.netMode == NetmodeID.Server) { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 7; - if (npc.ai[0] != 0f) + if (NPC.ai[0] != 0f) num153 = 5; if (CalamityConfig.Instance.Afterimages) @@ -561,19 +562,19 @@ namespace CalamityMod.NPCs.PlagueEnemies { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -591,24 +592,24 @@ namespace CalamityMod.NPCs.PlagueEnemies { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg5"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Pbg"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Pbg2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Pbg3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Pbg4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Pbg5"), 1f); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 100; + NPC.height = 100; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -618,10 +619,10 @@ namespace CalamityMod.NPCs.PlagueEnemies } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -633,13 +634,13 @@ namespace CalamityMod.NPCs.PlagueEnemies { int heartAmt = Main.rand.Next(3) + 3; for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } - DropHelper.DropItemChance(npc, ItemID.Stinger, Main.expertMode ? 0.5f : 0.25f, 2, 3); - DropHelper.DropItem(npc, ModContent.ItemType(), 8, 12); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 50); + DropHelper.DropItemChance(NPC, ItemID.Stinger, Main.expertMode ? 0.5f : 0.25f, 2, 3); + DropHelper.DropItem(NPC, ModContent.ItemType(), 8, 12); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 50); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/PlagueEnemies/PlaguedDerpling.cs b/NPCs/PlagueEnemies/PlaguedDerpling.cs index f29112573f..50403b8de4 100644 --- a/NPCs/PlagueEnemies/PlaguedDerpling.cs +++ b/NPCs/PlagueEnemies/PlaguedDerpling.cs @@ -8,6 +8,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.PlagueEnemies { @@ -16,42 +17,42 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void SetStaticDefaults() { DisplayName.SetDefault("Viruling"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.noGravity = true; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 60; - npc.width = 58; - npc.height = 44; - npc.defense = 18; - npc.lifeMax = 400; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit22; - banner = npc.type; + NPC.damage = 60; + NPC.width = 58; + NPC.height = 44; + NPC.defense = 18; + NPC.lifeMax = 400; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.HitSound = SoundID.NPCHit22; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } float num = 6f; //2 float num2 = 0.05f; @@ -60,9 +61,9 @@ namespace CalamityMod.NPCs.PlagueEnemies num *= 1.5f; num2 *= 1.5f; } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num4 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num5 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num4 = (float)((int)(num4 / 8f) * 8); num5 = (float)((int)(num5 / 8f) * 8); vector.X = (float)((int)(vector.X / 8f) * 8); @@ -72,8 +73,8 @@ namespace CalamityMod.NPCs.PlagueEnemies float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); if (num6 == 0f) { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; + num4 = NPC.velocity.X; + num5 = NPC.velocity.Y; } else { @@ -81,69 +82,69 @@ namespace CalamityMod.NPCs.PlagueEnemies num4 *= num6; num5 *= num6; } - if (Main.player[npc.target].dead) + if (Main.player[NPC.target].dead) { - num4 = (float)npc.direction * num / 2f; + num4 = (float)NPC.direction * num / 2f; num5 = -num / 2f; } - if (npc.velocity.X < num4) + if (NPC.velocity.X < num4) { - npc.velocity.X = npc.velocity.X + num2; + NPC.velocity.X = NPC.velocity.X + num2; } - else if (npc.velocity.X > num4) + else if (NPC.velocity.X > num4) { - npc.velocity.X = npc.velocity.X - num2; + NPC.velocity.X = NPC.velocity.X - num2; } - if (npc.velocity.Y < num5) + if (NPC.velocity.Y < num5) { - npc.velocity.Y = npc.velocity.Y + num2; + NPC.velocity.Y = NPC.velocity.Y + num2; } - else if (npc.velocity.Y > num5) + else if (NPC.velocity.Y > num5) { - npc.velocity.Y = npc.velocity.Y - num2; + NPC.velocity.Y = NPC.velocity.Y - num2; } if (num4 > 0f) { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4); + NPC.spriteDirection = 1; + NPC.rotation = (float)Math.Atan2((double)num5, (double)num4); } else if (num4 < 0f) { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; + NPC.spriteDirection = -1; + NPC.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; } float num12 = 0.7f; - if (npc.collideX) + if (NPC.collideX) { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num12; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + NPC.netUpdate = true; + NPC.velocity.X = NPC.oldVelocity.X * -num12; + if (NPC.direction == -1 && NPC.velocity.X > 0f && NPC.velocity.X < 2f) { - npc.velocity.X = 2f; + NPC.velocity.X = 2f; } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + if (NPC.direction == 1 && NPC.velocity.X < 0f && NPC.velocity.X > -2f) { - npc.velocity.X = -2f; + NPC.velocity.X = -2f; } } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + NPC.netUpdate = true; + NPC.velocity.Y = NPC.oldVelocity.Y * -num12; + if (NPC.velocity.Y > 0f && (double)NPC.velocity.Y < 1.5) { - npc.velocity.Y = 2f; + NPC.velocity.Y = 2f; } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + if (NPC.velocity.Y < 0f && (double)NPC.velocity.Y > -1.5) { - npc.velocity.Y = -2f; + NPC.velocity.Y = -2f; } } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) { - npc.netUpdate = true; + NPC.netUpdate = true; } - int num13 = Dust.NewDust(new Vector2(npc.position.X - npc.velocity.X, npc.position.Y - npc.velocity.Y), npc.width, npc.height, 46, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default, 2f); + int num13 = Dust.NewDust(new Vector2(NPC.position.X - NPC.velocity.X, NPC.position.Y - NPC.velocity.Y), NPC.width, NPC.height, 46, NPC.velocity.X * 0.2f, NPC.velocity.Y * 0.2f, 100, default, 2f); Dust dust = Main.dust[num13]; dust.noGravity = true; dust.velocity.X *= 0.3f; @@ -152,7 +153,7 @@ namespace CalamityMod.NPCs.PlagueEnemies public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -168,24 +169,24 @@ namespace CalamityMod.NPCs.PlagueEnemies { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), NPC.Center); for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Viruling"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Viruling2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Viruling3"), 1f); } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 1, 2); + DropHelper.DropItem(NPC, ModContent.ItemType(), 1, 2); } } } diff --git a/NPCs/PlagueEnemies/PlaguedFlyingFox.cs b/NPCs/PlagueEnemies/PlaguedFlyingFox.cs index 860cf13547..89d76d7e09 100644 --- a/NPCs/PlagueEnemies/PlaguedFlyingFox.cs +++ b/NPCs/PlagueEnemies/PlaguedFlyingFox.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.PlagueEnemies { @@ -13,33 +14,33 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void SetStaticDefaults() { DisplayName.SetDefault("Melter"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.npcSlots = 0.5f; - npc.aiStyle = 14; + NPC.npcSlots = 0.5f; + NPC.aiStyle = 14; aiType = NPCID.GiantFlyingFox; animationType = NPCID.GiantFlyingFox; - npc.damage = 55; - npc.width = 38; - npc.height = 34; - npc.defense = 15; - npc.lifeMax = 500; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit1; - banner = npc.type; + NPC.damage = 55; + NPC.width = 38; + NPC.height = 34; + NPC.defense = 15; + NPC.lifeMax = 500; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.HitSound = SoundID.NPCHit1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -55,21 +56,21 @@ namespace CalamityMod.NPCs.PlagueEnemies { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), NPC.Center); for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 1, 2); + DropHelper.DropItem(NPC, ModContent.ItemType(), 1, 2); } } } diff --git a/NPCs/PlagueEnemies/PlaguedJungleSlime.cs b/NPCs/PlagueEnemies/PlaguedJungleSlime.cs index cd0ac05daf..794cb5cdca 100644 --- a/NPCs/PlagueEnemies/PlaguedJungleSlime.cs +++ b/NPCs/PlagueEnemies/PlaguedJungleSlime.cs @@ -8,6 +8,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.PlagueEnemies { @@ -18,29 +19,29 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void SetStaticDefaults() { DisplayName.SetDefault("Pestilent Slime"); - Main.npcFrameCount[npc.type] = 2; + Main.npcFrameCount[NPC.type] = 2; } public override void SetDefaults() { - npc.aiStyle = 1; - npc.damage = 55; - npc.width = 40; - npc.height = 30; - npc.defense = 12; - npc.lifeMax = 350; - npc.knockBackResist = 0f; + NPC.aiStyle = 1; + NPC.damage = 55; + NPC.width = 40; + NPC.height = 30; + NPC.defense = 12; + NPC.lifeMax = 350; + NPC.knockBackResist = 0f; animationType = NPCID.CorruptSlime; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.alpha = 60; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void AI() @@ -49,22 +50,22 @@ namespace CalamityMod.NPCs.PlagueEnemies { spikeTimer -= 1f; } - if (!npc.wet && !Main.player[npc.target].npcTypeNoAggro[npc.type]) + if (!NPC.wet && !Main.player[NPC.target].npcTypeNoAggro[NPC.type]) { - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; - float num15 = Main.player[npc.target].position.Y - vector3.Y; + Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num14 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector3.X; + float num15 = Main.player[NPC.target].position.Y - vector3.Y; float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - if (Main.expertMode && num16 < 120f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + if (Main.expertMode && num16 < 120f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && NPC.velocity.Y == 0f) { - npc.ai[0] = -40f; - if (npc.velocity.Y == 0f) + NPC.ai[0] = -40f; + if (NPC.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.9f; + NPC.velocity.X = NPC.velocity.X * 0.9f; } if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) { - Main.PlaySound(SoundID.Item42, npc.position); + SoundEngine.PlaySound(SoundID.Item42, NPC.position); for (int n = 0; n < 5; n++) { Vector2 vector4 = new Vector2((float)(n - 2), -4f); @@ -77,17 +78,17 @@ namespace CalamityMod.NPCs.PlagueEnemies } } } - else if (num16 < 360f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + else if (num16 < 360f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && NPC.velocity.Y == 0f) { - npc.ai[0] = -40f; - if (npc.velocity.Y == 0f) + NPC.ai[0] = -40f; + if (NPC.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.9f; + NPC.velocity.X = NPC.velocity.X * 0.9f; } if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) { - Main.PlaySound(SoundID.Item42, npc.position); - num15 = Main.player[npc.target].position.Y - vector3.Y - (float)Main.rand.Next(0, 200); + SoundEngine.PlaySound(SoundID.Item42, NPC.position); + num15 = Main.player[NPC.target].position.Y - vector3.Y - (float)Main.rand.Next(0, 200); num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); num16 = 6.5f / num16; num14 *= num16; @@ -101,7 +102,7 @@ namespace CalamityMod.NPCs.PlagueEnemies public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -112,22 +113,22 @@ namespace CalamityMod.NPCs.PlagueEnemies { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), NPC.Center); for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItemChance(npc, ItemID.Stinger, Main.expertMode ? 0.5f : 0.25f); - DropHelper.DropItem(npc, ModContent.ItemType(), 1, 2); + DropHelper.DropItemChance(NPC, ItemID.Stinger, Main.expertMode ? 0.5f : 0.25f); + DropHelper.DropItem(NPC, ModContent.ItemType(), 1, 2); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/PlagueEnemies/PlaguedTortoise.cs b/NPCs/PlagueEnemies/PlaguedTortoise.cs index 87e6e303ba..738adc1a31 100644 --- a/NPCs/PlagueEnemies/PlaguedTortoise.cs +++ b/NPCs/PlagueEnemies/PlaguedTortoise.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.PlagueEnemies { @@ -13,49 +14,49 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void SetStaticDefaults() { DisplayName.SetDefault("Plagueshell"); - Main.npcFrameCount[npc.type] = 8; + Main.npcFrameCount[NPC.type] = 8; } public override void SetDefaults() { - npc.npcSlots = 2f; - npc.damage = 80; - npc.aiStyle = 39; - npc.width = 46; - npc.height = 32; - npc.defense = 32; - npc.lifeMax = 800; - npc.knockBackResist = 0.2f; + NPC.npcSlots = 2f; + NPC.damage = 80; + NPC.aiStyle = 39; + NPC.width = 46; + NPC.height = 32; + NPC.defense = 32; + NPC.lifeMax = 800; + NPC.knockBackResist = 0.2f; animationType = NPCID.GiantTortoise; - npc.value = Item.buyPrice(0, 0, 20, 0); - npc.HitSound = SoundID.NPCHit24; - npc.noGravity = false; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.HitSound = SoundID.NPCHit24; + NPC.noGravity = false; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), NPC.Center); for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.Calamity().ZoneSunkenSea) + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; } @@ -69,7 +70,7 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 3, 4); + DropHelper.DropItem(NPC, ModContent.ItemType(), 3, 4); } } } diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index d79d49209e..261430eb9d 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -8,6 +8,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.PlaguebringerGoliath { @@ -16,28 +17,28 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Homing Missile"); - Main.npcFrameCount[npc.type] = 4; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 4; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.width = 22; - npc.height = 22; - npc.defense = 20; - npc.lifeMax = BossRushEvent.BossRushActive ? 5000 : 500; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.width = 22; + NPC.height = 22; + NPC.defense = 20; + NPC.lifeMax = BossRushEvent.BossRushActive ? 5000 : 500; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.knockBackResist = 0f; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.noGravity = true; + NPC.canGhostHeal = false; + NPC.noTileCollide = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void AI() @@ -47,89 +48,89 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - Lighting.AddLight(npc.Center, 0.015f, 0.1f, 0f); + Lighting.AddLight(NPC.Center, 0.015f, 0.1f, 0f); - if (Math.Abs(npc.velocity.X) >= 3f || Math.Abs(npc.velocity.Y) >= 3f) + if (Math.Abs(NPC.velocity.X) >= 3f || Math.Abs(NPC.velocity.Y) >= 3f) { float num247 = 0f; float num248 = 0f; if (Main.rand.Next(2) == 1) { - num247 = npc.velocity.X * 0.5f; - num248 = npc.velocity.Y * 0.5f; + num247 = NPC.velocity.X * 0.5f; + num248 = NPC.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(npc.position.X + 3f + num247, npc.position.Y + 3f + num248) - npc.velocity * 0.5f, npc.width - 8, npc.height - 8, 6, 0f, 0f, 100, default, 0.5f); + int num249 = Dust.NewDust(new Vector2(NPC.position.X + 3f + num247, NPC.position.Y + 3f + num248) - NPC.velocity * 0.5f, NPC.width - 8, NPC.height - 8, 6, 0f, 0f, 100, default, 0.5f); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(npc.position.X + 3f + num247, npc.position.Y + 3f + num248) - npc.velocity * 0.5f, npc.width - 8, npc.height - 8, 31, 0f, 0f, 100, default, 0.25f); + num249 = Dust.NewDust(new Vector2(NPC.position.X + 3f + num247, NPC.position.Y + 3f + num248) - NPC.velocity * 0.5f, NPC.width - 8, NPC.height - 8, 31, 0f, 0f, 100, default, 0.25f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } else if (Main.rand.NextBool(4)) { - int num252 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 31, 0f, 0f, 100, default, 0.5f); + int num252 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 31, 0f, 0f, 100, default, 0.5f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = npc.Center + new Vector2(0f, (float)(-(float)npc.height / 2)).RotatedBy((double)npc.rotation, default) * 1.1f; + Main.dust[num252].position = NPC.Center + new Vector2(0f, (float)(-(float)NPC.height / 2)).RotatedBy((double)NPC.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 1f); + num252 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = npc.Center + new Vector2(0f, (float)(-(float)npc.height / 2 - 6)).RotatedBy((double)npc.rotation, default) * 1.1f; + Main.dust[num252].position = NPC.Center + new Vector2(0f, (float)(-(float)NPC.height / 2 - 6)).RotatedBy((double)NPC.rotation, default) * 1.1f; } - npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; - float timeBeforeHoming = 120f - npc.ai[3] * 0.5f; - if (npc.ai[2] < timeBeforeHoming) + float timeBeforeHoming = 120f - NPC.ai[3] * 0.5f; + if (NPC.ai[2] < timeBeforeHoming) { - npc.ai[2] += 1f; + NPC.ai[2] += 1f; return; } - if (npc.ai[0] == 0f && npc.ai[1] == 0f) + if (NPC.ai[0] == 0f && NPC.ai[1] == 0f) { - npc.ai[0] = 1f; - npc.ai[1] = (float)Player.FindClosest(npc.position, npc.width, npc.height); - npc.netUpdate = true; - float num754 = npc.velocity.Length(); - npc.velocity = Vector2.Normalize(npc.velocity) * (num754 + 1f); + NPC.ai[0] = 1f; + NPC.ai[1] = (float)Player.FindClosest(NPC.position, NPC.width, NPC.height); + NPC.netUpdate = true; + float num754 = NPC.velocity.Length(); + NPC.velocity = Vector2.Normalize(NPC.velocity) * (num754 + 1f); } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - npc.localAI[1] += 1f; - float timeBeforeExploding = 480f + npc.ai[3] * 2f; - float homingDuration = (malice ? 430f : death ? 340f : revenge ? 290f : expertMode ? 240f : 150f) + npc.ai[3] * 2f; - if (npc.localAI[1] == timeBeforeExploding) + NPC.localAI[1] += 1f; + float timeBeforeExploding = 480f + NPC.ai[3] * 2f; + float homingDuration = (malice ? 430f : death ? 340f : revenge ? 290f : expertMode ? 240f : 150f) + NPC.ai[3] * 2f; + if (NPC.localAI[1] == timeBeforeExploding) { CheckDead(); - npc.life = 0; + NPC.life = 0; return; } - if (npc.localAI[1] < homingDuration) + if (NPC.localAI[1] < homingDuration) { - npc.noTileCollide = true; - Vector2 v3 = Main.player[(int)npc.ai[1]].Center - npc.Center; - float num760 = npc.velocity.ToRotation(); + NPC.noTileCollide = true; + Vector2 v3 = Main.player[(int)NPC.ai[1]].Center - NPC.Center; + float num760 = NPC.velocity.ToRotation(); float num761 = v3.ToRotation(); float angle = num761 - num760; angle = MathHelper.WrapAngle(angle); - npc.velocity = npc.velocity.RotatedBy(angle * 0.2); + NPC.velocity = NPC.velocity.RotatedBy(angle * 0.2); } else { - npc.noTileCollide = false; + NPC.noTileCollide = false; - if (npc.velocity.Length() < (malice ? 25f : 20f)) - npc.velocity *= 1.01f; + if (NPC.velocity.Length() < (malice ? 25f : 20f)) + NPC.velocity *= 1.01f; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { CheckDead(); - npc.life = 0; + NPC.life = 0; return; } } @@ -139,10 +140,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath for (int i = 0; i < Main.maxPlayers; i++) { Player player = Main.player[i]; - if (player.active && !player.dead && Vector2.Distance(player.Center, npc.Center) <= distanceBeforeExploding) + if (player.active && !player.dead && Vector2.Distance(player.Center, NPC.Center) <= distanceBeforeExploding) { CheckDead(); - npc.life = 0; + NPC.life = 0; return; } } @@ -151,11 +152,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -166,21 +167,21 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/PlaguebringerGoliath/PlagueHomingMissileGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueHomingMissileGlow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -190,37 +191,37 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override bool CheckDead() { - Main.PlaySound(SoundID.Item14, npc.position); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = npc.height = 216; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + SoundEngine.PlaySound(SoundID.Item14, NPC.position); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = NPC.height = 216; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 89, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -231,10 +232,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 89, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 89, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; Main.dust[num624].noGravity = true; } @@ -252,13 +253,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index d0c1b7c128..d7212c968c 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -7,6 +7,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.PlaguebringerGoliath { @@ -15,27 +16,27 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Mine"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.width = 42; - npc.height = 42; - npc.defense = 20; - npc.lifeMax = BossRushEvent.BossRushActive ? 10000 : 1000; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.width = 42; + NPC.height = 42; + NPC.defense = 20; + NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : 1000; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void AI() @@ -44,83 +45,83 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - Lighting.AddLight(npc.Center, 0.03f, 0.2f, 0f); + Lighting.AddLight(NPC.Center, 0.03f, 0.2f, 0f); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; if (!player.active || player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (!player.active || player.dead) { - if (npc.timeLeft > 10) - npc.timeLeft = 10; + if (NPC.timeLeft > 10) + NPC.timeLeft = 10; return; } } - else if (npc.timeLeft > 600) - npc.timeLeft = 600; + else if (NPC.timeLeft > 600) + NPC.timeLeft = 600; - Vector2 vector = Main.player[npc.target].Center - npc.Center; + Vector2 vector = Main.player[NPC.target].Center - NPC.Center; float distanceRequiredForExplosion = 90f; - float timeBeforeExplosion = (malice ? 1000f : death ? 740f : revenge ? 520f : 400f) + npc.ai[3] * 4f; - if (vector.Length() < distanceRequiredForExplosion || npc.ai[0] >= timeBeforeExplosion) + float timeBeforeExplosion = (malice ? 1000f : death ? 740f : revenge ? 520f : 400f) + NPC.ai[3] * 4f; + if (vector.Length() < distanceRequiredForExplosion || NPC.ai[0] >= timeBeforeExplosion) { CheckDead(); - npc.life = 0; + NPC.life = 0; return; } - npc.ai[0] += 1f; - if (npc.ai[0] >= timeBeforeExplosion * 0.8f) + NPC.ai[0] += 1f; + if (NPC.ai[0] >= timeBeforeExplosion * 0.8f) { - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; return; } - npc.TargetClosest(true); - float velocity = (malice ? 14f : death ? 12f : revenge ? 10f : 8f) + npc.ai[3] * 0.04f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + NPC.TargetClosest(true); + float velocity = (malice ? 14f : death ? 12f : revenge ? 10f : 8f) + NPC.ai[3] * 0.04f; + Vector2 vector167 = new Vector2(NPC.Center.X + (float)(NPC.direction * 20), NPC.Center.Y + 6f); float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; float num1374 = player.Center.Y - vector167.Y; float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); float num1376 = velocity / num1375; num1373 *= num1376; num1374 *= num1376; - float inertia = (malice ? 35f : death ? 40f : revenge ? 45f : 50f) - npc.ai[3] * 0.25f; - npc.velocity.X = (npc.velocity.X * inertia + num1373) / (inertia + 1f); - npc.velocity.Y = (npc.velocity.Y * inertia + num1374) / (inertia + 1f); + float inertia = (malice ? 35f : death ? 40f : revenge ? 45f : 50f) - NPC.ai[3] * 0.25f; + NPC.velocity.X = (NPC.velocity.X * inertia + num1373) / (inertia + 1f); + NPC.velocity.Y = (NPC.velocity.Y * inertia + num1374) / (inertia + 1f); } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter % 6 == 5) - npc.frame.Y += frameHeight; + NPC.frameCounter++; + if (NPC.frameCounter % 6 == 5) + NPC.frame.Y += frameHeight; - if (npc.frame.Y / frameHeight >= Main.npcFrameCount[npc.type]) - npc.frame.Y = 0; + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[NPC.type]) + NPC.frame.Y = 0; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/PlaguebringerGoliath/PlagueMineGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlagueMineGlow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -134,15 +135,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override bool CheckDead() { - Main.PlaySound(SoundID.Item14, npc.position); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = npc.height = 216; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + SoundEngine.PlaySound(SoundID.Item14, NPC.position); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = NPC.height = 216; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 89, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -153,10 +154,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 89, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 89, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; Main.dust[num624].noGravity = true; } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index c629a84267..d7b02fb755 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -23,6 +23,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.PlaguebringerGoliath { @@ -44,35 +45,35 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetStaticDefaults() { DisplayName.SetDefault("The Plaguebringer Goliath"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 64f; - npc.width = 198; - npc.height = 198; - npc.defense = 50; - npc.DR_NERD(0.3f); - npc.LifeMaxNERB(88750, 106500, 370000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 64f; + NPC.width = 198; + NPC.height = 198; + NPC.defense = 50; + NPC.DR_NERD(0.3f); + NPC.LifeMaxNERB(88750, 106500, 370000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.aiStyle = -1; aiType = -1; - npc.boss = true; - npc.value = Item.buyPrice(0, 75, 0, 0); - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; + NPC.boss = true; + NPC.value = Item.buyPrice(0, 75, 0, 0); + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; music = CalamityMod.Instance.GetMusicFromMusicMod("PlaguebringerGoliath") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override void SendExtraAI(BinaryWriter writer) @@ -86,7 +87,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath writer.Write(chargeDistance); writer.Write(charging); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -100,17 +101,17 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath chargeDistance = reader.ReadInt32(); charging = reader.ReadBoolean(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); //drawcode adjustments for the new sprite - npc.gfxOffY = charging ? -40 : -50; - npc.width = npc.frame.Width / 2; - npc.height = (int)(npc.frame.Height * (charging ? 1.5f : 1.8f)); + NPC.gfxOffY = charging ? -40 : -50; + NPC.width = NPC.frame.Width / 2; + NPC.height = (int)(NPC.frame.Height * (charging ? 1.5f : 1.8f)); // Mode variables bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -119,7 +120,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Phases bool phase2 = lifeRatio < 0.75f; @@ -132,20 +133,20 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float nukeBarrageChallengeAmt = (0.5f - lifeRatio) * 200f; // Adjust slowing debuff immunity - bool immuneToSlowingDebuffs = npc.ai[0] == 0f || npc.ai[0] == 4f; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + bool immuneToSlowingDebuffs = NPC.ai[0] == 0f || NPC.ai[0] == 4f; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; // Light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.3f, 0.7f, 0f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.3f, 0.7f, 0f); // Show message if (!halfLife && phase3 && expertMode) @@ -153,7 +154,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath string key = "Mods.CalamityMod.PlagueBossText"; Color messageColor = Color.Lime; CalamityUtils.DisplayLocalizedText(key, messageColor); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGNukeWarning"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGNukeWarning"), NPC.Center); halfLife = true; } @@ -164,7 +165,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (MissileCountdown > 1) MissileCountdown--; - Vector2 vectorCenter = npc.Center; + Vector2 vectorCenter = NPC.Center; // Count nearby players int num1038 = 0; @@ -175,14 +176,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; // Distance from target Vector2 distFromPlayer = player.Center - vectorCenter; @@ -201,7 +202,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float enrageScale = death ? 0.5f : 0f; if (biomeEnraged) { - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1.5f; } @@ -213,14 +214,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath bool diagonalDash = (revenge && phase2) || malice; - if (npc.ai[0] != 0f && npc.ai[0] != 4f) - npc.rotation = npc.velocity.X * 0.02f; + if (NPC.ai[0] != 0f && NPC.ai[0] != 4f) + NPC.rotation = NPC.velocity.X * 0.02f; // Despawn if (!player.active || player.dead || Vector2.Distance(player.Center, vectorCenter) > 5600f) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (!player.active || player.dead || Vector2.Distance(player.Center, vectorCenter) > 5600f) { if (despawnTimer > 0) @@ -233,23 +234,23 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath canDespawn = despawnTimer <= 0; if (canDespawn) { - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.2f; - if (npc.velocity.Y < -16f) - npc.velocity.Y = -16f; + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.2f; + if (NPC.velocity.Y < -16f) + NPC.velocity.Y = -16f; - if (npc.timeLeft > 60) - npc.timeLeft = 60; + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; - if (npc.ai[0] != -1f) + if (NPC.ai[0] != -1f) { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = -1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; MissileCountdown = 0; chargeDistance = 0; - npc.netUpdate = true; + NPC.netUpdate = true; } return; } @@ -258,18 +259,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (calamityGlobalNPC.newAI[3] == 0f) { calamityGlobalNPC.newAI[3] = 1f; - npc.ai[0] = 2f; - npc.netUpdate = true; + NPC.ai[0] = 2f; + NPC.netUpdate = true; } // Phase switch - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { if (Main.netMode != NetmodeID.MultiplayerClient) { int num596; do num596 = MissileCountdown == 1 ? 4 : Main.rand.Next(4); - while (num596 == npc.ai[1] || num596 == 1); + while (num596 == NPC.ai[1] || num596 == 1); if (num596 == 0 && diagonalDash && distFromPlayer.Length() < 1800f) { @@ -288,27 +289,27 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath break; } } - while (chargeDistance == npc.ai[3]); + while (chargeDistance == NPC.ai[3]); - npc.ai[3] = -chargeDistance; + NPC.ai[3] = -chargeDistance; } - npc.ai[0] = num596; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = num596; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; // Prevent netUpdate from being blocked by the spam counter. // A phase switch sync is a critical operation that must be synced. - if (npc.netSpam >= 10) - npc.netSpam = 9; + if (NPC.netSpam >= 10) + NPC.netSpam = 9; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), NPC.Center); } } // Charge phase - else if (npc.ai[0] == 0f) + else if (NPC.ai[0] == 0f) { float num1044 = revenge ? 28f : 26f; if (phase2) @@ -323,32 +324,32 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1044 += 2f * enrageScale; int num1043 = (int)Math.Ceiling(2f + enrageScale); - if ((npc.ai[1] > (2 * num1043) && npc.ai[1] % 2f == 0f) || distFromPlayer.Length() > 1800f) + if ((NPC.ai[1] > (2 * num1043) && NPC.ai[1] % 2f == 0f) || distFromPlayer.Length() > 1800f) { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; // Prevent netUpdate from being blocked by the spam counter. // A phase switch sync is a critical operation that must be synced. - if (npc.netSpam >= 10) - npc.netSpam = 9; + if (NPC.netSpam >= 10) + NPC.netSpam = 9; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), NPC.Center); return; } // Charge - if (npc.ai[1] % 2f == 0f) + if (NPC.ai[1] % 2f == 0f) { float playerLocation = vectorCenter.X - player.Center.X; float num620 = 20f; num620 += 20f * enrageScale; - if (Math.Abs(npc.Center.Y - (player.Center.Y - chargeDistance)) < num620) + if (Math.Abs(NPC.Center.Y - (player.Center.Y - chargeDistance)) < num620) { if (diagonalDash) { @@ -367,36 +368,36 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } charging = true; - npc.frameCounter = 4; + NPC.frameCounter = 4; - npc.ai[1] += 1f; - npc.ai[2] = 0f; + NPC.ai[1] += 1f; + NPC.ai[2] = 0f; float num1045 = player.position.X + (player.width / 2) - vectorCenter.X; float num1046 = player.position.Y + (player.height / 2) - vectorCenter.Y; float num1047 = (float)Math.Sqrt(num1045 * num1045 + num1046 * num1046); num1047 = num1044 / num1047; - npc.velocity.X = num1045 * num1047; - npc.velocity.Y = num1046 * num1047; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity.X = num1045 * num1047; + NPC.velocity.Y = num1046 * num1047; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); - calamityGlobalNPC.newAI[1] = npc.velocity.X; - calamityGlobalNPC.newAI[2] = npc.velocity.Y; + calamityGlobalNPC.newAI[1] = NPC.velocity.X; + calamityGlobalNPC.newAI[2] = NPC.velocity.Y; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - if (npc.spriteDirection != 1) - npc.rotation += (float)Math.PI; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; + if (NPC.spriteDirection != 1) + NPC.rotation += (float)Math.PI; - npc.netUpdate = true; - npc.netSpam -= 5; + NPC.netUpdate = true; + NPC.netSpam -= 5; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PBGDash"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PBGDash"), NPC.Center); return; } - npc.rotation = npc.velocity.X * 0.02f; + NPC.rotation = NPC.velocity.X * 0.02f; charging = false; float num1048 = revenge ? 14f : 12f; @@ -415,43 +416,43 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1049 += 0.25f * enrageScale; if (vectorCenter.Y < (player.Center.Y - chargeDistance)) - npc.velocity.Y += num1049; + NPC.velocity.Y += num1049; else - npc.velocity.Y -= num1049; + NPC.velocity.Y -= num1049; - if (npc.velocity.Y < -num1048) - npc.velocity.Y = -num1048; - if (npc.velocity.Y > num1048) - npc.velocity.Y = num1048; + if (NPC.velocity.Y < -num1048) + NPC.velocity.Y = -num1048; + if (NPC.velocity.Y > num1048) + NPC.velocity.Y = num1048; if (Math.Abs(vectorCenter.X - player.Center.X) > 650f) - npc.velocity.X += num1049 * npc.direction; + NPC.velocity.X += num1049 * NPC.direction; else if (Math.Abs(vectorCenter.X - player.Center.X) < 500f) - npc.velocity.X -= num1049 * npc.direction; + NPC.velocity.X -= num1049 * NPC.direction; else - npc.velocity.X *= 0.8f; + NPC.velocity.X *= 0.8f; - if (npc.velocity.X < -num1048) - npc.velocity.X = -num1048; - if (npc.velocity.X > num1048) - npc.velocity.X = num1048; + if (NPC.velocity.X < -num1048) + NPC.velocity.X = -num1048; + if (NPC.velocity.X > num1048) + NPC.velocity.X = num1048; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; - npc.netUpdate = true; - npc.netSpam -= 5; + NPC.netUpdate = true; + NPC.netSpam -= 5; } // Slow down after charge else { - if (npc.velocity.X < 0f) - npc.direction = -1; + if (NPC.velocity.X < 0f) + NPC.direction = -1; else - npc.direction = 1; + NPC.direction = 1; - npc.spriteDirection = npc.direction; + NPC.spriteDirection = NPC.direction; int num1050 = revenge ? 525 : 550; if (phase4) @@ -466,71 +467,71 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (vectorCenter.X < player.Center.X) num1051 = -1; - if (npc.direction == num1051 && (Math.Abs(vectorCenter.X - player.Center.X) > num1050 || Math.Abs(vectorCenter.Y - player.Center.Y) > num1050)) - npc.ai[2] = 1f; + if (NPC.direction == num1051 && (Math.Abs(vectorCenter.X - player.Center.X) > num1050 || Math.Abs(vectorCenter.Y - player.Center.Y) > num1050)) + NPC.ai[2] = 1f; - if (enrageScale > 0 && npc.ai[2] == 1f) - npc.velocity *= 0.95f; + if (enrageScale > 0 && NPC.ai[2] == 1f) + NPC.velocity *= 0.95f; - if (npc.ai[2] != 1f) + if (NPC.ai[2] != 1f) { charging = true; - npc.frameCounter = 4; + NPC.frameCounter = 4; // Velocity fix if PBG slowed - if (npc.velocity.Length() < num1044) - npc.velocity = new Vector2(calamityGlobalNPC.newAI[1], calamityGlobalNPC.newAI[2]); + if (NPC.velocity.Length() < num1044) + NPC.velocity = new Vector2(calamityGlobalNPC.newAI[1], calamityGlobalNPC.newAI[2]); calamityGlobalNPC.newAI[0] += 1f; if (calamityGlobalNPC.newAI[0] > 90f) - npc.velocity *= 1.01f; + NPC.velocity *= 1.01f; - npc.netUpdate = true; + NPC.netUpdate = true; return; } float playerLocation = vectorCenter.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; - npc.rotation = npc.velocity.X * 0.02f; + NPC.rotation = NPC.velocity.X * 0.02f; charging = false; - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; float num1052 = revenge ? 0.12f : 0.1f; if (phase2) { - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; num1052 += 0.05f; } if (phase3) { - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; num1052 += 0.05f; } if (phase4) { - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; num1052 += 0.05f; } if (enrageScale > 0) - npc.velocity *= 0.95f; + NPC.velocity *= 0.95f; - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < num1052) { - npc.ai[2] = 0f; - npc.ai[1] += 1f; + NPC.ai[2] = 0f; + NPC.ai[1] += 1f; calamityGlobalNPC.newAI[0] = 0f; } } } // Move closer if too far away - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { float playerLocation = vectorCenter.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; float num1055 = player.position.X + (player.width / 2) - vectorCenter.X; float num1056 = player.position.Y + (player.height / 2) - 200f - vectorCenter.Y; @@ -539,17 +540,17 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath calamityGlobalNPC.newAI[0] += 1f; if (num1057 < 600f || calamityGlobalNPC.newAI[0] >= 180f) { - npc.ai[0] = (phase3 || malice) ? 5f : 1f; - npc.ai[1] = 0f; + NPC.ai[0] = (phase3 || malice) ? 5f : 1f; + NPC.ai[1] = 0f; calamityGlobalNPC.newAI[0] = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; // Prevent netUpdate from being blocked by the spam counter. // A phase switch sync is a critical operation that must be synced. - if (npc.netSpam >= 10) - npc.netSpam = 9; + if (NPC.netSpam >= 10) + NPC.netSpam = 9; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), NPC.Center); return; } @@ -559,31 +560,31 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } // Spawn less missiles - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { charging = false; - Vector2 vector119 = new Vector2(npc.direction == 1 ? npc.getRect().BottomLeft().X : npc.getRect().BottomRight().X, npc.getRect().Bottom().Y + 20f); - vector119.X += npc.direction * 120; + Vector2 vector119 = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); + vector119.X += NPC.direction * 120; float num1058 = player.position.X + (player.width / 2) - vectorCenter.X; float num1059 = player.position.Y + (player.height / 2) - vectorCenter.Y; float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); - npc.ai[1] += 1f; - npc.ai[1] += num1038 / 2; + NPC.ai[1] += 1f; + NPC.ai[1] += num1038 / 2; if (phase2) - npc.ai[1] += 0.5f; + NPC.ai[1] += 0.5f; bool flag103 = false; - if (npc.ai[1] > 40f - 12f * enrageScale) + if (NPC.ai[1] > 40f - 12f * enrageScale) { - npc.ai[1] = 0f; - npc.ai[2] += 1f; + NPC.ai[1] = 0f; + NPC.ai[2] += 1f; flag103 = true; } if (flag103) { - Main.PlaySound(SoundID.NPCHit, (int)npc.position.X, (int)npc.position.Y, 8); + SoundEngine.PlaySound(SoundID.NPCHit, (int)NPC.position.X, (int)NPC.position.Y, 8); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -611,59 +612,59 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (num1060 > 600f) Movement(100f, 350f, 450f, player, enrageScale); else - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; float playerLocation = vectorCenter.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; - if (npc.ai[2] > 3f) + if (NPC.ai[2] > 3f) { - npc.ai[0] = -1f; - npc.ai[1] = 2f; - npc.ai[2] = 0f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.ai[1] = 2f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; // Prevent netUpdate from being blocked by the spam counter. // A phase switch sync is a critical operation that must be synced. - if (npc.netSpam >= 10) - npc.netSpam = 9; + if (NPC.netSpam >= 10) + NPC.netSpam = 9; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), NPC.Center); } } // Missile spawn - else if (npc.ai[0] == 5f) + else if (NPC.ai[0] == 5f) { charging = false; - Vector2 vector119 = new Vector2(npc.direction == 1 ? npc.getRect().BottomLeft().X : npc.getRect().BottomRight().X, npc.getRect().Bottom().Y + 20f); - vector119.X += npc.direction * 120; + Vector2 vector119 = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); + vector119.X += NPC.direction * 120; float num1058 = player.position.X + (player.width / 2) - vectorCenter.X; float num1059 = player.position.Y + (player.height / 2) - vectorCenter.Y; float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); - npc.ai[1] += 1f; - npc.ai[1] += num1038 / 2; + NPC.ai[1] += 1f; + NPC.ai[1] += num1038 / 2; bool flag103 = false; if (phase4) - npc.ai[1] += 0.5f; + NPC.ai[1] += 0.5f; if (phase5) - npc.ai[1] += 0.5f; + NPC.ai[1] += 0.5f; - if (npc.ai[1] % 20f == 19f) - npc.netUpdate = true; + if (NPC.ai[1] % 20f == 19f) + NPC.netUpdate = true; - if (npc.ai[1] > 30f - 12f * enrageScale) + if (NPC.ai[1] > 30f - 12f * enrageScale) { - npc.ai[1] = 0f; - npc.ai[2] += 1f; + NPC.ai[1] = 0f; + NPC.ai[2] += 1f; flag103 = true; } if (flag103) { - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 88); + SoundEngine.PlaySound(SoundID.Item, (int)NPC.position.X, (int)NPC.position.Y, 88); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -693,41 +694,41 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (num1060 > 600f) Movement(100f, 350f, 450f, player, enrageScale); else - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; float playerLocation = vectorCenter.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; - if (npc.ai[2] > 5f) + if (NPC.ai[2] > 5f) { - npc.ai[0] = -1f; - npc.ai[1] = 2f; - npc.ai[2] = 0f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.ai[1] = 2f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; // Prevent netUpdate from being blocked by the spam counter. // A phase switch sync is a critical operation that must be synced. - if (npc.netSpam >= 10) - npc.netSpam = 9; + if (NPC.netSpam >= 10) + NPC.netSpam = 9; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), NPC.Center); } } // Stinger phase - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - Vector2 vector121 = new Vector2(npc.direction == 1 ? npc.getRect().BottomLeft().X : npc.getRect().BottomRight().X, npc.getRect().Bottom().Y + 20f); - vector121.X += npc.direction * 120; + Vector2 vector121 = new Vector2(NPC.direction == 1 ? NPC.getRect().BottomLeft().X : NPC.getRect().BottomRight().X, NPC.getRect().Bottom().Y + 20f); + vector121.X += NPC.direction * 120; - npc.ai[1] += 1f; + NPC.ai[1] += 1f; int num650 = phase5 ? 20 : (phase3 ? 25 : 30); num650 -= (int)Math.Ceiling(5f * enrageScale); - if (npc.ai[1] % num650 == (num650 - 1) && vectorCenter.Y < player.position.Y) + if (NPC.ai[1] % num650 == (num650 - 1) && vectorCenter.Y < player.position.Y) { - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 42); + SoundEngine.PlaySound(SoundID.Item, (int)NPC.position.X, (int)NPC.position.Y, 42); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -742,7 +743,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1072 *= num1073; int type = ModContent.ProjectileType(); - switch ((int)npc.ai[2]) + switch ((int)NPC.ai[2]) { case 0: case 1: @@ -757,64 +758,64 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath break; } - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, type, damage, 0f, Main.myPlayer, challengeAmt, player.position.Y); - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.ai[2] += 1f; - if (npc.ai[2] > 4f) - npc.ai[2] = 0f; + NPC.ai[2] += 1f; + if (NPC.ai[2] > 4f) + NPC.ai[2] = 0f; } Movement(100f, 400f, 500f, player, enrageScale); float playerLocation = vectorCenter.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; - if (npc.ai[1] > num650 * 10f) + if (NPC.ai[1] > num650 * 10f) { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.ai[2] = 0f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.ai[1] = 3f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; // Prevent netUpdate from being blocked by the spam counter. // A phase switch sync is a critical operation that must be synced. - if (npc.netSpam >= 10) - npc.netSpam = 9; + if (NPC.netSpam >= 10) + NPC.netSpam = 9; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), NPC.Center); } } // Missile charge - else if (npc.ai[0] == 4f) + else if (NPC.ai[0] == 4f) { float num1044 = revenge ? 28f : 26f; num1044 += 3f * enrageScale; int num1043 = (int)Math.Ceiling(2f + enrageScale); - if (npc.ai[1] > (2 * num1043) && npc.ai[1] % 2f == 0f) + if (NPC.ai[1] > (2 * num1043) && NPC.ai[1] % 2f == 0f) { MissileCountdown = 0; - npc.ai[0] = -1f; - npc.ai[1] = -1f; - npc.ai[2] = 0f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.ai[1] = -1f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; // Prevent netUpdate from being blocked by the spam counter. // A phase switch sync is a critical operation that must be synced. - if (npc.netSpam >= 10) - npc.netSpam = 9; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), npc.Center); + if (NPC.netSpam >= 10) + NPC.netSpam = 9; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), NPC.Center); return; } // Charge - if (npc.ai[1] % 2f == 0f) + if (NPC.ai[1] % 2f == 0f) { float playerLocation = vectorCenter.X - player.Center.X; @@ -825,7 +826,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { if (MissileCountdown == 1) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PBGBarrageLaunch"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PBGBarrageLaunch"), NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -833,7 +834,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath speed += 2f * enrageScale; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Vector2 baseVelocity = player.Center - vectorCenter; baseVelocity.Normalize(); @@ -853,29 +854,29 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath charging = true; - npc.ai[1] += 1f; - npc.ai[2] = 0f; + NPC.ai[1] += 1f; + NPC.ai[2] = 0f; float num1045 = player.position.X + (player.width / 2) - vectorCenter.X; float num1046 = player.position.Y - 500f + (player.height / 2) - vectorCenter.Y; float num1047 = (float)Math.Sqrt(num1045 * num1045 + num1046 * num1046); num1047 = num1044 / num1047; - npc.velocity.X = num1045 * num1047; - npc.velocity.Y = num1046 * num1047; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity.X = num1045 * num1047; + NPC.velocity.Y = num1046 * num1047; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - if (npc.spriteDirection != 1) - npc.rotation += (float)Math.PI; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; + if (NPC.spriteDirection != 1) + NPC.rotation += (float)Math.PI; - npc.netUpdate = true; + NPC.netUpdate = true; return; } - npc.rotation = npc.velocity.X * 0.02f; + NPC.rotation = NPC.velocity.X * 0.02f; charging = false; float num1048 = revenge ? 16f : 14f; @@ -884,93 +885,93 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1049 += 0.25f * enrageScale; if (vectorCenter.Y < player.Center.Y - 500f) - npc.velocity.Y += num1049; + NPC.velocity.Y += num1049; else - npc.velocity.Y -= num1049; + NPC.velocity.Y -= num1049; - if (npc.velocity.Y < -num1048) - npc.velocity.Y = -num1048; - if (npc.velocity.Y > num1048) - npc.velocity.Y = num1048; + if (NPC.velocity.Y < -num1048) + NPC.velocity.Y = -num1048; + if (NPC.velocity.Y > num1048) + NPC.velocity.Y = num1048; if (Math.Abs(vectorCenter.X - player.Center.X) > 600f) - npc.velocity.X += num1049 * npc.direction; + NPC.velocity.X += num1049 * NPC.direction; else if (Math.Abs(vectorCenter.X - player.Center.X) < 300f) - npc.velocity.X -= num1049 * npc.direction; + NPC.velocity.X -= num1049 * NPC.direction; else - npc.velocity.X *= 0.8f; + NPC.velocity.X *= 0.8f; - if (npc.velocity.X < -num1048) - npc.velocity.X = -num1048; - if (npc.velocity.X > num1048) - npc.velocity.X = num1048; + if (NPC.velocity.X < -num1048) + NPC.velocity.X = -num1048; + if (NPC.velocity.X > num1048) + NPC.velocity.X = num1048; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; } // Slow down after charge else { - if (npc.velocity.X < 0f) - npc.direction = -1; + if (NPC.velocity.X < 0f) + NPC.direction = -1; else - npc.direction = 1; + NPC.direction = 1; - npc.spriteDirection = npc.direction; + NPC.spriteDirection = NPC.direction; int num1050 = 600; int num1051 = 1; if (vectorCenter.X < player.Center.X) num1051 = -1; - if (npc.direction == num1051 && Math.Abs(vectorCenter.X - player.Center.X) > num1050) - npc.ai[2] = 1f; - if (enrageScale > 0 && npc.ai[2] == 1f) - npc.velocity *= 0.95f; + if (NPC.direction == num1051 && Math.Abs(vectorCenter.X - player.Center.X) > num1050) + NPC.ai[2] = 1f; + if (enrageScale > 0 && NPC.ai[2] == 1f) + NPC.velocity *= 0.95f; - if (npc.ai[2] != 1f) + if (NPC.ai[2] != 1f) { charging = true; // Velocity fix if PBG slowed - if (npc.velocity.Length() < num1044) - npc.velocity.X = num1044 * npc.direction; + if (NPC.velocity.Length() < num1044) + NPC.velocity.X = num1044 * NPC.direction; calamityGlobalNPC.newAI[0] += 1f; if (calamityGlobalNPC.newAI[0] > 90f) - npc.velocity.X *= 1.01f; + NPC.velocity.X *= 1.01f; return; } - npc.rotation = npc.velocity.X * 0.02f; + NPC.rotation = NPC.velocity.X * 0.02f; charging = false; - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; float num1052 = revenge ? 0.12f : 0.1f; if (phase3) { - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; num1052 += 0.05f; } if (phase4) { - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; num1052 += 0.05f; } if (phase5) { - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; num1052 += 0.05f; } if (enrageScale > 0) - npc.velocity *= 0.95f; + NPC.velocity *= 0.95f; - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < num1052) { - npc.ai[2] = 0f; - npc.ai[1] += 1f; + NPC.ai[2] = 0f; + NPC.ai[1] += 1f; calamityGlobalNPC.newAI[0] = 0f; } } @@ -989,38 +990,38 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath velocity *= 0.5f; deceleration *= 1f - enrageScale * 0.1f; - if (npc.position.Y > player.position.Y - yPos) + if (NPC.position.Y > player.position.Y - yPos) { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - npc.velocity.Y -= acceleration.Y; - if (npc.velocity.Y > velocity.Y) - npc.velocity.Y = velocity.Y; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y *= deceleration; + NPC.velocity.Y -= acceleration.Y; + if (NPC.velocity.Y > velocity.Y) + NPC.velocity.Y = velocity.Y; } - else if (npc.position.Y < player.position.Y - yPos2) + else if (NPC.position.Y < player.position.Y - yPos2) { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - npc.velocity.Y += acceleration.Y; - if (npc.velocity.Y < -velocity.Y) - npc.velocity.Y = -velocity.Y; + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= deceleration; + NPC.velocity.Y += acceleration.Y; + if (NPC.velocity.Y < -velocity.Y) + NPC.velocity.Y = -velocity.Y; } - if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + xPos) + if (NPC.position.X + (NPC.width / 2) > player.position.X + (player.width / 2) + xPos) { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - npc.velocity.X -= acceleration.X; - if (npc.velocity.X > velocity.X) - npc.velocity.X = velocity.X; + if (NPC.velocity.X > 0f) + NPC.velocity.X *= deceleration; + NPC.velocity.X -= acceleration.X; + if (NPC.velocity.X > velocity.X) + NPC.velocity.X = velocity.X; } - if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - xPos) + if (NPC.position.X + (NPC.width / 2) < player.position.X + (player.width / 2) - xPos) { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - npc.velocity.X += acceleration.X; - if (npc.velocity.X < -velocity.X) - npc.velocity.X = -velocity.X; + if (NPC.velocity.X < 0f) + NPC.velocity.X *= deceleration; + NPC.velocity.X += acceleration.X; + if (NPC.velocity.X < -velocity.X) + NPC.velocity.X = -velocity.X; } } @@ -1031,10 +1032,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -1051,21 +1052,21 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { for (int k = 0; k < 2; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int i = 1; i < 7; i++) - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("PlaguebringerGoliathGore" + i), 2f); - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 200; - npc.height = 200; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("PlaguebringerGoliathGore" + i), 2f); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 200; + NPC.height = 200; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -1075,10 +1076,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -1086,18 +1087,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.npcTexture[npc.type]; - Texture2D glowTexture = ModContent.GetTexture("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathGlow"); + Texture2D texture = Main.npcTexture[NPC.type]; + Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathGlow"); if (curTex != (charging ? 2 : 1)) { - npc.frame.X = 0; - npc.frame.Y = 0; + NPC.frame.X = 0; + NPC.frame.Y = 0; } if (charging) { curTex = 2; - texture = ModContent.GetTexture("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex"); - glowTexture = ModContent.GetTexture("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTexGlow"); + texture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex"); + glowTexture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTexGlow"); } else { @@ -1105,17 +1106,17 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; int frameCount = 3; - Rectangle rectangle = new Rectangle(npc.frame.X, npc.frame.Y, texture.Width / 2, texture.Height / frameCount); + Rectangle rectangle = new Rectangle(NPC.frame.X, NPC.frame.Y, texture.Width / 2, texture.Height / frameCount); Vector2 vector11 = rectangle.Size() / 2f; Vector2 posOffset = new Vector2(charging ? 175 : 125, 0); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 10; - if (npc.ai[0] != 0f && npc.ai[0] != 4f) + if (NPC.ai[0] != 0f && NPC.ai[0] != 4f) num153 = 7; if (CalamityConfig.Instance.Afterimages) @@ -1124,19 +1125,19 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture.Width, texture.Height / frameCount) * npc.scale / 2f; - vector41 += vector11 * npc.scale + posOffset; - spriteBatch.Draw(texture, vector41, new Rectangle?(rectangle), color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture.Width, texture.Height / frameCount) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + posOffset; + spriteBatch.Draw(texture, vector41, new Rectangle?(rectangle), color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture.Width, texture.Height / frameCount) * npc.scale / 2f; - vector43 += vector11 * npc.scale + posOffset; - spriteBatch.Draw(texture, vector43, new Rectangle?(rectangle), npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture.Width, texture.Height / frameCount) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + posOffset; + spriteBatch.Draw(texture, vector43, new Rectangle?(rectangle), NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); @@ -1147,14 +1148,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(glowTexture.Width, glowTexture.Height / frameCount) * npc.scale / 2f; - vector44 += vector11 * npc.scale + posOffset; - spriteBatch.Draw(glowTexture, vector44, new Rectangle?(rectangle), color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(glowTexture.Width, glowTexture.Height / frameCount) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + posOffset; + spriteBatch.Draw(glowTexture, vector44, new Rectangle?(rectangle), color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(glowTexture, vector43, new Rectangle?(rectangle), color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(glowTexture, vector43, new Rectangle?(rectangle), color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -1163,17 +1164,17 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { int width = !charging ? (532 / 2) : (644 / 2); int height = !charging ? (768 / 3) : (636 / 3); - npc.frameCounter += 1.0; + NPC.frameCounter += 1.0; - if (npc.frameCounter > 4.0) + if (NPC.frameCounter > 4.0) { - npc.frame.Y = npc.frame.Y + height; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + height; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= height * 3) + if (NPC.frame.Y >= height * 3) { - npc.frame.Y = 0; - npc.frame.X = npc.frame.X == 0 ? width : 0; + NPC.frame.Y = 0; + NPC.frame.X = NPC.frame.X == 0 ? width : 0; if (charging) { flyingFrame2 = !flyingFrame2; @@ -1188,24 +1189,24 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedPlaguebringer); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedPlaguebringer); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { // Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 10, 14); - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 13, 17); - DropHelper.DropItemSpray(npc, ItemID.Stinger, 3, 5); + DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 10, 14); + DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 13, 17); + DropHelper.DropItemSpray(NPC, ItemID.Stinger, 3, 5); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), // Virulence DropHelper.WeightStack(w), DropHelper.WeightStack(w), // Pandemic @@ -1220,14 +1221,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // Mark PBG as dead CalamityWorld.downedPlaguebringer = true; @@ -1236,8 +1237,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index 35e84818e8..b06a34cd1d 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -18,25 +18,25 @@ namespace CalamityMod.NPCs.Polterghast public override void SetStaticDefaults() { DisplayName.SetDefault("Phantom"); - NPCID.Sets.TrailingMode[npc.type] = 1; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.width = 30; - npc.height = 30; - npc.defense = 45; - npc.DR_NERD(0.1f); - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.damage = 0; - npc.LifeMaxNERB(Main.expertMode ? 11250 : 8750, CalamityWorld.death ? 22500 : 18750, 15000); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.Calamity().VulnerableToSickness = false; + NPC.width = 30; + NPC.height = 30; + NPC.defense = 45; + NPC.DR_NERD(0.1f); + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.damage = 0; + NPC.LifeMaxNERB(Main.expertMode ? 11250 : 8750, CalamityWorld.death ? 22500 : 18750, 15000); + NPC.HitSound = SoundID.NPCHit36; + NPC.DeathSound = SoundID.NPCDeath39; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) @@ -57,17 +57,17 @@ namespace CalamityMod.NPCs.Polterghast for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; } - npc.ai[1] = npc.ai[0]; + NPC.ai[1] = NPC.ai[0]; } if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return false; } @@ -79,40 +79,40 @@ namespace CalamityMod.NPCs.Polterghast // Scale multiplier based on nearby active tiles float tileEnrageMult = Main.npc[CalamityGlobalNPC.ghostBoss].ai[3]; - npc.TargetClosest(true); + NPC.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; + Vector2 direction = Main.player[NPC.target].Center - NPC.Center; direction.Normalize(); direction *= 0.05f; - npc.rotation = direction.ToRotation(); + NPC.rotation = direction.ToRotation(); if (!chargePhase) { - npc.ai[2] += 1f; - if (npc.ai[2] >= 150f) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 150f) { if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float maxVelocity = 8f * tileEnrageMult; float acceleration = 1.15f + (tileEnrageMult - 1f) * 0.15f; - Projectile.NewProjectile(npc.Center, direction, type, damage, 1f, npc.target, maxVelocity, acceleration); + Projectile.NewProjectile(NPC.Center, direction, type, damage, 1f, NPC.target, maxVelocity, acceleration); } - npc.ai[2] = 0f; + NPC.ai[2] = 0f; } } NPC parent = Main.npc[NPC.FindFirstNPC(ModContent.NPCType())]; - double deg = npc.ai[1]; + double deg = NPC.ai[1]; double rad = deg * (Math.PI / 180); double dist = 500; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; + NPC.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - NPC.width / 2; + NPC.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - NPC.height / 2; float SPEEN = 1f - lifeRatio * 2f; if (SPEEN < 0f) SPEEN = 0f; - npc.ai[1] += 0.5f + SPEEN; + NPC.ai[1] += 0.5f + SPEEN; return false; } @@ -129,11 +129,11 @@ namespace CalamityMod.NPCs.Polterghast public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -144,37 +144,37 @@ namespace CalamityMod.NPCs.Polterghast { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } public override void HitEffect(int hitDirection, double damage) { - Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + Dust.NewDust(NPC.position, NPC.width, NPC.height, 180, hitDirection, -1f, 0, default, 1f); + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 45; - npc.height = 45; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 45; + NPC.height = 45; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 2; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -184,10 +184,10 @@ namespace CalamityMod.NPCs.Polterghast } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index 174daae7a7..30f44dd8bc 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Polterghast { @@ -20,48 +21,48 @@ namespace CalamityMod.NPCs.Polterghast public override void SetStaticDefaults() { DisplayName.SetDefault("Polterghast"); - Main.npcFrameCount[npc.type] = 4; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 4; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.width = 90; - npc.height = 120; - npc.defense = 45; - npc.DR_NERD(0.1f); - npc.LifeMaxNERB(Main.expertMode ? 45000 : 35000, CalamityWorld.death ? 90000 : 75000, 60000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.width = 90; + NPC.height = 120; + NPC.defense = 45; + NPC.DR_NERD(0.1f); + NPC.LifeMaxNERB(Main.expertMode ? 45000 : 35000, CalamityWorld.death ? 90000 : 75000, 60000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.aiStyle = -1; aiType = -1; - npc.Opacity = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.Calamity().VulnerableToSickness = false; + NPC.Opacity = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.netAlways = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit36; + NPC.DeathSound = SoundID.NPCDeath39; + NPC.Calamity().VulnerableToSickness = false; } public override void BossHeadRotation(ref float rotation) { bool polterHasTarget = CalamityGlobalNPC.ghostBoss.WithinBounds(Main.maxNPCs) && Main.npc[CalamityGlobalNPC.ghostBoss].active && Main.npc[CalamityGlobalNPC.ghostBoss].HasValidTarget; - if (polterHasTarget && npc.Calamity().newAI[3] == 0f) - rotation = (Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center - npc.Center).ToRotation() + MathHelper.PiOver2; + if (polterHasTarget && NPC.Calamity().newAI[3] == 0f) + rotation = (Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center - NPC.Center).ToRotation() + MathHelper.PiOver2; else - rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(despawnTimer); writer.Write(reachedChargingPoint); - CalamityGlobalNPC cgn = npc.Calamity(); + CalamityGlobalNPC cgn = NPC.Calamity(); writer.Write(cgn.newAI[0]); writer.Write(cgn.newAI[1]); writer.Write(cgn.newAI[2]); @@ -72,7 +73,7 @@ namespace CalamityMod.NPCs.Polterghast { despawnTimer = reader.ReadInt32(); reachedChargingPoint = reader.ReadBoolean(); - CalamityGlobalNPC cgn = npc.Calamity(); + CalamityGlobalNPC cgn = NPC.Calamity(); cgn.newAI[0] = reader.ReadSingle(); cgn.newAI[1] = reader.ReadSingle(); cgn.newAI[2] = reader.ReadSingle(); @@ -81,7 +82,7 @@ namespace CalamityMod.NPCs.Polterghast public override void AI() { - CalamityGlobalNPC.ghostBossClone = npc.whoAmI; + CalamityGlobalNPC.ghostBossClone = NPC.whoAmI; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -90,23 +91,23 @@ namespace CalamityMod.NPCs.Polterghast if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.5f, 0.25f, 0.75f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.5f, 0.25f, 0.75f); Player player = Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target]; // Percent life remaining, Polter float lifeRatio = Main.npc[CalamityGlobalNPC.ghostBoss].life / Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax; - Vector2 vector = npc.Center; + Vector2 vector = NPC.Center; // Scale multiplier based on nearby active tiles float tileEnrageMult = Main.npc[CalamityGlobalNPC.ghostBoss].ai[3]; - bool chargePhase = Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] >= 420f || npc.Calamity().newAI[3] == 1f; + bool chargePhase = Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] >= 420f || NPC.Calamity().newAI[3] == 1f; float chargeVelocity = 24f; float chargeAcceleration = 0.6f; float chargeDistance = 480f; @@ -114,8 +115,8 @@ namespace CalamityMod.NPCs.Polterghast bool speedBoost = false; bool despawnBoost = false; - if (npc.timeLeft < 1500) - npc.timeLeft = 1500; + if (NPC.timeLeft < 1500) + NPC.timeLeft = 1500; float velocity = 3f; float acceleration = 0.03f; @@ -125,11 +126,11 @@ namespace CalamityMod.NPCs.Polterghast if (despawnTimer <= 0) { despawnBoost = true; - npc.ai[1] = 0f; - npc.Calamity().newAI[0] = 0f; - npc.Calamity().newAI[1] = 0f; - npc.Calamity().newAI[2] = 0f; - npc.Calamity().newAI[3] = 0f; + NPC.ai[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[2] = 0f; + NPC.Calamity().newAI[3] = 0f; } speedBoost = true; @@ -158,27 +159,27 @@ namespace CalamityMod.NPCs.Polterghast Vector2 rotationVector = lookAt - vector; // Rotation - if (npc.Calamity().newAI[3] == 0f) + if (NPC.Calamity().newAI[3] == 0f) { float num740 = player.Center.X + predictionVector.X - vector.X; float num741 = player.Center.Y + predictionVector.Y - vector.Y; - npc.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; } else - npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; if (!chargePhase) { // Set this here to avoid despawn issues reachedChargingPoint = false; - npc.ai[0] = 0f; + NPC.ai[0] = 0f; - npc.Opacity += 0.02f; - if (npc.Opacity > 0.8f) - npc.Opacity = 0.8f; + NPC.Opacity += 0.02f; + if (NPC.Opacity > 0.8f) + NPC.Opacity = 0.8f; float movementLimitX = 0f; float movementLimitY = 0f; @@ -238,8 +239,8 @@ namespace CalamityMod.NPCs.Polterghast if (num738 < velocity) { - num736 = npc.velocity.X; - num737 = npc.velocity.Y; + num736 = NPC.velocity.X; + num737 = NPC.velocity.Y; } else { @@ -248,71 +249,71 @@ namespace CalamityMod.NPCs.Polterghast num737 *= num738; } - if (npc.velocity.X < num736) + if (NPC.velocity.X < num736) { - npc.velocity.X += acceleration; - if (npc.velocity.X < 0f && num736 > 0f) - npc.velocity.X += acceleration * 2f; + NPC.velocity.X += acceleration; + if (NPC.velocity.X < 0f && num736 > 0f) + NPC.velocity.X += acceleration * 2f; } - else if (npc.velocity.X > num736) + else if (NPC.velocity.X > num736) { - npc.velocity.X -= acceleration; - if (npc.velocity.X > 0f && num736 < 0f) - npc.velocity.X -= acceleration * 2f; + NPC.velocity.X -= acceleration; + if (NPC.velocity.X > 0f && num736 < 0f) + NPC.velocity.X -= acceleration * 2f; } - if (npc.velocity.Y < num737) + if (NPC.velocity.Y < num737) { - npc.velocity.Y += acceleration; - if (npc.velocity.Y < 0f && num737 > 0f) - npc.velocity.Y += acceleration * 2f; + NPC.velocity.Y += acceleration; + if (NPC.velocity.Y < 0f && num737 > 0f) + NPC.velocity.Y += acceleration * 2f; } - else if (npc.velocity.Y > num737) + else if (NPC.velocity.Y > num737) { - npc.velocity.Y -= acceleration; - if (npc.velocity.Y > 0f && num737 < 0f) - npc.velocity.Y -= acceleration * 2f; + NPC.velocity.Y -= acceleration; + if (NPC.velocity.Y > 0f && num737 < 0f) + NPC.velocity.Y -= acceleration * 2f; } } else { // Charge - if (npc.Calamity().newAI[3] == 1f) + if (NPC.Calamity().newAI[3] == 1f) { reachedChargingPoint = false; - npc.Opacity += 0.06f; - if (npc.Opacity > 0.8f) - npc.Opacity = 0.8f; + NPC.Opacity += 0.06f; + if (NPC.Opacity > 0.8f) + NPC.Opacity = 0.8f; - if (npc.Calamity().newAI[1] == 0f) + if (NPC.Calamity().newAI[1] == 0f) { - npc.velocity = Vector2.Normalize(rotationVector) * chargeVelocity; - npc.Calamity().newAI[1] = 1f; + NPC.velocity = Vector2.Normalize(rotationVector) * chargeVelocity; + NPC.Calamity().newAI[1] = 1f; } else { - npc.Calamity().newAI[2] += 1f; + NPC.Calamity().newAI[2] += 1f; // Slow down for a few frames float totalChargeTime = chargeDistance * 4f / chargeVelocity; float slowDownTime = chargeVelocity; - if (npc.Calamity().newAI[2] >= totalChargeTime - slowDownTime) - npc.velocity *= 0.9f; + if (NPC.Calamity().newAI[2] >= totalChargeTime - slowDownTime) + NPC.velocity *= 0.9f; // Reset and either go back to normal or charge again - if (npc.Calamity().newAI[2] >= totalChargeTime) + if (NPC.Calamity().newAI[2] >= totalChargeTime) { - npc.Calamity().newAI[1] = 0f; - npc.Calamity().newAI[2] = 0f; - npc.Calamity().newAI[3] = 0f; - npc.ai[0] = 0f; - npc.ai[1] += 1f; + NPC.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[2] = 0f; + NPC.Calamity().newAI[3] = 0f; + NPC.ai[0] = 0f; + NPC.ai[1] += 1f; - if (npc.ai[1] >= 3f) + if (NPC.ai[1] >= 3f) { // Reset and return to normal movement - npc.Calamity().newAI[0] = 0f; - npc.ai[1] = 0f; + NPC.Calamity().newAI[0] = 0f; + NPC.ai[1] = 0f; } } } @@ -320,31 +321,31 @@ namespace CalamityMod.NPCs.Polterghast else { // Random location choice - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.velocity = Vector2.Zero; - npc.ai[0] = Main.rand.Next(2) + 1; - npc.netUpdate = true; + NPC.velocity = Vector2.Zero; + NPC.ai[0] = Main.rand.Next(2) + 1; + NPC.netUpdate = true; } // Pick a charging location // Set charge locations X if (Main.npc[CalamityGlobalNPC.ghostBoss].Center.X >= player.Center.X) - npc.Calamity().newAI[1] = npc.ai[0] == 1f ? player.Center.X - chargeDistance : Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[1]; + NPC.Calamity().newAI[1] = NPC.ai[0] == 1f ? player.Center.X - chargeDistance : Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[1]; else - npc.Calamity().newAI[1] = npc.ai[0] == 1f ? player.Center.X + chargeDistance : Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[1]; + NPC.Calamity().newAI[1] = NPC.ai[0] == 1f ? player.Center.X + chargeDistance : Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[1]; // Set charge locations Y if (Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y >= player.Center.Y) - npc.Calamity().newAI[2] = npc.ai[0] == 2f ? player.Center.Y - chargeDistance : Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[2]; + NPC.Calamity().newAI[2] = NPC.ai[0] == 2f ? player.Center.Y - chargeDistance : Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[2]; else - npc.Calamity().newAI[2] = npc.ai[0] == 2f ? player.Center.Y + chargeDistance : Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[2]; + NPC.Calamity().newAI[2] = NPC.ai[0] == 2f ? player.Center.Y + chargeDistance : Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[2]; // Do not deal damage during movement to avoid cheap bullshit hits - npc.damage = 0; + NPC.damage = 0; // Charge location - Vector2 chargeVector = new Vector2(npc.Calamity().newAI[1], npc.Calamity().newAI[2]); + Vector2 chargeVector = new Vector2(NPC.Calamity().newAI[1], NPC.Calamity().newAI[2]); Vector2 chargeLocationVelocity = Vector2.Normalize(chargeVector - vector) * chargeVelocity; // Line up a charge @@ -352,15 +353,15 @@ namespace CalamityMod.NPCs.Polterghast if (Vector2.Distance(vector, chargeVector) <= chargeDistanceGateValue * 3f) { - npc.Opacity += 0.06f; - if (npc.Opacity > 0.8f) - npc.Opacity = 0.8f; + NPC.Opacity += 0.06f; + if (NPC.Opacity > 0.8f) + NPC.Opacity = 0.8f; } else { - npc.Opacity -= 0.06f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.06f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } if (Vector2.Distance(vector, chargeVector) <= chargeDistanceGateValue || reachedChargingPoint) @@ -368,54 +369,54 @@ namespace CalamityMod.NPCs.Polterghast // Emit dust if (!reachedChargingPoint) { - Main.PlaySound(SoundID.Item125, npc.position); + SoundEngine.PlaySound(SoundID.Item125, NPC.position); for (int i = 0; i < 30; i++) { - int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 5f; } } reachedChargingPoint = true; - npc.velocity = Vector2.Zero; - npc.Center = chargeVector; + NPC.velocity = Vector2.Zero; + NPC.Center = chargeVector; } else { // Reduce velocity and acceleration to allow for smoother movement inside this loop if (Vector2.Distance(vector, chargeVector) > 1200f) - npc.velocity = chargeLocationVelocity; + NPC.velocity = chargeLocationVelocity; else - npc.SimpleFlyMovement(chargeLocationVelocity, chargeAcceleration); + NPC.SimpleFlyMovement(chargeLocationVelocity, chargeAcceleration); } } - npc.netUpdate = true; + NPC.netUpdate = true; - if (npc.netSpam > 10) - npc.netSpam = 10; + if (NPC.netSpam > 10) + NPC.netSpam = 10; if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } public override Color? GetAlpha(Color drawColor) { - return new Color(200, 150, 255) * npc.Opacity; + return new Color(200, 150, 255) * NPC.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); Color color36 = Color.White; - Color lightRed = new Color(255, 100, 100, 255) * npc.Opacity; + Color lightRed = new Color(255, 100, 100, 255) * NPC.Opacity; float amount9 = 0.5f; int num153 = 7; @@ -429,59 +430,59 @@ namespace CalamityMod.NPCs.Polterghast color38 = Color.Lerp(color38, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - 300f) / 120f, 0f, 1f)); color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Color color = npc.GetAlpha(lightColor); + Color color = NPC.GetAlpha(lightColor); if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > 300f) color = Color.Lerp(color, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - 300f) / 120f, 0f, 1f)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - Texture2D texture2D16 = ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterPhantomGlow"); + Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterPhantomGlow"); Color color42 = Color.Lerp(Color.White, (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] < 300f || Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > 300f) ? Color.Red : Color.Black, 0.5f); if (CalamityConfig.Instance.Afterimages) { for (int num163 = 1; num163 < num153; num163++) { - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color43 = color42; color43 = Color.Lerp(color43, color36, amount9); - color43 = npc.GetAlpha(color43); + color43 = NPC.GetAlpha(color43); color43 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture2D16, vector44, npc.frame, color43, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 6.0) { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; } - if (npc.frame.Y > frameHeight * 3) + if (NPC.frame.Y > frameHeight * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } @@ -503,24 +504,24 @@ namespace CalamityMod.NPCs.Polterghast public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) { - Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + Dust.NewDust(NPC.position, NPC.width, NPC.height, 180, hitDirection, -1f, 0, default, 1f); + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 90; - npc.height = 90; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 90; + NPC.height = 90; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -530,10 +531,10 @@ namespace CalamityMod.NPCs.Polterghast } for (int num623 = 0; num623 < 60; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 180, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 5e5c7e36a7..b798bc22a9 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -22,6 +22,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Polterghast { @@ -48,35 +49,35 @@ namespace CalamityMod.NPCs.Polterghast public override void SetStaticDefaults() { DisplayName.SetDefault("Polterghast"); - Main.npcFrameCount[npc.type] = 12; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 12; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 50f; - npc.GetNPCDamage(); - npc.width = 90; - npc.height = 120; - npc.defense = 90; - npc.DR_NERD(0.2f); - npc.LifeMaxNERB(350000, 420000, 325000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 50f; + NPC.GetNPCDamage(); + NPC.width = 90; + NPC.height = 120; + NPC.defense = 90; + NPC.DR_NERD(0.2f); + NPC.LifeMaxNERB(350000, 420000, 325000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(3, 50, 0, 0); - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; + NPC.value = Item.buyPrice(3, 50, 0, 0); + NPC.boss = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.netAlways = true; music = CalamityMod.Instance.GetMusicFromMusicMod("Polterghast") ?? MusicID.Plantera; - npc.HitSound = SoundID.NPCHit7; - npc.DeathSound = SoundID.NPCDeath39; + NPC.HitSound = SoundID.NPCHit7; + NPC.DeathSound = SoundID.NPCDeath39; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToSickness = false; } public override void BossHeadSlot(ref int index) @@ -85,7 +86,7 @@ namespace CalamityMod.NPCs.Polterghast bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool phase3 = npc.life / (float)npc.lifeMax < (death ? 0.6f : revenge ? 0.5f : expertMode ? 0.35f : 0.2f); + bool phase3 = NPC.life / (float)NPC.lifeMax < (death ? 0.6f : revenge ? 0.5f : expertMode ? 0.35f : 0.2f); if (phase3) index = phase3IconIndex; else @@ -94,17 +95,17 @@ namespace CalamityMod.NPCs.Polterghast public override void BossHeadRotation(ref float rotation) { - if (npc.HasValidTarget && npc.Calamity().newAI[3] == 0f) - rotation = (Main.player[npc.TranslatedTargetIndex].Center - npc.Center).ToRotation() + MathHelper.PiOver2; + if (NPC.HasValidTarget && NPC.Calamity().newAI[3] == 0f) + rotation = (Main.player[NPC.TranslatedTargetIndex].Center - NPC.Center).ToRotation() + MathHelper.PiOver2; else - rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(despawnTimer); writer.Write(reachedChargingPoint); - CalamityGlobalNPC cgn = npc.Calamity(); + CalamityGlobalNPC cgn = NPC.Calamity(); writer.Write(cgn.newAI[0]); writer.Write(cgn.newAI[1]); writer.Write(cgn.newAI[2]); @@ -115,7 +116,7 @@ namespace CalamityMod.NPCs.Polterghast { despawnTimer = reader.ReadInt32(); reachedChargingPoint = reader.ReadBoolean(); - CalamityGlobalNPC cgn = npc.Calamity(); + CalamityGlobalNPC cgn = NPC.Calamity(); cgn.newAI[0] = reader.ReadSingle(); cgn.newAI[1] = reader.ReadSingle(); cgn.newAI[2] = reader.ReadSingle(); @@ -124,13 +125,13 @@ namespace CalamityMod.NPCs.Polterghast public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.1f, 0.5f, 0.5f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.1f, 0.5f, 0.5f); // whoAmI variable - CalamityGlobalNPC.ghostBoss = npc.whoAmI; + CalamityGlobalNPC.ghostBoss = NPC.whoAmI; // Detect clone bool cloneAlive = false; @@ -138,10 +139,10 @@ namespace CalamityMod.NPCs.Polterghast cloneAlive = Main.npc[CalamityGlobalNPC.ghostBossClone].active; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Variables - Vector2 vector = npc.Center; + Vector2 vector = NPC.Center; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool speedBoost = false; bool despawnBoost = false; @@ -165,37 +166,37 @@ namespace CalamityMod.NPCs.Polterghast float chargeVelocity = getPissed ? 28f : phase3 ? 24f : phase2 ? 22f : 20f; float chargeAcceleration = getPissed ? 0.7f : phase3 ? 0.6f : phase2 ? 0.55f : 0.5f; float chargeDistance = 480f; - bool charging = npc.ai[2] >= 300f; - bool reset = npc.ai[2] >= 600f; + bool charging = NPC.ai[2] >= 300f; + bool reset = NPC.ai[2] >= 600f; float speedUpDistance = 480f - 360f * (1f - lifeRatio); // Only get a new target while not charging if (!chargePhase) { // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); } - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; bool speedUp = Vector2.Distance(player.Center, vector) > speedUpDistance; // 30 or 40 tile distance float velocity = 10f; // Max should be 21 float acceleration = 0.05f; // Max should be 0.13 if (!player.active || player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (!player.active || player.dead) { speedBoost = true; despawnBoost = true; reachedChargingPoint = false; - npc.ai[1] = 0f; + NPC.ai[1] = 0f; calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; @@ -217,17 +218,17 @@ namespace CalamityMod.NPCs.Polterghast CalamityMod.StopRain(); // Set time left - if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; // Spawn hooks - if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] = 1f; - NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.localAI[0] = 1f; + NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), NPC.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), NPC.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), NPC.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), NPC.whoAmI, 0f, 0f, 0f, 0f, 255); } if (!player.ZoneDungeon && !BossRushEvent.BossRushActive && player.position.Y < Main.worldSurface * 16.0) @@ -236,7 +237,7 @@ namespace CalamityMod.NPCs.Polterghast if (despawnTimer <= 0) { despawnBoost = true; - npc.ai[1] = 0f; + NPC.ai[1] = 0f; calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; @@ -253,8 +254,8 @@ namespace CalamityMod.NPCs.Polterghast // Despawn if (Vector2.Distance(player.Center, vector) > (despawnBoost ? 1500f : 6000f)) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } @@ -307,7 +308,7 @@ namespace CalamityMod.NPCs.Polterghast } // Slow down if close to target and not inside tiles - if (!speedUp && !Collision.SolidCollision(npc.position, npc.width, npc.height) && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && !charging && !chargePhase) + if (!speedUp && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height) && !charging && !chargePhase) { velocity = 8f; acceleration = 0.035f; @@ -326,7 +327,7 @@ namespace CalamityMod.NPCs.Polterghast { if (Main.tile[x, y] != null) { - if (Main.tile[x, y].nactive() && Main.tileSolid[Main.tile[x, y].type] && !Main.tileSolidTop[Main.tile[x, y].type] && !TileID.Sets.Platforms[Main.tile[x, y].type]) + if (Main.tile[x, y].nactive() && Main.tileSolid[Main.tile[x, y].TileType] && !Main.tileSolidTop[Main.tile[x, y].TileType] && !TileID.Sets.Platforms[Main.tile[x, y].TileType]) nearbyActiveTiles++; } } @@ -340,10 +341,10 @@ namespace CalamityMod.NPCs.Polterghast if (malice) tileEnrageMult = 1.75f; - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && tileEnrageMult >= 1.6f; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && tileEnrageMult >= 1.6f; // Used to inform clone and hooks about number of active tiles nearby - npc.ai[3] = tileEnrageMult; + NPC.ai[3] = tileEnrageMult; // Increase projectile fire rate based on number of nearby active tiles float amount = 1f - ((tileEnrageMult - 1f) / 0.75f); @@ -369,18 +370,18 @@ namespace CalamityMod.NPCs.Polterghast { float num740 = player.Center.X + predictionVector.X - vector.X; float num741 = player.Center.Y + predictionVector.Y - vector.Y; - npc.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; } else - npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; if (!chargePhase) { - npc.ai[2] += 1f; + NPC.ai[2] += 1f; if (reset) { - npc.ai[2] = 0f; - npc.netUpdate = true; + NPC.ai[2] = 0f; + NPC.netUpdate = true; } float movementLimitX = 0f; @@ -440,8 +441,8 @@ namespace CalamityMod.NPCs.Polterghast if (num738 < velocity) { - num736 = npc.velocity.X; - num737 = npc.velocity.Y; + num736 = NPC.velocity.X; + num737 = NPC.velocity.Y; } else { @@ -450,36 +451,36 @@ namespace CalamityMod.NPCs.Polterghast num737 *= num738; } - if (npc.velocity.X < num736) + if (NPC.velocity.X < num736) { - npc.velocity.X += acceleration; - if (npc.velocity.X < 0f && num736 > 0f) - npc.velocity.X += acceleration * 2f; + NPC.velocity.X += acceleration; + if (NPC.velocity.X < 0f && num736 > 0f) + NPC.velocity.X += acceleration * 2f; } - else if (npc.velocity.X > num736) + else if (NPC.velocity.X > num736) { - npc.velocity.X -= acceleration; - if (npc.velocity.X > 0f && num736 < 0f) - npc.velocity.X -= acceleration * 2f; + NPC.velocity.X -= acceleration; + if (NPC.velocity.X > 0f && num736 < 0f) + NPC.velocity.X -= acceleration * 2f; } - if (npc.velocity.Y < num737) + if (NPC.velocity.Y < num737) { - npc.velocity.Y += acceleration; - if (npc.velocity.Y < 0f && num737 > 0f) - npc.velocity.Y += acceleration * 2f; + NPC.velocity.Y += acceleration; + if (NPC.velocity.Y < 0f && num737 > 0f) + NPC.velocity.Y += acceleration * 2f; } - else if (npc.velocity.Y > num737) + else if (NPC.velocity.Y > num737) { - npc.velocity.Y -= acceleration; - if (npc.velocity.Y > 0f && num737 < 0f) - npc.velocity.Y -= acceleration * 2f; + NPC.velocity.Y -= acceleration; + if (NPC.velocity.Y > 0f && num737 < 0f) + NPC.velocity.Y -= acceleration * 2f; } // Slow down considerably if near player - if (!speedUp && nearbyActiveTiles > 1000 && !Collision.SolidCollision(npc.position, npc.width, npc.height) && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && !charging) + if (!speedUp && nearbyActiveTiles > 1000 && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height) && !charging) { - if (npc.velocity.Length() > velocity) - npc.velocity *= 0.97f; + if (NPC.velocity.Length() > velocity) + NPC.velocity *= 0.97f; } } else @@ -491,7 +492,7 @@ namespace CalamityMod.NPCs.Polterghast if (calamityGlobalNPC.newAI[1] == 0f) { - npc.velocity = Vector2.Normalize(rotationVector) * chargeVelocity; + NPC.velocity = Vector2.Normalize(rotationVector) * chargeVelocity; calamityGlobalNPC.newAI[1] = 1f; } else @@ -502,7 +503,7 @@ namespace CalamityMod.NPCs.Polterghast float totalChargeTime = chargeDistance * 4f / chargeVelocity; float slowDownTime = chargeVelocity; if (calamityGlobalNPC.newAI[2] >= totalChargeTime - slowDownTime) - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; // Reset and either go back to normal or charge again if (calamityGlobalNPC.newAI[2] >= totalChargeTime) @@ -510,18 +511,18 @@ namespace CalamityMod.NPCs.Polterghast calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; - npc.ai[1] += 1f; + NPC.ai[1] += 1f; - if (npc.ai[1] >= chargeAmt) + if (NPC.ai[1] >= chargeAmt) { // Reset and return to normal movement calamityGlobalNPC.newAI[0] = 0f; - npc.ai[1] = 0f; + NPC.ai[1] = 0f; } else { // Get a new target and charge again - npc.TargetClosest(); + NPC.TargetClosest(); } } } @@ -555,18 +556,18 @@ namespace CalamityMod.NPCs.Polterghast // Emit dust if (!reachedChargingPoint) { - Main.PlaySound(SoundID.Item125, npc.position); + SoundEngine.PlaySound(SoundID.Item125, NPC.position); for (int i = 0; i < 30; i++) { - int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 5f; } } reachedChargingPoint = true; - npc.velocity = Vector2.Zero; - npc.Center = chargeVector; + NPC.velocity = Vector2.Zero; + NPC.Center = chargeVector; if (clonePositionCheck) { @@ -593,38 +594,38 @@ namespace CalamityMod.NPCs.Polterghast } } else - npc.SimpleFlyMovement(chargeLocationVelocity, chargeAcceleration); + NPC.SimpleFlyMovement(chargeLocationVelocity, chargeAcceleration); } - npc.netUpdate = true; + NPC.netUpdate = true; - if (npc.netSpam > 10) - npc.netSpam = 10; + if (NPC.netSpam > 10) + NPC.netSpam = 10; if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI, 0f, 0f, 0f, 0, 0, 0); } if (!phase2 && !phase3) { - npc.damage = npc.defDamage; - npc.defense = npc.defDefense; + NPC.damage = NPC.defDamage; + NPC.defense = NPC.defDefense; if (Main.netMode != NetmodeID.MultiplayerClient && !charging && !chargePhase) { - npc.localAI[1] += expertMode ? 1.5f : 1f; + NPC.localAI[1] += expertMode ? 1.5f : 1f; if (speedBoost) - npc.localAI[1] += 2f; + NPC.localAI[1] += 2f; - if (npc.localAI[1] >= 90f * projectileFireRateMultiplier) + if (NPC.localAI[1] >= 90f * projectileFireRateMultiplier) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; - bool flag47 = Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height); - if (npc.localAI[3] > 0f) + bool flag47 = Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + if (NPC.localAI[3] > 0f) { flag47 = true; - npc.localAI[3] = 0f; + NPC.localAI[3] = 0f; } if (flag47) @@ -632,11 +633,11 @@ namespace CalamityMod.NPCs.Polterghast int type = ModContent.ProjectileType(); if (Main.rand.NextBool(3)) { - npc.localAI[1] = -30f; + NPC.localAI[1] = -30f; type = ModContent.ProjectileType(); } - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Vector2 vector93 = vector; float num743 = player.Center.X - vector93.X; @@ -664,7 +665,7 @@ namespace CalamityMod.NPCs.Polterghast else { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Vector2 vector93 = vector; float num743 = player.Center.X - vector93.X; @@ -694,28 +695,28 @@ namespace CalamityMod.NPCs.Polterghast } else if (!phase3) { - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; // Reset charge attack arrays to prevent problems - npc.ai[1] = 0f; + NPC.ai[1] = 0f; calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; - Main.PlaySound(SoundID.Item122, npc.Center); + SoundEngine.PlaySound(SoundID.Item122, NPC.Center); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt5"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Polt"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Polt2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Polt3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Polt4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Polt5"), 1f); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -726,34 +727,34 @@ namespace CalamityMod.NPCs.Polterghast } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } - npc.GivenName = "Necroghast"; + NPC.GivenName = "Necroghast"; - npc.damage = (int)(npc.defDamage * 1.2f); - npc.defense = (int)(npc.defDefense * 0.8f); + NPC.damage = (int)(NPC.defDamage * 1.2f); + NPC.defense = (int)(NPC.defDefense * 0.8f); if (Main.netMode != NetmodeID.MultiplayerClient && !charging && !chargePhase) { - npc.localAI[1] += expertMode ? 1.5f : 1f; + NPC.localAI[1] += expertMode ? 1.5f : 1f; if (speedBoost) - npc.localAI[1] += 2f; + NPC.localAI[1] += 2f; - if (npc.localAI[1] >= 150f * projectileFireRateMultiplier) + if (NPC.localAI[1] >= 150f * projectileFireRateMultiplier) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; - bool flag47 = Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height); - if (npc.localAI[3] > 0f) + bool flag47 = Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + if (NPC.localAI[3] > 0f) { flag47 = true; - npc.localAI[3] = 0f; + NPC.localAI[3] = 0f; } if (flag47) @@ -761,11 +762,11 @@ namespace CalamityMod.NPCs.Polterghast int type = ModContent.ProjectileType(); if (Main.rand.NextBool(3)) { - npc.localAI[1] = -30f; + NPC.localAI[1] = -30f; type = ModContent.ProjectileType(); } - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Vector2 vector93 = vector; float num743 = player.Center.X - vector93.X; @@ -794,7 +795,7 @@ namespace CalamityMod.NPCs.Polterghast else { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Vector2 vector93 = vector; float num743 = player.Center.X - vector93.X; @@ -825,14 +826,14 @@ namespace CalamityMod.NPCs.Polterghast } else { - npc.HitSound = SoundID.NPCHit36; + NPC.HitSound = SoundID.NPCHit36; - if (npc.ai[0] == 1f) + if (NPC.ai[0] == 1f) { - npc.ai[0] = 2f; + NPC.ai[0] = 2f; // Reset charge attack arrays to prevent problems - npc.ai[1] = 0f; + NPC.ai[1] = 0f; calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; @@ -846,24 +847,24 @@ namespace CalamityMod.NPCs.Polterghast { for (int I = 0; I < 3; I++) { - int spawn = NPC.NewNPC((int)(vector.X + (Math.Sin(I * 120) * 500)), (int)(vector.Y + (Math.Cos(I * 120) * 500)), ModContent.NPCType(), npc.whoAmI, 0, 0, 0, -1); + int spawn = NPC.NewNPC((int)(vector.X + (Math.Sin(I * 120) * 500)), (int)(vector.Y + (Math.Cos(I * 120) * 500)), ModContent.NPCType(), NPC.whoAmI, 0, 0, 0, -1); NPC npc2 = Main.npc[spawn]; npc2.ai[0] = I * 120; } } } - Main.PlaySound(SoundID.Item122, npc.Center); + SoundEngine.PlaySound(SoundID.Item122, NPC.Center); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt5"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Polt"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Polt2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Polt3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Polt4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Polt5"), 1f); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -874,23 +875,23 @@ namespace CalamityMod.NPCs.Polterghast } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } - npc.GivenName = "Necroplasm"; + NPC.GivenName = "Necroplasm"; - npc.damage = (int)(npc.defDamage * 1.4f); - npc.defense = (int)(npc.defDefense * 0.5f); + NPC.damage = (int)(NPC.defDamage * 1.4f); + NPC.defense = (int)(NPC.defDefense * 0.5f); - npc.localAI[1] += 1f; - if (npc.localAI[1] >= (getPissed ? 150f : 210f) * projectileFireRateMultiplier && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + NPC.localAI[1] += 1f; + if (NPC.localAI[1] >= (getPissed ? 150f : 210f) * projectileFireRateMultiplier && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient && !charging && !chargePhase) { Vector2 vector93 = vector; @@ -912,7 +913,7 @@ namespace CalamityMod.NPCs.Polterghast double offsetAngle; int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); for (int i = 0; i < numProj; i++) { @@ -924,10 +925,10 @@ namespace CalamityMod.NPCs.Polterghast if (phase4) { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= (getPissed ? 300f : 420f)) + NPC.localAI[2] += 1f; + if (NPC.localAI[2] >= (getPissed ? 300f : 420f)) { - npc.localAI[2] = 0f; + NPC.localAI[2] = 0f; float num757 = 6f; Vector2 vector94 = vector; @@ -959,12 +960,12 @@ namespace CalamityMod.NPCs.Polterghast public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedPolterghast); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedPolterghast); CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Cyborg }, CalamityWorld.downedPolterghast); @@ -972,15 +973,15 @@ namespace CalamityMod.NPCs.Polterghast if (!Main.expertMode) { // Materials - DropHelper.DropItem(npc, ModContent.ItemType(), 7, 15); - DropHelper.DropItem(npc, ModContent.ItemType(), 30, 40); + DropHelper.DropItem(NPC, ModContent.ItemType(), 7, 15); + DropHelper.DropItem(NPC, ModContent.ItemType(), 30, 40); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -991,14 +992,14 @@ namespace CalamityMod.NPCs.Polterghast ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); } // If Polterghast has not been killed, notify players about the Abyss minibosses now dropping items if (!CalamityWorld.downedPolterghast) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperSearchRoar"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperSearchRoar"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); string key = "Mods.CalamityMod.GhostBossText"; Color messageColor = Color.RoyalBlue; @@ -1022,12 +1023,12 @@ namespace CalamityMod.NPCs.Polterghast public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Texture2D texture2D16 = ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterghastGlow2"); - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastGlow2"); + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 7; @@ -1038,28 +1039,28 @@ namespace CalamityMod.NPCs.Polterghast { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterghastGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastGlow"); Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); Color lightRed = new Color(255, 100, 100, 255); - if (npc.Calamity().newAI[0] > 300f) - color37 = Color.Lerp(color37, lightRed, MathHelper.Clamp((npc.Calamity().newAI[0] - 300f) / 120f, 0f, 1f)); + if (NPC.Calamity().newAI[0] > 300f) + color37 = Color.Lerp(color37, lightRed, MathHelper.Clamp((NPC.Calamity().newAI[0] - 300f) / 120f, 0f, 1f)); - Color color42 = Color.Lerp(Color.White, (npc.ai[2] >= 300f || npc.Calamity().newAI[0] > 300f) ? Color.Red : Color.Black, 0.5f); + Color color42 = Color.Lerp(Color.White, (NPC.ai[2] >= 300f || NPC.Calamity().newAI[0] > 300f) ? Color.Red : Color.Black, 0.5f); if (CalamityConfig.Instance.Afterimages) { @@ -1067,24 +1068,24 @@ namespace CalamityMod.NPCs.Polterghast { Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); - color41 = npc.GetAlpha(color41); + color41 = NPC.GetAlpha(color41); color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); Color color43 = color42; color43 = Color.Lerp(color43, color36, amount9); - color43 = npc.GetAlpha(color43); + color43 = NPC.GetAlpha(color43); color43 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture2D16, vector44, npc.frame, color43, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -1092,7 +1093,7 @@ namespace CalamityMod.NPCs.Polterghast public override void FindFrame(int frameHeight) { // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; @@ -1101,39 +1102,39 @@ namespace CalamityMod.NPCs.Polterghast bool phase2 = lifeRatio < (death ? 0.9f : revenge ? 0.8f : expertMode ? 0.65f : 0.5f); bool phase3 = lifeRatio < (death ? 0.6f : revenge ? 0.5f : expertMode ? 0.35f : 0.2f); - npc.frameCounter += 1D; - if (npc.frameCounter > 6D) + NPC.frameCounter += 1D; + if (NPC.frameCounter > 6D) { - npc.frameCounter = 0D; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; } if (phase3) { - if (npc.frame.Y < frameHeight * 8) + if (NPC.frame.Y < frameHeight * 8) { - npc.frame.Y = frameHeight * 8; + NPC.frame.Y = frameHeight * 8; } - if (npc.frame.Y > frameHeight * 11) + if (NPC.frame.Y > frameHeight * 11) { - npc.frame.Y = frameHeight * 8; + NPC.frame.Y = frameHeight * 8; } } else if (phase2) { - if (npc.frame.Y < frameHeight * 4) + if (NPC.frame.Y < frameHeight * 4) { - npc.frame.Y = frameHeight * 4; + NPC.frame.Y = frameHeight * 4; } - if (npc.frame.Y > frameHeight * 7) + if (NPC.frame.Y > frameHeight * 7) { - npc.frame.Y = frameHeight * 4; + NPC.frame.Y = frameHeight * 4; } } else { - if (npc.frame.Y > frameHeight * 3) + if (NPC.frame.Y > frameHeight * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } @@ -1151,24 +1152,24 @@ namespace CalamityMod.NPCs.Polterghast public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Ectoplasm, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, hitDirection, -1f, 0, default, 1f); + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 90; - npc.height = 90; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 90; + NPC.height = 90; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -1178,10 +1179,10 @@ namespace CalamityMod.NPCs.Polterghast } for (int num623 = 0; num623 < 60; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index fab966e77b..234d9b33be 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -18,45 +18,45 @@ namespace CalamityMod.NPCs.Polterghast public override void SetStaticDefaults() { DisplayName.SetDefault("Polterghast Hook"); - Main.npcFrameCount[npc.type] = 2; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 2; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 0; - npc.width = 40; - npc.height = 40; - npc.lifeMax = 50000; - npc.dontTakeDamage = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit34; - npc.DeathSound = SoundID.NPCDeath39; + NPC.damage = 0; + NPC.width = 40; + NPC.height = 40; + NPC.lifeMax = 50000; + NPC.dontTakeDamage = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit34; + NPC.DeathSound = SoundID.NPCDeath39; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(phase2); writer.Write(despawnTimer); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { phase2 = reader.ReadBoolean(); despawnTimer = reader.ReadInt32(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); } public override void AI() { // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0.3f, 0.3f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0f, 0.3f, 0.3f); // Bools bool speedBoost = false; @@ -68,8 +68,8 @@ namespace CalamityMod.NPCs.Polterghast // Despawn if Polter is gone if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.Polterghast if (despawnTimer <= 0) despawnBoost = true; - npc.localAI[0] -= 6f; + NPC.localAI[0] -= 6f; speedBoost = true; } else @@ -109,48 +109,48 @@ namespace CalamityMod.NPCs.Polterghast if (phase2) { // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); Movement(phase2, expertMode, revenge, death, speedBoost, despawnBoost, lifeRatio, tileEnrageMult, player); // Fire projectiles - Vector2 vector17 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num147 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector17.X; - float num148 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector17.Y; + Vector2 vector17 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num147 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - vector17.X; + float num148 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - vector17.Y; float num149 = (float)Math.Sqrt(num147 * num147 + num148 * num148); if (chargePhase) { - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; return; } - npc.ai[2] += 1f; - if (npc.ai[3] == 0f) + NPC.ai[2] += 1f; + if (NPC.ai[3] == 0f) { - if (npc.ai[2] > 120f) + if (NPC.ai[2] > 120f) { - npc.ai[2] = 0f; - npc.ai[3] = 1f; - npc.netUpdate = true; + NPC.ai[2] = 0f; + NPC.ai[3] = 1f; + NPC.netUpdate = true; } } else { - if (npc.ai[2] > 40f) - npc.ai[3] = 0f; + if (NPC.ai[2] > 40f) + NPC.ai[3] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == 20f) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == 20f) { float num151 = 10f * tileEnrageMult; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); num149 = num151 / num149; num147 *= num149; num148 *= num149; @@ -170,52 +170,52 @@ namespace CalamityMod.NPCs.Polterghast if (phase2) { - float num740 = Main.player[npc.target].Center.X - npc.Center.X; - float num741 = Main.player[npc.target].Center.Y - npc.Center.Y; - npc.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; + float num740 = Main.player[NPC.target].Center.X - NPC.Center.X; + float num741 = Main.player[NPC.target].Center.Y - NPC.Center.Y; + NPC.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; } if (Main.netMode == NetmodeID.MultiplayerClient) { - if (npc.ai[0] == 0f) - npc.ai[0] = (int)(npc.Center.X / 16f); - if (npc.ai[1] == 0f) - npc.ai[1] = (int)(npc.Center.X / 16f); + if (NPC.ai[0] == 0f) + NPC.ai[0] = (int)(NPC.Center.X / 16f); + if (NPC.ai[1] == 0f) + NPC.ai[1] = (int)(NPC.Center.X / 16f); } if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.ai[0] == 0f || npc.ai[1] == 0f) - npc.localAI[0] = 0f; + if (NPC.ai[0] == 0f || NPC.ai[1] == 0f) + NPC.localAI[0] = 0f; if (chargePhase) { - npc.localAI[0] -= 10f; + NPC.localAI[0] -= 10f; } else { float shootBoost = death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); - npc.localAI[0] -= 1f + shootBoost * tileEnrageMult; + NPC.localAI[0] -= 1f + shootBoost * tileEnrageMult; if (expertMode) - npc.localAI[0] -= Vector2.Distance(npc.Center, player.Center) * 0.002f; + NPC.localAI[0] -= Vector2.Distance(NPC.Center, player.Center) * 0.002f; if (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] >= 300f) - npc.localAI[0] -= 3f; + NPC.localAI[0] -= 3f; if (speedBoost) - npc.localAI[0] -= 6f; + NPC.localAI[0] -= 6f; } - if (!despawnBoost && npc.localAI[0] <= 0f && npc.ai[0] != 0f) + if (!despawnBoost && NPC.localAI[0] <= 0f && NPC.ai[0] != 0f) { for (int num763 = 0; num763 < Main.maxNPCs; num763++) { - if (num763 != npc.whoAmI && Main.npc[num763].active && Main.npc[num763].type == npc.type && (Main.npc[num763].velocity.X != 0f || Main.npc[num763].velocity.Y != 0f)) - npc.localAI[0] = 180f; + if (num763 != NPC.whoAmI && Main.npc[num763].active && Main.npc[num763].type == NPC.type && (Main.npc[num763].velocity.X != 0f || Main.npc[num763].velocity.Y != 0f)) + NPC.localAI[0] = 180f; } } - if (npc.localAI[0] <= 0f) + if (NPC.localAI[0] <= 0f) { - npc.localAI[0] = 450f; + NPC.localAI[0] = 450f; bool flag50 = false; int num764 = 0; while (!flag50 && num764 <= 1000) @@ -223,7 +223,7 @@ namespace CalamityMod.NPCs.Polterghast num764++; int num765 = (int)(player.Center.X / 16f); int num766 = (int)(player.Center.Y / 16f); - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { num765 = (int)((player.Center.X + Main.npc[CalamityGlobalNPC.ghostBoss].Center.X) / 32f); num766 = (int)((player.Center.Y + Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y) / 32f); @@ -239,13 +239,13 @@ namespace CalamityMod.NPCs.Polterghast int num769 = num766 + Main.rand.Next(-num767, num767 + 1); try { - if (WorldGen.SolidTile(num768, num769) || Main.tile[num768, num769].wall > 0 || chargePhase) + if (WorldGen.SolidTile(num768, num769) || Main.tile[num768, num769].WallType > 0 || chargePhase) { flag50 = true; - npc.ai[0] = num768; - npc.ai[1] = num769; - npc.localAI[1] = Vector2.Distance(npc.Center, player.Center) * 0.01f; - npc.netUpdate = true; + NPC.ai[0] = num768; + NPC.ai[1] = num769; + NPC.localAI[1] = Vector2.Distance(NPC.Center, player.Center) * 0.01f; + NPC.netUpdate = true; } } catch { @@ -254,12 +254,12 @@ namespace CalamityMod.NPCs.Polterghast } } - if (npc.ai[0] > 0f && npc.ai[1] > 0f) + if (NPC.ai[0] > 0f && NPC.ai[1] > 0f) { float velocityBoost = death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); float velocity = (8f + velocityBoost) * tileEnrageMult; if (expertMode) - velocity += npc.localAI[1]; + velocity += NPC.localAI[1]; if (revenge) velocity += 1f; if (speedBoost) @@ -267,28 +267,28 @@ namespace CalamityMod.NPCs.Polterghast if (despawnBoost) velocity *= 2f; - Vector2 vector95 = new Vector2(npc.Center.X, npc.Center.Y); - float num773 = npc.ai[0] * 16f - 8f - vector95.X; - float num774 = npc.ai[1] * 16f - 8f - vector95.Y; + Vector2 vector95 = new Vector2(NPC.Center.X, NPC.Center.Y); + float num773 = NPC.ai[0] * 16f - 8f - vector95.X; + float num774 = NPC.ai[1] * 16f - 8f - vector95.Y; float num775 = (float)Math.Sqrt(num773 * num773 + num774 * num774); if (num775 < 12f + velocity) { - npc.velocity.X = num773; - npc.velocity.Y = num774; + NPC.velocity.X = num773; + NPC.velocity.Y = num774; } else { num775 = velocity / num775; - npc.velocity.X = num773 * num775; - npc.velocity.Y = num774 * num775; + NPC.velocity.X = num773 * num775; + NPC.velocity.Y = num774 * num775; } if (!phase2) { - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector96 = new Vector2(NPC.Center.X, NPC.Center.Y); float num776 = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - vector96.X; float num777 = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - vector96.Y; - npc.rotation = (float)Math.Atan2(num777, num776) - 1.57f; + NPC.rotation = (float)Math.Atan2(num777, num776) - 1.57f; } } } @@ -298,7 +298,7 @@ namespace CalamityMod.NPCs.Polterghast Color lightRed = new Color(255, 100, 100, 255); if (Main.npc[CalamityGlobalNPC.ghostBoss].active && !phase2) { - Vector2 center = npc.Center; + Vector2 center = NPC.Center; float bossCenterX = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - center.X; float bossCenterY = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - center.Y; float rotation2 = (float)Math.Atan2(bossCenterY, bossCenterX) - 1.57f; @@ -325,18 +325,18 @@ namespace CalamityMod.NPCs.Polterghast if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > 300f) color2 = Color.Lerp(color2, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - 300f) / 120f, 0f, 1f)); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterghastChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterghastChain").Width, chainWidth)), color2, rotation2, - new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterghastChain").Width * 0.5f, ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterghastChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), + new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Width, chainWidth)), color2, rotation2, + new Vector2(ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Width * 0.5f, ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); } } SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -347,21 +347,21 @@ namespace CalamityMod.NPCs.Polterghast { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterghastHookGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterghastHookGlow"); Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > 300f) @@ -373,16 +373,16 @@ namespace CalamityMod.NPCs.Polterghast { Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); - color41 = npc.GetAlpha(color41); + color41 = NPC.GetAlpha(color41); color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -391,48 +391,48 @@ namespace CalamityMod.NPCs.Polterghast { if (phase2) { - if (npc.ai[3] == 0f) + if (NPC.ai[3] == 0f) { - if (npc.frame.Y < 1) + if (NPC.frame.Y < 1) { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 4.0) { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; } } } - else if (npc.frame.Y > 0) + else if (NPC.frame.Y > 0) { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 4.0) { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y - frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y - frameHeight; } } return; } - if (npc.velocity.X == 0f && npc.velocity.Y == 0f) + if (NPC.velocity.X == 0f && NPC.velocity.Y == 0f) { - if (npc.frame.Y < 1) + if (NPC.frame.Y < 1) { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 4.0) { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; } } } - else if (npc.frame.Y > 0) + else if (NPC.frame.Y > 0) { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 4.0) { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y - frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y - frameHeight; } } } @@ -452,13 +452,13 @@ namespace CalamityMod.NPCs.Polterghast { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 180, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 180, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs index 9d75b25728..35c054f671 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs @@ -16,6 +16,7 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Events; +using Terraria.Audio; namespace CalamityMod.NPCs.ProfanedGuardians { @@ -29,36 +30,36 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void SetStaticDefaults() { DisplayName.SetDefault("Guardian Commander"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 20f; - npc.aiStyle = -1; - npc.GetNPCDamage(); - npc.width = 100; - npc.height = 80; - npc.defense = 40; - npc.DR_NERD(0.3f); - npc.LifeMaxNERB(56250, 67500, 165000); // Old HP - 102500, 112500 + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 20f; + NPC.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 100; + NPC.height = 80; + NPC.defense = 40; + NPC.DR_NERD(0.3f); + NPC.LifeMaxNERB(56250, 67500, 165000); // Old HP - 102500, 112500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; aiType = -1; - npc.boss = true; + NPC.boss = true; music = CalamityMod.Instance.GetMusicFromMusicMod("Guardians") ?? MusicID.Boss1; - npc.value = Item.buyPrice(1, 0, 0, 0); - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.value = Item.buyPrice(1, 0, 0, 0); + NPC.HitSound = SoundID.NPCHit52; + NPC.DeathSound = SoundID.NPCDeath55; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) @@ -77,15 +78,15 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - CalamityGlobalNPC.doughnutBoss = npc.whoAmI; + CalamityGlobalNPC.doughnutBoss = NPC.whoAmI; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; @@ -93,12 +94,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; - Vector2 vectorCenter = npc.Center; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[1] == 0f) + Vector2 vectorCenter = NPC.Center; + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[1] == 0f) { - npc.localAI[1] = 1f; + NPC.localAI[1] = 1f; NPC.NewNPC((int)vectorCenter.X, (int)vectorCenter.Y, ModContent.NPCType()); NPC.NewNPC((int)vectorCenter.X, (int)vectorCenter.Y, ModContent.NPCType()); } @@ -119,15 +120,15 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Defense if (defenderAlive) { - npc.Calamity().DR = 0.9f; - npc.Calamity().unbreakableDR = true; - npc.Calamity().CurrentlyIncreasingDefenseOrDR = true; + NPC.Calamity().DR = 0.9f; + NPC.Calamity().unbreakableDR = true; + NPC.Calamity().CurrentlyIncreasingDefenseOrDR = true; } else { - npc.Calamity().DR = 0.3f; - npc.Calamity().unbreakableDR = false; - npc.Calamity().CurrentlyIncreasingDefenseOrDR = false; + NPC.Calamity().DR = 0.3f; + NPC.Calamity().unbreakableDR = false; + NPC.Calamity().CurrentlyIncreasingDefenseOrDR = false; } // Healing @@ -140,58 +141,58 @@ namespace CalamityMod.NPCs.ProfanedGuardians healTimer = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { - int healAmt = npc.lifeMax / 20; - if (healAmt > npc.lifeMax - npc.life) - healAmt = npc.lifeMax - npc.life; + int healAmt = NPC.lifeMax / 20; + if (healAmt > NPC.lifeMax - NPC.life) + healAmt = NPC.lifeMax - NPC.life; if (healAmt > 0) { - npc.life += healAmt; - npc.HealEffect(healAmt, true); - npc.netUpdate = true; + NPC.life += healAmt; + NPC.HealEffect(healAmt, true); + NPC.netUpdate = true; } } } } // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; if (!Main.dayTime || !player.active || player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (!Main.dayTime || !player.active || player.dead) { - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.1f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; - if (npc.timeLeft > 60) - npc.timeLeft = 60; + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; - if (npc.ai[0] != 0f) + if (NPC.ai[0] != 0f) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } return; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; // Become immune over time if target isn't in hell or hallow bool isHoly = player.ZoneHoly; @@ -201,7 +202,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (biomeEnrageTimer > 0) biomeEnrageTimer--; else - npc.Calamity().CurrentlyEnraged = true; + NPC.Calamity().CurrentlyEnraged = true; } else biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; @@ -223,13 +224,13 @@ namespace CalamityMod.NPCs.ProfanedGuardians float num1006 = 0.111111117f * inertia; - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - if (Math.Abs(npc.Center.X - player.Center.X) > 10f) + if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { float playerLocation = vectorCenter.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; } float velocity = (malice || biomeEnraged) ? 20f : death ? 18f : revenge ? 17f : expertMode ? 16f : 14f; @@ -239,10 +240,10 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (defenderAlive) phaseGateValue *= 1.25f; - if (npc.ai[3] < phaseGateValue || healerAlive) + if (NPC.ai[3] < phaseGateValue || healerAlive) { - npc.velocity = (npc.velocity * (inertia - 1f) + targetVector) / inertia; - npc.ai[3] += 1f; + NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector) / inertia; + NPC.ai[3] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -250,11 +251,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (phase1) divisor *= 2f; - if (npc.ai[3] % divisor == 0f) + if (NPC.ai[3] % divisor == 0f) { - Main.PlaySound(SoundID.Item20, npc.position); + SoundEngine.PlaySound(SoundID.Item20, NPC.position); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Vector2 projectileVelocity = Vector2.Normalize(player.Center - vectorCenter); int numProj = death ? 3 : 2; @@ -270,64 +271,64 @@ namespace CalamityMod.NPCs.ProfanedGuardians { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); Vector2 normalizedPerturbedSpeed = Vector2.Normalize(perturbedSpeed); - Projectile.NewProjectile(vectorCenter, normalizedPerturbedSpeed * npc.velocity.Length() * 1.25f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(vectorCenter, normalizedPerturbedSpeed * NPC.velocity.Length() * 1.25f, type, damage, 0f, Main.myPlayer, 2f, 0f); } } } } else { - npc.ai[0] = 1f; - npc.ai[2] = targetVector.X; - npc.ai[3] = targetVector.Y; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[2] = targetVector.X; + NPC.ai[3] = targetVector.Y; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - if (Math.Abs(npc.Center.X - player.Center.X) > 10f) + if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { float playerLocation = vectorCenter.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; } - npc.velocity *= 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 12f) + NPC.velocity *= 0.8f; + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 12f) { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]); + NPC.ai[0] = 2f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + Vector2 velocity = new Vector2(NPC.ai[2], NPC.ai[3]); velocity.Normalize(); velocity *= (malice || biomeEnraged) ? 39f : death ? 33f : revenge ? 30f : expertMode ? 27f : 21f; if (defenderAlive) velocity *= 0.8f; - npc.velocity = velocity; + NPC.velocity = velocity; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - if (Math.Sign(npc.velocity.X) != 0) - npc.spriteDirection = -Math.Sign(npc.velocity.X); - npc.spriteDirection = Math.Sign(npc.velocity.X); + if (Math.Sign(NPC.velocity.X) != 0) + NPC.spriteDirection = -Math.Sign(NPC.velocity.X); + NPC.spriteDirection = Math.Sign(NPC.velocity.X); if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += 1f; + NPC.localAI[0] += 1f; float projectileGateValue = (malice || biomeEnraged) ? 30f : death ? 35f : revenge ? 37f : expertMode ? 40f : 45f; - if (npc.localAI[0] >= projectileGateValue && Vector2.Distance(vectorCenter, player.Center) > 160f) + if (NPC.localAI[0] >= projectileGateValue && Vector2.Distance(vectorCenter, player.Center) > 160f) { - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; - Main.PlaySound(SoundID.Item20, npc.position); + SoundEngine.PlaySound(SoundID.Item20, NPC.position); int totalProjectiles = phase1 ? 6 : 10; float velocity = phase1 ? 5f : 6f; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); switch (spearType) { @@ -352,7 +353,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians for (int i = 0; i < totalProjectiles; i++) { Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); - Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, 0f); } spearType++; @@ -361,58 +362,58 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } - npc.ai[1] += 1f; + NPC.ai[1] += 1f; float phaseGateValue = (malice || biomeEnraged) ? 60f : death ? 70f : revenge ? 75f : expertMode ? 80f : 90f; - if (npc.ai[1] >= phaseGateValue) + if (NPC.ai[1] >= phaseGateValue) { - npc.ai[0] = 3f; - npc.ai[1] = 24f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.velocity /= 2f; - npc.netUpdate = true; + NPC.ai[0] = 3f; + NPC.ai[1] = 24f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.velocity /= 2f; + NPC.netUpdate = true; } else { Vector2 targetVector = player.Center - vectorCenter; targetVector.Normalize(); if (targetVector.HasNaNs()) - targetVector = new Vector2(npc.direction, 0f); + targetVector = new Vector2(NPC.direction, 0f); - npc.velocity = (npc.velocity * (inertia - 1f) + targetVector * (npc.velocity.Length() + num1006)) / inertia; + NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + num1006)) / inertia; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - if (Math.Sign(npc.velocity.X) != 0) - npc.spriteDirection = -Math.Sign(npc.velocity.X); - npc.spriteDirection = Math.Sign(npc.velocity.X); + if (Math.Sign(NPC.velocity.X) != 0) + NPC.spriteDirection = -Math.Sign(NPC.velocity.X); + NPC.spriteDirection = Math.Sign(NPC.velocity.X); - npc.ai[1] -= 1f; - if (npc.ai[1] <= 0f) + NPC.ai[1] -= 1f; + if (NPC.ai[1] <= 0f) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; - if (npc.ai[0] == 2f) + if (NPC.ai[0] == 2f) num153 = 10; if (CalamityConfig.Instance.Afterimages) @@ -421,21 +422,21 @@ namespace CalamityMod.NPCs.ProfanedGuardians { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBossGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBossGlow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -444,16 +445,16 @@ namespace CalamityMod.NPCs.ProfanedGuardians { Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); - color41 = npc.GetAlpha(color41); + color41 = NPC.GetAlpha(color41); color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -472,15 +473,15 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); // Profaned Guardians have no actual drops and no treasure bag - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedGuardians); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedGuardians); // Mark the Profaned Guardians as dead CalamityWorld.downedGuardians = true; @@ -494,25 +495,25 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4"), 1f); for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs index 7ce6ad9e28..cd138fcb5e 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs @@ -11,6 +11,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.ProfanedGuardians { @@ -23,34 +24,34 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void SetStaticDefaults() { DisplayName.SetDefault("Guardian Defender"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 3f; - npc.aiStyle = -1; - npc.GetNPCDamage(); - npc.width = 100; - npc.height = 80; - npc.defense = 50; - npc.DR_NERD(0.4f); - npc.LifeMaxNERB(43750, 52500, 30000); // Old HP - 40000, 50000 + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 3f; + NPC.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 100; + NPC.height = 80; + NPC.defense = 50; + NPC.DR_NERD(0.4f); + NPC.LifeMaxNERB(43750, 52500, 30000); // Old HP - 40000, 50000 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; aiType = -1; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.HitSound = SoundID.NPCHit52; + NPC.DeathSound = SoundID.NPCDeath55; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) @@ -67,20 +68,20 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - CalamityGlobalNPC.doughnutBossDefender = npc.whoAmI; + CalamityGlobalNPC.doughnutBossDefender = NPC.whoAmI; if (CalamityGlobalNPC.doughnutBoss < 0 || !Main.npc[CalamityGlobalNPC.doughnutBoss].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } @@ -101,32 +102,32 @@ namespace CalamityMod.NPCs.ProfanedGuardians healTimer = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { - int healAmt = npc.lifeMax / 20; - if (healAmt > npc.lifeMax - npc.life) - healAmt = npc.lifeMax - npc.life; + int healAmt = NPC.lifeMax / 20; + if (healAmt > NPC.lifeMax - NPC.life) + healAmt = NPC.lifeMax - NPC.life; if (healAmt > 0) { - npc.life += healAmt; - npc.HealEffect(healAmt, true); - npc.netUpdate = true; + NPC.life += healAmt; + NPC.HealEffect(healAmt, true); + NPC.netUpdate = true; } } } } // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); Player player = Main.player[Main.npc[CalamityGlobalNPC.doughnutBoss].target]; - if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; @@ -141,46 +142,46 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (biomeEnrageTimer > 0) biomeEnrageTimer--; else - npc.Calamity().CurrentlyEnraged = true; + NPC.Calamity().CurrentlyEnraged = true; } else biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; bool biomeEnraged = biomeEnrageTimer <= 0; - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - if (Math.Abs(npc.Center.X - player.Center.X) > 10f) + if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; } - npc.ai[3] += 1f; + NPC.ai[3] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { float divisor = (malice || biomeEnraged) ? 30f : death ? 40f : revenge ? 45f : expertMode ? 50f : 60f; - if (npc.ai[3] % divisor == 0f) + if (NPC.ai[3] % divisor == 0f) { - Main.PlaySound(SoundID.Item20, npc.position); + SoundEngine.PlaySound(SoundID.Item20, NPC.position); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center, Vector2.Normalize(player.Center - npc.Center) * npc.velocity.Length() * 1.5f, type, damage, 0f, Main.myPlayer, 2f, 0f); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * NPC.velocity.Length() * 1.5f, type, damage, 0f, Main.myPlayer, 2f, 0f); } } - Vector2 targetVector = player.Center - npc.Center; + Vector2 targetVector = player.Center - NPC.Center; float phaseGateValue = (malice || biomeEnraged) ? 60f : death ? 80f : revenge ? 90f : expertMode ? 100f : 120f; - if (npc.ai[3] >= phaseGateValue && !healerAlive) + if (NPC.ai[3] >= phaseGateValue && !healerAlive) { - npc.ai[0] = 1f; - npc.ai[2] = targetVector.X; - npc.ai[3] = targetVector.Y; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[2] = targetVector.X; + NPC.ai[3] = targetVector.Y; + NPC.netUpdate = true; } - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector96 = new Vector2(NPC.Center.X, NPC.Center.Y); float num784 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector96.X; float num785 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector96.Y; float num786 = (float)Math.Sqrt(num784 * num784 + num785 * num785); @@ -190,119 +191,119 @@ namespace CalamityMod.NPCs.ProfanedGuardians num786 = (Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 5f) / num786; num784 *= num786; num785 *= num786; - npc.velocity.X = (npc.velocity.X * 25f + num784) / 26f; - npc.velocity.Y = (npc.velocity.Y * 25f + num785) / 26f; + NPC.velocity.X = (NPC.velocity.X * 25f + num784) / 26f; + NPC.velocity.Y = (NPC.velocity.Y * 25f + num785) / 26f; return; } - if (npc.velocity.Length() < Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 5f) - npc.velocity *= 1.1f; + if (NPC.velocity.Length() < Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 5f) + NPC.velocity *= 1.1f; } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - if (Math.Abs(npc.Center.X - player.Center.X) > 10f) + if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; } - npc.velocity *= 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 18f) + NPC.velocity *= 0.8f; + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 18f) { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]); + NPC.ai[0] = 2f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + Vector2 velocity = new Vector2(NPC.ai[2], NPC.ai[3]); velocity.Normalize(); velocity *= (malice || biomeEnraged) ? 32f : death ? 27f : revenge ? 24.5f : expertMode ? 22f : 17f; - npc.velocity = velocity; + NPC.velocity = velocity; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - if (Math.Sign(npc.velocity.X) != 0) - npc.spriteDirection = -Math.Sign(npc.velocity.X); - npc.spriteDirection = Math.Sign(npc.velocity.X); + if (Math.Sign(NPC.velocity.X) != 0) + NPC.spriteDirection = -Math.Sign(NPC.velocity.X); + NPC.spriteDirection = Math.Sign(NPC.velocity.X); if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += 1f; + NPC.localAI[0] += 1f; float projectileGateValue = (malice || biomeEnraged) ? 30f : death ? 40f : revenge ? 45f : expertMode ? 50f : 60f; - if (npc.localAI[0] >= projectileGateValue && Vector2.Distance(npc.Center, player.Center) > 160f) + if (NPC.localAI[0] >= projectileGateValue && Vector2.Distance(NPC.Center, player.Center) > 160f) { - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; - Main.PlaySound(SoundID.Item20, npc.position); + SoundEngine.PlaySound(SoundID.Item20, NPC.position); float velocity = 5f; int totalProjectiles = 6; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); for (int i = 0; i < totalProjectiles; i++) { Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); - Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.Center, vector255, type, damage, 0f, Main.myPlayer); } } } - npc.ai[1] += 1f; + NPC.ai[1] += 1f; float phaseGateValue = (malice || biomeEnraged) ? 60f : death ? 80f : revenge ? 90f : expertMode ? 100f : 120f; - if (npc.ai[1] >= phaseGateValue) + if (NPC.ai[1] >= phaseGateValue) { - npc.ai[0] = 3f; - npc.ai[1] = 24f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.velocity /= 2f; - npc.netUpdate = true; + NPC.ai[0] = 3f; + NPC.ai[1] = 24f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.velocity /= 2f; + NPC.netUpdate = true; } else { - Vector2 targetVector = player.Center - npc.Center; + Vector2 targetVector = player.Center - NPC.Center; targetVector.Normalize(); if (targetVector.HasNaNs()) - targetVector = new Vector2(npc.direction, 0f); + targetVector = new Vector2(NPC.direction, 0f); float inertia = (malice || biomeEnraged) ? 35f : death ? 40f : revenge ? 42f : expertMode ? 45f : 50f; float num1006 = 0.111111117f * inertia; - npc.velocity = (npc.velocity * (inertia - 1f) + targetVector * (npc.velocity.Length() + num1006)) / inertia; + NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + num1006)) / inertia; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - if (Math.Sign(npc.velocity.X) != 0) - npc.spriteDirection = -Math.Sign(npc.velocity.X); - npc.spriteDirection = Math.Sign(npc.velocity.X); + if (Math.Sign(NPC.velocity.X) != 0) + NPC.spriteDirection = -Math.Sign(NPC.velocity.X); + NPC.spriteDirection = Math.Sign(NPC.velocity.X); - npc.ai[1] -= 1f; - if (npc.ai[1] <= 0f) + NPC.ai[1] -= 1f; + if (NPC.ai[1] <= 0f) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; - if (npc.ai[0] == 2f) + if (NPC.ai[0] == 2f) num153 = 10; if (CalamityConfig.Instance.Afterimages) @@ -311,21 +312,21 @@ namespace CalamityMod.NPCs.ProfanedGuardians { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBoss2Glow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBoss2Glow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -334,16 +335,16 @@ namespace CalamityMod.NPCs.ProfanedGuardians { Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); - color41 = npc.GetAlpha(color41); + color41 = NPC.GetAlpha(color41); color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -356,7 +357,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 4); } public override void BossLoot(ref string name, ref int potionType) @@ -374,16 +375,16 @@ namespace CalamityMod.NPCs.ProfanedGuardians { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3"), 1f); for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs index 88617ee7df..09b060d3e7 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs @@ -20,34 +20,34 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void SetStaticDefaults() { DisplayName.SetDefault("Guardian Healer"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 3f; - npc.aiStyle = -1; - npc.GetNPCDamage(); - npc.width = 100; - npc.height = 80; - npc.defense = 30; - npc.DR_NERD(0.2f); - npc.LifeMaxNERB(25000, 30000, 20000); // Old HP - 25000, 35000 + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 3f; + NPC.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 100; + NPC.height = 80; + NPC.defense = 30; + NPC.DR_NERD(0.2f); + NPC.LifeMaxNERB(25000, 30000, 20000); // Old HP - 25000, 35000 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; aiType = -1; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.HitSound = SoundID.NPCHit52; + NPC.DeathSound = SoundID.NPCDeath55; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) @@ -62,35 +62,35 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - CalamityGlobalNPC.doughnutBossHealer = npc.whoAmI; + CalamityGlobalNPC.doughnutBossHealer = NPC.whoAmI; if (CalamityGlobalNPC.doughnutBoss < 0 || !Main.npc[CalamityGlobalNPC.doughnutBoss].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); Player player = Main.player[Main.npc[CalamityGlobalNPC.doughnutBoss].target]; - if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; bool isHoly = player.ZoneHoly; bool isHell = player.ZoneUnderworldHeight; @@ -101,19 +101,19 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (biomeEnrageTimer > 0) biomeEnrageTimer--; else - npc.Calamity().CurrentlyEnraged = true; + NPC.Calamity().CurrentlyEnraged = true; } else biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - if (Math.Abs(npc.Center.X - player.Center.X) > 10f) + if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; } - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector96 = new Vector2(NPC.Center.X, NPC.Center.Y); float num784 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector96.X; float num785 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector96.Y; float num786 = (float)Math.Sqrt(num784 * num784 + num785 * num785); @@ -123,24 +123,24 @@ namespace CalamityMod.NPCs.ProfanedGuardians num786 = (Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 3f) / num786; num784 *= num786; num785 *= num786; - npc.velocity.X = (npc.velocity.X * 25f + num784) / 26f; - npc.velocity.Y = (npc.velocity.Y * 25f + num785) / 26f; + NPC.velocity.X = (NPC.velocity.X * 25f + num784) / 26f; + NPC.velocity.Y = (NPC.velocity.Y * 25f + num785) / 26f; return; } - if (npc.velocity.Length() < Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 3f) - npc.velocity *= 1.1f; + if (NPC.velocity.Length() < Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 3f) + NPC.velocity *= 1.1f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Texture2D texture2D16 = ModContent.GetTexture("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBoss3Glow2"); - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBoss3Glow2"); + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -151,21 +151,21 @@ namespace CalamityMod.NPCs.ProfanedGuardians { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBoss3Glow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBoss3Glow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); Color color42 = Color.Lerp(Color.White, Color.Violet, 0.5f); @@ -175,24 +175,24 @@ namespace CalamityMod.NPCs.ProfanedGuardians { Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); - color41 = npc.GetAlpha(color41); + color41 = NPC.GetAlpha(color41); color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); Color color43 = color42; color43 = Color.Lerp(color43, color36, amount9); - color43 = npc.GetAlpha(color43); + color43 = NPC.GetAlpha(color43); color43 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture2D16, vector44, npc.frame, color43, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -205,7 +205,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 4); } public override void BossLoot(ref string name, ref int potionType) @@ -223,18 +223,18 @@ namespace CalamityMod.NPCs.ProfanedGuardians { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5"), 1f); for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 648ac0ea15..99d0d6f22e 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -18,58 +18,58 @@ namespace CalamityMod.NPCs.Providence public override void SetStaticDefaults() { DisplayName.SetDefault("Providence Defender"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 1f; - npc.aiStyle = -1; - npc.GetNPCDamage(); - npc.width = 100; - npc.height = 80; - npc.defense = 50; - npc.DR_NERD(0.4f); - npc.lifeMax = 18750; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 1f; + NPC.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 100; + NPC.height = 80; + NPC.defense = 50; + NPC.DR_NERD(0.4f); + NPC.lifeMax = 18750; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 30000; + NPC.lifeMax = 30000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; aiType = -1; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.HitSound = SoundID.NPCHit52; + NPC.DeathSound = SoundID.NPCDeath55; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - npc.damage = 0; + NPC.damage = 0; - CalamityGlobalNPC.holyBossDefender = npc.whoAmI; + CalamityGlobalNPC.holyBossDefender = NPC.whoAmI; if (CalamityGlobalNPC.holyBoss < 0 || !Main.npc[CalamityGlobalNPC.holyBoss].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } @@ -77,32 +77,32 @@ namespace CalamityMod.NPCs.Providence if (start) { for (int d = 0; d < 30; d++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); - npc.ai[1] = npc.ai[0]; + NPC.ai[1] = NPC.ai[0]; start = false; } - float playerLocation = npc.Center.X - Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + float playerLocation = NPC.Center.X - Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target].Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; - double deg = npc.ai[1]; + double deg = NPC.ai[1]; double rad = deg * (Math.PI / 180); double dist = 400; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 1f; + NPC.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - NPC.width / 2; + NPC.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - NPC.height / 2; + NPC.ai[1] += 1f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -113,21 +113,21 @@ namespace CalamityMod.NPCs.Providence { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBoss2Glow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBoss2Glow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -136,16 +136,16 @@ namespace CalamityMod.NPCs.Providence { Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); - color41 = npc.GetAlpha(color41); + color41 = NPC.GetAlpha(color41); color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -156,7 +156,7 @@ namespace CalamityMod.NPCs.Providence { int heartAmt = Main.rand.Next(3) + 3; for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } } @@ -165,16 +165,16 @@ namespace CalamityMod.NPCs.Providence public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3"), 1f); for (int k = 0; k < 30; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index 4ab259ab37..7fa768a695 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -18,57 +18,57 @@ namespace CalamityMod.NPCs.Providence public override void SetStaticDefaults() { DisplayName.SetDefault("Providence Healer"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.npcSlots = 1f; - npc.aiStyle = -1; - npc.damage = 20; - npc.width = 100; - npc.height = 80; - npc.defense = 30; - npc.DR_NERD(0.2f); - npc.lifeMax = 15000; + NPC.npcSlots = 1f; + NPC.aiStyle = -1; + NPC.damage = 20; + NPC.width = 100; + NPC.height = 80; + NPC.defense = 30; + NPC.DR_NERD(0.2f); + NPC.lifeMax = 15000; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 20000; + NPC.lifeMax = 20000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; aiType = -1; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.HitSound = SoundID.NPCHit52; + NPC.DeathSound = SoundID.NPCDeath55; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - npc.damage = 0; + NPC.damage = 0; - CalamityGlobalNPC.holyBossHealer = npc.whoAmI; + CalamityGlobalNPC.holyBossHealer = NPC.whoAmI; if (CalamityGlobalNPC.holyBoss < 0 || !Main.npc[CalamityGlobalNPC.holyBoss].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } @@ -76,33 +76,33 @@ namespace CalamityMod.NPCs.Providence if (start) { for (int d = 0; d < 30; d++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); - npc.ai[1] = npc.ai[0]; + NPC.ai[1] = NPC.ai[0]; start = false; } - float playerLocation = npc.Center.X - Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + float playerLocation = NPC.Center.X - Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target].Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; - double deg = npc.ai[1]; + double deg = NPC.ai[1]; double rad = deg * (Math.PI / 180); double dist = 400; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 1f; + NPC.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - NPC.width / 2; + NPC.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - NPC.height / 2; + NPC.ai[1] += 1f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Texture2D texture2D16 = ModContent.GetTexture("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBoss3Glow2"); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBoss3Glow2"); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -113,21 +113,21 @@ namespace CalamityMod.NPCs.Providence { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBoss3Glow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBoss3Glow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); Color color42 = Color.Lerp(Color.White, Color.Violet, 0.5f); @@ -137,24 +137,24 @@ namespace CalamityMod.NPCs.Providence { Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); - color41 = npc.GetAlpha(color41); + color41 = NPC.GetAlpha(color41); color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); Color color43 = color42; color43 = Color.Lerp(color43, color36, amount9); - color43 = npc.GetAlpha(color43); + color43 = NPC.GetAlpha(color43); color43 *= (float)(num153 - num163) / 15f; - spriteBatch.Draw(texture2D16, vector44, npc.frame, color43, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D16, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -165,7 +165,7 @@ namespace CalamityMod.NPCs.Providence { int heartAmt = Main.rand.Next(3) + 3; for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } } @@ -174,18 +174,18 @@ namespace CalamityMod.NPCs.Providence public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5"), 1f); for (int k = 0; k < 50; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index a763c45727..38daf8ba81 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -18,58 +18,58 @@ namespace CalamityMod.NPCs.Providence public override void SetStaticDefaults() { DisplayName.SetDefault("Providence Offense"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 1f; - npc.aiStyle = -1; - npc.GetNPCDamage(); - npc.width = 100; - npc.height = 80; - npc.defense = 40; - npc.DR_NERD(0.3f); - npc.lifeMax = 31875; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 1f; + NPC.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 100; + NPC.height = 80; + NPC.defense = 40; + NPC.DR_NERD(0.3f); + NPC.lifeMax = 31875; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 40000; + NPC.lifeMax = 40000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; aiType = -1; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.HitSound = SoundID.NPCHit52; + NPC.DeathSound = SoundID.NPCDeath55; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - npc.damage = 0; + NPC.damage = 0; - CalamityGlobalNPC.holyBossAttacker = npc.whoAmI; + CalamityGlobalNPC.holyBossAttacker = NPC.whoAmI; if (CalamityGlobalNPC.holyBoss < 0 || !Main.npc[CalamityGlobalNPC.holyBoss].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } @@ -77,36 +77,36 @@ namespace CalamityMod.NPCs.Providence if (start) { for (int d = 0; d < 30; d++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); - npc.ai[1] = npc.ai[0]; + NPC.ai[1] = NPC.ai[0]; start = false; } - float playerLocation = npc.Center.X - Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; + float playerLocation = NPC.Center.X - Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target].Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; - double deg = npc.ai[1]; + double deg = NPC.ai[1]; double rad = deg * (Math.PI / 180); double dist = 400; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 1f; + NPC.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - NPC.width / 2; + NPC.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - NPC.height / 2; + NPC.ai[1] += 1f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; - if (npc.ai[0] == 2f) + if (NPC.ai[0] == 2f) num153 = 10; if (CalamityConfig.Instance.Afterimages) @@ -115,21 +115,21 @@ namespace CalamityMod.NPCs.Providence { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBossGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianBossGlow"); Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -138,16 +138,16 @@ namespace CalamityMod.NPCs.Providence { Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); - color41 = npc.GetAlpha(color41); + color41 = NPC.GetAlpha(color41); color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -158,7 +158,7 @@ namespace CalamityMod.NPCs.Providence { int heartAmt = Main.rand.Next(3) + 3; for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } } @@ -167,17 +167,17 @@ namespace CalamityMod.NPCs.Providence public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4"), 1f); for (int k = 0; k < 30; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 73caffc915..0f0c91b9e9 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -33,6 +33,7 @@ using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Providence { @@ -54,8 +55,8 @@ namespace CalamityMod.NPCs.Providence private float AIState { - get => npc.ai[0]; - set => npc.ai[0] = value; + get => NPC.ai[0]; + set => NPC.ai[0] = value; } private bool text = false; @@ -78,37 +79,37 @@ namespace CalamityMod.NPCs.Providence public override void SetStaticDefaults() { DisplayName.SetDefault("Providence, the Profaned Goddess"); - Main.npcFrameCount[npc.type] = 3; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 3; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.npcSlots = 36f; - npc.damage = 100; - npc.width = 600; - npc.height = 450; - npc.defense = 50; - npc.DR_NERD(normalDR); - npc.LifeMaxNERB(312500, 375000, 1250000); // Old HP - 440000, 500000 + NPC.npcSlots = 36f; + NPC.damage = 100; + NPC.width = 600; + NPC.height = 450; + NPC.defense = 50; + NPC.DR_NERD(normalDR); + NPC.LifeMaxNERB(312500, 375000, 1250000); // Old HP - 440000, 500000 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(3, 0, 0, 0); - npc.boss = true; - npc.Opacity = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; + NPC.value = Item.buyPrice(3, 0, 0, 0); + NPC.boss = true; + NPC.Opacity = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.netAlways = true; music = CalamityMod.Instance.GetMusicFromMusicMod("Providence") ?? MusicID.LunarBoss; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/ProvidenceDeath"); + NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/ProvidenceDeath"); bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) @@ -121,14 +122,14 @@ namespace CalamityMod.NPCs.Providence writer.Write(frameUsed); writer.Write(healTimer); writer.Write(flightPath); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - writer.Write(npc.canGhostHeal); - writer.Write(npc.localAI[2]); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.chaseable); + writer.Write(NPC.canGhostHeal); + writer.Write(NPC.localAI[2]); writer.Write(Dying); writer.Write(DeathAnimationTimer); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -142,45 +143,45 @@ namespace CalamityMod.NPCs.Providence frameUsed = reader.ReadInt32(); healTimer = reader.ReadInt32(); flightPath = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - npc.canGhostHeal = reader.ReadBoolean(); - npc.localAI[2] = reader.ReadSingle(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); + NPC.canGhostHeal = reader.ReadBoolean(); + NPC.localAI[2] = reader.ReadSingle(); Dying = reader.ReadBoolean(); DeathAnimationTimer = reader.ReadInt32(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); // Be sure to inform clients of the fact that Providence is dying if only the server recieved this packet. if (Main.netMode == NetmodeID.Server && !wasDyingBefore && Dying) { - npc.netSpam = 0; - npc.netUpdate = true; + NPC.netSpam = 0; + NPC.netUpdate = true; } } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); // whoAmI variable for Guardians and other things - CalamityGlobalNPC.holyBoss = npc.whoAmI; + CalamityGlobalNPC.holyBoss = NPC.whoAmI; // Rotation - npc.rotation = npc.velocity.X * 0.004f; + NPC.rotation = NPC.velocity.X * 0.004f; - Vector2 vector = npc.Center; + Vector2 vector = NPC.Center; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); // Target variable and boss center - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; // Night bool bool malice = CalamityWorld.malice; @@ -203,19 +204,19 @@ namespace CalamityMod.NPCs.Providence bool spawnAnimation = calamityGlobalNPC.newAI[3] < spawnAnimationTime; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Play enrage animation if night starts if (nightTime && calamityGlobalNPC.newAI[3] == spawnAnimationTime) { AIState = (int)Phase.HolyBlast; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } // Increase all projectile damage at night @@ -223,17 +224,17 @@ namespace CalamityMod.NPCs.Providence if (nightTime) projectileDamageMult = 2; - npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && (nightTime || malice)) || biomeEnrageTimer <= 0; + NPC.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && (nightTime || malice)) || biomeEnrageTimer <= 0; // Projectile damage values - int holyLaserDamage = npc.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - int crystalDamage = npc.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - int holySpearDamage = npc.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - int holyBombDamage = npc.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - int moltenBlastDamage = npc.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - int holyFireDamage = npc.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - int holyBlastDamage = npc.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - int holyStarDamage = npc.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; + int holyLaserDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; + int crystalDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; + int holySpearDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; + int holyBombDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; + int moltenBlastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; + int holyFireDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; + int holyBlastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; + int holyStarDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; // Change dust type at night int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; @@ -247,7 +248,7 @@ namespace CalamityMod.NPCs.Providence // Phases bool ignoreGuardianAmt = lifeRatio < (death ? 0.2f : 0.15f); bool phase2 = lifeRatio < 0.75f && !nightTime; - bool delayAttacks = npc.localAI[2] > 0f; + bool delayAttacks = NPC.localAI[2] > 0f; // Spear phase float spearRateIncrease = 1f - lifeRatio; @@ -339,8 +340,8 @@ namespace CalamityMod.NPCs.Providence } // Whether the boss can be homed in on or healed off of - npc.chaseable = normalAttackRate && AIState != (int)Phase.FlameCocoon && AIState != (int)Phase.SpearCocoon && AIState != (int)Phase.Laser; - npc.canGhostHeal = npc.chaseable; + NPC.chaseable = normalAttackRate && AIState != (int)Phase.FlameCocoon && AIState != (int)Phase.SpearCocoon && AIState != (int)Phase.Laser; + NPC.canGhostHeal = NPC.chaseable; // Prevent lag by stopping rain CalamityMod.StopRain(); @@ -365,7 +366,7 @@ namespace CalamityMod.NPCs.Providence // Take damage or not bool biomeEnraged = biomeEnrageTimer <= 0 || malice; - npc.dontTakeDamage = Dying; + NPC.dontTakeDamage = Dying; // Do the death animation once killed. if (Dying) @@ -390,9 +391,9 @@ namespace CalamityMod.NPCs.Providence // Defense if (defenderAlive) - npc.defense = npc.defDefense * 2; + NPC.defense = NPC.defDefense * 2; else - npc.defense = npc.defDefense; + NPC.defense = NPC.defDefense; // Healing if (healerAlive) @@ -404,15 +405,15 @@ namespace CalamityMod.NPCs.Providence healTimer = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { - int healAmt = npc.lifeMax / 200; - if (healAmt > npc.lifeMax - npc.life) - healAmt = npc.lifeMax - npc.life; + int healAmt = NPC.lifeMax / 200; + if (healAmt > NPC.lifeMax - NPC.life) + healAmt = NPC.lifeMax - NPC.life; if (healAmt > 0) { - npc.life += healAmt; - npc.HealEffect(healAmt, true); - npc.netUpdate = true; + NPC.life += healAmt; + NPC.HealEffect(healAmt, true); + NPC.netUpdate = true; } } } @@ -424,49 +425,49 @@ namespace CalamityMod.NPCs.Providence { if (!player.active || player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; } if (!player.active || player.dead) { targetDead = true; - if (npc.timeLeft > 60) - npc.timeLeft = 60; + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; - if (npc.velocity.X > 0f) - npc.velocity.X += 0.2f; + if (NPC.velocity.X > 0f) + NPC.velocity.X += 0.2f; else - npc.velocity.X -= 0.2f; + NPC.velocity.X -= 0.2f; - npc.velocity.Y -= 0.2f; + NPC.velocity.Y -= 0.2f; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; // Guardian spawn if (!nightTime) { - if (bossLife == 0f && npc.life > 0) - bossLife = npc.lifeMax; + if (bossLife == 0f && NPC.life > 0) + bossLife = NPC.lifeMax; - if (npc.life > 0) + if (NPC.life > 0) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)(npc.lifeMax * 0.66); - if ((npc.life + num660) < bossLife) + int num660 = (int)(NPC.lifeMax * 0.66); + if ((NPC.life + num660) < bossLife) { - bossLife = npc.life; - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 74); + bossLife = NPC.life; + SoundEngine.PlaySound(SoundID.Item, (int)NPC.position.X, (int)NPC.position.Y, 74); int guardianRingAmt = 3; int guardianSpread = 360 / guardianRingAmt; int guardianDistance = 400; for (int i = 0; i < guardianRingAmt; i++) { int type = i == 0 ? ModContent.NPCType() : i == 1 ? ModContent.NPCType() : ModContent.NPCType(); - int spawn = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(i * guardianSpread) * guardianDistance)), (int)(npc.Center.Y + (Math.Cos(i * guardianSpread) * guardianDistance)), type, npc.whoAmI, 0, 0, 0, -1); + int spawn = NPC.NewNPC((int)(NPC.Center.X + (Math.Sin(i * guardianSpread) * guardianDistance)), (int)(NPC.Center.Y + (Math.Cos(i * guardianSpread) * guardianDistance)), type, NPC.whoAmI, 0, 0, 0, -1); Main.npc[spawn].ai[0] = i * guardianSpread; } } @@ -475,9 +476,9 @@ namespace CalamityMod.NPCs.Providence } // Set DR based on current attack phase - npc.Calamity().DR = (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon || AIState == (int)Phase.Laser || spawnAnimation) ? + NPC.Calamity().DR = (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon || AIState == (int)Phase.Laser || spawnAnimation) ? cocoonDR : delayAttacks ? - MathHelper.Lerp(normalDR, cocoonDR, npc.localAI[2] / attackDelayAfterCocoon) : normalDR; + MathHelper.Lerp(normalDR, cocoonDR, NPC.localAI[2] / attackDelayAfterCocoon) : normalDR; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon || AIState == (int)Phase.Laser || spawnAnimation; @@ -548,23 +549,23 @@ namespace CalamityMod.NPCs.Providence if (!targetDead) { - npc.velocity.X += flightPath * acceleration; - if (npc.velocity.X > velocity) - npc.velocity.X = velocity; - if (npc.velocity.X < -velocity) - npc.velocity.X = -velocity; + NPC.velocity.X += flightPath * acceleration; + if (NPC.velocity.X > velocity) + NPC.velocity.X = velocity; + if (NPC.velocity.X < -velocity) + NPC.velocity.X = -velocity; - float num855 = player.position.Y - (npc.position.Y + npc.height); + float num855 = player.position.Y - (NPC.position.Y + NPC.height); if (num855 < (firingLaser ? 150f : 200f)) // 150 - npc.velocity.Y -= 0.2f; + NPC.velocity.Y -= 0.2f; if (num855 > (firingLaser ? 200f : 250f)) // 200 - npc.velocity.Y += 0.2f; + NPC.velocity.Y += 0.2f; float speedVariance = 2f; - if (npc.velocity.Y > (firingLaser ? speedVariance : 6f)) - npc.velocity.Y = firingLaser ? speedVariance : 6f; - if (npc.velocity.Y < (firingLaser ? -speedVariance : -6f)) - npc.velocity.Y = firingLaser ? -speedVariance : -6f; + if (NPC.velocity.Y > (firingLaser ? speedVariance : 6f)) + NPC.velocity.Y = firingLaser ? speedVariance : 6f; + if (NPC.velocity.Y < (firingLaser ? -speedVariance : -6f)) + NPC.velocity.Y = firingLaser ? -speedVariance : -6f; } // Slowly drift down when spawning @@ -573,7 +574,7 @@ namespace CalamityMod.NPCs.Providence float minSpawnVelocity = 0.4f; float maxSpawnVelocity = 4f; float velocityY = maxSpawnVelocity - MathHelper.Lerp(minSpawnVelocity, maxSpawnVelocity, calamityGlobalNPC.newAI[3] / spawnAnimationTime); - npc.velocity = new Vector2(0f, velocityY); + NPC.velocity = new Vector2(0f, velocityY); } } @@ -706,16 +707,16 @@ namespace CalamityMod.NPCs.Providence // Reset attack delay for laser if (phase == (int)Phase.Laser) - npc.localAI[2] = 0f; + NPC.localAI[2] = 0f; // Reset arrays AIState = phase; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; break; case (int)Phase.HolyBlast: @@ -726,14 +727,14 @@ namespace CalamityMod.NPCs.Providence Projectile.NewProjectile(vector + new Vector2(0f, -80f), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, biomeType, 0f); if (calamityGlobalNPC.newAI[3] == 10f && nightTime) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceHolyRay"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceHolyRay"), (int)NPC.position.X, (int)NPC.position.Y); if (calamityGlobalNPC.newAI[3] > 10f && calamityGlobalNPC.newAI[3] < 150f) { int dustAmt = (int)MathHelper.Lerp(4f, 8f, calamityGlobalNPC.newAI[3] / spawnAnimationTime); for (int m = 0; m < dustAmt; m++) { - float fade = MathHelper.Lerp(1.3f, 0.7f, npc.Opacity) * Utils.InverseLerp(0f, 120f, calamityGlobalNPC.newAI[3], clamped: true); + float fade = MathHelper.Lerp(1.3f, 0.7f, NPC.Opacity) * Utils.InverseLerp(0f, 120f, calamityGlobalNPC.newAI[3], clamped: true); Color newColor = Main.hslToRgb(calamityGlobalNPC.newAI[3] / 180f, 1f, 0.5f); if (!nightTime) @@ -751,8 +752,8 @@ namespace CalamityMod.NPCs.Providence newColor.R = 0; } - int dust = Dust.NewDust(npc.position, npc.width, npc.height, 267, 0f, 0f, 0, newColor); - Main.dust[dust].position = npc.Center + Main.rand.NextVector2Circular(npc.width * 2f, npc.height * 2f) + new Vector2(0f, -150f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 267, 0f, 0f, 0, newColor); + Main.dust[dust].position = NPC.Center + Main.rand.NextVector2Circular(NPC.width * 2f, NPC.height * 2f) + new Vector2(0f, -150f); Main.dust[dust].velocity *= Main.rand.NextFloat() * 0.8f; Main.dust[dust].noGravity = true; Main.dust[dust].fadeIn = 0.6f + Main.rand.NextFloat() * 0.7f * fade; @@ -769,7 +770,7 @@ namespace CalamityMod.NPCs.Providence } } - npc.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f); + NPC.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f); calamityGlobalNPC.newAI[3] += 1f; @@ -782,25 +783,25 @@ namespace CalamityMod.NPCs.Providence // Attack delay after cocoon phase if (delayAttacks) { - npc.localAI[2] -= 1f; + NPC.localAI[2] -= 1f; return; } - if (distanceX > distanceNeededToShoot && npc.position.Y < player.position.Y) + if (distanceX > distanceNeededToShoot && NPC.position.Y < player.position.Y) { - npc.ai[3] += 1f; + NPC.ai[3] += 1f; int shootBoost = death ? (int)Math.Round(5f * (1f - lifeRatio)) : (int)Math.Round(4f * (1f - lifeRatio)); int num856 = (biomeEnraged ? 18 : expertMode ? 24 : 26) - shootBoost; num856 = (int)(num856 * attackRateMult); - if (npc.ai[3] >= num856) - npc.ai[3] = -num856; + if (NPC.ai[3] >= num856) + NPC.ai[3] = -num856; - if (npc.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - vector.X += npc.velocity.X * 7f; + vector.X += NPC.velocity.X * 7f; float num857 = player.position.X + player.width * 0.5f - vector.X; float num858 = player.Center.Y - vector.Y; float num859 = (float)Math.Sqrt(num857 * num857 + num858 * num858); @@ -818,14 +819,14 @@ namespace CalamityMod.NPCs.Providence Projectile.NewProjectile(vector.X, vector.Y, num857, num858, ModContent.ProjectileType(), holyBlastDamage, 0f, Main.myPlayer, 0f, 0f); } } - else if (npc.ai[3] < 0f) - npc.ai[3] += 1f; + else if (NPC.ai[3] < 0f) + NPC.ai[3] += 1f; - npc.ai[1] += 1f; - if (npc.ai[1] >= phaseTime) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= phaseTime) { AIState = (int)Phase.PhaseChange; - npc.TargetClosest(); + NPC.TargetClosest(); } break; @@ -835,13 +836,13 @@ namespace CalamityMod.NPCs.Providence // Attack delay after cocoon phase if (delayAttacks) { - npc.localAI[2] -= 1f; + NPC.localAI[2] -= 1f; return; } if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[3] += 1f; + NPC.ai[3] += 1f; int shootBoost = death ? (int)Math.Round(6f * (1f - lifeRatio)) : (int)Math.Round(5f * (1f - lifeRatio)); int num864 = (expertMode ? 36 : 39) - shootBoost; @@ -850,13 +851,13 @@ namespace CalamityMod.NPCs.Providence num864 = (int)(num864 * attackRateMult); - if (npc.ai[3] >= num864) + if (NPC.ai[3] >= num864) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; - Vector2 vector113 = new Vector2(vector.X, npc.position.Y + npc.height - 14f); + Vector2 vector113 = new Vector2(vector.X, NPC.position.Y + NPC.height - 14f); - float num865 = npc.velocity.Y; + float num865 = NPC.velocity.Y; if (num865 < 0f) num865 = 0f; @@ -865,15 +866,15 @@ namespace CalamityMod.NPCs.Providence if (nightTime) num865 *= 2f; - Projectile.NewProjectile(vector113.X, vector113.Y, npc.velocity.X * 0.25f, num865, ModContent.ProjectileType(), holyFireDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector113.X, vector113.Y, NPC.velocity.X * 0.25f, num865, ModContent.ProjectileType(), holyFireDamage, 0f, Main.myPlayer, 0f, 0f); } } - npc.ai[1] += 1f; - if (npc.ai[1] >= phaseTime) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= phaseTime) { AIState = (int)Phase.PhaseChange; - npc.TargetClosest(); + NPC.TargetClosest(); } break; @@ -882,11 +883,11 @@ namespace CalamityMod.NPCs.Providence if (!targetDead) { - if (npc.velocity.Length() <= 2f) - npc.velocity = Vector2.Zero; - if (npc.velocity.Length() > 2f) + if (NPC.velocity.Length() <= 2f) + NPC.velocity = Vector2.Zero; + if (NPC.velocity.Length() > 2f) { - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; return; } } @@ -895,16 +896,16 @@ namespace CalamityMod.NPCs.Providence int totalFlameProjectiles = biomeEnraged ? 45 : 36; int chains = 4; float interval = totalFlameProjectiles / chains * divisor; - double patternInterval = Math.Floor(npc.ai[3] / interval); + double patternInterval = Math.Floor(NPC.ai[3] / interval); int healingStarChance = revenge ? 8 : expertMode ? 6 : 4; if (Main.netMode != NetmodeID.MultiplayerClient) { if (patternInterval % 2 == 0) { - if (npc.ai[3] % divisor == 0f) + if (NPC.ai[3] % divisor == 0f) { - Main.PlaySound(SoundID.Item20, npc.Center); + SoundEngine.PlaySound(SoundID.Item20, NPC.Center); bool normalSpread = calamityGlobalNPC.newAI[1] % 2f == 0f; double radians = MathHelper.TwoPi / chains; double angleA = radians * 0.5; @@ -913,14 +914,14 @@ namespace CalamityMod.NPCs.Providence Vector2 spinningPoint = normalSpread ? new Vector2(0f, -cocoonProjVelocity) : new Vector2(-velocityX, -cocoonProjVelocity); for (int i = 0; i < chains; i++) { - Vector2 vector2 = spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(npc.ai[2])); + Vector2 vector2 = spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(NPC.ai[2])); int projectileType = ModContent.ProjectileType(); int dmgAmt = holyStarDamage; if (Main.rand.NextBool(healingStarChance) && !death) { projectileType = ModContent.ProjectileType(); - dmgAmt = npc.GetProjectileDamageNoScaling(projectileType); + dmgAmt = NPC.GetProjectileDamageNoScaling(projectileType); Projectile.NewProjectile(fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); } else @@ -928,24 +929,24 @@ namespace CalamityMod.NPCs.Providence } // Radial offset - npc.ai[2] += 10f; + NPC.ai[2] += 10f; } - npc.netUpdate = true; + NPC.netUpdate = true; } else { - npc.ai[2] = 0f; + NPC.ai[2] = 0f; totalFlameProjectiles = biomeEnraged ? 20 : 16; - if (npc.ai[3] % (divisor * totalFlameProjectiles) == 0f) + if (NPC.ai[3] % (divisor * totalFlameProjectiles) == 0f) { calamityGlobalNPC.newAI[1] += 1f; double radians = MathHelper.TwoPi / totalFlameProjectiles; - Main.PlaySound(SoundID.Item20, npc.position); + SoundEngine.PlaySound(SoundID.Item20, NPC.position); double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; float velocityX = (float)(cocoonProjVelocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = npc.ai[3] % (divisor * totalFlameProjectiles * 2f) == 0f ? new Vector2(-velocityX, -cocoonProjVelocity) : new Vector2(0f, -cocoonProjVelocity); + Vector2 spinningPoint = NPC.ai[3] % (divisor * totalFlameProjectiles * 2f) == 0f ? new Vector2(-velocityX, -cocoonProjVelocity) : new Vector2(0f, -cocoonProjVelocity); for (int i = 0; i < totalFlameProjectiles; i++) { Vector2 vector2 = spinningPoint.RotatedBy(radians * i); @@ -955,7 +956,7 @@ namespace CalamityMod.NPCs.Providence if (Main.rand.NextBool(healingStarChance) && !death) { projectileType = ModContent.ProjectileType(); - dmgAmt = npc.GetProjectileDamageNoScaling(projectileType); + dmgAmt = NPC.GetProjectileDamageNoScaling(projectileType); Projectile.NewProjectile(fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); } else @@ -965,7 +966,7 @@ namespace CalamityMod.NPCs.Providence } // Fire a flame towards every player, with a limit of 5 - if (npc.ai[3] % 60f == 0f && expertMode) + if (NPC.ai[3] % 60f == 0f && expertMode) { List targets = new List(); for (int p = 0; p < Main.maxPlayers; p++) @@ -985,12 +986,12 @@ namespace CalamityMod.NPCs.Providence } } - if (npc.ai[3] == 0f) + if (NPC.ai[3] == 0f) DespawnSpecificProjectiles(); // Air is burning text - npc.ai[3] += 1f; - if (npc.ai[3] >= (phaseTime * 1.5f) && !text) + NPC.ai[3] += 1f; + if (NPC.ai[3] >= (phaseTime * 1.5f) && !text) { text = true; string key = "Mods.CalamityMod.ProfanedBossText"; @@ -1000,7 +1001,7 @@ namespace CalamityMod.NPCs.Providence } // Inflict Icarus Folly - if (npc.ai[3] >= (phaseTime * 2f)) + if (NPC.ai[3] >= (phaseTime * 2f)) { if (Main.netMode != NetmodeID.Server) { @@ -1009,7 +1010,7 @@ namespace CalamityMod.NPCs.Providence if (!player2.dead && player2.active && Vector2.Distance(player2.Center, vector) < 2800f && !inLiquid) { - Main.PlaySound(SoundID.Item20, player2.position); + SoundEngine.PlaySound(SoundID.Item20, player2.position); player2.AddBuff(ModContent.BuffType(), 3000, true); for (int num621 = 0; num621 < 40; num621++) @@ -1039,8 +1040,8 @@ namespace CalamityMod.NPCs.Providence text = false; AIState = (int)Phase.PhaseChange; - npc.localAI[2] = attackDelayAfterCocoon; - npc.TargetClosest(); + NPC.localAI[2] = attackDelayAfterCocoon; + NPC.TargetClosest(); } break; @@ -1050,13 +1051,13 @@ namespace CalamityMod.NPCs.Providence // Attack delay after cocoon phase if (delayAttacks) { - npc.localAI[2] -= 1f; + NPC.localAI[2] -= 1f; return; } - if (distanceX > distanceNeededToShoot && npc.position.Y < player.position.Y) + if (distanceX > distanceNeededToShoot && NPC.position.Y < player.position.Y) { - npc.ai[3] += 1f; + NPC.ai[3] += 1f; int shootBoost = death ? (int)Math.Round(5f * (1f - lifeRatio)) : (int)Math.Round(4f * (1f - lifeRatio)); int num856 = (expertMode ? 24 : 26) - shootBoost; @@ -1065,12 +1066,12 @@ namespace CalamityMod.NPCs.Providence num856 = (int)(num856 * attackRateMult); - if (npc.ai[3] >= num856) - npc.ai[3] = -num856; + if (NPC.ai[3] >= num856) + NPC.ai[3] = -num856; - if (npc.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - vector.X += npc.velocity.X * 7f; + vector.X += NPC.velocity.X * 7f; float num857 = player.position.X + player.width * 0.5f - vector.X; float num858 = player.Center.Y - vector.Y; float num859 = (float)Math.Sqrt(num857 * num857 + num858 * num858); @@ -1090,14 +1091,14 @@ namespace CalamityMod.NPCs.Providence Projectile.NewProjectile(vector.X, vector.Y, num857 * 0.1f, num858, ModContent.ProjectileType(), moltenBlastDamage, 0f, Main.myPlayer, 0f, 0f); } } - else if (npc.ai[3] < 0f) - npc.ai[3] += 1f; + else if (NPC.ai[3] < 0f) + NPC.ai[3] += 1f; - npc.ai[1] += 1f; - if (npc.ai[1] >= phaseTime) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= phaseTime) { AIState = (int)Phase.PhaseChange; - npc.TargetClosest(); + NPC.TargetClosest(); } break; @@ -1107,40 +1108,40 @@ namespace CalamityMod.NPCs.Providence // Attack delay after cocoon phase if (delayAttacks) { - npc.localAI[2] -= 1f; + NPC.localAI[2] -= 1f; return; } if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[3] += 1f; + NPC.ai[3] += 1f; int shootBoost = death ? (int)Math.Round(12f * (1f - lifeRatio)) : (int)Math.Round(10f * (1f - lifeRatio)); int num864 = (biomeEnraged ? 54 : expertMode ? 73 : 77) - shootBoost; num864 = (int)(num864 * attackRateMult); - if (npc.ai[3] >= num864) + if (NPC.ai[3] >= num864) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; - Vector2 vector113 = new Vector2(vector.X, npc.position.Y + npc.height - 14f); + Vector2 vector113 = new Vector2(vector.X, NPC.position.Y + NPC.height - 14f); - float num865 = npc.velocity.Y; + float num865 = NPC.velocity.Y; if (num865 < 0f) num865 = 0f; num865 += expertMode ? 4f : 3f; - Projectile.NewProjectile(vector113.X, vector113.Y, npc.velocity.X * 0.25f, num865, ModContent.ProjectileType(), holyBombDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector113.X, vector113.Y, NPC.velocity.X * 0.25f, num865, ModContent.ProjectileType(), holyBombDamage, 0f, Main.myPlayer, 0f, 0f); } } - npc.ai[1] += 1f; - if (npc.ai[1] >= phaseTime) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= phaseTime) { AIState = (int)Phase.PhaseChange; - npc.TargetClosest(); + NPC.TargetClosest(); } break; @@ -1149,24 +1150,24 @@ namespace CalamityMod.NPCs.Providence if (!targetDead) { - if (npc.velocity.Length() <= 2f) - npc.velocity = Vector2.Zero; - if (npc.velocity.Length() > 2f) + if (NPC.velocity.Length() <= 2f) + NPC.velocity = Vector2.Zero; + if (NPC.velocity.Length() > 2f) { - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; return; } } - if (npc.ai[1] == 0f) + if (NPC.ai[1] == 0f) DespawnSpecificProjectiles(); if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[2] += spearRate; - if (npc.ai[2] >= (float)(baseSpearRate * attackRateMult)) + NPC.ai[2] += spearRate; + if (NPC.ai[2] >= (float)(baseSpearRate * attackRateMult)) { - npc.ai[2] = 0f; + NPC.ai[2] = 0f; Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, fireFrom); @@ -1199,12 +1200,12 @@ namespace CalamityMod.NPCs.Providence } } - npc.ai[3] += 1f; - if (npc.ai[3] >= phaseTime) + NPC.ai[3] += 1f; + if (NPC.ai[3] >= phaseTime) { AIState = (int)Phase.PhaseChange; - npc.localAI[2] = attackDelayAfterCocoon; - npc.TargetClosest(); + NPC.localAI[2] = attackDelayAfterCocoon; + NPC.TargetClosest(); } break; @@ -1212,12 +1213,12 @@ namespace CalamityMod.NPCs.Providence case (int)Phase.Crystal: if (!targetDead) - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; - npc.ai[1] += 1f; - if (npc.ai[1] >= crystalPhaseTime) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= crystalPhaseTime) { - if (npc.ai[1] == crystalPhaseTime && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.ai[1] == crystalPhaseTime && Main.netMode != NetmodeID.MultiplayerClient) { int proj = Projectile.NewProjectile(player.Center.X, player.Center.Y - 360f, 0f, 0f, ModContent.ProjectileType(), crystalDamage, 0f, player.whoAmI, lifeRatio, 0f); @@ -1225,10 +1226,10 @@ namespace CalamityMod.NPCs.Providence Main.projectile[proj].timeLeft = nightCrystalTime; } - if (npc.ai[1] >= crystalPhaseTime + nightCrystalTime || !nightTime) + if (NPC.ai[1] >= crystalPhaseTime + nightCrystalTime || !nightTime) { AIState = (int)Phase.PhaseChange; - npc.TargetClosest(); + NPC.TargetClosest(); } } @@ -1240,13 +1241,13 @@ namespace CalamityMod.NPCs.Providence float rotation = (nightTime ? 435f : 450f) + (guardianAmt * 5); - npc.ai[2] += 1f; - if (npc.ai[2] < 120f) + NPC.ai[2] += 1f; + if (NPC.ai[2] < 120f) { - if (npc.ai[2] >= 40f) + if (NPC.ai[2] >= 40f) { int num1220 = 0; - if (npc.ai[2] >= 80f) + if (NPC.ai[2] >= 80f) num1220 = 1; for (int d = 0; d < 1 + num1220; d++) @@ -1256,20 +1257,20 @@ namespace CalamityMod.NPCs.Providence scalar = 2.8f; Vector2 vector199 = new Vector2(vector.X, vector.Y + 32f) + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * value19 / 2f; - int index = Dust.NewDust(vector199 - Vector2.One * 8f, 16, 16, dustType, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); + int index = Dust.NewDust(vector199 - Vector2.One * 8f, 16, 16, dustType, NPC.velocity.X / 2f, NPC.velocity.Y / 2f, 0, default, 1f); Main.dust[index].velocity = Vector2.Normalize(vector - vector199) * 3.5f * (10f - num1220 * 2f) / 10f; Main.dust[index].noGravity = true; Main.dust[index].scale = scalar; } } } - else if (npc.ai[2] < (revenge ? 220f : 300f)) + else if (NPC.ai[2] < (revenge ? 220f : 300f)) { - if (npc.ai[2] == 120f) + if (NPC.ai[2] == 120f) { if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 2800f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceHolyRay"), + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceHolyRay"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); } @@ -1284,32 +1285,32 @@ namespace CalamityMod.NPCs.Providence // 60 degrees offset velocity = velocity.RotatedBy(-(double)num1225 * MathHelper.TwoPi / 6f); - Projectile.NewProjectile(vector.X, vector.Y + 32f, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, num1225 * MathHelper.TwoPi / rotation, npc.whoAmI); + Projectile.NewProjectile(vector.X, vector.Y + 32f, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, num1225 * MathHelper.TwoPi / rotation, NPC.whoAmI); // -60 degrees offset if (revenge) - Projectile.NewProjectile(vector.X, vector.Y + 32f, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -num1225 * MathHelper.TwoPi / rotation, npc.whoAmI); + Projectile.NewProjectile(vector.X, vector.Y + 32f, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -num1225 * MathHelper.TwoPi / rotation, NPC.whoAmI); if (nightTime && lifeRatio < 0.5f) { rotation *= 0.33f; velocity = velocity.RotatedBy(-(double)num1225 * MathHelper.TwoPi / 2f); - Projectile.NewProjectile(vector.X, vector.Y + 32f, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, num1225 * MathHelper.TwoPi / rotation, npc.whoAmI); + Projectile.NewProjectile(vector.X, vector.Y + 32f, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, num1225 * MathHelper.TwoPi / rotation, NPC.whoAmI); if (revenge) - Projectile.NewProjectile(vector.X, vector.Y + 32f, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -num1225 * MathHelper.TwoPi / rotation, npc.whoAmI); + Projectile.NewProjectile(vector.X, vector.Y + 32f, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -num1225 * MathHelper.TwoPi / rotation, NPC.whoAmI); } - npc.netUpdate = true; + NPC.netUpdate = true; } } } - npc.ai[1] += 1f; - if (npc.ai[1] >= (revenge ? 235f : 315f)) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= (revenge ? 235f : 315f)) { AIState = (int)Phase.PhaseChange; - npc.TargetClosest(); + NPC.TargetClosest(); } break; @@ -1323,14 +1324,14 @@ namespace CalamityMod.NPCs.Providence DeathAnimationTimer++; // Slow down to a halt and define rotation based off of that. - npc.velocity *= 0.9f; - npc.rotation = npc.velocity.X * 0.004f; + NPC.velocity *= 0.9f; + NPC.rotation = NPC.velocity.X * 0.004f; // Play an animation sound immediately. Also delete various projectiles. if (DeathAnimationTimer == 1f) { - if (Main.netMode != NetmodeID.Server && Main.LocalPlayer.WithinRange(npc.Center, 4800f)) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceDeathAnimation").WithVolume(1.65f), Main.LocalPlayer.Center); + if (Main.netMode != NetmodeID.Server && Main.LocalPlayer.WithinRange(NPC.Center, 4800f)) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceDeathAnimation").WithVolume(1.65f), Main.LocalPlayer.Center); DespawnSpecificProjectiles(); @@ -1345,17 +1346,17 @@ namespace CalamityMod.NPCs.Providence // Begin fading out before the exploding sun animation happens. if (DeathAnimationTimer >= 370f) - npc.Opacity *= 0.97f; + NPC.Opacity *= 0.97f; // Create an explosive wave shortly after the death animation begins. // The temporal offset coincides with the point at which the crystal shatter sound happens in the // above defeat scene sound. if (DeathAnimationTimer == 92f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceHolyBlastImpact"), npc.Center); - Main.PlaySound(npc.DeathSound, npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceHolyBlastImpact"), NPC.Center); + SoundEngine.PlaySound(NPC.DeathSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); } // Explode as an enormous holy star before dying and dropping loot. @@ -1364,9 +1365,9 @@ namespace CalamityMod.NPCs.Providence for (int i = 0; i < 80; i++) { Vector2 sparkleVelocity = Main.rand.NextVector2Circular(23f, 23f); - Projectile.NewProjectile(npc.Center, sparkleVelocity, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(NPC.Center, sparkleVelocity, ModContent.ProjectileType(), 0, 0f); } - Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, 255); + Projectile.NewProjectile(NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, 255); } // Idly release harmless cindiers. @@ -1376,28 +1377,28 @@ namespace CalamityMod.NPCs.Providence for (int i = 0; i < 3; i++) { Vector2 shootVelocity = Main.rand.NextVector2CircularEdge(13f, 13f) * Main.rand.NextFloat(0.7f, 1.3f); - Projectile.NewProjectile(npc.Center, shootVelocity, ModContent.ProjectileType(), 0, 0f, 255); + Projectile.NewProjectile(NPC.Center, shootVelocity, ModContent.ProjectileType(), 0, 0f, 255); } } // Do periodic syncs. if (Main.netMode == NetmodeID.Server && DeathAnimationTimer % 45f == 44f) - npc.netUpdate = true; + NPC.netUpdate = true; // Die and create drops after the star is gone. if (DeathAnimationTimer >= 345f) { - npc.active = false; - npc.HitEffect(); - npc.NPCLoot(); - npc.netUpdate = true; + NPC.active = false; + NPC.HitEffect(); + NPC.NPCLoot(); + NPC.netUpdate = true; } } public float CalculateBurnIntensity() { - float distanceToTarget = Vector2.Distance(Main.player[npc.target].Center, npc.Center); - float aiTimer = npc.ai[3]; + float distanceToTarget = Vector2.Distance(Main.player[NPC.target].Center, NPC.Center); + float aiTimer = NPC.ai[3]; // Night bool bool malice = CalamityWorld.malice; @@ -1468,38 +1469,38 @@ namespace CalamityMod.NPCs.Providence public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedProvidence); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedProvidence); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedProvidence); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedProvidence); CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedProvidence); // Accessories clientside only in Expert. Both drop if she is defeated at night. - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, biomeType != 2 || !hasTakenDaytimeDamage); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, biomeType == 2 || !hasTakenDaytimeDamage); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode, biomeType != 2 || !hasTakenDaytimeDamage); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode, biomeType == 2 || !hasTakenDaytimeDamage); // Drops pre-scal, cannot be sold, does nothing aka purely vanity. Requires at least expert for consistency with other post scal dev items. bool shouldDrop = challenge/* || (Main.expertMode && Main.rand.NextBool(CalamityWorld.downedSCal ? 10 : 200))*/; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, shouldDrop); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, shouldDrop); // Special drop for defeating her at night - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice || !hasTakenDaytimeDamage, 3, 4); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, CalamityWorld.malice || !hasTakenDaytimeDamage, 3, 4); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { // Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 20, 30); - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 15, 20); + DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 20, 30); + DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 15, 20); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -1510,15 +1511,15 @@ namespace CalamityMod.NPCs.Providence ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.Top.Y >= (Main.maxTilesY - 240f) * 16f) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.Top.Y >= (Main.maxTilesY - 240f) * 16f) SpawnLootBox(); // If Providence has not been killed, notify players of Uelibloom Ore @@ -1550,8 +1551,8 @@ namespace CalamityMod.NPCs.Providence private void SpawnLootBox() { - int tileCenterX = (int)npc.Center.X / 16; - int tileCenterY = (int)npc.Center.Y / 16; + int tileCenterX = (int)NPC.Center.X / 16; + int tileCenterY = (int)NPC.Center.Y / 16; int halfBox = 5; for (int x = tileCenterX - halfBox; x <= tileCenterX + halfBox; x++) { @@ -1560,7 +1561,7 @@ namespace CalamityMod.NPCs.Providence if ((x == tileCenterX - halfBox || x == tileCenterX + halfBox || y == tileCenterY - halfBox || y == tileCenterY + halfBox) && !Main.tile[x, y].active()) { - Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); Main.tile[x, y].active(true); } Main.tile[x, y].lava(false); @@ -1642,15 +1643,15 @@ namespace CalamityMod.NPCs.Providence getTextureGlow2String += "Night"; } - Texture2D texture = ModContent.GetTexture(getTextureString); - Texture2D textureGlow = ModContent.GetTexture(getTextureGlowString); - Texture2D textureGlow2 = ModContent.GetTexture(getTextureGlow2String); + Texture2D texture = ModContent.Request(getTextureString); + Texture2D textureGlow = ModContent.Request(getTextureGlowString); + Texture2D textureGlow2 = ModContent.Request(getTextureGlow2String); SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -1661,25 +1662,25 @@ namespace CalamityMod.NPCs.Providence { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; if (colorOverride != null) color38 = colorOverride.Value; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY) + drawOffset; - spriteBatch.Draw(texture, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY) + drawOffset; - spriteBatch.Draw(texture, vector43, npc.frame, colorOverride ?? npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture, vector43, NPC.frame, colorOverride ?? NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - Color color37 = Color.Lerp(Color.White, nightTime ? Color.Cyan : Color.Yellow, 0.5f) * npc.Opacity; - Color color42 = Color.Lerp(Color.White, nightTime ? Color.BlueViolet : Color.Violet, 0.5f) * npc.Opacity; + Color color37 = Color.Lerp(Color.White, nightTime ? Color.Cyan : Color.Yellow, 0.5f) * NPC.Opacity; + Color color42 = Color.Lerp(Color.White, nightTime ? Color.BlueViolet : Color.Violet, 0.5f) * NPC.Opacity; if (colorOverride != null) { color37 = colorOverride.Value; @@ -1692,29 +1693,29 @@ namespace CalamityMod.NPCs.Providence { Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); - color41 = npc.GetAlpha(color41); + color41 = NPC.GetAlpha(color41); color41 *= (num153 - num163) / 15f; if (colorOverride != null) color41 = colorOverride.Value; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(textureGlow.Width, textureGlow.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY) + drawOffset; - spriteBatch.Draw(textureGlow, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(textureGlow.Width, textureGlow.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(textureGlow, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); Color color43 = color42; color43 = Color.Lerp(color43, color36, amount9); - color43 = npc.GetAlpha(color43); + color43 = NPC.GetAlpha(color43); color43 *= (num153 - num163) / 15f; if (colorOverride != null) color43 = colorOverride.Value; - spriteBatch.Draw(textureGlow2, vector44, npc.frame, color43, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(textureGlow2, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(textureGlow, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(textureGlow, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(textureGlow2, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(textureGlow2, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } float burnIntensity = Utils.InverseLerp(0f, 45f, DeathAnimationTimer, true); @@ -1741,28 +1742,28 @@ namespace CalamityMod.NPCs.Providence { if (!useDefenseFrames) { - npc.frameCounter += Dying ? 0.25 : 1.0; - if (npc.frameCounter > 8.0) + NPC.frameCounter += Dying ? 0.25 : 1.0; + if (NPC.frameCounter > 8.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 3) + if (NPC.frame.Y >= frameHeight * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; useDefenseFrames = true; } } else { - npc.frameCounter += Dying ? 0.25 : 1.0; - if (npc.frameCounter > 8.0) + NPC.frameCounter += Dying ? 0.25 : 1.0; + if (NPC.frameCounter > 8.0) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; } - if (npc.frame.Y >= frameHeight * 2) - npc.frame.Y = frameHeight * 2; + if (NPC.frame.Y >= frameHeight * 2) + NPC.frame.Y = frameHeight * 2; } } else @@ -1770,15 +1771,15 @@ namespace CalamityMod.NPCs.Providence if (useDefenseFrames) useDefenseFrames = false; - npc.frameCounter += Dying ? 0.25 : 1.0; - if (npc.frameCounter > (npc.Calamity().newAI[3] < 180f ? 8.0 : 5.0)) + NPC.frameCounter += Dying ? 0.25 : 1.0; + if (NPC.frameCounter > (NPC.Calamity().newAI[3] < 180f ? 8.0 : 5.0)) { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; } - if (npc.frame.Y >= frameHeight * 3) //6 + if (NPC.frame.Y >= frameHeight * 3) //6 { - npc.frame.Y = 0; + NPC.frame.Y = 0; frameUsed++; } if (frameUsed > 3) @@ -1794,8 +1795,8 @@ namespace CalamityMod.NPCs.Providence public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * 0.8f); } public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) @@ -1808,9 +1809,9 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.SinglePlayer) { - var netMessage = mod.GetPacket(); + var netMessage = Mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.ProvidenceDyeConditionSync); - netMessage.Write((byte)npc.whoAmI); + netMessage.Write((byte)NPC.whoAmI); netMessage.Write(hasTakenDaytimeDamage); netMessage.Send(); } @@ -1843,9 +1844,9 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.SinglePlayer) { - var netMessage = mod.GetPacket(); + var netMessage = Mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.PSCChallengeSync); - netMessage.Write((byte)npc.whoAmI); + netMessage.Write((byte)NPC.whoAmI); netMessage.Write(challenge); netMessage.Send(); } @@ -1863,9 +1864,9 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.SinglePlayer) { - var netMessage = mod.GetPacket(); + var netMessage = Mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.ProvidenceDyeConditionSync); - netMessage.Write((byte)npc.whoAmI); + netMessage.Write((byte)NPC.whoAmI); netMessage.Write(hasTakenDaytimeDamage); netMessage.Send(); } @@ -1878,9 +1879,9 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.SinglePlayer) { - var netMessage = mod.GetPacket(); + var netMessage = Mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.PSCChallengeSync); - netMessage.Write((byte)npc.whoAmI); + netMessage.Write((byte)NPC.whoAmI); netMessage.Write(challenge); netMessage.Send(); } @@ -1893,20 +1894,20 @@ namespace CalamityMod.NPCs.Providence { DespawnSpecificProjectiles(true); Dying = true; - npc.active = true; - npc.netUpdate = true; + NPC.active = true; + NPC.netUpdate = true; } return false; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if ((damage * (crit ? 2D : 1D)) >= npc.life) + if ((damage * (crit ? 2D : 1D)) >= NPC.life) { damage = 0D; - npc.life = 1; - npc.dontTakeDamage = true; + NPC.life = 1; + NPC.dontTakeDamage = true; if (!Dying) CheckDead(); return false; @@ -1917,30 +1918,30 @@ namespace CalamityMod.NPCs.Providence public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0 && !Dying) + if (NPC.soundDelay == 0 && !Dying) { - npc.soundDelay = 8; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/ProvidenceHurt"), npc.Center); + NPC.soundDelay = 8; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/ProvidenceHurt"), NPC.Center); } int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; for (int k = 0; k < 15; k++) - Dust.NewDust(npc.position, npc.width, npc.height, dustType, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { float randomSpread = Main.rand.Next(-50, 50) / 100; - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence4"), 1f); - npc.position = npc.Center; - npc.width = 400; - npc.height = 350; - npc.position -= npc.Size * 0.5f; + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/Providence"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/Providence2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/Providence3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.GetGoreSlot("Gores/Providence4"), 1f); + NPC.position = NPC.Center; + NPC.width = 400; + NPC.height = 350; + NPC.position -= NPC.Size * 0.5f; for (int d = 0; d < 60; d++) { - int fire = Dust.NewDust(npc.position, npc.width, npc.height, dustType, 0f, 0f, 100, default, 2f); + int fire = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -1950,10 +1951,10 @@ namespace CalamityMod.NPCs.Providence } for (int d = 0; d < 90; d++) { - int fire = Dust.NewDust(npc.position, npc.width, npc.height, dustType, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(npc.position, npc.width, npc.height, dustType, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } } diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index dadc498cfb..5618507b25 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -14,35 +14,35 @@ namespace CalamityMod.NPCs.Ravager public override void SetStaticDefaults() { DisplayName.SetDefault("Flame Pillar"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.GetNPCDamage(); - npc.width = 40; - npc.height = 150; - npc.defense = 35; - npc.DR_NERD(0.2f); - npc.chaseable = false; - npc.canGhostHeal = false; - npc.lifeMax = CalamityWorld.downedProvidence ? 14000 : 3500; - npc.alpha = 255; - npc.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 40; + NPC.height = 150; + NPC.defense = 35; + NPC.DR_NERD(0.2f); + NPC.chaseable = false; + NPC.canGhostHeal = false; + NPC.lifeMax = CalamityWorld.downedProvidence ? 14000 : 3500; + NPC.alpha = 255; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.knockBackResist = 0f; + NPC.HitSound = SoundID.NPCHit41; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() @@ -52,55 +52,55 @@ namespace CalamityMod.NPCs.Ravager if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { - npc.life = 0; - HitEffect(npc.direction, 9999); - npc.netUpdate = true; + NPC.life = 0; + HitEffect(NPC.direction, 9999); + NPC.netUpdate = true; return; } - if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0.5f, 0.5f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0f, 0.5f, 0.5f); - if (npc.alpha > 0) + if (NPC.alpha > 0) { - npc.damage = 0; + NPC.damage = 0; - npc.alpha -= 5; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 5; + if (NPC.alpha < 0) + NPC.alpha = 0; } else { if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) - npc.damage = (int)(npc.defDamage * 1.5); + NPC.damage = (int)(NPC.defDamage * 1.5); else - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.ai[1] += 1f; - if (npc.ai[1] >= 60f) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 60f) { - npc.ai[0] = 1f; - npc.ai[1] = 180f; + NPC.ai[0] = 1f; + NPC.ai[1] = 180f; } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - if (npc.ai[1] >= 0f) + if (NPC.ai[1] >= 0f) { - npc.ai[1] -= 1f; - npc.localAI[0] += 1f; - if (npc.localAI[0] % (death ? 45f : 60f) == 0f) + NPC.ai[1] -= 1f; + NPC.localAI[0] += 1f; + if (NPC.localAI[0] % (death ? 45f : 60f) == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { float speedY = -12f; float speedX = 0f; - switch ((int)npc.ai[2]) + switch ((int)NPC.ai[2]) { case 0: break; @@ -115,19 +115,19 @@ namespace CalamityMod.NPCs.Ravager } Vector2 velocity = new Vector2(speedX, speedY); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center, velocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.Center, velocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); } - npc.ai[2] += 1f; - npc.localAI[0] = 0f; - npc.netUpdate = true; + NPC.ai[2] += 1f; + NPC.localAI[0] = 0f; + NPC.netUpdate = true; } } else { - npc.life = 0; - HitEffect(npc.direction, 9999); - npc.netUpdate = true; + NPC.life = 0; + HitEffect(NPC.direction, 9999); + NPC.netUpdate = true; } } } @@ -135,21 +135,21 @@ namespace CalamityMod.NPCs.Ravager public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Ravager/FlamePillarGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Ravager/FlamePillarGlow"); Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -160,17 +160,17 @@ namespace CalamityMod.NPCs.Ravager public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 50; - npc.height = 180; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 50; + NPC.height = 180; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 30; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 135, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 135, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -180,10 +180,10 @@ namespace CalamityMod.NPCs.Ravager } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Stone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -191,7 +191,7 @@ namespace CalamityMod.NPCs.Ravager { for (int num621 = 0; num621 < 2; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -201,10 +201,10 @@ namespace CalamityMod.NPCs.Ravager } for (int num623 = 0; num623 < 2; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Stone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 9a98a3dd06..6c10ea1218 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -18,6 +18,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Ravager { @@ -29,119 +30,119 @@ namespace CalamityMod.NPCs.Ravager public override void SetStaticDefaults() { DisplayName.SetDefault("Ravager"); - Main.npcFrameCount[npc.type] = 7; + Main.npcFrameCount[NPC.type] = 7; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.lavaImmune = true; - npc.noGravity = true; - npc.npcSlots = 20f; - npc.aiStyle = -1; - npc.GetNPCDamage(); - npc.width = 332; - npc.height = 214; - npc.defense = 55; - npc.value = Item.buyPrice(0, 75, 0, 0); - npc.DR_NERD(0.35f); - npc.LifeMaxNERB(44600, 53500, 460000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.lavaImmune = true; + NPC.noGravity = true; + NPC.npcSlots = 20f; + NPC.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 332; + NPC.height = 214; + NPC.defense = 55; + NPC.value = Item.buyPrice(0, 75, 0, 0); + NPC.DR_NERD(0.35f); + NPC.LifeMaxNERB(44600, 53500, 460000); if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.damage = (int)(npc.damage * 1.5); - npc.defense *= 2; - npc.lifeMax *= 4; - npc.value *= 1.5f; + NPC.damage = (int)(NPC.damage * 1.5); + NPC.defense *= 2; + NPC.lifeMax *= 4; + NPC.value *= 1.5f; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; aiType = -1; - npc.boss = true; - npc.netAlways = true; - npc.alpha = 255; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; + NPC.boss = true; + NPC.netAlways = true; + NPC.alpha = 255; + NPC.HitSound = SoundID.NPCHit41; + NPC.DeathSound = SoundID.NPCDeath14; music = CalamityMod.Instance.GetMusicFromMusicMod("Ravager") ?? MusicID.Boss4; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); writer.Write(velocityY); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); velocityY = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Large fire light - Lighting.AddLight((int)(npc.Center.X - 110f) / 16, (int)(npc.Center.Y - 30f) / 16, 0f, 0.5f, 2f); - Lighting.AddLight((int)(npc.Center.X + 110f) / 16, (int)(npc.Center.Y - 30f) / 16, 0f, 0.5f, 2f); + Lighting.AddLight((int)(NPC.Center.X - 110f) / 16, (int)(NPC.Center.Y - 30f) / 16, 0f, 0.5f, 2f); + Lighting.AddLight((int)(NPC.Center.X + 110f) / 16, (int)(NPC.Center.Y - 30f) / 16, 0f, 0.5f, 2f); // Small fire light - Lighting.AddLight((int)(npc.Center.X - 40f) / 16, (int)(npc.Center.Y - 60f) / 16, 0f, 0.25f, 1f); - Lighting.AddLight((int)(npc.Center.X + 40f) / 16, (int)(npc.Center.Y - 60f) / 16, 0f, 0.25f, 1f); + Lighting.AddLight((int)(NPC.Center.X - 40f) / 16, (int)(NPC.Center.Y - 60f) / 16, 0f, 0.25f, 1f); + Lighting.AddLight((int)(NPC.Center.X + 40f) / 16, (int)(NPC.Center.Y - 60f) / 16, 0f, 0.25f, 1f); - CalamityGlobalNPC.scavenger = npc.whoAmI; + CalamityGlobalNPC.scavenger = NPC.whoAmI; - if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] = 1f; - NPC.NewNPC((int)npc.Center.X - 70, (int)npc.Center.Y + 88, ModContent.NPCType()); - NPC.NewNPC((int)npc.Center.X + 70, (int)npc.Center.Y + 88, ModContent.NPCType()); - NPC.NewNPC((int)npc.Center.X - 120, (int)npc.Center.Y + 50, ModContent.NPCType()); - NPC.NewNPC((int)npc.Center.X + 120, (int)npc.Center.Y + 50, ModContent.NPCType()); - NPC.NewNPC((int)npc.Center.X + 1, (int)npc.Center.Y - 20, ModContent.NPCType()); + NPC.localAI[0] = 1f; + NPC.NewNPC((int)NPC.Center.X - 70, (int)NPC.Center.Y + 88, ModContent.NPCType()); + NPC.NewNPC((int)NPC.Center.X + 70, (int)NPC.Center.Y + 88, ModContent.NPCType()); + NPC.NewNPC((int)NPC.Center.X - 120, (int)NPC.Center.Y + 50, ModContent.NPCType()); + NPC.NewNPC((int)NPC.Center.X + 120, (int)NPC.Center.Y + 50, ModContent.NPCType()); + NPC.NewNPC((int)NPC.Center.X + 1, (int)NPC.Center.Y - 20, ModContent.NPCType()); } - if (npc.target >= 0 && Main.player[npc.target].dead) + if (NPC.target >= 0 && Main.player[NPC.target].dead) { - npc.TargetClosest(); - if (Main.player[npc.target].dead) - npc.noTileCollide = true; + NPC.TargetClosest(); + if (Main.player[NPC.target].dead) + NPC.noTileCollide = true; } - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; - if (npc.alpha > 0) + if (NPC.alpha > 0) { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 10; + if (NPC.alpha < 0) + NPC.alpha = 0; - npc.ai[1] = 0f; + NPC.ai[1] = 0f; } bool leftLegActive = false; @@ -170,12 +171,12 @@ namespace CalamityMod.NPCs.Ravager bool anyHeadActive = headActive || freeHeadActive; bool immunePhase = headActive || rightClawActive || leftClawActive || rightLegActive || leftLegActive; bool finalPhase = !leftClawActive && !rightClawActive && !headActive && !leftLegActive && !rightLegActive && expertMode; - bool phase2 = npc.ai[0] == 2f; - bool reduceFallSpeed = npc.velocity.Y > 0f && npc.Bottom.Y > player.Top.Y; + bool phase2 = NPC.ai[0] == 2f; + bool reduceFallSpeed = NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y; if (immunePhase) { - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; if (malice) { if (Main.netMode != NetmodeID.Server) @@ -187,7 +188,7 @@ namespace CalamityMod.NPCs.Ravager } else { - npc.dontTakeDamage = false; + NPC.dontTakeDamage = false; if (Main.netMode != NetmodeID.Server) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && revenge) @@ -197,7 +198,7 @@ namespace CalamityMod.NPCs.Ravager if (!headActive) { - int rightDust = Dust.NewDust(new Vector2(npc.Center.X, npc.Center.Y - 30f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 2.5f); + int rightDust = Dust.NewDust(new Vector2(NPC.Center.X, NPC.Center.Y - 30f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 2.5f); Main.dust[rightDust].alpha += Main.rand.Next(100); Main.dust[rightDust].velocity *= 0.2f; @@ -207,7 +208,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.NextBool(10)) { - rightDust = Dust.NewDust(new Vector2(npc.Center.X, npc.Center.Y - 30f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 1.5f); + rightDust = Dust.NewDust(new Vector2(NPC.Center.X, NPC.Center.Y - 30f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 1.5f); if (Main.rand.Next(20) != 0) { Main.dust[rightDust].noGravity = true; @@ -220,7 +221,7 @@ namespace CalamityMod.NPCs.Ravager if (!rightClawActive) { - int rightDust = Dust.NewDust(new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 3f); + int rightDust = Dust.NewDust(new Vector2(NPC.Center.X + 80f, NPC.Center.Y + 45f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[rightDust].alpha += Main.rand.Next(100); Main.dust[rightDust].velocity *= 0.2f; @@ -230,7 +231,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.NextBool(10)) { - rightDust = Dust.NewDust(new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 2f); + rightDust = Dust.NewDust(new Vector2(NPC.Center.X + 80f, NPC.Center.Y + 45f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 2f); if (Main.rand.Next(20) != 0) { Main.dust[rightDust].noGravity = true; @@ -243,7 +244,7 @@ namespace CalamityMod.NPCs.Ravager if (!leftClawActive) { - int leftDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 3f); + int leftDust = Dust.NewDust(new Vector2(NPC.Center.X - 80f, NPC.Center.Y + 45f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 3f); Dust leftDustExpr = Main.dust[leftDust]; leftDustExpr.alpha += Main.rand.Next(100); leftDustExpr.velocity *= 0.2f; @@ -252,7 +253,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.NextBool(10)) { - leftDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 2f); + leftDust = Dust.NewDust(new Vector2(NPC.Center.X - 80f, NPC.Center.Y + 45f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 2f); if (Main.rand.Next(20) != 0) { Dust leftDustExpr2 = Main.dust[leftDust]; @@ -265,7 +266,7 @@ namespace CalamityMod.NPCs.Ravager if (!rightLegActive) { - int rightDust = Dust.NewDust(new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 2f); + int rightDust = Dust.NewDust(new Vector2(NPC.Center.X + 60f, NPC.Center.Y + 60f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 2f); Dust rightDustExpr = Main.dust[rightDust]; rightDustExpr.alpha += Main.rand.Next(100); rightDustExpr.velocity *= 0.2f; @@ -274,7 +275,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.NextBool(10)) { - rightDust = Dust.NewDust(new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 1.5f); + rightDust = Dust.NewDust(new Vector2(NPC.Center.X + 60f, NPC.Center.Y + 60f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 1.5f); if (Main.rand.Next(20) != 0) { Dust rightDustExpr2 = Main.dust[rightDust]; @@ -287,7 +288,7 @@ namespace CalamityMod.NPCs.Ravager if (!leftLegActive) { - int leftDust = Dust.NewDust(new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 2f); + int leftDust = Dust.NewDust(new Vector2(NPC.Center.X - 60f, NPC.Center.Y + 60f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[leftDust].alpha += Main.rand.Next(100); Main.dust[leftDust].velocity *= 0.2f; @@ -297,7 +298,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.NextBool(10)) { - leftDust = Dust.NewDust(new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 1.5f); + leftDust = Dust.NewDust(new Vector2(NPC.Center.X - 60f, NPC.Center.Y + 60f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 1.5f); if (Main.rand.Next(20) != 0) { Main.dust[leftDust].noGravity = true; @@ -308,56 +309,56 @@ namespace CalamityMod.NPCs.Ravager } } - if (npc.noTileCollide && !player.dead) + if (NPC.noTileCollide && !player.dead) { - if (npc.velocity.Y > 0f && npc.Bottom.Y > player.Top.Y) - npc.noTileCollide = false; - else if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.noTileCollide = false; + if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) + NPC.noTileCollide = false; + else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.noTileCollide = false; } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.velocity.X *= 0.8f; + NPC.velocity.X *= 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] > 0f) + NPC.ai[1] += 1f; + if (NPC.ai[1] > 0f) { if (revenge) { if (calamityGlobalNPC.newAI[0] % 3f == 0f) - npc.ai[1] += 1f; + NPC.ai[1] += 1f; else if (calamityGlobalNPC.newAI[0] % 2f == 0f) - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } if (!rightClawActive && !leftClawActive) - npc.ai[1] += 1f; + NPC.ai[1] += 1f; if (!headActive) - npc.ai[1] += 1f; + NPC.ai[1] += 1f; if (!rightLegActive && !leftLegActive) - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } float jumpGateValue = 180f; - if (npc.ai[1] >= jumpGateValue) + if (NPC.ai[1] >= jumpGateValue) { - npc.ai[1] = -20f; + NPC.ai[1] = -20f; } - else if (npc.ai[1] == -1f) + else if (NPC.ai[1] == -1f) { - npc.noTileCollide = true; + NPC.noTileCollide = true; - npc.TargetClosest(); + NPC.TargetClosest(); - bool shouldFall = player.position.Y >= npc.Bottom.Y; + bool shouldFall = player.position.Y >= NPC.Bottom.Y; float velocityXBoost = !anyHeadActive ? 6f : death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); float velocityX = 4f + velocityXBoost; velocityY = -16f; - float distanceBelowTarget = npc.position.Y - (player.position.Y + 80f); + float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); if (revenge) { @@ -395,27 +396,27 @@ namespace CalamityMod.NPCs.Ravager if (finalPhase) calamityGlobalNPC.newAI[2] = player.direction; - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; - npc.velocity.X = velocityX * npc.direction; - npc.velocity.Y = velocityY; + NPC.velocity.X = velocityX * NPC.direction; + NPC.velocity.Y = velocityY; - npc.ai[0] = finalPhase ? 2f : 1f; - npc.ai[1] = 0f; + NPC.ai[0] = finalPhase ? 2f : 1f; + NPC.ai[1] = 0f; } } CustomGravity(); } - else if (npc.ai[0] >= 1f) + else if (NPC.ai[0] >= 1f) { - if (npc.velocity.Y == 0f && (npc.ai[1] == 31f || npc.ai[0] == 1f)) + if (NPC.velocity.Y == 0f && (NPC.ai[1] == 31f || NPC.ai[0] == 1f)) { - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 14, 1.25f, -0.25f); + SoundEngine.PlaySound(SoundID.Item, (int)NPC.position.X, (int)NPC.position.Y, 14, 1.25f, -0.25f); - npc.ai[0] = 0f; - npc.ai[1] = 0f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -426,7 +427,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.npc[i].type == ModContent.NPCType() && Main.npc[i].ai[0] == 0f) { Main.npc[i].ai[1] = -1f; - Main.npc[i].direction = npc.direction; + Main.npc[i].direction = NPC.direction; Main.npc[i].netUpdate = true; } } @@ -452,17 +453,17 @@ namespace CalamityMod.NPCs.Ravager calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[3] = 0f; - npc.TargetClosest(); + NPC.TargetClosest(); - for (int stompDustArea = (int)npc.position.X - 30; stompDustArea < (int)npc.position.X + npc.width + 60; stompDustArea += 30) + for (int stompDustArea = (int)NPC.position.X - 30; stompDustArea < (int)NPC.position.X + NPC.width + 60; stompDustArea += 30) { for (int stompDustAmount = 0; stompDustAmount < 6; stompDustAmount++) { - int stompDust = Dust.NewDust(new Vector2(npc.position.X - 30f, npc.position.Y + npc.height), npc.width + 30, 4, 31, 0f, 0f, 100, default, 1.5f); + int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 30f, NPC.position.Y + NPC.height), NPC.width + 30, 4, 31, 0f, 0f, 100, default, 1.5f); Main.dust[stompDust].velocity *= 0.2f; } - int stompGore = Gore.NewGore(new Vector2(stompDustArea - 30, npc.position.Y + npc.height - 12f), default, Main.rand.Next(61, 64), 1f); + int stompGore = Gore.NewGore(new Vector2(stompDustArea - 30, NPC.position.Y + NPC.height - 12f), default, Main.rand.Next(61, 64), 1f); Main.gore[stompGore].velocity *= 0.4f; } } @@ -470,26 +471,26 @@ namespace CalamityMod.NPCs.Ravager { Vector2 targetVector = player.position; float aimY = targetVector.Y - 640f; - float distanceFromTargetPos = Math.Abs(npc.Top.Y - aimY); - bool inRange = npc.Top.Y <= aimY + 160f && npc.Top.Y >= aimY - 16f; + float distanceFromTargetPos = Math.Abs(NPC.Top.Y - aimY); + bool inRange = NPC.Top.Y <= aimY + 160f && NPC.Top.Y >= aimY - 16f; - if (phase2 && npc.ai[1] == 0f) + if (phase2 && NPC.ai[1] == 0f) { - npc.noTileCollide = true; + NPC.noTileCollide = true; calamityGlobalNPC.newAI[3] += 1f; if (inRange) - npc.velocity.Y = 0f; - else if (npc.Top.Y > aimY) - npc.velocity.Y -= 0.2f + distanceFromTargetPos * 0.001f; + NPC.velocity.Y = 0f; + else if (NPC.Top.Y > aimY) + NPC.velocity.Y -= 0.2f + distanceFromTargetPos * 0.001f; else - npc.velocity.Y += 0.2f + distanceFromTargetPos * 0.001f; + NPC.velocity.Y += 0.2f + distanceFromTargetPos * 0.001f; - if (npc.velocity.Y < velocityY) - npc.velocity.Y = velocityY; - if (npc.velocity.Y > -velocityY) - npc.velocity.Y = -velocityY; + if (NPC.velocity.Y < velocityY) + NPC.velocity.Y = velocityY; + if (NPC.velocity.Y > -velocityY) + NPC.velocity.Y = -velocityY; } float maxOffsetScale = death ? 320f : 240f; @@ -502,9 +503,9 @@ namespace CalamityMod.NPCs.Ravager else calamityGlobalNPC.newAI[2] = player.direction; - if ((npc.position.X < targetVector.X + offset && npc.position.X + npc.width > targetVector.X + player.width + offset && (inRange || npc.ai[0] != 2f)) || npc.ai[1] > 0f || calamityGlobalNPC.newAI[3] >= 180f) + if ((NPC.position.X < targetVector.X + offset && NPC.position.X + NPC.width > targetVector.X + player.width + offset && (inRange || NPC.ai[0] != 2f)) || NPC.ai[1] > 0f || calamityGlobalNPC.newAI[3] >= 180f) { - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; if (phase2) { @@ -514,10 +515,10 @@ namespace CalamityMod.NPCs.Ravager else if (expertMode) stopBeforeFallTime -= death ? 15f * (1f - lifeRatio) : 10f * (1f - lifeRatio); - if (npc.ai[1] < stopBeforeFallTime) + if (NPC.ai[1] < stopBeforeFallTime) { - npc.ai[1] += 1f; - npc.velocity = Vector2.Zero; + NPC.ai[1] += 1f; + NPC.velocity = Vector2.Zero; } else { @@ -527,16 +528,16 @@ namespace CalamityMod.NPCs.Ravager if (calamityGlobalNPC.newAI[1] > 1f) fallSpeed *= calamityGlobalNPC.newAI[1]; - npc.velocity.Y += fallSpeed; + NPC.velocity.Y += fallSpeed; - npc.ai[1] = 31f; + NPC.ai[1] = 31f; } } else { - npc.velocity.X *= 0.9f; + NPC.velocity.X *= 0.9f; - if (npc.Bottom.Y < player.position.Y) + if (NPC.Bottom.Y < player.position.Y) { float fallSpeedBoost = !anyHeadActive ? 0.9f : death ? 0.9f * (1f - lifeRatio) : 0.6f * (1f - lifeRatio); float fallSpeed = (malice ? 0.9f : 0.6f) + fallSpeedBoost; @@ -544,17 +545,17 @@ namespace CalamityMod.NPCs.Ravager if (calamityGlobalNPC.newAI[1] > 1f) fallSpeed *= calamityGlobalNPC.newAI[1]; - npc.velocity.Y += fallSpeed; + NPC.velocity.Y += fallSpeed; } } } else { float velocityMult = malice ? 2f : 1.8f; - float velocityXChange = 0.2f + Math.Abs(npc.Center.X - player.Center.X) * 0.001f; + float velocityXChange = 0.2f + Math.Abs(NPC.Center.X - player.Center.X) * 0.001f; float velocityXBoost = !anyHeadActive ? 6f : death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); - float velocityX = 8f + velocityXBoost + Math.Abs(npc.Center.X - player.Center.X) * 0.001f; + float velocityX = 8f + velocityXBoost + Math.Abs(NPC.Center.X - player.Center.X) * 0.001f; if (!rightClawActive) velocityX += 1f; @@ -569,20 +570,20 @@ namespace CalamityMod.NPCs.Ravager if (phase2) { - npc.damage = 0; + NPC.damage = 0; velocityXChange *= velocityMult; velocityX *= velocityMult; } - if (npc.direction < 0) - npc.velocity.X -= velocityXChange; - else if (npc.direction > 0) - npc.velocity.X += velocityXChange; + if (NPC.direction < 0) + NPC.velocity.X -= velocityXChange; + else if (NPC.direction > 0) + NPC.velocity.X += velocityXChange; - if (npc.velocity.X < -velocityX) - npc.velocity.X = -velocityX; - if (npc.velocity.X > velocityX) - npc.velocity.X = velocityX; + if (NPC.velocity.X < -velocityX) + NPC.velocity.X = -velocityX; + if (NPC.velocity.X > velocityX) + NPC.velocity.X = velocityX; } CustomGravity(); @@ -602,28 +603,28 @@ namespace CalamityMod.NPCs.Ravager if (calamityGlobalNPC.newAI[1] > 1f && !reduceFallSpeed) maxFallSpeed *= calamityGlobalNPC.newAI[1]; - npc.velocity.Y += gravity; - if (npc.velocity.Y > maxFallSpeed) - npc.velocity.Y = maxFallSpeed; + NPC.velocity.Y += gravity; + if (NPC.velocity.Y > maxFallSpeed) + NPC.velocity.Y = maxFallSpeed; } - player = Main.player[npc.target]; - if (npc.target <= 0 || npc.target == 255 || player.dead || !player.active) + player = Main.player[NPC.target]; + if (NPC.target <= 0 || NPC.target == 255 || player.dead || !player.active) { - npc.TargetClosest(); - player = Main.player[npc.target]; + NPC.TargetClosest(); + player = Main.player[NPC.target]; } int distanceFromTarget = player.dead ? 1600 : malice ? 8400 : 5600; - if (Vector2.Distance(npc.Center, player.Center) > distanceFromTarget) + if (Vector2.Distance(NPC.Center, player.Center) > distanceFromTarget) { - npc.TargetClosest(); - player = Main.player[npc.target]; + NPC.TargetClosest(); + player = Main.player[NPC.target]; - if (Vector2.Distance(npc.Center, player.Center) > distanceFromTarget) + if (Vector2.Distance(NPC.Center, player.Center) > distanceFromTarget) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; } } } @@ -631,57 +632,57 @@ namespace CalamityMod.NPCs.Ravager public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Width, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Height / Main.npcFrameCount[npc.type]) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Color.Blue); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerBodyGlow"), vector, - npc.frame, color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow").Height / Main.npcFrameCount[NPC.type]) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Blue); + spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerBodyGlow"), vector, + NPC.frame, color, NPC.rotation, vector11, 1f, spriteEffects, 0f); Color color2 = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerLegRight"), new Vector2(center.X - Main.screenPosition.X + 28f, center.Y - Main.screenPosition.Y + 20f), //72 - new Rectangle?(new Rectangle(0, 0, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerLegRight").Width, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerLegRight").Height)), + spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight"), new Vector2(center.X - Main.screenPosition.X + 28f, center.Y - Main.screenPosition.Y + 20f), //72 + new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight").Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegRight").Height)), color2, 0f, default, 1f, SpriteEffects.None, 0f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerLegLeft"), new Vector2(center.X - Main.screenPosition.X - 112f, center.Y - Main.screenPosition.Y + 20f), //72 - new Rectangle?(new Rectangle(0, 0, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerLegLeft").Width, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerLegLeft").Height)), + spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft"), new Vector2(center.X - Main.screenPosition.X - 112f, center.Y - Main.screenPosition.Y + 20f), //72 + new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft").Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerLegLeft").Height)), color2, 0f, default, 1f, SpriteEffects.None, 0f); if (NPC.AnyNPCs(ModContent.NPCType())) { - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerHead"), new Vector2(center.X - Main.screenPosition.X - 70f, center.Y - Main.screenPosition.Y - 75f), - new Rectangle?(new Rectangle(0, 0, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerHead").Width, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerHead").Height)), + spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead"), new Vector2(center.X - Main.screenPosition.X - 70f, center.Y - Main.screenPosition.Y - 75f), + new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead").Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerHead").Height)), color2, 0f, default, 1f, SpriteEffects.None, 0f); } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 2f); - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 2f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody5"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody5"), 1f); for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 2f); - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 5, hitDirection, -1f, 0, default, 2f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } } } @@ -689,15 +690,15 @@ namespace CalamityMod.NPCs.Ravager // Can only hit the target if within certain distance public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - Vector2 npcCenter = npc.Center; + Vector2 npcCenter = NPC.Center; // NOTE: Right and left hitboxes are interchangeable, each hitbox is the same size and is located to the right or left of the center hitbox. // Width = 83, Height = 107 - Rectangle leftHitbox = new Rectangle((int)(npcCenter.X - (npc.width / 2f) + 8f), (int)(npcCenter.Y - (npc.height / 4f)), npc.width / 4, npc.height / 2); + Rectangle leftHitbox = new Rectangle((int)(npcCenter.X - (NPC.width / 2f) + 8f), (int)(npcCenter.Y - (NPC.height / 4f)), NPC.width / 4, NPC.height / 2); // Width = 166, Height = 214 - Rectangle bodyHitbox = new Rectangle((int)(npcCenter.X - (npc.width / 4f)), (int)(npcCenter.Y - (npc.height / 2f) + 8f), npc.width / 2, npc.height); + Rectangle bodyHitbox = new Rectangle((int)(npcCenter.X - (NPC.width / 4f)), (int)(npcCenter.Y - (NPC.height / 2f) + 8f), NPC.width / 2, NPC.height); // Width = 83, Height = 107 - Rectangle rightHitbox = new Rectangle((int)(npcCenter.X + (npc.width / 4f) - 8f), (int)(npcCenter.Y - (npc.height / 4f)), npc.width / 4, npc.height / 2); + Rectangle rightHitbox = new Rectangle((int)(npcCenter.X + (NPC.width / 4f) - 8f), (int)(npcCenter.Y - (NPC.height / 4f)), NPC.width / 4, NPC.height / 2); Vector2 leftHitboxCenter = new Vector2(leftHitbox.X + (leftHitbox.Width / 2), leftHitbox.Y + (leftHitbox.Height / 2)); Vector2 bodyHitboxCenter = new Vector2(bodyHitbox.X + (bodyHitbox.Width / 2), bodyHitbox.Y + (bodyHitbox.Height / 2)); @@ -766,23 +767,23 @@ namespace CalamityMod.NPCs.Ravager public override void NPCLoot() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedScavenger); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedScavenger); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { // Materials - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !CalamityWorld.downedProvidence); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !CalamityWorld.downedProvidence); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -791,15 +792,15 @@ namespace CalamityMod.NPCs.Ravager ); // Equipment - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.downedProvidence); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, CalamityWorld.downedProvidence); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // Mark Ravager as dead CalamityWorld.downedScavenger = true; diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 75ac570620..64ec322860 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -19,66 +19,66 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.lavaImmune = true; - npc.aiStyle = -1; - npc.GetNPCDamage(); - npc.width = 80; - npc.height = 40; - npc.defense = 40; - npc.DR_NERD(0.15f); - npc.lifeMax = 12788; - npc.knockBackResist = 0f; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.lavaImmune = true; + NPC.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 80; + NPC.height = 40; + NPC.defense = 40; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 12788; + NPC.knockBackResist = 0f; aiType = -1; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.alpha = 255; - npc.netAlways = true; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; + NPC.noGravity = true; + NPC.canGhostHeal = false; + NPC.alpha = 255; + NPC.netAlways = true; + NPC.HitSound = SoundID.NPCHit41; + NPC.DeathSound = SoundID.NPCDeath14; if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.damage = (int)(npc.damage * 1.5); - npc.defense *= 2; - npc.lifeMax *= 4; + NPC.damage = (int)(NPC.damage * 1.5); + NPC.defense *= 2; + NPC.lifeMax *= 4; } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 26000; + NPC.lifeMax = 26000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - if (npc.timeLeft < 1800) + if (NPC.timeLeft < 1800) { - npc.timeLeft = 1800; + NPC.timeLeft = 1800; } - if (npc.alpha > 0) + if (NPC.alpha > 0) { - npc.alpha -= 10; - if (npc.alpha < 0) + NPC.alpha -= 10; + if (NPC.alpha < 0) { - npc.alpha = 0; + NPC.alpha = 0; } - npc.ai[1] = -90f; + NPC.ai[1] = -90f; } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.noTileCollide = true; + NPC.noTileCollide = true; float num659 = 36f; - Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector79 = new Vector2(NPC.Center.X, NPC.Center.Y); float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; num660 -= 120f; @@ -86,102 +86,102 @@ namespace CalamityMod.NPCs.Ravager float num662 = (float)Math.Sqrt(num660 * num660 + num661 * num661); if (num662 < 12f + num659) { - npc.rotation = 0f; - npc.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(-120f, 50f); - npc.ai[1] += 1f; - if (npc.life < npc.lifeMax / 2 || death) + NPC.rotation = 0f; + NPC.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(-120f, 50f); + NPC.ai[1] += 1f; + if (NPC.life < NPC.lifeMax / 2 || death) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } - if (npc.life < npc.lifeMax / 3 || death) + if (NPC.life < NPC.lifeMax / 3 || death) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } - if (npc.life < npc.lifeMax / 5 || death) + if (NPC.life < NPC.lifeMax / 5 || death) { - npc.ai[1] += 5f; + NPC.ai[1] += 5f; } - if (npc.ai[1] >= 60f) + if (NPC.ai[1] >= 60f) { // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - if (npc.Center.X + 100f > Main.player[npc.target].Center.X) + if (NPC.Center.X + 100f > Main.player[NPC.target].Center.X) { - npc.ai[1] = 0f; - npc.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[0] = 1f; return; } - npc.ai[1] = 0f; + NPC.ai[1] = 0f; return; } } else { num662 = num659 / num662; - npc.velocity.X = num660 * num662; - npc.velocity.Y = num661 * num662; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity.X = num660 * num662; + NPC.velocity.Y = num661 * num662; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - npc.noTileCollide = true; - npc.collideX = false; - npc.collideY = false; + NPC.noTileCollide = true; + NPC.collideX = false; + NPC.collideY = false; float num663 = 12f; - if (npc.life < npc.lifeMax / 2 || death) + if (NPC.life < NPC.lifeMax / 2 || death) { num663 += 2f; } - if (npc.life < npc.lifeMax / 3 || death) + if (NPC.life < NPC.lifeMax / 3 || death) { num663 += 2f; } - if (npc.life < npc.lifeMax / 5 || death) + if (NPC.life < NPC.lifeMax / 5 || death) { num663 += 5f; } - Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); - float num664 = Main.player[npc.target].Center.X - vector80.X; - float num665 = Main.player[npc.target].Center.Y - vector80.Y; + Vector2 vector80 = new Vector2(NPC.Center.X, NPC.Center.Y); + float num664 = Main.player[NPC.target].Center.X - vector80.X; + float num665 = Main.player[NPC.target].Center.Y - vector80.Y; float num666 = (float)Math.Sqrt(num664 * num664 + num665 * num665); num666 = num663 / num666; - npc.velocity.X = num664 * num666; - npc.velocity.Y = num665 * num666; - npc.ai[0] = 2f; - npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); + NPC.velocity.X = num664 * num666; + NPC.velocity.Y = num665 * num666; + NPC.ai[0] = 2f; + NPC.rotation = (float)Math.Atan2(-NPC.velocity.Y, -NPC.velocity.X); } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + if (Math.Abs(NPC.velocity.X) > Math.Abs(NPC.velocity.Y)) { - if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) + if (NPC.velocity.X > 0f && NPC.Center.X > Main.player[NPC.target].Center.X) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } - if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) + if (NPC.velocity.X < 0f && NPC.Center.X < Main.player[NPC.target].Center.X) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } } else { - if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) + if (NPC.velocity.Y > 0f && NPC.Center.Y > Main.player[NPC.target].Center.Y) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } - if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) + if (NPC.velocity.Y < 0f && NPC.Center.Y < Main.player[NPC.target].Center.Y) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } } - Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector81 = new Vector2(NPC.Center.X, NPC.Center.Y); float num667 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector81.X; float num668 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector81.Y; num667 += Main.npc[CalamityGlobalNPC.scavenger].velocity.X; @@ -189,63 +189,63 @@ namespace CalamityMod.NPCs.Ravager num668 += 40f; num667 -= 110f; float num669 = (float)Math.Sqrt(num667 * num667 + num668 * num668); - if ((num669 > (death ? 900f : 700f) || npc.collideX || npc.collideY) | npc.justHit) + if ((num669 > (death ? 900f : 700f) || NPC.collideX || NPC.collideY) | NPC.justHit) { - npc.noTileCollide = true; - npc.ai[0] = 0f; + NPC.noTileCollide = true; + NPC.ai[0] = 0f; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - npc.noTileCollide = true; + NPC.noTileCollide = true; float num671 = 12f; float num672 = 0.4f; - Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); - float num673 = Main.player[npc.target].Center.X - vector82.X; - float num674 = Main.player[npc.target].Center.Y - vector82.Y; + Vector2 vector82 = new Vector2(NPC.Center.X, NPC.Center.Y); + float num673 = Main.player[NPC.target].Center.X - vector82.X; + float num674 = Main.player[NPC.target].Center.Y - vector82.Y; float num675 = (float)Math.Sqrt(num673 * num673 + num674 * num674); num675 = num671 / num675; num673 *= num675; num674 *= num675; - if (npc.velocity.X < num673) + if (NPC.velocity.X < num673) { - npc.velocity.X += num672; - if (npc.velocity.X < 0f && num673 > 0f) + NPC.velocity.X += num672; + if (NPC.velocity.X < 0f && num673 > 0f) { - npc.velocity.X += num672 * 2f; + NPC.velocity.X += num672 * 2f; } } - else if (npc.velocity.X > num673) + else if (NPC.velocity.X > num673) { - npc.velocity.X -= num672; - if (npc.velocity.X > 0f && num673 < 0f) + NPC.velocity.X -= num672; + if (NPC.velocity.X > 0f && num673 < 0f) { - npc.velocity.X -= num672 * 2f; + NPC.velocity.X -= num672 * 2f; } } - if (npc.velocity.Y < num674) + if (NPC.velocity.Y < num674) { - npc.velocity.Y += num672; - if (npc.velocity.Y < 0f && num674 > 0f) + NPC.velocity.Y += num672; + if (NPC.velocity.Y < 0f && num674 > 0f) { - npc.velocity.Y += num672 * 2f; + NPC.velocity.Y += num672 * 2f; } } - else if (npc.velocity.Y > num674) + else if (NPC.velocity.Y > num674) { - npc.velocity.Y -= num672; - if (npc.velocity.Y > 0f && num674 < 0f) + NPC.velocity.Y -= num672; + if (NPC.velocity.Y > 0f && num674 < 0f) { - npc.velocity.Y -= num672 * 2f; + NPC.velocity.Y -= num672 * 2f; } } - npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); + NPC.rotation = (float)Math.Atan2(-NPC.velocity.Y, -NPC.velocity.X); } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); float drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; float drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; drawPositionY += 12f; @@ -271,9 +271,9 @@ namespace CalamityMod.NPCs.Ravager drawPositionY += 12f; drawPositionX -= 28f; Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), - new Rectangle?(new Rectangle(0, 0, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Width, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Height)), color, rotation, - new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Width * 0.5f, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), + new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Height)), color, rotation, + new Vector2(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Width * 0.5f, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); } } return true; @@ -293,20 +293,20 @@ namespace CalamityMod.NPCs.Ravager public override void HitEffect(int hitDirection, double damage) { - if (npc.life > 0) + if (NPC.life > 0) { int num285 = 0; - while (num285 < damage / npc.lifeMax * 100.0) + while (num285 < damage / NPC.lifeMax * 100.0) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); num285++; } } else { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft3"), 1f); } } } diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index d823b8b155..61b0430380 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -19,66 +19,66 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.lavaImmune = true; - npc.aiStyle = -1; - npc.GetNPCDamage(); - npc.width = 80; - npc.height = 40; - npc.defense = 40; - npc.DR_NERD(0.15f); - npc.lifeMax = 12788; - npc.knockBackResist = 0f; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.lavaImmune = true; + NPC.aiStyle = -1; + NPC.GetNPCDamage(); + NPC.width = 80; + NPC.height = 40; + NPC.defense = 40; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 12788; + NPC.knockBackResist = 0f; aiType = -1; - npc.netAlways = true; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.alpha = 255; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.noGravity = true; + NPC.canGhostHeal = false; + NPC.alpha = 255; + NPC.HitSound = SoundID.NPCHit41; + NPC.DeathSound = SoundID.NPCDeath14; if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.damage = (int)(npc.damage * 1.5); - npc.defense *= 2; - npc.lifeMax *= 4; + NPC.damage = (int)(NPC.damage * 1.5); + NPC.defense *= 2; + NPC.lifeMax *= 4; } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 26000; + NPC.lifeMax = 26000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - if (npc.timeLeft < 1800) + if (NPC.timeLeft < 1800) { - npc.timeLeft = 1800; + NPC.timeLeft = 1800; } - if (npc.alpha > 0) + if (NPC.alpha > 0) { - npc.alpha -= 10; - if (npc.alpha < 0) + NPC.alpha -= 10; + if (NPC.alpha < 0) { - npc.alpha = 0; + NPC.alpha = 0; } - npc.ai[1] = -90f; + NPC.ai[1] = -90f; } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.noTileCollide = true; + NPC.noTileCollide = true; float num659 = 36f; - Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector79 = new Vector2(NPC.Center.X, NPC.Center.Y); float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; num660 += 120f; @@ -86,102 +86,102 @@ namespace CalamityMod.NPCs.Ravager float num662 = (float)Math.Sqrt(num660 * num660 + num661 * num661); if (num662 < 12f + num659) { - npc.rotation = 0f; - npc.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(120f, 50f); - npc.ai[1] += 1f; - if (npc.life < npc.lifeMax / 2 || death) + NPC.rotation = 0f; + NPC.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(120f, 50f); + NPC.ai[1] += 1f; + if (NPC.life < NPC.lifeMax / 2 || death) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } - if (npc.life < npc.lifeMax / 3 || death) + if (NPC.life < NPC.lifeMax / 3 || death) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } - if (npc.life < npc.lifeMax / 5 || death) + if (NPC.life < NPC.lifeMax / 5 || death) { - npc.ai[1] += 5f; + NPC.ai[1] += 5f; } - if (npc.ai[1] >= 60f) + if (NPC.ai[1] >= 60f) { // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - if (npc.Center.X - 100f < Main.player[npc.target].Center.X) + if (NPC.Center.X - 100f < Main.player[NPC.target].Center.X) { - npc.ai[1] = 0f; - npc.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[0] = 1f; return; } - npc.ai[1] = 0f; + NPC.ai[1] = 0f; return; } } else { num662 = num659 / num662; - npc.velocity.X = num660 * num662; - npc.velocity.Y = num661 * num662; - npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); + NPC.velocity.X = num660 * num662; + NPC.velocity.Y = num661 * num662; + NPC.rotation = (float)Math.Atan2(-NPC.velocity.Y, -NPC.velocity.X); } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - npc.noTileCollide = true; - npc.collideX = false; - npc.collideY = false; + NPC.noTileCollide = true; + NPC.collideX = false; + NPC.collideY = false; float num663 = 12f; - if (npc.life < npc.lifeMax / 2 || death) + if (NPC.life < NPC.lifeMax / 2 || death) { num663 += 2f; } - if (npc.life < npc.lifeMax / 3 || death) + if (NPC.life < NPC.lifeMax / 3 || death) { num663 += 2f; } - if (npc.life < npc.lifeMax / 5 || death) + if (NPC.life < NPC.lifeMax / 5 || death) { num663 += 5f; } - Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); - float num664 = Main.player[npc.target].Center.X - vector80.X; - float num665 = Main.player[npc.target].Center.Y - vector80.Y; + Vector2 vector80 = new Vector2(NPC.Center.X, NPC.Center.Y); + float num664 = Main.player[NPC.target].Center.X - vector80.X; + float num665 = Main.player[NPC.target].Center.Y - vector80.Y; float num666 = (float)Math.Sqrt(num664 * num664 + num665 * num665); num666 = num663 / num666; - npc.velocity.X = num664 * num666; - npc.velocity.Y = num665 * num666; - npc.ai[0] = 2f; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity.X = num664 * num666; + NPC.velocity.Y = num665 * num666; + NPC.ai[0] = 2f; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + if (Math.Abs(NPC.velocity.X) > Math.Abs(NPC.velocity.Y)) { - if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) + if (NPC.velocity.X > 0f && NPC.Center.X > Main.player[NPC.target].Center.X) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } - if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) + if (NPC.velocity.X < 0f && NPC.Center.X < Main.player[NPC.target].Center.X) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } } else { - if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) + if (NPC.velocity.Y > 0f && NPC.Center.Y > Main.player[NPC.target].Center.Y) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } - if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) + if (NPC.velocity.Y < 0f && NPC.Center.Y < Main.player[NPC.target].Center.Y) { - npc.noTileCollide = false; + NPC.noTileCollide = false; } } - Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector81 = new Vector2(NPC.Center.X, NPC.Center.Y); float num667 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector81.X; float num668 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector81.Y; num667 += Main.npc[CalamityGlobalNPC.scavenger].velocity.X; @@ -189,63 +189,63 @@ namespace CalamityMod.NPCs.Ravager num668 += 40f; num667 += 110f; float num669 = (float)Math.Sqrt(num667 * num667 + num668 * num668); - if ((num669 > (death ? 900f : 700f) || npc.collideX || npc.collideY) | npc.justHit) + if ((num669 > (death ? 900f : 700f) || NPC.collideX || NPC.collideY) | NPC.justHit) { - npc.noTileCollide = true; - npc.ai[0] = 0f; + NPC.noTileCollide = true; + NPC.ai[0] = 0f; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - npc.noTileCollide = true; + NPC.noTileCollide = true; float num671 = 12f; float num672 = 0.4f; - Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); - float num673 = Main.player[npc.target].Center.X - vector82.X; - float num674 = Main.player[npc.target].Center.Y - vector82.Y; + Vector2 vector82 = new Vector2(NPC.Center.X, NPC.Center.Y); + float num673 = Main.player[NPC.target].Center.X - vector82.X; + float num674 = Main.player[NPC.target].Center.Y - vector82.Y; float num675 = (float)Math.Sqrt(num673 * num673 + num674 * num674); num675 = num671 / num675; num673 *= num675; num674 *= num675; - if (npc.velocity.X < num673) + if (NPC.velocity.X < num673) { - npc.velocity.X += num672; - if (npc.velocity.X < 0f && num673 > 0f) + NPC.velocity.X += num672; + if (NPC.velocity.X < 0f && num673 > 0f) { - npc.velocity.X += num672 * 2f; + NPC.velocity.X += num672 * 2f; } } - else if (npc.velocity.X > num673) + else if (NPC.velocity.X > num673) { - npc.velocity.X -= num672; - if (npc.velocity.X > 0f && num673 < 0f) + NPC.velocity.X -= num672; + if (NPC.velocity.X > 0f && num673 < 0f) { - npc.velocity.X -= num672 * 2f; + NPC.velocity.X -= num672 * 2f; } } - if (npc.velocity.Y < num674) + if (NPC.velocity.Y < num674) { - npc.velocity.Y += num672; - if (npc.velocity.Y < 0f && num674 > 0f) + NPC.velocity.Y += num672; + if (NPC.velocity.Y < 0f && num674 > 0f) { - npc.velocity.Y += num672 * 2f; + NPC.velocity.Y += num672 * 2f; } } - else if (npc.velocity.Y > num674) + else if (NPC.velocity.Y > num674) { - npc.velocity.Y -= num672; - if (npc.velocity.Y > 0f && num674 < 0f) + NPC.velocity.Y -= num672; + if (NPC.velocity.Y > 0f && num674 < 0f) { - npc.velocity.Y -= num672 * 2f; + NPC.velocity.Y -= num672 * 2f; } } - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); float drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; float drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; drawPositionY += 12f; @@ -271,9 +271,9 @@ namespace CalamityMod.NPCs.Ravager drawPositionY += 12f; drawPositionX += 28f; Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), - new Rectangle?(new Rectangle(0, 0, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Width, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Height)), color, rotation, - new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Width * 0.5f, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), + new Rectangle?(new Rectangle(0, 0, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Width, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Height)), color, rotation, + new Vector2(ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Width * 0.5f, ModContent.Request("CalamityMod/NPCs/Ravager/RavagerChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); } } return true; @@ -293,19 +293,19 @@ namespace CalamityMod.NPCs.Ravager public override void HitEffect(int hitDirection, double damage) { - if (npc.life > 0) + if (NPC.life > 0) { int num285 = 0; - while (num285 < damage / npc.lifeMax * 100.0) + while (num285 < damage / NPC.lifeMax * 100.0) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); num285++; } } else { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawRight"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawRight2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawRight"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawRight2"), 1f); } } } diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index 02c128b05e..94ee0c5cf4 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Ravager { @@ -17,43 +18,43 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { - npc.aiStyle = -1; - npc.damage = 50; - npc.width = 80; - npc.height = 80; - npc.defense = 40; - npc.DR_NERD(0.15f); - npc.lifeMax = 19182; - npc.knockBackResist = 0f; + NPC.aiStyle = -1; + NPC.damage = 50; + NPC.width = 80; + NPC.height = 80; + NPC.defense = 40; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 19182; + NPC.knockBackResist = 0f; aiType = -1; - npc.netAlways = true; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.alpha = 255; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = null; + NPC.netAlways = true; + NPC.noGravity = true; + NPC.canGhostHeal = false; + NPC.noTileCollide = true; + NPC.alpha = 255; + NPC.HitSound = SoundID.NPCHit41; + NPC.DeathSound = null; if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.defense *= 2; - npc.lifeMax *= 4; + NPC.defense *= 2; + NPC.lifeMax *= 4; } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 45000; + NPC.lifeMax = 45000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } @@ -61,41 +62,41 @@ namespace CalamityMod.NPCs.Ravager bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - npc.damage = 0; + NPC.damage = 0; - if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; - npc.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(1f, -20f); + NPC.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(1f, -20f); - if (npc.alpha > 0) + if (NPC.alpha > 0) { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 10; + if (NPC.alpha < 0) + NPC.alpha = 0; } - npc.ai[1] += 1f; - if (npc.ai[1] >= (death ? 420f : 480f)) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= (death ? 420f : 480f)) { - Main.PlaySound(SoundID.Item62, npc.position); + SoundEngine.PlaySound(SoundID.Item62, NPC.position); // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - npc.ai[1] = 0f; + NPC.ai[1] = 0f; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 shootFromVector = new Vector2(npc.Center.X, npc.Center.Y - 20f); + Vector2 shootFromVector = new Vector2(NPC.Center.X, NPC.Center.Y - 20f); Vector2 velocity = new Vector2(0f, -15f); - int nuke = Projectile.NewProjectile(shootFromVector, velocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, npc.target, 0f); + int nuke = Projectile.NewProjectile(shootFromVector, velocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, NPC.target, 0f); Main.projectile[nuke].velocity.Y = -15f; } } @@ -107,18 +108,18 @@ namespace CalamityMod.NPCs.Ravager public override void HitEffect(int hitDirection, double damage) { - if (npc.life > 0) + if (NPC.life > 0) { int num285 = 0; - while ((double)num285 < damage / (double)npc.lifeMax * 100.0) + while ((double)num285 < damage / (double)NPC.lifeMax * 100.0) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, (float)hitDirection, -1f, 0, default, 1f); num285++; } } else if (Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); + NPC.NewNPC((int)NPC.Center.X, (int)NPC.position.Y + NPC.height, ModContent.NPCType(), NPC.whoAmI); } } } diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index c7ca017050..b078ed722d 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Ravager { @@ -18,48 +19,48 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { - npc.aiStyle = -1; - npc.damage = 50; - npc.width = 80; - npc.height = 80; - npc.defense = 40; - npc.DR_NERD(0.15f); - npc.lifeMax = 9591; - npc.knockBackResist = 0f; + NPC.aiStyle = -1; + NPC.damage = 50; + NPC.width = 80; + NPC.height = 80; + NPC.defense = 40; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 9591; + NPC.knockBackResist = 0f; aiType = -1; - npc.netAlways = true; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.noGravity = true; + NPC.canGhostHeal = false; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit41; + NPC.DeathSound = SoundID.NPCDeath14; if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.defense *= 2; - npc.lifeMax *= 4; + NPC.defense *= 2; + NPC.lifeMax *= 4; } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 22500; + NPC.lifeMax = 22500; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { - npc.life = 0; - HitEffect(npc.direction, 9999); - npc.netUpdate = true; + NPC.life = 0; + HitEffect(NPC.direction, 9999); + NPC.netUpdate = true; return; } // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - npc.damage = 0; + NPC.damage = 0; Player player = Main.player[Main.npc[CalamityGlobalNPC.scavenger].target]; @@ -67,12 +68,12 @@ namespace CalamityMod.NPCs.Ravager bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; - if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; // Rotation - float num801 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); - float num802 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); + float num801 = NPC.position.X + (NPC.width / 2) - player.position.X - (player.width / 2); + float num802 = NPC.position.Y + NPC.height - 59f - player.position.Y - (player.height / 2); float num803 = (float)Math.Atan2(num802, num801) + MathHelper.PiOver2; if (num803 < 0f) num803 += MathHelper.TwoPi; @@ -80,59 +81,59 @@ namespace CalamityMod.NPCs.Ravager num803 -= MathHelper.TwoPi; float num804 = 0.1f; - if (npc.rotation < num803) + if (NPC.rotation < num803) { - if ((num803 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num804; + if ((num803 - NPC.rotation) > MathHelper.Pi) + NPC.rotation -= num804; else - npc.rotation += num804; + NPC.rotation += num804; } - else if (npc.rotation > num803) + else if (NPC.rotation > num803) { - if ((npc.rotation - num803) > MathHelper.Pi) - npc.rotation += num804; + if ((NPC.rotation - num803) > MathHelper.Pi) + NPC.rotation += num804; else - npc.rotation -= num804; + NPC.rotation -= num804; } - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - npc.rotation = num803; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - npc.rotation = num803; + if (NPC.rotation > num803 - num804 && NPC.rotation < num803 + num804) + NPC.rotation = num803; + if (NPC.rotation < 0f) + NPC.rotation += MathHelper.TwoPi; + else if (NPC.rotation > MathHelper.TwoPi) + NPC.rotation -= MathHelper.TwoPi; + if (NPC.rotation > num803 - num804 && NPC.rotation < num803 + num804) + NPC.rotation = num803; - npc.ai[1] += 1f; - bool fireProjectiles = npc.ai[1] >= (malice ? 240f : 480f); - if (fireProjectiles && Vector2.Distance(npc.Center, player.Center) > 80f) + NPC.ai[1] += 1f; + bool fireProjectiles = NPC.ai[1] >= (malice ? 240f : 480f); + if (fireProjectiles && Vector2.Distance(NPC.Center, player.Center) > 80f) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float projectileVelocity = death ? 8f : 6f; - if (npc.ai[1] >= 600f) + if (NPC.ai[1] >= 600f) { - npc.ai[0] += 1f; - npc.ai[1] = 0f; + NPC.ai[0] += 1f; + NPC.ai[1] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(SoundID.Item62, npc.position); + SoundEngine.PlaySound(SoundID.Item62, NPC.position); type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center, Vector2.Normalize(player.Center - npc.Center) * projectileVelocity * 0.25f, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, Main.npc[CalamityGlobalNPC.scavenger].target, 0f); + damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity * 0.25f, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, Main.npc[CalamityGlobalNPC.scavenger].target, 0f); } } else { - if (npc.ai[1] % 40f == 0f) + if (NPC.ai[1] % 40f == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(SoundID.Item33, npc.position); - Projectile.NewProjectile(npc.Center, Vector2.Normalize(player.Center - npc.Center) * projectileVelocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, -1f); + SoundEngine.PlaySound(SoundID.Item33, NPC.position); + Projectile.NewProjectile(NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, -1f); } } } @@ -151,8 +152,8 @@ namespace CalamityMod.NPCs.Ravager num824 *= 1.25f; } - Vector2 vector82 = npc.Center; - float distanceX = npc.ai[0] % 2f == 0f ? 480f : -480f; + Vector2 vector82 = NPC.Center; + float distanceX = NPC.ai[0] % 2f == 0f ? 480f : -480f; float distanceY = fireProjectiles ? -320f : 320f; float num825 = player.Center.X + (fireProjectiles ? distanceX : 0f) - vector82.X; float num826 = player.Center.Y + distanceY - vector82.Y; @@ -161,29 +162,29 @@ namespace CalamityMod.NPCs.Ravager num825 *= num827; num826 *= num827; - if (npc.velocity.X < num825) + if (NPC.velocity.X < num825) { - npc.velocity.X += num824; - if (npc.velocity.X < 0f && num825 > 0f) - npc.velocity.X += num824; + NPC.velocity.X += num824; + if (NPC.velocity.X < 0f && num825 > 0f) + NPC.velocity.X += num824; } - else if (npc.velocity.X > num825) + else if (NPC.velocity.X > num825) { - npc.velocity.X -= num824; - if (npc.velocity.X > 0f && num825 < 0f) - npc.velocity.X -= num824; + NPC.velocity.X -= num824; + if (NPC.velocity.X > 0f && num825 < 0f) + NPC.velocity.X -= num824; } - if (npc.velocity.Y < num826) + if (NPC.velocity.Y < num826) { - npc.velocity.Y += num824; - if (npc.velocity.Y < 0f && num826 > 0f) - npc.velocity.Y += num824; + NPC.velocity.Y += num824; + if (NPC.velocity.Y < 0f && num826 > 0f) + NPC.velocity.Y += num824; } - else if (npc.velocity.Y > num826) + else if (NPC.velocity.Y > num826) { - npc.velocity.Y -= num824; - if (npc.velocity.Y > 0f && num826 < 0f) - npc.velocity.Y -= num824; + NPC.velocity.Y -= num824; + if (NPC.velocity.Y > 0f && num826 < 0f) + NPC.velocity.Y -= num824; } } @@ -191,18 +192,18 @@ namespace CalamityMod.NPCs.Ravager { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead3"), 1f); for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 5543c05d4a..4c4ff9a1d6 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -16,59 +16,59 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { - npc.aiStyle = -1; - npc.damage = 50; - npc.width = 60; - npc.height = 60; - npc.defense = 40; - npc.DR_NERD(0.15f); - npc.lifeMax = 12788; - npc.knockBackResist = 0f; + NPC.aiStyle = -1; + NPC.damage = 50; + NPC.width = 60; + NPC.height = 60; + NPC.defense = 40; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 12788; + NPC.knockBackResist = 0f; aiType = -1; - npc.netAlways = true; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.alpha = 255; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.noGravity = true; + NPC.canGhostHeal = false; + NPC.noTileCollide = true; + NPC.alpha = 255; + NPC.HitSound = SoundID.NPCHit41; + NPC.DeathSound = SoundID.NPCDeath14; if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.defense *= 2; - npc.lifeMax *= 4; + NPC.defense *= 2; + NPC.lifeMax *= 4; } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 40000; + NPC.lifeMax = 40000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - npc.damage = 0; + NPC.damage = 0; - if (npc.alpha > 0) + if (NPC.alpha > 0) { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 10; + if (NPC.alpha < 0) + NPC.alpha = 0; - npc.ai[1] = 0f; + NPC.ai[1] = 0f; } - npc.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(-70f, 88f); + NPC.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(-70f, 88f); } public override bool CheckActive() => false; @@ -77,17 +77,17 @@ namespace CalamityMod.NPCs.Ravager { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft2"), 1f); for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index a5748c75c5..0172efcb66 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -16,59 +16,59 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { - npc.aiStyle = -1; - npc.damage = 50; - npc.width = 60; - npc.height = 60; - npc.defense = 40; - npc.DR_NERD(0.15f); - npc.lifeMax = 12788; - npc.knockBackResist = 0f; + NPC.aiStyle = -1; + NPC.damage = 50; + NPC.width = 60; + NPC.height = 60; + NPC.defense = 40; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 12788; + NPC.knockBackResist = 0f; aiType = -1; - npc.netAlways = true; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.alpha = 255; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; + NPC.netAlways = true; + NPC.noGravity = true; + NPC.canGhostHeal = false; + NPC.noTileCollide = true; + NPC.alpha = 255; + NPC.HitSound = SoundID.NPCHit41; + NPC.DeathSound = SoundID.NPCDeath14; if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.defense *= 2; - npc.lifeMax *= 4; + NPC.defense *= 2; + NPC.lifeMax *= 4; } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 40000; + NPC.lifeMax = 40000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - npc.damage = 0; + NPC.damage = 0; - if (npc.alpha > 0) + if (NPC.alpha > 0) { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 10; + if (NPC.alpha < 0) + NPC.alpha = 0; - npc.ai[1] = 0f; + NPC.ai[1] = 0f; } - npc.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(70f, 88f); + NPC.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(70f, 88f); } public override bool CheckActive() => false; @@ -77,17 +77,17 @@ namespace CalamityMod.NPCs.Ravager { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegRight"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegRight2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegRight"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegRight2"), 1f); for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index c00a0b32aa..e792b1c754 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Ravager { @@ -17,65 +18,65 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.width = 60; - npc.height = 300; - npc.defense = 50; - npc.DR_NERD(0.3f); - npc.chaseable = false; - npc.canGhostHeal = false; - npc.lifeMax = CalamityWorld.downedProvidence ? 20000 : 5000; - npc.alpha = 255; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.width = 60; + NPC.height = 300; + NPC.defense = 50; + NPC.DR_NERD(0.3f); + NPC.chaseable = false; + NPC.canGhostHeal = false; + NPC.lifeMax = CalamityWorld.downedProvidence ? 20000 : 5000; + NPC.alpha = 255; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToWater = true; + NPC.knockBackResist = 0f; + NPC.HitSound = SoundID.NPCHit41; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; } public override void AI() { if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { - npc.life = 0; - HitEffect(npc.direction, 9999); - npc.netUpdate = true; + NPC.life = 0; + HitEffect(NPC.direction, 9999); + NPC.netUpdate = true; return; } - if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; - if (npc.alpha > 0) + if (NPC.alpha > 0) { - npc.damage = 0; + NPC.damage = 0; - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 10; + if (NPC.alpha < 0) + NPC.alpha = 0; } else { if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) - npc.damage = (int)(npc.defDamage * 1.5); + NPC.damage = (int)(NPC.defDamage * 1.5); else - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - if (npc.ai[1] == -1f) + if (NPC.ai[1] == -1f) { - Main.PlaySound(SoundID.Item62, npc.position); + SoundEngine.PlaySound(SoundID.Item62, NPC.position); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -85,38 +86,38 @@ namespace CalamityMod.NPCs.Ravager } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Stone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - npc.noTileCollide = true; - npc.velocity.X = ((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 15 : 12) * npc.direction; - npc.velocity.Y = -28.5f; - npc.ai[0] = 1f; - npc.ai[1] = 0f; + NPC.noTileCollide = true; + NPC.velocity.X = ((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 15 : 12) * NPC.direction; + NPC.velocity.Y = -28.5f; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; } } } else { - if (npc.velocity.Y == 0f || Vector2.Distance(npc.Center, Main.npc[CalamityGlobalNPC.scavenger].Center) > 2800f) + if (NPC.velocity.Y == 0f || Vector2.Distance(NPC.Center, Main.npc[CalamityGlobalNPC.scavenger].Center) > 2800f) { - Main.PlaySound(SoundID.Item14, npc.position); - npc.ai[0] = 0f; - npc.life = 0; - HitEffect(npc.direction, 9999); - npc.netUpdate = true; + SoundEngine.PlaySound(SoundID.Item14, NPC.position); + NPC.ai[0] = 0f; + NPC.life = 0; + HitEffect(NPC.direction, 9999); + NPC.netUpdate = true; return; } else { - npc.velocity.Y += 0.2f; + NPC.velocity.Y += 0.2f; - if (npc.velocity.Y >= 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.noTileCollide = false; + if (NPC.velocity.Y >= 0f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.noTileCollide = false; } } } @@ -128,26 +129,26 @@ namespace CalamityMod.NPCs.Ravager public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180, true); - Main.PlaySound(SoundID.Item14, npc.position); - npc.ai[0] = 0f; - npc.life = 0; - HitEffect(npc.direction, 9999); - npc.netUpdate = true; + SoundEngine.PlaySound(SoundID.Item14, NPC.position); + NPC.ai[0] = 0f; + NPC.life = 0; + HitEffect(NPC.direction, 9999); + NPC.netUpdate = true; } public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 80; - npc.height = 360; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 80; + NPC.height = 360; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 30; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -157,31 +158,31 @@ namespace CalamityMod.NPCs.Ravager } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Stone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - float y = npc.height / 6f; + float y = NPC.height / 6f; float randomVelocityScale = 0.25f; for (int i = 0; i < 2; i++) { - Vector2 randomVelocity = npc.velocity * Main.rand.NextFloat() * randomVelocityScale; - Gore.NewGore(npc.position, npc.velocity + randomVelocity, mod.GetGoreSlot("Gores/ScavengerGores/RockPillar"), 1f); - Gore.NewGore(npc.position + Vector2.UnitY * y, npc.velocity + randomVelocity, mod.GetGoreSlot("Gores/ScavengerGores/RockPillar2"), 1f); - Gore.NewGore(npc.position + Vector2.UnitY * y * 2f, npc.velocity + randomVelocity, mod.GetGoreSlot("Gores/ScavengerGores/RockPillar3"), 1f); - Gore.NewGore(npc.position + Vector2.UnitY * y * 3f, npc.velocity + randomVelocity, mod.GetGoreSlot("Gores/ScavengerGores/RockPillar4"), 1f); - Gore.NewGore(npc.position + Vector2.UnitY * y * 4f, npc.velocity + randomVelocity, mod.GetGoreSlot("Gores/ScavengerGores/RockPillar5"), 1f); - Gore.NewGore(npc.position + Vector2.UnitY * y * 5f, npc.velocity + randomVelocity, mod.GetGoreSlot("Gores/ScavengerGores/RockPillar6"), 1f); + Vector2 randomVelocity = NPC.velocity * Main.rand.NextFloat() * randomVelocityScale; + Gore.NewGore(NPC.position, NPC.velocity + randomVelocity, Mod.GetGoreSlot("Gores/ScavengerGores/RockPillar"), 1f); + Gore.NewGore(NPC.position + Vector2.UnitY * y, NPC.velocity + randomVelocity, Mod.GetGoreSlot("Gores/ScavengerGores/RockPillar2"), 1f); + Gore.NewGore(NPC.position + Vector2.UnitY * y * 2f, NPC.velocity + randomVelocity, Mod.GetGoreSlot("Gores/ScavengerGores/RockPillar3"), 1f); + Gore.NewGore(NPC.position + Vector2.UnitY * y * 3f, NPC.velocity + randomVelocity, Mod.GetGoreSlot("Gores/ScavengerGores/RockPillar4"), 1f); + Gore.NewGore(NPC.position + Vector2.UnitY * y * 4f, NPC.velocity + randomVelocity, Mod.GetGoreSlot("Gores/ScavengerGores/RockPillar5"), 1f); + Gore.NewGore(NPC.position + Vector2.UnitY * y * 5f, NPC.velocity + randomVelocity, Mod.GetGoreSlot("Gores/ScavengerGores/RockPillar6"), 1f); } } else { for (int num621 = 0; num621 < 2; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -191,10 +192,10 @@ namespace CalamityMod.NPCs.Ravager } for (int num623 = 0; num623 < 2; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Stone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Stone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/Signus/CosmicLantern.cs b/NPCs/Signus/CosmicLantern.cs index 7b83129185..c6dfafec4c 100644 --- a/NPCs/Signus/CosmicLantern.cs +++ b/NPCs/Signus/CosmicLantern.cs @@ -13,65 +13,65 @@ namespace CalamityMod.NPCs.Signus public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Lantern"); - Main.npcFrameCount[npc.type] = 4; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 4; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.GetNPCDamage(); - npc.width = 25; - npc.height = 25; - npc.defense = 50; - npc.lifeMax = 25; - npc.alpha = 255; - npc.knockBackResist = 0.85f; - npc.noGravity = true; - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - npc.Calamity().VulnerableToSickness = false; + NPC.GetNPCDamage(); + NPC.width = 25; + NPC.height = 25; + NPC.defense = 50; + NPC.lifeMax = 25; + NPC.alpha = 255; + NPC.knockBackResist = 0.85f; + NPC.noGravity = true; + NPC.dontTakeDamage = true; + NPC.chaseable = false; + NPC.canGhostHeal = false; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit53; + NPC.DeathSound = SoundID.NPCDeath44; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void AI() { if (CalamityGlobalNPC.signus < 0 || !Main.npc[CalamityGlobalNPC.signus].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0.3f, 0.3f); + Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.3f, 0.3f, 0.3f); - npc.alpha -= 3; - if (npc.alpha < 0) + NPC.alpha -= 3; + if (NPC.alpha < 0) { - npc.alpha = 0; - int num1262 = Dust.NewDust(npc.position, npc.width, npc.height, 204, 0f, 0f, 0, default, 0.25f); + NPC.alpha = 0; + int num1262 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 204, 0f, 0f, 0, default, 0.25f); Main.dust[num1262].velocity *= 0.1f; Main.dust[num1262].noGravity = true; } @@ -80,17 +80,17 @@ namespace CalamityMod.NPCs.Signus float playerDistNormMult = revenge ? 24f : 22f; if (BossRushEvent.BossRushActive || CalamityWorld.malice) playerDistNormMult = 30f; - CalamityAI.DungeonSpiritAI(npc, mod, playerDistNormMult, 0f, true); + CalamityAI.DungeonSpiritAI(NPC, Mod, playerDistNormMult, 0f, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -101,21 +101,21 @@ namespace CalamityMod.NPCs.Signus { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Signus/CosmicLanternGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/Signus/CosmicLanternGlow"); Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -124,16 +124,16 @@ namespace CalamityMod.NPCs.Signus { Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); - color41 = npc.GetAlpha(color41); + color41 = NPC.GetAlpha(color41); color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -143,16 +143,16 @@ namespace CalamityMod.NPCs.Signus public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 1; - return npc.alpha == 0; + return NPC.alpha == 0; } public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 204, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 204, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 1df220aed7..4792b1a0f7 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -19,6 +19,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Signus { [AutoloadBossHead] @@ -31,26 +32,26 @@ namespace CalamityMod.NPCs.Signus public override void SetStaticDefaults() { DisplayName.SetDefault("Signus, Envoy of the Devourer"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 32f; - npc.GetNPCDamage(); - npc.width = 130; - npc.height = 130; - npc.defense = 60; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 32f; + NPC.GetNPCDamage(); + NPC.width = 130; + NPC.height = 130; + NPC.defense = 60; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel3; - npc.LifeMaxNERB(notDoGFight ? 297000 : 73000, notDoGFight ? 356400 : 87600, 240000); + NPC.LifeMaxNERB(notDoGFight ? 297000 : 73000, notDoGFight ? 356400 : 87600, 240000); // If fought alone, Signus plays his own theme if (notDoGFight) { - npc.value = Item.buyPrice(2, 0, 0, 0); + NPC.value = Item.buyPrice(2, 0, 0, 0); music = CalamityMod.Instance.GetMusicFromMusicMod("Signus") ?? MusicID.Boss4; } // If fought as a DoG interlude, keep the DoG music playing @@ -58,18 +59,18 @@ namespace CalamityMod.NPCs.Signus music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.aiStyle = -1; aiType = -1; - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - npc.HitSound = SoundID.NPCHit49; - npc.DeathSound = SoundID.NPCDeath51; + NPC.boss = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.netAlways = true; + NPC.HitSound = SoundID.NPCHit49; + NPC.DeathSound = SoundID.NPCDeath51; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) @@ -78,7 +79,7 @@ namespace CalamityMod.NPCs.Signus writer.Write(spawnY); writer.Write(lifeToAlpha); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -87,23 +88,23 @@ namespace CalamityMod.NPCs.Signus spawnY = reader.ReadInt32(); lifeToAlpha = reader.ReadInt32(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - CalamityGlobalNPC.signus = npc.whoAmI; + CalamityGlobalNPC.signus = NPC.whoAmI; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - Vector2 vectorCenter = npc.Center; + Vector2 vectorCenter = NPC.Center; - double lifeRatio = npc.life / (double)npc.lifeMax; + double lifeRatio = NPC.life / (double)NPC.lifeMax; lifeToAlpha = (int)(100.0 * (1.0 - lifeRatio)); int maxCharges = death ? 1 : revenge ? 2 : expertMode ? 3 : 4; @@ -114,73 +115,73 @@ namespace CalamityMod.NPCs.Signus bool phase3 = lifeRatio < 0.5f; bool phase4 = lifeRatio < 0.33f; - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, vectorCenter) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, vectorCenter) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; if (!player.active || player.dead || Vector2.Distance(player.Center, vectorCenter) > 6400f) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (!player.active || player.dead || Vector2.Distance(player.Center, vectorCenter) > 6400f) { - if (npc.timeLeft < 10) + if (NPC.timeLeft < 10) { CalamityWorld.DoGSecondStageCountdown = 0; if (Main.netMode == NetmodeID.Server) { - var netMessage = mod.GetPacket(); + var netMessage = Mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); } } - npc.rotation = npc.velocity.X * 0.04f; + NPC.rotation = NPC.velocity.X * 0.04f; - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.15f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.15f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; - if (npc.timeLeft > 60) - npc.timeLeft = 60; + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; - if (npc.ai[0] != 0f) + if (NPC.ai[0] != 0f) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; spawnY = 120; - npc.netUpdate = true; + NPC.netUpdate = true; } return; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; - if (lifeToAlpha < 50 && npc.ai[0] != 1f) + if (lifeToAlpha < 50 && NPC.ai[0] != 1f) { for (int num1011 = 0; num1011 < 2; num1011++) { if (Main.rand.Next(3) < 1) { - int num1012 = Dust.NewDust(vectorCenter - new Vector2(70f), 70 * 2, 70 * 2, (int)CalamityDusts.PurpleCosmilite, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + int num1012 = Dust.NewDust(vectorCenter - new Vector2(70f), 70 * 2, 70 * 2, (int)CalamityDusts.PurpleCosmilite, NPC.velocity.X * 0.5f, NPC.velocity.Y * 0.5f, 90, default, 1.5f); Main.dust[num1012].noGravity = true; Main.dust[num1012].velocity *= 0.2f; Main.dust[num1012].fadeIn = 1f; @@ -188,18 +189,18 @@ namespace CalamityMod.NPCs.Signus } } - if (npc.ai[0] <= 2f) + if (NPC.ai[0] <= 2f) { - npc.rotation = npc.velocity.X * 0.04f; + NPC.rotation = NPC.velocity.X * 0.04f; float playerLocation = vectorCenter.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; - npc.knockBackResist = 0.05f; + NPC.knockBackResist = 0.05f; if (expertMode) - npc.knockBackResist *= Main.expertKnockBack; + NPC.knockBackResist *= Main.expertKnockBack; if (phase3 || revenge) - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; float speed = malice ? 20f : revenge ? 15f : expertMode ? 14f : 12f; if (expertMode) @@ -211,40 +212,40 @@ namespace CalamityMod.NPCs.Signus num797 = speed / num797; num795 *= num797; num796 *= num797; - npc.velocity.X = (npc.velocity.X * 50f + num795) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num796) / 51f; + NPC.velocity.X = (NPC.velocity.X * 50f + num795) / 51f; + NPC.velocity.Y = (NPC.velocity.Y * 50f + num796) / 51f; } else - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { if (Main.netMode != NetmodeID.MultiplayerClient) { int phase; do phase = Main.rand.Next(5); - while (phase == npc.ai[1] || (phase == 0 && phase4) || phase == 1 || phase == 2); + while (phase == NPC.ai[1] || (phase == 0 && phase4) || phase == 1 || phase == 2); - npc.ai[0] = phase; - npc.ai[1] = 0f; + NPC.ai[0] = phase; + NPC.ai[1] = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 0f) + else if (NPC.ai[0] == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[1] += malice ? 1.5f : 1f; + NPC.localAI[1] += malice ? 1.5f : 1f; if (expertMode) - npc.localAI[1] += death ? 3f * (float)(1D - lifeRatio) : 2f * (float)(1D - lifeRatio); + NPC.localAI[1] += death ? 3f * (float)(1D - lifeRatio) : 2f * (float)(1D - lifeRatio); - if (npc.localAI[1] >= 120f) + if (NPC.localAI[1] >= 120f) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; - npc.TargetClosest(); + NPC.TargetClosest(); int num1249 = 0; int num1250; @@ -275,57 +276,57 @@ namespace CalamityMod.NPCs.Signus return; } - npc.ai[0] = 1f; - npc.ai[1] = num1250; - npc.ai[2] = num1251; + NPC.ai[0] = 1f; + NPC.ai[1] = num1250; + NPC.ai[2] = num1251; - npc.netUpdate = true; + NPC.netUpdate = true; return; } } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - Vector2 position = new Vector2(npc.ai[1] * 16f - (npc.width / 2), npc.ai[2] * 16f - (npc.height / 2)); + Vector2 position = new Vector2(NPC.ai[1] * 16f - (NPC.width / 2), NPC.ai[2] * 16f - (NPC.height / 2)); for (int m = 0; m < 5; m++) { - int dust = Dust.NewDust(position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 90, default, 2f); + int dust = Dust.NewDust(position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 90, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].fadeIn = 1f; } - npc.alpha += malice ? 3 : 2; + NPC.alpha += malice ? 3 : 2; if (expertMode) - npc.alpha += death ? (int)Math.Round(4.5D * (1D - lifeRatio)) : (int)Math.Round(3D * (1D - lifeRatio)); + NPC.alpha += death ? (int)Math.Round(4.5D * (1D - lifeRatio)) : (int)Math.Round(3D * (1D - lifeRatio)); - if (npc.alpha >= 255) + if (NPC.alpha >= 255) { - Main.PlaySound(SoundID.Item8, vectorCenter); + SoundEngine.PlaySound(SoundID.Item8, vectorCenter); - npc.alpha = 255; + NPC.alpha = 255; - npc.position = position; + NPC.position = position; for (int n = 0; n < 15; n++) { - int num39 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 90, default, 3f); + int num39 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 90, default, 3f); Main.dust[num39].noGravity = true; } - npc.ai[0] = 2f; + NPC.ai[0] = 2f; - npc.netUpdate = true; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - npc.alpha -= 50; - if (npc.alpha <= lifeToAlpha) + NPC.alpha -= 50; + if (NPC.alpha <= lifeToAlpha) { if (Main.netMode != NetmodeID.MultiplayerClient && revenge) { - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 122); + SoundEngine.PlaySound(SoundID.Item, (int)NPC.position.X, (int)NPC.position.Y, 122); int num660 = NPC.NewNPC((int)(player.position.X + 750f), (int)player.position.Y, ModContent.NPCType()); if (Main.netMode == NetmodeID.Server) @@ -337,7 +338,7 @@ namespace CalamityMod.NPCs.Signus for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -345,7 +346,7 @@ namespace CalamityMod.NPCs.Signus Main.dust[num622].scale = 0.5f; Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } - int num623 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num623 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num623].velocity *= 3f; Main.dust[num623].noGravity = true; if (Main.rand.NextBool(2)) @@ -357,55 +358,55 @@ namespace CalamityMod.NPCs.Signus for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; - int num625 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int num625 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num625].noGravity = true; Main.dust[num625].velocity *= 5f; - num625 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + num625 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num625].velocity *= 2f; } } - npc.ai[3] += 1f; - npc.alpha = lifeToAlpha; - if (npc.ai[3] >= maxTeleports) + NPC.ai[3] += 1f; + NPC.alpha = lifeToAlpha; + if (NPC.ai[3] >= maxTeleports) { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[0] = -1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; } else - npc.ai[0] = 0f; + NPC.ai[0] = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - npc.damage = 0; - npc.rotation = npc.velocity.X * 0.04f; + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.04f; float playerLocation = vectorCenter.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; float divisor = expertMode ? (malice ? 10f : death ? 12f : revenge ? 15f : 20f) - (float)Math.Ceiling(5D * (1D - lifeRatio)) : 20f; float scytheBarrageTime = divisor * 3f; float scytheBarrageCooldown = divisor * 3f; - npc.ai[1] += 1f; - if (npc.ai[2] > 0f) - npc.ai[2] -= 1f; + NPC.ai[1] += 1f; + if (NPC.ai[2] > 0f) + NPC.ai[2] -= 1f; else - npc.ai[2] = scytheBarrageTime + scytheBarrageCooldown; + NPC.ai[2] = scytheBarrageTime + scytheBarrageCooldown; - if (npc.ai[2] <= scytheBarrageTime) + if (NPC.ai[2] <= scytheBarrageTime) { - if (npc.ai[1] % divisor == divisor - 1f) + if (NPC.ai[1] % divisor == divisor - 1f) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -417,8 +418,8 @@ namespace CalamityMod.NPCs.Signus num1071 *= num1073; num1072 *= num1073; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, num1071, num1072, type, damage, 0f, Main.myPlayer, 0f, npc.target + 1); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, num1071, num1072, type, damage, 0f, Main.myPlayer, 0f, NPC.target + 1); } } } @@ -426,60 +427,60 @@ namespace CalamityMod.NPCs.Signus float maxVelocityY = malice ? 1.5f : death ? 2.5f : 3f; float maxVelocityX = malice ? 5f : death ? 7f : 8f; - if (npc.position.Y > player.position.Y - 200f) + if (NPC.position.Y > player.position.Y - 200f) { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.975f; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y *= 0.975f; - npc.velocity.Y -= death ? 0.12f : 0.1f; + NPC.velocity.Y -= death ? 0.12f : 0.1f; - if (npc.velocity.Y > maxVelocityY) - npc.velocity.Y = maxVelocityY; + if (NPC.velocity.Y > maxVelocityY) + NPC.velocity.Y = maxVelocityY; } - else if (npc.position.Y < player.position.Y - 400f) + else if (NPC.position.Y < player.position.Y - 400f) { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.975f; + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= 0.975f; - npc.velocity.Y += death ? 0.12f : 0.1f; + NPC.velocity.Y += death ? 0.12f : 0.1f; - if (npc.velocity.Y < -maxVelocityY) - npc.velocity.Y = -maxVelocityY; + if (NPC.velocity.Y < -maxVelocityY) + NPC.velocity.Y = -maxVelocityY; } if (vectorCenter.X > player.Center.X + 500f) { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; + if (NPC.velocity.X > 0f) + NPC.velocity.X *= 0.98f; - npc.velocity.X -= death ? 0.12f : 0.1f; + NPC.velocity.X -= death ? 0.12f : 0.1f; - if (npc.velocity.X > maxVelocityX) - npc.velocity.X = maxVelocityX; + if (NPC.velocity.X > maxVelocityX) + NPC.velocity.X = maxVelocityX; } if (vectorCenter.X < player.Center.X - 500f) { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; + if (NPC.velocity.X < 0f) + NPC.velocity.X *= 0.98f; - npc.velocity.X += death ? 0.12f : 0.1f; + NPC.velocity.X += death ? 0.12f : 0.1f; - if (npc.velocity.X < -maxVelocityX) - npc.velocity.X = -maxVelocityX; + if (NPC.velocity.X < -maxVelocityX) + NPC.velocity.X = -maxVelocityX; } - if (npc.ai[1] >= divisor * 20f) + if (NPC.ai[1] >= divisor * 20f) { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.ai[1] = 3f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } - else if (npc.ai[0] == 4f) + else if (NPC.ai[0] == 4f) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -501,17 +502,17 @@ namespace CalamityMod.NPCs.Signus } } - npc.rotation = npc.velocity.ToRotation(); + NPC.rotation = NPC.velocity.ToRotation(); - if (Math.Sign(npc.velocity.X) != 0) - npc.spriteDirection = -Math.Sign(npc.velocity.X); + if (Math.Sign(NPC.velocity.X) != 0) + NPC.spriteDirection = -Math.Sign(NPC.velocity.X); - if (npc.rotation < -MathHelper.PiOver2) - npc.rotation += MathHelper.Pi; - if (npc.rotation > MathHelper.PiOver2) - npc.rotation -= MathHelper.Pi; + if (NPC.rotation < -MathHelper.PiOver2) + NPC.rotation += MathHelper.Pi; + if (NPC.rotation > MathHelper.PiOver2) + NPC.rotation -= MathHelper.Pi; - npc.spriteDirection = Math.Sign(npc.velocity.X); + NPC.spriteDirection = Math.Sign(NPC.velocity.X); if (calamityGlobalNPC.newAI[0] == 0f) // Line up the charge { @@ -527,178 +528,178 @@ namespace CalamityMod.NPCs.Signus vector126 = Vector2.Normalize(vector126) * velocity; vector127 = Vector2.Normalize(vector127) * velocity; - bool flag64 = Collision.CanHit(vectorCenter, 1, 1, player.Center, 1, 1) || npc.ai[3] >= 120f; + bool flag64 = Collision.CanHit(vectorCenter, 1, 1, player.Center, 1, 1) || NPC.ai[3] >= 120f; float num1014 = 8f; flag64 = flag64 && vector126.ToRotation() > MathHelper.Pi / num1014 && vector126.ToRotation() < MathHelper.Pi - MathHelper.Pi / num1014; if (num1013 > 1400f || !flag64) { - npc.velocity = (npc.velocity * (inertia - 1f) + vector127) / inertia; + NPC.velocity = (NPC.velocity * (inertia - 1f) + vector127) / inertia; if (!flag64) { - npc.ai[3] += 1f; - if (npc.ai[3] == 120f) - npc.netUpdate = true; + NPC.ai[3] += 1f; + if (NPC.ai[3] == 120f) + NPC.netUpdate = true; } else - npc.ai[3] = 0f; + NPC.ai[3] = 0f; } else { calamityGlobalNPC.newAI[0] = 1f; - npc.ai[2] = vector126.X; - npc.ai[3] = vector126.Y; - npc.netUpdate = true; + NPC.ai[2] = vector126.X; + NPC.ai[3] = vector126.Y; + NPC.netUpdate = true; } } else if (calamityGlobalNPC.newAI[0] == 1f) // Pause before charge { - npc.velocity *= 0.8f; + NPC.velocity *= 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 5f) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 5f) { calamityGlobalNPC.newAI[0] = 2f; - npc.netUpdate = true; + NPC.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]); + Vector2 velocity = new Vector2(NPC.ai[2], NPC.ai[3]); velocity.Normalize(); velocity *= chargeVelocity; - npc.velocity = velocity; + NPC.velocity = velocity; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; } } else if (calamityGlobalNPC.newAI[0] == 2f) // Charging { if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[2] += 1f; - if (phase2 && npc.ai[2] % 3f == 0f) + NPC.ai[2] += 1f; + if (phase2 && NPC.ai[2] % 3f == 0f) { - Main.PlaySound(SoundID.Item73, npc.position); + SoundEngine.PlaySound(SoundID.Item73, NPC.position); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(vectorCenter, Vector2.Zero, type, damage, 0f, Main.myPlayer); } } - npc.ai[1] += 1f; + NPC.ai[1] += 1f; bool flag65 = vectorCenter.Y + 50f > player.Center.Y; - if ((npc.ai[1] >= 90f && flag65) || npc.velocity.Length() < 8f) + if ((NPC.ai[1] >= 90f && flag65) || NPC.velocity.Length() < 8f) { calamityGlobalNPC.newAI[0] = 3f; - npc.ai[1] = 30f; - npc.ai[2] = 0f; - npc.velocity /= 2f; - npc.netUpdate = true; + NPC.ai[1] = 30f; + NPC.ai[2] = 0f; + NPC.velocity /= 2f; + NPC.netUpdate = true; } else { Vector2 vec2 = player.Center - vectorCenter; vec2.Normalize(); if (vec2.HasNaNs()) - vec2 = new Vector2(npc.direction, 0f); + vec2 = new Vector2(NPC.direction, 0f); - npc.velocity = (npc.velocity * (inertia - 1f) + vec2 * (npc.velocity.Length() + 0.111111117f * inertia)) / inertia; + NPC.velocity = (NPC.velocity * (inertia - 1f) + vec2 * (NPC.velocity.Length() + 0.111111117f * inertia)) / inertia; } } else if (calamityGlobalNPC.newAI[0] == 3f) // Slow down after charging and reset { - npc.ai[1] -= 1f; - if (npc.ai[1] <= 0f) + NPC.ai[1] -= 1f; + if (NPC.ai[1] <= 0f) { - npc.TargetClosest(); + NPC.TargetClosest(); calamityGlobalNPC.newAI[1] += 1f; if (calamityGlobalNPC.newAI[1] >= maxCharges) { - npc.ai[0] = -1f; - npc.ai[1] = 4f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[0] = -1f; + NPC.ai[1] = 4f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; calamityGlobalNPC.newAI[1] = 0f; } else { - npc.ai[1] = 0f; + NPC.ai[1] = 0f; } calamityGlobalNPC.newAI[0] = 0f; - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.velocity *= 0.97f; + NPC.velocity *= 0.97f; } } } public override void FindFrame(int frameHeight) { - npc.frameCounter += 1.0; - if (npc.ai[0] == 4f) + NPC.frameCounter += 1.0; + if (NPC.ai[0] == 4f) { - if (npc.frameCounter > 72.0) //12 + if (NPC.frameCounter > 72.0) //12 { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; } } else { int frameY = 196; - if (npc.frameCounter > 72.0) + if (NPC.frameCounter > 72.0) { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; } - npc.frame.Y = frameY * (int)(npc.frameCounter / 12.0); //1 to 6 - if (npc.frame.Y >= frameHeight * 6) + NPC.frame.Y = frameY * (int)(NPC.frameCounter / 12.0); //1 to 6 + if (NPC.frame.Y >= frameHeight * 6) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Texture2D NPCTexture = Main.npcTexture[npc.type]; - Texture2D glowMaskTexture = ModContent.GetTexture("CalamityMod/NPCs/Signus/SignusGlow"); + Texture2D NPCTexture = Main.npcTexture[NPC.type]; + Texture2D glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusGlow"); SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; int num153 = 5; - Rectangle frame = npc.frame; - int frameCount = Main.npcFrameCount[npc.type]; + Rectangle frame = NPC.frame; + int frameCount = Main.npcFrameCount[NPC.type]; - if (npc.ai[0] == 4f) + if (NPC.ai[0] == 4f) { - NPCTexture = ModContent.GetTexture("CalamityMod/NPCs/Signus/SignusAlt2"); - glowMaskTexture = ModContent.GetTexture("CalamityMod/NPCs/Signus/SignusAlt2Glow"); + NPCTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt2"); + glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt2Glow"); num153 = 10; - int frameY = 94 * (int)(npc.frameCounter / 12.0); + int frameY = 94 * (int)(NPC.frameCounter / 12.0); if (frameY >= 94 * 6) frameY = 0; frame = new Rectangle(0, frameY, NPCTexture.Width, NPCTexture.Height / frameCount); } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - NPCTexture = ModContent.GetTexture("CalamityMod/NPCs/Signus/SignusAlt"); - glowMaskTexture = ModContent.GetTexture("CalamityMod/NPCs/Signus/SignusAltGlow"); + NPCTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAlt"); + glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusAltGlow"); num153 = 7; } else { - NPCTexture = Main.npcTexture[npc.type]; - glowMaskTexture = ModContent.GetTexture("CalamityMod/NPCs/Signus/SignusGlow"); + NPCTexture = Main.npcTexture[NPC.type]; + glowMaskTexture = ModContent.Request("CalamityMod/NPCs/Signus/SignusGlow"); } Vector2 vector11 = new Vector2(NPCTexture.Width / 2, NPCTexture.Height / frameCount / 2); Color color36 = Color.White; float amount9 = 0.5f; - float scale = npc.scale; - float rotation = npc.rotation; - float offsetY = npc.gfxOffY; + float scale = NPC.scale; + float rotation = NPC.rotation; + float offsetY = NPC.gfxOffY; if (CalamityConfig.Instance.Afterimages) { @@ -706,19 +707,19 @@ namespace CalamityMod.NPCs.Signus { Color color38 = drawColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; vector41 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; vector41 += vector11 * scale + new Vector2(0f, 4f + offsetY); spriteBatch.Draw(NPCTexture, vector41, new Rectangle?(frame), color38, rotation, vector11, scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; + Vector2 vector43 = NPC.Center - Main.screenPosition; vector43 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; vector43 += vector11 * scale + new Vector2(0f, 4f + offsetY); - spriteBatch.Draw(NPCTexture, vector43, new Rectangle?(frame), npc.GetAlpha(drawColor), rotation, vector11, scale, spriteEffects, 0f); + spriteBatch.Draw(NPCTexture, vector43, new Rectangle?(frame), NPC.GetAlpha(drawColor), rotation, vector11, scale, spriteEffects, 0f); Color color40 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); @@ -728,9 +729,9 @@ namespace CalamityMod.NPCs.Signus { Color color41 = color40; color41 = Color.Lerp(color41, color36, amount9); - color41 = npc.GetAlpha(color41); + color41 = NPC.GetAlpha(color41); color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; vector44 -= new Vector2(glowMaskTexture.Width, glowMaskTexture.Height / frameCount) * scale / 2f; vector44 += vector11 * scale + new Vector2(0f, 4f + offsetY); spriteBatch.Draw(glowMaskTexture, vector44, new Rectangle?(frame), color41, rotation, vector11, scale, spriteEffects, 0f); @@ -753,33 +754,33 @@ namespace CalamityMod.NPCs.Signus bool fullStrength = !CalamityWorld.downedSentinel3 || CalamityWorld.DoGSecondStageCountdown <= 0; if (fullStrength) { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); bool lastSentinelKilled = CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && !CalamityWorld.downedSentinel3; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, lastSentinelKilled); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, lastSentinelKilled); if (!Main.expertMode) { // Materials - DropHelper.DropItem(npc, ModContent.ItemType(), true, 2, 3); + DropHelper.DropItem(NPC, ModContent.ItemType(), true, 2, 3); // Weapons - DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 4); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); if (Main.rand.NextBool(20)) { - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); } } } @@ -790,7 +791,7 @@ namespace CalamityMod.NPCs.Signus CalamityWorld.DoGSecondStageCountdown = 600; if (Main.netMode == NetmodeID.Server) { - var netMessage = mod.GetPacket(); + var netMessage = Mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); @@ -811,27 +812,27 @@ namespace CalamityMod.NPCs.Signus public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 200; - npc.height = 150; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 200; + NPC.height = 150; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -841,18 +842,18 @@ namespace CalamityMod.NPCs.Signus } for (int num623 = 0; num623 < 60; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } float randomSpread = Main.rand.Next(-200, 200) / 100; - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus5"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/Signus"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/Signus2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/Signus3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/Signus4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity * randomSpread, Mod.GetGoreSlot("Gores/Signus5"), 1f); } } @@ -863,10 +864,10 @@ namespace CalamityMod.NPCs.Signus Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) diff --git a/NPCs/Signus/SignusBomb.cs b/NPCs/Signus/SignusBomb.cs index 26d38db737..77c8367887 100644 --- a/NPCs/Signus/SignusBomb.cs +++ b/NPCs/Signus/SignusBomb.cs @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Signus { @@ -16,141 +17,141 @@ namespace CalamityMod.NPCs.Signus public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Mine"); - NPCID.Sets.TrailingMode[npc.type] = 1; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.width = 30; - npc.height = 30; - npc.lifeMax = 4800; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.width = 30; + NPC.height = 30; + NPC.lifeMax = 4800; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.dontTakeDamage = true; - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - npc.Calamity().VulnerableToSickness = false; + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.dontTakeDamage = true; + NPC.HitSound = SoundID.NPCHit53; + NPC.DeathSound = SoundID.NPCDeath44; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); } public override void AI() { if (CalamityGlobalNPC.signus < 0 || !Main.npc[CalamityGlobalNPC.signus].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.7f, 0.2f, 1.1f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.7f, 0.2f, 1.1f); - npc.rotation = npc.velocity.X * 0.04f; + NPC.rotation = NPC.velocity.X * 0.04f; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; - Vector2 vector = player.Center - npc.Center; - npc.ai[2] = vector.Length(); + Vector2 vector = player.Center - NPC.Center; + NPC.ai[2] = vector.Length(); - npc.damage = 0; - npc.ai[3] += 1f; - if (npc.ai[2] < 90f || npc.ai[3] >= 300f || npc.Calamity().newAI[0] > 0f) + NPC.damage = 0; + NPC.ai[3] += 1f; + if (NPC.ai[2] < 90f || NPC.ai[3] >= 300f || NPC.Calamity().newAI[0] > 0f) { - npc.Calamity().newAI[0] += 1f; - npc.velocity *= 0.98f; - npc.dontTakeDamage = false; - npc.scale = MathHelper.Lerp(1f, 3f, npc.Calamity().newAI[0] / 45f); + NPC.Calamity().newAI[0] += 1f; + NPC.velocity *= 0.98f; + NPC.dontTakeDamage = false; + NPC.scale = MathHelper.Lerp(1f, 3f, NPC.Calamity().newAI[0] / 45f); - if (npc.Calamity().newAI[0] >= 45f) + if (NPC.Calamity().newAI[0] >= 45f) { CheckDead(); - npc.life = 0; + NPC.life = 0; } return; } - if (npc.ai[1] == 0f) + if (NPC.ai[1] == 0f) { - npc.scale -= 0.02f; - npc.alpha += 30; - if (npc.alpha >= 250) + NPC.scale -= 0.02f; + NPC.alpha += 30; + if (NPC.alpha >= 250) { - npc.alpha = 255; - npc.ai[1] = 1f; + NPC.alpha = 255; + NPC.ai[1] = 1f; } } - else if (npc.ai[1] == 1f) + else if (NPC.ai[1] == 1f) { - npc.scale += 0.02f; - npc.alpha -= 30; - if (npc.alpha <= 0) + NPC.scale += 0.02f; + NPC.alpha -= 30; + if (NPC.alpha <= 0) { - npc.alpha = 0; - npc.ai[1] = 0f; + NPC.alpha = 0; + NPC.ai[1] = 0f; } } float num1372 = death ? 16f : 14f; - Vector2 vector167 = new Vector2(npc.Center.X + (npc.direction * 20), npc.Center.Y + 6f); + Vector2 vector167 = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); float num1373 = player.position.X + player.width * 0.5f - vector167.X; float num1374 = player.Center.Y - vector167.Y; float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); float num1376 = num1372 / num1375; num1373 *= num1376; num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) + NPC.ai[0] -= 1f; + if (num1375 < 200f || NPC.ai[0] > 0f) { if (num1375 < 200f) { - npc.ai[0] = 20f; + NPC.ai[0] = 20f; } - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.direction = -1; + NPC.direction = -1; } else { - npc.direction = 1; + NPC.direction = 1; } return; } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f; + NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f; if (num1375 < 350f) { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + NPC.velocity.X = (NPC.velocity.X * 10f + num1373) / 11f; + NPC.velocity.Y = (NPC.velocity.Y * 10f + num1374) / 11f; } if (num1375 < 300f) { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + NPC.velocity.X = (NPC.velocity.X * 7f + num1373) / 8f; + NPC.velocity.Y = (NPC.velocity.Y * 7f + num1374) / 8f; } } @@ -161,15 +162,15 @@ namespace CalamityMod.NPCs.Signus public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (npc.Calamity().newAI[0] >= 45f) + if (NPC.Calamity().newAI[0] >= 45f) return false; SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[NPC.type].Width / 2, Main.npcTexture[NPC.type].Height / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -180,19 +181,19 @@ namespace CalamityMod.NPCs.Signus { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -201,16 +202,16 @@ namespace CalamityMod.NPCs.Signus public override bool CheckDead() { - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 14); - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.damage = npc.defDamage; - npc.width = npc.height = 256; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + SoundEngine.PlaySound(SoundID.Item, (int)NPC.position.X, (int)NPC.position.Y, 14); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.damage = NPC.defDamage; + NPC.width = NPC.height = 256; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -221,10 +222,10 @@ namespace CalamityMod.NPCs.Signus } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; Main.dust[num624].noGravity = true; } diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index edde478527..567ab9ed87 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.SlimeGod { @@ -19,115 +20,115 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetStaticDefaults() { DisplayName.SetDefault("Ebonian Slime God"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.width = 150; - npc.height = 92; - npc.scale = 1.1f; - npc.defense = 10; - npc.LifeMaxNERB(5350, 6400, 220000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.width = 150; + NPC.height = 92; + NPC.scale = 1.1f; + NPC.defense = 10; + NPC.LifeMaxNERB(5350, 6400, 220000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; animationType = NPCID.KingSlime; - npc.value = 0f; - npc.alpha = 55; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + NPC.value = 0f; + NPC.alpha = 55; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.localAI[1]); + writer.Write(NPC.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.localAI[1] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC.slimeGodPurple = npc.whoAmI; + CalamityGlobalNPC.slimeGodPurple = NPC.whoAmI; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || npc.localAI[1] == 1f || BossRushEvent.BossRushActive; - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; + bool death = CalamityWorld.death || NPC.localAI[1] == 1f || BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; - Vector2 vector = npc.Center; + Vector2 vector = NPC.Center; - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; - npc.defense = npc.defDefense; - npc.damage = npc.defDamage; - if (npc.localAI[1] == 1f) + NPC.defense = NPC.defDefense; + NPC.damage = NPC.defDamage; + if (NPC.localAI[1] == 1f) { - npc.defense = npc.defDefense + 20; - npc.damage = npc.defDamage + 22; + NPC.defense = NPC.defDefense + 20; + NPC.damage = NPC.defDamage + 22; } - npc.aiAction = 0; - npc.noTileCollide = false; - npc.noGravity = false; + NPC.aiAction = 0; + NPC.noTileCollide = false; + NPC.noGravity = false; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; - if (npc.ai[0] != 6f && (player.dead || !player.active)) + if (NPC.ai[0] != 6f && (player.dead || !player.active)) { - npc.TargetClosest(); - player = Main.player[npc.target]; + NPC.TargetClosest(); + player = Main.player[NPC.target]; if (player.dead || !player.active) { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; if (Vector2.Distance(player.Center, vector) > 5400f) { - npc.position.X = player.Center.X / 16 * 16f - (npc.width / 2); - npc.position.Y = player.Center.Y / 16 * 16f - (npc.height / 2) - 150f; + NPC.position.X = player.Center.X / 16 * 16f - (NPC.width / 2); + NPC.position.Y = player.Center.Y / 16 * 16f - (NPC.height / 2) - 150f; } float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * (malice ? 0.008f : 0.005f); if (lifeRatio <= 0.5f && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { - Main.PlaySound(SoundID.NPCDeath1, npc.position); - Vector2 spawnAt = vector + new Vector2(0f, npc.height / 2f); + SoundEngine.PlaySound(SoundID.NPCDeath1, NPC.position); + Vector2 spawnAt = vector + new Vector2(0f, NPC.height / 2f); NPC.NewNPC((int)spawnAt.X - 30, (int)spawnAt.Y, ModContent.NPCType()); NPC.NewNPC((int)spawnAt.X + 30, (int)spawnAt.Y, ModContent.NPCType()); - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } bool flag100 = false; - bool hyperMode = npc.localAI[1] == 1f; + bool hyperMode = NPC.localAI[1] == 1f; if (CalamityGlobalNPC.slimeGodRed != -1) { if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) @@ -137,7 +138,7 @@ namespace CalamityMod.NPCs.SlimeGod } if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; flag100 = false; hyperMode = true; } @@ -149,27 +150,27 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += flag100 ? 1f : 2f; + NPC.localAI[0] += flag100 ? 1f : 2f; if (revenge) - npc.localAI[0] += 0.5f; + NPC.localAI[0] += 0.5f; if (malice) - npc.localAI[0] += 1f; + NPC.localAI[0] += 1f; - if (npc.localAI[0] >= 600f && Vector2.Distance(player.Center, npc.Center) > 160f) + if (NPC.localAI[0] >= 600f && Vector2.Distance(player.Center, NPC.Center) > 160f) { - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; float num179 = 6f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + Vector2 value9 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); float num180 = player.position.X + (float)player.width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; + NPC.netUpdate = true; num183 = num179 / num183; num180 *= num183; num182 *= num183; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; int totalProjectiles = expertMode ? 6 : 4; @@ -189,27 +190,27 @@ namespace CalamityMod.NPCs.SlimeGod } } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { if ((player.Center - vector).Length() > (hyperMode ? 1200f : 2400f)) //1200 { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.TargetClosest(); - npc.velocity.X *= 0.8f; - npc.ai[1] += flag100 ? 1f : 2f; + NPC.TargetClosest(); + NPC.velocity.X *= 0.8f; + NPC.ai[1] += flag100 ? 1f : 2f; float num1879 = 60f; float num1880 = death ? 3.5f : revenge ? 3f : expertMode ? 2.5f : 2f; if (revenge) @@ -224,304 +225,304 @@ namespace CalamityMod.NPCs.SlimeGod { num1881 += 2f; } - if (npc.ai[1] > num1879) + if (NPC.ai[1] > num1879) { - npc.ai[3] += 1f; - if (npc.ai[3] >= 2f) + NPC.ai[3] += 1f; + if (NPC.ai[3] >= 2f) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; num1881 *= 1.25f; num1880 *= 0.75f; } - npc.ai[1] = 0f; - npc.velocity.Y -= num1881; - npc.velocity.X = (num1880 + distanceSpeedBoost) * npc.direction; - npc.netUpdate = true; + NPC.ai[1] = 0f; + NPC.velocity.Y -= num1881; + NPC.velocity.X = (num1880 + distanceSpeedBoost) * NPC.direction; + NPC.netUpdate = true; } } else { - npc.velocity.X *= 0.99f; - if (npc.direction < 0 && npc.velocity.X > -1f) + NPC.velocity.X *= 0.99f; + if (NPC.direction < 0 && NPC.velocity.X > -1f) { - npc.velocity.X = -1f; + NPC.velocity.X = -1f; } - if (npc.direction > 0 && npc.velocity.X < 1f) + if (NPC.direction > 0 && NPC.velocity.X < 1f) { - npc.velocity.X = 1f; + NPC.velocity.X = 1f; } } - npc.ai[2] += 1f; + NPC.ai[2] += 1f; if (revenge) { - npc.ai[2] += death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + NPC.ai[2] += death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); } - if (npc.ai[2] >= 420f && npc.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.ai[2] >= 420f && NPC.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) { int random = Main.rand.Next(2) + (lifeRatio < 0.75f ? 1 : 0); switch (random) { case 0: - npc.ai[0] = 2f; + NPC.ai[0] = 2f; break; case 1: - npc.ai[0] = 3f; - npc.noTileCollide = true; - npc.velocity.Y = death ? -9f : revenge ? -8f : expertMode ? -7f : -6f; + NPC.ai[0] = 3f; + NPC.noTileCollide = true; + NPC.velocity.Y = death ? -9f : revenge ? -8f : expertMode ? -7f : -6f; break; case 2: - npc.ai[0] = 5f; + NPC.ai[0] = 5f; break; default: break; } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - npc.localAI[0] += 5f; - npc.velocity.X *= 0.85f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 80f) + NPC.localAI[0] += 5f; + NPC.velocity.X *= 0.85f; + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 80f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - npc.noTileCollide = true; - npc.noGravity = true; - if (npc.velocity.X < 0f) + NPC.noTileCollide = true; + NPC.noGravity = true; + if (NPC.velocity.X < 0f) { - npc.direction = -1; + NPC.direction = -1; } else { - npc.direction = 1; + NPC.direction = 1; } - npc.spriteDirection = npc.direction; - npc.TargetClosest(); + NPC.spriteDirection = NPC.direction; + NPC.TargetClosest(); Vector2 center40 = player.Center; center40.Y -= 350f; Vector2 vector272 = center40 - vector; - if (npc.ai[2] == 1f) + if (NPC.ai[2] == 1f) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; vector272 = player.Center - vector; vector272.Normalize(); vector272 *= death ? 9f : revenge ? 8f : expertMode ? 7f : 6f; - npc.velocity = (npc.velocity * 4f + vector272) / 5f; - if (npc.ai[1] > 12f) + NPC.velocity = (NPC.velocity * 4f + vector272) / 5f; + if (NPC.ai[1] > 12f) { - npc.ai[1] = 0f; - npc.ai[0] = 3.1f; - npc.ai[2] = 0f; - npc.velocity = vector272; + NPC.ai[1] = 0f; + NPC.ai[0] = 3.1f; + NPC.ai[2] = 0f; + NPC.velocity = vector272; } } else { if (Math.Abs(vector.X - player.Center.X) < 40f && vector.Y < player.Center.Y - 300f) { - npc.ai[1] = 0f; - npc.ai[2] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 1f; return; } vector272.Normalize(); vector272 *= (death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost; - npc.velocity = (npc.velocity * 5f + vector272) / 6f; + NPC.velocity = (NPC.velocity * 5f + vector272) / 6f; } } - else if (npc.ai[0] == 3.1f) + else if (NPC.ai[0] == 3.1f) { - bool atTargetPosition = npc.position.Y + npc.height >= player.position.Y; - if (npc.ai[2] == 0f && (atTargetPosition || npc.localAI[1] == 0f) && Collision.CanHit(vector, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; + if (NPC.ai[2] == 0f && (atTargetPosition || NPC.localAI[1] == 0f) && Collision.CanHit(vector, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.ai[2] = 1f; - npc.netUpdate = true; + NPC.ai[2] = 1f; + NPC.netUpdate = true; } - if (atTargetPosition || npc.velocity.Y <= 0f) + if (atTargetPosition || NPC.velocity.Y <= 0f) { - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) + NPC.ai[1] += 1f; + if (NPC.ai[1] > 10f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.ai[0] = 4f; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.ai[0] = 4f; - npc.netUpdate = true; + NPC.netUpdate = true; } } - else if (npc.ai[2] == 0f) + else if (NPC.ai[2] == 0f) { - npc.noTileCollide = true; + NPC.noTileCollide = true; } - npc.noGravity = true; - npc.velocity.Y += 0.5f; + NPC.noGravity = true; + NPC.velocity.Y += 0.5f; float velocityLimit = malice ? 20f : death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; - if (npc.velocity.Y > velocityLimit) + if (NPC.velocity.Y > velocityLimit) { - npc.velocity.Y = velocityLimit; + NPC.velocity.Y = velocityLimit; } } else { - if (npc.ai[0] == 4f) + if (NPC.ai[0] == 4f) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.direction = 1; + NPC.direction = 1; } else { - npc.direction = -1; + NPC.direction = -1; } - npc.spriteDirection = npc.direction; - npc.noTileCollide = true; - npc.noGravity = true; + NPC.spriteDirection = NPC.direction; + NPC.noTileCollide = true; + NPC.noGravity = true; Vector2 value74 = player.Center - vector; value74.Y -= 40f; - if (value74.Length() < 320f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (value74.Length() < 320f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } if (value74.Length() > 100f) { value74.Normalize(); value74 *= (death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost; } - npc.velocity = (npc.velocity * 4f + value74) / 5f; + NPC.velocity = (NPC.velocity * 4f + value74) / 5f; return; } - if (npc.ai[0] == 5f) + if (NPC.ai[0] == 5f) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.TargetClosest(); - npc.velocity.X *= 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] > 5f) + NPC.TargetClosest(); + NPC.velocity.X *= 0.8f; + NPC.ai[1] += 1f; + if (NPC.ai[1] > 5f) { - npc.ai[1] = 0f; - npc.velocity.Y -= 3f; + NPC.ai[1] = 0f; + NPC.velocity.Y -= 3f; if (player.position.Y + player.height < vector.Y) { - npc.velocity.Y -= 1.2f; + NPC.velocity.Y -= 1.2f; } if (player.position.Y + player.height < vector.Y - 40f) { - npc.velocity.Y -= 1.4f; + NPC.velocity.Y -= 1.4f; } if (player.position.Y + player.height < vector.Y - 80f) { - npc.velocity.Y -= 1.7f; + NPC.velocity.Y -= 1.7f; } if (player.position.Y + player.height < vector.Y - 120f) { - npc.velocity.Y -= 2f; + NPC.velocity.Y -= 2f; } if (player.position.Y + player.height < vector.Y - 160f) { - npc.velocity.Y -= 2.2f; + NPC.velocity.Y -= 2.2f; } if (player.position.Y + player.height < vector.Y - 200f) { - npc.velocity.Y -= 2.4f; + NPC.velocity.Y -= 2.4f; } if (!Collision.CanHit(vector, 1, 1, player.Center, 1, 1)) { - npc.velocity.Y -= 2f; + NPC.velocity.Y -= 2f; } - npc.velocity.X = ((death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost) * npc.direction; - npc.ai[2] += 1f; + NPC.velocity.X = ((death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost) * NPC.direction; + NPC.ai[2] += 1f; } } else { - npc.velocity.X *= 0.98f; + NPC.velocity.X *= 0.98f; float velocityLimit = (death ? 6.5f : revenge ? 6f : expertMode ? 5.5f : 5f) + distanceSpeedBoost; - if (npc.direction < 0 && npc.velocity.X > -velocityLimit) + if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) { - npc.velocity.X = -velocityLimit; + NPC.velocity.X = -velocityLimit; } - if (npc.direction > 0 && npc.velocity.X < velocityLimit) + if (NPC.direction > 0 && NPC.velocity.X < velocityLimit) { - npc.velocity.X = velocityLimit; + NPC.velocity.X = velocityLimit; } } - if (npc.ai[2] >= 2f && npc.velocity.Y == 0f) + if (NPC.ai[2] >= 2f && NPC.velocity.Y == 0f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 6f) + else if (NPC.ai[0] == 6f) { - npc.life = npc.lifeMax; - npc.defense = 9999; - npc.noTileCollide = true; - npc.alpha += 7; - if (npc.timeLeft > 10) + NPC.life = NPC.lifeMax; + NPC.defense = 9999; + NPC.noTileCollide = true; + NPC.alpha += 7; + if (NPC.timeLeft > 10) { - npc.timeLeft = 10; + NPC.timeLeft = 10; } - if (npc.alpha > 255) + if (NPC.alpha > 255) { - npc.alpha = 255; + NPC.alpha = 255; } - npc.velocity.X *= 0.98f; + NPC.velocity.X *= 0.98f; } } - int num244 = Dust.NewDust(npc.position, npc.width, npc.height, 173, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); + int num244 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 173, NPC.velocity.X, NPC.velocity.Y, 255, new Color(0, 80, 255, 80), NPC.scale * 1.2f); Main.dust[num244].noGravity = true; Main.dust[num244].velocity *= 0.5f; - if (bossLife == 0f && npc.life > 0) + if (bossLife == 0f && NPC.life > 0) { - bossLife = npc.lifeMax; + bossLife = NPC.lifeMax; } float num644 = 1f; - if (npc.life > 0) + if (NPC.life > 0) { float num659 = lifeRatio; num659 = num659 * 0.5f + 0.75f; num659 *= num644; - if (num659 != npc.scale) + if (num659 != NPC.scale) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)npc.height; - npc.scale = num659; - npc.width = (int)(150f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)npc.height; + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)NPC.height; + NPC.scale = num659; + NPC.width = (int)(150f * NPC.scale); + NPC.height = (int)(92f * NPC.scale); + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)NPC.height; } if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)((double)npc.lifeMax * 0.2); - if ((float)(npc.life + num660) < bossLife) + int num660 = (int)((double)NPC.lifeMax * 0.2); + if ((float)(NPC.life + num660) < bossLife) { - bossLife = (float)npc.life; + bossLife = (float)NPC.life; int num661 = Main.rand.Next(1, 3); for (int num662 = 0; num662 < num661; num662++) { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); + int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); int num663 = ModContent.NPCType(); int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num664].SetDefaults(num663, -1f); @@ -541,8 +542,8 @@ namespace CalamityMod.NPCs.SlimeGod public override Color? GetAlpha(Color drawColor) { - Color lightColor = new Color(200, 150, Main.DiscoB, npc.alpha); - Color newColor = npc.localAI[1] == 1f ? lightColor : drawColor; + Color lightColor = new Color(200, 150, Main.DiscoB, NPC.alpha); + Color newColor = NPC.localAI[1] == 1f ? lightColor : drawColor; return newColor; } @@ -560,7 +561,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()); if (!otherSlimeGodsAlive) - SlimeGodCore.DropSlimeGodLoot(npc); + SlimeGodCore.DropSlimeGodLoot(NPC); } public override bool CheckActive() @@ -577,13 +578,13 @@ namespace CalamityMod.NPCs.SlimeGod { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 00e562860a..f811688b50 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -20,6 +20,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.SlimeGod { [AutoloadBossHead] @@ -35,83 +36,83 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 10f; - npc.width = 44; - npc.height = 44; - npc.defense = 6; - npc.LifeMaxNERB(2100, 2500, 250000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 10f; + NPC.width = 44; + NPC.height = 44; + NPC.defense = 6; + NPC.LifeMaxNERB(2100, 2500, 250000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPCID.Sets.TrailCacheLength[NPC.type] = 8; + NPCID.Sets.TrailingMode[NPC.type] = 1; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.Opacity = 0.8f; - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 25, 0, 0); + NPC.Opacity = 0.8f; + NPC.boss = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); writer.Write(buffedSlime); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); buffedSlime = reader.ReadInt32(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - CalamityGlobalNPC.slimeGod = npc.whoAmI; + CalamityGlobalNPC.slimeGod = NPC.whoAmI; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; - Vector2 vectorCenter = npc.Center; + Vector2 vectorCenter = NPC.Center; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, vectorCenter) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, vectorCenter) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; if (Main.netMode != NetmodeID.MultiplayerClient && !slimesSpawned) { @@ -122,14 +123,14 @@ namespace CalamityMod.NPCs.SlimeGod // Emit dust int randomDust = Main.rand.NextBool(2) ? 173 : 260; - int num658 = Dust.NewDust(npc.position, npc.width, npc.height, randomDust, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.5f); + int num658 = Dust.NewDust(NPC.position, NPC.width, NPC.height, randomDust, NPC.velocity.X, NPC.velocity.Y, 255, new Color(0, 80, 255, 80), NPC.scale * 1.5f); Main.dust[num658].noGravity = true; Main.dust[num658].velocity *= 0.5f; - npc.dontTakeDamage = false; + NPC.dontTakeDamage = false; // Set damage - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; // Enrage based on large slimes bool phase2 = lifeRatio < 0.4f || malice; @@ -164,8 +165,8 @@ namespace CalamityMod.NPCs.SlimeGod else Main.npc[CalamityGlobalNPC.slimeGodRed].localAI[1] = 0f; - npc.localAI[2] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.X; - npc.localAI[3] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.Y; + NPC.localAI[2] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.X; + NPC.localAI[3] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.Y; redSlimeAlive = true; phase2 = lifeRatio < 0.2f; @@ -176,17 +177,17 @@ namespace CalamityMod.NPCs.SlimeGod // Despawn if (!player.active || player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; if (!player.active || player.dead) { - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - npc.velocity.Y += 0.2f; - if (npc.velocity.Y > 16f) - npc.velocity.Y = 16f; + if (NPC.velocity.Y < -3f) + NPC.velocity.Y = -3f; + NPC.velocity.Y += 0.2f; + if (NPC.velocity.Y > 16f) + NPC.velocity.Y = 16f; - if (npc.position.Y > Main.worldSurface * 16.0) + if (NPC.position.Y > Main.worldSurface * 16.0) { for (int x = 0; x < Main.maxNPCs; x++) { @@ -197,51 +198,51 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[x].netUpdate = true; } } - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; } - if (npc.ai[0] != 0f || npc.ai[1] != 0f) + if (NPC.ai[0] != 0f || NPC.ai[1] != 0f) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.netUpdate = true; } return; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; float ai1 = malice ? 210f : hyperMode ? 270f : 360f; // Hide inside large slime - if (!hyperMode && npc.ai[1] < ai1) + if (!hyperMode && NPC.ai[1] < ai1) { - if (calamityGlobalNPC.newAI[2] == 0f && npc.life > 0) + if (calamityGlobalNPC.newAI[2] == 0f && NPC.life > 0) { - calamityGlobalNPC.newAI[2] = npc.lifeMax; + calamityGlobalNPC.newAI[2] = NPC.lifeMax; } - if (npc.life > 0) + if (NPC.life > 0) { - int num660 = (int)(npc.lifeMax * 0.05); - if ((npc.life + num660) < calamityGlobalNPC.newAI[2]) + int num660 = (int)(NPC.lifeMax * 0.05); + if ((NPC.life + num660) < calamityGlobalNPC.newAI[2]) { - calamityGlobalNPC.newAI[2] = npc.life; + calamityGlobalNPC.newAI[2] = NPC.life; calamityGlobalNPC.newAI[3] = 1f; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SlimeGodPossession"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SlimeGodPossession"), (int)NPC.position.X, (int)NPC.position.Y); } } if (calamityGlobalNPC.newAI[3] == 1f) { - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; if (buffedSlime == 0) { @@ -254,20 +255,20 @@ namespace CalamityMod.NPCs.SlimeGod } Vector2 purpleSlimeVector = new Vector2(calamityGlobalNPC.newAI[0], calamityGlobalNPC.newAI[1]); - Vector2 redSlimeVector = new Vector2(npc.localAI[2], npc.localAI[3]); + Vector2 redSlimeVector = new Vector2(NPC.localAI[2], NPC.localAI[3]); Vector2 goToVector = buffedSlime == 1 ? purpleSlimeVector : redSlimeVector; Vector2 goToPosition = goToVector - vectorCenter; - npc.velocity = Vector2.Normalize(goToPosition) * 24f; + NPC.velocity = Vector2.Normalize(goToPosition) * 24f; // Reduce velocity to 0 to avoid spastic movement when inside big slime. - if (Vector2.Distance(npc.Center, goToVector) < 24f) + if (Vector2.Distance(NPC.Center, goToVector) < 24f) { - npc.velocity = Vector2.Zero; + NPC.velocity = Vector2.Zero; - npc.Opacity -= 0.2f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; + NPC.Opacity -= 0.2f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; } bool slimeDead = false; @@ -276,17 +277,17 @@ namespace CalamityMod.NPCs.SlimeGod else slimeDead = CalamityGlobalNPC.slimeGodRed < 0 || !Main.npc[CalamityGlobalNPC.slimeGodRed].active; - npc.ai[2] += 1f; - if (npc.ai[2] >= 600f || slimeDead) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 600f || slimeDead) { - npc.TargetClosest(); - npc.ai[2] = 0f; + NPC.TargetClosest(); + NPC.ai[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; - npc.velocity = Vector2.UnitY * -12f; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SlimeGodExit"), (int)npc.position.X, (int)npc.position.Y); + NPC.velocity = Vector2.UnitY * -12f; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SlimeGodExit"), (int)NPC.position.X, (int)NPC.position.Y); for (int i = 0; i < 20; i++) { - int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -296,10 +297,10 @@ namespace CalamityMod.NPCs.SlimeGod } for (int j = 0; j < 30; j++) { - int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 3f); + int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 5f; - dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 2f; } } @@ -307,112 +308,112 @@ namespace CalamityMod.NPCs.SlimeGod return; } - npc.Opacity += 0.2f; - if (npc.Opacity > 0.8f) - npc.Opacity = 0.8f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 0.8f) + NPC.Opacity = 0.8f; buffedSlime = 0; } - else if (npc.ai[1] < ai1) + else if (NPC.ai[1] < ai1) { - npc.Opacity += 0.2f; - if (npc.Opacity > 0.8f) - npc.Opacity = 0.8f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 0.8f) + NPC.Opacity = 0.8f; } // Spin and shoot orbs if (phase2) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; if (revenge) { - if (npc.ai[1] >= ai1) + if (NPC.ai[1] >= ai1) { - if (npc.localAI[1] == 0f) + if (NPC.localAI[1] == 0f) { // Slow down, rotation - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; // Set teleport location, turn invisible, spin direction - npc.Opacity -= 0.2f; - if (npc.Opacity <= 0f) + NPC.Opacity -= 0.2f; + if (NPC.Opacity <= 0f) { - npc.Opacity = 0f; - npc.velocity.Normalize(); + NPC.Opacity = 0f; + NPC.velocity.Normalize(); int teleportX = player.velocity.X < 0f ? -20 : 20; int teleportY = player.velocity.Y < 0f ? -10 : 10; int playerPosX = (int)player.Center.X / 16 + teleportX; int playerPosY = (int)player.Center.Y / 16 - teleportY; - npc.ai[2] = playerPosX; - npc.ai[3] = playerPosY; - npc.localAI[1] = 1f; - npc.netUpdate = true; + NPC.ai[2] = playerPosX; + NPC.ai[3] = playerPosY; + NPC.localAI[1] = 1f; + NPC.netUpdate = true; } } - else if (npc.localAI[1] == 1f) + else if (NPC.localAI[1] == 1f) { // Rotation - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; // Teleport to location - if (npc.Opacity == 0f) + if (NPC.Opacity == 0f) { - Vector2 position = new Vector2(npc.ai[2] * 16f - (npc.width / 2), npc.ai[3] * 16f - (npc.height / 2)); - npc.position = position; + Vector2 position = new Vector2(NPC.ai[2] * 16f - (NPC.width / 2), NPC.ai[3] * 16f - (NPC.height / 2)); + NPC.position = position; } // Turn visible - npc.Opacity += 0.2f; - if (npc.Opacity >= 0.8f) + NPC.Opacity += 0.2f; + if (NPC.Opacity >= 0.8f) { - npc.Opacity = 0.8f; - npc.localAI[0] = vectorCenter.X - player.Center.X < 0 ? 1f : -1f; - npc.localAI[1] = 2f; + NPC.Opacity = 0.8f; + NPC.localAI[0] = vectorCenter.X - player.Center.X < 0 ? 1f : -1f; + NPC.localAI[1] = 2f; } - npc.netUpdate = true; + NPC.netUpdate = true; } else { // No damage while spinning - npc.damage = 0; + NPC.damage = 0; // Rotation - npc.rotation += npc.direction * 0.3f; + NPC.rotation += NPC.direction * 0.3f; // Velocity boost - if (npc.localAI[1] == 2f) + if (NPC.localAI[1] == 2f) { - npc.localAI[1] = 3f; - npc.velocity *= 12f; + NPC.localAI[1] = 3f; + NPC.velocity *= 12f; } // Spin velocity - float velocity = MathHelper.TwoPi / (180f - (npc.ai[1] - ai1)); - npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.localAI[0]); + float velocity = MathHelper.TwoPi / (180f - (NPC.ai[1] - ai1)); + NPC.velocity = NPC.velocity.RotatedBy(-(double)velocity * NPC.localAI[0]); // Reset and charge at target - if (npc.ai[1] >= ai1 + 100f) + if (NPC.ai[1] >= ai1 + 100f) { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; float chargeVelocity = death ? 12f : 9f; - npc.velocity = Vector2.Normalize(player.Center + (malice ? player.velocity * 20f : Vector2.Zero) - vectorCenter) * chargeVelocity; - npc.TargetClosest(); + NPC.velocity = Vector2.Normalize(player.Center + (malice ? player.velocity * 20f : Vector2.Zero) - vectorCenter) * chargeVelocity; + NPC.TargetClosest(); return; } if (Main.netMode != NetmodeID.MultiplayerClient) { float divisor = malice ? 10f : 15f; - if (npc.ai[1] % divisor == 0f && Vector2.Distance(player.Center, vectorCenter) > 160f) + if (NPC.ai[1] % divisor == 0f && Vector2.Distance(player.Center, vectorCenter) > 160f) { float num179 = expertMode ? 9f : 7.5f; - Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 value9 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num180 = player.position.X + player.width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; @@ -421,7 +422,7 @@ namespace CalamityMod.NPCs.SlimeGod num180 *= num183; num182 *= num183; int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; num180 = player.position.X + player.width * 0.5f - value9.X; @@ -441,10 +442,10 @@ namespace CalamityMod.NPCs.SlimeGod { if (Main.netMode != NetmodeID.MultiplayerClient && Vector2.Distance(player.Center, vectorCenter) > 160f) { - if (npc.ai[1] % 40f == 0f) + if (NPC.ai[1] % 40f == 0f) { float num179 = expertMode ? 12f : 10f; - Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 value9 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num180 = player.position.X + player.width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; @@ -453,7 +454,7 @@ namespace CalamityMod.NPCs.SlimeGod num180 *= num183; num182 *= num183; int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; int totalProjectiles = expertMode ? 3 : 2; @@ -485,7 +486,7 @@ namespace CalamityMod.NPCs.SlimeGod num1372 *= 1.25f; } - Vector2 vector167 = new Vector2(vectorCenter.X + (npc.direction * 20), vectorCenter.Y + 6f); + Vector2 vector167 = new Vector2(vectorCenter.X + (NPC.direction * 20), vectorCenter.Y + 6f); float num1373 = player.position.X + player.width * 0.5f - vector167.X; float num1374 = player.Center.Y - vector167.Y; float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); @@ -493,52 +494,52 @@ namespace CalamityMod.NPCs.SlimeGod num1373 *= num1376; num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) + NPC.ai[0] -= 1f; + if (num1375 < 200f || NPC.ai[0] > 0f) { if (num1375 < 200f) { - npc.ai[0] = 20f; + NPC.ai[0] = 20f; } - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.direction = -1; + NPC.direction = -1; } else { - npc.direction = 1; + NPC.direction = 1; } - npc.rotation += npc.direction * 0.3f; + NPC.rotation += NPC.direction * 0.3f; return; } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f; + NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f; if (num1375 < 350f) { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + NPC.velocity.X = (NPC.velocity.X * 10f + num1373) / 11f; + NPC.velocity.Y = (NPC.velocity.Y * 10f + num1374) / 11f; } if (num1375 < 300f) { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + NPC.velocity.X = (NPC.velocity.X * 7f + num1373) / 8f; + NPC.velocity.Y = (NPC.velocity.Y * 7f + num1374) / 8f; } - npc.rotation = npc.velocity.X * 0.1f; + NPC.rotation = NPC.velocity.X * 0.1f; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Color color24 = npc.GetAlpha(drawColor); - Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; + Color color24 = NPC.GetAlpha(drawColor); + Color color25 = Lighting.GetColor((int)((double)NPC.position.X + (double)NPC.width * 0.5) / 16, (int)(((double)NPC.position.Y + (double)NPC.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[NPC.type]; + int num156 = Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type]; + int y3 = num156 * (int)NPC.frameCounter; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num156); Vector2 origin2 = rectangle.Size() / 2f; int num157 = 8; @@ -546,10 +547,10 @@ namespace CalamityMod.NPCs.SlimeGod int num159 = 1; float num160 = 0f; int num161 = num159; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); + spriteBatch.Draw(texture2D3, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY), NPC.frame, color24, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0); while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && CalamityConfig.Instance.Afterimages) { - Color color26 = npc.GetAlpha(color25); + Color color26 = NPC.GetAlpha(color25); { goto IL_6899; } @@ -562,10 +563,10 @@ namespace CalamityMod.NPCs.SlimeGod { num164 = (float)(num159 - num161); } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = npc.oldPos[num161]; - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[NPC.type] * 1.5f); + Vector2 value4 = NPC.oldPos[num161]; + float num165 = NPC.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + NPC.Size / 2f - Main.screenPosition + new Vector2(0, NPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + NPC.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, NPC.scale, spriteEffects, 0f); goto IL_6881; } return false; @@ -584,7 +585,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()); if (!otherSlimeGodsAlive) - DropSlimeGodLoot(npc); + DropSlimeGodLoot(NPC); } // This loot code is shared with every other Slime God component. @@ -643,19 +644,19 @@ namespace CalamityMod.NPCs.SlimeGod { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 40; - npc.height = 40; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 40; + NPC.height = 40; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -665,10 +666,10 @@ namespace CalamityMod.NPCs.SlimeGod } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -676,7 +677,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index 7adff13d2f..0442928ff6 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.SlimeGod { @@ -19,119 +20,119 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetStaticDefaults() { DisplayName.SetDefault("Crimulan Slime God"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.width = 150; - npc.height = 92; - npc.scale = 1.1f; - npc.defense = 12; - npc.LifeMaxNERB(4750, 5700, 160000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.width = 150; + NPC.height = 92; + NPC.scale = 1.1f; + NPC.defense = 12; + NPC.LifeMaxNERB(4750, 5700, 160000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; animationType = NPCID.KingSlime; - npc.value = 0f; - npc.alpha = 55; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + NPC.value = 0f; + NPC.alpha = 55; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.localAI[1]); + writer.Write(NPC.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.localAI[1] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC.slimeGodRed = npc.whoAmI; + CalamityGlobalNPC.slimeGodRed = NPC.whoAmI; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || npc.localAI[1] == 1f || BossRushEvent.BossRushActive; - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; + bool death = CalamityWorld.death || NPC.localAI[1] == 1f || BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; - Vector2 vector = npc.Center; + Vector2 vector = NPC.Center; - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; - npc.defense = npc.defDefense; - npc.damage = npc.defDamage; - if (npc.localAI[1] == 1f) + NPC.defense = NPC.defDefense; + NPC.damage = NPC.defDamage; + if (NPC.localAI[1] == 1f) { - npc.defense = npc.defDefense + 24; - npc.damage = npc.defDamage + 25; + NPC.defense = NPC.defDefense + 24; + NPC.damage = NPC.defDamage + 25; } - npc.aiAction = 0; - npc.noTileCollide = false; - npc.noGravity = false; + NPC.aiAction = 0; + NPC.noTileCollide = false; + NPC.noGravity = false; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; - if (npc.ai[0] != 6f && (player.dead || !player.active)) + if (NPC.ai[0] != 6f && (player.dead || !player.active)) { - npc.TargetClosest(); - player = Main.player[npc.target]; + NPC.TargetClosest(); + player = Main.player[NPC.target]; if (player.dead || !player.active) { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; if (Vector2.Distance(player.Center, vector) > 5400f) { - npc.position.X = player.Center.X / 16 * 16f - (npc.width / 2); - npc.position.Y = player.Center.Y / 16 * 16f - (npc.height / 2) - 150f; + NPC.position.X = player.Center.X / 16 * 16f - (NPC.width / 2); + NPC.position.Y = player.Center.Y / 16 * 16f - (NPC.height / 2) - 150f; } float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * (malice ? 0.008f : 0.005f); if (lifeRatio <= 0.5f && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { - Main.PlaySound(SoundID.NPCDeath1, npc.position); - Vector2 spawnAt = vector + new Vector2(0f, npc.height / 2f); + SoundEngine.PlaySound(SoundID.NPCDeath1, NPC.position); + Vector2 spawnAt = vector + new Vector2(0f, NPC.height / 2f); NPC.NewNPC((int)spawnAt.X - 30, (int)spawnAt.Y, ModContent.NPCType()); NPC.NewNPC((int)spawnAt.X + 30, (int)spawnAt.Y, ModContent.NPCType()); - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } bool flag100 = false; - bool hyperMode = npc.localAI[1] == 1f; + bool hyperMode = NPC.localAI[1] == 1f; if (CalamityGlobalNPC.slimeGodPurple != -1) { if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) @@ -141,7 +142,7 @@ namespace CalamityMod.NPCs.SlimeGod } if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; hyperMode = true; flag100 = false; } @@ -151,25 +152,25 @@ namespace CalamityMod.NPCs.SlimeGod hyperMode = true; } - if (npc.localAI[1] != 1f) + if (NPC.localAI[1] != 1f) { if (!flag100) - npc.defense = npc.defDefense * 2; + NPC.defense = NPC.defDefense * 2; } if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += flag100 ? 1f : 2f; + NPC.localAI[0] += flag100 ? 1f : 2f; if (revenge) - npc.localAI[0] += 0.5f; + NPC.localAI[0] += 0.5f; if (malice) - npc.localAI[0] += 1f; + NPC.localAI[0] += 1f; - if (npc.localAI[0] >= 450f && Vector2.Distance(player.Center, npc.Center) > 160f) + if (NPC.localAI[0] >= 450f && Vector2.Distance(player.Center, NPC.Center) > 160f) { - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; float num179 = expertMode ? 12f : 10f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + Vector2 value9 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); float num180 = player.position.X + (float)player.width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; @@ -178,7 +179,7 @@ namespace CalamityMod.NPCs.SlimeGod num180 *= num183; num182 *= num183; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; for (int num186 = 0; num186 < 2; num186++) @@ -196,26 +197,26 @@ namespace CalamityMod.NPCs.SlimeGod } } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { if ((player.Center - vector).Length() > (hyperMode ? 1200f : 2400f)) { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.TargetClosest(); - npc.velocity.X *= 0.8f; - npc.ai[1] += 1f; + NPC.TargetClosest(); + NPC.velocity.X *= 0.8f; + NPC.ai[1] += 1f; float num1879 = 50f; float num1880 = death ? 4.5f : revenge ? 4f : expertMode ? 3.5f : 3f; if (revenge) @@ -230,302 +231,302 @@ namespace CalamityMod.NPCs.SlimeGod { num1881 += 2f; } - if (npc.ai[1] > num1879) + if (NPC.ai[1] > num1879) { - npc.ai[3] += 1f; - if (npc.ai[3] >= 2f) + NPC.ai[3] += 1f; + if (NPC.ai[3] >= 2f) { - npc.ai[3] = 0f; + NPC.ai[3] = 0f; num1881 *= 0.75f; num1880 *= 1.25f; } - npc.ai[1] = 0f; - npc.velocity.Y -= num1881; - npc.velocity.X = (num1880 + distanceSpeedBoost) * npc.direction; - npc.netUpdate = true; + NPC.ai[1] = 0f; + NPC.velocity.Y -= num1881; + NPC.velocity.X = (num1880 + distanceSpeedBoost) * NPC.direction; + NPC.netUpdate = true; } } else { - npc.velocity.X *= 0.99f; - if (npc.direction < 0 && npc.velocity.X > -1f) + NPC.velocity.X *= 0.99f; + if (NPC.direction < 0 && NPC.velocity.X > -1f) { - npc.velocity.X = -1f; + NPC.velocity.X = -1f; } - if (npc.direction > 0 && npc.velocity.X < 1f) + if (NPC.direction > 0 && NPC.velocity.X < 1f) { - npc.velocity.X = 1f; + NPC.velocity.X = 1f; } } - npc.ai[2] += 1f; + NPC.ai[2] += 1f; if (revenge) { - npc.ai[2] += death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + NPC.ai[2] += death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); } - if (npc.ai[2] >= 360f && npc.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.ai[2] >= 360f && NPC.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) { int random = Main.rand.Next(2) + (lifeRatio < 0.75f ? 1 : 0); switch (random) { case 0: - npc.ai[0] = 2f; + NPC.ai[0] = 2f; break; case 1: - npc.ai[0] = 3f; - npc.noTileCollide = true; - npc.velocity.Y = death ? -10f : revenge ? -9f : expertMode ? -8f : -7f; + NPC.ai[0] = 3f; + NPC.noTileCollide = true; + NPC.velocity.Y = death ? -10f : revenge ? -9f : expertMode ? -8f : -7f; break; case 2: - npc.ai[0] = 5f; + NPC.ai[0] = 5f; break; default: break; } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - npc.velocity.X *= 0.85f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 40f) + NPC.velocity.X *= 0.85f; + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 40f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - npc.noTileCollide = true; - npc.noGravity = true; - if (npc.velocity.X < 0f) + NPC.noTileCollide = true; + NPC.noGravity = true; + if (NPC.velocity.X < 0f) { - npc.direction = -1; + NPC.direction = -1; } else { - npc.direction = 1; + NPC.direction = 1; } - npc.spriteDirection = npc.direction; - npc.TargetClosest(); + NPC.spriteDirection = NPC.direction; + NPC.TargetClosest(); Vector2 center40 = player.Center; center40.Y -= 350f; Vector2 vector272 = center40 - vector; - if (npc.ai[2] == 1f) + if (NPC.ai[2] == 1f) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; vector272 = player.Center - vector; vector272.Normalize(); vector272 *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; - npc.velocity = (npc.velocity * 4f + vector272) / 5f; - if (npc.ai[1] > 12f) + NPC.velocity = (NPC.velocity * 4f + vector272) / 5f; + if (NPC.ai[1] > 12f) { - npc.ai[1] = 0f; - npc.ai[0] = 3.1f; - npc.ai[2] = 0f; - npc.velocity = vector272; - npc.netUpdate = true; + NPC.ai[1] = 0f; + NPC.ai[0] = 3.1f; + NPC.ai[2] = 0f; + NPC.velocity = vector272; + NPC.netUpdate = true; } } else { if (Math.Abs(vector.X - player.Center.X) < 40f && vector.Y < player.Center.Y - 300f) { - npc.ai[1] = 0f; - npc.ai[2] = 1f; - npc.netUpdate = true; + NPC.ai[1] = 0f; + NPC.ai[2] = 1f; + NPC.netUpdate = true; return; } vector272.Normalize(); vector272 *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; - npc.velocity = (npc.velocity * 5f + vector272) / 6f; + NPC.velocity = (NPC.velocity * 5f + vector272) / 6f; } } - else if (npc.ai[0] == 3.1f) + else if (NPC.ai[0] == 3.1f) { - bool atTargetPosition = npc.position.Y + npc.height >= player.position.Y; - if (npc.ai[2] == 0f && (atTargetPosition || npc.localAI[1] == 0f) && Collision.CanHit(vector, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; + if (NPC.ai[2] == 0f && (atTargetPosition || NPC.localAI[1] == 0f) && Collision.CanHit(vector, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.ai[2] = 1f; - npc.netUpdate = true; + NPC.ai[2] = 1f; + NPC.netUpdate = true; } - if (atTargetPosition || npc.velocity.Y <= 0f) + if (atTargetPosition || NPC.velocity.Y <= 0f) { - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) + NPC.ai[1] += 1f; + if (NPC.ai[1] > 10f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.ai[0] = 4f; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.ai[0] = 4f; - npc.netUpdate = true; + NPC.netUpdate = true; } } - else if (npc.ai[2] == 0f) + else if (NPC.ai[2] == 0f) { - npc.noTileCollide = true; + NPC.noTileCollide = true; } - npc.noGravity = true; - npc.velocity.Y += 0.5f; + NPC.noGravity = true; + NPC.velocity.Y += 0.5f; float velocityLimit = malice ? 20f : death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; - if (npc.velocity.Y > velocityLimit) + if (NPC.velocity.Y > velocityLimit) { - npc.velocity.Y = velocityLimit; + NPC.velocity.Y = velocityLimit; } } else { - if (npc.ai[0] == 4f) + if (NPC.ai[0] == 4f) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.direction = 1; + NPC.direction = 1; } else { - npc.direction = -1; + NPC.direction = -1; } - npc.spriteDirection = npc.direction; - npc.noTileCollide = true; - npc.noGravity = true; + NPC.spriteDirection = NPC.direction; + NPC.noTileCollide = true; + NPC.noGravity = true; Vector2 value74 = player.Center - vector; value74.Y -= 40f; - if (value74.Length() < 320f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (value74.Length() < 320f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } if (value74.Length() > 100f) { value74.Normalize(); value74 *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; } - npc.velocity = (npc.velocity * 4f + value74) / 5f; + NPC.velocity = (NPC.velocity * 4f + value74) / 5f; return; } - if (npc.ai[0] == 5f) + if (NPC.ai[0] == 5f) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.TargetClosest(); - npc.velocity.X *= 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] > 5f) + NPC.TargetClosest(); + NPC.velocity.X *= 0.8f; + NPC.ai[1] += 1f; + if (NPC.ai[1] > 5f) { - npc.ai[1] = 0f; - npc.velocity.Y -= 4f; + NPC.ai[1] = 0f; + NPC.velocity.Y -= 4f; if (player.position.Y + player.height < vector.Y) { - npc.velocity.Y -= 1.25f; + NPC.velocity.Y -= 1.25f; } if (player.position.Y + player.height < vector.Y - 40f) { - npc.velocity.Y -= 1.5f; + NPC.velocity.Y -= 1.5f; } if (player.position.Y + player.height < vector.Y - 80f) { - npc.velocity.Y -= 1.75f; + NPC.velocity.Y -= 1.75f; } if (player.position.Y + player.height < vector.Y - 120f) { - npc.velocity.Y -= 2f; + NPC.velocity.Y -= 2f; } if (player.position.Y + player.height < vector.Y - 160f) { - npc.velocity.Y -= 2.25f; + NPC.velocity.Y -= 2.25f; } if (player.position.Y + player.height < vector.Y - 200f) { - npc.velocity.Y -= 2.5f; + NPC.velocity.Y -= 2.5f; } if (!Collision.CanHit(vector, 1, 1, player.Center, 1, 1)) { - npc.velocity.Y -= 2f; + NPC.velocity.Y -= 2f; } - npc.velocity.X = ((death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost) * npc.direction; - npc.ai[2] += 1f; + NPC.velocity.X = ((death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost) * NPC.direction; + NPC.ai[2] += 1f; } } else { - npc.velocity.X *= 0.98f; + NPC.velocity.X *= 0.98f; float velocityLimit = (death ? 6.5f : revenge ? 6f : expertMode ? 5.5f : 5f) + distanceSpeedBoost; - if (npc.direction < 0 && npc.velocity.X > -velocityLimit) + if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) { - npc.velocity.X = -velocityLimit; + NPC.velocity.X = -velocityLimit; } - if (npc.direction > 0 && npc.velocity.X < velocityLimit) + if (NPC.direction > 0 && NPC.velocity.X < velocityLimit) { - npc.velocity.X = velocityLimit; + NPC.velocity.X = velocityLimit; } } - if (npc.ai[2] >= 3f && npc.velocity.Y == 0f) + if (NPC.ai[2] >= 3f && NPC.velocity.Y == 0f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 6f) + else if (NPC.ai[0] == 6f) { - npc.life = npc.lifeMax; - npc.defense = 9999; - npc.noTileCollide = true; - npc.alpha += 7; - if (npc.timeLeft > 10) + NPC.life = NPC.lifeMax; + NPC.defense = 9999; + NPC.noTileCollide = true; + NPC.alpha += 7; + if (NPC.timeLeft > 10) { - npc.timeLeft = 10; + NPC.timeLeft = 10; } - if (npc.alpha > 255) + if (NPC.alpha > 255) { - npc.alpha = 255; + NPC.alpha = 255; } - npc.velocity.X *= 0.98f; + NPC.velocity.X *= 0.98f; } } - int num658 = Dust.NewDust(npc.position, npc.width, npc.height, 260, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.5f); + int num658 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 260, NPC.velocity.X, NPC.velocity.Y, 255, new Color(0, 80, 255, 80), NPC.scale * 1.5f); Main.dust[num658].noGravity = true; Main.dust[num658].velocity *= 0.5f; - if (bossLife == 0f && npc.life > 0) + if (bossLife == 0f && NPC.life > 0) { - bossLife = npc.lifeMax; + bossLife = NPC.lifeMax; } float num644 = 1f; - if (npc.life > 0) + if (NPC.life > 0) { float num659 = lifeRatio; num659 = num659 * 0.5f + 0.75f; num659 *= num644; - if (num659 != npc.scale) + if (num659 != NPC.scale) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)npc.height; - npc.scale = num659; - npc.width = (int)(150f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)npc.height; + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)NPC.height; + NPC.scale = num659; + NPC.width = (int)(150f * NPC.scale); + NPC.height = (int)(92f * NPC.scale); + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)NPC.height; } if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)((double)npc.lifeMax * 0.15); - if ((float)(npc.life + num660) < bossLife) + int num660 = (int)((double)NPC.lifeMax * 0.15); + if ((float)(NPC.life + num660) < bossLife) { - bossLife = (float)npc.life; - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + bossLife = (float)NPC.life; + int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); + int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); int num663 = ModContent.NPCType(); if (Main.rand.NextBool(3)) { @@ -548,8 +549,8 @@ namespace CalamityMod.NPCs.SlimeGod public override Color? GetAlpha(Color drawColor) { - Color lightColor = new Color(Main.DiscoR, 100, 150, npc.alpha); - Color newColor = npc.localAI[1] == 1f ? lightColor : drawColor; + Color lightColor = new Color(Main.DiscoR, 100, 150, NPC.alpha); + Color newColor = NPC.localAI[1] == 1f ? lightColor : drawColor; return newColor; } @@ -567,7 +568,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()); if (!otherSlimeGodsAlive) - SlimeGodCore.DropSlimeGodLoot(npc); + SlimeGodCore.DropSlimeGodLoot(NPC); } public override bool CheckActive() @@ -584,13 +585,13 @@ namespace CalamityMod.NPCs.SlimeGod { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index 81bdeaeb48..624e48fe32 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -19,104 +19,104 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetStaticDefaults() { DisplayName.SetDefault("Crimulan Slime God"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.LifeMaxNERB(1005, 1205, 80000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.LifeMaxNERB(1005, 1205, 80000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.GetNPCDamage(); - npc.width = 150; - npc.height = 92; - npc.scale = 0.8f; - npc.defense = 10; - npc.knockBackResist = 0f; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.GetNPCDamage(); + NPC.width = 150; + NPC.height = 92; + NPC.scale = 0.8f; + NPC.defense = 10; + NPC.knockBackResist = 0f; animationType = NPCID.KingSlime; - npc.value = Item.buyPrice(0, 1, 0, 0); - npc.alpha = 55; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + NPC.value = Item.buyPrice(0, 1, 0, 0); + NPC.alpha = 55; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.localAI[1]); + writer.Write(NPC.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.localAI[1] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); } public override void AI() { if (CalamityGlobalNPC.slimeGodRed < 0 || !Main.npc[CalamityGlobalNPC.slimeGodRed].active) - CalamityGlobalNPC.slimeGodRed = npc.whoAmI; + CalamityGlobalNPC.slimeGodRed = NPC.whoAmI; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || npc.localAI[1] == 1f || BossRushEvent.BossRushActive; - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; + bool death = CalamityWorld.death || NPC.localAI[1] == 1f || BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; - Vector2 vector = npc.Center; + Vector2 vector = NPC.Center; - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; - npc.defense = npc.defDefense; - npc.damage = npc.defDamage; - if (npc.localAI[1] == 1f) + NPC.defense = NPC.defDefense; + NPC.damage = NPC.defDamage; + if (NPC.localAI[1] == 1f) { - npc.defense = npc.defDefense + 20; - npc.damage = npc.defDamage + 22; + NPC.defense = NPC.defDefense + 20; + NPC.damage = NPC.defDamage + 22; } - npc.aiAction = 0; - npc.noTileCollide = false; - npc.noGravity = false; + NPC.aiAction = 0; + NPC.noTileCollide = false; + NPC.noGravity = false; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; - if (npc.ai[0] != 6f && (player.dead || !player.active)) + if (NPC.ai[0] != 6f && (player.dead || !player.active)) { - npc.TargetClosest(); - player = Main.player[npc.target]; + NPC.TargetClosest(); + player = Main.player[NPC.target]; if (player.dead || !player.active) { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * (malice ? 0.008f : 0.005f); bool flag100 = false; - bool hyperMode = npc.localAI[1] == 1f; + bool hyperMode = NPC.localAI[1] == 1f; if (CalamityGlobalNPC.slimeGodPurple != -1) { if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) @@ -126,7 +126,7 @@ namespace CalamityMod.NPCs.SlimeGod } if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; hyperMode = true; flag100 = false; } @@ -136,25 +136,25 @@ namespace CalamityMod.NPCs.SlimeGod hyperMode = true; } - if (npc.localAI[1] != 1f) + if (NPC.localAI[1] != 1f) { if (!flag100) - npc.defense = npc.defDefense * 2; + NPC.defense = NPC.defDefense * 2; } if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += flag100 ? 0.5f : 1f; + NPC.localAI[0] += flag100 ? 0.5f : 1f; if (revenge) - npc.localAI[0] += 0.5f; + NPC.localAI[0] += 0.5f; if (malice) - npc.localAI[0] += 1f; + NPC.localAI[0] += 1f; - if (npc.localAI[0] >= 450f && Vector2.Distance(player.Center, npc.Center) > 160f) + if (NPC.localAI[0] >= 450f && Vector2.Distance(player.Center, NPC.Center) > 160f) { - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; float num179 = expertMode ? 12f : 10f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + Vector2 value9 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); float num180 = player.position.X + (float)player.width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; @@ -163,7 +163,7 @@ namespace CalamityMod.NPCs.SlimeGod num180 *= num183; num182 *= num183; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; num180 = player.position.X + (float)player.width * 0.5f - value9.X; @@ -176,27 +176,27 @@ namespace CalamityMod.NPCs.SlimeGod } } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { if ((player.Center - vector).Length() > (hyperMode ? 1200f : 3600f)) { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.TargetClosest(); - npc.velocity.X *= 0.8f; - npc.ai[1] += 1f; + NPC.TargetClosest(); + NPC.velocity.X *= 0.8f; + NPC.ai[1] += 1f; float num1879 = 35f; float num1880 = death ? 5.5f : revenge ? 5f : expertMode ? 4.5f : 4f; if (revenge) @@ -211,295 +211,295 @@ namespace CalamityMod.NPCs.SlimeGod { num1881 += 2f; } - if (npc.ai[1] > num1879) + if (NPC.ai[1] > num1879) { num1881 *= 0.75f; num1880 *= 1.25f; - npc.ai[1] = 0f; - npc.velocity.Y -= num1881; - npc.velocity.X = (num1880 + distanceSpeedBoost) * npc.direction; - npc.netUpdate = true; + NPC.ai[1] = 0f; + NPC.velocity.Y -= num1881; + NPC.velocity.X = (num1880 + distanceSpeedBoost) * NPC.direction; + NPC.netUpdate = true; } } else { - npc.velocity.X *= 0.99f; - if (npc.direction < 0 && npc.velocity.X > -1f) + NPC.velocity.X *= 0.99f; + if (NPC.direction < 0 && NPC.velocity.X > -1f) { - npc.velocity.X = -1f; + NPC.velocity.X = -1f; } - if (npc.direction > 0 && npc.velocity.X < 1f) + if (NPC.direction > 0 && NPC.velocity.X < 1f) { - npc.velocity.X = 1f; + NPC.velocity.X = 1f; } } - npc.ai[2] += 1f; + NPC.ai[2] += 1f; if (revenge) { - npc.ai[2] += death ? 1f - lifeRatio : 0.5f * (1f - lifeRatio); + NPC.ai[2] += death ? 1f - lifeRatio : 0.5f * (1f - lifeRatio); } - if (npc.ai[2] >= 180f && npc.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.ai[2] >= 180f && NPC.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) { int random = Main.rand.Next(2) + (lifeRatio < 0.5f ? 1 : 0); switch (random) { case 0: - npc.ai[0] = 2f; + NPC.ai[0] = 2f; break; case 1: - npc.ai[0] = 3f; - npc.noTileCollide = true; - npc.velocity.Y = death ? -11f : revenge ? -10f : expertMode ? -9f : -8f; + NPC.ai[0] = 3f; + NPC.noTileCollide = true; + NPC.velocity.Y = death ? -11f : revenge ? -10f : expertMode ? -9f : -8f; break; case 2: - npc.ai[0] = 5f; + NPC.ai[0] = 5f; break; default: break; } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - npc.velocity.X *= 0.85f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 30f) + NPC.velocity.X *= 0.85f; + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 30f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - npc.noTileCollide = true; - npc.noGravity = true; - if (npc.velocity.X < 0f) + NPC.noTileCollide = true; + NPC.noGravity = true; + if (NPC.velocity.X < 0f) { - npc.direction = -1; + NPC.direction = -1; } else { - npc.direction = 1; + NPC.direction = 1; } - npc.spriteDirection = npc.direction; - npc.TargetClosest(); + NPC.spriteDirection = NPC.direction; + NPC.TargetClosest(); Vector2 center40 = player.Center; center40.Y -= 350f; Vector2 vector272 = center40 - vector; - if (npc.ai[2] == 1f) + if (NPC.ai[2] == 1f) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; vector272 = player.Center - vector; vector272.Normalize(); vector272 *= death ? 11f : revenge ? 10f : expertMode ? 9f : 8f; - npc.velocity = (npc.velocity * 4f + vector272) / 5f; - if (npc.ai[1] > 12f) + NPC.velocity = (NPC.velocity * 4f + vector272) / 5f; + if (NPC.ai[1] > 12f) { - npc.ai[1] = 0f; - npc.ai[0] = 3.1f; - npc.ai[2] = 0f; - npc.velocity = vector272; - npc.netUpdate = true; + NPC.ai[1] = 0f; + NPC.ai[0] = 3.1f; + NPC.ai[2] = 0f; + NPC.velocity = vector272; + NPC.netUpdate = true; } } else { if (Math.Abs(vector.X - player.Center.X) < 40f && vector.Y < player.Center.Y - 300f) { - npc.ai[1] = 0f; - npc.ai[2] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 1f; return; } vector272.Normalize(); vector272 *= (death ? 13f : revenge ? 12f : expertMode ? 11f : 10f) + distanceSpeedBoost; - npc.velocity = (npc.velocity * 5f + vector272) / 6f; + NPC.velocity = (NPC.velocity * 5f + vector272) / 6f; } } - else if (npc.ai[0] == 3.1f) + else if (NPC.ai[0] == 3.1f) { - bool atTargetPosition = npc.position.Y + npc.height >= player.position.Y; - if (npc.ai[2] == 0f && (atTargetPosition || npc.localAI[1] == 0f) && Collision.CanHit(vector, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; + if (NPC.ai[2] == 0f && (atTargetPosition || NPC.localAI[1] == 0f) && Collision.CanHit(vector, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.ai[2] = 1f; + NPC.ai[2] = 1f; } - if (atTargetPosition || npc.velocity.Y <= 0f) + if (atTargetPosition || NPC.velocity.Y <= 0f) { - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) + NPC.ai[1] += 1f; + if (NPC.ai[1] > 10f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.ai[0] = 4f; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.ai[0] = 4f; - npc.netUpdate = true; + NPC.netUpdate = true; } } - else if (npc.ai[2] == 0f) + else if (NPC.ai[2] == 0f) { - npc.noTileCollide = true; + NPC.noTileCollide = true; } - npc.noGravity = true; - npc.velocity.Y += 0.5f; + NPC.noGravity = true; + NPC.velocity.Y += 0.5f; float velocityLimit = malice ? 22f : death ? 16f : revenge ? 15f : expertMode ? 14f : 13f; - if (npc.velocity.Y > velocityLimit) + if (NPC.velocity.Y > velocityLimit) { - npc.velocity.Y = velocityLimit; + NPC.velocity.Y = velocityLimit; } } else { - if (npc.ai[0] == 4f) + if (NPC.ai[0] == 4f) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.direction = 1; + NPC.direction = 1; } else { - npc.direction = -1; + NPC.direction = -1; } - npc.spriteDirection = npc.direction; - npc.noTileCollide = true; - npc.noGravity = true; + NPC.spriteDirection = NPC.direction; + NPC.noTileCollide = true; + NPC.noGravity = true; Vector2 value74 = player.Center - vector; value74.Y -= 40f; - if (value74.Length() < 280f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (value74.Length() < 280f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } if (value74.Length() > 50f) { value74.Normalize(); value74 *= (death ? 13f : revenge ? 12f : expertMode ? 11f : 10f) + distanceSpeedBoost; } - npc.velocity = (npc.velocity * 4f + value74) / 5f; + NPC.velocity = (NPC.velocity * 4f + value74) / 5f; return; } - if (npc.ai[0] == 5f) + if (NPC.ai[0] == 5f) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.TargetClosest(); - npc.velocity.X *= 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] > 5f) + NPC.TargetClosest(); + NPC.velocity.X *= 0.8f; + NPC.ai[1] += 1f; + if (NPC.ai[1] > 5f) { - npc.ai[1] = 0f; - npc.velocity.Y -= 4f; + NPC.ai[1] = 0f; + NPC.velocity.Y -= 4f; if (player.position.Y + player.height < vector.Y) { - npc.velocity.Y -= 1.25f; + NPC.velocity.Y -= 1.25f; } if (player.position.Y + player.height < vector.Y - 40f) { - npc.velocity.Y -= 1.5f; + NPC.velocity.Y -= 1.5f; } if (player.position.Y + player.height < vector.Y - 80f) { - npc.velocity.Y -= 1.75f; + NPC.velocity.Y -= 1.75f; } if (player.position.Y + player.height < vector.Y - 120f) { - npc.velocity.Y -= 2f; + NPC.velocity.Y -= 2f; } if (player.position.Y + player.height < vector.Y - 160f) { - npc.velocity.Y -= 2.25f; + NPC.velocity.Y -= 2.25f; } if (player.position.Y + player.height < vector.Y - 200f) { - npc.velocity.Y -= 2.5f; + NPC.velocity.Y -= 2.5f; } if (!Collision.CanHit(vector, 1, 1, player.Center, 1, 1)) { - npc.velocity.Y -= 2f; + NPC.velocity.Y -= 2f; } - npc.velocity.X = ((death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost) * npc.direction; - npc.ai[2] += 1f; + NPC.velocity.X = ((death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost) * NPC.direction; + NPC.ai[2] += 1f; } } else { - npc.velocity.X *= 0.98f; + NPC.velocity.X *= 0.98f; float velocityLimit = (death ? 7f : revenge ? 6f : expertMode ? 5f : 4f) + distanceSpeedBoost; - if (npc.direction < 0 && npc.velocity.X > -velocityLimit) + if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) { - npc.velocity.X = -velocityLimit; + NPC.velocity.X = -velocityLimit; } - if (npc.direction > 0 && npc.velocity.X < velocityLimit) + if (NPC.direction > 0 && NPC.velocity.X < velocityLimit) { - npc.velocity.X = velocityLimit; + NPC.velocity.X = velocityLimit; } } - if (npc.ai[2] >= 3f && npc.velocity.Y == 0f) + if (NPC.ai[2] >= 3f && NPC.velocity.Y == 0f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 6f) + else if (NPC.ai[0] == 6f) { - npc.life = npc.lifeMax; - npc.defense = 9999; - npc.noTileCollide = true; - npc.alpha += 7; - if (npc.timeLeft > 10) + NPC.life = NPC.lifeMax; + NPC.defense = 9999; + NPC.noTileCollide = true; + NPC.alpha += 7; + if (NPC.timeLeft > 10) { - npc.timeLeft = 10; + NPC.timeLeft = 10; } - if (npc.alpha > 255) + if (NPC.alpha > 255) { - npc.alpha = 255; + NPC.alpha = 255; } - npc.velocity.X *= 0.98f; + NPC.velocity.X *= 0.98f; } } - int num658 = Dust.NewDust(npc.position, npc.width, npc.height, 260, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.5f); + int num658 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 260, NPC.velocity.X, NPC.velocity.Y, 255, new Color(0, 80, 255, 80), NPC.scale * 1.5f); Main.dust[num658].noGravity = true; Main.dust[num658].velocity *= 0.5f; - if (bossLife == 0f && npc.life > 0) + if (bossLife == 0f && NPC.life > 0) { - bossLife = npc.lifeMax; + bossLife = NPC.lifeMax; } float num644 = 1f; - if (npc.life > 0) + if (NPC.life > 0) { float num659 = lifeRatio; num659 = num659 * 0.5f + 0.75f; num659 *= num644; - if (num659 != npc.scale) + if (num659 != NPC.scale) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)npc.height; - npc.scale = num659 * 0.75f; - npc.width = (int)(150f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)npc.height; + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)NPC.height; + NPC.scale = num659 * 0.75f; + NPC.width = (int)(150f * NPC.scale); + NPC.height = (int)(92f * NPC.scale); + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)NPC.height; } if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)((double)npc.lifeMax * 0.15); - if ((float)(npc.life + num660) < bossLife) + int num660 = (int)((double)NPC.lifeMax * 0.15); + if ((float)(NPC.life + num660) < bossLife) { - bossLife = (float)npc.life; - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + bossLife = (float)NPC.life; + int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); + int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); int num663 = ModContent.NPCType(); if (Main.rand.NextBool(3)) { @@ -522,8 +522,8 @@ namespace CalamityMod.NPCs.SlimeGod public override Color? GetAlpha(Color drawColor) { - Color lightColor = new Color(Main.DiscoR, 100, 150, npc.alpha); - Color newColor = npc.localAI[1] == 1f ? lightColor : drawColor; + Color lightColor = new Color(Main.DiscoR, 100, 150, NPC.alpha); + Color newColor = NPC.localAI[1] == 1f ? lightColor : drawColor; return newColor; } @@ -533,7 +533,7 @@ namespace CalamityMod.NPCs.SlimeGod { int heartAmt = Main.rand.Next(3) + 3; for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } bool otherSlimeGodsAlive = @@ -543,7 +543,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.AnyNPCs(ModContent.NPCType()) || NPC.CountNPCS(ModContent.NPCType()) > 1; // the other crimulan split is alive if (!otherSlimeGodsAlive) - SlimeGodCore.DropSlimeGodLoot(npc); + SlimeGodCore.DropSlimeGodLoot(NPC); } public override bool CheckActive() @@ -560,19 +560,19 @@ namespace CalamityMod.NPCs.SlimeGod { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 50; + NPC.height = 50; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -582,10 +582,10 @@ namespace CalamityMod.NPCs.SlimeGod } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -593,7 +593,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index b9321e2503..db7e0a0073 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -19,104 +19,104 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetStaticDefaults() { DisplayName.SetDefault("Ebonian Slime God"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.LifeMaxNERB(1500, 1800, 110000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.LifeMaxNERB(1500, 1800, 110000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.GetNPCDamage(); - npc.width = 150; - npc.height = 92; - npc.scale = 0.8f; - npc.defense = 8; - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.GetNPCDamage(); + NPC.width = 150; + NPC.height = 92; + NPC.scale = 0.8f; + NPC.defense = 8; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; animationType = NPCID.KingSlime; - npc.value = Item.buyPrice(0, 1, 0, 0); - npc.alpha = 55; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; + NPC.value = Item.buyPrice(0, 1, 0, 0); + NPC.alpha = 55; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.localAI[1]); + writer.Write(NPC.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.localAI[1] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); } public override void AI() { if (CalamityGlobalNPC.slimeGodPurple < 0 || !Main.npc[CalamityGlobalNPC.slimeGodPurple].active) - CalamityGlobalNPC.slimeGodPurple = npc.whoAmI; + CalamityGlobalNPC.slimeGodPurple = NPC.whoAmI; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || npc.localAI[1] == 1f || BossRushEvent.BossRushActive; - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; + bool death = CalamityWorld.death || NPC.localAI[1] == 1f || BossRushEvent.BossRushActive; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; - Vector2 vector = npc.Center; + Vector2 vector = NPC.Center; - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; - npc.defense = npc.defDefense; - npc.damage = npc.defDamage; - if (npc.localAI[1] == 1f) + NPC.defense = NPC.defDefense; + NPC.damage = NPC.defDamage; + if (NPC.localAI[1] == 1f) { - npc.defense = npc.defDefense + 16; - npc.damage = npc.defDamage + 20; + NPC.defense = NPC.defDefense + 16; + NPC.damage = NPC.defDamage + 20; } - npc.aiAction = 0; - npc.noTileCollide = false; - npc.noGravity = false; + NPC.aiAction = 0; + NPC.noTileCollide = false; + NPC.noGravity = false; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; - if (npc.ai[0] != 6f && (player.dead || !player.active)) + if (NPC.ai[0] != 6f && (player.dead || !player.active)) { - npc.TargetClosest(); - player = Main.player[npc.target]; + NPC.TargetClosest(); + player = Main.player[NPC.target]; if (player.dead || !player.active) { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * (malice ? 0.008f : 0.005f); bool flag100 = false; - bool hyperMode = npc.localAI[1] == 1f; + bool hyperMode = NPC.localAI[1] == 1f; if (CalamityGlobalNPC.slimeGodRed != -1) { if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) @@ -126,7 +126,7 @@ namespace CalamityMod.NPCs.SlimeGod } if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; hyperMode = true; flag100 = false; } @@ -138,17 +138,17 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += flag100 ? 0.5f : 1f; + NPC.localAI[0] += flag100 ? 0.5f : 1f; if (revenge) - npc.localAI[0] += 0.5f; + NPC.localAI[0] += 0.5f; if (malice) - npc.localAI[0] += 1f; + NPC.localAI[0] += 1f; - if (npc.localAI[0] >= 600f && Vector2.Distance(player.Center, npc.Center) > 160f) + if (NPC.localAI[0] >= 600f && Vector2.Distance(player.Center, NPC.Center) > 160f) { - npc.localAI[0] = 0f; + NPC.localAI[0] = 0f; float num179 = 6f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + Vector2 value9 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); float num180 = player.position.X + (float)player.width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; @@ -157,7 +157,7 @@ namespace CalamityMod.NPCs.SlimeGod num180 *= num183; num182 *= num183; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; int totalProjectiles = expertMode ? 3 : 2; @@ -177,27 +177,27 @@ namespace CalamityMod.NPCs.SlimeGod } } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { if ((player.Center - vector).Length() > (hyperMode ? 1200f : 3600f)) { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.TargetClosest(); - npc.velocity.X *= 0.8f; - npc.ai[1] += flag100 ? 1f : 2f; + NPC.TargetClosest(); + NPC.velocity.X *= 0.8f; + NPC.ai[1] += flag100 ? 1f : 2f; float num1879 = 40f; float num1880 = death ? 5.5f : revenge ? 5f : expertMode ? 4.5f : 4f; if (revenge) @@ -212,295 +212,295 @@ namespace CalamityMod.NPCs.SlimeGod { num1881 += 2f; } - if (npc.ai[1] > num1879) + if (NPC.ai[1] > num1879) { num1881 *= 1.25f; num1880 *= 0.75f; - npc.ai[1] = 0f; - npc.velocity.Y -= num1881; - npc.velocity.X = (num1880 + distanceSpeedBoost) * npc.direction; + NPC.ai[1] = 0f; + NPC.velocity.Y -= num1881; + NPC.velocity.X = (num1880 + distanceSpeedBoost) * NPC.direction; } } else { - npc.velocity.X *= 0.99f; - if (npc.direction < 0 && npc.velocity.X > -1f) + NPC.velocity.X *= 0.99f; + if (NPC.direction < 0 && NPC.velocity.X > -1f) { - npc.velocity.X = -1f; + NPC.velocity.X = -1f; } - if (npc.direction > 0 && npc.velocity.X < 1f) + if (NPC.direction > 0 && NPC.velocity.X < 1f) { - npc.velocity.X = 1f; + NPC.velocity.X = 1f; } } - npc.ai[2] += 1f; + NPC.ai[2] += 1f; if (revenge) { - npc.ai[2] += death ? 1f - lifeRatio : 0.5f * (1f - lifeRatio); + NPC.ai[2] += death ? 1f - lifeRatio : 0.5f * (1f - lifeRatio); } - if (npc.ai[2] >= 210f && npc.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.ai[2] >= 210f && NPC.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) { int random = Main.rand.Next(2) + (lifeRatio < 0.5f ? 1 : 0); switch (random) { case 0: - npc.ai[0] = 2f; + NPC.ai[0] = 2f; break; case 1: - npc.ai[0] = 3f; - npc.noTileCollide = true; - npc.velocity.Y = death ? -10f : revenge ? -9f : expertMode ? -8f : -7f; + NPC.ai[0] = 3f; + NPC.noTileCollide = true; + NPC.velocity.Y = death ? -10f : revenge ? -9f : expertMode ? -8f : -7f; break; case 2: - npc.ai[0] = 5f; + NPC.ai[0] = 5f; break; default: break; } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - npc.localAI[0] += 5f; - npc.velocity.X *= 0.85f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 40f) + NPC.localAI[0] += 5f; + NPC.velocity.X *= 0.85f; + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 40f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - npc.noTileCollide = true; - npc.noGravity = true; - if (npc.velocity.X < 0f) + NPC.noTileCollide = true; + NPC.noGravity = true; + if (NPC.velocity.X < 0f) { - npc.direction = -1; + NPC.direction = -1; } else { - npc.direction = 1; + NPC.direction = 1; } - npc.spriteDirection = npc.direction; - npc.TargetClosest(); + NPC.spriteDirection = NPC.direction; + NPC.TargetClosest(); Vector2 center40 = player.Center; center40.Y -= 350f; Vector2 vector272 = center40 - vector; - if (npc.ai[2] == 1f) + if (NPC.ai[2] == 1f) { - npc.ai[1] += 1f; + NPC.ai[1] += 1f; vector272 = player.Center - vector; vector272.Normalize(); vector272 *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; - npc.velocity = (npc.velocity * 4f + vector272) / 5f; - if (npc.ai[1] > 12f) + NPC.velocity = (NPC.velocity * 4f + vector272) / 5f; + if (NPC.ai[1] > 12f) { - npc.ai[1] = 0f; - npc.ai[0] = 3.1f; - npc.ai[2] = 0f; - npc.velocity = vector272; - npc.netUpdate = true; + NPC.ai[1] = 0f; + NPC.ai[0] = 3.1f; + NPC.ai[2] = 0f; + NPC.velocity = vector272; + NPC.netUpdate = true; } } else { if (Math.Abs(vector.X - player.Center.X) < 40f && vector.Y < player.Center.Y - 300f) { - npc.ai[1] = 0f; - npc.ai[2] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 1f; return; } vector272.Normalize(); vector272 *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; - npc.velocity = (npc.velocity * 5f + vector272) / 6f; + NPC.velocity = (NPC.velocity * 5f + vector272) / 6f; } } - else if (npc.ai[0] == 3.1f) + else if (NPC.ai[0] == 3.1f) { - bool atTargetPosition = npc.position.Y + npc.height >= player.position.Y; - if (npc.ai[2] == 0f && (atTargetPosition || npc.localAI[1] == 0f) && Collision.CanHit(vector, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; + if (NPC.ai[2] == 0f && (atTargetPosition || NPC.localAI[1] == 0f) && Collision.CanHit(vector, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.ai[2] = 1f; + NPC.ai[2] = 1f; } - if (atTargetPosition || npc.velocity.Y <= 0f) + if (atTargetPosition || NPC.velocity.Y <= 0f) { - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) + NPC.ai[1] += 1f; + if (NPC.ai[1] > 10f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.ai[0] = 4f; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.ai[0] = 4f; - npc.netUpdate = true; + NPC.netUpdate = true; } } - else if (npc.ai[2] == 0f) + else if (NPC.ai[2] == 0f) { - npc.noTileCollide = true; + NPC.noTileCollide = true; } - npc.noGravity = true; - npc.velocity.Y += 0.5f; + NPC.noGravity = true; + NPC.velocity.Y += 0.5f; float velocityLimit = malice ? 20f : death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; - if (npc.velocity.Y > velocityLimit) + if (NPC.velocity.Y > velocityLimit) { - npc.velocity.Y = velocityLimit; + NPC.velocity.Y = velocityLimit; } } else { - if (npc.ai[0] == 4f) + if (NPC.ai[0] == 4f) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.direction = 1; + NPC.direction = 1; } else { - npc.direction = -1; + NPC.direction = -1; } - npc.spriteDirection = npc.direction; - npc.noTileCollide = true; - npc.noGravity = true; + NPC.spriteDirection = NPC.direction; + NPC.noTileCollide = true; + NPC.noGravity = true; Vector2 value74 = player.Center - vector; value74.Y -= 40f; - if (value74.Length() < 280f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (value74.Length() < 280f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } if (value74.Length() > 50f) { value74.Normalize(); value74 *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; } - npc.velocity = (npc.velocity * 4f + value74) / 5f; + NPC.velocity = (NPC.velocity * 4f + value74) / 5f; return; } - if (npc.ai[0] == 5f) + if (NPC.ai[0] == 5f) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.TargetClosest(); - npc.velocity.X *= 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] > 5f) + NPC.TargetClosest(); + NPC.velocity.X *= 0.8f; + NPC.ai[1] += 1f; + if (NPC.ai[1] > 5f) { - npc.ai[1] = 0f; - npc.velocity.Y -= 3f; + NPC.ai[1] = 0f; + NPC.velocity.Y -= 3f; if (player.position.Y + player.height < vector.Y) { - npc.velocity.Y -= 1.2f; + NPC.velocity.Y -= 1.2f; } if (player.position.Y + player.height < vector.Y - 40f) { - npc.velocity.Y -= 1.4f; + NPC.velocity.Y -= 1.4f; } if (player.position.Y + player.height < vector.Y - 80f) { - npc.velocity.Y -= 1.7f; + NPC.velocity.Y -= 1.7f; } if (player.position.Y + player.height < vector.Y - 120f) { - npc.velocity.Y -= 2f; + NPC.velocity.Y -= 2f; } if (player.position.Y + player.height < vector.Y - 160f) { - npc.velocity.Y -= 2.2f; + NPC.velocity.Y -= 2.2f; } if (player.position.Y + player.height < vector.Y - 200f) { - npc.velocity.Y -= 2.4f; + NPC.velocity.Y -= 2.4f; } if (!Collision.CanHit(vector, 1, 1, player.Center, 1, 1)) { - npc.velocity.Y -= 2f; + NPC.velocity.Y -= 2f; } - npc.velocity.X = ((death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost) * npc.direction; - npc.ai[2] += 1f; + NPC.velocity.X = ((death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost) * NPC.direction; + NPC.ai[2] += 1f; } } else { - npc.velocity.X *= 0.98f; + NPC.velocity.X *= 0.98f; float velocityLimit = (death ? 6.5f : revenge ? 6f : expertMode ? 5.5f : 5f) + distanceSpeedBoost; - if (npc.direction < 0 && npc.velocity.X > -velocityLimit) + if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) { - npc.velocity.X = -velocityLimit; + NPC.velocity.X = -velocityLimit; } - if (npc.direction > 0 && npc.velocity.X < velocityLimit) + if (NPC.direction > 0 && NPC.velocity.X < velocityLimit) { - npc.velocity.X = velocityLimit; + NPC.velocity.X = velocityLimit; } } - if (npc.ai[2] >= 2f && npc.velocity.Y == 0f) + if (NPC.ai[2] >= 2f && NPC.velocity.Y == 0f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 6f) + else if (NPC.ai[0] == 6f) { - npc.life = npc.lifeMax; - npc.defense = 9999; - npc.noTileCollide = true; - npc.alpha += 7; - if (npc.timeLeft > 10) + NPC.life = NPC.lifeMax; + NPC.defense = 9999; + NPC.noTileCollide = true; + NPC.alpha += 7; + if (NPC.timeLeft > 10) { - npc.timeLeft = 10; + NPC.timeLeft = 10; } - if (npc.alpha > 255) + if (NPC.alpha > 255) { - npc.alpha = 255; + NPC.alpha = 255; } - npc.velocity.X *= 0.98f; + NPC.velocity.X *= 0.98f; } } - int num244 = Dust.NewDust(npc.position, npc.width, npc.height, 173, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); + int num244 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 173, NPC.velocity.X, NPC.velocity.Y, 255, new Color(0, 80, 255, 80), NPC.scale * 1.2f); Main.dust[num244].noGravity = true; Main.dust[num244].velocity *= 0.5f; - if (bossLife == 0f && npc.life > 0) + if (bossLife == 0f && NPC.life > 0) { - bossLife = npc.lifeMax; + bossLife = NPC.lifeMax; } float num644 = 1f; - if (npc.life > 0) + if (NPC.life > 0) { float num659 = lifeRatio; num659 = num659 * 0.5f + 0.75f; num659 *= num644; - if (num659 != npc.scale) + if (num659 != NPC.scale) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)npc.height; - npc.scale = num659 * 0.75f; - npc.width = (int)(150f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)npc.height; + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)NPC.height; + NPC.scale = num659 * 0.75f; + NPC.width = (int)(150f * NPC.scale); + NPC.height = (int)(92f * NPC.scale); + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)NPC.height; } if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)((double)npc.lifeMax * 0.2); - if ((float)(npc.life + num660) < bossLife) + int num660 = (int)((double)NPC.lifeMax * 0.2); + if ((float)(NPC.life + num660) < bossLife) { - bossLife = (float)npc.life; - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + bossLife = (float)NPC.life; + int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); + int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); int num663 = ModContent.NPCType(); int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num664].SetDefaults(num663, -1f); @@ -519,8 +519,8 @@ namespace CalamityMod.NPCs.SlimeGod public override Color? GetAlpha(Color drawColor) { - Color lightColor = new Color(200, 150, Main.DiscoB, npc.alpha); - Color newColor = npc.localAI[1] == 1f ? lightColor : drawColor; + Color lightColor = new Color(200, 150, Main.DiscoB, NPC.alpha); + Color newColor = NPC.localAI[1] == 1f ? lightColor : drawColor; return newColor; } @@ -530,7 +530,7 @@ namespace CalamityMod.NPCs.SlimeGod { int heartAmt = Main.rand.Next(3) + 3; for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } bool otherSlimeGodsAlive = @@ -540,7 +540,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()); if (!otherSlimeGodsAlive) - SlimeGodCore.DropSlimeGodLoot(npc); + SlimeGodCore.DropSlimeGodLoot(NPC); } public override bool CheckActive() @@ -557,19 +557,19 @@ namespace CalamityMod.NPCs.SlimeGod { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 50; + NPC.height = 50; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -579,10 +579,10 @@ namespace CalamityMod.NPCs.SlimeGod } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -590,7 +590,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs index a502cc8986..9ed456e874 100644 --- a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs @@ -11,46 +11,46 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetStaticDefaults() { DisplayName.SetDefault("Corrupt Slime Spawn"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.aiStyle = 14; - npc.GetNPCDamage(); - npc.width = 40; - npc.height = 30; - npc.defense = 6; - npc.lifeMax = 180; + NPC.aiStyle = 14; + NPC.GetNPCDamage(); + NPC.width = 40; + NPC.height = 30; + NPC.defense = 6; + NPC.lifeMax = 180; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 10000; + NPC.lifeMax = 10000; } - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; animationType = 121; - npc.alpha = 55; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.alpha = 55; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override bool PreNPCLoot() => false; public override void HitEffect(int hitDirection, double damage) { - if (Main.netMode != NetmodeID.MultiplayerClient && npc.life <= 0) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.life <= 0) { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + Vector2 spawnAt = NPC.Center + new Vector2(0f, (float)NPC.height / 2f); NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType()); } for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs index ce362d9517..95370915d1 100644 --- a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs @@ -11,45 +11,45 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetStaticDefaults() { DisplayName.SetDefault("Corrupt Slime Spawn"); - Main.npcFrameCount[npc.type] = 2; + Main.npcFrameCount[NPC.type] = 2; } public override void SetDefaults() { - npc.aiStyle = 1; - npc.GetNPCDamage(); - npc.width = 40; - npc.height = 30; - npc.defense = 4; - npc.lifeMax = 90; + NPC.aiStyle = 1; + NPC.GetNPCDamage(); + NPC.width = 40; + NPC.height = 30; + NPC.defense = 4; + NPC.lifeMax = 90; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 5000; + NPC.lifeMax = 5000; } - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; animationType = NPCID.CorruptSlime; - npc.alpha = 55; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.alpha = 55; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } } } @@ -58,12 +58,12 @@ namespace CalamityMod.NPCs.SlimeGod { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(8) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } - DropHelper.DropItemChance(npc, ItemID.Vitamins, Main.expertMode ? 50 : 100); + DropHelper.DropItemChance(NPC, ItemID.Vitamins, Main.expertMode ? 50 : 100); return false; } diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson.cs b/NPCs/SlimeGod/SlimeSpawnCrimson.cs index 11b46b6dd2..64f3be968d 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson.cs @@ -11,45 +11,45 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetStaticDefaults() { DisplayName.SetDefault("Crimson Slime Spawn"); - Main.npcFrameCount[npc.type] = 2; + Main.npcFrameCount[NPC.type] = 2; } public override void SetDefaults() { - npc.aiStyle = 1; - npc.GetNPCDamage(); - npc.width = 40; - npc.height = 30; - npc.defense = 4; - npc.lifeMax = 110; + NPC.aiStyle = 1; + NPC.GetNPCDamage(); + NPC.width = 40; + NPC.height = 30; + NPC.defense = 4; + NPC.lifeMax = 110; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 10000; + NPC.lifeMax = 10000; } - npc.knockBackResist = 0f; + NPC.knockBackResist = 0f; animationType = NPCID.CorruptSlime; - npc.alpha = 55; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.alpha = 55; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } } } @@ -58,12 +58,12 @@ namespace CalamityMod.NPCs.SlimeGod { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(8) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } - DropHelper.DropItemChance(npc, ItemID.Blindfold, Main.expertMode ? 50 : 100); + DropHelper.DropItemChance(NPC, ItemID.Blindfold, Main.expertMode ? 50 : 100); return false; } diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs index 6de4023aa6..50733f9633 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs @@ -16,31 +16,31 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetStaticDefaults() { DisplayName.SetDefault("Crimson Slime Spawn"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.aiStyle = 1; - npc.GetNPCDamage(); - npc.width = 40; - npc.height = 30; - npc.defense = 6; - npc.lifeMax = 130; + NPC.aiStyle = 1; + NPC.GetNPCDamage(); + NPC.width = 40; + NPC.height = 30; + NPC.defense = 6; + NPC.lifeMax = 130; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 12000; + NPC.lifeMax = 12000; } - npc.knockBackResist = 0f; - npc.alpha = 55; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToSickness = false; + NPC.knockBackResist = 0f; + NPC.alpha = 55; + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; } public override void FindFrame(int frameHeight) @@ -48,28 +48,28 @@ namespace CalamityMod.NPCs.SlimeGod int frameY = 1; if (!Main.dedServ) { - if (!Main.NPCLoaded[npc.type] || Main.npcTexture[npc.type] is null) + if (!Main.NPCLoaded[NPC.type] || Main.npcTexture[NPC.type] is null) return; - frameY = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + frameY = Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type]; } int aiState = 0; - if (npc.aiAction == 0) - aiState = npc.velocity.Y >= 0f ? (npc.velocity.Y <= 0f ? (npc.velocity.X == 0f ? 0 : 1) : 3) : 2; - else if (npc.aiAction == 1) + if (NPC.aiAction == 0) + aiState = NPC.velocity.Y >= 0f ? (NPC.velocity.Y <= 0f ? (NPC.velocity.X == 0f ? 0 : 1) : 3) : 2; + else if (NPC.aiAction == 1) aiState = 4; - npc.frameCounter++; + NPC.frameCounter++; if (aiState > 0) - npc.frameCounter++; + NPC.frameCounter++; if (aiState == 4) - npc.frameCounter++; - if (npc.frameCounter >= 8f) + NPC.frameCounter++; + if (NPC.frameCounter >= 8f) { - npc.frame.Y += frameY; - npc.frameCounter = 0f; + NPC.frame.Y += frameY; + NPC.frameCounter = 0f; } - if (npc.frame.Y >= frameY * Main.npcFrameCount[npc.type]) - npc.frame.Y = 0; + if (NPC.frame.Y >= frameY * Main.npcFrameCount[NPC.type]) + NPC.frame.Y = 0; } public override void AI() @@ -78,19 +78,19 @@ namespace CalamityMod.NPCs.SlimeGod spikeTimer -= 1f; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - if (!npc.wet) + int damage = NPC.GetProjectileDamage(type); + if (!NPC.wet) { - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; - float num15 = Main.player[npc.target].position.Y - vector3.Y; + Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num14 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector3.X; + float num15 = Main.player[NPC.target].position.Y - vector3.Y; float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - if (Main.expertMode && num16 < 120f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + if (Main.expertMode && num16 < 120f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && NPC.velocity.Y == 0f) { - npc.ai[0] = -40f; - if (npc.velocity.Y == 0f) + NPC.ai[0] = -40f; + if (NPC.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.9f; + NPC.velocity.X = NPC.velocity.X * 0.9f; } if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) { @@ -106,16 +106,16 @@ namespace CalamityMod.NPCs.SlimeGod } } } - else if (num16 < 360f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + else if (num16 < 360f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && NPC.velocity.Y == 0f) { - npc.ai[0] = -40f; - if (npc.velocity.Y == 0f) + NPC.ai[0] = -40f; + if (NPC.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.9f; + NPC.velocity.X = NPC.velocity.X * 0.9f; } if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) { - num15 = Main.player[npc.target].position.Y - vector3.Y - (float)Main.rand.Next(0, 200); + num15 = Main.player[NPC.target].position.Y - vector3.Y - (float)Main.rand.Next(0, 200); num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); num16 = 6.5f / num16; num14 *= num16; @@ -131,13 +131,13 @@ namespace CalamityMod.NPCs.SlimeGod { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); } } } @@ -146,12 +146,12 @@ namespace CalamityMod.NPCs.SlimeGod { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(8) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } - DropHelper.DropItemChance(npc, ItemID.Blindfold, Main.expertMode ? 50 : 100); + DropHelper.DropItemChance(NPC, ItemID.Blindfold, Main.expertMode ? 50 : 100); return false; } diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 97ec59380e..47d4e2e5ed 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -15,20 +15,20 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetStaticDefaults() { DisplayName.SetDefault("Storm Weaver"); - NPCID.Sets.TrailingMode[npc.type] = 1; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 40; - npc.height = 40; + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 40; + NPC.height = 40; // 10% of HP is phase one bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; - npc.lifeMax = notDoGFight ? 825500 : 139750; - npc.LifeMaxNERB(npc.lifeMax, npc.lifeMax, 475000); + NPC.lifeMax = notDoGFight ? 825500 : 139750; + NPC.LifeMaxNERB(NPC.lifeMax, NPC.lifeMax, 475000); // If fought alone, Storm Weaver plays its own theme if (notDoGFight) @@ -38,48 +38,48 @@ namespace CalamityMod.NPCs.StormWeaver music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; // Phase one settings - CalamityGlobalNPC global = npc.Calamity(); - npc.defense = 150; + CalamityGlobalNPC global = NPC.Calamity(); + NPC.defense = 150; global.DR = 0.999999f; global.unbreakableDR = true; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; + NPC.chaseable = false; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.boss = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.boss = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.netAlways = true; + NPC.dontCountMe = true; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToElectricity = false; + NPC.Calamity().VulnerableToElectricity = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -89,41 +89,41 @@ namespace CalamityMod.NPCs.StormWeaver public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; // Shed armor - bool shedArmor = npc.life / (float)npc.lifeMax < 0.9f; + bool shedArmor = NPC.life / (float)NPC.lifeMax < 0.9f; // Update armored settings to naked settings if (shedArmor) { // Spawn armor gore and set other crucial variables - if (!npc.chaseable) + if (!NPC.chaseable) { - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmorBody1"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmorBody2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmorBody3"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SWArmorBody1"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SWArmorBody2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SWArmorBody3"), NPC.scale); - CalamityGlobalNPC global = npc.Calamity(); - npc.defense = 30; + CalamityGlobalNPC global = NPC.Calamity(); + NPC.defense = 30; global.DR = 0.2f; global.unbreakableDR = false; - npc.chaseable = true; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath13; - npc.frame = new Rectangle(0, 0, 54, 52); + NPC.chaseable = true; + NPC.HitSound = SoundID.NPCHit13; + NPC.DeathSound = SoundID.NPCDeath13; + NPC.frame = new Rectangle(0, 0, 54, 52); } } - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -137,39 +137,39 @@ namespace CalamityMod.NPCs.StormWeaver } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - if (npc.alpha != 0) + if (NPC.alpha != 0) { for (int num934 = 0; num934 < 2; num934++) { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + int num935 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); Main.dust[num935].noGravity = true; Main.dust[num935].noLight = true; } } - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; @@ -178,42 +178,42 @@ namespace CalamityMod.NPCs.StormWeaver num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2(num192, num191) + MathHelper.PiOver2; + NPC.rotation = (float)System.Math.Atan2(num192, num191) + MathHelper.PiOver2; num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - bool shedArmor = npc.life / (float)npc.lifeMax < 0.9f; - Texture2D texture2D15 = shedArmor ? ModContent.GetTexture("CalamityMod/NPCs/StormWeaver/StormWeaverBodyNaked") : Main.npcTexture[npc.type]; + bool shedArmor = NPC.life / (float)NPC.lifeMax < 0.9f; + Texture2D texture2D15 = shedArmor ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverBodyNaked") : Main.npcTexture[NPC.type]; Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Color color36 = Color.White; float amount9 = 0.5f; @@ -227,36 +227,36 @@ namespace CalamityMod.NPCs.StormWeaver if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f) - color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); - else if (Main.npc[(int)npc.ai[2]].localAI[3] > 0f) - color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp(Main.npc[(int)npc.ai[2]].localAI[3] / 60f, 0f, 1f)); + if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] > 280f) + color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); + else if (Main.npc[(int)NPC.ai[2]].localAI[3] > 0f) + color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 60f, 0f, 1f)); } color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - Color color = npc.GetAlpha(lightColor); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Color color = NPC.GetAlpha(lightColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f) - color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); - else if (Main.npc[(int)npc.ai[2]].localAI[3] > 0f) - color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp(Main.npc[(int)npc.ai[2]].localAI[3] / 60f, 0f, 1f)); + if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] > 280f) + color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); + else if (Main.npc[(int)NPC.ai[2]].localAI[3] > 0f) + color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 60f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -269,7 +269,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void OnHitPlayer(Player player, int damage, bool crit) { - int buffDuration = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] >= 400f ? 180 : 90; + int buffDuration = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] >= 400f ? 180 : 90; player.AddBuff(BuffID.Electrified, buffDuration, true); } @@ -285,7 +285,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x) && npc.life / (float)npc.lifeMax >= 0.9f) + if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x) && NPC.life / (float)NPC.lifeMax >= 0.9f) { if (projectile.penetrate == -1 && !projectile.minion) projectile.penetrate = 1; @@ -297,24 +297,24 @@ namespace CalamityMod.NPCs.StormWeaver public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeBody1"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeBody2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeBody3"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SWNudeBody1"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SWNudeBody2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SWNudeBody3"), NPC.scale); - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 30; - npc.height = 30; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 30; + NPC.height = 30; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -325,10 +325,10 @@ namespace CalamityMod.NPCs.StormWeaver for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -336,8 +336,8 @@ namespace CalamityMod.NPCs.StormWeaver public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 645e9e8c92..63017884a2 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -17,6 +17,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.StormWeaver { @@ -48,26 +49,26 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetStaticDefaults() { DisplayName.SetDefault("Storm Weaver"); - NPCID.Sets.TrailingMode[npc.type] = 1; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 74; - npc.height = 74; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 74; + NPC.height = 74; // 10% of HP is phase one bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; - npc.lifeMax = notDoGFight ? 825500 : 139750; - npc.LifeMaxNERB(npc.lifeMax, npc.lifeMax, 475000); + NPC.lifeMax = notDoGFight ? 825500 : 139750; + NPC.LifeMaxNERB(NPC.lifeMax, NPC.lifeMax, 475000); // If fought alone, Storm Weaver plays its own theme if (notDoGFight) { - npc.value = Item.buyPrice(2, 0, 0, 0); + NPC.value = Item.buyPrice(2, 0, 0, 0); music = CalamityMod.Instance.GetMusicFromMusicMod("Weaver") ?? MusicID.Boss3; } // If fought as a DoG interlude, keep the DoG music playing @@ -75,42 +76,42 @@ namespace CalamityMod.NPCs.StormWeaver music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; // Phase one settings - CalamityGlobalNPC global = npc.Calamity(); - npc.defense = 150; + CalamityGlobalNPC global = NPC.Calamity(); + NPC.defense = 150; global.DR = 0.999999f; global.unbreakableDR = true; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; + NPC.chaseable = false; + NPC.HitSound = SoundID.NPCHit4; + NPC.DeathSound = SoundID.NPCDeath14; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.boss = true; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; + NPC.knockBackResist = 0f; + NPC.boss = true; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.netAlways = true; bossBag = ModContent.ItemType(); if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToElectricity = false; + NPC.Calamity().VulnerableToElectricity = false; } public override void BossHeadSlot(ref int index) { - if (npc.life / (float)npc.lifeMax < 0.9f) + if (NPC.life / (float)NPC.lifeMax < 0.9f) index = vulnerableIconIndex; else index = normalIconIndex; @@ -118,38 +119,38 @@ namespace CalamityMod.NPCs.StormWeaver public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.chaseable); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); for (int i = 0; i < 4; i++) - writer.Write(npc.Calamity().newAI[i]); + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.chaseable = reader.ReadBoolean(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) - npc.Calamity().newAI[i] = reader.ReadSingle(); + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && malice; if (!Main.raining) CalamityUtils.StartRain(); - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Shed armor bool shedArmor = lifeRatio < 0.9f; @@ -167,74 +168,74 @@ namespace CalamityMod.NPCs.StormWeaver if (shedArmor) { // Spawn armor gore, roar and set other crucial variables - if (!npc.chaseable) + if (!NPC.chaseable) { - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmorHead1"), npc.scale); - Main.PlaySound(SoundID.NPCDeath14, (int)npc.Center.X, (int)npc.Center.Y); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SWArmorHead1"), NPC.scale); + SoundEngine.PlaySound(SoundID.NPCDeath14, (int)NPC.Center.X, (int)NPC.Center.Y); - CalamityGlobalNPC global = npc.Calamity(); - npc.defense = 15; + CalamityGlobalNPC global = NPC.Calamity(); + NPC.defense = 15; global.DR = 0.1f; global.unbreakableDR = false; - npc.chaseable = true; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath13; - npc.frame = new Rectangle(0, 0, 62, 86); + NPC.chaseable = true; + NPC.HitSound = SoundID.NPCHit13; + NPC.DeathSound = SoundID.NPCDeath13; + NPC.frame = new Rectangle(0, 0, 62, 86); } } int boltProjectiles = (phase3 || death) ? 4 : phase2 ? 3 : 2; - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - if (npc.alpha != 0) + if (NPC.alpha != 0) { for (int num934 = 0; num934 < 2; num934++) { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + int num935 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); Main.dust[num935].noGravity = true; Main.dust[num935].noLight = true; } } - npc.alpha -= 12; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 12; + if (NPC.alpha < 0) + NPC.alpha = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!tail && npc.ai[0] == 0f) + if (!tail && NPC.ai[0] == 0f) { - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; int totalLength = death ? 60 : revenge ? 50 : expertMode ? 40 : 30; for (int num36 = 0; num36 < totalLength; num36++) { int lol; if (num36 >= 0 && num36 < totalLength - 1) - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); else - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = NPC.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; - npc.netUpdate = true; + NPC.netUpdate = true; Previous = lol; } @@ -243,44 +244,44 @@ namespace CalamityMod.NPCs.StormWeaver if (expertMode && !phase4) { - npc.localAI[0] += malice ? 1.5f : 1f; + NPC.localAI[0] += malice ? 1.5f : 1f; float spawnOrbGateValue = shedArmor ? 450f : 360f; - if (npc.localAI[0] >= spawnOrbGateValue) + if (NPC.localAI[0] >= spawnOrbGateValue) { - npc.localAI[0] = 0f; - npc.netUpdate = true; + NPC.localAI[0] = 0f; + NPC.netUpdate = true; float orbDistance = shedArmor ? 250f : 350f; - float xPos = Main.rand.NextBool(2) ? Main.player[npc.target].position.X + orbDistance : Main.player[npc.target].position.X - orbDistance; - float yPos = Main.rand.NextBool(2) ? Main.player[npc.target].position.Y + orbDistance : Main.player[npc.target].position.Y - orbDistance; + float xPos = Main.rand.NextBool(2) ? Main.player[NPC.target].position.X + orbDistance : Main.player[NPC.target].position.X - orbDistance; + float yPos = Main.rand.NextBool(2) ? Main.player[NPC.target].position.Y + orbDistance : Main.player[NPC.target].position.Y - orbDistance; Vector2 spawnPos = new Vector2(xPos, yPos); int type = ProjectileID.CultistBossLightningOrb; - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(spawnPos, Vector2.Zero, type, damage, 0f, Main.myPlayer); } } } - if (npc.life > Main.npc[(int)npc.ai[0]].life) - npc.life = Main.npc[(int)npc.ai[0]].life; + if (NPC.life > Main.npc[(int)NPC.ai[0]].life) + NPC.life = Main.npc[(int)NPC.ai[0]].life; - if (Main.player[npc.target].dead && npc.life > 0) + if (Main.player[NPC.target].dead && NPC.life > 0) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; calamityGlobalNPC.newAI[0] = 0f; - npc.TargetClosest(false); + NPC.TargetClosest(false); - npc.velocity.Y -= 3f; - if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 3f; + NPC.velocity.Y -= 3f; + if ((double)NPC.position.Y < Main.topWorld + 16f) + NPC.velocity.Y -= 3f; - if ((double)npc.position.Y < Main.topWorld + 16f) + if ((double)NPC.position.Y < Main.topWorld + 16f) { CalamityWorld.DoGSecondStageCountdown = 0; if (Main.netMode == NetmodeID.Server) { - var netMessage = mod.GetPacket(); + var netMessage = Mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); @@ -298,12 +299,12 @@ namespace CalamityMod.NPCs.StormWeaver } } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f && npc.life > 0) + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 10000f && NPC.life > 0) { CalamityWorld.DoGSecondStageCountdown = 0; if (Main.netMode == NetmodeID.Server) { - var netMessage = mod.GetPacket(); + var netMessage = Mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); @@ -320,14 +321,14 @@ namespace CalamityMod.NPCs.StormWeaver } } - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; - else if (npc.velocity.X > 0f) - npc.spriteDirection = 1; + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); float num188 = (shedArmor ? 12f : 10f) + (malice ? 3f : revenge ? 1.5f : expertMode ? 1f : 0f); float num189 = (shedArmor ? 0.24f : 0.2f) + (malice ? 0.12f : revenge ? 0.08f : expertMode ? 0.04f : 0f); @@ -337,41 +338,41 @@ namespace CalamityMod.NPCs.StormWeaver calamityGlobalNPC.newAI[0] += 1f; if (calamityGlobalNPC.newAI[0] >= 400f) { - npc.localAI[3] = 60f; + NPC.localAI[3] = 60f; - if (npc.localAI[1] == 0f) - npc.localAI[1] = 1f; + if (NPC.localAI[1] == 0f) + NPC.localAI[1] = 1f; if (calamityGlobalNPC.newAI[0] >= 500f) { - npc.TargetClosest(); - npc.localAI[1] = 0f; + NPC.TargetClosest(); + NPC.localAI[1] = 0f; calamityGlobalNPC.newAI[0] = 0f; } if (revenge) { - if (npc.localAI[1] == 2f) + if (NPC.localAI[1] == 2f) { - num188 += Vector2.Distance(Main.player[npc.target].Center, npc.Center) * 0.01f * (0.7f - lifeRatio); - num189 += Vector2.Distance(Main.player[npc.target].Center, npc.Center) * 0.0001f * (0.7f - lifeRatio); + num188 += Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) * 0.01f * (0.7f - lifeRatio); + num189 += Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) * 0.0001f * (0.7f - lifeRatio); num188 *= 2f; num189 *= 0.85f; - float stopChargeDistance = 800f * npc.localAI[2]; + float stopChargeDistance = 800f * NPC.localAI[2]; if (stopChargeDistance < 0) { - if (npc.Center.X < Main.player[npc.target].Center.X + stopChargeDistance) + if (NPC.Center.X < Main.player[NPC.target].Center.X + stopChargeDistance) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; calamityGlobalNPC.newAI[0] = 0f; } } else { - if (npc.Center.X > Main.player[npc.target].Center.X + stopChargeDistance) + if (NPC.Center.X > Main.player[NPC.target].Center.X + stopChargeDistance) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; calamityGlobalNPC.newAI[0] = 0f; } } @@ -380,14 +381,14 @@ namespace CalamityMod.NPCs.StormWeaver int dustAmt = 5; for (int num1474 = 0; num1474 < dustAmt; num1474++) { - Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; - vector171 = vector171.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)MathHelper.Pi / (float)dustAmt) + npc.Center; + Vector2 vector171 = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; + vector171 = vector171.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)MathHelper.Pi / (float)dustAmt) + NPC.Center; Vector2 value18 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 206, value18.X, value18.Y, 100, default, 3f); Main.dust[num1475].noGravity = true; Main.dust[num1475].noLight = true; Main.dust[num1475].velocity /= 4f; - Main.dust[num1475].velocity -= npc.velocity; + Main.dust[num1475].velocity -= NPC.velocity; } } } @@ -395,43 +396,43 @@ namespace CalamityMod.NPCs.StormWeaver { calamityGlobalNPC.newAI[0] += malice ? 4f : death ? 2f : 2f * (0.7f - lifeRatio); - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; + if (NPC.localAI[3] > 0f) + NPC.localAI[3] -= 1f; } } float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); + float num50 = NPC.velocity.Length(); if (num50 > 0f) { if (num50 > num48) { - npc.velocity.Normalize(); - npc.velocity *= num48; + NPC.velocity.Normalize(); + NPC.velocity *= num48; } else if (num50 < num49) { - npc.velocity.Normalize(); - npc.velocity *= num49; + NPC.velocity.Normalize(); + NPC.velocity *= num49; } } if (phase2 && !phase4) { - if (npc.localAI[1] == 1f) + if (NPC.localAI[1] == 1f) { // Play lightning sound on the target if not in phase 3 - Vector2 soundCenter = Main.player[npc.target].Center; + Vector2 soundCenter = Main.player[NPC.target].Center; // Play lightning sound on all nearby players if in phase 3 if (phase3) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f) + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < 2800f) { soundCenter = Main.player[Main.myPlayer].Center; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)soundCenter.X, (int)soundCenter.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)soundCenter.X, (int)soundCenter.Y); if (Main.netMode != NetmodeID.Server) { @@ -444,17 +445,17 @@ namespace CalamityMod.NPCs.StormWeaver } } else - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)soundCenter.X, (int)soundCenter.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)soundCenter.X, (int)soundCenter.Y); - npc.localAI[1] = 2f; + NPC.localAI[1] = 2f; if (Main.netMode != NetmodeID.MultiplayerClient) { int speed2 = revenge ? 8 : 7; - float spawnX2 = npc.Center.X > Main.player[npc.target].Center.X ? 1000f : -1000f; - float spawnY2 = -1000f + Main.player[npc.target].Center.Y; - Vector2 baseSpawn = new Vector2(spawnX2 + Main.player[npc.target].Center.X, spawnY2); - Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; + float spawnX2 = NPC.Center.X > Main.player[NPC.target].Center.X ? 1000f : -1000f; + float spawnY2 = -1000f + Main.player[NPC.target].Center.Y; + Vector2 baseSpawn = new Vector2(spawnX2 + Main.player[NPC.target].Center.X, spawnY2); + Vector2 baseVelocity = Main.player[NPC.target].Center - baseSpawn; baseVelocity.Normalize(); baseVelocity *= speed2; @@ -464,24 +465,24 @@ namespace CalamityMod.NPCs.StormWeaver source.X += i * 30f - (boltProjectiles * 15f); Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / boltProjectiles))); velocity.X = velocity.X + 3f * Main.rand.NextFloat() - 1.5f; - Vector2 vector94 = Main.player[npc.target].Center - source; + Vector2 vector94 = Main.player[NPC.target].Center - source; float ai = Main.rand.Next(100); int type = ProjectileID.CultistBossLightningOrbArc; - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(source, velocity, type, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); } } if (revenge) - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (num188 + Vector2.Distance(Main.player[npc.target].Center, npc.Center) * 0.01f * (0.7f - lifeRatio)) * 2f; + NPC.velocity = Vector2.Normalize(Main.player[NPC.target].Center - NPC.Center) * (num188 + Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) * 0.01f * (0.7f - lifeRatio)) * 2f; float chargeDirection = 0; - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) chargeDirection = -1f; - else if (npc.velocity.X > 0f) + else if (NPC.velocity.X > 0f) chargeDirection = 1f; - npc.localAI[2] = chargeDirection; + NPC.localAI[2] = chargeDirection; } } @@ -498,84 +499,84 @@ namespace CalamityMod.NPCs.StormWeaver num191 *= num198; num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - if (npc.velocity.X > num191) - npc.velocity.X = npc.velocity.X - num189; + if (NPC.velocity.X > num191) + NPC.velocity.X = NPC.velocity.X - num189; } - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - if (npc.velocity.Y > num192) - npc.velocity.Y = npc.velocity.Y - num189; + if (NPC.velocity.Y > num192) + NPC.velocity.Y = NPC.velocity.Y - num189; } - if (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(num192) < num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y + num189 * 2f; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y = NPC.velocity.Y + num189 * 2f; else - npc.velocity.Y = npc.velocity.Y - num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 2f; } - if (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(num191) < num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + num189 * 2f; + if (NPC.velocity.X > 0f) + NPC.velocity.X = NPC.velocity.X + num189 * 2f; else - npc.velocity.X = npc.velocity.X - num189 * 2f; + NPC.velocity.X = NPC.velocity.X - num189 * 2f; } } else { if (num196 > num197) { - if (npc.velocity.X < num191) - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - else if (npc.velocity.X > num191) - npc.velocity.X = npc.velocity.X - num189 * 1.1f; + if (NPC.velocity.X < num191) + NPC.velocity.X = NPC.velocity.X + num189 * 1.1f; + else if (NPC.velocity.X > num191) + NPC.velocity.X = NPC.velocity.X - num189 * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) { - if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y + num189; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y = NPC.velocity.Y + num189; else - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } else { - if (npc.velocity.Y < num192) - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - else if (npc.velocity.Y > num192) - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + if (NPC.velocity.Y < num192) + NPC.velocity.Y = NPC.velocity.Y + num189 * 1.1f; + else if (NPC.velocity.Y > num192) + NPC.velocity.Y = NPC.velocity.Y - num189 * 1.1f; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) { - if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X + num189; + if (NPC.velocity.X > 0f) + NPC.velocity.X = NPC.velocity.X + num189; else - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } } - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; if (phase4) { // Become weak and stop the storm when in phase 4 - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; calamityGlobalNPC.newAI[0] = 0f; CalamityMod.StopRain(); } @@ -609,11 +610,11 @@ namespace CalamityMod.NPCs.StormWeaver public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - bool shedArmor = npc.life / (float)npc.lifeMax < 0.9f; - Texture2D texture2D15 = shedArmor ? ModContent.GetTexture("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked") : Main.npcTexture[npc.type]; + bool shedArmor = NPC.life / (float)NPC.lifeMax < 0.9f; + Texture2D texture2D15 = shedArmor ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked") : Main.npcTexture[NPC.type]; Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Color color36 = Color.White; float amount9 = 0.5f; @@ -627,36 +628,36 @@ namespace CalamityMod.NPCs.StormWeaver if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.Calamity().newAI[0] > 280f) - color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp((npc.Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); - else if (npc.localAI[3] > 0f) - color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp(npc.localAI[3] / 60f, 0f, 1f)); + if (NPC.Calamity().newAI[0] > 280f) + color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp((NPC.Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); + else if (NPC.localAI[3] > 0f) + color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp(NPC.localAI[3] / 60f, 0f, 1f)); } color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - Color color = npc.GetAlpha(lightColor); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Color color = NPC.GetAlpha(lightColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.Calamity().newAI[0] > 280f) - color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp((npc.Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); - else if (npc.localAI[3] > 0f) - color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp(npc.localAI[3] / 60f, 0f, 1f)); + if (NPC.Calamity().newAI[0] > 280f) + color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp((NPC.Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); + else if (NPC.localAI[3] > 0f) + color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp(NPC.localAI[3] / 60f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -669,7 +670,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void OnHitPlayer(Player player, int damage, bool crit) { - int buffDuration = npc.Calamity().newAI[0] >= 400f ? 360 : 180; + int buffDuration = NPC.Calamity().newAI[0] >= 400f ? 360 : 180; player.AddBuff(BuffID.Electrified, buffDuration, true); } @@ -681,23 +682,23 @@ namespace CalamityMod.NPCs.StormWeaver public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeHead1"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeHead2"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SWNudeHead1"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SWNudeHead2"), NPC.scale); - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 30; - npc.height = 30; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 30; + NPC.height = 30; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -708,10 +709,10 @@ namespace CalamityMod.NPCs.StormWeaver for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -735,11 +736,11 @@ namespace CalamityMod.NPCs.StormWeaver public override bool SpecialNPCLoot() { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + int closestSegmentID = DropHelper.FindClosestWormSegment(NPC, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()); - npc.position = Main.npc[closestSegmentID].position; + NPC.position = Main.npc[closestSegmentID].position; return false; } @@ -749,34 +750,34 @@ namespace CalamityMod.NPCs.StormWeaver bool fullStrength = !CalamityWorld.downedSentinel2 || CalamityWorld.DoGSecondStageCountdown <= 0; if (fullStrength) { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); bool lastSentinelKilled = CalamityWorld.downedSentinel1 && !CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, lastSentinelKilled); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, lastSentinelKilled); if (!Main.expertMode) { // Materials - DropHelper.DropItem(npc, ModContent.ItemType(), true, 5, 8); + DropHelper.DropItem(NPC, ModContent.ItemType(), true, 5, 8); // Weapons - DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 4); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); // Light pet. - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); if (Main.rand.NextBool(20)) { - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); } } } @@ -787,7 +788,7 @@ namespace CalamityMod.NPCs.StormWeaver CalamityWorld.DoGSecondStageCountdown = 7260; if (Main.netMode == NetmodeID.Server) { - var netMessage = mod.GetPacket(); + var netMessage = Mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); @@ -804,7 +805,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); } } } diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 496026fe5c..ee2f75f275 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -17,20 +17,20 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetStaticDefaults() { DisplayName.SetDefault("Storm Weaver"); - NPCID.Sets.TrailingMode[npc.type] = 1; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.GetNPCDamage(); - npc.npcSlots = 5f; - npc.width = 48; - npc.height = 80; + NPC.GetNPCDamage(); + NPC.npcSlots = 5f; + NPC.width = 48; + NPC.height = 80; // 10% of HP is phase one bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; - npc.lifeMax = notDoGFight ? 825500 : 139750; - npc.LifeMaxNERB(npc.lifeMax, npc.lifeMax, 475000); + NPC.lifeMax = notDoGFight ? 825500 : 139750; + NPC.LifeMaxNERB(NPC.lifeMax, NPC.lifeMax, 475000); // If fought alone, Storm Weaver plays its own theme if (notDoGFight) @@ -40,46 +40,46 @@ namespace CalamityMod.NPCs.StormWeaver music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; // Phase one settings - npc.takenDamageMultiplier = 3f; - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath14; + NPC.takenDamageMultiplier = 3f; + NPC.HitSound = SoundID.NPCHit53; + NPC.DeathSound = SoundID.NPCDeath14; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.boss = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.boss = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.netAlways = true; + NPC.dontCountMe = true; if (CalamityWorld.malice || BossRushEvent.BossRushActive) - npc.scale = 1.25f; + NPC.scale = 1.25f; else if (CalamityWorld.death) - npc.scale = 1.2f; + NPC.scale = 1.2f; else if (CalamityWorld.revenge) - npc.scale = 1.15f; + NPC.scale = 1.15f; else if (Main.expertMode) - npc.scale = 1.1f; + NPC.scale = 1.1f; - npc.Calamity().VulnerableToElectricity = false; + NPC.Calamity().VulnerableToElectricity = false; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); + writer.Write(NPC.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) { invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -92,48 +92,48 @@ namespace CalamityMod.NPCs.StormWeaver if (invinceTime > 0) { invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; + NPC.damage = 0; + NPC.dontTakeDamage = true; } else { - npc.damage = npc.defDamage; - npc.dontTakeDamage = false; + NPC.damage = NPC.defDamage; + NPC.dontTakeDamage = false; } - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; // Shed armor - bool shedArmor = npc.life / (float)npc.lifeMax < 0.9f; + bool shedArmor = NPC.life / (float)NPC.lifeMax < 0.9f; // Update armored settings to naked settings if (shedArmor) { // Spawn armor gore and set other crucial variables - if (npc.takenDamageMultiplier == 3f) + if (NPC.takenDamageMultiplier == 3f) { - npc.Calamity().VulnerableToHeat = true; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmorTail1"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmorTail2"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SWArmorTail1"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SWArmorTail2"), NPC.scale); - CalamityGlobalNPC global = npc.Calamity(); - npc.defense = 45; + CalamityGlobalNPC global = NPC.Calamity(); + NPC.defense = 45; global.DR = 0.3f; - npc.takenDamageMultiplier = 1f; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath13; - npc.frame = new Rectangle(0, 0, 42, 68); + NPC.takenDamageMultiplier = 1f; + NPC.HitSound = SoundID.NPCHit13; + NPC.DeathSound = SoundID.NPCDeath13; + NPC.frame = new Rectangle(0, 0, 42, 68); } } - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -147,39 +147,39 @@ namespace CalamityMod.NPCs.StormWeaver } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - if (npc.alpha != 0) + if (NPC.alpha != 0) { for (int num934 = 0; num934 < 2; num934++) { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + int num935 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); Main.dust[num935].noGravity = true; Main.dust[num935].noLight = true; } } - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; @@ -188,42 +188,42 @@ namespace CalamityMod.NPCs.StormWeaver num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2(num192, num191) + MathHelper.PiOver2; + NPC.rotation = (float)System.Math.Atan2(num192, num191) + MathHelper.PiOver2; num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - bool shedArmor = npc.life / (float)npc.lifeMax < 0.9f; - Texture2D texture2D15 = shedArmor ? ModContent.GetTexture("CalamityMod/NPCs/StormWeaver/StormWeaverTailNaked") : Main.npcTexture[npc.type]; + bool shedArmor = NPC.life / (float)NPC.lifeMax < 0.9f; + Texture2D texture2D15 = shedArmor ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverTailNaked") : Main.npcTexture[NPC.type]; Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Color color36 = Color.White; float amount9 = 0.5f; @@ -237,43 +237,43 @@ namespace CalamityMod.NPCs.StormWeaver if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f) - color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); - else if (Main.npc[(int)npc.ai[2]].localAI[3] > 0f) - color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp(Main.npc[(int)npc.ai[2]].localAI[3] / 60f, 0f, 1f)); + if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] > 280f) + color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); + else if (Main.npc[(int)NPC.ai[2]].localAI[3] > 0f) + color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 60f, 0f, 1f)); } color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - Color color = npc.GetAlpha(lightColor); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Color color = NPC.GetAlpha(lightColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f) - color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); - else if (Main.npc[(int)npc.ai[2]].localAI[3] > 0f) - color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp(Main.npc[(int)npc.ai[2]].localAI[3] / 60f, 0f, 1f)); + if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] > 280f) + color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); + else if (Main.npc[(int)NPC.ai[2]].localAI[3] > 0f) + color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 60f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); if (!shedArmor) { - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/StormWeaver/StormWeaverTailGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverTailGlow"); Color rainbowBecauseWhyTheFuckNot = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); Color color37 = Color.Lerp(Color.White, rainbowBecauseWhyTheFuckNot, 0.5f); - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } return false; @@ -287,30 +287,30 @@ namespace CalamityMod.NPCs.StormWeaver public override void OnHitPlayer(Player player, int damage, bool crit) { - int buffDuration = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] >= 400f ? 120 : 60; + int buffDuration = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] >= 400f ? 120 : 60; player.AddBuff(BuffID.Electrified, buffDuration, true); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, hitDirection, -1f, 0, default, 1f); - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeTail1"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeTail2"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SWNudeTail1"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SWNudeTail2"), NPC.scale); - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 30; - npc.height = 30; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 30; + NPC.height = 30; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -321,10 +321,10 @@ namespace CalamityMod.NPCs.StormWeaver for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -342,8 +342,8 @@ namespace CalamityMod.NPCs.StormWeaver public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index 49515ed00d..33ec6334d8 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -19,28 +19,28 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { DisplayName.SetDefault("Anthozoan Crab"); - Main.npcFrameCount[npc.type] = 16; + Main.npcFrameCount[NPC.type] = 16; } public override void SetDefaults() { - npc.noGravity = true; - npc.damage = 45; - npc.width = 56; - npc.height = 42; - npc.defense = 22; - npc.lifeMax = 920; - npc.aiStyle = aiType = -1; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit38; - npc.DeathSound = SoundID.NPCDeath46; - npc.knockBackResist = 0.04f; - banner = npc.type; + NPC.noGravity = true; + NPC.damage = 45; + NPC.width = 56; + NPC.height = 42; + NPC.defense = 22; + NPC.lifeMax = 920; + NPC.aiStyle = aiType = -1; + NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.HitSound = SoundID.NPCHit38; + NPC.DeathSound = SoundID.NPCDeath46; + NPC.knockBackResist = 0.04f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { @@ -52,139 +52,139 @@ namespace CalamityMod.NPCs.SulphurousSea } public override void AI() { - if (npc.ai[1]++ % 360f < 280f) + if (NPC.ai[1]++ % 360f < 280f) { - if (npc.ai[2] > 1f) + if (NPC.ai[2] > 1f) { - npc.ai[2]--; + NPC.ai[2]--; } - npc.aiAction = 0; - if (npc.ai[2] == 0f) + NPC.aiAction = 0; + if (NPC.ai[2] == 0f) { - npc.ai[0] = -90f; - npc.ai[2] = 1f; - npc.TargetClosest(true); + NPC.ai[0] = -90f; + NPC.ai[2] = 1f; + NPC.TargetClosest(true); } - npc.TargetClosest(false); - Player player = Main.player[npc.target]; - if (npc.velocity.Y == 0f && !Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + NPC.TargetClosest(false); + Player player = Main.player[NPC.target]; + if (NPC.velocity.Y == 0f && !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - if (npc.collideY && npc.oldVelocity.Y != 0f && Collision.SolidCollision(npc.position, npc.width, npc.height)) + if (NPC.collideY && NPC.oldVelocity.Y != 0f && Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { - npc.position.X -= npc.velocity.X + npc.direction; + NPC.position.X -= NPC.velocity.X + NPC.direction; } - if (npc.ai[3] == npc.position.X) + if (NPC.ai[3] == NPC.position.X) { - npc.direction *= -1; - npc.ai[2] = 200f; + NPC.direction *= -1; + NPC.ai[2] = 200f; } - npc.spriteDirection = npc.direction; - npc.ai[3] = 0f; - npc.velocity.X *= 0.8f; - if (Math.Abs(npc.velocity.X) < 0.1f) + NPC.spriteDirection = NPC.direction; + NPC.ai[3] = 0f; + NPC.velocity.X *= 0.8f; + if (Math.Abs(NPC.velocity.X) < 0.1f) { - npc.velocity.X = 0f; + NPC.velocity.X = 0f; } - npc.ai[0] += 5f; + NPC.ai[0] += 5f; int state = 0; - if (npc.ai[0] >= 0f) + if (NPC.ai[0] >= 0f) { state = 1; } - if (npc.ai[0] >= -1000f && npc.ai[0] <= -500f) + if (NPC.ai[0] >= -1000f && NPC.ai[0] <= -500f) { state = 2; } - if (npc.ai[0] >= -2000f && npc.ai[0] <= -1500f) + if (NPC.ai[0] >= -2000f && NPC.ai[0] <= -1500f) { state = 3; } if (state > 0) { - npc.netUpdate = true; + NPC.netUpdate = true; if (state == 3) { - npc.velocity.Y -= 9f; - npc.velocity.X += 8f * npc.direction; - npc.ai[0] = -120f; - npc.ai[3] = npc.position.X; + NPC.velocity.Y -= 9f; + NPC.velocity.X += 8f * NPC.direction; + NPC.ai[0] = -120f; + NPC.ai[3] = NPC.position.X; } else { - npc.velocity.Y -= 8f; - npc.velocity.X += 11f * npc.direction; - npc.ai[0] = -80f; + NPC.velocity.Y -= 8f; + NPC.velocity.X += 11f * NPC.direction; + NPC.ai[0] = -80f; if (state == 1) { - npc.ai[0] -= 1000f; + NPC.ai[0] -= 1000f; } else { - npc.ai[0] -= 2000f; + NPC.ai[0] -= 2000f; } } } - else if (npc.ai[0] >= -30f) + else if (NPC.ai[0] >= -30f) { - npc.aiAction = 1; + NPC.aiAction = 1; return; } } - else if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - npc.direction = npc.spriteDirection = (npc.SafeDirectionTo(player.Center).X < 0).ToDirectionInt(); - if (Math.Abs(npc.velocity.X) < 14f && Math.Abs(player.Center.X - npc.Center.X) > 65f) - npc.velocity.X += npc.spriteDirection * -0.08f; + NPC.direction = NPC.spriteDirection = (NPC.SafeDirectionTo(player.Center).X < 0).ToDirectionInt(); + if (Math.Abs(NPC.velocity.X) < 14f && Math.Abs(player.Center.X - NPC.Center.X) > 65f) + NPC.velocity.X += NPC.spriteDirection * -0.08f; } } else { - npc.velocity.X *= 0.9f; - if (npc.ai[1] % 360f == 300f) + NPC.velocity.X *= 0.9f; + if (NPC.ai[1] % 360f == 300f) { - npc.velocity.X = 0f; - Vector2 rockSpawnPosition = new Vector2(16f * -npc.spriteDirection + npc.Center.X, npc.Bottom.Y - 6f); + NPC.velocity.X = 0f; + Vector2 rockSpawnPosition = new Vector2(16f * -NPC.spriteDirection + NPC.Center.X, NPC.Bottom.Y - 6f); if (Main.netMode != NetmodeID.MultiplayerClient) { boulderIndex = Projectile.NewProjectile(rockSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 29, 6f); - npc.netUpdate = true; + NPC.netUpdate = true; } } - if (npc.ai[1] % 360f == 330f) + if (NPC.ai[1] % 360f == 330f) { - Main.projectile[boulderIndex].velocity = new Vector2(0f, -11f).RotatedBy(-npc.spriteDirection * 0.8f); + Main.projectile[boulderIndex].velocity = new Vector2(0f, -11f).RotatedBy(-NPC.spriteDirection * 0.8f); boulderIndex = -1; - npc.netUpdate = true; + NPC.netUpdate = true; } } - npc.velocity.Y += 0.25f; + NPC.velocity.Y += 0.25f; } public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.ai[1] % 360f < 280f) + NPC.frameCounter++; + if (NPC.ai[1] % 360f < 280f) { - if (npc.frameCounter % 6 == 5) + if (NPC.frameCounter % 6 == 5) { - npc.frame.Y += frameHeight; - if (npc.frame.Y >= 4 * frameHeight) + NPC.frame.Y += frameHeight; + if (NPC.frame.Y >= 4 * frameHeight) { - npc.frame.Y = frameHeight; + NPC.frame.Y = frameHeight; } } } else { - npc.frame.Y = 3 * frameHeight + frameHeight * (int)MathHelper.Clamp(npc.ai[1] % 280f / 60f * 9, 0, 9); + NPC.frame.Y = 3 * frameHeight + frameHeight * (int)MathHelper.Clamp(NPC.ai[1] % 280f / 60f * 9, 0, 9); } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur || !CalamityWorld.downedAquaticScourge) + if (spawnInfo.playerSafe || !spawnInfo.Player.Calamity().ZoneSulphur || !CalamityWorld.downedAquaticScourge) { return 0f; } @@ -193,7 +193,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 15); // Rarer to encourage fighting Acid Rain + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 15); // Rarer to encourage fighting Acid Rain } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -203,15 +203,15 @@ namespace CalamityMod.NPCs.SulphurousSea public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/AnthozoanCrabGore"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/AnthozoanCrabGore2"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/AnthozoanCrabGore3"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/AnthozoanCrabGore"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/AnthozoanCrabGore2"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/AnthozoanCrabGore3"), NPC.scale); } } } diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index f941dcc646..33cd8bfb5c 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -23,42 +23,42 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { - npc.noGravity = true; - npc.damage = 45; - npc.width = 54; - npc.height = 42; - npc.defense = 25; - npc.lifeMax = 1000; - npc.aiStyle = aiType = -1; - npc.value = Item.buyPrice(0, 0, 3, 50); - npc.HitSound = SoundID.NPCHit42; - npc.DeathSound = SoundID.NPCDeath5; - npc.knockBackResist = 0f; - banner = npc.type; + NPC.noGravity = true; + NPC.damage = 45; + NPC.width = 54; + NPC.height = 42; + NPC.defense = 25; + NPC.lifeMax = 1000; + NPC.aiStyle = aiType = -1; + NPC.value = Item.buyPrice(0, 0, 3, 50); + NPC.HitSound = SoundID.NPCHit42; + NPC.DeathSound = SoundID.NPCDeath5; + NPC.knockBackResist = 0f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.velocity.Y += 0.25f; - npc.TargetClosest(false); - Player player = Main.player[npc.target]; - if (Math.Abs(player.Center.X - npc.Center.X) < CheckDistance && player.Bottom.Y < npc.Top.Y) + NPC.velocity.Y += 0.25f; + NPC.TargetClosest(false); + Player player = Main.player[NPC.target]; + if (Math.Abs(player.Center.X - NPC.Center.X) < CheckDistance && player.Bottom.Y < NPC.Top.Y) { - if (npc.ai[0]++ % 35f == 34f && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.ai[0]++ % 35f == 34f && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 velocity = new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-11f, -6f)); - Projectile.NewProjectile(npc.Top + new Vector2(0f, 6f), velocity, ModContent.ProjectileType(), 27, 3f); + Projectile.NewProjectile(NPC.Top + new Vector2(0f, 6f), velocity, ModContent.ProjectileType(), 27, 3f); } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur || !CalamityWorld.downedAquaticScourge) + if (spawnInfo.playerSafe || !spawnInfo.Player.Calamity().ZoneSulphur || !CalamityWorld.downedAquaticScourge) { return 0f; } @@ -67,8 +67,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 15); // Rarer to encourage fighting Acid Rain - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 15); // Rarer to encourage fighting Acid Rain + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -78,14 +78,14 @@ namespace CalamityMod.NPCs.SulphurousSea public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/BelchingCoralGore"), npc.scale); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/BelchingCoralGore2"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/BelchingCoralGore"), NPC.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/AcidRain/BelchingCoralGore2"), NPC.scale); } } } diff --git a/NPCs/SulphurousSea/Catfish.cs b/NPCs/SulphurousSea/Catfish.cs index 4e747904d0..befa626ec5 100644 --- a/NPCs/SulphurousSea/Catfish.cs +++ b/NPCs/SulphurousSea/Catfish.cs @@ -12,67 +12,67 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { DisplayName.SetDefault("Catfish"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.noGravity = true; - npc.damage = 30; - npc.width = 98; - npc.height = 40; - npc.defense = 12; - npc.lifeMax = 120; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.damage = 30; + NPC.width = 98; + NPC.height = 40; + NPC.defense = 12; + NPC.lifeMax = 120; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath40; - npc.knockBackResist = 0.8f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath40; + NPC.knockBackResist = 0.8f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.chaseable = false; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - CalamityAI.PassiveSwimmingAI(npc, mod, 0, Main.player[npc.target].Calamity().GetAbyssAggro(200f, 150f), 0.25f, 0.15f, 8f, 8f, 0.1f); + CalamityAI.PassiveSwimmingAI(NPC, Mod, 0, Main.player[NPC.target].Calamity().GetAbyssAggro(200f, 150f), 0.25f, 0.15f, 8f, 8f, 0.1f); } public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { - return npc.chaseable; + return NPC.chaseable; } return null; } public override void FindFrame(int frameHeight) { - if (!npc.wet) + if (!NPC.wet) { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; return; } - npc.frameCounter += npc.chaseable ? 0.15f : 0.075f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += NPC.chaseable ? 0.15f : 0.075f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -86,7 +86,7 @@ namespace CalamityMod.NPCs.SulphurousSea { return 0f; } - if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.water) { return 0.2f; } @@ -95,20 +95,20 @@ namespace CalamityMod.NPCs.SulphurousSea public override void NPCLoot() { - DropHelper.DropItemChance(npc, ItemID.DivingHelmet, 20); + DropHelper.DropItemChance(NPC, ItemID.DivingHelmet, 20); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/SulphurousSea/Flounder.cs b/NPCs/SulphurousSea/Flounder.cs index eebd38c4a0..f9e9f08290 100644 --- a/NPCs/SulphurousSea/Flounder.cs +++ b/NPCs/SulphurousSea/Flounder.cs @@ -12,74 +12,74 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { DisplayName.SetDefault("Flounder"); - Main.npcFrameCount[npc.type] = 4; + Main.npcFrameCount[NPC.type] = 4; } public override void SetDefaults() { - npc.chaseable = false; - npc.damage = 10; - npc.width = 42; - npc.height = 32; - npc.defense = 15; - npc.lifeMax = 40; - npc.aiStyle = -1; + NPC.chaseable = false; + NPC.damage = 10; + NPC.width = 42; + NPC.height = 32; + NPC.defense = 15; + NPC.lifeMax = 40; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit50; - npc.DeathSound = SoundID.NPCDeath53; - npc.knockBackResist = 0.35f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 0, 80); + NPC.HitSound = SoundID.NPCHit50; + NPC.DeathSound = SoundID.NPCDeath53; + NPC.knockBackResist = 0.35f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.chaseable = false; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; int num = 200; - if (npc.ai[2] == 0f) + if (NPC.ai[2] == 0f) { - npc.alpha = num; - npc.TargetClosest(true); - if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + NPC.alpha = num; + NPC.TargetClosest(true); + if (!Main.player[NPC.target].dead && (Main.player[NPC.target].Center - NPC.Center).Length() < 170f && + Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - npc.ai[2] = -16f; + NPC.ai[2] = -16f; } - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit) + if (NPC.velocity.X != 0f || NPC.velocity.Y < 0f || NPC.velocity.Y > 2f || NPC.justHit) { - npc.ai[2] = -16f; + NPC.ai[2] = -16f; } return; } - if (npc.ai[2] < 0f) + if (NPC.ai[2] < 0f) { - if (npc.alpha > 0) + if (NPC.alpha > 0) { - npc.alpha -= num / 16; - if (npc.alpha < 0) + NPC.alpha -= num / 16; + if (NPC.alpha < 0) { - npc.alpha = 0; + NPC.alpha = 0; } } - npc.ai[2] += 1f; - if (npc.ai[2] == 0f) + NPC.ai[2] += 1f; + if (NPC.ai[2] == 0f) { - npc.ai[2] = 1f; - npc.velocity.X = (float)(npc.direction * 2); + NPC.ai[2] = 1f; + NPC.velocity.X = (float)(NPC.direction * 2); } return; } - npc.alpha = 0; - if (npc.ai[2] == 1f) + NPC.alpha = 0; + if (NPC.ai[2] == 1f) { - npc.chaseable = true; - CalamityAI.PassiveSwimmingAI(npc, mod, 0, 0f, 0.1f, 0.1f, 2f, 1f, 0.1f); + NPC.chaseable = true; + CalamityAI.PassiveSwimmingAI(NPC, Mod, 0, 0f, 0.1f, 0.1f, 2f, 1f, 0.1f); } } @@ -90,15 +90,15 @@ namespace CalamityMod.NPCs.SulphurousSea public override void FindFrame(int frameHeight) { - if (!npc.wet) + if (!NPC.wet) { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; return; } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -107,7 +107,7 @@ namespace CalamityMod.NPCs.SulphurousSea { return 0f; } - if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.water) { return 0.2f; } @@ -116,20 +116,20 @@ namespace CalamityMod.NPCs.SulphurousSea public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 1); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 2, 1, 1); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index ef4938e027..514cf7544e 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -12,36 +12,36 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { DisplayName.SetDefault("Gnasher"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.damage = 25; - npc.width = 50; - npc.height = 36; - npc.defense = 30; - npc.DR_NERD(0.15f); - npc.lifeMax = 35; - npc.knockBackResist = 0.25f; - npc.aiStyle = 3; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 25; + NPC.width = 50; + NPC.height = 36; + NPC.defense = 30; + NPC.DR_NERD(0.15f); + NPC.lifeMax = 35; + NPC.knockBackResist = 0.25f; + NPC.aiStyle = 3; aiType = 67; - npc.value = Item.buyPrice(0, 0, 0, 60); - npc.HitSound = SoundID.NPCHit50; - npc.DeathSound = SoundID.NPCDeath54; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 0, 60); + NPC.HitSound = SoundID.NPCHit50; + NPC.DeathSound = SoundID.NPCDeath54; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - npc.spriteDirection = (npc.direction > 0) ? -1 : 1; - float num79 = (Main.player[npc.target].Center - npc.Center).Length(); + NPC.spriteDirection = (NPC.direction > 0) ? -1 : 1; + float num79 = (Main.player[NPC.target].Center - NPC.Center).Length(); num79 *= 0.0025f; if ((double)num79 > 1.5) { @@ -57,37 +57,37 @@ namespace CalamityMod.NPCs.SulphurousSea num78 = 2.25f - num79; } num78 *= (CalamityWorld.death ? 1.2f : 0.8f); - if (npc.velocity.X < -num78 || npc.velocity.X > num78) + if (NPC.velocity.X < -num78 || NPC.velocity.X > num78) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.velocity *= 0.8f; + NPC.velocity *= 0.8f; } } - else if (npc.velocity.X < num78 && npc.direction == 1) + else if (NPC.velocity.X < num78 && NPC.direction == 1) { - npc.velocity.X = npc.velocity.X + 1f; - if (npc.velocity.X > num78) + NPC.velocity.X = NPC.velocity.X + 1f; + if (NPC.velocity.X > num78) { - npc.velocity.X = num78; + NPC.velocity.X = num78; } } - else if (npc.velocity.X > -num78 && npc.direction == -1) + else if (NPC.velocity.X > -num78 && NPC.direction == -1) { - npc.velocity.X = npc.velocity.X - 1f; - if (npc.velocity.X < -num78) + NPC.velocity.X = NPC.velocity.X - 1f; + if (NPC.velocity.X < -num78) { - npc.velocity.X = -num78; + NPC.velocity.X = -num78; } } } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -101,7 +101,7 @@ namespace CalamityMod.NPCs.SulphurousSea { return 0f; } - if (spawnInfo.player.Calamity().ZoneSulphur) + if (spawnInfo.Player.Calamity().ZoneSulphur) { return 0.2f; } @@ -110,23 +110,23 @@ namespace CalamityMod.NPCs.SulphurousSea public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ItemID.TurtleShell, Main.hardMode, 10, 1, 1); + DropHelper.DropItemCondition(NPC, ItemID.TurtleShell, Main.hardMode, 10, 1, 1); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gnasher"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gnasher2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Gnasher"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Gnasher2"), 1f); } } } diff --git a/NPCs/SulphurousSea/MicrobialCluster.cs b/NPCs/SulphurousSea/MicrobialCluster.cs index 33240650ce..7d12f48fd6 100644 --- a/NPCs/SulphurousSea/MicrobialCluster.cs +++ b/NPCs/SulphurousSea/MicrobialCluster.cs @@ -17,47 +17,47 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { - npc.noGravity = true; - npc.damage = 0; - npc.width = 24; - npc.height = 24; - npc.lifeMax = 5; - npc.aiStyle = aiType = -1; - npc.noTileCollide = false; - npc.noGravity = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.dontTakeDamageFromHostiles = true; - npc.knockBackResist = 0f; + NPC.noGravity = true; + NPC.damage = 0; + NPC.width = 24; + NPC.height = 24; + NPC.lifeMax = 5; + NPC.aiStyle = aiType = -1; + NPC.noTileCollide = false; + NPC.noGravity = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.dontTakeDamageFromHostiles = true; + NPC.knockBackResist = 0f; } public override void AI() { - if (npc.collideX || npc.collideY) + if (NPC.collideX || NPC.collideY) { - npc.velocity *= -1f; - npc.netUpdate = true; + NPC.velocity *= -1f; + NPC.netUpdate = true; } DelegateMethods.v3_1 = Color.GreenYellow.ToVector3() * 2f; - Utils.PlotTileLine(npc.Center, npc.Center + npc.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); - npc.ai[0]++; - if (npc.ai[0] % SlowdownTime > SlowdownTime - SlowdownTime) + Utils.PlotTileLine(NPC.Center, NPC.Center + NPC.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); + NPC.ai[0]++; + if (NPC.ai[0] % SlowdownTime > SlowdownTime - SlowdownTime) { - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; } - if (npc.ai[0] % SlowdownTime == SlowdownTime - 1) + if (NPC.ai[0] % SlowdownTime == SlowdownTime - 1) { - npc.velocity = npc.velocity.SafeNormalize(-Vector2.UnitY).RotatedByRandom(MathHelper.PiOver4) * 4f; + NPC.velocity = NPC.velocity.SafeNormalize(-Vector2.UnitY).RotatedByRandom(MathHelper.PiOver4) * 4f; } - if (npc.ai[0] % 32f == 31f) + if (NPC.ai[0] % 32f == 31f) { - Dust dust = Dust.NewDustPerfect(npc.Center, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(NPC.Center, (int)CalamityDusts.SulfurousSeaAcid); dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1f, 2f); dust.noGravity = true; dust.scale = 1.6f; } } - public override float SpawnChance(NPCSpawnInfo spawnInfo) => spawnInfo.player.InSulphur() && spawnInfo.water ? 0.4f : 0f; + public override float SpawnChance(NPCSpawnInfo spawnInfo) => spawnInfo.Player.InSulphur() && spawnInfo.water ? 0.4f : 0f; public override void NPCLoot() { @@ -65,11 +65,11 @@ namespace CalamityMod.NPCs.SulphurousSea public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 6; k++) { - Dust dust = Dust.NewDustPerfect(npc.Center, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(NPC.Center, (int)CalamityDusts.SulfurousSeaAcid); dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1f, 2f); dust.scale = 1.2f; } diff --git a/NPCs/SulphurousSea/Trasher.cs b/NPCs/SulphurousSea/Trasher.cs index 99db054101..24d8ee4dc2 100644 --- a/NPCs/SulphurousSea/Trasher.cs +++ b/NPCs/SulphurousSea/Trasher.cs @@ -18,146 +18,146 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { DisplayName.SetDefault("Trasher"); - Main.npcFrameCount[npc.type] = 8; + Main.npcFrameCount[NPC.type] = 8; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.noGravity = true; - npc.damage = 50; - npc.width = 150; - npc.height = 40; - npc.defense = 22; - npc.lifeMax = 200; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.noGravity = true; + NPC.damage = 50; + NPC.width = 150; + NPC.height = 40; + NPC.defense = 22; + NPC.lifeMax = 200; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 3, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath5; - npc.knockBackResist = 0f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 3, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath5; + NPC.knockBackResist = 0f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(hasBeenHit); - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - npc.spriteDirection = (npc.direction > 0) ? -1 : 1; - npc.chaseable = hasBeenHit; - if (npc.justHit) + NPC.spriteDirection = (NPC.direction > 0) ? -1 : 1; + NPC.chaseable = hasBeenHit; + if (NPC.justHit) { hasBeenHit = true; } - if (npc.wet) + if (NPC.wet) { - if (npc.direction == 0) + if (NPC.direction == 0) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - npc.noTileCollide = false; + NPC.noTileCollide = false; bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < 200f) + NPC.TargetClosest(false); + if (Main.player[NPC.target].wet && !Main.player[NPC.target].dead && + Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && + (Main.player[NPC.target].Center - NPC.Center).Length() < 200f) { flag14 = true; } - if (Main.player[npc.target].dead && flag14) + if (Main.player[NPC.target].dead && flag14) { flag14 = false; } if (!flag14) { - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; + NPC.netUpdate = true; } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } } if (flag14) { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * (CalamityWorld.death ? 0.6f : 0.3f); - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * (CalamityWorld.death ? 0.2f : 0.1f); + NPC.TargetClosest(true); + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * (CalamityWorld.death ? 0.6f : 0.3f); + NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * (CalamityWorld.death ? 0.2f : 0.1f); float velocityX = CalamityWorld.death ? 20f : 10f; float velocityY = CalamityWorld.death ? 10f : 5f; - if (npc.velocity.X > velocityX) + if (NPC.velocity.X > velocityX) { - npc.velocity.X = velocityX; + NPC.velocity.X = velocityX; } - if (npc.velocity.X < -velocityX) + if (NPC.velocity.X < -velocityX) { - npc.velocity.X = -velocityX; + NPC.velocity.X = -velocityX; } - if (npc.velocity.Y > velocityY) + if (NPC.velocity.Y > velocityY) { - npc.velocity.Y = velocityY; + NPC.velocity.Y = velocityY; } - if (npc.velocity.Y < -velocityY) + if (NPC.velocity.Y < -velocityY) { - npc.velocity.Y = -velocityY; + NPC.velocity.Y = -velocityY; } } else { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -1.5f || npc.velocity.X > 1.5f) + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -1.5f || NPC.velocity.X > 1.5f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num258 = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int num259 = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; if (Main.tile[num258, num259 - 1] == null) { Main.tile[num258, num259 - 1] = new Tile(); @@ -174,143 +174,143 @@ namespace CalamityMod.NPCs.SulphurousSea { if (Main.tile[num258, num259 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num258, num259 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) { - npc.velocity.Y = npc.velocity.Y * 0.95f; + NPC.velocity.Y = NPC.velocity.Y * 0.95f; } } else { - if (Collision.WetCollision(npc.position, npc.width, npc.height)) + if (Collision.WetCollision(NPC.position, NPC.width, NPC.height)) { - npc.noTileCollide = false; - npc.netUpdate = true; + NPC.noTileCollide = false; + NPC.netUpdate = true; return; } - npc.noTileCollide = true; + NPC.noTileCollide = true; float num823 = 1f; - npc.TargetClosest(true); + NPC.TargetClosest(true); bool flag51 = false; - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.death) + if ((double)NPC.life < (double)NPC.lifeMax * 0.5 || CalamityWorld.death) { num823 = 1.5f; } - if ((double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.death) + if ((double)NPC.life < (double)NPC.lifeMax * 0.25 || CalamityWorld.death) { num823 = 2.5f; } - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 20f) + if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 20f) { flag51 = true; } if (flag51) { - npc.velocity.X = npc.velocity.X * 0.9f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + NPC.velocity.X = NPC.velocity.X * 0.9f; + if ((double)NPC.velocity.X > -0.1 && (double)NPC.velocity.X < 0.1) { - npc.velocity.X = 0f; + NPC.velocity.X = 0f; } } else { - if (npc.direction > 0) + if (NPC.direction > 0) { - npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; + NPC.velocity.X = (NPC.velocity.X * 20f + num823) / 21f; } - if (npc.direction < 0) + if (NPC.direction < 0) { - npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; + NPC.velocity.X = (NPC.velocity.X * 20f - num823) / 21f; } } int num854 = 80; int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); + Vector2 position2 = new Vector2(NPC.Center.X - (float)(num854 / 2), NPC.position.Y + (float)NPC.height - (float)num855); bool flag52 = false; - if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y + (float)Main.player[npc.target].height - 16f) + if (NPC.position.X < Main.player[NPC.target].position.X && NPC.position.X + (float)NPC.width > Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width && NPC.position.Y + (float)NPC.height < Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height - 16f) { flag52 = true; } if (flag52) { - npc.velocity.Y = npc.velocity.Y + 0.5f; + NPC.velocity.Y = NPC.velocity.Y + 0.5f; } else if (Collision.SolidCollision(position2, num854, num855)) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = 0f; + NPC.velocity.Y = 0f; } - if (npc.velocity.Y > -0.2f) + if (NPC.velocity.Y > -0.2f) { - npc.velocity.Y = npc.velocity.Y - 0.025f; + NPC.velocity.Y = NPC.velocity.Y - 0.025f; } else { - npc.velocity.Y = npc.velocity.Y - 0.2f; + NPC.velocity.Y = NPC.velocity.Y - 0.2f; } - if (npc.velocity.Y < -4f) + if (NPC.velocity.Y < -4f) { - npc.velocity.Y = -4f; + NPC.velocity.Y = -4f; } } else { - if (npc.velocity.Y < 0f) + if (NPC.velocity.Y < 0f) { - npc.velocity.Y = 0f; + NPC.velocity.Y = 0f; } - if (npc.velocity.Y < 0.1f) + if (NPC.velocity.Y < 0.1f) { - npc.velocity.Y = npc.velocity.Y + 0.025f; + NPC.velocity.Y = NPC.velocity.Y + 0.025f; } else { - npc.velocity.Y = npc.velocity.Y + 0.5f; + NPC.velocity.Y = NPC.velocity.Y + 0.5f; } } - if (npc.velocity.Y > 10f) + if (NPC.velocity.Y > 10f) { - npc.velocity.Y = 10f; + NPC.velocity.Y = 10f; } } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.05f; - npc.rotation = MathHelper.Clamp(npc.rotation, -0.1f, 0.1f); + NPC.rotation = NPC.velocity.Y * (float)NPC.direction * 0.05f; + NPC.rotation = MathHelper.Clamp(NPC.rotation, -0.1f, 0.1f); } public override void FindFrame(int frameHeight) { - npc.frameCounter += hasBeenHit ? 1.25 : 1.0; - if (npc.frameCounter < 6.0) + NPC.frameCounter += hasBeenHit ? 1.25 : 1.0; + if (NPC.frameCounter < 6.0) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } - else if (npc.frameCounter < 12.0) + else if (NPC.frameCounter < 12.0) { - npc.frame.Y = frameHeight; + NPC.frame.Y = frameHeight; } - else if (npc.frameCounter < 18.0) + else if (NPC.frameCounter < 18.0) { - npc.frame.Y = frameHeight * 2; + NPC.frame.Y = frameHeight * 2; } - else if (npc.frameCounter < 24.0) + else if (NPC.frameCounter < 24.0) { - npc.frame.Y = frameHeight * 3; + NPC.frame.Y = frameHeight * 3; } else { - npc.frameCounter = 0.0; - npc.frame.Y = 0; + NPC.frameCounter = 0.0; + NPC.frame.Y = 0; } - if (!npc.wet) + if (!NPC.wet) { - npc.frame.Y = npc.frame.Y + frameHeight * 4; + NPC.frame.Y = NPC.frame.Y + frameHeight * 4; } } @@ -325,7 +325,7 @@ namespace CalamityMod.NPCs.SulphurousSea { return 0f; } - if (spawnInfo.player.Calamity().ZoneSulphur || (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water)) + if (spawnInfo.Player.Calamity().ZoneSulphur || (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.water)) { return 0.1f; } @@ -336,28 +336,28 @@ namespace CalamityMod.NPCs.SulphurousSea { if (!NPC.savedAngler && !NPC.AnyNPCs(NPCID.Angler) && !NPC.AnyNPCs(NPCID.SleepingAngler) && Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Angler, 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y, NPCID.Angler, 0, 0f, 0f, 0f, 0f, 255); NPC.savedAngler = true; } - DropHelper.DropItemChance(npc, ItemID.DivingHelmet, 20); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 20); - DropHelper.DropItemCondition(npc, ItemID.Gatligator, Main.hardMode, 10, 1, 1); + DropHelper.DropItemChance(NPC, ItemID.DivingHelmet, 20); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 20); + DropHelper.DropItemCondition(NPC, ItemID.Gatligator, Main.hardMode, 10, 1, 1); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Trasher"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Trasher2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Trasher"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Trasher2"), 1f); } } } diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs index aba06d53a4..08180f1077 100644 --- a/NPCs/SunkenSea/BlindedAngler.cs +++ b/NPCs/SunkenSea/BlindedAngler.cs @@ -14,86 +14,86 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { DisplayName.SetDefault("Blinded Angler"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.noGravity = true; - npc.damage = 150; - npc.width = 56; - npc.height = 44; - npc.defense = 30; - npc.DR_NERD(0.2f); - npc.lifeMax = 750; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.damage = 150; + NPC.width = 56; + NPC.height = 44; + NPC.defense = 30; + NPC.DR_NERD(0.2f); + NPC.lifeMax = 750; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 0, 40, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.1f; - banner = npc.type; + NPC.value = Item.buyPrice(0, 0, 40, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.1f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.chaseable = false; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - Lighting.AddLight(npc.Center, (255 - npc.alpha) * 0f / 255f, (255 - npc.alpha) * 0.75f / 255f, (255 - npc.alpha) * 0.75f / 255f); - CalamityAI.PassiveSwimmingAI(npc, mod, 1, 100f, 0.1f, 0.1f, 3f, 3f, 0.1f); + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); + CalamityAI.PassiveSwimmingAI(NPC, Mod, 1, 100f, 0.1f, 0.1f, 3f, 3f, 0.1f); } public override void FindFrame(int frameHeight) { - npc.frameCounter += npc.wet ? 0.15f : 0f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += NPC.wet ? 0.15f : 0f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/BlindedAnglerGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { - return npc.chaseable; + return NPC.chaseable; } return null; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (Main.hardMode && spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) + if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.Player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.45f; } @@ -102,26 +102,26 @@ namespace CalamityMod.NPCs.SunkenSea public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.25f); - DropHelper.DropItem(npc, ModContent.ItemType(), 5, 9); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.25f); + DropHelper.DropItem(NPC, ModContent.ItemType(), 5, 9); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore4"), 1f); } } } diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index 9af6fcab88..9e2f2f9ce3 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -16,38 +16,38 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { DisplayName.SetDefault("Clam"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.damage = 30; - npc.width = 56; - npc.height = 38; - npc.defense = 9999; - npc.DR_NERD(0.25f); - npc.lifeMax = Main.hardMode ? 300 : 150; + NPC.damage = 30; + NPC.width = 56; + NPC.height = 38; + NPC.defense = 9999; + NPC.DR_NERD(0.25f); + NPC.lifeMax = Main.hardMode ? 300 : 150; if (Main.expertMode) { - npc.lifeMax *= 2; + NPC.lifeMax *= 2; } - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.value = Main.hardMode ? Item.buyPrice(0, 0, 10, 0) : Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit4; - npc.knockBackResist = 0.05f; - banner = npc.type; + NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 10, 0) : Item.buyPrice(0, 0, 1, 0); + NPC.HitSound = SoundID.NPCHit4; + NPC.knockBackResist = 0.05f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(hitAmount); - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); writer.Write(hasBeenHit); writer.Write(statChange); } @@ -55,113 +55,113 @@ namespace CalamityMod.NPCs.SunkenSea public override void ReceiveExtraAI(BinaryReader reader) { hitAmount = reader.ReadInt32(); - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); hasBeenHit = reader.ReadBoolean(); statChange = reader.ReadBoolean(); } public override void AI() { - npc.TargetClosest(true); - if (Main.player[npc.target].Calamity().clamity) + NPC.TargetClosest(true); + if (Main.player[NPC.target].Calamity().clamity) { hitAmount = 3; hasBeenHit = true; } - if (npc.justHit && hitAmount < 3) + if (NPC.justHit && hitAmount < 3) { ++hitAmount; hasBeenHit = true; } - npc.chaseable = hasBeenHit; + NPC.chaseable = hasBeenHit; if (hitAmount == 3) { if (!statChange) { - npc.buffImmune[BuffID.Confused] = false; - npc.defense = 6; - npc.damage = Main.expertMode ? 60 : 30; + NPC.buffImmune[BuffID.Confused] = false; + NPC.defense = 6; + NPC.damage = Main.expertMode ? 60 : 30; if (Main.hardMode) { - npc.defense = 15; - npc.damage = Main.expertMode ? 120 : 60; + NPC.defense = 15; + NPC.damage = Main.expertMode ? 120 : 60; } statChange = true; } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || (double)npc.velocity.Y > 0.9) + if (NPC.velocity.X != 0f || NPC.velocity.Y < 0f || (double)NPC.velocity.Y > 0.9) { - npc.ai[0] = 1f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.netUpdate = true; return; } - npc.ai[0] = 1f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.netUpdate = true; return; } } - else if (npc.velocity.Y == 0f) + else if (NPC.velocity.Y == 0f) { - npc.ai[2] += 1f; + NPC.ai[2] += 1f; int num321 = 20; - if (npc.ai[1] == 0f) + if (NPC.ai[1] == 0f) { num321 = 12; } - if (npc.ai[2] < (float)num321) + if (NPC.ai[2] < (float)num321) { - npc.velocity.X *= 0.9f; + NPC.velocity.X *= 0.9f; return; } - npc.ai[2] = 0f; - npc.TargetClosest(true); - if (npc.direction == 0) + NPC.ai[2] = 0f; + NPC.TargetClosest(true); + if (NPC.direction == 0) { - npc.direction = -1; + NPC.direction = -1; } - npc.spriteDirection = -npc.direction; - npc.ai[1] += 1f; - npc.ai[3] += 1f; - if (npc.ai[3] >= 4f) + NPC.spriteDirection = -NPC.direction; + NPC.ai[1] += 1f; + NPC.ai[3] += 1f; + if (NPC.ai[3] >= 4f) { - npc.ai[3] = 0f; - if (npc.ai[1] == 2f) + NPC.ai[3] = 0f; + if (NPC.ai[1] == 2f) { float multiplierX = (float)Main.rand.Next(3, 7); - npc.velocity.X = (float)npc.direction * multiplierX; - npc.velocity.Y = -8f; - npc.ai[1] = 0f; + NPC.velocity.X = (float)NPC.direction * multiplierX; + NPC.velocity.Y = -8f; + NPC.ai[1] = 0f; } else { float multiplierX = (float)Main.rand.Next(5, 9); - npc.velocity.X = (float)npc.direction * multiplierX; - npc.velocity.Y = -4f; + NPC.velocity.X = (float)NPC.direction * multiplierX; + NPC.velocity.Y = -4f; } } - npc.netUpdate = true; + NPC.netUpdate = true; return; } else { - if (npc.direction == 1 && npc.velocity.X < 1f) + if (NPC.direction == 1 && NPC.velocity.X < 1f) { - npc.velocity.X = npc.velocity.X + 0.1f; + NPC.velocity.X = NPC.velocity.X + 0.1f; return; } - if (npc.direction == -1 && npc.velocity.X > -1f) + if (NPC.direction == -1 && NPC.velocity.X > -1f) { - npc.velocity.X = npc.velocity.X - 0.1f; + NPC.velocity.X = NPC.velocity.X - 0.1f; return; } } } else { - npc.damage = 0; + NPC.damage = 0; } } @@ -176,28 +176,28 @@ namespace CalamityMod.NPCs.SunkenSea public override void FindFrame(int frameHeight) { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 4.0) { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; } if (hitAmount < 3) { - npc.frame.Y = frameHeight * 4; + NPC.frame.Y = frameHeight * 4; } else { - if (npc.frame.Y > frameHeight * 3) + if (NPC.frame.Y > frameHeight * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } @@ -208,23 +208,23 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Clam/Clam1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Clam/Clam2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Clam/Clam3"), 1f); } } public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 8, 12); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 0.5f); + DropHelper.DropItem(NPC, ModContent.ItemType(), 8, 12); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 0.5f); } } } diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index b3c6293344..cdb838f438 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -16,167 +16,167 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { DisplayName.SetDefault("Eutrophic Ray"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.damage = 20; - npc.width = 116; - npc.height = 36; - npc.defense = Main.hardMode ? 15 : 5; - npc.DR_NERD(0.05f); - npc.lifeMax = Main.hardMode ? 500 : 150; - npc.aiStyle = -1; + NPC.damage = 20; + NPC.width = 116; + NPC.height = 36; + NPC.defense = Main.hardMode ? 15 : 5; + NPC.DR_NERD(0.05f); + NPC.lifeMax = Main.hardMode ? 500 : 150; + NPC.aiStyle = -1; aiType = -1; - npc.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath55; - npc.knockBackResist = 0f; - banner = npc.type; + NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath55; + NPC.knockBackResist = 0f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); writer.Write(hasBeenHit); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); hasBeenHit = reader.ReadBoolean(); } public override void AI() { - npc.TargetClosest(true); - if (npc.velocity.X > 0.25f) + NPC.TargetClosest(true); + if (NPC.velocity.X > 0.25f) { - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } - else if (npc.velocity.X < 0.25f) + else if (NPC.velocity.X < 0.25f) { - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } - if (npc.justHit && !hasBeenHit) + if (NPC.justHit && !hasBeenHit) { hasBeenHit = true; - npc.damage = Main.expertMode ? 40 : 20; + NPC.damage = Main.expertMode ? 40 : 20; if (Main.hardMode) { - npc.damage = Main.expertMode ? 100 : 50; + NPC.damage = Main.expertMode ? 100 : 50; } - npc.noTileCollide = true; - npc.noGravity = true; - if (npc.Center.X < Main.player[npc.target].Center.X) + NPC.noTileCollide = true; + NPC.noGravity = true; + if (NPC.Center.X < Main.player[NPC.target].Center.X) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } else { - npc.ai[0] = 2f; + NPC.ai[0] = 2f; } } - npc.chaseable = hasBeenHit; + NPC.chaseable = hasBeenHit; if (hasBeenHit) { float AccelerationY = Main.hardMode ? 0.4f : 0.2f; float MaxSpeedY = Main.hardMode ? 4f : 2.5f; float Rotation = 0; - if ((npc.Center.Y + 0.4f) > Main.player[npc.target].Center.Y) + if ((NPC.Center.Y + 0.4f) > Main.player[NPC.target].Center.Y) { - npc.velocity.Y -= AccelerationY; - if (npc.velocity.Y < -MaxSpeedY) + NPC.velocity.Y -= AccelerationY; + if (NPC.velocity.Y < -MaxSpeedY) { - npc.velocity.Y = -MaxSpeedY; + NPC.velocity.Y = -MaxSpeedY; } } - else if ((npc.Center.Y - 0.4f) < Main.player[npc.target].Center.Y) + else if ((NPC.Center.Y - 0.4f) < Main.player[NPC.target].Center.Y) { - npc.velocity.Y += AccelerationY; - if (npc.velocity.Y > MaxSpeedY) + NPC.velocity.Y += AccelerationY; + if (NPC.velocity.Y > MaxSpeedY) { - npc.velocity.Y = MaxSpeedY; + NPC.velocity.Y = MaxSpeedY; } } float AccelerationX = Main.hardMode ? 0.4f : 0.25f; float MaxSpeedX = Main.hardMode ? 6f : 4f; - if (npc.ai[0] == 1f) + if (NPC.ai[0] == 1f) { Rotation = -0.05f; - npc.velocity.X -= AccelerationX; - if (npc.velocity.X < -MaxSpeedX) + NPC.velocity.X -= AccelerationX; + if (NPC.velocity.X < -MaxSpeedX) { - npc.velocity.X = -MaxSpeedX; + NPC.velocity.X = -MaxSpeedX; } - if ((npc.Center.X + 300f) < Main.player[npc.target].Center.X) + if ((NPC.Center.X + 300f) < Main.player[NPC.target].Center.X) { - npc.ai[0] = 2f; + NPC.ai[0] = 2f; } } - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { Rotation = 0.05f; - npc.velocity.X += AccelerationX; - if (npc.velocity.X > MaxSpeedX) + NPC.velocity.X += AccelerationX; + if (NPC.velocity.X > MaxSpeedX) { - npc.velocity.X = MaxSpeedX; + NPC.velocity.X = MaxSpeedX; } - if ((npc.Center.X - 300f) > Main.player[npc.target].Center.X) + if ((NPC.Center.X - 300f) > Main.player[NPC.target].Center.X) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } - npc.rotation = npc.velocity.Y * Rotation; - if (npc.rotation < -0.1f) + NPC.rotation = NPC.velocity.Y * Rotation; + if (NPC.rotation < -0.1f) { - npc.rotation = -0.1f; + NPC.rotation = -0.1f; } - if (npc.rotation > 0.1f) + if (NPC.rotation > 0.1f) { - npc.rotation = 0.1f; + NPC.rotation = 0.1f; return; } } else { - npc.damage = 0; + NPC.damage = 0; } } public override void FindFrame(int frameHeight) { - npc.frameCounter += hasBeenHit ? 0.15f : 0f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += hasBeenHit ? 0.15f : 0f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/EutrophicRayGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override bool? CanBeHitByProjectile(Projectile projectile) @@ -190,7 +190,7 @@ namespace CalamityMod.NPCs.SunkenSea public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.Player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } @@ -199,25 +199,25 @@ namespace CalamityMod.NPCs.SunkenSea public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 3, 1, 1); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/EutrophicRay/RayGore1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/EutrophicRay/RayGore2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/EutrophicRay/RayGore3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/EutrophicRay/RayGore4"), 1f); } } } diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index fb515ad0a4..fc78ac1045 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -17,102 +17,102 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { DisplayName.SetDefault("Ghost Bell"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.noGravity = true; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.aiStyle = -1; aiType = -1; - npc.damage = Main.hardMode ? 75 : 25; - npc.width = 54; - npc.height = 76; - npc.defense = Main.hardMode ? 10 : 0; - npc.lifeMax = Main.hardMode ? 400 : 120; - npc.knockBackResist = 0f; - npc.alpha = 100; - npc.value = Main.hardMode ? Item.buyPrice(0, 0, 20, 0) : Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit25; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; + NPC.damage = Main.hardMode ? 75 : 25; + NPC.width = 54; + NPC.height = 76; + NPC.defense = Main.hardMode ? 10 : 0; + NPC.lifeMax = Main.hardMode ? 400 : 120; + NPC.knockBackResist = 0f; + NPC.alpha = 100; + NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 20, 0) : Item.buyPrice(0, 0, 2, 0); + NPC.HitSound = SoundID.NPCHit25; + NPC.DeathSound = SoundID.NPCDeath28; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = false; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = false; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); writer.Write(hasBeenHit); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); hasBeenHit = reader.ReadBoolean(); } public override void AI() { - Lighting.AddLight(npc.Center, 0f, (255 - npc.alpha) * 1.5f / 255f, (255 - npc.alpha) * 1.5f / 255f); - if (npc.justHit) + Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 1.5f / 255f, (255 - NPC.alpha) * 1.5f / 255f); + if (NPC.justHit) { hasBeenHit = true; } - npc.chaseable = hasBeenHit; - if (npc.localAI[0] == 0f) + NPC.chaseable = hasBeenHit; + if (NPC.localAI[0] == 0f) { - npc.localAI[0] = 1f; - npc.velocity.Y = -6f; - npc.netUpdate = true; + NPC.localAI[0] = 1f; + NPC.velocity.Y = -6f; + NPC.netUpdate = true; } - if (npc.wet) + if (NPC.wet) { - npc.noGravity = true; - if (npc.localAI[2] > 0f) + NPC.noGravity = true; + if (NPC.localAI[2] > 0f) { - npc.localAI[2] -= 1f; + NPC.localAI[2] -= 1f; } - if (npc.localAI[2] <= 0f) + if (NPC.localAI[2] <= 0f) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.localAI[1] += 1f; + NPC.localAI[1] += 1f; } else { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; } - npc.velocity.Y += 0.1f; - if (npc.velocity.Y > 3f || npc.localAI[1] >= 6f) + NPC.velocity.Y += 0.1f; + if (NPC.velocity.Y > 3f || NPC.localAI[1] >= 6f) { - npc.velocity.Y = -3f; + NPC.velocity.Y = -3f; } } } else { - npc.noGravity = false; - npc.velocity.Y = 2f; - npc.localAI[2] = 75f; - npc.netUpdate = true; + NPC.noGravity = false; + NPC.velocity.Y = 2f; + NPC.localAI[2] = 75f; + NPC.netUpdate = true; } } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.1f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.Player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.9f; } @@ -122,18 +122,18 @@ namespace CalamityMod.NPCs.SunkenSea public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/GhostBellGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/GhostBellGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/GhostBellGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -145,21 +145,21 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } } } public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 0.2f); - DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, 0.01f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 0.2f); + DropHelper.DropItemChance(NPC, ItemID.JellyfishNecklace, 0.01f); } } } diff --git a/NPCs/SunkenSea/GhostBellSmall.cs b/NPCs/SunkenSea/GhostBellSmall.cs index 1248dcf7cd..da6cd4cad8 100644 --- a/NPCs/SunkenSea/GhostBellSmall.cs +++ b/NPCs/SunkenSea/GhostBellSmall.cs @@ -16,56 +16,56 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { DisplayName.SetDefault("Baby Ghost Bell"); - Main.npcFrameCount[npc.type] = 4; - Main.npcCatchable[npc.type] = true; + Main.npcFrameCount[NPC.type] = 4; + Main.npcCatchable[NPC.type] = true; } public override void SetDefaults() { - npc.npcSlots = 0.1f; - npc.noGravity = true; - npc.chaseable = false; - npc.aiStyle = -1; + NPC.npcSlots = 0.1f; + NPC.noGravity = true; + NPC.chaseable = false; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 0; - npc.width = 28; - npc.height = 36; - npc.defense = 0; - npc.lifeMax = 5; - npc.knockBackResist = 1f; - npc.alpha = 100; - npc.HitSound = SoundID.NPCHit25; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; + NPC.damage = 0; + NPC.width = 28; + NPC.height = 36; + NPC.defense = 0; + NPC.lifeMax = 5; + NPC.knockBackResist = 1f; + NPC.alpha = 100; + NPC.HitSound = SoundID.NPCHit25; + NPC.DeathSound = SoundID.NPCDeath28; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.catchItem = (short)ModContent.ItemType(); + NPC.catchItem = (short)ModContent.ItemType(); } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); writer.Write(hasBeenHit); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); hasBeenHit = reader.ReadBoolean(); } public override void AI() { - if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { if (Main.rand.NextBool(20)) - npc.catchItem = (short)ModContent.ItemType(); - npc.localAI[0] = 1f; - npc.velocity.Y = -3f; - npc.netUpdate = true; + NPC.catchItem = (short)ModContent.ItemType(); + NPC.localAI[0] = 1f; + NPC.velocity.Y = -3f; + NPC.netUpdate = true; } - if (Main.rand.Next(8) < 1 && npc.catchItem == (short)ModContent.ItemType()) + if (Main.rand.Next(8) < 1 && NPC.catchItem == (short)ModContent.ItemType()) { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 68, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 200, default, 1f); + int dust = Dust.NewDust(NPC.position - new Vector2(2f, 2f), NPC.width + 4, NPC.height + 4, 68, NPC.velocity.X * 0.4f, NPC.velocity.Y * 0.4f, 200, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.1f; Main.dust[dust].velocity.Y += 0.25f; @@ -76,22 +76,22 @@ namespace CalamityMod.NPCs.SunkenSea Main.dust[dust].scale *= 0.5f; } } - Lighting.AddLight(npc.Center, 0f, (255 - npc.alpha) * 1f / 255f, (255 - npc.alpha) * 1f / 255f); - if (npc.wet) + Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 1f / 255f, (255 - NPC.alpha) * 1f / 255f); + if (NPC.wet) { - npc.noGravity = true; - if (npc.velocity.Y < 0f) + NPC.noGravity = true; + if (NPC.velocity.Y < 0f) { - npc.velocity.Y += 0.1f; + NPC.velocity.Y += 0.1f; } - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = 0f; + NPC.velocity.Y = 0f; } } else { - npc.noGravity = false; + NPC.noGravity = false; } } @@ -106,15 +106,15 @@ namespace CalamityMod.NPCs.SunkenSea public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.Player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 1.5f; } @@ -124,31 +124,31 @@ namespace CalamityMod.NPCs.SunkenSea public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/GhostBellSmallGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/GhostBellSmallGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/GhostBellSmallGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellSmallGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellSmallGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/GhostBellSmallGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 2; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index ede86e92d8..e0a1ce1f2a 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -17,6 +17,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.SunkenSea { [AutoloadBossHead] @@ -32,32 +33,32 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { DisplayName.SetDefault("Giant Clam"); - Main.npcFrameCount[npc.type] = 12; + Main.npcFrameCount[NPC.type] = 12; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.lavaImmune = true; - npc.npcSlots = 5f; - npc.damage = 50; - npc.width = 160; - npc.height = 120; - npc.defense = 9999; - npc.DR_NERD(0.3f); - npc.lifeMax = Main.hardMode ? 7500 : 1250; - npc.aiStyle = -1; + NPC.Calamity().canBreakPlayerDefense = true; + NPC.lavaImmune = true; + NPC.npcSlots = 5f; + NPC.damage = 50; + NPC.width = 160; + NPC.height = 120; + NPC.defense = 9999; + NPC.DR_NERD(0.3f); + NPC.lifeMax = Main.hardMode ? 7500 : 1250; + NPC.aiStyle = -1; aiType = -1; - npc.value = Main.hardMode ? Item.buyPrice(0, 8, 0, 0) : Item.buyPrice(0, 1, 0, 0); - npc.HitSound = SoundID.NPCHit4; - npc.knockBackResist = 0f; - npc.rarity = 2; - banner = npc.type; + NPC.value = Main.hardMode ? Item.buyPrice(0, 8, 0, 0) : Item.buyPrice(0, 1, 0, 0); + NPC.HitSound = SoundID.NPCHit4; + NPC.knockBackResist = 0f; + NPC.rarity = 2; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) @@ -65,8 +66,8 @@ namespace CalamityMod.NPCs.SunkenSea writer.Write(hitAmount); writer.Write(attack); writer.Write(attackAnim); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.chaseable); writer.Write(hasBeenHit); writer.Write(statChange); writer.Write(hide); @@ -77,8 +78,8 @@ namespace CalamityMod.NPCs.SunkenSea hitAmount = reader.ReadInt32(); attack = reader.ReadInt32(); attackAnim = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); hasBeenHit = reader.ReadBoolean(); statChange = reader.ReadBoolean(); hide = reader.ReadBoolean(); @@ -86,42 +87,42 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { - npc.TargetClosest(true); - Player player = Main.player[npc.target]; - if (npc.justHit && hitAmount < 5) + NPC.TargetClosest(true); + Player player = Main.player[NPC.target]; + if (NPC.justHit && hitAmount < 5) { ++hitAmount; hasBeenHit = true; } - npc.chaseable = hasBeenHit; + NPC.chaseable = hasBeenHit; if (hitAmount == 5) { if (Main.netMode != NetmodeID.Server) { - if (!Main.player[npc.target].dead && Main.player[npc.target].active) + if (!Main.player[NPC.target].dead && Main.player[NPC.target].active) { player.AddBuff(ModContent.BuffType(), 2); //CLAM INVASION } } if (!hide) - Lighting.AddLight(npc.Center, 0f, (255 - npc.alpha) * 2.5f / 255f, (255 - npc.alpha) * 2.5f / 255f); + Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 2.5f / 255f, (255 - NPC.alpha) * 2.5f / 255f); if (!statChange) { - npc.defense = 10; - npc.damage = Main.expertMode ? 100 : 50; + NPC.defense = 10; + NPC.damage = Main.expertMode ? 100 : 50; if (Main.hardMode) { - npc.defense = 35; - npc.damage = Main.expertMode ? 200 : 100; + NPC.defense = 35; + NPC.damage = Main.expertMode ? 200 : 100; } statChange = true; } - if (npc.ai[0] < 240f) + if (NPC.ai[0] < 240f) { - npc.ai[0] += 1f; + NPC.ai[0] += 1f; hide = false; } else @@ -137,55 +138,55 @@ namespace CalamityMod.NPCs.SunkenSea else if (attack == 0) { hide = true; - npc.defense = 9999; - npc.ai[1] += 1f; - if (npc.ai[1] >= 90f) + NPC.defense = 9999; + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 90f) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; hide = false; attack = -1; - npc.defense = Main.hardMode ? 35 : 10; - NPC.NewNPC((int)(npc.Center.X + 5), (int)npc.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)(npc.Center.X - 5), (int)npc.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.defense = Main.hardMode ? 35 : 10; + NPC.NewNPC((int)(NPC.Center.X + 5), (int)NPC.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)(NPC.Center.X - 5), (int)NPC.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); } } else if (attack == 1) { - if (npc.ai[2] == 0f) + if (NPC.ai[2] == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.TargetClosest(true); - npc.ai[2] = 1f; - npc.netUpdate = true; + NPC.TargetClosest(true); + NPC.ai[2] = 1f; + NPC.netUpdate = true; } } - else if (npc.ai[2] == 1f) + else if (NPC.ai[2] == 1f) { - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.alpha += Main.hardMode ? 8 : 5; - if (npc.alpha >= 255) + NPC.damage = 0; + NPC.chaseable = false; + NPC.dontTakeDamage = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.alpha += Main.hardMode ? 8 : 5; + if (NPC.alpha >= 255) { - npc.alpha = 255; - npc.position.X = player.Center.X - (float)(npc.width / 2); - npc.position.Y = player.Center.Y - (float)(npc.height / 2) + player.gfxOffY - 200f; - npc.position.X = npc.position.X - 15f; - npc.position.Y = npc.position.Y - 100f; - npc.ai[2] = 2f; - npc.netUpdate = true; + NPC.alpha = 255; + NPC.position.X = player.Center.X - (float)(NPC.width / 2); + NPC.position.Y = player.Center.Y - (float)(NPC.height / 2) + player.gfxOffY - 200f; + NPC.position.X = NPC.position.X - 15f; + NPC.position.Y = NPC.position.Y - 100f; + NPC.ai[2] = 2f; + NPC.netUpdate = true; } } - else if (npc.ai[2] == 2f) + else if (NPC.ai[2] == 2f) { if (Main.rand.NextBool(2)) { - int num5 = Dust.NewDust(npc.position, npc.width, npc.height, 226, 0f, 0f, 200, default, 1.5f); + int num5 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 226, 0f, 0f, 200, default, 1.5f); Main.dust[num5].noGravity = true; Main.dust[num5].velocity *= 0.75f; Main.dust[num5].fadeIn = 1.3f; @@ -195,63 +196,63 @@ namespace CalamityMod.NPCs.SunkenSea Main.dust[num5].velocity = vector; vector.Normalize(); vector *= 34f; - Main.dust[num5].position = npc.Center - vector; + Main.dust[num5].position = NPC.Center - vector; } - npc.alpha -= Main.hardMode ? 7 : 4; - if (npc.alpha <= 0) + NPC.alpha -= Main.hardMode ? 7 : 4; + if (NPC.alpha <= 0) { - npc.damage = Main.expertMode ? 100 : 50; + NPC.damage = Main.expertMode ? 100 : 50; if (Main.hardMode) { - npc.damage = Main.expertMode ? 200 : 100; + NPC.damage = Main.expertMode ? 200 : 100; } - npc.chaseable = true; - npc.dontTakeDamage = false; - npc.alpha = 0; - npc.ai[2] = 3f; - npc.netUpdate = true; + NPC.chaseable = true; + NPC.dontTakeDamage = false; + NPC.alpha = 0; + NPC.ai[2] = 3f; + NPC.netUpdate = true; } } - else if (npc.ai[2] == 3f) + else if (NPC.ai[2] == 3f) { - npc.velocity.Y += 0.8f; + NPC.velocity.Y += 0.8f; attackAnim = true; - if (npc.Center.Y > (player.Center.Y - (float)(npc.height / 2) + player.gfxOffY - 15f)) + if (NPC.Center.Y > (player.Center.Y - (float)(NPC.height / 2) + player.gfxOffY - 15f)) { - npc.noTileCollide = false; - npc.ai[2] = 4f; - npc.netUpdate = true; + NPC.noTileCollide = false; + NPC.ai[2] = 4f; + NPC.netUpdate = true; } } - else if (npc.ai[2] == 4f) + else if (NPC.ai[2] == 4f) { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.ai[2] = 0f; - npc.ai[0] = 0f; - npc.netUpdate = true; - npc.noGravity = false; + NPC.ai[2] = 0f; + NPC.ai[0] = 0f; + NPC.netUpdate = true; + NPC.noGravity = false; attack = -1; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)npc.position.X, (int)npc.position.Y); - for (int stompDustArea = (int)npc.position.X - 30; stompDustArea < (int)npc.position.X + npc.width + 60; stompDustArea += 30) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)NPC.position.X, (int)NPC.position.Y); + for (int stompDustArea = (int)NPC.position.X - 30; stompDustArea < (int)NPC.position.X + NPC.width + 60; stompDustArea += 30) { for (int stompDustAmount = 0; stompDustAmount < 5; stompDustAmount++) { - int stompDust = Dust.NewDust(new Vector2(npc.position.X - 30f, npc.position.Y + (float)npc.height), npc.width + 30, 4, 33, 0f, 0f, 100, default, 1.5f); + int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 30f, NPC.position.Y + (float)NPC.height), NPC.width + 30, 4, 33, 0f, 0f, 100, default, 1.5f); Main.dust[stompDust].velocity *= 0.2f; } - int stompGore = Gore.NewGore(new Vector2((float)(stompDustArea - 30), npc.position.Y + (float)npc.height - 12f), default, Main.rand.Next(61, 64), 1f); + int stompGore = Gore.NewGore(new Vector2((float)(stompDustArea - 30), NPC.position.Y + (float)NPC.height - 12f), default, Main.rand.Next(61, 64), 1f); Main.gore[stompGore].velocity *= 0.4f; } } - npc.velocity.Y += 0.8f; + NPC.velocity.Y += 0.8f; } } } - if (npc.ai[3] < 180f && Main.hardMode) + if (NPC.ai[3] < 180f && Main.hardMode) { - npc.ai[3] += 1f; + NPC.ai[3] += 1f; } else if (Main.hardMode) { @@ -261,23 +262,23 @@ namespace CalamityMod.NPCs.SunkenSea } else if (attack == 2) { - Main.PlaySound(SoundID.Item67, npc.position); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + SoundEngine.PlaySound(SoundID.Item67, NPC.position); + Vector2 value9 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(NPC.velocity.X, NPC.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int projectileShot = ModContent.ProjectileType(); int damage = Main.expertMode ? 28 : 35; float speed = 5f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); + Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)(NPC.height / 2)); + float num6 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); + float num7 = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); num8 = speed / num8; num6 *= num8; num7 *= num8; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.Center.X, NPC.Center.Y, num6, num7, projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; @@ -285,13 +286,13 @@ namespace CalamityMod.NPCs.SunkenSea Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 3f), (float)(-Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); } attack = -1; - npc.ai[3] = 0f; + NPC.ai[3] = 0f; } else if (attack == 3) { if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(SoundID.Item68, npc.position); + SoundEngine.PlaySound(SoundID.Item68, NPC.position); int damage = Main.expertMode ? 28 : 35; float shotSpacing = 750f; for (int i = 0; i < 11; i++) @@ -301,7 +302,7 @@ namespace CalamityMod.NPCs.SunkenSea } } attack = -1; - npc.ai[3] = 0f; + NPC.ai[3] = 0f; } } } @@ -309,7 +310,7 @@ namespace CalamityMod.NPCs.SunkenSea public override bool CheckActive() { - return Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f; + return Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f; } public override bool? CanBeHitByProjectile(Projectile projectile) @@ -323,23 +324,23 @@ namespace CalamityMod.NPCs.SunkenSea public override void FindFrame(int frameHeight) { - npc.frameCounter += 1.0; - if (npc.frameCounter > (attackAnim ? 2.0 : 5.0)) + NPC.frameCounter += 1.0; + if (NPC.frameCounter > (attackAnim ? 2.0 : 5.0)) { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + NPC.frame.Y = NPC.frame.Y + frameHeight; } if (hitAmount < 5 || hide) { - npc.frame.Y = frameHeight * 11; + NPC.frame.Y = frameHeight * 11; } else if (attackAnim) { - if (npc.frame.Y < frameHeight * 3) + if (NPC.frame.Y < frameHeight * 3) { - npc.frame.Y = frameHeight * 3; + NPC.frame.Y = frameHeight * 3; } - if (npc.frame.Y > frameHeight * 10) + if (NPC.frame.Y > frameHeight * 10) { hide = true; attackAnim = false; @@ -347,16 +348,16 @@ namespace CalamityMod.NPCs.SunkenSea } else { - if (npc.frame.Y > frameHeight * 3) + if (NPC.frame.Y > frameHeight * 3) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && CalamityWorld.downedDesertScourge && !NPC.AnyNPCs(ModContent.NPCType())) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.water && CalamityWorld.downedDesertScourge && !NPC.AnyNPCs(ModContent.NPCType())) { return SpawnCondition.CaveJellyfish.Chance * 0.24f; } @@ -367,40 +368,40 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam5"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/GiantClam/GiantClam1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/GiantClam/GiantClam2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/GiantClam/GiantClam3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/GiantClam/GiantClam4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/GiantClam/GiantClam5"), 1f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Texture2D texture = Main.npcTexture[npc.type]; - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); + Texture2D texture = Main.npcTexture[NPC.type]; + CalamityMod.DrawTexture(spriteBatch, texture, 0, NPC, drawColor, true); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/GiantClamGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/GiantClamGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/GiantClamGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/GiantClamGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/GiantClamGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/GiantClamGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void NPCLoot() @@ -410,18 +411,18 @@ namespace CalamityMod.NPCs.SunkenSea int amidiasNPC = NPC.FindFirstNPC(ModContent.NPCType()); if (amidiasNPC == -1 && Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); } // Materials - DropHelper.DropItem(npc, ModContent.ItemType(), 25, 35); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 6, 11); + DropHelper.DropItem(NPC, ModContent.ItemType(), 25, 35); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 6, 11); // Weapons if (Main.hardMode) { float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -430,8 +431,8 @@ namespace CalamityMod.NPCs.SunkenSea } // Equipment - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 3, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 3, 1, 1); // Mark Giant Clam as dead CalamityWorld.downedCLAM = true; diff --git a/NPCs/SunkenSea/PrismTurtle.cs b/NPCs/SunkenSea/PrismTurtle.cs index cdf1d3761c..69a470086d 100644 --- a/NPCs/SunkenSea/PrismTurtle.cs +++ b/NPCs/SunkenSea/PrismTurtle.cs @@ -14,124 +14,124 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { DisplayName.SetDefault("Prism-Back"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.noGravity = true; - npc.damage = Main.hardMode ? 40 : 20; //normal damage - npc.width = 72; - npc.height = 58; - npc.defense = Main.hardMode ? 25 : 10; - npc.DR_NERD(0.25f); - npc.lifeMax = Main.hardMode ? 1000 : 350; - npc.aiStyle = -1; + NPC.noGravity = true; + NPC.damage = Main.hardMode ? 40 : 20; //normal damage + NPC.width = 72; + NPC.height = 58; + NPC.defense = Main.hardMode ? 25 : 10; + NPC.DR_NERD(0.25f); + NPC.lifeMax = Main.hardMode ? 1000 : 350; + NPC.aiStyle = -1; aiType = -1; - npc.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit24; - npc.DeathSound = SoundID.NPCDeath27; - npc.knockBackResist = 0.15f; - banner = npc.type; + NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit24; + NPC.DeathSound = SoundID.NPCDeath27; + NPC.knockBackResist = 0.15f; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.chaseable = false; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() { - if ((npc.Center.Y + 10f) > Main.player[npc.target].Center.Y) + if ((NPC.Center.Y + 10f) > Main.player[NPC.target].Center.Y) { if (CalamityWorld.death) //gotta do damage scaling directly { - npc.damage = Main.hardMode ? 240 : 120; + NPC.damage = Main.hardMode ? 240 : 120; } else if (CalamityWorld.revenge) { - npc.damage = Main.hardMode ? 168 : 84; + NPC.damage = Main.hardMode ? 168 : 84; } else if (Main.expertMode) { - npc.damage = Main.hardMode ? 160 : 80; + NPC.damage = Main.hardMode ? 160 : 80; } else { - npc.damage = Main.hardMode ? 80 : 40; + NPC.damage = Main.hardMode ? 80 : 40; } } else { if (CalamityWorld.death) //gotta do damage scaling directly { - npc.damage = Main.hardMode ? 120 : 60; + NPC.damage = Main.hardMode ? 120 : 60; } else if (CalamityWorld.revenge) { - npc.damage = Main.hardMode ? 84 : 42; + NPC.damage = Main.hardMode ? 84 : 42; } else if (Main.expertMode) { - npc.damage = Main.hardMode ? 80 : 40; + NPC.damage = Main.hardMode ? 80 : 40; } else { - npc.damage = Main.hardMode ? 40 : 20; + NPC.damage = Main.hardMode ? 40 : 20; } } - Lighting.AddLight(npc.Center, (255 - npc.alpha) * 0f / 255f, (255 - npc.alpha) * 0.75f / 255f, (255 - npc.alpha) * 0.75f / 255f); - CalamityAI.PassiveSwimmingAI(npc, mod, 2, 0f, 0f, 0f, 0f, 0f, 0.1f); + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); + CalamityAI.PassiveSwimmingAI(NPC, Mod, 2, 0f, 0f, 0f, 0f, 0f, 0.1f); } public override void FindFrame(int frameHeight) { - npc.frameCounter += npc.wet ? 0.1f : 0f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += NPC.wet ? 0.1f : 0f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/PrismTurtleGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/PrismTurtleGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Blue); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/SunkenSea/PrismTurtleGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/PrismTurtleGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/PrismTurtleGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Blue); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/PrismTurtleGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { - return npc.chaseable; + return NPC.chaseable; } return null; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.Player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.9f; } @@ -140,25 +140,25 @@ namespace CalamityMod.NPCs.SunkenSea public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 1, 1, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 1, 1, 3); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore5"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore5"), 1f); for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/SunkenSea/SeaFloaty.cs b/NPCs/SunkenSea/SeaFloaty.cs index 9f1495467e..34ab338131 100644 --- a/NPCs/SunkenSea/SeaFloaty.cs +++ b/NPCs/SunkenSea/SeaFloaty.cs @@ -12,103 +12,103 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { DisplayName.SetDefault("Sea Floaty"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.npcSlots = 0.5f; - npc.aiStyle = -1; + NPC.npcSlots = 0.5f; + NPC.aiStyle = -1; aiType = -1; - npc.damage = 5; - npc.width = 72; - npc.height = 22; - npc.defense = 0; - npc.lifeMax = 50; - npc.knockBackResist = 0.5f; - npc.value = Item.buyPrice(0, 0, 0, 50); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.damage = 5; + NPC.width = 72; + NPC.height = 22; + NPC.defense = 0; + NPC.lifeMax = 50; + NPC.knockBackResist = 0.5f; + NPC.value = Item.buyPrice(0, 0, 0, 50); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.chaseable); + writer.Write(NPC.chaseable); writer.Write(hasBeenHit); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.chaseable = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); hasBeenHit = reader.ReadBoolean(); } public override void AI() { - if (npc.velocity.X > 0.25f) + if (NPC.velocity.X > 0.25f) { - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } - else if (npc.velocity.X < 0.25f) + else if (NPC.velocity.X < 0.25f) { - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.direction = 1; - npc.ai[0] = 1f; + NPC.direction = 1; + NPC.ai[0] = 1f; } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -2.5f || NPC.velocity.X > 2.5f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.collideX) + if (NPC.collideX) { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; + NPC.netUpdate = true; } - if (npc.justHit && !hasBeenHit) + if (NPC.justHit && !hasBeenHit) { hasBeenHit = true; - npc.noTileCollide = true; - npc.noGravity = true; + NPC.noTileCollide = true; + NPC.noGravity = true; } - npc.chaseable = hasBeenHit; + NPC.chaseable = hasBeenHit; if (hasBeenHit) { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X - (float)npc.direction * 0.5f; - npc.velocity.Y = npc.velocity.Y - (float)npc.directionY * 0.3f; - if (npc.velocity.X > 10f) + NPC.TargetClosest(true); + NPC.velocity.X = NPC.velocity.X - (float)NPC.direction * 0.5f; + NPC.velocity.Y = NPC.velocity.Y - (float)NPC.directionY * 0.3f; + if (NPC.velocity.X > 10f) { - npc.velocity.X = 10f; + NPC.velocity.X = 10f; } - if (npc.velocity.X < -10f) + if (NPC.velocity.X < -10f) { - npc.velocity.X = -10f; + NPC.velocity.X = -10f; } - if (npc.velocity.Y > 10f) + if (NPC.velocity.Y > 10f) { - npc.velocity.Y = 10f; + NPC.velocity.Y = 10f; } - if (npc.velocity.Y < -10f) + if (NPC.velocity.Y < -10f) { - npc.velocity.Y = -10f; + NPC.velocity.Y = -10f; } - npc.direction *= -1; - npc.rotation = npc.velocity.X * 0.1f; - if ((double)npc.rotation < -0.3) + NPC.direction *= -1; + NPC.rotation = NPC.velocity.X * 0.1f; + if ((double)NPC.rotation < -0.3) { - npc.rotation = -0.3f; + NPC.rotation = -0.3f; } - if ((double)npc.rotation > 0.3) + if ((double)NPC.rotation > 0.3) { - npc.rotation = 0.3f; + NPC.rotation = 0.3f; return; } } @@ -116,15 +116,15 @@ namespace CalamityMod.NPCs.SunkenSea public override void FindFrame(int frameHeight) { - npc.frameCounter += hasBeenHit ? 0.3f : 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += hasBeenHit ? 0.3f : 0.15f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.Player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.45f; } @@ -135,17 +135,17 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore3"), 1f); } } } diff --git a/NPCs/SunkenSea/SeaMinnow.cs b/NPCs/SunkenSea/SeaMinnow.cs index 13aa25aeac..744e607b09 100644 --- a/NPCs/SunkenSea/SeaMinnow.cs +++ b/NPCs/SunkenSea/SeaMinnow.cs @@ -11,125 +11,125 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { DisplayName.SetDefault("Sea Minnow"); - Main.npcFrameCount[npc.type] = 4; - Main.npcCatchable[npc.type] = true; + Main.npcFrameCount[NPC.type] = 4; + Main.npcCatchable[NPC.type] = true; } public override void SetDefaults() { - npc.npcSlots = 0.1f; - npc.noGravity = true; - npc.damage = 0; - npc.width = 36; - npc.height = 22; - npc.defense = 0; - npc.lifeMax = 5; - npc.aiStyle = -1; + NPC.npcSlots = 0.1f; + NPC.noGravity = true; + NPC.damage = 0; + NPC.width = 36; + NPC.height = 22; + NPC.defense = 0; + NPC.lifeMax = 5; + NPC.aiStyle = -1; aiType = -1; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.chaseable = false; - npc.catchItem = (short)ModContent.ItemType(); + NPC.chaseable = false; + NPC.catchItem = (short)ModContent.ItemType(); } public override void AI() { - CalamityAI.PassiveSwimmingAI(npc, mod, 3, 150f, 0.25f, 0.15f, 6f, 6f, 0.05f); - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - npc.noGravity = true; + CalamityAI.PassiveSwimmingAI(NPC, Mod, 3, 150f, 0.25f, 0.15f, 6f, 6f, 0.05f); + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + NPC.noGravity = true; bool flag14 = false; - if (npc.direction == 0) + if (NPC.direction == 0) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } - if (npc.wet) + if (NPC.wet) { - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - (Main.player[npc.target].Center - npc.Center).Length() < 150f) + NPC.TargetClosest(false); + if (Main.player[NPC.target].wet && !Main.player[NPC.target].dead && + (Main.player[NPC.target].Center - NPC.Center).Length() < 150f) { flag14 = true; } - if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) + if ((!Main.player[NPC.target].wet || Main.player[NPC.target].dead) && flag14) { flag14 = false; } if (!flag14) { - if (npc.collideX || npc.velocity.X == 0f) + if (NPC.collideX || NPC.velocity.X == 0f) { - npc.velocity.X = npc.velocity.X * -3f; - npc.direction *= -1; - npc.netUpdate = true; + NPC.velocity.X = NPC.velocity.X * -3f; + NPC.direction *= -1; + NPC.netUpdate = true; } - if (npc.collideY) + if (NPC.collideY) { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -3f; - npc.directionY = -1; - npc.ai[0] = -1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -3f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - else if (npc.velocity.Y < 0f) + else if (NPC.velocity.Y < 0f) { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } } if (flag14) { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X - (float)npc.direction * 0.25f; - npc.velocity.Y = npc.velocity.Y - (float)npc.directionY * 0.15f; - if (npc.velocity.X > 6f) + NPC.TargetClosest(true); + NPC.velocity.X = NPC.velocity.X - (float)NPC.direction * 0.25f; + NPC.velocity.Y = NPC.velocity.Y - (float)NPC.directionY * 0.15f; + if (NPC.velocity.X > 6f) { - npc.velocity.X = 6f; + NPC.velocity.X = 6f; } - if (npc.velocity.X < -6f) + if (NPC.velocity.X < -6f) { - npc.velocity.X = -6f; + NPC.velocity.X = -6f; } - if (npc.velocity.Y > 6f) + if (NPC.velocity.Y > 6f) { - npc.velocity.Y = 6f; + NPC.velocity.Y = 6f; } - if (npc.velocity.Y < -6f) + if (NPC.velocity.Y < -6f) { - npc.velocity.Y = -6f; + NPC.velocity.Y = -6f; } - npc.direction *= -1; + NPC.direction *= -1; } else { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -2.5f || NPC.velocity.X > 2.5f) { - npc.velocity.X = npc.velocity.X * 0.95f; + NPC.velocity.X = NPC.velocity.X * 0.95f; } - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) { - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num258 = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int num259 = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; if (Main.tile[num258, num259 - 1] == null) { Main.tile[num258, num259 - 1] = new Tile(); @@ -146,63 +146,63 @@ namespace CalamityMod.NPCs.SunkenSea { if (Main.tile[num258, num259 + 1].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } else if (Main.tile[num258, num259 + 2].active()) { - npc.ai[0] = -1f; + NPC.ai[0] = -1f; } } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) { - npc.velocity.Y = npc.velocity.Y * 0.95f; + NPC.velocity.Y = NPC.velocity.Y * 0.95f; } } else { - if (npc.velocity.Y == 0f) + if (NPC.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + NPC.velocity.X = NPC.velocity.X * 0.94f; + if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) { - npc.velocity.X = 0f; + NPC.velocity.X = 0f; } } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 10f) + NPC.velocity.Y = NPC.velocity.Y + 0.3f; + if (NPC.velocity.Y > 10f) { - npc.velocity.Y = 10f; + NPC.velocity.Y = 10f; } - npc.ai[0] = 1f; + NPC.ai[0] = 1f; } - npc.rotation = npc.velocity.X * 0.05f; - if ((double)npc.rotation < -0.1) + NPC.rotation = NPC.velocity.X * 0.05f; + if ((double)NPC.rotation < -0.1) { - npc.rotation = -0.1f; + NPC.rotation = -0.1f; } - if ((double)npc.rotation > 0.1) + if ((double)NPC.rotation > 0.1) { - npc.rotation = 0.1f; + NPC.rotation = 0.1f; return; } } public override void FindFrame(int frameHeight) { - if (!npc.wet) + if (!NPC.wet) { - npc.frameCounter = 0.0; + NPC.frameCounter = 0.0; return; } - npc.frameCounter += 0.075f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + NPC.frameCounter += 0.075f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.water && !spawnInfo.Player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } @@ -213,7 +213,7 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/SunkenSea/SeaSerpent1.cs b/NPCs/SunkenSea/SeaSerpent1.cs index 73dab45d26..41681ecddd 100644 --- a/NPCs/SunkenSea/SeaSerpent1.cs +++ b/NPCs/SunkenSea/SeaSerpent1.cs @@ -21,66 +21,66 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { - npc.damage = 50; - npc.width = 50; //42 - npc.height = 24; //32 - npc.defense = 10; - npc.lifeMax = 3000; - npc.aiStyle = -1; + NPC.damage = 50; + NPC.width = 50; //42 + NPC.height = 24; //32 + NPC.defense = 10; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 20, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - banner = npc.type; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + banner = NPC.type; bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override void AI() { - Lighting.AddLight(npc.Center, (255 - npc.alpha) * 0f / 255f, (255 - npc.alpha) * 0.30f / 255f, (255 - npc.alpha) * 0.30f / 255f); - if (npc.ai[2] > 0f) + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + if (NPC.ai[2] > 0f) { - npc.realLife = (int)npc.ai[2]; + NPC.realLife = (int)NPC.ai[2]; } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead) { - npc.TargetClosest(true); + NPC.TargetClosest(true); } if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!TailSpawned && npc.ai[0] == 0f) + if (!TailSpawned && NPC.ai[0] == 0f) { - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; for (int segment = 0; segment < maxLength; segment++) { int lol = 0; if (segment == 0 || segment == 1 || segment == 4 || segment == 5) { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } else if (segment == 2 || segment == 3 || segment == 6) { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } else if (segment == 7) { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } else if (segment == 8) { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = (float)NPC.whoAmI; Main.npc[lol].ai[1] = (float)Previous; Main.npc[Previous].ai[0] = (float)lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); @@ -89,44 +89,44 @@ namespace CalamityMod.NPCs.SunkenSea TailSpawned = true; } } - if (npc.velocity.X < 0f) + if (NPC.velocity.X < 0f) { - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } - else if (npc.velocity.X > 0f) + else if (NPC.velocity.X > 0f) { - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } - if (Main.player[npc.target].dead) + if (Main.player[NPC.target].dead) { - npc.TargetClosest(false); + NPC.TargetClosest(false); } - npc.alpha -= 42; - if (npc.alpha < 0) + NPC.alpha -= 42; + if (NPC.alpha < 0) { - npc.alpha = 0; + NPC.alpha = 0; } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f) + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) { - npc.active = false; + NPC.active = false; } float num188 = speed; float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - if (npc.life > npc.lifeMax * 0.99) + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + if (NPC.life > NPC.lifeMax * 0.99) { num192 += 300; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) + if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 250f) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - num191 = Main.player[npc.target].Center.X + 300f; + num191 = Main.player[NPC.target].Center.X + 300f; } else { - num191 = Main.player[npc.target].Center.X - 300f; + num191 = Main.player[NPC.target].Center.X - 300f; } } } @@ -137,18 +137,18 @@ namespace CalamityMod.NPCs.SunkenSea } float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); + float num50 = NPC.velocity.Length(); if (num50 > 0f) { if (num50 > num48) { - npc.velocity.Normalize(); - npc.velocity *= num48; + NPC.velocity.Normalize(); + NPC.velocity *= num48; } else if (num50 < num49) { - npc.velocity.Normalize(); - npc.velocity *= num49; + NPC.velocity.Normalize(); + NPC.velocity *= num49; } } num191 = (float)((int)(num191 / 16f) * 16); @@ -163,50 +163,50 @@ namespace CalamityMod.NPCs.SunkenSea float num198 = num188 / num193; num191 *= num198; num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - if (npc.velocity.X > num191) + if (NPC.velocity.X > num191) { - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - if (npc.velocity.Y > num192) + if (NPC.velocity.Y > num192) { - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num189 * 2f; } else { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 2f; } } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X + num189 * 2f; //changed from 2 } else { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X - num189 * 2f; //changed from 2 } } } @@ -214,56 +214,56 @@ namespace CalamityMod.NPCs.SunkenSea { if (num196 > num197) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X + num189 * 1.1f; //changed from 1.1 } - else if (npc.velocity.X > num191) + else if (NPC.velocity.X > num191) { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X - num189 * 1.1f; //changed from 1.1 } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)num188 * 0.5) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } } else { - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + num189 * 1.1f; } - else if (npc.velocity.Y > num192) + else if (NPC.velocity.Y > num192) { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 1.1f; } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)num188 * 0.5) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } } } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (Main.hardMode && spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && - !NPC.AnyNPCs(ModContent.NPCType()) && !spawnInfo.player.Calamity().clamity && !spawnInfo.playerSafe) + if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.water && + !NPC.AnyNPCs(ModContent.NPCType()) && !spawnInfo.Player.Calamity().clamity && !spawnInfo.playerSafe) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } @@ -272,22 +272,22 @@ namespace CalamityMod.NPCs.SunkenSea public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.25f); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.25f); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore1"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore1"), 1f); } } } diff --git a/NPCs/SunkenSea/SeaSerpent2.cs b/NPCs/SunkenSea/SeaSerpent2.cs index 7babac0900..3e942d0f88 100644 --- a/NPCs/SunkenSea/SeaSerpent2.cs +++ b/NPCs/SunkenSea/SeaSerpent2.cs @@ -17,29 +17,29 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { - npc.damage = 40; - npc.width = 24; //42 - npc.height = 16; //24 - npc.defense = 20; - npc.lifeMax = 3000; - npc.aiStyle = -1; //new + NPC.damage = 40; + NPC.width = 24; //42 + NPC.height = 16; //24 + NPC.defense = 20; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -49,10 +49,10 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { - Lighting.AddLight(npc.Center, (255 - npc.alpha) * 0f / 255f, (255 - npc.alpha) * 0.30f / 255f, (255 - npc.alpha) * 0.30f / 255f); + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -66,29 +66,29 @@ namespace CalamityMod.NPCs.SunkenSea } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -96,30 +96,30 @@ namespace CalamityMod.NPCs.SunkenSea num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } @@ -137,15 +137,15 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore2"), 1f); } } } diff --git a/NPCs/SunkenSea/SeaSerpent3.cs b/NPCs/SunkenSea/SeaSerpent3.cs index 7b037fb5ca..20a2469208 100644 --- a/NPCs/SunkenSea/SeaSerpent3.cs +++ b/NPCs/SunkenSea/SeaSerpent3.cs @@ -14,29 +14,29 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { - npc.damage = 40; - npc.width = 24; //42 - npc.height = 16; //24 - npc.defense = 20; - npc.lifeMax = 3000; - npc.aiStyle = -1; //new + NPC.damage = 40; + NPC.width = 24; //42 + NPC.height = 16; //24 + NPC.defense = 20; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -46,10 +46,10 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { - Lighting.AddLight(npc.Center, (255 - npc.alpha) * 0f / 255f, (255 - npc.alpha) * 0.30f / 255f, (255 - npc.alpha) * 0.30f / 255f); + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -63,29 +63,29 @@ namespace CalamityMod.NPCs.SunkenSea } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -93,30 +93,30 @@ namespace CalamityMod.NPCs.SunkenSea num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } @@ -134,15 +134,15 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore3"), 1f); } } } diff --git a/NPCs/SunkenSea/SeaSerpent4.cs b/NPCs/SunkenSea/SeaSerpent4.cs index 298649eb47..96a9d74410 100644 --- a/NPCs/SunkenSea/SeaSerpent4.cs +++ b/NPCs/SunkenSea/SeaSerpent4.cs @@ -14,29 +14,29 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { - npc.damage = 30; - npc.width = 28; //42 - npc.height = 24; //34 - npc.defense = 20; - npc.lifeMax = 3000; - npc.aiStyle = -1; //new + NPC.damage = 30; + NPC.width = 28; //42 + NPC.height = 24; //34 + NPC.defense = 20; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -46,10 +46,10 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { - Lighting.AddLight(npc.Center, (255 - npc.alpha) * 0f / 255f, (255 - npc.alpha) * 0.30f / 255f, (255 - npc.alpha) * 0.30f / 255f); + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -63,29 +63,29 @@ namespace CalamityMod.NPCs.SunkenSea } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -93,30 +93,30 @@ namespace CalamityMod.NPCs.SunkenSea num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } @@ -134,15 +134,15 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore4"), 1f); } } } diff --git a/NPCs/SunkenSea/SeaSerpent5.cs b/NPCs/SunkenSea/SeaSerpent5.cs index 53637965f5..2eb54b27f2 100644 --- a/NPCs/SunkenSea/SeaSerpent5.cs +++ b/NPCs/SunkenSea/SeaSerpent5.cs @@ -14,29 +14,29 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { - npc.damage = 20; - npc.width = 36; //42 - npc.height = 30; //40 - npc.defense = 30; - npc.lifeMax = 3000; - npc.aiStyle = -1; //new + NPC.damage = 20; + NPC.width = 36; //42 + NPC.height = 30; //40 + NPC.defense = 30; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = true; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -46,10 +46,10 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { - Lighting.AddLight(npc.Center, (255 - npc.alpha) * 0f / 255f, (255 - npc.alpha) * 0.30f / 255f, (255 - npc.alpha) * 0.30f / 255f); + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; // Check if other segments are still alive, if not, die bool shouldDespawn = true; @@ -63,29 +63,29 @@ namespace CalamityMod.NPCs.SunkenSea } if (!shouldDespawn) { - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0) shouldDespawn = true; } if (shouldDespawn) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)NPC.ai[1]].alpha < 128) { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); @@ -93,30 +93,30 @@ namespace CalamityMod.NPCs.SunkenSea num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - npc.spriteDirection = -1; + NPC.spriteDirection = -1; else if (num191 > 0f) - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } @@ -134,15 +134,15 @@ namespace CalamityMod.NPCs.SunkenSea { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 37, hitDirection, -1f, 0, default, 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore5"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore5"), 1f); } } } diff --git a/NPCs/SupremeCalamitas/BrimstoneHeart.cs b/NPCs/SupremeCalamitas/BrimstoneHeart.cs index 89b3e4ee9a..133b4b521c 100644 --- a/NPCs/SupremeCalamitas/BrimstoneHeart.cs +++ b/NPCs/SupremeCalamitas/BrimstoneHeart.cs @@ -14,33 +14,33 @@ namespace CalamityMod.NPCs.SupremeCalamitas public class BrimstoneHeart : ModNPC { public PrimitiveTrail ChainDrawer = null; - public int ChainHeartIndex => (int)npc.ai[0]; + public int ChainHeartIndex => (int)NPC.ai[0]; public List ChainEndpoints = new List(); public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Heart"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[NPC.type] = 6; } public override void SetDefaults() { - npc.damage = 0; - npc.width = 24; - npc.height = 24; - npc.defense = 0; - npc.LifeMaxNERB(24550, 29440, 10000); - npc.aiStyle = -1; + NPC.damage = 0; + NPC.width = 24; + NPC.height = 24; + NPC.defense = 0; + NPC.LifeMaxNERB(24550, 29440, 10000); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.hide = true; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath1; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.hide = true; + NPC.HitSound = SoundID.NPCHit13; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; } public override void SendExtraAI(BinaryWriter writer) @@ -62,23 +62,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; } public override void NPCLoot() { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(4) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } } @@ -87,7 +87,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float widthInterpolant = Utils.InverseLerp(0f, 0.16f, completionRatio, true) * Utils.InverseLerp(1f, 0.84f, completionRatio, true); widthInterpolant = (float)Math.Pow(widthInterpolant, 8D); float baseWidth = MathHelper.Lerp(4f, 1f, widthInterpolant); - float pulseWidth = MathHelper.Lerp(0f, 3.2f, (float)Math.Pow(Math.Sin(Main.GlobalTime * 2.6f + npc.whoAmI * 1.3f + completionRatio), 16D)); + float pulseWidth = MathHelper.Lerp(0f, 3.2f, (float)Math.Pow(Math.Sin(Main.GlobalTime * 2.6f + NPC.whoAmI * 1.3f + completionRatio), 16D)); return baseWidth + pulseWidth; } @@ -99,10 +99,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void FindFrame(int frameHeight) { - int frame = (int)Math.Round((float)Math.Pow(Math.Sin(Main.GlobalTime * 2.6f + npc.whoAmI * 1.3f), 6D) * Main.npcFrameCount[npc.type]); - if (frame >= Main.npcFrameCount[npc.type]) - frame = Main.npcFrameCount[npc.type] - 1; - npc.frame.Y = frame * frameHeight; + int frame = (int)Math.Round((float)Math.Pow(Math.Sin(Main.GlobalTime * 2.6f + NPC.whoAmI * 1.3f), 6D) * Main.npcFrameCount[NPC.type]); + if (frame >= Main.npcFrameCount[NPC.type]) + frame = Main.npcFrameCount[NPC.type] - 1; + NPC.frame.Y = frame * frameHeight; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) @@ -113,8 +113,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas { List points = new List() { - npc.Center, - ChainEndpoints[i] + npc.DirectionTo(ChainEndpoints[i]) * 25f + NPC.Center, + ChainEndpoints[i] + NPC.DirectionTo(ChainEndpoints[i]) * 25f }; ChainDrawer.Draw(points, -Main.screenPosition, 40); } @@ -126,7 +126,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { for (int i = 0; i < 70; i++) { - Vector2 dustSpawnPosition = Vector2.Lerp(npc.Center, ChainEndpoints[tendrilIndex], i / 70f); + Vector2 dustSpawnPosition = Vector2.Lerp(NPC.Center, ChainEndpoints[tendrilIndex], i / 70f); Dust blood = Dust.NewDustDirect(dustSpawnPosition, 4, 4, DustID.Blood); blood.velocity = Main.rand.NextVector2Circular(3f, 3f); blood.scale = Main.rand.NextFloat(1f, 1.4f); @@ -135,12 +135,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int i = 1; i <= 2; i++) { Vector2 heartGoreVelocity = new Vector2((i == 1).ToDirectionInt() * 3f, Main.rand.NextFloat(-2f, 0f)); - Gore.NewGorePerfect(npc.Center, heartGoreVelocity, mod.GetGoreSlot($"Gores/SupremeCalamitas/BrimstoneHeart_Gore{i}"), npc.scale); + Gore.NewGorePerfect(NPC.Center, heartGoreVelocity, Mod.GetGoreSlot($"Gores/SupremeCalamitas/BrimstoneHeart_Gore{i}"), NPC.scale); } for (int i = 0; i < ChainEndpoints.Count; i++) TendrilDestructionEffects(i); diff --git a/NPCs/SupremeCalamitas/SCalWormArm.cs b/NPCs/SupremeCalamitas/SCalWormArm.cs index 0232c2878a..b6ebfc7a1f 100644 --- a/NPCs/SupremeCalamitas/SCalWormArm.cs +++ b/NPCs/SupremeCalamitas/SCalWormArm.cs @@ -33,28 +33,28 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - public NPC SegmentToAttachTo => Main.npc[(int)npc.ai[0]]; + public NPC SegmentToAttachTo => Main.npc[(int)NPC.ai[0]]; public bool CurrentlyMoving { - get => npc.ai[1] == 1f; - set => npc.ai[1] = value.ToInt(); + get => NPC.ai[1] == 1f; + set => NPC.ai[1] = value.ToInt(); } public Vector2 MoveDestination { - get => new Vector2(npc.ai[2], npc.ai[3]); + get => new Vector2(NPC.ai[2], NPC.ai[3]); set { - npc.ai[2] = value.X; - npc.ai[3] = value.Y; + NPC.ai[2] = value.X; + NPC.ai[3] = value.Y; } } - public ref float Time => ref npc.localAI[0]; + public ref float Time => ref NPC.localAI[0]; public bool ReelingBack { - get => npc.localAI[1] == 0f; - set => npc.localAI[1] = 1f - value.ToInt(); + get => NPC.localAI[1] == 0f; + set => NPC.localAI[1] = 1f - value.ToInt(); } - public Player Target => Main.player[npc.target]; + public Player Target => Main.player[NPC.target]; public SepulcherArmLimb[] Limbs = new SepulcherArmLimb[4]; public override void SetStaticDefaults() @@ -64,78 +64,78 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SetDefaults() { - npc.damage = 0; - npc.npcSlots = 5f; - npc.width = 34; - npc.height = 48; - npc.defense = 0; - CalamityGlobalNPC global = npc.Calamity(); + NPC.damage = 0; + NPC.npcSlots = 5f; + NPC.width = 34; + NPC.height = 48; + NPC.defense = 0; + CalamityGlobalNPC global = NPC.Calamity(); global.DR = 0.999999f; global.unbreakableDR = true; - npc.lifeMax = CalamityWorld.revenge ? 345000 : 300000; - npc.aiStyle = aiType = -1; - npc.knockBackResist = 0f; - npc.scale = Main.expertMode ? 1.35f : 1.2f; - npc.dontTakeDamage = true; - npc.alpha = 255; - npc.chaseable = false; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.lifeMax = CalamityWorld.revenge ? 345000 : 300000; + NPC.aiStyle = aiType = -1; + NPC.knockBackResist = 0f; + NPC.scale = Main.expertMode ? 1.35f : 1.2f; + NPC.dontTakeDamage = true; + NPC.alpha = 255; + NPC.chaseable = false; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.netAlways = true; + NPC.dontCountMe = true; for (int i = 0; i < Limbs.Length; i++) - Limbs[i] = new SepulcherArmLimb(npc.Center, 0f); + Limbs[i] = new SepulcherArmLimb(NPC.Center, 0f); } public override void SendExtraAI(BinaryWriter writer) { for (int i = 0; i < Limbs.Length; i++) Limbs[i].SendData(writer); - writer.Write(npc.rotation); + writer.Write(NPC.rotation); } public override void ReceiveExtraAI(BinaryReader reader) { for (int i = 0; i < Limbs.Length; i++) Limbs[i].ReceiveData(reader); - npc.rotation = reader.ReadSingle(); + NPC.rotation = reader.ReadSingle(); } public override void AI() { // Die if the segment is not present. - if (!Main.npc.IndexInRange((int)npc.ai[0]) || !Main.npc[(int)npc.ai[0]].active) + if (!Main.npc.IndexInRange((int)NPC.ai[0]) || !Main.npc[(int)NPC.ai[0]].active) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); return; } - npc.Opacity = SegmentToAttachTo.Opacity; - npc.TargetClosest(false); + NPC.Opacity = SegmentToAttachTo.Opacity; + NPC.TargetClosest(false); Vector2 idealMovePosition = SegmentToAttachTo.Center; - float sideFactor = MathHelper.Lerp(200f, 18f, Utils.InverseLerp(-0.51f, -0.06f, npc.rotation, true)); - float aheadFactor = MathHelper.Lerp(284f, 680f, Utils.InverseLerp(-0.51f, -0.06f, npc.rotation, true)); - idealMovePosition += (SegmentToAttachTo.rotation + npc.rotation * npc.direction - MathHelper.PiOver2).ToRotationVector2() * npc.scale * aheadFactor; - idealMovePosition += (SegmentToAttachTo.rotation + npc.rotation * npc.direction - MathHelper.PiOver2 + MathHelper.PiOver2 * npc.direction).ToRotationVector2() * npc.scale * sideFactor; - npc.Center = idealMovePosition; + float sideFactor = MathHelper.Lerp(200f, 18f, Utils.InverseLerp(-0.51f, -0.06f, NPC.rotation, true)); + float aheadFactor = MathHelper.Lerp(284f, 680f, Utils.InverseLerp(-0.51f, -0.06f, NPC.rotation, true)); + idealMovePosition += (SegmentToAttachTo.rotation + NPC.rotation * NPC.direction - MathHelper.PiOver2).ToRotationVector2() * NPC.scale * aheadFactor; + idealMovePosition += (SegmentToAttachTo.rotation + NPC.rotation * NPC.direction - MathHelper.PiOver2 + MathHelper.PiOver2 * NPC.direction).ToRotationVector2() * NPC.scale * sideFactor; + NPC.Center = idealMovePosition; UpdateLimbs(); if (ReelingBack) { - npc.rotation -= 0.066f; - if (npc.rotation < -0.55f) + NPC.rotation -= 0.066f; + if (NPC.rotation < -0.55f) ReelingBack = false; } else { - npc.rotation += 0.029f; - if (npc.rotation > 0.77f) + NPC.rotation += 0.029f; + if (NPC.rotation > 0.77f) ReelingBack = true; } @@ -144,16 +144,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas public void MoveToDestination() { - npc.Center = Vector2.Lerp(npc.Center, MoveDestination, 0.05f); - npc.Center = npc.Center.MoveTowards(MoveDestination, 10f); + NPC.Center = Vector2.Lerp(NPC.Center, MoveDestination, 0.05f); + NPC.Center = NPC.Center.MoveTowards(MoveDestination, 10f); // Stop moving if sufficiently close to the desired destination. - if (npc.WithinRange(MoveDestination, 15f)) + if (NPC.WithinRange(MoveDestination, 15f)) { - npc.Center = MoveDestination; + NPC.Center = MoveDestination; MoveDestination = Vector2.Zero; CurrentlyMoving = false; - npc.netUpdate = true; + NPC.netUpdate = true; } } @@ -161,48 +161,48 @@ namespace CalamityMod.NPCs.SupremeCalamitas { Vector2 offsetFromSegment = Vector2.Zero; - offsetFromSegment += new Vector2(npc.direction * 60f, 55f).RotatedBy(SegmentToAttachTo.rotation - (MathHelper.PiOver2 - npc.rotation * 1.7f - 0.77f) * npc.direction).SafeNormalize(Vector2.UnitY) * 92f; + offsetFromSegment += new Vector2(NPC.direction * 60f, 55f).RotatedBy(SegmentToAttachTo.rotation - (MathHelper.PiOver2 - NPC.rotation * 1.7f - 0.77f) * NPC.direction).SafeNormalize(Vector2.UnitY) * 92f; Limbs[0].Center = SegmentToAttachTo.Center + offsetFromSegment; Limbs[0].Rotation = offsetFromSegment.ToRotation(); - Limbs[1].Rotation = npc.AngleFrom(Limbs[0].Center); - Limbs[1].Center = Limbs[0].Center + offsetFromSegment * 0.5f + (npc.Center - Limbs[0].Center).SafeNormalize(Vector2.UnitY) * 84f; + Limbs[1].Rotation = NPC.AngleFrom(Limbs[0].Center); + Limbs[1].Center = Limbs[0].Center + offsetFromSegment * 0.5f + (NPC.Center - Limbs[0].Center).SafeNormalize(Vector2.UnitY) * 84f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D armTexture = Main.npcTexture[npc.type]; - Texture2D foreArmTexture = ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SCalWormForeArm"); - Texture2D handTexture = ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SCalWormHand"); + Texture2D armTexture = Main.npcTexture[NPC.type]; + Texture2D foreArmTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SCalWormForeArm"); + Texture2D handTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SCalWormHand"); Vector2 forearmDrawPosition = Limbs[0].Center - Main.screenPosition; Color drawColor = Lighting.GetColor((int)(Limbs[0].Center.X / 16), (int)(Limbs[0].Center.Y / 16)); - spriteBatch.Draw(foreArmTexture, forearmDrawPosition, null, drawColor, Limbs[0].Rotation + MathHelper.PiOver2, foreArmTexture.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(foreArmTexture, forearmDrawPosition, null, drawColor, Limbs[0].Rotation + MathHelper.PiOver2, foreArmTexture.Size() * 0.5f, NPC.scale, SpriteEffects.None, 0f); Vector2 armDrawPosition = Limbs[1].Center - Main.screenPosition; drawColor = Lighting.GetColor((int)(Limbs[1].Center.X / 16), (int)(Limbs[1].Center.Y / 16)); - spriteBatch.Draw(armTexture, armDrawPosition, null, drawColor, Limbs[1].Rotation + MathHelper.PiOver2, armTexture.Size() * new Vector2(0.5f, 0f), npc.scale, SpriteEffects.FlipVertically, 0f); + spriteBatch.Draw(armTexture, armDrawPosition, null, drawColor, Limbs[1].Rotation + MathHelper.PiOver2, armTexture.Size() * new Vector2(0.5f, 0f), NPC.scale, SpriteEffects.FlipVertically, 0f); Vector2 handDrawPosition = armDrawPosition; - SpriteEffects handDirection = npc.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - spriteBatch.Draw(handTexture, handDrawPosition, null, drawColor, Limbs[1].Rotation - MathHelper.PiOver2, handTexture.Size() * new Vector2(0.5f, 0f), npc.scale, handDirection, 0f); + SpriteEffects handDirection = NPC.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + spriteBatch.Draw(handTexture, handDrawPosition, null, drawColor, Limbs[1].Rotation - MathHelper.PiOver2, handTexture.Size() * new Vector2(0.5f, 0f), NPC.scale, handDirection, 0f); return false; } public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { Vector2 forearmGoreSpawnPosition = Limbs[0].Center + Main.rand.NextVector2Circular(6f, 6f); Vector2 armGoreSpawnPosition = Limbs[1].Center + Main.rand.NextVector2Circular(6f, 6f); Vector2 handGoreSpawnPosition = armGoreSpawnPosition + Main.rand.NextVector2Circular(6f, 6f); - Gore.NewGorePerfect(armGoreSpawnPosition, Main.rand.NextVector2Circular(3f, 3f), mod.GetGoreSlot($"Gores/SupremeCalamitas/SepulcherArm_Gore"), npc.scale); + Gore.NewGorePerfect(armGoreSpawnPosition, Main.rand.NextVector2Circular(3f, 3f), Mod.GetGoreSlot($"Gores/SupremeCalamitas/SepulcherArm_Gore"), NPC.scale); for (int i = 1; i <= 2; i++) - Gore.NewGorePerfect(forearmGoreSpawnPosition, Main.rand.NextVector2Circular(3f, 3f), mod.GetGoreSlot($"Gores/SupremeCalamitas/SepulcherForearm_Gore{i}"), npc.scale); + Gore.NewGorePerfect(forearmGoreSpawnPosition, Main.rand.NextVector2Circular(3f, 3f), Mod.GetGoreSlot($"Gores/SupremeCalamitas/SepulcherForearm_Gore{i}"), NPC.scale); for (int i = 1; i <= 2; i++) - Gore.NewGorePerfect(handGoreSpawnPosition, Main.rand.NextVector2Circular(3f, 3f), mod.GetGoreSlot($"Gores/SupremeCalamitas/SepulcherHand_Gore{i}"), npc.scale); + Gore.NewGorePerfect(handGoreSpawnPosition, Main.rand.NextVector2Circular(3f, 3f), Mod.GetGoreSlot($"Gores/SupremeCalamitas/SepulcherHand_Gore{i}"), NPC.scale); } } diff --git a/NPCs/SupremeCalamitas/SCalWormBody.cs b/NPCs/SupremeCalamitas/SCalWormBody.cs index 47602cd0bc..1de9be1c92 100644 --- a/NPCs/SupremeCalamitas/SCalWormBody.cs +++ b/NPCs/SupremeCalamitas/SCalWormBody.cs @@ -10,8 +10,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public class SCalWormBody : ModNPC { private bool setAlpha = false; - public NPC AheadSegment => Main.npc[(int)npc.ai[1]]; - public NPC HeadSegment => Main.npc[(int)npc.ai[2]]; + public NPC AheadSegment => Main.npc[(int)NPC.ai[1]]; + public NPC HeadSegment => Main.npc[(int)NPC.ai[2]]; public override void SetStaticDefaults() { @@ -20,41 +20,41 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SetDefaults() { - npc.damage = 0; //70 - npc.npcSlots = 5f; - npc.width = npc.height = 48; - npc.defense = 0; - CalamityGlobalNPC global = npc.Calamity(); + NPC.damage = 0; //70 + NPC.npcSlots = 5f; + NPC.width = NPC.height = 48; + NPC.defense = 0; + CalamityGlobalNPC global = NPC.Calamity(); global.DR = 0.999999f; global.unbreakableDR = true; - npc.lifeMax = CalamityWorld.revenge ? 345000 : 300000; - npc.aiStyle = -1; //new + NPC.lifeMax = CalamityWorld.revenge ? 345000 : 300000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.scale = 1.2f; + NPC.knockBackResist = 0f; + NPC.scale = 1.2f; if (Main.expertMode) { - npc.scale = 1.35f; + NPC.scale = 1.35f; } - npc.alpha = 255; - npc.chaseable = false; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.alpha = 255; + NPC.chaseable = false; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.netAlways = true; + NPC.dontCountMe = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.localAI[3]); + writer.Write(NPC.localAI[3]); writer.Write(setAlpha); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.localAI[3] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); setAlpha = reader.ReadBoolean(); } @@ -65,52 +65,52 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { - if (npc.ai[2] > 0f) + if (NPC.ai[2] > 0f) { - npc.realLife = (int)npc.ai[2]; + NPC.realLife = (int)NPC.ai[2]; } bool shouldDie = false; - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDie = true; - else if (AheadSegment.life <= 0 || !AheadSegment.active || npc.life <= 0) + else if (AheadSegment.life <= 0 || !AheadSegment.active || NPC.life <= 0) shouldDie = true; if (shouldDie) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); } if (AheadSegment.alpha < 128 && !setAlpha) { - if (npc.alpha != 0) + if (NPC.alpha != 0) { for (int i = 0; i < 2; i++) { - Dust fire = Dust.NewDustDirect(npc.position, npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Dust fire = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); fire.noGravity = true; fire.noLight = true; } } - npc.alpha -= 42; - if (npc.alpha <= 0) + NPC.alpha -= 42; + if (NPC.alpha <= 0) { setAlpha = true; - npc.alpha = 0; + NPC.alpha = 0; } } else - npc.alpha = HeadSegment.alpha; + NPC.alpha = HeadSegment.alpha; - if (Main.npc.IndexInRange((int)npc.ai[1])) + if (Main.npc.IndexInRange((int)NPC.ai[1])) { - Vector2 offsetToAheadSegment = AheadSegment.Center - npc.Center; - npc.rotation = offsetToAheadSegment.ToRotation() + MathHelper.PiOver2; - npc.velocity = Vector2.Zero; - npc.Center = AheadSegment.Center - offsetToAheadSegment.SafeNormalize(Vector2.UnitY) * 52f; - npc.spriteDirection = (offsetToAheadSegment.X > 0f).ToDirectionInt(); + Vector2 offsetToAheadSegment = AheadSegment.Center - NPC.Center; + NPC.rotation = offsetToAheadSegment.ToRotation() + MathHelper.PiOver2; + NPC.velocity = Vector2.Zero; + NPC.Center = AheadSegment.Center - offsetToAheadSegment.SafeNormalize(Vector2.UnitY) * 52f; + NPC.spriteDirection = (offsetToAheadSegment.X > 0f).ToDirectionInt(); } } @@ -132,16 +132,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = npc.localAI[3] / 2f % 2f == 0f ? ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SCalWormBodyAlt") : Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = NPC.localAI[3] / 2f % 2f == 0f ? ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SCalWormBodyAlt") : Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -158,9 +158,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { - int variant = (int)(npc.localAI[3] / 2f % 2f); + int variant = (int)(NPC.localAI[3] / 2f % 2f); if (variant == 0) { for (int i = 1; i <= 9; i++) @@ -168,8 +168,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!Main.rand.NextBool(3)) continue; - Vector2 goreSpawnPosition = npc.Center; - Gore.NewGorePerfect(goreSpawnPosition, Main.rand.NextVector2Circular(2f, 2f), mod.GetGoreSlot($"Gores/SupremeCalamitas/SepulcherBody1_Gore{i}"), npc.scale); + Vector2 goreSpawnPosition = NPC.Center; + Gore.NewGorePerfect(goreSpawnPosition, Main.rand.NextVector2Circular(2f, 2f), Mod.GetGoreSlot($"Gores/SupremeCalamitas/SepulcherBody1_Gore{i}"), NPC.scale); } } else @@ -179,8 +179,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!Main.rand.NextBool(3)) continue; - Vector2 goreSpawnPosition = npc.Center; - Gore.NewGorePerfect(goreSpawnPosition, Main.rand.NextVector2Circular(2f, 2f), mod.GetGoreSlot($"Gores/SupremeCalamitas/SepulcherBody2_Gore{i}"), npc.scale); + Vector2 goreSpawnPosition = NPC.Center; + Gore.NewGorePerfect(goreSpawnPosition, Main.rand.NextVector2Circular(2f, 2f), Mod.GetGoreSlot($"Gores/SupremeCalamitas/SepulcherBody2_Gore{i}"), NPC.scale); } } } diff --git a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs index 11316d7359..eb46638dad 100644 --- a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs +++ b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs @@ -7,43 +7,44 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.SupremeCalamitas { public class SCalWormBodyWeak : ModNPC { private bool setAlpha = false; - public NPC AheadSegment => Main.npc[(int)npc.ai[1]]; - public NPC HeadSegment => Main.npc[(int)npc.ai[2]]; - public ref float AttackTimer => ref npc.localAI[0]; + public NPC AheadSegment => Main.npc[(int)NPC.ai[1]]; + public NPC HeadSegment => Main.npc[(int)NPC.ai[2]]; + public ref float AttackTimer => ref NPC.localAI[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Heart"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 5; } public override void SetDefaults() { - npc.damage = 0; - npc.npcSlots = 5f; - npc.width = 20; - npc.height = 20; - npc.lifeMax = CalamityWorld.revenge ? 345000 : 300000; - npc.aiStyle = -1; + NPC.damage = 0; + NPC.npcSlots = 5f; + NPC.width = 20; + NPC.height = 20; + NPC.lifeMax = CalamityWorld.revenge ? 345000 : 300000; + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.scale = Main.expertMode ? 1.35f : 1.2f; - npc.alpha = 255; - npc.chaseable = false; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.knockBackResist = 0f; + NPC.scale = Main.expertMode ? 1.35f : 1.2f; + NPC.alpha = 255; + NPC.chaseable = false; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.netAlways = true; + NPC.dontCountMe = true; - CalamityGlobalNPC global = npc.Calamity(); + CalamityGlobalNPC global = NPC.Calamity(); global.DR = 0.999999f; global.unbreakableDR = true; } @@ -62,42 +63,42 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; bool shouldDie = false; - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) shouldDie = true; - else if (AheadSegment.life <= 0 || !AheadSegment.active || npc.life <= 0) + else if (AheadSegment.life <= 0 || !AheadSegment.active || NPC.life <= 0) shouldDie = true; if (shouldDie) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); } if (AheadSegment.alpha < 128 && !setAlpha) { - if (npc.alpha != 0) + if (NPC.alpha != 0) { for (int i = 0; i < 2; i++) { - Dust fire = Dust.NewDustDirect(npc.position, npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Dust fire = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); fire.noGravity = true; fire.noLight = true; } } - npc.alpha -= 42; - if (npc.alpha <= 0) + NPC.alpha -= 42; + if (NPC.alpha <= 0) { setAlpha = true; - npc.alpha = 0; + NPC.alpha = 0; } } else - npc.alpha = HeadSegment.alpha; + NPC.alpha = HeadSegment.alpha; AttackTimer += (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 1.5f : 1f; if (AttackTimer >= 900f) @@ -106,27 +107,27 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); int totalProjectiles = 4; float radians = MathHelper.TwoPi / totalProjectiles; Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, velocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.Center, velocity, type, damage, 0f, Main.myPlayer); } - npc.netUpdate = true; + NPC.netUpdate = true; } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), NPC.Center); } - if (Main.npc.IndexInRange((int)npc.ai[1])) + if (Main.npc.IndexInRange((int)NPC.ai[1])) { - Vector2 offsetToAheadSegment = AheadSegment.Center - npc.Center; - npc.rotation = offsetToAheadSegment.ToRotation() + MathHelper.PiOver2; - npc.velocity = Vector2.Zero; - npc.Center = AheadSegment.Center - offsetToAheadSegment.SafeNormalize(Vector2.UnitY) * 34f; - npc.spriteDirection = (offsetToAheadSegment.X > 0f).ToDirectionInt(); + Vector2 offsetToAheadSegment = AheadSegment.Center - NPC.Center; + NPC.rotation = offsetToAheadSegment.ToRotation() + MathHelper.PiOver2; + NPC.velocity = Vector2.Zero; + NPC.Center = AheadSegment.Center - offsetToAheadSegment.SafeNormalize(Vector2.UnitY) * 34f; + NPC.spriteDirection = (offsetToAheadSegment.X > 0f).ToDirectionInt(); } } @@ -147,13 +148,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void FindFrame(int frameHeight) { - npc.frameCounter++; - npc.frame.Y = ((int)(npc.frameCounter / 5) + npc.whoAmI) % Main.npcFrameCount[npc.type] * frameHeight; + NPC.frameCounter++; + NPC.frame.Y = ((int)(NPC.frameCounter / 5) + NPC.whoAmI) % Main.npcFrameCount[NPC.type] * frameHeight; } public override void HitEffect(int hitDirection, double damage) { - if (Main.netMode != NetmodeID.MultiplayerClient && npc.life <= 0) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.life <= 0) { for (int i = 0; i < Main.rand.Next(1, 3 + 1); i++) { @@ -161,7 +162,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas continue; Vector2 soulVelocity = -Vector2.UnitY.RotatedByRandom(0.53f) * Main.rand.NextFloat(2.5f, 4f); - Projectile.NewProjectile(npc.Center, soulVelocity, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(NPC.Center, soulVelocity, ModContent.ProjectileType(), 0, 0f); } } } diff --git a/NPCs/SupremeCalamitas/SCalWormHead.cs b/NPCs/SupremeCalamitas/SCalWormHead.cs index 5479877912..449ccd91e4 100644 --- a/NPCs/SupremeCalamitas/SCalWormHead.cs +++ b/NPCs/SupremeCalamitas/SCalWormHead.cs @@ -7,6 +7,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -24,40 +25,40 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SetDefaults() { - npc.damage = 0; //150 - npc.npcSlots = 5f; - npc.width = 62; //324 - npc.height = 64; //216 - npc.defense = 0; - CalamityGlobalNPC global = npc.Calamity(); + NPC.damage = 0; //150 + NPC.npcSlots = 5f; + NPC.width = 62; //324 + NPC.height = 64; //216 + NPC.defense = 0; + CalamityGlobalNPC global = NPC.Calamity(); global.DR = 0.999999f; global.unbreakableDR = true; - npc.lifeMax = CalamityWorld.revenge ? 345000 : 300000; - npc.aiStyle = -1; //new + NPC.lifeMax = CalamityWorld.revenge ? 345000 : 300000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.scale = Main.expertMode ? 1.35f : 1.2f; - npc.scale *= 1.25f; + NPC.knockBackResist = 0f; + NPC.scale = Main.expertMode ? 1.35f : 1.2f; + NPC.scale *= 1.25f; - npc.alpha = 255; - npc.chaseable = false; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.netAlways = true; + NPC.alpha = 255; + NPC.chaseable = false; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.netAlways = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.localAI[0]); - writer.Write(npc.alpha); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.alpha); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.localAI[0] = reader.ReadSingle(); - npc.alpha = reader.ReadInt32(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.alpha = reader.ReadInt32(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -67,41 +68,41 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { - CalamityGlobalNPC.SCalWorm = npc.whoAmI; + CalamityGlobalNPC.SCalWorm = NPC.whoAmI; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!TailSpawned && npc.ai[0] == 0f) + if (!TailSpawned && NPC.ai[0] == 0f) { float rotationalOffset = 0f; - int Previous = npc.whoAmI; + int Previous = NPC.whoAmI; for (int i = 0; i < maxLength; i++) { int lol; if (i >= 0 && i < minLength && i % 2 == 1) { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); Main.npc[lol].localAI[0] += passedVar; passedVar += 36f; } else if (i >= 0 && i < minLength) { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); Main.npc[lol].localAI[3] = i; } else - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + lol = NPC.NewNPC((int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); // Create arms. if (i >= 3 && i % 4 == 0) @@ -129,52 +130,52 @@ namespace CalamityMod.NPCs.SupremeCalamitas rotationalOffset = MathHelper.WrapAngle(rotationalOffset); } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = NPC.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; Previous = lol; } TailSpawned = true; } - if (!npc.active && Main.netMode == NetmodeID.Server) + if (!NPC.active && Main.netMode == NetmodeID.Server) { - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } } - if (Main.player[npc.target].dead || !NPC.AnyNPCs(ModContent.NPCType()) || CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) + if (Main.player[NPC.target].dead || !NPC.AnyNPCs(ModContent.NPCType()) || CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) { - npc.TargetClosest(false); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/SepulcherDeath"), Main.player[npc.target].Center); - npc.life = 0; - npc.HitEffect(); - npc.active = false; - npc.netUpdate = true; + NPC.TargetClosest(false); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/SepulcherDeath"), Main.player[NPC.target].Center); + NPC.life = 0; + NPC.HitEffect(); + NPC.active = false; + NPC.netUpdate = true; } else - npc.Opacity = MathHelper.Clamp(npc.Opacity + 0.165f, 0f, 1f); + NPC.Opacity = MathHelper.Clamp(NPC.Opacity + 0.165f, 0f, 1f); - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); float num188 = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 12.5f : 10f; float num189 = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 0.125f : 0.1f; float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); + float num50 = NPC.velocity.Length(); if (num50 > 0f) { if (num50 > num48) { - npc.velocity.Normalize(); - npc.velocity *= num48; + NPC.velocity.Normalize(); + NPC.velocity *= num48; } else if (num50 < num49) { - npc.velocity.Normalize(); - npc.velocity *= num49; + NPC.velocity.Normalize(); + NPC.velocity *= num49; } } @@ -190,50 +191,50 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num198 = num188 / num193; num191 *= num198; num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f)) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - if (npc.velocity.X > num191) + if (NPC.velocity.X > num191) { - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - if (npc.velocity.Y > num192) + if (NPC.velocity.Y > num192) { - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } - if (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(num192) < num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f))) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y + num189 * 2f; } else { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 2f; } } - if (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(num191) < num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f))) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X + num189 * 2f; //changed from 2 } else { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + NPC.velocity.X = NPC.velocity.X - num189 * 2f; //changed from 2 } } } @@ -241,65 +242,65 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (num196 > num197) { - if (npc.velocity.X < num191) + if (NPC.velocity.X < num191) { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X + num189 * 1.1f; //changed from 1.1 } - else if (npc.velocity.X > num191) + else if (NPC.velocity.X > num191) { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + NPC.velocity.X = NPC.velocity.X - num189 * 1.1f; //changed from 1.1 } - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) { - if (npc.velocity.Y > 0f) + if (NPC.velocity.Y > 0f) { - npc.velocity.Y = npc.velocity.Y + num189; + NPC.velocity.Y = NPC.velocity.Y + num189; } else { - npc.velocity.Y = npc.velocity.Y - num189; + NPC.velocity.Y = NPC.velocity.Y - num189; } } } else { - if (npc.velocity.Y < num192) + if (NPC.velocity.Y < num192) { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y + num189 * 1.1f; } - else if (npc.velocity.Y > num192) + else if (NPC.velocity.Y > num192) { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + NPC.velocity.Y = NPC.velocity.Y - num189 * 1.1f; } - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5) { - if (npc.velocity.X > 0f) + if (NPC.velocity.X > 0f) { - npc.velocity.X = npc.velocity.X + num189; + NPC.velocity.X = NPC.velocity.X + num189; } else { - npc.velocity.X = npc.velocity.X - num189; + NPC.velocity.X = NPC.velocity.X - num189; } } } } - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -326,18 +327,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int i = 1; i <= 3; i++) { - Vector2 goreSpawnPosition = npc.Center; + Vector2 goreSpawnPosition = NPC.Center; // Spawn at a slight offset when spawning mandibles. if (i == 2) - goreSpawnPosition += npc.velocity.SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver4) * 16f; + goreSpawnPosition += NPC.velocity.SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver4) * 16f; if (i == 3) - goreSpawnPosition += npc.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-MathHelper.PiOver4) * 16f; - Gore.NewGorePerfect(goreSpawnPosition, npc.velocity, mod.GetGoreSlot($"Gores/SupremeCalamitas/SepulcherHead_Gore{i}"), npc.scale); + goreSpawnPosition += NPC.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-MathHelper.PiOver4) * 16f; + Gore.NewGorePerfect(goreSpawnPosition, NPC.velocity, Mod.GetGoreSlot($"Gores/SupremeCalamitas/SepulcherHead_Gore{i}"), NPC.scale); } } } diff --git a/NPCs/SupremeCalamitas/SCalWormTail.cs b/NPCs/SupremeCalamitas/SCalWormTail.cs index d767d5a3e3..67885111f2 100644 --- a/NPCs/SupremeCalamitas/SCalWormTail.cs +++ b/NPCs/SupremeCalamitas/SCalWormTail.cs @@ -18,31 +18,31 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SetDefaults() { - npc.damage = 0; - npc.npcSlots = 5f; - npc.width = 20; //324 - npc.height = 20; //216 - npc.defense = 0; - CalamityGlobalNPC global = npc.Calamity(); + NPC.damage = 0; + NPC.npcSlots = 5f; + NPC.width = 20; //324 + NPC.height = 20; //216 + NPC.defense = 0; + CalamityGlobalNPC global = NPC.Calamity(); global.DR = 0.999999f; global.unbreakableDR = true; - npc.lifeMax = CalamityWorld.revenge ? 345000 : 300000; - npc.aiStyle = -1; //new + NPC.lifeMax = CalamityWorld.revenge ? 345000 : 300000; + NPC.aiStyle = -1; //new aiType = -1; //new - npc.knockBackResist = 0f; - npc.scale = 1.2f; + NPC.knockBackResist = 0f; + NPC.scale = 1.2f; if (Main.expertMode) { - npc.scale = 1.35f; + NPC.scale = 1.35f; } - npc.alpha = 255; - npc.chaseable = false; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.netAlways = true; - npc.dontCountMe = true; + NPC.alpha = 255; + NPC.chaseable = false; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.netAlways = true; + NPC.dontCountMe = true; } public override void SendExtraAI(BinaryWriter writer) @@ -62,53 +62,53 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { - if (npc.ai[2] > 0f) + if (NPC.ai[2] > 0f) { - npc.realLife = (int)npc.ai[2]; + NPC.realLife = (int)NPC.ai[2]; } bool flag = false; - if (npc.ai[1] <= 0f) + if (NPC.ai[1] <= 0f) { flag = true; } - else if (Main.npc[(int)npc.ai[1]].life <= 0 || npc.life <= 0) + else if (Main.npc[(int)NPC.ai[1]].life <= 0 || NPC.life <= 0) { flag = true; } if (flag) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); } - if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) + if (Main.npc[(int)NPC.ai[1]].alpha < 128 && !setAlpha) { - if (npc.alpha != 0) + if (NPC.alpha != 0) { for (int num934 = 0; num934 < 2; num934++) { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + int num935 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 182, 0f, 0f, 100, default, 2f); Main.dust[num935].noGravity = true; Main.dust[num935].noLight = true; } } - npc.alpha -= 42; - if (npc.alpha <= 0) + NPC.alpha -= 42; + if (NPC.alpha <= 0) { setAlpha = true; - npc.alpha = 0; + NPC.alpha = 0; } } else { - npc.alpha = Main.npc[(int)npc.ai[2]].alpha; + NPC.alpha = Main.npc[(int)NPC.ai[2]].alpha; } - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); + float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; @@ -116,33 +116,33 @@ namespace CalamityMod.NPCs.SupremeCalamitas num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; + NPC.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; + int num194 = NPC.width; num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + num191; + NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) { - npc.spriteDirection = -1; + NPC.spriteDirection = -1; } else if (num191 > 0f) { - npc.spriteDirection = 1; + NPC.spriteDirection = 1; } } } @@ -150,16 +150,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } @@ -181,14 +181,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { for (int i = 1; i <= 2; i++) { - Vector2 goreSpawnPosition = npc.Center; + Vector2 goreSpawnPosition = NPC.Center; if (i == 2) - goreSpawnPosition -= (npc.rotation - MathHelper.PiOver2).ToRotationVector2() * 20f; - Gore.NewGorePerfect(goreSpawnPosition, Main.rand.NextVector2Circular(3f, 3f), mod.GetGoreSlot($"Gores/SupremeCalamitas/SepulcherTail_Gore{i}"), npc.scale); + goreSpawnPosition -= (NPC.rotation - MathHelper.PiOver2).ToRotationVector2() * 20f; + Gore.NewGorePerfect(goreSpawnPosition, Main.rand.NextVector2Circular(3f, 3f), Mod.GetGoreSlot($"Gores/SupremeCalamitas/SepulcherTail_Gore{i}"), NPC.scale); } } } diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 6b72cae98b..c2d401dedc 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using System.IO; +using Terraria.Audio; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -16,33 +17,33 @@ namespace CalamityMod.NPCs.SupremeCalamitas private int timer = 0; private bool start = true; public NPC SCal => Main.npc[CalamityGlobalNPC.SCal]; - public Player Target => Main.player[npc.target]; - public Vector2 EyePosition => npc.Center + new Vector2(npc.spriteDirection == -1 ? 40f : -36f, 16f); - public ref float RotationalDegreeOffset => ref npc.ai[1]; + public Player Target => Main.player[NPC.target]; + public Vector2 EyePosition => NPC.Center + new Vector2(NPC.spriteDirection == -1 ? 40f : -36f, 16f); + public ref float RotationalDegreeOffset => ref NPC.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Soul Seeker"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.aiStyle = -1; + NPC.aiStyle = -1; aiType = -1; - npc.width = 40; - npc.height = 40; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.damage = 0; - npc.defense = 60; - npc.DR_NERD(0.25f); - npc.LifeMaxNERB(Main.expertMode ? 24000 : 15000, 28000); - npc.DeathSound = SoundID.DD2_SkeletonDeath; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; + NPC.width = 40; + NPC.height = 40; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.damage = 0; + NPC.defense = 60; + NPC.DR_NERD(0.25f); + NPC.LifeMaxNERB(Main.expertMode ? 24000 : 15000, 28000); + NPC.DeathSound = SoundID.DD2_SkeletonDeath; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; } public override void SendExtraAI(BinaryWriter writer) @@ -57,11 +58,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void FindFrame(int frameHeight) { - npc.frameCounter++; - if (npc.frameCounter % 5 == 4) - npc.frame.Y += frameHeight; - if (npc.frame.Y / frameHeight >= Main.npcFrameCount[npc.type]) - npc.frame.Y = 0; + NPC.frameCounter++; + if (NPC.frameCounter % 5 == 4) + NPC.frame.Y += frameHeight; + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[NPC.type]) + NPC.frame.Y = 0; } public override bool PreAI() @@ -69,28 +70,28 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Die if SCal is no longer present. if (CalamityGlobalNPC.SCal < 0 || !SCal.active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return false; } if (start) { for (int i = 0; i < 10; i++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - RotationalDegreeOffset = npc.ai[0]; + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + RotationalDegreeOffset = NPC.ai[0]; start = false; } // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Target.dead || !Target.active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Target.dead || !Target.active) + NPC.TargetClosest(); // Target another player if the current player target is too far away - if (!npc.WithinRange(Target.Center, CalamityGlobalNPC.CatchUpDistance200Tiles)) - npc.TargetClosest(); + if (!NPC.WithinRange(Target.Center, CalamityGlobalNPC.CatchUpDistance200Tiles)) + NPC.TargetClosest(); - npc.spriteDirection = (Target.Center.X < npc.Center.X).ToDirectionInt(); + NPC.spriteDirection = (Target.Center.X < NPC.Center.X).ToDirectionInt(); timer++; int shootRate = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 120 : 180; @@ -99,25 +100,25 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < Main.maxNPCs; i++) { NPC seeker = Main.npc[i]; - if (seeker.type == npc.type) + if (seeker.type == NPC.type) { - if (seeker == npc) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), SCal.Center); + if (seeker == NPC) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), SCal.Center); break; } } if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Vector2 shootVelocity = (Target.Center - EyePosition).SafeNormalize(Vector2.UnitY) * 9f; Projectile.NewProjectile(EyePosition, shootVelocity, type, damage, 1f, Main.myPlayer); } timer = 0; - npc.netUpdate = true; + NPC.netUpdate = true; } - npc.position = SCal.Center - MathHelper.ToRadians(RotationalDegreeOffset).ToRotationVector2() * 300f - npc.Size * 0.5f; + NPC.position = SCal.Center - MathHelper.ToRadians(RotationalDegreeOffset).ToRotationVector2() * 300f - NPC.Size * 0.5f; RotationalDegreeOffset += 0.5f; return false; } @@ -126,9 +127,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (!CalamityWorld.revenge) { - int closestPlayer = Player.FindClosest(npc.Center, 1, 1); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.Next(4) == 0 && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } } @@ -140,17 +141,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 50; + NPC.height = 50; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -160,15 +161,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } for (int i = 1; i <= 5; i++) - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot($"Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore{i}"), npc.scale); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot($"Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore{i}"), NPC.scale); } } @@ -177,11 +178,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture2D15 = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 2; @@ -192,21 +193,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SoulSeekerSupremeGlow"); + texture2D15 = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SoulSeekerSupremeGlow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -216,14 +217,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 5b8905c7a7..916e70f8a1 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -27,6 +27,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -95,8 +96,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas private float forcefieldScale = 1; private FrameAnimationType FrameType { - get => (FrameAnimationType)(int)npc.localAI[2]; - set => npc.localAI[2] = (int)value; + get => (FrameAnimationType)(int)NPC.localAI[2]; + set => NPC.localAI[2] = (int)value; } private bool AttackCloseToBeingOver { @@ -105,32 +106,32 @@ namespace CalamityMod.NPCs.SupremeCalamitas int attackLength = 0; // First phase. - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - if (npc.ai[1] == 0f) + if (NPC.ai[1] == 0f) attackLength = 300; - if (npc.ai[1] == 2f) + if (NPC.ai[1] == 2f) attackLength = 70; - if (npc.ai[1] == 3f) + if (NPC.ai[1] == 3f) attackLength = 480; - if (npc.ai[1] == 4f) + if (NPC.ai[1] == 4f) attackLength = 300; } else { - if (npc.ai[1] == 0f) + if (NPC.ai[1] == 0f) attackLength = 240; - if (npc.ai[1] == 2f) + if (NPC.ai[1] == 2f) attackLength = 70; - if (npc.ai[1] == 3f) + if (NPC.ai[1] == 3f) attackLength = 300; - if (npc.ai[1] == 4f) + if (NPC.ai[1] == 4f) attackLength = 240; } - return npc.ai[2] >= attackLength - 30f; + return NPC.ai[2] >= attackLength - 30f; } } - private ref float FrameChangeSpeed => ref npc.localAI[3]; + private ref float FrameChangeSpeed => ref NPC.localAI[3]; private Vector2 cataclysmSpawnPosition; private Vector2 catastropheSpawnPosition; @@ -171,42 +172,42 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SetStaticDefaults() { DisplayName.SetDefault("Supreme Calamitas"); - Main.npcFrameCount[npc.type] = 21; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 21; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.GetNPCDamage(); - npc.npcSlots = 50f; - npc.width = npc.height = 44; - npc.defense = 100; - npc.DR_NERD(normalDR); - npc.value = Item.buyPrice(30, 0, 0, 0); - npc.LifeMaxNERB(960000, 1150000, 500000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.GetNPCDamage(); + NPC.npcSlots = 50f; + NPC.width = NPC.height = 44; + NPC.defense = 100; + NPC.DR_NERD(normalDR); + NPC.value = Item.buyPrice(30, 0, 0, 0); + NPC.LifeMaxNERB(960000, 1150000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.dontTakeDamage = false; - npc.chaseable = true; - npc.boss = true; - npc.canGhostHeal = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; + NPC.knockBackResist = 0f; + NPC.dontTakeDamage = false; + NPC.chaseable = true; + NPC.boss = true; + NPC.canGhostHeal = false; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; music = CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas1") ?? MusicID.Boss2; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void BossHeadSlot(ref int index) { - bool inPhase2 = npc.ai[0] == 3f; + bool inPhase2 = NPC.ai[0] == 3f; if (!CalamityWorld.downedSCal || BossRushEvent.BossRushActive) index = inPhase2 ? hoodedHeadIconP2Index : hoodedHeadIconIndex; else @@ -238,8 +239,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas writer.Write(spawnArena); writer.Write(hasSummonedBrothers); writer.Write(enteredBrothersPhase); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.chaseable); writer.Write(giveUpCounter); writer.Write(phaseChange); @@ -289,8 +290,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas spawnArena = reader.ReadBoolean(); hasSummonedBrothers = reader.ReadBoolean(); enteredBrothersPhase = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.chaseable = reader.ReadBoolean(); giveUpCounter = reader.ReadInt32(); phaseChange = reader.ReadInt32(); @@ -322,7 +323,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas #endregion #region StartUp - CalamityGlobalNPC.SCal = npc.whoAmI; + CalamityGlobalNPC.SCal = NPC.whoAmI; bool wormAlive = false; if (CalamityGlobalNPC.SCalWorm != -1) @@ -356,29 +357,29 @@ namespace CalamityMod.NPCs.SupremeCalamitas bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Projectile damage values - int bulletHellblastDamage = npc.GetProjectileDamage(ModContent.ProjectileType()); + int bulletHellblastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); int firstBulletHellblastDamage = (int)Math.Round(bulletHellblastDamage * 1.25); - int barrageDamage = npc.GetProjectileDamage(ModContent.ProjectileType()); - int gigablastDamage = npc.GetProjectileDamage(ModContent.ProjectileType()); - int fireblastDamage = npc.GetProjectileDamage(ModContent.ProjectileType()); - int monsterDamage = npc.GetProjectileDamage(ModContent.ProjectileType()); - int waveDamage = npc.GetProjectileDamage(ModContent.ProjectileType()); - int hellblastDamage = npc.GetProjectileDamage(ModContent.ProjectileType()); + int barrageDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); + int gigablastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); + int fireblastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); + int monsterDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); + int waveDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); + int hellblastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); int bodyWidth = 44; int bodyHeight = 42; int baseBulletHellProjectileGateValue = revenge ? 8 : expertMode ? 9 : 10; - Vector2 vectorCenter = npc.Center; + Vector2 vectorCenter = NPC.Center; // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; if (!startText) { @@ -394,9 +395,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas #endregion #region Directioning - bool currentlyCharging = npc.ai[1] == 2f; - if (!currentlyCharging && Math.Abs(player.Center.X - npc.Center.X) > 16f) - npc.spriteDirection = (player.Center.X < npc.Center.X).ToDirectionInt(); + bool currentlyCharging = NPC.ai[1] == 2f; + if (!currentlyCharging && Math.Abs(player.Center.X - NPC.Center.X) > 16f) + NPC.spriteDirection = (player.Center.X < NPC.Center.X).ToDirectionInt(); #endregion #region Forcefield and Shield Logic @@ -405,14 +406,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 hitboxSize = new Vector2(forcefieldScale * 216f / 1.4142f); hitboxSize = Vector2.Max(hitboxSize, new Vector2(42, 44)); - if (npc.Size != hitboxSize) - npc.Size = hitboxSize; + if (NPC.Size != hitboxSize) + NPC.Size = hitboxSize; bool shouldNotUseShield = bulletHellCounter2 % 900 != 0 || attackCastDelay > 0 || NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()) || - npc.ai[0] == 1f || npc.ai[0] == 2f; + NPC.ai[0] == 1f || NPC.ai[0] == 2f; // Make the shield and forcefield fade away in SCal's acceptance phase. - if (npc.life <= npc.lifeMax * 0.01) + if (NPC.life <= NPC.lifeMax * 0.01) { shieldOpacity = MathHelper.Lerp(shieldOpacity, 0f, 0.08f); forcefieldScale = MathHelper.Lerp(forcefieldScale, 0f, 0.08f); @@ -420,11 +421,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Summon a shield if the next attack will be a charge. // Make it go away if certain triggers happen during this, such as a bullet hell starting, however. - else if (((willCharge && AttackCloseToBeingOver) || npc.ai[1] == 2f) && !shouldNotUseShield) + else if (((willCharge && AttackCloseToBeingOver) || NPC.ai[1] == 2f) && !shouldNotUseShield) { - if (npc.ai[1] != 2f) + if (NPC.ai[1] != 2f) { - float idealRotation = npc.AngleTo(player.Center); + float idealRotation = NPC.AngleTo(player.Center); float angularOffset = Math.Abs(MathHelper.WrapAngle(shieldRotation - idealRotation)); if (angularOffset > 0.04f) @@ -438,12 +439,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Emit dust off the skull at the position of its eye socket. for (float num6 = 1f; num6 < 16f; num6 += 1f) { - Dust dust = Dust.NewDustPerfect(npc.Center, 182); - dust.position = Vector2.Lerp(npc.position, npc.oldPosition, num6 / 16f) + npc.Size * 0.5f; + Dust dust = Dust.NewDustPerfect(NPC.Center, 182); + dust.position = Vector2.Lerp(NPC.position, NPC.oldPosition, num6 / 16f) + NPC.Size * 0.5f; dust.position += shieldRotation.ToRotationVector2() * 42f; - dust.position += (shieldRotation - MathHelper.PiOver2).ToRotationVector2() * (float)Math.Cos(npc.velocity.ToRotation()) * -4f; + dust.position += (shieldRotation - MathHelper.PiOver2).ToRotationVector2() * (float)Math.Cos(NPC.velocity.ToRotation()) * -4f; dust.noGravity = true; - dust.velocity = npc.velocity; + dust.velocity = NPC.velocity; dust.color = Color.Red; dust.scale = MathHelper.Lerp(0.6f, 0.85f, 1f - num6 / 16f); } @@ -472,18 +473,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (death) { - safeBox.X = spawnX = spawnXReset = (int)(npc.Center.X - 1000f); - spawnX2 = spawnXReset2 = (int)(npc.Center.X + 1000f); - safeBox.Y = spawnY = spawnYReset = (int)(npc.Center.Y - 1000f); + safeBox.X = spawnX = spawnXReset = (int)(NPC.Center.X - 1000f); + spawnX2 = spawnXReset2 = (int)(NPC.Center.X + 1000f); + safeBox.Y = spawnY = spawnYReset = (int)(NPC.Center.Y - 1000f); safeBox.Width = 2000; safeBox.Height = 2000; spawnYAdd = 100; } else { - safeBox.X = spawnX = spawnXReset = (int)(npc.Center.X - 1250f); - spawnX2 = spawnXReset2 = (int)(npc.Center.X + 1250f); - safeBox.Y = spawnY = spawnYReset = (int)(npc.Center.Y - 1250f); + safeBox.X = spawnX = spawnXReset = (int)(NPC.Center.X - 1250f); + spawnX2 = spawnXReset2 = (int)(NPC.Center.X + 1250f); + safeBox.Y = spawnY = spawnYReset = (int)(NPC.Center.Y - 1250f); safeBox.Width = 2500; safeBox.Height = 2500; spawnYAdd = 125; @@ -501,7 +502,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if ((num55 == num52 - num54 || num55 == num52 + num54 || num56 == num53 - num54 || num56 == num53 + num54) && !Main.tile[num55, num56].active()) { - Main.tile[num55, num56].type = (ushort)ModContent.TileType(); + Main.tile[num55, num56].TileType = (ushort)ModContent.TileType(); Main.tile[num55, num56].active(true); } if (Main.netMode == NetmodeID.Server) @@ -517,14 +518,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (initialRitualPosition == Vector2.Zero) { - initialRitualPosition = npc.Center + Vector2.UnitY * 24f; - npc.netUpdate = true; + initialRitualPosition = NPC.Center + Vector2.UnitY * 24f; + NPC.netUpdate = true; } // Sync to update all clients on the state of the arena. // Only after this will enrages be registered. spawnArena = true; - npc.netUpdate = true; + NPC.netUpdate = true; } } #endregion @@ -540,10 +541,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas uDieLul = MathHelper.Clamp(uDieLul * 0.99f, 1f, 2f); protectionBoost = false; } - npc.Calamity().CurrentlyEnraged = !player.Hitbox.Intersects(safeBox); + NPC.Calamity().CurrentlyEnraged = !player.Hitbox.Intersects(safeBox); // Set DR to be 99% and unbreakable if enraged. Boost DR during the 5th attack. - CalamityGlobalNPC global = npc.Calamity(); + CalamityGlobalNPC global = NPC.Calamity(); if (protectionBoost && !gettingTired5) { global.DR = enragedDR; @@ -560,37 +561,37 @@ namespace CalamityMod.NPCs.SupremeCalamitas #region Despawn if (!player.active || player.dead) { - npc.TargetClosest(false); - player = Main.player[npc.target]; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; // Slow down and disappear in a burst of fire if should despawn. if (!player.active || player.dead) { canDespawn = true; - npc.Opacity = MathHelper.Lerp(npc.Opacity, 0f, 0.065f); - npc.velocity = Vector2.Lerp(Vector2.UnitY * -4f, Vector2.Zero, (float)Math.Sin(MathHelper.Pi * npc.Opacity)); - forcefieldOpacity = Utils.InverseLerp(0.1f, 0.6f, npc.Opacity, true); - if (npc.alpha >= 230) + NPC.Opacity = MathHelper.Lerp(NPC.Opacity, 0f, 0.065f); + NPC.velocity = Vector2.Lerp(Vector2.UnitY * -4f, Vector2.Zero, (float)Math.Sin(MathHelper.Pi * NPC.Opacity)); + forcefieldOpacity = Utils.InverseLerp(0.1f, 0.6f, NPC.Opacity, true); + if (NPC.alpha >= 230) { if (CalamityWorld.downedSCal && !BossRushEvent.BossRushActive) { // Create a teleport line effect - Dust.QuickDustLine(npc.Center, initialRitualPosition, 500f, Color.Red); - npc.Center = initialRitualPosition; + Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, Color.Red); + NPC.Center = initialRitualPosition; // Make the town NPC spawn. if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 12, ModContent.NPCType()); + NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y + 12, ModContent.NPCType()); } - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; } - for (int i = 0; i < MathHelper.Lerp(2f, 6f, 1f - npc.Opacity); i++) + for (int i = 0; i < MathHelper.Lerp(2f, 6f, 1f - NPC.Opacity); i++) { - Dust brimstoneFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Fire); + Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Fire); brimstoneFire.color = Color.Red; brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); @@ -605,14 +606,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (attackCastDelay > 0) { attackCastDelay--; - npc.velocity *= 0.94f; - npc.damage = 0; - npc.dontTakeDamage = true; + NPC.velocity *= 0.94f; + NPC.damage = 0; + NPC.dontTakeDamage = true; // Make a magic effect over time. for (int i = 0; i < (attackCastDelay == 0 ? 16 : 1); i++) { - Vector2 dustSpawnPosition = npc.Bottom; + Vector2 dustSpawnPosition = NPC.Bottom; float horizontalSpawnOffset = bodyWidth * Main.rand.NextFloat(0.42f, 0.5f); if (Main.rand.NextBool(2)) horizontalSpawnOffset *= -1f; @@ -622,7 +623,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas magic.color = Color.Lerp(Color.Red, Color.Orange, Main.rand.NextFloat(0.8f)); magic.noGravity = true; magic.velocity = Vector2.UnitY * -Main.rand.NextFloat(5f, 9f); - magic.scale = 1f + npc.velocity.Y * 0.35f; + magic.scale = 1f + NPC.velocity.Y * 0.35f; } if ((startBattle && !hasSummonedSepulcher1) || (gettingTired && !hasSummonedSepulcher2)) @@ -633,8 +634,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (attackCastDelay == 0) { - npc.dontTakeDamage = false; - npc.netUpdate = true; + NPC.dontTakeDamage = false; + NPC.netUpdate = true; } FrameType = FrameAnimationType.Casting; @@ -646,12 +647,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas { despawnProj = true; bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; + NPC.damage = 0; + NPC.chaseable = false; + NPC.dontTakeDamage = true; if (!canDespawn) - npc.velocity *= 0.95f; + NPC.velocity *= 0.95f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -690,25 +691,25 @@ namespace CalamityMod.NPCs.SupremeCalamitas attackCastDelay = sepulcherSpawnCastTime; for (int i = 0; i < 40; i++) { - Dust castFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-70f, 70f), (int)CalamityDusts.Brimstone); + Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), (int)CalamityDusts.Brimstone); castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); castFire.fadeIn = 1.25f; castFire.noGravity = true; } - npc.Center = safeBox.TopRight() + new Vector2(-120f, 620f); + NPC.Center = safeBox.TopRight() + new Vector2(-120f, 620f); for (int i = 0; i < 40; i++) { - Dust castFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-70f, 70f), (int)CalamityDusts.Brimstone); + Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), (int)CalamityDusts.Brimstone); castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); castFire.fadeIn = 1.25f; castFire.noGravity = true; } - Main.PlaySound(SoundID.DD2_DarkMageCastHeal, player.Center); + SoundEngine.PlaySound(SoundID.DD2_DarkMageCastHeal, player.Center); startBattle = true; } #endregion @@ -717,12 +718,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas { despawnProj = true; bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; + NPC.damage = 0; + NPC.chaseable = false; + NPC.dontTakeDamage = true; if (!canDespawn) - npc.velocity *= 0.95f; + NPC.velocity *= 0.95f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -769,7 +770,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameType = FrameAnimationType.Casting; return; } - if (!startSecondAttack && (npc.life <= npc.lifeMax * 0.75)) + if (!startSecondAttack && (NPC.life <= NPC.lifeMax * 0.75)) { if (!BossRushEvent.BossRushActive) { @@ -787,12 +788,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas { despawnProj = true; bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; + NPC.damage = 0; + NPC.chaseable = false; + NPC.dontTakeDamage = true; if (!canDespawn) - npc.velocity *= 0.95f; + NPC.velocity *= 0.95f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -830,7 +831,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameType = FrameAnimationType.Casting; return; } - if (!startThirdAttack && (npc.life <= npc.lifeMax * 0.5)) + if (!startThirdAttack && (NPC.life <= NPC.lifeMax * 0.5)) { // Switch from the Grief section of Stained, Brutal Calamity to the Lament section. music = CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas2") ?? MusicID.Boss3; @@ -851,12 +852,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas { despawnProj = true; bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; + NPC.damage = 0; + NPC.chaseable = false; + NPC.dontTakeDamage = true; if (!canDespawn) - npc.velocity *= 0.95f; + NPC.velocity *= 0.95f; if (Main.netMode != NetmodeID.MultiplayerClient) // More clustered attack { @@ -903,7 +904,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameType = FrameAnimationType.Casting; return; } - if (!startFourthAttack && (npc.life <= npc.lifeMax * 0.3)) + if (!startFourthAttack && (NPC.life <= NPC.lifeMax * 0.3)) { // Switch from the Lament section of Stained, Brutal Calamity to the Epiphany section. music = CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas3") ?? MusicID.LunarBoss; @@ -924,12 +925,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas { despawnProj = true; bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; + NPC.damage = 0; + NPC.chaseable = false; + NPC.dontTakeDamage = true; if (!canDespawn) - npc.velocity *= 0.95f; + NPC.velocity *= 0.95f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -976,7 +977,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameType = FrameAnimationType.Casting; return; } - if (!startFifthAttack && (npc.life <= npc.lifeMax * 0.1)) + if (!startFifthAttack && (NPC.life <= NPC.lifeMax * 0.1)) { string key = "Mods.CalamityMod.SCalBH5Text"; @@ -998,14 +999,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Switch from the Epiphany section of Stained, Brutal Calamity to the Acceptance section. music = CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas4") ?? MusicID.Eerie; - if (npc.velocity.Y < 9f) - npc.velocity.Y += 0.185f; - npc.noTileCollide = false; - npc.noGravity = false; - npc.damage = 0; + if (NPC.velocity.Y < 9f) + NPC.velocity.Y += 0.185f; + NPC.noTileCollide = false; + NPC.noGravity = false; + NPC.damage = 0; if (!canDespawn) - npc.velocity.X *= 0.96f; + NPC.velocity.X *= 0.96f; if (CalamityWorld.downedSCal && !BossRushEvent.BossRushActive) { @@ -1013,7 +1014,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { for (int i = 0; i < 24; i++) { - Dust brimstoneFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Fire); + Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Fire); brimstoneFire.color = Color.Red; brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); @@ -1021,8 +1022,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas brimstoneFire.noGravity = true; } - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; NPCLoot(); } } @@ -1036,14 +1037,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (BossRushEvent.BossRushActive) { - npc.chaseable = true; - npc.dontTakeDamage = false; + NPC.chaseable = true; + NPC.dontTakeDamage = false; return; } for (int i = 0; i < 24; i++) { - Dust brimstoneFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Fire); + Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Fire); brimstoneFire.color = Color.Red; brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); @@ -1051,17 +1052,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas brimstoneFire.noGravity = true; } - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; NPCLoot(); return; } giveUpCounter--; - npc.chaseable = false; - npc.dontTakeDamage = true; + NPC.chaseable = false; + NPC.dontTakeDamage = true; return; } - if (!gettingTired5 && (npc.life <= npc.lifeMax * 0.01)) + if (!gettingTired5 && (NPC.life <= NPC.lifeMax * 0.01)) { for (int x = 0; x < Main.maxProjectiles; x++) { @@ -1083,7 +1084,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas gettingTired5 = true; return; } - else if (!gettingTired4 && (npc.life <= npc.lifeMax * 0.02)) + else if (!gettingTired4 && (NPC.life <= NPC.lifeMax * 0.02)) { if (!BossRushEvent.BossRushActive) { @@ -1095,7 +1096,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas gettingTired4 = true; return; } - else if (!gettingTired3 && (npc.life <= npc.lifeMax * 0.04)) + else if (!gettingTired3 && (NPC.life <= NPC.lifeMax * 0.04)) { if (!BossRushEvent.BossRushActive) { @@ -1107,7 +1108,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas gettingTired3 = true; return; } - else if (!gettingTired2 && (npc.life <= npc.lifeMax * 0.06)) + else if (!gettingTired2 && (NPC.life <= NPC.lifeMax * 0.06)) { if (!BossRushEvent.BossRushActive) { @@ -1119,30 +1120,30 @@ namespace CalamityMod.NPCs.SupremeCalamitas gettingTired2 = true; return; } - else if (!gettingTired && (npc.life <= npc.lifeMax * 0.08)) + else if (!gettingTired && (NPC.life <= NPC.lifeMax * 0.08)) { attackCastDelay = sepulcherSpawnCastTime; for (int i = 0; i < 40; i++) { - Dust castFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-70f, 70f), (int)CalamityDusts.Brimstone); + Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), (int)CalamityDusts.Brimstone); castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); castFire.fadeIn = 1.25f; castFire.noGravity = true; } - npc.Center = safeBox.TopRight() + new Vector2(-120f, 620f); + NPC.Center = safeBox.TopRight() + new Vector2(-120f, 620f); for (int i = 0; i < 40; i++) { - Dust castFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-70f, 70f), (int)CalamityDusts.Brimstone); + Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), (int)CalamityDusts.Brimstone); castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); castFire.fadeIn = 1.25f; castFire.noGravity = true; } - Main.PlaySound(SoundID.DD2_DarkMageCastHeal, player.Center); + SoundEngine.PlaySound(SoundID.DD2_DarkMageCastHeal, player.Center); gettingTired = true; return; } @@ -1176,7 +1177,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } #endregion #region TransformSeekerandBrotherTriggers - if (!halfLife && (npc.life <= npc.lifeMax * 0.4)) + if (!halfLife && (NPC.life <= NPC.lifeMax * 0.4)) { if (!BossRushEvent.BossRushActive) { @@ -1188,7 +1189,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas halfLife = true; } - if (npc.life <= npc.lifeMax * 0.2) + if (NPC.life <= NPC.lifeMax * 0.2) { if (!secondStage) { @@ -1201,64 +1202,64 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(SoundID.Item74, npc.position); + SoundEngine.PlaySound(SoundID.Item74, NPC.position); for (int I = 0; I < 20; I++) { - int FireEye = NPC.NewNPC((int)(vectorCenter.X + (Math.Sin(I * 18) * 300)), (int)(vectorCenter.Y + (Math.Cos(I * 18) * 300)), ModContent.NPCType(), npc.whoAmI, 0, 0, 0, -1); + int FireEye = NPC.NewNPC((int)(vectorCenter.X + (Math.Sin(I * 18) * 300)), (int)(vectorCenter.Y + (Math.Cos(I * 18) * 300)), ModContent.NPCType(), NPC.whoAmI, 0, 0, 0, -1); NPC Eye = Main.npc[FireEye]; Eye.ai[0] = I * 18; Eye.ai[3] = I * 18; } } - Main.PlaySound(SoundID.DD2_DarkMageHealImpact, player.Center); + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, player.Center); secondStage = true; } } - if (bossLife == 0f && npc.life > 0) + if (bossLife == 0f && NPC.life > 0) { - bossLife = npc.lifeMax; + bossLife = NPC.lifeMax; } - if (npc.life > 0) + if (NPC.life > 0) { - if (npc.life < npc.lifeMax * 0.45f && !enteredBrothersPhase) + if (NPC.life < NPC.lifeMax * 0.45f && !enteredBrothersPhase) { enteredBrothersPhase = true; attackCastDelay = brothersSpawnCastTime; - npc.netUpdate = true; + NPC.netUpdate = true; } } #endregion #region FirstStage - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; if (wormAlive) { - npc.dontTakeDamage = true; - npc.chaseable = false; + NPC.dontTakeDamage = true; + NPC.chaseable = false; } else { if (cataclysmAlive || catastropheAlive) { - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.damage = 0; + NPC.dontTakeDamage = true; + NPC.chaseable = false; + NPC.damage = 0; if (!canDespawn) - npc.velocity *= 0.95f; + NPC.velocity *= 0.95f; return; } else { - npc.dontTakeDamage = false; - npc.chaseable = true; + NPC.dontTakeDamage = false; + NPC.chaseable = true; } } - if (npc.ai[1] == -1f) + if (NPC.ai[1] == -1f) { phaseChange++; if (phaseChange > 23) @@ -1349,13 +1350,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas break; } - npc.ai[1] = phase; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[1] = phase; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; } else { - if (npc.ai[1] == 0f) + if (NPC.ai[1] == 0f) { float num823 = 12f; float num824 = 0.12f; @@ -1367,7 +1368,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas num824 *= 0.5f; } - Vector2 vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector82 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num825 = player.position.X + (player.width / 2) - vector82.X; float num826 = player.position.Y + (player.height / 2) - 550f - vector82.Y; float num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); @@ -1378,51 +1379,51 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) { - if (npc.velocity.X < num825) + if (NPC.velocity.X < num825) { - npc.velocity.X += num824; - if (npc.velocity.X < 0f && num825 > 0f) - npc.velocity.X += num824; + NPC.velocity.X += num824; + if (NPC.velocity.X < 0f && num825 > 0f) + NPC.velocity.X += num824; } - else if (npc.velocity.X > num825) + else if (NPC.velocity.X > num825) { - npc.velocity.X -= num824; - if (npc.velocity.X > 0f && num825 < 0f) - npc.velocity.X -= num824; + NPC.velocity.X -= num824; + if (NPC.velocity.X > 0f && num825 < 0f) + NPC.velocity.X -= num824; } - if (npc.velocity.Y < num826) + if (NPC.velocity.Y < num826) { - npc.velocity.Y += num824; - if (npc.velocity.Y < 0f && num826 > 0f) - npc.velocity.Y += num824; + NPC.velocity.Y += num824; + if (NPC.velocity.Y < 0f && num826 > 0f) + NPC.velocity.Y += num824; } - else if (npc.velocity.Y > num826) + else if (NPC.velocity.Y > num826) { - npc.velocity.Y -= num824; - if (npc.velocity.Y > 0f && num826 < 0f) - npc.velocity.Y -= num824; + NPC.velocity.Y -= num824; + if (NPC.velocity.Y > 0f && num826 < 0f) + NPC.velocity.Y -= num824; } } - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 300f) { - npc.ai[1] = -1f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[1] = -1f; + NPC.TargetClosest(); + NPC.netUpdate = true; } - vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + vector82 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); num825 = player.position.X + (player.width / 2) - vector82.X; num826 = player.position.Y + (player.height / 2) - vector82.Y; - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 90f) + NPC.localAI[1] += wormAlive ? 0.5f : 1f; + if (NPC.localAI[1] > 90f) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; float num828 = 10f * uDieLul; - Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 value9 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num180 = player.position.X + player.width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; @@ -1439,7 +1440,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { canFireSplitingFireball = false; randomShot = ModContent.ProjectileType(); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), NPC.Center); num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num828 / num827; num825 *= num827; @@ -1461,14 +1462,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; + NPC.netUpdate = true; } } else if (randomShot == 1 && canFireSplitingFireball) { canFireSplitingFireball = false; randomShot = ModContent.ProjectileType(); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), NPC.Center); num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num828 / num827; num825 *= num827; @@ -1490,14 +1491,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; + NPC.netUpdate = true; } } else { canFireSplitingFireball = true; randomShot = ModContent.ProjectileType(); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), NPC.Center); for (int num186 = 0; num186 < 8; num186++) { num180 = player.position.X + player.width * 0.5f - value9.X; @@ -1525,7 +1526,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, barrageDamage, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; + NPC.netUpdate = true; } } } @@ -1533,21 +1534,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameType = FrameAnimationType.FasterUpwardDraft; } - else if (npc.ai[1] == 1f) + else if (NPC.ai[1] == 1f) { float num383 = wormAlive ? 26f : 30f; - if (npc.life < npc.lifeMax * 0.95) + if (NPC.life < NPC.lifeMax * 0.95) num383 += 1f; - if (npc.life < npc.lifeMax * 0.85) + if (NPC.life < NPC.lifeMax * 0.85) num383 += 1f; - if (npc.life < npc.lifeMax * 0.7) + if (NPC.life < NPC.lifeMax * 0.7) num383 += 1f; - if (npc.life < npc.lifeMax * 0.6) + if (NPC.life < NPC.lifeMax * 0.6) num383 += 1f; - if (npc.life < npc.lifeMax * 0.5) + if (NPC.life < NPC.lifeMax * 0.5) num383 += 1f; - Vector2 vector37 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector37 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num384 = player.position.X + (player.width / 2) - vector37.X; float num385 = player.position.Y + (player.height / 2) - vector37.Y; float num386 = (float)Math.Sqrt(num384 * num384 + num385 * num385); @@ -1555,59 +1556,59 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) { - npc.velocity.X = num384 * num386; - npc.velocity.Y = num385 * num386; - shieldRotation = npc.velocity.ToRotation(); - npc.netUpdate = true; + NPC.velocity.X = num384 * num386; + NPC.velocity.Y = num385 * num386; + shieldRotation = NPC.velocity.ToRotation(); + NPC.netUpdate = true; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/SCalDash"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/SCalDash"), NPC.Center); } - npc.ai[1] = 2f; + NPC.ai[1] = 2f; } - else if (npc.ai[1] == 2f) + else if (NPC.ai[1] == 2f) { - npc.ai[2] += 1f; + NPC.ai[2] += 1f; - if (Math.Abs(npc.velocity.X) > 0.15f) - npc.spriteDirection = (npc.velocity.X < 0f).ToDirectionInt(); - if (npc.ai[2] >= 25f) + if (Math.Abs(NPC.velocity.X) > 0.15f) + NPC.spriteDirection = (NPC.velocity.X < 0f).ToDirectionInt(); + if (NPC.ai[2] >= 25f) { if (!canDespawn) { - npc.velocity *= 0.96f; + NPC.velocity *= 0.96f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + NPC.velocity.Y = 0f; } } - bool willChargeAgain = npc.ai[3] + 1 < 2; + bool willChargeAgain = NPC.ai[3] + 1 < 2; - if (npc.ai[2] >= 70f) + if (NPC.ai[2] >= 70f) { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.TargetClosest(); + NPC.ai[3] += 1f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); if (!willChargeAgain) - npc.ai[1] = -1f; + NPC.ai[1] = -1f; else - npc.ai[1] = 1f; + NPC.ai[1] = 1f; } - if (willChargeAgain && npc.ai[2] > 50f) + if (willChargeAgain && NPC.ai[2] > 50f) { - float idealRotation = npc.AngleTo(player.Center); + float idealRotation = NPC.AngleTo(player.Center); shieldRotation = shieldRotation.AngleLerp(idealRotation, 0.125f); shieldRotation = shieldRotation.AngleTowards(idealRotation, 0.18f); } FrameType = FrameAnimationType.FasterUpwardDraft; } - else if (npc.ai[1] == 3f) + else if (NPC.ai[1] == 3f) { float num412 = 32f; float num413 = 1.2f; @@ -1620,11 +1621,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas } int num414 = 1; - if (npc.position.X + (npc.width / 2) < player.position.X + player.width) + if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) num414 = -1; - Vector2 handPosition = npc.Center + new Vector2(npc.spriteDirection * -18f, 2f); - Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 handPosition = NPC.Center + new Vector2(NPC.spriteDirection * -18f, 2f); + Vector2 vector40 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num415 = player.position.X + (player.width / 2) + (num414 * 600) - vector40.X; float num416 = player.position.Y + (player.height / 2) - vector40.Y; float num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); @@ -1635,57 +1636,57 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) { - if (npc.velocity.X < num415) + if (NPC.velocity.X < num415) { - npc.velocity.X += num413; - if (npc.velocity.X < 0f && num415 > 0f) - npc.velocity.X += num413; + NPC.velocity.X += num413; + if (NPC.velocity.X < 0f && num415 > 0f) + NPC.velocity.X += num413; } - else if (npc.velocity.X > num415) + else if (NPC.velocity.X > num415) { - npc.velocity.X -= num413; - if (npc.velocity.X > 0f && num415 < 0f) - npc.velocity.X -= num413; + NPC.velocity.X -= num413; + if (NPC.velocity.X > 0f && num415 < 0f) + NPC.velocity.X -= num413; } - if (npc.velocity.Y < num416) + if (NPC.velocity.Y < num416) { - npc.velocity.Y += num413; - if (npc.velocity.Y < 0f && num416 > 0f) - npc.velocity.Y += num413; + NPC.velocity.Y += num413; + if (NPC.velocity.Y < 0f && num416 > 0f) + NPC.velocity.Y += num413; } - else if (npc.velocity.Y > num416) + else if (NPC.velocity.Y > num416) { - npc.velocity.Y -= num413; - if (npc.velocity.Y > 0f && num416 < 0f) - npc.velocity.Y -= num413; + NPC.velocity.Y -= num413; + if (NPC.velocity.Y > 0f && num416 < 0f) + NPC.velocity.Y -= num413; } } - npc.ai[2] += 1f; - if (npc.ai[2] >= 480f) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 480f) { - npc.ai[1] = -1f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[1] = -1f; + NPC.TargetClosest(); + NPC.netUpdate = true; } else { if (!player.dead) - npc.ai[3] += wormAlive ? 0.5f : 1f; + NPC.ai[3] += wormAlive ? 0.5f : 1f; - if (npc.ai[3] >= 20f) + if (NPC.ai[3] >= 20f) { - npc.ai[3] = 0f; - vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + NPC.ai[3] = 0f; + vector40 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); num415 = player.position.X + (player.width / 2) - vector40.X; num416 = player.position.Y + (player.height / 2) - vector40.Y; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneHellblastSound"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneHellblastSound"), NPC.Center); // Release a burst of magic dust along with a brimstone hellblast skull. for (int i = 0; i < 25; i++) { Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = npc.DirectionTo(player.Center).RotatedByRandom(0.31f) * Main.rand.NextFloat(3f, 5f) + npc.velocity; + brimstoneMagic.velocity = NPC.DirectionTo(player.Center).RotatedByRandom(0.31f) * Main.rand.NextFloat(3f, 5f) + NPC.velocity; brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); brimstoneMagic.noGravity = true; brimstoneMagic.color = Color.OrangeRed; @@ -1711,7 +1712,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.rand.NextBool(2)) { Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = Vector2.UnitY.RotatedByRandom(0.14f) * Main.rand.NextFloat(-3.5f, -3f) + npc.velocity; + brimstoneMagic.velocity = Vector2.UnitY.RotatedByRandom(0.14f) * Main.rand.NextFloat(-3.5f, -3f) + NPC.velocity; brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); brimstoneMagic.noGravity = true; brimstoneMagic.noLight = true; @@ -1719,10 +1720,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameType = FrameAnimationType.OutwardHandCast; } - else if (npc.ai[1] == 4f) + else if (NPC.ai[1] == 4f) { int num831 = 1; - if (npc.position.X + (npc.width / 2) < player.position.X + player.width) + if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) num831 = -1; float num832 = 32f; @@ -1735,7 +1736,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas num833 *= 0.5f; } - Vector2 vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector83 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num834 = player.position.X + (player.width / 2) + (num831 * 750) - vector83.X; //600 float num835 = player.position.Y + (player.height / 2) - vector83.Y; float num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); @@ -1746,61 +1747,61 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) { - if (npc.velocity.X < num834) + if (NPC.velocity.X < num834) { - npc.velocity.X += num833; - if (npc.velocity.X < 0f && num834 > 0f) - npc.velocity.X += num833; + NPC.velocity.X += num833; + if (NPC.velocity.X < 0f && num834 > 0f) + NPC.velocity.X += num833; } - else if (npc.velocity.X > num834) + else if (NPC.velocity.X > num834) { - npc.velocity.X -= num833; - if (npc.velocity.X > 0f && num834 < 0f) - npc.velocity.X -= num833; + NPC.velocity.X -= num833; + if (NPC.velocity.X > 0f && num834 < 0f) + NPC.velocity.X -= num833; } - if (npc.velocity.Y < num835) + if (NPC.velocity.Y < num835) { - npc.velocity.Y += num833; - if (npc.velocity.Y < 0f && num835 > 0f) - npc.velocity.Y += num833; + NPC.velocity.Y += num833; + if (NPC.velocity.Y < 0f && num835 > 0f) + NPC.velocity.Y += num833; } - else if (npc.velocity.Y > num835) + else if (NPC.velocity.Y > num835) { - npc.velocity.Y -= num833; - if (npc.velocity.Y > 0f && num835 < 0f) - npc.velocity.Y -= num833; + NPC.velocity.Y -= num833; + if (NPC.velocity.Y > 0f && num835 < 0f) + NPC.velocity.Y -= num833; } } - vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + vector83 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); num834 = player.position.X + (player.width / 2) - vector83.X; num835 = player.position.Y + (player.height / 2) - vector83.Y; int shootRate = wormAlive ? 280 : 140; - npc.localAI[1]++; + NPC.localAI[1]++; FrameChangeSpeed = 0.175f; FrameType = FrameAnimationType.BlastCast; - if (npc.localAI[1] > shootRate) + if (NPC.localAI[1] > shootRate) { - Vector2 handPosition = npc.Center + new Vector2(npc.spriteDirection * -22f, 2f); + Vector2 handPosition = NPC.Center + new Vector2(NPC.spriteDirection * -22f, 2f); // Release a burst of magic dust when punching. for (int i = 0; i < 25; i++) { Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = npc.DirectionTo(player.Center).RotatedByRandom(0.24f) * Main.rand.NextFloat(5f, 7f) + npc.velocity; + brimstoneMagic.velocity = NPC.DirectionTo(player.Center).RotatedByRandom(0.24f) * Main.rand.NextFloat(5f, 7f) + NPC.velocity; brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); brimstoneMagic.noGravity = true; brimstoneMagic.color = Color.OrangeRed; brimstoneMagic.fadeIn = 1.5f; brimstoneMagic.noLight = true; } - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), NPC.Center); float num837 = 5f * uDieLul; int num839 = ModContent.ProjectileType(); num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); @@ -1813,106 +1814,106 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 300f) { - npc.ai[1] = -1f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[1] = -1f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } } - if (npc.life < npc.lifeMax * 0.4) + if (NPC.life < NPC.lifeMax * 0.4) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } #endregion #region Transition - else if (npc.ai[0] == 1f || npc.ai[0] == 2f) + else if (NPC.ai[0] == 1f || NPC.ai[0] == 2f) { - npc.dontTakeDamage = true; - npc.chaseable = false; + NPC.dontTakeDamage = true; + NPC.chaseable = false; - if (npc.ai[0] == 1f) + if (NPC.ai[0] == 1f) { - npc.ai[2] += 0.005f; - if (npc.ai[2] > 0.5) - npc.ai[2] = 0.5f; + NPC.ai[2] += 0.005f; + if (NPC.ai[2] > 0.5) + NPC.ai[2] = 0.5f; } else { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - npc.ai[2] = 0f; + NPC.ai[2] -= 0.005f; + if (NPC.ai[2] < 0f) + NPC.ai[2] = 0f; } - npc.ai[1] += 1f; - if (npc.ai[1] == 100f) + NPC.ai[1] += 1f; + if (NPC.ai[1] == 100f) { - npc.ai[0] += 1f; - npc.ai[1] = 0f; + NPC.ai[0] += 1f; + NPC.ai[1] = 0f; - if (npc.ai[0] == 3f) - npc.ai[2] = 0f; + if (NPC.ai[0] == 3f) + NPC.ai[2] = 0f; else { for (int num388 = 0; num388 < 50; num388++) - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SupremeCalamitasSpawn"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SupremeCalamitasSpawn"), NPC.Center); } } for (int i = 0; i < 4; i++) { - Dust brimstoneFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-24f, 24f), (int)CalamityDusts.Brimstone); + Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), (int)CalamityDusts.Brimstone); brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2.75f, 4.25f); brimstoneFire.noGravity = true; } if (!canDespawn) { - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + NPC.velocity.Y = 0f; } } #endregion #region LastStage else { - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; if (wormAlive) { - npc.dontTakeDamage = true; - npc.chaseable = false; + NPC.dontTakeDamage = true; + NPC.chaseable = false; } else { if (NPC.AnyNPCs(ModContent.NPCType())) { - npc.dontTakeDamage = true; - npc.chaseable = false; + NPC.dontTakeDamage = true; + NPC.chaseable = false; } else { - npc.dontTakeDamage = false; - npc.chaseable = true; + NPC.dontTakeDamage = false; + NPC.chaseable = true; } } - if (npc.ai[1] == -1f) + if (NPC.ai[1] == -1f) { phaseChange++; if (phaseChange > 23) @@ -2003,13 +2004,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas break; } - npc.ai[1] = phase; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[1] = phase; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; } else { - if (npc.ai[1] == 0f) + if (NPC.ai[1] == 0f) { float num823 = 12f; float num824 = 0.12f; @@ -2021,7 +2022,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas num824 *= 0.5f; } - Vector2 vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector82 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num825 = player.position.X + (player.width / 2) - vector82.X; float num826 = player.position.Y + (player.height / 2) - 550f - vector82.Y; float num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); @@ -2032,52 +2033,52 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) { - if (npc.velocity.X < num825) + if (NPC.velocity.X < num825) { - npc.velocity.X += num824; - if (npc.velocity.X < 0f && num825 > 0f) - npc.velocity.X += num824; + NPC.velocity.X += num824; + if (NPC.velocity.X < 0f && num825 > 0f) + NPC.velocity.X += num824; } - else if (npc.velocity.X > num825) + else if (NPC.velocity.X > num825) { - npc.velocity.X -= num824; - if (npc.velocity.X > 0f && num825 < 0f) - npc.velocity.X -= num824; + NPC.velocity.X -= num824; + if (NPC.velocity.X > 0f && num825 < 0f) + NPC.velocity.X -= num824; } - if (npc.velocity.Y < num826) + if (NPC.velocity.Y < num826) { - npc.velocity.Y += num824; - if (npc.velocity.Y < 0f && num826 > 0f) - npc.velocity.Y += num824; + NPC.velocity.Y += num824; + if (NPC.velocity.Y < 0f && num826 > 0f) + NPC.velocity.Y += num824; } - else if (npc.velocity.Y > num826) + else if (NPC.velocity.Y > num826) { - npc.velocity.Y -= num824; - if (npc.velocity.Y > 0f && num826 < 0f) - npc.velocity.Y -= num824; + NPC.velocity.Y -= num824; + if (NPC.velocity.Y > 0f && num826 < 0f) + NPC.velocity.Y -= num824; } } - npc.ai[2] += 1f; - if (npc.ai[2] >= 240f) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 240f) { - npc.ai[1] = -1f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[1] = -1f; + NPC.TargetClosest(); + NPC.netUpdate = true; } - vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + vector82 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); num825 = player.position.X + (player.width / 2) - vector82.X; num826 = player.position.Y + (player.height / 2) - vector82.Y; - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 60f) + NPC.localAI[1] += wormAlive ? 0.5f : 1f; + if (NPC.localAI[1] > 60f) { - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; float num828 = 10f * uDieLul; - Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 value9 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num180 = player.position.X + player.width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; @@ -2092,7 +2093,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas int randomShot = Main.rand.Next(6); if (randomShot == 0 && canFireSplitingFireball) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), NPC.Center); canFireSplitingFireball = false; randomShot = ModContent.ProjectileType(); num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); @@ -2116,12 +2117,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; + NPC.netUpdate = true; } } else if (randomShot == 1 && canFireSplitingFireball) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), NPC.Center); canFireSplitingFireball = false; randomShot = ModContent.ProjectileType(); num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); @@ -2145,12 +2146,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; + NPC.netUpdate = true; } } else { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), NPC.Center); canFireSplitingFireball = true; randomShot = ModContent.ProjectileType(); for (int num186 = 0; num186 < 8; num186++) @@ -2180,23 +2181,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, barrageDamage, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; + NPC.netUpdate = true; } } } } } - else if (npc.ai[1] == 1f) + else if (NPC.ai[1] == 1f) { float num383 = wormAlive ? 31f : 35f; - if (npc.life < npc.lifeMax * 0.3) + if (NPC.life < NPC.lifeMax * 0.3) num383 += 1f; - if (npc.life < npc.lifeMax * 0.2) + if (NPC.life < NPC.lifeMax * 0.2) num383 += 1f; - if (npc.life < npc.lifeMax * 0.1) + if (NPC.life < NPC.lifeMax * 0.1) num383 += 1f; - Vector2 vector37 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector37 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num384 = player.position.X + (player.width / 2) - vector37.X; float num385 = player.position.Y + (player.height / 2) - vector37.Y; float num386 = (float)Math.Sqrt(num384 * num384 + num385 * num385); @@ -2204,57 +2205,57 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) { - npc.velocity.X = num384 * num386; - npc.velocity.Y = num385 * num386; - shieldRotation = npc.velocity.ToRotation(); - npc.netUpdate = true; + NPC.velocity.X = num384 * num386; + NPC.velocity.Y = num385 * num386; + shieldRotation = NPC.velocity.ToRotation(); + NPC.netUpdate = true; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/SCalDash"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/SCalDash"), NPC.Center); } - npc.ai[1] = 2f; + NPC.ai[1] = 2f; } - else if (npc.ai[1] == 2f) + else if (NPC.ai[1] == 2f) { - npc.ai[2] += 1f; - if (npc.ai[2] >= 25f) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 25f) { if (!canDespawn) { - npc.velocity *= 0.96f; + NPC.velocity *= 0.96f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + NPC.velocity.Y = 0f; } } - bool willChargeAgain = npc.ai[3] + 1 < 1; + bool willChargeAgain = NPC.ai[3] + 1 < 1; - if (npc.ai[2] >= 70f) + if (NPC.ai[2] >= 70f) { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.TargetClosest(); + NPC.ai[3] += 1f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); if (!willChargeAgain) - npc.ai[1] = -1f; + NPC.ai[1] = -1f; else - npc.ai[1] = 1f; + NPC.ai[1] = 1f; } - if (willChargeAgain && npc.ai[2] > 50f) + if (willChargeAgain && NPC.ai[2] > 50f) { - float idealRotation = npc.AngleTo(player.Center); + float idealRotation = NPC.AngleTo(player.Center); shieldRotation = shieldRotation.AngleLerp(idealRotation, 0.125f); shieldRotation = shieldRotation.AngleTowards(idealRotation, 0.18f); } FrameType = FrameAnimationType.FasterUpwardDraft; } - else if (npc.ai[1] == 3f) + else if (NPC.ai[1] == 3f) { float num412 = 32f; float num413 = 1.2f; @@ -2267,11 +2268,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas } int num414 = 1; - if (npc.position.X + (npc.width / 2) < player.position.X + player.width) + if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) num414 = -1; - Vector2 handPosition = npc.Center + new Vector2(npc.spriteDirection * -18f, 2f); - Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 handPosition = NPC.Center + new Vector2(NPC.spriteDirection * -18f, 2f); + Vector2 vector40 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num415 = player.position.X + (player.width / 2) + (num414 * 600) - vector40.X; float num416 = player.position.Y + (player.height / 2) - vector40.Y; float num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); @@ -2282,57 +2283,57 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) { - if (npc.velocity.X < num415) + if (NPC.velocity.X < num415) { - npc.velocity.X += num413; - if (npc.velocity.X < 0f && num415 > 0f) - npc.velocity.X += num413; + NPC.velocity.X += num413; + if (NPC.velocity.X < 0f && num415 > 0f) + NPC.velocity.X += num413; } - else if (npc.velocity.X > num415) + else if (NPC.velocity.X > num415) { - npc.velocity.X -= num413; - if (npc.velocity.X > 0f && num415 < 0f) - npc.velocity.X -= num413; + NPC.velocity.X -= num413; + if (NPC.velocity.X > 0f && num415 < 0f) + NPC.velocity.X -= num413; } - if (npc.velocity.Y < num416) + if (NPC.velocity.Y < num416) { - npc.velocity.Y += num413; - if (npc.velocity.Y < 0f && num416 > 0f) - npc.velocity.Y += num413; + NPC.velocity.Y += num413; + if (NPC.velocity.Y < 0f && num416 > 0f) + NPC.velocity.Y += num413; } - else if (npc.velocity.Y > num416) + else if (NPC.velocity.Y > num416) { - npc.velocity.Y -= num413; - if (npc.velocity.Y > 0f && num416 < 0f) - npc.velocity.Y -= num413; + NPC.velocity.Y -= num413; + if (NPC.velocity.Y > 0f && num416 < 0f) + NPC.velocity.Y -= num413; } } - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 300f) { - npc.ai[1] = -1f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[1] = -1f; + NPC.TargetClosest(); + NPC.netUpdate = true; } else { if (!player.dead) - npc.ai[3] += wormAlive ? 0.5f : 1f; + NPC.ai[3] += wormAlive ? 0.5f : 1f; - if (npc.ai[3] >= 24f) + if (NPC.ai[3] >= 24f) { - npc.ai[3] = 0f; - vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + NPC.ai[3] = 0f; + vector40 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); num415 = player.position.X + (player.width / 2) - vector40.X; num416 = player.position.Y + (player.height / 2) - vector40.Y; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneHellblastSound"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneHellblastSound"), NPC.Center); // Release a burst of magic dust along with a brimstone hellblast skull. for (int i = 0; i < 25; i++) { Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = npc.DirectionTo(player.Center).RotatedByRandom(0.31f) * Main.rand.NextFloat(3f, 5f) + npc.velocity; + brimstoneMagic.velocity = NPC.DirectionTo(player.Center).RotatedByRandom(0.31f) * Main.rand.NextFloat(3f, 5f) + NPC.velocity; brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); brimstoneMagic.noGravity = true; brimstoneMagic.color = Color.OrangeRed; @@ -2358,7 +2359,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.rand.NextBool(2)) { Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = Vector2.UnitY.RotatedByRandom(0.14f) * Main.rand.NextFloat(-3.5f, -3f) + npc.velocity; + brimstoneMagic.velocity = Vector2.UnitY.RotatedByRandom(0.14f) * Main.rand.NextFloat(-3.5f, -3f) + NPC.velocity; brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); brimstoneMagic.noGravity = true; brimstoneMagic.noLight = true; @@ -2367,10 +2368,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameChangeSpeed = 0.245f; FrameType = FrameAnimationType.PunchHandCast; } - else if (npc.ai[1] == 4f) + else if (NPC.ai[1] == 4f) { int num831 = 1; - if (npc.position.X + (npc.width / 2) < player.position.X + player.width) + if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) num831 = -1; float num832 = 32f; @@ -2383,7 +2384,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas num833 *= 0.5f; } - Vector2 vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector83 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num834 = player.position.X + (player.width / 2) + (num831 * 750) - vector83.X; //600 float num835 = player.position.Y + (player.height / 2) - vector83.Y; float num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); @@ -2394,65 +2395,65 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) { - if (npc.velocity.X < num834) + if (NPC.velocity.X < num834) { - npc.velocity.X += num833; - if (npc.velocity.X < 0f && num834 > 0f) - npc.velocity.X += num833; + NPC.velocity.X += num833; + if (NPC.velocity.X < 0f && num834 > 0f) + NPC.velocity.X += num833; } - else if (npc.velocity.X > num834) + else if (NPC.velocity.X > num834) { - npc.velocity.X -= num833; - if (npc.velocity.X > 0f && num834 < 0f) - npc.velocity.X -= num833; + NPC.velocity.X -= num833; + if (NPC.velocity.X > 0f && num834 < 0f) + NPC.velocity.X -= num833; } - if (npc.velocity.Y < num835) + if (NPC.velocity.Y < num835) { - npc.velocity.Y += num833; - if (npc.velocity.Y < 0f && num835 > 0f) - npc.velocity.Y += num833; + NPC.velocity.Y += num833; + if (NPC.velocity.Y < 0f && num835 > 0f) + NPC.velocity.Y += num833; } - else if (npc.velocity.Y > num835) + else if (NPC.velocity.Y > num835) { - npc.velocity.Y -= num833; - if (npc.velocity.Y > 0f && num835 < 0f) - npc.velocity.Y -= num833; + NPC.velocity.Y -= num833; + if (NPC.velocity.Y > 0f && num835 < 0f) + NPC.velocity.Y -= num833; } } - vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + vector83 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); num834 = player.position.X + (player.width / 2) - vector83.X; num835 = player.position.Y + (player.height / 2) - vector83.Y; int shootRate = wormAlive ? 200 : 100; - npc.localAI[1]++; - if (npc.ai[2] > 40f && (npc.localAI[1] > shootRate - 18 || npc.localAI[1] <= 15f)) + NPC.localAI[1]++; + if (NPC.ai[2] > 40f && (NPC.localAI[1] > shootRate - 18 || NPC.localAI[1] <= 15f)) { FrameChangeSpeed = 0f; FrameType = FrameAnimationType.BlastPunchCast; } - if (npc.localAI[1] > shootRate) + if (NPC.localAI[1] > shootRate) { - Vector2 handPosition = npc.Center + new Vector2(npc.spriteDirection * -22f, 2f); + Vector2 handPosition = NPC.Center + new Vector2(NPC.spriteDirection * -22f, 2f); // Release a burst of magic dust when punching. for (int i = 0; i < 25; i++) { Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); - brimstoneMagic.velocity = npc.DirectionTo(player.Center).RotatedByRandom(0.24f) * Main.rand.NextFloat(5f, 7f) + npc.velocity; + brimstoneMagic.velocity = NPC.DirectionTo(player.Center).RotatedByRandom(0.24f) * Main.rand.NextFloat(5f, 7f) + NPC.velocity; brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); brimstoneMagic.noGravity = true; brimstoneMagic.color = Color.OrangeRed; brimstoneMagic.fadeIn = 1.5f; brimstoneMagic.noLight = true; } - npc.localAI[1] = 0f; + NPC.localAI[1] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); - npc.localAI[1] = 0f; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), NPC.Center); + NPC.localAI[1] = 0f; float num837 = 5f * uDieLul; int num839 = ModContent.ProjectileType(); num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); @@ -2465,12 +2466,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - npc.ai[2] += 1f; - if (npc.ai[2] >= 240f) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 240f) { - npc.ai[1] = -1f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[1] = -1f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } } @@ -2493,7 +2494,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } float castCompletion = Utils.InverseLerp(sepulcherSpawnCastTime - 25f, 0f, attackCastDelay, true); - Vector2 armPosition = npc.Center + Vector2.UnitX * npc.spriteDirection * -8f; + Vector2 armPosition = NPC.Center + Vector2.UnitX * NPC.spriteDirection * -8f; // Emit dust at the arm position as a sort of magic effect. Dust magic = Dust.NewDustPerfect(armPosition, 264); @@ -2518,7 +2519,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (attackCastDelay == 0) { string key = "Mods.CalamityMod.SCalStartText"; - if (npc.life <= npc.lifeMax * 0.08) + if (NPC.life <= NPC.lifeMax * 0.08) key = "Mods.CalamityMod.SCalSepulcher2Text"; if (!BossRushEvent.BossRushActive) @@ -2542,7 +2543,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // And play a fire-like sound effect. hasSummonedSepulcher1 = true; - hasSummonedSepulcher2 = npc.life <= npc.lifeMax * 0.08; + hasSummonedSepulcher2 = NPC.life <= NPC.lifeMax * 0.08; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -2562,24 +2563,24 @@ namespace CalamityMod.NPCs.SupremeCalamitas spawnX = spawnXReset; spawnX2 = spawnXReset2; spawnY = spawnYReset; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); - npc.netUpdate = true; + NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); + NPC.netUpdate = true; } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/SepulcherSpawn"), target.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/SepulcherSpawn"), target.Center); } } public void DoBrothersSpawningCastAnimation(int bodyWidth, int bodyHeight) { - Vector2 leftOfCircle = npc.Center + Vector2.UnitY * bodyHeight * 0.5f - Vector2.UnitX * bodyWidth * 0.45f; - Vector2 rightOfCircle = npc.Center + Vector2.UnitY * bodyHeight * 0.5f + Vector2.UnitX * bodyWidth * 0.45f; + Vector2 leftOfCircle = NPC.Center + Vector2.UnitY * bodyHeight * 0.5f - Vector2.UnitX * bodyWidth * 0.45f; + Vector2 rightOfCircle = NPC.Center + Vector2.UnitY * bodyHeight * 0.5f + Vector2.UnitX * bodyWidth * 0.45f; if (Main.netMode != NetmodeID.MultiplayerClient && catastropheSpawnPosition == Vector2.Zero) { - catastropheSpawnPosition = npc.Center - Vector2.UnitX * 500f; - cataclysmSpawnPosition = npc.Center + Vector2.UnitX * 500f; - npc.netUpdate = true; + catastropheSpawnPosition = NPC.Center - Vector2.UnitX * 500f; + cataclysmSpawnPosition = NPC.Center + Vector2.UnitX * 500f; + NPC.netUpdate = true; } // Draw some magic dust much like the sandstorm elemental cast that approaches where the brothers will spawn. @@ -2650,7 +2651,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas CalamityUtils.SpawnBossBetter(catastropheSpawnPosition, ModContent.NPCType()); CalamityUtils.SpawnBossBetter(cataclysmSpawnPosition, ModContent.NPCType()); } - Main.PlaySound(SoundID.DD2_DarkMageHealImpact, npc.Center); + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, NPC.Center); hasSummonedBrothers = true; } } @@ -2713,29 +2714,29 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void NPCLoot() { // Create a teleport line effect - Dust.QuickDustLine(npc.Center, initialRitualPosition, 500f, Color.Red); - npc.Center = initialRitualPosition; + Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, Color.Red); + NPC.Center = initialRitualPosition; - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); // Only drops in Malice because this is Leviathan's item - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, CalamityWorld.malice); // Levi drops directly from the boss so that you cannot obtain it by difficulty swapping bags // It is one of extremely few Deathmode exclusive drops in the game - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.death); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, CalamityWorld.death); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { // Materials - DropHelper.DropItem(npc, ModContent.ItemType(), true, 18, 27); + DropHelper.DropItem(NPC, ModContent.ItemType(), true, 18, 27); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -2746,28 +2747,28 @@ namespace CalamityMod.NPCs.SupremeCalamitas ); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); // SCal vanity set (This drops all at once, or not at all) if (Main.rand.NextBool(7)) { - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); + DropHelper.DropItem(NPC, ModContent.ItemType()); } } // Other - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedSCal); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedSCal); // Increase the player's SCal kill count - if (Main.player[npc.target].Calamity().sCalKillCount < 5) - Main.player[npc.target].Calamity().sCalKillCount++; + if (Main.player[NPC.target].Calamity().sCalKillCount < 5) + Main.player[NPC.target].Calamity().sCalKillCount++; // Spawn the SCal NPC directly where the boss was - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 12, ModContent.NPCType()); + NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y + 12, ModContent.NPCType()); // Mark Supreme Calamitas as defeated CalamityWorld.downedSCal = true; @@ -2781,10 +2782,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (BossRushEvent.BossRushActive) return true; - npc.life = 1; - npc.active = true; - npc.dontTakeDamage = true; - npc.netUpdate = true; + NPC.life = 1; + NPC.active = true; + NPC.dontTakeDamage = true; + NPC.netUpdate = true; return false; } @@ -2803,13 +2804,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas { cooldownSlot = 1; - Vector2 shieldCenter = npc.Center + shieldRotation.ToRotationVector2() * 24f; + Vector2 shieldCenter = NPC.Center + shieldRotation.ToRotationVector2() * 24f; Vector2 shieldTop = shieldCenter - (shieldRotation + MathHelper.PiOver2).ToRotationVector2() * 61f; Vector2 shieldBottom = shieldCenter - (shieldRotation + MathHelper.PiOver2).ToRotationVector2() * 61f; float _ = 0f; bool collidingWithShield = Collision.CheckAABBvLineCollision(target.TopLeft, target.Size, shieldTop, shieldBottom, 64f, ref _) && shieldOpacity > 0.55f; - return collidingWithShield || npc.Hitbox.Intersects(target.Hitbox); + return collidingWithShield || NPC.Hitbox.Intersects(target.Hitbox); } public override void FindFrame(int frameHeight) @@ -2820,43 +2821,43 @@ namespace CalamityMod.NPCs.SupremeCalamitas int shootRate = wormAlive ? 200 : 100; // Special punch logic for the blast attack. - if (FrameType == FrameAnimationType.BlastPunchCast && (npc.localAI[1] > shootRate - 18 || npc.localAI[1] <= 15f)) + if (FrameType == FrameAnimationType.BlastPunchCast && (NPC.localAI[1] > shootRate - 18 || NPC.localAI[1] <= 15f)) { - if (npc.localAI[1] > shootRate - 18) - npc.frame.Y = (int)MathHelper.Lerp(0, 3, Utils.InverseLerp(shootRate - 18, shootRate, npc.localAI[1], true)); + if (NPC.localAI[1] > shootRate - 18) + NPC.frame.Y = (int)MathHelper.Lerp(0, 3, Utils.InverseLerp(shootRate - 18, shootRate, NPC.localAI[1], true)); else - npc.frame.Y = (int)MathHelper.Lerp(3, 5, Utils.InverseLerp(0f, 15f, npc.localAI[1], true)); - npc.frame.Y += (int)FrameType * 6; + NPC.frame.Y = (int)MathHelper.Lerp(3, 5, Utils.InverseLerp(0f, 15f, NPC.localAI[1], true)); + NPC.frame.Y += (int)FrameType * 6; } else { - npc.frameCounter += FrameChangeSpeed; - npc.frameCounter %= 6; - npc.frame.Y = (int)npc.frameCounter + (int)FrameType * 6; + NPC.frameCounter += FrameChangeSpeed; + NPC.frameCounter %= 6; + NPC.frame.Y = (int)NPC.frameCounter + (int)FrameType * 6; } } public override Color? GetAlpha(Color drawColor) { if (willCharge) - return drawColor * npc.Opacity * 0.45f; + return drawColor * NPC.Opacity * 0.45f; return null; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = CalamityWorld.downedSCal && !BossRushEvent.BossRushActive ? Main.npcTexture[npc.type] : ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasHooded"); + Texture2D texture2D15 = CalamityWorld.downedSCal && !BossRushEvent.BossRushActive ? Main.npcTexture[NPC.type] : ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasHooded"); - Vector2 vector11 = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[npc.type] / 2f); + Vector2 vector11 = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2f); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 7; - Rectangle frame = texture2D15.Frame(2, Main.npcFrameCount[npc.type], npc.frame.Y / Main.npcFrameCount[npc.type], npc.frame.Y % Main.npcFrameCount[npc.type]); + Rectangle frame = texture2D15.Frame(2, Main.npcFrameCount[NPC.type], NPC.frame.Y / Main.npcFrameCount[NPC.type], NPC.frame.Y % Main.npcFrameCount[NPC.type]); if (CalamityConfig.Instance.Afterimages) { @@ -2864,19 +2865,19 @@ namespace CalamityMod.NPCs.SupremeCalamitas { Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - bool inPhase2 = npc.ai[0] >= 3f && npc.life > npc.lifeMax * 0.01; - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + bool inPhase2 = NPC.ai[0] >= 3f && NPC.life > NPC.lifeMax * 0.01; + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); if (inPhase2) { @@ -2885,15 +2886,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas vector43 += Main.rand.NextVector2Circular(0.25f, 0.7f); // And gain a flaming aura. - Color auraColor = npc.GetAlpha(Color.Red) * 0.4f; + Color auraColor = NPC.GetAlpha(Color.Red) * 0.4f; for (int i = 0; i < 7; i++) { Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTime * 4f).ToRotationVector2(); rotationalDrawOffset *= MathHelper.Lerp(3f, 4.25f, (float)Math.Cos(Main.GlobalTime * 4f) * 0.5f + 0.5f); - spriteBatch.Draw(texture2D15, vector43 + rotationalDrawOffset, frame, auraColor, npc.rotation, vector11, npc.scale * 1.1f, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43 + rotationalDrawOffset, frame, auraColor, NPC.rotation, vector11, NPC.scale * 1.1f, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, frame, NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); DrawForcefield(spriteBatch); DrawShield(spriteBatch); @@ -2907,14 +2908,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas float intensity = hitTimer / 35f; // Shield intensity is always high during invincibility, except during cast animations, so that she can be more easily seen. - if (npc.dontTakeDamage && attackCastDelay <= 0) + if (NPC.dontTakeDamage && attackCastDelay <= 0) intensity = 0.75f + Math.Abs((float)Math.Cos(Main.GlobalTime * 1.7f)) * 0.1f; // Make the forcefield weaker in the second phase as a means of showing desparation. - if (npc.ai[0] >= 3f) + if (NPC.ai[0] >= 3f) intensity *= 0.6f; - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; float flickerPower = 0f; if (lifeRatio < 0.6f) flickerPower += 0.1f; @@ -2928,20 +2929,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas opacity *= MathHelper.Lerp(1f, MathHelper.Max(1f - flickerPower, 0.56f), (float)Math.Pow(Math.Cos(Main.GlobalTime * MathHelper.Lerp(3f, 5f, flickerPower)), 24D)); // During/prior to a charge the forcefield is always darker than usual and thus its intensity is also higher. - if (!npc.dontTakeDamage && (willCharge || npc.ai[1] == 2f)) + if (!NPC.dontTakeDamage && (willCharge || NPC.ai[1] == 2f)) intensity = 1.1f; // Dampen the opacity and intensity slightly, to allow SCal to be more easily visible inside of the forcefield. intensity *= 0.75f; opacity *= 0.75f; - Texture2D forcefieldTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/CalamitasShield"); + Texture2D forcefieldTexture = ModContent.Request("CalamityMod/ExtraTextures/CalamitasShield"); GameShaders.Misc["CalamityMod:SupremeShield"].UseImage("Images/Misc/Perlin"); Color forcefieldColor = Color.DarkViolet; Color secondaryForcefieldColor = Color.Red * 1.4f; - if (!npc.dontTakeDamage && (willCharge || npc.ai[1] == 2f)) + if (!NPC.dontTakeDamage && (willCharge || NPC.ai[1] == 2f)) { forcefieldColor *= 0.25f; secondaryForcefieldColor = Color.Lerp(secondaryForcefieldColor, Color.Black, 0.7f); @@ -2956,7 +2957,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas GameShaders.Misc["CalamityMod:SupremeShield"].UseOpacity(opacity); GameShaders.Misc["CalamityMod:SupremeShield"].Apply(); - spriteBatch.Draw(forcefieldTexture, npc.Center - Main.screenPosition, null, Color.White * opacity, 0f, forcefieldTexture.Size() * 0.5f, forcefieldScale * 3f, SpriteEffects.None, 0f); + spriteBatch.Draw(forcefieldTexture, NPC.Center - Main.screenPosition, null, Color.White * opacity, 0f, forcefieldTexture.Size() * 0.5f, forcefieldScale * 3f, SpriteEffects.None, 0f); spriteBatch.ExitShaderRegion(); } @@ -2967,17 +2968,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas float jawRotationOffset = 0f; // Have an agape mouth when charging. - if (npc.ai[1] == 2f) + if (NPC.ai[1] == 2f) jawRotationOffset -= 0.71f; // And a laugh right before the charge. - else if (willCharge && npc.ai[1] != 2f && AttackCloseToBeingOver) + else if (willCharge && NPC.ai[1] != 2f && AttackCloseToBeingOver) jawRotationOffset += MathHelper.Lerp(0.04f, -0.82f, (float)Math.Sin(Main.GlobalTime * 17.2f) * 0.5f + 0.5f); Color shieldColor = Color.White * shieldOpacity; - Texture2D shieldSkullTexture = ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldTop"); - Texture2D shieldJawTexture = ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldBottom"); - Vector2 drawPosition = npc.Center + shieldRotation.ToRotationVector2() * 24f - Main.screenPosition; + Texture2D shieldSkullTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldTop"); + Texture2D shieldJawTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldBottom"); + Vector2 drawPosition = NPC.Center + shieldRotation.ToRotationVector2() * 24f - Main.screenPosition; Vector2 jawDrawPosition = drawPosition; SpriteEffects direction = Math.Cos(shieldRotation) > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically; if (direction == SpriteEffects.FlipVertically) @@ -2997,24 +2998,24 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { hitTimer = 35; - npc.netUpdate = true; + NPC.netUpdate = true; } for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 100; + NPC.height = 100; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -3024,10 +3025,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -3035,8 +3036,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index 0a5bf76a02..3ad96e13a0 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -11,6 +11,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Particles; +using Terraria.Audio; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -23,38 +24,38 @@ namespace CalamityMod.NPCs.SupremeCalamitas public const int HorizontalOffset = 750; public const int PunchCounterLimit = 60; public const int DartBurstCounterLimit = 300; - public Player Target => Main.player[npc.target]; - public ref float PunchCounter => ref npc.ai[1]; - public ref float DartBurstCounter => ref npc.ai[2]; - public ref float ElapsedVerticalDistance => ref npc.ai[3]; - public ref float AttackDelayTimer => ref npc.localAI[0]; + public Player Target => Main.player[NPC.target]; + public ref float PunchCounter => ref NPC.ai[1]; + public ref float DartBurstCounter => ref NPC.ai[2]; + public ref float ElapsedVerticalDistance => ref NPC.ai[3]; + public ref float AttackDelayTimer => ref NPC.localAI[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Cataclysm"); - Main.npcFrameCount[npc.type] = 9; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 9; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.damage = 0; - npc.npcSlots = 5f; - npc.width = 120; - npc.height = 120; - npc.defense = 80; - npc.DR_NERD(0.25f); - npc.LifeMaxNERB(230000, 276000, 100000); + NPC.damage = 0; + NPC.npcSlots = 5f; + NPC.width = 120; + NPC.height = 120; + NPC.defense = 80; + NPC.DR_NERD(0.25f); + NPC.LifeMaxNERB(230000, 276000, 100000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.DD2_OgreRoar; - npc.DeathSound = SoundID.NPCDeath52; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.DD2_OgreRoar; + NPC.DeathSound = SoundID.NPCDeath52; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; } public override void SendExtraAI(BinaryWriter writer) @@ -72,8 +73,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas float punchInterpolant = Utils.InverseLerp(10f, PunchCounterLimit * 2f, PunchCounter + (PunchingFromRight ? 0f : PunchCounterLimit), true); if (AttackDelayTimer < 120f) { - npc.frameCounter += 0.15f; - if (npc.frameCounter >= 1f) + NPC.frameCounter += 0.15f; + if (NPC.frameCounter >= 1f) CurrentFrame = (CurrentFrame + 1) % 12; } else @@ -81,29 +82,29 @@ namespace CalamityMod.NPCs.SupremeCalamitas CurrentFrame = (int)Math.Round(MathHelper.Lerp(12f, 21f, punchInterpolant)); } - int xFrame = CurrentFrame / Main.npcFrameCount[npc.type]; - int yFrame = CurrentFrame % Main.npcFrameCount[npc.type]; + int xFrame = CurrentFrame / Main.npcFrameCount[NPC.type]; + int yFrame = CurrentFrame % Main.npcFrameCount[NPC.type]; - npc.frame.Width = 212; - npc.frame.Height = 208; - npc.frame.X = xFrame * npc.frame.Width; - npc.frame.Y = yFrame * npc.frame.Height; + NPC.frame.Width = 212; + NPC.frame.Height = 208; + NPC.frame.X = xFrame * NPC.frame.Width; + NPC.frame.Y = yFrame * NPC.frame.Height; } public override void AI() { // Set the whoAmI variable. - CalamityGlobalNPC.SCalCataclysm = npc.whoAmI; + CalamityGlobalNPC.SCalCataclysm = NPC.whoAmI; // Disappear if Supreme Calamitas is not present. if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } - float totalLifeRatio = npc.life / (float)npc.lifeMax; + float totalLifeRatio = NPC.life / (float)NPC.lifeMax; if (CalamityGlobalNPC.SCalCatastrophe != -1) { if (Main.npc[CalamityGlobalNPC.SCalCatastrophe].active) @@ -112,12 +113,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas totalLifeRatio *= 0.5f; // Get a target if no valid one has been found. - if (npc.target < 0 || npc.target == Main.maxPlayers || Target.dead || !Target.active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Target.dead || !Target.active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away. - if (!npc.WithinRange(Target.Center, CalamityGlobalNPC.CatchUpDistance200Tiles)) - npc.TargetClosest(); + if (!NPC.WithinRange(Target.Center, CalamityGlobalNPC.CatchUpDistance200Tiles)) + NPC.TargetClosest(); float acceleration = 1.5f; @@ -147,11 +148,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas ElapsedVerticalDistance = 0f; // Reset rotation to zero. - npc.rotation = 0f; + NPC.rotation = 0f; // Hover to the side of the target. - Vector2 idealVelocity = npc.SafeDirectionTo(Target.Center + new Vector2(HorizontalOffset, VerticalOffset)) * 60f; - npc.SimpleFlyMovement(idealVelocity, acceleration); + Vector2 idealVelocity = NPC.SafeDirectionTo(Target.Center + new Vector2(HorizontalOffset, VerticalOffset)) * 60f; + NPC.SimpleFlyMovement(idealVelocity, acceleration); // Have a small delay prior to shooting projectiles. if (AttackDelayTimer < 120f) @@ -166,12 +167,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (PunchCounter >= PunchCounterLimit) { PunchCounter = 0f; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneHellblastSound"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneHellblastSound"), NPC.Center); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 fistSpawnPosition = npc.Center + Vector2.UnitX * -74f; + Vector2 fistSpawnPosition = NPC.Center + Vector2.UnitX * -74f; Projectile.NewProjectile(fistSpawnPosition, Vector2.UnitX * -8f, type, damage, 0f, Main.myPlayer, 0f, PunchingFromRight.ToInt()); } PunchingFromRight = !PunchingFromRight; @@ -184,14 +185,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (DartBurstCounter >= DartBurstCounterLimit) { DartBurstCounter = 0f; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), NPC.Center); // TODO -- Consider changing this to use RotatedBy or ToRotationVector2. float speed = 7f; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(NPC.velocity.X, NPC.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -199,13 +200,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 8; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * speed), (float)(Math.Cos(offsetAngle) * speed), type, damage, 0f, Main.myPlayer, 0f, 1f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(-Math.Sin(offsetAngle) * speed), (float)(-Math.Cos(offsetAngle) * speed), type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.Center.X, NPC.Center.Y, (float)(Math.Sin(offsetAngle) * speed), (float)(Math.Cos(offsetAngle) * speed), type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.Center.X, NPC.Center.Y, (float)(-Math.Sin(offsetAngle) * speed), (float)(-Math.Cos(offsetAngle) * speed), type, damage, 0f, Main.myPlayer, 0f, 1f); } } for (int i = 0; i < 6; i++) - Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f); + Dust.NewDust(NPC.position + NPC.velocity, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f); } } } @@ -213,27 +214,27 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 origin = npc.frame.Size() * 0.5f; + Texture2D texture = Main.npcTexture[NPC.type]; + Vector2 origin = NPC.frame.Size() * 0.5f; int afterimageCount = 4; if (CalamityConfig.Instance.Afterimages) { for (int i = 1; i < afterimageCount; i += 2) { - Color afterimageColor = npc.GetAlpha(Color.Lerp(lightColor, Color.White, 0.5f)) * ((afterimageCount - i) / 15f); - Vector2 drawPosition = npc.oldPos[i] + npc.Size * 0.5f - Main.screenPosition; - spriteBatch.Draw(texture, drawPosition, npc.frame, afterimageColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + Color afterimageColor = NPC.GetAlpha(Color.Lerp(lightColor, Color.White, 0.5f)) * ((afterimageCount - i) / 15f); + Vector2 drawPosition = NPC.oldPos[i] + NPC.Size * 0.5f - Main.screenPosition; + spriteBatch.Draw(texture, drawPosition, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } } - Vector2 mainDrawPosition = npc.Center - Main.screenPosition; - spriteBatch.Draw(texture, mainDrawPosition, npc.frame, npc.GetAlpha(lightColor), npc.rotation, origin, npc.scale, spriteEffects, 0f); + Vector2 mainDrawPosition = NPC.Center - Main.screenPosition; + spriteBatch.Draw(texture, mainDrawPosition, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeCataclysmGlow"); + texture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCataclysmGlow"); Color baseGlowmaskColor = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -241,12 +242,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 1; i < afterimageCount; i++) { Color afterimageColor = Color.Lerp(baseGlowmaskColor, Color.White, 0.5f) * ((afterimageCount - i) / 15f); - Vector2 drawPosition = npc.oldPos[i] + npc.Size * 0.5f - Main.screenPosition; - spriteBatch.Draw(texture, drawPosition, npc.frame, afterimageColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + Vector2 drawPosition = NPC.oldPos[i] + NPC.Size * 0.5f - Main.screenPosition; + spriteBatch.Draw(texture, drawPosition, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture, mainDrawPosition, npc.frame, baseGlowmaskColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, mainDrawPosition, NPC.frame, baseGlowmaskColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); return false; } @@ -257,26 +258,26 @@ namespace CalamityMod.NPCs.SupremeCalamitas { int heartAmt = Main.rand.Next(3) + 3; for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } public override bool CheckActive() => false; public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 100; + NPC.height = 100; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -286,16 +287,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } // Turn into dust on death. - if (npc.life <= 0) - DeathAshParticle.CreateAshesFromNPC(npc); + if (NPC.life <= 0) + DeathAshParticle.CreateAshesFromNPC(NPC); } } } diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 9e0896bfea..3612baddf5 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -11,6 +11,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Particles; +using Terraria.Audio; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -23,39 +24,39 @@ namespace CalamityMod.NPCs.SupremeCalamitas public const int HorizontalOffset = 750; public const int SlashCounterLimit = 45; public const int DartBurstCounterLimit = 300; - public Player Target => Main.player[npc.target]; - public ref float SlashCounter => ref npc.ai[1]; - public ref float DartBurstCounter => ref npc.ai[2]; - public ref float ElapsedVerticalDistance => ref npc.ai[3]; - public ref float AttackDelayTimer => ref npc.localAI[0]; + public Player Target => Main.player[NPC.target]; + public ref float SlashCounter => ref NPC.ai[1]; + public ref float DartBurstCounter => ref NPC.ai[2]; + public ref float ElapsedVerticalDistance => ref NPC.ai[3]; + public ref float AttackDelayTimer => ref NPC.localAI[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Catastrophe"); - Main.npcFrameCount[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 8; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.damage = 0; - npc.npcSlots = 5f; - npc.width = 120; - npc.height = 120; - npc.defense = 80; - npc.DR_NERD(0.25f); - npc.LifeMaxNERB(230000, 276000, 100000); + NPC.damage = 0; + NPC.npcSlots = 5f; + NPC.width = 120; + NPC.height = 120; + NPC.defense = 80; + NPC.DR_NERD(0.25f); + NPC.LifeMaxNERB(230000, 276000, 100000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.DD2_OgreRoar; - npc.DeathSound = SoundID.NPCDeath52; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.DD2_OgreRoar; + NPC.DeathSound = SoundID.NPCDeath52; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; } public override void SendExtraAI(BinaryWriter writer) @@ -74,8 +75,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas float slashInterpolant = Utils.InverseLerp(0f, SlashCounterLimit * 2f, slashCounter, true); if (AttackDelayTimer < 120f) { - npc.frameCounter += 0.15f; - if (npc.frameCounter >= 1f) + NPC.frameCounter += 0.15f; + if (NPC.frameCounter >= 1f) CurrentFrame = (CurrentFrame + 1) % 6; } else @@ -83,29 +84,29 @@ namespace CalamityMod.NPCs.SupremeCalamitas CurrentFrame = (int)Math.Round(MathHelper.Lerp(6f, 15f, slashInterpolant)); } - int xFrame = CurrentFrame / Main.npcFrameCount[npc.type]; - int yFrame = CurrentFrame % Main.npcFrameCount[npc.type]; + int xFrame = CurrentFrame / Main.npcFrameCount[NPC.type]; + int yFrame = CurrentFrame % Main.npcFrameCount[NPC.type]; - npc.frame.Width = 400; - npc.frame.Height = 230; - npc.frame.X = xFrame * npc.frame.Width; - npc.frame.Y = yFrame * npc.frame.Height; + NPC.frame.Width = 400; + NPC.frame.Height = 230; + NPC.frame.X = xFrame * NPC.frame.Width; + NPC.frame.Y = yFrame * NPC.frame.Height; } public override void AI() { // Set the whoAmI variable. - CalamityGlobalNPC.SCalCatastrophe = npc.whoAmI; + CalamityGlobalNPC.SCalCatastrophe = NPC.whoAmI; // Disappear if Supreme Calamitas is not present. if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return; } - float totalLifeRatio = npc.life / (float)npc.lifeMax; + float totalLifeRatio = NPC.life / (float)NPC.lifeMax; if (CalamityGlobalNPC.SCalCataclysm != -1) { if (Main.npc[CalamityGlobalNPC.SCalCataclysm].active) @@ -114,17 +115,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas totalLifeRatio *= 0.5f; // Get a target if no valid one has been found. - if (npc.target < 0 || npc.target == Main.maxPlayers || Target.dead || !Target.active) - npc.TargetClosest(); + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Target.dead || !Target.active) + NPC.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away. - if (!npc.WithinRange(Target.Center, CalamityGlobalNPC.CatchUpDistance200Tiles)) - npc.TargetClosest(); + if (!NPC.WithinRange(Target.Center, CalamityGlobalNPC.CatchUpDistance200Tiles)) + NPC.TargetClosest(); float acceleration = 1.5f; // Reduce acceleration if target is holding a true melee weapon - Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; + Item targetSelectedItem = Main.player[NPC.target].inventory[Main.player[NPC.target].selectedItem]; if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) acceleration *= 0.5f; @@ -149,14 +150,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas ElapsedVerticalDistance = 0f; // Reset rotation to zero. - npc.rotation = 0f; + NPC.rotation = 0f; // Set direction. - npc.spriteDirection = (Target.Center.X > npc.Center.X).ToDirectionInt(); + NPC.spriteDirection = (Target.Center.X > NPC.Center.X).ToDirectionInt(); // Hover to the side of the target. - Vector2 idealVelocity = npc.SafeDirectionTo(Target.Center + new Vector2(-HorizontalOffset, VerticalOffset)) * 60f; - npc.SimpleFlyMovement(idealVelocity, acceleration); + Vector2 idealVelocity = NPC.SafeDirectionTo(Target.Center + new Vector2(-HorizontalOffset, VerticalOffset)) * 60f; + NPC.SimpleFlyMovement(idealVelocity, acceleration); // Have a small delay prior to shooting projectiles. if (AttackDelayTimer < 120f) @@ -171,11 +172,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (SlashCounter >= SlashCounterLimit) { SlashCounter = 0f; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), NPC.Center); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 slashSpawnPosition = npc.Center + Vector2.UnitX * 125f; + int damage = NPC.GetProjectileDamage(type); + Vector2 slashSpawnPosition = NPC.Center + Vector2.UnitX * 125f; if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(slashSpawnPosition, Vector2.UnitX * 4f, type, damage, 0f, Main.myPlayer, 0f, SlashingFromRight.ToInt()); SlashingFromRight = !SlashingFromRight; @@ -188,14 +189,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (DartBurstCounter >= DartBurstCounterLimit) { DartBurstCounter = 0f; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), npc.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), NPC.Center); // TODO -- Consider changing this to use RotatedBy or ToRotationVector2. float speed = 7f; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(NPC.velocity.X, NPC.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -203,13 +204,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 8; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * speed), (float)(Math.Cos(offsetAngle) * speed), type, damage, 0f, Main.myPlayer, 0f, 1f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(-Math.Sin(offsetAngle) * speed), (float)(-Math.Cos(offsetAngle) * speed), type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.Center.X, NPC.Center.Y, (float)(Math.Sin(offsetAngle) * speed), (float)(Math.Cos(offsetAngle) * speed), type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.Center.X, NPC.Center.Y, (float)(-Math.Sin(offsetAngle) * speed), (float)(-Math.Cos(offsetAngle) * speed), type, damage, 0f, Main.myPlayer, 0f, 1f); } } for (int i = 0; i < 6; i++) - Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f); + Dust.NewDust(NPC.position + NPC.velocity, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f); } } } @@ -217,27 +218,27 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 origin = npc.frame.Size() * 0.5f; + Texture2D texture = Main.npcTexture[NPC.type]; + Vector2 origin = NPC.frame.Size() * 0.5f; int afterimageCount = 4; if (CalamityConfig.Instance.Afterimages) { for (int i = 1; i < afterimageCount; i += 2) { - Color afterimageColor = npc.GetAlpha(Color.Lerp(lightColor, Color.White, 0.5f)) * ((afterimageCount - i) / 15f); - Vector2 drawPosition = npc.oldPos[i] + npc.Size * 0.5f - Main.screenPosition; - spriteBatch.Draw(texture, drawPosition, npc.frame, afterimageColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + Color afterimageColor = NPC.GetAlpha(Color.Lerp(lightColor, Color.White, 0.5f)) * ((afterimageCount - i) / 15f); + Vector2 drawPosition = NPC.oldPos[i] + NPC.Size * 0.5f - Main.screenPosition; + spriteBatch.Draw(texture, drawPosition, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } } - Vector2 mainDrawPosition = npc.Center - Main.screenPosition; - spriteBatch.Draw(texture, mainDrawPosition, npc.frame, npc.GetAlpha(lightColor), npc.rotation, origin, npc.scale, spriteEffects, 0f); + Vector2 mainDrawPosition = NPC.Center - Main.screenPosition; + spriteBatch.Draw(texture, mainDrawPosition, NPC.frame, NPC.GetAlpha(lightColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeCatastropheGlow"); + texture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCatastropheGlow"); Color baseGlowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.35f); if (CalamityConfig.Instance.Afterimages) @@ -245,12 +246,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 1; i < afterimageCount; i++) { Color afterimageColor = Color.Lerp(baseGlowmaskColor, Color.White, 0.5f) * ((afterimageCount - i) / 15f); - Vector2 drawPosition = npc.oldPos[i] + npc.Size * 0.5f - Main.screenPosition; - spriteBatch.Draw(texture, drawPosition, npc.frame, afterimageColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + Vector2 drawPosition = NPC.oldPos[i] + NPC.Size * 0.5f - Main.screenPosition; + spriteBatch.Draw(texture, drawPosition, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture, mainDrawPosition, npc.frame, baseGlowmaskColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, mainDrawPosition, NPC.frame, baseGlowmaskColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); return false; } @@ -261,26 +262,26 @@ namespace CalamityMod.NPCs.SupremeCalamitas { int heartAmt = Main.rand.Next(3) + 3; for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + Item.NewItem((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); } public override bool CheckActive() => false; public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 100; + NPC.height = 100; + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -290,16 +291,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } // Turn into dust on death. - if (npc.life <= 0) - DeathAshParticle.CreateAshesFromNPC(npc); + if (NPC.life <= 0) + DeathAshParticle.CreateAshesFromNPC(NPC); } } } diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index 9660cea1cd..4f11961adf 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Ammo; using CalamityMod.Items.Potions; @@ -25,35 +25,35 @@ namespace CalamityMod.NPCs.TownNPCs { DisplayName.SetDefault("Archmage"); - Main.npcFrameCount[npc.type] = 25; - NPCID.Sets.ExtraFramesCount[npc.type] = 9; - NPCID.Sets.AttackFrameCount[npc.type] = 4; - NPCID.Sets.DangerDetectRange[npc.type] = 700; - NPCID.Sets.AttackType[npc.type] = 0; - NPCID.Sets.AttackTime[npc.type] = 90; - NPCID.Sets.AttackAverageChance[npc.type] = 30; + Main.npcFrameCount[NPC.type] = 25; + NPCID.Sets.ExtraFramesCount[NPC.type] = 9; + NPCID.Sets.AttackFrameCount[NPC.type] = 4; + NPCID.Sets.DangerDetectRange[NPC.type] = 700; + NPCID.Sets.AttackType[NPC.type] = 0; + NPCID.Sets.AttackTime[NPC.type] = 90; + NPCID.Sets.AttackAverageChance[NPC.type] = 30; } public override void SetDefaults() { - npc.townNPC = true; - npc.friendly = true; - npc.lavaImmune = true; - npc.width = 18; - npc.height = 40; - npc.aiStyle = 7; - npc.damage = 10; - npc.defense = 15; - npc.lifeMax = 20000; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.8f; + NPC.townNPC = true; + NPC.friendly = true; + NPC.lavaImmune = true; + NPC.width = 18; + NPC.height = 40; + NPC.aiStyle = 7; + NPC.damage = 10; + NPC.defense = 15; + NPC.lifeMax = 20000; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.8f; animationType = NPCID.Guide; } public override void AI() { - if (!CalamityWorld.foundHomePermafrost && !npc.homeless) + if (!CalamityWorld.foundHomePermafrost && !NPC.homeless) { CalamityWorld.foundHomePermafrost = true; } @@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.TownNPCs public override string GetChat() { - if (npc.homeless && !CalamityWorld.foundHomePermafrost) + if (NPC.homeless && !CalamityWorld.foundHomePermafrost) { if (Main.rand.NextBool(2)) return "I have not seen such a sky in decades. Who are you, to so brazenly march against that Tyrant?"; diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index 600cbca370..b8021c1914 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -20,29 +20,29 @@ namespace CalamityMod.NPCs.TownNPCs { DisplayName.SetDefault("Drunk Princess"); - Main.npcFrameCount[npc.type] = 25; - NPCID.Sets.ExtraFramesCount[npc.type] = 9; - NPCID.Sets.AttackFrameCount[npc.type] = 4; - NPCID.Sets.DangerDetectRange[npc.type] = 400; - NPCID.Sets.AttackType[npc.type] = 0; - NPCID.Sets.AttackTime[npc.type] = 60; - NPCID.Sets.AttackAverageChance[npc.type] = 15; + Main.npcFrameCount[NPC.type] = 25; + NPCID.Sets.ExtraFramesCount[NPC.type] = 9; + NPCID.Sets.AttackFrameCount[NPC.type] = 4; + NPCID.Sets.DangerDetectRange[NPC.type] = 400; + NPCID.Sets.AttackType[NPC.type] = 0; + NPCID.Sets.AttackTime[NPC.type] = 60; + NPCID.Sets.AttackAverageChance[NPC.type] = 15; } public override void SetDefaults() { - npc.townNPC = true; - npc.friendly = true; - npc.lavaImmune = true; - npc.width = 18; - npc.height = 40; - npc.aiStyle = 7; - npc.damage = 10; - npc.defense = 15; - npc.lifeMax = 20000; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.knockBackResist = 0.5f; + NPC.townNPC = true; + NPC.friendly = true; + NPC.lavaImmune = true; + NPC.width = 18; + NPC.height = 40; + NPC.aiStyle = 7; + NPC.damage = 10; + NPC.defense = 15; + NPC.lifeMax = 20000; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath6; + NPC.knockBackResist = 0.5f; animationType = NPCID.Guide; } @@ -78,7 +78,7 @@ namespace CalamityMod.NPCs.TownNPCs if (CalamityUtils.AnyBossNPCS()) return "Why are you talking to me right now? Shouldn't you be bumbling around and dying for my amusement?"; - if (npc.homeless) + if (NPC.homeless) { if (Main.rand.NextBool(2)) return "I could smell my vodka from MILES away!"; diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index efb0c200f8..32f5218d30 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -21,29 +21,29 @@ namespace CalamityMod.NPCs.TownNPCs { DisplayName.SetDefault("Sea King"); - Main.npcFrameCount[npc.type] = 25; - NPCID.Sets.ExtraFramesCount[npc.type] = 5; - NPCID.Sets.AttackFrameCount[npc.type] = 4; - NPCID.Sets.DangerDetectRange[npc.type] = 700; - NPCID.Sets.AttackType[npc.type] = 0; - NPCID.Sets.AttackTime[npc.type] = 90; - NPCID.Sets.AttackAverageChance[npc.type] = 30; - NPCID.Sets.HatOffsetY[npc.type] = 16; + Main.npcFrameCount[NPC.type] = 25; + NPCID.Sets.ExtraFramesCount[NPC.type] = 5; + NPCID.Sets.AttackFrameCount[NPC.type] = 4; + NPCID.Sets.DangerDetectRange[NPC.type] = 700; + NPCID.Sets.AttackType[NPC.type] = 0; + NPCID.Sets.AttackTime[NPC.type] = 90; + NPCID.Sets.AttackAverageChance[NPC.type] = 30; + NPCID.Sets.HatOffsetY[NPC.type] = 16; } public override void SetDefaults() { - npc.townNPC = true; - npc.friendly = true; - npc.width = 30; - npc.height = 58; - npc.aiStyle = 7; - npc.damage = 10; - npc.defense = 25; - npc.lifeMax = 7500; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.65f; + NPC.townNPC = true; + NPC.friendly = true; + NPC.width = 30; + NPC.height = 58; + NPC.aiStyle = 7; + NPC.damage = 10; + NPC.defense = 25; + NPC.lifeMax = 7500; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.65f; animationType = NPCID.Guide; } @@ -59,7 +59,7 @@ namespace CalamityMod.NPCs.TownNPCs public override void AI() { - npc.breath += 2; + NPC.breath += 2; } public override string GetChat() @@ -67,10 +67,10 @@ namespace CalamityMod.NPCs.TownNPCs IList dialogue = new List(); Player player = Main.player[Main.myPlayer]; - if (npc.homeless) + if (NPC.homeless) { if (Main.rand.NextBool(2)) - return "How much more has the world fallen to ruin? Even the Tyrant’s empire..."; + return "How much more has the world fallen to ruin? Even the Tyrant’s empire..."; else return "Thank you for your service, my child, but I am afraid I am without a home now."; } @@ -134,7 +134,7 @@ namespace CalamityMod.NPCs.TownNPCs if (CalamityWorld.downedDoG) { - dialogue.Add("To see that Tyrant’s serpent free of its shackles. It gave me chills."); + dialogue.Add("To see that Tyrant’s serpent free of its shackles. It gave me chills."); } return dialogue[Main.rand.Next(dialogue.Count)]; @@ -148,7 +148,7 @@ namespace CalamityMod.NPCs.TownNPCs if (CalamityWorld.downedYharon) { - switch (npc.Calamity().newAI[0] % 3f) + switch (NPC.Calamity().newAI[0] % 3f) { case 0f: displayThisText = "Pockets of ore have appeared once more in the land. This will allow you to create the most powerful weaponry and armor imagined!"; @@ -163,7 +163,7 @@ namespace CalamityMod.NPCs.TownNPCs } else if (CalamityWorld.downedDoG) { - switch (npc.Calamity().newAI[0] % 3f) + switch (NPC.Calamity().newAI[0] % 3f) { case 0f: displayThisText = "The Devourer of God's cosmic armor is unique in that it is capable of not only protecting his body from tearing itself apart when ripping through the fabric of space and time, but also allows him to control his powers."; @@ -178,7 +178,7 @@ namespace CalamityMod.NPCs.TownNPCs } else if (CalamityWorld.downedPolterghast) { - switch (npc.Calamity().newAI[0] % 2f) + switch (NPC.Calamity().newAI[0] % 2f) { case 0f: displayThisText = "The Abyss holds many secrets revealed with time. Checking it out again may not be a bad idea."; @@ -190,7 +190,7 @@ namespace CalamityMod.NPCs.TownNPCs } else if (CalamityWorld.downedProvidence) { - switch (npc.Calamity().newAI[0] % 3f) + switch (NPC.Calamity().newAI[0] % 3f) { case 0f: displayThisText = "The Rune of Kos holds a significant portion of Providence's brand of magic, easily distinguishable from all others. Activating it in certain places would have some... risky consequences."; @@ -205,7 +205,7 @@ namespace CalamityMod.NPCs.TownNPCs } else if (NPC.downedMoonlord) { - switch (npc.Calamity().newAI[0] % 6f) + switch (NPC.Calamity().newAI[0] % 6f) { case 0f: displayThisText = "Your adventure focuses to the jungle it seems. The Dragonfolly and its swarming offspring should be eliminated before their numbers spiral out of control."; @@ -229,7 +229,7 @@ namespace CalamityMod.NPCs.TownNPCs } else if (NPC.downedGolemBoss) { - switch (npc.Calamity().newAI[0] % 3f) + switch (NPC.Calamity().newAI[0] % 3f) { case 0f: displayThisText = "The men at the front of the dungeon are performing a ritual to keep the Moon Lord contained in his prison. In order to gain Yharim's attention, however, you may need to defeat them."; @@ -244,7 +244,7 @@ namespace CalamityMod.NPCs.TownNPCs } else if (Main.hardMode) { - switch (npc.Calamity().newAI[0] % 8f) + switch (NPC.Calamity().newAI[0] % 8f) { case 0f: displayThisText = !CalamityWorld.downedCryogen ? "Have you heard of the story of Archmage Permafrost? Rumor has it he's been locked away in an icy prison by Lord Yharim. Perhaps you would be able to free him if Cryogen was destroyed." : "You will find more ores have been unlocked due to the magic sealing them away being dispelled. Some of them may require more than just the ore itself to create."; @@ -274,7 +274,7 @@ namespace CalamityMod.NPCs.TownNPCs } else { - switch (npc.Calamity().newAI[0] % 10f) + switch (NPC.Calamity().newAI[0] % 10f) { case 0f: displayThisText = "There are rumors of ores that lay in latency. When you defeat certain bosses you will undo the ancient magic which conceals those materials."; @@ -330,7 +330,7 @@ namespace CalamityMod.NPCs.TownNPCs { shop = false; Main.npcChatText = Lore(); - npc.Calamity().newAI[0]++; + NPC.Calamity().newAI[0]++; Player player = Main.player[Main.myPlayer]; player.AddBuff(ModContent.BuffType(), 36000); } @@ -391,12 +391,12 @@ namespace CalamityMod.NPCs.TownNPCs public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Amidias/Amidias"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Amidias/Amidias2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Amidias/Amidias3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Amidias/Amidias4"), 1f); } } diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index 64d7f5f184..8add87c8ad 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Pets; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Rogue; @@ -11,6 +11,7 @@ using Terraria.ID; using Terraria.GameContent.Events; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] @@ -37,29 +38,29 @@ namespace CalamityMod.NPCs.TownNPCs { DisplayName.SetDefault("Bandit"); - Main.npcFrameCount[npc.type] = 23; - NPCID.Sets.ExtraFramesCount[npc.type] = 9; - NPCID.Sets.AttackFrameCount[npc.type] = 4; - NPCID.Sets.DangerDetectRange[npc.type] = 500; - NPCID.Sets.AttackType[npc.type] = 0; - NPCID.Sets.AttackTime[npc.type] = 60; - NPCID.Sets.AttackAverageChance[npc.type] = 10; + Main.npcFrameCount[NPC.type] = 23; + NPCID.Sets.ExtraFramesCount[NPC.type] = 9; + NPCID.Sets.AttackFrameCount[NPC.type] = 4; + NPCID.Sets.DangerDetectRange[NPC.type] = 500; + NPCID.Sets.AttackType[NPC.type] = 0; + NPCID.Sets.AttackTime[NPC.type] = 60; + NPCID.Sets.AttackAverageChance[NPC.type] = 10; } public override void SetDefaults() { - npc.townNPC = true; - npc.friendly = true; - npc.lavaImmune = false; - npc.width = 18; - npc.height = 44; - npc.aiStyle = 7; - npc.damage = 10; - npc.defense = 15; - npc.lifeMax = 250; //Im not special :( - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.5f; + NPC.townNPC = true; + NPC.friendly = true; + NPC.lavaImmune = false; + NPC.width = 18; + NPC.height = 44; + NPC.aiStyle = 7; + NPC.damage = 10; + NPC.defense = 15; + NPC.lifeMax = 250; //Im not special :( + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.5f; animationType = NPCID.PartyGirl; } @@ -111,19 +112,19 @@ namespace CalamityMod.NPCs.TownNPCs { PossibleDialogs.Add("Where is my party hat? Well, I stole it of course."); } - if (npc.GivenName == "Laura") + if (NPC.GivenName == "Laura") { PossibleDialogs.Add("The nice thing about maps is I can track anything that has fallen."); } - if (npc.GivenName == "Penelope") + if (NPC.GivenName == "Penelope") { PossibleDialogs.Add("Imagine how fast you could throw if you just had more hands."); } - if (npc.GivenName == "Valerie") + if (NPC.GivenName == "Valerie") { PossibleDialogs.Add("I also take food for currency."); } - if (npc.GivenName == "Rowan") + if (NPC.GivenName == "Rowan") { PossibleDialogs.Add("Usually I only think of animals as food or target practice, but dragons are an exception."); } @@ -202,7 +203,7 @@ namespace CalamityMod.NPCs.TownNPCs Main.LocalPlayer.SellItem(CalamityWorld.MoneyStolenByBandit, 1); CalamityWorld.MoneyStolenByBandit = 0; NPC goblinFucker = Main.npc[goblinIndex]; - Main.PlaySound(SoundID.Coins, -1, -1, 1, 1f, 0f); // Money dink sound + SoundEngine.PlaySound(SoundID.Coins, -1, -1, 1, 1f, 0f); // Money dink sound switch (Main.rand.Next(2)) { case 0: @@ -217,8 +218,8 @@ namespace CalamityMod.NPCs.TownNPCs public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/TownNPCs/THIEF" + (BirthdayParty.PartyIsUp ? "Alt" : "")), npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY) - new Vector2(0f, 6f), npc.frame, drawColor, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/TownNPCs/THIEF" + (BirthdayParty.PartyIsUp ? "Alt" : "")), NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); return false; } @@ -359,12 +360,12 @@ namespace CalamityMod.NPCs.TownNPCs public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Bandit/Bandit"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Bandit/Bandit2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Bandit/Bandit3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Bandit/Bandit4"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Bandit/Bandit"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Bandit/Bandit2"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Bandit/Bandit3"), 1f); + Gore.NewGore(NPC.position, NPC.velocity, Mod.GetGoreSlot("Gores/Bandit/Bandit4"), 1f); } } diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs index a36199b5a8..434ca17103 100644 --- a/NPCs/TownNPCs/WITCH.cs +++ b/NPCs/TownNPCs/WITCH.cs @@ -21,32 +21,32 @@ namespace CalamityMod.NPCs.TownNPCs { DisplayName.SetDefault("Brimstone Witch"); - Main.npcFrameCount[npc.type] = 27; - NPCID.Sets.ExtraFramesCount[npc.type] = 9; - NPCID.Sets.AttackFrameCount[npc.type] = 4; - NPCID.Sets.DangerDetectRange[npc.type] = 700; - NPCID.Sets.AttackType[npc.type] = 1; - NPCID.Sets.AttackTime[npc.type] = 30; - NPCID.Sets.AttackAverageChance[npc.type] = 5; + Main.npcFrameCount[NPC.type] = 27; + NPCID.Sets.ExtraFramesCount[NPC.type] = 9; + NPCID.Sets.AttackFrameCount[NPC.type] = 4; + NPCID.Sets.DangerDetectRange[NPC.type] = 700; + NPCID.Sets.AttackType[NPC.type] = 1; + NPCID.Sets.AttackTime[NPC.type] = 30; + NPCID.Sets.AttackAverageChance[NPC.type] = 5; } public override void SetDefaults() { - npc.townNPC = true; - npc.friendly = true; - npc.lavaImmune = true; - npc.width = 18; - npc.height = 40; - npc.aiStyle = 7; - npc.damage = 10; + NPC.townNPC = true; + NPC.friendly = true; + NPC.lavaImmune = true; + NPC.width = 18; + NPC.height = 40; + NPC.aiStyle = 7; + NPC.damage = 10; // You should not be able to kill SCal under any typical circumstances. - npc.lifeMax = 1000000; + NPC.lifeMax = 1000000; - npc.defense = 120; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.knockBackResist = 0.8f; + NPC.defense = 120; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath6; + NPC.knockBackResist = 0.8f; animationType = NPCID.Wizard; } @@ -67,7 +67,7 @@ namespace CalamityMod.NPCs.TownNPCs { WeightedRandom textSelector = new WeightedRandom(Main.rand); - if (npc.homeless) + if (NPC.homeless) { textSelector.Add("I'm considering moving back to that old cave of mine."); textSelector.Add("I certainly can't return to the Tyrant's old dwellings now, have you got any places to stay?"); @@ -138,12 +138,12 @@ namespace CalamityMod.NPCs.TownNPCs { Main.playerInventory = true; Main.LocalPlayer.Calamity().newCalamitasInventory = false; - CalamitasEnchantUI.NPCIndex = npc.whoAmI; + CalamitasEnchantUI.NPCIndex = NPC.whoAmI; CalamitasEnchantUI.CurrentlyViewing = true; if (!Main.LocalPlayer.Calamity().GivenBrimstoneLocus) { - DropHelper.DropItem(npc, ItemType()); + DropHelper.DropItem(NPC, ItemType()); Main.LocalPlayer.Calamity().GivenBrimstoneLocus = true; } @@ -172,8 +172,8 @@ namespace CalamityMod.NPCs.TownNPCs // However, this doesn't happen in Boss Rush; the SCal there is a silent puppet created by Xeroc, not SCal herself. if (NPC.AnyNPCs(NPCType()) && !BossRushEvent.BossRushActive) { - npc.active = false; - npc.netUpdate = true; + NPC.active = false; + NPC.netUpdate = true; return false; } return true; @@ -195,15 +195,15 @@ namespace CalamityMod.NPCs.TownNPCs // Explode into red dust on death. public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + if (NPC.life <= 0) { - npc.position = npc.Center; - npc.width = npc.height = 50; - npc.position.X -= npc.width / 2; - npc.position.Y -= npc.height / 2; + NPC.position = NPC.Center; + NPC.width = NPC.height = 50; + NPC.position.X -= NPC.width / 2; + NPC.position.Y -= NPC.height / 2; for (int i = 0; i < 5; i++) { - int brimstone = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int brimstone = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimstone].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -214,11 +214,11 @@ namespace CalamityMod.NPCs.TownNPCs for (int i = 0; i < 10; i++) { - int fire = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } } diff --git a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs index aa1f39061b..3381774a50 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -83,7 +84,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn gore if (npc.localAI[2] == 0f) { - Main.PlaySound(SoundID.NPCHit, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.NPCHit, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); npc.localAI[2] = 1f; @@ -95,7 +96,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int num794 = 0; num794 < 20; num794++) Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); } // Percent life remaining @@ -165,7 +166,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 10f) { // Sound - Main.PlaySound(SoundID.ForceRoar, (int)npc.position.X, (int)npc.position.Y, -1, 1f, 0f); + SoundEngine.PlaySound(SoundID.ForceRoar, (int)npc.position.X, (int)npc.position.Y, -1, 1f, 0f); // Velocity npc.velocity = Vector2.Normalize(Main.player[npc.target].Center + (malice ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center) * ((death ? 20f : 16f) + 4f * enrageScale); @@ -210,7 +211,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { // Charge sound if (npc.ai[2] == 0f) - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); // Velocity int var = 120; @@ -352,7 +353,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[3] = 255f; npc.position.X = npc.ai[1] * 16f - (npc.width / 2); npc.position.Y = npc.ai[2] * 16f - (npc.height / 2); - Main.PlaySound(SoundID.Item8, npc.Center); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); npc.ai[0] = npc.ai[0] == -8f ? -9f : -3f; npc.netUpdate = true; npc.netSpam = 0; @@ -499,7 +500,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.alpha += 25; if (npc.alpha >= 255) { - Main.PlaySound(SoundID.Item8, npc.Center); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); npc.alpha = 255; npc.position.X = npc.ai[1] * 16f - (npc.width / 2); npc.position.Y = npc.ai[2] * 16f - (npc.height / 2); diff --git a/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs index 0124e498ba..f7e9299b2e 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -21,7 +22,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Chant sound if (npc.ai[0] != -1f && Main.rand.NextBool(1000)) - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, Main.rand.Next(88, 92), 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, Main.rand.Next(88, 92), 1f, 0f); // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -167,7 +168,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn and play sound if (npc.localAI[0] == 0f) { - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 89, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 89, 1f, 0f); npc.localAI[0] = 1f; npc.alpha = 255; npc.rotation = 0f; @@ -198,7 +199,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity *= 0.95f; if (npc.localAI[2] != 13f) - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 105, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 105, 1f, 0f); npc.localAI[2] = 13f; } diff --git a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs index 341d0f6a50..f705596a7b 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs @@ -8,6 +8,7 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -289,7 +290,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { for (int l = num14; l < num15; l++) { - if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[Main.tile[k, l].type] || (Main.tileSolidTop[Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) + if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].liquid > 64)) { Vector2 vector2; vector2.X = k * 16; @@ -464,7 +465,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses num24 = 20f; npc.soundDelay = (int)num24; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); } num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); diff --git a/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs index 8b08797b4d..92b8f611d8 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -285,7 +286,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; } - Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); } npc.ai[2] += 1f; @@ -449,11 +450,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Play sounds and spawn bubbles if (npc.ai[2] == 0f) - Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); if (npc.ai[2] % bubbleBelchPhaseDivisor == 0f) { - Main.PlaySound(SoundID.NPCKilled, (int)vector.X, (int)vector.Y, 19, 1f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)vector.X, (int)vector.Y, 19, 1f, 0f); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -492,7 +493,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Play sound and spawn sharknadoes if (npc.ai[2] == (sharknadoPhaseTimer - 30)) - Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 9, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 9, 1f, 0f); if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == sharknadoPhaseTimer - 30) { @@ -529,7 +530,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Sound if (npc.ai[2] == phaseTransitionTimer - 60) - Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); npc.ai[2] += 1f; if (npc.ai[2] >= phaseTransitionTimer) @@ -698,11 +699,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { // Play sounds and spawn bubbles if (npc.ai[2] == 0f) - Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); if (npc.ai[2] % bubbleSpinPhaseDivisor == 0f) { - Main.PlaySound(SoundID.NPCKilled, (int)vector.X, (int)vector.Y, 19, 1f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)vector.X, (int)vector.Y, 19, 1f, 0f); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -745,7 +746,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Play sound and spawn cthulhunado if (npc.ai[2] == sharknadoPhaseTimer - 30) - Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == sharknadoPhaseTimer - 30) Projectile.NewProjectile(vector.X, vector.Y, 0f, 0f, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1); @@ -790,7 +791,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Play sound if (npc.ai[2] == phaseTransitionTimer - 60) - Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); npc.ai[2] += 1f; if (npc.ai[2] >= phaseTransitionTimer) @@ -979,7 +980,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Play sound if (npc.ai[2] == teleportPhaseTimer / 2) - Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == teleportPhaseTimer / 2) { diff --git a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs index 2da8226058..89282b3871 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -249,7 +250,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { for (int num34 = num31; num34 < num32; num34++) { - if (Main.tile[num33, num34] != null && ((Main.tile[num33, num34].nactive() && (Main.tileSolid[Main.tile[num33, num34].type] || (Main.tileSolidTop[Main.tile[num33, num34].type] && Main.tile[num33, num34].frameY == 0))) || Main.tile[num33, num34].liquid > 64)) + if (Main.tile[num33, num34] != null && ((Main.tile[num33, num34].nactive() && (Main.tileSolid[Main.tile[num33, num34].TileType] || (Main.tileSolidTop[Main.tile[num33, num34].TileType] && Main.tile[num33, num34].TileFrameY == 0))) || Main.tile[num33, num34].liquid > 64)) { Vector2 vector; vector.X = num33 * 16; @@ -400,7 +401,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses num54 = 20f; npc.soundDelay = (int)num54; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); } num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); diff --git a/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs index bbe4a670b2..1b5236e55f 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -160,7 +161,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num23, 0f, 0f, 0f, 0, 0, 0); } - Main.PlaySound(SoundID.NPCHit1, (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y); + SoundEngine.PlaySound(SoundID.NPCHit1, (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y); int num; for (int m = 0; m < 10; m = num + 1) @@ -283,7 +284,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] = 0f; else { - Main.PlaySound(SoundID.NPCHit1, (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(SoundID.NPCHit1, (int)npc.position.X, (int)npc.position.Y); int num; for (int num35 = 0; num35 < 2; num35 = num + 1) @@ -300,7 +301,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses num = num36; } - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); } } @@ -378,7 +379,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 1f) { - Main.PlaySound(SoundID.ForceRoar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.ForceRoar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); npc.rotation = num8; float chargeSpeed = 6.2f + 4f * (0.75f - lifeRatio); @@ -535,7 +536,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 4f) { if (npc.ai[2] == 0f) - Main.PlaySound(SoundID.ForceRoar, (int)npc.position.X, (int)npc.position.Y, -1, 1f, 0f); + SoundEngine.PlaySound(SoundID.ForceRoar, (int)npc.position.X, (int)npc.position.Y, -1, 1f, 0f); float num60 = num5; npc.ai[2] += 1f; @@ -617,7 +618,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num34, 0f, 0f, 0f, 0, 0, 0); } - Main.PlaySound(SoundID.NPCDeath13, npc.position); + SoundEngine.PlaySound(SoundID.NPCDeath13, npc.position); for (int m = 0; m < 10; m++) Dust.NewDust(servantSpawnCenter, 20, 20, 5, servantSpawnVelocity.X * 0.4f, servantSpawnVelocity.Y * 0.4f, 0, default, 1f); @@ -683,7 +684,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 7f) { if (npc.ai[2] == 0f) - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); float num60 = (float)Math.Round(num5 * 2.5f); npc.ai[2] += 1f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs index 489ec3d289..823c52755f 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -66,7 +67,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int num2 = (int)Main.player[npc.target].Center.Y / 16; Tile tile = Framing.GetTileSafely(num, num2); - if (tile.wall == WallID.LihzahrdBrickUnsafe) + if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else turboEnrage = malice; @@ -269,7 +270,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.TargetClosest(); // Play sound - Main.PlaySound(SoundID.Item14, npc.position); + SoundEngine.PlaySound(SoundID.Item14, npc.position); npc.ai[0] = 0f; @@ -418,7 +419,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int num2 = (int)Main.player[npc.target].Center.Y / 16; Tile tile = Framing.GetTileSafely(num, num2); - if (tile.wall == WallID.LihzahrdBrickUnsafe) + if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else turboEnrage = malice; @@ -673,7 +674,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int num2 = (int)Main.player[npc.target].Center.Y / 16; Tile tile = Framing.GetTileSafely(num, num2); - if (tile.wall == WallID.LihzahrdBrickUnsafe) + if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else turboEnrage = malice; @@ -909,7 +910,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int num2 = (int)Main.player[npc.target].Center.Y / 16; Tile tile = Framing.GetTileSafely(num, num2); - if (tile.wall == WallID.LihzahrdBrickUnsafe) + if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else turboEnrage = malice; diff --git a/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs index 926008adaf..cd3af7b1b3 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -60,7 +61,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - Main.PlaySound(SoundID.Item38, (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(SoundID.Item38, (int)npc.position.X, (int)npc.position.Y); NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType()); } @@ -436,7 +437,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int num241 = num240; int num242 = 0; - if (Main.tile[num239, num241].nactive() && Main.tileSolid[Main.tile[num239, num241].type] && !Main.tileSolidTop[Main.tile[num239, num241].type]) + if (Main.tile[num239, num241].nactive() && Main.tileSolid[Main.tile[num239, num241].TileType] && !Main.tileSolidTop[Main.tile[num239, num241].TileType]) { num242 = 1; } @@ -445,7 +446,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (; num242 < 150 && num241 + num242 < Main.maxTilesY; num242++) { int y = num241 + num242; - if (Main.tile[num239, y].nactive() && Main.tileSolid[Main.tile[num239, y].type] && !Main.tileSolidTop[Main.tile[num239, y].type]) + if (Main.tile[num239, y].nactive() && Main.tileSolid[Main.tile[num239, y].TileType] && !Main.tileSolidTop[Main.tile[num239, y].TileType]) { num242--; break; diff --git a/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs b/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs index 2882a07978..0fdfe4567b 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -50,7 +51,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { // Play a random Moon Lord sound if (npc.ai[0] != -1f && npc.ai[0] != 2f && Main.rand.NextBool(200)) - Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, Main.rand.Next(93, 100), 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, Main.rand.Next(93, 100), 1f, 0f); // Start the AI if (npc.localAI[3] == 0f) @@ -66,7 +67,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[1] += 1f; if (npc.ai[1] == 30f) - Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, 92, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, 92, 1f, 0f); if (npc.ai[1] < 60f) MoonlordDeathDrama.RequestLight(npc.ai[1] / 30f, npc.Center); @@ -91,7 +92,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[1] += 1f; if (npc.ai[1] == 30f) - Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, 92, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, 92, 1f, 0f); if (npc.ai[1] < 60f) MoonlordDeathDrama.RequestLight(npc.ai[1] / 30f, npc.Center); @@ -416,7 +417,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } if (npc.ai[1] == 1f) - Main.PlaySound(SoundID.NPCDeath61, npc.Center); + SoundEngine.PlaySound(SoundID.NPCDeath61, npc.Center); if (npc.ai[1] >= 480f) MoonlordDeathDrama.RequestLight((npc.ai[1] - 480f) / 120f, npc.Center); @@ -893,7 +894,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[1] = 1f; if (num1207 == num1208 - 35f) - Main.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 6, 1f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 6, 1f, 0f); if ((shootFirstBolt || shootSecondBolt || shootThirdBolt) && Main.netMode != NetmodeID.MultiplayerClient) { @@ -1501,7 +1502,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[1] = 1f; if (num1178 == num1179 - 35f) - Main.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 6, 1f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 6, 1f, 0f); if ((shootFirstBolt || shootSecondBolt || shootThirdBolt) && Main.netMode != NetmodeID.MultiplayerClient) { @@ -1609,7 +1610,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } if (Main.rand.Next(420) == 0) - Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, Main.rand.Next(100, 101), 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, Main.rand.Next(100, 101), 1f, 0f); Vector2 value22 = new Vector2(30f); @@ -1774,7 +1775,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 0.4f, 0.2f); if (num1245 == num1241 - 35f) - Main.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 6, 1f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 6, 1f, 0f); if ((num1245 == num1241 - 14f || num1245 == num1241 - 7f || num1245 == num1241) && Main.netMode != NetmodeID.MultiplayerClient) { @@ -1904,7 +1905,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (num1245 < 120f) { - Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, 102, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, 102, 1f, 0f); if (num1245 == 105f) npc.netUpdate = true; diff --git a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs index a51fd90ae1..e02827b49b 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -145,7 +146,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (Main.tile[x, y] != null) { - if (Main.tile[x, y].nactive() && Main.tileSolid[Main.tile[x, y].type] && !Main.tileSolidTop[Main.tile[x, y].type] && !TileID.Sets.Platforms[Main.tile[x, y].type]) + if (Main.tile[x, y].nactive() && Main.tileSolid[Main.tile[x, y].TileType] && !Main.tileSolidTop[Main.tile[x, y].TileType] && !TileID.Sets.Platforms[Main.tile[x, y].TileType]) nearbyActiveTiles++; } } @@ -519,7 +520,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (calamityGlobalNPC.newAI[0] >= sporeGasGateValue) { npc.TargetClosest(); - Main.PlaySound(SoundID.Item20, npc.position); + SoundEngine.PlaySound(SoundID.Item20, npc.position); Vector2 vector93 = npc.Center; float num742 = 3f; @@ -717,7 +718,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses try { - if (WorldGen.SolidTile(num768, num769) || (Main.tile[num768, num769].wall > 0 && (num764 > 500 || lifeRatio < 0.5f))) + if (WorldGen.SolidTile(num768, num769) || (Main.tile[num768, num769].WallType > 0 && (num764 > 500 || lifeRatio < 0.5f))) { flag50 = true; npc.ai[0] = num768; diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs index 15ddce130d..45b7cfd241 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs @@ -7,6 +7,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -201,7 +202,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); return false; } @@ -459,7 +460,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn bees or hornets if (Collision.CanHit(vector76, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && spawnBee) { - Main.PlaySound(SoundID.NPCHit1, (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(SoundID.NPCHit1, (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { int spawnType = Main.rand.Next(210, 212); @@ -548,7 +549,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Fire stingers if (npc.ai[1] % num650 == (num650 - 1) && npc.position.Y + npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector78, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - Main.PlaySound(SoundID.Item17, npc.position); + SoundEngine.PlaySound(SoundID.Item17, npc.position); if (Main.netMode != NetmodeID.MultiplayerClient) { float num624 = 12f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs index 7700f0cc37..f9d5377b46 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -55,7 +56,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (respawnHands && calamityGlobalNPC.newAI[0] == 0f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) { calamityGlobalNPC.newAI[0] = 1f; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, -0.25f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, -0.25f); SpawnHands(); npc.netUpdate = true; @@ -114,7 +115,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.dayTime && !BossRushEvent.BossRushActive && npc.ai[1] != 3f && npc.ai[1] != 2f) { npc.ai[1] = 2f; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); } // Hand immunity @@ -138,7 +139,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.ai[3] = 0f; - Main.PlaySound(SoundID.Item66, npc.position); + SoundEngine.PlaySound(SoundID.Item66, npc.position); Vector2 vector10 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -395,7 +396,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses calamityGlobalNPC.newAI[1] += 1f; if (calamityGlobalNPC.newAI[1] == 2f) - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); if (npc.ai[2] >= 300f) { diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs index cfd4e05022..bb27870b53 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs @@ -7,6 +7,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -155,7 +156,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } npc.ai[1] = 2f; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); } // Adjust slowing debuff immunity @@ -387,7 +388,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] += 1f; if (npc.ai[2] == 2f) - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); // Spin for 3 seconds then return to floating phase float phaseTimer = 240f; @@ -507,7 +508,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[2] == 2f) { // Play angry noise - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); // Set spin direction if (Main.player[npc.target].velocity.X > 0f) @@ -611,7 +612,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Projectile.NewProjectile(npc.Center.X + Main.rand.Next(npc.width / 2), npc.Center.Y + 4f, velocity.X, velocity.Y, type, damage, 0f, Main.myPlayer, 0f, delayBeforeHoming); } - Main.PlaySound(SoundID.Item39, npc.Center); + SoundEngine.PlaySound(SoundID.Item39, npc.Center); if (calamityGlobalNPC.newAI[1] >= 10f) { diff --git a/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs index 0f05238a92..4ad2a001d0 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -611,7 +612,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] = 0f; else { - Main.PlaySound(SoundID.NPCHit1, (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(SoundID.NPCHit1, (int)npc.position.X, (int)npc.position.Y); int num; for (int num397 = 0; num397 < 2; num397 = num + 1) @@ -628,7 +629,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses num = num398; } - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); } } @@ -917,7 +918,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(SoundID.Item33, npc.position); + SoundEngine.PlaySound(SoundID.Item33, npc.position); float num353 = 6f; int type = ModContent.ProjectileType(); @@ -1346,7 +1347,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] = 0f; else { - Main.PlaySound(SoundID.NPCHit, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.NPCHit, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); int num; for (int num438 = 0; num438 < 2; num438 = num + 1) @@ -1363,7 +1364,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses num = num439; } - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); } } @@ -1472,7 +1473,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[2] > 22f) { npc.localAI[2] = 0f; - Main.PlaySound(SoundID.Item34, npc.position); + SoundEngine.PlaySound(SoundID.Item34, npc.position); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -1520,7 +1521,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] == 1f) { // Play charge sound - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); // Set rotation and velocity npc.rotation = num420; @@ -1639,7 +1640,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 4f) { if (npc.ai[2] == 0f) - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + SoundEngine.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); float num60 = ((!retAlive && npc.ai[3] == 4f) ? 75f : 50f) - (float)Math.Round(death ? 14f * (0.7f - lifeRatio) : 0f); diff --git a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs index 72b0903658..656acfce9e 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { @@ -98,7 +99,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[3] >= (600 + Main.rand.Next(1000))) { npc.localAI[3] = -Main.rand.Next(200); - Main.PlaySound(SoundID.NPCDeath10, (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(SoundID.NPCDeath10, (int)npc.position.X, (int)npc.position.Y); } // Set whoAmI variable @@ -228,7 +229,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Play roar sound on players nearby if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f) - Main.PlaySound(SoundID.NPCKilled, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 10, 1f, -0.25f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 10, 1f, -0.25f); } } else if (distanceFromTarget < distanceBeforeSlowingDown) diff --git a/NPCs/VanillaNPCOverrides/RegularEnemies/DemonEyeAI.cs b/NPCs/VanillaNPCOverrides/RegularEnemies/DemonEyeAI.cs index f245121e3a..a12db4f6da 100644 --- a/NPCs/VanillaNPCOverrides/RegularEnemies/DemonEyeAI.cs +++ b/NPCs/VanillaNPCOverrides/RegularEnemies/DemonEyeAI.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies { @@ -108,7 +109,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies { // Randomly play pigron noises if the NPC is a pigron. if (Pigrons.Contains(npc.type) && Main.rand.NextBool(1000)) - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 9, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 9, 1f, 0f); // Disable gravity. npc.noGravity = true; diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index ceaa69f780..eb42cb10ca 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -28,6 +28,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.NPCs.Yharon { @@ -57,40 +58,40 @@ namespace CalamityMod.NPCs.Yharon public override void SetStaticDefaults() { DisplayName.SetDefault("Jungle Dragon, Yharon"); - Main.npcFrameCount[npc.type] = 7; - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[NPC.type] = 7; + NPCID.Sets.TrailingMode[NPC.type] = 1; } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 50f; - npc.GetNPCDamage(); - npc.width = 200; - npc.height = 200; - npc.defense = 90; - npc.LifeMaxNERB(1302000, 1562400, 370000); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 50f; + NPC.GetNPCDamage(); + NPC.width = 200; + NPC.height = 200; + NPC.defense = 90; + NPC.LifeMaxNERB(1302000, 1562400, 370000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0f; - npc.aiStyle = -1; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(10, 0, 0, 0); - npc.boss = true; - npc.DR_NERD(normalDR); + NPC.value = Item.buyPrice(10, 0, 0, 0); + NPC.boss = true; + NPC.DR_NERD(normalDR); - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.netAlways = true; music = CalamityMod.Instance.GetMusicFromMusicMod("YharonP1") ?? MusicID.Boss3; - npc.HitSound = SoundID.NPCHit56; - npc.DeathSound = SoundID.NPCDeath60; + NPC.HitSound = SoundID.NPCHit56; + NPC.DeathSound = SoundID.NPCDeath60; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SendExtraAI(BinaryWriter writer) @@ -101,7 +102,7 @@ namespace CalamityMod.NPCs.Yharon bb[2] = moveCloser; bb[3] = useTornado; bb[4] = startSecondAI; - bb[5] = npc.dontTakeDamage; + bb[5] = NPC.dontTakeDamage; writer.Write(bb); writer.Write(secondPhasePhase); writer.Write(teleportLocation); @@ -112,10 +113,10 @@ namespace CalamityMod.NPCs.Yharon writer.Write(safeBox.Y); writer.Write(safeBox.Width); writer.Write(safeBox.Height); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -126,7 +127,7 @@ namespace CalamityMod.NPCs.Yharon moveCloser = bb[2]; useTornado = bb[3]; startSecondAI = bb[4]; - npc.dontTakeDamage = bb[5]; + NPC.dontTakeDamage = bb[5]; secondPhasePhase = reader.ReadInt32(); teleportLocation = reader.ReadInt32(); invincibilityCounter = reader.ReadInt32(); @@ -136,18 +137,18 @@ namespace CalamityMod.NPCs.Yharon safeBox.Y = reader.ReadInt32(); safeBox.Width = reader.ReadInt32(); safeBox.Height = reader.ReadInt32(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; // Stop rain CalamityMod.StopRain(); @@ -160,7 +161,7 @@ namespace CalamityMod.NPCs.Yharon float pie = (float)Math.PI; - Vector2 vectorCenter = npc.Center; + Vector2 vectorCenter = NPC.Center; // Start phase 2 or not if (startSecondAI) @@ -174,9 +175,9 @@ namespace CalamityMod.NPCs.Yharon bool phase2Check = death || lifeRatio <= phase2GateValue; bool phase3Check = lifeRatio <= (death ? 0.8f : revenge ? 0.75f : expertMode ? 0.7f : 0.625f); bool phase4Check = lifeRatio <= ai2GateValue; - bool phase1Change = npc.ai[0] > -1f; - bool phase2Change = npc.ai[0] > 5f; - bool phase3Change = npc.ai[0] > 12f; + bool phase1Change = NPC.ai[0] > -1f; + bool phase2Change = NPC.ai[0] > 5f; + bool phase3Change = NPC.ai[0] > 12f; // Timer, velocity and acceleration for idle phase before phase switch int phaseSwitchTimer = expertMode ? 36 : 40; @@ -205,8 +206,8 @@ namespace CalamityMod.NPCs.Yharon int chargeTime = expertMode ? 40 : 45; float chargeSpeed = expertMode ? 28f : 26f; float fastChargeVelocityMultiplier = malice ? 2f : 1.5f; - bool playFastChargeRoarSound = npc.localAI[1] == fastChargeTelegraphTime * 0.5f; - bool doFastCharge = npc.localAI[1] > fastChargeTelegraphTime; + bool playFastChargeRoarSound = NPC.localAI[1] == fastChargeTelegraphTime * 0.5f; + bool doFastCharge = NPC.localAI[1] > fastChargeTelegraphTime; if (phase3Change) { @@ -264,45 +265,45 @@ namespace CalamityMod.NPCs.Yharon int spawnPhaseTimer = 75; // Target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) { - npc.TargetClosest(); - npc.netUpdate = true; + NPC.TargetClosest(); + NPC.netUpdate = true; } // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, vectorCenter) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, vectorCenter) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[NPC.target]; // Despawn if (player.dead || !player.active) { - npc.TargetClosest(); - player = Main.player[npc.target]; + NPC.TargetClosest(); + player = Main.player[NPC.target]; if (player.dead || !player.active) { - npc.velocity.Y -= 0.4f; + NPC.velocity.Y -= 0.4f; - if (npc.timeLeft > 60) - npc.timeLeft = 60; + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; - if (npc.ai[0] > 12f) - npc.ai[0] = 13f; - else if (npc.ai[0] > 5f) - npc.ai[0] = 6f; + if (NPC.ai[0] > 12f) + NPC.ai[0] = 13f; + else if (NPC.ai[0] > 5f) + NPC.ai[0] = 6f; else - npc.ai[0] = 0f; + NPC.ai[0] = 0f; - npc.ai[2] = 0f; + NPC.ai[2] = 0f; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; - int xPos = 60 * npc.direction; - Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (npc.width + 20) / 2f + vectorCenter; + int xPos = 60 * NPC.direction; + Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (NPC.width + 20) / 2f + vectorCenter; Vector2 fromMouth = new Vector2((int)vector.X + xPos, (int)vector.Y - 15); // Create the arena, but not as a multiplayer client. @@ -324,30 +325,30 @@ namespace CalamityMod.NPCs.Yharon } // Force Yharon to send a sync packet so that the arena gets sent immediately - npc.netUpdate = true; + NPC.netUpdate = true; } // Enrage code doesn't run on frame 1 so that Yharon won't be enraged for 1 frame in multiplayer else { enraged = !player.Hitbox.Intersects(safeBox); - npc.Calamity().CurrentlyEnraged = enraged; + NPC.Calamity().CurrentlyEnraged = enraged; if (enraged) { phaseSwitchTimer = 15; protectionBoost = true; - npc.damage = npc.defDamage * 5; + NPC.damage = NPC.defDamage * 5; chargeSpeed += 25f; } else { - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; protectionBoost = false; } } // Set DR based on protection boost (aka enrage) - bool chargeTelegraph = (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f) && npc.localAI[1] > 0f; - bool bulletHell = npc.ai[0] == 8f || npc.ai[0] == 15f; + bool chargeTelegraph = (NPC.ai[0] == 0f || NPC.ai[0] == 6f || NPC.ai[0] == 13f) && NPC.localAI[1] > 0f; + bool bulletHell = NPC.ai[0] == 8f || NPC.ai[0] == 15f; calamityGlobalNPC.DR = protectionBoost ? EnragedDR : normalDR; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = protectionBoost; @@ -372,94 +373,94 @@ namespace CalamityMod.NPCs.Yharon } if (bulletHell) - npc.damage = 0; + NPC.damage = 0; // Trigger spawn effects - if (npc.localAI[0] == 0f) + if (NPC.localAI[0] == 0f) { - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; + NPC.localAI[0] = 1f; + NPC.alpha = 255; + NPC.rotation = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[0] = -1f; - npc.netUpdate = true; + NPC.ai[0] = -1f; + NPC.netUpdate = true; } } // Rotation float npcRotation = (float)Math.Atan2(player.Center.Y - vectorCenter.Y, player.Center.X - vectorCenter.X); - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) npcRotation += pie; if (npcRotation < 0f) npcRotation += MathHelper.TwoPi; if (npcRotation > MathHelper.TwoPi) npcRotation -= MathHelper.TwoPi; - if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 9f || npc.ai[0] == 10f || npc.ai[0] == 16f) + if (NPC.ai[0] == -1f || NPC.ai[0] == 3f || NPC.ai[0] == 4f || NPC.ai[0] == 9f || NPC.ai[0] == 10f || NPC.ai[0] == 16f) npcRotation = 0f; float npcRotationSpeed = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 8f || npc.ai[0] == 11f || npc.ai[0] == 12f || - npc.ai[0] == 14f || npc.ai[0] == 15f || npc.ai[0] == 18f || npc.ai[0] == 19f) + if (NPC.ai[0] == 1f || NPC.ai[0] == 5f || NPC.ai[0] == 7f || NPC.ai[0] == 8f || NPC.ai[0] == 11f || NPC.ai[0] == 12f || + NPC.ai[0] == 14f || NPC.ai[0] == 15f || NPC.ai[0] == 18f || NPC.ai[0] == 19f) npcRotationSpeed = 0f; - if (npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 9f || npc.ai[0] == 16f) + if (NPC.ai[0] == 3f || NPC.ai[0] == 4f || NPC.ai[0] == 9f || NPC.ai[0] == 16f) npcRotationSpeed = 0.01f; if (npcRotationSpeed != 0f) - npc.rotation = npc.rotation.AngleTowards(npcRotation, npcRotationSpeed); + NPC.rotation = NPC.rotation.AngleTowards(npcRotation, npcRotationSpeed); // Alpha effects - if (npc.ai[0] != -1f && ((npc.ai[0] != 6f && npc.ai[0] != 13f) || npc.ai[2] <= phaseSwitchTimer)) + if (NPC.ai[0] != -1f && ((NPC.ai[0] != 6f && NPC.ai[0] != 13f) || NPC.ai[2] <= phaseSwitchTimer)) { - bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); + bool colliding = Collision.SolidCollision(NPC.position, NPC.width, NPC.height); if (colliding) - npc.alpha += 15; + NPC.alpha += 15; else - npc.alpha -= 15; + NPC.alpha -= 15; - if (npc.alpha < 0) - npc.alpha = 0; + if (NPC.alpha < 0) + NPC.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; + if (NPC.alpha > 150) + NPC.alpha = 150; } // Spawn effects - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) { - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; int num1467 = Math.Sign(player.Center.X - vectorCenter.X); if (num1467 != 0) { - npc.direction = num1467; - npc.spriteDirection = -npc.direction; + NPC.direction = num1467; + NPC.spriteDirection = -NPC.direction; } - if (npc.ai[2] > 20f) + if (NPC.ai[2] > 20f) { - npc.velocity.Y = -2f; - npc.alpha -= 5; + NPC.velocity.Y = -2f; + NPC.alpha -= 5; - bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); + bool colliding = Collision.SolidCollision(NPC.position, NPC.width, NPC.height); if (colliding) - npc.alpha += 15; + NPC.alpha += 15; - if (npc.alpha < 0) - npc.alpha = 0; + if (NPC.alpha < 0) + NPC.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; + if (NPC.alpha > 150) + NPC.alpha = 150; } - if (npc.ai[2] == fireTornadoPhaseTimer - 30) + if (NPC.ai[2] == fireTornadoPhaseTimer - 30) { int num1468 = 72; for (int num1469 = 0; num1469 < num1468; num1469++) { - Vector2 vector169 = Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f; + Vector2 vector169 = Vector2.Normalize(NPC.velocity) * new Vector2(NPC.width / 2f, NPC.height) * 0.75f * 0.5f; vector169 = vector169.RotatedBy((num1469 - (num1468 / 2 - 1)) * MathHelper.TwoPi / num1468) + vectorCenter; Vector2 value16 = vector169 - vectorCenter; int num1470 = Dust.NewDust(vector169 + value16, 0, 0, 244, value16.X * 2f, value16.Y * 2f, 100, default, 1.4f); @@ -468,54 +469,54 @@ namespace CalamityMod.NPCs.Yharon Main.dust[num1470].velocity = Vector2.Normalize(value16) * 3f; } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); } - npc.ai[2] += 1f; - if (npc.ai[2] >= spawnPhaseTimer) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= spawnPhaseTimer) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; } } #region Phase1 // Phase switch - else if (npc.ai[0] == 0f && !player.dead) + else if (NPC.ai[0] == 0f && !player.dead) { - if (npc.ai[1] == 0f) - npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); + if (NPC.ai[1] == 0f) + NPC.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 destination = player.Center + new Vector2(NPC.ai[1], 0); Vector2 distanceFromDestination = destination - vectorCenter; - Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - npc.velocity) * velocity; + Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - NPC.velocity) * velocity; if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) - npc.SimpleFlyMovement(desiredVelocity, acceleration); + NPC.SimpleFlyMovement(desiredVelocity, acceleration); else - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; int num1471 = Math.Sign(player.Center.X - vectorCenter.X); if (num1471 != 0) { - if (npc.ai[2] == 0f && num1471 != npc.direction) - npc.rotation += pie; + if (NPC.ai[2] == 0f && num1471 != NPC.direction) + NPC.rotation += pie; - npc.direction = num1471; + NPC.direction = num1471; - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } - npc.ai[2] += 1f; - if (npc.ai[2] >= phaseSwitchTimer) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= phaseSwitchTimer) { int aiState = 0; - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { case 0: case 1: @@ -526,11 +527,11 @@ namespace CalamityMod.NPCs.Yharon aiState = 5; break; case 4: - npc.ai[3] = 1f; + NPC.ai[3] = 1f; aiState = 2; break; case 5: - npc.ai[3] = 0f; + NPC.ai[3] = 0f; aiState = 3; break; } @@ -540,242 +541,242 @@ namespace CalamityMod.NPCs.Yharon if (aiState == 1) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); if (num1471 != 0) { - npc.direction = num1471; + NPC.direction = num1471; - if (npc.spriteDirection == 1) - npc.rotation += pie; + if (NPC.spriteDirection == 1) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } } else if (aiState == 2) { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 2f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } else if (aiState == 3) { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 3f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } else if (aiState == 4) { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } else if (aiState == 5) { if (playFastChargeRoarSound) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); if (doFastCharge) { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.localAI[1] = 0f; + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.localAI[1] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed * fastChargeVelocityMultiplier; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed * fastChargeVelocityMultiplier; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); if (num1471 != 0) { - npc.direction = num1471; + NPC.direction = num1471; - if (npc.spriteDirection == 1) - npc.rotation += pie; + if (NPC.spriteDirection == 1) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } } else - npc.localAI[1] += 1f; + NPC.localAI[1] += 1f; } - npc.netUpdate = true; + NPC.netUpdate = true; } } // Charge - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { ChargeDust(7, pie); - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= chargeTime) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 2f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Fireball breath - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - if (npc.ai[1] == 0f) - npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); + if (NPC.ai[1] == 0f) + NPC.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 destination = player.Center + new Vector2(NPC.ai[1], 0); Vector2 value17 = destination - vectorCenter; - Vector2 vector170 = Vector2.Normalize(value17 - npc.velocity) * flareBombPhaseVelocity; + Vector2 vector170 = Vector2.Normalize(value17 - NPC.velocity) * flareBombPhaseVelocity; if (Vector2.Distance(vectorCenter, destination) > reduceSpeedFlareBombDistance) - npc.SimpleFlyMovement(vector170, flareBombPhaseAcceleration); + NPC.SimpleFlyMovement(vector170, flareBombPhaseAcceleration); else - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; - if (npc.ai[2] == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[2] == 0f) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); - if (npc.ai[2] % flareBombSpawnDivisor == 0f) + if (NPC.ai[2] % flareBombSpawnDivisor == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(fromMouth, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.target, 1f); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(fromMouth, Vector2.Zero, type, damage, 0f, Main.myPlayer, NPC.target, 1f); } } int num1476 = Math.Sign(player.Center.X - vectorCenter.X); if (num1476 != 0) { - npc.direction = num1476; + NPC.direction = num1476; - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } - npc.ai[2] += 1f; - if (npc.ai[2] >= flareBombPhaseTimer) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= flareBombPhaseTimer) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Fire tornadoes - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == fireTornadoPhaseTimer - 30) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[2] == fireTornadoPhaseTimer - 30) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)NPC.position.X, (int)NPC.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == fireTornadoPhaseTimer - 30) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == fireTornadoPhaseTimer - 30) { - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, npc.direction * 4, 8f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, -(float)npc.direction * 4, 8f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, NPC.direction * 4, 8f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, -(float)NPC.direction * 4, 8f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); } - npc.ai[2] += 1f; - if (npc.ai[2] >= fireTornadoPhaseTimer) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= fireTornadoPhaseTimer) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Enter new phase - else if (npc.ai[0] == 4f) + else if (NPC.ai[0] == 4f) { - npc.velocity *= 0.9f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + NPC.velocity *= 0.9f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == newPhaseTimer - 60) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[2] == newPhaseTimer - 60) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); - npc.ai[2] += 1f; - if (npc.ai[2] >= newPhaseTimer) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= newPhaseTimer) { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[1] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[1] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Fast charge - else if (npc.ai[0] == 5f) + else if (NPC.ai[0] == 5f) { ChargeDust(14, pie); - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= chargeTime) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 2f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } #endregion #region Phase2 // Phase switch - else if (npc.ai[0] == 6f && !player.dead) + else if (NPC.ai[0] == 6f && !player.dead) { - if (npc.ai[1] == 0f) - npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); + if (NPC.ai[1] == 0f) + NPC.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 destination = player.Center + new Vector2(NPC.ai[1], 0); Vector2 distanceFromDestination = destination - vectorCenter; - Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - npc.velocity) * velocity; + Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - NPC.velocity) * velocity; if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) - npc.SimpleFlyMovement(desiredVelocity, acceleration); + NPC.SimpleFlyMovement(desiredVelocity, acceleration); else - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; int num1477 = Math.Sign(player.Center.X - vectorCenter.X); if (num1477 != 0) { - if (npc.ai[2] == 0f && num1477 != npc.direction) - npc.rotation += pie; + if (NPC.ai[2] == 0f && num1477 != NPC.direction) + NPC.rotation += pie; - npc.direction = num1477; + NPC.direction = num1477; - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } - npc.ai[2] += 1f; - if (npc.ai[2] >= phaseSwitchTimer) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= phaseSwitchTimer) { int aiState = 0; - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { case 0: case 1: @@ -793,7 +794,7 @@ namespace CalamityMod.NPCs.Yharon aiState = 2; break; case 7: - npc.ai[3] = 0f; + NPC.ai[3] = 0f; aiState = 3; break; } @@ -803,163 +804,163 @@ namespace CalamityMod.NPCs.Yharon if (aiState == 1) { - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 7f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); if (num1477 != 0) { - npc.direction = num1477; + NPC.direction = num1477; - if (npc.spriteDirection == 1) - npc.rotation += pie; + if (NPC.spriteDirection == 1) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } } else if (aiState == 2) { Vector2 npcCenter = vectorCenter; - if (npc.alpha < 255) + if (NPC.alpha < 255) { - npc.alpha += 17; - if (npc.alpha > 255) - npc.alpha = 255; + NPC.alpha += 17; + if (NPC.alpha > 255) + NPC.alpha = 255; } - if (npc.ai[2] == phaseSwitchTimer + 15f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[2] == phaseSwitchTimer + 15f) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)NPC.position.X, (int)NPC.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == phaseSwitchTimer + 15f) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == phaseSwitchTimer + 15f) { Vector2 center = player.Center + new Vector2(0f, -540f); - npcCenter = npc.Center = center; + npcCenter = NPC.Center = center; } - if (npc.ai[2] < phaseSwitchTimer + teleportPhaseTimer) + if (NPC.ai[2] < phaseSwitchTimer + teleportPhaseTimer) return; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * spinPhaseVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity = Vector2.Normalize(player.Center - vectorCenter) * spinPhaseVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); if (num1477 != 0) { - npc.direction = num1477; + NPC.direction = num1477; - if (npc.spriteDirection == 1) - npc.rotation += pie; + if (NPC.spriteDirection == 1) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } - npc.ai[0] = 8f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 1f; + NPC.ai[0] = 8f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 1f; } else if (aiState == 3) { - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 9f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } else if (aiState == 4) { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 10f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } else if (aiState == 5) { if (playFastChargeRoarSound) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); if (doFastCharge) { - npc.ai[0] = 11f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.localAI[1] = 0f; + NPC.ai[0] = 11f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.localAI[1] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed * fastChargeVelocityMultiplier; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed * fastChargeVelocityMultiplier; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); if (num1477 != 0) { - npc.direction = num1477; + NPC.direction = num1477; - if (npc.spriteDirection == 1) - npc.rotation += pie; + if (NPC.spriteDirection == 1) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } } else - npc.localAI[1] += 1f; + NPC.localAI[1] += 1f; } else if (aiState == 6) { - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * spinPhaseVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity = Vector2.Normalize(player.Center - vectorCenter) * spinPhaseVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); if (num1477 != 0) { - npc.direction = num1477; + NPC.direction = num1477; - if (npc.spriteDirection == 1) - npc.rotation += pie; + if (NPC.spriteDirection == 1) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } - npc.ai[0] = 12f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 12f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } - npc.netUpdate = true; + NPC.netUpdate = true; } } // Charge - else if (npc.ai[0] == 7f) + else if (NPC.ai[0] == 7f) { ChargeDust(7, pie); - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= chargeTime) { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 2f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Flare Dust bullet hell - else if (npc.ai[0] == 8f) + else if (NPC.ai[0] == 8f) { - if (npc.ai[2] == 0f) + if (NPC.ai[2] == 0f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - flareDustBulletHellSpawn = vectorCenter + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / (MathHelper.TwoPi * 3f); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); + flareDustBulletHellSpawn = vectorCenter + NPC.velocity.RotatedBy(MathHelper.PiOver2 * -NPC.direction) * spinTime / (MathHelper.TwoPi * 3f); } - npc.ai[2] += 1f; + NPC.ai[2] += 1f; - if (npc.ai[2] % flareDustSpawnDivisor == 0f) + if (NPC.ai[2] % flareDustSpawnDivisor == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int ringReduction = (int)MathHelper.Lerp(0f, 14f, npc.ai[2] / flareDustPhaseTimer); + int ringReduction = (int)MathHelper.Lerp(0f, 14f, NPC.ai[2] / flareDustPhaseTimer); int totalProjectiles = 38 - ringReduction; // 36 for first ring, 22 for last ring - DoFlareDustBulletHell(0, flareDustSpawnDivisor, npc.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, 0f, 0f, false); + DoFlareDustBulletHell(0, flareDustSpawnDivisor, NPC.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, 0f, 0f, false); // Fire a flame towards every player, with a limit of 5 if (expertMode) @@ -977,97 +978,97 @@ namespace CalamityMod.NPCs.Yharon { Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 20f - flareDustBulletHellSpawn) * 8f; int type = ModContent.ProjectileType(); - int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); + int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, NPC.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); Main.projectile[proj].extraUpdates += 1; } } } } - npc.velocity = npc.velocity.RotatedBy(-(double)spinPhaseRotation * (float)npc.direction); - npc.rotation -= spinPhaseRotation * npc.direction; + NPC.velocity = NPC.velocity.RotatedBy(-(double)spinPhaseRotation * (float)NPC.direction); + NPC.rotation -= spinPhaseRotation * NPC.direction; - if (npc.ai[2] >= flareDustPhaseTimer) + if (NPC.ai[2] >= flareDustPhaseTimer) { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = increasedIdleTimeAfterBulletHell; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.ai[2] = increasedIdleTimeAfterBulletHell; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Infernado - else if (npc.ai[0] == 9f) + else if (NPC.ai[0] == 9f) { - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == fireTornadoPhaseTimer - 30) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[2] == fireTornadoPhaseTimer - 30) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)NPC.position.X, (int)NPC.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == fireTornadoPhaseTimer - 30) - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == fireTornadoPhaseTimer - 30) + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.target + 1); - npc.ai[2] += 1f; - if (npc.ai[2] >= fireTornadoPhaseTimer) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= fireTornadoPhaseTimer) { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Enter new phase - else if (npc.ai[0] == 10f) + else if (NPC.ai[0] == 10f) { - npc.velocity *= 0.9f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + NPC.velocity *= 0.9f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == newPhaseTimer - 60) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[2] == newPhaseTimer - 60) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); - npc.ai[2] += 1f; - if (npc.ai[2] >= newPhaseTimer) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= newPhaseTimer) { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[1] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 13f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[1] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Fast charge - else if (npc.ai[0] == 11f) + else if (NPC.ai[0] == 11f) { ChargeDust(14, pie); - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= chargeTime) { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 2f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Flare Dust that speeds up and whips around in a wave - else if (npc.ai[0] == 12f) + else if (NPC.ai[0] == 12f) { - if (npc.ai[2] == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[2] == 0f) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); - npc.ai[2] += 1f; + NPC.ai[2] += 1f; - if (npc.ai[2] % flareDustSpawnDivisor2 == 0f) + if (NPC.ai[2] % flareDustSpawnDivisor2 == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1075,61 +1076,61 @@ namespace CalamityMod.NPCs.Yharon projectileVelocity.Normalize(); projectileVelocity *= 0.1f; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(fromMouth, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); } } - npc.velocity = npc.velocity.RotatedBy(-(double)spinPhaseRotation * (float)npc.direction); - npc.rotation -= spinPhaseRotation * npc.direction; + NPC.velocity = NPC.velocity.RotatedBy(-(double)spinPhaseRotation * (float)NPC.direction); + NPC.rotation -= spinPhaseRotation * NPC.direction; - if (npc.ai[2] >= flareDustPhaseTimer2) + if (NPC.ai[2] >= flareDustPhaseTimer2) { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 2f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } #endregion #region Phase3 // Phase switch - else if (npc.ai[0] == 13f && !player.dead) + else if (NPC.ai[0] == 13f && !player.dead) { - if (npc.ai[1] == 0f) - npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); + if (NPC.ai[1] == 0f) + NPC.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 destination = player.Center + new Vector2(NPC.ai[1], 0); Vector2 distanceFromDestination = destination - vectorCenter; - Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - npc.velocity) * velocity; + Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - NPC.velocity) * velocity; if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) - npc.SimpleFlyMovement(desiredVelocity, acceleration); + NPC.SimpleFlyMovement(desiredVelocity, acceleration); else - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; int num1477 = Math.Sign(player.Center.X - vectorCenter.X); if (num1477 != 0) { - if (npc.ai[2] == 0f && num1477 != npc.direction) - npc.rotation += pie; + if (NPC.ai[2] == 0f && num1477 != NPC.direction) + NPC.rotation += pie; - npc.direction = num1477; + NPC.direction = num1477; - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } - npc.ai[2] += 1f; - if (npc.ai[2] >= phaseSwitchTimer) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= phaseSwitchTimer) { int aiState = 0; - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { case 0: case 1: @@ -1147,7 +1148,7 @@ namespace CalamityMod.NPCs.Yharon aiState = 6; break; case 7: - npc.ai[3] = 1f; + NPC.ai[3] = 1f; aiState = 7; break; case 8: @@ -1160,171 +1161,171 @@ namespace CalamityMod.NPCs.Yharon if (aiState == 1) { - npc.ai[0] = 14f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 14f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); if (num1477 != 0) { - npc.direction = num1477; + NPC.direction = num1477; - if (npc.spriteDirection == 1) - npc.rotation += pie; + if (NPC.spriteDirection == 1) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } } else if (aiState == 2) { Vector2 npcCenter = vectorCenter; - if (npc.alpha < 255) + if (NPC.alpha < 255) { - npc.alpha += 17; - if (npc.alpha > 255) - npc.alpha = 255; + NPC.alpha += 17; + if (NPC.alpha > 255) + NPC.alpha = 255; } - if (npc.ai[2] == phaseSwitchTimer + 15f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[2] == phaseSwitchTimer + 15f) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)NPC.position.X, (int)NPC.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == phaseSwitchTimer + 15f) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == phaseSwitchTimer + 15f) { Vector2 center = player.Center + new Vector2(0f, -540f); - npcCenter = npc.Center = center; + npcCenter = NPC.Center = center; } - if (npc.ai[2] < phaseSwitchTimer + teleportPhaseTimer) + if (NPC.ai[2] < phaseSwitchTimer + teleportPhaseTimer) return; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * spinPhaseVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity = Vector2.Normalize(player.Center - vectorCenter) * spinPhaseVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); if (num1477 != 0) { - npc.direction = num1477; + NPC.direction = num1477; - if (npc.spriteDirection == 1) - npc.rotation += pie; + if (NPC.spriteDirection == 1) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } - npc.ai[0] = 15f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[0] = 15f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; } else if (aiState == 3) { - npc.ai[0] = 16f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 16f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } else if (aiState == 4) { - npc.ai[0] = 17f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 17f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } else if (aiState == 5) { if (playFastChargeRoarSound) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); if (doFastCharge) { - npc.ai[0] = 18f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.localAI[1] = 0f; + NPC.ai[0] = 18f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.localAI[1] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed * fastChargeVelocityMultiplier; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed * fastChargeVelocityMultiplier; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); if (num1477 != 0) { - npc.direction = num1477; + NPC.direction = num1477; - if (npc.spriteDirection == 1) - npc.rotation += pie; + if (NPC.spriteDirection == 1) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } } else - npc.localAI[1] += 1f; + NPC.localAI[1] += 1f; } else if (aiState == 6) { - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * spinPhaseVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + NPC.velocity = Vector2.Normalize(player.Center - vectorCenter) * spinPhaseVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); if (num1477 != 0) { - npc.direction = num1477; + NPC.direction = num1477; - if (npc.spriteDirection == 1) - npc.rotation += pie; + if (NPC.spriteDirection == 1) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } - npc.ai[0] = 19f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 19f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } else if (aiState == 7) { - npc.ai[0] = 20f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; + NPC.ai[0] = 20f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; } - npc.netUpdate = true; + NPC.netUpdate = true; } } // Charge - else if (npc.ai[0] == 14f) + else if (NPC.ai[0] == 14f) { ChargeDust(7, pie); - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= chargeTime) { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 13f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 2f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Flare Dust bullet hell - else if (npc.ai[0] == 15f) + else if (NPC.ai[0] == 15f) { - if (npc.ai[2] == 0f) + if (NPC.ai[2] == 0f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - flareDustBulletHellSpawn = vectorCenter + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / (MathHelper.TwoPi * 3f); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); + flareDustBulletHellSpawn = vectorCenter + NPC.velocity.RotatedBy(MathHelper.PiOver2 * -NPC.direction) * spinTime / (MathHelper.TwoPi * 3f); } - npc.ai[2] += 1f; - if (npc.ai[2] % flareDustSpawnDivisor3 == 0f) + NPC.ai[2] += 1f; + if (NPC.ai[2] % flareDustSpawnDivisor3 == 0f) { // Rotate spiral by 7.2 * (300 / 12) = +90 degrees and then back -90 degrees if (Main.netMode != NetmodeID.MultiplayerClient) { - DoFlareDustBulletHell(1, flareDustPhaseTimer, npc.GetProjectileDamage(ModContent.ProjectileType()), 8, 12f, 3.6f, false); + DoFlareDustBulletHell(1, flareDustPhaseTimer, NPC.GetProjectileDamage(ModContent.ProjectileType()), 8, 12f, 3.6f, false); // Fire a flame towards every player, with a limit of 5 - if (expertMode && npc.ai[2] % (flareDustSpawnDivisor3 * 2) == 0f) + if (expertMode && NPC.ai[2] % (flareDustSpawnDivisor3 * 2) == 0f) { List targets = new List(); for (int p = 0; p < Main.maxPlayers; p++) @@ -1339,100 +1340,100 @@ namespace CalamityMod.NPCs.Yharon { Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 20f - flareDustBulletHellSpawn) * 8f; int type = ModContent.ProjectileType(); - int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); + int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, NPC.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); Main.projectile[proj].extraUpdates += 1; } } } } - npc.velocity = npc.velocity.RotatedBy(-(double)spinPhaseRotation * (float)npc.direction); - npc.rotation -= spinPhaseRotation * npc.direction; + NPC.velocity = NPC.velocity.RotatedBy(-(double)spinPhaseRotation * (float)NPC.direction); + NPC.rotation -= spinPhaseRotation * NPC.direction; - if (npc.ai[2] >= flareDustPhaseTimer) + if (NPC.ai[2] >= flareDustPhaseTimer) { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.localAI[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 13f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.localAI[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Infernado - else if (npc.ai[0] == 16f) + else if (NPC.ai[0] == 16f) { - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == fireTornadoPhaseTimer - 30) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[2] == fireTornadoPhaseTimer - 30) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)NPC.position.X, (int)NPC.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == fireTornadoPhaseTimer - 30) - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == fireTornadoPhaseTimer - 30) + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.target + 1); - npc.ai[2] += 1f; - if (npc.ai[2] >= fireTornadoPhaseTimer) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= fireTornadoPhaseTimer) { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 3f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 13f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 3f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Enter new phase - else if (npc.ai[0] == 17f) + else if (NPC.ai[0] == 17f) { - npc.velocity *= 0.9f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + NPC.velocity *= 0.9f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == newPhaseTimer - 60) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[2] == newPhaseTimer - 60) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); - npc.ai[2] += 1f; - if (npc.ai[2] >= newPhaseTimer) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= newPhaseTimer) { startSecondAI = true; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[1] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[1] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Fast charge - else if (npc.ai[0] == 18f) + else if (NPC.ai[0] == 18f) { ChargeDust(14, pie); - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= chargeTime) { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 13f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 2f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Fireball ring - else if (npc.ai[0] == 19f) + else if (NPC.ai[0] == 19f) { - if (npc.ai[2] == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[2] == 0f) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); - npc.ai[2] += 1f; + NPC.ai[2] += 1f; - if (npc.ai[2] % flareDustSpawnDivisor2 == 0f) + if (NPC.ai[2] % flareDustSpawnDivisor2 == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1440,72 +1441,72 @@ namespace CalamityMod.NPCs.Yharon projectileVelocity.Normalize(); projectileVelocity *= 0.1f; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(fromMouth, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); } } - npc.velocity = npc.velocity.RotatedBy(-(double)spinPhaseRotation * (float)npc.direction); - npc.rotation -= spinPhaseRotation * npc.direction; + NPC.velocity = NPC.velocity.RotatedBy(-(double)spinPhaseRotation * (float)NPC.direction); + NPC.rotation -= spinPhaseRotation * NPC.direction; - if (npc.ai[2] >= flareDustPhaseTimer2 - 50) + if (NPC.ai[2] >= flareDustPhaseTimer2 - 50) { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 13f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 1f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } // Fireball breath - else if (npc.ai[0] == 20f) + else if (NPC.ai[0] == 20f) { - if (npc.ai[1] == 0f) - npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); + if (NPC.ai[1] == 0f) + NPC.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 destination = player.Center + new Vector2(NPC.ai[1], 0); Vector2 value17 = destination - vectorCenter; - Vector2 vector170 = Vector2.Normalize(value17 - npc.velocity) * flareBombPhaseVelocity; + Vector2 vector170 = Vector2.Normalize(value17 - NPC.velocity) * flareBombPhaseVelocity; if (Vector2.Distance(vectorCenter, destination) > reduceSpeedFlareBombDistance) - npc.SimpleFlyMovement(vector170, flareBombPhaseAcceleration); + NPC.SimpleFlyMovement(vector170, flareBombPhaseAcceleration); else - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; - if (npc.ai[2] == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[2] == 0f) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); - if (npc.ai[2] % flareBombSpawnDivisor == 0f) + if (NPC.ai[2] % flareBombSpawnDivisor == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(fromMouth, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.target, 1f); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(fromMouth, Vector2.Zero, type, damage, 0f, Main.myPlayer, NPC.target, 1f); } } int num1476 = Math.Sign(player.Center.X - vectorCenter.X); if (num1476 != 0) { - npc.direction = num1476; + NPC.direction = num1476; - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += pie; - npc.spriteDirection = -npc.direction; + NPC.spriteDirection = -NPC.direction; } - npc.ai[2] += 1f; - if (npc.ai[2] >= flareBombPhaseTimer - 15) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= flareBombPhaseTimer - 15) { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 13f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } #endregion @@ -1521,11 +1522,11 @@ namespace CalamityMod.NPCs.Yharon float phase4GateValue = death ? 0.165f : 0.11f; bool phase4 = lifeRatio <= phase4GateValue && revenge; - if (npc.ai[0] != 8f) + if (NPC.ai[0] != 8f) { - npc.alpha -= 25; - if (npc.alpha < 0) - npc.alpha = 0; + NPC.alpha -= 25; + if (NPC.alpha < 0) + NPC.alpha = 0; } if (!moveCloser) @@ -1541,63 +1542,63 @@ namespace CalamityMod.NPCs.Yharon CalamityUtils.DisplayLocalizedText(key, messageColor); } - npc.dontTakeDamage = false; + NPC.dontTakeDamage = false; if (invincibilityCounter < Phase2InvincibilityTime) { - npc.dontTakeDamage = true; + NPC.dontTakeDamage = true; phase2 = phase3 = phase4 = false; invincibilityCounter++; } // Acquire target and determine enrage state - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + if (NPC.target < 0 || NPC.target == 255 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) { - npc.TargetClosest(); - npc.netUpdate = true; + NPC.TargetClosest(); + NPC.netUpdate = true; } // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, vectorCenter) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); + if (Vector2.Distance(Main.player[NPC.target].Center, vectorCenter) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); - Player targetData = Main.player[npc.target]; + Player targetData = Main.player[NPC.target]; // Despawn bool targetDead = false; if (targetData.dead || !targetData.active) { - npc.TargetClosest(); - targetData = Main.player[npc.target]; + NPC.TargetClosest(); + targetData = Main.player[NPC.target]; if (targetData.dead || !targetData.active) { targetDead = true; - npc.velocity.Y -= 0.4f; + NPC.velocity.Y -= 0.4f; - if (npc.timeLeft > 60) - npc.timeLeft = 60; + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; - npc.ai[0] = 1f; - npc.ai[1] = 0f; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; } } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; enraged = !targetData.Hitbox.Intersects(safeBox); if (enraged) { protectionBoost = true; - npc.damage = npc.defDamage * 5; + NPC.damage = NPC.defDamage * 5; } else { protectionBoost = false; - npc.damage = npc.defDamage; + NPC.damage = NPC.defDamage; } // Set DR based on protection boost (aka enrage) - bool bulletHell = npc.ai[0] == 5f; + bool bulletHell = NPC.ai[0] == 5f; calamityGlobalNPC.DR = protectionBoost ? EnragedDR : normalDR; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = protectionBoost; @@ -1620,7 +1621,7 @@ namespace CalamityMod.NPCs.Yharon break; } - if (npc.ai[0] == 9f) + if (NPC.ai[0] == 9f) { calamityGlobalNPC.DR = 0.61f; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; @@ -1628,7 +1629,7 @@ namespace CalamityMod.NPCs.Yharon } if (bulletHell) - npc.damage = 0; + NPC.damage = 0; float reduceSpeedChargeDistance = 500f; float phaseSwitchTimer = malice ? 28f : expertMode ? 30f : 32f; @@ -1639,8 +1640,8 @@ namespace CalamityMod.NPCs.Yharon float fastChargeVelocityMultiplier = malice ? 2f : 1.5f; fastChargeTelegraphTime = protectionBoost ? 60 : (100 - secondPhasePhase * 10); - bool playFastChargeRoarSound = npc.localAI[1] == fastChargeTelegraphTime * 0.5f; - bool doFastChargeTelegraph = npc.localAI[1] <= fastChargeTelegraphTime; + bool playFastChargeRoarSound = NPC.localAI[1] == fastChargeTelegraphTime * 0.5f; + bool doFastChargeTelegraph = NPC.localAI[1] <= fastChargeTelegraphTime; float fireballBreathTimer = 60f; float fireballBreathPhaseTimer = fireballBreathTimer + 120f; @@ -1680,43 +1681,43 @@ namespace CalamityMod.NPCs.Yharon chargeSpeed *= velocityMult; } - if (npc.ai[0] == 0f) + if (NPC.ai[0] == 0f) { - npc.ai[1] += 1f; - if (npc.ai[1] >= 10f) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 10f) { - npc.ai[1] = 0f; - npc.ai[0] = 1f; - npc.ai[2] = 0f; - npc.netUpdate = true; + NPC.ai[1] = 0f; + NPC.ai[0] = 1f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; } } - else if (npc.ai[0] == 1f) + else if (NPC.ai[0] == 1f) { - if (npc.ai[2] == 0f) - npc.ai[2] = (vectorCenter.X < targetData.Center.X) ? 1 : -1; + if (NPC.ai[2] == 0f) + NPC.ai[2] = (vectorCenter.X < targetData.Center.X) ? 1 : -1; - Vector2 destination = targetData.Center + new Vector2(-npc.ai[2], 0f); - Vector2 desiredVelocity = npc.SafeDirectionTo(destination) * velocity; + Vector2 destination = targetData.Center + new Vector2(-NPC.ai[2], 0f); + Vector2 desiredVelocity = NPC.SafeDirectionTo(destination) * velocity; if (!targetDead) { if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) - npc.SimpleFlyMovement(desiredVelocity, acceleration); + NPC.SimpleFlyMovement(desiredVelocity, acceleration); else - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; } int num27 = (vectorCenter.X < targetData.Center.X) ? 1 : -1; - npc.direction = npc.spriteDirection = num27; + NPC.direction = NPC.spriteDirection = num27; - npc.ai[1] += 1f; - if (npc.ai[1] >= phaseSwitchTimer) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= phaseSwitchTimer) { int num28 = 1; if (phase4) { - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { case 0: num28 = 8; //teleport @@ -1732,7 +1733,7 @@ namespace CalamityMod.NPCs.Yharon } else if (phase3) { - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { case 0: num28 = 6; //tornado @@ -1786,7 +1787,7 @@ namespace CalamityMod.NPCs.Yharon } else if (phase2) { - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { case 0: num28 = 6; //tornado @@ -1825,7 +1826,7 @@ namespace CalamityMod.NPCs.Yharon } else { - switch ((int)npc.ai[3]) + switch ((int)NPC.ai[3]) { case 0: num28 = 6; //tornado @@ -1854,34 +1855,34 @@ namespace CalamityMod.NPCs.Yharon } } - if (num28 == 5 && npc.ai[1] < phaseSwitchTimer + teleportPhaseTimer) + if (num28 == 5 && NPC.ai[1] < phaseSwitchTimer + teleportPhaseTimer) { - float newRotation = npc.AngleTo(targetData.Center); + float newRotation = NPC.AngleTo(targetData.Center); float amount = 0.04f; - if (npc.spriteDirection == -1) + if (NPC.spriteDirection == -1) newRotation += pie; if (amount != 0f) - npc.rotation = npc.rotation.AngleTowards(newRotation, amount); + NPC.rotation = NPC.rotation.AngleTowards(newRotation, amount); Vector2 npcCenter = vectorCenter; - if (npc.alpha < 255) + if (NPC.alpha < 255) { - npc.alpha += 17; - if (npc.alpha > 255) - npc.alpha = 255; + NPC.alpha += 17; + if (NPC.alpha > 255) + NPC.alpha = 255; } float timeBeforeTeleport = teleportPhaseTimer - 15f; - if (npc.ai[1] == phaseSwitchTimer + timeBeforeTeleport) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[1] == phaseSwitchTimer + timeBeforeTeleport) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)NPC.position.X, (int)NPC.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == phaseSwitchTimer + timeBeforeTeleport) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[1] == phaseSwitchTimer + timeBeforeTeleport) { Vector2 center = targetData.Center + new Vector2(0f, -540f); - npcCenter = npc.Center = center; + npcCenter = NPC.Center = center; } return; @@ -1889,28 +1890,28 @@ namespace CalamityMod.NPCs.Yharon if (num28 == 7 && doFastChargeTelegraph) { - float newRotation = npc.AngleTo(targetData.Center); + float newRotation = NPC.AngleTo(targetData.Center); float amount = 0.04f; - if (npc.spriteDirection == -1) + if (NPC.spriteDirection == -1) newRotation += pie; if (amount != 0f) - npc.rotation = npc.rotation.AngleTowards(newRotation, amount); + NPC.rotation = NPC.rotation.AngleTowards(newRotation, amount); if (playFastChargeRoarSound) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); - npc.localAI[1] += 1f; + NPC.localAI[1] += 1f; return; } - npc.ai[0] = num28; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.localAI[1] = 0f; + NPC.ai[0] = num28; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 1f; + NPC.localAI[1] = 0f; switch (secondPhasePhase) { @@ -1918,35 +1919,35 @@ namespace CalamityMod.NPCs.Yharon if (phase2) { secondPhasePhase = 2; - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[0] = 9f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; } break; case 2: if (phase3) { secondPhasePhase = 3; - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[0] = 9f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; } break; case 3: if (phase4) { secondPhasePhase = 4; - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; + NPC.ai[0] = 9f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; } break; } - npc.netUpdate = true; + NPC.netUpdate = true; float aiLimit = 10f; if (phase4) @@ -1956,57 +1957,57 @@ namespace CalamityMod.NPCs.Yharon else if (phase2) aiLimit = 11f; - if (npc.ai[3] >= aiLimit) - npc.ai[3] = 0f; + if (NPC.ai[3] >= aiLimit) + NPC.ai[3] = 0f; switch (num28) { case 2: //charge { - Vector2 vector = npc.SafeDirectionTo(targetData.Center, Vector2.UnitX * npc.spriteDirection); - npc.spriteDirection = (vector.X > 0f) ? 1 : -1; - npc.rotation = vector.ToRotation(); + Vector2 vector = NPC.SafeDirectionTo(targetData.Center, Vector2.UnitX * NPC.spriteDirection); + NPC.spriteDirection = (vector.X > 0f) ? 1 : -1; + NPC.rotation = vector.ToRotation(); - if (npc.spriteDirection == -1) - npc.rotation += pie; + if (NPC.spriteDirection == -1) + NPC.rotation += pie; - npc.velocity = vector * chargeSpeed; + NPC.velocity = vector * chargeSpeed; break; } case 3: //fireballs { Vector2 vector2 = new Vector2((targetData.Center.X > vectorCenter.X) ? 1 : -1, 0f); - npc.spriteDirection = (vector2.X > 0f) ? 1 : -1; - npc.velocity = vector2 * -2f; + NPC.spriteDirection = (vector2.X > 0f) ? 1 : -1; + NPC.velocity = vector2 * -2f; break; } case 5: //spin move { - Vector2 vector3 = npc.SafeDirectionTo(targetData.Center, Vector2.UnitX * npc.spriteDirection); - npc.spriteDirection = (vector3.X > 0f) ? 1 : -1; - npc.rotation = vector3.ToRotation(); + Vector2 vector3 = NPC.SafeDirectionTo(targetData.Center, Vector2.UnitX * NPC.spriteDirection); + NPC.spriteDirection = (vector3.X > 0f) ? 1 : -1; + NPC.rotation = vector3.ToRotation(); - if (npc.spriteDirection == -1) - npc.rotation += pie; + if (NPC.spriteDirection == -1) + NPC.rotation += pie; - npc.velocity = vector3 * spinPhaseVelocity; + NPC.velocity = vector3 * spinPhaseVelocity; - npc.localAI[3] = Main.rand.Next(2); + NPC.localAI[3] = Main.rand.Next(2); break; } case 7: //fast charge { - Vector2 vector = npc.SafeDirectionTo(targetData.Center, Vector2.UnitX * npc.spriteDirection); - npc.spriteDirection = (vector.X > 0f) ? 1 : -1; - npc.rotation = vector.ToRotation(); + Vector2 vector = NPC.SafeDirectionTo(targetData.Center, Vector2.UnitX * NPC.spriteDirection); + NPC.spriteDirection = (vector.X > 0f) ? 1 : -1; + NPC.rotation = vector.ToRotation(); - if (npc.spriteDirection == -1) - npc.rotation += pie; + if (NPC.spriteDirection == -1) + NPC.rotation += pie; - npc.velocity = vector * chargeSpeed * fastChargeVelocityMultiplier; + NPC.velocity = vector * chargeSpeed * fastChargeVelocityMultiplier; break; } @@ -2015,154 +2016,154 @@ namespace CalamityMod.NPCs.Yharon } // Charge - else if (npc.ai[0] == 2f) + else if (NPC.ai[0] == 2f) { - if (npc.ai[1] == 1f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[1] == 1f) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)NPC.position.X, (int)NPC.position.Y); ChargeDust(7, pie); - npc.ai[1] += 1f; - if (npc.ai[1] >= chargeTime) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= chargeTime) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); } } // Fireball spit - else if (npc.ai[0] == 3f) + else if (NPC.ai[0] == 3f) { int num29 = (vectorCenter.X < targetData.Center.X) ? 1 : -1; - npc.ai[2] = num29; + NPC.ai[2] = num29; - npc.ai[1] += 1f; - if (npc.ai[1] < fireballBreathTimer) + NPC.ai[1] += 1f; + if (NPC.ai[1] < fireballBreathTimer) { Vector2 vector4 = targetData.Center + new Vector2(num29 * -750f, -300f); - Vector2 value = npc.SafeDirectionTo(vector4) * 16f; + Vector2 value = NPC.SafeDirectionTo(vector4) * 16f; - if (npc.Distance(vector4) < 16f) - npc.Center = vector4; + if (NPC.Distance(vector4) < 16f) + NPC.Center = vector4; else - npc.position += value; + NPC.position += value; - if (Vector2.Distance(vector4, npc.Center) < 32f) - npc.ai[1] = fireballBreathTimer - 1f; + if (Vector2.Distance(vector4, NPC.Center) < 32f) + NPC.ai[1] = fireballBreathTimer - 1f; } - if (npc.ai[1] == fireballBreathTimer) + if (NPC.ai[1] == fireballBreathTimer) { int direction = (targetData.Center.X > vectorCenter.X) ? 1 : -1; - npc.velocity = new Vector2(direction, 0f) * fireballBreathPhaseVelocity; - npc.direction = npc.spriteDirection = direction; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonFire"), npc.Center); + NPC.velocity = new Vector2(direction, 0f) * fireballBreathPhaseVelocity; + NPC.direction = NPC.spriteDirection = direction; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonFire"), NPC.Center); } - if (npc.ai[1] >= fireballBreathTimer) + if (NPC.ai[1] >= fireballBreathTimer) { - if (npc.ai[1] % 10 == 0 && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.ai[1] % 10 == 0 && Main.netMode != NetmodeID.MultiplayerClient) { float xOffset = 30f; - Vector2 position = vectorCenter + new Vector2((110f + xOffset) * npc.direction, -20f).RotatedBy(npc.rotation); + Vector2 position = vectorCenter + new Vector2((110f + xOffset) * NPC.direction, -20f).RotatedBy(NPC.rotation); Vector2 projectileVelocity = targetData.Center - position; projectileVelocity.Normalize(); projectileVelocity *= 0.1f; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(position, projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); } - if (Math.Abs(targetData.Center.X - vectorCenter.X) > 700f && Math.Abs(npc.velocity.X) < chargeSpeed) - npc.velocity.X += Math.Sign(npc.velocity.X) * 0.5f; + if (Math.Abs(targetData.Center.X - vectorCenter.X) > 700f && Math.Abs(NPC.velocity.X) < chargeSpeed) + NPC.velocity.X += Math.Sign(NPC.velocity.X) * 0.5f; } - if (npc.ai[1] >= fireballBreathPhaseTimer) + if (NPC.ai[1] >= fireballBreathPhaseTimer) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); } } // Splitting fireball breath - else if (npc.ai[0] == 4f) + else if (NPC.ai[0] == 4f) { int num31 = (vectorCenter.X < targetData.Center.X) ? 1 : -1; - npc.ai[2] = num31; + NPC.ai[2] = num31; - if (npc.ai[1] < splittingFireballBreathTimer) + if (NPC.ai[1] < splittingFireballBreathTimer) { Vector2 vector5 = targetData.Center + new Vector2(num31 * -750f, -300f); - Vector2 value2 = npc.SafeDirectionTo(vector5) * splittingFireballBreathPhaseVelocity; + Vector2 value2 = NPC.SafeDirectionTo(vector5) * splittingFireballBreathPhaseVelocity; - npc.velocity = Vector2.Lerp(npc.velocity, value2, 0.0333333351f); + NPC.velocity = Vector2.Lerp(NPC.velocity, value2, 0.0333333351f); int direction = (vectorCenter.X < targetData.Center.X) ? 1 : -1; - npc.direction = npc.spriteDirection = direction; + NPC.direction = NPC.spriteDirection = direction; if (Vector2.Distance(vector5, vectorCenter) < 32f) - npc.ai[1] = splittingFireballBreathTimer - 1f; + NPC.ai[1] = splittingFireballBreathTimer - 1f; } - else if (npc.ai[1] == splittingFireballBreathTimer) + else if (NPC.ai[1] == splittingFireballBreathTimer) { - Vector2 vector6 = npc.SafeDirectionTo(targetData.Center, Vector2.UnitX * npc.spriteDirection); + Vector2 vector6 = NPC.SafeDirectionTo(targetData.Center, Vector2.UnitX * NPC.spriteDirection); vector6.Y *= 0.15f; - vector6 = vector6.SafeNormalize(Vector2.UnitX * npc.direction); + vector6 = vector6.SafeNormalize(Vector2.UnitX * NPC.direction); - npc.spriteDirection = (vector6.X > 0f) ? 1 : -1; - npc.rotation = vector6.ToRotation(); + NPC.spriteDirection = (vector6.X > 0f) ? 1 : -1; + NPC.rotation = vector6.ToRotation(); - if (npc.spriteDirection == -1) - npc.rotation += pie; + if (NPC.spriteDirection == -1) + NPC.rotation += pie; - npc.velocity = vector6 * splittingFireballBreathPhaseVelocity; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonFire"), npc.Center); + NPC.velocity = vector6 * splittingFireballBreathPhaseVelocity; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonFire"), NPC.Center); } else { - npc.position.X += npc.SafeDirectionTo(targetData.Center).X * 7f; - npc.position.Y += npc.SafeDirectionTo(targetData.Center + new Vector2(0f, -400f)).Y * 6f; + NPC.position.X += NPC.SafeDirectionTo(targetData.Center).X * 7f; + NPC.position.Y += NPC.SafeDirectionTo(targetData.Center + new Vector2(0f, -400f)).Y * 6f; float xOffset = 30f; - Vector2 position = vectorCenter + new Vector2((110f + xOffset) * npc.direction, -20f).RotatedBy(npc.rotation); - int num34 = (int)(npc.ai[1] - splittingFireballBreathTimer + 1f); + Vector2 position = vectorCenter + new Vector2((110f + xOffset) * NPC.direction, -20f).RotatedBy(NPC.rotation); + int num34 = (int)(NPC.ai[1] - splittingFireballBreathTimer + 1f); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = NPC.GetProjectileDamage(type); if (num34 <= splittingFireballBreathTimer2 && num34 % splittingFireballBreathDivisor == 0 && Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(position, npc.velocity, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(position, NPC.velocity, type, damage, 0f, Main.myPlayer, 0f, 0f); } - if (npc.ai[1] > splittingFireballBreathPhaseTimer - splittingFireballBreathYVelocityTimer) - npc.velocity.Y -= 0.1f; + if (NPC.ai[1] > splittingFireballBreathPhaseTimer - splittingFireballBreathYVelocityTimer) + NPC.velocity.Y -= 0.1f; - npc.ai[1] += 1f; - if (npc.ai[1] >= splittingFireballBreathPhaseTimer) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= splittingFireballBreathPhaseTimer) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); } } // Fireball spin - else if (npc.ai[0] == 5f) + else if (NPC.ai[0] == 5f) { - npc.velocity = npc.velocity.RotatedBy(-(double)spinRotation * (float)npc.direction); - npc.rotation -= spinRotation * npc.direction; + NPC.velocity = NPC.velocity.RotatedBy(-(double)spinRotation * (float)NPC.direction); + NPC.rotation -= spinRotation * NPC.direction; - if (npc.ai[1] == 1f) + if (NPC.ai[1] == 1f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - flareDustBulletHellSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / (MathHelper.TwoPi * 3f); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); + flareDustBulletHellSpawn = NPC.Center + NPC.velocity.RotatedBy(MathHelper.PiOver2 * -NPC.direction) * spinTime / (MathHelper.TwoPi * 3f); } - npc.ai[1] += 1f; + NPC.ai[1] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { if (secondPhasePhase >= 3) @@ -2171,24 +2172,24 @@ namespace CalamityMod.NPCs.Yharon // For phase 4: Rotate spiral by 18 * (240 / 16) = +135 degrees and then back -135 degrees - if (npc.ai[1] % flareDustSpawnDivisor2 == 0f) + if (NPC.ai[1] % flareDustSpawnDivisor2 == 0f) { int totalProjectiles = secondPhasePhase == 4 ? 12 : 10; float projectileVelocity = secondPhasePhase == 4 ? 16f : 12f; float radialOffset = secondPhasePhase == 4 ? 2.8f : 3.2f; - if (npc.localAI[3] == 0f) + if (NPC.localAI[3] == 0f) { - DoFlareDustBulletHell(1, spinPhaseTimer, npc.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, projectileVelocity, radialOffset, true); + DoFlareDustBulletHell(1, spinPhaseTimer, NPC.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, projectileVelocity, radialOffset, true); } else { - int ringReduction = (int)MathHelper.Lerp(0f, 12f, npc.ai[1] / spinPhaseTimer); + int ringReduction = (int)MathHelper.Lerp(0f, 12f, NPC.ai[1] / spinPhaseTimer); int totalProjectiles2 = 38 - ringReduction; // 36 for first ring, 24 for last ring - DoFlareDustBulletHell(0, flareDustSpawnDivisor2, npc.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles2, 0f, 0f, true); + DoFlareDustBulletHell(0, flareDustSpawnDivisor2, NPC.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles2, 0f, 0f, true); } // Fire a flame towards every player, with a limit of 10 - if (expertMode && npc.ai[2] % (flareDustSpawnDivisor2 * 2) == 0f) + if (expertMode && NPC.ai[2] % (flareDustSpawnDivisor2 * 2) == 0f) { List targets = new List(); for (int p = 0; p < Main.maxPlayers; p++) @@ -2203,7 +2204,7 @@ namespace CalamityMod.NPCs.Yharon { Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 20f - flareDustBulletHellSpawn) * (projectileVelocity * 0.7f); int type = ModContent.ProjectileType(); - int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); + int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, NPC.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); Main.projectile[proj].extraUpdates += 1; } } @@ -2211,11 +2212,11 @@ namespace CalamityMod.NPCs.Yharon } else { - if (npc.ai[1] % flareDustSpawnDivisor == 0f) + if (NPC.ai[1] % flareDustSpawnDivisor == 0f) { - int ringReduction = (int)MathHelper.Lerp(0f, 12f, npc.ai[1] / spinPhaseTimer); + int ringReduction = (int)MathHelper.Lerp(0f, 12f, NPC.ai[1] / spinPhaseTimer); int totalProjectiles = 38 - ringReduction; // 36 for first ring, 24 for last ring - DoFlareDustBulletHell(0, flareDustSpawnDivisor, npc.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, 0f, 0f, true); + DoFlareDustBulletHell(0, flareDustSpawnDivisor, NPC.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, 0f, 0f, true); // Fire a flame towards every player, with a limit of 10 if (expertMode) @@ -2233,162 +2234,162 @@ namespace CalamityMod.NPCs.Yharon { Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 20f - flareDustBulletHellSpawn) * 8f; int type = ModContent.ProjectileType(); - int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); + int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, NPC.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); Main.projectile[proj].extraUpdates += 1; } } } } - if (npc.ai[1] == 210f && secondPhasePhase == 4 && useTornado) + if (NPC.ai[1] == 210f && secondPhasePhase == 4 && useTornado) { useTornado = false; - Projectile.NewProjectile(vectorCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); + Projectile.NewProjectile(vectorCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.target + 1); } } - if (npc.ai[1] >= spinPhaseTimer) + if (NPC.ai[1] >= spinPhaseTimer) { - npc.ai[0] = 1f; - npc.ai[1] = increasedIdleTimeAfterBulletHell; - npc.ai[2] = 0f; - npc.localAI[2] = 0f; - npc.TargetClosest(); - npc.velocity /= 2f; + NPC.ai[0] = 1f; + NPC.ai[1] = increasedIdleTimeAfterBulletHell; + NPC.ai[2] = 0f; + NPC.localAI[2] = 0f; + NPC.TargetClosest(); + NPC.velocity /= 2f; } } // Fire ring - else if (npc.ai[0] == 6f) + else if (NPC.ai[0] == 6f) { - if (npc.ai[1] == 0f) + if (NPC.ai[1] == 0f) { Vector2 destination2 = targetData.Center + new Vector2(0f, -200f); - Vector2 desiredVelocity2 = npc.SafeDirectionTo(destination2) * velocity * 1.5f; - npc.SimpleFlyMovement(desiredVelocity2, acceleration * 1.5f); + Vector2 desiredVelocity2 = NPC.SafeDirectionTo(destination2) * velocity * 1.5f; + NPC.SimpleFlyMovement(desiredVelocity2, acceleration * 1.5f); int num35 = (vectorCenter.X < targetData.Center.X) ? 1 : -1; - npc.direction = npc.spriteDirection = num35; + NPC.direction = NPC.spriteDirection = num35; - npc.ai[2] += 1f; - if (npc.Distance(targetData.Center) < 600f || npc.ai[2] >= 180f) + NPC.ai[2] += 1f; + if (NPC.Distance(targetData.Center) < 600f || NPC.ai[2] >= 180f) { - npc.ai[1] = 1f; - npc.netUpdate = true; + NPC.ai[1] = 1f; + NPC.netUpdate = true; } } else { - if (npc.ai[1] < flareSpawnDecelerationTimer) - npc.velocity *= 0.95f; + if (NPC.ai[1] < flareSpawnDecelerationTimer) + NPC.velocity *= 0.95f; else - npc.velocity *= 0.98f; + NPC.velocity *= 0.98f; - if (npc.ai[1] == flareSpawnDecelerationTimer) + if (NPC.ai[1] == flareSpawnDecelerationTimer) { - if (npc.velocity.Y > 0f) - npc.velocity.Y /= 3f; + if (NPC.velocity.Y > 0f) + NPC.velocity.Y /= 3f; - npc.velocity.Y -= 3f; + NPC.velocity.Y -= 3f; } if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.ai[1] == 20f || npc.ai[1] == 80f || npc.ai[1] == 140f) + if (NPC.ai[1] == 20f || NPC.ai[1] == 80f || NPC.ai[1] == 140f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)NPC.position.X, (int)NPC.position.Y); - DoFireRing(expertMode ? 300 : 180, npc.GetProjectileDamage(ModContent.ProjectileType()), npc.target, 1f); + DoFireRing(expertMode ? 300 : 180, NPC.GetProjectileDamage(ModContent.ProjectileType()), NPC.target, 1f); } } - npc.ai[1] += 1f; + NPC.ai[1] += 1f; } - if (npc.ai[1] >= flareSpawnPhaseTimer) + if (NPC.ai[1] >= flareSpawnPhaseTimer) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)NPC.position.X, (int)NPC.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(vectorCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); + Projectile.NewProjectile(vectorCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.target + 1); - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); } } // Fast charge - else if (npc.ai[0] == 7f) + else if (NPC.ai[0] == 7f) { - if (npc.ai[1] == 1f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[1] == 1f) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)NPC.position.X, (int)NPC.position.Y); ChargeDust(14, pie); - npc.ai[1] += 1f; - if (npc.ai[1] >= chargeTime) + NPC.ai[1] += 1f; + if (NPC.ai[1] >= chargeTime) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); } } // Teleport - else if (npc.ai[0] == 8f) + else if (NPC.ai[0] == 8f) { Vector2 npcCenter = vectorCenter; - if (npc.alpha < 255) + if (NPC.alpha < 255) { - npc.alpha += 17; - if (npc.alpha > 255) - npc.alpha = 255; + NPC.alpha += 17; + if (NPC.alpha > 255) + NPC.alpha = 255; } - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == 15f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (NPC.ai[2] == 15f) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)NPC.position.X, (int)NPC.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == 15f) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == 15f) { - if (npc.ai[1] == 0f) - npc.ai[1] = 450 * Math.Sign((npcCenter - targetData.Center).X); + if (NPC.ai[1] == 0f) + NPC.ai[1] = 450 * Math.Sign((npcCenter - targetData.Center).X); teleportLocation = Main.rand.NextBool(2) ? (revenge ? 500 : 600) : (revenge ? -500 : -600); - Vector2 center = targetData.Center + new Vector2(-npc.ai[1], teleportLocation); - npcCenter = npc.Center = center; + Vector2 center = targetData.Center + new Vector2(-NPC.ai[1], teleportLocation); + npcCenter = NPC.Center = center; } - npc.ai[2] += 1f; - if (npc.ai[2] >= teleportPhaseTimer) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= teleportPhaseTimer) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.localAI[1] = fastChargeTelegraphTime + 1f; - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.localAI[1] = fastChargeTelegraphTime + 1f; + NPC.netUpdate = true; } } // Enter new phase - else if (npc.ai[0] == 9f) + else if (NPC.ai[0] == 9f) { - npc.velocity *= 0.9f; + NPC.velocity *= 0.9f; - Vector2 vector = npc.SafeDirectionTo(targetData.Center, -Vector2.UnitY); - npc.spriteDirection = (vector.X > 0f) ? 1 : -1; - npc.rotation = vector.ToRotation(); + Vector2 vector = NPC.SafeDirectionTo(targetData.Center, -Vector2.UnitY); + NPC.spriteDirection = (vector.X > 0f) ? 1 : -1; + NPC.rotation = vector.ToRotation(); - if (npc.spriteDirection == -1) - npc.rotation += pie; + if (NPC.spriteDirection == -1) + NPC.rotation += pie; - if (npc.ai[2] == 120f) + if (NPC.ai[2] == 120f) { if (secondPhasePhase == 4) { @@ -2410,25 +2411,25 @@ namespace CalamityMod.NPCs.Yharon } } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)NPC.position.X, (int)NPC.position.Y); } - npc.ai[2] += 1f; - if (npc.ai[2] >= 180f) + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 180f) { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; } } - float num42 = npc.AngleTo(targetData.Center); + float num42 = NPC.AngleTo(targetData.Center); float num43 = 0.04f; - switch ((int)npc.ai[0]) + switch ((int)NPC.ai[0]) { case 2: case 5: @@ -2441,12 +2442,12 @@ namespace CalamityMod.NPCs.Yharon num43 = 0.01f; num42 = 0f; - if (npc.spriteDirection == -1) + if (NPC.spriteDirection == -1) num42 -= pie; - if (npc.ai[1] >= fireballBreathTimer) + if (NPC.ai[1] >= fireballBreathTimer) { - num42 += npc.spriteDirection * pie / 12f; + num42 += NPC.spriteDirection * pie / 12f; num43 = 0.05f; } @@ -2455,7 +2456,7 @@ namespace CalamityMod.NPCs.Yharon num43 = 0.01f; num42 = pie; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) num42 += pie; break; @@ -2463,17 +2464,17 @@ namespace CalamityMod.NPCs.Yharon num43 = 0.02f; num42 = 0f; - if (npc.spriteDirection == -1) + if (NPC.spriteDirection == -1) num42 -= pie; break; } - if (npc.spriteDirection == -1) + if (NPC.spriteDirection == -1) num42 += pie; if (num43 != 0f) - npc.rotation = npc.rotation.AngleTowards(num42, num43); + NPC.rotation = NPC.rotation.AngleTowards(num42, num43); } #endregion @@ -2482,14 +2483,14 @@ namespace CalamityMod.NPCs.Yharon { for (int num1474 = 0; num1474 < dustAmt; num1474++) { - Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; - vector171 = vector171.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)pie / (float)dustAmt) + npc.Center; + Vector2 vector171 = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; + vector171 = vector171.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)pie / (float)dustAmt) + NPC.Center; Vector2 value18 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 244, value18.X * 2f, value18.Y * 2f, 100, default, 1.4f); Main.dust[num1475].noGravity = true; Main.dust[num1475].noLight = true; Main.dust[num1475].velocity /= 4f; - Main.dust[num1475].velocity -= npc.velocity; + Main.dust[num1475].velocity -= NPC.velocity; } } #endregion @@ -2497,8 +2498,8 @@ namespace CalamityMod.NPCs.Yharon #region Flare Dust Bullet Hell private void DoFlareDustBulletHell(int attackType, int timer, int projectileDamage, int totalProjectiles, float projectileVelocity, float radialOffset, bool phase2) { - Main.PlaySound(SoundID.Item20, flareDustBulletHellSpawn); - float aiVariableUsed = phase2 ? npc.ai[1] : npc.ai[2]; + SoundEngine.PlaySound(SoundID.Item20, flareDustBulletHellSpawn); + float aiVariableUsed = phase2 ? NPC.ai[1] : NPC.ai[2]; switch (attackType) { case 0: @@ -2519,7 +2520,7 @@ namespace CalamityMod.NPCs.Yharon case 1: double radians = MathHelper.TwoPi / totalProjectiles; - Vector2 spinningPoint = Vector2.Normalize(new Vector2(-npc.localAI[2], -projectileVelocity)); + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-NPC.localAI[2], -projectileVelocity)); for (int i = 0; i < totalProjectiles; i++) { @@ -2528,7 +2529,7 @@ namespace CalamityMod.NPCs.Yharon } float newRadialOffset = (int)aiVariableUsed / (timer / 4) % 2f == 0f ? radialOffset : -radialOffset; - npc.localAI[2] += newRadialOffset; + NPC.localAI[2] += newRadialOffset; break; default: @@ -2548,7 +2549,7 @@ namespace CalamityMod.NPCs.Yharon for (int i = 0; i < totalProjectiles; i++) { Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); - int proj = Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, ai0, ai1); + int proj = Projectile.NewProjectile(NPC.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, ai0, ai1); Main.projectile[proj].timeLeft = timeLeft; } } @@ -2558,36 +2559,36 @@ namespace CalamityMod.NPCs.Yharon #region Drawing public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - bool idlePhases = (!startSecondAI && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f)) || (startSecondAI && (npc.ai[0] == 5f || npc.ai[0] < 2f)); + bool idlePhases = (!startSecondAI && (NPC.ai[0] == 0f || NPC.ai[0] == 6f || NPC.ai[0] == 13f)) || (startSecondAI && (NPC.ai[0] == 5f || NPC.ai[0] < 2f)); - bool chargingOrSpawnPhases = (!startSecondAI && (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || npc.ai[0] == 14f || npc.ai[0] == 18f)) || - (startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 2f || npc.ai[0] == 7f)); + bool chargingOrSpawnPhases = (!startSecondAI && (NPC.ai[0] == 1f || NPC.ai[0] == 5f || NPC.ai[0] == 7f || NPC.ai[0] == 11f || NPC.ai[0] == 14f || NPC.ai[0] == 18f)) || + (startSecondAI && (NPC.ai[0] == 6f || NPC.ai[0] == 2f || NPC.ai[0] == 7f)); - bool projectileOrCirclePhases = (!startSecondAI && (npc.ai[0] == 2f || npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f || npc.ai[0] == 20f)) || - (startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 3f)); + bool projectileOrCirclePhases = (!startSecondAI && (NPC.ai[0] == 2f || NPC.ai[0] == 8f || NPC.ai[0] == 12f || NPC.ai[0] == 15f || NPC.ai[0] == 19f || NPC.ai[0] == 20f)) || + (startSecondAI && (NPC.ai[0] == 4f || NPC.ai[0] == 3f)); - bool tornadoPhase = !startSecondAI && (npc.ai[0] == 3f || npc.ai[0] == 9f || npc.ai[0] == -1f || npc.ai[0] == 16f); + bool tornadoPhase = !startSecondAI && (NPC.ai[0] == 3f || NPC.ai[0] == 9f || NPC.ai[0] == -1f || NPC.ai[0] == 16f); - bool newPhasePhase = (!startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 10f || npc.ai[0] == 17f)) || (startSecondAI && npc.ai[0] == 9f); + bool newPhasePhase = (!startSecondAI && (NPC.ai[0] == 4f || NPC.ai[0] == 10f || NPC.ai[0] == 17f)) || (startSecondAI && NPC.ai[0] == 9f); - bool pauseAfterTeleportPhase = startSecondAI && npc.ai[0] == 8f; + bool pauseAfterTeleportPhase = startSecondAI && NPC.ai[0] == 8f; bool ai2 = startSecondAI; SpriteEffects spriteEffects = ai2 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - if (npc.spriteDirection == 1) + if (NPC.spriteDirection == 1) spriteEffects = ai2 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture = Main.npcTexture[NPC.type]; + Vector2 vector11 = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[NPC.type] / 2); Color color = lightColor; Color invincibleColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); Color color36 = Color.White; float amount9 = 0f; bool invincible = ai2 && invincibilityCounter < Phase2InvincibilityTime; - bool flag8 = npc.ai[0] > 5f; - bool flag9 = npc.ai[0] > 12f; + bool flag8 = NPC.ai[0] > 5f; + bool flag9 = NPC.ai[0] > 12f; bool flag10 = startSecondAI; int num150 = 120; int num151 = 60; @@ -2598,16 +2599,16 @@ namespace CalamityMod.NPCs.Yharon color = CalamityGlobalNPC.buffColor(color, 0.8f, 0.7f, 0.4f, 1f); else if (flag8) color = CalamityGlobalNPC.buffColor(color, 0.7f, 0.7f, 0.5f, 1f); - else if (npc.ai[0] == 4f && npc.ai[2] > num150) + else if (NPC.ai[0] == 4f && NPC.ai[2] > num150) { - float num152 = npc.ai[2] - num150; + float num152 = NPC.ai[2] - num150; num152 /= num151; color = CalamityGlobalNPC.buffColor(color, 1f - 0.3f * num152, 1f - 0.3f * num152, 1f - 0.5f * num152, 1f); } int num153 = 10; int num154 = 2; - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) num153 = 0; if (idlePhases) num153 = 7; @@ -2628,12 +2629,12 @@ namespace CalamityMod.NPCs.Yharon { Color color38 = color; color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); + color38 = NPC.GetAlpha(color38); color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } @@ -2641,26 +2642,26 @@ namespace CalamityMod.NPCs.Yharon float num157 = 0f; float scaleFactor9 = 0f; - if (npc.ai[0] == -1f) + if (NPC.ai[0] == -1f) num156 = 0; if (tornadoPhase) { int num158 = 60; int num159 = 30; - if (npc.ai[2] > num158) + if (NPC.ai[2] > num158) { num156 = 6; - num157 = 1f - (float)Math.Cos((npc.ai[2] - num158) / num159 * MathHelper.TwoPi); + num157 = 1f - (float)Math.Cos((NPC.ai[2] - num158) / num159 * MathHelper.TwoPi); num157 /= 3f; scaleFactor9 = 40f; } } - if (newPhasePhase && npc.ai[2] > num150) + if (newPhasePhase && NPC.ai[2] > num150) { num156 = 6; - num157 = 1f - (float)Math.Cos((npc.ai[2] - num150) / num151 * MathHelper.TwoPi); + num157 = 1f - (float)Math.Cos((NPC.ai[2] - num150) / num151 * MathHelper.TwoPi); num157 /= 3f; scaleFactor9 = 60f; } @@ -2668,7 +2669,7 @@ namespace CalamityMod.NPCs.Yharon if (pauseAfterTeleportPhase) { num156 = 6; - num157 = 1f - (float)Math.Cos(npc.ai[2] / 30f * MathHelper.TwoPi); + num157 = 1f - (float)Math.Cos(NPC.ai[2] / 30f * MathHelper.TwoPi); num157 /= 3f; scaleFactor9 = 20f; } @@ -2679,31 +2680,31 @@ namespace CalamityMod.NPCs.Yharon { Color color39 = lightColor; color39 = Color.Lerp(color39, color36, amount9); - color39 = npc.GetAlpha(color39); + color39 = NPC.GetAlpha(color39); color39 *= 1f - num157; - Vector2 vector42 = npc.Center + (num160 / (float)num156 * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; - vector42 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector42 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, vector42, npc.frame, color39, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector42 = NPC.Center + (num160 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; + vector42 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector42 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, vector42, NPC.frame, color39, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, vector43, npc.frame, invincible ? invincibleColor : npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector43 = NPC.Center - Main.screenPosition; + vector43 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, vector43, NPC.frame, invincible ? invincibleColor : NPC.GetAlpha(lightColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - if (flag8 || npc.ai[0] == 4f || startSecondAI) + if (flag8 || NPC.ai[0] == 4f || startSecondAI) { - texture = ModContent.GetTexture("CalamityMod/NPCs/Yharon/YharonGlowOrange"); + texture = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowOrange"); Color color40 = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Orange, 0.5f); color36 = invincible ? invincibleColor : Color.Orange; - Texture2D texture2 = ModContent.GetTexture("CalamityMod/NPCs/Yharon/YharonGlowGreen"); + Texture2D texture2 = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowGreen"); Color color43 = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Chartreuse, 0.5f); Color color44 = invincible ? invincibleColor : Color.Chartreuse; - Texture2D texture3 = ModContent.GetTexture("CalamityMod/NPCs/Yharon/YharonGlowPurple"); + Texture2D texture3 = ModContent.Request("CalamityMod/NPCs/Yharon/YharonGlowPurple"); Color color45 = Color.Lerp(Color.White, invincible ? invincibleColor : Color.BlueViolet, 0.5f); Color color46 = invincible ? invincibleColor : Color.BlueViolet; @@ -2714,18 +2715,18 @@ namespace CalamityMod.NPCs.Yharon if (newPhasePhase) { - float num161 = npc.ai[2] - num150; + float num161 = NPC.ai[2] - num150; num161 /= num151; color36 *= num161; color40 *= num161; - if (flag9 || npc.ai[0] == 10f || startSecondAI) + if (flag9 || NPC.ai[0] == 10f || startSecondAI) { color43 *= num161; color44 *= num161; } - if (flag10 || npc.ai[0] == 17f) + if (flag10 || NPC.ai[0] == 17f) { color45 *= num161; color46 *= num161; @@ -2734,7 +2735,7 @@ namespace CalamityMod.NPCs.Yharon if (pauseAfterTeleportPhase) { - float num162 = npc.ai[2]; + float num162 = NPC.ai[2]; num162 /= 30f; if (num162 > 0.5f) @@ -2757,25 +2758,25 @@ namespace CalamityMod.NPCs.Yharon Color color41 = color40; color41 = Color.Lerp(color41, color36, amount9); color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - if (flag9 || npc.ai[0] == 10f || startSecondAI) + if (flag9 || NPC.ai[0] == 10f || startSecondAI) { Color color47 = color43; color47 = Color.Lerp(color47, color44, amount9); color47 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture2, vector44, npc.frame, color47, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2, vector44, NPC.frame, color47, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } - if (flag10 || npc.ai[0] == 17f) + if (flag10 || NPC.ai[0] == 17f) { Color color48 = color45; color48 = Color.Lerp(color48, color46, amount9); color48 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture3, vector44, npc.frame, color48, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture3, vector44, NPC.frame, color48, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } @@ -2783,40 +2784,40 @@ namespace CalamityMod.NPCs.Yharon { Color color42 = color40; color42 = Color.Lerp(color42, color36, amount9); - color42 = npc.GetAlpha(color42); + color42 = NPC.GetAlpha(color42); color42 *= 1f - num157; - Vector2 vector45 = npc.Center + (num164 / (float)num156 * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; - vector45 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector45 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, vector45, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Vector2 vector45 = NPC.Center + (num164 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; + vector45 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector45 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, vector45, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - if (flag9 || npc.ai[0] == 10f || startSecondAI) + if (flag9 || NPC.ai[0] == 10f || startSecondAI) { Color color49 = color43; color49 = Color.Lerp(color49, color44, amount9); - color49 = npc.GetAlpha(color49); + color49 = NPC.GetAlpha(color49); color49 *= 1f - num157; - spriteBatch.Draw(texture2, vector45, npc.frame, color49, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2, vector45, NPC.frame, color49, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } - if (flag10 || npc.ai[0] == 17f) + if (flag10 || NPC.ai[0] == 17f) { Color color50 = color45; color50 = Color.Lerp(color50, color46, amount9); - color50 = npc.GetAlpha(color50); + color50 = NPC.GetAlpha(color50); color50 *= 1f - num157; - spriteBatch.Draw(texture3, vector45, npc.frame, color50, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture3, vector45, NPC.frame, color50, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } } - spriteBatch.Draw(texture, vector43, npc.frame, color40, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, vector43, NPC.frame, color40, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - if (flag9 || npc.ai[0] == 10f || startSecondAI) - spriteBatch.Draw(texture2, vector43, npc.frame, color43, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + if (flag9 || NPC.ai[0] == 10f || startSecondAI) + spriteBatch.Draw(texture2, vector43, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - if (flag10 || npc.ai[0] == 17f) - spriteBatch.Draw(texture3, vector43, npc.frame, color45, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + if (flag10 || NPC.ai[0] == 17f) + spriteBatch.Draw(texture3, vector43, NPC.frame, color45, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } return false; @@ -2828,17 +2829,17 @@ namespace CalamityMod.NPCs.Yharon { CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedYharon); - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); // Bags occur in either phase 1 or 2, as they don't contain phase 2 only drops - DropHelper.DropBags(npc); + DropHelper.DropBags(NPC); // Normal drops: Everything that would otherwise be in the bag if (!Main.expertMode) { // Weapons float w = DropHelper.NormalWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(npc, + DropHelper.DropEntireWeightedSet(NPC, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -2850,28 +2851,28 @@ namespace CalamityMod.NPCs.Yharon ); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); // Materials int soulFragMin = 15; int soulFragMax = 22; - DropHelper.DropItem(npc, ModContent.ItemType(), true, soulFragMin, soulFragMax); + DropHelper.DropItem(NPC, ModContent.ItemType(), true, soulFragMin, soulFragMax); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); - DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); + DropHelper.DropItem(NPC, ModContent.ItemType(), true); } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); // Other // DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedYharon); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedYharon); // If Yharon has not been killed yet, notify players of Auric Ore if (!CalamityWorld.downedYharon) @@ -2928,53 +2929,53 @@ namespace CalamityMod.NPCs.Yharon public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } #endregion #region Find Frame public override void FindFrame(int frameHeight) { - bool idlePhases = (!startSecondAI && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f)) || (startSecondAI && (npc.ai[0] == 5f || npc.ai[0] < 2f)); + bool idlePhases = (!startSecondAI && (NPC.ai[0] == 0f || NPC.ai[0] == 6f || NPC.ai[0] == 13f)) || (startSecondAI && (NPC.ai[0] == 5f || NPC.ai[0] < 2f)); - bool chargingOrSpawnPhases = (!startSecondAI && (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || npc.ai[0] == 14f || npc.ai[0] == 18f)) || - (startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 2f || npc.ai[0] == 7f)); + bool chargingOrSpawnPhases = (!startSecondAI && (NPC.ai[0] == 1f || NPC.ai[0] == 5f || NPC.ai[0] == 7f || NPC.ai[0] == 11f || NPC.ai[0] == 14f || NPC.ai[0] == 18f)) || + (startSecondAI && (NPC.ai[0] == 6f || NPC.ai[0] == 2f || NPC.ai[0] == 7f)); - bool projectileOrCirclePhases = (!startSecondAI && (npc.ai[0] == 2f || npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f || npc.ai[0] == 20f)) || - (startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 3f || npc.ai[0] == 8f)); + bool projectileOrCirclePhases = (!startSecondAI && (NPC.ai[0] == 2f || NPC.ai[0] == 8f || NPC.ai[0] == 12f || NPC.ai[0] == 15f || NPC.ai[0] == 19f || NPC.ai[0] == 20f)) || + (startSecondAI && (NPC.ai[0] == 4f || NPC.ai[0] == 3f || NPC.ai[0] == 8f)); - bool tornadoPhase = !startSecondAI && (npc.ai[0] == 3f || npc.ai[0] == 9f || npc.ai[0] == -1f || npc.ai[0] == 16f); + bool tornadoPhase = !startSecondAI && (NPC.ai[0] == 3f || NPC.ai[0] == 9f || NPC.ai[0] == -1f || NPC.ai[0] == 16f); - bool newPhasePhase = (!startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 10f || npc.ai[0] == 17f)) || (startSecondAI && npc.ai[0] == 9f); + bool newPhasePhase = (!startSecondAI && (NPC.ai[0] == 4f || NPC.ai[0] == 10f || NPC.ai[0] == 17f)) || (startSecondAI && NPC.ai[0] == 9f); - bool chargeTelegraph = (!startSecondAI && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f) && npc.localAI[1] > 0f) || - (startSecondAI && npc.ai[0] < 2f && npc.localAI[1] > 0f); + bool chargeTelegraph = (!startSecondAI && (NPC.ai[0] == 0f || NPC.ai[0] == 6f || NPC.ai[0] == 13f) && NPC.localAI[1] > 0f) || + (startSecondAI && NPC.ai[0] < 2f && NPC.localAI[1] > 0f); if (chargeTelegraph) { // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + float lifeRatio = NPC.life / (float)NPC.lifeMax; - bool doTelegraphFlightAnimation = npc.localAI[1] < fastChargeTelegraphTime * 0.5f || npc.localAI[1] > fastChargeTelegraphTime - (fastChargeTelegraphTime / 6f); - bool doTelegraphRoarAnimation = npc.localAI[1] > fastChargeTelegraphTime - fastChargeTelegraphTime * 0.4f && npc.localAI[1] < fastChargeTelegraphTime - fastChargeTelegraphTime * 0.2f; + bool doTelegraphFlightAnimation = NPC.localAI[1] < fastChargeTelegraphTime * 0.5f || NPC.localAI[1] > fastChargeTelegraphTime - (fastChargeTelegraphTime / 6f); + bool doTelegraphRoarAnimation = NPC.localAI[1] > fastChargeTelegraphTime - fastChargeTelegraphTime * 0.4f && NPC.localAI[1] < fastChargeTelegraphTime - fastChargeTelegraphTime * 0.2f; bool phase4 = startSecondAI && lifeRatio <= ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.165f : 0.11f) && (CalamityWorld.revenge || BossRushEvent.BossRushActive); if (doTelegraphFlightAnimation) { - npc.frameCounter += phase4 ? 2D : 1D; - if (npc.frameCounter > 5D) + NPC.frameCounter += phase4 ? 2D : 1D; + if (NPC.frameCounter > 5D) { - npc.frameCounter = 0D; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y >= frameHeight * 5) - npc.frame.Y = 0; + if (NPC.frame.Y >= frameHeight * 5) + NPC.frame.Y = 0; } else { - npc.frame.Y = frameHeight * 5; + NPC.frame.Y = frameHeight * 5; if (doTelegraphRoarAnimation) - npc.frame.Y = frameHeight * 6; + NPC.frame.Y = frameHeight * 6; } return; } @@ -2982,50 +2983,50 @@ namespace CalamityMod.NPCs.Yharon if (idlePhases) { int num84 = 5; - if (!startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 13f)) + if (!startSecondAI && (NPC.ai[0] == 6f || NPC.ai[0] == 13f)) { num84 = 4; } - npc.frameCounter += 1D; - if (npc.frameCounter > num84) + NPC.frameCounter += 1D; + if (NPC.frameCounter > num84) { - npc.frameCounter = 0D; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y >= frameHeight * 5) + if (NPC.frame.Y >= frameHeight * 5) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } if (chargingOrSpawnPhases) - npc.frame.Y = frameHeight * 5; + NPC.frame.Y = frameHeight * 5; if (projectileOrCirclePhases) - npc.frame.Y = frameHeight * 5; + NPC.frame.Y = frameHeight * 5; if (tornadoPhase) { int num85 = 90; - if (npc.ai[2] < num85 - 30 || npc.ai[2] > num85 - 10) + if (NPC.ai[2] < num85 - 30 || NPC.ai[2] > num85 - 10) { - npc.frameCounter += 1D; - if (npc.frameCounter > 5D) + NPC.frameCounter += 1D; + if (NPC.frameCounter > 5D) { - npc.frameCounter = 0D; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y >= frameHeight * 5) + if (NPC.frame.Y >= frameHeight * 5) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } else { - npc.frame.Y = frameHeight * 5; - if (npc.ai[2] > num85 - 20 && npc.ai[2] < num85 - 15) + NPC.frame.Y = frameHeight * 5; + if (NPC.ai[2] > num85 - 20 && NPC.ai[2] < num85 - 15) { - npc.frame.Y = frameHeight * 6; + NPC.frame.Y = frameHeight * 6; } } } @@ -3033,25 +3034,25 @@ namespace CalamityMod.NPCs.Yharon if (newPhasePhase) { int num86 = 180; - if (npc.ai[2] < num86 - 60 || npc.ai[2] > num86 - 20) + if (NPC.ai[2] < num86 - 60 || NPC.ai[2] > num86 - 20) { - npc.frameCounter += 1D; - if (npc.frameCounter > 5D) + NPC.frameCounter += 1D; + if (NPC.frameCounter > 5D) { - npc.frameCounter = 0D; - npc.frame.Y += frameHeight; + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; } - if (npc.frame.Y >= frameHeight * 5) + if (NPC.frame.Y >= frameHeight * 5) { - npc.frame.Y = 0; + NPC.frame.Y = 0; } } else { - npc.frame.Y = frameHeight * 5; - if (npc.ai[2] > num86 - 50 && npc.ai[2] < num86 - 25) + NPC.frame.Y = frameHeight * 5; + if (NPC.ai[2] > num86 - 50 && NPC.ai[2] < num86 - 25) { - npc.frame.Y = frameHeight * 6; + NPC.frame.Y = frameHeight * 6; } } } @@ -3063,20 +3064,20 @@ namespace CalamityMod.NPCs.Yharon { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } - if (npc.life <= 0) + if (NPC.life <= 0) { DoFireRing(300, (Main.expertMode || BossRushEvent.BossRushActive) ? 125 : 150, -1f, 0f); - npc.position.X = npc.position.X + (npc.width / 2); - npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 300; - npc.height = 280; - npc.position.X = npc.position.X - (npc.width / 2); - npc.position.Y = npc.position.Y - (npc.height / 2); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 300; + NPC.height = 280; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -3086,16 +3087,16 @@ namespace CalamityMod.NPCs.Yharon } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } // Turn into dust on death. - if (npc.life <= 0) - DeathAshParticle.CreateAshesFromNPC(npc); + if (NPC.life <= 0) + DeathAshParticle.CreateAshesFromNPC(NPC); } } #endregion diff --git a/Particles/BaseParticleSet.cs b/Particles/BaseParticleSet.cs index 060fcfa356..b4021b17ba 100644 --- a/Particles/BaseParticleSet.cs +++ b/Particles/BaseParticleSet.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Particles particle.CustomDraw(Main.spriteBatch, basePosition); else { - var tex = ModContent.GetTexture(particle.Texture); + var tex = ModContent.Request(particle.Texture); Vector2 drawPosition = basePosition - Main.screenPosition + particle.RelativeOffset; Color particleColor = particle.Color; diff --git a/Particles/BloodParticle.cs b/Particles/BloodParticle.cs index 8a8fe242de..c9438f0b9f 100644 --- a/Particles/BloodParticle.cs +++ b/Particles/BloodParticle.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Particles float verticalStretch = Utils.InverseLerp(0f, 24f, Math.Abs(Velocity.Y), true) * 0.84f; float brightness = (float)Math.Pow(Lighting.Brightness((int)(Position.X / 16f), (int)(Position.Y / 16f)), 0.15); Vector2 scale = new Vector2(1f, verticalStretch + 1f) * Scale * 0.1f; - Texture2D texture = ModContent.GetTexture(Texture); + Texture2D texture = ModContent.Request(Texture); spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color * brightness, Rotation, texture.Size() * 0.5f, scale, 0, 0f); } diff --git a/Particles/BloodParticle2.cs b/Particles/BloodParticle2.cs index 500fdd6c7c..07621d05ff 100644 --- a/Particles/BloodParticle2.cs +++ b/Particles/BloodParticle2.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { float brightness = (float)Math.Pow(Lighting.Brightness((int)(Position.X / 16f), (int)(Position.Y / 16f)), 0.15); - Texture2D texture = ModContent.GetTexture(Texture); + Texture2D texture = ModContent.Request(Texture); Rectangle frame = texture.Frame(1, 3, 0, (int)(LifetimeCompletion * 3f)); Vector2 origin = frame.Size() * 0.5f; diff --git a/Particles/BloomLineVFX.cs b/Particles/BloomLineVFX.cs index 49c371b71b..eedc6d6e78 100644 --- a/Particles/BloomLineVFX.cs +++ b/Particles/BloomLineVFX.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D tex = GeneralParticleHandler.GetTexture(Type); + Texture2D tex = GeneralParticleHandler.Assets.Request(Type).Value; float rot = LineVector.ToRotation() + MathHelper.PiOver2; Vector2 origin = new Vector2(tex.Width/2f, tex.Height); Vector2 scale = new Vector2(Scale, LineVector.Length() / tex.Height); @@ -41,7 +41,7 @@ namespace CalamityMod.Particles if (Capped) { - Texture2D cap = ModContent.GetTexture("CalamityMod/Particles/BloomLineCap"); ; + Texture2D cap = ModContent.Request("CalamityMod/Particles/BloomLineCap"); ; scale = new Vector2(Scale, Scale); origin = new Vector2(cap.Width / 2f, cap.Height); diff --git a/Particles/BloomRing.cs b/Particles/BloomRing.cs index 9dad40b433..3158cd3766 100644 --- a/Particles/BloomRing.cs +++ b/Particles/BloomRing.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D tex = GeneralParticleHandler.GetTexture(Type); + Texture2D tex = GeneralParticleHandler.Assets.Request(Type).Value; spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale, SpriteEffects.None, 0); } diff --git a/Particles/ChargeUpLineVFX.cs b/Particles/ChargeUpLineVFX.cs index 0f57dd1d31..d604987122 100644 --- a/Particles/ChargeUpLineVFX.cs +++ b/Particles/ChargeUpLineVFX.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch, Vector2 basePosition) { - Texture2D tex = ModContent.GetTexture("CalamityMod/Particles/Light"); + Texture2D tex = ModContent.Request("CalamityMod/Particles/Light"); float rot = LineDirection + MathHelper.PiOver2; Vector2 origin = new Vector2(tex.Width / 2f, tex.Height); diff --git a/Particles/ConstellationRing.cs b/Particles/ConstellationRing.cs index 937ff1bef3..a9c62f5104 100644 --- a/Particles/ConstellationRing.cs +++ b/Particles/ConstellationRing.cs @@ -42,9 +42,9 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D ringTexture = GeneralParticleHandler.GetTexture(Type); - Texture2D starTexture = ModContent.GetTexture("CalamityMod/Particles/Sparkle"); - Texture2D bloomTexture = ModContent.GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D ringTexture = GeneralParticleHandler.Assets.Request(Type).Value; + Texture2D starTexture = ModContent.Request("CalamityMod/Particles/Sparkle"); + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); spriteBatch.Draw(ringTexture, Position - Main.screenPosition, null, Color * Opacity, Rotation, ringTexture.Size() / 2f, Squish * Scale, SpriteEffects.None, 0); diff --git a/Particles/CritSpark.cs b/Particles/CritSpark.cs index 1e4f28d1d2..242468fa77 100644 --- a/Particles/CritSpark.cs +++ b/Particles/CritSpark.cs @@ -49,8 +49,8 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D sparkTexture = GeneralParticleHandler.GetTexture(Type); - Texture2D bloomTexture = ModContent.GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D sparkTexture = GeneralParticleHandler.Assets.Request(Type).Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)sparkTexture.Height / (float)bloomTexture.Height; diff --git a/Particles/ElectricSpark.cs b/Particles/ElectricSpark.cs index 6ddfcfcc97..391f8d1b9d 100644 --- a/Particles/ElectricSpark.cs +++ b/Particles/ElectricSpark.cs @@ -55,9 +55,9 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D sparkTexture = GeneralParticleHandler.GetTexture(Type); + Texture2D sparkTexture = GeneralParticleHandler.Assets.Request(Type).Value; Rectangle frame = new Rectangle(0, 6 * Variant, 6, 6); - Texture2D bloomTexture = ModContent.GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)frame.Height / (float)bloomTexture.Height; diff --git a/Particles/FakeDustParticle.cs b/Particles/FakeDustParticle.cs index ead5403161..c25c325e84 100644 --- a/Particles/FakeDustParticle.cs +++ b/Particles/FakeDustParticle.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D dustTexture = Big ? ModContent.GetTexture("CalamityMod/Particles/FakeDustBig") : GeneralParticleHandler.GetTexture(Type); + Texture2D dustTexture = Big ? ModContent.Request("CalamityMod/Particles/FakeDustBig") : GeneralParticleHandler.Assets.Request(Type).Value; Rectangle frame = new Rectangle(0, (Big ? 8 : 6) * Variant, (Big ? 8 : 6), (Big ? 8 : 6)); spriteBatch.Draw(dustTexture, Position - Main.screenPosition, frame, Color * opacity, Rotation, frame.Size() / 2f, Scale, SpriteEffects.None, 0); } diff --git a/Particles/FlareShine.cs b/Particles/FlareShine.cs index 188ff7eaf6..7da2834eaf 100644 --- a/Particles/FlareShine.cs +++ b/Particles/FlareShine.cs @@ -68,8 +68,8 @@ namespace CalamityMod.Particles { if (SpawnDelay > 0) return; - Texture2D sparkTexture = GeneralParticleHandler.GetTexture(Type); - Texture2D bloomTexture = ModContent.GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D sparkTexture = GeneralParticleHandler.Assets.Request(Type).Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)sparkTexture.Height / (float)bloomTexture.Height; Vector2 squish = Vector2.Lerp(OriginalScale, FinalScale, PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) })); diff --git a/Particles/GeneralParticleHandler.cs b/Particles/GeneralParticleHandler.cs index 7b3c70fcf8..6f4f1a3063 100644 --- a/Particles/GeneralParticleHandler.cs +++ b/Particles/GeneralParticleHandler.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Particles string texturePath = type.Namespace.Replace('.', '/') + "/" + type.Name; if (instance.Texture != "") texturePath = instance.Texture; - particleTextures[ID] = ModContent.GetTexture(texturePath); + particleTextures[ID] = ModContent.Request(texturePath); } } } diff --git a/Particles/GenericBloom.cs b/Particles/GenericBloom.cs index f439d0f340..1d8c0fc004 100644 --- a/Particles/GenericBloom.cs +++ b/Particles/GenericBloom.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D tex = GeneralParticleHandler.GetTexture(Type); + Texture2D tex = GeneralParticleHandler.Assets.Request(Type).Value; spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale, SpriteEffects.None, 0); } diff --git a/Particles/GenericSparkle.cs b/Particles/GenericSparkle.cs index 7285422ee7..ff1302e8e2 100644 --- a/Particles/GenericSparkle.cs +++ b/Particles/GenericSparkle.cs @@ -45,8 +45,8 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D starTexture = GeneralParticleHandler.GetTexture(Type); - Texture2D bloomTexture = ModContent.GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D starTexture = GeneralParticleHandler.Assets.Request(Type).Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; diff --git a/Particles/GruesomeEminenceParticleSet.cs b/Particles/GruesomeEminenceParticleSet.cs index 72e757d089..27bb2ff143 100644 --- a/Particles/GruesomeEminenceParticleSet.cs +++ b/Particles/GruesomeEminenceParticleSet.cs @@ -26,11 +26,11 @@ namespace CalamityMod.Particles }; public override List BackgroundTextures => new List() { - ModContent.GetTexture("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer1"), - ModContent.GetTexture("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer2"), - ModContent.GetTexture("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer3"), - ModContent.GetTexture("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer4"), - ModContent.GetTexture("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer5"), + ModContent.Request("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer1"), + ModContent.Request("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer2"), + ModContent.Request("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer3"), + ModContent.Request("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer4"), + ModContent.Request("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer5"), }; public override FusableParticle SpawnParticle(Vector2 center, float sizeStrength) { @@ -85,7 +85,7 @@ namespace CalamityMod.Particles public override void DrawParticles() { - Texture2D fusableParticleBase = ModContent.GetTexture("CalamityMod/ExtraTextures/FusableParticleBase"); + Texture2D fusableParticleBase = ModContent.Request("CalamityMod/ExtraTextures/FusableParticleBase"); foreach (FusableParticle particle in Particles) { Vector2 drawPosition = particle.Center - Main.screenPosition; diff --git a/Particles/HeavySmoke.cs b/Particles/HeavySmoke.cs index 3c26e46aff..62dd4bcf47 100644 --- a/Particles/HeavySmoke.cs +++ b/Particles/HeavySmoke.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D tex = GeneralParticleHandler.GetTexture(Type); + Texture2D tex = GeneralParticleHandler.Assets.Request(Type).Value; int animationFrame = (int)Math.Floor(Time / ((float)(Lifetime / (float)FrameAmount))); Rectangle frame = new Rectangle(80 * Variant, 80 * animationFrame, 80, 80); diff --git a/Particles/ImpactParticle.cs b/Particles/ImpactParticle.cs index 43728049c4..8a1c8cf0ad 100644 --- a/Particles/ImpactParticle.cs +++ b/Particles/ImpactParticle.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Particles { float scaleFactor = CalamityUtils.Convert01To010(LifetimeCompletion) * 1.3f; Vector2 scale = new Vector2(0.3f, 1f) * scaleFactor; - Texture2D texture = ModContent.GetTexture(Texture); + Texture2D texture = ModContent.Request(Texture); spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, 0f, texture.Size() * 0.5f, scale, 0, 0f); spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); diff --git a/Particles/LineVFX.cs b/Particles/LineVFX.cs index a625711be5..ac02a5651f 100644 --- a/Particles/LineVFX.cs +++ b/Particles/LineVFX.cs @@ -38,9 +38,9 @@ namespace CalamityMod.Particles { Texture2D tex; if (Concave) - tex = ModContent.GetTexture("CalamityMod/Particles/ThickEndedLine"); //THICC :wearty: weary: :weary : oogogg;... ooog... that line be lookin' mighty fine... :hot: + tex = ModContent.Request("CalamityMod/Particles/ThickEndedLine"); //THICC :wearty: weary: :weary : oogogg;... ooog... that line be lookin' mighty fine... :hot: else - tex = GeneralParticleHandler.GetTexture(Type); + tex = GeneralParticleHandler.Assets.Request(Type).Value; Vector2 drawPosition = Position - Utils.SafeNormalize(LineVector, Vector2.Zero) * (float)Math.Sqrt(1f - (float)Math.Pow(LifetimeCompletion - 1f, 2)) * Expansion / 2f; Vector2 expandedLine = LineVector + Utils.SafeNormalize(LineVector, Vector2.Zero) * (float)Math.Sqrt(1f - (float)Math.Pow(LifetimeCompletion - 1f, 2)) * Expansion; diff --git a/Particles/PulseRing.cs b/Particles/PulseRing.cs index c1612fbe7a..1a63245256 100644 --- a/Particles/PulseRing.cs +++ b/Particles/PulseRing.cs @@ -44,14 +44,14 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D tex = GeneralParticleHandler.GetTexture(Type); + Texture2D tex = GeneralParticleHandler.Assets.Request(Type).Value; spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale, SpriteEffects.None, 0); } public override void CustomDraw(SpriteBatch spriteBatch, Vector2 basePosition) { - Texture2D tex = ModContent.GetTexture("CalamityMod/Particles/HollowCircleHardEdge"); //GeneralParitcleHandler.GetTexture somehow wont work for set particles and defaults to the first particle it has (blood) + Texture2D tex = ModContent.Request("CalamityMod/Particles/HollowCircleHardEdge"); //GeneralParitcleHandler.GetTexture somehow wont work for set particles and defaults to the first particle it has (blood) spriteBatch.Draw(tex, basePosition - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale, SpriteEffects.None, 0); } } diff --git a/Particles/RancorGroundLavaParticleSet.cs b/Particles/RancorGroundLavaParticleSet.cs index 783f6c16a7..38bbb1b061 100644 --- a/Particles/RancorGroundLavaParticleSet.cs +++ b/Particles/RancorGroundLavaParticleSet.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Particles }; public override List BackgroundTextures => new List() { - ModContent.GetTexture("CalamityMod/Projectiles/InvisibleProj"), + ModContent.Request("CalamityMod/Projectiles/InvisibleProj"), }; public override FusableParticle SpawnParticle(Vector2 center, float sizeStrength) { @@ -38,7 +38,7 @@ namespace CalamityMod.Particles public override void DrawParticles() { - Texture2D fusableParticleBase = ModContent.GetTexture("CalamityMod/ExtraTextures/FusableParticleBase"); + Texture2D fusableParticleBase = ModContent.Request("CalamityMod/ExtraTextures/FusableParticleBase"); foreach (FusableParticle particle in Particles) { Vector2 drawPosition = particle.Center - Main.screenPosition; diff --git a/Particles/RancorLavaParticleSet.cs b/Particles/RancorLavaParticleSet.cs index dca39c16b1..4eff579bce 100644 --- a/Particles/RancorLavaParticleSet.cs +++ b/Particles/RancorLavaParticleSet.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Particles }; public override List BackgroundTextures => new List() { - ModContent.GetTexture("CalamityMod/Projectiles/InvisibleProj"), + ModContent.Request("CalamityMod/Projectiles/InvisibleProj"), }; public override FusableParticle SpawnParticle(Vector2 center, float sizeStrength) { @@ -38,7 +38,7 @@ namespace CalamityMod.Particles public override void DrawParticles() { - Texture2D fusableParticleBase = ModContent.GetTexture("CalamityMod/ExtraTextures/FusableParticleBase"); + Texture2D fusableParticleBase = ModContent.Request("CalamityMod/ExtraTextures/FusableParticleBase"); foreach (FusableParticle particle in Particles) { Vector2 drawPosition = particle.Center - Main.screenPosition; diff --git a/Particles/SemiCircularSmearVFX.cs b/Particles/SemiCircularSmearVFX.cs index eee194cd8e..9111f1df53 100644 --- a/Particles/SemiCircularSmearVFX.cs +++ b/Particles/SemiCircularSmearVFX.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Particles //Use custom draw for the squish public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D tex = GeneralParticleHandler.GetTexture(Type); + Texture2D tex = GeneralParticleHandler.Assets.Request(Type).Value; spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation, tex.Size() / 2f, Squish * Scale, SpriteEffects.None, 0); } } diff --git a/Particles/SnowflakeSparkle.cs b/Particles/SnowflakeSparkle.cs index 6e143e6ea6..0aaf87b3ee 100644 --- a/Particles/SnowflakeSparkle.cs +++ b/Particles/SnowflakeSparkle.cs @@ -44,8 +44,8 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D spokesTexture = GeneralParticleHandler.GetTexture(Type); - Texture2D bloomTexture = ModContent.GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D spokesTexture = GeneralParticleHandler.Assets.Request(Type).Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)spokesTexture.Height / (float)bloomTexture.Height; diff --git a/Particles/SparkParticle.cs b/Particles/SparkParticle.cs index 3aa35377a0..fb1349f237 100644 --- a/Particles/SparkParticle.cs +++ b/Particles/SparkParticle.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { Vector2 scale = new Vector2(0.35f, 1.6f) * Scale; - Texture2D texture = ModContent.GetTexture(Texture); + Texture2D texture = ModContent.Request(Texture); spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); } diff --git a/Particles/SquishyLightParticle.cs b/Particles/SquishyLightParticle.cs index 6495a82e06..71a4c2e43a 100644 --- a/Particles/SquishyLightParticle.cs +++ b/Particles/SquishyLightParticle.cs @@ -45,8 +45,8 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D tex = ModContent.GetTexture("CalamityMod/Particles/Light"); - Texture2D bloomTex = ModContent.GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D tex = ModContent.Request("CalamityMod/Particles/Light"); + Texture2D bloomTex = ModContent.Request("CalamityMod/Particles/BloomCircle"); float squish = MathHelper.Clamp(Velocity.Length() / 10f * SquishStrenght, 1f, MaxSquish); diff --git a/Particles/StreamGougeParticleSet.cs b/Particles/StreamGougeParticleSet.cs index 051cf4090b..c5665c282c 100644 --- a/Particles/StreamGougeParticleSet.cs +++ b/Particles/StreamGougeParticleSet.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Particles }; public override List BackgroundTextures => new List() { - ModContent.GetTexture("CalamityMod/ExtraTextures/ParticleBackgrounds/StreamGougeLayer"), + ModContent.Request("CalamityMod/ExtraTextures/ParticleBackgrounds/StreamGougeLayer"), }; public override FusableParticle SpawnParticle(Vector2 center, float sizeStrength) { @@ -49,7 +49,7 @@ namespace CalamityMod.Particles public override void DrawParticles() { - Texture2D fusableParticleBase = ModContent.GetTexture("CalamityMod/ExtraTextures/FusableParticleBase"); + Texture2D fusableParticleBase = ModContent.Request("CalamityMod/ExtraTextures/FusableParticleBase"); foreach (FusableParticle particle in Particles) { Vector2 drawPosition = particle.Center - Main.screenPosition; diff --git a/Particles/StrongBloom.cs b/Particles/StrongBloom.cs index ca849cc915..d91834eb75 100644 --- a/Particles/StrongBloom.cs +++ b/Particles/StrongBloom.cs @@ -35,14 +35,14 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D tex = GeneralParticleHandler.GetTexture(Type); + Texture2D tex = GeneralParticleHandler.Assets.Request(Type).Value; spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale, SpriteEffects.None, 0); } public override void CustomDraw(SpriteBatch spriteBatch, Vector2 relativePosition) { - Texture2D tex = ModContent.GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D tex = ModContent.Request("CalamityMod/Particles/BloomCircle"); spriteBatch.Draw(tex, relativePosition - Main.screenPosition, null, Color, Rotation, tex.Size() / 2f, Scale, SpriteEffects.None, 0); } diff --git a/Particles/ThunderBoltVFX.cs b/Particles/ThunderBoltVFX.cs index 14f7c5b725..c04aee1f8c 100644 --- a/Particles/ThunderBoltVFX.cs +++ b/Particles/ThunderBoltVFX.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D tex = GeneralParticleHandler.GetTexture(Type); + Texture2D tex = GeneralParticleHandler.Assets.Request(Type).Value; Vector2 Shake = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (1 - (Time / (float)Lifetime)) * ShakePower; diff --git a/Prefixes/AccessoryPrefix.cs b/Prefixes/AccessoryPrefix.cs index 8f39a39418..b53e21d6d3 100644 --- a/Prefixes/AccessoryPrefix.cs +++ b/Prefixes/AccessoryPrefix.cs @@ -28,10 +28,10 @@ namespace CalamityMod.Prefixes if (base.Autoload(ref name)) { AccessoryModifiers = new List(); - AddAccessoryPrefix(mod, AccPrefixType.Quiet, 1.02f); - AddAccessoryPrefix(mod, AccPrefixType.Cloaked, 1.04f); - AddAccessoryPrefix(mod, AccPrefixType.Camouflaged, 1.06f); - AddAccessoryPrefix(mod, AccPrefixType.Silent, 1.08f); + AddAccessoryPrefix(Mod, AccPrefixType.Quiet, 1.02f); + AddAccessoryPrefix(Mod, AccPrefixType.Cloaked, 1.04f); + AddAccessoryPrefix(Mod, AccPrefixType.Camouflaged, 1.06f); + AddAccessoryPrefix(Mod, AccPrefixType.Silent, 1.08f); } return false; } diff --git a/Prefixes/RoguePrefix.cs b/Prefixes/RoguePrefix.cs index 130c3ad2b6..6f58223663 100644 --- a/Prefixes/RoguePrefix.cs +++ b/Prefixes/RoguePrefix.cs @@ -37,22 +37,22 @@ namespace CalamityMod.Prefixes { //Damage, Use Time, Crit, Velocity, SS Dmg RogueModifiers = new List(); - AddRoguePrefix(mod, RoguePrefixType.Pointy, 1.1f, 1f, 0, 1f, 1f); - AddRoguePrefix(mod, RoguePrefixType.Sharp, 1.15f, 1f, 0, 1f, 1f); - AddRoguePrefix(mod, RoguePrefixType.Feathered, 1f, 0.85f, 0, 1.1f, 1f); - AddRoguePrefix(mod, RoguePrefixType.Sleek, 1f, 0.9f, 0, 1.15f, 1f); - AddRoguePrefix(mod, RoguePrefixType.Hefty, 1.1f, 1f, 0, 1f, 1.15f); - AddRoguePrefix(mod, RoguePrefixType.Mighty, 1.15f, 1f, 0, 1f, 1.05f); - AddRoguePrefix(mod, RoguePrefixType.Glorious, 1.1f, 0.95f, 0, 1f, 1f); - AddRoguePrefix(mod, RoguePrefixType.Serrated, 1.1f, 0.9f, 0, 1.05f, 1f); - AddRoguePrefix(mod, RoguePrefixType.Vicious, 1.1f, 0.95f, 0, 1.15f, 1f); - AddRoguePrefix(mod, RoguePrefixType.Lethal, 1.1f, 0.95f, 2, 1.05f, 1.05f); - AddRoguePrefix(mod, RoguePrefixType.Flawless, 1.15f, 0.9f, 5, 1.1f, 1.15f); - AddRoguePrefix(mod, RoguePrefixType.Radical, 1.05f, 0.95f, 0, 1.05f, 0.9f); - AddRoguePrefix(mod, RoguePrefixType.Blunt, 0.85f, 1f, 0, 1f, 1f); - AddRoguePrefix(mod, RoguePrefixType.Flimsy, 0.9f, 1f, 0, 1f, 0.9f); - AddRoguePrefix(mod, RoguePrefixType.Unbalanced, 1f, 1.15f, 0, 0.95f, 1f); - AddRoguePrefix(mod, RoguePrefixType.Atrocious, 0.85f, 1f, 0, 0.9f, 0.9f); + AddRoguePrefix(Mod, RoguePrefixType.Pointy, 1.1f, 1f, 0, 1f, 1f); + AddRoguePrefix(Mod, RoguePrefixType.Sharp, 1.15f, 1f, 0, 1f, 1f); + AddRoguePrefix(Mod, RoguePrefixType.Feathered, 1f, 0.85f, 0, 1.1f, 1f); + AddRoguePrefix(Mod, RoguePrefixType.Sleek, 1f, 0.9f, 0, 1.15f, 1f); + AddRoguePrefix(Mod, RoguePrefixType.Hefty, 1.1f, 1f, 0, 1f, 1.15f); + AddRoguePrefix(Mod, RoguePrefixType.Mighty, 1.15f, 1f, 0, 1f, 1.05f); + AddRoguePrefix(Mod, RoguePrefixType.Glorious, 1.1f, 0.95f, 0, 1f, 1f); + AddRoguePrefix(Mod, RoguePrefixType.Serrated, 1.1f, 0.9f, 0, 1.05f, 1f); + AddRoguePrefix(Mod, RoguePrefixType.Vicious, 1.1f, 0.95f, 0, 1.15f, 1f); + AddRoguePrefix(Mod, RoguePrefixType.Lethal, 1.1f, 0.95f, 2, 1.05f, 1.05f); + AddRoguePrefix(Mod, RoguePrefixType.Flawless, 1.15f, 0.9f, 5, 1.1f, 1.15f); + AddRoguePrefix(Mod, RoguePrefixType.Radical, 1.05f, 0.95f, 0, 1.05f, 0.9f); + AddRoguePrefix(Mod, RoguePrefixType.Blunt, 0.85f, 1f, 0, 1f, 1f); + AddRoguePrefix(Mod, RoguePrefixType.Flimsy, 0.9f, 1f, 0, 1f, 0.9f); + AddRoguePrefix(Mod, RoguePrefixType.Unbalanced, 1f, 1.15f, 0, 0.95f, 1f); + AddRoguePrefix(Mod, RoguePrefixType.Atrocious, 0.85f, 1f, 0, 0.9f, 0.9f); } return false; } diff --git a/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs index 4b6bfccbd5..83dc023d26 100644 --- a/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles { public abstract class BaseIdleHoldoutProjectile : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public abstract int AssociatedItemID { get; } @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles CheckForEveryHoldout(Owner); if (Owner.ActiveItem().type != AssociatedItemID || Owner.CCed || !Owner.active || Owner.dead) { - projectile.Kill(); + Projectile.Kill(); return; } SafeAI(); diff --git a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs index fb2740cabd..73fe35b03c 100644 --- a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Projectiles.BaseProjectiles #region Auto-Properties public float RotationalSpeed { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public float Time { - get => projectile.localAI[0]; - set => projectile.localAI[0] = value; + get => Projectile.localAI[0]; + set => Projectile.localAI[0] = value; } public float LaserLength { - get => projectile.localAI[1]; - set => projectile.localAI[1] = value; + get => Projectile.localAI[1]; + set => Projectile.localAI[1] = value; } #endregion @@ -39,12 +39,12 @@ namespace CalamityMod.Projectiles.BaseProjectiles AttachToSomething(); // Ensure the the velocity is a unit vector. This has NaN safety in place with a fallback of <0, -1>. - projectile.velocity = projectile.velocity.SafeNormalize(-Vector2.UnitY); + Projectile.velocity = Projectile.velocity.SafeNormalize(-Vector2.UnitY); Time++; if (Time >= Lifetime) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles if (LightCastColor != Color.Transparent) { DelegateMethods.v3_1 = LightCastColor.ToVector3(); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.width * projectile.scale, DelegateMethods.CastLight); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength, Projectile.width * Projectile.scale, DelegateMethods.CastLight); } } @@ -72,9 +72,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles // In this case, "doing something with that angle" means incrementing it by a constant. This allows the laser to perform "arcing" motion. // You could attempt to make it intelligent by having it move towards the target like the Last Prism, but that's not done here. - float updatedVelocityDirection = projectile.velocity.ToRotation() + RotationalSpeed; - projectile.rotation = updatedVelocityDirection - MathHelper.PiOver2; // Pretty much all lasers have a vertical sheet. - projectile.velocity = updatedVelocityDirection.ToRotationVector2(); + float updatedVelocityDirection = Projectile.velocity.ToRotation() + RotationalSpeed; + Projectile.rotation = updatedVelocityDirection - MathHelper.PiOver2; // Pretty much all lasers have a vertical sheet. + Projectile.velocity = updatedVelocityDirection.ToRotationVector2(); } /// @@ -82,9 +82,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// public virtual void DetermineScale() { - projectile.scale = (float)Math.Sin(Time / Lifetime * MathHelper.Pi) * ScaleExpandRate * MaxScale; - if (projectile.scale > MaxScale) - projectile.scale = MaxScale; + Projectile.scale = (float)Math.Sin(Time / Lifetime * MathHelper.Pi) * ScaleExpandRate * MaxScale; + if (Projectile.scale > MaxScale) + Projectile.scale = MaxScale; } /// @@ -113,22 +113,22 @@ namespace CalamityMod.Projectiles.BaseProjectiles public float DetermineLaserLength_CollideWithTiles(int samplePointCount) { float[] laserLengthSamplePoints = new float[samplePointCount]; - Collision.LaserScan(projectile.Center, projectile.velocity, projectile.scale, MaxLaserLength, laserLengthSamplePoints); + Collision.LaserScan(Projectile.Center, Projectile.velocity, Projectile.scale, MaxLaserLength, laserLengthSamplePoints); return laserLengthSamplePoints.Average(); } protected internal void DrawBeamWithColor(SpriteBatch spriteBatch, Color beamColor, float scale, int startFrame = 0, int middleFrame = 0, int endFrame = 0) { - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[projectile.type], 0, startFrame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[projectile.type], 0, middleFrame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[projectile.type], 0, endFrame); + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, startFrame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, middleFrame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, endFrame); // Start texture drawing. spriteBatch.Draw(LaserBeginTexture, - projectile.Center - Main.screenPosition, + Projectile.Center - Main.screenPosition, startFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserBeginTexture.Size() / 2f, scale, SpriteEffects.None, @@ -137,8 +137,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles // Prepare things for body drawing. float laserBodyLength = LaserLength; laserBodyLength -= (startFrameArea.Height / 2 + endFrameArea.Height) * scale; - Vector2 centerOnLaser = projectile.Center; - centerOnLaser += projectile.velocity * scale * startFrameArea.Height / 2f; + Vector2 centerOnLaser = Projectile.Center; + centerOnLaser += Projectile.velocity * scale * startFrameArea.Height / 2f; // Body drawing. if (laserBodyLength > 0f) @@ -151,13 +151,13 @@ namespace CalamityMod.Projectiles.BaseProjectiles centerOnLaser - Main.screenPosition, middleFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserMiddleTexture.Width * 0.5f * Vector2.UnitX, scale, SpriteEffects.None, 0f); incrementalBodyLength += laserOffset; - centerOnLaser += projectile.velocity * laserOffset; + centerOnLaser += Projectile.velocity * laserOffset; } } @@ -169,7 +169,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles laserEndCenter, endFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserEndTexture.Frame(1, 1, 0, 0).Top(), scale, SpriteEffects.None, @@ -187,15 +187,15 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackMelee; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.Size.Length() * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength, Projectile.Size.Length() * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { // This should never happen, but just in case- - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) return false; - DrawBeamWithColor(spriteBatch, LaserOverlayColor, projectile.scale); + DrawBeamWithColor(spriteBatch, LaserOverlayColor, Projectile.scale); return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -203,7 +203,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles if (projHitbox.Intersects(targetHitbox)) return true; float _ = 0f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.Size.Length() * projectile.scale, ref _); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength, Projectile.Size.Length() * Projectile.scale, ref _); } public override bool ShouldUpdatePosition() => false; diff --git a/Projectiles/BaseProjectiles/BaseMassiveExplosionProjectile.cs b/Projectiles/BaseProjectiles/BaseMassiveExplosionProjectile.cs index 3863e98f1b..8502df3474 100644 --- a/Projectiles/BaseProjectiles/BaseMassiveExplosionProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseMassiveExplosionProjectile.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles { public abstract class BaseMassiveExplosionProjectile : ModProjectile { - public ref float CurrentRadius => ref projectile.ai[0]; - public ref float MaxRadius => ref projectile.ai[1]; + public ref float CurrentRadius => ref Projectile.ai[0]; + public ref float MaxRadius => ref Projectile.ai[1]; public virtual bool UsesScreenshake { get; } = false; public virtual float GetScreenshakePower(float pulseCompletionRatio) => 0f; public virtual float Fadeout(float completion) => (1f - (float)Math.Sqrt(completion)) * 0.7f; @@ -25,17 +25,17 @@ namespace CalamityMod.Projectiles.BaseProjectiles { if (UsesScreenshake) { - float screenShakePower = GetScreenshakePower(projectile.timeLeft / (float)Lifetime) * Utils.InverseLerp(1300f, 0f, projectile.Distance(Main.LocalPlayer.Center), true); + float screenShakePower = GetScreenshakePower(Projectile.timeLeft / (float)Lifetime) * Utils.InverseLerp(1300f, 0f, Projectile.Distance(Main.LocalPlayer.Center), true); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; } // Expand outward. CurrentRadius = MathHelper.Lerp(CurrentRadius, MaxRadius, 0.25f); - projectile.scale = MathHelper.Lerp(1.2f, 5f, Utils.InverseLerp(Lifetime, 0f, projectile.timeLeft, true)); + Projectile.scale = MathHelper.Lerp(1.2f, 5f, Utils.InverseLerp(Lifetime, 0f, Projectile.timeLeft, true)); // Adjust the hitbox. - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(CurrentRadius * projectile.scale), (int)(CurrentRadius * projectile.scale)); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, (int)(CurrentRadius * Projectile.scale), (int)(CurrentRadius * Projectile.scale)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -43,12 +43,12 @@ namespace CalamityMod.Projectiles.BaseProjectiles spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); - float pulseCompletionRatio = Utils.InverseLerp(Lifetime, 0f, projectile.timeLeft, true); + float pulseCompletionRatio = Utils.InverseLerp(Lifetime, 0f, Projectile.timeLeft, true); Vector2 scale = new Vector2(1.5f, 1f); - Vector2 drawPosition = projectile.Center - Main.screenPosition + projectile.Size * scale * 0.5f; - Rectangle drawArea = new Rectangle(0, 0, projectile.width, projectile.height); - Color fadeoutColor = new Color(new Vector4(Fadeout(pulseCompletionRatio)) * projectile.Opacity); - DrawData drawData = new DrawData(ModContent.GetTexture("Terraria/Misc/Perlin"), drawPosition, drawArea, fadeoutColor, projectile.rotation, projectile.Size, scale, SpriteEffects.None, 0); + Vector2 drawPosition = Projectile.Center - Main.screenPosition + Projectile.Size * scale * 0.5f; + Rectangle drawArea = new Rectangle(0, 0, Projectile.width, Projectile.height); + Color fadeoutColor = new Color(new Vector4(Fadeout(pulseCompletionRatio)) * Projectile.Opacity); + DrawData drawData = new DrawData(ModContent.Request("Terraria/Misc/Perlin"), drawPosition, drawArea, fadeoutColor, Projectile.rotation, Projectile.Size, scale, SpriteEffects.None, 0); GameShaders.Misc["ForceField"].UseColor(GetCurrentExplosionColor(pulseCompletionRatio)); GameShaders.Misc["ForceField"].Apply(drawData); diff --git a/Projectiles/BaseProjectiles/BaseSpearProjectile.cs b/Projectiles/BaseProjectiles/BaseSpearProjectile.cs index 0bb95b3261..cb3b28047b 100644 --- a/Projectiles/BaseProjectiles/BaseSpearProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSpearProjectile.cs @@ -25,110 +25,110 @@ namespace CalamityMod.Projectiles.BaseProjectiles // ai[0] = Speed value of the spear. Changes as time goes by. // localAI[0] = Special effect 0-1 flag value. Actived right before the spear goes backward. - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; // Adjust owner stats based on this projectile - player.direction = projectile.direction; - player.heldProj = projectile.whoAmI; + player.direction = Projectile.direction; + player.heldProj = Projectile.whoAmI; player.itemTime = player.itemAnimation; // Stick to the player - projectile.position = player.Center - projectile.Size / 2f; + Projectile.position = player.Center - Projectile.Size / 2f; // And move outward/inward based on the speed variable. - projectile.position += projectile.velocity * projectile.ai[0]; + Projectile.position += Projectile.velocity * Projectile.ai[0]; // If we're not movement, start. - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[0] = InitialSpeed; - projectile.netUpdate = true; + Projectile.ai[0] = InitialSpeed; + Projectile.netUpdate = true; } // Reel back if (player.itemAnimation < player.itemAnimationMax / 3) { - projectile.ai[0] -= ReelbackSpeed; + Projectile.ai[0] -= ReelbackSpeed; // If we haven't done the special effect yet (assuming there is one), do it. // Note : Null Coalescing does not work in this case because we are invoking a method, not setting a value. - if (projectile.localAI[0] == 0f && EffectBeforeReelback != null && Main.myPlayer == projectile.owner) + if (Projectile.localAI[0] == 0f && EffectBeforeReelback != null && Main.myPlayer == Projectile.owner) { - projectile.localAI[0] = 1f; - EffectBeforeReelback.Invoke(projectile); + Projectile.localAI[0] = 1f; + EffectBeforeReelback.Invoke(Projectile); } } // Move forward else { - projectile.ai[0] += ForwardSpeed; + Projectile.ai[0] += ForwardSpeed; } // If at the end of the animation, kill the projectile. if (player.itemAnimation == 0) - projectile.Kill(); + Projectile.Kill(); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2 + MathHelper.PiOver4; - if (projectile.spriteDirection == -1) - projectile.rotation -= MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 + MathHelper.PiOver4; + if (Projectile.spriteDirection == -1) + Projectile.rotation -= MathHelper.PiOver2; } else if (SpearAiType == SpearType.GhastlyGlaiveSpear) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; Vector2 playerRelativePoint = player.RotatedRelativePoint(player.MountedCenter, true); - projectile.direction = player.direction; - player.heldProj = projectile.whoAmI; - projectile.Center = playerRelativePoint; + Projectile.direction = player.direction; + player.heldProj = Projectile.whoAmI; + Projectile.Center = playerRelativePoint; if (player.dead) { - projectile.Kill(); + Projectile.Kill(); return; } // If the player isn't stuck, be it from the stoned or frozen debuff, do the usual AI if (!player.frozen) { // Pretty much the same as regular spears. - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + if (Main.player[Projectile.owner].itemAnimation < Main.player[Projectile.owner].itemAnimationMax / 3) { - if (projectile.localAI[0] == 0f && EffectBeforeReelback != null && Main.myPlayer == projectile.owner) + if (Projectile.localAI[0] == 0f && EffectBeforeReelback != null && Main.myPlayer == Projectile.owner) { - projectile.localAI[0] = 1f; - EffectBeforeReelback.Invoke(projectile); + Projectile.localAI[0] = 1f; + EffectBeforeReelback.Invoke(Projectile); } } - projectile.spriteDirection = projectile.direction = player.direction; + Projectile.spriteDirection = Projectile.direction = player.direction; // Decrement alpha if it's greater than zero. A 255 starting alpha is // not required, this is just a solution for relevant edge-cases. - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 127; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 127; + if (Projectile.alpha < 0) + Projectile.alpha = 0; } - if (projectile.localAI[0] > 0f) + if (Projectile.localAI[0] > 0f) { - projectile.localAI[0] -= 1f; + Projectile.localAI[0] -= 1f; } float inverseAnimationCompletion = 1f - (player.itemAnimation / (float)player.itemAnimationMax); - float originalVelocityDirection = projectile.velocity.ToRotation(); - float originalVelocitySpeed = projectile.velocity.Length(); + float originalVelocityDirection = Projectile.velocity.ToRotation(); + float originalVelocitySpeed = Projectile.velocity.Length(); // The motion moves in an imaginary circle, but the cane does not because it relies on // its ai[0] X multiplier, giving it the "swiping" motion. Vector2 flatVelocity = Vector2.UnitX.RotatedBy(MathHelper.Pi + inverseAnimationCompletion * MathHelper.TwoPi) * - new Vector2(originalVelocitySpeed, projectile.ai[0]); + new Vector2(originalVelocitySpeed, Projectile.ai[0]); - projectile.position += flatVelocity.RotatedBy(originalVelocityDirection) + + Projectile.position += flatVelocity.RotatedBy(originalVelocityDirection) + new Vector2(originalVelocitySpeed + TravelSpeed, 0f).RotatedBy(originalVelocityDirection); // Determine how to rotate. The larger the 40 value is, the more rapidly the projectile rotates. Vector2 destination = playerRelativePoint + flatVelocity.RotatedBy(originalVelocityDirection) + originalVelocityDirection.ToRotationVector2() * (originalVelocitySpeed + TravelSpeed + 40f); - projectile.rotation = player.AngleTo(destination) + MathHelper.PiOver4 * player.direction; //or this + Projectile.rotation = player.AngleTo(destination) + MathHelper.PiOver4 * player.direction; //or this // Rotate 180 degrees if facing to the right - if (projectile.spriteDirection == -1) - projectile.rotation += MathHelper.Pi; + if (Projectile.spriteDirection == -1) + Projectile.rotation += MathHelper.Pi; } // Kill the hook if the player's item use cycle is almost over and reset the reuseDelay @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles // decremented by the useTime. On reset it reverts to useAnimation - 1 if (player.itemAnimation == 2) { - projectile.Kill(); + Projectile.Kill(); player.reuseDelay = 2; } } @@ -148,7 +148,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void AI() { Behavior(); - if ((SpearAiType == SpearType.GhastlyGlaiveSpear && !Main.player[projectile.owner].frozen) || + if ((SpearAiType == SpearType.GhastlyGlaiveSpear && !Main.player[Projectile.owner].frozen) || SpearAiType == SpearType.TypicalSpear) { ExtraBehavior(); diff --git a/Projectiles/BaseProjectiles/BaseSporeSacProjectile.cs b/Projectiles/BaseProjectiles/BaseSporeSacProjectile.cs index 373f201966..70e4e5ddaa 100644 --- a/Projectiles/BaseProjectiles/BaseSporeSacProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSporeSacProjectile.cs @@ -6,12 +6,12 @@ namespace CalamityMod.Projectiles.BaseProjectiles { public abstract class BaseSporeSacProjectile : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public bool FadingOut => GeneralTimer > 5400f; - public bool HomesInStronglyOnEnemies => projectile.ai[1] == 1f; - public ref float GeneralTimer => ref projectile.ai[0]; - public ref float PulseIncrement => ref projectile.localAI[0]; - public ref float MoveTimer => ref projectile.localAI[1]; + public bool HomesInStronglyOnEnemies => Projectile.ai[1] == 1f; + public ref float GeneralTimer => ref Projectile.ai[0]; + public ref float PulseIncrement => ref Projectile.localAI[0]; + public ref float MoveTimer => ref Projectile.localAI[1]; public virtual Color? LightColor => new Color(0.25f, 0.025f, 0.275f); @@ -23,8 +23,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles // Emit light if applicable. if (LightColor.HasValue) { - float lightFactor = projectile.Opacity * projectile.scale; - Lighting.AddLight(projectile.Center, LightColor.Value.ToVector3() * lightFactor); + float lightFactor = Projectile.Opacity * Projectile.scale; + Lighting.AddLight(Projectile.Center, LightColor.Value.ToVector3() * lightFactor); } PulseIncrement++; @@ -34,14 +34,14 @@ namespace CalamityMod.Projectiles.BaseProjectiles PulseIncrement *= -1f; // Pulse in and out based on the increment in a way analogous to a triangle wave. - projectile.scale += (PulseIncrement >= 0f).ToDirectionInt() * 0.003f; + Projectile.scale += (PulseIncrement >= 0f).ToDirectionInt() * 0.003f; // Rotate with an angular velocity proportional to the scale of the projectile. - projectile.rotation += projectile.scale * 0.0025f; + Projectile.rotation += Projectile.scale * 0.0025f; // Determine the move direction. Vector2 moveDirection = Vector2.One; - switch (projectile.identity % 6) + switch (Projectile.identity % 6) { case 0: moveDirection.X *= -1f; @@ -64,23 +64,23 @@ namespace CalamityMod.Projectiles.BaseProjectiles MoveTimer += 1f; if (MoveTimer > 60f) MoveTimer = -180f; - projectile.velocity += moveDirection * (MoveTimer >= -60f).ToDirectionInt() * 0.002f; + Projectile.velocity += moveDirection * (MoveTimer >= -60f).ToDirectionInt() * 0.002f; // Fade out and die after enough time. // This process is accelerated the farther away the projectile is from its owner. GeneralTimer++; if (FadingOut) { - projectile.damage = 0; - if (projectile.alpha < 255) - projectile.alpha = Utils.Clamp(projectile.alpha + 5, 0, 255); + Projectile.damage = 0; + if (Projectile.alpha < 255) + Projectile.alpha = Utils.Clamp(Projectile.alpha + 5, 0, 255); - else if (projectile.owner == Main.myPlayer) - projectile.Kill(); + else if (Projectile.owner == Main.myPlayer) + Projectile.Kill(); } else { - float ownerDistanceIncrement = projectile.Distance(Owner.Center); + float ownerDistanceIncrement = Projectile.Distance(Owner.Center); if (ownerDistanceIncrement > 400f) ownerDistanceIncrement *= 1.1f; @@ -105,24 +105,24 @@ namespace CalamityMod.Projectiles.BaseProjectiles GeneralTimer += ownerDistanceIncrement * 0.01f; // Fade in. - projectile.alpha = Utils.Clamp(projectile.alpha - 10, 50, 255); + Projectile.alpha = Utils.Clamp(Projectile.alpha - 10, 50, 255); } - if (HomesInStronglyOnEnemies || projectile.timeLeft < (3300 + PulseIncrement)) + if (HomesInStronglyOnEnemies || Projectile.timeLeft < (3300 + PulseIncrement)) { - NPC potentialTarget = projectile.Center.ClosestNPCAt(HomeDistance); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(HomeDistance); if (potentialTarget != null) { if (HomesInStronglyOnEnemies) - projectile.extraUpdates = 5; + Projectile.extraUpdates = 5; - projectile.velocity = (projectile.velocity * 10f + projectile.SafeDirectionTo(potentialTarget.Center) * HomeSpeed) / 11f; + Projectile.velocity = (Projectile.velocity * 10f + Projectile.SafeDirectionTo(potentialTarget.Center) * HomeSpeed) / 11f; return; } } - if (projectile.velocity.Length() > 0.2f) + if (Projectile.velocity.Length() > 0.2f) { - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; } } } diff --git a/Projectiles/BaseProjectiles/BaseWhipProjectile.cs b/Projectiles/BaseProjectiles/BaseWhipProjectile.cs index aa7a8415b6..58e75000fa 100644 --- a/Projectiles/BaseProjectiles/BaseWhipProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseWhipProjectile.cs @@ -15,61 +15,61 @@ namespace CalamityMod.Projectiles.BaseProjectiles public virtual void Behavior() { - Player player = Main.player[projectile.owner]; - if (projectile.localAI[1] > 0f) + Player player = Main.player[Projectile.owner]; + if (Projectile.localAI[1] > 0f) { - projectile.localAI[1] -= 1f; + Projectile.localAI[1] -= 1f; } // Rapidly appear - projectile.alpha -= 42; - if (projectile.alpha < 0) + Projectile.alpha -= 42; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } // Determine the starting velocity direction - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = projectile.velocity.ToRotation(); + Projectile.localAI[0] = Projectile.velocity.ToRotation(); } - float direction = (projectile.localAI[0].ToRotationVector2().X >= 0f).ToDirectionInt(); - if (projectile.ai[1] <= 0f) + float direction = (Projectile.localAI[0].ToRotationVector2().X >= 0f).ToDirectionInt(); + if (Projectile.ai[1] <= 0f) { direction *= -1f; } // As ai[0], the timer, goes up, - Vector2 velocityAdditive = (direction * (projectile.ai[0] / 30f * MathHelper.TwoPi - MathHelper.PiOver2)).ToRotationVector2(); + Vector2 velocityAdditive = (direction * (Projectile.ai[0] / 30f * MathHelper.TwoPi - MathHelper.PiOver2)).ToRotationVector2(); // ai[1] = A starting rotation value. With a min of 0 and a max of pi/4 // The larger it is, the larger the outward distance we travel. // It will always be compressed a bit relative to the X travel movement, however, // because sin(pi/4) = 1/sqrt(2), which is less than the default multiplier the X distance // receives: 1. - velocityAdditive.Y *= (float)Math.Sin(projectile.ai[1]); - if (projectile.ai[1] <= 0f) + velocityAdditive.Y *= (float)Math.Sin(Projectile.ai[1]); + if (Projectile.ai[1] <= 0f) { velocityAdditive.Y *= -1f; } // Rotate by the starting velocity angle, to maintain the original rotation instead of // Constantly rotating upward or sideways - velocityAdditive = velocityAdditive.RotatedBy(projectile.localAI[0]); - projectile.ai[0] += 1f; - if (projectile.ai[0] < 30f) + velocityAdditive = velocityAdditive.RotatedBy(Projectile.localAI[0]); + Projectile.ai[0] += 1f; + if (Projectile.ai[0] < 30f) { - projectile.velocity += 48f * velocityAdditive; + Projectile.velocity += 48f * velocityAdditive; } else { - projectile.Kill(); + Projectile.Kill(); } // Adjust position so that we're always sticking to the player. - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); + Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + player.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); // Adjust the center based on player attributes. Vector2 centerDelta = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; @@ -82,12 +82,12 @@ namespace CalamityMod.Projectiles.BaseProjectiles centerDelta.Y = player.bodyFrame.Height - centerDelta.Y; } if (player.heldProj == -1) - player.heldProj = projectile.whoAmI; + player.heldProj = Projectile.whoAmI; centerDelta -= new Vector2(player.bodyFrame.Width - player.width, player.bodyFrame.Height - 42) / 2f; - projectile.Center = player.RotatedRelativePoint(player.position + centerDelta, true) - projectile.velocity; + Projectile.Center = player.RotatedRelativePoint(player.position + centerDelta, true) - Projectile.velocity; // Cool dust - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { GenerateDust(); } @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Behavior(); ExtraBehavior(); } - public Texture2D FlailTexture => Main.projectileTexture[projectile.type]; + public Texture2D FlailTexture => Main.projectileTexture[Projectile.type]; #region Virtual Values public virtual Color SpecialDrawColor => new Color(255, 200, 0); @@ -125,10 +125,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles // Dust moving along the whip for (int i = 0; i < 2; i++) { - Dust dust = Dust.NewDustDirect(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, ExudeDustType, 0f, 0f, 100, SpecialDrawColor, 2f); + Dust dust = Dust.NewDustDirect(Projectile.position + Projectile.velocity * 2f, Projectile.width, Projectile.height, ExudeDustType, 0f, 0f, 100, SpecialDrawColor, 2f); dust.noGravity = true; dust.velocity *= 2f; - dust.velocity += projectile.localAI[0].ToRotationVector2(); + dust.velocity += Projectile.localAI[0].ToRotationVector2(); dust.fadeIn = 1.5f; } float counterMax = 18f; @@ -137,11 +137,11 @@ namespace CalamityMod.Projectiles.BaseProjectiles { if (Main.rand.NextBool(4)) { - Vector2 spawnPosition = projectile.position + projectile.velocity + projectile.velocity * (counter / counterMax); - Dust dust = Dust.NewDustDirect(spawnPosition, projectile.width, projectile.height, WhipDustType, 0f, 0f, 100, SpecialDrawColor, 1f); + Vector2 spawnPosition = Projectile.position + Projectile.velocity + Projectile.velocity * (counter / counterMax); + Dust dust = Dust.NewDustDirect(spawnPosition, Projectile.width, Projectile.height, WhipDustType, 0f, 0f, 100, SpecialDrawColor, 1f); dust.noGravity = true; dust.fadeIn = 0.5f; - dust.velocity += projectile.localAI[0].ToRotationVector2(); + dust.velocity += Projectile.localAI[0].ToRotationVector2(); dust.noLight = true; } counter++; @@ -154,21 +154,21 @@ namespace CalamityMod.Projectiles.BaseProjectiles { // If the velocity is zero, don't draw anything. // Doing so would lead to various divison by 0 errors during the normalization process. - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) { return false; } DrawHandleSprite(in lightColor); - Vector2 normalizedVelocity = Vector2.Normalize(projectile.velocity); + Vector2 normalizedVelocity = Vector2.Normalize(Projectile.velocity); - float speed = projectile.velocity.Length() + 16f - 40f * projectile.scale; + float speed = Projectile.velocity.Length() + 16f - 40f * Projectile.scale; - Vector2 bodyDrawPosition = projectile.Center.Floor() + normalizedVelocity * projectile.scale * 20f; + Vector2 bodyDrawPosition = Projectile.Center.Floor() + normalizedVelocity * Projectile.scale * 20f; DrawType2BodySprite(in speed, in normalizedVelocity, in lightColor, ref bodyDrawPosition); - bodyDrawPosition = projectile.Center.Floor() + normalizedVelocity * projectile.scale * 20f; + bodyDrawPosition = Projectile.Center.Floor() + normalizedVelocity * Projectile.scale * 20f; DrawType1BodySprite(in speed, in normalizedVelocity, in lightColor, ref bodyDrawPosition); Vector2 whipEndPosition = bodyDrawPosition; @@ -184,12 +184,12 @@ namespace CalamityMod.Projectiles.BaseProjectiles { Rectangle handleFrame = new Rectangle(0, 0, FlailTexture.Width, HandleHeight); Main.spriteBatch.Draw(FlailTexture, - projectile.Center.Floor() - Main.screenPosition + Vector2.UnitY * Main.player[projectile.owner].gfxOffY, + Projectile.Center.Floor() - Main.screenPosition + Vector2.UnitY * Main.player[Projectile.owner].gfxOffY, new Rectangle?(handleFrame), lightColor, - projectile.rotation + MathHelper.Pi, + Projectile.rotation + MathHelper.Pi, handleFrame.Size() / 2f - Vector2.UnitY * 4f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); } @@ -220,12 +220,12 @@ namespace CalamityMod.Projectiles.BaseProjectiles drawPositionDeltaMult *= 0.75f; } Main.spriteBatch.Draw(FlailTexture, - bodyDrawPosition - Main.screenPosition + Vector2.UnitY * Main.player[projectile.owner].gfxOffY, + bodyDrawPosition - Main.screenPosition + Vector2.UnitY * Main.player[Projectile.owner].gfxOffY, new Rectangle?(type1BodyFrame), lightColor, - projectile.rotation + MathHelper.Pi, + Projectile.rotation + MathHelper.Pi, new Vector2(type1BodyFrame.Width / 2, 0f), - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); bodyDrawPosition += normalizedVelocity * drawPositionDeltaMult; @@ -257,16 +257,16 @@ namespace CalamityMod.Projectiles.BaseProjectiles type2BodyFrame.Height = (int)(speed - counter); } Main.spriteBatch.Draw(FlailTexture, - bodyDrawPosition - Main.screenPosition + Vector2.UnitY * Main.player[projectile.owner].gfxOffY, + bodyDrawPosition - Main.screenPosition + Vector2.UnitY * Main.player[Projectile.owner].gfxOffY, new Rectangle?(type2BodyFrame), lightColor, - projectile.rotation + MathHelper.Pi, + Projectile.rotation + MathHelper.Pi, new Vector2(type2BodyFrame.Width / 2, 0f), - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); - counter += type2BodyFrame.Height * projectile.scale; - bodyDrawPosition += normalizedVelocity * type2BodyFrame.Height * projectile.scale; + counter += type2BodyFrame.Height * Projectile.scale; + bodyDrawPosition += normalizedVelocity * type2BodyFrame.Height * Projectile.scale; } } } @@ -280,12 +280,12 @@ namespace CalamityMod.Projectiles.BaseProjectiles { Rectangle tailFrame = new Rectangle(0, TailStartY, FlailTexture.Width, TailHeight); Main.spriteBatch.Draw(FlailTexture, - whipEndPosition - Main.screenPosition + Vector2.UnitY * Main.player[projectile.owner].gfxOffY, + whipEndPosition - Main.screenPosition + Vector2.UnitY * Main.player[Projectile.owner].gfxOffY, new Rectangle?(tailFrame), lightColor, - projectile.rotation + MathHelper.Pi, + Projectile.rotation + MathHelper.Pi, FlailTexture.Frame(1, 1, 0, 0).Top(), - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); } @@ -295,8 +295,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit, Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -305,7 +305,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles return true; } float _ = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref _)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity, 16f * Projectile.scale, ref _)) { return true; } diff --git a/Projectiles/Boss/AbyssBallVolley.cs b/Projectiles/Boss/AbyssBallVolley.cs index caa4bab2c7..cf2a59118a 100644 --- a/Projectiles/Boss/AbyssBallVolley.cs +++ b/Projectiles/Boss/AbyssBallVolley.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -16,45 +17,45 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.alpha = 60; - projectile.tileCollide = false; - projectile.timeLeft = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 780 : CalamityWorld.death ? 600 : CalamityWorld.revenge ? 540 : Main.expertMode ? 480 : 300; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.penetrate = 1; + Projectile.alpha = 60; + Projectile.tileCollide = false; + Projectile.timeLeft = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 780 : CalamityWorld.death ? 600 : CalamityWorld.revenge ? 540 : Main.expertMode ? 480 : 300; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - if (projectile.velocity.Length() < 16f && (Main.expertMode || BossRushEvent.BossRushActive)) + if (Projectile.velocity.Length() < 16f && (Main.expertMode || BossRushEvent.BossRushActive)) { float velocityMult = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 1.025f : CalamityWorld.death ? 1.015f : CalamityWorld.revenge ? 1.0125f : Main.expertMode ? 1.01f : 1f; - projectile.velocity *= velocityMult; + Projectile.velocity *= velocityMult; } - if (projectile.timeLeft < 60) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); + if (Projectile.timeLeft < 60) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 33); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 33); } if (Main.rand.NextBool(2)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, 0f, 0f); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 12f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 12f, targetHitbox); - public override bool CanHitPlayer(Player target) => projectile.timeLeft >= 60; + public override bool CanHitPlayer(Player target) => Projectile.timeLeft >= 60; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.timeLeft < 60) + if (Projectile.timeLeft < 60) return; target.AddBuff(BuffID.Weak, 120); diff --git a/Projectiles/Boss/AbyssBallVolley2.cs b/Projectiles/Boss/AbyssBallVolley2.cs index d8b97961ea..6fb91d2eda 100644 --- a/Projectiles/Boss/AbyssBallVolley2.cs +++ b/Projectiles/Boss/AbyssBallVolley2.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -16,48 +17,48 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.alpha = 60; - projectile.tileCollide = false; - projectile.timeLeft = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 640 : CalamityWorld.death ? 490 : CalamityWorld.revenge ? 440 : Main.expertMode ? 390 : 240; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.penetrate = 1; + Projectile.alpha = 60; + Projectile.tileCollide = false; + Projectile.timeLeft = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 640 : CalamityWorld.death ? 490 : CalamityWorld.revenge ? 440 : Main.expertMode ? 390 : 240; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - if (projectile.velocity.Length() < 18f && (Main.expertMode || BossRushEvent.BossRushActive)) + if (Projectile.velocity.Length() < 18f && (Main.expertMode || BossRushEvent.BossRushActive)) { float velocityMult = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 1.025f : CalamityWorld.death ? 1.015f : CalamityWorld.revenge ? 1.0125f : Main.expertMode ? 1.01f : 1f; - projectile.velocity *= velocityMult; + Projectile.velocity *= velocityMult; } - if (projectile.timeLeft < 60) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); + if (Projectile.timeLeft < 60) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 33); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 33); } if (Main.rand.NextBool(2)) { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 127, 0f, 0f); Main.dust[dust].noGravity = true; } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 12f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 12f, targetHitbox); - public override bool CanHitPlayer(Player target) => projectile.timeLeft >= 60; + public override bool CanHitPlayer(Player target) => Projectile.timeLeft >= 60; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.timeLeft < 60) + if (Projectile.timeLeft < 60) return; target.AddBuff(BuffID.Darkness, 120); diff --git a/Projectiles/Boss/ApolloChargeTelegraph.cs b/Projectiles/Boss/ApolloChargeTelegraph.cs index f082c973f0..3add42f2c1 100644 --- a/Projectiles/Boss/ApolloChargeTelegraph.cs +++ b/Projectiles/Boss/ApolloChargeTelegraph.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Boss public Vector2[] ChargePositions = new Vector2[1]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)Projectile.ai[1]) ? Main.npc[(int)Projectile.ai[1]] : null; public PrimitiveTrail TelegraphDrawer = null; public const float TelegraphFadeTime = 15f; @@ -27,13 +27,13 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Boss bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - projectile.timeLeft = malice ? 30 : death ? 40 : revenge ? 45 : expertMode ? 50 : 60; + Projectile.timeLeft = malice ? 30 : death ? 40 : revenge ? 45 : expertMode ? 50 : 60; } public override void SendExtraAI(BinaryWriter writer) @@ -61,16 +61,16 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { // Determine the relative opacities for each player based on their distance. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.netUpdate = true; } // Die if the thing to attach to disappears. if (ThingToAttachTo is null || !ThingToAttachTo.active) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -82,19 +82,19 @@ namespace CalamityMod.Projectiles.Boss // Determine opacity float telegraphTotalTime = malice ? 30f : death ? 40f : revenge ? 45f : expertMode ? 50f : 60f; - projectile.Opacity = Utils.InverseLerp(0f, 6f, projectile.timeLeft, true) * Utils.InverseLerp(telegraphTotalTime, telegraphTotalTime - 6f, projectile.timeLeft, true); + Projectile.Opacity = Utils.InverseLerp(0f, 6f, Projectile.timeLeft, true) * Utils.InverseLerp(telegraphTotalTime, telegraphTotalTime - 6f, Projectile.timeLeft, true); } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public Color TelegraphPrimitiveColor(float completionRatio) { - float opacity = MathHelper.Lerp(0.38f, 1.2f, projectile.Opacity); + float opacity = MathHelper.Lerp(0.38f, 1.2f, Projectile.Opacity); opacity *= CalamityUtils.Convert01To010(completionRatio); - opacity *= MathHelper.Lerp(0.9f, 0.2f, projectile.ai[0] / (ChargePositions.Length - 1f)); + opacity *= MathHelper.Lerp(0.9f, 0.2f, Projectile.ai[0] / (ChargePositions.Length - 1f)); if (completionRatio > 0.95f) opacity = 0.0000001f; return Color.Green * opacity; @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Boss public float TelegraphPrimitiveWidth(float completionRatio) { - return projectile.Opacity * 15f; + return Projectile.Opacity * 15f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -123,9 +123,9 @@ namespace CalamityMod.Projectiles.Boss // Stand-in variable used to differentiate between the beams. // It is not used anywhere else. - projectile.ai[0] = i; + Projectile.ai[0] = i; - TelegraphDrawer.Draw(positions, projectile.Size * 0.5f - Main.screenPosition, 55); + TelegraphDrawer.Draw(positions, Projectile.Size * 0.5f - Main.screenPosition, 55); } return false; } diff --git a/Projectiles/Boss/ApolloFireball.cs b/Projectiles/Boss/ApolloFireball.cs index 5a90cb25dd..fa8eec82dd 100644 --- a/Projectiles/Boss/ApolloFireball.cs +++ b/Projectiles/Boss/ApolloFireball.cs @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -18,61 +19,61 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Volatile Plasma Blast"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 48; - projectile.height = 48; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.Opacity = 0f; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 48; + Projectile.height = 48; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.Opacity = 0f; cooldownSlot = 1; - projectile.timeLeft = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 48 : timeLeft; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.timeLeft = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 48 : timeLeft; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]); - if (Vector2.Distance(targetLocation, projectile.Center) < 80f) - projectile.tileCollide = true; + Vector2 targetLocation = new Vector2(Projectile.ai[0], Projectile.ai[1]); + if (Vector2.Distance(targetLocation, Projectile.Center) < 80f) + Projectile.tileCollide = true; int fadeInTime = 3; - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - (((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 48 : timeLeft) - fadeInTime)) / (float)fadeInTime), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - (((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 48 : timeLeft) - fadeInTime)) / (float)fadeInTime), 0f, 1f); - Lighting.AddLight(projectile.Center, 0f, 0.6f * projectile.Opacity, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.6f * Projectile.Opacity, 0f); - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) - projectile.frame = 0; + if (Projectile.frame > 5) + Projectile.frame = 0; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - MathHelper.PiOver2; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; float speed1 = 1.8f; float speed2 = 2.8f; @@ -81,21 +82,21 @@ namespace CalamityMod.Projectiles.Boss for (int num53 = 0; num53 < 40; num53++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool(2) ? 107 : 110; - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 3f; dust = Main.dust[num54]; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; @@ -109,13 +110,13 @@ namespace CalamityMod.Projectiles.Boss for (int num55 = 0; num55 < 20; num55++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool(2) ? 107 : 110; - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; @@ -125,11 +126,11 @@ namespace CalamityMod.Projectiles.Boss } } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; target.AddBuff(BuffID.OnFire, 360); @@ -138,24 +139,24 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { int height = 90; - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.Damage(); - Main.PlaySound(SoundID.Item93, projectile.Center); + SoundEngine.PlaySound(SoundID.Item93, Projectile.Center); - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { bool splitNormal = true; if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) @@ -176,7 +177,7 @@ namespace CalamityMod.Projectiles.Boss for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(projectile.Center, velocity2, type, (int)Math.Round(projectile.damage * 0.8), 0f, Main.myPlayer); + Projectile.NewProjectile(Projectile.Center, velocity2, type, (int)Math.Round(Projectile.damage * 0.8), 0f, Main.myPlayer); } } @@ -190,7 +191,7 @@ namespace CalamityMod.Projectiles.Boss if (num640 < 50) num641 = 4f; - int num643 = Dust.NewDust(projectile.Center, 6, 6, Main.rand.NextBool(2) ? 107 : 110, 0f, 0f, 100, default, 1f); + int num643 = Dust.NewDust(Projectile.Center, 6, 6, Main.rand.NextBool(2) ? 107 : 110, 0f, 0f, 100, default, 1f); float num644 = Main.dust[num643].velocity.X; float num645 = Main.dust[num643].velocity.Y; diff --git a/Projectiles/Boss/ApolloRocket.cs b/Projectiles/Boss/ApolloRocket.cs index 3662996c84..404db664e0 100644 --- a/Projectiles/Boss/ApolloRocket.cs +++ b/Projectiles/Boss/ApolloRocket.cs @@ -7,6 +7,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -15,57 +16,57 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("High Explosive Plasma Rocket"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 28; - projectile.height = 28; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 28; + Projectile.height = 28; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; cooldownSlot = 1; - projectile.timeLeft = 600; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.timeLeft = 600; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - if (projectile.position.Y > projectile.ai[1]) - projectile.tileCollide = true; + if (Projectile.position.Y > Projectile.ai[1]) + Projectile.tileCollide = true; // Animation - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) - projectile.frame = 0; + if (Projectile.frame > 4) + Projectile.frame = 0; // Rotation - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; // Spawn effects - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; float speed1 = 1.8f; float speed2 = 2.8f; @@ -74,21 +75,21 @@ namespace CalamityMod.Projectiles.Boss for (int num53 = 0; num53 < 20; num53++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool(2) ? 107 : 110; - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 3f; dust = Main.dust[num54]; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; @@ -102,13 +103,13 @@ namespace CalamityMod.Projectiles.Boss for (int num55 = 0; num55 < 10; num55++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool(2) ? 107 : 110; - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; @@ -124,32 +125,32 @@ namespace CalamityMod.Projectiles.Boss bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Light - Lighting.AddLight(projectile.Center, 0f, 0.6f, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.6f, 0f); // Get a target and calculate distance from it - int target = Player.FindClosest(projectile.Center, 1, 1); - Vector2 distanceFromTarget = Main.player[target].Center - projectile.Center; + int target = Player.FindClosest(Projectile.Center, 1, 1); + Vector2 distanceFromTarget = Main.player[target].Center - Projectile.Center; // Set AI to stop homing, start accelerating float stopHomingDistance = malice ? 120f : death ? 160f : revenge ? 180f : expertMode ? 200f : 240f; - if (distanceFromTarget.Length() < stopHomingDistance || projectile.ai[0] == 1f || projectile.timeLeft < 480) + if (distanceFromTarget.Length() < stopHomingDistance || Projectile.ai[0] == 1f || Projectile.timeLeft < 480) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; - if (projectile.velocity.Length() < 24f) - projectile.velocity *= 1.05f; + if (Projectile.velocity.Length() < 24f) + Projectile.velocity *= 1.05f; return; } // Home in on target - float scaleFactor = projectile.velocity.Length(); + float scaleFactor = Projectile.velocity.Length(); float inertia = malice ? 6f : death ? 8f : revenge ? 9f : expertMode ? 10f : 12f; distanceFromTarget.Normalize(); distanceFromTarget *= scaleFactor; - projectile.velocity = (projectile.velocity * inertia + distanceFromTarget) / (inertia + 1f); - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor; + Projectile.velocity = (Projectile.velocity * inertia + distanceFromTarget) / (inertia + 1f); + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor; // Fly away from other rockets float pushForce = malice ? 0.07f : death ? 0.06f : revenge ? 0.055f : expertMode ? 0.05f : 0.04f; @@ -158,23 +159,23 @@ namespace CalamityMod.Projectiles.Boss { Projectile otherProj = Main.projectile[k]; // Short circuits to make the loop as fast as possible - if (!otherProj.active || k == projectile.whoAmI) + if (!otherProj.active || k == Projectile.whoAmI) continue; // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. - bool sameProjType = otherProj.type == projectile.type; - float taxicabDist = Vector2.Distance(projectile.Center, otherProj.Center); + bool sameProjType = otherProj.type == Projectile.type; + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); if (sameProjType && taxicabDist < pushDistance) { - if (projectile.position.X < otherProj.position.X) - projectile.velocity.X -= pushForce; + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; else - projectile.velocity.X += pushForce; + Projectile.velocity.X += pushForce; - if (projectile.position.Y < otherProj.position.Y) - projectile.velocity.Y -= pushForce; + if (Projectile.position.Y < otherProj.position.Y) + Projectile.velocity.Y -= pushForce; else - projectile.velocity.Y += pushForce; + Projectile.velocity.Y += pushForce; } } } @@ -187,38 +188,38 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int drawStart = height * projectile.frame; - Vector2 origin = projectile.Size / 2; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = height * Projectile.frame; + Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/ApolloRocketGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Boss/ApolloRocketGlow"), Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); } public override void Kill(int timeLeft) { // Rocket explosion int height = 90; - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int num621 = 0; num621 < 12; num621++) { int randomDustType = Main.rand.NextBool(2) ? 107 : 110; - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -229,13 +230,13 @@ namespace CalamityMod.Projectiles.Boss for (int num623 = 0; num623 < 15; num623++) { int randomDustType = Main.rand.NextBool(2) ? 107 : 110; - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 100, default, 3f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, 0f, 0f, 100, default, 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 5f; - dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 100, default, 2f); + dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDustType, 0f, 0f, 100, default, 2f); Main.dust[dust].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/AresDeathBeamStart.cs b/Projectiles/Boss/AresDeathBeamStart.cs index 2a2fff5417..3538c9ba43 100644 --- a/Projectiles/Boss/AresDeathBeamStart.cs +++ b/Projectiles/Boss/AresDeathBeamStart.cs @@ -19,48 +19,48 @@ namespace CalamityMod.Projectiles.Boss public int OwnerIndex { - get => (int)projectile.ai[1]; - set => projectile.ai[1] = value; + get => (int)Projectile.ai[1]; + set => Projectile.ai[1] = value; } public override float MaxScale => 1f; public override float MaxLaserLength => 2400f; public override float Lifetime => AresBody.deathrayDuration; public override Color LaserOverlayColor => new Color(250, 250, 250, 100); public override Color LightCastColor => Color.White; - public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/Projectiles/Boss/AresDeathBeamStart"); - public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresDeathBeamMiddle"); - public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresDeathBeamEnd"); + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/Projectiles/Boss/AresDeathBeamStart"); + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/AresDeathBeamMiddle"); + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/AresDeathBeamEnd"); public override void SetStaticDefaults() { // Ares' eight-pointed-star laser beams DisplayName.SetDefault("Exo Overload Beam"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AttachToSomething() @@ -68,21 +68,21 @@ namespace CalamityMod.Projectiles.Boss if (Main.npc[OwnerIndex].active && Main.npc[OwnerIndex].type == ModContent.NPCType()) { Vector2 fireFrom = new Vector2(Main.npc[OwnerIndex].Center.X - 1f, Main.npc[OwnerIndex].Center.Y + 23f); - fireFrom += projectile.velocity.SafeNormalize(Vector2.UnitY) * MathHelper.Lerp(35f, 127f, projectile.scale * projectile.scale); - projectile.Center = fireFrom; + fireFrom += Projectile.velocity.SafeNormalize(Vector2.UnitY) * MathHelper.Lerp(35f, 127f, Projectile.scale * Projectile.scale); + Projectile.Center = fireFrom; } // Die of the owner is invalid in some way. else { - projectile.Kill(); + Projectile.Kill(); return; } // Die if the owner is not performing Ares' deathray attack. if (Main.npc[OwnerIndex].Calamity().newAI[0] != (float)AresBody.Phase.Deathrays) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -113,14 +113,14 @@ namespace CalamityMod.Projectiles.Boss angularVelocity *= -1f; // Update the direction and rotation of the laser. - projectile.velocity = projectile.velocity.RotatedBy(angularVelocity); - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.velocity = Projectile.velocity.RotatedBy(angularVelocity); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override float DetermineLaserLength() { float[] sampledLengths = new float[10]; - Collision.LaserScan(projectile.Center, projectile.velocity, projectile.width * projectile.scale, MaxLaserLength, sampledLengths); + Collision.LaserScan(Projectile.Center, Projectile.velocity, Projectile.width * Projectile.scale, MaxLaserLength, sampledLengths); float newLaserLength = sampledLengths.Average(); @@ -135,10 +135,10 @@ namespace CalamityMod.Projectiles.Boss { // Spawn dust at the end of the beam. int dustType = 107; - Vector2 dustCreationPosition = projectile.Center + projectile.velocity * (LaserLength - 14f); + Vector2 dustCreationPosition = Projectile.Center + Projectile.velocity * (LaserLength - 14f); for (int i = 0; i < 2; i++) { - float dustDirection = projectile.velocity.ToRotation() + Main.rand.NextBool().ToDirectionInt() * MathHelper.PiOver2; + float dustDirection = Projectile.velocity.ToRotation() + Main.rand.NextBool().ToDirectionInt() * MathHelper.PiOver2; Vector2 dustVelocity = dustDirection.ToRotationVector2() * Main.rand.NextFloat(2f, 4f); Dust exoEnergy = Dust.NewDustDirect(dustCreationPosition, 0, 0, dustType, dustVelocity.X, dustVelocity.Y, 0, new Color(0, 255, 255), 1f); exoEnergy.noGravity = true; @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(5)) { - Vector2 dustSpawnOffset = projectile.velocity.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloatDirection() * projectile.width * 0.5f; + Vector2 dustSpawnOffset = Projectile.velocity.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloatDirection() * Projectile.width * 0.5f; Dust exoEnergy = Dust.NewDustDirect(dustCreationPosition + dustSpawnOffset - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); exoEnergy.velocity *= 0.5f; @@ -156,46 +156,46 @@ namespace CalamityMod.Projectiles.Boss } // Determine frames. - projectile.frameCounter++; - if (projectile.frameCounter % 5f == 0f) - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + if (Projectile.frameCounter % 5f == 0f) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { // This should never happen, but just in case- - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) return false; // Don't draw the laser if its scale is too low, as that could lead to an infinite loop and out of memory crash. // This has happened in multiplayer historically, so this check is important. - if (projectile.scale < 0.001f) + if (Projectile.scale < 0.001f) return false; Color beamColor = LaserOverlayColor; - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); // Start texture drawing. spriteBatch.Draw(LaserBeginTexture, - projectile.Center - Main.screenPosition, + Projectile.Center - Main.screenPosition, startFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserBeginTexture.Size() / 2f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); // Prepare things for body drawing. float laserBodyLength = LaserLength + middleFrameArea.Height; - Vector2 centerOnLaser = projectile.Center; + Vector2 centerOnLaser = Projectile.Center; // Body drawing. if (laserBodyLength > 0f) { - float laserOffset = middleFrameArea.Height * projectile.scale; + float laserOffset = middleFrameArea.Height * Projectile.scale; float incrementalBodyLength = 0f; while (incrementalBodyLength + 1f < laserBodyLength) { @@ -203,14 +203,14 @@ namespace CalamityMod.Projectiles.Boss centerOnLaser - Main.screenPosition, middleFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserMiddleTexture.Size() * 0.5f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); incrementalBodyLength += laserOffset; - centerOnLaser += projectile.velocity * laserOffset; - middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[projectile.type]; + centerOnLaser += Projectile.velocity * laserOffset; + middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[Projectile.type]; if (middleFrameArea.Y + middleFrameArea.Height > LaserMiddleTexture.Height) middleFrameArea.Y = 0; } @@ -221,9 +221,9 @@ namespace CalamityMod.Projectiles.Boss laserEndCenter, endFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserEndTexture.Size() * 0.5f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); return false; @@ -235,7 +235,7 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(BuffID.Frostburn, 360); } - public override bool CanHitPlayer(Player target) => projectile.scale >= 0.5f; + public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { diff --git a/Projectiles/Boss/AresDeathBeamTelegraph.cs b/Projectiles/Boss/AresDeathBeamTelegraph.cs index dfd4d416d1..50b4f2ec5e 100644 --- a/Projectiles/Boss/AresDeathBeamTelegraph.cs +++ b/Projectiles/Boss/AresDeathBeamTelegraph.cs @@ -14,11 +14,11 @@ namespace CalamityMod.Projectiles.Boss public float TelegraphDelay { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } - public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)Projectile.ai[1]) ? Main.npc[(int)Projectile.ai[1]] : null; public Vector2 OldVelocity; public const float deathrayTelegraphDuration_Normal = 150f; @@ -37,13 +37,13 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Boss bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - projectile.timeLeft = (int)(malice ? deathrayTelegraphDuration_Malice : death ? deathrayTelegraphDuration_Death : + Projectile.timeLeft = (int)(malice ? deathrayTelegraphDuration_Malice : death ? deathrayTelegraphDuration_Death : revenge ? deathrayTelegraphDuration_Rev : expertMode ? deathrayTelegraphDuration_Expert : deathrayTelegraphDuration_Normal); } @@ -68,29 +68,29 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { // Determine the relative opacities for each player based on their distance. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.netUpdate = true; } // Die if the thing to attach to disappears. if (ThingToAttachTo is null || !ThingToAttachTo.active) { - projectile.Kill(); + Projectile.Kill(); return; } // Set start of telegraph to the npc center. - projectile.Center = ThingToAttachTo.Center + new Vector2(-1f, 23f) + (Vector2.Normalize(OldVelocity) * 17f); + Projectile.Center = ThingToAttachTo.Center + new Vector2(-1f, 23f) + (Vector2.Normalize(OldVelocity) * 17f); // Be sure to save the velocity the projectile started with. It will be set again when the telegraph is over. if (OldVelocity == Vector2.Zero) { - OldVelocity = projectile.velocity; - projectile.velocity = Vector2.Zero; - projectile.netUpdate = true; - projectile.rotation = OldVelocity.ToRotation() + MathHelper.PiOver2; + OldVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + Projectile.netUpdate = true; + Projectile.rotation = OldVelocity.ToRotation() + MathHelper.PiOver2; } TelegraphDelay++; @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Boss if (TelegraphDelay >= TelegraphTotalTime) return true; - Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + Texture2D laserTelegraph = ModContent.Request("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); float yScale = 2f; if (TelegraphDelay < TelegraphFadeTime) yScale = MathHelper.Lerp(0f, 2f, TelegraphDelay / 15f); @@ -132,8 +132,8 @@ namespace CalamityMod.Projectiles.Boss colorOuter *= 0.7f; colorInner *= 0.7f; - spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, OldVelocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); - spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, OldVelocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorInner, OldVelocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorOuter, OldVelocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Boss/AresGaussNukeProjectile.cs b/Projectiles/Boss/AresGaussNukeProjectile.cs index fbee040d8a..1a3b230138 100644 --- a/Projectiles/Boss/AresGaussNukeProjectile.cs +++ b/Projectiles/Boss/AresGaussNukeProjectile.cs @@ -9,6 +9,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -19,52 +20,52 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Gauss Nuke"); - Main.projFrames[projectile.type] = 12; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 12; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 100; - projectile.height = 100; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 100; + Projectile.height = 100; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; cooldownSlot = 1; - projectile.timeLeft = timeLeft; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.timeLeft = timeLeft; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - if (projectile.position.Y > projectile.ai[1]) - projectile.tileCollide = true; + if (Projectile.position.Y > Projectile.ai[1]) + Projectile.tileCollide = true; // Animation - projectile.frameCounter++; - if (projectile.frameCounter >= 6) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 12) - projectile.frame = 0; + if (Projectile.frame >= 12) + Projectile.frame = 0; // Rotation - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - MathHelper.PiOver2; // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; @@ -73,15 +74,15 @@ namespace CalamityMod.Projectiles.Boss bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Spawn effects - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; for (int i = 0; i < 25; i++) { // Choose a random speed and angle float dustSpeed = Main.rand.NextFloat(3f, 13f); float angleRandom = 0.06f; - Vector2 dustVel = new Vector2(dustSpeed, 0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2f * angleRandom); @@ -89,17 +90,17 @@ namespace CalamityMod.Projectiles.Boss float scale = Main.rand.NextFloat(0.5f, 1.6f); // Spawn dust - Dust dust = Dust.NewDustPerfect(projectile.Center, 107, -dustVel, 0, default, scale); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 107, -dustVel, 0, default, scale); dust.noGravity = true; } // Gauss sparks - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { int totalProjectiles = malice ? 18 : 12; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - float velocity = projectile.velocity.Length(); + float velocity = Projectile.velocity.Length(); double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); @@ -107,94 +108,94 @@ namespace CalamityMod.Projectiles.Boss for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(projectile.Center, velocity2 + Vector2.Normalize(projectile.velocity) * -6f, type, (int)Math.Round(projectile.damage * 0.5), 0f, Main.myPlayer); + Projectile.NewProjectile(Projectile.Center, velocity2 + Vector2.Normalize(Projectile.velocity) * -6f, type, (int)Math.Round(Projectile.damage * 0.5), 0f, Main.myPlayer); } } } // Light - Lighting.AddLight(projectile.Center, 0.2f, 0.25f, 0.05f); + Lighting.AddLight(Projectile.Center, 0.2f, 0.25f, 0.05f); // Get a target and calculate distance from it - int target = Player.FindClosest(projectile.Center, 1, 1); - Vector2 distanceFromTarget = Main.player[target].Center - projectile.Center; + int target = Player.FindClosest(Projectile.Center, 1, 1); + Vector2 distanceFromTarget = Main.player[target].Center - Projectile.Center; // Set AI to stop homing, start accelerating float stopHomingDistance = malice ? 260f : death ? 280f : revenge ? 290f : expertMode ? 300f : 320f; - if ((distanceFromTarget.Length() < stopHomingDistance && projectile.ai[0] != -1f) || projectile.ai[0] == 1f) + if ((distanceFromTarget.Length() < stopHomingDistance && Projectile.ai[0] != -1f) || Projectile.ai[0] == 1f) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; - if (projectile.velocity.Length() < 24f) - projectile.velocity *= 1.025f; + if (Projectile.velocity.Length() < 24f) + Projectile.velocity *= 1.025f; return; } // Home in on target - float scaleFactor = projectile.velocity.Length(); + float scaleFactor = Projectile.velocity.Length(); float inertia = malice ? 6f : death ? 8f : revenge ? 9f : expertMode ? 10f : 12f; distanceFromTarget.Normalize(); distanceFromTarget *= scaleFactor; - projectile.velocity = (projectile.velocity * inertia + distanceFromTarget) / (inertia + 1f); - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor; + Projectile.velocity = (Projectile.velocity * inertia + distanceFromTarget) / (inertia + 1f); + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { spriteBatch.EnterShaderRegion(); - Texture2D telegraphBase = ModContent.GetTexture("CalamityMod/Projectiles/InvisibleProj"); + Texture2D telegraphBase = ModContent.Request("CalamityMod/Projectiles/InvisibleProj"); - GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseOpacity(0.4f * MathHelper.Clamp((1 - projectile.timeLeft / (float)timeLeft) * 8f, 0, 1)); + GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseOpacity(0.4f * MathHelper.Clamp((1 - Projectile.timeLeft / (float)timeLeft) * 8f, 0, 1)); GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseColor(Color.Lerp(Color.Goldenrod, Color.Gold, 0.7f * (float)Math.Pow(0.5 + 0.5 * Math.Sin(Main.GlobalTime), 3))); GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSecondaryColor(Color.Lerp(Color.Yellow, Color.White, 0.5f)); - GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSaturation(1 - projectile.timeLeft / (float)timeLeft); + GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSaturation(1 - Projectile.timeLeft / (float)timeLeft); GameShaders.Misc["CalamityMod:CircularAoETelegraph"].Apply(); - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; spriteBatch.Draw(telegraphBase, drawPosition, null, lightColor, 0, telegraphBase.Size() / 2f, 1070f, 0, 0); spriteBatch.ExitShaderRegion(); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int drawStart = height * projectile.frame; - Vector2 origin = projectile.Size / 2; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = height * Projectile.frame; + Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/AresGaussNukeProjectileGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Boss/AresGaussNukeProjectileGlow"), Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 45f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 45f, targetHitbox); public override void Kill(int timeLeft) { // Nuke explosion sound - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), Projectile.Center); // Nuke gores - Gore.NewGore(projectile.position, projectile.velocity, mod.GetGoreSlot("Gores/Ares/AresGaussNuke1"), 1f); - Gore.NewGore(projectile.position, projectile.velocity, mod.GetGoreSlot("Gores/Ares/AresGaussNuke3"), 1f); + Gore.NewGore(Projectile.position, Projectile.velocity, Mod.GetGoreSlot("Gores/Ares/AresGaussNuke1"), 1f); + Gore.NewGore(Projectile.position, Projectile.velocity, Mod.GetGoreSlot("Gores/Ares/AresGaussNuke3"), 1f); // Create a bunch of lightning bolts in the sky ExoMechsSky.CreateLightningBolt(12); - if (Main.myPlayer == projectile.owner && projectile.ai[0] != -1f) + if (Main.myPlayer == Projectile.owner && Projectile.ai[0] != -1f) { // Explosion waves for (int i = 0; i < 3; i++) { - Projectile explosion = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 0f, Main.myPlayer); + Projectile explosion = Projectile.NewProjectileDirect(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer); if (explosion.whoAmI.WithinBounds(Main.maxProjectiles)) { // Make the max explosion radius decrease over time, creating a ring effect. diff --git a/Projectiles/Boss/AresGaussNukeProjectileBoom.cs b/Projectiles/Boss/AresGaussNukeProjectileBoom.cs index 8aa3256b55..ae72e1462b 100644 --- a/Projectiles/Boss/AresGaussNukeProjectileBoom.cs +++ b/Projectiles/Boss/AresGaussNukeProjectileBoom.cs @@ -31,19 +31,19 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = projectile.height = 2; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = Lifetime; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = Projectile.height = 2; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime; cooldownSlot = 1; } - public override void PostAI() => Lighting.AddLight(projectile.Center, 0.2f, 0.1f, 0f); + public override void PostAI() => Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f); - public override bool CanHitPlayer(Player target) => CalamityUtils.CircularHitboxCollision(projectile.Center, CurrentRadius * projectile.scale * 0.4f, target.Hitbox) && projectile.timeLeft > 6; + public override bool CanHitPlayer(Player target) => CalamityUtils.CircularHitboxCollision(Projectile.Center, CurrentRadius * Projectile.scale * 0.4f, target.Hitbox) && Projectile.timeLeft > 6; public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => target.Calamity().lastProjectileHit = projectile; diff --git a/Projectiles/Boss/AresGaussNukeProjectileSpark.cs b/Projectiles/Boss/AresGaussNukeProjectileSpark.cs index 83be235e35..1f4be9794d 100644 --- a/Projectiles/Boss/AresGaussNukeProjectileSpark.cs +++ b/Projectiles/Boss/AresGaussNukeProjectileSpark.cs @@ -15,73 +15,73 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Gauss Spark"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.Opacity = 0f; + Projectile.width = 14; + Projectile.height = 14; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.Opacity = 0f; cooldownSlot = 1; - projectile.penetrate = -1; - projectile.timeLeft = timeLeft; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.penetrate = -1; + Projectile.timeLeft = timeLeft; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 15f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 15f) { - projectile.localAI[0] = 15f; - projectile.velocity.Y += 0.1f; + Projectile.localAI[0] = 15f; + Projectile.velocity.Y += 0.1f; } - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; int fadeOutTime = 15; int fadeInTime = 3; - if (projectile.timeLeft < fadeOutTime) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / (float)fadeOutTime, 0f, 1f); + if (Projectile.timeLeft < fadeOutTime) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / (float)fadeOutTime, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - (timeLeft - fadeInTime)) / (float)fadeInTime), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - (timeLeft - fadeInTime)) / (float)fadeInTime), 0f, 1f); - Lighting.AddLight(projectile.Center, 0.1f * projectile.Opacity, 0.125f * projectile.Opacity, 0.025f * projectile.Opacity); + Lighting.AddLight(Projectile.Center, 0.1f * Projectile.Opacity, 0.125f * Projectile.Opacity, 0.025f * Projectile.Opacity); - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - MathHelper.PiOver2; } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; target.AddBuff(BuffID.OnFire, 180); @@ -89,10 +89,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/AresLaserBeamStart.cs b/Projectiles/Boss/AresLaserBeamStart.cs index ed442219f4..a36271fdcf 100644 --- a/Projectiles/Boss/AresLaserBeamStart.cs +++ b/Projectiles/Boss/AresLaserBeamStart.cs @@ -24,37 +24,37 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(frameDrawn); - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { frameDrawn = reader.ReadInt32(); - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { Vector2? vector78 = null; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - projectile.velocity = -Vector2.UnitY; + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) + Projectile.velocity = -Vector2.UnitY; // Kill laser to prevent bullshit hits when Ares enters passive and immune phase bool killLaser = false; @@ -67,41 +67,41 @@ namespace CalamityMod.Projectiles.Boss } } - if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType() && !killLaser) + if (Main.npc[(int)Projectile.ai[1]].active && Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType() && !killLaser) { float offset = 84f; float offset2 = 16f; - Vector2 fireFrom = Main.npc[(int)projectile.ai[1]].Calamity().newAI[3] == 0f ? new Vector2(Main.npc[(int)projectile.ai[1]].Center.X - offset2 * Main.npc[(int)projectile.ai[1]].direction, Main.npc[(int)projectile.ai[1]].Center.Y + offset) : new Vector2(Main.npc[(int)projectile.ai[1]].Center.X + offset * Main.npc[(int)projectile.ai[1]].direction, Main.npc[(int)projectile.ai[1]].Center.Y + offset2); - projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; + Vector2 fireFrom = Main.npc[(int)Projectile.ai[1]].Calamity().newAI[3] == 0f ? new Vector2(Main.npc[(int)Projectile.ai[1]].Center.X - offset2 * Main.npc[(int)Projectile.ai[1]].direction, Main.npc[(int)Projectile.ai[1]].Center.Y + offset) : new Vector2(Main.npc[(int)Projectile.ai[1]].Center.X + offset * Main.npc[(int)Projectile.ai[1]].direction, Main.npc[(int)Projectile.ai[1]].Center.Y + offset2); + Projectile.position = fireFrom - new Vector2(Projectile.width, Projectile.height) / 2f; } else - projectile.Kill(); + Projectile.Kill(); float num801 = 1f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 60f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 60f) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.scale = (float)Math.Sin(projectile.localAI[0] * (float)Math.PI / 60f) * 10f * num801; - if (projectile.scale > num801) - projectile.scale = num801; + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * (float)Math.PI / 60f) * 10f * num801; + if (Projectile.scale > num801) + Projectile.scale = num801; - float num804 = projectile.velocity.ToRotation(); - projectile.rotation = num804 - MathHelper.PiOver2; - projectile.velocity = num804.ToRotationVector2(); + float num804 = Projectile.velocity.ToRotation(); + Projectile.rotation = num804 - MathHelper.PiOver2; + Projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; //3f - float num806 = projectile.width; + float num806 = Projectile.width; - Vector2 samplingPoint = projectile.Center; + Vector2 samplingPoint = Projectile.Center; if (vector78.HasValue) samplingPoint = vector78.Value; float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); + Collision.LaserScan(samplingPoint, Projectile.velocity, num806 * Projectile.scale, 2400f, array3); float num807 = 0f; for (int num808 = 0; num808 < array3.Length; num808++) { @@ -110,20 +110,20 @@ namespace CalamityMod.Projectiles.Boss num807 /= num805; // Fire laser through walls at max length if target cannot be seen - if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1)) + if (!Collision.CanHitLine(Main.npc[(int)Projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)Projectile.ai[1]].target].Center, 1, 1)) { num807 = 2400f; } float amount = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); //length of laser, linear interpolation // Spawn dust at the end of the beam int dustType = (int)CalamityDusts.Brimstone; - Vector2 dustPos = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); + Vector2 dustPos = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); for (int i = 0; i < 2; i++) { - float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float dustRot = Projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult); int dust = Dust.NewDust(dustPos, 0, 0, dustType, dustVel.X, dustVel.Y, 0, default, 1f); @@ -133,29 +133,29 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(5)) { - Vector2 dustRot = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; + Vector2 dustRot = Projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * Projectile.width; int dust = Dust.NewDust(dustPos + dustRot - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, default, 1.5f); Main.dust[dust].velocity *= 0.5f; Main.dust[dust].velocity.Y = -Math.Abs(Main.dust[dust].velocity.Y); } DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) return false; - Texture2D beamStart = Main.projectileTexture[projectile.type]; - Texture2D beamMiddle = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresLaserBeamMiddle"); - Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresLaserBeamEnd"); + Texture2D beamStart = Main.projectileTexture[Projectile.type]; + Texture2D beamMiddle = ModContent.Request("CalamityMod/ExtraTextures/Lasers/AresLaserBeamMiddle"); + Texture2D beamEnd = ModContent.Request("CalamityMod/ExtraTextures/Lasers/AresLaserBeamEnd"); - float drawLength = projectile.localAI[1]; + float drawLength = Projectile.localAI[1]; Color color = new Color(250, 250, 250, 100); - if (projectile.localAI[0] % 5f == 0f) + if (Projectile.localAI[0] % 5f == 0f) { frameDrawn++; if (frameDrawn >= maxFrames) @@ -163,14 +163,14 @@ namespace CalamityMod.Projectiles.Boss } // Draw start of beam - Vector2 vector = projectile.Center - Main.screenPosition; + Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / maxFrames * frameDrawn, beamStart.Width, beamStart.Height / maxFrames); - spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(beamStart, vector, sourceRectangle, color, Projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / maxFrames) / 2f, Projectile.scale, SpriteEffects.None, 0f); // Draw middle of beam - drawLength -= (beamStart.Height / maxFrames / 2 + beamEnd.Height / maxFrames) * projectile.scale; - Vector2 center = projectile.Center; - center += projectile.velocity * projectile.scale * beamStart.Height / maxFrames / 2f; + drawLength -= (beamStart.Height / maxFrames / 2 + beamEnd.Height / maxFrames) * Projectile.scale; + Vector2 center = Projectile.Center; + center += Projectile.velocity * Projectile.scale * beamStart.Height / maxFrames / 2f; if (drawLength > 0f) { float i = 0f; @@ -182,14 +182,14 @@ namespace CalamityMod.Projectiles.Boss if (drawLength - i < rectangle.Height) rectangle.Height = (int)(drawLength - i); - spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, Projectile.rotation, new Vector2(rectangle.Width / 2f, 0f), Projectile.scale, SpriteEffects.None, 0f); middleFrameDrawn++; if (middleFrameDrawn >= maxFrames) middleFrameDrawn = 0; - i += rectangle.Height * projectile.scale; - center += projectile.velocity * rectangle.Height * projectile.scale; + i += rectangle.Height * Projectile.scale; + center += Projectile.velocity * rectangle.Height * Projectile.scale; rectangle.Y += beamMiddle.Height / maxFrames; if (rectangle.Y + rectangle.Height > beamMiddle.Height / maxFrames) @@ -200,7 +200,7 @@ namespace CalamityMod.Projectiles.Boss // Draw end of beam Vector2 vector2 = center - Main.screenPosition; sourceRectangle = new Rectangle(0, beamEnd.Height / maxFrames * frameDrawn, beamEnd.Width, beamEnd.Height / maxFrames); - spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, Projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / maxFrames) / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -208,8 +208,8 @@ namespace CalamityMod.Projectiles.Boss public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -219,7 +219,7 @@ namespace CalamityMod.Projectiles.Boss return true; } float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 30f * projectile.scale, ref num6)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 30f * Projectile.scale, ref num6)) { return true; } @@ -231,7 +231,7 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(ModContent.BuffType(), 300); } - public override bool CanHitPlayer(Player target) => projectile.scale >= 0.5f; + public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { diff --git a/Projectiles/Boss/AresPlasmaBolt.cs b/Projectiles/Boss/AresPlasmaBolt.cs index dff5e23828..88709a5317 100644 --- a/Projectiles/Boss/AresPlasmaBolt.cs +++ b/Projectiles/Boss/AresPlasmaBolt.cs @@ -16,67 +16,67 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Exoplasma Bolt"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 18; - projectile.height = 18; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.Opacity = 0f; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 18; + Projectile.height = 18; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.Opacity = 0f; cooldownSlot = 1; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.timeLeft = timeLeft; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = timeLeft; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { // 22 frames starting at 0.5 // 17 frames starting at 1 - if (projectile.velocity.Length() < maxVelocity) + if (Projectile.velocity.Length() < maxVelocity) { - projectile.velocity *= 1.075f; - if (projectile.velocity.Length() > maxVelocity) + Projectile.velocity *= 1.075f; + if (Projectile.velocity.Length() > maxVelocity) { - projectile.velocity.Normalize(); - projectile.velocity *= maxVelocity; + Projectile.velocity.Normalize(); + Projectile.velocity *= maxVelocity; } } int fadeOutTime = 15; int fadeInTime = 3; - if (projectile.timeLeft < fadeOutTime) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / (float)fadeOutTime, 0f, 1f); + if (Projectile.timeLeft < fadeOutTime) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / (float)fadeOutTime, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - (timeLeft - fadeInTime)) / (float)fadeInTime), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - (timeLeft - fadeInTime)) / (float)fadeInTime), 0f, 1f); - Lighting.AddLight(projectile.Center, 0f, 0.4f * projectile.Opacity, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.4f * Projectile.Opacity, 0f); - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - MathHelper.PiOver2; } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; target.AddBuff(BuffID.OnFire, 180); @@ -85,10 +85,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/AresPlasmaFireball.cs b/Projectiles/Boss/AresPlasmaFireball.cs index eb1430bdbb..ff636f41e7 100644 --- a/Projectiles/Boss/AresPlasmaFireball.cs +++ b/Projectiles/Boss/AresPlasmaFireball.cs @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -18,64 +19,64 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Volatile Plasma Blast"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 36; - projectile.height = 36; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.Opacity = 0f; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 36; + Projectile.height = 36; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.Opacity = 0f; cooldownSlot = 1; - projectile.timeLeft = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 96 : timeLeft; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.timeLeft = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 96 : timeLeft; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - if (projectile.ai[0] != -1f) + if (Projectile.ai[0] != -1f) { - Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]); - if (Vector2.Distance(targetLocation, projectile.Center) < 80f) - projectile.tileCollide = true; + Vector2 targetLocation = new Vector2(Projectile.ai[0], Projectile.ai[1]); + if (Vector2.Distance(targetLocation, Projectile.Center) < 80f) + Projectile.tileCollide = true; } int fadeInTime = 3; - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - (((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 96 : timeLeft) - fadeInTime)) / (float)fadeInTime), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - (((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 96 : timeLeft) - fadeInTime)) / (float)fadeInTime), 0f, 1f); - Lighting.AddLight(projectile.Center, 0f, 0.6f * projectile.Opacity, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.6f * Projectile.Opacity, 0f); - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) - projectile.frame = 0; + if (Projectile.frame > 5) + Projectile.frame = 0; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - MathHelper.PiOver2; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; float speed1 = 1.8f; float speed2 = 2.8f; @@ -84,21 +85,21 @@ namespace CalamityMod.Projectiles.Boss for (int num53 = 0; num53 < 40; num53++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool(2) ? 107 : 110; - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 3f; dust = Main.dust[num54]; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; @@ -112,13 +113,13 @@ namespace CalamityMod.Projectiles.Boss for (int num55 = 0; num55 < 20; num55++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool(2) ? 107 : 110; - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; @@ -128,11 +129,11 @@ namespace CalamityMod.Projectiles.Boss } } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; target.AddBuff(BuffID.OnFire, 360); @@ -141,24 +142,24 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { int height = 90; - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.Damage(); - Main.PlaySound(SoundID.Item93, projectile.Center); + SoundEngine.PlaySound(SoundID.Item93, Projectile.Center); - if (Main.myPlayer == projectile.owner && projectile.ai[1] != -1f) + if (Main.myPlayer == Projectile.owner && Projectile.ai[1] != -1f) { bool splitNormal = true; if (CalamityGlobalNPC.draedonExoMechPrimePlasmaCannon != -1) @@ -171,7 +172,7 @@ namespace CalamityMod.Projectiles.Boss int totalProjectiles = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 12 : 8; // Reduce the total amount of projectiles by half if Ares Plasma Arm is shooting them and in deathray phase and not the last mech - if (projectile.ai[0] == -1f) + if (Projectile.ai[0] == -1f) totalProjectiles /= 2; float radians = MathHelper.TwoPi / totalProjectiles; @@ -184,7 +185,7 @@ namespace CalamityMod.Projectiles.Boss for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(projectile.Center, velocity2, type, (int)Math.Round(projectile.damage * 0.8), 0f, Main.myPlayer); + Projectile.NewProjectile(Projectile.Center, velocity2, type, (int)Math.Round(Projectile.damage * 0.8), 0f, Main.myPlayer); } } @@ -198,7 +199,7 @@ namespace CalamityMod.Projectiles.Boss if (num640 < 50) num641 = 4f; - int num643 = Dust.NewDust(projectile.Center, 6, 6, Main.rand.NextBool(2) ? 107 : 110, 0f, 0f, 100, default, 1f); + int num643 = Dust.NewDust(Projectile.Center, 6, 6, Main.rand.NextBool(2) ? 107 : 110, 0f, 0f, 100, default, 1f); float num644 = Main.dust[num643].velocity.X; float num645 = Main.dust[num643].velocity.Y; diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs index fc6850e7e8..79d5423015 100644 --- a/Projectiles/Boss/AresTeslaOrb.cs +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Boss { public class AresTeslaOrb : ModProjectile { - public ref float Identity => ref projectile.ai[0]; + public ref float Identity => ref Projectile.ai[0]; public PrimitiveTrail LightningDrawer; public PrimitiveTrail LightningBackgroundDrawer; private const int timeLeft = 480; @@ -23,33 +23,33 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Tesla Sphere"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.Opacity = 0f; + Projectile.width = 32; + Projectile.height = 32; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.Opacity = 0f; cooldownSlot = 1; - projectile.timeLeft = timeLeft; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.timeLeft = timeLeft; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() @@ -61,30 +61,30 @@ namespace CalamityMod.Projectiles.Boss deathrayPhase = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Calamity().newAI[0] == (float)AresBody.Phase.Deathrays; } - if (projectile.velocity.Length() < (deathrayPhase ? 10.4f : 20.8f)) - projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() < (deathrayPhase ? 10.4f : 20.8f)) + Projectile.velocity *= 1.01f; int fadeOutTime = 15; int fadeInTime = 3; - if (projectile.timeLeft < fadeOutTime) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / (float)fadeOutTime, 0f, 1f); + if (Projectile.timeLeft < fadeOutTime) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / (float)fadeOutTime, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - (timeLeft - fadeInTime)) / (float)fadeInTime), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - (timeLeft - fadeInTime)) / (float)fadeInTime), 0f, 1f); - Lighting.AddLight(projectile.Center, 0.1f * projectile.Opacity, 0.25f * projectile.Opacity, 0.25f * projectile.Opacity); + Lighting.AddLight(Projectile.Center, 0.1f * Projectile.Opacity, 0.25f * Projectile.Opacity, 0.25f * Projectile.Opacity); - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; float speed1 = 1.8f; float speed2 = 2.8f; @@ -93,21 +93,21 @@ namespace CalamityMod.Projectiles.Boss for (int num53 = 0; num53 < 40; num53++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2f * angleRandom); int randomDustType = Main.rand.Next(2) == 0 ? 206 : 229; float scale = randomDustType == 206 ? 1.5f : 1f; - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 2.5f * scale); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 2.5f * scale); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 3f; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 1.5f * scale); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 1.5f * scale); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; @@ -119,14 +119,14 @@ namespace CalamityMod.Projectiles.Boss for (int num55 = 0; num55 < 20; num55++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2f * angleRandom); int randomDustType = Main.rand.Next(2) == 0 ? 206 : 229; float scale = randomDustType == 206 ? 1.5f : 1f; - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 3f * scale); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 3f * scale); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; @@ -135,11 +135,11 @@ namespace CalamityMod.Projectiles.Boss } } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; target.AddBuff(BuffID.Electrified, 240); @@ -159,10 +159,10 @@ namespace CalamityMod.Projectiles.Boss float detachDistance = malice ? 1600f : death ? 1360f : revenge ? 1280f : expertMode ? 1200f : 960f; for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].type != projectile.type || Main.projectile[i].ai[0] != Identity + 1f || !Main.projectile[i].active || Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Calamity().newAI[0] == (float)AresBody.Phase.Deathrays) + if (Main.projectile[i].type != Projectile.type || Main.projectile[i].ai[0] != Identity + 1f || !Main.projectile[i].active || Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Calamity().newAI[0] == (float)AresBody.Phase.Deathrays) continue; - if (Vector2.Distance(projectile.Center, Main.projectile[i].Center) > detachDistance) + if (Vector2.Distance(Projectile.Center, Main.projectile[i].Center) > detachDistance) continue; return Main.projectile[i]; @@ -207,21 +207,21 @@ namespace CalamityMod.Projectiles.Boss internal float WidthFunction(float completionRatio) { - return MathHelper.Lerp(0.75f, 1.85f, (float)Math.Sin(MathHelper.Pi * completionRatio)) * projectile.scale; + return MathHelper.Lerp(0.75f, 1.85f, (float)Math.Sin(MathHelper.Pi * completionRatio)) * Projectile.scale; } internal Color ColorFunction(float completionRatio) { float fadeToWhite = MathHelper.Lerp(0f, 0.65f, (float)Math.Sin(MathHelper.TwoPi * completionRatio + Main.GlobalTime * 4f) * 0.5f + 0.5f); Color baseColor = Color.Lerp(Color.Cyan, Color.White, fadeToWhite); - return Color.Lerp(baseColor, Color.LightBlue, ((float)Math.Sin(MathHelper.Pi * completionRatio + Main.GlobalTime * 4f) * 0.5f + 0.5f) * 0.8f) * projectile.Opacity; + return Color.Lerp(baseColor, Color.LightBlue, ((float)Math.Sin(MathHelper.Pi * completionRatio + Main.GlobalTime * 4f) * 0.5f + 0.5f) * 0.8f) * Projectile.Opacity; } internal float BackgroundWidthFunction(float completionRatio) => WidthFunction(completionRatio) * 4f; internal Color BackgroundColorFunction(float completionRatio) { - Color color = Color.CornflowerBlue * projectile.Opacity * 0.4f; + Color color = Color.CornflowerBlue * Projectile.Opacity * 0.4f; return color; } @@ -235,15 +235,15 @@ namespace CalamityMod.Projectiles.Boss Projectile orbToAttachTo = GetOrbToAttachTo(); if (orbToAttachTo != null) { - List arcPoints = DetermineElectricArcPoints(projectile.Center, orbToAttachTo.Center, 117); + List arcPoints = DetermineElectricArcPoints(Projectile.Center, orbToAttachTo.Center, 117); LightningBackgroundDrawer.Draw(arcPoints, -Main.screenPosition, 90); LightningDrawer.Draw(arcPoints, -Main.screenPosition, 90); } - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -254,7 +254,7 @@ namespace CalamityMod.Projectiles.Boss float _ = 0f; Projectile orbToAttachTo = GetOrbToAttachTo(); - if (orbToAttachTo != null && Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, orbToAttachTo.Center, 8f, ref _)) + if (orbToAttachTo != null && Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, orbToAttachTo.Center, 8f, ref _)) return true; return false; diff --git a/Projectiles/Boss/ArtemisChargeTelegraph.cs b/Projectiles/Boss/ArtemisChargeTelegraph.cs index f0e20c5ab7..4784cf2e46 100644 --- a/Projectiles/Boss/ArtemisChargeTelegraph.cs +++ b/Projectiles/Boss/ArtemisChargeTelegraph.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Boss { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)Projectile.ai[1]) ? Main.npc[(int)Projectile.ai[1]] : null; public Vector2 OldVelocity; public PrimitiveTrail TelegraphDrawer = null; @@ -24,14 +24,14 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 45; + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 45; } public override void SendExtraAI(BinaryWriter writer) @@ -47,35 +47,35 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { // Determine the relative opacities for each player based on their distance. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.netUpdate = true; } // Die if the thing to attach to disappears. if (ThingToAttachTo is null || !ThingToAttachTo.active) { - projectile.Kill(); + Projectile.Kill(); return; } // Set start of telegraph to the npc center. - projectile.Center = ThingToAttachTo.Center + projectile.velocity * 50f; + Projectile.Center = ThingToAttachTo.Center + Projectile.velocity * 50f; // Determine opacity - projectile.Opacity = Utils.InverseLerp(0f, 8f, projectile.timeLeft, true); + Projectile.Opacity = Utils.InverseLerp(0f, 8f, Projectile.timeLeft, true); } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public Color TelegraphPrimitiveColor(float completionRatio) { float colorInterpolant = (completionRatio * 1.2f + Main.GlobalTime * 0.26f) % 1f; - float opacity = MathHelper.Lerp(0.2f, 0.425f, projectile.Opacity) * Utils.InverseLerp(30f, 24f, projectile.timeLeft, true); + float opacity = MathHelper.Lerp(0.2f, 0.425f, Projectile.Opacity) * Utils.InverseLerp(30f, 24f, Projectile.timeLeft, true); return CalamityUtils.MulticolorLerp(colorInterpolant, Color.Orange, Color.Red, Color.Crimson, Color.Red) * opacity; } @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Boss { // Used to determine the degree to which the ends of the telegraph should smoothen away. float endSmoothenFactor = Utils.InverseLerp(1f, 0.995f, completionRatio, true); - return endSmoothenFactor * projectile.Opacity * 22f; + return endSmoothenFactor * Projectile.Opacity * 22f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -95,11 +95,11 @@ namespace CalamityMod.Projectiles.Boss GameShaders.Misc["CalamityMod:Flame"].UseSaturation(0.28f); Vector2[] drawPositions = new Vector2[] { - projectile.Center, - projectile.Center + projectile.velocity.SafeNormalize(Vector2.UnitY) * TelegraphWidth + Projectile.Center, + Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitY) * TelegraphWidth }; - TelegraphDrawer.Draw(drawPositions, projectile.Size * 0.5f - Main.screenPosition, 87); + TelegraphDrawer.Draw(drawPositions, Projectile.Size * 0.5f - Main.screenPosition, 87); return false; } } diff --git a/Projectiles/Boss/ArtemisDeathrayTelegraph.cs b/Projectiles/Boss/ArtemisDeathrayTelegraph.cs index 009d799149..8be70dc861 100644 --- a/Projectiles/Boss/ArtemisDeathrayTelegraph.cs +++ b/Projectiles/Boss/ArtemisDeathrayTelegraph.cs @@ -12,11 +12,11 @@ namespace CalamityMod.Projectiles.Boss public float TelegraphDelay { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } - public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)Projectile.ai[1]) ? Main.npc[(int)Projectile.ai[1]] : null; public Vector2 OldVelocity; public const float TelegraphTotalTime = 60f; @@ -30,14 +30,14 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 60; + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; } public override void SendExtraAI(BinaryWriter writer) @@ -53,29 +53,29 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { // Determine the relative opacities for each player based on their distance. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.netUpdate = true; } // Die if the thing to attach to disappears. if (ThingToAttachTo is null || !ThingToAttachTo.active) { - projectile.Kill(); + Projectile.Kill(); return; } // Set start of telegraph to the npc center. - projectile.Center = ThingToAttachTo.Center + Vector2.Normalize(OldVelocity) * 70f; + Projectile.Center = ThingToAttachTo.Center + Vector2.Normalize(OldVelocity) * 70f; // Be sure to save the velocity the projectile started with. It will be set again when the telegraph is over. if (OldVelocity == Vector2.Zero) { - OldVelocity = projectile.velocity; - projectile.velocity = Vector2.Zero; - projectile.netUpdate = true; - projectile.rotation = OldVelocity.ToRotation() + MathHelper.PiOver2; + OldVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + Projectile.netUpdate = true; + Projectile.rotation = OldVelocity.ToRotation() + MathHelper.PiOver2; } TelegraphDelay++; @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Boss if (TelegraphDelay >= TelegraphTotalTime) return true; - Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + Texture2D laserTelegraph = ModContent.Request("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); float yScale = 2f; if (TelegraphDelay < TelegraphFadeTime) yScale = MathHelper.Lerp(0f, 2f, TelegraphDelay / 15f); @@ -108,8 +108,8 @@ namespace CalamityMod.Projectiles.Boss colorOuter *= 0.7f; colorInner *= 0.7f; - spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, OldVelocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); - spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, OldVelocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorInner, OldVelocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorOuter, OldVelocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Boss/ArtemisLaser.cs b/Projectiles/Boss/ArtemisLaser.cs index ee8073910d..62ab2614aa 100644 --- a/Projectiles/Boss/ArtemisLaser.cs +++ b/Projectiles/Boss/ArtemisLaser.cs @@ -15,13 +15,13 @@ namespace CalamityMod.Projectiles.Boss { public float TelegraphDelay { - get => projectile.localAI[1]; - set => projectile.localAI[1] = value; + get => Projectile.localAI[1]; + set => Projectile.localAI[1] = value; } - public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)Projectile.ai[1]) ? Main.npc[(int)Projectile.ai[1]] : null; - public ref float LaserVelocity => ref projectile.ai[0]; + public ref float LaserVelocity => ref Projectile.ai[0]; public Vector2 Destination; public Vector2 Velocity; @@ -32,21 +32,21 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Exo Pulse Laser"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 22; - projectile.height = 22; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 22; + Projectile.height = 22; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 600; cooldownSlot = 1; } @@ -68,110 +68,110 @@ namespace CalamityMod.Projectiles.Boss { // Determine the relative opacities for each player based on their distance. // This has a lower bound of 0.35 to prevent the laser from going completely invisible and players getting hit by cheap shots. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.netUpdate = true; } - projectile.frameCounter++; - if (projectile.frameCounter > 12) + Projectile.frameCounter++; + if (Projectile.frameCounter > 12) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.6f, 0f, 0f); // Die if the thing to attach to disappears. if (ThingToAttachTo is null || !ThingToAttachTo.active) { - projectile.Kill(); + Projectile.Kill(); return; } // Fade in after telegraphs have faded. if (TelegraphDelay > TelegraphTotalTime) { - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> if (Velocity != Vector2.Zero) { - projectile.extraUpdates = 3; - projectile.velocity = Velocity * ((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 1.25f : 1f); + Projectile.extraUpdates = 3; + Projectile.velocity = Velocity * ((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 1.25f : 1f); Velocity = Vector2.Zero; - projectile.netUpdate = true; + Projectile.netUpdate = true; } // Direction and rotation. - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } } else if (Destination == Vector2.Zero) { // Set start of telegraph to the npc center. - projectile.Center = ThingToAttachTo.Center; + Projectile.Center = ThingToAttachTo.Center; // Set destination of the laser, the target's center. - Destination = projectile.velocity; + Destination = Projectile.velocity; - projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f; + Projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f; // Calculate and store the velocity that will be used for laser telegraph rotation and beam firing. Vector2 projectileDestination = Destination - ThingToAttachTo.Center; Velocity = Vector2.Normalize(projectileDestination) * LaserVelocity; // Set velocity to zero. - projectile.velocity = Vector2.Zero; - projectile.netUpdate = true; + Projectile.velocity = Vector2.Zero; + Projectile.netUpdate = true; // Direction and rotation. - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); } } else { // Set start of telegraph to the npc center. - projectile.Center = ThingToAttachTo.Center; + Projectile.Center = ThingToAttachTo.Center; - projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f; + Projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f; // Calculate and store the velocity that will be used for laser telegraph rotation and beam firing. Vector2 projectileDestination = Destination - ThingToAttachTo.Center; Velocity = Vector2.Normalize(projectileDestination) * LaserVelocity; // Direction and rotation. - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); } } @@ -193,24 +193,24 @@ namespace CalamityMod.Projectiles.Boss public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - return CalamityUtils.CircularHitboxCollision(projHitbox.Center(), projectile.Size.Length() * 0.5f, targetHitbox); + return CalamityUtils.CircularHitboxCollision(projHitbox.Center(), Projectile.Size.Length() * 0.5f, targetHitbox); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { if (TelegraphDelay >= TelegraphTotalTime) { - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - Vector2 drawOffset = projectile.velocity.SafeNormalize(Vector2.Zero) * -30f; - projectile.Center += drawOffset; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); - projectile.Center -= drawOffset; + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + Vector2 drawOffset = Projectile.velocity.SafeNormalize(Vector2.Zero) * -30f; + Projectile.Center += drawOffset; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + Projectile.Center -= drawOffset; return false; } - Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + Texture2D laserTelegraph = ModContent.Request("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); float yScale = 2f; if (TelegraphDelay < TelegraphFadeTime) @@ -228,8 +228,8 @@ namespace CalamityMod.Projectiles.Boss colorOuter *= 0.6f; colorInner *= 0.6f; - spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, Velocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); - spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, Velocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorInner, Velocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorOuter, Velocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Boss/ArtemisLaserBeamStart.cs b/Projectiles/Boss/ArtemisLaserBeamStart.cs index d3a3670c52..e0d08f9096 100644 --- a/Projectiles/Boss/ArtemisLaserBeamStart.cs +++ b/Projectiles/Boss/ArtemisLaserBeamStart.cs @@ -14,50 +14,50 @@ namespace CalamityMod.Projectiles.Boss { public int OwnerIndex { - get => (int)projectile.ai[0]; - set => projectile.ai[0] = value; + get => (int)Projectile.ai[0]; + set => Projectile.ai[0] = value; } public override float MaxScale => 1f; public override float MaxLaserLength => 4800f; public override float Lifetime => 600; public override Color LaserOverlayColor => new Color(250, 180, 100, 100); public override Color LightCastColor => Color.White; - public override Texture2D LaserBeginTexture => Main.projectileTexture[projectile.type]; - public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresLaserBeamMiddle"); - public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresLaserBeamEnd"); + public override Texture2D LaserBeginTexture => Main.projectileTexture[Projectile.type]; + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/AresLaserBeamMiddle"); + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/AresLaserBeamEnd"); public override string Texture => "CalamityMod/Projectiles/Boss/AresLaserBeamStart"; public override void SetStaticDefaults() { DisplayName.SetDefault("Ohio Beam"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; // This is its serious name // DisplayName.SetDefault("Exothermal Artemis Beam"); } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AttachToSomething() @@ -65,21 +65,21 @@ namespace CalamityMod.Projectiles.Boss if (Main.npc[OwnerIndex].active && Main.npc[OwnerIndex].type == ModContent.NPCType()) { Vector2 fireFrom = Main.npc[OwnerIndex].Center + Vector2.UnitY * Main.npc[OwnerIndex].gfxOffY; - fireFrom += projectile.velocity.SafeNormalize(Vector2.UnitY) * 78f; - projectile.Center = fireFrom; + fireFrom += Projectile.velocity.SafeNormalize(Vector2.UnitY) * 78f; + Projectile.Center = fireFrom; } // Die of the owner is invalid in some way. else { - projectile.Kill(); + Projectile.Kill(); return; } // Die if the owner is not performing Artemis' deathray attack. if (Main.npc[OwnerIndex].Calamity().newAI[0] != (float)Artemis.Phase.Deathray) { - projectile.Kill(); + Projectile.Kill(); return; } } @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Boss public override float DetermineLaserLength() { float[] sampledLengths = new float[10]; - Collision.LaserScan(projectile.Center, projectile.velocity, projectile.width * projectile.scale, MaxLaserLength, sampledLengths); + Collision.LaserScan(Projectile.Center, Projectile.velocity, Projectile.width * Projectile.scale, MaxLaserLength, sampledLengths); float newLaserLength = sampledLengths.Average(); @@ -100,48 +100,48 @@ namespace CalamityMod.Projectiles.Boss public override void UpdateLaserMotion() { - projectile.rotation = Main.npc[OwnerIndex].rotation; - projectile.velocity = (projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + Projectile.rotation = Main.npc[OwnerIndex].rotation; + Projectile.velocity = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); } public override void PostAI() { // Determine frames. - projectile.frameCounter++; - if (projectile.frameCounter % 5f == 0f) - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + if (Projectile.frameCounter % 5f == 0f) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { // This should never happen, but just in case. - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) return false; Color beamColor = LaserOverlayColor; - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); // Start texture drawing. spriteBatch.Draw(LaserBeginTexture, - projectile.Center - Main.screenPosition, + Projectile.Center - Main.screenPosition, startFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserBeginTexture.Size() / 2f, - projectile.scale, + Projectile.scale, SpriteEffects.FlipVertically, 0f); // Prepare things for body drawing. float laserBodyLength = LaserLength + middleFrameArea.Height; - Vector2 centerOnLaser = projectile.Center + projectile.velocity * projectile.scale * 5f; + Vector2 centerOnLaser = Projectile.Center + Projectile.velocity * Projectile.scale * 5f; // Body drawing. if (laserBodyLength > 0f) { - float laserOffset = middleFrameArea.Height * projectile.scale; + float laserOffset = middleFrameArea.Height * Projectile.scale; float incrementalBodyLength = 0f; while (incrementalBodyLength + 1f < laserBodyLength) { @@ -149,14 +149,14 @@ namespace CalamityMod.Projectiles.Boss centerOnLaser - Main.screenPosition, middleFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserMiddleTexture.Size() * 0.5f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); incrementalBodyLength += laserOffset; - centerOnLaser += projectile.velocity * laserOffset; - middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[projectile.type]; + centerOnLaser += Projectile.velocity * laserOffset; + middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[Projectile.type]; if (middleFrameArea.Y + middleFrameArea.Height > LaserMiddleTexture.Height) middleFrameArea.Y = 0; } @@ -167,9 +167,9 @@ namespace CalamityMod.Projectiles.Boss laserEndCenter, endFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserEndTexture.Size() * 0.5f, - projectile.scale, + Projectile.scale, SpriteEffects.FlipVertically, 0f); return false; @@ -180,7 +180,7 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(ModContent.BuffType(), 300); } - public override bool CanHitPlayer(Player target) => projectile.scale >= 0.5f; + public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index c74f2d965a..fcef64a445 100644 --- a/Projectiles/Boss/AstralFlame.cs +++ b/Projectiles/Boss/AstralFlame.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class AstralFlame : ModProjectile @@ -13,95 +14,95 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Homing Flame"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 50; - projectile.height = 50; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 100; - projectile.penetrate = 1; - projectile.timeLeft = 485; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 50; + Projectile.height = 50; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 100; + Projectile.penetrate = 1; + Projectile.timeLeft = 485; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } - Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); + Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); - int num103 = Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; + int num103 = Player.FindClosest(Projectile.Center, 1, 1); + Vector2 vector11 = Main.player[num103].Center - Projectile.Center; if (vector11.Length() < 60f) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 15f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 15f) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 0.8f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 0.8f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } - if (projectile.ai[0] >= 120f) + if (Projectile.ai[0] >= 120f) { - if (projectile.ai[1] < 120f) + if (Projectile.ai[1] < 120f) { - if (projectile.ai[1] < 15f) - projectile.velocity *= 1.02f; + if (Projectile.ai[1] < 15f) + Projectile.velocity *= 1.02f; - float scaleFactor2 = projectile.velocity.Length(); + float scaleFactor2 = Projectile.velocity.Length(); vector11.Normalize(); vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 15f + vector11) / 16f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; } - else if (projectile.velocity.Length() < 18f) - projectile.velocity *= 1.01f; + else if (Projectile.velocity.Length() < 18f) + Projectile.velocity *= 1.01f; - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -111,25 +112,25 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 103, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = projectile.height = 96; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Zombie, (int)Projectile.position.X, (int)Projectile.position.Y, 103, 1f, 0f); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 96; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 50, default, 1f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 50, default, 1f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - projectile.Damage(); + Projectile.Damage(); } } } diff --git a/Projectiles/Boss/AstralGodRay.cs b/Projectiles/Boss/AstralGodRay.cs index 7894b91cff..d9c3dbe8b1 100644 --- a/Projectiles/Boss/AstralGodRay.cs +++ b/Projectiles/Boss/AstralGodRay.cs @@ -18,42 +18,42 @@ namespace CalamityMod.Projectiles.Boss // They are extremely carefully chosen and barely work as is! private const float WaveTheta = 0.09f; private const int WaveTwistFrames = 9; - private ref float WaveFrameState => ref projectile.localAI[1]; + private ref float WaveFrameState => ref Projectile.localAI[1]; public override string Texture => "CalamityMod/Projectiles/LaserProj"; public override void SetStaticDefaults() { DisplayName.SetDefault("Astral God Ray"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.MaxUpdates = 1; - projectile.timeLeft = 1200; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 5; + Projectile.height = 5; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 1; + Projectile.timeLeft = 1200; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]); - if (Vector2.Distance(targetLocation, projectile.Center) < 80f) - projectile.tileCollide = true; + Vector2 targetLocation = new Vector2(Projectile.ai[0], Projectile.ai[1]); + if (Vector2.Distance(targetLocation, Projectile.Center) < 80f) + Projectile.tileCollide = true; // Very rapidly fade into existence. - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; float waveSign = WaveFrameState < 0f ? -1f : 1f; @@ -66,10 +66,10 @@ namespace CalamityMod.Projectiles.Boss WaveFrameState = dirToUse * WaveTwistFrames * 0.5f; // Backfill old rotations to prevent visual glitches. - float iterRotation = projectile.velocity.ToRotation(); - for (int i = 0; i < projectile.oldRot.Length; ++i) + float iterRotation = Projectile.velocity.ToRotation(); + for (int i = 0; i < Projectile.oldRot.Length; ++i) { - projectile.oldRot[i] = iterRotation; + Projectile.oldRot[i] = iterRotation; iterRotation += waveSign * WaveTheta; } } @@ -80,28 +80,28 @@ namespace CalamityMod.Projectiles.Boss WaveFrameState += waveSign; // Apply a constant, rapid wave to the laser's motion. - projectile.velocity = projectile.velocity.RotatedBy(waveSign * WaveTheta); - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.velocity = Projectile.velocity.RotatedBy(waveSign * WaveTheta); + Projectile.rotation = Projectile.velocity.ToRotation(); // Emit light. if (WaveFrameState < 0f) - Lighting.AddLight(projectile.Center, 0.87f, 0.65f, 0.1725f); + Lighting.AddLight(Projectile.Center, 0.87f, 0.65f, 0.1725f); else - Lighting.AddLight(projectile.Center, 0.1725f, 0.87f, 0.65f); + Lighting.AddLight(Projectile.Center, 0.1725f, 0.87f, 0.65f); // Laser length shenanigans. If the laser is still growing, increase localAI 0 to indicate it is getting longer. - projectile.localAI[0] += 10f; // LaserLengthChangeRate; + Projectile.localAI[0] += 10f; // LaserLengthChangeRate; // Cap it at max length. - if (projectile.localAI[0] > LaserLength) - projectile.localAI[0] = LaserLength; + if (Projectile.localAI[0] > LaserLength) + Projectile.localAI[0] = LaserLength; // Otherwise it's shrinking. Once it reaches zero length it dies for good. else { - projectile.localAI[0] -= LaserLengthChangeRate; - if (projectile.localAI[0] <= 0f) - projectile.Kill(); + Projectile.localAI[0] -= LaserLengthChangeRate; + if (Projectile.localAI[0] <= 0f) + Projectile.Kill(); } } @@ -113,19 +113,19 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { if (WaveFrameState < 0f) - return new Color(255, 100, 0, projectile.alpha); + return new Color(255, 100, 0, Projectile.alpha); - return new Color(0, 255, 200, projectile.alpha); + return new Color(0, 255, 200, Projectile.alpha); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(LaserLength, 2f, lightColor, curve: true); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(LaserLength, 2f, lightColor, curve: true); public override void Kill(int timeLeft) { int dustID = WaveFrameState < 0f ? ModContent.DustType() : ModContent.DustType(); int dustAmt = 4; - Vector2 dustPos = projectile.Center - projectile.velocity / 2f; - Vector2 dustVel = projectile.velocity / 4f; + Vector2 dustPos = Projectile.Center - Projectile.velocity / 2f; + Vector2 dustVel = Projectile.velocity / 4f; for (int i = 0; i < dustAmt; ++i) { Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f, Scale: 1.5f); diff --git a/Projectiles/Boss/AstralLaser.cs b/Projectiles/Boss/AstralLaser.cs index 2b9a433176..529aca7413 100644 --- a/Projectiles/Boss/AstralLaser.cs +++ b/Projectiles/Boss/AstralLaser.cs @@ -12,78 +12,78 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Laser Volley"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 240; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 240; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 2) - projectile.frame = 0; + if (Projectile.frame > 2) + Projectile.frame = 0; - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } - Lighting.AddLight(projectile.Center, 0.3f, 0.3f, 0f); + Lighting.AddLight(Projectile.Center, 0.3f, 0.3f, 0f); - projectile.ai[0] += 1f; - if (projectile.ai[0] > 9f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 9f) { - if (projectile.alpha > 0) - projectile.alpha -= 5; + if (Projectile.alpha > 0) + Projectile.alpha -= 5; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override bool CanHitPlayer(Player target) => projectile.timeLeft >= 85; + public override bool CanHitPlayer(Player target) => Projectile.timeLeft >= 85; public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(projectile.alpha * (b2 / 255f)); + byte b2 = (byte)(Projectile.timeLeft * 3); + byte a2 = (byte)(Projectile.alpha * (b2 / 255f)); return new Color(b2, b2, b2, a2); } - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.timeLeft >= 85) + if (Projectile.timeLeft >= 85) target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs index cbee93a53e..cedf717625 100644 --- a/Projectiles/Boss/AstralShot2.cs +++ b/Projectiles/Boss/AstralShot2.cs @@ -15,63 +15,63 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Laser"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.extraUpdates = 2; + Projectile.extraUpdates = 2; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; float maxVelocity = malice ? 3.75f : 3f; - if (projectile.velocity.Length() < maxVelocity) + if (Projectile.velocity.Length() < maxVelocity) { - projectile.velocity *= malice ? 1.02f : 1.015f; - if (projectile.velocity.Length() > maxVelocity) + Projectile.velocity *= malice ? 1.02f : 1.015f; + if (Projectile.velocity.Length() > maxVelocity) { - projectile.velocity.Normalize(); - projectile.velocity *= maxVelocity; + Projectile.velocity.Normalize(); + Projectile.velocity *= maxVelocity; } } } else { - Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]); - if (Vector2.Distance(targetLocation, projectile.Center) < 80f) - projectile.tileCollide = true; + Vector2 targetLocation = new Vector2(Projectile.ai[0], Projectile.ai[1]); + if (Vector2.Distance(targetLocation, Projectile.Center) < 80f) + Projectile.tileCollide = true; } - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -81,12 +81,12 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/BigFlare.cs b/Projectiles/Boss/BigFlare.cs index 2ad80a73e5..6e4b4bcde3 100644 --- a/Projectiles/Boss/BigFlare.cs +++ b/Projectiles/Boss/BigFlare.cs @@ -6,6 +6,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -14,120 +15,120 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Big Flare"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 100; - projectile.height = 100; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - projectile.scale = 1.5f; + Projectile.width = 100; + Projectile.height = 100; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 1200; + Projectile.scale = 1.5f; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - int num625 = (int)projectile.ai[1] - 1; + int num625 = (int)Projectile.ai[1] - 1; if (num625 < 255) { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 10f) { int num626 = 6; for (int num627 = 0; num627 < num626; num627++) { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + projectile.Center; + Vector2 vector45 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + Projectile.Center; Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); int num628 = Dust.NewDust(vector45 + value15, 0, 0, 244, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); Main.dust[num628].noGravity = true; Main.dust[num628].noLight = true; Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; + Main.dust[num628].velocity -= Projectile.velocity; } - projectile.alpha -= 5; - if (projectile.alpha < 100) + Projectile.alpha -= 5; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } } - Vector2 value16 = Main.player[num625].Center - projectile.Center; + Vector2 value16 = Main.player[num625].Center - Projectile.Center; float num629 = 4f; - num629 += projectile.localAI[0] / 60f; - projectile.velocity = Vector2.Normalize(value16) * num629; + num629 += Projectile.localAI[0] / 60f; + Projectile.velocity = Vector2.Normalize(value16) * num629; if (value16.Length() < 64f) { - projectile.Kill(); + Projectile.Kill(); } } } - if (projectile.wet) + if (Projectile.wet) { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); + Projectile.position.Y = Projectile.position.Y - 16f; + Projectile.Kill(); } } public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 53, projectile.alpha); + return new Color(255, Main.DiscoG, 53, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 20); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 20); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); + int num231 = (int)(Projectile.Center.Y / 16f); + int num232 = (int)(Projectile.Center.X / 16f); int num233 = 100; if (num232 < 10) { @@ -149,13 +150,13 @@ namespace CalamityMod.Projectiles.Boss for (int num234 = num231; num234 < num231 + spawnAreaY; num234++) { Tile tile = Main.tile[num232, num234 + 10]; - if (tile.active() && !TileID.Sets.Platforms[tile.type] && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + if (tile.active() && !TileID.Sets.Platforms[tile.TileType] && (Main.tileSolid[(int)tile.TileType] || tile.liquid != 0)) { num231 = num234; break; } } - int spawnLimitY = (int)(Main.player[projectile.owner].Center.Y / 16f) + 50; + int spawnLimitY = (int)(Main.player[Projectile.owner].Center.Y / 16f) + 50; if (num231 > spawnLimitY) { num231 = spawnLimitY; diff --git a/Projectiles/Boss/BigFlare2.cs b/Projectiles/Boss/BigFlare2.cs index f60cfe62e7..7406dbeffc 100644 --- a/Projectiles/Boss/BigFlare2.cs +++ b/Projectiles/Boss/BigFlare2.cs @@ -6,6 +6,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -14,120 +15,120 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Big Flare"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 100; - projectile.height = 100; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - projectile.scale = 1.5f; + Projectile.width = 100; + Projectile.height = 100; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 1200; + Projectile.scale = 1.5f; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - int num625 = (int)projectile.ai[1] - 1; + int num625 = (int)Projectile.ai[1] - 1; if (num625 < 255) { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 10f) { int num626 = 6; for (int num627 = 0; num627 < num626; num627++) { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + projectile.Center; + Vector2 vector45 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + Projectile.Center; Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); int num628 = Dust.NewDust(vector45 + value15, 0, 0, 244, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); Main.dust[num628].noGravity = true; Main.dust[num628].noLight = true; Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; + Main.dust[num628].velocity -= Projectile.velocity; } - projectile.alpha -= 5; - if (projectile.alpha < 100) + Projectile.alpha -= 5; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } } - Vector2 value16 = Main.player[num625].Center - projectile.Center; + Vector2 value16 = Main.player[num625].Center - Projectile.Center; float num629 = 4f; - num629 += projectile.localAI[0] / 60f; - projectile.velocity = Vector2.Normalize(value16) * num629; + num629 += Projectile.localAI[0] / 60f; + Projectile.velocity = Vector2.Normalize(value16) * num629; if (value16.Length() < 64f) { - projectile.Kill(); + Projectile.Kill(); } } } - if (projectile.wet) + if (Projectile.wet) { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); + Projectile.position.Y = Projectile.position.Y - 16f; + Projectile.Kill(); } } public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 53, projectile.alpha); + return new Color(255, Main.DiscoG, 53, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 20); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 20); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); + int num231 = (int)(Projectile.Center.Y / 16f); + int num232 = (int)(Projectile.Center.X / 16f); int num233 = 100; if (num232 < 10) { @@ -149,13 +150,13 @@ namespace CalamityMod.Projectiles.Boss for (int num234 = num231; num234 < num231 + spawnAreaY; num234++) { Tile tile = Main.tile[num232, num234 + 10]; - if (tile.active() && !TileID.Sets.Platforms[tile.type] && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + if (tile.active() && !TileID.Sets.Platforms[tile.TileType] && (Main.tileSolid[(int)tile.TileType] || tile.liquid != 0)) { num231 = num234; break; } } - int spawnLimitY = (int)(Main.player[projectile.owner].Center.Y / 16f) + 75; + int spawnLimitY = (int)(Main.player[Projectile.owner].Center.Y / 16f) + 75; if (num231 > spawnLimitY) { num231 = spawnLimitY; diff --git a/Projectiles/Boss/BirbAura.cs b/Projectiles/Boss/BirbAura.cs index 024458849d..cfd43c74a7 100644 --- a/Projectiles/Boss/BirbAura.cs +++ b/Projectiles/Boss/BirbAura.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.Enums; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class BirbAura : ModProjectile @@ -19,27 +20,27 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 80; - projectile.height = 80; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 1200; + Projectile.width = 80; + Projectile.height = 80; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 1200; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); writer.Write(timer); writer.Write(timeBeforeVanish); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); timer = reader.ReadSingle(); timeBeforeVanish = reader.ReadSingle(); } @@ -48,47 +49,47 @@ namespace CalamityMod.Projectiles.Boss { Vector2? vector78 = null; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - projectile.velocity = -Vector2.UnitY; + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) + Projectile.velocity = -Vector2.UnitY; - Vector2 fireFrom = new Vector2(projectile.ai[0], projectile.ai[1]); - projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; + Vector2 fireFrom = new Vector2(Projectile.ai[0], Projectile.ai[1]); + Projectile.position = fireFrom - new Vector2(Projectile.width, Projectile.height) / 2f; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - projectile.velocity = -Vector2.UnitY; + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) + Projectile.velocity = -Vector2.UnitY; if (timer > 0f) timer -= 1f; float num801 = 1f; if (timeBeforeVanish == 0f) - timeBeforeVanish = projectile.timeLeft <= 900 ? 900f : 1200f; + timeBeforeVanish = Projectile.timeLeft <= 900 ? 900f : 1200f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= timeBeforeVanish) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= timeBeforeVanish) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.scale = (float)Math.Sin(projectile.localAI[0] * Math.PI / timeBeforeVanish) * 10f * num801; - if (projectile.scale > num801) - projectile.scale = num801; + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * Math.PI / timeBeforeVanish) * 10f * num801; + if (Projectile.scale > num801) + Projectile.scale = num801; - float num804 = projectile.velocity.ToRotation(); - projectile.rotation = num804 - MathHelper.PiOver2; - projectile.velocity = num804.ToRotationVector2(); + float num804 = Projectile.velocity.ToRotation(); + Projectile.rotation = num804 - MathHelper.PiOver2; + Projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; //3f - float num806 = projectile.width; + float num806 = Projectile.width; - Vector2 samplingPoint = projectile.Center; + Vector2 samplingPoint = Projectile.Center; if (vector78.HasValue) samplingPoint = vector78.Value; - float laserLength = projectile.ai[1] - 160f; + float laserLength = Projectile.ai[1] - 160f; float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, laserLength, array3); + Collision.LaserScan(samplingPoint, Projectile.velocity, num806 * Projectile.scale, laserLength, array3); float num807 = 0f; for (int num808 = 0; num808 < array3.Length; num808++) { @@ -99,46 +100,46 @@ namespace CalamityMod.Projectiles.Boss num807 = MathHelper.Clamp(num807, 3600f, 4800f); float amount = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - if (timer <= 0f && (projectile.localAI[0] >= 120f || projectile.timeLeft <= 900)) + if (timer <= 0f && (Projectile.localAI[0] >= 120f || Projectile.timeLeft <= 900)) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { timer = 15f; Vector2 fireFrom = new Vector2(target.Center.X, target.Center.Y - 900f); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)target.Center.X, (int)target.Center.Y - 300); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)target.Center.X, (int)target.Center.Y - 300); Vector2 ai0 = target.Center - fireFrom; float ai = Main.rand.Next(100); Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, 0f, projectile.owner, ai0.ToRotation(), ai); + Projectile.NewProjectile(fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, 0f, Projectile.owner, ai0.ToRotation(), ai); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) { return false; } - Texture2D texture = Main.projectileTexture[projectile.type]; - Texture2D texture2 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/BirbAuraStart"); - Texture2D texture3 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/BirbAuraEnd"); - float num223 = projectile.localAI[1]; //length of laser + Texture2D texture = Main.projectileTexture[Projectile.type]; + Texture2D texture2 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BirbAuraStart"); + Texture2D texture3 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BirbAuraEnd"); + float num223 = Projectile.localAI[1]; //length of laser Color color44 = new Color(128, 128, 128, 0); - Vector2 vector = projectile.Center - Main.screenPosition; + Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; - spriteBatch.Draw(texture2, vector, sourceRectangle2, color44, projectile.rotation, texture2.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - num223 -= (texture2.Height / 2 + texture3.Height) * projectile.scale; - Vector2 value20 = projectile.Center; - value20 += projectile.velocity * projectile.scale * texture2.Height / 2f; + spriteBatch.Draw(texture2, vector, sourceRectangle2, color44, Projectile.rotation, texture2.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); + num223 -= (texture2.Height / 2 + texture3.Height) * Projectile.scale; + Vector2 value20 = Projectile.Center; + value20 += Projectile.velocity * Projectile.scale * texture2.Height / 2f; if (num223 > 0f) { float num224 = 0f; @@ -149,9 +150,9 @@ namespace CalamityMod.Projectiles.Boss { rectangle7.Height = (int)(num223 - num224); } - spriteBatch.Draw(texture, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f); - num224 += rectangle7.Height * projectile.scale; - value20 += projectile.velocity * rectangle7.Height * projectile.scale; + spriteBatch.Draw(texture, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, Projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0f); + num224 += rectangle7.Height * Projectile.scale; + value20 += Projectile.velocity * rectangle7.Height * Projectile.scale; rectangle7.Y += texture.Height; if (rectangle7.Y + rectangle7.Height > texture.Height) { @@ -161,15 +162,15 @@ namespace CalamityMod.Projectiles.Boss } Vector2 vector2 = value20 - Main.screenPosition; sourceRectangle2 = null; - spriteBatch.Draw(texture3, vector2, sourceRectangle2, color44, projectile.rotation, texture3.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture3, vector2, sourceRectangle2, color44, Projectile.rotation, texture3.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -183,7 +184,7 @@ namespace CalamityMod.Projectiles.Boss return true; } float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 80f * projectile.scale, ref num6)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 80f * Projectile.scale, ref num6)) { return true; } diff --git a/Projectiles/Boss/BirbAuraFlare.cs b/Projectiles/Boss/BirbAuraFlare.cs index 7e499efae3..7a1a71911d 100644 --- a/Projectiles/Boss/BirbAuraFlare.cs +++ b/Projectiles/Boss/BirbAuraFlare.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -19,61 +20,61 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 1200; + Projectile.width = 32; + Projectile.height = 32; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 1200; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - int num625 = (int)projectile.ai[1] - 1; + int num625 = (int)Projectile.ai[1] - 1; if (num625 < 255) { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 10f) { // Dust pulse effect - projectile.localAI[1] = (float)Math.Abs(Math.Cos(MathHelper.ToRadians(projectile.localAI[0] * 2f))); + Projectile.localAI[1] = (float)Math.Abs(Math.Cos(MathHelper.ToRadians(Projectile.localAI[0] * 2f))); int num626 = 18; for (int num627 = 0; num627 < num626; num627++) { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2(projectile.width / 2f, projectile.height) * projectile.localAI[1]; - vector45 = vector45.RotatedBy((num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (float)num626) + projectile.Center; + Vector2 vector45 = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * Projectile.localAI[1]; + vector45 = vector45.RotatedBy((num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (float)num626) + Projectile.Center; Vector2 value15 = ((float)(Main.rand.NextDouble() * Math.PI) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num628 = Dust.NewDust(vector45 + value15, 0, 0, 60, value15.X * 2f, value15.Y * 2f, 100, default, 1f); Main.dust[num628].scale = 1.4f; Main.dust[num628].noGravity = true; Main.dust[num628].noLight = true; Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; + Main.dust[num628].velocity -= Projectile.velocity; } } - Vector2 value16 = Main.player[num625].Center - projectile.Center; + Vector2 value16 = Main.player[num625].Center - Projectile.Center; float num629 = 4f; - float divisor = 60f - 15f * projectile.ai[0]; - num629 += projectile.localAI[0] / divisor; - projectile.velocity = Vector2.Normalize(value16) * num629; + float divisor = 60f - 15f * Projectile.ai[0]; + num629 += Projectile.localAI[0] / divisor; + Projectile.velocity = Vector2.Normalize(value16) * num629; if (value16.Length() < 32f) { - projectile.Kill(); + Projectile.Kill(); } } } @@ -81,22 +82,22 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.DD2_BetsyFireballImpact, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, (int)Projectile.position.X, (int)Projectile.position.Y); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2(projectile.width / 2f, projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / num226) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / num226) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 60, vector7.X, vector7.Y, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); + int num231 = (int)(Projectile.Center.Y / 16f); + int num232 = (int)(Projectile.Center.X / 16f); int num233 = 100; if (num232 < 10) { @@ -118,8 +119,8 @@ namespace CalamityMod.Projectiles.Boss float y = num231 * 16 + 900; Vector2 laserVelocity = new Vector2(x, 160f) - new Vector2(x, y); int type = ModContent.ProjectileType(); - int damage = projectile.GetProjectileDamage(ModContent.NPCType()); - if (projectile.ai[0] >= 2f) + int damage = Projectile.GetProjectileDamage(ModContent.NPCType()); + if (Projectile.ai[0] >= 2f) { x += 1000f; if ((int)(x / 16f) > Main.maxTilesX - 10) diff --git a/Projectiles/Boss/BloodGeyser.cs b/Projectiles/Boss/BloodGeyser.cs index 5c4b403a95..9385b65900 100644 --- a/Projectiles/Boss/BloodGeyser.cs +++ b/Projectiles/Boss/BloodGeyser.cs @@ -15,27 +15,27 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.timeLeft = 420; - projectile.penetrate = 1; + Projectile.width = 12; + Projectile.height = 12; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 420; + Projectile.penetrate = 1; } public override void AI() { - if (projectile.position.Y > projectile.ai[1]) - projectile.tileCollide = true; + if (Projectile.position.Y > Projectile.ai[1]) + Projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.Blood, 0f, 0f, 100, default, 0.5f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 0.5f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - projectile.velocity.Y += 0.06f; - projectile.velocity.X *= 0.995f; + Projectile.velocity.Y += 0.06f; + Projectile.velocity.X *= 0.995f; } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(250, 50, 50, projectile.alpha); + return new Color(250, 50, 50, Projectile.alpha); } } } diff --git a/Projectiles/Boss/BrimstoneBall.cs b/Projectiles/Boss/BrimstoneBall.cs index 6e52b6279d..fe32c26c7e 100644 --- a/Projectiles/Boss/BrimstoneBall.cs +++ b/Projectiles/Boss/BrimstoneBall.cs @@ -14,24 +14,24 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.hostile = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - projectile.rotation += 0.12f * projectile.direction; + Projectile.rotation += 0.12f * Projectile.direction; - Lighting.AddLight(projectile.Center, 0.25f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0f); for (int num468 = 0; num468 < 2; num468++) { - Vector2 dspeed = -projectile.velocity * 0.7f; - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 150, default, 1.1f); + Vector2 dspeed = -Projectile.velocity * 0.7f; + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 150, default, 1.1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity = dspeed; } diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index c70da72c51..f67aea2314 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -16,88 +16,88 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Dart"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 690; + Projectile.width = 18; + Projectile.height = 18; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 690; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; - if (projectile.velocity.Length() < (projectile.ai[1] == 0f ? (malice ? 17.5f : 14f) : (malice ? 12.5f : 10f))) - projectile.velocity *= malice ? 1.0125f : 1.01f; + if (Projectile.velocity.Length() < (Projectile.ai[1] == 0f ? (malice ? 17.5f : 14f) : (malice ? 12.5f : 10f))) + Projectile.velocity *= malice ? 1.0125f : 1.01f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - if (projectile.timeLeft < 60) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); + if (Projectile.timeLeft < 60) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - if (projectile.timeLeft > 570) + if (Projectile.timeLeft > 570) { - int player = Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector = Main.player[player].Center - projectile.Center; - float scaleFactor = projectile.velocity.Length(); + int player = Player.FindClosest(Projectile.Center, 1, 1); + Vector2 vector = Main.player[player].Center - Projectile.Center; + float scaleFactor = Projectile.velocity.Length(); vector.Normalize(); vector *= scaleFactor; - projectile.velocity = (projectile.velocity * 15f + vector) / 16f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor; + Projectile.velocity = (Projectile.velocity * 15f + vector) / 16f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor; } } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; - if (projectile.ai[0] == 0f) - projectile.damage = NPC.AnyNPCs(ModContent.NPCType()) ? projectile.GetProjectileDamage(ModContent.NPCType()) : projectile.GetProjectileDamage(ModContent.NPCType()); + if (Projectile.ai[0] == 0f) + Projectile.damage = NPC.AnyNPCs(ModContent.NPCType()) ? Projectile.GetProjectileDamage(ModContent.NPCType()) : Projectile.GetProjectileDamage(ModContent.NPCType()); } - Lighting.AddLight(projectile.Center, 0.75f * projectile.Opacity, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.75f * Projectile.Opacity, 0f, 0f); } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 120); @@ -108,8 +108,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/BrimstoneFire.cs b/Projectiles/Boss/BrimstoneFire.cs index 1189de8ba5..5a97d54c76 100644 --- a/Projectiles/Boss/BrimstoneFire.cs +++ b/Projectiles/Boss/BrimstoneFire.cs @@ -15,39 +15,39 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 6; + Projectile.height = 6; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 90; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.3f, 0f, 0f); - if (projectile.ai[0] > 7f) + Lighting.AddLight(Projectile.Center, 0.3f, 0f, 0f); + if (Projectile.ai[0] > 7f) { float scalar = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { scalar = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { scalar = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { scalar = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int dustType = (int)CalamityDusts.Brimstone; if (Main.rand.NextBool(2)) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 100, default, 1f); Dust dust = Main.dust[fire]; if (Main.rand.NextBool(3)) { @@ -67,9 +67,9 @@ namespace CalamityMod.Projectiles.Boss } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Boss/BrimstoneFireblast.cs b/Projectiles/Boss/BrimstoneFireblast.cs index 2db0c21062..2d9a1000c5 100644 --- a/Projectiles/Boss/BrimstoneFireblast.cs +++ b/Projectiles/Boss/BrimstoneFireblast.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -14,73 +15,73 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Gigablast"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 50; - projectile.height = 50; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.Opacity = 0f; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 50; + Projectile.height = 50; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.Opacity = 0f; cooldownSlot = 1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) - projectile.frame = 0; + if (Projectile.frame > 5) + Projectile.frame = 0; - if (projectile.ai[1] == 1f) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); + if (Projectile.ai[1] == 1f) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 60) / 60f), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 60) / 60f), 0f, 1f); - Lighting.AddLight(projectile.Center, 0.9f * projectile.Opacity, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.9f * Projectile.Opacity, 0f, 0f); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); + Projectile.localAI[0] = 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); } - int target = Player.FindClosest(projectile.Center, 1, 1); - float projSpeed = projectile.velocity.Length(); - Vector2 playerVec = Main.player[target].Center - projectile.Center; + int target = Player.FindClosest(Projectile.Center, 1, 1); + float projSpeed = Projectile.velocity.Length(); + Vector2 playerVec = Main.player[target].Center - Projectile.Center; playerVec.Normalize(); playerVec *= projSpeed; - projectile.velocity = (projectile.velocity * 24f + playerVec) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= projSpeed; + Projectile.velocity = (Projectile.velocity * 24f + playerVec) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= projSpeed; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int drawStart = frameHeight * projectile.frame; - lightColor.R = (byte)(255 * projectile.Opacity); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = frameHeight * Projectile.frame; + lightColor.R = (byte)(255 * Projectile.Opacity); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; target.AddBuff(ModContent.BuffType(), 240); @@ -89,35 +90,35 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneGigablastImpact"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneGigablastImpact"), Projectile.Center); - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { float spread = 12f * MathHelper.PiOver2 * 0.01f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 30f; double offsetAngle; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 30; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f); } } } for (int j = 0; j < 2; j++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); } for (int k = 0; k < 20; k++) { - int redFire = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.5f); + int redFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.5f); Main.dust[redFire].noGravity = true; Main.dust[redFire].velocity *= 3f; - redFire = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); + redFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); Main.dust[redFire].velocity *= 2f; Main.dust[redFire].noGravity = true; } diff --git a/Projectiles/Boss/BrimstoneGigaBlast.cs b/Projectiles/Boss/BrimstoneGigaBlast.cs index 42e38f1086..e62098ac70 100644 --- a/Projectiles/Boss/BrimstoneGigaBlast.cs +++ b/Projectiles/Boss/BrimstoneGigaBlast.cs @@ -8,6 +8,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -16,87 +17,87 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Fireblast"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 36; - projectile.height = 36; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.Opacity = 0f; - projectile.timeLeft = 150; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 36; + Projectile.height = 36; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.Opacity = 0f; + Projectile.timeLeft = 150; cooldownSlot = 1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 5) - projectile.frame = 0; + if (Projectile.frame >= 5) + Projectile.frame = 0; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - Lighting.AddLight(projectile.Center, 0.9f * projectile.Opacity, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.9f * Projectile.Opacity, 0f, 0f); - if (projectile.ai[1] == 1f) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); + if (Projectile.ai[1] == 1f) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 90) / 60f), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 90) / 60f), 0f, 1f); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); + Projectile.localAI[0] = 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); } float inertia = revenge ? 80f : 100f; float homeSpeed = revenge ? 20f : 15f; float minDist = 40f; - int target = (int)projectile.ai[0]; + int target = (int)Projectile.ai[0]; if (target >= 0 && Main.player[target].active && !Main.player[target].dead) { - if (projectile.Distance(Main.player[target].Center) > minDist) + if (Projectile.Distance(Main.player[target].Center) > minDist) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[target].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * homeSpeed) / inertia; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[target].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * homeSpeed) / inertia; } } else { - if (projectile.ai[0] != -1f) + if (Projectile.ai[0] != -1f) { - projectile.ai[0] = -1f; - projectile.netUpdate = true; + Projectile.ai[0] = -1f; + Projectile.netUpdate = true; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int drawStart = frameHeight * projectile.frame; - lightColor.R = (byte)(255 * projectile.Opacity); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = frameHeight * Projectile.frame; + lightColor.R = (byte)(255 * Projectile.Opacity); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; target.AddBuff(ModContent.BuffType(), 240); @@ -105,32 +106,32 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneFireblastImpact"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneFireblastImpact"), Projectile.Center); - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { float spread = 45f * MathHelper.PiOver2 * 0.01f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 8; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 7f), (float)(Math.Cos(offsetAngle) * 7f), ModContent.ProjectileType(), (int)Math.Round(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 1f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 7f), (float)(-Math.Cos(offsetAngle) * 7f), ModContent.ProjectileType(), (int)Math.Round(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 1f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 7f), (float)(Math.Cos(offsetAngle) * 7f), ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 1f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 7f), (float)(-Math.Cos(offsetAngle) * 7f), ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 1f); } } } - Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); for (int j = 0; j < 10; j++) { - int redFire = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.5f); + int redFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.5f); Main.dust[redFire].noGravity = true; Main.dust[redFire].velocity *= 3f; - redFire = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); + redFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); Main.dust[redFire].velocity *= 2f; Main.dust[redFire].noGravity = true; } diff --git a/Projectiles/Boss/BrimstoneHellblast.cs b/Projectiles/Boss/BrimstoneHellblast.cs index dea8ba0639..2ecb15a9fd 100644 --- a/Projectiles/Boss/BrimstoneHellblast.cs +++ b/Projectiles/Boss/BrimstoneHellblast.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -14,76 +15,76 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Hellblast"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 40; - projectile.height = 40; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 255; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 40; + Projectile.height = 40; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 255; cooldownSlot = 1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter >= 10) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 10) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - Lighting.AddLight(projectile.Center, 0.9f * projectile.Opacity, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.9f * Projectile.Opacity, 0f, 0f); - if (projectile.timeLeft < 51) - projectile.Opacity -= 0.02f; + if (Projectile.timeLeft < 51) + Projectile.Opacity -= 0.02f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); } - if (projectile.velocity.Length() < 18f) - projectile.velocity *= 1.03f; + if (Projectile.velocity.Length() < 18f) + Projectile.velocity *= 1.03f; - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2(-projectile.velocity.Y, -projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2(-Projectile.velocity.Y, -Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override bool CanHitPlayer(Player target) => projectile.timeLeft >= 51; + public override bool CanHitPlayer(Player target) => Projectile.timeLeft >= 51; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.timeLeft < 51) + if (Projectile.timeLeft < 51) return; - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 120); @@ -94,10 +95,10 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); for (int dust = 0; dust <= 5; dust++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f); } } diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index be62921dde..2b7ff17e64 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -14,80 +14,80 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Hellblast"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 40; - projectile.height = 40; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.penetrate = -1; - projectile.timeLeft = 1500; - projectile.Opacity = 0f; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 40; + Projectile.height = 40; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; + Projectile.penetrate = -1; + Projectile.timeLeft = 1500; + Projectile.Opacity = 0f; cooldownSlot = 1; } public override void AI() { // Cal Clone bullet hell projectiles accelerate after a certain time has passed - if (projectile.ai[0] == 2f && Main.expertMode && projectile.timeLeft < 1260) + if (Projectile.ai[0] == 2f && Main.expertMode && Projectile.timeLeft < 1260) { - if (projectile.velocity.Length() < ((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 10f : 8f)) - projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() < ((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 10f : 8f)) + Projectile.velocity *= 1.01f; } - projectile.frameCounter++; - if (projectile.frameCounter >= 10) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 10) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - if (projectile.timeLeft < 60) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); + if (Projectile.timeLeft < 60) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 1440) / 60f), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 1440) / 60f), 0f, 1f); - Lighting.AddLight(projectile.Center, 0.9f * projectile.Opacity, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.9f * Projectile.Opacity, 0f, 0f); - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2(-projectile.velocity.Y, -projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2(-Projectile.velocity.Y, -Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int drawStart = frameHeight * projectile.frame; - lightColor.R = (byte)(255 * projectile.Opacity); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = frameHeight * Projectile.frame; + lightColor.R = (byte)(255 * Projectile.Opacity); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, spriteEffects, 0f); return false; } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index de1c0c3afa..4b17b33280 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class BrimstoneHellfireball : ModProjectile @@ -12,89 +13,89 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Hellfireball"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 34; - projectile.height = 34; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.alpha = 255; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 34; + Projectile.height = 34; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.alpha = 255; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { // Animation - projectile.frameCounter++; - if (projectile.frameCounter > 9) + Projectile.frameCounter++; + if (Projectile.frameCounter > 9) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 6) - projectile.frame = 0; + if (Projectile.frame >= 6) + Projectile.frame = 0; // Fade in - if (projectile.alpha > 5) - projectile.alpha -= 15; - if (projectile.alpha < 5) - projectile.alpha = 5; + if (Projectile.alpha > 5) + Projectile.alpha -= 15; + if (Projectile.alpha < 5) + Projectile.alpha = 5; - if (projectile.ai[0] != 0f && projectile.ai[1] != 0f) + if (Projectile.ai[0] != 0f && Projectile.ai[1] != 0f) { bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) flag15 = true; - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) flag15 = true; - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) flag16 = true; - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) flag16 = true; if (flag15 & flag16) - projectile.Kill(); + Projectile.Kill(); } // Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90f) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90f) * Projectile.direction; - if (projectile.velocity.Length() < 16f) - projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() < 16f) + Projectile.velocity *= 1.01f; - Lighting.AddLight(projectile.Center, 0.5f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0f, 0f); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); + Projectile.localAI[0] += 1f; } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } public override Color? GetAlpha(Color lightColor) { - return new Color(250, 50, 50, projectile.alpha); + return new Color(250, 50, 50, Projectile.alpha); } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -104,7 +105,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 6ccca78a49..819349d68e 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.IO; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class BrimstoneMonster : ModProjectile @@ -23,30 +24,30 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 320; - projectile.height = 320; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.hide = true; - projectile.penetrate = -1; - projectile.timeLeft = 36000; - projectile.Opacity = 0f; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 320; + Projectile.height = 320; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.hide = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 36000; + Projectile.Opacity = 0f; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(speedAdd); - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); writer.Write(speedLimit); } public override void ReceiveExtraAI(BinaryReader reader) { speedAdd = reader.ReadSingle(); - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); speedLimit = reader.ReadSingle(); } @@ -54,17 +55,17 @@ namespace CalamityMod.Projectiles.Boss { if (!CalamityPlayer.areThereAnyDamnBosses) { - projectile.active = false; - projectile.netUpdate = true; + Projectile.active = false; + Projectile.netUpdate = true; return; } - int choice = (int)projectile.ai[1]; - if (projectile.localAI[0] == 0f) + int choice = (int)Projectile.ai[1]; + if (Projectile.localAI[0] == 0f) { - projectile.soundDelay = 1125 - (choice * 225); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BrimstoneMonsterSpawn"), projectile.Center); - projectile.localAI[0] += 1f; + Projectile.soundDelay = 1125 - (choice * 225); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BrimstoneMonsterSpawn"), Projectile.Center); + Projectile.localAI[0] += 1f; switch (choice) { case 0: @@ -87,16 +88,16 @@ namespace CalamityMod.Projectiles.Boss if (speedAdd < speedLimit) speedAdd += 0.04f; - if (projectile.soundDelay <= 0 && (choice == 0 || choice == 2)) + if (Projectile.soundDelay <= 0 && (choice == 0 || choice == 2)) { - projectile.soundDelay = 420; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BrimstoneMonsterDrone"), projectile.Center); + Projectile.soundDelay = 420; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BrimstoneMonsterDrone"), Projectile.Center); } bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - Lighting.AddLight(projectile.Center, 3f * projectile.Opacity, 0f, 0f); + Lighting.AddLight(Projectile.Center, 3f * Projectile.Opacity, 0f, 0f); float inertia = (revenge ? 4.5f : 5f) + speedAdd; float speed = (revenge ? 1.5f : 1.35f) + (speedAdd * 0.25f); @@ -108,24 +109,24 @@ namespace CalamityMod.Projectiles.Boss speed *= 0.5f; } - if (projectile.timeLeft < 90) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 90f, 0f, 1f); + if (Projectile.timeLeft < 90) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 90f, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 35910) / 90f), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 35910) / 90f), 0f, 1f); - int target = (int)projectile.ai[0]; + int target = (int)Projectile.ai[0]; if (target >= 0 && Main.player[target].active && !Main.player[target].dead) { - if (projectile.Distance(Main.player[target].Center) > minDist) + if (Projectile.Distance(Main.player[target].Center) > minDist) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[target].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * speed) / inertia; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[target].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * speed) / inertia; } } else { - projectile.ai[0] = Player.FindClosest(projectile.Center, 1, 1); - projectile.netUpdate = true; + Projectile.ai[0] = Player.FindClosest(Projectile.Center, 1, 1); + Projectile.netUpdate = true; } if (death) @@ -137,42 +138,42 @@ namespace CalamityMod.Projectiles.Boss { Projectile otherProj = Main.projectile[k]; // Short circuits to make the loop as fast as possible - if (!otherProj.active || k == projectile.whoAmI) + if (!otherProj.active || k == Projectile.whoAmI) continue; // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. - bool sameProjType = otherProj.type == projectile.type; - float taxicabDist = Vector2.Distance(projectile.Center, otherProj.Center); + bool sameProjType = otherProj.type == Projectile.type; + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); if (sameProjType && taxicabDist < 320f) { - if (projectile.position.X < otherProj.position.X) - projectile.velocity.X -= pushForce; + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; else - projectile.velocity.X += pushForce; + Projectile.velocity.X += pushForce; - if (projectile.position.Y < otherProj.position.Y) - projectile.velocity.Y -= pushForce; + if (Projectile.position.Y < otherProj.position.Y) + Projectile.velocity.Y -= pushForce; else - projectile.velocity.Y += pushForce; + Projectile.velocity.Y += pushForce; } } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 170f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 170f, targetHitbox); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - lightColor.R = (byte)(255 * projectile.Opacity); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + lightColor.R = (byte)(255 * Projectile.Opacity); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; target.AddBuff(ModContent.BuffType(), 900); diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index b3aebb5516..4553a66f73 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -21,75 +21,75 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { Vector2? vector78 = null; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - projectile.velocity = -Vector2.UnitY; + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) + Projectile.velocity = -Vector2.UnitY; - if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType()) + if (Main.npc[(int)Projectile.ai[1]].active && Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType()) { - Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X + (Main.npc[(int)projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)projectile.ai[1]].Center.Y - 74f); - projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; + Vector2 fireFrom = new Vector2(Main.npc[(int)Projectile.ai[1]].Center.X + (Main.npc[(int)Projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)Projectile.ai[1]].Center.Y - 74f); + Projectile.position = fireFrom - new Vector2(Projectile.width, Projectile.height) / 2f; } else - projectile.Kill(); + Projectile.Kill(); float num801 = 1f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 45f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 45f) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.scale = (float)Math.Sin(projectile.localAI[0] * (float)Math.PI / 45f) * 10f * num801; - if (projectile.scale > num801) - projectile.scale = num801; + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * (float)Math.PI / 45f) * 10f * num801; + if (Projectile.scale > num801) + Projectile.scale = num801; - float num804 = projectile.velocity.ToRotation(); + float num804 = Projectile.velocity.ToRotation(); // Rotating beam for test AI - if (projectile.ai[0] > 0f) - num804 += Main.npc[(int)projectile.ai[1]].spriteDirection * MathHelper.TwoPi / 360f; + if (Projectile.ai[0] > 0f) + num804 += Main.npc[(int)Projectile.ai[1]].spriteDirection * MathHelper.TwoPi / 360f; - projectile.rotation = num804 - MathHelper.PiOver2; - projectile.velocity = num804.ToRotationVector2(); + Projectile.rotation = num804 - MathHelper.PiOver2; + Projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; //3f - float num806 = projectile.width; + float num806 = Projectile.width; - Vector2 samplingPoint = projectile.Center; + Vector2 samplingPoint = Projectile.Center; if (vector78.HasValue) { samplingPoint = vector78.Value; } float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); + Collision.LaserScan(samplingPoint, Projectile.velocity, num806 * Projectile.scale, 2400f, array3); float num807 = 0f; for (int num808 = 0; num808 < array3.Length; num808++) { @@ -98,34 +98,34 @@ namespace CalamityMod.Projectiles.Boss num807 /= num805; // Fire laser through walls at max length if target cannot be seen - if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1)) + if (!Collision.CanHitLine(Main.npc[(int)Projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)Projectile.ai[1]].target].Center, 1, 1)) { num807 = 2400f; } float amount = 0.5f; //0.5f - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation - Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); //length of laser, linear interpolation + Vector2 vector79 = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); // Fire brimstone darts along the laser bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; - if (Main.npc[(int)projectile.ai[1]].ai[1] == 210f && projectile.owner == Main.myPlayer) + if (Main.npc[(int)Projectile.ai[1]].ai[1] == 210f && Projectile.owner == Main.myPlayer) { - Vector2 velocity = projectile.velocity; + Vector2 velocity = Projectile.velocity; velocity.Normalize(); float distanceBetweenProjectiles = malice ? 72f : 144f; - Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X + (Main.npc[(int)projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)projectile.ai[1]].Center.Y - 74f) + velocity * distanceBetweenProjectiles; - int projectileAmt = (int)(projectile.localAI[1] / distanceBetweenProjectiles); + Vector2 fireFrom = new Vector2(Main.npc[(int)Projectile.ai[1]].Center.X + (Main.npc[(int)Projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)Projectile.ai[1]].Center.Y - 74f) + velocity * distanceBetweenProjectiles; + int projectileAmt = (int)(Projectile.localAI[1] / distanceBetweenProjectiles); int type = ModContent.ProjectileType(); - int damage = projectile.GetProjectileDamage(ModContent.NPCType()); + int damage = Projectile.GetProjectileDamage(ModContent.NPCType()); for (int i = 0; i < projectileAmt; i++) { int totalProjectiles = 2; float radians = MathHelper.TwoPi / totalProjectiles; for (int j = 0; j < totalProjectiles; j++) { - Vector2 projVelocity = projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2); + Vector2 projVelocity = Projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2); int proj = Projectile.NewProjectile(fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, death ? 2f : 1f, 0f); Main.projectile[proj].tileCollide = true; } @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Boss for (int num809 = 0; num809 < 2; num809++) { - float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float num810 = Projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; float num811 = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 vector80 = new Vector2((float)Math.Cos(num810) * num811, (float)Math.Sin(num810) * num811); int num812 = Dust.NewDust(vector79, 0, 0, (int)CalamityDusts.Brimstone, vector80.X, vector80.Y, 0, default, 1f); @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(5)) { - Vector2 value29 = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; + Vector2 value29 = Projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * Projectile.width; int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[num813]; dust.velocity *= 0.5f; @@ -153,26 +153,26 @@ namespace CalamityMod.Projectiles.Boss } DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) { return false; } - Texture2D texture2D19 = Main.projectileTexture[projectile.type]; - Texture2D texture2D20 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/BrimstoneRayMid"); - Texture2D texture2D21 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/BrimstoneRayEnd"); - float num223 = projectile.localAI[1]; //length of laser + Texture2D texture2D19 = Main.projectileTexture[Projectile.type]; + Texture2D texture2D20 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BrimstoneRayMid"); + Texture2D texture2D21 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BrimstoneRayEnd"); + float num223 = Projectile.localAI[1]; //length of laser Color color44 = new Color(255, 255, 255, 0) * 0.9f; - Vector2 vector = projectile.Center - Main.screenPosition; + Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; - spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - num223 -= (texture2D19.Height / 2 + texture2D21.Height) * projectile.scale; - Vector2 value20 = projectile.Center; - value20 += projectile.velocity * projectile.scale * texture2D19.Height / 2f; + spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); + num223 -= (texture2D19.Height / 2 + texture2D21.Height) * Projectile.scale; + Vector2 value20 = Projectile.Center; + value20 += Projectile.velocity * Projectile.scale * texture2D19.Height / 2f; if (num223 > 0f) { float num224 = 0f; @@ -183,9 +183,9 @@ namespace CalamityMod.Projectiles.Boss { rectangle7.Height = (int)(num223 - num224); } - spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f); - num224 += rectangle7.Height * projectile.scale; - value20 += projectile.velocity * rectangle7.Height * projectile.scale; + spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, Projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0f); + num224 += rectangle7.Height * Projectile.scale; + value20 += Projectile.velocity * rectangle7.Height * Projectile.scale; rectangle7.Y += texture2D20.Height; if (rectangle7.Y + rectangle7.Height > texture2D20.Height) { @@ -195,15 +195,15 @@ namespace CalamityMod.Projectiles.Boss } Vector2 vector2 = value20 - Main.screenPosition; sourceRectangle2 = null; - spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, color44, projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, color44, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -213,7 +213,7 @@ namespace CalamityMod.Projectiles.Boss return true; } float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref num6)) { return true; } @@ -225,7 +225,7 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(ModContent.BuffType(), 300); } - public override bool CanHitPlayer(Player target) => projectile.scale >= 0.5f; + public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { diff --git a/Projectiles/Boss/BrimstoneTargetRay.cs b/Projectiles/Boss/BrimstoneTargetRay.cs index 3cfe11e5e3..4f8b26563b 100644 --- a/Projectiles/Boss/BrimstoneTargetRay.cs +++ b/Projectiles/Boss/BrimstoneTargetRay.cs @@ -18,76 +18,76 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.scale = 0.1f; + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; + Projectile.scale = 0.1f; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { Vector2? vector78 = null; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - projectile.velocity = -Vector2.UnitY; + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) + Projectile.velocity = -Vector2.UnitY; - if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType()) + if (Main.npc[(int)Projectile.ai[1]].active && Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType()) { - Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X + (Main.npc[(int)projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)projectile.ai[1]].Center.Y - 74f); - projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; + Vector2 fireFrom = new Vector2(Main.npc[(int)Projectile.ai[1]].Center.X + (Main.npc[(int)Projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)Projectile.ai[1]].Center.Y - 74f); + Projectile.position = fireFrom - new Vector2(Projectile.width, Projectile.height) / 2f; } else - projectile.Kill(); + Projectile.Kill(); - Vector2 laserVelocity = new Vector2(Main.npc[(int)projectile.ai[1]].Calamity().newAI[1], Main.npc[(int)projectile.ai[1]].Calamity().newAI[2]); - float rotationVelocity = projectile.ai[0] == 0f ? laserVelocity.ToRotation() : projectile.velocity.ToRotation(); - projectile.rotation = rotationVelocity - MathHelper.PiOver2; - projectile.velocity = rotationVelocity.ToRotationVector2(); + Vector2 laserVelocity = new Vector2(Main.npc[(int)Projectile.ai[1]].Calamity().newAI[1], Main.npc[(int)Projectile.ai[1]].Calamity().newAI[2]); + float rotationVelocity = Projectile.ai[0] == 0f ? laserVelocity.ToRotation() : Projectile.velocity.ToRotation(); + Projectile.rotation = rotationVelocity - MathHelper.PiOver2; + Projectile.velocity = rotationVelocity.ToRotationVector2(); - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - if (Main.npc[(int)projectile.ai[1]].ai[1] >= 150f) + if (Main.npc[(int)Projectile.ai[1]].ai[1] >= 150f) { - projectile.Kill(); + Projectile.Kill(); return; } } else { - if (Main.npc[(int)projectile.ai[1]].ai[1] >= 180f) + if (Main.npc[(int)Projectile.ai[1]].ai[1] >= 180f) { - projectile.Kill(); + Projectile.Kill(); return; } } float num805 = 3f; //3f - float num806 = projectile.width; + float num806 = Projectile.width; - Vector2 samplingPoint = projectile.Center; + Vector2 samplingPoint = Projectile.Center; if (vector78.HasValue) { samplingPoint = vector78.Value; } float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); + Collision.LaserScan(samplingPoint, Projectile.velocity, num806 * Projectile.scale, 2400f, array3); float num807 = 0f; for (int num808 = 0; num808 < array3.Length; num808++) { @@ -96,48 +96,48 @@ namespace CalamityMod.Projectiles.Boss num807 /= num805; // Fire laser through walls at max length if target cannot be seen - if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1)) + if (!Collision.CanHitLine(Main.npc[(int)Projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)Projectile.ai[1]].target].Center, 1, 1)) { num807 = 2400f; } float amount = 0.5f; //0.5f - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); //length of laser, linear interpolation DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) { return false; } - Texture2D texture2D19 = Main.projectileTexture[projectile.type]; - Texture2D texture2D20 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/BrimstoneRayMid"); - Texture2D texture2D21 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/BrimstoneRayEnd"); - float num223 = projectile.localAI[1]; //length of laser + Texture2D texture2D19 = Main.projectileTexture[Projectile.type]; + Texture2D texture2D20 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BrimstoneRayMid"); + Texture2D texture2D21 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BrimstoneRayEnd"); + float num223 = Projectile.localAI[1]; //length of laser Color color44 = new Color(255, 255, 255, 0) * 0.9f; - Vector2 vector = projectile.Center - Main.screenPosition; + Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; - spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - num223 -= (texture2D19.Height / 2 + texture2D21.Height) * projectile.scale; - Vector2 value20 = projectile.Center; - value20 += projectile.velocity * projectile.scale * texture2D19.Height / 2f; + spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); + num223 -= (texture2D19.Height / 2 + texture2D21.Height) * Projectile.scale; + Vector2 value20 = Projectile.Center; + value20 += Projectile.velocity * Projectile.scale * texture2D19.Height / 2f; if (num223 > 0f) { float num224 = 0f; - Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16); + Rectangle rectangle7 = new Rectangle(0, 16 * (Projectile.timeLeft / 3 % 5), texture2D20.Width, 16); while (num224 + 1f < num223) { if (num223 - num224 < rectangle7.Height) { rectangle7.Height = (int)(num223 - num224); } - spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f); - num224 += rectangle7.Height * projectile.scale; - value20 += projectile.velocity * rectangle7.Height * projectile.scale; + spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, Projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0f); + num224 += rectangle7.Height * Projectile.scale; + value20 += Projectile.velocity * rectangle7.Height * Projectile.scale; rectangle7.Y += 16; if (rectangle7.Y + rectangle7.Height > texture2D20.Height) { @@ -147,15 +147,15 @@ namespace CalamityMod.Projectiles.Boss } Vector2 vector2 = value20 - Main.screenPosition; sourceRectangle2 = null; - spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, color44, projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, color44, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -165,7 +165,7 @@ namespace CalamityMod.Projectiles.Boss return true; } float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref num6)) { return true; } diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs index 78b8680e2d..319c07f3d9 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Flame Skull"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - projectile.Opacity = 0f; + Projectile.width = 40; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 1200; + Projectile.Opacity = 0f; cooldownSlot = 1; } @@ -43,46 +43,46 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { x++; - projectile.velocity.Y = (float)(5D * Math.Sin(x / 5D)); + Projectile.velocity.Y = (float)(5D * Math.Sin(x / 5D)); - projectile.frameCounter++; - if (projectile.frameCounter > 12) + Projectile.frameCounter++; + if (Projectile.frameCounter > 12) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - if (projectile.timeLeft < 30) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); + if (Projectile.timeLeft < 30) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 1170) / 30f), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 1170) / 30f), 0f, 1f); - Lighting.AddLight(projectile.Center, 0.5f * projectile.Opacity, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f * Projectile.Opacity, 0f, 0f); - if (projectile.velocity.X < 0f) - projectile.spriteDirection = 1; + if (Projectile.velocity.X < 0f) + Projectile.spriteDirection = 1; else - projectile.spriteDirection = -1; + Projectile.spriteDirection = -1; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - lightColor.R = (byte)(255 * projectile.Opacity); - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + lightColor.R = (byte)(255 * Projectile.Opacity); + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, spriteEffects, 0f); return false; } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Boss/BrokenApolloLens.cs b/Projectiles/Boss/BrokenApolloLens.cs index 58a545036e..f39c92b597 100644 --- a/Projectiles/Boss/BrokenApolloLens.cs +++ b/Projectiles/Boss/BrokenApolloLens.cs @@ -6,28 +6,28 @@ namespace CalamityMod.Projectiles.Boss { public class BrokenApolloLens : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() => DisplayName.SetDefault("Lens"); public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.penetrate = -1; - projectile.timeLeft = 480; + Projectile.width = Projectile.height = 30; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 480; } public override void AI() { if (Time < 5f) - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; else - projectile.rotation += (projectile.velocity.X > 0f).ToDirectionInt() * projectile.velocity.Length() * 0.018f; + Projectile.rotation += (Projectile.velocity.X > 0f).ToDirectionInt() * Projectile.velocity.Length() * 0.018f; - if (projectile.timeLeft < 90) - projectile.Opacity = projectile.timeLeft / 90f; - projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.325f, -25f, 25f); + if (Projectile.timeLeft < 90) + Projectile.Opacity = Projectile.timeLeft / 90f; + Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y + 0.325f, -25f, 25f); Time++; } @@ -35,18 +35,18 @@ namespace CalamityMod.Projectiles.Boss public override bool OnTileCollide(Vector2 oldVelocity) { // Stop bouncing after a certain degree of slowness has been reached. - if (projectile.velocity.Length() < 3f) + if (Projectile.velocity.Length() < 3f) { - projectile.velocity = Vector2.Zero; + Projectile.velocity = Vector2.Zero; return false; } - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y * 0.75f; - projectile.velocity *= 0.8f; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y * 0.75f; + Projectile.velocity *= 0.8f; return false; } diff --git a/Projectiles/Boss/BrokenArtemisLens.cs b/Projectiles/Boss/BrokenArtemisLens.cs index 02c98e0f2a..7065c09641 100644 --- a/Projectiles/Boss/BrokenArtemisLens.cs +++ b/Projectiles/Boss/BrokenArtemisLens.cs @@ -6,28 +6,28 @@ namespace CalamityMod.Projectiles.Boss { public class BrokenArtemisLens : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() => DisplayName.SetDefault("Lens"); public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.penetrate = -1; - projectile.timeLeft = 480; + Projectile.width = Projectile.height = 30; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 480; } public override void AI() { if (Time < 5f) - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; else - projectile.rotation += (projectile.velocity.X > 0f).ToDirectionInt() * projectile.velocity.Length() * 0.018f; + Projectile.rotation += (Projectile.velocity.X > 0f).ToDirectionInt() * Projectile.velocity.Length() * 0.018f; - if (projectile.timeLeft < 90) - projectile.Opacity = projectile.timeLeft / 90f; - projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.325f, -25f, 25f); + if (Projectile.timeLeft < 90) + Projectile.Opacity = Projectile.timeLeft / 90f; + Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y + 0.325f, -25f, 25f); Time++; } @@ -35,18 +35,18 @@ namespace CalamityMod.Projectiles.Boss public override bool OnTileCollide(Vector2 oldVelocity) { // Stop bouncing after a certain degree of slowness has been reached. - if (projectile.velocity.Length() < 3f) + if (Projectile.velocity.Length() < 3f) { - projectile.velocity = Vector2.Zero; + Projectile.velocity = Vector2.Zero; return false; } - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y * 0.75f; - projectile.velocity *= 0.8f; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y * 0.75f; + Projectile.velocity *= 0.8f; return false; } diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index 757797f134..f87cf52aa7 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -13,21 +13,21 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Dark Energy"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 80; - projectile.height = 80; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.penetrate = -1; - projectile.Opacity = 0f; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 80; + Projectile.height = 80; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; + Projectile.penetrate = -1; + Projectile.Opacity = 0f; cooldownSlot = 1; } @@ -35,64 +35,64 @@ namespace CalamityMod.Projectiles.Boss { if (CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) { - projectile.active = false; - projectile.netUpdate = true; + Projectile.active = false; + Projectile.netUpdate = true; return; } - if (Vector2.Distance(projectile.Center, Main.npc[CalamityGlobalNPC.voidBoss].Center) < 80f) - projectile.Kill(); + if (Vector2.Distance(Projectile.Center, Main.npc[CalamityGlobalNPC.voidBoss].Center) < 80f) + Projectile.Kill(); - if (projectile.velocity.Length() < 10f) - projectile.velocity *= 1.05f; + if (Projectile.velocity.Length() < 10f) + Projectile.velocity *= 1.05f; - if (projectile.timeLeft < 30) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); + if (Projectile.timeLeft < 30) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 570) / 30f), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 570) / 30f), 0f, 1f); - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) - projectile.frame = 0; + if (Projectile.frame > 5) + Projectile.frame = 0; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color = Color.Lerp(Color.White, Color.Fuchsia, 0.5f) * projectile.Opacity; - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int drawStart = height * projectile.frame; - Vector2 origin = projectile.Size / 2; + Color color = Color.Lerp(Color.White, Color.Fuchsia, 0.5f) * Projectile.Opacity; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = height * Projectile.frame; + Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow"), Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); - color = Color.Lerp(Color.White, Color.Cyan, 0.5f) * projectile.Opacity; + color = Color.Lerp(Color.White, Color.Cyan, 0.5f) * Projectile.Opacity; - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow2"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow2"), Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 35f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 35f, targetHitbox); - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity == 1f) + if (Projectile.Opacity == 1f) target.AddBuff(BuffID.VortexDebuff, 60); } @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Boss { for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -111,10 +111,10 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 2f; } diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index 50a742c975..076713cf8c 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -15,21 +15,21 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Dark Energy"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 80; - projectile.height = 80; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.penetrate = -1; - projectile.Opacity = 0f; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 80; + Projectile.height = 80; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; + Projectile.penetrate = -1; + Projectile.Opacity = 0f; cooldownSlot = 1; } @@ -37,64 +37,64 @@ namespace CalamityMod.Projectiles.Boss { if (CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) { - projectile.active = false; - projectile.netUpdate = true; + Projectile.active = false; + Projectile.netUpdate = true; return; } - if (Vector2.Distance(projectile.Center, Main.npc[CalamityGlobalNPC.voidBoss].Center) < 80f) - projectile.Kill(); + if (Vector2.Distance(Projectile.Center, Main.npc[CalamityGlobalNPC.voidBoss].Center) < 80f) + Projectile.Kill(); - if (projectile.velocity.Length() < 10f) - projectile.velocity *= 1.05f; + if (Projectile.velocity.Length() < 10f) + Projectile.velocity *= 1.05f; - if (projectile.timeLeft < 30) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); + if (Projectile.timeLeft < 30) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 570) / 30f), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 570) / 30f), 0f, 1f); - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) - projectile.frame = 0; + if (Projectile.frame > 5) + Projectile.frame = 0; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color = Color.Lerp(Color.White, Color.Fuchsia, 0.5f) * projectile.Opacity; - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int drawStart = height * projectile.frame; - Vector2 origin = projectile.Size / 2; + Color color = Color.Lerp(Color.White, Color.Fuchsia, 0.5f) * Projectile.Opacity; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = height * Projectile.frame; + Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow"), Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); - color = Color.Lerp(Color.White, Color.Cyan, 0.5f) * projectile.Opacity; + color = Color.Lerp(Color.White, Color.Cyan, 0.5f) * Projectile.Opacity; - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow2"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow2"), Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 35f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 35f, targetHitbox); - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity == 1f) + if (Projectile.Opacity == 1f) target.AddBuff(BuffID.VortexDebuff, 60); } @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Boss { for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -113,10 +113,10 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 1f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 2f; } diff --git a/Projectiles/Boss/DarkOrb.cs b/Projectiles/Boss/DarkOrb.cs index 7da6fe6e87..cec3f3405e 100644 --- a/Projectiles/Boss/DarkOrb.cs +++ b/Projectiles/Boss/DarkOrb.cs @@ -20,26 +20,26 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Dark Orb"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 3600; + Projectile.width = 20; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 3600; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); writer.Write(start); writer.WriteVector2(center); writer.Write(distances[0]); @@ -51,8 +51,8 @@ namespace CalamityMod.Projectiles.Boss public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); start = reader.ReadBoolean(); center = reader.ReadVector2(); distances[0] = reader.ReadDouble(); @@ -64,30 +64,30 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (projectile.ai[0] != 8f) + if (Projectile.ai[0] != 8f) { // Pulse in and out - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - projectile.scale -= 0.012f; - if (projectile.scale <= 0.8f) + Projectile.scale -= 0.012f; + if (Projectile.scale <= 0.8f) { - projectile.scale = 0.8f; - projectile.localAI[1] = 1f; + Projectile.scale = 0.8f; + Projectile.localAI[1] = 1f; } } else { - projectile.scale += 0.012f; - if (projectile.scale >= 1.2f) + Projectile.scale += 0.012f; + if (Projectile.scale >= 1.2f) { - projectile.scale = 1.2f; - projectile.localAI[1] = 0f; + Projectile.scale = 1.2f; + Projectile.localAI[1] = 0f; } } } - switch ((int)projectile.ai[0]) + switch ((int)Projectile.ai[0]) { // No AI case -1: @@ -99,34 +99,34 @@ namespace CalamityMod.Projectiles.Boss if (start) { - center = projectile.Center; - velocity = Vector2.Normalize(Main.player[Player.FindClosest(projectile.Center, 1, 1)].Center - projectile.Center) * 2f; + center = Projectile.Center; + velocity = Vector2.Normalize(Main.player[Player.FindClosest(Projectile.Center, 1, 1)].Center - Projectile.Center) * 2f; start = false; } center += velocity; - double rad = MathHelper.ToRadians(projectile.ai[1]); + double rad = MathHelper.ToRadians(Projectile.ai[1]); - float amount = 1f - projectile.localAI[0] / 360f; + float amount = 1f - Projectile.localAI[0] / 360f; if (amount < 0f) amount = 0f; distances[0] += MathHelper.Lerp(1f, 6f, amount); - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.position.X = center.X - (int)(Math.Sin(rad) * distances[0]) - projectile.width / 2; - projectile.position.Y = center.Y - (int)(Math.Cos(rad) * distances[0]) - projectile.height / 2; + Projectile.position.X = center.X - (int)(Math.Sin(rad) * distances[0]) - Projectile.width / 2; + Projectile.position.Y = center.Y - (int)(Math.Cos(rad) * distances[0]) - Projectile.height / 2; } else { - projectile.position.X = center.X - (int)(Math.Cos(rad) * distances[0]) - projectile.width / 2; - projectile.position.Y = center.Y - (int)(Math.Sin(rad) * distances[0]) - projectile.height / 2; + Projectile.position.X = center.X - (int)(Math.Cos(rad) * distances[0]) - Projectile.width / 2; + Projectile.position.Y = center.Y - (int)(Math.Sin(rad) * distances[0]) - Projectile.height / 2; } - projectile.ai[1] += 0.25f + amount; - projectile.localAI[0] += 1f; + Projectile.ai[1] += 0.25f + amount; + Projectile.localAI[0] += 1f; break; @@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.Boss case 3: case 4: - bool useSin = projectile.ai[0] == 3f; + bool useSin = Projectile.ai[0] == 3f; WavyMotion(0.1f, 0f, useSin, false); @@ -151,8 +151,8 @@ namespace CalamityMod.Projectiles.Boss case 5: case 16: - float fastGateValue = projectile.ai[0] == 5f ? 30f : 60f; - float maxVelocity = projectile.ai[0] == 5f ? 12f : 6f; + float fastGateValue = Projectile.ai[0] == 5f ? 30f : 60f; + float maxVelocity = Projectile.ai[0] == 5f ? 12f : 6f; LurchForwardOnTimer(90f, fastGateValue, 3f, maxVelocity, 0.95f, 1.2f); @@ -161,22 +161,22 @@ namespace CalamityMod.Projectiles.Boss // Split into 4 projectiles that can use any of the first 6 AIs case 6: - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; - if (projectile.ai[1] >= 90f) + if (Projectile.ai[1] >= 90f) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { int totalProjectiles = 4; float radians = MathHelper.TwoPi / totalProjectiles; for (int i = 0; i < totalProjectiles; i++) { Vector2 vector = new Vector2(0f, -8f).RotatedBy(radians * i); - Projectile.NewProjectile(projectile.Center, vector, projectile.type, projectile.damage, 0f, Main.myPlayer, Main.rand.Next(6), 0f); + Projectile.NewProjectile(Projectile.Center, vector, Projectile.type, Projectile.damage, 0f, Main.myPlayer, Main.rand.Next(6), 0f); } } - projectile.Kill(); + Projectile.Kill(); } break; @@ -184,22 +184,22 @@ namespace CalamityMod.Projectiles.Boss // Split into 8 projectiles that can use either of the first 2 AIs case 7: - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; - if (projectile.ai[1] >= 120f) + if (Projectile.ai[1] >= 120f) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { int totalProjectiles = 8; float radians = MathHelper.TwoPi / totalProjectiles; for (int i = 0; i < totalProjectiles; i++) { Vector2 vector = new Vector2(0f, -8f).RotatedBy(radians * i); - Projectile.NewProjectile(projectile.Center, vector, projectile.type, projectile.damage, 0f, Main.myPlayer, Main.rand.Next(2), 0f); + Projectile.NewProjectile(Projectile.Center, vector, Projectile.type, Projectile.damage, 0f, Main.myPlayer, Main.rand.Next(2), 0f); } } - projectile.Kill(); + Projectile.Kill(); } break; @@ -207,18 +207,18 @@ namespace CalamityMod.Projectiles.Boss // Split into 3 wavy projectiles multiple times case 8: - bool splitOnce = projectile.timeLeft < 1800; - bool splitTwice = projectile.timeLeft < 900; - bool splitThrice = projectile.timeLeft < 450; + bool splitOnce = Projectile.timeLeft < 1800; + bool splitTwice = Projectile.timeLeft < 900; + bool splitThrice = Projectile.timeLeft < 450; if (splitOnce) WavyMotion(0.05f, 2f, true, true); - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 180f) + if (Projectile.localAI[0] >= 180f) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { int totalProjectiles = 3; float radians = MathHelper.TwoPi / totalProjectiles; @@ -230,25 +230,25 @@ namespace CalamityMod.Projectiles.Boss (splitThrice ? 3 : 0); } - Vector2 vector = Main.player[Player.FindClosest(projectile.Center, 1, 1)].Center - projectile.Center; + Vector2 vector = Main.player[Player.FindClosest(Projectile.Center, 1, 1)].Center - Projectile.Center; vector.Normalize(); vector *= 3f; for (int i = 0; i < totalProjectiles; i++) { - Vector2 vector2 = splitOnce ? projectile.velocity.RotatedBy(MathHelper.ToRadians(i * spread)) : new Vector2(0f, -3f).RotatedBy(radians * i); + Vector2 vector2 = splitOnce ? Projectile.velocity.RotatedBy(MathHelper.ToRadians(i * spread)) : new Vector2(0f, -3f).RotatedBy(radians * i); - int proj = Projectile.NewProjectile(projectile.Center, vector + vector2, projectile.type, projectile.damage, 0f, Main.myPlayer, 8f, 0f); + int proj = Projectile.NewProjectile(Projectile.Center, vector + vector2, Projectile.type, Projectile.damage, 0f, Main.myPlayer, 8f, 0f); - Main.projectile[proj].timeLeft = projectile.timeLeft / 2; + Main.projectile[proj].timeLeft = Projectile.timeLeft / 2; if (Main.projectile[proj].timeLeft < 150) Main.projectile[proj].timeLeft = 150; - Main.projectile[proj].scale = projectile.scale * 0.6f; + Main.projectile[proj].scale = Projectile.scale * 0.6f; } } - projectile.Kill(); + Projectile.Kill(); } break; @@ -257,7 +257,7 @@ namespace CalamityMod.Projectiles.Boss case 9: case 10: - bool useSin2 = projectile.ai[0] == 9f; + bool useSin2 = Projectile.ai[0] == 9f; OscillationMotion(0.05f, useSin2); @@ -266,23 +266,23 @@ namespace CalamityMod.Projectiles.Boss // Homing case 11: - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; - if (projectile.ai[1] >= 180f) + if (Projectile.ai[1] >= 180f) { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] < 180f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] < 180f) { - Vector2 vector = Main.player[Player.FindClosest(projectile.Center, 1, 1)].Center - projectile.Center; - float scaleFactor = projectile.velocity.Length(); + Vector2 vector = Main.player[Player.FindClosest(Projectile.Center, 1, 1)].Center - Projectile.Center; + float scaleFactor = Projectile.velocity.Length(); vector.Normalize(); vector *= scaleFactor; - projectile.velocity = (projectile.velocity * 15f + vector) / 16f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor; + Projectile.velocity = (Projectile.velocity * 15f + vector) / 16f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor; } - else if (projectile.velocity.Length() < 18f) - projectile.velocity *= 1.01f; + else if (Projectile.velocity.Length() < 18f) + Projectile.velocity *= 1.01f; } break; @@ -293,8 +293,8 @@ namespace CalamityMod.Projectiles.Boss if (start) { - center = projectile.Center; - velocity = Vector2.Normalize(Main.player[Player.FindClosest(projectile.Center, 1, 1)].Center - projectile.Center); + center = Projectile.Center; + velocity = Vector2.Normalize(Main.player[Player.FindClosest(Projectile.Center, 1, 1)].Center - Projectile.Center); start = false; } @@ -303,12 +303,12 @@ namespace CalamityMod.Projectiles.Boss float velocityGateValue3 = 240f; float amount2 = 1f; - bool flyOutward = projectile.localAI[0] < velocityGateValue3; + bool flyOutward = Projectile.localAI[0] < velocityGateValue3; if (flyOutward) - amount2 -= projectile.localAI[0] / velocityGateValue3; + amount2 -= Projectile.localAI[0] / velocityGateValue3; else - amount2 = (projectile.localAI[0] - velocityGateValue3) / velocityGateValue3; + amount2 = (Projectile.localAI[0] - velocityGateValue3) / velocityGateValue3; amount2 = MathHelper.Clamp(0f, 1f, amount2); @@ -316,21 +316,21 @@ namespace CalamityMod.Projectiles.Boss distances[0] += flyOutward ? distanceVariable : -distanceVariable; - double rad2 = MathHelper.ToRadians(projectile.ai[1]); + double rad2 = MathHelper.ToRadians(Projectile.ai[1]); - if (projectile.ai[0] == 12f) + if (Projectile.ai[0] == 12f) { - projectile.position.X = center.X - (int)(Math.Sin(rad2) * distances[0] * 2D) - projectile.width / 2; - projectile.position.Y = center.Y - (int)(Math.Cos(rad2) * distances[0]) - projectile.height / 2; + Projectile.position.X = center.X - (int)(Math.Sin(rad2) * distances[0] * 2D) - Projectile.width / 2; + Projectile.position.Y = center.Y - (int)(Math.Cos(rad2) * distances[0]) - Projectile.height / 2; } else { - projectile.position.X = center.X - (int)(Math.Cos(rad2) * distances[0]) - projectile.width / 2; - projectile.position.Y = center.Y - (int)(Math.Sin(rad2) * distances[0] * 2D) - projectile.height / 2; + Projectile.position.X = center.X - (int)(Math.Cos(rad2) * distances[0]) - Projectile.width / 2; + Projectile.position.Y = center.Y - (int)(Math.Sin(rad2) * distances[0] * 2D) - Projectile.height / 2; } - projectile.ai[1] += 0.25f + amount2; - projectile.localAI[0] += 1f; + Projectile.ai[1] += 0.25f + amount2; + Projectile.localAI[0] += 1f; break; @@ -342,8 +342,8 @@ namespace CalamityMod.Projectiles.Boss if (start) { - center = projectile.Center; - velocity = Vector2.Normalize(Main.player[Player.FindClosest(projectile.Center, 1, 1)].Center - projectile.Center) * velocityMult; + center = Projectile.Center; + velocity = Vector2.Normalize(Main.player[Player.FindClosest(Projectile.Center, 1, 1)].Center - Projectile.Center) * velocityMult; start = false; } @@ -351,19 +351,19 @@ namespace CalamityMod.Projectiles.Boss float flyInwardGateValue = 240f; - float amount3 = 1f - projectile.localAI[0] / flyInwardGateValue; + float amount3 = 1f - Projectile.localAI[0] / flyInwardGateValue; if (amount3 < 0f) amount3 = 0f; - bool changeXPos = projectile.ai[0] == 14f; + bool changeXPos = Projectile.ai[0] == 14f; float units = 6f; distances[0] += MathHelper.Lerp(1f, units, amount3); - if (projectile.localAI[0] > flyInwardGateValue) + if (Projectile.localAI[0] > flyInwardGateValue) { - distances[2] = changeXPos ? Math.Abs(center.X - projectile.Center.X) : Math.Abs(center.Y - projectile.Center.Y); + distances[2] = changeXPos ? Math.Abs(center.X - Projectile.Center.X) : Math.Abs(center.Y - Projectile.Center.Y); if (distances[3] == 0D) distances[3] = distances[2] - units * 10f; @@ -376,7 +376,7 @@ namespace CalamityMod.Projectiles.Boss { float slowDownGateValue = 30f; - if (projectile.localAI[0] > flyInwardGateValue - slowDownGateValue) + if (Projectile.localAI[0] > flyInwardGateValue - slowDownGateValue) velocity *= 1f - velocityMult / slowDownGateValue; distances[1] = distances[0]; @@ -385,15 +385,15 @@ namespace CalamityMod.Projectiles.Boss double distanceX = changeXPos ? distances[1] : distances[0]; double distanceY = changeXPos ? distances[0] : distances[1]; - double rad3 = MathHelper.ToRadians(projectile.ai[1]); + double rad3 = MathHelper.ToRadians(Projectile.ai[1]); - projectile.position.X = center.X - (int)(Math.Sin(rad3) * distanceX) - projectile.width / 2; - projectile.position.Y = center.Y - (int)(Math.Cos(rad3) * distanceY) - projectile.height / 2; + Projectile.position.X = center.X - (int)(Math.Sin(rad3) * distanceX) - Projectile.width / 2; + Projectile.position.Y = center.Y - (int)(Math.Cos(rad3) * distanceY) - Projectile.height / 2; - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 600f) - projectile.Kill(); + if (Projectile.localAI[0] > 600f) + Projectile.Kill(); break; } @@ -403,145 +403,145 @@ namespace CalamityMod.Projectiles.Boss { if (start) { - velocity = projectile.velocity; + velocity = Projectile.velocity; start = false; } - projectile.ai[1] += frequency; + Projectile.ai[1] += frequency; if (amplitude == 0f) amplitude = velocity.Length(); - float wavyVelocity = useSin ? (float)Math.Sin(projectile.ai[1]) : (float)Math.Cos(projectile.ai[1]); + float wavyVelocity = useSin ? (float)Math.Sin(Projectile.ai[1]) : (float)Math.Cos(Projectile.ai[1]); if (waveWithVelocity) - projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity) * amplitude; + Projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity) * amplitude; else - projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity).RotatedBy(MathHelper.ToRadians(velocity.ToRotation())) * amplitude; + Projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity).RotatedBy(MathHelper.ToRadians(velocity.ToRotation())) * amplitude; } private void LurchForward(float frequncy, float deceleration, float acceleration) { - projectile.ai[1] += frequncy; + Projectile.ai[1] += frequncy; - projectile.velocity *= MathHelper.Lerp(deceleration, acceleration, (float)Math.Abs(Math.Sin(projectile.ai[1]))); + Projectile.velocity *= MathHelper.Lerp(deceleration, acceleration, (float)Math.Abs(Math.Sin(Projectile.ai[1]))); } private void LurchForwardOnTimer(float slowGateValue, float fastGateValue, float minVelocity, float maxVelocity, float deceleration, float acceleration) { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; - if (projectile.ai[1] <= slowGateValue) + if (Projectile.ai[1] <= slowGateValue) { - if (projectile.velocity.Length() > minVelocity) - projectile.velocity *= deceleration; + if (Projectile.velocity.Length() > minVelocity) + Projectile.velocity *= deceleration; } - else if (projectile.ai[1] < slowGateValue + fastGateValue) + else if (Projectile.ai[1] < slowGateValue + fastGateValue) { - if (projectile.velocity.Length() < maxVelocity) - projectile.velocity *= acceleration; + if (Projectile.velocity.Length() < maxVelocity) + Projectile.velocity *= acceleration; } else - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; } private void OscillationMotion(float frequncy, bool useSin) { - projectile.ai[1] += frequncy; + Projectile.ai[1] += frequncy; - float oscillation = useSin ? (float)Math.Sin(projectile.ai[1]) : (float)Math.Cos(projectile.ai[1]); + float oscillation = useSin ? (float)Math.Sin(Projectile.ai[1]) : (float)Math.Cos(Projectile.ai[1]); if (start) { - velocity = projectile.velocity; + velocity = Projectile.velocity; start = false; } else if (oscillation == 0f) { - Player target = Main.player[Player.FindClosest(projectile.Center, 1, 1)]; - Vector2 vector = target.Center + target.velocity * 20f - projectile.Center; + Player target = Main.player[Player.FindClosest(Projectile.Center, 1, 1)]; + Vector2 vector = target.Center + target.velocity * 20f - Projectile.Center; vector.Normalize(); vector *= velocity.Length(); - projectile.velocity = vector; + Projectile.velocity = vector; } else { float amplitude = velocity.Length(); - projectile.velocity.Normalize(); - projectile.velocity *= amplitude * oscillation; + Projectile.velocity.Normalize(); + Projectile.velocity *= amplitude * oscillation; } } public override Color? GetAlpha(Color lightColor) { - switch ((int)projectile.ai[0]) + switch ((int)Projectile.ai[0]) { // No AI case -1: - return new Color(0, 100, 255, projectile.alpha); + return new Color(0, 100, 255, Projectile.alpha); // Rotate around a point, spread outward and move case 0: case 1: - return new Color(0, 100, 255, projectile.alpha); + return new Color(0, 100, 255, Projectile.alpha); // Lurch forward case 2: - return new Color(255, 200, 0, projectile.alpha); + return new Color(255, 200, 0, Projectile.alpha); // Wavy motion case 3: case 4: - return new Color(0, 255, 200, projectile.alpha); + return new Color(0, 255, 200, Projectile.alpha); // Speed up then slow down on a timer case 5: case 16: - return new Color(0, 255, 100, projectile.alpha); + return new Color(0, 255, 100, Projectile.alpha); // Split into 4 projectiles that can use any of the first 6 AIs case 6: - return new Color(200, 0, 255, projectile.alpha); + return new Color(200, 0, 255, Projectile.alpha); // Split into 8 projectiles that can use either of the first 2 AIs case 7: - return new Color(255, 0, 150, projectile.alpha); + return new Color(255, 0, 150, Projectile.alpha); // Split into 3 wavy projectiles multiple times case 8: - return new Color(200, 0, 0, projectile.alpha); + return new Color(200, 0, 0, Projectile.alpha); // idk yet case 9: case 10: - return new Color(255, 255, 0, projectile.alpha); + return new Color(255, 255, 0, Projectile.alpha); // Homing case 11: - return new Color(150, 0, 200, projectile.alpha); + return new Color(150, 0, 200, Projectile.alpha); // Rotate around a moving point and spread outward then inward in an oval pattern case 12: case 13: - return new Color(0, 100, 255, projectile.alpha); + return new Color(0, 100, 255, Projectile.alpha); // Spread out then drift inward after some time and then drift outward case 14: case 15: - return new Color(0, 100, 255, projectile.alpha); + return new Color(0, 100, 255, Projectile.alpha); } return null; @@ -555,7 +555,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/DestroyerCursedLaser.cs b/Projectiles/Boss/DestroyerCursedLaser.cs index 7ec2d08586..f0a6764e0f 100644 --- a/Projectiles/Boss/DestroyerCursedLaser.cs +++ b/Projectiles/Boss/DestroyerCursedLaser.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class DestroyerCursedLaser : ModProjectile @@ -14,46 +15,46 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.scale = 1.8f; - projectile.extraUpdates = 2; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.scale = 1.8f; + Projectile.extraUpdates = 2; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.75f / 255f, 0f); - if (projectile.alpha > 0) + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.75f / 255f, 0f); + if (Projectile.alpha > 0) { - projectile.alpha -= 125; + Projectile.alpha -= 125; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); - projectile.localAI[1] = 1f; + SoundEngine.PlaySound(SoundID.Item33, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.localAI[1] = 1f; } - if (projectile.velocity.Length() < 12f) + if (Projectile.velocity.Length() < 12f) { - projectile.velocity *= 1.0025f; + Projectile.velocity *= 1.0025f; } } public override Color? GetAlpha(Color lightColor) { - if (projectile.alpha < 200) + if (Projectile.alpha < 200) { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } return Color.Transparent; } diff --git a/Projectiles/Boss/DestroyerElectricLaser.cs b/Projectiles/Boss/DestroyerElectricLaser.cs index 2d02fc5291..ee27897e9a 100644 --- a/Projectiles/Boss/DestroyerElectricLaser.cs +++ b/Projectiles/Boss/DestroyerElectricLaser.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class DestroyerElectricLaser : ModProjectile @@ -14,46 +15,46 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.ignoreWater = true; - projectile.width = 4; - projectile.height = 4; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.scale = 1.2f; - projectile.timeLeft = 600; - projectile.extraUpdates = 2; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.ignoreWater = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.hostile = true; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.scale = 1.2f; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 2; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.35f / 255f); - if (projectile.alpha > 0) + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); + if (Projectile.alpha > 0) { - projectile.alpha -= 125; + Projectile.alpha -= 125; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); - projectile.localAI[1] = 1f; + SoundEngine.PlaySound(SoundID.Item33, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.localAI[1] = 1f; } - if (projectile.velocity.Length() < 12f) + if (Projectile.velocity.Length() < 12f) { - projectile.velocity *= 1.0025f; + Projectile.velocity *= 1.0025f; } } public override Color? GetAlpha(Color lightColor) { - if (projectile.alpha < 200) + if (Projectile.alpha < 200) { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } return Color.Transparent; } diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index fd320f8b69..48a4e5e8f5 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -6,6 +6,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -21,91 +22,91 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 100; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = MaxTimeLeft; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.alpha = 100; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = MaxTimeLeft; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { // Sound on spawn - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 33); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 33); } // Deal no damage if fading out and not set to explode - if (projectile.timeLeft < FadeTime) + if (Projectile.timeLeft < FadeTime) { - if (projectile.ai[0] == 0f) - projectile.damage = 0; + if (Projectile.ai[0] == 0f) + Projectile.damage = 0; } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 12f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 12f, targetHitbox); - public override bool CanHitPlayer(Player target) => projectile.timeLeft <= MaxTimeLeft - FadeTime && (projectile.timeLeft >= FadeTime || projectile.ai[0] == 1f); + public override bool CanHitPlayer(Player target) => Projectile.timeLeft <= MaxTimeLeft - FadeTime && (Projectile.timeLeft >= FadeTime || Projectile.ai[0] == 1f); public override Color? GetAlpha(Color lightColor) { // Fade in - if (projectile.timeLeft > MaxTimeLeft - FadeTime) + if (Projectile.timeLeft > MaxTimeLeft - FadeTime) { - projectile.localAI[1] += 1f; - byte b2 = (byte)(((int)projectile.localAI[1]) * 3); - byte a2 = (byte)(projectile.alpha * (b2 / 255f)); + Projectile.localAI[1] += 1f; + byte b2 = (byte)(((int)Projectile.localAI[1]) * 3); + byte a2 = (byte)(Projectile.alpha * (b2 / 255f)); return new Color(b2, b2, b2, a2); } // Fade out if not set to explode // Glow more red over time if set to explode - if (projectile.timeLeft < FadeTime) + if (Projectile.timeLeft < FadeTime) { - byte b2 = (byte)(projectile.timeLeft * 3); - if (projectile.ai[0] == 0f) + byte b2 = (byte)(Projectile.timeLeft * 3); + if (Projectile.ai[0] == 0f) { - byte a2 = (byte)(projectile.alpha * (b2 / 255f)); + byte a2 = (byte)(Projectile.alpha * (b2 / 255f)); return new Color(b2, b2, b2, a2); } else - return new Color(255, b2, b2, projectile.alpha); + return new Color(255, b2, b2, Projectile.alpha); } // Normal - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override void Kill(int timeLeft) { // Explode and split into accelerating lasers - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position = projectile.Center; - projectile.width = projectile.height = 96; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 96; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -115,14 +116,14 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 1.5f; - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); } // Spawn diagonal lasers - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { int totalProjectiles = 4; float radians = MathHelper.TwoPi / totalProjectiles; @@ -135,7 +136,7 @@ namespace CalamityMod.Projectiles.Boss for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(projectile.Center, velocity2, type, (int)Math.Round(projectile.damage * 0.75), 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity2, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Main.myPlayer, 1f, 0f); } } } @@ -143,7 +144,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.timeLeft > MaxTimeLeft - FadeTime || (projectile.timeLeft < FadeTime && projectile.ai[0] == 0f)) + if (Projectile.timeLeft > MaxTimeLeft - FadeTime || (Projectile.timeLeft < FadeTime && Projectile.ai[0] == 0f)) return; target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Boss/DeusRitualDrama.cs b/Projectiles/Boss/DeusRitualDrama.cs index b307ade999..c1b0735a78 100644 --- a/Projectiles/Boss/DeusRitualDrama.cs +++ b/Projectiles/Boss/DeusRitualDrama.cs @@ -7,6 +7,7 @@ using Terraria.DataStructures; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -14,10 +15,10 @@ namespace CalamityMod.Projectiles.Boss { public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } - public bool CreatedWithStarcore => projectile.ai[1] == 1f; + public bool CreatedWithStarcore => Projectile.ai[1] == 1f; public const int TotalSinePeriods = 6; public const int PulseTime = 45; public const int TotalRitualTime = 420; @@ -30,23 +31,23 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = projectile.height = 2; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = TotalRitualTime; + Projectile.width = Projectile.height = 2; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = TotalRitualTime; } public override void AI() { - projectile.extraUpdates = CreatedWithStarcore.ToInt(); + Projectile.extraUpdates = CreatedWithStarcore.ToInt(); Time++; if (Time == TotalRitualTime - PulseTime) { - int idx = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y - (int)MaxUpwardRise, ModContent.NPCType(), 1); + int idx = NPC.NewNPC((int)Projectile.Center.X, (int)Projectile.Center.Y - (int)MaxUpwardRise, ModContent.NPCType(), 1); if (idx != -1) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstrumDeusSpawn"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstrumDeusSpawn"), Projectile.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { CalamityUtils.BossAwakenMessage(idx); @@ -68,12 +69,12 @@ namespace CalamityMod.Projectiles.Boss spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); float pulseCompletionRatio = Utils.InverseLerp(TotalRitualTime - PulseTime, TotalRitualTime, Time, true); - Vector2 scale = projectile.scale * (3f + pulseCompletionRatio * 5f) * new Vector2(1.5f, 1f); - DrawData drawData = new DrawData(ModContent.GetTexture("Terraria/Misc/Perlin"), - projectile.Center - Main.screenPosition + PulseSize.ToVector2() * scale * 0.5f - Vector2.UnitY * upwardness, + Vector2 scale = Projectile.scale * (3f + pulseCompletionRatio * 5f) * new Vector2(1.5f, 1f); + DrawData drawData = new DrawData(ModContent.Request("Terraria/Misc/Perlin"), + Projectile.Center - Main.screenPosition + PulseSize.ToVector2() * scale * 0.5f - Vector2.UnitY * upwardness, new Rectangle(0, 0, PulseSize.X, PulseSize.Y), new Color(new Vector4(1f - (float)Math.Sqrt(pulseCompletionRatio))) * 0.66f, - projectile.rotation, + Projectile.rotation, PulseSize.ToVector2(), scale, SpriteEffects.None, 0); @@ -96,20 +97,20 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < 20; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + Vector2.UnitY * offset.Y, 261); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Vector2.UnitY * offset.Y, 261); dust.color = Utils.SelectRandom(Main.rand, Color.Cyan, Color.OrangeRed); dust.scale = 1.15f; dust.velocity = Main.rand.NextVector2CircularEdge(3f, 3f) * Main.rand.NextFloat(0.7f, 1.4f); dust.noGravity = true; float angle = MathHelper.TwoPi * i / 20f; - dust = Dust.NewDustPerfect(projectile.Center + Vector2.UnitY * offset.Y, 261); + dust = Dust.NewDustPerfect(Projectile.Center + Vector2.UnitY * offset.Y, 261); dust.color = Utils.SelectRandom(Main.rand, Color.Cyan, Color.OrangeRed); dust.scale = 1.15f; dust.velocity = angle.ToRotationVector2() * 7f; dust.noGravity = true; } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconOrbPulse"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconOrbPulse"), Projectile.Center); } DrawStars(spriteBatch, offset); @@ -119,13 +120,13 @@ namespace CalamityMod.Projectiles.Boss public void DrawStars(SpriteBatch spriteBatch, Vector2 offset) { - Texture2D starTexture = ModContent.GetTexture(Texture); + Texture2D starTexture = ModContent.Request(Texture); for (int i = 0; i < 6; i++) { float angle = MathHelper.TwoPi * i / 6f + Time / 15f; Vector2 angularOffset = angle.ToRotationVector2() * 4f; spriteBatch.Draw(starTexture, - projectile.Center + angularOffset + offset - Main.screenPosition, + Projectile.Center + angularOffset + offset - Main.screenPosition, null, Color.Cyan * 0.5f, 0f, @@ -134,7 +135,7 @@ namespace CalamityMod.Projectiles.Boss SpriteEffects.None, 0f); spriteBatch.Draw(starTexture, - projectile.Center + angularOffset + offset * new Vector2(-1f, 1f) - Main.screenPosition, + Projectile.Center + angularOffset + offset * new Vector2(-1f, 1f) - Main.screenPosition, null, Color.OrangeRed * 0.5f, 0f, @@ -144,7 +145,7 @@ namespace CalamityMod.Projectiles.Boss 0f); } spriteBatch.Draw(starTexture, - projectile.Center + offset - Main.screenPosition, + Projectile.Center + offset - Main.screenPosition, null, Color.Cyan * 1.4f, 0f, @@ -153,7 +154,7 @@ namespace CalamityMod.Projectiles.Boss SpriteEffects.None, 0f); spriteBatch.Draw(starTexture, - projectile.Center + offset * new Vector2(-1f, 1f) - Main.screenPosition, + Projectile.Center + offset * new Vector2(-1f, 1f) - Main.screenPosition, null, Color.OrangeRed * 1.1f, 0f, @@ -165,13 +166,13 @@ namespace CalamityMod.Projectiles.Boss // Generate dust at the star position. This gives them a trail effect. if (!Main.dedServ) { - Dust dust2 = Dust.NewDustPerfect(projectile.Center + offset, 261); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + offset, 261); dust2.color = Color.Cyan; dust2.scale = 1.15f; dust2.velocity = Vector2.Zero; dust2.noGravity = true; - dust2 = Dust.NewDustPerfect(projectile.Center + offset * new Vector2(-1f, 1f), 261); + dust2 = Dust.NewDustPerfect(Projectile.Center + offset * new Vector2(-1f, 1f), 261); dust2.color = Color.OrangeRed; dust2.scale = 1.15f; dust2.velocity = Vector2.Zero; diff --git a/Projectiles/Boss/DoGBeam.cs b/Projectiles/Boss/DoGBeam.cs index 51b6a9bf84..d00188d0af 100644 --- a/Projectiles/Boss/DoGBeam.cs +++ b/Projectiles/Boss/DoGBeam.cs @@ -10,59 +10,59 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Portal Laser"); - Main.projFrames[projectile.type] = 2; + Main.projFrames[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.scale = 2f; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 960; + Projectile.width = 6; + Projectile.height = 6; + Projectile.hostile = true; + Projectile.scale = 2f; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 960; cooldownSlot = 1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 1) - projectile.frame = 0; + if (Projectile.frame > 1) + Projectile.frame = 0; - Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.3f); + Lighting.AddLight(Projectile.Center, 0f, 0.2f, 0.3f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; - int num103 = Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 90f && projectile.ai[1] > 30f) + int num103 = Player.FindClosest(Projectile.Center, 1, 1); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] < 90f && Projectile.ai[1] > 30f) { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; + float scaleFactor2 = Projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - Projectile.Center; vector11.Normalize(); vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 20f + vector11) / 21f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 20f + vector11) / 21f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; } - if (projectile.timeLeft == 950) - projectile.damage = (int)projectile.ai[0]; - if (projectile.timeLeft < 30) - projectile.damage = 0; + if (Projectile.timeLeft == 950) + Projectile.damage = (int)Projectile.ai[0]; + if (Projectile.timeLeft < 30) + Projectile.damage = 0; } public override bool CanHitPlayer(Player target) { - if (projectile.timeLeft > 950 || projectile.timeLeft < 30) + if (Projectile.timeLeft > 950 || Projectile.timeLeft < 30) { return false; } @@ -71,13 +71,13 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft > 950) + if (Projectile.timeLeft > 950) { return new Color(0, 0, 0, 0); } - if (projectile.timeLeft < 30) + if (Projectile.timeLeft < 30) { - byte b2 = (byte)(projectile.timeLeft * 8.5); + byte b2 = (byte)(Projectile.timeLeft * 8.5); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index febe8acc94..2b23eb8e57 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -18,18 +19,18 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Beam Portal"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 80; - projectile.height = 80; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.penetrate = -1; + Projectile.width = 80; + Projectile.height = 80; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; + Projectile.penetrate = -1; cooldownSlot = 1; } @@ -47,20 +48,20 @@ namespace CalamityMod.Projectiles.Boss { if (CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) { - projectile.active = false; - projectile.netUpdate = true; + Projectile.active = false; + Projectile.netUpdate = true; return; } - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (start) { - Main.PlaySound(SoundID.Item92, (int)projectile.Center.X, (int)projectile.Center.Y); + SoundEngine.PlaySound(SoundID.Item92, (int)Projectile.Center.X, (int)Projectile.Center.Y); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -71,15 +72,15 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 1f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 2f; } - projectile.ai[1] = projectile.ai[0]; + Projectile.ai[1] = Projectile.ai[0]; start = false; } @@ -89,34 +90,34 @@ namespace CalamityMod.Projectiles.Boss bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - Lighting.AddLight(projectile.Center, 0f, 0.95f, 1.15f); + Lighting.AddLight(Projectile.Center, 0f, 0.95f, 1.15f); - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) - projectile.frame = 0; + if (Projectile.frame > 5) + Projectile.frame = 0; - double deg = projectile.ai[1]; + double deg = Projectile.ai[1]; double rad = deg * (Math.PI / 180); double dist = malice ? 800D : death ? 960D : revenge ? 1000D : expertMode ? 1040D : 1080D; - projectile.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - projectile.width / 2; - projectile.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - projectile.height / 2; - projectile.ai[1] += 1f; + Projectile.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - Projectile.width / 2; + Projectile.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - Projectile.height / 2; + Projectile.ai[1] += 1f; // Don't fire projectiles if Ceaseless Void is entering a new phase - if (projectile.timeLeft > 30) + if (Projectile.timeLeft > 30) { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 240f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 240f) { - projectile.localAI[0] = 0f; - if (projectile.owner == Main.myPlayer) + Projectile.localAI[0] = 0f; + if (Projectile.owner == Main.myPlayer) { - Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item33, (int)Projectile.position.X, (int)Projectile.position.Y); float speed = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3f; speed *= Main.npc[CalamityGlobalNPC.voidBoss].ai[1]; int totalProjectiles = 3; @@ -124,7 +125,7 @@ namespace CalamityMod.Projectiles.Boss for (int i = 0; i < totalProjectiles; i++) { Vector2 velocity = new Vector2(0f, -speed).RotatedBy(radians * i); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), 0, 0f, projectile.owner, projectile.damage, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), 0, 0f, Projectile.owner, Projectile.damage, 0f); } } } @@ -135,9 +136,9 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 30) + if (Projectile.timeLeft < 30) { - byte b2 = (byte)(projectile.timeLeft * 8.5); + byte b2 = (byte)(Projectile.timeLeft * 8.5); byte a2 = (byte)(100f * (b2 / 255f)); return new Color(b2, b2, b2, a2); } diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs index 690c25ec7e..d4d3a07a8c 100644 --- a/Projectiles/Boss/DoGDeath.cs +++ b/Projectiles/Boss/DoGDeath.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Boss { public float TelegraphDelay { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public Vector2 OldVelocity; @@ -29,16 +29,16 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.timeLeft = 450; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 450; cooldownSlot = 1; } @@ -56,38 +56,38 @@ namespace CalamityMod.Projectiles.Boss { // Determine the relative opacities for each player based on their distance. // This has a lower bound of 0.35 to prevent the laser from going completely invisible and players getting hit by cheap shots. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.netUpdate = true; } // Fade in after telegraphs have faded. if (TelegraphDelay > TelegraphTotalTime) { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } // If an old velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> if (OldVelocity != Vector2.Zero) { - projectile.velocity = OldVelocity * ((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 1.25f : 1f); + Projectile.velocity = OldVelocity * ((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 1.25f : 1f); OldVelocity = Vector2.Zero; - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } // Otherwise, be sure to save the velocity the projectile started with. It will be set again when the telegraph is over. else if (OldVelocity == Vector2.Zero) { - OldVelocity = projectile.velocity; - projectile.velocity = Vector2.Zero; - projectile.netUpdate = true; - projectile.rotation = OldVelocity.ToRotation() + MathHelper.PiOver2; + OldVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + Projectile.netUpdate = true; + Projectile.rotation = OldVelocity.ToRotation() + MathHelper.PiOver2; } TelegraphDelay++; } @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Boss { if (TelegraphDelay >= TelegraphTotalTime) return true; - Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + Texture2D laserTelegraph = ModContent.Request("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); float yScale = 2f; if (TelegraphDelay < TelegraphFadeTime) { @@ -134,8 +134,8 @@ namespace CalamityMod.Projectiles.Boss colorOuter *= 0.7f; colorInner *= 0.7f; - spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, OldVelocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); - spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, OldVelocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorInner, OldVelocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorOuter, OldVelocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Boss/DoGDeathBoom.cs b/Projectiles/Boss/DoGDeathBoom.cs index d32e85a743..546b7bdbf6 100644 --- a/Projectiles/Boss/DoGDeathBoom.cs +++ b/Projectiles/Boss/DoGDeathBoom.cs @@ -19,18 +19,18 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = projectile.height = 2; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = Lifetime; + Projectile.width = Projectile.height = 2; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime; cooldownSlot = 1; } public override void PostAI() { MaxRadius = 4200f; - Lighting.AddLight(projectile.Center, 0.1f, 0.1f, 0.1f); + Lighting.AddLight(Projectile.Center, 0.1f, 0.1f, 0.1f); } } } diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index 90e9aa682f..8ef61e513c 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class DoGFire : ModProjectile @@ -12,64 +13,64 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Death Fire"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 34; - projectile.height = 34; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.extraUpdates = 1; - projectile.penetrate = -1; - projectile.timeLeft = 480; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 34; + Projectile.height = 34; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.extraUpdates = 1; + Projectile.penetrate = -1; + Projectile.timeLeft = 480; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - if (projectile.localAI[0] == 0f && projectile.ai[1] == 0f) + if (Projectile.localAI[0] == 0f && Projectile.ai[1] == 0f) { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.localAI[0] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) - projectile.frame = 0; + if (Projectile.frame > 5) + Projectile.frame = 0; - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - int dust = Dust.NewDust(new Vector2(projectile.position.X + projectile.velocity.X, projectile.position.Y + projectile.velocity.Y), projectile.width, projectile.height, 173, projectile.velocity.X, projectile.velocity.Y, 100, default, 0.8f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X + Projectile.velocity.X, Projectile.position.Y + Projectile.velocity.Y), Projectile.width, Projectile.height, 173, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 0.8f); Main.dust[dust].noGravity = true; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - if (projectile.velocity.Length() < projectile.ai[1]) - projectile.velocity *= projectile.ai[0]; + if (Projectile.velocity.Length() < Projectile.ai[1]) + Projectile.velocity *= Projectile.ai[0]; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -80,14 +81,14 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item74, (int)projectile.Center.X, (int)projectile.Center.Y); - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item74, (int)Projectile.Center.X, (int)Projectile.Center.Y); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -97,13 +98,13 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - projectile.Damage(); + Projectile.Damage(); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/DoGP1EndPortal.cs b/Projectiles/Boss/DoGP1EndPortal.cs index 0f308db262..360c9e0a9b 100644 --- a/Projectiles/Boss/DoGP1EndPortal.cs +++ b/Projectiles/Boss/DoGP1EndPortal.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Boss { public class DoGP1EndPortal : ModProjectile { - public ref float TimeCountdown => ref projectile.ai[1]; + public ref float TimeCountdown => ref Projectile.ai[1]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() @@ -20,12 +20,12 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = projectile.height = 120; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 60000; - projectile.hide = true; + Projectile.width = Projectile.height = 120; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 60000; + Projectile.hide = true; } public override void AI() @@ -33,16 +33,16 @@ namespace CalamityMod.Projectiles.Boss if (TimeCountdown > 0f) { if (TimeCountdown > 120f) - projectile.scale = MathHelper.Clamp(projectile.scale + 0.02f, 0f, 1f); + Projectile.scale = MathHelper.Clamp(Projectile.scale + 0.02f, 0f, 1f); if (TimeCountdown < 55f) - projectile.scale = MathHelper.Clamp(projectile.scale - 0.02f, 0f, 1f); + Projectile.scale = MathHelper.Clamp(Projectile.scale - 0.02f, 0f, 1f); TimeCountdown--; } else - projectile.scale = Utils.InverseLerp(60000f, 59945f, projectile.timeLeft, true) * Utils.InverseLerp(60f, 115f, CalamityWorld.DoGSecondStageCountdown, true); + Projectile.scale = Utils.InverseLerp(60000f, 59945f, Projectile.timeLeft, true) * Utils.InverseLerp(60f, 115f, CalamityWorld.DoGSecondStageCountdown, true); if ((CalamityWorld.DoGSecondStageCountdown < 60f && TimeCountdown == 0f) || NPCs.CalamityGlobalNPC.DoGHead == -1 || TimeCountdown == 1f) - projectile.Kill(); + Projectile.Kill(); } public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) @@ -54,10 +54,10 @@ namespace CalamityMod.Projectiles.Boss { spriteBatch.EnterShaderRegion(); - Texture2D noiseTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/VoronoiShapes"); - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Texture2D noiseTexture = ModContent.Request("CalamityMod/ExtraTextures/VoronoiShapes"); + Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = noiseTexture.Size() * 0.5f; - GameShaders.Misc["CalamityMod:DoGPortal"].UseOpacity(projectile.scale); + GameShaders.Misc["CalamityMod:DoGPortal"].UseOpacity(Projectile.scale); GameShaders.Misc["CalamityMod:DoGPortal"].UseColor(Color.Cyan); GameShaders.Misc["CalamityMod:DoGPortal"].UseSecondaryColor(Color.Fuchsia); GameShaders.Misc["CalamityMod:DoGPortal"].Apply(); diff --git a/Projectiles/Boss/DoGTeleportRift.cs b/Projectiles/Boss/DoGTeleportRift.cs index 076ae94603..84238e3324 100644 --- a/Projectiles/Boss/DoGTeleportRift.cs +++ b/Projectiles/Boss/DoGTeleportRift.cs @@ -18,48 +18,48 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.scale = 2.5f; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.Opacity = 0f; - projectile.penetrate = -1; - projectile.timeLeft = 200; + Projectile.width = Projectile.height = 30; + Projectile.scale = 2.5f; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.Opacity = 0f; + Projectile.penetrate = -1; + Projectile.timeLeft = 200; } public override void AI() { - if (projectile.ai[0] == -1f) + if (Projectile.ai[0] == -1f) return; - if (projectile.timeLeft < 160) - projectile.timeLeft = 160; + if (Projectile.timeLeft < 160) + Projectile.timeLeft = 160; - if (!Main.npc[(int)projectile.ai[0]].active) - projectile.Kill(); + if (!Main.npc[(int)Projectile.ai[0]].active) + Projectile.Kill(); - projectile.ai[1] += MathHelper.Pi / 30f; - projectile.Opacity = MathHelper.Clamp(projectile.ai[1], 0f, 1f); + Projectile.ai[1] += MathHelper.Pi / 30f; + Projectile.Opacity = MathHelper.Clamp(Projectile.ai[1], 0f, 1f); - if (projectile.Opacity == 1f && Main.rand.NextBool(15)) + if (Projectile.Opacity == 1f && Main.rand.NextBool(15)) { - Dust dust = Main.dust[Dust.NewDust(projectile.Top, 0, 0, 267, 0f, 0f, 100, new Color(150, 100, 255, 255), 1f)]; + Dust dust = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, 267, 0f, 0f, 100, new Color(150, 100, 255, 255), 1f)]; dust.velocity.X = 0f; dust.noGravity = true; dust.fadeIn = 1f; - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * (4f * Main.rand.NextFloat() + 26f); + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * (4f * Main.rand.NextFloat() + 26f); dust.scale = 0.5f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - float lerpMult = Utils.InverseLerp(15f, 30f, projectile.timeLeft, clamped: true) * Utils.InverseLerp(240f, 200f, projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTime % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f; + float lerpMult = Utils.InverseLerp(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.InverseLerp(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTime % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f; - Texture2D texture = Main.projectileTexture[projectile.type]; - Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - Color baseColor = new Color(150, 100, 255, 255) * projectile.Opacity; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color baseColor = new Color(150, 100, 255, 255) * Projectile.Opacity; baseColor *= 0.5f; baseColor.A = 0; Color colorA = baseColor; @@ -67,10 +67,10 @@ namespace CalamityMod.Projectiles.Boss colorA *= lerpMult; colorB *= lerpMult; Vector2 origin = texture.Size() / 2f; - Vector2 scale = new Vector2(3f, 9f) * projectile.Opacity * lerpMult; + Vector2 scale = new Vector2(3f, 9f) * Projectile.Opacity * lerpMult; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver2, origin, scale, spriteEffects, 0); @@ -78,27 +78,27 @@ namespace CalamityMod.Projectiles.Boss spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver2, origin, scale * 0.8f, spriteEffects, 0); spriteBatch.Draw(texture, drawPos, null, colorB, 0f, origin, scale * 0.8f, spriteEffects, 0); - spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver2 + projectile.ai[1] * 0.25f, origin, scale, spriteEffects, 0); - spriteBatch.Draw(texture, drawPos, null, colorA, projectile.ai[1] * 0.25f, origin, scale, spriteEffects, 0); - spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver2 + projectile.ai[1] * 0.5f, origin, scale * 0.8f, spriteEffects, 0); - spriteBatch.Draw(texture, drawPos, null, colorB, projectile.ai[1] * 0.5f, origin, scale * 0.8f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver2 + Projectile.ai[1] * 0.25f, origin, scale, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorA, Projectile.ai[1] * 0.25f, origin, scale, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver2 + Projectile.ai[1] * 0.5f, origin, scale * 0.8f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, Projectile.ai[1] * 0.5f, origin, scale * 0.8f, spriteEffects, 0); spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver4, origin, scale * 0.6f, spriteEffects, 0); spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver4 * 3f, origin, scale * 0.6f, spriteEffects, 0); spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4, origin, scale * 0.4f, spriteEffects, 0); spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4 * 3f, origin, scale * 0.4f, spriteEffects, 0); - spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver4 + projectile.ai[1] * 0.75f, origin, scale * 0.6f, spriteEffects, 0); - spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver4 * 3f + projectile.ai[1] * 0.75f, origin, scale * 0.6f, spriteEffects, 0); - spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4 + projectile.ai[1], origin, scale * 0.4f, spriteEffects, 0); - spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4 * 3f + projectile.ai[1], origin, scale * 0.4f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver4 + Projectile.ai[1] * 0.75f, origin, scale * 0.6f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver4 * 3f + Projectile.ai[1] * 0.75f, origin, scale * 0.6f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4 + Projectile.ai[1], origin, scale * 0.4f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4 * 3f + Projectile.ai[1], origin, scale * 0.4f, spriteEffects, 0); return false; } public override void Kill(int timeLeft) { - if (projectile.ai[0] == -1f) + if (Projectile.ai[0] == -1f) return; int dustAmt = 50; @@ -109,8 +109,8 @@ namespace CalamityMod.Projectiles.Boss random += j * 2; int dustAmtSpawned = 0; int scale = random * 13; - float dustPositionX = projectile.Center.X - (scale / 2); - float dustPositionY = projectile.Center.Y - (scale / 2); + float dustPositionX = Projectile.Center.X - (scale / 2); + float dustPositionY = Projectile.Center.Y - (scale / 2); while (dustAmtSpawned < dustAmt) { float dustVelocityX = Main.rand.Next(-random, random); @@ -122,8 +122,8 @@ namespace CalamityMod.Projectiles.Boss dustVelocityY *= dustVelocity; int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 5f); Main.dust[dust].noGravity = true; - Main.dust[dust].position.X = projectile.Center.X; - Main.dust[dust].position.Y = projectile.Center.Y; + Main.dust[dust].position.X = Projectile.Center.X; + Main.dust[dust].position.Y = Projectile.Center.Y; Main.dust[dust].position.X += Main.rand.Next(-10, 11); Main.dust[dust].position.Y += Main.rand.Next(-10, 11); Main.dust[dust].velocity.X = dustVelocityX; diff --git a/Projectiles/Boss/DraedonSummonLaser.cs b/Projectiles/Boss/DraedonSummonLaser.cs index e379fc7a96..afac20d8c9 100644 --- a/Projectiles/Boss/DraedonSummonLaser.cs +++ b/Projectiles/Boss/DraedonSummonLaser.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -21,24 +22,24 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = projectile.height = 24; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.hide = true; - projectile.timeLeft = Lifetime; + Projectile.width = Projectile.height = 24; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.hide = true; + Projectile.timeLeft = Lifetime; } - public override bool CanDamage() => projectile.timeLeft < Lifetime - 30; + public override bool CanDamage() => Projectile.timeLeft < Lifetime - 30; public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), Projectile.Center); for (int i = 0; i < 36; i++) { - Dust exoDust = Dust.NewDustPerfect(projectile.BottomRight, 267); + Dust exoDust = Dust.NewDustPerfect(Projectile.BottomRight, 267); exoDust.color = CalamityUtils.MulticolorLerp(i / 36f, CalamityUtils.ExoPalette); exoDust.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * new Vector2(3f, 1.45f) - Vector2.UnitY * 2f; exoDust.scale = 2.8f; @@ -48,23 +49,23 @@ namespace CalamityMod.Projectiles.Boss for (int i = 0; i < 10; i++) { - Dust exoDust = Dust.NewDustPerfect(projectile.BottomRight, 267); + Dust exoDust = Dust.NewDustPerfect(Projectile.BottomRight, 267); exoDust.color = CalamityUtils.MulticolorLerp(Main.rand.NextFloat(), CalamityUtils.ExoPalette); exoDust.velocity = Main.rand.NextVector2Circular(2f, 2f); exoDust.scale = 4f; exoDust.fadeIn = 2f; exoDust.noGravity = true; } - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } - Lighting.AddLight(projectile.Center, Color.White.ToVector3()); - projectile.scale = Utils.InverseLerp(-1f, 15f, projectile.timeLeft, true) * Utils.InverseLerp(Lifetime + 1f, Lifetime - 15f, projectile.timeLeft, true); + Lighting.AddLight(Projectile.Center, Color.White.ToVector3()); + Projectile.scale = Utils.InverseLerp(-1f, 15f, Projectile.timeLeft, true) * Utils.InverseLerp(Lifetime + 1f, Lifetime - 15f, Projectile.timeLeft, true); } private float PrimitiveWidthFunction(float completionRatio) { - return Utils.InverseLerp(1f, 0.96f, completionRatio, true) * Utils.InverseLerp(0f, 0.016f, completionRatio, true) * projectile.scale * 20f; + return Utils.InverseLerp(1f, 0.96f, completionRatio, true) * Utils.InverseLerp(0f, 0.016f, completionRatio, true) * Projectile.scale * 20f; } private Color PrimitiveColorFunction(float completionRatio) @@ -81,16 +82,16 @@ namespace CalamityMod.Projectiles.Boss Vector2[] basePoints = new Vector2[8]; for (int i = 0; i < basePoints.Length; i++) - basePoints[i] = projectile.Center - Vector2.UnitY * i / basePoints.Length * LaserLength; + basePoints[i] = Projectile.Center - Vector2.UnitY * i / basePoints.Length * LaserLength; - Vector2 overallOffset = projectile.Size * 0.5f - Main.screenPosition; + Vector2 overallOffset = Projectile.Size * 0.5f - Main.screenPosition; RayDrawer.Draw(basePoints, overallOffset, 92); return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center - Vector2.UnitY * LaserLength); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center - Vector2.UnitY * LaserLength); } public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) diff --git a/Projectiles/Boss/DyingSun.cs b/Projectiles/Boss/DyingSun.cs index 5636990498..d58f38d1f0 100644 --- a/Projectiles/Boss/DyingSun.cs +++ b/Projectiles/Boss/DyingSun.cs @@ -11,37 +11,37 @@ namespace CalamityMod.Projectiles.Boss public class DyingSun : ModProjectile { public PrimitiveTrail FireDrawer; - public ref float Time => ref projectile.ai[0]; - public ref float Radius => ref projectile.ai[1]; + public ref float Time => ref Projectile.ai[0]; + public ref float Radius => ref Projectile.ai[1]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() => DisplayName.SetDefault("Dying Sun"); public override void SetDefaults() { - projectile.width = 164; - projectile.height = 164; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 100; - projectile.MaxUpdates = 2; - projectile.scale = 1f; + Projectile.width = 164; + Projectile.height = 164; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 100; + Projectile.MaxUpdates = 2; + Projectile.scale = 1f; } public override void AI() { - projectile.scale += 0.08f; - Radius = projectile.scale * 42f; - projectile.Opacity = Utils.InverseLerp(8f, 42f, projectile.timeLeft, true); + Projectile.scale += 0.08f; + Radius = Projectile.scale * 42f; + Projectile.Opacity = Utils.InverseLerp(8f, 42f, Projectile.timeLeft, true); Time++; } - public float SunWidthFunction(float completionRatio) => Radius * projectile.scale * (float)Math.Sin(MathHelper.Pi * completionRatio); + public float SunWidthFunction(float completionRatio) => Radius * Projectile.scale * (float)Math.Sin(MathHelper.Pi * completionRatio); public Color SunColorFunction(float completionRatio) { Color sunColor = Main.dayTime ? Color.Yellow : Color.Cyan; - return Color.Lerp(sunColor, Color.White, (float)Math.Sin(MathHelper.Pi * completionRatio) * 0.5f + 0.3f) * projectile.Opacity; + return Color.Lerp(sunColor, Color.White, (float)Math.Sin(MathHelper.Pi * completionRatio) * 0.5f + 0.3f) * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Boss for (int i = 0; i < 16; i++) { rotationPoints.Add(adjustedAngle); - drawPoints.Add(Vector2.Lerp(projectile.Center - offsetDirection * Radius / 2f, projectile.Center + offsetDirection * Radius / 2f, i / 16f)); + drawPoints.Add(Vector2.Lerp(Projectile.Center - offsetDirection * Radius / 2f, Projectile.Center + offsetDirection * Radius / 2f, i / 16f)); } FireDrawer.Draw(drawPoints, -Main.screenPosition, 24); diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs index 69f9b9f4dc..dcb7e93d72 100644 --- a/Projectiles/Boss/EssenceDust.cs +++ b/Projectiles/Boss/EssenceDust.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class EssenceDust : ModProjectile @@ -15,23 +16,23 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 46; - projectile.height = 46; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; + Projectile.width = 46; + Projectile.height = 46; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; cooldownSlot = 1; } public override void AI() { - projectile.velocity *= 0.985f; - Lighting.AddLight(projectile.Center, 0.45f, 0f, 0.55f); + Projectile.velocity *= 0.985f; + Lighting.AddLight(Projectile.Center, 0.45f, 0f, 0.55f); for (int num468 = 0; num468 < 5; num468++) { - int num469 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 0.5f); + int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 0.5f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -39,14 +40,14 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item74, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position = projectile.Center; - projectile.width = projectile.height = 96; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item74, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 96; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -56,13 +57,13 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 15; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - projectile.Damage(); + Projectile.Damage(); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Boss/Flare.cs b/Projectiles/Boss/Flare.cs index 793f937b61..c745d93e32 100644 --- a/Projectiles/Boss/Flare.cs +++ b/Projectiles/Boss/Flare.cs @@ -7,6 +7,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -15,100 +16,100 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Flare"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 100; - projectile.height = 100; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; + Projectile.width = 100; + Projectile.height = 100; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } float num630 = 0.209439516f; float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; + float num632 = (float)(Math.Cos((double)(num630 * Projectile.ai[0])) - 0.5) * num631; + Projectile.velocity.Y = Projectile.velocity.Y - num632; + Projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * Projectile.ai[0])) - 0.5) * num631; + Projectile.velocity.Y = Projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 10f) { - projectile.alpha -= 5; - if (projectile.alpha < 100) + Projectile.alpha -= 5; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } } - if (projectile.wet) + if (Projectile.wet) { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); + Projectile.position.Y = Projectile.position.Y - 16f; + Projectile.Kill(); } } public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 53, projectile.alpha); + return new Color(255, Main.DiscoG, 53, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - Main.PlaySound(SoundID.Item20, projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); + int num231 = (int)(Projectile.Center.Y / 16f); + int num232 = (int)(Projectile.Center.X / 16f); int num233 = 100; if (num232 < 10) { @@ -129,13 +130,13 @@ namespace CalamityMod.Projectiles.Boss for (int num234 = num231; num234 < num231 + num233; num234++) { Tile tile = Main.tile[num232, num234]; - if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + if (tile.active() && (Main.tileSolid[(int)tile.TileType] || tile.liquid != 0)) { num231 = num234; break; } } - int spawnLimitY = (int)(Main.player[projectile.owner].Center.Y / 16f) + 25; + int spawnLimitY = (int)(Main.player[Projectile.owner].Center.Y / 16f) + 25; if (num231 > spawnLimitY) { num231 = spawnLimitY; diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index 6d9e2f1e96..03e9e1cf1b 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class FlareBomb : ModProjectile @@ -13,20 +14,20 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Flare Bomb"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 64; - projectile.height = 66; - projectile.hostile = true; - projectile.scale = 1.5f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.alpha = 50; - projectile.timeLeft = 180; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 64; + Projectile.height = 66; + Projectile.hostile = true; + Projectile.scale = 1.5f; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.alpha = 50; + Projectile.timeLeft = 180; cooldownSlot = 1; } @@ -34,49 +35,49 @@ namespace CalamityMod.Projectiles.Boss { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); - if (projectile.timeLeft > 30 && projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - projectile.alpha = 128; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.timeLeft > 30 && Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.timeLeft > 30 && Projectile.alpha < 128 && Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + Projectile.alpha = 128; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - if (projectile.ai[0] == -1f || (projectile.timeLeft > 135 && projectile.ai[1] == 1f)) + if (Projectile.ai[0] == -1f || (Projectile.timeLeft > 135 && Projectile.ai[1] == 1f)) return; float inertia = revenge ? 70f : 77f; float num954 = 40f; float scaleFactor12 = revenge ? 35f : 28f; - int num959 = (int)projectile.ai[0]; + int num959 = (int)Projectile.ai[0]; if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) { - if (projectile.Distance(Main.player[num959].Center) > num954) + if (Projectile.Distance(Main.player[num959].Center) > num954) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[num959].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * scaleFactor12) / inertia; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[num959].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * scaleFactor12) / inertia; } } else { - if (projectile.ai[0] != -1f) + if (Projectile.ai[0] != -1f) { - projectile.ai[0] = -1f; - projectile.netUpdate = true; + Projectile.ai[0] = -1f; + Projectile.netUpdate = true; } } - if (projectile.timeLeft < 60) + if (Projectile.timeLeft < 60) return; float num1247 = 0.5f; @@ -84,43 +85,43 @@ namespace CalamityMod.Projectiles.Boss { if (Main.projectile[num1248].active) { - if (num1248 != projectile.whoAmI && Main.projectile[num1248].type == projectile.type) + if (num1248 != Projectile.whoAmI && Main.projectile[num1248].type == Projectile.type) { - if (Vector2.Distance(projectile.Center, Main.projectile[num1248].Center) < 24f) + if (Vector2.Distance(Projectile.Center, Main.projectile[num1248].Center) < 24f) { - if (projectile.position.X < Main.projectile[num1248].position.X) - projectile.velocity.X -= num1247; + if (Projectile.position.X < Main.projectile[num1248].position.X) + Projectile.velocity.X -= num1247; else - projectile.velocity.X += num1247; + Projectile.velocity.X += num1247; - if (projectile.position.Y < Main.projectile[num1248].position.Y) - projectile.velocity.Y -= num1247; + if (Projectile.position.Y < Main.projectile[num1248].position.Y) + Projectile.velocity.Y -= num1247; else - projectile.velocity.Y += num1247; + Projectile.velocity.Y += num1247; } } } } } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Rectangle(0, y6, texture2D13.Width, num214), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle(0, y6, texture2D13.Width, num214), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 48); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 48); for (int d = 0; d < 2; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -130,17 +131,17 @@ namespace CalamityMod.Projectiles.Boss } for (int d = 0; d < 4; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); - projectile.Damage(); + CalamityUtils.ExplosionGores(Projectile.Center, 3); + Projectile.Damage(); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 16f * projectile.scale, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 16f * Projectile.scale, targetHitbox); public override void OnHitPlayer(Player target, int damage, bool crit) { diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index 0612388481..68ca48e652 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.cs @@ -6,6 +6,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class FlareDust : ModProjectile @@ -20,26 +21,26 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Flare Dust"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 64; - projectile.height = 66; - projectile.scale = 1.5f; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 680; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 64; + Projectile.height = 66; + Projectile.scale = 1.5f; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 680; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); writer.Write(start); writer.Write(startingPosX); writer.Write(startingPosY); @@ -48,7 +49,7 @@ namespace CalamityMod.Projectiles.Boss public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); start = reader.ReadBoolean(); startingPosX = reader.ReadSingle(); startingPosY = reader.ReadSingle(); @@ -57,74 +58,74 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) return; if (start) { - startingPosX = projectile.Center.X; - startingPosY = projectile.Center.Y; + startingPosX = Projectile.Center.X; + startingPosY = Projectile.Center.Y; start = false; } - float amount = projectile.localAI[0] / 120f; + float amount = Projectile.localAI[0] / 120f; if (amount > 1f) amount = 1f; distance += MathHelper.Lerp(1f, 9f, amount); - if (projectile.timeLeft < 380) + if (Projectile.timeLeft < 380) { - float amount2 = (projectile.localAI[0] - 300f) / 240f; + float amount2 = (Projectile.localAI[0] - 300f) / 240f; if (amount2 > 1f) amount2 = 1f; distance += MathHelper.Lerp(1f, 9f, amount2); } - double rad = MathHelper.ToRadians(projectile.ai[1]); - if (projectile.ai[0] == 0f) + double rad = MathHelper.ToRadians(Projectile.ai[1]); + if (Projectile.ai[0] == 0f) { - projectile.position.X = startingPosX - (int)(Math.Sin(rad) * distance) - projectile.width / 2; - projectile.position.Y = startingPosY - (int)(Math.Cos(rad) * distance) - projectile.height / 2; + Projectile.position.X = startingPosX - (int)(Math.Sin(rad) * distance) - Projectile.width / 2; + Projectile.position.Y = startingPosY - (int)(Math.Cos(rad) * distance) - Projectile.height / 2; } else { - projectile.position.X = startingPosX - (int)(Math.Cos(rad) * distance) - projectile.width / 2; - projectile.position.Y = startingPosY - (int)(Math.Sin(rad) * distance) - projectile.height / 2; + Projectile.position.X = startingPosX - (int)(Math.Cos(rad) * distance) - Projectile.width / 2; + Projectile.position.Y = startingPosY - (int)(Math.Sin(rad) * distance) - Projectile.height / 2; } - projectile.ai[1] += (1.1f - amount) * 0.5f; - projectile.localAI[0] += 1f; + Projectile.ai[1] += (1.1f - amount) * 0.5f; + Projectile.localAI[0] += 1f; } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 48); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 48); for (int d = 0; d < 2; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -134,26 +135,26 @@ namespace CalamityMod.Projectiles.Boss } for (int d = 0; d < 4; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); - projectile.Damage(); + CalamityUtils.ExplosionGores(Projectile.Center, 3); + Projectile.Damage(); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 16f * projectile.scale, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 16f * Projectile.scale, targetHitbox); public override bool CanHitPlayer(Player target) { Rectangle targetHitbox = target.Hitbox; - float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); + float dist1 = Vector2.Distance(Projectile.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(Projectile.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(Projectile.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(Projectile.Center, targetHitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -163,7 +164,7 @@ namespace CalamityMod.Projectiles.Boss if (dist4 < minDist) minDist = dist4; - return minDist <= 16f * projectile.scale; + return minDist <= 16f * Projectile.scale; } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index c66fa249a2..91f85f31e9 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -6,6 +6,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class FlareDust2 : ModProjectile @@ -18,20 +19,20 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Flare Bomb"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 64; - projectile.height = 66; - projectile.scale = 1.5f; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 840; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 64; + Projectile.height = 66; + Projectile.scale = 1.5f; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 840; cooldownSlot = 1; } @@ -49,89 +50,89 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - if (projectile.timeLeft < 630) + if (Projectile.timeLeft < 630) { - if (projectile.velocity.Length() < 6f) + if (Projectile.velocity.Length() < 6f) { - projectile.velocity *= 1.025f; + Projectile.velocity *= 1.025f; } else { if (start) { - velocity = projectile.velocity; + velocity = Projectile.velocity; start = false; } - projectile.ai[1] += 0.1f; + Projectile.ai[1] += 0.1f; float amplitude = 2f; - float wavyVelocity = (float)Math.Cos(projectile.ai[1]); + float wavyVelocity = (float)Math.Cos(Projectile.ai[1]); - projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity) * amplitude; + Projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity) * amplitude; } } } else { - if (projectile.timeLeft < 420) + if (Projectile.timeLeft < 420) { - if (projectile.velocity.Length() < 12f) + if (Projectile.velocity.Length() < 12f) { - projectile.velocity *= 1.05f; + Projectile.velocity *= 1.05f; } else { if (start) { - velocity = projectile.velocity; + velocity = Projectile.velocity; start = false; } - projectile.ai[1] += 0.1f; + Projectile.ai[1] += 0.1f; float amplitude = 2f; - float wavyVelocity = (float)Math.Sin(projectile.ai[1]); + float wavyVelocity = (float)Math.Sin(Projectile.ai[1]); - projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity) * amplitude; + Projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity) * amplitude; } } } - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 48); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 48); for (int d = 0; d < 2; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -141,17 +142,17 @@ namespace CalamityMod.Projectiles.Boss } for (int d = 0; d < 4; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); - projectile.Damage(); + CalamityUtils.ExplosionGores(Projectile.Center, 3); + Projectile.Damage(); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 16f * projectile.scale, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 16f * Projectile.scale, targetHitbox); public override void OnHitPlayer(Player target, int damage, bool crit) { diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs index 98b0569004..37a4ee3966 100644 --- a/Projectiles/Boss/Flarenado.cs +++ b/Projectiles/Boss/Flarenado.cs @@ -13,31 +13,31 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Flarenado"); - Main.projFrames[projectile.type] = 12; + Main.projFrames[Projectile.type] = 12; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 320; - projectile.height = 88; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 600; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 320; + Projectile.height = 88; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.timeLeft = 600; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() @@ -47,100 +47,100 @@ namespace CalamityMod.Projectiles.Boss float baseWidth = 320f; float baseHeight = 88f; - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); + Projectile.direction = Projectile.spriteDirection = -Math.Sign(Projectile.velocity.X); } - projectile.frameCounter++; - if (projectile.frameCounter > 2) + Projectile.frameCounter++; + if (Projectile.frameCounter > 2) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.scale = (scaleBase - projectile.ai[1]) * scaleMult / scaleBase; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(baseWidth * projectile.scale), (int)(baseHeight * projectile.scale)); - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.scale = (scaleBase - Projectile.ai[1]) * scaleMult / scaleBase; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, (int)(baseWidth * Projectile.scale), (int)(baseHeight * Projectile.scale)); + Projectile.netUpdate = true; } - if (projectile.ai[1] != -1f) + if (Projectile.ai[1] != -1f) { - projectile.scale = (scaleBase - projectile.ai[1]) * scaleMult / scaleBase; - projectile.width = (int)(baseWidth * projectile.scale); - projectile.height = (int)(baseHeight * projectile.scale); + Projectile.scale = (scaleBase - Projectile.ai[1]) * scaleMult / scaleBase; + Projectile.width = (int)(baseWidth * Projectile.scale); + Projectile.height = (int)(baseHeight * Projectile.scale); } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (!Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.alpha -= 30; - if (projectile.alpha < 60) + Projectile.alpha -= 30; + if (Projectile.alpha < 60) { - projectile.alpha = 60; + Projectile.alpha = 60; } } else { - projectile.alpha += 30; - if (projectile.alpha > 150) + Projectile.alpha += 30; + if (Projectile.alpha > 150) { - projectile.alpha = 150; + Projectile.alpha = 150; } } - if (projectile.ai[0] > 0f) + if (Projectile.ai[0] > 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + if (Projectile.ai[0] == 1f && Projectile.ai[1] > 0f && Projectile.owner == Main.myPlayer) { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= baseHeight * projectile.scale / 2f; - float num618 = (scaleBase - projectile.ai[1] + 1f) * scaleMult / scaleBase; + Projectile.netUpdate = true; + Vector2 center = Projectile.Center; + center.Y -= baseHeight * Projectile.scale / 2f; + float num618 = (scaleBase - Projectile.ai[1] + 1f) * scaleMult / scaleBase; center.Y -= baseHeight * num618 / 2f; center.Y += 2f; - Projectile.NewProjectile(center, projectile.velocity, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 11f, projectile.ai[1] - 1f); + Projectile.NewProjectile(center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 11f, Projectile.ai[1] - 1f); } - if (projectile.ai[0] <= 0f) + if (Projectile.ai[0] <= 0f) { float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; + float num623 = (float)Projectile.width / 5f; num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X -= num624 * -projectile.direction; - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X += num624 * -projectile.direction; + float num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; + Projectile.position.X -= num624 * -Projectile.direction; + Projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; + Projectile.position.X += num624 * -Projectile.direction; } - if (projectile.timeLeft == 480) - projectile.damage = projectile.GetProjectileDamage(ModContent.NPCType()); + if (Projectile.timeLeft == 480) + Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); } - public override bool CanHitPlayer(Player target) => projectile.timeLeft <= 480; + public override bool CanHitPlayer(Player target) => Projectile.timeLeft <= 480; public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 53, projectile.alpha); + return new Color(255, 255, 53, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.timeLeft <= 480) + if (Projectile.timeLeft <= 480) target.AddBuff(ModContent.BuffType(), 300); } diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index c8b2290b5d..459b029f35 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -13,53 +13,53 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Frost Mist"); - Main.projFrames[projectile.type] = 8; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 8; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.Opacity = 0f; - projectile.coldDamage = true; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.Opacity = 0f; + Projectile.coldDamage = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -67,66 +67,66 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 16f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 16f) { - projectile.localAI[1] = 0f; + Projectile.localAI[1] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * -projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * -Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy(projectile.rotation - MathHelper.PiOver2); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy(Projectile.rotation - MathHelper.PiOver2); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 187, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } - if (projectile.timeLeft < 30) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); + if (Projectile.timeLeft < 30) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 270) / 30f), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 270) / 30f), 0f, 1f); - int num103 = Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 140f && projectile.ai[1] > 60f) + int num103 = Player.FindClosest(Projectile.Center, 1, 1); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] < 140f && Projectile.ai[1] > 60f) { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; + float scaleFactor2 = Projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - Projectile.Center; vector11.Normalize(); vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 24f + vector11) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; } - if (projectile.velocity.Length() < 12f) - projectile.velocity *= 1.02f; + if (Projectile.velocity.Length() < 12f) + Projectile.velocity *= 1.02f; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - Lighting.AddLight(projectile.Center, 0f, 0.35f * projectile.Opacity, 0.35f * projectile.Opacity); + Lighting.AddLight(Projectile.Center, 0f, 0.35f * Projectile.Opacity, 0.35f * Projectile.Opacity); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; target.AddBuff(BuffID.Frostburn, 120, true); diff --git a/Projectiles/Boss/GreatSandBlast.cs b/Projectiles/Boss/GreatSandBlast.cs index 920b6f84d9..ac2c48f9ca 100644 --- a/Projectiles/Boss/GreatSandBlast.cs +++ b/Projectiles/Boss/GreatSandBlast.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -13,45 +14,45 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Great Sand Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.aiStyle = 1; - projectile.alpha = 255; + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.aiStyle = 1; + Projectile.alpha = 255; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - projectile.tileCollide = projectile.timeLeft < 240; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.tileCollide = Projectile.timeLeft < 240; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - projectile.alpha -= 50; - if (projectile.alpha < 0) + Projectile.alpha -= 50; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -59,23 +60,23 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 32; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.2f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.Damage(); + Projectile.Damage(); } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -85,7 +86,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/HealOrbProv.cs b/Projectiles/Boss/HealOrbProv.cs index 1418f32c90..28186bb3a0 100644 --- a/Projectiles/Boss/HealOrbProv.cs +++ b/Projectiles/Boss/HealOrbProv.cs @@ -18,28 +18,28 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 3; } public override void AI() { - int num487 = (int)projectile.ai[0]; + int num487 = (int)Projectile.ai[0]; float num488 = 2.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector36 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num489 = Main.player[num487].Center.X - vector36.X; float num490 = Main.player[num487].Center.Y - vector36.Y; float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + if (num491 < 50f && Projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && Projectile.position.X + (float)Projectile.width > Main.player[num487].position.X && Projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && Projectile.position.Y + (float)Projectile.height > Main.player[num487].position.Y) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int num492 = (int)projectile.ai[1]; + int num492 = (int)Projectile.ai[1]; Main.player[num487].HealEffect(num492, false); Main.player[num487].statLife += num492; if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) @@ -52,18 +52,18 @@ namespace CalamityMod.Projectiles.Boss } NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); } - projectile.Kill(); + Projectile.Kill(); } num491 = num488 / num491; num489 *= num491; num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + Projectile.velocity.X = (Projectile.velocity.X * 15f + num489) / 16f; + Projectile.velocity.Y = (Projectile.velocity.Y * 15f + num490) / 16f; for (int num497 = 0; num497 < 1; num497++) { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1f); + float num498 = Projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(Projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1f); Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; diff --git a/Projectiles/Boss/HellfireExplosion.cs b/Projectiles/Boss/HellfireExplosion.cs index 09524a68d4..62c273c0d2 100644 --- a/Projectiles/Boss/HellfireExplosion.cs +++ b/Projectiles/Boss/HellfireExplosion.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class HellfireExplosion : ModProjectile @@ -18,67 +19,67 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 130; - projectile.height = 130; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 180; + Projectile.width = 130; + Projectile.height = 130; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.localAI[0] += 1f; } bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -89,10 +90,10 @@ namespace CalamityMod.Projectiles.Boss num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + int num467 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; + Main.dust[num467].position.X = Projectile.Center.X; + Main.dust[num467].position.Y = Projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index ac279a7942..66852b5727 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -13,96 +14,96 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Hive Bomb"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 22; - projectile.height = 22; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 22; + Projectile.height = 22; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - if (projectile.velocity.Length() < 18f) - projectile.velocity *= 1.01f + (projectile.ai[0] * 0.0002f); + if (Projectile.velocity.Length() < 18f) + Projectile.velocity *= 1.01f + (Projectile.ai[0] * 0.0002f); - if (projectile.position.Y > projectile.ai[1]) - projectile.tileCollide = true; + if (Projectile.position.Y > Projectile.ai[1]) + Projectile.tileCollide = true; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - if (Math.Abs(projectile.velocity.X) >= 3f || Math.Abs(projectile.velocity.Y) >= 3f) + if (Math.Abs(Projectile.velocity.X) >= 3f || Math.Abs(Projectile.velocity.Y) >= 3f) { float num247 = 0f; float num248 = 0f; if (Main.rand.Next(2) == 1) { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; + num247 = Projectile.velocity.X * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); + int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.25f); + num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.25f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } else if (Main.rand.NextBool(4)) { - int num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 0.5f); + int num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 0.5f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(50, 250, 50, projectile.alpha); + return new Color(50, 250, 50, Projectile.alpha); } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -112,13 +113,13 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Boss/HolyAura.cs b/Projectiles/Boss/HolyAura.cs index fbbf5f769f..fbeb0c9166 100644 --- a/Projectiles/Boss/HolyAura.cs +++ b/Projectiles/Boss/HolyAura.cs @@ -15,32 +15,32 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.aiStyle = -1; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.aiStyle = -1; aiType = -1; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 210; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 210; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; Vector2 origin = texture.Size() / 2f; float time = Main.GlobalTime % 10f / 10f; - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; int drawnAmt = 30; float[] posX = new float[drawnAmt]; float[] posY = new float[drawnAmt]; float[] hue = new float[drawnAmt]; float[] size = new float[drawnAmt]; int totalTime = 210; - float colorChangeAmt = Utils.InverseLerp(0f, 60f, projectile.timeLeft, true) * Utils.InverseLerp(totalTime, totalTime - 60, projectile.timeLeft, true); - float colorChangeAmt2 = Utils.InverseLerp(0f, 60f, projectile.timeLeft, true) * Utils.InverseLerp(totalTime, 90f, projectile.timeLeft, true); + float colorChangeAmt = Utils.InverseLerp(0f, 60f, Projectile.timeLeft, true) * Utils.InverseLerp(totalTime, totalTime - 60, Projectile.timeLeft, true); + float colorChangeAmt2 = Utils.InverseLerp(0f, 60f, Projectile.timeLeft, true) * Utils.InverseLerp(totalTime, 90f, Projectile.timeLeft, true); colorChangeAmt2 = Utils.InverseLerp(0.2f, 0.5f, colorChangeAmt2, true); float sizeScale = 0.8f; float sizeScalar = (1f - sizeScale) / drawnAmt; @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Boss Color color = Main.hslToRgb(hue[i] % 1f, 1f, 0.5f) * colorChangeAmt * colorChangeAmt2; - bool underworld = projectile.ai[0] == 2f; + bool underworld = Projectile.ai[0] == 2f; if (Main.dayTime) { color.R = 255; @@ -84,9 +84,9 @@ namespace CalamityMod.Projectiles.Boss color.A /= 4; int fadeTime = 30; - if (projectile.timeLeft < fadeTime) + if (Projectile.timeLeft < fadeTime) { - float amount2 = projectile.timeLeft / (float)fadeTime; + float amount2 = Projectile.timeLeft / (float)fadeTime; if (color.R > 0) color.R = (byte)MathHelper.Lerp(0, color.R, amount2); diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index cbda9a2b87..5fbc114725 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -8,6 +8,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -16,43 +17,43 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Blast"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 180; - projectile.height = 180; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 180; + Projectile.height = 180; + Projectile.hostile = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.wet || projectile.lavaWet) + if (Projectile.wet || Projectile.lavaWet) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { int dustType = (Main.dayTime && !CalamityWorld.malice) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -60,50 +61,50 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } - if (Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(Projectile.velocity.X) > 0.2) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); } else { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); } } public override Color? GetAlpha(Color lightColor) { - return (Main.dayTime && !CalamityWorld.malice) ? new Color(250, 150, 0, projectile.alpha) : new Color(100, 200, 250, projectile.alpha); + return (Main.dayTime && !CalamityWorld.malice) ? new Color(250, 150, 0, Projectile.alpha) : new Color(100, 200, 250, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = (Main.dayTime && !CalamityWorld.malice) ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/HolyBlastNight"); - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = (Main.dayTime && !CalamityWorld.malice) ? Main.projectileTexture[Projectile.type] : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight"); + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Vector2 shootFromVector = new Vector2(projectile.Center.X, projectile.Center.Y); + Vector2 shootFromVector = new Vector2(Projectile.Center.X, Projectile.Center.Y); float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; float velocity = 5f; int totalProjectiles = (!Main.dayTime || CalamityWorld.malice || BossRushEvent.BossRushActive) ? 5 : 4; int type = ModContent.ProjectileType(); - int damage = (int)Math.Round(projectile.damage * 0.75); + int damage = (int)Math.Round(Projectile.damage * 0.75); for (int i = 0; i < totalProjectiles; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; @@ -111,18 +112,18 @@ namespace CalamityMod.Projectiles.Boss Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), type, damage, 0f, Main.myPlayer, 0f, 0f); } } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceHolyBlastImpact"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceHolyBlastImpact"), Projectile.Center); int dustType = (Main.dayTime && !CalamityWorld.malice) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; for (int num193 = 0; num193 < 4; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); } for (int num194 = 0; num194 < 40; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index c58a5e474d..ea9c0a816b 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -9,6 +9,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -19,20 +20,20 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Bomb"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 80; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.timeLeft = 250; - projectile.penetrate = -1; - projectile.tileCollide = false; + Projectile.width = 40; + Projectile.height = 80; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 250; + Projectile.penetrate = -1; + Projectile.tileCollide = false; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) @@ -50,71 +51,71 @@ namespace CalamityMod.Projectiles.Boss flareShootTimer--; if (flareShootTimer <= 0) { - Main.PlaySound(SoundID.Item20, projectile.Center); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); - if (projectile.owner == Main.myPlayer) + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -2f, ModContent.ProjectileType(), (int)Math.Round(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, -2f, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); } flareShootTimer = 60; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.Center); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } - projectile.velocity *= 0.975f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.velocity *= 0.975f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } public override Color? GetAlpha(Color lightColor) { - return ((Main.dayTime && !CalamityWorld.malice) || !NPC.AnyNPCs(ModContent.NPCType())) ? new Color(250, 150, 0, projectile.alpha) : new Color(100, 200, 250, projectile.alpha); + return ((Main.dayTime && !CalamityWorld.malice) || !NPC.AnyNPCs(ModContent.NPCType())) ? new Color(250, 150, 0, Projectile.alpha) : new Color(100, 200, 250, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = ((Main.dayTime && !CalamityWorld.malice) || !NPC.AnyNPCs(ModContent.NPCType())) ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/HolyBombNight"); - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = ((Main.dayTime && !CalamityWorld.malice) || !NPC.AnyNPCs(ModContent.NPCType())) ? Main.projectileTexture[Projectile.type] : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBombNight"); + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item20, projectile.Center); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 150; + Projectile.height = 150; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); int dustType = ((Main.dayTime && !CalamityWorld.malice) || !NPC.AnyNPCs(ModContent.NPCType())) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index bc12af3148..275bcd1020 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -8,6 +8,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -22,40 +23,40 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; + Projectile.width = Projectile.height = 30; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; cooldownSlot = 1; - projectile.penetrate = 1; - projectile.timeLeft = 200; - projectile.Calamity().canBreakPlayerDefense = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 200; + Projectile.Calamity().canBreakPlayerDefense = true; } public override void AI() { - if (projectile.ai[0] == 0f && (CalamityWorld.malice || BossRushEvent.BossRushActive)) - projectile.velocity *= 1.25f; + if (Projectile.ai[0] == 0f && (CalamityWorld.malice || BossRushEvent.BossRushActive)) + Projectile.velocity *= 1.25f; - if (projectile.ai[0] < 240f) + if (Projectile.ai[0] < 240f) { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; - if (projectile.timeLeft < 160) - projectile.timeLeft = 160; + if (Projectile.timeLeft < 160) + Projectile.timeLeft = 160; } - if (projectile.velocity.Length() < 16f) - projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() < 16f) + Projectile.velocity *= 1.01f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - float lerpMult = Utils.InverseLerp(15f, 30f, projectile.timeLeft, clamped: true) * Utils.InverseLerp(240f, 200f, projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTime % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f; + float lerpMult = Utils.InverseLerp(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.InverseLerp(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTime % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f; - Texture2D texture = Main.projectileTexture[projectile.type]; - Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Texture2D texture = Main.projectileTexture[Projectile.type]; + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Color baseColor = (Main.dayTime && !CalamityWorld.malice) ? new Color(255, 200, 100, 255) : new Color(100, 200, 255, 255); baseColor *= 0.5f; baseColor.A = 0; @@ -67,7 +68,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 scale = new Vector2(0.5f, 1.5f) * lerpMult; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; float upRight = MathHelper.PiOver4; @@ -88,12 +89,12 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 50); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 50); int dustType = (Main.dayTime && !CalamityWorld.malice) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; for (int d = 0; d < 5; d++) { - int holy = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[holy].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -103,10 +104,10 @@ namespace CalamityMod.Projectiles.Boss } for (int d = 0; d < 8; d++) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } } @@ -115,7 +116,7 @@ namespace CalamityMod.Projectiles.Boss { int buffType = (Main.dayTime && !CalamityWorld.malice) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 180); - projectile.Kill(); + Projectile.Kill(); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/HolyExplosionBoom.cs b/Projectiles/Boss/HolyExplosionBoom.cs index 80545d0bb4..c4fc53a29c 100644 --- a/Projectiles/Boss/HolyExplosionBoom.cs +++ b/Projectiles/Boss/HolyExplosionBoom.cs @@ -20,18 +20,18 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = projectile.height = 2; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = Lifetime; + Projectile.width = Projectile.height = 2; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime; cooldownSlot = 1; } public override void PostAI() { MaxRadius = 3000f; - Lighting.AddLight(projectile.Center, 0.1f, 0.1f, 0.1f); + Lighting.AddLight(Projectile.Center, 0.1f, 0.1f, 0.1f); } } } diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index fc1cfb8040..f1ea7fead9 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -7,6 +7,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -15,58 +16,58 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Fire"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.aiStyle = 1; - projectile.tileCollide = false; + Projectile.width = 26; + Projectile.height = 26; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.aiStyle = 1; + Projectile.tileCollide = false; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } - projectile.alpha -= (!Main.dayTime || CalamityWorld.malice || BossRushEvent.BossRushActive) ? 10 : 5; - if (projectile.alpha <= 0) + Projectile.alpha -= (!Main.dayTime || CalamityWorld.malice || BossRushEvent.BossRushActive) ? 10 : 5; + if (Projectile.alpha <= 0) { - projectile.Kill(); + Projectile.Kill(); } - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } public override Color? GetAlpha(Color lightColor) { - return (Main.dayTime && !CalamityWorld.malice) ? new Color(250, 150, 0, projectile.alpha) : new Color(100, 200, 250, projectile.alpha); + return (Main.dayTime && !CalamityWorld.malice) ? new Color(250, 150, 0, Projectile.alpha) : new Color(100, 200, 250, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = (Main.dayTime && !CalamityWorld.malice) ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/HolyFireNight"); - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = (Main.dayTime && !CalamityWorld.malice) ? Main.projectileTexture[Projectile.type] : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFireNight"); + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -75,31 +76,31 @@ namespace CalamityMod.Projectiles.Boss int randomShot = Main.rand.Next(2); if (randomShot == 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0.01f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0.01f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0.01f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, -0.01f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } else { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0.05f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0.05f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0.05f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, -0.05f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } - Main.PlaySound(SoundID.Item20, projectile.Center); - projectile.position.X = projectile.position.X + (projectile.width / 2); - projectile.position.Y = projectile.position.Y + (projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + Projectile.position.X = Projectile.position.X + (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); + Projectile.width = 150; + Projectile.height = 150; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); int dustType = (Main.dayTime && !CalamityWorld.malice) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; @@ -108,9 +109,9 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); } } diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index a3c1cd43a4..d540e5dfe0 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -9,6 +9,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -17,84 +18,84 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Fire"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; + Projectile.width = 26; + Projectile.height = 26; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - if (Math.Abs(projectile.velocity.X) < 7f) + if (Math.Abs(Projectile.velocity.X) < 7f) { - projectile.velocity.X *= 1.05f; + Projectile.velocity.X *= 1.05f; } - int num103 = Player.FindClosest(projectile.Center, 1, 1); - if (projectile.ai[1] == 0f) + int num103 = Player.FindClosest(Projectile.Center, 1, 1); + if (Projectile.ai[1] == 0f) { - projectile.damage = projectile.GetProjectileDamage(ModContent.NPCType()); + Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); } - projectile.ai[1] += 1f; - if (projectile.ai[1] < 180f && projectile.ai[1] > 60f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] < 180f && Projectile.ai[1] > 60f) { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; + float scaleFactor2 = Projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - Projectile.Center; vector11.Normalize(); vector11 *= scaleFactor2; float inertia = (!Main.dayTime || CalamityWorld.malice || BossRushEvent.BossRushActive) ? 20f : 25f; - projectile.velocity = (projectile.velocity * (inertia - 1f) + vector11) / inertia; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + vector11) / inertia; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; } } public override Color? GetAlpha(Color lightColor) { - return (Main.dayTime && !CalamityWorld.malice) ? new Color(250, 150, 0, projectile.alpha) : new Color(100, 200, 250, projectile.alpha); + return (Main.dayTime && !CalamityWorld.malice) ? new Color(250, 150, 0, Projectile.alpha) : new Color(100, 200, 250, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = (Main.dayTime && !CalamityWorld.malice) ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/HolyFire2Night"); - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = (Main.dayTime && !CalamityWorld.malice) ? Main.projectileTexture[Projectile.type] : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night"); + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item20, projectile.Center); - projectile.position.X = projectile.position.X + (projectile.width / 2); - projectile.position.Y = projectile.position.Y + (projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + Projectile.position.X = Projectile.position.X + (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); + Projectile.width = 150; + Projectile.height = 150; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); int dustType = (Main.dayTime && !CalamityWorld.malice) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; @@ -103,9 +104,9 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); } } diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index db52145ceb..0b1310fd4d 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -8,6 +8,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -16,89 +17,89 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Flare"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 50; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.timeLeft = 840; + Projectile.width = 20; + Projectile.height = 50; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 840; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - float velocityYCap = projectile.position.Y + projectile.height < player.position.Y ? 1f : 0.25f; - projectile.velocity.Y += 0.01f; - if (projectile.velocity.Y > velocityYCap) - projectile.velocity.Y = velocityYCap; + float velocityYCap = Projectile.position.Y + Projectile.height < player.position.Y ? 1f : 0.25f; + Projectile.velocity.Y += 0.01f; + if (Projectile.velocity.Y > velocityYCap) + Projectile.velocity.Y = velocityYCap; float velocityX = (!Main.dayTime || CalamityWorld.malice || BossRushEvent.BossRushActive) ? 0.025f : 0.02f; - if (projectile.position.X + projectile.width < player.position.X) + if (Projectile.position.X + Projectile.width < player.position.X) { - if (projectile.velocity.X < 0f) - projectile.velocity.X *= 0.99f; - projectile.velocity.X += velocityX; + if (Projectile.velocity.X < 0f) + Projectile.velocity.X *= 0.99f; + Projectile.velocity.X += velocityX; } - else if (projectile.position.X > player.position.X + player.width) + else if (Projectile.position.X > player.position.X + player.width) { - if (projectile.velocity.X > 0f) - projectile.velocity.X *= 0.99f; - projectile.velocity.X -= velocityX; + if (Projectile.velocity.X > 0f) + Projectile.velocity.X *= 0.99f; + Projectile.velocity.X -= velocityX; } float velocityXCap = (!Main.dayTime || CalamityWorld.malice || BossRushEvent.BossRushActive) ? 10f : 8f; - if (projectile.velocity.X > velocityXCap || projectile.velocity.X < -velocityXCap) - projectile.velocity.X *= 0.97f; + if (Projectile.velocity.X > velocityXCap || Projectile.velocity.X < -velocityXCap) + Projectile.velocity.X *= 0.97f; - projectile.rotation = projectile.velocity.X * 0.025f; + Projectile.rotation = Projectile.velocity.X * 0.025f; } public override Color? GetAlpha(Color lightColor) { - return ((Main.dayTime && !CalamityWorld.malice) || !NPC.AnyNPCs(ModContent.NPCType())) ? new Color(250, 150, 0, projectile.alpha) : new Color(100, 200, 250, projectile.alpha); + return ((Main.dayTime && !CalamityWorld.malice) || !NPC.AnyNPCs(ModContent.NPCType())) ? new Color(250, 150, 0, Projectile.alpha) : new Color(100, 200, 250, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = ((Main.dayTime && !CalamityWorld.malice) || !NPC.AnyNPCs(ModContent.NPCType())) ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/HolyFlareNight"); - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = ((Main.dayTime && !CalamityWorld.malice) || !NPC.AnyNPCs(ModContent.NPCType())) ? Main.projectileTexture[Projectile.type] : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFlareNight"); + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item20, projectile.Center); - projectile.position.X = projectile.position.X + (projectile.width / 2); - projectile.position.Y = projectile.position.Y + (projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + Projectile.position.X = Projectile.position.X + (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); int dustType = ((Main.dayTime && !CalamityWorld.malice) || !NPC.AnyNPCs(ModContent.NPCType())) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; @@ -107,9 +108,9 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); } } diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index af3bbd0267..79c8fbf2db 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -18,38 +19,38 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 200; + Projectile.width = 20; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 200; } public override void AI() { - if (projectile.ai[0] < 240f) + if (Projectile.ai[0] < 240f) { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; - if (projectile.timeLeft < 160) - projectile.timeLeft = 160; + if (Projectile.timeLeft < 160) + Projectile.timeLeft = 160; } - if (projectile.velocity.Length() < 16f) - projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() < 16f) + Projectile.velocity *= 1.01f; - int index = Player.FindClosest(projectile.position, projectile.width, projectile.height); + int index = Player.FindClosest(Projectile.position, Projectile.width, Projectile.height); Player player = Main.player[index]; if (player is null) return; - float playerDist = Vector2.Distance(player.Center, projectile.Center); - if (!player.immune && playerDist < 50f && !player.dead && projectile.position.X < player.position.X + player.width && projectile.position.X + projectile.width > player.position.X && projectile.position.Y < player.position.Y + player.height && projectile.position.Y + projectile.height > player.position.Y) + float playerDist = Vector2.Distance(player.Center, Projectile.Center); + if (!player.immune && playerDist < 50f && !player.dead && Projectile.position.X < player.position.X + player.width && Projectile.position.X + Projectile.width > player.position.X && Projectile.position.Y < player.position.Y + player.height && Projectile.position.Y + Projectile.height > player.position.Y) { - int healAmt = (int)projectile.ai[1]; + int healAmt = (int)Projectile.ai[1]; player.HealEffect(healAmt, false); player.statLife += healAmt; if (player.statLife > player.statLifeMax2) @@ -57,29 +58,29 @@ namespace CalamityMod.Projectiles.Boss player.statLife = player.statLifeMax2; } NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, index, healAmt); - projectile.Kill(); + Projectile.Kill(); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D value = Main.projectileTexture[projectile.type]; + Texture2D value = Main.projectileTexture[Projectile.type]; Color color33 = new Color(54, 209, 54, 0); - Vector2 vector28 = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Vector2 vector28 = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Color color34 = color33; Vector2 origin5 = value.Size() / 2f; Color color35 = color33 * 0.5f; - float num162 = Utils.InverseLerp(15f, 30f, projectile.timeLeft, clamped: true) * Utils.InverseLerp(240f, 200f, projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTime % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; + float num162 = Utils.InverseLerp(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.InverseLerp(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTime % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; Vector2 vector29 = new Vector2(0.5f, 1f) * num162; Vector2 vector30 = new Vector2(0.5f, 1f) * num162; color34 *= num162; color35 *= num162; int num163 = 0; - Vector2 position3 = vector28 + projectile.velocity.SafeNormalize(Vector2.Zero) * Utils.InverseLerp(0.5f, 1f, projectile.localAI[0] / 60f, clamped: true) * num163; + Vector2 position3 = vector28 + Projectile.velocity.SafeNormalize(Vector2.Zero) * Utils.InverseLerp(0.5f, 1f, Projectile.localAI[0] / 60f, clamped: true) * num163; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; spriteBatch.Draw(value, position3, null, color34, (float)Math.PI / 2f, origin5, vector29, spriteEffects, 0); @@ -97,16 +98,16 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); - projectile.position.X = projectile.position.X + (projectile.width / 2); - projectile.position.Y = projectile.position.Y + (projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + Projectile.position.X = Projectile.position.X + (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -116,10 +117,10 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 8; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 247, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index f415d72c53..cdad997cf5 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -18,52 +18,52 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 200; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 200; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); writer.WriteVector2(velocity); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); velocity = reader.ReadVector2(); } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; - if (projectile.ai[0] == 1f) - velocity = projectile.velocity; + if (Projectile.ai[0] == 1f) + velocity = Projectile.velocity; } float timeGateValue = (!Main.dayTime || CalamityWorld.malice || BossRushEvent.BossRushActive) ? 420f : 540f; - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; float slowGateValue = (!Main.dayTime || CalamityWorld.malice || BossRushEvent.BossRushActive) ? 60f : 90f; float fastGateValue = 30f; @@ -73,25 +73,25 @@ namespace CalamityMod.Projectiles.Boss float deceleration = 0.95f; float acceleration = 1.2f; - if (projectile.localAI[1] >= timeGateValue) + if (Projectile.localAI[1] >= timeGateValue) { - if (projectile.velocity.Length() < extremeVelocity) - projectile.velocity *= acceleration; + if (Projectile.velocity.Length() < extremeVelocity) + Projectile.velocity *= acceleration; } else { - if (projectile.ai[1] <= slowGateValue) + if (Projectile.ai[1] <= slowGateValue) { - if (projectile.velocity.Length() > minVelocity) - projectile.velocity *= deceleration; + if (Projectile.velocity.Length() > minVelocity) + Projectile.velocity *= deceleration; } - else if (projectile.ai[1] < slowGateValue + fastGateValue) + else if (Projectile.ai[1] < slowGateValue + fastGateValue) { - if (projectile.velocity.Length() < maxVelocity) - projectile.velocity *= acceleration; + if (Projectile.velocity.Length() < maxVelocity) + Projectile.velocity *= acceleration; } else - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; } } else @@ -99,75 +99,75 @@ namespace CalamityMod.Projectiles.Boss float frequency = (!Main.dayTime || CalamityWorld.malice || BossRushEvent.BossRushActive) ? 0.2f : 0.1f; float amplitude = (!Main.dayTime || CalamityWorld.malice || BossRushEvent.BossRushActive) ? 4f : 2f; - projectile.ai[1] += frequency; + Projectile.ai[1] += frequency; - float wavyVelocity = (float)Math.Sin(projectile.ai[1]); + float wavyVelocity = (float)Math.Sin(Projectile.ai[1]); - projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity).RotatedBy(MathHelper.ToRadians(velocity.ToRotation())) * amplitude; + Projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity).RotatedBy(MathHelper.ToRadians(velocity.ToRotation())) * amplitude; } - if (projectile.localAI[1] < timeGateValue) + if (Projectile.localAI[1] < timeGateValue) { - projectile.localAI[1] += 1f; + Projectile.localAI[1] += 1f; - if (projectile.timeLeft < 160) - projectile.timeLeft = 160; + if (Projectile.timeLeft < 160) + Projectile.timeLeft = 160; } - projectile.Opacity = MathHelper.Lerp(240f, 220f, projectile.timeLeft); + Projectile.Opacity = MathHelper.Lerp(240f, 220f, Projectile.timeLeft); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D value = Main.projectileTexture[projectile.type]; - int green = projectile.ai[0] != 0f ? 255 : 125; - int blue = projectile.ai[0] != 0f ? 0 : 125; + Texture2D value = Main.projectileTexture[Projectile.type]; + int green = Projectile.ai[0] != 0f ? 255 : 125; + int blue = Projectile.ai[0] != 0f ? 0 : 125; Color baseColor = new Color(255, green, blue, 255); if (!Main.dayTime || CalamityWorld.malice) { - int red = projectile.ai[0] != 0f ? 100 : 175; - green = projectile.ai[0] != 0f ? 255 : 175; + int red = Projectile.ai[0] != 0f ? 100 : 175; + green = Projectile.ai[0] != 0f ? 255 : 175; baseColor = new Color(red, green, 255, 255); } Color color33 = baseColor * 0.5f; color33.A = 0; - Vector2 vector28 = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Vector2 vector28 = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Color color34 = color33; Vector2 origin5 = value.Size() / 2f; Color color35 = color33 * 0.5f; - float num162 = Utils.InverseLerp(15f, 30f, projectile.timeLeft, clamped: true) * Utils.InverseLerp(240f, 200f, projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTime % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; + float num162 = Utils.InverseLerp(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.InverseLerp(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTime % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; Vector2 vector29 = new Vector2(1f, 1.5f) * num162; Vector2 vector30 = new Vector2(0.5f, 1f) * num162; color34 *= num162; color35 *= num162; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; if (CalamityConfig.Instance.Afterimages) { - for (int i = 0; i < projectile.oldPos.Length; i++) + for (int i = 0; i < Projectile.oldPos.Length; i++) { - Vector2 drawPos = projectile.oldPos[i] + vector28; - Color color = projectile.GetAlpha(color34) * ((projectile.oldPos.Length - i) / projectile.oldPos.Length); - Main.spriteBatch.Draw(value, drawPos, null, color, projectile.rotation, origin5, vector29, spriteEffects, 0f); - Main.spriteBatch.Draw(value, drawPos, null, color, projectile.rotation, origin5, vector30, spriteEffects, 0f); + Vector2 drawPos = Projectile.oldPos[i] + vector28; + Color color = Projectile.GetAlpha(color34) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); + Main.spriteBatch.Draw(value, drawPos, null, color, Projectile.rotation, origin5, vector29, spriteEffects, 0f); + Main.spriteBatch.Draw(value, drawPos, null, color, Projectile.rotation, origin5, vector30, spriteEffects, 0f); - color = projectile.GetAlpha(color35) * ((projectile.oldPos.Length - i) / projectile.oldPos.Length); - Main.spriteBatch.Draw(value, drawPos, null, color, projectile.rotation, origin5, vector29 * 0.6f, spriteEffects, 0f); - Main.spriteBatch.Draw(value, drawPos, null, color, projectile.rotation, origin5, vector30 * 0.6f, spriteEffects, 0f); + color = Projectile.GetAlpha(color35) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); + Main.spriteBatch.Draw(value, drawPos, null, color, Projectile.rotation, origin5, vector29 * 0.6f, spriteEffects, 0f); + Main.spriteBatch.Draw(value, drawPos, null, color, Projectile.rotation, origin5, vector30 * 0.6f, spriteEffects, 0f); } } - spriteBatch.Draw(value, vector28, null, color34, projectile.rotation, origin5, vector29, spriteEffects, 0); - spriteBatch.Draw(value, vector28, null, color34, projectile.rotation, origin5, vector30, spriteEffects, 0); - spriteBatch.Draw(value, vector28, null, color35, projectile.rotation, origin5, vector29 * 0.6f, spriteEffects, 0); - spriteBatch.Draw(value, vector28, null, color35, projectile.rotation, origin5, vector30 * 0.6f, spriteEffects, 0); + spriteBatch.Draw(value, vector28, null, color34, Projectile.rotation, origin5, vector29, spriteEffects, 0); + spriteBatch.Draw(value, vector28, null, color34, Projectile.rotation, origin5, vector30, spriteEffects, 0); + spriteBatch.Draw(value, vector28, null, color35, Projectile.rotation, origin5, vector29 * 0.6f, spriteEffects, 0); + spriteBatch.Draw(value, vector28, null, color35, Projectile.rotation, origin5, vector30 * 0.6f, spriteEffects, 0); return false; } diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index d9ef369c25..651c55aa4f 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -16,63 +17,63 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.penetrate = -1; - projectile.hostile = true; - projectile.timeLeft = 300; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.penetrate = -1; + Projectile.hostile = true; + Projectile.timeLeft = 300; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - Lighting.AddLight((int)((projectile.position.X + (projectile.width / 2)) / 16f), (int)((projectile.position.Y + (projectile.height / 2)) / 16f), 0f, 0.25f, 0.25f); + Lighting.AddLight((int)((Projectile.position.X + (Projectile.width / 2)) / 16f), (int)((Projectile.position.Y + (Projectile.height / 2)) / 16f), 0f, 0.25f, 0.25f); - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; for (int num322 = 0; num322 < 2; num322++) { - int num323 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, projectile.velocity.X, projectile.velocity.Y, 50, default, 0.6f); + int num323 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); Main.dust[num323].noGravity = true; Dust dust = Main.dust[num323]; dust.velocity *= 0.3f; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.01f; - projectile.alpha -= 50; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 50; + if (Projectile.alpha <= 0) { - projectile.localAI[0] = 1f; - projectile.alpha = 0; + Projectile.localAI[0] = 1f; + Projectile.alpha = 0; } } else { - projectile.scale -= 0.01f; - projectile.alpha += 50; - if (projectile.alpha >= 255) + Projectile.scale -= 0.01f; + Projectile.alpha += 50; + if (Projectile.alpha >= 255) { - projectile.localAI[0] = 0f; - projectile.alpha = 255; + Projectile.localAI[0] = 0f; + Projectile.alpha = 255; } } } public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? new Color(50, 50, 255, projectile.alpha) : new Color(255, 255, 255, projectile.alpha); + return Main.dayTime ? new Color(50, 50, 255, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); } public override void Kill(int timeLeft) { int num497 = 5; - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); int num3; for (int num498 = 0; num498 < num497; num498 = num3 + 1) { - int num499 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, 0f, 0f, 0, default, 1f); + int num499 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, 0f, 0f, 0, default, 1f); if (Main.rand.Next(3) != 0) { Dust dust = Main.dust[num499]; @@ -98,8 +99,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs index 0fc1ac29f9..4f5c30992c 100644 --- a/Projectiles/Boss/IceBomb.cs +++ b/Projectiles/Boss/IceBomb.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -18,51 +19,51 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; - projectile.height = 30; - projectile.scale = 0.5f; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.scale = 0.5f; + Projectile.hostile = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } - public override bool CanHitPlayer(Player target) => projectile.ai[0] >= 120f; + public override bool CanHitPlayer(Player target) => Projectile.ai[0] >= 120f; public override void AI() { - projectile.velocity *= 0.99f; + Projectile.velocity *= 0.99f; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.01f; - projectile.alpha -= 50; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 50; + if (Projectile.alpha <= 0) { - projectile.localAI[0] = 1f; - projectile.alpha = 0; + Projectile.localAI[0] = 1f; + Projectile.alpha = 0; } } else { - projectile.scale -= 0.01f; - projectile.alpha += 50; - if (projectile.alpha >= 255) + Projectile.scale -= 0.01f; + Projectile.alpha += 50; + if (Projectile.alpha >= 255) { - projectile.localAI[0] = 0f; - projectile.alpha = 255; + Projectile.localAI[0] = 0f; + Projectile.alpha = 255; } } - if (projectile.ai[0] < 120f) + if (Projectile.ai[0] < 120f) { - projectile.ai[0] += 1f; - if (projectile.ai[0] == 120f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] == 120f) { for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -72,51 +73,51 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 14; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - projectile.scale = 1f; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(30f * projectile.scale)); - Main.PlaySound(SoundID.Item30, projectile.Center); + Projectile.scale = 1f; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, (int)(30f * Projectile.scale)); + SoundEngine.PlaySound(SoundID.Item30, Projectile.Center); } } } public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? new Color(50, 50, 255, projectile.alpha) : new Color(255, 255, 255, projectile.alpha); + return Main.dayTime ? new Color(50, 50, 255, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int totalProjectiles = (CalamityWorld.revenge || BossRushEvent.BossRushActive ? 3 : 2) + (int)projectile.ai[1]; + int totalProjectiles = (CalamityWorld.revenge || BossRushEvent.BossRushActive ? 3 : 2) + (int)Projectile.ai[1]; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = (int)Math.Round(projectile.damage * 0.75); + int damage = (int)Math.Round(Projectile.damage * 0.75); float velocity = CalamityWorld.revenge || BossRushEvent.BossRushActive ? 7f : 6f; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(projectile.Center, vector255, type, damage, 0f, projectile.owner, 1f, 0f); + Projectile.NewProjectile(Projectile.Center, vector255, type, damage, 0f, Projectile.owner, 1f, 0f); } } for (int k = 0; k < 10; k++) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.ai[0] >= 120f) + if (Projectile.ai[0] >= 120f) { target.AddBuff(BuffID.Frostburn, 120, true); target.AddBuff(BuffID.Chilled, 90, true); diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs index 3ebc17e9f0..43ca4f59d8 100644 --- a/Projectiles/Boss/IceRain.cs +++ b/Projectiles/Boss/IceRain.cs @@ -4,6 +4,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -16,97 +17,97 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - Lighting.AddLight((int)((projectile.position.X + (projectile.width / 2)) / 16f), (int)((projectile.position.Y + (projectile.height / 2)) / 16f), 0f, 0.25f, 0.25f); + Lighting.AddLight((int)((Projectile.position.X + (Projectile.width / 2)) / 16f), (int)((Projectile.position.Y + (Projectile.height / 2)) / 16f), 0f, 0.25f, 0.25f); - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - if (projectile.velocity.Length() < projectile.ai[1]) - projectile.velocity *= 1.015f; + if (Projectile.velocity.Length() < Projectile.ai[1]) + Projectile.velocity *= 1.015f; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; for (int num322 = 0; num322 < 2; num322++) { - int num323 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, projectile.velocity.X, projectile.velocity.Y, 50, default, 0.6f); + int num323 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); Main.dust[num323].noGravity = true; Dust dust = Main.dust[num323]; dust.velocity *= 0.3f; } } - else if (projectile.ai[0] == 1f) + else if (Projectile.ai[0] == 1f) { - projectile.aiStyle = 1; + Projectile.aiStyle = 1; for (int num322 = 0; num322 < 2; num322++) { - int num323 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, projectile.velocity.X, projectile.velocity.Y, 50, default, 0.6f); + int num323 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); Main.dust[num323].noGravity = true; Dust dust = Main.dust[num323]; dust.velocity *= 0.3f; } } - else if (projectile.ai[0] == 2f) + else if (Projectile.ai[0] == 2f) { - projectile.velocity.Y += 0.1f; + Projectile.velocity.Y += 0.1f; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - if (projectile.velocity.Y > 6f) - projectile.velocity.Y = 6f; + if (Projectile.velocity.Y > 6f) + Projectile.velocity.Y = 6f; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.01f; - projectile.alpha -= 50; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 50; + if (Projectile.alpha <= 0) { - projectile.localAI[0] = 1f; - projectile.alpha = 0; + Projectile.localAI[0] = 1f; + Projectile.alpha = 0; } } else { - projectile.scale -= 0.01f; - projectile.alpha += 50; - if (projectile.alpha >= 255) + Projectile.scale -= 0.01f; + Projectile.alpha += 50; + if (Projectile.alpha >= 255) { - projectile.localAI[0] = 0f; - projectile.alpha = 255; + Projectile.localAI[0] = 0f; + Projectile.alpha = 255; } } } public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? new Color(50, 50, 255, projectile.alpha) : new Color(255, 255, 255, projectile.alpha); + return Main.dayTime ? new Color(50, 50, 255, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 27, 0.25f); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 27, 0.25f); for (int num373 = 0; num373 < 3; num373++) { - int num374 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 76, 0f, 0f, 0, default, 1f); + int num374 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 76, 0f, 0f, 0, default, 1f); Main.dust[num374].noGravity = true; Main.dust[num374].noLight = true; Main.dust[num374].scale = 0.7f; diff --git a/Projectiles/Boss/IchorBlob.cs b/Projectiles/Boss/IchorBlob.cs index 649617c23c..3497199cde 100644 --- a/Projectiles/Boss/IchorBlob.cs +++ b/Projectiles/Boss/IchorBlob.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -13,108 +14,108 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Ichor Blob"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 52; - projectile.height = 56; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 52; + Projectile.height = 56; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - if (projectile.position.Y > projectile.ai[1] - 32f) - projectile.tileCollide = true; + if (Projectile.position.Y > Projectile.ai[1] - 32f) + Projectile.tileCollide = true; // Deal no damage and increment the variable used to kill the projectile after 15 seconds - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 900f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 900f) { - projectile.localAI[0] += 10f; - projectile.damage = 0; + Projectile.localAI[0] += 10f; + Projectile.damage = 0; } // Kill the projectile 26 frames after it stops dealing damage - if (projectile.localAI[0] > 255f) + if (Projectile.localAI[0] > 255f) { - projectile.Kill(); - projectile.localAI[0] = 255f; + Projectile.Kill(); + Projectile.localAI[0] = 255f; } // Add yellow light based on alpha - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.16f / 255f, (255 - projectile.alpha) * 0.04f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.16f / 255f, (255 - Projectile.alpha) * 0.04f / 255f); // Adjust projectile visibility based on the kill timer - projectile.alpha = (int)(100.0 + projectile.localAI[0] * 0.7); + Projectile.alpha = (int)(100.0 + Projectile.localAI[0] * 0.7); - if (projectile.velocity.Y != 0f && projectile.ai[0] == 0f) + if (Projectile.velocity.Y != 0f && Projectile.ai[0] == 0f) { // Rotate based on velocity, only do this here, because it's falling - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - MathHelper.PiOver2; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 1) - projectile.frame = 0; + if (Projectile.frame > 1) + Projectile.frame = 0; } else { // Prevent sliding - projectile.velocity.X = 0f; + Projectile.velocity.X = 0f; // Do not animate falling frames - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; - if (projectile.frame < 2) + if (Projectile.frame < 2) { // Set frame to blob and frame counter to 0 - projectile.frame = 2; - projectile.frameCounter = 0; + Projectile.frame = 2; + Projectile.frameCounter = 0; // Play squish sound - Main.PlaySound(SoundID.NPCDeath21, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCDeath21, Projectile.Center); // Emit dust float num50 = 1.6f; float num51 = 0.8f; float num52 = 2f; - Vector2 value3 = (projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length(); + Vector2 value3 = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + Vector2 value4 = value3 * Projectile.velocity.Length(); for (int num53 = 0; num53 < 10; num53++) { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 170, 0f, 0f, 200, default, num50); + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 200, default, num50); Dust dust = Main.dust[num54]; - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust.noGravity = true; dust.velocity.Y -= 2f; dust.velocity *= 3f; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 170, 0f, 0f, 100, default, num51); - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 100, default, num51); + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust.velocity.Y -= 2f; dust.velocity *= 2f; dust.noGravity = true; @@ -123,9 +124,9 @@ namespace CalamityMod.Projectiles.Boss } for (int num55 = 0; num55 < 5; num55++) { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 170, 0f, 0f, 0, default, num52); + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 0, default, num52); Dust dust = Main.dust[num56]; - dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; dust.noGravity = true; dust.velocity.Y -= 2f; dust.velocity *= 0.5f; @@ -133,33 +134,33 @@ namespace CalamityMod.Projectiles.Boss } } - projectile.rotation = 0f; + Projectile.rotation = 0f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) - projectile.frame = 5; + if (Projectile.frame > 5) + Projectile.frame = 5; } // Do velocity code after the frame code, to avoid messing anything up // Reduce x velocity every frame - projectile.velocity.X *= 0.99f; + Projectile.velocity.X *= 0.99f; // Stop falling if water or lava is hit - if (projectile.wet || projectile.lavaWet) + if (Projectile.wet || Projectile.lavaWet) { - projectile.velocity.Y = 0f; + Projectile.velocity.Y = 0f; } else { // Fall - projectile.velocity.Y += 0.1f; - if (projectile.velocity.Y > 6f) - projectile.velocity.Y = 6f; + Projectile.velocity.Y += 0.1f; + if (Projectile.velocity.Y > 6f) + Projectile.velocity.Y = 6f; } } @@ -171,30 +172,30 @@ namespace CalamityMod.Projectiles.Boss public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 16f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 16f, targetHitbox); - public override bool CanHitPlayer(Player target) => projectile.localAI[1] <= 900f && projectile.localAI[1] > 120f; + public override bool CanHitPlayer(Player target) => Projectile.localAI[1] <= 900f && Projectile.localAI[1] > 120f; public override Color? GetAlpha(Color lightColor) { - if (projectile.localAI[1] > 900f) + if (Projectile.localAI[1] > 900f) { - byte b2 = (byte)((26f - (projectile.localAI[1] - 900f)) * 10f); - byte a2 = (byte)(projectile.alpha * (b2 / 255f)); + byte b2 = (byte)((26f - (Projectile.localAI[1] - 900f)) * 10f); + byte a2 = (byte)(Projectile.alpha * (b2 / 255f)); return new Color(b2, b2, b2, a2); } - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.localAI[1] <= 900f && projectile.localAI[1] > 120f) + if (Projectile.localAI[1] <= 900f && Projectile.localAI[1] > 120f) target.AddBuff(BuffID.Ichor, 240); } } diff --git a/Projectiles/Boss/IchorShot.cs b/Projectiles/Boss/IchorShot.cs index 69a5eba1e3..224c6e89f8 100644 --- a/Projectiles/Boss/IchorShot.cs +++ b/Projectiles/Boss/IchorShot.cs @@ -11,41 +11,41 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Ichor Shot"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.timeLeft = 420; - projectile.penetrate = 1; + Projectile.width = 12; + Projectile.height = 12; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 420; + Projectile.penetrate = 1; } public override void AI() { - if (projectile.position.Y > projectile.ai[1]) - projectile.tileCollide = true; + if (Projectile.position.Y > Projectile.ai[1]) + Projectile.tileCollide = true; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) - projectile.frame = 0; + if (Projectile.frame > 5) + Projectile.frame = 0; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 170, 0f, 0f, 100, default, 0.5f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 100, default, 0.5f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - projectile.velocity.Y += 0.06f; - projectile.velocity.X *= 0.995f; + Projectile.velocity.Y += 0.06f; + Projectile.velocity.X *= 0.995f; } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 50, projectile.alpha); + return new Color(200, 200, 50, Projectile.alpha); } } } diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs index a441b3afeb..74e19500a4 100644 --- a/Projectiles/Boss/Infernado.cs +++ b/Projectiles/Boss/Infernado.cs @@ -15,31 +15,31 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Infernado"); - Main.projFrames[projectile.type] = 12; + Main.projFrames[Projectile.type] = 12; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 320; - projectile.height = 88; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 720; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 320; + Projectile.height = 88; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.timeLeft = 720; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() @@ -49,100 +49,100 @@ namespace CalamityMod.Projectiles.Boss float baseWidth = 320f; float baseHeight = 88f; - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); + Projectile.direction = Projectile.spriteDirection = -Math.Sign(Projectile.velocity.X); } - projectile.frameCounter++; - if (projectile.frameCounter > 2) + Projectile.frameCounter++; + if (Projectile.frameCounter > 2) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.scale = (scaleBase - projectile.ai[1]) * scaleMult / scaleBase; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(baseWidth * projectile.scale), (int)(baseHeight * projectile.scale)); - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.scale = (scaleBase - Projectile.ai[1]) * scaleMult / scaleBase; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, (int)(baseWidth * Projectile.scale), (int)(baseHeight * Projectile.scale)); + Projectile.netUpdate = true; } - if (projectile.ai[1] != -1f) + if (Projectile.ai[1] != -1f) { - projectile.scale = (scaleBase - projectile.ai[1]) * scaleMult / scaleBase; - projectile.width = (int)(baseWidth * projectile.scale); - projectile.height = (int)(baseHeight * projectile.scale); + Projectile.scale = (scaleBase - Projectile.ai[1]) * scaleMult / scaleBase; + Projectile.width = (int)(baseWidth * Projectile.scale); + Projectile.height = (int)(baseHeight * Projectile.scale); } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (!Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.alpha -= 30; - if (projectile.alpha < 60) + Projectile.alpha -= 30; + if (Projectile.alpha < 60) { - projectile.alpha = 60; + Projectile.alpha = 60; } } else { - projectile.alpha += 30; - if (projectile.alpha > 150) + Projectile.alpha += 30; + if (Projectile.alpha > 150) { - projectile.alpha = 150; + Projectile.alpha = 150; } } - if (projectile.ai[0] > 0f) + if (Projectile.ai[0] > 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + if (Projectile.ai[0] == 1f && Projectile.ai[1] > 0f && Projectile.owner == Main.myPlayer) { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= baseHeight * projectile.scale / 2f; - float num618 = (scaleBase - projectile.ai[1] + 1f) * scaleMult / scaleBase; + Projectile.netUpdate = true; + Vector2 center = Projectile.Center; + center.Y -= baseHeight * Projectile.scale / 2f; + float num618 = (scaleBase - Projectile.ai[1] + 1f) * scaleMult / scaleBase; center.Y -= baseHeight * num618 / 2f; center.Y += 2f; - Projectile.NewProjectile(center, projectile.velocity, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 11f, projectile.ai[1] - 1f); + Projectile.NewProjectile(center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 11f, Projectile.ai[1] - 1f); } - if (projectile.ai[0] <= 0f) + if (Projectile.ai[0] <= 0f) { float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; + float num623 = (float)Projectile.width / 5f; num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X -= num624 * -projectile.direction; - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X += num624 * -projectile.direction; + float num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; + Projectile.position.X -= num624 * -Projectile.direction; + Projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; + Projectile.position.X += num624 * -Projectile.direction; } - if (projectile.timeLeft == 600) - projectile.damage = projectile.GetProjectileDamage(ModContent.NPCType()); + if (Projectile.timeLeft == 600) + Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); } - public override bool CanHitPlayer(Player target) => projectile.timeLeft <= 600; + public override bool CanHitPlayer(Player target) => Projectile.timeLeft <= 600; public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 53, projectile.alpha); + return new Color(255, 255, 53, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.timeLeft <= 600) + if (Projectile.timeLeft <= 600) target.AddBuff(ModContent.BuffType(), 420); } diff --git a/Projectiles/Boss/Infernado2.cs b/Projectiles/Boss/Infernado2.cs index edd1c8edcd..175972b7dd 100644 --- a/Projectiles/Boss/Infernado2.cs +++ b/Projectiles/Boss/Infernado2.cs @@ -15,31 +15,31 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Infernado"); - Main.projFrames[projectile.type] = 12; + Main.projFrames[Projectile.type] = 12; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 320; - projectile.height = 88; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 840; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 320; + Projectile.height = 88; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.timeLeft = 840; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() @@ -49,100 +49,100 @@ namespace CalamityMod.Projectiles.Boss float baseWidth = 320f; float baseHeight = 88f; - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); + Projectile.direction = Projectile.spriteDirection = -Math.Sign(Projectile.velocity.X); } - projectile.frameCounter++; - if (projectile.frameCounter > 2) + Projectile.frameCounter++; + if (Projectile.frameCounter > 2) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.scale = (scaleBase - projectile.ai[1]) * scaleMult / scaleBase; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(baseWidth * projectile.scale), (int)(baseHeight * projectile.scale)); - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.scale = (scaleBase - Projectile.ai[1]) * scaleMult / scaleBase; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, (int)(baseWidth * Projectile.scale), (int)(baseHeight * Projectile.scale)); + Projectile.netUpdate = true; } - if (projectile.ai[1] != -1f) + if (Projectile.ai[1] != -1f) { - projectile.scale = (scaleBase - projectile.ai[1]) * scaleMult / scaleBase; - projectile.width = (int)(baseWidth * projectile.scale); - projectile.height = (int)(baseHeight * projectile.scale); + Projectile.scale = (scaleBase - Projectile.ai[1]) * scaleMult / scaleBase; + Projectile.width = (int)(baseWidth * Projectile.scale); + Projectile.height = (int)(baseHeight * Projectile.scale); } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (!Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.alpha -= 30; - if (projectile.alpha < 60) + Projectile.alpha -= 30; + if (Projectile.alpha < 60) { - projectile.alpha = 60; + Projectile.alpha = 60; } } else { - projectile.alpha += 30; - if (projectile.alpha > 150) + Projectile.alpha += 30; + if (Projectile.alpha > 150) { - projectile.alpha = 150; + Projectile.alpha = 150; } } - if (projectile.ai[0] > 0f) + if (Projectile.ai[0] > 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + if (Projectile.ai[0] == 1f && Projectile.ai[1] > 0f && Projectile.owner == Main.myPlayer) { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= baseHeight * projectile.scale / 2f; - float num618 = (scaleBase - projectile.ai[1] + 1f) * scaleMult / scaleBase; + Projectile.netUpdate = true; + Vector2 center = Projectile.Center; + center.Y -= baseHeight * Projectile.scale / 2f; + float num618 = (scaleBase - Projectile.ai[1] + 1f) * scaleMult / scaleBase; center.Y -= baseHeight * num618 / 2f; center.Y += 2f; - Projectile.NewProjectile(center, projectile.velocity, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 11f, projectile.ai[1] - 1f); + Projectile.NewProjectile(center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 11f, Projectile.ai[1] - 1f); } - if (projectile.ai[0] <= 0f) + if (Projectile.ai[0] <= 0f) { float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; + float num623 = (float)Projectile.width / 5f; num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X -= num624 * -projectile.direction; - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X += num624 * -projectile.direction; + float num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; + Projectile.position.X -= num624 * -Projectile.direction; + Projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; + Projectile.position.X += num624 * -Projectile.direction; } - if (projectile.timeLeft == 720) - projectile.damage = projectile.GetProjectileDamage(ModContent.NPCType()); + if (Projectile.timeLeft == 720) + Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); } - public override bool CanHitPlayer(Player target) => projectile.timeLeft <= 720; + public override bool CanHitPlayer(Player target) => Projectile.timeLeft <= 720; public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 53, projectile.alpha); + return new Color(255, 255, 53, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.timeLeft <= 720) + if (Projectile.timeLeft <= 720) target.AddBuff(ModContent.BuffType(), 420); } diff --git a/Projectiles/Boss/InfernadoRevenge.cs b/Projectiles/Boss/InfernadoRevenge.cs index 3d43085a08..fb8b1b88e4 100644 --- a/Projectiles/Boss/InfernadoRevenge.cs +++ b/Projectiles/Boss/InfernadoRevenge.cs @@ -21,33 +21,33 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 320; - projectile.height = 1020; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 360000; + Projectile.width = 320; + Projectile.height = 1020; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.timeLeft = 360000; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { if (!CalamityPlayer.areThereAnyDamnBosses) { - projectile.active = false; - projectile.netUpdate = true; + Projectile.active = false; + Projectile.netUpdate = true; return; } } @@ -62,8 +62,8 @@ namespace CalamityMod.Projectiles.Boss float _ = 0f; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), - projectile.Bottom, - projectile.Bottom - Vector2.UnitY * TornadoHeight, + Projectile.Bottom, + Projectile.Bottom - Vector2.UnitY * TornadoHeight, 72, ref _); } @@ -71,15 +71,15 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { if (TornadoDrawer is null) - TornadoDrawer = new PrimitiveTrail(_ => projectile.width * 0.5f + 16f, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:Bordernado"]); + TornadoDrawer = new PrimitiveTrail(_ => Projectile.width * 0.5f + 16f, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:Bordernado"]); GameShaders.Misc["CalamityMod:Bordernado"].UseSaturation(-0.2f); - GameShaders.Misc["CalamityMod:Bordernado"].SetShaderTexture(ModContent.GetTexture("Terraria/Misc/Perlin")); + GameShaders.Misc["CalamityMod:Bordernado"].SetShaderTexture(ModContent.Request("Terraria/Misc/Perlin")); Vector2[] drawPoints = new Vector2[5]; Vector2 upwardAscent = Vector2.UnitY * TornadoHeight; - Vector2 downwardOffset = Vector2.UnitY * projectile.height / (drawPoints.Length + 1); + Vector2 downwardOffset = Vector2.UnitY * Projectile.height / (drawPoints.Length + 1); - Vector2 bottom = projectile.Bottom + downwardOffset; + Vector2 bottom = Projectile.Bottom + downwardOffset; Vector2 top = bottom - upwardAscent; for (int i = 0; i < drawPoints.Length - 1; i++) drawPoints[i] = Vector2.Lerp(top, bottom, i / (float)(drawPoints.Length - 1)); @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Boss drawPoints[drawPoints.Length - 1] = bottom; TornadoDrawer.Draw(drawPoints, -Main.screenPosition, 85); - Texture2D vortexTexture = ModContent.GetTexture("CalamityMod/Projectiles/Boss/OldDukeVortex"); + Texture2D vortexTexture = ModContent.Request("CalamityMod/Projectiles/Boss/OldDukeVortex"); for (int i = 0; i < 110; i++) { float angle = MathHelper.TwoPi * i / 50f + Main.GlobalTime * MathHelper.TwoPi; diff --git a/Projectiles/Boss/JewelProjectile.cs b/Projectiles/Boss/JewelProjectile.cs index 81bfafa8d9..ecdd8233cb 100644 --- a/Projectiles/Boss/JewelProjectile.cs +++ b/Projectiles/Boss/JewelProjectile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -11,25 +12,25 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Ruby Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.penetrate = -1; - projectile.hostile = true; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.penetrate = -1; + Projectile.hostile = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; for (int index = 0; index < 2; ++index) { - int ruby = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, projectile.velocity.X, projectile.velocity.Y, 90, new Color(), 1.2f); + int ruby = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 90, Projectile.velocity.X, Projectile.velocity.Y, 90, new Color(), 1.2f); Dust dust = Main.dust[ruby]; dust.noGravity = true; dust.velocity *= 0.3f; @@ -40,10 +41,10 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); for (int index1 = 0; index1 < 15; ++index1) { - int ruby = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, projectile.oldVelocity.X, projectile.oldVelocity.Y, 50, new Color(), 1.2f); + int ruby = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 90, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 50, new Color(), 1.2f); Dust dust = Main.dust[ruby]; dust.noGravity = true; dust.scale *= 1.25f; @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/LeviathanBomb.cs b/Projectiles/Boss/LeviathanBomb.cs index a7d57ddc78..bde8dbc943 100644 --- a/Projectiles/Boss/LeviathanBomb.cs +++ b/Projectiles/Boss/LeviathanBomb.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class LeviathanBomb : ModProjectile @@ -18,51 +19,51 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 172; - projectile.height = 172; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 120; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 172; + Projectile.height = 172; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 120; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(visible); - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { visible = reader.ReadBoolean(); - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - projectile.velocity *= 1.005f; + Projectile.velocity *= 1.005f; - projectile.rotation += 0.1f; + Projectile.rotation += 0.1f; - if (visible && projectile.alpha > 0) - projectile.alpha -= 15; + if (visible && Projectile.alpha > 0) + Projectile.alpha -= 15; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 12f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 12f) visible = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 80f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 80f, targetHitbox); public override void OnHitPlayer(Player target, int damage, bool crit) { @@ -71,10 +72,10 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -84,10 +85,10 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 15; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Boss/LeviathanSpawner.cs b/Projectiles/Boss/LeviathanSpawner.cs index 68db9f667c..9f9bfb4662 100644 --- a/Projectiles/Boss/LeviathanSpawner.cs +++ b/Projectiles/Boss/LeviathanSpawner.cs @@ -6,43 +6,44 @@ using Terraria.GameContent.Shaders; using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; using LeviathanNPC = CalamityMod.NPCs.Leviathan.Leviathan; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class LeviathanSpawner : ModProjectile { - internal ref float Time => ref projectile.ai[0]; + internal ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() => DisplayName.SetDefault("Spawner"); public override void SetDefaults() { - projectile.width = projectile.height = 20; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.timeLeft = 450; + Projectile.width = Projectile.height = 20; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + Projectile.timeLeft = 450; } public override void AI() { - projectile.Opacity = CalamityUtils.Convert01To010(projectile.timeLeft / 120f) * 4f; - if (projectile.Opacity > 1f) - projectile.Opacity = 1f; + Projectile.Opacity = CalamityUtils.Convert01To010(Projectile.timeLeft / 120f) * 4f; + if (Projectile.Opacity > 1f) + Projectile.Opacity = 1f; Main.LocalPlayer.Calamity().GeneralScreenShakePower = (float)Math.Pow(Utils.InverseLerp(180f, 290f, Time, true), 0.3D) * 6f; Main.LocalPlayer.Calamity().GeneralScreenShakePower += CalamityUtils.Convert01To010((float)Math.Pow(Utils.InverseLerp(300f, 440f, Time, true), 0.5D)) * 10f; - if (projectile.timeLeft == 45) + if (Projectile.timeLeft == 45) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LeviathanRoarCharge"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LeviathanRoarCharge"), Projectile.Center); if (Main.netMode != NetmodeID.Server) { WaterShaderData ripple = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); - Vector2 ripplePos = projectile.Center; + Vector2 ripplePos = Projectile.Center; for (int i = 0; i < 3; i++) ripple.QueueRipple(ripplePos, Color.White, Vector2.One * 1000f, RippleShape.Square, Main.rand.NextFloat(MathHelper.TwoPi)); @@ -51,7 +52,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.netMode == NetmodeID.MultiplayerClient) return; - int leviathan = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y, ModContent.NPCType()); + int leviathan = NPC.NewNPC((int)Projectile.Center.X, (int)Projectile.Center.Y, ModContent.NPCType()); if (Main.npc.IndexInRange(leviathan)) Main.npc[leviathan].velocity = Vector2.UnitY * -7f; } @@ -65,7 +66,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.netMode == NetmodeID.Server) return; - WorldUtils.Find((projectile.Center - Vector2.UnitY * 1200f).ToTileCoordinates(), Searches.Chain(new Searches.Down(150), new CustomConditions.IsWater()), out Point waterTop); + WorldUtils.Find((Projectile.Center - Vector2.UnitY * 1200f).ToTileCoordinates(), Searches.Chain(new Searches.Down(150), new CustomConditions.IsWater()), out Point waterTop); // Create bubbling water. if (Time % 4f == 3f && Time > 90f) diff --git a/Projectiles/Boss/MajesticSparkle.cs b/Projectiles/Boss/MajesticSparkle.cs index ba14dd1797..3bf8a2fb3d 100644 --- a/Projectiles/Boss/MajesticSparkle.cs +++ b/Projectiles/Boss/MajesticSparkle.cs @@ -8,8 +8,8 @@ namespace CalamityMod.Projectiles.Boss { public class MajesticSparkle : ModProjectile { - public ref float Time => ref projectile.ai[0]; - public ref float ColorSpectrumHue => ref projectile.ai[1]; + public ref float Time => ref Projectile.ai[0]; + public ref float ColorSpectrumHue => ref Projectile.ai[1]; public const int Lifetime = 90; public const int FadeinTime = 18; public const int FadeoutTime = 18; @@ -21,44 +21,44 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 72; - projectile.height = 72; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = Lifetime; - projectile.scale = 0.001f; + Projectile.width = 72; + Projectile.height = 72; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = Lifetime; + Projectile.scale = 0.001f; } public override void AI() { if (Time == 1f) { - projectile.scale = Main.rand.NextFloat(0.3f, 0.75f); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(projectile.scale * 72f)); + Projectile.scale = Main.rand.NextFloat(0.3f, 0.75f); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, (int)(Projectile.scale * 72f)); ColorSpectrumHue = Main.rand.NextFloat(0f, 0.9999f); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.netUpdate = true; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.netUpdate = true; } - projectile.velocity *= 0.96f; - projectile.rotation = projectile.rotation.AngleLerp(MathHelper.PiOver2, 0.085f); + Projectile.velocity *= 0.96f; + Projectile.rotation = Projectile.rotation.AngleLerp(MathHelper.PiOver2, 0.085f); // Go 33% across the color spectrum throughout the sparkle's lifetime instead of using a static color. ColorSpectrumHue = (ColorSpectrumHue + 0.333f / Lifetime) % 0.999f; - projectile.Opacity = Utils.InverseLerp(0f, FadeinTime, Time, true) * Utils.InverseLerp(Lifetime, Lifetime - FadeoutTime, Time, true); - projectile.velocity = projectile.velocity.RotatedBy(Math.Sin(Time / 30f) * 0.0125f); + Projectile.Opacity = Utils.InverseLerp(0f, FadeinTime, Time, true) * Utils.InverseLerp(Lifetime, Lifetime - FadeoutTime, Time, true); + Projectile.velocity = Projectile.velocity.RotatedBy(Math.Sin(Time / 30f) * 0.0125f); Time++; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D sparkleTexture = ModContent.GetTexture(Texture); + Texture2D sparkleTexture = ModContent.Request(Texture); - Vector2 drawPosition = projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY; - Color sparkleColor = Main.hslToRgb(ColorSpectrumHue, 1f, 0.5f) * projectile.Opacity * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; + Color sparkleColor = Main.hslToRgb(ColorSpectrumHue, 1f, 0.5f) * Projectile.Opacity * 0.5f; sparkleColor.A = 0; sparkleColor *= MathHelper.Lerp(1f, 1.5f, Utils.InverseLerp(Lifetime * 0.5f - 15f, Lifetime * 0.5f + 15f, Time, true)); @@ -67,13 +67,13 @@ namespace CalamityMod.Projectiles.Boss Vector2 origin = sparkleTexture.Size() * 0.5f; - Vector2 sparkleScale = new Vector2(0.3f, 1f) * projectile.Opacity * projectile.scale; - Vector2 orthogonalsparkleScale = new Vector2(0.3f, 2f) * projectile.Opacity * projectile.scale; + Vector2 sparkleScale = new Vector2(0.3f, 1f) * Projectile.Opacity * Projectile.scale; + Vector2 orthogonalsparkleScale = new Vector2(0.3f, 2f) * Projectile.Opacity * Projectile.scale; - spriteBatch.Draw(sparkleTexture, drawPosition, null, sparkleColor, MathHelper.PiOver2 + projectile.rotation, origin, orthogonalsparkleScale, SpriteEffects.None, 0f); - spriteBatch.Draw(sparkleTexture, drawPosition, null,sparkleColor, projectile.rotation, origin, sparkleScale, SpriteEffects.None, 0f); - spriteBatch.Draw(sparkleTexture, drawPosition, null, orthogonalSparkleColor, MathHelper.PiOver2 + projectile.rotation, origin, orthogonalsparkleScale * 0.6f, SpriteEffects.None, 0f); - spriteBatch.Draw(sparkleTexture, drawPosition, null, orthogonalSparkleColor, projectile.rotation, origin, sparkleScale * 0.6f, SpriteEffects.None, 0f); + spriteBatch.Draw(sparkleTexture, drawPosition, null, sparkleColor, MathHelper.PiOver2 + Projectile.rotation, origin, orthogonalsparkleScale, SpriteEffects.None, 0f); + spriteBatch.Draw(sparkleTexture, drawPosition, null,sparkleColor, Projectile.rotation, origin, sparkleScale, SpriteEffects.None, 0f); + spriteBatch.Draw(sparkleTexture, drawPosition, null, orthogonalSparkleColor, MathHelper.PiOver2 + Projectile.rotation, origin, orthogonalsparkleScale * 0.6f, SpriteEffects.None, 0f); + spriteBatch.Draw(sparkleTexture, drawPosition, null, orthogonalSparkleColor, Projectile.rotation, origin, sparkleScale * 0.6f, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index 960fe3ea1e..f91396237b 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -9,6 +9,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -17,51 +18,51 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Molten Blast"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 42; - projectile.height = 42; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 90; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 42; + Projectile.height = 42; + Projectile.hostile = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 90; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - if (projectile.wet || projectile.lavaWet) - projectile.Kill(); + if (Projectile.wet || Projectile.lavaWet) + Projectile.Kill(); int dustType = (Main.dayTime && !CalamityWorld.malice) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { for (int d = 0; d < 10; d++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -69,75 +70,75 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 30f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * -projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * -Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy(l * 3.14159274f / 6f, default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy(projectile.rotation - 1.57079637f, default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy(Projectile.rotation - 1.57079637f, default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 1.57f; } public override Color? GetAlpha(Color lightColor) { - return (Main.dayTime && !CalamityWorld.malice) ? new Color(250, 150, 0, projectile.alpha) : new Color(100, 200, 250, projectile.alpha); + return (Main.dayTime && !CalamityWorld.malice) ? new Color(250, 150, 0, Projectile.alpha) : new Color(100, 200, 250, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = (Main.dayTime && !CalamityWorld.malice) ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/MoltenBlastNight"); - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = (Main.dayTime && !CalamityWorld.malice) ? Main.projectileTexture[Projectile.type] : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlastNight"); + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { int blobAmt = (!Main.dayTime || CalamityWorld.malice || BossRushEvent.BossRushActive) ? 9 : 6; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int b = 0; b < blobAmt; b++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)Math.Round(projectile.damage * 0.75), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, 0f); } } - Main.PlaySound(SoundID.Item20, projectile.Center); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); int dustType = (Main.dayTime && !CalamityWorld.malice) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 2.5f); + int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 18f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 18f, targetHitbox); public override void OnHitPlayer(Player target, int damage, bool crit) { diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index 954996abb3..a523f553e3 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class MoltenBlob : ModProjectile @@ -13,45 +14,45 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Molten Blob"); - Main.projFrames[projectile.type] = 2; + Main.projFrames[Projectile.type] = 2; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.timeLeft = 900; - projectile.scale = 1.5f; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 900; + Projectile.scale = 1.5f; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - projectile.velocity.X *= 0.95f; + Projectile.velocity.X *= 0.95f; - if (projectile.wet || projectile.lavaWet) + if (Projectile.wet || Projectile.lavaWet) { - projectile.velocity.Y = 0f; + Projectile.velocity.Y = 0f; } else { - projectile.velocity.Y += 0.1f; - if (projectile.velocity.Y > 5f) - projectile.velocity.Y = 5f; + Projectile.velocity.Y += 0.1f; + if (Projectile.velocity.Y > 5f) + Projectile.velocity.Y = 5f; } - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 1) - projectile.frame = 0; + if (Projectile.frame > 1) + Projectile.frame = 0; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) @@ -64,31 +65,31 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return (Main.dayTime && !CalamityWorld.malice) ? new Color(250, 150, 0, projectile.alpha) : new Color(100, 200, 250, projectile.alpha); + return (Main.dayTime && !CalamityWorld.malice) ? new Color(250, 150, 0, Projectile.alpha) : new Color(100, 200, 250, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = (Main.dayTime && !CalamityWorld.malice) ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/MoltenBlobNight"); - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = (Main.dayTime && !CalamityWorld.malice) ? Main.projectileTexture[Projectile.type] : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight"); + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item20, projectile.Center); - projectile.position.X = projectile.position.X + (projectile.width / 2); - projectile.position.Y = projectile.position.Y + (projectile.height / 2); - projectile.width = 10; - projectile.height = 10; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + Projectile.position.X = Projectile.position.X + (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); + Projectile.width = 10; + Projectile.height = 10; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); int dustType = (Main.dayTime && !CalamityWorld.malice) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; @@ -97,9 +98,9 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); } } diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index 1a1d4fb09b..4289b741ec 100644 --- a/Projectiles/Boss/MushBomb.cs +++ b/Projectiles/Boss/MushBomb.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class MushBomb : ModProjectile @@ -10,81 +11,81 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Mushroom Shot"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 480; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 480; + Projectile.aiStyle = 1; aiType = ProjectileID.WoodenArrowFriendly; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.timeLeft < 90) + if (Projectile.timeLeft < 90) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - Lighting.AddLight(projectile.Center, 0f, 0.15f, 0.3f); - projectile.velocity.X *= 0.99f; + Lighting.AddLight(Projectile.Center, 0f, 0.15f, 0.3f); + Projectile.velocity.X *= 0.99f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int drawStart = height * projectile.frame; - Vector2 origin = projectile.Size / 2; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = height * Projectile.frame; + Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int drawStart = height * projectile.frame; - Vector2 origin = projectile.Size / 2; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = height * Projectile.frame; + Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/MushBombGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Boss/MushBombGlow"), Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCDeath1, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 20; + Projectile.height = 20; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 7; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -94,10 +95,10 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index 1c990c0386..75ed9c08ad 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -14,84 +15,84 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Falling Mushroom"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 480; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 480; + Projectile.aiStyle = 1; aiType = ProjectileID.WoodenArrowFriendly; } public override void AI() { - projectile.velocity.Y = BossRushEvent.BossRushActive ? 10f : CalamityWorld.malice ? 8f : CalamityWorld.death ? 6f : 5f; + Projectile.velocity.Y = BossRushEvent.BossRushActive ? 10f : CalamityWorld.malice ? 8f : CalamityWorld.death ? 6f : 5f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.timeLeft < 90) - projectile.tileCollide = true; + if (Projectile.timeLeft < 90) + Projectile.tileCollide = true; - Lighting.AddLight(projectile.Center, 0f, 0.15f, 0.3f); + Lighting.AddLight(Projectile.Center, 0f, 0.15f, 0.3f); - if (Math.Abs(projectile.velocity.X) > 2f) - projectile.velocity.X *= 0.99f; + if (Math.Abs(Projectile.velocity.X) > 2f) + Projectile.velocity.X *= 0.99f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int drawStart = height * projectile.frame; - Vector2 origin = projectile.Size / 2; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = height * Projectile.frame; + Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int drawStart = height * projectile.frame; - Vector2 origin = projectile.Size / 2; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = height * Projectile.frame; + Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/MushBombGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Boss/MushBombGlow"), Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCDeath1, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 20; + Projectile.height = 20; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 7; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -101,10 +102,10 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Boss/OldDukeGore.cs b/Projectiles/Boss/OldDukeGore.cs index 84eb903c4a..70f756fdd8 100644 --- a/Projectiles/Boss/OldDukeGore.cs +++ b/Projectiles/Boss/OldDukeGore.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -13,63 +14,63 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurous Gore"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; + Projectile.width = 24; + Projectile.height = 24; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.alpha = 255; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - projectile.alpha -= 50; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 50; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 15f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 15f) { - projectile.velocity.Y += 0.1f; + Projectile.velocity.Y += 0.1f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } - projectile.tileCollide = projectile.timeLeft < 240; + Projectile.tileCollide = Projectile.timeLeft < 240; - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; - int blood = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Blood, 0f, 0f, 100, default, 1f); + int blood = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1f); Main.dust[blood].noGravity = true; Main.dust[blood].velocity *= 0f; - int acid = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); + int acid = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); Main.dust[acid].noGravity = true; Main.dust[acid].velocity *= 0f; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCDeath12, projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath12, Projectile.position); int num226 = 8; for (int num227 = 0; num227 < num226; num227++) { - Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - source = source.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 dustVel = source - projectile.Center; + Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 dustVel = source - Projectile.Center; int blood = Dust.NewDust(source + dustVel, 0, 0, DustID.Blood, dustVel.X, dustVel.Y, 100, default, 1.2f); Main.dust[blood].noGravity = true; Main.dust[blood].noLight = true; @@ -78,10 +79,10 @@ namespace CalamityMod.Projectiles.Boss for (int d = 0; d < 6; d++) { - int acid = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default(Color), 3f); + int acid = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default(Color), 3f); Main.dust[acid].noGravity = true; Main.dust[acid].velocity *= 5f; - acid = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default(Color), 2f); + acid = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default(Color), 2f); Main.dust[acid].velocity *= 2f; Main.dust[acid].noGravity = true; } @@ -99,7 +100,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/OldDukeSummonDrop.cs b/Projectiles/Boss/OldDukeSummonDrop.cs index 3272537a2b..ed07f3fafd 100644 --- a/Projectiles/Boss/OldDukeSummonDrop.cs +++ b/Projectiles/Boss/OldDukeSummonDrop.cs @@ -15,25 +15,25 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Acid"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 20; - projectile.hostile = true; - projectile.tileCollide = true; - projectile.ignoreWater = false; - projectile.timeLeft = 400; + Projectile.width = 14; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.tileCollide = true; + Projectile.ignoreWater = false; + Projectile.timeLeft = 400; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (projectile.velocity.Y <= 8f) + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (Projectile.velocity.Y <= 8f) { - projectile.velocity.Y += 0.15f; + Projectile.velocity.Y += 0.15f; } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -41,12 +41,12 @@ namespace CalamityMod.Projectiles.Boss // Water drip for (int i = 0; i < 4; i++) { - int idx = Dust.NewDust(projectile.position - projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); Dust dust = Main.dust[idx]; dust.position.X -= 2f; Main.dust[idx].alpha = 38; Main.dust[idx].velocity *= 0.1f; - Main.dust[idx].velocity -= projectile.velocity * 0.025f; + Main.dust[idx].velocity -= Projectile.velocity * 0.025f; Main.dust[idx].scale = 0.75f; } return true; @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Boss/OldDukeVortex.cs b/Projectiles/Boss/OldDukeVortex.cs index d6e3385db7..5c097dd78f 100644 --- a/Projectiles/Boss/OldDukeVortex.cs +++ b/Projectiles/Boss/OldDukeVortex.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -14,96 +15,96 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurous Vortex"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 408; - projectile.height = 408; - projectile.scale = 0.004f; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 1800; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 408; + Projectile.height = 408; + Projectile.scale = 0.004f; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 1800; cooldownSlot = 1; } public override void AI() { - if (projectile.scale < 1f) + if (Projectile.scale < 1f) { - if (projectile.alpha > 0) - projectile.alpha -= 1; + if (Projectile.alpha > 0) + Projectile.alpha -= 1; - projectile.scale += 0.004f; - if (projectile.scale > 1f) - projectile.scale = 1f; + Projectile.scale += 0.004f; + if (Projectile.scale > 1f) + Projectile.scale = 1f; - projectile.width = projectile.height = (int)(408f * projectile.scale); + Projectile.width = Projectile.height = (int)(408f * Projectile.scale); } else { - if (projectile.timeLeft <= 85) + if (Projectile.timeLeft <= 85) { - if (projectile.alpha < 255) - projectile.alpha += 3; + if (Projectile.alpha < 255) + Projectile.alpha += 3; - projectile.scale += 0.012f; - projectile.width = projectile.height = (int)(408f * projectile.scale); + Projectile.scale += 0.012f; + Projectile.width = Projectile.height = (int)(408f * Projectile.scale); } else - projectile.width = projectile.height = 408; + Projectile.width = Projectile.height = 408; } - projectile.velocity = Vector2.Normalize(new Vector2(projectile.ai[0], projectile.ai[1]) - projectile.Center) * 1.5f; + Projectile.velocity = Vector2.Normalize(new Vector2(Projectile.ai[0], Projectile.ai[1]) - Projectile.Center) * 1.5f; - projectile.rotation -= 0.1f * (float)(1D - (projectile.alpha / 255D)); + Projectile.rotation -= 0.1f * (float)(1D - (Projectile.alpha / 255D)); - float lightAmt = 2f * projectile.scale; - Lighting.AddLight(projectile.Center, lightAmt, lightAmt * 2f, lightAmt); + float lightAmt = 2f * Projectile.scale; + Lighting.AddLight(Projectile.Center, lightAmt, lightAmt * 2f, lightAmt); - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 174; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVortex"), (int)projectile.Center.X, (int)projectile.Center.Y); + Projectile.soundDelay = 174; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVortex"), (int)Projectile.Center.X, (int)Projectile.Center.Y); } - if (projectile.timeLeft > 85) + if (Projectile.timeLeft > 85) { - int numDust = (int)(0.2f * MathHelper.TwoPi * 408f * projectile.scale); + int numDust = (int)(0.2f * MathHelper.TwoPi * 408f * Projectile.scale); float angleIncrement = MathHelper.TwoPi / (float)numDust; - Vector2 dustOffset = new Vector2(408f * projectile.scale, 0f); + Vector2 dustOffset = new Vector2(408f * Projectile.scale, 0f); dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); - int var = (int)(408f * projectile.scale); + int var = (int)(408f * Projectile.scale); for (int i = 0; i < numDust; i++) { if (Main.rand.NextBool(var)) { dustOffset = dustOffset.RotatedBy(angleIncrement); - int dust = Dust.NewDust(projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid); - Main.dust[dust].position = projectile.Center + dustOffset; + int dust = Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid); + Main.dust[dust].position = Projectile.Center + dustOffset; Main.dust[dust].noGravity = true; - Main.dust[dust].velocity = Vector2.Normalize(projectile.Center - Main.dust[dust].position) * 24f; - Main.dust[dust].scale = projectile.scale * 3f; + Main.dust[dust].velocity = Vector2.Normalize(Projectile.Center - Main.dust[dust].position) * 24f; + Main.dust[dust].scale = Projectile.scale * 3f; } } - float distanceRequired = 800f * projectile.scale; + float distanceRequired = 800f * Projectile.scale; float succPower = 0.4f; for (int i = 0; i < Main.maxPlayers; i++) { Player player = Main.player[i]; - float distance = Vector2.Distance(player.Center, projectile.Center); + float distance = Vector2.Distance(player.Center, Projectile.Center); if (distance < distanceRequired && player.grappling[0] == -1) { - if (Collision.CanHit(projectile.Center, 1, 1, player.Center, 1, 1)) + if (Collision.CanHit(Projectile.Center, 1, 1, player.Center, 1, 1)) { float distanceRatio = distance / distanceRequired; @@ -112,12 +113,12 @@ namespace CalamityMod.Projectiles.Boss player.wingTime = wingTimeSet; float multiplier = 1f - distanceRatio; - if (player.Center.X < projectile.Center.X) + if (player.Center.X < Projectile.Center.X) player.velocity.X += succPower * multiplier; else player.velocity.X -= succPower * multiplier; - if (player.Center.Y < projectile.Center.Y) + if (player.Center.Y < Projectile.Center.Y) player.velocity.Y += succPower * multiplier; else player.velocity.Y -= succPower * multiplier; @@ -129,17 +130,17 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override bool CanHitPlayer(Player target) => projectile.timeLeft <= 1680 && projectile.timeLeft > 85; + public override bool CanHitPlayer(Player target) => Projectile.timeLeft <= 1680 && Projectile.timeLeft > 85; - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 210f * projectile.scale, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 210f * Projectile.scale, targetHitbox); public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.timeLeft <= 1680 && projectile.timeLeft > 85) + if (Projectile.timeLeft <= 1680 && Projectile.timeLeft > 85) target.AddBuff(ModContent.BuffType(), 600); } diff --git a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs index 1c37cf8093..73eb42a01c 100644 --- a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs +++ b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs @@ -19,20 +19,20 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Old Duke Summoner"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 1; - projectile.scale = 0.004f; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 1800; + Projectile.width = Projectile.height = 1; + Projectile.scale = 0.004f; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 1800; } private static void ExpandVertically(int startX, int startY, out int topY, out int bottomY, int maxExpandUp = 100, int maxExpandDown = 100) { @@ -62,53 +62,53 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.rotation -= 0.15f * (float)(1D - (projectile.alpha / 255D)); - projectile.ai[0]++; + Projectile.rotation -= 0.15f * (float)(1D - (Projectile.alpha / 255D)); + Projectile.ai[0]++; - float totalTilesToExpand = 1600f * projectile.scale / 16; + float totalTilesToExpand = 1600f * Projectile.scale / 16; - Point centerAsTileCoords = projectile.Center.ToTileCoordinates(); + Point centerAsTileCoords = Projectile.Center.ToTileCoordinates(); ExpandVertically(centerAsTileCoords.X, centerAsTileCoords.Y, out int topY, out int bottomY, (int)(totalTilesToExpand / 2), (int)(totalTilesToExpand / 2)); topY++; bottomY--; Vector2 topVector = new Vector2(centerAsTileCoords.X, topY) * 16f + new Vector2(8f); Vector2 bottomVector = new Vector2(centerAsTileCoords.X, bottomY) * 16f + new Vector2(8f); Vector2 centerVector = Vector2.Lerp(topVector, bottomVector, 0.5f); - projectile.width = (int)(208 * projectile.scale); - projectile.height = (int)(bottomVector.Y - topVector.Y); - projectile.Center = centerVector; + Projectile.width = (int)(208 * Projectile.scale); + Projectile.height = (int)(bottomVector.Y - topVector.Y); + Projectile.Center = centerVector; - if (projectile.ai[0] < 90f) + if (Projectile.ai[0] < 90f) { - projectile.alpha = (int)MathHelper.Lerp(255f, 0f, projectile.ai[0] / 90f); - projectile.scale = MathHelper.Lerp(0.004f, 1f, projectile.ai[0] / 90f); + Projectile.alpha = (int)MathHelper.Lerp(255f, 0f, Projectile.ai[0] / 90f); + Projectile.scale = MathHelper.Lerp(0.004f, 1f, Projectile.ai[0] / 90f); } // Spray gore and acid everywhere - else if (projectile.ai[0] < 480f) + else if (Projectile.ai[0] < 480f) { - if (projectile.ai[0] % 10f == 9f) + if (Projectile.ai[0] % 10f == 9f) { Vector2 velocity = new Vector2(0f, -18f).RotatedByRandom(0.7f); - Projectile.NewProjectile(projectile.Top + new Vector2(Main.rand.NextFloat(-80f, 80f), 100f), velocity, + Projectile.NewProjectile(Projectile.Top + new Vector2(Main.rand.NextFloat(-80f, 80f), 100f), velocity, ModContent.ProjectileType(), 65, 2f); } - if (projectile.ai[0] % 35f == 34f) + if (Projectile.ai[0] % 35f == 34f) { Vector2 velocity = new Vector2(Main.rand.NextFloat(-3f, 3f), -7f - Main.rand.NextFloat(4f, 12f)).RotatedByRandom(0.5f); - Projectile.NewProjectile(projectile.Top + new Vector2(Main.rand.NextFloat(-30f, 30f), 100f), velocity, + Projectile.NewProjectile(Projectile.Top + new Vector2(Main.rand.NextFloat(-30f, 30f), 100f), velocity, ModContent.ProjectileType(), 65, 2f); } } // Fade out and die - if (projectile.ai[0] >= 600f) + if (Projectile.ai[0] >= 600f) { - projectile.alpha = (int)MathHelper.Lerp(0f, 255f, (projectile.ai[0] - 600f) / 120f); + Projectile.alpha = (int)MathHelper.Lerp(0f, 255f, (Projectile.ai[0] - 600f) / 120f); bool canSpawnBoomer = false; for (int i = 0; i < Main.player.Length; i++) { - if (!Main.player[i].dead && projectile.Distance(Main.player[i].Center) < 12000f) + if (!Main.player[i].dead && Projectile.Distance(Main.player[i].Center) < 12000f) { canSpawnBoomer = true; break; @@ -116,20 +116,20 @@ namespace CalamityMod.Projectiles.Boss } // Summon the boomer duke - if (projectile.ai[0] == 660f) + if (Projectile.ai[0] == 660f) { if (canSpawnBoomer) { for (int i = 0; i < 160; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Top + Vector2.UnitY * 100f, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(Projectile.Top + Vector2.UnitY * 100f, (int)CalamityDusts.SulfurousSeaAcid); dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(5f, 23f); dust.noGravity = true; dust.scale = 3f; } if (Main.netMode != NetmodeID.MultiplayerClient) { - int boomer = NPC.NewNPC((int)projectile.Top.X, (int)projectile.Top.Y + 100, ModContent.NPCType()); + int boomer = NPC.NewNPC((int)Projectile.Top.X, (int)Projectile.Top.Y + 100, ModContent.NPCType()); string boomerName = Main.npc[boomer].TypeName; if (Main.netMode == NetmodeID.SinglePlayer) @@ -166,32 +166,32 @@ namespace CalamityMod.Projectiles.Boss } } } - if (projectile.ai[0] >= 720f) + if (Projectile.ai[0] >= 720f) { - projectile.Kill(); + Projectile.Kill(); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - float totalTilesToExpand = 1600f * projectile.scale / 16; - Point centerAsTileCoords = projectile.Center.ToTileCoordinates(); + float totalTilesToExpand = 1600f * Projectile.scale / 16; + Point centerAsTileCoords = Projectile.Center.ToTileCoordinates(); ExpandVertically(centerAsTileCoords.X, centerAsTileCoords.Y, out _, out int bottomY, (int)(totalTilesToExpand / 2), (int)(totalTilesToExpand / 2)); bottomY--; Vector2 bottomVector = new Vector2(centerAsTileCoords.X, bottomY) * 16f + new Vector2(8f); - Texture2D texture = ModContent.GetTexture(Texture); - float yMax = 1600f * projectile.scale; + Texture2D texture = ModContent.Request(Texture); + float yMax = 1600f * Projectile.scale; for (int y = 0; y < yMax; y += 30) { float thetaDelta = MathHelper.Pi * y / yMax; - float scale = projectile.scale * MathHelper.Lerp(0.3f, 1.4f, y / yMax); + float scale = Projectile.scale * MathHelper.Lerp(0.3f, 1.4f, y / yMax); float alphaMultiplier = MathHelper.Lerp(1f, 0.6f, y / yMax); spriteBatch.Draw(texture, bottomVector - Main.screenPosition - Vector2.UnitY * y, null, - Color.White * projectile.Opacity * 0.3f * alphaMultiplier, - projectile.rotation + thetaDelta, + Color.White * Projectile.Opacity * 0.3f * alphaMultiplier, + Projectile.rotation + thetaDelta, texture.Size() * 0.5f, scale, SpriteEffects.None, @@ -200,9 +200,9 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override bool CanHitPlayer(Player target) => projectile.ai[0] >= 90f; + public override bool CanHitPlayer(Player target) => Projectile.ai[0] >= 90f; - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 240f * projectile.scale, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 240f * Projectile.scale, targetHitbox); public override void OnHitPlayer(Player target, int damage, bool crit) { diff --git a/Projectiles/Boss/PhantomBlast.cs b/Projectiles/Boss/PhantomBlast.cs index 99ddc38122..6c6455a663 100644 --- a/Projectiles/Boss/PhantomBlast.cs +++ b/Projectiles/Boss/PhantomBlast.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -17,87 +18,87 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 18; - projectile.height = 18; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 18; + Projectile.height = 18; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - if (projectile.velocity.Length() < 10f) - projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() < 10f) + Projectile.velocity *= 1.01f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { - projectile.alpha -= 5; - if (projectile.alpha < 30) - projectile.alpha = 30; + Projectile.alpha -= 5; + if (Projectile.alpha < 30) + Projectile.alpha = 30; } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 24f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 24f) { - projectile.localAI[1] = 0f; + Projectile.localAI[1] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * -projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * -Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy(projectile.rotation - MathHelper.PiOver2); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 180, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy(Projectile.rotation - MathHelper.PiOver2); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 180, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } } public override Color? GetAlpha(Color lightColor) { - return new Color(100, 250, 250, projectile.alpha); + return new Color(100, 250, 250, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item125, projectile.position); - projectile.position.X = projectile.position.X + (projectile.width / 2); - projectile.position.Y = projectile.position.Y + (projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item125, Projectile.position); + Projectile.position.X = Projectile.position.X + (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -108,10 +109,10 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Boss/PhantomBlast2.cs b/Projectiles/Boss/PhantomBlast2.cs index 6943e5185b..9eb070751a 100644 --- a/Projectiles/Boss/PhantomBlast2.cs +++ b/Projectiles/Boss/PhantomBlast2.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -17,87 +18,87 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 18; - projectile.height = 18; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 18; + Projectile.height = 18; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - if (projectile.velocity.Length() < 12f) - projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() < 12f) + Projectile.velocity *= 1.01f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { - projectile.alpha -= 5; - if (projectile.alpha < 30) - projectile.alpha = 30; + Projectile.alpha -= 5; + if (Projectile.alpha < 30) + Projectile.alpha = 30; } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 24f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 24f) { - projectile.localAI[1] = 0f; + Projectile.localAI[1] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * -projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * -Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy(projectile.rotation - MathHelper.PiOver2); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy(Projectile.rotation - MathHelper.PiOver2); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } } public override Color? GetAlpha(Color lightColor) { - return new Color(250, 100, 100, projectile.alpha); + return new Color(250, 100, 100, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item125, projectile.position); - projectile.position.X = projectile.position.X + (projectile.width / 2); - projectile.position.Y = projectile.position.Y + (projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item125, Projectile.position); + Projectile.position.X = Projectile.position.X + (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -108,10 +109,10 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Boss/PhantomGhostShot.cs b/Projectiles/Boss/PhantomGhostShot.cs index 942ba58515..a988b509e5 100644 --- a/Projectiles/Boss/PhantomGhostShot.cs +++ b/Projectiles/Boss/PhantomGhostShot.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -17,56 +18,56 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; + Projectile.width = 14; + Projectile.height = 14; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 6f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 6f) { for (int num151 = 0; num151 < 40; num151++) { - int num152 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1f); + int num152 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1f); Main.dust[num152].velocity *= 3f; - Main.dust[num152].velocity += projectile.velocity * 0.75f; + Main.dust[num152].velocity += Projectile.velocity * 0.75f; Main.dust[num152].scale *= 1.2f; Main.dust[num152].noGravity = true; } } - if (projectile.localAI[0] > 9f) + if (Projectile.localAI[0] > 9f) { - projectile.alpha -= 5; - if (projectile.alpha < 30) - projectile.alpha = 30; + Projectile.alpha -= 5; + if (Projectile.alpha < 30) + Projectile.alpha = 30; } } @@ -77,7 +78,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(100, 250, 250, projectile.alpha); + return new Color(100, 250, 250, Projectile.alpha); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/PhantomHookShot.cs b/Projectiles/Boss/PhantomHookShot.cs index 0e678a61dc..ead363b387 100644 --- a/Projectiles/Boss/PhantomHookShot.cs +++ b/Projectiles/Boss/PhantomHookShot.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -17,56 +18,56 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; + Projectile.width = 14; + Projectile.height = 14; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 6f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 6f) { for (int num151 = 0; num151 < 40; num151++) { - int num152 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1f); + int num152 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); Main.dust[num152].velocity *= 3f; - Main.dust[num152].velocity += projectile.velocity * 0.75f; + Main.dust[num152].velocity += Projectile.velocity * 0.75f; Main.dust[num152].scale *= 1.2f; Main.dust[num152].noGravity = true; } } - if (projectile.localAI[0] > 9f) + if (Projectile.localAI[0] > 9f) { - projectile.alpha -= 5; - if (projectile.alpha < 30) - projectile.alpha = 30; + Projectile.alpha -= 5; + if (Projectile.alpha < 30) + Projectile.alpha = 30; } } @@ -77,7 +78,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(100, 250, 250, projectile.alpha); + return new Color(100, 250, 250, Projectile.alpha); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs index c5e099b1f9..af923edabb 100644 --- a/Projectiles/Boss/PhantomMine.cs +++ b/Projectiles/Boss/PhantomMine.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class PhantomMine : ModProjectile @@ -15,45 +16,45 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 480; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 480; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - if (projectile.velocity.Length() < projectile.ai[0]) - projectile.velocity *= projectile.ai[1]; + if (Projectile.velocity.Length() < Projectile.ai[0]) + Projectile.velocity *= Projectile.ai[1]; } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } - public override bool CanHitPlayer(Player target) => projectile.velocity.Length() >= projectile.ai[0]; + public override bool CanHitPlayer(Player target) => Projectile.velocity.Length() >= Projectile.ai[0]; - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 12f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 12f, targetHitbox); public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (projectile.width / 2); - projectile.position.Y = projectile.position.Y + (projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); + Projectile.width = 150; + Projectile.height = 150; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -63,17 +64,17 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.velocity.Length() >= projectile.ai[0]) + if (Projectile.velocity.Length() >= Projectile.ai[0]) { target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs index eeb39b50b1..381eaadcc4 100644 --- a/Projectiles/Boss/PhantomShot.cs +++ b/Projectiles/Boss/PhantomShot.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -19,58 +20,58 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 1.57f; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { - projectile.alpha -= 5; - if (projectile.alpha < 30) - projectile.alpha = 30; + Projectile.alpha -= 5; + if (Projectile.alpha < 30) + Projectile.alpha = 30; } - if (projectile.localAI[0] > 180f && projectile.localAI[0] < 240f && Main.expertMode) + if (Projectile.localAI[0] > 180f && Projectile.localAI[0] < 240f && Main.expertMode) { - if (projectile.ai[0] == 0f) - projectile.ai[0] = projectile.velocity.Length() * 3f; + if (Projectile.ai[0] == 0f) + Projectile.ai[0] = Projectile.velocity.Length() * 3f; - int num189 = Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector20 = Main.player[num189].Center - projectile.Center; + int num189 = Player.FindClosest(Projectile.Center, 1, 1); + Vector2 vector20 = Main.player[num189].Center - Projectile.Center; vector20.Normalize(); - vector20 *= projectile.ai[0]; + vector20 *= Projectile.ai[0]; int num190 = 80; - projectile.velocity = (projectile.velocity * (num190 - 1) + vector20) / num190; + Projectile.velocity = (Projectile.velocity * (num190 - 1) + vector20) / num190; } } public override Color? GetAlpha(Color lightColor) { - return new Color(100, 250, 250, projectile.alpha); + return new Color(100, 250, 250, Projectile.alpha); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Boss/PhantomShot2.cs b/Projectiles/Boss/PhantomShot2.cs index 3f676d115f..c9333263d1 100644 --- a/Projectiles/Boss/PhantomShot2.cs +++ b/Projectiles/Boss/PhantomShot2.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -19,58 +20,58 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 1.57f; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { - projectile.alpha -= 5; - if (projectile.alpha < 30) - projectile.alpha = 30; + Projectile.alpha -= 5; + if (Projectile.alpha < 30) + Projectile.alpha = 30; } - if (projectile.localAI[0] > 180f && projectile.localAI[0] < 300f && Main.expertMode) + if (Projectile.localAI[0] > 180f && Projectile.localAI[0] < 300f && Main.expertMode) { - if (projectile.ai[0] == 0f) - projectile.ai[0] = projectile.velocity.Length() * 2f; + if (Projectile.ai[0] == 0f) + Projectile.ai[0] = Projectile.velocity.Length() * 2f; - int num189 = Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector20 = Main.player[num189].Center - projectile.Center; + int num189 = Player.FindClosest(Projectile.Center, 1, 1); + Vector2 vector20 = Main.player[num189].Center - Projectile.Center; vector20.Normalize(); - vector20 *= projectile.ai[0]; + vector20 *= Projectile.ai[0]; int num190 = 80; - projectile.velocity = (projectile.velocity * (num190 - 1) + vector20) / num190; + Projectile.velocity = (Projectile.velocity * (num190 - 1) + vector20) / num190; } } public override Color? GetAlpha(Color lightColor) { - return new Color(250, 100, 100, projectile.alpha); + return new Color(250, 100, 100, Projectile.alpha); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Boss/PlagueExplosion.cs b/Projectiles/Boss/PlagueExplosion.cs index 8214753ba6..b6bccfd496 100644 --- a/Projectiles/Boss/PlagueExplosion.cs +++ b/Projectiles/Boss/PlagueExplosion.cs @@ -16,49 +16,49 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.15f, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.15f, 0f); float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while (num462 < num461) { - float num463 = Main.rand.Next(-7, 8) * projectile.scale; - float num464 = Main.rand.Next(-7, 8) * projectile.scale; - float num465 = Main.rand.Next(2, 6) * projectile.scale; + float num463 = Main.rand.Next(-7, 8) * Projectile.scale; + float num464 = Main.rand.Next(-7, 8) * Projectile.scale; + float num465 = Main.rand.Next(2, 6) * Projectile.scale; float num466 = (float)Math.Sqrt(num463 * num463 + num464 * num464); num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default); + int num467 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default); Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; + Main.dust[num467].position.X = Projectile.Center.X; + Main.dust[num467].position.Y = Projectile.Center.Y; Main.dust[num467].position.X += Main.rand.Next(-10, 11); Main.dust[num467].position.Y += Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; - Main.dust[num467].scale = projectile.scale * 0.35f; + Main.dust[num467].scale = Projectile.scale * 0.35f; num462++; } } diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index 2fb2905a3c..043b6f492f 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -15,38 +15,38 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.scale = 1.5f; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.scale = 1.5f; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - if (projectile.position.Y > projectile.ai[1]) - projectile.tileCollide = true; + if (Projectile.position.Y > Projectile.ai[1]) + Projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - int num123 = Player.FindClosest(projectile.Center, 1, 1); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] < (60f + projectile.ai[0] * 0.5f) && projectile.localAI[0] > 30f) + int num123 = Player.FindClosest(Projectile.Center, 1, 1); + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] < (60f + Projectile.ai[0] * 0.5f) && Projectile.localAI[0] > 30f) { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector17 = Main.player[num123].Center - projectile.Center; + float scaleFactor2 = Projectile.velocity.Length(); + Vector2 vector17 = Main.player[num123].Center - Projectile.Center; vector17.Normalize(); vector17 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector17) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 24f + vector17) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; } - if (projectile.velocity.Length() < (16f + projectile.ai[0] * 0.04f)) - projectile.velocity *= 1.02f; + if (Projectile.velocity.Length() < (16f + Projectile.ai[0] * 0.04f)) + Projectile.velocity *= 1.02f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -57,18 +57,18 @@ namespace CalamityMod.Projectiles.Boss public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == 1) + if (Projectile.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); - Vector2 vector11 = new Vector2(Main.projectileTexture[projectile.type].Width / 2, Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2); + Vector2 center = new Vector2(Projectile.Center.X, Projectile.Center.Y); + Vector2 vector11 = new Vector2(Main.projectileTexture[Projectile.type].Width / 2, Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type] / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Width, ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Height / Main.projFrames[projectile.type]) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); - Color color = new Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Color.Red); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow"), vector, - null, color, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); + vector -= new Vector2(ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Width, ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Height / Main.projFrames[Projectile.type]) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + Projectile.gfxOffY); + Color color = new Color(127 - Projectile.alpha, 127 - Projectile.alpha, 127 - Projectile.alpha, 0).MultiplyRGBA(Color.Red); + Main.spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow"), vector, + null, color, Projectile.rotation, vector11, Projectile.scale, spriteEffects, 0f); } } } diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index 799f7b178b..cf76249b93 100644 --- a/Projectiles/Boss/PlagueStingerGoliathV2.cs +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -19,23 +20,23 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.scale = 1.5f; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.scale = 1.5f; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - if (projectile.position.Y > projectile.ai[1]) - projectile.tileCollide = true; + if (Projectile.position.Y > Projectile.ai[1]) + Projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -46,33 +47,33 @@ namespace CalamityMod.Projectiles.Boss public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == 1) + if (Projectile.spriteDirection == 1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Texture2D glow = ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow"); - Vector2 origin = new Vector2(glow.Width / 2, glow.Height / Main.projFrames[projectile.type] / 2); - Vector2 drawPos = projectile.Center - Main.screenPosition; - drawPos -= new Vector2(glow.Width, glow.Height / Main.projFrames[projectile.type]) * 1f / 2f; - drawPos += origin * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); - Color color = new Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Color.Red); - Main.spriteBatch.Draw(glow, drawPos, null, color, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow"); + Vector2 origin = new Vector2(glow.Width / 2, glow.Height / Main.projFrames[Projectile.type] / 2); + Vector2 drawPos = Projectile.Center - Main.screenPosition; + drawPos -= new Vector2(glow.Width, glow.Height / Main.projFrames[Projectile.type]) * 1f / 2f; + drawPos += origin * 1f + new Vector2(0f, 0f + 4f + Projectile.gfxOffY); + Color color = new Color(127 - Projectile.alpha, 127 - Projectile.alpha, 127 - Projectile.alpha, 0).MultiplyRGBA(Color.Red); + Main.spriteBatch.Draw(glow, drawPos, null, color, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - float scale = 1.5f + projectile.ai[0] * 0.015f; + float scale = 1.5f + Projectile.ai[0] * 0.015f; int baseWidthAndHeight = 20; - int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); Main.projectile[proj].scale = scale; Main.projectile[proj].width = (int)(baseWidthAndHeight * scale); Main.projectile[proj].height = (int)(baseWidthAndHeight * scale); - Main.projectile[proj].position.X = projectile.Center.X - Main.projectile[proj].width * 0.5f; - Main.projectile[proj].position.Y = projectile.Center.Y - Main.projectile[proj].height * 0.5f; + Main.projectile[proj].position.X = Projectile.Center.X - Main.projectile[proj].width * 0.5f; + Main.projectile[proj].position.Y = Projectile.Center.Y - Main.projectile[proj].height * 0.5f; } } } diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index 2ae91f8ab1..9c4572ee42 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -13,79 +13,79 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Profaned Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 32; - projectile.height = 32; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 300; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 32; + Projectile.height = 32; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.timeLeft = 300; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - if (projectile.timeLeft < 210) - projectile.tileCollide = true; + if (Projectile.timeLeft < 210) + Projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver4; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver4; - if (projectile.alpha > 0) - projectile.alpha -= 17; + if (Projectile.alpha > 0) + Projectile.alpha -= 17; - projectile.ai[1] += 1f; - if (projectile.ai[1] <= 20f) - projectile.velocity *= 0.95f; - else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) - projectile.velocity *= 1.1f; - else if (projectile.ai[1] == 40f) - projectile.ai[1] = 0f; + Projectile.ai[1] += 1f; + if (Projectile.ai[1] <= 20f) + Projectile.velocity *= 0.95f; + else if (Projectile.ai[1] > 20f && Projectile.ai[1] <= 39f) + Projectile.velocity *= 1.1f; + else if (Projectile.ai[1] == 40f) + Projectile.ai[1] = 0f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 30f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } } public override Color? GetAlpha(Color lightColor) { - return new Color(250, 150, 0, projectile.alpha); + return new Color(250, 150, 0, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index 331fd09af9..d6a5196ce3 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class ProvidenceCrystal : ModProjectile @@ -19,88 +20,88 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 160; - projectile.height = 160; - projectile.ignoreWater = true; - projectile.timeLeft = BossRushEvent.BossRushActive ? 1500 : ((CalamityWorld.death || CalamityWorld.malice) ? 2100 : 3600); - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.penetrate = -1; + Projectile.width = 160; + Projectile.height = 160; + Projectile.ignoreWater = true; + Projectile.timeLeft = BossRushEvent.BossRushActive ? 1500 : ((CalamityWorld.death || CalamityWorld.malice) ? 2100 : 3600); + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.penetrate = -1; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player.dead || NPC.CountNPCS(ModContent.NPCType()) < 1) { - projectile.active = false; - projectile.netUpdate = true; + Projectile.active = false; + Projectile.netUpdate = true; return; } bool dayTime = Main.dayTime && !CalamityWorld.malice; - projectile.position.X = Main.player[projectile.owner].Center.X - (projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 360f; - if (Main.player[projectile.owner].gravDir == -1f) + Projectile.position.X = Main.player[Projectile.owner].Center.X - (Projectile.width / 2); + Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (Projectile.height / 2) + Main.player[Projectile.owner].gfxOffY - 360f; + if (Main.player[Projectile.owner].gravDir == -1f) { - projectile.position.Y = projectile.position.Y + 400f; - projectile.rotation = 3.14f; + Projectile.position.Y = Projectile.position.Y + 400f; + Projectile.rotation = 3.14f; } else { - projectile.rotation = 0f; + Projectile.rotation = 0f; } - projectile.position.X = (int)projectile.position.X; - projectile.position.Y = (int)projectile.position.Y; - projectile.velocity = Vector2.Zero; - projectile.alpha -= 5; - if (projectile.alpha < 0) + Projectile.position.X = (int)Projectile.position.X; + Projectile.position.Y = (int)Projectile.position.Y; + Projectile.velocity = Vector2.Zero; + Projectile.alpha -= 5; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.direction == 0) + if (Projectile.direction == 0) { - projectile.direction = Main.player[projectile.owner].direction; + Projectile.direction = Main.player[Projectile.owner].direction; } - if (projectile.alpha == 0 && Main.rand.NextBool(15)) + if (Projectile.alpha == 0 && Main.rand.NextBool(15)) { - Dust dust34 = Main.dust[Dust.NewDust(projectile.Top, 0, 0, 267, 0f, 0f, 100, dayTime ? new Color(255, 200, Main.DiscoB) : new Color(Main.DiscoR, 200, 255), 1f)]; + Dust dust34 = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, 267, 0f, 0f, 100, dayTime ? new Color(255, 200, Main.DiscoB) : new Color(Main.DiscoR, 200, 255), 1f)]; dust34.velocity.X = 0f; dust34.noGravity = true; dust34.fadeIn = 1f; - dust34.position = projectile.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f); + dust34.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f); dust34.scale = 0.5f; } - float lifeRatio = projectile.ai[0]; + float lifeRatio = Projectile.ai[0]; // Increment timer - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; // Spawn daytime shards every 300 frames // Spawn nighttime shards every 30 frames - if (projectile.localAI[0] >= (dayTime ? 300f : 30f)) + if (Projectile.localAI[0] >= (dayTime ? 300f : 30f)) { // Spawn shards every 30 frames at night or at 300 frames during day - if (projectile.localAI[0] % 30f == 0f || dayTime) + if (Projectile.localAI[0] % 30f == 0f || dayTime) { - Main.PlaySound(SoundID.Item109, projectile.position); - projectile.netUpdate = true; - if (projectile.owner == Main.myPlayer) + SoundEngine.PlaySound(SoundID.Item109, Projectile.position); + Projectile.netUpdate = true; + if (Projectile.owner == Main.myPlayer) { - int totalProjectiles = dayTime ? 15 : (projectile.localAI[0] % 60f == 0f ? 15 : 10); + int totalProjectiles = dayTime ? 15 : (Projectile.localAI[0] % 60f == 0f ? 15 : 10); float speedX = dayTime ? -21f : -15f; float speedAdjustment = Math.Abs(speedX * 2f / (totalProjectiles - 1)); float speedY = -3f; @@ -108,36 +109,36 @@ namespace CalamityMod.Projectiles.Boss { float x4 = dayTime ? Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X : Main.rgbToHsl(new Color(Main.DiscoR, 200, 255)).X; float randomSpread = dayTime ? 0f : Main.rand.Next(-150, 151) * 0.01f * (1f - lifeRatio); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX + speedAdjustment * i + randomSpread, speedY, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, x4, projectile.whoAmI); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, speedX + speedAdjustment * i + randomSpread, speedY, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, x4, Projectile.whoAmI); } } // Reset timer - if (projectile.localAI[0] >= 60f) - projectile.localAI[0] = 0f; + if (Projectile.localAI[0] >= 60f) + Projectile.localAI[0] = 0f; } } } public override Color? GetAlpha(Color lightColor) { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color25 = Lighting.GetColor((int)(projectile.position.X + projectile.width * 0.5) / 16, (int)((projectile.position.Y + projectile.height * 0.5) / 16.0)); - Vector2 vector59 = projectile.position + new Vector2(projectile.width, projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = Main.projectileTexture[projectile.type]; - Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Color alpha5 = projectile.GetAlpha(color25); + Color color25 = Lighting.GetColor((int)(Projectile.position.X + Projectile.width * 0.5) / 16, (int)((Projectile.position.Y + Projectile.height * 0.5) / 16.0)); + Vector2 vector59 = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D34 = Main.projectileTexture[Projectile.type]; + Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alpha5 = Projectile.GetAlpha(color25); Vector2 origin11 = rectangle17.Size() / 2f; - float scaleFactor5 = (float)Math.Cos(MathHelper.TwoPi * (projectile.localAI[0] / 60f)) + 3f + 3f; + float scaleFactor5 = (float)Math.Cos(MathHelper.TwoPi * (Projectile.localAI[0] / 60f)) + 3f + 3f; for (float num286 = 0f; num286 < 4f; num286 += 1f) { double angle = num286 * MathHelper.PiOver2; Vector2 center = default; - Main.spriteBatch.Draw(texture2D34, vector59 + Vector2.UnitY.RotatedBy(angle, center) * scaleFactor5, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * 0.2f, projectile.rotation, origin11, projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture2D34, vector59 + Vector2.UnitY.RotatedBy(angle, center) * scaleFactor5, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * 0.2f, Projectile.rotation, origin11, Projectile.scale, SpriteEffects.None, 0f); } return false; } diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index cb0805a5f0..7b4e8b22cc 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -6,6 +6,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class ProvidenceCrystalShard : ModProjectile @@ -17,83 +18,83 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 34; - projectile.height = 34; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 600; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 34; + Projectile.height = 34; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 600; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { if (!Main.dayTime || CalamityWorld.malice || BossRushEvent.BossRushActive) - projectile.extraUpdates = 1; + Projectile.extraUpdates = 1; - if (projectile.timeLeft < 300) + if (Projectile.timeLeft < 300) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - Color newColor2 = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); - if (projectile.alpha > 0) + Color newColor2 = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); + if (Projectile.alpha > 0) { - projectile.alpha -= 8; + Projectile.alpha -= 8; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - Lighting.AddLight(projectile.Center, newColor2.ToVector3() * 0.5f); + Lighting.AddLight(Projectile.Center, newColor2.ToVector3() * 0.5f); } - projectile.velocity.X *= 0.995f; - if (projectile.velocity.Y < 0f) + Projectile.velocity.X *= 0.995f; + if (Projectile.velocity.Y < 0f) { - projectile.velocity.Y *= 0.98f; + Projectile.velocity.Y *= 0.98f; } else { - projectile.velocity.Y *= 1.06f; + Projectile.velocity.Y *= 1.06f; float fallSpeed = (CalamityWorld.revenge || BossRushEvent.BossRushActive || !Main.dayTime) ? 3.5f : 3f; - if (projectile.velocity.Y > fallSpeed) + if (Projectile.velocity.Y > fallSpeed) { - projectile.velocity.Y = fallSpeed; + Projectile.velocity.Y = fallSpeed; } } - if (projectile.velocity.Y > -0.5f && projectile.localAI[1] == 0f) + if (Projectile.velocity.Y > -0.5f && Projectile.localAI[1] == 0f) { - projectile.localAI[1] = 1f; - projectile.velocity.Y = 0.5f; + Projectile.localAI[1] = 1f; + Projectile.velocity.Y = 0.5f; } - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - 1.57f; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - 1.57f; int num3; for (int num979 = 0; num979 < 2; num979 = num3 + 1) { if (Main.rand.NextBool(10)) { - Vector2 value55 = Vector2.UnitY.RotatedBy(num979 * 3.14159274f).RotatedBy(projectile.rotation); - Dust dust24 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + Vector2 value55 = Vector2.UnitY.RotatedBy(num979 * 3.14159274f).RotatedBy(Projectile.rotation); + Dust dust24 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; dust24.noGravity = true; dust24.noLight = true; - dust24.scale = projectile.Opacity * projectile.localAI[0]; - dust24.position = projectile.Center; + dust24.scale = Projectile.Opacity * Projectile.localAI[0]; + dust24.position = Projectile.Center; dust24.velocity = value55 * 2.5f; } num3 = num979; @@ -103,11 +104,11 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(10)) { Vector2 value56 = Vector2.UnitY.RotatedBy(num980 * 3.14159274f); - Dust dust25 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + Dust dust25 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; dust25.noGravity = true; dust25.noLight = true; - dust25.scale = projectile.Opacity * projectile.localAI[0]; - dust25.position = projectile.Center; + dust25.scale = Projectile.Opacity * Projectile.localAI[0]; + dust25.position = Projectile.Center; dust25.velocity = value56 * 2.5f; } num3 = num980; @@ -123,7 +124,7 @@ namespace CalamityMod.Projectiles.Boss vector136.Normalize(); } vector136 *= 20f + Main.rand.NextFloat() * 100f; - Vector2 vector137 = projectile.Center + vector136; + Vector2 vector137 = Projectile.Center + vector136; Point point3 = vector137.ToTileCoordinates(); bool flag52 = true; if (!WorldGen.InWorld(point3.X, point3.Y, 0)) @@ -155,17 +156,17 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); float num69 = Main.rand.Next(7, 13); Vector2 value5 = new Vector2(2.1f, 2f); - Color newColor = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); + Color newColor = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); newColor.A = 255; float num72; for (float num70 = 0f; num70 < num69; num70 = num72 + 1f) { - int num71 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num71].position = projectile.Center; + int num71 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[num71].position = Projectile.Center; Main.dust[num71].velocity = spinningpoint.RotatedBy(6.28318548f * num70 / num69) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[num71].noGravity = true; Main.dust[num71].scale = 2f; @@ -180,8 +181,8 @@ namespace CalamityMod.Projectiles.Boss } for (float num73 = 0f; num73 < num69; num73 = num72 + 1f) { - int num74 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num74].position = projectile.Center; + int num74 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[num74].position = Projectile.Center; Main.dust[num74].velocity = spinningpoint.RotatedBy(6.28318548f * num73 / num69) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); Dust dust = Main.dust[num74]; dust.velocity *= Main.rand.NextFloat() * 0.8f; @@ -200,7 +201,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 026984a1be..b81555a8ad 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -21,27 +21,27 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 48; - projectile.height = 48; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 48; + Projectile.height = 48; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() @@ -49,54 +49,54 @@ namespace CalamityMod.Projectiles.Boss bool scissorLasers = CalamityWorld.revenge || !Main.dayTime || BossRushEvent.BossRushActive; Vector2? vector78 = null; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) { - projectile.velocity = -Vector2.UnitY; + Projectile.velocity = -Vector2.UnitY; } - if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType()) + if (Main.npc[(int)Projectile.ai[1]].active && Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType()) { - Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X, Main.npc[(int)projectile.ai[1]].Center.Y + 32f); - projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; + Vector2 fireFrom = new Vector2(Main.npc[(int)Projectile.ai[1]].Center.X, Main.npc[(int)Projectile.ai[1]].Center.Y + 32f); + Projectile.position = fireFrom - new Vector2(Projectile.width, Projectile.height) / 2f; } else - projectile.Kill(); + Projectile.Kill(); - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) { - projectile.velocity = -Vector2.UnitY; + Projectile.velocity = -Vector2.UnitY; } float num801 = 1f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= (scissorLasers ? 100f : 180f)) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= (scissorLasers ? 100f : 180f)) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.scale = (float)Math.Sin(projectile.localAI[0] * MathHelper.Pi / (scissorLasers ? 100f : 180f)) * 10f * num801; - if (projectile.scale > num801) + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * MathHelper.Pi / (scissorLasers ? 100f : 180f)) * 10f * num801; + if (Projectile.scale > num801) { - projectile.scale = num801; + Projectile.scale = num801; } - float num804 = projectile.velocity.ToRotation(); - num804 += projectile.ai[0]; - projectile.rotation = num804 - MathHelper.PiOver2; - projectile.velocity = num804.ToRotationVector2(); + float num804 = Projectile.velocity.ToRotation(); + num804 += Projectile.ai[0]; + Projectile.rotation = num804 - MathHelper.PiOver2; + Projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; //3f - float num806 = projectile.width; + float num806 = Projectile.width; - Vector2 samplingPoint = projectile.Center; + Vector2 samplingPoint = Projectile.Center; if (vector78.HasValue) { samplingPoint = vector78.Value; } float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); + Collision.LaserScan(samplingPoint, Projectile.velocity, num806 * Projectile.scale, 2400f, array3); float num807 = 0f; for (int num808 = 0; num808 < array3.Length; num808++) { @@ -105,18 +105,18 @@ namespace CalamityMod.Projectiles.Boss num807 /= num805; // Fire laser through walls at max length if target cannot be seen - if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1)) + if (!Collision.CanHitLine(Main.npc[(int)Projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)Projectile.ai[1]].target].Center, 1, 1)) { num807 = 2400f; } int dustType = (Main.dayTime && !CalamityWorld.malice) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; float amount = 0.5f; //0.5f - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation - Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); //length of laser, linear interpolation + Vector2 vector79 = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); for (int num809 = 0; num809 < 2; num809++) { - float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float num810 = Projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; float num811 = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 vector80 = new Vector2((float)Math.Cos(num810) * num811, (float)Math.Sin(num810) * num811); int num812 = Dust.NewDust(vector79, 0, 0, dustType, vector80.X, vector80.Y, 0, default, 1f); @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(5)) { - Vector2 value29 = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; + Vector2 value29 = Projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * Projectile.width; int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[num813]; dust.velocity *= 0.5f; @@ -134,40 +134,40 @@ namespace CalamityMod.Projectiles.Boss } DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) { return false; } bool dayTime = Main.dayTime && !CalamityWorld.malice; - Texture2D texture2D19 = dayTime ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/ProvidenceHolyRayNight"); - Texture2D texture2D20 = dayTime ? ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMid") : ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMidNight"); - Texture2D texture2D21 = dayTime ? ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEnd") : ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight"); - float num223 = projectile.localAI[1]; //length of laser + Texture2D texture2D19 = dayTime ? Main.projectileTexture[Projectile.type] : ModContent.Request("CalamityMod/Projectiles/Boss/ProvidenceHolyRayNight"); + Texture2D texture2D20 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMid") : ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMidNight"); + Texture2D texture2D21 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEnd") : ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight"); + float num223 = Projectile.localAI[1]; //length of laser Color color44 = dayTime ? new Color(250, 250, 250, 0) : new Color(175, 175, 250, 0) * 0.9f; - Vector2 vector = projectile.Center - Main.screenPosition; + Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; - Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - num223 -= (texture2D19.Height / 2 + texture2D21.Height) * projectile.scale; - Vector2 value20 = projectile.Center; - value20 += projectile.velocity * projectile.scale * texture2D19.Height / 2f; + Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); + num223 -= (texture2D19.Height / 2 + texture2D21.Height) * Projectile.scale; + Vector2 value20 = Projectile.Center; + value20 += Projectile.velocity * Projectile.scale * texture2D19.Height / 2f; if (num223 > 0f) { float num224 = 0f; - Rectangle rectangle7 = new Rectangle(0, 36 * (projectile.timeLeft / 3 % 4), texture2D20.Width, 36); + Rectangle rectangle7 = new Rectangle(0, 36 * (Projectile.timeLeft / 3 % 4), texture2D20.Width, 36); while (num224 + 1f < num223) { if (num223 - num224 < rectangle7.Height) { rectangle7.Height = (int)(num223 - num224); } - Main.spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color44, projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f); - num224 += rectangle7.Height * projectile.scale; - value20 += projectile.velocity * rectangle7.Height * projectile.scale; + Main.spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color44, Projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0f); + num224 += rectangle7.Height * Projectile.scale; + value20 += Projectile.velocity * rectangle7.Height * Projectile.scale; rectangle7.Y += 36; if (rectangle7.Y + rectangle7.Height > texture2D20.Height) { @@ -177,15 +177,15 @@ namespace CalamityMod.Projectiles.Boss } Vector2 vector2 = value20 - Main.screenPosition; sourceRectangle2 = null; - Main.spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, color44, projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, color44, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -195,7 +195,7 @@ namespace CalamityMod.Projectiles.Boss return true; } float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref num6)) { return true; } @@ -208,7 +208,7 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(buffType, 420); } - public override bool CanHitPlayer(Player target) => projectile.scale >= 0.5f; + public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { diff --git a/Projectiles/Boss/RavagerFlame.cs b/Projectiles/Boss/RavagerFlame.cs index e78a015ebf..a81c3b76e5 100644 --- a/Projectiles/Boss/RavagerFlame.cs +++ b/Projectiles/Boss/RavagerFlame.cs @@ -3,6 +3,7 @@ using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -17,31 +18,31 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.aiStyle = 1; - projectile.extraUpdates = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 2 : 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.aiStyle = 1; + Projectile.extraUpdates = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? 2 : 1; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { for (int num468 = 0; num468 < 2; num468++) { - int num469 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 3f); + int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 3f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } } diff --git a/Projectiles/Boss/RedLightning.cs b/Projectiles/Boss/RedLightning.cs index b8d1144e2b..7cf30b9006 100644 --- a/Projectiles/Boss/RedLightning.cs +++ b/Projectiles/Boss/RedLightning.cs @@ -15,69 +15,69 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Red Lightning"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.extraUpdates = 20; - projectile.timeLeft = 1260; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 20; + Projectile.timeLeft = 1260; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - if (projectile.frameCounter == 0 || projectile.oldPos[0] == Vector2.Zero) + if (Projectile.frameCounter == 0 || Projectile.oldPos[0] == Vector2.Zero) { - for (int num31 = projectile.oldPos.Length - 1; num31 > 0; num31--) + for (int num31 = Projectile.oldPos.Length - 1; num31 > 0; num31--) { - projectile.oldPos[num31] = projectile.oldPos[num31 - 1]; + Projectile.oldPos[num31] = Projectile.oldPos[num31 - 1]; } - projectile.oldPos[0] = projectile.position; - if (projectile.velocity == Vector2.Zero) + Projectile.oldPos[0] = Projectile.position; + if (Projectile.velocity == Vector2.Zero) { - float num32 = projectile.rotation + MathHelper.PiOver2 + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float num32 = Projectile.rotation + MathHelper.PiOver2 + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; float num33 = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 vector2 = new Vector2((float)Math.Cos((double)num32) * num33, (float)Math.Sin((double)num32) * num33); - int num34 = Dust.NewDust(projectile.oldPos[projectile.oldPos.Length - 1], 0, 0, 60, vector2.X, vector2.Y, 0, default, 1f); + int num34 = Dust.NewDust(Projectile.oldPos[Projectile.oldPos.Length - 1], 0, 0, 60, vector2.X, vector2.Y, 0, default, 1f); Main.dust[num34].noGravity = true; Main.dust[num34].scale = 1.7f; } } - int num3 = projectile.frameCounter; - projectile.frameCounter = num3 + 1; - Lighting.AddLight(projectile.Center, 0.8f, 0.25f, 0.15f); - if (projectile.velocity == Vector2.Zero) + int num3 = Projectile.frameCounter; + Projectile.frameCounter = num3 + 1; + Lighting.AddLight(Projectile.Center, 0.8f, 0.25f, 0.15f); + if (Projectile.velocity == Vector2.Zero) { - if (projectile.frameCounter >= projectile.extraUpdates * 2) + if (Projectile.frameCounter >= Projectile.extraUpdates * 2) { - projectile.frameCounter = 0; + Projectile.frameCounter = 0; bool flag36 = true; - for (int num855 = 1; num855 < projectile.oldPos.Length; num855 = num3 + 1) + for (int num855 = 1; num855 < Projectile.oldPos.Length; num855 = num3 + 1) { - if (projectile.oldPos[num855] != projectile.oldPos[0]) + if (Projectile.oldPos[num855] != Projectile.oldPos[0]) { flag36 = false; } @@ -85,44 +85,44 @@ namespace CalamityMod.Projectiles.Boss } if (flag36) { - projectile.Kill(); + Projectile.Kill(); return; } } - if (Main.rand.Next(projectile.extraUpdates) == 0) + if (Main.rand.Next(Projectile.extraUpdates) == 0) { for (int num856 = 0; num856 < 2; num856 = num3 + 1) { - float num857 = projectile.rotation + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float num857 = Projectile.rotation + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; float num858 = (float)Main.rand.NextDouble() * 0.8f + 1f; Vector2 vector96 = new Vector2((float)Math.Cos((double)num857) * num858, (float)Math.Sin((double)num857) * num858); - int num859 = Dust.NewDust(projectile.Center, 0, 0, 60, vector96.X, vector96.Y, 0, default, 1f); + int num859 = Dust.NewDust(Projectile.Center, 0, 0, 60, vector96.X, vector96.Y, 0, default, 1f); Main.dust[num859].noGravity = true; Main.dust[num859].scale = 1.2f; num3 = num856; } if (Main.rand.NextBool(5)) { - Vector2 value39 = projectile.velocity.RotatedBy((double)MathHelper.PiOver2, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; - int num860 = Dust.NewDust(projectile.Center + value39 - Vector2.One * 4f, 8, 8, 60, 0f, 0f, 100, default, 1.5f); + Vector2 value39 = Projectile.velocity.RotatedBy((double)MathHelper.PiOver2, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)Projectile.width; + int num860 = Dust.NewDust(Projectile.Center + value39 - Vector2.One * 4f, 8, 8, 60, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[num860]; dust.velocity *= 0.5f; Main.dust[num860].velocity.Y = -Math.Abs(Main.dust[num860].velocity.Y); } } } - else if (projectile.frameCounter >= projectile.extraUpdates * 2) + else if (Projectile.frameCounter >= Projectile.extraUpdates * 2) { - projectile.frameCounter = 0; - float num861 = projectile.velocity.Length(); - UnifiedRandom unifiedRandom = new UnifiedRandom((int)projectile.ai[1]); + Projectile.frameCounter = 0; + float num861 = Projectile.velocity.Length(); + UnifiedRandom unifiedRandom = new UnifiedRandom((int)Projectile.ai[1]); int num862 = 0; Vector2 vector97 = -Vector2.UnitY; Vector2 vector98; do { int num863 = unifiedRandom.Next(); - projectile.ai[1] = (float)num863; + Projectile.ai[1] = (float)num863; num863 %= 100; float f = (float)num863 / 100f * MathHelper.TwoPi; vector98 = f.ToRotationVector2(); @@ -135,11 +135,11 @@ namespace CalamityMod.Projectiles.Boss { flag37 = true; } - if (vector98.X * (float)(projectile.extraUpdates + 1) * 2f * num861 + projectile.localAI[0] > 40f) + if (vector98.X * (float)(Projectile.extraUpdates + 1) * 2f * num861 + Projectile.localAI[0] > 40f) { flag37 = true; } - if (vector98.X * (float)(projectile.extraUpdates + 1) * 2f * num861 + projectile.localAI[0] < -40f) + if (vector98.X * (float)(Projectile.extraUpdates + 1) * 2f * num861 + Projectile.localAI[0] < -40f) { flag37 = true; } @@ -152,8 +152,8 @@ namespace CalamityMod.Projectiles.Boss } while (num3 < 100); - projectile.velocity = Vector2.Zero; - projectile.localAI[1] = 1f; + Projectile.velocity = Vector2.Zero; + Projectile.localAI[1] = 1f; goto IL_25092; @@ -161,11 +161,11 @@ namespace CalamityMod.Projectiles.Boss vector97 = vector98; IL_25092: - if (projectile.velocity != Vector2.Zero) + if (Projectile.velocity != Vector2.Zero) { - projectile.localAI[0] += vector97.X * (float)(projectile.extraUpdates + 1) * 2f * num861; - projectile.velocity = vector97.RotatedBy((double)(projectile.ai[0] + MathHelper.PiOver2), default(Vector2)) * num861; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.localAI[0] += vector97.X * (float)(Projectile.extraUpdates + 1) * 2f * num861; + Projectile.velocity = vector97.RotatedBy((double)(Projectile.ai[0] + MathHelper.PiOver2), default(Vector2)) * num861; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } } } @@ -182,41 +182,41 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 end = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D tex3 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/RedLightningTexture"); - projectile.GetAlpha(lightColor); - Vector2 scale16 = new Vector2(projectile.scale) / 2f; + Vector2 end = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D tex3 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/RedLightningTexture"); + Projectile.GetAlpha(lightColor); + Vector2 scale16 = new Vector2(Projectile.scale) / 2f; for (int num289 = 0; num289 < 3; num289++) { if (num289 == 0) { - scale16 = new Vector2(projectile.scale) * 0.6f; + scale16 = new Vector2(Projectile.scale) * 0.6f; DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(219, 104, 58, 0) * 0.5f; } else if (num289 == 1) { - scale16 = new Vector2(projectile.scale) * 0.4f; + scale16 = new Vector2(Projectile.scale) * 0.4f; DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, 126, 56, 0) * 0.5f; } else { - scale16 = new Vector2(projectile.scale) * 0.2f; + scale16 = new Vector2(Projectile.scale) * 0.2f; DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, 128, 128, 0) * 0.5f; } DelegateMethods.f_1 = 1f; - for (int num290 = projectile.oldPos.Length - 1; num290 > 0; num290--) + for (int num290 = Projectile.oldPos.Length - 1; num290 > 0; num290--) { - if (!(projectile.oldPos[num290] == Vector2.Zero)) + if (!(Projectile.oldPos[num290] == Vector2.Zero)) { - Vector2 start = projectile.oldPos[num290] + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Vector2 end2 = projectile.oldPos[num290 - 1] + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Vector2 start = Projectile.oldPos[num290] + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Vector2 end2 = Projectile.oldPos[num290 - 1] + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Utils.DrawLaser(spriteBatch, tex3, start, end2, scale16, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } } - if (projectile.oldPos[0] != Vector2.Zero) + if (Projectile.oldPos[0] != Vector2.Zero) { DelegateMethods.f_1 = 1f; - Vector2 start2 = projectile.oldPos[0] + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Vector2 start2 = Projectile.oldPos[0] + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex3, start2, end, scale16, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } } diff --git a/Projectiles/Boss/RedLightningFeather.cs b/Projectiles/Boss/RedLightningFeather.cs index 3cac749a34..4ec58b24de 100644 --- a/Projectiles/Boss/RedLightningFeather.cs +++ b/Projectiles/Boss/RedLightningFeather.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -12,137 +13,137 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Lightning Feather"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 1200; + Projectile.width = 20; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 1200; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2(-projectile.velocity.Y, -projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2(-Projectile.velocity.Y, -Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); } - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 1170) / 30f), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 1170) / 30f), 0f, 1f); - Lighting.AddLight(projectile.Center, 0.7f * projectile.Opacity, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.7f * Projectile.Opacity, 0f, 0f); - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; float timeGateValue = 150f; float timeGateValue2 = 300f; - if (projectile.ai[0] > timeGateValue) + if (Projectile.ai[0] > timeGateValue) { - int num103 = Player.FindClosest(projectile.Center, 1, 1); + int num103 = Player.FindClosest(Projectile.Center, 1, 1); - if (projectile.ai[0] <= timeGateValue2) + if (Projectile.ai[0] <= timeGateValue2) { - if (projectile.ai[0] == timeGateValue2) + if (Projectile.ai[0] == timeGateValue2) { - Vector2 aimVector = projectile.ai[1] == 0f ? (Main.player[num103].velocity * 20f) : Vector2.Zero; - Vector2 v4 = Main.player[num103].Center + aimVector - projectile.Center; + Vector2 aimVector = Projectile.ai[1] == 0f ? (Main.player[num103].velocity * 20f) : Vector2.Zero; + Vector2 v4 = Main.player[num103].Center + aimVector - Projectile.Center; if (float.IsNaN(v4.X) || float.IsNaN(v4.Y)) v4 = -Vector2.UnitY; EmitDust(); - projectile.velocity = Vector2.Normalize(v4) * 18f; + Projectile.velocity = Vector2.Normalize(v4) * 18f; } - else if (projectile.ai[0] > timeGateValue2 - 30f) + else if (Projectile.ai[0] > timeGateValue2 - 30f) { - if (projectile.velocity.Length() > 2f) - projectile.velocity *= 0.9f; + if (Projectile.velocity.Length() > 2f) + Projectile.velocity *= 0.9f; } else { - if (projectile.velocity.Length() < 12f) - projectile.velocity *= 1.02f; + if (Projectile.velocity.Length() < 12f) + Projectile.velocity *= 1.02f; - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; + float scaleFactor2 = Projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - Projectile.Center; vector11.Normalize(); vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 24f + vector11) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; } } else - projectile.tileCollide = true; + Projectile.tileCollide = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, Main.projectileTexture[projectile.type], false); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, Main.projectileTexture[Projectile.type], false); return false; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); EmitDust(); - projectile.Damage(); + Projectile.Damage(); } private void EmitDust() { - Main.PlaySound(SoundID.Item109, projectile.position); + SoundEngine.PlaySound(SoundID.Item109, Projectile.position); for (int num193 = 0; num193 < 6; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); } for (int num194 = 0; num194 < 10; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; target.AddBuff(BuffID.Electrified, 60); diff --git a/Projectiles/Boss/SCalRitualDrama.cs b/Projectiles/Boss/SCalRitualDrama.cs index ded26c46c2..d5e32b840b 100644 --- a/Projectiles/Boss/SCalRitualDrama.cs +++ b/Projectiles/Boss/SCalRitualDrama.cs @@ -5,22 +5,23 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class SCalRitualDrama : ModProjectile { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public const int TotalRitualTime = 270; public override void SetStaticDefaults() => DisplayName.SetDefault("Calamitous Ritual Drama"); public override void SetDefaults() { - projectile.width = projectile.height = 2; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = TotalRitualTime + 420; + Projectile.width = Projectile.height = 2; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = TotalRitualTime + 420; } public override void AI() @@ -32,7 +33,7 @@ namespace CalamityMod.Projectiles.Boss { SCalSky.OverridingIntensity = Utils.InverseLerp(90f, TotalRitualTime - 25f, Time, true); Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.InverseLerp(90f, TotalRitualTime - 25f, Time, true); - Main.LocalPlayer.Calamity().GeneralScreenShakePower *= Utils.InverseLerp(3400f, 1560f, Main.LocalPlayer.Distance(projectile.Center), true) * 4f; + Main.LocalPlayer.Calamity().GeneralScreenShakePower *= Utils.InverseLerp(3400f, 1560f, Main.LocalPlayer.Distance(Projectile.Center), true) * 4f; } // Summon SCal right before the ritual effect ends. @@ -43,7 +44,7 @@ namespace CalamityMod.Projectiles.Boss if (Time >= TotalRitualTime) { if (Main.netMode != NetmodeID.MultiplayerClient && !NPC.AnyNPCs(ModContent.NPCType())) - projectile.Kill(); + Projectile.Kill(); return; } @@ -52,7 +53,7 @@ namespace CalamityMod.Projectiles.Boss { if (Main.rand.NextBool(4)) { - Dust brimstone = Dust.NewDustPerfect(projectile.Center + new Vector2(Main.rand.NextFloat(-20f, 24f), Main.rand.NextFloat(10f, 18f)), 267); + Dust brimstone = Dust.NewDustPerfect(Projectile.Center + new Vector2(Main.rand.NextFloat(-20f, 24f), Main.rand.NextFloat(10f, 18f)), 267); brimstone.scale = Main.rand.NextFloat(0.7f, 1f); brimstone.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat()); brimstone.fadeIn = 0.7f; @@ -69,13 +70,13 @@ namespace CalamityMod.Projectiles.Boss // Summon SCal serverside. // All the other acoustic and visual effects can happen client-side. if (Main.netMode != NetmodeID.MultiplayerClient) - CalamityUtils.SpawnBossBetter(projectile.Center - new Vector2(60f), ModContent.NPCType()); + CalamityUtils.SpawnBossBetter(Projectile.Center - new Vector2(60f), ModContent.NPCType()); // Make a laugh sound and create a burst of brimstone dust. - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SupremeCalamitasSpawn"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SupremeCalamitasSpawn"), Projectile.Center); // Make a sudden screen shake. - Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.InverseLerp(3400f, 1560f, Main.LocalPlayer.Distance(projectile.Center), true) * 16f; + Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.InverseLerp(3400f, 1560f, Main.LocalPlayer.Distance(Projectile.Center), true) * 16f; // Generate a dust explosion at the ritual's position. float burstDirectionVariance = 3; @@ -85,7 +86,7 @@ namespace CalamityMod.Projectiles.Boss burstDirectionVariance += j * 2; for (int k = 0; k < 40; k++) { - Dust burstDust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.Brimstone); + Dust burstDust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.Brimstone); burstDust.scale = Main.rand.NextFloat(3.1f, 3.5f); burstDust.position += Main.rand.NextVector2Circular(10f, 10f); burstDust.velocity = Main.rand.NextVector2Square(-burstDirectionVariance, burstDirectionVariance).SafeNormalize(Vector2.UnitY) * burstSpeed; diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs index ecd1974bc8..7cc3aa296d 100644 --- a/Projectiles/Boss/SandBlast.cs +++ b/Projectiles/Boss/SandBlast.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -12,29 +13,29 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Sand Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.Opacity = 0f; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.Opacity = 0f; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { for (int num621 = 0; num621 < 2; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -42,37 +43,37 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 21); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 21); } - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - int num103 = Player.FindClosest(projectile.Center, 1, 1); + int num103 = Player.FindClosest(Projectile.Center, 1, 1); float inertia = 60f; - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; + float scaleFactor2 = Projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - Projectile.Center; vector11.Normalize(); vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * (inertia - 1f) + vector11) / inertia; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + vector11) / inertia; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; } - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - projectile.Opacity += 0.2f; - if (projectile.Opacity > 1f) - projectile.Opacity = 1f; + Projectile.Opacity += 0.2f; + if (Projectile.Opacity > 1f) + Projectile.Opacity = 1f; - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 0.8f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 0.8f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int dust = 0; dust <= 3; dust++) { float num463 = Main.rand.Next(-10, 11); @@ -82,10 +83,10 @@ namespace CalamityMod.Projectiles.Boss num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1.2f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1.2f); Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; + Main.dust[num467].position.X = Projectile.Center.X; + Main.dust[num467].position.Y = Projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; expr_149DF_cp_0.position.X += Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; @@ -97,10 +98,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/SandPoisonCloud.cs b/Projectiles/Boss/SandPoisonCloud.cs index 9b7134e779..ef2cf6507e 100644 --- a/Projectiles/Boss/SandPoisonCloud.cs +++ b/Projectiles/Boss/SandPoisonCloud.cs @@ -12,77 +12,77 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Toxic Cloud"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 52; - projectile.height = 48; - projectile.hostile = true; - projectile.Opacity = 0f; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 1800; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 52; + Projectile.height = 48; + Projectile.hostile = true; + Projectile.Opacity = 0f; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 1800; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.3f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.3f, 0f); - projectile.frameCounter++; - if (projectile.frameCounter > 9) + Projectile.frameCounter++; + if (Projectile.frameCounter > 9) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - projectile.velocity *= 0.995f; + Projectile.velocity *= 0.995f; - if (projectile.timeLeft < 180) + if (Projectile.timeLeft < 180) { - projectile.damage = 0; - if (projectile.Opacity > 0f) + Projectile.damage = 0; + if (Projectile.Opacity > 0f) { - projectile.Opacity -= 0.02f; - if (projectile.Opacity <= 0f) + Projectile.Opacity -= 0.02f; + if (Projectile.Opacity <= 0f) { - projectile.Opacity = 0f; - projectile.Kill(); + Projectile.Opacity = 0f; + Projectile.Kill(); } } } - else if (projectile.Opacity < 0.9f) + else if (Projectile.Opacity < 0.9f) { - projectile.Opacity += 0.12f; - if (projectile.Opacity > 0.9f) - projectile.Opacity = 0.9f; + Projectile.Opacity += 0.12f; + if (Projectile.Opacity > 0.9f) + Projectile.Opacity = 0.9f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 20f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f, targetHitbox); - public override bool CanHitPlayer(Player target) => projectile.Opacity == 0.9f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 0.9f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity == 0.9f) + if (Projectile.Opacity == 0.9f) target.AddBuff(ModContent.BuffType(), 240, true); } } diff --git a/Projectiles/Boss/SandPoisonCloudOldDuke.cs b/Projectiles/Boss/SandPoisonCloudOldDuke.cs index 9952c4b25a..85e6f0634c 100644 --- a/Projectiles/Boss/SandPoisonCloudOldDuke.cs +++ b/Projectiles/Boss/SandPoisonCloudOldDuke.cs @@ -14,76 +14,76 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Toxic Cloud"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 52; - projectile.height = 48; - projectile.hostile = true; - projectile.Opacity = 0f; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 1800; + Projectile.width = 52; + Projectile.height = 48; + Projectile.hostile = true; + Projectile.Opacity = 0f; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 1800; cooldownSlot = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.3f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.3f, 0f); - projectile.frameCounter++; - if (projectile.frameCounter > 9) + Projectile.frameCounter++; + if (Projectile.frameCounter > 9) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - projectile.velocity *= 0.995f; + Projectile.velocity *= 0.995f; - if (projectile.timeLeft < 180) + if (Projectile.timeLeft < 180) { - projectile.damage = 0; - if (projectile.Opacity > 0f) + Projectile.damage = 0; + if (Projectile.Opacity > 0f) { - projectile.Opacity -= 0.02f; - if (projectile.Opacity <= 0f) + Projectile.Opacity -= 0.02f; + if (Projectile.Opacity <= 0f) { - projectile.Opacity = 0f; - projectile.Kill(); + Projectile.Opacity = 0f; + Projectile.Kill(); } } } - else if (projectile.Opacity < 0.9f) + else if (Projectile.Opacity < 0.9f) { - projectile.Opacity += 0.12f; - if (projectile.Opacity > 0.9f) - projectile.Opacity = 0.9f; + Projectile.Opacity += 0.12f; + if (Projectile.Opacity > 0.9f) + Projectile.Opacity = 0.9f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 20f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f, targetHitbox); - public override bool CanHitPlayer(Player target) => projectile.Opacity == 0.9f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 0.9f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity == 0.9f) + if (Projectile.Opacity == 0.9f) target.AddBuff(ModContent.BuffType(), 240, true); } diff --git a/Projectiles/Boss/SandTooth.cs b/Projectiles/Boss/SandTooth.cs index 2556f4087d..b6574dd33b 100644 --- a/Projectiles/Boss/SandTooth.cs +++ b/Projectiles/Boss/SandTooth.cs @@ -14,43 +14,43 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - int num103 = Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 150f && projectile.ai[1] > 30f) + int num103 = Player.FindClosest(Projectile.Center, 1, 1); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] < 150f && Projectile.ai[1] > 30f) { float inertia = 20f; - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; + float scaleFactor2 = Projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - Projectile.Center; vector11.Normalize(); vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * (inertia - 1f) + vector11) / inertia; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + vector11) / inertia; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; } - else if (projectile.ai[0] == 1f) + else if (Projectile.ai[0] == 1f) { - if (projectile.velocity.Length() < 16f) - projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() < 16f) + Projectile.velocity *= 1.01f; } - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver4; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Boss/SandToothOldDuke.cs b/Projectiles/Boss/SandToothOldDuke.cs index 5a79d95a7a..277e99e97f 100644 --- a/Projectiles/Boss/SandToothOldDuke.cs +++ b/Projectiles/Boss/SandToothOldDuke.cs @@ -16,37 +16,37 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 450; + Projectile.width = 20; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 450; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - int num103 = Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 250f && projectile.ai[1] > 60f) + int num103 = Player.FindClosest(Projectile.Center, 1, 1); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] < 250f && Projectile.ai[1] > 60f) { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; + float scaleFactor2 = Projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - Projectile.Center; vector11.Normalize(); vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 24f + vector11) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; } - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver4; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/ScavengerLaser.cs index 4fdd01ca89..355c283c57 100644 --- a/Projectiles/Boss/ScavengerLaser.cs +++ b/Projectiles/Boss/ScavengerLaser.cs @@ -6,6 +6,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -14,151 +15,151 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Homing Dart"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 600; + Projectile.width = 16; + Projectile.height = 16; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.timeLeft = 600; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) - projectile.frame = 0; + if (Projectile.frame > 4) + Projectile.frame = 0; - projectile.alpha -= 40; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 40; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - if (projectile.alpha < 40) + if (Projectile.alpha < 40) { - int num805 = Dust.NewDust(projectile.Center - Vector2.One * 5f, 10, 10, 244, -projectile.velocity.X / 3f, -projectile.velocity.Y / 3f, 150, Color.Transparent, 0.6f); + int num805 = Dust.NewDust(Projectile.Center - Vector2.One * 5f, 10, 10, 244, -Projectile.velocity.X / 3f, -Projectile.velocity.Y / 3f, 150, Color.Transparent, 0.6f); Main.dust[num805].noGravity = true; } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (projectile.ai[1] == -1f) + if (Projectile.ai[1] == -1f) { - if (projectile.velocity.Length() < 18f) - projectile.velocity *= 1.05f; + if (Projectile.velocity.Length() < 18f) + Projectile.velocity *= 1.05f; else - projectile.tileCollide = true; + Projectile.tileCollide = true; return; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 45f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 45f) { - projectile.localAI[0] = 0f; - projectile.ai[0] = 1f; - projectile.ai[1] = Player.FindClosest(projectile.position, projectile.width, projectile.height); - projectile.netUpdate = true; + Projectile.localAI[0] = 0f; + Projectile.ai[0] = 1f; + Projectile.ai[1] = Player.FindClosest(Projectile.position, Projectile.width, Projectile.height); + Projectile.netUpdate = true; } - projectile.velocity.X = projectile.velocity.RotatedBy(0.0, default).X; - projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); + Projectile.velocity.X = Projectile.velocity.RotatedBy(0.0, default).X; + Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -6f, 6f); - projectile.velocity.Y = projectile.velocity.Y - 0.08f; - if (projectile.velocity.Y > 0f) - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - if (projectile.velocity.Y < -7f) - projectile.velocity.Y = -7f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.08f; + if (Projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; + if (Projectile.velocity.Y < -7f) + Projectile.velocity.Y = -7f; } - else if (projectile.ai[0] == 1f) + else if (Projectile.ai[0] == 1f) { - if (Main.player[(int)projectile.ai[1]].Center.Y > projectile.Center.Y + 90f) + if (Main.player[(int)Projectile.ai[1]].Center.Y > Projectile.Center.Y + 90f) { - projectile.ai[0] = 2f; - projectile.netUpdate = true; + Projectile.ai[0] = 2f; + Projectile.netUpdate = true; } - projectile.velocity.X = projectile.velocity.RotatedBy(0.0, default).X; - projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); + Projectile.velocity.X = Projectile.velocity.RotatedBy(0.0, default).X; + Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -6f, 6f); - projectile.velocity.Y = projectile.velocity.Y - 0.08f; - if (projectile.velocity.Y > 0f) - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - if (projectile.velocity.Y < -7f) - projectile.velocity.Y = -7f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.08f; + if (Projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; + if (Projectile.velocity.Y < -7f) + Projectile.velocity.Y = -7f; } - else if (projectile.ai[0] == 2f) + else if (Projectile.ai[0] == 2f) { - if (Main.player[(int)projectile.ai[1]].Center.Y < projectile.Center.Y) - projectile.tileCollide = true; + if (Main.player[(int)Projectile.ai[1]].Center.Y < Projectile.Center.Y) + Projectile.tileCollide = true; float speed = revenge ? 9f : 7.5f; - Vector2 vector70 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; + Vector2 vector70 = Main.player[(int)Projectile.ai[1]].Center - Projectile.Center; if (vector70.Length() < 20f) { - projectile.Kill(); + Projectile.Kill(); return; } vector70.Normalize(); vector70 *= 14f; - vector70 = Vector2.Lerp(projectile.velocity, vector70, 0.6f); + vector70 = Vector2.Lerp(Projectile.velocity, vector70, 0.6f); if (vector70.Y < speed) vector70.Y = speed; float num804 = 0.4f; - if (projectile.velocity.X < vector70.X) + if (Projectile.velocity.X < vector70.X) { - projectile.velocity.X = projectile.velocity.X + num804; - if (projectile.velocity.X < 0f && vector70.X > 0f) - projectile.velocity.X = projectile.velocity.X + num804; + Projectile.velocity.X = Projectile.velocity.X + num804; + if (Projectile.velocity.X < 0f && vector70.X > 0f) + Projectile.velocity.X = Projectile.velocity.X + num804; } - else if (projectile.velocity.X > vector70.X) + else if (Projectile.velocity.X > vector70.X) { - projectile.velocity.X = projectile.velocity.X - num804; - if (projectile.velocity.X > 0f && vector70.X < 0f) - projectile.velocity.X = projectile.velocity.X - num804; + Projectile.velocity.X = Projectile.velocity.X - num804; + if (Projectile.velocity.X > 0f && vector70.X < 0f) + Projectile.velocity.X = Projectile.velocity.X - num804; } - if (projectile.velocity.Y < vector70.Y) + if (Projectile.velocity.Y < vector70.Y) { - projectile.velocity.Y = projectile.velocity.Y + num804; - if (projectile.velocity.Y < 0f && vector70.Y > 0f) - projectile.velocity.Y = projectile.velocity.Y + num804; + Projectile.velocity.Y = Projectile.velocity.Y + num804; + if (Projectile.velocity.Y < 0f && vector70.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num804; } - else if (projectile.velocity.Y > vector70.Y) + else if (Projectile.velocity.Y > vector70.Y) { - projectile.velocity.Y = projectile.velocity.Y - num804; - if (projectile.velocity.Y > 0f && vector70.Y < 0f) - projectile.velocity.Y = projectile.velocity.Y - num804; + Projectile.velocity.Y = Projectile.velocity.Y - num804; + if (Projectile.velocity.Y > 0f && vector70.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num804; } } } @@ -170,36 +171,36 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(255, 50, 50, projectile.alpha); + return new Color(255, 50, 50, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 103, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); + SoundEngine.PlaySound(SoundID.Zombie, (int)Projectile.position.X, (int)Projectile.position.Y, 103, 1f, 0f); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, default, 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 0, default, 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - projectile.Damage(); + Projectile.Damage(); } } } diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index 07f31921f5..dde4068f98 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class ScavengerNuke : ModProjectile @@ -12,20 +13,20 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Homing Nuke"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 44; - projectile.height = 44; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 44; + Projectile.height = 44; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 600; } public override void AI() @@ -33,63 +34,63 @@ namespace CalamityMod.Projectiles.Boss bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; - if (projectile.timeLeft < 180) - projectile.tileCollide = true; + if (Projectile.timeLeft < 180) + Projectile.tileCollide = true; - projectile.frameCounter++; - if (projectile.frameCounter > 18) + Projectile.frameCounter++; + if (Projectile.frameCounter > 18) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) - projectile.frame = 0; + if (Projectile.frame > 4) + Projectile.frame = 0; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; float inertia = malice ? 70f : revenge ? 90f : 110f; float scaleFactor12 = malice ? 20f : revenge ? 16f : 12f; - if (projectile.alpha > 0) - projectile.alpha -= 10; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha > 0) + Projectile.alpha -= 10; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); + Lighting.AddLight(Projectile.Center, 1f, 0.7f, 0f); - int num959 = (int)projectile.ai[0]; + int num959 = (int)Projectile.ai[0]; if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) { - if (projectile.Distance(Main.player[num959].Center) > 320f) + if (Projectile.Distance(Main.player[num959].Center) > 320f) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[num959].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * scaleFactor12) / inertia; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[num959].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * scaleFactor12) / inertia; } } else { - if (projectile.timeLeft > 30) - projectile.timeLeft = 30; + if (Projectile.timeLeft > 30) + Projectile.timeLeft = 30; - if (projectile.ai[0] != -1f) + if (Projectile.ai[0] != -1f) { - projectile.ai[0] = -1f; - projectile.netUpdate = true; + Projectile.ai[0] = -1f; + Projectile.netUpdate = true; } } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 160; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); - projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 160; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); + Projectile.Damage(); for (int num621 = 0; num621 < 30; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -99,13 +100,13 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } } } diff --git a/Projectiles/Boss/ShadeNimbusHostile.cs b/Projectiles/Boss/ShadeNimbusHostile.cs index 21900c7545..9c205d0bd4 100644 --- a/Projectiles/Boss/ShadeNimbusHostile.cs +++ b/Projectiles/Boss/ShadeNimbusHostile.cs @@ -9,51 +9,51 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Shade Nimbus"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 54; - projectile.height = 28; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.hostile = true; - projectile.timeLeft = 360; - projectile.penetrate = -1; + Projectile.width = 54; + Projectile.height = 28; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.hostile = true; + Projectile.timeLeft = 360; + Projectile.penetrate = -1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 5) + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame > 5) { - projectile.frame = 0; + Projectile.frame = 0; } } - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 300f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 300f) { - projectile.alpha += 5; - if (projectile.alpha > 255) + Projectile.alpha += 5; + if (Projectile.alpha > 255) { - projectile.alpha = 255; - projectile.Kill(); + Projectile.alpha = 255; + Projectile.Kill(); } } else { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 45f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 45f) { - projectile.ai[0] = 0f; - int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); - int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 4f, ModContent.ProjectileType(), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.ai[0] = 0f; + int num414 = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); + int num415 = (int)(Projectile.position.Y + (float)Projectile.height + 4f); + Projectile.NewProjectile((float)num414, (float)num415, 0f, 4f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Boss/ShaderainHostile.cs b/Projectiles/Boss/ShaderainHostile.cs index c4af7a58e3..a6cbd0eab9 100644 --- a/Projectiles/Boss/ShaderainHostile.cs +++ b/Projectiles/Boss/ShaderainHostile.cs @@ -14,35 +14,35 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 4; - projectile.height = 40; - projectile.hostile = true; - projectile.extraUpdates = 1; - projectile.penetrate = -1; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 4; + Projectile.height = 40; + Projectile.hostile = true; + Projectile.extraUpdates = 1; + Projectile.penetrate = -1; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - projectile.alpha = 50; + Projectile.alpha = 50; } public override void Kill(int timeLeft) { - int num310 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + (float)projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default, 1f); + int num310 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + (float)Projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num310]; dust.position.X -= 2f; dust.alpha = 38; dust.velocity *= 0.1f; - dust.velocity += -projectile.oldVelocity * 0.25f; + dust.velocity += -Projectile.oldVelocity * 0.25f; dust.scale = 0.95f; } public override Color? GetAlpha(Color lightColor) { - return new Color(102, 255, 102, projectile.alpha); + return new Color(102, 255, 102, Projectile.alpha); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Boss/ShadowflameFireball.cs b/Projectiles/Boss/ShadowflameFireball.cs index abb56b79cf..0938d964af 100644 --- a/Projectiles/Boss/ShadowflameFireball.cs +++ b/Projectiles/Boss/ShadowflameFireball.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -17,24 +18,24 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.light = 0.8f; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 360; - projectile.scale = 1.25f; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.light = 0.8f; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 360; + Projectile.scale = 1.25f; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.localAI[0] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } // Main chunky dark purple dust at the front of the fireball @@ -42,9 +43,9 @@ namespace CalamityMod.Projectiles.Boss { int dustType = 27; float dustScale = Main.rand.NextFloat(1.4f, 2.4f); - int dustID = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType); + int dustID = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType); Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity = projectile.velocity; + Main.dust[dustID].velocity = Projectile.velocity; Main.dust[dustID].scale = dustScale; } @@ -53,35 +54,35 @@ namespace CalamityMod.Projectiles.Boss int dustType = 70; float velMult = Main.rand.NextFloat(0.05f, 0.6f); float dustScale = Main.rand.NextFloat(1.2f, 1.8f); - int dustID = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); Main.dust[dustID].noGravity = true; Main.dust[dustID].velocity *= 0.1f; - Main.dust[dustID].velocity += projectile.velocity * velMult; + Main.dust[dustID].velocity += Projectile.velocity * velMult; Main.dust[dustID].scale = dustScale; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 60f) + int num103 = (int)Player.FindClosest(Projectile.Center, 1, 1); + Vector2 vector11 = Main.player[num103].Center - Projectile.Center; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 60f) { - if (projectile.ai[0] < 240f) + if (Projectile.ai[0] < 240f) { - float scaleFactor2 = projectile.velocity.Length(); + float scaleFactor2 = Projectile.velocity.Length(); vector11.Normalize(); vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 24f + vector11) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; } - else if (projectile.velocity.Length() < 18f) + else if (Projectile.velocity.Length() < 18f) { - projectile.tileCollide = true; - projectile.velocity *= 1.02f; + Projectile.tileCollide = true; + Projectile.velocity *= 1.02f; } } } @@ -99,13 +100,13 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); int killDust = 20; for (int i = 0; i < killDust; ++i) { int dustType = Main.rand.NextBool() ? 70 : 27; float dustScale = Main.rand.NextFloat(1f, 1.6f); - int dustID = Dust.NewDust(projectile.Center, 1, 1, dustType); + int dustID = Dust.NewDust(Projectile.Center, 1, 1, dustType); Main.dust[dustID].velocity *= 4f; Main.dust[dustID].scale = dustScale; } diff --git a/Projectiles/Boss/Shadowflamethrower.cs b/Projectiles/Boss/Shadowflamethrower.cs index 8a94e8f2c2..ab6b03e9f7 100644 --- a/Projectiles/Boss/Shadowflamethrower.cs +++ b/Projectiles/Boss/Shadowflamethrower.cs @@ -16,26 +16,26 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 60; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 6; + Projectile.height = 6; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 60; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - if (projectile.ai[0] > 7f) + if (Projectile.ai[0] > 7f) { int[] dustTypes = new int[] { 27, 27, 112, 173 }; if(true) { int dustType = dustTypes[Main.rand.Next(4)]; int dustID; - Vector2 corner = projectile.position - new Vector2(6f, 6f); + Vector2 corner = Projectile.position - new Vector2(6f, 6f); int width = 18; int height = 18; switch (dustType) @@ -45,28 +45,28 @@ namespace CalamityMod.Projectiles.Boss Main.dust[dustID].noGravity = false; Main.dust[dustID].scale = Main.rand.NextFloat(1f, 1.2f); Main.dust[dustID].velocity *= 0.9f; - Main.dust[dustID].velocity += projectile.velocity * 0.7f; + Main.dust[dustID].velocity += Projectile.velocity * 0.7f; break; case 112: - dustID = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); Main.dust[dustID].noGravity = true; Main.dust[dustID].scale = Main.rand.NextFloat(1.4f, 2f); Main.dust[dustID].velocity *= 2.2f; - Main.dust[dustID].velocity += projectile.velocity * Main.rand.NextFloat(0.15f, 0.4f); + Main.dust[dustID].velocity += Projectile.velocity * Main.rand.NextFloat(0.15f, 0.4f); break; case 173: - dustID = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); Main.dust[dustID].noGravity = false; Main.dust[dustID].scale = Main.rand.NextFloat(1.9f, 3f); Main.dust[dustID].velocity *= 1.5f; - Main.dust[dustID].velocity += projectile.velocity * Main.rand.NextFloat(0.6f, 1f); + Main.dust[dustID].velocity += Projectile.velocity * Main.rand.NextFloat(0.6f, 1f); break; } } } - projectile.ai[0]++; - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.ai[0]++; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Boss/SignusScythe.cs b/Projectiles/Boss/SignusScythe.cs index ea0378a9d8..bd3ad26060 100644 --- a/Projectiles/Boss/SignusScythe.cs +++ b/Projectiles/Boss/SignusScythe.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class SignusScythe : ModProjectile @@ -14,62 +15,62 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 420; - projectile.alpha = 100; - projectile.penetrate = -1; + Projectile.width = 26; + Projectile.height = 26; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 420; + Projectile.alpha = 100; + Projectile.penetrate = -1; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(counter); - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { counter = reader.ReadInt32(); - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - projectile.rotation += 0.5f * projectile.direction; + Projectile.rotation += 0.5f * Projectile.direction; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item73, projectile.position); + Projectile.localAI[0] = 1f; + SoundEngine.PlaySound(SoundID.Item73, Projectile.position); } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 150f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 150f) { - if (projectile.ai[1] > 0f && projectile.ai[0] < 160f) + if (Projectile.ai[1] > 0f && Projectile.ai[0] < 160f) { - int num625 = (int)projectile.ai[1] - 1; + int num625 = (int)Projectile.ai[1] - 1; if (num625 < Main.maxPlayers) { - Vector2 value16 = Main.player[num625].Center - projectile.Center; - projectile.velocity = Vector2.Normalize(value16) * 22f; + Vector2 value16 = Main.player[num625].Center - Projectile.Center; + Projectile.velocity = Vector2.Normalize(value16) * 22f; } } } @@ -77,12 +78,12 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -93,10 +94,10 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item74, projectile.position); + SoundEngine.PlaySound(SoundID.Item74, Projectile.position); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -106,10 +107,10 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.5f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Boss/SirenSong.cs b/Projectiles/Boss/SirenSong.cs index 3c807e593a..f1beb62e03 100644 --- a/Projectiles/Boss/SirenSong.cs +++ b/Projectiles/Boss/SirenSong.cs @@ -13,76 +13,76 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Musical Note"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 58; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 960; - projectile.Opacity = 0f; + Projectile.width = 24; + Projectile.height = 58; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 960; + Projectile.Opacity = 0f; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - projectile.velocity *= 0.985f; + Projectile.velocity *= 0.985f; - if (projectile.timeLeft < 30) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); + if (Projectile.timeLeft < 30) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 930) / 30f), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 930) / 30f), 0f, 1f); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.01f; - if (projectile.scale >= 1.1f) - projectile.localAI[0] = 1f; + Projectile.scale += 0.01f; + if (Projectile.scale >= 1.1f) + Projectile.localAI[0] = 1f; } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale -= 0.01f; - if (projectile.scale <= 0.9f) - projectile.localAI[0] = 0f; + Projectile.scale -= 0.01f; + if (Projectile.scale <= 0.9f) + Projectile.localAI[0] = 0f; } - Lighting.AddLight(projectile.Center, 0.7f * projectile.Opacity, 0.5f * projectile.Opacity, 0f); + Lighting.AddLight(Projectile.Center, 0.7f * Projectile.Opacity, 0.5f * Projectile.Opacity, 0f); if (CalamityGlobalNPC.leviathan != -1) { if (Main.npc[CalamityGlobalNPC.leviathan].active) - projectile.extraUpdates = 1; + Projectile.extraUpdates = 1; } } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; target.AddBuff(BuffID.Confused, 120); diff --git a/Projectiles/Boss/SkyFlare.cs b/Projectiles/Boss/SkyFlare.cs index 2a02612547..b9ea2d0f9f 100644 --- a/Projectiles/Boss/SkyFlare.cs +++ b/Projectiles/Boss/SkyFlare.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { public class SkyFlare : ModProjectile @@ -14,72 +15,72 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Sky Flare"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.penetrate = 1; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.penetrate = 1; cooldownSlot = 1; } public override void AI() { - projectile.velocity *= 0.9995f; + Projectile.velocity *= 0.9995f; int addStuff = Main.rand.Next(5); blowTimer += addStuff; if (blowTimer >= 900) { - projectile.Kill(); + Projectile.Kill(); } - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) + if (Projectile.frame > 4) { - projectile.frame = 0; + Projectile.frame = 0; } } public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 53, projectile.alpha); + return new Color(255, Main.DiscoG, 53, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - Main.PlaySound(SoundID.Item20, projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); + int num231 = (int)(Projectile.Center.Y / 16f); + int num232 = (int)(Projectile.Center.X / 16f); int num233 = 100; if (num232 < 10) { @@ -100,7 +101,7 @@ namespace CalamityMod.Projectiles.Boss for (int num234 = num231; num234 < num231 + num233; num234++) { Tile tile = Main.tile[num232, num234]; - if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + if (tile.active() && (Main.tileSolid[(int)tile.TileType] || tile.liquid != 0)) { num231 = num234; break; diff --git a/Projectiles/Boss/SkyFlareRevenge.cs b/Projectiles/Boss/SkyFlareRevenge.cs index 47dd276a9b..2090e00017 100644 --- a/Projectiles/Boss/SkyFlareRevenge.cs +++ b/Projectiles/Boss/SkyFlareRevenge.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -14,67 +15,67 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Sky Flare"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 10; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 10; cooldownSlot = 1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) + if (Projectile.frame > 4) { - projectile.frame = 0; + Projectile.frame = 0; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 53, projectile.alpha); + return new Color(255, Main.DiscoG, 53, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item20, projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { - Vector2 dustSource = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - dustSource = dustSource.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 dustVel = dustSource - projectile.Center; + Vector2 dustSource = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + dustSource = dustSource.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 dustVel = dustSource - Projectile.Center; int idx = Dust.NewDust(dustSource + dustVel, 0, 0, 244, dustVel.X * 2f, dustVel.Y * 2f, 100, default, 1.4f); Main.dust[idx].noGravity = true; Main.dust[idx].noLight = true; Main.dust[idx].velocity = dustVel; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { int type = ModContent.ProjectileType(); - int damage = projectile.GetProjectileDamage(ModContent.NPCType()); - int nado = Projectile.NewProjectile(projectile.Center, Vector2.Zero, type, damage, 4f, Main.myPlayer, 16f, 50f); - Main.projectile[nado].Bottom = projectile.Center; + int damage = Projectile.GetProjectileDamage(ModContent.NPCType()); + int nado = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, type, damage, 4f, Main.myPlayer, 16f, 50f); + Main.projectile[nado].Bottom = Projectile.Center; Main.projectile[nado].netUpdate = true; } } diff --git a/Projectiles/Boss/SporeGasPlantera.cs b/Projectiles/Boss/SporeGasPlantera.cs index 56a79f23c4..d666701bc6 100644 --- a/Projectiles/Boss/SporeGasPlantera.cs +++ b/Projectiles/Boss/SporeGasPlantera.cs @@ -12,94 +12,94 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Spore Gas"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 32; - projectile.height = 32; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 32; + Projectile.height = 32; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - projectile.ai[1] += 1f; - if (projectile.ai[1] > 1800f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 1800f) { - projectile.localAI[0] += 10f; - projectile.damage = 0; + Projectile.localAI[0] += 10f; + Projectile.damage = 0; } - if (projectile.localAI[0] > 255f) + if (Projectile.localAI[0] > 255f) { - projectile.Kill(); - projectile.localAI[0] = 255f; + Projectile.Kill(); + Projectile.localAI[0] = 255f; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.16f / 255f, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.04f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.16f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.04f / 255f); - projectile.alpha = (int)(100.0 + projectile.localAI[0] * 0.7); - projectile.rotation += projectile.velocity.X * 0.02f; - projectile.rotation += projectile.direction * 0.002f; + Projectile.alpha = (int)(100.0 + Projectile.localAI[0] * 0.7); + Projectile.rotation += Projectile.velocity.X * 0.02f; + Projectile.rotation += Projectile.direction * 0.002f; - if (projectile.velocity.Length() > 0.5f) - projectile.velocity *= 0.98f; + if (Projectile.velocity.Length() > 0.5f) + Projectile.velocity *= 0.98f; } - public override bool CanHitPlayer(Player target) => projectile.ai[1] <= 1800f && projectile.ai[1] > 120f; + public override bool CanHitPlayer(Player target) => Projectile.ai[1] <= 1800f && Projectile.ai[1] > 120f; public override Color? GetAlpha(Color lightColor) { - if (projectile.ai[1] > 1800f) + if (Projectile.ai[1] > 1800f) { - byte b2 = (byte)((26f - (projectile.ai[1] - 1800f)) * 10f); - byte a2 = (byte)(projectile.alpha * (b2 / 255f)); + byte b2 = (byte)((26f - (Projectile.ai[1] - 1800f)) * 10f); + byte a2 = (byte)(Projectile.alpha * (b2 / 255f)); return new Color(b2, b2, b2, a2); } - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { // Changes the texture of the projectile - Texture2D texture = Main.projectileTexture[projectile.type]; - switch ((int)projectile.ai[0]) + Texture2D texture = Main.projectileTexture[Projectile.type]; + switch ((int)Projectile.ai[0]) { case 0: break; case 1: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Boss/SporeGasPlantera2"); + texture = ModContent.Request("CalamityMod/Projectiles/Boss/SporeGasPlantera2"); break; case 2: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Boss/SporeGasPlantera3"); + texture = ModContent.Request("CalamityMod/Projectiles/Boss/SporeGasPlantera3"); break; default: break; } - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, texture); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, texture); return false; } public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.ai[1] <= 1800f && projectile.ai[1] > 120f) + if (Projectile.ai[1] <= 1800f && Projectile.ai[1] > 120f) target.AddBuff(BuffID.Poisoned, 240); } } diff --git a/Projectiles/Boss/SupremeCataclysmFist.cs b/Projectiles/Boss/SupremeCataclysmFist.cs index 360777bebb..87dcadeb42 100644 --- a/Projectiles/Boss/SupremeCataclysmFist.cs +++ b/Projectiles/Boss/SupremeCataclysmFist.cs @@ -9,65 +9,65 @@ namespace CalamityMod.Projectiles.Boss { public class SupremeCataclysmFist : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Fist of Fury"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = projectile.height = 44; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - projectile.Opacity = 0f; + Projectile.width = Projectile.height = 44; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 1200; + Projectile.Opacity = 0f; cooldownSlot = 1; } public override void AI() { // Fly in a sinusoidal wave. - projectile.velocity.Y = (float)Math.Sin(Time / 5D) * 5f; + Projectile.velocity.Y = (float)Math.Sin(Time / 5D) * 5f; // Decide frames. - projectile.frameCounter++; - projectile.frame = projectile.frameCounter / 5 % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; // Fade in and handle visuals. - projectile.Opacity = Utils.InverseLerp(0f, 12f, projectile.timeLeft, true) * Utils.InverseLerp(1200f, 1188f, projectile.timeLeft, true); - projectile.spriteDirection = (projectile.velocity.X > 0f).ToDirectionInt(); + Projectile.Opacity = Utils.InverseLerp(0f, 12f, Projectile.timeLeft, true) * Utils.InverseLerp(1200f, 1188f, Projectile.timeLeft, true); + Projectile.spriteDirection = (Projectile.velocity.X > 0f).ToDirectionInt(); Time++; // Emit light. - Lighting.AddLight(projectile.Center, 0.5f * projectile.Opacity, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f * Projectile.Opacity, 0f, 0f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); + lightColor.R = (byte)(255 * Projectile.Opacity); - SpriteEffects direction = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Main.projectileTexture[projectile.type]; - if (projectile.ai[1] == 1f) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Boss/SupremeCataclysmFistAlt"); + SpriteEffects direction = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Main.projectileTexture[Projectile.type]; + if (Projectile.ai[1] == 1f) + texture = ModContent.Request("CalamityMod/Projectiles/Boss/SupremeCataclysmFistAlt"); - Vector2 drawPosition = projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY; - drawPosition.X -= Math.Sign(projectile.velocity.X) * 40f; - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - spriteBatch.Draw(texture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + Vector2 drawPosition = Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; + drawPosition.X -= Math.Sign(Projectile.velocity.X) * 40f; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); return false; } - public override bool CanHitPlayer(Player target) => projectile.Opacity >= 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity >= 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Boss/SupremeCatastropheSlash.cs b/Projectiles/Boss/SupremeCatastropheSlash.cs index dce91a90f5..cf7159148a 100644 --- a/Projectiles/Boss/SupremeCatastropheSlash.cs +++ b/Projectiles/Boss/SupremeCatastropheSlash.cs @@ -8,73 +8,73 @@ namespace CalamityMod.Projectiles.Boss { public class SupremeCatastropheSlash : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Resonance Slash"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; + Projectile.Calamity().canBreakPlayerDefense = true; // These never naturally use rotations, so this shouldn't be an issue. - projectile.width = 100; - projectile.height = 60; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.penetrate = -1; - projectile.timeLeft = 1500; - projectile.Opacity = 0f; + Projectile.width = 100; + Projectile.height = 60; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; + Projectile.penetrate = -1; + Projectile.timeLeft = 1500; + Projectile.Opacity = 0f; cooldownSlot = 1; } public override void AI() { // Decide frames. - projectile.frameCounter++; - projectile.frame = projectile.frameCounter / 7 % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 7 % Main.projFrames[Projectile.type]; // Fade in and handle visuals. - projectile.Opacity = Utils.InverseLerp(0f, 8f, projectile.timeLeft, true) * Utils.InverseLerp(1500f, 1492f, projectile.timeLeft, true); - projectile.spriteDirection = (projectile.velocity.X > 0f).ToDirectionInt(); + Projectile.Opacity = Utils.InverseLerp(0f, 8f, Projectile.timeLeft, true) * Utils.InverseLerp(1500f, 1492f, Projectile.timeLeft, true); + Projectile.spriteDirection = (Projectile.velocity.X > 0f).ToDirectionInt(); Time++; // Emit light. - Lighting.AddLight(projectile.Center, 0.5f * projectile.Opacity, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f * Projectile.Opacity, 0f, 0f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects direction = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Main.projectileTexture[projectile.type]; - if (projectile.ai[1] == 0f) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Boss/SupremeCatastropheSlashAlt"); + SpriteEffects direction = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Main.projectileTexture[Projectile.type]; + if (Projectile.ai[1] == 0f) + texture = ModContent.Request("CalamityMod/Projectiles/Boss/SupremeCatastropheSlashAlt"); - Vector2 drawPosition = projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY; - drawPosition -= projectile.velocity.SafeNormalize(Vector2.UnitX) * 38f; - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Vector2 drawPosition = Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; + drawPosition -= Projectile.velocity.SafeNormalize(Vector2.UnitX) * 38f; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); for (int i = 0; i < 3; i++) { - Color afterimageColor = projectile.GetAlpha(lightColor) * (1f - i / 3f) * 0.5f; - Vector2 afterimageOffset = projectile.velocity * -i * 4f; - spriteBatch.Draw(texture, drawPosition + afterimageOffset, frame, afterimageColor, projectile.rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + Color afterimageColor = Projectile.GetAlpha(lightColor) * (1f - i / 3f) * 0.5f; + Vector2 afterimageOffset = Projectile.velocity * -i * 4f; + spriteBatch.Draw(texture, drawPosition + afterimageOffset, frame, afterimageColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); } - spriteBatch.Draw(texture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); return false; } - public override bool CanHitPlayer(Player target) => projectile.Opacity >= 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity >= 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity != 1f) + if (Projectile.Opacity != 1f) return; target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Boss/SwirlingFire.cs b/Projectiles/Boss/SwirlingFire.cs index 0f5cb05e31..8a211082f9 100644 --- a/Projectiles/Boss/SwirlingFire.cs +++ b/Projectiles/Boss/SwirlingFire.cs @@ -6,8 +6,8 @@ namespace CalamityMod.Projectiles.Boss { public class SwirlingFire : ModProjectile { - public ref float AngularTurnSpeed => ref projectile.ai[0]; - public ref float Time => ref projectile.ai[1]; + public ref float AngularTurnSpeed => ref Projectile.ai[0]; + public ref float Time => ref Projectile.ai[1]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { @@ -16,20 +16,20 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = projectile.height = 10; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 180; + Projectile.width = Projectile.height = 10; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; cooldownSlot = 1; } public override void AI() { Vector2 fireVelocity = (Time / 6f).ToRotationVector2() * Main.rand.NextFloat(1.7f, 2.2f); - Dust fire = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(3f, 3f), Main.dayTime ? 6 : 267); + Dust fire = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(3f, 3f), Main.dayTime ? 6 : 267); fire.velocity = fireVelocity.RotatedBy(MathHelper.PiOver2); fire.scale = Main.rand.NextFloat(1.3f, 1.45f); fire.noGravity = true; @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Boss Dust.CloneDust(fire).velocity = fireVelocity.RotatedBy(-MathHelper.PiOver2); - projectile.velocity = projectile.velocity.RotatedBy(AngularTurnSpeed); + Projectile.velocity = Projectile.velocity.RotatedBy(AngularTurnSpeed); Time++; } } diff --git a/Projectiles/Boss/ThanatosBeamStart.cs b/Projectiles/Boss/ThanatosBeamStart.cs index c9fe6bbf9b..45f8965e1c 100644 --- a/Projectiles/Boss/ThanatosBeamStart.cs +++ b/Projectiles/Boss/ThanatosBeamStart.cs @@ -11,6 +11,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -18,8 +19,8 @@ namespace CalamityMod.Projectiles.Boss { public int OwnerIndex { - get => (int)projectile.ai[1]; - set => projectile.ai[1] = value; + get => (int)Projectile.ai[1]; + set => Projectile.ai[1] = value; } public bool OwnerIsValid => Main.npc[OwnerIndex].active && Main.npc[OwnerIndex].type == ModContent.NPCType(); @@ -29,9 +30,9 @@ namespace CalamityMod.Projectiles.Boss public override float Lifetime => 180; public override Color LaserOverlayColor => new Color(250, 250, 250, 100); public override Color LightCastColor => Color.White; - public override Texture2D LaserBeginTexture => Main.projectileTexture[projectile.type]; - public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ThanatosBeamMiddle"); - public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ThanatosBeamEnd"); + public override Texture2D LaserBeginTexture => Main.projectileTexture[Projectile.type]; + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/ThanatosBeamMiddle"); + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/ThanatosBeamEnd"); public override void SetStaticDefaults() { @@ -39,31 +40,31 @@ namespace CalamityMod.Projectiles.Boss DisplayName.SetDefault("T Hanos Beam"); // This is its serious name // DisplayName.SetDefault("Gamma Disintegration Beam"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = projectile.height = 40; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = Projectile.height = 40; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; + Projectile.Calamity().canBreakPlayerDefense = true; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AttachToSomething() @@ -71,8 +72,8 @@ namespace CalamityMod.Projectiles.Boss if (OwnerIsValid) { Vector2 fireFrom = Main.npc[OwnerIndex].Center + Vector2.UnitY * Main.npc[OwnerIndex].gfxOffY; - fireFrom += projectile.velocity.SafeNormalize(Vector2.UnitY) * projectile.scale * 174f; - projectile.Center = fireFrom; + fireFrom += Projectile.velocity.SafeNormalize(Vector2.UnitY) * Projectile.scale * 174f; + Projectile.Center = fireFrom; } // Die of the owner is invalid in some way. @@ -80,22 +81,22 @@ namespace CalamityMod.Projectiles.Boss else { if (Main.netMode != NetmodeID.MultiplayerClient) - projectile.Kill(); + Projectile.Kill(); return; } // Die if the owner is not performing Thanatos' deathray attack. if (Main.npc[OwnerIndex].Calamity().newAI[0] != (float)ThanatosHead.Phase.Deathray) { - projectile.Kill(); + Projectile.Kill(); return; } } public override void UpdateLaserMotion() { - projectile.velocity = Main.npc[OwnerIndex].velocity.SafeNormalize(Vector2.UnitY); - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.velocity = Main.npc[OwnerIndex].velocity.SafeNormalize(Vector2.UnitY); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override void PostAI() @@ -111,10 +112,10 @@ namespace CalamityMod.Projectiles.Boss // Spawn dust at the end of the beam. int dustType = (int)CalamityDusts.Brimstone; - Vector2 dustCreationPosition = projectile.Center + projectile.velocity * (LaserLength - 14f); + Vector2 dustCreationPosition = Projectile.Center + Projectile.velocity * (LaserLength - 14f); for (int i = 0; i < 2; i++) { - float dustDirection = projectile.velocity.ToRotation() + Main.rand.NextBool().ToDirectionInt() * MathHelper.PiOver2; + float dustDirection = Projectile.velocity.ToRotation() + Main.rand.NextBool().ToDirectionInt() * MathHelper.PiOver2; Vector2 dustVelocity = dustDirection.ToRotationVector2() * Main.rand.NextFloat(2f, 4f); Dust redFlame = Dust.NewDustDirect(dustCreationPosition, 0, 0, dustType, dustVelocity.X, dustVelocity.Y, 0, default, 1f); @@ -124,7 +125,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(5)) { - Vector2 dustSpawnOffset = projectile.velocity.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloatDirection() * projectile.width * 0.5f; + Vector2 dustSpawnOffset = Projectile.velocity.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloatDirection() * Projectile.width * 0.5f; Dust redFlame = Dust.NewDustDirect(dustCreationPosition + dustSpawnOffset - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, default, 1.5f); redFlame.velocity *= 0.5f; @@ -138,23 +139,23 @@ namespace CalamityMod.Projectiles.Boss if (Main.npc[OwnerIndex].Calamity().newAI[2] % laserFireRate == 0f) { // Play a laser sound to go with the beams. - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), Main.npc[OwnerIndex].Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), Main.npc[OwnerIndex].Center); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Vector2 beamDirection = projectile.velocity.SafeNormalize(Vector2.UnitY); + Vector2 beamDirection = Projectile.velocity.SafeNormalize(Vector2.UnitY); float distanceBetweenProjectiles = malice ? 160f : death ? 256f : revenge ? 288f : 320f; Vector2 laserFirePosition = Main.npc[OwnerIndex].Center + beamDirection * distanceBetweenProjectiles; int laserCount = (int)(LaserLength / distanceBetweenProjectiles); int type = ModContent.ProjectileType(); - int damage = projectile.GetProjectileDamage(Main.npc[OwnerIndex].type); + int damage = Projectile.GetProjectileDamage(Main.npc[OwnerIndex].type); for (int i = 0; i < laserCount; i++) { int totalProjectiles = 2; float radians = MathHelper.TwoPi / totalProjectiles; for (int j = 0; j < totalProjectiles; j++) { - Vector2 projVelocity = projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2) * 12f; + Vector2 projVelocity = Projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2) * 12f; Projectile.NewProjectile(laserFirePosition, projVelocity, type, damage, 0f, Main.myPlayer, 0f, -1f); } laserFirePosition += beamDirection * distanceBetweenProjectiles; @@ -163,9 +164,9 @@ namespace CalamityMod.Projectiles.Boss } // Determine frames. - projectile.frameCounter++; - if (projectile.frameCounter % 5f == 0f) - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + if (Projectile.frameCounter % 5f == 0f) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -174,33 +175,33 @@ namespace CalamityMod.Projectiles.Boss return false; // This should never happen, but just in case. - if (projectile.velocity == Vector2.Zero || projectile.localAI[0] < 2f) + if (Projectile.velocity == Vector2.Zero || Projectile.localAI[0] < 2f) return false; Color beamColor = LaserOverlayColor; - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); // Start texture drawing. spriteBatch.Draw(LaserBeginTexture, - projectile.Center - Main.screenPosition, + Projectile.Center - Main.screenPosition, startFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserBeginTexture.Size() / 2f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); // Prepare things for body drawing. float laserBodyLength = LaserLength + middleFrameArea.Height; - Vector2 centerOnLaser = projectile.Center + projectile.velocity * -5f; + Vector2 centerOnLaser = Projectile.Center + Projectile.velocity * -5f; // Body drawing. if (laserBodyLength > 0f) { - float laserOffset = middleFrameArea.Height * projectile.scale; + float laserOffset = middleFrameArea.Height * Projectile.scale; float incrementalBodyLength = 0f; while (incrementalBodyLength + 1f < laserBodyLength) { @@ -208,14 +209,14 @@ namespace CalamityMod.Projectiles.Boss centerOnLaser - Main.screenPosition, middleFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserMiddleTexture.Size() * 0.5f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); incrementalBodyLength += laserOffset; - centerOnLaser += projectile.velocity * laserOffset; - middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[projectile.type]; + centerOnLaser += Projectile.velocity * laserOffset; + middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[Projectile.type]; if (middleFrameArea.Y + middleFrameArea.Height > LaserMiddleTexture.Height) middleFrameArea.Y = 0; } @@ -226,9 +227,9 @@ namespace CalamityMod.Projectiles.Boss laserEndCenter, endFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserEndTexture.Size() * 0.5f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); return false; @@ -239,7 +240,7 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(ModContent.BuffType(), 360); } - public override bool CanHitPlayer(Player target) => OwnerIsValid && projectile.scale >= 0.5f; + public override bool CanHitPlayer(Player target) => OwnerIsValid && Projectile.scale >= 0.5f; public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { diff --git a/Projectiles/Boss/ThanatosBeamTelegraph.cs b/Projectiles/Boss/ThanatosBeamTelegraph.cs index 1b3f77c614..c7f138886d 100644 --- a/Projectiles/Boss/ThanatosBeamTelegraph.cs +++ b/Projectiles/Boss/ThanatosBeamTelegraph.cs @@ -10,11 +10,11 @@ namespace CalamityMod.Projectiles.Boss { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[0]) ? Main.npc[(int)projectile.ai[0]] : null; + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)Projectile.ai[0]) ? Main.npc[(int)Projectile.ai[0]] : null; public float ConvergenceRatio => MathHelper.SmoothStep(0f, 1f, Utils.InverseLerp(25f, 120f, Time, true)); - public ref float StartingRotationalOffset => ref projectile.ai[1]; - public ref float ConvergenceAngle => ref projectile.localAI[0]; - public ref float Time => ref projectile.localAI[1]; + public ref float StartingRotationalOffset => ref Projectile.ai[1]; + public ref float ConvergenceAngle => ref Projectile.localAI[0]; + public ref float Time => ref Projectile.localAI[1]; public const int Lifetime = 180; public const float TelegraphWidth = 3600f; public const float BeamPosOffset = 16f; @@ -22,12 +22,12 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = projectile.height = 4; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = Lifetime; + Projectile.width = Projectile.height = 4; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime; } public override void SendExtraAI(BinaryWriter writer) @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Boss // Die if the thing to attach to disappears. if (ThingToAttachTo is null || !ThingToAttachTo.active || ThingToAttachTo.Calamity().newAI[0] != 2f) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -58,36 +58,36 @@ namespace CalamityMod.Projectiles.Boss float beamStartForwardsOffset = -8f; // Set the starting location of the beam to the center of the NPC. - projectile.Center = ThingToAttachTo.Center; + Projectile.Center = ThingToAttachTo.Center; // Add a fixed offset to align with the NPC's spritesheet (?) - projectile.position += hostNPCDirection * BeamPosOffset + new Vector2(0f, -ThingToAttachTo.gfxOffY); + Projectile.position += hostNPCDirection * BeamPosOffset + new Vector2(0f, -ThingToAttachTo.gfxOffY); // Add the forwards offset, measured in pixels. - projectile.position += hostNPCDirection * beamStartForwardsOffset; + Projectile.position += hostNPCDirection * beamStartForwardsOffset; - projectile.rotation = StartingRotationalOffset.AngleLerp(ConvergenceAngle, ConvergenceRatio) + ThingToAttachTo.velocity.ToRotation(); + Projectile.rotation = StartingRotationalOffset.AngleLerp(ConvergenceAngle, ConvergenceRatio) + ThingToAttachTo.velocity.ToRotation(); Time++; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + Texture2D laserTelegraph = ModContent.Request("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); - float verticalScale = Utils.InverseLerp(0f, 20f, Time, true) * Utils.InverseLerp(0f, 16f, projectile.timeLeft, true) * 4f; + float verticalScale = Utils.InverseLerp(0f, 20f, Time, true) * Utils.InverseLerp(0f, 16f, Projectile.timeLeft, true) * 4f; Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, verticalScale); Vector2 scaleOuter = scaleInner * new Vector2(1f, 2.2f); Color colorOuter = Color.Lerp(Color.Red, Color.Crimson, Time / Lifetime * 2f % 1f); // Iterate through crimson and red twice and then flash. - colorOuter = Color.Lerp(colorOuter, Color.White, Utils.InverseLerp(40f, 0f, projectile.timeLeft, true) * 0.8f); + colorOuter = Color.Lerp(colorOuter, Color.White, Utils.InverseLerp(40f, 0f, Projectile.timeLeft, true) * 0.8f); Color colorInner = Color.Lerp(colorOuter, Color.White, 0.5f); colorInner *= 0.85f; colorOuter *= 0.7f; - spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, projectile.rotation, origin, scaleOuter, SpriteEffects.None, 0f); - spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, projectile.rotation, origin, scaleInner, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorOuter, Projectile.rotation, origin, scaleOuter, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorInner, Projectile.rotation, origin, scaleInner, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Boss/ThanatosLaser.cs b/Projectiles/Boss/ThanatosLaser.cs index df08e52a1b..d15173122c 100644 --- a/Projectiles/Boss/ThanatosLaser.cs +++ b/Projectiles/Boss/ThanatosLaser.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Projectiles.Boss { public float TelegraphDelay { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } - public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)Projectile.ai[1]) ? Main.npc[(int)Projectile.ai[1]] : null; public Vector2 Destination; public Vector2 Velocity; @@ -32,21 +32,21 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Exo Pulse Laser"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 22; - projectile.height = 22; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 22; + Projectile.height = 22; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 600; cooldownSlot = 1; } @@ -66,71 +66,71 @@ namespace CalamityMod.Projectiles.Boss { // Determine the relative opacities for each player based on their distance. // This has a lower bound of 0.35 to prevent the laser from going completely invisible and players getting hit by cheap shots. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.netUpdate = true; } - projectile.frameCounter++; - if (projectile.frameCounter > 12) + Projectile.frameCounter++; + if (Projectile.frameCounter > 12) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.6f, 0f, 0f); // If there is no NPC to attach to, run this instead. - if (projectile.ai[1] == -1f) + if (Projectile.ai[1] == -1f) { // Fade in after telegraphs have faded. if (TelegraphDelay > TelegraphTotalTime) { - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> if (Velocity != Vector2.Zero) { - projectile.extraUpdates = 3; - projectile.velocity = Velocity * ((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 1.25f : 1f); + Projectile.extraUpdates = 3; + Projectile.velocity = Velocity * ((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 1.25f : 1f); Velocity = Vector2.Zero; - projectile.netUpdate = true; + Projectile.netUpdate = true; } // Direction and rotation. - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } } else if (Velocity == Vector2.Zero) { - Velocity = projectile.velocity; - projectile.velocity = Vector2.Zero; - projectile.netUpdate = true; + Velocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + Projectile.netUpdate = true; // Direction and rotation. - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); } } @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Boss // Die if the thing to attach to disappears. if (ThingToAttachTo is null || !ThingToAttachTo.active) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -152,85 +152,85 @@ namespace CalamityMod.Projectiles.Boss // Fade in after telegraphs have faded. if (TelegraphDelay > TelegraphTotalTime) { - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> if (Velocity != Vector2.Zero) { - projectile.extraUpdates = 3; - projectile.velocity = Velocity * ((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 1.25f : 1f); + Projectile.extraUpdates = 3; + Projectile.velocity = Velocity * ((CalamityWorld.malice || BossRushEvent.BossRushActive) ? 1.25f : 1f); Velocity = Vector2.Zero; - projectile.netUpdate = true; + Projectile.netUpdate = true; } // Direction and rotation. - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } } else if (Destination == Vector2.Zero) { // Set start of telegraph to the npc center. - projectile.Center = ThingToAttachTo.Center; + Projectile.Center = ThingToAttachTo.Center; // Set destination of the laser, the target's center. - Destination = projectile.velocity; + Destination = Projectile.velocity; if (aresLaserIsOwner) - projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f + Vector2.UnitY * 16f; + Projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f + Vector2.UnitY * 16f; // Calculate and store the velocity that will be used for laser telegraph rotation and beam firing. Vector2 projectileDestination = Destination - ThingToAttachTo.Center; Velocity = Vector2.Normalize(projectileDestination) * LaserVelocity; // Set velocity to zero. - projectile.velocity = Vector2.Zero; - projectile.netUpdate = true; + Projectile.velocity = Vector2.Zero; + Projectile.netUpdate = true; // Direction and rotation. - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); } } else { // Set start of telegraph to the npc center. - projectile.Center = ThingToAttachTo.Center; + Projectile.Center = ThingToAttachTo.Center; if (aresLaserIsOwner) - projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f + Vector2.UnitY * 16f; + Projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f + Vector2.UnitY * 16f; // Calculate and store the velocity that will be used for laser telegraph rotation and beam firing. Vector2 projectileDestination = Destination - ThingToAttachTo.Center; Velocity = Vector2.Normalize(projectileDestination) * LaserVelocity; // Direction and rotation. - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); } } @@ -252,24 +252,24 @@ namespace CalamityMod.Projectiles.Boss public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - return CalamityUtils.CircularHitboxCollision(projHitbox.Center(), projectile.Size.Length() * 0.5f, targetHitbox); + return CalamityUtils.CircularHitboxCollision(projHitbox.Center(), Projectile.Size.Length() * 0.5f, targetHitbox); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { if (TelegraphDelay >= TelegraphTotalTime) { - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - Vector2 drawOffset = projectile.velocity.SafeNormalize(Vector2.Zero) * -30f; - projectile.Center += drawOffset; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); - projectile.Center -= drawOffset; + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + Vector2 drawOffset = Projectile.velocity.SafeNormalize(Vector2.Zero) * -30f; + Projectile.Center += drawOffset; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + Projectile.Center -= drawOffset; return false; } - Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + Texture2D laserTelegraph = ModContent.Request("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); float yScale = 2f; if (TelegraphDelay < TelegraphFadeTime) @@ -287,8 +287,8 @@ namespace CalamityMod.Projectiles.Boss colorOuter *= 0.6f; colorInner *= 0.6f; - spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, Velocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); - spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, Velocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorInner, Velocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorOuter, Velocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Boss/ToxicCloud.cs b/Projectiles/Boss/ToxicCloud.cs index 8e0204152a..4a3df03b3f 100644 --- a/Projectiles/Boss/ToxicCloud.cs +++ b/Projectiles/Boss/ToxicCloud.cs @@ -16,80 +16,80 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Toxic Cloud"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 52; - projectile.height = 48; - projectile.hostile = true; - projectile.Opacity = 0f; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 900; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 52; + Projectile.height = 48; + Projectile.hostile = true; + Projectile.Opacity = 0f; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 900; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.1f, 0.7f, 0f); + Lighting.AddLight(Projectile.Center, 0.1f, 0.7f, 0f); bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; - if (projectile.velocity.Length() < (malice ? 6.25f : 5f)) - projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() < (malice ? 6.25f : 5f)) + Projectile.velocity *= 1.01f; - projectile.frameCounter++; - if (projectile.frameCounter > 9) + Projectile.frameCounter++; + if (Projectile.frameCounter > 9) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 860f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 860f) { - projectile.damage = 0; - if (projectile.Opacity > 0f) + Projectile.damage = 0; + if (Projectile.Opacity > 0f) { - projectile.Opacity -= 0.02f; - if (projectile.Opacity <= 0f) + Projectile.Opacity -= 0.02f; + if (Projectile.Opacity <= 0f) { - projectile.Opacity = 0f; - projectile.Kill(); + Projectile.Opacity = 0f; + Projectile.Kill(); } } } - else if (projectile.Opacity < 0.9f) + else if (Projectile.Opacity < 0.9f) { - projectile.Opacity += 0.12f; - if (projectile.Opacity > 0.9f) - projectile.Opacity = 0.9f; + Projectile.Opacity += 0.12f; + if (Projectile.Opacity > 0.9f) + Projectile.Opacity = 0.9f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 20f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f, targetHitbox); - public override bool CanHitPlayer(Player target) => projectile.Opacity == 0.9f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 0.9f; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.Opacity == 0.9f) + if (Projectile.Opacity == 0.9f) { target.AddBuff(BuffID.Poisoned, 120); target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Boss/VileClot.cs b/Projectiles/Boss/VileClot.cs index 038f9048a1..cb9f5dafe7 100644 --- a/Projectiles/Boss/VileClot.cs +++ b/Projectiles/Boss/VileClot.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -15,28 +16,28 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.light = 0.6f; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.light = 0.6f; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.localAI[0] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } - int num104 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), - projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 100, default, 1.5f); + int num104 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), + Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 100, default, 1.5f); Main.dust[num104].noGravity = true; - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -46,14 +47,14 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int num584 = 0; num584 < 6; num584++) { - int num585 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, -projectile.velocity.X * 0.2f, -projectile.velocity.Y * 0.2f, 100, default, 2.5f); + int num585 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, -Projectile.velocity.X * 0.2f, -Projectile.velocity.Y * 0.2f, 100, default, 2.5f); Main.dust[num585].noGravity = true; Dust dust = Main.dust[num585]; dust.velocity *= 2f; - num585 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, -projectile.velocity.X * 0.2f, -projectile.velocity.Y * 0.2f, 100, default, 1.2f); + num585 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, -Projectile.velocity.X * 0.2f, -Projectile.velocity.Y * 0.2f, 100, default, 1.2f); dust = Main.dust[num585]; dust.velocity *= 2f; } diff --git a/Projectiles/Boss/WaterSpear.cs b/Projectiles/Boss/WaterSpear.cs index 02646e3ecc..7a60b6f501 100644 --- a/Projectiles/Boss/WaterSpear.cs +++ b/Projectiles/Boss/WaterSpear.cs @@ -13,43 +13,43 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Water Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.Opacity = 0f; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.Opacity = 0f; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - if (projectile.velocity.Length() < 10f) - projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() < 10f) + Projectile.velocity *= 1.01f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -57,27 +57,27 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; } - if (projectile.timeLeft < 30) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); + if (Projectile.timeLeft < 30) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 270) / 30f), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 270) / 30f), 0f, 1f); - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f * projectile.Opacity); + Lighting.AddLight(Projectile.Center, 0f, 0f, 0.5f * Projectile.Opacity); } - public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Boss { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 33, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Boss/YharonFireball.cs b/Projectiles/Boss/YharonFireball.cs index 79b55fde34..17080471bf 100644 --- a/Projectiles/Boss/YharonFireball.cs +++ b/Projectiles/Boss/YharonFireball.cs @@ -16,109 +16,109 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Dragon Fireball"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 34; - projectile.height = 34; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 120; - projectile.aiStyle = 1; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 34; + Projectile.height = 34; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 120; + Projectile.aiStyle = 1; aiType = ProjectileID.DD2BetsyFireball; cooldownSlot = 1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation += MathHelper.Pi; + Projectile.rotation += MathHelper.Pi; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(speedX); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[1]); writer.Write(speedX2); } public override void ReceiveExtraAI(BinaryReader reader) { speedX = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); speedX2 = reader.ReadSingle(); } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int frameY = frameHeight * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int frameY = frameHeight * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; if (CalamityConfig.Instance.Afterimages) { - for (int i = 0; i < projectile.oldPos.Length; i++) + for (int i = 0; i < Projectile.oldPos.Length; i++) { - Vector2 drawPos = projectile.oldPos[i] + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - Color color2 = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), color2, projectile.rotation, rectangle.Size() / 2f, projectile.scale, spriteEffects, 0f); + Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color color2 = Projectile.GetAlpha(lightColor) * ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), color2, Projectile.rotation, rectangle.Size() / 2f, Projectile.scale, spriteEffects, 0f); } } - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, texture.Width, frameHeight)), - projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); + Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, spriteEffects, 0f); return false; } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int x = 0; x < 3; x++) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX, -50f, ModContent.ProjectileType(), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, speedX, -50f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer, 0f, 0f); speedX += 3f; } for (int x = 0; x < 2; x++) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX2, -75f, ModContent.ProjectileType(), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, speedX2, -75f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer, 0f, 0f); speedX2 += 10f; } } - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 144); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 144); for (int d = 0; d < 2; d++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 50, default, 1.5f); } for (int d = 0; d < 20; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 0, default, 2.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 0, default, 2.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 50, default, 1.5f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 50, default, 1.5f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs index 78792c1ccc..542e0d13d5 100644 --- a/Projectiles/Boss/YharonFireball2.cs +++ b/Projectiles/Boss/YharonFireball2.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -15,116 +16,116 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Dragon Fireball"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 34; - projectile.height = 34; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 3600; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 34; + Projectile.height = 34; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 3600; cooldownSlot = 1; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + Projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; - if (projectile.velocity.Y < -1f) + if (Projectile.velocity.Y < -1f) { // 129 frames to get from -50 to -1 - projectile.velocity.Y *= 0.97f; + Projectile.velocity.Y *= 0.97f; } else { // 85 frames to get from -1 to 16 - projectile.velocity.Y += 0.2f; - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; + Projectile.velocity.Y += 0.2f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; } - projectile.velocity.X *= 0.995f; + Projectile.velocity.X *= 0.995f; - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); + Projectile.localAI[0] = 1f; + Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, Projectile.Center); } - if (projectile.ai[0] >= 2f) + if (Projectile.ai[0] >= 2f) { - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; } if (Main.rand.NextBool(16)) { - Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 200, default, 1f); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 200, default, 1f); dust.scale *= 0.7f; - dust.velocity += projectile.velocity * 0.25f; + dust.velocity += Projectile.velocity * 0.25f; } } - public override bool CanHitPlayer(Player target) => projectile.velocity.Y >= -16f; + public override bool CanHitPlayer(Player target) => Projectile.velocity.Y >= -16f; - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 14, 0.5f, 0f); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 144); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 14, 0.5f, 0f); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 144); for (int d = 0; d < 2; d++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1.5f); } for (int d = 0; d < 20; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 0, default, 2.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 0, default, 2.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.5f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1.5f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } - projectile.Damage(); + Projectile.Damage(); } public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.velocity.Y >= -16f) + if (Projectile.velocity.Y >= -16f) target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index f57d02ddab..1f6790ea10 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -20,10 +20,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Utilities; -using Terraria.World.Generation; +using Terraria.WorldBuilding; using static Terraria.ModLoader.ModContent; using NanotechProjectile = CalamityMod.Projectiles.Typeless.Nanotech; +using Terraria.Audio; namespace CalamityMod.Projectiles { @@ -485,7 +486,7 @@ namespace CalamityMod.Projectiles if (ExplosiveEnchantCountdown <= 300) { if (Main.rand.NextBool(24)) - Main.PlaySound(SoundID.DD2_BetsyFireballShot, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, projectile.Center); Dust fire = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(projectile.width, projectile.height) * 0.42f, 267); fire.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0.45f, 1f)); @@ -502,7 +503,7 @@ namespace CalamityMod.Projectiles if (ExplosiveEnchantCountdown <= 0) { - Main.PlaySound(SoundID.DD2_KoboldExplosion, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_KoboldExplosion, projectile.Center); if (Main.myPlayer == projectile.owner) { if (projectile.minionSlots > 0f) @@ -646,7 +647,7 @@ namespace CalamityMod.Projectiles if (projectile.soundDelay == 0) { projectile.soundDelay = 20 + Main.rand.Next(40); - Main.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, projectile.position); } if (projectile.localAI[0] == 0f) @@ -750,7 +751,7 @@ namespace CalamityMod.Projectiles if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item34, projectile.position); + SoundEngine.PlaySound(SoundID.Item34, projectile.position); } else if (projectile.ai[1] == 1f && Main.netMode != NetmodeID.MultiplayerClient) { @@ -871,7 +872,7 @@ namespace CalamityMod.Projectiles if (projectile.localAI[1] == 0f) { projectile.localAI[1] = 1f; - Main.PlaySound(SoundID.Item120, projectile.position); + SoundEngine.PlaySound(SoundID.Item120, projectile.position); } projectile.ai[0] += 1f; @@ -1042,7 +1043,7 @@ namespace CalamityMod.Projectiles return true; if (projectile.ai[0] == 0f) - Main.PlaySound(SoundID.Item8, projectile.position); + SoundEngine.PlaySound(SoundID.Item8, projectile.position); projectile.rotation += projectile.direction * 0.8f; @@ -1080,7 +1081,7 @@ namespace CalamityMod.Projectiles if (projectile.localAI[1] == 0f) { - Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); projectile.localAI[1] = 1f; } @@ -1117,7 +1118,7 @@ namespace CalamityMod.Projectiles if (projectile.localAI[1] == 0f) { - Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); projectile.localAI[1] = 1f; } @@ -1142,7 +1143,7 @@ namespace CalamityMod.Projectiles if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item17, projectile.position); + SoundEngine.PlaySound(SoundID.Item17, projectile.position); } if (projectile.alpha > 0) @@ -1365,7 +1366,7 @@ namespace CalamityMod.Projectiles { if (projectile.localAI[1] == 0f) { - Main.PlaySound(SoundID.Item121, projectile.position); + SoundEngine.PlaySound(SoundID.Item121, projectile.position); projectile.localAI[1] = 1f; } @@ -1476,7 +1477,7 @@ namespace CalamityMod.Projectiles if (projectile.localAI[1] == 0f) { projectile.localAI[1] = 1f; - Main.PlaySound(SoundID.Item120, projectile.position); + SoundEngine.PlaySound(SoundID.Item120, projectile.position); } projectile.ai[0] += 1f; @@ -1706,7 +1707,7 @@ namespace CalamityMod.Projectiles projectile.velocity = -Vector2.UnitY; if (projectile.localAI[0] == 0f) - Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 104, 1f, 0f); + SoundEngine.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 104, 1f, 0f); float num801 = 1f; projectile.localAI[0] += 1f; @@ -1873,7 +1874,7 @@ namespace CalamityMod.Projectiles projectile.damage = defDamage + 15; } - if (projectile.modProjectile != null && projectile.modProjectile.mod.Name.Equals("CalamityMod")) + if (projectile.modProjectile != null && projectile.modProjectile.Mod.Name.Equals("CalamityMod")) goto SKIP_CALAMITY; if ((projectile.minion || projectile.sentry) && !ProjectileID.Sets.StardustDragon[projectile.type]) //For all other mods and vanilla, exclude dragon due to bugs @@ -1894,83 +1895,83 @@ namespace CalamityMod.Projectiles // If rogue projectiles are not internally throwing while in-flight, they can never critically strike. if (rogue) - projectile.thrown = true; + projectile.DamageType = DamageClass.Throwing; if (forceMelee) { projectile.hostile = false; projectile.friendly = true; - projectile.melee = true; - projectile.ranged = false; - projectile.magic = false; + projectile.DamageType = DamageClass.Melee; + // projectile.ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + // projectile.magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; projectile.minion = false; - projectile.thrown = false; + // projectile.thrown = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; rogue = false; } else if (forceRanged) { projectile.hostile = false; projectile.friendly = true; - projectile.melee = false; - projectile.ranged = true; - projectile.magic = false; + // projectile.melee = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + projectile.DamageType = DamageClass.Ranged; + // projectile.magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; projectile.minion = false; - projectile.thrown = false; + // projectile.thrown = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; rogue = false; } else if (forceMagic) { projectile.hostile = false; projectile.friendly = true; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = true; + // projectile.melee = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + // projectile.ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + projectile.DamageType = DamageClass.Magic; projectile.minion = false; - projectile.thrown = false; + // projectile.thrown = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; rogue = false; } else if (forceMinion) { projectile.hostile = false; projectile.friendly = true; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = false; + // projectile.melee = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + // projectile.ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + // projectile.magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; projectile.minion = true; - projectile.thrown = false; + // projectile.thrown = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; rogue = false; } else if (forceRogue) { projectile.hostile = false; projectile.friendly = true; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = false; + // projectile.melee = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + // projectile.ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + // projectile.magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; projectile.minion = false; - projectile.thrown = true; + projectile.DamageType = DamageClass.Throwing; rogue = true; } else if (forceTypeless) { projectile.hostile = false; projectile.friendly = true; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = false; + // projectile.melee = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + // projectile.ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + // projectile.magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; projectile.minion = false; - projectile.thrown = false; + // projectile.thrown = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; rogue = false; } else if (forceHostile) { projectile.hostile = true; projectile.friendly = false; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = false; + // projectile.melee = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + // projectile.ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + // projectile.magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; projectile.minion = false; - projectile.thrown = false; + // projectile.thrown = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; rogue = false; } @@ -1980,13 +1981,13 @@ namespace CalamityMod.Projectiles { if (player.ActiveItem().type == ItemID.BeesKnees) { - projectile.magic = false; - projectile.ranged = true; + // projectile.magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + projectile.DamageType = DamageClass.Ranged; } } } else if (projectile.type == ProjectileID.SoulDrain) - projectile.magic = true; + projectile.DamageType = DamageClass.Magic; if (projectile.type == ProjectileID.OrnamentFriendly && lineColor == 1) //spawned by Festive Wings { diff --git a/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs b/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs index 61bb60130d..56e1ffd316 100644 --- a/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs +++ b/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs @@ -21,37 +21,37 @@ namespace CalamityMod.Projectiles.Damageable public override void SafeSetDefaults() { - projectile.width = projectile.height = 76; - projectile.friendly = true; - projectile.penetrate = 20; + Projectile.width = Projectile.height = 76; + Projectile.friendly = true; + Projectile.penetrate = 20; } public override void SafeAI() { - projectile.rotation += MathHelper.ToRadians(8f); - Vector2 spawnPosition = projectile.Center + Utils.NextVector2Circular(Main.rand, projectile.width, projectile.height) / 2f; + Projectile.rotation += MathHelper.ToRadians(8f); + Vector2 spawnPosition = Projectile.Center + Utils.NextVector2Circular(Main.rand, Projectile.width, Projectile.height) / 2f; for (int i = 0; i < 8; i++) { Dust dust = Dust.NewDustPerfect(spawnPosition, (int)CalamityDusts.ProfanedFire); - dust.velocity = projectile.DirectionFrom(spawnPosition); + dust.velocity = Projectile.DirectionFrom(spawnPosition); dust.scale = Main.rand.NextFloat(1.1f, 1.5f); dust.noGravity = true; } } public override void DamageKillEffect() { - Utils.PoofOfSmoke(projectile.Center); + Utils.PoofOfSmoke(Projectile.Center); } public override void Kill(int timeLeft) { for (int i = 1; i <= 6; i++) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { float angle = MathHelper.TwoPi / 6f * (i - 1); - Projectile shard = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, mod.ProjectileType("ArtifactOfResilienceShard" + i.ToString()), projectile.damage, projectile.knockBack, projectile.owner); + Projectile shard = Projectile.NewProjectileDirect(Projectile.Center, Vector2.Zero, Mod.Find("ArtifactOfResilienceShard" + i.ToString()).Type, Projectile.damage, Projectile.knockBack, Projectile.owner); shard.ai[0] = angle; - shard.frameCounter = projectile.frameCounter + 1; // FrameCounter is a stored value for the amount of times the bulwark has reformed. + shard.frameCounter = Projectile.frameCounter + 1; // FrameCounter is a stored value for the amount of times the bulwark has reformed. } } } diff --git a/Projectiles/Damageable/DamageableProjectile.cs b/Projectiles/Damageable/DamageableProjectile.cs index 7545c99a14..02a3f11404 100644 --- a/Projectiles/Damageable/DamageableProjectile.cs +++ b/Projectiles/Damageable/DamageableProjectile.cs @@ -153,27 +153,27 @@ namespace CalamityMod.Projectiles.Damageable { if (HitSound != null) { - Main.PlaySound(HitSound, projectile.Center); + SoundEngine.PlaySound(HitSound, Projectile.Center); } } else if (Life <= 0) { if (DeathSound != null) { - Main.PlaySound(DeathSound, projectile.Center); + SoundEngine.PlaySound(DeathSound, Projectile.Center); } DamageKillEffect(); - projectile.Kill(); + Projectile.Kill(); } } public virtual bool NPCCollisionCheck() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; for (int i = 0; i < Main.npc.Length; i++) { if (Main.npc[i].active && !Main.npc[i].friendly && Main.npc[i].damage > 0 && DamageSources.HasFlag(DamageSourceType.HostileNPCs)) { - if (Main.npc[i].Hitbox.Intersects(projectile.Hitbox) && !NPCsToIgnore.Contains(Main.npc[i].type)) + if (Main.npc[i].Hitbox.Intersects(Projectile.Hitbox) && !NPCsToIgnore.Contains(Main.npc[i].type)) { int damage = Main.DamageVar(Main.npc[i].damage); int bannerBuffId = Item.NPCtoBanner(Main.npc[i].BannerID()); @@ -188,7 +188,7 @@ namespace CalamityMod.Projectiles.Damageable damage = (int)(damage * ItemID.Sets.BannerStrength[Item.BannerToItem(bannerBuffId)].NormalDamageReceived); } } - CombatText.NewText(new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height), CombatText.DamagedFriendly, damage); + CombatText.NewText(new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height), CombatText.DamagedFriendly, damage); Life -= damage; HitEffectNPC(damage, Main.npc[i]); DamageImmunityFrames = MaxDamageImmunityFrames; @@ -205,21 +205,21 @@ namespace CalamityMod.Projectiles.Damageable { bool canBeHit = (Main.projectile[i].friendly && DamageSources.HasFlag(DamageSourceType.FriendlyProjectiles) || Main.projectile[i].hostile && DamageSources.HasFlag(DamageSourceType.HostileProjectiles)) && - i != projectile.whoAmI; + i != Projectile.whoAmI; if (Main.projectile[i].active && canBeHit && Main.projectile[i].damage > 0) { - if (Main.projectile[i].Colliding(Main.projectile[i].Hitbox, projectile.Hitbox)) + if (Main.projectile[i].Colliding(Main.projectile[i].Hitbox, Projectile.Hitbox)) { int damage = Main.DamageVar(Main.projectile[i].damage) * 2; damage = Main.expertMode ? (int)(damage * Main.expertDamage) : damage; - CombatText.NewText(new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height), CombatText.DamagedFriendly, damage); + CombatText.NewText(new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height), CombatText.DamagedFriendly, damage); Life -= damage; HitEffectProjectile(damage, Main.projectile[i]); DamageImmunityFrames = MaxDamageImmunityFrames; - if (projectile.usesIDStaticNPCImmunity) - DamageImmunityFrames = projectile.idStaticNPCHitCooldown; - if (projectile.usesLocalNPCImmunity) - DamageImmunityFrames = projectile.localNPCHitCooldown; + if (Projectile.usesIDStaticNPCImmunity) + DamageImmunityFrames = Projectile.idStaticNPCHitCooldown; + if (Projectile.usesLocalNPCImmunity) + DamageImmunityFrames = Projectile.localNPCHitCooldown; NetUpdate(true); return true; } @@ -278,11 +278,11 @@ namespace CalamityMod.Projectiles.Damageable { if (forceCondition()) { - NetMessage.SendData(MessageID.SyncProjectile, number: projectile.whoAmI); + NetMessage.SendData(MessageID.SyncProjectile, number: Projectile.whoAmI); } } else - projectile.netUpdate = true; + Projectile.netUpdate = true; } /// /// Does things when the projectile is hit. @@ -315,13 +315,13 @@ namespace CalamityMod.Projectiles.Damageable { mouseRectangle.Y = (int)Main.screenPosition.Y + Main.screenHeight - Main.mouseY; } - if (projectile.Hitbox.Intersects(mouseRectangle)) + if (Projectile.Hitbox.Intersects(mouseRectangle)) { if (LifeMax > 1) { string lifeDataText = string.Concat(new object[] { - projectile.Name, + Projectile.Name, ": ", Life, "/", @@ -343,7 +343,7 @@ namespace CalamityMod.Projectiles.Damageable return; Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, null, null, null, Main.UIScaleMatrix); - Main.instance.DrawHealthBar(projectile.Bottom.X, projectile.Bottom.Y, Life, LifeMax, 1f, 1f); + Main.instance.DrawHealthBar(Projectile.Bottom.X, Projectile.Bottom.Y, Life, LifeMax, 1f, 1f); } #endregion } diff --git a/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs b/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs index c3152637e2..0942f7c609 100644 --- a/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs +++ b/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs @@ -12,27 +12,27 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public const int Lifetime = 360; public override void SetStaticDefaults() { DisplayName.SetDefault("Pulse Energy"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = Lifetime; - projectile.extraUpdates = 1; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = Lifetime; + Projectile.extraUpdates = 1; } public override void AI() @@ -40,13 +40,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Time++; GenerateIdleDust(); - NPC potentialTarget = projectile.Center.ClosestNPCAt(920f); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(920f); if (potentialTarget != null) { - float oldSpeed = projectile.velocity.Length(); - float inertia = MathHelper.Lerp(15f, 4f, Utils.InverseLerp(Lifetime, Lifetime - 60f, projectile.timeLeft, true)); - projectile.velocity = (projectile.velocity * inertia + projectile.SafeDirectionTo(potentialTarget.Center, -Vector2.UnitY) * oldSpeed) / (inertia + 1f); - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX) * oldSpeed; + float oldSpeed = Projectile.velocity.Length(); + float inertia = MathHelper.Lerp(15f, 4f, Utils.InverseLerp(Lifetime, Lifetime - 60f, Projectile.timeLeft, true)); + Projectile.velocity = (Projectile.velocity * inertia + Projectile.SafeDirectionTo(potentialTarget.Center, -Vector2.UnitY) * oldSpeed) / (inertia + 1f); + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * oldSpeed; } } @@ -57,15 +57,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Generate a helical group of dust particles that pulsate with time. for (int i = 0; i < 3; i++) { - float angle = projectile.velocity.ToRotation() + MathHelper.PiOver2; + float angle = Projectile.velocity.ToRotation() + MathHelper.PiOver2; float pulse = (float)Math.Sin(Time / 110f + MathHelper.TwoPi / 3f * i); Vector2 offset = angle.ToRotationVector2().RotatedBy(MathHelper.TwoPi / 3f * i) * pulse * 6f; - Dust dust = Dust.NewDustPerfect(projectile.Center + offset, 234); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 234); dust.velocity = Vector2.Zero; dust.noGravity = true; - dust = Dust.NewDustPerfect(projectile.Center + offset, 234); + dust = Dust.NewDustPerfect(Projectile.Center + offset, 234); dust.velocity = Vector2.Zero; dust.noGravity = true; } diff --git a/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs b/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs index 4aa1383ed1..cbcb718176 100644 --- a/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs +++ b/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -11,8 +12,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public const int TotalSpins = 2; public const float SpinTime = 30f; @@ -23,43 +24,43 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 180; - projectile.penetrate = 4; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; - projectile.tileCollide = false; + Projectile.width = 34; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 180; + Projectile.penetrate = 4; + Projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; + Projectile.tileCollide = false; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.Purple.ToVector3()); + Lighting.AddLight(Projectile.Center, Color.Purple.ToVector3()); Time++; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (Time <= SpinTime) { - projectile.velocity = projectile.velocity.RotatedBy(MathHelper.TwoPi * TotalSpins / SpinTime); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; - projectile.Center = player.itemLocation + projectile.velocity; + Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.TwoPi * TotalSpins / SpinTime); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.Center = player.itemLocation + Projectile.velocity; ManipulatePlayerItemValues(player); } else if (Time == SpinTime + 1f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; RingDustEffect(player.itemLocation, 1f, 1f, 5f, 2f); - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX * player.direction) * player.ActiveItem().shootSpeed; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX * player.direction) * player.ActiveItem().shootSpeed; } } public void ManipulatePlayerItemValues(Player player) { - player.direction = projectile.direction; - player.heldProj = projectile.whoAmI; - player.itemRotation = projectile.rotation; + player.direction = Projectile.direction; + player.heldProj = Projectile.whoAmI; + player.itemRotation = Projectile.rotation; player.itemTime = player.itemAnimation; } @@ -84,27 +85,27 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public void OnHitEffects() { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; // Explode if the projectile is a stealth strike projectile. int totalEnergyParticlesToSpawn = 4; - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); totalEnergyParticlesToSpawn = 4; - RingDustEffect(projectile.Center, 1.6f, 1.4f, 7f, 2.6f); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 160); - projectile.damage /= 2; - projectile.Damage(); - projectile.damage *= 2; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 34); + RingDustEffect(Projectile.Center, 1.6f, 1.4f, 7f, 2.6f); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 160); + Projectile.damage /= 2; + Projectile.Damage(); + Projectile.damage *= 2; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 34); } for (int i = 0; i < totalEnergyParticlesToSpawn; i++) { float offsetAngle = MathHelper.Lerp(-0.35f, 0.35f, i / (float)totalEnergyParticlesToSpawn); - Vector2 velocity = -projectile.oldVelocity.RotatedBy(offsetAngle) * 0.66f; - Projectile.NewProjectile(projectile.Center + velocity * 1.8f, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack * 0.4f, projectile.owner); + Vector2 velocity = -Projectile.oldVelocity.RotatedBy(offsetAngle) * 0.66f; + Projectile.NewProjectile(Projectile.Center + velocity * 1.8f, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.4f, Projectile.owner); } } diff --git a/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs b/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs index 334ba20f84..9e58e239bb 100644 --- a/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs +++ b/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs @@ -14,78 +14,78 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Galvanizing Glaive"); - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 90; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 90; } public override void SetDefaults() { - projectile.width = 100; - projectile.height = 100; - projectile.melee = true; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.alpha = 255; + Projectile.width = 100; + Projectile.height = 100; + Projectile.DamageType = DamageClass.Melee; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.hide = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; + Projectile.alpha = 255; } public override SpearType SpearAiType => SpearType.GhastlyGlaiveSpear; public override float TravelSpeed => 8f; public override Action EffectBeforeReelback => proj => { - Vector2 offset = projectile.velocity.SafeNormalize(Vector2.UnitY) * projectile.width; - Projectile.NewProjectile(projectile.Center + offset, projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), 0f, projectile.owner); + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitY) * Projectile.width; + Projectile.NewProjectile(Projectile.Center + offset, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner); }; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 drawPosition = projectile.position + new Vector2(projectile.width, projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture = ModContent.GetTexture(Texture); + Vector2 drawPosition = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture = ModContent.Request(Texture); Vector2 origin = texture.Size() * 0.5f; - spriteBatch.Draw(texture, drawPosition, null, lightColor, projectile.rotation, origin, projectile.scale, projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(texture, drawPosition, null, lightColor, Projectile.rotation, origin, Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - float angle = projectile.rotation - MathHelper.PiOver4 * (projectile.spriteDirection == -1).ToInt(); + float angle = Projectile.rotation - MathHelper.PiOver4 * (Projectile.spriteDirection == -1).ToInt(); float _ = 0f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + angle.ToRotationVector2() * -105f, projectile.width, ref _); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + angle.ToRotationVector2() * -105f, Projectile.width, ref _); } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float animationRatio = player.itemAnimation / (float)player.itemAnimationMax; DelegateMethods.f_1 = Utils.InverseLerp(0f, 0.4f, animationRatio, true) * Utils.InverseLerp(1f, 0.6f, animationRatio, true); DelegateMethods.c_1 = Color.White; List oldPositions = new List() { - projectile.position + Projectile.position }; - foreach (var oldPosition in projectile.oldPos) + foreach (var oldPosition in Projectile.oldPos) { if (oldPosition != Vector2.Zero) oldPositions.Add(oldPosition); } for (int i = 0; i < oldPositions.Count - 2; i += 2) { - Vector2 offset = projectile.Size * 0.5f + projectile.Size.RotatedBy(projectile.velocity.ToRotation() - MathHelper.PiOver4) * 0.4f; - Vector2 start = oldPositions[i] + offset - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY; - Vector2 end = oldPositions[i + 2] + offset - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY; - Utils.DrawLaser(spriteBatch, ModContent.GetTexture("CalamityMod/Projectiles/LightningProj"), start, end, new Vector2(0.2f), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + Vector2 offset = Projectile.Size * 0.5f + Projectile.Size.RotatedBy(Projectile.velocity.ToRotation() - MathHelper.PiOver4) * 0.4f; + Vector2 start = oldPositions[i] + offset - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; + Vector2 end = oldPositions[i + 2] + offset - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; + Utils.DrawLaser(spriteBatch, ModContent.Request("CalamityMod/Projectiles/LightningProj"), start, end, new Vector2(0.2f), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (Main.rand.NextBool(12)) - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, projectile.owner, 0f, target.whoAmI); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Projectile.owner, 0f, target.whoAmI); } } } diff --git a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs index 6d3127489c..b1b8954bdc 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Audio; using System; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -20,49 +21,49 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 24; - projectile.height = 58; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; + Projectile.width = 24; + Projectile.height = 58; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float num = MathHelper.PiOver2; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.type == ModContent.ProjectileType()) + if (Projectile.type == ModContent.ProjectileType()) { - if (projectile.ai[0] < 5f) - projectile.ai[0] += 1f; + if (Projectile.ai[0] < 5f) + Projectile.ai[0] += 1f; - if (projectile.ai[0] > 4f) - projectile.ai[0] = 2f; + if (Projectile.ai[0] > 4f) + Projectile.ai[0] = 2f; // The Gatling Laser shoots every other frame (effective use time of 2). int fireRate = 2; - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; bool shootThisFrame = false; - if (projectile.ai[1] >= fireRate) + if (Projectile.ai[1] >= fireRate) { - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; shootThisFrame = true; } - if (projectile.soundDelay <= 0) + if (Projectile.soundDelay <= 0) { - projectile.soundDelay = fireRate * 6; - if (projectile.ai[0] != 1f) + Projectile.soundDelay = fireRate * 6; + if (Projectile.ai[0] != 1f) { fireLasers = true; - projectile.soundDelay *= 6; - gatlingLaserLoop = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GatlingLaserFireLoop"), (int)projectile.position.X, (int)projectile.position.Y); + Projectile.soundDelay *= 6; + gatlingLaserLoop = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GatlingLaserFireLoop"), (int)Projectile.position.X, (int)Projectile.position.Y); } } - if (shootThisFrame && Main.myPlayer == projectile.owner && fireLasers) + if (shootThisFrame && Main.myPlayer == Projectile.owner && fireLasers) { Item gatling = player.ActiveItem(); @@ -81,7 +82,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (stillInUse && hasMana && hasCharge) { - float scaleFactor = player.ActiveItem().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) @@ -94,15 +95,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal vector3 = -Vector2.UnitY; } vector3 *= scaleFactor; - if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) + if (vector3.X != Projectile.velocity.X || vector3.Y != Projectile.velocity.Y) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity = vector3; + Projectile.velocity = vector3; int type = ModContent.ProjectileType(); float velocity = 3f; - value2 = projectile.Center; - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * velocity; + value2 = Projectile.Center; + Vector2 spinningpoint = Vector2.Normalize(Projectile.velocity) * velocity; double spread = Math.PI / 32D; spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 2D * spread - spread); @@ -119,31 +120,31 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } float SpeedX = velocity2.X + Main.rand.Next(-1, 2) * 0.005f; float SpeedY = velocity2.Y + Main.rand.Next(-1, 2) * 0.005f; - float ai0 = projectile.ai[0] - 2f; // 0, 1, or 2 + float ai0 = Projectile.ai[0] - 2f; // 0, 1, or 2 // Use charge when firing a laser. modItem.Charge -= GatlingLaser.HoldoutChargeUse; - Projectile.NewProjectile(value2.X, value2.Y, SpeedX, SpeedY, type, currentDamage, projectile.knockBack, projectile.owner, ai0, 0f); + Projectile.NewProjectile(value2.X, value2.Y, SpeedX, SpeedY, type, currentDamage, Projectile.knockBack, Projectile.owner, ai0, 0f); } else { if (gatlingLaserLoop != null) gatlingLaserLoop.Stop(); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GatlingLaserFireEnd"), (int)projectile.position.X, (int)projectile.position.Y); - projectile.Kill(); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GatlingLaserFireEnd"), (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.Kill(); } } } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); + player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * Projectile.direction, Projectile.velocity.X * Projectile.direction); } public override bool CanDamage() => false; diff --git a/Projectiles/DraedonsArsenal/GatlingLaserShot.cs b/Projectiles/DraedonsArsenal/GatlingLaserShot.cs index d9c73029a4..fe9360ca7b 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserShot.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserShot.cs @@ -19,54 +19,54 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 600; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 600; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.2f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.2f, 0f, 0f); float createDustVar = 10f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > createDustVar) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > createDustVar) { Vector2 value7 = new Vector2(5f, 10f); Vector2 value8 = Vector2.UnitX * -12f; - switch ((int)projectile.ai[0]) + switch ((int)Projectile.ai[0]) { case 0: - int num41 = Dust.NewDust(projectile.Center, 0, 0, dust, 0f, 0f, 160, default, 0.8f); + int num41 = Dust.NewDust(Projectile.Center, 0, 0, dust, 0f, 0f, 160, default, 0.8f); Main.dust[num41].noGravity = true; - Main.dust[num41].position = projectile.Center; - Main.dust[num41].velocity = projectile.velocity; + Main.dust[num41].position = Projectile.Center; + Main.dust[num41].velocity = Projectile.velocity; break; case 1: value8 = -Vector2.UnitY.RotatedBy(24f * 0.1308997f + 0f * MathHelper.Pi) * value7 * 0.5f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dust, 0f, 0f, 160, default, 0.8f); + int num42 = Dust.NewDust(Projectile.Center, 0, 0, dust, 0f, 0f, 160, default, 0.8f); Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; + Main.dust[num42].position = Projectile.Center + value8; + Main.dust[num42].velocity = Projectile.velocity; break; case 2: value8 = -Vector2.UnitY.RotatedBy(24f * 0.1308997f + 1f * MathHelper.Pi) * value7 * 0.5f; - int num43 = Dust.NewDust(projectile.Center, 0, 0, dust, 0f, 0f, 160, default, 0.8f); + int num43 = Dust.NewDust(Projectile.Center, 0, 0, dust, 0f, 0f, 160, default, 0.8f); Main.dust[num43].noGravity = true; - Main.dust[num43].position = projectile.Center + value8; - Main.dust[num43].velocity = projectile.velocity; + Main.dust[num43].position = Projectile.Center + value8; + Main.dust[num43].velocity = Projectile.velocity; break; default: break; } } - if (projectile.localAI[0] == createDustVar) + if (Projectile.localAI[0] == createDustVar) LaserBurst(1.8f, 3f); } @@ -78,14 +78,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void Kill(int timeLeft) { int height = 20; - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); LaserBurst(2.4f, 4.2f); // 60 dusts @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float num641 = 4f; - int num643 = Dust.NewDust(projectile.Center, 6, 6, dust, 0f, 0f, 100, default, 1f); + int num643 = Dust.NewDust(Projectile.Center, 6, 6, dust, 0f, 0f, 100, default, 1f); float num644 = Main.dust[num643].velocity.X; float num645 = Main.dust[num643].velocity.Y; @@ -125,20 +125,20 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num53 = 0; num53 < 4; num53 = num3 + 1) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 0.9f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 0.9f); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust2 = Main.dust[num54]; dust2.velocity *= 3f; dust2 = Main.dust[num54]; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 0.66f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 0.66f); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust2 = Main.dust[num54]; dust2.velocity *= 2f; @@ -154,12 +154,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num55 = 0; num55 < 2; num55 = num3 + 1) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 1.2f); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 1.2f); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust2 = Main.dust[num56]; diff --git a/Projectiles/DraedonsArsenal/GaussEnergy.cs b/Projectiles/DraedonsArsenal/GaussEnergy.cs index c47e7ec50d..8ffbd1755f 100644 --- a/Projectiles/DraedonsArsenal/GaussEnergy.cs +++ b/Projectiles/DraedonsArsenal/GaussEnergy.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 240; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; } public override void AI() { for (int i = 0; i < 2; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(4f, 4f), 107); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4f, 4f), 107); dust.scale = Main.rand.NextFloat(1.1f, 1.3f); dust.noGravity = true; } diff --git a/Projectiles/DraedonsArsenal/GaussFlux.cs b/Projectiles/DraedonsArsenal/GaussFlux.cs index c596885fe0..3788965409 100644 --- a/Projectiles/DraedonsArsenal/GaussFlux.cs +++ b/Projectiles/DraedonsArsenal/GaussFlux.cs @@ -11,13 +11,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public NPC Target { - get => Main.npc[(int)projectile.ai[1]]; - set => projectile.ai[1] = value.whoAmI; + get => Main.npc[(int)Projectile.ai[1]]; + set => Projectile.ai[1] = value.whoAmI; } public override void SetStaticDefaults() { @@ -26,25 +26,25 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 180; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.Lime.ToVector3()); + Lighting.AddLight(Projectile.Center, Color.Lime.ToVector3()); if (!Target.active) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.Center = Target.Center; + Projectile.Center = Target.Center; if (!Main.dedServ) { if (Time == 0) diff --git a/Projectiles/DraedonsArsenal/GaussPistolShot.cs b/Projectiles/DraedonsArsenal/GaussPistolShot.cs index 229a753ef4..1529d9fe89 100644 --- a/Projectiles/DraedonsArsenal/GaussPistolShot.cs +++ b/Projectiles/DraedonsArsenal/GaussPistolShot.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public Vector2 OldVelocity; public const float MaxChargeRadius = 7f; @@ -25,18 +25,18 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Gauss Shot"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.timeLeft = 240; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; } public override void SendExtraAI(BinaryWriter writer) @@ -55,30 +55,30 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (Time < ChargeTime && OldVelocity == Vector2.Zero) { - OldVelocity = projectile.velocity; - projectile.velocity = Vector2.Zero; - projectile.netUpdate = true; + OldVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + Projectile.netUpdate = true; } if (Time >= ChargeTime && OldVelocity != Vector2.Zero) { - projectile.velocity = OldVelocity; + Projectile.velocity = OldVelocity; OldVelocity = Vector2.Zero; - projectile.netUpdate = true; + Projectile.netUpdate = true; } float energyRadius = MathHelper.Lerp(MaxChargeRadius * 0.333f, MaxChargeRadius, Utils.InverseLerp(0f, ChargeTime, Time, true)); float energySphereSpeedMax = MathHelper.Lerp(MaxEnergyParticleSpeed, MinEnergyParticleSpeed, Utils.InverseLerp(0f, ChargeTime, Time, true)); // Charge up dust. - if (projectile.velocity.Length() == 0f && !Main.dedServ) + if (Projectile.velocity.Length() == 0f && !Main.dedServ) { for (int i = 0; i < 2; i++) { Vector2 offset = Main.rand.NextVector2CircularEdge(energyRadius, energyRadius) * 3f; float dustHue = Main.rand.NextFloat(0.15f, 0.3f); - Dust dust = Dust.NewDustPerfect(projectile.Center + offset, 261); - dust.velocity = projectile.DirectionFrom(dust.position) * energyRadius / 3f; + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 261); + dust.velocity = Projectile.DirectionFrom(dust.position) * energyRadius / 3f; dust.color = Main.hslToRgb(dustHue, Main.rand.NextFloat(0.9f, 1f), Main.rand.NextFloat(0.5f, 0.66f)); dust.noGravity = true; } @@ -98,9 +98,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal offset.Y *= yOffsetFactor; float dustHue = Main.rand.NextFloat(0.15f, 0.3f); - Dust dust = Dust.NewDustPerfect(projectile.Center + offset, 261); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 261); dust.velocity = Main.rand.NextVector2Circular(energySphereSpeedMax, energySphereSpeedMax); - dust.velocity += projectile.velocity; + dust.velocity += Projectile.velocity; dust.color = Main.hslToRgb(dustHue, Main.rand.NextFloat(0.9f, 1f), Main.rand.NextFloat(0.5f, 0.66f)); dust.scale = 0.8f; dust.noGravity = true; @@ -111,12 +111,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float angle = i / 25f * MathHelper.TwoPi; - Vector2 offset = angle.ToRotationVector2().RotatedBy(projectile.velocity.ToRotation()) * energyRadius * 1.5f; + Vector2 offset = angle.ToRotationVector2().RotatedBy(Projectile.velocity.ToRotation()) * energyRadius * 1.5f; offset.X *= -xOffsetFactor; offset.Y *= yOffsetFactor; float dustHue = Main.rand.NextFloat(0.15f, 0.3f); - Dust dust = Dust.NewDustPerfect(projectile.Center + offset, 261); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 261); dust.velocity = Vector2.Zero; dust.color = Main.hslToRgb(dustHue, Main.rand.NextFloat(0.9f, 1f), Main.rand.NextFloat(0.5f, 0.66f)); dust.scale = 0.5f; diff --git a/Projectiles/DraedonsArsenal/GaussRifleBlast.cs b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs index 09a3015d71..9b584abab7 100644 --- a/Projectiles/DraedonsArsenal/GaussRifleBlast.cs +++ b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs @@ -2,6 +2,7 @@ using System; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -11,8 +12,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public override void SetStaticDefaults() @@ -22,16 +23,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = projectile.height = 40; - projectile.friendly = true; - projectile.ranged = true; - projectile.timeLeft = 300; + Projectile.width = Projectile.height = 40; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 300; } public override void AI() { Time++; - projectile.tileCollide = Time > 3f; + Projectile.tileCollide = Time > 3f; if (!Main.dedServ) { // Idle dust. @@ -40,7 +41,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float angle = i / 10f * MathHelper.TwoPi; for (int j = 0; j < 4; j++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, 263); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 263); dust.velocity = angle.ToRotationVector2().RotatedByRandom(0.25f) * Main.rand.NextFloat(6f, 8f); dust.noGravity = true; dust.scale = 1.6f; @@ -49,9 +50,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Ring dust. for (int i = 0; i < 4; i++) { - float angle = projectile.velocity.ToRotation() + (i / 4f * MathHelper.TwoPi) + Time / 24f; + float angle = Projectile.velocity.ToRotation() + (i / 4f * MathHelper.TwoPi) + Time / 24f; float radius = (float)Math.Sin(Time / 7.5f) * 40f + 10f; - Dust dust = Dust.NewDustPerfect(projectile.Center + angle.ToRotationVector2() * radius, 226); + Dust dust = Dust.NewDustPerfect(Projectile.Center + angle.ToRotationVector2() * radius, 226); dust.velocity = Vector2.Zero; dust.noGravity = true; dust.scale = 1.5f; @@ -61,10 +62,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void Kill(int timeLeft) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), projectile.Center); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), Projectile.Center); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs b/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs index 9cf003f5f0..1853401c7a 100644 --- a/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs +++ b/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public override void SetStaticDefaults() @@ -21,14 +21,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = projectile.height = 500; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 20; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 12; + Projectile.width = Projectile.height = 500; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 20; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; } public override void AI() @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int i = 0; i < 50; i++) { float angle = i / 30f * MathHelper.TwoPi; - Dust dust = Dust.NewDustPerfect(projectile.Center, 261); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 261); dust.velocity = angle.ToRotationVector2(); dust.velocity = dust.velocity.RotatedByRandom(0.4f); dust.velocity = dust.velocity.RotatedBy(Time / 60f * MathHelper.ToRadians(720f)); diff --git a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs index 42f1731ca3..b05580a31b 100644 --- a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs +++ b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -15,45 +16,45 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Hydraulic Volt Crasher"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 56; - projectile.height = 56; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.hide = true; - projectile.ownerHitCheck = true; - projectile.melee = true; - projectile.scale = 1.75f; - projectile.Calamity().trueMelee = true; + Projectile.width = 56; + Projectile.height = 56; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.hide = true; + Projectile.ownerHitCheck = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.scale = 1.75f; + Projectile.Calamity().trueMelee = true; } public override void AI() { - projectile.timeLeft = 60; - projectile.frameCounter++; - if (projectile.frameCounter % 4f == 3f) + Projectile.timeLeft = 60; + Projectile.frameCounter++; + if (Projectile.frameCounter % 4f == 3f) { - projectile.frame++; - if (projectile.frame >= Main.projFrames[projectile.type]) + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } } // Decrement charge cooldown if (chargeCooldown > 0) chargeCooldown = 0; // Play idle sounds every so often. - if (projectile.soundDelay <= 0) + if (Projectile.soundDelay <= 0) { - Main.PlaySound(SoundID.Item22, projectile.position); - projectile.soundDelay = 30; + SoundEngine.PlaySound(SoundID.Item22, Projectile.position); + Projectile.soundDelay = 30; } - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; Vector2 center = player.RotatedRelativePoint(player.MountedCenter); if (Main.myPlayer == player.whoAmI) @@ -62,12 +63,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Item heldItem = player.ActiveItem(); if (heldItem.type < ItemID.Count) { - projectile.Kill(); + Projectile.Kill(); return; } // Update the damage of the holdout projectile constantly so that it decreases as charge decreases, even while in use. - projectile.damage = player.GetWeaponDamage(heldItem); + Projectile.damage = player.GetWeaponDamage(heldItem); // Check if the player's held item still has sufficient charge. If so, and they're still using it, take a tiny bit of charge from it. CalamityGlobalItem modItem = heldItem.Calamity(); @@ -75,52 +76,52 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { modItem.Charge -= HydraulicVoltCrasher.HoldoutChargeUse; - float speed = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + float speed = player.inventory[player.selectedItem].shootSpeed * Projectile.scale; Vector2 toPointTo = Main.MouseWorld; if (player.gravDir == -1f) { toPointTo.Y = Main.screenHeight - toPointTo.Y; } toPointTo = Vector2.Normalize(toPointTo - center) * speed; - if (toPointTo != projectile.velocity) + if (toPointTo != Projectile.velocity) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity = toPointTo; + Projectile.velocity = toPointTo; } else { - projectile.Kill(); + Projectile.Kill(); } } - player.ChangeDir((projectile.velocity.X > 0).ToDirectionInt()); - player.heldProj = projectile.whoAmI; + player.ChangeDir((Projectile.velocity.X > 0).ToDirectionInt()); + player.heldProj = Projectile.whoAmI; player.itemAnimation = 2; player.itemTime = 2; // Note: player.SetDummyItemTime(frame) exists in 1.4 which accomplishes this task - player.itemRotation = (projectile.velocity * player.direction).ToRotation(); - projectile.direction = projectile.spriteDirection = player.direction; - projectile.rotation = projectile.velocity.ToRotation() + (projectile.direction == -1).ToInt() * MathHelper.Pi; + player.itemRotation = (Projectile.velocity * player.direction).ToRotation(); + Projectile.direction = Projectile.spriteDirection = player.direction; + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.direction == -1).ToInt() * MathHelper.Pi; if (Main.rand.NextBool(5)) { - Vector2 spawnPosition = projectile.velocity; + Vector2 spawnPosition = Projectile.velocity; spawnPosition.Normalize(); - spawnPosition *= projectile.Size; - spawnPosition += projectile.Center; + spawnPosition *= Projectile.Size; + spawnPosition += Projectile.Center; Dust dust = Dust.NewDustPerfect(spawnPosition, 226); - dust.velocity = projectile.velocity.SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(2f, 3.6f); + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(2f, 3.6f); dust.velocity += player.velocity * 0.4f; } - projectile.position = center - projectile.Size * 0.5f; - projectile.position -= projectile.velocity.ToRotation().ToRotationVector2() * 8f; - projectile.velocity.X *= Main.rand.NextFloat(0.97f, 1.03f); + Projectile.position = center - Projectile.Size * 0.5f; + Projectile.position -= Projectile.velocity.ToRotation().ToRotationVector2() * 8f; + Projectile.velocity.X *= Main.rand.NextFloat(0.97f, 1.03f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"), target.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"), target.Center); if (chargeCooldown > 0) return; chargeCooldown = 60; @@ -128,7 +129,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int i = 0; i < Main.npc.Length; i++) { if (i != target.whoAmI && - Main.npc[i].CanBeChasedBy(projectile, false) && + Main.npc[i].CanBeChasedBy(Projectile, false) && Main.npc[i].Distance(target.Center) < 240f) { if (TryToSuperchargeNPC(Main.npc[i])) @@ -161,9 +162,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), - (int)(projectile.damage * 0.8), + (int)(Projectile.damage * 0.8), 0f, - projectile.owner, + Projectile.owner, 0f, npc.whoAmI); return true; @@ -171,14 +172,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), lightColor, projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), lightColor, Projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/DraedonsArsenal/LaserRifleShot.cs b/Projectiles/DraedonsArsenal/LaserRifleShot.cs index 2307f63a4d..b8188b914d 100644 --- a/Projectiles/DraedonsArsenal/LaserRifleShot.cs +++ b/Projectiles/DraedonsArsenal/LaserRifleShot.cs @@ -19,36 +19,36 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 600; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 600; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.2f, 0.1f, 0f); + Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f); float createDustVar = 12f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > createDustVar) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > createDustVar) { Vector2 value7 = new Vector2(5f, 10f); Vector2 value8 = Vector2.UnitX * -12f; for (int i = 0; i < 2; i++) { - int num41 = Dust.NewDust(projectile.Center, 0, 0, dust, 0f, 0f, 160, projectile.ai[0] == 0f ? default : new Color(255, 255, 0), 2f); + int num41 = Dust.NewDust(Projectile.Center, 0, 0, dust, 0f, 0f, 160, Projectile.ai[0] == 0f ? default : new Color(255, 255, 0), 2f); Main.dust[num41].noGravity = true; - Main.dust[num41].position = projectile.Center; - Main.dust[num41].velocity = projectile.velocity; + Main.dust[num41].position = Projectile.Center; + Main.dust[num41].velocity = Projectile.velocity; } } - if (projectile.localAI[0] == createDustVar) + if (Projectile.localAI[0] == createDustVar) LaserBurst(1.8f, 3f); } @@ -60,14 +60,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void Kill(int timeLeft) { int height = 60; - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); LaserBurst(2.4f, 4.2f); // 60 dusts @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float num641 = 4f; - int num643 = Dust.NewDust(projectile.Center, 6, 6, dust, 0f, 0f, 100, default, 2f); + int num643 = Dust.NewDust(Projectile.Center, 6, 6, dust, 0f, 0f, 100, default, 2f); float num644 = Main.dust[num643].velocity.X; float num645 = Main.dust[num643].velocity.Y; @@ -102,20 +102,20 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num53 = 0; num53 < 20; num53++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 2.5f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 2.5f); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust2 = Main.dust[num54]; dust2.velocity *= 3f; dust2 = Main.dust[num54]; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 1.9f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 1.9f); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust2 = Main.dust[num54]; dust2.velocity *= 2f; @@ -129,12 +129,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num55 = 0; num55 < 10; num55++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 3.2f); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 3.2f); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust2 = Main.dust[num56]; diff --git a/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs b/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs index db65f294fa..19c1d4c76f 100644 --- a/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs +++ b/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -10,8 +11,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } private float lightAmt = 1f; @@ -29,19 +30,19 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = projectile.height = 383; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = frameLength * horizontalFrames * verticalFrames / 2; + Projectile.width = Projectile.height = 383; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = frameLength * horizontalFrames * verticalFrames / 2; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter % frameLength == frameLength - 1) + Projectile.frameCounter++; + if (Projectile.frameCounter % frameLength == frameLength - 1) { frameY++; if (frameY >= verticalFrames) @@ -51,15 +52,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } if (frameX >= horizontalFrames) { - projectile.Kill(); + Projectile.Kill(); } } - Lighting.AddLight(projectile.Center, Color.White.ToVector3() * 4f * lightAmt); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 4f * lightAmt); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"), projectile.Center); - projectile.localAI[0] = 1f; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"), Projectile.Center); + Projectile.localAI[0] = 1f; } lightAmt = (float)Math.Sin(Time / 37 * MathHelper.Pi) * 2f; if (lightAmt > 1f) @@ -67,17 +68,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Time++; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; int length = texture.Width / horizontalFrames; int height = texture.Height / verticalFrames; - Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Rectangle frame = new Rectangle(frameX * length, frameY * height, length, height); Vector2 origin = new Vector2(length / 2f, height / 2f); - spriteBatch.Draw(texture, drawPos, frame, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, drawPos, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/DraedonsArsenal/MountedScannerLaser.cs b/Projectiles/DraedonsArsenal/MountedScannerLaser.cs index 648bcde31c..d85cc3c26c 100644 --- a/Projectiles/DraedonsArsenal/MountedScannerLaser.cs +++ b/Projectiles/DraedonsArsenal/MountedScannerLaser.cs @@ -14,61 +14,61 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public int OwnerIndex { - get => Projectile.GetByUUID(projectile.owner, projectile.ai[1]); - set => projectile.ai[1] = value; + get => Projectile.GetByUUID(Projectile.owner, Projectile.ai[1]); + set => Projectile.ai[1] = value; } public override float MaxScale => 0.5f + (float)Math.Cos(Main.GlobalTime * 10f) * 0.07f; public override float MaxLaserLength => 900f; public override float Lifetime => 70f; public override Color LaserOverlayColor => Color.Red; public override Color LightCastColor => LaserOverlayColor; - public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); - public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); - public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); public override void SetStaticDefaults() { DisplayName.SetDefault("Deathray"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 17; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.localNPCHitCooldown = 15; - projectile.usesLocalNPCImmunity = true; + Projectile.width = Projectile.height = 17; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.localNPCHitCooldown = 15; + Projectile.usesLocalNPCImmunity = true; } public override float DetermineLaserLength() { float[] samples = new float[4]; - Collision.LaserScan(projectile.Center, projectile.velocity, projectile.width * projectile.scale, MaxLaserLength, samples); + Collision.LaserScan(Projectile.Center, Projectile.velocity, Projectile.width * Projectile.scale, MaxLaserLength, samples); return samples.Average(); } public override void UpdateLaserMotion() { if (OwnerIndex == -1) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.velocity = Vector2.Lerp(projectile.velocity, Main.projectile[OwnerIndex].rotation.ToRotationVector2().RotatedBy(Math.Cos(Time / 25) * 0.05f), 0.125f); - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Main.projectile[OwnerIndex].rotation.ToRotationVector2().RotatedBy(Math.Cos(Time / 25) * 0.05f), 0.125f); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override void AttachToSomething() { if (OwnerIndex == -1) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.Center = Main.projectile[OwnerIndex].Center + Main.projectile[OwnerIndex].rotation.ToRotationVector2() * 18f; + Projectile.Center = Main.projectile[OwnerIndex].Center + Main.projectile[OwnerIndex].rotation.ToRotationVector2() * 18f; // Kill the projectile if the owner isn't targeting anything anymore. if (Main.projectile[OwnerIndex].localAI[0] == 0f) - projectile.Kill(); + Projectile.Kill(); } public override bool ShouldUpdatePosition() => false; public override void ExtraBehavior() @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Spawn dust at the end of the laser. if (!Main.dedServ) { - Vector2 laserSpawnPosition = projectile.Center + projectile.velocity * (LaserLength - 14f); + Vector2 laserSpawnPosition = Projectile.Center + Projectile.velocity * (LaserLength - 14f); for (int i = 0; i < 3; i++) { Dust dust = Dust.NewDustPerfect(laserSpawnPosition + Main.rand.NextVector2Circular(8f, 8f), 261); @@ -89,12 +89,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.damage = (int)(projectile.damage * 0.6); + Projectile.damage = (int)(Projectile.damage * 0.6); } public override void OnHitPvp(Player target, int damage, bool crit) { - projectile.damage = (int)(projectile.damage * 0.6); + Projectile.damage = (int)(Projectile.damage * 0.6); } } } diff --git a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs index ba79156e04..d4f5e965fe 100644 --- a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs +++ b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs @@ -3,125 +3,126 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { public class MountedScannerSummon : ModProjectile { public float AngularOffsetRelativeToPlayer { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public float Time { - get => projectile.ai[1]; - set => projectile.ai[1] = value; + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; } public const float OffsetDistanceFromPlayer = 60f; public const float LaserFireRate = 40f; public override void SetStaticDefaults() { DisplayName.SetDefault("Mounted Scanner"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - ProjectileID.Sets.NeedsUUID[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 18; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; + Projectile.width = 24; + Projectile.height = 18; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 1; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.Center = player.Center + AngularOffsetRelativeToPlayer.ToRotationVector2() * OffsetDistanceFromPlayer; - if (projectile.localAI[0] == 0f) + Player player = Main.player[Projectile.owner]; + Projectile.Center = player.Center + AngularOffsetRelativeToPlayer.ToRotationVector2() * OffsetDistanceFromPlayer; + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; } AdjustDamage(player); GrantBuffs(player); - NPC potentialTarget = projectile.Center.MinionHoming(960f, player); + NPC potentialTarget = Projectile.Center.MinionHoming(960f, player); if (potentialTarget is null) { AdjustVisualValues_Idle(player); - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } else { AttackTarget(potentialTarget); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } Time++; } // While this projectile cannot attack, the projectiles it shoots derive from the damage. public void AdjustDamage(Player player) { - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } } public void GrantBuffs(Player player) { - bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isCorrectProjectile) { if (player.dead) player.Calamity().mountedScanner = false; if (player.Calamity().mountedScanner) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } public void AdjustVisualValues_Idle(Player player) { if (player.velocity.Length() > 1.5f) { - projectile.spriteDirection = (player.velocity.X > 0).ToDirectionInt(); - projectile.rotation = player.velocity.ToRotation() + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + Projectile.spriteDirection = (player.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = player.velocity.ToRotation() + (Projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; } else { - projectile.spriteDirection = 1; - projectile.rotation = projectile.rotation.AngleLerp(MathHelper.PiOver2, 0.075f); + Projectile.spriteDirection = 1; + Projectile.rotation = Projectile.rotation.AngleLerp(MathHelper.PiOver2, 0.075f); } } public void AttackTarget(NPC target) { - projectile.spriteDirection = 1; - projectile.rotation = projectile.AngleTo(target.Center); - if (!Collision.CanHitLine(projectile.position, projectile.width, projectile.height, target.position, target.width, target.height)) + Projectile.spriteDirection = 1; + Projectile.rotation = Projectile.AngleTo(target.Center); + if (!Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, target.position, target.width, target.height)) return; if (Time % 80f == 79f) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, - projectile.SafeDirectionTo(target.Center, Vector2.UnitY), + Projectile.NewProjectile(Projectile.Center, + Projectile.SafeDirectionTo(target.Center, Vector2.UnitY), ModContent.ProjectileType(), - projectile.damage, - projectile.knockBack, - projectile.owner, + Projectile.damage, + Projectile.knockBack, + Projectile.owner, 0f, - projectile.whoAmI); + Projectile.whoAmI); } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), Projectile.Center); } } public override bool CanDamage() => false; diff --git a/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs b/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs index 5840828ce3..d4e16eb721 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs @@ -12,45 +12,45 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Light Blade"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 64; - projectile.height = 120; - projectile.scale = 0.5f; - projectile.Size *= projectile.scale; + Projectile.width = 64; + Projectile.height = 120; + Projectile.scale = 0.5f; + Projectile.Size *= Projectile.scale; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.melee = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.timeLeft = Lifetime; - projectile.localNPCHitCooldown = 6; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.timeLeft = Lifetime; + Projectile.localNPCHitCooldown = 6; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - NPC potentialTarget = projectile.Center.ClosestNPCAt(1000f); - if (potentialTarget != null && projectile.Distance(potentialTarget.Center) > 40f && projectile.timeLeft > Lifetime - 60) - projectile.velocity = (projectile.velocity * 7f + projectile.SafeDirectionTo(potentialTarget.Center, -Vector2.UnitY) * 24f) / 8f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + NPC potentialTarget = Projectile.Center.ClosestNPCAt(1000f); + if (potentialTarget != null && Projectile.Distance(potentialTarget.Center) > 40f && Projectile.timeLeft > Lifetime - 60) + Projectile.velocity = (Projectile.velocity * 7f + Projectile.SafeDirectionTo(potentialTarget.Center, -Vector2.UnitY) * 24f) / 8f; - projectile.frameCounter++; + Projectile.frameCounter++; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D bladeTexture = ModContent.GetTexture(Texture); + Texture2D bladeTexture = ModContent.Request(Texture); MiscShaderData distortationShader = GameShaders.Misc["CalamityMod:LightDistortion"]; spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Rectangle frame = bladeTexture.Frame(1, 5, 0, projectile.frameCounter / 4 % 5); - var drawData2 = new DrawData(bladeTexture, projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, bladeTexture.Size() / new Vector2(1f, 5f) * 0.5f, projectile.scale * 1.2f, SpriteEffects.None, 0); + Rectangle frame = bladeTexture.Frame(1, 5, 0, Projectile.frameCounter / 4 % 5); + var drawData2 = new DrawData(bladeTexture, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, bladeTexture.Size() / new Vector2(1f, 5f) * 0.5f, Projectile.scale * 1.2f, SpriteEffects.None, 0); distortationShader.Apply(drawData2); drawData2.Draw(spriteBatch); diff --git a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs index ccfa0743a3..968842af88 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs @@ -10,6 +10,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -33,7 +34,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { get { - CalamityGlobalItem swordItem = Main.player[projectile.owner].ActiveItem().Calamity(); + CalamityGlobalItem swordItem = Main.player[Projectile.owner].ActiveItem().Calamity(); return swordItem.ChargeRatio < Phaseslayer.SizeChargeThreshold; } } @@ -41,62 +42,62 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // ai[0] wrapper. Stores a rolling lerped average of angular momentum which is used as the swing speed damage multiplier. public float AngularDamageFactor { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } // ai[1] wrapper. Stores the sword's vanishing timer. public float FadeoutTime { - get => projectile.ai[1]; - set => projectile.ai[1] = value; + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; } - public int BladeFrameX => IsSmall ? 1 : projectile.frame / 7; - public int BladeFrameY => IsSmall ? projectile.frame % 3 : projectile.frame % 7; + public int BladeFrameX => IsSmall ? 1 : Projectile.frame / 7; + public int BladeFrameY => IsSmall ? Projectile.frame % 3 : Projectile.frame % 7; public override void SetStaticDefaults() { DisplayName.SetDefault("Phaseslayer"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 13; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 13; } public override void SetDefaults() { - projectile.width = 46; // Collision logic is done manually. - projectile.height = 46; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 46; // Collision logic is done manually. + Projectile.height = 46; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 13; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 13; } // Vanilla Terraria doesn't sync projectile rotation, but it does sync velocity. // Rather than hacking velocity to reflect rotation, I'd rather just send the rotation directly. // - Ozzatron (09/21/2020) - public override void SendExtraAI(BinaryWriter writer) => writer.Write(projectile.rotation); - public override void ReceiveExtraAI(BinaryReader reader) => projectile.rotation = reader.ReadSingle(); + public override void SendExtraAI(BinaryWriter writer) => writer.Write(Projectile.rotation); + public override void ReceiveExtraAI(BinaryReader reader) => Projectile.rotation = reader.ReadSingle(); public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityGlobalItem modItem = player.ActiveItem().Calamity(); // Angles are wrapped to be 0 to 2pi instead of -pi to pi for convenience with absolute values. - float rotationAdjusted = MathHelper.WrapAngle(projectile.rotation) + MathHelper.Pi; - float oldRotationAdjusted = MathHelper.WrapAngle(projectile.oldRot[1]) + MathHelper.Pi; + float rotationAdjusted = MathHelper.WrapAngle(Projectile.rotation) + MathHelper.Pi; + float oldRotationAdjusted = MathHelper.WrapAngle(Projectile.oldRot[1]) + MathHelper.Pi; float deltaAngle = Math.Abs(MathHelper.WrapAngle(rotationAdjusted - oldRotationAdjusted)); // Frame 1 effect: Prevent the sword from instantly firing a sword beam. - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - projectile.localAI[1] = 1f; - projectile.soundDelay = SwordBeamCooldown; + Projectile.localAI[1] = 1f; + Projectile.soundDelay = SwordBeamCooldown; } ManipulatePlayer(player, modItem); @@ -128,7 +129,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (player.channel && !player.noItems && !player.CCed && playerItem.type == ModContent.ItemType() && hasCharge) { // The distance ratio ranges from 0 (your mouse is directly on the player) to 1 (your mouse is at the max range considered, or any further distance). - float mouseDistance = projectile.Distance(Main.MouseWorld); + float mouseDistance = Projectile.Distance(Main.MouseWorld); float distRatio = Utils.InverseLerp(0f, MaximumMouseRange, mouseDistance, true); // This formula ensures that the sword has a sudden and extremely harsh responsiveness penalty when the mouse is close to the player. @@ -137,13 +138,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Update the sword's angle with the responsiveness determined by mouse position. // Also flag for netcode sync if applicable (this is the only way the sword can rotate in multiplayer). - float newRotation = projectile.rotation.AngleLerp(player.AngleTo(Main.MouseWorld), aimResponsiveness); - if (projectile.rotation != newRotation) + float newRotation = Projectile.rotation.AngleLerp(player.AngleTo(Main.MouseWorld), aimResponsiveness); + if (Projectile.rotation != newRotation) { - projectile.netUpdate = true; - projectile.netSpam = 0; // You cannot stop Phaseslayer from sending packets. + Projectile.netUpdate = true; + Projectile.netSpam = 0; // You cannot stop Phaseslayer from sending packets. } - projectile.rotation = newRotation; + Projectile.rotation = newRotation; } // If the player is not wielding the sword, determine whether it should fade out or instantly vanish. @@ -154,30 +155,30 @@ namespace CalamityMod.Projectiles.DraedonsArsenal FadeoutTime = 10f; // If the player was killed, frozen, cursed, etc. just delete it immediately. else - projectile.Kill(); + Projectile.Kill(); } } // This line ensures the sword stays glued to the player, even for other players in multiplayer. - projectile.Center = player.MountedCenter + projectile.rotation.ToRotationVector2() * ProjCenterOffset; + Projectile.Center = player.MountedCenter + Projectile.rotation.ToRotationVector2() * ProjCenterOffset; // These lines ensure the player and their arm are rotated the correct direction to hold the sword. - projectile.direction = (Math.Cos(projectile.rotation) > 0).ToDirectionInt(); - player.ChangeDir(projectile.direction); + Projectile.direction = (Math.Cos(Projectile.rotation) > 0).ToDirectionInt(); + player.ChangeDir(Projectile.direction); player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = CalamityUtils.WrapAngle90Degrees(projectile.rotation); + player.itemRotation = CalamityUtils.WrapAngle90Degrees(Projectile.rotation); } private void OnShrinkEffects() { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/MechGaussRifle"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/MechGaussRifle"), Projectile.Center); if (Main.dedServ) return; for (int i = 0; i < 60; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.Brimstone); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.Brimstone); dust.velocity = Main.rand.NextVector2Circular(20f, 20f); dust.scale = 2.5f; dust.fadeIn = 1.2f; @@ -202,58 +203,58 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Get the underlying sword item's current damage. This takes into account the player's stats and the sword's current charge. int damageWithChargeAndStats = player.GetWeaponDamage(player.ActiveItem()); float sizeDamageScalar = IsSmall ? Phaseslayer.SmallDamageMultiplier : 1f; - projectile.damage = (int)(damageWithChargeAndStats * speedDamageScalar * sizeDamageScalar); + Projectile.damage = (int)(damageWithChargeAndStats * speedDamageScalar * sizeDamageScalar); } private void ManipulateFrames() { - projectile.frame = 0; + Projectile.frame = 0; if (IsSmall) { // Fadeout frames. if (FadeoutTime > 5) - projectile.frame = 1; + Projectile.frame = 1; else if (FadeoutTime > 0) - projectile.frame = 2; + Projectile.frame = 2; } else { - projectile.frameCounter++; - int adjustFrameCounter = projectile.frameCounter % 120; + Projectile.frameCounter++; + int adjustFrameCounter = Projectile.frameCounter % 120; // Idle lightning frames. if (adjustFrameCounter >= 50 && adjustFrameCounter <= 78) - projectile.frame = (int)MathHelper.Lerp(1, 9, Utils.InverseLerp(50, 75, adjustFrameCounter, true)); + Projectile.frame = (int)MathHelper.Lerp(1, 9, Utils.InverseLerp(50, 75, adjustFrameCounter, true)); if (adjustFrameCounter >= 90 && adjustFrameCounter <= 120) - projectile.frame = (int)MathHelper.Lerp(10, 18, Utils.InverseLerp(90, 117, adjustFrameCounter, true)); + Projectile.frame = (int)MathHelper.Lerp(10, 18, Utils.InverseLerp(90, 117, adjustFrameCounter, true)); // Fadeout frames. if (FadeoutTime > 5) - projectile.frame = 19; + Projectile.frame = 19; else if (FadeoutTime > 0) - projectile.frame = 20; + Projectile.frame = 20; } } private void HandleSwordBeams(Player player, CalamityGlobalItem modItem, float deltaAngle) { // Producing a sword beam takes a bit higher of a speed than the "typical" speed the sword is balanced around. - if (projectile.soundDelay <= 0 && deltaAngle >= 1.3f * StandardSwingSpeed) + if (Projectile.soundDelay <= 0 && deltaAngle >= 1.3f * StandardSwingSpeed) { // Sword beams cost a noticeable amount of energy, but deal the blade's current damage. Swing harder to get more damage! if (Main.myPlayer == player.whoAmI) { - Vector2 velocity = projectile.rotation.ToRotationVector2() * 20f; - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * SwordBeamDamageMultiplier), 0f, player.whoAmI); + Vector2 velocity = Projectile.rotation.ToRotationVector2() * 20f; + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * SwordBeamDamageMultiplier), 0f, player.whoAmI); // Actually consume energy to fire the sword beam. modItem.Charge -= Phaseslayer.SwordBeamChargeUse; } // The sound delay doubles as the sword beam's cooldown. - projectile.soundDelay = SwordBeamCooldown; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ELRFire"), projectile.Center); + Projectile.soundDelay = SwordBeamCooldown; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ELRFire"), Projectile.Center); } } @@ -263,22 +264,22 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { FadeoutTime--; if (FadeoutTime <= 0f) - projectile.Kill(); + Projectile.Kill(); } } internal PrimitiveTrail TrailDrawer; internal Color ColorFunction(float completionRatio) { - float averageRotation = projectile.oldRot.Take(20).Average(angle => MathHelper.WrapAngle(angle) + MathHelper.Pi); - float deltaAngle = Math.Abs(averageRotation - (MathHelper.WrapAngle(projectile.rotation) + MathHelper.Pi)); - float opacity = projectile.Opacity; + float averageRotation = Projectile.oldRot.Take(20).Average(angle => MathHelper.WrapAngle(angle) + MathHelper.Pi); + float deltaAngle = Math.Abs(averageRotation - (MathHelper.WrapAngle(Projectile.rotation) + MathHelper.Pi)); + float opacity = Projectile.Opacity; opacity *= Utils.InverseLerp(StandardSwingSpeed * 0.7f, StandardSwingSpeed, AngularDamageFactor, true); opacity *= (float)Math.Pow(Utils.InverseLerp(1f, 0.45f, completionRatio, true), 4D); opacity *= (float)Math.Pow(Utils.InverseLerp(0.9f, 1.1f, deltaAngle, true), 2D); - float rotationAdjusted = MathHelper.WrapAngle(projectile.rotation) + MathHelper.Pi; - float oldRotationAdjusted = MathHelper.WrapAngle(projectile.oldRot[1]) + MathHelper.Pi; + float rotationAdjusted = MathHelper.WrapAngle(Projectile.rotation) + MathHelper.Pi; + float oldRotationAdjusted = MathHelper.WrapAngle(Projectile.oldRot[1]) + MathHelper.Pi; deltaAngle = Math.Abs(MathHelper.WrapAngle(rotationAdjusted - oldRotationAdjusted)); if (deltaAngle < 0.04f) @@ -291,13 +292,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D bladeTexture = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PhaseslayerBlade"); - Texture2D hiltTexture = ModContent.GetTexture(Texture); + Texture2D bladeTexture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PhaseslayerBlade"); + Texture2D hiltTexture = ModContent.Request(Texture); if (IsSmall) - bladeTexture = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PhaseslayerBladeSmall"); + bladeTexture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PhaseslayerBladeSmall"); - float bladeLength = (IsSmall ? 90f : 132f) * projectile.scale; - Vector2 bladeOffset = projectile.rotation.ToRotationVector2() * bladeLength; + float bladeLength = (IsSmall ? 90f : 132f) * Projectile.scale; + Vector2 bladeOffset = Projectile.rotation.ToRotationVector2() * bladeLength; Vector2 origin = bladeTexture.Size() * 0.5f; origin /= IsSmall ? new Vector2(1f, 3f) : new Vector2(3f, 7f); @@ -306,27 +307,27 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (TrailDrawer is null) TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"]); - GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/SwordSlashTexture")); + GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/SwordSlashTexture")); - Player player = Main.player[projectile.owner]; - float swingAngularDirection = Math.Sign(MathHelper.WrapAngle(projectile.rotation - projectile.oldRot[1])); + Player player = Main.player[Projectile.owner]; + float swingAngularDirection = Math.Sign(MathHelper.WrapAngle(Projectile.rotation - Projectile.oldRot[1])); - Vector2[] drawPoints = new Vector2[projectile.oldPos.Length]; + Vector2[] drawPoints = new Vector2[Projectile.oldPos.Length]; Vector2 perpendicularDirection = bladeOffset.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.PiOver2); for (int i = 0; i < drawPoints.Length; i++) { - if (projectile.oldPos[i] == Vector2.Zero) + if (Projectile.oldPos[i] == Vector2.Zero) continue; float swingFactor = MathHelper.Min(1f, AngularDamageFactor); float offsetFactor = i * -swingAngularDirection * MathHelper.Min(0.8f, swingFactor) * 100f; float angularTurn = i * swingAngularDirection * -0.09f; - drawPoints[i] = projectile.position + perpendicularDirection.RotatedBy(angularTurn) * offsetFactor; + drawPoints[i] = Projectile.position + perpendicularDirection.RotatedBy(angularTurn) * offsetFactor; } - TrailDrawer.Draw(drawPoints, projectile.Size * 0.5f + bladeOffset - Main.screenPosition, 50); - spriteBatch.Draw(bladeTexture, projectile.Center + bladeOffset - Main.screenPosition, frame, Color.White, projectile.rotation + MathHelper.PiOver2, origin, projectile.scale, SpriteEffects.None, 0f); - spriteBatch.Draw(hiltTexture, projectile.Center - Main.screenPosition, null, lightColor, projectile.rotation + MathHelper.PiOver2, hiltTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + TrailDrawer.Draw(drawPoints, Projectile.Size * 0.5f + bladeOffset - Main.screenPosition, 50); + spriteBatch.Draw(bladeTexture, Projectile.Center + bladeOffset - Main.screenPosition, frame, Color.White, Projectile.rotation + MathHelper.PiOver2, origin, Projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(hiltTexture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation + MathHelper.PiOver2, hiltTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -334,9 +335,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float _ = 0f; - Vector2 start = projectile.Center + projectile.rotation.ToRotationVector2() * 28f; - Vector2 end = start + projectile.rotation.ToRotationVector2() * (IsSmall ? 202f : 254f) * projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, 60f * projectile.scale, ref _); + Vector2 start = Projectile.Center + Projectile.rotation.ToRotationVector2() * 28f; + Vector2 end = start + Projectile.rotation.ToRotationVector2() * (IsSmall ? 202f : 254f) * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, 60f * Projectile.scale, ref _); } } } diff --git a/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs b/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs index 7de5d6872c..d139e63139 100644 --- a/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs +++ b/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -20,29 +21,29 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 6; - projectile.timeLeft = 600; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.extraUpdates = 6; + Projectile.timeLeft = 600; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.6f, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.6f, 0f); int dustTypeOnTimer = dust1; float createDustVar = 10f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > createDustVar) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > createDustVar) { for (int num447 = 0; num447 < 2; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * (num447 * 0.25f); + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * (num447 * 0.25f); int num448 = Dust.NewDust(vector33, 1, 1, dustTypeOnTimer, 0f, 0f, 0, default, 1f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; @@ -50,10 +51,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Main.dust[num448].velocity *= 0.2f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] == 48f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] == 48f) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; if (dustTypeOnTimer == dust1) dustTypeOnTimer = dust2; @@ -67,28 +68,28 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num41 = 0; num41 < 2; num41++) { Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy(projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 0.75f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dust1, 0f, 0f, 160, default, 1f); + value8 = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 0.75f; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, dust1, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 0.6f; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; + Main.dust[num42].position = Projectile.Center + value8; + Main.dust[num42].velocity = Projectile.velocity; } for (int num41 = 0; num41 < 2; num41++) { Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy(projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 1.5f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); + value8 = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 1.5f; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 0.6f; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; + Main.dust[num42].position = Projectile.Center + value8; + Main.dust[num42].velocity = Projectile.velocity; } } } - if (projectile.localAI[0] == createDustVar) + if (Projectile.localAI[0] == createDustVar) PlasmaBurst(1f, 1.6f); } @@ -101,16 +102,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void Kill(int timeLeft) { int height = 90; - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); - Main.PlaySound(SoundID.Item93, projectile.Center); + SoundEngine.PlaySound(SoundID.Item93, Projectile.Center); PlasmaBurst(1.8f, 3.6f); // 60 dusts @@ -125,7 +126,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (num640 < 100) num641 = 4f; - int num643 = Dust.NewDust(projectile.Center, 6, 6, Main.rand.Next(2) == 0 ? dust1 : dust2, 0f, 0f, 100, default, 1f); + int num643 = Dust.NewDust(Projectile.Center, 6, 6, Main.rand.Next(2) == 0 ? dust1 : dust2, 0f, 0f, 100, default, 1f); float num644 = Main.dust[num643].velocity.X; float num645 = Main.dust[num643].velocity.Y; @@ -174,21 +175,21 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num53 = 0; num53 < 40; num53++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.Next(2) == 0 ? dust1 : dust2; - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 3f; dust = Main.dust[num54]; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; @@ -202,13 +203,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num55 = 0; num55 < 20; num55++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.Next(2) == 0 ? dust1 : dust2; - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; diff --git a/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs b/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs index 9a6df6f5e5..ac7e89c828 100644 --- a/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs +++ b/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs @@ -2,6 +2,7 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -13,8 +14,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public override void SetStaticDefaults() @@ -24,28 +25,28 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 22; - projectile.height = 28; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.MaxUpdates = 2; - projectile.Calamity().rogue = true; + Projectile.width = 22; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.MaxUpdates = 2; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - Vector2 projectileTop = projectile.Center + new Vector2(0f, projectile.height * -0.5f).RotatedBy(projectile.rotation); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Vector2 projectileTop = Projectile.Center + new Vector2(0f, Projectile.height * -0.5f).RotatedBy(Projectile.rotation); if (Time > 10f) - projectile.velocity.Y += Gravity; + Projectile.velocity.Y += Gravity; if (!Main.dedServ) { Dust dust = Dust.NewDustPerfect(projectileTop, 107); - dust.velocity = projectile.rotation.ToRotationVector2().RotatedByRandom(0.35f) * Main.rand.NextFloat(2f, 4f); - dust.velocity += projectile.velocity * 0.25f; + dust.velocity = Projectile.rotation.ToRotationVector2().RotatedByRandom(0.35f) * Main.rand.NextFloat(2f, 4f); + dust.velocity += Projectile.velocity * 0.25f; dust.scale = Main.rand.NextFloat(0.95f, 1.3f); } Time++; @@ -53,19 +54,19 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void Kill(int timeLeft) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaGrenadeExplosion"), (int)projectile.position.X, (int)projectile.position.Y); - if (projectile.Calamity().stealthStrike) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaGrenadeExplosion"), (int)Projectile.position.X, (int)Projectile.position.Y); + if (Projectile.Calamity().stealthStrike) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack * 2f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 2f, Projectile.owner); } if (!Main.dedServ) { for (int i = 0; i < 220; i++) { int type = Main.rand.NextBool(2) ? 261 : 107; - Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(10f, 10f), type); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10f, 10f), type); dust.scale = Main.rand.NextFloat(1.6f, 2.2f); dust.velocity = Main.rand.NextVector2CircularEdge(75f, 75f); dust.noGravity = true; @@ -78,17 +79,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } else { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 360); - if (Main.myPlayer == projectile.owner) + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 360); + if (Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } if (!Main.dedServ) { for (int i = 0; i < 120; i++) { int type = Main.rand.NextBool(3) ? 261 : (int)CalamityDusts.SulfurousSeaAcid; - Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(10f, 10f), type); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10f, 10f), type); dust.scale = Main.rand.NextFloat(1.3f, 1.5f); dust.velocity = Main.rand.NextVector2CircularEdge(15f, 15f); dust.noGravity = true; diff --git a/Projectiles/DraedonsArsenal/PlasmaGrenadeSmallExplosion.cs b/Projectiles/DraedonsArsenal/PlasmaGrenadeSmallExplosion.cs index 3fb89e59ee..da94e48c9b 100644 --- a/Projectiles/DraedonsArsenal/PlasmaGrenadeSmallExplosion.cs +++ b/Projectiles/DraedonsArsenal/PlasmaGrenadeSmallExplosion.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public int frameX = 0; @@ -27,19 +27,19 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = projectile.height = 279; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.width = Projectile.height = 279; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter % frameLength == frameLength - 1) + Projectile.frameCounter++; + if (Projectile.frameCounter % frameLength == frameLength - 1) { frameY++; if (frameY >= verticalFrames) @@ -49,22 +49,22 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } if (frameX >= horizontalFrames) { - projectile.Kill(); + Projectile.Kill(); } } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; int length = texture.Width / horizontalFrames; int height = texture.Height / verticalFrames; - Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Rectangle frame = new Rectangle(frameX * length, frameY * height, length, height); Vector2 origin = new Vector2(length / 2f, height / 2f); - spriteBatch.Draw(texture, drawPos, frame, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, drawPos, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs index c98eb5018a..a627b6d131 100644 --- a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs +++ b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs @@ -13,48 +13,48 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public const float MaximumRepulsionSpeed = 13f; public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public bool North { - get => projectile.ai[1] == 1f; - set => projectile.ai[1] = value.ToInt(); + get => Projectile.ai[1] == 1f; + set => Projectile.ai[1] = value.ToInt(); } public override void SetStaticDefaults() { DisplayName.SetDefault("Pole Warper"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; } public override void SetDefaults() { - projectile.width = projectile.height = 22; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 12; + Projectile.width = Projectile.height = 22; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 0.5f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; } public override void AI() { - Player player = Main.player[projectile.owner]; - if (projectile.localAI[0] == 0f) + Player player = Main.player[Projectile.owner]; + if (Projectile.localAI[0] == 0f) { Initialize(player); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } GrantBuffs(player); - NPC potentialTarget = projectile.Center.MinionHoming(1400f, player); + NPC potentialTarget = Projectile.Center.MinionHoming(1400f, player); if (potentialTarget is null) { PlayerMovement(player); @@ -73,13 +73,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public void Initialize(Player player) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 45; i++) { float angle = MathHelper.TwoPi / 45f * i; Vector2 velocity = angle.ToRotationVector2() * 4f; - Dust dust = Dust.NewDustPerfect(projectile.Center + velocity * 2.75f, 261, velocity); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velocity * 2.75f, 261, velocity); dust.noGravity = true; } } @@ -87,18 +87,18 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // While this projectile cannot attack, the projectiles it shoots derive from the damage. public void AdjustDamage(Player player) { - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } } public void GrantBuffs(Player player) { - bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isCorrectProjectile) { @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } if (player.Calamity().poleWarper) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } } @@ -116,18 +116,18 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public void PlayerMovement(Player player) { Vector2 destination = player.Center + Vector2.UnitY.RotatedBy(Time / 16f + AngularOffset + (!North).ToInt() * MathHelper.Pi) * 180f; - projectile.velocity = (projectile.velocity * 4f + projectile.SafeDirectionTo(destination) * 10f) / 5f; - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * 10f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity = (Projectile.velocity * 4f + Projectile.SafeDirectionTo(destination) * 10f) / 5f; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 10f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public void NPCMovement(NPC npc) { for (int i = 0; i < Main.projectile.Length; i++) { - if (Main.projectile[i].type == projectile.type && + if (Main.projectile[i].type == Projectile.type && Main.projectile[i].active && - projectile.owner == projectile.owner) + Projectile.owner == Projectile.owner) { PoleWarperSummon otherPole = (PoleWarperSummon)Main.projectile[i].modProjectile; if (otherPole.Time != Time && otherPole.Time != Time + 1) @@ -140,19 +140,19 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float offsetAngle = AngularOffset * 0.5f + (!North).ToInt() * MathHelper.Pi; Vector2 destination = npc.Center + Vector2.UnitY.RotatedBy(offsetAngle) * 180f; - projectile.velocity = (projectile.velocity * 4f + projectile.SafeDirectionTo(destination) * 10f) / 5f; - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * 25f; - projectile.rotation = projectile.AngleTo(npc.Center) + MathHelper.PiOver2; + Projectile.velocity = (Projectile.velocity * 4f + Projectile.SafeDirectionTo(destination) * 10f) / 5f; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 25f; + Projectile.rotation = Projectile.AngleTo(npc.Center) + MathHelper.PiOver2; } else if (Time % 60f < 35f) { - projectile.velocity *= 0.96f; - projectile.rotation += 0.05f; + Projectile.velocity *= 0.96f; + Projectile.rotation += 0.05f; } else if (Time % 60f == 35f) { - projectile.velocity = projectile.SafeDirectionTo(npc.Center, -Vector2.UnitY) * 29f; - projectile.rotation = projectile.AngleTo(npc.Center) + MathHelper.PiOver2; + Projectile.velocity = Projectile.SafeDirectionTo(npc.Center, -Vector2.UnitY) * 29f; + Projectile.rotation = Projectile.AngleTo(npc.Center) + MathHelper.PiOver2; } } @@ -161,20 +161,20 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // This does not incorporate attraction on purpose. Doing so causes the minions to very easily become distracted. for (int i = 0; i < Main.projectile.Length; i++) { - if (Main.projectile[i].type == projectile.type && + if (Main.projectile[i].type == Projectile.type && Main.projectile[i].active && - projectile.Distance(Main.projectile[i].Center) < 40f) + Projectile.Distance(Main.projectile[i].Center) < 40f) { PoleWarperSummon otherPole = (PoleWarperSummon)Main.projectile[i].modProjectile; if (otherPole.North != North) { - float distanceFromOtherPole = projectile.Distance(Main.projectile[i].Center) + 1f; + float distanceFromOtherPole = Projectile.Distance(Main.projectile[i].Center) + 1f; if (float.IsNaN(distanceFromOtherPole) || distanceFromOtherPole < 1f) { distanceFromOtherPole = 1f; } float repulsionSpeed = MaximumRepulsionSpeed * (float)Math.Pow(3f, -distanceFromOtherPole / 27f); - projectile.velocity -= (Main.projectile[i].Center - projectile.Center).SafeNormalize(Vector2.UnitY) * repulsionSpeed; + Projectile.velocity -= (Main.projectile[i].Center - Projectile.Center).SafeNormalize(Vector2.UnitY) * repulsionSpeed; } } } @@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, 1, lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, 1, lightColor, 2); return false; } } diff --git a/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs b/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs index d6e4f5e8ba..2f12ef9ab0 100644 --- a/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs +++ b/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public bool ReelingBack { - get => projectile.timeLeft <= ReelbackTime; + get => Projectile.timeLeft <= ReelbackTime; set { if (value) - projectile.timeLeft = ReelbackTime; + Projectile.timeLeft = ReelbackTime; } } - public Player Owner => Main.player[projectile.owner]; - public float Outwardness => OutwardnessMax * (float)Math.Sin(projectile.timeLeft / (float)Lifetime * MathHelper.Pi); - public ref float InitialRotation => ref projectile.ai[0]; - public ref float OutwardnessMax => ref projectile.ai[1]; - public ref float SwingDirection => ref projectile.localAI[0]; + public Player Owner => Main.player[Projectile.owner]; + public float Outwardness => OutwardnessMax * (float)Math.Sin(Projectile.timeLeft / (float)Lifetime * MathHelper.Pi); + public ref float InitialRotation => ref Projectile.ai[0]; + public ref float OutwardnessMax => ref Projectile.ai[1]; + public ref float SwingDirection => ref Projectile.localAI[0]; public const int ChargeTime = 25; public const int ReelbackTime = 25; public const int Lifetime = ChargeTime + ReelbackTime; @@ -37,17 +37,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.timeLeft = Lifetime; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.tileCollide = false; - projectile.extraUpdates = 1; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = Lifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; } public override void SendExtraAI(BinaryWriter writer) @@ -62,42 +62,42 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { - projectile.rotation = projectile.AngleTo(Owner.Center) - MathHelper.PiOver2; + Projectile.rotation = Projectile.AngleTo(Owner.Center) - MathHelper.PiOver2; if (Owner.dead) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.direction = (Owner.Center.X - projectile.Center.X > 0).ToDirectionInt(); - projectile.spriteDirection = projectile.direction; + Projectile.direction = (Owner.Center.X - Projectile.Center.X > 0).ToDirectionInt(); + Projectile.spriteDirection = Projectile.direction; ManipulateOwnerFields(); - if (projectile.timeLeft >= Lifetime - ChargeTime) + if (Projectile.timeLeft >= Lifetime - ChargeTime) { - float time = Utils.InverseLerp(Lifetime, Lifetime - ChargeTime, projectile.timeLeft, true); + float time = Utils.InverseLerp(Lifetime, Lifetime - ChargeTime, Projectile.timeLeft, true); float offsetAngle = MathHelper.Lerp(-1.1f, 1.5f, time); // Set the range of the offset to -1.8 and 1.8 based off of the time. - offsetAngle *= projectile.localAI[0]; // Incorporate direction into the offset angle. + offsetAngle *= Projectile.localAI[0]; // Incorporate direction into the offset angle. - projectile.velocity = InitialRotation.ToRotationVector2().RotatedBy(offsetAngle) * 29f; + Projectile.velocity = InitialRotation.ToRotationVector2().RotatedBy(offsetAngle) * 29f; // Adjust the velocity to go along with the player's if the velocity directions are similar so that the player's movement doesn't hinder the projectile's movement. - if (Vector2.Dot(projectile.velocity.SafeNormalize(Vector2.Zero), Owner.velocity.SafeNormalize(Vector2.Zero)) > 0.45f) + if (Vector2.Dot(Projectile.velocity.SafeNormalize(Vector2.Zero), Owner.velocity.SafeNormalize(Vector2.Zero)) > 0.45f) { - projectile.velocity += Owner.velocity; + Projectile.velocity += Owner.velocity; } } else { - projectile.velocity = projectile.SafeDirectionTo(Owner.Center, Vector2.UnitX * Owner.direction) * 43f; - projectile.timeLeft = ReelbackTime; - if (projectile.WithinRange(Owner.Center, 45f)) - projectile.Kill(); + Projectile.velocity = Projectile.SafeDirectionTo(Owner.Center, Vector2.UnitX * Owner.direction) * 43f; + Projectile.timeLeft = ReelbackTime; + if (Projectile.WithinRange(Owner.Center, 45f)) + Projectile.Kill(); } GenerateIdleDust(); - if (projectile.timeLeft % 3 == 2 && projectile.Distance(Owner.Center) > 40f) + if (Projectile.timeLeft % 3 == 2 && Projectile.Distance(Owner.Center) > 40f) SpawnElectricFields(); } @@ -105,8 +105,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { Owner.itemAnimation = 4; Owner.itemTime = 4; - Owner.ChangeDir(-projectile.direction); - Owner.itemRotation = projectile.rotation + (projectile.spriteDirection == -1).ToInt() * MathHelper.TwoPi; + Owner.ChangeDir(-Projectile.direction); + Owner.itemRotation = Projectile.rotation + (Projectile.spriteDirection == -1).ToInt() * MathHelper.TwoPi; } public void GenerateIdleDust() @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal return; for (int i = 0; i < 4; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(52f, 52f), 261); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(52f, 52f), 261); dust.velocity = Vector2.Zero; dust.noGravity = true; } @@ -123,9 +123,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public void SpawnElectricFields() { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - Projectile field = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ProjectileID.Electrosphere, projectile.damage, projectile.knockBack, projectile.owner); + Projectile field = Projectile.NewProjectileDirect(Projectile.Center, Vector2.Zero, ProjectileID.Electrosphere, Projectile.damage, Projectile.knockBack, Projectile.owner); if (field.whoAmI.WithinBounds(Main.maxProjectiles)) { field.Calamity().forceMelee = true; @@ -137,13 +137,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Player player = Main.player[projectile.owner]; - Texture2D chainTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Chains/PulseDragonChain"); - Texture2D pulseTexture = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PulseAura"); - Texture2D dragonHeadTexture = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PulseDragonProjectile"); + Player player = Main.player[Projectile.owner]; + Texture2D chainTexture = ModContent.Request("CalamityMod/ExtraTextures/Chains/PulseDragonChain"); + Texture2D pulseTexture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PulseAura"); + Texture2D dragonHeadTexture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PulseDragonProjectile"); if (ReelingBack) - dragonHeadTexture = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PulseDragonHeadClosed"); - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + dragonHeadTexture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PulseDragonHeadClosed"); + Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; // Chain drawing. List bezierPoints = new List() @@ -154,20 +154,20 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { Vector2 offset = Vector2.UnitX * -SwingDirection; offset *= Outwardness * (float)Math.Sin(i / 20f * MathHelper.Pi); - offset *= Utils.InverseLerp(0f, 300f, Owner.Distance(Vector2.Lerp(mountedCenter, projectile.Center, i / 20f) + offset), true); - bezierPoints.Add(Vector2.Lerp(mountedCenter, projectile.Center, i / 20f) + offset); + offset *= Utils.InverseLerp(0f, 300f, Owner.Distance(Vector2.Lerp(mountedCenter, Projectile.Center, i / 20f) + offset), true); + bezierPoints.Add(Vector2.Lerp(mountedCenter, Projectile.Center, i / 20f) + offset); } - bezierPoints.Add(projectile.Center); + bezierPoints.Add(Projectile.Center); BezierCurve bezierCurve = new BezierCurve(bezierPoints.ToArray()); - int totalChains = (int)(projectile.Distance(mountedCenter) / chainTexture.Height); + int totalChains = (int)(Projectile.Distance(mountedCenter) / chainTexture.Height); totalChains = (int)MathHelper.Clamp(totalChains, 40f, 1000f); for (int i = 0; i < totalChains - 1; i++) { Vector2 drawPosition = bezierCurve.Evaluate(i / (float)totalChains); float angle = (bezierCurve.Evaluate(i / (float)totalChains + 1f / totalChains) - drawPosition).ToRotation(); angle -= MathHelper.PiOver2; - spriteBatch.Draw(chainTexture, drawPosition - Main.screenPosition, null, lightColor, angle, chainTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(chainTexture, drawPosition - Main.screenPosition, null, lightColor, angle, chainTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); } // Aura drawing. @@ -177,12 +177,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float time = (float)Math.Sin(Main.GlobalTime * 1.8f); float angle = time * MathHelper.Pi + Main.GlobalTime * 2.1f; float scale = 1.1f + time * 0.2f; - spriteBatch.Draw(pulseTexture, projectile.Center + offset - Main.screenPosition, null, Color.Cyan * 0.3f, angle, pulseTexture.Size() * 0.5f, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(pulseTexture, Projectile.Center + offset - Main.screenPosition, null, Color.Cyan * 0.3f, angle, pulseTexture.Size() * 0.5f, scale, SpriteEffects.None, 0f); } // Head drawing. - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - spriteBatch.Draw(dragonHeadTexture, projectile.Center - Main.screenPosition, null, lightColor, projectile.rotation, dragonHeadTexture.Size() * 0.5f, projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + spriteBatch.Draw(dragonHeadTexture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, dragonHeadTexture.Size() * 0.5f, Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/DraedonsArsenal/PulsePistolShot.cs b/Projectiles/DraedonsArsenal/PulsePistolShot.cs index 364e0c0084..60d897fa51 100644 --- a/Projectiles/DraedonsArsenal/PulsePistolShot.cs +++ b/Projectiles/DraedonsArsenal/PulsePistolShot.cs @@ -13,31 +13,31 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public NPC Target { - get => Main.npc[(int)projectile.ai[0]]; - set => projectile.ai[0] = value.whoAmI; + get => Main.npc[(int)Projectile.ai[0]]; + set => Projectile.ai[0] = value.whoAmI; } public float Time { - get => projectile.ai[1]; - set => projectile.ai[1] = value; + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; } public List NPCsAlreadyHit = new List(); public override void SetStaticDefaults() { DisplayName.SetDefault("Pulse Bolt"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 10; - projectile.timeLeft = 120 * (1 + projectile.extraUpdates); + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.extraUpdates = 10; + Projectile.timeLeft = 120 * (1 + Projectile.extraUpdates); } public override void AI() @@ -47,13 +47,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { if (NPCsAlreadyHit.Count > 0) { - float angleOffset = MathHelper.WrapAngle(projectile.AngleTo(Target.Center) - projectile.velocity.ToRotation()); + float angleOffset = MathHelper.WrapAngle(Projectile.AngleTo(Target.Center) - Projectile.velocity.ToRotation()); angleOffset = MathHelper.Clamp(angleOffset, -0.2f, 0.2f); - projectile.velocity = projectile.velocity.RotatedBy(angleOffset); + Projectile.velocity = Projectile.velocity.RotatedBy(angleOffset); } float radiusFactor = MathHelper.Lerp(0f, 1f, Utils.InverseLerp(10f, 50f, Time, true)); - Dust dust = Dust.NewDustPerfect(projectile.Center, 234); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 234); dust.noGravity = true; dust.velocity = Vector2.Zero; dust.scale = 1.6f; @@ -63,28 +63,28 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { for (int i = 0; i < 5; i++) { - float offsetRotationAngle = projectile.velocity.ToRotation() + Time / 20f; + float offsetRotationAngle = Projectile.velocity.ToRotation() + Time / 20f; float radius = (14f + (float)Math.Cos(Time / 13f) * 6f) * radiusFactor; - Vector2 dustPosition = projectile.Center; + Vector2 dustPosition = Projectile.Center; dustPosition += offsetRotationAngle.ToRotationVector2().RotatedBy(i / 5f * MathHelper.TwoPi) * radius; dust = Dust.NewDustPerfect(dustPosition, Main.rand.NextBool(3) ? 234 : 173); dust.noGravity = true; - dust.velocity = -projectile.velocity; + dust.velocity = -Projectile.velocity; dust.scale = 0.8f; } } } } - public override bool CanDamage() => Time > projectile.MaxUpdates; + public override bool CanDamage() => Time > Projectile.MaxUpdates; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (!NPCsAlreadyHit.Contains(target)) NPCsAlreadyHit.Add(target); // If the maximum amount of targets have already been hit, die early. - if (projectile.frameCounter >= 4) + if (Projectile.frameCounter >= 4) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int i = 0; i < Main.npc.Length; i++) { bool legalTarget = Main.npc[i] != target && Main.npc[i].active && Main.npc[i].CanBeChasedBy(null); - float distanceToTarget = projectile.Distance(Main.npc[i].Center); + float distanceToTarget = Projectile.Distance(Main.npc[i].Center); if (legalTarget && distanceToTarget < minDistance && !NPCsAlreadyHit.Contains(Main.npc[i])) { minDistance = distanceToTarget; @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (potentialTargets.Count == 0) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -113,17 +113,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal NPC toHit = potentialTargets[Main.rand.Next(0, maxIndex)]; // A netcode block such as Main.myPlayer == projectile.owner is not required. OnHitNPC is only run client-side. - Projectile splitShot = Projectile.NewProjectileDirect(projectile.Center, - projectile.velocity, - projectile.type, - projectile.damage, - projectile.knockBack, - projectile.owner, + Projectile splitShot = Projectile.NewProjectileDirect(Projectile.Center, + Projectile.velocity, + Projectile.type, + Projectile.damage, + Projectile.knockBack, + Projectile.owner, toHit.whoAmI); - splitShot.frameCounter = projectile.frameCounter + 1; + splitShot.frameCounter = Projectile.frameCounter + 1; ((PulsePistolShot)splitShot.modProjectile).NPCsAlreadyHit.AddRange(NPCsAlreadyHit); ((PulsePistolShot)splitShot.modProjectile).NPCsAlreadyHit.Add(toHit); - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/DraedonsArsenal/PulseRifleShot.cs b/Projectiles/DraedonsArsenal/PulseRifleShot.cs index e95be8bafd..959b0e35f2 100644 --- a/Projectiles/DraedonsArsenal/PulseRifleShot.cs +++ b/Projectiles/DraedonsArsenal/PulseRifleShot.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -22,29 +23,29 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 300; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 300; } public override void AI() { - bool notSplitProjectile = projectile.ai[1] == 0f; + bool notSplitProjectile = Projectile.ai[1] == 0f; - Lighting.AddLight(projectile.Center, 0.3f, 0f, 0.5f); + Lighting.AddLight(Projectile.Center, 0.3f, 0f, 0.5f); float createDustVar = 10f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > createDustVar) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > createDustVar) { for (int num447 = 0; num447 < 2; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * (num447 * 0.25f); + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * (num447 * 0.25f); int num448 = Dust.NewDust(vector33, 1, 1, dust1, 0f, 0f, 0, default, 1f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; @@ -64,49 +65,49 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num41 = 0; num41 < 2; num41++) { value8 = -Vector2.UnitY.RotatedBy(24f * 0.1308997f + 0f * MathHelper.Pi) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); + int num42 = Dust.NewDust(Projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 1.5f; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].position = Projectile.Center + value8; } for (int num41 = 0; num41 < 2; num41++) { value8 = -Vector2.UnitY.RotatedBy(24f * 0.1308997f + 1f * MathHelper.Pi) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); + int num42 = Dust.NewDust(Projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 1.5f; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].position = Projectile.Center + value8; } } } - if (projectile.localAI[0] == createDustVar && notSplitProjectile) + if (Projectile.localAI[0] == createDustVar && notSplitProjectile) PulseBurst(4f, 5f); } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 280 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 280 && target.CanBeChasedBy(Projectile); public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (projectile.ai[1] < 5f && !hasHit && Main.myPlayer == projectile.owner) + if (Projectile.ai[1] < 5f && !hasHit && Main.myPlayer == Projectile.owner) { hasHit = true; int alreadyTargetedNPCType = 0; - if (projectile.ai[1] > 0f) - alreadyTargetedNPCType = (int)projectile.ai[0]; + if (Projectile.ai[1] > 0f) + alreadyTargetedNPCType = (int)Projectile.ai[0]; else alreadyTargetedNPCType = target.whoAmI; for (int i = 0; i < Main.maxNPCs; i++) { - if (!Main.npc[i].CanBeChasedBy(projectile, false) || !Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + if (!Main.npc[i].CanBeChasedBy(Projectile, false) || !Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) continue; - if (alreadyTargetedNPCType != Main.npc[i].whoAmI && projectile.Center.ManhattanDistance(Main.npc[i].Center) < 600f) + if (alreadyTargetedNPCType != Main.npc[i].whoAmI && Projectile.Center.ManhattanDistance(Main.npc[i].Center) < 600f) { - Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(Main.npc[i].Center) * 5f, projectile.type, projectile.damage / 2, 0f, projectile.owner, Main.npc[i].whoAmI, projectile.ai[1] + 1f); + Projectile.NewProjectile(Projectile.Center, Projectile.SafeDirectionTo(Main.npc[i].Center) * 5f, Projectile.type, Projectile.damage / 2, 0f, Projectile.owner, Main.npc[i].whoAmI, Projectile.ai[1] + 1f); break; } } @@ -115,7 +116,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void Kill(int timeLeft) { - int timesSplit = (int)projectile.ai[1]; + int timesSplit = (int)Projectile.ai[1]; int height = 40; int totalDust = 400; @@ -151,16 +152,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal break; } - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); - Main.PlaySound(SoundID.Item93, projectile.Center); + SoundEngine.PlaySound(SoundID.Item93, Projectile.Center); int fourth = totalDust / 4; int half = totalDust / 2; @@ -180,7 +181,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dustType = dust3; } - int num650 = Dust.NewDust(projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, 1f); + int num650 = Dust.NewDust(Projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, 1f); float num651 = Main.dust[num650].velocity.X; float num652 = Main.dust[num650].velocity.Y; if (num651 == 0f && num652 == 0f) @@ -222,20 +223,20 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num53 = 0; num53 < 50; num53++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust3, dustVel.X, dustVel.Y, 200, default, 1.7f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust3, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 3f; dust = Main.dust[num54]; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust1, dustVel.X, dustVel.Y, 100, default, 1f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust1, dustVel.X, dustVel.Y, 100, default, 1f); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; @@ -249,12 +250,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num55 = 0; num55 < 25; num55++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust2, dustVel.X, dustVel.Y, 0, default, 3f); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dust2, dustVel.X, dustVel.Y, 0, default, 3f); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; diff --git a/Projectiles/DraedonsArsenal/PulseTurret.cs b/Projectiles/DraedonsArsenal/PulseTurret.cs index f4f5c18479..96a33a8815 100644 --- a/Projectiles/DraedonsArsenal/PulseTurret.cs +++ b/Projectiles/DraedonsArsenal/PulseTurret.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { public class PulseTurret : ModProjectile @@ -11,91 +12,91 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Pulse Turret"); - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 24; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; + Projectile.width = 50; + Projectile.height = 24; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.sentry = true; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.penetrate = -1; } public override void AI() { - Player player = Main.player[projectile.owner]; - if (projectile.localAI[0] == 0f) + Player player = Main.player[Projectile.owner]; + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - if (projectile.velocity.Y < 12f) + if (Projectile.velocity.Y < 12f) { - projectile.velocity.Y += 0.5f; + Projectile.velocity.Y += 0.5f; } - NPC potentialTarget = projectile.Center.MinionHoming(850f, player, false); + NPC potentialTarget = Projectile.Center.MinionHoming(850f, player, false); if (potentialTarget != null) { - projectile.spriteDirection = (potentialTarget.Center.X - projectile.Center.X > 0).ToDirectionInt(); - projectile.ai[0]++; - if (projectile.ai[0] % 40f < 30f) + Projectile.spriteDirection = (potentialTarget.Center.X - Projectile.Center.X > 0).ToDirectionInt(); + Projectile.ai[0]++; + if (Projectile.ai[0] % 40f < 30f) { - float idealAngle = projectile.AngleTo(potentialTarget.Center) + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; - if (projectile.ai[1] <= 0f) + float idealAngle = Projectile.AngleTo(potentialTarget.Center) + (Projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + if (Projectile.ai[1] <= 0f) { - projectile.rotation = projectile.rotation.AngleLerp(idealAngle, MathHelper.TwoPi / 25f); + Projectile.rotation = Projectile.rotation.AngleLerp(idealAngle, MathHelper.TwoPi / 25f); } // Recoil back after firing else { - if (projectile.ai[1] > 13f) + if (Projectile.ai[1] > 13f) { - projectile.rotation -= MathHelper.ToRadians(10f) * projectile.localAI[0]; + Projectile.rotation -= MathHelper.ToRadians(10f) * Projectile.localAI[0]; } - projectile.ai[1]--; + Projectile.ai[1]--; } } - if (projectile.ai[0] % 40f == 39f && Main.myPlayer == projectile.owner) + if (Projectile.ai[0] % 40f == 39f && Main.myPlayer == Projectile.owner) { - Texture2D standTexture = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PulseTurretStand"); - Vector2 shootPosition = projectile.Center - ((standTexture.Height / 2 + 6f) * Vector2.UnitY); - shootPosition += (projectile.Size * 0.5f).RotatedBy(projectile.rotation - MathHelper.ToRadians(18f) - (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi); + Texture2D standTexture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PulseTurretStand"); + Vector2 shootPosition = Projectile.Center - ((standTexture.Height / 2 + 6f) * Vector2.UnitY); + shootPosition += (Projectile.Size * 0.5f).RotatedBy(Projectile.rotation - MathHelper.ToRadians(18f) - (Projectile.spriteDirection == -1).ToInt() * MathHelper.Pi); - bool aimingAtTarget = Math.Abs(Vector2.Normalize(potentialTarget.Center - shootPosition).ToRotation() - projectile.rotation) < MathHelper.ToRadians(32f) + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; - if (aimingAtTarget || projectile.Distance(potentialTarget.Center) < 45f) + bool aimingAtTarget = Math.Abs(Vector2.Normalize(potentialTarget.Center - shootPosition).ToRotation() - Projectile.rotation) < MathHelper.ToRadians(32f) + (Projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + if (aimingAtTarget || Projectile.Distance(potentialTarget.Center) < 45f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PulseRifleFire"), shootPosition); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PulseRifleFire"), shootPosition); Projectile.NewProjectile(shootPosition, Vector2.Normalize(potentialTarget.Center - shootPosition) * 12f, ModContent.ProjectileType(), - projectile.damage, - projectile.knockBack, - projectile.owner); - if (projectile.ai[0] % 120f == 119f) + Projectile.damage, + Projectile.knockBack, + Projectile.owner); + if (Projectile.ai[0] % 120f == 119f) { for (int i = -1; i <= 1; i += 2) { Projectile.NewProjectile(shootPosition, (potentialTarget.Center - shootPosition).SafeNormalize(Vector2.UnitY).RotatedBy(i * MathHelper.ToRadians(28f)) * 7f, ModContent.ProjectileType(), - projectile.damage, - projectile.knockBack, - projectile.owner, + Projectile.damage, + Projectile.knockBack, + Projectile.owner, 0f, 1f); } @@ -107,38 +108,38 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Dust.NewDustPerfect(shootPosition, 173).scale = Main.rand.NextFloat(1.4f, 1.8f); } - projectile.ai[1] = 15f; - projectile.localAI[0] = Math.Sign(projectile.SafeDirectionTo(potentialTarget.Center).X); + Projectile.ai[1] = 15f; + Projectile.localAI[0] = Math.Sign(Projectile.SafeDirectionTo(potentialTarget.Center).X); } } } else { - projectile.rotation = projectile.rotation.AngleLerp(0f, MathHelper.TwoPi / 50f); + Projectile.rotation = Projectile.rotation.AngleLerp(0f, MathHelper.TwoPi / 50f); } - projectile.StickToTiles(false, false); + Projectile.StickToTiles(false, false); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D standTexture = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PulseTurretStand"); - spriteBatch.Draw(ModContent.GetTexture(Texture), - projectile.Center - ((standTexture.Height / 2 + 6f) * Vector2.UnitY) - Main.screenPosition, + Texture2D standTexture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PulseTurretStand"); + spriteBatch.Draw(ModContent.Request(Texture), + Projectile.Center - ((standTexture.Height / 2 + 6f) * Vector2.UnitY) - Main.screenPosition, null, lightColor, - projectile.rotation, - projectile.Size * 0.5f, - projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.rotation, + Projectile.Size * 0.5f, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); spriteBatch.Draw(standTexture, - projectile.Center - Main.screenPosition, + Projectile.Center - Main.screenPosition, null, lightColor, 0f, standTexture.Size() * 0.5f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); return false; diff --git a/Projectiles/DraedonsArsenal/PulseTurretShot.cs b/Projectiles/DraedonsArsenal/PulseTurretShot.cs index 406f265631..f3a2830389 100644 --- a/Projectiles/DraedonsArsenal/PulseTurretShot.cs +++ b/Projectiles/DraedonsArsenal/PulseTurretShot.cs @@ -15,43 +15,43 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Pulse Bolt"); - ProjectileID.Sets.SentryShot[projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.minion = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; } public override void AI() { - projectile.ai[0] += MathHelper.ToRadians(6f); + Projectile.ai[0] += MathHelper.ToRadians(6f); if (!Main.dedServ) { for (int i = 0; i < 3; i++) { - float angle = projectile.velocity.ToRotation() + MathHelper.PiOver2; - float pulse = (float)Math.Sin(projectile.ai[0] + MathHelper.TwoPi / 3f * i); + float angle = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + float pulse = (float)Math.Sin(Projectile.ai[0] + MathHelper.TwoPi / 3f * i); Vector2 offset = angle.ToRotationVector2().RotatedBy(MathHelper.TwoPi / 3f * i) * pulse * 7f; - Dust.NewDustPerfect(projectile.Center + offset, 234, Vector2.Zero).noGravity = true; - Dust.NewDustPerfect(projectile.Center - offset, 234, Vector2.Zero).noGravity = true; + Dust.NewDustPerfect(Projectile.Center + offset, 234, Vector2.Zero).noGravity = true; + Dust.NewDustPerfect(Projectile.Center - offset, 234, Vector2.Zero).noGravity = true; } } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - NPC potentialTarget = projectile.Center.MinionHoming(850f, Main.player[projectile.owner], false); + NPC potentialTarget = Projectile.Center.MinionHoming(850f, Main.player[Projectile.owner], false); if (potentialTarget != null) { - float speed = projectile.velocity.Length(); - float inertia = MathHelper.Lerp(18f, 6f, 1f - projectile.timeLeft / 300f); - projectile.velocity = (projectile.velocity * inertia + projectile.SafeDirectionTo(potentialTarget.Center) * speed) / (inertia + 1f); - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX) * speed; + float speed = Projectile.velocity.Length(); + float inertia = MathHelper.Lerp(18f, 6f, 1f - Projectile.timeLeft / 300f); + Projectile.velocity = (Projectile.velocity * inertia + Projectile.SafeDirectionTo(potentialTarget.Center) * speed) / (inertia + 1f); + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * speed; } } } @@ -66,17 +66,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { for (int j = 0; j < SpiralRings; j++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + + Dust dust = Dust.NewDustPerfect(Projectile.Center + Vector2.UnitY.RotatedBy(j / (float)SpiralRings * MathHelper.TwoPi * direction).RotatedBy(i / (float)SpiralPrecision * MathHelper.TwoPi / SpiralRings * direction) * 36f * i / SpiralPrecision, 173); - dust.velocity = projectile.SafeDirectionTo(dust.position) * 2.4f; + dust.velocity = Projectile.SafeDirectionTo(dust.position) * 2.4f; dust.scale = 1.6f; dust.noGravity = true; - dust = Dust.NewDustPerfect(projectile.Center + + dust = Dust.NewDustPerfect(Projectile.Center + Vector2.UnitY.RotatedBy(j / (float)SpiralRings * MathHelper.TwoPi * direction).RotatedBy(i / (float)SpiralPrecision * MathHelper.TwoPi / SpiralRings * direction) * 36f * i / SpiralPrecision, 173); - dust.velocity = projectile.DirectionFrom(dust.position) * 4f; + dust.velocity = Projectile.DirectionFrom(dust.position) * 4f; dust.scale = 1.6f; dust.noGravity = true; } diff --git a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs index 5bb09a39f8..8c254af3bd 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public float EyeOutwardness = 1f; @@ -26,23 +26,23 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Snake Eyes"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = projectile.height = 22; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 22; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 1; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; } public override void SendExtraAI(BinaryWriter writer) @@ -64,43 +64,43 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { - Player player = Main.player[projectile.owner]; - if (projectile.localAI[0] == 0f) + Player player = Main.player[Projectile.owner]; + if (Projectile.localAI[0] == 0f) { Initialize(player); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } AdjustDamage(player); GrantBuffs(player); - NPC potentialTarget = projectile.Center.MinionHoming(820f, player); + NPC potentialTarget = Projectile.Center.MinionHoming(820f, player); if (potentialTarget == null || SufferingFromSeparationAnxiety) { - projectile.ai[1] = 0f; - if (projectile.localAI[1] == 1f) + Projectile.ai[1] = 0f; + if (Projectile.localAI[1] == 1f) { Time = 0f; - projectile.localAI[1] = 0f; + Projectile.localAI[1] = 0f; } PlayerMovement(player); } else { - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { Time = 0f; - projectile.localAI[1] = 1f; + Projectile.localAI[1] = 1f; } NPCMovement(potentialTarget); } - if (!SufferingFromSeparationAnxiety && projectile.Distance(player.Center) > (potentialTarget is null ? 360f : 1800f)) + if (!SufferingFromSeparationAnxiety && Projectile.Distance(player.Center) > (potentialTarget is null ? 360f : 1800f)) { SufferingFromSeparationAnxiety = true; - projectile.netUpdate = true; + Projectile.netUpdate = true; } - else if (SufferingFromSeparationAnxiety && projectile.Distance(player.Center) < (potentialTarget is null ? 10f : 120f)) + else if (SufferingFromSeparationAnxiety && Projectile.Distance(player.Center) < (potentialTarget is null ? 10f : 120f)) { SufferingFromSeparationAnxiety = false; - projectile.netUpdate = true; + Projectile.netUpdate = true; } if (!Main.dedServ) { @@ -111,14 +111,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public void Initialize(Player player) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - Destination = projectile.Center - Vector2.UnitY * 180f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Destination = Projectile.Center - Vector2.UnitY * 180f; for (int i = 0; i < 45; i++) { float angle = MathHelper.TwoPi / 45f * i; Vector2 velocity = angle.ToRotationVector2() * 4f; - Dust dust = Dust.NewDustPerfect(projectile.Center + velocity * 2.75f, 39, velocity); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velocity * 2.75f, 39, velocity); dust.noGravity = true; } } @@ -126,18 +126,18 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // While this projectile cannot attack, the projectiles it shoots derive from the damage. public void AdjustDamage(Player player) { - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } } public void GrantBuffs(Player player) { - bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isCorrectProjectile) { @@ -147,42 +147,42 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } if (player.Calamity().snakeEyes) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } } public void PlayerMovement(Player player) { - projectile.velocity = Vector2.Zero; + Projectile.velocity = Vector2.Zero; if (!SufferingFromSeparationAnxiety) { - projectile.Center = player.Center - Vector2.UnitY * (80f + (float)Math.Sin(Time / 120f * MathHelper.TwoPi) * 30f); + Projectile.Center = player.Center - Vector2.UnitY * (80f + (float)Math.Sin(Time / 120f * MathHelper.TwoPi) * 30f); EyeOutwardness = MathHelper.Lerp(EyeOutwardness, 0f, 0.15f); return; } if (Time % 150f == 0f) { - OldCenter = projectile.Center; + OldCenter = Projectile.Center; } else if (Time % 150f <= 35f) { - EyeRotation = projectile.AngleTo(player.Center); + EyeRotation = Projectile.AngleTo(player.Center); EyeOutwardness = MathHelper.Lerp(EyeOutwardness, 1f, 0.15f); - projectile.Center = Vector2.SmoothStep(OldCenter, player.Center - Vector2.UnitY * 80f, Utils.InverseLerp(0f, 35f, Time % 150f)); + Projectile.Center = Vector2.SmoothStep(OldCenter, player.Center - Vector2.UnitY * 80f, Utils.InverseLerp(0f, 35f, Time % 150f)); } else { - projectile.Center = player.Center - Vector2.UnitY * (80f + (float)Math.Sin((Time % 150f - 35f) / 115f * MathHelper.TwoPi) * 30f); + Projectile.Center = player.Center - Vector2.UnitY * (80f + (float)Math.Sin((Time % 150f - 35f) / 115f * MathHelper.TwoPi) * 30f); } EyeOutwardness = MathHelper.Lerp(EyeOutwardness, 0f, 0.15f); } public void NPCMovement(NPC npc) { - projectile.velocity = Vector2.Zero; + Projectile.velocity = Vector2.Zero; Vector2 offsetMultiplier = Vector2.UnitX; - switch ((int)projectile.ai[1] % 4) + switch ((int)Projectile.ai[1] % 4) { case 0: offsetMultiplier = new Vector2(-1f, -1f); @@ -199,11 +199,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } if (Time % 20f == 0f) { - if (projectile.ai[1] > 0 && Main.myPlayer == projectile.owner) + if (Projectile.ai[1] > 0 && Main.myPlayer == Projectile.owner) { - Vector2 shootPosition = projectile.Center + Utils.Vector2FromElipse(EyeRotation.ToRotationVector2(), projectile.Size * 0.5f * EyeOutwardness); - Vector2 shootVelocity = projectile.SafeDirectionTo(npc.Center, Main.rand.NextVector2Unit()) * 4f; - int laser = Projectile.NewProjectile(shootPosition, shootVelocity, ProjectileID.UFOLaser, projectile.damage, projectile.knockBack, projectile.owner); + Vector2 shootPosition = Projectile.Center + Utils.Vector2FromElipse(EyeRotation.ToRotationVector2(), Projectile.Size * 0.5f * EyeOutwardness); + Vector2 shootVelocity = Projectile.SafeDirectionTo(npc.Center, Main.rand.NextVector2Unit()) * 4f; + int laser = Projectile.NewProjectile(shootPosition, shootVelocity, ProjectileID.UFOLaser, Projectile.damage, Projectile.knockBack, Projectile.owner); if (laser.WithinBounds(Main.maxProjectiles)) { Main.projectile[laser].timeLeft *= 2; @@ -212,38 +212,38 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Main.projectile[laser].Calamity().forceMinion = true; } } - projectile.ai[1]++; - OldCenter = projectile.Center; + Projectile.ai[1]++; + OldCenter = Projectile.Center; } else { EyeOutwardness = MathHelper.Lerp(EyeOutwardness, 1f, 0.15f); - EyeRotation = EyeRotation.AngleTowards(projectile.AngleTo(npc.Center), MathHelper.TwoPi / 20f); - projectile.Center = Vector2.SmoothStep(OldCenter, npc.Center + (new Vector2(300f) + projectile.Size * 0.5f) * offsetMultiplier, Time % 20f / 20f); + EyeRotation = EyeRotation.AngleTowards(Projectile.AngleTo(npc.Center), MathHelper.TwoPi / 20f); + Projectile.Center = Vector2.SmoothStep(OldCenter, npc.Center + (new Vector2(300f) + Projectile.Size * 0.5f) * offsetMultiplier, Time % 20f / 20f); } } public void GenerateAfterimageDust() { - for (int i = 1; i < projectile.oldPos.Length; i++) + for (int i = 1; i < Projectile.oldPos.Length; i++) { if (i == 1) { for (int j = 0; j < 14; j++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, 261); - dust.position += (j / 14f * MathHelper.TwoPi).ToRotationVector2() * projectile.Size * 0.5f * 1.3f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, 261); + dust.position += (j / 14f * MathHelper.TwoPi).ToRotationVector2() * Projectile.Size * 0.5f * 1.3f; dust.velocity = Vector2.Zero; dust.scale = 0.6f; dust.noGravity = true; } } - if (Vector2.Distance(projectile.oldPos[i - 1], projectile.oldPos[i]) > 3f) + if (Vector2.Distance(Projectile.oldPos[i - 1], Projectile.oldPos[i]) > 3f) { for (int j = 0; j < 7; j++) { - Dust dust = Dust.NewDustPerfect(projectile.oldPos[i] + projectile.Size * 0.5f, 261); - dust.position += (j / 7f * MathHelper.TwoPi).ToRotationVector2() * ((projectile.oldPos.Length - i) * 1.2f + 3f); + Dust dust = Dust.NewDustPerfect(Projectile.oldPos[i] + Projectile.Size * 0.5f, 261); + dust.position += (j / 7f * MathHelper.TwoPi).ToRotationVector2() * ((Projectile.oldPos.Length - i) * 1.2f + 3f); dust.velocity = Vector2.Zero; dust.scale = 0.6f; dust.noGravity = true; @@ -256,11 +256,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, 0, Color.White, ProjectileID.Sets.TrailCacheLength[projectile.type]); - Texture2D eyeTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/SnakeEye"); - Vector2 offsetVector = Utils.Vector2FromElipse(EyeRotation.ToRotationVector2(), projectile.Size * 0.5f * EyeOutwardness); + CalamityUtils.DrawAfterimagesCentered(Projectile, 0, Color.White, ProjectileID.Sets.TrailCacheLength[Projectile.type]); + Texture2D eyeTexture = ModContent.Request("CalamityMod/ExtraTextures/SnakeEye"); + Vector2 offsetVector = Utils.Vector2FromElipse(EyeRotation.ToRotationVector2(), Projectile.Size * 0.5f * EyeOutwardness); spriteBatch.Draw(eyeTexture, - projectile.Center + offsetVector - Main.screenPosition, + Projectile.Center + offsetVector - Main.screenPosition, null, Color.White, 0f, diff --git a/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs index ca8fc62c97..5c1b920a4c 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs @@ -15,48 +15,48 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Acid"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 20; - projectile.friendly = true; - projectile.tileCollide = true; - projectile.ignoreWater = false; - projectile.timeLeft = 300; - projectile.alpha = 255; - projectile.minion = true; - projectile.minionSlots = 0f; + Projectile.width = 14; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.ignoreWater = false; + Projectile.timeLeft = 300; + Projectile.alpha = 255; + Projectile.minion = true; + Projectile.minionSlots = 0f; } public override void AI() { - if (projectile.velocity.Y <= 10f) + if (Projectile.velocity.Y <= 10f) { - projectile.velocity.Y += Gravity; + Projectile.velocity.Y += Gravity; } - projectile.ai[0]++; - if (projectile.ai[0] < 10) + Projectile.ai[0]++; + if (Projectile.ai[0] < 10) { - projectile.alpha = (int)MathHelper.Lerp(255, 0, projectile.ai[0] / 10f); + Projectile.alpha = (int)MathHelper.Lerp(255, 0, Projectile.ai[0] / 10f); } - projectile.tileCollide = projectile.timeLeft <= 260; - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.tileCollide = Projectile.timeLeft <= 260; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override bool OnTileCollide(Vector2 oldVelocity) { // Water drip for (int i = 0; i < 4; i++) { - int idx = Dust.NewDust(projectile.position - projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); Dust dust = Main.dust[idx]; dust.position.X -= 2f; Main.dust[idx].alpha = 38; Main.dust[idx].velocity *= 0.1f; - Main.dust[idx].velocity -= projectile.velocity * 0.025f; + Main.dust[idx].velocity -= Projectile.velocity * 0.025f; Main.dust[idx].scale = 2f; } return true; @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127) * projectile.Opacity, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127) * Projectile.Opacity, 2); return false; } } diff --git a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs index 745388d114..225bc663d8 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs @@ -6,7 +6,8 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; +using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { public class StarSwallowerSummon : ModProjectile @@ -19,29 +20,29 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public bool ReleasingAcid { - get => projectile.ai[0] != 0f; - set => projectile.ai[0] = value.ToInt(); + get => Projectile.ai[0] != 0f; + set => Projectile.ai[0] = value.ToInt(); } public override void SetStaticDefaults() { DisplayName.SetDefault("Pet Froge"); - Main.projFrames[projectile.type] = 12; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 12; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 38; - projectile.height = 30; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.minion = true; - projectile.timeLeft *= 5; - projectile.penetrate = -1; + Projectile.width = 38; + Projectile.height = 30; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.minion = true; + Projectile.timeLeft *= 5; + Projectile.penetrate = -1; } public override void SendExtraAI(BinaryWriter writer) @@ -62,9 +63,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; - bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isCorrectProjectile) { @@ -74,24 +75,24 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } if (player.Calamity().starSwallowerPetFroge) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } int minimumFrame = 0; int maximumFrame = 11; - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) { minimumFrame = maximumFrame = 0; } if (HopCooldown > 0) { - if (projectile.velocity.Length() > 8f) + if (Projectile.velocity.Length() > 8f) { minimumFrame = maximumFrame = 1; - if (Math.Abs(projectile.oldPosition.Y - projectile.position.Y) < 5.5f) + if (Math.Abs(Projectile.oldPosition.Y - Projectile.position.Y) < 5.5f) minimumFrame = maximumFrame = 0; } else if (HopCooldown < 6) @@ -115,20 +116,20 @@ namespace CalamityMod.Projectiles.DraedonsArsenal AdjustDamage(player); // Gravity effect. - projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.4f, -11f, 11f); + Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y + 0.4f, -11f, 11f); - projectile.tileCollide = !FlyUntilNearPlayer; + Projectile.tileCollide = !FlyUntilNearPlayer; ReleasingAcid = false; // Remember, && doesn't evaluate future statements if the statement it just evaluated is true. // This means that null problems should never happen, since it wouldn't pass the potentialTarget != null check. - NPC potentialTarget = projectile.Center.MinionHoming(800f, player); + NPC potentialTarget = Projectile.Center.MinionHoming(800f, player); if (potentialTarget != null && - Math.Abs(potentialTarget.Center.X - projectile.Center.X) < 320f && - Math.Sign(potentialTarget.Center.Y - projectile.Center.Y) == -1 && - Math.Abs(potentialTarget.Center.Y - projectile.Center.Y) < 160f && - Math.Sign(potentialTarget.Center.Y - projectile.Center.Y) == -1 && + Math.Abs(potentialTarget.Center.X - Projectile.Center.X) < 320f && + Math.Sign(potentialTarget.Center.Y - Projectile.Center.Y) == -1 && + Math.Abs(potentialTarget.Center.Y - Projectile.Center.Y) < 160f && + Math.Sign(potentialTarget.Center.Y - Projectile.Center.Y) == -1 && !FlyUntilNearPlayer) { FallThroughYPoint = potentialTarget.Top.Y; @@ -140,45 +141,45 @@ namespace CalamityMod.Projectiles.DraedonsArsenal FallThroughYPoint = player.Top.Y; } - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); ManipulateFrames(minimumFrame, maximumFrame); } public void AdjustDamage(Player player) { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int newDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int newDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = newDamage; + Projectile.damage = newDamage; } } public void HandleHop(Vector2 targetPosition) { - if (HopCooldown <= 0f && projectile.oldPosition.Y == projectile.position.Y) + if (HopCooldown <= 0f && Projectile.oldPosition.Y == Projectile.position.Y) { - float hopXMult = Utils.InverseLerp(50f, 500f, targetPosition.X - projectile.Center.X, true); - float hopYMult = Utils.InverseLerp(40f, 300f, targetPosition.Y - projectile.Center.Y, true); - float hopSpeedX = MathHelper.Lerp(4f, 17f, hopXMult) * Math.Sign(targetPosition.X - projectile.Center.X); + float hopXMult = Utils.InverseLerp(50f, 500f, targetPosition.X - Projectile.Center.X, true); + float hopYMult = Utils.InverseLerp(40f, 300f, targetPosition.Y - Projectile.Center.Y, true); + float hopSpeedX = MathHelper.Lerp(4f, 17f, hopXMult) * Math.Sign(targetPosition.X - Projectile.Center.X); float hopSpeedY = -1 * MathHelper.Lerp(8f, 23f, hopYMult); Vector2 velocity = new Vector2(hopSpeedX, hopSpeedY); - projectile.velocity = velocity; - projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + Projectile.velocity = velocity; + Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); HopCooldown = 25f; } else { - projectile.velocity.X *= 0.935f; + Projectile.velocity.X *= 0.935f; HopCooldown--; } } @@ -186,13 +187,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public void PlayerSeparationAnxietyAI(Player player, ref int minimumFrame, ref int maximumFrame) { // If the player is extremely far away, don't bother homing. Just go to the player's location. - if (projectile.Distance(player.Center) > 1900f) + if (Projectile.Distance(player.Center) > 1900f) { - projectile.Center = player.Center; - projectile.netUpdate = true; + Projectile.Center = player.Center; + Projectile.netUpdate = true; return; } - Vector2 returnPosition = projectile.Center; + Vector2 returnPosition = Projectile.Center; returnPosition.Y -= 200 * 16; returnPosition.Y = MathHelper.Clamp(returnPosition.Y, 50, Main.maxTilesX * 16 - 50); @@ -201,17 +202,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal new Conditions.IsSolid() }), out _); - if (projectile.Distance(player.Center) > 1200f) + if (Projectile.Distance(player.Center) > 1200f) { FlyUntilNearPlayer = true; - projectile.netUpdate = true; + Projectile.netUpdate = true; } - if (projectile.Distance(player.Center) < 120f && + if (Projectile.Distance(player.Center) < 120f && FlyUntilNearPlayer && - !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { FlyUntilNearPlayer = false; - projectile.netUpdate = true; + Projectile.netUpdate = true; } bool flying = noGround || FlyUntilNearPlayer; @@ -222,10 +223,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal minimumFrame = 7; maximumFrame = 11; float inertia = 30f; - projectile.velocity = (projectile.velocity * (inertia - 1) + projectile.SafeDirectionTo(player.Center) * 18f) / inertia; + Projectile.velocity = (Projectile.velocity * (inertia - 1) + Projectile.SafeDirectionTo(player.Center) * 18f) / inertia; } // Otherwise hop around when on the ground. - else if (projectile.oldPosition.Y == projectile.position.Y) + else if (Projectile.oldPosition.Y == Projectile.position.Y) { HandleHop(player.Center); } @@ -234,7 +235,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public void NPCTargetingAI(NPC potentialTarget) { HandleHop(potentialTarget.Center); - if (Collision.CanHit(projectile.position, projectile.width, projectile.height, potentialTarget.position, potentialTarget.width, projectile.height) && AcidShootCooldown <= 0f) + if (Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, potentialTarget.position, potentialTarget.width, Projectile.height) && AcidShootCooldown <= 0f) { AcidShootTimer++; ReleasingAcid = AcidShootTimer >= 16 && AcidShootTimer <= 44; @@ -242,62 +243,62 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (AcidShootTimer >= 20 && AcidShootTimer <= 44 && AcidShootTimer % 6 == 0 && - Main.myPlayer == projectile.owner) + Main.myPlayer == Projectile.owner) { - Vector2 spawnPosition = projectile.Center + Vector2.UnitX * 8f * projectile.spriteDirection; - projectile.spriteDirection = (potentialTarget.Center.X - projectile.Center.X > 0).ToDirectionInt(); + Vector2 spawnPosition = Projectile.Center + Vector2.UnitX * 8f * Projectile.spriteDirection; + Projectile.spriteDirection = (potentialTarget.Center.X - Projectile.Center.X > 0).ToDirectionInt(); Vector2 fireVelocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(spawnPosition, potentialTarget.Center, StarSwallowerAcid.Gravity, 14f); Projectile.NewProjectile(spawnPosition, fireVelocity, ModContent.ProjectileType(), - projectile.damage, - projectile.knockBack, - projectile.owner); - Main.PlaySound(SoundID.Item13, spawnPosition); + Projectile.damage, + Projectile.knockBack, + Projectile.owner); + SoundEngine.PlaySound(SoundID.Item13, spawnPosition); } if (AcidShootTimer > 48) { AcidShootTimer = 0; AcidShootCooldown = 10f; - projectile.netUpdate = true; + Projectile.netUpdate = true; } } else if (AcidShootCooldown > 0f) AcidShootCooldown--; - projectile.velocity.X *= 0.8f; + Projectile.velocity.X *= 0.8f; } public void ManipulateFrames(int minimumFrame, int maximumFrame) { - if (projectile.frame < minimumFrame) + if (Projectile.frame < minimumFrame) { - projectile.frame = minimumFrame; + Projectile.frame = minimumFrame; } - projectile.frameCounter++; - if (projectile.frameCounter >= maximumFrame) + Projectile.frameCounter++; + if (Projectile.frameCounter >= maximumFrame) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > maximumFrame) + if (Projectile.frame > maximumFrame) { - projectile.frame = minimumFrame; + Projectile.frame = minimumFrame; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = ModContent.GetTexture(Texture); - Rectangle frame = texture.Frame(2, Main.projFrames[projectile.type], ReleasingAcid.ToInt(), projectile.frame); + Texture2D texture = ModContent.Request(Texture); + Rectangle frame = texture.Frame(2, Main.projFrames[Projectile.type], ReleasingAcid.ToInt(), Projectile.frame); spriteBatch.Draw(texture, - projectile.Center - Main.screenPosition, + Projectile.Center - Main.screenPosition, frame, lightColor, - projectile.rotation, - projectile.Size * 0.5f, - projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.rotation, + Projectile.Size * 0.5f, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); return false; } @@ -306,7 +307,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { - fallThrough = projectile.Bottom.Y < FallThroughYPoint - 120f; + fallThrough = Projectile.Bottom.Y < FallThroughYPoint - 120f; return base.TileCollideStyle(ref width, ref height, ref fallThrough); } diff --git a/Projectiles/DraedonsArsenal/SystemBaneLightning.cs b/Projectiles/DraedonsArsenal/SystemBaneLightning.cs index a1ff583428..767b49c0b5 100644 --- a/Projectiles/DraedonsArsenal/SystemBaneLightning.cs +++ b/Projectiles/DraedonsArsenal/SystemBaneLightning.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public int ElectrocutionTarget { - get => (int)projectile.ai[0]; - set => projectile.ai[0] = value; + get => (int)Projectile.ai[0]; + set => Projectile.ai[0] = value; } public const float OuterLightningScale = 0.5f; public const float InnerLightningScale = 0.3f; @@ -26,63 +26,63 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Lightning"); - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 60; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 60; } public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.tileCollide = false; - projectile.timeLeft = 40 * (projectile.extraUpdates + 1); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 40 * (Projectile.extraUpdates + 1); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; } public override void AI() { // Initialize the lightning without a set target. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { ElectrocutionTarget = -1; - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } bool hasSelectedTarget = ElectrocutionTarget >= 0 && ElectrocutionTarget < Main.npc.Length; - NPC potentialTarget = projectile.Center.ClosestNPCAt(800f); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(800f); if (hasSelectedTarget) potentialTarget = Main.npc[ElectrocutionTarget]; if (potentialTarget != null) { // Don't move at all if the lightning is already close to/electrocuting its target. - if (hasSelectedTarget && projectile.Distance(potentialTarget.Center) < 14f) - projectile.velocity = Vector2.Zero; + if (hasSelectedTarget && Projectile.Distance(potentialTarget.Center) < 14f) + Projectile.velocity = Vector2.Zero; else ArcToTarget(potentialTarget); } // Sometimes randomly update the velocity to make it look like it's actually lightning instead of just a line if (Main.rand.NextBool(10)) { - projectile.velocity = projectile.velocity.RotatedByRandom(0.52f); - projectile.netUpdate = true; + Projectile.velocity = Projectile.velocity.RotatedByRandom(0.52f); + Projectile.netUpdate = true; } } public void ArcToTarget(NPC target) { // Convert the velocity into a rotation, update it to move towards the target, and then convert that updated angle back into a velocity. - float updatedVelocityDirection = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(target.Center), 0.25f); - projectile.velocity = updatedVelocityDirection.ToRotationVector2() * projectile.velocity.Length(); + float updatedVelocityDirection = Projectile.velocity.ToRotation().AngleTowards(Projectile.AngleTo(target.Center), 0.25f); + Projectile.velocity = updatedVelocityDirection.ToRotationVector2() * Projectile.velocity.Length(); // Sometimes add a bit of randomness to the lightning's movement. if (Main.rand.NextBool(5)) { - projectile.velocity = projectile.velocity.RotatedByRandom(0.9f); - projectile.netSpam = 0; - projectile.netUpdate = true; + Projectile.velocity = Projectile.velocity.RotatedByRandom(0.9f); + Projectile.netSpam = 0; + Projectile.netUpdate = true; } } @@ -92,15 +92,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (ElectrocutionTarget == -1) { ElectrocutionTarget = target.whoAmI; - projectile.velocity = Vector2.Zero; - projectile.netUpdate = true; + Projectile.velocity = Vector2.Zero; + Projectile.netUpdate = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { // If you have any ideas of making lightning that isn't the same as the cultist lightning and looks more like real lightning, please change this. - List oldPositions = projectile.oldPos.Where(oldPosition => oldPosition != Vector2.Zero).ToList(); + List oldPositions = Projectile.oldPos.Where(oldPosition => oldPosition != Vector2.Zero).ToList(); for (int i = 0; i < oldPositions.Count - 1; i++) { // Draw two types of lightning to make it look like it has an outer and an inner part. @@ -111,13 +111,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal DelegateMethods.f_1 = OuterLightningOpacity; DelegateMethods.c_1 = OuterLightningColor; - Vector2 start = oldPositions[i] + projectile.Size * 0.5f - Main.screenPosition; - Vector2 end = oldPositions[i + 1] + projectile.Size * 0.5f - Main.screenPosition; - Utils.DrawLaser(spriteBatch, ModContent.GetTexture(Texture), start, end, new Vector2(OuterLightningScale), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + Vector2 start = oldPositions[i] + Projectile.Size * 0.5f - Main.screenPosition; + Vector2 end = oldPositions[i + 1] + Projectile.Size * 0.5f - Main.screenPosition; + Utils.DrawLaser(spriteBatch, ModContent.Request(Texture), start, end, new Vector2(OuterLightningScale), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); DelegateMethods.f_1 = InnerLightningOpacity; DelegateMethods.c_1 = InnerLightningColor; - Utils.DrawLaser(spriteBatch, ModContent.GetTexture(Texture), start, end, new Vector2(InnerLightningScale), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + Utils.DrawLaser(spriteBatch, ModContent.Request(Texture), start, end, new Vector2(InnerLightningScale), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } return false; } diff --git a/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs b/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs index 5e793b5798..d4323f1370 100644 --- a/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs +++ b/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public SoundEffectInstance ShittyMicrowaveMemeSound = null; public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public const int LightningFireRate = 60; public const int FieldLightningFireRate = 45; @@ -27,58 +27,58 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 36; - projectile.height = 36; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; - projectile.tileCollide = true; - projectile.timeLeft = 480; - projectile.Calamity().rogue = true; + Projectile.width = 36; + Projectile.height = 36; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; + Projectile.tileCollide = true; + Projectile.timeLeft = 480; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.StickToTiles(false, true); + Projectile.StickToTiles(false, true); Time++; - projectile.rotation = projectile.velocity.ToRotation(); - if (projectile.velocity.Y < 15f) + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.velocity.Y < 15f) { - projectile.velocity.Y += 0.5f; + Projectile.velocity.Y += 0.5f; } // Generate idle sparks. if (Time % 15f == 0f) { - Dust dust = Dust.NewDustPerfect(projectile.Center, 229); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 229); dust.velocity = Main.rand.NextVector2Circular(10f, 10f); dust.fadeIn = 1.05f; dust.noGravity = true; } // Every so often, generate some lightning at a nearby enemy, if one exists. - if (Time % LightningFireRate == 0f && Main.myPlayer == projectile.owner) + if (Time % LightningFireRate == 0f && Main.myPlayer == Projectile.owner) { - int lightningDamage = projectile.damage; - int totalSystemBanes = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + int lightningDamage = Projectile.damage; + int totalSystemBanes = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type]; // Make the damage of the lightning have diminishing returns depending on how many systems are present. lightningDamage = (int)Math.Ceiling(lightningDamage / Math.Pow(totalSystemBanes, 1D / 3D)); - NPC potentialTarget = projectile.Center.ClosestNPCAt(900f); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(900f); if (potentialTarget != null) - Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(potentialTarget.Center) * 15f, ModContent.ProjectileType(), lightningDamage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center) * 15f, ModContent.ProjectileType(), lightningDamage, Projectile.knockBack, Projectile.owner); } // Sometimes generate lightning from the outside of the energy field if the projectile was spawned by a stealth strike. - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - NPC potentialTarget = projectile.Center.ClosestNPCAt(FieldRadius); - if (Time % FieldLightningFireRate == 0f && potentialTarget != null && Main.myPlayer == projectile.owner) + NPC potentialTarget = Projectile.Center.ClosestNPCAt(FieldRadius); + if (Time % FieldLightningFireRate == 0f && potentialTarget != null && Main.myPlayer == Projectile.owner) { - Vector2 spawnPosition = projectile.Center + Main.rand.NextVector2CircularEdge(FieldRadius, FieldRadius); - Projectile.NewProjectile(spawnPosition, potentialTarget.DirectionFrom(spawnPosition) * 14f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2CircularEdge(FieldRadius, FieldRadius); + Projectile.NewProjectile(spawnPosition, potentialTarget.DirectionFrom(spawnPosition) * 14f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } @@ -87,15 +87,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public void PlayMicrowaveSounds() { - if (ShittyMicrowaveMemeSound is null && projectile.Calamity().stealthStrike) + if (ShittyMicrowaveMemeSound is null && Projectile.Calamity().stealthStrike) { ShittyMicrowaveMemeSound = ModContent.GetSound("CalamityMod/Sounds/Custom/MMMMMMMMMMMMM").CreateInstance(); ShittyMicrowaveMemeSound.IsLooped = true; - CalamityUtils.ApplySoundStats(ref ShittyMicrowaveMemeSound, projectile.Center); + CalamityUtils.ApplySoundStats(ref ShittyMicrowaveMemeSound, Projectile.Center); Main.PlaySoundInstance(ShittyMicrowaveMemeSound); } else if (ShittyMicrowaveMemeSound != null && !ShittyMicrowaveMemeSound.IsDisposed) - CalamityUtils.ApplySoundStats(ref ShittyMicrowaveMemeSound, projectile.Center); + CalamityUtils.ApplySoundStats(ref ShittyMicrowaveMemeSound, Projectile.Center); } public override void Kill(int timeLeft) @@ -106,18 +106,18 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - if (!projectile.Calamity().stealthStrike) + if (!Projectile.Calamity().stealthStrike) return; int totalCirclePoints = 55; - float generalOpacity = Utils.InverseLerp(0f, 30f, projectile.timeLeft, true) * Utils.InverseLerp(480f, 450f, projectile.timeLeft, true); - Texture2D lightningTexture = ModContent.GetTexture("CalamityMod/Projectiles/LightningProj"); + float generalOpacity = Utils.InverseLerp(0f, 30f, Projectile.timeLeft, true) * Utils.InverseLerp(480f, 450f, Projectile.timeLeft, true); + Texture2D lightningTexture = ModContent.Request("CalamityMod/Projectiles/LightningProj"); for (int i = 0; i < totalCirclePoints; i++) { float angle = MathHelper.TwoPi * i / totalCirclePoints; float nextAngle = angle + MathHelper.TwoPi / totalCirclePoints; float radiusOffset = (float)Math.Cos(Main.GlobalTime * 65f); - Vector2 start = projectile.Center + angle.ToRotationVector2() * (FieldRadius + radiusOffset) - Main.screenPosition; - Vector2 end = projectile.Center + nextAngle.ToRotationVector2() * (FieldRadius + radiusOffset) - Main.screenPosition; + Vector2 start = Projectile.Center + angle.ToRotationVector2() * (FieldRadius + radiusOffset) - Main.screenPosition; + Vector2 end = Projectile.Center + nextAngle.ToRotationVector2() * (FieldRadius + radiusOffset) - Main.screenPosition; DelegateMethods.f_1 = SystemBaneLightning.InnerLightningOpacity * generalOpacity; DelegateMethods.c_1 = SystemBaneLightning.InnerLightningColor; @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.velocity.X *= 0.8f; + Projectile.velocity.X *= 0.8f; return false; } } diff --git a/Projectiles/DraedonsArsenal/TaserHook.cs b/Projectiles/DraedonsArsenal/TaserHook.cs index 647954afc0..fc12e3b2c2 100644 --- a/Projectiles/DraedonsArsenal/TaserHook.cs +++ b/Projectiles/DraedonsArsenal/TaserHook.cs @@ -17,20 +17,20 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public TaserAIState AIState { - get => (TaserAIState)(int)projectile.ai[0]; - set => projectile.ai[0] = (int)value; + get => (TaserAIState)(int)Projectile.ai[0]; + set => Projectile.ai[0] = (int)value; } public float Time { - get => projectile.ai[1]; - set => projectile.ai[1] = value; + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; } public int ElectrocutionTarget { - get => (int)projectile.localAI[0]; - set => projectile.localAI[0] = value; + get => (int)Projectile.localAI[0]; + set => Projectile.localAI[0] = value; } public const float ReelbackSpeed = 15f; @@ -42,25 +42,25 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.tileCollide = true; - projectile.ownerHitCheck = true; - projectile.ranged = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.tileCollide = true; + Projectile.ownerHitCheck = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } public override void AI() { Time++; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; switch (AIState) { case TaserAIState.Firing: - float distanceFromPlayer = projectile.Distance(player.Center); + float distanceFromPlayer = Projectile.Distance(player.Center); if (distanceFromPlayer > 600f || Time >= 90f) GoToAIState(TaserAIState.ReelingBack); break; @@ -72,21 +72,21 @@ namespace CalamityMod.Projectiles.DraedonsArsenal return; } - projectile.Center = Main.npc[ElectrocutionTarget].Center; + Projectile.Center = Main.npc[ElectrocutionTarget].Center; break; case TaserAIState.ReelingBack: // Kill the gun and the hook if the hook has returned to the gun. - if (projectile.Hitbox.Intersects(player.Hitbox)) + if (Projectile.Hitbox.Intersects(player.Hitbox)) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.tileCollide = false; - projectile.velocity = projectile.SafeDirectionTo(player.Center) * ReelbackSpeed; + Projectile.tileCollide = false; + Projectile.velocity = Projectile.SafeDirectionTo(player.Center) * ReelbackSpeed; break; } - projectile.rotation = projectile.AngleFrom(player.Center); + Projectile.rotation = Projectile.AngleFrom(player.Center); ManipulatePlayerItemValues(player); } @@ -94,8 +94,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public void ManipulatePlayerItemValues(Player player) { - player.ChangeDir((player.Center.X - projectile.Center.X < 0).ToDirectionInt()); - player.itemRotation = CalamityUtils.WrapAngle90Degrees(projectile.rotation); + player.ChangeDir((player.Center.X - Projectile.Center.X < 0).ToDirectionInt()); + player.itemRotation = CalamityUtils.WrapAngle90Degrees(Projectile.rotation); player.itemTime = 4; player.itemAnimation = 4; } @@ -106,17 +106,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (AIState == newAIState) return; - projectile.penetrate = -1; + Projectile.penetrate = -1; AIState = newAIState; - projectile.netUpdate = true; + Projectile.netUpdate = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Player player = Main.player[projectile.owner]; - Texture2D texture = ModContent.GetTexture(Texture); - Utils.DrawLine(spriteBatch, player.MountedCenter, projectile.Center, Color.Cyan, Color.White, 4f); - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, null, lightColor, projectile.rotation, texture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + Player player = Main.player[Projectile.owner]; + Texture2D texture = ModContent.Request(Texture); + Utils.DrawLine(spriteBatch, player.MountedCenter, Projectile.Center, Color.Cyan, Color.White, 4f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/DraedonsArsenal/TeslaCannonShot.cs b/Projectiles/DraedonsArsenal/TeslaCannonShot.cs index 7bf0e4efeb..5e4f9499db 100644 --- a/Projectiles/DraedonsArsenal/TeslaCannonShot.cs +++ b/Projectiles/DraedonsArsenal/TeslaCannonShot.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -21,29 +22,29 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 600; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 600; } public override void AI() { - bool notArcingProjectile = projectile.ai[1] >= 0f; + bool notArcingProjectile = Projectile.ai[1] >= 0f; - Lighting.AddLight(projectile.Center, 0f, 0.3f, 0.4f); + Lighting.AddLight(Projectile.Center, 0f, 0.3f, 0.4f); float createDustVar = 10f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > createDustVar) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > createDustVar) { for (int num447 = 0; num447 < 2; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * (num447 * 0.25f); + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * (num447 * 0.25f); int num448 = Dust.NewDust(vector33, 1, 1, dustArray[3], 0f, 0f, 0, default, 1f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; @@ -51,16 +52,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } if (Main.rand.Next(6) == 0) - Dust.NewDust(projectile.Center, projectile.width, projectile.height, dustArray[6], 0f, 0f); + Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, dustArray[6], 0f, 0f); if (notArcingProjectile) { - if (projectile.ai[1] > 0f) - projectile.ai[1] -= 1f; + if (Projectile.ai[1] > 0f) + Projectile.ai[1] -= 1f; - projectile.ai[0] += 1f; - if (projectile.ai[0] == 48f) - projectile.ai[0] = 0f; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] == 48f) + Projectile.ai[0] = 0f; else { Vector2 value7 = new Vector2(5f, 10f); @@ -69,49 +70,49 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num41 = 0; num41 < 2; num41++) { - value8 = -Vector2.UnitY.RotatedBy(projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dustArray[2], 0f, 0f, 160, default, 1f); + value8 = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, dustArray[2], 0f, 0f, 160, default, 1f); Main.dust[num42].scale = scale; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].position = Projectile.Center + value8; } for (int num41 = 0; num41 < 2; num41++) { - value8 = -Vector2.UnitY.RotatedBy(projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 1.5f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dustArray[1], 0f, 0f, 160, default, 1f); + value8 = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 1.5f; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, dustArray[1], 0f, 0f, 160, default, 1f); Main.dust[num42].scale = scale; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].position = Projectile.Center + value8; } for (int num41 = 0; num41 < 2; num41++) { - value8 = -Vector2.UnitY.RotatedBy(projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 2f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dustArray[0], 0f, 0f, 160, default, 1f); + value8 = -Vector2.UnitY.RotatedBy(Projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 2f; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, dustArray[0], 0f, 0f, 160, default, 1f); Main.dust[num42].scale = scale; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].position = Projectile.Center + value8; } } - if (projectile.ai[1] == 0f && Main.myPlayer == projectile.owner) + if (Projectile.ai[1] == 0f && Main.myPlayer == Projectile.owner) { if (arcs < 10) { - Vector2 vector35 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); + Vector2 vector35 = new Vector2(Projectile.position.X + Projectile.width * 0.5f, Projectile.position.Y + Projectile.height * 0.5f); float num474 = 600f; for (int i = 0; i < Main.maxNPCs; i++) { - if (!Main.npc[i].CanBeChasedBy(projectile, false) || !Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + if (!Main.npc[i].CanBeChasedBy(Projectile, false) || !Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) continue; - if (projectile.Center.ManhattanDistance(Main.npc[i].Center) < num474) + if (Projectile.Center.ManhattanDistance(Main.npc[i].Center) < num474) { - Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(Main.npc[i].Center) * 2f, projectile.type, (int)(projectile.damage * 0.6), projectile.knockBack * 0.6f, projectile.owner, 0f, -1f); + Projectile.NewProjectile(Projectile.Center, Projectile.SafeDirectionTo(Main.npc[i].Center) * 2f, Projectile.type, (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.6f, Projectile.owner, 0f, -1f); - projectile.ai[1] = 60f; + Projectile.ai[1] = 60f; arcs++; break; @@ -122,25 +123,25 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } - if (projectile.localAI[0] == createDustVar && notArcingProjectile) + if (Projectile.localAI[0] == createDustVar && notArcingProjectile) ElectricalBurst(5f, 9f); } public override void Kill(int timeLeft) { - bool notArcingProjectile = projectile.ai[1] >= 0f; + bool notArcingProjectile = Projectile.ai[1] >= 0f; int height = notArcingProjectile ? 120 : 60; - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); - Main.PlaySound(SoundID.Item125, projectile.Center); + SoundEngine.PlaySound(SoundID.Item125, Projectile.Center); int dustAmt = notArcingProjectile ? 400 : 100; int fourth = notArcingProjectile ? 100 : 25; @@ -170,7 +171,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } float scale = (dustType == dustArray[4] ? 3f : 1.5f); - int num675 = Dust.NewDust(projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, scale); + int num675 = Dust.NewDust(Projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, scale); float num676 = Main.dust[num675].velocity.X; float num677 = Main.dust[num675].velocity.Y; @@ -208,7 +209,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (num672 > threeFourths) { - int num650 = Dust.NewDust(projectile.Center, 6, 6, dustArray[5], 0f, 0f, 100, default, 1.3f); + int num650 = Dust.NewDust(Projectile.Center, 6, 6, dustArray[5], 0f, 0f, 100, default, 1.3f); float num651 = Main.dust[num650].velocity.X; float num652 = Main.dust[num650].velocity.Y; @@ -236,22 +237,22 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num53 = 0; num53 < 40; num53++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2f * angleRandom); int randomDustType = Main.rand.Next(2) == 0 ? dustArray[4] : dustArray[5]; float scale = randomDustType == dustArray[4] ? 1.5f : 1f; - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 2.5f * scale); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 2.5f * scale); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 3f; dust = Main.dust[num54]; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 1.5f * scale); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 1.5f * scale); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; @@ -265,14 +266,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num55 = 0; num55 < 20; num55++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2f * angleRandom); int randomDustType = Main.rand.Next(2) == 0 ? dustArray[4] : dustArray[5]; float scale = randomDustType == dustArray[4] ? 1.5f : 1f; - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 3f * scale); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 3f * scale); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; diff --git a/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs b/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs index c5653055cf..b8d10b0930 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public float Time { - get => projectile.localAI[0]; - set => projectile.localAI[0] = value; + get => Projectile.localAI[0]; + set => Projectile.localAI[0] = value; } public override void SetStaticDefaults() { @@ -19,29 +19,29 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 600; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 600; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.2f, 0.1f, 0f); + Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f); Time++; if (Time >= 10f) { for (int i = 0; i < 2; i++) { - Dust dust = Dust.NewDustDirect(projectile.Center, 0, 0, 182, 0f, 0f, 160, default, 2f); - dust.position = projectile.Center; - dust.velocity = projectile.velocity; - dust.scale = projectile.scale; + Dust dust = Dust.NewDustDirect(Projectile.Center, 0, 0, 182, 0f, 0f, 160, default, 2f); + dust.position = Projectile.Center; + dust.velocity = Projectile.velocity; + dust.scale = Projectile.scale; dust.noGravity = true; } } @@ -49,12 +49,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 60); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 60); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); } } } diff --git a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs index d18af01eda..6cb62ffe97 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs @@ -15,14 +15,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public bool ReturningToPlayer { - get => projectile.ai[0] == 1f; - set => projectile.ai[0] = value.ToInt(); + get => Projectile.ai[0] == 1f; + set => Projectile.ai[0] = value.ToInt(); } public float Time { - get => projectile.ai[1]; - set => projectile.ai[1] = value; + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; } public const int LaserFireRate = 20; @@ -34,25 +34,25 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Tracking Disk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.Red.ToVector3()); + Lighting.AddLight(Projectile.Center, Color.Red.ToVector3()); - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; Time++; if (!ReturningToPlayer) @@ -60,56 +60,56 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (Time >= 45f) { ReturningToPlayer = true; - projectile.tileCollide = false; - projectile.netUpdate = true; + Projectile.tileCollide = false; + Projectile.netUpdate = true; } } else { - float distanceFromPlayer = projectile.Distance(player.Center); + float distanceFromPlayer = Projectile.Distance(player.Center); if (distanceFromPlayer > 3000f) - projectile.Kill(); + Projectile.Kill(); // This is done instead of a Normalize or DirectionTo call because the variables needed are already present and calculating the square root again would be unnecessary. - Vector2 idealVelocity = (player.Center - projectile.Center) / distanceFromPlayer * ReturnMaxSpeed; + Vector2 idealVelocity = (player.Center - Projectile.Center) / distanceFromPlayer * ReturnMaxSpeed; - projectile.velocity.X += Math.Sign(idealVelocity.X - projectile.velocity.X) * ReturnAcceleration; - projectile.velocity.Y += Math.Sign(idealVelocity.Y - projectile.velocity.Y) * ReturnAcceleration; + Projectile.velocity.X += Math.Sign(idealVelocity.X - Projectile.velocity.X) * ReturnAcceleration; + Projectile.velocity.Y += Math.Sign(idealVelocity.Y - Projectile.velocity.Y) * ReturnAcceleration; if (Time % LaserFireRate == 0f) - AttemptToFireLasers((int)(projectile.damage * 0.25)); + AttemptToFireLasers((int)(Projectile.damage * 0.25)); - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - if (projectile.Hitbox.Intersects(player.Hitbox)) - projectile.Kill(); + if (Projectile.Hitbox.Intersects(player.Hitbox)) + Projectile.Kill(); } } - projectile.rotation += 0.25f; + Projectile.rotation += 0.25f; } public void AttemptToFireLasers(int damage) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { int targetCount = 0; List targets = Main.npc.Where(npc => { - return npc.active && projectile.Distance(npc.Center) < MaxTargetSearchDistance && npc.CanBeChasedBy(); + return npc.active && Projectile.Distance(npc.Center) < MaxTargetSearchDistance && npc.CanBeChasedBy(); }).ToList(); foreach (var target in targets) { if (targetCount >= MaxLaserCountPerShot) break; - Projectile laser = Projectile.NewProjectileDirect(projectile.Center, - projectile.SafeDirectionTo(target.Center) * 4f, + Projectile laser = Projectile.NewProjectileDirect(Projectile.Center, + Projectile.SafeDirectionTo(target.Center) * 4f, ModContent.ProjectileType(), damage, - projectile.knockBack, - projectile.owner, + Projectile.knockBack, + Projectile.owner, 1f); laser.scale *= 1.6f; laser.netUpdate = true; @@ -118,10 +118,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } else { - NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxTargetSearchDistance); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(MaxTargetSearchDistance); if (potentialTarget != null) { - Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(potentialTarget.Center) * 3f, ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center) * 3f, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner); } } } @@ -129,18 +129,18 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool OnTileCollide(Vector2 oldVelocity) { ReturningToPlayer = true; - projectile.tileCollide = false; - projectile.netUpdate = true; - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; + Projectile.tileCollide = false; + Projectile.netUpdate = true; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, ProjectileID.Sets.TrailCacheLength[projectile.type]); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, ProjectileID.Sets.TrailCacheLength[Projectile.type]); return false; } } diff --git a/Projectiles/DraedonsArsenal/UnstableMatter.cs b/Projectiles/DraedonsArsenal/UnstableMatter.cs index 7f63ae3e6a..12cc07deeb 100644 --- a/Projectiles/DraedonsArsenal/UnstableMatter.cs +++ b/Projectiles/DraedonsArsenal/UnstableMatter.cs @@ -11,14 +11,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public bool HasCollidedWithATile { - get => projectile.ai[0] == 1f; - set => projectile.ai[0] = value.ToInt(); + get => Projectile.ai[0] == 1f; + set => Projectile.ai[0] = value.ToInt(); } public float Time { - get => projectile.ai[1]; - set => projectile.ai[1] = value; + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; } public override void SetStaticDefaults() @@ -28,19 +28,19 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = true; - projectile.penetrate = -1; - projectile.timeLeft = 480; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 480; } public override void AI() { // Cast some lime light at the projectile's position. - Lighting.AddLight(projectile.Center, Color.GreenYellow.ToVector3()); + Lighting.AddLight(Projectile.Center, Color.GreenYellow.ToVector3()); Time++; if (Time >= 10f) GenerateIdleDust(); @@ -55,15 +55,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // The faster the projectile itself is, the slower the dust, and the longer it lasts. // This is done to give the projectile a "streak" movement the faster it is versus a expansion. int dustCount = HasCollidedWithATile ? 5 : 12; - float baseSpeedRatio = Utils.InverseLerp(6f, 14f, projectile.velocity.Length(), true); + float baseSpeedRatio = Utils.InverseLerp(6f, 14f, Projectile.velocity.Length(), true); float speed = MathHelper.Lerp(6f, 1.8f, (float)Math.Pow(baseSpeedRatio, 3f)); if (!HasCollidedWithATile) speed += MathHelper.Lerp(-6f, 4f, Utils.InverseLerp(10f, 150f, Time, true)); float persistence = MathHelper.Lerp(0f, 0.8f, baseSpeedRatio); for (int i = 0; i < dustCount; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, 107); - dust.velocity = Main.rand.NextVector2CircularEdge(speed, speed) - projectile.velocity; + Dust dust = Dust.NewDustPerfect(Projectile.Center, 107); + dust.velocity = Main.rand.NextVector2CircularEdge(speed, speed) - Projectile.velocity; dust.fadeIn = persistence; dust.scale = 0.9f; dust.noGravity = true; @@ -74,8 +74,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { if (!HasCollidedWithATile) damage /= 3; - else if (projectile.penetrate == -1) - projectile.penetrate = 1; + else if (Projectile.penetrate == -1) + Projectile.penetrate = 1; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -86,20 +86,20 @@ namespace CalamityMod.Projectiles.DraedonsArsenal HasCollidedWithATile = true; // And bounce off the tile. Or towards a nearby enemy, if there is one. - NPC potentialTarget = projectile.Center.ClosestNPCAt(700f, false); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(700f, false); if (potentialTarget != null) - projectile.velocity = projectile.SafeDirectionTo(potentialTarget.Center); + Projectile.velocity = Projectile.SafeDirectionTo(potentialTarget.Center); else { - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; } - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * 14f; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 14f; - projectile.netUpdate = true; + Projectile.netUpdate = true; return false; } return true; diff --git a/Projectiles/DraedonsArsenal/VoltageStream.cs b/Projectiles/DraedonsArsenal/VoltageStream.cs index 1654868696..229170770f 100644 --- a/Projectiles/DraedonsArsenal/VoltageStream.cs +++ b/Projectiles/DraedonsArsenal/VoltageStream.cs @@ -12,14 +12,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public NPC Target { - get => Main.npc[(int)projectile.ai[1]]; - set => projectile.ai[1] = value.whoAmI; + get => Main.npc[(int)Projectile.ai[1]]; + set => Projectile.ai[1] = value.whoAmI; } public override void SetStaticDefaults() @@ -29,25 +29,25 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 5; - projectile.timeLeft = 180; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 12; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 5; + Projectile.timeLeft = 180; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.SkyBlue.ToVector3()); + Lighting.AddLight(Projectile.Center, Color.SkyBlue.ToVector3()); if (!Target.active) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.Center = Target.Center; + Projectile.Center = Target.Center; if (Time < 90f) { float completionRatio = Utils.InverseLerp(0f, 90f, Time, true); @@ -96,22 +96,22 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dust.noGravity = true; } Target.AddBuff(BuffID.Electrified, 180); - projectile.Kill(); + Projectile.Kill(); } Time++; - if (projectile.damage <= 0) - projectile.Kill(); + if (Projectile.damage <= 0) + Projectile.Kill(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.damage = (int)(projectile.damage * 0.75); + Projectile.damage = (int)(Projectile.damage * 0.75); } public override void OnHitPvp(Player target, int damage, bool crit) { - projectile.damage = (int)(projectile.damage * 0.75); + Projectile.damage = (int)(Projectile.damage * 0.75); } } } diff --git a/Projectiles/DraedonsArsenal/WavePounderBoom.cs b/Projectiles/DraedonsArsenal/WavePounderBoom.cs index d7f2aadaf1..dfedb301a8 100644 --- a/Projectiles/DraedonsArsenal/WavePounderBoom.cs +++ b/Projectiles/DraedonsArsenal/WavePounderBoom.cs @@ -7,23 +7,23 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public class WavePounderBoom : BaseMassiveExplosionProjectile { public override int Lifetime => 60; - public override bool UsesScreenshake => projectile.Calamity().stealthStrike; + public override bool UsesScreenshake => Projectile.Calamity().stealthStrike; public override float GetScreenshakePower(float pulseCompletionRatio) => CalamityUtils.Convert01To010(pulseCompletionRatio) * 16f; public override Color GetCurrentExplosionColor(float pulseCompletionRatio) => Color.Lerp(Color.Yellow * 1.6f, Color.White, MathHelper.Clamp(pulseCompletionRatio * 2.2f, 0f, 1f)); public override void SetStaticDefaults() => DisplayName.SetDefault("Explosion"); public override void SetDefaults() { - projectile.width = projectile.height = 2; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.timeLeft = Lifetime; - projectile.Calamity().rogue = true; + Projectile.width = Projectile.height = 2; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.timeLeft = Lifetime; + Projectile.Calamity().rogue = true; } - public override void PostAI() => Lighting.AddLight(projectile.Center, 0.2f, 0.1f, 0f); + public override void PostAI() => Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f); } } diff --git a/Projectiles/DraedonsArsenal/WavePounderProjectile.cs b/Projectiles/DraedonsArsenal/WavePounderProjectile.cs index 14821d45b0..6af69f3a6f 100644 --- a/Projectiles/DraedonsArsenal/WavePounderProjectile.cs +++ b/Projectiles/DraedonsArsenal/WavePounderProjectile.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -15,23 +16,23 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.timeLeft = 180; - projectile.Calamity().rogue = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.timeLeft = 180; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.velocity.X != 0f) - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - else projectile.rotation = MathHelper.Pi; + if (Projectile.velocity.X != 0f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + else Projectile.rotation = MathHelper.Pi; - if (projectile.velocity.Y < 12f) - projectile.velocity.Y += 0.35f; + if (Projectile.velocity.Y < 12f) + Projectile.velocity.Y += 0.35f; // Generate some dust that moves towards the bomb to show that it's sucking in energy. if (!Main.dedServ) @@ -39,10 +40,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int i = 0; i < 2; i++) { float offset = Main.rand.NextFloat(38f, 42f); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) offset *= 1.66f; - Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2CircularEdge(offset, offset), 107); - dust.velocity = projectile.DirectionFrom(dust.position) * offset / 12f + projectile.velocity; + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(offset, offset), 107); + dust.velocity = Projectile.DirectionFrom(dust.position) * offset / 12f + Projectile.velocity; dust.noGravity = true; } } @@ -50,14 +51,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void Kill(int timeLeft) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), projectile.Center); - if (Main.myPlayer == projectile.owner) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), Projectile.Center); + if (Main.myPlayer == Projectile.owner) { - if (!projectile.Calamity().stealthStrike) + if (!Projectile.Calamity().stealthStrike) { for (int i = 0; i < 5; i++) { - Projectile explosion = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile explosion = Projectile.NewProjectileDirect(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); explosion.ai[1] = Main.rand.NextFloat(110f, 200f) + i * 20f; // Randomize the maximum radius. explosion.localAI[1] = Main.rand.NextFloat(0.18f, 0.3f); // And the interpolation step. explosion.netUpdate = true; @@ -67,7 +68,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { for (int i = 0; i < 7; i++) { - Projectile explosion = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), projectile.knockBack, projectile.owner); + Projectile explosion = Projectile.NewProjectileDirect(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), Projectile.knockBack, Projectile.owner); if (explosion.whoAmI.WithinBounds(Main.maxProjectiles)) { explosion.ai[1] = Main.rand.NextFloat(320f, 870f) + i * 45f; // Randomize the maximum radius. @@ -83,7 +84,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.velocity = Vector2.Zero; + Projectile.velocity = Vector2.Zero; return false; } } diff --git a/Projectiles/Enemy/BelchingCoralSpike.cs b/Projectiles/Enemy/BelchingCoralSpike.cs index d3d827ddca..b993f0d1d4 100644 --- a/Projectiles/Enemy/BelchingCoralSpike.cs +++ b/Projectiles/Enemy/BelchingCoralSpike.cs @@ -11,46 +11,46 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Spike"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 20; - projectile.hostile = true; - projectile.timeLeft = 480; - projectile.ignoreWater = true; + Projectile.width = 14; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.timeLeft = 480; + Projectile.ignoreWater = true; } public override void AI() { - if (projectile.ai[0]++ < 10f) + if (Projectile.ai[0]++ < 10f) { - projectile.alpha = (int)MathHelper.Lerp(255f, 0f, projectile.ai[0] / 10f); + Projectile.alpha = (int)MathHelper.Lerp(255f, 0f, Projectile.ai[0] / 10f); } else { - if (projectile.velocity.Y < 12f) - projectile.velocity.Y += 0.1f; + if (Projectile.velocity.Y < 12f) + Projectile.velocity.Y += 0.1f; } - projectile.tileCollide = projectile.ai[0] > 30f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.tileCollide = Projectile.ai[0] > 30f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { for (int i = 0; i <= 2; i++) { - int idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Enemy/CrabBoulder.cs b/Projectiles/Enemy/CrabBoulder.cs index 0a3d6d1b45..0838d7ba77 100644 --- a/Projectiles/Enemy/CrabBoulder.cs +++ b/Projectiles/Enemy/CrabBoulder.cs @@ -11,39 +11,39 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Boulder"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 26; - projectile.hostile = true; - projectile.timeLeft = 480; - projectile.ignoreWater = true; + Projectile.width = Projectile.height = 26; + Projectile.hostile = true; + Projectile.timeLeft = 480; + Projectile.ignoreWater = true; } public override void AI() { - if (projectile.ai[0]++ < 30f) + if (Projectile.ai[0]++ < 30f) { - projectile.scale = MathHelper.Lerp(0.004f, 1f, projectile.ai[0] / 30f); + Projectile.scale = MathHelper.Lerp(0.004f, 1f, Projectile.ai[0] / 30f); } else { - if (projectile.velocity.Y < 12f) - projectile.velocity.Y += 0.18f; + if (Projectile.velocity.Y < 12f) + Projectile.velocity.Y += 0.18f; } - projectile.tileCollide = projectile.ai[0] > 70f; - projectile.rotation += Math.Sign(projectile.velocity.X) * 0.08f; + Projectile.tileCollide = Projectile.ai[0] > 70f; + Projectile.rotation += Math.Sign(Projectile.velocity.X) * 0.08f; } public override void Kill(int timeLeft) { - Utils.PoofOfSmoke(projectile.Center); + Utils.PoofOfSmoke(Projectile.Center); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/CragmawAcidDrop.cs b/Projectiles/Enemy/CragmawAcidDrop.cs index 77192a616b..4ee9dbff1c 100644 --- a/Projectiles/Enemy/CragmawAcidDrop.cs +++ b/Projectiles/Enemy/CragmawAcidDrop.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.penetrate = -1; - projectile.hostile = true; - projectile.timeLeft = 240; - projectile.tileCollide = false; - projectile.ignoreWater = false; + Projectile.width = 16; + Projectile.height = 16; + Projectile.penetrate = -1; + Projectile.hostile = true; + Projectile.timeLeft = 240; + Projectile.tileCollide = false; + Projectile.ignoreWater = false; } public override void AI() { float homingSpeed = CalamityWorld.downedPolterghast ? 16.5f : 10f; - Player target = Main.player[Player.FindClosest(projectile.Center, 1, 1)]; - if (projectile.WithinRange(target.Center, 1200f) && projectile.timeLeft < 210) - projectile.velocity = (projectile.velocity * 59f + projectile.SafeDirectionTo(target.Center) * homingSpeed) / 60f; - projectile.Opacity = Utils.InverseLerp(0f, 25f, projectile.timeLeft, true); - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Player target = Main.player[Player.FindClosest(Projectile.Center, 1, 1)]; + if (Projectile.WithinRange(target.Center, 1200f) && Projectile.timeLeft < 210) + Projectile.velocity = (Projectile.velocity * 59f + Projectile.SafeDirectionTo(target.Center) * homingSpeed) / 60f; + Projectile.Opacity = Utils.InverseLerp(0f, 25f, Projectile.timeLeft, true); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Enemy { lightColor = Color.White; lightColor.A = 64; - return lightColor * projectile.Opacity; + return lightColor * Projectile.Opacity; } } } diff --git a/Projectiles/Enemy/CragmawBeam.cs b/Projectiles/Enemy/CragmawBeam.cs index c51f6137b5..389a35be75 100644 --- a/Projectiles/Enemy/CragmawBeam.cs +++ b/Projectiles/Enemy/CragmawBeam.cs @@ -26,13 +26,13 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = Lifetime; + Projectile.width = 22; + Projectile.height = 22; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = Lifetime; } // Netcode for sending and receiving shit @@ -40,59 +40,59 @@ namespace CalamityMod.Projectiles.Enemy public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - NPC body = Main.npc[(int)projectile.ai[1]]; + NPC body = Main.npc[(int)Projectile.ai[1]]; if (!body.active) - projectile.Kill(); + Projectile.Kill(); // Sometimes the beam would readjust to some other, weird angle. This fixes that. - if (projectile.velocity != -Vector2.UnitY) + if (Projectile.velocity != -Vector2.UnitY) { - projectile.velocity = -Vector2.UnitY; - projectile.netUpdate = true; + Projectile.velocity = -Vector2.UnitY; + Projectile.netUpdate = true; } - if (Main.npc[(int)projectile.ai[1]].active) + if (Main.npc[(int)Projectile.ai[1]].active) { - projectile.Center = Main.npc[(int)projectile.ai[1]].Top + new Vector2(0f, 4f); + Projectile.Center = Main.npc[(int)Projectile.ai[1]].Top + new Vector2(0f, 4f); } // How fat the laser is float laserSize = 1.6f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= Lifetime) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= Lifetime) { - projectile.Kill(); + Projectile.Kill(); return; } // Causes the effect where the laser appears to expand/contract at the beginning and end of its life - projectile.scale = (float)Math.Sin(projectile.localAI[0] * MathHelper.Pi / Lifetime) * 10f * laserSize; - if (projectile.scale > laserSize) + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * MathHelper.Pi / Lifetime) * 10f * laserSize; + if (Projectile.scale > laserSize) { - projectile.scale = laserSize; + Projectile.scale = laserSize; } - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - Vector2 samplingPoint = projectile.Center; + Vector2 samplingPoint = Projectile.Center; float[] samples = new float[3]; float determinedLength = 0f; - Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, maximumLength, samples); + Collision.LaserScan(samplingPoint, Projectile.velocity, Projectile.width * Projectile.scale, maximumLength, samples); for (int i = 0; i < samples.Length; i++) { determinedLength += samples[i]; @@ -102,22 +102,22 @@ namespace CalamityMod.Projectiles.Enemy determinedLength = MathHelper.Clamp(determinedLength, maximumLength * 0.5f, maximumLength); float lerpDelta = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], determinedLength, lerpDelta); - Vector2 beamEndPosiiton = projectile.Center + projectile.velocity * (projectile.localAI[1] - 6f); + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], determinedLength, lerpDelta); + Vector2 beamEndPosiiton = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 6f); // Release acid along the beam periodically. - if (projectile.timeLeft % 20 == 19 && Main.netMode != NetmodeID.MultiplayerClient) + if (Projectile.timeLeft % 20 == 19 && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 acidSpawnPosition = projectile.Center + projectile.velocity * projectile.localAI[1] * Main.rand.NextFloat(0.1f, 0.8f); + Vector2 acidSpawnPosition = Projectile.Center + Projectile.velocity * Projectile.localAI[1] * Main.rand.NextFloat(0.1f, 0.8f); if (!Main.player[Player.FindClosest(acidSpawnPosition, 1, 1)].WithinRange(acidSpawnPosition, 300f)) - Projectile.NewProjectile(acidSpawnPosition, Main.rand.NextVector2CircularEdge(8f, 8f), ModContent.ProjectileType(), projectile.damage / 2, 0f); + Projectile.NewProjectile(acidSpawnPosition, Main.rand.NextVector2CircularEdge(8f, 8f), ModContent.ProjectileType(), Projectile.damage / 2, 0f); } if (WorldGen.SolidTile((int)(beamEndPosiiton.X / 16), (int)(beamEndPosiiton.Y / 16))) { for (int i = 0; i < 4; i++) { - float theta = projectile.velocity.ToRotation() + Main.rand.NextBool(2).ToDirectionInt() * MathHelper.PiOver2; + float theta = Projectile.velocity.ToRotation() + Main.rand.NextBool(2).ToDirectionInt() * MathHelper.PiOver2; float speed = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 velocity = theta.ToRotationVector2() * speed; Dust dust = Dust.NewDustDirect(beamEndPosiiton, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, velocity.X, velocity.Y, 0, default, 1f); @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Enemy for (int i = 0; i < 8; i++) { Dust dust = Dust.NewDustPerfect(beamEndPosiiton, (int)CalamityDusts.SulfurousSeaAcid); - dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(55f)).RotatedBy(projectile.rotation); + dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(55f)).RotatedBy(Projectile.rotation); dust.noGravity = true; dust.scale = 1.8f; } @@ -142,43 +142,43 @@ namespace CalamityMod.Projectiles.Enemy } // Draw acid green light across the laser DelegateMethods.v3_1 = new Vector3(0.62f, 0.94f, 0.38f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) { return false; } - Texture2D laserTailTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/CragmawMireBeamBegin"); - Texture2D laserBodyTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/CragmawMireBeamMid"); - Texture2D laserHeadTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/CragmawMireBeamEnd"); - float laserLength = projectile.localAI[1]; + Texture2D laserTailTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/CragmawMireBeamBegin"); + Texture2D laserBodyTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/CragmawMireBeamMid"); + Texture2D laserHeadTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/CragmawMireBeamEnd"); + float laserLength = Projectile.localAI[1]; Color drawColor = new Color(1f, 1f, 1f) * 0.9f; // Laser tail logic - Main.spriteBatch.Draw(laserTailTexture, projectile.Center - Main.screenPosition, null, drawColor, projectile.rotation, laserTailTexture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(laserTailTexture, Projectile.Center - Main.screenPosition, null, drawColor, Projectile.rotation, laserTailTexture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); // Laser body logic - laserLength -= (laserTailTexture.Height / 2 + laserHeadTexture.Height) * projectile.scale; - Vector2 centerDelta = projectile.Center; - centerDelta += projectile.velocity * projectile.scale * (float)laserTailTexture.Height / 2f; + laserLength -= (laserTailTexture.Height / 2 + laserHeadTexture.Height) * Projectile.scale; + Vector2 centerDelta = Projectile.Center; + centerDelta += Projectile.velocity * Projectile.scale * (float)laserTailTexture.Height / 2f; if (laserLength > 0f) { float laserLengthDelta = 0f; - Rectangle sourceRectangle = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 16); + Rectangle sourceRectangle = new Rectangle(0, 16 * (Projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 16); while (laserLengthDelta + 1f < laserLength) { if (laserLength - laserLengthDelta < sourceRectangle.Height) { sourceRectangle.Height = (int)(laserLength - laserLengthDelta); } - Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); - laserLengthDelta += sourceRectangle.Height * projectile.scale; - centerDelta += projectile.velocity * sourceRectangle.Height * projectile.scale; + Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, Projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), Projectile.scale, SpriteEffects.None, 0f); + laserLengthDelta += sourceRectangle.Height * Projectile.scale; + centerDelta += Projectile.velocity * sourceRectangle.Height * Projectile.scale; sourceRectangle.Y += 16; if (sourceRectangle.Y + sourceRectangle.Height > laserBodyTexture.Height) { @@ -189,15 +189,15 @@ namespace CalamityMod.Projectiles.Enemy // Laser head logic - Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, projectile.rotation, laserHeadTexture.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, Projectile.rotation, laserHeadTexture.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Projectile.localAI[1], (float)Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -207,7 +207,7 @@ namespace CalamityMod.Projectiles.Enemy return true; } float value = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref value)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref value)) { return true; } diff --git a/Projectiles/Enemy/CragmawBubble.cs b/Projectiles/Enemy/CragmawBubble.cs index 907468cd1a..ce95fa6d57 100644 --- a/Projectiles/Enemy/CragmawBubble.cs +++ b/Projectiles/Enemy/CragmawBubble.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { @@ -15,84 +16,84 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Bubble"); - Main.projFrames[projectile.type] = 7; + Main.projFrames[Projectile.type] = 7; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 0.01f; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.timeLeft = 240; - projectile.penetrate = 1; + Projectile.width = 30; + Projectile.height = 30; + Projectile.scale = 0.01f; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.timeLeft = 240; + Projectile.penetrate = 1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 6) + if (Projectile.frame > 6) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.localAI[1] < 1f) + if (Projectile.localAI[1] < 1f) { - projectile.localAI[1] += 0.01f; - projectile.scale += 0.01f; - projectile.width = (int)(30f * projectile.scale); - projectile.height = (int)(30f * projectile.scale); + Projectile.localAI[1] += 0.01f; + Projectile.scale += 0.01f; + Projectile.width = (int)(30f * Projectile.scale); + Projectile.height = (int)(30f * Projectile.scale); } else { - projectile.damage = 20; - projectile.width = 30; - projectile.height = 30; - projectile.tileCollide = true; + Projectile.damage = 20; + Projectile.width = 30; + Projectile.height = 30; + Projectile.tileCollide = true; } - if (projectile.localAI[0] > 2f) + if (Projectile.localAI[0] > 2f) { - projectile.alpha -= 20; - if (projectile.alpha < 100) + Projectile.alpha -= 20; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } } else { - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (projectile.ai[1] > 30f) + if (Projectile.ai[1] > 30f) { - if (projectile.velocity.Y > -8f) + if (Projectile.velocity.Y > -8f) { - projectile.velocity.Y -= 0.125f; + Projectile.velocity.Y -= 0.125f; } } else { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); for (int i = 0; i < 36; i++) { float angle = MathHelper.TwoPi * i / 36f; @@ -100,13 +101,13 @@ namespace CalamityMod.Projectiles.Enemy if (!float.IsNaN(y)) { Vector2 velocity = new Vector2((float)Math.Cos(angle), y) * 3f; - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); dust.velocity = velocity; dust.noGravity = true; dust.scale = 2f; velocity = new Vector2(y, (float)Math.Cos(angle)) * 3f; - dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); + dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); dust.velocity = velocity; dust.noGravity = true; dust.scale = 2f; @@ -117,8 +118,8 @@ namespace CalamityMod.Projectiles.Enemy if (Main.netMode != NetmodeID.MultiplayerClient) { float angle = MathHelper.TwoPi / 4f * i + MathHelper.PiOver2; - Projectile.NewProjectileDirect(projectile.Center, angle.ToRotationVector2().RotatedByRandom(0.1f) * 8f, ModContent.ProjectileType(), - projectile.damage, 3f).tileCollide = true; + Projectile.NewProjectileDirect(Projectile.Center, angle.ToRotationVector2().RotatedByRandom(0.1f) * 8f, ModContent.ProjectileType(), + Projectile.damage, 3f).tileCollide = true; } } } diff --git a/Projectiles/Enemy/CragmawExplosion.cs b/Projectiles/Enemy/CragmawExplosion.cs index 53f7195916..478e606193 100644 --- a/Projectiles/Enemy/CragmawExplosion.cs +++ b/Projectiles/Enemy/CragmawExplosion.cs @@ -22,19 +22,19 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 140; - projectile.height = 290; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.tileCollide = false; - projectile.hide = true; + Projectile.width = 140; + Projectile.height = 290; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.hide = true; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter % 6 == 0) + Projectile.frameCounter++; + if (Projectile.frameCounter % 6 == 0) { FrameY += 1; if (FrameY >= 7) @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Enemy FrameY = 0; } if (FrameX >= 2) - projectile.Kill(); + Projectile.Kill(); } } @@ -59,8 +59,8 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Rectangle frame = new Rectangle(FrameX * projectile.width, FrameY * projectile.height, projectile.width, projectile.height); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SulphuricNukesplosion"), projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2f, 1f, SpriteEffects.None, 0f); + Rectangle frame = new Rectangle(FrameX * Projectile.width, FrameY * Projectile.height, Projectile.width, Projectile.height); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Rogue/SulphuricNukesplosion"), Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2f, 1f, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Enemy/CragmawSpike.cs b/Projectiles/Enemy/CragmawSpike.cs index 75796191b8..6bbc9626d7 100644 --- a/Projectiles/Enemy/CragmawSpike.cs +++ b/Projectiles/Enemy/CragmawSpike.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.penetrate = -1; - projectile.hostile = true; - projectile.timeLeft = 600; - projectile.tileCollide = false; - projectile.ignoreWater = false; + Projectile.width = 16; + Projectile.height = 16; + Projectile.penetrate = -1; + Projectile.hostile = true; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; + Projectile.ignoreWater = false; } public override void AI() { float maxSpeed = CalamityWorld.downedPolterghast ? 19.5f : 11.5f; - if (projectile.velocity.Length() < maxSpeed) - projectile.velocity *= 1.024f; + if (Projectile.velocity.Length() < maxSpeed) + Projectile.velocity *= 1.024f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -42,10 +42,10 @@ namespace CalamityMod.Projectiles.Enemy { for (int i = 0; i < 3; i++) { - int idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Enemy/CragmawVibeCheckChain.cs b/Projectiles/Enemy/CragmawVibeCheckChain.cs index a54ea38352..2e71124fce 100644 --- a/Projectiles/Enemy/CragmawVibeCheckChain.cs +++ b/Projectiles/Enemy/CragmawVibeCheckChain.cs @@ -16,85 +16,85 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = projectile.height = 12; - projectile.alpha = 255; - projectile.timeLeft = Lifetime; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = Projectile.height = 12; + Projectile.alpha = 255; + Projectile.timeLeft = Lifetime; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); writer.Write(ReelingPlayer); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); ReelingPlayer = reader.ReadBoolean(); } public override void AI() { Vector2 offsetDrawVector = new Vector2(0f, 30f); - projectile.alpha -= 15; - if (projectile.alpha < 0) + Projectile.alpha -= 15; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - int toTarget = (int)projectile.ai[1]; - if (!Main.npc[(int)projectile.ai[0]].active) + int toTarget = (int)Projectile.ai[1]; + if (!Main.npc[(int)Projectile.ai[0]].active) { - projectile.Kill(); + Projectile.Kill(); return; } - Vector2 drawPosition = ReelingPlayer ? Main.player[toTarget].Center : projectile.Center; - projectile.rotation = (Main.npc[(int)projectile.ai[0]].Top - drawPosition + offsetDrawVector).ToRotation() + MathHelper.PiOver2; - if (projectile.localAI[0] == 0f) + Vector2 drawPosition = ReelingPlayer ? Main.player[toTarget].Center : Projectile.Center; + Projectile.rotation = (Main.npc[(int)Projectile.ai[0]].Top - drawPosition + offsetDrawVector).ToRotation() + MathHelper.PiOver2; + if (Projectile.localAI[0] == 0f) { - projectile.velocity = (projectile.velocity * 10f + projectile.SafeDirectionTo(Main.player[toTarget].Center) * 9f) / 11f; - if (projectile.timeLeft <= 180f) + Projectile.velocity = (Projectile.velocity * 10f + Projectile.SafeDirectionTo(Main.player[toTarget].Center) * 9f) / 11f; + if (Projectile.timeLeft <= 180f) { - projectile.localAI[0] = 1f; - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.netUpdate = true; } - if (projectile.WithinRange(Main.player[toTarget].Center, 16f)) + if (Projectile.WithinRange(Main.player[toTarget].Center, 16f)) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; ReelingPlayer = true; - projectile.netUpdate = true; + Projectile.netUpdate = true; } } else { if (ReelingPlayer) - Main.player[toTarget].velocity = Vector2.Lerp(Main.player[toTarget].velocity, projectile.velocity, 0.024f); + Main.player[toTarget].velocity = Vector2.Lerp(Main.player[toTarget].velocity, Projectile.velocity, 0.024f); if (Main.player[toTarget].dead) ReelingPlayer = false; - if (!Main.npc[(int)projectile.ai[0]].WithinRange(Main.player[toTarget].Center, 6f)) - projectile.velocity = (projectile.velocity * 16f + Main.player[toTarget].SafeDirectionTo(Main.npc[(int)projectile.ai[0]].Center) * 19f) / 17f; + if (!Main.npc[(int)Projectile.ai[0]].WithinRange(Main.player[toTarget].Center, 6f)) + Projectile.velocity = (Projectile.velocity * 16f + Main.player[toTarget].SafeDirectionTo(Main.npc[(int)Projectile.ai[0]].Center) * 19f) / 17f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D endTexture = ModContent.GetTexture(Texture); - Texture2D chainTexture = ModContent.GetTexture("CalamityMod/Projectiles/Enemy/CragmawVibeCheckMid"); - Vector2 drawPosition = ReelingPlayer ? Main.player[(int)projectile.ai[1]].Center : projectile.Center; - Vector2 distanceVectorToStart = Main.npc[(int)projectile.ai[0]].Top + Vector2.UnitY * 30f - drawPosition; + Texture2D endTexture = ModContent.Request(Texture); + Texture2D chainTexture = ModContent.Request("CalamityMod/Projectiles/Enemy/CragmawVibeCheckMid"); + Vector2 drawPosition = ReelingPlayer ? Main.player[(int)Projectile.ai[1]].Center : Projectile.Center; + Vector2 distanceVectorToStart = Main.npc[(int)Projectile.ai[0]].Top + Vector2.UnitY * 30f - drawPosition; float distanceToStart = distanceVectorToStart.Length(); Vector2 directionToStart = Vector2.Normalize(distanceVectorToStart); Rectangle frameRectangle = endTexture.Frame(1, 1, 0, 0); frameRectangle.Height /= 4; - frameRectangle.Y += projectile.frame * frameRectangle.Height; + frameRectangle.Y += Projectile.frame * frameRectangle.Height; - spriteBatch.Draw(endTexture, drawPosition - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(frameRectangle), projectile.GetAlpha(lightColor), projectile.rotation, frameRectangle.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(endTexture, drawPosition - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(frameRectangle), Projectile.GetAlpha(lightColor), Projectile.rotation, frameRectangle.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); - distanceToStart -= (frameRectangle.Height / 2 + chainTexture.Height) * projectile.scale; + distanceToStart -= (frameRectangle.Height / 2 + chainTexture.Height) * Projectile.scale; Vector2 chainDrawPosition = drawPosition; - chainDrawPosition += directionToStart * projectile.scale * frameRectangle.Height / 2f; + chainDrawPosition += directionToStart * Projectile.scale * frameRectangle.Height / 2f; if (distanceToStart > 0f) { float distanceMoved = 0f; @@ -108,9 +108,9 @@ namespace CalamityMod.Projectiles.Enemy Point chainPositionTileCoords = chainDrawPosition.ToTileCoordinates(); Color colorAtChainPosition = Lighting.GetColor(chainPositionTileCoords.X, chainPositionTileCoords.Y); colorAtChainPosition = Color.Lerp(colorAtChainPosition, Color.White, 0.3f); - spriteBatch.Draw(chainTexture, chainDrawPosition - Main.screenPosition, new Rectangle?(chainTextureFrameRectangle), projectile.GetAlpha(colorAtChainPosition), projectile.rotation, chainTextureFrameRectangle.Bottom(), projectile.scale, SpriteEffects.None, 0f); - distanceMoved += chainTextureFrameRectangle.Height * projectile.scale; - chainDrawPosition += directionToStart * chainTextureFrameRectangle.Height * projectile.scale; + spriteBatch.Draw(chainTexture, chainDrawPosition - Main.screenPosition, new Rectangle?(chainTextureFrameRectangle), Projectile.GetAlpha(colorAtChainPosition), Projectile.rotation, chainTextureFrameRectangle.Bottom(), Projectile.scale, SpriteEffects.None, 0f); + distanceMoved += chainTextureFrameRectangle.Height * Projectile.scale; + chainDrawPosition += directionToStart * chainTextureFrameRectangle.Height * Projectile.scale; } } return false; diff --git a/Projectiles/Enemy/CrimsonSpike.cs b/Projectiles/Enemy/CrimsonSpike.cs index 16c948f9f8..0dd97fe6a0 100644 --- a/Projectiles/Enemy/CrimsonSpike.cs +++ b/Projectiles/Enemy/CrimsonSpike.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { @@ -14,38 +15,38 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.alpha = 255; - projectile.aiStyle = 1; - projectile.penetrate = -1; + Projectile.width = 6; + Projectile.height = 6; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.aiStyle = 1; + Projectile.penetrate = -1; } public override void AI() { - if (projectile.alpha == 0 && Main.rand.NextBool(3)) + if (Projectile.alpha == 0 && Main.rand.NextBool(3)) { - int num67 = Dust.NewDust(projectile.position - projectile.velocity * 3f, projectile.width, projectile.height, 260, 0f, 0f, 50, new Color(255, 136, 78, 150), 1.2f); + int num67 = Dust.NewDust(Projectile.position - Projectile.velocity * 3f, Projectile.width, Projectile.height, 260, 0f, 0f, 50, new Color(255, 136, 78, 150), 1.2f); Main.dust[num67].velocity *= 0.3f; - Main.dust[num67].velocity += projectile.velocity * 0.3f; + Main.dust[num67].velocity += Projectile.velocity * 0.3f; Main.dust[num67].noGravity = true; } - projectile.alpha -= 50; - if (projectile.alpha < 0) + Projectile.alpha -= 50; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item17, (int)projectile.position.X, (int)projectile.position.Y); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item17, (int)Projectile.position.X, (int)Projectile.position.Y); } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 5f) { - projectile.ai[0] = 5f; - projectile.velocity.Y = projectile.velocity.Y + 0.15f; + Projectile.ai[0] = 5f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.15f; } } @@ -58,7 +59,7 @@ namespace CalamityMod.Projectiles.Enemy { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 260, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 260, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Enemy/DraedonLaser.cs b/Projectiles/Enemy/DraedonLaser.cs index 3c586a3628..b77324fead 100644 --- a/Projectiles/Enemy/DraedonLaser.cs +++ b/Projectiles/Enemy/DraedonLaser.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { @@ -13,8 +14,8 @@ namespace CalamityMod.Projectiles.Enemy // The DrawBeam method relies on localAI[0] for its calculations. A different parameter won't work. public float TrailLength { - get => projectile.localAI[0]; - set => projectile.localAI[0] = value; + get => Projectile.localAI[0]; + set => Projectile.localAI[0] = value; } public const int MaxTrailPoints = 50; public override void SetStaticDefaults() @@ -24,31 +25,31 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.tileCollide = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 4; - projectile.timeLeft = 240; + Projectile.width = 6; + Projectile.height = 6; + Projectile.hostile = true; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 4; + Projectile.timeLeft = 240; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { // play a sound frame 1. changed this from space gun sound because that sound was way too annoying - var sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), projectile.Center); + var sound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), Projectile.Center); if (sound != null) sound.Volume *= 0.35f; - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } - projectile.alpha = (int)(Math.Sin(projectile.timeLeft / 240f * MathHelper.Pi) * 1.6f * 255f); - if (projectile.alpha > 255) - projectile.alpha = 255; + Projectile.alpha = (int)(Math.Sin(Projectile.timeLeft / 240f * MathHelper.Pi) * 1.6f * 255f); + if (Projectile.alpha > 255) + Projectile.alpha = 255; TrailLength += 1.5f; if (TrailLength > MaxTrailPoints) { @@ -58,6 +59,6 @@ namespace CalamityMod.Projectiles.Enemy public override Color? GetAlpha(Color lightColor) => new Color(255, 190, 255, 0); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(MaxTrailPoints, 1.5f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(MaxTrailPoints, 1.5f, lightColor); } } diff --git a/Projectiles/Enemy/EarthRockBig.cs b/Projectiles/Enemy/EarthRockBig.cs index 78ddbee317..839d787517 100644 --- a/Projectiles/Enemy/EarthRockBig.cs +++ b/Projectiles/Enemy/EarthRockBig.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class EarthRockBig : ModProjectile @@ -15,30 +16,30 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 32; - projectile.height = 32; - projectile.hostile = true; - projectile.penetrate = 3; - projectile.timeLeft = 600; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.width = 32; + Projectile.height = 32; + Projectile.hostile = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 600; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -46,23 +47,23 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCDeath14, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 60; - projectile.height = 60; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.NPCDeath14, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 60; + Projectile.height = 60; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 8, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -72,13 +73,13 @@ namespace CalamityMod.Projectiles.Enemy } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 1, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 1, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 8, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Enemy/EarthRockSmall.cs b/Projectiles/Enemy/EarthRockSmall.cs index 50fbd84713..53efce5554 100644 --- a/Projectiles/Enemy/EarthRockSmall.cs +++ b/Projectiles/Enemy/EarthRockSmall.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class EarthRockSmall : ModProjectile @@ -15,32 +16,32 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; + Projectile.width = 20; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCDeath14, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.NPCDeath14, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 8, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -50,13 +51,13 @@ namespace CalamityMod.Projectiles.Enemy } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 1, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 1, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 8, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 8, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Enemy/FlakAcid.cs b/Projectiles/Enemy/FlakAcid.cs index 6fd041b7e7..8bdde38606 100644 --- a/Projectiles/Enemy/FlakAcid.cs +++ b/Projectiles/Enemy/FlakAcid.cs @@ -13,39 +13,39 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Acid"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 50; - projectile.hostile = true; - projectile.timeLeft = 480; - projectile.tileCollide = true; - projectile.ignoreWater = true; + Projectile.width = 30; + Projectile.height = 50; + Projectile.hostile = true; + Projectile.timeLeft = 480; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; } public override void AI() { - if (projectile.ai[0]++ <= 30f) + if (Projectile.ai[0]++ <= 30f) { - projectile.alpha = (int)MathHelper.Lerp(255f, 0f, projectile.ai[0] / 30f); + Projectile.alpha = (int)MathHelper.Lerp(255f, 0f, Projectile.ai[0] / 30f); } - if (projectile.velocity.Y < 10f) - projectile.velocity.Y += 0.15f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.velocity.Y < 10f) + Projectile.velocity.Y += 0.15f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; for (int i = 0; i < Main.player.Length; i++) { - if (Main.player[i].Distance(projectile.Center) < 60f) + if (Main.player[i].Distance(Projectile.Center) < 60f) { - projectile.Kill(); + Projectile.Kill(); } } - if (Math.Sign(projectile.velocity.Y) != Math.Sign(projectile.oldVelocity.Y) && projectile.ai[0] >= 5f) + if (Math.Sign(Projectile.velocity.Y) != Math.Sign(Projectile.oldVelocity.Y) && Projectile.ai[0] >= 5f) { - projectile.Kill(); + Projectile.Kill(); } } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -54,18 +54,18 @@ namespace CalamityMod.Projectiles.Enemy } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 150); - projectile.Damage(); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 150); + Projectile.Damage(); for (int i = 0; i <= 40; i++) { - int idx = Dust.NewDust(projectile.position, 200, 200, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 200, 200, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; - Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (Main.dust[idx].position - projectile.Center).Length() / 30f; + Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (Main.dust[idx].position - Projectile.Center).Length() / 30f; Main.dust[idx].scale = 2.5f; } for (int i = 0; i <= 90; i++) { - int idx = Dust.NewDust(projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid); + int idx = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid); Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 8f; Main.dust[idx].scale = 3f; Main.dust[idx].noGravity = true; @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/FlameBurstHostile.cs b/Projectiles/Enemy/FlameBurstHostile.cs index 24384de399..8d4257bd36 100644 --- a/Projectiles/Enemy/FlameBurstHostile.cs +++ b/Projectiles/Enemy/FlameBurstHostile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class FlameBurstHostile : ModProjectile @@ -18,28 +19,28 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.timeLeft = 180; + Projectile.width = 6; + Projectile.height = 6; + Projectile.hostile = true; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.timeLeft = 180; } public override void AI() { if (count == 0f) { - Main.PlaySound(SoundID.Item73, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item73, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 20; + Projectile.height = 20; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -49,40 +50,40 @@ namespace CalamityMod.Projectiles.Enemy } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } count += 1f; } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 5; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 0.75f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 0.75f); Main.dust[num469].velocity *= 0f; } } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 200f && projectile.ai[1] > 40f) + int num103 = (int)Player.FindClosest(Projectile.Center, 1, 1); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] < 200f && Projectile.ai[1] > 40f) { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; + float scaleFactor2 = Projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - Projectile.Center; vector11.Normalize(); vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 24f + vector11) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; } - if (projectile.ai[0] < 0f) + if (Projectile.ai[0] < 0f) { - if (projectile.velocity.Length() < 18f) + if (Projectile.velocity.Length() < 18f) { - projectile.velocity *= 1.02f; + Projectile.velocity *= 1.02f; } } } @@ -96,7 +97,7 @@ namespace CalamityMod.Projectiles.Enemy { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 246, Projectile.oldVelocity.X * 0f, Projectile.oldVelocity.Y * 0f); } } } diff --git a/Projectiles/Enemy/GammaAcid.cs b/Projectiles/Enemy/GammaAcid.cs index 5847c76e60..92486ca96e 100644 --- a/Projectiles/Enemy/GammaAcid.cs +++ b/Projectiles/Enemy/GammaAcid.cs @@ -14,26 +14,26 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Acid"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 50; - projectile.hostile = true; - projectile.timeLeft = 480; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 30; + Projectile.height = 50; + Projectile.hostile = true; + Projectile.timeLeft = 480; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void AI() { - if (projectile.ai[0]++ <= 30f) + if (Projectile.ai[0]++ <= 30f) { - projectile.alpha = (int)MathHelper.Lerp(255f, 127f, projectile.ai[0] / 30f); + Projectile.alpha = (int)MathHelper.Lerp(255f, 127f, Projectile.ai[0] / 30f); } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override void OnHitPlayer(Player target, int damage, bool crit) { @@ -41,18 +41,18 @@ namespace CalamityMod.Projectiles.Enemy } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 80); - projectile.Damage(); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 80); + Projectile.Damage(); for (int i = 0; i <= 40; i++) { - int idx = Dust.NewDust(projectile.position, 100, 100, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 100, 100, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; - Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (Main.dust[idx].position - projectile.Center).Length() / 30f; + Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (Main.dust[idx].position - Projectile.Center).Length() / 30f; Main.dust[idx].scale = 2.5f; } for (int i = 0; i <= 90; i++) { - int idx = Dust.NewDust(projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid); + int idx = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid); Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 8f; Main.dust[idx].scale = 3f; Main.dust[idx].noGravity = true; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/GammaBeam.cs b/Projectiles/Enemy/GammaBeam.cs index afb65bd04c..65fd7aabff 100644 --- a/Projectiles/Enemy/GammaBeam.cs +++ b/Projectiles/Enemy/GammaBeam.cs @@ -26,13 +26,13 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = TrueTimeLeft; + Projectile.width = 22; + Projectile.height = 22; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = TrueTimeLeft; } // Netcode for sending and receiving shit @@ -40,62 +40,62 @@ namespace CalamityMod.Projectiles.Enemy public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - NPC body = Main.npc[(int)projectile.ai[1]]; + NPC body = Main.npc[(int)Projectile.ai[1]]; if (!body.active) - projectile.Kill(); + Projectile.Kill(); - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) { - projectile.velocity = -Vector2.UnitY; + Projectile.velocity = -Vector2.UnitY; } - if (Main.npc[(int)projectile.ai[1]].active) + if (Main.npc[(int)Projectile.ai[1]].active) { - projectile.Center = Main.npc[(int)projectile.ai[1]].Top + new Vector2(0f, 6f); + Projectile.Center = Main.npc[(int)Projectile.ai[1]].Top + new Vector2(0f, 6f); } - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) { - projectile.velocity = -Vector2.UnitY; + Projectile.velocity = -Vector2.UnitY; } // How fat the laser is float laserSize = 1f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= TrueTimeLeft) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= TrueTimeLeft) { - projectile.Kill(); + Projectile.Kill(); return; } // Causes the effect where the laser appears to expand/contract at the beginning and end of its life - projectile.scale = (float)Math.Sin(projectile.localAI[0] * MathHelper.Pi / TrueTimeLeft) * 10f * laserSize; - if (projectile.scale > laserSize) + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * MathHelper.Pi / TrueTimeLeft) * 10f * laserSize; + if (Projectile.scale > laserSize) { - projectile.scale = laserSize; + Projectile.scale = laserSize; } - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - Vector2 samplingPoint = projectile.Center; + Vector2 samplingPoint = Projectile.Center; float[] samples = new float[3]; float determinedLength = 0f; - Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, maximumLength, samples); + Collision.LaserScan(samplingPoint, Projectile.velocity, Projectile.width * Projectile.scale, maximumLength, samples); for (int i = 0; i < samples.Length; i++) { determinedLength += samples[i]; @@ -105,14 +105,14 @@ namespace CalamityMod.Projectiles.Enemy determinedLength = MathHelper.Clamp(determinedLength, maximumLength * 0.5f, maximumLength); float lerpDelta = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], determinedLength, lerpDelta); - Vector2 beamEndPosiiton = projectile.Center + projectile.velocity * (projectile.localAI[1] - 6f); + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], determinedLength, lerpDelta); + Vector2 beamEndPosiiton = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 6f); if (WorldGen.SolidTile((int)(beamEndPosiiton.X / 16), (int)(beamEndPosiiton.Y / 16))) { for (int i = 0; i < 4; i++) { - float theta = projectile.velocity.ToRotation() + Main.rand.NextBool(2).ToDirectionInt() * MathHelper.PiOver2; + float theta = Projectile.velocity.ToRotation() + Main.rand.NextBool(2).ToDirectionInt() * MathHelper.PiOver2; float speed = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 velocity = theta.ToRotationVector2() * speed; Dust dust = Dust.NewDustDirect(beamEndPosiiton, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, velocity.X, velocity.Y, 0, default, 1f); @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Enemy for (int i = 0; i < 8; i++) { Dust dust = Dust.NewDustPerfect(beamEndPosiiton, (int)CalamityDusts.SulfurousSeaAcid); - dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(55f)).RotatedBy(projectile.rotation); + dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(55f)).RotatedBy(Projectile.rotation); dust.noGravity = true; dust.scale = 1.8f; } @@ -137,43 +137,43 @@ namespace CalamityMod.Projectiles.Enemy } // Draw acid green light across the laser DelegateMethods.v3_1 = new Vector3(0.62f, 0.94f, 0.38f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) { return false; } - Texture2D laserTailTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/GammaBeamBegin"); - Texture2D laserBodyTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/GammaBeamMid"); - Texture2D laserHeadTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/GammaBeamEnd"); - float laserLength = projectile.localAI[1]; + Texture2D laserTailTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/GammaBeamBegin"); + Texture2D laserBodyTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/GammaBeamMid"); + Texture2D laserHeadTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/GammaBeamEnd"); + float laserLength = Projectile.localAI[1]; Color drawColor = new Color(1f, 1f, 1f) * 0.9f; // Laser tail logic - Main.spriteBatch.Draw(laserTailTexture, projectile.Center - Main.screenPosition, null, drawColor, projectile.rotation, laserTailTexture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(laserTailTexture, Projectile.Center - Main.screenPosition, null, drawColor, Projectile.rotation, laserTailTexture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); // Laser body logic - laserLength -= (laserTailTexture.Height / 2 + laserHeadTexture.Height) * projectile.scale; - Vector2 centerDelta = projectile.Center; - centerDelta += projectile.velocity * projectile.scale * (float)laserTailTexture.Height / 2f; + laserLength -= (laserTailTexture.Height / 2 + laserHeadTexture.Height) * Projectile.scale; + Vector2 centerDelta = Projectile.Center; + centerDelta += Projectile.velocity * Projectile.scale * (float)laserTailTexture.Height / 2f; if (laserLength > 0f) { float laserLengthDelta = 0f; - Rectangle sourceRectangle = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 16); + Rectangle sourceRectangle = new Rectangle(0, 16 * (Projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 16); while (laserLengthDelta + 1f < laserLength) { if (laserLength - laserLengthDelta < sourceRectangle.Height) { sourceRectangle.Height = (int)(laserLength - laserLengthDelta); } - Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); - laserLengthDelta += sourceRectangle.Height * projectile.scale; - centerDelta += projectile.velocity * sourceRectangle.Height * projectile.scale; + Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, Projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), Projectile.scale, SpriteEffects.None, 0f); + laserLengthDelta += sourceRectangle.Height * Projectile.scale; + centerDelta += Projectile.velocity * sourceRectangle.Height * Projectile.scale; sourceRectangle.Y += 16; if (sourceRectangle.Y + sourceRectangle.Height > laserBodyTexture.Height) { @@ -184,15 +184,15 @@ namespace CalamityMod.Projectiles.Enemy // Laser head logic - Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, projectile.rotation, laserHeadTexture.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, Projectile.rotation, laserHeadTexture.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Projectile.localAI[1], (float)Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -202,7 +202,7 @@ namespace CalamityMod.Projectiles.Enemy return true; } float value = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref value)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref value)) { return true; } diff --git a/Projectiles/Enemy/HorsWaterBlast.cs b/Projectiles/Enemy/HorsWaterBlast.cs index 56520e7fe9..40a8b1cdfd 100644 --- a/Projectiles/Enemy/HorsWaterBlast.cs +++ b/Projectiles/Enemy/HorsWaterBlast.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { @@ -17,21 +18,21 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; + Projectile.width = 12; + Projectile.height = 12; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -39,22 +40,22 @@ namespace CalamityMod.Projectiles.Enemy Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item21, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item21, Projectile.position); } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.35f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); for (int num457 = 0; num457 < 10; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item21, projectile.position); + SoundEngine.PlaySound(SoundID.Item21, Projectile.position); for (int dust = 0; dust <= 40; dust++) { float num463 = (float)Main.rand.Next(-10, 11); @@ -64,10 +65,10 @@ namespace CalamityMod.Projectiles.Enemy num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; + Main.dust[num467].position.X = Projectile.Center.X; + Main.dust[num467].position.Y = Projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; diff --git a/Projectiles/Enemy/InkBombHostile.cs b/Projectiles/Enemy/InkBombHostile.cs index 2b0156afd7..e4cc997856 100644 --- a/Projectiles/Enemy/InkBombHostile.cs +++ b/Projectiles/Enemy/InkBombHostile.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { @@ -15,38 +16,38 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 10f) { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 10f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if (Projectile.velocity.X > -0.01f && Projectile.velocity.X < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y - 0.01f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.01f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCDeath28, projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath28, Projectile.position); int num251 = Main.rand.Next(5, 8); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { int num320 = Main.rand.Next(15, 21); for (int num321 = 0; num321 < num320; num321++) @@ -54,18 +55,18 @@ namespace CalamityMod.Projectiles.Enemy Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); vector15.Normalize(); vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType() + Main.rand.Next(3), (int)Math.Round(projectile.damage * 0.165), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType() + Main.rand.Next(3), (int)Math.Round(Projectile.damage * 0.165), 1f, Projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); } } - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 60; - projectile.height = 60; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 60; + Projectile.height = 60; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 54, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 54, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -75,20 +76,20 @@ namespace CalamityMod.Projectiles.Enemy } for (int num623 = 0; num623 < 15; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 109, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 109, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 109, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 109, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 12f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 12f, targetHitbox); public override void OnHitPlayer(Player target, int damage, bool crit) { target.AddBuff(BuffID.Darkness, 300, true); - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Enemy/InkPoisonCloud.cs b/Projectiles/Enemy/InkPoisonCloud.cs index c0b6736aac..d8ef02ecae 100644 --- a/Projectiles/Enemy/InkPoisonCloud.cs +++ b/Projectiles/Enemy/InkPoisonCloud.cs @@ -10,61 +10,61 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Ink Cloud"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 52; - projectile.height = 48; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; + Projectile.width = 52; + Projectile.height = 48; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 3600; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 9) + Projectile.frameCounter++; + if (Projectile.frameCounter > 9) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - projectile.velocity *= 0.99f; + Projectile.velocity *= 0.99f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 120f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 5; - if (projectile.alpha > 255) - projectile.alpha = 255; + Projectile.alpha += 5; + if (Projectile.alpha > 255) + Projectile.alpha = 255; } - else if (projectile.owner == Main.myPlayer) - projectile.Kill(); + else if (Projectile.owner == Main.myPlayer) + Projectile.Kill(); } - else if (projectile.alpha > 80) + else if (Projectile.alpha > 80) { - projectile.alpha -= 30; - if (projectile.alpha < 80) - projectile.alpha = 80; + Projectile.alpha -= 30; + if (Projectile.alpha < 80) + Projectile.alpha = 80; } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 20f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f, targetHitbox); - public override bool CanHitPlayer(Player target) => projectile.alpha == 80; + public override bool CanHitPlayer(Player target) => Projectile.alpha == 80; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.alpha == 80) + if (Projectile.alpha == 80) target.AddBuff(BuffID.Darkness, 300, true); } } diff --git a/Projectiles/Enemy/InkPoisonCloud2.cs b/Projectiles/Enemy/InkPoisonCloud2.cs index 6d9accc61a..ff72476209 100644 --- a/Projectiles/Enemy/InkPoisonCloud2.cs +++ b/Projectiles/Enemy/InkPoisonCloud2.cs @@ -10,61 +10,61 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Ink Cloud"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 52; - projectile.height = 48; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; + Projectile.width = 52; + Projectile.height = 48; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 3600; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 9) + Projectile.frameCounter++; + if (Projectile.frameCounter > 9) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - projectile.velocity *= 0.995f; + Projectile.velocity *= 0.995f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 120f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 5; - if (projectile.alpha > 255) - projectile.alpha = 255; + Projectile.alpha += 5; + if (Projectile.alpha > 255) + Projectile.alpha = 255; } - else if (projectile.owner == Main.myPlayer) - projectile.Kill(); + else if (Projectile.owner == Main.myPlayer) + Projectile.Kill(); } - else if (projectile.alpha > 80) + else if (Projectile.alpha > 80) { - projectile.alpha -= 30; - if (projectile.alpha < 80) - projectile.alpha = 80; + Projectile.alpha -= 30; + if (Projectile.alpha < 80) + Projectile.alpha = 80; } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 20f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f, targetHitbox); - public override bool CanHitPlayer(Player target) => projectile.alpha == 80; + public override bool CanHitPlayer(Player target) => Projectile.alpha == 80; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.alpha == 80) + if (Projectile.alpha == 80) target.AddBuff(BuffID.Darkness, 300, true); } } diff --git a/Projectiles/Enemy/InkPoisonCloud3.cs b/Projectiles/Enemy/InkPoisonCloud3.cs index cb8dad85c0..4aa05d5e04 100644 --- a/Projectiles/Enemy/InkPoisonCloud3.cs +++ b/Projectiles/Enemy/InkPoisonCloud3.cs @@ -10,61 +10,61 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Ink Cloud"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 52; - projectile.height = 48; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; + Projectile.width = 52; + Projectile.height = 48; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 3600; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 9) + Projectile.frameCounter++; + if (Projectile.frameCounter > 9) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - projectile.velocity *= 0.999f; + Projectile.velocity *= 0.999f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 120f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 5; - if (projectile.alpha > 255) - projectile.alpha = 255; + Projectile.alpha += 5; + if (Projectile.alpha > 255) + Projectile.alpha = 255; } - else if (projectile.owner == Main.myPlayer) - projectile.Kill(); + else if (Projectile.owner == Main.myPlayer) + Projectile.Kill(); } - else if (projectile.alpha > 80) + else if (Projectile.alpha > 80) { - projectile.alpha -= 30; - if (projectile.alpha < 80) - projectile.alpha = 80; + Projectile.alpha -= 30; + if (Projectile.alpha < 80) + Projectile.alpha = 80; } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 20f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f, targetHitbox); - public override bool CanHitPlayer(Player target) => projectile.alpha == 80; + public override bool CanHitPlayer(Player target) => Projectile.alpha == 80; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.alpha == 80) + if (Projectile.alpha == 80) target.AddBuff(BuffID.Darkness, 300, true); } } diff --git a/Projectiles/Enemy/LightningCloud.cs b/Projectiles/Enemy/LightningCloud.cs index 0635540f0b..235bb943f0 100644 --- a/Projectiles/Enemy/LightningCloud.cs +++ b/Projectiles/Enemy/LightningCloud.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class LightningCloud : ModProjectile @@ -9,46 +10,46 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 54; - projectile.height = 28; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.hostile = true; - projectile.timeLeft = 180; - projectile.Opacity = 0f; - projectile.penetrate = -1; + Projectile.width = 54; + Projectile.height = 28; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.hostile = true; + Projectile.timeLeft = 180; + Projectile.Opacity = 0f; + Projectile.penetrate = -1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frameCounter = 0; - projectile.frame++; + Projectile.frameCounter = 0; + Projectile.frame++; - int maxFrame = projectile.timeLeft < 60 ? 6 : 3; - if (projectile.frame >= maxFrame) - projectile.frame = 0; + int maxFrame = Projectile.timeLeft < 60 ? 6 : 3; + if (Projectile.frame >= maxFrame) + Projectile.frame = 0; - if (projectile.frame == 5 && Main.myPlayer == projectile.owner) + if (Projectile.frame == 5 && Main.myPlayer == Projectile.owner) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), Projectile.Center); float ai = Main.rand.Next(100); Vector2 velocity = Vector2.UnitY * 7f; - Projectile.NewProjectile(projectile.Bottom, velocity, ProjectileID.CultistBossLightningOrbArc, projectile.damage, 0f, projectile.owner, MathHelper.PiOver2, ai); + Projectile.NewProjectile(Projectile.Bottom, velocity, ProjectileID.CultistBossLightningOrbArc, Projectile.damage, 0f, Projectile.owner, MathHelper.PiOver2, ai); } } - if (projectile.timeLeft < 30) - projectile.Opacity = MathHelper.Lerp(projectile.Opacity, 0f, 0.14f); + if (Projectile.timeLeft < 30) + Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, 0f, 0.14f); else - projectile.Opacity = MathHelper.Lerp(projectile.Opacity, 1f, 0.33f); + Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, 1f, 0.33f); } } } diff --git a/Projectiles/Enemy/MantisRing.cs b/Projectiles/Enemy/MantisRing.cs index 52929ff3a1..366a3bba00 100644 --- a/Projectiles/Enemy/MantisRing.cs +++ b/Projectiles/Enemy/MantisRing.cs @@ -6,30 +6,31 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class MantisRing : ModProjectile { public override void SetStaticDefaults() { - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.knockBack = 3f; - projectile.width = 72; - projectile.height = 30; - projectile.hostile = true; - projectile.penetrate = 8; + Projectile.Calamity().canBreakPlayerDefense = true; + Projectile.knockBack = 3f; + Projectile.width = 72; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.penetrate = 8; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item1, projectile.Center); + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); for (int i = 0; i < 60; i++) { @@ -37,8 +38,8 @@ namespace CalamityMod.Projectiles.Enemy Vector2 angleVec = angle.ToRotationVector2(); float distance = Main.rand.NextFloat(14f, 36f); Vector2 off = angleVec * distance; - off.Y *= (float)projectile.height / projectile.width; - Vector2 pos = projectile.Center + off; + off.Y *= (float)Projectile.height / Projectile.width; + Vector2 pos = Projectile.Center + off; Dust d = Dust.NewDustPerfect(pos, ModContent.DustType(), angleVec * Main.rand.NextFloat(2f, 4f)); d.customData = true; } @@ -46,16 +47,16 @@ namespace CalamityMod.Projectiles.Enemy public override void AI() { - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; - if (projectile.frame > 2) + Projectile.frame++; + Projectile.frameCounter = 0; + if (Projectile.frame > 2) { - projectile.frame = 0; + Projectile.frame = 0; } } @@ -65,8 +66,8 @@ namespace CalamityMod.Projectiles.Enemy float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); float distance = Main.rand.NextFloat(14f, 36f); Vector2 off = angle.ToRotationVector2() * distance; - off.Y *= (float)projectile.height / projectile.width; - Vector2 pos = projectile.Center + off; + off.Y *= (float)Projectile.height / Projectile.width; + Vector2 pos = Projectile.Center + off; Dust.NewDustPerfect(pos, ModContent.DustType(), Vector2.Zero); } } @@ -78,7 +79,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/MaulerAcidBubble.cs b/Projectiles/Enemy/MaulerAcidBubble.cs index 953bd2f0af..b71bb921e2 100644 --- a/Projectiles/Enemy/MaulerAcidBubble.cs +++ b/Projectiles/Enemy/MaulerAcidBubble.cs @@ -4,66 +4,67 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class MaulerAcidBubble : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Projectiles/Enemy/SulphuricAcidBubble"; public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Bubble"); - Main.projFrames[projectile.type] = 7; + Main.projFrames[Projectile.type] = 7; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 150; - projectile.penetrate = -1; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 150; + Projectile.penetrate = -1; } public override void AI() { // Handle frames. - projectile.frameCounter++; - projectile.frame = projectile.frameCounter / 4 % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 4 % Main.projFrames[Projectile.type]; // Home in on players after a sufficient amount of time has passed. if (Time > 60f) { float flySpeed = Main.expertMode ? 17.5f : 14.5f; - Player target = Main.player[Player.FindClosest(projectile.Center, 1, 1)]; - if (!projectile.WithinRange(target.Center, 50f)) - projectile.velocity = (projectile.velocity * 49f + projectile.SafeDirectionTo(target.Center) * flySpeed) / 50f; - projectile.tileCollide = true; + Player target = Main.player[Player.FindClosest(Projectile.Center, 1, 1)]; + if (!Projectile.WithinRange(target.Center, 50f)) + Projectile.velocity = (Projectile.velocity * 49f + Projectile.SafeDirectionTo(target.Center) * flySpeed) / 50f; + Projectile.tileCollide = true; } // Emit light. - Lighting.AddLight(projectile.Center, 0.2f, 0.6f, 0.2f); + Lighting.AddLight(Projectile.Center, 0.2f, 0.6f, 0.2f); // Rotate. - projectile.rotation += projectile.direction * 0.04f; + Projectile.rotation += Projectile.direction * 0.04f; Time++; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Texture2D texture = Main.projectileTexture[Projectile.type]; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.localAI[1] < 1f) + if (Projectile.localAI[1] < 1f) { return; } @@ -72,7 +73,7 @@ namespace CalamityMod.Projectiles.Enemy public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); } } } diff --git a/Projectiles/Enemy/MaulerAcidDrop.cs b/Projectiles/Enemy/MaulerAcidDrop.cs index 0653f3e90c..92541899f6 100644 --- a/Projectiles/Enemy/MaulerAcidDrop.cs +++ b/Projectiles/Enemy/MaulerAcidDrop.cs @@ -15,22 +15,22 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.penetrate = -1; - projectile.hostile = true; - projectile.timeLeft = 240; - projectile.tileCollide = false; - projectile.ignoreWater = false; + Projectile.width = 16; + Projectile.height = 16; + Projectile.penetrate = -1; + Projectile.hostile = true; + Projectile.timeLeft = 240; + Projectile.tileCollide = false; + Projectile.ignoreWater = false; } public override void AI() { float homingSpeed = 16f; - Player target = Main.player[Player.FindClosest(projectile.Center, 1, 1)]; - if (projectile.WithinRange(target.Center, 1200f) && projectile.timeLeft < 210) - projectile.velocity = (projectile.velocity * 59f + projectile.SafeDirectionTo(target.Center) * homingSpeed) / 60f; - projectile.Opacity = Utils.InverseLerp(0f, 25f, projectile.timeLeft, true); - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Player target = Main.player[Player.FindClosest(Projectile.Center, 1, 1)]; + if (Projectile.WithinRange(target.Center, 1200f) && Projectile.timeLeft < 210) + Projectile.velocity = (Projectile.velocity * 59f + Projectile.SafeDirectionTo(target.Center) * homingSpeed) / 60f; + Projectile.Opacity = Utils.InverseLerp(0f, 25f, Projectile.timeLeft, true); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Enemy { lightColor = Color.White; lightColor.A = 64; - return lightColor * projectile.Opacity; + return lightColor * Projectile.Opacity; } } } diff --git a/Projectiles/Enemy/NuclearBulletLarge.cs b/Projectiles/Enemy/NuclearBulletLarge.cs index 341228dfc2..a6097de975 100644 --- a/Projectiles/Enemy/NuclearBulletLarge.cs +++ b/Projectiles/Enemy/NuclearBulletLarge.cs @@ -14,17 +14,17 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 30; - projectile.height = 18; - projectile.hostile = true; - projectile.timeLeft = 240; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 30; + Projectile.height = 18; + Projectile.hostile = true; + Projectile.timeLeft = 240; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.White.ToVector3() * 1.25f); - projectile.rotation = projectile.velocity.ToRotation(); + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 1.25f); + Projectile.rotation = Projectile.velocity.ToRotation(); } public override void OnHitPlayer(Player target, int damage, bool crit) { @@ -34,10 +34,10 @@ namespace CalamityMod.Projectiles.Enemy { for (int i = 0; i <= 2; i++) { - int idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Enemy/NuclearBulletMedium.cs b/Projectiles/Enemy/NuclearBulletMedium.cs index 3a2d7b8606..0f726a5cad 100644 --- a/Projectiles/Enemy/NuclearBulletMedium.cs +++ b/Projectiles/Enemy/NuclearBulletMedium.cs @@ -15,38 +15,38 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 24; - projectile.height = 12; - projectile.hostile = true; - projectile.timeLeft = 360; - projectile.tileCollide = true; - projectile.ignoreWater = true; + Projectile.width = 24; + Projectile.height = 12; + Projectile.hostile = true; + Projectile.timeLeft = 360; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.White.ToVector3() * 1.25f); - projectile.rotation = projectile.velocity.ToRotation(); - projectile.ai[0]++; - if (projectile.ai[0] < 85f) + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 1.25f); + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.ai[0]++; + if (Projectile.ai[0] < 85f) { - projectile.velocity.Y += Math.Sign(projectile.localAI[0]) * 0.1f; + Projectile.velocity.Y += Math.Sign(Projectile.localAI[0]) * 0.1f; } - if (projectile.ai[0] == 160f) + if (Projectile.ai[0] == 160f) { - projectile.ai[1] = Player.FindClosest(projectile.Center, 1, 1); + Projectile.ai[1] = Player.FindClosest(Projectile.Center, 1, 1); } - if (projectile.ai[0] >= 160f && projectile.ai[0] <= 200f) + if (Projectile.ai[0] >= 160f && Projectile.ai[0] <= 200f) { - Player player = Main.player[(int)projectile.ai[1]]; + Player player = Main.player[(int)Projectile.ai[1]]; float inertia = 10f; - if (projectile.Distance(player.Center) > 70f) - projectile.velocity = (projectile.velocity * inertia + projectile.SafeDirectionTo(player.Center) * 18.5f) / (inertia + 1f); + if (Projectile.Distance(player.Center) > 70f) + Projectile.velocity = (Projectile.velocity * inertia + Projectile.SafeDirectionTo(player.Center) * 18.5f) / (inertia + 1f); - projectile.tileCollide = true; + Projectile.tileCollide = true; } else { - projectile.tileCollide = false; + Projectile.tileCollide = false; } } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -57,10 +57,10 @@ namespace CalamityMod.Projectiles.Enemy { for (int i = 0; i <= 2; i++) { - int idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Enemy/NuclearToadGoo.cs b/Projectiles/Enemy/NuclearToadGoo.cs index f2d030ddec..188ba43111 100644 --- a/Projectiles/Enemy/NuclearToadGoo.cs +++ b/Projectiles/Enemy/NuclearToadGoo.cs @@ -9,27 +9,27 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Goop"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.hostile = true; - projectile.timeLeft = 600; - projectile.tileCollide = true; - projectile.ignoreWater = false; + Projectile.width = 18; + Projectile.height = 18; + Projectile.hostile = true; + Projectile.timeLeft = 600; + Projectile.tileCollide = true; + Projectile.ignoreWater = false; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.frame = Main.rand.Next(3); - projectile.localAI[0] = 1f; + Projectile.frame = Main.rand.Next(3); + Projectile.localAI[0] = 1f; } - if (projectile.velocity.Y < 10f) - projectile.velocity.Y += 0.175f; + if (Projectile.velocity.Y < 10f) + Projectile.velocity.Y += 0.175f; } public override void OnHitPlayer(Player target, int damage, bool crit) { @@ -39,10 +39,10 @@ namespace CalamityMod.Projectiles.Enemy { for (int i = 0; i <= 4; i++) { - int idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Enemy/OrthoceraStream.cs b/Projectiles/Enemy/OrthoceraStream.cs index 5586125397..3d830adf5b 100644 --- a/Projectiles/Enemy/OrthoceraStream.cs +++ b/Projectiles/Enemy/OrthoceraStream.cs @@ -16,50 +16,50 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.extraUpdates = 2; - projectile.tileCollide = false; + Projectile.width = 32; + Projectile.height = 32; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; } public override void AI() { - projectile.ai[1]++; - if (projectile.ai[1] >= 4f) + Projectile.ai[1]++; + if (Projectile.ai[1] >= 4f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - projectile.scale -= 0.002f; - if (projectile.scale <= 0f) + Projectile.scale -= 0.002f; + if (Projectile.scale <= 0f) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.ai[0] <= 3f) + if (Projectile.ai[0] <= 3f) { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; return; } - projectile.velocity.Y = projectile.velocity.Y + 0.075f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.075f; for (int i = 0; i < 3; i++) { - Vector2 positionDelta = projectile.velocity / 3f * i; + Vector2 positionDelta = Projectile.velocity / 3f * i; int spawnDelta = 14; - int dustIdx = Dust.NewDust(new Vector2(projectile.position.X + spawnDelta, projectile.position.Y + spawnDelta), projectile.width - spawnDelta * 2, projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); + int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[dustIdx]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.5f; + dust.velocity += Projectile.velocity * 0.5f; dust.position -= positionDelta; } if (Main.rand.NextBool(8)) { int spawnDelta = 16; - int dustIdx = Dust.NewDust(new Vector2(projectile.position.X + spawnDelta, projectile.position.Y + spawnDelta), projectile.width - spawnDelta * 2, projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 0.5f); + int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 0.5f); Main.dust[dustIdx].velocity *= 0.25f; - Main.dust[dustIdx].velocity += projectile.velocity * 0.5f; + Main.dust[dustIdx].velocity += Projectile.velocity * 0.5f; } } diff --git a/Projectiles/Enemy/PearlBurst.cs b/Projectiles/Enemy/PearlBurst.cs index 640e29cf15..8e401aa8f4 100644 --- a/Projectiles/Enemy/PearlBurst.cs +++ b/Projectiles/Enemy/PearlBurst.cs @@ -9,70 +9,70 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Pearl Burst"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 64; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.ignoreWater = true; - projectile.tileCollide = false; + Projectile.width = 40; + Projectile.height = 64; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); } - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - projectile.alpha -= 6; - projectile.ai[1] += 1f; - if (projectile.ai[1] <= 20f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Projectile.alpha -= 6; + Projectile.ai[1] += 1f; + if (Projectile.ai[1] <= 20f) { - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; + Projectile.velocity.X *= 0.975f; + Projectile.velocity.Y *= 0.975f; } - else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) + else if (Projectile.ai[1] > 20f && Projectile.ai[1] <= 39f) { - projectile.velocity.X *= 1.05f; - projectile.velocity.Y *= 1.05f; + Projectile.velocity.X *= 1.05f; + Projectile.velocity.Y *= 1.05f; } - else if (projectile.ai[1] == 40f) + else if (Projectile.ai[1] == 40f) { - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 30f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 92, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 92, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } } diff --git a/Projectiles/Enemy/PearlRain.cs b/Projectiles/Enemy/PearlRain.cs index 54a9ba18b6..c3cb7cf0be 100644 --- a/Projectiles/Enemy/PearlRain.cs +++ b/Projectiles/Enemy/PearlRain.cs @@ -11,40 +11,40 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Pearl Rain"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 64; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.ignoreWater = true; - projectile.tileCollide = false; + Projectile.width = 40; + Projectile.height = 64; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); } - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - projectile.alpha -= 6; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Projectile.alpha -= 6; } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Enemy/PufferExplosion.cs b/Projectiles/Enemy/PufferExplosion.cs index 1447a389a3..5639de619b 100644 --- a/Projectiles/Enemy/PufferExplosion.cs +++ b/Projectiles/Enemy/PufferExplosion.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class PufferExplosion : ModProjectile @@ -17,60 +18,60 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 210; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + Projectile.width = 250; + Projectile.height = 250; + Projectile.friendly = true; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 210; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.01f / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.localAI[0] += 1f; } bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -81,10 +82,10 @@ namespace CalamityMod.Projectiles.Enemy num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; + Main.dust[num467].position.X = Projectile.Center.X; + Main.dust[num467].position.Y = Projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; diff --git a/Projectiles/Enemy/StormMarkHostile.cs b/Projectiles/Enemy/StormMarkHostile.cs index d02d897805..4260f58cc7 100644 --- a/Projectiles/Enemy/StormMarkHostile.cs +++ b/Projectiles/Enemy/StormMarkHostile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class StormMarkHostile : ModProjectile @@ -16,25 +17,25 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 900; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; } public override void AI() { Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = -1; - Main.PlaySound(SoundID.Item60, projectile.Center); + Projectile.soundDelay = -1; + SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); } - if (projectile.localAI[1] < 30f) + if (Projectile.localAI[1] < 30f) { for (int num1134 = 0; num1134 < 1; num1134++) { @@ -45,10 +46,10 @@ namespace CalamityMod.Projectiles.Enemy value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); value81.X *= -1f; Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 16, 0f, 0f, 0, default, 0.5f)]; dust34.position = position4; - dust34.customData = projectile.Center + value82; + dust34.customData = Projectile.Center + value82; dust34.fadeIn = 1f; dust34.scale = 0.3f; if (value81.X > -1.2f) @@ -58,50 +59,50 @@ namespace CalamityMod.Projectiles.Enemy dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; } } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + Projectile.localAI[0] = 0.8f; + Projectile.direction = 1; + Point point9 = Projectile.Center.ToTileCoordinates(); + Projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) + Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; + if (Projectile.localAI[1] < 33f) { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 8; + Projectile.alpha -= 8; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } - if (projectile.localAI[1] > 103f) + if (Projectile.localAI[1] > 103f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 16; + Projectile.alpha += 16; } - if (projectile.alpha > 255) + if (Projectile.alpha > 255) { - projectile.alpha = 255; + Projectile.alpha = 255; } } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); } for (int num1135 = 0; num1135 < 2; num1135++) { if (Main.rand.NextBool(10)) { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust dust35 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; dust35.noGravity = true; dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; + dust35.scale = Projectile.Opacity * Projectile.localAI[0]; + dust35.position = Projectile.Center; dust35.velocity = value83 * 2.5f; } } @@ -110,52 +111,52 @@ namespace CalamityMod.Projectiles.Enemy if (Main.rand.NextBool(10)) { Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; + Dust dust36 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; dust36.noGravity = true; dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; + dust36.scale = Projectile.Opacity * Projectile.localAI[0]; + dust36.position = Projectile.Center; dust36.velocity = value84 * 2.5f; } } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + Projectile.velocity = Vector2.Zero; + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) { int num1137 = 40; if (Main.expertMode) { num1137 = 25; } - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), num1137, 3f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), num1137, 3f, Projectile.owner, 0f, 0f); } - if (projectile.localAI[1] >= 120f) + if (Projectile.localAI[1] >= 120f) { - projectile.Kill(); + Projectile.Kill(); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Color alpha5 = projectile.GetAlpha(color25); + Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[Projectile.type]; + Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alpha5 = Projectile.GetAlpha(color25); Vector2 origin7 = rectangle11.Size() / 2f; Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, Projectile.rotation, origin7, Projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Enemy/SulphuricAcidBubble.cs b/Projectiles/Enemy/SulphuricAcidBubble.cs index 1178ba5d9a..40c263f213 100644 --- a/Projectiles/Enemy/SulphuricAcidBubble.cs +++ b/Projectiles/Enemy/SulphuricAcidBubble.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { @@ -12,119 +13,119 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Bubble"); - Main.projFrames[projectile.type] = 7; + Main.projFrames[Projectile.type] = 7; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 0.01f; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.timeLeft = 360; - projectile.penetrate = 1; + Projectile.width = 30; + Projectile.height = 30; + Projectile.scale = 0.01f; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.timeLeft = 360; + Projectile.penetrate = 1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 6) + if (Projectile.frame > 6) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.localAI[1] < 1f) + if (Projectile.localAI[1] < 1f) { - projectile.localAI[1] += 0.01f; - projectile.scale += 0.01f; - projectile.width = (int)(30f * projectile.scale); - projectile.height = (int)(30f * projectile.scale); + Projectile.localAI[1] += 0.01f; + Projectile.scale += 0.01f; + Projectile.width = (int)(30f * Projectile.scale); + Projectile.height = (int)(30f * Projectile.scale); } else { - projectile.damage = 20; - projectile.width = 30; - projectile.height = 30; - projectile.tileCollide = true; + Projectile.damage = 20; + Projectile.width = 30; + Projectile.height = 30; + Projectile.tileCollide = true; } - if (projectile.localAI[0] > 2f) + if (Projectile.localAI[0] > 2f) { - projectile.alpha -= 20; - if (projectile.alpha < 100) + Projectile.alpha -= 20; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } } else { - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (projectile.ai[1] > 30f) + if (Projectile.ai[1] > 30f) { - if (projectile.velocity.Y > -2f) + if (Projectile.velocity.Y > -2f) { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.05f; } } else { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; } - if (projectile.wet) + if (Projectile.wet) { - if (projectile.velocity.Y > 0f) + if (Projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; + Projectile.velocity.Y = Projectile.velocity.Y * 0.98f; } - if (projectile.velocity.Y > -1f) + if (Projectile.velocity.Y > -1f) { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.localAI[1] < 1f) + if (Projectile.localAI[1] < 1f) { return; } target.AddBuff(ModContent.BuffType(), 120); - projectile.Kill(); + Projectile.Kill(); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 60; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 60; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num3; for (int num246 = 0; num246 < 25; num246 = num3 + 1) { - int num247 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 0, default, 1f); - Main.dust[num247].position = (Main.dust[num247].position + projectile.position) / 2f; + int num247 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 0, default, 1f); + Main.dust[num247].position = (Main.dust[num247].position + Projectile.position) / 2f; Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); Main.dust[num247].velocity.Normalize(); Dust dust = Main.dust[num247]; dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[num247].alpha = projectile.alpha; + Main.dust[num247].alpha = Projectile.alpha; num3 = num246; } } diff --git a/Projectiles/Enemy/SulphuricAcidMist.cs b/Projectiles/Enemy/SulphuricAcidMist.cs index e5efb7b074..68246058f5 100644 --- a/Projectiles/Enemy/SulphuricAcidMist.cs +++ b/Projectiles/Enemy/SulphuricAcidMist.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { @@ -11,66 +12,66 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Mist"); - Main.projFrames[projectile.type] = 10; + Main.projFrames[Projectile.type] = 10; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.alpha = 255; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 9) + if (Projectile.frame > 9) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item111, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item111, Projectile.position); } - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 180f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 180f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 5; - if (projectile.alpha > 255) + Projectile.alpha += 5; + if (Projectile.alpha > 255) { - projectile.alpha = 255; - projectile.Kill(); + Projectile.alpha = 255; + Projectile.Kill(); } } } - else if (projectile.alpha > 80) + else if (Projectile.alpha > 80) { - projectile.alpha -= 30; - if (projectile.alpha < 80) + Projectile.alpha -= 30; + if (Projectile.alpha < 80) { - projectile.alpha = 80; + Projectile.alpha = 80; } } } diff --git a/Projectiles/Enemy/TornadoHostile.cs b/Projectiles/Enemy/TornadoHostile.cs index d82852ebf4..82ae0ed210 100644 --- a/Projectiles/Enemy/TornadoHostile.cs +++ b/Projectiles/Enemy/TornadoHostile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Enemy { public class TornadoHostile : ModProjectile @@ -16,40 +17,40 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 1200; + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 1200; } public override void AI() { float num1125 = 600f; - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = -1; - Main.PlaySound(SoundID.Item122, projectile.position); + Projectile.soundDelay = -1; + SoundEngine.PlaySound(SoundID.Item122, Projectile.position); } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= num1125) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= num1125) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.localAI[0] >= 30f) + if (Projectile.localAI[0] >= 30f) { - projectile.damage = 0; - if (projectile.ai[0] < num1125 - 120f) + Projectile.damage = 0; + if (Projectile.ai[0] < num1125 - 120f) { - float num1126 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1126; - projectile.netUpdate = true; + float num1126 = Projectile.ai[0] % 60f; + Projectile.ai[0] = num1125 - 120f + num1126; + Projectile.netUpdate = true; } } float num1127 = 15f; float num1128 = 15f; - Point point8 = projectile.Center.ToTileCoordinates(); + Point point8 = Projectile.Center.ToTileCoordinates(); int num1129; int num1130; Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); @@ -60,14 +61,14 @@ namespace CalamityMod.Projectiles.Enemy Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); value74.X = value74.Y * 0.2f; - projectile.width = (int)(value74.X * 0.65f); - projectile.height = (int)value74.Y; - projectile.Center = vector146; - if (projectile.owner == Main.myPlayer) + Projectile.width = (int)(value74.X * 0.65f); + Projectile.height = (int)value74.Y; + Projectile.Center = vector146; + if (Projectile.owner == Main.myPlayer) { bool flag74 = false; - Vector2 center16 = Main.player[projectile.owner].Center; - Vector2 top = Main.player[projectile.owner].Top; + Vector2 center16 = Main.player[Projectile.owner].Center; + Vector2 top = Main.player[Projectile.owner].Top; for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) { Vector2 position2 = Vector2.Lerp(value72, value73, num1131); @@ -77,14 +78,14 @@ namespace CalamityMod.Projectiles.Enemy break; } } - if (!flag74 && projectile.ai[0] < num1125 - 120f) + if (!flag74 && Projectile.ai[0] < num1125 - 120f) { - float num1132 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1132; - projectile.netUpdate = true; + float num1132 = Projectile.ai[0] % 60f; + Projectile.ai[0] = num1125 - 120f + num1132; + Projectile.netUpdate = true; } } - if (projectile.ai[0] < num1125 - 120f) + if (Projectile.ai[0] < num1125 - 120f) { for (int num1133 = 0; num1133 < 1; num1133++) { @@ -115,13 +116,13 @@ namespace CalamityMod.Projectiles.Enemy float num226 = 600f; float num227 = 15f; float num228 = 15f; - float num229 = projectile.ai[0]; + float num229 = Projectile.ai[0]; float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); if (num229 > num226 - 60f) { scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); } - Point point5 = projectile.Center.ToTileCoordinates(); + Point point5 = Projectile.Center.ToTileCoordinates(); int num230; int num231; Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); @@ -134,7 +135,7 @@ namespace CalamityMod.Projectiles.Enemy Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); vector33.X = vector33.Y * num232; new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Texture2D texture2D23 = Main.projectileTexture[Projectile.type]; Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); Vector2 origin3 = rectangle9.Size() / 2f; float num233 = -0.06283186f * num229; diff --git a/Projectiles/Enemy/ToxicMinnowCloud.cs b/Projectiles/Enemy/ToxicMinnowCloud.cs index 65d0abb2fe..356937253b 100644 --- a/Projectiles/Enemy/ToxicMinnowCloud.cs +++ b/Projectiles/Enemy/ToxicMinnowCloud.cs @@ -10,77 +10,77 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Toxic Cloud"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 52; - projectile.height = 48; - projectile.hostile = true; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 7; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 600; + Projectile.width = 52; + Projectile.height = 48; + Projectile.hostile = true; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 7; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 600; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 9) + Projectile.frameCounter++; + if (Projectile.frameCounter > 9) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; if (Main.rand.NextBool(2)) - projectile.velocity *= 0.95f; + Projectile.velocity *= 0.95f; else if (Main.rand.NextBool(2)) - projectile.velocity *= 0.9f; + Projectile.velocity *= 0.9f; else if (Main.rand.NextBool(2)) - projectile.velocity *= 0.85f; + Projectile.velocity *= 0.85f; else - projectile.velocity *= 0.8f; + Projectile.velocity *= 0.8f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 560f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 560f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 5; - if (projectile.alpha > 255) - projectile.alpha = 255; + Projectile.alpha += 5; + if (Projectile.alpha > 255) + Projectile.alpha = 255; } - else if (projectile.owner == Main.myPlayer) - projectile.Kill(); + else if (Projectile.owner == Main.myPlayer) + Projectile.Kill(); } - else if (projectile.alpha > 80) + else if (Projectile.alpha > 80) { - projectile.alpha -= 30; - if (projectile.alpha < 80) - projectile.alpha = 80; + Projectile.alpha -= 30; + if (Projectile.alpha < 80) + Projectile.alpha = 80; } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 20f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f, targetHitbox); - public override bool CanHitPlayer(Player target) => projectile.alpha == 80; + public override bool CanHitPlayer(Player target) => Projectile.alpha == 80; public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.alpha == 80) + if (Projectile.alpha == 80) target.AddBuff(BuffID.Poisoned, 120); } - public override bool? CanHitNPC(NPC target) => projectile.alpha == 80; + public override bool? CanHitNPC(NPC target) => Projectile.alpha == 80; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.alpha == 80) + if (Projectile.alpha == 80) target.AddBuff(BuffID.Poisoned, 120); } } diff --git a/Projectiles/Enemy/TrilobiteSpike.cs b/Projectiles/Enemy/TrilobiteSpike.cs index fb324324ab..ab7aab5797 100644 --- a/Projectiles/Enemy/TrilobiteSpike.cs +++ b/Projectiles/Enemy/TrilobiteSpike.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.timeLeft = 600; - projectile.tileCollide = true; - projectile.ignoreWater = false; + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.timeLeft = 600; + Projectile.tileCollide = true; + Projectile.ignoreWater = false; } public override void AI() { - if (projectile.velocity.Y < 10f) - projectile.velocity.Y += 0.25f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.velocity.Y < 10f) + Projectile.velocity.Y += 0.25f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override void OnHitPlayer(Player target, int damage, bool crit) { @@ -35,10 +35,10 @@ namespace CalamityMod.Projectiles.Enemy { for (int i = 0; i <= 2; i++) { - int idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Environment/AcidDrop.cs b/Projectiles/Environment/AcidDrop.cs index c22bdb0871..a792d23965 100644 --- a/Projectiles/Environment/AcidDrop.cs +++ b/Projectiles/Environment/AcidDrop.cs @@ -13,34 +13,34 @@ namespace CalamityMod.Projectiles.Environment public override void SetStaticDefaults() { DisplayName.SetDefault("Acid"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 20; - projectile.hostile = true; - projectile.tileCollide = true; - projectile.ignoreWater = false; - projectile.timeLeft = 360; + Projectile.width = 14; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.tileCollide = true; + Projectile.ignoreWater = false; + Projectile.timeLeft = 360; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override bool OnTileCollide(Vector2 oldVelocity) { // Water drip for (int i = 0; i < 4; i++) { - int idx = Dust.NewDust(projectile.position - projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); Dust dust = Main.dust[idx]; dust.position.X -= 2f; Main.dust[idx].alpha = 38; Main.dust[idx].velocity *= 0.1f; - Main.dust[idx].velocity -= projectile.velocity * 0.025f; + Main.dust[idx].velocity -= Projectile.velocity * 0.025f; Main.dust[idx].scale = 0.75f; } @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Environment public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Environment/BrimstoneGeyser.cs b/Projectiles/Environment/BrimstoneGeyser.cs index 45653e3f88..57b8b08a70 100644 --- a/Projectiles/Environment/BrimstoneGeyser.cs +++ b/Projectiles/Environment/BrimstoneGeyser.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Environment { public class BrimstoneGeyser : ModProjectile @@ -19,94 +20,94 @@ namespace CalamityMod.Projectiles.Environment public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 120; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.trap = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 120; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.trap = true; } public override void AI() { - int num1 = Math.Sign(projectile.velocity.Y); + int num1 = Math.Sign(Projectile.velocity.Y); int num2 = num1 == -1 ? 0 : 1; - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - if (!Collision.SolidCollision(projectile.position + new Vector2(0f, num1 == -1 ? (float) (projectile.height - 48) : 0f), projectile.width, 48) && !Collision.WetCollision(projectile.position + new Vector2(0f, num1 == -1 ? (float) (projectile.height - 20) : 0f), projectile.width, 20)) + if (!Collision.SolidCollision(Projectile.position + new Vector2(0f, num1 == -1 ? (float) (Projectile.height - 48) : 0f), Projectile.width, 48) && !Collision.WetCollision(Projectile.position + new Vector2(0f, num1 == -1 ? (float) (Projectile.height - 20) : 0f), Projectile.width, 20)) { - projectile.velocity = new Vector2(0f, (float) Math.Sign(projectile.velocity.Y) * (1f / 1000f)); - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.timeLeft = 60; + Projectile.velocity = new Vector2(0f, (float) Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.timeLeft = 60; } - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 60f) - projectile.Kill(); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 60f) + Projectile.Kill(); for (int index1 = 0; index1 < 3; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, new Color(), 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, new Color(), 1f); Main.dust[index2].scale = 0.1f + Main.rand.Next(5) * 0.1f; Main.dust[index2].fadeIn = 1.5f + Main.rand.Next(5) * 0.1f; Main.dust[index2].noGravity = true; - Main.dust[index2].position = projectile.Center + new Vector2(0f, (float) (-projectile.height / 2)).RotatedBy((double)projectile.rotation, new Vector2()) * 1.1f; + Main.dust[index2].position = Projectile.Center + new Vector2(0f, (float) (-Projectile.height / 2)).RotatedBy((double)Projectile.rotation, new Vector2()) * 1.1f; } } - if (projectile.ai[0] != 1f) + if (Projectile.ai[0] != 1f) return; - projectile.velocity = new Vector2(0f, (float) Math.Sign(projectile.velocity.Y) * (1f / 1000f)); + Projectile.velocity = new Vector2(0f, (float) Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); if (num1 != 0) { int num3 = 16; int num4 = 320; - while (num3 < num4 && !Collision.SolidCollision(projectile.position + new Vector2(0f, num1 == -1 ? (float)(projectile.height - num3 - 16) : 0f), projectile.width, num3 + 16)) + while (num3 < num4 && !Collision.SolidCollision(Projectile.position + new Vector2(0f, num1 == -1 ? (float)(Projectile.height - num3 - 16) : 0f), Projectile.width, num3 + 16)) num3 += 16; if (num1 == -1) { - projectile.position.Y += (float)projectile.height; - projectile.height = num3; - projectile.position.Y -= (float)num3; + Projectile.position.Y += (float)Projectile.height; + Projectile.height = num3; + Projectile.position.Y -= (float)num3; } else - projectile.height = num3; + Projectile.height = num3; } - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 60f) - projectile.Kill(); - if (projectile.localAI[0] == 0f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 60f) + Projectile.Kill(); + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; for (int index1 = 0; index1 < 60; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); Dust dust = Main.dust[index2]; dust.alpha = 200; dust.velocity *= new Vector2(0.3f, 2f); dust.velocity.Y += (float)(2 * num1); dust.scale += Main.rand.NextFloat(); - dust.position = new Vector2(projectile.Center.X, projectile.Center.Y + (float) projectile.height * 0.5f * (float) -num1); + dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -num1); dust.customData = (object) num2; if (num1 == -1 && Main.rand.Next(4) != 0) { dust.velocity.Y -= 0.2f; } } - Main.PlaySound(SoundID.Item34, projectile.position); + SoundEngine.PlaySound(SoundID.Item34, Projectile.position); } if (num1 == 1) { for (int index1 = 0; index1 < 9; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); Dust dust = Main.dust[index2]; dust.alpha = 200; dust.velocity *= new Vector2(0.3f, 2f); dust.velocity.Y += (float)(2 * num1); dust.scale += Main.rand.NextFloat(); - dust.position = new Vector2(projectile.Center.X, projectile.Center.Y + (float) projectile.height * 0.5f * (float) -num1); + dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -num1); dust.customData = (object)num2; if (num1 == -1 && Main.rand.Next(4) != 0) { @@ -114,16 +115,16 @@ namespace CalamityMod.Projectiles.Environment } } } - int Height = (int)(projectile.ai[1] / 60f * (float)projectile.height) * 3; - if (Height > projectile.height) - Height = projectile.height; - Vector2 Position = projectile.position + (num1 == -1 ? new Vector2(0f, (float) (projectile.height - Height)) : Vector2.Zero); - Vector2 vector2 = projectile.position + (num1 == -1 ? new Vector2(0f, (float) projectile.height) : Vector2.Zero); + int Height = (int)(Projectile.ai[1] / 60f * (float)Projectile.height) * 3; + if (Height > Projectile.height) + Height = Projectile.height; + Vector2 Position = Projectile.position + (num1 == -1 ? new Vector2(0f, (float) (Projectile.height - Height)) : Vector2.Zero); + Vector2 vector2 = Projectile.position + (num1 == -1 ? new Vector2(0f, (float) Projectile.height) : Vector2.Zero); for (int index1 = 0; index1 < 6; ++index1) { if (Main.rand.Next(3) < 2) { - int index2 = Dust.NewDust(Position, projectile.width, Height, dustType, 0f, 0f, 90, new Color(), 2.5f); + int index2 = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, 0f, 90, new Color(), 2.5f); Dust dust = Main.dust[index2]; dust.noGravity = true; dust.fadeIn = 1f; @@ -136,14 +137,14 @@ namespace CalamityMod.Projectiles.Environment dust.position.Y = MathHelper.Lerp(dust.position.Y, vector2.Y, 0.5f); dust.velocity *= 5f; dust.velocity.Y -= 3f; - dust.position.X = projectile.Center.X; + dust.position.X = Projectile.Center.X; dust.noGravity = false; dust.noLight = true; dust.fadeIn = 0.4f; dust.scale *= 0.3f; } else - Main.dust[index2].velocity = projectile.DirectionFrom(Main.dust[index2].position) * Main.dust[index2].velocity.Length() * 0.25f; + Main.dust[index2].velocity = Projectile.DirectionFrom(Main.dust[index2].position) * Main.dust[index2].velocity.Length() * 0.25f; Main.dust[index2].velocity.Y *= (float)-num1; Main.dust[index2].customData = (object)num2; } @@ -152,7 +153,7 @@ namespace CalamityMod.Projectiles.Environment { if (Main.rand.NextFloat() >= 0.5f) { - int index2 = Dust.NewDust(Position, projectile.width, Height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); + int index2 = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); Dust dust = Main.dust[index2]; dust.alpha = 200; dust.velocity *= new Vector2(0.6f, 1.5f); diff --git a/Projectiles/Environment/GeyserTelegraph.cs b/Projectiles/Environment/GeyserTelegraph.cs index 13ea7b7b51..e1d3ea07de 100644 --- a/Projectiles/Environment/GeyserTelegraph.cs +++ b/Projectiles/Environment/GeyserTelegraph.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Projectiles.Environment public override void SetDefaults() { - projectile.width = 6; - projectile.height = 12; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.timeLeft = 100; - projectile.trap = true; + Projectile.width = 6; + Projectile.height = 12; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 100; + Projectile.trap = true; } public override void AI() { - if (!initialized && Main.myPlayer != projectile.owner) + if (!initialized && Main.myPlayer != Projectile.owner) { int projectileType = ModContent.ProjectileType(); float randomVelocity = Main.rand.NextFloat() + 0.5f; - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -8f * randomVelocity, projectileType, 0, 0f, projectile.owner, 0f, 0f); + int proj = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, -8f * randomVelocity, projectileType, 0, 0f, Projectile.owner, 0f, 0f); Main.projectile[proj].netUpdate = true; initialized = true; } @@ -38,16 +38,16 @@ namespace CalamityMod.Projectiles.Environment public override void Kill(int timeLeft) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; int projectileType = ProjectileID.GeyserTrap; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { projectileType = ModContent.ProjectileType(); } float randomVelocity = Main.rand.NextFloat() + 0.5f; - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -8f * randomVelocity, projectileType, 20, 2f, projectile.owner, 0f, 0f); + int proj = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, -8f * randomVelocity, projectileType, 20, 2f, Projectile.owner, 0f, 0f); Main.projectile[proj].friendly = false; Main.projectile[proj].netUpdate = true; } diff --git a/Projectiles/Environment/HotSteam.cs b/Projectiles/Environment/HotSteam.cs index 78fd9df3b8..a1d65ea77a 100644 --- a/Projectiles/Environment/HotSteam.cs +++ b/Projectiles/Environment/HotSteam.cs @@ -16,18 +16,18 @@ namespace CalamityMod.Projectiles.Environment public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.hostile = true; - projectile.tileCollide = true; - projectile.ignoreWater = false; - projectile.timeLeft = 30; + Projectile.width = 40; + Projectile.height = 40; + Projectile.hostile = true; + Projectile.tileCollide = true; + Projectile.ignoreWater = false; + Projectile.timeLeft = 30; } public override void AI() { for (int i = 0; i < 6; i++) { - Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 4); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 4); dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi); dust.alpha = 127; } diff --git a/Projectiles/Environment/LavaChunk.cs b/Projectiles/Environment/LavaChunk.cs index b0a8da37ea..f7b6fd88ff 100644 --- a/Projectiles/Environment/LavaChunk.cs +++ b/Projectiles/Environment/LavaChunk.cs @@ -9,86 +9,86 @@ namespace CalamityMod.Projectiles.Environment public override void SetStaticDefaults() { DisplayName.SetDefault("Lava Chunk"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.hostile = true; - projectile.timeLeft = 360; - projectile.penetrate = 1; + Projectile.width = 16; + Projectile.height = 16; + Projectile.hostile = true; + Projectile.timeLeft = 360; + Projectile.penetrate = 1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) + if (Projectile.frame > 5) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.localAI[1] < 1f) + if (Projectile.localAI[1] < 1f) { - projectile.localAI[1] += 0.002f; - projectile.scale -= 0.002f; - projectile.width = (int)(18f * projectile.scale); - projectile.height = (int)(18f * projectile.scale); + Projectile.localAI[1] += 0.002f; + Projectile.scale -= 0.002f; + Projectile.width = (int)(18f * Projectile.scale); + Projectile.height = (int)(18f * Projectile.scale); } else { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.scale > 0.25f) + if (Projectile.scale > 0.25f) { for (int num246 = 0; num246 < 2; num246++) { float num248 = 0f; if (num246 == 1) { - num248 = projectile.velocity.Y * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, projectile.scale); + int num249 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, Projectile.scale); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, projectile.scale * 0.5f); + num249 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, Projectile.scale * 0.5f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } } else { - projectile.damage = 0; + Projectile.damage = 0; } - if (projectile.velocity.Y < 6f) + if (Projectile.velocity.Y < 6f) { - projectile.velocity.Y = projectile.velocity.Y + 0.05f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.05f; } - if (projectile.wet) + if (Projectile.wet) { - if (projectile.velocity.Y < 0f) + if (Projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; + Projectile.velocity.Y = Projectile.velocity.Y * 0.98f; } - if (projectile.velocity.Y < 0.5f) + if (Projectile.velocity.Y < 0.5f) { - projectile.velocity.Y = projectile.velocity.Y + 0.01f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.01f; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Environment/LightningMark.cs b/Projectiles/Environment/LightningMark.cs index 3627457199..46e36e2161 100644 --- a/Projectiles/Environment/LightningMark.cs +++ b/Projectiles/Environment/LightningMark.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Environment { public class LightningMark : ModProjectile @@ -15,23 +16,23 @@ namespace CalamityMod.Projectiles.Environment public override void SetDefaults() { - projectile.width = 6; - projectile.height = 12; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.timeLeft = 1800; - projectile.extraUpdates = 10; + Projectile.width = 6; + Projectile.height = 12; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 1800; + Projectile.extraUpdates = 10; } public override void AI() { - if (projectile.timeLeft <= 600) + if (Projectile.timeLeft <= 600) { - if (projectile.ai[0] == 0f && projectile.owner == Main.myPlayer) + if (Projectile.ai[0] == 0f && Projectile.owner == Main.myPlayer) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; - Vector2 fireFrom = new Vector2(projectile.Center.X, projectile.Center.Y - 900f); + Vector2 fireFrom = new Vector2(Projectile.Center.X, Projectile.Center.Y - 900f); int tries = 0; while (CalamityUtils.ParanoidTileRetrieval((int)(fireFrom.X / 16f), (int)(fireFrom.Y / 16f)).active()) { @@ -42,14 +43,14 @@ namespace CalamityMod.Projectiles.Environment return; } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), projectile.Center); - Vector2 ai0 = projectile.Center - fireFrom; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), Projectile.Center); + Vector2 ai0 = Projectile.Center - fireFrom; float ai = Main.rand.Next(100); Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; int damage = NPC.downedMoonlord ? 80 : NPC.downedPlantBoss ? 40 : Main.hardMode ? 20 : 10; - int proj = Projectile.NewProjectile(fireFrom, velocity, ProjectileID.CultistBossLightningOrbArc, damage, 0f, projectile.owner, ai0.ToRotation(), ai); + int proj = Projectile.NewProjectile(fireFrom, velocity, ProjectileID.CultistBossLightningOrbArc, damage, 0f, Projectile.owner, ai0.ToRotation(), ai); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].extraUpdates += 11; @@ -58,13 +59,13 @@ namespace CalamityMod.Projectiles.Environment } } } - else if (projectile.velocity.Y == 0f) + else if (Projectile.velocity.Y == 0f) { - Lighting.AddLight(projectile.Center, 0.6f, 0.9f, 1f); + Lighting.AddLight(Projectile.Center, 0.6f, 0.9f, 1f); if (Main.rand.NextBool(3)) { - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 226, 0f, 0f, 100, default, 1f); + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 226, 0f, 0f, 100, default, 1f); Main.dust[num199].position.X -= 2f; Main.dust[num199].position.Y += 2f; Main.dust[num199].scale = 0.7f; @@ -74,7 +75,7 @@ namespace CalamityMod.Projectiles.Environment if (Main.rand.NextBool(15)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); Main.dust[num200].position.X -= 2f; Main.dust[num200].position.Y += 2f; Main.dust[num200].scale = 0.7f; @@ -83,13 +84,13 @@ namespace CalamityMod.Projectiles.Environment } } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) - projectile.velocity.Y *= -0.5f; + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) + Projectile.velocity.Y *= -0.5f; - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) diff --git a/Projectiles/Environment/SmokeTelegraph.cs b/Projectiles/Environment/SmokeTelegraph.cs index 5700ab53f4..35d51776b1 100644 --- a/Projectiles/Environment/SmokeTelegraph.cs +++ b/Projectiles/Environment/SmokeTelegraph.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Environment { public class SmokeTelegraph : ModProjectile @@ -17,94 +18,94 @@ namespace CalamityMod.Projectiles.Environment public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 120; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.trap = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 120; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.trap = true; } public override void AI() { - int num1 = Math.Sign(projectile.velocity.Y); + int num1 = Math.Sign(Projectile.velocity.Y); int num2 = num1 == -1 ? 0 : 1; - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - if (!Collision.SolidCollision(projectile.position + new Vector2(0f, num1 == -1 ? (float) (projectile.height - 48) : 0f), projectile.width, 48) && !Collision.WetCollision(projectile.position + new Vector2(0f, num1 == -1 ? (float) (projectile.height - 20) : 0f), projectile.width, 20)) + if (!Collision.SolidCollision(Projectile.position + new Vector2(0f, num1 == -1 ? (float) (Projectile.height - 48) : 0f), Projectile.width, 48) && !Collision.WetCollision(Projectile.position + new Vector2(0f, num1 == -1 ? (float) (Projectile.height - 20) : 0f), Projectile.width, 20)) { - projectile.velocity = new Vector2(0f, (float) Math.Sign(projectile.velocity.Y) * (1f / 1000f)); - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.timeLeft = 60; + Projectile.velocity = new Vector2(0f, (float) Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.timeLeft = 60; } - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 60f) - projectile.Kill(); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 60f) + Projectile.Kill(); for (int index1 = 0; index1 < 3; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, new Color(), 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, new Color(), 1f); Main.dust[index2].scale = 0.1f + Main.rand.Next(5) * 0.1f; Main.dust[index2].fadeIn = 1.5f + Main.rand.Next(5) * 0.1f; Main.dust[index2].noGravity = true; - Main.dust[index2].position = projectile.Center + new Vector2(0f, (float) (-projectile.height / 2)).RotatedBy((double)projectile.rotation, new Vector2()) * 1.1f; + Main.dust[index2].position = Projectile.Center + new Vector2(0f, (float) (-Projectile.height / 2)).RotatedBy((double)Projectile.rotation, new Vector2()) * 1.1f; } } - if (projectile.ai[0] != 1f) + if (Projectile.ai[0] != 1f) return; - projectile.velocity = new Vector2(0f, (float) Math.Sign(projectile.velocity.Y) * (1f / 1000f)); + Projectile.velocity = new Vector2(0f, (float) Math.Sign(Projectile.velocity.Y) * (1f / 1000f)); if (num1 != 0) { int num3 = 16; int num4 = 320; - while (num3 < num4 && !Collision.SolidCollision(projectile.position + new Vector2(0f, num1 == -1 ? (float)(projectile.height - num3 - 16) : 0f), projectile.width, num3 + 16)) + while (num3 < num4 && !Collision.SolidCollision(Projectile.position + new Vector2(0f, num1 == -1 ? (float)(Projectile.height - num3 - 16) : 0f), Projectile.width, num3 + 16)) num3 += 16; if (num1 == -1) { - projectile.position.Y += (float)projectile.height; - projectile.height = num3; - projectile.position.Y -= (float)num3; + Projectile.position.Y += (float)Projectile.height; + Projectile.height = num3; + Projectile.position.Y -= (float)num3; } else - projectile.height = num3; + Projectile.height = num3; } - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 60f) - projectile.Kill(); - if (projectile.localAI[0] == 0f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 60f) + Projectile.Kill(); + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; for (int index1 = 0; index1 < 60; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); Dust dust = Main.dust[index2]; dust.alpha = 200; dust.velocity *= new Vector2(0.3f, 2f); dust.velocity.Y += (float)(2 * num1); dust.scale += Main.rand.NextFloat(); - dust.position = new Vector2(projectile.Center.X, projectile.Center.Y + (float) projectile.height * 0.5f * (float) -num1); + dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -num1); dust.customData = (object) num2; if (num1 == -1 && Main.rand.Next(4) != 0) { dust.velocity.Y -= 0.2f; } } - Main.PlaySound(SoundID.Item34, projectile.position); + SoundEngine.PlaySound(SoundID.Item34, Projectile.position); } if (num1 == 1) { for (int index1 = 0; index1 < 9; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); Dust dust = Main.dust[index2]; dust.alpha = 200; dust.velocity *= new Vector2(0.3f, 2f); dust.velocity.Y += (float)(2 * num1); dust.scale += Main.rand.NextFloat(); - dust.position = new Vector2(projectile.Center.X, projectile.Center.Y + (float) projectile.height * 0.5f * (float) -num1); + dust.position = new Vector2(Projectile.Center.X, Projectile.Center.Y + (float) Projectile.height * 0.5f * (float) -num1); dust.customData = (object)num2; if (num1 == -1 && Main.rand.Next(4) != 0) { @@ -112,16 +113,16 @@ namespace CalamityMod.Projectiles.Environment } } } - int Height = (int)(projectile.ai[1] / 60f * (float)projectile.height) * 3; - if (Height > projectile.height) - Height = projectile.height; - Vector2 Position = projectile.position + (num1 == -1 ? new Vector2(0f, (float) (projectile.height - Height)) : Vector2.Zero); - Vector2 vector2 = projectile.position + (num1 == -1 ? new Vector2(0f, (float) projectile.height) : Vector2.Zero); + int Height = (int)(Projectile.ai[1] / 60f * (float)Projectile.height) * 3; + if (Height > Projectile.height) + Height = Projectile.height; + Vector2 Position = Projectile.position + (num1 == -1 ? new Vector2(0f, (float) (Projectile.height - Height)) : Vector2.Zero); + Vector2 vector2 = Projectile.position + (num1 == -1 ? new Vector2(0f, (float) Projectile.height) : Vector2.Zero); for (int index1 = 0; index1 < 6; ++index1) { if (Main.rand.Next(3) < 2) { - int index2 = Dust.NewDust(Position, projectile.width, Height, dustType, 0f, 0f, 90, new Color(), 2.5f); + int index2 = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, 0f, 90, new Color(), 2.5f); Dust dust = Main.dust[index2]; dust.noGravity = true; dust.fadeIn = 1f; @@ -134,14 +135,14 @@ namespace CalamityMod.Projectiles.Environment dust.position.Y = MathHelper.Lerp(dust.position.Y, vector2.Y, 0.5f); dust.velocity *= 5f; dust.velocity.Y -= 3f; - dust.position.X = projectile.Center.X; + dust.position.X = Projectile.Center.X; dust.noGravity = false; dust.noLight = true; dust.fadeIn = 0.4f; dust.scale *= 0.3f; } else - Main.dust[index2].velocity = projectile.DirectionFrom(Main.dust[index2].position) * Main.dust[index2].velocity.Length() * 0.25f; + Main.dust[index2].velocity = Projectile.DirectionFrom(Main.dust[index2].position) * Main.dust[index2].velocity.Length() * 0.25f; Main.dust[index2].velocity.Y *= (float)-num1; Main.dust[index2].customData = (object)num2; } @@ -150,7 +151,7 @@ namespace CalamityMod.Projectiles.Environment { if (Main.rand.NextFloat() >= 0.5f) { - int index2 = Dust.NewDust(Position, projectile.width, Height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); + int index2 = Dust.NewDust(Position, Projectile.width, Height, dustType, 0f, -2.5f * (float) -num1, 0, new Color(), 1f); Dust dust = Main.dust[index2]; dust.alpha = 200; dust.velocity *= new Vector2(0.6f, 1.5f); diff --git a/Projectiles/Healing/AtaxiaHealOrb.cs b/Projectiles/Healing/AtaxiaHealOrb.cs index e02d5f88b8..6cfa22ea6a 100644 --- a/Projectiles/Healing/AtaxiaHealOrb.cs +++ b/Projectiles/Healing/AtaxiaHealOrb.cs @@ -14,23 +14,23 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 240; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 240; + Projectile.extraUpdates = 3; } public override void AI() { - projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f); - int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 2f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5.5f, 15f); + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[dusty]; dust.noGravity = true; - dust.position.X -= projectile.velocity.X * 0.2f; - dust.position.Y += projectile.velocity.Y * 0.2f; + dust.position.X -= Projectile.velocity.X * 0.2f; + dust.position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/AuricOrb.cs b/Projectiles/Healing/AuricOrb.cs index 31c373e15c..0433b50d4c 100644 --- a/Projectiles/Healing/AuricOrb.cs +++ b/Projectiles/Healing/AuricOrb.cs @@ -12,49 +12,49 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 360; - projectile.extraUpdates = 3; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 360; + Projectile.extraUpdates = 3; } public override void AI() { - projectile.alpha -= 2; - if (projectile.localAI[0] == 0f) + Projectile.alpha -= 2; + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.05f; - if (projectile.scale > 1.2f) + Projectile.scale += 0.05f; + if (Projectile.scale > 1.2f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } } else { - projectile.scale -= 0.05f; - if (projectile.scale < 0.8f) + Projectile.scale -= 0.05f; + if (Projectile.scale < 0.8f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } } - projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 6f, 15f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 6f, 15f); return; } public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 53, projectile.alpha); + return new Color(255, Main.DiscoG, 53, Projectile.alpha); } public override void Kill(int timeLeft) { for (int num407 = 0; num407 < 5; num407++) { - int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(255, Main.DiscoG, 53), 1f); + int num408 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 157, 0f, 0f, 0, new Color(255, Main.DiscoG, 53), 1f); Main.dust[num408].noGravity = true; Main.dust[num408].velocity *= 1.5f; Main.dust[num408].scale = 1.5f; diff --git a/Projectiles/Healing/BurntSiennaProj.cs b/Projectiles/Healing/BurntSiennaProj.cs index c34bafa181..53d71423f8 100644 --- a/Projectiles/Healing/BurntSiennaProj.cs +++ b/Projectiles/Healing/BurntSiennaProj.cs @@ -14,25 +14,25 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; } public override void AI() { - projectile.velocity *= 0.95f; + Projectile.velocity *= 0.95f; - projectile.HealingProjectile(3, (int)projectile.ai[0], 6f, 15f, false); - int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); + Projectile.HealingProjectile(3, (int)Projectile.ai[0], 6f, 15f, false); + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[dusty]; dust.noGravity = true; - dust.position.X -= projectile.velocity.X * 0.2f; - dust.position.Y += projectile.velocity.Y * 0.2f; + dust.position.X -= Projectile.velocity.X * 0.2f; + dust.position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/CactusHealOrb.cs b/Projectiles/Healing/CactusHealOrb.cs index 8becd8cfb3..6e180208a9 100644 --- a/Projectiles/Healing/CactusHealOrb.cs +++ b/Projectiles/Healing/CactusHealOrb.cs @@ -14,25 +14,25 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; } public override void AI() { - projectile.velocity.Y *= 0.98f; + Projectile.velocity.Y *= 0.98f; - projectile.HealingProjectile(15, projectile.owner, 12f, 15f, false); - int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 200, 0), 1.5f); + Projectile.HealingProjectile(15, Projectile.owner, 12f, 15f, false); + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 200, 0), 1.5f); Dust dust = Main.dust[dusty]; dust.noGravity = true; - dust.position.X -= projectile.velocity.X * 0.2f; - dust.position.Y += projectile.velocity.Y * 0.2f; + dust.position.X -= Projectile.velocity.X * 0.2f; + dust.position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/DemonHeal.cs b/Projectiles/Healing/DemonHeal.cs index 05a253ef83..5330fb44e6 100644 --- a/Projectiles/Healing/DemonHeal.cs +++ b/Projectiles/Healing/DemonHeal.cs @@ -5,25 +5,25 @@ namespace CalamityMod.Projectiles.Healing { public class DemonHeal : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() => DisplayName.SetDefault("Heal"); public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 640; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 640; } public override void AI() { - projectile.HealingProjectile(10, projectile.owner, 20f, 20f, true, 640); + Projectile.HealingProjectile(10, Projectile.owner, 20f, 20f, true, 640); - Dust fire = Dust.NewDustPerfect(projectile.Center, 130); + Dust fire = Dust.NewDustPerfect(Projectile.Center, 130); fire.velocity = Microsoft.Xna.Framework.Vector2.Zero; fire.scale = Main.rand.NextFloat(1f, 1.15f); fire.fadeIn = 0.45f; diff --git a/Projectiles/Healing/EarthHealOrb.cs b/Projectiles/Healing/EarthHealOrb.cs index d94a12a07a..d38bba0e63 100644 --- a/Projectiles/Healing/EarthHealOrb.cs +++ b/Projectiles/Healing/EarthHealOrb.cs @@ -14,23 +14,23 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 3; } public override void AI() { - projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 8f, 15f); - int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default, 1f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 8f, 15f); + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 74, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[dusty]; dust.noGravity = true; - dust.position.X -= projectile.velocity.X * 0.2f; - dust.position.Y += projectile.velocity.Y * 0.2f; + dust.position.X -= Projectile.velocity.X * 0.2f; + dust.position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/EssenceFlame.cs b/Projectiles/Healing/EssenceFlame.cs index 1527235534..d87155733f 100644 --- a/Projectiles/Healing/EssenceFlame.cs +++ b/Projectiles/Healing/EssenceFlame.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Healing { public class EssenceFlame : ModProjectile @@ -9,51 +10,51 @@ namespace CalamityMod.Projectiles.Healing public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.alpha = 255; - projectile.extraUpdates = 3; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; + Projectile.alpha = 255; + Projectile.extraUpdates = 3; } public override void AI() { - projectile.alpha -= 5; - projectile.frameCounter++; - if (projectile.frameCounter > 16) + Projectile.alpha -= 5; + Projectile.frameCounter++; + if (Projectile.frameCounter > 16) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 3.5f, 15f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 3.5f, 15f); return; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item74, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item74, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -63,10 +64,10 @@ namespace CalamityMod.Projectiles.Healing } for (int num623 = 0; num623 < 15; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Healing/Exoheal.cs b/Projectiles/Healing/Exoheal.cs index 99b9cbb39a..16afaccc9f 100644 --- a/Projectiles/Healing/Exoheal.cs +++ b/Projectiles/Healing/Exoheal.cs @@ -14,23 +14,23 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 3; } public override void AI() { - projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 8f, 15f); - int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 8f, 15f); + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); Dust dust = Main.dust[dusty]; dust.noGravity = true; - dust.position.X -= projectile.velocity.X * 0.2f; - dust.position.Y += projectile.velocity.Y * 0.2f; + dust.position.X -= Projectile.velocity.X * 0.2f; + dust.position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/FungalHeal.cs b/Projectiles/Healing/FungalHeal.cs index 15be959080..494083ba55 100644 --- a/Projectiles/Healing/FungalHeal.cs +++ b/Projectiles/Healing/FungalHeal.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.extraUpdates = 10; - projectile.timeLeft = 300; + Projectile.width = 6; + Projectile.height = 6; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.extraUpdates = 10; + Projectile.timeLeft = 300; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if ((player.ActiveItem().summon && !player.ActiveItem().melee && !player.ActiveItem().ranged && @@ -35,22 +35,22 @@ namespace CalamityMod.Projectiles.Healing player.ActiveItem().pick > 0 || player.ActiveItem().axe > 0) { - projectile.timeLeft = 600; + Projectile.timeLeft = 600; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 5f, 15f); - float num494 = projectile.velocity.X * 0.334f; - float num495 = -(projectile.velocity.Y * 0.334f); - int num496 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 56, 0f, 0f, 100, default, 0.5f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5f, 15f); + float num494 = Projectile.velocity.X * 0.334f; + float num495 = -(Projectile.velocity.Y * 0.334f); + int num496 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 0.5f); Dust dust = Main.dust[num496]; dust.noGravity = true; dust.position.X -= num494; dust.position.Y -= num495; - float num498 = projectile.velocity.X * 0.2f; - float num499 = -(projectile.velocity.Y * 0.2f); - int num500 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 56, 0f, 0f, 100, default, 0.7f); + float num498 = Projectile.velocity.X * 0.2f; + float num499 = -(Projectile.velocity.Y * 0.2f); + int num500 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 0.7f); Dust dust2 = Main.dust[num500]; dust2.noGravity = true; dust2.position.X -= num498; diff --git a/Projectiles/Healing/GodSlayerHealOrb.cs b/Projectiles/Healing/GodSlayerHealOrb.cs index 4351d24dc3..97e31d9662 100644 --- a/Projectiles/Healing/GodSlayerHealOrb.cs +++ b/Projectiles/Healing/GodSlayerHealOrb.cs @@ -14,23 +14,23 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 240; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 240; + Projectile.extraUpdates = 3; } public override void AI() { - projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 6.5f, 15f); - int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 6.5f, 15f); + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[dusty]; dust.noGravity = true; - dust.position.X -= projectile.velocity.X * 0.2f; - dust.position.Y += projectile.velocity.Y * 0.2f; + dust.position.X -= Projectile.velocity.X * 0.2f; + dust.position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/ManaOverloaderHealOrb.cs b/Projectiles/Healing/ManaOverloaderHealOrb.cs index 710379066e..0b2fe8805f 100644 --- a/Projectiles/Healing/ManaOverloaderHealOrb.cs +++ b/Projectiles/Healing/ManaOverloaderHealOrb.cs @@ -14,23 +14,23 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 180; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 180; + Projectile.extraUpdates = 3; } public override void AI() { - projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 3f, 15f); - int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1.3f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 3f, 15f); + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 1.3f); Dust dust = Main.dust[dusty]; dust.noGravity = true; - dust.position.X -= projectile.velocity.X * 0.2f; - dust.position.Y += projectile.velocity.Y * 0.2f; + dust.position.X -= Projectile.velocity.X * 0.2f; + dust.position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/PhantomicHeart.cs b/Projectiles/Healing/PhantomicHeart.cs index 077ab144fc..7db8ea4932 100644 --- a/Projectiles/Healing/PhantomicHeart.cs +++ b/Projectiles/Healing/PhantomicHeart.cs @@ -14,20 +14,20 @@ namespace CalamityMod.Projectiles.Healing public override void SetStaticDefaults() { DisplayName.SetDefault("Phantomic Heart"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 42; - projectile.friendly = true; - projectile.alpha = 20; - projectile.penetrate = -1; - projectile.timeLeft = 600; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Projectile.width = 28; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.alpha = 20; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SendExtraAI(BinaryWriter writer) @@ -44,11 +44,11 @@ namespace CalamityMod.Projectiles.Healing { if (floatTimer >= 10) { - projectile.velocity.Y *= 0.99f; + Projectile.velocity.Y *= 0.99f; } else { - projectile.velocity.Y *= 1.01f; + Projectile.velocity.Y *= 1.01f; } if (floatTimer >= 20) floatTimer = 0; @@ -57,41 +57,41 @@ namespace CalamityMod.Projectiles.Healing for (int i = 0; i < 3; i++) { - Dust.NewDust(projectile.TopLeft, projectile.width, projectile.height, 5, Main.rand.NextFloat(-3, 3), -5f, 0, new Color(99, 54, 84), Main.rand.NextFloat(0.5f, 1.5f)); + Dust.NewDust(Projectile.TopLeft, Projectile.width, Projectile.height, 5, Main.rand.NextFloat(-3, 3), -5f, 0, new Color(99, 54, 84), Main.rand.NextFloat(0.5f, 1.5f)); } - Player player = Main.player[projectile.owner]; - Vector2 playerVector = player.Center - projectile.Center; + Player player = Main.player[Projectile.owner]; + Vector2 playerVector = player.Center - Projectile.Center; float playerDist = playerVector.Length(); - if (projectile.timeLeft < 500 && playerDist < 50f && projectile.position.X < player.position.X + player.width && projectile.position.X + projectile.width > player.position.X && projectile.position.Y < player.position.Y + player.height && projectile.position.Y + projectile.height > player.position.Y) + if (Projectile.timeLeft < 500 && playerDist < 50f && Projectile.position.X < player.position.X + player.width && Projectile.position.X + Projectile.width > player.position.X && Projectile.position.Y < player.position.Y + player.height && Projectile.position.Y + Projectile.height > player.position.Y) { if (player.whoAmI == Main.myPlayer) { CalamityPlayer calPlayer = player.Calamity(); calPlayer.phantomicHeartRegen = 720; - projectile.Kill(); + Projectile.Kill(); } } - if (player.lifeMagnet && projectile.timeLeft < 510) + if (player.lifeMagnet && Projectile.timeLeft < 510) { float N = 18f; playerDist = 15f / playerDist; playerVector.X *= playerDist; playerVector.Y *= playerDist; - projectile.velocity.X = (projectile.velocity.X * N + playerVector.X) / (N + 1f); - projectile.velocity.Y = (projectile.velocity.Y * N + playerVector.Y) / (N + 1f); + Projectile.velocity.X = (Projectile.velocity.X * N + playerVector.X) / (N + 1f); + Projectile.velocity.Y = (Projectile.velocity.Y * N + playerVector.Y) / (N + 1f); } - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; - if (projectile.frame % 2 == 0) - projectile.netUpdate = true; + Projectile.frame++; + Projectile.frameCounter = 0; + if (Projectile.frame % 2 == 0) + Projectile.netUpdate = true; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } } diff --git a/Projectiles/Healing/PhoenixHeal.cs b/Projectiles/Healing/PhoenixHeal.cs index 4ed7189924..893ff53828 100644 --- a/Projectiles/Healing/PhoenixHeal.cs +++ b/Projectiles/Healing/PhoenixHeal.cs @@ -14,22 +14,22 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 420; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 420; + Projectile.extraUpdates = 3; } public override void AI() { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.95f; - projectile.HealingProjectile(10, (int)projectile.ai[0], 6f, 15f, false, 360); - float num498 = projectile.velocity.X * 0.2f; - float num499 = -(projectile.velocity.Y * 0.2f); - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Projectile.velocity.X *= 0.95f; + Projectile.velocity.Y *= 0.95f; + Projectile.HealingProjectile(10, (int)Projectile.ai[0], 6f, 15f, false, 360); + float num498 = Projectile.velocity.X * 0.2f; + float num499 = -(Projectile.velocity.Y * 0.2f); + int num500 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num500]; dust.noGravity = true; dust.position.X -= num498; diff --git a/Projectiles/Healing/RainHeal.cs b/Projectiles/Healing/RainHeal.cs index 8249fee0be..ee06354060 100644 --- a/Projectiles/Healing/RainHeal.cs +++ b/Projectiles/Healing/RainHeal.cs @@ -14,28 +14,28 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; } public override void AI() { - if (projectile.timeLeft < 165) + if (Projectile.timeLeft < 165) { - if (projectile.timeLeft > 150) - projectile.velocity *= 0.9f; + if (Projectile.timeLeft > 150) + Projectile.velocity *= 0.9f; else - projectile.HealingProjectile(8, projectile.owner, 12f, 15f, false); + Projectile.HealingProjectile(8, Projectile.owner, 12f, 15f, false); } - float num498 = projectile.velocity.X * 0.2f; - float num499 = -(projectile.velocity.Y * 0.2f); - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + float num498 = Projectile.velocity.X * 0.2f; + float num499 = -(Projectile.velocity.Y * 0.2f); + int num500 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Dust dust = Main.dust[num500]; dust.noGravity = true; dust.position.X -= num498; diff --git a/Projectiles/Healing/ReaverHealOrb.cs b/Projectiles/Healing/ReaverHealOrb.cs index b0aa542221..dc33a2d16d 100644 --- a/Projectiles/Healing/ReaverHealOrb.cs +++ b/Projectiles/Healing/ReaverHealOrb.cs @@ -13,23 +13,23 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 240; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 240; + Projectile.extraUpdates = 3; } public override void AI() { - projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f); - int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default, 2f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5.5f, 15f); + int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 74, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[dusty]; dust.noGravity = true; - dust.position.X -= projectile.velocity.X * 0.2f; - dust.position.Y += projectile.velocity.Y * 0.2f; + dust.position.X -= Projectile.velocity.X * 0.2f; + dust.position.Y += Projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/RoyalHeal.cs b/Projectiles/Healing/RoyalHeal.cs index bdd8c010b4..96d3429805 100644 --- a/Projectiles/Healing/RoyalHeal.cs +++ b/Projectiles/Healing/RoyalHeal.cs @@ -14,21 +14,21 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.extraUpdates = 10; + Projectile.width = 6; + Projectile.height = 6; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.extraUpdates = 10; } public override void AI() { - projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5.5f, 15f); for (int num493 = 0; num493 < 3; num493++) { - float num494 = projectile.velocity.X * 0.334f * (float)num493; - float num495 = -(projectile.velocity.Y * 0.334f) * (float)num493; - int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 1.1f); + float num494 = Projectile.velocity.X * 0.334f * (float)num493; + float num495 = -(Projectile.velocity.Y * 0.334f) * (float)num493; + int num496 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.1f); Dust dust = Main.dust[num496]; dust.noGravity = true; dust.position.X -= num494; @@ -36,9 +36,9 @@ namespace CalamityMod.Projectiles.Healing } for (int num497 = 0; num497 < 5; num497++) { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 1.3f); + float num498 = Projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(Projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.3f); Dust dust2 = Main.dust[num500]; dust2.noGravity = true; dust2.position.X -= num498; diff --git a/Projectiles/Healing/ShinobiHealOrb.cs b/Projectiles/Healing/ShinobiHealOrb.cs index afd6e7749d..b02276a89e 100644 --- a/Projectiles/Healing/ShinobiHealOrb.cs +++ b/Projectiles/Healing/ShinobiHealOrb.cs @@ -14,22 +14,22 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 300; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; } public override void AI() { - projectile.HealingProjectile((int)projectile.ai[1], projectile.owner, 6f, 15f); + Projectile.HealingProjectile((int)Projectile.ai[1], Projectile.owner, 6f, 15f); for (int num468 = 0; num468 < 3; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 15, 0f, 0f, 100, default, 1.3f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 15, 0f, 0f, 100, default, 1.3f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } diff --git a/Projectiles/Healing/SilvaOrb.cs b/Projectiles/Healing/SilvaOrb.cs index f413e11c86..3723325429 100644 --- a/Projectiles/Healing/SilvaOrb.cs +++ b/Projectiles/Healing/SilvaOrb.cs @@ -12,49 +12,49 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.extraUpdates = 3; + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 3; } public override void AI() { - projectile.alpha -= 2; - if (projectile.localAI[0] == 0f) + Projectile.alpha -= 2; + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.05f; - if (projectile.scale > 1.2f) + Projectile.scale += 0.05f; + if (Projectile.scale > 1.2f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } } else { - projectile.scale -= 0.05f; - if (projectile.scale < 0.8f) + Projectile.scale -= 0.05f; + if (Projectile.scale < 0.8f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } } - projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 6f, 15f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 6f, 15f); return; } public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); + return new Color(Main.DiscoR, 203, 103, Projectile.alpha); } public override void Kill(int timeLeft) { for (int num407 = 0; num407 < 5; num407++) { - int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + int num408 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[num408].noGravity = true; Main.dust[num408].velocity *= 1.5f; Main.dust[num408].scale = 1.5f; diff --git a/Projectiles/Healing/TerracottaProj.cs b/Projectiles/Healing/TerracottaProj.cs index 608b4e9e6f..a563985778 100644 --- a/Projectiles/Healing/TerracottaProj.cs +++ b/Projectiles/Healing/TerracottaProj.cs @@ -14,23 +14,23 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 360; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 360; } public override void AI() { - projectile.velocity *= 0.99f; + Projectile.velocity *= 0.99f; - projectile.HealingProjectile(9, (int)projectile.ai[0], 8f, 15f, false, 300); - float num498 = projectile.velocity.X * 0.2f; - float num499 = -(projectile.velocity.Y * 0.2f); - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); + Projectile.HealingProjectile(9, (int)Projectile.ai[0], 8f, 15f, false, 300); + float num498 = Projectile.velocity.X * 0.2f; + float num499 = -(Projectile.velocity.Y * 0.2f); + int num500 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num500]; dust.noGravity = true; dust.position.X -= num498; @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Healing { for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { diff --git a/Projectiles/Healing/TransfusionTrail.cs b/Projectiles/Healing/TransfusionTrail.cs index 20cddb6036..6371624598 100644 --- a/Projectiles/Healing/TransfusionTrail.cs +++ b/Projectiles/Healing/TransfusionTrail.cs @@ -14,28 +14,28 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.extraUpdates = 10; + Projectile.width = 6; + Projectile.height = 6; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.extraUpdates = 10; } public override void AI() { - projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 6.5f, 15f); - float num494 = projectile.velocity.X * 0.334f; - float num495 = -(projectile.velocity.Y * 0.334f); - int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 183, 0f, 0f, 100, default, 0.7f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 6.5f, 15f); + float num494 = Projectile.velocity.X * 0.334f; + float num495 = -(Projectile.velocity.Y * 0.334f); + int num496 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 183, 0f, 0f, 100, default, 0.7f); Dust dust = Main.dust[num496]; dust.noGravity = true; dust.position.X -= num494; dust.position.Y -= num495; for (int num497 = 0; num497 < 2; num497++) { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 183, 0f, 0f, 100, default, 0.9f); + float num498 = Projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(Projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 183, 0f, 0f, 100, default, 0.9f); Dust dust2 = Main.dust[num500]; dust2.noGravity = true; dust2.position.X -= num498; diff --git a/Projectiles/Healing/XerocHealOrb.cs b/Projectiles/Healing/XerocHealOrb.cs index 3be81d7384..f100881822 100644 --- a/Projectiles/Healing/XerocHealOrb.cs +++ b/Projectiles/Healing/XerocHealOrb.cs @@ -12,23 +12,23 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 240; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 240; + Projectile.extraUpdates = 3; } public override void AI() { - projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f); - float num498 = projectile.velocity.X * 0.2f; - float num499 = -(projectile.velocity.Y * 0.2f); - if (projectile.timeLeft % 2 == 0) + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5.5f, 15f); + float num498 = Projectile.velocity.X * 0.2f; + float num499 = -(Projectile.velocity.Y * 0.2f); + if (Projectile.timeLeft % 2 == 0) { - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 2f); + int num500 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[num500]; dust.noGravity = true; dust.position.X -= num498; diff --git a/Projectiles/Hybrid/AetherBeam.cs b/Projectiles/Hybrid/AetherBeam.cs index 4283c18829..5187dc6007 100644 --- a/Projectiles/Hybrid/AetherBeam.cs +++ b/Projectiles/Hybrid/AetherBeam.cs @@ -20,59 +20,59 @@ namespace CalamityMod.Projectiles.Hybrid public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.magic = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.timeLeft = 300; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 5; + Projectile.timeLeft = 300; } public override void AI() { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.magic = false; - projectile.ranged = true; + // projectile.magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + Projectile.DamageType = DamageClass.Ranged; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { split = false; - projectile.tileCollide = false; - projectile.ai[1] = 0f; + Projectile.tileCollide = false; + Projectile.ai[1] = 0f; } - projectile.damage += projectile.Calamity().defDamage / 200; + Projectile.damage += Projectile.Calamity().defDamage / 200; - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 1f, 0f, 0.7f); + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 1f, 0f, 0.7f); float num55 = 100f; float num56 = 2f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - projectile.localAI[0] = num55; + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) + Projectile.localAI[0] = num55; } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - projectile.Kill(); + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) + Projectile.Kill(); } } public override Color? GetAlpha(Color lightColor) => new Color(250, 50, 200, 0); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 2f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(100f, 2f, lightColor); public override bool OnTileCollide(Vector2 oldVelocity) { @@ -80,17 +80,17 @@ namespace CalamityMod.Projectiles.Hybrid { float random = Main.rand.Next(30, 90); float spread = random * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int proj1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, projectile.ai[0], 1f); - int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, projectile.ai[0], 1f); + int proj1 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0], 1f); + int proj2 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0], 1f); } } } diff --git a/Projectiles/Magic/AbyssBall.cs b/Projectiles/Magic/AbyssBall.cs index 208c9e6bc6..68f968d9eb 100644 --- a/Projectiles/Magic/AbyssBall.cs +++ b/Projectiles/Magic/AbyssBall.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -16,38 +17,38 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.alpha = 60; - projectile.penetrate = 2; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.magic = true; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.alpha = 60; + Projectile.penetrate = 2; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Projectile.velocity.X *= 0.985f; + Projectile.velocity.Y *= 0.985f; + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 160; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 160; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 14); for (int num621 = 0; num621 < 30; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -57,10 +58,10 @@ namespace CalamityMod.Projectiles.Magic } for (int num623 = 0; num623 < 60; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Magic/AcidGunStream.cs b/Projectiles/Magic/AcidGunStream.cs index fe51b26ecf..c88d3ca1c9 100644 --- a/Projectiles/Magic/AcidGunStream.cs +++ b/Projectiles/Magic/AcidGunStream.cs @@ -15,51 +15,51 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.extraUpdates = 2; - projectile.tileCollide = false; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; } public override void AI() { - projectile.ai[1]++; - if (projectile.ai[1] >= 4f) + Projectile.ai[1]++; + if (Projectile.ai[1] >= 4f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - projectile.scale -= 0.002f; - if (projectile.scale <= 0f) + Projectile.scale -= 0.002f; + if (Projectile.scale <= 0f) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.ai[0] <= 3f) + if (Projectile.ai[0] <= 3f) { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; return; } - projectile.velocity.Y = projectile.velocity.Y + 0.075f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.075f; for (int i = 0; i < 3; i++) { - Vector2 positionDelta = projectile.velocity / 3f * i; + Vector2 positionDelta = Projectile.velocity / 3f * i; int spawnDelta = 14; - int dustIdx = Dust.NewDust(new Vector2(projectile.position.X + spawnDelta, projectile.position.Y + spawnDelta), projectile.width - spawnDelta * 2, projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); + int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[dustIdx]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.5f; + dust.velocity += Projectile.velocity * 0.5f; dust.position -= positionDelta; } if (Main.rand.NextBool(8)) { int spawnDelta = 16; - int dustIdx = Dust.NewDust(new Vector2(projectile.position.X + spawnDelta, projectile.position.Y + spawnDelta), projectile.width - spawnDelta * 2, projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 0.5f); + int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 0.5f); Main.dust[dustIdx].velocity *= 0.25f; - Main.dust[dustIdx].velocity += projectile.velocity * 0.5f; + Main.dust[dustIdx].velocity += Projectile.velocity * 0.5f; } } } diff --git a/Projectiles/Magic/AcidicReed.cs b/Projectiles/Magic/AcidicReed.cs index f2d9e0fb0d..2848a0c15c 100644 --- a/Projectiles/Magic/AcidicReed.cs +++ b/Projectiles/Magic/AcidicReed.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class AcidicReed : ModProjectile @@ -13,35 +14,35 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.magic = true; - projectile.timeLeft = 600; - projectile.tileCollide = true; - projectile.ignoreWater = false; - projectile.penetrate = 1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 600; + Projectile.tileCollide = true; + Projectile.ignoreWater = false; + Projectile.penetrate = 1; } public override void AI() { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { Terraria.Audio.LegacySoundStyle saxSound = Utils.SelectRandom(Main.rand, new Terraria.Audio.LegacySoundStyle[] { - mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Saxophone/Sax1"), - mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Saxophone/Sax2"), - mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Saxophone/Sax3"), - mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Saxophone/Sax4"), - mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Saxophone/Sax5"), - mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Saxophone/Sax6") + Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Saxophone/Sax1"), + Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Saxophone/Sax2"), + Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Saxophone/Sax3"), + Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Saxophone/Sax4"), + Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Saxophone/Sax5"), + Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Saxophone/Sax6") }); - Main.PlaySound(saxSound, projectile.position); - projectile.ai[0] = 0f; + SoundEngine.PlaySound(saxSound, Projectile.position); + Projectile.ai[0] = 0f; } - if (projectile.velocity.Y < 10f) - projectile.velocity.Y += 0.25f; - projectile.rotation = projectile.velocity.ToRotation(); + if (Projectile.velocity.Y < 10f) + Projectile.velocity.Y += 0.25f; + Projectile.rotation = Projectile.velocity.ToRotation(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -58,10 +59,10 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i <= 2; i++) { - int idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; } diff --git a/Projectiles/Magic/AcidicSaxBubble.cs b/Projectiles/Magic/AcidicSaxBubble.cs index bb60398796..c440bc35b4 100644 --- a/Projectiles/Magic/AcidicSaxBubble.cs +++ b/Projectiles/Magic/AcidicSaxBubble.cs @@ -6,6 +6,7 @@ using Terraria.ModLoader; using CalamityMod.Dusts; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Magic; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -18,33 +19,33 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Bubble"); - Main.projFrames[projectile.type] = 7; + Main.projFrames[Projectile.type] = 7; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.alpha = 255; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.alpha = 255; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 6) + if (Projectile.frame > 6) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { if (counter >= 120f) { @@ -52,69 +53,69 @@ namespace CalamityMod.Projectiles.Magic Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); vector15.Normalize(); vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), (int)(BelchingSaxophone.BaseDamage * Main.player[projectile.owner].MagicDamage()), 1f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), (int)(BelchingSaxophone.BaseDamage * Main.player[Projectile.owner].MagicDamage()), 1f, Projectile.owner, 0f, 0f); } else counter += 1f; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 6f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 6f) { int num982 = 20; - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= num982; + Projectile.alpha -= num982; } - if (projectile.alpha < 80) + if (Projectile.alpha < 80) { - projectile.alpha = 80; + Projectile.alpha = 80; } } - if (projectile.ai[1] >= 45f) + if (Projectile.ai[1] >= 45f) { - projectile.ai[1] = 45f; + Projectile.ai[1] = 45f; if (counter2 < 1f) { counter2 += 0.002f; - projectile.scale += 0.002f; - projectile.width = (int)(30f * projectile.scale); - projectile.height = (int)(30f * projectile.scale); + Projectile.scale += 0.002f; + Projectile.width = (int)(30f * Projectile.scale); + Projectile.height = (int)(30f * Projectile.scale); } else { - projectile.width = 60; - projectile.height = 60; + Projectile.width = 60; + Projectile.height = 60; } - if (projectile.wet) + if (Projectile.wet) { - if (projectile.velocity.Y > 0f) + if (Projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; + Projectile.velocity.Y = Projectile.velocity.Y * 0.98f; } - if (projectile.velocity.Y > -1f) + if (Projectile.velocity.Y > -1f) { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; } } - else if (projectile.velocity.Y > -2f) + else if (Projectile.velocity.Y > -2f) { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.05f; } } killCounter++; if (killCounter >= 200) { - projectile.Kill(); + Projectile.Kill(); } } - projectile.StickyProjAI(15); + Projectile.StickyProjAI(15); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(3, false); + Projectile.ModifyHitNPCSticky(3, false); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -128,10 +129,10 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -147,28 +148,28 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(SoundID.Item54, projectile.Center); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item54, Projectile.Center); int num3; for (int num246 = 0; num246 < 25; num246 = num3 + 1) { - int num247 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 0, default, 1f); - Main.dust[num247].position = (Main.dust[num247].position + projectile.position) / 2f; + int num247 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 0, default, 1f); + Main.dust[num247].position = (Main.dust[num247].position + Projectile.position) / 2f; Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); Main.dust[num247].velocity.Normalize(); Dust dust = Main.dust[num247]; dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[num247].alpha = projectile.alpha; + Main.dust[num247].alpha = Projectile.alpha; num3 = num246; } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); } } } diff --git a/Projectiles/Magic/AcidicSaxMist.cs b/Projectiles/Magic/AcidicSaxMist.cs index c278567bd8..ac49cbc172 100644 --- a/Projectiles/Magic/AcidicSaxMist.cs +++ b/Projectiles/Magic/AcidicSaxMist.cs @@ -2,6 +2,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -10,69 +11,69 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Mist"); - Main.projFrames[projectile.type] = 10; + Main.projFrames[Projectile.type] = 10; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 9) + if (Projectile.frame > 9) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 111); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 111); } - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 90f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 5; - if (projectile.alpha > 255) + Projectile.alpha += 5; + if (Projectile.alpha > 255) { - projectile.alpha = 255; - projectile.Kill(); + Projectile.alpha = 255; + Projectile.Kill(); } } } - else if (projectile.alpha > 80) + else if (Projectile.alpha > 80) { - projectile.alpha -= 30; - if (projectile.alpha < 80) + Projectile.alpha -= 30; + if (Projectile.alpha < 80) { - projectile.alpha = 80; + Projectile.alpha = 80; } } } diff --git a/Projectiles/Magic/AetherfluxCannonHoldout.cs b/Projectiles/Magic/AetherfluxCannonHoldout.cs index 4de0982e8b..5241c298fb 100644 --- a/Projectiles/Magic/AetherfluxCannonHoldout.cs +++ b/Projectiles/Magic/AetherfluxCannonHoldout.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -11,53 +12,53 @@ namespace CalamityMod.Projectiles.Magic { private const int FramesPerFireRateIncrease = 36; - private Player Owner => Main.player[projectile.owner]; + private Player Owner => Main.player[Projectile.owner]; private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; - private ref float DeployedFrames => ref projectile.ai[0]; - private ref float AnimationRate => ref projectile.ai[1]; - private ref float LastShootAttemptTime => ref projectile.localAI[0]; - private ref float LastAnimationTime => ref projectile.localAI[1]; + private ref float DeployedFrames => ref Projectile.ai[0]; + private ref float AnimationRate => ref Projectile.ai[1]; + private ref float LastShootAttemptTime => ref Projectile.localAI[0]; + private ref float LastAnimationTime => ref Projectile.localAI[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Aetherflux Cannon"); - Main.projFrames[projectile.type] = 8; + Main.projFrames[Projectile.type] = 8; } public override void SetDefaults() { - projectile.width = 58; - projectile.height = 94; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; + Projectile.width = 58; + Projectile.height = 94; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 gunBarrelPos = armPosition + projectile.velocity * projectile.height * 0.4f; + Vector2 gunBarrelPos = armPosition + Projectile.velocity * Projectile.height * 0.4f; // If the player is unable to continue using the holdout, delete it. if (!OwnerCanShoot) { - projectile.Kill(); + Projectile.Kill(); return; } // Play a sound frame 1. if (DeployedFrames <= 0f) { - var sound = Main.PlaySound(SoundID.DD2_DarkMageCastHeal, projectile.Center); + var sound = SoundEngine.PlaySound(SoundID.DD2_DarkMageCastHeal, Projectile.Center); CalamityUtils.SafeVolumeChange(ref sound, 1.5f); } // Update damage based on curent magic damage stat (so Mana Sickness affects it) Item weaponItem = Owner.ActiveItem(); - projectile.damage = (int)((weaponItem?.damage ?? 0) * Owner.MagicDamage()); + Projectile.damage = (int)((weaponItem?.damage ?? 0) * Owner.MagicDamage()); // Get the original weapon's use time. int itemUseTime = weaponItem?.useAnimation ?? T1000.UseTime; @@ -74,7 +75,7 @@ namespace CalamityMod.Projectiles.Magic if (DeployedFrames - LastAnimationTime >= AnimationRate) { LastAnimationTime = DeployedFrames; - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; } // Once past the initial spin-up time, fire constantly as long as mana is available. @@ -87,11 +88,11 @@ namespace CalamityMod.Projectiles.Magic if (manaOK) { if (actuallyShoot) - Main.PlaySound(SoundID.Item91, projectile.Center); + SoundEngine.PlaySound(SoundID.Item91, Projectile.Center); int projID = ModContent.ProjectileType(); float shootSpeed = weaponItem.shootSpeed; - Vector2 shootDirection = projectile.velocity.SafeNormalize(Vector2.UnitY); + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.UnitY); Vector2 shootVelocity = shootDirection * shootSpeed; // Waving beams need to start offset so they cross each other neatly. @@ -108,7 +109,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 dustVelocity = shootVelocity + dustInaccuracy * dustOnlySpread; if (actuallyShoot) { - Projectile godRay = Projectile.NewProjectileDirect(laserStartPos, shootVelocity, projID, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile godRay = Projectile.NewProjectileDirect(laserStartPos, shootVelocity, projID, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); // Tell this Phased God Ray exactly which way it should be waving. godRay.localAI[1] = i * 0.5f; } @@ -119,7 +120,7 @@ namespace CalamityMod.Projectiles.Magic // Delete the laser gun if a mana cost cannot be paid. else { - projectile.Kill(); + Projectile.Kill(); return; } } @@ -130,31 +131,31 @@ namespace CalamityMod.Projectiles.Magic private void UpdateProjectileHeldVariables(Vector2 armPosition) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - float interpolant = Utils.InverseLerp(5f, 25f, projectile.Distance(Main.MouseWorld), true); - Vector2 oldVelocity = projectile.velocity; - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(Main.MouseWorld), interpolant); - if (projectile.velocity != oldVelocity) + float interpolant = Utils.InverseLerp(5f, 25f, Projectile.Distance(Main.MouseWorld), true); + Vector2 oldVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), interpolant); + if (Projectile.velocity != oldVelocity) { - projectile.netSpam = 0; - projectile.netUpdate = true; + Projectile.netSpam = 0; + Projectile.netUpdate = true; } } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.Center = armPosition + projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction) * 8f; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.Center = armPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction) * 8f; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; } private void ManipulatePlayerVariables() { - Owner.ChangeDir(projectile.direction); - Owner.heldProj = projectile.whoAmI; + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } private void SpawnFiringDust(Vector2 gunBarrelPos, Vector2 laserVelocity) diff --git a/Projectiles/Magic/Ancient.cs b/Projectiles/Magic/Ancient.cs index ef3648affb..71c3821efb 100644 --- a/Projectiles/Magic/Ancient.cs +++ b/Projectiles/Magic/Ancient.cs @@ -12,58 +12,58 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Ancient"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 100; - projectile.height = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.penetrate = 6; - projectile.extraUpdates = 6; - projectile.timeLeft = 151; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 100; + Projectile.height = 100; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.penetrate = 6; + Projectile.extraUpdates = 6; + Projectile.timeLeft = 151; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.6f, 0.5f, 0f); - if (projectile.timeLeft % 30 == 0) + Lighting.AddLight(Projectile.Center, 0.6f, 0.5f, 0f); + if (Projectile.timeLeft % 30 == 0) { int numProj = 3; float randomSpread = Main.rand.NextFloat(3f, 18f); float rotation = MathHelper.ToRadians(randomSpread); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = -1; i < numProj - 1; i++) { - Vector2 perturbedSpeed = projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i)); - Projectile.NewProjectile(projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, projectile.ai[1]); + Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i)); + Projectile.NewProjectile(Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, Projectile.ai[1]); } } } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.ai[0] > 4f && projectile.numUpdates % 2 == 0) + if (Projectile.ai[0] > 4f && Projectile.numUpdates % 2 == 0) { int dustType = 22; - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[idx]; if (Main.rand.NextBool(2)) { @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Magic } dust.velocity.X *= 2f; dust.velocity.Y *= 2f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); if (Main.rand.NextBool(3)) { dust.noGravity = true; @@ -93,27 +93,27 @@ namespace CalamityMod.Projectiles.Magic dust.velocity.X *= 1.5f; dust.velocity.Y *= 1.5f; } - projectile.ai[0] += 1f; - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.ai[0] += 1f; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); // Dust effects - Circle dustCircle = new Circle(projectile.Center, projectile.width / 2); + Circle dustCircle = new Circle(Projectile.Center, Projectile.width / 2); for (int i = 0; i < 20; i++) { // Dust Vector2 dustPos = dustCircle.RandomPointInCircle(); - if ((dustPos - projectile.Center).Length() > 48) + if ((dustPos - Projectile.Center).Length() > 48) { int dustIndex = Dust.NewDust(dustPos, 1, 1, 22); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].fadeIn = 1f; - Vector2 dustVelocity = projectile.Center - Main.dust[dustIndex].position; + Vector2 dustVelocity = Projectile.Center - Main.dust[dustIndex].position; float distToCenter = dustVelocity.Length(); dustVelocity.Normalize(); dustVelocity = dustVelocity.RotatedBy(MathHelper.ToRadians(-90f)); diff --git a/Projectiles/Magic/Ancient2.cs b/Projectiles/Magic/Ancient2.cs index 524683df69..8e69b9c7e6 100644 --- a/Projectiles/Magic/Ancient2.cs +++ b/Projectiles/Magic/Ancient2.cs @@ -13,42 +13,42 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Ancient"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = 4; - projectile.extraUpdates = 12; - projectile.timeLeft = 30; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.scale = 0.5f; + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 4; + Projectile.extraUpdates = 12; + Projectile.timeLeft = 30; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; + Projectile.scale = 0.5f; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.3f, 0.25f, 0f); - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Lighting.AddLight(Projectile.Center, 0.3f, 0.25f, 0f); + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - if (projectile.ai[0] > 7f && projectile.numUpdates % 2 == 0) + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; + if (Projectile.ai[0] > 7f && Projectile.numUpdates % 2 == 0) { int dustType = 22; - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[idx]; if (Main.rand.NextBool(2)) { @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic } dust.velocity.X *= 3f; dust.velocity.Y *= 3f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); if (Main.rand.NextBool(3)) { dust.noGravity = true; @@ -78,37 +78,37 @@ namespace CalamityMod.Projectiles.Magic dust.velocity.X *= 1.1f; dust.velocity.Y *= 1.1f; } - projectile.ai[0] += 1f; - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.ai[0] += 1f; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - int height = texture.Height / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameHeight, texture.Width, height); Vector2 origin = new Vector2(texture.Width / 2f, height / 2f); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); // Dust effects - Circle dustCircle = new Circle(projectile.Center, projectile.width / 2); + Circle dustCircle = new Circle(Projectile.Center, Projectile.width / 2); for (int i = 0; i < 20; i++) { // Dust Vector2 dustPos = dustCircle.RandomPointInCircle(); - if ((dustPos - projectile.Center).Length() > 48) + if ((dustPos - Projectile.Center).Length() > 48) { int dustIndex = Dust.NewDust(dustPos, 1, 1, 22); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].fadeIn = 1f; - Vector2 dustVelocity = projectile.Center - Main.dust[dustIndex].position; + Vector2 dustVelocity = Projectile.Center - Main.dust[dustIndex].position; float distToCenter = dustVelocity.Length(); dustVelocity.Normalize(); dustVelocity = dustVelocity.RotatedBy(MathHelper.ToRadians(-90f)); diff --git a/Projectiles/Magic/ApotheosisEnergy.cs b/Projectiles/Magic/ApotheosisEnergy.cs index 9fcd4318e3..5aed3a238e 100644 --- a/Projectiles/Magic/ApotheosisEnergy.cs +++ b/Projectiles/Magic/ApotheosisEnergy.cs @@ -13,39 +13,39 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Apotheosis Energy"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = 210; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.timeLeft = 210; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.Cyan.ToVector3() * projectile.Opacity); + Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3() * Projectile.Opacity); // Fade-effects. - if (projectile.timeLeft < 40f) - projectile.Opacity = Utils.InverseLerp(0f, 40f, projectile.timeLeft, true); + if (Projectile.timeLeft < 40f) + Projectile.Opacity = Utils.InverseLerp(0f, 40f, Projectile.timeLeft, true); else - projectile.alpha = Utils.Clamp(projectile.alpha - 30, 0, 255); + Projectile.alpha = Utils.Clamp(Projectile.alpha - 30, 0, 255); - NPC potentialTarget = projectile.Center.ClosestNPCAt(5900f); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(5900f); if (potentialTarget != null) { - float squaredTargetDistance = projectile.DistanceSQ(potentialTarget.Center); + float squaredTargetDistance = Projectile.DistanceSQ(potentialTarget.Center); if (squaredTargetDistance > 120f * 120f && squaredTargetDistance < 1000f * 1000f) - projectile.velocity = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(potentialTarget.Center), 0.1f).ToRotationVector2() * projectile.velocity.Length(); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.AngleTo(potentialTarget.Center), 0.1f).ToRotationVector2() * Projectile.velocity.Length(); } } @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic Color colorToUse = baseColor; if (completionRatio > 0.5f) colorToUse = Color.Lerp(baseColor, Color.Transparent, 1f - completionRatio / 0.5f); - return colorToUse * projectile.Opacity; + return colorToUse * Projectile.Opacity; } internal float WidthFunction(float completionRatio) @@ -74,14 +74,14 @@ namespace CalamityMod.Projectiles.Magic width = (float)Math.Sin(completionRatio / 0.2f * MathHelper.PiOver2) * maxWidthOutwardness + 0.1f; else width = MathHelper.Lerp(maxWidthOutwardness, 0f, Utils.InverseLerp(0.2f, 1f, completionRatio, true)); - return width * projectile.Opacity; + return width * Projectile.Opacity; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - for (int i = 0; i < projectile.oldPos.Length; i++) + for (int i = 0; i < Projectile.oldPos.Length; i++) { - if (Collision.CheckAABBvAABBCollision(projectile.oldPos[i], projHitbox.Size(), targetHitbox.TopLeft(), projHitbox.Size())) + if (Collision.CheckAABBvAABBCollision(Projectile.oldPos[i], projHitbox.Size(), targetHitbox.TopLeft(), projHitbox.Size())) return true; } return false; @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Magic if (TrailDrawer is null) TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction); - TrailDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f - Main.screenPosition, 85); + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 85); return false; } } diff --git a/Projectiles/Magic/ApotheosisWorm.cs b/Projectiles/Magic/ApotheosisWorm.cs index c498678a27..9b5a4489bc 100644 --- a/Projectiles/Magic/ApotheosisWorm.cs +++ b/Projectiles/Magic/ApotheosisWorm.cs @@ -6,6 +6,7 @@ using System; using System.IO; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -43,10 +44,10 @@ namespace CalamityMod.Projectiles.Magic internal Vector2 PortalPosition; internal Segment[] Segments = new Segment[80]; - internal Player Owner => Main.player[projectile.owner]; - internal ref float Time => ref projectile.ai[0]; - internal ref float FlyAcceleration => ref projectile.ai[1]; - internal ref float JawRotation => ref projectile.localAI[1]; + internal Player Owner => Main.player[Projectile.owner]; + internal ref float Time => ref Projectile.ai[0]; + internal ref float FlyAcceleration => ref Projectile.ai[1]; + internal ref float JawRotation => ref Projectile.localAI[1]; public override void SetStaticDefaults() { @@ -55,19 +56,19 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 108; - projectile.height = 108; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 9; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.light = 1.5f; + Projectile.width = 108; + Projectile.height = 108; + Projectile.alpha = 255; + Projectile.timeLeft = 300; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 9; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + Projectile.light = 1.5f; } // Be VERY careful with the projectile's netcode, and use syncs very sparingly. @@ -97,22 +98,22 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; // Initialization. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - PortalPosition = projectile.Center + projectile.velocity * 7f; - if (Main.myPlayer == projectile.owner) + PortalPosition = Projectile.Center + Projectile.velocity * 7f; + if (Main.myPlayer == Projectile.owner) InitializeSegments(); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } // Head fade-in effects. - if (projectile.timeLeft <= 75) - projectile.alpha = Utils.Clamp(projectile.alpha + 40, 0, 255); + if (Projectile.timeLeft <= 75) + Projectile.alpha = Utils.Clamp(Projectile.alpha + 40, 0, 255); else if (Time > 15f) - projectile.alpha = Utils.Clamp(projectile.alpha - 40, 0, 255); + Projectile.alpha = Utils.Clamp(Projectile.alpha - 40, 0, 255); // Update all segments of the devourer every frame. for (int i = 0; i < Segments.Length; i++) @@ -123,32 +124,32 @@ namespace CalamityMod.Projectiles.Magic // Reset the jaw's rotation slowly over time. JawRotation = MathHelper.Lerp(JawRotation, 0f, 0.08f); - NPC potentialTarget = projectile.Center.ClosestNPCAt(4200f); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(4200f); if (potentialTarget != null) AttackTarget(potentialTarget); } internal void InitializeSegments() { - Vector2 directionToMouse = (Main.MouseWorld - projectile.Center).SafeNormalize(Vector2.UnitX * Owner.direction); - projectile.rotation = directionToMouse.ToRotation() + MathHelper.PiOver2; + Vector2 directionToMouse = (Main.MouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.rotation = directionToMouse.ToRotation() + MathHelper.PiOver2; for (int i = 0; i < Segments.Length; i++) { - Segments[i] = new Segment(255, projectile.rotation, projectile.Center + directionToMouse / Segments.Length * i * 900f); + Segments[i] = new Segment(255, Projectile.rotation, Projectile.Center + directionToMouse / Segments.Length * i * 900f); } - projectile.netUpdate = true; + Projectile.netUpdate = true; } internal void UpdateSegment(int segmentIndex) { - float aheadSegmentRotation = segmentIndex > 0 ? Segments[segmentIndex - 1].Rotation : projectile.rotation; - Vector2 aheadSegmentCenter = segmentIndex > 0 ? Segments[segmentIndex - 1].Center : projectile.Center; + float aheadSegmentRotation = segmentIndex > 0 ? Segments[segmentIndex - 1].Rotation : Projectile.rotation; + Vector2 aheadSegmentCenter = segmentIndex > 0 ? Segments[segmentIndex - 1].Center : Projectile.Center; Vector2 offsetToAheadSegment = aheadSegmentCenter - Segments[segmentIndex].Center; // Individual segment fade effects depending on time. - if (projectile.timeLeft <= 60) + if (Projectile.timeLeft <= 60) { - int invisibleSegmentIndex = (int)MathHelper.Lerp(0f, Segments.Length, 1f - MathHelper.Clamp(projectile.timeLeft / 60f * 1.4f, 0f, 1f)); + int invisibleSegmentIndex = (int)MathHelper.Lerp(0f, Segments.Length, 1f - MathHelper.Clamp(Projectile.timeLeft / 60f * 1.4f, 0f, 1f)); if (segmentIndex < invisibleSegmentIndex) { Segments[segmentIndex].Alpha += 31; @@ -184,29 +185,29 @@ namespace CalamityMod.Projectiles.Magic internal void AttackTarget(NPC target) { - if (Time >= 40f && projectile.alpha == 0 && Main.rand.NextBool(8)) + if (Time >= 40f && Projectile.alpha == 0 && Main.rand.NextBool(8)) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { Segment segmentToShootFrom = Segments[Main.rand.Next(Segments.Length)]; Vector2 shootVelocity = (target.Center - segmentToShootFrom.Center).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.25f) * 18f; - Projectile.NewProjectile(segmentToShootFrom.Center, shootVelocity, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner); + Projectile.NewProjectile(segmentToShootFrom.Center, shootVelocity, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner); } if (Main.rand.NextBool(10)) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), Projectile.Center); } float idealFlyAcceleration = 0.18f; Vector2 destination = target.Center; - float distanceFromDestination = projectile.Distance(destination); + float distanceFromDestination = Projectile.Distance(destination); // Get a swerve effect if somewhat far from the target. - if (projectile.Distance(destination) > 725f) + if (Projectile.Distance(destination) > 725f) { destination += (Time % 30f / 30f * MathHelper.TwoPi).ToRotationVector2() * 145f; - distanceFromDestination = projectile.Distance(destination); + distanceFromDestination = Projectile.Distance(destination); idealFlyAcceleration *= 2.5f; } @@ -216,12 +217,12 @@ namespace CalamityMod.Projectiles.Magic FlyAcceleration = MathHelper.Lerp(FlyAcceleration, idealFlyAcceleration, 0.3f); - float directionToTargetOrthogonality = Vector2.Dot(projectile.velocity.SafeNormalize(Vector2.Zero), projectile.SafeDirectionTo(destination)); + float directionToTargetOrthogonality = Vector2.Dot(Projectile.velocity.SafeNormalize(Vector2.Zero), Projectile.SafeDirectionTo(destination)); // Fly towards the target if it's far. if (distanceFromDestination > 320f) { - float speed = projectile.velocity.Length(); + float speed = Projectile.velocity.Length(); if (speed < 23f) speed += 0.08f; @@ -238,7 +239,7 @@ namespace CalamityMod.Projectiles.Magic speed = MathHelper.Clamp(speed, 16f, 34f); - projectile.velocity = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(destination), FlyAcceleration).ToRotationVector2() * speed; + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.AngleTo(destination), FlyAcceleration).ToRotationVector2() * speed; } // Open jaws when near the target, and snap when really close. @@ -259,21 +260,21 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == 1) + if (Projectile.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D headTexture = Main.projectileTexture[projectile.type]; - Vector2 drawPosition = projectile.Center - Main.screenPosition; - Vector2 headTextureOrigin = Main.projectileTexture[projectile.type].Size() * 0.5f; - drawPosition -= headTexture.Size() * projectile.scale * 0.5f; - drawPosition += headTextureOrigin * projectile.scale + new Vector2(0f, 4f + projectile.gfxOffY); + Texture2D headTexture = Main.projectileTexture[Projectile.type]; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 headTextureOrigin = Main.projectileTexture[Projectile.type].Size() * 0.5f; + drawPosition -= headTexture.Size() * Projectile.scale * 0.5f; + drawPosition += headTextureOrigin * Projectile.scale + new Vector2(0f, 4f + Projectile.gfxOffY); - Texture2D jawTexture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/ApotheosisJaw"); + Texture2D jawTexture = ModContent.Request("CalamityMod/Projectiles/Magic/ApotheosisJaw"); Vector2 jawOrigin = jawTexture.Size() * 0.5f; // Segment drawing. - Texture2D bodyTexture = ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyS"); - Texture2D tailTexture = ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailS"); + Texture2D bodyTexture = ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyS"); + Texture2D tailTexture = ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailS"); // Not white to differentiate itself slightly from regular DoG when fighting Boss Rush. Color baseColor = Color.Lerp(Color.White, Color.Fuchsia, 0.15f); @@ -283,7 +284,7 @@ namespace CalamityMod.Projectiles.Magic bool isTail = i == Segments.Length - 1; Texture2D segmentTexture = isTail ? tailTexture : bodyTexture; Vector2 segmentOrigin = segmentTexture.Size() * 0.5f; - spriteBatch.Draw(segmentTexture, Segments[i].Center - Main.screenPosition, null, baseColor * ((255 - Segments[i].Alpha) / 255f), Segments[i].Rotation, segmentOrigin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(segmentTexture, Segments[i].Center - Main.screenPosition, null, baseColor * ((255 - Segments[i].Alpha) / 255f), Segments[i].Rotation, segmentOrigin, Projectile.scale, SpriteEffects.None, 0f); } // Jaw drawing. @@ -297,10 +298,10 @@ namespace CalamityMod.Projectiles.Magic // X/Y offsets for the jaws depending on the angle of the jaw. // Has potential to act weird at unexpected angles, but that should never happen naturally. Vector2 jawPosition = drawPosition; - jawPosition += Vector2.UnitX.RotatedBy(projectile.rotation + JawRotation * i) * i * (jawBaseOffset + (float)Math.Sin(JawRotation) * 24f); - jawPosition -= Vector2.UnitY.RotatedBy(projectile.rotation) * (38f + (float)Math.Sin(JawRotation) * 30f); + jawPosition += Vector2.UnitX.RotatedBy(Projectile.rotation + JawRotation * i) * i * (jawBaseOffset + (float)Math.Sin(JawRotation) * 24f); + jawPosition -= Vector2.UnitY.RotatedBy(Projectile.rotation) * (38f + (float)Math.Sin(JawRotation) * 30f); - spriteBatch.Draw(jawTexture, jawPosition, null, baseColor * projectile.Opacity, projectile.rotation + JawRotation * i, jawOrigin, projectile.scale, jawSpriteEffect, 0f); + spriteBatch.Draw(jawTexture, jawPosition, null, baseColor * Projectile.Opacity, Projectile.rotation + JawRotation * i, jawOrigin, Projectile.scale, jawSpriteEffect, 0f); } // Portal drawing at the start of the devourer's lifetime. @@ -310,9 +311,9 @@ namespace CalamityMod.Projectiles.Magic float currentFade = Utils.InverseLerp(0f, 8f, Time, true) * Utils.InverseLerp(60f, 52f, Time, true); currentFade *= (1f + 0.2f * (float)Math.Cos(Main.GlobalTime % 30f * MathHelper.Pi * 3f)) * 0.8f; - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/StarProj"); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/StarProj"); Vector2 drawPos = PortalPosition - Main.screenPosition; - baseColor = new Color(150, 100, 255, 255) * projectile.Opacity; + baseColor = new Color(150, 100, 255, 255) * Projectile.Opacity; baseColor *= 0.5f; baseColor.A = 0; Color colorA = baseColor; @@ -320,7 +321,7 @@ namespace CalamityMod.Projectiles.Magic colorA *= currentFade; colorB *= currentFade; Vector2 origin = texture.Size() / 2f; - Vector2 scale = new Vector2(4f, 10f) * projectile.Opacity * currentFade; + Vector2 scale = new Vector2(4f, 10f) * Projectile.Opacity * currentFade; spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver2, origin, scale, SpriteEffects.None, 0); spriteBatch.Draw(texture, drawPos, null, colorA, 0f, origin, scale, SpriteEffects.None, 0); @@ -345,14 +346,14 @@ namespace CalamityMod.Projectiles.Magic } // Head drawing. - spriteBatch.Draw(headTexture, drawPosition, null, baseColor * projectile.Opacity, projectile.rotation, headTextureOrigin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(headTexture, drawPosition, null, baseColor * Projectile.Opacity, Projectile.rotation, headTextureOrigin, Projectile.scale, spriteEffects, 0f); return false; } // Manual collision detection that incorporates segments. public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - if (Collision.CheckAABBvAABBCollision(projectile.position, projHitbox.Size(), targetHitbox.TopLeft(), projHitbox.Size())) + if (Collision.CheckAABBvAABBCollision(Projectile.position, projHitbox.Size(), targetHitbox.TopLeft(), projHitbox.Size())) return true; for (int i = 0; i < Segments.Length; i++) diff --git a/Projectiles/Magic/AquamarineBolt.cs b/Projectiles/Magic/AquamarineBolt.cs index 19ff595c7a..97d9b6835d 100644 --- a/Projectiles/Magic/AquamarineBolt.cs +++ b/Projectiles/Magic/AquamarineBolt.cs @@ -10,43 +10,43 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.magic = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); int num154 = 14; - int num155 = Dust.NewDust(projectile.Center, projectile.width - num154 * 2, projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1.5f); + int num155 = Dust.NewDust(Projectile.Center, Projectile.width - num154 * 2, Projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1.5f); Main.dust[num155].noGravity = true; Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; + Main.dust[num155].velocity += Projectile.velocity * 0.5f; if (Main.rand.NextBool(16)) { int num156 = 16; - int num157 = Dust.NewDust(projectile.Center, projectile.width - num156 * 2, projectile.height - num156 * 2, 68, 0f, 0f, 100, default, 1f); + int num157 = Dust.NewDust(Projectile.Center, Projectile.width - num156 * 2, Projectile.height - num156 * 2, 68, 0f, 0f, 100, default, 1f); Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; + Main.dust[num157].velocity += Projectile.velocity * 0.5f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/ArcticBearPawProj.cs b/Projectiles/Magic/ArcticBearPawProj.cs index 2a872a9904..61a587263b 100644 --- a/Projectiles/Magic/ArcticBearPawProj.cs +++ b/Projectiles/Magic/ArcticBearPawProj.cs @@ -10,18 +10,18 @@ namespace CalamityMod.Projectiles.Magic { public override void SetDefaults() { - projectile.width = projectile.height = 40; - projectile.aiStyle = 1; + Projectile.width = Projectile.height = 40; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.friendly = true; - projectile.magic = true; - projectile.coldDamage = true; - projectile.penetrate = 5; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.coldDamage = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.coldDamage = true; + Projectile.penetrate = 5; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.coldDamage = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void SetStaticDefaults() @@ -32,17 +32,17 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { //make pretty dust - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 88); Main.dust[index2].noGravity = true; - if (projectile.velocity.X > -0.05f && projectile.velocity.X < 0.05f & - projectile.velocity.Y > -0.05f && projectile.velocity.Y < 0.05f) + if (Projectile.velocity.X > -0.05f && Projectile.velocity.X < 0.05f & + Projectile.velocity.Y > -0.05f && Projectile.velocity.Y < 0.05f) { - projectile.Kill(); + Projectile.Kill(); } else { - projectile.velocity *= 0.968f; + Projectile.velocity *= 0.968f; } } @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } } } diff --git a/Projectiles/Magic/ArtAttackHoldout.cs b/Projectiles/Magic/ArtAttackHoldout.cs index 614b606c5d..aef74c68d6 100644 --- a/Projectiles/Magic/ArtAttackHoldout.cs +++ b/Projectiles/Magic/ArtAttackHoldout.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Projectiles.Magic { public class ArtAttackHoldout : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public const float AimResponsiveness = 0.72f; public override string Texture => "CalamityMod/Items/Weapons/Magic/ArtAttack"; @@ -18,13 +18,13 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 70; - projectile.height = 70; - projectile.friendly = false; - projectile.magic = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 90000; + Projectile.width = 70; + Projectile.height = 70; + Projectile.friendly = false; + // projectile.magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 90000; } public override void AI() @@ -32,50 +32,50 @@ namespace CalamityMod.Projectiles.Magic // Common code among holdouts to keep the holdout projectile directly in the player's hand. UpdatePlayerVisuals(); - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { // Update aim. UpdateAim(); // Create the star. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Vector2 initialStarVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f; - Projectile.NewProjectile(projectile.Center, initialStarVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - projectile.localAI[0] = 1f; + Vector2 initialStarVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f; + Projectile.NewProjectile(Projectile.Center, initialStarVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.localAI[0] = 1f; } if (!Owner.channel) - projectile.Kill(); + Projectile.Kill(); } } private void UpdatePlayerVisuals() { // Place the projectile directly into the player's hand at all times. - projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; // The staff is a holdout projectile; update the player's variables to reflect this. - Owner.ChangeDir(projectile.direction); - Owner.heldProj = projectile.whoAmI; + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.itemRotation = CalamityUtils.WrapAngle90Degrees(projectile.rotation); + Owner.itemRotation = CalamityUtils.WrapAngle90Degrees(Projectile.rotation); } // Adjusts the aim vector of the staff to point towards the mouse. This is Last Prism code. private void UpdateAim() { - Vector2 aimOffset = projectile.SafeDirectionTo(Main.MouseWorld, -Vector2.UnitY); - aimOffset = Vector2.Lerp(aimOffset, Vector2.Normalize(projectile.velocity), AimResponsiveness).SafeNormalize(Vector2.UnitY) * 30f; + Vector2 aimOffset = Projectile.SafeDirectionTo(Main.MouseWorld, -Vector2.UnitY); + aimOffset = Vector2.Lerp(aimOffset, Vector2.Normalize(Projectile.velocity), AimResponsiveness).SafeNormalize(Vector2.UnitY) * 30f; - if (aimOffset != projectile.velocity) + if (aimOffset != Projectile.velocity) { - projectile.netSpam = 0; - projectile.netUpdate = true; + Projectile.netSpam = 0; + Projectile.netUpdate = true; } - projectile.velocity = aimOffset; + Projectile.velocity = aimOffset; } public override bool CanDamage() => false; diff --git a/Projectiles/Magic/ArtAttackStar.cs b/Projectiles/Magic/ArtAttackStar.cs index c1e2a02cf8..9f91f670e2 100644 --- a/Projectiles/Magic/ArtAttackStar.cs +++ b/Projectiles/Magic/ArtAttackStar.cs @@ -9,41 +9,42 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class ArtAttackStar : ModProjectile { public PrimitiveTrail TrailDrawer = null; - public Player Owner => Main.player[projectile.owner]; - public ref float Time => ref projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; public const int StarShapeCreationDelay = 12; public override void SetStaticDefaults() { DisplayName.SetDefault("Star"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 120; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 120; } public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 9000; - projectile.alpha = 255; - projectile.magic = true; + Projectile.width = 2; + Projectile.height = 2; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 9000; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - ProjectileID.Sets.TrailCacheLength[projectile.type] = 60; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 60; // Die if the holdout is gone. if (Owner.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && Time >= 2f) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -51,7 +52,7 @@ namespace CalamityMod.Projectiles.Magic int shapeEndPoint = -1; // Determine if two points are intersecting with the star. - List cleanOldPositions = projectile.oldPos.Where(p => p != Vector2.Zero).ToList(); + List cleanOldPositions = Projectile.oldPos.Where(p => p != Vector2.Zero).ToList(); if (Time > StarShapeCreationDelay) { int start = 12; @@ -60,8 +61,8 @@ namespace CalamityMod.Projectiles.Magic float closedAngleLowerBound = (cleanOldPositions.Count - 2f) * MathHelper.Pi; for (int i = end - 1; i >= start; i--) { - float distanceFromStar = Vector2.Distance(projectile.position, projectile.oldPos[i]); - if (distanceFromStar < projectile.velocity.Length() * 0.7f + 12f) + float distanceFromStar = Vector2.Distance(Projectile.position, Projectile.oldPos[i]); + if (distanceFromStar < Projectile.velocity.Length() * 0.7f + 12f) { shapeIsComplete = true; @@ -73,7 +74,7 @@ namespace CalamityMod.Projectiles.Magic averageDistanceFromStar /= end - start; // Cancel out intersection "completions" if the velocity is slow enough to be rebounding or the shape is relatively small. - if (averageDistanceFromStar < projectile.velocity.Length() + 70f || projectile.velocity.Length() < 16f) + if (averageDistanceFromStar < Projectile.velocity.Length() + 70f || Projectile.velocity.Length() < 16f) shapeIsComplete = false; } @@ -87,19 +88,19 @@ namespace CalamityMod.Projectiles.Magic { if (shapeIsComplete) { - Main.PlaySound(SoundID.DD2_DarkMageHealImpact, Owner.Center); + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Owner.Center); DoShapeHitAreaChecks(cleanOldPositions, shapeEndPoint); } - projectile.Kill(); + Projectile.Kill(); return; } // Fade in. - projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.1f, 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.1f, 0f, 1f); // Update movement. - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) DoMouseMovement(); Time++; @@ -108,42 +109,42 @@ namespace CalamityMod.Projectiles.Magic public void DoMouseMovement() { Vector2 destination = Main.MouseWorld; - float distanceFromTarget = projectile.Distance(destination); + float distanceFromTarget = Projectile.Distance(destination); float moveInterpolant = Utils.InverseLerp(0f, 100f, distanceFromTarget, true) * Utils.InverseLerp(600f, 400f, distanceFromTarget, true); - Vector2 targetCenterOffsetVec = destination - projectile.Center; + Vector2 targetCenterOffsetVec = destination - Projectile.Center; float movementSpeed = MathHelper.Min(60f, targetCenterOffsetVec.Length()); Vector2 idealVelocity = targetCenterOffsetVec.SafeNormalize(Vector2.Zero) * movementSpeed; // Ensure velocity never has a magnitude less than 2. - if (projectile.velocity.Length() < 2f) - projectile.velocity += projectile.velocity.RotatedBy(MathHelper.PiOver4).SafeNormalize(Vector2.Zero) * 2f; + if (Projectile.velocity.Length() < 2f) + Projectile.velocity += Projectile.velocity.RotatedBy(MathHelper.PiOver4).SafeNormalize(Vector2.Zero) * 2f; // Die if anything goes wrong with the velocity. - if (projectile.velocity.HasNaNs()) - projectile.Kill(); + if (Projectile.velocity.HasNaNs()) + Projectile.Kill(); // Approach the ideal velocity. - projectile.velocity = Vector2.Lerp(projectile.velocity, idealVelocity, moveInterpolant * 0.15f); - projectile.velocity = projectile.velocity.MoveTowards(idealVelocity, 6f); - if (projectile.velocity.AngleBetween(projectile.oldVelocity) < 0.85f && projectile.velocity.AngleBetween(idealVelocity) > 1.4f) - projectile.velocity = projectile.velocity.RotatedBy(0.35f) * 0.75f; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, moveInterpolant * 0.15f); + Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 6f); + if (Projectile.velocity.AngleBetween(Projectile.oldVelocity) < 0.85f && Projectile.velocity.AngleBetween(idealVelocity) > 1.4f) + Projectile.velocity = Projectile.velocity.RotatedBy(0.35f) * 0.75f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; // Continuously sync since mouse information is local. - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } public void EmitIdleDust() { - bool slowMovement = projectile.velocity.Length() < 6f; + bool slowMovement = Projectile.velocity.Length() < 6f; int dustCount = slowMovement ? 3 : 1; for (int i = 0; i < dustCount; i++) { - Dust rainbowMagic = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(8f, 8f), 261); - rainbowMagic.velocity = Main.rand.NextVector2Circular(6f, 6f) - (projectile.velocity * 0.16f).RotatedByRandom(0.51f); + Dust rainbowMagic = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8f, 8f), 261); + rainbowMagic.velocity = Main.rand.NextVector2Circular(6f, 6f) - (Projectile.velocity * 0.16f).RotatedByRandom(0.51f); if (slowMovement) rainbowMagic.velocity -= Vector2.UnitY.RotatedByRandom(0.81f) * Main.rand.NextFloat(4.5f); @@ -158,7 +159,7 @@ namespace CalamityMod.Projectiles.Magic public void DoShapeHitAreaChecks(List cleanOldPositions, int shapeEndPoint) { float damageFactor = MathHelper.Lerp(1f, ArtAttack.MaxDamageBoostFactor, Utils.InverseLerp(0f, ArtAttack.MaxDamageBoostTime, Time, true)); - int damage = (int)(projectile.damage * damageFactor); + int damage = (int)(Projectile.damage * damageFactor); for (int i = 0; i < Main.maxNPCs; i++) { if (!Main.npc[i].CanBeChasedBy()) @@ -198,12 +199,12 @@ namespace CalamityMod.Projectiles.Magic // Strike an enemy if it's in the shape. if (enemyIsInShape) { - Main.PlaySound(SoundID.DD2_LightningBugZap, Main.npc[i].Center); + SoundEngine.PlaySound(SoundID.DD2_LightningBugZap, Main.npc[i].Center); CreateDustExplosionEffect(Main.npc[i].Center); - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - int strike = Projectile.NewProjectile(Main.npc[i].Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, projectile.owner, i); + int strike = Projectile.NewProjectile(Main.npc[i].Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Projectile.owner, i); if (Main.projectile.IndexInRange(strike)) Main.projectile[strike].Calamity().forceMelee = true; } @@ -225,13 +226,13 @@ namespace CalamityMod.Projectiles.Magic } } - public override void Kill(int timeLeft) => CreateDustExplosionEffect(projectile.Center); + public override void Kill(int timeLeft) => CreateDustExplosionEffect(Projectile.Center); public Color TrailColor(float completionRatio) { float hue = (Main.GlobalTime * -0.62f + completionRatio * 1.5f) % 1f; float brightness = MathHelper.SmoothStep(0.5f, 1f, Utils.InverseLerp(0.3f, 0f, completionRatio, true)); - float opacity = Utils.InverseLerp(1f, 0.8f, completionRatio, true) * projectile.Opacity; + float opacity = Utils.InverseLerp(1f, 0.8f, completionRatio, true) * Projectile.Opacity; Color color = Main.hslToRgb(hue, 1f, brightness) * opacity; color.A = (byte)(int)(Utils.InverseLerp(0f, 0.2f, completionRatio) * 128); return color; @@ -248,18 +249,18 @@ namespace CalamityMod.Projectiles.Magic if (TrailDrawer is null) TrailDrawer = new PrimitiveTrail(TrailWidth, TrailColor, null, GameShaders.Misc["CalamityMod:ArtAttack"]); - Texture2D texture = Main.projectileTexture[projectile.type]; - Vector2 drawPosition = projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; Vector2 origin = texture.Size() * 0.5f; spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:ArtAttack"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/FabstaffStreak")); + GameShaders.Misc["CalamityMod:ArtAttack"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/FabstaffStreak")); GameShaders.Misc["CalamityMod:ArtAttack"].Apply(); - TrailDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f - Main.screenPosition, 100); + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 100); spriteBatch.ExitShaderRegion(); - spriteBatch.Draw(texture, drawPosition, null, projectile.GetAlpha(Color.White), projectile.rotation, origin, projectile.scale, 0, 0f); + spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(Color.White), Projectile.rotation, origin, Projectile.scale, 0, 0f); return false; } diff --git a/Projectiles/Magic/Asteroid.cs b/Projectiles/Magic/Asteroid.cs index 19ae131992..3a852a61de 100644 --- a/Projectiles/Magic/Asteroid.cs +++ b/Projectiles/Magic/Asteroid.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -11,48 +12,48 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Asteroid"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.extraUpdates = 2; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 2; } public override void AI() { - if (projectile.position.Y > Main.player[projectile.owner].position.Y - 300f) + if (Projectile.position.Y > Main.player[Projectile.owner].position.Y - 300f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if ((double)projectile.position.Y < Main.worldSurface * 16.0) + if ((double)Projectile.position.Y < Main.worldSurface * 16.0) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - projectile.scale = projectile.ai[1]; - projectile.rotation += projectile.velocity.X * 2f; - Vector2 position = projectile.Center + Vector2.Normalize(projectile.velocity) * 10f; - Dust dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 0, default, 1f)]; + Projectile.scale = Projectile.ai[1]; + Projectile.rotation += Projectile.velocity.X * 2f; + Vector2 position = Projectile.Center + Vector2.Normalize(Projectile.velocity) * 10f; + Dust dust20 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 1f)]; dust20.position = position; - dust20.velocity = projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + projectile.velocity / 4f; - dust20.position += projectile.velocity.RotatedBy(1.5707963705062866, default); + dust20.velocity = Projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; + dust20.position += Projectile.velocity.RotatedBy(1.5707963705062866, default); dust20.fadeIn = 0.5f; dust20.noGravity = true; - dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 0, default, 1f)]; + dust20 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 1f)]; dust20.position = position; - dust20.velocity = projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + projectile.velocity / 4f; - dust20.position += projectile.velocity.RotatedBy(-1.5707963705062866, default); + dust20.velocity = Projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; + dust20.position += Projectile.velocity.RotatedBy(-1.5707963705062866, default); dust20.fadeIn = 0.5f; dust20.noGravity = true; for (int num189 = 0; num189 < 1; num189++) { - int num190 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 0, default, 1f); + int num190 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 1f); Main.dust[num190].velocity *= 0.5f; Main.dust[num190].scale *= 1.3f; Main.dust[num190].fadeIn = 1f; @@ -62,39 +63,39 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item89, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = (int)(128f * projectile.scale); - projectile.height = (int)(128f * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item89, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = (int)(128f * Projectile.scale); + Projectile.height = (int)(128f * Projectile.scale); + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num336 = 0; num336 < 4; num336++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); } for (int num337 = 0; num337 < 16; num337++) { - int num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 2.5f); + int num338 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 2.5f); Main.dust[num338].noGravity = true; Main.dust[num338].velocity *= 3f; - num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 1.5f); + num338 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 1.5f); Main.dust[num338].velocity *= 2f; Main.dust[num338].noGravity = true; } for (int num339 = 0; num339 < 2; num339++) { - int num340 = Gore.NewGore(projectile.position + new Vector2((float)(projectile.width * Main.rand.Next(100)) / 100f, (float)(projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); + int num340 = Gore.NewGore(Projectile.position + new Vector2((float)(Projectile.width * Main.rand.Next(100)) / 100f, (float)(Projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); Gore gore = Main.gore[num340]; gore.velocity *= 0.3f; gore.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; gore.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - projectile.localAI[1] = -1f; - projectile.maxPenetrate = 0; - projectile.Damage(); + Projectile.localAI[1] = -1f; + Projectile.maxPenetrate = 0; + Projectile.Damage(); } for (int num341 = 0; num341 < 5; num341++) { @@ -104,7 +105,7 @@ namespace CalamityMod.Projectiles.Magic 259, 158 }); - int num343 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num342, 2.5f * (float)projectile.direction, -2.5f, 0, default, 1f); + int num343 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num342, 2.5f * (float)Projectile.direction, -2.5f, 0, default, 1f); Main.dust[num343].alpha = 200; Main.dust[num343].velocity *= 2.4f; Main.dust[num343].scale += Main.rand.NextFloat(); @@ -113,12 +114,12 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 2; + target.immune[Projectile.owner] = 2; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/AsteroidMolten.cs b/Projectiles/Magic/AsteroidMolten.cs index 794b527a62..ff436f9927 100644 --- a/Projectiles/Magic/AsteroidMolten.cs +++ b/Projectiles/Magic/AsteroidMolten.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class AsteroidMolten : ModProjectile @@ -11,48 +12,48 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Asteroid"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.extraUpdates = 2; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 2; } public override void AI() { - if (projectile.position.Y > Main.player[projectile.owner].position.Y - 300f) + if (Projectile.position.Y > Main.player[Projectile.owner].position.Y - 300f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if ((double)projectile.position.Y < Main.worldSurface * 16.0) + if ((double)Projectile.position.Y < Main.worldSurface * 16.0) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - projectile.scale = projectile.ai[1]; - projectile.rotation += projectile.velocity.X * 2f; - Vector2 position = projectile.Center + Vector2.Normalize(projectile.velocity) * 10f; - Dust dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; + Projectile.scale = Projectile.ai[1]; + Projectile.rotation += Projectile.velocity.X * 2f; + Vector2 position = Projectile.Center + Vector2.Normalize(Projectile.velocity) * 10f; + Dust dust20 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; dust20.position = position; - dust20.velocity = projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + projectile.velocity / 4f; - dust20.position += projectile.velocity.RotatedBy(1.5707963705062866, default); + dust20.velocity = Projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; + dust20.position += Projectile.velocity.RotatedBy(1.5707963705062866, default); dust20.fadeIn = 0.5f; dust20.noGravity = true; - dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; + dust20 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; dust20.position = position; - dust20.velocity = projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + projectile.velocity / 4f; - dust20.position += projectile.velocity.RotatedBy(-1.5707963705062866, default); + dust20.velocity = Projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; + dust20.position += Projectile.velocity.RotatedBy(-1.5707963705062866, default); dust20.fadeIn = 0.5f; dust20.noGravity = true; for (int num189 = 0; num189 < 1; num189++) { - int num190 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f); + int num190 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f); Main.dust[num190].velocity *= 0.5f; Main.dust[num190].scale *= 1.3f; Main.dust[num190].fadeIn = 1f; @@ -62,39 +63,39 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item89, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = (int)(128f * projectile.scale); - projectile.height = (int)(128f * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item89, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = (int)(128f * Projectile.scale); + Projectile.height = (int)(128f * Projectile.scale); + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num336 = 0; num336 < 8; num336++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); } for (int num337 = 0; num337 < 32; num337++) { - int num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 2.5f); + int num338 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 2.5f); Main.dust[num338].noGravity = true; Main.dust[num338].velocity *= 3f; - num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); + num338 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); Main.dust[num338].velocity *= 2f; Main.dust[num338].noGravity = true; } for (int num339 = 0; num339 < 2; num339++) { - int num340 = Gore.NewGore(projectile.position + new Vector2((float)(projectile.width * Main.rand.Next(100)) / 100f, (float)(projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); + int num340 = Gore.NewGore(Projectile.position + new Vector2((float)(Projectile.width * Main.rand.Next(100)) / 100f, (float)(Projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); Gore gore = Main.gore[num340]; gore.velocity *= 0.3f; gore.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; gore.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - projectile.localAI[1] = -1f; - projectile.maxPenetrate = 0; - projectile.Damage(); + Projectile.localAI[1] = -1f; + Projectile.maxPenetrate = 0; + Projectile.Damage(); } for (int num341 = 0; num341 < 5; num341++) { @@ -104,7 +105,7 @@ namespace CalamityMod.Projectiles.Magic 259, 158 }); - int num343 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num342, 2.5f * (float)projectile.direction, -2.5f, 0, new Color(255, Main.DiscoG, 0), 1f); + int num343 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num342, 2.5f * (float)Projectile.direction, -2.5f, 0, new Color(255, Main.DiscoG, 0), 1f); Main.dust[num343].alpha = 200; Main.dust[num343].velocity *= 2.4f; Main.dust[num343].scale += Main.rand.NextFloat(); @@ -113,66 +114,66 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.AddBuff(ModContent.BuffType(), 360); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { //Changes the texture of the projectile - Texture2D texture = Main.projectileTexture[projectile.type]; - switch ((int)projectile.ai[0]) + Texture2D texture = Main.projectileTexture[Projectile.type]; + switch ((int)Projectile.ai[0]) { case 0: break; case 1: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/AsteroidMolten2"); + texture = ModContent.Request("CalamityMod/Projectiles/Magic/AsteroidMolten2"); break; case 2: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/AsteroidMolten3"); + texture = ModContent.Request("CalamityMod/Projectiles/Magic/AsteroidMolten3"); break; case 3: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/AsteroidMolten4"); + texture = ModContent.Request("CalamityMod/Projectiles/Magic/AsteroidMolten4"); break; case 4: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/AsteroidMolten5"); + texture = ModContent.Request("CalamityMod/Projectiles/Magic/AsteroidMolten5"); break; case 5: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/AsteroidMolten6"); + texture = ModContent.Request("CalamityMod/Projectiles/Magic/AsteroidMolten6"); break; default: break; } - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, texture); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, texture); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/AsteroidMoltenGlow"); - switch ((int)projectile.ai[0]) + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Magic/AsteroidMoltenGlow"); + switch ((int)Projectile.ai[0]) { case 0: break; case 1: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/AsteroidMoltenGlow2"); + texture = ModContent.Request("CalamityMod/Projectiles/Magic/AsteroidMoltenGlow2"); break; case 2: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/AsteroidMoltenGlow3"); + texture = ModContent.Request("CalamityMod/Projectiles/Magic/AsteroidMoltenGlow3"); break; case 3: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/AsteroidMoltenGlow4"); + texture = ModContent.Request("CalamityMod/Projectiles/Magic/AsteroidMoltenGlow4"); break; case 4: return; case 5: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/AsteroidMoltenGlow6"); + texture = ModContent.Request("CalamityMod/Projectiles/Magic/AsteroidMoltenGlow6"); break; default: break; } Vector2 origin = texture.Size() / 2f; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } } } diff --git a/Projectiles/Magic/AstralCrystal.cs b/Projectiles/Magic/AstralCrystal.cs index 88148426e5..8cc4027516 100644 --- a/Projectiles/Magic/AstralCrystal.cs +++ b/Projectiles/Magic/AstralCrystal.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -16,20 +17,20 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.extraUpdates = 2; - projectile.tileCollide = false; - projectile.magic = true; + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = 5; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; } public override void Kill(int timeLeft) @@ -41,21 +42,21 @@ namespace CalamityMod.Projectiles.Magic { blue = !blue; Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f); - Dust d = Dust.NewDustPerfect(projectile.Center, blue ? ModContent.DustType() : ModContent.DustType(), velocity); + Dust d = Dust.NewDustPerfect(Projectile.Center, blue ? ModContent.DustType() : ModContent.DustType(), velocity); d.customData = 0.025f; } //chunks for (int i = 0; i < Main.rand.Next(5, 9); i++) { - Dust d = Dust.NewDustPerfect(projectile.Center, ModContent.DustType()); + Dust d = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); } - Main.PlaySound(SoundID.Item27, projectile.Center); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (float i = 0; i < MathHelper.TwoPi; i += MathHelper.PiOver4 / 2f) { - Projectile.NewProjectile(projectile.Center, i.ToRotationVector2() * 9f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, i.ToRotationVector2() * 9f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } @@ -69,13 +70,13 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.Kill(); + Projectile.Kill(); return false; } @@ -87,38 +88,38 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { //FRAMING - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 3) + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } //ROTATION - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); //TILE COLLISION - if (projectile.Center.Y > projectile.ai[0]) + if (Projectile.Center.Y > Projectile.ai[0]) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } //Normal astral dusts - Vector2 vect = projectile.velocity; + Vector2 vect = Projectile.velocity; vect.Normalize(); vect *= 32; - Vector2 pos = projectile.Center + vect; - Vector2 perp = new Vector2(projectile.velocity.Y, -projectile.velocity.X); + Vector2 pos = Projectile.Center + vect; + Vector2 perp = new Vector2(Projectile.velocity.Y, -Projectile.velocity.X); perp.Normalize(); bool flag = Main.time % 2 == 0; int blue = ModContent.DustType(); int orange = ModContent.DustType(); - projectile.ai[1] += 0.3141f; //2pi / 20 (total frames for one loop of animation) - Vector2 posOff = perp * (float)Math.Sin(projectile.ai[1]) * 6f; + Projectile.ai[1] += 0.3141f; //2pi / 20 (total frames for one loop of animation) + Vector2 posOff = perp * (float)Math.Sin(Projectile.ai[1]) * 6f; Dust d1 = Dust.NewDustPerfect(pos + posOff, flag ? blue : orange, perp * Main.rand.NextFloat(2.3f, 3.5f)); Dust d2 = Dust.NewDustPerfect(pos - posOff, flag ? orange : blue, -perp * Main.rand.NextFloat(2.3f, 3.5f)); d1.customData = d2.customData = 0.035f; @@ -126,7 +127,7 @@ namespace CalamityMod.Projectiles.Magic //Astral chunk dust if (Main.rand.NextBool(30)) { - Dust dust = Dust.NewDustPerfect(projectile.Center, ModContent.DustType()); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); dust.velocity *= 0.3f; } } diff --git a/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs b/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs index 808d56d99b..332e69f8fb 100644 --- a/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs +++ b/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs @@ -11,12 +11,12 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -32,10 +32,10 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { //KILL VELOCITY - projectile.ai[0]++; - if (projectile.ai[0] > 10) + Projectile.ai[0]++; + if (Projectile.ai[0] > 10) { - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Magic/AstralStarMagic.cs b/Projectiles/Magic/AstralStarMagic.cs index f7646a71bb..808ae0c66e 100644 --- a/Projectiles/Magic/AstralStarMagic.cs +++ b/Projectiles/Magic/AstralStarMagic.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -18,20 +19,20 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.alpha = 50; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.alpha = 50; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void AI() @@ -40,50 +41,50 @@ namespace CalamityMod.Projectiles.Magic noTileHitCounter -= randomToSubtract; if (noTileHitCounter == 0) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 9); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 9); } } - projectile.alpha -= 15; + Projectile.alpha -= 15; int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) + if (Projectile.Center.Y >= Projectile.ai[1]) { num58 = 0; } - if (projectile.alpha < num58) + if (Projectile.alpha < num58) { - projectile.alpha = num58; + Projectile.alpha = num58; } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType(), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; + Main.dust[num59].position = Projectile.Center + value3 * 12f; } if (Main.rand.NextBool(48)) { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + int num60 = Gore.NewGore(Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; + Main.gore[num60].velocity += Projectile.velocity * 0.3f; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.light = 0.9f; + Projectile.light = 0.9f; if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType(), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20)) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } } @@ -95,26 +96,26 @@ namespace CalamityMod.Projectiles.Magic public override Color? GetAlpha(Color lightColor) { - return new Color(200, 100, 250, projectile.alpha); + return new Color(200, 100, 250, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -124,15 +125,15 @@ namespace CalamityMod.Projectiles.Magic } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } for (int num480 = 0; num480 < 3; num480++) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } } } diff --git a/Projectiles/Magic/AstralachneaFang.cs b/Projectiles/Magic/AstralachneaFang.cs index 63e2891def..b9167694c1 100644 --- a/Projectiles/Magic/AstralachneaFang.cs +++ b/Projectiles/Magic/AstralachneaFang.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class AstralachneaFang : ModProjectile @@ -12,37 +13,37 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Fang"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.magic = true; - projectile.timeLeft = 240; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 240; } public override void AI() { - int astral = Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + int astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[astral].noGravity = true; - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 150f, 12f, 25f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 150f, 12f, 25f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), 0f, 0f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f); } } @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/AtlantisSpear.cs b/Projectiles/Magic/AtlantisSpear.cs index ccb523b612..e49c53c72a 100644 --- a/Projectiles/Magic/AtlantisSpear.cs +++ b/Projectiles/Magic/AtlantisSpear.cs @@ -15,75 +15,75 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 52; - projectile.height = 52; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; + Projectile.width = 52; + Projectile.height = 52; + Projectile.aiStyle = 4; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; aiType = ProjectileID.CrystalVileShardHead; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.ai[0] == 0f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + if (Projectile.ai[0] == 0f) { - projectile.alpha -= 50; - if (projectile.alpha <= 0) + Projectile.alpha -= 50; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) + Projectile.alpha = 0; + Projectile.ai[0] = 1f; + if (Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; + Projectile.ai[1] += 1f; + Projectile.position += Projectile.velocity * 1f; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - int projType = projectile.type; - if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) + int projType = Projectile.type; + if (Projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) { projType = ModContent.ProjectileType(); } - int dmg = projectile.damage; - float kBack = projectile.knockBack; - int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, projType, dmg, kBack, projectile.owner, 0f, projectile.ai[1] + 1f); + int dmg = Projectile.damage; + float kBack = Projectile.knockBack; + int number = Projectile.NewProjectile(Projectile.position.X + Projectile.velocity.X + (float)(Projectile.width / 2), Projectile.position.Y + Projectile.velocity.Y + (float)(Projectile.height / 2), Projectile.velocity.X, Projectile.velocity.Y, projType, dmg, kBack, Projectile.owner, 0f, Projectile.ai[1] + 1f); NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); } } } else { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170) { for (int num55 = 0; num55 < 8; num55++) { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); + int num56 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); Main.dust[num56].noGravity = true; Main.dust[num56].velocity *= 0.5f; } } - projectile.alpha += 7; - if (projectile.alpha >= 255) + Projectile.alpha += 7; + if (Projectile.alpha >= 255) { - projectile.Kill(); + Projectile.Kill(); } } if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 206, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); } } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[Projectile.owner] = 6; } public override void Kill(int timeLeft) @@ -92,13 +92,13 @@ namespace CalamityMod.Projectiles.Magic float rotation = MathHelper.ToRadians(20); for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + int projectile2 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); Main.projectile[projectile2].penetrate = 1; } for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 206, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); } } } diff --git a/Projectiles/Magic/AtlantisSpear2.cs b/Projectiles/Magic/AtlantisSpear2.cs index 8b5fdac034..03df28c97f 100644 --- a/Projectiles/Magic/AtlantisSpear2.cs +++ b/Projectiles/Magic/AtlantisSpear2.cs @@ -16,65 +16,65 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 52; - projectile.height = 52; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; + Projectile.width = 52; + Projectile.height = 52; + Projectile.aiStyle = 4; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; aiType = ProjectileID.CrystalVileShardShaft; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.ai[0] == 0f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + if (Projectile.ai[0] == 0f) { - projectile.alpha -= 50; - if (projectile.alpha <= 0) + Projectile.alpha -= 50; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) + Projectile.alpha = 0; + Projectile.ai[0] = 1f; + if (Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; + Projectile.ai[1] += 1f; + Projectile.position += Projectile.velocity * 1f; } } } else { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170) { for (int num55 = 0; num55 < 8; num55++) { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); + int num56 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); Main.dust[num56].noGravity = true; Main.dust[num56].velocity *= 0.5f; } } - projectile.alpha += 7; - if (projectile.alpha >= 255) + Projectile.alpha += 7; + if (Projectile.alpha >= 255) { - projectile.Kill(); + Projectile.Kill(); } } if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 206, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); } } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override void Kill(int timeLeft) { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 206, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); } } } diff --git a/Projectiles/Magic/AuraRain.cs b/Projectiles/Magic/AuraRain.cs index 5d44f37cde..1573b09e6c 100644 --- a/Projectiles/Magic/AuraRain.cs +++ b/Projectiles/Magic/AuraRain.cs @@ -15,26 +15,26 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 45; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = true; - projectile.timeLeft = 300; - projectile.alpha = 255; - projectile.scale = 1.1f; - projectile.magic = true; - projectile.extraUpdates = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 45; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = true; + Projectile.timeLeft = 300; + Projectile.alpha = 255; + Projectile.scale = 1.1f; + Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 1; aiType = ProjectileID.RainFriendly; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - MathHelper.PiOver2; - Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; + Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; dust.velocity = Vector2.Zero; - dust.position -= projectile.velocity / 5f; + dust.position -= Projectile.velocity / 5f; dust.noGravity = true; dust.scale = 0.8f; dust.noLight = true; @@ -42,8 +42,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Magic/AuroraAustralis.cs b/Projectiles/Magic/AuroraAustralis.cs index 1159e9a93d..db3d4bec36 100644 --- a/Projectiles/Magic/AuroraAustralis.cs +++ b/Projectiles/Magic/AuroraAustralis.cs @@ -25,15 +25,15 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.magic = true; - projectile.alpha = 255; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Magic; + Projectile.alpha = 255; CosFrequency = 0.15f; CosAmplitude = 0.06f; @@ -42,62 +42,62 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { // On-spawn effects - if (projectile.ai[0] == 0) + if (Projectile.ai[0] == 0) { // Store the X and Y of the spawn velocity so it can be used for trig calculations - projectile.localAI[0] = projectile.velocity.X; - projectile.localAI[1] = projectile.velocity.Y; + Projectile.localAI[0] = Projectile.velocity.X; + Projectile.localAI[1] = Projectile.velocity.Y; } // Doesn't collide with tiles for the first 2 frames - projectile.tileCollide = projectile.ai[0] > 2f; + Projectile.tileCollide = Projectile.ai[0] > 2f; // Apply fancy cosine movement, then slight gravity, then cap velocity. // Original velocity is reconstructed so that it can be used in the calculation - Vector2 originalVelocity = new Vector2(projectile.localAI[0], projectile.localAI[1]); + Vector2 originalVelocity = new Vector2(Projectile.localAI[0], Projectile.localAI[1]); ApplyCosVelocity(originalVelocity); - float currentSpeed = projectile.velocity.Length(); + float currentSpeed = Projectile.velocity.Length(); float maxSpeed = 1.4f * originalVelocity.Length(); if (currentSpeed > maxSpeed) - projectile.velocity *= maxSpeed / currentSpeed; + Projectile.velocity *= maxSpeed / currentSpeed; // spawn dust if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.Next(dustTypes), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.Next(dustTypes), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - int rainbow = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int rainbow = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Dust dust = Main.dust[rainbow]; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.2f; - dust.position.X = projectile.Center.X + 4f + Main.rand.Next(-2, 3); - dust.position.Y = projectile.Center.Y + Main.rand.Next(-2, 3); + dust.velocity += Projectile.velocity * 0.2f; + dust.position.X = Projectile.Center.X + 4f + Main.rand.Next(-2, 3); + dust.position.Y = Projectile.Center.Y + Main.rand.Next(-2, 3); dust.noGravity = true; - if (projectile.timeLeft % 10 == 0 && Main.myPlayer == projectile.owner) //spawn stars every 10 ticks + if (Projectile.timeLeft % 10 == 0 && Main.myPlayer == Projectile.owner) //spawn stars every 10 ticks { - if (Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 30) + if (Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 30) { float dmgKBMult = Main.rand.NextFloat(0.25f, 0.75f); - Projectile star = CalamityUtils.ProjectileRain(projectile.Center, projectile.velocity.X, 100f, 500f, 800f, Main.rand.NextFloat(10f, 20f), ModContent.ProjectileType(), (int)(projectile.damage * dmgKBMult), projectile.knockBack * dmgKBMult, projectile.owner); + Projectile star = CalamityUtils.ProjectileRain(Projectile.Center, Projectile.velocity.X, 100f, 500f, 800f, Main.rand.NextFloat(10f, 20f), ModContent.ProjectileType(), (int)(Projectile.damage * dmgKBMult), Projectile.knockBack * dmgKBMult, Projectile.owner); star.timeLeft = 120; } } - projectile.ai[0]++; + Projectile.ai[0]++; } private void ApplyCosVelocity(Vector2 baseVelocity) { - float radians = -(-MathHelper.PiOver2 + CosFrequency * projectile.ai[0]); - projectile.velocity += CosAmplitude * baseVelocity.RotatedBy(radians); + float radians = -(-MathHelper.PiOver2 + CosFrequency * Projectile.ai[0]); + Projectile.velocity += CosAmplitude * baseVelocity.RotatedBy(radians); } public override void Kill(int timeLeft) { for (int i = 0; i <= 5; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.Next(dustTypes), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.Next(dustTypes), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Magic/BeamStar.cs b/Projectiles/Magic/BeamStar.cs index 514bbaba9f..b6a1cc9df1 100644 --- a/Projectiles/Magic/BeamStar.cs +++ b/Projectiles/Magic/BeamStar.cs @@ -9,24 +9,24 @@ namespace CalamityMod.Projectiles.Magic { public class BeamStar : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 12; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 240; - projectile.tileCollide = true; - projectile.magic = true; + Projectile.width = Projectile.height = 12; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 240; + Projectile.tileCollide = true; + Projectile.DamageType = DamageClass.Magic; } public override void AI() @@ -34,34 +34,34 @@ namespace CalamityMod.Projectiles.Magic Time++; if (Time < 45f) - projectile.velocity = projectile.velocity.RotatedBy((projectile.identity % 4 - 2) / 2f * 0.016f) * 1.004f; + Projectile.velocity = Projectile.velocity.RotatedBy((Projectile.identity % 4 - 2) / 2f * 0.016f) * 1.004f; else { - NPC potentialTarget = projectile.Center.ClosestNPCAt(800f, false); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(800f, false); if (potentialTarget != null) { - float destinationDeltaAngle = MathHelper.WrapAngle(projectile.AngleTo(potentialTarget.Center) - projectile.velocity.ToRotation()); + float destinationDeltaAngle = MathHelper.WrapAngle(Projectile.AngleTo(potentialTarget.Center) - Projectile.velocity.ToRotation()); // If the angle is <0, meaning it's to the left, the sine will return a negative number, // and a positive number if >0, because WrapAngle constricts to angle to a bound of // -pi and pi, which are where a sine's wave restarts anew. float angularHomeDirection = Math.Sign(Math.Sin(destinationDeltaAngle)); - projectile.velocity = projectile.velocity.RotatedBy(angularHomeDirection * 0.03f); + Projectile.velocity = Projectile.velocity.RotatedBy(angularHomeDirection * 0.03f); } } if (Main.rand.NextBool(4)) { - Dust stardust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1f); - stardust.position = projectile.Center; + Dust stardust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); + stardust.position = Projectile.Center; stardust.scale += Main.rand.NextFloat(0.5f); stardust.noGravity = true; stardust.velocity.Y -= 2f; } if (Main.rand.NextBool(6)) { - Dust stardust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 176, 0f, 0f, 100, default, 1f); - stardust.position = projectile.Center; + Dust stardust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 176, 0f, 0f, 100, default, 1f); + stardust.position = Projectile.Center; stardust.scale += Main.rand.NextFloat(0.3f, 1.1f); stardust.noGravity = true; stardust.velocity *= 0.1f; @@ -71,16 +71,16 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Vector2 drawPosition; - Texture2D starTexture = Main.projectileTexture[projectile.type]; - for (int i = 1; i < projectile.oldPos.Length; i++) + Texture2D starTexture = Main.projectileTexture[Projectile.type]; + for (int i = 1; i < Projectile.oldPos.Length; i++) { - float scale = projectile.scale * MathHelper.Lerp(0.9f, 0.6f, i / (float)projectile.oldPos.Length) * 0.56f; - drawPosition = projectile.oldPos[i] + projectile.Size * 0.5f - Main.screenPosition; + float scale = Projectile.scale * MathHelper.Lerp(0.9f, 0.6f, i / (float)Projectile.oldPos.Length) * 0.56f; + drawPosition = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; spriteBatch.Draw(starTexture, drawPosition, null, Color.White, 0f, starTexture.Size() * 0.5f, scale, SpriteEffects.None, 0f); } - drawPosition = projectile.Center - Main.screenPosition; - spriteBatch.Draw(starTexture, drawPosition, null, Color.White, 0f, starTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + drawPosition = Projectile.Center - Main.screenPosition; + spriteBatch.Draw(starTexture, drawPosition, null, Color.White, 0f, starTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -88,8 +88,8 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 176, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 180, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 176, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 180, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/BeamingBolt.cs b/Projectiles/Magic/BeamingBolt.cs index 854dc8274f..37b99c0438 100644 --- a/Projectiles/Magic/BeamingBolt.cs +++ b/Projectiles/Magic/BeamingBolt.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class BeamingBolt : ModProjectile @@ -15,28 +16,28 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.friendly = true; - projectile.timeLeft = 120; - projectile.penetrate = -1; - projectile.magic = true; + Projectile.width = Projectile.height = 30; + Projectile.friendly = true; + Projectile.timeLeft = 120; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Magic; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - if (projectile.ai[0] == 1f) - tex = ModContent.GetTexture("CalamityMod/Projectiles/Magic/BeamingThornBlossom"); + Texture2D tex = Main.projectileTexture[Projectile.type]; + if (Projectile.ai[0] == 1f) + tex = ModContent.Request("CalamityMod/Projectiles/Magic/BeamingThornBlossom"); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void AI() { - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.985f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; + Projectile.velocity.X *= 0.95f; + Projectile.velocity.Y *= 0.985f; for (int dust = 0; dust < 2; dust++) { int randomDust = Utils.SelectRandom(Main.rand, new int[] @@ -45,7 +46,7 @@ namespace CalamityMod.Projectiles.Magic 58, 204 }); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } @@ -59,27 +60,27 @@ namespace CalamityMod.Projectiles.Magic 58, 204 }); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, projectile.ai[0], 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, projectile.ai[0], 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f); } } - Main.PlaySound(SoundID.Item105, projectile.position); + SoundEngine.PlaySound(SoundID.Item105, Projectile.position); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[Projectile.owner] = 7; } } } diff --git a/Projectiles/Magic/BeamingBolt2.cs b/Projectiles/Magic/BeamingBolt2.cs index 048bf84368..d9fc55357f 100644 --- a/Projectiles/Magic/BeamingBolt2.cs +++ b/Projectiles/Magic/BeamingBolt2.cs @@ -14,39 +14,39 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.timeLeft = 120; - projectile.penetrate = 1; - projectile.magic = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.timeLeft = 120; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 90 && target.CanBeChasedBy(Projectile); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - if (projectile.ai[0] == 1f) - tex = ModContent.GetTexture("CalamityMod/Projectiles/Magic/BeamingThorn"); + Texture2D tex = Main.projectileTexture[Projectile.type]; + if (Projectile.ai[0] == 1f) + tex = ModContent.Request("CalamityMod/Projectiles/Magic/BeamingThorn"); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void AI() { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; int randomDust = Utils.SelectRandom(Main.rand, new int[] { 164, 58, 204 }); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - if (projectile.timeLeft < 90) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); + if (Projectile.timeLeft < 90) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 20f); } public override void Kill(int timeLeft) @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Magic 58, 204 }); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/BeastScythe.cs b/Projectiles/Magic/BeastScythe.cs index 1ea68ef780..6c4c3a5d14 100644 --- a/Projectiles/Magic/BeastScythe.cs +++ b/Projectiles/Magic/BeastScythe.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -13,58 +14,58 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 54; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.magic = true; - projectile.extraUpdates = 1; - projectile.tileCollide = false; + Projectile.width = 50; + Projectile.height = 54; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 1; + Projectile.tileCollide = false; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 20; + Projectile.alpha -= 20; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - projectile.rotation += 0.5f; + Projectile.rotation += 0.5f; - Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.35f); + Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0.35f); if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); } - projectile.ai[0] += 1f; - if (projectile.ai[0] <= 30f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] <= 30f) { - projectile.velocity *= 0.999f; + Projectile.velocity *= 0.999f; } - if (Main.myPlayer == projectile.owner && projectile.ai[0] == 30f) + if (Main.myPlayer == Projectile.owner && Projectile.ai[0] == 30f) { - if (Main.player[projectile.owner].channel) + if (Main.player[Projectile.owner].channel) { float num115 = 20f; - Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector10 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; - if (Main.player[projectile.owner].gravDir == -1f) + if (Main.player[Projectile.owner].gravDir == -1f) { num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; } @@ -76,61 +77,61 @@ namespace CalamityMod.Projectiles.Magic num116 *= num118; num117 *= num118; int num119 = (int)(num116 * 1000f); - int num120 = (int)(projectile.velocity.X * 1000f); + int num120 = (int)(Projectile.velocity.X * 1000f); int num121 = (int)(num117 * 1000f); - int num122 = (int)(projectile.velocity.Y * 1000f); + int num122 = (int)(Projectile.velocity.Y * 1000f); if (num119 != num120 || num121 != num122) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; + Projectile.velocity.X = num116; + Projectile.velocity.Y = num117; } else { int num123 = (int)(num116 * 1000f); - int num124 = (int)(projectile.velocity.X * 1000f); + int num124 = (int)(Projectile.velocity.X * 1000f); int num125 = (int)(num117 * 1000f); - int num126 = (int)(projectile.velocity.Y * 1000f); + int num126 = (int)(Projectile.velocity.Y * 1000f); if (num123 != num124 || num125 != num126) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; + Projectile.velocity.X = num116; + Projectile.velocity.Y = num117; } } else { - projectile.netUpdate = true; + Projectile.netUpdate = true; float num127 = 20f; - Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector11 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; - if (Main.player[projectile.owner].gravDir == -1f) + if (Main.player[Projectile.owner].gravDir == -1f) { num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; } float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || projectile.ai[0] < 0f) + if (num130 == 0f || Projectile.ai[0] < 0f) { - vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); - num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; - num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; + vector11 = new Vector2(Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2), Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2)); + num128 = Projectile.position.X + (float)Projectile.width * 0.5f - vector11.X; + num129 = Projectile.position.Y + (float)Projectile.height * 0.5f - vector11.Y; num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); } num130 = num127 / num130; num128 *= num130; num129 *= num130; - projectile.velocity.X = num128; - projectile.velocity.Y = num129; + Projectile.velocity.X = num128; + Projectile.velocity.Y = num129; } } - if (projectile.ai[0] >= 30f) + if (Projectile.ai[0] >= 30f) { - projectile.velocity *= 1.001f; + Projectile.velocity *= 1.001f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); } } @@ -153,32 +154,32 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position = projectile.Center; - projectile.width = projectile.height = 100; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 14); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 100; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); + bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); for (int m = 0; m < 4; m++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); } for (int n = 0; n < 4; n++) { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 0, default, 2.5f); + int num10 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 2.5f); Main.dust[num10].noGravity = true; Main.dust[num10].velocity *= 3f; if (flag) { Main.dust[num10].noLight = true; } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.5f); + num10 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); Main.dust[num10].velocity *= 2f; Main.dust[num10].noGravity = true; if (flag) @@ -190,7 +191,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/BigBeamofDeath.cs b/Projectiles/Magic/BigBeamofDeath.cs index cc9b509f71..10db60c329 100644 --- a/Projectiles/Magic/BigBeamofDeath.cs +++ b/Projectiles/Magic/BigBeamofDeath.cs @@ -14,39 +14,39 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 100; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 80; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 100; + Projectile.penetrate = -1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 80; } public override void Kill(int timeLeft) { int numProj = 2; float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center, perturbedSpeed, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * 0.25f; int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 3f); Main.dust[num448].position = vector33; Main.dust[num448].velocity *= 0.1f; diff --git a/Projectiles/Magic/BigBeamofDeath2.cs b/Projectiles/Magic/BigBeamofDeath2.cs index f2bc155eac..5eacbbdc9d 100644 --- a/Projectiles/Magic/BigBeamofDeath2.cs +++ b/Projectiles/Magic/BigBeamofDeath2.cs @@ -14,22 +14,22 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 100; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 80; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 100; + Projectile.penetrate = -1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 80; } public override void AI() { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * 0.25f; int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 3f); Main.dust[num448].position = vector33; Main.dust[num448].velocity *= 0.1f; diff --git a/Projectiles/Magic/BlackAnurianBubble.cs b/Projectiles/Magic/BlackAnurianBubble.cs index 5dd510596e..72ce79a530 100644 --- a/Projectiles/Magic/BlackAnurianBubble.cs +++ b/Projectiles/Magic/BlackAnurianBubble.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -14,68 +15,68 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.magic = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - if (projectile.localAI[0] > 2f) + if (Projectile.localAI[0] > 2f) { - projectile.alpha -= 20; - if (projectile.alpha < 100) + Projectile.alpha -= 20; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } } else { - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (projectile.ai[0] > 30f) + if (Projectile.ai[0] > 30f) { - if (projectile.velocity.Y > -8f) + if (Projectile.velocity.Y > -8f) { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.05f; } - projectile.velocity.X = projectile.velocity.X * 0.98f; + Projectile.velocity.X = Projectile.velocity.X * 0.98f; } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation = projectile.velocity.X * 0.1f; - if (projectile.wet) + Projectile.rotation = Projectile.velocity.X * 0.1f; + if (Projectile.wet) { - if (projectile.velocity.Y > 0f) + if (Projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; + Projectile.velocity.Y = Projectile.velocity.Y * 0.98f; } - if (projectile.velocity.Y > -8f) + if (Projectile.velocity.Y > -8f) { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; } - projectile.velocity.X = projectile.velocity.X * 0.94f; + Projectile.velocity.X = Projectile.velocity.X * 0.94f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); int num3; for (int num246 = 0; num246 < 25; num246 = num3 + 1) { - int num247 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, 0f, 0f, 0, default, 1f); - Main.dust[num247].position = (Main.dust[num247].position + projectile.position) / 2f; + int num247 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 0, default, 1f); + Main.dust[num247].position = (Main.dust[num247].position + Projectile.position) / 2f; Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); Main.dust[num247].velocity.Normalize(); Dust dust = Main.dust[num247]; dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[num247].alpha = projectile.alpha; + Main.dust[num247].alpha = Projectile.alpha; num3 = num246; } } diff --git a/Projectiles/Magic/BlackAnurianPlankton.cs b/Projectiles/Magic/BlackAnurianPlankton.cs index 713fc39733..7cbec838f1 100644 --- a/Projectiles/Magic/BlackAnurianPlankton.cs +++ b/Projectiles/Magic/BlackAnurianPlankton.cs @@ -9,62 +9,62 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Plankton"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.magic = true; - projectile.extraUpdates = 3; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 3; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) + if (Projectile.frame > 4) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 50; + Projectile.alpha -= 50; } else { - projectile.extraUpdates = 0; + Projectile.extraUpdates = 0; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - float num373 = projectile.position.X; - float num374 = projectile.position.Y; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + float num373 = Projectile.position.X; + float num374 = Projectile.position.Y; float num375 = 100000f; bool flag10 = false; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 30f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 30f) { - projectile.ai[0] = 30f; + Projectile.ai[0] = 30f; for (int num376 = 0; num376 < Main.maxNPCs; num376++) { - if (Main.npc[num376].CanBeChasedBy(projectile, false) && !Main.npc[num376].wet) + if (Main.npc[num376].CanBeChasedBy(Projectile, false) && !Main.npc[num376].wet) { float num377 = Main.npc[num376].position.X + (float)(Main.npc[num376].width / 2); float num378 = Main.npc[num376].position.Y + (float)(Main.npc[num376].height / 2); - float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); - if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height)) + float num379 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num377) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num378); + if (num379 < 800f && num379 < num375 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height)) { num375 = num379; num373 = num377; @@ -76,49 +76,49 @@ namespace CalamityMod.Projectiles.Magic } if (!flag10) { - num373 = projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X * 100f; - num374 = projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y * 100f; + num373 = Projectile.position.X + (float)(Projectile.width / 2) + Projectile.velocity.X * 100f; + num374 = Projectile.position.Y + (float)(Projectile.height / 2) + Projectile.velocity.Y * 100f; } float num380 = 6f; float num381 = 0.1f; - Vector2 vector30 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector30 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num382 = num373 - vector30.X; float num383 = num374 - vector30.Y; float num384 = (float)Math.Sqrt((double)(num382 * num382 + num383 * num383)); num384 = num380 / num384; num382 *= num384; num383 *= num384; - if (projectile.velocity.X < num382) + if (Projectile.velocity.X < num382) { - projectile.velocity.X = projectile.velocity.X + num381; - if (projectile.velocity.X < 0f && num382 > 0f) + Projectile.velocity.X = Projectile.velocity.X + num381; + if (Projectile.velocity.X < 0f && num382 > 0f) { - projectile.velocity.X = projectile.velocity.X + num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X + num381 * 2f; } } - else if (projectile.velocity.X > num382) + else if (Projectile.velocity.X > num382) { - projectile.velocity.X = projectile.velocity.X - num381; - if (projectile.velocity.X > 0f && num382 < 0f) + Projectile.velocity.X = Projectile.velocity.X - num381; + if (Projectile.velocity.X > 0f && num382 < 0f) { - projectile.velocity.X = projectile.velocity.X - num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X - num381 * 2f; } } - if (projectile.velocity.Y < num383) + if (Projectile.velocity.Y < num383) { - projectile.velocity.Y = projectile.velocity.Y + num381; - if (projectile.velocity.Y < 0f && num383 > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num381; + if (Projectile.velocity.Y < 0f && num383 > 0f) { - projectile.velocity.Y = projectile.velocity.Y + num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + num381 * 2f; } } - else if (projectile.velocity.Y > num383) + else if (Projectile.velocity.Y > num383) { - projectile.velocity.Y = projectile.velocity.Y - num381; - if (projectile.velocity.Y > 0f && num383 < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num381; + if (Projectile.velocity.Y > 0f && num383 < 0f) { - projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - num381 * 2f; } } } diff --git a/Projectiles/Magic/BlindingLight.cs b/Projectiles/Magic/BlindingLight.cs index 65862902a3..401e7fd9e2 100644 --- a/Projectiles/Magic/BlindingLight.cs +++ b/Projectiles/Magic/BlindingLight.cs @@ -20,36 +20,36 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.magic = true; - projectile.timeLeft = Lifetime; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = Lifetime; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, Radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox); public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) => crit = true; public override void AI() { - if (projectile.timeLeft == Lifetime) + if (Projectile.timeLeft == Lifetime) { ConsumeNearbyBlades(); DivideDamageAmongstTargets(); } - projectile.ai[0]++; - float progress = (float)Math.Sin(projectile.ai[0] / Lifetime * MathHelper.Pi); - if (projectile.ai[0] > 55f) - progress = MathHelper.Lerp(progress, 0f, (projectile.ai[0] - 55f) / 5f); - if (Main.netMode != NetmodeID.Server && projectile.ai[0] > 15f) // Otherwise a white flash appears, but it quickly disappears. + Projectile.ai[0]++; + float progress = (float)Math.Sin(Projectile.ai[0] / Lifetime * MathHelper.Pi); + if (Projectile.ai[0] > 55f) + progress = MathHelper.Lerp(progress, 0f, (Projectile.ai[0] - 55f) / 5f); + if (Main.netMode != NetmodeID.Server && Projectile.ai[0] > 15f) // Otherwise a white flash appears, but it quickly disappears. { if (!Filters.Scene["CalamityMod:LightBurst"].IsActive()) - Filters.Scene.Activate("CalamityMod:LightBurst", projectile.Center).GetShader().UseTargetPosition(projectile.Center).UseProgress(0f); + Filters.Scene.Activate("CalamityMod:LightBurst", Projectile.Center).GetShader().UseTargetPosition(Projectile.Center).UseProgress(0f); Filters.Scene["CalamityMod:LightBurst"].GetShader().UseProgress(progress); } @@ -68,16 +68,16 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < Main.maxProjectiles; ++i) { Projectile otherProj = Main.projectile[i]; - if (otherProj is null || !otherProj.active || otherProj.owner != projectile.owner || otherProj.type != lightBlade) + if (otherProj is null || !otherProj.active || otherProj.owner != Projectile.owner || otherProj.type != lightBlade) continue; // Can only consume blades within the flash radius (which should be most if not all of them anyway) - if (projectile.Distance(otherProj.Center) > Radius) + if (Projectile.Distance(otherProj.Center) > Radius) continue; extraDamage += otherProj.damage / 2; otherProj.Kill(); } - projectile.damage += extraDamage; + Projectile.damage += extraDamage; } private void DivideDamageAmongstTargets() @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Magic NPC npc = Main.npc[i]; if (npc is null || !npc.active || npc.friendly || npc.dontTakeDamage || npc.immortal) continue; - if (projectile.Colliding(default, npc.Hitbox)) + if (Projectile.Colliding(default, npc.Hitbox)) ++numTargets; } @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Magic numTargets = 1; // Divide damage by the square root of nearby targets. 25 targets = 1/5th damage, for example. - projectile.damage = (int)(projectile.damage / Math.Sqrt(numTargets)); + Projectile.damage = (int)(Projectile.damage / Math.Sqrt(numTargets)); } } } diff --git a/Projectiles/Magic/BloodBeam.cs b/Projectiles/Magic/BloodBeam.cs index 1dfb9db6b3..5df9378cc5 100644 --- a/Projectiles/Magic/BloodBeam.cs +++ b/Projectiles/Magic/BloodBeam.cs @@ -14,37 +14,37 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.tileCollide = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 120; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 120; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.35f, 0f, 0f); - if (projectile.ai[0] > 7f) + Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0f); + if (Projectile.ai[0] > 7f) { float scalar = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { scalar = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { scalar = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { scalar = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int dustType = DustID.Blood; - int blood = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int blood = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[blood]; if (Main.rand.NextBool(3)) { @@ -59,9 +59,9 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; } } } diff --git a/Projectiles/Magic/BloodBlast.cs b/Projectiles/Magic/BloodBlast.cs index ac8f88ce03..6da0eff34b 100644 --- a/Projectiles/Magic/BloodBlast.cs +++ b/Projectiles/Magic/BloodBlast.cs @@ -14,48 +14,48 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 2; - projectile.magic = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 2; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0f, 0f); for (int num92 = 0; num92 < 2; num92++) { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; + float num93 = Projectile.velocity.X / 3f * (float)num92; + float num94 = Projectile.velocity.Y / 3f * (float)num92; int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 5, 0f, 0f, 100, default, 1.2f); + int num96 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num95, Projectile.position.Y + (float)num95), Projectile.width - num95 * 2, Projectile.height - num95 * 2, 5, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[num96]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.1f; + dust.velocity += Projectile.velocity * 0.1f; dust.position.X -= num93; dust.position.Y -= num94; } if (Main.rand.NextBool(5)) { int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 5, 0f, 0f, 100, default, 0.6f); + int num98 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num97, Projectile.position.Y + (float)num97), Projectile.width - num97 * 2, Projectile.height - num97 * 2, 5, 0f, 0f, 100, default, 0.6f); Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; + Main.dust[num98].velocity += Projectile.velocity * 0.5f; } - if (projectile.ai[1] >= 20f) + if (Projectile.ai[1] >= 20f) { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } else { - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } } } diff --git a/Projectiles/Magic/BloodRay.cs b/Projectiles/Magic/BloodRay.cs index af08b03798..f103060a87 100644 --- a/Projectiles/Magic/BloodRay.cs +++ b/Projectiles/Magic/BloodRay.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Magic public const int Lifetime = 150; public const float MaxExponentialDamageBoost = 3f; public static readonly float ExponentialDamageBoost = (float)Math.Pow(MaxExponentialDamageBoost, 1f / Lifetime); - public ref float Time => ref projectile.ai[0]; - public ref float InitialDamage => ref projectile.ai[1]; + public ref float Time => ref Projectile.ai[0]; + public ref float InitialDamage => ref Projectile.ai[1]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { @@ -20,14 +20,14 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = Lifetime; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 10; + Projectile.extraUpdates = 100; + Projectile.timeLeft = Lifetime; } public override void AI() @@ -37,19 +37,19 @@ namespace CalamityMod.Projectiles.Magic // cast (which removes the fractional part) would overtake any increases before the damage can rise. if (InitialDamage == 0f) { - InitialDamage = projectile.damage; - projectile.netUpdate = true; + InitialDamage = Projectile.damage; + Projectile.netUpdate = true; } Time++; - projectile.damage = (int)(InitialDamage * Math.Pow(ExponentialDamageBoost, Time)); + Projectile.damage = (int)(InitialDamage * Math.Pow(ExponentialDamageBoost, Time)); if (Time >= 12f) { for (int i = 0; i < 2; i++) { int dustType = Main.rand.NextBool(4) ? 182 : (int)CalamityDusts.Brimstone; - Vector2 dustSpawnPos = projectile.position - projectile.velocity * i / 2f; + Vector2 dustSpawnPos = Projectile.position - Projectile.velocity * i / 2f; Dust crimtameMagic = Dust.NewDustPerfect(dustSpawnPos, dustType); crimtameMagic.scale = Main.rand.NextFloat(0.96f, 1.04f) * MathHelper.Lerp(1f, 1.7f, Time / Lifetime); crimtameMagic.noGravity = true; diff --git a/Projectiles/Magic/BlueBubble.cs b/Projectiles/Magic/BlueBubble.cs index faf7544aad..f8d615c1de 100644 --- a/Projectiles/Magic/BlueBubble.cs +++ b/Projectiles/Magic/BlueBubble.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -14,32 +15,32 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.timeLeft = 120; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 120; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 90 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.velocity *= 0.99f; + Projectile.velocity *= 0.99f; - projectile.scale += 0.005f; + Projectile.scale += 0.005f; - if (projectile.alpha > 0) - projectile.alpha -= 30; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha > 0) + Projectile.alpha -= 30; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - Vector2 v2 = projectile.ai[0].ToRotationVector2(); - float num743 = projectile.velocity.ToRotation(); + Vector2 v2 = Projectile.ai[0].ToRotationVector2(); + float num743 = Projectile.velocity.ToRotation(); float num744 = v2.ToRotation(); double num745 = num744 - num743; if (num745 > MathHelper.Pi) @@ -47,21 +48,21 @@ namespace CalamityMod.Projectiles.Magic if (num745 < -MathHelper.Pi) num745 += MathHelper.TwoPi; - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (projectile.timeLeft < 90) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 400f, 8f, 20f); + if (Projectile.timeLeft < 90) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 400f, 8f, 20f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.Center); + SoundEngine.PlaySound(SoundID.Item54, Projectile.Center); int num190 = Main.rand.Next(5, 9); for (int num191 = 0; num191 < num190; num191++) { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); + int num192 = Dust.NewDust(Projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, Projectile.Center, 0.5f); Main.dust[num192].noGravity = true; } } diff --git a/Projectiles/Magic/BlushieStaffProj.cs b/Projectiles/Magic/BlushieStaffProj.cs index a9bbf8042a..d35aeac448 100644 --- a/Projectiles/Magic/BlushieStaffProj.cs +++ b/Projectiles/Magic/BlushieStaffProj.cs @@ -20,34 +20,34 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.Calamity().PierceResistHarshness = 0.06f; - projectile.Calamity().PierceResistCap = 0.4f; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.Calamity().PierceResistHarshness = 0.06f; + Projectile.Calamity().PierceResistCap = 0.4f; } public override void AI() { - Player player = Main.player[projectile.owner]; - if (Main.myPlayer == projectile.owner) + Player player = Main.player[Projectile.owner]; + if (Main.myPlayer == Projectile.owner) { - if (!player.channel || player.noItems || player.CCed || projectile.ai[0] > 3600f) + if (!player.channel || player.noItems || player.CCed || Projectile.ai[0] > 3600f) { - projectile.Kill(); + Projectile.Kill(); } } - projectile.Center = player.MountedCenter; - projectile.timeLeft = 2; + Projectile.Center = player.MountedCenter; + Projectile.timeLeft = 2; player.itemTime = 2; player.itemAnimation = 2; - projectile.ai[0] += 1f; - projectile.damage = (int)(projectile.ai[0] - 120f); // Max damage = 3480 - if (projectile.damage >= 100 && Main.myPlayer == projectile.owner) + Projectile.ai[0] += 1f; + Projectile.damage = (int)(Projectile.ai[0] - 120f); // Max damage = 3480 + if (Projectile.damage >= 100 && Main.myPlayer == Projectile.owner) { if (player.statMana <= 0 && player.manaFlower) { @@ -59,26 +59,26 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.Kill(); + Projectile.Kill(); } } - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - projectile.localAI[1] = 37f; - projectile.localAI[0] = Main.rand.Next(xRange); + Projectile.localAI[1] = 37f; + Projectile.localAI[0] = Main.rand.Next(xRange); } - projectile.localAI[0] = Next(projectile.localAI[0]); + Projectile.localAI[0] = Next(Projectile.localAI[0]); } private float Next(float seed) { - return (seed * projectile.localAI[1] + 101f) % (4 * xRange * yRange); + return (seed * Projectile.localAI[1] + 101f) % (4 * xRange * yRange); } public override bool CanDamage() { - return projectile.ai[0] > 120f; + return Projectile.ai[0] > 120f; } public override void ModifyDamageHitbox(ref Rectangle hitbox) @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.penetrate++; + Projectile.penetrate++; target.AddBuff(BuffID.Daybreak, 300); target.AddBuff(BuffID.OnFire, 300); target.AddBuff(BuffID.Frostburn, 300); @@ -107,12 +107,12 @@ namespace CalamityMod.Projectiles.Magic spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Vector2 center = projectile.Center - Main.screenPosition; + Vector2 center = Projectile.Center - Main.screenPosition; Vector2 aura = center + new Vector2(-xRange, yRange); - Texture2D texture = ModContent.GetTexture("CalamityMod/ExtraTextures/BlushieStaffAura"); + Texture2D texture = ModContent.Request("CalamityMod/ExtraTextures/BlushieStaffAura"); Rectangle frame = new Rectangle(50, 0, 50, 32); int count = 2 * xRange / 50; - SpriteEffects effects = projectile.ai[0] % 30f < 15f ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + SpriteEffects effects = Projectile.ai[0] % 30f < 15f ? SpriteEffects.None : SpriteEffects.FlipHorizontally; for (int k = 0; k < count; k++) { if (k == 0) @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 bottomLeftGear = center + new Vector2(-xRange / 2, yRange / 2); Vector2 bottomRightGear = center + new Vector2(xRange - 100, yRange - 100); - float alpha = projectile.ai[0] / 60f; + float alpha = Projectile.ai[0] / 60f; if (alpha > 0f) { if (alpha > 1f) @@ -154,26 +154,26 @@ namespace CalamityMod.Projectiles.Magic } float scale = 1f; - if (projectile.ai[0] < 60f) + if (Projectile.ai[0] < 60f) { - scale = 4f - 3f * projectile.ai[0] / 60f; + scale = 4f - 3f * Projectile.ai[0] / 60f; } - texture = ModContent.GetTexture("CalamityMod/ExtraTextures/BlushieStaffGear"); + texture = ModContent.Request("CalamityMod/ExtraTextures/BlushieStaffGear"); Vector2 origin = new Vector2(48f, 48f); - spriteBatch.Draw(texture, center, null, Color.White, projectile.ai[0] / 20f, origin, 1.5f * scale, SpriteEffects.None, 0f); - spriteBatch.Draw(texture, topLeftGear, null, Color.White, projectile.ai[0] / 10f, origin, scale, SpriteEffects.None, 0f); - spriteBatch.Draw(texture, topRightGear, null, Color.White, -projectile.ai[0] / 8f, origin, 0.75f * scale, SpriteEffects.None, 0f); - spriteBatch.Draw(texture, bottomLeftGear, null, Color.White, -projectile.ai[0] / 15f, origin, 1.4f * scale, SpriteEffects.None, 0f); - spriteBatch.Draw(texture, bottomRightGear, null, Color.White, projectile.ai[0] / 10f, origin, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, center, null, Color.White, Projectile.ai[0] / 20f, origin, 1.5f * scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, topLeftGear, null, Color.White, Projectile.ai[0] / 10f, origin, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, topRightGear, null, Color.White, -Projectile.ai[0] / 8f, origin, 0.75f * scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, bottomLeftGear, null, Color.White, -Projectile.ai[0] / 15f, origin, 1.4f * scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, bottomRightGear, null, Color.White, Projectile.ai[0] / 10f, origin, scale, SpriteEffects.None, 0f); - float seed = projectile.localAI[0]; - texture = ModContent.GetTexture("CalamityMod/ExtraTextures/BlushieStaffFire"); + float seed = Projectile.localAI[0]; + texture = ModContent.Request("CalamityMod/ExtraTextures/BlushieStaffFire"); Vector2 topLeft = center + new Vector2(-xRange, -yRange); - for (int k = (int)projectile.ai[0] - 60; k < (int)projectile.ai[0]; k++) + for (int k = (int)Projectile.ai[0] - 60; k < (int)Projectile.ai[0]; k++) { if (k > 120) { - spriteBatch.Draw(texture, topLeft + new Vector2(seed % (2 * xRange), seed % (2 * yRange) + k - projectile.ai[0]), Color.White); + spriteBatch.Draw(texture, topLeft + new Vector2(seed % (2 * xRange), seed % (2 * yRange) + k - Projectile.ai[0]), Color.White); } seed = Next(seed); } @@ -185,14 +185,14 @@ namespace CalamityMod.Projectiles.Magic private void DrawChains(SpriteBatch spriteBatch, Vector2 start, Vector2 end, float alpha) { - Texture2D texture = ModContent.GetTexture("CalamityMod/ExtraTextures/BlushieStaffChain"); + Texture2D texture = ModContent.Request("CalamityMod/ExtraTextures/BlushieStaffChain"); Vector2 unit = end - start; float distance = unit.Length() - 36f; unit.Normalize(); float rotation = unit.ToRotation(); start += unit * 18f; end -= unit * 18f; - float offset = projectile.ai[0] * 2f % texture.Width; + float offset = Projectile.ai[0] * 2f % texture.Width; start += unit * offset; distance -= offset; int count = (int)(distance / texture.Width); diff --git a/Projectiles/Magic/BrimstoneBeam.cs b/Projectiles/Magic/BrimstoneBeam.cs index 6b3963fc4b..d5ba9adb3b 100644 --- a/Projectiles/Magic/BrimstoneBeam.cs +++ b/Projectiles/Magic/BrimstoneBeam.cs @@ -15,37 +15,37 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 30; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 30; } public override void Kill(int timeLeft) { int numProj = 2; float rotation = MathHelper.ToRadians(10); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity; - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity; + Projectile.alpha = 255; int num249 = 235; int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); Main.dust[num448].position = vector33; diff --git a/Projectiles/Magic/BrimstoneBeam2.cs b/Projectiles/Magic/BrimstoneBeam2.cs index eb12f4a7c9..c4dce75954 100644 --- a/Projectiles/Magic/BrimstoneBeam2.cs +++ b/Projectiles/Magic/BrimstoneBeam2.cs @@ -15,34 +15,34 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 30; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 30; } public override void Kill(int timeLeft) { int numProj = 2; float rotation = MathHelper.ToRadians(10); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } public override void AI() { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity; - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity; + Projectile.alpha = 255; int num249 = 235; int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); Main.dust[num448].position = vector33; diff --git a/Projectiles/Magic/BrimstoneBeam3.cs b/Projectiles/Magic/BrimstoneBeam3.cs index 8beb89fee4..05289a1539 100644 --- a/Projectiles/Magic/BrimstoneBeam3.cs +++ b/Projectiles/Magic/BrimstoneBeam3.cs @@ -15,34 +15,34 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 30; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 30; } public override void Kill(int timeLeft) { int numProj = 2; float rotation = MathHelper.ToRadians(10); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } public override void AI() { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity; - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity; + Projectile.alpha = 255; int num249 = 235; int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); Main.dust[num448].position = vector33; diff --git a/Projectiles/Magic/BrimstoneBeam4.cs b/Projectiles/Magic/BrimstoneBeam4.cs index ba4bb7c661..9214f0f3d0 100644 --- a/Projectiles/Magic/BrimstoneBeam4.cs +++ b/Projectiles/Magic/BrimstoneBeam4.cs @@ -15,34 +15,34 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 30; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 30; } public override void Kill(int timeLeft) { int numProj = 2; float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } public override void AI() { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity; - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity; + Projectile.alpha = 255; int num249 = 235; int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); Main.dust[num448].position = vector33; diff --git a/Projectiles/Magic/BrimstoneBeam5.cs b/Projectiles/Magic/BrimstoneBeam5.cs index d13b28b041..cd05d3e0e0 100644 --- a/Projectiles/Magic/BrimstoneBeam5.cs +++ b/Projectiles/Magic/BrimstoneBeam5.cs @@ -15,20 +15,20 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 30; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 30; } public override void AI() { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity; - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity; + Projectile.alpha = 255; int num249 = 235; int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); Main.dust[num448].position = vector33; diff --git a/Projectiles/Magic/BrimstoneFireball.cs b/Projectiles/Magic/BrimstoneFireball.cs index b955cbed8a..ee8db4388a 100644 --- a/Projectiles/Magic/BrimstoneFireball.cs +++ b/Projectiles/Magic/BrimstoneFireball.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class BrimstoneFireball : ModProjectile @@ -13,27 +14,27 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Fireball"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 4; - projectile.timeLeft = 300; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 4; + Projectile.timeLeft = 300; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.25f, 0f, 0f); - if (projectile.wet && !projectile.lavaWet) + Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0f); + if (Projectile.wet && !Projectile.lavaWet) { - projectile.Kill(); - if (projectile.owner == Main.myPlayer) + Projectile.Kill(); + if (Projectile.owner == Main.myPlayer) { int fireballAmt = Main.rand.Next(2, 4); for (int j = 0; j < fireballAmt; j++) @@ -45,76 +46,76 @@ namespace CalamityMod.Projectiles.Magic } velocity.Normalize(); velocity *= Main.rand.NextFloat(70f, 100f) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.85), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.oldPosition.X + (float)(Projectile.width / 2), Projectile.oldPosition.Y + (float)(Projectile.height / 2), velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.85), 0f, Projectile.owner, 0f, 0f); } } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - int brimstone = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int brimstone = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimstone].noGravity = true; Main.dust[brimstone].velocity *= 0f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0.0 && projectile.velocity.X != 0.0) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0.0 && Projectile.velocity.X != 0.0) { - projectile.velocity.X *= 0.97f; - if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) + Projectile.velocity.X *= 0.97f; + if (Projectile.velocity.X > -0.01f && Projectile.velocity.X < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y += 0.2f; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.1f * projectile.direction; + Projectile.velocity.Y += 0.2f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.1f * Projectile.direction; } - if (projectile.velocity.Y <= 16f) + if (Projectile.velocity.Y <= 16f) return; - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } public override bool OnTileCollide(Vector2 oldVelocity) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.penetrate--; - if (projectile.penetrate <= 0) + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) + Projectile.ai[0] += 0.1f; + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - projectile.velocity *= 0.8f; + Projectile.velocity *= 0.8f; } return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; + target.immune[Projectile.owner] = 8; target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs index a8a9c52fda..25c2c1c00b 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs +++ b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class BrimstoneHellfireballFriendly : ModProjectile @@ -14,67 +15,67 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Hellfire"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.penetrate = 2; - projectile.extraUpdates = 1; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.penetrate = 2; + Projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 9) + Projectile.frameCounter++; + if (Projectile.frameCounter > 9) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 6) + if (Projectile.frame >= 6) { - projectile.frame = 0; + Projectile.frame = 0; } //Fade in - if (projectile.alpha > 5) - projectile.alpha -= 15; - if (projectile.alpha < 5) - projectile.alpha = 5; + if (Projectile.alpha > 5) + Projectile.alpha -= 15; + if (Projectile.alpha < 5) + Projectile.alpha = 5; //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90) * Projectile.direction; - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); + Main.dust[num458].velocity += Projectile.velocity * 0.1f; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); + Projectile.localAI[0] += 1f; } } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int fire = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int fire = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } @@ -85,7 +86,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/BrimstoneHomer.cs b/Projectiles/Magic/BrimstoneHomer.cs index c4e3a8bb29..b011832a4f 100644 --- a/Projectiles/Magic/BrimstoneHomer.cs +++ b/Projectiles/Magic/BrimstoneHomer.cs @@ -14,27 +14,27 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 180; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 180; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.rotation += 0.7f * projectile.direction; + Projectile.rotation += 0.7f * Projectile.direction; - int brimstone = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + int brimstone = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Main.dust[brimstone].noGravity = true; - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 8f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 8f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Magic/BrimstoneTentacle.cs b/Projectiles/Magic/BrimstoneTentacle.cs index 269066d555..dd2496866b 100644 --- a/Projectiles/Magic/BrimstoneTentacle.cs +++ b/Projectiles/Magic/BrimstoneTentacle.cs @@ -17,78 +17,78 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.MaxUpdates = 3; - projectile.magic = true; + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = 5; + Projectile.MaxUpdates = 3; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.localAI[1]++; - if (projectile.velocity.X != projectile.velocity.X) + Projectile.localAI[1]++; + if (Projectile.velocity.X != Projectile.velocity.X) { - if (Math.Abs(projectile.velocity.X) < 1f) + if (Math.Abs(Projectile.velocity.X) < 1f) { - projectile.velocity.X = -projectile.velocity.X; + Projectile.velocity.X = -Projectile.velocity.X; } else { - projectile.Kill(); + Projectile.Kill(); } } - if (projectile.velocity.Y != projectile.velocity.Y) + if (Projectile.velocity.Y != Projectile.velocity.Y) { - if (Math.Abs(projectile.velocity.Y) < 1f) + if (Math.Abs(Projectile.velocity.Y) < 1f) { - projectile.velocity.Y = -projectile.velocity.Y; + Projectile.velocity.Y = -Projectile.velocity.Y; } else { - projectile.Kill(); + Projectile.Kill(); } } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if (projectile.localAI[0] < 0.1f) + Vector2 center10 = Projectile.Center; + Projectile.scale = 1f - Projectile.localAI[0]; + Projectile.width = (int)(20f * Projectile.scale); + Projectile.height = Projectile.width; + Projectile.position.X = center10.X - (float)(Projectile.width / 2); + Projectile.position.Y = center10.Y - (float)(Projectile.height / 2); + if (Projectile.localAI[0] < 0.1f) { - projectile.localAI[0] += 0.01f; + Projectile.localAI[0] += 0.01f; } else { - projectile.localAI[0] += 0.025f; + Projectile.localAI[0] += 0.025f; } - if (projectile.localAI[0] >= 0.95f) + if (Projectile.localAI[0] >= 0.95f) { - projectile.Kill(); + Projectile.Kill(); } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; - if (projectile.velocity.Length() > 16f) + Projectile.velocity.X = Projectile.velocity.X + Projectile.ai[0] * 1.5f; + Projectile.velocity.Y = Projectile.velocity.Y + Projectile.ai[1] * 1.5f; + if (Projectile.velocity.Length() > 16f) { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; + Projectile.velocity.Normalize(); + Projectile.velocity *= 16f; } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f && projectile.localAI[1] > 5f) + Projectile.ai[0] *= 1.05f; + Projectile.ai[1] *= 1.05f; + if (Projectile.scale < 1f && Projectile.localAI[1] > 5f) { int num897 = 0; - while ((float)num897 < projectile.scale * 10f) + while ((float)num897 < Projectile.scale * 10f) { - int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.5f); - Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; + int num898 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.5f); + Main.dust[num898].position = (Main.dust[num898].position + Projectile.Center) / 2f; Main.dust[num898].noGravity = true; Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); - Main.dust[num898].fadeIn = (float)(100 + projectile.owner); - Main.dust[num898].scale += projectile.scale * 0.75f; + Main.dust[num898].velocity -= Projectile.velocity * (1.3f - Projectile.scale); + Main.dust[num898].fadeIn = (float)(100 + Projectile.owner); + Main.dust[num898].scale += Projectile.scale * 0.75f; num897++; } } @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Magic/ClamorNoctusStar.cs b/Projectiles/Magic/ClamorNoctusStar.cs index 665c220cb7..28d116fe03 100644 --- a/Projectiles/Magic/ClamorNoctusStar.cs +++ b/Projectiles/Magic/ClamorNoctusStar.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -12,38 +13,38 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.magic = true; - projectile.aiStyle = 93; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; + Projectile.aiStyle = 93; aiType = ProjectileID.NailFriendly; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item9, (int)Projectile.position.X, (int)Projectile.position.Y); } } if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 20, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } @@ -54,18 +55,18 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -75,21 +76,21 @@ namespace CalamityMod.Projectiles.Magic } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } for (int num480 = 0; num480 < 3; num480++) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/ClamorNoctusWyvern.cs b/Projectiles/Magic/ClamorNoctusWyvern.cs index 2216332957..7339fecbd4 100644 --- a/Projectiles/Magic/ClamorNoctusWyvern.cs +++ b/Projectiles/Magic/ClamorNoctusWyvern.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -15,52 +16,52 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.magic = true; - projectile.aiStyle = 93; - projectile.extraUpdates = 1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; + Projectile.aiStyle = 93; + Projectile.extraUpdates = 1; } public override void AI() { if (Main.rand.Next(5) == 0) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 126, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 126, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - projectile.timeLeft = 0; + Projectile.timeLeft = 0; } return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCHit7, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit7, Projectile.Center); for (int i = 0; i <= 10; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 126, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 126, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - int head = Gore.NewGore(projectile.Center, projectile.velocity * 0.8f, mod.GetGoreSlot("Gores/WyvernWeapons/ClamorNoctusHead")); + int head = Gore.NewGore(Projectile.Center, Projectile.velocity * 0.8f, Mod.GetGoreSlot("Gores/WyvernWeapons/ClamorNoctusHead")); Main.gore[head].timeLeft /= 10; - int body = Gore.NewGore(projectile.Center, projectile.velocity * 0.8f, mod.GetGoreSlot("Gores/WyvernWeapons/ClamorNoctusBody")); + int body = Gore.NewGore(Projectile.Center, Projectile.velocity * 0.8f, Mod.GetGoreSlot("Gores/WyvernWeapons/ClamorNoctusBody")); Main.gore[body].timeLeft /= 10; - int tail = Gore.NewGore(projectile.Center, projectile.velocity * 0.8f, mod.GetGoreSlot("Gores/WyvernWeapons/ClamorNoctusTail")); + int tail = Gore.NewGore(Projectile.Center, Projectile.velocity * 0.8f, Mod.GetGoreSlot("Gores/WyvernWeapons/ClamorNoctusTail")); Main.gore[tail].timeLeft /= 10; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Magic/ClimaxBeam.cs b/Projectiles/Magic/ClimaxBeam.cs index f82d840373..8c78158a88 100644 --- a/Projectiles/Magic/ClimaxBeam.cs +++ b/Projectiles/Magic/ClimaxBeam.cs @@ -14,20 +14,20 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 90; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; + Projectile.width = 4; + Projectile.height = 4; + Projectile.extraUpdates = 100; + Projectile.friendly = true; + Projectile.timeLeft = 90; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; } public override void AI() { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * 0.25f; int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 1.25f); Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; diff --git a/Projectiles/Magic/ClimaxProj.cs b/Projectiles/Magic/ClimaxProj.cs index addc5197a5..b6d2d9a498 100644 --- a/Projectiles/Magic/ClimaxProj.cs +++ b/Projectiles/Magic/ClimaxProj.cs @@ -11,67 +11,67 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Voltaic Orb"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 38; - projectile.height = 38; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 48; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = 38; + Projectile.height = 38; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 48; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } public override void AI() { // Rapidly screech to a halt once spawned. - projectile.velocity *= 0.86f; + Projectile.velocity *= 0.86f; // Spin chaotically given a pre-defined spin direction. Choose one initially at random. float spinTheta = 0.11f; - if (projectile.localAI[1] == 0f) - projectile.localAI[1] = Main.rand.NextBool() ? -spinTheta : spinTheta; - projectile.rotation += projectile.localAI[1]; + if (Projectile.localAI[1] == 0f) + Projectile.localAI[1] = Main.rand.NextBool() ? -spinTheta : spinTheta; + Projectile.rotation += Projectile.localAI[1]; // Animate the lightning orb. - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 4) + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame > 4) { - projectile.frame = 0; + Projectile.frame = 0; } } // Initial stagger in frames needs to be skipped over before it starts shooting, // but once it's past that then it can fire constantly - --projectile.ai[0]; - if (projectile.ai[0] < 0f) - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, Climax.OrbFireRate, 2, ModContent.ProjectileType(), 1D, true); + --Projectile.ai[0]; + if (Projectile.ai[0] < 0f) + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 400f, 8f, Climax.OrbFireRate, 2, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 30) + if (Projectile.timeLeft < 30) { - float num7 = projectile.timeLeft / 30f; - projectile.alpha = (int)(255f - 255f * num7); + float num7 = Projectile.timeLeft / 30f; + Projectile.alpha = (int)(255f - 255f * num7); } - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Magic/CoralSpike.cs b/Projectiles/Magic/CoralSpike.cs index c67f916a44..5990df80d9 100644 --- a/Projectiles/Magic/CoralSpike.cs +++ b/Projectiles/Magic/CoralSpike.cs @@ -11,20 +11,20 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.aiStyle = 14; - projectile.penetrate = 4; - projectile.timeLeft = 360; - projectile.magic = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.aiStyle = 14; + Projectile.penetrate = 4; + Projectile.timeLeft = 360; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.velocity.X *= 0.9f; - projectile.velocity.Y *= 0.99f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.velocity.X *= 0.9f; + Projectile.velocity.Y *= 0.99f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; } } } diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index 5f892d65ac..ae802c74e2 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -16,78 +16,78 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.MaxUpdates = 3; - projectile.magic = true; + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = 5; + Projectile.MaxUpdates = 3; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.localAI[1]++; - if (projectile.velocity.X != projectile.velocity.X) + Projectile.localAI[1]++; + if (Projectile.velocity.X != Projectile.velocity.X) { - if (Math.Abs(projectile.velocity.X) < 1f) + if (Math.Abs(Projectile.velocity.X) < 1f) { - projectile.velocity.X = -projectile.velocity.X; + Projectile.velocity.X = -Projectile.velocity.X; } else { - projectile.Kill(); + Projectile.Kill(); } } - if (projectile.velocity.Y != projectile.velocity.Y) + if (Projectile.velocity.Y != Projectile.velocity.Y) { - if (Math.Abs(projectile.velocity.Y) < 1f) + if (Math.Abs(Projectile.velocity.Y) < 1f) { - projectile.velocity.Y = -projectile.velocity.Y; + Projectile.velocity.Y = -Projectile.velocity.Y; } else { - projectile.Kill(); + Projectile.Kill(); } } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if (projectile.localAI[0] < 0.1f) + Vector2 center10 = Projectile.Center; + Projectile.scale = 1f - Projectile.localAI[0]; + Projectile.width = (int)(20f * Projectile.scale); + Projectile.height = Projectile.width; + Projectile.position.X = center10.X - (float)(Projectile.width / 2); + Projectile.position.Y = center10.Y - (float)(Projectile.height / 2); + if (Projectile.localAI[0] < 0.1f) { - projectile.localAI[0] += 0.01f; + Projectile.localAI[0] += 0.01f; } else { - projectile.localAI[0] += 0.025f; + Projectile.localAI[0] += 0.025f; } - if (projectile.localAI[0] >= 0.95f) + if (Projectile.localAI[0] >= 0.95f) { - projectile.Kill(); + Projectile.Kill(); } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; - if (projectile.velocity.Length() > 16f) + Projectile.velocity.X = Projectile.velocity.X + Projectile.ai[0] * 1.5f; + Projectile.velocity.Y = Projectile.velocity.Y + Projectile.ai[1] * 1.5f; + if (Projectile.velocity.Length() > 16f) { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; + Projectile.velocity.Normalize(); + Projectile.velocity *= 16f; } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f && projectile.localAI[1] > 5f) + Projectile.ai[0] *= 1.05f; + Projectile.ai[1] *= 1.05f; + if (Projectile.scale < 1f && Projectile.localAI[1] > 5f) { int num897 = 0; - while ((float)num897 < projectile.scale * 10f) + while ((float)num897 < Projectile.scale * 10f) { - int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.1f); - Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; + int num898 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); + Main.dust[num898].position = (Main.dust[num898].position + Projectile.Center) / 2f; Main.dust[num898].noGravity = true; Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); - Main.dust[num898].fadeIn = (float)(100 + projectile.owner); - Main.dust[num898].scale += projectile.scale * 0.75f; + Main.dust[num898].velocity -= Projectile.velocity * (1.3f - Projectile.scale); + Main.dust[num898].fadeIn = (float)(100 + Projectile.owner); + Main.dust[num898].scale += Projectile.scale * 0.75f; num897++; } } @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; } } } diff --git a/Projectiles/Magic/Crescent.cs b/Projectiles/Magic/Crescent.cs index 310db9486a..840790a3ea 100644 --- a/Projectiles/Magic/Crescent.cs +++ b/Projectiles/Magic/Crescent.cs @@ -10,46 +10,46 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Crescent Cutter"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.friendly = true; - projectile.timeLeft = 200; - projectile.aiStyle = 0; - projectile.width = 20; - projectile.height = 20; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.knockBack = 0; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.magic = true; + Projectile.friendly = true; + Projectile.timeLeft = 200; + Projectile.aiStyle = 0; + Projectile.width = 20; + Projectile.height = 20; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.knockBack = 0; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.DamageType = DamageClass.Magic; } public override Color? GetAlpha(Color lightColor) { - return new Color(230, 230, 255, projectile.alpha); + return new Color(230, 230, 255, Projectile.alpha); } public override void AI() { - Projectile parent = Main.projectile[(int)projectile.ai[0]]; + Projectile parent = Main.projectile[(int)Projectile.ai[0]]; if (!parent.active) - projectile.Kill(); + Projectile.Kill(); - projectile.rotation += 0.7f; + Projectile.rotation += 0.7f; - projectile.ai[1]++; + Projectile.ai[1]++; - if (projectile.ai[1] > 20) + if (Projectile.ai[1] > 20) { - projectile.velocity += projectile.SafeDirectionTo(parent.Center) * 2.5f; - if (projectile.WithinRange(parent.Center, 75f)) - projectile.Kill(); + Projectile.velocity += Projectile.SafeDirectionTo(parent.Center) * 2.5f; + if (Projectile.WithinRange(parent.Center, 75f)) + Projectile.Kill(); } } } diff --git a/Projectiles/Magic/CryoBlast.cs b/Projectiles/Magic/CryoBlast.cs index d9e8af2c2f..798da415f3 100644 --- a/Projectiles/Magic/CryoBlast.cs +++ b/Projectiles/Magic/CryoBlast.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class CryoBlast : ModProjectile @@ -13,63 +14,63 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = projectile.height = 35; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 3; - projectile.timeLeft = 90; - projectile.coldDamage = true; - projectile.ignoreWater = true; - projectile.alpha = 255; + Projectile.width = Projectile.height = 35; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 3; + Projectile.timeLeft = 90; + Projectile.coldDamage = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; } public override void AI() { - if (projectile.scale <= 2.5f) + if (Projectile.scale <= 2.5f) { - projectile.scale *= 1.02f; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(35f * projectile.scale)); + Projectile.scale *= 1.02f; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, (int)(35f * Projectile.scale)); } - else if (projectile.ai[0] < 2f) + else if (Projectile.ai[0] < 2f) { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; // Fire extra waves to the left and right for (int i = 0; i < 2; i++) { - Projectile.NewProjectile(projectile.Center, projectile.velocity.RotatedBy(-Spread * (i + 1)), projectile.type, projectile.damage / 2, projectile.knockBack, projectile.owner, projectile.ai[0], 0f); - Projectile.NewProjectile(projectile.Center, projectile.velocity.RotatedBy(+Spread * (i + 1)), projectile.type, projectile.damage / 2, projectile.knockBack, projectile.owner, projectile.ai[0], 0f); + Projectile.NewProjectile(Projectile.Center, Projectile.velocity.RotatedBy(-Spread * (i + 1)), Projectile.type, Projectile.damage / 2, Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f); + Projectile.NewProjectile(Projectile.Center, Projectile.velocity.RotatedBy(+Spread * (i + 1)), Projectile.type, Projectile.damage / 2, Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f); } - projectile.Kill(); + Projectile.Kill(); } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0.5f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f || projectile.ai[0] > 0f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f || Projectile.ai[0] > 0f) { - int ice = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 100, default, projectile.scale * 0.5f); + int ice = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 100, default, Projectile.scale * 0.5f); Main.dust[ice].noGravity = true; Main.dust[ice].velocity *= 0f; - int snow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 185, 0f, 0f, 100, default, projectile.scale * 0.5f); + int snow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 185, 0f, 0f, 100, default, Projectile.scale * 0.5f); Main.dust[snow].noGravity = true; Main.dust[snow].velocity *= 0f; } @@ -77,35 +78,35 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if ((projectile.timeLeft > 596 && projectile.ai[0] == 0f) || (projectile.timeLeft > 599 && projectile.ai[0] > 0f)) + if ((Projectile.timeLeft > 596 && Projectile.ai[0] == 0f) || (Projectile.timeLeft > 599 && Projectile.ai[0] > 0f)) return false; - Texture2D texture = Main.projectileTexture[projectile.type]; - Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - int height = texture.Height / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameHeight, texture.Width, height); Vector2 origin = new Vector2(texture.Width / 2f, height / 2f); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.Center); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int index1 = 0; index1 < 15; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88, 0f, 0f, 0, new Color(), 0.9f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 88, 0f, 0f, 0, new Color(), 0.9f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 1.5f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Vector2 shardPos = projectile.oldPosition + 0.5f * projectile.Size; + Vector2 shardPos = Projectile.oldPosition + 0.5f * Projectile.Size; for (int i = 0; i < 3; i++) { Vector2 shardVel = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); @@ -115,7 +116,7 @@ namespace CalamityMod.Projectiles.Magic } shardVel.Normalize(); shardVel *= Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(shardPos, shardVel, ProjectileID.Blizzard, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner); + Projectile.NewProjectile(shardPos, shardVel, ProjectileID.Blizzard, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); } } } diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index 84d4f4712a..3167f8b407 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -22,45 +22,45 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.Calamity().PierceResistHarshness = 0.06f; - projectile.Calamity().PierceResistCap = 0.4f; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.Calamity().PierceResistHarshness = 0.06f; + Projectile.Calamity().PierceResistCap = 0.4f; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { Vector2? vector71 = null; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - projectile.velocity = -Vector2.UnitY; + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) + Projectile.velocity = -Vector2.UnitY; - if (projectile.type != ModContent.ProjectileType() || !Main.projectile[(int)projectile.ai[1]].active || Main.projectile[(int)projectile.ai[1]].type != ModContent.ProjectileType()) + if (Projectile.type != ModContent.ProjectileType() || !Main.projectile[(int)Projectile.ai[1]].active || Main.projectile[(int)Projectile.ai[1]].type != ModContent.ProjectileType()) { - projectile.Kill(); + Projectile.Kill(); return; } - float laserPosition = (int)projectile.ai[0] - 2.5f; - Vector2 value36 = Vector2.Normalize(Main.projectile[(int)projectile.ai[1]].velocity); - Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; + float laserPosition = (int)Projectile.ai[0] - 2.5f; + Vector2 value36 = Vector2.Normalize(Main.projectile[(int)Projectile.ai[1]].velocity); + Projectile projectile2 = Main.projectile[(int)Projectile.ai[1]]; float num811; Vector2 value37 = Vector2.Zero; float num812; @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic float laserRotationSpeed; float scaleFactor6; Color color = new Color(1, 1, 1, 127); - projectile.Opacity = 1f; + Projectile.Opacity = 1f; if (projectile2.ai[0] < 720f) { @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Magic if (colorLimit > 255f) colorLimit = 255f; - switch ((int)projectile.ai[0]) //R O Y G B I V + switch ((int)Projectile.ai[0]) //R O Y G B I V { case 0: color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); @@ -127,64 +127,64 @@ namespace CalamityMod.Projectiles.Magic float num814 = (projectile2.ai[0] + laserPosition * laserRotationSpeed) / (laserRotationSpeed * 6f) * MathHelper.TwoPi; num811 = Vector2.UnitY.RotatedBy(num814).Y * (MathHelper.Pi / 6) * num812 * 0.33f; value37 = (Vector2.UnitY.RotatedBy(num814) * new Vector2(4f, y)).RotatedBy(projectile2.velocity.ToRotation()); - projectile.position = projectile2.Center + value36 * 16f - projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)projectile.ai[1]].gfxOffY); - projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; - projectile.position += value37; - projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy(num811); - projectile.scale = 1.5f * (1.5f - num812); + Projectile.position = projectile2.Center + value36 * 16f - Projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)Projectile.ai[1]].gfxOffY); + Projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; + Projectile.position += value37; + Projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy(num811); + Projectile.scale = 1.5f * (1.5f - num812); // Takes 360 frames to reach normal damage float amount = projectile2.ai[0] / 1200f; if (amount > 1f) amount = 1f; - projectile.damage = (int)(projectile2.damage * MathHelper.Lerp(0.25f, 2.2f, amount)); + Projectile.damage = (int)(projectile2.damage * MathHelper.Lerp(0.25f, 2.2f, amount)); if (projectile2.ai[0] >= 720f) vector71 = new Vector2?(projectile2.Center); - if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) - vector71 = new Vector2?(Main.player[projectile.owner].Center); + if (!Collision.CanHitLine(Main.player[Projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) + vector71 = new Vector2?(Main.player[Projectile.owner].Center); - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - projectile.velocity = -Vector2.UnitY; + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) + Projectile.velocity = -Vector2.UnitY; - float num818 = projectile.velocity.ToRotation(); - projectile.rotation = num818 - MathHelper.PiOver2; - projectile.velocity = num818.ToRotationVector2(); + float num818 = Projectile.velocity.ToRotation(); + Projectile.rotation = num818 - MathHelper.PiOver2; + Projectile.velocity = num818.ToRotationVector2(); float num819 = 2f; float num820 = 0f; - Vector2 samplingPoint = projectile.Center; + Vector2 samplingPoint = Projectile.Center; if (vector71.HasValue) samplingPoint = vector71.Value; float[] array3 = new float[(int)num819]; - Collision.LaserScan(samplingPoint, projectile.velocity, num820 * projectile.scale, 2400f, array3); + Collision.LaserScan(samplingPoint, Projectile.velocity, num820 * Projectile.scale, 2400f, array3); float num821 = 0f; for (int num822 = 0; num822 < array3.Length; num822++) num821 += array3[num822]; num821 /= num819; float amount2 = 0.75f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num821, amount2); - if (Math.Abs(projectile.localAI[1] - num821) < 100f && projectile.scale > 0.15f) + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num821, amount2); + if (Math.Abs(Projectile.localAI[1] - num821) < 100f && Projectile.scale > 0.15f) { - Vector2 vector80 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14.5f * projectile.scale); + Vector2 vector80 = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14.5f * Projectile.scale); for (int num843 = 0; num843 < 2; num843++) { - float num844 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float num844 = Projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; float num845 = (float)Main.rand.NextDouble() * 0.8f + 1f; Vector2 vector81 = new Vector2((float)Math.Cos(num844) * num845, (float)Math.Sin(num844) * num845); int num846 = Dust.NewDust(vector80, 0, 0, 267, vector81.X, vector81.Y, 0, color, 3.3f); Main.dust[num846].color = color; Main.dust[num846].scale = 1.2f; - if (projectile.scale > 1f) + if (Projectile.scale > 1f) { - Main.dust[num846].velocity *= projectile.scale; - Main.dust[num846].scale *= projectile.scale; + Main.dust[num846].velocity *= Projectile.scale; + Main.dust[num846].scale *= Projectile.scale; } Main.dust[num846].noGravity = true; - if (projectile.scale != 1.4f) + if (Projectile.scale != 1.4f) { Dust dust9 = Dust.CloneDust(num846); dust9.color = color; @@ -196,7 +196,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(5)) { - Vector2 value42 = projectile.velocity.RotatedBy(MathHelper.PiOver2) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; + Vector2 value42 = Projectile.velocity.RotatedBy(MathHelper.PiOver2) * ((float)Main.rand.NextDouble() - 0.5f) * Projectile.width; int num847 = Dust.NewDust(vector80 + value42 - Vector2.One * 4f, 8, 8, 267, 0f, 0f, 100, color, 5f); Main.dust[num847].velocity *= 0.5f; Main.dust[num847].noGravity = true; @@ -205,23 +205,23 @@ namespace CalamityMod.Projectiles.Magic DelegateMethods.v3_1 = color.ToVector3() * 0.3f; float value43 = 0.1f * (float)Math.Sin(Main.GlobalTime * 20f); - Vector2 size = new Vector2(projectile.velocity.Length() * projectile.localAI[1], projectile.width * projectile.scale); - float num848 = projectile.velocity.ToRotation(); + Vector2 size = new Vector2(Projectile.velocity.Length() * Projectile.localAI[1], Projectile.width * Projectile.scale); + float num848 = Projectile.velocity.ToRotation(); if (Main.netMode != NetmodeID.Server) - ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy(num848), color, size, RippleShape.Square, num848); + ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(Projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy(num848), color, size, RippleShape.Square, num848); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - float num228 = projectile.localAI[1]; - Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; + Texture2D tex = Main.projectileTexture[Projectile.type]; + float num228 = Projectile.localAI[1]; + Projectile projectile2 = Main.projectile[(int)Projectile.ai[1]]; Color color = new Color(1, 1, 1, 127); if (projectile2.ai[0] < 720f) { @@ -238,7 +238,7 @@ namespace CalamityMod.Projectiles.Magic { colorLimit = 255f; } - switch ((int)projectile.ai[0]) //R O Y G B I V + switch ((int)Projectile.ai[0]) //R O Y G B I V { case 0: color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); @@ -265,25 +265,25 @@ namespace CalamityMod.Projectiles.Magic } Color value25 = color; - Vector2 value26 = projectile.Center.Floor(); - value26 += projectile.velocity * projectile.scale * 10.5f; - num228 -= projectile.scale * 14.5f * projectile.scale; - Vector2 vector29 = new Vector2(projectile.scale); + Vector2 value26 = Projectile.Center.Floor(); + value26 += Projectile.velocity * Projectile.scale * 10.5f; + num228 -= Projectile.scale * 14.5f * Projectile.scale; + Vector2 vector29 = new Vector2(Projectile.scale); DelegateMethods.f_1 = 1f; - DelegateMethods.c_1 = value25 * 0.75f * projectile.Opacity; - Vector2 projPos = projectile.oldPos[0]; - projPos = new Vector2(projectile.width, projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); - DelegateMethods.c_1 = color * 0.75f * projectile.Opacity; - Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29 / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); + DelegateMethods.c_1 = value25 * 0.75f * Projectile.Opacity; + Vector2 projPos = Projectile.oldPos[0]; + projPos = new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + Projectile.velocity * num228 - Main.screenPosition, vector29, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); + DelegateMethods.c_1 = color * 0.75f * Projectile.Opacity; + Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + Projectile.velocity * num228 - Main.screenPosition, vector29 / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); return false; } public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -292,7 +292,7 @@ namespace CalamityMod.Projectiles.Magic return true; float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref num6)) return true; return false; diff --git a/Projectiles/Magic/DarkSparkPrism.cs b/Projectiles/Magic/DarkSparkPrism.cs index 009b32ccca..0c8599d3fc 100644 --- a/Projectiles/Magic/DarkSparkPrism.cs +++ b/Projectiles/Magic/DarkSparkPrism.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -15,80 +16,80 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.NeedsUUID[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 22; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = 14; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float num = 0f; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) num = MathHelper.Pi; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter); float num26 = 30f; - if (projectile.ai[0] > 360f) + if (Projectile.ai[0] > 360f) num26 = 15f; - if (projectile.ai[0] > 480f) + if (Projectile.ai[0] > 480f) num26 = 5f; - projectile.damage = (int)(player.ActiveItem().damage * player.MagicDamage()); + Projectile.damage = (int)(player.ActiveItem().damage * player.MagicDamage()); - projectile.ai[0] += 1f; - projectile.ai[1] += 1f; + Projectile.ai[0] += 1f; + Projectile.ai[1] += 1f; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.localAI[1] = 255f; + Projectile.localAI[0] = 1f; + Projectile.localAI[1] = 255f; } - if (projectile.localAI[1] > 0f) - projectile.localAI[1] -= 1f; + if (Projectile.localAI[1] > 0f) + Projectile.localAI[1] -= 1f; bool flag9 = false; - if (projectile.ai[0] % num26 == 0f) + if (Projectile.ai[0] % num26 == 0f) flag9 = true; int num27 = 10; bool flag10 = false; - if (projectile.ai[0] % num26 == 0f) + if (Projectile.ai[0] % num26 == 0f) flag10 = true; - if (projectile.ai[1] >= 1f) + if (Projectile.ai[1] >= 1f) { - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; flag10 = true; - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - float scaleFactor5 = player.ActiveItem().shootSpeed * projectile.scale; + float scaleFactor5 = player.ActiveItem().shootSpeed * Projectile.scale; Vector2 value12 = vector; Vector2 value13 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - value12; if (player.gravDir == -1f) @@ -98,86 +99,86 @@ namespace CalamityMod.Projectiles.Magic if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) vector11 = -Vector2.UnitY; - vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(projectile.velocity), 0.92f)); + vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(Projectile.velocity), 0.92f)); vector11 *= scaleFactor5; - if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) - projectile.netUpdate = true; + if (vector11.X != Projectile.velocity.X || vector11.Y != Projectile.velocity.Y) + Projectile.netUpdate = true; - projectile.velocity = vector11; + Projectile.velocity = vector11; } } - projectile.frameCounter++; - int num28 = (projectile.ai[0] < 480f) ? 3 : 1; - if (projectile.frameCounter >= num28) + Projectile.frameCounter++; + int num28 = (Projectile.ai[0] < 480f) ? 3 : 1; + if (Projectile.frameCounter >= num28) { - projectile.frameCounter = 0; - if (++projectile.frame >= 4) - projectile.frame = 0; + Projectile.frameCounter = 0; + if (++Projectile.frame >= 4) + Projectile.frame = 0; } - if (projectile.soundDelay <= 0) + if (Projectile.soundDelay <= 0) { - projectile.soundDelay = num27; - projectile.soundDelay *= 2; - if (projectile.ai[0] != 1f) - Main.PlaySound(SoundID.Item15, projectile.position); + Projectile.soundDelay = num27; + Projectile.soundDelay *= 2; + if (Projectile.ai[0] != 1f) + SoundEngine.PlaySound(SoundID.Item15, Projectile.position); } - if (flag10 && Main.myPlayer == projectile.owner) + if (flag10 && Main.myPlayer == Projectile.owner) { bool flag11 = !flag9 || player.CheckMana(player.ActiveItem(), -1, true, false); bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed; if (flag12) { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - Vector2 center3 = projectile.Center; - Vector2 vector12 = Vector2.Normalize(projectile.velocity); + Vector2 center3 = Projectile.Center; + Vector2 vector12 = Vector2.Normalize(Projectile.velocity); if (float.IsNaN(vector12.X) || float.IsNaN(vector12.Y)) vector12 = -Vector2.UnitY; - int num29 = projectile.damage; + int num29 = Projectile.damage; for (int l = 0; l < 7; l++) - Projectile.NewProjectile(center3, vector12, ModContent.ProjectileType(), num29, projectile.knockBack, projectile.owner, l, Projectile.GetByUUID(projectile.owner, projectile.whoAmI)); + Projectile.NewProjectile(center3, vector12, ModContent.ProjectileType(), num29, Projectile.knockBack, Projectile.owner, l, Projectile.GetByUUID(Projectile.owner, Projectile.whoAmI)); - projectile.netUpdate = true; + Projectile.netUpdate = true; } } else - projectile.Kill(); + Projectile.Kill(); } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); + player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * Projectile.direction, Projectile.velocity.X * Projectile.direction); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + if (Projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[Projectile.type]) { color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); } SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Texture2D texture2D14 = Main.projectileTexture[projectile.type]; - int num215 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y7 = num215 * projectile.frame; - Vector2 vector27 = (projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition).Floor(); - if (Main.player[projectile.owner].shroomiteStealth && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) + Texture2D texture2D14 = Main.projectileTexture[Projectile.type]; + int num215 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y7 = num215 * Projectile.frame; + Vector2 vector27 = (Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition).Floor(); + if (Main.player[Projectile.owner].shroomiteStealth && Main.player[Projectile.owner].inventory[Main.player[Projectile.owner].selectedItem].ranged) { - float num216 = Main.player[projectile.owner].stealth; + float num216 = Main.player[Projectile.owner].stealth; if ((double)num216 < 0.03) { num216 = 0.03f; @@ -185,9 +186,9 @@ namespace CalamityMod.Projectiles.Magic float arg_97B3_0 = (1f + num216 * 10f) / 11f; color25 *= num216; } - if (Main.player[projectile.owner].setVortex && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) + if (Main.player[Projectile.owner].setVortex && Main.player[Projectile.owner].inventory[Main.player[Projectile.owner].selectedItem].ranged) { - float num217 = Main.player[projectile.owner].stealth; + float num217 = Main.player[Projectile.owner].stealth; if ((double)num217 < 0.03) { num217 = 0.03f; @@ -195,23 +196,23 @@ namespace CalamityMod.Projectiles.Magic float arg_9854_0 = (1f + num217 * 10f) / 11f; color25 = color25.MultiplyRGBA(new Color(Vector4.Lerp(Vector4.One, new Vector4(0.16f, 0.12f, 0f, 0f), 1f - num217))); } - Main.spriteBatch.Draw(texture2D14, vector27, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25), projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); - float scaleFactor2 = (float)Math.Cos((double)(6.28318548f * (projectile.ai[0] / 120f))) * 2f + 2f; - if (projectile.ai[0] > 480f) + Main.spriteBatch.Draw(texture2D14, vector27, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y7, texture2D14.Width, num215)), Projectile.GetAlpha(color25), Projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), Projectile.scale, spriteEffects, 0f); + float scaleFactor2 = (float)Math.Cos((double)(6.28318548f * (Projectile.ai[0] / 120f))) * 2f + 2f; + if (Projectile.ai[0] > 480f) { scaleFactor2 = 4f; } for (float num218 = 0f; num218 < 4f; num218 += 1f) { - Main.spriteBatch.Draw(texture2D14, vector27 + Vector2.UnitY.RotatedBy((double)(num218 * 6.28318548f / 4f), default) * scaleFactor2, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25).MultiplyRGBA(new Color(255, 255, 255, 0)) * 0.03f, projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D14, vector27 + Vector2.UnitY.RotatedBy((double)(num218 * 6.28318548f / 4f), default) * scaleFactor2, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y7, texture2D14.Width, num215)), Projectile.GetAlpha(color25).MultiplyRGBA(new Color(255, 255, 255, 0)) * 0.03f, Projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), Projectile.scale, spriteEffects, 0f); } return false; } public override Color? GetAlpha(Color lightColor) { - if (projectile.ai[0] < 255f) - return new Color((int)projectile.ai[0], (int)projectile.ai[0], (int)projectile.ai[0], (int)projectile.localAI[1]); + if (Projectile.ai[0] < 255f) + return new Color((int)Projectile.ai[0], (int)Projectile.ai[0], (int)Projectile.ai[0], (int)Projectile.localAI[1]); else return new Color(255, 255, 255, 0); } diff --git a/Projectiles/Magic/DeathhailBeam.cs b/Projectiles/Magic/DeathhailBeam.cs index 0b748b1a13..d9b5fcc091 100644 --- a/Projectiles/Magic/DeathhailBeam.cs +++ b/Projectiles/Magic/DeathhailBeam.cs @@ -18,9 +18,9 @@ namespace CalamityMod.Projectiles.Magic public override float Lifetime => 20f; public override Color LaserOverlayColor => CalamityUtils.ColorSwap(startingColor, secondColor, 0.9f); public override Color LightCastColor => LaserOverlayColor; - public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); - public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); - public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); public override void SetStaticDefaults() { @@ -29,19 +29,19 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = projectile.height = 22; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.localNPCHitCooldown = -1; - projectile.usesLocalNPCImmunity = true; + Projectile.width = Projectile.height = 22; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.localNPCHitCooldown = -1; + Projectile.usesLocalNPCImmunity = true; } public override bool PreAI() { // Initialization. Using the AI hook would override the base laser's code, and we don't want that. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { if (Main.rand.NextBool()) { diff --git a/Projectiles/Magic/DivineRetributionSpear.cs b/Projectiles/Magic/DivineRetributionSpear.cs index 0ffcbb052e..7f9375ce2c 100644 --- a/Projectiles/Magic/DivineRetributionSpear.cs +++ b/Projectiles/Magic/DivineRetributionSpear.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -13,64 +14,64 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Divine Retribution"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 420; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.timeLeft = 420; } public override void AI() { - float num953 = 25f * projectile.ai[1]; //100 - float scaleFactor12 = 5f * projectile.ai[1]; //5 + float num953 = 25f * Projectile.ai[1]; //100 + float scaleFactor12 = 5f * Projectile.ai[1]; //5 float num954 = 1000f; - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } - Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + Lighting.AddLight(Projectile.Center, 0.7f, 0.3f, 0f); + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + if (Projectile.Distance(Main.player[Projectile.owner].Center) > num954) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 9f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 9f, 20f); } else { - if (projectile.timeLeft > 30) + if (Projectile.timeLeft > 30) { - projectile.timeLeft = 30; + Projectile.timeLeft = 30; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -82,26 +83,26 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 96; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item74, (int)projectile.Center.X, (int)projectile.Center.Y); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 96; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item74, (int)Projectile.Center.X, (int)Projectile.Center.Y); for (int num193 = 0; num193 < 6; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0, 0); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0, 0); } for (int num194 = 0; num194 < 10; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0, 0); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0, 0); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0, 0); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0, 0); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } diff --git a/Projectiles/Magic/DustProjectile.cs b/Projectiles/Magic/DustProjectile.cs index 8c2f285fff..b28419b300 100644 --- a/Projectiles/Magic/DustProjectile.cs +++ b/Projectiles/Magic/DustProjectile.cs @@ -12,42 +12,42 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Dust"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 64; - projectile.height = 64; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; + Projectile.width = 64; + Projectile.height = 64; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 90; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.4f, 0.01f); - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Lighting.AddLight(Projectile.Center, 0.5f, 0.4f, 0.01f); + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - if (projectile.ai[0] > 7f) + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; + if (Projectile.ai[0] > 7f) { int dustType = 22; - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[idx]; if (Main.rand.NextBool(3)) { @@ -59,31 +59,31 @@ namespace CalamityMod.Projectiles.Magic dust.velocity.X *= 1.5f; dust.velocity.Y *= 1.5f; } - projectile.ai[0] += 1f; - projectile.rotation += 0.3f * (float)projectile.direction; - if (projectile.timeLeft < 30) - projectile.Opacity = MathHelper.Lerp(0f, 1f, (float)projectile.timeLeft / 30f); + Projectile.ai[0] += 1f; + Projectile.rotation += 0.3f * (float)Projectile.direction; + if (Projectile.timeLeft < 30) + Projectile.Opacity = MathHelper.Lerp(0f, 1f, (float)Projectile.timeLeft / 30f); } - public override bool CanDamage() => projectile.timeLeft > 30; + public override bool CanDamage() => Projectile.timeLeft > 30; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); // Dust effects - Circle dustCircle = new Circle(projectile.Center, projectile.width / 2); + Circle dustCircle = new Circle(Projectile.Center, Projectile.width / 2); for (int i = 0; i < 20; i++) { // Dust Vector2 dustPos = dustCircle.RandomPointInCircle(); - if ((dustPos - projectile.Center).Length() > 48) + if ((dustPos - Projectile.Center).Length() > 48) { int dustIndex = Dust.NewDust(dustPos, 1, 1, 22); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].fadeIn = 1f; - Vector2 dustVelocity = projectile.Center - Main.dust[dustIndex].position; + Vector2 dustVelocity = Projectile.Center - Main.dust[dustIndex].position; float distToCenter = dustVelocity.Length(); dustVelocity.Normalize(); dustVelocity = dustVelocity.RotatedBy(MathHelper.ToRadians(-90f)); diff --git a/Projectiles/Magic/EelDrop.cs b/Projectiles/Magic/EelDrop.cs index fbdb44b4b8..d56eb3d1db 100644 --- a/Projectiles/Magic/EelDrop.cs +++ b/Projectiles/Magic/EelDrop.cs @@ -14,24 +14,24 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Acid"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 20; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = true; - projectile.ignoreWater = false; - projectile.timeLeft = 240; + Projectile.width = 14; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = true; + Projectile.ignoreWater = false; + Projectile.timeLeft = 240; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -39,12 +39,12 @@ namespace CalamityMod.Projectiles.Magic // Water drip for (int i = 0; i < 4; i++) { - int idx = Dust.NewDust(projectile.position - projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); Dust dust = Main.dust[idx]; dust.position.X -= 2f; Main.dust[idx].alpha = 38; Main.dust[idx].velocity *= 0.1f; - Main.dust[idx].velocity -= projectile.velocity * 0.025f; + Main.dust[idx].velocity -= Projectile.velocity * 0.025f; Main.dust[idx].scale = 1.67f; } @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Magic/EidolicWailSoundwave.cs b/Projectiles/Magic/EidolicWailSoundwave.cs index 92d7d7d55e..02ee6f1fdf 100644 --- a/Projectiles/Magic/EidolicWailSoundwave.cs +++ b/Projectiles/Magic/EidolicWailSoundwave.cs @@ -12,61 +12,61 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Wail"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 36; - projectile.height = 36; - projectile.scale = 0.005f; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.magic = true; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; - projectile.timeLeft = 450; - projectile.Calamity().PierceResistHarshness = 0.06f; - projectile.Calamity().PierceResistCap = 0.4f; + Projectile.width = 36; + Projectile.height = 36; + Projectile.scale = 0.005f; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; + Projectile.timeLeft = 450; + Projectile.Calamity().PierceResistHarshness = 0.06f; + Projectile.Calamity().PierceResistCap = 0.4f; } public override void AI() { - if (projectile.localAI[0] < 1f) + if (Projectile.localAI[0] < 1f) { - projectile.localAI[0] += 0.02f; // 50 frames to reach full size and max power - projectile.scale += 0.02f; - projectile.width = (int)(36f * projectile.scale); - projectile.height = (int)(36f * projectile.scale); + Projectile.localAI[0] += 0.02f; // 50 frames to reach full size and max power + Projectile.scale += 0.02f; + Projectile.width = (int)(36f * Projectile.scale); + Projectile.height = (int)(36f * Projectile.scale); } else { - projectile.width = 36; - projectile.height = 36; + Projectile.width = 36; + Projectile.height = 36; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } return false; } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - damage = (int)(damage * projectile.localAI[0]); + damage = (int)(damage * Projectile.localAI[0]); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -76,9 +76,9 @@ namespace CalamityMod.Projectiles.Magic public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/EldritchTentacle.cs b/Projectiles/Magic/EldritchTentacle.cs index c1aff61edd..c577689b3d 100644 --- a/Projectiles/Magic/EldritchTentacle.cs +++ b/Projectiles/Magic/EldritchTentacle.cs @@ -15,77 +15,77 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.MaxUpdates = 3; - projectile.magic = true; + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.MaxUpdates = 3; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - if (Math.Abs(projectile.velocity.X) < 1f) + if (Math.Abs(Projectile.velocity.X) < 1f) { - projectile.velocity.X = -projectile.velocity.X; + Projectile.velocity.X = -Projectile.velocity.X; } else { - projectile.Kill(); + Projectile.Kill(); } } - if (projectile.velocity.Y != projectile.velocity.Y) + if (Projectile.velocity.Y != Projectile.velocity.Y) { - if (Math.Abs(projectile.velocity.Y) < 1f) + if (Math.Abs(Projectile.velocity.Y) < 1f) { - projectile.velocity.Y = -projectile.velocity.Y; + Projectile.velocity.Y = -Projectile.velocity.Y; } else { - projectile.Kill(); + Projectile.Kill(); } } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) + Vector2 center10 = Projectile.Center; + Projectile.scale = 1f - Projectile.localAI[0]; + Projectile.width = (int)(20f * Projectile.scale); + Projectile.height = Projectile.width; + Projectile.position.X = center10.X - (float)(Projectile.width / 2); + Projectile.position.Y = center10.Y - (float)(Projectile.height / 2); + if ((double)Projectile.localAI[0] < 0.1) { - projectile.localAI[0] += 0.01f; + Projectile.localAI[0] += 0.01f; } else { - projectile.localAI[0] += 0.025f; + Projectile.localAI[0] += 0.025f; } - if (projectile.localAI[0] >= 0.95f) + if (Projectile.localAI[0] >= 0.95f) { - projectile.Kill(); + Projectile.Kill(); } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; - if (projectile.velocity.Length() > 16f) + Projectile.velocity.X = Projectile.velocity.X + Projectile.ai[0] * 1.5f; + Projectile.velocity.Y = Projectile.velocity.Y + Projectile.ai[1] * 1.5f; + if (Projectile.velocity.Length() > 16f) { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; + Projectile.velocity.Normalize(); + Projectile.velocity *= 16f; } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) + Projectile.ai[0] *= 1.05f; + Projectile.ai[1] *= 1.05f; + if (Projectile.scale < 1f) { int num897 = 0; - while ((float)num897 < projectile.scale * 10f) + while ((float)num897 < Projectile.scale * 10f) { - int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.1f); - Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; + int num898 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); + Main.dust[num898].position = (Main.dust[num898].position + Projectile.Center) / 2f; Main.dust[num898].noGravity = true; Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); - Main.dust[num898].fadeIn = (float)(100 + projectile.owner); - Main.dust[num898].scale += projectile.scale * 0.75f; + Main.dust[num898].velocity -= Projectile.velocity * (1.3f - Projectile.scale); + Main.dust[num898].fadeIn = (float)(100 + Projectile.owner); + Main.dust[num898].scale += Projectile.scale * 0.75f; num897++; } } diff --git a/Projectiles/Magic/ElementBolt.cs b/Projectiles/Magic/ElementBolt.cs index 9ac5a14daf..7f5fc2b664 100644 --- a/Projectiles/Magic/ElementBolt.cs +++ b/Projectiles/Magic/ElementBolt.cs @@ -14,28 +14,28 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 30; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.extraUpdates = 100; + Projectile.friendly = true; + Projectile.timeLeft = 30; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } public override void AI() { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] >= 29f && Projectile.owner == Main.myPlayer) { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.7f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.localAI[1] = 0f; + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7f), Projectile.knockBack, Projectile.owner, 0f, 0f); } for (int num447 = 0; num447 < 2; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; diff --git a/Projectiles/Magic/ElementBolt2.cs b/Projectiles/Magic/ElementBolt2.cs index b0d87927d4..a5f63e81a7 100644 --- a/Projectiles/Magic/ElementBolt2.cs +++ b/Projectiles/Magic/ElementBolt2.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 15; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.extraUpdates = 100; + Projectile.friendly = true; + Projectile.timeLeft = 15; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } public override void AI() { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * 0.25f; int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); Main.dust[num448].position = vector33; Main.dust[num448].noGravity = true; diff --git a/Projectiles/Magic/ElementOrb.cs b/Projectiles/Magic/ElementOrb.cs index 0ac7c0a41c..06379ae664 100644 --- a/Projectiles/Magic/ElementOrb.cs +++ b/Projectiles/Magic/ElementOrb.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 30; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType()); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType()); } } } diff --git a/Projectiles/Magic/ElementOrb2.cs b/Projectiles/Magic/ElementOrb2.cs index 0d2c6e9dd3..688f4dc6fb 100644 --- a/Projectiles/Magic/ElementOrb2.cs +++ b/Projectiles/Magic/ElementOrb2.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 30; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType()); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType()); } } } diff --git a/Projectiles/Magic/ElementTentacle.cs b/Projectiles/Magic/ElementTentacle.cs index b29babc641..ac856f340a 100644 --- a/Projectiles/Magic/ElementTentacle.cs +++ b/Projectiles/Magic/ElementTentacle.cs @@ -17,77 +17,77 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.MaxUpdates = 3; - projectile.magic = true; - projectile.tileCollide = false; + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.MaxUpdates = 3; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - if (Math.Abs(projectile.velocity.X) < 1f) + if (Math.Abs(Projectile.velocity.X) < 1f) { - projectile.velocity.X = -projectile.velocity.X; + Projectile.velocity.X = -Projectile.velocity.X; } else { - projectile.Kill(); + Projectile.Kill(); } } - if (projectile.velocity.Y != projectile.velocity.Y) + if (Projectile.velocity.Y != Projectile.velocity.Y) { - if (Math.Abs(projectile.velocity.Y) < 1f) + if (Math.Abs(Projectile.velocity.Y) < 1f) { - projectile.velocity.Y = -projectile.velocity.Y; + Projectile.velocity.Y = -Projectile.velocity.Y; } else { - projectile.Kill(); + Projectile.Kill(); } } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) + Vector2 center10 = Projectile.Center; + Projectile.scale = 1f - Projectile.localAI[0]; + Projectile.width = (int)(20f * Projectile.scale); + Projectile.height = Projectile.width; + Projectile.position.X = center10.X - (float)(Projectile.width / 2); + Projectile.position.Y = center10.Y - (float)(Projectile.height / 2); + if ((double)Projectile.localAI[0] < 0.1) { - projectile.localAI[0] += 0.01f; + Projectile.localAI[0] += 0.01f; } else { - projectile.localAI[0] += 0.025f; + Projectile.localAI[0] += 0.025f; } - if (projectile.localAI[0] >= 0.95f) + if (Projectile.localAI[0] >= 0.95f) { - projectile.Kill(); + Projectile.Kill(); } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 2f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 2f; - if (projectile.velocity.Length() > 16f) + Projectile.velocity.X = Projectile.velocity.X + Projectile.ai[0] * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + Projectile.ai[1] * 2f; + if (Projectile.velocity.Length() > 16f) { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; + Projectile.velocity.Normalize(); + Projectile.velocity *= 16f; } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) + Projectile.ai[0] *= 1.05f; + Projectile.ai[1] *= 1.05f; + if (Projectile.scale < 1f) { int num897 = 0; - while ((float)num897 < projectile.scale * 10f) + while ((float)num897 < Projectile.scale * 10f) { - int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, projectile.velocity.X, projectile.velocity.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); - Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; + int num898 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, Projectile.velocity.X, Projectile.velocity.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); + Main.dust[num898].position = (Main.dust[num898].position + Projectile.Center) / 2f; Main.dust[num898].noGravity = true; Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); - Main.dust[num898].scale += projectile.scale * 0.75f; + Main.dust[num898].velocity -= Projectile.velocity * (1.3f - Projectile.scale); + Main.dust[num898].scale += Projectile.scale * 0.75f; num897++; } } diff --git a/Projectiles/Magic/ElementalRayBeam.cs b/Projectiles/Magic/ElementalRayBeam.cs index 9463679ccc..31a7482d90 100644 --- a/Projectiles/Magic/ElementalRayBeam.cs +++ b/Projectiles/Magic/ElementalRayBeam.cs @@ -16,32 +16,32 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = 180; - projectile.ignoreWater = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 10; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 180; + Projectile.ignoreWater = true; } public override void AI() { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 22f && projectile.owner == Main.myPlayer) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] >= 22f && Projectile.owner == Main.myPlayer) { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.localAI[1] = 0f; + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { for (int num447 = 0; num447 < 3; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; diff --git a/Projectiles/Magic/EnormousConsumingVortex.cs b/Projectiles/Magic/EnormousConsumingVortex.cs index 40cacc26cc..e70aeba830 100644 --- a/Projectiles/Magic/EnormousConsumingVortex.cs +++ b/Projectiles/Magic/EnormousConsumingVortex.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -12,14 +13,14 @@ namespace CalamityMod.Projectiles.Magic { public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public float IdealScale { - get => projectile.ai[1]; - set => projectile.ai[1] = value; + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; } public const int TentacleSpawnRate = 20; @@ -31,46 +32,46 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Subsuming Vortex"); - ProjectileID.Sets.NeedsUUID[projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.scale = StartingScale; - projectile.timeLeft = 540; - projectile.tileCollide = false; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.scale = StartingScale; + Projectile.timeLeft = 540; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } // Vanilla Terraria does not sync projectile scale by default. - public override void SendExtraAI(BinaryWriter writer) => writer.Write(projectile.scale); - public override void ReceiveExtraAI(BinaryReader reader) => projectile.scale = reader.ReadSingle(); + public override void SendExtraAI(BinaryWriter writer) => writer.Write(Projectile.scale); + public override void ReceiveExtraAI(BinaryReader reader) => Projectile.scale = reader.ReadSingle(); public override void AI() { - projectile.rotation += MathHelper.ToRadians(8f); // Spin 2 win. - projectile.alpha = (int)MathHelper.Lerp(255, 0, Utils.InverseLerp(0f, 20f, Time, true)); // Fade in completely after 20 frames. - projectile.scale = MathHelper.Lerp(StartingScale, IdealScale, Utils.InverseLerp(0f, 30f, Time, true)); // Expand completely after 30 frames. + Projectile.rotation += MathHelper.ToRadians(8f); // Spin 2 win. + Projectile.alpha = (int)MathHelper.Lerp(255, 0, Utils.InverseLerp(0f, 20f, Time, true)); // Fade in completely after 20 frames. + Projectile.scale = MathHelper.Lerp(StartingScale, IdealScale, Utils.InverseLerp(0f, 30f, Time, true)); // Expand completely after 30 frames. // Determine the ideal scale in the first frame. if (IdealScale == 0f) { IdealScale = Main.rand.NextFloat(2.2f, 3f); - projectile.netUpdate = true; + Projectile.netUpdate = true; } // Target enemy if possible and idly spawn tentacles. if (Time < 150) { TargetingMovement(); - if (Time % TentacleSpawnRate == TentacleSpawnRate - 1 && Main.myPlayer == projectile.owner) + if (Time % TentacleSpawnRate == TentacleSpawnRate - 1 && Main.myPlayer == Projectile.owner) { ProduceSubsumingHentai(); } @@ -78,7 +79,7 @@ namespace CalamityMod.Projectiles.Magic // Slow down and pulse frequently. else if (Time < 220) { - projectile.velocity *= 0.96f; + Projectile.velocity *= 0.96f; if (Time % PulseInterval == 0f) { PulseEffect(); @@ -87,24 +88,24 @@ namespace CalamityMod.Projectiles.Magic else if (Time >= 240) { ExplodeEffect(); - projectile.Kill(); + Projectile.Kill(); } - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(projectile.scale * 62)); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, (int)(Projectile.scale * 62)); Time++; } public void ProduceSubsumingHentai() { - int tentacleDamage = (int)(projectile.damage * 0.25f); + int tentacleDamage = (int)(Projectile.damage * 0.25f); float xStartingAcceleration = Main.rand.NextFloat(0.001f, 0.04f) * Main.rand.NextBool(2).ToDirectionInt(); float yStartingAcceleration = Main.rand.NextFloat(0.001f, 0.04f) * Main.rand.NextBool(2).ToDirectionInt(); Projectile subsumingHentai = Projectile.NewProjectileDirect( - projectile.Center, + Projectile.Center, Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(9f, 13f), ModContent.ProjectileType(), tentacleDamage, - projectile.knockBack * 0.5f, - projectile.owner, + Projectile.knockBack * 0.5f, + Projectile.owner, xStartingAcceleration, yStartingAcceleration ); @@ -114,22 +115,22 @@ namespace CalamityMod.Projectiles.Magic public void TargetingMovement() { - NPC potentialTarget = projectile.Center.ClosestNPCAt(600f, true, true); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(600f, true, true); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 5f + projectile.SafeDirectionTo(potentialTarget.Center) * 7f) / 6f; + Projectile.velocity = (Projectile.velocity * 5f + Projectile.SafeDirectionTo(potentialTarget.Center) * 7f) / 6f; } public void PulseEffect() { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, PulseHitboxExpandRatio); - projectile.Damage(); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, PulseHitboxExpandRatio); + Projectile.Damage(); if (!Main.dedServ) { - Main.PlaySound(SoundID.Item43, projectile.Center); + SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); for (int i = 0; (float)i < 85; i++) { float angle = i / 85f * MathHelper.TwoPi; - Vector2 spawnPosition = projectile.Center + angle.ToRotationVector2() * (500f + Main.rand.NextFloat(-8f, 8f)); + Vector2 spawnPosition = Projectile.Center + angle.ToRotationVector2() * (500f + Main.rand.NextFloat(-8f, 8f)); Vector2 velocity = (angle - (float)Math.PI).ToRotationVector2() * Main.rand.NextFloat(27f, 38.5f); Dust dust = Dust.NewDustPerfect(spawnPosition, 264, velocity); dust.scale = 0.9f; @@ -138,43 +139,43 @@ namespace CalamityMod.Projectiles.Magic dust.noGravity = true; } } - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 1f / PulseHitboxExpandRatio); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 1f / PulseHitboxExpandRatio); } public void ExplodeEffect() { - Main.PlaySound(SoundID.Zombie, projectile.Center, 104); + SoundEngine.PlaySound(SoundID.Zombie, Projectile.Center, 104); if (!Main.dedServ) { for (int i = 0; i < 200; i++) { Vector2 velocity = Main.rand.NextVector2Circular(50f, 50f); - Dust dust = Dust.NewDustPerfect(projectile.Center, 264, velocity); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 264, velocity); dust.color = Main.hslToRgb(i / 100f % 1f, 1f, 0.8f); dust.fadeIn = 1.25f; dust.noGravity = true; } } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - int vortexDamage = (int)(projectile.damage * 0.75f); - NPC closestTarget = projectile.Center.ClosestNPCAt(1600f, true, true); + int vortexDamage = (int)(Projectile.damage * 0.75f); + NPC closestTarget = Projectile.Center.ClosestNPCAt(1600f, true, true); for (int i = 0; i < 12; i++) { float rotation = Main.rand.NextFloat(MathHelper.TwoPi); Vector2 velocity = Vector2.UnitY.RotatedBy(rotation); if (closestTarget != null) - velocity = projectile.SafeDirectionTo(closestTarget.Center, -Vector2.UnitY).RotatedByRandom(0.4f); + velocity = Projectile.SafeDirectionTo(closestTarget.Center, -Vector2.UnitY).RotatedByRandom(0.4f); velocity *= Main.rand.NextFloat(3f, 5f); - Projectile.NewProjectileDirect(projectile.Center, + Projectile.NewProjectileDirect(Projectile.Center, velocity, ModContent.ProjectileType(), vortexDamage, - projectile.knockBack, - projectile.owner, + Projectile.knockBack, + Projectile.owner, 0f, Main.rand.NextFloat(0.5f, 1.8f)); } @@ -186,8 +187,8 @@ namespace CalamityMod.Projectiles.Magic int vortexesToDraw = 27; for (int i = 0; i < vortexesToDraw; i++) { - float rotation = MathHelper.TwoPi / i * vortexesToDraw + projectile.rotation; - float drawScale = projectile.scale * 0.66f; + float rotation = MathHelper.TwoPi / i * vortexesToDraw + Projectile.rotation; + float drawScale = Projectile.scale * 0.66f; drawScale *= (float)(Math.Cos(Time / 18f + rotation * 2f) + 1f) * 0.3f + 0.7f; // Range of 0.7 to 1. Used to give variance with the scale. float offsetFactor = (float)(Math.Sin(Time / 18f + rotation * 2f) + 1f) * 0.2f + 0.8f; // Range of 0.8 to 1. @@ -195,14 +196,14 @@ namespace CalamityMod.Projectiles.Magic // Due to the way RotatedBy works, the offset can be negative, giving the projectile a // dual buzzsaw look. Vector2 drawOffset = Vector2.UnitX.RotatedBy(rotation) * 30f * offsetFactor * drawScale; - Vector2 drawPosition = projectile.Center + drawOffset - Main.screenPosition; + Vector2 drawPosition = Projectile.Center + drawOffset - Main.screenPosition; Color colorToDraw = Main.hslToRgb((i / (float)vortexesToDraw + Time / 40f) % 1f, 1f, 0.75f); - spriteBatch.Draw(ModContent.GetTexture(Texture), + spriteBatch.Draw(ModContent.Request(Texture), drawPosition, null, colorToDraw * 0.7f, rotation, - ModContent.GetTexture(Texture).Size() * 0.5f, + ModContent.Request(Texture).Size() * 0.5f, drawScale, SpriteEffects.None, 0f); diff --git a/Projectiles/Magic/EternityBook.cs b/Projectiles/Magic/EternityBook.cs index 1a4a9738dc..706cc051e1 100644 --- a/Projectiles/Magic/EternityBook.cs +++ b/Projectiles/Magic/EternityBook.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -8,88 +9,88 @@ namespace CalamityMod.Projectiles.Magic { public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public override void SetStaticDefaults() { DisplayName.SetDefault("Eternity"); - Main.projFrames[projectile.type] = 8; + Main.projFrames[Projectile.type] = 8; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = 26; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; - projectile.Center = player.Center + 18f * player.direction * Vector2.UnitX; + Projectile.Center = player.Center + 18f * player.direction * Vector2.UnitX; // If the player is no longer able to hold the book, kill it (and by extension the other projectiles). if (!player.channel || player.noItems || player.CCed) { - projectile.Kill(); + Projectile.Kill(); return; } Time++; // Summon a bunch of cool things the moment the book is created, assuming an NPC is near the mouse position. - if (Main.myPlayer == projectile.owner && Time == 1f) + if (Main.myPlayer == Projectile.owner && Time == 1f) { NPC target = Main.MouseWorld.ClosestNPCAt(4400f, true, true); if (target != null) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceHolyRay")); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceHolyRay")); SummonProjectilesOnTarget(target, player); } } // Switch frames at a linearly increasing rate to make it look like the player is flipping pages quickly. - if (projectile.frameCounter++ >= (int)MathHelper.Lerp(10f, 1f, Utils.InverseLerp(0f, 200f, Time, true))) + if (Projectile.frameCounter++ >= (int)MathHelper.Lerp(10f, 1f, Utils.InverseLerp(0f, 200f, Time, true))) { - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; - projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frameCounter = 0; } AdjustPlayerValues(player); } public void AdjustPlayerValues(Player player) { - projectile.spriteDirection = projectile.direction = player.direction; - projectile.timeLeft = 2; - player.heldProj = projectile.whoAmI; + Projectile.spriteDirection = Projectile.direction = player.direction; + Projectile.timeLeft = 2; + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (projectile.direction * projectile.velocity).ToRotation(); + player.itemRotation = (Projectile.direction * Projectile.velocity).ToRotation(); } public void SummonProjectilesOnTarget(NPC target, Player owner) { - Projectile hex = Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 0f, owner.whoAmI, target.whoAmI); - hex.localAI[1] = projectile.whoAmI; + Projectile hex = Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, owner.whoAmI, target.whoAmI); + hex.localAI[1] = Projectile.whoAmI; for (int i = 0; i < 5; i++) { float crystalAngleOffset = MathHelper.TwoPi / 5f * i; Projectile crystal = Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, owner.whoAmI, target.whoAmI, crystalAngleOffset); crystal.frame = i % 2; - crystal.localAI[1] = projectile.whoAmI; + crystal.localAI[1] = Projectile.whoAmI; } for (int i = 0; i < 10; i++) { float circleOffset = MathHelper.TwoPi / 10f * i; Projectile circleSpell = Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, owner.whoAmI, target.whoAmI, circleOffset); - circleSpell.localAI[1] = projectile.whoAmI; + circleSpell.localAI[1] = Projectile.whoAmI; } } public override bool CanDamage() => false; diff --git a/Projectiles/Magic/EternityCircle.cs b/Projectiles/Magic/EternityCircle.cs index 27cc1bd27a..0225cb9cc6 100644 --- a/Projectiles/Magic/EternityCircle.cs +++ b/Projectiles/Magic/EternityCircle.cs @@ -11,23 +11,23 @@ namespace CalamityMod.Projectiles.Magic public int TargetNPCIndex { - get => (int)projectile.ai[0]; - set => projectile.ai[0] = value; + get => (int)Projectile.ai[0]; + set => Projectile.ai[0] = value; } public float SinusoidalPositionAngle { - get => projectile.ai[1]; - set => projectile.ai[1] = value; + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; } public float SinusoidalOffsetAngle { - get => projectile.localAI[0]; - set => projectile.localAI[0] = value; + get => Projectile.localAI[0]; + set => Projectile.localAI[0] = value; } public int HeldBookIndex { - get => (int)projectile.localAI[1]; - set => projectile.localAI[1] = value; + get => (int)Projectile.localAI[1]; + set => Projectile.localAI[1] = value; } public const float TargetOffsetRadius = 490f; public const float SinusoidalOffsetAngleIncrement = 0.54f; @@ -39,13 +39,13 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = EternityHex.Lifetime; - projectile.alpha = 255; - projectile.magic = true; + Projectile.width = 2; + Projectile.height = 2; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = EternityHex.Lifetime; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; } public override void AI() @@ -55,19 +55,19 @@ namespace CalamityMod.Projectiles.Magic // Delete the circle if any necessary components are incorrect/would cause errors. if (HeldBookIndex >= Main.projectile.Length || SinusoidalOffsetAngle < 0) { - projectile.Kill(); + Projectile.Kill(); return; } if (!Main.projectile[HeldBookIndex].active) { - projectile.Kill(); + Projectile.Kill(); return; } // Delete the circle if the target cannot be damaged. if (!target.active || target.dontTakeDamage) { - projectile.active = false; + Projectile.active = false; } // Assign an offset angle if it has a default value. @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Magic } // Circle around the enemy. - projectile.position = target.Center + SinusoidalPositionAngle.ToRotationVector2() * TargetOffsetRadius; + Projectile.position = target.Center + SinusoidalPositionAngle.ToRotationVector2() * TargetOffsetRadius; SinusoidalPositionAngle += SinusoidalPositionAngleIncrement; SinusoidalOffsetAngle += SinusoidalOffsetAngleIncrement; @@ -87,10 +87,10 @@ namespace CalamityMod.Projectiles.Magic float radius = 8f; Vector2 offset = Vector2.UnitY * pulse * radius; - Dust dust = Dust.NewDustPerfect(projectile.Center + offset, 132, Vector2.Zero); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 132, Vector2.Zero); dust.noGravity = true; - dust = Dust.NewDustPerfect(projectile.Center - offset, 133, Vector2.Zero); + dust = Dust.NewDustPerfect(Projectile.Center - offset, 133, Vector2.Zero); dust.noGravity = true; } } diff --git a/Projectiles/Magic/EternityCrystal.cs b/Projectiles/Magic/EternityCrystal.cs index 021d5a2555..f44e12490b 100644 --- a/Projectiles/Magic/EternityCrystal.cs +++ b/Projectiles/Magic/EternityCrystal.cs @@ -5,6 +5,7 @@ using System; using System.IO; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -15,30 +16,30 @@ namespace CalamityMod.Projectiles.Magic public float DegreesToSpin = 2f; public int TargetIndex { - get => (int)projectile.ai[0]; - set => projectile.ai[0] = value; + get => (int)Projectile.ai[0]; + set => Projectile.ai[0] = value; } public float SpinAngle { - get => projectile.ai[1]; - set => projectile.ai[1] = value; + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; } public const int InwardCollapseTime = 70; public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal"); - Main.projFrames[projectile.type] = 2; + Main.projFrames[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 36; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = EternityHex.Lifetime; - projectile.alpha = 0; - projectile.magic = true; + Projectile.width = 34; + Projectile.height = 36; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = EternityHex.Lifetime; + Projectile.alpha = 0; + Projectile.DamageType = DamageClass.Magic; } public override void SendExtraAI(BinaryWriter writer) @@ -52,29 +53,29 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; // Delete the crystal if any necessary components are incorrect/would cause errors. - if (projectile.localAI[1] >= Main.projectile.Length || projectile.localAI[0] < 0) + if (Projectile.localAI[1] >= Main.projectile.Length || Projectile.localAI[0] < 0) { DeathDust(); - projectile.Kill(); + Projectile.Kill(); return; } - Projectile book = Main.projectile[(int)projectile.localAI[1]]; + Projectile book = Main.projectile[(int)Projectile.localAI[1]]; if (!book.active) { DeathDust(); - projectile.Kill(); + Projectile.Kill(); return; } if (TargetIndex >= Main.npc.Length || TargetIndex < 0) { DeathDust(); - projectile.Kill(); + Projectile.Kill(); return; } @@ -83,42 +84,42 @@ namespace CalamityMod.Projectiles.Magic if (!target.active) { DeathDust(); - projectile.Kill(); + Projectile.Kill(); return; } - projectile.localAI[0] += 1f; - if (projectile.timeLeft == 1 && !Collapsing) + Projectile.localAI[0] += 1f; + if (Projectile.timeLeft == 1 && !Collapsing) { - projectile.velocity = projectile.SafeDirectionTo(target.Center) * 2f; - projectile.timeLeft = InwardCollapseTime; + Projectile.velocity = Projectile.SafeDirectionTo(target.Center) * 2f; + Projectile.timeLeft = InwardCollapseTime; Collapsing = true; - projectile.netUpdate = true; + Projectile.netUpdate = true; } SpinAngle -= MathHelper.ToRadians(DegreesToSpin); - projectile.rotation = projectile.AngleTo(target.Center) - MathHelper.PiOver2; - projectile.position = target.Center + SpinAngle.ToRotationVector2() * TargetOffsetRadius; + Projectile.rotation = Projectile.AngleTo(target.Center) - MathHelper.PiOver2; + Projectile.position = target.Center + SpinAngle.ToRotationVector2() * TargetOffsetRadius; if (!Collapsing) { - projectile.damage = 0; + Projectile.damage = 0; } else { DegreesToSpin *= 1.0425f; TargetOffsetRadius *= 0.95f; - if (projectile.Hitbox.Intersects(target.Hitbox) && !target.dontTakeDamage) + if (Projectile.Hitbox.Intersects(target.Hitbox) && !target.dontTakeDamage) ExplosionEffect(target, player); - if (projectile.alpha < 255) - projectile.alpha += 3; + if (Projectile.alpha < 255) + Projectile.alpha += 3; } } public void DeathDust() { for (int i = 0; i < 20; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, Eternity.DustID, newColor: new Color(245, 112, 218)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, Eternity.DustID, newColor: new Color(245, 112, 218)); dust.velocity = Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(2f, 6f); dust.noGravity = true; } @@ -130,7 +131,7 @@ namespace CalamityMod.Projectiles.Magic player.addDPS(damage); target.StrikeNPC(damage, 0f, 0, false); - Vector2 randomCirclePointVector = Vector2.UnitY.RotatedBy(projectile.rotation); + Vector2 randomCirclePointVector = Vector2.UnitY.RotatedBy(Projectile.rotation); // pointsPerStarStrip is basically how many times dust should be drawn to make half of a star point. // The amount of dust from the explosion = pointsPerStarStrip * starPoints * 2. @@ -158,14 +159,14 @@ namespace CalamityMod.Projectiles.Magic randomCirclePointVector = randomCirclePointVector.RotatedBy(MathHelper.TwoPi / starPoints); } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), (int)target.Center.X, (int)target.Center.Y); - projectile.Kill(); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), (int)target.Center.X, (int)target.Center.Y); + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D myTexture = ModContent.GetTexture(Texture); - Rectangle frame = myTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Color trasparentCrystalColor = projectile.GetAlpha(lightColor) * 0.6f; + Texture2D myTexture = ModContent.Request(Texture); + Rectangle frame = myTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color trasparentCrystalColor = Projectile.GetAlpha(lightColor) * 0.6f; Vector2 origin = frame.Size() / 2f; // Determine the offset factor of the crystals via a universal time-based sinusoid incorporated into a linear interpolation. @@ -174,9 +175,9 @@ namespace CalamityMod.Projectiles.Magic for (float i = 0f; i < 5; i++) { float angle = MathHelper.TwoPi / 5f * i + MathHelper.PiOver2; - Vector2 offset = Vector2.UnitY.RotatedBy(angle).RotatedBy(projectile.rotation); - Vector2 drawPosition = projectile.Center - Main.screenPosition + offset * outwardness + Vector2.UnitY * projectile.gfxOffY; - spriteBatch.Draw(myTexture, drawPosition, frame, trasparentCrystalColor, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + Vector2 offset = Vector2.UnitY.RotatedBy(angle).RotatedBy(Projectile.rotation); + Vector2 drawPosition = Projectile.Center - Main.screenPosition + offset * outwardness + Vector2.UnitY * Projectile.gfxOffY; + spriteBatch.Draw(myTexture, drawPosition, frame, trasparentCrystalColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } return true; } diff --git a/Projectiles/Magic/EternityHex.cs b/Projectiles/Magic/EternityHex.cs index 4b18741a68..8800fe3b75 100644 --- a/Projectiles/Magic/EternityHex.cs +++ b/Projectiles/Magic/EternityHex.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Projectiles.Magic internal PrimitiveTrail LemniscateDrawer = null; public int TargetNPCIndex { - get => (int)projectile.ai[0]; - set => projectile.ai[0] = value; + get => (int)Projectile.ai[0]; + set => Projectile.ai[0] = value; } public float LemniscateAngle { - get => projectile.ai[1]; - set => projectile.ai[1] = value; + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; } public float Time { - get => projectile.localAI[0]; - set => projectile.localAI[0] = value; + get => Projectile.localAI[0]; + set => Projectile.localAI[0] = value; } public int BookProjectileIndex { - get => (int)projectile.localAI[1]; - set => projectile.localAI[1] = value; + get => (int)Projectile.localAI[1]; + set => Projectile.localAI[1] = value; } public const int Lifetime = 310; public const float BossLifeMaxDamageMult = 1f / 350f; @@ -40,26 +40,26 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Eternity"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 63; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 63; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.alpha = 255; + Projectile.width = 4; + Projectile.height = 4; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; + Projectile.alpha = 255; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (TargetNPCIndex >= Main.npc.Length || TargetNPCIndex < 0) { DeathDust(); - projectile.Kill(); + Projectile.Kill(); return; } @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Magic if (BookProjectileIndex >= Main.projectile.Length || BookProjectileIndex < 0 || Time < 0) { DeathDust(); - projectile.Kill(); + Projectile.Kill(); return; } @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Magic else { DeathDust(); - projectile.Kill(); + Projectile.Kill(); return; } } @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Magic if (!book.active) { DeathDust(); - projectile.Kill(); + Projectile.Kill(); return; } @@ -109,12 +109,12 @@ namespace CalamityMod.Projectiles.Magic DetermineLemniscatePosition(target); } - if (Time < Lifetime * projectile.MaxUpdates) + if (Time < Lifetime * Projectile.MaxUpdates) { - float effectRate = MathHelper.Lerp(0.4f, 1f, Time / (Lifetime * projectile.MaxUpdates - 40)); + float effectRate = MathHelper.Lerp(0.4f, 1f, Time / (Lifetime * Projectile.MaxUpdates - 40)); float random = Main.rand.NextFloat(); - projectile.Opacity = Utils.InverseLerp(Lifetime * projectile.MaxUpdates, (Lifetime - 60f) * projectile.MaxUpdates, Time, true); + Projectile.Opacity = Utils.InverseLerp(Lifetime * Projectile.MaxUpdates, (Lifetime - 60f) * Projectile.MaxUpdates, Time, true); // Spawn a bunch of swirling dust and do damage. if (random <= effectRate) @@ -143,13 +143,13 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < homerCount; i++) { Vector2 velocity = Vector2.UnitY.RotatedBy(MathHelper.TwoPi / homerCount * i).RotatedByRandom(0.3f) * 10f; - Projectile.NewProjectile(target.Center + velocity * 4f, velocity, ModContent.ProjectileType(), damage, 0f, projectile.owner, TargetNPCIndex); + Projectile.NewProjectile(target.Center + velocity * 4f, velocity, ModContent.ProjectileType(), damage, 0f, Projectile.owner, TargetNPCIndex); } } } else { - projectile.Kill(); + Projectile.Kill(); } } @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 44; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, Eternity.DustID, newColor: new Color(245, 112, 218)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, Eternity.DustID, newColor: new Color(245, 112, 218)); dust.velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(2f, 6f); dust.noGravity = true; } @@ -171,7 +171,7 @@ namespace CalamityMod.Projectiles.Magic float outwardMultiplier = MathHelper.Lerp(4f, 220f, Utils.InverseLerp(0f, 120f, Time, true)); Vector2 lemniscateOffset = scale * new Vector2((float)Math.Cos(LemniscateAngle), (float)Math.Sin(2f * LemniscateAngle) / 2f); - projectile.Center = target.Center + lemniscateOffset * outwardMultiplier; + Projectile.Center = target.Center + lemniscateOffset * outwardMultiplier; } public void ChooseNewTarget(NPC newTarget) @@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Magic Projectile proj = Main.projectile[i]; if (!proj.active) continue; - if (proj.owner != projectile.owner) + if (proj.owner != Projectile.owner) continue; if (proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType()) continue; @@ -212,7 +212,7 @@ namespace CalamityMod.Projectiles.Magic // So that the player can gauge the DPS of this weapon effectively (StrikeNPC alone will not register the DPS to the player. I have to do this myself). public void RegisterDPS(int damage) { - Main.player[projectile.owner].addDPS(damage); + Main.player[Projectile.owner].addDPS(damage); } public Color PrimitiveColorFunction(float completionRatio) @@ -222,7 +222,7 @@ namespace CalamityMod.Projectiles.Magic Color headColor = Color.Lerp(Color.Black, Color.Magenta, 0.1f); Color tailColor = Color.Lerp(Color.Magenta, Color.Cyan, completionRatio * 0.5f + leftoverTimeScale); - float opacity = (float)Math.Pow(Utils.InverseLerp(1f, 0.61f, completionRatio, true), 0.4) * projectile.Opacity; + float opacity = (float)Math.Pow(Utils.InverseLerp(1f, 0.61f, completionRatio, true), 0.4) * Projectile.Opacity; float fadeToMagenta = MathHelper.SmoothStep(0f, 1f, (float)Math.Pow(completionRatio, 0.6D)); return Color.Lerp(headColor, tailColor, fadeToMagenta) * opacity; @@ -239,8 +239,8 @@ namespace CalamityMod.Projectiles.Magic if (LemniscateDrawer is null) LemniscateDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction, null, GameShaders.Misc["CalamityMod:TrailStreak"]); - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/EternityStreak")); - LemniscateDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f - Main.screenPosition, 84); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/EternityStreak")); + LemniscateDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 84); return false; } } diff --git a/Projectiles/Magic/EternityHoming.cs b/Projectiles/Magic/EternityHoming.cs index 58aeaba512..f11e747531 100644 --- a/Projectiles/Magic/EternityHoming.cs +++ b/Projectiles/Magic/EternityHoming.cs @@ -17,35 +17,35 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 120; - projectile.alpha = 255; - projectile.magic = true; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 120; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - NPC target = projectile.Center.ClosestNPCAt(3000f); + NPC target = Projectile.Center.ClosestNPCAt(3000f); if (target != null) - projectile.velocity = (projectile.velocity * 7f + projectile.SafeDirectionTo(target.Center) * 10f) / 8f; + Projectile.velocity = (Projectile.velocity * 7f + Projectile.SafeDirectionTo(target.Center) * 10f) / 8f; - projectile.ai[0] += 0.18f; - float angle = projectile.velocity.ToRotation() + MathHelper.PiOver2; - float pulse = (float)Math.Sin(projectile.ai[0]); + Projectile.ai[0] += 0.18f; + float angle = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + float pulse = (float)Math.Sin(Projectile.ai[0]); float radius = 4f; Vector2 offset = angle.ToRotationVector2() * pulse * radius; - Dust dust = Dust.NewDustPerfect(projectile.Center + offset, 264, Vector2.Zero); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 264, Vector2.Zero); dust.color = Eternity.BlueColor; dust.scale = 1.4f; dust.noLight = true; dust.noGravity = true; - dust = Dust.NewDustPerfect(projectile.Center - offset, 264, Vector2.Zero); + dust = Dust.NewDustPerfect(Projectile.Center - offset, 264, Vector2.Zero); dust.color = Eternity.PinkColor; dust.scale = 1.4f; dust.noLight = true; diff --git a/Projectiles/Magic/EventHorizonBlackhole.cs b/Projectiles/Magic/EventHorizonBlackhole.cs index 6af0f72fff..051dc33ceb 100644 --- a/Projectiles/Magic/EventHorizonBlackhole.cs +++ b/Projectiles/Magic/EventHorizonBlackhole.cs @@ -13,48 +13,48 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Blackhole"); - Main.projFrames[projectile.type] = 8; + Main.projFrames[Projectile.type] = 8; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = 90; - projectile.magic = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 12; + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 90; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 60; + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 60; public override void AI() { - if (projectile.frame == 8) + if (Projectile.frame == 8) return; // Update animation - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.timeLeft > 15) + if (Projectile.timeLeft > 15) { - if (projectile.frame >= 4) - projectile.frame = 0; + if (Projectile.frame >= 4) + Projectile.frame = 0; } else { - if (projectile.frame < 4) - projectile.frame = 4; - if (projectile.frame >= 8) - projectile.frame = 4; + if (Projectile.frame < 4) + Projectile.frame = 4; + if (Projectile.frame >= 8) + Projectile.frame = 4; } } @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/EventHorizonStar.cs b/Projectiles/Magic/EventHorizonStar.cs index ecbc9854c1..da6d14ae1c 100644 --- a/Projectiles/Magic/EventHorizonStar.cs +++ b/Projectiles/Magic/EventHorizonStar.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -15,48 +16,48 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Event Horizon Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.magic = true; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.alpha = 180; + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.alpha = 180; } public override void AI() { //rotation - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; //sound effects - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item9, (int)Projectile.position.X, (int)Projectile.position.Y); } } //dust effects if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 262, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 0, default, 0.75f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 262, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 0, default, 0.75f); } - projectile.localAI[0]++; + Projectile.localAI[0]++; - Vector2 playerCenter = Main.player[projectile.owner].Center; - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; + Vector2 playerCenter = Main.player[Projectile.owner].Center; + float centerX = Projectile.Center.X; + float centerY = Projectile.Center.Y; if (!initialized) { @@ -72,21 +73,21 @@ namespace CalamityMod.Projectiles.Magic float yDist = playerCenter.Y - centerY; float radius = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (projectile.localAI[0] > 10 && projectile.localAI[0] < 100) + if (Projectile.localAI[0] > 10 && Projectile.localAI[0] < 100) { - projectile.ai[1] += 1f / 60f; + Projectile.ai[1] += 1f / 60f; - if (projectile.ai[1] > 0) + if (Projectile.ai[1] > 0) { - projectile.ai[0] += MathHelper.ToRadians(5f) / projectile.ai[1]; - projectile.Center = playerCenter + projectile.ai[0].ToRotationVector2() * radius; + Projectile.ai[0] += MathHelper.ToRadians(5f) / Projectile.ai[1]; + Projectile.Center = playerCenter + Projectile.ai[0].ToRotationVector2() * radius; } } //homing - if (projectile.localAI[0] >= 100) + if (Projectile.localAI[0] >= 100) { - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; float homingRange = 325f; bool homeIn = false; float inertia = 25f; @@ -94,11 +95,11 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].CanBeChasedBy(projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (homingRange + extraDistance)) + if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (homingRange + extraDistance)) { center = Main.npc[i].Center; homeIn = true; @@ -109,36 +110,36 @@ namespace CalamityMod.Projectiles.Magic if (homeIn) { - projectile.extraUpdates = 1; - Vector2 homeInVector = projectile.SafeDirectionTo(center, Vector2.UnitY); + Projectile.extraUpdates = 1; + Vector2 homeInVector = Projectile.SafeDirectionTo(center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * inertia + homeInVector * homingSpeed) / (inertia + 1f); + Projectile.velocity = (Projectile.velocity * inertia + homeInVector * homingSpeed) / (inertia + 1f); } else - projectile.extraUpdates = 0; + Projectile.extraUpdates = 0; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Daybreak, 120); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), new Color(255, 255, 255, 127), projectile.rotation, texture.Size() / 2f, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), new Color(255, 255, 255, 127), Projectile.rotation, texture.Size() / 2f, Projectile.scale, spriteEffects, 0f); } } } diff --git a/Projectiles/Magic/EvergladeSprayProjectile.cs b/Projectiles/Magic/EvergladeSprayProjectile.cs index 74fd8e7ccf..3b561180e5 100644 --- a/Projectiles/Magic/EvergladeSprayProjectile.cs +++ b/Projectiles/Magic/EvergladeSprayProjectile.cs @@ -17,62 +17,62 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 6; - projectile.extraUpdates = 2; - projectile.magic = true; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 6; + Projectile.extraUpdates = 2; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - projectile.scale -= 0.002f; - if (projectile.scale <= 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.01f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); + Projectile.scale -= 0.002f; + if (Projectile.scale <= 0f) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.ai[0] <= 3f) + if (Projectile.ai[0] <= 3f) { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; return; } - projectile.velocity.Y = projectile.velocity.Y + 0.075f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.075f; for (int num151 = 0; num151 < 3; num151++) { - float num152 = projectile.velocity.X / 3f * (float)num151; - float num153 = projectile.velocity.Y / 3f * (float)num151; + float num152 = Projectile.velocity.X / 3f * (float)num151; + float num153 = Projectile.velocity.Y / 3f * (float)num151; int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 157, 0f, 0f, 100, default, 1f); + int num155 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num154, Projectile.position.Y + (float)num154), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 157, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num155]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.5f; + dust.velocity += Projectile.velocity * 0.5f; dust.position.X -= num152; dust.position.Y -= num153; } if (Main.rand.NextBool(8)) { int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 157, 0f, 0f, 100, default, 0.5f); + int num157 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num156, Projectile.position.Y + (float)num156), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 157, 0f, 0f, 100, default, 0.5f); Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; + Main.dust[num157].velocity += Projectile.velocity * 0.5f; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; + target.immune[Projectile.owner] = 8; target.AddBuff(BuffID.Ichor, 600); target.AddBuff(BuffID.CursedInferno, 300); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Magic/FabBolt.cs b/Projectiles/Magic/FabBolt.cs index 0fff02f6ce..10d348bf62 100644 --- a/Projectiles/Magic/FabBolt.cs +++ b/Projectiles/Magic/FabBolt.cs @@ -14,59 +14,59 @@ namespace CalamityMod.Projectiles.Magic public bool FadingOut { - get => projectile.ai[0] == 1f; - set => projectile.ai[0] = value.ToInt(); + get => Projectile.ai[0] == 1f; + set => Projectile.ai[0] = value.ToInt(); } public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 23; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 23; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.extraUpdates = 2; - projectile.penetrate = 12; - projectile.timeLeft = 90 * projectile.extraUpdates; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 0; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.extraUpdates = 2; + Projectile.penetrate = 12; + Projectile.timeLeft = 90 * Projectile.extraUpdates; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 0; } public override void AI() { if (FadingOut) { - projectile.Opacity = MathHelper.Lerp(projectile.Opacity, 0f, 0.27f); - if (projectile.Opacity <= 0.05f) - projectile.Kill(); + Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, 0f, 0.27f); + if (Projectile.Opacity <= 0.05f) + Projectile.Kill(); } else - projectile.velocity *= 1.004f; - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.velocity *= 1.004f; + Projectile.rotation = Projectile.velocity.ToRotation(); // Emit light. - Lighting.AddLight(projectile.Center, Vector3.One * projectile.Opacity * 0.45f); + Lighting.AddLight(Projectile.Center, Vector3.One * Projectile.Opacity * 0.45f); } internal Color ColorFunction(float completionRatio) { float fadeToEnd = MathHelper.Lerp(0.25f, 0.5f, (float)Math.Cos(-Main.GlobalTime * 3f) * 0.5f + 0.5f); fadeToEnd *= 1f - Utils.InverseLerp(0.35f, 0f, completionRatio, true); - Color endColor = Color.Lerp(Color.Cyan, Color.HotPink, projectile.identity % 2); - return Color.Lerp(Color.White, endColor, fadeToEnd) * projectile.Opacity * 0.7f; + Color endColor = Color.Lerp(Color.Cyan, Color.HotPink, Projectile.identity % 2); + return Color.Lerp(Color.White, endColor, fadeToEnd) * Projectile.Opacity * 0.7f; } internal float WidthFunction(float completionRatio) { float expansionCompletion = 1f - (float)Math.Pow(1f - Utils.InverseLerp(0f, 0.2f, completionRatio, true), 2D); - return MathHelper.Lerp(0f, 22f, expansionCompletion) * projectile.Opacity; + return MathHelper.Lerp(0f, 22f, expansionCompletion) * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -74,19 +74,19 @@ namespace CalamityMod.Projectiles.Magic if (TrailDrawer is null) TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, PrimitiveTrail.RigidPointRetreivalFunction, GameShaders.Misc["CalamityMod:TrailStreak"]); - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/FabstaffStreak")); - TrailDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f - Main.screenPosition, 80, projectile.oldRot); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/FabstaffStreak")); + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 80, Projectile.oldRot); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (!FadingOut && projectile.penetrate < 2) + if (!FadingOut && Projectile.penetrate < 2) { FadingOut = true; - projectile.velocity *= 0.1f; - projectile.extraUpdates = 0; - projectile.netUpdate = true; + Projectile.velocity *= 0.1f; + Projectile.extraUpdates = 0; + Projectile.netUpdate = true; } } @@ -95,9 +95,9 @@ namespace CalamityMod.Projectiles.Magic if (!FadingOut) { FadingOut = true; - projectile.velocity *= 0.1f; - projectile.extraUpdates = 0; - projectile.netUpdate = true; + Projectile.velocity *= 0.1f; + Projectile.extraUpdates = 0; + Projectile.netUpdate = true; } return false; } diff --git a/Projectiles/Magic/FabRay.cs b/Projectiles/Magic/FabRay.cs index 7ce0648c04..0cb607b938 100644 --- a/Projectiles/Magic/FabRay.cs +++ b/Projectiles/Magic/FabRay.cs @@ -15,60 +15,60 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Ray"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 54; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 54; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 70; - projectile.extraUpdates = 3; - projectile.timeLeft = 60 * projectile.extraUpdates; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 70; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 60 * Projectile.extraUpdates; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.2f, 0.01f, 0.1f); - projectile.ai[0] += 1f; - projectile.Opacity = Utils.InverseLerp(0f, 10f * projectile.MaxUpdates, projectile.timeLeft, true); + Lighting.AddLight(Projectile.Center, 0.2f, 0.01f, 0.1f); + Projectile.ai[0] += 1f; + Projectile.Opacity = Utils.InverseLerp(0f, 10f * Projectile.MaxUpdates, Projectile.timeLeft, true); - int shootRate = projectile.npcProj ? 40 : 12; - if (projectile.owner == Main.myPlayer && projectile.ai[0] % shootRate == 0f) + int shootRate = Projectile.npcProj ? 40 : 12; + if (Projectile.owner == Main.myPlayer && Projectile.ai[0] % shootRate == 0f) { - NPC potentialTarget = projectile.Center.ClosestNPCAt(180f, false); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(180f, false); if (potentialTarget != null) { - Vector2 shootVelocity = projectile.SafeDirectionTo(potentialTarget.Center) * 13f; - Projectile.NewProjectile(projectile.Center - shootVelocity * 2.5f, shootVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Vector2 shootVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 13f; + Projectile.NewProjectile(Projectile.Center - shootVelocity * 2.5f, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } - for (int i = 0; i < projectile.oldPos.Length / 4; i += 3) + for (int i = 0; i < Projectile.oldPos.Length / 4; i += 3) { - potentialTarget = projectile.oldPos[i].ClosestNPCAt(280f, false); + potentialTarget = Projectile.oldPos[i].ClosestNPCAt(280f, false); if (potentialTarget != null) { - Vector2 shootVelocity = (potentialTarget.Center - projectile.oldPos[i]).SafeNormalize(Vector2.UnitY) * 13f; - Projectile.NewProjectile(projectile.oldPos[i] - shootVelocity * 2.5f, shootVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Vector2 shootVelocity = (potentialTarget.Center - Projectile.oldPos[i]).SafeNormalize(Vector2.UnitY) * 13f; + Projectile.NewProjectile(Projectile.oldPos[i] - shootVelocity * 2.5f, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); break; } } } // Emit light. - Lighting.AddLight(projectile.Center, Vector3.One * projectile.Opacity * 0.7f); + Lighting.AddLight(Projectile.Center, Vector3.One * Projectile.Opacity * 0.7f); } internal Color ColorFunction(float completionRatio) { float fadeToEnd = MathHelper.Lerp(0.65f, 1f, (float)Math.Cos(-Main.GlobalTime * 3f) * 0.5f + 0.5f); - float fadeOpacity = Utils.InverseLerp(1f, 0.64f, completionRatio, true) * projectile.Opacity; + float fadeOpacity = Utils.InverseLerp(1f, 0.64f, completionRatio, true) * Projectile.Opacity; Color endColor = Color.Lerp(Color.Cyan, Color.HotPink, (float)Math.Sin(completionRatio * MathHelper.Pi * 1.6f - Main.GlobalTime * 4f) * 0.5f + 0.5f); return Color.Lerp(Color.White, endColor, fadeToEnd) * fadeOpacity; } @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Magic internal float WidthFunction(float completionRatio) { float expansionCompletion = 1f - (float)Math.Pow(1f - Utils.InverseLerp(0f, 0.3f, completionRatio, true), 2D); - return MathHelper.Lerp(0f, 32f * projectile.Opacity, expansionCompletion); + return MathHelper.Lerp(0f, 32f * Projectile.Opacity, expansionCompletion); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -84,27 +84,27 @@ namespace CalamityMod.Projectiles.Magic if (TrailDrawer is null) TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/ScarletDevilStreak")); - TrailDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f - Main.screenPosition, 32); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/ScarletDevilStreak")); + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 32); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; diff --git a/Projectiles/Magic/FatesRevealFlame.cs b/Projectiles/Magic/FatesRevealFlame.cs index 99c3278896..9ce2452df2 100644 --- a/Projectiles/Magic/FatesRevealFlame.cs +++ b/Projectiles/Magic/FatesRevealFlame.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -10,19 +11,19 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Fate's Reveal"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 180; - projectile.magic = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Magic; } public override void AI() @@ -30,129 +31,129 @@ namespace CalamityMod.Projectiles.Magic float num949 = 10f; float scaleFactor11 = 15f; float num950 = 160f; - if (projectile.timeLeft > 30 && projectile.alpha > 0) + if (Projectile.timeLeft > 30 && Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (Projectile.timeLeft > 30 && Projectile.alpha < 128 && Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.alpha = 128; + Projectile.alpha = 128; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - int num3 = projectile.frameCounter + 1; - projectile.frameCounter = num3; + int num3 = Projectile.frameCounter + 1; + Projectile.frameCounter = num3; if (num3 > 4) { - projectile.frameCounter = 0; - num3 = projectile.frame + 1; - projectile.frame = num3; + Projectile.frameCounter = 0; + num3 = Projectile.frame + 1; + Projectile.frame = num3; if (num3 >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } } float num951 = 0.5f; - if (projectile.timeLeft < 120) + if (Projectile.timeLeft < 120) { num951 = 1.1f; } - if (projectile.timeLeft < 60) + if (Projectile.timeLeft < 60) { num951 = 1.6f; } - float[] var_2_2A211_cp_0 = projectile.ai; + float[] var_2_2A211_cp_0 = Projectile.ai; int var_2_2A211_cp_1 = 1; float num73 = var_2_2A211_cp_0[var_2_2A211_cp_1]; var_2_2A211_cp_0[var_2_2A211_cp_1] = num73 + 1f; - float num952 = projectile.ai[1] / 180f * 6.28318548f; + float num952 = Projectile.ai[1] / 180f * 6.28318548f; for (float num953 = 0f; num953 < 3f; num953 = num73 + 1f) { if (Main.rand.Next(3) != 0) { return; } - Dust dust13 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 60, 0f, -2f, 0, default, 1f)]; - dust13.position = projectile.Center + Vector2.UnitY.RotatedBy((double)(num953 * 6.28318548f / 3f + projectile.ai[1]), default) * 10f; + Dust dust13 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, -2f, 0, default, 1f)]; + dust13.position = Projectile.Center + Vector2.UnitY.RotatedBy((double)(num953 * 6.28318548f / 3f + Projectile.ai[1]), default) * 10f; dust13.noGravity = true; - dust13.velocity = projectile.DirectionFrom(dust13.position); + dust13.velocity = Projectile.DirectionFrom(dust13.position); dust13.scale = num951; dust13.fadeIn = 0.5f; dust13.alpha = 200; num73 = num953; } - if (projectile.timeLeft < 4) + if (Projectile.timeLeft < 4) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 180; - projectile.Center = projectile.position; + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 180; + Projectile.Center = Projectile.position; // Ozzatron 15FEB2021 -- What the actual fuck is this // projectile.damage = 800; for (int num955 = 0; num955 < 10; num955 = num3 + 1) { - Dust dust13 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, 0f, -2f, 0, default, 1f)]; + Dust dust13 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 60, 0f, -2f, 0, default, 1f)]; dust13.noGravity = true; - if (dust13.position != projectile.Center) - dust13.velocity = projectile.SafeDirectionTo(dust13.position) * 3f; + if (dust13.position != Projectile.Center) + dust13.velocity = Projectile.SafeDirectionTo(dust13.position) * 3f; num3 = num955; } } - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (projectile.Distance(Main.player[projectile.owner].Center) > num950) + if (Projectile.Distance(Main.player[Projectile.owner].Center) > num950) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (num949 - 1f) + moveDirection * scaleFactor11) / num949; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (num949 - 1f) + moveDirection * scaleFactor11) / num949; } } else { - if (projectile.timeLeft > 30) + if (Projectile.timeLeft > 30) { - projectile.timeLeft = 30; + Projectile.timeLeft = 30; } } } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 30) + if (Projectile.timeLeft < 30) { - float num4 = (float)projectile.timeLeft / 30f; - projectile.alpha = (int)(255f - 255f * num4); + float num4 = (float)Projectile.timeLeft / 30f; + Projectile.alpha = (int)(255f - 255f * num4); } - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 128 - projectile.alpha / 2); + return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 128 - Projectile.alpha / 2); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - projectile.position = projectile.Center; - projectile.width = projectile.height = 84; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 84; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Damage(); // Dust code int num3; for (int num122 = 0; num122 < 3; num122 = num3 + 1) { - int num123 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num123].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num123 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[num123].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; num3 = num122; } for (int num124 = 0; num124 < 10; num124 = num3 + 1) { - int num125 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.5f); - Main.dust[num125].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num125 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.5f); + Main.dust[num125].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[num125].noGravity = true; Dust dust = Main.dust[num125]; dust.velocity *= 2f; @@ -160,8 +161,8 @@ namespace CalamityMod.Projectiles.Magic } for (int num126 = 0; num126 < 5; num126 = num3 + 1) { - int num127 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 1.5f); - Main.dust[num127].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + int num127 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 1.5f); + Main.dust[num127].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; Main.dust[num127].noGravity = true; Dust dust = Main.dust[num127]; dust.velocity *= 2f; diff --git a/Projectiles/Magic/FlameBeamTip.cs b/Projectiles/Magic/FlameBeamTip.cs index f003046649..1479a63e19 100644 --- a/Projectiles/Magic/FlameBeamTip.cs +++ b/Projectiles/Magic/FlameBeamTip.cs @@ -13,61 +13,61 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; + Projectile.width = 32; + Projectile.height = 32; + Projectile.aiStyle = 4; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; } public override bool PreAI() { - if (projectile.ai[0] != 0f) - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) - projectile.alpha += 5; + if (Projectile.ai[0] != 0f) + if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170) + Projectile.alpha += 5; return true; } public override void AI() { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.alpha -= 50; - if (projectile.alpha <= 0) + Projectile.alpha -= 50; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) + Projectile.alpha = 0; + Projectile.ai[0] = 1f; + if (Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity; + Projectile.ai[1] += 1f; + Projectile.position += Projectile.velocity; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - int num48 = projectile.type; - if (projectile.ai[1] >= (float)(15 + Main.rand.Next(3))) + int num48 = Projectile.type; + if (Projectile.ai[1] >= (float)(15 + Main.rand.Next(3))) { num48 = ModContent.ProjectileType(); } - int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), - projectile.velocity.X, projectile.velocity.Y, num48, projectile.damage, projectile.knockBack, projectile.owner, 0f, projectile.ai[1] + 1f); + int number = Projectile.NewProjectile(Projectile.position.X + Projectile.velocity.X + (float)(Projectile.width / 2), Projectile.position.Y + Projectile.velocity.Y + (float)(Projectile.height / 2), + Projectile.velocity.X, Projectile.velocity.Y, num48, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, Projectile.ai[1] + 1f); NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); } } } else { - if (projectile.alpha == 150) + if (Projectile.alpha == 150) { for (int num55 = 0; num55 < 10; num55++) { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, projectile.velocity.X * 0.01f, projectile.velocity.Y * 0.01f, 200, default, 2f); + int num56 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 60, Projectile.velocity.X * 0.01f, Projectile.velocity.Y * 0.01f, 200, default, 2f); Main.dust[num56].noGravity = true; } } @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; + target.immune[Projectile.owner] = 8; target.AddBuff(BuffID.OnFire, 240); } } diff --git a/Projectiles/Magic/FlameBeamTip2.cs b/Projectiles/Magic/FlameBeamTip2.cs index 8808772fdb..27fc2fed5f 100644 --- a/Projectiles/Magic/FlameBeamTip2.cs +++ b/Projectiles/Magic/FlameBeamTip2.cs @@ -13,48 +13,48 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = projectile.height = 40; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; + Projectile.width = Projectile.height = 40; + Projectile.aiStyle = 4; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; } public override bool PreAI() { - if (projectile.ai[0] != 0f) - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) - projectile.alpha += 5; + if (Projectile.ai[0] != 0f) + if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170) + Projectile.alpha += 5; return true; } public override void AI() { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.alpha -= 50; - if (projectile.alpha <= 0) + Projectile.alpha -= 50; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) + Projectile.alpha = 0; + Projectile.ai[0] = 1f; + if (Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity; + Projectile.ai[1] += 1f; + Projectile.position += Projectile.velocity; } } } else { - if (projectile.alpha == 150) + if (Projectile.alpha == 150) { for (int num55 = 0; num55 < 10; num55++) { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, projectile.velocity.X * 0.01f, projectile.velocity.Y * 0.01f, 200, default, 2f); + int num56 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 60, Projectile.velocity.X * 0.01f, Projectile.velocity.Y * 0.01f, 200, default, 2f); Main.dust[num56].noGravity = true; } } @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; + target.immune[Projectile.owner] = 8; target.AddBuff(BuffID.OnFire, 240); } } diff --git a/Projectiles/Magic/FlamingPumpkin.cs b/Projectiles/Magic/FlamingPumpkin.cs index 78525817b4..7123196e4e 100644 --- a/Projectiles/Magic/FlamingPumpkin.cs +++ b/Projectiles/Magic/FlamingPumpkin.cs @@ -11,20 +11,20 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 14; - projectile.penetrate = 2; - projectile.timeLeft = 200; - projectile.magic = true; - projectile.friendly = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 14; + Projectile.penetrate = 2; + Projectile.timeLeft = 200; + Projectile.DamageType = DamageClass.Magic; + Projectile.friendly = true; } public override void AI() { if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 64, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 64, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/FlareBoltProjectile.cs b/Projectiles/Magic/FlareBoltProjectile.cs index ed064ca210..b9fe3fa652 100644 --- a/Projectiles/Magic/FlareBoltProjectile.cs +++ b/Projectiles/Magic/FlareBoltProjectile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -11,87 +12,87 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Flare Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 4; - projectile.timeLeft = 480; - projectile.magic = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 4; + Projectile.timeLeft = 480; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.45f / 255f, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.1f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.45f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.1f / 255f); for (int num92 = 0; num92 < 2; num92++) { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; + float num93 = Projectile.velocity.X / 3f * (float)num92; + float num94 = Projectile.velocity.Y / 3f * (float)num92; int num95 = 4; - int fireDust = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 174, 0f, 0f, 100, default, 1.2f); + int fireDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)num95, Projectile.position.Y + (float)num95), Projectile.width - num95 * 2, Projectile.height - num95 * 2, 174, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[fireDust]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.1f; + dust.velocity += Projectile.velocity * 0.1f; dust.position.X -= num93; dust.position.Y -= num94; } if (Main.rand.NextBool(10)) { int num97 = 4; - int fireDustSmol = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 174, 0f, 0f, 100, default, 0.6f); + int fireDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)num97, Projectile.position.Y + (float)num97), Projectile.width - num97 * 2, Projectile.height - num97 * 2, 174, 0f, 0f, 100, default, 0.6f); Main.dust[fireDustSmol].velocity *= 0.25f; - Main.dust[fireDustSmol].velocity += projectile.velocity * 0.5f; + Main.dust[fireDustSmol].velocity += Projectile.velocity * 0.5f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); } return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Magic/ForbiddenAxeBlade.cs b/Projectiles/Magic/ForbiddenAxeBlade.cs index 9c2b92b5d4..c775f5d170 100644 --- a/Projectiles/Magic/ForbiddenAxeBlade.cs +++ b/Projectiles/Magic/ForbiddenAxeBlade.cs @@ -11,44 +11,44 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.magic = true; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.alpha -= 3; - projectile.rotation += 0.75f; + Projectile.alpha -= 3; + Projectile.rotation += 0.75f; - projectile.ai[1] += 1f; - if (projectile.ai[1] <= 20f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] <= 20f) { - projectile.velocity *= 0.85f; + Projectile.velocity *= 0.85f; } - else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) + else if (Projectile.ai[1] > 20f && Projectile.ai[1] <= 39f) { - projectile.velocity *= 1.25f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 10f, 20f); + Projectile.velocity *= 1.25f; + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 10f, 20f); } - else if (projectile.ai[1] == 40f) + else if (Projectile.ai[1] == 40f) { - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; } if (Main.rand.NextBool(8)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } } @@ -56,13 +56,13 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/ForbiddenSunProjectile.cs b/Projectiles/Magic/ForbiddenSunProjectile.cs index 06a22127a9..fc8a3da7e8 100644 --- a/Projectiles/Magic/ForbiddenSunProjectile.cs +++ b/Projectiles/Magic/ForbiddenSunProjectile.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -11,43 +12,43 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Sun"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.magic = true; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation(); - if (projectile.frameCounter++ % 4 == 0) + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.frameCounter++ % 4 == 0) { - projectile.frame++; + Projectile.frame++; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.01f / 255f); - if (projectile.wet && !projectile.lavaWet) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + if (Projectile.wet && !Projectile.lavaWet) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.localAI[0] += 1f; } if (Main.rand.NextBool(4)) { - int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f); + int num469 = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -55,9 +56,9 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } diff --git a/Projectiles/Magic/ForbiddenSunburst.cs b/Projectiles/Magic/ForbiddenSunburst.cs index a982f19b32..ef810dd9f9 100644 --- a/Projectiles/Magic/ForbiddenSunburst.cs +++ b/Projectiles/Magic/ForbiddenSunburst.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -19,40 +20,40 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 220; - projectile.height = 220; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 150; - projectile.magic = true; + Projectile.width = 220; + Projectile.height = 220; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 150; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.75f, 0.5f, 0f); - if (projectile.wet && !projectile.lavaWet) + Lighting.AddLight(Projectile.Center, 0.75f, 0.5f, 0f); + if (Projectile.wet && !Projectile.lavaWet) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.localAI[0] += 1f; } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -63,11 +64,11 @@ namespace CalamityMod.Projectiles.Magic num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 2.5f); + int num467 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 2.5f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; @@ -78,10 +79,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; + target.immune[Projectile.owner] = 8; target.AddBuff(BuffID.OnFire, 300); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, ExplosionRadius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); } } diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index 73abdf7ca3..d6b40410dc 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -11,108 +12,108 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Frigidflash Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 5; - projectile.timeLeft = 480; - projectile.magic = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 5; + Projectile.timeLeft = 480; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); for (int num92 = 0; num92 < 2; num92++) { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; + float num93 = Projectile.velocity.X / 3f * (float)num92; + float num94 = Projectile.velocity.Y / 3f * (float)num92; int num95 = 4; - int fireDust = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 174, 0f, 0f, 100, default, 1.2f); + int fireDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)num95, Projectile.position.Y + (float)num95), Projectile.width - num95 * 2, Projectile.height - num95 * 2, 174, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[fireDust]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.1f; + dust.velocity += Projectile.velocity * 0.1f; dust.position.X -= num93; dust.position.Y -= num94; } if (Main.rand.NextBool(10)) { int num97 = 4; - int fireDustSmol = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 174, 0f, 0f, 100, default, 0.6f); + int fireDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)num97, Projectile.position.Y + (float)num97), Projectile.width - num97 * 2, Projectile.height - num97 * 2, 174, 0f, 0f, 100, default, 0.6f); Main.dust[fireDustSmol].velocity *= 0.25f; - Main.dust[fireDustSmol].velocity += projectile.velocity * 0.5f; + Main.dust[fireDustSmol].velocity += Projectile.velocity * 0.5f; } for (int num105 = 0; num105 < 2; num105++) { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; + float num99 = Projectile.velocity.X / 3f * (float)num105; + float num100 = Projectile.velocity.Y / 3f * (float)num105; int num101 = 4; - int frostDust = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); + int frostDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)num101, Projectile.position.Y + (float)num101), Projectile.width - num101 * 2, Projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[frostDust]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.1f; + dust.velocity += Projectile.velocity * 0.1f; dust.position.X -= num99; dust.position.Y -= num100; } if (Main.rand.NextBool(10)) { int num103 = 4; - int frostDustSmol = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); + int frostDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)num103, Projectile.position.Y + (float)num103), Projectile.width - num103 * 2, Projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); Main.dust[frostDustSmol].velocity *= 0.25f; - Main.dust[frostDustSmol].velocity += projectile.velocity * 0.5f; + Main.dust[frostDustSmol].velocity += Projectile.velocity * 0.5f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); } return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Magic/FrostBoltProjectile.cs b/Projectiles/Magic/FrostBoltProjectile.cs index 0466976a67..162f2c3bc1 100644 --- a/Projectiles/Magic/FrostBoltProjectile.cs +++ b/Projectiles/Magic/FrostBoltProjectile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -11,88 +12,88 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Ball"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 2; - projectile.timeLeft = 480; - projectile.magic = true; - projectile.coldDamage = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 2; + Projectile.timeLeft = 480; + Projectile.DamageType = DamageClass.Magic; + Projectile.coldDamage = true; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.3f / 255f, (255 - projectile.alpha) * 0.45f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.01f / 255f, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.45f / 255f); for (int num105 = 0; num105 < 2; num105++) { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; + float num99 = Projectile.velocity.X / 3f * (float)num105; + float num100 = Projectile.velocity.Y / 3f * (float)num105; int num101 = 4; - int frostDust = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); + int frostDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)num101, Projectile.position.Y + (float)num101), Projectile.width - num101 * 2, Projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[frostDust]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.1f; + dust.velocity += Projectile.velocity * 0.1f; dust.position.X -= num99; dust.position.Y -= num100; } if (Main.rand.NextBool(10)) { int num103 = 4; - int frostDustSmol = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); + int frostDustSmol = Dust.NewDust(new Vector2(Projectile.position.X + (float)num103, Projectile.position.Y + (float)num103), Projectile.width - num103 * 2, Projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); Main.dust[frostDustSmol].velocity *= 0.25f; - Main.dust[frostDustSmol].velocity += projectile.velocity * 0.5f; + Main.dust[frostDustSmol].velocity += Projectile.velocity * 0.5f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); } return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Magic/GammaLaser.cs b/Projectiles/Magic/GammaLaser.cs index 10bf0d52d9..b15e3a22ee 100644 --- a/Projectiles/Magic/GammaLaser.cs +++ b/Projectiles/Magic/GammaLaser.cs @@ -12,38 +12,38 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Laser"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 150; - projectile.magic = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 150; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.1f, 0.35f, 0f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + Lighting.AddLight(Projectile.Center, 0.1f, 0.35f, 0f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; if (Main.rand.NextBool(7)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 74, 0f, 0f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 1; + target.immune[Projectile.owner] = 1; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/GhastlyBlast.cs b/Projectiles/Magic/GhastlyBlast.cs index a2cd42e9b5..84621a0508 100644 --- a/Projectiles/Magic/GhastlyBlast.cs +++ b/Projectiles/Magic/GhastlyBlast.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -16,42 +17,42 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Ghast Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 6; - projectile.extraUpdates = 2; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 12; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 6; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; } public override void AI() { - projectile.ai[0] += 1f; - bool goingSlow = projectile.velocity.Length() <= DriftVelocity; - bool currentlyHoming = projectile.ai[1] > 0f; + Projectile.ai[0] += 1f; + bool goingSlow = Projectile.velocity.Length() <= DriftVelocity; + bool currentlyHoming = Projectile.ai[1] > 0f; // Rapidly fade in when the projectile starts existing - projectile.alpha -= 15; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 15; + if (Projectile.alpha < 0) + Projectile.alpha = 0; // Moving faster than drift velocity, but not homing. // This way, when the projectile speeds back up upon homing, it doesn't suddenly lose its homing again. if (!goingSlow && !currentlyHoming) { // Spin at a certain rate - projectile.rotation -= 0.104719758f; + Projectile.rotation -= 0.104719758f; // Dust, randomly if (Main.rand.NextBool(3)) @@ -59,9 +60,9 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(2)) { Vector2 vector140 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust28 = Main.dust[Dust.NewDust(projectile.Center - vector140 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + Dust dust28 = Main.dust[Dust.NewDust(Projectile.Center - vector140 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; dust28.noGravity = true; - dust28.position = projectile.Center - vector140 * Main.rand.Next(10, 21); + dust28.position = Projectile.Center - vector140 * Main.rand.Next(10, 21); dust28.velocity = vector140.RotatedBy(MathHelper.PiOver2) * 6f; dust28.scale = 0.5f + Main.rand.NextFloat(); dust28.fadeIn = 0.5f; @@ -70,9 +71,9 @@ namespace CalamityMod.Projectiles.Magic else { Vector2 vector141 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust29 = Main.dust[Dust.NewDust(projectile.Center - vector141 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + Dust dust29 = Main.dust[Dust.NewDust(Projectile.Center - vector141 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; dust29.noGravity = true; - dust29.position = projectile.Center - vector141 * 30f; + dust29.position = Projectile.Center - vector141 * 30f; dust29.velocity = vector141.RotatedBy(-MathHelper.PiOver2) * 3f; dust29.scale = 0.5f + Main.rand.NextFloat(); dust29.fadeIn = 0.5f; @@ -81,23 +82,23 @@ namespace CalamityMod.Projectiles.Magic } // Grow and slow down - if (projectile.ai[0] >= FramesBeforeSlowing * projectile.MaxUpdates) + if (Projectile.ai[0] >= FramesBeforeSlowing * Projectile.MaxUpdates) { - projectile.velocity *= 0.977f; - projectile.scale += 0.00744680827f; - if (projectile.scale > 1.2f) + Projectile.velocity *= 0.977f; + Projectile.scale += 0.00744680827f; + if (Projectile.scale > 1.2f) { - projectile.scale = 1.2f; + Projectile.scale = 1.2f; } - projectile.rotation -= 0.0174532924f; + Projectile.rotation -= 0.0174532924f; } // Set velocity to the drift velocity exactly after slowing down enough and reset the time counter. - float speed = projectile.velocity.Length(); + float speed = Projectile.velocity.Length(); if (speed < 1.02f * DriftVelocity) { - projectile.velocity *= DriftVelocity / speed; - projectile.ai[0] = 0f; + Projectile.velocity *= DriftVelocity / speed; + Projectile.ai[0] = 0f; } } @@ -105,7 +106,7 @@ namespace CalamityMod.Projectiles.Magic else { // Spin at the exact same rate anyway - projectile.rotation -= 0.104719758f; + Projectile.rotation -= 0.104719758f; // Excessively complicated dust int num3; @@ -114,16 +115,16 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(2)) { Vector2 vector142 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust30 = Main.dust[Dust.NewDust(projectile.Center - vector142 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + Dust dust30 = Main.dust[Dust.NewDust(Projectile.Center - vector142 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; dust30.noGravity = true; - dust30.position = projectile.Center - vector142 * Main.rand.Next(10, 21); + dust30.position = Projectile.Center - vector142 * Main.rand.Next(10, 21); dust30.velocity = vector142.RotatedBy(MathHelper.PiOver2) * 6f; dust30.scale = 0.9f + Main.rand.NextFloat(); dust30.fadeIn = 0.5f; dust30.customData = projectile; vector142 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); dust30.noGravity = true; - dust30.position = projectile.Center - vector142 * Main.rand.Next(10, 21); + dust30.position = Projectile.Center - vector142 * Main.rand.Next(10, 21); dust30.velocity = vector142.RotatedBy(MathHelper.PiOver2) * 6f; dust30.scale = 0.9f + Main.rand.NextFloat(); dust30.fadeIn = 0.5f; @@ -133,9 +134,9 @@ namespace CalamityMod.Projectiles.Magic else { Vector2 vector143 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust dust31 = Main.dust[Dust.NewDust(projectile.Center - vector143 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; + Dust dust31 = Main.dust[Dust.NewDust(Projectile.Center - vector143 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; dust31.noGravity = true; - dust31.position = projectile.Center - vector143 * Main.rand.Next(20, 31); + dust31.position = Projectile.Center - vector143 * Main.rand.Next(20, 31); dust31.velocity = vector143.RotatedBy(-MathHelper.PiOver2) * 5f; dust31.scale = 0.9f + Main.rand.NextFloat(); dust31.fadeIn = 0.5f; @@ -145,28 +146,28 @@ namespace CalamityMod.Projectiles.Magic } // Every so many frames, spawn a sub blast. - if (projectile.ai[0] % 30f == 0f && projectile.ai[0] < 241f && Main.myPlayer == projectile.owner) + if (Projectile.ai[0] % 30f == 0f && Projectile.ai[0] < 241f && Main.myPlayer == Projectile.owner) { Vector2 vector144 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 12f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector144.X, vector144.Y, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, projectile.whoAmI); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, vector144.X, vector144.Y, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, Projectile.whoAmI); } // Undocumented, unrefactored homing. Will not home through walls. // Apparently has two different homing distances. - Vector2 vector145 = projectile.Center; + Vector2 vector145 = Projectile.Center; float num1015 = 500f; bool flag59 = false; int num1016 = 0; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { for (int num1017 = 0; num1017 < Main.maxNPCs; num1017 = num3 + 1) { - if (Main.npc[num1017].CanBeChasedBy(projectile, false)) + if (Main.npc[num1017].CanBeChasedBy(Projectile, false)) { Vector2 center13 = Main.npc[num1017].Center; - if (projectile.Distance(center13) < num1015 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num1017].position, Main.npc[num1017].width, Main.npc[num1017].height)) + if (Projectile.Distance(center13) < num1015 && Collision.CanHit(new Vector2(Projectile.position.X + (float)(Projectile.width / 2), Projectile.position.Y + (float)(Projectile.height / 2)), 1, 1, Main.npc[num1017].position, Main.npc[num1017].width, Main.npc[num1017].height)) { - num1015 = projectile.Distance(center13); + num1015 = Projectile.Distance(center13); vector145 = center13; flag59 = true; num1016 = num1017; @@ -176,94 +177,94 @@ namespace CalamityMod.Projectiles.Magic } if (flag59) { - if (projectile.ai[1] != (float)(num1016 + 1)) + if (Projectile.ai[1] != (float)(num1016 + 1)) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.ai[1] = (float)(num1016 + 1); + Projectile.ai[1] = (float)(num1016 + 1); } flag59 = false; } - if (projectile.ai[1] != 0f) + if (Projectile.ai[1] != 0f) { - int num1018 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num1018].active && Main.npc[num1018].CanBeChasedBy(projectile, true) && projectile.Distance(Main.npc[num1018].Center) < 1000f) + int num1018 = (int)(Projectile.ai[1] - 1f); + if (Main.npc[num1018].active && Main.npc[num1018].CanBeChasedBy(Projectile, true) && Projectile.Distance(Main.npc[num1018].Center) < 1000f) { flag59 = true; vector145 = Main.npc[num1018].Center; } } - if (!projectile.friendly) + if (!Projectile.friendly) { flag59 = false; } - if (projectile.localAI[0] < 60f) + if (Projectile.localAI[0] < 60f) { - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (flag59 && projectile.localAI[0] >= 60f) + if (flag59 && Projectile.localAI[0] >= 60f) { float HomingVelocity = 24f; int HomingN = 8; - Vector2 vector146 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector146 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float dx = vector145.X - vector146.X; float dy = vector145.Y - vector146.Y; float dist = (float)Math.Sqrt((double)(dx * dx + dy * dy)); dist = HomingVelocity / dist; dx *= dist; dy *= dist; - projectile.velocity.X = (projectile.velocity.X * (float)(HomingN - 1) + dx) / (float)HomingN; - projectile.velocity.Y = (projectile.velocity.Y * (float)(HomingN - 1) + dy) / (float)HomingN; + Projectile.velocity.X = (Projectile.velocity.X * (float)(HomingN - 1) + dx) / (float)HomingN; + Projectile.velocity.Y = (Projectile.velocity.Y * (float)(HomingN - 1) + dy) / (float)HomingN; } } // If the projectile is solid enough, add light. - if (projectile.alpha < 150) + if (Projectile.alpha < 150) { - Lighting.AddLight(projectile.Center, 0.9f, 0f, 0.1f); + Lighting.AddLight(Projectile.Center, 0.9f, 0f, 0.1f); } - if (projectile.ai[0] >= MaximumWaitFrames * projectile.MaxUpdates) + if (Projectile.ai[0] >= MaximumWaitFrames * Projectile.MaxUpdates) { - projectile.Kill(); + Projectile.Kill(); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha); + return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha); } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 238; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 238; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num95 = 0; num95 < 4; num95++) { - int num96 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num96].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + int num96 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[num96].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; } for (int num97 = 0; num97 < 30; num97++) { - int num98 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 200, default, 3.7f); + int num98 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 200, default, 3.7f); Dust dust = Main.dust[num98]; - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; - num98 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + num98 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; dust.velocity *= 2f; dust.noGravity = true; dust.fadeIn = 1f; @@ -271,25 +272,25 @@ namespace CalamityMod.Projectiles.Magic } for (int num99 = 0; num99 < 10; num99++) { - int num100 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.7f); + int num100 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.7f); Dust dust = Main.dust[num100]; - dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; } for (int num101 = 0; num101 < 10; num101++) { - int num102 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 1.5f); + int num102 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 1.5f); Dust dust = Main.dust[num102]; - dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { for (int num105 = 0; num105 < Main.maxProjectiles; num105++) { - if (Main.projectile[num105].active && Main.projectile[num105].type == ModContent.ProjectileType() && Main.projectile[num105].ai[1] == projectile.whoAmI) + if (Main.projectile[num105].active && Main.projectile[num105].type == ModContent.ProjectileType() && Main.projectile[num105].ai[1] == Projectile.whoAmI) { Main.projectile[num105].Kill(); } @@ -304,7 +305,7 @@ namespace CalamityMod.Projectiles.Magic int num109 = (num108 == 60) ? 180 : 60; for (int num110 = 0; num110 < num106; num110++) { - Vector2 vector4 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); + Vector2 vector4 = Projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); Vector2 vector5 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); while (vector5.X == 0f && vector5.Y == 0f) { @@ -316,11 +317,11 @@ namespace CalamityMod.Projectiles.Magic vector5.Y *= -1f; } vector5 *= Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(vector4.X, vector4.Y, vector5.X, vector5.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, num108, 0f); + Projectile.NewProjectile(vector4.X, vector4.Y, vector5.X, vector5.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.8f, Projectile.owner, num108, 0f); } for (int num111 = 0; num111 < num107; num111++) { - Vector2 vector6 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); + Vector2 vector6 = Projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); Vector2 vector7 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); while (vector7.X == 0f && vector7.Y == 0f) { @@ -332,7 +333,7 @@ namespace CalamityMod.Projectiles.Magic vector7.Y *= -1f; } vector7 *= Main.rand.Next(40, 81) * 0.1f; - Projectile.NewProjectile(vector6.X, vector6.Y, vector7.X, vector7.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, num109, 0f); + Projectile.NewProjectile(vector6.X, vector6.Y, vector7.X, vector7.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.8f, Projectile.owner, num109, 0f); } } } diff --git a/Projectiles/Magic/GhastlyExplosion.cs b/Projectiles/Magic/GhastlyExplosion.cs index 239b20c747..ee544b1935 100644 --- a/Projectiles/Magic/GhastlyExplosion.cs +++ b/Projectiles/Magic/GhastlyExplosion.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -16,22 +17,22 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.magic = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { int num3; - int num328 = (int)projectile.ai[0]; + int num328 = (int)Projectile.ai[0]; for (int num329 = 0; num329 < 3; num329 = num3 + 1) { - int num330 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, num328, default, 1.2f); - Main.dust[num330].position = (Main.dust[num330].position + projectile.Center) / 2f; + int num330 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, Projectile.velocity.X, Projectile.velocity.Y, num328, default, 1.2f); + Main.dust[num330].position = (Main.dust[num330].position + Projectile.Center) / 2f; Main.dust[num330].noGravity = true; Dust dust = Main.dust[num330]; dust.velocity *= 0.5f; @@ -39,14 +40,14 @@ namespace CalamityMod.Projectiles.Magic } for (int num331 = 0; num331 < 2; num331 = num3 + 1) { - int num330 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, num328, default, 0.4f); + int num330 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, Projectile.velocity.X, Projectile.velocity.Y, num328, default, 0.4f); if (num331 == 0) { - Main.dust[num330].position = (Main.dust[num330].position + projectile.Center * 5f) / 6f; + Main.dust[num330].position = (Main.dust[num330].position + Projectile.Center * 5f) / 6f; } else if (num331 == 1) { - Main.dust[num330].position = (Main.dust[num330].position + (projectile.Center + projectile.velocity / 2f) * 5f) / 6f; + Main.dust[num330].position = (Main.dust[num330].position + (Projectile.Center + Projectile.velocity / 2f) * 5f) / 6f; } Dust dust = Main.dust[num330]; dust.velocity *= 0.1f; @@ -59,21 +60,21 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item50, projectile.position); + SoundEngine.PlaySound(SoundID.Item50, Projectile.position); int num3; for (int num116 = 0; num116 < 20; num116 = num3 + 1) { - int num117 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 0.5f); + int num117 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 0.5f); Dust dust; Main.dust[num117].scale = 1.2f + (float)Main.rand.Next(-10, 11) * 0.01f; Main.dust[num117].noGravity = true; dust = Main.dust[num117]; dust.velocity *= 2.5f; dust = Main.dust[num117]; - dust.velocity -= projectile.oldVelocity / 10f; + dust.velocity -= Projectile.oldVelocity / 10f; num3 = num116; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { int num118 = 3; for (int num119 = 0; num119 < num118; num119 = num3 + 1) @@ -85,7 +86,7 @@ namespace CalamityMod.Projectiles.Magic } vector8.Normalize(); vector8 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), vector8.X, vector8.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, projectile.ai[0], 0f); + Projectile.NewProjectile(Projectile.oldPosition.X + (float)(Projectile.width / 2), Projectile.oldPosition.Y + (float)(Projectile.height / 2), vector8.X, vector8.Y, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.8), Projectile.knockBack * 0.8f, Projectile.owner, Projectile.ai[0], 0f); num3 = num119; } } diff --git a/Projectiles/Magic/GhastlyExplosionShard.cs b/Projectiles/Magic/GhastlyExplosionShard.cs index cf17ff01bd..daac22cda7 100644 --- a/Projectiles/Magic/GhastlyExplosionShard.cs +++ b/Projectiles/Magic/GhastlyExplosionShard.cs @@ -14,37 +14,37 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.alpha = 255; - projectile.timeLeft = 80; - projectile.penetrate = 1; - projectile.magic = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.timeLeft = 80; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 50 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 50 && target.CanBeChasedBy(Projectile); public override void AI() { - int num332 = (int)projectile.ai[0]; + int num332 = (int)Projectile.ai[0]; - projectile.ai[1] += 1f; - float num333 = (120f - projectile.ai[1]) / 120f; - if (projectile.ai[1] > 80f) - projectile.Kill(); + Projectile.ai[1] += 1f; + float num333 = (120f - Projectile.ai[1]) / 120f; + if (Projectile.ai[1] > 80f) + Projectile.Kill(); - projectile.velocity.Y += 0.2f; - if (projectile.velocity.Y > 18f) - projectile.velocity.Y = 18f; + Projectile.velocity.Y += 0.2f; + if (Projectile.velocity.Y > 18f) + Projectile.velocity.Y = 18f; - projectile.velocity.X *= 0.98f; + Projectile.velocity.X *= 0.98f; int num3; for (int num334 = 0; num334 < 2; num334 = num3 + 1) { - int num335 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num332, projectile.velocity.X, projectile.velocity.Y, 50, default, 1.1f); - Main.dust[num335].position = (Main.dust[num335].position + projectile.Center) / 2f; + int num335 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num332, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 1.1f); + Main.dust[num335].position = (Main.dust[num335].position + Projectile.Center) / 2f; Main.dust[num335].noGravity = true; Dust dust = Main.dust[num335]; dust.velocity *= 0.3f; @@ -55,8 +55,8 @@ namespace CalamityMod.Projectiles.Magic for (int num336 = 0; num336 < 1; num336 = num3 + 1) { - int num335 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num332, projectile.velocity.X, projectile.velocity.Y, 50, default, 0.6f); - Main.dust[num335].position = (Main.dust[num335].position + projectile.Center * 5f) / 6f; + int num335 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num332, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); + Main.dust[num335].position = (Main.dust[num335].position + Projectile.Center * 5f) / 6f; Dust dust = Main.dust[num335]; dust.velocity *= 0.1f; Main.dust[num335].noGravity = true; @@ -66,8 +66,8 @@ namespace CalamityMod.Projectiles.Magic num3 = num336; } - if (projectile.timeLeft < 50) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); + if (Projectile.timeLeft < 50) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 20f); } public override void Kill(int timeLeft) @@ -75,14 +75,14 @@ namespace CalamityMod.Projectiles.Magic int num3; for (int num114 = 0; num114 < 10; num114 = num3 + 1) { - int num115 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 0.5f); + int num115 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 0.5f); Dust dust; Main.dust[num115].scale = 1f + Main.rand.Next(-10, 11) * 0.01f; Main.dust[num115].noGravity = true; dust = Main.dust[num115]; dust.velocity *= 1.25f; dust = Main.dust[num115]; - dust.velocity -= projectile.oldVelocity / 10f; + dust.velocity -= Projectile.oldVelocity / 10f; num3 = num114; } } diff --git a/Projectiles/Magic/GhastlySubBlast.cs b/Projectiles/Magic/GhastlySubBlast.cs index e2fdc64e54..32311f1bb9 100644 --- a/Projectiles/Magic/GhastlySubBlast.cs +++ b/Projectiles/Magic/GhastlySubBlast.cs @@ -13,98 +13,98 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 18; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 420; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.width = 18; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 420; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override void AI() { bool flag60 = false; bool flag61 = false; - int num3 = projectile.type; + int num3 = Projectile.type; int num1024 = ModContent.ProjectileType(); float num1025 = 420f; float x3 = 0.15f; float y3 = 0.15f; if (flag61) { - int num1026 = (int)projectile.ai[1]; + int num1026 = (int)Projectile.ai[1]; if (!Main.projectile[num1026].active || Main.projectile[num1026].type != num1024) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - projectile.ai[0] += 1f; - if (projectile.ai[0] < num1025) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] < num1025) { bool flag62 = true; - int num1027 = (int)projectile.ai[1]; + int num1027 = (int)Projectile.ai[1]; if (Main.projectile[num1027].active && Main.projectile[num1027].type == num1024) { if (!flag60 && Main.projectile[num1027].oldPos[1] != Vector2.Zero) { - projectile.position += Main.projectile[num1027].position - Main.projectile[num1027].oldPos[1]; + Projectile.position += Main.projectile[num1027].position - Main.projectile[num1027].oldPos[1]; } - if (projectile.Center.HasNaNs()) + if (Projectile.Center.HasNaNs()) { - projectile.Kill(); + Projectile.Kill(); return; } } else { - projectile.ai[0] = num1025; + Projectile.ai[0] = num1025; flag62 = false; - projectile.Kill(); + Projectile.Kill(); } if (flag62 && !flag60) { - projectile.velocity += new Vector2((float)Math.Sign(Main.projectile[num1027].Center.X - projectile.Center.X), (float)Math.Sign(Main.projectile[num1027].Center.Y - projectile.Center.Y)) * new Vector2(x3, y3); - if (projectile.velocity.Length() > 6f) + Projectile.velocity += new Vector2((float)Math.Sign(Main.projectile[num1027].Center.X - Projectile.Center.X), (float)Math.Sign(Main.projectile[num1027].Center.Y - Projectile.Center.Y)) * new Vector2(x3, y3); + if (Projectile.velocity.Length() > 6f) { - projectile.velocity *= 6f / projectile.velocity.Length(); + Projectile.velocity *= 6f / Projectile.velocity.Length(); } } if (Main.rand.NextBool(2)) { - int num1028 = Dust.NewDust(projectile.Center, 8, 8, 60, 0f, 0f, 0, default, 1f); - Main.dust[num1028].position = projectile.Center; - Main.dust[num1028].velocity = projectile.velocity; + int num1028 = Dust.NewDust(Projectile.Center, 8, 8, 60, 0f, 0f, 0, default, 1f); + Main.dust[num1028].position = Projectile.Center; + Main.dust[num1028].velocity = Projectile.velocity; Main.dust[num1028].noGravity = true; Main.dust[num1028].scale = 1.5f; if (flag62) { - Main.dust[num1028].customData = Main.projectile[(int)projectile.ai[1]]; + Main.dust[num1028].customData = Main.projectile[(int)Projectile.ai[1]]; } } - projectile.alpha = 255; + Projectile.alpha = 255; return; } } public override void Kill(int timeLeft) { - projectile.ai[0] = 60f; + Projectile.ai[0] = 60f; for (int num114 = 0; num114 < 10; num114++) { - int num115 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 0.5f); + int num115 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 0.5f); Dust dust; Main.dust[num115].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f; Main.dust[num115].noGravity = true; dust = Main.dust[num115]; dust.velocity *= 1.25f; dust = Main.dust[num115]; - dust.velocity -= projectile.oldVelocity / 10f; + dust.velocity -= Projectile.oldVelocity / 10f; } } } diff --git a/Projectiles/Magic/GhastlyVisageProj.cs b/Projectiles/Magic/GhastlyVisageProj.cs index e77337775a..52f9d7aee6 100644 --- a/Projectiles/Magic/GhastlyVisageProj.cs +++ b/Projectiles/Magic/GhastlyVisageProj.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -12,67 +13,67 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Ghastly Visage"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = 26; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.65f, 0f, 0.1f); - Player player = Main.player[projectile.owner]; + Lighting.AddLight(Projectile.Center, 0.65f, 0f, 0.1f); + Player player = Main.player[Projectile.owner]; float num = 0f; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { num = MathHelper.Pi; } - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num39 = 0; - if (projectile.ai[0] >= 240f) + if (Projectile.ai[0] >= 240f) { num39++; } - if (projectile.ai[0] >= 480f) + if (Projectile.ai[0] >= 480f) { num39++; } int num40 = 40; int num41 = 2; - projectile.ai[1] -= 1f; + Projectile.ai[1] -= 1f; bool flag15 = false; - if (projectile.ai[1] <= 0f) + if (Projectile.ai[1] <= 0f) { - projectile.ai[1] = (float)(num40 - num41 * num39); + Projectile.ai[1] = (float)(num40 - num41 * num39); flag15 = true; - int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); + int arg_1EF4_0 = (int)Projectile.ai[0] / (num40 - num41 * num39); } bool flag16 = player.channel && !player.noItems && !player.CCed; - if (projectile.localAI[0] > 0f) + if (Projectile.localAI[0] > 0f) { - projectile.localAI[0] -= 1f; + Projectile.localAI[0] -= 1f; } int manaCost = (int)(20f * player.manaCost); - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { if (player.statMana < manaCost) { @@ -86,12 +87,12 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.Kill(); + Projectile.Kill(); } } else { - projectile.Kill(); + Projectile.Kill(); } } else @@ -102,10 +103,10 @@ namespace CalamityMod.Projectiles.Magic player.manaRegenDelay = (int)player.maxRegenDelay; } } - projectile.localAI[1] += 1f; - Main.PlaySound(SoundID.Item117, projectile.position); + Projectile.localAI[1] += 1f; + SoundEngine.PlaySound(SoundID.Item117, Projectile.position); } - if (projectile.soundDelay <= 0 && flag16) + if (Projectile.soundDelay <= 0 && flag16) { if (player.statMana < manaCost) { @@ -119,12 +120,12 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.Kill(); + Projectile.Kill(); } } else { - projectile.Kill(); + Projectile.Kill(); } } else @@ -135,14 +136,14 @@ namespace CalamityMod.Projectiles.Magic player.manaRegenDelay = (int)player.maxRegenDelay; } } - projectile.soundDelay = num40 - num41 * num39; - if (projectile.ai[0] != 1f) + Projectile.soundDelay = num40 - num41 * num39; + if (Projectile.ai[0] != 1f) { - Main.PlaySound(SoundID.Item117, projectile.position); + SoundEngine.PlaySound(SoundID.Item117, Projectile.position); } - projectile.localAI[0] = 12f; + Projectile.localAI[0] = 12f; } - if (flag15 && Main.myPlayer == projectile.owner) + if (flag15 && Main.myPlayer == Projectile.owner) { int num42 = ModContent.ProjectileType(); float coreVelocity = 11.5f; @@ -151,7 +152,7 @@ namespace CalamityMod.Projectiles.Magic if (flag16) { weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2); - float scaleFactor12 = player.ActiveItem().shootSpeed * projectile.scale; + 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) @@ -164,46 +165,46 @@ namespace CalamityMod.Projectiles.Magic value19 = -Vector2.UnitY; } value19 *= scaleFactor12; - if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) + if (value19.X != Projectile.velocity.X || value19.Y != Projectile.velocity.Y) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity = value19 * 0.55f; - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * coreVelocity; + Projectile.velocity = value19 * 0.55f; + Vector2 vector20 = Vector2.Normalize(Projectile.velocity) * coreVelocity; if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) { vector20 = -Vector2.UnitY; } Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -10f, 10f); - int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); + int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, Projectile.owner, 0f, 0f); } else { - projectile.Kill(); + Projectile.Kill(); } } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; Vector2 origin = new Vector2(13f, 16f); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Magic/GhastlyVisageProjGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Magic/GhastlyVisageProjGlow"), Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); } public override bool CanDamage() => false; diff --git a/Projectiles/Magic/GleamingBolt.cs b/Projectiles/Magic/GleamingBolt.cs index 598944c4d6..6bab2cb6c9 100644 --- a/Projectiles/Magic/GleamingBolt.cs +++ b/Projectiles/Magic/GleamingBolt.cs @@ -2,6 +2,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class GleamingBolt : ModProjectile @@ -13,18 +14,18 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.timeLeft = 250; - projectile.penetrate = 1; - projectile.magic = true; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.timeLeft = 250; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * projectile.direction; - projectile.velocity *= 0.985f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; + Projectile.velocity *= 0.985f; for (int dust = 0; dust < 2; dust++) { int randomDust = Utils.SelectRandom(Main.rand, new int[] @@ -32,7 +33,7 @@ namespace CalamityMod.Projectiles.Magic 64, 204 }); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } @@ -45,22 +46,22 @@ namespace CalamityMod.Projectiles.Magic 64, 204 }); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 3; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); } } - Main.PlaySound(SoundID.Item105, projectile.position); + SoundEngine.PlaySound(SoundID.Item105, Projectile.position); } } } diff --git a/Projectiles/Magic/GleamingBolt2.cs b/Projectiles/Magic/GleamingBolt2.cs index cbdbeb2c02..100eee59f2 100644 --- a/Projectiles/Magic/GleamingBolt2.cs +++ b/Projectiles/Magic/GleamingBolt2.cs @@ -13,31 +13,31 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.timeLeft = 120; - projectile.penetrate = 1; - projectile.magic = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.timeLeft = 120; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 90 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - if (projectile.timeLeft < 90) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 8f, 20f); + if (Projectile.timeLeft < 90) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 8f, 20f); else - projectile.velocity *= 0.985f; + Projectile.velocity *= 0.985f; int randomDust = Utils.SelectRandom(Main.rand, new int[] { 64, 204 }); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void Kill(int timeLeft) @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Magic { randomDust = 204; } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/GraniteEnergy.cs b/Projectiles/Magic/GraniteEnergy.cs index 1927e3e1b1..8198f8c650 100644 --- a/Projectiles/Magic/GraniteEnergy.cs +++ b/Projectiles/Magic/GraniteEnergy.cs @@ -13,24 +13,24 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.magic = true; - projectile.timeLeft = 90; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 90; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 60 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 60 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.ToRadians(90); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.ToRadians(90); if (Main.rand.NextBool(2)) - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.6f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 100, default, 0.6f); - if (projectile.timeLeft < 60) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); + if (Projectile.timeLeft < 60) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 20f); } } } diff --git a/Projectiles/Magic/GranitePulse.cs b/Projectiles/Magic/GranitePulse.cs index a9c4972b4a..abd898bfeb 100644 --- a/Projectiles/Magic/GranitePulse.cs +++ b/Projectiles/Magic/GranitePulse.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class GranitePulse : ModProjectile @@ -13,63 +14,63 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Pulse"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 46; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = 1200; + Projectile.width = 40; + Projectile.height = 46; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.timeLeft = 1200; } public override void AI() { - projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(MathHelper.TwoPi * projectile.ai[0] / 300f)) * 0.5f); - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 300f) + Projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(MathHelper.TwoPi * Projectile.ai[0] / 300f)) * 0.5f); + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 300f) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 7200f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 7200f) { - projectile.alpha += 5; - if (projectile.alpha > 255) + Projectile.alpha += 5; + if (Projectile.alpha > 255) { - projectile.alpha = 255; - projectile.Kill(); + Projectile.alpha = 255; + Projectile.Kill(); } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 10f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 10f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; int projCount = 0; int index = 0; float findOldest = 0f; - int projType = projectile.type; + int projType = Projectile.type; for (int i = 0; i < Main.maxProjectiles; i++) { Projectile proj = Main.projectile[i]; - if (proj.active && proj.owner == projectile.owner && proj.type == projType && proj.ai[1] < 3600f) + if (proj.active && proj.owner == Projectile.owner && proj.type == projType && proj.ai[1] < 3600f) { projCount++; if (proj.ai[1] > findOldest) @@ -88,11 +89,11 @@ namespace CalamityMod.Projectiles.Magic } if (!initialized) { - Main.PlaySound(SoundID.NPCHit53, projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 20); + SoundEngine.PlaySound(SoundID.NPCHit53, Projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 20); for (int d = 0; d < 5; d++) { - int ecto = Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.5f); + int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, 0f, 0f, 100, default, 0.5f); Main.dust[ecto].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -102,21 +103,21 @@ namespace CalamityMod.Projectiles.Magic } for (int d = 0; d < 10; d++) { - int ecto = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); Main.dust[ecto].noGravity = true; Main.dust[ecto].velocity *= 5f; - ecto = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); + ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 0.5f); Main.dust[ecto].velocity *= 2f; } initialized = true; } - if (projectile.timeLeft % 50 == 1 && projectile.alpha <= 0) + if (Projectile.timeLeft % 50 == 1 && Projectile.alpha <= 0) { - Main.PlaySound(SoundID.NPCHit53, projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 20); + SoundEngine.PlaySound(SoundID.NPCHit53, Projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 20); for (int d = 0; d < 5; d++) { - int ecto = Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.5f); + int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, 0f, 0f, 100, default, 0.5f); Main.dust[ecto].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -126,23 +127,23 @@ namespace CalamityMod.Projectiles.Magic } for (int d = 0; d < 10; d++) { - int ecto = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); Main.dust[ecto].noGravity = true; Main.dust[ecto].velocity *= 5f; - ecto = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); + ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 0.5f); Main.dust[ecto].velocity *= 2f; } float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } @@ -150,13 +151,13 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), Projectile.scale, spriteEffects, 0f); return false; } diff --git a/Projectiles/Magic/GruesomeEminenceHoldout.cs b/Projectiles/Magic/GruesomeEminenceHoldout.cs index 523fb0f8e0..329bb07354 100644 --- a/Projectiles/Magic/GruesomeEminenceHoldout.cs +++ b/Projectiles/Magic/GruesomeEminenceHoldout.cs @@ -2,23 +2,24 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class GruesomeEminenceHoldout : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() => DisplayName.SetDefault("Gruesome Eminence"); public override void SetDefaults() { - projectile.width = 26; - projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = 26; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } public override void AI() @@ -28,24 +29,24 @@ namespace CalamityMod.Projectiles.Magic // Die if the owner is no longer channeling the item. int congregationType = ModContent.ProjectileType(); if (!Owner.channel) - projectile.Kill(); + Projectile.Kill(); // Summon a congregation of spirits if the player doesn't have one already. else if (Owner.ownedProjectileCounts[congregationType] <= 0) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Vector2 spiritSpawnPosition = projectile.Center - Vector2.UnitY * 12f; - Projectile.NewProjectile(spiritSpawnPosition, -Vector2.UnitY * 10f, congregationType, projectile.damage, projectile.knockBack, projectile.owner); + Vector2 spiritSpawnPosition = Projectile.Center - Vector2.UnitY * 12f; + Projectile.NewProjectile(spiritSpawnPosition, -Vector2.UnitY * 10f, congregationType, Projectile.damage, Projectile.knockBack, Projectile.owner); } - Main.PlaySound(SoundID.DD2_EtherianPortalOpen, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalOpen, Projectile.Center); } // Emit light. - Lighting.AddLight(projectile.Center, 0.13f, 0f, 0.05f); + Lighting.AddLight(Projectile.Center, 0.13f, 0f, 0.05f); // Also emit dust. - Dust ghostlyMagic = Dust.NewDustPerfect(projectile.Top + Main.rand.NextVector2Circular(5f, 5f) + Vector2.UnitX * projectile.direction * 7f, 267); + Dust ghostlyMagic = Dust.NewDustPerfect(Projectile.Top + Main.rand.NextVector2Circular(5f, 5f) + Vector2.UnitX * Projectile.direction * 7f, 267); ghostlyMagic.color = Color.Lerp(Color.DarkRed, Color.Fuchsia, Main.rand.NextFloat(0.7f)); ghostlyMagic.color = Color.Lerp(ghostlyMagic.color, Color.Black, 0.5f); ghostlyMagic.velocity = -Vector2.UnitY.RotatedBy(0.44f) * Main.rand.NextFloat(0.8f, 2f); @@ -56,10 +57,10 @@ namespace CalamityMod.Projectiles.Magic public void StickToOwner() { - projectile.rotation = 0f; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - Owner.ChangeDir(projectile.direction); + Projectile.rotation = 0f; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + Owner.ChangeDir(Projectile.direction); Vector2 centerDelta = Main.OffsetsPlayerOnhand[Owner.bodyFrame.Y / 56] * 2f; if (Owner.direction != 1) @@ -69,17 +70,17 @@ namespace CalamityMod.Projectiles.Magic centerDelta.Y = Owner.bodyFrame.Height - centerDelta.Y; if (Owner.heldProj == -1) - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; centerDelta -= new Vector2(Owner.bodyFrame.Width - Owner.width, Owner.bodyFrame.Height - 42) / 2f; - projectile.Center = Owner.RotatedRelativePoint(Owner.position + centerDelta, true) - projectile.velocity; - if (projectile.spriteDirection == 1) - projectile.position.X += 4f; + Projectile.Center = Owner.RotatedRelativePoint(Owner.position + centerDelta, true) - Projectile.velocity; + if (Projectile.spriteDirection == 1) + Projectile.position.X += 4f; - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.itemLocation = projectile.Center; - Owner.itemRotation = MathHelper.PiOver4 * -projectile.direction; + Owner.itemLocation = Projectile.Center; + Owner.itemRotation = MathHelper.PiOver4 * -Projectile.direction; } // This is just a casting item. It should not do contact damage. diff --git a/Projectiles/Magic/HadopelagicEcho2.cs b/Projectiles/Magic/HadopelagicEcho2.cs index d8aa187ae6..fa57e94df2 100644 --- a/Projectiles/Magic/HadopelagicEcho2.cs +++ b/Projectiles/Magic/HadopelagicEcho2.cs @@ -14,35 +14,35 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Echo"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 36; - projectile.height = 36; - projectile.scale = 0.85f; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - projectile.timeLeft = 30; - projectile.extraUpdates = 1; - projectile.tileCollide = false; + Projectile.width = 36; + Projectile.height = 36; + Projectile.scale = 0.85f; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.timeLeft = 30; + Projectile.extraUpdates = 1; + Projectile.tileCollide = false; } public override void AI() { - if (projectile.alpha > 100) - projectile.alpha -= 25; - if (projectile.alpha < 100) - projectile.alpha = 100; + if (Projectile.alpha > 100) + Projectile.alpha -= 25; + if (Projectile.alpha < 100) + Projectile.alpha = 100; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -52,9 +52,9 @@ namespace CalamityMod.Projectiles.Magic public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * (b2 / 255f)); return new Color(b2, b2, b2, a2); } @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/HadopelagicEchoSoundwave.cs b/Projectiles/Magic/HadopelagicEchoSoundwave.cs index 31edb55995..e6761935dd 100644 --- a/Projectiles/Magic/HadopelagicEchoSoundwave.cs +++ b/Projectiles/Magic/HadopelagicEchoSoundwave.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class HadopelagicEchoSoundwave : ModProjectile @@ -17,77 +18,77 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Echo"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 36; - projectile.height = 36; - projectile.scale = 0.005f; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; - projectile.timeLeft = 450; - projectile.Calamity().PierceResistHarshness = 0.06f; - projectile.Calamity().PierceResistCap = 0.4f; + Projectile.width = 36; + Projectile.height = 36; + Projectile.scale = 0.005f; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; + Projectile.timeLeft = 450; + Projectile.Calamity().PierceResistHarshness = 0.06f; + Projectile.Calamity().PierceResistCap = 0.4f; } public override void AI() { - if (projectile.ai[0] == 0f || projectile.ai[0] == 4f) + if (Projectile.ai[0] == 0f || Projectile.ai[0] == 4f) { if (!playedSound) { - Main.PlaySound(Main.rand.NextBool(100) ? mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/Sunskater") : mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)projectile.Center.X, (int)projectile.Center.Y); + SoundEngine.PlaySound(Main.rand.NextBool(100) ? Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/Sunskater") : Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)Projectile.Center.X, (int)Projectile.Center.Y); playedSound = true; } } - if (projectile.localAI[0] < 1f) + if (Projectile.localAI[0] < 1f) { - projectile.localAI[0] += 0.05f; - projectile.scale += 0.05f; - projectile.width = (int)(36f * projectile.scale); - projectile.height = (int)(36f * projectile.scale); + Projectile.localAI[0] += 0.05f; + Projectile.scale += 0.05f; + Projectile.width = (int)(36f * Projectile.scale); + Projectile.height = (int)(36f * Projectile.scale); } else { - projectile.width = 36; - projectile.height = 36; + Projectile.width = 36; + Projectile.height = 36; } if (echoCooldown > 0) echoCooldown--; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; return false; } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - damage = (int)(damage * projectile.localAI[0]); + damage = (int)(damage * Projectile.localAI[0]); } public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) { - damage = (int)(damage * projectile.localAI[0]); + damage = (int)(damage * Projectile.localAI[0]); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -97,8 +98,8 @@ namespace CalamityMod.Projectiles.Magic { echoCooldown = 120; int echoID = ModContent.ProjectileType(); - int echoDamage = (int)(0.2f * projectile.damage); - float echoKB = projectile.knockBack / 3; + int echoDamage = (int)(0.2f * Projectile.damage); + float echoKB = Projectile.knockBack / 3; int echos = 2; for (int i = 0; i < echos; ++i) { @@ -109,9 +110,9 @@ namespace CalamityMod.Projectiles.Magic float echoSpeed = Main.rand.NextFloat(15f, 18f); Vector2 velocity = startDir * (-echoSpeed); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(startPoint, velocity, echoID, echoDamage, echoKB, projectile.owner); + Projectile.NewProjectile(startPoint, velocity, echoID, echoDamage, echoKB, Projectile.owner); } } } @@ -119,9 +120,9 @@ namespace CalamityMod.Projectiles.Magic public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -130,7 +131,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/HeliumFlashBlast.cs b/Projectiles/Magic/HeliumFlashBlast.cs index c7504da5c2..ca7227aca0 100644 --- a/Projectiles/Magic/HeliumFlashBlast.cs +++ b/Projectiles/Magic/HeliumFlashBlast.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -22,17 +23,17 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { // Width and height don't actually do anything because the explosion uses custom collision - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = Lifetime; + Projectile.width = 250; + Projectile.height = 250; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } // localAI[0] = frame counter @@ -40,27 +41,27 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { // Play sound on frame 1 and initialize dust quantity - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item74, projectile.Center); - Main.PlaySound(SoundID.Item88, projectile.Center); - projectile.localAI[1] = StartDustQuantity; + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item88, Projectile.Center); + Projectile.localAI[1] = StartDustQuantity; } // Pure dust projectile DrawProjectile(); // Increment frame counter - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } private void DrawProjectile() { // Taper down the dust amount for the last bit of the projectile's life - if (projectile.localAI[0] >= Lifetime - 15) - projectile.localAI[1] -= 1f; + if (Projectile.localAI[0] >= Lifetime - 15) + Projectile.localAI[1] -= 1f; - int dustCount = (int)projectile.localAI[1]; + int dustCount = (int)Projectile.localAI[1]; for (int i = 0; i < dustCount; ++i) { int dustType = Main.rand.NextBool(3) ? 262 : 87; @@ -72,9 +73,9 @@ namespace CalamityMod.Projectiles.Magic speed = randVelocity / speed; randX *= speed; randY *= speed; - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); - Main.dust[idx].position.X = projectile.Center.X + Main.rand.NextFloat(-10f, 10f); - Main.dust[idx].position.Y = projectile.Center.Y + Main.rand.NextFloat(-10f, 10f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); + Main.dust[idx].position.X = Projectile.Center.X + Main.rand.NextFloat(-10f, 10f); + Main.dust[idx].position.Y = Projectile.Center.Y + Main.rand.NextFloat(-10f, 10f); Main.dust[idx].velocity.X = randX; Main.dust[idx].velocity.Y = randY; Main.dust[idx].scale = scale; @@ -87,6 +88,6 @@ namespace CalamityMod.Projectiles.Magic target.AddBuff(BuffID.Daybreak, 300); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, ExplosionRadius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); } } diff --git a/Projectiles/Magic/HellfireExplosionFriendly.cs b/Projectiles/Magic/HellfireExplosionFriendly.cs index 7baf8d698f..7a3b0456bb 100644 --- a/Projectiles/Magic/HellfireExplosionFriendly.cs +++ b/Projectiles/Magic/HellfireExplosionFriendly.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class HellfireExplosionFriendly : ModProjectile @@ -18,38 +19,38 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 130; - projectile.height = 130; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 180; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 130; + Projectile.height = 130; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, 0.9f, 0f, 0f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.localAI[0] += 1f; } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -60,11 +61,11 @@ namespace CalamityMod.Projectiles.Magic num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Magic/HellwingPillar.cs b/Projectiles/Magic/HellwingPillar.cs index 7861302074..f643e759a0 100644 --- a/Projectiles/Magic/HellwingPillar.cs +++ b/Projectiles/Magic/HellwingPillar.cs @@ -12,57 +12,57 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Pillar"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 90; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - if (projectile.ai[0] > 7f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); + if (Projectile.ai[0] > 7f) { float scalar = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { scalar = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { scalar = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { scalar = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num297 = 127; if (Main.rand.NextBool(3)) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { @@ -82,9 +82,9 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/HeresyProj.cs b/Projectiles/Magic/HeresyProj.cs index 7eb11e2dc9..d4d342ee09 100644 --- a/Projectiles/Magic/HeresyProj.cs +++ b/Projectiles/Magic/HeresyProj.cs @@ -5,40 +5,41 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Utilities; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class HeresyProj : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public float ShootIntensity => MathHelper.SmoothStep(0f, 1f, Utils.InverseLerp(0f, 275f, Time, true)); - public ref float Time => ref projectile.ai[0]; - public ref float AttackTimer => ref projectile.ai[1]; + public ref float Time => ref Projectile.ai[0]; + public ref float AttackTimer => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Heresy"); - Main.projFrames[projectile.type] = 8; + Main.projFrames[Projectile.type] = 8; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = 26; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } public override void AI() { - projectile.Center = Owner.Center + Vector2.UnitX * Owner.direction * 18f; + Projectile.Center = Owner.Center + Vector2.UnitX * Owner.direction * 18f; // If the player is no longer able to hold the book, kill it. if (!Owner.channel || Owner.noItems || Owner.CCed) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -46,30 +47,30 @@ namespace CalamityMod.Projectiles.Magic ReleaseThings(); // Switch frames at a linearly increasing rate to make it look like the player is flipping pages quickly. - projectile.frameCounter++; - if (projectile.frameCounter >= (int)MathHelper.Lerp(10f, 2f, Utils.InverseLerp(0f, 180f, Time, true))) + Projectile.frameCounter++; + if (Projectile.frameCounter >= (int)MathHelper.Lerp(10f, 2f, Utils.InverseLerp(0f, 180f, Time, true))) { - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; - projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frameCounter = 0; } AdjustPlayerValues(); - projectile.timeLeft = 2; + Projectile.timeLeft = 2; AttackTimer++; Time++; } public void ReleaseThings() { - Main.PlaySound(SoundID.DD2_EtherianPortalSpawnEnemy); - if (Main.myPlayer != projectile.owner) + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalSpawnEnemy); + if (Main.myPlayer != Projectile.owner) return; // If the owner has sufficient mana, consume it. // Otherwise, delete the book and don't bother summoning anything. if (!Owner.CheckMana(Owner.ActiveItem().mana, true, false)) { - projectile.Kill(); + Projectile.Kill(); return; } WeightedRandom typeDecider = new WeightedRandom(); @@ -81,33 +82,33 @@ namespace CalamityMod.Projectiles.Magic typeDecider.Add(ModContent.ProjectileType(), ShootIntensity * 0.4f); typeDecider.Add(ModContent.ProjectileType(), ShootIntensity * 0.2f); - Vector2 spawnPosition = projectile.Top + Main.rand.NextVector2CircularEdge(4f, 4f); + Vector2 spawnPosition = Projectile.Top + Main.rand.NextVector2CircularEdge(4f, 4f); Vector2 shootVelocity = -Vector2.UnitY.RotatedBy(Main.rand.NextFloat(-0.13f, 0.23f) * Owner.direction) * Owner.gravDir; shootVelocity *= Main.rand.NextFloat(5f, 8); if (Owner.velocity.Y < 0f) shootVelocity.Y += Owner.velocity.Y; - Projectile.NewProjectile(spawnPosition, shootVelocity, typeDecider.Get(), projectile.damage, projectile.knockBack, projectile.owner, ShootIntensity); + Projectile.NewProjectile(spawnPosition, shootVelocity, typeDecider.Get(), Projectile.damage, Projectile.knockBack, Projectile.owner, ShootIntensity); AttackTimer = 0f; - projectile.netUpdate = true; + Projectile.netUpdate = true; } public void AdjustPlayerValues() { - projectile.spriteDirection = projectile.direction = Owner.direction; - Owner.heldProj = projectile.whoAmI; + Projectile.spriteDirection = Projectile.direction = Owner.direction; + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.itemRotation = (projectile.direction * projectile.velocity).ToRotation(); + Owner.itemRotation = (Projectile.direction * Projectile.velocity).ToRotation(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { float glowOutwardness = MathHelper.SmoothStep(0f, 4f, Utils.InverseLerp(90f, 270f, Time, true)); - Texture2D bookTexture = Main.projectileTexture[projectile.type]; - Rectangle frame = bookTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Texture2D bookTexture = Main.projectileTexture[Projectile.type]; + Rectangle frame = bookTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 drawPosition; Vector2 origin = frame.Size() * 0.5f; Color glowColor = Color.Lerp(Color.Pink, Color.Red, (float)Math.Cos(Main.GlobalTime * 5f) * 0.5f + 0.5f); @@ -116,12 +117,12 @@ namespace CalamityMod.Projectiles.Magic // Draw an ominous glowing version of the book after a bit of time. for (int i = 0; i < 8; i++) { - drawPosition = projectile.Center + (MathHelper.TwoPi * i / 8f + Main.GlobalTime * 4f).ToRotationVector2() * glowOutwardness - Main.screenPosition; - spriteBatch.Draw(bookTexture, drawPosition, frame, projectile.GetAlpha(glowColor), projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + drawPosition = Projectile.Center + (MathHelper.TwoPi * i / 8f + Main.GlobalTime * 4f).ToRotationVector2() * glowOutwardness - Main.screenPosition; + spriteBatch.Draw(bookTexture, drawPosition, frame, Projectile.GetAlpha(glowColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } - drawPosition = projectile.Center - Main.screenPosition; - spriteBatch.Draw(bookTexture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + drawPosition = Projectile.Center - Main.screenPosition; + spriteBatch.Draw(bookTexture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Magic/HolyFlame.cs b/Projectiles/Magic/HolyFlame.cs index 66c01768c7..db130eaa45 100644 --- a/Projectiles/Magic/HolyFlame.cs +++ b/Projectiles/Magic/HolyFlame.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class HolyFlame : ModProjectile @@ -10,53 +11,53 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.alpha -= 3; - if (projectile.alpha <= 0) + Projectile.alpha -= 3; + if (Projectile.alpha <= 0) { - projectile.Kill(); + Projectile.Kill(); } - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -66,10 +67,10 @@ namespace CalamityMod.Projectiles.Magic } for (int num623 = 0; num623 < 35; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 247, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Magic/HolyLaser.cs b/Projectiles/Magic/HolyLaser.cs index ec20259537..de2d69e935 100644 --- a/Projectiles/Magic/HolyLaser.cs +++ b/Projectiles/Magic/HolyLaser.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 2; - projectile.extraUpdates = 100; - projectile.timeLeft = 180; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 2; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 180; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { int num249 = Main.rand.Next(2); if (num249 == 0) @@ -42,8 +42,8 @@ namespace CalamityMod.Projectiles.Magic { num249 = 246; } - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * 0.25f; int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 0.25f); Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; @@ -55,9 +55,9 @@ namespace CalamityMod.Projectiles.Magic { target.AddBuff(ModContent.BuffType(), 180); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMagic = true; } diff --git a/Projectiles/Magic/IceBarrageMain.cs b/Projectiles/Magic/IceBarrageMain.cs index 1d018e1415..0c4ffcae81 100644 --- a/Projectiles/Magic/IceBarrageMain.cs +++ b/Projectiles/Magic/IceBarrageMain.cs @@ -19,29 +19,29 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = pwidth; - projectile.height = pheight; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.timeLeft = 280; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.coldDamage = true; + Projectile.width = pwidth; + Projectile.height = pheight; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 280; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.coldDamage = true; } public override void AI() { - NPC closestTarget = projectile.Center.ClosestNPCAt(500f, true, true); + NPC closestTarget = Projectile.Center.ClosestNPCAt(500f, true, true); if (closestTarget != null) { - projectile.Center = closestTarget.Center; + Projectile.Center = closestTarget.Center; } - projectile.ai[0]++; - projectile.ai[1]++; + Projectile.ai[0]++; + Projectile.ai[1]++; for (int j = 0; j < 3; j++) { int dustType = Main.rand.NextBool(2) ? 68 : 67; @@ -49,27 +49,27 @@ namespace CalamityMod.Projectiles.Magic { dustType = 80; } - if (projectile.ai[0] < 140f) + if (Projectile.ai[0] < 140f) { Vector2 direction = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, direction.X, direction.Y, 50, default, 1.3f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, direction.X, direction.Y, 50, default, 1.3f); Main.dust[dust].noGravity = true; } else { int direct = Main.rand.NextBool(2) ? 1 : -1; Vector2 dir1 = new Vector2(0f, 10f) * direct; - int dust1 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, dir1.X, dir1.Y, 50, default, 1.3f); + int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, dir1.X, dir1.Y, 50, default, 1.3f); Main.dust[dust1].noGravity = true; Main.dust[dust1].velocity = dir1; int direct2 = Main.rand.NextBool(2) ? 1 : -1; Vector2 dir2 = new Vector2(10f, 0f) * direct2; - int dust2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, dir2.X, dir2.Y, 50, default, 1.3f); + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, dir2.X, dir2.Y, 50, default, 1.3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity = dir2; } } - if (projectile.ai[0] < 55) + if (Projectile.ai[0] < 55) { for (int i = 0; i < 10; i++) { @@ -78,8 +78,8 @@ namespace CalamityMod.Projectiles.Magic { dtype1 = 80; } - Vector2 Dpos = projectile.Center + new Vector2(Main.rand.NextFloat(250f, 270f), Main.rand.NextFloat(250f, 270f)).RotatedBy(MathHelper.ToRadians(Main.rand.Next(1, 360))); - Vector2 Dspeed = projectile.Center - Dpos; + Vector2 Dpos = Projectile.Center + new Vector2(Main.rand.NextFloat(250f, 270f), Main.rand.NextFloat(250f, 270f)).RotatedBy(MathHelper.ToRadians(Main.rand.Next(1, 360))); + Vector2 Dspeed = Projectile.Center - Dpos; Dspeed.Normalize(); Dspeed *= 0.5f; float Dscale = Main.rand.NextFloat(1.5f, 2f); @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[d1].noGravity = true; } } - else if (projectile.ai[0] == 55f) + else if (Projectile.ai[0] == 55f) { for (int i = 0; i < 270; i++) { @@ -97,8 +97,8 @@ namespace CalamityMod.Projectiles.Magic { dtype2 = 80; } - Vector2 Dpos = projectile.Center + new Vector2(Main.rand.NextFloat(250f, 270f), Main.rand.NextFloat(250f, 270f)).RotatedBy(MathHelper.ToRadians(Main.rand.Next(1, 360))); - Vector2 Dspeed = projectile.Center - Dpos; + Vector2 Dpos = Projectile.Center + new Vector2(Main.rand.NextFloat(250f, 270f), Main.rand.NextFloat(250f, 270f)).RotatedBy(MathHelper.ToRadians(Main.rand.Next(1, 360))); + Vector2 Dspeed = Projectile.Center - Dpos; Dspeed.Normalize(); Dspeed *= Main.rand.NextFloat(8f,34f); float Dscale = Main.rand.NextFloat(1.5f, 2f); @@ -108,13 +108,13 @@ namespace CalamityMod.Projectiles.Magic } } - else if (projectile.ai[0] == 140f) + else if (Projectile.ai[0] == 140f) { - Vector2 projcenter = projectile.Center; - projectile.width = 200; - projectile.height = 200; - projectile.Center = projcenter; - projectile.Damage(); + Vector2 projcenter = Projectile.Center; + Projectile.width = 200; + Projectile.height = 200; + Projectile.Center = projcenter; + Projectile.Damage(); for (int i = 0; i < 180; i++) { int dtype3 = Main.rand.NextBool(2) ? 68 : 67; @@ -123,53 +123,53 @@ namespace CalamityMod.Projectiles.Magic dtype3 = 80; } Vector2 explosiondir = new Vector2(Main.rand.NextFloat(-18f, 18f), Main.rand.NextFloat(-18f, 18f)); - int d2 = Dust.NewDust(projectile.Center, 1, 1, dtype3, explosiondir.X, explosiondir.Y, 50, default, 1.5f); + int d2 = Dust.NewDust(Projectile.Center, 1, 1, dtype3, explosiondir.X, explosiondir.Y, 50, default, 1.5f); Main.dust[d2].noGravity = true; } for (int k = 0; k < 45; k++) { Vector2 projspeed = new Vector2(Main.rand.NextFloat(-8f, 8f), Main.rand.NextFloat(-8f, 8f)); - int ice = Projectile.NewProjectile(projectile.Center, projspeed, ProjectileID.NorthPoleSnowflake, (int)(projectile.damage * 0.05f), 2f, projectile.owner, 0f, (float)Main.rand.Next(3)); + int ice = Projectile.NewProjectile(Projectile.Center, projspeed, ProjectileID.NorthPoleSnowflake, (int)(Projectile.damage * 0.05f), 2f, Projectile.owner, 0f, (float)Main.rand.Next(3)); Main.projectile[ice].timeLeft = 600; - Main.projectile[ice].melee = false; + // Main.projectile[ice].melee = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; Main.projectile[ice].Calamity().forceMagic = true; } - projectile.width = pwidth; - projectile.height = pheight; - projectile.Center = projcenter; - Vector2 pos1 = new Vector2(projectile.Center.X, projectile.Center.Y - (projectile.height * 0.5f) - 44f); - int block1 = Projectile.NewProjectile(pos1, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.3f), 5f, projectile.owner, 0f, 0f); + Projectile.width = pwidth; + Projectile.height = pheight; + Projectile.Center = projcenter; + Vector2 pos1 = new Vector2(Projectile.Center.X, Projectile.Center.Y - (Projectile.height * 0.5f) - 44f); + int block1 = Projectile.NewProjectile(pos1, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 0f, 0f); Main.projectile[block1].Center = pos1; - Vector2 pos2 = new Vector2(projectile.Center.X + (projectile.width * 0.5f) + 48f, projectile.Center.Y); - int block2 = Projectile.NewProjectile(pos2, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.3f), 5f, projectile.owner, 1f, 0f); + Vector2 pos2 = new Vector2(Projectile.Center.X + (Projectile.width * 0.5f) + 48f, Projectile.Center.Y); + int block2 = Projectile.NewProjectile(pos2, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 1f, 0f); Main.projectile[block2].Center = pos2; - Vector2 pos3 = new Vector2(projectile.Center.X, projectile.Center.Y + (projectile.height * 0.5f) + 44f); - int block3 = Projectile.NewProjectile(pos3, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.3f), 5f, projectile.owner, 2f, 0f); + Vector2 pos3 = new Vector2(Projectile.Center.X, Projectile.Center.Y + (Projectile.height * 0.5f) + 44f); + int block3 = Projectile.NewProjectile(pos3, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 2f, 0f); Main.projectile[block3].Center = pos3; - Vector2 pos4 = new Vector2(projectile.Center.X - (projectile.width * 0.5f) - 49f, projectile.Center.Y); - int block4 = Projectile.NewProjectile(pos4, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.3f), 5f, projectile.owner, 3f, 0f); + Vector2 pos4 = new Vector2(Projectile.Center.X - (Projectile.width * 0.5f) - 49f, Projectile.Center.Y); + int block4 = Projectile.NewProjectile(pos4, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 3f, 0f); Main.projectile[block4].Center = pos4; } - if (projectile.ai[0] > 90) + if (Projectile.ai[0] > 90) { - if (projectile.ai[1] >= 5f) + if (Projectile.ai[1] >= 5f) { Vector2 projspeed = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); - int ice = Projectile.NewProjectile(projectile.Center, projspeed, ProjectileID.NorthPoleSnowflake, (int)(projectile.damage * 0.05f), 2f, projectile.owner, 0f, (float)Main.rand.Next(3)); + int ice = Projectile.NewProjectile(Projectile.Center, projspeed, ProjectileID.NorthPoleSnowflake, (int)(Projectile.damage * 0.05f), 2f, Projectile.owner, 0f, (float)Main.rand.Next(3)); if (ice.WithinBounds(Main.maxProjectiles)) { Main.projectile[ice].timeLeft = 600; - Main.projectile[ice].melee = false; + // Main.projectile[ice].melee = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; Main.projectile[ice].Calamity().forceMagic = true; } - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; } } } public override bool CanDamage() { - if (projectile.ai[0] == 140f) + if (Projectile.ai[0] == 140f) return true; return false; } diff --git a/Projectiles/Magic/IceBlock.cs b/Projectiles/Magic/IceBlock.cs index 9da87e29b0..4c01287b54 100644 --- a/Projectiles/Magic/IceBlock.cs +++ b/Projectiles/Magic/IceBlock.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; using Microsoft.Xna.Framework; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -14,29 +15,29 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 58; - projectile.height = 58; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.timeLeft = 140; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 60; - projectile.coldDamage = true; + Projectile.width = 58; + Projectile.height = 58; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 140; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; + Projectile.coldDamage = true; } public override void AI() { - if (projectile.alpha > 20) + if (Projectile.alpha > 20) { - projectile.alpha -= 12; + Projectile.alpha -= 12; } - if(projectile.alpha < 20) + if(Projectile.alpha < 20) { - projectile.alpha = 20; + Projectile.alpha = 20; } for (int i = 0; i < Main.maxProjectiles; i++) { @@ -47,27 +48,27 @@ namespace CalamityMod.Projectiles.Magic Vector2 pos2 = new Vector2(proj.Center.X + (proj.width * 0.5f) + 48f, proj.Center.Y); Vector2 pos3 = new Vector2(proj.Center.X, proj.Center.Y + (proj.height * 0.5f) + 44f); Vector2 pos4 = new Vector2(proj.Center.X - (proj.width * 0.5f) - 49f, proj.Center.Y); - switch (projectile.ai[0]) + switch (Projectile.ai[0]) { - case 0: projectile.Center = pos1; + case 0: Projectile.Center = pos1; break; - case 1: projectile.Center = pos2; + case 1: Projectile.Center = pos2; break; - case 2: projectile.Center = pos3; + case 2: Projectile.Center = pos3; break; - case 3: projectile.Center = pos4; + case 3: Projectile.Center = pos4; break; default: break; } } } - switch (projectile.ai[0]) + switch (Projectile.ai[0]) { - case 1: projectile.rotation = (MathHelper.Pi * 0.5f); + case 1: Projectile.rotation = (MathHelper.Pi * 0.5f); break; - case 2: projectile.rotation = MathHelper.Pi; + case 2: Projectile.rotation = MathHelper.Pi; break; - case 3: projectile.rotation = (MathHelper.Pi * 1.5f); + case 3: Projectile.rotation = (MathHelper.Pi * 1.5f); break; default: break; } @@ -83,15 +84,15 @@ namespace CalamityMod.Projectiles.Magic dustType = 80; } Vector2 direction = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, direction.X, direction.Y, 50, default, 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, direction.X, direction.Y, 50, default, 1.5f); Main.dust[dust].noGravity = true; } - Main.PlaySound(SoundID.NPCHit5, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit5, Projectile.Center); for (int i = 0; i< 8; i++) { Vector2 projdir = new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-10f, 10f)); - Vector2 projpos = projectile.Center + new Vector2(Main.rand.NextFloat(-50f, 50f), Main.rand.NextFloat(-50f, 50f)); - Projectile.NewProjectile(projpos, projdir, ModContent.ProjectileType(), (int)(projectile.damage * 0.2f), 4f, projectile.owner, Main.rand.Next(0, 2), 0f); + Vector2 projpos = Projectile.Center + new Vector2(Main.rand.NextFloat(-50f, 50f), Main.rand.NextFloat(-50f, 50f)); + Projectile.NewProjectile(projpos, projdir, ModContent.ProjectileType(), (int)(Projectile.damage * 0.2f), 4f, Projectile.owner, Main.rand.Next(0, 2), 0f); } } } diff --git a/Projectiles/Magic/IceBlockIcicle.cs b/Projectiles/Magic/IceBlockIcicle.cs index b4e8a6670b..531afefe04 100644 --- a/Projectiles/Magic/IceBlockIcicle.cs +++ b/Projectiles/Magic/IceBlockIcicle.cs @@ -3,6 +3,7 @@ using Terraria.ModLoader; using Terraria.ID; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -15,32 +16,32 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.timeLeft = 600; - projectile.coldDamage = true; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 600; + Projectile.coldDamage = true; } public override void AI() { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + (MathHelper.Pi * 0.5f * projectile.direction); - projectile.velocity.Y += 0.25f; - if(projectile.velocity.Y > 16f) + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + (MathHelper.Pi * 0.5f * Projectile.direction); + Projectile.velocity.Y += 0.25f; + if(Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/IceBlockIcicle2"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Magic/IceBlockIcicle2"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } return true; @@ -56,10 +57,10 @@ namespace CalamityMod.Projectiles.Magic dustType = 80; } Vector2 direction = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, direction.X, direction.Y, 50, default, 1.1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, direction.X, direction.Y, 50, default, 1.1f); Main.dust[dust].noGravity = true; } - Main.PlaySound(SoundID.NPCHit5, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit5, Projectile.Center); } } } diff --git a/Projectiles/Magic/IceCluster.cs b/Projectiles/Magic/IceCluster.cs index 0c76e81079..9231361d20 100644 --- a/Projectiles/Magic/IceCluster.cs +++ b/Projectiles/Magic/IceCluster.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class IceCluster : ModProjectile @@ -11,71 +12,71 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Ice"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 90; - projectile.height = 90; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 100; - projectile.tileCollide = false; - projectile.magic = true; - projectile.coldDamage = true; + Projectile.width = 90; + Projectile.height = 90; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 100; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.coldDamage = true; } public override void AI() { - projectile.rotation += 0.5f; + Projectile.rotation += 0.5f; - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - projectile.localAI[1] = 1f; - Main.PlaySound(SoundID.Item120, projectile.position); + Projectile.localAI[1] = 1f; + SoundEngine.PlaySound(SoundID.Item120, Projectile.position); } - projectile.ai[0] += 1f; - if (projectile.ai[1] == 1f) + Projectile.ai[0] += 1f; + if (Projectile.ai[1] == 1f) { - if (projectile.ai[0] % 30f == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (Projectile.ai[0] % 30f == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector80 = projectile.rotation.ToRotationVector2(); - Projectile.NewProjectile(projectile.Center, vector80, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Vector2 vector80 = Projectile.rotation.ToRotationVector2(); + Projectile.NewProjectile(Projectile.Center, vector80, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } - Lighting.AddLight(projectile.Center, 0.3f, 0.75f, 0.9f); + Lighting.AddLight(Projectile.Center, 0.3f, 0.75f, 0.9f); } - if (projectile.ai[0] >= 90f) - projectile.alpha += 25; + if (Projectile.ai[0] >= 90f) + Projectile.alpha += 25; else - projectile.alpha -= 15; + Projectile.alpha -= 15; - if (projectile.alpha < 0) - projectile.alpha = 0; - if (projectile.alpha > 255) - projectile.alpha = 255; + if (Projectile.alpha < 0) + Projectile.alpha = 0; + if (Projectile.alpha > 255) + Projectile.alpha = 255; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; target.AddBuff(ModContent.BuffType(), 30); - Vector2 vector80 = projectile.rotation.ToRotationVector2(); - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, vector80, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Vector2 vector80 = Projectile.rotation.ToRotationVector2(); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center, vector80, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Magic/IceSpike.cs b/Projectiles/Magic/IceSpike.cs index 169ca5a084..8167891c5b 100644 --- a/Projectiles/Magic/IceSpike.cs +++ b/Projectiles/Magic/IceSpike.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -16,32 +17,32 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.magic = true; - projectile.timeLeft = 240; - projectile.coldDamage = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 240; + Projectile.coldDamage = true; } public override void AI() { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + (MathHelper.Pi * 0.5f * projectile.direction); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + (MathHelper.Pi * 0.5f * Projectile.direction); - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 10f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 10f, 20f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, 0f, 0f); } } diff --git a/Projectiles/Magic/Icicle.cs b/Projectiles/Magic/Icicle.cs index 1d149a549b..a8364cf8be 100644 --- a/Projectiles/Magic/Icicle.cs +++ b/Projectiles/Magic/Icicle.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -9,15 +10,15 @@ namespace CalamityMod.Projectiles.Magic { public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.friendly = true; - projectile.magic = true; - projectile.coldDamage = true; - projectile.penetrate = 1; - projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.coldDamage = true; + Projectile.penetrate = 1; + Projectile.coldDamage = true; } public override void SetStaticDefaults() @@ -32,15 +33,15 @@ namespace CalamityMod.Projectiles.Magic public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int index1 = 0; index1 < 5; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, new Color(), 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, new Color(), 1f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 1.5f; Main.dust[index2].scale *= 0.9f; diff --git a/Projectiles/Magic/IcicleStaffProj.cs b/Projectiles/Magic/IcicleStaffProj.cs index b5696297b6..55aba7b7ef 100644 --- a/Projectiles/Magic/IcicleStaffProj.cs +++ b/Projectiles/Magic/IcicleStaffProj.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class IcicleStaffProj : ModProjectile @@ -14,25 +15,25 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.coldDamage = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 600; + Projectile.coldDamage = true; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 3; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 0.75f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 0.75f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -41,10 +42,10 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/InfernadoFriendly.cs b/Projectiles/Magic/InfernadoFriendly.cs index 7a39bcbc87..6a8dade15d 100644 --- a/Projectiles/Magic/InfernadoFriendly.cs +++ b/Projectiles/Magic/InfernadoFriendly.cs @@ -11,27 +11,27 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Infernado"); - Main.projFrames[projectile.type] = 12; + Main.projFrames[Projectile.type] = 12; } public override void SetDefaults() { - projectile.width = 320; - projectile.height = 88; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 500; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; - projectile.magic = true; + Projectile.width = 320; + Projectile.height = 88; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.timeLeft = 500; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) intersectingSomething = true; float scaleBase = 44f; @@ -41,85 +41,85 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(25)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); + Projectile.direction = Projectile.spriteDirection = -Math.Sign(Projectile.velocity.X); } - projectile.frameCounter++; - if (projectile.frameCounter > 2) + Projectile.frameCounter++; + if (Projectile.frameCounter > 2) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.scale = (scaleBase - projectile.ai[1]) * scaleMult / scaleBase; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(baseWidth * projectile.scale), (int)(baseHeight * projectile.scale)); - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.scale = (scaleBase - Projectile.ai[1]) * scaleMult / scaleBase; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, (int)(baseWidth * Projectile.scale), (int)(baseHeight * Projectile.scale)); + Projectile.netUpdate = true; } - if (projectile.ai[1] != -1f) + if (Projectile.ai[1] != -1f) { - projectile.scale = (scaleBase - projectile.ai[1]) * scaleMult / scaleBase; - projectile.width = (int)(baseWidth * projectile.scale); - projectile.height = (int)(baseHeight * projectile.scale); + Projectile.scale = (scaleBase - Projectile.ai[1]) * scaleMult / scaleBase; + Projectile.width = (int)(baseWidth * Projectile.scale); + Projectile.height = (int)(baseHeight * Projectile.scale); } if (!intersectingSomething) { - projectile.alpha -= 30; - if (projectile.alpha < 100) + Projectile.alpha -= 30; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } } else { - projectile.alpha += 30; - if (projectile.alpha > 200) + Projectile.alpha += 30; + if (Projectile.alpha > 200) { - projectile.alpha = 200; + Projectile.alpha = 200; } } - if (projectile.ai[0] > 0f) + if (Projectile.ai[0] > 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + if (Projectile.ai[0] == 1f && Projectile.ai[1] > 0f && Projectile.owner == Main.myPlayer) { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= baseHeight * projectile.scale / 2f; - float num618 = (scaleBase - projectile.ai[1] + 1f) * scaleMult / scaleBase; + Projectile.netUpdate = true; + Vector2 center = Projectile.Center; + center.Y -= baseHeight * Projectile.scale / 2f; + float num618 = (scaleBase - Projectile.ai[1] + 1f) * scaleMult / scaleBase; center.Y -= baseHeight * num618 / 2f; center.Y += 2f; - Projectile segment = Projectile.NewProjectileDirect(center, projectile.velocity, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + Projectile segment = Projectile.NewProjectileDirect(center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 10f, Projectile.ai[1] - 1f); //Defaults to magic if (segment.whoAmI.WithinBounds(Main.maxProjectiles)) { - segment.Calamity().forceMelee = projectile.Calamity().forceMelee; - segment.Calamity().forceRanged = projectile.Calamity().forceRanged; - segment.Calamity().forceMinion = projectile.Calamity().forceMinion; - segment.Calamity().forceRogue = projectile.Calamity().forceRogue; - segment.Calamity().forceTypeless = projectile.Calamity().forceTypeless; - segment.Calamity().forceHostile = projectile.Calamity().forceHostile; + segment.Calamity().forceMelee = Projectile.Calamity().forceMelee; + segment.Calamity().forceRanged = Projectile.Calamity().forceRanged; + segment.Calamity().forceMinion = Projectile.Calamity().forceMinion; + segment.Calamity().forceRogue = Projectile.Calamity().forceRogue; + segment.Calamity().forceTypeless = Projectile.Calamity().forceTypeless; + segment.Calamity().forceHostile = Projectile.Calamity().forceHostile; } } - if (projectile.ai[0] <= 0f) + if (Projectile.ai[0] <= 0f) { float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; + float num623 = (float)Projectile.width / 5f; num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X -= num624 * -projectile.direction; - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X += num624 * -projectile.direction; + float num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; + Projectile.position.X -= num624 * -Projectile.direction; + Projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; + Projectile.position.X += num624 * -Projectile.direction; return; } } @@ -128,17 +128,17 @@ namespace CalamityMod.Projectiles.Magic { if (!intersectingSomething) { - return new Color(95, 95, 19, 255 - projectile.alpha); + return new Color(95, 95, 19, 255 - Projectile.alpha); } - return new Color(64, 64, 13, 255 - projectile.alpha); + return new Color(64, 64, 13, 255 - Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Magic/InfernadoMarkFriendly.cs b/Projectiles/Magic/InfernadoMarkFriendly.cs index 65af55a354..deeda96bb5 100644 --- a/Projectiles/Magic/InfernadoMarkFriendly.cs +++ b/Projectiles/Magic/InfernadoMarkFriendly.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class InfernadoMarkFriendly : ModProjectile @@ -16,52 +17,52 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.magic = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - int num625 = (int)projectile.ai[1] - 1; + int num625 = (int)Projectile.ai[1] - 1; if (num625 < 255) { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 10f) { int num626 = 6; for (int num627 = 0; num627 < num626; num627++) { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + projectile.Center; + Vector2 vector45 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + Projectile.Center; Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); int num628 = Dust.NewDust(vector45 + value15, 0, 0, 244, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); Main.dust[num628].noGravity = true; Main.dust[num628].noLight = true; Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; + Main.dust[num628].velocity -= Projectile.velocity; } - projectile.alpha -= 5; - if (projectile.alpha < 100) + Projectile.alpha -= 5; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } } - Vector2 value16 = Main.player[num625].Center - projectile.Center; + Vector2 value16 = Main.player[num625].Center - Projectile.Center; float num629 = 4f; - num629 += projectile.localAI[0] / 20f; - projectile.velocity = Vector2.Normalize(value16) * num629; + num629 += Projectile.localAI[0] / 20f; + Projectile.velocity = Vector2.Normalize(value16) * num629; if (value16.Length() < 50f) { - projectile.Kill(); + Projectile.Kill(); } } } @@ -69,47 +70,47 @@ namespace CalamityMod.Projectiles.Magic { float num630 = 0.209439516f; float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) + float num632 = (float)(Math.Cos((double)(num630 * Projectile.ai[0])) - 0.5) * num631; + Projectile.velocity.Y = Projectile.velocity.Y - num632; + Projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * Projectile.ai[0])) - 0.5) * num631; + Projectile.velocity.Y = Projectile.velocity.Y + num632; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 10f) { - projectile.alpha -= 5; - if (projectile.alpha < 100) + Projectile.alpha -= 5; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } } } - if (projectile.wet) + if (Projectile.wet) { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); + Projectile.position.Y = Projectile.position.Y - 16f; + Projectile.Kill(); return; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item20, projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 244, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); + int num231 = (int)(Projectile.Center.Y / 16f); + int num232 = (int)(Projectile.Center.X / 16f); int num233 = 100; if (num232 < 10) { @@ -130,13 +131,13 @@ namespace CalamityMod.Projectiles.Magic for (int num234 = num231; num234 < num231 + num233; num234++) { Tile tile = Main.tile[num232, num234]; - if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + if (tile.active() && (Main.tileSolid[(int)tile.TileType] || tile.liquid != 0)) { num231 = num234; break; } } - int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack * 30f, Main.myPlayer, 16f, 16f); + int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 30f, Main.myPlayer, 16f, 16f); Main.projectile[num236].netUpdate = true; } } diff --git a/Projectiles/Magic/InfernalBlade.cs b/Projectiles/Magic/InfernalBlade.cs index 32caefd5f1..6ce482bf7b 100644 --- a/Projectiles/Magic/InfernalBlade.cs +++ b/Projectiles/Magic/InfernalBlade.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class InfernalBlade : ModProjectile @@ -15,57 +16,57 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.timeLeft = 180; - projectile.magic = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); - if (projectile.alpha > 0) + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); + if (Projectile.alpha > 0) { - Main.PlaySound(SoundID.Item9, projectile.Center); - projectile.alpha = 0; - projectile.scale = 1.1f; - projectile.frame = Main.rand.Next(14); + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); + Projectile.alpha = 0; + Projectile.scale = 1.1f; + Projectile.frame = Main.rand.Next(14); float num98 = 16f; int num99 = 0; while ((float)num99 < num98) { Vector2 vector11 = Vector2.UnitX * 0f; vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default); - int num100 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 0, default, 1f); + vector11 = vector11.RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num100 = Dust.NewDust(Projectile.Center, 0, 0, 182, 0f, 0f, 0, default, 1f); Main.dust[num100].scale = 1.5f; Main.dust[num100].noGravity = true; - Main.dust[num100].position = projectile.Center + vector11; - Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; + Main.dust[num100].position = Projectile.Center + vector11; + Main.dust[num100].velocity = Projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; num99++; } } - projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; + Projectile.rotation = Projectile.velocity.ToRotation() + 0.7853982f; } public override void Kill(int timeLeft) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Item10, projectile.position); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); int dustAmt = Main.rand.Next(4, 10); for (int d = 0; d < dustAmt; d++) { - int fire = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.velocity *= 1.6f; dust.velocity.Y -= 1f; - dust.velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; + dust.velocity += -Projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; dust.scale = 2f; dust.fadeIn = 0.5f; dust.noGravity = true; @@ -77,39 +78,39 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.projectileTexture[projectile.type]; - int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num155 * projectile.frame; + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.projectileTexture[Projectile.type]; + int num155 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y3 = num155 * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num155); Vector2 origin2 = rectangle.Size() / 2f; float num158 = 0f; int num156 = 3; int num157 = 1; float value4 = 8f; - rectangle = new Rectangle(38 * projectile.frame, 0, 38, 38); + rectangle = new Rectangle(38 * Projectile.frame, 0, 38, 38); origin2 = rectangle.Size() / 2f; for (int num159 = 1; num159 < num156; num159 += num157) { Color color26 = color25; - color26 = projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value5 = projectile.oldPos[num159]; - float num160 = projectile.rotation; + color26 = Projectile.GetAlpha(color26); + color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + Vector2 value5 = Projectile.oldPos[num159]; + float num160 = Projectile.rotation; SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) + if (ProjectileID.Sets.TrailingMode[Projectile.type] == 2) { - num160 = projectile.oldRot[num159]; - effects = (projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + num160 = Projectile.oldRot[num159]; + effects = (Projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; } - Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); + Main.spriteBatch.Draw(texture2D3, value5 + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + Projectile.rotation * num158 * (float)(num159 - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, MathHelper.Lerp(Projectile.scale, value4, (float)num159 / 15f), effects, 0f); } - Color color28 = projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + Color color28 = Projectile.GetAlpha(color25); + Main.spriteBatch.Draw(texture2D3, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, Projectile.rotation, origin2, Projectile.scale, spriteEffects, 0f); return false; } @@ -127,9 +128,9 @@ namespace CalamityMod.Projectiles.Magic private void OnHitEffects(Vector2 targetPos) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), 1f, projectile.owner, true); + CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), 1f, Projectile.owner, true); } } } diff --git a/Projectiles/Magic/InfernalBlade2.cs b/Projectiles/Magic/InfernalBlade2.cs index 01eb1032e0..c94a3bbc95 100644 --- a/Projectiles/Magic/InfernalBlade2.cs +++ b/Projectiles/Magic/InfernalBlade2.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class InfernalBlade2 : ModProjectile @@ -17,57 +18,57 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 2; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 180; - projectile.magic = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 2; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); - if (projectile.alpha > 0) + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); + if (Projectile.alpha > 0) { - Main.PlaySound(SoundID.Item9, projectile.Center); - projectile.alpha = 0; - projectile.scale = 1.1f; - projectile.frame = Main.rand.Next(14); + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); + Projectile.alpha = 0; + Projectile.scale = 1.1f; + Projectile.frame = Main.rand.Next(14); float num98 = 16f; int num99 = 0; while ((float)num99 < num98) { Vector2 vector11 = Vector2.UnitX * 0f; vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default); - int num100 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 0, default, 1f); + vector11 = vector11.RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num100 = Dust.NewDust(Projectile.Center, 0, 0, 182, 0f, 0f, 0, default, 1f); Main.dust[num100].scale = 1.5f; Main.dust[num100].noGravity = true; - Main.dust[num100].position = projectile.Center + vector11; - Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; + Main.dust[num100].position = Projectile.Center + vector11; + Main.dust[num100].velocity = Projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; num99++; } } - projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; + Projectile.rotation = Projectile.velocity.ToRotation() + 0.7853982f; } public override void Kill(int timeLeft) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Item10, projectile.position); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); int num487 = Main.rand.Next(4, 10); for (int num488 = 0; num488 < num487; num488++) { - int num489 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); + int num489 = Dust.NewDust(Projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); Main.dust[num489].velocity *= 1.6f; Dust expr_FEDF_cp_0 = Main.dust[num489]; expr_FEDF_cp_0.velocity.Y -= 1f; - Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; + Main.dust[num489].velocity += -Projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; Main.dust[num489].scale = 2f; Main.dust[num489].fadeIn = 0.5f; Main.dust[num489].noGravity = true; @@ -82,39 +83,39 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.projectileTexture[projectile.type]; - int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num155 * projectile.frame; + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.projectileTexture[Projectile.type]; + int num155 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y3 = num155 * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num155); Vector2 origin2 = rectangle.Size() / 2f; float num158 = 0f; int num156 = 3; int num157 = 1; float value4 = 8f; - rectangle = new Rectangle(38 * projectile.frame, 0, 38, 38); + rectangle = new Rectangle(38 * Projectile.frame, 0, 38, 38); origin2 = rectangle.Size() / 2f; for (int num159 = 1; num159 < num156; num159 += num157) { Color color26 = color25; - color26 = projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value5 = projectile.oldPos[num159]; - float num160 = projectile.rotation; + color26 = Projectile.GetAlpha(color26); + color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + Vector2 value5 = Projectile.oldPos[num159]; + float num160 = Projectile.rotation; SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) + if (ProjectileID.Sets.TrailingMode[Projectile.type] == 2) { - num160 = projectile.oldRot[num159]; - effects = (projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + num160 = Projectile.oldRot[num159]; + effects = (Projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; } - Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); + Main.spriteBatch.Draw(texture2D3, value5 + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + Projectile.rotation * num158 * (float)(num159 - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, MathHelper.Lerp(Projectile.scale, value4, (float)num159 / 15f), effects, 0f); } - Color color28 = projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + Color color28 = Projectile.GetAlpha(color25); + Main.spriteBatch.Draw(texture2D3, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, Projectile.rotation, origin2, Projectile.scale, spriteEffects, 0f); return false; } diff --git a/Projectiles/Magic/IonBlast.cs b/Projectiles/Magic/IonBlast.cs index 32412ec0de..0af76bd9cf 100644 --- a/Projectiles/Magic/IonBlast.cs +++ b/Projectiles/Magic/IonBlast.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class IonBlast : ModProjectile @@ -12,73 +13,73 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.ignoreWater = false; - projectile.timeLeft = 120; - projectile.magic = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.ignoreWater = false; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; - projectile.velocity.X *= 1.015f; - projectile.velocity.Y *= 1.015f; - if (projectile.alpha > 0) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + Projectile.velocity.X *= 1.015f; + Projectile.velocity.Y *= 1.015f; + if (Projectile.alpha > 0) { - projectile.alpha -= 3; + Projectile.alpha -= 3; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 1f, 0f, 0.2f); + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 1f, 0f, 0.2f); float num55 = 100f; float num56 = 3f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); } } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item92, projectile.Center); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 32; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item92, Projectile.Center); int num212 = Main.rand.Next(15, 30); for (int num213 = 0; num213 < num212; num213++) { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 130, 0f, 0f, 100, default, 1f); + int num214 = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 130, 0f, 0f, 100, default, 1f); Main.dust[num214].velocity *= 2f; Main.dust[num214].noGravity = true; } @@ -91,7 +92,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/KeelhaulBubble.cs b/Projectiles/Magic/KeelhaulBubble.cs index 84159f45e6..0c5db3dd2a 100644 --- a/Projectiles/Magic/KeelhaulBubble.cs +++ b/Projectiles/Magic/KeelhaulBubble.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; } public override void Kill(int timeLeft) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 80f, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 80f, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y - 80f, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y - 80f, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Magic/KeelhaulGeyserBottom.cs b/Projectiles/Magic/KeelhaulGeyserBottom.cs index 0c26061c70..ac0282bd6d 100644 --- a/Projectiles/Magic/KeelhaulGeyserBottom.cs +++ b/Projectiles/Magic/KeelhaulGeyserBottom.cs @@ -7,34 +7,34 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Geyser"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 158; - projectile.height = 188; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = 180; - projectile.alpha = 90; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 158; + Projectile.height = 188; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.alpha = 90; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; } } } diff --git a/Projectiles/Magic/KeelhaulGeyserTop.cs b/Projectiles/Magic/KeelhaulGeyserTop.cs index ae6783388f..273d081482 100644 --- a/Projectiles/Magic/KeelhaulGeyserTop.cs +++ b/Projectiles/Magic/KeelhaulGeyserTop.cs @@ -7,34 +7,34 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Geyser"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 158; - projectile.height = 188; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = 180; - projectile.alpha = 90; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 158; + Projectile.height = 188; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.alpha = 90; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; } } } diff --git a/Projectiles/Magic/LightBall.cs b/Projectiles/Magic/LightBall.cs index 15b95e91ff..486ae8c1f2 100644 --- a/Projectiles/Magic/LightBall.cs +++ b/Projectiles/Magic/LightBall.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class LightBall : ModProjectile @@ -13,41 +14,41 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.alpha = 60; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.magic = true; + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.alpha = 60; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); - projectile.velocity.X *= 0.995f; - projectile.velocity.Y *= 0.995f; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0.5f); + Projectile.velocity.X *= 0.995f; + Projectile.velocity.Y *= 0.995f; + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 200, projectile.alpha); + return new Color(255, 255, 200, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 300; - projectile.height = 300; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 300; + Projectile.height = 300; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -57,10 +58,10 @@ namespace CalamityMod.Projectiles.Magic } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Magic/LightBallExplosion.cs b/Projectiles/Magic/LightBallExplosion.cs index 11af6c22cc..6fa2c958fb 100644 --- a/Projectiles/Magic/LightBallExplosion.cs +++ b/Projectiles/Magic/LightBallExplosion.cs @@ -12,15 +12,15 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 300; - projectile.height = 300; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 300; + Projectile.height = 300; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } } } diff --git a/Projectiles/Magic/LightBead.cs b/Projectiles/Magic/LightBead.cs index 750bad1d36..6e9915b386 100644 --- a/Projectiles/Magic/LightBead.cs +++ b/Projectiles/Magic/LightBead.cs @@ -13,59 +13,59 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.alpha = 50; - projectile.scale = 1.2f; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.magic = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.alpha = 50; + Projectile.scale = 1.2f; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); - projectile.rotation += projectile.velocity.X * 0.2f; - projectile.ai[1] += 1f; + Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0.5f); + Projectile.rotation += Projectile.velocity.X * 0.2f; + Projectile.ai[1] += 1f; if (Main.rand.NextBool(5)) { - Dust whiteMagic = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, default, 1f); + Dust whiteMagic = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, default, 1f); whiteMagic.noGravity = true; whiteMagic.velocity *= 0.5f; whiteMagic.scale *= 0.9f; } - if (projectile.ai[1] > 300f) + if (Projectile.ai[1] > 300f) { - projectile.scale -= 0.05f; - if (projectile.scale <= 0.2f) + Projectile.scale -= 0.05f; + if (Projectile.scale <= 0.2f) { - projectile.scale = 0.2f; - projectile.Kill(); + Projectile.scale = 0.2f; + Projectile.Kill(); return; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 15f, 15f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 15f, 15f); } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 200, projectile.alpha); + return new Color(255, 255, 200, Projectile.alpha); } public override void Kill(int timeLeft) { for (int k = 0; k < 4; k++) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); int beadAmt = Main.rand.Next(2, 3); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int b = 0; b < beadAmt; b++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Magic/LightBeadSplit.cs b/Projectiles/Magic/LightBeadSplit.cs index bb9b8e25bd..3620e35cee 100644 --- a/Projectiles/Magic/LightBeadSplit.cs +++ b/Projectiles/Magic/LightBeadSplit.cs @@ -13,28 +13,28 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.alpha = 50; - projectile.scale = 0.6f; - projectile.penetrate = 1; - projectile.timeLeft = 400; - projectile.magic = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.alpha = 50; + Projectile.scale = 0.6f; + Projectile.penetrate = 1; + Projectile.timeLeft = 400; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f); - projectile.rotation += projectile.velocity.X * 0.2f; - projectile.velocity *= 0.985f; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); + Projectile.rotation += Projectile.velocity.X * 0.2f; + Projectile.velocity *= 0.985f; } public override void Kill(int timeLeft) { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 212, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 212, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/LightBlade.cs b/Projectiles/Magic/LightBlade.cs index b58228ff17..c5970a690d 100644 --- a/Projectiles/Magic/LightBlade.cs +++ b/Projectiles/Magic/LightBlade.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -22,71 +23,71 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Light Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = NumAfterimages; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = NumAfterimages; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.scale = 1.5f; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = 2; - projectile.extraUpdates = 2; - projectile.timeLeft = Lifetime; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.scale = 1.5f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = 2; + Projectile.extraUpdates = 2; + Projectile.timeLeft = Lifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { // The sprite is diagonal, so rotate by pi/4 - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; // These effects only occur on the first frame. Alpha is set to 0 immediately on frame 1. - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha = 0; + Projectile.alpha = 0; FirstFrameEffects(); // Store original velocity for homing calculations - projectile.ai[0] = projectile.velocity.Length(); + Projectile.ai[0] = Projectile.velocity.Length(); } // Every other frame, add less light. else - Lighting.AddLight(projectile.Center, lightColor.ToVector3() * LightBrightness); + Lighting.AddLight(Projectile.Center, lightColor.ToVector3() * LightBrightness); // Home in on the paired sword, if one is defined and it exists - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - Projectile paired = Main.projectile[(int)(projectile.ai[1] - 1)]; + Projectile paired = Main.projectile[(int)(Projectile.ai[1] - 1)]; if (paired is null || !paired.active || paired.type != ModContent.ProjectileType()) - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; else { - Vector2 homingVec = projectile.SafeDirectionTo(paired.Center) * projectile.ai[0]; - projectile.velocity = (projectile.velocity * (SwordHomingStrength - 1f) + homingVec) / SwordHomingStrength; + Vector2 homingVec = Projectile.SafeDirectionTo(paired.Center) * Projectile.ai[0]; + Projectile.velocity = (Projectile.velocity * (SwordHomingStrength - 1f) + homingVec) / SwordHomingStrength; } } // Also weakly home in on nearby enemies - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, projectile.ai[0], EnemyHomingStrength); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, Projectile.ai[0], EnemyHomingStrength); // The projectile never slows down, even as it tries to curve towards enemies and its paired sword. - float currentSpeed = projectile.velocity.Length(); - projectile.velocity *= projectile.ai[0] / currentSpeed; + float currentSpeed = Projectile.velocity.Length(); + Projectile.velocity *= Projectile.ai[0] / currentSpeed; } private void FirstFrameEffects() { // Pick a random sword sprite and a random color to use. - projectile.frame = Main.rand.Next(14); + Projectile.frame = Main.rand.Next(14); lightColor = Judgement.GetRandomLightColor(); // Spawn starting dust. @@ -95,9 +96,9 @@ namespace CalamityMod.Projectiles.Magic for(int i = 0; i < numDust; ++i) { Vector2 dustOffset = Vector2.UnitY.RotatedBy(i * MathHelper.TwoPi / numDust) * baseOffsetVec; - dustOffset = dustOffset.RotatedBy(projectile.velocity.ToRotation()); - Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, DustID, 0f, 0f); - d.position = projectile.Center + dustOffset; + dustOffset = dustOffset.RotatedBy(Projectile.velocity.ToRotation()); + Dust d = Dust.NewDustDirect(Projectile.Center, 0, 0, DustID, 0f, 0f); + d.position = Projectile.Center + dustOffset; d.velocity = dustOffset.SafeNormalize(Vector2.Zero); d.velocity *= 1.4f; d.scale = 1.5f; @@ -106,21 +107,21 @@ namespace CalamityMod.Projectiles.Magic // Each blade appears in a huge flash of light. float startingBrightness = LightBrightness * 3f; - Lighting.AddLight(projectile.Center, lightColor.ToVector3() * startingBrightness); + Lighting.AddLight(Projectile.Center, lightColor.ToVector3() * startingBrightness); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer calPlayer = player.Calamity(); calPlayer.danceOfLightCharge++; if (calPlayer.danceOfLightCharge >= Judgement.HitsPerFlash) { calPlayer.danceOfLightCharge = 0; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { int flashDamage = (int)(Judgement.FlashBaseDamage * player.MagicDamage()); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), flashDamage, 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), flashDamage, 0f, Projectile.owner); } } @@ -128,13 +129,13 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCHit3, projectile.position); + SoundEngine.PlaySound(SoundID.NPCHit3, Projectile.position); int numDust = Main.rand.Next(4, 10); for (int i = 0; i < numDust; i++) { - Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, DustID, 0f, 0f, 100); + Dust d = Dust.NewDustDirect(Projectile.Center, 0, 0, DustID, 0f, 0f, 100); d.velocity *= 1.6f; - d.velocity += projectile.velocity * Main.rand.NextFloat(-0.5f, 0.5f); + d.velocity += Projectile.velocity * Main.rand.NextFloat(-0.5f, 0.5f); d.velocity.Y += -1f; d.noGravity = true; d.scale = 2f; @@ -147,33 +148,33 @@ namespace CalamityMod.Projectiles.Magic // Uses bizarre drawcode because it has a horizontal sprite sheet public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Point projTile = projectile.Center.ToTileCoordinates(); + Point projTile = Projectile.Center.ToTileCoordinates(); Color localLight = Lighting.GetColor(projTile.X, projTile.Y); - Texture2D tex = Main.projectileTexture[projectile.type]; - Rectangle rect = new Rectangle(38 * projectile.frame, 0, 38, 38); + Texture2D tex = Main.projectileTexture[Projectile.type]; + Rectangle rect = new Rectangle(38 * Projectile.frame, 0, 38, 38); Vector2 halfSpriteSize = rect.Size() / 2f; // Draw the projectile itself - Color mainSwordColor = projectile.GetAlpha(localLight); + Color mainSwordColor = Projectile.GetAlpha(localLight); mainSwordColor.A = 160; - SpriteEffects sfx = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - spriteBatch.Draw(tex, drawPos, new Rectangle?(rect), mainSwordColor, projectile.rotation, halfSpriteSize, projectile.scale, sfx, 0f); + SpriteEffects sfx = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + spriteBatch.Draw(tex, drawPos, new Rectangle?(rect), mainSwordColor, Projectile.rotation, halfSpriteSize, Projectile.scale, sfx, 0f); // Draw the projectile's afterimages for (int i = 0; i < NumAfterimages; ++i) { - Color afterimageLight = projectile.GetAlpha(localLight); + Color afterimageLight = Projectile.GetAlpha(localLight); afterimageLight.A = 40; float posLerp = 1f; - Vector2 afterimagePos = (1f - posLerp) * projectile.position + posLerp * projectile.oldPos[i]; - float rotation = projectile.oldRot[i]; - SpriteEffects afterimageSfx = projectile.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - float afterimageScale = MathHelper.Lerp(1.2f * projectile.scale, 0.4f * projectile.scale, i / (NumAfterimages - 1f)); + Vector2 afterimagePos = (1f - posLerp) * Projectile.position + posLerp * Projectile.oldPos[i]; + float rotation = Projectile.oldRot[i]; + SpriteEffects afterimageSfx = Projectile.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + float afterimageScale = MathHelper.Lerp(1.2f * Projectile.scale, 0.4f * Projectile.scale, i / (NumAfterimages - 1f)); - Vector2 imageDrawPos = afterimagePos + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Vector2 imageDrawPos = afterimagePos + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); spriteBatch.Draw(tex, imageDrawPos, new Rectangle?(rect), afterimageLight, rotation, halfSpriteSize, afterimageScale, afterimageSfx, 0f); } diff --git a/Projectiles/Magic/LightningArc.cs b/Projectiles/Magic/LightningArc.cs index 3271b0cb84..11a0831af7 100644 --- a/Projectiles/Magic/LightningArc.cs +++ b/Projectiles/Magic/LightningArc.cs @@ -18,16 +18,16 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.alpha = 255; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.timeLeft = 20; - projectile.penetrate = 6; - projectile.tileCollide = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 20; + Projectile.penetrate = 6; + Projectile.tileCollide = true; } @@ -36,23 +36,23 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { //projectile.alpha exists - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - AdjustMagnitude(ref projectile.velocity); - projectile.localAI[0] = 1f; + AdjustMagnitude(ref Projectile.velocity); + Projectile.localAI[0] = 1f; } Vector2 move = Vector2.Zero; float distance = 160f; bool target = false; NPC npc = null; bool pastNPC = false; - if (projectile.timeLeft < 18) + if (Projectile.timeLeft < 18) { for (int k = 0; k < Main.maxNPCs; k++) { if (Main.npc[k].active && !Main.npc[k].dontTakeDamage && !Main.npc[k].friendly && Main.npc[k].lifeMax > 5 && !shockedbefore.Contains(Main.npc[k])) { - Vector2 newMove = Main.npc[k].Center - (projectile.velocity + projectile.Center); + Vector2 newMove = Main.npc[k].Center - (Projectile.velocity + Projectile.Center); float distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y); if (distanceTo < distance) { @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic //if not found, look through npcs that have been shocked before if (!target) { foreach (NPC pastnpc in shockedbefore) { - Vector2 newMove = pastnpc.Center -(projectile.velocity + projectile.Center); + Vector2 newMove = pastnpc.Center -(Projectile.velocity + Projectile.Center); float distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y); if (distanceTo < distance) { @@ -83,11 +83,11 @@ namespace CalamityMod.Projectiles.Magic // Main.dust[dust].velocity /= 2f; - Vector2 current = projectile.Center; + Vector2 current = Projectile.Center; if (target) { shockedbefore.Add(npc); - npc.HitEffect(0, projectile.damage); + npc.HitEffect(0, Projectile.damage); //AdjustMagnitude(ref move); //AdjustMagnitude(ref projectile.velocity); //projectile.velocity = (10 * projectile.velocity + move) / 11f; @@ -101,15 +101,15 @@ namespace CalamityMod.Projectiles.Magic } else { - move = (projectile.velocity+ new Vector2(Main.rand.Next(-10, 10), Main.rand.Next(-10, 10)))*5; + move = (Projectile.velocity+ new Vector2(Main.rand.Next(-10, 10), Main.rand.Next(-10, 10)))*5; } for (int i = 0; i < 20; i++) { - int dust = Dust.NewDust(current, projectile.width, projectile.height, 20, 0, 0); + int dust = Dust.NewDust(current, Projectile.width, Projectile.height, 20, 0, 0); Main.dust[dust].velocity = new Vector2(0); current += move / 20f; } - projectile.position = current; + Projectile.position = current; /*int tx = (int)(projectile.position.X / 16f); int ty = (int)(projectile.position.Y / 16f); @@ -139,8 +139,8 @@ namespace CalamityMod.Projectiles.Magic } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.velocity = oldVelocity; - projectile.timeLeft -= 12; + Projectile.velocity = oldVelocity; + Projectile.timeLeft -= 12; return false; } diff --git a/Projectiles/Magic/LiquidBlade.cs b/Projectiles/Magic/LiquidBlade.cs index ef1997ec9c..fe1a5f9632 100644 --- a/Projectiles/Magic/LiquidBlade.cs +++ b/Projectiles/Magic/LiquidBlade.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -18,58 +19,58 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.timeLeft = 180; - projectile.magic = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 3; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); - if (projectile.alpha > 0) + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); + if (Projectile.alpha > 0) { - Main.PlaySound(SoundID.Item9, projectile.position); - projectile.alpha = 0; - projectile.scale = 1.1f; - projectile.frame = Main.rand.Next(14); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); + Projectile.alpha = 0; + Projectile.scale = 1.1f; + Projectile.frame = Main.rand.Next(14); float num98 = 16f; int num99 = 0; while ((float)num99 < num98) { Vector2 vector11 = Vector2.UnitX * 0f; vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default); - int num100 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + vector11 = vector11.RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num100 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[num100].scale = 1.5f; Main.dust[num100].noGravity = true; - Main.dust[num100].position = projectile.Center + vector11; - Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; + Main.dust[num100].position = Projectile.Center + vector11; + Main.dust[num100].velocity = Projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; num99++; } } - projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; + Projectile.rotation = Projectile.velocity.ToRotation() + 0.7853982f; } public override void Kill(int timeLeft) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Item10, projectile.position); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); int num487 = Main.rand.Next(4, 10); for (int num488 = 0; num488 < num487; num488++) { - int num489 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int num489 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Dust dust = Main.dust[num489]; dust.velocity *= 1.6f; dust.velocity.Y -= 1f; - dust.velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; + dust.velocity += -Projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; dust.scale = 2f; dust.fadeIn = 0.5f; dust.noGravity = true; @@ -84,39 +85,39 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.projectileTexture[projectile.type]; - int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num155 * projectile.frame; + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.projectileTexture[Projectile.type]; + int num155 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y3 = num155 * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num155); Vector2 origin2 = rectangle.Size() / 2f; float num158 = 0f; int num156 = 3; int num157 = 1; float value4 = 8f; - rectangle = new Rectangle(38 * projectile.frame, 0, 38, 38); + rectangle = new Rectangle(38 * Projectile.frame, 0, 38, 38); origin2 = rectangle.Size() / 2f; for (int num159 = 1; num159 < num156; num159 += num157) { Color color26 = color25; - color26 = projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value5 = projectile.oldPos[num159]; - float num160 = projectile.rotation; + color26 = Projectile.GetAlpha(color26); + color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + Vector2 value5 = Projectile.oldPos[num159]; + float num160 = Projectile.rotation; SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) + if (ProjectileID.Sets.TrailingMode[Projectile.type] == 2) { - num160 = projectile.oldRot[num159]; - effects = (projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + num160 = Projectile.oldRot[num159]; + effects = (Projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; } - Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); + Main.spriteBatch.Draw(texture2D3, value5 + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + Projectile.rotation * num158 * (float)(num159 - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, MathHelper.Lerp(Projectile.scale, value4, (float)num159 / 15f), effects, 0f); } - Color color28 = projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + Color color28 = Projectile.GetAlpha(color25); + Main.spriteBatch.Draw(texture2D3, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, Projectile.rotation, origin2, Projectile.scale, spriteEffects, 0f); return false; } @@ -138,9 +139,9 @@ namespace CalamityMod.Projectiles.Magic private void OnHitEffects(Vector2 targetPos) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), 1f, projectile.owner, true); + CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), 1f, Projectile.owner, true); } } } diff --git a/Projectiles/Magic/LiquidBlade2.cs b/Projectiles/Magic/LiquidBlade2.cs index e75bfcf194..a67e930212 100644 --- a/Projectiles/Magic/LiquidBlade2.cs +++ b/Projectiles/Magic/LiquidBlade2.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -18,58 +19,58 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 180; - projectile.magic = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 3; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); - if (projectile.alpha > 0) + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); + if (Projectile.alpha > 0) { - Main.PlaySound(SoundID.Item9, projectile.position); - projectile.alpha = 0; - projectile.scale = 1.1f; - projectile.frame = Main.rand.Next(14); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); + Projectile.alpha = 0; + Projectile.scale = 1.1f; + Projectile.frame = Main.rand.Next(14); float num98 = 16f; int num99 = 0; while ((float)num99 < num98) { Vector2 vector11 = Vector2.UnitX * 0f; vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default); - int num100 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + vector11 = vector11.RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num100 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[num100].scale = 1.5f; Main.dust[num100].noGravity = true; - Main.dust[num100].position = projectile.Center + vector11; - Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; + Main.dust[num100].position = Projectile.Center + vector11; + Main.dust[num100].velocity = Projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; num99++; } } - projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; + Projectile.rotation = Projectile.velocity.ToRotation() + 0.7853982f; } public override void Kill(int timeLeft) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Item10, projectile.position); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); int num487 = Main.rand.Next(4, 10); for (int num488 = 0; num488 < num487; num488++) { - int num489 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int num489 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Dust dust = Main.dust[num489]; dust.velocity *= 1.6f; dust.velocity.Y -= 1f; - dust.velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; + dust.velocity += -Projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; dust.scale = 2f; dust.fadeIn = 0.5f; dust.noGravity = true; @@ -84,39 +85,39 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.projectileTexture[projectile.type]; - int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num155 * projectile.frame; + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.projectileTexture[Projectile.type]; + int num155 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y3 = num155 * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num155); Vector2 origin2 = rectangle.Size() / 2f; float num158 = 0f; int num156 = 3; int num157 = 1; float value4 = 8f; - rectangle = new Rectangle(38 * projectile.frame, 0, 38, 38); + rectangle = new Rectangle(38 * Projectile.frame, 0, 38, 38); origin2 = rectangle.Size() / 2f; for (int num159 = 1; num159 < num156; num159 += num157) { Color color26 = color25; - color26 = projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value5 = projectile.oldPos[num159]; - float num160 = projectile.rotation; + color26 = Projectile.GetAlpha(color26); + color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + Vector2 value5 = Projectile.oldPos[num159]; + float num160 = Projectile.rotation; SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) + if (ProjectileID.Sets.TrailingMode[Projectile.type] == 2) { - num160 = projectile.oldRot[num159]; - effects = (projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + num160 = Projectile.oldRot[num159]; + effects = (Projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; } - Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); + Main.spriteBatch.Draw(texture2D3, value5 + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + Projectile.rotation * num158 * (float)(num159 - 1) * (float)-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, MathHelper.Lerp(Projectile.scale, value4, (float)num159 / 15f), effects, 0f); } - Color color28 = projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + Color color28 = Projectile.GetAlpha(color25); + Main.spriteBatch.Draw(texture2D3, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, Projectile.rotation, origin2, Projectile.scale, spriteEffects, 0f); return false; } diff --git a/Projectiles/Magic/LuxorsGiftMagic.cs b/Projectiles/Magic/LuxorsGiftMagic.cs index 4ae57912f7..18405f2b49 100644 --- a/Projectiles/Magic/LuxorsGiftMagic.cs +++ b/Projectiles/Magic/LuxorsGiftMagic.cs @@ -12,72 +12,72 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Gift"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 2; - projectile.alpha = 255; - projectile.timeLeft = 240; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 2; + Projectile.alpha = 255; + Projectile.timeLeft = 240; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.localAI[0] == 0f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + if (Projectile.localAI[0] == 0f) { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 250) + Projectile.scale -= 0.01f; + Projectile.alpha += 15; + if (Projectile.alpha >= 250) { - projectile.alpha = 255; - projectile.localAI[0] = 1f; + Projectile.alpha = 255; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[0] = 0f; + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; } } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 3f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 3f) { for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.velocity *= 0.25f; + Projectile.velocity *= 0.25f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs index 1f81acb5d1..d9cffe42aa 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class MadAlchemistsCocktailAlt : ModProjectile @@ -15,26 +16,26 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; } public override void AI() { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) + Projectile.rotation += Math.Abs(Projectile.velocity.X) * 0.04f * (float)Projectile.direction; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 90f) { - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.97f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.4f; + Projectile.velocity.X = Projectile.velocity.X * 0.97f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } @@ -54,45 +55,45 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item20, projectile.Center); - Main.PlaySound(SoundID.Item107, projectile.Center); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); + Gore.NewGore(Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); + Gore.NewGore(Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); // This previously did double damage. It now does half damage. int blastWidth = 120; - projectile.position = projectile.Center; - projectile.width = projectile.height = blastWidth; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.damage /= 2; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = blastWidth; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.damage /= 2; + Projectile.Damage(); // I don't even know what this dust code does float num51 = 1.8f; float num52 = 2.5f; Vector2 value3 = (0f - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; + Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; int num3; for (int num53 = 0; num53 < 40; num53 = num3 + 1) { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 200, default, num52); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 200, default, num52); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 4f; dust = Main.dust[num54]; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, num51); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 3f; Main.dust[num54].noGravity = true; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 100, default, num51); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; Main.dust[num54].noGravity = true; @@ -104,8 +105,8 @@ namespace CalamityMod.Projectiles.Magic } for (int num55 = 0; num55 < 20; num55 = num3 + 1) { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 0, default, num52); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; dust.velocity *= 0.5f; diff --git a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs index 10d5271901..167af336ea 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -15,45 +16,45 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; } public override void AI() { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) + Projectile.rotation += Math.Abs(Projectile.velocity.X) * 0.04f * (float)Projectile.direction; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 90f) { - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.97f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.4f; + Projectile.velocity.X = Projectile.velocity.X * 0.97f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item107, projectile.position); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); + SoundEngine.PlaySound(SoundID.Item107, Projectile.position); + Gore.NewGore(Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); + Gore.NewGore(Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); int numClouds = 9; - int cloudDamage = projectile.damage / 2; - if (projectile.owner == Main.myPlayer) + int cloudDamage = Projectile.damage / 2; + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numClouds; i++) { Vector2 v = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); v.Normalize(); v *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, v.X, v.Y, ModContent.ProjectileType(), cloudDamage, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, v.X, v.Y, ModContent.ProjectileType(), cloudDamage, 0f, Projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs b/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs index 4b293f2b44..6fd6943559 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs @@ -10,35 +10,35 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; // Only one gas cloud can hit at once. - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 9; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 9; } public override void AI() { - projectile.ai[1] += 1f; - if (projectile.ai[1] > 60f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 60f) { - projectile.ai[0] += 10f; + Projectile.ai[0] += 10f; } - if (projectile.ai[0] > 255f) + if (Projectile.ai[0] > 255f) { - projectile.Kill(); - projectile.ai[0] = 255f; + Projectile.Kill(); + Projectile.ai[0] = 255f; } - projectile.alpha = (int)(100.0 + (double)projectile.ai[0] * 0.7); - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.rotation += (float)projectile.direction * 0.003f; - projectile.velocity *= 0.96f; + Projectile.alpha = (int)(100.0 + (double)Projectile.ai[0] * 0.7); + Projectile.rotation += Projectile.velocity.X * 0.1f; + Projectile.rotation += (float)Projectile.direction * 0.003f; + Projectile.velocity *= 0.96f; } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs index e377c16256..2e7c221d1c 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -15,42 +16,42 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; } public override void AI() { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) + Projectile.rotation += Math.Abs(Projectile.velocity.X) * 0.04f * (float)Projectile.direction; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 90f) { - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.97f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.4f; + Projectile.velocity.X = Projectile.velocity.X * 0.97f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item107, projectile.position); - Main.PlaySound(SoundID.Item88, projectile.position); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); + SoundEngine.PlaySound(SoundID.Item107, Projectile.position); + SoundEngine.PlaySound(SoundID.Item88, Projectile.position); + Gore.NewGore(Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); + Gore.NewGore(Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); for (int i = 0; i < 3; i++) { - float x = projectile.position.X + (float)Main.rand.Next(-100, 100); - float y = projectile.position.Y - (float)Main.rand.Next(500, 600); + float x = Projectile.position.X + (float)Main.rand.Next(-100, 100); + float y = Projectile.position.Y - (float)Main.rand.Next(500, 600); Vector2 vector = new Vector2(x, y); - float num15 = projectile.position.X + (float)(projectile.width / 2) - vector.X; - float num16 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; + float num15 = Projectile.position.X + (float)(Projectile.width / 2) - vector.X; + float num16 = Projectile.position.Y + (float)(Projectile.height / 2) - vector.Y; num15 += (float)Main.rand.Next(-100, 101); int num17 = 25; float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); @@ -58,9 +59,9 @@ namespace CalamityMod.Projectiles.Magic num15 *= num18; num16 *= num18; - float ai2 = num16 + projectile.position.Y; - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(x, y, num15, num16, ProjectileID.LunarFlare, projectile.damage / 2, 5f, projectile.owner, 0f, ai2); + float ai2 = num16 + Projectile.position.Y; + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(x, y, num15, num16, ProjectileID.LunarFlare, Projectile.damage / 2, 5f, Projectile.owner, 0f, ai2); } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs index 66b80887fe..603ac77a7a 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -15,45 +16,45 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; } public override void AI() { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) + Projectile.rotation += Math.Abs(Projectile.velocity.X) * 0.04f * (float)Projectile.direction; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 90f) { - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.97f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.4f; + Projectile.velocity.X = Projectile.velocity.X * 0.97f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item107, projectile.position); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); + SoundEngine.PlaySound(SoundID.Item107, Projectile.position); + Gore.NewGore(Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); + Gore.NewGore(Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); int numShrapnel = 4; - int shrapnelDamage = projectile.damage / 3; - if (projectile.owner == Main.myPlayer) + int shrapnelDamage = Projectile.damage / 3; + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numShrapnel; i++) { Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); value17.Normalize(); value17 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), shrapnelDamage, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), shrapnelDamage, 0f, Projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailRed.cs b/Projectiles/Magic/MadAlchemistsCocktailRed.cs index f21c8764b8..509395da16 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailRed.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailRed.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -15,67 +16,67 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; } public override void AI() { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) + Projectile.rotation += Math.Abs(Projectile.velocity.X) * 0.04f * (float)Projectile.direction; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 90f) { - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.97f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.4f; + Projectile.velocity.X = Projectile.velocity.X * 0.97f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item20, projectile.Center); - Main.PlaySound(SoundID.Item107, projectile.Center); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); + Gore.NewGore(Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); + Gore.NewGore(Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); // This previously had a width of 480 pixels and did triple damage. // It now has a width of 110 pixels and deals 1/2 damage. int blastWidth = 110; - projectile.position = projectile.Center; - projectile.width = projectile.height = blastWidth; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.damage /= 2; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = blastWidth; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.damage /= 2; + Projectile.Damage(); // I don't even know what this dust code does float num50 = 3f; float num51 = 2.4f; float num52 = 3.8f; Vector2 value3 = (0f - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; + Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; int num3; for (int num53 = 0; num53 < 60; num53 = num3 + 1) { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 200, default, num50); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 200, default, num50); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 8f; dust = Main.dust[num54]; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, num51); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 6f; Main.dust[num54].noGravity = true; @@ -83,8 +84,8 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num54].color = Color.Crimson * 0.5f; dust = Main.dust[num54]; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, num51); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 4f; Main.dust[num54].noGravity = true; @@ -92,8 +93,8 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num54].color = Color.Crimson * 0.5f; dust = Main.dust[num54]; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, num51); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; Main.dust[num54].noGravity = true; @@ -105,8 +106,8 @@ namespace CalamityMod.Projectiles.Magic } for (int num55 = 0; num55 < 30; num55 = num3 + 1) { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 0, default, num52); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; dust.velocity *= 0.5f; diff --git a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs index 1ae76da089..55e36052f2 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs @@ -14,44 +14,44 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.extraUpdates = 1; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.extraUpdates = 1; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { Vector2 value7 = new Vector2(6f, 12f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 48f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } else { for (int num41 = 0; num41 < 2; num41++) { Vector2 value8 = Vector2.UnitX * -15f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 * 0.75f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 0.75f); + value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 * 0.75f; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 0.75f); Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; + Main.dust[num42].position = Projectile.Center + value8; + Main.dust[num42].velocity = Projectile.velocity; } } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); Main.dust[num458].noGravity = true; - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 12f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 12f, 20f); } } } diff --git a/Projectiles/Magic/MagnaBlast.cs b/Projectiles/Magic/MagnaBlast.cs index 6b3d2d79ad..2a21701bbe 100644 --- a/Projectiles/Magic/MagnaBlast.cs +++ b/Projectiles/Magic/MagnaBlast.cs @@ -15,30 +15,30 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 16; - projectile.height = 32; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 16; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - if (projectile.scale <= 1.6f) + if (Projectile.scale <= 1.6f) { - projectile.scale *= 1.01f; - projectile.width = (int)(16f * projectile.scale); - projectile.height = (int)(32f * projectile.scale); + Projectile.scale *= 1.01f; + Projectile.width = (int)(16f * Projectile.scale); + Projectile.height = (int)(32f * Projectile.scale); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.1f / 255f, (255 - projectile.alpha) * 0.1f / 255f, (255 - projectile.alpha) * 1f / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.1f / 255f, (255 - Projectile.alpha) * 0.1f / 255f, (255 - Projectile.alpha) * 1f / 255f); + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 3; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 59, 0f, 0f, 100, default, projectile.scale); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 59, 0f, 0f, 100, default, Projectile.scale); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 59, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 59, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/MagneticBeam.cs b/Projectiles/Magic/MagneticBeam.cs index fc18ce2ac9..23d93eed66 100644 --- a/Projectiles/Magic/MagneticBeam.cs +++ b/Projectiles/Magic/MagneticBeam.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 90; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.extraUpdates = 100; + Projectile.friendly = true; + Projectile.timeLeft = 90; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } public override void AI() { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * 0.25f; int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 1.25f); Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; diff --git a/Projectiles/Magic/MagneticOrb.cs b/Projectiles/Magic/MagneticOrb.cs index 939d7704fc..c0232e06b4 100644 --- a/Projectiles/Magic/MagneticOrb.cs +++ b/Projectiles/Magic/MagneticOrb.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Magnetic Orb"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 38; - projectile.height = 38; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.magic = true; + Projectile.width = 38; + Projectile.height = 38; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Magic; } public override bool CanDamage() => false; @@ -34,53 +34,53 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { // Drift to a stop after being launched - projectile.velocity *= 0.972f; + Projectile.velocity *= 0.972f; // On frame 1, pick a random offset to use for the firing pattern. - if (projectile.timeLeft == Lifetime) - projectile.localAI[0] = Main.rand.NextFloat(0f, FramesPerBeam); + if (Projectile.timeLeft == Lifetime) + Projectile.localAI[0] = Main.rand.NextFloat(0f, FramesPerBeam); // What in the hell does this code do - if (projectile.velocity.X > 0f) + if (Projectile.velocity.X > 0f) { - projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; + Projectile.rotation += (Math.Abs(Projectile.velocity.Y) + Math.Abs(Projectile.velocity.X)) * 0.001f; } else { - projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; + Projectile.rotation -= (Math.Abs(Projectile.velocity.Y) + Math.Abs(Projectile.velocity.X)) * 0.001f; } // Update animation - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 4) + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame > 4) { - projectile.frame = 0; + Projectile.frame = 0; } } - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, FramesPerBeam, 1, ModContent.ProjectileType(), 1D, true); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 8f, FramesPerBeam, 1, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 30) + if (Projectile.timeLeft < 30) { - float num7 = (float)projectile.timeLeft / 30f; - projectile.alpha = (int)(255f - 255f * num7); + float num7 = (float)Projectile.timeLeft / 30f; + Projectile.alpha = (int)(255f - 255f * num7); } - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Magic/MagnusBeam.cs b/Projectiles/Magic/MagnusBeam.cs index c773fdede1..d0e3b3369c 100644 --- a/Projectiles/Magic/MagnusBeam.cs +++ b/Projectiles/Magic/MagnusBeam.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -17,24 +18,24 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.alpha = 0; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.alpha = 0; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); float num29 = 5f; float num30 = 150f; float scaleFactor = 6f; Vector2 value7 = new Vector2(10f, 20f); float num31 = 1f; - int num32 = 3 * projectile.MaxUpdates; + int num32 = 3 * Projectile.MaxUpdates; int num33 = Utils.SelectRandom(Main.rand, new int[] { 56, @@ -44,22 +45,22 @@ namespace CalamityMod.Projectiles.Magic 181 }); int num34 = 261; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - projectile.localAI[0] = (float)-(float)Main.rand.Next(48); + Projectile.ai[1] = 1f; + Projectile.localAI[0] = (float)-(float)Main.rand.Next(48); } - else if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) + else if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) { int num35 = -1; float num36 = num30; for (int num37 = 0; num37 < 200; num37++) { - if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(projectile, false)) + if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(Projectile, false)) { Vector2 center3 = Main.npc[num37].Center; - float num38 = Vector2.Distance(center3, projectile.Center); - if (num38 < num36 && num35 == -1 && Collision.CanHitLine(projectile.Center, 1, 1, center3, 1, 1)) + float num38 = Vector2.Distance(center3, Projectile.Center); + if (num38 < num36 && num35 == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, center3, 1, 1)) { num36 = num38; num35 = num37; @@ -68,33 +69,33 @@ namespace CalamityMod.Projectiles.Magic } if (num36 < 8f) { - projectile.Kill(); + Projectile.Kill(); return; } if (num35 != -1) { - projectile.ai[1] = num29 + 1f; - projectile.ai[0] = (float)num35; - projectile.netUpdate = true; + Projectile.ai[1] = num29 + 1f; + Projectile.ai[0] = (float)num35; + Projectile.netUpdate = true; } } - else if (projectile.ai[1] > num29) + else if (Projectile.ai[1] > num29) { - projectile.ai[1] += 1f; - int num39 = (int)projectile.ai[0]; - if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(projectile, false)) + Projectile.ai[1] += 1f; + int num39 = (int)Projectile.ai[0]; + if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(Projectile, false)) { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 1f; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } else { - projectile.velocity.ToRotation(); - Vector2 vector6 = Main.npc[num39].Center - projectile.Center; + Projectile.velocity.ToRotation(); + Vector2 vector6 = Main.npc[num39].Center - Projectile.Center; if (vector6.Length() < 20f) { - projectile.Kill(); + Projectile.Kill(); return; } if (vector6 != Vector2.Zero) @@ -103,49 +104,49 @@ namespace CalamityMod.Projectiles.Magic vector6 *= scaleFactor; } float num40 = 30f; - projectile.velocity = (projectile.velocity * (num40 - 1f) + vector6) / num40; + Projectile.velocity = (Projectile.velocity * (num40 - 1f) + vector6) / num40; } } - if (projectile.ai[1] >= 1f && projectile.ai[1] < num29) + if (Projectile.ai[1] >= 1f && Projectile.ai[1] < num29) { - projectile.ai[1] += 1f; - if (projectile.ai[1] == num29) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] == num29) { - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 48f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } - else if (projectile.alpha == 0) + else if (Projectile.alpha == 0) { for (int num41 = 0; num41 < 2; num41++) { Vector2 value8 = Vector2.UnitX * -30f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, num34, 0f, 0f, 160, default, 1f); + value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - Projectile.rotation.ToRotationVector2() * 10f; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, num34, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = num31; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8 + projectile.velocity * 2f; - Main.dust[num42].velocity = Vector2.Normalize(projectile.Center + projectile.velocity * 2f * 8f - Main.dust[num42].position) * 2f + projectile.velocity * 2f; + Main.dust[num42].position = Projectile.Center + value8 + Projectile.velocity * 2f; + Main.dust[num42].velocity = Vector2.Normalize(Projectile.Center + Projectile.velocity * 2f * 8f - Main.dust[num42].position) * 2f + Projectile.velocity * 2f; } } if (Main.rand.NextBool(12)) { - Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.2).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num44 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, 0f, 0f, 100, default, 1f); + Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.2).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num44 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, 0f, 0f, 100, default, 1f); Main.dust[num44].velocity *= 0.1f; - Main.dust[num44].position = projectile.Center + value9 * (float)projectile.width / 2f + projectile.velocity * 2f; + Main.dust[num44].position = Projectile.Center + value9 * (float)Projectile.width / 2f + Projectile.velocity * 2f; Main.dust[num44].fadeIn = 0.9f; } if (Main.rand.NextBool(64)) { - Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.4).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num46 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, 0f, 0f, 155, default, 0.8f); + Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.4).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num46 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, 0f, 0f, 155, default, 0.8f); Main.dust[num46].velocity *= 0.3f; - Main.dust[num46].position = projectile.Center + value10 * (float)projectile.width / 2f; + Main.dust[num46].position = Projectile.Center + value10 * (float)Projectile.width / 2f; if (Main.rand.NextBool(2)) { Main.dust[num46].fadeIn = 1.4f; @@ -155,11 +156,11 @@ namespace CalamityMod.Projectiles.Magic { for (int num47 = 0; num47 < 2; num47++) { - Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.8).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num48 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num33, 0f, 0f, 0, default, 1.2f); + Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.8).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num48 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num33, 0f, 0f, 0, default, 1.2f); Main.dust[num48].velocity *= 0.3f; Main.dust[num48].noGravity = true; - Main.dust[num48].position = projectile.Center + value11 * (float)projectile.width / 2f; + Main.dust[num48].position = Projectile.Center + value11 * (float)Projectile.width / 2f; if (Main.rand.NextBool(2)) { Main.dust[num48].fadeIn = 1.4f; @@ -168,37 +169,37 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool(3)) { - Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.2).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num50 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num34, 0f, 0f, 100, default, 1f); + Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.2).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num50 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num34, 0f, 0f, 100, default, 1f); Main.dust[num50].velocity *= 0.3f; - Main.dust[num50].position = projectile.Center + value13 * (float)projectile.width / 2f; + Main.dust[num50].position = Projectile.Center + value13 * (float)Projectile.width / 2f; Main.dust[num50].fadeIn = 1.2f; Main.dust[num50].scale = 1.5f; Main.dust[num50].noGravity = true; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); for (int num151 = 0; num151 < 2; num151++) { int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 263, 0f, 0f, 100, default, 1.35f); + int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 263, 0f, 0f, 100, default, 1.35f); Main.dust[num155].noGravity = true; Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; + Main.dust[num155].velocity += Projectile.velocity * 0.5f; } if (Main.rand.NextBool(8)) { int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 263, 0f, 0f, 100, default, 1f); + int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 263, 0f, 0f, 100, default, 1f); Main.dust[num157].velocity *= 0.25f; Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += projectile.velocity * 0.5f; + Main.dust[num157].velocity += Projectile.velocity * 0.5f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -211,10 +212,10 @@ namespace CalamityMod.Projectiles.Magic { target.AddBuff(ModContent.BuffType(), 480); - if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) + if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) return; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.statLife += 1; player.statMana += 25; player.HealEffect(1); @@ -237,17 +238,17 @@ namespace CalamityMod.Projectiles.Magic float num50 = 1.7f; float num51 = 0.8f; float num52 = 2f; - Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Vector2 value3 = (Projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); for (int num53 = 0; num53 < 40; num53++) { num47 = Utils.SelectRandom(Main.rand, new int[] @@ -258,14 +259,14 @@ namespace CalamityMod.Projectiles.Magic 206, 181 }); - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num47, 0f, 0f, 200, default, num50); + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num47, 0f, 0f, 200, default, num50); Dust dust = Main.dust[num54]; - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num48, 0f, 0f, 100, default, num51); - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num48, 0f, 0f, 100, default, num51); + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.velocity *= 2f; dust.noGravity = true; dust.fadeIn = 1f; @@ -274,9 +275,9 @@ namespace CalamityMod.Projectiles.Magic } for (int num55 = 0; num55 < 20; num55++) { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num49, 0f, 0f, 0, default, num52); + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num49, 0f, 0f, 0, default, num52); Dust dust = Main.dust[num56]; - dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; dust.noGravity = true; dust.velocity *= 0.5f; dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); diff --git a/Projectiles/Magic/ManaBolt.cs b/Projectiles/Magic/ManaBolt.cs index 011d1d951e..7cc48b9416 100644 --- a/Projectiles/Magic/ManaBolt.cs +++ b/Projectiles/Magic/ManaBolt.cs @@ -2,6 +2,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class ManaBolt : ModProjectile @@ -13,47 +14,47 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.magic = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * projectile.direction; - projectile.velocity *= 0.985f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; + Projectile.velocity *= 0.985f; int randomDust = Utils.SelectRandom(Main.rand, new int[] { 15, 107 }); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 15, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 3; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); } } - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); } } } diff --git a/Projectiles/Magic/ManaBoltSmall.cs b/Projectiles/Magic/ManaBoltSmall.cs index 170f634ed8..4612af9cfa 100644 --- a/Projectiles/Magic/ManaBoltSmall.cs +++ b/Projectiles/Magic/ManaBoltSmall.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class ManaBoltSmall : ModProjectile @@ -14,36 +15,36 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 60; - projectile.magic = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 60; + Projectile.DamageType = DamageClass.Magic; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 40 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 40 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - if (projectile.timeLeft < 40) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 450f, 6f, 20f); + if (Projectile.timeLeft < 40) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 450f, 6f, 20f); else - projectile.velocity *= 0.975f; + Projectile.velocity *= 0.975f; - if (projectile.timeLeft % 4 == 0) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + if (Projectile.timeLeft % 4 == 0) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 15, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void Kill(int timeLeft) { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 15, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); } } } diff --git a/Projectiles/Magic/ManaBoltSmall2.cs b/Projectiles/Magic/ManaBoltSmall2.cs index c7ec698aa1..9d09a0268f 100644 --- a/Projectiles/Magic/ManaBoltSmall2.cs +++ b/Projectiles/Magic/ManaBoltSmall2.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class ManaBoltSmall2 : ModProjectile @@ -16,31 +17,31 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 0; - projectile.penetrate = 1; - projectile.timeLeft = 60; - projectile.magic = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.alpha = 0; + Projectile.penetrate = 1; + Projectile.timeLeft = 60; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - if (projectile.timeLeft % 4 == 0) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + Projectile.velocity.X *= 0.975f; + Projectile.velocity.Y *= 0.975f; + if (Projectile.timeLeft % 4 == 0) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void Kill(int timeLeft) { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); } } } diff --git a/Projectiles/Magic/ManaMonster.cs b/Projectiles/Magic/ManaMonster.cs index 8b82332280..b3cd1fdf79 100644 --- a/Projectiles/Magic/ManaMonster.cs +++ b/Projectiles/Magic/ManaMonster.cs @@ -4,44 +4,45 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class ManaMonster : ModProjectile { - public ref float Time => ref projectile.ai[0]; - public Player Target => Main.player[projectile.owner]; + public ref float Time => ref Projectile.ai[0]; + public Player Target => Main.player[Projectile.owner]; public const int NPCAttackTime = 50; public const int PlayerAttackRedirectTime = 45; public override void SetStaticDefaults() { DisplayName.SetDefault("Monster"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = projectile.height = 52; - projectile.friendly = true; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.Opacity = 0f; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.magic = true; + Projectile.width = Projectile.height = 52; + Projectile.friendly = true; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.Opacity = 0f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { if (Time < NPCAttackTime) { - projectile.Opacity = Utils.InverseLerp(0f, 30f, Time, true); - if (projectile.velocity.Length() < 27f) - projectile.velocity *= 1.05f; + Projectile.Opacity = Utils.InverseLerp(0f, 30f, Time, true); + if (Projectile.velocity.Length() < 27f) + Projectile.velocity *= 1.05f; } else { @@ -49,26 +50,26 @@ namespace CalamityMod.Projectiles.Magic if (Time == NPCAttackTime) { int ambientNoiseID = Main.rand.Next(39, 41 + 1); - Main.PlaySound(SoundID.Zombie, Target.Center, ambientNoiseID); - Main.PlaySound(SoundID.DD2_DrakinShot, Target.Center); + SoundEngine.PlaySound(SoundID.Zombie, Target.Center, ambientNoiseID); + SoundEngine.PlaySound(SoundID.DD2_DrakinShot, Target.Center); CreateTransitionBurstDust(); } if (Time < NPCAttackTime + PlayerAttackRedirectTime) { - float idealMovementDirection = projectile.AngleTo(Target.Center); + float idealMovementDirection = Projectile.AngleTo(Target.Center); float angularTurnSpeed = 0.09f; - float newSpeed = MathHelper.Lerp(projectile.velocity.Length(), 22f, 0.1f); - projectile.velocity = projectile.velocity.ToRotation().AngleTowards(idealMovementDirection, angularTurnSpeed).ToRotationVector2() * newSpeed; + float newSpeed = MathHelper.Lerp(Projectile.velocity.Length(), 22f, 0.1f); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(idealMovementDirection, angularTurnSpeed).ToRotationVector2() * newSpeed; } - else if (projectile.velocity.Length() < 35f) - projectile.velocity *= 1.04f; + else if (Projectile.velocity.Length() < 35f) + Projectile.velocity *= 1.04f; // Fade out. - projectile.Opacity = Utils.InverseLerp(0f, 15f, projectile.timeLeft, true); + Projectile.Opacity = Utils.InverseLerp(0f, 15f, Projectile.timeLeft, true); } - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; Time++; } @@ -79,7 +80,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 75; i++) { - Dust brimstone = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Square(-25f, 25f), (int)CalamityDusts.Brimstone); + Dust brimstone = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Square(-25f, 25f), (int)CalamityDusts.Brimstone); brimstone.velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(2f, 3.1f) * MathHelper.Lerp(1f, 2.175f, i / 75f); brimstone.velocity = Vector2.Lerp(brimstone.velocity, -Vector2.UnitY * brimstone.velocity.Length(), 0.5f); brimstone.scale = MathHelper.Lerp(1f, 1.875f, i / 75f) * Main.rand.NextFloat(0.8f, 1f); @@ -91,12 +92,12 @@ namespace CalamityMod.Projectiles.Magic // Ensure damage is not absolutely obscene when hitting players. public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = 102; - public override bool CanDamage() => projectile.Opacity >= 1f; + public override bool CanDamage() => Projectile.Opacity >= 1f; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/MelterAmp.cs b/Projectiles/Magic/MelterAmp.cs index defab26993..f4a2f3db1c 100644 --- a/Projectiles/Magic/MelterAmp.cs +++ b/Projectiles/Magic/MelterAmp.cs @@ -9,63 +9,63 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Melter Amp"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 38; - projectile.friendly = true; - projectile.magic = true; - projectile.netImportant = true; - projectile.penetrate = -1; - projectile.timeLeft = 6000; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 34; + Projectile.height = 38; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.netImportant = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 6000; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void AI() { - bool flag64 = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool flag64 = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; if (flag64) { if (player.dead) { - projectile.active = false; + Projectile.active = false; return; } if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 1) { - projectile.active = false; + Projectile.active = false; return; } if (!player.ActiveItem().magic || player.ActiveItem().shoot != ModContent.ProjectileType()) { - projectile.active = false; + Projectile.active = false; return; } } - Lighting.AddLight(projectile.Center, 0.75f, 0.75f, 0.75f); - if (projectile.ai[0] > 0f) + Lighting.AddLight(Projectile.Center, 0.75f, 0.75f, 0.75f); + if (Projectile.ai[0] > 0f) { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 6f) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; } } - if (Main.myPlayer == projectile.owner && projectile.ai[0] == 0f) + if (Main.myPlayer == Projectile.owner && Projectile.ai[0] == 0f) { - projectile.ai[0] = 1f; - int Damage = projectile.damage; + Projectile.ai[0] = 1f; + int Damage = Projectile.damage; int type; - projectile.netUpdate = true; + Projectile.netUpdate = true; float num127 = 20f; - Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector11 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; if (player.gravDir == -1f) @@ -76,8 +76,8 @@ namespace CalamityMod.Projectiles.Magic if (num130 == 0f) { vector11 = new Vector2(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2)); - num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; - num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; + num128 = Projectile.position.X + (float)Projectile.width * 0.5f - vector11.X; + num129 = Projectile.position.Y + (float)Projectile.height * 0.5f - vector11.Y; num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); } num130 = num127 / num130; @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Magic int note = Main.rand.Next(0, 2); if (note == 0) { - Damage = (int)(projectile.damage * 1.5f); + Damage = (int)(Projectile.damage * 1.5f); type = ModContent.ProjectileType(); } else @@ -97,17 +97,17 @@ namespace CalamityMod.Projectiles.Magic VelocityY *= 1.5f; type = ModContent.ProjectileType(); } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, VelocityX, VelocityY, type, Damage, projectile.knockBack, projectile.owner, 0.0f, 0.0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, VelocityX, VelocityY, type, Damage, Projectile.knockBack, Projectile.owner, 0.0f, 0.0f); } - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 2) + if (Projectile.frame > 2) { - projectile.frame = 0; + Projectile.frame = 0; } } } diff --git a/Projectiles/Magic/MelterNote1.cs b/Projectiles/Magic/MelterNote1.cs index b7888c4edd..ac832a460d 100644 --- a/Projectiles/Magic/MelterNote1.cs +++ b/Projectiles/Magic/MelterNote1.cs @@ -11,33 +11,33 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 2; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 2; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void AI() { - projectile.velocity *= 0.985f; + Projectile.velocity *= 0.985f; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.02f; - if (projectile.scale >= 1.25f) - projectile.localAI[0] = 1f; + Projectile.scale += 0.02f; + if (Projectile.scale >= 1.25f) + Projectile.localAI[0] = 1f; } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale -= 0.02f; - if (projectile.scale <= 0.75f) - projectile.localAI[0] = 0f; + Projectile.scale -= 0.02f; + if (Projectile.scale <= 0.75f) + Projectile.localAI[0] = 0f; } } diff --git a/Projectiles/Magic/MelterNote2.cs b/Projectiles/Magic/MelterNote2.cs index c877cde6fd..c0ba54c44a 100644 --- a/Projectiles/Magic/MelterNote2.cs +++ b/Projectiles/Magic/MelterNote2.cs @@ -11,33 +11,33 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 16; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 2; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 7; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 16; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 2; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 7; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void AI() { - projectile.velocity *= 0.99f; + Projectile.velocity *= 0.99f; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.02f; - if (projectile.scale >= 1.25f) - projectile.localAI[0] = 1f; + Projectile.scale += 0.02f; + if (Projectile.scale >= 1.25f) + Projectile.localAI[0] = 1f; } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale -= 0.02f; - if (projectile.scale <= 0.75f) - projectile.localAI[0] = 0f; + Projectile.scale -= 0.02f; + if (Projectile.scale <= 0.75f) + Projectile.localAI[0] = 0f; } } diff --git a/Projectiles/Magic/MeteorStar.cs b/Projectiles/Magic/MeteorStar.cs index 9d98c36864..013f7b6ac9 100644 --- a/Projectiles/Magic/MeteorStar.cs +++ b/Projectiles/Magic/MeteorStar.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -11,78 +12,78 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Meteor Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 42; - projectile.height = 34; - projectile.friendly = true; - projectile.magic = true; - projectile.timeLeft = 361; + Projectile.width = 42; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 361; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; bool flippedGravity = player.gravDir == -1f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.15f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.15f / 255f); - bool explodingSoon = projectile.timeLeft <= 120; - if (projectile.soundDelay <= 0) + bool explodingSoon = Projectile.timeLeft <= 120; + if (Projectile.soundDelay <= 0) { - projectile.soundDelay = 30 + Main.rand.Next(40); + Projectile.soundDelay = 30 + Main.rand.Next(40); if (explodingSoon) - projectile.soundDelay -= 30; + Projectile.soundDelay -= 30; if (Main.rand.NextBool(10) || explodingSoon) { - Main.PlaySound(SoundID.Item9, projectile.Center); + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); } } if (Main.rand.NextBool(20) || explodingSoon && Main.rand.NextBool(3)) { - int idx = Gore.NewGore(projectile.Center, projectile.velocity * 0.2f, Main.rand.Next(16, 18), 1f); + int idx = Gore.NewGore(Projectile.Center, Projectile.velocity * 0.2f, Main.rand.Next(16, 18), 1f); Main.gore[idx].velocity *= 0.66f; - Main.gore[idx].velocity += projectile.velocity * 0.3f; + Main.gore[idx].velocity += Projectile.velocity * 0.3f; } if (explodingSoon) { for (int i = 0; i < 3; i++) { - int smoke = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); + int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[smoke]; dust.velocity *= 0.3f; - dust.position.X = projectile.Center.X + 4f + Main.rand.NextFloat(-6f, 6f); - dust.position.Y = projectile.Center.Y + Main.rand.NextFloat(-6f, 6f); + dust.position.X = Projectile.Center.X + 4f + Main.rand.NextFloat(-6f, 6f); + dust.position.Y = Projectile.Center.Y + Main.rand.NextFloat(-6f, 6f); dust.noGravity = true; } } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { if (player.channel) { float speed = 14f; - float mouseDistX = (float)Main.mouseX + Main.screenPosition.X - projectile.Center.X; - float mouseDistY = (float)Main.mouseY + Main.screenPosition.Y - projectile.Center.Y; + float mouseDistX = (float)Main.mouseX + Main.screenPosition.X - Projectile.Center.X; + float mouseDistY = (float)Main.mouseY + Main.screenPosition.Y - Projectile.Center.Y; if (player.gravDir == -1f) { - mouseDistY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projectile.Center.Y; + mouseDistY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - Projectile.Center.Y; } Vector2 mouseVec = new Vector2(mouseDistX, mouseDistY); float mouseDist = mouseVec.Length(); @@ -92,34 +93,34 @@ namespace CalamityMod.Projectiles.Magic mouseVec.X *= mouseDist; mouseVec.Y *= mouseDist; int mouseSpeedX = (int)(mouseVec.X * 1000f); - int projSpeedX = (int)(projectile.velocity.X * 1000f); + int projSpeedX = (int)(Projectile.velocity.X * 1000f); int mouseSpeedY = (int)(mouseVec.Y * 1000f); - int projSpeedY = (int)(projectile.velocity.Y * 1000f); + int projSpeedY = (int)(Projectile.velocity.Y * 1000f); if (mouseSpeedX != projSpeedX || mouseSpeedY != projSpeedY) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity.X = mouseVec.X; - projectile.velocity.Y = mouseVec.Y; + Projectile.velocity.X = mouseVec.X; + Projectile.velocity.Y = mouseVec.Y; } else { int mouseSpeedX = (int)(mouseVec.X * 1000f); - int projSpeedX = (int)(projectile.velocity.X * 1000f); + int projSpeedX = (int)(Projectile.velocity.X * 1000f); int mouseSpeedY = (int)(mouseVec.Y * 1000f); - int projSpeedY = (int)(projectile.velocity.Y * 1000f); + int projSpeedY = (int)(Projectile.velocity.Y * 1000f); if (mouseSpeedX != projSpeedX || mouseSpeedY != projSpeedY) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity.X = mouseVec.X; - projectile.velocity.Y = mouseVec.Y; + Projectile.velocity.X = mouseVec.X; + Projectile.velocity.Y = mouseVec.Y; } - player.direction = (projectile.velocity.X > 0).ToDirectionInt(); - player.velocity = projectile.velocity; - if (projectile.velocity.Y > 16f) + player.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + player.velocity = Projectile.velocity; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; player.velocity.Y = 16f; } if (player.mount != null) @@ -127,9 +128,9 @@ namespace CalamityMod.Projectiles.Magic player.mount.Dismount(player); } if (!flippedGravity) - player.Bottom = projectile.Center; + player.Bottom = Projectile.Center; else - player.Top = projectile.Center; + player.Top = Projectile.Center; } else { @@ -137,16 +138,16 @@ namespace CalamityMod.Projectiles.Magic } } - projectile.tileCollide = projectile.velocity != Vector2.Zero && ++projectile.ai[0] >= 5f; + Projectile.tileCollide = Projectile.velocity != Vector2.Zero && ++Projectile.ai[0] >= 5f; // Die immediately if the owner of this projectile is clipping into tiles because of its movement. - if (Collision.SolidCollision(player.position, player.width, player.height) && projectile.velocity != Vector2.Zero) + if (Collision.SolidCollision(player.position, player.width, player.height) && Projectile.velocity != Vector2.Zero) { player.velocity.Y = 0f; Explode(); } - if (projectile.timeLeft <= 1) + if (Projectile.timeLeft <= 1) Explode(); } @@ -162,39 +163,39 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); // Draw the main texture in fullbright - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int frameY = frameHeight * projectile.frame; - float scale = projectile.scale; - float rotation = projectile.rotation; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int frameY = frameHeight * Projectile.frame; + float scale = Projectile.scale; + float rotation = Projectile.rotation; Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); Vector2 origin = rectangle.Size() / 2f; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), rectangle, Color.White, rotation, origin, scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), rectangle, Color.White, rotation, origin, scale, spriteEffects, 0f); return false; } private void Explode(bool reducedDmg = false) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 64); - Main.PlaySound(SoundID.Item14, projectile.Center); - Vector2 spawnPos = projectile.Center; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 64); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + Vector2 spawnPos = Projectile.Center; spawnPos.Y -= 70f; if (reducedDmg) - projectile.damage /= 6; - Projectile.NewProjectile(spawnPos, Vector2.Zero, ModContent.ProjectileType(), projectile.damage * 3, projectile.knockBack * 3f, projectile.owner, reducedDmg.ToInt()); + Projectile.damage /= 6; + Projectile.NewProjectile(spawnPos, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 3, Projectile.knockBack * 3f, Projectile.owner, reducedDmg.ToInt()); for (int i = 0; i < 10; i++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.2f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -204,9 +205,9 @@ namespace CalamityMod.Projectiles.Magic } for (int i = 0; i < 5; i++) { - Gore.NewGore(projectile.position, projectile.velocity * 0.05f, Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, Projectile.velocity * 0.05f, Main.rand.Next(16, 18), 1f); } - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Magic/MeteorStarExplosion.cs b/Projectiles/Magic/MeteorStarExplosion.cs index 38aea62884..369ca04e12 100644 --- a/Projectiles/Magic/MeteorStarExplosion.cs +++ b/Projectiles/Magic/MeteorStarExplosion.cs @@ -8,27 +8,27 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); - Main.projFrames[projectile.type] = 7; + Main.projFrames[Projectile.type] = 7; } public override void SetDefaults() { - projectile.width = 84; - projectile.height = 152; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = Main.projFrames[projectile.type] * 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 35; - projectile.tileCollide = false; - projectile.hostile = true; + Projectile.width = 84; + Projectile.height = 152; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.timeLeft = Main.projFrames[Projectile.type] * 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 35; + Projectile.tileCollide = false; + Projectile.hostile = true; } public override void AI() { - if (projectile.timeLeft % 5f == 4f) - projectile.frame++; + if (Projectile.timeLeft % 5f == 4f) + Projectile.frame++; } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Magic damage = Main.rand.Next(GloriousEnd.PlayerExplosionDmgMin, GloriousEnd.PlayerExplosionDmgMax + 1); if (Main.expertMode) damage /= 2; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) damage /= 2; } @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Magic damage = Main.rand.Next(GloriousEnd.PlayerExplosionDmgMin, GloriousEnd.PlayerExplosionDmgMax + 1); if (Main.expertMode) damage /= 2; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) damage /= 2; } } diff --git a/Projectiles/Magic/MiasmaGas.cs b/Projectiles/Magic/MiasmaGas.cs index 5ebdd10546..b4d6ab2f32 100644 --- a/Projectiles/Magic/MiasmaGas.cs +++ b/Projectiles/Magic/MiasmaGas.cs @@ -11,67 +11,67 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Gas"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 44; - projectile.height = 28; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 240; - projectile.penetrate = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.magic = true; + Projectile.width = 44; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 240; + Projectile.penetrate = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.alpha = Main.rand.Next(35, 75); - projectile.localAI[0] = 1f; + Projectile.alpha = Main.rand.Next(35, 75); + Projectile.localAI[0] = 1f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 360f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 360f) { - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.velocity *= 0.9865f; + Projectile.velocity *= 0.9865f; } - projectile.rotation += projectile.velocity.X * 0.0003f; + Projectile.rotation += Projectile.velocity.X * 0.0003f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; } public override void Kill(int timeLeft) { for (int i = 0; i < 25; i++) { - Dust dust = Dust.NewDustDirect(projectile.position, 48, 30, 189, 0f, 0f); - dust.velocity = projectile.velocity.RotatedByRandom(MathHelper.ToRadians(39f)); + Dust dust = Dust.NewDustDirect(Projectile.position, 48, 30, 189, 0f, 0f); + dust.velocity = Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(39f)); dust.alpha = 127; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/NanoPurgeHoldout.cs b/Projectiles/Magic/NanoPurgeHoldout.cs index 09450954ae..a64383aee5 100644 --- a/Projectiles/Magic/NanoPurgeHoldout.cs +++ b/Projectiles/Magic/NanoPurgeHoldout.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -12,43 +13,43 @@ namespace CalamityMod.Projectiles.Magic private const int FramesPerFireRateIncrease = 36; private static int[] LaserOffsetByAnimationFrame = { 4, 3, 0, 3 }; - private Player Owner => Main.player[projectile.owner]; + private Player Owner => Main.player[Projectile.owner]; private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; - private ref float DeployedFrames => ref projectile.ai[0]; - private ref float ChargeTowardsNextShot => ref projectile.ai[1]; + private ref float DeployedFrames => ref Projectile.ai[0]; + private ref float ChargeTowardsNextShot => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Nano Purge"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 62; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; + Projectile.width = 34; + Projectile.height = 62; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 gunBarrelPos = armPosition + projectile.velocity * projectile.height * 0.5f; + Vector2 gunBarrelPos = armPosition + Projectile.velocity * Projectile.height * 0.5f; // If the player is unable to continue using the holdout, delete it. if (!OwnerCanShoot) { - projectile.Kill(); + Projectile.Kill(); return; } // Update damage based on curent magic damage stat (so Mana Sickness affects it) Item nanoPurge = Owner.ActiveItem(); - projectile.damage = (int)((nanoPurge?.damage ?? 0) * Owner.MagicDamage()); + Projectile.damage = (int)((nanoPurge?.damage ?? 0) * Owner.MagicDamage()); // Get the original weapon's use time. int itemUseTime = nanoPurge?.useAnimation ?? Purge.UseTime; @@ -68,17 +69,17 @@ namespace CalamityMod.Projectiles.Magic ChargeTowardsNextShot -= itemUseTime; // Update the animation. - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; bool manaCostPaid = Owner.CheckMana(Owner.ActiveItem(), -1, true, false); if (manaCostPaid) { - Main.PlaySound(SoundID.Item91, projectile.Center); + SoundEngine.PlaySound(SoundID.Item91, Projectile.Center); int projID = ModContent.ProjectileType(); float shootSpeed = nanoPurge.shootSpeed; float inaccuracyRatio = 0.045f; - Vector2 shootDirection = projectile.velocity.SafeNormalize(Vector2.UnitY); + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.UnitY); Vector2 perp = shootDirection.RotatedBy(MathHelper.PiOver2); // Fire a pair of lasers, one with a negative offset, one with a positive offset. @@ -86,8 +87,8 @@ namespace CalamityMod.Projectiles.Magic { Vector2 spread = Main.rand.NextVector2CircularEdge(shootSpeed, shootSpeed); Vector2 shootVelocity = shootDirection * shootSpeed + inaccuracyRatio * spread; - Vector2 splitBarrelPos = gunBarrelPos + i * LaserOffsetByAnimationFrame[projectile.frame] * perp; - Projectile.NewProjectile(splitBarrelPos, shootVelocity, projID, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Vector2 splitBarrelPos = gunBarrelPos + i * LaserOffsetByAnimationFrame[Projectile.frame] * perp; + Projectile.NewProjectile(splitBarrelPos, shootVelocity, projID, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); SpawnFiringDust(splitBarrelPos, shootVelocity); } } @@ -95,7 +96,7 @@ namespace CalamityMod.Projectiles.Magic // Delete the laser gun if a mana cost cannot be paid. else { - projectile.Kill(); + Projectile.Kill(); return; } } @@ -106,31 +107,31 @@ namespace CalamityMod.Projectiles.Magic private void UpdateProjectileHeldVariables(Vector2 armPosition) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - float interpolant = Utils.InverseLerp(5f, 25f, projectile.Distance(Main.MouseWorld), true); - Vector2 oldVelocity = projectile.velocity; - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(Main.MouseWorld), interpolant); - if (projectile.velocity != oldVelocity) + float interpolant = Utils.InverseLerp(5f, 25f, Projectile.Distance(Main.MouseWorld), true); + Vector2 oldVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), interpolant); + if (Projectile.velocity != oldVelocity) { - projectile.netSpam = 0; - projectile.netUpdate = true; + Projectile.netSpam = 0; + Projectile.netUpdate = true; } } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.Center = armPosition + projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction) * 8f; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.Center = armPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction) * 8f; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; } private void ManipulatePlayerVariables() { - Owner.ChangeDir(projectile.direction); - Owner.heldProj = projectile.whoAmI; + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } private void SpawnFiringDust(Vector2 gunBarrelPos, Vector2 laserVelocity) diff --git a/Projectiles/Magic/NanoPurgeLaser.cs b/Projectiles/Magic/NanoPurgeLaser.cs index 46940c5d2d..bbeb47cc53 100644 --- a/Projectiles/Magic/NanoPurgeLaser.cs +++ b/Projectiles/Magic/NanoPurgeLaser.cs @@ -18,55 +18,55 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 600; - projectile.magic = true; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { // Very rapidly fade into existence. - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; // Emit light. - Lighting.AddLight(projectile.Center, 0f, 0.7f, 0.1f); + Lighting.AddLight(Projectile.Center, 0f, 0.7f, 0.1f); // Laser length shenanigans. If the laser is still growing, increase localAI 0 to indicate it is getting longer. - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += LaserLengthChangeRate; + Projectile.localAI[0] += LaserLengthChangeRate; // Cap it at max length. - if (projectile.localAI[0] > LaserLength) - projectile.localAI[0] = LaserLength; + if (Projectile.localAI[0] > LaserLength) + Projectile.localAI[0] = LaserLength; } // Otherwise it's shrinking. Once it reaches zero length it dies for good. else { - projectile.localAI[0] -= LaserLengthChangeRate; - if (projectile.localAI[0] <= 0f) - projectile.Kill(); + Projectile.localAI[0] -= LaserLengthChangeRate; + if (Projectile.localAI[0] <= 0f) + Projectile.Kill(); } } public override Color? GetAlpha(Color lightColor) => new Color(96, 255, 96, 0); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(LaserLength, 2f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(LaserLength, 2f, lightColor); public override void Kill(int timeLeft) { int dustID = 107; int dustAmt = Main.rand.Next(3, 7); - Vector2 dustPos = projectile.Center - projectile.velocity / 2f; + Vector2 dustPos = Projectile.Center - Projectile.velocity / 2f; for (int i = 0; i < dustAmt; ++i) { Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f, Scale: 0.8f); diff --git a/Projectiles/Magic/NebulaElementalBeam.cs b/Projectiles/Magic/NebulaElementalBeam.cs index aa1feb5c1f..368439bf4c 100644 --- a/Projectiles/Magic/NebulaElementalBeam.cs +++ b/Projectiles/Magic/NebulaElementalBeam.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Magic public override float MaxLaserLength => 1000f; public override float Lifetime => 30f; public override Color LightCastColor => Color.White; - public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); - public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); - public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); public const float UniversalAngularSpeed = MathHelper.Pi / 400f; @@ -25,14 +25,14 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = projectile.height = 20; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 13; - projectile.tileCollide = false; - projectile.timeLeft = (int)Lifetime; + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 13; + Projectile.tileCollide = false; + Projectile.timeLeft = (int)Lifetime; } public override void ExtraBehavior() @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic int totalBubbles = 24; for (int i = 0; i < totalBubbles; i++) { - Dust nebulaBubble = Dust.NewDustPerfect(projectile.Center, 242); + Dust nebulaBubble = Dust.NewDustPerfect(Projectile.Center, 242); nebulaBubble.velocity = Main.rand.NextVector2Circular(6f, 6f); nebulaBubble.scale = Main.rand.NextFloat(2f, 3f); nebulaBubble.noGravity = true; @@ -52,13 +52,13 @@ namespace CalamityMod.Projectiles.Magic } } - public override void DetermineScale() => projectile.scale = projectile.timeLeft / Lifetime * MaxScale; + public override void DetermineScale() => Projectile.scale = Projectile.timeLeft / Lifetime * MaxScale; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - DrawBeamWithColor(spriteBatch, new Color(190, 29, 209), projectile.scale); - DrawBeamWithColor(spriteBatch, Color.Lerp(new Color(254, 126, 229), Color.Transparent, 0.35f), projectile.scale * 0.6f); - DrawBeamWithColor(spriteBatch, Color.Lerp(new Color(254, 190, 243), Color.Transparent, 0.35f), projectile.scale * 0.6f); + DrawBeamWithColor(spriteBatch, new Color(190, 29, 209), Projectile.scale); + DrawBeamWithColor(spriteBatch, Color.Lerp(new Color(254, 126, 229), Color.Transparent, 0.35f), Projectile.scale * 0.6f); + DrawBeamWithColor(spriteBatch, Color.Lerp(new Color(254, 190, 243), Color.Transparent, 0.35f), Projectile.scale * 0.6f); return false; } } diff --git a/Projectiles/Magic/NettleRight.cs b/Projectiles/Magic/NettleRight.cs index 9981633d4d..278cdd4f03 100644 --- a/Projectiles/Magic/NettleRight.cs +++ b/Projectiles/Magic/NettleRight.cs @@ -13,57 +13,57 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.aiStyle = 4; + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.aiStyle = 4; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; - if (projectile.ai[0] == 0f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + if (Projectile.ai[0] == 0f) { - projectile.alpha -= 50; - if (projectile.alpha > 0) + Projectile.alpha -= 50; + if (Projectile.alpha > 0) return; - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) + Projectile.alpha = 0; + Projectile.ai[0] = 1f; + if (Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; + Projectile.ai[1] += 1f; + Projectile.position += Projectile.velocity * 1f; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - int type = projectile.type; - if (projectile.ai[1] >= 10f) + int type = Projectile.type; + if (Projectile.ai[1] >= 10f) type = ModContent.ProjectileType(); - int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, type, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[number].ai[1] = projectile.ai[1] + 1f; + int number = Projectile.NewProjectile(Projectile.position.X + Projectile.velocity.X + (float)(Projectile.width / 2), Projectile.position.Y + Projectile.velocity.Y + (float)(Projectile.height / 2), Projectile.velocity.X, Projectile.velocity.Y, type, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Main.projectile[number].ai[1] = Projectile.ai[1] + 1f; } } else { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170) { for (int index1 = 0; index1 < 8; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 7, projectile.velocity.X * 0.025f, projectile.velocity.Y * 0.025f, 200, new Color(), 1.3f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 7, Projectile.velocity.X * 0.025f, Projectile.velocity.Y * 0.025f, 200, new Color(), 1.3f); Dust dust = Main.dust[index2]; dust.noGravity = true; dust.velocity *= 0.5f; } } - projectile.alpha += 3; - if (projectile.alpha < 255) + Projectile.alpha += 3; + if (Projectile.alpha < 255) return; - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Magic/NettleTip.cs b/Projectiles/Magic/NettleTip.cs index 11d18a41c4..ebe7a2c4b1 100644 --- a/Projectiles/Magic/NettleTip.cs +++ b/Projectiles/Magic/NettleTip.cs @@ -11,15 +11,15 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.magic = true; + Projectile.width = 28; + Projectile.height = 28; + Projectile.aiStyle = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; aiType = ProjectileID.NettleBurstEnd; } } diff --git a/Projectiles/Magic/NightBolt.cs b/Projectiles/Magic/NightBolt.cs index 1804429148..9fec845258 100644 --- a/Projectiles/Magic/NightBolt.cs +++ b/Projectiles/Magic/NightBolt.cs @@ -14,21 +14,21 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 20; - projectile.friendly = true; - projectile.timeLeft = 30; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.extraUpdates = 20; + Projectile.friendly = true; + Projectile.timeLeft = 30; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } public override void AI() { for (int num447 = 0; num447 < 2; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); int num448 = Dust.NewDust(vector33, 1, 1, 27, 0f, 0f, 0, default, 1.25f); Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; diff --git a/Projectiles/Magic/NightOrb.cs b/Projectiles/Magic/NightOrb.cs index 82dabaff4b..8041720dfa 100644 --- a/Projectiles/Magic/NightOrb.cs +++ b/Projectiles/Magic/NightOrb.cs @@ -12,19 +12,19 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 30; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType()); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType()); } } } diff --git a/Projectiles/Magic/NightsRayBeam.cs b/Projectiles/Magic/NightsRayBeam.cs index 12e112e3b2..f3eda5451a 100644 --- a/Projectiles/Magic/NightsRayBeam.cs +++ b/Projectiles/Magic/NightsRayBeam.cs @@ -5,11 +5,11 @@ namespace CalamityMod.Projectiles.Magic { public class NightsRayBeam : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public bool HasFiredSideBeams { - get => projectile.ai[1] == 1f; - set => projectile.ai[1] = value.ToInt(); + get => Projectile.ai[1] == 1f; + set => Projectile.ai[1] = value.ToInt(); } public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() @@ -19,14 +19,14 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = 150; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 10; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 150; } public override void AI() @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 2; i++) { - Vector2 dustSpawnPos = projectile.position - projectile.velocity * i / 2f; + Vector2 dustSpawnPos = Projectile.position - Projectile.velocity * i / 2f; Dust corruptMagic = Dust.NewDustPerfect(dustSpawnPos, 27); corruptMagic.color = Color.Lerp(Color.Fuchsia, Color.Magenta, Main.rand.NextFloat(0.6f)); corruptMagic.scale = Main.rand.NextFloat(0.96f, 1.04f); @@ -48,16 +48,16 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (!HasFiredSideBeams && projectile.owner == Main.myPlayer) + if (!HasFiredSideBeams && Projectile.owner == Main.myPlayer) { Vector2 baseSpawnPositionOffset = Main.rand.NextVector2CircularEdge(40f, 40f); for (int i = 0; i < 4; i++) { Vector2 spawnPosition = target.Center + baseSpawnPositionOffset.RotatedBy(MathHelper.TwoPi * i / 4f); - Projectile.NewProjectile(spawnPosition, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.8), projectile.knockBack, projectile.owner); + Projectile.NewProjectile(spawnPosition, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack, Projectile.owner); } HasFiredSideBeams = true; - projectile.netUpdate = true; + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Magic/NuclearFuryProjectile.cs b/Projectiles/Magic/NuclearFuryProjectile.cs index ae1127582e..0fdb82fe77 100644 --- a/Projectiles/Magic/NuclearFuryProjectile.cs +++ b/Projectiles/Magic/NuclearFuryProjectile.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -12,66 +13,66 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Nuclear Fury"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 60; - projectile.height = 60; - projectile.alpha = 255; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.tileCollide = false; - projectile.extraUpdates = 2; - projectile.ignoreWater = true; + Projectile.width = 60; + Projectile.height = 60; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; + Projectile.extraUpdates = 2; + Projectile.ignoreWater = true; } public override void AI() { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 10f && Main.rand.NextBool(3)) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 10f && Main.rand.NextBool(3)) { int num = 6; for (int index1 = 0; index1 < num; ++index1) { - Vector2 vector2_1 = (Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width, (float)projectile.height) / 2f).RotatedBy((double)(index1 - (num / 2 - 1)) * Math.PI / (double)num, new Vector2()) + projectile.Center; + Vector2 vector2_1 = (Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width, (float)Projectile.height) / 2f).RotatedBy((double)(index1 - (num / 2 - 1)) * Math.PI / (double)num, new Vector2()) + Projectile.Center; Vector2 vector2_2 = ((Main.rand.NextFloat() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); int index2 = Dust.NewDust(vector2_1 + vector2_2, 0, 0, 217, vector2_2.X * 2f, vector2_2.Y * 2f, 100, new Color(), 1.4f); Dust dust = Main.dust[index2]; dust.noGravity = true; dust.noLight = true; dust.velocity /= 4f; - dust.velocity -= projectile.velocity; + dust.velocity -= Projectile.velocity; } - projectile.alpha -= 5; - if (projectile.alpha < 50) - projectile.alpha = 50; - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.1f, 0.4f, 0.6f); + Projectile.alpha -= 5; + if (Projectile.alpha < 50) + Projectile.alpha = 50; + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0.1f, 0.4f, 0.6f); } - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; int num1 = -1; - Vector2 targetVec = projectile.Center; + Vector2 targetVec = Projectile.Center; float maxDistance = 500f; - if (projectile.localAI[0] > 0f) + if (Projectile.localAI[0] > 0f) { - projectile.localAI[0] -= 1f; + Projectile.localAI[0] -= 1f; } - if (projectile.ai[0] == 0f && projectile.localAI[0] == 0f) + if (Projectile.ai[0] == 0f && Projectile.localAI[0] == 0f) { for (int index = 0; index < Main.maxNPCs; ++index) { NPC npc = Main.npc[index]; - if (npc.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == (index + 1f))) + if (npc.CanBeChasedBy(Projectile, false) && (Projectile.ai[0] == 0f || Projectile.ai[0] == (index + 1f))) { float extraDistance = (npc.width / 2) + (npc.height / 2); bool canHit = true; if (extraDistance < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); float npcDist = Vector2.Distance(npc.Center, targetVec); if (npcDist < (maxDistance + extraDistance) && canHit) @@ -84,19 +85,19 @@ namespace CalamityMod.Projectiles.Magic } if (num1 >= 0) { - projectile.ai[0] = num1 + 1f; - projectile.netUpdate = true; + Projectile.ai[0] = num1 + 1f; + Projectile.netUpdate = true; } } - if (projectile.localAI[0] == 0f && projectile.ai[0] == 0f) - projectile.localAI[0] = 30f; + if (Projectile.localAI[0] == 0f && Projectile.ai[0] == 0f) + Projectile.localAI[0] = 30f; bool flag = false; - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { - int index = (int)(projectile.ai[0] - 1); - if (Main.npc[index].active && !Main.npc[index].dontTakeDamage && Main.npc[index].immune[projectile.owner] == 0) + int index = (int)(Projectile.ai[0] - 1); + if (Main.npc[index].active && !Main.npc[index].dontTakeDamage && Main.npc[index].immune[Projectile.owner] == 0) { - if ((Math.Abs(projectile.Center.X - Main.npc[index].Center.X) + Math.Abs(projectile.Center.Y - Main.npc[index].Center.Y)) < 1000f) + if ((Math.Abs(Projectile.Center.X - Main.npc[index].Center.X) + Math.Abs(Projectile.Center.Y - Main.npc[index].Center.Y)) < 1000f) { flag = true; targetVec = Main.npc[index].Center; @@ -104,31 +105,31 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; flag = false; - projectile.netUpdate = true; + Projectile.netUpdate = true; } } if (flag) { - double num3 = (double)(targetVec - projectile.Center).ToRotation() - (double)projectile.velocity.ToRotation(); + double num3 = (double)(targetVec - Projectile.Center).ToRotation() - (double)Projectile.velocity.ToRotation(); if (num3 > Math.PI) num3 -= 2.0 * Math.PI; if (num3 < -1.0 * Math.PI) num3 += 2.0 * Math.PI; - projectile.velocity = projectile.velocity.RotatedBy(num3 * 0.1, new Vector2()); + Projectile.velocity = Projectile.velocity.RotatedBy(num3 * 0.1, new Vector2()); } - float num4 = projectile.velocity.Length(); - projectile.velocity.Normalize(); - projectile.velocity = projectile.velocity * (num4 + 1f / 400f); + float num4 = Projectile.velocity.Length(); + Projectile.velocity.Normalize(); + Projectile.velocity = Projectile.velocity * (num4 + 1f / 400f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 5; k++) { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 34, 0f, 0f); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 34, 0f, 0f); Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; } @@ -143,9 +144,9 @@ namespace CalamityMod.Projectiles.Magic { target.buffImmune[BuffID.Wet] = false; //I'm not sorry target.AddBuff(BuffID.Wet, 600); - if (projectile.ai[1] != 1f) //Nuclear Fury + if (Projectile.ai[1] != 1f) //Nuclear Fury { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; } } @@ -156,7 +157,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/ParticleBeamofDoom.cs b/Projectiles/Magic/ParticleBeamofDoom.cs index 1eb4d08eca..6699669830 100644 --- a/Projectiles/Magic/ParticleBeamofDoom.cs +++ b/Projectiles/Magic/ParticleBeamofDoom.cs @@ -14,25 +14,25 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 100; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * 0.25f; int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 2.5f); Main.dust[num448].position = vector33; Main.dust[num448].velocity *= 0.1f; diff --git a/Projectiles/Magic/PartySparkle.cs b/Projectiles/Magic/PartySparkle.cs index 58be299f5d..bffeb09ec8 100644 --- a/Projectiles/Magic/PartySparkle.cs +++ b/Projectiles/Magic/PartySparkle.cs @@ -11,13 +11,13 @@ namespace CalamityMod.Projectiles.Magic { public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public float ColorSpectrumHue { - get => projectile.ai[1]; - set => projectile.ai[1] = value; + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; } public const int Lifetime = 90; public const int FadeinTime = 18; @@ -29,44 +29,44 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 72; - projectile.height = 72; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.timeLeft = Lifetime; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.scale = 0.001f; + Projectile.width = 72; + Projectile.height = 72; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = Lifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.scale = 0.001f; } public override void AI() { if (Time == 1f) { - projectile.scale = Main.rand.NextFloat(0.4f, 1.1f); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(72 * projectile.scale)); + Projectile.scale = Main.rand.NextFloat(0.4f, 1.1f); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, (int)(72 * Projectile.scale)); ColorSpectrumHue = Main.rand.NextFloat(0f, 0.9999f); - projectile.netUpdate = true; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.netUpdate = true; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } Time++; - projectile.velocity *= 0.96f; + Projectile.velocity *= 0.96f; - projectile.rotation = projectile.rotation.AngleLerp(MathHelper.PiOver2, 0.085f); + Projectile.rotation = Projectile.rotation.AngleLerp(MathHelper.PiOver2, 0.085f); ColorSpectrumHue = (ColorSpectrumHue + 0.333f / Lifetime) % 0.999f; // Go 33% across the color spectrum throughout the sparkle's life instead of using a static sprite. - projectile.Opacity = Utils.InverseLerp(0f, FadeinTime, Time, true) * Utils.InverseLerp(Lifetime, Lifetime - FadeoutTime, Time, true); - projectile.velocity = projectile.velocity.RotatedBy(Math.Sin(Time / 30f) * 0.0125f); + Projectile.Opacity = Utils.InverseLerp(0f, FadeinTime, Time, true) * Utils.InverseLerp(Lifetime, Lifetime - FadeoutTime, Time, true); + Projectile.velocity = Projectile.velocity.RotatedBy(Math.Sin(Time / 30f) * 0.0125f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D sparkleTexture = ModContent.GetTexture(Texture); + Texture2D sparkleTexture = ModContent.Request(Texture); - Color sparkleColor = CalamityUtils.MulticolorLerp(ColorSpectrumHue, RainbowPartyCannon.ColorSet) * projectile.Opacity * 0.5f; + Color sparkleColor = CalamityUtils.MulticolorLerp(ColorSpectrumHue, RainbowPartyCannon.ColorSet) * Projectile.Opacity * 0.5f; sparkleColor.A = 0; sparkleColor *= MathHelper.Lerp(1f, 1.5f, Utils.InverseLerp(Lifetime * 0.5f - 15f, Lifetime * 0.5f + 15f, Time, true)); @@ -75,41 +75,41 @@ namespace CalamityMod.Projectiles.Magic Vector2 origin = sparkleTexture.Size() / 2f; - Vector2 sparkleScale = new Vector2(0.3f, 1f) * projectile.Opacity * projectile.scale; - Vector2 orthogonalsparkleScale = new Vector2(0.3f, 2f) * projectile.Opacity * projectile.scale; + Vector2 sparkleScale = new Vector2(0.3f, 1f) * Projectile.Opacity * Projectile.scale; + Vector2 orthogonalsparkleScale = new Vector2(0.3f, 2f) * Projectile.Opacity * Projectile.scale; spriteBatch.Draw(sparkleTexture, - projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, null, sparkleColor, - MathHelper.PiOver2 + projectile.rotation, + MathHelper.PiOver2 + Projectile.rotation, origin, orthogonalsparkleScale, SpriteEffects.None, 0f); spriteBatch.Draw(sparkleTexture, - projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, null, sparkleColor, - projectile.rotation, + Projectile.rotation, origin, sparkleScale, SpriteEffects.None, 0f); spriteBatch.Draw(sparkleTexture, - projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, null, orthogonalsparkleColor, - MathHelper.PiOver2 + projectile.rotation, + MathHelper.PiOver2 + Projectile.rotation, origin, orthogonalsparkleScale * 0.6f, SpriteEffects.None, 0f); spriteBatch.Draw(sparkleTexture, - projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, null, orthogonalsparkleColor, - projectile.rotation, + Projectile.rotation, origin, sparkleScale * 0.6f, SpriteEffects.None, diff --git a/Projectiles/Magic/PhantasmalFuryProj.cs b/Projectiles/Magic/PhantasmalFuryProj.cs index 93bf1dd04b..004c2518aa 100644 --- a/Projectiles/Magic/PhantasmalFuryProj.cs +++ b/Projectiles/Magic/PhantasmalFuryProj.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class PhantasmalFuryProj : ModProjectile @@ -11,79 +12,79 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Fury"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.magic = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; - if (projectile.timeLeft % 10 == 0) + if (Projectile.timeLeft % 10 == 0) { - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } - Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0.25f); + Lighting.AddLight(Projectile.Center, 0.25f, 0.25f, 0.25f); for (int num457 = 0; num457 < 3; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 2f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 2f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item43, projectile.position); + SoundEngine.PlaySound(SoundID.Item43, Projectile.position); for (int j = 0; j <= 10; j++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 1f); } float spread = 30f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/Phantom.cs b/Projectiles/Magic/Phantom.cs index 3c2dd9a953..388eaf8f1d 100644 --- a/Projectiles/Magic/Phantom.cs +++ b/Projectiles/Magic/Phantom.cs @@ -12,29 +12,29 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.extraUpdates = 1; - projectile.penetrate = 2; - projectile.ignoreWater = true; - projectile.timeLeft = 120; - projectile.magic = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.extraUpdates = 1; + Projectile.penetrate = 2; + Projectile.ignoreWater = true; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.rotation += 0.01f; + Projectile.rotation += 0.01f; - Lighting.AddLight(projectile.Center, 0.2f, 0.2f, 0.2f); + Lighting.AddLight(Projectile.Center, 0.2f, 0.2f, 0.2f); for (int num457 = 0; num457 < 2; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 1f); Main.dust[num458].noGravity = true; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); } } } diff --git a/Projectiles/Magic/PhasedGodRay.cs b/Projectiles/Magic/PhasedGodRay.cs index 7ad38172be..5a00b93725 100644 --- a/Projectiles/Magic/PhasedGodRay.cs +++ b/Projectiles/Magic/PhasedGodRay.cs @@ -16,40 +16,40 @@ namespace CalamityMod.Projectiles.Magic // They are extremely carefully chosen and barely work as is! private const float WaveTheta = 0.09f; private const int WaveTwistFrames = 9; - private ref float WaveFrameState => ref projectile.localAI[1]; + private ref float WaveFrameState => ref Projectile.localAI[1]; public override string Texture => "CalamityMod/Projectiles/LaserProj"; public override void SetStaticDefaults() { DisplayName.SetDefault("Phased God Ray"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 12; - projectile.MaxUpdates = 3; - projectile.timeLeft = 280; - projectile.magic = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = 280; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void AI() { // Very rapidly fade into existence. - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; float waveSign = WaveFrameState < 0f ? -1f : 1f; @@ -62,10 +62,10 @@ namespace CalamityMod.Projectiles.Magic WaveFrameState = dirToUse * WaveTwistFrames * 0.5f; // Backfill old rotations to prevent visual glitches. - float iterRotation = projectile.velocity.ToRotation(); - for (int i = 0; i < projectile.oldRot.Length; ++i) + float iterRotation = Projectile.velocity.ToRotation(); + for (int i = 0; i < Projectile.oldRot.Length; ++i) { - projectile.oldRot[i] = iterRotation; + Projectile.oldRot[i] = iterRotation; iterRotation += waveSign * WaveTheta; } } @@ -76,28 +76,28 @@ namespace CalamityMod.Projectiles.Magic WaveFrameState += waveSign; // Apply a constant, rapid wave to the laser's motion. - projectile.velocity = projectile.velocity.RotatedBy(waveSign * WaveTheta); - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.velocity = Projectile.velocity.RotatedBy(waveSign * WaveTheta); + Projectile.rotation = Projectile.velocity.ToRotation(); // Emit light. - Lighting.AddLight(projectile.Center, 0.87f, 0.65f, 0.1725f); + Lighting.AddLight(Projectile.Center, 0.87f, 0.65f, 0.1725f); // Laser length shenanigans. If the laser is still growing, increase localAI 0 to indicate it is getting longer. - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += 10f; // LaserLengthChangeRate; + Projectile.localAI[0] += 10f; // LaserLengthChangeRate; // Cap it at max length. - if (projectile.localAI[0] > LaserLength) - projectile.localAI[0] = LaserLength; + if (Projectile.localAI[0] > LaserLength) + Projectile.localAI[0] = LaserLength; } // Otherwise it's shrinking. Once it reaches zero length it dies for good. else { - projectile.localAI[0] -= LaserLengthChangeRate; - if (projectile.localAI[0] <= 0f) - projectile.Kill(); + Projectile.localAI[0] -= LaserLengthChangeRate; + if (Projectile.localAI[0] <= 0f) + Projectile.Kill(); } } @@ -107,14 +107,14 @@ namespace CalamityMod.Projectiles.Magic public override Color? GetAlpha(Color lightColor) => new Color(222, 166, 44, 0); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(LaserLength, 2f, lightColor, curve: true); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(LaserLength, 2f, lightColor, curve: true); public override void Kill(int timeLeft) { int dustID = 269; int dustAmt = 4; - Vector2 dustPos = projectile.Center - projectile.velocity / 2f; - Vector2 dustVel = projectile.velocity / 4f; + Vector2 dustPos = Projectile.Center - Projectile.velocity / 2f; + Vector2 dustVel = Projectile.velocity / 4f; for (int i = 0; i < dustAmt; ++i) { Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f, Scale: 2.5f); diff --git a/Projectiles/Magic/PlagueFang.cs b/Projectiles/Magic/PlagueFang.cs index 099d482d90..cd8d053c50 100644 --- a/Projectiles/Magic/PlagueFang.cs +++ b/Projectiles/Magic/PlagueFang.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -16,45 +17,45 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.magic = true; - projectile.alpha = 255; - projectile.penetrate = 6; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.alpha = 255; + Projectile.penetrate = 6; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.alpha > 0) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + if (Projectile.alpha > 0) { - projectile.alpha -= 50; + Projectile.alpha -= 50; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - int num159 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 163, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f); + int num159 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 163, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f); Main.dust[num159].noGravity = true; Main.dust[num159].velocity *= 0.6f; - Main.dust[num159].velocity -= projectile.velocity * 0.4f; + Main.dust[num159].velocity -= Projectile.velocity * 0.4f; - int num160 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 205, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f); + int num160 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 205, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f); Main.dust[num160].noGravity = true; Main.dust[num160].velocity *= 0.2f; - Main.dust[num160].velocity -= projectile.velocity * 0.4f; + Main.dust[num160].velocity -= Projectile.velocity * 0.4f; } } public override Color? GetAlpha(Color lightColor) { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { return Color.Transparent; } @@ -63,19 +64,19 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 27); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 27); for (int num301 = 0; num301 < 7; num301++) { - int num302 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 163, 0f, 0f, 100, default, 1f); + int num302 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 163, 0f, 0f, 100, default, 1f); Main.dust[num302].noGravity = true; Main.dust[num302].velocity *= 1.2f; - Main.dust[num302].velocity -= projectile.oldVelocity * 0.3f; + Main.dust[num302].velocity -= Projectile.oldVelocity * 0.3f; - int num402 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 205, 0f, 0f, 100, default, 1f); + int num402 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 205, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num402]; dust.noGravity = true; dust.velocity *= 1.2f; - dust.velocity -= projectile.oldVelocity * 0.3f; + dust.velocity -= Projectile.oldVelocity * 0.3f; } } diff --git a/Projectiles/Magic/PlasmaBolt.cs b/Projectiles/Magic/PlasmaBolt.cs index 56d5baf30e..a4ef56b1cd 100644 --- a/Projectiles/Magic/PlasmaBolt.cs +++ b/Projectiles/Magic/PlasmaBolt.cs @@ -14,26 +14,26 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 200; - projectile.extraUpdates = 10; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 200; + Projectile.extraUpdates = 10; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 6f) { for (int d = 0; d < 5; d++) { - Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; dust.velocity = Vector2.Zero; - dust.position -= projectile.velocity / 5f * d; + dust.position -= Projectile.velocity / 5f * d; dust.noGravity = true; dust.scale = 0.65f; dust.noLight = true; diff --git a/Projectiles/Magic/PlasmaRay.cs b/Projectiles/Magic/PlasmaRay.cs index d05421db21..d8f15012af 100644 --- a/Projectiles/Magic/PlasmaRay.cs +++ b/Projectiles/Magic/PlasmaRay.cs @@ -17,36 +17,36 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 80; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 80; } public override void AI() { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 65, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - if (projectile.velocity.X != projectile.velocity.X) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 65, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; + Projectile.position.X = Projectile.position.X + Projectile.velocity.X; + Projectile.velocity.X = -Projectile.velocity.X; } - if (projectile.velocity.Y != projectile.velocity.Y) + if (Projectile.velocity.Y != Projectile.velocity.Y) { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; + Projectile.position.Y = Projectile.position.Y + Projectile.velocity.Y; + Projectile.velocity.Y = -Projectile.velocity.Y; } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { for (int num447 = 0; num447 < 4; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); + Projectile.alpha = 255; int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.75f); Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; @@ -59,23 +59,23 @@ namespace CalamityMod.Projectiles.Magic { float random = Main.rand.Next(30, 90); float spread = random * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 1.75), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 1.75), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 1.75), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 1.75), Projectile.knockBack, Projectile.owner, 0f, 0f); } } - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } return false; } @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Magic/PlasmaRay2.cs b/Projectiles/Magic/PlasmaRay2.cs index 211c944a6d..24f7cf1189 100644 --- a/Projectiles/Magic/PlasmaRay2.cs +++ b/Projectiles/Magic/PlasmaRay2.cs @@ -14,37 +14,37 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 40; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 40; } public override void AI() { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 65, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - if (projectile.velocity.X != projectile.velocity.X) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 65, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; + Projectile.position.X = Projectile.position.X + Projectile.velocity.X; + Projectile.velocity.X = -Projectile.velocity.X; } - if (projectile.velocity.Y != projectile.velocity.Y) + if (Projectile.velocity.Y != Projectile.velocity.Y) { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; + Projectile.position.Y = Projectile.position.Y + Projectile.velocity.Y; + Projectile.velocity.Y = -Projectile.velocity.Y; } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { for (int num447 = 0; num447 < 4; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); + Projectile.alpha = 255; int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.25f); Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 65, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 65, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/PlasmaShot.cs b/Projectiles/Magic/PlasmaShot.cs index b6977b5b4c..6b55585ee3 100644 --- a/Projectiles/Magic/PlasmaShot.cs +++ b/Projectiles/Magic/PlasmaShot.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class PlasmaShot : ModProjectile @@ -15,26 +16,26 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.extraUpdates = 10; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 10; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 6f) { for (int d = 0; d < 10; d++) { - Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; dust.velocity = Vector2.Zero; - dust.position -= projectile.velocity / 5f * d; + dust.position -= Projectile.velocity / 5f * d; dust.noGravity = true; dust.noLight = true; } @@ -43,21 +44,21 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); int cloudAmt = Main.rand.Next(20, 31); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < cloudAmt; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); - Projectile cloud = Projectile.NewProjectileDirect(projectile.Center, velocity, ProjectileID.ToxicCloud + Main.rand.Next(3), projectile.damage, 1f, projectile.owner, 0f, Main.rand.Next(-45, 1)); + Projectile cloud = Projectile.NewProjectileDirect(Projectile.Center, velocity, ProjectileID.ToxicCloud + Main.rand.Next(3), Projectile.damage, 1f, Projectile.owner, 0f, Main.rand.Next(-45, 1)); cloud.usesIDStaticNPCImmunity = true; cloud.idStaticNPCHitCooldown = 10; } } for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/PoseidonTyphoon.cs b/Projectiles/Magic/PoseidonTyphoon.cs index 4ccd3efb2c..095af615a4 100644 --- a/Projectiles/Magic/PoseidonTyphoon.cs +++ b/Projectiles/Magic/PoseidonTyphoon.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class PoseidonTyphoon : ModProjectile @@ -13,25 +14,25 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; //randomized in the item file now, penetrates 4 to 10 times - projectile.timeLeft = 300; - projectile.ignoreWater = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 10; //randomized in the item file now, penetrates 4 to 10 times + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; } public override void AI() { - projectile.rotation += projectile.velocity.X * 0.05f; + Projectile.rotation += Projectile.velocity.X * 0.05f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 6f, 30f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 6f, 30f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); } public override Color? GetAlpha(Color lightColor) @@ -41,20 +42,20 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; diff --git a/Projectiles/Magic/PrinceFlameLarge.cs b/Projectiles/Magic/PrinceFlameLarge.cs index 441484c89b..12533e9ef6 100644 --- a/Projectiles/Magic/PrinceFlameLarge.cs +++ b/Projectiles/Magic/PrinceFlameLarge.cs @@ -7,60 +7,61 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class PrinceFlameLarge : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public const int Lifetime = 60; public const int FadeoutTime = 25; public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Fireball"); - Main.projFrames[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + Main.projFrames[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = projectile.height = 40; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = Lifetime; - projectile.penetrate = 4; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 11; - projectile.magic = true; + Projectile.width = Projectile.height = 40; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = Lifetime; + Projectile.penetrate = 4; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 11; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { // Create rose petals. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { for (int i = 0; i < 10; i++) { - Dust rose = Dust.NewDustPerfect(projectile.Center, ModContent.DustType()); - rose.velocity += projectile.velocity.SafeNormalize(Vector2.Zero).RotatedByRandom(0.61f) * 2.5f; + Dust rose = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + rose.velocity += Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedByRandom(0.61f) * 2.5f; rose.velocity.Y += Main.rand.NextFloat(-2.4f, 1.6f); rose.velocity *= 0.4f; rose.scale = Main.rand.NextFloat(1.2f, 1.7f); rose.noGravity = Main.rand.NextBool(); } - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } // Explode before dissipating. - if (projectile.timeLeft == FadeoutTime) + if (Projectile.timeLeft == FadeoutTime) ExplodeIntoFireballs(); - bool dissipating = projectile.timeLeft < FadeoutTime; + bool dissipating = Projectile.timeLeft < FadeoutTime; for (int i = 0; i < (dissipating ? 2 : 1); i++) { - Dust fire = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire); + Dust fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire); fire.velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(2f, 6f); fire.scale *= Main.rand.NextFloat(1.15f, 1.7f); fire.noGravity = Main.rand.NextBool(); @@ -69,8 +70,8 @@ namespace CalamityMod.Projectiles.Magic // Dissipate at the end of the projectile's lifetime. if (dissipating) { - projectile.frame = (int)Math.Round(MathHelper.Lerp(4f, 7f, Utils.InverseLerp(FadeoutTime, 0f, projectile.timeLeft, true))); - projectile.velocity *= 0.95f; + Projectile.frame = (int)Math.Round(MathHelper.Lerp(4f, 7f, Utils.InverseLerp(FadeoutTime, 0f, Projectile.timeLeft, true))); + Projectile.velocity *= 0.95f; return; } @@ -79,41 +80,41 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 12; i++) { - Vector2 dustSpawnOffset = Vector2.UnitX * -projectile.width / 2f; + Vector2 dustSpawnOffset = Vector2.UnitX * -Projectile.width / 2f; dustSpawnOffset += -Vector2.UnitY.RotatedBy(i * MathHelper.TwoPi / 12f) * new Vector2(8f, 16f); - dustSpawnOffset = dustSpawnOffset.RotatedBy(projectile.rotation - MathHelper.PiOver2); + dustSpawnOffset = dustSpawnOffset.RotatedBy(Projectile.rotation - MathHelper.PiOver2); - Dust holyFire = Dust.NewDustDirect(projectile.Center, 0, 0, (int)CalamityDusts.ProfanedFire, 0f, 0f, 160, default, 1f); + Dust holyFire = Dust.NewDustDirect(Projectile.Center, 0, 0, (int)CalamityDusts.ProfanedFire, 0f, 0f, 160, default, 1f); holyFire.scale = 1.1f; holyFire.noGravity = true; - holyFire.position = projectile.Center + dustSpawnOffset; - holyFire.velocity = projectile.velocity * 0.1f; - holyFire.velocity = (projectile.Center - projectile.velocity * 3f - holyFire.position).SafeNormalize(Vector2.Zero) * 1.25f; + holyFire.position = Projectile.Center + dustSpawnOffset; + holyFire.velocity = Projectile.velocity * 0.1f; + holyFire.velocity = (Projectile.Center - Projectile.velocity * 3f - holyFire.position).SafeNormalize(Vector2.Zero) * 1.25f; } } Time++; - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - projectile.frameCounter++; - projectile.frame = projectile.frameCounter / 5 % 4; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % 4; } public void ExplodeIntoFireballs() { // Play a fizzle sound. - Main.PlaySound(SoundID.DD2_KoboldIgnite, projectile.Center); - if (Main.myPlayer != projectile.owner) + SoundEngine.PlaySound(SoundID.DD2_KoboldIgnite, Projectile.Center); + if (Main.myPlayer != Projectile.owner) return; // And explode into a burst of fire. - int damage = (int)(projectile.damage * 0.66f); - float kb = projectile.knockBack * 0.4f; + int damage = (int)(Projectile.damage * 0.66f); + float kb = Projectile.knockBack * 0.4f; float offsetAngle = Main.rand.NextFloatDirection() * 0.31f; for (int i = 0; i < ThePrince.FlameSplitCount; i++) { Vector2 shootVelocity = (MathHelper.TwoPi * i / ThePrince.FlameSplitCount + offsetAngle).ToRotationVector2() * 8f; - Vector2 flameSpawnPosition = projectile.Center + shootVelocity; - Projectile.NewProjectile(flameSpawnPosition, shootVelocity, ModContent.ProjectileType(), damage, kb, projectile.owner); + Vector2 flameSpawnPosition = Projectile.Center + shootVelocity; + Projectile.NewProjectile(flameSpawnPosition, shootVelocity, ModContent.ProjectileType(), damage, kb, Projectile.owner); } } @@ -121,7 +122,7 @@ namespace CalamityMod.Projectiles.Magic { lightColor = Color.Lerp(lightColor, Color.White, 0.8f); lightColor.A /= 4; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -132,7 +133,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 30; i++) { - Dust fire = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire); + Dust fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire); fire.velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(3f, 8f); fire.position += fire.velocity.RotatedBy(MathHelper.PiOver2) * 2f; fire.scale *= Main.rand.NextFloat(1.15f, 1.7f); diff --git a/Projectiles/Magic/PrinceFlameSmall.cs b/Projectiles/Magic/PrinceFlameSmall.cs index efc2e96b9d..80df848fa9 100644 --- a/Projectiles/Magic/PrinceFlameSmall.cs +++ b/Projectiles/Magic/PrinceFlameSmall.cs @@ -9,44 +9,44 @@ namespace CalamityMod.Projectiles.Magic { public class PrinceFlameSmall : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public const int AttackDelay = 12; public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Fire"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 240; - projectile.penetrate = 1; - projectile.magic = true; - projectile.extraUpdates = 2; + Projectile.width = Projectile.height = 16; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 240; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 2; } public override void AI() { Time++; - projectile.frameCounter++; - projectile.frame = projectile.frameCounter / 5 % Main.projFrames[projectile.type]; - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - projectile.Opacity = Utils.InverseLerp(0f, 15f, projectile.timeLeft, true); + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.Opacity = Utils.InverseLerp(0f, 15f, Projectile.timeLeft, true); if (Time > AttackDelay) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 14f, 32f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, false, 600f, 14f, 32f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { lightColor = Color.Lerp(lightColor, Color.White, 0.8f); lightColor.A /= 3; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/RainbowComet.cs b/Projectiles/Magic/RainbowComet.cs index 3e244cfc67..890abc6619 100644 --- a/Projectiles/Magic/RainbowComet.cs +++ b/Projectiles/Magic/RainbowComet.cs @@ -5,78 +5,79 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class RainbowComet : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public const float FadeinTime = 40f; public override void SetStaticDefaults() { DisplayName.SetDefault("Comet"); - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; - Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 72; - projectile.height = 72; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.magic = true; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.alpha = 255; - projectile.localNPCHitCooldown = 16; + Projectile.width = 72; + Projectile.height = 72; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.alpha = 255; + Projectile.localNPCHitCooldown = 16; } public override void AI() { Time++; - projectile.Opacity = Utils.InverseLerp(0f, 20f, Time, true); - projectile.velocity = projectile.velocity.RotatedBy(Math.Sin(Time / 30f) * 0.0125f); - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.Opacity = Utils.InverseLerp(0f, 20f, Time, true); + Projectile.velocity = Projectile.velocity.RotatedBy(Math.Sin(Time / 30f) * 0.0125f); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - projectile.frameCounter++; - if (projectile.frameCounter % 4 == 3) - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + if (Projectile.frameCounter % 4 == 3) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D cometTexture = ModContent.GetTexture(Texture); + Texture2D cometTexture = ModContent.Request(Texture); spriteBatch.Draw(cometTexture, - projectile.Center + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition, - cometTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame), - Color.White * projectile.Opacity, - projectile.rotation, + Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition, + cometTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame), + Color.White * Projectile.Opacity, + Projectile.rotation, cometTexture.Size() * 0.5f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { // Generate pretty sparkles. for (int i = 0; i < 18; i++) { Vector2 velocity = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(9f, 20f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, 1f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, 1f, Projectile.owner); } // And release a bunch of rockets. for (int i = 0; i < (int)RainbowRocket.PartyCannonExplosionType.Count; i++) { - Vector2 velocity = -projectile.velocity.SafeNormalize(-Vector2.UnitY); + Vector2 velocity = -Projectile.velocity.SafeNormalize(-Vector2.UnitY); velocity = velocity.RotatedBy(MathHelper.Lerp(-1.1f, 1.1f, i / (float)(int)RainbowRocket.PartyCannonExplosionType.Count)); velocity *= Main.rand.NextFloat(7f, 15f); - Projectile rocket = Projectile.NewProjectileDirect(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage * 3, 1f, projectile.owner); + Projectile rocket = Projectile.NewProjectileDirect(Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage * 3, 1f, Projectile.owner); rocket.ai[1] = i; } } @@ -85,14 +86,14 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 80; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, 263); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 263); dust.color = CalamityUtils.MulticolorLerp((Main.rand.NextFloat(0.4f) + Main.GlobalTime * 0.4f) % 0.999f, RainbowPartyCannon.ColorSet); dust.scale = Main.rand.NextFloat(0.6f, 0.9f); dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(12f, 16f); dust.noGravity = true; } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire").WithVolume(0.45f), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire").WithVolume(0.45f), Projectile.Center); } } } diff --git a/Projectiles/Magic/RainbowPartyCannonProjectile.cs b/Projectiles/Magic/RainbowPartyCannonProjectile.cs index da42c6a936..5383e20db4 100644 --- a/Projectiles/Magic/RainbowPartyCannonProjectile.cs +++ b/Projectiles/Magic/RainbowPartyCannonProjectile.cs @@ -2,13 +2,14 @@ using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class RainbowPartyCannonProjectile : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float Time => ref projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; public const float ChargeDelay = 60f; public override void SetStaticDefaults() { @@ -17,25 +18,25 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 92; - projectile.height = 66; - projectile.penetrate = -1; - projectile.magic = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 92; + Projectile.height = 66; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void AI() { Item heldItem = Owner.ActiveItem(); - projectile.damage = (int)((heldItem?.damage ?? 0) * Owner.MagicDamage()); + Projectile.damage = (int)((heldItem?.damage ?? 0) * Owner.MagicDamage()); UpdatePlayerVisuals(Owner.Center); bool stillUsingCannon = Owner.channel && !Owner.noItems && !Owner.CCed; if (!stillUsingCannon) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -47,16 +48,16 @@ namespace CalamityMod.Projectiles.Magic { if (Main.rand.NextBool(3)) { - Vector2 velocityDirection = projectile.velocity.RotatedByRandom(0.1f); - Vector2 shotOffset = velocityDirection * projectile.Size * 0.5f; - Dust.NewDustPerfect(projectile.Center + shotOffset, Main.rand.Next(139, 143), velocityDirection * Main.rand.NextFloat(5f, 9f)); + Vector2 velocityDirection = Projectile.velocity.RotatedByRandom(0.1f); + Vector2 shotOffset = velocityDirection * Projectile.Size * 0.5f; + Dust.NewDustPerfect(Projectile.Center + shotOffset, Main.rand.Next(139, 143), velocityDirection * Main.rand.NextFloat(5f, 9f)); } } Time++; // Forces the cannon to disappear immediately if anything goes wrong. - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } public void ConsumeManaAndFireProjectile(Item heldItem) @@ -66,41 +67,41 @@ namespace CalamityMod.Projectiles.Magic if (!Owner.CheckMana(heldItem.mana, true)) { - projectile.Kill(); + Projectile.Kill(); return; } - Main.PlaySound(heldItem.UseSound, projectile.Center); - Vector2 spawnPosition = projectile.Center + projectile.velocity * 150f; + SoundEngine.PlaySound(heldItem.UseSound, Projectile.Center); + Vector2 spawnPosition = Projectile.Center + Projectile.velocity * 150f; // Shoot farther back if the cannon is shoved into a bunch of tiles. if (!Collision.CanHitLine(Owner.MountedCenter, 16, 16, spawnPosition, 16, 16)) - spawnPosition = projectile.Center + projectile.velocity * 50f; + spawnPosition = Projectile.Center + Projectile.velocity * 50f; - Projectile.NewProjectile(spawnPosition, projectile.velocity.SafeNormalize(Vector2.Zero) * heldItem.shootSpeed, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, Owner.whoAmI); + Projectile.NewProjectile(spawnPosition, Projectile.velocity.SafeNormalize(Vector2.Zero) * heldItem.shootSpeed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Owner.whoAmI); } public void UpdatePlayerVisuals(Vector2 center) { // Place the cannon directly into the player's hand at all times. - projectile.Center = center; + Projectile.Center = center; // Set the direction of the cannon if it hasn't been set yet. - if (projectile.velocity == Vector2.Zero || projectile.velocity.Length() != 1f) - projectile.velocity = (Main.MouseWorld - center).SafeNormalize(Vector2.UnitX * projectile.direction); + if (Projectile.velocity == Vector2.Zero || Projectile.velocity.Length() != 1f) + Projectile.velocity = (Main.MouseWorld - center).SafeNormalize(Vector2.UnitX * Projectile.direction); - projectile.rotation = projectile.velocity.ToRotation(); - projectile.direction = projectile.spriteDirection = (Math.Cos(projectile.rotation) > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.direction = Projectile.spriteDirection = (Math.Cos(Projectile.rotation) > 0).ToDirectionInt(); // The cannon is a holdout projectile. Change the player's channel and direction values to reflect this. - Owner.ChangeDir(projectile.direction); - Owner.heldProj = projectile.whoAmI; + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); - if (projectile.spriteDirection == -1) - projectile.rotation += MathHelper.Pi; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + if (Projectile.spriteDirection == -1) + Projectile.rotation += MathHelper.Pi; } public override bool CanDamage() => false; diff --git a/Projectiles/Magic/RainbowRocket.cs b/Projectiles/Magic/RainbowRocket.cs index 32d6ae872c..8a468fb997 100644 --- a/Projectiles/Magic/RainbowRocket.cs +++ b/Projectiles/Magic/RainbowRocket.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -23,11 +24,11 @@ namespace CalamityMod.Projectiles.Magic } internal PrimitiveTrail TrailDrawer = null; - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public PartyCannonExplosionType RocketType { - get => (PartyCannonExplosionType)(int)projectile.ai[1]; - set => projectile.ai[1] = (int)value; + get => (PartyCannonExplosionType)(int)Projectile.ai[1]; + set => Projectile.ai[1] = (int)value; } public const float SwerveAngle = 0.02f; public const float SwerveAngleOffsetMax = 0.04f; @@ -36,58 +37,58 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Rainbow Rocket"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 52; + Projectile.width = 28; + Projectile.height = 52; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.magic = true; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Magic; } #region AI public override void AI() { Time++; - Lighting.AddLight(projectile.Center, Main.hslToRgb((float)Math.Sin(Time / 20f) * 0.5f + 0.5f, 0.9f, 0.9f).ToVector3()); + Lighting.AddLight(Projectile.Center, Main.hslToRgb((float)Math.Sin(Time / 20f) * 0.5f + 0.5f, 0.9f, 0.9f).ToVector3()); - projectile.tileCollide = Time > 60f; + Projectile.tileCollide = Time > 60f; - projectile.frameCounter++; - if (projectile.frameCounter % 4 == 3) - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + if (Projectile.frameCounter % 4 == 3) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; - NPC potentialTarget = projectile.Center.ClosestNPCAt(2300f, true, true); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(2300f, true, true); if (Time < SwerveTime) DoMovement_IdleSwerveFly(); else if (potentialTarget != null) DoMovement_FlyToTarget(potentialTarget); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } private void DoMovement_IdleSwerveFly() { float swerveAngleOffset = MathHelper.Lerp(-SwerveAngleOffsetMax, SwerveAngleOffsetMax, (float)RocketType / ((float)PartyCannonExplosionType.Count)); - projectile.velocity = projectile.velocity.RotatedBy(swerveAngleOffset + SwerveAngle); + Projectile.velocity = Projectile.velocity.RotatedBy(swerveAngleOffset + SwerveAngle); } private void DoMovement_FlyToTarget(NPC target) { - float angleToTarget = projectile.AngleTo(target.Center); - float angleOffset = MathHelper.WrapAngle(angleToTarget - projectile.velocity.ToRotation()); - projectile.velocity = projectile.velocity.RotatedBy(MathHelper.Clamp(angleOffset, -0.2f, 0.2f)); - projectile.velocity = projectile.velocity.SafeNormalize(-Vector2.UnitY) * (projectile.velocity.Length() + HomingAcceleration); + float angleToTarget = Projectile.AngleTo(target.Center); + float angleOffset = MathHelper.WrapAngle(angleToTarget - Projectile.velocity.ToRotation()); + Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.Clamp(angleOffset, -0.2f, 0.2f)); + Projectile.velocity = Projectile.velocity.SafeNormalize(-Vector2.UnitY) * (Projectile.velocity.Length() + HomingAcceleration); - if (Vector2.Dot(projectile.velocity.SafeNormalize(Vector2.Zero), projectile.SafeDirectionTo(target.Center)) < 0.75f) - projectile.velocity *= 0.75f; + if (Vector2.Dot(Projectile.velocity.SafeNormalize(Vector2.Zero), Projectile.SafeDirectionTo(target.Center)) < 0.75f) + Projectile.velocity *= 0.75f; } #endregion @@ -117,8 +118,8 @@ namespace CalamityMod.Projectiles.Magic internal Color ColorFunction(float completionRatio) { - Color baseColor = Main.hslToRgb((projectile.identity * 0.33f + completionRatio + Main.GlobalTime * 2f) % 1f, 1f, 0.54f); - return Color.Lerp(GetRocketColor(), baseColor, MathHelper.Clamp(completionRatio * 0.8f, 0f, 1f)) * projectile.Opacity; + Color baseColor = Main.hslToRgb((Projectile.identity * 0.33f + completionRatio + Main.GlobalTime * 2f) % 1f, 1f, 0.54f); + return Color.Lerp(GetRocketColor(), baseColor, MathHelper.Clamp(completionRatio * 0.8f, 0f, 1f)) * Projectile.Opacity; } internal float WidthFunction(float completionRatio) @@ -129,7 +130,7 @@ namespace CalamityMod.Projectiles.Magic width = (float)Math.Sin(completionRatio / 0.1f * MathHelper.PiOver2) * maxWidthOutwardness + 0.1f; else width = MathHelper.Lerp(maxWidthOutwardness, 0f, Utils.InverseLerp(0.1f, 1f, completionRatio, true)); - return width * projectile.Opacity; + return width * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -137,17 +138,17 @@ namespace CalamityMod.Projectiles.Magic if (TrailDrawer is null) TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction); - projectile.oldPos[0] = projectile.position + projectile.velocity.SafeNormalize(Vector2.Zero) * 50f; - TrailDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f - Main.screenPosition + projectile.velocity, 80); + Projectile.oldPos[0] = Projectile.position + Projectile.velocity.SafeNormalize(Vector2.Zero) * 50f; + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition + Projectile.velocity, 80); - Texture2D rocketTexture = ModContent.GetTexture(Texture); + Texture2D rocketTexture = ModContent.Request(Texture); spriteBatch.Draw(rocketTexture, - projectile.Center - Main.screenPosition, - rocketTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame), + Projectile.Center - Main.screenPosition, + rocketTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame), GetRocketColor(), - projectile.rotation, + Projectile.rotation, rocketTexture.Size() * 0.5f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); return false; @@ -157,26 +158,26 @@ namespace CalamityMod.Projectiles.Magic #region Kill Effects public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - for (int i = 1; i < projectile.oldPos.Length; i++) + for (int i = 1; i < Projectile.oldPos.Length; i++) { if (Main.rand.NextBool(3)) { - float offsetAngle = MathHelper.Lerp(-MathHelper.PiOver4, MathHelper.PiOver4, i / (float)projectile.oldPos.Length); - Vector2 spawnPosition = projectile.oldPos[i] + projectile.Size * 0.5f; - Vector2 spawnVelocity = (projectile.oldPos[i - 1] - projectile.oldPos[i]).SafeNormalize(Vector2.Zero); + float offsetAngle = MathHelper.Lerp(-MathHelper.PiOver4, MathHelper.PiOver4, i / (float)Projectile.oldPos.Length); + Vector2 spawnPosition = Projectile.oldPos[i] + Projectile.Size * 0.5f; + Vector2 spawnVelocity = (Projectile.oldPos[i - 1] - Projectile.oldPos[i]).SafeNormalize(Vector2.Zero); spawnVelocity = spawnVelocity.RotatedBy(offsetAngle); spawnVelocity *= Main.rand.NextFloat(12f, 18f); - Projectile.NewProjectile(spawnPosition, spawnVelocity, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner); + Projectile.NewProjectile(spawnPosition, spawnVelocity, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner); } } } - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 350); - projectile.Damage(); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 350); + Projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); // There's no need to spawn dust from the server. if (Main.dedServ) @@ -213,18 +214,18 @@ namespace CalamityMod.Projectiles.Magic public void PinkMarkExplosionDust() { // Spawn the main balloon. - BalloonExplosionDust(projectile.Center, Main.rand.NextFloat(8f, 15f), Color.Yellow); + BalloonExplosionDust(Projectile.Center, Main.rand.NextFloat(8f, 15f), Color.Yellow); // Spawn the two smaller balloons. float absoluteOffsetAngle = Main.rand.NextFloat(0.4f, 0.7f) * -1f; Vector2 offset = Vector2.UnitY.RotatedBy(absoluteOffsetAngle) * 120f; offset += Vector2.UnitX * 40f; - BalloonExplosionDust(projectile.Center + offset, Main.rand.NextFloat(6f, 11f), Color.DeepPink, absoluteOffsetAngle); + BalloonExplosionDust(Projectile.Center + offset, Main.rand.NextFloat(6f, 11f), Color.DeepPink, absoluteOffsetAngle); absoluteOffsetAngle = Main.rand.NextFloat(0.4f, 0.7f); offset = Vector2.UnitY.RotatedBy(absoluteOffsetAngle) * 120f; offset -= Vector2.UnitX * 40f; - BalloonExplosionDust(projectile.Center + offset, Main.rand.NextFloat(6f, 11f), Color.DeepPink, absoluteOffsetAngle); + BalloonExplosionDust(Projectile.Center + offset, Main.rand.NextFloat(6f, 11f), Color.DeepPink, absoluteOffsetAngle); } public void BalloonExplosionDust(Vector2 center, float petalBurstSpeed, Color balloonColor, float absoluteOffsetAngle = 0) { @@ -282,18 +283,18 @@ namespace CalamityMod.Projectiles.Magic public void OrangeMarkExplosionDust() { // Spawn the main apple. - AppleExplosionDust(projectile.Center, Main.rand.NextFloat(8f, 15f)); + AppleExplosionDust(Projectile.Center, Main.rand.NextFloat(8f, 15f)); // Spawn two other apples to the side. float absoluteOffsetAngle = Main.rand.NextFloat(0.4f, 0.7f) * -1f; Vector2 offset = Vector2.UnitY.RotatedBy(absoluteOffsetAngle) * 120f; offset += Vector2.UnitX * 70f; - AppleExplosionDust(projectile.Center + offset, Main.rand.NextFloat(6f, 11f), absoluteOffsetAngle); + AppleExplosionDust(Projectile.Center + offset, Main.rand.NextFloat(6f, 11f), absoluteOffsetAngle); absoluteOffsetAngle = Main.rand.NextFloat(0.4f, 0.7f); offset = Vector2.UnitY.RotatedBy(absoluteOffsetAngle) * 120f; offset -= Vector2.UnitX * 70f; - AppleExplosionDust(projectile.Center + offset, Main.rand.NextFloat(6f, 11f), absoluteOffsetAngle); + AppleExplosionDust(Projectile.Center + offset, Main.rand.NextFloat(6f, 11f), absoluteOffsetAngle); } public void AppleExplosionDust(Vector2 center, float appleBurstSpeed, float offsetAngle = 0f) { @@ -361,15 +362,15 @@ namespace CalamityMod.Projectiles.Magic public void YellowMarkExplosionDust() { // Spawn three butterflies. - ButterflyExplosionDust(projectile.Center, Main.rand.NextFloat(8f, 12f)); + ButterflyExplosionDust(Projectile.Center, Main.rand.NextFloat(8f, 12f)); Vector2 offset = Vector2.UnitY.RotatedBy(Main.rand.NextFloat(0.4f, 0.7f) * -1f) * 120f; offset += Vector2.UnitX * 84f; - ButterflyExplosionDust(projectile.Center + offset, Main.rand.NextFloat(6f, 11f)); + ButterflyExplosionDust(Projectile.Center + offset, Main.rand.NextFloat(6f, 11f)); offset = Vector2.UnitY.RotatedBy(Main.rand.NextFloat(0.4f, 0.7f)) * 120f; offset -= Vector2.UnitX * 84f; - ButterflyExplosionDust(projectile.Center + offset, Main.rand.NextFloat(6f, 11f)); + ButterflyExplosionDust(Projectile.Center + offset, Main.rand.NextFloat(6f, 11f)); } public void ButterflyExplosionDust(Vector2 center, float butterflyBurstSpeed, float offsetAngle = 0f) { @@ -428,17 +429,17 @@ namespace CalamityMod.Projectiles.Magic public void WhiteMarkExplosionDust() { // Spawn three diamonds. - DiamondExplosionDust(projectile.Center, Main.rand.NextFloat(8f, 12f)); + DiamondExplosionDust(Projectile.Center, Main.rand.NextFloat(8f, 12f)); float absoluteOffsetAngle = Main.rand.NextFloat(0.4f, 0.7f); Vector2 offset = Vector2.UnitY.RotatedBy(absoluteOffsetAngle * -1f) * 120f; offset += Vector2.UnitX * 84f; - DiamondExplosionDust(projectile.Center + offset, Main.rand.NextFloat(6f, 11f)); + DiamondExplosionDust(Projectile.Center + offset, Main.rand.NextFloat(6f, 11f)); absoluteOffsetAngle = Main.rand.NextFloat(0.4f, 0.7f); offset = Vector2.UnitY.RotatedBy(absoluteOffsetAngle) * 120f; offset -= Vector2.UnitX * 84f; - DiamondExplosionDust(projectile.Center + offset, Main.rand.NextFloat(6f, 11f)); + DiamondExplosionDust(Projectile.Center + offset, Main.rand.NextFloat(6f, 11f)); } public void DiamondExplosionDust(Vector2 center, float diamondBurstSpeed, float offsetAngle = 0f) { @@ -485,7 +486,7 @@ namespace CalamityMod.Projectiles.Magic #region Sky Blue Mark public void SkyBlueMarkExplosionDust() { - RainbowBoltExplosionDust(projectile.Center, Main.rand.NextFloat(-0.2f, 0.2f)); + RainbowBoltExplosionDust(Projectile.Center, Main.rand.NextFloat(-0.2f, 0.2f)); } public void RainbowBoltExplosionDust(Vector2 center, float offsetAngle = 0f) { @@ -579,12 +580,12 @@ namespace CalamityMod.Projectiles.Magic #region Purple Mark public void PurpleMarkExplosionDust() { - TwilightStarExplosionDust(projectile.Center, 14f, Color.Magenta); + TwilightStarExplosionDust(Projectile.Center, 14f, Color.Magenta); for (int i = 0; i < 6; i++) { float angle = MathHelper.TwoPi * i / 6f; Vector2 offset = angle.ToRotationVector2() * Main.rand.NextFloat(140f, 180f); - TwilightStarExplosionDust(projectile.Center + offset, 4f, Color.White, Main.rand.NextFloat(-0.2f, 0.2f)); + TwilightStarExplosionDust(Projectile.Center + offset, 4f, Color.White, Main.rand.NextFloat(-0.2f, 0.2f)); } } public void TwilightStarExplosionDust(Vector2 center, float petalBurstSpeed, Color starColor, float absoluteOffsetAngle = 0f) @@ -615,8 +616,8 @@ namespace CalamityMod.Projectiles.Magic #region Pale Pink Mark public void PalePinkMarkExplosionDust() { - StarlightMarkExplosionDust(projectile.Center); - StarlightStarExplosionDust(projectile.Center + new Vector2(16f, 36f), 2f); + StarlightMarkExplosionDust(Projectile.Center); + StarlightStarExplosionDust(Projectile.Center + new Vector2(16f, 36f), 2f); } public void StarlightMarkExplosionDust(Vector2 center) { diff --git a/Projectiles/Magic/RancorArm.cs b/Projectiles/Magic/RancorArm.cs index f2a8525f2e..e83d42b856 100644 --- a/Projectiles/Magic/RancorArm.cs +++ b/Projectiles/Magic/RancorArm.cs @@ -7,63 +7,64 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class RancorArm : ModProjectile { public Vector2 IdealPosition; - public Player Owner => Main.player[projectile.owner]; - public float RotationDirection => projectile.rotation + projectile.ai[0]; - public ref float Time => ref projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public float RotationDirection => Projectile.rotation + Projectile.ai[0]; + public ref float Time => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Vengeful Arm"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = projectile.height = 4; - projectile.friendly = true; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.timeLeft = 240; - projectile.hide = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 12; - projectile.ignoreWater = true; + Projectile.width = Projectile.height = 4; + Projectile.friendly = true; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 240; + Projectile.hide = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 12; + Projectile.ignoreWater = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.frame); - writer.Write(projectile.rotation); + writer.Write(Projectile.frame); + writer.Write(Projectile.rotation); writer.WriteVector2(IdealPosition); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.frame = reader.ReadInt32(); - projectile.rotation = reader.ReadSingle(); + Projectile.frame = reader.ReadInt32(); + Projectile.rotation = reader.ReadSingle(); IdealPosition = reader.ReadVector2(); } public override void AI() { // Decide a frame to use and adjust the hitbox based on it. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { // Play a wraith death sound. - Main.PlaySound(SoundID.NPCDeath52, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCDeath52, Projectile.Center); - projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); Vector2 newSize; - switch (projectile.frame) + switch (Projectile.frame) { case 0: newSize = new Vector2(16f, 48f); @@ -87,35 +88,35 @@ namespace CalamityMod.Projectiles.Magic } // Find the lowest point. - Vector2 idealCenter = projectile.Center; + Vector2 idealCenter = Projectile.Center; if (WorldUtils.Find(idealCenter.ToTileCoordinates(), Searches.Chain(new Searches.Down(25), new CustomConditions.SolidOrPlatform()), out Point result)) { idealCenter = result.ToWorldCoordinates(); } idealCenter.Y += 36f; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)newSize.X, (int)newSize.Y); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, (int)newSize.X, (int)newSize.Y); // Sometimes use a slanted rotation. if (Main.rand.NextBool(3)) - projectile.rotation = Main.rand.NextFloatDirection() * 0.3f; + Projectile.rotation = Main.rand.NextFloatDirection() * 0.3f; IdealPosition = idealCenter; - projectile.localAI[0] = 1f; - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.netUpdate = true; } // Rise from underneath the ideal position and fade in. // At the end of the projectile's lifetime the arm sinks back into the ground and withers away. - float descendCompletion = Utils.InverseLerp(0f, 24f, projectile.timeLeft, true); + float descendCompletion = Utils.InverseLerp(0f, 24f, Projectile.timeLeft, true); float riseCompletion = Utils.InverseLerp(0f, 30f, Time, true); float heightOffset = -58f; - if (projectile.height > 90f) + if (Projectile.height > 90f) heightOffset += 22f; - projectile.Bottom = IdealPosition + Vector2.UnitY.RotatedBy(RotationDirection) * ((1f - riseCompletion * descendCompletion) * 64f + heightOffset); - projectile.Opacity = (float)Math.Pow(riseCompletion, 2.4) * descendCompletion; - projectile.scale = descendCompletion; + Projectile.Bottom = IdealPosition + Vector2.UnitY.RotatedBy(RotationDirection) * ((1f - riseCompletion * descendCompletion) * 64f + heightOffset); + Projectile.Opacity = (float)Math.Pow(riseCompletion, 2.4) * descendCompletion; + Projectile.scale = descendCompletion; Time++; } @@ -123,9 +124,9 @@ namespace CalamityMod.Projectiles.Magic public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float _ = 0f; - Vector2 bottom = projectile.Bottom; - Vector2 top = projectile.Bottom - Vector2.UnitY.RotatedBy(RotationDirection) * projectile.height; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), bottom, top, projectile.width * projectile.scale, ref _); + Vector2 bottom = Projectile.Bottom; + Vector2 top = Projectile.Bottom - Vector2.UnitY.RotatedBy(RotationDirection) * Projectile.height; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), bottom, top, Projectile.width * Projectile.scale, ref _); } public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) @@ -140,17 +141,17 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Texture2D texture = Main.projectileTexture[Projectile.type]; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; - Vector2 drawPosition = projectile.Center - Main.screenPosition; - Color light = Lighting.GetColor((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16); - Color drawColor = light * projectile.Opacity; - Color fadedColor = Color.Red * projectile.Opacity * projectile.scale * 0.4f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color light = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16); + Color drawColor = light * Projectile.Opacity; + Color fadedColor = Color.Red * Projectile.Opacity * Projectile.scale * 0.4f; fadedColor.A = 0; - Vector2 scale = new Vector2(projectile.scale, 1f); - float afterimageOffset = projectile.Opacity * projectile.scale * 5f; + Vector2 scale = new Vector2(Projectile.scale, 1f); + float afterimageOffset = Projectile.Opacity * Projectile.scale * 5f; for (int i = 0; i < 6; i++) { diff --git a/Projectiles/Magic/RancorFog.cs b/Projectiles/Magic/RancorFog.cs index ab1bc1c460..a06d01f45f 100644 --- a/Projectiles/Magic/RancorFog.cs +++ b/Projectiles/Magic/RancorFog.cs @@ -9,37 +9,37 @@ namespace CalamityMod.Projectiles.Magic { public class RancorFog : ModProjectile { - public ref float LightPower => ref projectile.ai[0]; + public ref float LightPower => ref Projectile.ai[0]; public override void SetStaticDefaults() => DisplayName.SetDefault("Fog"); public override void SetDefaults() { - projectile.width = projectile.height = 184; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.timeLeft = 210; - projectile.hide = true; - projectile.ignoreWater = true; + Projectile.width = Projectile.height = 184; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 210; + Projectile.hide = true; + Projectile.ignoreWater = true; } public override void AI() { // Decide scale and initial rotation on the first frame this projectile exists. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale = Main.rand.NextFloat(1f, 1.7f); - projectile.rotation = Main.rand.NextFloat(MathHelper.TwoPi); - projectile.localAI[0] = 1f; + Projectile.scale = Main.rand.NextFloat(1f, 1.7f); + Projectile.rotation = Main.rand.NextFloat(MathHelper.TwoPi); + Projectile.localAI[0] = 1f; } // Calculate light power. This checks below the position of the fog to check if this fog is underground. // Without this, it may render over the fullblack that the game renders for obscured tiles. - float lightPowerBelow = Lighting.GetColor((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D); + float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D); LightPower = MathHelper.Lerp(LightPower, lightPowerBelow, 0.15f); - projectile.Opacity = Utils.InverseLerp(210f, 195f, projectile.timeLeft, true) * Utils.InverseLerp(0f, 90f, projectile.timeLeft, true); - projectile.rotation += projectile.velocity.X * 0.004f; - projectile.velocity *= 0.985f; + Projectile.Opacity = Utils.InverseLerp(210f, 195f, Projectile.timeLeft, true) * Utils.InverseLerp(0f, 90f, Projectile.timeLeft, true); + Projectile.rotation += Projectile.velocity.X * 0.004f; + Projectile.velocity *= 0.985f; } public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) @@ -51,13 +51,13 @@ namespace CalamityMod.Projectiles.Magic { spriteBatch.SetBlendState(BlendState.Additive); - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; Vector2 origin = texture.Size() * 0.5f; - Vector2 drawPosition = projectile.Center - Main.screenPosition; - float opacity = Utils.InverseLerp(0f, 0.08f, LightPower, true) * projectile.Opacity * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float opacity = Utils.InverseLerp(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.5f; Color drawColor = new Color(236, 0, 68) * opacity; - Vector2 scale = projectile.Size / texture.Size() * projectile.scale; - spriteBatch.Draw(texture, drawPosition, null, drawColor, projectile.rotation, origin, scale, SpriteEffects.None, 0f); + Vector2 scale = Projectile.Size / texture.Size() * Projectile.scale; + spriteBatch.Draw(texture, drawPosition, null, drawColor, Projectile.rotation, origin, scale, SpriteEffects.None, 0f); spriteBatch.SetBlendState(BlendState.AlphaBlend); return false; diff --git a/Projectiles/Magic/RancorHoldout.cs b/Projectiles/Magic/RancorHoldout.cs index 5a0d21eea0..919690288f 100644 --- a/Projectiles/Magic/RancorHoldout.cs +++ b/Projectiles/Magic/RancorHoldout.cs @@ -7,30 +7,30 @@ namespace CalamityMod.Projectiles.Magic { public class RancorHoldout : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float Time => ref projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; public const int ManaConsumeRate = 12; public override void SetStaticDefaults() { DisplayName.SetDefault("Rancor"); - Main.projFrames[projectile.type] = 16; + Main.projFrames[Projectile.type] = 16; } public override void SetDefaults() { - projectile.width = projectile.height = 34; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.hide = true; - projectile.timeLeft = 90000; + Projectile.width = Projectile.height = 34; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.hide = true; + Projectile.timeLeft = 90000; } public override void AI() { - projectile.Center = Owner.Center + Vector2.UnitX * Owner.direction * 8f; + Projectile.Center = Owner.Center + Vector2.UnitX * Owner.direction * 8f; // 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 = Time % ManaConsumeRate != ManaConsumeRate - 1f || Owner.CheckMana(Owner.ActiveItem(), -1, true, false); @@ -39,22 +39,22 @@ namespace CalamityMod.Projectiles.Magic // If the owner is no longer able to hold the book, kill it. if (!bookStillInUse) { - projectile.Kill(); + Projectile.Kill(); return; } Time++; // Cast the magic circle on the first frame. - if (Main.myPlayer == projectile.owner && Time == 1f) - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + if (Main.myPlayer == Projectile.owner && Time == 1f) + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); // Handle frames. - projectile.frameCounter++; - if (projectile.frameCounter >= 4) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 4) { - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; - projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frameCounter = 0; } AdjustPlayerHoldValues(); @@ -64,9 +64,9 @@ namespace CalamityMod.Projectiles.Magic public void AdjustPlayerHoldValues() { - projectile.spriteDirection = projectile.direction = Owner.direction; - projectile.timeLeft = 2; - Owner.heldProj = projectile.whoAmI; + Projectile.spriteDirection = Projectile.direction = Owner.direction; + Projectile.timeLeft = 2; + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; Owner.itemRotation = 0f; diff --git a/Projectiles/Magic/RancorLargeCinder.cs b/Projectiles/Magic/RancorLargeCinder.cs index 8baff72124..a1a85be991 100644 --- a/Projectiles/Magic/RancorLargeCinder.cs +++ b/Projectiles/Magic/RancorLargeCinder.cs @@ -7,21 +7,21 @@ namespace CalamityMod.Projectiles.Magic { public class RancorLargeCinder : ModProjectile { - public ref float Time => ref projectile.ai[0]; - public ref float Lifetime => ref projectile.ai[1]; + public ref float Time => ref Projectile.ai[0]; + public ref float Lifetime => ref Projectile.ai[1]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() => DisplayName.SetDefault("Lava Cinder"); public override void SetDefaults() { - projectile.width = projectile.height = 36; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.friendly = true; - projectile.hostile = true; - projectile.timeLeft = 300; - projectile.ignoreWater = true; + Projectile.width = Projectile.height = 36; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.friendly = true; + Projectile.hostile = true; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; } public override void AI() @@ -30,21 +30,21 @@ namespace CalamityMod.Projectiles.Magic if (Lifetime == 0f) { Lifetime = Main.rand.Next(45, 150); - projectile.netUpdate = true; + Projectile.netUpdate = true; } // Calculate the scale of the cinder. else { - projectile.scale = Utils.InverseLerp(0f, 20f, Time, true) * Utils.InverseLerp(Lifetime, Lifetime - 20f, Time, true); - projectile.scale *= MathHelper.Lerp(0.5f, 1f, projectile.identity % 6f / 6f); + Projectile.scale = Utils.InverseLerp(0f, 20f, Time, true) * Utils.InverseLerp(Lifetime, Lifetime - 20f, Time, true); + Projectile.scale *= MathHelper.Lerp(0.5f, 1f, Projectile.identity % 6f / 6f); } // Fall down. - projectile.velocity.Y += 0.04f; + Projectile.velocity.Y += 0.04f; // Create lava particles. - FusableParticleManager.GetParticleSetByType().SpawnParticle(projectile.Center + Main.rand.NextVector2Circular(6f, 6f), projectile.scale * 36f); + FusableParticleManager.GetParticleSetByType().SpawnParticle(Projectile.Center + Main.rand.NextVector2Circular(6f, 6f), Projectile.scale * 36f); Time++; } @@ -54,6 +54,6 @@ namespace CalamityMod.Projectiles.Magic damage = Main.rand.Next(80, 90); } - public override Color? GetAlpha(Color lightColor) => Color.White * projectile.Opacity; + public override Color? GetAlpha(Color lightColor) => Color.White * Projectile.Opacity; } } diff --git a/Projectiles/Magic/RancorLaserbeam.cs b/Projectiles/Magic/RancorLaserbeam.cs index a845214d2b..061890b042 100644 --- a/Projectiles/Magic/RancorLaserbeam.cs +++ b/Projectiles/Magic/RancorLaserbeam.cs @@ -9,21 +9,21 @@ using System.Linq; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.Projectiles.Magic { public class RancorLaserbeam : ModProjectile { public PrimitiveTrail RayDrawer = null; - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public Projectile MagicCircle { get { for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].identity != projectile.ai[0] || !Main.projectile[i].active || Main.projectile[i].owner != projectile.owner) + if (Main.projectile[i].identity != Projectile.ai[0] || !Main.projectile[i].active || Main.projectile[i].owner != Projectile.owner) continue; return Main.projectile[i]; @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Magic return null; } } - public ref float LaserLength => ref projectile.ai[1]; + public ref float LaserLength => ref Projectile.ai[1]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public const float MaxLaserLength = 3330f; @@ -40,17 +40,17 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = projectile.height = 32; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.hide = true; - projectile.Calamity().PierceResistHarshness = 0.06f; - projectile.Calamity().PierceResistCap = 0.4f; + Projectile.width = Projectile.height = 32; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.hide = true; + Projectile.Calamity().PierceResistHarshness = 0.06f; + Projectile.Calamity().PierceResistCap = 0.4f; } public override void AI() @@ -58,63 +58,63 @@ namespace CalamityMod.Projectiles.Magic // If the owner is no longer able to cast the beam, kill it. if (!Owner.channel || Owner.noItems || Owner.CCed || MagicCircle is null) { - projectile.Kill(); + Projectile.Kill(); return; } // Grow bigger up to a point. - projectile.scale = MathHelper.Clamp(projectile.scale + 0.15f, 0.05f, 2f); + Projectile.scale = MathHelper.Clamp(Projectile.scale + 0.15f, 0.05f, 2f); // Decide where to position the laserbeam. - Vector2 circlePointDirection = projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction); - projectile.Center = MagicCircle.Center; + Vector2 circlePointDirection = Projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.Center = MagicCircle.Center; // Update the laser length. float[] laserLengthSamplePoints = new float[24]; - Collision.LaserScan(projectile.Center, projectile.velocity, projectile.scale * 8f, MaxLaserLength, laserLengthSamplePoints); + Collision.LaserScan(Projectile.Center, Projectile.velocity, Projectile.scale * 8f, MaxLaserLength, laserLengthSamplePoints); LaserLength = laserLengthSamplePoints.Average(); // Update aim. UpdateAim(); // Adjust damage every frame. This is necessary to ensure that mana sickness and such are applied. - projectile.damage = (int)(MagicCircle.damage * Owner.MagicDamage()); + Projectile.damage = (int)(MagicCircle.damage * Owner.MagicDamage()); // Create arms on surfaces. - if (Main.myPlayer == projectile.owner && Main.rand.NextBool(8)) + if (Main.myPlayer == Projectile.owner && Main.rand.NextBool(8)) CreateArmsOnSurfaces(); // Create hit effects at the end of the beam. - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) CreateTileHitEffects(); // Make the beam cast light along its length. The brightness of the light is reliant on the scale of the beam. - DelegateMethods.v3_1 = Color.DarkViolet.ToVector3() * projectile.scale * 0.4f; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.width * projectile.scale, DelegateMethods.CastLight); + DelegateMethods.v3_1 = Color.DarkViolet.ToVector3() * Projectile.scale * 0.4f; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength, Projectile.width * Projectile.scale, DelegateMethods.CastLight); } public void UpdateAim() { // Only execute the aiming code for the owner. - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; Vector2 newAimDirection = MagicCircle.velocity.SafeNormalize(Vector2.UnitY); // Sync if the direction is different from the old one. // Spam caps are ignored due to the frequency of this happening. - if (newAimDirection != projectile.velocity) + if (newAimDirection != Projectile.velocity) { - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } - projectile.velocity = newAimDirection; + Projectile.velocity = newAimDirection; } public void CreateArmsOnSurfaces() { - Vector2 endOfLaser = projectile.Center + projectile.velocity * LaserLength + Main.rand.NextVector2Circular(80f, 8f); + Vector2 endOfLaser = Projectile.Center + Projectile.velocity * LaserLength + Main.rand.NextVector2Circular(80f, 8f); Vector2 idealCenter = endOfLaser; if (WorldUtils.Find(idealCenter.ToTileCoordinates(), Searches.Chain(new Searches.Down(5), new CustomConditions.SolidOrPlatform()), out Point result)) { @@ -123,17 +123,17 @@ namespace CalamityMod.Projectiles.Magic Point endOfLaserTileCoords = idealCenter.ToTileCoordinates(); Tile endTile = CalamityUtils.ParanoidTileRetrieval(endOfLaserTileCoords.X, endOfLaserTileCoords.Y); - if (endTile.nactive() && (Main.tileSolid[endTile.type] || Main.tileSolidTop[endTile.type]) && !endTile.halfBrick() && endTile.slope() == 0) + if (endTile.nactive() && (Main.tileSolid[endTile.TileType] || Main.tileSolidTop[endTile.TileType]) && !endTile.halfBrick() && endTile.slope() == 0) { Vector2 armSpawnPosition = endOfLaserTileCoords.ToWorldCoordinates(); - Projectile.NewProjectile(armSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), projectile.damage * 2 / 3, 0f, projectile.owner); + Projectile.NewProjectile(armSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 2 / 3, 0f, Projectile.owner); } } public void CreateTileHitEffects() { - Vector2 endOfLaser = projectile.Center + projectile.velocity * (LaserLength - Main.rand.NextFloat(12f, 72f)); - Projectile.NewProjectile(endOfLaser, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType(), 0, 0f, projectile.owner); + Vector2 endOfLaser = Projectile.Center + Projectile.velocity * (LaserLength - Main.rand.NextFloat(12f, 72f)); + Projectile.NewProjectile(endOfLaser, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType(), 0, 0f, Projectile.owner); if (Main.rand.NextBool(2)) { @@ -143,22 +143,22 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(11)) { type = ModContent.ProjectileType(); - damage = projectile.damage / 3; + damage = Projectile.damage / 3; cinderSpeed *= 1.2f; } - Vector2 cinderVelocity = Vector2.Lerp(-projectile.velocity, -Vector2.UnitY, 0.45f).RotatedByRandom(0.72f) * cinderSpeed; - Projectile.NewProjectile(endOfLaser, cinderVelocity, type, damage, 0f, projectile.owner); + Vector2 cinderVelocity = Vector2.Lerp(-Projectile.velocity, -Vector2.UnitY, 0.45f).RotatedByRandom(0.72f) * cinderSpeed; + Projectile.NewProjectile(endOfLaser, cinderVelocity, type, damage, 0f, Projectile.owner); } - FusableParticleManager.GetParticleSetByType().SpawnParticle(endOfLaser + Main.rand.NextVector2Circular(10f, 10f) + projectile.velocity * 40f, 135f); + FusableParticleManager.GetParticleSetByType().SpawnParticle(endOfLaser + Main.rand.NextVector2Circular(10f, 10f) + Projectile.velocity * 40f, 135f); } - private float PrimitiveWidthFunction(float completionRatio) => projectile.scale * 20f; + private float PrimitiveWidthFunction(float completionRatio) => Projectile.scale * 20f; private Color PrimitiveColorFunction(float completionRatio) { Color vibrantColor = Color.Lerp(Color.Blue, Color.Red, (float)Math.Cos(Main.GlobalTime * 0.67f - completionRatio / LaserLength * 29f) * 0.5f + 0.5f); - float opacity = projectile.Opacity * Utils.InverseLerp(0.97f, 0.9f, completionRatio, true) * + float opacity = Projectile.Opacity * Utils.InverseLerp(0.97f, 0.9f, completionRatio, true) * Utils.InverseLerp(0f, MathHelper.Clamp(15f / LaserLength, 0f, 0.5f), completionRatio, true) * (float)Math.Pow(Utils.InverseLerp(60f, 270f, LaserLength, true), 3D); return Color.Lerp(vibrantColor, Color.White, 0.5f) * opacity * 2f; @@ -173,7 +173,7 @@ namespace CalamityMod.Projectiles.Magic Vector2[] basePoints = new Vector2[24]; for (int i = 0; i < basePoints.Length; i++) - basePoints[i] = projectile.Center + projectile.velocity * i / (basePoints.Length - 1f) * LaserLength; + basePoints[i] = Projectile.Center + Projectile.velocity * i / (basePoints.Length - 1f) * LaserLength; Vector2 overallOffset = -Main.screenPosition; RayDrawer.Draw(basePoints, overallOffset, 92); @@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.Magic public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LaserLength); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength); } public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) diff --git a/Projectiles/Magic/RancorMagicCircle.cs b/Projectiles/Magic/RancorMagicCircle.cs index a2161574c6..1ce4a223b5 100644 --- a/Projectiles/Magic/RancorMagicCircle.cs +++ b/Projectiles/Magic/RancorMagicCircle.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Projectiles.Magic { public class RancorMagicCircle : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float Time => ref projectile.ai[0]; - public ref float PulseLoopSoundSlot => ref projectile.localAI[0]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; + public ref float PulseLoopSoundSlot => ref Projectile.localAI[0]; public ActiveSound PulseLoopSound => Main.GetActiveSound(SlotId.FromFloat(PulseLoopSoundSlot)); public float ChargeupCompletion => MathHelper.Clamp(Time / ChargeupTime, 0f, 1f); public const int ChargeupTime = 240; @@ -23,30 +23,30 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = projectile.height = 114; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.timeLeft = 90000; + Projectile.width = Projectile.height = 114; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.timeLeft = 90000; } public override void AI() { // Always update before the laserbeam, so that it doesn't recieve strange offsets. - projectile.Calamity().UpdatePriority = 1f; + Projectile.Calamity().UpdatePriority = 1f; // If the owner is no longer able to cast the circle, kill it. if (!Owner.channel || Owner.noItems || Owner.CCed) { - projectile.Kill(); + Projectile.Kill(); return; } if (Time >= 1f && Owner.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -57,11 +57,11 @@ namespace CalamityMod.Projectiles.Magic UpdateAim(); // Decide where to position the magic circle. - Vector2 circlePointDirection = projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction); - projectile.Center = Owner.Center + circlePointDirection * projectile.scale * 56f; + Vector2 circlePointDirection = Projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.Center = Owner.Center + circlePointDirection * Projectile.scale * 56f; // Adjust the owner's direction. - Owner.ChangeDir(projectile.direction); + Owner.ChangeDir(Projectile.direction); // Do animation stuff. DoPrettyDustEffects(); @@ -72,41 +72,41 @@ namespace CalamityMod.Projectiles.Magic // Create an idle ominous sound once the laser has appeared. else if (Main.GetActiveSound(SlotId.FromFloat(PulseLoopSoundSlot)) is null) - PulseLoopSoundSlot = Main.PlayTrackedSound(SoundID.DD2_EtherianPortalIdleLoop, projectile.Center).ToFloat(); + PulseLoopSoundSlot = Main.PlayTrackedSound(SoundID.DD2_EtherianPortalIdleLoop, Projectile.Center).ToFloat(); // Make a cast sound effect soon after the circle appears. if (Time == 15f) - Main.PlaySound(SoundID.Item117, projectile.Center); + SoundEngine.PlaySound(SoundID.Item117, Projectile.Center); Time++; } public void AdjustVisualValues() { - projectile.scale = Utils.InverseLerp(0f, 35f, Time, true) * 1.4f; - projectile.Opacity = (float)Math.Pow(projectile.scale / 1.4f, 2D); - projectile.rotation -= MathHelper.ToRadians(projectile.scale * 4f); + Projectile.scale = Utils.InverseLerp(0f, 35f, Time, true) * 1.4f; + Projectile.Opacity = (float)Math.Pow(Projectile.scale / 1.4f, 2D); + Projectile.rotation -= MathHelper.ToRadians(Projectile.scale * 4f); } public void UpdateAim() { // Only execute the aiming code for the owner since Main.MouseWorld is a client-side variable. - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; Vector2 idealDirection = Owner.SafeDirectionTo(Main.MouseWorld, Vector2.UnitX * Owner.direction); - Vector2 newAimDirection = projectile.velocity.MoveTowards(idealDirection, 0.05f); + Vector2 newAimDirection = Projectile.velocity.MoveTowards(idealDirection, 0.05f); // Sync if the direction is different from the old one. // Spam caps are ignored due to the frequency of this happening. - if (newAimDirection != projectile.velocity) + if (newAimDirection != Projectile.velocity) { - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } - projectile.velocity = newAimDirection; - projectile.direction = (projectile.velocity.X > 0f).ToDirectionInt(); + Projectile.velocity = newAimDirection; + Projectile.direction = (Projectile.velocity.X > 0f).ToDirectionInt(); } public void DoPrettyDustEffects() @@ -117,13 +117,13 @@ namespace CalamityMod.Projectiles.Magic if (!Main.rand.NextBool(dustSpawnChance)) continue; - float dustSpawnOffsetFactor = Main.rand.NextFloat(projectile.width * 0.375f, projectile.width * 0.485f); - Vector2 dustSpawnOffsetDirection = Main.rand.NextVector2CircularEdge(0.5f, 1f).RotatedBy(projectile.velocity.ToRotation()); + float dustSpawnOffsetFactor = Main.rand.NextFloat(Projectile.width * 0.375f, Projectile.width * 0.485f); + Vector2 dustSpawnOffsetDirection = Main.rand.NextVector2CircularEdge(0.5f, 1f).RotatedBy(Projectile.velocity.ToRotation()); Vector2 dustSpawnOffset = dustSpawnOffsetDirection * dustSpawnOffsetFactor; Vector2 dustVelocity = (-dustSpawnOffset.SafeNormalize(Vector2.UnitY)).RotatedBy(MathHelper.PiOver2 * Main.rand.NextFloatDirection()); dustVelocity *= Main.rand.NextFloat(2f, 6f); - Dust magic = Dust.NewDustPerfect(projectile.Center + dustSpawnOffset, 264); + Dust magic = Dust.NewDustPerfect(Projectile.Center + dustSpawnOffset, 264); magic.color = Color.Lerp(Color.Red, Color.Blue, Main.rand.NextFloat()); magic.velocity = dustVelocity; magic.scale *= Main.rand.NextFloat(1f, 1.4f); @@ -138,12 +138,12 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(3)) { float dustSpeed = MathHelper.Lerp(3.5f, 8f, ChargeupCompletion) * Main.rand.NextFloat(0.65f, 1f); - float dustSpawnOffsetFactor = Main.rand.NextFloat(projectile.width * 0.375f, projectile.width * 0.485f); - Vector2 dustVelocity = projectile.velocity * dustSpeed; - Vector2 dustSpawnOffsetDirection = Main.rand.NextVector2CircularEdge(0.5f, 1f).RotatedBy(projectile.velocity.ToRotation()); + float dustSpawnOffsetFactor = Main.rand.NextFloat(Projectile.width * 0.375f, Projectile.width * 0.485f); + Vector2 dustVelocity = Projectile.velocity * dustSpeed; + Vector2 dustSpawnOffsetDirection = Main.rand.NextVector2CircularEdge(0.5f, 1f).RotatedBy(Projectile.velocity.ToRotation()); Vector2 dustSpawnOffset = dustSpawnOffsetDirection * dustSpawnOffsetFactor; - Dust magic = Dust.NewDustPerfect(projectile.Center + dustSpawnOffset, 264); + Dust magic = Dust.NewDustPerfect(Projectile.Center + dustSpawnOffset, 264); magic.color = Color.Lerp(Color.Red, Color.Blue, Main.rand.NextFloat()); magic.velocity = dustVelocity; magic.scale *= Main.rand.NextFloat(1f, 1.05f + ChargeupCompletion * 0.55f); @@ -155,22 +155,22 @@ namespace CalamityMod.Projectiles.Magic if (Time == ChargeupTime - 1f) { // Play a laserbeam deathray sound. Should probably be replaced some day - Main.PlaySound(SoundID.Zombie, projectile.Center, 104); + SoundEngine.PlaySound(SoundID.Zombie, Projectile.Center, 104); - if (Main.myPlayer == projectile.owner) - Projectile.NewProjectile(projectile.Center, projectile.velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, projectile.identity); + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.identity); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D outerCircleTexture = ModContent.GetTexture(Texture); - Texture2D outerCircleGlowmask = ModContent.GetTexture(Texture + "Glowmask"); - Texture2D innerCircleTexture = ModContent.GetTexture(Texture + "Inner"); - Texture2D innerCircleGlowmask = ModContent.GetTexture(Texture + "InnerGlowmask"); - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Texture2D outerCircleTexture = ModContent.Request(Texture); + Texture2D outerCircleGlowmask = ModContent.Request(Texture + "Glowmask"); + Texture2D innerCircleTexture = ModContent.Request(Texture + "Inner"); + Texture2D innerCircleGlowmask = ModContent.Request(Texture + "InnerGlowmask"); + Vector2 drawPosition = Projectile.Center - Main.screenPosition; - float directionRotation = projectile.velocity.ToRotation(); + float directionRotation = Projectile.velocity.ToRotation(); Color startingColor = Color.Red; Color endingColor = Color.Blue; @@ -185,7 +185,7 @@ namespace CalamityMod.Projectiles.Magic GameShaders.Misc["CalamityMod:RancorMagicCircle"].UseSecondaryColor(endingColor); GameShaders.Misc["CalamityMod:RancorMagicCircle"].UseSaturation(directionRotation); GameShaders.Misc["CalamityMod:RancorMagicCircle"].UseOpacity(opacity); - GameShaders.Misc["CalamityMod:RancorMagicCircle"].Shader.Parameters["uDirection"].SetValue((float)projectile.direction); + GameShaders.Misc["CalamityMod:RancorMagicCircle"].Shader.Parameters["uDirection"].SetValue((float)Projectile.direction); GameShaders.Misc["CalamityMod:RancorMagicCircle"].Shader.Parameters["uCircularRotation"].SetValue(circularRotation); GameShaders.Misc["CalamityMod:RancorMagicCircle"].Shader.Parameters["uImageSize0"].SetValue(texture.Size()); GameShaders.Misc["CalamityMod:RancorMagicCircle"].Shader.Parameters["overallImageSize"].SetValue(outerCircleTexture.Size()); @@ -193,17 +193,17 @@ namespace CalamityMod.Projectiles.Magic GameShaders.Misc["CalamityMod:RancorMagicCircle"].Apply(); } - restartShader(outerCircleGlowmask, projectile.Opacity, projectile.rotation, BlendState.Additive); - spriteBatch.Draw(outerCircleGlowmask, drawPosition, null, Color.White, 0f, outerCircleGlowmask.Size() * 0.5f, projectile.scale * 1.075f, SpriteEffects.None, 0f); + restartShader(outerCircleGlowmask, Projectile.Opacity, Projectile.rotation, BlendState.Additive); + spriteBatch.Draw(outerCircleGlowmask, drawPosition, null, Color.White, 0f, outerCircleGlowmask.Size() * 0.5f, Projectile.scale * 1.075f, SpriteEffects.None, 0f); - restartShader(outerCircleTexture, projectile.Opacity * 0.7f, projectile.rotation, BlendState.AlphaBlend); - spriteBatch.Draw(outerCircleTexture, drawPosition, null, Color.White, 0f, outerCircleTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + restartShader(outerCircleTexture, Projectile.Opacity * 0.7f, Projectile.rotation, BlendState.AlphaBlend); + spriteBatch.Draw(outerCircleTexture, drawPosition, null, Color.White, 0f, outerCircleTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); - restartShader(innerCircleGlowmask, projectile.Opacity * 0.5f, 0f, BlendState.Additive); - spriteBatch.Draw(innerCircleGlowmask, drawPosition, null, Color.White, 0f, innerCircleGlowmask.Size() * 0.5f, projectile.scale * 1.075f, SpriteEffects.None, 0f); + restartShader(innerCircleGlowmask, Projectile.Opacity * 0.5f, 0f, BlendState.Additive); + spriteBatch.Draw(innerCircleGlowmask, drawPosition, null, Color.White, 0f, innerCircleGlowmask.Size() * 0.5f, Projectile.scale * 1.075f, SpriteEffects.None, 0f); - restartShader(innerCircleTexture, projectile.Opacity * 0.7f, 0f, BlendState.AlphaBlend); - spriteBatch.Draw(innerCircleTexture, drawPosition, null, Color.White, 0f, innerCircleTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + restartShader(innerCircleTexture, Projectile.Opacity * 0.7f, 0f, BlendState.AlphaBlend); + spriteBatch.Draw(innerCircleTexture, drawPosition, null, Color.White, 0f, innerCircleTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); spriteBatch.ExitShaderRegion(); return false; diff --git a/Projectiles/Magic/RancorSmallCinder.cs b/Projectiles/Magic/RancorSmallCinder.cs index 373f20e37b..e2fb22f50e 100644 --- a/Projectiles/Magic/RancorSmallCinder.cs +++ b/Projectiles/Magic/RancorSmallCinder.cs @@ -6,53 +6,53 @@ namespace CalamityMod.Projectiles.Magic { public class RancorSmallCinder : ModProjectile { - public ref float Time => ref projectile.ai[0]; - public ref float Lifetime => ref projectile.ai[1]; + public ref float Time => ref Projectile.ai[0]; + public ref float Lifetime => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Cinder"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = projectile.height = 4; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.timeLeft = 300; - projectile.ignoreWater = true; + Projectile.width = Projectile.height = 4; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; } public override void AI() { // Decide a frame to use on the first frame this projectile exists. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); - projectile.localAI[0] = 1f; + Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); + Projectile.localAI[0] = 1f; } // Make a decision for the lifetime for the cinder if one has not yet been made. if (Lifetime == 0f) { Lifetime = Main.rand.Next(60, 210); - projectile.netUpdate = true; + Projectile.netUpdate = true; } // Calculate scale of the cinder. else { - projectile.scale = Utils.InverseLerp(0f, 20f, Time, true) * Utils.InverseLerp(Lifetime, Lifetime - 20f, Time, true); - projectile.scale *= MathHelper.Lerp(0.5f, 1f, projectile.identity % 6f / 6f); + Projectile.scale = Utils.InverseLerp(0f, 20f, Time, true) * Utils.InverseLerp(Lifetime, Lifetime - 20f, Time, true); + Projectile.scale *= MathHelper.Lerp(0.5f, 1f, Projectile.identity % 6f / 6f); } if (Time >= Lifetime) - projectile.Kill(); + Projectile.Kill(); Time++; } - public override Color? GetAlpha(Color lightColor) => Color.White * projectile.Opacity; + public override Color? GetAlpha(Color lightColor) => Color.White * Projectile.Opacity; } } diff --git a/Projectiles/Magic/RedirectingFire.cs b/Projectiles/Magic/RedirectingFire.cs index 1a80d56d0c..c310c53552 100644 --- a/Projectiles/Magic/RedirectingFire.cs +++ b/Projectiles/Magic/RedirectingFire.cs @@ -3,37 +3,38 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class RedirectingFire : ModProjectile { - public ref float BurstIntensity => ref projectile.ai[0]; - public ref float Time => ref projectile.ai[1]; + public ref float BurstIntensity => ref Projectile.ai[0]; + public ref float Time => ref Projectile.ai[1]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() => DisplayName.SetDefault("Fire"); public override void SetDefaults() { - projectile.width = projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = Projectile.height = 18; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } public override void AI() { if (Time >= 18f) { - NPC potentialTarget = projectile.Center.ClosestNPCAt(1100f, false); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(1100f, false); if (potentialTarget != null) HomeInOnTarget(potentialTarget); - float accelerationFactor = MathHelper.SmoothStep(1.025f, 1.015f, Utils.InverseLerp(6f, 24f, projectile.velocity.Length(), true)); - if (projectile.velocity.Length() < 24f) - projectile.velocity *= accelerationFactor; + float accelerationFactor = MathHelper.SmoothStep(1.025f, 1.015f, Utils.InverseLerp(6f, 24f, Projectile.velocity.Length(), true)); + if (Projectile.velocity.Length() < 24f) + Projectile.velocity *= accelerationFactor; } EmitDust(); Time++; @@ -41,24 +42,24 @@ namespace CalamityMod.Projectiles.Magic public void HomeInOnTarget(NPC target) { - float oldSpeed = projectile.velocity.Length(); + float oldSpeed = Projectile.velocity.Length(); float delayFactor = Utils.InverseLerp(20f, 35f, Time, true); float homeSpeed = MathHelper.Lerp(0f, 0.075f, delayFactor); - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(target.Center) * 16f, homeSpeed); - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * oldSpeed; - projectile.position += (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * MathHelper.Lerp(25f, 1f, Utils.InverseLerp(100f, 360f, projectile.Distance(target.Center), true)) * delayFactor; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(target.Center) * 16f, homeSpeed); + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * oldSpeed; + Projectile.position += (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * MathHelper.Lerp(25f, 1f, Utils.InverseLerp(100f, 360f, Projectile.Distance(target.Center), true)) * delayFactor; } public Dust CreateDustInstance() { int dustType = 264; - Color brimstoneColor = Color.Lerp(Color.Red, Color.DarkViolet, (float)Math.Sin(projectile.identity * 3f + Time / 12f) * 0.7f + 0.3f); + Color brimstoneColor = Color.Lerp(Color.Red, Color.DarkViolet, (float)Math.Sin(Projectile.identity * 3f + Time / 12f) * 0.7f + 0.3f); Color dustColor = Color.Lerp(Color.Orange, Color.Yellow, Main.rand.NextFloat()); dustColor = Color.Lerp(dustColor, brimstoneColor, (float)Math.Pow(BurstIntensity, 2D)); - Dust dust = Dust.NewDustPerfect(projectile.Center, dustType); + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustType); dust.color = dustColor; dust.noGravity = true; dust.noLight = true; @@ -74,7 +75,7 @@ namespace CalamityMod.Projectiles.Magic { Dust dust = CreateDustInstance(); dust.velocity = (MathHelper.TwoPi * i / 5f).ToRotationVector2(); - dust.position += projectile.velocity; + dust.position += Projectile.velocity; dust.scale = MathHelper.Lerp(1f, 1.5f, BurstIntensity) * Main.rand.NextFloat(0.7f, 1.3f); } } @@ -82,13 +83,13 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { // Emit some fire sounds. - Main.PlaySound(SoundID.Item34, projectile.Center); + SoundEngine.PlaySound(SoundID.Item34, Projectile.Center); if (Main.dedServ) return; for (int i = 0; i < 15; i++) { - Dust ectoplasm = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(30f, 30f) * BurstIntensity, 264); + Dust ectoplasm = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(30f, 30f) * BurstIntensity, 264); ectoplasm.velocity = Main.rand.NextVector2Circular(2f, 2f); ectoplasm.color = Color.Lerp(Color.Orange, Color.Yellow, Main.rand.NextFloat(0.67f)); ectoplasm.scale = MathHelper.Lerp(1f, 1.6f, BurstIntensity); diff --git a/Projectiles/Magic/RedirectingGildedSoul.cs b/Projectiles/Magic/RedirectingGildedSoul.cs index 7cbd836204..19f34851a8 100644 --- a/Projectiles/Magic/RedirectingGildedSoul.cs +++ b/Projectiles/Magic/RedirectingGildedSoul.cs @@ -4,57 +4,58 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class RedirectingGildedSoul : ModProjectile { - public ref float BurstIntensity => ref projectile.ai[0]; - public ref float Time => ref projectile.ai[1]; + public ref float BurstIntensity => ref Projectile.ai[0]; + public ref float Time => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Gilded Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.scale = 0.6f; - projectile.width = projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.scale = 0.6f; + Projectile.width = Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } - public override void AI() => RedirectingVengefulSoul.DoSoulAI(projectile, ref Time, 5f); + public override void AI() => RedirectingVengefulSoul.DoSoulAI(Projectile, ref Time, 5f); public override Color? GetAlpha(Color lightColor) { - Color baseColor = Color.Lerp(Color.DarkGoldenrod, Color.Gold, projectile.identity % 5f / 5f); + Color baseColor = Color.Lerp(Color.DarkGoldenrod, Color.Gold, Projectile.identity % 5f / 5f); Color color = Color.Lerp(baseColor, Color.White, BurstIntensity * 0.5f + (float)Math.Cos(Main.GlobalTime * 2.7f) * 0.04f); color.A = 127; - return color * projectile.Opacity; + return color * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - SpriteEffects direction = projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; for (int i = 0; i < 4; i++) { - for (int j = 0; j < projectile.oldPos.Length / 2; j++) + for (int j = 0; j < Projectile.oldPos.Length / 2; j++) { - Color drawColor = projectile.GetAlpha(lightColor); - drawColor = Color.Lerp(drawColor, Color.White * projectile.Opacity, 2f * j / projectile.oldPos.Length) * (float)Math.Pow(1f - Utils.InverseLerp(0f, projectile.oldPos.Length / 2, j, true), 2D); - Vector2 drawPosition = projectile.oldPos[j] + projectile.Size * 0.5f + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 0.5f - Main.screenPosition; - float rotation = projectile.oldRot[j]; + Color drawColor = Projectile.GetAlpha(lightColor); + drawColor = Color.Lerp(drawColor, Color.White * Projectile.Opacity, 2f * j / Projectile.oldPos.Length) * (float)Math.Pow(1f - Utils.InverseLerp(0f, Projectile.oldPos.Length / 2, j, true), 2D); + Vector2 drawPosition = Projectile.oldPos[j] + Projectile.Size * 0.5f + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 0.5f - Main.screenPosition; + float rotation = Projectile.oldRot[j]; - spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); } } @@ -64,10 +65,10 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { // Play a wraith death sound at max intensity and a dungeon spirit hit sound otherwise. - Main.PlaySound(BurstIntensity >= 1f ? SoundID.NPCDeath52 : SoundID.NPCHit35, projectile.Center); + SoundEngine.PlaySound(BurstIntensity >= 1f ? SoundID.NPCDeath52 : SoundID.NPCHit35, Projectile.Center); // As well as an "extinguished" sound. - Main.PlaySound(SoundID.NPCDeath55, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCDeath55, Projectile.Center); // Make a ghost sound and explode into ectoplasmic energy. if (Main.dedServ) @@ -75,9 +76,9 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 45; i++) { - Dust ectoplasm = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(80f, 80f) * (float)Math.Pow(BurstIntensity, 2D), 264); + Dust ectoplasm = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(80f, 80f) * (float)Math.Pow(BurstIntensity, 2D), 264); ectoplasm.velocity = Main.rand.NextVector2Circular(2f, 2f); - ectoplasm.color = projectile.GetAlpha(Color.White); + ectoplasm.color = Projectile.GetAlpha(Color.White); ectoplasm.scale = MathHelper.Lerp(1f, 1.6f, BurstIntensity); ectoplasm.noGravity = true; ectoplasm.noLight = true; diff --git a/Projectiles/Magic/RedirectingLostSoul.cs b/Projectiles/Magic/RedirectingLostSoul.cs index 34e533869b..812647deb0 100644 --- a/Projectiles/Magic/RedirectingLostSoul.cs +++ b/Projectiles/Magic/RedirectingLostSoul.cs @@ -4,55 +4,56 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class RedirectingLostSoul : ModProjectile { - public ref float BurstIntensity => ref projectile.ai[0]; - public ref float Time => ref projectile.ai[1]; + public ref float BurstIntensity => ref Projectile.ai[0]; + public ref float Time => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } - public override void AI() => RedirectingVengefulSoul.DoSoulAI(projectile, ref Time, 1f); + public override void AI() => RedirectingVengefulSoul.DoSoulAI(Projectile, ref Time, 1f); public override Color? GetAlpha(Color lightColor) { - Color baseColor = Color.Lerp(Color.DarkRed, Color.DarkViolet, projectile.identity % 5f / 5f * 0.5f); + Color baseColor = Color.Lerp(Color.DarkRed, Color.DarkViolet, Projectile.identity % 5f / 5f * 0.5f); Color color = Color.Lerp(baseColor, Color.White, BurstIntensity * 0.5f + (float)Math.Cos(Main.GlobalTime * 2.7f) * 0.04f); color.A = 0; - return color * projectile.Opacity; + return color * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects direction = projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = Main.projectileTexture[projectile.type]; - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - for (int j = 0; j < projectile.oldPos.Length / 2; j++) + for (int j = 0; j < Projectile.oldPos.Length / 2; j++) { - float fade = (float)Math.Pow(1f - Utils.InverseLerp(0f, projectile.oldPos.Length / 2, j, true), 2D); - Color drawColor = projectile.GetAlpha(lightColor) * fade; - Vector2 drawPosition = projectile.oldPos[j] + projectile.Size * 0.5f - Main.screenPosition; - float rotation = projectile.oldRot[j]; + float fade = (float)Math.Pow(1f - Utils.InverseLerp(0f, Projectile.oldPos.Length / 2, j, true), 2D); + Color drawColor = Projectile.GetAlpha(lightColor) * fade; + Vector2 drawPosition = Projectile.oldPos[j] + Projectile.Size * 0.5f - Main.screenPosition; + float rotation = Projectile.oldRot[j]; - spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); } return false; @@ -61,7 +62,7 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { // Play a wraith death sound at max intensity and a dungeon spirit hit sound otherwise. - Main.PlaySound(BurstIntensity >= 1f ? SoundID.NPCDeath52 : SoundID.NPCHit35, projectile.Center); + SoundEngine.PlaySound(BurstIntensity >= 1f ? SoundID.NPCDeath52 : SoundID.NPCHit35, Projectile.Center); // Make a ghost sound and explode into ectoplasmic energy. if (Main.dedServ) @@ -69,9 +70,9 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 45; i++) { - Dust ectoplasm = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(50f, 50f) * BurstIntensity, 264); + Dust ectoplasm = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(50f, 50f) * BurstIntensity, 264); ectoplasm.velocity = Main.rand.NextVector2Circular(2f, 2f); - ectoplasm.color = projectile.GetAlpha(Color.White); + ectoplasm.color = Projectile.GetAlpha(Color.White); ectoplasm.scale = MathHelper.Lerp(1f, 1.6f, BurstIntensity); ectoplasm.noGravity = true; ectoplasm.noLight = true; diff --git a/Projectiles/Magic/RedirectingVengefulSoul.cs b/Projectiles/Magic/RedirectingVengefulSoul.cs index 45bde8c05e..94c4e9f19b 100644 --- a/Projectiles/Magic/RedirectingVengefulSoul.cs +++ b/Projectiles/Magic/RedirectingVengefulSoul.cs @@ -4,33 +4,34 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class RedirectingVengefulSoul : ModProjectile { - public ref float BurstIntensity => ref projectile.ai[0]; - public ref float Time => ref projectile.ai[1]; + public ref float BurstIntensity => ref Projectile.ai[0]; + public ref float Time => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.scale = 0.8f; - projectile.width = projectile.height = 46; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.scale = 0.8f; + Projectile.width = Projectile.height = 46; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } - public override void AI() => DoSoulAI(projectile, ref Time, 2f); + public override void AI() => DoSoulAI(Projectile, ref Time, 2f); public static void DoSoulAI(Projectile projectile, ref float time, float soulPower) { @@ -69,27 +70,27 @@ namespace CalamityMod.Projectiles.Magic public override Color? GetAlpha(Color lightColor) { - Color baseColor = Color.Lerp(Color.IndianRed, Color.DarkViolet, projectile.identity % 5f / 5f * 0.5f); + Color baseColor = Color.Lerp(Color.IndianRed, Color.DarkViolet, Projectile.identity % 5f / 5f * 0.5f); Color color = Color.Lerp(baseColor * 1.5f, baseColor, BurstIntensity * 0.5f + (float)Math.Cos(Main.GlobalTime * 2.7f) * 0.04f); color.A = 0; - return color * projectile.Opacity; + return color * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects direction = projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = Main.projectileTexture[projectile.type]; - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { - for (int j = 0; j < projectile.oldPos.Length / 2; j++) + for (int j = 0; j < Projectile.oldPos.Length / 2; j++) { - float fade = (float)Math.Pow(1f - Utils.InverseLerp(0f, projectile.oldPos.Length / 2, j, true), 2D); - Color drawColor = Color.Lerp(projectile.GetAlpha(lightColor), Color.White * projectile.Opacity, j / projectile.oldPos.Length) * fade; - Vector2 drawPosition = projectile.oldPos[j] + projectile.Size * 0.5f + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 1.5f - Main.screenPosition; - float rotation = projectile.oldRot[j]; + float fade = (float)Math.Pow(1f - Utils.InverseLerp(0f, Projectile.oldPos.Length / 2, j, true), 2D); + Color drawColor = Color.Lerp(Projectile.GetAlpha(lightColor), Color.White * Projectile.Opacity, j / Projectile.oldPos.Length) * fade; + Vector2 drawPosition = Projectile.oldPos[j] + Projectile.Size * 0.5f + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 1.5f - Main.screenPosition; + float rotation = Projectile.oldRot[j]; - spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); } } @@ -99,7 +100,7 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { // Play a wraith death sound at max intensity and a dungeon spirit hit sound otherwise. - Main.PlaySound(BurstIntensity >= 1f ? SoundID.NPCDeath52 : SoundID.NPCHit35, projectile.Center); + SoundEngine.PlaySound(BurstIntensity >= 1f ? SoundID.NPCDeath52 : SoundID.NPCHit35, Projectile.Center); // Make a ghost sound and explode into ectoplasmic energy. if (Main.dedServ) @@ -107,16 +108,16 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 45; i++) { - Dust ectoplasm = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(100f, 100f) * (float)Math.Pow(BurstIntensity, 2D), 264); + Dust ectoplasm = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(100f, 100f) * (float)Math.Pow(BurstIntensity, 2D), 264); ectoplasm.velocity = Main.rand.NextVector2Circular(2f, 2f); - ectoplasm.color = projectile.GetAlpha(Color.White); + ectoplasm.color = Projectile.GetAlpha(Color.White); ectoplasm.scale = MathHelper.Lerp(1.2f, 1.9f, BurstIntensity); ectoplasm.noGravity = true; ectoplasm.noLight = true; - ectoplasm = Dust.NewDustPerfect(projectile.Center, 264); + ectoplasm = Dust.NewDustPerfect(Projectile.Center, 264); ectoplasm.velocity = (MathHelper.TwoPi * i / 45f).ToRotationVector2() * 6f; - ectoplasm.color = projectile.GetAlpha(Color.White); + ectoplasm.color = Projectile.GetAlpha(Color.White); ectoplasm.scale = MathHelper.Lerp(1.2f, 1.9f, BurstIntensity); ectoplasm.noGravity = true; ectoplasm.noLight = true; diff --git a/Projectiles/Magic/RougeSlashLarge.cs b/Projectiles/Magic/RougeSlashLarge.cs index 7183c7051a..8aa07c2cc6 100644 --- a/Projectiles/Magic/RougeSlashLarge.cs +++ b/Projectiles/Magic/RougeSlashLarge.cs @@ -12,60 +12,60 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Slash"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.timeLeft = 300; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 3; + Projectile.alpha = 255; + Projectile.timeLeft = 300; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - if (projectile.alpha > 0) - projectile.alpha -= 17; + if (Projectile.alpha > 0) + Projectile.alpha -= 17; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 12f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 12f) { - projectile.localAI[1] = 0f; + Projectile.localAI[1] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * -projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * -Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy(projectile.rotation - MathHelper.PiOver2); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy(Projectile.rotation - MathHelper.PiOver2); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.velocity *= 0.25f; - target.immune[projectile.owner] = 1; + Projectile.velocity *= 0.25f; + target.immune[Projectile.owner] = 1; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/RougeSlashMedium.cs b/Projectiles/Magic/RougeSlashMedium.cs index 4a72e90e03..f5d6ac6286 100644 --- a/Projectiles/Magic/RougeSlashMedium.cs +++ b/Projectiles/Magic/RougeSlashMedium.cs @@ -12,60 +12,60 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Slash"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = 2; - projectile.alpha = 255; - projectile.timeLeft = 300; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 2; + Projectile.alpha = 255; + Projectile.timeLeft = 300; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - if (projectile.alpha > 0) - projectile.alpha -= 17; + if (Projectile.alpha > 0) + Projectile.alpha -= 17; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 12f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 12f) { - projectile.localAI[1] = 0f; + Projectile.localAI[1] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * -projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * -Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy(projectile.rotation - MathHelper.PiOver2); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy(Projectile.rotation - MathHelper.PiOver2); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.velocity *= 0.25f; - target.immune[projectile.owner] = 1; + Projectile.velocity *= 0.25f; + target.immune[Projectile.owner] = 1; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/RougeSlashSmall.cs b/Projectiles/Magic/RougeSlashSmall.cs index bd0d06f761..754f63f9b3 100644 --- a/Projectiles/Magic/RougeSlashSmall.cs +++ b/Projectiles/Magic/RougeSlashSmall.cs @@ -12,60 +12,60 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Slash"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 300; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 300; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - if (projectile.alpha > 0) - projectile.alpha -= 17; + if (Projectile.alpha > 0) + Projectile.alpha -= 17; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 12f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 12f) { - projectile.localAI[1] = 0f; + Projectile.localAI[1] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * -projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * -Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy(projectile.rotation - MathHelper.PiOver2); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy(Projectile.rotation - MathHelper.PiOver2); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 60, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.velocity *= 0.25f; - target.immune[projectile.owner] = 1; + Projectile.velocity *= 0.25f; + target.immune[Projectile.owner] = 1; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/SHPB.cs b/Projectiles/Magic/SHPB.cs index a95dd71891..8e04349e38 100644 --- a/Projectiles/Magic/SHPB.cs +++ b/Projectiles/Magic/SHPB.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class SHPB : ModProjectile @@ -13,67 +14,67 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("SHPB"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.magic = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight(projectile.Center, 1f * num, 0.2f * num, 0.75f * num); - projectile.alpha -= 2; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Lighting.AddLight(Projectile.Center, 1f * num, 0.2f * num, 0.75f * num); + Projectile.alpha -= 2; + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f; - projectile.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f; - if (projectile.localAI[0] == 0f) + Projectile.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f; + Projectile.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f; + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) + Projectile.scale += 0.05f; + if ((double)Projectile.scale > 1.2) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } } else { - projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) + Projectile.scale -= 0.05f; + if ((double)Projectile.scale < 0.8) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } } - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; + Projectile.velocity.X *= 0.985f; + Projectile.velocity.Y *= 0.985f; + float num472 = Projectile.Center.X; + float num473 = Projectile.Center.Y; float num474 = 250f; bool flag17 = false; for (int num475 = 0; num475 < 200; num475++) { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + if (Main.npc[num475].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) { float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num476) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num477); if (num478 < num474) { num474 = num478; @@ -86,31 +87,31 @@ namespace CalamityMod.Projectiles.Magic explosionTimer--; if (explosionTimer <= 0) { - projectile.Kill(); + Projectile.Kill(); } } } public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 155, projectile.alpha); + return new Color(255, Main.DiscoG, 155, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item105, projectile.position); - if (projectile.owner == Main.myPlayer) + SoundEngine.PlaySound(SoundID.Item105, Projectile.position); + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Magic/SHPExplosion.cs b/Projectiles/Magic/SHPExplosion.cs index e0839848d4..28cea230c3 100644 --- a/Projectiles/Magic/SHPExplosion.cs +++ b/Projectiles/Magic/SHPExplosion.cs @@ -15,35 +15,35 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 500; - projectile.height = 500; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 500; + Projectile.height = 500; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight(projectile.Center, 5f * num, 1f * num, 4f * num); + Lighting.AddLight(Projectile.Center, 5f * num, 1f * num, 4f * num); float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -67,10 +67,10 @@ namespace CalamityMod.Projectiles.Magic { randomDust = 187; } - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 2f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 2f); Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; + Main.dust[num467].position.X = Projectile.Center.X; + Main.dust[num467].position.Y = Projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; diff --git a/Projectiles/Magic/SHPL.cs b/Projectiles/Magic/SHPL.cs index 6276d6a6b1..0afe0f0845 100644 --- a/Projectiles/Magic/SHPL.cs +++ b/Projectiles/Magic/SHPL.cs @@ -15,51 +15,51 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 600; - projectile.magic = true; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.5f, 0.2f, 0.5f); + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0.5f, 0.2f, 0.5f); float num55 = 100f; float num56 = 3f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); return; } } } - public override Color? GetAlpha(Color lightColor) => new Color(255, Main.DiscoG, 155, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(255, Main.DiscoG, 155, Projectile.alpha); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(100f, 3f, lightColor); public override void Kill(int timeLeft) { @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Magic 73, 187 }); - int idx = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, dustType, 0f, 0f, 100, default, 2.1f); + int idx = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, dustType, 0f, 0f, 100, default, 2.1f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index cd58f02b41..2cc03f1423 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -18,57 +19,57 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Flare"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.alpha = 255; - projectile.magic = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.velocity.X = projectile.velocity.X + (Main.player[projectile.owner].velocity.X * 0.5f); - startSpeedY = projectile.velocity.Y + (Main.player[projectile.owner].velocity.Y * 0.5f); - projectile.velocity.Y = startSpeedY; + Projectile.velocity.X = Projectile.velocity.X + (Main.player[Projectile.owner].velocity.X * 0.5f); + startSpeedY = Projectile.velocity.Y + (Main.player[Projectile.owner].velocity.Y * 0.5f); + Projectile.velocity.Y = startSpeedY; } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 180f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 180f) { x++; speed += 0.1; - projectile.velocity.Y = startSpeedY + (float)(speed * Math.Sin(x / 4)); + Projectile.velocity.Y = startSpeedY + (float)(speed * Math.Sin(x / 4)); } - projectile.rotation += projectile.velocity.Y * 0.02f; - projectile.alpha -= 5; - if (projectile.alpha < 30) + Projectile.rotation += Projectile.velocity.Y * 0.02f; + Projectile.alpha -= 5; + if (Projectile.alpha < 30) { - projectile.alpha = 30; + Projectile.alpha = 30; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 10; - projectile.height = 10; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 10; + Projectile.height = 10; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -78,10 +79,10 @@ namespace CalamityMod.Projectiles.Magic } for (int num623 = 0; num623 < 6; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } @@ -90,17 +91,17 @@ namespace CalamityMod.Projectiles.Magic { target.AddBuff(ModContent.BuffType(), 120); - if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) + if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) return; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.statLife += 1; player.HealEffect(1); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs index 6366ab6f4c..93f051e815 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs @@ -14,51 +14,51 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < (projectile.ai[1] == 1f ? 12f : 16f)) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < (Projectile.ai[1] == 1f ? 12f : 16f)) { - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); } public override Color? GetAlpha(Color lightColor) { - return new Color(250, 50, 50, projectile.alpha); + return new Color(250, 50, 50, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs index e79a9d2f49..fd2d9d733e 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -16,84 +17,84 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Hellblast"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 255; - projectile.alpha = 0; + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 255; + Projectile.alpha = 0; } public override void AI() { if (!initialized) { - if (projectile.npcProj) + if (Projectile.npcProj) { - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.penetrate = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.penetrate = 10; } initialized = true; } - projectile.frameCounter++; - if (projectile.frameCounter >= 10) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 10) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.alpha += 1; - Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f); - if (projectile.ai[1] == 0f) + Projectile.alpha += 1; + Lighting.AddLight(Projectile.Center, 0.9f, 0f, 0f); + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } - projectile.velocity.X *= 1.03f; - projectile.velocity.Y *= 1.03f; - if (projectile.velocity.X < 0f) + Projectile.velocity.X *= 1.03f; + Projectile.velocity.Y *= 1.03f; + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } } public override Color? GetAlpha(Color lightColor) { - return new Color(250, 50, 50, projectile.alpha); + return new Color(250, 50, 50, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item20, projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); for (int dust = 0; dust <= 5; dust++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f); } } } diff --git a/Projectiles/Magic/SerpentineBody.cs b/Projectiles/Magic/SerpentineBody.cs index 41f38f1958..0f55b25e4a 100644 --- a/Projectiles/Magic/SerpentineBody.cs +++ b/Projectiles/Magic/SerpentineBody.cs @@ -9,35 +9,35 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Serpentine"); - ProjectileID.Sets.NeedsUUID[projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 14; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.55f / 255f, (255 - projectile.alpha) * 0.55f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.55f / 255f, (255 - Projectile.alpha) * 0.55f / 255f); int num1051 = 10; Vector2 value68 = Vector2.Zero; - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - int chase = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); + int chase = Projectile.GetByUUID(Projectile.owner, (int)Projectile.ai[0]); float num1064; float scaleFactor17; float scaleFactor18; @@ -48,48 +48,48 @@ namespace CalamityMod.Projectiles.Magic num1064 = Main.projectile[chase].rotation; scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); scaleFactor17 = 16f; - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; + Main.projectile[chase].localAI[0] = Projectile.localAI[0] + 1f; } else { for (int k = 0; k < 8; k++) { - int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default, 1.25f); + int num114 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); Dust dust = Main.dust[num114]; dust.velocity *= 0.3f; - Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.Y = Projectile.position.Y + (float)(Projectile.height / 2) + (float)Main.rand.Next(-4, 5); Main.dust[num114].noGravity = true; } - projectile.active = false; - projectile.Kill(); + Projectile.active = false; + Projectile.Kill(); return; } - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 40; + Projectile.alpha -= 40; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (num1064 != projectile.rotation) + Projectile.velocity = Vector2.Zero; + Vector2 vector134 = value68 - Projectile.Center; + if (num1064 != Projectile.rotation) { - float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); + float num1068 = MathHelper.WrapAngle(num1064 - Projectile.rotation); vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default); } - projectile.rotation = vector134.ToRotation() + 1.57079637f; - projectile.position = projectile.Center; - projectile.scale = scaleFactor18; - projectile.width = projectile.height = (int)((float)num1051 * projectile.scale); - projectile.Center = projectile.position; + Projectile.rotation = vector134.ToRotation() + 1.57079637f; + Projectile.position = Projectile.Center; + Projectile.scale = scaleFactor18; + Projectile.width = Projectile.height = (int)((float)num1051 * Projectile.scale); + Projectile.Center = Projectile.position; if (vector134 != Vector2.Zero) { - projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; + Projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; } - projectile.spriteDirection = (vector134.X > 0f) ? 1 : -1; + Projectile.spriteDirection = (vector134.X > 0f) ? 1 : -1; return; } } diff --git a/Projectiles/Magic/SerpentineHead.cs b/Projectiles/Magic/SerpentineHead.cs index 4b9a562481..97c6d54043 100644 --- a/Projectiles/Magic/SerpentineHead.cs +++ b/Projectiles/Magic/SerpentineHead.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -11,75 +12,75 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Serpentine"); - ProjectileID.Sets.NeedsUUID[projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.penetrate = 5; - projectile.timeLeft = 600; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 14; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + Projectile.penetrate = 5; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.55f / 255f, (255 - projectile.alpha) * 0.55f / 255f); - if (projectile.alpha > 0) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.55f / 255f, (255 - Projectile.alpha) * 0.55f / 255f); + if (Projectile.alpha > 0) { - projectile.alpha -= 40; + Projectile.alpha -= 40; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default, 1.25f); + int num114 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); Dust dust = Main.dust[num114]; dust.velocity *= 0.3f; - Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.Y = Projectile.position.Y + (float)(Projectile.height / 2) + (float)Main.rand.Next(-4, 5); Main.dust[num114].noGravity = true; - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - int direction = projectile.direction; - projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0f) ? 1 : -1; - if (direction != projectile.direction) + Projectile.rotation = Projectile.velocity.ToRotation() + 1.57079637f; + int direction = Projectile.direction; + Projectile.direction = Projectile.spriteDirection = (Projectile.velocity.X > 0f) ? 1 : -1; + if (direction != Projectile.direction) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - float num1061 = MathHelper.Clamp(projectile.localAI[0], 0f, 50f); - projectile.position = projectile.Center; - projectile.scale = 1f + num1061 * 0.01f; - projectile.width = projectile.height = (int)(10 * projectile.scale); - projectile.Center = projectile.position; + float num1061 = MathHelper.Clamp(Projectile.localAI[0], 0f, 50f); + Projectile.position = Projectile.Center; + Projectile.scale = 1f + num1061 * 0.01f; + Projectile.width = Projectile.height = (int)(10 * Projectile.scale); + Projectile.Center = Projectile.position; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 20f && projectile.ai[0] < 40f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 20f && Projectile.ai[0] < 40f) { - projectile.velocity.Y = projectile.velocity.Y + 0.3f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.3f; } - else if (projectile.ai[0] >= 40f && projectile.ai[0] < 60f) + else if (Projectile.ai[0] >= 40f && Projectile.ai[0] < 60f) { - projectile.velocity.Y = projectile.velocity.Y - 0.3f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.3f; } - else if (projectile.ai[0] >= 60f) + else if (Projectile.ai[0] >= 60f) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; } - if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) + if (Main.myPlayer == Projectile.owner && Projectile.ai[0] <= 0f) { - if (Main.player[projectile.owner].channel) + if (Main.player[Projectile.owner].channel) { float num115 = 18f; - Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector10 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; - if (Main.player[projectile.owner].gravDir == -1f) + if (Main.player[Projectile.owner].gravDir == -1f) { num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; } @@ -91,81 +92,81 @@ namespace CalamityMod.Projectiles.Magic num116 *= num118; num117 *= num118; int num119 = (int)(num116 * 1000f); - int num120 = (int)(projectile.velocity.X * 1000f); + int num120 = (int)(Projectile.velocity.X * 1000f); int num121 = (int)(num117 * 1000f); - int num122 = (int)(projectile.velocity.Y * 1000f); + int num122 = (int)(Projectile.velocity.Y * 1000f); if (num119 != num120 || num121 != num122) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; + Projectile.velocity.X = num116; + Projectile.velocity.Y = num117; } else { int num123 = (int)(num116 * 1000f); - int num124 = (int)(projectile.velocity.X * 1000f); + int num124 = (int)(Projectile.velocity.X * 1000f); int num125 = (int)(num117 * 1000f); - int num126 = (int)(projectile.velocity.Y * 1000f); + int num126 = (int)(Projectile.velocity.Y * 1000f); if (num123 != num124 || num125 != num126) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; + Projectile.velocity.X = num116; + Projectile.velocity.Y = num117; } } - else if (projectile.ai[0] <= 0f) + else if (Projectile.ai[0] <= 0f) { - projectile.netUpdate = true; + Projectile.netUpdate = true; float num127 = 12f; - Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector11 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; - if (Main.player[projectile.owner].gravDir == -1f) + if (Main.player[Projectile.owner].gravDir == -1f) { num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; } float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || projectile.ai[0] < 0f) + if (num130 == 0f || Projectile.ai[0] < 0f) { - vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); - num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; - num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; + vector11 = new Vector2(Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2), Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2)); + num128 = Projectile.position.X + (float)Projectile.width * 0.5f - vector11.X; + num129 = Projectile.position.Y + (float)Projectile.height * 0.5f - vector11.Y; num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); } num130 = num127 / num130; num128 *= num130; num129 *= num130; - projectile.velocity.X = num128; - projectile.velocity.Y = num129; - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + Projectile.velocity.X = num128; + Projectile.velocity.Y = num129; + if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.Kill(); + Projectile.Kill(); } - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } } - if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) + if (Projectile.velocity.X != 0f || Projectile.velocity.Y != 0f) { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 8; k++) { - int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default, 1.25f); + int num114 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); Dust dust = Main.dust[num114]; dust.velocity *= 0.3f; - Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.Y = Projectile.position.Y + (float)(Projectile.height / 2) + (float)Main.rand.Next(-4, 5); Main.dust[num114].noGravity = true; } } diff --git a/Projectiles/Magic/SerpentineTail.cs b/Projectiles/Magic/SerpentineTail.cs index cc1b97f6aa..b221e1eb99 100644 --- a/Projectiles/Magic/SerpentineTail.cs +++ b/Projectiles/Magic/SerpentineTail.cs @@ -9,35 +9,35 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Serpentine"); - ProjectileID.Sets.NeedsUUID[projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 14; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); int num1051 = 10; Vector2 value68 = Vector2.Zero; - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - int chase = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); + int chase = Projectile.GetByUUID(Projectile.owner, (int)Projectile.ai[0]); float num1064; float scaleFactor17; float scaleFactor18; @@ -48,48 +48,48 @@ namespace CalamityMod.Projectiles.Magic num1064 = Main.projectile[chase].rotation; scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); scaleFactor17 = 16f; - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; + Main.projectile[chase].localAI[0] = Projectile.localAI[0] + 1f; } else { for (int k = 0; k < 8; k++) { - int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default, 1.25f); + int num114 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 68, 0f, 0f, 100, default, 1.25f); Dust dust = Main.dust[num114]; dust.velocity *= 0.3f; - Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.X = Projectile.position.X + (float)(Projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.Y = Projectile.position.Y + (float)(Projectile.height / 2) + (float)Main.rand.Next(-4, 5); Main.dust[num114].noGravity = true; } - projectile.active = false; - projectile.Kill(); + Projectile.active = false; + Projectile.Kill(); return; } - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 40; + Projectile.alpha -= 40; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (num1064 != projectile.rotation) + Projectile.velocity = Vector2.Zero; + Vector2 vector134 = value68 - Projectile.Center; + if (num1064 != Projectile.rotation) { - float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); + float num1068 = MathHelper.WrapAngle(num1064 - Projectile.rotation); vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default); } - projectile.rotation = vector134.ToRotation() + 1.57079637f; - projectile.position = projectile.Center; - projectile.scale = scaleFactor18; - projectile.width = projectile.height = (int)((float)num1051 * projectile.scale); - projectile.Center = projectile.position; + Projectile.rotation = vector134.ToRotation() + 1.57079637f; + Projectile.position = Projectile.Center; + Projectile.scale = scaleFactor18; + Projectile.width = Projectile.height = (int)((float)num1051 * Projectile.scale); + Projectile.Center = Projectile.position; if (vector134 != Vector2.Zero) { - projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; + Projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; } - projectile.spriteDirection = (vector134.X > 0f) ? 1 : -1; + Projectile.spriteDirection = (vector134.X > 0f) ? 1 : -1; return; } } diff --git a/Projectiles/Magic/ShadeNimbus.cs b/Projectiles/Magic/ShadeNimbus.cs index 0e44a8f697..b99d29369b 100644 --- a/Projectiles/Magic/ShadeNimbus.cs +++ b/Projectiles/Magic/ShadeNimbus.cs @@ -11,66 +11,66 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Nimbus"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 54; - projectile.height = 24; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; + Projectile.width = 54; + Projectile.height = 24; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame >= Main.projFrames[projectile.type]) + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } } - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 7200f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 7200f) { - projectile.alpha += 5; - if (projectile.alpha > 255) + Projectile.alpha += 5; + if (Projectile.alpha > 255) { - projectile.alpha = 255; - projectile.Kill(); + Projectile.alpha = 255; + Projectile.Kill(); } } else { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 8f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 8f) { - projectile.ai[0] = 0f; - if (projectile.owner == Main.myPlayer) + Projectile.ai[0] = 0f; + if (Projectile.owner == Main.myPlayer) { - int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); - int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); + int num414 = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); + int num415 = (int)(Projectile.position.Y + (float)Projectile.height + 4f); + Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); } } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 10f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 10f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; int projCount = 0; int oldestCloud = 0; float cloudAge = 0f; - int projType = projectile.type; + int projType = Projectile.type; for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { Projectile proj = Main.projectile[projIndex]; - if (proj.active && proj.owner == projectile.owner && proj.type == projType && proj.ai[1] < 3600f) + if (proj.active && proj.owner == Projectile.owner && proj.type == projType && proj.ai[1] < 3600f) { projCount++; if (proj.ai[1] > cloudAge) diff --git a/Projectiles/Magic/ShadeNimbusCloud.cs b/Projectiles/Magic/ShadeNimbusCloud.cs index 0197c14da6..78e0ba8edd 100644 --- a/Projectiles/Magic/ShadeNimbusCloud.cs +++ b/Projectiles/Magic/ShadeNimbusCloud.cs @@ -7,47 +7,47 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Nimbus"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.netImportant = true; - projectile.penetrate = -1; + Projectile.width = 28; + Projectile.height = 28; + Projectile.netImportant = true; + Projectile.penetrate = -1; } public override void AI() { - float num410 = projectile.ai[0]; - float num411 = projectile.ai[1]; + float num410 = Projectile.ai[0]; + float num411 = Projectile.ai[1]; if (num410 != 0f && num411 != 0f) { bool flag12 = false; bool flag13 = false; - if ((projectile.velocity.X < 0f && projectile.Center.X < num410) || (projectile.velocity.X > 0f && projectile.Center.X > num410)) + if ((Projectile.velocity.X < 0f && Projectile.Center.X < num410) || (Projectile.velocity.X > 0f && Projectile.Center.X > num410)) { flag12 = true; } - if ((projectile.velocity.Y < 0f && projectile.Center.Y < num411) || (projectile.velocity.Y > 0f && projectile.Center.Y > num411)) + if ((Projectile.velocity.Y < 0f && Projectile.Center.Y < num411) || (Projectile.velocity.Y > 0f && Projectile.Center.Y > num411)) { flag13 = true; } if (flag12 && flag13) { - projectile.Kill(); + Projectile.Kill(); } } - projectile.rotation += projectile.velocity.X * 0.02f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.rotation += Projectile.velocity.X * 0.02f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 3) + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; return; } } @@ -55,9 +55,9 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Magic/ShadecrystalProjectile.cs b/Projectiles/Magic/ShadecrystalProjectile.cs index 8126acfed4..ad6e0d2689 100644 --- a/Projectiles/Magic/ShadecrystalProjectile.cs +++ b/Projectiles/Magic/ShadecrystalProjectile.cs @@ -14,53 +14,53 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.scale = 1.5f; - projectile.friendly = true; - projectile.alpha = 50; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.magic = true; + Projectile.width = 6; + Projectile.height = 6; + Projectile.scale = 1.5f; + Projectile.friendly = true; + Projectile.alpha = 50; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.15f, 0f, 0.15f); + Lighting.AddLight(Projectile.Center, 0.15f, 0f, 0.15f); - projectile.rotation += projectile.velocity.X * 0.2f; + Projectile.rotation += Projectile.velocity.X * 0.2f; if (Main.rand.NextBool(4)) { - int num300 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 70, 0f, 0f, 0, default, 1f); + int num300 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 70, 0f, 0f, 0, default, 1f); Main.dust[num300].noGravity = true; Main.dust[num300].velocity *= 0.2f; Main.dust[num300].scale *= 0.8f; } - projectile.velocity *= 0.99f; + Projectile.velocity *= 0.99f; - projectile.ai[1] += 1f; - if (projectile.ai[1] > 90f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 90f) { - projectile.scale -= 0.05f; - if (projectile.scale <= 0.2) + Projectile.scale -= 0.05f; + if (Projectile.scale <= 0.2) { - projectile.scale = 0.2f; - projectile.Kill(); + Projectile.scale = 0.2f; + Projectile.Kill(); } - projectile.width = (int)(6f * projectile.scale); - projectile.height = (int)(6f * projectile.scale); + Projectile.width = (int)(6f * Projectile.scale); + Projectile.height = (int)(6f * Projectile.scale); } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; return false; } @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 70, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 70, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Magic/Shaderain.cs b/Projectiles/Magic/Shaderain.cs index 31e557ea19..920e109c1c 100644 --- a/Projectiles/Magic/Shaderain.cs +++ b/Projectiles/Magic/Shaderain.cs @@ -16,29 +16,29 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 40; - projectile.friendly = true; - projectile.extraUpdates = 1; - projectile.penetrate = 3; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.magic = true; + Projectile.width = 4; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.extraUpdates = 1; + Projectile.penetrate = 3; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.alpha = 50; + Projectile.alpha = 50; } public override void Kill(int timeLeft) { - int num310 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + (float)projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default, 1f); + int num310 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + (float)Projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num310]; dust.position.X -= 2f; dust.alpha = 38; dust.velocity *= 0.1f; - dust.velocity += -projectile.oldVelocity * 0.25f; + dust.velocity += -Projectile.oldVelocity * 0.25f; dust.scale = 0.95f; } diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index f84329dc0c..ce3382d995 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -15,35 +15,35 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 6; - projectile.extraUpdates = 100; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 6; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.damage = (int)(projectile.damage * 1.15); - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.damage = (int)(Projectile.damage * 1.15); + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -51,19 +51,19 @@ namespace CalamityMod.Projectiles.Magic public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.damage = (int)(projectile.damage * 1.15); + Projectile.damage = (int)(Projectile.damage * 1.15); } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { for (int num447 = 0; num447 < 4; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); + Projectile.alpha = 255; int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 1f); Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; diff --git a/Projectiles/Magic/ShiftingSandsProj.cs b/Projectiles/Magic/ShiftingSandsProj.cs index bafe24ae78..388cdcd5e4 100644 --- a/Projectiles/Magic/ShiftingSandsProj.cs +++ b/Projectiles/Magic/ShiftingSandsProj.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -12,53 +13,53 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Shifting Sands"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.magic = true; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.penetrate = 5; + Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.soundDelay == 0 && Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 2f) + if (Projectile.soundDelay == 0 && Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) > 2f) { - projectile.soundDelay = 10; - Main.PlaySound(SoundID.Item20, projectile.Center); + Projectile.soundDelay = 10; + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } - int sand = Dust.NewDust(projectile.position, projectile.width, projectile.height, 85, 0f, 0f, 100, default, 2f); + int sand = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[sand]; dust.velocity *= 0.3f; - dust.position.X = projectile.Center.X + 4f + (float)Main.rand.Next(-4, 5); - dust.position.Y = projectile.Center.Y + (float)Main.rand.Next(-4, 5); + dust.position.X = Projectile.Center.X + 4f + (float)Main.rand.Next(-4, 5); + dust.position.Y = Projectile.Center.Y + (float)Main.rand.Next(-4, 5); dust.noGravity = true; - if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) + if (Main.myPlayer == Projectile.owner && Projectile.ai[0] <= 0f) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player.channel) { float speed = 18f; - float mouseDistX = (float)Main.mouseX + Main.screenPosition.X - projectile.Center.X; - float mouseDistY = (float)Main.mouseY + Main.screenPosition.Y - projectile.Center.Y; + float mouseDistX = (float)Main.mouseX + Main.screenPosition.X - Projectile.Center.X; + float mouseDistY = (float)Main.mouseY + Main.screenPosition.Y - Projectile.Center.Y; if (player.gravDir == -1f) { - mouseDistY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projectile.Center.Y; + mouseDistY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - Projectile.Center.Y; } Vector2 mouseVec = new Vector2(mouseDistX, mouseDistY); float mouseDist = mouseVec.Length(); - if (projectile.ai[0] < 0f) + if (Projectile.ai[0] < 0f) { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } if (mouseDist > speed) { @@ -66,35 +67,35 @@ namespace CalamityMod.Projectiles.Magic mouseVec.X *= mouseDist; mouseVec.Y *= mouseDist; int mouseSpeedX = (int)(mouseVec.X * 1000f); - int projSpeedX = (int)(projectile.velocity.X * 1000f); + int projSpeedX = (int)(Projectile.velocity.X * 1000f); int mouseSpeedY = (int)(mouseVec.Y * 1000f); - int projSpeedY = (int)(projectile.velocity.Y * 1000f); + int projSpeedY = (int)(Projectile.velocity.Y * 1000f); if (mouseSpeedX != projSpeedX || mouseSpeedY != projSpeedY) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity.X = mouseVec.X; - projectile.velocity.Y = mouseVec.Y; + Projectile.velocity.X = mouseVec.X; + Projectile.velocity.Y = mouseVec.Y; } else { int mouseSpeedX = (int)(mouseVec.X * 1000f); - int projSpeedX = (int)(projectile.velocity.X * 1000f); + int projSpeedX = (int)(Projectile.velocity.X * 1000f); int mouseSpeedY = (int)(mouseVec.Y * 1000f); - int projSpeedY = (int)(projectile.velocity.Y * 1000f); + int projSpeedY = (int)(Projectile.velocity.Y * 1000f); if (mouseSpeedX != projSpeedX || mouseSpeedY != projSpeedY) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity.X = mouseVec.X; - projectile.velocity.Y = mouseVec.Y; + Projectile.velocity.X = mouseVec.X; + Projectile.velocity.Y = mouseVec.Y; } } - else if (projectile.ai[0] <= 0f) + else if (Projectile.ai[0] <= 0f) { - projectile.netUpdate = true; + Projectile.netUpdate = true; float speed = 12f; - Vector2 projCenter = projectile.Center; + Vector2 projCenter = Projectile.Center; float mouseDistX = (float)Main.mouseX + Main.screenPosition.X - projCenter.X; float mouseDistY = (float)Main.mouseY + Main.screenPosition.Y - projCenter.Y; if (player.gravDir == -1f) @@ -103,57 +104,57 @@ namespace CalamityMod.Projectiles.Magic } Vector2 mouseVec = new Vector2(mouseDistX, mouseDistY); float mouseDist = mouseVec.Length(); - if (mouseDist == 0f || projectile.ai[0] < 0f) + if (mouseDist == 0f || Projectile.ai[0] < 0f) { projCenter = player.Center; - mouseVec = projectile.Center - projCenter; + mouseVec = Projectile.Center - projCenter; mouseDist = mouseVec.Length(); } mouseDist = speed / mouseDist; mouseVec.X *= mouseDist; mouseVec.Y *= mouseDist; - projectile.velocity.X = mouseVec.X; - projectile.velocity.Y = mouseVec.Y; - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + Projectile.velocity.X = mouseVec.X; + Projectile.velocity.Y = mouseVec.Y; + if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.Kill(); + Projectile.Kill(); } - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } } - if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) + if (Projectile.velocity.X != 0f || Projectile.velocity.Y != 0f) { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.Center); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); int dustAmt = 36; for (int index = 0; index < dustAmt; index++) { - Vector2 dustPos = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - dustPos = dustPos.RotatedBy((double)((float)(index - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 dustVel = dustPos - projectile.Center; + Vector2 dustPos = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + dustPos = dustPos.RotatedBy((double)((float)(index - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 dustVel = dustPos - Projectile.Center; int sand = Dust.NewDust(dustPos + dustVel, 0, 0, 85, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.2f); Main.dust[sand].noGravity = true; Main.dust[sand].noLight = true; diff --git a/Projectiles/Magic/SilvaBurst.cs b/Projectiles/Magic/SilvaBurst.cs index 851647bc8b..34899d76e0 100644 --- a/Projectiles/Magic/SilvaBurst.cs +++ b/Projectiles/Magic/SilvaBurst.cs @@ -15,36 +15,36 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 96; - projectile.height = 96; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.alpha = 255; - projectile.timeLeft = 2; + Projectile.width = 96; + Projectile.height = 96; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.alpha = 255; + Projectile.timeLeft = 2; } public override void AI() { // Create a bright burst of Silva light. float brightness = 1.6f; - Lighting.AddLight(projectile.Center, 0.27f * brightness, 0.82f * brightness, 0.157f * brightness); + Lighting.AddLight(Projectile.Center, 0.27f * brightness, 0.82f * brightness, 0.157f * brightness); // Produce a bunch of dust. int dustID = 157; for (int d = 0; d < 3; d++) - Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); for (int d = 0; d < 30; d++) { - int explode = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 2.5f); + int explode = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 2.5f); Main.dust[explode].noGravity = true; Main.dust[explode].velocity *= 3f; - explode = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); + explode = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); Main.dust[explode].velocity *= 2f; Main.dust[explode].noGravity = true; } diff --git a/Projectiles/Magic/SirensSongNote.cs b/Projectiles/Magic/SirensSongNote.cs index b671eb022c..0c3b4ff221 100644 --- a/Projectiles/Magic/SirensSongNote.cs +++ b/Projectiles/Magic/SirensSongNote.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -12,70 +13,70 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Song"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 5; - projectile.timeLeft = 420; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 5; + Projectile.timeLeft = 420; } public override void AI() { - if (projectile.velocity.Length() > 4f) - projectile.velocity *= 0.985f; + if (Projectile.velocity.Length() > 4f) + Projectile.velocity *= 0.985f; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.02f; - if (projectile.scale >= 1.25f) - projectile.localAI[0] = 1f; + Projectile.scale += 0.02f; + if (Projectile.scale >= 1.25f) + Projectile.localAI[0] = 1f; } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale -= 0.02f; - if (projectile.scale <= 0.75f) - projectile.localAI[0] = 0f; + Projectile.scale -= 0.02f; + if (Projectile.scale <= 0.75f) + Projectile.localAI[0] = 0f; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.harpNote = projectile.ai[0]; - Main.PlaySound(SoundID.Item26, projectile.position); + Projectile.ai[1] = 1f; + Main.harpNote = Projectile.ai[0]; + SoundEngine.PlaySound(SoundID.Item26, Projectile.position); } - Lighting.AddLight(projectile.Center, 0f, 0f, 1.2f); + Lighting.AddLight(Projectile.Center, 0f, 0f, 1.2f); - if (projectile.velocity.X > 0f) - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); + if (Projectile.velocity.X > 0f) + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); else - projectile.rotation = (float)Math.Atan2(-projectile.velocity.Y, -projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2(-Projectile.velocity.Y, -Projectile.velocity.X); } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; return false; } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(50f * (b2 / 255f)); return new Color(b2, b2, b2, a2); } @@ -84,13 +85,13 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[Projectile.owner] = 7; target.AddBuff(BuffID.Confused, 300); } } diff --git a/Projectiles/Magic/SlitheringEelProjectile.cs b/Projectiles/Magic/SlitheringEelProjectile.cs index bebbfb4063..a72472243e 100644 --- a/Projectiles/Magic/SlitheringEelProjectile.cs +++ b/Projectiles/Magic/SlitheringEelProjectile.cs @@ -26,53 +26,53 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Eel"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 360; - projectile.Opacity = 0f; + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 360; + Projectile.Opacity = 0f; } public override void AI() { - projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation(); - if (projectile.numHits >= 3f) + Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.numHits >= 3f) { - projectile.alpha += 5; - if (projectile.alpha >= 255) - projectile.Kill(); + Projectile.alpha += 5; + if (Projectile.alpha >= 255) + Projectile.Kill(); } else - projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.1f, 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.1f, 0f, 1f); - if (projectile.timeLeft % 80f < 35f && projectile.Distance(Main.MouseWorld) > 70f) + if (Projectile.timeLeft % 80f < 35f && Projectile.Distance(Main.MouseWorld) > 70f) { - float angleToTarget = projectile.AngleTo(Main.MouseWorld); - float angleDifference = MathHelper.WrapAngle(angleToTarget - projectile.velocity.ToRotation()); - projectile.velocity = projectile.velocity.RotatedBy(angleDifference / 9f); + float angleToTarget = Projectile.AngleTo(Main.MouseWorld); + float angleDifference = MathHelper.WrapAngle(angleToTarget - Projectile.velocity.ToRotation()); + Projectile.velocity = Projectile.velocity.RotatedBy(angleDifference / 9f); } - if (projectile.timeLeft % 65f == 64f) - Projectile.NewProjectile(projectile.Center, Vector2.UnitY * 7f, ModContent.ProjectileType(), projectile.damage / 2, 2f, projectile.owner); + if (Projectile.timeLeft % 65f == 64f) + Projectile.NewProjectile(Projectile.Center, Vector2.UnitY * 7f, ModContent.ProjectileType(), Projectile.damage / 2, 2f, Projectile.owner); UpdateSegments(); } public void UpdateSegments() { - Vector2 aheadPosition = projectile.Center; - float aheadRotation = projectile.rotation; + Vector2 aheadPosition = Projectile.Center; + float aheadRotation = Projectile.rotation; // Connect all segments to each-other and calculate their rotations. for (int i = 0; i < Segments.Length; i++) @@ -83,9 +83,9 @@ namespace CalamityMod.Projectiles.Magic // Given the fact that all segments will execute this code is succession, the // result across the entire worm will exponentially decay over each segment, // allowing for smooth rotations. This code is what the stardust dragon uses for its segmenting. - if (aheadRotation != projectile.rotation) + if (aheadRotation != Projectile.rotation) { - float offsetAngle = MathHelper.WrapAngle(aheadRotation - projectile.rotation) * 0.03f; + float offsetAngle = MathHelper.WrapAngle(aheadRotation - Projectile.rotation) * 0.03f; offsetToDestination = offsetToDestination.RotatedBy(offsetAngle); } Segments[i].Rotation = (aheadPosition - Segments[i].CurrentPosition).ToRotation(); @@ -99,10 +99,10 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D headTexture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/SlitheringEelProjectile"); - Texture2D bodyTexture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/SlitheringEelBody"); - Texture2D bodyTexture2 = ModContent.GetTexture("CalamityMod/Projectiles/Magic/SlitheringEelBody2"); - Texture2D tailTexture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/SlitheringEelTail"); + Texture2D headTexture = ModContent.Request("CalamityMod/Projectiles/Magic/SlitheringEelProjectile"); + Texture2D bodyTexture = ModContent.Request("CalamityMod/Projectiles/Magic/SlitheringEelBody"); + Texture2D bodyTexture2 = ModContent.Request("CalamityMod/Projectiles/Magic/SlitheringEelBody2"); + Texture2D tailTexture = ModContent.Request("CalamityMod/Projectiles/Magic/SlitheringEelTail"); Vector2 drawPosition; lightColor = new Color(255, 255, 255, 127); @@ -115,11 +115,11 @@ namespace CalamityMod.Projectiles.Magic textureToUse = tailTexture; drawPosition = Segments[i].CurrentPosition - Main.screenPosition; - spriteBatch.Draw(textureToUse, drawPosition, null, projectile.GetAlpha(lightColor), Segments[i].Rotation, textureToUse.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(textureToUse, drawPosition, null, Projectile.GetAlpha(lightColor), Segments[i].Rotation, textureToUse.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); } - drawPosition = projectile.Center - Main.screenPosition; - spriteBatch.Draw(headTexture, drawPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, headTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + drawPosition = Projectile.Center - Main.screenPosition; + spriteBatch.Draw(headTexture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, headTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { for (int i = 0; i < 23; i++) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f); } } } diff --git a/Projectiles/Magic/SmallSpirit.cs b/Projectiles/Magic/SmallSpirit.cs index 4d69980a21..4a412d0f34 100644 --- a/Projectiles/Magic/SmallSpirit.cs +++ b/Projectiles/Magic/SmallSpirit.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Magic { public class SmallSpirit : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public Projectile ProjectileOwner { get @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Magic int spiritType = ModContent.ProjectileType(); for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].type != spiritType || Main.projectile[i].identity != projectile.ai[0] || - Main.projectile[i].owner != projectile.owner) + if (Main.projectile[i].type != spiritType || Main.projectile[i].identity != Projectile.ai[0] || + Main.projectile[i].owner != Projectile.owner) { continue; } @@ -33,26 +33,26 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Small Angry Spirit"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = projectile.height = 28; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 360; + Projectile.width = Projectile.height = 28; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 360; } public override void AI() { - float radius = MathHelper.SmoothStep(84f, 44f, (float)Math.Sqrt(1f - projectile.timeLeft / 360f)); + float radius = MathHelper.SmoothStep(84f, 44f, (float)Math.Sqrt(1f - Projectile.timeLeft / 360f)); // Handle frames. - projectile.frameCounter++; - projectile.frame = projectile.frameCounter / 5 % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; float maxOpacity = 1f; @@ -61,11 +61,11 @@ namespace CalamityMod.Projectiles.Magic float flySpeed = 8f; float flyInertia = 54f; - projectile.hostile = true; - projectile.friendly = false; - if (ProjectileOwner != null && (ProjectileOwner.ModProjectile().CurrentPower > 0.97f || projectile.timeLeft < 95)) + Projectile.hostile = true; + Projectile.friendly = false; + if (ProjectileOwner != null && (ProjectileOwner.ModProjectile().CurrentPower > 0.97f || Projectile.timeLeft < 95)) { - projectile.hostile = false; + Projectile.hostile = false; radius += 54f; @@ -74,9 +74,9 @@ namespace CalamityMod.Projectiles.Magic flyInertia = 5f; // Die if close to the owner projectile, effectively being absorbed. - projectile.Center = projectile.Center.MoveTowards(target.Center, 8.5f); - if (projectile.WithinRange(target.Center, 80f)) - projectile.Kill(); + Projectile.Center = Projectile.Center.MoveTowards(target.Center, 8.5f); + if (Projectile.WithinRange(target.Center, 80f)) + Projectile.Kill(); // Become translucent when returning to the projectile owner. maxOpacity = 0.4f; @@ -85,39 +85,39 @@ namespace CalamityMod.Projectiles.Magic // Die if no valid target exists or the projectile owner is absent. if (target is null || ProjectileOwner is null || !ProjectileOwner.active) { - projectile.Kill(); + Projectile.Kill(); return; } // If not close to the target, redirect towards them. - if (!projectile.WithinRange(target.Center, 260f)) + if (!Projectile.WithinRange(target.Center, 260f)) { - Vector2 idealVelocity = projectile.SafeDirectionTo(target.Center) * flySpeed; - projectile.velocity = (projectile.velocity * (flyInertia - 1f) + idealVelocity) / flyInertia; + Vector2 idealVelocity = Projectile.SafeDirectionTo(target.Center) * flySpeed; + Projectile.velocity = (Projectile.velocity * (flyInertia - 1f) + idealVelocity) / flyInertia; } // Otherwise accelerate. else - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; // Rapidly fade in. - projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.075f, 0f, maxOpacity); + Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.075f, 0f, maxOpacity); // Decide rotation. - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; // Emit particles. - Vector2 spawnPosition = projectile.Center + Main.rand.NextVector2Circular(5f, 5f) * radius / 130f; + Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Circular(5f, 5f) * radius / 130f; FusableParticleManager.GetParticleSetByType()?.SpawnParticle(spawnPosition, radius); } - public override Color? GetAlpha(Color lightColor) => Color.White * projectile.Opacity; + public override Color? GetAlpha(Color lightColor) => Color.White * Projectile.Opacity; public override void Kill(int timeLeft) { for (int i = 0; i < 6; i++) { - Dust phantoplasm = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(12f, 12f), 261); + Dust phantoplasm = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(12f, 12f), 261); phantoplasm.color = Color.Lerp(Color.LightPink, Color.Red, Main.rand.NextFloat(0.67f)); phantoplasm.scale = 1.2f; phantoplasm.fadeIn = 0.55f; diff --git a/Projectiles/Magic/Snowball.cs b/Projectiles/Magic/Snowball.cs index fbe8b34be8..d3f838fc8d 100644 --- a/Projectiles/Magic/Snowball.cs +++ b/Projectiles/Magic/Snowball.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -10,15 +11,15 @@ namespace CalamityMod.Projectiles.Magic { public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.magic = true; - projectile.coldDamage = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.coldDamage = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.coldDamage = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.coldDamage = true; } public override void SetStaticDefaults() @@ -34,28 +35,28 @@ namespace CalamityMod.Projectiles.Magic public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); //crystal bullet shards for (int index1 = 0; index1 < 10; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, new Color(), 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, new Color(), 1f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 2f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int index = 0; index < 6; ++index) { - 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 p = Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 2, 0f, projectile.owner); - Main.projectile[p].ranged = false; - Main.projectile[p].magic = true; + 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 p = Projectile.NewProjectile(Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, Projectile.damage / 2, 0f, Projectile.owner); + // Main.projectile[p].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + Main.projectile[p].DamageType = DamageClass.Magic; } } //insert ice shattering dust here diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index 220c9aa1f7..d057e69523 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -11,52 +12,52 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Snowflake"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 9; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.alpha = 70; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.magic = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 9; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.alpha = 70; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Magic; aiType = ProjectileID.FlyingKnife; - projectile.coldDamage = true; + Projectile.coldDamage = true; } public override void AI() { - projectile.rotation += 0.15f; + Projectile.rotation += 0.15f; if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[Projectile.owner] = 7; target.AddBuff(BuffID.Frostburn, 180); } } diff --git a/Projectiles/Magic/SolarBeam2.cs b/Projectiles/Magic/SolarBeam2.cs index 50e9dd6b9b..c1c3f588f0 100644 --- a/Projectiles/Magic/SolarBeam2.cs +++ b/Projectiles/Magic/SolarBeam2.cs @@ -15,31 +15,31 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 6; - projectile.extraUpdates = 100; - projectile.timeLeft = 300; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 6; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 300; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -47,14 +47,14 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num447 = 0; num447 < 4; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); + Projectile.alpha = 255; int num448 = Dust.NewDust(vector33, 1, 1, 246, 0f, 0f, 0, default, 1f); Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; @@ -65,10 +65,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 4; - if (projectile.owner == Main.myPlayer) + target.immune[Projectile.owner] = 4; + if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMagic = true; } diff --git a/Projectiles/Magic/SolarElementalBeam.cs b/Projectiles/Magic/SolarElementalBeam.cs index bce85a1d74..b1cc27a051 100644 --- a/Projectiles/Magic/SolarElementalBeam.cs +++ b/Projectiles/Magic/SolarElementalBeam.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.Magic public override float MaxLaserLength => 1000f; public override float Lifetime => 30f; public override Color LightCastColor => Color.White; - public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); - public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); - public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); public override void SetStaticDefaults() { @@ -24,14 +24,14 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = projectile.height = 20; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 13; - projectile.tileCollide = false; - projectile.timeLeft = (int)Lifetime; + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 13; + Projectile.tileCollide = false; + Projectile.timeLeft = (int)Lifetime; } public override void ExtraBehavior() @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic Color dustColor = Color.Lerp(Color.White, Color.Yellow, j / 12f); float dustScale = MathHelper.Lerp(1.6f, 0.85f, j / 12f); - Dust fire = Dust.NewDustPerfect(projectile.Center, 6); + Dust fire = Dust.NewDustPerfect(Projectile.Center, 6); fire.velocity = angle.ToRotationVector2() * starSpeed; fire.color = dustColor; fire.scale = dustScale; @@ -59,13 +59,13 @@ namespace CalamityMod.Projectiles.Magic } } - public override void DetermineScale() => projectile.scale = projectile.timeLeft / Lifetime * MaxScale; + public override void DetermineScale() => Projectile.scale = Projectile.timeLeft / Lifetime * MaxScale; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - DrawBeamWithColor(spriteBatch, Color.Lerp(Color.OrangeRed, Color.Transparent, 0.25f), projectile.scale); - DrawBeamWithColor(spriteBatch, Color.Lerp(Color.Yellow * 1.1f, Color.Transparent, 0.25f), projectile.scale * 0.4f); + DrawBeamWithColor(spriteBatch, Color.Lerp(Color.OrangeRed, Color.Transparent, 0.25f), Projectile.scale); + DrawBeamWithColor(spriteBatch, Color.Lerp(Color.Yellow * 1.1f, Color.Transparent, 0.25f), Projectile.scale * 0.4f); return false; } @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Magic { int type = ModContent.ProjectileType(); int boomDamage = (int)(damage * 1.1); - int boom = Projectile.NewProjectile(target.Center, Vector2.Zero, type, boomDamage, knockback, projectile.owner, 0f, Main.rand.NextFloat(0.85f, 2f)); + int boom = Projectile.NewProjectile(target.Center, Vector2.Zero, type, boomDamage, knockback, Projectile.owner, 0f, Main.rand.NextFloat(0.85f, 2f)); Main.projectile[boom].Calamity().forceMagic = true; } } diff --git a/Projectiles/Magic/SoulPiercerBeam.cs b/Projectiles/Magic/SoulPiercerBeam.cs index 7262d86198..7dac73c49f 100644 --- a/Projectiles/Magic/SoulPiercerBeam.cs +++ b/Projectiles/Magic/SoulPiercerBeam.cs @@ -14,26 +14,26 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 240; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 240; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity; - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity; + Projectile.alpha = 255; int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.5f); Main.dust[num448].position = vector33; Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.014f; @@ -45,9 +45,9 @@ namespace CalamityMod.Projectiles.Magic { for (int x = 0; x < 3; x++) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ProjectileBarrage(projectile.Center, target.Center, true, -500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, projectile.owner, false, 0f); + CalamityUtils.ProjectileBarrage(Projectile.Center, target.Center, true, -500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, false, 0f); } } } diff --git a/Projectiles/Magic/SoulPiercerBolt.cs b/Projectiles/Magic/SoulPiercerBolt.cs index a50114daae..7e700c78d7 100644 --- a/Projectiles/Magic/SoulPiercerBolt.cs +++ b/Projectiles/Magic/SoulPiercerBolt.cs @@ -14,22 +14,22 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 180; - projectile.penetrate = -1; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 4; + Projectile.height = 4; + Projectile.extraUpdates = 100; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 180; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity; int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.5f); Main.dust[num448].position = vector33; Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.014f; diff --git a/Projectiles/Magic/SparkInfernal.cs b/Projectiles/Magic/SparkInfernal.cs index 0ac2553275..d1591286e7 100644 --- a/Projectiles/Magic/SparkInfernal.cs +++ b/Projectiles/Magic/SparkInfernal.cs @@ -15,23 +15,23 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.magic = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 6, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } public override void Kill(int timeLeft) { - Player player = Main.player[projectile.owner]; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(TheWand.BaseDamage * (player.allDamage + player.magicDamage - 1f)), projectile.knockBack, projectile.owner, 0f, 0f); + Player player = Main.player[Projectile.owner]; + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(TheWand.BaseDamage * (player.allDamage + player.GetDamage(DamageClass.Magic) - 1f)), Projectile.knockBack, Projectile.owner, 0f, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Magic/SparklingBeam.cs b/Projectiles/Magic/SparklingBeam.cs index 6526641425..750aff1f60 100644 --- a/Projectiles/Magic/SparklingBeam.cs +++ b/Projectiles/Magic/SparklingBeam.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -25,15 +26,15 @@ namespace CalamityMod.Projectiles.Magic // By making a property to handle this it makes our life easier, and the accessibility more readable public float Distance { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } // The actual charge value is stored in the localAI0 field public float Charge { - get => projectile.localAI[0]; - set => projectile.localAI[0] = value; + get => Projectile.localAI[0]; + set => Projectile.localAI[0] = value; } // Are we at max charge? With c#6 you can simply use => which indicates this is a get only property @@ -44,18 +45,18 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.hide = true; - projectile.timeLeft = 300; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 19; - projectile.Calamity().PierceResistHarshness = 0.06f; - projectile.Calamity().PierceResistCap = 0.4f; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.hide = true; + Projectile.timeLeft = 300; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 19; + Projectile.Calamity().PierceResistHarshness = 0.06f; + Projectile.Calamity().PierceResistCap = 0.4f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -63,8 +64,8 @@ namespace CalamityMod.Projectiles.Magic // We start drawing the laser if we have charged up if (IsAtMaxCharge) { - DrawLaser(spriteBatch, Main.projectileTexture[projectile.type], Main.player[projectile.owner].Center, - projectile.velocity, 10, projectile.damage, -1.57f, 1f, 1000f, Color.White, (int)MOVE_DISTANCE); + DrawLaser(spriteBatch, Main.projectileTexture[Projectile.type], Main.player[Projectile.owner].Center, + Projectile.velocity, 10, Projectile.damage, -1.57f, 1f, 1000f, Color.White, (int)MOVE_DISTANCE); } return false; } @@ -100,8 +101,8 @@ namespace CalamityMod.Projectiles.Magic if (!IsAtMaxCharge) return false; - Player player = Main.player[projectile.owner]; - Vector2 unit = projectile.velocity; + Player player = Main.player[Projectile.owner]; + Vector2 unit = Projectile.velocity; float point = 0f; // Run an AABB versus Line check to look for collisions, look up AABB collision first to see how it works // It will look for collisions on the given line using AABB @@ -113,15 +114,15 @@ namespace CalamityMod.Projectiles.Magic { if (target.life <= 0 && target.lifeMax > 5) { - Player player = Main.player[projectile.owner]; - int shardDamage = projectile.damage / 5; + Player player = Main.player[Projectile.owner]; + int shardDamage = Projectile.damage / 5; int shardAmt = Main.rand.Next(2, 4); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int s = 0; s < shardAmt; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType(), shardDamage, 0f, projectile.owner); + int shard = Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType(), shardDamage, 0f, Projectile.owner); if (shard.WithinBounds(Main.maxProjectiles)) Main.projectile[shard].Calamity().forceMagic = true; } @@ -132,9 +133,9 @@ namespace CalamityMod.Projectiles.Magic // The AI of the projectile public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.position = player.Center + projectile.velocity * MOVE_DISTANCE; - projectile.timeLeft = 2; + Player player = Main.player[Projectile.owner]; + Projectile.position = player.Center + Projectile.velocity * MOVE_DISTANCE; + Projectile.timeLeft = 2; // By separating large AI into methods it becomes very easy to see the flow of the AI in a broader sense // First we update player variables that are needed to channel the laser @@ -152,7 +153,7 @@ namespace CalamityMod.Projectiles.Magic //Play cool sound when fully charged if (!playedSound) { - Main.PlaySound(SoundID.Item68, projectile.position); + SoundEngine.PlaySound(SoundID.Item68, Projectile.position); playedSound = true; } @@ -163,18 +164,18 @@ namespace CalamityMod.Projectiles.Magic private void SpawnDusts(Player player) { - Vector2 unit = projectile.velocity * -1; - Vector2 dustPos = player.Center + projectile.velocity * Distance; + Vector2 unit = Projectile.velocity * -1; + Vector2 dustPos = player.Center + Projectile.velocity * Distance; for (int i = 0; i < 2; ++i) { - float num1 = projectile.velocity.ToRotation() + (Main.rand.Next(2) == 1 ? -1.0f : 1.0f) * 1.57f; + float num1 = Projectile.velocity.ToRotation() + (Main.rand.Next(2) == 1 ? -1.0f : 1.0f) * 1.57f; float num2 = (float)(Main.rand.NextDouble() * 0.8f + 1.0f); Vector2 dustVel = new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2); Dust dust = Main.dust[Dust.NewDust(dustPos, 0, 0, 226, dustVel.X, dustVel.Y)]; dust.noGravity = true; dust.scale = 1.2f; - dust = Dust.NewDustDirect(Main.player[projectile.owner].Center, 0, 0, 31, + dust = Dust.NewDustDirect(Main.player[Projectile.owner].Center, 0, 0, 31, -unit.X * Distance, -unit.Y * Distance); dust.fadeIn = 0f; dust.noGravity = true; @@ -184,13 +185,13 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(5)) { - Vector2 offset = projectile.velocity.RotatedBy(1.57f) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; + Vector2 offset = Projectile.velocity.RotatedBy(1.57f) * ((float)Main.rand.NextDouble() - 0.5f) * Projectile.width; Dust dust = Main.dust[Dust.NewDust(dustPos + offset - Vector2.One * 4f, 8, 8, 31, 0.0f, 0.0f, 100, new Color(), 1.5f)]; dust.velocity *= 0.5f; dust.velocity.Y = -Math.Abs(dust.velocity.Y); - unit = dustPos - Main.player[projectile.owner].Center; + unit = dustPos - Main.player[Projectile.owner].Center; unit.Normalize(); - dust = Main.dust[Dust.NewDust(Main.player[projectile.owner].Center + 55 * unit, 8, 8, 31, 0.0f, 0.0f, 100, new Color(), 1.5f)]; + dust = Main.dust[Dust.NewDust(Main.player[Projectile.owner].Center + 55 * unit, 8, 8, 31, 0.0f, 0.0f, 100, new Color(), 1.5f)]; dust.velocity = dust.velocity * 0.5f; dust.velocity.Y = -Math.Abs(dust.velocity.Y); } @@ -202,8 +203,8 @@ namespace CalamityMod.Projectiles.Magic private void SetLaserPosition(Player player) { float[] samplingPoints = new float[12]; - Collision.LaserScan(player.Center + projectile.velocity * MOVE_DISTANCE, projectile.velocity, projectile.width * 0.5f, 2200f, samplingPoints); - Distance = MathHelper.Max(samplingPoints.Average() + projectile.height * 2f, 40f); + Collision.LaserScan(player.Center + Projectile.velocity * MOVE_DISTANCE, Projectile.velocity, Projectile.width * 0.5f, 2200f, samplingPoints); + Distance = MathHelper.Max(samplingPoints.Average() + Projectile.height * 2f, 40f); } private void ChargeLaser(Player player) @@ -211,15 +212,15 @@ namespace CalamityMod.Projectiles.Magic // Kill the projectile if the player stops channeling if (!player.channel) { - projectile.Kill(); + Projectile.Kill(); } else { // Do we still have enough mana? If not, we kill the projectile because we cannot use it anymore - if (Main.player[projectile.owner].miscCounter % 10 == 0 && !player.CheckMana(player.ActiveItem(), -1, true)) + if (Main.player[Projectile.owner].miscCounter % 10 == 0 && !player.CheckMana(player.ActiveItem(), -1, true)) { - projectile.Kill(); + Projectile.Kill(); } - Vector2 offset = projectile.velocity; + Vector2 offset = Projectile.velocity; offset *= MOVE_DISTANCE - 20; Vector2 pos = player.Center + offset - new Vector2(10, 10); if (Charge < MAX_CHARGE) @@ -228,12 +229,12 @@ namespace CalamityMod.Projectiles.Magic } int chargeFact = (int)(Charge / 20f); Vector2 dustVelocity = Vector2.UnitX * 18f; - dustVelocity = dustVelocity.RotatedBy(projectile.rotation - 1.57f); - Vector2 spawnPos = projectile.Center + dustVelocity; + dustVelocity = dustVelocity.RotatedBy(Projectile.rotation - 1.57f); + Vector2 spawnPos = Projectile.Center + dustVelocity; for (int k = 0; k < chargeFact + 1; k++) { Vector2 spawn = spawnPos + ((float)Main.rand.NextDouble() * 6.28f).ToRotationVector2() * (12f - chargeFact * 2); - Dust dust = Main.dust[Dust.NewDust(pos, 20, 20, 226, projectile.velocity.X / 2f, projectile.velocity.Y / 2f)]; + Dust dust = Main.dust[Dust.NewDust(pos, 20, 20, 226, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f)]; dust.velocity = Vector2.Normalize(spawnPos - spawn) * 1.5f * (10f - chargeFact * 2f) / 10f; dust.noGravity = true; dust.scale = Main.rand.Next(10, 20) * 0.05f; @@ -244,27 +245,27 @@ namespace CalamityMod.Projectiles.Magic private void UpdatePlayer(Player player) { // Multiplayer support here, only run this code if the client running it is the owner of the projectile - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { Vector2 diff = Main.MouseWorld - player.Center; diff.Normalize(); - projectile.velocity = diff; - projectile.direction = Main.MouseWorld.X > player.position.X ? 1 : -1; - projectile.netUpdate = true; + Projectile.velocity = diff; + Projectile.direction = Main.MouseWorld.X > player.position.X ? 1 : -1; + Projectile.netUpdate = true; } - int dir = projectile.direction; + int dir = Projectile.direction; player.ChangeDir(dir); // Set player direction to where we are shooting - player.heldProj = projectile.whoAmI; // Update player's held projectile + player.heldProj = Projectile.whoAmI; // Update player's held projectile player.itemTime = 2; // Set item time to 2 frames while we are used player.itemAnimation = 2; // Set item animation time to 2 frames while we are used - player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * dir, projectile.velocity.X * dir); // Set the item rotation to where we are shooting + player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * dir, Projectile.velocity.X * dir); // Set the item rotation to where we are shooting } private void CastLights() { // Cast a light along the line of the laser DelegateMethods.v3_1 = new Vector3(0.8f, 0.8f, 1f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * (Distance - MOVE_DISTANCE), 26, DelegateMethods.CastLight); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * (Distance - MOVE_DISTANCE), 26, DelegateMethods.CastLight); } public override bool ShouldUpdatePosition() => false; @@ -275,8 +276,8 @@ namespace CalamityMod.Projectiles.Magic public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * Distance, (projectile.width + 16) * projectile.scale, DelegateMethods.CutTiles); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Distance, (Projectile.width + 16) * Projectile.scale, DelegateMethods.CutTiles); } } } diff --git a/Projectiles/Magic/SpiritCongregation.cs b/Projectiles/Magic/SpiritCongregation.cs index c55910c8b6..ec920cb475 100644 --- a/Projectiles/Magic/SpiritCongregation.cs +++ b/Projectiles/Magic/SpiritCongregation.cs @@ -7,21 +7,22 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class SpiritCongregation : ModProjectile { public Vector2 HoverOffset = Vector2.Zero; - public ref float Time => ref projectile.ai[0]; - public ref float BaseDamage => ref projectile.ai[1]; - public ref float DeathCounter => ref projectile.localAI[0]; + public ref float Time => ref Projectile.ai[0]; + public ref float BaseDamage => ref Projectile.ai[1]; + public ref float DeathCounter => ref Projectile.localAI[0]; public bool WasStrongBefore { - get => projectile.localAI[1] == 1f; - set => projectile.localAI[1] = value.ToInt(); + get => Projectile.localAI[1] == 1f; + set => Projectile.localAI[1] = value.ToInt(); } - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public float CurrentPower => (float)Math.Pow(Utils.InverseLerp(15f, 840f, Time, true), 4D); public float CongregationDiameter => MathHelper.SmoothStep(54f, 185f, CurrentPower); public float MovementSpeed @@ -44,21 +45,21 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Spirit Monster"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; } public override void SetDefaults() { - projectile.width = projectile.height = 108; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.magic = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.timeLeft = 90000; + Projectile.width = Projectile.height = 108; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; + Projectile.timeLeft = 90000; } public override void SendExtraAI(BinaryWriter writer) @@ -80,59 +81,59 @@ namespace CalamityMod.Projectiles.Magic { DeathCounter++; if (DeathCounter >= 35f) - projectile.Kill(); - projectile.scale = 1f - DeathCounter / 35f; - projectile.velocity *= 0.98f; + Projectile.Kill(); + Projectile.scale = 1f - DeathCounter / 35f; + Projectile.velocity *= 0.98f; EmitGhostGas(); return; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { // Prepare for death prior to not being channeled. if (!Owner.channel) { DeathCounter = 1f; - projectile.netUpdate = true; + Projectile.netUpdate = true; return; } - Vector2 previousVelocity = projectile.velocity; + Vector2 previousVelocity = Projectile.velocity; // If not sufficiently close to the mouse, move towards it. - if (!projectile.WithinRange(Main.MouseWorld, 80f)) + if (!Projectile.WithinRange(Main.MouseWorld, 80f)) MoveTowardsMouse(); // Otherwise slow down to a point. - else if (projectile.velocity.Length() > 4f) - projectile.velocity *= 0.95f; + else if (Projectile.velocity.Length() > 4f) + Projectile.velocity *= 0.95f; // Sync velocity if it changed from what it was before. - if (previousVelocity != projectile.velocity) + if (previousVelocity != Projectile.velocity) { - projectile.netSpam = 0; - projectile.netUpdate = true; + Projectile.netSpam = 0; + Projectile.netUpdate = true; } } - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); // Handle dynamic damage. if (BaseDamage == 0f) - BaseDamage = projectile.damage; + BaseDamage = Projectile.damage; else { float damageBoostFactor = MathHelper.SmoothStep(1f, 3.3f, CurrentPower); - projectile.damage = (int)(BaseDamage * damageBoostFactor); + Projectile.damage = (int)(BaseDamage * damageBoostFactor); } // Increment the timer on the final extra update. - if (projectile.FinalExtraUpdate()) + if (Projectile.FinalExtraUpdate()) Time++; // Set the hover offset to a zero vector after enough time has passed and the projectile is powerful/tame enough. bool tame = CurrentPower > 0.97f; - projectile.hostile = !tame && Time > 75f; + Projectile.hostile = !tame && Time > 75f; if (tame) { if (HoverOffset != Vector2.Zero) @@ -149,7 +150,7 @@ namespace CalamityMod.Projectiles.Magic burstDirectionVariance += j * 2; for (int k = 0; k < 40; k++) { - Dust burstDust = Dust.NewDustPerfect(projectile.Center, 267); + Dust burstDust = Dust.NewDustPerfect(Projectile.Center, 267); burstDust.scale = Main.rand.NextFloat(1.74f, 2.5f); burstDust.position += Main.rand.NextVector2Circular(10f, 10f); burstDust.velocity = Main.rand.NextVector2Square(-burstDirectionVariance, burstDirectionVariance).SafeNormalize(Vector2.UnitY) * burstSpeed; @@ -158,26 +159,26 @@ namespace CalamityMod.Projectiles.Magic } burstSpeed += 1.8f; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { for (int i = 0; i < 25; i++) { Vector2 dustVelocity = Main.rand.NextVector2Circular(4f, 4f); - Projectile.NewProjectile(projectile.Center, dustVelocity, ModContent.ProjectileType(), 0, 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, dustVelocity, ModContent.ProjectileType(), 0, 0f, Projectile.owner); } } - Main.PlaySound(SoundID.DD2_BetsyFlyingCircleAttack, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_BetsyFlyingCircleAttack, Projectile.Center); WasStrongBefore = true; } // Otherwise, if not tame, periodically define a new offset. // This determines where to fly to and adds unpredictability at first. - else if (Main.myPlayer == projectile.owner && Time % 55f == 54f) + else if (Main.myPlayer == Projectile.owner && Time % 55f == 54f) { float maxHoverOffset = MathHelper.SmoothStep(460f, 0f, CurrentPower); HoverOffset = Main.rand.NextVector2Unit() * Main.rand.NextFloat(0.6f, 1f) * maxHoverOffset; - projectile.netUpdate = true; + Projectile.netUpdate = true; } // Release spirits that fly towards the target @@ -193,33 +194,33 @@ namespace CalamityMod.Projectiles.Magic // Make inertia become more significant the more power the congregation has, due to growing size. float inertia = MathHelper.Lerp(18f, 40f, CurrentPower); - Vector2 directionToMouseOffset = projectile.SafeDirectionTo(Main.MouseWorld + HoverOffset); - Vector2 directionToOwner = projectile.SafeDirectionTo(Owner.Center); + Vector2 directionToMouseOffset = Projectile.SafeDirectionTo(Main.MouseWorld + HoverOffset); + Vector2 directionToOwner = Projectile.SafeDirectionTo(Owner.Center); Vector2 idealVelocity = Vector2.Lerp(directionToMouseOffset, directionToOwner, 0.25f) * MovementSpeed; // Approach the ideal velocity. - projectile.velocity = projectile.velocity.MoveTowards(idealVelocity, MovementSpeed * 0.04f); - projectile.velocity = (projectile.velocity * (inertia - 1f) + idealVelocity) / inertia; + Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, MovementSpeed * 0.04f); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + idealVelocity) / inertia; } public void ReleaseSmallSpirits() { - if (projectile.WithinRange(Owner.Center, 230f) || Time % 45f != 44f) + if (Projectile.WithinRange(Owner.Center, 230f) || Time % 45f != 44f) return; - Main.PlaySound(SoundID.DD2_EtherianPortalSpawnEnemy, projectile.Center); - if (Main.myPlayer == projectile.owner) + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalSpawnEnemy, Projectile.Center); + if (Main.myPlayer == Projectile.owner) { Vector2 spiritVelocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(7f, 10f); - Projectile.NewProjectile(projectile.Center, spiritVelocity, ModContent.ProjectileType(), 70, 0f, projectile.owner, projectile.identity); + Projectile.NewProjectile(Projectile.Center, spiritVelocity, ModContent.ProjectileType(), 70, 0f, Projectile.owner, Projectile.identity); } } public void EmitGhostGas() { float particleSize = CongregationDiameter; - if (projectile.oldPosition != projectile.position && Time > 2f) - particleSize += (projectile.oldPosition - projectile.position).Length() * 4.2f; + if (Projectile.oldPosition != Projectile.position && Time > 2f) + particleSize += (Projectile.oldPosition - Projectile.position).Length() * 4.2f; // Place a hard limit on particle sizes. if (particleSize > 500f) @@ -232,61 +233,61 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < particleSpawnCount; i++) { // Summon a base particle. - Vector2 spawnPosition = projectile.Center + Main.rand.NextVector2Circular(1f, 1f) * particleSize / 26f; + Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Circular(1f, 1f) * particleSize / 26f; FusableParticleManager.GetParticleSetByType()?.SpawnParticle(spawnPosition, particleSize); // And an "ahead" particle that spawns based on current movement. // This causes the "head" of the overall thing to have bumps when moving. - spawnPosition += projectile.velocity.RotatedByRandom(1.38f) * particleSize / 105f; + spawnPosition += Projectile.velocity.RotatedByRandom(1.38f) * particleSize / 105f; FusableParticleManager.GetParticleSetByType()?.SpawnParticle(spawnPosition, particleSize * 0.4f); } // Release gas projectiles randomly. This does not happen when dying. - if (Main.myPlayer == projectile.owner && Main.rand.NextBool(16) && DeathCounter <= 0f) + if (Main.myPlayer == Projectile.owner && Main.rand.NextBool(16) && DeathCounter <= 0f) { - Vector2 dustVelocity = -projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(1.04f) * 1.5f; - Projectile.NewProjectile(projectile.Center, dustVelocity, ModContent.ProjectileType(), 0, 0f, projectile.owner); + Vector2 dustVelocity = -Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(1.04f) * 1.5f; + Projectile.NewProjectile(Projectile.Center, dustVelocity, ModContent.ProjectileType(), 0, 0f, Projectile.owner); } } public void UpdateFrames() { int maxFrame = CurrentPower <= LargeMouthPowerLowerBound ? 6 : 9; - projectile.frameCounter++; - projectile.frame = projectile.frameCounter / 5 % maxFrame; + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % maxFrame; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { int maxFrame = CurrentPower <= LargeMouthPowerLowerBound ? 6 : 9; Vector2 backgroundOffset = Vector2.UnitX * Main.GlobalTime * maxFrame * 0.03f; - Texture2D texture = Main.projectileTexture[projectile.type]; - Texture2D backTexture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/SpiritCongregationBack"); - Texture2D auraTexture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/SpiritCongregationAura"); - Texture2D backgroundTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer1"); + Texture2D texture = Main.projectileTexture[Projectile.type]; + Texture2D backTexture = ModContent.Request("CalamityMod/Projectiles/Magic/SpiritCongregationBack"); + Texture2D auraTexture = ModContent.Request("CalamityMod/Projectiles/Magic/SpiritCongregationAura"); + Texture2D backgroundTexture = ModContent.Request("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer1"); if (CurrentPower > LargeMouthPowerLowerBound) { - texture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/SpiritCongregationBig"); - backTexture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/SpiritCongregationBackBig"); - auraTexture = ModContent.GetTexture("CalamityMod/Projectiles/Magic/SpiritCongregationAuraBig"); + texture = ModContent.Request("CalamityMod/Projectiles/Magic/SpiritCongregationBig"); + backTexture = ModContent.Request("CalamityMod/Projectiles/Magic/SpiritCongregationBackBig"); + auraTexture = ModContent.Request("CalamityMod/Projectiles/Magic/SpiritCongregationAuraBig"); } Effect shader = GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"].Shader; - float offsetFactor = projectile.scale * ((CongregationDiameter - 54f) / 90f + 1.5f); + float offsetFactor = Projectile.scale * ((CongregationDiameter - 54f) / 90f + 1.5f); offsetFactor *= texture.Width / 90f; - Vector2 drawPosition = projectile.Center - Main.screenPosition + projectile.rotation.ToRotationVector2() * offsetFactor * 15f; - Rectangle frame = texture.Frame(1, maxFrame, 0, projectile.frame); + Vector2 drawPosition = Projectile.Center - Main.screenPosition + Projectile.rotation.ToRotationVector2() * offsetFactor * 15f; + Rectangle frame = texture.Frame(1, maxFrame, 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; Color auraColor = Color.Lerp(Color.Fuchsia, Color.Black, 0.55f); - SpriteEffects direction = Math.Cos(projectile.rotation) > 0f ? SpriteEffects.None : SpriteEffects.FlipVertically; + SpriteEffects direction = Math.Cos(Projectile.rotation) > 0f ? SpriteEffects.None : SpriteEffects.FlipVertically; // Draw the outline aura below everything else. spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); ; for (int i = 0; i < 3; i++) - spriteBatch.Draw(auraTexture, drawPosition, frame, auraColor, projectile.rotation, origin, projectile.scale, direction, 0f); + spriteBatch.Draw(auraTexture, drawPosition, frame, auraColor, Projectile.rotation, origin, Projectile.scale, direction, 0f); spriteBatch.ExitShaderRegion(); @@ -303,8 +304,8 @@ namespace CalamityMod.Projectiles.Magic shader.Parameters["renderTargetArea"].SetValue(backTexture.Size()); shader.Parameters["invertedScreen"].SetValue(Main.LocalPlayer.gravDir == -1f); shader.Parameters["generalBackgroundOffset"].SetValue(backgroundOffset); - shader.Parameters["uWorldPosition"].SetValue(projectile.position); - shader.Parameters["uRotation"].SetValue(projectile.rotation); + shader.Parameters["uWorldPosition"].SetValue(Projectile.position); + shader.Parameters["uRotation"].SetValue(Projectile.rotation); shader.Parameters["uTime"].SetValue(Main.GlobalTime); shader.Parameters["upscaleFactor"].SetValue(new Vector2(Main.screenWidth, Main.screenHeight) / backTexture.Size() / maxFrame); @@ -315,10 +316,10 @@ namespace CalamityMod.Projectiles.Magic shader.CurrentTechnique.Passes[0].Apply(); // Draw the normal texture. - spriteBatch.Draw(backTexture, drawPosition, frame, Color.White, projectile.rotation, origin, projectile.scale, direction, 0f); + spriteBatch.Draw(backTexture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, direction, 0f); spriteBatch.ExitShaderRegion(); - spriteBatch.Draw(texture, drawPosition, frame, Color.White, projectile.rotation, origin, projectile.scale, direction, 0f); + spriteBatch.Draw(texture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, direction, 0f); return false; } @@ -330,11 +331,11 @@ namespace CalamityMod.Projectiles.Magic public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - for (int i = 0; i < projectile.oldPos.Length; i++) + for (int i = 0; i < Projectile.oldPos.Length; i++) { - float hitboxRadius = CongregationDiameter * MathHelper.Lerp(0.45f, 0.17f, i / (float)projectile.oldPos.Length) * 1.4f; + float hitboxRadius = CongregationDiameter * MathHelper.Lerp(0.45f, 0.17f, i / (float)Projectile.oldPos.Length) * 1.4f; Vector2 hitboxCircle = Vector2.One * hitboxRadius; - if (CalamityUtils.CircularHitboxCollision(projectile.oldPos[i] + hitboxCircle * 0.5f, hitboxRadius, targetHitbox)) + if (CalamityUtils.CircularHitboxCollision(Projectile.oldPos[i] + hitboxCircle * 0.5f, hitboxRadius, targetHitbox)) return true; } return false; diff --git a/Projectiles/Magic/SpiritDust.cs b/Projectiles/Magic/SpiritDust.cs index c863b60559..ff2235a91b 100644 --- a/Projectiles/Magic/SpiritDust.cs +++ b/Projectiles/Magic/SpiritDust.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 60; + Projectile.width = Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 60; } public override void AI() { - float radius = MathHelper.SmoothStep(80f, 48f, 1f - projectile.timeLeft / 90f); - Vector2 spawnPosition = projectile.Center + Main.rand.NextVector2Circular(5f, 5f) * radius / 130f; + float radius = MathHelper.SmoothStep(80f, 48f, 1f - Projectile.timeLeft / 90f); + Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Circular(5f, 5f) * radius / 130f; FusableParticleManager.GetParticleSetByType()?.SpawnParticle(spawnPosition, radius); } } diff --git a/Projectiles/Magic/SpiritFlameCurse.cs b/Projectiles/Magic/SpiritFlameCurse.cs index 065747e2b9..e9685003f6 100644 --- a/Projectiles/Magic/SpiritFlameCurse.cs +++ b/Projectiles/Magic/SpiritFlameCurse.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -10,57 +11,57 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 8; + Main.projFrames[Projectile.type] = 8; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.magic = true; - projectile.coldDamage = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; + Projectile.coldDamage = true; } public override void AI() { - projectile.alpha -= 3; - if (projectile.alpha <= 0) + Projectile.alpha -= 3; + if (Projectile.alpha <= 0) { - projectile.Kill(); + Projectile.Kill(); } - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.velocity.X *= 0.975f; + Projectile.velocity.Y *= 0.975f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 7) + if (Projectile.frame > 7) { - projectile.frame = 0; + Projectile.frame = 0; } - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.5f); + Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0.5f); } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 160; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 160; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -70,10 +71,10 @@ namespace CalamityMod.Projectiles.Magic } for (int num623 = 0; num623 < 35; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Magic/Starblast.cs b/Projectiles/Magic/Starblast.cs index 74d50123f3..2aeb99d352 100644 --- a/Projectiles/Magic/Starblast.cs +++ b/Projectiles/Magic/Starblast.cs @@ -11,44 +11,44 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.magic = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.velocity.Y = projectile.velocity.Y + 0.1f; - projectile.velocity.X = projectile.velocity.X * 1.025f; - projectile.alpha -= 23; - projectile.scale = 0.8f * (255f - (float)projectile.alpha) / 255f; - if (projectile.alpha < 0) + Projectile.velocity.Y = Projectile.velocity.Y + 0.1f; + Projectile.velocity.X = Projectile.velocity.X * 1.025f; + Projectile.alpha -= 23; + Projectile.scale = 0.8f * (255f - (float)Projectile.alpha) / 255f; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } - if (projectile.alpha >= 255 && projectile.ai[0] > 5f) + if (Projectile.alpha >= 255 && Projectile.ai[0] > 5f) { - projectile.Kill(); + Projectile.Kill(); } if (Main.rand.NextBool(4)) { - int num193 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1f); - Main.dust[num193].position = projectile.Center; + int num193 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); + Main.dust[num193].position = Projectile.Center; Main.dust[num193].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num193].noGravity = true; Dust expr_835F_cp_0 = Main.dust[num193]; @@ -56,8 +56,8 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool(6)) { - int num194 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 176, 0f, 0f, 100, default, 1f); - Main.dust[num194].position = projectile.Center; + int num194 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 176, 0f, 0f, 100, default, 1f); + Main.dust[num194].position = Projectile.Center; Main.dust[num194].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num194].noGravity = true; Main.dust[num194].velocity *= 0.1f; @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -74,8 +74,8 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 176, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 180, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 176, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 180, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Magic/StardustElementalBeam.cs b/Projectiles/Magic/StardustElementalBeam.cs index 910f62b98a..6023059580 100644 --- a/Projectiles/Magic/StardustElementalBeam.cs +++ b/Projectiles/Magic/StardustElementalBeam.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.Magic public override float MaxLaserLength => 1000f; public override float Lifetime => 30f; public override Color LightCastColor => Color.White; - public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); - public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); - public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); public override void SetStaticDefaults() { @@ -24,40 +24,40 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = projectile.height = 20; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 13; - projectile.tileCollide = false; - projectile.timeLeft = (int)Lifetime; + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 13; + Projectile.tileCollide = false; + Projectile.timeLeft = (int)Lifetime; } public override void ExtraBehavior() { // Generate 2 stars from the side. - if (Main.myPlayer == projectile.owner && Time == 5f) + if (Main.myPlayer == Projectile.owner && Time == 5f) { int type = ModContent.ProjectileType(); - int damage = (int)(projectile.damage * 0.75); + int damage = (int)(Projectile.damage * 0.75); for (int i = 0; i < 2; i++) { - Vector2 starSpeed = projectile.velocity.RotatedBy(MathHelper.PiOver2 * i) * 5f; - Projectile.NewProjectile(projectile.Center, starSpeed, type, damage, projectile.knockBack, projectile.owner); + Vector2 starSpeed = Projectile.velocity.RotatedBy(MathHelper.PiOver2 * i) * 5f; + Projectile.NewProjectile(Projectile.Center, starSpeed, type, damage, Projectile.knockBack, Projectile.owner); } } } - public override void DetermineScale() => projectile.scale = projectile.timeLeft / Lifetime * MaxScale; + public override void DetermineScale() => Projectile.scale = Projectile.timeLeft / Lifetime * MaxScale; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - DrawBeamWithColor(spriteBatch, Color.Lerp(Color.CornflowerBlue * 1.1f, Color.Transparent, 0.3f), projectile.scale); - DrawBeamWithColor(spriteBatch, Color.Lerp(Color.Cyan, Color.Transparent, 0.3f), projectile.scale * 0.5f); - DrawBeamWithColor(spriteBatch, Color.Lerp(Color.White, Color.Transparent, 0.3f), projectile.scale * 0.2f); + DrawBeamWithColor(spriteBatch, Color.Lerp(Color.CornflowerBlue * 1.1f, Color.Transparent, 0.3f), Projectile.scale); + DrawBeamWithColor(spriteBatch, Color.Lerp(Color.Cyan, Color.Transparent, 0.3f), Projectile.scale * 0.5f); + DrawBeamWithColor(spriteBatch, Color.Lerp(Color.White, Color.Transparent, 0.3f), Projectile.scale * 0.2f); return false; } @@ -72,12 +72,12 @@ namespace CalamityMod.Projectiles.Magic float spawnOffsetSpread = Main.rand.NextFloat(MathHelper.ToRadians(36f), MathHelper.ToRadians(64f)); float baseOffsetAngle = Main.rand.NextFloat(-0.6f, 0.6f); int type = ModContent.ProjectileType(); - damage = (int)(projectile.damage * 0.7); + damage = (int)(Projectile.damage * 0.7); for (int i = 0; i < 4; i++) { float spawnOffsetAngle = MathHelper.Lerp(spawnOffsetSpread * -0.5f, spawnOffsetSpread * 0.5f, i / 4f) + baseOffsetAngle; Vector2 spawnPosition = target.Top - Vector2.UnitY.RotatedBy(spawnOffsetAngle) * 65f; - Projectile.NewProjectile(spawnPosition, -Vector2.UnitY.RotatedBy(spawnOffsetAngle) * 2f, type, damage, knockback, projectile.owner); + Projectile.NewProjectile(spawnPosition, -Vector2.UnitY.RotatedBy(spawnOffsetAngle) * 2f, type, damage, knockback, Projectile.owner); } } } diff --git a/Projectiles/Magic/StickyFeather.cs b/Projectiles/Magic/StickyFeather.cs index fe2ed42193..0661e5b1cc 100644 --- a/Projectiles/Magic/StickyFeather.cs +++ b/Projectiles/Magic/StickyFeather.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -11,19 +12,19 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Feather"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.magic = true; - projectile.aiStyle = 93; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; + Projectile.aiStyle = 93; aiType = ProjectileID.NailFriendly; } @@ -31,27 +32,27 @@ namespace CalamityMod.Projectiles.Magic { if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 206, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 1; + target.immune[Projectile.owner] = 1; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -61,17 +62,17 @@ namespace CalamityMod.Projectiles.Magic } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/StratusSphereProj.cs b/Projectiles/Magic/StratusSphereProj.cs index 271e4eb865..3a73ff0c89 100644 --- a/Projectiles/Magic/StratusSphereProj.cs +++ b/Projectiles/Magic/StratusSphereProj.cs @@ -12,74 +12,74 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Stratus Sphere"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.hostile = false; - projectile.friendly = true; - projectile.aiStyle = -1; - projectile.width = 314; - projectile.height = 198; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.knockBack = 0; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.magic = true; + Projectile.hostile = false; + Projectile.friendly = true; + Projectile.aiStyle = -1; + Projectile.width = 314; + Projectile.height = 198; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.knockBack = 0; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.DamageType = DamageClass.Magic; } public override Color? GetAlpha(Color lightColor) { - return new Color(230, 230, 255, projectile.alpha); + return new Color(230, 230, 255, Projectile.alpha); } public override void AI() { - projectile.ai[0]++; + Projectile.ai[0]++; - if (projectile.ai[0] < 200) + if (Projectile.ai[0] < 200) { - if (projectile.ai[0] > 100) + if (Projectile.ai[0] > 100) { - projectile.velocity.X = projectile.velocity.X * 40 / 41; - projectile.velocity.Y = projectile.velocity.Y * 45 / 46 - 0.005f; + Projectile.velocity.X = Projectile.velocity.X * 40 / 41; + Projectile.velocity.Y = Projectile.velocity.Y * 45 / 46 - 0.005f; } } else { - projectile.velocity.X = projectile.velocity.X * 10 / 11; - projectile.velocity.Y = projectile.velocity.Y * 10 / 11; + Projectile.velocity.X = Projectile.velocity.X * 10 / 11; + Projectile.velocity.Y = Projectile.velocity.Y * 10 / 11; if (roundsGone <= 4) - projectile.ai[1]++; + Projectile.ai[1]++; int rand = Main.rand.Next(-50, 51); int rand2 = Main.rand.Next(-50, 51); - Vector2 targetDir = projectile.Center + new Vector2(rand, rand2); - if (projectile.ai[1] > 40) - Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(targetDir) * 12f, ModContent.ProjectileType(), projectile.damage / 2, 0.4f, projectile.owner, projectile.whoAmI); + Vector2 targetDir = Projectile.Center + new Vector2(rand, rand2); + if (Projectile.ai[1] > 40) + Projectile.NewProjectile(Projectile.Center, Projectile.SafeDirectionTo(targetDir) * 12f, ModContent.ProjectileType(), Projectile.damage / 2, 0.4f, Projectile.owner, Projectile.whoAmI); - if (projectile.ai[1] > 46) + if (Projectile.ai[1] > 46) { - projectile.ai[1] = 0; + Projectile.ai[1] = 0; roundsGone++; } - if (roundsGone > 4 && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] == 0) - projectile.Kill(); + if (roundsGone > 4 && Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] == 0) + Projectile.Kill(); } - projectile.frameCounter++; - if (projectile.frameCounter >= 4) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 4) { - projectile.frame++; - projectile.frameCounter = 0; - if (projectile.frame >= 6) + Projectile.frame++; + Projectile.frameCounter = 0; + if (Projectile.frame >= 6) { - projectile.frame = 0; + Projectile.frame = 0; } } @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Magic { Dust dust; // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. - Vector2 position = projectile.Center; + Vector2 position = Projectile.Center; dust = Main.dust[Terraria.Dust.NewDust(position, 0, 0, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.7236842f)]; } @@ -98,9 +98,9 @@ namespace CalamityMod.Projectiles.Magic int num20 = 36; for (int i = 0; i < num20; i++) { - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f * 0.5f; - spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + projectile.Center; - Vector2 vector = spinningpoint - projectile.Center; + Vector2 spinningpoint = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f * 0.5f; + spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + Projectile.Center; + Vector2 vector = spinningpoint - Projectile.Center; int num21 = Dust.NewDust(spinningpoint + vector, 0, 0, 226, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 0.7236842f); Main.dust[num21].noGravity = true; Main.dust[num21].noLight = true; @@ -116,16 +116,16 @@ namespace CalamityMod.Projectiles.Magic { Dust dust; // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. - Vector2 position = projectile.Center - new Vector2(34, 34); + Vector2 position = Projectile.Center - new Vector2(34, 34); dust = Main.dust[Terraria.Dust.NewDust(position, 68, 68, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.7236842f)]; } int num20 = 36; for (int i = 0; i < num20; i++) { - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f * 0.5f; - spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + projectile.Center; - Vector2 vector = spinningpoint - projectile.Center; + Vector2 spinningpoint = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f * 0.5f; + spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + Projectile.Center; + Vector2 vector = spinningpoint - Projectile.Center; int num21 = Dust.NewDust(spinningpoint + vector, 0, 0, 226, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 0.7236842f); Main.dust[num21].noGravity = true; Main.dust[num21].noLight = true; diff --git a/Projectiles/Magic/SubsumingTentacle.cs b/Projectiles/Magic/SubsumingTentacle.cs index be24d5a944..7e5123ca03 100644 --- a/Projectiles/Magic/SubsumingTentacle.cs +++ b/Projectiles/Magic/SubsumingTentacle.cs @@ -10,16 +10,16 @@ namespace CalamityMod.Projectiles.Magic { public int AlphaFade { - get => (int)projectile.localAI[0]; - set => projectile.localAI[0] = value; + get => (int)Projectile.localAI[0]; + set => Projectile.localAI[0] = value; } public Vector2 OffsetAcceleration { - get => new Vector2(projectile.ai[0], projectile.ai[1]); + get => new Vector2(Projectile.ai[0], Projectile.ai[1]); set { - projectile.ai[0] = value.X; - projectile.ai[1] = value.Y; + Projectile.ai[0] = value.X; + Projectile.ai[1] = value.Y; } } public const float SegmentOffset = 5f; @@ -29,47 +29,47 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Exo Tentacle"); - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 75; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 75; } public override void SetDefaults() { - projectile.width = projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.MaxUpdates = 2; - projectile.magic = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.MaxUpdates = 2; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; } public override void AI() { - if (!projectile.tileCollide) + if (!Projectile.tileCollide) { AlphaFade++; - projectile.alpha = AlphaFade; - if (projectile.alpha >= 255) + Projectile.alpha = AlphaFade; + if (Projectile.alpha >= 255) { - projectile.Kill(); + Projectile.Kill(); return; } } // Here, the old positions act more like "control points" than old postions, and will be referred as such henceforth. // Each control point should have a set offset, to give a "chain" effect. - for (int i = 1; i < projectile.oldPos.Length; i++) + for (int i = 1; i < Projectile.oldPos.Length; i++) { - projectile.oldPos[i] = projectile.oldPos[i - 1] + Vector2.Normalize(projectile.oldPos[i] - projectile.oldPos[i - 1]) * SegmentOffset; + Projectile.oldPos[i] = Projectile.oldPos[i - 1] + Vector2.Normalize(Projectile.oldPos[i] - Projectile.oldPos[i - 1]) * SegmentOffset; } - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(20f * projectile.scale)); - if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height) && projectile.tileCollide) + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, (int)(20f * Projectile.scale)); + if (Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height) && Projectile.tileCollide) { - projectile.tileCollide = false; + Projectile.tileCollide = false; } - NPC closestTarget = projectile.Center.ClosestNPCAt(MaxEnemyDistance, true, true); + NPC closestTarget = Projectile.Center.ClosestNPCAt(MaxEnemyDistance, true, true); if (closestTarget != null) { HomingMovement(closestTarget); @@ -78,20 +78,20 @@ namespace CalamityMod.Projectiles.Magic { ArcingMovement(); } - projectile.scale -= closestTarget is null ? 0.007f : 0.004f; - if (projectile.scale <= 0.05f) + Projectile.scale -= closestTarget is null ? 0.007f : 0.004f; + if (Projectile.scale <= 0.05f) { - projectile.Kill(); + Projectile.Kill(); } } public void ArcingMovement() { // Cause the tentacle to arc around at an increasingly fast rate. - projectile.velocity += OffsetAcceleration; - if (projectile.velocity.Length() > MaxArcingSpeed) + Projectile.velocity += OffsetAcceleration; + if (Projectile.velocity.Length() > MaxArcingSpeed) { - projectile.velocity.Normalize(); - projectile.velocity *= MaxArcingSpeed; + Projectile.velocity.Normalize(); + Projectile.velocity *= MaxArcingSpeed; } // Accelerate the arc. @@ -99,13 +99,13 @@ namespace CalamityMod.Projectiles.Magic } public void HomingMovement(NPC closestTarget) { - float angleOffset = MathHelper.WrapAngle(projectile.AngleTo(closestTarget.Center) - projectile.velocity.ToRotation()); + float angleOffset = MathHelper.WrapAngle(Projectile.AngleTo(closestTarget.Center) - Projectile.velocity.ToRotation()); angleOffset = MathHelper.Clamp(angleOffset, -0.2f, 0.2f); - if (projectile.Distance(closestTarget.Center) > 65f) + if (Projectile.Distance(closestTarget.Center) > 65f) { - projectile.velocity = projectile.velocity.RotatedBy(angleOffset); - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * MaxHomingSpeed; + Projectile.velocity = Projectile.velocity.RotatedBy(angleOffset); + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * MaxHomingSpeed; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -113,21 +113,21 @@ namespace CalamityMod.Projectiles.Magic spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - if (projectile.scale < 1f) + if (Projectile.scale < 1f) { - for (int i = 10; i < projectile.oldPos.Length; i++) + for (int i = 10; i < Projectile.oldPos.Length; i++) { var tentacleShader = GameShaders.Misc["CalamityMod:SubsumingTentacle"]; tentacleShader.UseImage("Images/Misc/Perlin"); - Vector2 drawPos = projectile.oldPos[i] + ModContent.GetTexture(Texture).Size() / 2f - Main.screenPosition + projectile.gfxOffY * Vector2.UnitY; - float scale = MathHelper.Lerp(0.05f, 1.3f, i / (float)projectile.oldPos.Length) * projectile.scale; + Vector2 drawPos = Projectile.oldPos[i] + ModContent.Request(Texture).Size() / 2f - Main.screenPosition + Projectile.gfxOffY * Vector2.UnitY; + float scale = MathHelper.Lerp(0.05f, 1.3f, i / (float)Projectile.oldPos.Length) * Projectile.scale; scale = MathHelper.Clamp(scale, 0f, 2f); - Color color = projectile.GetAlpha(lightColor) * ((projectile.oldPos.Length - i) / projectile.oldPos.Length); + Color color = Projectile.GetAlpha(lightColor) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); - spriteBatch.Draw(ModContent.GetTexture(Texture), drawPos, null, color, projectile.rotation, ModContent.GetTexture(Texture).Size() / 2f, scale, SpriteEffects.None, 0f); - tentacleShader.UseSaturation(i / (float)projectile.oldPos.Length); // A "completion ratio" for the shader. Used to make the entire tentacle appear multi-colored. - tentacleShader.UseOpacity(1f / projectile.oldPos.Length); // A "step value" for the shader. Used to give variance in color at each individual segment. + spriteBatch.Draw(ModContent.Request(Texture), drawPos, null, color, Projectile.rotation, ModContent.Request(Texture).Size() / 2f, scale, SpriteEffects.None, 0f); + tentacleShader.UseSaturation(i / (float)Projectile.oldPos.Length); // A "completion ratio" for the shader. Used to make the entire tentacle appear multi-colored. + tentacleShader.UseOpacity(1f / Projectile.oldPos.Length); // A "step value" for the shader. Used to give variance in color at each individual segment. tentacleShader.Apply(null); } } @@ -141,10 +141,10 @@ namespace CalamityMod.Projectiles.Magic public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - for (int i = 1; i < projectile.oldPos.Length; i++) + for (int i = 1; i < Projectile.oldPos.Length; i++) { - float scale = MathHelper.Lerp(0.05f, 1f, i / (float)projectile.oldPos.Length) * projectile.scale * 0.85f; - if (targetHitbox.Intersects(new Rectangle((int)projectile.oldPos[i].X, (int)projectile.oldPos[i].Y, (int)(projectile.width * scale), (int)(projectile.height * scale)))) + float scale = MathHelper.Lerp(0.05f, 1f, i / (float)Projectile.oldPos.Length) * Projectile.scale * 0.85f; + if (targetHitbox.Intersects(new Rectangle((int)Projectile.oldPos[i].X, (int)Projectile.oldPos[i].Y, (int)(Projectile.width * scale), (int)(Projectile.height * scale)))) return true; } return false; @@ -152,7 +152,7 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.velocity = oldVelocity; + Projectile.velocity = oldVelocity; return false; } } diff --git a/Projectiles/Magic/SupremeDustFlakProjectile.cs b/Projectiles/Magic/SupremeDustFlakProjectile.cs index 2005850339..7527dc7c58 100644 --- a/Projectiles/Magic/SupremeDustFlakProjectile.cs +++ b/Projectiles/Magic/SupremeDustFlakProjectile.cs @@ -12,40 +12,40 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = 2; - projectile.extraUpdates = 3; - projectile.timeLeft = 100; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 2; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 100; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.3f / 255f, (255 - projectile.alpha) * 0.01f / 255f); - if (projectile.ai[0] > 7f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + if (Projectile.ai[0] > 7f) { float num296 = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { num296 = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { num296 = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num297 = 32; for (int num298 = 0; num298 < 2; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Magic } for (int num298 = 0; num298 < 2; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { @@ -84,14 +84,14 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[Projectile.owner] = 6; } } } diff --git a/Projectiles/Magic/SupremeDustProjectile.cs b/Projectiles/Magic/SupremeDustProjectile.cs index 504f371303..f34b511be7 100644 --- a/Projectiles/Magic/SupremeDustProjectile.cs +++ b/Projectiles/Magic/SupremeDustProjectile.cs @@ -12,38 +12,38 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 200; - projectile.height = 200; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = 4; - projectile.extraUpdates = 3; - projectile.timeLeft = 200; + Projectile.width = 200; + Projectile.height = 200; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 4; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 200; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.95f / 255f, (255 - projectile.alpha) * 0.85f / 255f, (255 - projectile.alpha) * 0.01f / 255f); - if (projectile.ai[0] > 7f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.95f / 255f, (255 - Projectile.alpha) * 0.85f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + if (Projectile.ai[0] > 7f) { float num296 = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { num296 = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { num296 = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num297 = 32; - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(2)) { @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Magic dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; dust.scale *= num296; - int num399 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num399 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust2 = Main.dust[num399]; if (Main.rand.NextBool(3)) { @@ -78,17 +78,17 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; - if (projectile.owner == Main.myPlayer) + target.immune[Projectile.owner] = 6; + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Magic/TacticiansElectricBoom.cs b/Projectiles/Magic/TacticiansElectricBoom.cs index 67180af85f..7152542944 100644 --- a/Projectiles/Magic/TacticiansElectricBoom.cs +++ b/Projectiles/Magic/TacticiansElectricBoom.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 100; - projectile.height = 100; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.magic = true; + Projectile.width = 100; + Projectile.height = 100; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - if (projectile.timeLeft >= 8) + if (Projectile.timeLeft >= 8) { for (int i = 0; i < 30; i++) { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic dustVelocity.Normalize(); dustVelocity *= 6; - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, dustVelocity.X, dustVelocity.Y, 0, default, 0.75f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, dustVelocity.X, dustVelocity.Y, 0, default, 0.75f); Main.dust[dust].noGravity = true; } } @@ -52,6 +52,6 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(BuffID.Electrified, 180); - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); } } diff --git a/Projectiles/Magic/TacticiansTrumpCardProj.cs b/Projectiles/Magic/TacticiansTrumpCardProj.cs index 7121309947..3111f37ad1 100644 --- a/Projectiles/Magic/TacticiansTrumpCardProj.cs +++ b/Projectiles/Magic/TacticiansTrumpCardProj.cs @@ -14,36 +14,36 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 3; + Projectile.timeLeft = 300; aiType = ProjectileID.LightBeam; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.extraUpdates = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.37f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.47f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.37f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.47f / 255f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 132, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 132, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 295) + if (Projectile.timeLeft > 295) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -51,18 +51,18 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 132, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 132, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner); } public override void OnHitPvp(Player target, int damage, bool crit) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner); } } } diff --git a/Projectiles/Magic/TearsofHeavenProjectile.cs b/Projectiles/Magic/TearsofHeavenProjectile.cs index 5aec44e4c2..b21b22039b 100644 --- a/Projectiles/Magic/TearsofHeavenProjectile.cs +++ b/Projectiles/Magic/TearsofHeavenProjectile.cs @@ -11,57 +11,57 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Tears of Heaven"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.timeLeft = 240; - projectile.light = 0.5f; - projectile.tileCollide = false; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 3; + Projectile.alpha = 255; + Projectile.timeLeft = 240; + Projectile.light = 0.5f; + Projectile.tileCollide = false; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; - int num96 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, 1f); + int num96 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, 1f); Main.dust[num96].noGravity = true; - int num102 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, 0f, 0f, 100, default, 1f); + int num102 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, 0f, 0f, 100, default, 1f); Main.dust[num102].noGravity = true; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 250f, 8f, 20f); - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[Projectile.owner] = 6; target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Magic/TerraBeam.cs b/Projectiles/Magic/TerraBeam.cs index f6e5c99754..39045f3ce6 100644 --- a/Projectiles/Magic/TerraBeam.cs +++ b/Projectiles/Magic/TerraBeam.cs @@ -12,11 +12,11 @@ namespace CalamityMod.Projectiles.Magic public override float MaxLaserLength => 1200f; public override float Lifetime => 30f; public override Color LightCastColor => Color.White; - public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); - public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); - public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); - public ref float ShardCooldown => ref projectile.ai[1]; + public ref float ShardCooldown => ref Projectile.ai[1]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { @@ -25,15 +25,15 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = projectile.height = 20; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - projectile.tileCollide = false; - projectile.timeLeft = (int)Lifetime; + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.tileCollide = false; + Projectile.timeLeft = (int)Lifetime; } public override void ExtraBehavior() @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Magic Color dustColor = Color.Lerp(Color.White, Color.YellowGreen, j / 12f); float dustScale = MathHelper.Lerp(1.6f, 0.85f, j / 12f); - Dust terraMagic = Dust.NewDustPerfect(projectile.Center, 107); + Dust terraMagic = Dust.NewDustPerfect(Projectile.Center, 107); terraMagic.velocity = angle.ToRotationVector2() * starSpeed; terraMagic.color = dustColor; terraMagic.scale = dustScale; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < ovalPoints; i++) { float angle = MathHelper.TwoPi * i / ovalPoints; - Dust terraMagic = Dust.NewDustPerfect(projectile.Center, 107); + Dust terraMagic = Dust.NewDustPerfect(Projectile.Center, 107); terraMagic.velocity = angle.ToRotationVector2() * 6f; terraMagic.scale = 1.1f; terraMagic.noGravity = true; @@ -74,12 +74,12 @@ namespace CalamityMod.Projectiles.Magic ShardCooldown--; } - public override void DetermineScale() => projectile.scale = projectile.timeLeft / Lifetime * MaxScale; + public override void DetermineScale() => Projectile.scale = Projectile.timeLeft / Lifetime * MaxScale; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - DrawBeamWithColor(spriteBatch, Color.Lime * 1.1f, projectile.scale); - DrawBeamWithColor(spriteBatch, Color.Yellow * 1.1f, projectile.scale * 0.5f); + DrawBeamWithColor(spriteBatch, Color.Lime * 1.1f, Projectile.scale); + DrawBeamWithColor(spriteBatch, Color.Yellow * 1.1f, Projectile.scale * 0.5f); return false; } @@ -91,11 +91,11 @@ namespace CalamityMod.Projectiles.Magic // The "Center" of the laser is actually the start of it in this context. // Collision is done separately. This might have a slight offset due to collision // boxes, but that should be negligible. - float lengthFromStart = projectile.Distance(target.Center); + float lengthFromStart = Projectile.Distance(target.Center); int totalShards = (int)MathHelper.Lerp(1, 4, MathHelper.Clamp(lengthFromStart / MaxLaserLength * 1.4f, 0f, 1f)); int shardType = ModContent.ProjectileType(); - int shardDamage = (int)(projectile.damage * 0.6); + int shardDamage = (int)(Projectile.damage * 0.6); for (int i = 0; i < totalShards; i++) { int tries = 0; @@ -107,11 +107,11 @@ namespace CalamityMod.Projectiles.Magic } while (Collision.SolidCollision((target.Center + spawnOffset).ToTileCoordinates().ToVector2(), 4, 4) && tries < 10); - Projectile.NewProjectile(target.Center + spawnOffset, Main.rand.NextVector2CircularEdge(6f, 6f), shardType, shardDamage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(target.Center + spawnOffset, Main.rand.NextVector2CircularEdge(6f, 6f), shardType, shardDamage, Projectile.knockBack, Projectile.owner); } ShardCooldown = 3f; - projectile.netUpdate = true; + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Magic/TerraShard.cs b/Projectiles/Magic/TerraShard.cs index ad5d9e241d..8c4d9ddc07 100644 --- a/Projectiles/Magic/TerraShard.cs +++ b/Projectiles/Magic/TerraShard.cs @@ -13,23 +13,23 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = projectile.height = 20; - projectile.friendly = true; - projectile.timeLeft = 60; - projectile.magic = true; - projectile.tileCollide = true; + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.timeLeft = 60; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = true; } public override void AI() { for (int i = 0; i < 4; i++) { - Dust terraMagic = Dust.NewDustDirect(projectile.Center, 1, 1, 107, 0f, 0f, 0, default, 0.5f); + Dust terraMagic = Dust.NewDustDirect(Projectile.Center, 1, 1, 107, 0f, 0f, 0, default, 0.5f); terraMagic.scale = 0.42f; terraMagic.velocity *= 0.1f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 15f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, false, 500f, 15f, 20f); } } } diff --git a/Projectiles/Magic/ThunderstormShot.cs b/Projectiles/Magic/ThunderstormShot.cs index 1dc453429c..c24d92d2ef 100644 --- a/Projectiles/Magic/ThunderstormShot.cs +++ b/Projectiles/Magic/ThunderstormShot.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class ThunderstormShot : ModProjectile @@ -15,31 +16,31 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.extraUpdates = 25; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 25; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 9f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 9f) { for (int num121 = 0; num121 < 5; num121++) { - Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; dust.velocity = Vector2.Zero; - dust.position -= projectile.velocity / 5f * (float)num121; + dust.position -= Projectile.velocity / 5f * (float)num121; dust.noGravity = true; dust.noLight = true; - Dust dust2 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + Dust dust2 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; dust2.velocity = Vector2.Zero; - dust2.position -= projectile.velocity / 5f * (float)num121; + dust2.position -= Projectile.velocity / 5f * (float)num121; dust2.noGravity = true; dust2.noLight = true; } @@ -48,18 +49,18 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item125, projectile.Center); + SoundEngine.PlaySound(SoundID.Item125, Projectile.Center); for (int n = 0; n < 5; n++) { - CalamityUtils.ProjectileRain(projectile.Center, 200f, 100f, 1500f, 1500f, 29f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + CalamityUtils.ProjectileRain(Projectile.Center, 200f, 100f, 1500f, 1500f, 29f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 36); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 36); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 1f; //0.75 - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 1f; //0.75 + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 229, vector7.X, vector7.Y, 100, default, 1.2f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; @@ -67,17 +68,17 @@ namespace CalamityMod.Projectiles.Magic } for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X, vector7.Y, 100, default, 1.2f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); } } } diff --git a/Projectiles/Magic/ThunderstormShotSplit.cs b/Projectiles/Magic/ThunderstormShotSplit.cs index 10abae89a6..6873dcdd75 100644 --- a/Projectiles/Magic/ThunderstormShotSplit.cs +++ b/Projectiles/Magic/ThunderstormShotSplit.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class ThunderstormShotSplit : ModProjectile @@ -15,36 +16,36 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.extraUpdates = 15; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 15; } public override void AI() { - if (projectile.timeLeft < 420) + if (Projectile.timeLeft < 420) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 6f) { for (int num121 = 0; num121 < 5; num121++) { - Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default, 0.5f)]; + Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 0.5f)]; dust.velocity = Vector2.Zero; - dust.position -= projectile.velocity / 5f * (float)num121; + dust.position -= Projectile.velocity / 5f * (float)num121; dust.noGravity = true; dust.noLight = true; - Dust dust2 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X, projectile.velocity.Y, 100, default, 0.5f)]; + Dust dust2 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 0.5f)]; dust2.velocity = Vector2.Zero; - dust2.position -= projectile.velocity / 5f * (float)num121; + dust2.position -= Projectile.velocity / 5f * (float)num121; dust2.noGravity = true; dust2.noLight = true; } @@ -53,17 +54,17 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item125, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 16; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item125, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 16; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; //0.75 - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; //0.75 + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 229, vector7.X, vector7.Y, 100, default, 0.6f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; @@ -71,15 +72,15 @@ namespace CalamityMod.Projectiles.Magic } for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.5f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X, vector7.Y, 100, default, 0.6f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.Damage(); + Projectile.Damage(); } } } diff --git a/Projectiles/Magic/TradewindsProjectile.cs b/Projectiles/Magic/TradewindsProjectile.cs index 52258a4191..53c6061cd9 100644 --- a/Projectiles/Magic/TradewindsProjectile.cs +++ b/Projectiles/Magic/TradewindsProjectile.cs @@ -12,60 +12,60 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Feather"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 600; - projectile.magic = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 64, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 64, 0f, 0f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - projectile.velocity *= 0.75f; + Projectile.velocity *= 0.75f; } return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.ai[0] += 0.1f; - projectile.velocity *= 0.75f; + Projectile.ai[0] += 0.1f; + Projectile.velocity *= 0.75f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/TridentIcicle.cs b/Projectiles/Magic/TridentIcicle.cs index 04f22f2014..8ab12efa31 100644 --- a/Projectiles/Magic/TridentIcicle.cs +++ b/Projectiles/Magic/TridentIcicle.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -10,16 +11,16 @@ namespace CalamityMod.Projectiles.Magic { public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.aiStyle = 1; + Projectile.width = 18; + Projectile.height = 18; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.friendly = true; - projectile.coldDamage = true; - projectile.magic = true; - projectile.penetrate = 2; - projectile.ignoreWater = true; - projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.coldDamage = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 2; + Projectile.ignoreWater = true; + Projectile.coldDamage = true; } public override void SetStaticDefaults() @@ -30,7 +31,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { //make pretty dust - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 88); Main.dust[index2].noGravity = true; } @@ -42,15 +43,15 @@ namespace CalamityMod.Projectiles.Magic public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int i = 0; i < 10; i++) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 88); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 2f; } diff --git a/Projectiles/Magic/UberBubble.cs b/Projectiles/Magic/UberBubble.cs index f03664e202..19fbb21704 100644 --- a/Projectiles/Magic/UberBubble.cs +++ b/Projectiles/Magic/UberBubble.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class UberBubble : ModProjectile @@ -13,28 +14,28 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.timeLeft = 30; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 30; } public override void AI() { - projectile.velocity *= 0.975f; + Projectile.velocity *= 0.975f; - if (projectile.alpha > 0) - projectile.alpha -= 30; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha > 0) + Projectile.alpha -= 30; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - Vector2 v2 = projectile.ai[0].ToRotationVector2(); - float num743 = projectile.velocity.ToRotation(); + Vector2 v2 = Projectile.ai[0].ToRotationVector2(); + float num743 = Projectile.velocity.ToRotation(); float num744 = v2.ToRotation(); double num745 = num744 - num743; if (num745 > MathHelper.Pi) @@ -42,24 +43,24 @@ namespace CalamityMod.Projectiles.Magic if (num745 < -MathHelper.Pi) num745 -= -MathHelper.TwoPi; - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item96, projectile.position); + SoundEngine.PlaySound(SoundID.Item96, Projectile.position); int num190 = Main.rand.Next(4, 6); for (int num191 = 0; num191 < num190; num191++) { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 171, 0f, 0f, 100, default, 1.4f); + int num192 = Dust.NewDust(Projectile.Center, 0, 0, 171, 0f, 0f, 100, default, 1.4f); Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, Projectile.Center, 0.5f); Main.dust[num192].noGravity = true; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int numBubbles = 0; numBubbles < 3; numBubbles++) - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * (Main.rand.NextFloat() * 2f), projectile.velocity.Y * (Main.rand.NextFloat() * 2f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * (Main.rand.NextFloat() * 2f), Projectile.velocity.Y * (Main.rand.NextFloat() * 2f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Magic/UndinesRetributionSpear.cs b/Projectiles/Magic/UndinesRetributionSpear.cs index ee9e332007..de1e8f9b64 100644 --- a/Projectiles/Magic/UndinesRetributionSpear.cs +++ b/Projectiles/Magic/UndinesRetributionSpear.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -13,73 +14,73 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Undine's Retribution"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 420; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.timeLeft = 420; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - float num953 = 25f * projectile.ai[1]; //100 - float scaleFactor12 = 5f * projectile.ai[1]; //5 + float num953 = 25f * Projectile.ai[1]; //100 + float scaleFactor12 = 5f * Projectile.ai[1]; //5 float num954 = 500f; - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } - Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.7f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + Lighting.AddLight(Projectile.Center, 0f, 0.1f, 0.7f); + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + if (Projectile.Distance(Main.player[Projectile.owner].Center) > num954) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 9f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 9f, 20f); } else { - if (projectile.timeLeft > 30) + if (Projectile.timeLeft > 30) { - projectile.timeLeft = 30; + Projectile.timeLeft = 30; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -90,27 +91,27 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); - Main.PlaySound(SoundID.Item21, projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item21, Projectile.position); for (int num193 = 0; num193 < 4; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 6; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } diff --git a/Projectiles/Magic/ValkyrieRayBeam.cs b/Projectiles/Magic/ValkyrieRayBeam.cs index d702c915b2..986f432d46 100644 --- a/Projectiles/Magic/ValkyrieRayBeam.cs +++ b/Projectiles/Magic/ValkyrieRayBeam.cs @@ -42,57 +42,57 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.alpha = 0; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.alpha = 0; // The beam itself still stops on tiles, but its invisible "source" projectile ignores them. - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; // The beam lasts for only some frames and fades out over that time. - projectile.timeLeft = Lifetime; + Projectile.timeLeft = Lifetime; } // projectile.ai[0] = Length of the beam (dynamically recalculated every frame in case someone breaks or places some blocks) public override void AI() { // If the projectile for some reason isn't still a Valkyrie Ray, delete it immediately. - if (projectile.type != ModContent.ProjectileType()) + if (Projectile.type != ModContent.ProjectileType()) { - projectile.Kill(); + Projectile.Kill(); return; } // On frame 1, set the beam vector and rotation, but set the real velocity to zero. - if(projectile.velocity != Vector2.Zero) + if(Projectile.velocity != Vector2.Zero) { - beamVector = Vector2.Normalize(projectile.velocity); - projectile.rotation = projectile.velocity.ToRotation(); - projectile.velocity = Vector2.Zero; + beamVector = Vector2.Normalize(Projectile.velocity); + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.velocity = Vector2.Zero; } // Reduce the "power" and thus scale of the projectile over its lifetime. - float power = (float)projectile.timeLeft / Lifetime; - projectile.scale = MaxBeamScale * power; + float power = (float)Projectile.timeLeft / Lifetime; + Projectile.scale = MaxBeamScale * power; // Perform a laser scan to calculate the correct length of the beam. float[] laserScanResults = new float[NumSamplePoints]; // A minimum width is forced for the beam scan to prevent massive lag when fired into open areas. - float scanWidth = projectile.scale < 1f ? 1f : projectile.scale; - Collision.LaserScan(projectile.Center, beamVector, BeamTileCollisionWidth * scanWidth, MaxBeamLength, laserScanResults); + float scanWidth = Projectile.scale < 1f ? 1f : Projectile.scale; + Collision.LaserScan(Projectile.Center, beamVector, BeamTileCollisionWidth * scanWidth, MaxBeamLength, laserScanResults); float avg = 0f; for (int i = 0; i < laserScanResults.Length; ++i) avg += laserScanResults[i]; avg /= NumSamplePoints; - projectile.ai[0] = MathHelper.Lerp(projectile.ai[0], avg, BeamLengthChangeFactor); + Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], avg, BeamLengthChangeFactor); // X = beam length. Y = beam width. - Vector2 beamDims = new Vector2(beamVector.Length() * projectile.ai[0], projectile.width * projectile.scale); + Vector2 beamDims = new Vector2(beamVector.Length() * Projectile.ai[0], Projectile.width * Projectile.scale); Color beamColor = GetBeamColor(); ProduceBeamDust(beamColor); @@ -103,16 +103,16 @@ namespace CalamityMod.Projectiles.Magic WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); // A universal time-based sinusoid which updates extremely rapidly. GlobalTime is 0 to 3600, measured in seconds. float waveSine = 0.1f * (float)Math.Sin(Main.GlobalTime * 20f); - Vector2 ripplePos = projectile.position + new Vector2(beamDims.X * 0.5f, 0f).RotatedBy(projectile.rotation); + Vector2 ripplePos = Projectile.position + new Vector2(beamDims.X * 0.5f, 0f).RotatedBy(Projectile.rotation); // WaveData is encoded as a Color. Not sure why, considering Vector3 exists. Color waveData = new Color(0.5f, 0.1f * Math.Sign(waveSine) + 0.5f, 0f, 1f) * Math.Abs(waveSine); - wsd.QueueRipple(ripplePos, waveData, beamDims, RippleShape.Square, projectile.rotation); + wsd.QueueRipple(ripplePos, waveData, beamDims, RippleShape.Square, Projectile.rotation); } // Make the beam cast light along its length. // v3_1 is an unnamed decompiled variable which is the color of the light cast by DelegateMethods.CastLight DelegateMethods.v3_1 = beamColor.ToVector3() * power * MaxBeamBrightness; - Utils.PlotTileLine(projectile.Center, projectile.Center + beamVector * projectile.ai[0], beamDims.Y, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + beamVector * Projectile.ai[0], beamDims.Y, new Utils.PerLinePoint(DelegateMethods.CastLight)); } // Determines whether the specified target hitbox is intersecting with the beam. @@ -123,13 +123,13 @@ namespace CalamityMod.Projectiles.Magic return true; // Otherwise, perform an AABB line collision check to check the whole beam. float _ = float.NaN; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + beamVector * projectile.ai[0], BeamHitboxCollisionWidth * projectile.scale, ref _); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + beamVector * Projectile.ai[0], BeamHitboxCollisionWidth * Projectile.scale, ref _); } // Ensure that the hit direction is correct when hitting enemies. public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - hitDirection = (projectile.Center.X < target.Center.X).ToDirectionInt(); + hitDirection = (Projectile.Center.X < target.Center.X).ToDirectionInt(); } private Color GetBeamColor() @@ -142,16 +142,16 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { // If the beam doesn't have a defined projection vector or hasn't yet had its velocity set to zero, don't draw anything. - if (beamVector == Vector2.Zero || projectile.velocity != Vector2.Zero) + if (beamVector == Vector2.Zero || Projectile.velocity != Vector2.Zero) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - float beamLength = projectile.ai[0]; - Vector2 centerFloored = projectile.Center.Floor() + beamVector * projectile.scale * BeamRenderTileOffset; - Vector2 scaleVec = new Vector2(projectile.scale); + Texture2D tex = Main.projectileTexture[Projectile.type]; + float beamLength = Projectile.ai[0]; + Vector2 centerFloored = Projectile.Center.Floor() + beamVector * Projectile.scale * BeamRenderTileOffset; + Vector2 scaleVec = new Vector2(Projectile.scale); // Reduce the beam length proportional to its square area to reduce block penetration. - beamLength -= BeamLengthReductionFactor * projectile.scale * projectile.scale; + beamLength -= BeamLengthReductionFactor * Projectile.scale * Projectile.scale; DelegateMethods.f_1 = 1f; // f_1 is an unnamed decompiled variable whose function is unknown. Leave it at 1. Vector2 beamStartPos = centerFloored - Main.screenPosition; @@ -161,7 +161,7 @@ namespace CalamityMod.Projectiles.Magic // Draw the outermost beam // c_1 is an unnamed decompiled variable which is the render color of the beam drawn by DelegateMethods.RainbowLaserDraw Color beamColor = GetBeamColor(); - DelegateMethods.c_1 = beamColor * OuterBeamOpacityMultiplier * projectile.Opacity; + DelegateMethods.c_1 = beamColor * OuterBeamOpacityMultiplier * Projectile.Opacity; Utils.DrawLaser(Main.spriteBatch, tex, beamStartPos, beamEndPos, scaleVec, llf); // Draw the inner beams, each with reduced size and whiter color @@ -169,7 +169,7 @@ namespace CalamityMod.Projectiles.Magic { beamColor = Color.Lerp(beamColor, Color.White, 0.4f); scaleVec *= 0.85f; - DelegateMethods.c_1 = beamColor * InnerBeamOpacityMultiplier * projectile.Opacity; + DelegateMethods.c_1 = beamColor * InnerBeamOpacityMultiplier * Projectile.Opacity; Utils.DrawLaser(Main.spriteBatch, tex, beamStartPos, beamEndPos, scaleVec, llf); } return false; @@ -178,11 +178,11 @@ namespace CalamityMod.Projectiles.Magic private void ProduceBeamDust(Color beamColor) { // Create a few dust per frame a small distance from where the beam ends. - Vector2 laserEndPos = projectile.Center + beamVector * (projectile.ai[0] - MainDustBeamEndOffset * projectile.scale); + Vector2 laserEndPos = Projectile.Center + beamVector * (Projectile.ai[0] - MainDustBeamEndOffset * Projectile.scale); for (int i = 0; i < 2; ++i) { // 50% chance for the dust to come off on either side of the beam. - float dustAngle = projectile.rotation + (Main.rand.NextBool() ? 1f : -1f) * MathHelper.PiOver2; + float dustAngle = Projectile.rotation + (Main.rand.NextBool() ? 1f : -1f) * MathHelper.PiOver2; float dustStartDist = Main.rand.NextFloat(1f, 1.8f); Vector2 dustVel = dustAngle.ToRotationVector2() * dustStartDist; int d = Dust.NewDust(laserEndPos, 0, 0, BeamDustID, dustVel.X, dustVel.Y, 0, beamColor); @@ -191,14 +191,14 @@ namespace CalamityMod.Projectiles.Magic Main.dust[d].scale = 0.7f; // Scale up dust with the projectile if it's large. - if (projectile.scale > 1f) + if (Projectile.scale > 1f) { - Main.dust[d].velocity *= projectile.scale; - Main.dust[d].scale *= projectile.scale; + Main.dust[d].velocity *= Projectile.scale; + Main.dust[d].scale *= Projectile.scale; } // If the beam isn't at max scale, then make additional smaller dust. - if (projectile.scale != MaxBeamScale) + if (Projectile.scale != MaxBeamScale) { Dust smallDust = Dust.CloneDust(d); smallDust.scale /= 2f; @@ -209,7 +209,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(5)) { // Velocity, flipped sideways, times -50% to 50% of beam width. - Vector2 dustOffset = beamVector.RotatedBy(MathHelper.PiOver2) * (Main.rand.NextFloat() - 0.5f) * projectile.width; + Vector2 dustOffset = beamVector.RotatedBy(MathHelper.PiOver2) * (Main.rand.NextFloat() - 0.5f) * Projectile.width; Vector2 dustPos = laserEndPos + dustOffset - Vector2.One * SidewaysDustBeamEndOffset; int d = Dust.NewDust(dustPos, 8, 8, BeamDustID, 0f, 0f, 100, beamColor, 1.2f); Main.dust[d].velocity *= 0.5f; @@ -225,9 +225,9 @@ namespace CalamityMod.Projectiles.Magic // tilecut_0 is an unnamed decompiled variable which tells CutTiles how the tiles are being cut (in this case, via a projectile). DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; Utils.PerLinePoint cut = new Utils.PerLinePoint(DelegateMethods.CutTiles); - Vector2 beamStartPos = projectile.Center; - Vector2 beamEndPos = beamStartPos + beamVector * projectile.ai[0]; - Utils.PlotTileLine(beamStartPos, beamEndPos, projectile.width * projectile.scale, cut); + Vector2 beamStartPos = Projectile.Center; + Vector2 beamEndPos = beamStartPos + beamVector * Projectile.ai[0]; + Utils.PlotTileLine(beamStartPos, beamEndPos, Projectile.width * Projectile.scale, cut); } } } diff --git a/Projectiles/Magic/ValkyrieRayStaff.cs b/Projectiles/Magic/ValkyrieRayStaff.cs index 23d693ae49..49b5bfd92e 100644 --- a/Projectiles/Magic/ValkyrieRayStaff.cs +++ b/Projectiles/Magic/ValkyrieRayStaff.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -19,63 +20,63 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 54; - projectile.height = 52; + Projectile.width = 54; + Projectile.height = 52; // This projectile has no hitboxes and no damage type. - projectile.friendly = false; - projectile.melee = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 900; + Projectile.friendly = false; + // projectile.melee = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 900; } // ai[0] is a time-dilated frame counter. ai[1] is whether the beam has already fired. // localAI[0] is the rate at which the "frame" counter increases. public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true); // 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 / player.ActiveItem().useTime; + if (Projectile.localAI[0] == 0f) + 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]; + Projectile.ai[0] += Projectile.localAI[0]; int maxTime = ValkyrieRay.ChargeFrames + ValkyrieRay.CooldownFrames; - if (projectile.ai[0] > maxTime) + if (Projectile.ai[0] > maxTime) { - projectile.Kill(); + Projectile.Kill(); return; } // Compute the weapon's charge. - float chargeLevel = MathHelper.Clamp(projectile.ai[0] / ValkyrieRay.ChargeFrames, 0f, 1f); + float chargeLevel = MathHelper.Clamp(Projectile.ai[0] / ValkyrieRay.ChargeFrames, 0f, 1f); // Common code among holdouts to keep the holdout projectile directly in the player's hand UpdatePlayerVisuals(player, rrp); // Compute the gem position, which is needed for visual effects - float angle = projectile.rotation - MathHelper.PiOver2; + float angle = Projectile.rotation - MathHelper.PiOver2; Vector2 gemOffset = Vector2.One * ValkyrieRay.GemDistance * 1.4142f; // distance to gem on staff - Vector2 gemPos = projectile.Center + gemOffset.RotatedBy(angle); + Vector2 gemPos = Projectile.Center + gemOffset.RotatedBy(angle); // Firing or charging? - if (chargeLevel >= 1f && projectile.ai[1] == 0f) + if (chargeLevel >= 1f && Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; // so it never fires again + Projectile.ai[1] = 1f; // so it never fires again FiringEffects(gemPos); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile laser = Projectile.NewProjectileDirect(gemPos, projectile.velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile laser = Projectile.NewProjectileDirect(gemPos, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); laser.Center = gemPos; } } - else if (projectile.ai[1] == 0f) + else if (Projectile.ai[1] == 0f) { // The player can constantly re-aim the staff while it's charging, but once it fires it is locked in place. - UpdateAim(rrp, projectile.velocity.Length()); + UpdateAim(rrp, Projectile.velocity.Length()); ChargingEffects(gemPos, chargeLevel); } } @@ -83,17 +84,17 @@ namespace CalamityMod.Projectiles.Magic private void UpdatePlayerVisuals(Player player, Vector2 rrp) { // Place the projectile directly into the player's hand at all times - projectile.Center = rrp; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.Center = rrp; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; // The staff is a holdout projectile, so change the player's variables to reflect that - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; // Multiplying by projectile.direction is required due to vanilla spaghetti. - player.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + player.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } // Adjusts the aim vector of the staff to point towards the mouse. This is Last Prism code. @@ -102,12 +103,12 @@ namespace CalamityMod.Projectiles.Magic Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); if (aimVector.HasNaNs()) aimVector = -Vector2.UnitY; - aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(projectile.velocity), AimResponsiveness)); + aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(Projectile.velocity), AimResponsiveness)); aimVector *= 30f; - if (aimVector != projectile.velocity) - projectile.netUpdate = true; - projectile.velocity = aimVector; + if (aimVector != Projectile.velocity) + Projectile.netUpdate = true; + Projectile.velocity = aimVector; } private void ChargingEffects(Vector2 center, float chargeLevel) @@ -130,8 +131,8 @@ namespace CalamityMod.Projectiles.Magic private void FiringEffects(Vector2 center) { - Main.PlaySound(SoundID.Item28, center); - Main.PlaySound(SoundID.Item60, center); + SoundEngine.PlaySound(SoundID.Item28, center); + SoundEngine.PlaySound(SoundID.Item60, center); int numDust = 36; int dustID = 73; for (int i = 0; i < numDust; ++i) diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index 13dd38d96b..65422d3c60 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -7,35 +7,36 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class Vehemence : ModProjectile { - public ref float Time => ref projectile.ai[0]; - public Player Owner => Main.player[projectile.owner]; + public ref float Time => ref Projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { DisplayName.SetDefault("Blast of Vehemence"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 300; - projectile.magic = true; + Projectile.width = Projectile.height = 32; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - Lighting.AddLight(projectile.Center, Color.DarkRed.ToVector3()); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, Color.DarkRed.ToVector3()); if (Time == 0f) GenerateInitialBurstDust(); @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic { float angle = MathHelper.TwoPi * i / 40f; - Dust brimstoneMagic = Dust.NewDustPerfect(projectile.Center + projectile.velocity * 7f, 27); + Dust brimstoneMagic = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 7f, 27); brimstoneMagic.velocity = angle.ToRotationVector2() * 15f; brimstoneMagic.color = Color.Lerp(Color.Red, Color.MediumPurple, (float)Math.Sin(angle) * 0.5f + 0.5f); brimstoneMagic.scale = 1.6f; @@ -70,9 +71,9 @@ namespace CalamityMod.Projectiles.Magic for (int i = -1; i <= 1; i += 2) { float helixOffset = (float)Math.Sin(Time / 45f * MathHelper.TwoPi) * i * 8f; - Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation); + Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(Projectile.rotation); - Dust brimstoneMagic = Dust.NewDustPerfect(projectile.Center + spawnOffset, (int)CalamityDusts.Brimstone); + Dust brimstoneMagic = Dust.NewDustPerfect(Projectile.Center + spawnOffset, (int)CalamityDusts.Brimstone); brimstoneMagic.velocity = Vector2.Zero; brimstoneMagic.scale = 1.1f; brimstoneMagic.noGravity = true; @@ -81,13 +82,13 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item74, projectile.position); - if (Main.myPlayer == projectile.owner) + SoundEngine.PlaySound(SoundID.Item74, Projectile.position); + if (Main.myPlayer == Projectile.owner) { int skullID = ModContent.ProjectileType(); - int damage = (int)(projectile.damage * Vehemenc.SkullRatio); + int damage = (int)(Projectile.damage * Vehemenc.SkullRatio); for (int i = 0; i < 18; i++) - Projectile.NewProjectile(projectile.Center, Main.rand.NextVector2Circular(12f, 12f), skullID, damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Main.rand.NextVector2Circular(12f, 12f), skullID, damage, Projectile.knockBack, Projectile.owner); } if (!Main.dedServ) @@ -96,8 +97,8 @@ namespace CalamityMod.Projectiles.Magic { for (int j = 0; j < 4; j++) { - Vector2 shootVelocity = projectile.velocity.RotatedBy(MathHelper.Lerp(-0.35f, 0.35f, j / 4f)) * Main.rand.NextFloat(0.75f, 1.1f); - Vector2 spawnPosition = projectile.Center + shootVelocity.SafeNormalize(Vector2.Zero) * 10f; + Vector2 shootVelocity = Projectile.velocity.RotatedBy(MathHelper.Lerp(-0.35f, 0.35f, j / 4f)) * Main.rand.NextFloat(0.75f, 1.1f); + Vector2 spawnPosition = Projectile.Center + shootVelocity.SafeNormalize(Vector2.Zero) * 10f; Dust blood = Dust.NewDustPerfect(spawnPosition, DustID.Blood); blood.velocity = shootVelocity; @@ -106,7 +107,7 @@ namespace CalamityMod.Projectiles.Magic } for (int i = 0; i < 60; i++) { - Dust brimstoneMagic = Dust.NewDustPerfect(projectile.Center, Main.rand.NextBool(2) ? (int)CalamityDusts.Brimstone : 27); + Dust brimstoneMagic = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(2) ? (int)CalamityDusts.Brimstone : 27); brimstoneMagic.velocity = Main.rand.NextVector2Circular(18f, 18f); brimstoneMagic.scale = 1.7f; brimstoneMagic.noGravity = true; @@ -121,7 +122,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/VehemenceHoldout.cs b/Projectiles/Magic/VehemenceHoldout.cs index ec8c1cef30..d3c4b47ee2 100644 --- a/Projectiles/Magic/VehemenceHoldout.cs +++ b/Projectiles/Magic/VehemenceHoldout.cs @@ -8,9 +8,9 @@ namespace CalamityMod.Projectiles.Magic { public class VehemenceHoldout : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float Time => ref projectile.ai[0]; - public ref float ChargeTime => ref projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; + public ref float ChargeTime => ref Projectile.ai[1]; public override string Texture => "CalamityMod/Items/Weapons/Magic/Vehemenc"; public override void SetStaticDefaults() @@ -20,19 +20,19 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = projectile.height = 114; - projectile.friendly = false; - projectile.magic = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 91; + Projectile.width = Projectile.height = 114; + Projectile.friendly = false; + // projectile.magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 91; } public override void AI() { UpdatePlayerVisuals(); - if (projectile.timeLeft > ChargeTime + 5) - projectile.timeLeft = (int)ChargeTime + 5; + if (Projectile.timeLeft > ChargeTime + 5) + Projectile.timeLeft = (int)ChargeTime + 5; if (Time == ChargeTime) ShootBolt(); else if (Time < ChargeTime) @@ -42,41 +42,41 @@ namespace CalamityMod.Projectiles.Magic // If the player aborts the charge by releasing LMB, it cancels. if (Main.mouseLeftRelease && Time >= 5f && Time < ChargeTime) - projectile.Kill(); + Projectile.Kill(); } private void UpdatePlayerVisuals() { - projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - projectile.rotation = projectile.AngleTo(Main.MouseWorld); - projectile.velocity = projectile.rotation.ToRotationVector2(); + Projectile.rotation = Projectile.AngleTo(Main.MouseWorld); + Projectile.velocity = Projectile.rotation.ToRotationVector2(); // Place the projectile directly into the player's hand with an offset at all times. - projectile.Center += projectile.rotation.ToRotationVector2() * 30f; + Projectile.Center += Projectile.rotation.ToRotationVector2() * 30f; - projectile.direction = projectile.spriteDirection = (Math.Cos(projectile.rotation) > 0).ToDirectionInt(); + Projectile.direction = Projectile.spriteDirection = (Math.Cos(Projectile.rotation) > 0).ToDirectionInt(); // The staff is a holdout projectile; change the player's variables to reflect this. - Owner.ChangeDir(projectile.direction); - Owner.heldProj = projectile.whoAmI; + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.itemRotation = CalamityUtils.WrapAngle90Degrees(projectile.rotation); + Owner.itemRotation = CalamityUtils.WrapAngle90Degrees(Projectile.rotation); - projectile.rotation += MathHelper.PiOver4; - if (projectile.spriteDirection == -1) - projectile.rotation += MathHelper.PiOver2; + Projectile.rotation += MathHelper.PiOver4; + if (Projectile.spriteDirection == -1) + Projectile.rotation += MathHelper.PiOver2; } private void ShootBolt() { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; Item heldItem = Owner.ActiveItem(); - Vector2 shootVelocity = projectile.velocity * heldItem.shootSpeed; - Projectile.NewProjectile(projectile.Center, shootVelocity, ModContent.ProjectileType(), (int)(Owner.MagicDamage() * heldItem.damage), heldItem.knockBack, projectile.owner); + Vector2 shootVelocity = Projectile.velocity * heldItem.shootSpeed; + Projectile.NewProjectile(Projectile.Center, shootVelocity, ModContent.ProjectileType(), (int)(Owner.MagicDamage() * heldItem.damage), heldItem.knockBack, Projectile.owner); } private void CreateChargeDust() @@ -84,11 +84,11 @@ namespace CalamityMod.Projectiles.Magic if (Main.dedServ) return; - Vector2 spawnOffset = projectile.velocity * 94f; + Vector2 spawnOffset = Projectile.velocity * 94f; for (int i = 0; i < 18; i++) { - Dust brimstoneMagic = Dust.NewDustPerfect(projectile.Center + spawnOffset + Main.rand.NextVector2CircularEdge(20f, 20f), (int)CalamityDusts.Brimstone); - brimstoneMagic.velocity = (projectile.Center + spawnOffset - brimstoneMagic.position).SafeNormalize(Vector2.Zero) * 0.3f + Owner.velocity; + Dust brimstoneMagic = Dust.NewDustPerfect(Projectile.Center + spawnOffset + Main.rand.NextVector2CircularEdge(20f, 20f), (int)CalamityDusts.Brimstone); + brimstoneMagic.velocity = (Projectile.Center + spawnOffset - brimstoneMagic.position).SafeNormalize(Vector2.Zero) * 0.3f + Owner.velocity; brimstoneMagic.velocity.Y -= 2f; brimstoneMagic.scale = 1.2f; brimstoneMagic.noGravity = true; diff --git a/Projectiles/Magic/VehemenceSkull.cs b/Projectiles/Magic/VehemenceSkull.cs index 1dc6c05b20..499e0f72b3 100644 --- a/Projectiles/Magic/VehemenceSkull.cs +++ b/Projectiles/Magic/VehemenceSkull.cs @@ -8,57 +8,57 @@ namespace CalamityMod.Projectiles.Magic { public class VehemenceSkull : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Vehement Skull"); - Main.projFrames[projectile.type] = 10; + Main.projFrames[Projectile.type] = 10; } public override void SetDefaults() { - projectile.width = projectile.height = 45; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 9; - projectile.magic = true; + Projectile.width = Projectile.height = 45; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 9; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { Time++; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.ai[0] < 125) // 155 - frameCounter tick * number of disippation frames. + if (Projectile.ai[0] < 125) // 155 - frameCounter tick * number of disippation frames. { - if (projectile.frame >= 4) - projectile.frame = 0; + if (Projectile.frame >= 4) + Projectile.frame = 0; } - else if (projectile.owner == Main.myPlayer && projectile.frame >= Main.projFrames[projectile.type]) - projectile.Kill(); + else if (Projectile.owner == Main.myPlayer && Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.Kill(); // Produce some light. - Lighting.AddLight(projectile.Center, 0.36f, 0.09f, 0.09f); + Lighting.AddLight(Projectile.Center, 0.36f, 0.09f, 0.09f); - projectile.velocity *= 0.972f; - if (projectile.alpha > 110) + Projectile.velocity *= 0.972f; + if (Projectile.alpha > 110) { - projectile.alpha -= 30; - if (projectile.alpha < 70) - projectile.alpha = 70; + Projectile.alpha -= 30; + if (Projectile.alpha < 70) + Projectile.alpha = 70; } - if (Math.Abs(projectile.velocity.X) > 0.1f) - projectile.spriteDirection = -projectile.direction; + if (Math.Abs(Projectile.velocity.X) > 0.1f) + Projectile.spriteDirection = -Projectile.direction; } public override Color? GetAlpha(Color lightColor) => new Color(191, 63, 54, 100); diff --git a/Projectiles/Magic/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index 6719de81b8..5c0396d7c8 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -12,40 +13,40 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.magic = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(45); - Lighting.AddLight(projectile.Center, 0.25f, 0.2f, 0f); - if (projectile.wet && !projectile.lavaWet) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.ToRadians(45); + Lighting.AddLight(Projectile.Center, 0.25f, 0.2f, 0f); + if (Projectile.wet && !Projectile.lavaWet) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item73, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item73, Projectile.position); + Projectile.localAI[0] += 1f; } for (int num457 = 0; num457 < 3; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.2f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1.2f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } } @@ -56,15 +57,15 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int explosionDamage = projectile.damage; + int explosionDamage = Projectile.damage; float explosionKB = 6f; - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), explosionDamage, explosionKB, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), explosionDamage, explosionKB, Projectile.owner); - int cinderDamage = (int)(projectile.damage * 0.75); + int cinderDamage = (int)(Projectile.damage * 0.75); float cinderKB = 0f; - Vector2 cinderPos = projectile.oldPosition + 0.5f * projectile.Size; + Vector2 cinderPos = Projectile.oldPosition + 0.5f * Projectile.Size; int numCinders = Main.rand.Next(7, 10); for (int i = 0; i < numCinders; i++) { @@ -75,14 +76,14 @@ namespace CalamityMod.Projectiles.Magic } cinderVel.Normalize(); cinderVel *= Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(cinderPos, cinderVel, ModContent.ProjectileType(), cinderDamage, cinderKB, projectile.owner); + Projectile.NewProjectile(cinderPos, cinderVel, ModContent.ProjectileType(), cinderDamage, cinderKB, Projectile.owner); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/VenusianExplosion.cs b/Projectiles/Magic/VenusianExplosion.cs index 767f7d71bd..ec2d8bcefc 100644 --- a/Projectiles/Magic/VenusianExplosion.cs +++ b/Projectiles/Magic/VenusianExplosion.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -17,38 +18,38 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 120; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 250; + Projectile.height = 250; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.01f / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item74, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item74, Projectile.position); + Projectile.localAI[0] += 1f; } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -59,11 +60,11 @@ namespace CalamityMod.Projectiles.Magic num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 2.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 2.5f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index da28a9a9a0..fb20da4424 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -13,102 +13,102 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Venusian Cinder"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 3; - projectile.timeLeft = 120; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 3; + Projectile.timeLeft = 120; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { //Rotation - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.rotation = -projectile.velocity.X * 0.05f + MathHelper.PiOver2; + Projectile.rotation = -Projectile.velocity.X * 0.05f + MathHelper.PiOver2; } else { - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); } - projectile.ai[1]--; + Projectile.ai[1]--; //frames if (!initialized) { initialized = true; - projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); } - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } //movement - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X *= -0.1f; + Projectile.velocity.X *= -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X *= -0.5f; + Projectile.velocity.X *= -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y *= -0.5f; + Projectile.velocity.Y *= -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X *= 0.97f; - if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) + Projectile.velocity.X *= 0.97f; + if (Projectile.velocity.X > -0.01f && Projectile.velocity.X < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; } - if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) + if (Projectile.velocity.Y < 0.25f && Projectile.velocity.Y > 0.15f) { - projectile.velocity.X *= 0.8f; + Projectile.velocity.X *= 0.8f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } - if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) + if (Projectile.velocity.Y < 0.25f && Projectile.velocity.Y > 0.15f) { - projectile.velocity.X *= 0.8f; + Projectile.velocity.X *= 0.8f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } //Dust if (Main.rand.NextBool(4)) { - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num199]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool(10)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1f); Dust dust2 = Main.dust[num200]; dust2.position.X -= 2f; dust2.position.Y += 2f; @@ -135,13 +135,13 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.ai[1] = 10f; + Projectile.ai[1] = 10f; return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/VisceraBeam.cs b/Projectiles/Magic/VisceraBeam.cs index a47547c996..4f02f6da84 100644 --- a/Projectiles/Magic/VisceraBeam.cs +++ b/Projectiles/Magic/VisceraBeam.cs @@ -17,35 +17,35 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 9; - projectile.extraUpdates = 100; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 9; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; } public override bool OnTileCollide(Vector2 oldVelocity) { healAmt *= 1.25f; - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -53,24 +53,24 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) + if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) return; healAmt *= 1.25f; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.statLife += (int)healAmt; player.HealEffect((int)healAmt); } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { for (int num447 = 0; num447 < 4; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); int num448 = Dust.NewDust(vector33, 1, 1, 5, 0f, 0f, 0, default, 1f); Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; diff --git a/Projectiles/Magic/VitriolicViperFang.cs b/Projectiles/Magic/VitriolicViperFang.cs index 3321e1e704..abfb963516 100644 --- a/Projectiles/Magic/VitriolicViperFang.cs +++ b/Projectiles/Magic/VitriolicViperFang.cs @@ -13,31 +13,31 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Fang"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 34; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 4; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 16; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 4; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (projectile.penetrate == 0) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.penetrate == 0) { - projectile.alpha += 4; - if (projectile.alpha >= 255) + Projectile.alpha += 4; + if (Projectile.alpha >= 255) { - projectile.Kill(); + Projectile.Kill(); } } } @@ -45,13 +45,13 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 10; i++) { - Dust dust = Dust.NewDustDirect(projectile.position, 10, 10, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustDirect(Projectile.position, 10, 10, (int)CalamityDusts.SulfurousSeaAcid); dust.noGravity = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Magic/VitriolicViperSpit.cs b/Projectiles/Magic/VitriolicViperSpit.cs index cae9ee8332..eedd6e635f 100644 --- a/Projectiles/Magic/VitriolicViperSpit.cs +++ b/Projectiles/Magic/VitriolicViperSpit.cs @@ -14,25 +14,25 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 16; - projectile.height = 26; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.width = 16; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override void Kill(int timeLeft) { for (int i = 0; i < 14; i++) { - Dust dust = Dust.NewDustDirect(projectile.position, 10, 10, 27); + Dust dust = Dust.NewDustDirect(Projectile.position, 10, 10, 27); dust.noGravity = true; } } diff --git a/Projectiles/Magic/VividBeam.cs b/Projectiles/Magic/VividBeam.cs index 4319360eab..42bfaa4adc 100644 --- a/Projectiles/Magic/VividBeam.cs +++ b/Projectiles/Magic/VividBeam.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 240; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 240; } public override void AI() @@ -37,42 +37,42 @@ namespace CalamityMod.Projectiles.Magic { Vector2 offset = Vector2.UnitX * 0f; offset += -Vector2.UnitY.RotatedBy((double)((float)d * (MathHelper.TwoPi / dustAmt)), default) * new Vector2(1f, 4f); - offset = offset.RotatedBy((double)projectile.velocity.ToRotation(), default); - int i = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + offset = offset.RotatedBy((double)Projectile.velocity.ToRotation(), default); + int i = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[i].scale = 1.5f; Main.dust[i].noGravity = true; - Main.dust[i].position = projectile.Center + offset; - Main.dust[i].velocity = projectile.velocity * 0f + offset.SafeNormalize(Vector2.UnitY) * 1f; + Main.dust[i].position = Projectile.Center + offset; + Main.dust[i].velocity = Projectile.velocity * 0f + offset.SafeNormalize(Vector2.UnitY) * 1f; d++; } } float pi = MathHelper.Pi; - projectile.ai[0] += 1f; - if (projectile.ai[0] == 48f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] == 48f) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; } else { for (int d = 0; d < 2; d++) { Vector2 offset = Vector2.UnitX * -12f; - offset = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * pi / 24f + (float)d * pi), default) * new Vector2(5f, 10f) - projectile.rotation.ToRotationVector2() * 10f; - int i = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + offset = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * pi / 24f + (float)d * pi), default) * new Vector2(5f, 10f) - Projectile.rotation.ToRotationVector2() * 10f; + int i = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[i].scale = 0.75f; Main.dust[i].noGravity = true; - Main.dust[i].position = projectile.Center + offset; - Main.dust[i].velocity = projectile.velocity; + Main.dust[i].position = Projectile.Center + offset; + Main.dust[i].velocity = Projectile.velocity; } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int d = 0; d < 2; d++) { - Vector2 source = projectile.position; - source -= projectile.velocity * ((float)d * 0.25f); + Vector2 source = Projectile.position; + source -= Projectile.velocity * ((float)d * 0.25f); int i = Dust.NewDust(source, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[i].noGravity = true; Main.dust[i].position = source; @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { SummonLasers(); } @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { SummonLasers(); } @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { SummonLasers(); } @@ -111,26 +111,26 @@ namespace CalamityMod.Projectiles.Magic private void SummonLasers() { - switch (projectile.ai[1]) + switch (Projectile.ai[1]) { case 0f: - CalamityUtils.ProjectileRain(projectile.Center, 400f, 100f, 500f, 800f, 6f, ModContent.ProjectileType(), (int)(projectile.damage * 0.7), projectile.knockBack, projectile.owner); + CalamityUtils.ProjectileRain(Projectile.Center, 400f, 100f, 500f, 800f, 6f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); break; case 1f: - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage * 2, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner); break; case 2f: float spread = 30f * 0.01f * MathHelper.PiOver2; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } break; } diff --git a/Projectiles/Magic/VividBolt.cs b/Projectiles/Magic/VividBolt.cs index 3e3e1e4675..c0c02cfa3d 100644 --- a/Projectiles/Magic/VividBolt.cs +++ b/Projectiles/Magic/VividBolt.cs @@ -14,46 +14,46 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.penetrate = -1; - projectile.friendly = true; - projectile.timeLeft = 30; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 4; + Projectile.height = 4; + Projectile.extraUpdates = 100; + Projectile.penetrate = -1; + Projectile.friendly = true; + Projectile.timeLeft = 30; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } public override void AI() { Vector2 value7 = new Vector2(5f, 10f); - projectile.ai[0] += 1f; - if (projectile.ai[0] == 48f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] == 48f) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; } else { for (int num41 = 0; num41 < 2; num41++) { Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - Projectile.rotation.ToRotationVector2() * 10f; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[num42].scale = 0.33f; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; + Main.dust[num42].position = Projectile.Center + value8; + Main.dust[num42].velocity = Projectile.velocity; } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num447 = 0; num447 < 2; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; diff --git a/Projectiles/Magic/VividClarityBeam.cs b/Projectiles/Magic/VividClarityBeam.cs index 4e56d562a1..c0e0aaabc8 100644 --- a/Projectiles/Magic/VividClarityBeam.cs +++ b/Projectiles/Magic/VividClarityBeam.cs @@ -15,54 +15,54 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 10; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { Vector2 value7 = new Vector2(5f, 10f); - projectile.ai[0] += 1f; - if (projectile.ai[0] == 48f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] == 48f) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; } else { for (int num41 = 0; num41 < 2; num41++) { Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - Projectile.rotation.ToRotationVector2() * 10f; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[num42].scale = 0.75f; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; + Main.dust[num42].position = Projectile.Center + value8; + Main.dust[num42].velocity = Projectile.velocity; } } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] >= 29f && Projectile.owner == Main.myPlayer) { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.localAI[1] = 0f; + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num447 = 0; num447 < 2; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; @@ -74,21 +74,21 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.damage = (int)((double)projectile.damage * 1.2); - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.damage = (int)((double)Projectile.damage * 1.2); + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -97,13 +97,13 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.ExoDebuffs(); - projectile.damage = (int)(projectile.damage * 1.1); + Projectile.damage = (int)(Projectile.damage * 1.1); } public override void OnHitPvp(Player target, int damage, bool crit) { target.ExoDebuffs(); - projectile.damage = (int)(projectile.damage * 1.1); + Projectile.damage = (int)(Projectile.damage * 1.1); } } } diff --git a/Projectiles/Magic/VividExplosion.cs b/Projectiles/Magic/VividExplosion.cs index b37c167cbf..de7be4f5bc 100644 --- a/Projectiles/Magic/VividExplosion.cs +++ b/Projectiles/Magic/VividExplosion.cs @@ -15,21 +15,21 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = projectile.height = 1; //Uses custom collision, this field is irrelevant - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.timeLeft = 5; + Projectile.width = Projectile.height = 1; //Uses custom collision, this field is irrelevant + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; + Projectile.timeLeft = 5; } public override void AI() { - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); float dustSpeed = Main.rand.NextFloat(12f, 35f); Vector2 dustVel = CalamityUtils.RandomVelocity(40f, dustSpeed, dustSpeed, 1f); @@ -39,16 +39,16 @@ namespace CalamityMod.Projectiles.Magic 234, 269 }); - int rainbow = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[rainbow]; dust.noGravity = true; - dust.position = projectile.Center; + dust.position = Projectile.Center; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity = dustVel; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Magic/VividLaser2.cs b/Projectiles/Magic/VividLaser2.cs index 49fa5ee9d6..91b3a2e76b 100644 --- a/Projectiles/Magic/VividLaser2.cs +++ b/Projectiles/Magic/VividLaser2.cs @@ -14,36 +14,36 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.timeLeft = 120; - projectile.penetrate = 1; - projectile.magic = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.timeLeft = 120; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { Vector2 value7 = new Vector2(5f, 10f); - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; for (int dust = 0; dust < 2; dust++) { Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[1] * 0.1308997f + (float)dust * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[1] * 0.1308997f + (float)dust * 3.14159274f), default) * value7 - Projectile.rotation.ToRotationVector2() * 10f; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, 66, 0f, 0f, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[num42].scale = 0.75f; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; + Main.dust[num42].position = Projectile.Center + value8; + Main.dust[num42].velocity = Projectile.velocity; } - if (projectile.timeLeft < 110) - projectile.ai[0] = 1f; + if (Projectile.timeLeft < 110) + Projectile.ai[0] = 1f; - if (projectile.ai[0] >= 1f) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 400f, 12f, 20f); + if (Projectile.ai[0] >= 1f) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 400f, 12f, 20f); } public override void Kill(int timeLeft) @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Magic 234, 269 }); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } @@ -73,13 +73,13 @@ namespace CalamityMod.Projectiles.Magic // Cannot deal damage for the first several frames of existence. public override bool? CanHitNPC(NPC target) { - if (projectile.timeLeft >= 110) + if (Projectile.timeLeft >= 110) { return false; } return null; } - public override bool CanHitPvp(Player target) => projectile.timeLeft < 110; + public override bool CanHitPvp(Player target) => Projectile.timeLeft < 110; } } diff --git a/Projectiles/Magic/VividOrb.cs b/Projectiles/Magic/VividOrb.cs index 1fe9a3ab91..913672a28b 100644 --- a/Projectiles/Magic/VividOrb.cs +++ b/Projectiles/Magic/VividOrb.cs @@ -12,21 +12,21 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.ignoreWater = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.ignoreWater = true; } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType(), 1D, true); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType(), 1D, true); } } } diff --git a/Projectiles/Magic/VoidVortexProj.cs b/Projectiles/Magic/VoidVortexProj.cs index c545e2054a..1a5a6ca3ab 100644 --- a/Projectiles/Magic/VoidVortexProj.cs +++ b/Projectiles/Magic/VoidVortexProj.cs @@ -11,68 +11,68 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Void Vortex"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 38; - projectile.height = 38; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 180; - projectile.magic = true; + Projectile.width = 38; + Projectile.height = 38; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { // Spin chaotically given a pre-defined spin direction. Choose one initially at random. float spinTheta = 0.11f; - if (projectile.localAI[1] == 0f) - projectile.localAI[1] = Main.rand.NextBool() ? -spinTheta : spinTheta; - projectile.rotation += projectile.localAI[1]; + if (Projectile.localAI[1] == 0f) + Projectile.localAI[1] = Main.rand.NextBool() ? -spinTheta : spinTheta; + Projectile.rotation += Projectile.localAI[1]; // Animate the lightning orb. - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 4) + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame > 4) { - projectile.frame = 0; + Projectile.frame = 0; } } // Spiral outwards in an increasingly chaotic fashion. - float revolutionTheta = 0.12f * projectile.ai[1]; - projectile.velocity = projectile.velocity.RotatedBy(revolutionTheta) * 1.0092f; + float revolutionTheta = 0.12f * Projectile.ai[1]; + Projectile.velocity = Projectile.velocity.RotatedBy(revolutionTheta) * 1.0092f; // Initial stagger in frames needs to be skipped over before it starts shooting, // but once it's past that then it can fire constantly - --projectile.ai[0]; - if (projectile.ai[0] < 0f) - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, VoidVortex.OrbFireRate, 2, ModContent.ProjectileType(), 1D, true); + --Projectile.ai[0]; + if (Projectile.ai[0] < 0f) + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 400f, 8f, VoidVortex.OrbFireRate, 2, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 30) + if (Projectile.timeLeft < 30) { - float num7 = projectile.timeLeft / 30f; - projectile.alpha = (int)(255f - 255f * num7); + float num7 = Projectile.timeLeft / 30f; + Projectile.alpha = (int)(255f - 255f * num7); } - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Magic/VolatileStarcore.cs b/Projectiles/Magic/VolatileStarcore.cs index 789603ff5f..74d889e324 100644 --- a/Projectiles/Magic/VolatileStarcore.cs +++ b/Projectiles/Magic/VolatileStarcore.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class VolatileStarcore : ModProjectile @@ -15,18 +16,18 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Volatile Starcore"); - Main.projFrames[projectile.type] = NumAnimationFrames; + Main.projFrames[Projectile.type] = NumAnimationFrames; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.magic = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.extraUpdates = 2; - projectile.timeLeft = Lifetime; - projectile.alpha = 48; + Projectile.width = 26; + Projectile.height = 26; + Projectile.DamageType = DamageClass.Magic; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 2; + Projectile.timeLeft = Lifetime; + Projectile.alpha = 48; } public override void AI() @@ -37,33 +38,33 @@ namespace CalamityMod.Projectiles.Magic drawOriginOffsetX = 0; // Play sound and set rotation on frame 1 - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.NPCDeath56, projectile.Center); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.localAI[0] = 1f; + SoundEngine.PlaySound(SoundID.NPCDeath56, Projectile.Center); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; } // Dust only shows up after the first few frames - if (projectile.localAI[0] >= 5f) + if (Projectile.localAI[0] >= 5f) SpawnDust(); // Lighting and spin - Lighting.AddLight(projectile.Center, 1.8f, 1.6f, 0.5f); - projectile.rotation += 0.11f; + Lighting.AddLight(Projectile.Center, 1.8f, 1.6f, 0.5f); + Projectile.rotation += 0.11f; // Increment frame counter - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; // Update animation - projectile.frameCounter++; - if (projectile.frameCounter > AnimationFrameTime) + Projectile.frameCounter++; + if (Projectile.frameCounter > AnimationFrameTime) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= NumAnimationFrames) - projectile.frame = 0; + if (Projectile.frame >= NumAnimationFrames) + Projectile.frame = 0; } private void SpawnDust() @@ -73,9 +74,9 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < coreDustCount; ++i) { float scale = Main.rand.NextFloat(1.0f, 1.4f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, coreDustType); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, coreDustType); Main.dust[idx].velocity *= 0.7f; - Main.dust[idx].velocity += projectile.velocity * 1.4f; + Main.dust[idx].velocity += Projectile.velocity * 1.4f; Main.dust[idx].scale = scale; Main.dust[idx].noGravity = true; } @@ -85,8 +86,8 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < trailDustCount; ++i) { float scale = Main.rand.NextFloat(1.0f, 1.4f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, trailDustType, 0f, 0f); - Main.dust[idx].velocity = projectile.velocity * 0.8f; + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, trailDustType, 0f, 0f); + Main.dust[idx].velocity = Projectile.velocity * 0.8f; Main.dust[idx].scale = scale; Main.dust[idx].noGravity = true; } @@ -106,14 +107,14 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - if (projectile.owner != Main.myPlayer) + if (Projectile.owner != Main.myPlayer) return; // Spawn a Helium Flash on impact int type = ModContent.ProjectileType(); - int damage = (int)(HeliumFlash.ExplosionDamageMultiplier * projectile.damage); + int damage = (int)(HeliumFlash.ExplosionDamageMultiplier * Projectile.damage); float kb = 9.5f; - Projectile.NewProjectile(projectile.Center, Vector2.Zero, type, damage, kb, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, type, damage, kb, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Magic/Vortex.cs b/Projectiles/Magic/Vortex.cs index 193ad83d7f..40e2e8aea3 100644 --- a/Projectiles/Magic/Vortex.cs +++ b/Projectiles/Magic/Vortex.cs @@ -9,18 +9,18 @@ namespace CalamityMod.Projectiles.Magic { public float TargetCheckCooldown { - get => projectile.localAI[0]; - set => projectile.localAI[0] = value; + get => Projectile.localAI[0]; + set => Projectile.localAI[0] = value; } public float Time { - get => projectile.localAI[1]; - set => projectile.localAI[1] = value; + get => Projectile.localAI[1]; + set => Projectile.localAI[1] = value; } public int TargetIndex { - get => (int)projectile.ai[0]; - set => projectile.ai[0] = value; + get => (int)Projectile.ai[0]; + set => Projectile.ai[0] = value; } public const float AngularMovementSpeed = 0.1f; @@ -31,22 +31,22 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Subsuming Vortex"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 60; - projectile.height = 60; - projectile.alpha = 255; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.extraUpdates = 4; - projectile.timeLeft = 115 * projectile.extraUpdates; - projectile.ignoreWater = true; + Projectile.width = 60; + Projectile.height = 60; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.extraUpdates = 4; + Projectile.timeLeft = 115 * Projectile.extraUpdates; + Projectile.ignoreWater = true; } public override void AI() @@ -57,17 +57,17 @@ namespace CalamityMod.Projectiles.Magic TargetIndex = -1; } Time++; - if (projectile.localAI[1] > 10f && Main.rand.NextBool(3)) + if (Projectile.localAI[1] > 10f && Main.rand.NextBool(3)) { VisualEffects(); } Movement(HandleTargeting()); - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; } public bool HandleTargeting() { - float targetCheckDistance = 350f * projectile.ai[1]; + float targetCheckDistance = 350f * Projectile.ai[1]; // Reduce a cooldown. Nothing special here. if (TargetCheckCooldown > 0f) @@ -78,10 +78,10 @@ namespace CalamityMod.Projectiles.Magic // Attempt to find a target if the projectile has none. if (TargetIndex == -1 && TargetCheckCooldown <= 0f) { - NPC potentialTarget = projectile.Center.ClosestNPCAt(targetCheckDistance, true, true); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(targetCheckDistance, true, true); if (potentialTarget != null) TargetIndex = potentialTarget.whoAmI; - projectile.netUpdate = true; + Projectile.netUpdate = true; } if (TargetCheckCooldown <= 0f && TargetIndex == -1) { @@ -91,11 +91,11 @@ namespace CalamityMod.Projectiles.Magic // Ensure that the target is still in reach if there is indeed a target. if (TargetIndex != -1) { - stillCanReachTarget = projectile.Distance(Main.npc[TargetIndex].Center) < MaximumTargetDistance; + stillCanReachTarget = Projectile.Distance(Main.npc[TargetIndex].Center) < MaximumTargetDistance; if (!stillCanReachTarget) { TargetIndex = -1; - projectile.netUpdate = true; + Projectile.netUpdate = true; } } return stillCanReachTarget; @@ -109,22 +109,22 @@ namespace CalamityMod.Projectiles.Magic int dustCount = 5; for (int i = 0; i < dustCount; i++) { - Vector2 spawnPosition = projectile.Center + projectile.Size.RotatedBy(i / (float)dustCount * MathHelper.TwoPi) * 0.333f; + Vector2 spawnPosition = Projectile.Center + Projectile.Size.RotatedBy(i / (float)dustCount * MathHelper.TwoPi) * 0.333f; Vector2 velocity = Main.rand.NextFloat(MathHelper.TwoPi).ToRotationVector2() * Main.rand.NextFloat(6f, 16f); Dust dust = Dust.NewDustPerfect(spawnPosition, 66, velocity, 0, Main.DiscoColor, 0.7f); dust.noGravity = true; dust.noLight = true; - dust.velocity = -projectile.velocity; + dust.velocity = -Projectile.velocity; } } // Fade in. - projectile.alpha -= 5; - if (projectile.alpha < 50) + Projectile.alpha -= 5; + if (Projectile.alpha < 50) { - projectile.alpha = 50; + Projectile.alpha = 50; } // And make rainbow light. - Lighting.AddLight(projectile.Center / 16, Main.DiscoColor.ToVector3()); + Lighting.AddLight(Projectile.Center / 16, Main.DiscoColor.ToVector3()); } public void Movement(bool stillCanReachTarget) @@ -136,13 +136,13 @@ namespace CalamityMod.Projectiles.Magic // This causes the velocity to constantly rotate sharply towards the target. if (stillCanReachTarget) { - float angleOffsetToTarget = projectile.AngleTo(Main.npc[TargetIndex].Center) - projectile.velocity.ToRotation(); + float angleOffsetToTarget = Projectile.AngleTo(Main.npc[TargetIndex].Center) - Projectile.velocity.ToRotation(); angleOffsetToTarget = MathHelper.WrapAngle(angleOffsetToTarget); // Ensure the offset is in the range of -pi to pi. - projectile.velocity = projectile.velocity.RotatedBy(angleOffsetToTarget * AngularMovementSpeed); + Projectile.velocity = Projectile.velocity.RotatedBy(angleOffsetToTarget * AngularMovementSpeed); } // Accelerate constantly with time. - float oldSpeed = projectile.velocity.Length(); - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * (oldSpeed + Acceleration); + float oldSpeed = Projectile.velocity.Length(); + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * (oldSpeed + Acceleration); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/VortexElementalBeam.cs b/Projectiles/Magic/VortexElementalBeam.cs index 3bb01e701d..5dd6ffa180 100644 --- a/Projectiles/Magic/VortexElementalBeam.cs +++ b/Projectiles/Magic/VortexElementalBeam.cs @@ -13,39 +13,39 @@ namespace CalamityMod.Projectiles.Magic { public const int Lifetime = 30; public const float LightningTurnRandomnessFactor = 1.7f; - public ref float InitialVelocityAngle => ref projectile.ai[0]; + public ref float InitialVelocityAngle => ref Projectile.ai[0]; // Technically not a ratio, and more of a seed, but it is used in a 0-2pi squash // later in the code to get an arbitrary unit vector (which is then checked). - public ref float BaseTurnAngleRatio => ref projectile.ai[1]; - public ref float AccumulatedXMovementSpeeds => ref projectile.localAI[0]; + public ref float BaseTurnAngleRatio => ref Projectile.ai[1]; + public ref float AccumulatedXMovementSpeeds => ref Projectile.localAI[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Lightning"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 30; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 30; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = projectile.height = 16; - projectile.friendly = true; - projectile.magic = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.extraUpdates = 20; - projectile.timeLeft = 45 * projectile.extraUpdates; + Projectile.width = Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 20; + Projectile.timeLeft = 45 * Projectile.extraUpdates; // Readjust the velocity magnitude the moment this projectile is created // to make velocity setting outside the scope of this projectile less irritating // to consider alongside extraUpdate multipliers. // Also set the initial angle. - if (projectile.velocity != Vector2.Zero) + if (Projectile.velocity != Vector2.Zero) { - projectile.velocity /= projectile.extraUpdates; + Projectile.velocity /= Projectile.extraUpdates; } } @@ -57,18 +57,18 @@ namespace CalamityMod.Projectiles.Magic { // frameCounter in this context is really just an arbitrary timer // which allows random turning to occur. - projectile.frameCounter++; + Projectile.frameCounter++; - projectile.scale += 0.04f / projectile.MaxUpdates; - if (projectile.scale > 1f) - projectile.scale = 1f; + Projectile.scale += 0.04f / Projectile.MaxUpdates; + if (Projectile.scale > 1f) + Projectile.scale = 1f; - Lighting.AddLight(projectile.Center, Color.Pink.ToVector3()); - if (projectile.frameCounter >= projectile.extraUpdates * 2) + Lighting.AddLight(Projectile.Center, Color.Pink.ToVector3()); + if (Projectile.frameCounter >= Projectile.extraUpdates * 2) { - projectile.frameCounter = 0; + Projectile.frameCounter = 0; - float originalSpeed = MathHelper.Min(6f, projectile.velocity.Length()); + float originalSpeed = MathHelper.Min(6f, Projectile.velocity.Length()); UnifiedRandom unifiedRandom = new UnifiedRandom((int)BaseTurnAngleRatio); int turnTries = 0; Vector2 newBaseDirection = -Vector2.UnitY; @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Magic // This mess of math basically encourages movement at the ends of an extraUpdate cycle, // discourages super frequenent randomness as the accumulated X speed changes get larger, // or if the original speed is quite large. - if (Math.Abs(potentialBaseDirection.X * (projectile.extraUpdates + 1) * 2f * originalSpeed + AccumulatedXMovementSpeeds) > projectile.MaxUpdates * LightningTurnRandomnessFactor) + if (Math.Abs(potentialBaseDirection.X * (Projectile.extraUpdates + 1) * 2f * originalSpeed + AccumulatedXMovementSpeeds) > Projectile.MaxUpdates * LightningTurnRandomnessFactor) { canChangeLightningDirection = false; } @@ -105,11 +105,11 @@ namespace CalamityMod.Projectiles.Magic } while (turnTries < 100); - if (projectile.velocity != Vector2.Zero) + if (Projectile.velocity != Vector2.Zero) { - AccumulatedXMovementSpeeds += newBaseDirection.X * (projectile.extraUpdates + 1) * 2f * originalSpeed; - projectile.velocity = newBaseDirection.RotatedBy(InitialVelocityAngle + MathHelper.PiOver2) * originalSpeed; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + AccumulatedXMovementSpeeds += newBaseDirection.X * (Projectile.extraUpdates + 1) * 2f * originalSpeed; + Projectile.velocity = newBaseDirection.RotatedBy(InitialVelocityAngle + MathHelper.PiOver2) * originalSpeed; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } } } @@ -117,36 +117,36 @@ namespace CalamityMod.Projectiles.Magic #region Drawing public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D lightningSegmentTexture = Main.projectileTexture[projectile.type]; - projectile.GetAlpha(lightColor); - Vector2 lightningScale = new Vector2(projectile.scale) / 2f; + Texture2D lightningSegmentTexture = Main.projectileTexture[Projectile.type]; + Projectile.GetAlpha(lightColor); + Vector2 lightningScale = new Vector2(Projectile.scale) / 2f; for (int i = 0; i < 3; i++) { // c_1 and f_1 are general fields that are used for drawing methods in here. // c_1 is the color to be used, and f_1 is the opacity. if (i == 0) { - lightningScale = new Vector2(projectile.scale) * 0.6f; + lightningScale = new Vector2(Projectile.scale) * 0.6f; DelegateMethods.c_1 = Color.DarkCyan * 0.85f; } else if (i == 1) { - lightningScale = new Vector2(projectile.scale) * 0.4f; + lightningScale = new Vector2(Projectile.scale) * 0.4f; DelegateMethods.c_1 = Color.Cyan * 0.85f; } else { - lightningScale = new Vector2(projectile.scale) * 0.2f; + lightningScale = new Vector2(Projectile.scale) * 0.2f; DelegateMethods.c_1 = Color.White; } DelegateMethods.f_1 = 1f; - for (int j = projectile.oldPos.Length - 1; j > 0; j--) + for (int j = Projectile.oldPos.Length - 1; j > 0; j--) { - if (projectile.oldPos[j] != Vector2.Zero) + if (Projectile.oldPos[j] != Vector2.Zero) { - Vector2 start = projectile.oldPos[j] + projectile.Size * 0.5f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Vector2 end = projectile.oldPos[j - 1] + projectile.Size * 0.5f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Vector2 start = Projectile.oldPos[j] + Projectile.Size * 0.5f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Vector2 end = Projectile.oldPos[j - 1] + Projectile.Size * 0.5f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Utils.DrawLaser(spriteBatch, lightningSegmentTexture, start, end, lightningScale, DelegateMethods.LightningLaserDraw); } } @@ -159,17 +159,17 @@ namespace CalamityMod.Projectiles.Magic { target.AddBuff(BuffID.Electrified, 180); - for (int i = 0; i < projectile.oldPos.Length - 1; i++) + for (int i = 0; i < Projectile.oldPos.Length - 1; i++) { // Skip zeroed old positions. They are almost certainly a // result of incomplete indices. - if (projectile.oldPos[i + 1] == Vector2.Zero) + if (Projectile.oldPos[i + 1] == Vector2.Zero) continue; for (int j = 0; j < 8; j++) { - Vector2 dustSpawnPosition = Vector2.Lerp(projectile.oldPos[i], projectile.oldPos[i + 1], j / 8f); - dustSpawnPosition += projectile.Size * 0.5f; + Vector2 dustSpawnPosition = Vector2.Lerp(Projectile.oldPos[i], Projectile.oldPos[i + 1], j / 8f); + dustSpawnPosition += Projectile.Size * 0.5f; Dust electricity = Dust.NewDustPerfect(dustSpawnPosition, Main.rand.NextBool(2) ? 226 : 229); electricity.velocity = Vector2.Zero; diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index 791d319d95..bf0bd3ff93 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -16,42 +17,42 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Leech"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 540; - projectile.magic = true; + Projectile.width = Projectile.height = 18; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 540; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.Pi; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.Pi; } //Sticky Behaviour - projectile.StickyProjAI(5); + Projectile.StickyProjAI(5); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(3, false); + Projectile.ModifyHitNPCSticky(3, false); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -66,44 +67,44 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + Projectile.Kill(); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int drawStart = height * projectile.frame; - Vector2 origin = projectile.Size / 2; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = height * Projectile.frame; + Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int drawStart = height * projectile.frame; - Vector2 origin = projectile.Size / 2; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = height * Projectile.frame; + Vector2 origin = Projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/AcidRain/WaterLeechGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/AcidRain/WaterLeechGlow"), Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 1, 0.5f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 0.5f, 0f); for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 1.5f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Magic/WaterStream.cs b/Projectiles/Magic/WaterStream.cs index bfa31fb1b5..412cb625b6 100644 --- a/Projectiles/Magic/WaterStream.cs +++ b/Projectiles/Magic/WaterStream.cs @@ -14,61 +14,61 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.extraUpdates = 2; - projectile.magic = true; - projectile.tileCollide = false; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.extraUpdates = 2; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; } public override void AI() { - projectile.ai[1]++; - if (projectile.ai[1] >= 4f) + Projectile.ai[1]++; + if (Projectile.ai[1] >= 4f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.timeLeft % 20 == 0) + if (Projectile.timeLeft % 20 == 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.25f / 255f); - projectile.scale -= 0.002f; - if (projectile.scale <= 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); + Projectile.scale -= 0.002f; + if (Projectile.scale <= 0f) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.ai[0] <= 3f) + if (Projectile.ai[0] <= 3f) { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; return; } - projectile.velocity.Y = projectile.velocity.Y + 0.075f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.075f; for (int num151 = 0; num151 < 3; num151++) { - float num152 = projectile.velocity.X / 3f * (float)num151; - float num153 = projectile.velocity.Y / 3f * (float)num151; + float num152 = Projectile.velocity.X / 3f * (float)num151; + float num153 = Projectile.velocity.Y / 3f * (float)num151; int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 1f); + int num155 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num154, Projectile.position.Y + (float)num154), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 1f); Dust dust = Main.dust[num155]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.5f; + dust.velocity += Projectile.velocity * 0.5f; dust.position.X -= num152; dust.position.Y -= num153; } if (Main.rand.NextBool(8)) { int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 0.5f); + int num157 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num156, Projectile.position.Y + (float)num156), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 0.5f); Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; + Main.dust[num157].velocity += Projectile.velocity * 0.5f; } } } diff --git a/Projectiles/Magic/WaterStream2.cs b/Projectiles/Magic/WaterStream2.cs index de5cd3f3d4..aa93c6379c 100644 --- a/Projectiles/Magic/WaterStream2.cs +++ b/Projectiles/Magic/WaterStream2.cs @@ -14,49 +14,49 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 80; - projectile.magic = true; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 80; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.25f / 255f); - projectile.scale -= 0.002f; - if (projectile.scale <= 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); + Projectile.scale -= 0.002f; + if (Projectile.scale <= 0f) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.ai[0] <= 3f) + if (Projectile.ai[0] <= 3f) { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; return; } - projectile.velocity.Y = projectile.velocity.Y + 0.075f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.075f; for (int num151 = 0; num151 < 3; num151++) { - float num152 = projectile.velocity.X / 3f * (float)num151; - float num153 = projectile.velocity.Y / 3f * (float)num151; + float num152 = Projectile.velocity.X / 3f * (float)num151; + float num153 = Projectile.velocity.Y / 3f * (float)num151; int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 1f); + int num155 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num154, Projectile.position.Y + (float)num154), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 1f); Dust dust = Main.dust[num155]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.5f; + dust.velocity += Projectile.velocity * 0.5f; dust.position.X -= num152; dust.position.Y -= num153; } if (Main.rand.NextBool(8)) { int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 0.5f); + int num157 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num156, Projectile.position.Y + (float)num156), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 0.5f); Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; + Main.dust[num157].velocity += Projectile.velocity * 0.5f; } } } diff --git a/Projectiles/Magic/WaywasherProj.cs b/Projectiles/Magic/WaywasherProj.cs index 1cc7e7e958..f00954659a 100644 --- a/Projectiles/Magic/WaywasherProj.cs +++ b/Projectiles/Magic/WaywasherProj.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { public class WaywasherProj : ModProjectile @@ -14,52 +15,52 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 0; - projectile.penetrate = 2; - projectile.timeLeft = 300; - projectile.magic = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 0; + Projectile.penetrate = 2; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f * (float)projectile.direction; - Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.7f); + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f * (float)Projectile.direction; + Lighting.AddLight(Projectile.Center, 0f, 0.1f, 0.7f); for (int num105 = 0; num105 < 2; num105++) { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; + float num99 = Projectile.velocity.X / 3f * (float)num105; + float num100 = Projectile.velocity.Y / 3f * (float)num105; int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(64, 224, 208), 1.2f); + int num102 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num101, Projectile.position.Y + (float)num101), Projectile.width - num101 * 2, Projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(64, 224, 208), 1.2f); Dust dust = Main.dust[num102]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.1f; + dust.velocity += Projectile.velocity * 0.1f; dust.position.X -= num99; dust.position.Y -= num100; } if (Main.rand.NextBool(5)) { int num103 = 4; - int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 33, 0f, 0f, 0, new Color(64, 224, 208), 0.6f); + int num104 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num103, Projectile.position.Y + (float)num103), Projectile.width - num103 * 2, Projectile.height - num103 * 2, 33, 0f, 0f, 0, new Color(64, 224, 208), 0.6f); Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += projectile.velocity * 0.5f; + Main.dust[num104].velocity += Projectile.velocity * 0.5f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, new Color(0, 142, 255), 1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 33, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, new Color(0, 142, 255), 1f); } } } diff --git a/Projectiles/Magic/WulfrumBolt.cs b/Projectiles/Magic/WulfrumBolt.cs index c06793c1bc..23d67e272c 100644 --- a/Projectiles/Magic/WulfrumBolt.cs +++ b/Projectiles/Magic/WulfrumBolt.cs @@ -15,41 +15,41 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.magic = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.1f / 255f, 0f); + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.1f / 255f, 0f); for (int num151 = 0; num151 < 3; num151++) { int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 61, 0f, 0f, 100, default, 3f); + int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 61, 0f, 0f, 100, default, 3f); Main.dust[num155].noGravity = true; Main.dust[num155].noLight = true; Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; + Main.dust[num155].velocity += Projectile.velocity * 0.5f; } if (Main.rand.NextBool(8)) { int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 61, 0f, 0f, 100, default, 2.25f); + int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 61, 0f, 0f, 100, default, 2.25f); Main.dust[num157].velocity *= 0.25f; Main.dust[num157].noLight = true; - Main.dust[num157].velocity += projectile.velocity * 0.5f; + Main.dust[num157].velocity += Projectile.velocity * 0.5f; return; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Magic/WyvernFeatherGreen.cs b/Projectiles/Magic/WyvernFeatherGreen.cs index 64361c3a9e..a9eabc7891 100644 --- a/Projectiles/Magic/WyvernFeatherGreen.cs +++ b/Projectiles/Magic/WyvernFeatherGreen.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -11,45 +12,45 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Feather"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.alpha = 255; - projectile.magic = true; - projectile.aiStyle = 93; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 5; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; + Projectile.aiStyle = 93; aiType = ProjectileID.NailFriendly; - projectile.extraUpdates = 1; + Projectile.extraUpdates = 1; } public override void AI() { if (Main.rand.NextBool(6)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 61, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 61, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 61, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 61, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -59,17 +60,17 @@ namespace CalamityMod.Projectiles.Magic } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 61, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 61, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 61, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 61, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/WyvernFeatherPink.cs b/Projectiles/Magic/WyvernFeatherPink.cs index d533c14268..13c4d33b42 100644 --- a/Projectiles/Magic/WyvernFeatherPink.cs +++ b/Projectiles/Magic/WyvernFeatherPink.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -11,19 +12,19 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Feather"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.alpha = 255; - projectile.magic = true; - projectile.aiStyle = 93; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 5; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; + Projectile.aiStyle = 93; aiType = ProjectileID.NailFriendly; } @@ -31,24 +32,24 @@ namespace CalamityMod.Projectiles.Magic { if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 242, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 242, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 242, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 242, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -58,17 +59,17 @@ namespace CalamityMod.Projectiles.Magic } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 242, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 242, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 242, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 242, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/WyvernFeatherPurple.cs b/Projectiles/Magic/WyvernFeatherPurple.cs index 55f3788c84..9da08b9c01 100644 --- a/Projectiles/Magic/WyvernFeatherPurple.cs +++ b/Projectiles/Magic/WyvernFeatherPurple.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -11,19 +12,19 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Feather"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.alpha = 255; - projectile.magic = true; - projectile.aiStyle = 93; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 5; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; + Projectile.aiStyle = 93; aiType = ProjectileID.NailFriendly; } @@ -31,24 +32,24 @@ namespace CalamityMod.Projectiles.Magic { if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -58,17 +59,17 @@ namespace CalamityMod.Projectiles.Magic } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/WyvernProjectile.cs b/Projectiles/Magic/WyvernProjectile.cs index 243b10458e..c0e697c19d 100644 --- a/Projectiles/Magic/WyvernProjectile.cs +++ b/Projectiles/Magic/WyvernProjectile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -15,51 +16,51 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.magic = true; - projectile.aiStyle = 93; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; + Projectile.aiStyle = 93; } public override void AI() { if (Main.rand.Next(5) == 0) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 16, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 16, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - projectile.timeLeft = 0; + Projectile.timeLeft = 0; } return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCHit7, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit7, Projectile.Center); for (int i = 0; i <= 10; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 16, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 16, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - int head = Gore.NewGore(projectile.Center, projectile.velocity * 0.8f, mod.GetGoreSlot("Gores/WyvernWeapons/WyvernHead")); + int head = Gore.NewGore(Projectile.Center, Projectile.velocity * 0.8f, Mod.GetGoreSlot("Gores/WyvernWeapons/WyvernHead")); Main.gore[head].timeLeft /= 10; - int body = Gore.NewGore(projectile.Center, projectile.velocity * 0.8f, mod.GetGoreSlot("Gores/WyvernWeapons/WyvernBody")); + int body = Gore.NewGore(Projectile.Center, Projectile.velocity * 0.8f, Mod.GetGoreSlot("Gores/WyvernWeapons/WyvernBody")); Main.gore[body].timeLeft /= 10; - int tail = Gore.NewGore(projectile.Center, projectile.velocity * 0.8f, mod.GetGoreSlot("Gores/WyvernWeapons/WyvernTail")); + int tail = Gore.NewGore(Projectile.Center, Projectile.velocity * 0.8f, Mod.GetGoreSlot("Gores/WyvernWeapons/WyvernTail")); Main.gore[tail].timeLeft /= 10; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Magic/YharimsCrystalBeam.cs b/Projectiles/Magic/YharimsCrystalBeam.cs index bcacdac047..821edd7629 100644 --- a/Projectiles/Magic/YharimsCrystalBeam.cs +++ b/Projectiles/Magic/YharimsCrystalBeam.cs @@ -44,21 +44,21 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.magic = true; - projectile.penetrate = -1; - projectile.alpha = 255; + Projectile.width = 18; + Projectile.height = 18; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.alpha = 255; // The beam itself still stops on tiles, but its invisible "source" projectile ignores them. - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().PierceResistHarshness = 0.06f; - projectile.Calamity().PierceResistCap = 0.4f; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Calamity().PierceResistHarshness = 0.06f; + Projectile.Calamity().PierceResistCap = 0.4f; } - public override void SendExtraAI(BinaryWriter writer) => writer.Write(projectile.localAI[1]); - public override void ReceiveExtraAI(BinaryReader reader) => projectile.localAI[1] = reader.ReadSingle(); + public override void SendExtraAI(BinaryWriter writer) => writer.Write(Projectile.localAI[1]); + public override void ReceiveExtraAI(BinaryReader reader) => Projectile.localAI[1] = reader.ReadSingle(); // projectile.ai[0] = 0 through N-1, chosen at spawn = Which beam ID this is (they all have different rotations and colors) // projectile.ai[1] = Index of the crystal projectile "hosting" this beam @@ -67,10 +67,10 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { // If something has gone wrong with either the beam or the host crystal, destroy the beam. - Projectile hostCrystal = Main.projectile[(int)projectile.ai[1]]; - if (projectile.type != ModContent.ProjectileType() || !hostCrystal.active || hostCrystal.type != ModContent.ProjectileType()) + Projectile hostCrystal = Main.projectile[(int)Projectile.ai[1]]; + if (Projectile.type != ModContent.ProjectileType() || !hostCrystal.active || hostCrystal.type != ModContent.ProjectileType()) { - projectile.Kill(); + Projectile.Kill(); return; } Vector2 hostCrystalDir = Vector2.Normalize(hostCrystal.velocity); @@ -78,13 +78,13 @@ namespace CalamityMod.Projectiles.Magic // Update the beam's damage based on the host crystal's current damage value, which accounts for Mana Sickness. // Yharim's Crystal smoothly scales up its damage instead of suddenly jumping to a higher damage output. - projectile.damage = (int)(hostCrystal.damage * GetDamageMultiplier(chargeRatio)); + Projectile.damage = (int)(hostCrystal.damage * GetDamageMultiplier(chargeRatio)); // The beam cannot strike enemies until at a certain charge level. - projectile.friendly = hostCrystal.ai[0] > YharimsCrystalPrism.DamageStart; + Projectile.friendly = hostCrystal.ai[0] > YharimsCrystalPrism.DamageStart; // This offset is used to make the beams orient differently. - float beamIdOffset = (int)projectile.ai[0] - YharimsCrystalPrism.NumBeams / 2f + 0.5f; + float beamIdOffset = (int)Projectile.ai[0] - YharimsCrystalPrism.NumBeams / 2f + 0.5f; float beamSpread; float spinRate; float beamStartSidewaysOffset; @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Magic // Variables scale smoothly while the crystal is charging up, but are fixed once it is at max charge. if (chargeRatio < 1f) { - projectile.scale = MathHelper.Lerp(0f, MaxBeamScale, chargeRatio); + Projectile.scale = MathHelper.Lerp(0f, MaxBeamScale, chargeRatio); beamSpread = MathHelper.Lerp(1.22f, 0f, chargeRatio); beamStartSidewaysOffset = MathHelper.Lerp(20f, 6f, chargeRatio); beamStartForwardsOffset = MathHelper.Lerp(-17f, -13f, chargeRatio); @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Magic if (chargeRatio <= 0.66f) { float phaseRatio = chargeRatio * 1.5f; - projectile.Opacity = MathHelper.Lerp(0f, 0.4f, phaseRatio); + Projectile.Opacity = MathHelper.Lerp(0f, 0.4f, phaseRatio); spinRate = MathHelper.Lerp(20f, 16f, phaseRatio); } @@ -112,14 +112,14 @@ namespace CalamityMod.Projectiles.Magic else { float phaseRatio = (chargeRatio - 0.66f) * 3f; - projectile.Opacity = MathHelper.Lerp(0.4f, 1f, phaseRatio); + Projectile.Opacity = MathHelper.Lerp(0.4f, 1f, phaseRatio); spinRate = MathHelper.Lerp(16f, 6f, phaseRatio); } } else { - projectile.scale = MaxBeamScale; - projectile.Opacity = 1f; + Projectile.scale = MaxBeamScale; + Projectile.Opacity = 1f; beamSpread = 0f; spinRate = 6f; beamStartSidewaysOffset = 6f; @@ -135,42 +135,42 @@ namespace CalamityMod.Projectiles.Magic Vector2 beamSpanVector = (unitRot * yVec).RotatedBy(hostCrystalAngle); // Calculate the beam's emanating position. Start with the crystal center. - projectile.Center = hostCrystal.Center; + Projectile.Center = hostCrystal.Center; // Add a fixed offset to align with the crystal's spritesheet (?) - projectile.position += hostCrystalDir * BeamPosOffset + new Vector2(0f, -hostCrystal.gfxOffY); + Projectile.position += hostCrystalDir * BeamPosOffset + new Vector2(0f, -hostCrystal.gfxOffY); // Add the forwards offset, measured in pixels. - projectile.position += hostCrystalDir * beamStartForwardsOffset; + Projectile.position += hostCrystalDir * beamStartForwardsOffset; // Add the sideways offset vector, which is calculated for the current angle of the beam and scales with the beam's sideways offset. - projectile.position += beamSpanVector; + Projectile.position += beamSpanVector; // Set the beam's velocity to point towards its current spread direction and sanity check it. It should have magnitude 1. - projectile.velocity = hostCrystalDir.RotatedBy(sinusoidYOffset); - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - projectile.velocity = -Vector2.UnitY; - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.velocity = hostCrystalDir.RotatedBy(sinusoidYOffset); + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) + Projectile.velocity = -Vector2.UnitY; + Projectile.rotation = Projectile.velocity.ToRotation(); // By default, the interpolation starts at the projectile's center. // If the host crystal is fully charged, the interpolation starts at the host crystal's center instead. // Overriding that, if the player shoves the crystal into or through a wall, the interpolation starts at the player's center. - Vector2 samplingPoint = projectile.Center; + Vector2 samplingPoint = Projectile.Center; if(hostCrystal.ai[0] >= YharimsCrystalPrism.MaxCharge) samplingPoint = hostCrystal.Center; - if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, hostCrystal.Center, 0, 0)) - samplingPoint = Main.player[projectile.owner].Center; + if (!Collision.CanHitLine(Main.player[Projectile.owner].Center, 0, 0, hostCrystal.Center, 0, 0)) + samplingPoint = Main.player[Projectile.owner].Center; // Perform a laser scan to calculate the correct length of the beam. // Alternatively, if the beam ignores tiles, just set it to be the max beam length with the following line. // projectile.localAI[1] = MaxBeamLength; float[] laserScanResults = new float[NumSamplePoints]; - Collision.LaserScan(samplingPoint, projectile.velocity, BeamTileCollisionWidth * projectile.scale, MaxBeamLength, laserScanResults); + Collision.LaserScan(samplingPoint, Projectile.velocity, BeamTileCollisionWidth * Projectile.scale, MaxBeamLength, laserScanResults); float avg = 0f; for (int i = 0; i < laserScanResults.Length; ++i) avg += laserScanResults[i]; avg /= NumSamplePoints; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], avg, BeamLengthChangeFactor); + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], avg, BeamLengthChangeFactor); // X = beam length. Y = beam width. - Vector2 beamDims = new Vector2(projectile.velocity.Length() * projectile.localAI[1], projectile.width * projectile.scale); + Vector2 beamDims = new Vector2(Projectile.velocity.Length() * Projectile.localAI[1], Projectile.width * Projectile.scale); // Only produce dust and cause water ripples if the beam is above a certain charge level. Color beamColor = GetBeamColor(); @@ -184,17 +184,17 @@ namespace CalamityMod.Projectiles.Magic WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); // A universal time-based sinusoid which updates extremely rapidly. GlobalTime is 0 to 3600, measured in seconds. float waveSine = 0.1f * (float)Math.Sin(Main.GlobalTime * 20f); - Vector2 ripplePos = projectile.position + new Vector2(beamDims.X * 0.5f, 0f).RotatedBy(projectile.rotation); + Vector2 ripplePos = Projectile.position + new Vector2(beamDims.X * 0.5f, 0f).RotatedBy(Projectile.rotation); // WaveData is encoded as a Color. Not sure why, considering Vector3 exists. Color waveData = new Color(0.5f, 0.1f * Math.Sign(waveSine) + 0.5f, 0f, 1f) * Math.Abs(waveSine); - wsd.QueueRipple(ripplePos, waveData, beamDims, RippleShape.Square, projectile.rotation); + wsd.QueueRipple(ripplePos, waveData, beamDims, RippleShape.Square, Projectile.rotation); } } // Make the beam cast light along its length. The brightness of the light scales with the charge. // v3_1 is an unnamed decompiled variable which is the color of the light cast by DelegateMethods.CastLight DelegateMethods.v3_1 = beamColor.ToVector3() * BeamLightBrightness * chargeRatio; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], beamDims.Y, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], beamDims.Y, new Utils.PerLinePoint(DelegateMethods.CastLight)); } // Uses a simple polynomial (x^3) to get sudden but smooth damage increase near the end of the charge-up period. @@ -212,38 +212,38 @@ namespace CalamityMod.Projectiles.Magic return true; // Otherwise, perform an AABB line collision check to check the whole beam. float _ = float.NaN; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], BeamHitboxCollisionWidth * projectile.scale, ref _); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], BeamHitboxCollisionWidth * Projectile.scale, ref _); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { // If the beam doesn't have a defined direction, don't draw anything. - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - float beamLength = projectile.localAI[1]; - Vector2 centerFloored = projectile.Center.Floor() + projectile.velocity * projectile.scale * BeamRenderTileOffset; - Vector2 scaleVec = new Vector2(projectile.scale); + Texture2D tex = Main.projectileTexture[Projectile.type]; + float beamLength = Projectile.localAI[1]; + Vector2 centerFloored = Projectile.Center.Floor() + Projectile.velocity * Projectile.scale * BeamRenderTileOffset; + Vector2 scaleVec = new Vector2(Projectile.scale); // Reduce the beam length proportional to its square area to reduce block penetration. - beamLength -= BeamLengthReductionFactor * projectile.scale * projectile.scale; + beamLength -= BeamLengthReductionFactor * Projectile.scale * Projectile.scale; DelegateMethods.f_1 = 1f; // f_1 is an unnamed decompiled variable whose function is unknown. Leave it at 1. Vector2 beamStartPos = centerFloored - Main.screenPosition; - Vector2 beamEndPos = beamStartPos + projectile.velocity * beamLength; + Vector2 beamEndPos = beamStartPos + Projectile.velocity * beamLength; Utils.LaserLineFraming llf = new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw); // Draw the outer beam // c_1 is an unnamed decompiled variable which is the render color of the beam drawn by DelegateMethods.RainbowLaserDraw Color outerBeamColor = GetBeamColor(); - DelegateMethods.c_1 = outerBeamColor * OuterBeamOpacityMultiplier * projectile.Opacity; + DelegateMethods.c_1 = outerBeamColor * OuterBeamOpacityMultiplier * Projectile.Opacity; Utils.DrawLaser(Main.spriteBatch, tex, beamStartPos, beamEndPos, scaleVec, llf); // Draw the inner beam (reduced size) scaleVec *= 0.5f; Color innerBeamColor = Color.White; - DelegateMethods.c_1 = innerBeamColor * InnerBeamOpacityMultiplier * projectile.Opacity; + DelegateMethods.c_1 = innerBeamColor * InnerBeamOpacityMultiplier * Projectile.Opacity; Utils.DrawLaser(Main.spriteBatch, tex, beamStartPos, beamEndPos, scaleVec, llf); return false; } @@ -251,11 +251,11 @@ namespace CalamityMod.Projectiles.Magic private void ProduceBeamDust(Color beamColor) { // Create a few dust per frame a small distance from where the beam ends. - Vector2 laserEndPos = projectile.Center + projectile.velocity * (projectile.localAI[1] - MainDustBeamEndOffset * projectile.scale); + Vector2 laserEndPos = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - MainDustBeamEndOffset * Projectile.scale); for (int i = 0; i < 2; ++i) { // 50% chance for the dust to come off on either side of the beam. - float dustAngle = projectile.rotation + (Main.rand.NextBool() ? 1f : -1f) * MathHelper.PiOver2; + float dustAngle = Projectile.rotation + (Main.rand.NextBool() ? 1f : -1f) * MathHelper.PiOver2; float dustStartDist = Main.rand.NextFloat(1f, 1.8f); Vector2 dustVel = dustAngle.ToRotationVector2() * dustStartDist; int d = Dust.NewDust(laserEndPos, 0, 0, 244, dustVel.X, dustVel.Y, 0, beamColor, 3.3f); @@ -264,14 +264,14 @@ namespace CalamityMod.Projectiles.Magic Main.dust[d].scale = 1.2f; // Scale up dust with the projectile if it's large. - if (projectile.scale > 1f) + if (Projectile.scale > 1f) { - Main.dust[d].velocity *= projectile.scale; - Main.dust[d].scale *= projectile.scale; + Main.dust[d].velocity *= Projectile.scale; + Main.dust[d].scale *= Projectile.scale; } // If the beam isn't at max scale, then make additional smaller dust. - if (projectile.scale != MaxBeamScale) + if (Projectile.scale != MaxBeamScale) { Dust smallDust = Dust.CloneDust(d); smallDust.scale /= 2f; @@ -282,7 +282,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(5)) { // Velocity, flipped sideways, times -50% to 50% of beam width. - Vector2 dustOffset = projectile.velocity.RotatedBy(MathHelper.PiOver2) * (Main.rand.NextFloat() - 0.5f) * projectile.width; + Vector2 dustOffset = Projectile.velocity.RotatedBy(MathHelper.PiOver2) * (Main.rand.NextFloat() - 0.5f) * Projectile.width; Vector2 dustPos = laserEndPos + dustOffset - Vector2.One * SidewaysDustBeamEndOffset; int dustID = 244; int d = Dust.NewDust(dustPos, 8, 8, dustID, 0f, 0f, 100, beamColor, 5f); @@ -295,7 +295,7 @@ namespace CalamityMod.Projectiles.Magic private Color GetBeamColor() { - float customHue = GetHue(projectile.ai[0]); + float customHue = GetHue(Projectile.ai[0]); float sat = 0.66f; Color c = Main.hslToRgb(customHue, sat, 0.53f); c.A = 64; @@ -305,8 +305,8 @@ namespace CalamityMod.Projectiles.Magic // indexing = 0 through N-1 (it's beam ID, stored in projectile.ai[0]) private float GetHue(float indexing) { - string name = Main.player[projectile.owner].name ?? ""; - if (Main.player[projectile.owner].active) + string name = Main.player[Projectile.owner].name ?? ""; + if (Main.player[Projectile.owner].active) { switch (name) { @@ -354,9 +354,9 @@ namespace CalamityMod.Projectiles.Magic // tilecut_0 is an unnamed decompiled variable which tells CutTiles how the tiles are being cut (in this case, via a projectile). DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; Utils.PerLinePoint cut = new Utils.PerLinePoint(DelegateMethods.CutTiles); - Vector2 beamStartPos = projectile.Center; - Vector2 beamEndPos = beamStartPos + projectile.velocity * projectile.localAI[1]; - Utils.PlotTileLine(beamStartPos, beamEndPos, projectile.width * projectile.scale, cut); + Vector2 beamStartPos = Projectile.Center; + Vector2 beamEndPos = beamStartPos + Projectile.velocity * Projectile.localAI[1]; + Utils.PlotTileLine(beamStartPos, beamEndPos, Projectile.width * Projectile.scale, cut); } } } diff --git a/Projectiles/Magic/YharimsCrystalPrism.cs b/Projectiles/Magic/YharimsCrystalPrism.cs index 7447510c99..dbac701d1b 100644 --- a/Projectiles/Magic/YharimsCrystalPrism.cs +++ b/Projectiles/Magic/YharimsCrystalPrism.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -20,18 +21,18 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Yermes Christal"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.NeedsUUID[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 22; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = 14; + Projectile.height = 22; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } // TODO -- Make property wrappers for these variables instead of needing to explain them. @@ -39,46 +40,46 @@ namespace CalamityMod.Projectiles.Magic // localAI[0] is the number of frames between mana consumptions. public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true); // Update damage based on curent magic damage stat (so Mana Sickness affects it) - projectile.damage = (int)((player.ActiveItem()?.damage ?? 0) * player.MagicDamage()); + Projectile.damage = (int)((player.ActiveItem()?.damage ?? 0) * player.MagicDamage()); // ai[0] is the overall frame counter. - projectile.ai[0] += 1f; - float chargeRatio = MathHelper.Clamp(projectile.ai[0] / MaxCharge, 0f, 1f); + Projectile.ai[0] += 1f; + float chargeRatio = MathHelper.Clamp(Projectile.ai[0] / MaxCharge, 0f, 1f); // Update the crystal's animation, with the animation accelerating as the crystal charges - projectile.frameCounter++; - int framesPerAnimationUpdate = projectile.ai[0] >= MaxCharge ? 2 : projectile.ai[0] >= (MaxCharge * 0.66f) ? 3 : 4; - if (projectile.frameCounter >= framesPerAnimationUpdate) + Projectile.frameCounter++; + int framesPerAnimationUpdate = Projectile.ai[0] >= MaxCharge ? 2 : Projectile.ai[0] >= (MaxCharge * 0.66f) ? 3 : 4; + if (Projectile.frameCounter >= framesPerAnimationUpdate) { - projectile.frameCounter = 0; - if (++projectile.frame >= 6) - projectile.frame = 0; + Projectile.frameCounter = 0; + if (++Projectile.frame >= 6) + Projectile.frame = 0; } // Make sound intermittently while the crystal is in use - if (projectile.soundDelay <= 0) + if (Projectile.soundDelay <= 0) { - projectile.soundDelay = SoundInterval; + Projectile.soundDelay = SoundInterval; // Don't play the continuous beam sound the first time around - if (projectile.ai[0] > 1f) - Main.PlaySound(SoundID.Item15, projectile.position); + if (Projectile.ai[0] > 1f) + SoundEngine.PlaySound(SoundID.Item15, Projectile.position); } // Once the crystal reaches a certain charge, start producing dust. More charge = more dust. - if (projectile.ai[0] > DustStart && Main.rand.NextFloat() < chargeRatio) + if (Projectile.ai[0] > DustStart && Main.rand.NextFloat() < chargeRatio) SpawnEjectionDust(chargeRatio); UpdatePlayerVisuals(player, rrp); // Update the crystal's existence: project beams on frame 1, and despawn if out of mana. - if (projectile.owner == Main.myPlayer) + 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.ActiveItem().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. @@ -86,39 +87,39 @@ namespace CalamityMod.Projectiles.Magic bool crystalStillInUse = player.channel && allowContinuedUse && !player.noItems && !player.CCed; // The beams are only projected once (on frame 1). - if (crystalStillInUse && projectile.ai[0] == 1f) + if (crystalStillInUse && Projectile.ai[0] == 1f) { - Vector2 beamVelocity = Vector2.Normalize(projectile.velocity); + Vector2 beamVelocity = Vector2.Normalize(Projectile.velocity); if (beamVelocity.HasNaNs()) beamVelocity = -Vector2.UnitY; - int damage = projectile.damage; - float kb = projectile.knockBack; // should always be 0 + int damage = Projectile.damage; + float kb = Projectile.knockBack; // should always be 0 for (int b = 0; b < NumBeams; b++) - Projectile.NewProjectile(projectile.Center, beamVelocity, ModContent.ProjectileType(), damage, kb, projectile.owner, b, Projectile.GetByUUID(projectile.owner, projectile.whoAmI)); - projectile.netUpdate = true; + Projectile.NewProjectile(Projectile.Center, beamVelocity, ModContent.ProjectileType(), damage, kb, Projectile.owner, b, Projectile.GetByUUID(Projectile.owner, Projectile.whoAmI)); + Projectile.netUpdate = true; } else if (!crystalStillInUse) - projectile.Kill(); + Projectile.Kill(); } // Ensures the crystal will disappear immediately if anything goes wrong - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } private bool ShouldConsumeMana() { // If the mana consumption timer hasn't been initialized yet, initialize it and consume mana on frame 1. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.ai[1] = projectile.localAI[0] = MaxManaConsumptionDelay; + Projectile.ai[1] = Projectile.localAI[0] = MaxManaConsumptionDelay; return true; } - bool consume = projectile.ai[0] == projectile.ai[1]; + bool consume = Projectile.ai[0] == Projectile.ai[1]; if(consume) { - projectile.localAI[0] = MathHelper.Clamp(projectile.localAI[0] - 1f, MinManaConsumptionDelay, MaxManaConsumptionDelay); - projectile.ai[1] += projectile.localAI[0]; + Projectile.localAI[0] = MathHelper.Clamp(Projectile.localAI[0] - 1f, MinManaConsumptionDelay, MaxManaConsumptionDelay); + Projectile.ai[1] += Projectile.localAI[0]; } return consume; } @@ -129,42 +130,42 @@ namespace CalamityMod.Projectiles.Magic Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); if (aimVector.HasNaNs()) aimVector = -Vector2.UnitY; - aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(projectile.velocity), AimResponsiveness)); + aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(Projectile.velocity), AimResponsiveness)); aimVector *= speed; - if (aimVector != projectile.velocity) - projectile.netUpdate = true; - projectile.velocity = aimVector; + if (aimVector != Projectile.velocity) + Projectile.netUpdate = true; + Projectile.velocity = aimVector; } private void UpdatePlayerVisuals(Player player, Vector2 rrp) { // Place the projectile directly into the player's hand at all times - projectile.Center = rrp; + Projectile.Center = rrp; // The beam comes out of the tip of the crystal, not the side - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.spriteDirection = projectile.direction; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.spriteDirection = Projectile.direction; // The crystal is a holdout projectile, so change the player's variables to reflect that - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; // Multiplying by projectile.direction is required due to vanilla spaghetti. - player.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + player.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } private void SpawnEjectionDust(float charge) { - Vector2 projDir = Vector2.Normalize(projectile.velocity); + Vector2 projDir = Vector2.Normalize(Projectile.velocity); int dustType = 90; float dustAngle = MathHelper.Pi * 0.76f * (Main.rand.NextBool() ? 1f : -1f); float scale = Main.rand.NextFloat(0.9f, 1.2f); float speed = 18f * charge; Vector2 dustVel = projDir.RotatedBy(dustAngle) * speed; float dustForwardOffset = 11f; - Vector2 dustOrigin = projectile.Center + dustForwardOffset * projDir; + Vector2 dustOrigin = Projectile.Center + dustForwardOffset * projDir; Dust d = Dust.NewDustDirect(dustOrigin, 1, 1, dustType, dustVel.X, dustVel.Y); d.position += Main.rand.NextVector2Circular(2f, 2f); d.noGravity = true; @@ -174,12 +175,12 @@ namespace CalamityMod.Projectiles.Magic // Completely custom drawcode because it's a holdout projectile. The projectile is also fullbright. public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects eff = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D tex = Main.projectileTexture[projectile.type]; - int frameHeight = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int texYOffset = frameHeight * projectile.frame; - Vector2 sheetInsertVec = (projectile.Center + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition).Floor(); - Main.spriteBatch.Draw(tex, sheetInsertVec, new Rectangle?(new Rectangle(0, texYOffset, tex.Width, frameHeight)), Color.White, projectile.rotation, new Vector2(tex.Width / 2f, frameHeight / 2f), projectile.scale, eff, 0f); + SpriteEffects eff = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D tex = Main.projectileTexture[Projectile.type]; + int frameHeight = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int texYOffset = frameHeight * Projectile.frame; + Vector2 sheetInsertVec = (Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition).Floor(); + Main.spriteBatch.Draw(tex, sheetInsertVec, new Rectangle?(new Rectangle(0, texYOffset, tex.Width, frameHeight)), Color.White, Projectile.rotation, new Vector2(tex.Width / 2f, frameHeight / 2f), Projectile.scale, eff, 0f); return false; } } diff --git a/Projectiles/Melee/AegisBeam.cs b/Projectiles/Melee/AegisBeam.cs index 5f37d4e7dd..75d115ef3e 100644 --- a/Projectiles/Melee/AegisBeam.cs +++ b/Projectiles/Melee/AegisBeam.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -15,47 +16,47 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.alpha = 255; - projectile.melee = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0f); - projectile.rotation += 1f; - projectile.alpha -= 25; - if (projectile.alpha < 0) + Lighting.AddLight(Projectile.Center, 0.25f, 0.25f, 0f); + Projectile.rotation += 1f; + Projectile.alpha -= 25; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 73); + Projectile.localAI[0] += 1f; } - int num458 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 0.8f); + int num458 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 0.8f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item20, projectile.Center); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); for (int d = 0; d <= 30; d++) { float num463 = (float)Main.rand.Next(-10, 11); @@ -65,23 +66,23 @@ namespace CalamityMod.Projectiles.Melee num466 = speed / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.2f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.2f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; dust.velocity.Y = num464; } int flameAmt = Main.rand.Next(2, 4); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < flameAmt; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/AegisBlast.cs b/Projectiles/Melee/AegisBlast.cs index 66124d9b3c..ef227f267d 100644 --- a/Projectiles/Melee/AegisBlast.cs +++ b/Projectiles/Melee/AegisBlast.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -17,60 +18,60 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 150; - projectile.height = 150; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.melee = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 150; + Projectile.height = 150; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0f / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0f / 255f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 74); + Projectile.localAI[0] += 1f; } bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -81,10 +82,10 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; + Main.dust[num467].position.X = Projectile.Center.X; + Main.dust[num467].position.Y = Projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; @@ -97,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.damage = (int)(projectile.damage * 0.95); + Projectile.damage = (int)(Projectile.damage * 0.95); } } } diff --git a/Projectiles/Melee/AegisBlast2.cs b/Projectiles/Melee/AegisBlast2.cs index 8caed9f8a2..ff29cdfb8b 100644 --- a/Projectiles/Melee/AegisBlast2.cs +++ b/Projectiles/Melee/AegisBlast2.cs @@ -15,55 +15,55 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 5; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0f / 255f); bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -74,10 +74,10 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; + Main.dust[num467].position.X = Projectile.Center.X; + Main.dust[num467].position.Y = Projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; diff --git a/Projectiles/Melee/AegisFlame.cs b/Projectiles/Melee/AegisFlame.cs index 7d60e6401e..d8a32e68c2 100644 --- a/Projectiles/Melee/AegisFlame.cs +++ b/Projectiles/Melee/AegisFlame.cs @@ -14,45 +14,45 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.melee = true; + Projectile.width = 6; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + Projectile.velocity.X = Projectile.velocity.X * -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + Projectile.rotation += Projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); Dust expr_8976_cp_0 = Main.dust[num199]; expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; @@ -72,20 +72,20 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + Projectile.velocity.X = Projectile.velocity.X * 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) + Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)damage * 0.75), knockback, Main.myPlayer); } diff --git a/Projectiles/Melee/AftershockRock.cs b/Projectiles/Melee/AftershockRock.cs index 22cea92f68..6b4c141397 100644 --- a/Projectiles/Melee/AftershockRock.cs +++ b/Projectiles/Melee/AftershockRock.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 32; - projectile.height = 34; - projectile.aiStyle = 14; - projectile.friendly = true; - projectile.penetrate = 6; - projectile.extraUpdates = 1; - projectile.melee = true; - projectile.ignoreWater = true; + Projectile.width = 32; + Projectile.height = 34; + Projectile.aiStyle = 14; + Projectile.friendly = true; + Projectile.penetrate = 6; + Projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; aiType = ProjectileID.BoulderStaffOfEarth; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } } } diff --git a/Projectiles/Melee/AmidiasWhirlpool.cs b/Projectiles/Melee/AmidiasWhirlpool.cs index 1b5c626512..587fc1b402 100644 --- a/Projectiles/Melee/AmidiasWhirlpool.cs +++ b/Projectiles/Melee/AmidiasWhirlpool.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -11,78 +12,78 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Whirlpool"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 58; - projectile.height = 58; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.alpha = 100; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.melee = true; + Projectile.width = 58; + Projectile.height = 58; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.alpha = 100; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { for (int num105 = 0; num105 < 2; num105++) { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; + float num99 = Projectile.velocity.X / 3f * (float)num105; + float num100 = Projectile.velocity.Y / 3f * (float)num105; int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); + int num102 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num101, Projectile.position.Y + (float)num101), Projectile.width - num101 * 2, Projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); Dust dust = Main.dust[num102]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.1f; + dust.velocity += Projectile.velocity * 0.1f; dust.position.X -= num99; dust.position.Y -= num100; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num1013 = 0; - if (projectile.velocity.Length() <= 8f) //4 + if (Projectile.velocity.Length() <= 8f) //4 { num1013 = 1; } if (num1013 == 0) { - projectile.rotation -= 0.104719758f; + Projectile.rotation -= 0.104719758f; - if (projectile.ai[0] >= 30f) + if (Projectile.ai[0] >= 30f) { - projectile.velocity *= 0.98f; - projectile.rotation -= 0.0174532924f; + Projectile.velocity *= 0.98f; + Projectile.rotation -= 0.0174532924f; } - if (projectile.velocity.Length() < 8.2f) //4.1 + if (Projectile.velocity.Length() < 8.2f) //4.1 { - projectile.velocity.Normalize(); - projectile.velocity *= 4f; - projectile.ai[0] = 0f; + Projectile.velocity.Normalize(); + Projectile.velocity *= 4f; + Projectile.ai[0] = 0f; } } else if (num1013 == 1) { int num3; - projectile.rotation -= 0.104719758f; - Vector2 vector145 = projectile.Center; + Projectile.rotation -= 0.104719758f; + Vector2 vector145 = Projectile.Center; float num1015 = 150f; bool flag59 = false; int num1016 = 0; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { for (int num1017 = 0; num1017 < 200; num1017 = num3 + 1) { - if (Main.npc[num1017].CanBeChasedBy(projectile, false)) + if (Main.npc[num1017].CanBeChasedBy(Projectile, false)) { Vector2 center13 = Main.npc[num1017].Center; - if (projectile.Distance(center13) < num1015 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num1017].position, Main.npc[num1017].width, Main.npc[num1017].height)) + if (Projectile.Distance(center13) < num1015 && Collision.CanHit(new Vector2(Projectile.position.X + (float)(Projectile.width / 2), Projectile.position.Y + (float)(Projectile.height / 2)), 1, 1, Main.npc[num1017].position, Main.npc[num1017].width, Main.npc[num1017].height)) { - num1015 = projectile.Distance(center13); + num1015 = Projectile.Distance(center13); vector145 = center13; flag59 = true; num1016 = num1017; @@ -93,24 +94,24 @@ namespace CalamityMod.Projectiles.Melee } if (flag59) { - if (projectile.ai[1] != (float)(num1016 + 1)) + if (Projectile.ai[1] != (float)(num1016 + 1)) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.ai[1] = (float)(num1016 + 1); + Projectile.ai[1] = (float)(num1016 + 1); } flag59 = false; } - if (projectile.ai[1] != 0f) + if (Projectile.ai[1] != 0f) { - int num1018 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num1018].active && Main.npc[num1018].CanBeChasedBy(projectile, true) && projectile.Distance(Main.npc[num1018].Center) < 1000f) + int num1018 = (int)(Projectile.ai[1] - 1f); + if (Main.npc[num1018].active && Main.npc[num1018].CanBeChasedBy(Projectile, true) && Projectile.Distance(Main.npc[num1018].Center) < 1000f) { flag59 = true; vector145 = Main.npc[num1018].Center; } } - if (!projectile.friendly) + if (!Projectile.friendly) { flag59 = false; } @@ -118,21 +119,21 @@ namespace CalamityMod.Projectiles.Melee { float num1019 = 24f; int num1020 = 10; - Vector2 vector146 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector146 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num1021 = vector145.X - vector146.X; float num1022 = vector145.Y - vector146.Y; float num1023 = (float)Math.Sqrt((double)(num1021 * num1021 + num1022 * num1022)); num1023 = num1019 / num1023; num1021 *= num1023; num1022 *= num1023; - projectile.velocity.X = (projectile.velocity.X * (float)(num1020 - 1) + num1021) / (float)num1020; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num1020 - 1) + num1022) / (float)num1020; + Projectile.velocity.X = (Projectile.velocity.X * (float)(num1020 - 1) + num1021) / (float)num1020; + Projectile.velocity.Y = (Projectile.velocity.Y * (float)(num1020 - 1) + num1022) / (float)num1020; } } - Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.9f); - if (projectile.ai[0] >= 120f) + Lighting.AddLight(Projectile.Center, 0f, 0.1f, 0.9f); + if (Projectile.ai[0] >= 120f) { - projectile.Kill(); + Projectile.Kill(); } } @@ -143,10 +144,10 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 10); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 10); for (int k = 0; k < 20; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X, projectile.oldVelocity.Y, 0, new Color(0, 142, 255), 1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 33, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 0, new Color(0, 142, 255), 1f); } } } diff --git a/Projectiles/Melee/AncientBeam.cs b/Projectiles/Melee/AncientBeam.cs index 06aaacdc6f..ef915d0421 100644 --- a/Projectiles/Melee/AncientBeam.cs +++ b/Projectiles/Melee/AncientBeam.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -17,48 +18,48 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Ancient Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } const float MaxTime = 40; - public float Timer => MaxTime - projectile.timeLeft; + public float Timer => MaxTime - Projectile.timeLeft; public override void SetDefaults() { - projectile.width = projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = (int)MaxTime; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = (int)MaxTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 34f * projectile.scale; - Vector2 start = -Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * 8.5f; + float bladeLenght = 34f * Projectile.scale; + Vector2 start = -Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 8.5f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center + start, projectile.Center + start + Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint); } public override void AI() { - if (projectile.timeLeft < MaxTime - 5) - projectile.tileCollide = true; + if (Projectile.timeLeft < MaxTime - 5) + Projectile.tileCollide = true; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; - projectile.scale = 2.4f; - projectile.Opacity = 0.6f; - Lighting.AddLight(projectile.Center, 0.75f, 1f, 0.24f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.scale = 2.4f; + Projectile.Opacity = 0.6f; + Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); - projectile.velocity *= (1 - (float)Math.Pow(Timer / MaxTime, 3)); + Projectile.velocity *= (1 - (float)Math.Pow(Timer / MaxTime, 3)); if (Main.rand.NextBool(3)) { - int dustTrail = Dust.NewDust(projectile.Center, 14, 14, 66, projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + int dustTrail = Dust.NewDust(Projectile.Center, 14, 14, 66, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); Main.dust[dustTrail].noGravity = true; } @@ -67,38 +68,38 @@ namespace CalamityMod.Projectiles.Melee int dustType = Main.rand.Next(3); dustType = dustType == 0 ? 15 : dustType == 1 ? 57 : 58; - Dust.NewDust(projectile.Center, 14, 14, dustType, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 150, default, 1.3f); + Dust.NewDust(Projectile.Center, 14, 14, dustType, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 150, default, 1.3f); } - if (projectile.velocity.Length() < 1.0f) - projectile.Kill(); + if (Projectile.velocity.Length() < 1.0f) + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 35) + if (Projectile.timeLeft > 35) return false; - DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.DD2_WitherBeastDeath, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath, Projectile.Center); for (int i = 0; i < 10; i++) { Vector2 particleSpeed = Main.rand.NextVector2CircularEdge(1, 1) * Main.rand.NextFloat(1.2f, 2.3f); - Particle energyLeak = new SquishyLightParticle(projectile.Center + Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * 40f, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Cyan, 60, 1, 1.5f, hueShift: 0.02f); + Particle energyLeak = new SquishyLightParticle(Projectile.Center + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 40f, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Cyan, 60, 1, 1.5f, hueShift: 0.02f); GeneralParticleHandler.SpawnParticle(energyLeak); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : projectile.Center + projectile.rotation.ToRotationVector2() * 60f; + Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f; for (int i = 0; i < 10; i++) { Vector2 particleSpeed = Main.rand.NextVector2CircularEdge(1, 1) * Main.rand.NextFloat(2.6f, 4f); diff --git a/Projectiles/Melee/AncientStar.cs b/Projectiles/Melee/AncientStar.cs index 3042152bc6..713e961037 100644 --- a/Projectiles/Melee/AncientStar.cs +++ b/Projectiles/Melee/AncientStar.cs @@ -5,107 +5,108 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class AncientStar : ModProjectile { const float MaxTime = 120; - public float Timer => MaxTime - projectile.timeLeft; + public float Timer => MaxTime - Projectile.timeLeft; - public ref float Shine => ref projectile.ai[0]; + public ref float Shine => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Ancient Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = (int)MaxTime; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = (int)MaxTime; } public override void AI() { if (Timer == 0) { - Particle spark = new CritSpark(projectile.Center, Vector2.Zero, Color.White, Color.Cyan, Main.rand.NextFloat(2.3f, 2.6f), 20, 0.1f, 1.5f, hueShift: 0.02f); + Particle spark = new CritSpark(Projectile.Center, Vector2.Zero, Color.White, Color.Cyan, Main.rand.NextFloat(2.3f, 2.6f), 20, 0.1f, 1.5f, hueShift: 0.02f); GeneralParticleHandler.SpawnParticle(spark); for (int i = 0; i < 4; i++) { - Vector2 particleSpeed = projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.8f) * 0.1f; - Particle energyLeak = new SquishyLightParticle(projectile.Center, particleSpeed, Main.rand.NextFloat(0.8f, 1.4f), Color.Cyan, 60, 0.3f, 1.5f, hueShift: 0.02f); + Vector2 particleSpeed = Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.8f) * 0.1f; + Particle energyLeak = new SquishyLightParticle(Projectile.Center, particleSpeed, Main.rand.NextFloat(0.8f, 1.4f), Color.Cyan, 60, 0.3f, 1.5f, hueShift: 0.02f); GeneralParticleHandler.SpawnParticle(energyLeak); } } - if (projectile.timeLeft < MaxTime - 5) + if (Projectile.timeLeft < MaxTime - 5) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } if (Timer / MaxTime > 0.25f) { - projectile.velocity *= 0.95f; + Projectile.velocity *= 0.95f; } int dustType = Main.rand.Next(3); dustType = dustType == 0 ? 15 : dustType == 1 ? 57 : 58; - Dust.NewDust(projectile.Center, 14, 14, dustType, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 150, default, 1.3f); + Dust.NewDust(Projectile.Center, 14, 14, dustType, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 150, default, 1.3f); - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); } } if (Main.rand.NextBool(48)) { - int starGore = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + int starGore = Gore.NewGore(Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[starGore].velocity *= 0.66f; - Main.gore[starGore].velocity += projectile.velocity * 0.3f; + Main.gore[starGore].velocity += Projectile.velocity * 0.3f; } - if (projectile.velocity.Length() < 2f) + if (Projectile.velocity.Length() < 2f) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); if (Shine == 1f) { spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D starTexture = ModContent.GetTexture("CalamityMod/Particles/Sparkle"); - Texture2D bloomTexture = ModContent.GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D starTexture = ModContent.Request("CalamityMod/Particles/Sparkle"); + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; Color color = Main.hslToRgb((Main.GlobalTime * 0.6f) % 1, 1, 0.85f); float rotation = Main.GlobalTime * 8f; - Vector2 sparkCenter = projectile.Center - Main.screenPosition; + Vector2 sparkCenter = Projectile.Center - Main.screenPosition; spriteBatch.Draw(bloomTexture, sparkCenter, null, color * 0.5f, 0, bloomTexture.Size() / 2f, 2 * properBloomSize, SpriteEffects.None, 0); spriteBatch.Draw(starTexture, sparkCenter, null, color * 0.5f, rotation + MathHelper.PiOver4, starTexture.Size() / 2f, 1 * 0.75f, SpriteEffects.None, 0); @@ -120,20 +121,20 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - var breakSound = Main.PlaySound(SoundID.DD2_WitherBeastDeath, projectile.Center); + var breakSound = SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath, Projectile.Center); if (breakSound != null) breakSound.Volume *= 0.5f; for (int i = 0; i < 5; i++) { Vector2 particleSpeed = Main.rand.NextVector2CircularEdge(1, 1) * Main.rand.NextFloat(5.2f, 4.3f); - Particle spark = new CritSpark(projectile.Center, particleSpeed, Color.White, Color.Cyan, Main.rand.NextFloat(1.3f, 1.6f), 40, 0.1f, 3.5f, hueShift: 0.02f); + Particle spark = new CritSpark(Projectile.Center, particleSpeed, Color.White, Color.Cyan, Main.rand.NextFloat(1.3f, 1.6f), 40, 0.1f, 3.5f, hueShift: 0.02f); GeneralParticleHandler.SpawnParticle(spark); } for (int i = 0; i < 3; i++) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } } } diff --git a/Projectiles/Melee/AquaStream.cs b/Projectiles/Melee/AquaStream.cs index 8aae7b63eb..92a544326c 100644 --- a/Projectiles/Melee/AquaStream.cs +++ b/Projectiles/Melee/AquaStream.cs @@ -14,26 +14,26 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.scale = 1f; - projectile.friendly = true; - projectile.alpha = 150; - projectile.penetrate = 1; - projectile.timeLeft = 14; - projectile.melee = true; + Projectile.width = 6; + Projectile.height = 6; + Projectile.scale = 1f; + Projectile.friendly = true; + Projectile.alpha = 150; + Projectile.penetrate = 1; + Projectile.timeLeft = 14; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { //projectile.ai[0] is the X increment while projectile.ai[1] is the Y increment - projectile.velocity.X += projectile.ai[0]; - projectile.velocity.Y += projectile.ai[1]; + Projectile.velocity.X += Projectile.ai[0]; + Projectile.velocity.Y += Projectile.ai[1]; if (Main.rand.NextFloat() < 1f) { Dust dust; // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. - Vector2 position = projectile.Center; + Vector2 position = Projectile.Center; dust = Terraria.Dust.NewDustPerfect(position, 33, new Vector2(0f, 0f), 0, new Color(0, 142, 255), 2.368421f); dust.noGravity = true; } diff --git a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs index 9f325a813b..1e85ac02ca 100644 --- a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -19,10 +20,10 @@ namespace CalamityMod.Projectiles.Melee private bool initialized = false; const float MaxTime = 340; static float ParryTime = 15; - public Vector2 DistanceFromPlayer => projectile.velocity * 10 * (1f + ((float)Math.Sin(Timer / ParryTime * MathHelper.Pi) * 0.8f)); - public float Timer => MaxTime - projectile.timeLeft; - public ref float AlreadyParried => ref projectile.ai[1]; - public Player Owner => Main.player[projectile.owner]; + public Vector2 DistanceFromPlayer => Projectile.velocity * 10 * (1f + ((float)Math.Sin(Timer / ParryTime * MathHelper.Pi) * 0.8f)); + public float Timer => MaxTime - Projectile.timeLeft; + public ref float AlreadyParried => ref Projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { @@ -30,12 +31,12 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 75; - projectile.width = projectile.height = 75; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 75; + Projectile.width = Projectile.height = 75; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; } public override bool CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; @@ -44,8 +45,8 @@ namespace CalamityMod.Projectiles.Melee { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 80f * projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (projectile.velocity * bladeLenght), 24, ref collisionPoint); + float bladeLenght = 80f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint); } public void GeneralParryEffects() @@ -54,9 +55,9 @@ namespace CalamityMod.Projectiles.Melee if (sword != null) sword.Charge = 10f; - Main.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); - Main.PlaySound(SoundID.Item67); - CombatText.NewText(projectile.Hitbox, new Color(111, 247, 200), "Parry!", true); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); + SoundEngine.PlaySound(SoundID.Item67); + CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), "Parry!", true); AlreadyParried = 1f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -70,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee if (target.damage > 0) Owner.GiveIFrames(35); - Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : projectile.Center + projectile.rotation.ToRotationVector2() * 60f; + Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f; Particle spark = new GenericSparkle(particleOrigin, Vector2.Zero, Color.White, Color.HotPink, 1.2f, 35, 0.1f, 2); GeneralParticleHandler.SpawnParticle(spark); @@ -86,21 +87,21 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - projectile.timeLeft = (int)MaxTime; - Main.PlaySound(SoundID.DD2_SkyDragonsFuryShot, projectile.Center); + Projectile.timeLeft = (int)MaxTime; + SoundEngine.PlaySound(SoundID.DD2_SkyDragonsFuryShot, Projectile.Center); - projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - projectile.velocity.Normalize(); - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); + Projectile.velocity.Normalize(); + Projectile.rotation = Projectile.velocity.ToRotation(); initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } //Manage position and rotation - projectile.Center = Owner.Center + DistanceFromPlayer ; - projectile.scale = 1.4f + ((float)Math.Sin(Timer / 160f * MathHelper.Pi) * 0.6f); //SWAGGER + Projectile.Center = Owner.Center + DistanceFromPlayer ; + Projectile.scale = 1.4f + ((float)Math.Sin(Timer / 160f * MathHelper.Pi) * 0.6f); //SWAGGER if (Timer > ParryTime) return; @@ -108,7 +109,7 @@ namespace CalamityMod.Projectiles.Melee if (AlreadyParried == 0) { float collisionPoint = 0f; - float bladeLenght = 80f * projectile.scale; + float bladeLenght = 80f * Projectile.scale; for (int k = 0; k < Main.maxProjectiles; k++) { @@ -117,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee if (proj.active && proj.hostile && proj.damage > 1 && //Only parry harmful projectiles proj.velocity.Length() * (proj.extraUpdates + 1) > 1f && //Only parry projectiles that move semi-quickly proj.Size.Length() < 300 && //Only parry projectiles that aren't too large - Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (projectile.velocity * bladeLenght), 24, ref collisionPoint)) + Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint)) { GeneralParryEffects(); @@ -136,9 +137,9 @@ namespace CalamityMod.Projectiles.Melee } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; - Owner.direction = Math.Sign(projectile.velocity.X); - Owner.itemRotation = projectile.rotation; + Owner.heldProj = Projectile.whoAmI; + Owner.direction = Math.Sign(Projectile.velocity.X); + Owner.itemRotation = Projectile.rotation; if (Owner.direction != 1) { Owner.itemRotation -= MathHelper.Pi; @@ -164,7 +165,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawPos = Owner.Center - Main.screenPosition + new Vector2(0, -36) - barBG.Size() / 2; Rectangle frame = new Rectangle(0, 0, (int)((Timer - ParryTime) / (MaxTime - ParryTime) * barFG.Width), barFG.Height); - float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? projectile.timeLeft / 8f : 1f; + float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? Projectile.timeLeft / 8f : 1f; Color color = Main.hslToRgb((Main.GlobalTime * 0.6f) % 1, 1, 0.85f + (float)Math.Sin(Main.GlobalTime * 3f) * 0.1f); spriteBatch.Draw(barBG, drawPos, color * opacity); @@ -177,20 +178,20 @@ namespace CalamityMod.Projectiles.Melee Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheAncients"); Texture2D glowmask = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheAncientsGlow"); - float drawRotation = projectile.rotation + MathHelper.PiOver4; + float drawRotation = Projectile.rotation + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, sword.Height); - Vector2 drawOffset = Owner.Center + projectile.velocity * DistanceFromPlayer.Length() - Main.screenPosition; + Vector2 drawOffset = Owner.Center + Projectile.velocity * DistanceFromPlayer.Length() - Main.screenPosition; - spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); - spriteBatch.Draw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + spriteBatch.Draw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); if (AlreadyParried > 0) { drawOrigin = new Vector2(0f, 36f); Rectangle frame = new Rectangle(24, 0, 36, 36); - drawOffset = Owner.Center + projectile.velocity * (DistanceFromPlayer.Length() + 33) - Main.screenPosition; - spriteBatch.Draw(glowmask, drawOffset, frame, Main.hslToRgb(Main.GlobalTime % 1, 1, 0.8f) * (1 - AlreadyParried / ParryTime), drawRotation, drawOrigin, projectile.scale + AlreadyParried / ParryTime, 0f, 0f); + drawOffset = Owner.Center + Projectile.velocity * (DistanceFromPlayer.Length() + 33) - Main.screenPosition; + spriteBatch.Draw(glowmask, drawOffset, frame, Main.hslToRgb(Main.GlobalTime % 1, 1, 0.8f) * (1 - AlreadyParried / ParryTime), drawRotation, drawOrigin, Projectile.scale + AlreadyParried / ParryTime, 0f, 0f); } return false; @@ -200,7 +201,7 @@ namespace CalamityMod.Projectiles.Melee { //Play a blip when it dies, to indicate to the player its ready to get used again if (Main.myPlayer == Owner.whoAmI) - Main.PlaySound(SoundID.Item35); + SoundEngine.PlaySound(SoundID.Item35); } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs index 50dad42950..2557888585 100644 --- a/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs @@ -9,6 +9,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -19,44 +20,44 @@ namespace CalamityMod.Projectiles.Melee private bool initialized = false; Vector2 direction = Vector2.Zero; - public float SwingDirection => projectile.ai[0] * Math.Sign(direction.X); - public ref float Charge => ref projectile.ai[1]; - public ref float HasFired => ref projectile.localAI[0]; + public float SwingDirection => Projectile.ai[0] * Math.Sign(direction.X); + public ref float Charge => ref Projectile.ai[1]; + public ref float HasFired => ref Projectile.localAI[0]; const float MaxTime = 35; private float SwingWidth = MathHelper.PiOver2 * 1.5f; public Vector2 DistanceFromPlayer => direction * 30; - public float Timer => MaxTime - projectile.timeLeft; - public Player Owner => Main.player[projectile.owner]; + public float Timer => MaxTime - Projectile.timeLeft; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { DisplayName.SetDefault("Fractured Ark"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 60; - projectile.width = projectile.height = 60; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = (int)MaxTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 60; + Projectile.width = Projectile.height = 60; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = (int)MaxTime; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 78f * projectile.scale; - Vector2 holdPoint = DistanceFromPlayer.Length() * projectile.rotation.ToRotationVector2(); + float bladeLenght = 78f * Projectile.scale; + Vector2 holdPoint = DistanceFromPlayer.Length() * Projectile.rotation.ToRotationVector2(); - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint); } @@ -71,37 +72,37 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - projectile.timeLeft = (int)MaxTime; - var sound = Main.PlaySound(Charge > 0 ? SoundID.DD2_PhantomPhoenixShot : SoundID.DD2_MonkStaffSwing, projectile.Center); + Projectile.timeLeft = (int)MaxTime; + var sound = SoundEngine.PlaySound(Charge > 0 ? SoundID.DD2_PhantomPhoenixShot : SoundID.DD2_MonkStaffSwing, Projectile.Center); if (Charge > 0) CalamityUtils.SafeVolumeChange(ref sound, 2.5f); - direction = projectile.velocity; + direction = Projectile.velocity; direction.Normalize(); - projectile.rotation = direction.ToRotation(); + Projectile.rotation = direction.ToRotation(); initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } //Manage position and rotation - projectile.Center = Owner.Center + DistanceFromPlayer; + Projectile.Center = Owner.Center + DistanceFromPlayer; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Lerp(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, SwingRatio()); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Lerp(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, SwingRatio()); - projectile.scale = 1.4f + ((float)Math.Sin(SwingRatio() * MathHelper.Pi) * 0.6f) + (Charge / 10f) * 0.6f; + Projectile.scale = 1.4f + ((float)Math.Sin(SwingRatio() * MathHelper.Pi) * 0.6f) + (Charge / 10f) * 0.6f; if (Owner.whoAmI == Main.myPlayer && SwingRatio() > 0.5f && HasFired == 0f && Charge > 0) { - Projectile.NewProjectile(Owner.Center + direction * 30f, projectile.velocity * 1.25f, ProjectileType(), (int)(projectile.damage * ArkoftheAncients.beamDamageMultiplier), 2f, Owner.whoAmI) ; + Projectile.NewProjectile(Owner.Center + direction * 30f, Projectile.velocity * 1.25f, ProjectileType(), (int)(Projectile.damage * ArkoftheAncients.beamDamageMultiplier), 2f, Owner.whoAmI) ; HasFired = 1f; } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; - Owner.direction = Math.Sign(projectile.velocity.X); - Owner.itemRotation = projectile.rotation; + Owner.heldProj = Projectile.whoAmI; + Owner.direction = Math.Sign(Projectile.velocity.X); + Owner.itemRotation = Projectile.rotation; if (Owner.direction != 1) { Owner.itemRotation -= MathHelper.Pi; @@ -110,8 +111,8 @@ namespace CalamityMod.Projectiles.Melee if (Charge > 0 && Main.rand.Next(2) == 0) { - Vector2 particleOrigin = projectile.Center + projectile.rotation.ToRotationVector2() * 75 * projectile.scale; - Vector2 particleSpeed = projectile.rotation.ToRotationVector2().RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(1.2f, 2f); + Vector2 particleOrigin = Projectile.Center + Projectile.rotation.ToRotationVector2() * 75 * Projectile.scale; + Vector2 particleSpeed = Projectile.rotation.ToRotationVector2().RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(1.2f, 2f); Particle energyLeak = new CritSpark(particleOrigin, particleSpeed + Owner.velocity, Color.White, Color.Cyan, Main.rand.NextFloat(0.6f, 1.6f), 20 + Main.rand.Next(10), 0.1f, 1.5f, hueShift: 0.02f); GeneralParticleHandler.SpawnParticle(energyLeak); } @@ -127,23 +128,23 @@ namespace CalamityMod.Projectiles.Melee float extraAngle = Owner.direction < 0 ? MathHelper.PiOver2 : 0f; - float drawAngle = projectile.rotation; - float drawRotation = projectile.rotation + MathHelper.PiOver4 + extraAngle; + float drawAngle = Projectile.rotation; + float drawRotation = Projectile.rotation + MathHelper.PiOver4 + extraAngle; Vector2 drawOrigin = new Vector2(Owner.direction < 0 ? sword.Width : 0f , sword.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - if (CalamityConfig.Instance.Afterimages && Timer > ProjectileID.Sets.TrailCacheLength[projectile.type]) + if (CalamityConfig.Instance.Afterimages && Timer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) { - for (int i = 0; i < projectile.oldRot.Length; ++i) + for (int i = 0; i < Projectile.oldRot.Length; ++i) { - Color color = Main.hslToRgb((i / (float)projectile.oldRot.Length) * 0.7f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f)); - float afterimageRotation = projectile.oldRot[i] + MathHelper.PiOver4; - spriteBatch.Draw(glowmask, drawOffset, null, color * 0.15f, afterimageRotation + extraAngle, drawOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), flip, 0f); + Color color = Main.hslToRgb((i / (float)Projectile.oldRot.Length) * 0.7f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f)); + float afterimageRotation = Projectile.oldRot[i] + MathHelper.PiOver4; + spriteBatch.Draw(glowmask, drawOffset, null, color * 0.15f, afterimageRotation + extraAngle, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), flip, 0f); } } - spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, flip, 0f); - spriteBatch.Draw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, flip, 0f); + spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f); + spriteBatch.Draw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f); return false; } diff --git a/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs b/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs index 911fc05de7..c78012f3ac 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs @@ -9,6 +9,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -18,18 +19,18 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight"; //Umm actually the rending scissors are for aote mr programmer what the hel.. it gets changed in predraw anywyas private bool initialized = false; - public ref float Charge => ref projectile.ai[0]; + public ref float Charge => ref Projectile.ai[0]; public bool Dashing { get { - return projectile.ai[1] == 1; + return Projectile.ai[1] == 1; } set { - projectile.ai[1] = value ? 1f : 0f; + Projectile.ai[1] = value ? 1f : 0f; } } @@ -42,19 +43,19 @@ namespace CalamityMod.Projectiles.Melee const float SnapTime = 25f; const float HoldTime = 15f; - public float SnapTimer => MaxTime - projectile.timeLeft; - public float HoldTimer => MaxTime - projectile.timeLeft - SnapTime; - public float StitchTimer => MaxTime - projectile.timeLeft - SnapTime - (HoldTime / 2f); + public float SnapTimer => MaxTime - Projectile.timeLeft; + public float HoldTimer => MaxTime - Projectile.timeLeft - SnapTime; + public float StitchTimer => MaxTime - Projectile.timeLeft - SnapTime - (HoldTime / 2f); public float SnapProgress => MathHelper.Clamp(SnapTimer / SnapTime, 0, 1); public float HoldProgress => MathHelper.Clamp(HoldTimer / HoldTime, 0, 1); public float StitchProgress => MathHelper.Clamp(StitchTimer / (MaxTime - (SnapTime + (HoldTime / 2f))), 0, 1); - public int CurrentAnimation => (MaxTime - projectile.timeLeft) <= SnapTime ? 0 : (MaxTime - projectile.timeLeft) <= SnapTime + HoldTime ? 1 : 2; + public int CurrentAnimation => (MaxTime - Projectile.timeLeft) <= SnapTime ? 0 : (MaxTime - Projectile.timeLeft) <= SnapTime + HoldTime ? 1 : 2; - public Vector2 scissorPosition => projectile.Center + ThrustDisplaceRatio() * projectile.velocity * 200f; + public Vector2 scissorPosition => Projectile.Center + ThrustDisplaceRatio() * Projectile.velocity * 200f; - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public Particle PolarStar; @@ -65,15 +66,15 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 300; - projectile.width = projectile.height = 300; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 300; + Projectile.width = Projectile.height = 300; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = (int)MaxTime + 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = (int)MaxTime + 2; } public override bool CanDamage() @@ -89,7 +90,7 @@ namespace CalamityMod.Projectiles.Melee //The hitbox is simplified into a line collision. float collisionPoint = 0f; float bladeLenght = ThrustDisplaceRatio() * 242f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + (projectile.velocity * bladeLenght), 30, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLenght), 30, ref collisionPoint); } public override bool ShouldUpdatePosition() => false; @@ -98,20 +99,20 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - projectile.timeLeft = (int)MaxTime; - var sound = Main.PlaySound(SoundID.Item84, projectile.Center); + Projectile.timeLeft = (int)MaxTime; + var sound = SoundEngine.PlaySound(SoundID.Item84, Projectile.Center); SafeVolumeChange(ref sound, 0.3f); - projectile.velocity.Normalize(); - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.velocity.Normalize(); + Projectile.rotation = Projectile.velocity.ToRotation(); initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } //Manage position and rotation - projectile.scale = 1.4f; + Projectile.scale = 1.4f; HandleParticles(); @@ -129,7 +130,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 20; i++) { float positionAlongLine = MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, Main.rand.NextFloat(0f, 1f)); - Vector2 particlePosition = projectile.Center + projectile.velocity * positionAlongLine; + Vector2 particlePosition = Projectile.Center + Projectile.velocity * positionAlongLine; Color particleColor = Main.rand.NextBool() ? Color.OrangeRed : Main.rand.NextBool() ? Color.White : Color.Orange; float particleScale = Main.rand.NextFloat(0.05f, 0.4f) * (0.4f + 0.6f * (float)Math.Sin(positionAlongLine / (ThrustDisplaceRatio() * 242f) * MathHelper.Pi)); @@ -167,13 +168,13 @@ namespace CalamityMod.Projectiles.Melee { Dashing = false; Owner.velocity *= 0.1f; //Abrupt stop - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MeatySlash"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MeatySlash"), Projectile.Center); if (Owner.whoAmI == Main.myPlayer) { for (int i = 0; i < 5; i++) { - Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Main.rand.NextVector2CircularEdge(28, 28), ProjectileType(), (int)(ArkoftheCosmos.SlashBoltsDamageMultiplier * projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.07f); + Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Main.rand.NextVector2CircularEdge(28, 28), ProjectileType(), (int)(ArkoftheCosmos.SlashBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.07f); { blast.timeLeft = 100; } @@ -187,14 +188,14 @@ namespace CalamityMod.Projectiles.Melee { if (PolarStar == null) { - PolarStar = new GenericSparkle(projectile.Center, Vector2.Zero, Color.White, Color.CornflowerBlue, projectile.scale * 2f, 2, 0.1f, 5f, true); + PolarStar = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Color.CornflowerBlue, Projectile.scale * 2f, 2, 0.1f, 5f, true); GeneralParticleHandler.SpawnParticle(PolarStar); } else if (HoldProgress <= 0.4f) { PolarStar.Time = 0; PolarStar.Position = scissorPosition; - PolarStar.Scale = projectile.scale * 2f; + PolarStar.Scale = Projectile.scale * 2f; } //Update stitches @@ -203,11 +204,11 @@ namespace CalamityMod.Projectiles.Melee if (StitchRotations[i] == 0) { StitchRotations[i] = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4) + MathHelper.PiOver2; - var sewSound = Main.PlaySound(i % 3 == 0 ? SoundID.Item63 : i % 3 == 1 ? SoundID.Item64 : SoundID.Item65, Owner.Center); + var sewSound = SoundEngine.PlaySound(i % 3 == 0 ? SoundID.Item63 : i % 3 == 1 ? SoundID.Item64 : SoundID.Item65, Owner.Center); SafeVolumeChange(ref sewSound, 0.5f); float positionAlongLine = (ThrustDisplaceRatio() * 242f / (float)maxStitches * 0.5f) + MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, i / (float)maxStitches); - Vector2 stitchCenter = projectile.Center + projectile.velocity * positionAlongLine; + Vector2 stitchCenter = Projectile.Center + Projectile.velocity * positionAlongLine; Particle spark = new CritSpark(stitchCenter, Vector2.Zero, Color.White, Color.Cyan, 3f, 8, 0.1f, 3); @@ -225,7 +226,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 10; i++) { - Vector2 particleSpeed = projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f); + Vector2 particleSpeed = Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f); Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Red, 60, 1, 1.5f, hueShift: 0.002f); GeneralParticleHandler.SpawnParticle(energyLeak); } @@ -234,7 +235,7 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { //Add some damage falloff - damage = (int)(damage * Math.Pow((1 - ArkoftheCosmos.blastFalloffStrenght), projectile.numHits * ArkoftheCosmos.blastFalloffSpeed)); + damage = (int)(damage * Math.Pow((1 - ArkoftheCosmos.blastFalloffStrenght), Projectile.numHits * ArkoftheCosmos.blastFalloffSpeed)); } public override void Kill(int timeLeft) @@ -265,9 +266,9 @@ namespace CalamityMod.Projectiles.Melee Texture2D sliceTex = GetTexture("CalamityMod/Particles/BloomLine"); Color sliceColor = Color.Lerp(Color.OrangeRed, Color.White, SnapProgress); - float rot = projectile.rotation + MathHelper.PiOver2; + float rot = Projectile.rotation + MathHelper.PiOver2; Vector2 sliceScale = new Vector2(0.2f * (1 - SnapProgress) ,ThrustDisplaceRatio() * 242f); - spriteBatch.Draw(sliceTex, projectile.Center - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0f); + spriteBatch.Draw(sliceTex, Projectile.Center - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0f); //Draw the scissors @@ -276,7 +277,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeft"); Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight"); - float snippingRotation = projectile.rotation + MathHelper.PiOver4; + float snippingRotation = Projectile.rotation + MathHelper.PiOver4; float drawRotation = MathHelper.Lerp(snippingRotation - MathHelper.PiOver4, snippingRotation, RotationRatio()); float drawRotationBack = MathHelper.Lerp(snippingRotation + MathHelper.PiOver4, snippingRotation, RotationRatio()); @@ -288,8 +289,8 @@ namespace CalamityMod.Projectiles.Melee Color drawColor = Color.Tomato * opacity * 0.9f; Color drawColorBack = Color.DeepSkyBlue * opacity * 0.9f; - spriteBatch.Draw(backBlade, drawPosition, null, drawColorBack, drawRotationBack, drawOriginBack, projectile.scale, 0f, 0f); - spriteBatch.Draw(frontBlade, drawPosition, null, drawColor * opacity, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(backBlade, drawPosition, null, drawColorBack, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f); + spriteBatch.Draw(frontBlade, drawPosition, null, drawColor * opacity, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); } //Draw the rip @@ -305,7 +306,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 scale = new Vector2(ripWidth, (ThrustDisplaceRatio() * 242f) / lineTex.Height); float lineOpacity = StitchProgress < 0.75f ? 1f : 1 - (StitchProgress - 0.75f) * 4f; - spriteBatch.Draw(lineTex, projectile.Center - Main.screenPosition + Shake, null, Color.Lerp(Color.White, Color.OrangeRed * 0.7f, raise) * lineOpacity, rot, origin, scale, SpriteEffects.None, 0); + spriteBatch.Draw(lineTex, Projectile.Center - Main.screenPosition + Shake, null, Color.Lerp(Color.White, Color.OrangeRed * 0.7f, raise) * lineOpacity, rot, origin, scale, SpriteEffects.None, 0); //Draw the stitches @@ -314,9 +315,9 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < CurrentStitches; i++) { float positionAlongLine = (ThrustDisplaceRatio() * 242f / (float)maxStitches * 0.5f) + MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, i / (float)maxStitches); - Vector2 stitchCenter = projectile.Center + projectile.velocity * positionAlongLine; + Vector2 stitchCenter = Projectile.Center + Projectile.velocity * positionAlongLine; - rot = projectile.rotation + MathHelper.PiOver2 + StitchRotations[i]; + rot = Projectile.rotation + MathHelper.PiOver2 + StitchRotations[i]; origin = new Vector2(lineTex.Width / 2f, lineTex.Height / 2f); float stitchLenght = (float)Math.Sin(i / (float)(maxStitches - 1) * MathHelper.Pi) * 0.5f + 0.5f; diff --git a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs index 6ce7fd879d..b3c8cc6dc8 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs @@ -9,6 +9,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -20,12 +21,12 @@ namespace CalamityMod.Projectiles.Melee private bool initialized = false; const float MaxTime = 340; static float ParryTime = 15; - public Vector2 DistanceFromPlayer => projectile.velocity * 10 + projectile.velocity * 10 * ThrustDisplaceRatio(); - public float Timer => MaxTime - projectile.timeLeft; - public float ParryProgress => (MaxTime - projectile.timeLeft) / ParryTime; + public Vector2 DistanceFromPlayer => Projectile.velocity * 10 + Projectile.velocity * 10 * ThrustDisplaceRatio(); + public float Timer => MaxTime - Projectile.timeLeft; + public float ParryProgress => (MaxTime - Projectile.timeLeft) / ParryTime; - public ref float AlreadyParried => ref projectile.ai[1]; - public Player Owner => Main.player[projectile.owner]; + public ref float AlreadyParried => ref Projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { @@ -33,12 +34,12 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 75; - projectile.width = projectile.height = 75; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 75; + Projectile.width = Projectile.height = 75; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; } public override bool CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; @@ -47,8 +48,8 @@ namespace CalamityMod.Projectiles.Melee { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 142f * projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (projectile.velocity * bladeLenght), 44, ref collisionPoint); + float bladeLenght = 142f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 44, ref collisionPoint); } public void GeneralParryEffects() @@ -59,11 +60,11 @@ namespace CalamityMod.Projectiles.Melee sword.Charge = 10f; sword.Combo = 0f; } - Main.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); - var chunder = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); + var chunder = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center); SafeVolumeChange(ref chunder, 1.3f); - CombatText.NewText(projectile.Hitbox, new Color(111, 247, 200), "Parry!", true); + CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), "Parry!", true); for (int i = 0; i < 5; i ++) //Don't loose your way { @@ -87,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee if (target.damage > 0) Owner.GiveIFrames(35); - Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : projectile.Center + projectile.rotation.ToRotationVector2() * 60f; + Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f; Particle spark = new GenericSparkle(particleOrigin, Vector2.Zero, Color.White, Color.HotPink, 1.2f, 35, 0.1f, 2); GeneralParticleHandler.SpawnParticle(spark); @@ -103,28 +104,28 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - projectile.timeLeft = (int)MaxTime; - var sound = Main.PlaySound(SoundID.Item84, projectile.Center); + Projectile.timeLeft = (int)MaxTime; + var sound = SoundEngine.PlaySound(SoundID.Item84, Projectile.Center); CalamityUtils.SafeVolumeChange(ref sound, 0.3f); - projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - projectile.velocity.Normalize(); - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); + Projectile.velocity.Normalize(); + Projectile.rotation = Projectile.velocity.ToRotation(); initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } //Manage position and rotation - projectile.Center = Owner.Center + DistanceFromPlayer ; - projectile.scale = 1.4f + ThrustDisplaceRatio() * 0.2f; + Projectile.Center = Owner.Center + DistanceFromPlayer ; + Projectile.scale = 1.4f + ThrustDisplaceRatio() * 0.2f; if (Timer > ParryTime) return; float collisionPoint = 0f; - float bladeLenght = 142f * projectile.scale; + float bladeLenght = 142f * Projectile.scale; for (int k = 0; k < Main.maxProjectiles; k++) { @@ -133,7 +134,7 @@ namespace CalamityMod.Projectiles.Melee if (proj.active && proj.hostile && proj.damage > 1 && //Only parry harmful projectiles proj.velocity.Length() * (proj.extraUpdates + 1) > 1f && //Only parry projectiles that move semi-quickly proj.Size.Length() < 300 && //Only parry projectiles that aren't too large - Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (projectile.velocity * bladeLenght), 24, ref collisionPoint)) + Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint)) { if (AlreadyParried == 0) { @@ -153,9 +154,9 @@ namespace CalamityMod.Projectiles.Melee //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; - Owner.direction = Math.Sign(projectile.velocity.X); - Owner.itemRotation = projectile.rotation; + Owner.heldProj = Projectile.whoAmI; + Owner.direction = Math.Sign(Projectile.velocity.X); + Owner.itemRotation = Projectile.rotation; if (Owner.direction != 1) { Owner.itemRotation -= MathHelper.Pi; @@ -192,7 +193,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawPos = Owner.Center - Main.screenPosition + new Vector2(0, -36) - barBG.Size() / 2; Rectangle frame = new Rectangle(0, 0, (int)((Timer - ParryTime) / (MaxTime - ParryTime) * barFG.Width), barFG.Height); - float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? projectile.timeLeft / 8f : 1f; + float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? Projectile.timeLeft / 8f : 1f; Color color = Main.hslToRgb((float)Math.Sin(Main.GlobalTime * 1.2f) * 0.05f + 0.08f, 1, 0.65f + (float)Math.Sin(Main.GlobalTime * 7f) * 0.1f); spriteBatch.Draw(barBG, drawPos, color * opacity); @@ -206,20 +207,20 @@ namespace CalamityMod.Projectiles.Melee Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight"); Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow"); - float snippingRotation = projectile.rotation + MathHelper.PiOver4; + float snippingRotation = Projectile.rotation + MathHelper.PiOver4; float drawRotation = MathHelper.Lerp(snippingRotation - MathHelper.PiOver4, snippingRotation, RotationRatio()); float drawRotationBack = MathHelper.Lerp(snippingRotation + MathHelper.PiOver4, snippingRotation, RotationRatio()); Vector2 drawOrigin = new Vector2(33, 86); //Right on the hole Vector2 drawOriginBack = new Vector2(44f, 86); //Right on the hole - Vector2 drawPosition = Owner.Center + projectile.velocity * 15 + projectile.velocity * ThrustDisplaceRatio() * 50f - Main.screenPosition; + Vector2 drawPosition = Owner.Center + Projectile.velocity * 15 + Projectile.velocity * ThrustDisplaceRatio() * 50f - Main.screenPosition; - spriteBatch.Draw(backBlade, drawPosition, null, lightColor, drawRotationBack, drawOriginBack, projectile.scale, 0f, 0f); - spriteBatch.Draw(backBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotationBack, drawOriginBack, projectile.scale, 0f, 0f); + spriteBatch.Draw(backBlade, drawPosition, null, lightColor, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f); + spriteBatch.Draw(backBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f); - spriteBatch.Draw(frontBlade, drawPosition, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); - spriteBatch.Draw(frontBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(frontBlade, drawPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + spriteBatch.Draw(frontBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); return false; } @@ -228,7 +229,7 @@ namespace CalamityMod.Projectiles.Melee //Play a blip when it dies, to indicate to the player its ready to get used again if (Main.myPlayer == Owner.whoAmI) { - var ding = Main.PlaySound(SoundID.Item35); + var ding = SoundEngine.PlaySound(SoundID.Item35); CalamityUtils.SafeVolumeChange(ref ding, 2f); } } diff --git a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs index ec0f7cf08c..4658a9f6de 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs @@ -9,6 +9,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -19,9 +20,9 @@ namespace CalamityMod.Projectiles.Melee private bool initialized = false; Vector2 direction = Vector2.Zero; - public ref float Combo => ref projectile.ai[0]; - public ref float Charge => ref projectile.ai[1]; - public Player Owner => Main.player[projectile.owner]; + public ref float Combo => ref Projectile.ai[0]; + public ref float Charge => ref Projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; Particle smear; @@ -49,9 +50,9 @@ namespace CalamityMod.Projectiles.Melee private float SwingWidth = MathHelper.PiOver2 * 1.5f; public Vector2 DistanceFromPlayer => direction * 30; - public float SwingTimer => MaxSwingTime - projectile.timeLeft; + public float SwingTimer => MaxSwingTime - Projectile.timeLeft; public float SwingCompletion => SwingTimer / MaxSwingTime; - public ref float HasFired => ref projectile.localAI[0]; + public ref float HasFired => ref Projectile.localAI[0]; #endregion #region Throw variables @@ -60,59 +61,59 @@ namespace CalamityMod.Projectiles.Melee public bool Thrown => Combo == 2 || Combo == 3; public const float MaxThrowTime = 140; public float ThrowReach; - public float ThrowTimer => MaxThrowTime - projectile.timeLeft; + public float ThrowTimer => MaxThrowTime - Projectile.timeLeft; public float ThrowCompletion => ThrowTimer / MaxThrowTime; public const float SnapWindowStart = 0.2f; public const float SnapWindowEnd = 0.75f; public float SnapEndTime => (MaxThrowTime - (MaxThrowTime * SnapWindowEnd)); - public float SnapEndCompletion => (SnapEndTime - projectile.timeLeft) / SnapEndTime; - public ref float ChanceMissed => ref projectile.localAI[1]; + public float SnapEndCompletion => (SnapEndTime - Projectile.timeLeft) / SnapEndTime; + public ref float ChanceMissed => ref Projectile.localAI[1]; #endregion public override void SetStaticDefaults() { DisplayName.SetDefault("Ark of the Cosmos"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 60; - projectile.width = projectile.height = 60; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = Thrown ? 10 : (int)(MaxSwingTime); + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 60; + Projectile.width = Projectile.height = 60; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Thrown ? 10 : (int)(MaxSwingTime); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - float bladeLenght = 172f * projectile.scale; + float bladeLenght = 172f * Projectile.scale; if (Thrown) { - bool mainCollision = Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center - Vector2.One * bladeLenght / 2f, Vector2.One * bladeLenght); + bool mainCollision = Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.One * bladeLenght / 2f, Vector2.One * bladeLenght); if (Combo == 2f) return mainCollision; else { - Vector2 thrownBladeStart = Vector2.SmoothStep(Owner.Center, projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f)); + Vector2 thrownBladeStart = Vector2.SmoothStep(Owner.Center, Projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f)); bool thrownScissorCollision = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), thrownBladeStart, thrownBladeStart + direction * bladeLenght); return mainCollision || thrownScissorCollision; } } float collisionPoint = 0f; - Vector2 holdPoint = DistanceFromPlayer.Length() * projectile.rotation.ToRotationVector2(); + Vector2 holdPoint = DistanceFromPlayer.Length() * Projectile.rotation.ToRotationVector2(); - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint); } //Swing animation keys @@ -140,32 +141,32 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - projectile.timeLeft = Thrown ? (int) MaxThrowTime : (int)MaxSwingTime; - var sound = Main.PlaySound((Charge > 0 || Thrown) ? SoundID.DD2_PhantomPhoenixShot : SoundID.Item71, projectile.Center); + Projectile.timeLeft = Thrown ? (int) MaxThrowTime : (int)MaxSwingTime; + var sound = SoundEngine.PlaySound((Charge > 0 || Thrown) ? SoundID.DD2_PhantomPhoenixShot : SoundID.Item71, Projectile.Center); if (Charge > 0) SafeVolumeChange(ref sound, 2.5f); - direction = projectile.velocity; + direction = Projectile.velocity; direction.Normalize(); - projectile.velocity = direction; - projectile.rotation = direction.ToRotation(); + Projectile.velocity = direction; + Projectile.rotation = direction.ToRotation(); if (SwirlSwing) - projectile.localNPCHitCooldown = (int)(projectile.localNPCHitCooldown / 4f); + Projectile.localNPCHitCooldown = (int)(Projectile.localNPCHitCooldown / 4f); initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } if (!Thrown) { //Manage position and rotation - projectile.Center = Owner.Center + DistanceFromPlayer; + Projectile.Center = Owner.Center + DistanceFromPlayer; //Baby swing if (!SwirlSwing) { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Lerp(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, SwingRatio()); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Lerp(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, SwingRatio()); } //Chungal swing @@ -173,23 +174,23 @@ namespace CalamityMod.Projectiles.Melee { float startRot = (MathHelper.Pi - MathHelper.PiOver4) * SwingDirection; float endRot = -(MathHelper.TwoPi + MathHelper.PiOver4 * 1.5f) * SwingDirection; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Lerp(startRot, endRot, SwirlRatio()); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Lerp(startRot, endRot, SwirlRatio()); DoParticleEffects(true); //Really important to use projectile.timeLeft -1 instead of simply projectile.timeLeft because if it spawns a bolt on its last frame of existence the primitive drawer will break and shit itself or something idk - if (Owner.whoAmI == Main.myPlayer && (projectile.timeLeft - 1) % Math.Ceiling(MaxSwingTime / ArkoftheCosmos.SwirlBoltAmount) == 0f) + if (Owner.whoAmI == Main.myPlayer && (Projectile.timeLeft - 1) % Math.Ceiling(MaxSwingTime / ArkoftheCosmos.SwirlBoltAmount) == 0f) { //Slightly shift the blasts up so the final close shots don't go BELOW the cursor and instead go right on it. - float adjustedBlastRotation = projectile.rotation - MathHelper.PiOver4 * 1.15f * Owner.direction; + float adjustedBlastRotation = Projectile.rotation - MathHelper.PiOver4 * 1.15f * Owner.direction; - Projectile blast = Projectile.NewProjectileDirect(Owner.Center + adjustedBlastRotation.ToRotationVector2() * 10f, adjustedBlastRotation.ToRotationVector2() * 20f, ProjectileType(), (int)(ArkoftheCosmos.SwirlBoltDamageMultiplier / ArkoftheCosmos.SwirlBoltAmount * projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f); + Projectile blast = Projectile.NewProjectileDirect(Owner.Center + adjustedBlastRotation.ToRotationVector2() * 10f, adjustedBlastRotation.ToRotationVector2() * 20f, ProjectileType(), (int)(ArkoftheCosmos.SwirlBoltDamageMultiplier / ArkoftheCosmos.SwirlBoltAmount * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f); { blast.timeLeft = 100; } } } - projectile.scale = 1.2f + ((float)Math.Sin(SwingRatio() * MathHelper.Pi) * 0.6f) + (Charge / 10f) * 0.2f; + Projectile.scale = 1.2f + ((float)Math.Sin(SwingRatio() * MathHelper.Pi) * 0.6f) + (Charge / 10f) * 0.2f; } else @@ -197,38 +198,38 @@ namespace CalamityMod.Projectiles.Melee //Telegraph the start of the snap window with a bit of leeway if (Math.Abs(ThrowCompletion - SnapWindowStart + 0.1f) <= 0.005f && ChanceMissed == 0f && Main.myPlayer == Owner.whoAmI) { - Particle pulse = new PulseRing(projectile.Center, Vector2.Zero, Color.OrangeRed, 0.05f, 1.8f, 8); + Particle pulse = new PulseRing(Projectile.Center, Vector2.Zero, Color.OrangeRed, 0.05f, 1.8f, 8); GeneralParticleHandler.SpawnParticle(pulse); - Main.PlaySound(SoundID.Item4); + SoundEngine.PlaySound(SoundID.Item4); //Spawn a constellation link - Projectile chain = Projectile.NewProjectileDirect(Owner.Center, Vector2.Zero, ProjectileType(), (int)(projectile.damage * ArkoftheCosmos.chainDamageMultiplier), 0, Owner.whoAmI, (int)(projectile.timeLeft / 2f)); - chain.timeLeft = (int)(projectile.timeLeft / 2f); + Projectile chain = Projectile.NewProjectileDirect(Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * ArkoftheCosmos.chainDamageMultiplier), 0, Owner.whoAmI, (int)(Projectile.timeLeft / 2f)); + chain.timeLeft = (int)(Projectile.timeLeft / 2f); } //Rotate the blade towards the cursor - projectile.Center = Vector2.Lerp(projectile.Center, Owner.Calamity().mouseWorld, 0.025f * ThrowRatio()); - projectile.Center = projectile.Center.MoveTowards(Owner.Calamity().mouseWorld, 20f * ThrowRatio()); + Projectile.Center = Vector2.Lerp(Projectile.Center, Owner.Calamity().mouseWorld, 0.025f * ThrowRatio()); + Projectile.Center = Projectile.Center.MoveTowards(Owner.Calamity().mouseWorld, 20f * ThrowRatio()); - if ((projectile.Center - Owner.Center).Length() > ArkoftheCosmos.MaxThrowReach) - projectile.Center = Owner.Center + Owner.DirectionTo(projectile.Center) * ArkoftheCosmos.MaxThrowReach; + if ((Projectile.Center - Owner.Center).Length() > ArkoftheCosmos.MaxThrowReach) + Projectile.Center = Owner.Center + Owner.DirectionTo(Projectile.Center) * ArkoftheCosmos.MaxThrowReach; - projectile.rotation -= MathHelper.PiOver4 * 0.3f; - projectile.scale = 1f + ThrowScaleRatio() * 0.5f; + Projectile.rotation -= MathHelper.PiOver4 * 0.3f; + Projectile.scale = 1f + ThrowScaleRatio() * 0.5f; //Come back if (Math.Abs(ThrowCompletion - SnapWindowEnd) <= 0.005f) - direction = projectile.Center - Owner.Center; + direction = Projectile.Center - Owner.Center; if (ThrowCompletion > SnapWindowEnd) - projectile.Center = Owner.Center + direction * ThrowRatio(); + Projectile.Center = Owner.Center + direction * ThrowRatio(); //Snip if (!OwnerCanShoot && Combo == 2 && ThrowCompletion >= (SnapWindowStart - 0.1f) && ThrowCompletion < SnapWindowEnd && ChanceMissed == 0f) { - Particle snapSpark = new GenericSparkle(projectile.Center, Owner.velocity - Utils.SafeNormalize(projectile.velocity, Vector2.Zero), Color.White, Color.OrangeRed, Main.rand.NextFloat(1f, 2f), 10 + Main.rand.Next(10), 0.1f, 3f); + Particle snapSpark = new GenericSparkle(Projectile.Center, Owner.velocity - Utils.SafeNormalize(Projectile.velocity, Vector2.Zero), Color.White, Color.OrangeRed, Main.rand.NextFloat(1f, 2f), 10 + Main.rand.Next(10), 0.1f, 3f); GeneralParticleHandler.SpawnParticle(snapSpark); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3) @@ -240,7 +241,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { - Projectile blast = Projectile.NewProjectileDirect(projectile.Center + (MathHelper.TwoPi * (i / 3f) + rotationOffset).ToRotationVector2() * 30f, (MathHelper.TwoPi * (i / 3f) + rotationOffset).ToRotationVector2() * 20f, ProjectileType(), (int)(ArkoftheCosmos.SnapBoltsDamageMultiplier * projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f); + Projectile blast = Projectile.NewProjectileDirect(Projectile.Center + (MathHelper.TwoPi * (i / 3f) + rotationOffset).ToRotationVector2() * 30f, (MathHelper.TwoPi * (i / 3f) + rotationOffset).ToRotationVector2() * 20f, ProjectileType(), (int)(ArkoftheCosmos.SnapBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f); { blast.timeLeft = 100; } @@ -248,14 +249,14 @@ namespace CalamityMod.Projectiles.Melee //Reset local immunity so that the snap can do damage for (int i = 0; i < Main.maxNPCs; ++i) - projectile.localNPCImmunity[i] = 0; + Projectile.localNPCImmunity[i] = 0; } Combo = 3f; //Mark the end of the regular throw - direction = projectile.Center - Owner.Center; //At this point direction becomes also a marker for the last position it was in before snapping - projectile.velocity = projectile.rotation.ToRotationVector2(); - projectile.timeLeft = (int)SnapEndTime; - projectile.localNPCHitCooldown = (int)SnapEndTime; //Only snap the enemies ONCE + direction = Projectile.Center - Owner.Center; //At this point direction becomes also a marker for the last position it was in before snapping + Projectile.velocity = Projectile.rotation.ToRotationVector2(); + Projectile.timeLeft = (int)SnapEndTime; + Projectile.localNPCHitCooldown = (int)SnapEndTime; //Only snap the enemies ONCE } @@ -266,14 +267,14 @@ namespace CalamityMod.Projectiles.Melee { //Slow down the projectile's retraction float curveDownGently = MathHelper.Lerp(1f, 0.8f, 1f - (float)Math.Sqrt(1f - (float)Math.Pow(SnapEndCompletion , 2f))); - projectile.Center = Owner.Center + direction * curveDownGently; - projectile.scale = 1.5f; + Projectile.Center = Owner.Center + direction * curveDownGently; + Projectile.scale = 1.5f; float orientateProperly = (float)Math.Sqrt(1f - (float)Math.Pow(MathHelper.Clamp(SnapEndCompletion + 0.2f, 0f, 1f) - 1f, 2f)); - float extraRotations = (direction.ToRotation() + MathHelper.PiOver4 > projectile.velocity.ToRotation()) ? -MathHelper.TwoPi : 0f; + float extraRotations = (direction.ToRotation() + MathHelper.PiOver4 > Projectile.velocity.ToRotation()) ? -MathHelper.TwoPi : 0f; - projectile.rotation = MathHelper.Lerp(projectile.velocity.ToRotation(), direction.ToRotation() + extraRotations, orientateProperly); + Projectile.rotation = MathHelper.Lerp(Projectile.velocity.ToRotation(), direction.ToRotation() + extraRotations, orientateProperly); } //Sharticles @@ -281,9 +282,9 @@ namespace CalamityMod.Projectiles.Melee } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; - Owner.direction = Math.Sign(projectile.velocity.X); - Owner.itemRotation = projectile.rotation; + Owner.heldProj = Projectile.whoAmI; + Owner.direction = Math.Sign(Projectile.velocity.X); + Owner.itemRotation = Projectile.rotation; if (Owner.direction != 1) { Owner.itemRotation -= MathHelper.Pi; @@ -297,29 +298,29 @@ namespace CalamityMod.Projectiles.Melee if (swirlSwing) { //This specific scale setting isn't actually used for the blade itself at all since it gets set to something else further down. This is just to use for the particles - projectile.scale = 1.6f + ((float)Math.Sin(SwirlRatio() * MathHelper.Pi) * 1f) + (Charge / 10f) * 0.05f; + Projectile.scale = 1.6f + ((float)Math.Sin(SwirlRatio() * MathHelper.Pi) * 1f) + (Charge / 10f) * 0.05f; Color currentColor = Color.Chocolate * (MathHelper.Clamp((float)Math.Sin((SwirlRatio() - 0.2f) * MathHelper.Pi), 0f, 1f) * 0.8f); if (smear == null) { - smear = new CircularSmearSmokeyVFX(Owner.Center, currentColor, projectile.rotation, projectile.scale * 2.4f); + smear = new CircularSmearSmokeyVFX(Owner.Center, currentColor, Projectile.rotation, Projectile.scale * 2.4f); GeneralParticleHandler.SpawnParticle(smear); } //Update the variables of the smear else { - smear.Rotation = projectile.rotation + MathHelper.PiOver4 + (Owner.direction < 0 ? MathHelper.PiOver4 * 4f : 0f); + smear.Rotation = Projectile.rotation + MathHelper.PiOver4 + (Owner.direction < 0 ? MathHelper.PiOver4 * 4f : 0f); smear.Time = 0; smear.Position = Owner.Center; - smear.Scale = MathHelper.Lerp(2.6f, 3.5f, (projectile.scale - 1.6f) / 1f); + smear.Scale = MathHelper.Lerp(2.6f, 3.5f, (Projectile.scale - 1.6f) / 1f); smear.Color = currentColor; } if (Main.rand.NextBool()) { - float maxDistance = projectile.scale * 78f; + float maxDistance = Projectile.scale * 78f; Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance); Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2 * Owner.direction), Vector2.Zero) * 2 * (1f + distance.Length() / 15f); Particle glitter = new CritSpark(Owner.Center + distance, Owner.velocity + angularVelocity, Main.rand.Next(3) == 0 ? Color.Turquoise : Color.Coral, currentColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); @@ -334,8 +335,8 @@ namespace CalamityMod.Projectiles.Melee { for (float i = 0f; i <= 1; i += 0.5f) { - Vector2 smokepos = Owner.Center + (projectile.rotation.ToRotationVector2() * (30 + 50 * i) * projectile.scale) + projectile.rotation.ToRotationVector2().RotatedBy(-MathHelper.PiOver2) * 30f * scaleFactor * Main.rand.NextFloat(); - Vector2 smokespeed = projectile.rotation.ToRotationVector2().RotatedBy(-MathHelper.PiOver2 * Owner.direction) * 20f * scaleFactor + Owner.velocity; + Vector2 smokepos = Owner.Center + (Projectile.rotation.ToRotationVector2() * (30 + 50 * i) * Projectile.scale) + Projectile.rotation.ToRotationVector2().RotatedBy(-MathHelper.PiOver2) * 30f * scaleFactor * Main.rand.NextFloat(); + Vector2 smokespeed = Projectile.rotation.ToRotationVector2().RotatedBy(-MathHelper.PiOver2 * Owner.direction) * 20f * scaleFactor + Owner.velocity; Particle smoke = new HeavySmokeParticle(smokepos, smokespeed, Color.Lerp(Color.DodgerBlue, Color.MediumVioletRed, i), 6 + Main.rand.Next(5), scaleFactor * Main.rand.NextFloat(2.8f, 3.1f), Opacity + Main.rand.NextFloat(0f, 0.2f), 0f, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); @@ -358,18 +359,18 @@ namespace CalamityMod.Projectiles.Melee if (smear == null) { if (Charge <= 0) - smear = new TrientCircularSmear(projectile.Center, smearColor * opacity, projectile.rotation, projectile.scale * 1.7f); + smear = new TrientCircularSmear(Projectile.Center, smearColor * opacity, Projectile.rotation, Projectile.scale * 1.7f); else - smear = new CircularSmearSmokeyVFX(projectile.Center, smearColor * opacity, projectile.rotation, projectile.scale * 1.7f); + smear = new CircularSmearSmokeyVFX(Projectile.Center, smearColor * opacity, Projectile.rotation, Projectile.scale * 1.7f); GeneralParticleHandler.SpawnParticle(smear); } //Update the variables of the smear else { - smear.Rotation = projectile.rotation - 3.5f * MathHelper.PiOver4; + smear.Rotation = Projectile.rotation - 3.5f * MathHelper.PiOver4; smear.Time = 0; - smear.Position = projectile.Center; - smear.Scale = projectile.scale * 1.65f; + smear.Position = Projectile.Center; + smear.Scale = Projectile.scale * 1.65f; smear.Color = smearColor * opacity; } @@ -378,11 +379,11 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextBool()) { - float maxDistance = projectile.scale * 78f; + float maxDistance = Projectile.scale * 78f; Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance); Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(-MathHelper.PiOver2), Vector2.Zero) * 2 * (1f + distance.Length() / 15f); Color glitterColor = Main.hslToRgb(Main.rand.NextFloat(), 1, 0.5f); - Particle glitter = new CritSpark(projectile.Center + distance, Owner.velocity + angularVelocity, Color.White , glitterColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); + Particle glitter = new CritSpark(Projectile.Center + distance, Owner.velocity + angularVelocity, Color.White , glitterColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); GeneralParticleHandler.SpawnParticle(glitter); } @@ -394,8 +395,8 @@ namespace CalamityMod.Projectiles.Melee { for (float i = 0.5f; i <= 1; i += 0.5f) { - Vector2 smokepos = projectile.Center + (projectile.rotation.ToRotationVector2() * (60 * i) * projectile.scale) + projectile.rotation.ToRotationVector2().RotatedBy(-MathHelper.PiOver2) * 30f * scaleFactor * Main.rand.NextFloat(); - Vector2 smokespeed = projectile.rotation.ToRotationVector2().RotatedBy(MathHelper.PiOver2) * 20f * scaleFactor + Owner.velocity; + Vector2 smokepos = Projectile.Center + (Projectile.rotation.ToRotationVector2() * (60 * i) * Projectile.scale) + Projectile.rotation.ToRotationVector2().RotatedBy(-MathHelper.PiOver2) * 30f * scaleFactor * Main.rand.NextFloat(); + Vector2 smokespeed = Projectile.rotation.ToRotationVector2().RotatedBy(MathHelper.PiOver2) * 20f * scaleFactor + Owner.velocity; Particle smoke = new HeavySmokeParticle(smokepos, smokespeed, Color.Lerp(Color.DodgerBlue, Color.MediumVioletRed, i), 10 + Main.rand.Next(5), scaleFactor * Main.rand.NextFloat(2.8f, 3.1f), opacity + Main.rand.NextFloat(0f, 0.2f), 0f, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); @@ -421,14 +422,14 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 5; i++) { - Vector2 particleSpeed = Utils.SafeNormalize(target.Center - projectile.Center , Vector2.One).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(3.6f, 8f); + Vector2 particleSpeed = Utils.SafeNormalize(target.Center - Projectile.Center , Vector2.One).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(3.6f, 8f); Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.OrangeRed, 60, 2, 2.5f, hueShift: 0.06f); GeneralParticleHandler.SpawnParticle(energyLeak); } if (Combo == 3f) { - var snapSound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), projectile.Center); + var snapSound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center); SafeVolumeChange(ref snapSound, 1.3f); if (Charge <= 1) @@ -447,10 +448,10 @@ namespace CalamityMod.Projectiles.Melee if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3) Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3; - Main.PlaySound(SoundID.Item84, projectile.Center); + SoundEngine.PlaySound(SoundID.Item84, Projectile.Center); Vector2 sliceDirection = Utils.SafeNormalize(direction, Vector2.One) * 40; - Particle SliceLine = new LineVFX(projectile.Center - sliceDirection, sliceDirection * 2f, 0.2f, Color.Orange * 0.7f, expansion : 250f) + Particle SliceLine = new LineVFX(Projectile.Center - sliceDirection, sliceDirection * 2f, 0.2f, Color.Orange * 0.7f, expansion : 250f) { Lifetime = 10 }; @@ -487,25 +488,25 @@ namespace CalamityMod.Projectiles.Melee SpriteEffects flip = flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None; float extraAngle = Owner.direction < 0 ? MathHelper.PiOver2 : 0f; - float drawAngle = projectile.rotation; + float drawAngle = Projectile.rotation; float angleShift = MathHelper.PiOver4; - float drawRotation = projectile.rotation + angleShift + extraAngle; + float drawRotation = Projectile.rotation + angleShift + extraAngle; Vector2 drawOrigin = new Vector2(flipped ? sword.Width : 0f, sword.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[projectile.type] && Combo == 0f) + if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type] && Combo == 0f) { - for (int i = 1; i < projectile.oldRot.Length; ++i) + for (int i = 1; i < Projectile.oldRot.Length; ++i) { - Color color = Main.hslToRgb((i / (float)projectile.oldRot.Length) * 0.1f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f)); - float afterimageRotation = projectile.oldRot[i] + angleShift + extraAngle; - Main.spriteBatch.Draw(glowmask, drawOffset, null, color * 0.05f, afterimageRotation, drawOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), flip, 0f); + Color color = Main.hslToRgb((i / (float)Projectile.oldRot.Length) * 0.1f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f)); + float afterimageRotation = Projectile.oldRot[i] + angleShift + extraAngle; + Main.spriteBatch.Draw(glowmask, drawOffset, null, color * 0.05f, afterimageRotation, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), flip, 0f); } } - spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, flip, 0f); - spriteBatch.Draw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, flip, 0f); + spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f); + spriteBatch.Draw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f); if (SwingCompletion > 0.5f && Combo == 0f) { @@ -518,7 +519,7 @@ namespace CalamityMod.Projectiles.Melee float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * SwingCompletion + (Combo == 1f ? MathHelper.PiOver4 : 0)) * SwingDirection; Color smearColor = Main.hslToRgb(((SwingTimer - MaxSwingTime * 0.5f) / (MaxSwingTime * 0.5f)) * 0.15f + ((Combo == 1f) ? 0.85f : 0f), 1, 0.6f); - spriteBatch.Draw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, projectile.scale * 2.3f, SpriteEffects.None, 0); + spriteBatch.Draw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 2.3f, SpriteEffects.None, 0); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -537,9 +538,9 @@ namespace CalamityMod.Projectiles.Melee SpriteEffects flip = flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None; float extraAngle = flipped ? MathHelper.PiOver2 : 0f; - float drawAngle = projectile.rotation; + float drawAngle = Projectile.rotation; float angleShift = MathHelper.PiOver4; - float drawRotation = projectile.rotation + angleShift + extraAngle; + float drawRotation = Projectile.rotation + angleShift + extraAngle; Vector2 drawOrigin = new Vector2(flipped ? frontBlade.Width : 0f, frontBlade.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; @@ -547,26 +548,26 @@ namespace CalamityMod.Projectiles.Melee //Back blade Vector2 backScissorOrigin = new Vector2(flipped ? 90 : 44f, 86); //Lined up with the hole in the scissor blade - Vector2 backScissorDrawPosition = Owner.Center + drawAngle.ToRotationVector2() * 10f + (drawAngle.ToRotationVector2() * 56f + (drawAngle - MathHelper.PiOver2).ToRotationVector2() * 11 * Owner.direction) * projectile.scale - Main.screenPosition; //Lined up with the hole in the front blade + Vector2 backScissorDrawPosition = Owner.Center + drawAngle.ToRotationVector2() * 10f + (drawAngle.ToRotationVector2() * 56f + (drawAngle - MathHelper.PiOver2).ToRotationVector2() * 11 * Owner.direction) * Projectile.scale - Main.screenPosition; //Lined up with the hole in the front blade - if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[projectile.type]) + if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) { Texture2D afterimage = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsGlow"); - for (int i = 1; i < projectile.oldRot.Length; ++i) + for (int i = 1; i < Projectile.oldRot.Length; ++i) { - Color color = Main.hslToRgb((i / (float)projectile.oldRot.Length) * 0.1f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f)); - float afterimageRotation = projectile.oldRot[i] + angleShift + extraAngle; + Color color = Main.hslToRgb((i / (float)Projectile.oldRot.Length) * 0.1f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f)); + float afterimageRotation = Projectile.oldRot[i] + angleShift + extraAngle; - spriteBatch.Draw(afterimage, drawOffset, null, color * 0.15f, afterimageRotation, drawOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), flip, 0f); + spriteBatch.Draw(afterimage, drawOffset, null, color * 0.15f, afterimageRotation, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), flip, 0f); } } - spriteBatch.Draw(backBlade, backScissorDrawPosition, null, lightColor, drawRotation, backScissorOrigin, projectile.scale, flip, 0f); - spriteBatch.Draw(backBladeGlow, backScissorDrawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, backScissorOrigin, projectile.scale, flip, 0f); + spriteBatch.Draw(backBlade, backScissorDrawPosition, null, lightColor, drawRotation, backScissorOrigin, Projectile.scale, flip, 0f); + spriteBatch.Draw(backBladeGlow, backScissorDrawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, backScissorOrigin, Projectile.scale, flip, 0f); - spriteBatch.Draw(frontBlade, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, flip, 0f); - spriteBatch.Draw(frontBladeGlow, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, flip, 0f); + spriteBatch.Draw(frontBlade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f); + spriteBatch.Draw(frontBladeGlow, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f); if (SwingCompletion > 0.5f && Combo == 0f) { @@ -579,7 +580,7 @@ namespace CalamityMod.Projectiles.Melee float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * SwingCompletion + (Combo == 1f ? MathHelper.PiOver4 : 0)) * SwingDirection; Color smearColor = Main.hslToRgb(((SwingTimer - MaxSwingTime * 0.5f) / (MaxSwingTime * 0.5f)) * 0.15f + ((Combo == 1f) ? 0.85f : 0f), 1, 0.6f); - spriteBatch.Draw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, projectile.scale * 2.3f, SpriteEffects.None, 0); + spriteBatch.Draw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 2.3f, SpriteEffects.None, 0); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -596,20 +597,20 @@ namespace CalamityMod.Projectiles.Melee Texture2D thrownSword = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight"); Texture2D thrownGlowmask = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow"); - Vector2 drawPos2 = Vector2.SmoothStep(Owner.Center, projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f)); + Vector2 drawPos2 = Vector2.SmoothStep(Owner.Center, Projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f)); float drawRotation2 = direction.ToRotation() + MathHelper.PiOver4; Vector2 drawOrigin2 = new Vector2(44, 86); - spriteBatch.Draw(thrownSword, drawPos2 - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, projectile.scale, 0f, 0f); - spriteBatch.Draw(thrownGlowmask, drawPos2 - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, projectile.scale, 0f, 0f); + spriteBatch.Draw(thrownSword, drawPos2 - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); + spriteBatch.Draw(thrownGlowmask, drawPos2 - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); } - Vector2 drawPos = projectile.Center; - float drawRotation = projectile.rotation + MathHelper.PiOver4; + Vector2 drawPos = Projectile.Center; + float drawRotation = Projectile.rotation + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(32, 86); //Right on the hole. Well tbh here its not the hole theres a gem on it but you get me. - spriteBatch.Draw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); - spriteBatch.Draw(glowmask, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + spriteBatch.Draw(glowmask, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); } public void DrawThrownScissors(SpriteBatch spriteBatch, Color lightColor) @@ -619,21 +620,21 @@ namespace CalamityMod.Projectiles.Melee Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight"); Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow"); - Vector2 drawPos = projectile.Center; + Vector2 drawPos = Projectile.Center; Vector2 drawOrigin = new Vector2(32, 86); - float drawRotation = projectile.rotation + MathHelper.PiOver4; + float drawRotation = Projectile.rotation + MathHelper.PiOver4; Vector2 drawOrigin2 = new Vector2(44, 86); //Right on the hole - float drawRotation2 = projectile.rotation + MathHelper.Lerp(MathHelper.PiOver4, MathHelper.PiOver2 * 1.33f, MathHelper.Clamp(ThrowCompletion * 2f, 0f, 1f)); + float drawRotation2 = Projectile.rotation + MathHelper.Lerp(MathHelper.PiOver4, MathHelper.PiOver2 * 1.33f, MathHelper.Clamp(ThrowCompletion * 2f, 0f, 1f)); if (Combo == 3f) - drawRotation2 = projectile.rotation + MathHelper.Lerp(MathHelper.PiOver2 * 1.33f, MathHelper.PiOver4, MathHelper.Clamp(SnapEndCompletion + 0.5f, 0f, 1f)); + drawRotation2 = Projectile.rotation + MathHelper.Lerp(MathHelper.PiOver2 * 1.33f, MathHelper.PiOver4, MathHelper.Clamp(SnapEndCompletion + 0.5f, 0f, 1f)); - spriteBatch.Draw(backBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, projectile.scale, 0f, 0f); - spriteBatch.Draw(backBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, projectile.scale, 0f, 0f); + spriteBatch.Draw(backBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); + spriteBatch.Draw(backBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); - spriteBatch.Draw(frontBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); - spriteBatch.Draw(frontBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(frontBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + spriteBatch.Draw(frontBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs index 13551fa408..3c083d45ae 100644 --- a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs @@ -9,6 +9,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -20,12 +21,12 @@ namespace CalamityMod.Projectiles.Melee private bool initialized = false; const float MaxTime = 340; static float ParryTime = 15; - public Vector2 DistanceFromPlayer => projectile.velocity * 10 + projectile.velocity * 10 * ThrustDisplaceRatio(); - public float Timer => MaxTime - projectile.timeLeft; - public float ParryProgress => (MaxTime - projectile.timeLeft) / ParryTime; + public Vector2 DistanceFromPlayer => Projectile.velocity * 10 + Projectile.velocity * 10 * ThrustDisplaceRatio(); + public float Timer => MaxTime - Projectile.timeLeft; + public float ParryProgress => (MaxTime - Projectile.timeLeft) / ParryTime; - public ref float AlreadyParried => ref projectile.ai[1]; - public Player Owner => Main.player[projectile.owner]; + public ref float AlreadyParried => ref Projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { @@ -33,12 +34,12 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 75; - projectile.width = projectile.height = 75; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 75; + Projectile.width = Projectile.height = 75; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; } public override bool CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; @@ -47,8 +48,8 @@ namespace CalamityMod.Projectiles.Melee { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 142f * projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (projectile.velocity * bladeLenght), 44, ref collisionPoint); + float bladeLenght = 142f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 44, ref collisionPoint); } public void GeneralParryEffects() @@ -59,11 +60,11 @@ namespace CalamityMod.Projectiles.Melee sword.Charge = 10f; sword.Combo = 0f; } - Main.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); - var chunder = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); + var chunder = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center); SafeVolumeChange(ref chunder, 1.3f); - CombatText.NewText(projectile.Hitbox, new Color(111, 247, 200), "Parry!", true); + CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), "Parry!", true); for (int i = 0; i < 5; i ++) //Don't loose your way { @@ -87,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee if (target.damage > 0) Owner.GiveIFrames(35); - Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : projectile.Center + projectile.rotation.ToRotationVector2() * 60f; + Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f; Particle spark = new GenericSparkle(particleOrigin, Vector2.Zero, Color.White, Color.HotPink, 1.2f, 35, 0.1f, 2); GeneralParticleHandler.SpawnParticle(spark); @@ -103,28 +104,28 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - projectile.timeLeft = (int)MaxTime; - var sound = Main.PlaySound(SoundID.Item84, projectile.Center); + Projectile.timeLeft = (int)MaxTime; + var sound = SoundEngine.PlaySound(SoundID.Item84, Projectile.Center); CalamityUtils.SafeVolumeChange(ref sound, 0.3f); - projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - projectile.velocity.Normalize(); - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); + Projectile.velocity.Normalize(); + Projectile.rotation = Projectile.velocity.ToRotation(); initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } //Manage position and rotation - projectile.Center = Owner.Center + DistanceFromPlayer ; - projectile.scale = 1.4f + ThrustDisplaceRatio() * 0.2f; + Projectile.Center = Owner.Center + DistanceFromPlayer ; + Projectile.scale = 1.4f + ThrustDisplaceRatio() * 0.2f; if (Timer > ParryTime) return; float collisionPoint = 0f; - float bladeLenght = 142f * projectile.scale; + float bladeLenght = 142f * Projectile.scale; for (int k = 0; k < Main.maxProjectiles; k++) { @@ -133,7 +134,7 @@ namespace CalamityMod.Projectiles.Melee if (proj.active && proj.hostile && proj.damage > 1 && //Only parry harmful projectiles proj.velocity.Length() * (proj.extraUpdates + 1) > 1f && //Only parry projectiles that move semi-quickly proj.Size.Length() < 300 && //Only parry projectiles that aren't too large - Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (projectile.velocity * bladeLenght), 24, ref collisionPoint)) + Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint)) { if (AlreadyParried == 0) { @@ -153,9 +154,9 @@ namespace CalamityMod.Projectiles.Melee //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; - Owner.direction = Math.Sign(projectile.velocity.X); - Owner.itemRotation = projectile.rotation; + Owner.heldProj = Projectile.whoAmI; + Owner.direction = Math.Sign(Projectile.velocity.X); + Owner.itemRotation = Projectile.rotation; if (Owner.direction != 1) { Owner.itemRotation -= MathHelper.Pi; @@ -192,7 +193,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawPos = Owner.Center - Main.screenPosition + new Vector2(0, -36) - barBG.Size() / 2; Rectangle frame = new Rectangle(0, 0, (int)((Timer - ParryTime) / (MaxTime - ParryTime) * barFG.Width), barFG.Height); - float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? projectile.timeLeft / 8f : 1f; + float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? Projectile.timeLeft / 8f : 1f; Color color = Main.hslToRgb((float)Math.Sin(Main.GlobalTime * 1.2f) * 0.05f + 0.08f, 1, 0.65f + (float)Math.Sin(Main.GlobalTime * 7f) * 0.1f); spriteBatch.Draw(barBG, drawPos, color * opacity); @@ -206,21 +207,21 @@ namespace CalamityMod.Projectiles.Melee Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft"); Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow"); - float snippingRotation = projectile.rotation + MathHelper.PiOver4; - float snippingRotationBack = projectile.rotation + MathHelper.PiOver4 * 1.75f; + float snippingRotation = Projectile.rotation + MathHelper.PiOver4; + float snippingRotationBack = Projectile.rotation + MathHelper.PiOver4 * 1.75f; float drawRotation = MathHelper.Lerp(snippingRotation + MathHelper.PiOver4, snippingRotation, RotationRatio()); float drawRotationBack = MathHelper.Lerp(snippingRotationBack - MathHelper.PiOver4, snippingRotationBack, RotationRatio()); Vector2 drawOrigin = new Vector2(51, 86); //Right on the hole Vector2 drawOriginBack = new Vector2(22, 109); //Right on the hole - Vector2 drawPosition = Owner.Center + projectile.velocity * 15 + projectile.velocity * ThrustDisplaceRatio() * 50f - Main.screenPosition; + Vector2 drawPosition = Owner.Center + Projectile.velocity * 15 + Projectile.velocity * ThrustDisplaceRatio() * 50f - Main.screenPosition; - spriteBatch.Draw(backBlade, drawPosition, null, lightColor, drawRotationBack, drawOriginBack, projectile.scale, 0f, 0f); - spriteBatch.Draw(backBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotationBack, drawOriginBack, projectile.scale, 0f, 0f); + spriteBatch.Draw(backBlade, drawPosition, null, lightColor, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f); + spriteBatch.Draw(backBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f); - spriteBatch.Draw(frontBlade, drawPosition, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); - spriteBatch.Draw(frontBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(frontBlade, drawPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + spriteBatch.Draw(frontBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); return false; } @@ -229,7 +230,7 @@ namespace CalamityMod.Projectiles.Melee //Play a blip when it dies, to indicate to the player its ready to get used again if (Main.myPlayer == Owner.whoAmI) { - var ding = Main.PlaySound(SoundID.Item35); + var ding = SoundEngine.PlaySound(SoundID.Item35); CalamityUtils.SafeVolumeChange(ref ding, 2f); } } diff --git a/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs b/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs index fb7eb012f9..7e42ead629 100644 --- a/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs +++ b/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs @@ -9,6 +9,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -28,17 +29,17 @@ namespace CalamityMod.Projectiles.Melee const float SnapTime = 25f; const float HoldTime = 15f; - public float SnapTimer => MaxTime - projectile.timeLeft; - public float HoldTimer => MaxTime - projectile.timeLeft - SnapTime; - public float StitchTimer => MaxTime - projectile.timeLeft - SnapTime - (HoldTime / 2f); + public float SnapTimer => MaxTime - Projectile.timeLeft; + public float HoldTimer => MaxTime - Projectile.timeLeft - SnapTime; + public float StitchTimer => MaxTime - Projectile.timeLeft - SnapTime - (HoldTime / 2f); public float SnapProgress => MathHelper.Clamp(SnapTimer / SnapTime, 0, 1); public float HoldProgress => MathHelper.Clamp(HoldTimer / HoldTime, 0, 1); public float StitchProgress => MathHelper.Clamp(StitchTimer / (MaxTime - (SnapTime + (HoldTime / 2f))), 0, 1); - public int CurrentAnimation => (MaxTime - projectile.timeLeft) <= SnapTime ? 0 : (MaxTime - projectile.timeLeft) <= SnapTime + HoldTime ? 1 : 2; + public int CurrentAnimation => (MaxTime - Projectile.timeLeft) <= SnapTime ? 0 : (MaxTime - Projectile.timeLeft) <= SnapTime + HoldTime ? 1 : 2; - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { @@ -46,15 +47,15 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 300; - projectile.width = projectile.height = 300; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 300; + Projectile.width = Projectile.height = 300; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = (int)MaxTime + 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = (int)MaxTime + 2; } public override bool CanDamage() @@ -70,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee //The hitbox is simplified into a line collision. float collisionPoint = 0f; float bladeLenght = ThrustDisplaceRatio() * 242f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + (projectile.velocity * bladeLenght), 30, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLenght), 30, ref collisionPoint); } public override bool ShouldUpdatePosition() => false; @@ -79,21 +80,21 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - projectile.timeLeft = (int)MaxTime; - var sound = Main.PlaySound(SoundID.Item84, projectile.Center); + Projectile.timeLeft = (int)MaxTime; + var sound = SoundEngine.PlaySound(SoundID.Item84, Projectile.Center); SafeVolumeChange(ref sound, 0.3f); - projectile.velocity.Normalize(); - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.velocity.Normalize(); + Projectile.rotation = Projectile.velocity.ToRotation(); initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } //Manage position and rotation - projectile.scale = 1.4f; + Projectile.scale = 1.4f; //Update stitches for (int i = 0; i < CurrentStitches; i++) @@ -101,11 +102,11 @@ namespace CalamityMod.Projectiles.Melee if (StitchRotations[i] == 0) { StitchRotations[i] = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4) + MathHelper.PiOver2; - var sewSound = Main.PlaySound(i % 3 == 0 ? SoundID.Item63 : i % 3 == 1 ? SoundID.Item64 : SoundID.Item65, Owner.Center); + var sewSound = SoundEngine.PlaySound(i % 3 == 0 ? SoundID.Item63 : i % 3 == 1 ? SoundID.Item64 : SoundID.Item65, Owner.Center); SafeVolumeChange(ref sewSound, 0.5f); float positionAlongLine = (ThrustDisplaceRatio() * 242f / (float)maxStitches * 0.5f) + MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, i / (float)maxStitches); - Vector2 stitchCenter = projectile.Center + projectile.velocity * positionAlongLine + (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f; + Vector2 stitchCenter = Projectile.Center + Projectile.velocity * positionAlongLine + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f; Particle spark = new CritSpark(stitchCenter, Vector2.Zero, Color.White, Color.Cyan, 3f, 8, 0.1f, 3); @@ -120,7 +121,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 20; i++) { float positionAlongLine = MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, Main.rand.NextFloat(0f, 1f)); - Vector2 particlePosition = projectile.Center + projectile.velocity * positionAlongLine + (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f; + Vector2 particlePosition = Projectile.Center + Projectile.velocity * positionAlongLine + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f; Color particleColor = Main.rand.NextBool() ? Color.OrangeRed : Main.rand.NextBool() ? Color.White : Color.Orange; float particleScale = Main.rand.NextFloat(0.05f, 0.4f) * (0.4f + 0.6f * (float)Math.Sin(positionAlongLine / (ThrustDisplaceRatio() * 242f) * MathHelper.Pi)); @@ -154,7 +155,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 10; i++) { - Vector2 particleSpeed = projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f); + Vector2 particleSpeed = Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f); Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Red, 60, 1, 1.5f, hueShift: 0.002f); GeneralParticleHandler.SpawnParticle(energyLeak); } @@ -162,7 +163,7 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { //Add some damage falloff - damage = (int)(damage * Math.Pow((1 - ArkoftheElements.blastFalloffStrenght), projectile.numHits * ArkoftheElements.blastFalloffSpeed)); + damage = (int)(damage * Math.Pow((1 - ArkoftheElements.blastFalloffStrenght), Projectile.numHits * ArkoftheElements.blastFalloffSpeed)); } //Animation keys @@ -183,10 +184,10 @@ namespace CalamityMod.Projectiles.Melee Texture2D sliceTex = GetTexture("CalamityMod/Particles/BloomLine"); Color sliceColor = Color.Lerp(Color.OrangeRed, Color.White, SnapProgress); - float rot = projectile.rotation + MathHelper.PiOver2; - Vector2 nitpickShiftCorrection = (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f; //Ngl these minor nitpick variables probably be horrible to understand when decompiled into Vector43 + float rot = Projectile.rotation + MathHelper.PiOver2; + Vector2 nitpickShiftCorrection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f; //Ngl these minor nitpick variables probably be horrible to understand when decompiled into Vector43 Vector2 sliceScale = new Vector2(0.2f * (1 - SnapProgress) ,ThrustDisplaceRatio() * 242f); - spriteBatch.Draw(sliceTex, projectile.Center + nitpickShiftCorrection - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0f); + spriteBatch.Draw(sliceTex, Projectile.Center + nitpickShiftCorrection - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0f); //Draw the scissors @@ -195,8 +196,8 @@ namespace CalamityMod.Projectiles.Melee Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRight"); Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft"); - float snippingRotation = projectile.rotation + MathHelper.PiOver4; - float snippingRotationBack = projectile.rotation + MathHelper.PiOver4 * 1.75f; + float snippingRotation = Projectile.rotation + MathHelper.PiOver4; + float snippingRotationBack = Projectile.rotation + MathHelper.PiOver4 * 1.75f; float nitpickAngleCorrection = MathHelper.ToRadians(6f); //ITS IMPORTANT MOM! float drawRotation = MathHelper.Lerp(snippingRotation + MathHelper.PiOver4, snippingRotation, RotationRatio()) + nitpickAngleCorrection; @@ -204,14 +205,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(51, 86); //Right on the hole Vector2 drawOriginBack = new Vector2(22, 109); //Right on the hole - Vector2 drawPosition = projectile.Center + ThrustDisplaceRatio() * projectile.velocity * 200f - Main.screenPosition; + Vector2 drawPosition = Projectile.Center + ThrustDisplaceRatio() * Projectile.velocity * 200f - Main.screenPosition; float opacity = (0.4f - HoldProgress) / 0.4f; Color drawColor = Color.Orange * opacity * 0.9f; Color drawColorBack = Color.HotPink * opacity * 0.9f; - spriteBatch.Draw(backBlade, drawPosition, null, drawColorBack, drawRotationBack, drawOriginBack, projectile.scale, 0f, 0f); - spriteBatch.Draw(frontBlade, drawPosition, null, drawColor * opacity, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(backBlade, drawPosition, null, drawColorBack, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f); + spriteBatch.Draw(frontBlade, drawPosition, null, drawColor * opacity, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); } //Draw the rip @@ -227,7 +228,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 scale = new Vector2(ripWidth, (ThrustDisplaceRatio() * 242f) / lineTex.Height); float lineOpacity = StitchProgress < 0.75f ? 1f : 1 - (StitchProgress - 0.75f) * 4f; - spriteBatch.Draw(lineTex, projectile.Center - Main.screenPosition + Shake + nitpickShiftCorrection, null, Color.Lerp(Color.White, Color.OrangeRed * 0.7f, raise) * lineOpacity, rot, origin, scale, SpriteEffects.None, 0); + spriteBatch.Draw(lineTex, Projectile.Center - Main.screenPosition + Shake + nitpickShiftCorrection, null, Color.Lerp(Color.White, Color.OrangeRed * 0.7f, raise) * lineOpacity, rot, origin, scale, SpriteEffects.None, 0); //Draw the stitches @@ -236,9 +237,9 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < CurrentStitches; i++) { float positionAlongLine = (ThrustDisplaceRatio() * 242f / (float)maxStitches * 0.5f) + MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, i / (float)maxStitches); - Vector2 stitchCenter = projectile.Center + projectile.velocity * positionAlongLine + nitpickShiftCorrection; + Vector2 stitchCenter = Projectile.Center + Projectile.velocity * positionAlongLine + nitpickShiftCorrection; - rot = projectile.rotation + MathHelper.PiOver2 + StitchRotations[i]; + rot = Projectile.rotation + MathHelper.PiOver2 + StitchRotations[i]; origin = new Vector2(lineTex.Width / 2f, lineTex.Height / 2f); float stitchLenght = (float)Math.Sin(i / (float)(maxStitches - 1) * MathHelper.Pi) * 0.5f + 0.5f; diff --git a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs index 458c73a82e..b6bf8577b1 100644 --- a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs @@ -9,6 +9,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -19,9 +20,9 @@ namespace CalamityMod.Projectiles.Melee private bool initialized = false; Vector2 direction = Vector2.Zero; - public ref float Combo => ref projectile.ai[0]; - public ref float Charge => ref projectile.ai[1]; - public Player Owner => Main.player[projectile.owner]; + public ref float Combo => ref Projectile.ai[0]; + public ref float Charge => ref Projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; #region Regular swing variables @@ -45,9 +46,9 @@ namespace CalamityMod.Projectiles.Melee private float SwingWidth = MathHelper.PiOver2 * 1.5f; public Vector2 DistanceFromPlayer => direction * 30; - public float SwingTimer => MaxSwingTime - projectile.timeLeft; + public float SwingTimer => MaxSwingTime - Projectile.timeLeft; public float SwingCompletion => SwingTimer / MaxSwingTime; - public ref float HasFired => ref projectile.localAI[0]; + public ref float HasFired => ref Projectile.localAI[0]; #endregion #region Throw variables @@ -58,59 +59,59 @@ namespace CalamityMod.Projectiles.Melee const float ThrowReachMax = 500; const float ThrowReachMin = 200; public float ThrowReach; - public float ThrowTimer => MaxThrowTime - projectile.timeLeft; + public float ThrowTimer => MaxThrowTime - Projectile.timeLeft; public float ThrowCompletion => ThrowTimer / MaxThrowTime; const float SnapWindowStart = 0.4f; const float SnapWindowEnd = 0.6f; public float SnapEndTime => (MaxThrowTime - (MaxThrowTime * SnapWindowEnd)); - public float SnapEndCompletion => (SnapEndTime - projectile.timeLeft) / SnapEndTime; - public ref float ChanceMissed => ref projectile.localAI[1]; + public float SnapEndCompletion => (SnapEndTime - Projectile.timeLeft) / SnapEndTime; + public ref float ChanceMissed => ref Projectile.localAI[1]; #endregion public override void SetStaticDefaults() { DisplayName.SetDefault("Ark of the Elements"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 60; - projectile.width = projectile.height = 60; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = Thrown ? 10 : (int)MaxSwingTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 60; + Projectile.width = Projectile.height = 60; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Thrown ? 10 : (int)MaxSwingTime; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - float bladeLenght = 142f * projectile.scale; + float bladeLenght = 142f * Projectile.scale; if (Thrown) { - bool mainCollision = Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center - Vector2.One * bladeLenght / 2f, Vector2.One * bladeLenght); + bool mainCollision = Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.One * bladeLenght / 2f, Vector2.One * bladeLenght); if (Combo == 2f) return mainCollision; else { - Vector2 thrownBladeStart = Vector2.SmoothStep(Owner.Center, projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f)); + Vector2 thrownBladeStart = Vector2.SmoothStep(Owner.Center, Projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f)); bool thrownScissorCollision = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), thrownBladeStart, thrownBladeStart + direction * bladeLenght); return mainCollision || thrownScissorCollision; } } float collisionPoint = 0f; - Vector2 holdPoint = DistanceFromPlayer.Length() * projectile.rotation.ToRotationVector2(); + Vector2 holdPoint = DistanceFromPlayer.Length() * Projectile.rotation.ToRotationVector2(); - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint); } //Swing animation keys @@ -134,56 +135,56 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - projectile.timeLeft = Thrown ? (int) MaxThrowTime : (int)MaxSwingTime; - var sound = Main.PlaySound((Charge > 0 || Thrown) ? SoundID.DD2_PhantomPhoenixShot : SoundID.Item71, projectile.Center); + Projectile.timeLeft = Thrown ? (int) MaxThrowTime : (int)MaxSwingTime; + var sound = SoundEngine.PlaySound((Charge > 0 || Thrown) ? SoundID.DD2_PhantomPhoenixShot : SoundID.Item71, Projectile.Center); if (Charge > 0) CalamityUtils.SafeVolumeChange(ref sound, 2.5f); - direction = projectile.velocity; + direction = Projectile.velocity; direction.Normalize(); - projectile.rotation = direction.ToRotation(); + Projectile.rotation = direction.ToRotation(); if (Thrown) ThrowReach = MathHelper.Clamp((Owner.Center - Owner.Calamity().mouseWorld).Length(), ThrowReachMin, ThrowReachMax); initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } if (!Thrown) { //Manage position and rotation - projectile.Center = Owner.Center + DistanceFromPlayer; + Projectile.Center = Owner.Center + DistanceFromPlayer; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Lerp(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, SwingRatio()) - (Combo == 1 ? MathHelper.PiOver4 : 0f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Lerp(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, SwingRatio()) - (Combo == 1 ? MathHelper.PiOver4 : 0f); - projectile.scale = 1.2f + ((float)Math.Sin(SwingRatio() * MathHelper.Pi) * 0.6f) + (Charge / 10f) * 0.2f; + Projectile.scale = 1.2f + ((float)Math.Sin(SwingRatio() * MathHelper.Pi) * 0.6f) + (Charge / 10f) * 0.2f; } else { - Vector2 sparklePosition = projectile.Center + projectile.rotation.ToRotationVector2() * 90 * projectile.scale + (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 20 * projectile.scale; - Particle sparkle = new CritSpark(sparklePosition, projectile.rotation.ToRotationVector2() * 7f, Color.White, Color.OrangeRed, Main.rand.NextFloat(1f, 2f), 10 + Main.rand.Next(10), 0.1f, 3f, Main.rand.NextFloat(0f, 0.01f)); + Vector2 sparklePosition = Projectile.Center + Projectile.rotation.ToRotationVector2() * 90 * Projectile.scale + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 20 * Projectile.scale; + Particle sparkle = new CritSpark(sparklePosition, Projectile.rotation.ToRotationVector2() * 7f, Color.White, Color.OrangeRed, Main.rand.NextFloat(1f, 2f), 10 + Main.rand.Next(10), 0.1f, 3f, Main.rand.NextFloat(0f, 0.01f)); GeneralParticleHandler.SpawnParticle(sparkle); //Telegraph the start of the snap window with a bit of leeway if (Math.Abs(ThrowCompletion - SnapWindowStart + 0.1f) <= 0.005f && ChanceMissed == 0f && Main.myPlayer == Owner.whoAmI) { - Particle pulse = new PulseRing(projectile.Center, Vector2.Zero, Color.OrangeRed, 0.05f, 1.8f, 8); + Particle pulse = new PulseRing(Projectile.Center, Vector2.Zero, Color.OrangeRed, 0.05f, 1.8f, 8); GeneralParticleHandler.SpawnParticle(pulse); - Main.PlaySound(SoundID.Item4); + SoundEngine.PlaySound(SoundID.Item4); } - projectile.Center = Owner.Center + direction * ThrowRatio() * ThrowReach; - projectile.rotation -= MathHelper.PiOver4 * 0.3f; - projectile.scale = 1f + ThrowScaleRatio() * 0.5f; + Projectile.Center = Owner.Center + direction * ThrowRatio() * ThrowReach; + Projectile.rotation -= MathHelper.PiOver4 * 0.3f; + Projectile.scale = 1f + ThrowScaleRatio() * 0.5f; //Snip if (!OwnerCanShoot && Combo == 2 && ThrowCompletion >= (SnapWindowStart - 0.1f) && ThrowCompletion < SnapWindowEnd && ChanceMissed == 0f) { - Particle snapSpark = new GenericSparkle(projectile.Center, Owner.velocity - Utils.SafeNormalize(projectile.velocity, Vector2.Zero), Color.White, Color.OrangeRed, Main.rand.NextFloat(1f, 2f), 10 + Main.rand.Next(10), 0.1f, 3f); + Particle snapSpark = new GenericSparkle(Projectile.Center, Owner.velocity - Utils.SafeNormalize(Projectile.velocity, Vector2.Zero), Color.White, Color.OrangeRed, Main.rand.NextFloat(1f, 2f), 10 + Main.rand.Next(10), 0.1f, 3f); GeneralParticleHandler.SpawnParticle(snapSpark); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3) @@ -193,13 +194,13 @@ namespace CalamityMod.Projectiles.Melee { //Reset local immunity so that the snap can do damage for (int i = 0; i < Main.maxNPCs; ++i) - projectile.localNPCImmunity[i] = 0; + Projectile.localNPCImmunity[i] = 0; } Combo = 3f; //Mark the end of the regular throw - projectile.velocity = projectile.rotation.ToRotationVector2(); - projectile.timeLeft = (int)SnapEndTime; - projectile.localNPCHitCooldown = (int)SnapEndTime; //Only snap the enemies ONCE + Projectile.velocity = Projectile.rotation.ToRotationVector2(); + Projectile.timeLeft = (int)SnapEndTime; + Projectile.localNPCHitCooldown = (int)SnapEndTime; //Only snap the enemies ONCE } else if (!OwnerCanShoot && Combo == 2 && ChanceMissed == 0f) @@ -209,22 +210,22 @@ namespace CalamityMod.Projectiles.Melee { //Slow down the projectile's retraction float curveDownGently = MathHelper.Lerp(1f, 0.8f, 1f - (float)Math.Sqrt(1f - (float)Math.Pow(SnapEndCompletion , 2f))); - projectile.Center = Owner.Center + direction * ThrowReach * curveDownGently; - projectile.scale = 1.5f; + Projectile.Center = Owner.Center + direction * ThrowReach * curveDownGently; + Projectile.scale = 1.5f; float orientateProperly = (float)Math.Sqrt(1f - (float)Math.Pow(MathHelper.Clamp(SnapEndCompletion + 0.2f, 0f, 1f) - 1f, 2f)); - float extraRotations = (direction.ToRotation() + MathHelper.PiOver4 > projectile.velocity.ToRotation()) ? -MathHelper.TwoPi : 0f; + float extraRotations = (direction.ToRotation() + MathHelper.PiOver4 > Projectile.velocity.ToRotation()) ? -MathHelper.TwoPi : 0f; - projectile.rotation = MathHelper.Lerp(projectile.velocity.ToRotation(), direction.ToRotation() + MathHelper.PiOver4 * 0.2f + extraRotations, orientateProperly); + Projectile.rotation = MathHelper.Lerp(Projectile.velocity.ToRotation(), direction.ToRotation() + MathHelper.PiOver4 * 0.2f + extraRotations, orientateProperly); } } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; - Owner.direction = Math.Sign(projectile.velocity.X); - Owner.itemRotation = projectile.rotation; + Owner.heldProj = Projectile.whoAmI; + Owner.direction = Math.Sign(Projectile.velocity.X); + Owner.itemRotation = Projectile.rotation; if (Owner.direction != 1) { Owner.itemRotation -= MathHelper.Pi; @@ -243,14 +244,14 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 5; i++) { - Vector2 particleSpeed = Utils.SafeNormalize(target.Center - projectile.Center , Vector2.One).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(3.6f, 8f); + Vector2 particleSpeed = Utils.SafeNormalize(target.Center - Projectile.Center , Vector2.One).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(3.6f, 8f); Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.OrangeRed, 60, 2, 2.5f, hueShift: 0.06f); GeneralParticleHandler.SpawnParticle(energyLeak); } if (Combo == 3f) { - var snapSound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), projectile.Center); + var snapSound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center); SafeVolumeChange(ref snapSound, 1.3f); if (Charge <= 1) @@ -269,10 +270,10 @@ namespace CalamityMod.Projectiles.Melee if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3) Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3; - Main.PlaySound(SoundID.Item84, projectile.Center); + SoundEngine.PlaySound(SoundID.Item84, Projectile.Center); Vector2 sliceDirection = direction * 40; - Particle SliceLine = new LineVFX(projectile.Center - sliceDirection, sliceDirection * 2f, 0.2f, Color.Orange * 0.7f, expansion : 250f) + Particle SliceLine = new LineVFX(Projectile.Center - sliceDirection, sliceDirection * 2f, 0.2f, Color.Orange * 0.7f, expansion : 250f) { Lifetime = 10 }; @@ -309,25 +310,25 @@ namespace CalamityMod.Projectiles.Melee SpriteEffects flip = flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None; float extraAngle = Owner.direction < 0 ? MathHelper.PiOver2 : 0f; - float drawAngle = projectile.rotation; + float drawAngle = Projectile.rotation; float angleShift = Combo == 0 ? MathHelper.PiOver4 : MathHelper.PiOver2; - float drawRotation = projectile.rotation + angleShift + extraAngle; + float drawRotation = Projectile.rotation + angleShift + extraAngle; Vector2 drawOrigin = new Vector2(Combo == 1 ? sword.Width / 2f : flipped ? sword.Width : 0f, sword.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[projectile.type]) + if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) { - for (int i = 0; i < projectile.oldRot.Length; ++i) + for (int i = 0; i < Projectile.oldRot.Length; ++i) { - Color color = Main.hslToRgb((i / (float)projectile.oldRot.Length) * 0.1f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f)); - float afterimageRotation = projectile.oldRot[i] + angleShift + extraAngle; - Main.spriteBatch.Draw(glowmask, drawOffset, null, color * 0.15f, afterimageRotation, drawOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), flip, 0f); + Color color = Main.hslToRgb((i / (float)Projectile.oldRot.Length) * 0.1f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f)); + float afterimageRotation = Projectile.oldRot[i] + angleShift + extraAngle; + Main.spriteBatch.Draw(glowmask, drawOffset, null, color * 0.15f, afterimageRotation, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), flip, 0f); } } - spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, flip, 0f); - spriteBatch.Draw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, flip, 0f); + spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f); + spriteBatch.Draw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f); if (SwingCompletion > 0.5f) { @@ -340,7 +341,7 @@ namespace CalamityMod.Projectiles.Melee float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * SwingCompletion + (Combo == 1f ? MathHelper.PiOver4 : 0)) * SwingDirection; Color smearColor = Main.hslToRgb(((SwingTimer - MaxSwingTime * 0.5f) / (MaxSwingTime * 0.5f)) * 0.15f + ((Combo == 1f) ? 0.85f : 0f), 1, 0.6f); - spriteBatch.Draw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, projectile.scale * 2.3f, SpriteEffects.None, 0); + spriteBatch.Draw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 2.3f, SpriteEffects.None, 0); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -358,36 +359,36 @@ namespace CalamityMod.Projectiles.Melee bool flipped = Owner.direction < 0; SpriteEffects flip = flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None; float extraAngle = flipped ? MathHelper.PiOver2 : 0f; - float drawAngle = projectile.rotation; + float drawAngle = Projectile.rotation; float angleShift = (Combo == 0 || !flipped) ? MathHelper.PiOver4 : MathHelper.PiOver2 * 1.5f; - float drawRotation = projectile.rotation + angleShift + extraAngle; + float drawRotation = Projectile.rotation + angleShift + extraAngle; Vector2 drawOrigin = new Vector2(flipped ? frontBlade.Width : 0f, frontBlade.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; //Back blade float functionalDrawAngle = drawAngle + (Combo == 1f && flipped ? MathHelper.PiOver2 : 0f); Vector2 backScissorOrigin = new Vector2(flipped ? 11 : 20f, 109); //Lined up with the hole in the scissor blade - Vector2 backScissorDrawPosition = Owner.Center + drawAngle.ToRotationVector2() * 10f + functionalDrawAngle.ToRotationVector2() * 70f * projectile.scale - Main.screenPosition; //Lined up with the hole in the front blade + Vector2 backScissorDrawPosition = Owner.Center + drawAngle.ToRotationVector2() * 10f + functionalDrawAngle.ToRotationVector2() * 70f * Projectile.scale - Main.screenPosition; //Lined up with the hole in the front blade float backScissorRotation = drawRotation + (Combo == 1 ? (!flipped ? MathHelper.PiOver4 * 0.75f : MathHelper.PiOver4 * -0.75f) : 0f); - if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[projectile.type]) + if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) { - for (int i = 0; i < projectile.oldRot.Length; ++i) + for (int i = 0; i < Projectile.oldRot.Length; ++i) { - Color color = Main.hslToRgb((i / (float)projectile.oldRot.Length) * 0.1f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f)); - float afterimageRotation = projectile.oldRot[i] + angleShift + extraAngle; + Color color = Main.hslToRgb((i / (float)Projectile.oldRot.Length) * 0.1f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f)); + float afterimageRotation = Projectile.oldRot[i] + angleShift + extraAngle; float afterimageBackRotation = afterimageRotation + (backScissorRotation - drawRotation); - spriteBatch.Draw(backBladeGlow, backScissorDrawPosition, null, color * 0.15f, afterimageBackRotation, backScissorOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), flip, 0f); - spriteBatch.Draw(frontBladeGlow, drawOffset, null, color * 0.15f, afterimageRotation, drawOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), flip, 0f); + spriteBatch.Draw(backBladeGlow, backScissorDrawPosition, null, color * 0.15f, afterimageBackRotation, backScissorOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), flip, 0f); + spriteBatch.Draw(frontBladeGlow, drawOffset, null, color * 0.15f, afterimageRotation, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), flip, 0f); } } - spriteBatch.Draw(backBlade, backScissorDrawPosition, null, lightColor, backScissorRotation, backScissorOrigin, projectile.scale, flip, 0f); - spriteBatch.Draw(backBladeGlow, backScissorDrawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), backScissorRotation, backScissorOrigin, projectile.scale, flip, 0f); + spriteBatch.Draw(backBlade, backScissorDrawPosition, null, lightColor, backScissorRotation, backScissorOrigin, Projectile.scale, flip, 0f); + spriteBatch.Draw(backBladeGlow, backScissorDrawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), backScissorRotation, backScissorOrigin, Projectile.scale, flip, 0f); - spriteBatch.Draw(frontBlade, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, flip, 0f); - spriteBatch.Draw(frontBladeGlow, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, flip, 0f); + spriteBatch.Draw(frontBlade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f); + spriteBatch.Draw(frontBladeGlow, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f); if (SwingCompletion > 0.5f) { @@ -400,7 +401,7 @@ namespace CalamityMod.Projectiles.Melee float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * SwingCompletion + (Combo == 1f ? MathHelper.PiOver4 : 0)) * SwingDirection; Color smearColor = Main.hslToRgb(((SwingTimer - MaxSwingTime * 0.5f) / (MaxSwingTime * 0.5f)) * 0.15f + ((Combo == 1f) ? 0.85f : 0f), 1, 0.6f); - spriteBatch.Draw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, projectile.scale * 2.3f, SpriteEffects.None, 0); + spriteBatch.Draw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 2.3f, SpriteEffects.None, 0); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -418,21 +419,21 @@ namespace CalamityMod.Projectiles.Melee Texture2D thrownSword = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft"); Texture2D thrownGlowmask = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow"); - Vector2 drawPos2 = Vector2.SmoothStep(Owner.Center, projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f)); + Vector2 drawPos2 = Vector2.SmoothStep(Owner.Center, Projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f)); Vector2 drawOrigin2 = new Vector2(22, 109); //Right on the hole float drawRotation2 = direction.ToRotation() + MathHelper.PiOver2; - spriteBatch.Draw(thrownSword, drawPos2 - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, projectile.scale, 0f, 0f); - spriteBatch.Draw(thrownGlowmask, drawPos2 - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, projectile.scale, 0f, 0f); + spriteBatch.Draw(thrownSword, drawPos2 - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); + spriteBatch.Draw(thrownGlowmask, drawPos2 - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); } - Vector2 drawPos = projectile.Center; + Vector2 drawPos = Projectile.Center; Vector2 drawOrigin = new Vector2(51, 86); //Right on the hole - float drawRotation = projectile.rotation + MathHelper.PiOver4; + float drawRotation = Projectile.rotation + MathHelper.PiOver4; - spriteBatch.Draw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); - spriteBatch.Draw(glowmask, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + spriteBatch.Draw(glowmask, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear"); @@ -443,7 +444,7 @@ namespace CalamityMod.Projectiles.Melee float rotation = drawRotation + MathHelper.PiOver2 * 1.5f; Color smearColor = Main.hslToRgb(((SwingTimer - MaxSwingTime * 0.5f) / (MaxSwingTime * 0.5f)) * 0.15f, 1, 0.6f); - spriteBatch.Draw(smear, projectile.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, rotation, smear.Size() / 2f, projectile.scale * 1.4f, SpriteEffects.None, 0); + spriteBatch.Draw(smear, Projectile.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, rotation, smear.Size() / 2f, Projectile.scale * 1.4f, SpriteEffects.None, 0); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -456,21 +457,21 @@ namespace CalamityMod.Projectiles.Melee Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft"); Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow"); - Vector2 drawPos = projectile.Center; + Vector2 drawPos = Projectile.Center; Vector2 drawOrigin = new Vector2(51, 86); //Right on the hole - float drawRotation = projectile.rotation + MathHelper.PiOver4; + float drawRotation = Projectile.rotation + MathHelper.PiOver4; Vector2 drawOrigin2 = new Vector2(22, 109); //Right on the hole - float drawRotation2 = projectile.rotation + MathHelper.Lerp(0f, -MathHelper.PiOver4 * 0.33f, MathHelper.Clamp(ThrowCompletion * 2f, 0f, 1f)); + float drawRotation2 = Projectile.rotation + MathHelper.Lerp(0f, -MathHelper.PiOver4 * 0.33f, MathHelper.Clamp(ThrowCompletion * 2f, 0f, 1f)); if (Combo == 3f) - drawRotation2 = projectile.rotation + MathHelper.Lerp(-MathHelper.PiOver4 * 0.33f, MathHelper.PiOver2 * 0.85f, MathHelper.Clamp(SnapEndCompletion + 0.5f, 0f, 1f)); + drawRotation2 = Projectile.rotation + MathHelper.Lerp(-MathHelper.PiOver4 * 0.33f, MathHelper.PiOver2 * 0.85f, MathHelper.Clamp(SnapEndCompletion + 0.5f, 0f, 1f)); - spriteBatch.Draw(backBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, projectile.scale, 0f, 0f); - spriteBatch.Draw(backBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, projectile.scale, 0f, 0f); + spriteBatch.Draw(backBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); + spriteBatch.Draw(backBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); - spriteBatch.Draw(frontBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); - spriteBatch.Draw(frontBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(frontBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + spriteBatch.Draw(frontBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Smear stuff @@ -483,7 +484,7 @@ namespace CalamityMod.Projectiles.Melee float rotation = drawRotation + MathHelper.PiOver2 * 1.5f; Color smearColor = Main.hslToRgb(((SwingTimer - MaxSwingTime * 0.5f) / (MaxSwingTime * 0.5f)) * 0.15f, 1, 0.6f); - spriteBatch.Draw(smear, projectile.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, rotation, smear.Size() / 2f, projectile.scale * 1.4f, SpriteEffects.None, 0); + spriteBatch.Draw(smear, Projectile.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, rotation, smear.Size() / 2f, Projectile.scale * 1.4f, SpriteEffects.None, 0); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Melee/ArkoftheCosmos_Constellation.cs b/Projectiles/Melee/ArkoftheCosmos_Constellation.cs index 3b31b63d7c..25b3338f37 100644 --- a/Projectiles/Melee/ArkoftheCosmos_Constellation.cs +++ b/Projectiles/Melee/ArkoftheCosmos_Constellation.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Melee public class ArkoftheCosmosConstellation : ModProjectile { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public Player Owner => Main.player[projectile.owner]; - public float Timer => projectile.ai[0] - projectile.timeLeft; + public Player Owner => Main.player[Projectile.owner]; + public float Timer => Projectile.ai[0] - Projectile.timeLeft; const float ConstellationSwapTime = 15; public List Particles; @@ -25,25 +25,25 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Constellation"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 1; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 1; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 8; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = (int)ConstellationSwapTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 8; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = (int)ConstellationSwapTime; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + SizeVector, 30f, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + SizeVector, 30f, ref collisionPoint); } public void BootlegSpawnParticle(Particle particle) @@ -60,18 +60,18 @@ namespace CalamityMod.Projectiles.Melee if (Particles == null) Particles = new List(); - projectile.Center = Owner.Center; + Projectile.Center = Owner.Center; - if (!Owner.channel && projectile.timeLeft > 20) - projectile.timeLeft = 20; + if (!Owner.channel && Projectile.timeLeft > 20) + Projectile.timeLeft = 20; if (!Owner.active) { - projectile.Kill(); + Projectile.Kill(); return; } - if (Timer % ConstellationSwapTime == 0 && projectile.timeLeft >= 20) + if (Timer % ConstellationSwapTime == 0 && Projectile.timeLeft >= 20) { Particles.Clear(); @@ -123,8 +123,8 @@ namespace CalamityMod.Projectiles.Melee //Run the particles manually to be sure it doesnt get fucked over by the particle cap Vector2 moveDirection = Vector2.Zero; - if (Timer > projectile.oldPos.Length) - moveDirection = projectile.position - projectile.oldPos[0]; + if (Timer > Projectile.oldPos.Length) + moveDirection = Projectile.position - Projectile.oldPos[0]; foreach (Particle particle in Particles) { diff --git a/Projectiles/Melee/AstralScytheProjectile.cs b/Projectiles/Melee/AstralScytheProjectile.cs index 78227de78c..2d6fbcacd3 100644 --- a/Projectiles/Melee/AstralScytheProjectile.cs +++ b/Projectiles/Melee/AstralScytheProjectile.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class AstralScytheProjectile : ModProjectile @@ -16,23 +17,23 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Ring"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 72; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.timeLeft = 300; - projectile.penetrate = 8; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 7; - projectile.tileCollide = false; + Projectile.width = 72; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 300; + Projectile.penetrate = 8; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 7; + Projectile.tileCollide = false; } public override void AI() @@ -40,18 +41,18 @@ namespace CalamityMod.Projectiles.Melee if (tileCounter > 0) tileCounter--; if (tileCounter <= 0) - projectile.tileCollide = true; + Projectile.tileCollide = true; - projectile.velocity *= 1.03f; + Projectile.velocity *= 1.03f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; - if (projectile.frame > 2) + Projectile.frame++; + Projectile.frameCounter = 0; + if (Projectile.frame > 2) { - projectile.frame = 0; + Projectile.frame = 0; } } } @@ -63,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item1, projectile.Center); + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); for (int i = 0; i < 60; i++) { @@ -71,8 +72,8 @@ namespace CalamityMod.Projectiles.Melee Vector2 angleVec = angle.ToRotationVector2(); float distance = Main.rand.NextFloat(14f, 36f); Vector2 off = angleVec * distance; - off.Y *= (float)projectile.height / projectile.width; - Vector2 pos = projectile.Center + off; + off.Y *= (float)Projectile.height / Projectile.width; + Vector2 pos = Projectile.Center + off; Dust d = Dust.NewDustPerfect(pos, ModContent.DustType(), angleVec * Main.rand.NextFloat(2f, 4f)); d.customData = true; } @@ -80,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/AtaraxiaHoming.cs b/Projectiles/Melee/AtaraxiaHoming.cs index 6f2e786540..35b0f60f49 100644 --- a/Projectiles/Melee/AtaraxiaHoming.cs +++ b/Projectiles/Melee/AtaraxiaHoming.cs @@ -19,46 +19,46 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Definitely Not Exoblade"); - Main.projFrames[projectile.type] = NumAnimationFrames; + Main.projFrames[Projectile.type] = NumAnimationFrames; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = Lifespan; - projectile.ignoreWater = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = Lifespan; + Projectile.ignoreWater = true; } private bool HomingAI() { // Save current speed to AI variables - float speed = projectile.velocity.Length(); - if (projectile.ai[0] == 0f) - projectile.ai[0] = speed; + float speed = Projectile.velocity.Length(); + if (Projectile.ai[0] == 0f) + Projectile.ai[0] = speed; // Variables for choosing an NPC to home in on - float posX = projectile.position.X; - float posY = projectile.position.Y; + float posX = Projectile.position.X; + float posY = Projectile.position.Y; float homingRange = HomingStartRange; bool foundTarget = false; int targetIndex = 0; // ai[1] stores the index of the current target plus one. 0 is none. - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { // Find the closest target. The range decreases each time you find a closer target. for (int i = 0; i < Main.maxNPCs; ++i) { - if (Main.npc[i].CanBeChasedBy(projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { // Chlorophyte Bullets actually home in a diamond instead of a circle because they don't perform a square root here. - float d = Math.Abs(projectile.Center.X - Main.npc[i].Center.X) + Math.Abs(projectile.Center.Y - Main.npc[i].Center.Y); - if (d < homingRange && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) + float d = Math.Abs(Projectile.Center.X - Main.npc[i].Center.X) + Math.Abs(Projectile.Center.Y - Main.npc[i].Center.Y); + if (d < homingRange && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) { homingRange = d; posX = Main.npc[i].Center.X; @@ -71,23 +71,23 @@ namespace CalamityMod.Projectiles.Melee // If at least one valid target was found, set ai[1] to store its index plus one. if (foundTarget) - projectile.ai[1] = (float)(targetIndex + 1); + Projectile.ai[1] = (float)(targetIndex + 1); } // This is always the case after that loop for some reason. foundTarget = false; // Ensure the current target is still valid - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - targetIndex = (int)(projectile.ai[1] - 1f); + targetIndex = (int)(Projectile.ai[1] - 1f); // Chlorophyte Bullets will continue homing in unless their target is invincible. - if (Main.npc[targetIndex].active && Main.npc[targetIndex].CanBeChasedBy(projectile, false)) + if (Main.npc[targetIndex].active && Main.npc[targetIndex].CanBeChasedBy(Projectile, false)) { float targetX = Main.npc[targetIndex].Center.X; float targetY = Main.npc[targetIndex].Center.Y; - float d = Math.Abs(projectile.Center.X - targetX) + Math.Abs(projectile.Center.Y - targetY); + float d = Math.Abs(Projectile.Center.X - targetX) + Math.Abs(Projectile.Center.Y - targetY); if (d < HomingBreakRange) { foundTarget = true; @@ -96,14 +96,14 @@ namespace CalamityMod.Projectiles.Melee } } else - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; } // Non-friendly Chlorophyte Bullets will never actually home in, despite maintaining a target. - if (foundTarget && projectile.friendly) + if (foundTarget && Projectile.friendly) { - float dx = posX - projectile.Center.X; - float dy = posY - projectile.Center.Y; + float dx = posX - Projectile.Center.X; + float dy = posY - Projectile.Center.Y; float distance = (float)Math.Sqrt(dx * dx + dy * dy); float homingFactor = speed / distance; dx *= homingFactor; @@ -111,15 +111,15 @@ namespace CalamityMod.Projectiles.Melee // The projectile loses 1/5th of its current velocity and replaces it with homing power. float homingStrength = 5f; - projectile.velocity.X = (projectile.velocity.X * (homingStrength - 1f) + dx) / homingStrength; - projectile.velocity.Y = (projectile.velocity.Y * (homingStrength - 1f) + dy) / homingStrength; + Projectile.velocity.X = (Projectile.velocity.X * (homingStrength - 1f) + dx) / homingStrength; + Projectile.velocity.Y = (Projectile.velocity.Y * (homingStrength - 1f) + dy) / homingStrength; // And then approaches the homing velocity by an increment of 0.3. - projectile.velocity = projectile.velocity.MoveTowards(new Vector2(dx, dy), 0.3f); + Projectile.velocity = Projectile.velocity.MoveTowards(new Vector2(dx, dy), 0.3f); // Re-scale resulting velocity to the projectile's set maximum speed - projectile.velocity.Normalize(); - projectile.velocity *= speed; + Projectile.velocity.Normalize(); + Projectile.velocity *= speed; return true; } return false; @@ -130,38 +130,38 @@ namespace CalamityMod.Projectiles.Melee drawOffsetX = -28; drawOriginOffsetY = -2; drawOriginOffsetX = 12; - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); // Run homing code bool homing = HomingAI(); // Light - Lighting.AddLight(projectile.Center, 0.3f, 0.1f, 0.45f); + Lighting.AddLight(Projectile.Center, 0.3f, 0.1f, 0.45f); // Spawn dust with a 3/4 chance if currently homing in if (homing && Main.rand.Next(4) != 3) { - int idx = Dust.NewDust(projectile.Center, 1, 1, 70); - Main.dust[idx].position = projectile.Center; + int idx = Dust.NewDust(Projectile.Center, 1, 1, 70); + Main.dust[idx].position = Projectile.Center; Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 0.25f; } // Update animation - projectile.frameCounter++; - if (projectile.frameCounter > AnimationFrameTime) + Projectile.frameCounter++; + if (Projectile.frameCounter > AnimationFrameTime) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= NumAnimationFrames) - projectile.frame = 0; + if (Projectile.frame >= NumAnimationFrames) + Projectile.frame = 0; } // Cannot deal damage for the first several frames of existence. public override bool CanDamage() { - return projectile.timeLeft < Lifespan - IntangibleFrames; + return Projectile.timeLeft < Lifespan - IntangibleFrames; } } } diff --git a/Projectiles/Melee/AtaraxiaMain.cs b/Projectiles/Melee/AtaraxiaMain.cs index 76b751c096..dfa5a4c34b 100644 --- a/Projectiles/Melee/AtaraxiaMain.cs +++ b/Projectiles/Melee/AtaraxiaMain.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -13,19 +14,19 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Not Exoblade"); - Main.projFrames[projectile.type] = NumAnimationFrames; + Main.projFrames[Projectile.type] = NumAnimationFrames; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 180; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 180; } public override void AI() @@ -33,29 +34,29 @@ namespace CalamityMod.Projectiles.Melee drawOffsetX = -40; drawOriginOffsetY = -3; drawOriginOffsetX = 18; - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); // Light - Lighting.AddLight(projectile.Center, 0.45f, 0.1f, 0.1f); + Lighting.AddLight(Projectile.Center, 0.45f, 0.1f, 0.1f); // Spawn dust with a 1/2 chance if (Main.rand.NextBool()) { - int idx = Dust.NewDust(projectile.Center, 1, 1, 90); - Main.dust[idx].position = projectile.Center; + int idx = Dust.NewDust(Projectile.Center, 1, 1, 90); + Main.dust[idx].position = Projectile.Center; Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 0.6f; } // Update animation - projectile.frameCounter++; - if (projectile.frameCounter > AnimationFrameTime) + Projectile.frameCounter++; + if (Projectile.frameCounter > AnimationFrameTime) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= NumAnimationFrames) - projectile.frame = 0; + if (Projectile.frame >= NumAnimationFrames) + Projectile.frame = 0; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -66,36 +67,36 @@ namespace CalamityMod.Projectiles.Melee // Explodes like Exoblade's Exobeams public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCDeath55, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCDeath55, Projectile.Center); // Transform the projectile's hitbox into a big explosion - projectile.position = projectile.Center; - projectile.width = projectile.height = 140; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 140; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Vector2 corner = new Vector2(projectile.position.X, projectile.position.Y); + Vector2 corner = new Vector2(Projectile.position.X, Projectile.position.Y); for (int i = 0; i < 50; i++) { - int idx = Dust.NewDust(corner, projectile.width, projectile.height, 86, 0f, 0f, 0, new Color(210, 0, 255), 2.2f); + int idx = Dust.NewDust(corner, Projectile.width, Projectile.height, 86, 0f, 0f, 0, new Color(210, 0, 255), 2.2f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 2.5f; - idx = Dust.NewDust(corner, projectile.width, projectile.height, 118, 0f, 0f, 100, new Color(210, 0, 255), 1.8f); + idx = Dust.NewDust(corner, Projectile.width, Projectile.height, 118, 0f, 0f, 100, new Color(210, 0, 255), 1.8f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 1.8f; - idx = Dust.NewDust(corner, projectile.width, projectile.height, 71, 0f, 0f, 100, new Color(210, 0, 255), 1.0f); + idx = Dust.NewDust(corner, Projectile.width, Projectile.height, 71, 0f, 0f, 100, new Color(210, 0, 255), 1.0f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 4.0f; } // Make the projectile ignore iframes while exploding - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); } } } diff --git a/Projectiles/Melee/AtaraxiaSide.cs b/Projectiles/Melee/AtaraxiaSide.cs index bffd94d519..872b22d903 100644 --- a/Projectiles/Melee/AtaraxiaSide.cs +++ b/Projectiles/Melee/AtaraxiaSide.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -13,19 +14,19 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Also Not Exoblade"); - Main.projFrames[projectile.type] = NumAnimationFrames; + Main.projFrames[Projectile.type] = NumAnimationFrames; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 180; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 180; } public override void AI() @@ -33,29 +34,29 @@ namespace CalamityMod.Projectiles.Melee drawOffsetX = -28; drawOriginOffsetY = -2; drawOriginOffsetX = 12; - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); // Light - Lighting.AddLight(projectile.Center, 0.3f, 0.1f, 0.45f); + Lighting.AddLight(Projectile.Center, 0.3f, 0.1f, 0.45f); // Spawn dust with a 3/4 chance if (Main.rand.Next(4) != 3) { - int idx = Dust.NewDust(projectile.Center, 1, 1, 70); - Main.dust[idx].position = projectile.Center; + int idx = Dust.NewDust(Projectile.Center, 1, 1, 70); + Main.dust[idx].position = Projectile.Center; Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 0.25f; } // Update animation - projectile.frameCounter++; - if (projectile.frameCounter > AnimationFrameTime) + Projectile.frameCounter++; + if (Projectile.frameCounter > AnimationFrameTime) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= NumAnimationFrames) - projectile.frame = 0; + if (Projectile.frame >= NumAnimationFrames) + Projectile.frame = 0; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -66,20 +67,20 @@ namespace CalamityMod.Projectiles.Melee // Spawns 6 smaller projectiles that slowly glide outward and ignore iframes public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item89, projectile.Center); + SoundEngine.PlaySound(SoundID.Item89, Projectile.Center); // Individual split projectiles deal 5% damage per hit. int numSplits = 6; int splitID = ModContent.ProjectileType(); - int damage = (int)(projectile.damage * 0.05f); + int damage = (int)(Projectile.damage * 0.05f); float angleVariance = MathHelper.TwoPi / numSplits; Vector2 projVec = new Vector2(4.5f, 0f).RotatedByRandom(MathHelper.TwoPi); for (int i = 0; i < numSplits; ++i) { projVec = projVec.RotatedBy(angleVariance); - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, projVec, splitID, damage, 1.5f, Main.myPlayer); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center, projVec, splitID, damage, 1.5f, Main.myPlayer); } } } diff --git a/Projectiles/Melee/AtaraxiaSplit.cs b/Projectiles/Melee/AtaraxiaSplit.cs index 986f9091f0..1d174a5e5b 100644 --- a/Projectiles/Melee/AtaraxiaSplit.cs +++ b/Projectiles/Melee/AtaraxiaSplit.cs @@ -11,17 +11,17 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 6; - projectile.timeLeft = 25; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.alpha = 0; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 6; + Projectile.timeLeft = 25; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 0; } public override void AI() @@ -29,24 +29,24 @@ namespace CalamityMod.Projectiles.Melee drawOffsetX = -5; drawOriginOffsetY = -1; drawOriginOffsetX = 0; - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); // Slow down exponentially and fade away - projectile.velocity *= 0.93f; - projectile.alpha += 5; + Projectile.velocity *= 0.93f; + Projectile.alpha += 5; // Light which scales down as it fades - float lightFactor = (255f - (float)projectile.alpha) / 255f; - Lighting.AddLight(projectile.Center, 0.3f * lightFactor, 0.05f * lightFactor, 0.2f * lightFactor); + float lightFactor = (255f - (float)Projectile.alpha) / 255f; + Lighting.AddLight(Projectile.Center, 0.3f * lightFactor, 0.05f * lightFactor, 0.2f * lightFactor); // Spawn dust, with less dust as it fades away - if (Main.rand.Next(256) > projectile.alpha - 60) + if (Main.rand.Next(256) > Projectile.alpha - 60) { - int idx = Dust.NewDust(projectile.Center, 1, 1, 71); - Main.dust[idx].position = projectile.Center - projectile.velocity * 0.7f; + int idx = Dust.NewDust(Projectile.Center, 1, 1, 71); + Main.dust[idx].position = Projectile.Center - Projectile.velocity * 0.7f; Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 0.3f; - Main.dust[idx].velocity += projectile.velocity * 0.4f; + Main.dust[idx].velocity += Projectile.velocity * 0.4f; Main.dust[idx].scale = Main.rand.NextFloat(0.5f, 1.0f); Main.dust[idx].alpha = Main.rand.Next(80, 200); } diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index e4a1e06d6d..43ead0c0fc 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -12,54 +13,54 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Pumpkin Skull"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 300; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void AI() { - if (projectile.ai[0] < 0f) + if (Projectile.ai[0] < 0f) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 50; + Projectile.alpha -= 50; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.ai[0] >= 0f && projectile.ai[0] < 200f) + if (Projectile.ai[0] >= 0f && Projectile.ai[0] < 200f) { - int num554 = (int)projectile.ai[0]; + int num554 = (int)Projectile.ai[0]; if (Main.npc[num554].active) { float num555 = 8f; - Vector2 vector44 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector44 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num556 = Main.npc[num554].position.X - vector44.X; float num557 = Main.npc[num554].position.Y - vector44.Y; float num558 = (float)Math.Sqrt((double)(num556 * num556 + num557 * num557)); num558 = num555 / num558; num556 *= num558; num557 *= num558; - projectile.velocity.X = (projectile.velocity.X * 14f + num556) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num557) / 15f; + Projectile.velocity.X = (Projectile.velocity.X * 14f + num556) / 15f; + Projectile.velocity.Y = (Projectile.velocity.Y * 14f + num557) / 15f; } else { @@ -67,36 +68,36 @@ namespace CalamityMod.Projectiles.Melee int num3; for (int num560 = 0; num560 < 200; num560 = num3 + 1) { - if (Main.npc[num560].CanBeChasedBy(projectile, false)) + if (Main.npc[num560].CanBeChasedBy(Projectile, false)) { float num561 = Main.npc[num560].position.X + (float)(Main.npc[num560].width / 2); float num562 = Main.npc[num560].position.Y + (float)(Main.npc[num560].height / 2); - float num563 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num561) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num562); - if (num563 < num559 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num560].position, Main.npc[num560].width, Main.npc[num560].height)) + float num563 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num561) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num562); + if (num563 < num559 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num560].position, Main.npc[num560].width, Main.npc[num560].height)) { num559 = num563; - projectile.ai[0] = (float)num560; + Projectile.ai[0] = (float)num560; } } num3 = num560; } } - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } for (int num157 = 0; num157 < 2; num157++) { - int num158 = Dust.NewDust(new Vector2(projectile.position.X + 4f, projectile.position.Y + 4f), projectile.width - 8, projectile.height - 8, Main.rand.NextBool(2) ? 5 : 6, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 2f); - Main.dust[num158].position -= projectile.velocity * 2f; + int num158 = Dust.NewDust(new Vector2(Projectile.position.X + 4f, Projectile.position.Y + 4f), Projectile.width - 8, Projectile.height - 8, Main.rand.NextBool(2) ? 5 : 6, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 2f); + Main.dust[num158].position -= Projectile.velocity * 2f; Main.dust[num158].noGravity = true; Dust expr_7A4A_cp_0_cp_0 = Main.dust[num158]; expr_7A4A_cp_0_cp_0.velocity.X *= 0.3f; @@ -107,7 +108,7 @@ namespace CalamityMod.Projectiles.Melee return; } - projectile.Kill(); + Projectile.Kill(); } public override Color? GetAlpha(Color lightColor) @@ -117,16 +118,16 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 27); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 27); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -136,10 +137,10 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -147,13 +148,13 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.OnFire, 240); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int k = 0; k < 2; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)(projectile.damage * 0.35), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), + (int)(Projectile.damage * 0.35), Projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Melee/BallOFuguProj.cs b/Projectiles/Melee/BallOFuguProj.cs index 793a368f2b..b6f8c55aec 100644 --- a/Projectiles/Melee/BallOFuguProj.cs +++ b/Projectiles/Melee/BallOFuguProj.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,23 +17,23 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.alpha = 255; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 255; } public override void AI() { - Player player = Main.player[projectile.owner]; - Vector2 projVector = player.Center - projectile.Center; - projectile.rotation = projVector.ToRotation() - 1.57f; + Player player = Main.player[Projectile.owner]; + Vector2 projVector = player.Center - Projectile.Center; + Projectile.rotation = projVector.ToRotation() - 1.57f; if (player.dead) { - projectile.Kill(); + Projectile.Kill(); return; } player.itemAnimation = 10; @@ -40,74 +41,74 @@ namespace CalamityMod.Projectiles.Melee if (projVector.X < 0f) { player.ChangeDir(1); - projectile.direction = 1; + Projectile.direction = 1; } else { player.ChangeDir(-1); - projectile.direction = -1; + Projectile.direction = -1; } - player.itemRotation = (projVector * -1f * (float)projectile.direction).ToRotation(); - projectile.spriteDirection = (projVector.X > 0f) ? -1 : 1; - if (projectile.ai[0] == 0f && projVector.Length() > 400f) + player.itemRotation = (projVector * -1f * (float)Projectile.direction).ToRotation(); + Projectile.spriteDirection = (projVector.X > 0f) ? -1 : 1; + if (Projectile.ai[0] == 0f && projVector.Length() > 400f) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } - if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) + if (Projectile.ai[0] == 1f || Projectile.ai[0] == 2f) { float playerDist = projVector.Length(); if (playerDist > 1500f) { - projectile.Kill(); + Projectile.Kill(); return; } if (playerDist > 600f) { - projectile.ai[0] = 2f; + Projectile.ai[0] = 2f; } - projectile.tileCollide = false; + Projectile.tileCollide = false; float num694 = 20f; - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { num694 = 40f; } - projectile.velocity = Vector2.Normalize(projVector) * num694; + Projectile.velocity = Vector2.Normalize(projVector) * num694; if (projVector.Length() < num694) { - projectile.Kill(); + Projectile.Kill(); return; } } - projectile.ai[1] += 1f; - if (projectile.ai[1] > 5f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 5f) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.ai[1] % 6f == 0f && projectile.owner == Main.myPlayer) + if (Projectile.ai[1] % 6f == 0f && Projectile.owner == Main.myPlayer) { Vector2 vector63 = projVector * -1f; vector63.Normalize(); vector63 *= (float)Main.rand.Next(45, 65) * 0.1f; vector63 = vector63.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.6), projectile.knockBack * 0.2f, projectile.owner, -10f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - projectile.ai[0] = 1f; - projectile.netUpdate = true; - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = ModContent.GetTexture("CalamityMod/ExtraTextures/Chains/BallOFuguChain"); - Vector2 vector17 = projectile.Center; + Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/BallOFuguChain"); + Vector2 vector17 = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); float num91 = (float)texture2D2.Height; @@ -144,8 +145,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 180); - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Melee/BansheeHookBoom.cs b/Projectiles/Melee/BansheeHookBoom.cs index 7cdd4761db..22375c43c1 100644 --- a/Projectiles/Melee/BansheeHookBoom.cs +++ b/Projectiles/Melee/BansheeHookBoom.cs @@ -14,64 +14,64 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.melee = true; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.timeLeft = 6; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.timeLeft = 6; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { - projectile.ai[1] += 0.01f; - projectile.scale = projectile.ai[1]; - projectile.ai[0] += 1f; - projectile.alpha -= 63; - if (projectile.alpha < 0) + Projectile.ai[1] += 0.01f; + Projectile.scale = Projectile.ai[1]; + Projectile.ai[0] += 1f; + Projectile.alpha -= 63; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - Lighting.AddLight(projectile.Center, 1.5f, 0f, 0.15f); - if (projectile.ai[0] == 1f) + Lighting.AddLight(Projectile.Center, 1.5f, 0f, 0.15f); + if (Projectile.ai[0] == 1f) { - projectile.position = projectile.Center; - projectile.width = projectile.height = (int)(52f * projectile.scale); - projectile.Center = projectile.position; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = (int)(52f * Projectile.scale); + Projectile.Center = Projectile.position; + Projectile.Damage(); for (int num1000 = 0; num1000 < 2; num1000++) { - int num1001 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num1001].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num1001 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[num1001].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; } for (int num1002 = 0; num1002 < 5; num1002++) { - int num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 200, default, 2.7f); - Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num1003 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 200, default, 2.7f); + Main.dust[num1003].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[num1003].noGravity = true; Main.dust[num1003].velocity *= 3f; - num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num1003 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Main.dust[num1003].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[num1003].velocity *= 2f; Main.dust[num1003].noGravity = true; Main.dust[num1003].fadeIn = 2.5f; } for (int num1004 = 0; num1004 < 2; num1004++) { - int num1005 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.7f); - Main.dust[num1005].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + int num1005 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.7f); + Main.dust[num1005].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; Main.dust[num1005].noGravity = true; Main.dust[num1005].velocity *= 3f; } for (int num1006 = 0; num1006 < 5; num1006++) { - int num1007 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 0, default, 1.5f); - Main.dust[num1007].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + int num1007 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 0, default, 1.5f); + Main.dust[num1007].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; Main.dust[num1007].noGravity = true; Main.dust[num1007].velocity *= 3f; } diff --git a/Projectiles/Melee/BansheeHookScythe.cs b/Projectiles/Melee/BansheeHookScythe.cs index 70618dc5ed..6bbec2e0b5 100644 --- a/Projectiles/Melee/BansheeHookScythe.cs +++ b/Projectiles/Melee/BansheeHookScythe.cs @@ -13,34 +13,34 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 38; - projectile.height = 38; + Projectile.width = 38; + Projectile.height = 38; - projectile.aiStyle = 18; + Projectile.aiStyle = 18; aiType = ProjectileID.DeathSickle; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 90; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.penetrate = -1; + Projectile.timeLeft = 90; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.6f / 255f, 0f, 0f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.6f / 255f, 0f, 0f); } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } diff --git a/Projectiles/Melee/BiomeBladeHoldout.cs b/Projectiles/Melee/BiomeBladeHoldout.cs index 5bf259a761..74e782d8e8 100644 --- a/Projectiles/Melee/BiomeBladeHoldout.cs +++ b/Projectiles/Melee/BiomeBladeHoldout.cs @@ -9,17 +9,18 @@ using Terraria.ModLoader; using CalamityMod.Items.Weapons.Melee; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class BiomeBladeHoldout : ModProjectile //Visuals { - private Player Owner => Main.player[projectile.owner]; + private Player Owner => Main.player[Projectile.owner]; public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.modItem as TrueBiomeBlade).CanUseItem(Owner) : false; public bool OwnerMayChannel => Owner.itemAnimation == 0 && OwnerCanUseItem && Owner.Calamity().mouseRight && Owner.active && !Owner.dead && Owner.StandingStill() && !Owner.mount.Active && Owner.CheckSolidGround(1, 3); - public ref float ChanneledState => ref projectile.ai[0]; - public ref float ChannelTimer => ref projectile.ai[1]; - public ref float Initialized => ref projectile.localAI[0]; + public ref float ChanneledState => ref Projectile.ai[0]; + public ref float ChannelTimer => ref Projectile.ai[1]; + public ref float Initialized => ref Projectile.localAI[0]; private Item associatedItem; const int ChannelTime = 120; @@ -32,13 +33,13 @@ namespace CalamityMod.Projectiles.Melee public bool drawIndrawHeldProjInFrontOfHeldItemAndArms = true; public override void SetDefaults() { - projectile.width = projectile.height = 36; - projectile.aiStyle = -1; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.tileCollide = false; - projectile.damage = 0; + Projectile.width = Projectile.height = 36; + Projectile.aiStyle = -1; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.tileCollide = false; + Projectile.damage = 0; } public CurveSegment anticipation = new CurveSegment(EasingType.SineOut, 0f, 1f, 0.35f); @@ -54,12 +55,12 @@ namespace CalamityMod.Projectiles.Melee //If dropped, kill it instantly if (Owner.HeldItem.type != ItemType()) { - projectile.Kill(); + Projectile.Kill(); return; } if (Owner.whoAmI == Main.myPlayer) - Main.PlaySound(SoundID.DD2_DarkMageHealImpact); + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact); associatedItem = Owner.HeldItem; //Switch up the attunements @@ -71,25 +72,25 @@ namespace CalamityMod.Projectiles.Melee if (!OwnerMayChannel && ChanneledState == 0f) //IF the channeling gets interrupted for any reason { - projectile.Center = Owner.Top + new Vector2(18f, 0f); + Projectile.Center = Owner.Top + new Vector2(18f, 0f); ChanneledState = 1f; - projectile.timeLeft = 60; + Projectile.timeLeft = 60; return; } if (ChanneledState == 0f) { - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; - projectile.Center = Owner.Center + new Vector2(16f * Owner.direction + Owner.direction < 0 ? -26f : 16f, -30 * SwordHeight() + 10f); - projectile.rotation = MathHelper.PiOver4 + MathHelper.PiOver2; // No more silly turnaround with the repaired one? + Projectile.Center = Owner.Center + new Vector2(16f * Owner.direction + Owner.direction < 0 ? -26f : 16f, -30 * SwordHeight() + 10f); + Projectile.rotation = MathHelper.PiOver4 + MathHelper.PiOver2; // No more silly turnaround with the repaired one? ChannelTimer++; - projectile.timeLeft = 60; + Projectile.timeLeft = 60; if (ChannelTimer >= ChannelTime) { Attune((TrueBiomeBlade)associatedItem.modItem); - projectile.timeLeft = 120; + Projectile.timeLeft = 120; ChanneledState = 2f; //State where it stays invisible doing nothing. Acts as a cooldown Color particleColor = (associatedItem.modItem as TrueBiomeBlade).mainAttunement.tooltipColor; @@ -110,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee } if (ChanneledState == 1f) - projectile.position += Vector2.UnitY * -0.3f * (1f + projectile.timeLeft / 60f); + Projectile.position += Vector2.UnitY * -0.3f * (1f + Projectile.timeLeft / 60f); } public void Attune(TrueBiomeBlade item) @@ -145,13 +146,13 @@ namespace CalamityMod.Projectiles.Melee //If the owner already had the attunement , break out of it (And unswap) if (item.secondaryAttunement == attunement) { - Main.PlaySound(SoundID.DD2_LightningBugZap, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_LightningBugZap, Projectile.Center); item.secondaryAttunement = item.mainAttunement; item.mainAttunement = attunement; return; } - Main.PlaySound(SoundID.DD2_MonkStaffGroundImpact, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Projectile.Center); item.mainAttunement = attunement; } @@ -177,9 +178,9 @@ namespace CalamityMod.Projectiles.Melee else if (ChanneledState == 1f) { Texture2D tex = GetTexture(Texture); - Vector2 squishyScale = new Vector2(Math.Abs((float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * projectile.timeLeft / 30f)), 1f); - SpriteEffects flip = (float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * projectile.timeLeft / 30f) > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(tex, projectile.position - Main.screenPosition, null, lightColor * (projectile.timeLeft / 60f), 0, tex.Size() / 2, squishyScale * (2f - (projectile.timeLeft / 60f)), flip, 0); + Vector2 squishyScale = new Vector2(Math.Abs((float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f)), 1f); + SpriteEffects flip = (float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f) > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(tex, Projectile.position - Main.screenPosition, null, lightColor * (Projectile.timeLeft / 60f), 0, tex.Size() / 2, squishyScale * (2f - (Projectile.timeLeft / 60f)), flip, 0); return false; } diff --git a/Projectiles/Melee/BladecrestOathswordProj.cs b/Projectiles/Melee/BladecrestOathswordProj.cs index 411b44627c..02d4b85637 100644 --- a/Projectiles/Melee/BladecrestOathswordProj.cs +++ b/Projectiles/Melee/BladecrestOathswordProj.cs @@ -21,10 +21,10 @@ namespace CalamityMod.Projectiles.Melee public int Direction = 1; public SwingState CurrentState; - public ref float SwingDirection => ref projectile.ai[0]; - public ref float BladeHorizontalFactor => ref projectile.ai[1]; - public ref float PostSwingRepositionDelay => ref projectile.localAI[0]; - public ref float ChargePower => ref projectile.localAI[1]; + public ref float SwingDirection => ref Projectile.ai[0]; + public ref float BladeHorizontalFactor => ref Projectile.ai[1]; + public ref float PostSwingRepositionDelay => ref Projectile.localAI[0]; + public ref float ChargePower => ref Projectile.localAI[1]; public override string Texture => "CalamityMod/Items/Weapons/Melee/BladecrestOathsword"; public override int AssociatedItemID => ModContent.ItemType(); @@ -34,22 +34,22 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Bladecrest Oathsword"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = projectile.height = 56; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 90000; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 12; - projectile.noEnchantments = true; - projectile.Calamity().trueMelee = true; + Projectile.width = Projectile.height = 56; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 90000; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; + Projectile.noEnchantments = true; + Projectile.Calamity().trueMelee = true; } public override void SendExtraAI(BinaryWriter writer) @@ -78,8 +78,8 @@ namespace CalamityMod.Projectiles.Melee Direction = Owner.direction; // Glue the sword to its owner. - projectile.Opacity = 1f; - projectile.position = Owner.RotatedRelativePoint(Owner.MountedCenter, true) - projectile.Size / 2f + Vector2.UnitY * Owner.gfxOffY; + Projectile.Opacity = 1f; + Projectile.position = Owner.RotatedRelativePoint(Owner.MountedCenter, true) - Projectile.Size / 2f + Vector2.UnitY * Owner.gfxOffY; float swingSpeedInterpolant = 0.27f; float swingCompletion = 1f - Owner.itemAnimation / (float)Owner.itemAnimationMax; @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Melee // Fuck this shit. // The code is kept around if we want the holdout effect but I'm honestly not going to continue Criticism Whack-a-Mole with this frankly arbitrary visual. else - projectile.Opacity = 0f; + Projectile.Opacity = 0f; // Determine the horizontal stretch offset of the blade. This is used in matrix math below to create 2.5D visuals. BladeHorizontalFactor = MathHelper.Lerp(1f, 1.5f, (aimDirection3D.X * 0.5f + 0.5f) * Utils.InverseLerp(1f, 0.8f, unchangedSwingCompletion, true)); @@ -119,41 +119,41 @@ namespace CalamityMod.Projectiles.Melee float idealRotation = baseRotation; Owner.itemRotation = 0f; - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; idealRotation += MathHelper.PiOver4; if (Direction == -1) idealRotation += MathHelper.Pi; // Define rotation. - projectile.rotation = projectile.rotation.AngleTowards(idealRotation, swingSpeedInterpolant * 0.45f).AngleLerp(idealRotation, swingSpeedInterpolant * 0.2f); + Projectile.rotation = Projectile.rotation.AngleTowards(idealRotation, swingSpeedInterpolant * 0.45f).AngleLerp(idealRotation, swingSpeedInterpolant * 0.2f); // Offset the blade so that the handle is attached to the owner's hand. float horizontalBladeOffset = MathHelper.Lerp(-4f, 10f, Utils.InverseLerp(1f, 0.72f, unchangedSwingCompletion, true) * Utils.InverseLerp(0f, 0.28f, unchangedSwingCompletion, true)); - Vector2 bladeOffset = (projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * projectile.width * 0.5f; + Vector2 bladeOffset = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Projectile.width * 0.5f; bladeOffset += new Vector2(Direction * horizontalBladeOffset, 2f).RotatedBy(Owner.fullRotation) + Vector2.UnitY * Owner.gfxOffY; - projectile.position += bladeOffset; + Projectile.position += bladeOffset; // Create demon magic dust along the blade when swinging, as well as demon blood scythes. if (PostSwingRepositionDelay >= 10f && CurrentState == SwingState.Swinging) { for (int i = 0; i < 2; i++) { - Dust shadowflame = Dust.NewDustPerfect(projectile.Center + (projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * projectile.width * Main.rand.NextFloat(0.4f), 27); - shadowflame.velocity = (projectile.oldRot[0] - projectile.oldRot[1]).ToRotationVector2() * Main.rand.NextFloat(4f, 10f); - shadowflame.velocity += (projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * 7.5f; + Dust shadowflame = Dust.NewDustPerfect(Projectile.Center + (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Projectile.width * Main.rand.NextFloat(0.4f), 27); + shadowflame.velocity = (Projectile.oldRot[0] - Projectile.oldRot[1]).ToRotationVector2() * Main.rand.NextFloat(4f, 10f); + shadowflame.velocity += (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * 7.5f; shadowflame.scale = Main.rand.NextFloat(1f, 1.5f); shadowflame.fadeIn = 0.5f; shadowflame.noGravity = true; } - if (Main.myPlayer == projectile.owner && Owner.itemAnimation % 4 == 3 && Owner.itemAnimation < Owner.itemAnimationMax - 3) + if (Main.myPlayer == Projectile.owner && Owner.itemAnimation % 4 == 3 && Owner.itemAnimation < Owner.itemAnimationMax - 3) { - Vector2 bloodScytheShootVelocity = (projectile.rotation - MathHelper.PiOver4).ToRotationVector2(); + Vector2 bloodScytheShootVelocity = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2(); bloodScytheShootVelocity.Y *= 0.04f; bloodScytheShootVelocity = bloodScytheShootVelocity.SafeNormalize(Vector2.UnitY) * 50f; - Vector2 bloodScytheSpawnPosition = projectile.Center + bloodScytheShootVelocity.SafeNormalize(Vector2.UnitY) * 50f; - Projectile.NewProjectile(bloodScytheSpawnPosition, bloodScytheShootVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack * 0.4f, projectile.owner); + Vector2 bloodScytheSpawnPosition = Projectile.Center + bloodScytheShootVelocity.SafeNormalize(Vector2.UnitY) * 50f; + Projectile.NewProjectile(bloodScytheSpawnPosition, bloodScytheShootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.4f, Projectile.owner); } } } @@ -175,7 +175,7 @@ namespace CalamityMod.Projectiles.Melee else if (Owner.itemAnimation <= 0) { Owner.itemAnimation = 0; - projectile.oldPos = new Vector2[projectile.oldPos.Length]; + Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; CurrentState = SwingState.Default; } @@ -199,7 +199,7 @@ namespace CalamityMod.Projectiles.Melee }); GameShaders.Misc["CalamityMod:LinearTransformation"].Apply(); - CalamityUtils.DrawAfterimagesCentered(projectile, 2, lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, 2, lightColor); spriteBatch.ExitShaderRegion(); return false; diff --git a/Projectiles/Melee/BlazingPhantomBlade.cs b/Projectiles/Melee/BlazingPhantomBlade.cs index 97e19f7b67..79dd49f15c 100644 --- a/Projectiles/Melee/BlazingPhantomBlade.cs +++ b/Projectiles/Melee/BlazingPhantomBlade.cs @@ -11,37 +11,37 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Blazing Phantom Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 18; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 5; - projectile.timeLeft = 180; - projectile.ignoreWater = true; + Projectile.width = 50; + Projectile.height = 50; + Projectile.aiStyle = 18; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 5; + Projectile.timeLeft = 180; + Projectile.ignoreWater = true; aiType = ProjectileID.DeathSickle; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.6f, 0f, 0f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 250f, 8f, 20f); } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -50,13 +50,13 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; target.AddBuff(BuffID.OnFire, 180); } } diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index 6ce442a8f7..97bfeead83 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -14,36 +14,36 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 2; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } } - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 6f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 6f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player.moonLeech) return; diff --git a/Projectiles/Melee/Blood2.cs b/Projectiles/Melee/Blood2.cs index 36d01bb41b..6ac10ce4cb 100644 --- a/Projectiles/Melee/Blood2.cs +++ b/Projectiles/Melee/Blood2.cs @@ -14,31 +14,31 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 150; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 150; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 120 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 120 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 2; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } } - if (projectile.timeLeft < 120) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 6f, 20f); + if (Projectile.timeLeft < 120) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 6f, 20f); } } } diff --git a/Projectiles/Melee/BloodBall.cs b/Projectiles/Melee/BloodBall.cs index e038de0577..9a963cdfea 100644 --- a/Projectiles/Melee/BloodBall.cs +++ b/Projectiles/Melee/BloodBall.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,23 +15,23 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 200; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 200; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override void AI() { try { - int num223 = (int)(projectile.position.X / 16f) - 1; - int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; - int num225 = (int)(projectile.position.Y / 16f) - 1; - int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; + int num223 = (int)(Projectile.position.X / 16f) - 1; + int num224 = (int)((Projectile.position.X + (float)Projectile.width) / 16f) + 2; + int num225 = (int)(Projectile.position.Y / 16f) - 1; + int num226 = (int)((Projectile.position.Y + (float)Projectile.height) / 16f) + 2; if (num223 < 0) { num223 = 0; @@ -51,15 +52,15 @@ namespace CalamityMod.Projectiles.Melee { for (int num228 = num225; num228 < num226; num228++) { - if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) + if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].TileType] || (Main.tileSolidTop[(int)Main.tile[num227, num228].TileType] && Main.tile[num227, num228].TileFrameY == 0))) { Vector2 vector19; vector19.X = (float)(num227 * 16); vector19.Y = (float)(num228 * 16); - if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) + if (Projectile.position.X + (float)Projectile.width - 4f > vector19.X && Projectile.position.X + 4f < vector19.X + 16f && Projectile.position.Y + (float)Projectile.height - 4f > vector19.Y && Projectile.position.Y + 4f < vector19.Y + 16f) { - projectile.velocity.X = 0f; - projectile.velocity.Y = -0.2f; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = -0.2f; } } } @@ -67,64 +68,64 @@ namespace CalamityMod.Projectiles.Melee } catch { } - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + if (Projectile.owner == Main.myPlayer && Projectile.timeLeft <= 3) { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 128; - projectile.height = 128; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 8f; + Projectile.tileCollide = false; + Projectile.ai[1] = 0f; + Projectile.alpha = 255; + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 128; + Projectile.height = 128; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.knockBack = 8f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 10f) { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 10f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCHit, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 22; - projectile.height = 22; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.NPCHit, (int)Projectile.position.X, (int)Projectile.position.Y, 20); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 22; + Projectile.height = 22; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num648 = 0; num648 < 20; num648++) { - int num649 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.5f); + int num649 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.5f); Main.dust[num649].velocity *= 1.4f; } for (int num650 = 0; num650 < 10; num650++) { - int num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 2.5f); + int num651 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 2.5f); Main.dust[num651].noGravity = true; Main.dust[num651].velocity *= 5f; - num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.5f); + num651 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.5f); Main.dust[num651].velocity *= 3f; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Melee/BloodExplosion.cs b/Projectiles/Melee/BloodExplosion.cs index 88bd805ae1..06f30e9013 100644 --- a/Projectiles/Melee/BloodExplosion.cs +++ b/Projectiles/Melee/BloodExplosion.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,27 +17,27 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 100; - projectile.height = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.width = 100; + Projectile.height = 100; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 5; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) return; - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int d = 0; d < 4; d++) { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Blood, 0f, 0f, 100, default, 1.5f); + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1.5f); Main.dust[index].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -46,13 +47,13 @@ namespace CalamityMod.Projectiles.Melee } for (int d = 0; d < 6; d++) { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Blood, 0f, 0f, 100, default, 2f); + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 5f; - index = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Blood, 0f, 0f, 100, default, 1.5f); + index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1.5f); Main.dust[index].velocity *= 2f; } - projectile.ai[1]++; + Projectile.ai[1]++; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/BloodScythe.cs b/Projectiles/Melee/BloodScythe.cs index 418037b2f2..ddc5c36940 100644 --- a/Projectiles/Melee/BloodScythe.cs +++ b/Projectiles/Melee/BloodScythe.cs @@ -16,34 +16,34 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 28; + Projectile.height = 28; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.075f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.075f / 255f); - projectile.velocity *= 0.935f; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.1f; - projectile.Opacity = Utils.InverseLerp(1f, 6f, projectile.velocity.Length(), true); - if (projectile.Opacity <= 0f) - projectile.Kill(); + Projectile.velocity *= 0.935f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.1f; + Projectile.Opacity = Utils.InverseLerp(1f, 6f, Projectile.velocity.Length(), true); + if (Projectile.Opacity <= 0f) + Projectile.Kill(); if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Melee/BloodyBlade.cs b/Projectiles/Melee/BloodyBlade.cs index d8b7f2cd46..80323afe54 100644 --- a/Projectiles/Melee/BloodyBlade.cs +++ b/Projectiles/Melee/BloodyBlade.cs @@ -12,32 +12,32 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Bloody Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 48; - projectile.height = 48; - projectile.aiStyle = 18; + Projectile.width = 48; + Projectile.height = 48; + Projectile.aiStyle = 18; aiType = ProjectileID.DeathSickle; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.timeLeft = 300; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.3f / 255f, (255 - projectile.alpha) * 0.3f / 255f, (255 - projectile.alpha) * 0f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0f / 255f); } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -46,13 +46,13 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 9; + target.immune[Projectile.owner] = 9; target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(BuffID.Ichor, 60); } diff --git a/Projectiles/Melee/BlueAura.cs b/Projectiles/Melee/BlueAura.cs index 8411a06fed..435a23826c 100644 --- a/Projectiles/Melee/BlueAura.cs +++ b/Projectiles/Melee/BlueAura.cs @@ -14,22 +14,22 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { for (int num468 = 0; num468 < 3; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 15, 0f, 0f, 100, default, 1.3f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 15, 0f, 0f, 100, default, 1.3f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } diff --git a/Projectiles/Melee/BonebreakerFragment1.cs b/Projectiles/Melee/BonebreakerFragment1.cs index 4973879e74..c131ea7e6e 100644 --- a/Projectiles/Melee/BonebreakerFragment1.cs +++ b/Projectiles/Melee/BonebreakerFragment1.cs @@ -16,29 +16,29 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.aiStyle = 24; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.alpha = 50; - projectile.timeLeft = 600; - projectile.melee = true; + Projectile.width = 6; + Projectile.height = 6; + Projectile.aiStyle = 24; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.alpha = 50; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Melee; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { //Changes the texture of the projectile - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Melee/BonebreakerFragment2"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/BonebreakerFragment2"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Melee/BonebreakerFragment2"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/BonebreakerFragment2"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } return true; diff --git a/Projectiles/Melee/BonebreakerProjectile.cs b/Projectiles/Melee/BonebreakerProjectile.cs index b9290cf7e5..5af9ea93ca 100644 --- a/Projectiles/Melee/BonebreakerProjectile.cs +++ b/Projectiles/Melee/BonebreakerProjectile.cs @@ -16,44 +16,44 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.melee = true; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -2; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -2; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 45f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] >= 45f) { - projectile.velocity.X *= 0.98f; - projectile.velocity.Y += 0.35f; + Projectile.velocity.X *= 0.98f; + Projectile.velocity.Y += 0.35f; } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } //Sticky Behaviour - projectile.StickyProjAI(15); + Projectile.StickyProjAI(15); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(6, true); + Projectile.ModifyHitNPCSticky(6, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -67,8 +67,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -76,9 +76,9 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i <= 3; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 78, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.8f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 78, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 0.8f); } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int s = 0; s < Main.rand.Next(2,5); s++) { @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee } velocity.Normalize(); velocity *= (float)Main.rand.Next(70, 101) * 0.1f; - int shard = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack * 0.5f, projectile.owner, Main.rand.Next(0,4), 0f); + int shard = Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.Next(0,4), 0f); } } } @@ -110,13 +110,13 @@ namespace CalamityMod.Projectiles.Melee public override bool? CanHitNPC(NPC target) { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { return false; } return null; } - public override bool CanHitPvp(Player target) => projectile.ai[0] != 1f; + public override bool CanHitPvp(Player target) => Projectile.ai[0] != 1f; } } diff --git a/Projectiles/Melee/Brimblast.cs b/Projectiles/Melee/Brimblast.cs index 953fbcb2ad..8b9022c3a0 100644 --- a/Projectiles/Melee/Brimblast.cs +++ b/Projectiles/Melee/Brimblast.cs @@ -16,45 +16,45 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 24; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 240; + Projectile.width = 6; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.timeLeft = 240; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + Projectile.velocity.X = Projectile.velocity.X * -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + Projectile.rotation += Projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num199]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee dust.velocity.Y -= 4f; if (Main.rand.NextBool(2)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Dust dust2 = Main.dust[num200]; dust2.position.X -= 2f; dust2.position.Y += 2f; @@ -71,14 +71,14 @@ namespace CalamityMod.Projectiles.Melee dust2.noGravity = true; dust2.velocity *= 0.2f; } - if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) + if (Projectile.velocity.Y < 0.25f && Projectile.velocity.Y > 0.15f) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + Projectile.velocity.X = Projectile.velocity.X * 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) + Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[Projectile.owner] = 7; target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/Projectiles/Melee/BrimlanceHellfireExplosion.cs b/Projectiles/Melee/BrimlanceHellfireExplosion.cs index 302775f4f3..e74ef268de 100644 --- a/Projectiles/Melee/BrimlanceHellfireExplosion.cs +++ b/Projectiles/Melee/BrimlanceHellfireExplosion.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -19,60 +20,60 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 130; - projectile.height = 130; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.melee = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 130; + Projectile.height = 130; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); + Projectile.localAI[0] += 1f; } bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -83,11 +84,11 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Melee/BrimlanceStandingFire.cs b/Projectiles/Melee/BrimlanceStandingFire.cs index ad7e3d1ec0..214cb2730b 100644 --- a/Projectiles/Melee/BrimlanceStandingFire.cs +++ b/Projectiles/Melee/BrimlanceStandingFire.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -18,50 +19,50 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 240; + Projectile.width = 6; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.timeLeft = 240; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + Projectile.velocity.X = Projectile.velocity.X * -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; - if (projectile.ai[1] == 0f && projectile.type >= 326 && projectile.type <= 328) + Projectile.rotation += Projectile.velocity.X * 0.1f; + if (Projectile.ai[1] == 0f && Projectile.type >= 326 && Projectile.type <= 328) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 13); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 13); } - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[num199]; expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; @@ -72,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; @@ -81,14 +82,14 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + Projectile.velocity.X = Projectile.velocity.X * 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) + Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } @@ -96,7 +97,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[Projectile.owner] = 7; target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/Projectiles/Melee/Brimlash2.cs b/Projectiles/Melee/Brimlash2.cs index b2c0c97ef0..b6b81f8834 100644 --- a/Projectiles/Melee/Brimlash2.cs +++ b/Projectiles/Melee/Brimlash2.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -12,65 +13,65 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Brimlash"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; aiType = ProjectileID.LightBeam; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.melee = true; - projectile.timeLeft = 120; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 120; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 90 && target.CanBeChasedBy(Projectile); public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); - if (projectile.timeLeft < 90) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 15f); + if (Projectile.timeLeft < 90) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 15f); - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 235, 0f, 0f, 100, default, 1f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 115) + if (Projectile.timeLeft > 115) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); int num3; for (int num795 = 4; num795 < 31; num795 = num3 + 1) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 235, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / (float)num795); + float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 235, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 235, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 235, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[num798]; dust.velocity *= 0.05f; num3 = num795; diff --git a/Projectiles/Melee/BrimlashProj.cs b/Projectiles/Melee/BrimlashProj.cs index 3603d1ee14..7ac210b3f5 100644 --- a/Projectiles/Melee/BrimlashProj.cs +++ b/Projectiles/Melee/BrimlashProj.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,81 +15,81 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Brimlash"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; aiType = ProjectileID.LightBeam; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.melee = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - projectile.velocity *= 0.99f; - if (projectile.velocity.Length() < 3f) + Projectile.velocity *= 0.99f; + if (Projectile.velocity.Length() < 3f) { - projectile.Kill(); + Projectile.Kill(); } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 295) + if (Projectile.timeLeft > 295) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); int num3; for (int num795 = 4; num795 < 31; num795 = num3 + 1) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, (int)CalamityDusts.Brimstone, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / (float)num795); + float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, (int)CalamityDusts.Brimstone, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[num798]; dust.velocity *= 0.05f; num3 = num795; } float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (i = 0; i < 2; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/BrimstoneBoom.cs b/Projectiles/Melee/BrimstoneBoom.cs index b88d88e196..cdfae4c092 100644 --- a/Projectiles/Melee/BrimstoneBoom.cs +++ b/Projectiles/Melee/BrimstoneBoom.cs @@ -16,33 +16,33 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.timeLeft = 5; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while (num462 < num461) { @@ -53,10 +53,10 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; + Main.dust[num467].position.X = Projectile.Center.X; + Main.dust[num467].position.Y = Projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; expr_149DF_cp_0.position.X += Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[Projectile.owner] = 6; } } } diff --git a/Projectiles/Melee/BrimstoneLaserFriendly.cs b/Projectiles/Melee/BrimstoneLaserFriendly.cs index f03f349cf2..94b57dbf4e 100644 --- a/Projectiles/Melee/BrimstoneLaserFriendly.cs +++ b/Projectiles/Melee/BrimstoneLaserFriendly.cs @@ -19,36 +19,36 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.aiStyle = 1; + Projectile.width = 2; + Projectile.height = 2; + Projectile.aiStyle = 1; aiType = ProjectileID.DeathLaser; - projectile.friendly = true; - projectile.melee = true; - projectile.scale = 2f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.alpha = 120; - projectile.timeLeft = 600; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.scale = 2f; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.alpha = 120; + Projectile.timeLeft = 600; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - projectile.velocity.X *= 1.05f; - projectile.velocity.Y *= 1.05f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.velocity.Y += projectile.ai[0]; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); + Projectile.velocity.X *= 1.05f; + Projectile.velocity.Y *= 1.05f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.velocity.Y += Projectile.ai[0]; if (Main.rand.NextBool(2)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Melee/BrimstoneSwordExplosion.cs b/Projectiles/Melee/BrimstoneSwordExplosion.cs index c3ca6be0e8..77cd328b5b 100644 --- a/Projectiles/Melee/BrimstoneSwordExplosion.cs +++ b/Projectiles/Melee/BrimstoneSwordExplosion.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -19,60 +20,60 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 130; - projectile.height = 130; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 3; - projectile.timeLeft = 60; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 130; + Projectile.height = 130; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 3; + Projectile.timeLeft = 60; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); + Projectile.localAI[0] += 1f; } bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -83,11 +84,11 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Melee/BrinySpout.cs b/Projectiles/Melee/BrinySpout.cs index ab432b0735..01facbff6a 100644 --- a/Projectiles/Melee/BrinySpout.cs +++ b/Projectiles/Melee/BrinySpout.cs @@ -10,22 +10,22 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Briny Spout"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 150; - projectile.height = 42; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 60; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 8; + Projectile.width = 150; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.timeLeft = 60; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; } public override void AI() @@ -35,92 +35,92 @@ namespace CalamityMod.Projectiles.Melee float num615 = 1.5f; int num616 = 150; int num617 = 42; - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); + Projectile.direction = Projectile.spriteDirection = -Math.Sign(Projectile.velocity.X); } - projectile.frameCounter++; - if (projectile.frameCounter > 2) + Projectile.frameCounter++; + if (Projectile.frameCounter > 2) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 6) + if (Projectile.frame >= 6) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.scale = ((float)(num613 + num614) - Projectile.ai[1]) * num615 / (float)(num614 + num613); + Projectile.width = (int)((float)num616 * Projectile.scale); + Projectile.height = (int)((float)num617 * Projectile.scale); + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } - if (projectile.ai[1] != -1f) + if (Projectile.ai[1] != -1f) { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); + Projectile.scale = ((float)(num613 + num614) - Projectile.ai[1]) * num615 / (float)(num614 + num613); + Projectile.width = (int)((float)num616 * Projectile.scale); + Projectile.height = (int)((float)num617 * Projectile.scale); } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (!Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.alpha -= 3; - if (projectile.alpha < 60) + Projectile.alpha -= 3; + if (Projectile.alpha < 60) { - projectile.alpha = 60; + Projectile.alpha = 60; } } else { - projectile.alpha += 3; - if (projectile.alpha > 150) + Projectile.alpha += 3; + if (Projectile.alpha > 150) { - projectile.alpha = 150; + Projectile.alpha = 150; } } - if (projectile.ai[0] > 0f) + if (Projectile.ai[0] > 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + if (Projectile.ai[0] == 1f && Projectile.ai[1] > 0f && Projectile.owner == Main.myPlayer) { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + Projectile.netUpdate = true; + Vector2 center = Projectile.Center; + center.Y -= (float)num617 * Projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - Projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); center.Y -= (float)num617 * num618 / 2f; center.Y += 2f; - int num335 = Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 8f, projectile.ai[1] - 1f); + int num335 = Projectile.NewProjectile(center.X, center.Y, Projectile.velocity.X, Projectile.velocity.Y, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 8f, Projectile.ai[1] - 1f); } - if (projectile.ai[0] <= 0f) + if (Projectile.ai[0] <= 0f) { float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; + float num623 = (float)Projectile.width / 5f; num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)-(float)projectile.direction; - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)-(float)projectile.direction; + float num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; + Projectile.position.X = Projectile.position.X - num624 * (float)-(float)Projectile.direction; + Projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; + Projectile.position.X = Projectile.position.X + num624 * (float)-(float)Projectile.direction; } } public override Color? GetAlpha(Color lightColor) { - return new Color(53, Main.DiscoG, 255, projectile.alpha); + return new Color(53, Main.DiscoG, 255, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Melee/BrinyTyphoonBubble.cs b/Projectiles/Melee/BrinyTyphoonBubble.cs index ea7f33242a..1524810668 100644 --- a/Projectiles/Melee/BrinyTyphoonBubble.cs +++ b/Projectiles/Melee/BrinyTyphoonBubble.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -11,57 +12,57 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Bubble"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.melee = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 5; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 5; } public override void AI() { - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - int num625 = (int)projectile.ai[1] - 1; + int num625 = (int)Projectile.ai[1] - 1; if (num625 < 255) { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 10f) { int num626 = 6; for (int num627 = 0; num627 < num626; num627++) { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + projectile.Center; + Vector2 vector45 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + Projectile.Center; Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); int num628 = Dust.NewDust(vector45 + value15, 0, 0, 187, value15.X * 2f, value15.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 1.4f); Main.dust[num628].noGravity = true; Main.dust[num628].noLight = true; Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; + Main.dust[num628].velocity -= Projectile.velocity; } - projectile.alpha -= 5; - if (projectile.alpha < 100) + Projectile.alpha -= 5; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + Projectile.rotation += Projectile.velocity.X * 0.1f; + Projectile.frame = (int)(Projectile.localAI[0] / 3f) % 3; } - Vector2 value16 = Main.player[num625].Center - projectile.Center; + Vector2 value16 = Main.player[num625].Center - Projectile.Center; float num629 = 4f; - num629 += projectile.localAI[0] / 20f; - projectile.velocity = Vector2.Normalize(value16) * num629; + num629 += Projectile.localAI[0] / 20f; + Projectile.velocity = Vector2.Normalize(value16) * num629; if (value16.Length() < 50f) { - projectile.Kill(); + Projectile.Kill(); } } } @@ -69,49 +70,49 @@ namespace CalamityMod.Projectiles.Melee { float num630 = 0.209439516f; float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) + float num632 = (float)(Math.Cos((double)(num630 * Projectile.ai[0])) - 0.5) * num631; + Projectile.velocity.Y = Projectile.velocity.Y - num632; + Projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * Projectile.ai[0])) - 0.5) * num631; + Projectile.velocity.Y = Projectile.velocity.Y + num632; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 10f) { - projectile.alpha -= 5; - if (projectile.alpha < 100) + Projectile.alpha -= 5; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + Projectile.rotation += Projectile.velocity.X * 0.1f; + Projectile.frame = (int)(Projectile.localAI[0] / 3f) % 3; } } - if (projectile.wet) + if (Projectile.wet) { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); + Projectile.position.Y = Projectile.position.Y - 16f; + Projectile.Kill(); return; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 96); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 96); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 187, vector7.X * 2f, vector7.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int num330 = (int)(projectile.Center.Y / 16f); - int num331 = (int)(projectile.Center.X / 16f); + int num330 = (int)(Projectile.Center.Y / 16f); + int num331 = (int)(Projectile.Center.X / 16f); int num332 = 100; if (num331 < 10) { @@ -132,13 +133,13 @@ namespace CalamityMod.Projectiles.Melee for (int num333 = num330; num333 < num330 + num332; num333++) { Tile tile = Main.tile[num331, num333]; - if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + if (tile.active() && (Main.tileSolid[(int)tile.TileType] || tile.liquid != 0)) { num330 = num333; break; } } - int num335 = Projectile.NewProjectile((float)(num331 * 16 + 8), (float)(num330 * 16 - 24), 0f, 0f, ModContent.ProjectileType(), projectile.damage, 6f, Main.myPlayer, 8f, 25f); + int num335 = Projectile.NewProjectile((float)(num331 * 16 + 8), (float)(num330 * 16 - 24), 0f, 0f, ModContent.ProjectileType(), Projectile.damage, 6f, Main.myPlayer, 8f, 25f); Main.projectile[num335].netUpdate = true; } } diff --git a/Projectiles/Melee/BrokenBiomeBladeHoldout.cs b/Projectiles/Melee/BrokenBiomeBladeHoldout.cs index 440f03e907..82543140eb 100644 --- a/Projectiles/Melee/BrokenBiomeBladeHoldout.cs +++ b/Projectiles/Melee/BrokenBiomeBladeHoldout.cs @@ -9,18 +9,19 @@ using Terraria.ModLoader; using CalamityMod.Items.Weapons.Melee; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class BrokenBiomeBladeHoldout : ModProjectile //Visuals { - private Player Owner => Main.player[projectile.owner]; + private Player Owner => Main.player[Projectile.owner]; public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.modItem as BiomeBlade).CanUseItem(Owner) : false; public bool OwnerMayChannel => Owner.itemAnimation == 0 && OwnerCanUseItem && Owner.Calamity().mouseRight && Owner.active && !Owner.dead && Owner.StandingStill() && !Owner.mount.Active && Owner.CheckSolidGround(1, 3); - public ref float ChanneledState => ref projectile.ai[0]; - public ref float ChannelTimer => ref projectile.ai[1]; - public ref float Initialized => ref projectile.localAI[0]; + public ref float ChanneledState => ref Projectile.ai[0]; + public ref float ChannelTimer => ref Projectile.ai[1]; + public ref float Initialized => ref Projectile.localAI[0]; private Item associatedItem; const int ChannelTime = 120; @@ -33,13 +34,13 @@ namespace CalamityMod.Projectiles.Melee public bool drawIndrawHeldProjInFrontOfHeldItemAndArms = true; public override void SetDefaults() { - projectile.width = projectile.height = 36; - projectile.aiStyle = -1; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.tileCollide = false; - projectile.damage = 0; + Projectile.width = Projectile.height = 36; + Projectile.aiStyle = -1; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.tileCollide = false; + Projectile.damage = 0; } public CurveSegment anticipation = new CurveSegment(EasingType.SineOut, 0f, 1f, 0.35f); @@ -57,12 +58,12 @@ namespace CalamityMod.Projectiles.Melee //If dropped, kill it instantly if (Owner.HeldItem.type != ItemType()) { - projectile.Kill(); + Projectile.Kill(); return; } if (Owner.whoAmI == Main.myPlayer) - Main.PlaySound(SoundID.DD2_DarkMageHealImpact); + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact); associatedItem = Owner.HeldItem; //Switch up the attunements @@ -74,25 +75,25 @@ namespace CalamityMod.Projectiles.Melee if (!OwnerMayChannel && ChanneledState == 0f) //IF the channeling gets interrupted for any reason { - projectile.Center = Owner.Top + new Vector2(18f, 0f); + Projectile.Center = Owner.Top + new Vector2(18f, 0f); ChanneledState = 1f; - projectile.timeLeft = 60; + Projectile.timeLeft = 60; return; } if (ChanneledState == 0f) { - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; - projectile.Center = Owner.Center + new Vector2(16f * Owner.direction, -30 * SwordHeight() + 10f); - projectile.rotation = Utils.AngleLerp(-MathHelper.PiOver4, MathHelper.PiOver4 + MathHelper.PiOver2, MathHelper.Clamp(((ChannelTimer - 20f) / 50f), 0f, 1f)); + Projectile.Center = Owner.Center + new Vector2(16f * Owner.direction, -30 * SwordHeight() + 10f); + Projectile.rotation = Utils.AngleLerp(-MathHelper.PiOver4, MathHelper.PiOver4 + MathHelper.PiOver2, MathHelper.Clamp(((ChannelTimer - 20f) / 50f), 0f, 1f)); ChannelTimer++; - projectile.timeLeft = 60; + Projectile.timeLeft = 60; if (ChannelTimer >= ChannelTime) { Attune((BiomeBlade)associatedItem.modItem); - projectile.timeLeft = 120; + Projectile.timeLeft = 120; ChanneledState = 2f; //State where it stays invisible doing nothing. Acts as a cooldown Color particleColor = (associatedItem.modItem as BiomeBlade).mainAttunement.tooltipColor; @@ -113,7 +114,7 @@ namespace CalamityMod.Projectiles.Melee } if (ChanneledState == 1f) - projectile.position += Vector2.UnitY * -0.3f * (1f + projectile.timeLeft / 60f); + Projectile.position += Vector2.UnitY * -0.3f * (1f + Projectile.timeLeft / 60f); } public void Attune(BiomeBlade item) @@ -147,13 +148,13 @@ namespace CalamityMod.Projectiles.Melee //If the owner already had the attunement , break out of it (And unswap) if (item.secondaryAttunement == attunement) { - Main.PlaySound(SoundID.DD2_LightningBugZap, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_LightningBugZap, Projectile.Center); item.secondaryAttunement = item.mainAttunement; item.mainAttunement = attunement; return; } - Main.PlaySound(SoundID.DD2_MonkStaffGroundImpact, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Projectile.Center); item.mainAttunement = attunement; } @@ -182,9 +183,9 @@ namespace CalamityMod.Projectiles.Melee else if (ChanneledState == 1f) { Texture2D tex = GetTexture(Texture); - Vector2 squishyScale = new Vector2(Math.Abs((float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * projectile.timeLeft / 30f)), 1f); - SpriteEffects flip = (float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * projectile.timeLeft / 30f) > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(tex, projectile.position - Main.screenPosition, null, lightColor * (projectile.timeLeft / 60f), 0, tex.Size() / 2, squishyScale * (2f - (projectile.timeLeft / 60f)), flip, 0); + Vector2 squishyScale = new Vector2(Math.Abs((float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f)), 1f); + SpriteEffects flip = (float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f) > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(tex, Projectile.position - Main.screenPosition, null, lightColor * (Projectile.timeLeft / 60f), 0, tex.Size() / 2, squishyScale * (2f - (Projectile.timeLeft / 60f)), flip, 0); return false; } diff --git a/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs index 4b27d58436..e45c558786 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -17,10 +18,10 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur"; private bool initialized = false; Vector2 direction = Vector2.Zero; - public ref float Shred => ref projectile.ai[0]; //How much the attack is, attacking + public ref float Shred => ref Projectile.ai[0]; //How much the attack is, attacking public float ShredRatio => MathHelper.Clamp(Shred / (maxShred * 0.5f), 0f, 1f); - public ref float PogoCooldown => ref projectile.ai[1]; //Cooldown for the pogo - public Player Owner => Main.player[projectile.owner]; + public ref float PogoCooldown => ref Projectile.ai[1]; //Cooldown for the pogo + public Player Owner => Main.player[Projectile.owner]; public bool CanPogo => Owner.velocity.Y != 0 && PogoCooldown <= 0; //Only pogo when in the air and if the cooldown is zero private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; @@ -33,27 +34,27 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 70; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = BiomeBlade.HotAttunement_LocalIFrames; - projectile.timeLeft = BiomeBlade.HotAttunement_LocalIFrames; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 70; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = BiomeBlade.HotAttunement_LocalIFrames; + Projectile.timeLeft = BiomeBlade.HotAttunement_LocalIFrames; } public override bool CanDamage() { - return projectile.timeLeft <= 2; //Prevent spam click abuse + return Projectile.timeLeft <= 2; //Prevent spam click abuse } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 94 * projectile.scale; - float bladeWidth = 76 * projectile.scale; + float bladeLenght = 94 * Projectile.scale; + float bladeWidth = 76 * Projectile.scale; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); } @@ -65,9 +66,9 @@ namespace CalamityMod.Projectiles.Melee Owner.velocity = -direction.SafeNormalize(Vector2.Zero) * pogoStrenght; //Bounce Owner.fallStart = (int)(Owner.position.Y / 16f); PogoCooldown = 30; //Cooldown - Main.PlaySound(SoundID.DD2_MonkStaffGroundImpact, projectile.position); + SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Projectile.position); - Vector2 hitPosition = Owner.Center + (direction * 84 * projectile.scale); + Vector2 hitPosition = Owner.Center + (direction * 84 * Projectile.scale); for (int i = 0; i < 8; i++) { @@ -97,13 +98,13 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao { - Main.PlaySound(SoundID.Item90, projectile.Center); + SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); initialized = true; } if (!OwnerCanShoot) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -112,28 +113,28 @@ namespace CalamityMod.Projectiles.Melee if (Shred < 0) Shred = 0; - Lighting.AddLight(projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio); + Lighting.AddLight(Projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio); //Manage position and rotation direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); - projectile.rotation = direction.ToRotation(); - projectile.Center = Owner.Center + (direction * 60); + Projectile.rotation = direction.ToRotation(); + Projectile.Center = Owner.Center + (direction * 60); //Scaling based on shred - projectile.localNPCHitCooldown = BiomeBlade.HotAttunement_LocalIFrames - (int)(MathHelper.Lerp(0, BiomeBlade.HotAttunement_LocalIFrames - BiomeBlade.HotAttunement_LocalIFramesCharged, ShredRatio)); //Increase the hit frequency - projectile.scale = 1f + (ShredRatio * 1f); //SWAGGER + Projectile.localNPCHitCooldown = BiomeBlade.HotAttunement_LocalIFrames - (int)(MathHelper.Lerp(0, BiomeBlade.HotAttunement_LocalIFrames - BiomeBlade.HotAttunement_LocalIFramesCharged, ShredRatio)); //Increase the hit frequency + Projectile.scale = 1f + (ShredRatio * 1f); //SWAGGER - if (Collision.SolidCollision(Owner.Center + (direction * 84 * projectile.scale) - Vector2.One * 5f, 10, 10)) + if (Collision.SolidCollision(Owner.Center + (direction * 84 * Projectile.scale) - Vector2.One * 5f, 10, 10)) { Pogo(); - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.direction = Math.Sign(direction.X); Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) @@ -146,8 +147,8 @@ namespace CalamityMod.Projectiles.Melee Shred -= BiomeBlade.HotAttunement_ShredDecayRate; PogoCooldown--; - if (projectile.timeLeft <= 2) - projectile.timeLeft = 2; + if (Projectile.timeLeft <= 2) + Projectile.timeLeft = 2; } //Since the iframes vary, adjust the damage to be consistent no matter the iframes. The true scaling happens between the BaseDamage and the FulLChargeDamage @@ -157,7 +158,7 @@ namespace CalamityMod.Projectiles.Melee float currentDamage = (int)(MathHelper.Lerp(BiomeBlade.HotAttunement_BaseDamage * deviationFromBaseDamage, BiomeBlade.HotAttunement_FullChargeDamage * deviationFromBaseDamage, ShredRatio)); //Adjust the damage to make it constant based on the local iframes - float damageReduction = projectile.localNPCHitCooldown / (float)BiomeBlade.HotAttunement_LocalIFrames; + float damageReduction = Projectile.localNPCHitCooldown / (float)BiomeBlade.HotAttunement_LocalIFrames; damage = (int)(currentDamage * damageReduction); } @@ -168,7 +169,7 @@ namespace CalamityMod.Projectiles.Melee float currentDamage = (int)(MathHelper.Lerp(BiomeBlade.HotAttunement_BaseDamage * deviationFromBaseDamage, BiomeBlade.HotAttunement_FullChargeDamage * deviationFromBaseDamage, ShredRatio)); //Adjust the damage to make it constant based on the local iframes - float damageReduction = projectile.localNPCHitCooldown / (float)BiomeBlade.HotAttunement_LocalIFrames; + float damageReduction = Projectile.localNPCHitCooldown / (float)BiomeBlade.HotAttunement_LocalIFrames; damage = (int)(currentDamage * damageReduction); } @@ -183,7 +184,7 @@ namespace CalamityMod.Projectiles.Melee // get lifted up if (PogoCooldown <= 0) { - Main.PlaySound(SoundID.NPCHit30, projectile.Center); //Sizzle + SoundEngine.PlaySound(SoundID.NPCHit30, Projectile.Center); //Sizzle Shred += 62; //Augment the shredspeed if (Owner.velocity.Y > 0) Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly @@ -194,7 +195,7 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCHit43, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit43, Projectile.Center); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -210,16 +211,16 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition; - spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, blade.Height); - drawOffset = Owner.Center + (drawAngle.ToRotationVector2() * 32f * projectile.scale) - Main.screenPosition; + drawOffset = Owner.Center + (drawAngle.ToRotationVector2() * 32f * Projectile.scale) - Main.screenPosition; - spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); for (int i = 0; i < bladeAmount; i++) //Draw extra copies @@ -237,7 +238,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOffsetStraight = Owner.Center + direction * (float)Math.Sin(Main.GlobalTime * 7) * 10 - Main.screenPosition; //How far from the player Vector2 drawDisplacementAngle = direction.RotatedBy(MathHelper.PiOver2) * circleCompletion.ToRotationVector2().Y * (20 + 40 * ShredRatio); //How far perpendicularly - spriteBatch.Draw(blade, drawOffsetStraight + drawDisplacementAngle, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffsetStraight + drawDisplacementAngle, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); } //Back to normal diff --git a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs index 1209c36a55..3a2f1e5730 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs @@ -10,6 +10,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -21,9 +22,9 @@ namespace CalamityMod.Projectiles.Melee private bool initialized = false; Vector2 direction = Vector2.Zero; public float rotation; - public ref float SwingMode => ref projectile.ai[0]; //0 = Up-Down small slash, 1 = Down-Up large slash, 2 = Thrust - public ref float MaxTime => ref projectile.ai[1]; - public float Timer => MaxTime - projectile.timeLeft; + public ref float SwingMode => ref Projectile.ai[0]; //0 = Up-Down small slash, 1 = Down-Up large slash, 2 = Thrust + public ref float MaxTime => ref Projectile.ai[1]; + public float Timer => MaxTime - Projectile.timeLeft; public int SwingDirection { @@ -55,22 +56,22 @@ namespace CalamityMod.Projectiles.Melee } } - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { DisplayName.SetDefault("Biting Embrace"); - Main.projFrames[projectile.type] = 6; //The true trolling is that we only really use this for the third swing. + Main.projFrames[Projectile.type] = 6; //The true trolling is that we only really use this for the third swing. } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 75; - projectile.width = projectile.height = 75; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 75; + Projectile.width = Projectile.height = 75; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -82,14 +83,14 @@ namespace CalamityMod.Projectiles.Melee switch (SwingMode) { case 0: - bladeLenght = 90f * projectile.scale; + bladeLenght = 90f * Projectile.scale; break; case 1: - bladeLenght = 110f * projectile.scale; + bladeLenght = 110f * Projectile.scale; break; case 2: - bladeLenght = projectile.frame <= 2 ? 85f : 150f; //Only use the extended hitbox after the blade actually extends. For realism. - bladeLenght *= projectile.scale; + bladeLenght = Projectile.frame <= 2 ? 85f : 150f; //Only use the extended hitbox after the blade actually extends. For realism. + bladeLenght *= Projectile.scale; displace = direction * ThrustDisplaceRatio() * 60f; break; @@ -108,53 +109,53 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - projectile.timeLeft = (int)MaxTime; + Projectile.timeLeft = (int)MaxTime; switch (SwingMode) { case 0: - projectile.width = projectile.height = 100; - Main.PlaySound(SoundID.DD2_MonkStaffSwing, projectile.Center); + Projectile.width = Projectile.height = 100; + SoundEngine.PlaySound(SoundID.DD2_MonkStaffSwing, Projectile.Center); break; case 1: - projectile.width = projectile.height = 140; - Main.PlaySound(SoundID.DD2_OgreSpit, projectile.Center); - projectile.damage = (int)(projectile.damage * BiomeBlade.ColdAttunement_SecondSwingBoost); + Projectile.width = Projectile.height = 140; + SoundEngine.PlaySound(SoundID.DD2_OgreSpit, Projectile.Center); + Projectile.damage = (int)(Projectile.damage * BiomeBlade.ColdAttunement_SecondSwingBoost); break; case 2: - projectile.width = projectile.height = 130; - Main.PlaySound(SoundID.DD2_PhantomPhoenixShot, projectile.Center); - projectile.damage = (int)(projectile.damage * BiomeBlade.ColdAttunement_ThirdSwingBoost); + Projectile.width = Projectile.height = 130; + SoundEngine.PlaySound(SoundID.DD2_PhantomPhoenixShot, Projectile.Center); + Projectile.damage = (int)(Projectile.damage * BiomeBlade.ColdAttunement_ThirdSwingBoost); break; } //Take the direction the sword is swung. FUCK not controlling the swing direction more than just left/right :| direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); - projectile.rotation = direction.ToRotation(); + Projectile.rotation = direction.ToRotation(); initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } //Manage position and rotation - projectile.Center = Owner.Center + (direction * 30); + Projectile.Center = Owner.Center + (direction * 30); //rotation = projectile.rotation + MathHelper.SmoothStep(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, Timer / MaxTime); float factor = 1 - (float)Math.Pow((double)-(Timer / MaxTime) + 1, 2d); - rotation = projectile.rotation + MathHelper.Lerp(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, factor); - projectile.scale = 1f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.6f); //SWAGGER + rotation = Projectile.rotation + MathHelper.Lerp(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, factor); + Projectile.scale = 1f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.6f); //SWAGGER Lighting.AddLight(Owner.MountedCenter, new Vector3(0.75f, 1f, 1f) * (float)Math.Sin(Timer / MaxTime * MathHelper.Pi)); //Add the thrust motion & animation for the third combo state if (SwingMode == 2) { - projectile.scale = 1f + (ThrustScaleRatio() * 0.6f); - projectile.Center = Owner.Center + (direction * ThrustDisplaceRatio() * 60); + Projectile.scale = 1f + (ThrustScaleRatio() * 0.6f); + Projectile.Center = Owner.Center + (direction * ThrustDisplaceRatio() * 60); - projectile.frameCounter++; - if (projectile.frameCounter % 5 == 0 && projectile.frame + 1 < Main.projFrames[projectile.type]) - projectile.frame++; + Projectile.frameCounter++; + if (Projectile.frameCounter % 5 == 0 && Projectile.frame + 1 < Main.projFrames[Projectile.type]) + Projectile.frame++; if (Main.rand.NextBool()) { @@ -167,13 +168,13 @@ namespace CalamityMod.Projectiles.Melee else if (Main.rand.NextFloat(0f, 1f) > 0.75f) { - Vector2 particlePosition = Owner.Center + (rotation.ToRotationVector2() * 100f * projectile.scale); + Vector2 particlePosition = Owner.Center + (rotation.ToRotationVector2() * 100f * Projectile.scale); Particle snowflake = new SnowflakeSparkle(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); GeneralParticleHandler.SpawnParticle(snowflake); } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.direction = Math.Sign(rotation.ToRotationVector2().X); Owner.itemRotation = rotation; if (Owner.direction != 1) @@ -208,14 +209,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, blade.Height); - drawOffset = Owner.Center + (drawAngle.ToRotationVector2() * 28f * projectile.scale) - Main.screenPosition; - spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + drawOffset = Owner.Center + (drawAngle.ToRotationVector2() * 28f * Projectile.scale) - Main.screenPosition; + spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Back to normal spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -230,18 +231,18 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - spriteBatch.Draw(handle, drawOffset + thrustDisplace, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawOffset + thrustDisplace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, 114f); - drawOffset = Owner.Center + (direction * 28f * projectile.scale) - Main.screenPosition; + drawOffset = Owner.Center + (direction * 28f * Projectile.scale) - Main.screenPosition; //Anim stuff - Rectangle frameRectangle = new Rectangle(0, 0 + (116 * projectile.frame), 114, 114); + Rectangle frameRectangle = new Rectangle(0, 0 + (116 * Projectile.frame), 114, 114); - spriteBatch.Draw(blade, drawOffset + thrustDisplace, frameRectangle, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffset + thrustDisplace, frameRectangle, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Back to normal spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs index 914048ff91..345c889442 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -16,12 +17,12 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort"; private bool initialized = false; Vector2 direction = Vector2.Zero; - public ref float MaxTime => ref projectile.ai[0]; - public ref float CanLunge => ref projectile.ai[1]; - public float Timer => MaxTime - projectile.timeLeft; - public Player Owner => Main.player[projectile.owner]; + public ref float MaxTime => ref Projectile.ai[0]; + public ref float CanLunge => ref Projectile.ai[1]; + public float Timer => MaxTime - Projectile.timeLeft; + public Player Owner => Main.player[Projectile.owner]; public const float LungeSpeed = 16; - public ref float CanBounce => ref projectile.localAI[0]; + public ref float CanBounce => ref Projectile.localAI[0]; public override void SetStaticDefaults() { @@ -29,19 +30,19 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 84; - projectile.width = projectile.height = 84; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 84; + Projectile.width = Projectile.height = 84; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 120f * projectile.scale; + float bladeLenght = 120f * Projectile.scale; Vector2 displace = direction * ((float)Math.Sin(Timer / MaxTime * 3.14f) * 60); return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (direction * bladeLenght), 24, ref collisionPoint); @@ -52,26 +53,26 @@ namespace CalamityMod.Projectiles.Melee if (!initialized) //Initialization { CanBounce = 1f; - projectile.timeLeft = (int)MaxTime; + Projectile.timeLeft = (int)MaxTime; direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); - projectile.rotation = direction.ToRotation(); + Projectile.rotation = direction.ToRotation(); if (CanLunge == 1f) Lunge(); - Main.PlaySound(SoundID.Item103, projectile.Center); + SoundEngine.PlaySound(SoundID.Item103, Projectile.Center); initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } //Manage position and rotation - projectile.scale = 1f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.6f); //SWAGGER - projectile.Center = Owner.Center + (direction * ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 60)); + Projectile.scale = 1f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.6f); //SWAGGER + Projectile.Center = Owner.Center + (direction * ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 60)); - Lighting.AddLight(projectile.Center, new Vector3(0.9f, 0f, 0.35f) * (float)Math.Sin(Timer / MaxTime * MathHelper.Pi)); + Lighting.AddLight(Projectile.Center, new Vector3(0.9f, 0f, 0.35f) * (float)Math.Sin(Timer / MaxTime * MathHelper.Pi)); //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.direction = Math.Sign(direction.X); Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) @@ -83,18 +84,18 @@ namespace CalamityMod.Projectiles.Melee public void Lunge() { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; Owner.velocity = direction.SafeNormalize(Vector2.UnitX * Owner.direction) * LungeSpeed; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => OnHitEffects(!target.canGhostHeal || Main.player[projectile.owner].moonLeech); - public override void OnHitPvp(Player target, int damage, bool crit) => OnHitEffects(Main.player[projectile.owner].moonLeech); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => OnHitEffects(!target.canGhostHeal || Main.player[Projectile.owner].moonLeech); + public override void OnHitPvp(Player target, int damage, bool crit) => OnHitEffects(Main.player[Projectile.owner].moonLeech); private void OnHitEffects(bool cannotLifesteal) { - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; if (Main.myPlayer != Owner.whoAmI || CanBounce == 0f) @@ -127,16 +128,16 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition; - spriteBatch.Draw(handle, drawOffset + displace, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawOffset + displace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, tex.Height); - drawOffset = Owner.Center + (drawAngle.ToRotationVector2() * 24f * projectile.scale) - Main.screenPosition; + drawOffset = Owner.Center + (drawAngle.ToRotationVector2() * 24f * Projectile.scale) - Main.screenPosition; - spriteBatch.Draw(tex, drawOffset + displace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(tex, drawOffset + displace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Back to normal spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs b/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs index 0fc79a03de..4f9bed63cf 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs @@ -9,6 +9,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -17,11 +18,11 @@ namespace CalamityMod.Projectiles.Melee { public override string Texture => "CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchBlade"; private bool initialized = false; - public Player Owner => Main.player[projectile.owner]; - public float Timer => MaxTime - projectile.timeLeft; - public ref float HasSnapped => ref projectile.ai[0]; - public ref float SnapCoyoteTime => ref projectile.ai[1]; - public ref float Reach => ref projectile.localAI[0]; + public Player Owner => Main.player[Projectile.owner]; + public float Timer => MaxTime - Projectile.timeLeft; + public ref float HasSnapped => ref Projectile.ai[0]; + public ref float SnapCoyoteTime => ref Projectile.ai[1]; + public ref float Reach => ref Projectile.localAI[0]; const float MaxTime = 90; const int coyoteTimeFrames = 15; //How many frames does the whip stay extended @@ -41,21 +42,21 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 36; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = BiomeBlade.TropicalAttunement_LocalIFrames; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 36; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = BiomeBlade.TropicalAttunement_LocalIFrames; } public override bool? CanCutTiles() => false; //Itd be quite counterproductive to make the whip cut the tiles it just grew public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - BezierCurve curve = new BezierCurve(new Vector2[] { Owner.MountedCenter, controlPoint1, controlPoint2, projectile.Center }); + BezierCurve curve = new BezierCurve(new Vector2[] { Owner.MountedCenter, controlPoint1, controlPoint2, Projectile.Center }); int numPoints = 32; Vector2[] chainPositions = curve.GetPoints(numPoints).ToArray(); @@ -73,10 +74,10 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { base.ModifyHitNPC(target, ref damage, ref knockback, ref crit, ref hitDirection); - Vector2 projectileHalfLenght = (projectile.Size / 2f) * projectile.rotation.ToRotationVector2(); + Vector2 projectileHalfLenght = (Projectile.Size / 2f) * Projectile.rotation.ToRotationVector2(); float collisionPoint = 0; //If you hit the enemy during the coyote time with the blade of the whip, guarantee a crit & get some bonus damage - if (Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), projectile.Center - projectileHalfLenght, projectile.Center + projectileHalfLenght, 32, ref collisionPoint)) + if (Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), Projectile.Center - projectileHalfLenght, Projectile.Center + projectileHalfLenght, 32, ref collisionPoint)) { if (SnapCoyoteTime > 0f) { @@ -99,37 +100,37 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization. create control points & shit) { - projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); + Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); Reach = MathHelper.Clamp((Owner.Center - Owner.Calamity().mouseWorld).Length(), MinReach, MaxReach); - Main.PlaySound(SoundID.DD2_OgreSpit, projectile.Center); - controlPoint1 = projectile.Center; - controlPoint2 = projectile.Center; - projectile.timeLeft = (int)MaxTime; + SoundEngine.PlaySound(SoundID.DD2_OgreSpit, Projectile.Center); + controlPoint1 = Projectile.Center; + controlPoint2 = Projectile.Center; + Projectile.timeLeft = (int)MaxTime; initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } if (ReelingBack && HasSnapped == 0f) //Snap & also small coyote time for the hook { - Main.PlaySound(SoundID.Item41, projectile.Center); //Snap + SoundEngine.PlaySound(SoundID.Item41, Projectile.Center); //Snap HasSnapped = 1f; SnapCoyoteTime = coyoteTimeFrames; } if (SnapCoyoteTime > 0) //keep checking for the tile hook { - Lighting.AddLight(projectile.Center, 0.8f, 1f, 0.35f); + Lighting.AddLight(Projectile.Center, 0.8f, 1f, 0.35f); HookToTile(); SnapCoyoteTime--; } - Owner.direction = Math.Sign(projectile.velocity.X); - projectile.rotation = projectile.AngleFrom(Owner.Center); //Point away from playah + Owner.direction = Math.Sign(Projectile.velocity.X); + Projectile.rotation = Projectile.AngleFrom(Owner.Center); //Point away from playah float ratio = GetSwingRatio(); - projectile.Center = Owner.MountedCenter + SwingPosition(ratio); - projectile.direction = projectile.spriteDirection = -Owner.direction; + Projectile.Center = Owner.MountedCenter + SwingPosition(ratio); + Projectile.direction = Projectile.spriteDirection = -Owner.direction; Owner.itemRotation = MathHelper.WrapAngle(Owner.AngleTo(Owner.Calamity().mouseWorld) - (Owner.direction < 0 ? MathHelper.Pi : 0)); } @@ -138,12 +139,12 @@ namespace CalamityMod.Projectiles.Melee if (Main.myPlayer == Owner.whoAmI) { //Shmoove the player if a tile is hit. This movement always happens if the owner isnt on the ground, but will only happen if the projectile is above the player if they are standing on the ground) - if (Collision.SolidCollision(projectile.position, 32, 32) && (Owner.velocity.Y != 0 || projectile.position.Y < Owner.position.Y)) + if (Collision.SolidCollision(Projectile.position, 32, 32) && (Owner.velocity.Y != 0 || Projectile.position.Y < Owner.position.Y)) { - Owner.velocity = Owner.SafeDirectionTo(projectile.Center, Vector2.Zero) * ReelBackStrenght; + Owner.velocity = Owner.SafeDirectionTo(Projectile.Center, Vector2.Zero) * ReelBackStrenght; SnapCoyoteTime = 0f; } - Main.PlaySound(SoundID.Item65, projectile.position); + SoundEngine.PlaySound(SoundID.Item65, Projectile.position); } } @@ -169,12 +170,12 @@ namespace CalamityMod.Projectiles.Melee float angleDeviation = MathHelper.Pi / 1.2f; float angleOffset = Owner.direction * MathHelper.Lerp(-angleDeviation, 0, progress); //Go from very angled to straight at the zenith of the attack - return projectile.velocity.RotatedBy(angleOffset) * distance; + return Projectile.velocity.RotatedBy(angleOffset) * distance; } else { float distance = MathHelper.Lerp(Reach, 0f, progress); //Quickly zip back to the player . No angles or minimum distance from player. - return projectile.velocity * distance; + return Projectile.velocity * distance; } } @@ -185,25 +186,25 @@ namespace CalamityMod.Projectiles.Melee Texture2D handle = GetTexture("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchBlade"); Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchGlow"); - Vector2 projBottom = projectile.Center + new Vector2(-handle.Width / 2, handle.Height / 2).RotatedBy(projectile.rotation + MathHelper.PiOver4) * 0.75f; + Vector2 projBottom = Projectile.Center + new Vector2(-handle.Width / 2, handle.Height / 2).RotatedBy(Projectile.rotation + MathHelper.PiOver4) * 0.75f; DrawChain(spriteBatch, projBottom, out Vector2[] chainPositions); float drawRotation = (projBottom - chainPositions[chainPositions.Length - 2]).ToRotation() + MathHelper.PiOver4; //Face away from the last point of the bezier curve drawRotation += SnapCoyoteTime > 0 ? MathHelper.Pi : 0; //During coyote time the blade flips for some reason. Prevent that from happening - drawRotation += projectile.spriteDirection < 0 ? 0f : 0f; + drawRotation += Projectile.spriteDirection < 0 ? 0f : 0f; Vector2 drawOrigin = new Vector2(0f, handle.Height); - SpriteEffects flip = (projectile.spriteDirection < 0) ? SpriteEffects.None : SpriteEffects.None; - lightColor = Lighting.GetColor((int)(projectile.Center.X / 16f), (int)(projectile.Center.Y / 16f)); + SpriteEffects flip = (Projectile.spriteDirection < 0) ? SpriteEffects.None : SpriteEffects.None; + lightColor = Lighting.GetColor((int)(Projectile.Center.X / 16f), (int)(Projectile.Center.Y / 16f)); - spriteBatch.Draw(handle, projBottom - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, projectile.scale, flip, 0f); + spriteBatch.Draw(handle, projBottom - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f); //Turn on additive blending spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Only update the origin for once drawOrigin = new Vector2(0f, blade.Height); - spriteBatch.Draw(blade, projBottom - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale, flip, 0f); + spriteBatch.Draw(blade, projBottom - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, flip, 0f); //Back to normal spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs b/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs index b89cdbc638..33b48289ee 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs @@ -6,6 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -17,52 +18,52 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Purity Projection"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = projectile.height = 32; - projectile.aiStyle = 27; + Projectile.width = Projectile.height = 32; + Projectile.aiStyle = 27; aiType = ProjectileID.LightBeam; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 40; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 40; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override void AI() { - if (projectile.timeLeft < 35) - projectile.tileCollide = true; + if (Projectile.timeLeft < 35) + Projectile.tileCollide = true; - Lighting.AddLight(projectile.Center, 0.75f, 1f, 0.24f); - int dustParticle = Dust.NewDust(projectile.position, projectile.width, projectile.height, 75, 0f, 0f, 100, default, 0.9f); + Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); + int dustParticle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 0.9f); Main.dust[dustParticle].noGravity = true; Main.dust[dustParticle].velocity *= 0.5f; - Main.dust[dustParticle].velocity += projectile.velocity * 0.1f; + Main.dust[dustParticle].velocity += Projectile.velocity * 0.1f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 35) + if (Projectile.timeLeft > 35) return false; - DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item43, projectile.Center); + SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); for (int i = 0; i <= 15; i++) { - Vector2 displace = (projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f; - int dustParticle = Dust.NewDust(projectile.Center + displace, projectile.width, projectile.height, 75, 0f, 0f, 100, default, 2f); + Vector2 displace = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f; + int dustParticle = Dust.NewDust(Projectile.Center + displace, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 2f); Main.dust[dustParticle].noGravity = true; - Main.dust[dustParticle].velocity = projectile.oldVelocity; + Main.dust[dustParticle].velocity = Projectile.oldVelocity; } } diff --git a/Projectiles/Melee/BurningMeteor.cs b/Projectiles/Melee/BurningMeteor.cs index 997bc3497e..401714c54c 100644 --- a/Projectiles/Melee/BurningMeteor.cs +++ b/Projectiles/Melee/BurningMeteor.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -13,22 +14,22 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Meteor"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 46; - projectile.height = 46; - projectile.alpha = 150; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 180; - projectile.ignoreWater = true; + Projectile.width = 46; + Projectile.height = 46; + Projectile.alpha = 150; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 180; + Projectile.ignoreWater = true; } public override void AI() @@ -37,51 +38,51 @@ namespace CalamityMod.Projectiles.Melee noTileHitCounter -= randomToSubtract; if (noTileHitCounter == 0) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 30f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } - projectile.alpha -= 15; + Projectile.alpha -= 15; int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) + if (Projectile.Center.Y >= Projectile.ai[1]) { num58 = 0; } - if (projectile.alpha < num58) + if (Projectile.alpha < num58) { - projectile.alpha = num58; + Projectile.alpha = num58; } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, 0f, 0f); } } @@ -92,10 +93,10 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 175) + if (Projectile.timeLeft > 175) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/CalamityAura.cs b/Projectiles/Melee/CalamityAura.cs index f0255e6183..e45120d189 100644 --- a/Projectiles/Melee/CalamityAura.cs +++ b/Projectiles/Melee/CalamityAura.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,12 +17,12 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 80; - projectile.melee = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 80; + Projectile.DamageType = DamageClass.Melee; } public override void AI() @@ -29,18 +30,18 @@ namespace CalamityMod.Projectiles.Melee for (int num151 = 0; num151 < 3; num151++) { int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 73, 0f, 0f, 100, default, 1.35f); + int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 73, 0f, 0f, 100, default, 1.35f); Main.dust[num155].noGravity = true; Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; + Main.dust[num155].velocity += Projectile.velocity * 0.5f; } if (Main.rand.NextBool(8)) { int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 73, 0f, 0f, 100, default, 1f); + int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 73, 0f, 0f, 100, default, 1f); Main.dust[num157].velocity *= 0.25f; Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += projectile.velocity * 0.5f; + Main.dust[num157].velocity += Projectile.velocity * 0.5f; } } @@ -55,29 +56,29 @@ namespace CalamityMod.Projectiles.Melee float num50 = 1.7f; float num51 = 0.8f; float num52 = 2f; - Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Vector2 value3 = (Projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); int num3; for (int num53 = 0; num53 < 40; num53 = num3 + 1) { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 200, default, num50); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 200, default, num50); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 3f; dust = Main.dust[num54]; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, num51); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; Main.dust[num54].noGravity = true; @@ -89,8 +90,8 @@ namespace CalamityMod.Projectiles.Melee } for (int num55 = 0; num55 < 20; num55 = num3 + 1) { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 0, default, num52); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; dust.velocity *= 0.5f; diff --git a/Projectiles/Melee/CalamityAuraType2.cs b/Projectiles/Melee/CalamityAuraType2.cs index 865bf25ebf..623b975bf1 100644 --- a/Projectiles/Melee/CalamityAuraType2.cs +++ b/Projectiles/Melee/CalamityAuraType2.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,12 +17,12 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 80; - projectile.melee = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 80; + Projectile.DamageType = DamageClass.Melee; } public override void AI() @@ -29,18 +30,18 @@ namespace CalamityMod.Projectiles.Melee for (int num151 = 0; num151 < 3; num151++) { int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 56, 0f, 0f, 100, default, 1.35f); + int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 56, 0f, 0f, 100, default, 1.35f); Main.dust[num155].noGravity = true; Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; + Main.dust[num155].velocity += Projectile.velocity * 0.5f; } if (Main.rand.NextBool(8)) { int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 56, 0f, 0f, 100, default, 1f); + int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 56, 0f, 0f, 100, default, 1f); Main.dust[num157].velocity *= 0.25f; Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += projectile.velocity * 0.5f; + Main.dust[num157].velocity += Projectile.velocity * 0.5f; } } @@ -55,29 +56,29 @@ namespace CalamityMod.Projectiles.Melee float num50 = 1.7f; float num51 = 0.8f; float num52 = 2f; - Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Vector2 value3 = (Projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); int num3; for (int num53 = 0; num53 < 40; num53 = num3 + 1) { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 200, default, num50); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 200, default, num50); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 3f; dust = Main.dust[num54]; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, num51); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; Main.dust[num54].noGravity = true; @@ -89,8 +90,8 @@ namespace CalamityMod.Projectiles.Melee } for (int num55 = 0; num55 < 20; num55 = num3 + 1) { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 0, default, num52); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; dust.velocity *= 0.5f; diff --git a/Projectiles/Melee/CalamityAuraType3.cs b/Projectiles/Melee/CalamityAuraType3.cs index 744c041c80..03615463a4 100644 --- a/Projectiles/Melee/CalamityAuraType3.cs +++ b/Projectiles/Melee/CalamityAuraType3.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,12 +17,12 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 80; - projectile.melee = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 80; + Projectile.DamageType = DamageClass.Melee; } public override void AI() @@ -29,18 +30,18 @@ namespace CalamityMod.Projectiles.Melee for (int num151 = 0; num151 < 3; num151++) { int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 57, 0f, 0f, 100, default, 1.35f); + int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 57, 0f, 0f, 100, default, 1.35f); Main.dust[num155].noGravity = true; Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; + Main.dust[num155].velocity += Projectile.velocity * 0.5f; } if (Main.rand.NextBool(8)) { int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 57, 0f, 0f, 100, default, 1f); + int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 57, 0f, 0f, 100, default, 1f); Main.dust[num157].velocity *= 0.25f; Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += projectile.velocity * 0.5f; + Main.dust[num157].velocity += Projectile.velocity * 0.5f; } } @@ -55,29 +56,29 @@ namespace CalamityMod.Projectiles.Melee float num50 = 1.7f; float num51 = 0.8f; float num52 = 2f; - Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Vector2 value3 = (Projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); int num3; for (int num53 = 0; num53 < 40; num53 = num3 + 1) { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 200, default, num50); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 57, 0f, 0f, 200, default, num50); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 3f; dust = Main.dust[num54]; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 57, 0f, 0f, 100, default, num51); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; Main.dust[num54].noGravity = true; @@ -89,8 +90,8 @@ namespace CalamityMod.Projectiles.Melee } for (int num55 = 0; num55 < 20; num55 = num3 + 1) { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 57, 0f, 0f, 0, default, num52); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; dust.velocity *= 0.5f; diff --git a/Projectiles/Melee/ChaosFlameLarge.cs b/Projectiles/Melee/ChaosFlameLarge.cs index 83aa0cc49b..bd3b42e6e1 100644 --- a/Projectiles/Melee/ChaosFlameLarge.cs +++ b/Projectiles/Melee/ChaosFlameLarge.cs @@ -11,38 +11,38 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.aiStyle = 44; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 28; + Projectile.height = 28; + Projectile.aiStyle = 44; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; aiType = ProjectileID.SporeCloud; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - Lighting.AddLight(projectile.Center, 0.4f, 0f, 0f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Lighting.AddLight(Projectile.Center, 0.4f, 0f, 0f); if (Main.rand.NextBool(4)) { - int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f); + int num469 = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); + int num469 = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, 0f, 0f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 53, projectile.alpha); + return new Color(255, Main.DiscoG, 53, Projectile.alpha); } } } diff --git a/Projectiles/Melee/ChaosFlameSmall.cs b/Projectiles/Melee/ChaosFlameSmall.cs index c843b762c1..b499d064bd 100644 --- a/Projectiles/Melee/ChaosFlameSmall.cs +++ b/Projectiles/Melee/ChaosFlameSmall.cs @@ -10,38 +10,38 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.aiStyle = 44; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 16; + Projectile.height = 16; + Projectile.aiStyle = 44; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; aiType = ProjectileID.SporeCloud; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = projectile.velocity.ToRotation(); - Lighting.AddLight(projectile.Center, 0.4f, 0f, 0f); + Projectile.rotation = Projectile.velocity.ToRotation(); + Lighting.AddLight(Projectile.Center, 0.4f, 0f, 0f); if (Main.rand.NextBool(4)) { - int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f); + int num469 = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - int num469 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); + int num469 = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, 0f, 0f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 53, projectile.alpha); + return new Color(255, Main.DiscoG, 53, Projectile.alpha); } } } diff --git a/Projectiles/Melee/ClamCrusherFlail.cs b/Projectiles/Melee/ClamCrusherFlail.cs index c601ca5883..2482768298 100644 --- a/Projectiles/Melee/ClamCrusherFlail.cs +++ b/Projectiles/Melee/ClamCrusherFlail.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class ClamCrusherFlail : ModProjectile @@ -17,118 +18,118 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 58; - projectile.height = 74; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.alpha = 255; - projectile.tileCollide = false; + Projectile.width = 58; + Projectile.height = 74; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 255; + Projectile.tileCollide = false; } public override void AI() { - projectile.ai[1] += 1f; - if (projectile.ai[1] == 1f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] == 1f) { - finalDamage = projectile.damage * 4; + finalDamage = Projectile.damage * 4; } - if (projectile.ai[1] >= 5f && (projectile.ai[1] <= 10f)) + if (Projectile.ai[1] >= 5f && (Projectile.ai[1] <= 10f)) { for (int num105 = 0; num105 < 10; num105++) { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; + float num99 = Projectile.velocity.X / 3f * (float)num105; + float num100 = Projectile.velocity.Y / 3f * (float)num105; int num101 = 4; - int waterDust = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); + int waterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)num101, Projectile.position.Y + (float)num101), Projectile.width - num101 * 2, Projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); Dust waterdust = Main.dust[waterDust]; waterdust.noGravity = true; waterdust.velocity *= 0.1f; - waterdust.velocity += projectile.velocity * 0.1f; + waterdust.velocity += Projectile.velocity * 0.1f; waterdust.position.X -= num99; waterdust.position.Y -= num100; } } - if (projectile.ai[1] == 5f) + if (Projectile.ai[1] == 5f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; - projectile.rotation = vector62.ToRotation() - 1.57f; - if (Main.player[projectile.owner].dead) + Vector2 vector62 = Main.player[Projectile.owner].Center - Projectile.Center; + Projectile.rotation = vector62.ToRotation() - 1.57f; + if (Main.player[Projectile.owner].dead) { - projectile.Kill(); + Projectile.Kill(); return; } - Main.player[projectile.owner].itemAnimation = 10; - Main.player[projectile.owner].itemTime = 10; + Main.player[Projectile.owner].itemAnimation = 10; + Main.player[Projectile.owner].itemTime = 10; if (vector62.X < 0f) { - Main.player[projectile.owner].ChangeDir(1); - projectile.direction = 1; + Main.player[Projectile.owner].ChangeDir(1); + Projectile.direction = 1; } else { - Main.player[projectile.owner].ChangeDir(-1); - projectile.direction = -1; + Main.player[Projectile.owner].ChangeDir(-1); + Projectile.direction = -1; } - Main.player[projectile.owner].itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); - projectile.spriteDirection = (vector62.X > 0f) ? -1 : 1; - if (projectile.ai[1] >= 45f && (projectile.ai[0] != 1f || projectile.ai[0] != 2f)) + Main.player[Projectile.owner].itemRotation = (vector62 * -1f * (float)Projectile.direction).ToRotation(); + Projectile.spriteDirection = (vector62.X > 0f) ? -1 : 1; + if (Projectile.ai[1] >= 45f && (Projectile.ai[0] != 1f || Projectile.ai[0] != 2f)) { - projectile.velocity.Y += 1f; - projectile.velocity.X *= 0.995f; - projectile.damage = finalDamage; + Projectile.velocity.Y += 1f; + Projectile.velocity.X *= 0.995f; + Projectile.damage = finalDamage; } - if (projectile.ai[0] == 0f && vector62.Length() > 1000f) + if (Projectile.ai[0] == 0f && vector62.Length() > 1000f) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } - if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) + if (Projectile.ai[0] == 1f || Projectile.ai[0] == 2f) { float num693 = vector62.Length(); if (num693 > 1500f) { - projectile.Kill(); + Projectile.Kill(); return; } if (num693 > 600f) { - projectile.ai[0] = 2f; + Projectile.ai[0] = 2f; } - projectile.tileCollide = false; + Projectile.tileCollide = false; float num694 = 20f; - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { num694 = 40f; } - projectile.velocity = Vector2.Normalize(vector62) * num694; + Projectile.velocity = Vector2.Normalize(vector62) * num694; if (vector62.Length() < num694) { - projectile.Kill(); + Projectile.Kill(); return; } } - projectile.ai[1] += 1f; - if (projectile.ai[1] > 5f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 5f) { - projectile.alpha = 0; + Projectile.alpha = 0; } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.ai[1] >= 5f) + if (Projectile.ai[1] >= 5f) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - projectile.ai[0] = 1f; - projectile.netUpdate = true; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)projectile.position.X, (int)projectile.position.Y); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)Projectile.position.X, (int)Projectile.position.Y); for (int num105 = 0; num105 < 50; num105++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int waterDust = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width / 2, projectile.height / 2, 33, velocity.X, velocity.Y, 0, new Color(0, 142, 255), 1.5f); + int waterDust = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width / 2, Projectile.height / 2, 33, velocity.X, velocity.Y, 0, new Color(0, 142, 255), 1.5f); Main.dust[waterDust].velocity *= 2f; } } @@ -137,10 +138,10 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = ModContent.GetTexture("CalamityMod/ExtraTextures/Chains/ClamCrusherChain"); - Vector2 vector17 = projectile.Center; + Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/ClamCrusherChain"); + Vector2 vector17 = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); float num91 = (float)texture2D2.Height; @@ -176,14 +177,14 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.ai[1] >= 45f && (projectile.ai[0] != 1f || projectile.ai[0] != 2f)) + if (Projectile.ai[1] >= 45f && (Projectile.ai[0] != 1f || Projectile.ai[0] != 2f)) target.AddBuff(ModContent.BuffType(), 120); else target.AddBuff(ModContent.BuffType(), 60); - projectile.ai[0] = 1f; - projectile.netUpdate = true; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)projectile.position.X, (int)projectile.position.Y); + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)Projectile.position.X, (int)Projectile.position.Y); } } } diff --git a/Projectiles/Melee/CometQuasherMeteor.cs b/Projectiles/Melee/CometQuasherMeteor.cs index ae9034b638..fb8be47163 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class CometQuasherMeteor : ModProjectile @@ -10,70 +11,70 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Meteor"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.extraUpdates = 2; + Projectile.width = 24; + Projectile.height = 24; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.extraUpdates = 2; aiType = ProjectileID.Meteor1; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - if (projectile.Calamity().lineColor == 1) - tex = ModContent.GetTexture("CalamityMod/Projectiles/Melee/CometQuasherMeteor2"); - if (projectile.Calamity().lineColor == 2) - tex = ModContent.GetTexture("CalamityMod/Projectiles/Melee/CometQuasherMeteor3"); + Texture2D tex = Main.projectileTexture[Projectile.type]; + if (Projectile.Calamity().lineColor == 1) + tex = ModContent.Request("CalamityMod/Projectiles/Melee/CometQuasherMeteor2"); + if (Projectile.Calamity().lineColor == 2) + tex = ModContent.Request("CalamityMod/Projectiles/Melee/CometQuasherMeteor3"); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, tex); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, tex); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item89, projectile.position); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(128f * projectile.scale)); + SoundEngine.PlaySound(SoundID.Item89, Projectile.position); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, (int)(128f * Projectile.scale)); for (int index = 0; index < 8; ++index) - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); for (int index1 = 0; index1 < 32; ++index1) { - int index2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 2.5f); + int index2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 2.5f); Dust dust1 = Main.dust[index2]; dust1.noGravity = true; dust1.velocity *= 3f; - int index3 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 1.5f); + int index3 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust2 = Main.dust[index3]; dust2.velocity *= 2f; dust2.noGravity = true; } for (int index1 = 0; index1 < 2; ++index1) { - int index2 = Gore.NewGore(projectile.position + new Vector2((float) (projectile.width * Main.rand.Next(100)) / 100f, (float) (projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f); + int index2 = Gore.NewGore(Projectile.position + new Vector2((float) (Projectile.width * Main.rand.Next(100)) / 100f, (float) (Projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f); Gore gore = Main.gore[index2]; gore.velocity *= 0.3f; gore.velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f; gore.velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.localAI[1] = -1f; - projectile.maxPenetrate = 0; - projectile.Damage(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.localAI[1] = -1f; + Projectile.maxPenetrate = 0; + Projectile.Damage(); } for (int index1 = 0; index1 < 5; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, Utils.SelectRandom(Main.rand, new int[3]{ DustID.Fire, 259, 158 }), 2.5f * (float) projectile.direction, -2.5f, 0, new Color(), 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Utils.SelectRandom(Main.rand, new int[3]{ DustID.Fire, 259, 158 }), 2.5f * (float) Projectile.direction, -2.5f, 0, new Color(), 1f); Dust dust1 = Main.dust[index2]; dust1.alpha = 200; dust1.velocity *= 2.4f; diff --git a/Projectiles/Melee/CosmicBolt.cs b/Projectiles/Melee/CosmicBolt.cs index 7609b35b86..1aa6d98e94 100644 --- a/Projectiles/Melee/CosmicBolt.cs +++ b/Projectiles/Melee/CosmicBolt.cs @@ -14,29 +14,29 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 180; - projectile.melee = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.extraUpdates = 100; + Projectile.friendly = true; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int i = 0; i < 2; i++) { - Vector2 spawnPos = projectile.position; - spawnPos -= projectile.velocity * ((float)i * 0.25f); - projectile.alpha = 255; + Vector2 spawnPos = Projectile.position; + spawnPos -= Projectile.velocity * ((float)i * 0.25f); + Projectile.alpha = 255; int d = Dust.NewDust(spawnPos, 1, 1, 242, 0f, 0f, 0, default, 1.3f); Dust dust = Main.dust[d]; dust.position = spawnPos; - dust.position.X += (float)(projectile.width / 2); - dust.position.Y += (float)(projectile.height / 2); + dust.position.X += (float)(Projectile.width / 2); + dust.position.Y += (float)(Projectile.height / 2); dust.scale = Main.rand.NextFloat(0.49f, 0.763f); dust.velocity *= 0.2f; dust.noGravity = true; diff --git a/Projectiles/Melee/CosmicDischargeFlail.cs b/Projectiles/Melee/CosmicDischargeFlail.cs index 1e39828386..aea39e7fd4 100644 --- a/Projectiles/Melee/CosmicDischargeFlail.cs +++ b/Projectiles/Melee/CosmicDischargeFlail.cs @@ -19,18 +19,18 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.coldDamage = true; - projectile.extraUpdates = 1; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; + Projectile.coldDamage = true; + Projectile.extraUpdates = 1; } public override Color SpecialDrawColor => new Color(150, 255, 255); @@ -47,19 +47,19 @@ namespace CalamityMod.Projectiles.Melee //All of this wouldnt be here if depthLayer fucking worked, i wanna hit someone - Shucks public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Color colorAtCenter = Lighting.GetColor((int)(projectile.position.X + projectile.width * 0.5) / 16, - (int)((projectile.position.Y + projectile.height * 0.5) / 16.0)); - if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; + Color colorAtCenter = Lighting.GetColor((int)(Projectile.position.X + Projectile.width * 0.5) / 16, + (int)((Projectile.position.Y + Projectile.height * 0.5) / 16.0)); + if (Projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[Projectile.type]) { colorAtCenter = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); } - Color drawColor = projectile.GetAlpha(colorAtCenter); - float speed = projectile.velocity.Length() + 16f - 40f * projectile.scale; - Vector2 normalizedVelocity = Vector2.Normalize(projectile.velocity); + Color drawColor = Projectile.GetAlpha(colorAtCenter); + float speed = Projectile.velocity.Length() + 16f - 40f * Projectile.scale; + Vector2 normalizedVelocity = Vector2.Normalize(Projectile.velocity); Rectangle type1BodyFrame = new Rectangle(0, BodyType1StartY, FlailTexture.Width, BodyType1SectionHeight); - Vector2 bodyDrawPosition = projectile.Center.Floor(); - bodyDrawPosition += normalizedVelocity * projectile.scale * 33f; + Vector2 bodyDrawPosition = Projectile.Center.Floor(); + bodyDrawPosition += normalizedVelocity * Projectile.scale * 33f; if (speed > 0f) { @@ -71,16 +71,16 @@ namespace CalamityMod.Projectiles.Melee type1BodyFrame.Height = (int)(speed - counter); } Main.spriteBatch.Draw(FlailTexture, - bodyDrawPosition - Main.screenPosition + Vector2.UnitY * Main.player[projectile.owner].gfxOffY, + bodyDrawPosition - Main.screenPosition + Vector2.UnitY * Main.player[Projectile.owner].gfxOffY, new Microsoft.Xna.Framework.Rectangle?(type1BodyFrame), drawColor, - projectile.rotation + MathHelper.Pi, + Projectile.rotation + MathHelper.Pi, new Vector2((float)(type1BodyFrame.Width / 2), 0f), - projectile.scale, + Projectile.scale, SpriteEffects.None, 0.6f); - counter += type1BodyFrame.Height * projectile.scale; - bodyDrawPosition += normalizedVelocity * (float)type1BodyFrame.Height * projectile.scale; + counter += type1BodyFrame.Height * Projectile.scale; + bodyDrawPosition += normalizedVelocity * (float)type1BodyFrame.Height * Projectile.scale; } } } @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Melee return true; } float num8 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity, 16f * Projectile.scale, ref num8)) { return true; } @@ -101,15 +101,15 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; target.AddBuff(BuffID.Frostburn, 180); target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 60); - if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) + if (Projectile.localAI[1] <= 0f && Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, 10f, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); } - projectile.localAI[1] = 4f; + Projectile.localAI[1] = 4f; player.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Melee/CosmicIceBurst.cs b/Projectiles/Melee/CosmicIceBurst.cs index 93401e6fa1..3394e6c147 100644 --- a/Projectiles/Melee/CosmicIceBurst.cs +++ b/Projectiles/Melee/CosmicIceBurst.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -12,83 +13,83 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Ice"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.timeLeft = 60; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.coldDamage = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.timeLeft = 60; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; + Projectile.coldDamage = true; } public override void AI() { - projectile.ai[1] += 0.01f; - projectile.scale = projectile.ai[1]; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= (float)(3 * Main.projFrames[projectile.type])) + Projectile.ai[1] += 0.01f; + Projectile.scale = Projectile.ai[1]; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= (float)(3 * Main.projFrames[Projectile.type])) { - projectile.Kill(); + Projectile.Kill(); return; } - if (++projectile.frameCounter >= 3) + if (++Projectile.frameCounter >= 3) { - projectile.frameCounter = 0; - if (++projectile.frame >= Main.projFrames[projectile.type]) + Projectile.frameCounter = 0; + if (++Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.hide = true; + Projectile.hide = true; } } - projectile.alpha -= 63; - if (projectile.alpha < 0) + Projectile.alpha -= 63; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - Lighting.AddLight(projectile.Center, 0.517f, (float)Main.DiscoG / 300f, 0.85f); - if (projectile.ai[0] == 1f) + Lighting.AddLight(Projectile.Center, 0.517f, (float)Main.DiscoG / 300f, 0.85f); + if (Projectile.ai[0] == 1f) { - projectile.position = projectile.Center; - projectile.width = projectile.height = (int)(52f * projectile.scale); - projectile.Center = projectile.position; - projectile.Damage(); - Main.PlaySound(SoundID.Item62, projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = (int)(52f * Projectile.scale); + Projectile.Center = Projectile.position; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item62, Projectile.position); for (int num1000 = 0; num1000 < 2; num1000++) { - int num1001 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, new Color(150, 255, 255), 1f); - Main.dust[num1001].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num1001 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, new Color(150, 255, 255), 1f); + Main.dust[num1001].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; } for (int num1002 = 0; num1002 < 3; num1002++) { - int num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 200, new Color(150, 255, 255), 1f); - Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num1003 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 200, new Color(150, 255, 255), 1f); + Main.dust[num1003].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[num1003].noGravity = true; Main.dust[num1003].velocity *= 3f; - num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, new Color(150, 255, 255), 0.6f); - Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num1003 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, new Color(150, 255, 255), 0.6f); + Main.dust[num1003].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[num1003].velocity *= 2f; Main.dust[num1003].noGravity = true; Main.dust[num1003].fadeIn = 2.5f; } for (int num1004 = 0; num1004 < 2; num1004++) { - int num1005 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 0, new Color(150, 255, 255), 1f); - Main.dust[num1005].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + int num1005 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 0, new Color(150, 255, 255), 1f); + Main.dust[num1005].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; Main.dust[num1005].noGravity = true; Main.dust[num1005].velocity *= 3f; } for (int num1006 = 0; num1006 < 3; num1006++) { - int num1007 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 0, new Color(150, 255, 255), 0.6f); - Main.dust[num1007].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + int num1007 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 0, new Color(150, 255, 255), 0.6f); + Main.dust[num1007].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; Main.dust[num1007].noGravity = true; Main.dust[num1007].velocity *= 3f; } @@ -97,16 +98,16 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + if (Projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[Projectile.type]) { color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); } - Vector2 vector42 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D33 = Main.projectileTexture[projectile.type]; - Rectangle rectangle15 = texture2D33.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Color alpha5 = projectile.GetAlpha(color25); + Vector2 vector42 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D33 = Main.projectileTexture[Projectile.type]; + Rectangle rectangle15 = texture2D33.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alpha5 = Projectile.GetAlpha(color25); Vector2 origin11 = rectangle15.Size() / 2f; return true; } @@ -120,14 +121,14 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(BuffID.Frostburn, 180); target.AddBuff(ModContent.BuffType(), 180); - projectile.direction = Main.player[projectile.owner].direction; + Projectile.direction = Main.player[Projectile.owner].direction; } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Frostburn, 180); target.AddBuff(ModContent.BuffType(), 180); - projectile.direction = Main.player[projectile.owner].direction; + Projectile.direction = Main.player[Projectile.owner].direction; } } } diff --git a/Projectiles/Melee/CosmicOrb.cs b/Projectiles/Melee/CosmicOrb.cs index 100c3a82e4..31cbe7c94e 100644 --- a/Projectiles/Melee/CosmicOrb.cs +++ b/Projectiles/Melee/CosmicOrb.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,57 +15,57 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.extraUpdates = 0; - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.extraUpdates = 0; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, new Vector3(0.075f, 0.5f, 0.15f)); + Lighting.AddLight(Projectile.Center, new Vector3(0.075f, 0.5f, 0.15f)); - projectile.velocity *= 0.985f; - projectile.rotation += projectile.velocity.X * 0.2f; + Projectile.velocity *= 0.985f; + Projectile.rotation += Projectile.velocity.X * 0.2f; - if (projectile.velocity.X > 0f) + if (Projectile.velocity.X > 0f) { - projectile.rotation += 0.08f; + Projectile.rotation += 0.08f; } else { - projectile.rotation -= 0.08f; + Projectile.rotation -= 0.08f; } - projectile.ai[1] += 1f; - if (projectile.ai[1] > 30f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 30f) { - projectile.alpha += 10; - if (projectile.alpha >= 255) + Projectile.alpha += 10; + if (Projectile.alpha >= 255) { - projectile.alpha = 255; - projectile.Kill(); + Projectile.alpha = 255; + Projectile.Kill(); return; } } - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 8f, 5, ModContent.ProjectileType()); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 6f, 8f, 5, ModContent.ProjectileType()); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); for (int i = 0; i < 10; i++) { - int num192 = (int)(10f * projectile.scale); - int d = Dust.NewDust(projectile.Center - Vector2.One * (float)num192, num192 * 2, num192 * 2, 242, 0f, 0f, 0, default, 1f); + int num192 = (int)(10f * Projectile.scale); + int d = Dust.NewDust(Projectile.Center - Vector2.One * (float)num192, num192 * 2, num192 * 2, 242, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[d]; - Vector2 offset = Vector2.Normalize(dust.position - projectile.Center); - dust.position = projectile.Center + offset * (float)num192 * projectile.scale; + Vector2 offset = Vector2.Normalize(dust.position - Projectile.Center); + dust.position = Projectile.Center + offset * (float)num192 * Projectile.scale; if (i < 30) { dust.velocity = offset * dust.velocity.Length(); @@ -82,7 +83,7 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) { - return new Color(200 - projectile.alpha, 200 - projectile.alpha, 200 - projectile.alpha, 200 - projectile.alpha); + return new Color(200 - Projectile.alpha, 200 - Projectile.alpha, 200 - Projectile.alpha, 200 - Projectile.alpha); } } } diff --git a/Projectiles/Melee/CosmicShivBall.cs b/Projectiles/Melee/CosmicShivBall.cs index 0968618edf..df2388f61f 100644 --- a/Projectiles/Melee/CosmicShivBall.cs +++ b/Projectiles/Melee/CosmicShivBall.cs @@ -25,51 +25,51 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 220; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 220; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override void AI() { if (!initialized) { - target = projectile.Center.ClosestNPCAt(maxDistanceToTarget); - startingVelocityY = projectile.velocity.Y; + target = Projectile.Center.ClosestNPCAt(maxDistanceToTarget); + startingVelocityY = Projectile.velocity.Y; randomAngleDelta = Main.rand.NextFloat(0f, MathHelper.TwoPi); initialized = true; } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int i = 0; i < 3; i++) { - int dustID = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, (float)(projectile.direction * 2), 0f, 115, Color.White, 1.3f); + int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, (float)(Projectile.direction * 2), 0f, 115, Color.White, 1.3f); Main.dust[dustID].noGravity = true; Main.dust[dustID].velocity *= 0f; } - projectile.velocity.Y *= 0.965f; + Projectile.velocity.Y *= 0.965f; } - if (projectile.localAI[0] % 30 == 0) // every 0.5 seconds + if (Projectile.localAI[0] % 30 == 0) // every 0.5 seconds { - target = projectile.Center.ClosestNPCAt(maxDistanceToTarget); + target = Projectile.Center.ClosestNPCAt(maxDistanceToTarget); } if (target != null) { float inertia = 35f; float homingSpeed = 33.5f; - Vector2 idealVelocity = projectile.SafeDirectionTo(target.Center, Vector2.UnitX) * homingSpeed; - projectile.velocity = (projectile.velocity * (inertia - 1f) + idealVelocity) / inertia; + Vector2 idealVelocity = Projectile.SafeDirectionTo(target.Center, Vector2.UnitX) * homingSpeed; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + idealVelocity) / inertia; } else { - projectile.ai[0]++; - projectile.velocity.Y = startingVelocityY + (float)(Math.Cos(projectile.ai[0] / 12D + randomAngleDelta) * 7D); + Projectile.ai[0]++; + Projectile.velocity.Y = startingVelocityY + (float)(Math.Cos(Projectile.ai[0] / 12D + randomAngleDelta) * 7D); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -78,9 +78,9 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { int directionSign = Main.rand.NextBool(2).ToDirectionInt(); - Vector2 spawnPos = new Vector2(target.Center.X + directionSign * 650, projectile.Center.Y + Main.rand.Next(-500, 501)); + Vector2 spawnPos = new Vector2(target.Center.X + directionSign * 650, Projectile.Center.Y + Main.rand.Next(-500, 501)); Vector2 velocity = Vector2.Normalize(target.Center - spawnPos) * 30f; - Projectile.NewProjectile(spawnPos.X, spawnPos.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack * 0.1f, projectile.owner); + Projectile.NewProjectile(spawnPos.X, spawnPos.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.1f, Projectile.owner); } int starMax = Main.rand.Next(6, 11); // 6 to 10 stars for (int i = -starMax / 2; i < starMax / 2; i++) @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee int ySpawnAdditive = Main.rand.Next(-40, 41); Vector2 toSpawn = target.Center - new Vector2(0f, 800f + ySpawnAdditive).RotatedBy(MathHelper.ToRadians(i * 11f / starMax)); Vector2 toTarget = Vector2.Normalize(target.Center - toSpawn) * 35f; - Projectile.NewProjectile(toSpawn, toTarget, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner); + Projectile.NewProjectile(toSpawn, toTarget, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); } target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(BuffID.Frostburn, 60); @@ -99,9 +99,9 @@ namespace CalamityMod.Projectiles.Melee private void CircularDamage(float radius) { - if (projectile.owner != Main.myPlayer) + if (Projectile.owner != Main.myPlayer) return; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; for (int i = 0; i < Main.npc.Length; ++i) { @@ -110,18 +110,18 @@ namespace CalamityMod.Projectiles.Melee continue; // Shock any valid target within range. Check all four corners of their hitbox. - float d1 = Vector2.Distance(projectile.Center, target.Hitbox.TopLeft()); - float d2 = Vector2.Distance(projectile.Center, target.Hitbox.TopRight()); - float d3 = Vector2.Distance(projectile.Center, target.Hitbox.BottomLeft()); - float d4 = Vector2.Distance(projectile.Center, target.Hitbox.BottomRight()); + float d1 = Vector2.Distance(Projectile.Center, target.Hitbox.TopLeft()); + float d2 = Vector2.Distance(Projectile.Center, target.Hitbox.TopRight()); + float d3 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomLeft()); + float d4 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomRight()); float dist = MathHelper.Min(d1, d2); dist = MathHelper.Min(dist, d3); dist = MathHelper.Min(dist, d4); if (dist <= radius) { - int damage = (int)(projectile.damage * explosionDamageMultiplier); - bool crit = Main.rand.Next(100) <= owner.meleeCrit + 4; + int damage = (int)(Projectile.damage * explosionDamageMultiplier); + bool crit = Main.rand.Next(100) <= owner.GetCritChance(DamageClass.Melee) + 4; target.StrikeNPC(damage, 0f, 0, crit, false, false); if (Main.netMode != NetmodeID.SinglePlayer) @@ -139,7 +139,7 @@ namespace CalamityMod.Projectiles.Melee for (float k = 0f; k < MathHelper.TwoPi; k += 0.05f) { Vector2 velocity = k.ToRotationVector2() * (2f + (float)(Math.Sin((double)(rand2PI + k * (float)petalCount)) + 1.0) * speed) * Main.rand.NextFloat(0.95f, 1.05f); - Dust dust = Dust.NewDustPerfect(projectile.Center, 173, new Vector2?(velocity), 0, default, scale); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 173, new Vector2?(velocity), 0, default, scale); dust.customData = 0.025f; } CircularDamage(80f); diff --git a/Projectiles/Melee/CosmicShivBlade.cs b/Projectiles/Melee/CosmicShivBlade.cs index 2ecdbc077d..57c9a6124f 100644 --- a/Projectiles/Melee/CosmicShivBlade.cs +++ b/Projectiles/Melee/CosmicShivBlade.cs @@ -20,58 +20,58 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 42; - projectile.height = 42; - projectile.friendly = true; - projectile.penetrate = penetrateMax; - projectile.tileCollide = false; - projectile.timeLeft = 290; + Projectile.width = 42; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.penetrate = penetrateMax; + Projectile.tileCollide = false; + Projectile.timeLeft = 290; } public override void AI() { if (!initialized) { - startYVelSign = (float)Math.Sign(projectile.velocity.Y) * 0.35f; + startYVelSign = (float)Math.Sign(Projectile.velocity.Y) * 0.35f; initialized = true; } - if (projectile.penetrate == penetrateMax && projectile.timeLeft < 245) + if (Projectile.penetrate == penetrateMax && Projectile.timeLeft < 245) { - projectile.velocity.Y -= startYVelSign; //arc on the X axis (the amount of pressure on this tiny detail made me want to tear my head off) - if (Math.Abs(projectile.velocity.X) < 30f) + Projectile.velocity.Y -= startYVelSign; //arc on the X axis (the amount of pressure on this tiny detail made me want to tear my head off) + if (Math.Abs(Projectile.velocity.X) < 30f) { - projectile.velocity.X *= 1.04f; + Projectile.velocity.X *= 1.04f; } } - if (projectile.velocity.Length() != 0) + if (Projectile.velocity.Length() != 0) { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.Pi / 4; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.Pi / 4; } else { - projectile.rotation += MathHelper.Pi / 6f / (projectile.scale * 2.5f); + Projectile.rotation += MathHelper.Pi / 6f / (Projectile.scale * 2.5f); } - projectile.ai[0]++; - if (projectile.ai[1] >= 0) + Projectile.ai[0]++; + if (Projectile.ai[1] >= 0) { - projectile.ai[1]--; - if (projectile.ai[1] == 0) + Projectile.ai[1]--; + if (Projectile.ai[1] == 0) { - projectile.velocity *= -0.9f; + Projectile.velocity *= -0.9f; } } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.penetrate == penetrateMax) + if (Projectile.penetrate == penetrateMax) { - projectile.damage /= 15; + Projectile.damage /= 15; } else { - projectile.scale += (maxScale - 1) / (float)penetrateMax; + Projectile.scale += (maxScale - 1) / (float)penetrateMax; } - projectile.ai[1] = 5 + Main.rand.Next(-2, 3); - target.immune[projectile.owner] = 0; //so that all blades can hit the enemy + Projectile.ai[1] = 5 + Main.rand.Next(-2, 3); + target.immune[Projectile.owner] = 0; //so that all blades can hit the enemy target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(BuffID.Frostburn, 60); target.AddBuff(ModContent.BuffType(), 60); @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Melee { Vector2 randomCirclePointLerped = Vector2.Lerp(randomCirclePointVector, randomCirclePointRotated, k / 20f); float lerpMultiplier = MathHelper.Lerp(lerpStart, lerpEnd, k / 20f) * 4f; - int dustIndex = Dust.NewDust(projectile.Center, 0, 0, + int dustIndex = Dust.NewDust(Projectile.Center, 0, 0, 173, 0f, 0f, 100, default, 1.1f); Main.dust[dustIndex].velocity *= 0.1f; @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Melee } public override Color? GetAlpha(Color lightColor) { - return new Color(124, Main.DiscoG, 255, projectile.alpha); + return new Color(124, Main.DiscoG, 255, Projectile.alpha); } } } diff --git a/Projectiles/Melee/CosmicSpiritBomb1.cs b/Projectiles/Melee/CosmicSpiritBomb1.cs index 70e6b6364c..b60e79651a 100644 --- a/Projectiles/Melee/CosmicSpiritBomb1.cs +++ b/Projectiles/Melee/CosmicSpiritBomb1.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -15,22 +16,22 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 150; - projectile.melee = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 150; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { float num395 = (float)Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; - projectile.scale = num395 + 0.95f; + Projectile.scale = num395 + 0.95f; - float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; + float num947 = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; if (num947 <= 2f) { num947 = 1f; @@ -66,13 +67,13 @@ namespace CalamityMod.Projectiles.Melee num947 = 2f; } } - projectile.velocity = Vector2.Normalize(Main.player[projectile.owner].Center - projectile.Center) * num947; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + Projectile.velocity = Vector2.Normalize(Main.player[Projectile.owner].Center - Projectile.Center) * num947; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -82,16 +83,16 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 200; + Projectile.height = 200; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 15, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); } } } diff --git a/Projectiles/Melee/CosmicSpiritBomb2.cs b/Projectiles/Melee/CosmicSpiritBomb2.cs index 52fd254d11..3ff12924c6 100644 --- a/Projectiles/Melee/CosmicSpiritBomb2.cs +++ b/Projectiles/Melee/CosmicSpiritBomb2.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -15,22 +16,22 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 150; - projectile.melee = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 150; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { float num395 = (float)Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; - projectile.scale = num395 + 0.95f; + Projectile.scale = num395 + 0.95f; - float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; + float num947 = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; if (num947 <= 2f) { num947 = 1f; @@ -66,13 +67,13 @@ namespace CalamityMod.Projectiles.Melee num947 = 2f; } } - projectile.velocity = Vector2.Normalize(Main.player[projectile.owner].Center - projectile.Center) * num947; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + Projectile.velocity = Vector2.Normalize(Main.player[Projectile.owner].Center - Projectile.Center) * num947; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -82,16 +83,16 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 200; + Projectile.height = 200; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 73, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); } } } diff --git a/Projectiles/Melee/CosmicSpiritBomb3.cs b/Projectiles/Melee/CosmicSpiritBomb3.cs index bd1213e18e..b68867c0a2 100644 --- a/Projectiles/Melee/CosmicSpiritBomb3.cs +++ b/Projectiles/Melee/CosmicSpiritBomb3.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -15,22 +16,22 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 150; - projectile.melee = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 150; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { float num395 = (float)Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; - projectile.scale = num395 + 0.95f; + Projectile.scale = num395 + 0.95f; - float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; + float num947 = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; if (num947 <= 2f) { num947 = 1f; @@ -66,13 +67,13 @@ namespace CalamityMod.Projectiles.Melee num947 = 2f; } } - projectile.velocity = Vector2.Normalize(Main.player[projectile.owner].Center - projectile.Center) * num947; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + Projectile.velocity = Vector2.Normalize(Main.player[Projectile.owner].Center - Projectile.Center) * num947; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -82,16 +83,16 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 200; + Projectile.height = 200; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); } } } diff --git a/Projectiles/Melee/CrescentMoonFlail.cs b/Projectiles/Melee/CrescentMoonFlail.cs index b4059e52e5..d0df81762d 100644 --- a/Projectiles/Melee/CrescentMoonFlail.cs +++ b/Projectiles/Melee/CrescentMoonFlail.cs @@ -17,16 +17,16 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override Color SpecialDrawColor => default; @@ -42,10 +42,10 @@ namespace CalamityMod.Projectiles.Melee public override void ExtraBehavior() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (moonCounter > 0) moonCounter--; - if (moonCounter <= 0 && projectile.owner == Main.myPlayer) + if (moonCounter <= 0 && Projectile.owner == Main.myPlayer) { Vector2 vectorBruh = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; if (player.direction != 1) @@ -57,9 +57,9 @@ namespace CalamityMod.Projectiles.Melee vectorBruh.Y = (float)player.bodyFrame.Height - vectorBruh.Y; } vectorBruh -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; - Vector2 newCenter = player.RotatedRelativePoint(Main.player[projectile.owner].position + vectorBruh, true) + projectile.velocity; - int moonDamage = (int)(projectile.damage * 0.18f); - Projectile.NewProjectile(newCenter.X, newCenter.Y, 0f, 0f, ModContent.ProjectileType(), moonDamage, 0f, projectile.owner, 0f, 0f); + Vector2 newCenter = player.RotatedRelativePoint(Main.player[Projectile.owner].position + vectorBruh, true) + Projectile.velocity; + int moonDamage = (int)(Projectile.damage * 0.18f); + Projectile.NewProjectile(newCenter.X, newCenter.Y, 0f, 0f, ModContent.ProjectileType(), moonDamage, 0f, Projectile.owner, 0f, 0f); moonCounter = 6; } } @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 240); - projectile.localAI[1] = 4f; + Projectile.localAI[1] = 4f; } } } diff --git a/Projectiles/Melee/CrescentMoonProj.cs b/Projectiles/Melee/CrescentMoonProj.cs index c7fd2503b8..8bf36136f6 100644 --- a/Projectiles/Melee/CrescentMoonProj.cs +++ b/Projectiles/Melee/CrescentMoonProj.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,46 +15,46 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Crescent Moon"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 5; - projectile.timeLeft = 180; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.extraUpdates = 1; - projectile.aiStyle = 18; + Projectile.width = 50; + Projectile.height = 50; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 5; + Projectile.timeLeft = 180; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.extraUpdates = 1; + Projectile.aiStyle = 18; aiType = ProjectileID.DeathSickle; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0f, 0.6f); - if (projectile.soundDelay == 0) + Lighting.AddLight(Projectile.Center, 0f, 0f, 0.6f); + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 30 + Main.rand.Next(50); + Projectile.soundDelay = 30 + Main.rand.Next(50); if (Main.rand.NextBool(10)) { - Main.PlaySound(SoundID.Item9, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item9, (int)Projectile.position.X, (int)Projectile.position.Y); } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 250f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/CrystalDust.cs b/Projectiles/Melee/CrystalDust.cs index 940bd99361..b443cd5014 100644 --- a/Projectiles/Melee/CrystalDust.cs +++ b/Projectiles/Melee/CrystalDust.cs @@ -15,20 +15,20 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 46; - projectile.height = 46; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 3; - projectile.timeLeft = 100; + Projectile.width = 46; + Projectile.height = 46; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 3; + Projectile.timeLeft = 100; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { int num307 = Main.rand.Next(3); if (num307 == 0) @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee } for (int num468 = 0; num468 < 5; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num307, 0f, 0f, 100, default, 2f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num307, 0f, 0f, 100, default, 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } diff --git a/Projectiles/Melee/CrystylCrusherRay.cs b/Projectiles/Melee/CrystylCrusherRay.cs index 63074bd5cf..217705588d 100644 --- a/Projectiles/Melee/CrystylCrusherRay.cs +++ b/Projectiles/Melee/CrystylCrusherRay.cs @@ -6,6 +6,7 @@ using Terraria.Enums; using Terraria.GameContent.Achievements; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class CrystylCrusherRay : ModProjectile @@ -28,15 +29,15 @@ namespace CalamityMod.Projectiles.Melee // By making a property to handle this it makes our life easier, and the accessibility more readable public float Distance { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } // The actual charge value is stored in the localAI0 field public float Charge { - get => projectile.localAI[0]; - set => projectile.localAI[0] = value; + get => Projectile.localAI[0]; + set => Projectile.localAI[0] = value; } // Are we at max charge? With c#6 you can simply use => which indicates this is a get only property @@ -46,17 +47,17 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.scale = 1.5f; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.hide = true; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 10; + Projectile.height = 10; + Projectile.scale = 1.5f; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.hide = true; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -64,10 +65,10 @@ namespace CalamityMod.Projectiles.Melee // We start drawing the laser if we have charged up if (IsAtMaxCharge) { - Vector2 maxLength = Main.MouseWorld - Main.player[projectile.owner].Center; + Vector2 maxLength = Main.MouseWorld - Main.player[Projectile.owner].Center; - DrawLaser(spriteBatch, Main.projectileTexture[projectile.type], Main.player[projectile.owner].Center, - projectile.velocity, 15f, projectile.damage, -1.57f, projectile.scale, maxLength.Length(), new Color(Main.DiscoR, 0, 255), (int)MOVE_DISTANCE); + DrawLaser(spriteBatch, Main.projectileTexture[Projectile.type], Main.player[Projectile.owner].Center, + Projectile.velocity, 15f, Projectile.damage, -1.57f, Projectile.scale, maxLength.Length(), new Color(Main.DiscoR, 0, 255), (int)MOVE_DISTANCE); } return false; } @@ -102,8 +103,8 @@ namespace CalamityMod.Projectiles.Melee // We can only collide if we are at max charge, which is when the laser is actually fired if (!IsAtMaxCharge) return false; - Player player = Main.player[projectile.owner]; - Vector2 unit = projectile.velocity; + Player player = Main.player[Projectile.owner]; + Vector2 unit = Projectile.velocity; float point = 0f; // Run an AABB versus Line check to look for collisions, look up AABB collision first to see how it works // It will look for collisions on the given line using AABB @@ -114,13 +115,13 @@ namespace CalamityMod.Projectiles.Melee // The AI of the projectile public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; - if (projectile.timeLeft == 300) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"), player.Center); + if (Projectile.timeLeft == 300) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"), player.Center); - projectile.position = player.Center + projectile.velocity * MOVE_DISTANCE; - projectile.timeLeft = 2; + Projectile.position = player.Center + Projectile.velocity * MOVE_DISTANCE; + Projectile.timeLeft = 2; // By separating large AI into methods it becomes very easy to see the flow of the AI in a broader sense // First we update player variables that are needed to channel the laser @@ -136,7 +137,7 @@ namespace CalamityMod.Projectiles.Melee //Play cool sound when fully charged if (playedSound == false) { - Main.PlaySound(SoundID.Item68, projectile.Center); + SoundEngine.PlaySound(SoundID.Item68, Projectile.Center); playedSound = true; } @@ -150,7 +151,7 @@ namespace CalamityMod.Projectiles.Melee */ private void SetLaserPosition(Player player) { - Distance = MathHelper.Max(Main.player[projectile.owner].Distance(Main.MouseWorld) - 20f, MOVE_DISTANCE + 5f); + Distance = MathHelper.Max(Main.player[Projectile.owner].Distance(Main.MouseWorld) - 20f, MOVE_DISTANCE + 5f); } private void ChargeLaser(Player player) @@ -158,11 +159,11 @@ namespace CalamityMod.Projectiles.Melee // Kill the projectile if the player stops channeling if (!player.channel) { - projectile.Kill(); + Projectile.Kill(); } else { - Vector2 offset = projectile.velocity; + Vector2 offset = Projectile.velocity; offset *= MOVE_DISTANCE - 20; Vector2 pos = player.Center + offset - new Vector2(15f, 15f); if (Charge < MAX_CHARGE) @@ -171,8 +172,8 @@ namespace CalamityMod.Projectiles.Melee } int chargeFact = (int)(Charge / 20f); Vector2 dustVelocity = Vector2.UnitX * 18f; - dustVelocity = dustVelocity.RotatedBy(projectile.rotation - 1.57f); - Vector2 spawnPos = projectile.Center + dustVelocity; + dustVelocity = dustVelocity.RotatedBy(Projectile.rotation - 1.57f); + Vector2 spawnPos = Projectile.Center + dustVelocity; for (int k = 0; k < chargeFact + 1; k++) { int dustType = Main.rand.Next(3); @@ -191,7 +192,7 @@ namespace CalamityMod.Projectiles.Melee break; } Vector2 spawn = spawnPos + ((float)Main.rand.NextDouble() * 6.28f).ToRotationVector2() * (12f - chargeFact * 2); - Dust dust = Main.dust[Dust.NewDust(pos, 20, 20, dustType, projectile.velocity.X / 2f, projectile.velocity.Y / 2f)]; + Dust dust = Main.dust[Dust.NewDust(pos, 20, 20, dustType, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f)]; dust.velocity = Vector2.Normalize(spawnPos - spawn) * 1.5f * (10f - chargeFact * 2f) / 10f; dust.noGravity = true; dust.color = new Color(Main.DiscoR, 0, 255); @@ -203,27 +204,27 @@ namespace CalamityMod.Projectiles.Melee private void UpdatePlayer(Player player) { // Multiplayer support here, only run this code if the client running it is the owner of the projectile - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { Vector2 diff = Main.MouseWorld - player.Center; diff.Normalize(); - projectile.velocity = diff; - projectile.direction = Main.MouseWorld.X > player.position.X ? 1 : -1; - projectile.netUpdate = true; + Projectile.velocity = diff; + Projectile.direction = Main.MouseWorld.X > player.position.X ? 1 : -1; + Projectile.netUpdate = true; } - int dir = projectile.direction; + int dir = Projectile.direction; player.ChangeDir(dir); // Set player direction to where we are shooting - player.heldProj = projectile.whoAmI; // Update player's held projectile + player.heldProj = Projectile.whoAmI; // Update player's held projectile player.itemTime = 2; // Set item time to 2 frames while we are used player.itemAnimation = 2; // Set item animation time to 2 frames while we are used - player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * dir, projectile.velocity.X * dir); // Set the item rotation to where we are shooting + player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * dir, Projectile.velocity.X * dir); // Set the item rotation to where we are shooting } private void CastLights() { // Cast a light along the line of the laser DelegateMethods.v3_1 = new Vector3(0.8f, 0.8f, 1f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * (Distance - MOVE_DISTANCE), 26, DelegateMethods.CastLight); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * (Distance - MOVE_DISTANCE), 26, DelegateMethods.CastLight); } public override bool ShouldUpdatePosition() => false; @@ -234,15 +235,15 @@ namespace CalamityMod.Projectiles.Melee public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * Distance, projectile.width + 16, DelegateMethods.CutTiles); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Distance, Projectile.width + 16, DelegateMethods.CutTiles); } private void DestroyTiles() { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Vector2 destroyVector = projectile.Center + projectile.velocity * (Distance - MOVE_DISTANCE); + Vector2 destroyVector = Projectile.Center + Projectile.velocity * (Distance - MOVE_DISTANCE); int num814 = 3; int num815 = (int)(destroyVector.X / 16f - num814); int num816 = (int)(destroyVector.X / 16f + num814); @@ -310,7 +311,7 @@ namespace CalamityMod.Projectiles.Melee default: break; } - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2(projectile.width / 2f, projectile.height) * 0.75f; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / num226, default) + vector; Vector2 vector7 = vector6 - vector; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, dustType, vector7.X * 0.5f, vector7.Y * 0.5f, 100, new Color(Main.DiscoR, 0, 255), 1f); diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index 8bdec6829a..401193e563 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,66 +17,66 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Cyclone"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.alpha = 255; - projectile.friendly = true; - projectile.melee = true; - projectile.timeLeft = 300; - projectile.extraUpdates = 2; - projectile.penetrate = 2; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.tileCollide = false; + Projectile.width = 40; + Projectile.height = 40; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 2; + Projectile.penetrate = 2; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.tileCollide = false; } public override void AI() { - projectile.ai[0]++; - projectile.ai[1]++; + Projectile.ai[0]++; + Projectile.ai[1]++; //Code so it doesnt collide on tiles instantly - if (projectile.ai[0] >= 12) - projectile.tileCollide = true; + if (Projectile.ai[0] >= 12) + Projectile.tileCollide = true; - projectile.rotation += 2.5f; - projectile.alpha -= 5; - if (projectile.alpha < 50) + Projectile.rotation += 2.5f; + Projectile.alpha -= 5; + if (Projectile.alpha < 50) { - projectile.alpha = 50; - if (projectile.ai[1] >= 15) + Projectile.alpha = 50; + if (Projectile.ai[1] >= 15) { for (int i = 1; i <= 6; i++) { Vector2 dustspeed = new Vector2(3f, 3f).RotatedBy(MathHelper.ToRadians(dustvortex)); - int d = Dust.NewDust(projectile.Center, projectile.width / 2, projectile.height / 2, 31, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.3f); + int d = Dust.NewDust(Projectile.Center, Projectile.width / 2, Projectile.height / 2, 31, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.3f); Main.dust[d].noGravity = true; Main.dust[d].velocity = dustspeed; dustvortex += 60; } dustvortex -= 355; - projectile.ai[1] = 0; + Projectile.ai[1] = 0; } } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; + float num472 = Projectile.Center.X; + float num473 = Projectile.Center.Y; float num474 = 600f; for (int num475 = 0; num475 < 200; num475++) { NPC npc = Main.npc[num475]; - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { float npcCenterX = npc.position.X + (float)(npc.width / 2); float npcCenterY = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); + float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); if (num478 < num474) { if (npc.position.X < num472) @@ -101,25 +102,25 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) { - return new Color(204, 255, 255, projectile.alpha); + return new Color(204, 255, 255, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 60, 0.6f); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 60, 0.6f); for (int i = 0; i <= 360; i += 3) { Vector2 dustspeed = new Vector2(3f, 3f).RotatedBy(MathHelper.ToRadians(i)); - int d = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 31, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.4f); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 31, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.4f); Main.dust[d].noGravity = true; - Main.dust[d].position = projectile.Center; + Main.dust[d].position = Projectile.Center; Main.dust[d].velocity = dustspeed; } } diff --git a/Projectiles/Melee/DNA.cs b/Projectiles/Melee/DNA.cs index 40c229f0e3..75a59e82cd 100644 --- a/Projectiles/Melee/DNA.cs +++ b/Projectiles/Melee/DNA.cs @@ -15,67 +15,67 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ignoreWater = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 4; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; aiType = ProjectileID.CrystalVileShardHead; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] == 0f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + if (Projectile.ai[0] == 0f) { - projectile.alpha -= 50; - if (projectile.alpha <= 0) + Projectile.alpha -= 50; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) + Projectile.alpha = 0; + Projectile.ai[0] = 1f; + if (Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; + Projectile.ai[1] += 1f; + Projectile.position += Projectile.velocity * 1f; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - int num48 = projectile.type; - if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) + int num48 = Projectile.type; + if (Projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) { num48 = ModContent.ProjectileType(); } - int num49 = projectile.damage; - float num50 = projectile.knockBack; - int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, num48, num49, num50, projectile.owner, 0f, projectile.ai[1] + 1f); + int num49 = Projectile.damage; + float num50 = Projectile.knockBack; + int number = Projectile.NewProjectile(Projectile.position.X + Projectile.velocity.X + (float)(Projectile.width / 2), Projectile.position.Y + Projectile.velocity.Y + (float)(Projectile.height / 2), Projectile.velocity.X, Projectile.velocity.Y, num48, num49, num50, Projectile.owner, 0f, Projectile.ai[1] + 1f); NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); } } } else { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170) { for (int num55 = 0; num55 < 8; num55++) { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); + int num56 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); Main.dust[num56].noGravity = true; Main.dust[num56].velocity *= 0.5f; } } - projectile.alpha += 7; - if (projectile.alpha >= 255) + Projectile.alpha += 7; + if (Projectile.alpha >= 255) { - projectile.Kill(); + Projectile.Kill(); } } if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); } } @@ -83,14 +83,14 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.player[projectile.owner].GiveIFrames(Lucrecia.OnHitIFrames); - target.immune[projectile.owner] = 5; + Main.player[Projectile.owner].GiveIFrames(Lucrecia.OnHitIFrames); + target.immune[Projectile.owner] = 5; } } } diff --git a/Projectiles/Melee/DNA2.cs b/Projectiles/Melee/DNA2.cs index 4a32d8c2c2..2ab072ecca 100644 --- a/Projectiles/Melee/DNA2.cs +++ b/Projectiles/Melee/DNA2.cs @@ -17,55 +17,55 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ignoreWater = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 4; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; aiType = ProjectileID.CrystalVileShardShaft; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] == 0f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + if (Projectile.ai[0] == 0f) { - projectile.alpha -= 50; - if (projectile.alpha <= 0) + Projectile.alpha -= 50; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) + Projectile.alpha = 0; + Projectile.ai[0] = 1f; + if (Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; + Projectile.ai[1] += 1f; + Projectile.position += Projectile.velocity * 1f; } } } else { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170) { for (int num55 = 0; num55 < 8; num55++) { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); + int num56 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); Main.dust[num56].noGravity = true; Main.dust[num56].velocity *= 0.5f; } } - projectile.alpha += 7; - if (projectile.alpha >= 255) + Projectile.alpha += 7; + if (Projectile.alpha >= 255) { - projectile.Kill(); + Projectile.Kill(); } } if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); } } @@ -73,14 +73,14 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.player[projectile.owner].GiveIFrames(Lucrecia.OnHitIFrames); - target.immune[projectile.owner] = 5; + Main.player[Projectile.owner].GiveIFrames(Lucrecia.OnHitIFrames); + target.immune[Projectile.owner] = 5; } } } diff --git a/Projectiles/Melee/Dark.cs b/Projectiles/Melee/Dark.cs index aac54e1f8b..804d3c9ed3 100644 --- a/Projectiles/Melee/Dark.cs +++ b/Projectiles/Melee/Dark.cs @@ -12,36 +12,36 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Dark"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 300; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; } public override void AI() { - projectile.rotation += 0.5f; + Projectile.rotation += 0.5f; speedTimer--; if (speedTimer <= 0) { speedTimer = speedTimerMax; - projectile.velocity *= -1f; + Projectile.velocity *= -1f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/DarkBall.cs b/Projectiles/Melee/DarkBall.cs index 8dbb5a0cbf..18f46e70ba 100644 --- a/Projectiles/Melee/DarkBall.cs +++ b/Projectiles/Melee/DarkBall.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class DarkBall : ModProjectile @@ -13,24 +14,24 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.scale = 0.9f; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 200; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.width = 20; + Projectile.height = 20; + Projectile.scale = 0.9f; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 200; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override void AI() { try { - int num223 = (int)(projectile.position.X / 16f) - 1; - int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; - int num225 = (int)(projectile.position.Y / 16f) - 1; - int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; + int num223 = (int)(Projectile.position.X / 16f) - 1; + int num224 = (int)((Projectile.position.X + (float)Projectile.width) / 16f) + 2; + int num225 = (int)(Projectile.position.Y / 16f) - 1; + int num226 = (int)((Projectile.position.Y + (float)Projectile.height) / 16f) + 2; if (num223 < 0) { num223 = 0; @@ -51,15 +52,15 @@ namespace CalamityMod.Projectiles.Melee { for (int num228 = num225; num228 < num226; num228++) { - if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) + if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].TileType] || (Main.tileSolidTop[(int)Main.tile[num227, num228].TileType] && Main.tile[num227, num228].TileFrameY == 0))) { Vector2 vector19; vector19.X = (float)(num227 * 16); vector19.Y = (float)(num228 * 16); - if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) + if (Projectile.position.X + (float)Projectile.width - 4f > vector19.X && Projectile.position.X + 4f < vector19.X + 16f && Projectile.position.Y + (float)Projectile.height - 4f > vector19.Y && Projectile.position.Y + 4f < vector19.Y + 16f) { - projectile.velocity.X = 0f; - projectile.velocity.Y = -0.2f; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = -0.2f; } } } @@ -67,64 +68,64 @@ namespace CalamityMod.Projectiles.Melee } catch { } - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + if (Projectile.owner == Main.myPlayer && Projectile.timeLeft <= 3) { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 128; - projectile.height = 128; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 8f; + Projectile.tileCollide = false; + Projectile.ai[1] = 0f; + Projectile.alpha = 255; + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 128; + Projectile.height = 128; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.knockBack = 8f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 10f) { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 10f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCDeath21, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 22; - projectile.height = 22; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.NPCDeath21, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 22; + Projectile.height = 22; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num648 = 0; num648 < 20; num648++) { - int num649 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 1.5f); + int num649 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 1.5f); Main.dust[num649].velocity *= 1.4f; } for (int num650 = 0; num650 < 10; num650++) { - int num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 2.5f); + int num651 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 2.5f); Main.dust[num651].noGravity = true; Main.dust[num651].velocity *= 5f; - num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 1.5f); + num651 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 1.5f); Main.dust[num651].velocity *= 3f; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Melee/DarkBeam.cs b/Projectiles/Melee/DarkBeam.cs index 5f03704fe9..61d56c43ba 100644 --- a/Projectiles/Melee/DarkBeam.cs +++ b/Projectiles/Melee/DarkBeam.cs @@ -11,35 +11,35 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Dark Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 56; - projectile.height = 56; - projectile.aiStyle = 18; + Projectile.width = 56; + Projectile.height = 56; + Projectile.aiStyle = 18; aiType = ProjectileID.DeathSickle; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.2f / 255f, 0f, (255 - projectile.alpha) * 0.6f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.2f / 255f, 0f, (255 - Projectile.alpha) * 0.6f / 255f); - if (projectile.velocity.Length() < 12f) - projectile.velocity *= 1.1f; + if (Projectile.velocity.Length() < 12f) + Projectile.velocity *= 1.1f; } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * (b2 / 255f)); return new Color(b2, b2, b2, a2); } @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -61,16 +61,16 @@ namespace CalamityMod.Projectiles.Melee { for (int num105 = 0; num105 < 20; num105++) { - int num102 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 56, 0f, 0f, 0, default, 1f); + int num102 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 56, 0f, 0f, 0, default, 1f); Main.dust[num102].noGravity = true; - Main.dust[num102].velocity += projectile.velocity * 0.1f; + Main.dust[num102].velocity += Projectile.velocity * 0.1f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int k = 0; k < 3; k++) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)(projectile.damage * 0.5), projectile.knockBack * 0.15f, Main.myPlayer); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), + (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.15f, Main.myPlayer); } } } diff --git a/Projectiles/Melee/DarkIceZero.cs b/Projectiles/Melee/DarkIceZero.cs index 0b5c179800..2ce448c9a3 100644 --- a/Projectiles/Melee/DarkIceZero.cs +++ b/Projectiles/Melee/DarkIceZero.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -12,17 +13,17 @@ namespace CalamityMod.Projectiles.Melee { public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.aiStyle = 1; + Projectile.width = 28; + Projectile.height = 28; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.timeLeft = 600; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; - projectile.coldDamage = true; + Projectile.timeLeft = 600; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 1; + Projectile.coldDamage = true; } public override void SetStaticDefaults() @@ -32,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; return true; @@ -40,13 +41,13 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 16f) { - projectile.velocity *= 1.045f; + Projectile.velocity *= 1.045f; } //make pretty dust - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.25f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.25f); Main.dust[index2].noGravity = true; } @@ -65,26 +66,26 @@ namespace CalamityMod.Projectiles.Melee { if (timeLeft > 0) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 192; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); - Main.PlaySound(SoundID.Item27, projectile.Center); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 192; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int i = 0; i < 30; i++) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, 0f, 0f, 0, default, Main.rand.NextFloat(1f, 2f)); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, 0f, 0f, 0, default, Main.rand.NextFloat(1f, 2f)); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 4f; } for (int index1 = 0; index1 < 20; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, new Color(), 1.3f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, new Color(), 1.3f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 1.5f; } diff --git a/Projectiles/Melee/DemonBlast.cs b/Projectiles/Melee/DemonBlast.cs index 84d737c4c3..3124336b7d 100644 --- a/Projectiles/Melee/DemonBlast.cs +++ b/Projectiles/Melee/DemonBlast.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -13,21 +14,21 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Devil Fork"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.tileCollide = false; - projectile.melee = true; - projectile.alpha = 180; - projectile.timeLeft = 300; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 5; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 180; + Projectile.timeLeft = 300; } public override void AI() @@ -39,28 +40,28 @@ namespace CalamityMod.Projectiles.Melee 172 }); - if (projectile.position.HasNaNs()) + if (Projectile.position.HasNaNs()) { - projectile.Kill(); + Projectile.Kill(); return; } - bool tileCheck = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f)]; - dust.position = projectile.Center; + bool tileCheck = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); + Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f)]; + dust.position = Projectile.Center; dust.velocity = Vector2.Zero; dust.noGravity = true; if (tileCheck) dust.noLight = true; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.ToRadians(45); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.ToRadians(45); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); - bool tileCheck = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + bool tileCheck = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); for (int m = 0; m < 4; m++) { int dustType = Utils.SelectRandom(Main.rand, new int[] @@ -69,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee (int)CalamityDusts.Brimstone, 172 }); - Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.5f); } for (int n = 0; n < 4; n++) { @@ -79,14 +80,14 @@ namespace CalamityMod.Projectiles.Melee (int)CalamityDusts.Brimstone, 172 }); - int dustInt = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 2.5f); + int dustInt = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); Main.dust[dustInt].noGravity = true; Main.dust[dustInt].velocity *= 3f; if (tileCheck) { Main.dust[dustInt].noLight = true; } - dustInt = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1.5f); + dustInt = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.5f); Main.dust[dustInt].velocity *= 2f; Main.dust[dustInt].noGravity = true; if (tileCheck) @@ -97,11 +98,11 @@ namespace CalamityMod.Projectiles.Melee } //glowmask effect - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/DepthOrb.cs b/Projectiles/Melee/DepthOrb.cs index d4acd30bd7..9e694c0845 100644 --- a/Projectiles/Melee/DepthOrb.cs +++ b/Projectiles/Melee/DepthOrb.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class DepthOrb : ModProjectile @@ -16,46 +17,46 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 30; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 30; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f); - int num458 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.6f); + Lighting.AddLight(Projectile.Center, 0f, 0f, 0.5f); + int num458 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.6f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 25) + if (Projectile.timeLeft > 25) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(50, 50, 255, projectile.alpha); + return new Color(50, 50, 255, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.Center = projectile.position; + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.Center = Projectile.position; for (int dustIndex = 0; dustIndex < 30; dustIndex++) { float num463 = (float)Main.rand.Next(-10, 11); @@ -65,22 +66,22 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int num467 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; dust.velocity.Y = num464; } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/DepthOrb2.cs b/Projectiles/Melee/DepthOrb2.cs index 23e7ecca49..de27c1c497 100644 --- a/Projectiles/Melee/DepthOrb2.cs +++ b/Projectiles/Melee/DepthOrb2.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class DepthOrb2 : ModProjectile @@ -18,51 +19,51 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f); + Lighting.AddLight(Projectile.Center, 0f, 0f, 0.5f); - int num458 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int num458 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 115) + if (Projectile.timeLeft > 115) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(50, 50, 255, projectile.alpha); + return new Color(50, 50, 255, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int dustIndex = 0; dustIndex <= 30; dustIndex++) { float num463 = (float)Main.rand.Next(-10, 11); @@ -72,21 +73,21 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int num467 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; dust.velocity.Y = num464; } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/DevilsSunriseCyclone.cs b/Projectiles/Melee/DevilsSunriseCyclone.cs index 399b6f4361..170b3be1bb 100644 --- a/Projectiles/Melee/DevilsSunriseCyclone.cs +++ b/Projectiles/Melee/DevilsSunriseCyclone.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,50 +17,50 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Devil's Sunrise"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; } public override void AI() { - if (projectile.ai[1] < 510f && projectile.ai[1] != -1f) - projectile.ai[1] += 1f; + if (Projectile.ai[1] < 510f && Projectile.ai[1] != -1f) + Projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - if (!Main.player[projectile.owner].channel) + if (!Main.player[Projectile.owner].channel) { - projectile.ai[1] = -1f; - projectile.damage = projectile.Calamity().defDamage; + Projectile.ai[1] = -1f; + Projectile.damage = Projectile.Calamity().defDamage; } } - if (projectile.ai[1] >= 255f) - projectile.damage = (int)((double)projectile.Calamity().defDamage * 2.0); + if (Projectile.ai[1] >= 255f) + Projectile.damage = (int)((double)Projectile.Calamity().defDamage * 2.0); - red = 64 + (int)(projectile.ai[1] * 0.75f); + red = 64 + (int)(Projectile.ai[1] * 0.75f); if (red > 255) red = 255; - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); Main.dust[dust].velocity *= 0.3f; Main.dust[dust].noGravity = true; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float x = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + Vector2 vector2 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float x = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector2.X; + float y = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector2.Y; float distanceFromOwner = (float)Math.Sqrt((double)(x * x + y * y)); float speed = 25f; @@ -68,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee if (speed < 2f) speed = 2f; - if (speed <= 2f || projectile.ai[1] >= 510f || projectile.ai[1] == -1f) + if (speed <= 2f || Projectile.ai[1] >= 510f || Projectile.ai[1] == -1f) { float returnSpeedMax = 30f; float returnSpeed = 6f; @@ -76,52 +77,52 @@ namespace CalamityMod.Projectiles.Melee x *= distanceFromOwner; y *= distanceFromOwner; - if (projectile.velocity.X < x) + if (Projectile.velocity.X < x) { - projectile.velocity.X = projectile.velocity.X + returnSpeed; - if (projectile.velocity.X < 0f && x > 0f) - projectile.velocity.X = projectile.velocity.X + returnSpeed; + Projectile.velocity.X = Projectile.velocity.X + returnSpeed; + if (Projectile.velocity.X < 0f && x > 0f) + Projectile.velocity.X = Projectile.velocity.X + returnSpeed; } - else if (projectile.velocity.X > x) + else if (Projectile.velocity.X > x) { - projectile.velocity.X = projectile.velocity.X - returnSpeed; - if (projectile.velocity.X > 0f && x < 0f) - projectile.velocity.X = projectile.velocity.X - returnSpeed; + Projectile.velocity.X = Projectile.velocity.X - returnSpeed; + if (Projectile.velocity.X > 0f && x < 0f) + Projectile.velocity.X = Projectile.velocity.X - returnSpeed; } - if (projectile.velocity.Y < y) + if (Projectile.velocity.Y < y) { - projectile.velocity.Y = projectile.velocity.Y + returnSpeed; - if (projectile.velocity.Y < 0f && y > 0f) - projectile.velocity.Y = projectile.velocity.Y + returnSpeed; + Projectile.velocity.Y = Projectile.velocity.Y + returnSpeed; + if (Projectile.velocity.Y < 0f && y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + returnSpeed; } - else if (projectile.velocity.Y > y) + else if (Projectile.velocity.Y > y) { - projectile.velocity.Y = projectile.velocity.Y - returnSpeed; - if (projectile.velocity.Y > 0f && y < 0f) - projectile.velocity.Y = projectile.velocity.Y - returnSpeed; + Projectile.velocity.Y = Projectile.velocity.Y - returnSpeed; + if (Projectile.velocity.Y > 0f && y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - returnSpeed; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + Rectangle rectangle = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[Projectile.owner].position.X, (int)Main.player[Projectile.owner].position.Y, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height); if (rectangle.Intersects(value2)) - projectile.Kill(); + Projectile.Kill(); } } - else if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) + else if (Main.myPlayer == Projectile.owner && Projectile.ai[0] <= 0f) { - if (Main.player[projectile.owner].channel) + if (Main.player[Projectile.owner].channel) { - Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector10 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; - if (Main.player[projectile.owner].gravDir == -1f) + if (Main.player[Projectile.owner].gravDir == -1f) num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; - if (projectile.ai[0] < 0f) - projectile.ai[0] += 1f; + if (Projectile.ai[0] < 0f) + Projectile.ai[0] += 1f; float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); @@ -131,97 +132,97 @@ namespace CalamityMod.Projectiles.Melee num116 *= num118; num117 *= num118; int num119 = (int)(num116 * 1000f); - int num120 = (int)(projectile.velocity.X * 1000f); + int num120 = (int)(Projectile.velocity.X * 1000f); int num121 = (int)(num117 * 1000f); - int num122 = (int)(projectile.velocity.Y * 1000f); + int num122 = (int)(Projectile.velocity.Y * 1000f); if (num119 != num120 || num121 != num122) - projectile.netUpdate = true; + Projectile.netUpdate = true; - projectile.velocity.X = num116; - projectile.velocity.Y = num117; + Projectile.velocity.X = num116; + Projectile.velocity.Y = num117; } else { int num123 = (int)(num116 * 1000f); - int num124 = (int)(projectile.velocity.X * 1000f); + int num124 = (int)(Projectile.velocity.X * 1000f); int num125 = (int)(num117 * 1000f); - int num126 = (int)(projectile.velocity.Y * 1000f); + int num126 = (int)(Projectile.velocity.Y * 1000f); if (num123 != num124 || num125 != num126) - projectile.netUpdate = true; + Projectile.netUpdate = true; - projectile.velocity.X = num116; - projectile.velocity.Y = num117; + Projectile.velocity.X = num116; + Projectile.velocity.Y = num117; } } - else if (projectile.ai[0] <= 0f) + else if (Projectile.ai[0] <= 0f) { - projectile.netUpdate = true; - Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Projectile.netUpdate = true; + Vector2 vector11 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; - if (Main.player[projectile.owner].gravDir == -1f) + if (Main.player[Projectile.owner].gravDir == -1f) num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || projectile.ai[0] < 0f) + if (num130 == 0f || Projectile.ai[0] < 0f) { - vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); - num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; - num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; + vector11 = new Vector2(Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2), Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2)); + num128 = Projectile.position.X + (float)Projectile.width * 0.5f - vector11.X; + num129 = Projectile.position.Y + (float)Projectile.height * 0.5f - vector11.Y; num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); } num130 = speed / num130; num128 *= num130; num129 *= num130; - projectile.velocity.X = num128; - projectile.velocity.Y = num129; + Projectile.velocity.X = num128; + Projectile.velocity.Y = num129; - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - projectile.Kill(); + if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) + Projectile.Kill(); - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } } - Lighting.AddLight(projectile.Center, (float)((double)red * 0.001), 0.1f, 0.1f); + Lighting.AddLight(Projectile.Center, (float)((double)red * 0.001), 0.1f, 0.1f); - projectile.rotation += 0.5f; + Projectile.rotation += 0.5f; } public override Color? GetAlpha(Color lightColor) { - return new Color(red, greenAndBlue, greenAndBlue, projectile.alpha); + return new Color(red, greenAndBlue, greenAndBlue, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item88, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item88, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 66, vector7.X, vector7.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.Damage(); + Projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index 36b7919c34..91dd389492 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -15,60 +16,60 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Devil's Sunrise"); - Main.projFrames[projectile.type] = 28; + Main.projFrames[Projectile.type] = 28; } public override void SetDefaults() { - projectile.width = 148; - projectile.height = 68; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ownerHitCheck = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.Calamity().trueMelee = true; + Projectile.width = 148; + Projectile.height = 68; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.ownerHitCheck = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.Calamity().trueMelee = true; } public override void AI() { - if (projectile.ai[1] < 255f) - projectile.ai[1] += 1f; + if (Projectile.ai[1] < 255f) + Projectile.ai[1] += 1f; - if (projectile.ai[1] == 255f) - projectile.damage = (int)((double)projectile.Calamity().defDamage * 2.0); + if (Projectile.ai[1] == 255f) + Projectile.damage = (int)((double)Projectile.Calamity().defDamage * 2.0); - red = 64 + (int)(projectile.ai[1] * 0.75f); + red = 64 + (int)(Projectile.ai[1] * 0.75f); if (red > 255) red = 255; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float num = 0f; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) num = 3.14159274f; - if (++projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + if (++Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; - projectile.soundDelay--; - if (projectile.soundDelay <= 0) + Projectile.soundDelay--; + if (Projectile.soundDelay <= 0) { - Main.PlaySound(SoundID.Item15, projectile.Center); - projectile.soundDelay = 24; + SoundEngine.PlaySound(SoundID.Item15, Projectile.Center); + Projectile.soundDelay = 24; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { if (player.channel && !player.noItems && !player.CCed) { float scaleFactor6 = 1f; - if (player.ActiveItem().shoot == projectile.type) - scaleFactor6 = player.ActiveItem().shootSpeed * projectile.scale; + if (player.ActiveItem().shoot == Projectile.type) + scaleFactor6 = player.ActiveItem().shootSpeed * Projectile.scale; Vector2 vector13 = Main.MouseWorld - vector; vector13.Normalize(); @@ -76,39 +77,39 @@ namespace CalamityMod.Projectiles.Melee vector13 = Vector2.UnitX * (float)player.direction; vector13 *= scaleFactor6; - if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y) - projectile.netUpdate = true; + if (vector13.X != Projectile.velocity.X || vector13.Y != Projectile.velocity.Y) + Projectile.netUpdate = true; - projectile.velocity = vector13; + Projectile.velocity = vector13; } else - projectile.Kill(); + Projectile.Kill(); } - Vector2 vector14 = projectile.Center + projectile.velocity * 3f; + Vector2 vector14 = Projectile.Center + Projectile.velocity * 3f; Lighting.AddLight(vector14, (float)((double)red * 0.001), 0.1f, 0.1f); if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(vector14 - projectile.Size / 2f, projectile.width, projectile.height, 66, projectile.velocity.X, projectile.velocity.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); + int dust = Dust.NewDust(vector14 - Projectile.Size / 2f, Projectile.width, Projectile.height, 66, Projectile.velocity.X, Projectile.velocity.Y, 100, new Color(red, greenAndBlue, greenAndBlue), 1f); Main.dust[dust].noGravity = true; - Main.dust[dust].position -= projectile.velocity; + Main.dust[dust].position -= Projectile.velocity; } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); } public override Color? GetAlpha(Color lightColor) { - return new Color(red, greenAndBlue, greenAndBlue, projectile.alpha); + return new Color(red, greenAndBlue, greenAndBlue, Projectile.alpha); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/DivineHatchetBoomerang.cs b/Projectiles/Melee/DivineHatchetBoomerang.cs index b1ddde6ae5..4c1a8203a6 100644 --- a/Projectiles/Melee/DivineHatchetBoomerang.cs +++ b/Projectiles/Melee/DivineHatchetBoomerang.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -22,22 +23,22 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Scorching Seeker"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 60; - projectile.height = 60; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = 4; - projectile.timeLeft = Lifetime; - projectile.melee = true; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = 4; + Projectile.timeLeft = Lifetime; + Projectile.DamageType = DamageClass.Melee; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -45,89 +46,89 @@ namespace CalamityMod.Projectiles.Melee //holy dust if (Main.rand.NextBool(8)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } // Boomerang rotation - projectile.rotation += 0.4f * (float)projectile.direction; + Projectile.rotation += 0.4f * (float)Projectile.direction; // Boomerang sound - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } // Returns after some number of frames in the air - if (projectile.timeLeft < Lifetime - ReboundTime) - projectile.ai[0] = 1f; + if (Projectile.timeLeft < Lifetime - ReboundTime) + Projectile.ai[0] = 1f; - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { float returnSpeed = 26f; float acceleration = 1.4f; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; // Delete the projectile if it's excessively far away. Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); dist = returnSpeed / dist; xDist *= dist; yDist *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) + if (Projectile.velocity.X < xDist) { - projectile.velocity.X += acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X += acceleration; + if (Projectile.velocity.X < 0f && xDist > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > xDist) + else if (Projectile.velocity.X > xDist) { - projectile.velocity.X -= acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X -= acceleration; + if (Projectile.velocity.X > 0f && xDist < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < yDist) + if (Projectile.velocity.Y < yDist) { - projectile.velocity.Y += acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y += acceleration; + if (Projectile.velocity.Y < 0f && yDist > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > yDist) + else if (Projectile.velocity.Y > yDist) { - projectile.velocity.Y -= acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y -= acceleration; + if (Projectile.velocity.Y > 0f && yDist < 0f) + Projectile.velocity.Y -= acceleration; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); //home in on nearby NPCs if not returning to player - if (projectile.penetrate != -1) + if (Projectile.penetrate != -1) { if (!hasHitEnemy) { float range = 999f; for (int a = 0; a < Main.npc.Length; a++) { - if (Main.npc[a].CanBeChasedBy(projectile, false)) + if (Main.npc[a].CanBeChasedBy(Projectile, false)) { - if (Vector2.Distance(Main.npc[a].Center, projectile.Center) < range) + if (Vector2.Distance(Main.npc[a].Center, Projectile.Center) < range) { - Vector2 newVelocity = Main.npc[a].Center - projectile.Center; + Vector2 newVelocity = Main.npc[a].Center - Projectile.Center; newVelocity.Normalize(); newVelocity *= 15f; - projectile.velocity = newVelocity; + Projectile.velocity = newVelocity; } } } @@ -136,10 +137,10 @@ namespace CalamityMod.Projectiles.Melee { if (targetNPC >= 0) { - Vector2 newVelocity = Main.npc[targetNPC].Center - projectile.Center; + Vector2 newVelocity = Main.npc[targetNPC].Center - Projectile.Center; newVelocity.Normalize(); newVelocity *= 15f; - projectile.velocity = newVelocity; + Projectile.velocity = newVelocity; } } } @@ -148,7 +149,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -160,7 +161,7 @@ namespace CalamityMod.Projectiles.Melee //inflict Holy Flames for 6 seconds target.AddBuff(ModContent.BuffType(), 180); - if (projectile.penetrate != -1) + if (Projectile.penetrate != -1) { //find a nearby NPC to track float minDist = 999f; @@ -181,9 +182,9 @@ namespace CalamityMod.Projectiles.Melee { previousNPCs.Add(i); } - if (npc.CanBeChasedBy(projectile, false) && npc != target && !hasHitNPC) + if (npc.CanBeChasedBy(Projectile, false) && npc != target && !hasHitNPC) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < minDist) { minDist = dist; @@ -197,24 +198,24 @@ namespace CalamityMod.Projectiles.Melee { hasHitEnemy = true; targetNPC = index; - velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew = Main.npc[index].Center - Projectile.Center; velocityNew.Normalize(); velocityNew *= 15f; - projectile.velocity = velocityNew; + Projectile.velocity = velocityNew; } else { - projectile.penetrate = -1; - projectile.ai[0] = 1f; + Projectile.penetrate = -1; + Projectile.ai[0] = 1f; targetNPC = -1; } } // After its last hit, starts returning instead of vanishing. Can pierce infinitely on the way back. - if (projectile.penetrate == 1) + if (Projectile.penetrate == 1) { - projectile.penetrate = -1; - projectile.ai[0] = 1f; + Projectile.penetrate = -1; + Projectile.ai[0] = 1f; targetNPC = -1; } } diff --git a/Projectiles/Melee/DracoBeam.cs b/Projectiles/Melee/DracoBeam.cs index 04182a813a..02a27d5340 100644 --- a/Projectiles/Melee/DracoBeam.cs +++ b/Projectiles/Melee/DracoBeam.cs @@ -12,58 +12,58 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 14; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 14; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 50; + Projectile.height = 50; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override void Kill(int timeLeft) { float spread = 30f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, 0f, 0f); } } diff --git a/Projectiles/Melee/DracoBeam2.cs b/Projectiles/Melee/DracoBeam2.cs index 8752e076c1..8143cff751 100644 --- a/Projectiles/Melee/DracoBeam2.cs +++ b/Projectiles/Melee/DracoBeam2.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 14; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 14; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 240; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 50; + Projectile.height = 50; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 240; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -43,28 +43,28 @@ namespace CalamityMod.Projectiles.Melee speedTimer--; if (speedTimer > 60) { - projectile.velocity.X = 0f; - projectile.velocity.Y = 10f; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 10f; } else if (speedTimer <= 60) { - projectile.velocity.X = 0f; - projectile.velocity.Y = -10f; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = -10f; } if (speedTimer <= 0) { speedTimer = 120; } } - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 235) + if (Projectile.timeLeft > 235) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, 0f, 0f); } } diff --git a/Projectiles/Melee/DraconicSpark.cs b/Projectiles/Melee/DraconicSpark.cs index 071400b4ab..db6eec1427 100644 --- a/Projectiles/Melee/DraconicSpark.cs +++ b/Projectiles/Melee/DraconicSpark.cs @@ -21,15 +21,15 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = Lifetime; - projectile.alpha = 255; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = Lifetime; + Projectile.alpha = 255; } // ai[0] controls what type of Draconic Spark this is. @@ -46,17 +46,17 @@ namespace CalamityMod.Projectiles.Melee private void ArchAmaryllisHoming() { - float targetX = projectile.Center.X; - float targetY = projectile.Center.Y; + float targetX = Projectile.Center.X; + float targetY = Projectile.Center.Y; bool foundTarget = false; float maxRange = MaxHomingRange; for (int i = 0; i < 200; i++) { - if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + if (Main.npc[i].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) { float iterCenterX = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); float iterCenterY = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - float dist = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - iterCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - iterCenterY); + float dist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - iterCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - iterCenterY); if (dist < maxRange) { maxRange = dist; @@ -69,15 +69,15 @@ namespace CalamityMod.Projectiles.Melee if (foundTarget) { float speed = HomingVelocity; - Vector2 projCenter = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 projCenter = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float xDist = targetX - projCenter.X; float yDist = targetY - projCenter.Y; float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); dist = speed / dist; xDist *= dist; yDist *= dist; - projectile.velocity.X = (projectile.velocity.X * 20f + xDist) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + yDist) / 21f; + Projectile.velocity.X = (Projectile.velocity.X * 20f + xDist) / 21f; + Projectile.velocity.Y = (Projectile.velocity.Y * 20f + yDist) / 21f; return; } } @@ -85,48 +85,48 @@ namespace CalamityMod.Projectiles.Melee // Debuff applied depends on spark color. public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) target.AddBuff(BuffID.Daybreak, 180); - else if (projectile.ai[0] == 1f) + else if (Projectile.ai[0] == 1f) target.AddBuff(ModContent.BuffType(), 180); - else if (projectile.ai[0] == 2f) + else if (Projectile.ai[0] == 2f) target.AddBuff(ModContent.BuffType(), 180); } // Pure dust projectile, but dust used depends on AI variables private void DrawProjectile() { - if (projectile.ai[0] == 0) // daybroken spark + if (Projectile.ai[0] == 0) // daybroken spark { int dustID = 244; if (Main.rand.Next(3) != 0) { float scale = Main.rand.NextFloat(0.8f, 1.4f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID); Main.dust[idx].noGravity = true; - Main.dust[idx].velocity += projectile.velocity * 0.1f; + Main.dust[idx].velocity += Projectile.velocity * 0.1f; } } - else if (projectile.ai[0] == 1) // abyssal flames spark + else if (Projectile.ai[0] == 1) // abyssal flames spark { int dustID = 235; if (Main.rand.Next(3) != 0) { float scale = Main.rand.NextFloat(0.6f, 1.2f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f, 100, default, scale); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, scale); Main.dust[idx].noGravity = true; - Main.dust[idx].velocity += projectile.velocity * 0.1f; + Main.dust[idx].velocity += Projectile.velocity * 0.1f; } } - else if (projectile.ai[0] == 2) // holy flames spark + else if (Projectile.ai[0] == 2) // holy flames spark { int dustID = 246; if (Main.rand.Next(3) != 0) { float scale = Main.rand.NextFloat(0.8f, 1.4f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID); Main.dust[idx].noGravity = true; - Main.dust[idx].velocity += projectile.velocity * 0.1f; + Main.dust[idx].velocity += Projectile.velocity * 0.1f; } } } diff --git a/Projectiles/Melee/DragonPowFlail.cs b/Projectiles/Melee/DragonPowFlail.cs index 1d1f88dac5..d7ccee3949 100644 --- a/Projectiles/Melee/DragonPowFlail.cs +++ b/Projectiles/Melee/DragonPowFlail.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class DragonPowFlail : ModProjectile @@ -17,20 +18,20 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.extraUpdates = 2; + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 2; // Only hits enemies once, but doesn't give them iframes so sparks and explosions can hit. - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; - projectile.alpha = 255; + Projectile.alpha = 255; } // ai[0] = flail's current behavior state @@ -43,16 +44,16 @@ namespace CalamityMod.Projectiles.Melee drawOriginOffsetY = -11; drawOriginOffsetX = 0; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; // Update facing so it's always directly away from player - Vector2 posDiff = owner.Center - projectile.Center; - projectile.rotation = posDiff.ToRotation(); + Vector2 posDiff = owner.Center - Projectile.Center; + Projectile.rotation = posDiff.ToRotation(); // Destroy immediately if the owner is dead if (owner.dead) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -60,44 +61,44 @@ namespace CalamityMod.Projectiles.Melee if (posDiff.X < 0f) { owner.ChangeDir(1); - projectile.direction = 1; - projectile.spriteDirection = 1; - projectile.rotation += MathHelper.Pi; // keep dragon head facing up + Projectile.direction = 1; + Projectile.spriteDirection = 1; + Projectile.rotation += MathHelper.Pi; // keep dragon head facing up } else { owner.ChangeDir(-1); - projectile.direction = -1; - projectile.spriteDirection = -1; + Projectile.direction = -1; + Projectile.spriteDirection = -1; } // Keep the owner's hand out for as long as necessary and face it the right way - owner.itemRotation = (-1f * posDiff * (float)projectile.direction).ToRotation(); + owner.itemRotation = (-1f * posDiff * (float)Projectile.direction).ToRotation(); owner.itemAnimation = 6; owner.itemTime = 6; // If the flail is far enough out and still "heading out", then swap it to be returning float dist = posDiff.Length(); - if (projectile.ai[0] == 0f && dist > 800f) - projectile.ai[0] = 1f; + if (Projectile.ai[0] == 0f && dist > 800f) + Projectile.ai[0] = 1f; // Flail returning behavior - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { // If the flail gets way too far away, just destroy it if (dist > 1500f) { - projectile.Kill(); + Projectile.Kill(); return; } // Set velocity to be directly towards the player - projectile.velocity = posDiff.SafeNormalize(Vector2.Zero) * DragonPow.ReturnSpeed; + Projectile.velocity = posDiff.SafeNormalize(Vector2.Zero) * DragonPow.ReturnSpeed; // Once the flail is close enough to the player, destroy it if (posDiff.Length() < DragonPow.ReturnSpeed) { - projectile.Kill(); + Projectile.Kill(); return; } } @@ -108,38 +109,38 @@ namespace CalamityMod.Projectiles.Melee { int dustType = Main.rand.NextBool(3) ? 246 : 244; float scale = 0.8f + Main.rand.NextFloat(0.6f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); Main.dust[idx].noGravity = true; Main.dust[idx].scale = scale; Main.dust[idx].velocity *= 2f; - Main.dust[idx].velocity += projectile.velocity * 0.3f; + Main.dust[idx].velocity += Projectile.velocity * 0.3f; } // Increment the frame counter - ++projectile.ai[1]; + ++Projectile.ai[1]; // If the flail has been out for at least 5 frames, make it visible - projectile.alpha = (projectile.ai[1] > 5f) ? 0 : 255; + Projectile.alpha = (Projectile.ai[1] > 5f) ? 0 : 255; - if (projectile.ai[1] % 4 == 0) + if (Projectile.ai[1] % 4 == 0) { int type = ModContent.ProjectileType(); - int damage = projectile.damage / 8; + int damage = Projectile.damage / 8; float kb = 3f; float speed = DragonPow.SparkSpeed; Vector2 vel = new Vector2(speed, 0f).RotatedByRandom(MathHelper.TwoPi); - vel += projectile.velocity * 0.05f; + vel += Projectile.velocity * 0.05f; float sparkVariety = Main.rand.Next(3); - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, vel, type, damage, kb, projectile.owner, sparkVariety, 0f); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center, vel, type, damage, kb, Projectile.owner, sparkVariety, 0f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { // Only perform hit effects after reaching approximately 55% of the way out. - if (Main.player[projectile.owner].WithinRange(target.Center, 475f)) + if (Main.player[Projectile.owner].WithinRange(target.Center, 475f)) return; // Inflicts Daybroken, Abyssal Flames and Holy Flames for 3 seconds on-hit @@ -147,8 +148,8 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; PetalStorm(target.Center); Waterfalls(target.Center); @@ -157,15 +158,15 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitPvp(Player target, int damage, bool crit) { // Only perform hit effects after reaching approximately 55% of the way out. - if (projectile.WithinRange(Main.player[projectile.owner].Center, 475f)) + if (Projectile.WithinRange(Main.player[Projectile.owner].Center, 475f)) return; // Inflicts Abyssal Flames and Holy Flames for 8 seconds on-hit target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; PetalStorm(target.Center); Waterfalls(target.Center); @@ -174,18 +175,18 @@ namespace CalamityMod.Projectiles.Melee // Spawns a storm of flower petals on-hit. private void PetalStorm(Vector2 targetPos) { - Main.PlaySound(SoundID.Item105, targetPos); + SoundEngine.PlaySound(SoundID.Item105, targetPos); int type = ProjectileID.FlowerPetal; int numPetals = 12; - int petalDamage = projectile.damage / 8; + int petalDamage = Projectile.damage / 8; float petalKB = 0f; for (int i = 0; i < numPetals; ++i) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { float angle = Main.rand.NextFloat(MathHelper.TwoPi); - Projectile petal = CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(DragonPow.MinPetalSpeed, DragonPow.MaxPetalSpeed), type, petalDamage, petalKB, projectile.owner); + Projectile petal = CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(DragonPow.MinPetalSpeed, DragonPow.MaxPetalSpeed), type, petalDamage, petalKB, Projectile.owner); if (petal.whoAmI.WithinBounds(Main.maxProjectiles)) { petal.Calamity().forceMelee = true; @@ -201,7 +202,7 @@ namespace CalamityMod.Projectiles.Melee { int type = ModContent.ProjectileType(); int numWaterfalls = 12; - int waterfallDamage = projectile.damage / 6; + int waterfallDamage = Projectile.damage / 6; float waterfallKB = 0f; for (int i = 0; i < numWaterfalls; ++i) { @@ -212,9 +213,9 @@ namespace CalamityMod.Projectiles.Melee Vector2 fallVec = new Vector2(0f, fallSpeed); fallVec = fallVec.RotatedBy(Main.rand.NextFloat(-0.08f, 0.08f)); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int idx = Projectile.NewProjectile(startPos, fallVec, type, waterfallDamage, waterfallKB, projectile.owner, 0f, 0f); + int idx = Projectile.NewProjectile(startPos, fallVec, type, waterfallDamage, waterfallKB, Projectile.owner, 0f, 0f); Main.projectile[idx].timeLeft = 100; Main.projectile[idx].tileCollide = false; } @@ -224,11 +225,11 @@ namespace CalamityMod.Projectiles.Melee // PreDraw draws the flail's chain (underneath it, so it doesn't look weird) public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; Vector2 mountedCenter = owner.MountedCenter; Color transparent = Color.Transparent; - Texture2D chainTex = ModContent.GetTexture("CalamityMod/ExtraTextures/Chains/DragonPowChain"); - Vector2 chainDrawPos = projectile.Center; + Texture2D chainTex = ModContent.Request("CalamityMod/ExtraTextures/Chains/DragonPowChain"); + Vector2 chainDrawPos = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2(chainTex.Width * 0.5f, chainTex.Height * 0.5f); diff --git a/Projectiles/Melee/DragonRageFireball.cs b/Projectiles/Melee/DragonRageFireball.cs index 3f76ccf1af..93e348a60e 100644 --- a/Projectiles/Melee/DragonRageFireball.cs +++ b/Projectiles/Melee/DragonRageFireball.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,69 +15,69 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 64; - projectile.height = 66; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = lifeTime; - projectile.melee = true; + Projectile.width = 64; + Projectile.height = 66; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = lifeTime; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[0] = Main.rand.NextFloat(40f, 70f); - projectile.ai[1] = Main.rand.NextFloat(35f, 55f); + Projectile.ai[0] = Main.rand.NextFloat(40f, 70f); + Projectile.ai[1] = Main.rand.NextFloat(35f, 55f); } - target = projectile.Center.ClosestNPCAt(1200f); - projectile.frameCounter++; - if (projectile.frameCounter > 4) + target = Projectile.Center.ClosestNPCAt(1200f); + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; - if (target != null && projectile.timeLeft < lifeTime - 10) + if (target != null && Projectile.timeLeft < lifeTime - 10) { - float inertia = projectile.ai[0]; - float speed = projectile.ai[1]; - Vector2 moveDirection = projectile.SafeDirectionTo(target.Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * speed) / inertia; + float inertia = Projectile.ai[0]; + float speed = Projectile.ai[1]; + Vector2 moveDirection = Projectile.SafeDirectionTo(target.Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * speed) / inertia; } } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D projectileTexture = Main.projectileTexture[projectile.type]; - int frameHeight = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int frameY = frameHeight * projectile.frame; - Main.spriteBatch.Draw(projectileTexture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, projectileTexture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)projectileTexture.Width / 2f, (float)frameHeight / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D projectileTexture = Main.projectileTexture[Projectile.type]; + int frameHeight = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int frameY = frameHeight * Projectile.frame; + Main.spriteBatch.Draw(projectileTexture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, projectileTexture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)projectileTexture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 80); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 80); for (int d = 0; d < 5; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -86,16 +87,16 @@ namespace CalamityMod.Projectiles.Melee } for (int d = 0; d < 8; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + CalamityUtils.ExplosionGores(Projectile.Center, 3); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 245a27dcec..d6a1ce8549 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -19,55 +19,55 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = projectile.height = 408; - projectile.melee = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 90000; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.hide = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.Calamity().trueMelee = true; + Projectile.width = Projectile.height = 408; + Projectile.DamageType = DamageClass.Melee; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 90000; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.hide = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.Calamity().trueMelee = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float spinCycleTime = 50f; // If the player is dead, destroy the projectile if (player.dead || !player.channel) { - projectile.Kill(); + Projectile.Kill(); player.reuseDelay = 2; return; } - int direction = Math.Sign(projectile.velocity.X); - projectile.velocity = new Vector2(direction, 0f); + int direction = Math.Sign(Projectile.velocity.X); + Projectile.velocity = new Vector2(direction, 0f); // Initial Rotation - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.rotation = new Vector2(direction, -player.gravDir).ToRotation() + MathHelper.ToRadians(135f); - if (projectile.velocity.X < 0f) + Projectile.rotation = new Vector2(direction, -player.gravDir).ToRotation() + MathHelper.ToRadians(135f); + if (Projectile.velocity.X < 0f) { - projectile.rotation -= MathHelper.PiOver2; + Projectile.rotation -= MathHelper.PiOver2; } } - projectile.ai[0] += 1f; - projectile.rotation += MathHelper.TwoPi * 2f / spinCycleTime * (float)direction; + Projectile.ai[0] += 1f; + Projectile.rotation += MathHelper.TwoPi * 2f / spinCycleTime * (float)direction; int expectedDirection = (player.SafeDirectionTo(Main.MouseWorld).X > 0f).ToDirectionInt(); - if (projectile.ai[0] % spinCycleTime > spinCycleTime * 0.5f && expectedDirection != projectile.velocity.X) + if (Projectile.ai[0] % spinCycleTime > spinCycleTime * 0.5f && expectedDirection != Projectile.velocity.X) { player.ChangeDir(expectedDirection); - projectile.velocity = Vector2.UnitX * expectedDirection; - projectile.rotation -= MathHelper.Pi; - projectile.netUpdate = true; + Projectile.velocity = Vector2.UnitX * expectedDirection; + Projectile.rotation -= MathHelper.Pi; + Projectile.netUpdate = true; } SpawnDust(player, direction); PositionAndRotation(player); @@ -76,15 +76,15 @@ namespace CalamityMod.Projectiles.Melee private void SpawnDust(Player player, int direction) { - float num12 = projectile.rotation - MathHelper.PiOver4 * direction; - Vector2 value3 = projectile.Center + (num12 + ((direction == -1) ? MathHelper.Pi : 0f)).ToRotationVector2() * 30f; + float num12 = Projectile.rotation - MathHelper.PiOver4 * direction; + Vector2 value3 = Projectile.Center + (num12 + ((direction == -1) ? MathHelper.Pi : 0f)).ToRotationVector2() * 30f; Vector2 vector2 = num12.ToRotationVector2(); - Vector2 value4 = vector2.RotatedBy(MathHelper.PiOver2 * projectile.spriteDirection); + Vector2 value4 = vector2.RotatedBy(MathHelper.PiOver2 * Projectile.spriteDirection); if (Main.rand.NextBool(2)) { Dust dust = Dust.NewDustDirect(value3 - new Vector2(5f), 10, 10, 244, player.velocity.X, player.velocity.Y, 150, default, 1f); - dust.velocity = projectile.SafeDirectionTo(dust.position) * 0.1f + dust.velocity * 0.1f; + dust.velocity = Projectile.SafeDirectionTo(dust.position) * 0.1f + dust.velocity * 0.1f; } for (int j = 0; j < 4; j++) { @@ -106,8 +106,8 @@ namespace CalamityMod.Projectiles.Melee } if (Main.rand.Next(6) != 0) { - Dust dust = Dust.NewDustDirect(projectile.position, 0, 0, 244, 0f, 0f, 100, default, 1f); - dust.position = projectile.Center + vector2 * (60f + Main.rand.NextFloat() * 20f) * dustVelMult2; + Dust dust = Dust.NewDustDirect(Projectile.position, 0, 0, 244, 0f, 0f, 100, default, 1f); + dust.position = Projectile.Center + vector2 * (60f + Main.rand.NextFloat() * 20f) * dustVelMult2; dust.velocity = value4 * (4f + 4f * Main.rand.NextFloat()) * dustVelMult2 * dustVelMult; dust.noGravity = true; dust.noLight = true; @@ -124,22 +124,22 @@ namespace CalamityMod.Projectiles.Melee { Vector2 plrCtr = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 offset = Vector2.Zero; - projectile.Center = plrCtr + offset; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.Center = plrCtr + offset; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = player.itemAnimation = 2; - player.itemRotation = MathHelper.WrapAngle(projectile.rotation); + player.itemRotation = MathHelper.WrapAngle(Projectile.rotation); } private void VisibilityAndLight() { - Lighting.AddLight(projectile.Center, 1.45f, 1.22f, 0.58f); - projectile.alpha -= 128; - if (projectile.alpha < 0) + Lighting.AddLight(Projectile.Center, 1.45f, 1.22f, 0.58f); + Projectile.alpha -= 128; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } @@ -156,9 +156,9 @@ namespace CalamityMod.Projectiles.Melee private void OnHitEffects(Vector2 position) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); + CalamityPlayer modPlayer = Main.player[Projectile.owner].Calamity(); modPlayer.dragonRageHits++; if (modPlayer.dragonRageHits > 10) { @@ -166,7 +166,7 @@ namespace CalamityMod.Projectiles.Melee modPlayer.dragonRageHits = 0; } - int proj = Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); Main.projectile[proj].Calamity().forceMelee = true; } } @@ -182,25 +182,25 @@ namespace CalamityMod.Projectiles.Melee Vector2 velocity = new Vector2(0f, speed); velocity = velocity.RotatedBy(angleStep * i * Main.rand.NextFloat(0.9f, 1.1f)); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 8, projectile.knockBack / 3f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack / 3f, Projectile.owner); } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Player player = Main.player[projectile.owner]; - Rectangle myRect = projectile.Hitbox; - if (projectile.owner == Main.myPlayer) + Player player = Main.player[Projectile.owner]; + Rectangle myRect = Projectile.Hitbox; + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - bool voodooDolls = projectile.owner < Main.maxPlayers && (npc.type == NPCID.Guide && player.killGuide || npc.type == NPCID.Clothier && player.killClothier); - bool friendlyProjs = projectile.friendly && (!npc.friendly || voodooDolls); - bool hostileProjs = projectile.hostile && npc.friendly && !npc.dontTakeDamageFromHostiles; - if (npc.active && !npc.dontTakeDamage && (friendlyProjs || hostileProjs) && (projectile.owner < 0 || npc.immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) + bool voodooDolls = Projectile.owner < Main.maxPlayers && (npc.type == NPCID.Guide && player.killGuide || npc.type == NPCID.Clothier && player.killClothier); + bool friendlyProjs = Projectile.friendly && (!npc.friendly || voodooDolls); + bool hostileProjs = Projectile.hostile && npc.friendly && !npc.dontTakeDamageFromHostiles; + if (npc.active && !npc.dontTakeDamage && (friendlyProjs || hostileProjs) && (Projectile.owner < 0 || npc.immune[Projectile.owner] == 0 || Projectile.maxPenetrate == 1)) { - if (npc.noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(npc)) + if (npc.noTileCollide || !Projectile.ownerHitCheck || Projectile.CanHit(npc)) { bool canHit; Rectangle rect = npc.Hitbox; @@ -211,11 +211,11 @@ namespace CalamityMod.Projectiles.Melee rect.Y -= offset; rect.Width += offset * 2; rect.Height += offset * 2; - canHit = projectile.Colliding(myRect, rect); + canHit = Projectile.Colliding(myRect, rect); } else { - canHit = projectile.Colliding(myRect, rect); + canHit = Projectile.Colliding(myRect, rect); } if (canHit) { @@ -230,9 +230,9 @@ namespace CalamityMod.Projectiles.Melee public override void CutTiles() { float num5 = 60f; - float f = projectile.rotation - MathHelper.PiOver4 * (float)Math.Sign(projectile.velocity.X); + float f = Projectile.rotation - MathHelper.PiOver4 * (float)Math.Sign(Projectile.velocity.X); DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Utils.PlotTileLine(projectile.Center + f.ToRotationVector2() * -num5, projectile.Center + f.ToRotationVector2() * num5, (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Utils.PlotTileLine(Projectile.Center + f.ToRotationVector2() * -num5, Projectile.Center + f.ToRotationVector2() * num5, (float)Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -241,10 +241,10 @@ namespace CalamityMod.Projectiles.Melee { return true; } - float f = projectile.rotation - MathHelper.PiOver4 * (float)Math.Sign(projectile.velocity.X); + float f = Projectile.rotation - MathHelper.PiOver4 * (float)Math.Sign(Projectile.velocity.X); float num2 = 0f; float num3 = 110f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center + f.ToRotationVector2() * -num3, projectile.Center + f.ToRotationVector2() * num3, 23f * projectile.scale, ref num2)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + f.ToRotationVector2() * -num3, Projectile.Center + f.ToRotationVector2() * num3, 23f * Projectile.scale, ref num2)) { return true; } @@ -253,15 +253,15 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Texture2D tex = Main.projectileTexture[Projectile.type]; + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Rectangle rectangle = new Rectangle(0, 0, tex.Width, tex.Height); Vector2 origin = tex.Size() / 2f; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(tex, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(tex, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Melee/Earth2.cs b/Projectiles/Melee/Earth2.cs index 6f40ed47f2..05944bd1c5 100644 --- a/Projectiles/Melee/Earth2.cs +++ b/Projectiles/Melee/Earth2.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class Earth2 : ModProjectile @@ -16,16 +17,16 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.ignoreWater = true; - projectile.coldDamage = true; + Projectile.width = 34; + Projectile.height = 34; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; + Projectile.coldDamage = true; } public override void AI() @@ -34,62 +35,62 @@ namespace CalamityMod.Projectiles.Melee noTileHitCounter -= randomToSubtract; if (noTileHitCounter == 0) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item9, (int)Projectile.position.X, (int)Projectile.position.Y); } } - projectile.alpha -= 15; + Projectile.alpha -= 15; int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) + if (Projectile.Center.Y >= Projectile.ai[1]) { num58 = 0; } - if (projectile.alpha < num58) + if (Projectile.alpha < num58) { - projectile.alpha = num58; + Projectile.alpha = num58; } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; + Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; + Main.dust[num59].position = Projectile.Center + value3 * 12f; } if (Main.rand.NextBool(48)) { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + int num60 = Gore.NewGore(Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; + Main.gore[num60].velocity += Projectile.velocity * 0.3f; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.light = 0.9f; + Projectile.light = 0.9f; if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20)) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } - Lighting.AddLight(projectile.Center, 0f, 0f, 1.5f); + Lighting.AddLight(Projectile.Center, 0f, 0f, 1.5f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item10, (int)Projectile.position.X, (int)Projectile.position.Y); for (int k = 0; k < 15; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } diff --git a/Projectiles/Melee/Earth3.cs b/Projectiles/Melee/Earth3.cs index 135a5d8bc7..96270b6afa 100644 --- a/Projectiles/Melee/Earth3.cs +++ b/Projectiles/Melee/Earth3.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class Earth3 : ModProjectile @@ -17,15 +18,15 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.ignoreWater = true; + Projectile.width = 34; + Projectile.height = 34; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; } public override void AI() @@ -34,68 +35,68 @@ namespace CalamityMod.Projectiles.Melee noTileHitCounter -= randomToSubtract; if (noTileHitCounter == 0) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item9, (int)Projectile.position.X, (int)Projectile.position.Y); } } - projectile.alpha -= 15; + Projectile.alpha -= 15; int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) + if (Projectile.Center.Y >= Projectile.ai[1]) { num58 = 0; } - if (projectile.alpha < num58) + if (Projectile.alpha < num58) { - projectile.alpha = num58; + Projectile.alpha = num58; } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; + Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; + Main.dust[num59].position = Projectile.Center + value3 * 12f; } if (Main.rand.NextBool(48)) { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + int num60 = Gore.NewGore(Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; + Main.gore[num60].velocity += Projectile.velocity * 0.3f; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.light = 0.9f; + Projectile.light = 0.9f; if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20)) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } - Lighting.AddLight(projectile.Center, 1.5f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 1.5f, 0f, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 30; - projectile.height = 30; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 30; + Projectile.height = 30; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -105,13 +106,13 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 35; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Earth4.cs b/Projectiles/Melee/Earth4.cs index 2841912167..792f621a15 100644 --- a/Projectiles/Melee/Earth4.cs +++ b/Projectiles/Melee/Earth4.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class Earth4 : ModProjectile @@ -17,15 +18,15 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.ignoreWater = true; + Projectile.width = 34; + Projectile.height = 34; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; } public override void AI() @@ -34,68 +35,68 @@ namespace CalamityMod.Projectiles.Melee noTileHitCounter -= randomToSubtract; if (noTileHitCounter == 0) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item9, (int)Projectile.position.X, (int)Projectile.position.Y); } } - projectile.alpha -= 15; + Projectile.alpha -= 15; int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) + if (Projectile.Center.Y >= Projectile.ai[1]) { num58 = 0; } - if (projectile.alpha < num58) + if (Projectile.alpha < num58) { - projectile.alpha = num58; + Projectile.alpha = num58; } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; + Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 74, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; + Main.dust[num59].position = Projectile.Center + value3 * 12f; } if (Main.rand.NextBool(48)) { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + int num60 = Gore.NewGore(Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; + Main.gore[num60].velocity += Projectile.velocity * 0.3f; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.light = 0.9f; + Projectile.light = 0.9f; if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 74, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20)) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } - Lighting.AddLight(projectile.Center, 0f, 1.5f, 0f); + Lighting.AddLight(Projectile.Center, 0f, 1.5f, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item10, (int)Projectile.position.X, (int)Projectile.position.Y); for (int k = 0; k < 15; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 74, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(SoundID.Item4, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item4, (int)Projectile.position.X, (int)Projectile.position.Y); float healAmt = damage * 0.075f; if ((int)healAmt == 0) @@ -107,7 +108,7 @@ namespace CalamityMod.Projectiles.Melee if (healAmt > CalamityMod.lifeStealCap) healAmt = CalamityMod.lifeStealCap; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); } } } diff --git a/Projectiles/Melee/EarthProj.cs b/Projectiles/Melee/EarthProj.cs index 2969555772..6395be85a3 100644 --- a/Projectiles/Melee/EarthProj.cs +++ b/Projectiles/Melee/EarthProj.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -17,15 +18,15 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ignoreWater = true; + Projectile.width = 34; + Projectile.height = 34; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.ignoreWater = true; } public override void AI() @@ -34,28 +35,28 @@ namespace CalamityMod.Projectiles.Melee noTileHitCounter -= randomToSubtract; if (noTileHitCounter == 0) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item9, (int)Projectile.position.X, (int)Projectile.position.Y); } } - projectile.alpha -= 15; + Projectile.alpha -= 15; int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) + if (Projectile.Center.Y >= Projectile.ai[1]) { num58 = 0; } - if (projectile.alpha < num58) + if (Projectile.alpha < num58) { - projectile.alpha = num58; + Projectile.alpha = num58; } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; + Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; int dustChoice = Main.rand.Next(3); if (dustChoice == 0) { @@ -71,36 +72,36 @@ namespace CalamityMod.Projectiles.Melee } if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustChoice, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustChoice, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; + Main.dust[num59].position = Projectile.Center + value3 * 12f; } if (Main.rand.NextBool(48)) { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + int num60 = Gore.NewGore(Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; + Main.gore[num60].velocity += Projectile.velocity * 0.3f; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.light = 0.9f; + Projectile.light = 0.9f; if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, dustChoice, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustChoice, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20)) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0.5f); } public override void Kill(int timeLeft) { float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; @@ -120,10 +121,10 @@ namespace CalamityMod.Projectiles.Melee projChoice = ModContent.ProjectileType(); } offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projChoice, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projChoice, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projChoice, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projChoice, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } - Main.PlaySound(SoundID.Item10, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item10, (int)Projectile.position.X, (int)Projectile.position.Y); for (int k = 0; k < 15; k++) { int dustChoice = Main.rand.Next(3); @@ -139,7 +140,7 @@ namespace CalamityMod.Projectiles.Melee { dustChoice = 244; } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustChoice, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustChoice, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } diff --git a/Projectiles/Melee/ElementBall.cs b/Projectiles/Melee/ElementBall.cs index 53cb0a0fab..896bb34282 100644 --- a/Projectiles/Melee/ElementBall.cs +++ b/Projectiles/Melee/ElementBall.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.tileCollide = false; - projectile.timeLeft = 150; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; + Projectile.timeLeft = 150; } public override void AI() { - int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int num250 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[num250].noGravity = true; Main.dust[num250].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/ElementBallShiv.cs b/Projectiles/Melee/ElementBallShiv.cs index c13213519b..f5219a307c 100644 --- a/Projectiles/Melee/ElementBallShiv.cs +++ b/Projectiles/Melee/ElementBallShiv.cs @@ -16,28 +16,28 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 120; - projectile.aiStyle = 27; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 120; + Projectile.aiStyle = 27; } public override void AI() { - int rainbow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); Main.dust[rainbow].noGravity = true; Main.dust[rainbow].velocity = Vector2.Zero; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 115) + if (Projectile.timeLeft > 115) return false; return true; @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 4; k++) { - int rainbow = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[rainbow].noGravity = true; } } @@ -72,9 +72,9 @@ namespace CalamityMod.Projectiles.Melee { for (int x = 0; x < 4; x++) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, x > 2, 800f, 800f, 0f, 800f, 1f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, false, 50f); + CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, x > 2, 800f, 800f, 0f, 800f, 1f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, false, 50f); } } } diff --git a/Projectiles/Melee/ElementalExcaliburBeam.cs b/Projectiles/Melee/ElementalExcaliburBeam.cs index dc18b67d8d..087cb43f1f 100644 --- a/Projectiles/Melee/ElementalExcaliburBeam.cs +++ b/Projectiles/Melee/ElementalExcaliburBeam.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class ElementalExcaliburBeam : ModProjectile @@ -15,67 +16,67 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - projectile.timeLeft = 1200; - projectile.extraUpdates = 3; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.timeLeft = 1200; + Projectile.extraUpdates = 3; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (!playedSound) { - Main.PlaySound(SoundID.Item60, projectile.Center); + SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); playedSound = true; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 250) + Projectile.scale -= 0.01f; + Projectile.alpha += 15; + if (Projectile.alpha >= 250) { - projectile.alpha = 255; - projectile.localAI[0] = 1f; + Projectile.alpha = 255; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[0] = 0f; + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; } } Color color = new Color(255, 0, 0, alpha); - switch ((int)projectile.ai[0]) + switch ((int)Projectile.ai[0]) { case 0: // Red, normal beam break; @@ -83,22 +84,22 @@ namespace CalamityMod.Projectiles.Melee case 1: // Orange, curve back to player color = new Color(255, 128, 0, alpha); - int p = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 220f && projectile.ai[1] > 60f) + int p = (int)Player.FindClosest(Projectile.Center, 1, 1); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] < 220f && Projectile.ai[1] > 60f) { - float homeSpeed = projectile.velocity.Length(); - Vector2 vecToPlayer = Main.player[p].Center - projectile.Center; + float homeSpeed = Projectile.velocity.Length(); + Vector2 vecToPlayer = Main.player[p].Center - Projectile.Center; vecToPlayer.Normalize(); vecToPlayer *= homeSpeed; - projectile.velocity = (projectile.velocity * 24f + vecToPlayer) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= homeSpeed; + Projectile.velocity = (Projectile.velocity * 24f + vecToPlayer) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= homeSpeed; } - if (projectile.velocity.Length() < 24f) + if (Projectile.velocity.Length() < 24f) { - projectile.velocity *= 1.02f; + Projectile.velocity *= 1.02f; } break; @@ -106,21 +107,21 @@ namespace CalamityMod.Projectiles.Melee case 2: // Yellow, split after a certain time color = new Color(255, 255, 0, alpha); - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 180f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] >= 180f) { - projectile.localAI[1] = 0f; + Projectile.localAI[1] = 0f; int numProj = 2; float rotation = MathHelper.ToRadians(10); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj + 1; i++) { - Vector2 perturbedSpeed = projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center, perturbedSpeed * 0.5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.Center, perturbedSpeed * 0.5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } } - projectile.Kill(); + Projectile.Kill(); } break; @@ -131,19 +132,19 @@ namespace CalamityMod.Projectiles.Melee float inertia = 75f; float homingSpeed = 7.5f; float minDist = 80f; - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (projectile.Distance(Main.player[projectile.owner].Center) > minDist) + if (Projectile.Distance(Main.player[Projectile.owner].Center) > minDist) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * homingSpeed) / inertia; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * homingSpeed) / inertia; } } else { - if (projectile.timeLeft > 30) + if (Projectile.timeLeft > 30) { - projectile.timeLeft = 30; + Projectile.timeLeft = 30; } } @@ -152,17 +153,17 @@ namespace CalamityMod.Projectiles.Melee case 4: // Green, home in on enemies color = new Color(0, 255, 0, alpha); - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 6f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 6f, 20f); break; case 5: // Turquoise, speed up and don't collide with tiles color = new Color(0, 255, 128, alpha); - projectile.tileCollide = false; - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 28f) + Projectile.tileCollide = false; + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 28f) { - projectile.velocity *= 1.035f; + Projectile.velocity *= 1.035f; } break; @@ -182,18 +183,18 @@ namespace CalamityMod.Projectiles.Melee case 9: // Purple, speed up and slow down over and over color = new Color(128, 0, 255, alpha); - projectile.localAI[1] += 1f; - if (projectile.localAI[1] <= 40f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] <= 40f) { - projectile.velocity *= 0.95f; + Projectile.velocity *= 0.95f; } - else if (projectile.localAI[1] > 40f && projectile.localAI[1] <= 79f) + else if (Projectile.localAI[1] > 40f && Projectile.localAI[1] <= 79f) { - projectile.velocity *= 1.05f; + Projectile.velocity *= 1.05f; } - else if (projectile.localAI[1] == 80f) + else if (Projectile.localAI[1] == 80f) { - projectile.localAI[1] = 0f; + Projectile.localAI[1] = 0f; } break; @@ -201,28 +202,28 @@ namespace CalamityMod.Projectiles.Melee case 10: // Fuschia, start slow then get faster color = new Color(255, 0, 255, alpha); - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - projectile.velocity *= 0.1f; - projectile.localAI[1] += 1f; + Projectile.velocity *= 0.1f; + Projectile.localAI[1] += 1f; } - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; break; case 11: // Hot Pink, split into fuschia while travelling color = new Color(255, 0, 128, alpha); - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - projectile.velocity *= 0.33f; + Projectile.velocity *= 0.33f; } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 181f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] >= 181f) { - projectile.localAI[1] = 1f; - if (Main.myPlayer == projectile.owner) - Projectile.NewProjectile(projectile.Center + projectile.velocity, projectile.velocity, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 10f, 0f); + Projectile.localAI[1] = 1f; + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.Center + Projectile.velocity, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, 10f, 0f); } break; @@ -233,7 +234,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(2)) { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 267, 0f, 0f, alpha, color, 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 267, 0f, 0f, alpha, color, 1.5f); Main.dust[dust].noGravity = true; } } @@ -242,13 +243,13 @@ namespace CalamityMod.Projectiles.Melee { target.ExoDebuffs(2f); - if (projectile.ai[0] == 7f) + if (Projectile.ai[0] == 7f) { - projectile.velocity *= 0.25f; + Projectile.velocity *= 0.25f; } - else if (projectile.ai[0] == 8f) + else if (Projectile.ai[0] == 8f) { - projectile.velocity *= -1f; + Projectile.velocity *= -1f; } } @@ -256,27 +257,27 @@ namespace CalamityMod.Projectiles.Melee { target.ExoDebuffs(2f); - if (projectile.ai[0] == 7f) + if (Projectile.ai[0] == 7f) { - projectile.velocity *= 0.25f; + Projectile.velocity *= 0.25f; } - else if (projectile.ai[0] == 8f) + else if (Projectile.ai[0] == 8f) { - projectile.velocity *= -1f; + Projectile.velocity *= -1f; } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } return false; } @@ -286,7 +287,7 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) { Color color = new Color(255, 0, 0, alpha); - switch ((int)projectile.ai[0]) + switch ((int)Projectile.ai[0]) { case 0: // Red break; @@ -331,24 +332,24 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 1195) + if (Projectile.timeLeft > 1195) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 64); - projectile.maxPenetrate = projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 64); + Projectile.maxPenetrate = Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); Color color = new Color(255, 0, 0, alpha); - switch ((int)projectile.ai[0]) + switch ((int)Projectile.ai[0]) { case 0: // Red break; @@ -376,9 +377,9 @@ namespace CalamityMod.Projectiles.Melee bool fromRight = x == 1; if (x == 2) fromRight = Main.rand.NextBool(2); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ProjectileBarrage(projectile.Center, projectile.Center, fromRight, 500f, 500f, 0f, 500f, 5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.2), projectile.knockBack * 0.2f, projectile.owner, false, 0f).ai[0] = 5f; + CalamityUtils.ProjectileBarrage(Projectile.Center, Projectile.Center, fromRight, 500f, 500f, 0f, 500f, 5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.2), Projectile.knockBack * 0.2f, Projectile.owner, false, 0f).ai[0] = 5f; } } @@ -405,15 +406,15 @@ namespace CalamityMod.Projectiles.Melee for (int d = 0; d < 3; d++) { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 267, 0f, 0f, alpha, color, 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 267, 0f, 0f, alpha, color, 1.5f); Main.dust[dust].noGravity = true; } for (int d = 0; d < 30; d++) { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 267, 0f, 0f, alpha, color, 2.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 267, 0f, 0f, alpha, color, 2.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 3f; - dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 267, 0f, 0f, alpha, color, 1.5f); + dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 267, 0f, 0f, alpha, color, 1.5f); Main.dust[dust].velocity *= 2f; Main.dust[dust].noGravity = true; } diff --git a/Projectiles/Melee/ElementalGlassStar.cs b/Projectiles/Melee/ElementalGlassStar.cs index 6e89bad527..75eb460abd 100644 --- a/Projectiles/Melee/ElementalGlassStar.cs +++ b/Projectiles/Melee/ElementalGlassStar.cs @@ -5,107 +5,108 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class ElementalGlassStar : ModProjectile { const float MaxTime = 120; - public float Timer => MaxTime - projectile.timeLeft; + public float Timer => MaxTime - Projectile.timeLeft; public override void SetStaticDefaults() { DisplayName.SetDefault("Glass Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = (int)MaxTime; - projectile.scale = 1.5f; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = (int)MaxTime; + Projectile.scale = 1.5f; } public override void AI() { if (Timer == 0) { - Particle spark = new FlareShine(projectile.Center, Vector2.Zero, Color.White, Color.OrangeRed, 0f,new Vector2(0.5f, 1f), new Vector2(1.5f, 3f), 20, 0f, hueShift: 0.01f); + Particle spark = new FlareShine(Projectile.Center, Vector2.Zero, Color.White, Color.OrangeRed, 0f,new Vector2(0.5f, 1f), new Vector2(1.5f, 3f), 20, 0f, hueShift: 0.01f); GeneralParticleHandler.SpawnParticle(spark); for (int i = 0; i < 2; i++) { - Vector2 particleSpeed = projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.8f) * 0.1f; - Particle energyLeak = new SquishyLightParticle(projectile.Center, particleSpeed, Main.rand.NextFloat(0.8f, 1.4f), Color.Cyan, 60, 0.3f, 1.5f, hueShift: 0.02f); + Vector2 particleSpeed = Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.8f) * 0.1f; + Particle energyLeak = new SquishyLightParticle(Projectile.Center, particleSpeed, Main.rand.NextFloat(0.8f, 1.4f), Color.Cyan, 60, 0.3f, 1.5f, hueShift: 0.02f); GeneralParticleHandler.SpawnParticle(energyLeak); } } - if (projectile.timeLeft < MaxTime - 5) + if (Projectile.timeLeft < MaxTime - 5) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } if (Timer / MaxTime > 0.25f) { - projectile.velocity *= 0.95f; + Projectile.velocity *= 0.95f; } if (Main.rand.Next(3) == 0) { int dustType = Main.rand.Next(3); dustType = dustType == 0 ? 15 : dustType == 1 ? 57 : 58; - Dust.NewDust(projectile.Center, 14, 14, dustType, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 150, default, 1.3f); + Dust.NewDust(Projectile.Center, 14, 14, dustType, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 150, default, 1.3f); } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); } } if (Main.rand.NextBool(48)) { - int starGore = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + int starGore = Gore.NewGore(Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[starGore].velocity *= 0.66f; - Main.gore[starGore].velocity += projectile.velocity * 0.3f; + Main.gore[starGore].velocity += Projectile.velocity * 0.3f; } - if (projectile.velocity.Length() < 2f && projectile.timeLeft < (int)(MaxTime / 2f)) + if (Projectile.velocity.Length() < 2f && Projectile.timeLeft < (int)(MaxTime / 2f)) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 350f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 350f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D starTexture = ModContent.GetTexture("CalamityMod/Particles/Sparkle"); - Texture2D bloomTexture = ModContent.GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D starTexture = ModContent.Request("CalamityMod/Particles/Sparkle"); + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; Color color = Main.hslToRgb((float)Math.Sin(Main.GlobalTime * 15f) * 0.05f + 0.08f, 1, 0.55f); float rotation = Main.GlobalTime * 8f; - Vector2 sparkCenter = projectile.Center - Main.screenPosition; + Vector2 sparkCenter = Projectile.Center - Main.screenPosition; spriteBatch.Draw(bloomTexture, sparkCenter, null, color * 0.6f, 0, bloomTexture.Size() / 2f, 4f * properBloomSize, SpriteEffects.None, 0); spriteBatch.Draw(starTexture, sparkCenter, null, color, rotation + MathHelper.PiOver4, starTexture.Size() / 2f, 2f * 0.75f, SpriteEffects.None, 0); @@ -120,20 +121,20 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - var breakSound = Main.PlaySound(SoundID.DD2_WitherBeastDeath, projectile.Center); + var breakSound = SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath, Projectile.Center); if (breakSound != null) breakSound.Volume *= 0.5f; for (int i = 0; i < 2; i++) { Vector2 particleSpeed = Main.rand.NextVector2CircularEdge(1, 1) * Main.rand.NextFloat(5.2f, 4.3f); - Particle spark = new CritSpark(projectile.Center, particleSpeed, Color.White, Color.Cyan, Main.rand.NextFloat(1.3f, 1.6f), 40, 0.1f, 3.5f, hueShift: 0.02f); + Particle spark = new CritSpark(Projectile.Center, particleSpeed, Color.White, Color.Cyan, Main.rand.NextFloat(1.3f, 1.6f), 40, 0.1f, 3.5f, hueShift: 0.02f); GeneralParticleHandler.SpawnParticle(spark); } for (int i = 0; i < 3; i++) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } } } diff --git a/Projectiles/Melee/EmpyreanKnife.cs b/Projectiles/Melee/EmpyreanKnife.cs index 23faf7c9ad..57521eb083 100644 --- a/Projectiles/Melee/EmpyreanKnife.cs +++ b/Projectiles/Melee/EmpyreanKnife.cs @@ -14,54 +14,54 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Empyrean Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.extraUpdates = 1; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 1; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 75f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 75f) { - projectile.alpha += 10; - projectile.damage = (int)(projectile.damage * 0.95); - projectile.knockBack = projectile.knockBack * 0.95f; - if (projectile.alpha >= 255) - projectile.active = false; + Projectile.alpha += 10; + Projectile.damage = (int)(Projectile.damage * 0.95); + Projectile.knockBack = Projectile.knockBack * 0.95f; + if (Projectile.alpha >= 255) + Projectile.active = false; } - if (projectile.ai[0] < 75f) - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + if (Projectile.ai[0] < 75f) + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; else { - projectile.rotation += 0.5f; + Projectile.rotation += 0.5f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 150f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 150f, 12f, 20f); if (Main.rand.NextBool(6)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 58, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } public override bool OnTileCollide(Vector2 oldVelocity) { bounce--; if (bounce <= 0) - projectile.Kill(); + Projectile.Kill(); else { - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; } return false; } @@ -70,10 +70,10 @@ namespace CalamityMod.Projectiles.Melee { for (int num303 = 0; num303 < 3; num303++) { - int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.8f); + int num304 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 58, 0f, 0f, 100, default, 0.8f); Main.dust[num304].noGravity = true; Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; + Main.dust[num304].velocity -= Projectile.oldVelocity * 0.3f; } } @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee if (healAmt > CalamityMod.lifeStealCap) healAmt = CalamityMod.lifeStealCap; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); } public override void OnHitPvp(Player target, int damage, bool crit) @@ -104,12 +104,12 @@ namespace CalamityMod.Projectiles.Melee if (healAmt > CalamityMod.lifeStealCap) healAmt = CalamityMod.lifeStealCap; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/EonBolt.cs b/Projectiles/Melee/EonBolt.cs index aad04a6f48..62090ac125 100644 --- a/Projectiles/Melee/EonBolt.cs +++ b/Projectiles/Melee/EonBolt.cs @@ -17,68 +17,68 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/GalaxiaBolt"; public NPC target; - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; - public ref float Hue => ref projectile.ai[0]; - public ref float HomingStrenght => ref projectile.ai[1]; + public ref float Hue => ref Projectile.ai[0]; + public ref float HomingStrenght => ref Projectile.ai[1]; Particle Head; public override void SetStaticDefaults() { DisplayName.SetDefault("Eon Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 80; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 80; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Head == null) { - Head = new GenericSparkle(projectile.Center, Vector2.Zero, Color.White, Main.hslToRgb(Hue, 100, 50), 1.2f, 2, 0.06f, 3, true); + Head = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Main.hslToRgb(Hue, 100, 50), 1.2f, 2, 0.06f, 3, true); GeneralParticleHandler.SpawnParticle(Head); } else { - Head.Position = projectile.Center + projectile.velocity * 0.5f; + Head.Position = Projectile.Center + Projectile.velocity * 0.5f; Head.Time = 0; - Head.Scale += (float)Math.Sin(Main.GlobalTime * 6) * 0.02f * projectile.scale; + Head.Scale += (float)Math.Sin(Main.GlobalTime * 6) * 0.02f * Projectile.scale; } if (target == null) - target = projectile.Center.ClosestNPCAt(812f, true); + target = Projectile.Center.ClosestNPCAt(812f, true); - else if (CalamityUtils.AngleBetween(projectile.velocity, target.Center - projectile.Center) < MathHelper.Pi) //Home in + else if (CalamityUtils.AngleBetween(Projectile.velocity, target.Center - Projectile.Center) < MathHelper.Pi) //Home in { - float idealDirection = projectile.AngleTo(target.Center); - float updatedDirection = projectile.velocity.ToRotation().AngleTowards(idealDirection, HomingStrenght); - projectile.velocity = updatedDirection.ToRotationVector2() * projectile.velocity.Length() * 0.995f; + float idealDirection = Projectile.AngleTo(target.Center); + float updatedDirection = Projectile.velocity.ToRotation().AngleTowards(idealDirection, HomingStrenght); + Projectile.velocity = updatedDirection.ToRotationVector2() * Projectile.velocity.Length() * 0.995f; } - Lighting.AddLight(projectile.Center, 0.75f, 1f, 0.24f); + Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); if (Main.rand.Next(2) == 0) { - Particle smoke = new HeavySmokeParticle(projectile.Center, projectile.velocity * 0.5f, Color.Lerp(Color.DodgerBlue, Color.MediumVioletRed, (float)Math.Sin(Main.GlobalTime * 6f)), 20, Main.rand.NextFloat(0.6f, 1.2f) * projectile.scale, 0.28f, 0, false, 0, true); + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, Color.Lerp(Color.DodgerBlue, Color.MediumVioletRed, (float)Math.Sin(Main.GlobalTime * 6f)), 20, Main.rand.NextFloat(0.6f, 1.2f) * Projectile.scale, 0.28f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); if (Main.rand.Next(3) == 0) { - Particle smokeGlow = new HeavySmokeParticle(projectile.Center, projectile.velocity * 0.5f, Main.hslToRgb(Hue, 1, 0.7f), 15, Main.rand.NextFloat(0.4f, 0.7f) * projectile.scale, 0.8f, 0, true, 0.05f, true); + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, Main.hslToRgb(Hue, 1, 0.7f), 15, Main.rand.NextFloat(0.4f, 0.7f) * Projectile.scale, 0.8f, 0, true, 0.05f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } } @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee internal Color ColorFunction(float completionRatio) { float fadeToEnd = MathHelper.Lerp(0.65f, 1f, (float)Math.Cos(-Main.GlobalTime * 3f) * 0.5f + 0.5f); - float fadeOpacity = Utils.InverseLerp(1f, 0.64f, completionRatio, true) * projectile.Opacity; + float fadeOpacity = Utils.InverseLerp(1f, 0.64f, completionRatio, true) * Projectile.Opacity; Color colorHue = Main.hslToRgb(Hue, 1, 0.8f); Color endColor = Color.Lerp(colorHue, Color.PaleTurquoise, (float)Math.Sin(completionRatio * MathHelper.Pi * 1.6f - Main.GlobalTime * 4f) * 0.5f + 0.5f); @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Melee internal float WidthFunction(float completionRatio) { float expansionCompletion = (float)Math.Pow(1 - completionRatio, 3); - return MathHelper.Lerp(0f, 22 * projectile.scale * projectile.Opacity, expansionCompletion); + return MathHelper.Lerp(0f, 22 * Projectile.scale * Projectile.Opacity, expansionCompletion); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -105,11 +105,11 @@ namespace CalamityMod.Projectiles.Melee if (TrailDrawer is null) TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/ScarletDevilStreak")); - TrailDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f - Main.screenPosition, 30); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/ScarletDevilStreak")); + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 30); Texture2D texture = GetTexture("CalamityMod/Projectiles/Melee/GalaxiaBolt"); - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.5f), projectile.rotation, texture.Size() / 2f, projectile.scale, SpriteEffects.None, 0); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.5f), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/EssenceBeam.cs b/Projectiles/Melee/EssenceBeam.cs index fe7bc5ac19..22661c08a9 100644 --- a/Projectiles/Melee/EssenceBeam.cs +++ b/Projectiles/Melee/EssenceBeam.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -12,62 +13,62 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Essence Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.aiStyle = 27; + Projectile.width = 26; + Projectile.height = 26; + Projectile.aiStyle = 27; aiType = ProjectileID.LightBeam; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 10; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 10; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 600; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.6f, 0f, 0.2f); + Lighting.AddLight(Projectile.Center, 0.6f, 0f, 0.2f); } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - target.immune[projectile.owner] = 2; + target.immune[Projectile.owner] = 2; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); int num3; for (int num795 = 4; num795 < 31; num795 = num3 + 1) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 173, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / (float)num795); + float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 173, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 173, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 173, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[num798]; dust.velocity *= 0.05f; num3 = num795; diff --git a/Projectiles/Melee/EssenceFireball.cs b/Projectiles/Melee/EssenceFireball.cs index fed5d215e1..50cb47bce4 100644 --- a/Projectiles/Melee/EssenceFireball.cs +++ b/Projectiles/Melee/EssenceFireball.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class EssenceFireball : ModProjectile @@ -12,60 +13,60 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Fireball"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 120; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); + Projectile.localAI[0] = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) + if (Projectile.frame > 5) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - int dust = Dust.NewDust(new Vector2(projectile.position.X + projectile.velocity.X, projectile.position.Y + projectile.velocity.Y), projectile.width, projectile.height, 173, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.2f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X + Projectile.velocity.X, Projectile.position.Y + Projectile.velocity.Y), Projectile.width, Projectile.height, 173, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.2f); Main.dust[dust].noGravity = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 115) + if (Projectile.timeLeft > 115) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -76,14 +77,14 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item74, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item74, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -93,18 +94,18 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 10; - projectile.Damage(); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 10; + Projectile.Damage(); } } } diff --git a/Projectiles/Melee/EssenceFlame2.cs b/Projectiles/Melee/EssenceFlame2.cs index 037c22e413..d04fd0cdc4 100644 --- a/Projectiles/Melee/EssenceFlame2.cs +++ b/Projectiles/Melee/EssenceFlame2.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class EssenceFlame2 : ModProjectile @@ -11,53 +12,53 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.timeLeft = 180; - projectile.alpha = 255; - projectile.extraUpdates = 3; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 180; + Projectile.alpha = 255; + Projectile.extraUpdates = 3; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.alpha -= 5; + Projectile.alpha -= 5; - projectile.frameCounter++; - if (projectile.frameCounter > 16) + Projectile.frameCounter++; + if (Projectile.frameCounter > 16) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 10f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 10f, 20f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item74, projectile.Center); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -67,10 +68,10 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 8; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index dd57ac7f52..a6b7b458b6 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -12,40 +12,40 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 100; - projectile.height = 78; - projectile.aiStyle = 18; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.alpha = 55; - projectile.penetrate = 10; - projectile.timeLeft = 300; - projectile.ignoreWater = true; + Projectile.width = 100; + Projectile.height = 78; + Projectile.aiStyle = 18; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.alpha = 55; + Projectile.penetrate = 10; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; aiType = ProjectileID.DeathSickle; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.65f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.65f / 255f); if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -53,17 +53,17 @@ namespace CalamityMod.Projectiles.Melee { Vector2 origin = new Vector2(50f, 39f); Color color = Color.White; - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); color = new Color((int)b2, (int)b2, (int)b2, (int)a2); } SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, 1f, spriteEffects, 0f); + spriteBatch.Draw(Main.projectileTexture[Projectile.type], Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, 1f, spriteEffects, 0f); } public override Color? GetAlpha(Color lightColor) @@ -73,12 +73,12 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 2; + target.immune[Projectile.owner] = 2; target.AddBuff(ModContent.BuffType(), 180); if (target.life <= 0) { - if (projectile.owner == Main.myPlayer) - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], 8, ModContent.ProjectileType(), 1200f, 0f); + if (Projectile.owner == Main.myPlayer) + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 8, ModContent.ProjectileType(), 1200f, 0f); } } } diff --git a/Projectiles/Melee/EutrophicScimitarProj.cs b/Projectiles/Melee/EutrophicScimitarProj.cs index 741613ab66..1f56c652b2 100644 --- a/Projectiles/Melee/EutrophicScimitarProj.cs +++ b/Projectiles/Melee/EutrophicScimitarProj.cs @@ -10,17 +10,17 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Scimitar Zap"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.melee = true; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.DamageType = DamageClass.Melee; } public override Color? GetAlpha(Color lightColor) @@ -35,30 +35,30 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.35f / 255f); - projectile.frameCounter++; - if (projectile.frameCounter > 2) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); + Projectile.frameCounter++; + if (Projectile.frameCounter > 2) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 2) + if (Projectile.frame > 2) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } else { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } if (Main.rand.NextBool(2)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 226, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 226, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.5f); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } public override void Kill(int timeLeft) @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i <= 10; i++) { Dust dust; - Vector2 position = new Vector2(projectile.position.X - 4, projectile.position.Y - 4); + Vector2 position = new Vector2(Projectile.position.X - 4, Projectile.position.Y - 4); dust = Main.dust[Terraria.Dust.NewDust(position, 58, 58, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.4605263f)]; dust.noGravity = true; dust.fadeIn = 0.9473684f; diff --git a/Projectiles/Melee/EutrophicSpark.cs b/Projectiles/Melee/EutrophicSpark.cs index 2b4c64eb7c..52a7bf8038 100644 --- a/Projectiles/Melee/EutrophicSpark.cs +++ b/Projectiles/Melee/EutrophicSpark.cs @@ -14,47 +14,47 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 30; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.melee = true; + Projectile.width = 6; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 30; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + Projectile.velocity.X = Projectile.velocity.X * -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + Projectile.rotation += Projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[num199]; expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; @@ -74,14 +74,14 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + Projectile.velocity.X = Projectile.velocity.X * 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) + Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } diff --git a/Projectiles/Melee/ExcelsusBlue.cs b/Projectiles/Melee/ExcelsusBlue.cs index 1f638c888e..26ac7e0f2e 100644 --- a/Projectiles/Melee/ExcelsusBlue.cs +++ b/Projectiles/Melee/ExcelsusBlue.cs @@ -16,50 +16,50 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.alpha = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 34; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 300; + Projectile.alpha = 100; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f && projectile.timeLeft > 85) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 16f && Projectile.timeLeft > 85) { - projectile.velocity *= 1.05f; + Projectile.velocity *= 1.05f; } - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) > 0f && Projectile.timeLeft <= 85) { - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f; if (Main.rand.NextBool(8)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.tileCollide = false; - if (projectile.timeLeft > 85) + Projectile.tileCollide = false; + if (Projectile.timeLeft > 85) { - projectile.timeLeft = 85; + Projectile.timeLeft = 85; } return false; } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -68,17 +68,17 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Color color; - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); color = new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -87,14 +87,14 @@ namespace CalamityMod.Projectiles.Melee color = new Color(255, 255, 255, 100); } Vector2 origin = new Vector2(39f, 46f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/ExcelsusBlueGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Melee/ExcelsusBlueGlow"), Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.timeLeft > 85) + if (Projectile.timeLeft > 85) { - projectile.timeLeft = 85; + Projectile.timeLeft = 85; } target.AddBuff(BuffID.Frostburn, 180); } diff --git a/Projectiles/Melee/ExcelsusMain.cs b/Projectiles/Melee/ExcelsusMain.cs index a3a031f27b..2f8b33df3d 100644 --- a/Projectiles/Melee/ExcelsusMain.cs +++ b/Projectiles/Melee/ExcelsusMain.cs @@ -16,50 +16,50 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.alpha = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 34; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 300; + Projectile.alpha = 100; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 20f && projectile.timeLeft > 85) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 20f && Projectile.timeLeft > 85) { - projectile.velocity *= 1.05f; + Projectile.velocity *= 1.05f; } - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) > 0f && Projectile.timeLeft <= 85) { - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f; if (Main.rand.NextBool(8)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.NextBool(3) ? 56 : 242, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.tileCollide = false; - if (projectile.timeLeft > 85) + Projectile.tileCollide = false; + if (Projectile.timeLeft > 85) { - projectile.timeLeft = 85; + Projectile.timeLeft = 85; } return false; } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -68,17 +68,17 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Color color; - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); color = new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -87,14 +87,14 @@ namespace CalamityMod.Projectiles.Melee color = new Color(255, 255, 255, 100); } Vector2 origin = new Vector2(39f, 46f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/ExcelsusMainGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Melee/ExcelsusMainGlow"), Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.timeLeft > 85) + if (Projectile.timeLeft > 85) { - projectile.timeLeft = 85; + Projectile.timeLeft = 85; } target.AddBuff(BuffID.OnFire, 180); target.AddBuff(BuffID.Frostburn, 90); diff --git a/Projectiles/Melee/ExcelsusPink.cs b/Projectiles/Melee/ExcelsusPink.cs index c42ec3eba5..0e3136bcad 100644 --- a/Projectiles/Melee/ExcelsusPink.cs +++ b/Projectiles/Melee/ExcelsusPink.cs @@ -16,50 +16,50 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.alpha = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 34; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 300; + Projectile.alpha = 100; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 24f && projectile.timeLeft > 85) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 24f && Projectile.timeLeft > 85) { - projectile.velocity *= 1.05f; + Projectile.velocity *= 1.05f; } - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) > 0f && Projectile.timeLeft <= 85) { - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f; if (Main.rand.NextBool(8)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 242, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 242, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.tileCollide = false; - if (projectile.timeLeft > 85) + Projectile.tileCollide = false; + if (Projectile.timeLeft > 85) { - projectile.timeLeft = 85; + Projectile.timeLeft = 85; } return false; } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -68,17 +68,17 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Color color; - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); color = new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -87,14 +87,14 @@ namespace CalamityMod.Projectiles.Melee color = new Color(255, 255, 255, 100); } Vector2 origin = new Vector2(39f, 46f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/ExcelsusPinkGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Melee/ExcelsusPinkGlow"), Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.timeLeft > 85) + if (Projectile.timeLeft > 85) { - projectile.timeLeft = 85; + Projectile.timeLeft = 85; } target.AddBuff(BuffID.OnFire, 240); } diff --git a/Projectiles/Melee/ExoGladComet.cs b/Projectiles/Melee/ExoGladComet.cs index 91a4eee816..e91ab9d4ee 100644 --- a/Projectiles/Melee/ExoGladComet.cs +++ b/Projectiles/Melee/ExoGladComet.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class ExoGladComet : ModProjectile @@ -12,60 +13,60 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Comet"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = 1; - projectile.alpha = 50; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.alpha = 50; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) + if (Projectile.frame > 4) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.timeLeft > 30 && projectile.alpha > 0) + if (Projectile.timeLeft > 30 && Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (Projectile.timeLeft > 30 && Projectile.alpha < 128 && Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.alpha = 128; + Projectile.alpha = 128; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.alpha < 40) + if (Projectile.alpha < 40) { - int num309 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + int num309 = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X * 4f + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y * 4f), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); Main.dust[num309].velocity *= -0.25f; - num309 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + num309 = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X * 4f + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y * 4f), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); Main.dust[num309].velocity *= -0.25f; - Main.dust[num309].position -= projectile.velocity * 0.5f; + Main.dust[num309].position -= Projectile.velocity * 0.5f; } - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.5f); - projectile.velocity *= 1.005f; + Lighting.AddLight(Projectile.Center, 0f, 0.5f, 0.5f); + Projectile.velocity *= 1.005f; - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -80,32 +81,32 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(0, 255, 255, projectile.alpha); + return new Color(0, 255, 255, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 103, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = projectile.height = 80; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Zombie, (int)Projectile.position.X, (int)Projectile.position.Y, 103, 1f, 0f); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 80; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } diff --git a/Projectiles/Melee/ExoGladProj.cs b/Projectiles/Melee/ExoGladProj.cs index 220a068154..9519d81d6a 100644 --- a/Projectiles/Melee/ExoGladProj.cs +++ b/Projectiles/Melee/ExoGladProj.cs @@ -17,13 +17,13 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; } public override void AI() @@ -45,17 +45,17 @@ namespace CalamityMod.Projectiles.Melee } Vector2 offset = Vector2.UnitX * -12f; offset = -Vector2.UnitY.RotatedBy((double)(counter * 0.1308997f + (float)i * MathHelper.Pi), default) * value7; - int exo = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1.5f); + int exo = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1.5f); Main.dust[exo].noGravity = true; - Main.dust[exo].position = projectile.Center + offset; - Main.dust[exo].velocity = projectile.velocity; - int dusters = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f); + Main.dust[exo].position = Projectile.Center + offset; + Main.dust[exo].velocity = Projectile.velocity; + int dusters = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.8f); Main.dust[dusters].noGravity = true; Main.dust[dusters].velocity *= 0f; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 250f, 12f, 20f); } public override void Kill(int timeLeft) @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Melee }); for (int k = 0; k < 4; k++) { - int exo = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType, (float)(projectile.direction * 2), 0f, 150, default, 1f); + int exo = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, (float)(Projectile.direction * 2), 0f, 150, default, 1f); Main.dust[exo].noGravity = true; } } @@ -87,20 +87,20 @@ namespace CalamityMod.Projectiles.Melee private void OnHitEffects(Vector2 targetPos) { - float swordKB = projectile.knockBack; - int swordDmg = (int)(projectile.damage * 0.25); + float swordKB = Projectile.knockBack; + int swordDmg = (int)(Projectile.damage * 0.25); int numSwords = Main.rand.Next(1,4); int spearAmt = Main.rand.Next(1,4); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numSwords; ++i) { - CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(24f, 30f), ModContent.ProjectileType(), swordDmg, swordKB, projectile.owner); + CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(24f, 30f), ModContent.ProjectileType(), swordDmg, swordKB, Projectile.owner); } for (int n = 0; n < spearAmt; n++) { - CalamityUtils.ProjectileRain(targetPos, 400f, 100f, -1000f, -800f, 29f, ModContent.ProjectileType(), swordDmg, swordKB, projectile.owner); + CalamityUtils.ProjectileRain(targetPos, 400f, 100f, -1000f, -800f, 29f, ModContent.ProjectileType(), swordDmg, swordKB, Projectile.owner); } } } diff --git a/Projectiles/Melee/ExoGladSpears.cs b/Projectiles/Melee/ExoGladSpears.cs index eeb251f801..132d313a26 100644 --- a/Projectiles/Melee/ExoGladSpears.cs +++ b/Projectiles/Melee/ExoGladSpears.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class ExoGladSpears : ModProjectile @@ -11,53 +12,53 @@ namespace CalamityMod.Projectiles.Melee private Color currentColor = Color.Black; - internal ref float FlySpeedMultiplier => ref projectile.ai[1]; + internal ref float FlySpeedMultiplier => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Gladius Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.timeLeft = 600; - projectile.melee = true; - projectile.tileCollide = false; - projectile.extraUpdates = 1; + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - NPC potentialTarget = projectile.Center.ClosestNPCAt(1000f); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(1000f); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 8f) / 21f; - else if (projectile.Distance(Main.player[projectile.owner].Center) > 1000f) + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 8f) / 21f; + else if (Projectile.Distance(Main.player[Projectile.owner].Center) > 1000f) { float inertia = 25f * FlySpeedMultiplier; - Vector2 directionToOwner = (Main.player[projectile.owner].Center - projectile.Center).SafeNormalize(Vector2.UnitY); - projectile.velocity = (projectile.velocity * (inertia - 1f) + directionToOwner * 5f * FlySpeedMultiplier) / inertia; + Vector2 directionToOwner = (Main.player[Projectile.owner].Center - Projectile.Center).SafeNormalize(Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + directionToOwner * 5f * FlySpeedMultiplier) / inertia; } } - else if (projectile.timeLeft > 30) - projectile.timeLeft = 30; + else if (Projectile.timeLeft > 30) + Projectile.timeLeft = 30; - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); if (currentColor == Color.Black) { int startPoint = Main.rand.Next(6); - projectile.localAI[0] = startPoint; + Projectile.localAI[0] = startPoint; currentColor = GetStartingColor(startPoint); } - Visuals(projectile, ref currentColor); + Visuals(Projectile, ref currentColor); } internal static void Visuals(Projectile projectile, ref Color c) @@ -85,19 +86,19 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 64); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item74, (int)projectile.position.X, (int)projectile.position.Y); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 64); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item74, (int)Projectile.position.X, (int)Projectile.position.Y); int dustType = Utils.SelectRandom(Main.rand, new int[] { 107, @@ -106,15 +107,15 @@ namespace CalamityMod.Projectiles.Melee }); for (int i = 0; i < 6; i++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0, 0); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0, 0); } for (int i = 0; i < 10; i++) { - Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, dustType, 0, 0); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustType, 0, 0); dust.noGravity = true; dust.velocity *= 3f; - dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, dustType, 0, 0); + dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustType, 0, 0); dust.velocity *= 2f; dust.noGravity = true; } diff --git a/Projectiles/Melee/ExoGladiusBeam.cs b/Projectiles/Melee/ExoGladiusBeam.cs index 29819129a6..7572805da0 100644 --- a/Projectiles/Melee/ExoGladiusBeam.cs +++ b/Projectiles/Melee/ExoGladiusBeam.cs @@ -19,66 +19,66 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Gladius Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.penetrate = penetrationAmt; - projectile.timeLeft = 290; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.extraUpdates = 1; - projectile.tileCollide = false; + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.penetrate = penetrationAmt; + Projectile.timeLeft = 290; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.extraUpdates = 1; + Projectile.tileCollide = false; } public override void AI() { if (!initialized) { - startYVelSign = (float)Math.Sign(projectile.velocity.Y) * 0.35f; + startYVelSign = (float)Math.Sign(Projectile.velocity.Y) * 0.35f; initialized = true; } - if (projectile.penetrate == penetrationAmt && projectile.timeLeft < 245) + if (Projectile.penetrate == penetrationAmt && Projectile.timeLeft < 245) { - projectile.velocity.Y -= startYVelSign; //arc on the X axis (the amount of pressure on this tiny detail made me want to tear my head off) - if (Math.Abs(projectile.velocity.X) < 30f) + Projectile.velocity.Y -= startYVelSign; //arc on the X axis (the amount of pressure on this tiny detail made me want to tear my head off) + if (Math.Abs(Projectile.velocity.X) < 30f) { - projectile.velocity.X *= 1.04f; + Projectile.velocity.X *= 1.04f; } } - if (projectile.velocity.Length() != 0) + if (Projectile.velocity.Length() != 0) { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.Pi / 4; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.Pi / 4; } else { - projectile.rotation += MathHelper.Pi / 6f / (projectile.scale * 2.5f); + Projectile.rotation += MathHelper.Pi / 6f / (Projectile.scale * 2.5f); } - projectile.ai[0]++; - if (projectile.ai[1] >= 0) + Projectile.ai[0]++; + if (Projectile.ai[1] >= 0) { - projectile.ai[1]--; - if (projectile.ai[1] == 0) + Projectile.ai[1]--; + if (Projectile.ai[1] == 0) { - projectile.velocity *= -0.9f; + Projectile.velocity *= -0.9f; } } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); if (currentColor == Color.Black) { int startPoint = Main.rand.Next(6); - projectile.localAI[0] = startPoint; + Projectile.localAI[0] = startPoint; currentColor = GetStartingColor(startPoint); } - Visuals(projectile, ref currentColor); + Visuals(Projectile, ref currentColor); } internal static void Visuals(Projectile projectile, ref Color c) @@ -109,22 +109,22 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.scale += (maxScale - 1) / (float)penetrationAmt; - projectile.ai[1] = 5 + Main.rand.Next(-2, 3); + Projectile.scale += (maxScale - 1) / (float)penetrationAmt; + Projectile.ai[1] = 5 + Main.rand.Next(-2, 3); target.ExoDebuffs(); } public override void OnHitPvp(Player target, int damage, bool crit) { - projectile.scale += (maxScale - 1) / (float)penetrationAmt; - projectile.ai[1] = 5 + Main.rand.Next(-2, 3); + Projectile.scale += (maxScale - 1) / (float)penetrationAmt; + Projectile.ai[1] = 5 + Main.rand.Next(-2, 3); target.ExoDebuffs(); } diff --git a/Projectiles/Melee/Exobeam.cs b/Projectiles/Melee/Exobeam.cs index 54b1a78b45..8094fa4856 100644 --- a/Projectiles/Melee/Exobeam.cs +++ b/Projectiles/Melee/Exobeam.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class Exobeam : ModProjectile @@ -13,30 +14,30 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.light = 1f; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 600; + Projectile.light = 1f; } public override void AI() { - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - Main.PlaySound(SoundID.Item60, (int)projectile.position.X, (int)projectile.position.Y); - projectile.localAI[1] += 1f; + SoundEngine.PlaySound(SoundID.Item60, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.localAI[1] += 1f; } counter++; if (counter == 12) @@ -44,93 +45,93 @@ namespace CalamityMod.Projectiles.Melee counter = 0; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 107, 0f, 0f, 160, new Color(0, 255, 255), 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 107, 0f, 0f, 160, new Color(0, 255, 255), 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } - projectile.alpha -= 40; - if (projectile.alpha < 0) + Projectile.alpha -= 40; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 90f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 90f) { - projectile.localAI[0] = 0f; - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.localAI[0] = 0f; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } } - else if (projectile.ai[0] == 1f) + else if (Projectile.ai[0] == 1f) { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 60f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 60f) { - projectile.localAI[0] = 0f; - projectile.ai[0] = 2f; - projectile.ai[1] = (float)Player.FindClosest(projectile.position, projectile.width, projectile.height); - projectile.netUpdate = true; + Projectile.localAI[0] = 0f; + Projectile.ai[0] = 2f; + Projectile.ai[1] = (float)Player.FindClosest(Projectile.position, Projectile.width, Projectile.height); + Projectile.netUpdate = true; } } - else if (projectile.ai[0] == 2f) + else if (Projectile.ai[0] == 2f) { - Vector2 vector70 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; + Vector2 vector70 = Main.player[(int)Projectile.ai[1]].Center - Projectile.Center; if (vector70.Length() < 30f) { - projectile.Kill(); + Projectile.Kill(); return; } vector70.Normalize(); vector70 *= 14f; - vector70 = Vector2.Lerp(projectile.velocity, vector70, 0.6f); + vector70 = Vector2.Lerp(Projectile.velocity, vector70, 0.6f); if (vector70.Y < 24f) { vector70.Y = 24f; } float num804 = 0.4f; - if (projectile.velocity.X < vector70.X) + if (Projectile.velocity.X < vector70.X) { - projectile.velocity.X = projectile.velocity.X + num804; - if (projectile.velocity.X < 0f && vector70.X > 0f) + Projectile.velocity.X = Projectile.velocity.X + num804; + if (Projectile.velocity.X < 0f && vector70.X > 0f) { - projectile.velocity.X = projectile.velocity.X + num804; + Projectile.velocity.X = Projectile.velocity.X + num804; } } - else if (projectile.velocity.X > vector70.X) + else if (Projectile.velocity.X > vector70.X) { - projectile.velocity.X = projectile.velocity.X - num804; - if (projectile.velocity.X > 0f && vector70.X < 0f) + Projectile.velocity.X = Projectile.velocity.X - num804; + if (Projectile.velocity.X > 0f && vector70.X < 0f) { - projectile.velocity.X = projectile.velocity.X - num804; + Projectile.velocity.X = Projectile.velocity.X - num804; } } - if (projectile.velocity.Y < vector70.Y) + if (Projectile.velocity.Y < vector70.Y) { - projectile.velocity.Y = projectile.velocity.Y + num804; - if (projectile.velocity.Y < 0f && vector70.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num804; + if (Projectile.velocity.Y < 0f && vector70.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y + num804; + Projectile.velocity.Y = Projectile.velocity.Y + num804; } } - else if (projectile.velocity.Y > vector70.Y) + else if (Projectile.velocity.Y > vector70.Y) { - projectile.velocity.Y = projectile.velocity.Y - num804; - if (projectile.velocity.Y > 0f && vector70.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num804; + if (Projectile.velocity.Y > 0f && vector70.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y - num804; + Projectile.velocity.Y = Projectile.velocity.Y - num804; } } } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -145,40 +146,40 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) { - return new Color(0, 255, 255, projectile.alpha); + return new Color(0, 255, 255, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 192; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Zombie, (int)projectile.Center.X, (int)projectile.Center.Y, 103); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 192; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Zombie, (int)Projectile.Center.X, (int)Projectile.Center.Y, 103); for (int num193 = 0; num193 < 3; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 30; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } diff --git a/Projectiles/Melee/Exoboom.cs b/Projectiles/Melee/Exoboom.cs index 453f35e5bf..41d41b606b 100644 --- a/Projectiles/Melee/Exoboom.cs +++ b/Projectiles/Melee/Exoboom.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class Exoboom : ModProjectile @@ -16,60 +17,60 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 250; + Projectile.height = 250; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 30; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0.75f / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.75f / 255f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item74, (int)projectile.position.X, (int)projectile.position.Y); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item74, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.localAI[0] += 1f; } bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -80,11 +81,11 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index a5dc934e68..e8881d7e9c 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class Exocomet : ModProjectile @@ -11,70 +12,70 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Comet"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = 1; - projectile.alpha = 50; - projectile.timeLeft = 360; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.alpha = 50; + Projectile.timeLeft = 360; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 240 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 240 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) - projectile.frame = 0; + if (Projectile.frame > 4) + Projectile.frame = 0; - if (projectile.timeLeft > 30 && projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - projectile.alpha = 128; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.timeLeft > 30 && Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.timeLeft > 30 && Projectile.alpha < 128 && Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + Projectile.alpha = 128; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - if (projectile.alpha < 40) + if (Projectile.alpha < 40) { - int num309 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + int num309 = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X * 4f + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y * 4f), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); Main.dust[num309].velocity *= -0.25f; - num309 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + num309 = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X * 4f + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y * 4f), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); Main.dust[num309].velocity *= -0.25f; - Main.dust[num309].position -= projectile.velocity * 0.5f; + Main.dust[num309].position -= Projectile.velocity * 0.5f; } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.5f); + Lighting.AddLight(Projectile.Center, 0f, 0.5f, 0.5f); - if (projectile.timeLeft < 240) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 12f, 20f); + if (Projectile.timeLeft < 240) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 12f, 20f); else { - float num953 = 100f * projectile.ai[1]; - float scaleFactor12 = 20f * projectile.ai[1]; + float num953 = 100f * Projectile.ai[1]; + float scaleFactor12 = 20f * Projectile.ai[1]; float num954 = 40f; - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + if (Projectile.Distance(Main.player[Projectile.owner].Center) > num954) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; } } } @@ -94,7 +95,7 @@ namespace CalamityMod.Projectiles.Melee if (healAmt > CalamityMod.lifeStealCap) healAmt = CalamityMod.lifeStealCap; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); } public override void OnHitPvp(Player target, int damage, bool crit) @@ -111,37 +112,37 @@ namespace CalamityMod.Projectiles.Melee if (healAmt > CalamityMod.lifeStealCap) healAmt = CalamityMod.lifeStealCap; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(0, 255, 255, projectile.alpha); + return new Color(0, 255, 255, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 103, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = projectile.height = 80; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Zombie, (int)Projectile.position.X, (int)Projectile.position.Y, 103, 1f, 0f); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 80; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } diff --git a/Projectiles/Melee/FallenPaladinsHammerProj.cs b/Projectiles/Melee/FallenPaladinsHammerProj.cs index 07b4d1ef17..b974d55e5f 100644 --- a/Projectiles/Melee/FallenPaladinsHammerProj.cs +++ b/Projectiles/Melee/FallenPaladinsHammerProj.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,86 +17,86 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Fallen Paladin's Hammer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 62; - projectile.height = 62; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 2; + Projectile.width = 62; + Projectile.height = 62; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 2; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.35f, 0.35f, 0f); - if (projectile.soundDelay == 0) + Lighting.AddLight(Projectile.Center, 0.35f, 0.35f, 0f); + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 30f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 30f) { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } } else { - projectile.tileCollide = false; + Projectile.tileCollide = false; float num42 = 16f; float num43 = 3.2f; - Vector2 vector2 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - vector2.Y; + Vector2 vector2 = new Vector2(Projectile.position.X + Projectile.width * 0.5f, Projectile.position.Y + Projectile.height * 0.5f); + float num44 = Main.player[Projectile.owner].position.X + Main.player[Projectile.owner].width / 2 - vector2.X; + float num45 = Main.player[Projectile.owner].position.Y + Main.player[Projectile.owner].height / 2 - vector2.Y; float num46 = (float)Math.Sqrt(num44 * num44 + num45 * num45); if (num46 > 3000f) - projectile.Kill(); + Projectile.Kill(); num46 = num42 / num46; num44 *= num46; num45 *= num46; - if (projectile.velocity.X < num44) + if (Projectile.velocity.X < num44) { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - projectile.velocity.X = projectile.velocity.X + num43; + Projectile.velocity.X = Projectile.velocity.X + num43; + if (Projectile.velocity.X < 0f && num44 > 0f) + Projectile.velocity.X = Projectile.velocity.X + num43; } - else if (projectile.velocity.X > num44) + else if (Projectile.velocity.X > num44) { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - projectile.velocity.X = projectile.velocity.X - num43; + Projectile.velocity.X = Projectile.velocity.X - num43; + if (Projectile.velocity.X > 0f && num44 < 0f) + Projectile.velocity.X = Projectile.velocity.X - num43; } - if (projectile.velocity.Y < num45) + if (Projectile.velocity.Y < num45) { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - projectile.velocity.Y = projectile.velocity.Y + num43; + Projectile.velocity.Y = Projectile.velocity.Y + num43; + if (Projectile.velocity.Y < 0f && num45 > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num43; } - else if (projectile.velocity.Y > num45) + else if (Projectile.velocity.Y > num45) { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - projectile.velocity.Y = projectile.velocity.Y - num43; + Projectile.velocity.Y = Projectile.velocity.Y - num43; + if (Projectile.velocity.Y > 0f && num45 < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num43; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + Rectangle rectangle = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[Projectile.owner].position.X, (int)Main.player[Projectile.owner].position.Y, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height); if (rectangle.Intersects(value2)) - projectile.Kill(); + Projectile.Kill(); } } - projectile.rotation += 0.5f; + Projectile.rotation += 0.5f; } public override Color? GetAlpha(Color lightColor) @@ -117,9 +118,9 @@ namespace CalamityMod.Projectiles.Melee private void OnHitEffect() { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMelee = true; } @@ -127,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Feather.cs b/Projectiles/Melee/Feather.cs index 351cdad56a..e3f43336e5 100644 --- a/Projectiles/Melee/Feather.cs +++ b/Projectiles/Melee/Feather.cs @@ -15,18 +15,18 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 150; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 150; + Projectile.aiStyle = 1; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; } public override void Kill(int timeLeft) @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee int num3; for (int num611 = 0; num611 < 10; num611 = num3 + 1) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 64, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 1f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 64, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); num3 = num611; } } diff --git a/Projectiles/Melee/Flarefrost.cs b/Projectiles/Melee/Flarefrost.cs index 2ad586eacf..83d822a178 100644 --- a/Projectiles/Melee/Flarefrost.cs +++ b/Projectiles/Melee/Flarefrost.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,23 +17,23 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.melee = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { Vector2 value7 = new Vector2(5f, 10f); - Lighting.AddLight(projectile.Center, 0.25f, 0f, 0.25f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) + Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0.25f); + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 48f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } else { @@ -40,28 +41,28 @@ namespace CalamityMod.Projectiles.Melee { int dustType = num41 == 0 ? 67 : 174; Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); + value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = dustType == 67 ? 1.5f : 1f; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f); + Main.dust[num42].position = Projectile.Center + value8; + Main.dust[num42].velocity = Projectile.velocity; + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.8f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0f; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 250f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 250f, 12f, 20f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.Center); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int k = 0; k < 2; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs index 3f2732484c..c76f2c829d 100644 --- a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs +++ b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs @@ -11,31 +11,31 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Oathblade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 46; - projectile.height = 46; - projectile.aiStyle = 18; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = true; - projectile.penetrate = 3; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 46; + Projectile.height = 46; + Projectile.aiStyle = 18; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = true; + Projectile.penetrate = 3; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; aiType = ProjectileID.DemonScythe; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.35f); + Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0.35f); if (Main.rand.NextBool(3)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/GaelExplosion.cs b/Projectiles/Melee/GaelExplosion.cs index 6e7c23f023..61e0742bf8 100644 --- a/Projectiles/Melee/GaelExplosion.cs +++ b/Projectiles/Melee/GaelExplosion.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -18,60 +19,60 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 45; - projectile.height = 45; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 15; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = GaelsGreatsword.ImmunityFrames; + Projectile.width = 45; + Projectile.height = 45; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 15; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = GaelsGreatsword.ImmunityFrames; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0.75f / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.75f / 255f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item74, projectile.Center); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); + Projectile.localAI[0] += 1f; } bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -82,10 +83,10 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 218, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; + Main.dust[num467].position.X = Projectile.Center.X; + Main.dust[num467].position.Y = Projectile.Center.Y; Dust dust = Main.dust[num467]; dust.position.X += (float)Main.rand.Next(-10, 11); dust = Main.dust[num467]; diff --git a/Projectiles/Melee/GaelSkull.cs b/Projectiles/Melee/GaelSkull.cs index d3a52dace3..5bef47d20e 100644 --- a/Projectiles/Melee/GaelSkull.cs +++ b/Projectiles/Melee/GaelSkull.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class GaelSkull : ModProjectile @@ -12,154 +13,154 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Ark of the Cosmos' Superior Cousin"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - Main.projFrames[projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.timeLeft = 600; - projectile.light = 1f; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = GaelsGreatsword.ImmunityFrames; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 600; + Projectile.light = 1f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = GaelsGreatsword.ImmunityFrames; } public override void AI() { //Targeting - if (projectile.scale <= 1f) + if (Projectile.scale <= 1f) { - NPC target = projectile.Center.ClosestNPCAt(GaelsGreatsword.SearchDistance); - projectile.tileCollide = target != null; //Go through walls if we're hunting an NPC + NPC target = Projectile.Center.ClosestNPCAt(GaelsGreatsword.SearchDistance); + Projectile.tileCollide = target != null; //Go through walls if we're hunting an NPC if (target != null) { - float distanceFromTarget = projectile.Distance(target.Center); - float homingSpeed = projectile.velocity.Length() * (distanceFromTarget < 220f ? 1.25f : 1f); + float distanceFromTarget = Projectile.Distance(target.Center); + float homingSpeed = Projectile.velocity.Length() * (distanceFromTarget < 220f ? 1.25f : 1f); if (homingSpeed > 22f) homingSpeed = 22f; - Vector2 idealVelocity = projectile.SafeDirectionTo(target.Center) * homingSpeed; + Vector2 idealVelocity = Projectile.SafeDirectionTo(target.Center) * homingSpeed; - float inertia = projectile.Distance(target.Center) < 240f ? 4f : 13f; - projectile.velocity = (projectile.velocity * inertia + idealVelocity) / (inertia + 1f); + float inertia = Projectile.Distance(target.Center) < 240f ? 4f : 13f; + Projectile.velocity = (Projectile.velocity * inertia + idealVelocity) / (inertia + 1f); if (distanceFromTarget < 300f) - projectile.velocity = projectile.velocity.MoveTowards(idealVelocity, 2f); - projectile.velocity.Normalize(); - projectile.velocity *= homingSpeed; + Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 2f); + Projectile.velocity.Normalize(); + Projectile.velocity *= homingSpeed; } } //Rotation - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (-projectile.velocity).ToRotation(); + Projectile.spriteDirection = -1; + Projectile.rotation = (-Projectile.velocity).ToRotation(); } else { - projectile.spriteDirection = 1; - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.spriteDirection = 1; + Projectile.rotation = Projectile.velocity.ToRotation(); } //Dust circle - projectile.ai[0] += 1f; - if (projectile.ai[0] % 20 == 0f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] % 20 == 0f) { for (int l = 0; l < 14; l++) { - Vector2 spawnPositionAdditive = Vector2.UnitX * (float)-(float)projectile.width / 2f; - spawnPositionAdditive += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.TwoPi / 14f), default) * new Vector2(8f, 16f) * projectile.scale; - spawnPositionAdditive = spawnPositionAdditive.RotatedBy((double)(projectile.rotation), default); - int dustIndex = Dust.NewDust(projectile.Center, 0, 0, 218, 0f, 0f, 0, new Color(188, 126, 154), 1.5f); + Vector2 spawnPositionAdditive = Vector2.UnitX * (float)-(float)Projectile.width / 2f; + spawnPositionAdditive += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.TwoPi / 14f), default) * new Vector2(8f, 16f) * Projectile.scale; + spawnPositionAdditive = spawnPositionAdditive.RotatedBy((double)(Projectile.rotation), default); + int dustIndex = Dust.NewDust(Projectile.Center, 0, 0, 218, 0f, 0f, 0, new Color(188, 126, 154), 1.5f); Main.dust[dustIndex].noGravity = true; - Main.dust[dustIndex].position = projectile.Center + spawnPositionAdditive; - Main.dust[dustIndex].velocity = projectile.velocity * 0.1f; - Main.dust[dustIndex].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[dustIndex].position) * 1.25f; + Main.dust[dustIndex].position = Projectile.Center + spawnPositionAdditive; + Main.dust[dustIndex].velocity = Projectile.velocity * 0.1f; + Main.dust[dustIndex].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[dustIndex].position) * 1.25f; } } //Frame logic - projectile.frameCounter++; - if (projectile.frameCounter % 5 == 0) + Projectile.frameCounter++; + if (Projectile.frameCounter % 5 == 0) { - projectile.frame++; + Projectile.frame++; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } //Fat skull logic - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - if (projectile.localAI[0] == 0f && !NPC.downedMoonlord) + if (Projectile.localAI[0] == 0f && !NPC.downedMoonlord) { - projectile.penetrate = -1; - projectile.localAI[0] = 1f; + Projectile.penetrate = -1; + Projectile.localAI[0] = 1f; } else if (NPC.downedMoonlord) { - projectile.penetrate = 5; + Projectile.penetrate = 5; } - projectile.alpha += 1; - projectile.damage = (int)Math.Ceiling(projectile.damage * 0.992); //Exponentially decays to a factor of 0.12896 of the original damage - if (projectile.alpha >= 255) + Projectile.alpha += 1; + Projectile.damage = (int)Math.Ceiling(Projectile.damage * 0.992); //Exponentially decays to a factor of 0.12896 of the original damage + if (Projectile.alpha >= 255) { - projectile.Kill(); + Projectile.Kill(); } } - else if (projectile.alpha > 0) + else if (Projectile.alpha > 0) { - projectile.alpha -= 15; - if (projectile.alpha < 0) + Projectile.alpha -= 15; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 240; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - if (projectile.scale == 1.75f) - projectile.damage /= 2; - projectile.Damage(); - Main.PlaySound((int)SoundType.NPCKilled, (int)projectile.Center.X, (int)projectile.Center.Y, 52, 0.4f); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 240; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + if (Projectile.scale == 1.75f) + Projectile.damage /= 2; + Projectile.Damage(); + SoundEngine.PlaySound((int)SoundType.NPCKilled, (int)Projectile.Center.X, (int)Projectile.Center.Y, 52, 0.4f); for (int i = 0; i < 3; i++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 218, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 100, default, 1.5f); } for (int i = 0; i < 30; i++) { float angle = MathHelper.TwoPi * i / 30f; - int dustIndex = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 218, 0f, 0f, 0, default, 2.5f); + int dustIndex = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 0, default, 2.5f); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].velocity *= 3f; - dustIndex = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 218, 0f, 0f, 100, default, 1.5f); + dustIndex = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 100, default, 1.5f); Main.dust[dustIndex].velocity *= 2f; Main.dust[dustIndex].noGravity = true; - Dust.NewDust(projectile.Center + angle.ToRotationVector2() * 160f, 0, 0, 218, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.Center + angle.ToRotationVector2() * 160f, 0, 0, 218, 0f, 0f, 100, default, 1.5f); } } } diff --git a/Projectiles/Melee/GaelSkull2.cs b/Projectiles/Melee/GaelSkull2.cs index 615aaa1b4b..3005fda8c7 100644 --- a/Projectiles/Melee/GaelSkull2.cs +++ b/Projectiles/Melee/GaelSkull2.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class GaelSkull2 : ModProjectile @@ -13,129 +14,129 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Ark of the Cosmos' Superior Cousin"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - Main.projFrames[projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.timeLeft = 600; - projectile.light = 1f; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = GaelsGreatsword.ImmunityFrames; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 600; + Projectile.light = 1f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = GaelsGreatsword.ImmunityFrames; } public override void AI() { //Rotation - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (-projectile.velocity).ToRotation(); + Projectile.spriteDirection = -1; + Projectile.rotation = (-Projectile.velocity).ToRotation(); } else { - projectile.spriteDirection = 1; - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.spriteDirection = 1; + Projectile.rotation = Projectile.velocity.ToRotation(); } - projectile.ai[0] += 1f; - if (projectile.localAI[1] == 1f && projectile.ai[0] < 35f) + Projectile.ai[0] += 1f; + if (Projectile.localAI[1] == 1f && Projectile.ai[0] < 35f) { - projectile.velocity.Y += 0.5f; + Projectile.velocity.Y += 0.5f; return; } //Targeting - NPC target = projectile.Center.ClosestNPCAt(GaelsGreatsword.SearchDistance); - projectile.tileCollide = target != null; //Go through walls if we're hunting an NPC + NPC target = Projectile.Center.ClosestNPCAt(GaelsGreatsword.SearchDistance); + Projectile.tileCollide = target != null; //Go through walls if we're hunting an NPC if (target != null) { - float homingSpeed = projectile.velocity.Length() * (projectile.Distance(target.Center) < 220f ? 1.3f : 1f); - Vector2 idealVelocity = projectile.SafeDirectionTo(target.Center) * homingSpeed; + float homingSpeed = Projectile.velocity.Length() * (Projectile.Distance(target.Center) < 220f ? 1.3f : 1f); + Vector2 idealVelocity = Projectile.SafeDirectionTo(target.Center) * homingSpeed; - float inertia = projectile.Distance(target.Center) < 240f ? 4f : 13f; - projectile.velocity = (projectile.velocity * inertia + idealVelocity) / (inertia + 1f); - projectile.velocity.Normalize(); - projectile.velocity *= homingSpeed; + float inertia = Projectile.Distance(target.Center) < 240f ? 4f : 13f; + Projectile.velocity = (Projectile.velocity * inertia + idealVelocity) / (inertia + 1f); + Projectile.velocity.Normalize(); + Projectile.velocity *= homingSpeed; } //Dust circle - if (projectile.ai[0] % 20 == 0f) + if (Projectile.ai[0] % 20 == 0f) { for (int l = 0; l < 14; l++) { - Vector2 spawnPositionAdditive = Vector2.UnitX * (float)-(float)projectile.width / 2f; - spawnPositionAdditive += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.TwoPi / 14f), default) * new Vector2(8f, 16f) * projectile.scale; - spawnPositionAdditive = spawnPositionAdditive.RotatedBy((double)(projectile.rotation), default); - int dustIndex = Dust.NewDust(projectile.Center, 0, 0, 218, 0f, 0f, 0, new Color(188, 126, 154), 1.5f); + Vector2 spawnPositionAdditive = Vector2.UnitX * (float)-(float)Projectile.width / 2f; + spawnPositionAdditive += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.TwoPi / 14f), default) * new Vector2(8f, 16f) * Projectile.scale; + spawnPositionAdditive = spawnPositionAdditive.RotatedBy((double)(Projectile.rotation), default); + int dustIndex = Dust.NewDust(Projectile.Center, 0, 0, 218, 0f, 0f, 0, new Color(188, 126, 154), 1.5f); Main.dust[dustIndex].noGravity = true; - Main.dust[dustIndex].position = projectile.Center + spawnPositionAdditive; - Main.dust[dustIndex].velocity = projectile.velocity * 0.1f; - Main.dust[dustIndex].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[dustIndex].position) * 1.25f; + Main.dust[dustIndex].position = Projectile.Center + spawnPositionAdditive; + Main.dust[dustIndex].velocity = Projectile.velocity * 0.1f; + Main.dust[dustIndex].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[dustIndex].position) * 1.25f; } } //Frame logic - projectile.frameCounter++; - if (projectile.frameCounter % 5 == 0) + Projectile.frameCounter++; + if (Projectile.frameCounter % 5 == 0) { - projectile.frame++; + Projectile.frame++; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 15; - if (projectile.alpha < 0) + Projectile.alpha -= 15; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 240; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.Damage(); - Main.PlaySound((int)SoundType.NPCKilled, (int)projectile.Center.X, (int)projectile.Center.Y, 52, 0.4f); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 240; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.Damage(); + SoundEngine.PlaySound((int)SoundType.NPCKilled, (int)Projectile.Center.X, (int)Projectile.Center.Y, 52, 0.4f); for (int i = 0; i < 3; i++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 218, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 100, default, 1.5f); } for (int i = 0; i < 30; i++) { float angle = MathHelper.TwoPi * i / 30f; - int dustIndex = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 218, 0f, 0f, 0, default, 2.5f); + int dustIndex = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 0, default, 2.5f); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].velocity *= 3f; - dustIndex = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 218, 0f, 0f, 100, default, 1.5f); + dustIndex = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 100, default, 1.5f); Main.dust[dustIndex].velocity *= 2f; Main.dust[dustIndex].noGravity = true; - Dust.NewDust(projectile.Center + angle.ToRotationVector2() * 160f, 0, 0, 218, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.Center + angle.ToRotationVector2() * 160f, 0, 0, 218, 0f, 0f, 100, default, 1.5f); } } } diff --git a/Projectiles/Melee/GalacticaComet.cs b/Projectiles/Melee/GalacticaComet.cs index dc6e688e27..e412dc5d0d 100644 --- a/Projectiles/Melee/GalacticaComet.cs +++ b/Projectiles/Melee/GalacticaComet.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,22 +15,22 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Comet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.ignoreWater = true; + Projectile.width = 34; + Projectile.height = 34; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 600; + Projectile.ignoreWater = true; } public override void AI() @@ -38,110 +39,110 @@ namespace CalamityMod.Projectiles.Melee noTileHitCounter -= randomToSubtract; if (noTileHitCounter == 0) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 18f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 18f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, Main.rand.NextBool(2) ? 164 : 229, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, Main.rand.NextBool(2) ? 164 : 229, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } - projectile.alpha -= 15; + Projectile.alpha -= 15; int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) + if (Projectile.Center.Y >= Projectile.ai[1]) { num58 = 0; } - if (projectile.alpha < num58) + if (Projectile.alpha < num58) { - projectile.alpha = num58; + Projectile.alpha = num58; } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 164, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 164, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; + Main.dust[num59].position = Projectile.Center + value3 * 12f; } if (Main.rand.NextBool(48)) { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + int num60 = Gore.NewGore(Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; + Main.gore[num60].velocity += Projectile.velocity * 0.3f; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.light = 0.5f; + Projectile.light = 0.5f; if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20)) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, 100, 255, projectile.alpha); + return new Color(Main.DiscoR, 100, 255, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 144; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 144; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num193 = 0; num193 < 4; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 164, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 164, 0f, 0f, 50, default, 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 0, default, 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 0, default, 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 50, default, 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 50, default, 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/GalaxiaBolt.cs b/Projectiles/Melee/GalaxiaBolt.cs index 491b3220e5..383c251351 100644 --- a/Projectiles/Melee/GalaxiaBolt.cs +++ b/Projectiles/Melee/GalaxiaBolt.cs @@ -12,68 +12,68 @@ namespace CalamityMod.Projectiles.Melee public class GalaxiaBolt : ModProjectile { public NPC target; - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; - public ref float Hue => ref projectile.ai[0]; - public ref float HomingStrenght => ref projectile.ai[1]; + public ref float Hue => ref Projectile.ai[0]; + public ref float HomingStrenght => ref Projectile.ai[1]; Particle Head; public override void SetStaticDefaults() { DisplayName.SetDefault("Galaxia Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 80; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 80; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Head == null) { - Head = new GenericSparkle(projectile.Center, Vector2.Zero, Color.White, Main.hslToRgb(Hue, 100, 50), 1.2f, 2, 0.06f, 3); + Head = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Main.hslToRgb(Hue, 100, 50), 1.2f, 2, 0.06f, 3); GeneralParticleHandler.SpawnParticle(Head); } else { - Head.Position = projectile.Center + projectile.velocity * 0.5f; + Head.Position = Projectile.Center + Projectile.velocity * 0.5f; Head.Time = 0; - Head.Scale += (float)Math.Sin(Main.GlobalTime * 6) * 0.02f * projectile.scale; + Head.Scale += (float)Math.Sin(Main.GlobalTime * 6) * 0.02f * Projectile.scale; } if (target == null) - target = projectile.Center.ClosestNPCAt(812f, true); + target = Projectile.Center.ClosestNPCAt(812f, true); - else if (CalamityUtils.AngleBetween(projectile.velocity, target.Center - projectile.Center) < MathHelper.PiOver2) //Home in + else if (CalamityUtils.AngleBetween(Projectile.velocity, target.Center - Projectile.Center) < MathHelper.PiOver2) //Home in { - float idealDirection = projectile.AngleTo(target.Center); - float updatedDirection = projectile.velocity.ToRotation().AngleTowards(idealDirection, HomingStrenght); - projectile.velocity = updatedDirection.ToRotationVector2() * projectile.velocity.Length() * 0.995f; + float idealDirection = Projectile.AngleTo(target.Center); + float updatedDirection = Projectile.velocity.ToRotation().AngleTowards(idealDirection, HomingStrenght); + Projectile.velocity = updatedDirection.ToRotationVector2() * Projectile.velocity.Length() * 0.995f; } - Lighting.AddLight(projectile.Center, 0.75f, 1f, 0.24f); + Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); if (Main.rand.Next(2) == 0) { - Particle smoke = new HeavySmokeParticle(projectile.Center, projectile.velocity * 0.5f, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f) * projectile.scale, 0.8f, 0, false, 0, true); + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f) * Projectile.scale, 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); if (Main.rand.Next(3) == 0) { - Particle smokeGlow = new HeavySmokeParticle(projectile.Center, projectile.velocity * 0.5f, Main.hslToRgb(Hue, 1, 0.7f), 20, Main.rand.NextFloat(0.4f, 0.7f) * projectile.scale, 0.8f, 0, true, 0.005f, true); + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, Main.hslToRgb(Hue, 1, 0.7f), 20, Main.rand.NextFloat(0.4f, 0.7f) * Projectile.scale, 0.8f, 0, true, 0.005f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } } @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/GalaxiaHoldout.cs b/Projectiles/Melee/GalaxiaHoldout.cs index f692f54bea..22faa0336f 100644 --- a/Projectiles/Melee/GalaxiaHoldout.cs +++ b/Projectiles/Melee/GalaxiaHoldout.cs @@ -6,15 +6,16 @@ using System.Collections.Generic; using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class GalaxiaHoldout : ModProjectile //Visuals. Now much simpler than before! { - private Player Owner => Main.player[projectile.owner]; + private Player Owner => Main.player[Projectile.owner]; public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.modItem as FourSeasonsGalaxia).CanUseItem(Owner) : false; - public ref float Initialized => ref projectile.ai[0]; - public ref float CycleDirection => ref projectile.ai[1]; + public ref float Initialized => ref Projectile.ai[0]; + public ref float CycleDirection => ref Projectile.ai[1]; private Item associatedItem; @@ -25,13 +26,13 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { - projectile.width = projectile.height = 2; - projectile.aiStyle = -1; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 40; - projectile.tileCollide = false; - projectile.damage = 0; + Projectile.width = Projectile.height = 2; + Projectile.aiStyle = -1; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 40; + Projectile.tileCollide = false; + Projectile.damage = 0; } public override void AI() @@ -42,11 +43,11 @@ namespace CalamityMod.Projectiles.Melee //If dropped, kill it instantly if (Owner.HeldItem.type != ItemType()) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.Center = Owner.Center; + Projectile.Center = Owner.Center; associatedItem = Owner.HeldItem; //Switch up the attunements @@ -183,7 +184,7 @@ namespace CalamityMod.Projectiles.Melee } //Chunger - var Sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThunderStrike"), projectile.Center); + var Sound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThunderStrike"), Projectile.Center); CalamityUtils.SafeVolumeChange(ref Sound, 0.4f); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 5) Main.LocalPlayer.Calamity().GeneralScreenShakePower = 5; diff --git a/Projectiles/Melee/GalaxiaTropicRing.cs b/Projectiles/Melee/GalaxiaTropicRing.cs index 1594e7ec59..0852a2a884 100644 --- a/Projectiles/Melee/GalaxiaTropicRing.cs +++ b/Projectiles/Melee/GalaxiaTropicRing.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Projectiles.Melee { public class GalaxiaTropicRing : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float Mode => ref projectile.ai[0]; - public ref float Fade => ref projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Mode => ref Projectile.ai[0]; + public ref float Fade => ref Projectile.ai[1]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() @@ -23,12 +23,12 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -46,20 +46,20 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - return Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center - Vector2.One * 95 * projectile.scale, Vector2.One * 190 * projectile.scale); + return Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.One * 95 * Projectile.scale, Vector2.One * 190 * Projectile.scale); } public override void AI() { - projectile.velocity *= 0.95f; + Projectile.velocity *= 0.95f; if (Mode == 0f) - projectile.Center = Vector2.Lerp(projectile.Center, Owner.Center, 0.4f * MathHelper.Clamp((projectile.timeLeft - 150) / 150f, 0, 1)); + Projectile.Center = Vector2.Lerp(Projectile.Center, Owner.Center, 0.4f * MathHelper.Clamp((Projectile.timeLeft - 150) / 150f, 0, 1)); else - projectile.velocity = Utils.SafeNormalize(projectile.Center - Owner.Center, Vector2.Zero) * MathHelper.Clamp((projectile.timeLeft - 150) / 150f, 0, 1) * 3f * (5f - MathHelper.Clamp((projectile.Center - Owner.Center).Length() / 150f, 0, 4f)); + Projectile.velocity = Utils.SafeNormalize(Projectile.Center - Owner.Center, Vector2.Zero) * MathHelper.Clamp((Projectile.timeLeft - 150) / 150f, 0, 1) * 3f * (5f - MathHelper.Clamp((Projectile.Center - Owner.Center).Length() / 150f, 0, 4f)); - Fade = projectile.timeLeft > 250 ? (float)Math.Sin((300 - projectile.timeLeft) / 50f * MathHelper.PiOver2) * 0.6f + 0.4f : projectile.timeLeft > 50 ? 1f : (float)Math.Sin((projectile.timeLeft) / 50f * MathHelper.PiOver2); - Lighting.AddLight(projectile.Center, 0.75f, 1f, 0.24f); + Fade = Projectile.timeLeft > 250 ? (float)Math.Sin((300 - Projectile.timeLeft) / 50f * MathHelper.PiOver2) * 0.6f + 0.4f : Projectile.timeLeft > 50 ? 1f : (float)Math.Sin((Projectile.timeLeft) / 50f * MathHelper.PiOver2); + Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); } @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Melee float starHeight = (float)Math.Sin(Main.GlobalTime * 3 + StarIndex * MathHelper.TwoPi / (float)MaxStars); float starWidth = (float)Math.Cos(Main.GlobalTime * 3 + StarIndex * MathHelper.TwoPi / (float)MaxStars); - return projectile.Center + projectile.rotation.ToRotationVector2() * starWidth * (projectile.scale * diameter * 0.4f) + (projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * starHeight * (projectile.scale * diameter * 0.4f); + return Projectile.Center + Projectile.rotation.ToRotationVector2() * starWidth * (Projectile.scale * diameter * 0.4f) + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * starHeight * (Projectile.scale * diameter * 0.4f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -84,11 +84,11 @@ namespace CalamityMod.Projectiles.Melee spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - spriteBatch.Draw(bloomTexture, projectile.Center - Main.screenPosition, null, ringColor * 0.5f, 0, bloomTexture.Size() / 2f, 2.5f, SpriteEffects.None, 0); - spriteBatch.Draw(ring, projectile.Center - Main.screenPosition, null, ringColor * 0.8f, 0f, ring.Size() / 2f, projectile.scale, 0f, 0f); + spriteBatch.Draw(bloomTexture, Projectile.Center - Main.screenPosition, null, ringColor * 0.5f, 0, bloomTexture.Size() / 2f, 2.5f, SpriteEffects.None, 0); + spriteBatch.Draw(ring, Projectile.Center - Main.screenPosition, null, ringColor * 0.8f, 0f, ring.Size() / 2f, Projectile.scale, 0f, 0f); - spriteBatch.Draw(sigil, projectile.Center - Main.screenPosition, null, ringColor * MathHelper.Lerp(0.7f, 0f, ((Main.GlobalTime * 5f) % 10) / 10f), 0f, sigil.Size() / 2f, projectile.scale + ((Main.GlobalTime * 5f) % 10) / 10f * 2f, 0f, 0f); - spriteBatch.Draw(sigil, projectile.Center - Main.screenPosition, null, Color.White * Fade, 0f, sigil.Size() / 2f, projectile.scale, 0f, 0f); + spriteBatch.Draw(sigil, Projectile.Center - Main.screenPosition, null, ringColor * MathHelper.Lerp(0.7f, 0f, ((Main.GlobalTime * 5f) % 10) / 10f), 0f, sigil.Size() / 2f, Projectile.scale + ((Main.GlobalTime * 5f) % 10) / 10f * 2f, 0f, 0f); + spriteBatch.Draw(sigil, Projectile.Center - Main.screenPosition, null, Color.White * Fade, 0f, sigil.Size() / 2f, Projectile.scale, 0f, 0f); for (int i = 0; i < 5; i++) { diff --git a/Projectiles/Melee/Galaxia_AndromedasStride.cs b/Projectiles/Melee/Galaxia_AndromedasStride.cs index 3323fc2c3f..f145a5607b 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStride.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStride.cs @@ -11,6 +11,7 @@ using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; using Microsoft.Xna.Framework.Audio; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -19,11 +20,11 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Items/Weapons/Melee/GalaxiaExtra"; private bool initialized = false; Vector2 direction = Vector2.Zero; - public Player Owner => Main.player[projectile.owner]; - public ref float Charge => ref projectile.ai[0]; //Charge - public ref float State => ref projectile.ai[1]; //State 0 is "charging", State 1 is "thrusting" - public ref float CurrentIndicator => ref projectile.localAI[0]; //What "indicator" stage are you on. - public ref float OverCharge => ref projectile.localAI[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Charge => ref Projectile.ai[0]; //Charge + public ref float State => ref Projectile.ai[1]; //State 0 is "charging", State 1 is "thrusting" + public ref float CurrentIndicator => ref Projectile.localAI[0]; //What "indicator" stage are you on. + public ref float OverCharge => ref Projectile.localAI[1]; private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; const float MaxCharge = 500; @@ -37,14 +38,14 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 70; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 70; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; } public override bool CanDamage() @@ -55,8 +56,8 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 145 * projectile.scale; - float bladeWidth = 25 * projectile.scale; + float bladeLenght = 145 * Projectile.scale; + float bladeWidth = 25 * Projectile.scale; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); } @@ -73,8 +74,8 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao { - projectile.velocity = Vector2.Zero; - Main.PlaySound(SoundID.Item101, projectile.Center); + Projectile.velocity = Vector2.Zero; + SoundEngine.PlaySound(SoundID.Item101, Projectile.Center); initialized = true; } @@ -84,21 +85,21 @@ namespace CalamityMod.Projectiles.Melee { if (Charge / MaxCharge < 0.25f) { - Main.PlaySound(SoundID.Item109, projectile.Center); - projectile.Kill(); + SoundEngine.PlaySound(SoundID.Item109, Projectile.Center); + Projectile.Kill(); return; } else { - var dashSound = Main.PlaySound(SoundID.Item120, projectile.Center); + var dashSound = SoundEngine.PlaySound(SoundID.Item120, Projectile.Center); CalamityUtils.SafeVolumeChange(ref dashSound, 0.5f); State = 1f; - projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; //Keep that even, if its an odd number itll fuck off and wont reset the players velocity on death - dashDuration = projectile.timeLeft; - lastDisplacement = projectile.Center - Owner.Center; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; //Keep that even, if its an odd number itll fuck off and wont reset the players velocity on death + dashDuration = Projectile.timeLeft; + lastDisplacement = Projectile.Center - Owner.Center; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } } } @@ -107,23 +108,23 @@ namespace CalamityMod.Projectiles.Melee { direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); - projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement()); + Projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement()); Charge++; OverCharge--; - projectile.timeLeft = 2; + Projectile.timeLeft = 2; if ((Charge / MaxCharge >= 0.25f && CurrentIndicator == 0f) || (Charge / MaxCharge >= 0.5f && CurrentIndicator == 1f) || (Charge / MaxCharge >= 0.75f && CurrentIndicator == 2f) && Owner.whoAmI == Main.myPlayer) { //WOahhh do a ring of projectiles!! woahhh for (int i = 0; i < 5; i++) { - Projectile blast = Projectile.NewProjectileDirect(Owner.Center, (MathHelper.TwoPi * i / 5f).ToRotationVector2() * 10f, ProjectileType(), (int)(projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f); + Projectile blast = Projectile.NewProjectileDirect(Owner.Center, (MathHelper.TwoPi * i / 5f).ToRotationVector2() * 10f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f); { blast.timeLeft = 30; } } - Main.PlaySound(SoundID.Item79, projectile.Center); + SoundEngine.PlaySound(SoundID.Item79, Projectile.Center); CurrentIndicator++; OverCharge = 20f; } @@ -135,12 +136,12 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool()) { Vector2 smokeSpeed = direction.RotatedByRandom(MathHelper.PiOver4 * 0.3f) * Main.rand.NextFloat(10f, 30f) * 0.9f; - Particle smoke = new HeavySmokeParticle(projectile.Center + direction * 50f, smokeSpeed + Owner.velocity, Color.Lerp(Color.Purple, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f), 0.8f, 0, false, 0, true); + Particle smoke = new HeavySmokeParticle(Projectile.Center + direction * 50f, smokeSpeed + Owner.velocity, Color.Lerp(Color.Purple, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f), 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); if (Main.rand.Next(3) == 0) { - Particle smokeGlow = new HeavySmokeParticle(projectile.Center + direction * 50f, smokeSpeed + Owner.velocity, Main.hslToRgb(0.85f, 1, 0.8f), 20, Main.rand.NextFloat(0.4f, 0.7f), 0.8f, 0, true, 0.01f, true); + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center + direction * 50f, smokeSpeed + Owner.velocity, Main.hslToRgb(0.85f, 1, 0.8f), 20, Main.rand.NextFloat(0.4f, 0.7f), 0.8f, 0, true, 0.01f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } } @@ -151,14 +152,14 @@ namespace CalamityMod.Projectiles.Melee //Projectiles!!! wah!!! for (int i = 0; i < 9; i++) { - Projectile blast = Projectile.NewProjectileDirect(Owner.Center, (MathHelper.TwoPi * i / 9f).ToRotationVector2() * 10f, ProjectileType(), (int)(projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f); + Projectile blast = Projectile.NewProjectileDirect(Owner.Center, (MathHelper.TwoPi * i / 9f).ToRotationVector2() * 10f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f); { blast.timeLeft = 50; } } OverCharge = 20f; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconUse"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconUse"), Projectile.Center); CurrentIndicator++; } } @@ -166,36 +167,36 @@ namespace CalamityMod.Projectiles.Melee if (State == 1f) { - projectile.Center = Owner.Center + Vector2.Lerp(lastDisplacement, direction * 40f, MathHelper.Clamp(((dashDuration - projectile.timeLeft) / dashDuration) * 2f, 0f, 1f)); + Projectile.Center = Owner.Center + Vector2.Lerp(lastDisplacement, direction * 40f, MathHelper.Clamp(((dashDuration - Projectile.timeLeft) / dashDuration) * 2f, 0f, 1f)); Owner.fallStart = (int)(Owner.position.Y / 16f); Owner.Calamity().LungingDown = true; - if (Collision.SolidCollision(Owner.Center + (direction * 120 * projectile.scale) - Vector2.One * 5f, 10, 10)) + if (Collision.SolidCollision(Owner.Center + (direction * 120 * Projectile.scale) - Vector2.One * 5f, 10, 10)) { SlamDown(); - projectile.timeLeft = 0; + Projectile.timeLeft = 0; Owner.Calamity().LungingDown = false; - projectile.active = false; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.active = false; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } Owner.velocity = direction * 30f; float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); float strength = (float)Math.Sin(variation * 2f + MathHelper.PiOver2); - Particle Sparkle = new CritSpark(projectile.Center, Owner.velocity - direction.RotatedBy(variation) * (1 + strength) * 2f * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center, Owner.velocity - direction.RotatedBy(variation) * (1 + strength) * 2f * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } - Lighting.AddLight(projectile.Center, new Vector3(1f, 0.56f, 0.56f) * Charge / MaxCharge); + Lighting.AddLight(Projectile.Center, new Vector3(1f, 0.56f, 0.56f) * Charge / MaxCharge); //Manage position and rotation - projectile.rotation = direction.ToRotation(); + Projectile.rotation = direction.ToRotation(); //Scaling based on charge - projectile.scale = 1f + (Charge / MaxCharge * 0.3f); + Projectile.scale = 1f + (Charge / MaxCharge * 0.3f); Owner.direction = Math.Sign(direction.X); Owner.itemRotation = direction.ToRotation(); @@ -218,14 +219,14 @@ namespace CalamityMod.Projectiles.Melee if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 15) Main.LocalPlayer.Calamity().GeneralScreenShakePower = 15; - Projectile proj = Projectile.NewProjectileDirect(Owner.Center + (direction * 120 * projectile.scale), -direction * 16f, ProjectileType(), projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f); + Projectile proj = Projectile.NewProjectileDirect(Owner.Center + (direction * 120 * Projectile.scale), -direction * 16f, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f); proj.scale = 3f; proj.timeLeft = 50; SideSprouts(1, 150f, 1f * Charge / MaxCharge); SideSprouts(-1, 150f, 1f * Charge / MaxCharge); - SoundEffectInstance slamSound = Main.PlaySound(SoundID.DD2_MonkStaffGroundImpact, projectile.Center); + SoundEffectInstance slamSound = SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Projectile.Center); CalamityUtils.SafeVolumeChange(ref slamSound, 1.5f); } @@ -236,7 +237,7 @@ namespace CalamityMod.Projectiles.Melee bool validPositionFound = false; for (float i = 0f; i < 1; i += 1 / distance) { - Vector2 positionToCheck = Owner.Center + (direction * 120 * projectile.scale) + direction.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; + Vector2 positionToCheck = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) widestAngle = i; @@ -250,9 +251,9 @@ namespace CalamityMod.Projectiles.Melee if (validPositionFound) { - Vector2 projPosition = Owner.Center + (direction * 120 * projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; + Vector2 projPosition = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; Vector2 monolithRotation = direction.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), (int)(projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); + Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); if (proj.modProjectile is AndromedasStrideBoltSpawner spawner) { spawner.WaitTimer = (1 - projSize) * 34f; @@ -282,7 +283,7 @@ namespace CalamityMod.Projectiles.Melee float drawRotation = drawAngle + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, sword.Height); - Vector2 drawOffset = projectile.Center - Main.screenPosition; + Vector2 drawOffset = Projectile.Center - Main.screenPosition; CalamityUtils.EnterShaderRegion(spriteBatch); @@ -293,7 +294,7 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:BasicTint"].UseColor(new Color(255, 129, 153)); GameShaders.Misc["CalamityMod:BasicTint"].Apply(); - spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); CalamityUtils.ExitShaderRegion(spriteBatch); @@ -308,7 +309,7 @@ namespace CalamityMod.Projectiles.Melee Owner.Calamity().LungingDown = false; - projectile.active = false; + Projectile.active = false; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs b/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs index ea55f1e494..a4e6dc784b 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs @@ -6,14 +6,15 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class AndromedasStrideBoltSpawner : ModProjectile { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public Player Owner => Main.player[projectile.owner]; - public ref float Size => ref projectile.ai[1]; //Yes + public Player Owner => Main.player[Projectile.owner]; + public ref float Size => ref Projectile.ai[1]; //Yes public float WaitTimer; //How long until the monoliths appears public Vector2 OriginDirection; //The direction of the original strike @@ -25,81 +26,81 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 70; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.hide = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 70; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 30; + Projectile.hide = true; } public override bool CanDamage() => false; public override void AI() { - if (projectile.velocity != Vector2.Zero) + if (Projectile.velocity != Vector2.Zero) { SurfaceUp(); - projectile.rotation = projectile.velocity.ToRotation(); - projectile.velocity = Vector2.Zero; + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.velocity = Vector2.Zero; } if (WaitTimer > 0) { - projectile.timeLeft = 30; + Projectile.timeLeft = 30; WaitTimer--; } - if (projectile.timeLeft == 29) + if (Projectile.timeLeft == 29) { if (Size * 0.8 > 0.4 && Facing != 0) SideSprouts(Facing, 150f, Size * 0.8f); } - if (projectile.timeLeft < 29) + if (Projectile.timeLeft < 29) { if (Main.rand.Next(3) == 0) { - Vector2 particleDirection = (projectile.rotation - MathHelper.PiOver4).ToRotationVector2(); + Vector2 particleDirection = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2(); Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver4 / 2f, MathHelper.PiOver4 / 2f)) * Main.rand.NextFloat(15f, 35f); - Particle smoke = new HeavySmokeParticle(projectile.Center, flyDirection, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.4f, 1.3f) * projectile.scale, 0.8f, 0, false, 0, true); + Particle smoke = new HeavySmokeParticle(Projectile.Center, flyDirection, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.4f, 1.3f) * Projectile.scale, 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); if (Main.rand.Next(3) == 0) { - Particle smokeGlow = new HeavySmokeParticle(projectile.Center, flyDirection, Color.Red, 20, Main.rand.NextFloat(0.1f, 0.7f) * projectile.scale, 0.8f, 0, true, 0.01f, true); + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, flyDirection, Color.Red, 20, Main.rand.NextFloat(0.1f, 0.7f) * Projectile.scale, 0.8f, 0, true, 0.01f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } } } - if (projectile.timeLeft == 2) + if (Projectile.timeLeft == 2) { //New bolt if (Owner.whoAmI == Main.myPlayer) { - Projectile proj = Projectile.NewProjectileDirect(projectile.position, projectile.rotation.ToRotationVector2() * 18f, ProjectileType(), projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.position, Projectile.rotation.ToRotationVector2() * 18f, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f); proj.scale = Size * 3f; proj.timeLeft = 50; } - Vector2 particleDirection = (projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); - Main.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, projectile.Center); + Vector2 particleDirection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, Projectile.Center); for (int i = 0; i < 8; i++) { Vector2 hitPositionDisplace = particleDirection.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(0f, 10f); Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2)) * Main.rand.NextFloat(5f, 15f); - Particle smoke = new HeavySmokeParticle(projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(1.6f, 2.2f) * projectile.scale, 0.8f, 0, false, 0, true); + Particle smoke = new HeavySmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(1.6f, 2.2f) * Projectile.scale, 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); if (Main.rand.Next(3) == 0) { - Particle smokeGlow = new HeavySmokeParticle(projectile.Center + hitPositionDisplace, flyDirection, Color.Red, 20, Main.rand.NextFloat(1.4f, 1.7f) * projectile.scale, 0.8f, 0, true, 0.005f, true); + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Red, 20, Main.rand.NextFloat(1.4f, 1.7f) * Projectile.scale, 0.8f, 0, true, 0.005f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } } @@ -111,14 +112,14 @@ namespace CalamityMod.Projectiles.Melee { for (float i = 0; i < 40; i += 0.5f) { - Vector2 positionToCheck = projectile.Center + projectile.velocity * i; + Vector2 positionToCheck = Projectile.Center + Projectile.velocity * i; if (!Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) { - projectile.Center = projectile.Center + projectile.velocity * i; + Projectile.Center = Projectile.Center + Projectile.velocity * i; return; } } - projectile.Center = projectile.Center + projectile.velocity * 40f; + Projectile.Center = Projectile.Center + Projectile.velocity * 40f; } public bool SideSprouts(float facing, float distance, float projSize) @@ -128,7 +129,7 @@ namespace CalamityMod.Projectiles.Melee bool validPositionFound = false; for (float i = 0f; i < 1; i += 1 / distance) { - Vector2 positionToCheck = projectile.Center + OriginDirection.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; + Vector2 positionToCheck = Projectile.Center + OriginDirection.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) widestAngle = i; @@ -142,9 +143,9 @@ namespace CalamityMod.Projectiles.Melee if (validPositionFound) { - Vector2 projPosition = projectile.Center + OriginDirection.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; + Vector2 projPosition = Projectile.Center + OriginDirection.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; Vector2 monolithRotation = OriginDirection.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize); + Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize); if (proj.modProjectile is AndromedasStrideBoltSpawner spawner) { spawner.WaitTimer = (float)Math.Sqrt(1.0 - Math.Pow(projSize - 1.0, 2)) * 3f; diff --git a/Projectiles/Melee/Galaxia_AriesWrath.cs b/Projectiles/Melee/Galaxia_AriesWrath.cs index 307842f2bc..d7b3795450 100644 --- a/Projectiles/Melee/Galaxia_AriesWrath.cs +++ b/Projectiles/Melee/Galaxia_AriesWrath.cs @@ -9,6 +9,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,9 +17,9 @@ namespace CalamityMod.Projectiles.Melee { private NPC[] excludedTargets = new NPC[4]; public override string Texture => "CalamityMod/Items/Weapons/Melee/GalaxiaExtra2"; - public Player Owner => Main.player[projectile.owner]; - public ref float ChainSwapTimer => ref projectile.ai[0]; - public ref float BlastCooldown => ref projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float ChainSwapTimer => ref Projectile.ai[0]; + public ref float BlastCooldown => ref Projectile.ai[1]; private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed && Owner.HeldItem.type == ItemType(); const float MaxProjReach = 500f; //How far away do you check for enemies for the extra projs from crits be @@ -30,24 +31,24 @@ namespace CalamityMod.Projectiles.Melee { DisplayName.SetDefault("Aries's Wrath"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 80; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = FourSeasonsGalaxia.AriesAttunement_LocalIFrames; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 80; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = FourSeasonsGalaxia.AriesAttunement_LocalIFrames; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - return Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center - Vector2.One * 50 * projectile.scale, Vector2.One * 100 * projectile.scale); + return Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.One * 50 * Projectile.scale, Vector2.One * 100 * Projectile.scale); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -122,22 +123,22 @@ namespace CalamityMod.Projectiles.Melee if (!OwnerCanShoot) { //Kill the projectile if too far away from the player or close enough to get "re-absorbed) - if ((Owner.Center - projectile.Center).Length() < 30f || (Owner.Center - projectile.Center).Length() > 2000f || projectile.velocity.Length() > 100f) - projectile.Kill(); + if ((Owner.Center - Projectile.Center).Length() < 30f || (Owner.Center - Projectile.Center).Length() > 2000f || Projectile.velocity.Length() > 100f) + Projectile.Kill(); else { - if (projectile.timeLeft <= 2) + if (Projectile.timeLeft <= 2) { - projectile.velocity *= 10f; + Projectile.velocity *= 10f; } - if (projectile.velocity.AngleBetween(Owner.Center - projectile.Center) > MathHelper.PiOver4) - projectile.velocity = (projectile.velocity.ToRotation().AngleTowards(projectile.SafeDirectionTo(Owner.Center, Vector2.Zero).ToRotation(), MathHelper.Pi / 20f)).ToRotationVector2() * projectile.velocity.Length() * 0.98f; + if (Projectile.velocity.AngleBetween(Owner.Center - Projectile.Center) > MathHelper.PiOver4) + Projectile.velocity = (Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Owner.Center, Vector2.Zero).ToRotation(), MathHelper.Pi / 20f)).ToRotationVector2() * Projectile.velocity.Length() * 0.98f; else - projectile.velocity = (projectile.velocity.ToRotation().AngleTowards(projectile.SafeDirectionTo(Owner.Center, Vector2.Zero).ToRotation(), MathHelper.Pi)).ToRotationVector2() * projectile.velocity.Length() * 1.05f; - projectile.rotation = Main.GlobalTime * 25f; - projectile.scale = MathHelper.Clamp((Owner.Center - projectile.Center).Length() / (FourSeasonsGalaxia.AriesAttunement_Reach * 0.5f), 0.3f, 2f); - projectile.timeLeft = 4; + Projectile.velocity = (Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Owner.Center, Vector2.Zero).ToRotation(), MathHelper.Pi)).ToRotationVector2() * Projectile.velocity.Length() * 1.05f; + Projectile.rotation = Main.GlobalTime * 25f; + Projectile.scale = MathHelper.Clamp((Owner.Center - Projectile.Center).Length() / (FourSeasonsGalaxia.AriesAttunement_Reach * 0.5f), 0.3f, 2f); + Projectile.timeLeft = 4; } return; } @@ -145,29 +146,29 @@ namespace CalamityMod.Projectiles.Melee //On initialization basically if (ChainSwapTimer == 0f) { - projectile.Center = Owner.Center; - var scream = Main.PlaySound(SoundID.Item120, projectile.Center); + Projectile.Center = Owner.Center; + var scream = SoundEngine.PlaySound(SoundID.Item120, Projectile.Center); SafeVolumeChange(ref scream, 0.5f); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3) Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3; } - projectile.scale = 1f + ScaleEquation(); - projectile.timeLeft = 2; + Projectile.scale = 1f + ScaleEquation(); + Projectile.timeLeft = 2; - projectile.Center = Vector2.Lerp(projectile.Center, Owner.Calamity().mouseWorld, 0.05f * ThrowDisplace()); - projectile.Center = projectile.Center.MoveTowards(Owner.Calamity().mouseWorld, 40f * ThrowDisplace()); + Projectile.Center = Vector2.Lerp(Projectile.Center, Owner.Calamity().mouseWorld, 0.05f * ThrowDisplace()); + Projectile.Center = Projectile.Center.MoveTowards(Owner.Calamity().mouseWorld, 40f * ThrowDisplace()); - if ((projectile.Center - Owner.Center).Length() > FourSeasonsGalaxia.AriesAttunement_Reach) - projectile.Center = Owner.Center + Owner.SafeDirectionTo(projectile.Center, Vector2.Zero) * FourSeasonsGalaxia.AriesAttunement_Reach; + if ((Projectile.Center - Owner.Center).Length() > FourSeasonsGalaxia.AriesAttunement_Reach) + Projectile.Center = Owner.Center + Owner.SafeDirectionTo(Projectile.Center, Vector2.Zero) * FourSeasonsGalaxia.AriesAttunement_Reach; - projectile.rotation = Main.GlobalTime * 25f; + Projectile.rotation = Main.GlobalTime * 25f; //Make the owner look like theyre "holding" the sword bla bla - Owner.heldProj = projectile.whoAmI; - projectile.velocity = Owner.SafeDirectionTo(projectile.Center, Vector2.Zero); - Owner.direction = Math.Sign(projectile.velocity.X); - Owner.itemRotation = projectile.velocity.ToRotation(); + Owner.heldProj = Projectile.whoAmI; + Projectile.velocity = Owner.SafeDirectionTo(Projectile.Center, Vector2.Zero); + Owner.direction = Math.Sign(Projectile.velocity.X); + Owner.itemRotation = Projectile.velocity.ToRotation(); if (Owner.direction != 1) { Owner.itemRotation -= 3.14f; @@ -178,42 +179,42 @@ namespace CalamityMod.Projectiles.Melee if (smear == null) { - smear = new CircularSmearSmokeyVFX(projectile.Center, Color.MediumOrchid, projectile.rotation, projectile.scale); + smear = new CircularSmearSmokeyVFX(Projectile.Center, Color.MediumOrchid, Projectile.rotation, Projectile.scale); GeneralParticleHandler.SpawnParticle(smear); } if (smear != null) { - smear.Position = projectile.Center; - smear.Rotation = projectile.rotation + MathHelper.PiOver2 + MathHelper.PiOver4; + smear.Position = Projectile.Center; + smear.Rotation = Projectile.rotation + MathHelper.PiOver2 + MathHelper.PiOver4; smear.Time = 0; - smear.Scale = projectile.scale; + smear.Scale = Projectile.scale; smear.Color.A = (byte)(255 * MathHelper.Clamp(ChainSwapTimer / 50f, 0, 1)); } if (Main.rand.NextBool()) { - float maxDistance = projectile.scale * 82f; + float maxDistance = Projectile.scale * 82f; Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance); Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 2f * (1f + distance.Length() / 15f); - Particle glitter = new CritSpark(projectile.Center + distance, angularVelocity, Main.rand.Next(3) == 0 ? Color.HotPink : Color.Plum, Color.DarkOrchid, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); + Particle glitter = new CritSpark(Projectile.Center + distance, angularVelocity, Main.rand.Next(3) == 0 ? Color.HotPink : Color.Plum, Color.DarkOrchid, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); GeneralParticleHandler.SpawnParticle(glitter); } - float smokeDistance = projectile.scale * 62f; + float smokeDistance = Projectile.scale * 62f; Vector2 smokePos = Main.rand.NextVector2Circular(smokeDistance, smokeDistance); Vector2 smokeSpeed = Utils.SafeNormalize(smokePos.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 0.1f * (1f + smokePos.Length() / 15f); - Particle smoke = new HeavySmokeParticle(projectile.Center + smokePos, smokeSpeed, Color.Lerp(Color.Navy, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.4f, 1f) * projectile.scale, 0.8f, 0, false, 0, true); + Particle smoke = new HeavySmokeParticle(Projectile.Center + smokePos, smokeSpeed, Color.Lerp(Color.Navy, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.4f, 1f) * Projectile.scale, 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); if (Main.rand.Next(3) == 0) { - Particle smokeGlow = new HeavySmokeParticle(projectile.Center + smokePos, smokeSpeed, Main.hslToRgb(0.85f, 1, 0.5f), 20, Main.rand.NextFloat(0.4f, 1f) * projectile.scale, 0.8f, 0, true, 0.01f, true); + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center + smokePos, smokeSpeed, Main.hslToRgb(0.85f, 1, 0.5f), 20, Main.rand.NextFloat(0.4f, 1f) * Projectile.scale, 0.8f, 0, true, 0.01f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } if ((lastConstellation == null || !lastConstellation.active) && Owner.whoAmI == Main.myPlayer && ChainSwapTimer > 20) { - lastConstellation = Projectile.NewProjectileDirect(Owner.Center, Vector2.Zero, ProjectileType(), (int)(projectile.damage * FourSeasonsGalaxia.AriesAttunement_ChainDamageReduction), 0, Owner.whoAmI); + lastConstellation = Projectile.NewProjectileDirect(Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AriesAttunement_ChainDamageReduction), 0, Owner.whoAmI); } ChainSwapTimer++; @@ -224,11 +225,11 @@ namespace CalamityMod.Projectiles.Melee { Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/GalaxiaExtra2"); - Vector2 drawPos = projectile.Center; + Vector2 drawPos = Projectile.Center; Vector2 drawOrigin = sword.Size() / 2f; - float drawRotation = projectile.rotation + MathHelper.PiOver4; + float drawRotation = Projectile.rotation + MathHelper.PiOver4; - spriteBatch.Draw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); return false; } diff --git a/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs b/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs index 23cff4b92d..7587727020 100644 --- a/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs +++ b/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Melee public class AriesWrathConstellation : ModProjectile { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public Player Owner => Main.player[projectile.owner]; - public ref float Timer => ref projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Timer => ref Projectile.ai[0]; public List Particles; @@ -28,26 +28,26 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Constellation"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 1; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 1; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 8; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - projectile.timeLeft = 20; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 8; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + Projectile.timeLeft = 20; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + SizeVector, 30f, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + SizeVector, 30f, ref collisionPoint); } public void BootlegSpawnParticle(Particle particle) @@ -64,24 +64,24 @@ namespace CalamityMod.Projectiles.Melee if (Particles == null) Particles = new List(); - projectile.Center = Owner.Center; + Projectile.Center = Owner.Center; if (Owner.channel) - projectile.timeLeft = 20; + Projectile.timeLeft = 20; if (!Owner.active) { - projectile.Kill(); + Projectile.Kill(); return; } - if (Timer % ConstellationSwapTime == 0 && projectile.timeLeft >= 20) + if (Timer % ConstellationSwapTime == 0 && Projectile.timeLeft >= 20) { Particles.Clear(); PreviousEnd = Owner.Calamity().mouseWorld - Owner.Center; - projectile.ai[0] = 1; - Vector2 previousStar = projectile.Center; + Projectile.ai[0] = 1; + Vector2 previousStar = Projectile.Center; Vector2 offset; Particle Line; Particle Star = new GenericSparkle(previousStar, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f); @@ -90,36 +90,36 @@ namespace CalamityMod.Projectiles.Melee for (float i = 0 + Main.rand.NextFloat(0.2f, 0.5f); i < 1; i += Main.rand.NextFloat(0.2f, 0.5f)) { offset = Main.rand.NextFloat(-50f, 50f) * Utils.SafeNormalize(SizeVector.RotatedBy(MathHelper.PiOver2), Vector2.Zero); - Star = new GenericSparkle(projectile.Center + SizeVector * i + offset, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f); + Star = new GenericSparkle(Projectile.Center + SizeVector * i + offset, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f); BootlegSpawnParticle(Star); - Line = new BloomLineVFX(previousStar, projectile.Center + SizeVector * i + offset - previousStar, 0.8f, Color.MediumVioletRed * 0.75f, 20, true, true); + Line = new BloomLineVFX(previousStar, Projectile.Center + SizeVector * i + offset - previousStar, 0.8f, Color.MediumVioletRed * 0.75f, 20, true, true); BootlegSpawnParticle(Line); if (Main.rand.Next(3) == 0) { offset = Main.rand.NextFloat(-50f, 50f) * Utils.SafeNormalize(SizeVector.RotatedBy(MathHelper.PiOver2), Vector2.Zero); - Star = new GenericSparkle(projectile.Center + SizeVector * i + offset, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f); + Star = new GenericSparkle(Projectile.Center + SizeVector * i + offset, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f); BootlegSpawnParticle(Star); - Line = new BloomLineVFX(previousStar, projectile.Center + SizeVector * i + offset - previousStar, 0.8f, Color.MediumVioletRed * 0.75f, 20, true, true); + Line = new BloomLineVFX(previousStar, Projectile.Center + SizeVector * i + offset - previousStar, 0.8f, Color.MediumVioletRed * 0.75f, 20, true, true); BootlegSpawnParticle(Line); } - previousStar = projectile.Center + SizeVector * i + offset; + previousStar = Projectile.Center + SizeVector * i + offset; } - Star = new GenericSparkle(projectile.Center + SizeVector, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f); + Star = new GenericSparkle(Projectile.Center + SizeVector, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f); BootlegSpawnParticle(Star); - Line = new BloomLineVFX(previousStar, projectile.Center + SizeVector - previousStar, 0.8f, Color.MediumVioletRed * 0.75f, 20, true); + Line = new BloomLineVFX(previousStar, Projectile.Center + SizeVector - previousStar, 0.8f, Color.MediumVioletRed * 0.75f, 20, true); BootlegSpawnParticle(Line); } Vector2 moveDirection = Vector2.Zero; - if (Timer > projectile.oldPos.Length) - moveDirection = projectile.position - projectile.oldPos[0]; + if (Timer > Projectile.oldPos.Length) + moveDirection = Projectile.position - Projectile.oldPos[0]; foreach (Particle particle in Particles) { diff --git a/Projectiles/Melee/Galaxia_PhoenixsPride.cs b/Projectiles/Melee/Galaxia_PhoenixsPride.cs index 76cd533ba6..cd00638911 100644 --- a/Projectiles/Melee/Galaxia_PhoenixsPride.cs +++ b/Projectiles/Melee/Galaxia_PhoenixsPride.cs @@ -10,6 +10,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -18,8 +19,8 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Items/Weapons/Melee/GalaxiaExtra2"; //The blue one, since this is long range private bool initialized = false; Vector2 direction = Vector2.Zero; - public ref float CurrentState => ref projectile.ai[0]; - public Player Owner => Main.player[projectile.owner]; + public ref float CurrentState => ref Projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; public const float throwOutTime = 90f; public const float throwOutDistance = 440f; @@ -28,13 +29,13 @@ namespace CalamityMod.Projectiles.Melee public float snapTimer => (throwTimer / throwOutTime) < snapPoint ? 0 : ((throwTimer / throwOutTime) - snapPoint) / (1f - snapPoint); public static float retractionPoint = 0.6f; public float retractionTimer => (throwTimer / throwOutTime) < retractionPoint ? 0 : ((throwTimer / throwOutTime) - retractionPoint) / (1f - retractionPoint); - public ref float Empowerment => ref projectile.ai[1]; + public ref float Empowerment => ref Projectile.ai[1]; public float OverEmpowerment = 0f; //Used to keep cooldowns working when the spin is full - public ref float hasMadeSound => ref projectile.localAI[0]; - public ref float hasMadeChargeSound => ref projectile.localAI[1]; + public ref float hasMadeSound => ref Projectile.localAI[0]; + public ref float hasMadeChargeSound => ref Projectile.localAI[1]; public const float maxEmpowerment = 600f; - public float throwTimer => throwOutTime - projectile.timeLeft; + public float throwTimer => throwOutTime - Projectile.timeLeft; public float AngleReset = 0f; @@ -44,54 +45,54 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Phoenix's Pride"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 74; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = FourSeasonsGalaxia.PhoenixAttunement_LocalIFrames; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 74; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = FourSeasonsGalaxia.PhoenixAttunement_LocalIFrames; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 145 * projectile.scale; - float bladeWidth = 25 * projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); + float bladeLenght = 145 * Projectile.scale; + float bladeWidth = 25 * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); } public CurveSegment launch = new CurveSegment(EasingType.CircOut, 0f, 0f, 1f, 4); public CurveSegment hold = new CurveSegment(EasingType.Linear, snapPoint, 1f, 0f); public CurveSegment retract = new CurveSegment(EasingType.PolyInOut, retractionPoint, 1f, -1.05f, 3); - internal float ThrowCurve() => PiecewiseAnimation((throwOutTime - projectile.timeLeft) / throwOutTime, new CurveSegment[] { launch, hold, retract }); + internal float ThrowCurve() => PiecewiseAnimation((throwOutTime - Projectile.timeLeft) / throwOutTime, new CurveSegment[] { launch, hold, retract }); public override void AI() { if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao { - Main.PlaySound(SoundID.Item90, projectile.Center); - projectile.velocity = Vector2.Zero; + SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); + Projectile.velocity = Vector2.Zero; direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); initialized = true; } - projectile.rotation = direction.ToRotation(); //Only done for afterimages + Projectile.rotation = direction.ToRotation(); //Only done for afterimages if (!OwnerCanShoot) { if (CurrentState == 2f || (CurrentState == 0f && Empowerment / maxEmpowerment < 0.5)) { - Main.PlaySound(SoundID.Item77, projectile.Center); - projectile.Kill(); + SoundEngine.PlaySound(SoundID.Item77, Projectile.Center); + Projectile.Kill(); return; } @@ -101,14 +102,14 @@ namespace CalamityMod.Projectiles.Melee if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3) Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3; - Main.PlaySound(SoundID.Item80, projectile.Center); + SoundEngine.PlaySound(SoundID.Item80, Projectile.Center); direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES for (int i = 0; i <= 8; i++) { float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); float strength = (float)Math.Sin(variation * 2f + MathHelper.PiOver2); - Particle Sparkle = new CritSpark(projectile.Center, Owner.velocity + direction.RotatedBy(variation) * (1 + strength) * 2f * Main.rand.NextFloat(7.5f, 20f), Color.Coral, Color.Chocolate, 2f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 2f); + Particle Sparkle = new CritSpark(Projectile.Center, Owner.velocity + direction.RotatedBy(variation) * (1 + strength) * 2f * Main.rand.NextFloat(7.5f, 20f), Color.Coral, Color.Chocolate, 2f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 2f); GeneralParticleHandler.SpawnParticle(Sparkle); } @@ -118,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i <= 5; i++) { float angle = direction.ToRotation() + MathHelper.Lerp(-MathHelper.PiOver4, MathHelper.PiOver4, i / 5f); - Projectile.NewProjectile(Owner.Center, angle.ToRotationVector2() * 30f, ProjectileType(), (int)(projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltThrowDamageMultiplier), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f); + Projectile.NewProjectile(Owner.Center, angle.ToRotationVector2() * 30f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltThrowDamageMultiplier), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f); } } } @@ -131,7 +132,7 @@ namespace CalamityMod.Projectiles.Melee if (hasMadeChargeSound == 0f && Empowerment / maxEmpowerment >= 0.5) { hasMadeChargeSound = 1f; - Main.PlaySound(SoundID.Item76); + SoundEngine.PlaySound(SoundID.Item76); } float rotation = direction.ToRotation(); @@ -142,7 +143,7 @@ namespace CalamityMod.Projectiles.Melee { CanDirectFire = true; hasMadeSound = 1f; - Main.PlaySound(SoundID.Item71); + SoundEngine.PlaySound(SoundID.Item71); } } @@ -160,7 +161,7 @@ namespace CalamityMod.Projectiles.Melee for (float i = 0f; i <= 1; i += 0.5f) { - Vector2 smokepos = projectile.Center + (direction * (60 + 40 * i) * projectile.scale) + direction.RotatedBy(-MathHelper.PiOver2) * 30f * scaleFactor * Main.rand.NextFloat(); + Vector2 smokepos = Projectile.Center + (direction * (60 + 40 * i) * Projectile.scale) + direction.RotatedBy(-MathHelper.PiOver2) * 30f * scaleFactor * Main.rand.NextFloat(); Particle smoke = new HeavySmokeParticle(smokepos, direction.RotatedBy(-MathHelper.PiOver2) * 20f * scaleFactor + Owner.velocity, Color.Lerp(Color.MidnightBlue, Color.Indigo, i), 10 + Main.rand.Next(5), scaleFactor * Main.rand.NextFloat(2.8f, 3.1f), Opacity + Main.rand.NextFloat(0f, 0.2f), 0f, false, 0, true); @@ -177,7 +178,7 @@ namespace CalamityMod.Projectiles.Melee if ((Empowerment + OverEmpowerment) % 30 == 29 && Owner.whoAmI == Main.myPlayer) { Vector2 shotDirection = Main.rand.NextVector2CircularEdge(15f, 15f); - Projectile.NewProjectile(Owner.Center, shotDirection, ProjectileType(), (int)(projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f); + Projectile.NewProjectile(Owner.Center, shotDirection, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f); } } @@ -187,7 +188,7 @@ namespace CalamityMod.Projectiles.Melee Color currentColor = Color.Chocolate * (((Empowerment / maxEmpowerment) - 0.75f) / 0.25f * 0.8f); if (smear == null) { - smear = new CircularSmearSmokeyVFX(Owner.Center, currentColor, direction.ToRotation(), projectile.scale * 1.5f); + smear = new CircularSmearSmokeyVFX(Owner.Center, currentColor, direction.ToRotation(), Projectile.scale * 1.5f); GeneralParticleHandler.SpawnParticle(smear); } //Update the variables of the smear @@ -196,11 +197,11 @@ namespace CalamityMod.Projectiles.Melee smear.Rotation = direction.ToRotation() + MathHelper.PiOver2; smear.Time = 0; smear.Position = Owner.Center; - smear.Scale = projectile.scale * 1.9f; + smear.Scale = Projectile.scale * 1.9f; smear.Color = currentColor; } - float rotationAdjusted = MathHelper.WrapAngle(projectile.rotation) + MathHelper.Pi; + float rotationAdjusted = MathHelper.WrapAngle(Projectile.rotation) + MathHelper.Pi; float mouseAngleAdjusted = MathHelper.WrapAngle(Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One).ToRotation()) + MathHelper.Pi; float deltaAngleShoot = Math.Abs(MathHelper.WrapAngle(rotationAdjusted - mouseAngleAdjusted)); @@ -208,7 +209,7 @@ namespace CalamityMod.Projectiles.Melee { if (Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Owner.Center, Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * 15f, ProjectileType(), (int)(projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f); + Projectile.NewProjectile(Owner.Center, Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * 15f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f); } CanDirectFire = false; AngleReset = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One).ToRotation(); @@ -217,7 +218,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool()) { - float maxDistance = projectile.scale * 1.9f * 78f; + float maxDistance = Projectile.scale * 1.9f * 78f; Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance); Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 2f * (1f + distance.Length() / 15f); Particle glitter = new CritSpark(Owner.Center + distance, Owner.velocity + angularVelocity, Main.rand.Next(3) == 0 ? Color.Turquoise : Color.Coral, currentColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); @@ -227,13 +228,13 @@ namespace CalamityMod.Projectiles.Melee //Manage position and rotation - projectile.scale = 1 + Empowerment / maxEmpowerment * 1.5f; + Projectile.scale = 1 + Empowerment / maxEmpowerment * 1.5f; direction = direction.RotatedBy(MathHelper.Clamp(Empowerment / maxEmpowerment, 0.4f, 1f) * MathHelper.PiOver4 * 0.20f); direction.Normalize(); - projectile.rotation = direction.ToRotation(); - projectile.Center = Owner.Center + (direction * projectile.scale * 10); - projectile.timeLeft = (int)throwOutTime + 1; + Projectile.rotation = direction.ToRotation(); + Projectile.Center = Owner.Center + (direction * Projectile.scale * 10); + Projectile.timeLeft = (int)throwOutTime + 1; Empowerment++; if (Empowerment > maxEmpowerment) { @@ -244,12 +245,12 @@ namespace CalamityMod.Projectiles.Melee if (CurrentState == 1f) { - projectile.Center = Owner.Center + (direction * projectile.scale * 10) + (direction * throwOutDistance * ThrowCurve()); - projectile.scale = (1 + Empowerment / maxEmpowerment * 1.5f) * MathHelper.Clamp(1 - retractionTimer, 0.3f, 1f); + Projectile.Center = Owner.Center + (direction * Projectile.scale * 10) + (direction * throwOutDistance * ThrowCurve()); + Projectile.scale = (1 + Empowerment / maxEmpowerment * 1.5f) * MathHelper.Clamp(1 - retractionTimer, 0.3f, 1f); } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.direction = Math.Sign(direction.X); Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) @@ -283,20 +284,20 @@ namespace CalamityMod.Projectiles.Melee float drawRotation = drawAngle + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, sword.Height); - Vector2 drawOffset = projectile.Center - Main.screenPosition; + Vector2 drawOffset = Projectile.Center - Main.screenPosition; //Afterimages if (CalamityConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) { - for (int i = 0; i < projectile.oldRot.Length; ++i) + for (int i = 0; i < Projectile.oldRot.Length; ++i) { - Color color = projectile.GetAlpha(lightColor) * (1f - (i / (float)projectile.oldRot.Length)); - float afterimageRotation = projectile.oldRot[i] + MathHelper.PiOver4; - Main.spriteBatch.Draw(sword, drawOffset, null, color * MathHelper.Lerp(0f, 0.5f, MathHelper.Clamp((Empowerment - maxEmpowerment * 0.4f) / (maxEmpowerment * 0.6f), 0f, 1f)), afterimageRotation, drawOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), 0f, 0f); + Color color = Projectile.GetAlpha(lightColor) * (1f - (i / (float)Projectile.oldRot.Length)); + float afterimageRotation = Projectile.oldRot[i] + MathHelper.PiOver4; + Main.spriteBatch.Draw(sword, drawOffset, null, color * MathHelper.Lerp(0f, 0.5f, MathHelper.Clamp((Empowerment - maxEmpowerment * 0.4f) / (maxEmpowerment * 0.6f), 0f, 1f)), afterimageRotation, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), 0f, 0f); } } - spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); @@ -333,15 +334,15 @@ namespace CalamityMod.Projectiles.Melee Vector2 Shake = retractProgress > 0 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (1f - snapProgress) * 10f; - int dist = (int)Vector2.Distance(Owner.Center, projectile.Center) / 16; + int dist = (int)Vector2.Distance(Owner.Center, Projectile.Center) / 16; Vector2[] Nodes = new Vector2[dist + 1]; Nodes[0] = Owner.Center; - Nodes[dist] = projectile.Center; + Nodes[dist] = Projectile.Center; for (int i = 1; i < dist + 1; i++) { Rectangle frame = new Rectangle(0, 0 + 18 * (i % 2), 12, 18); - Vector2 positionAlongLine = Vector2.Lerp(Owner.Center, projectile.Center, i / (float)dist); //Get the position of the segment along the line, as if it were a flat line + Vector2 positionAlongLine = Vector2.Lerp(Owner.Center, Projectile.Center, i / (float)dist); //Get the position of the segment along the line, as if it were a flat line Nodes[i] = positionAlongLine + Shake * (float)Math.Sin(i / (float)dist * MathHelper.Pi); float rotation = (Nodes[i] - Nodes[i - 1]).ToRotation() - MathHelper.PiOver2; //Calculate rotation based on direction from last point diff --git a/Projectiles/Melee/Galaxia_PolarisGaze.cs b/Projectiles/Melee/Galaxia_PolarisGaze.cs index 2115de54ce..cf3e1d588e 100644 --- a/Projectiles/Melee/Galaxia_PolarisGaze.cs +++ b/Projectiles/Melee/Galaxia_PolarisGaze.cs @@ -9,6 +9,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using Microsoft.Xna.Framework.Audio; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -17,12 +18,12 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Items/Weapons/Melee/GalaxiaExtra"; //Red cuz close range yget the deal private bool initialized = false; Vector2 direction = Vector2.Zero; - public ref float Shred => ref projectile.ai[0]; //Charge, basically - public ref float HitChargeCooldown => ref projectile.ai[1]; - public ref float ChargeSoundCooldown => ref projectile.localAI[0]; + public ref float Shred => ref Projectile.ai[0]; //Charge, basically + public ref float HitChargeCooldown => ref Projectile.ai[1]; + public ref float ChargeSoundCooldown => ref Projectile.localAI[0]; public float Bounce(float x) => x <= 50 ? x / 50f : x <= 65 ? 1 + 0.15f * (float)Math.Sin((x - 50f) / 15f * MathHelper.Pi) : 1f; public float ShredRatio => MathHelper.Clamp(Shred / (maxShred * 0.5f), 0f, 1f); - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; public const float maxShred = 750; //How much shred you get @@ -41,14 +42,14 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 70; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = FourSeasonsGalaxia.PolarisAttunement_LocalIFrames; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 70; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = FourSeasonsGalaxia.PolarisAttunement_LocalIFrames; } public override bool CanDamage() @@ -59,8 +60,8 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 145 * projectile.scale; - float bladeWidth = 86 * projectile.scale; + float bladeLenght = 145 * Projectile.scale; + float bladeWidth = 86 * Projectile.scale; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); } @@ -69,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization. { - Main.PlaySound(SoundID.Item90, projectile.Center); + SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); initialized = true; foreach (Projectile proj in Main.projectile) @@ -94,19 +95,19 @@ namespace CalamityMod.Projectiles.Melee if (!OwnerCanShoot) { - projectile.Kill(); + Projectile.Kill(); return; } #region sparkles and particles - float bladeLenght = 120 * projectile.scale; + float bladeLenght = 120 * Projectile.scale; for (int i = 0; i < 3; i++) { if (Rings[i] == null) { - Rings[i] = new ConstellationRingVFX(Owner.Center + (direction * (25 + bladeLenght * 0.33f * i)), Color.DarkOrchid, direction.ToRotation(), projectile.scale * 0.25f * i, new Vector2(0.5f, 1f), spinSpeed: 7, starAmount: 3 + i, important: true); + Rings[i] = new ConstellationRingVFX(Owner.Center + (direction * (25 + bladeLenght * 0.33f * i)), Color.DarkOrchid, direction.ToRotation(), Projectile.scale * 0.25f * i, new Vector2(0.5f, 1f), spinSpeed: 7, starAmount: 3 + i, important: true); GeneralParticleHandler.SpawnParticle(Rings[i]); } else @@ -114,33 +115,33 @@ namespace CalamityMod.Projectiles.Melee Rings[i].Time = 0; Rings[i].Position = Owner.Center + Vector2.Lerp(Vector2.Zero, ((0.9f + 0.1f * (float)Math.Sin(Main.GlobalTime * 10f - i * 0.5f)) * direction * (25 + bladeLenght * 0.33f * (i + 1))), Bounce(MathHelper.Clamp(Shred - 30 * i, 0, maxShred))); Rings[i].Rotation = direction.ToRotation(); - Rings[i].Scale = projectile.scale * 0.25f * (i + 1); + Rings[i].Scale = Projectile.scale * 0.25f * (i + 1); (Rings[i] as ConstellationRingVFX).Opacity = 0.5f + 0.5f * ShredRatio; } } if (PolarStar == null) { - PolarStar = new GenericSparkle(Owner.Center + direction, Vector2.Zero, Color.White, Color.CornflowerBlue, projectile.scale, 2, 0.05f, 5f, true); + PolarStar = new GenericSparkle(Owner.Center + direction, Vector2.Zero, Color.White, Color.CornflowerBlue, Projectile.scale, 2, 0.05f, 5f, true); GeneralParticleHandler.SpawnParticle(PolarStar); } else { PolarStar.Time = 0; - PolarStar.Position = Owner.Center + direction * 46 * projectile.scale; + PolarStar.Position = Owner.Center + direction * 46 * Projectile.scale; PolarStar.Rotation += (1 + (float)Math.Sin(Main.GlobalTime * 4f)) * 0.02f; - PolarStar.Scale = projectile.scale * 2f; + PolarStar.Scale = Projectile.scale * 2f; } if (Main.rand.NextBool()) { Vector2 smokeSpeed = direction.RotatedByRandom(MathHelper.PiOver4 * 0.3f) * Main.rand.NextFloat(10f, 30f) * (ShredRatio * 0.5f + 1f); - Particle smoke = new HeavySmokeParticle(projectile.Center, smokeSpeed + Owner.velocity, Color.Lerp(Color.Purple, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f) * (ShredRatio * 0.5f + 1f), 0.8f, 0, false, 0, true); + Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Owner.velocity, Color.Lerp(Color.Purple, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f) * (ShredRatio * 0.5f + 1f), 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); if (Main.rand.Next(3) == 0) { - Particle smokeGlow = new HeavySmokeParticle(projectile.Center, smokeSpeed + Owner.velocity, Main.hslToRgb(0.55f, 1, 0.5f + 0.2f * ShredRatio), 20, Main.rand.NextFloat(0.4f, 0.7f) * (ShredRatio * 0.5f + 1f), 0.8f, 0, true, 0.01f, true); + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Owner.velocity, Main.hslToRgb(0.55f, 1, 0.5f + 0.2f * ShredRatio), 20, Main.rand.NextFloat(0.4f, 0.7f) * (ShredRatio * 0.5f + 1f), 0.8f, 0, true, 0.01f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } } @@ -154,32 +155,32 @@ namespace CalamityMod.Projectiles.Melee //Manage position and rotation direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); - projectile.rotation = direction.ToRotation(); - projectile.Center = Owner.Center + (direction * 60); + Projectile.rotation = direction.ToRotation(); + Projectile.Center = Owner.Center + (direction * 60); //Scaling based on shred - projectile.localNPCHitCooldown = FourSeasonsGalaxia.PolarisAttunement_LocalIFrames - (int)(MathHelper.Lerp(0, FourSeasonsGalaxia.PolarisAttunement_LocalIFrames - FourSeasonsGalaxia.PolarisAttunement_LocalIFramesCharged, ShredRatio)); //Increase the hit frequency - projectile.scale = 1f + (ShredRatio * 1f); //SWAGGER + Projectile.localNPCHitCooldown = FourSeasonsGalaxia.PolarisAttunement_LocalIFrames - (int)(MathHelper.Lerp(0, FourSeasonsGalaxia.PolarisAttunement_LocalIFrames - FourSeasonsGalaxia.PolarisAttunement_LocalIFramesCharged, ShredRatio)); //Increase the hit frequency + Projectile.scale = 1f + (ShredRatio * 1f); //SWAGGER if ((Wheel == null || !Wheel.active) && Dashing) { Dashing = false; Owner.velocity *= 0.1f; //Abrupt stop - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MeatySlash"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MeatySlash"), Projectile.Center); if (Owner.whoAmI == Main.myPlayer) { for (int i = 0; i < 5; i++) { - Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Main.rand.NextVector2CircularEdge(15, 15), ProjectileType(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.meleeDamage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.02f); + Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Main.rand.NextVector2CircularEdge(15, 15), ProjectileType(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.GetDamage(DamageClass.Melee)), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.02f); { blast.timeLeft = 100; } } - Projectile proj = Projectile.NewProjectileDirect(Owner.Center - DashStart / 2f, Vector2.Zero, ProjectileType(), (int)(projectile.damage * FourSeasonsGalaxia.PolarisAttunement_SlashDamageBoost), 0, Owner.whoAmI); + Projectile proj = Projectile.NewProjectileDirect(Owner.Center - DashStart / 2f, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_SlashDamageBoost), 0, Owner.whoAmI); if (proj.modProjectile is PolarisGazeDash dash) { dash.DashStart = DashStart; @@ -202,7 +203,7 @@ namespace CalamityMod.Projectiles.Melee } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.direction = Math.Sign(direction.X); Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) @@ -218,7 +219,7 @@ namespace CalamityMod.Projectiles.Melee { if (ChargeSoundCooldown <= 0) { - SoundEffectInstance chargeSound = Main.PlaySound(SoundID.DD2_BookStaffCast); + SoundEffectInstance chargeSound = SoundEngine.PlaySound(SoundID.DD2_BookStaffCast); CalamityUtils.SafeVolumeChange(ref chargeSound, 2.5f); ChargeSoundCooldown = 20; } @@ -231,7 +232,7 @@ namespace CalamityMod.Projectiles.Melee Shred += FourSeasonsGalaxia.PolarisAttunement_ShredChargeupGain; HitChargeCooldown--; - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } //Since the iframes vary, adjust the damage to be consistent no matter the iframes. The true scaling happens between the BaseDamage and the FulLChargeDamage @@ -241,7 +242,7 @@ namespace CalamityMod.Projectiles.Melee float currentDamage = (int)(MathHelper.Lerp(FourSeasonsGalaxia.PolarisAttunement_BaseDamage * deviationFromBaseDamage, FourSeasonsGalaxia.PolarisAttunement_FullChargeDamage * deviationFromBaseDamage, ShredRatio)); //Adjust the damage to make it constant based on the local iframes - float damageReduction = projectile.localNPCHitCooldown / (float)FourSeasonsGalaxia.PolarisAttunement_LocalIFrames; + float damageReduction = Projectile.localNPCHitCooldown / (float)FourSeasonsGalaxia.PolarisAttunement_LocalIFrames; damage = (int)(currentDamage * damageReduction); } @@ -252,7 +253,7 @@ namespace CalamityMod.Projectiles.Melee float currentDamage = (int)(MathHelper.Lerp(FourSeasonsGalaxia.PolarisAttunement_BaseDamage * deviationFromBaseDamage, FourSeasonsGalaxia.PolarisAttunement_FullChargeDamage * deviationFromBaseDamage, ShredRatio)); //Adjust the damage to make it constant based on the local iframes - float damageReduction = projectile.localNPCHitCooldown / (float)FourSeasonsGalaxia.PolarisAttunement_LocalIFrames; + float damageReduction = Projectile.localNPCHitCooldown / (float)FourSeasonsGalaxia.PolarisAttunement_LocalIFrames; damage = (int)(currentDamage * damageReduction); } @@ -271,7 +272,7 @@ namespace CalamityMod.Projectiles.Melee // get lifted up if (HitChargeCooldown <= 0) { - Main.PlaySound(SoundID.NPCHit30, projectile.Center); //Sizzle + SoundEngine.PlaySound(SoundID.NPCHit30, Projectile.Center); //Sizzle Shred += 80; //Augment the shredspeed if (Owner.velocity.Y > 0) Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly @@ -282,10 +283,10 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCHit43, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit43, Projectile.Center); if (ShredRatio > 0.85 && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, direction * 36f, ProjectileType(), (int)(projectile.damage * FourSeasonsGalaxia.PolarisAttunement_ShotDamageBoost), projectile.knockBack, Owner.whoAmI, Shred); + Projectile.NewProjectile(Projectile.Center, direction * 36f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred); } if (Dashing) { @@ -305,7 +306,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, sword.Height); Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition; - spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); return false; } diff --git a/Projectiles/Melee/Galaxia_PolarisGazeDash.cs b/Projectiles/Melee/Galaxia_PolarisGazeDash.cs index 7c2e204d0d..5b21b2ceb9 100644 --- a/Projectiles/Melee/Galaxia_PolarisGazeDash.cs +++ b/Projectiles/Melee/Galaxia_PolarisGazeDash.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Melee public class PolarisGazeDash : ModProjectile { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public Player Owner => Main.player[projectile.owner]; - public float Timer => 20 - projectile.timeLeft; + public Player Owner => Main.player[Projectile.owner]; + public float Timer => 20 - Projectile.timeLeft; public Vector2 DashStart; public Vector2 DashEnd; @@ -24,14 +24,14 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 8; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 60; - projectile.timeLeft = 20; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 8; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; + Projectile.timeLeft = 20; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee //Explode into cosmic bolts for (int i = 0; i < 3; i++) { - Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Owner.SafeDirectionTo(target.Center, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4) * 30f, ProjectileType(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.meleeDamage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.01f); + Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Owner.SafeDirectionTo(target.Center, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4) * 30f, ProjectileType(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.GetDamage(DamageClass.Melee)), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.01f); { blast.timeLeft = 100; } @@ -73,9 +73,9 @@ namespace CalamityMod.Projectiles.Melee Texture2D lineTex = GetTexture("CalamityMod/Particles/ThinEndedLine"); - Vector2 Shake = projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - projectile.timeLeft / 5f) * 0.5f; - float bump = (float)Math.Sin(((20f - projectile.timeLeft) / 20f) * MathHelper.Pi); - float raise = (float)Math.Sin(((20f - projectile.timeLeft) / 20f) * MathHelper.PiOver2); + Vector2 Shake = Projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - Projectile.timeLeft / 5f) * 0.5f; + float bump = (float)Math.Sin(((20f - Projectile.timeLeft) / 20f) * MathHelper.Pi); + float raise = (float)Math.Sin(((20f - Projectile.timeLeft) / 20f) * MathHelper.PiOver2); float rot = (DashEnd - DashStart).ToRotation() + MathHelper.PiOver2; Vector2 origin = new Vector2(lineTex.Width / 2f, lineTex.Height); diff --git a/Projectiles/Melee/Galaxia_PolarisGazeStar.cs b/Projectiles/Melee/Galaxia_PolarisGazeStar.cs index 2018c1c9ba..879b57671a 100644 --- a/Projectiles/Melee/Galaxia_PolarisGazeStar.cs +++ b/Projectiles/Melee/Galaxia_PolarisGazeStar.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,11 +15,11 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Particles/Sparkle"; private bool initialized = false; Vector2 direction = Vector2.Zero; - public ref float Shred => ref projectile.ai[0]; + public ref float Shred => ref Projectile.ai[0]; public float ShredRatio => MathHelper.Clamp(Shred / (PolarisGaze.maxShred * 0.5f), 0f, 1f); - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; - public float Timer => MaxTime - projectile.timeLeft; + public float Timer => MaxTime - Projectile.timeLeft; public const float MaxTime = 120; @@ -31,75 +32,75 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 45; - projectile.tileCollide = true; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 45; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.velocity *= 0.95f; + Projectile.velocity *= 0.95f; return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 84 * projectile.scale; - float bladeWidth = 76 * projectile.scale; + float bladeLenght = 84 * Projectile.scale; + float bladeWidth = 76 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center - direction * bladeLenght / 2, projectile.Center + direction * bladeLenght / 2, bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLenght / 2, Projectile.Center + direction * bladeLenght / 2, bladeWidth, ref collisionPoint); } public override void AI() { if (!initialized) { - Main.PlaySound(SoundID.Item90, projectile.Center); + SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); initialized = true; direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); - projectile.rotation = direction.ToRotation(); + Projectile.rotation = direction.ToRotation(); - projectile.timeLeft = (int)MaxTime; - projectile.velocity = direction * 16f; + Projectile.timeLeft = (int)MaxTime; + Projectile.velocity = direction * 16f; - projectile.scale = 1f + ShredRatio; //SWAGGER - projectile.netUpdate = true; + Projectile.scale = 1f + ShredRatio; //SWAGGER + Projectile.netUpdate = true; } - projectile.velocity *= 0.96f; - projectile.position += projectile.velocity; + Projectile.velocity *= 0.96f; + Projectile.position += Projectile.velocity; if (PolarStar == null) { - PolarStar = new GenericSparkle(projectile.Center, Vector2.Zero, Color.White, Color.CornflowerBlue, projectile.scale * 2f, 2, 0.1f, 5f, true); + PolarStar = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Color.CornflowerBlue, Projectile.scale * 2f, 2, 0.1f, 5f, true); GeneralParticleHandler.SpawnParticle(PolarStar); } else { PolarStar.Time = 0; - PolarStar.Position = projectile.Center; - PolarStar.Scale = projectile.scale * 2f; + PolarStar.Position = Projectile.Center; + PolarStar.Scale = Projectile.scale * 2f; } Vector2 smokeSpeed = Main.rand.NextVector2Circular(10f, 10f); - Particle smoke = new HeavySmokeParticle(projectile.Center, smokeSpeed + projectile.velocity / 2, Color.Lerp(Color.Purple, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f), 0.8f, 0, false, 0, true); + Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Projectile.velocity / 2, Color.Lerp(Color.Purple, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f), 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); if (Main.rand.Next(3) == 0) { - Particle smokeGlow = new HeavySmokeParticle(projectile.Center, smokeSpeed + projectile.velocity / 2, Main.hslToRgb(0.55f, 1, 0.5f), 20, Main.rand.NextFloat(0.4f, 0.7f), 0.8f, 0, true, 0.01f, true); + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Projectile.velocity / 2, Main.hslToRgb(0.55f, 1, 0.5f), 20, Main.rand.NextFloat(0.4f, 0.7f), 0.8f, 0, true, 0.01f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } @@ -111,11 +112,11 @@ namespace CalamityMod.Projectiles.Melee spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); var tex = GetTexture("CalamityMod/Particles/Sparkle"); - float opacityFade = projectile.timeLeft > 15 ? 1 : projectile.timeLeft / 15f; + float opacityFade = Projectile.timeLeft > 15 ? 1 : Projectile.timeLeft / 15f; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.5f * opacityFade, Main.GlobalTime * 10f + MathHelper.PiOver4, tex.Size() / 2f, projectile.scale * 1.5f, 0f, 0f); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.5f * opacityFade, Main.GlobalTime * 10f + MathHelper.PiOver4, tex.Size() / 2f, Projectile.scale * 1.5f, 0f, 0f); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f * opacityFade, Main.GlobalTime * 10f, tex.Size() / 2f, projectile.scale * 2f, 0f, 0f); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f * opacityFade, Main.GlobalTime * 10f, tex.Size() / 2f, Projectile.scale * 2f, 0f, 0f); //Back to normal spriteBatch.End(); @@ -126,19 +127,19 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item60, projectile.Center); + SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); for (int i = 0; i < 10; i++) { - Particle Sparkle = new CritSpark(projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * projectile.scale, Color.White, Main.rand.NextBool() ? Color.CornflowerBlue : Color.MediumSlateBlue, 0.4f + Main.rand.NextFloat(0f, 3.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * Projectile.scale, Color.White, Main.rand.NextBool() ? Color.CornflowerBlue : Color.MediumSlateBlue, 0.4f + Main.rand.NextFloat(0f, 3.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); Vector2 smokeSpeed = Main.rand.NextVector2Circular(20f, 20f); - Particle smoke = new HeavySmokeParticle(projectile.Center, smokeSpeed + projectile.velocity / 2, Color.Lerp(Color.DarkRed, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(1.5f, 2.2f), 0.8f, 0, false, 0, true); + Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Projectile.velocity / 2, Color.Lerp(Color.DarkRed, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(1.5f, 2.2f), 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); if (Main.rand.Next(3) == 0) { - Particle smokeGlow = new HeavySmokeParticle(projectile.Center, smokeSpeed + projectile.velocity / 2, Main.hslToRgb(0.55f, 1, 0.5f), 20, Main.rand.NextFloat(1.4f, 1.5f), 0.8f, 0, true, 0.01f, true); + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Projectile.velocity / 2, Main.hslToRgb(0.55f, 1, 0.5f), 20, Main.rand.NextFloat(1.4f, 1.5f), 0.8f, 0, true, 0.01f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } } diff --git a/Projectiles/Melee/GalaxyBlast.cs b/Projectiles/Melee/GalaxyBlast.cs index af667cd271..e28d9ab862 100644 --- a/Projectiles/Melee/GalaxyBlast.cs +++ b/Projectiles/Melee/GalaxyBlast.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,73 +17,73 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.aiStyle = 1; - projectile.penetrate = -1; - projectile.extraUpdates = 5; - projectile.tileCollide = false; - projectile.melee = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.aiStyle = 1; + Projectile.penetrate = -1; + Projectile.extraUpdates = 5; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + if (Projectile.ai[1] != -1f && Projectile.position.Y > Projectile.ai[1]) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.position.HasNaNs()) + if (Projectile.position.HasNaNs()) { - projectile.Kill(); + Projectile.Kill(); return; } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 0, default, 1f)]; - dust6.position = projectile.Center; + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 0, default, 1f)]; + dust6.position = Projectile.Center; dust6.velocity = Vector2.Zero; dust6.noGravity = true; if (flag5) { dust6.noLight = true; } - if (projectile.ai[1] == -1f) + if (Projectile.ai[1] == -1f) { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = projectile.height = 140; - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) + Projectile.ai[0] += 1f; + Projectile.velocity = Vector2.Zero; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 140; + Projectile.Center = Projectile.position; + Projectile.alpha -= 10; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + if (++Projectile.frameCounter >= Projectile.MaxUpdates * 3) { - projectile.frameCounter = 0; - projectile.frame++; + Projectile.frameCounter = 0; + Projectile.frame++; } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + if (Projectile.ai[0] >= (float)(Main.projFrames[Projectile.type] * Projectile.MaxUpdates * 3)) { - projectile.Kill(); + Projectile.Kill(); } return; } - projectile.alpha = 255; - if (projectile.numUpdates == 0) + Projectile.alpha = 255; + if (Projectile.numUpdates == 0) { int num158 = -1; float num159 = 60f; for (int num160 = 0; num160 < 200; num160++) { NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) + if (nPC.CanBeChasedBy(Projectile, false)) { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + float num161 = Projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(Projectile.Center, 0, 0, nPC.Center, 0, 0)) { num159 = num161; num158 = num160; @@ -91,31 +92,31 @@ namespace CalamityMod.Projectiles.Melee } if (num158 != -1) { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.ai[1] = -1f; + Projectile.netUpdate = true; } } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); for (int m = 0; m < 4; m++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1.5f); } for (int n = 0; n < 4; n++) { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 0, default, 2.5f); + int num10 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 0, default, 2.5f); Main.dust[num10].noGravity = true; Main.dust[num10].velocity *= 3f; if (flag) { Main.dust[num10].noLight = true; } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.5f); + num10 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1.5f); Main.dust[num10].velocity *= 2f; Main.dust[num10].noGravity = true; if (flag) @@ -128,7 +129,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.OnFire, 180); - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Melee/GalaxyBlastType2.cs b/Projectiles/Melee/GalaxyBlastType2.cs index 809c924fea..dd4ada5043 100644 --- a/Projectiles/Melee/GalaxyBlastType2.cs +++ b/Projectiles/Melee/GalaxyBlastType2.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,73 +17,73 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.aiStyle = 1; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.tileCollide = false; - projectile.melee = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.aiStyle = 1; + Projectile.penetrate = 1; + Projectile.extraUpdates = 5; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + if (Projectile.ai[1] != -1f && Projectile.position.Y > Projectile.ai[1]) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.position.HasNaNs()) + if (Projectile.position.HasNaNs()) { - projectile.Kill(); + Projectile.Kill(); return; } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 0, default, 1f)]; - dust6.position = projectile.Center; + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 0, default, 1f)]; + dust6.position = Projectile.Center; dust6.velocity = Vector2.Zero; dust6.noGravity = true; if (flag5) { dust6.noLight = true; } - if (projectile.ai[1] == -1f) + if (Projectile.ai[1] == -1f) { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = projectile.height = 140; - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) + Projectile.ai[0] += 1f; + Projectile.velocity = Vector2.Zero; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 140; + Projectile.Center = Projectile.position; + Projectile.alpha -= 10; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + if (++Projectile.frameCounter >= Projectile.MaxUpdates * 3) { - projectile.frameCounter = 0; - projectile.frame++; + Projectile.frameCounter = 0; + Projectile.frame++; } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + if (Projectile.ai[0] >= (float)(Main.projFrames[Projectile.type] * Projectile.MaxUpdates * 3)) { - projectile.Kill(); + Projectile.Kill(); } return; } - projectile.alpha = 255; - if (projectile.numUpdates == 0) + Projectile.alpha = 255; + if (Projectile.numUpdates == 0) { int num158 = -1; float num159 = 60f; for (int num160 = 0; num160 < 200; num160++) { NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) + if (nPC.CanBeChasedBy(Projectile, false)) { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + float num161 = Projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(Projectile.Center, 0, 0, nPC.Center, 0, 0)) { num159 = num161; num158 = num160; @@ -91,31 +92,31 @@ namespace CalamityMod.Projectiles.Melee } if (num158 != -1) { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.ai[1] = -1f; + Projectile.netUpdate = true; } } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); for (int m = 0; m < 4; m++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1.5f); } for (int n = 0; n < 4; n++) { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 0, default, 2.5f); + int num10 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 0, default, 2.5f); Main.dust[num10].noGravity = true; Main.dust[num10].velocity *= 3f; if (flag) { Main.dust[num10].noLight = true; } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1.5f); + num10 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1.5f); Main.dust[num10].velocity *= 2f; Main.dust[num10].noGravity = true; if (flag) @@ -128,7 +129,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Frostburn, 120); - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Melee/GalaxyBlastType3.cs b/Projectiles/Melee/GalaxyBlastType3.cs index 405aa418ce..fe2f837d7e 100644 --- a/Projectiles/Melee/GalaxyBlastType3.cs +++ b/Projectiles/Melee/GalaxyBlastType3.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,73 +17,73 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.aiStyle = 1; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.tileCollide = false; - projectile.melee = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.aiStyle = 1; + Projectile.penetrate = 1; + Projectile.extraUpdates = 5; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + if (Projectile.ai[1] != -1f && Projectile.position.Y > Projectile.ai[1]) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.position.HasNaNs()) + if (Projectile.position.HasNaNs()) { - projectile.Kill(); + Projectile.Kill(); return; } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 0, default, 1f)]; - dust6.position = projectile.Center; + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 57, 0f, 0f, 0, default, 1f)]; + dust6.position = Projectile.Center; dust6.velocity = Vector2.Zero; dust6.noGravity = true; if (flag5) { dust6.noLight = true; } - if (projectile.ai[1] == -1f) + if (Projectile.ai[1] == -1f) { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = projectile.height = 140; - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) + Projectile.ai[0] += 1f; + Projectile.velocity = Vector2.Zero; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 140; + Projectile.Center = Projectile.position; + Projectile.alpha -= 10; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + if (++Projectile.frameCounter >= Projectile.MaxUpdates * 3) { - projectile.frameCounter = 0; - projectile.frame++; + Projectile.frameCounter = 0; + Projectile.frame++; } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + if (Projectile.ai[0] >= (float)(Main.projFrames[Projectile.type] * Projectile.MaxUpdates * 3)) { - projectile.Kill(); + Projectile.Kill(); } return; } - projectile.alpha = 255; - if (projectile.numUpdates == 0) + Projectile.alpha = 255; + if (Projectile.numUpdates == 0) { int num158 = -1; float num159 = 60f; for (int num160 = 0; num160 < 200; num160++) { NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) + if (nPC.CanBeChasedBy(Projectile, false)) { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + float num161 = Projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(Projectile.Center, 0, 0, nPC.Center, 0, 0)) { num159 = num161; num158 = num160; @@ -91,31 +92,31 @@ namespace CalamityMod.Projectiles.Melee } if (num158 != -1) { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.ai[1] = -1f; + Projectile.netUpdate = true; } } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.position.X / 16, (int)Projectile.position.Y / 16)); for (int m = 0; m < 4; m++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 57, 0f, 0f, 100, default, 1.5f); } for (int n = 0; n < 4; n++) { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 0, default, 2.5f); + int num10 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 57, 0f, 0f, 0, default, 2.5f); Main.dust[num10].noGravity = true; Main.dust[num10].velocity *= 3f; if (flag) { Main.dust[num10].noLight = true; } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 100, default, 1.5f); + num10 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 57, 0f, 0f, 100, default, 1.5f); Main.dust[num10].velocity *= 2f; Main.dust[num10].noGravity = true; if (flag) @@ -128,7 +129,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Ichor, 60); - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Melee/GalaxySmasherHammer.cs b/Projectiles/Melee/GalaxySmasherHammer.cs index e9a0c6bb7e..1ea9dfc087 100644 --- a/Projectiles/Melee/GalaxySmasherHammer.cs +++ b/Projectiles/Melee/GalaxySmasherHammer.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -20,25 +21,25 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Galaxy Smasher"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 62; - projectile.height = 62; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = Lifetime; + Projectile.width = 62; + Projectile.height = 62; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = Lifetime; // Slightly ignores iframes so it can easily hit twice. - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override void AI() @@ -53,89 +54,89 @@ namespace CalamityMod.Projectiles.Melee { int dustType = Main.rand.NextBool(6) ? 112 : 173; float scale = 0.8f + Main.rand.NextFloat(0.6f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); Main.dust[idx].noGravity = true; Main.dust[idx].velocity = Vector2.Zero; Main.dust[idx].scale = scale; } // The hammer makes sound while flying. - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, (int)projectile.position.X, (int)projectile.position.Y); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, (int)Projectile.position.X, (int)Projectile.position.Y); } // ai[0] stores whether the hammer is returning. If 0, it isn't. If 1, it is. - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= ReboundTime) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= ReboundTime) { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } } else { - projectile.tileCollide = false; + Projectile.tileCollide = false; float returnSpeed = GalaxySmasherMelee.Speed; float acceleration = 3.2f; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; // Delete the hammer if it's excessively far away. Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); dist = returnSpeed / dist; xDist *= dist; yDist *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) + if (Projectile.velocity.X < xDist) { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X = Projectile.velocity.X + acceleration; + if (Projectile.velocity.X < 0f && xDist > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > xDist) + else if (Projectile.velocity.X > xDist) { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X = Projectile.velocity.X - acceleration; + if (Projectile.velocity.X > 0f && xDist < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < yDist) + if (Projectile.velocity.Y < yDist) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; + if (Projectile.velocity.Y < 0f && yDist > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > yDist) + else if (Projectile.velocity.Y > yDist) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; + if (Projectile.velocity.Y > 0f && yDist < 0f) + Projectile.velocity.Y -= acceleration; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); } // Rotate the hammer as it flies. - projectile.rotation += RotationIncrement; + Projectile.rotation += RotationIncrement; return; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -181,11 +182,11 @@ namespace CalamityMod.Projectiles.Melee } // Makes an explosion sound. - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); // Three death lasers (aka "Nebula Shots") swarm the target. int laserID = ModContent.ProjectileType(); - int laserDamage = (int)(0.2f * projectile.damage); + int laserDamage = (int)(0.2f * Projectile.damage); float laserKB = 2.5f; int numLasers = 3; for (int i = 0; i < numLasers; ++i) @@ -197,9 +198,9 @@ namespace CalamityMod.Projectiles.Melee float laserSpeed = Main.rand.NextFloat(15f, 18f); Vector2 velocity = startDir * -laserSpeed; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(startPoint, velocity, laserID, laserDamage, laserKB, projectile.owner); + int proj = Projectile.NewProjectile(startPoint, velocity, laserID, laserDamage, laserKB, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().forceMelee = true; diff --git a/Projectiles/Melee/GalaxyStar.cs b/Projectiles/Melee/GalaxyStar.cs index 722a807266..efbedd862b 100644 --- a/Projectiles/Melee/GalaxyStar.cs +++ b/Projectiles/Melee/GalaxyStar.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -13,44 +14,44 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 42; - projectile.height = 42; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 160; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.width = 42; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 160; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override void AI() { - Lighting.AddLight(projectile.Center, 1f, 1f, 1f); + Lighting.AddLight(Projectile.Center, 1f, 1f, 1f); if (!madeCoolMagicSound) { - Main.PlaySound(SoundID.Item9, projectile.position); // Starfury sound + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); // Starfury sound madeCoolMagicSound = true; } - projectile.ai[0]++; - if (projectile.ai[0] % 5 == 0) + Projectile.ai[0]++; + if (Projectile.ai[0] % 5 == 0) { for (int i = 0; i < Main.rand.Next(2, 4); i++) //2-3 stars { Vector2 randVector = Vector2.One.RotatedByRandom(Math.PI * 2.0) * 0.7f; - Dust.NewDust(projectile.Center, 4, 4, 58, randVector.X, randVector.Y, 0, default, 1f); + Dust.NewDust(Projectile.Center, 4, 4, 58, randVector.X, randVector.Y, 0, default, 1f); } } - projectile.rotation += projectile.velocity.Length() / 19f; + Projectile.rotation += Projectile.velocity.Length() / 19f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/GalileosMoon.cs b/Projectiles/Melee/GalileosMoon.cs index fdf030263f..916c16316f 100644 --- a/Projectiles/Melee/GalileosMoon.cs +++ b/Projectiles/Melee/GalileosMoon.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,44 +15,44 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Crescent Moon"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 12; - projectile.extraUpdates = 1; - projectile.timeLeft = 135 * projectile.MaxUpdates; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = projectile.MaxUpdates * 10; + Projectile.width = 50; + Projectile.height = 50; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 12; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 135 * Projectile.MaxUpdates; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 10; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0f, 0.6f); - if (projectile.soundDelay == 0) + Lighting.AddLight(Projectile.Center, 0f, 0f, 0.6f); + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); } } - projectile.rotation += projectile.direction * 0.55f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 10f, 25f); + Projectile.rotation += Projectile.direction * 0.55f; + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 250f, 10f, 25f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GalileosPlanet.cs b/Projectiles/Melee/GalileosPlanet.cs index 34bfe7e781..648270acf5 100644 --- a/Projectiles/Melee/GalileosPlanet.cs +++ b/Projectiles/Melee/GalileosPlanet.cs @@ -6,6 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.Graphics.Shaders; using CalamityMod.Buffs.DamageOverTime; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,28 +17,28 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Planet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 88; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; + Projectile.width = Projectile.height = 88; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; for (float i = -5; i <= 0; i++) { if (Main.rand.NextFloat(1f) < 0.4f) { // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. - Vector2 pos = projectile.position + new Vector2((projectile.width / 2) - 8, projectile.height + 16); + Vector2 pos = Projectile.position + new Vector2((Projectile.width / 2) - 8, Projectile.height + 16); Dust dust1 = Dust.NewDustPerfect(pos + new Vector2(-20 + i, -2), 180, new Vector2(i * 0.7f, -1.1f)); dust1.noGravity = true; } @@ -47,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextFloat(1f) < 0.4f) { // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. - Vector2 pos = projectile.position + new Vector2((projectile.width / 2) - 8, projectile.height + 16); + Vector2 pos = Projectile.position + new Vector2((Projectile.width / 2) - 8, Projectile.height + 16); Dust dust1 = Dust.NewDustPerfect(pos + new Vector2(20 + i, -2), 180, new Vector2(i * 0.7f, -1.1f)); dust1.noGravity = true; } @@ -55,48 +56,48 @@ namespace CalamityMod.Projectiles.Melee Dust dust; // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. - Vector2 pos2 = projectile.Center - new Vector2(20, 20); + Vector2 pos2 = Projectile.Center - new Vector2(20, 20); dust = Main.dust[Dust.NewDust(pos2, 40, 40, 180, 0f, 0f, 0, new Color(255, 255, 255), 1f)]; - Lighting.AddLight(projectile.Center, 0.3f, 0.3f, 0.7f); + Lighting.AddLight(Projectile.Center, 0.3f, 0.3f, 0.7f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 32; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); radius = 100; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); for (int i = 0; i < 72; i++) { Dust dust; // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. - Vector2 position = projectile.Center - new Vector2(30, 30); + Vector2 position = Projectile.Center - new Vector2(30, 30); dust = Main.dust[Terraria.Dust.NewDust(position, 60, 60, 187, Main.rand.Next(-5, 5), Main.rand.Next(-5, 5), 0, new Color(0, 167, 255), 5f)]; dust.noGravity = true; dust.shader = GameShaders.Armor.GetSecondaryShader(47, Main.LocalPlayer); } - Main.PlaySound(SoundID.NPCDeath43, projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath43, Projectile.position); for (int i = 0; i < 155; i++) { Dust dust; // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. - Vector2 position = projectile.position; + Vector2 position = Projectile.position; dust = Main.dust[Dust.NewDust(position, 94, 94, 180, Main.rand.Next(-5, 5), Main.rand.Next(-5, 5), 0, new Color(255, 255, 255), Main.rand.NextFloat(1.2f, 2.2f))]; dust.noGravity = true; } @@ -106,9 +107,9 @@ namespace CalamityMod.Projectiles.Melee int num20 = 36; for (int i = 0; i < num20; i++) { - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f * 0.5f; - spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + projectile.Center; - Vector2 vector = spinningpoint - projectile.Center; + Vector2 spinningpoint = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f * 0.5f; + spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + Projectile.Center; + Vector2 vector = spinningpoint - Projectile.Center; int num21 = Dust.NewDust(spinningpoint + vector, 0, 0, 180, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 1f); Main.dust[num21].noGravity = true; Main.dust[num21].velocity = Vector2.Normalize(vector) * x; @@ -120,16 +121,16 @@ namespace CalamityMod.Projectiles.Melee int num20 = 36; for (int i = 0; i < num20; i++) { - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f * 0.5f; - spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + projectile.Center; - Vector2 vector = spinningpoint - projectile.Center; + Vector2 spinningpoint = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f * 0.5f; + spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + Projectile.Center; + Vector2 vector = spinningpoint - Projectile.Center; int num21 = Dust.NewDust(spinningpoint + vector, 0, 0, 180, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 1f); Main.dust[num21].noGravity = true; Main.dust[num21].velocity = Vector2.Normalize(vector) * x; Main.dust[num21].velocity *= 2; } } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -137,6 +138,6 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(ModContent.BuffType(), 240); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); } } diff --git a/Projectiles/Melee/GelWave.cs b/Projectiles/Melee/GelWave.cs index 09de9e64a3..4628360653 100644 --- a/Projectiles/Melee/GelWave.cs +++ b/Projectiles/Melee/GelWave.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -12,65 +13,65 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Wave"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = 2; - projectile.alpha = 120; - projectile.timeLeft = 200; - projectile.tileCollide = false; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 2; + Projectile.alpha = 120; + Projectile.timeLeft = 200; + Projectile.tileCollide = false; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item92, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item92, Projectile.position); + Projectile.localAI[0] += 1f; } - Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.4f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.velocity.Y += projectile.ai[0]; + Lighting.AddLight(Projectile.Center, 0f, 0.2f, 0.4f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.velocity.Y += Projectile.ai[0]; if (Main.rand.NextBool(2)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 20, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 195) + if (Projectile.timeLeft > 195) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override void Kill(int timeLeft) { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 20, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Slimed, 300); - projectile.velocity *= 0.5f; + Projectile.velocity *= 0.5f; } } } diff --git a/Projectiles/Melee/GemTechYellowShard.cs b/Projectiles/Melee/GemTechYellowShard.cs index 8d4bf1777f..79f15b6930 100644 --- a/Projectiles/Melee/GemTechYellowShard.cs +++ b/Projectiles/Melee/GemTechYellowShard.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -9,7 +10,7 @@ namespace CalamityMod.Projectiles.Melee { public const int IntangibleFrames = 12; - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/ExtraTextures/GemTechArmor/YellowGem"; @@ -17,34 +18,34 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.MaxUpdates = 2; - projectile.timeLeft = 45; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.ignoreWater = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 45; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.ignoreWater = true; } public override void AI() { - if (projectile.FinalExtraUpdate()) + if (Projectile.FinalExtraUpdate()) Time++; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { // Play a shatter sound. - Main.PlaySound(SoundID.Item27, projectile.Center); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); // Create a triangular puff of yellow dust. Vector2 initialVelocity = (Main.rand.NextFloatDirection() * 0.11f).ToRotationVector2() * Main.rand.NextFloat(2f, 3.3f); for (int i = 0; i < 4; i++) { - Dust crystalShard = Dust.NewDustPerfect(projectile.Center, 267); + Dust crystalShard = Dust.NewDustPerfect(Projectile.Center, 267); crystalShard.velocity = initialVelocity * i / 4f; crystalShard.scale = 1.225f; crystalShard.color = Color.Yellow; @@ -53,12 +54,12 @@ namespace CalamityMod.Projectiles.Melee Dust.CloneDust(crystalShard).velocity = initialVelocity.RotatedBy(MathHelper.Pi * 0.666f) * i / 4f; Dust.CloneDust(crystalShard).velocity = initialVelocity.RotatedBy(MathHelper.Pi * -0.666f) * i / 4f; } - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } - projectile.velocity = projectile.velocity.RotatedBy(MathHelper.Pi * 0.0005f); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.Opacity = (float)System.Math.Sqrt(projectile.timeLeft / 45f); + Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.Pi * 0.0005f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.Opacity = (float)System.Math.Sqrt(Projectile.timeLeft / 45f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/GhastlySoulLarge.cs b/Projectiles/Melee/GhastlySoulLarge.cs index 130687f86d..349cd1f611 100644 --- a/Projectiles/Melee/GhastlySoulLarge.cs +++ b/Projectiles/Melee/GhastlySoulLarge.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,81 +15,81 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Ghastly Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 1.2f; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 30; + Projectile.height = 30; + Projectile.scale = 1.2f; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 0, default, 1f); + int num822 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; Main.dust[num822].scale = 1.3f; Main.dust[num822].noGravity = true; - float num953 = 30f * projectile.ai[1]; //100 - float scaleFactor12 = 6f * projectile.ai[1]; //5 + float num953 = 30f * Projectile.ai[1]; //100 + float scaleFactor12 = 6f * Projectile.ai[1]; //5 float num954 = 900f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + if (Projectile.Distance(Main.player[Projectile.owner].Center) > num954) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); } else { - if (projectile.timeLeft > 30) + if (Projectile.timeLeft > 30) { - projectile.timeLeft = 30; + Projectile.timeLeft = 30; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -102,22 +103,22 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 112; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoulEdge.ProjectileDeathSound, projectile.Center); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 112; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 2f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; diff --git a/Projectiles/Melee/GhastlySoulMedium.cs b/Projectiles/Melee/GhastlySoulMedium.cs index 40efbb59ef..ed66a2eea1 100644 --- a/Projectiles/Melee/GhastlySoulMedium.cs +++ b/Projectiles/Melee/GhastlySoulMedium.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,81 +15,81 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Ghastly Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 1.1f; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 30; + Projectile.height = 30; + Projectile.scale = 1.1f; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 0, default, 1f); + int num822 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; Main.dust[num822].scale = 1.3f; Main.dust[num822].noGravity = true; - float num953 = 35f * projectile.ai[1]; //100 - float scaleFactor12 = 7f * projectile.ai[1]; //5 + float num953 = 35f * Projectile.ai[1]; //100 + float scaleFactor12 = 7f * Projectile.ai[1]; //5 float num954 = 900f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + if (Projectile.Distance(Main.player[Projectile.owner].Center) > num954) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); } else { - if (projectile.timeLeft > 30) + if (Projectile.timeLeft > 30) { - projectile.timeLeft = 30; + Projectile.timeLeft = 30; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -102,22 +103,22 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 96; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoulEdge.ProjectileDeathSound, projectile.Center); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 96; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 2f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; diff --git a/Projectiles/Melee/GhastlySoulSmall.cs b/Projectiles/Melee/GhastlySoulSmall.cs index 57162ceba7..bef793ba58 100644 --- a/Projectiles/Melee/GhastlySoulSmall.cs +++ b/Projectiles/Melee/GhastlySoulSmall.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,80 +15,80 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Ghastly Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 30; + Projectile.height = 30; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 0, default, 1f); + int num822 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; Main.dust[num822].scale = 1.3f; Main.dust[num822].noGravity = true; - float num953 = 40f * projectile.ai[1]; //100 - float scaleFactor12 = 8f * projectile.ai[1]; //5 + float num953 = 40f * Projectile.ai[1]; //100 + float scaleFactor12 = 8f * Projectile.ai[1]; //5 float num954 = 900f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + if (Projectile.Distance(Main.player[Projectile.owner].Center) > num954) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); } else { - if (projectile.timeLeft > 30) + if (Projectile.timeLeft > 30) { - projectile.timeLeft = 30; + Projectile.timeLeft = 30; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -101,22 +102,22 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoulEdge.ProjectileDeathSound, projectile.Center); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 2f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; diff --git a/Projectiles/Melee/GreenDust.cs b/Projectiles/Melee/GreenDust.cs index ff2a046271..c11755e83f 100644 --- a/Projectiles/Melee/GreenDust.cs +++ b/Projectiles/Melee/GreenDust.cs @@ -13,62 +13,62 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.timeLeft = 3600; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 3600; } public override void AI() { - projectile.rotation += projectile.velocity.X * 0.02f; - if (projectile.velocity.X < 0f) + Projectile.rotation += Projectile.velocity.X * 0.02f; + if (Projectile.velocity.X < 0f) { - projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; + Projectile.rotation -= Math.Abs(Projectile.velocity.Y) * 0.02f; } else { - projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; + Projectile.rotation += Math.Abs(Projectile.velocity.Y) * 0.02f; } - projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 60f) + Projectile.velocity *= 0.98f; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 60f) { - if (projectile.timeLeft > 85) - projectile.timeLeft = 85; - if (projectile.alpha < 255) + if (Projectile.timeLeft > 85) + Projectile.timeLeft = 85; + if (Projectile.alpha < 255) { - projectile.alpha += 2; - if (projectile.alpha > 255) + Projectile.alpha += 2; + if (Projectile.alpha > 255) { - projectile.alpha = 255; + Projectile.alpha = 255; } } - else if (projectile.owner == Main.myPlayer) + else if (Projectile.owner == Main.myPlayer) { - projectile.Kill(); + Projectile.Kill(); } } - else if (projectile.alpha > 80) + else if (Projectile.alpha > 80) { - projectile.alpha -= 30; - if (projectile.alpha < 80) + Projectile.alpha -= 30; + if (Projectile.alpha < 80) { - projectile.alpha = 80; + Projectile.alpha = 80; } } } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } diff --git a/Projectiles/Melee/GreenWater.cs b/Projectiles/Melee/GreenWater.cs index eac12f7a05..4de989e348 100644 --- a/Projectiles/Melee/GreenWater.cs +++ b/Projectiles/Melee/GreenWater.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -12,59 +13,59 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Tooth"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 150; - projectile.melee = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 150; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.5f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0.5f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item21, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item21, Projectile.position); + Projectile.localAI[0] += 1f; } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 145) + if (Projectile.timeLeft > 145) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.Center); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); int num3; for (int num795 = 4; num795 < 31; num795 = num3 + 1) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 5, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / (float)num795); + float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 5, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 5, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 5, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[num798]; dust.velocity *= 0.05f; num3 = num795; diff --git a/Projectiles/Melee/HellionSpike.cs b/Projectiles/Melee/HellionSpike.cs index 5c9d85cb79..806c8665a0 100644 --- a/Projectiles/Melee/HellionSpike.cs +++ b/Projectiles/Melee/HellionSpike.cs @@ -11,28 +11,28 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Spike"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 600; + Projectile.width = 10; + Projectile.height = 10; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.timeLeft = 600; aiType = ProjectileID.SporeCloud; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0f); if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 44, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } @@ -40,22 +40,22 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 44, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; + target.immune[Projectile.owner] = 8; OnHitEffects(target.Center, crit); target.AddBuff(BuffID.Venom, 180); } @@ -70,9 +70,9 @@ namespace CalamityMod.Projectiles.Melee { if (crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile petal = CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, true); + Projectile petal = CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ProjectileID.FlowerPetal, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, true); if (petal.whoAmI.WithinBounds(Main.maxProjectiles)) { petal.Calamity().forceMelee = true; diff --git a/Projectiles/Melee/HolyColliderHolyFire.cs b/Projectiles/Melee/HolyColliderHolyFire.cs index 227abac88c..226736d204 100644 --- a/Projectiles/Melee/HolyColliderHolyFire.cs +++ b/Projectiles/Melee/HolyColliderHolyFire.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class HolyColliderHolyFire : ModProjectile @@ -13,67 +14,67 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 90; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 90; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 75 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 75 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - if (Math.Abs(projectile.velocity.X) < 7f) - projectile.velocity.X *= 1.05f; + if (Math.Abs(Projectile.velocity.X) < 7f) + Projectile.velocity.X *= 1.05f; - if (projectile.timeLeft < 75) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 450f, 12f, 20f); + if (Projectile.timeLeft < 75) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 450f, 12f, 20f); } public override Color? GetAlpha(Color lightColor) { - return new Color(250, 150, 0, projectile.alpha); + return new Color(250, 150, 0, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 150; + Projectile.height = 150; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; @@ -82,9 +83,9 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); } } } diff --git a/Projectiles/Melee/HyperBlade.cs b/Projectiles/Melee/HyperBlade.cs index 0e26cb83a4..2c3c54d009 100644 --- a/Projectiles/Melee/HyperBlade.cs +++ b/Projectiles/Melee/HyperBlade.cs @@ -11,40 +11,40 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 18; - projectile.alpha = 100; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = 5; - projectile.timeLeft = 300; - projectile.ignoreWater = true; + Projectile.width = 50; + Projectile.height = 50; + Projectile.aiStyle = 18; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 5; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; aiType = ProjectileID.DeathSickle; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; + Projectile.extraUpdates = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.5f, 0f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 10f, 10f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 300f, 10f, 10f); } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/IceBombFriendly.cs b/Projectiles/Melee/IceBombFriendly.cs index 3792533242..4879fcb180 100644 --- a/Projectiles/Melee/IceBombFriendly.cs +++ b/Projectiles/Melee/IceBombFriendly.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -18,50 +19,50 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 0.5f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; + Projectile.width = 30; + Projectile.height = 30; + Projectile.scale = 0.5f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; } - public override bool CanDamage() => projectile.ai[0] >= 120f; + public override bool CanDamage() => Projectile.ai[0] >= 120f; public override void AI() { - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.01f; - projectile.alpha -= 50; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 50; + if (Projectile.alpha <= 0) { - projectile.localAI[0] = 1f; - projectile.alpha = 0; + Projectile.localAI[0] = 1f; + Projectile.alpha = 0; } } else { - projectile.scale -= 0.01f; - projectile.alpha += 50; - if (projectile.alpha >= 255) + Projectile.scale -= 0.01f; + Projectile.alpha += 50; + if (Projectile.alpha >= 255) { - projectile.localAI[0] = 0f; - projectile.alpha = 255; + Projectile.localAI[0] = 0f; + Projectile.alpha = 255; } } - if (projectile.ai[0] < 120f) + if (Projectile.ai[0] < 120f) { - projectile.ai[0] += 1f; - if (projectile.ai[0] == 120f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] == 120f) { for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -71,45 +72,45 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 14; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - projectile.scale = 1f; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(30f * projectile.scale)); - Main.PlaySound(SoundID.Item30, projectile.Center); + Projectile.scale = 1f; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, (int)(30f * Projectile.scale)); + SoundEngine.PlaySound(SoundID.Item30, Projectile.Center); } } } public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? new Color(50, 50, 255, projectile.alpha) : new Color(255, 255, 255, projectile.alpha); + return Main.dayTime ? new Color(50, 50, 255, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (i = 0; i < 2; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, (int)(projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + int projectile1 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); if (projectile1.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectile1].Calamity().forceMelee = true; Main.projectile[projectile1].penetrate = 2; } - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, (int)(projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + int projectile2 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); if (projectile2.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectile2].Calamity().forceMelee = true; @@ -119,7 +120,7 @@ namespace CalamityMod.Projectiles.Melee } for (int k = 0; k < 3; k++) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Iceberg.cs b/Projectiles/Melee/Iceberg.cs index 0767a762c8..6b40723628 100644 --- a/Projectiles/Melee/Iceberg.cs +++ b/Projectiles/Melee/Iceberg.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class Iceberg : ModProjectile @@ -13,35 +14,35 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Iceberg"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.coldDamage = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.coldDamage = true; } public override void AI() { - projectile.rotation += 0.5f; - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1f); + Projectile.rotation += 0.5f; + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } @@ -52,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs index 1a20852a7d..d6c5a51172 100644 --- a/Projectiles/Melee/IllustriousKnife.cs +++ b/Projectiles/Melee/IllustriousKnife.cs @@ -14,48 +14,48 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Illustrious Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 50; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; + Projectile.width = 14; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 240f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 240f) { - projectile.alpha += 4; - projectile.damage = (int)(projectile.damage * 0.95); - projectile.knockBack = (int)(projectile.knockBack * 0.95); + Projectile.alpha += 4; + Projectile.damage = (int)(Projectile.damage * 0.95); + Projectile.knockBack = (int)(Projectile.knockBack * 0.95); } - if (projectile.ai[0] < 240f) - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; + if (Projectile.ai[0] < 240f) + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 1.57f; else { - projectile.rotation += 0.5f; + Projectile.rotation += 0.5f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); if (Main.rand.NextBool(6)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 20, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void Kill(int timeLeft) { for (int num303 = 0; num303 < 3; num303++) { - int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 0.8f); + int num304 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 0.8f); Main.dust[num304].noGravity = true; Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; + Main.dust[num304].velocity -= Projectile.oldVelocity * 0.3f; } } @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee if (healAmt > CalamityMod.lifeStealCap) healAmt = CalamityMod.lifeStealCap; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); } public override void OnHitPvp(Player target, int damage, bool crit) @@ -90,12 +90,12 @@ namespace CalamityMod.Projectiles.Melee if (healAmt > CalamityMod.lifeStealCap) healAmt = CalamityMod.lifeStealCap; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/InsidiousHarpoon.cs b/Projectiles/Melee/InsidiousHarpoon.cs index 1c3fb31e63..a1c5feb40a 100644 --- a/Projectiles/Melee/InsidiousHarpoon.cs +++ b/Projectiles/Melee/InsidiousHarpoon.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -12,32 +13,32 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Harpoon"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 8; - projectile.alpha = 255; - projectile.melee = true; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20 * projectile.extraUpdates; - projectile.tileCollide = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 8; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Melee; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20 * Projectile.extraUpdates; + Projectile.tileCollide = true; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha < 0) + Projectile.alpha = 0; int num297 = 171; if (Main.rand.Next(3) == 0) @@ -46,31 +47,31 @@ namespace CalamityMod.Projectiles.Melee } if (Main.rand.NextBool(9)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, num297, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - projectile.rotation += projectile.spriteDirection * MathHelper.ToRadians(45f); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.rotation += Projectile.spriteDirection * MathHelper.ToRadians(45f); } //Sticky Behaviour - projectile.StickyProjAI(15); - if (projectile.ai[0] == 2f) + Projectile.StickyProjAI(15); + if (Projectile.ai[0] == 2f) { - projectile.velocity *= 0f; + Projectile.velocity *= 0f; } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(20, true); + Projectile.ModifyHitNPCSticky(20, true); } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.ai[0] = 2f; - projectile.timeLeft = 300; + Projectile.ai[0] = 2f; + Projectile.timeLeft = 300; return false; } @@ -81,17 +82,17 @@ namespace CalamityMod.Projectiles.Melee { num297 = 46; } - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.Damage(); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -101,17 +102,17 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/JudgementBlah.cs b/Projectiles/Melee/JudgementBlah.cs index f88917cb28..6ce8ca6481 100644 --- a/Projectiles/Melee/JudgementBlah.cs +++ b/Projectiles/Melee/JudgementBlah.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,117 +15,117 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Blah Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.extraUpdates = 3; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.melee = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.extraUpdates = 3; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item60, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item60, Projectile.position); } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) + Projectile.scale -= 0.02f; + Projectile.alpha += 30; + if (Projectile.alpha >= 250) { - projectile.alpha = 255; - projectile.localAI[0] = 1f; + Projectile.alpha = 255; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) + Projectile.scale += 0.02f; + Projectile.alpha -= 30; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[0] = 0f; + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; } } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); whiteLightTimer--; if (whiteLightTimer == 0) { float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (i = 0; i < 1; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 0.6f), (float)(Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 0.6f), (float)(-Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 0.6f), (float)(Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 0.6f), (float)(-Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } whiteLightTimer = 5; } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.6f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.6f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 10f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 10f, 20f); } public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 115) + if (Projectile.timeLeft > 115) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item122, projectile.Center); + SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); for (int num193 = 0; num193 < 2; num193++) { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[dust].noGravity = true; } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/JudgementProj.cs b/Projectiles/Melee/JudgementProj.cs index b6166b88ef..7dcdc7c58f 100644 --- a/Projectiles/Melee/JudgementProj.cs +++ b/Projectiles/Melee/JudgementProj.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class JudgementProj : ModProjectile @@ -18,13 +19,13 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.melee = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.DamageType = DamageClass.Melee; } public override void AI() @@ -33,17 +34,17 @@ namespace CalamityMod.Projectiles.Melee if (whiteLightTimer == 0) { float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (i = 0; i < 1; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int projectile1 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + int projectile2 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); Main.projectile[projectile1].velocity.X *= 0.1f; Main.projectile[projectile1].velocity.Y *= 0.1f; Main.projectile[projectile2].velocity.X *= 0.1f; @@ -53,25 +54,25 @@ namespace CalamityMod.Projectiles.Melee whiteLightTimer = 5; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); for (int num457 = 0; num457 < 2; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1.25f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 91, 0f, 0f, 100, default, 1.25f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 9f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 9f, 20f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item122, projectile.position); - if (projectile.owner == Main.myPlayer) + SoundEngine.PlaySound(SoundID.Item122, Projectile.position); + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/LaserFountain.cs b/Projectiles/Melee/LaserFountain.cs index 622300a660..4f2dc60a84 100644 --- a/Projectiles/Melee/LaserFountain.cs +++ b/Projectiles/Melee/LaserFountain.cs @@ -13,33 +13,33 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 60; - projectile.melee = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 60; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; float SpeedX = (float)Main.rand.Next(-15, 15); float SpeedY = (float)Main.rand.Next(-20, -10); - if (projectile.localAI[0] >= 12f) + if (Projectile.localAI[0] >= 12f) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(350f * Main.player[projectile.owner].MeleeDamage()), projectile.knockBack, projectile.owner, 0f, 0f); + int projectile1 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(350f * Main.player[Projectile.owner].MeleeDamage()), Projectile.knockBack, Projectile.owner, 0f, 0f); if (projectile1.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectile1].Calamity().forceMelee = true; Main.projectile[projectile1].aiStyle = 1; } } - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } } } diff --git a/Projectiles/Melee/Leech.cs b/Projectiles/Melee/Leech.cs index d57d1800af..ea6f998716 100644 --- a/Projectiles/Melee/Leech.cs +++ b/Projectiles/Melee/Leech.cs @@ -14,45 +14,45 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.melee = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Melee; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 2; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } } - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 6f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 6f, 20f); } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 14, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Main.player[projectile.owner].moonLeech) + if (Main.player[Projectile.owner].moonLeech) return; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.statLife += 2; player.HealEffect(2); } diff --git a/Projectiles/Melee/LifeScythe.cs b/Projectiles/Melee/LifeScythe.cs index c6c30db90d..42cc033858 100644 --- a/Projectiles/Melee/LifeScythe.cs +++ b/Projectiles/Melee/LifeScythe.cs @@ -11,39 +11,39 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 62; - projectile.height = 72; - projectile.aiStyle = 18; - projectile.alpha = 55; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 5; - projectile.timeLeft = 240; - projectile.ignoreWater = true; - projectile.tileCollide = false; + Projectile.width = 62; + Projectile.height = 72; + Projectile.aiStyle = 18; + Projectile.alpha = 55; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 5; + Projectile.timeLeft = 240; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; aiType = ProjectileID.DeathSickle; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; } public override void AI() { float num395 = Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; - projectile.scale = num395 + 0.95f; + Projectile.scale = num395 + 0.95f; - Lighting.AddLight(projectile.Center, 0.1f, 0.5f, 0.15f); + Lighting.AddLight(Projectile.Center, 0.1f, 0.5f, 0.15f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/Light.cs b/Projectiles/Melee/Light.cs index c89e9a10e4..6c4d0f555f 100644 --- a/Projectiles/Melee/Light.cs +++ b/Projectiles/Melee/Light.cs @@ -12,36 +12,36 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Light"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 300; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; } public override void AI() { - projectile.rotation += 0.5f; + Projectile.rotation += 0.5f; speedTimer--; if (speedTimer <= 0) { speedTimer = speedTimerMax; - projectile.velocity *= -1f; + Projectile.velocity *= -1f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/LightBeam.cs b/Projectiles/Melee/LightBeam.cs index 9658221aa9..580b62fb77 100644 --- a/Projectiles/Melee/LightBeam.cs +++ b/Projectiles/Melee/LightBeam.cs @@ -11,35 +11,35 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Light Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 56; - projectile.height = 56; - projectile.aiStyle = 18; + Projectile.width = 56; + Projectile.height = 56; + Projectile.aiStyle = 18; aiType = ProjectileID.DeathSickle; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.6f / 255f, 0f, (255 - projectile.alpha) * 0.2f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.6f / 255f, 0f, (255 - Projectile.alpha) * 0.2f / 255f); - if (projectile.velocity.Length() < 18f) - projectile.velocity *= 1.1f; + if (Projectile.velocity.Length() < 18f) + Projectile.velocity *= 1.1f; } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * (b2 / 255f)); return new Color(b2, b2, b2, a2); } @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -61,16 +61,16 @@ namespace CalamityMod.Projectiles.Melee { for (int num105 = 0; num105 < 20; num105++) { - int num102 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 73, 0f, 0f, 0, default, 1f); + int num102 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 73, 0f, 0f, 0, default, 1f); Main.dust[num102].noGravity = true; - Main.dust[num102].velocity += projectile.velocity * 0.1f; + Main.dust[num102].velocity += Projectile.velocity * 0.1f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int k = 0; k < 3; k++) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)(projectile.damage * 0.5), projectile.knockBack * 0.15f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), + (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.15f, Main.myPlayer, 1f, 0f); } } } diff --git a/Projectiles/Melee/LightningThing.cs b/Projectiles/Melee/LightningThing.cs index 4524bb304f..520439973f 100644 --- a/Projectiles/Melee/LightningThing.cs +++ b/Projectiles/Melee/LightningThing.cs @@ -16,19 +16,19 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.timeLeft = 90; - projectile.melee = true; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.timeLeft = 90; + Projectile.DamageType = DamageClass.Melee; } public override void Kill(int timeLeft) { - int damage = (int)(GaelsGreatsword.BaseDamage * Main.player[projectile.owner].MeleeDamage()); + int damage = (int)(GaelsGreatsword.BaseDamage * Main.player[Projectile.owner].MeleeDamage()); for (int i = 0; i < 3; i++) { - int idx = Projectile.NewProjectile(projectile.Center + new Vector2(Main.rand.NextFloat(-35f, 35f), -1600f), Vector2.UnitY * 12f, - ProjectileID.CultistBossLightningOrbArc, damage, 0f, projectile.owner, + int idx = Projectile.NewProjectile(Projectile.Center + new Vector2(Main.rand.NextFloat(-35f, 35f), -1600f), Vector2.UnitY * 12f, + ProjectileID.CultistBossLightningOrbArc, damage, 0f, Projectile.owner, MathHelper.PiOver2, Main.rand.Next(100)); if (idx.WithinBounds(Main.maxProjectiles)) { diff --git a/Projectiles/Melee/LuxorsGiftMelee.cs b/Projectiles/Melee/LuxorsGiftMelee.cs index 0385f93871..d04535888c 100644 --- a/Projectiles/Melee/LuxorsGiftMelee.cs +++ b/Projectiles/Melee/LuxorsGiftMelee.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -12,68 +13,68 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Gift"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.alpha = 255; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 250) + Projectile.scale -= 0.01f; + Projectile.alpha += 15; + if (Projectile.alpha >= 250) { - projectile.alpha = 255; - projectile.localAI[0] = 1f; + Projectile.alpha = 255; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[0] = 0f; + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; } } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 3f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 3f) { for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -82,33 +83,33 @@ namespace CalamityMod.Projectiles.Melee public override bool OnTileCollide(Vector2 oldVelocity) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/MarianaProjectile.cs b/Projectiles/Melee/MarianaProjectile.cs index a394cd8f79..51b3ad9184 100644 --- a/Projectiles/Melee/MarianaProjectile.cs +++ b/Projectiles/Melee/MarianaProjectile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,29 +15,29 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.8f); + Lighting.AddLight(Projectile.Center, 0f, 0.2f, 0.8f); - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 9f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, false, 600f, 9f, 20f); } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -45,26 +46,26 @@ namespace CalamityMod.Projectiles.Melee public override bool OnTileCollide(Vector2 oldVelocity) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } return false; } diff --git a/Projectiles/Melee/MarniteObliteratorProj.cs b/Projectiles/Melee/MarniteObliteratorProj.cs index f685f7f62a..4126b7d9ad 100644 --- a/Projectiles/Melee/MarniteObliteratorProj.cs +++ b/Projectiles/Melee/MarniteObliteratorProj.cs @@ -10,16 +10,16 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 20; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.hide = true; - projectile.ownerHitCheck = true; - projectile.melee = true; - projectile.Calamity().trueMelee = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 20; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.hide = true; + Projectile.ownerHitCheck = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.Calamity().trueMelee = true; } } } diff --git a/Projectiles/Melee/MeldGreatswordBigProjectile.cs b/Projectiles/Melee/MeldGreatswordBigProjectile.cs index 44afbfdc7a..6061c811e0 100644 --- a/Projectiles/Melee/MeldGreatswordBigProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordBigProjectile.cs @@ -11,53 +11,53 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.melee = true; - projectile.timeLeft = 600; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 600; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); Vector2 value7 = new Vector2(6f, 12f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 48f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } else { for (int num41 = 0; num41 < 2; num41++) { Vector2 value8 = Vector2.UnitX * -15f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); + value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 1f; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; + Main.dust[num42].position = Projectile.Center + value8; + Main.dust[num42].velocity = Projectile.velocity; } } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, 0f, 0f, 100, default, 0.8f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 0.8f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/MeldGreatswordMediumProjectile.cs b/Projectiles/Melee/MeldGreatswordMediumProjectile.cs index f690fc272c..499640722d 100644 --- a/Projectiles/Melee/MeldGreatswordMediumProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordMediumProjectile.cs @@ -11,53 +11,53 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.melee = true; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 600; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); Vector2 value7 = new Vector2(6f, 12f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 48f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } else { for (int num41 = 0; num41 < 2; num41++) { Vector2 value8 = Vector2.UnitX * -15f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); + value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 1f; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; + Main.dust[num42].position = Projectile.Center + value8; + Main.dust[num42].velocity = Projectile.velocity; } } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, 0f, 0f, 100, default, 0.8f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 0.8f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/MeldGreatswordSmallProjectile.cs b/Projectiles/Melee/MeldGreatswordSmallProjectile.cs index aa364244ff..3d1fb10a97 100644 --- a/Projectiles/Melee/MeldGreatswordSmallProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordSmallProjectile.cs @@ -11,53 +11,53 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.melee = true; - projectile.timeLeft = 600; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 600; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); Vector2 value7 = new Vector2(6f, 12f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 48f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } else { for (int num41 = 0; num41 < 2; num41++) { Vector2 value8 = Vector2.UnitX * -15f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); + value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 1f; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; + Main.dust[num42].position = Projectile.Center + value8; + Main.dust[num42].velocity = Projectile.velocity; } } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, 0f, 0f, 100, default, 0.8f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 0.8f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs b/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs index 47c444c4ed..40e371602f 100644 --- a/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs +++ b/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Melee public class BitingEmbraceMist : ModProjectile { public override string Texture => "CalamityMod/Particles/MediumMist"; - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public Color mistColor; public int variant = -1; public override void SetStaticDefaults() @@ -19,19 +19,19 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 34; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 34; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 300; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - Vector2 size = projectile.Size * projectile.scale; + Vector2 size = Projectile.Size * Projectile.scale; - return Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center - size / 2f, size); + return Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - size / 2f, size); } public override void AI() @@ -39,31 +39,31 @@ namespace CalamityMod.Projectiles.Melee if (variant == -1) variant = Main.rand.Next(3); - if (Main.rand.Next(15) == 0 && projectile.alpha <= 140) //only try to spawn your particles if you're not close to dying + if (Main.rand.Next(15) == 0 && Projectile.alpha <= 140) //only try to spawn your particles if you're not close to dying { - Vector2 particlePosition = projectile.Center + Main.rand.NextVector2Circular(projectile.width * projectile.scale * 0.5f, projectile.height * projectile.scale * 0.5f); + Vector2 particlePosition = Projectile.Center + Main.rand.NextVector2Circular(Projectile.width * Projectile.scale * 0.5f, Projectile.height * Projectile.scale * 0.5f); Particle snowflake = new SnowflakeSparkle(particlePosition, Vector2.Zero, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); GeneralParticleHandler.SpawnParticle(snowflake); } - projectile.velocity *= 0.85f; - projectile.position += projectile.velocity; - projectile.rotation += 0.02f * projectile.timeLeft / 300f * ((projectile.velocity.X > 0) ? 1f : -1f); + Projectile.velocity *= 0.85f; + Projectile.position += Projectile.velocity; + Projectile.rotation += 0.02f * Projectile.timeLeft / 300f * ((Projectile.velocity.X > 0) ? 1f : -1f); - if (projectile.alpha < 165) + if (Projectile.alpha < 165) { - projectile.scale += 0.05f; - projectile.alpha += 2; + Projectile.scale += 0.05f; + Projectile.alpha += 2; } else { - projectile.scale *= 0.975f; - projectile.alpha += 1; + Projectile.scale *= 0.975f; + Projectile.alpha += 1; } - if (projectile.alpha >= 170) - projectile.Kill(); + if (Projectile.alpha >= 170) + Projectile.Kill(); - mistColor = Color.Lerp(new Color(172, 238, 255), new Color(145, 170, 188), MathHelper.Clamp((float)(projectile.alpha - 100) / 80, 0f, 1f)) * (255 - projectile.alpha / 255f); + mistColor = Color.Lerp(new Color(172, 238, 255), new Color(145, 170, 188), MathHelper.Clamp((float)(Projectile.alpha - 100) / 80, 0f, 1f)) * (255 - Projectile.alpha / 255f); } @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee var tex = GetTexture("CalamityMod/Particles/MediumMist"); Rectangle frame = tex.Frame(1, 3, 0, variant); - spriteBatch.Draw(tex, projectile.position - Main.screenPosition, frame, mistColor * 0.5f * ((255f - projectile.alpha) / 255f), projectile.rotation, frame.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(tex, Projectile.position - Main.screenPosition, frame, mistColor * 0.5f * ((255f - Projectile.alpha) / 255f), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); spriteBatch.ExitShaderRegion(); return false; diff --git a/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs b/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs index 9b3f61f78c..235ff31016 100644 --- a/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs +++ b/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Melee public class DecaysRetortDash : ModProjectile { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public Player Owner => Main.player[projectile.owner]; - public float Timer => 20 - projectile.timeLeft; + public Player Owner => Main.player[Projectile.owner]; + public float Timer => 20 - Projectile.timeLeft; public Vector2 DashStart; public Vector2 DashEnd; @@ -23,14 +23,14 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 8; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 60; - projectile.timeLeft = 20; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 8; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; + Projectile.timeLeft = 20; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D chainTex = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash"); - Vector2 Shake = projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - projectile.timeLeft / 5f) * 0.5f; + Vector2 Shake = Projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - Projectile.timeLeft / 5f) * 0.5f; int dist = (int)Vector2.Distance(DashEnd, DashStart) / 16; Vector2[] Nodes = new Vector2[dist + 1]; @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee float xScale = (i / (float)dist) * 5f; Vector2 scale = new Vector2(xScale, yScale); - float opacity = MathHelper.Clamp((float)Math.Sin(i / (float)dist * MathHelper.PiOver2) - (i / (float)dist * ((20f - projectile.timeLeft) / 25f)), 0f, 1f); + float opacity = MathHelper.Clamp((float)Math.Sin(i / (float)dist * MathHelper.PiOver2) - (i / (float)dist * ((20f - Projectile.timeLeft) / 25f)), 0f, 1f); Vector2 origin = new Vector2(chainTex.Width / 2, chainTex.Height); //Draw from center bottom of texture spriteBatch.Draw(chainTex, Nodes[i] - Main.screenPosition, null, Color.Crimson * opacity, rotation, origin, scale, SpriteEffects.None, 0); @@ -84,8 +84,8 @@ namespace CalamityMod.Projectiles.Melee //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)sparkTexture.Width / (float)bloomTexture.Height; - float bump = (float)Math.Sin(((20f - projectile.timeLeft) / 20f) * MathHelper.Pi); - float raise = (float)Math.Sin(((20f - projectile.timeLeft) / 20f) * MathHelper.PiOver2); + float bump = (float)Math.Sin(((20f - Projectile.timeLeft) / 20f) * MathHelper.Pi); + float raise = (float)Math.Sin(((20f - Projectile.timeLeft) / 20f) * MathHelper.PiOver2); Rectangle frame = new Rectangle(0, 0, 14, 14); spriteBatch.Draw(bloomTexture, DashEnd - Main.screenPosition, null, Color.Crimson * bump * 0.5f, 0, bloomTexture.Size() / 2f, bump * 6f * properBloomSize, SpriteEffects.None, 0); diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs index 715bec984a..05d3b2b8db 100644 --- a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs +++ b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs @@ -10,6 +10,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -18,11 +19,11 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence"; private bool initialized = false; Vector2 direction = Vector2.Zero; - public Player Owner => Main.player[projectile.owner]; - public ref float Charge => ref projectile.ai[0]; //Charge - public ref float State => ref projectile.ai[1]; //State 0 is "charging", State 1 is "thrusting" - public ref float CurrentIndicator => ref projectile.localAI[0]; //What "indicator" stage are you on. - public ref float OverCharge => ref projectile.localAI[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Charge => ref Projectile.ai[0]; //Charge + public ref float State => ref Projectile.ai[1]; //State 0 is "charging", State 1 is "thrusting" + public ref float CurrentIndicator => ref Projectile.localAI[0]; //What "indicator" stage are you on. + public ref float OverCharge => ref Projectile.localAI[1]; private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; const float MaxCharge = 500; @@ -36,14 +37,14 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 70; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 70; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; } public override bool CanDamage() @@ -54,8 +55,8 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 120 * projectile.scale; - float bladeWidth = 20 * projectile.scale; + float bladeLenght = 120 * Projectile.scale; + float bladeWidth = 20 * Projectile.scale; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); } @@ -72,8 +73,8 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao { - projectile.velocity = Vector2.Zero; - Main.PlaySound(SoundID.Item101, projectile.Center); + Projectile.velocity = Vector2.Zero; + SoundEngine.PlaySound(SoundID.Item101, Projectile.Center); initialized = true; } @@ -83,21 +84,21 @@ namespace CalamityMod.Projectiles.Melee { if (Charge / MaxCharge < 0.25f) { - Main.PlaySound(SoundID.Item109, projectile.Center); - projectile.Kill(); + SoundEngine.PlaySound(SoundID.Item109, Projectile.Center); + Projectile.Kill(); return; } else { - var dashSound = Main.PlaySound(SoundID.Item120, projectile.Center); + var dashSound = SoundEngine.PlaySound(SoundID.Item120, Projectile.Center); CalamityUtils.SafeVolumeChange(ref dashSound, 0.5f); State = 1f; - projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; //Keep that even, if its an odd number itll fuck off and wont reset the players velocity on death - dashDuration = projectile.timeLeft; - lastDisplacement = projectile.Center - Owner.Center; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; //Keep that even, if its an odd number itll fuck off and wont reset the players velocity on death + dashDuration = Projectile.timeLeft; + lastDisplacement = Projectile.Center - Owner.Center; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } } } @@ -106,15 +107,15 @@ namespace CalamityMod.Projectiles.Melee { direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); - projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement()); + Projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement()); Charge++; OverCharge--; - projectile.timeLeft = 2; + Projectile.timeLeft = 2; if ((Charge / MaxCharge >= 0.25f && CurrentIndicator == 0f) || (Charge / MaxCharge >= 0.5f && CurrentIndicator == 1f) || (Charge / MaxCharge >= 0.75f && CurrentIndicator == 2f)) { - var chargeSound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconOrbPulse"), projectile.Center); + var chargeSound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconOrbPulse"), Projectile.Center); if (chargeSound != null) chargeSound.Pitch = -0.2f + 0.1f * CurrentIndicator; CurrentIndicator++; @@ -127,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.whoAmI == Main.myPlayer && CurrentIndicator < 4f) { OverCharge = 20f; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconUse"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconUse"), Projectile.Center); CurrentIndicator++; } } @@ -135,36 +136,36 @@ namespace CalamityMod.Projectiles.Melee if (State == 1f) { - projectile.Center = Owner.Center + Vector2.Lerp(lastDisplacement, direction * 40f, MathHelper.Clamp(((dashDuration - projectile.timeLeft) / dashDuration) * 2f, 0f, 1f)); + Projectile.Center = Owner.Center + Vector2.Lerp(lastDisplacement, direction * 40f, MathHelper.Clamp(((dashDuration - Projectile.timeLeft) / dashDuration) * 2f, 0f, 1f)); Owner.fallStart = (int)(Owner.position.Y / 16f); Owner.Calamity().LungingDown = true; - if (Collision.SolidCollision(Owner.Center + (direction * 120 * projectile.scale) - Vector2.One * 5f, 10, 10)) + if (Collision.SolidCollision(Owner.Center + (direction * 120 * Projectile.scale) - Vector2.One * 5f, 10, 10)) { SlamDown(); - projectile.timeLeft = 0; + Projectile.timeLeft = 0; Owner.Calamity().LungingDown = false; - projectile.active = false; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.active = false; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } Owner.velocity = direction * 30f; float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); float strength = (float)Math.Sin(variation * 2f + MathHelper.PiOver2); - Particle Sparkle = new CritSpark(projectile.Center, Owner.velocity - direction.RotatedBy(variation) * (1 + strength) * 2f * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center, Owner.velocity - direction.RotatedBy(variation) * (1 + strength) * 2f * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } - Lighting.AddLight(projectile.Center, new Vector3(1f, 0.56f, 0.56f) * Charge / MaxCharge); + Lighting.AddLight(Projectile.Center, new Vector3(1f, 0.56f, 0.56f) * Charge / MaxCharge); //Manage position and rotation - projectile.rotation = direction.ToRotation(); + Projectile.rotation = direction.ToRotation(); //Scaling based on charge - projectile.scale = 1f + (Charge / MaxCharge * 0.3f); + Projectile.scale = 1f + (Charge / MaxCharge * 0.3f); Owner.direction = Math.Sign(direction.X); Owner.itemRotation = direction.ToRotation(); @@ -181,7 +182,7 @@ namespace CalamityMod.Projectiles.Melee public void SlamDown() { - var slamSound = Main.PlaySound(SoundID.DD2_MonkStaffGroundImpact, projectile.Center); + var slamSound = SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Projectile.Center); CalamityUtils.SafeVolumeChange(ref slamSound, 1.5f); if (Owner.whoAmI != Main.myPlayer || Owner.velocity.Y == 0f) @@ -193,7 +194,7 @@ namespace CalamityMod.Projectiles.Melee //Only create the central monolith if over half charge if (Charge / MaxCharge < 0.5f) return; - Projectile.NewProjectile(Owner.Center + (direction * 120 * projectile.scale), -direction, ProjectileType(), (int)(projectile.damage * TrueBiomeBlade.AstralAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), 1f); + Projectile.NewProjectile(Owner.Center + (direction * 120 * Projectile.scale), -direction, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.AstralAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), 1f); //Only create the side monoliths if over 3/4th charge if (Charge / MaxCharge < 0.75f) @@ -214,7 +215,7 @@ namespace CalamityMod.Projectiles.Melee bool validPositionFound = false; for (float i = 0f; i < 1; i += 1 / distance) { - Vector2 positionToCheck = Owner.Center + (direction * 120 * projectile.scale) + direction.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; + Vector2 positionToCheck = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) widestAngle = i; @@ -228,9 +229,9 @@ namespace CalamityMod.Projectiles.Melee if (validPositionFound) { - Vector2 projPosition = Owner.Center + (direction * 120 * projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; + Vector2 projPosition = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; Vector2 monolithRotation = direction.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), (int)(projectile.damage * TrueBiomeBlade.AstralAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); + Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.AstralAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); if (proj.modProjectile is ExtantAbhorrenceMonolith monolith) monolith.WaitTimer = (1 - projSize) * 34f; } @@ -257,9 +258,9 @@ namespace CalamityMod.Projectiles.Melee float drawRotation = drawAngle + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, handle.Height); - Vector2 drawOffset = projectile.Center - Main.screenPosition; + Vector2 drawOffset = Projectile.Center - Main.screenPosition; - spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); @@ -276,7 +277,7 @@ namespace CalamityMod.Projectiles.Melee //Update the parameters drawOrigin = new Vector2(0f, blade.Height); - spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Back to normal spriteBatch.End(); @@ -293,7 +294,7 @@ namespace CalamityMod.Projectiles.Melee Owner.Calamity().LungingDown = false; - projectile.active = false; + Projectile.active = false; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs index 9d6de4fc66..46d6a8a223 100644 --- a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs +++ b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs @@ -9,16 +9,17 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class ExtantAbhorrenceMonolith : ModProjectile { public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith"; - public Player Owner => Main.player[projectile.owner]; - public float Timer => (100f - projectile.timeLeft) / 100f; - public ref float Variant => ref projectile.ai[0]; //Yes - public ref float Size => ref projectile.ai[1]; //Yes + public Player Owner => Main.player[Projectile.owner]; + public float Timer => (100f - Projectile.timeLeft) / 100f; + public ref float Variant => ref Projectile.ai[0]; //Yes + public ref float Size => ref Projectile.ai[1]; //Yes public float WaitTimer; //How long till it appears fr. GOtta remember to sync that one public const float BaseWidth = 90f; public const float BaseHeight = 420f; @@ -42,13 +43,13 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 70; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 102; - projectile.hide = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 70; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 102; + Projectile.hide = true; } public override bool CanDamage() => WaitTimer <= 0; @@ -56,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + ((projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Height()), Width(), ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + ((Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Height()), Width(), ref collisionPoint); } public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) @@ -68,37 +69,37 @@ namespace CalamityMod.Projectiles.Melee { if (WaitTimer > 0) { - projectile.timeLeft = 102; + Projectile.timeLeft = 102; WaitTimer--; } - if (projectile.timeLeft == 100) + if (Projectile.timeLeft == 100) { SurfaceUp(); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.velocity = Vector2.Zero; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity = Vector2.Zero; if (Size >= 1) //Big monoliths create sparkles even before sprouting up { for (int i = 0; i < 20; i++) { - Particle Sparkle = new CritSpark(projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } } } - if (projectile.timeLeft == 80) + if (Projectile.timeLeft == 80) { - Vector2 particleDirection = (projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); - Main.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, projectile.Center); + Vector2 particleDirection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, Projectile.Center); for (int i = 0; i < 8; i++) { Vector2 hitPositionDisplace = particleDirection.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(0f, 10f); Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2)) * Main.rand.NextFloat(5f, 15f); - Particle smoke = new SmallSmokeParticle(projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.DarkOrange, Color.MediumTurquoise, Main.rand.NextFloat()), new Color(130, 130, 130), Main.rand.NextFloat(2.8f, 3.6f) * Size, 165 - Main.rand.Next(30), 0.1f); + Particle smoke = new SmallSmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.DarkOrange, Color.MediumTurquoise, Main.rand.NextFloat()), new Color(130, 130, 130), Main.rand.NextFloat(2.8f, 3.6f) * Size, 165 - Main.rand.Next(30), 0.1f); GeneralParticleHandler.SpawnParticle(smoke); } for (int i = 0; i < 6; i++) @@ -106,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 hitPositionDisplace = particleDirection.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(10f, 30f); Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4)); - Particle Rock = new StoneDebrisParticle(projectile.Center + hitPositionDisplace * 3, flyDirection * Main.rand.NextFloat(3f, 6f), Color.Lerp(Color.DarkSlateBlue, Color.LightSlateGray, Main.rand.NextFloat()), (1f + Main.rand.NextFloat(0f, 2.4f)) * Size, 30 + Main.rand.Next(50), 0.1f); + Particle Rock = new StoneDebrisParticle(Projectile.Center + hitPositionDisplace * 3, flyDirection * Main.rand.NextFloat(3f, 6f), Color.Lerp(Color.DarkSlateBlue, Color.LightSlateGray, Main.rand.NextFloat()), (1f + Main.rand.NextFloat(0f, 2.4f)) * Size, 30 + Main.rand.Next(50), 0.1f); GeneralParticleHandler.SpawnParticle(Rock); } } @@ -117,19 +118,19 @@ namespace CalamityMod.Projectiles.Melee { for (float i = 0; i < 40; i += 0.5f) { - Vector2 positionToCheck = projectile.Center + projectile.velocity * i; + Vector2 positionToCheck = Projectile.Center + Projectile.velocity * i; if (!Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) { - projectile.Center = projectile.Center + projectile.velocity * i; + Projectile.Center = Projectile.Center + Projectile.velocity * i; return; } } - projectile.Center = projectile.Center + projectile.velocity * 40f; + Projectile.Center = Projectile.Center + Projectile.velocity * 40f; } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (projectile.numHits > 0) + if (Projectile.numHits > 0) damage = (int)(damage * TrueBiomeBlade.AstralAttunement_MonolithDamageFalloff); } @@ -141,11 +142,11 @@ namespace CalamityMod.Projectiles.Melee Texture2D tex = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith"); - float drawAngle = projectile.rotation; + float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight); - Vector2 drawPosition = projectile.Center - Main.screenPosition - (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height); float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f); @@ -161,11 +162,11 @@ namespace CalamityMod.Projectiles.Melee Texture2D tex = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith_Glow"); - float drawAngle = projectile.rotation; + float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight); - Vector2 drawPosition = projectile.Center - Main.screenPosition - (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height); float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f); diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs index 8c3f08516b..09d4b62972 100644 --- a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs +++ b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Melee { public override string Texture => "CalamityMod/Items/Weapons/Melee/TrueBiomeBlade"; Vector2 direction = Vector2.Zero; - public Player Owner => Main.player[projectile.owner]; - public float Timer => 40 - projectile.timeLeft; + public Player Owner => Main.player[Projectile.owner]; + public float Timer => 40 - Projectile.timeLeft; public float HalfTimer => (Timer % 20); public override void SetStaticDefaults() @@ -25,12 +25,12 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 40; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 40; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override bool CanDamage() => false; @@ -40,14 +40,14 @@ namespace CalamityMod.Projectiles.Melee if (Math.Abs(HalfTimer / 20f) == 0.5f) { var splash = new LegacySoundStyle(SoundID.Splash, 0).WithPitchVariance(Main.rand.NextFloat()); - Main.PlaySound(splash, projectile.Center); + SoundEngine.PlaySound(splash, Projectile.Center); if (Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Owner.Center, direction * 0.1f + Owner.velocity, ProjectileType(), projectile.damage, 0, Owner.whoAmI); + Projectile.NewProjectile(Owner.Center, direction * 0.1f + Owner.velocity, ProjectileType(), Projectile.damage, 0, Owner.whoAmI); } - Particle Sparkle = new CritSpark(projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.CornflowerBlue : Color.DodgerBlue, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.CornflowerBlue : Color.DodgerBlue, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } @@ -61,9 +61,9 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation -= MathHelper.Pi; } - projectile.Center = Owner.Center + direction; - projectile.rotation = direction.ToRotation() + MathHelper.PiOver2; - projectile.spriteDirection = Math.Sign(Timer - 20f); + Projectile.Center = Owner.Center + direction; + Projectile.rotation = direction.ToRotation() + MathHelper.PiOver2; + Projectile.spriteDirection = Math.Sign(Timer - 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -73,9 +73,9 @@ namespace CalamityMod.Projectiles.Melee float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, blade.Height); - Vector2 drawOffset = projectile.Center - Main.screenPosition; + Vector2 drawOffset = Projectile.Center - Main.screenPosition; - spriteBatch.Draw(blade, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); return false; } diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs index 89ca437628..c957806630 100644 --- a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs +++ b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs @@ -16,38 +16,38 @@ namespace CalamityMod.Projectiles.Melee public class GestureForTheDrownedOrb : ModProjectile { public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned"; - public Player Owner => Main.player[projectile.owner]; - public ref float HasLanded => ref projectile.ai[0]; //Is the orb in the air or is it on the ground? - public ref float TimeSinceLanding => ref projectile.ai[1]; //How long has it been on the ground for - public float Timer => MaxTime - projectile.timeLeft; + public Player Owner => Main.player[Projectile.owner]; + public ref float HasLanded => ref Projectile.ai[0]; //Is the orb in the air or is it on the ground? + public ref float TimeSinceLanding => ref Projectile.ai[1]; //How long has it been on the ground for + public float Timer => MaxTime - Projectile.timeLeft; public const float MaxTime = 160f; public float groundOffset; - public bool BounceX => projectile.oldPosition.X == projectile.position.X; + public bool BounceX => Projectile.oldPosition.X == Projectile.position.X; public bool WaterMode = false; public float scaleX => 1 + 0.2f * (1f + -(float)Math.Sin((TimeSinceLanding - 10f) * 0.1f)) * 0.5f; - public float scaleY => (1 + 0.4f * (1f + (float)Math.Sin((TimeSinceLanding - 10f) * 0.1f)) * 0.5f) * MathHelper.Clamp((TimeSinceLanding - 10) / 30f, 0f, 1f) * MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); + public float scaleY => (1 + 0.4f * (1f + (float)Math.Sin((TimeSinceLanding - 10f) * 0.1f)) * 0.5f) * MathHelper.Clamp((TimeSinceLanding - 10) / 30f, 0f, 1f) * MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); public override void SetStaticDefaults() { DisplayName.SetDefault("Gesture for the Drowned"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = projectile.height = 26; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = (int)MaxTime; - projectile.melee = true; - projectile.alpha = 90; - projectile.ignoreWater = true; - projectile.hide = true; + Projectile.width = Projectile.height = 26; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = (int)MaxTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 90; + Projectile.ignoreWater = true; + Projectile.hide = true; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee return true; } HasLanded = 1f; - projectile.velocity.Y = -4f; + Projectile.velocity.Y = -4f; return false; } @@ -67,10 +67,10 @@ namespace CalamityMod.Projectiles.Melee return base.Colliding(projHitbox, targetHitbox); float collisionPoint = 0f; if (!WaterMode) - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Bottom, projectile.Bottom - (Vector2.UnitY * scaleY * 110), scaleX * 40, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Bottom, Projectile.Bottom - (Vector2.UnitY * scaleY * 110), scaleX * 40, ref collisionPoint); - float halfLenght = 66f * projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center + Utils.SafeNormalize(projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLenght, projectile.Center - Utils.SafeNormalize(projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLenght, 40f, ref collisionPoint); + float halfLenght = 66f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + Utils.SafeNormalize(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLenght, Projectile.Center - Utils.SafeNormalize(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLenght, 40f, ref collisionPoint); } public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) @@ -80,37 +80,37 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (Collision.WetCollision(projectile.position, projectile.width, projectile.height)) + if (Collision.WetCollision(Projectile.position, Projectile.width, Projectile.height)) { WaterMode = true; - projectile.velocity.Y *= 0.33f; + Projectile.velocity.Y *= 0.33f; } else if (WaterMode) { - projectile.Kill(); + Projectile.Kill(); } if (WaterMode) { - projectile.velocity *= 1.02f; - projectile.scale *= 1.01f; - projectile.timeLeft--; + Projectile.velocity *= 1.02f; + Projectile.scale *= 1.01f; + Projectile.timeLeft--; for (int i = 0; i <= 4; i++) { - Dust waterTrail = Main.dust[Dust.NewDust(projectile.Center + Main.rand.NextVector2Circular(10f, 10f), 23, 0, 33, -3.7f * Math.Sign(projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; + Dust waterTrail = Main.dust[Dust.NewDust(Projectile.Center + Main.rand.NextVector2Circular(10f, 10f), 23, 0, 33, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; waterTrail.fadeIn = 3f; } - Dust foamDust = Main.dust[Dust.NewDust(projectile.Center + Main.rand.NextVector2Circular(10f, 10f), 9, 0, 16, 2.7f * Math.Sign(projectile.velocity.X), -3f, 0, new Color(255, 255, 255), 1.4f)]; + Dust foamDust = Main.dust[Dust.NewDust(Projectile.Center + Main.rand.NextVector2Circular(10f, 10f), 9, 0, 16, 2.7f * Math.Sign(Projectile.velocity.X), -3f, 0, new Color(255, 255, 255), 1.4f)]; foamDust.noGravity = true; if (Main.rand.NextBool()) { float angle = Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2); - float distance = 10f + 50 * Math.Abs(angle) / MathHelper.PiOver2 * projectile.scale; - Vector2 sparkSpeed = -projectile.velocity; - Particle Spark = new CritSpark(projectile.Center + Vector2.Normalize(projectile.velocity.RotatedBy(angle)) * distance, sparkSpeed, Color.SkyBlue, Color.CornflowerBlue, 1f + Main.rand.NextFloat(0, 1f), 30, 0.4f, 0.6f); + float distance = 10f + 50 * Math.Abs(angle) / MathHelper.PiOver2 * Projectile.scale; + Vector2 sparkSpeed = -Projectile.velocity; + Particle Spark = new CritSpark(Projectile.Center + Vector2.Normalize(Projectile.velocity.RotatedBy(angle)) * distance, sparkSpeed, Color.SkyBlue, Color.CornflowerBlue, 1f + Main.rand.NextFloat(0, 1f), 30, 0.4f, 0.6f); GeneralParticleHandler.SpawnParticle(Spark); } return; @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee //Check 7 tiles under the projectile for solid ground for (float i = 0; i < 7; i += 0.5f) { - Vector2 positionToCheck = projectile.position; + Vector2 positionToCheck = Projectile.position; if (Main.tile[(int)(positionToCheck.X / 16), (int)((positionToCheck.Y / 16) + 1 * i)].IsTileSolidGround() && groundOffset == -1) { groundOffset = i * 16; @@ -141,26 +141,26 @@ namespace CalamityMod.Projectiles.Melee if (TimeSinceLanding > 10) { //Trailing water!! Dust spam!!! - Dust waterTrail = Main.dust[Dust.NewDust(projectile.Top + Vector2.UnitY * groundOffset, 23, 0, 33, -3.7f * Math.Sign(projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; + Dust waterTrail = Main.dust[Dust.NewDust(Projectile.Top + Vector2.UnitY * groundOffset, 23, 0, 33, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; waterTrail.fadeIn = 3f; - waterTrail = Main.dust[Dust.NewDust(projectile.TopRight + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(16f, 16f) + Vector2.UnitX * projectile.velocity.X * 4f, 23, 0, 33, -3.7f * Math.Sign(projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; + waterTrail = Main.dust[Dust.NewDust(Projectile.TopRight + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(16f, 16f) + Vector2.UnitX * Projectile.velocity.X * 4f, 23, 0, 33, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; waterTrail.fadeIn = 3f; - waterTrail = Main.dust[Dust.NewDust(projectile.TopLeft + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(16f, 16f) + Vector2.UnitX * projectile.velocity.X * 4f, 23, 0, 33, -3.7f * Math.Sign(projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; + waterTrail = Main.dust[Dust.NewDust(Projectile.TopLeft + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(16f, 16f) + Vector2.UnitX * Projectile.velocity.X * 4f, 23, 0, 33, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; waterTrail.fadeIn = 3f; - Dust foamDust = Main.dust[Dust.NewDust(projectile.Top + Vector2.UnitY * groundOffset + Vector2.UnitX * 16 * Math.Sign(projectile.velocity.X), 9, 0, 16, 2.7f * Math.Sign(projectile.velocity.X), -3f, 0, new Color(255, 255, 255), 1.4f)]; + Dust foamDust = Main.dust[Dust.NewDust(Projectile.Top + Vector2.UnitY * groundOffset + Vector2.UnitX * 16 * Math.Sign(Projectile.velocity.X), 9, 0, 16, 2.7f * Math.Sign(Projectile.velocity.X), -3f, 0, new Color(255, 255, 255), 1.4f)]; foamDust.noGravity = true; //Foam float height = scaleY * 100f; - Vector2 origin = projectile.Top + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(projectile.width / 4f, projectile.height / 4f) - (Vector2.UnitY * height); - Particle foamSmall = new FakeGlowDust(origin, projectile.velocity / 2f, Color.LightSlateGray, Main.rand.NextFloat(1f, 2f), 25, 0.1f, bigSize: true, gravity: (-projectile.velocity + Vector2.UnitY) * 0.1f); + Vector2 origin = Projectile.Top + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(Projectile.width / 4f, Projectile.height / 4f) - (Vector2.UnitY * height); + Particle foamSmall = new FakeGlowDust(origin, Projectile.velocity / 2f, Color.LightSlateGray, Main.rand.NextFloat(1f, 2f), 25, 0.1f, bigSize: true, gravity: (-Projectile.velocity + Vector2.UnitY) * 0.1f); GeneralParticleHandler.SpawnParticle(foamSmall); if (Main.rand.Next(5) == 0) { - Particle foamLarge = new MediumMistParticle(origin, projectile.velocity / 2f, Color.LightSlateGray, Color.LightBlue, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); + Particle foamLarge = new MediumMistParticle(origin, Projectile.velocity / 2f, Color.LightSlateGray, Color.LightBlue, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); GeneralParticleHandler.SpawnParticle(foamLarge); } } @@ -168,53 +168,53 @@ namespace CalamityMod.Projectiles.Melee else { - Particle foamSmall = new FakeGlowDust(projectile.Center + Main.rand.NextVector2Circular(projectile.width / 2f, projectile.height / 2f), projectile.velocity / 2f, Color.LightSlateGray, Main.rand.NextFloat(0.2f, 2f), 25, 0.1f, gravity: (-projectile.velocity + Vector2.UnitY) * 0.1f); + Particle foamSmall = new FakeGlowDust(Projectile.Center + Main.rand.NextVector2Circular(Projectile.width / 2f, Projectile.height / 2f), Projectile.velocity / 2f, Color.LightSlateGray, Main.rand.NextFloat(0.2f, 2f), 25, 0.1f, gravity: (-Projectile.velocity + Vector2.UnitY) * 0.1f); GeneralParticleHandler.SpawnParticle(foamSmall); if (Main.rand.NextBool()) { - Particle blob = new WaterGlobParticle(projectile.Center + Main.rand.NextVector2Circular(projectile.width / 2f, projectile.height / 2f), projectile.velocity / 2f, Main.rand.NextFloat(0.2f, 2f), 0.1f); + Particle blob = new WaterGlobParticle(Projectile.Center + Main.rand.NextVector2Circular(Projectile.width / 2f, Projectile.height / 2f), Projectile.velocity / 2f, Main.rand.NextFloat(0.2f, 2f), 0.1f); GeneralParticleHandler.SpawnParticle(blob); } } - projectile.rotation += 0.1f * ((projectile.velocity.X > 0) ? 1f : -1f); + Projectile.rotation += 0.1f * ((Projectile.velocity.X > 0) ? 1f : -1f); - if (projectile.velocity.Y < 15f) + if (Projectile.velocity.Y < 15f) { - projectile.velocity.Y += 0.3f; + Projectile.velocity.Y += 0.3f; } - if (Math.Abs(projectile.velocity.X) < 8) + if (Math.Abs(Projectile.velocity.X) < 8) { - projectile.velocity.X += 0.3f * ((projectile.velocity.X > 0) ? 1f : -1f); + Projectile.velocity.X += 0.3f * ((Projectile.velocity.X > 0) ? 1f : -1f); } else { - projectile.velocity.X = Math.Sign(projectile.velocity.X) * 8; + Projectile.velocity.X = Math.Sign(Projectile.velocity.X) * 8; } if (BounceX) { //Die lmao - projectile.Kill(); + Projectile.Kill(); } - projectile.frameCounter++; - if (projectile.frameCounter % 6 == 0) - projectile.frame = (projectile.frame + 1) % 3; + Projectile.frameCounter++; + if (Projectile.frameCounter % 6 == 0) + Projectile.frame = (Projectile.frame + 1) % 3; } public override void Kill(int timeLeft) { var splash = new LegacySoundStyle(SoundID.Splash, 0).WithPitchVariance(Main.rand.NextFloat()); - Main.PlaySound(splash, projectile.Center); + SoundEngine.PlaySound(splash, Projectile.Center); for (int i = 0; i < 4; i++) { - Particle foamLarge = new MediumMistParticle(projectile.Center + Main.rand.NextVector2Circular(projectile.width, projectile.height), projectile.oldVelocity / 2f, Color.LightSlateGray, Color.LightBlue, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); + Particle foamLarge = new MediumMistParticle(Projectile.Center + Main.rand.NextVector2Circular(Projectile.width, Projectile.height), Projectile.oldVelocity / 2f, Color.LightSlateGray, Color.LightBlue, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); GeneralParticleHandler.SpawnParticle(foamLarge); } } @@ -233,12 +233,12 @@ namespace CalamityMod.Projectiles.Melee if (WaterMode) { Texture2D wave = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave"); - float drawRotation = projectile.velocity.ToRotation() + MathHelper.Pi; + float drawRotation = Projectile.velocity.ToRotation() + MathHelper.Pi; Vector2 drawOrigin = new Vector2(wave.Width / 2f, wave.Height / 2f); - Vector2 drawOffset = projectile.Center - Main.screenPosition; + Vector2 drawOffset = Projectile.Center - Main.screenPosition; - spriteBatch.Draw(wave, drawOffset - projectile.velocity, null, Color.Lerp(lightColor, Color.White, 0.5f) * 0.2f, drawRotation, drawOrigin, projectile.scale - 0.2f, 0f, 0f); - spriteBatch.Draw(wave, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.5f) * 0.5f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(wave, drawOffset - Projectile.velocity, null, Color.Lerp(lightColor, Color.White, 0.5f) * 0.2f, drawRotation, drawOrigin, Projectile.scale - 0.2f, 0f, 0f); + spriteBatch.Draw(wave, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.5f) * 0.5f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); return false; } @@ -246,7 +246,7 @@ namespace CalamityMod.Projectiles.Melee if (HasLanded == 1f && TimeSinceLanding > 10f) { Texture2D wave = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave"); - Rectangle frame = new Rectangle(0, 0 + 110 * projectile.frame, 40, 110); + Rectangle frame = new Rectangle(0, 0 + 110 * Projectile.frame, 40, 110); float drawRotation = 0f; Vector2 drawOrigin = new Vector2(0f, frame.Height); @@ -257,13 +257,13 @@ namespace CalamityMod.Projectiles.Melee //Wobble Vector2 Scale; - SpriteEffects flip = projectile.velocity.X > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + SpriteEffects flip = Projectile.velocity.X > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; for (int i = 2; i >= 0; i--) { - drawOffset = projectile.position + Vector2.UnitY * groundOffset + Vector2.UnitY / 2f - Main.screenPosition; - drawOffset -= Vector2.UnitX * 10f * i * Math.Sign(projectile.velocity.X); - float ScaleYAlter = (1 + 0.4f * (1f + (float)Math.Sin((TimeSinceLanding - 10f) * 0.1f + 0.2 * i)) * 0.5f) * MathHelper.Clamp((TimeSinceLanding - 10) / 30f, 0f, 1f) * MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); + drawOffset = Projectile.position + Vector2.UnitY * groundOffset + Vector2.UnitY / 2f - Main.screenPosition; + drawOffset -= Vector2.UnitX * 10f * i * Math.Sign(Projectile.velocity.X); + float ScaleYAlter = (1 + 0.4f * (1f + (float)Math.Sin((TimeSinceLanding - 10f) * 0.1f + 0.2 * i)) * 0.5f) * MathHelper.Clamp((TimeSinceLanding - 10) / 30f, 0f, 1f) * MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); Scale = new Vector2(scaleX, ScaleYAlter - 0.05f * i); float slightfade = 1f - 0.24f * i; Color darkenedColor = Color.Lerp(lightColor, Color.Black, i * 0.15f); @@ -279,11 +279,11 @@ namespace CalamityMod.Projectiles.Melee else { Texture2D ball = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned"); - float drawRotation = projectile.rotation; - Vector2 drawOrigin = projectile.Size / 2f; - Vector2 drawOffset = projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation; + Vector2 drawOrigin = Projectile.Size / 2f; + Vector2 drawOffset = Projectile.Center - Main.screenPosition; - spriteBatch.Draw(ball, drawOffset, null, lightColor * MathHelper.Clamp(1 - TimeSinceLanding / 10f, 0f, 1f), drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(ball, drawOffset, null, lightColor * MathHelper.Clamp(1 - TimeSinceLanding / 10f, 0f, 1f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); return false; } diff --git a/Projectiles/Melee/MendedBiomeBlade_GrovetendersEntanglingVines.cs b/Projectiles/Melee/MendedBiomeBlade_GrovetendersEntanglingVines.cs index ad89b930de..baf68342f1 100644 --- a/Projectiles/Melee/MendedBiomeBlade_GrovetendersEntanglingVines.cs +++ b/Projectiles/Melee/MendedBiomeBlade_GrovetendersEntanglingVines.cs @@ -10,17 +10,17 @@ namespace CalamityMod.Projectiles.Melee public class GrovetendersEntanglingVines : ModProjectile { public override string Texture => "CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchChain"; - public Player Owner => Main.player[projectile.owner]; - public float Timer => 20 - projectile.timeLeft; + public Player Owner => Main.player[Projectile.owner]; + public float Timer => 20 - Projectile.timeLeft; public NPC NPCfrom { - get => Main.npc[(int)projectile.ai[0]]; - set => projectile.ai[0] = value.whoAmI; + get => Main.npc[(int)Projectile.ai[0]]; + set => Projectile.ai[0] = value.whoAmI; } public NPC Target { - get => Main.npc[(int)projectile.ai[1]]; - set => projectile.ai[1] = value.whoAmI; + get => Main.npc[(int)Projectile.ai[1]]; + set => Projectile.ai[1] = value.whoAmI; } const float curvature = 16f; @@ -31,29 +31,29 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 8; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - projectile.timeLeft = 20; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 8; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + Projectile.timeLeft = 20; } public override bool? CanHitNPC(NPC target) => target == Target; public override void AI() { - projectile.Center = Target.Center; + Projectile.Center = Target.Center; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D chainTex = GetTexture("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchChain"); - float opacity = projectile.timeLeft > 10 ? 1 : projectile.timeLeft / 10f; - Vector2 Shake = projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - projectile.timeLeft / 5f) * 0.5f; + float opacity = Projectile.timeLeft > 10 ? 1 : Projectile.timeLeft / 10f; + Vector2 Shake = Projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - Projectile.timeLeft / 5f) * 0.5f; Vector2 lineDirection = Utils.SafeNormalize(Target.Center - NPCfrom.Center, Vector2.Zero); int dist = (int)Vector2.Distance(Target.Center, NPCfrom.Center) / 16; diff --git a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs index 36ddf9782a..60ee3be831 100644 --- a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs @@ -10,6 +10,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -19,8 +20,8 @@ namespace CalamityMod.Projectiles.Melee private bool initialized = false; Vector2 direction = Vector2.Zero; Vector2 oldDirection = Vector2.Zero; - public ref float CurrentState => ref projectile.ai[0]; - public Player Owner => Main.player[projectile.owner]; + public ref float CurrentState => ref Projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; public const float throwOutTime = 90f; public const float throwOutDistance = 440f; @@ -29,88 +30,88 @@ namespace CalamityMod.Projectiles.Melee public float snapTimer => (throwTimer / throwOutTime) < snapPoint ? 0 : ((throwTimer / throwOutTime) - snapPoint) / (1f - snapPoint); public static float retractionPoint = 0.6f; public float retractionTimer => (throwTimer / throwOutTime) < retractionPoint ? 0 : ((throwTimer / throwOutTime) - retractionPoint) / (1f - retractionPoint); - public ref float Empowerment => ref projectile.ai[1]; - public ref float hasMadeSound => ref projectile.localAI[0]; - public ref float hasMadeChargeSound => ref projectile.localAI[1]; + public ref float Empowerment => ref Projectile.ai[1]; + public ref float hasMadeSound => ref Projectile.localAI[0]; + public ref float hasMadeChargeSound => ref Projectile.localAI[1]; public const float maxEmpowerment = 600f; - public float throwTimer => throwOutTime - projectile.timeLeft; + public float throwTimer => throwOutTime - Projectile.timeLeft; public Particle smear; public override void SetStaticDefaults() { DisplayName.SetDefault("Heaven's Might"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 74; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = TrueBiomeBlade.HolyAttunement_LocalIFrames; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 74; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = TrueBiomeBlade.HolyAttunement_LocalIFrames; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 100 * projectile.scale; - float bladeWidth = 20 * projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); + float bladeLenght = 100 * Projectile.scale; + float bladeWidth = 20 * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); } public CurveSegment launch = new CurveSegment(EasingType.CircOut, 0f, 0f, 1f, 4); public CurveSegment hold = new CurveSegment(EasingType.Linear, snapPoint, 1f, 0f); public CurveSegment retract = new CurveSegment(EasingType.PolyInOut, retractionPoint, 1f, -1.05f, 3); - internal float ThrowCurve() => PiecewiseAnimation((throwOutTime - projectile.timeLeft) / throwOutTime, new CurveSegment[] { launch, hold, retract }); + internal float ThrowCurve() => PiecewiseAnimation((throwOutTime - Projectile.timeLeft) / throwOutTime, new CurveSegment[] { launch, hold, retract }); public override void AI() { if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao { - Main.PlaySound(SoundID.Item90, projectile.Center); - projectile.velocity = Vector2.Zero; + SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); + Projectile.velocity = Vector2.Zero; direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); oldDirection = direction; initialized = true; } - projectile.rotation = direction.ToRotation(); //Only done for afterimages + Projectile.rotation = direction.ToRotation(); //Only done for afterimages if (!OwnerCanShoot) { if (CurrentState == 2f || (CurrentState == 0f && Empowerment / maxEmpowerment < 0.5)) { - Main.PlaySound(SoundID.Item77, projectile.Center); - projectile.Kill(); + SoundEngine.PlaySound(SoundID.Item77, Projectile.Center); + Projectile.Kill(); return; } else if (CurrentState == 0f) { CurrentState = 1f; - Main.PlaySound(SoundID.Item80, projectile.Center); + SoundEngine.PlaySound(SoundID.Item80, Projectile.Center); direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES for (int i = 0; i <= 8; i++) { float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); float strength = (float)Math.Sin(variation * 2f + MathHelper.PiOver2); - Particle Sparkle = new CritSpark(projectile.Center, Owner.velocity + direction.RotatedBy(variation) * (1 + strength) * 2f * Main.rand.NextFloat(7.5f, 20f), Color.White, Color.HotPink, 2f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 2f); + Particle Sparkle = new CritSpark(Projectile.Center, Owner.velocity + direction.RotatedBy(variation) * (1 + strength) * 2f * Main.rand.NextFloat(7.5f, 20f), Color.White, Color.HotPink, 2f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 2f); GeneralParticleHandler.SpawnParticle(Sparkle); } for (int i = 0; i <= 8; i++) { float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); float strength = (float)Math.Sin(variation * 2f + MathHelper.PiOver2); - Particle Sparkle = new CritSpark(projectile.Center, Owner.velocity + direction.RotatedBy(variation) * (1 + strength) * Main.rand.NextFloat(7.5f, 20f), Color.White, Color.Cyan, 2f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 2f); + Particle Sparkle = new CritSpark(Projectile.Center, Owner.velocity + direction.RotatedBy(variation) * (1 + strength) * Main.rand.NextFloat(7.5f, 20f), Color.White, Color.Cyan, 2f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 2f); GeneralParticleHandler.SpawnParticle(Sparkle); } } @@ -123,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee if (hasMadeChargeSound == 0f && Empowerment / maxEmpowerment >= 0.5) { hasMadeChargeSound = 1f; - Main.PlaySound(SoundID.Item76); + SoundEngine.PlaySound(SoundID.Item76); } float rotation = direction.ToRotation(); @@ -133,7 +134,7 @@ namespace CalamityMod.Projectiles.Melee else if (rotation > MathHelper.PiOver2 - MathHelper.PiOver4 && rotation < MathHelper.PiOver2 + MathHelper.PiOver4 && hasMadeSound == 0f) { hasMadeSound = 1f; - Main.PlaySound(SoundID.Item71); + SoundEngine.PlaySound(SoundID.Item71); } } @@ -141,7 +142,7 @@ namespace CalamityMod.Projectiles.Melee { if (smear == null) { - smear = new CircularSmearVFX(Owner.Center, Color.HotPink, direction.ToRotation(), projectile.scale * 1.5f); + smear = new CircularSmearVFX(Owner.Center, Color.HotPink, direction.ToRotation(), Projectile.scale * 1.5f); GeneralParticleHandler.SpawnParticle(smear); } //Update the variables of the smear @@ -150,21 +151,21 @@ namespace CalamityMod.Projectiles.Melee smear.Rotation = direction.ToRotation() + MathHelper.PiOver2; smear.Time = 0; smear.Position = Owner.Center; - smear.Scale = projectile.scale * 1.5f; + smear.Scale = Projectile.scale * 1.5f; smear.Color = Color.Lerp(Color.HotPink, Color.Cyan, (float)Math.Sin(Main.GlobalTime * 2f)) * (((Empowerment / maxEmpowerment) - 0.75f) / 0.25f * 0.8f); } } //Manage position and rotation - projectile.scale = 1 + Empowerment / maxEmpowerment * 1.5f; + Projectile.scale = 1 + Empowerment / maxEmpowerment * 1.5f; oldDirection = direction; direction = direction.RotatedBy(MathHelper.Clamp(Empowerment / maxEmpowerment, 0.4f, 1f) * MathHelper.PiOver4 * 0.20f); direction.Normalize(); - projectile.rotation = direction.ToRotation(); - projectile.Center = Owner.Center + (direction * projectile.scale * 10); - projectile.timeLeft = (int)throwOutTime + 1; + Projectile.rotation = direction.ToRotation(); + Projectile.Center = Owner.Center + (direction * Projectile.scale * 10); + Projectile.timeLeft = (int)throwOutTime + 1; Empowerment++; if (Empowerment > maxEmpowerment) Empowerment = maxEmpowerment; @@ -172,12 +173,12 @@ namespace CalamityMod.Projectiles.Melee if (CurrentState == 1f) { - projectile.Center = Owner.Center + (direction * projectile.scale * 10) + (direction * throwOutDistance * ThrowCurve()); - projectile.scale = (1 + Empowerment / maxEmpowerment * 1.5f) * MathHelper.Clamp(1 - retractionTimer, 0.3f, 1f); + Projectile.Center = Owner.Center + (direction * Projectile.scale * 10) + (direction * throwOutDistance * ThrowCurve()); + Projectile.scale = (1 + Empowerment / maxEmpowerment * 1.5f) * MathHelper.Clamp(1 - retractionTimer, 0.3f, 1f); } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.direction = Math.Sign(direction.X); Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) @@ -212,34 +213,34 @@ namespace CalamityMod.Projectiles.Melee float drawRotation = drawAngle + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, handle.Height); - Vector2 drawOffset = projectile.Center - Main.screenPosition; + Vector2 drawOffset = Projectile.Center - Main.screenPosition; //Afterimages if (CalamityConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) { - for (int i = 0; i < projectile.oldRot.Length; ++i) + for (int i = 0; i < Projectile.oldRot.Length; ++i) { - Color color = projectile.GetAlpha(lightColor) * (1f - (i / (float)projectile.oldRot.Length)); - float afterimageRotation = projectile.oldRot[i] + MathHelper.PiOver4; - Main.spriteBatch.Draw(handle, drawOffset, null, color * MathHelper.Lerp(0f, 0.5f, MathHelper.Clamp(Empowerment / maxEmpowerment - 0.4f / 0.1f, 0f, 1f)), afterimageRotation, drawOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), 0f, 0f); + Color color = Projectile.GetAlpha(lightColor) * (1f - (i / (float)Projectile.oldRot.Length)); + float afterimageRotation = Projectile.oldRot[i] + MathHelper.PiOver4; + Main.spriteBatch.Draw(handle, drawOffset, null, color * MathHelper.Lerp(0f, 0.5f, MathHelper.Clamp(Empowerment / maxEmpowerment - 0.4f / 0.1f, 0f, 1f)), afterimageRotation, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), 0f, 0f); } spriteBatch.End(); //Haha sup babe what if i restarted the spritebatch way too many times haha /blushes spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); Vector2 afterimageDrawOrigin = new Vector2(0f, blade.Height); - for (int i = 0; i < projectile.oldRot.Length; ++i) + for (int i = 0; i < Projectile.oldRot.Length; ++i) { - Color color = projectile.GetAlpha(lightColor) * (1f - (i / (float)projectile.oldRot.Length)); - float afterimageRotation = projectile.oldRot[i] + MathHelper.PiOver4; - Main.spriteBatch.Draw(blade, drawOffset, null, color * MathHelper.Lerp(0f, 0.5f, MathHelper.Clamp((Empowerment / maxEmpowerment - 0.4f) / 0.1f, 0f, 1f)), afterimageRotation, afterimageDrawOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), 0f, 0f); + Color color = Projectile.GetAlpha(lightColor) * (1f - (i / (float)Projectile.oldRot.Length)); + float afterimageRotation = Projectile.oldRot[i] + MathHelper.PiOver4; + Main.spriteBatch.Draw(blade, drawOffset, null, color * MathHelper.Lerp(0f, 0.5f, MathHelper.Clamp((Empowerment / maxEmpowerment - 0.4f) / 0.1f, 0f, 1f)), afterimageRotation, afterimageDrawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), 0f, 0f); } spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } - spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); @@ -257,7 +258,7 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:BasicTint"].Apply(); } - spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f * opacityFade, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f * opacityFade, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); if (CurrentState == 1f && snapTimer > 0) { @@ -279,15 +280,15 @@ namespace CalamityMod.Projectiles.Melee Vector2 Shake = retractProgress > 0 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (1f - snapProgress) * 10f; - int dist = (int)Vector2.Distance(Owner.Center, projectile.Center) / 16; + int dist = (int)Vector2.Distance(Owner.Center, Projectile.Center) / 16; Vector2[] Nodes = new Vector2[dist + 1]; Nodes[0] = Owner.Center; - Nodes[dist] = projectile.Center; + Nodes[dist] = Projectile.Center; for (int i = 1; i < dist + 1; i++) { Rectangle frame = new Rectangle(0, 0 + 18 * (i % 2), 12, 18); - Vector2 positionAlongLine = Vector2.Lerp(Owner.Center, projectile.Center, i / (float)dist); //Get the position of the segment along the line, as if it were a flat line + Vector2 positionAlongLine = Vector2.Lerp(Owner.Center, Projectile.Center, i / (float)dist); //Get the position of the segment along the line, as if it were a flat line Nodes[i] = positionAlongLine + Shake * (float)Math.Sin(i / (float)dist * MathHelper.Pi); float rotation = (Nodes[i] - Nodes[i - 1]).ToRotation() - MathHelper.PiOver2; //Calculate rotation based on direction from last point diff --git a/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs b/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs index 95e06729a4..8d431b9baa 100644 --- a/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs +++ b/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs @@ -10,27 +10,27 @@ namespace CalamityMod.Projectiles.Melee { public class PurityProjectionSigil : ModProjectile { - private NPC target => Main.npc[(int)projectile.ai[0]]; + private NPC target => Main.npc[(int)Projectile.ai[0]]; - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil"; public override void SetStaticDefaults() { DisplayName.SetDefault("Purity Sigil"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 40; - projectile.friendly = false; - projectile.hostile = false; - projectile.penetrate = -1; - projectile.timeLeft = TrueBiomeBlade.DefaultAttunement_SigilTime; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 40; + Projectile.friendly = false; + Projectile.hostile = false; + Projectile.penetrate = -1; + Projectile.timeLeft = TrueBiomeBlade.DefaultAttunement_SigilTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override Color? GetAlpha(Color lightColor) => Color.White; @@ -38,24 +38,24 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, 0.75f, 1f, 0.24f); - int dustParticle = Dust.NewDust(projectile.position, projectile.width, projectile.height, 75, 0f, 0f, 100, default, 0.9f); + Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); + int dustParticle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 0.9f); Main.dust[dustParticle].noGravity = true; Main.dust[dustParticle].velocity *= 0.5f; if (target.active) { - projectile.Center = target.Center; + Projectile.Center = target.Center; } else - projectile.active = false; + Projectile.active = false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (Main.myPlayer != projectile.owner) // don't show for other players + if (Main.myPlayer != Projectile.owner) // don't show for other players return false; - DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs index a2a44da2ab..a01eca37d6 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,12 +17,12 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_AridGrandeur"; private bool initialized = false; Vector2 direction = Vector2.Zero; - public ref float Shred => ref projectile.ai[0]; //How much the attack is, attacking + public ref float Shred => ref Projectile.ai[0]; //How much the attack is, attacking public float ShredRatio => MathHelper.Clamp(Shred / (maxShred * 0.5f), 0f, 1f); - public ref float PogoCooldown => ref projectile.ai[1]; //Cooldown for the pogo - public ref float BounceTime => ref projectile.localAI[0]; - public ref float ChargeSoundCooldown => ref projectile.localAI[1]; - public Player Owner => Main.player[projectile.owner]; + public ref float PogoCooldown => ref Projectile.ai[1]; //Cooldown for the pogo + public ref float BounceTime => ref Projectile.localAI[0]; + public ref float ChargeSoundCooldown => ref Projectile.localAI[1]; + public Player Owner => Main.player[Projectile.owner]; public bool CanPogo => Owner.velocity.Y != 0 && PogoCooldown <= 0; //Only pogo when in the air and if the cooldown is zero private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; @@ -34,27 +35,27 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 70; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = TrueBiomeBlade.HotAttunement_LocalIFrames; - projectile.timeLeft = TrueBiomeBlade.HotAttunement_LocalIFrames; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 70; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = TrueBiomeBlade.HotAttunement_LocalIFrames; + Projectile.timeLeft = TrueBiomeBlade.HotAttunement_LocalIFrames; } public override bool CanDamage() { - return projectile.timeLeft <= 2; //Prevent spam click abuse + return Projectile.timeLeft <= 2; //Prevent spam click abuse } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 120 * projectile.scale; - float bladeWidth = 76 * projectile.scale; + float bladeLenght = 120 * Projectile.scale; + float bladeWidth = 76 * Projectile.scale; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); } @@ -66,9 +67,9 @@ namespace CalamityMod.Projectiles.Melee Owner.velocity = -direction.SafeNormalize(Vector2.Zero) * pogoStrenght; //Bounce Owner.fallStart = (int)(Owner.position.Y / 16f); PogoCooldown = 30; //Cooldown - Main.PlaySound(SoundID.DD2_MonkStaffGroundImpact, projectile.position); + SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Projectile.position); - Vector2 hitPosition = Owner.Center + (direction * 100 * projectile.scale); + Vector2 hitPosition = Owner.Center + (direction * 100 * Projectile.scale); BounceTime = 20f; //Used only for animation for (int i = 0; i < 8; i++) @@ -99,13 +100,13 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao { - Main.PlaySound(SoundID.Item90, projectile.Center); + SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); initialized = true; } if (!OwnerCanShoot) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -114,28 +115,28 @@ namespace CalamityMod.Projectiles.Melee if (Shred < 0) Shred = 0; - Lighting.AddLight(projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio); + Lighting.AddLight(Projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio); //Manage position and rotation direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); - projectile.rotation = direction.ToRotation(); - projectile.Center = Owner.Center + (direction * 60); + Projectile.rotation = direction.ToRotation(); + Projectile.Center = Owner.Center + (direction * 60); //Scaling based on shred - projectile.localNPCHitCooldown = TrueBiomeBlade.HotAttunement_LocalIFrames - (int)(MathHelper.Lerp(0, TrueBiomeBlade.HotAttunement_LocalIFrames - TrueBiomeBlade.HotAttunement_LocalIFramesCharged, ShredRatio)); //Increase the hit frequency - projectile.scale = 1f + (ShredRatio * 1f); //SWAGGER + Projectile.localNPCHitCooldown = TrueBiomeBlade.HotAttunement_LocalIFrames - (int)(MathHelper.Lerp(0, TrueBiomeBlade.HotAttunement_LocalIFrames - TrueBiomeBlade.HotAttunement_LocalIFramesCharged, ShredRatio)); //Increase the hit frequency + Projectile.scale = 1f + (ShredRatio * 1f); //SWAGGER - if (Collision.SolidCollision(Owner.Center + (direction * 100 * projectile.scale) - Vector2.One * 5f, 10, 10)) + if (Collision.SolidCollision(Owner.Center + (direction * 100 * Projectile.scale) - Vector2.One * 5f, 10, 10)) { Pogo(); - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.direction = Math.Sign(direction.X); Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) @@ -151,7 +152,7 @@ namespace CalamityMod.Projectiles.Melee { if (ChargeSoundCooldown <= 0) { - Main.PlaySound(SoundID.DD2_SonicBoomBladeSlash); + SoundEngine.PlaySound(SoundID.DD2_SonicBoomBladeSlash); ChargeSoundCooldown = 20; } } @@ -163,8 +164,8 @@ namespace CalamityMod.Projectiles.Melee Shred -= TrueBiomeBlade.HotAttunement_ShredDecayRate; PogoCooldown--; BounceTime--; - if (projectile.timeLeft <= 2) - projectile.timeLeft = 2; + if (Projectile.timeLeft <= 2) + Projectile.timeLeft = 2; } //Since the iframes vary, adjust the damage to be consistent no matter the iframes. The true scaling happens between the BaseDamage and the FulLChargeDamage @@ -174,7 +175,7 @@ namespace CalamityMod.Projectiles.Melee float currentDamage = (int)(MathHelper.Lerp(TrueBiomeBlade.HotAttunement_BaseDamage * deviationFromBaseDamage, TrueBiomeBlade.HotAttunement_FullChargeDamage * deviationFromBaseDamage, ShredRatio)); //Adjust the damage to make it constant based on the local iframes - float damageReduction = projectile.localNPCHitCooldown / (float)TrueBiomeBlade.HotAttunement_LocalIFrames; + float damageReduction = Projectile.localNPCHitCooldown / (float)TrueBiomeBlade.HotAttunement_LocalIFrames; damage = (int)(currentDamage * damageReduction); } @@ -185,7 +186,7 @@ namespace CalamityMod.Projectiles.Melee float currentDamage = (int)(MathHelper.Lerp(TrueBiomeBlade.HotAttunement_BaseDamage * deviationFromBaseDamage, TrueBiomeBlade.HotAttunement_FullChargeDamage * deviationFromBaseDamage, ShredRatio)); //Adjust the damage to make it constant based on the local iframes - float damageReduction = projectile.localNPCHitCooldown / (float)TrueBiomeBlade.HotAttunement_LocalIFrames; + float damageReduction = Projectile.localNPCHitCooldown / (float)TrueBiomeBlade.HotAttunement_LocalIFrames; damage = (int)(currentDamage * damageReduction); } @@ -200,7 +201,7 @@ namespace CalamityMod.Projectiles.Melee // get lifted up if (PogoCooldown <= 0) { - Main.PlaySound(SoundID.NPCHit30, projectile.Center); //Sizzle + SoundEngine.PlaySound(SoundID.NPCHit30, Projectile.Center); //Sizzle Shred += 62; //Augment the shredspeed if (Owner.velocity.Y > 0) Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly @@ -211,10 +212,10 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCHit43, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit43, Projectile.Center); if (ShredRatio > 0.5 && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, direction * 16f, ProjectileType(), (int)(projectile.damage * TrueBiomeBlade.HotAttunement_ShotDamageBoost), projectile.knockBack, Owner.whoAmI, Shred); + Projectile.NewProjectile(Projectile.Center, direction * 16f, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.HotAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred); } } @@ -231,7 +232,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition; - spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); @@ -239,7 +240,7 @@ namespace CalamityMod.Projectiles.Melee //Update the parameters drawOrigin = new Vector2(0f, blade.Height); - spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); for (int i = 0; i < bladeAmount; i++) //Draw extra copies @@ -257,7 +258,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawDisplacementAngle = direction.RotatedBy(MathHelper.PiOver2) * circleCompletion.ToRotationVector2().Y * (20 + 40 * ShredRatio); //How far perpendicularly Vector2 drawOffsetFromBounce = direction * MathHelper.Clamp(BounceTime, 0f, 20f) / 20f * 20f; - spriteBatch.Draw(blade, drawOffsetStraight + drawDisplacementAngle + drawOffsetFromBounce, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffsetStraight + drawDisplacementAngle + drawOffsetFromBounce, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); } //Back to normal diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs index f59fc4b5e4..1820767609 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,9 +15,9 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_AridGrandeurExtra"; private bool initialized = false; Vector2 direction = Vector2.Zero; - public ref float Shred => ref projectile.ai[0]; + public ref float Shred => ref Projectile.ai[0]; public float ShredRatio => MathHelper.Clamp(Shred / (TrueAridGrandeur.maxShred * 0.5f), 0f, 1f); - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public const float pogoStrenght = 16f; //How much the player gets pogoed up @@ -26,46 +27,46 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 70; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 70; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 84 * projectile.scale; - float bladeWidth = 76 * projectile.scale; + float bladeLenght = 84 * Projectile.scale; + float bladeWidth = 76 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center - direction * bladeLenght / 2, projectile.Center + direction * bladeLenght / 2, bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLenght / 2, Projectile.Center + direction * bladeLenght / 2, bladeWidth, ref collisionPoint); } public override void AI() { if (!initialized) { - Main.PlaySound(SoundID.Item90, projectile.Center); - projectile.timeLeft = (int)(30f + ShredRatio * 30f); + SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); + Projectile.timeLeft = (int)(30f + ShredRatio * 30f); initialized = true; direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); - projectile.rotation = direction.ToRotation(); + Projectile.rotation = direction.ToRotation(); - projectile.velocity = direction * 6f; + Projectile.velocity = direction * 6f; - projectile.scale = 1f + ShredRatio; //SWAGGER - projectile.netUpdate = true; + Projectile.scale = 1f + ShredRatio; //SWAGGER + Projectile.netUpdate = true; } - projectile.position += projectile.velocity; + Projectile.position += Projectile.velocity; } @@ -86,12 +87,12 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, tex.Height); - Vector2 drawOffsetStraight = projectile.Center + direction * (float)Math.Sin(Main.GlobalTime * 7) * 10 - Main.screenPosition; //How far from the player + Vector2 drawOffsetStraight = Projectile.Center + direction * (float)Math.Sin(Main.GlobalTime * 7) * 10 - Main.screenPosition; //How far from the player Vector2 drawDisplacementAngle = direction.RotatedBy(MathHelper.PiOver2) * circleCompletion.ToRotationVector2().Y * (20 + 40 * ShredRatio); //How far perpendicularly - float opacityFade = projectile.timeLeft > 15 ? 1 : projectile.timeLeft / 15f; + float opacityFade = Projectile.timeLeft > 15 ? 1 : Projectile.timeLeft / 15f; - spriteBatch.Draw(tex, drawOffsetStraight + drawDisplacementAngle, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f * opacityFade, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(tex, drawOffsetStraight + drawDisplacementAngle, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f * opacityFade, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); } //Back to normal @@ -103,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item60, projectile.Center); + SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); for (int i = 0; i < 4; i++) //Particel { float drawAngle = direction.ToRotation(); @@ -112,12 +113,12 @@ namespace CalamityMod.Projectiles.Melee float drawRotation = drawAngle + MathHelper.PiOver4 + (circleCompletion * MathHelper.Pi / 10f) - (circleCompletion * (MathHelper.Pi / 9f) * ShredRatio); - Vector2 drawOffsetStraight = projectile.Center + direction * (float)Math.Sin(Main.GlobalTime * 7) * 10; //How far from the player + Vector2 drawOffsetStraight = Projectile.Center + direction * (float)Math.Sin(Main.GlobalTime * 7) * 10; //How far from the player Vector2 drawDisplacementAngle = direction.RotatedBy(MathHelper.PiOver2) * circleCompletion.ToRotationVector2().Y * (20 + 40 * ShredRatio); //How far perpendicularly for (int j = 0; j < 4; j++) { - Particle Sparkle = new GenericSparkle(drawOffsetStraight + (drawRotation - MathHelper.PiOver4).ToRotationVector2() * (60 + j * 50f) + drawDisplacementAngle, direction * projectile.velocity.Length() * Main.rand.NextFloat(0.9f, 1.1f), Color.Lerp(Color.Cyan, Color.Orange, (j + 1) / 4f), Color.OrangeRed, 0.5f + Main.rand.NextFloat(-0.2f, 0.2f), 20 + Main.rand.Next(30), 1, 2f); + Particle Sparkle = new GenericSparkle(drawOffsetStraight + (drawRotation - MathHelper.PiOver4).ToRotationVector2() * (60 + j * 50f) + drawDisplacementAngle, direction * Projectile.velocity.Length() * Main.rand.NextFloat(0.9f, 1.1f), Color.Lerp(Color.Cyan, Color.Orange, (j + 1) / 4f), Color.OrangeRed, 0.5f + Main.rand.NextFloat(-0.2f, 0.2f), 20 + Main.rand.Next(30), 1, 2f); GeneralParticleHandler.SpawnParticle(Sparkle); } diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs index ce63e4841f..1794a58965 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs @@ -10,6 +10,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -20,9 +21,9 @@ namespace CalamityMod.Projectiles.Melee private bool initialized = false; Vector2 direction = Vector2.Zero; public float rotation; - public ref float SwingMode => ref projectile.ai[0]; //0 = Up-Down small slash, 1 = Down-Up large slash, 2 = Thrust - public ref float MaxTime => ref projectile.ai[1]; - public float Timer => MaxTime - projectile.timeLeft; + public ref float SwingMode => ref Projectile.ai[0]; //0 = Up-Down small slash, 1 = Down-Up large slash, 2 = Thrust + public ref float MaxTime => ref Projectile.ai[1]; + public float Timer => MaxTime - Projectile.timeLeft; public int SwingDirection { @@ -54,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee } } - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { @@ -62,13 +63,13 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 75; - projectile.width = projectile.height = 75; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 75; + Projectile.width = Projectile.height = 75; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -81,11 +82,11 @@ namespace CalamityMod.Projectiles.Melee { case 0: case 1: - bladeLenght = 150 * projectile.scale; + bladeLenght = 150 * Projectile.scale; break; case 2: bladeLenght = 225f; //In awe e - bladeLenght *= projectile.scale; + bladeLenght *= Projectile.scale; displace = direction * ThrustDisplaceRatio() * 60f; break; @@ -104,57 +105,57 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - projectile.timeLeft = (int)MaxTime; + Projectile.timeLeft = (int)MaxTime; switch (SwingMode) { case 0: - projectile.width = projectile.height = 100; - Main.PlaySound(SoundID.DD2_MonkStaffSwing, projectile.Center); + Projectile.width = Projectile.height = 100; + SoundEngine.PlaySound(SoundID.DD2_MonkStaffSwing, Projectile.Center); break; case 1: - projectile.width = projectile.height = 100; - projectile.width = projectile.height = 100; - Main.PlaySound(SoundID.DD2_OgreSpit, projectile.Center); - projectile.damage = (int)(projectile.damage * TrueBiomeBlade.ColdAttunement_SecondSwingBoost); + Projectile.width = Projectile.height = 100; + Projectile.width = Projectile.height = 100; + SoundEngine.PlaySound(SoundID.DD2_OgreSpit, Projectile.Center); + Projectile.damage = (int)(Projectile.damage * TrueBiomeBlade.ColdAttunement_SecondSwingBoost); break; case 2: - projectile.width = projectile.height = 170; - Main.PlaySound(SoundID.DD2_PhantomPhoenixShot, projectile.Center); - projectile.damage = (int)(projectile.damage * TrueBiomeBlade.ColdAttunement_ThirdSwingBoost); + Projectile.width = Projectile.height = 170; + SoundEngine.PlaySound(SoundID.DD2_PhantomPhoenixShot, Projectile.Center); + Projectile.damage = (int)(Projectile.damage * TrueBiomeBlade.ColdAttunement_ThirdSwingBoost); break; } direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); - projectile.rotation = direction.ToRotation(); + Projectile.rotation = direction.ToRotation(); initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } //Manage position and rotation - projectile.Center = Owner.Center + (direction * 30); + Projectile.Center = Owner.Center + (direction * 30); //rotation = projectile.rotation + MathHelper.SmoothStep(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, Timer / MaxTime); float factor = 1 - (float)Math.Pow((double)-(Timer / MaxTime) + 1, 2d); - rotation = projectile.rotation + MathHelper.Lerp(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, factor); - projectile.scale = 1f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.6f); //SWAGGER + rotation = Projectile.rotation + MathHelper.Lerp(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, factor); + Projectile.scale = 1f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.6f); //SWAGGER Lighting.AddLight(Owner.MountedCenter, new Vector3(0.75f, 1f, 1f) * (float)Math.Sin(Timer / MaxTime * MathHelper.Pi)); //Add the thrust motion & animation for the third combo state if (SwingMode == 2) { - projectile.scale = 1f + (ThrustScaleRatio() * 0.3f); - projectile.Center = Owner.Center + (direction * ThrustDisplaceRatio() * 60); + Projectile.scale = 1f + (ThrustScaleRatio() * 0.3f); + Projectile.Center = Owner.Center + (direction * ThrustDisplaceRatio() * 60); - projectile.frameCounter++; - if (projectile.frameCounter % 5 == 0 && projectile.frame + 1 < Main.projFrames[projectile.type]) - projectile.frame++; + Projectile.frameCounter++; + if (Projectile.frameCounter % 5 == 0 && Projectile.frame + 1 < Main.projFrames[Projectile.type]) + Projectile.frame++; if (Main.rand.NextBool() && Owner.whoAmI == Main.myPlayer) { - Projectile mist = Projectile.NewProjectileDirect(Owner.Center + direction * 40 + Main.rand.NextVector2Circular(30f, 30f), Vector2.Zero, ProjectileType(), (int)(projectile.damage * TrueBiomeBlade.ColdAttunement_MistDamageReduction), 0f, Owner.whoAmI); + Projectile mist = Projectile.NewProjectileDirect(Owner.Center + direction * 40 + Main.rand.NextVector2Circular(30f, 30f), Vector2.Zero, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.ColdAttunement_MistDamageReduction), 0f, Owner.whoAmI); mist.velocity = (mist.Center - Owner.Center) * 0.2f + Owner.velocity; } @@ -164,16 +165,16 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextFloat(0f, 1f) > 0.75f && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Owner.Center + direction * 40, rotation.ToRotationVector2() * 5, ProjectileType(), (int)(projectile.damage * TrueBiomeBlade.ColdAttunement_MistDamageReduction), 0f, Owner.whoAmI); + Projectile.NewProjectile(Owner.Center + direction * 40, rotation.ToRotationVector2() * 5, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.ColdAttunement_MistDamageReduction), 0f, Owner.whoAmI); - Vector2 particlePosition = Owner.Center + (rotation.ToRotationVector2() * 100f * projectile.scale); + Vector2 particlePosition = Owner.Center + (rotation.ToRotationVector2() * 100f * Projectile.scale); Particle snowflake = new SnowflakeSparkle(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); GeneralParticleHandler.SpawnParticle(snowflake); } } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.direction = Math.Sign(rotation.ToRotationVector2().X); Owner.itemRotation = rotation; if (Owner.direction != 1) @@ -208,13 +209,13 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, blade.Height); - spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Back to normal spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -229,7 +230,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - spriteBatch.Draw(handle, drawOffset + thrustDisplace, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawOffset + thrustDisplace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -238,7 +239,7 @@ namespace CalamityMod.Projectiles.Melee drawOrigin = new Vector2(0f, blade.Height); //Anim stuff - spriteBatch.Draw(blade, drawOffset + thrustDisplace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffset + thrustDisplace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Back to normal spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs index 9056fd6a04..29febf4160 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -15,14 +16,14 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_DecaysRetort"; private bool initialized = false; public Vector2 direction = Vector2.Zero; - public ref float MaxTime => ref projectile.ai[0]; - public ref float CanLunge => ref projectile.ai[1]; - public float Timer => MaxTime - projectile.timeLeft; + public ref float MaxTime => ref Projectile.ai[0]; + public ref float CanLunge => ref Projectile.ai[1]; + public float Timer => MaxTime - Projectile.timeLeft; public bool ChargedUp; - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public const float LungeSpeed = 16; - public ref float CanBounce => ref projectile.localAI[0]; - public ref float dashTimer => ref projectile.localAI[1]; + public ref float CanBounce => ref Projectile.localAI[0]; + public ref float dashTimer => ref Projectile.localAI[1]; public const float maxDash = 20f; private Vector2 PowerLungeStart; @@ -33,19 +34,19 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 84; - projectile.width = projectile.height = 84; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 84; + Projectile.width = Projectile.height = 84; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 140f * projectile.scale; + float bladeLenght = 140f * Projectile.scale; Vector2 displace = direction * ((float)Math.Sin(Timer / MaxTime * 3.14f) * 60); return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (direction * bladeLenght), 24, ref collisionPoint); @@ -56,16 +57,16 @@ namespace CalamityMod.Projectiles.Melee if (!initialized) //Initialization { CanBounce = 1f; - projectile.timeLeft = (int)MaxTime; + Projectile.timeLeft = (int)MaxTime; direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); - projectile.rotation = direction.ToRotation(); + Projectile.rotation = direction.ToRotation(); if (CanLunge == 1f && !ChargedUp) Lunge(); - Main.PlaySound(SoundID.Item103, projectile.Center); + SoundEngine.PlaySound(SoundID.Item103, Projectile.Center); initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } if (ChargedUp && dashTimer == 0f) @@ -77,7 +78,7 @@ namespace CalamityMod.Projectiles.Melee { Owner.fallStart = (int)(Owner.position.Y / 16f); Owner.velocity = direction * 60f; - projectile.timeLeft = (int)(MaxTime / 2f); + Projectile.timeLeft = (int)(MaxTime / 2f); dashTimer++; } @@ -86,11 +87,11 @@ namespace CalamityMod.Projectiles.Melee Owner.velocity *= 0.1f; //Abrupt stop Owner.Calamity().LungingDown = false; - Main.PlaySound(mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/SwiftSlice"), Owner.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/SwiftSlice"), Owner.Center); if (Owner.whoAmI == Main.myPlayer) { - Projectile proj = Projectile.NewProjectileDirect(Owner.Center - PowerLungeStart / 2f, Vector2.Zero, ProjectileType(), (int)(projectile.damage * TrueBiomeBlade.EvilAttunement_SlashDamageBoost), 0, Owner.whoAmI); + Projectile proj = Projectile.NewProjectileDirect(Owner.Center - PowerLungeStart / 2f, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.EvilAttunement_SlashDamageBoost), 0, Owner.whoAmI); if (proj.modProjectile is DecaysRetortDash dash) { dash.DashStart = PowerLungeStart; @@ -102,13 +103,13 @@ namespace CalamityMod.Projectiles.Melee } //Manage position and rotation - projectile.scale = 1f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.6f); //SWAGGER - projectile.Center = Owner.Center + (direction * ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 60)); + Projectile.scale = 1f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.6f); //SWAGGER + Projectile.Center = Owner.Center + (direction * ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 60)); - Lighting.AddLight(projectile.Center, new Vector3(0.9f, 0f, 0.35f) * (float)Math.Sin(Timer / MaxTime * MathHelper.Pi)); + Lighting.AddLight(Projectile.Center, new Vector3(0.9f, 0f, 0.35f) * (float)Math.Sin(Timer / MaxTime * MathHelper.Pi)); //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.direction = Math.Sign(direction.X); Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) @@ -120,7 +121,7 @@ namespace CalamityMod.Projectiles.Melee public void Lunge() { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; Owner.velocity = direction.SafeNormalize(Vector2.UnitX * Owner.direction) * LungeSpeed; } @@ -133,16 +134,16 @@ namespace CalamityMod.Projectiles.Melee Owner.GiveIFrames(TrueBiomeBlade.EvilAttunement_SlashIFrames); } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => OnHitEffects(!target.canGhostHeal || Main.player[projectile.owner].moonLeech); - public override void OnHitPvp(Player target, int damage, bool crit) => OnHitEffects(Main.player[projectile.owner].moonLeech); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => OnHitEffects(!target.canGhostHeal || Main.player[Projectile.owner].moonLeech); + public override void OnHitPvp(Player target, int damage, bool crit) => OnHitEffects(Main.player[Projectile.owner].moonLeech); private void OnHitEffects(bool cannotLifesteal) { if (ChargedUp) return; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; if (Main.myPlayer != Owner.whoAmI || CanBounce == 0f) return; @@ -165,7 +166,7 @@ namespace CalamityMod.Projectiles.Melee { sword.PowerLungeCounter++; if (sword.PowerLungeCounter == 3) - Main.PlaySound(SoundID.Item79); //indicate the charge with a sound effect + SoundEngine.PlaySound(SoundID.Item79); //indicate the charge with a sound effect } } } @@ -182,7 +183,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition; - spriteBatch.Draw(handle, drawOffset + displace, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawOffset + displace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); @@ -190,12 +191,12 @@ namespace CalamityMod.Projectiles.Melee //Update the parameters drawOrigin = new Vector2(0f, tex.Height); - spriteBatch.Draw(tex, drawOffset + displace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(tex, drawOffset + displace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); if (dashTimer > 0f && dashTimer < maxDash) { float thrustRatio = (float)Math.Sin(dashTimer / maxDash * MathHelper.Pi); - spriteBatch.Draw(tex, drawOffset + displace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale * (1 + thrustRatio * 0.2f), 0f, 0f); + spriteBatch.Draw(tex, drawOffset + displace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale * (1 + thrustRatio * 0.2f), 0f, 0f); } //Back to normal diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs index 196977886b..fc798db1d6 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs @@ -10,6 +10,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -18,11 +19,11 @@ namespace CalamityMod.Projectiles.Melee private NPC[] excludedTargets = new NPC[4]; public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_GrovetendersTouchBlade"; private bool initialized = false; - public Player Owner => Main.player[projectile.owner]; - public float Timer => MaxTime - projectile.timeLeft; - public ref float HasSnapped => ref projectile.ai[0]; - public ref float SnapCoyoteTime => ref projectile.ai[1]; - public ref float Reach => ref projectile.localAI[0]; + public Player Owner => Main.player[Projectile.owner]; + public float Timer => MaxTime - Projectile.timeLeft; + public ref float HasSnapped => ref Projectile.ai[0]; + public ref float SnapCoyoteTime => ref Projectile.ai[1]; + public ref float Reach => ref Projectile.localAI[0]; public float flipped; @@ -46,21 +47,21 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 80; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = TrueBiomeBlade.TropicalAttunement_LocalIFrames; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 80; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = TrueBiomeBlade.TropicalAttunement_LocalIFrames; } public override bool? CanCutTiles() => false; //Itd be quite counterproductive to make the whip cut the tiles it just grew public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - BezierCurve curve = new BezierCurve(new Vector2[] { Owner.MountedCenter, controlPoint1, controlPoint2, projectile.Center }); + BezierCurve curve = new BezierCurve(new Vector2[] { Owner.MountedCenter, controlPoint1, controlPoint2, Projectile.Center }); int numPoints = 32; Vector2[] chainPositions = curve.GetPoints(numPoints).ToArray(); @@ -73,8 +74,8 @@ namespace CalamityMod.Projectiles.Melee return true; if (i == numPoints - 1) //Extra lenght collision for the blade itself { - Vector2 projectileHalfLenght = 85 * projectile.rotation.ToRotationVector2(); - return (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center - projectileHalfLenght, projectile.Center + projectileHalfLenght, 32, ref collisionPoint)); + Vector2 projectileHalfLenght = 85 * Projectile.rotation.ToRotationVector2(); + return (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - projectileHalfLenght, Projectile.Center + projectileHalfLenght, 32, ref collisionPoint)); } } @@ -84,10 +85,10 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Vector2 projectileHalfLenght = 85f * projectile.rotation.ToRotationVector2(); + Vector2 projectileHalfLenght = 85f * Projectile.rotation.ToRotationVector2(); float collisionPoint = 0; //If you hit the enemy during the coyote time with the blade of the whip, guarantee a crit & get some bonus damage - if (Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), projectile.Center - projectileHalfLenght, projectile.Center + projectileHalfLenght, 32, ref collisionPoint)) + if (Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), Projectile.Center - projectileHalfLenght, Projectile.Center + projectileHalfLenght, 32, ref collisionPoint)) { if (SnapCoyoteTime > 0f) { @@ -120,7 +121,7 @@ namespace CalamityMod.Projectiles.Melee if (!boing) { boing = true; - Main.PlaySound(SoundID.Item56); + SoundEngine.PlaySound(SoundID.Item56); } Projectile.NewProjectile(target.Center, Vector2.Zero, ProjectileType(), (int)(damage * TrueBiomeBlade.TropicalAttunement_VineDamageReduction), 0, Owner.whoAmI, target.whoAmI, potentialTarget.whoAmI); } @@ -154,37 +155,37 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization. create control points & shit) { - projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); + Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); Reach = MathHelper.Clamp((Owner.Center - Owner.Calamity().mouseWorld).Length(), MinReach, MaxReach); - Main.PlaySound(SoundID.DD2_OgreSpit, projectile.Center); - controlPoint1 = projectile.Center; - controlPoint2 = projectile.Center; - projectile.timeLeft = (int)MaxTime; + SoundEngine.PlaySound(SoundID.DD2_OgreSpit, Projectile.Center); + controlPoint1 = Projectile.Center; + controlPoint2 = Projectile.Center; + Projectile.timeLeft = (int)MaxTime; initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } if (ReelingBack && HasSnapped == 0f) //Snap & also small coyote time for the hook { - Main.PlaySound(SoundID.Item41, projectile.Center); //Snap + SoundEngine.PlaySound(SoundID.Item41, Projectile.Center); //Snap HasSnapped = 1f; SnapCoyoteTime = coyoteTimeFrames; } if (SnapCoyoteTime > 0) //keep checking for the tile hook { - Lighting.AddLight(projectile.Center, 0.8f, 1f, 0.35f); + Lighting.AddLight(Projectile.Center, 0.8f, 1f, 0.35f); HookToTile(); SnapCoyoteTime--; } - Owner.direction = Math.Sign(projectile.velocity.X); - projectile.rotation = projectile.AngleFrom(Owner.Center); //Point away from playah + Owner.direction = Math.Sign(Projectile.velocity.X); + Projectile.rotation = Projectile.AngleFrom(Owner.Center); //Point away from playah float ratio = GetSwingRatio(); - projectile.Center = Owner.MountedCenter + SwingPosition(ratio); - projectile.direction = projectile.spriteDirection = -Owner.direction * (int)flipped; + Projectile.Center = Owner.MountedCenter + SwingPosition(ratio); + Projectile.direction = Projectile.spriteDirection = -Owner.direction * (int)flipped; //MessWithTiles(); @@ -195,12 +196,12 @@ namespace CalamityMod.Projectiles.Melee if (Main.myPlayer == Owner.whoAmI) { //Shmoove the player if a tile is hit. This movement always happens if the owner isnt on the ground, but will only happen if the projectile is above the player if they are standing on the ground) - if (Collision.SolidCollision(projectile.position, 32, 32) && (Owner.velocity.Y != 0 || projectile.position.Y < Owner.position.Y)) + if (Collision.SolidCollision(Projectile.position, 32, 32) && (Owner.velocity.Y != 0 || Projectile.position.Y < Owner.position.Y)) { - Owner.velocity = Owner.SafeDirectionTo(projectile.Center, Vector2.Zero) * ReelBackStrenght; + Owner.velocity = Owner.SafeDirectionTo(Projectile.Center, Vector2.Zero) * ReelBackStrenght; SnapCoyoteTime = 0f; } - Main.PlaySound(SoundID.Item65, projectile.position); + SoundEngine.PlaySound(SoundID.Item65, Projectile.position); } } @@ -228,12 +229,12 @@ namespace CalamityMod.Projectiles.Melee float angleOffset = Owner.direction * flipped * MathHelper.Lerp(-angleDeviation, 0, progress); //Go from very angled to straight at the zenith of the attack if (flipped == -1) distance *= MathHelper.Lerp(0.1f, 0.3f, (float)Math.Sin(progress * MathHelper.Pi)); - return projectile.velocity.RotatedBy(angleOffset) * distance; + return Projectile.velocity.RotatedBy(angleOffset) * distance; } else { float distance = MathHelper.Lerp(Reach, 0f, progress); //Quickly zip back to the player . No angles or minimum distance from player. - return projectile.velocity * distance; + return Projectile.velocity * distance; } } @@ -244,23 +245,23 @@ namespace CalamityMod.Projectiles.Melee Texture2D handle = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GrovetendersTouchBlade"); Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GrovetendersTouchGlow"); - Vector2 projBottom = projectile.Center + new Vector2(-handle.Width / 2, handle.Height / 2).RotatedBy(projectile.rotation + MathHelper.PiOver4) * 0.75f; + Vector2 projBottom = Projectile.Center + new Vector2(-handle.Width / 2, handle.Height / 2).RotatedBy(Projectile.rotation + MathHelper.PiOver4) * 0.75f; DrawChain(spriteBatch, projBottom, out Vector2[] chainPositions); float drawRotation = (projBottom - chainPositions[chainPositions.Length - 2]).ToRotation() + MathHelper.PiOver4; //Face away from the last point of the bezier curve drawRotation += SnapCoyoteTime > 0 ? MathHelper.Pi : 0; //During coyote time the blade flips for some reason. Prevent that from happening - drawRotation += projectile.spriteDirection < 0 ? 0f : 0f; + drawRotation += Projectile.spriteDirection < 0 ? 0f : 0f; if (ReelingBack) - drawRotation = Utils.AngleLerp(drawRotation, (projectile.Center - Owner.Center).ToRotation(), GetSwingRatio()); + drawRotation = Utils.AngleLerp(drawRotation, (Projectile.Center - Owner.Center).ToRotation(), GetSwingRatio()); Vector2 drawOrigin = new Vector2(0f, handle.Height); - SpriteEffects flip = (projectile.spriteDirection < 0) ? SpriteEffects.None : SpriteEffects.None; - lightColor = Lighting.GetColor((int)(projectile.Center.X / 16f), (int)(projectile.Center.Y / 16f)); + SpriteEffects flip = (Projectile.spriteDirection < 0) ? SpriteEffects.None : SpriteEffects.None; + lightColor = Lighting.GetColor((int)(Projectile.Center.X / 16f), (int)(Projectile.Center.Y / 16f)); Vector2 nitpickCorrection = (flipped == -1 && (Timer / MaxTime < 0.35f)) ? drawRotation.ToRotationVector2() * 16f + (Owner.direction == -1f ? Vector2.UnitX * -12f : Vector2.Zero) : Vector2.Zero; - spriteBatch.Draw(handle, projBottom - nitpickCorrection - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, projectile.scale, flip, 0f); + spriteBatch.Draw(handle, projBottom - nitpickCorrection - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f); if ((!ReelingBack || SnapCoyoteTime != 0f) && (Timer / MaxTime > 0.35f)) { @@ -269,7 +270,7 @@ namespace CalamityMod.Projectiles.Melee spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Only update the origin for once drawOrigin = new Vector2(0f, blade.Height); - spriteBatch.Draw(blade, projBottom - nitpickCorrection - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale, flip, 0f); + spriteBatch.Draw(blade, projBottom - nitpickCorrection - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, flip, 0f); //Back to normal spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs b/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs index b0e2683a76..c1e8f99a2e 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs @@ -7,33 +7,34 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TruePurityProjection : ModProjectile //The boring plain one. With cool homing now { public NPC target; - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override string Texture => "CalamityMod/Projectiles/Melee/BrokenBiomeBlade_PurityProjection"; public override void SetStaticDefaults() { DisplayName.SetDefault("Purity Projection"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 32; - projectile.aiStyle = 27; + Projectile.width = Projectile.height = 32; + Projectile.aiStyle = 27; aiType = ProjectileID.LightBeam; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = TrueBiomeBlade.DefaultAttunement_BeamTime; - projectile.extraUpdates = 1; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = TrueBiomeBlade.DefaultAttunement_BeamTime; + Projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override void AI() @@ -50,43 +51,43 @@ namespace CalamityMod.Projectiles.Melee } } } - else if ((projectile.Center - target.Center).Length() >= (projectile.Center + projectile.velocity - target.Center).Length() && CalamityUtils.AngleBetween(projectile.velocity, target.Center - projectile.Center) < TrueBiomeBlade.DefaultAttunement_HomingAngle) //Home in + else if ((Projectile.Center - target.Center).Length() >= (Projectile.Center + Projectile.velocity - target.Center).Length() && CalamityUtils.AngleBetween(Projectile.velocity, target.Center - Projectile.Center) < TrueBiomeBlade.DefaultAttunement_HomingAngle) //Home in { - projectile.timeLeft = 30; //Remain alive - float angularTurnSpeed = MathHelper.ToRadians(MathHelper.Lerp(12.5f, 2.5f, MathHelper.Clamp(projectile.Distance(target.Center) / 10f, 0f, 1f))); - float idealDirection = projectile.AngleTo(target.Center); - float updatedDirection = projectile.velocity.ToRotation().AngleTowards(idealDirection, angularTurnSpeed); - projectile.velocity = updatedDirection.ToRotationVector2() * projectile.velocity.Length(); + Projectile.timeLeft = 30; //Remain alive + float angularTurnSpeed = MathHelper.ToRadians(MathHelper.Lerp(12.5f, 2.5f, MathHelper.Clamp(Projectile.Distance(target.Center) / 10f, 0f, 1f))); + float idealDirection = Projectile.AngleTo(target.Center); + float updatedDirection = Projectile.velocity.ToRotation().AngleTowards(idealDirection, angularTurnSpeed); + Projectile.velocity = updatedDirection.ToRotationVector2() * Projectile.velocity.Length(); } - if (projectile.timeLeft < TrueBiomeBlade.DefaultAttunement_BeamTime - 5f) - projectile.tileCollide = true; + if (Projectile.timeLeft < TrueBiomeBlade.DefaultAttunement_BeamTime - 5f) + Projectile.tileCollide = true; - Lighting.AddLight(projectile.Center, 0.75f, 1f, 0.24f); - int dustParticle = Dust.NewDust(projectile.position, projectile.width, projectile.height, 75, 0f, 0f, 100, default, 0.9f); + Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); + int dustParticle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 0.9f); Main.dust[dustParticle].noGravity = true; Main.dust[dustParticle].velocity *= 0.5f; - Main.dust[dustParticle].velocity += projectile.velocity * 0.1f; + Main.dust[dustParticle].velocity += Projectile.velocity * 0.1f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > TrueBiomeBlade.DefaultAttunement_BeamTime - 5f) + if (Projectile.timeLeft > TrueBiomeBlade.DefaultAttunement_BeamTime - 5f) return false; - DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item43, projectile.Center); + SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); for (int i = 0; i <= 15; i++) { - Vector2 displace = (projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f; - int dustParticle = Dust.NewDust(projectile.Center + displace, projectile.width, projectile.height, 75, 0f, 0f, 100, default, 2f); + Vector2 displace = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f; + int dustParticle = Dust.NewDust(Projectile.Center + displace, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 2f); Main.dust[dustParticle].noGravity = true; - Main.dust[dustParticle].velocity = projectile.oldVelocity; + Main.dust[dustParticle].velocity = Projectile.oldVelocity; } } diff --git a/Projectiles/Melee/MicrowaveAura.cs b/Projectiles/Melee/MicrowaveAura.cs index 1bb0b5da73..4cc4a325a3 100644 --- a/Projectiles/Melee/MicrowaveAura.cs +++ b/Projectiles/Melee/MicrowaveAura.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Melee.Yoyos; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -19,17 +20,17 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.width = 200; - projectile.height = 200; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.width = 200; + Projectile.height = 200; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; } public override void AI() @@ -37,12 +38,12 @@ namespace CalamityMod.Projectiles.Melee Projectile parent = FindParent(); if (parent != null && parent.active) { - projectile.Center = parent.Center; - projectile.timeLeft = 2; + Projectile.Center = parent.Center; + Projectile.timeLeft = 2; } else { - projectile.Kill(); + Projectile.Kill(); } } @@ -51,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(ModContent.BuffType(), 180); if (target.life <= 0 && (FindParent().modProjectile as MicrowaveYoyo).soundCooldown <= 0) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)projectile.Center.X, (int)projectile.Center.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)Projectile.Center.X, (int)Projectile.Center.Y); (FindParent().modProjectile as MicrowaveYoyo).soundCooldown = 60; } } @@ -61,7 +62,7 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(ModContent.BuffType(), 180); if (target.statLife <= 0 && (FindParent().modProjectile as MicrowaveYoyo).soundCooldown <= 0) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)projectile.Center.X, (int)projectile.Center.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)Projectile.Center.X, (int)Projectile.Center.Y); (FindParent().modProjectile as MicrowaveYoyo).soundCooldown = 60; } } @@ -72,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < Main.maxProjectiles; i++) { Projectile p = Main.projectile[i]; - if (p.identity == projectile.ai[0] && p.active && p.type == ModContent.ProjectileType() && p.owner == projectile.owner) + if (p.identity == Projectile.ai[0] && p.active && p.type == ModContent.ProjectileType() && p.owner == Projectile.owner) { parent = p; break; @@ -81,6 +82,6 @@ namespace CalamityMod.Projectiles.Melee return parent; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); } } diff --git a/Projectiles/Melee/MirrorBlast.cs b/Projectiles/Melee/MirrorBlast.cs index e18640d3d9..97f2a0f4fb 100644 --- a/Projectiles/Melee/MirrorBlast.cs +++ b/Projectiles/Melee/MirrorBlast.cs @@ -12,52 +12,52 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; } public override void AI() { - int num123 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + int num123 = (int)Player.FindClosest(Projectile.Center, 1, 1); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] < 110f && Projectile.ai[1] > 30f) { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector17 = Main.player[num123].Center - projectile.Center; + float scaleFactor2 = Projectile.velocity.Length(); + Vector2 vector17 = Main.player[num123].Center - Projectile.Center; vector17.Normalize(); vector17 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector17) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 24f + vector17) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; } - if (projectile.velocity.Length() < 18f) + if (Projectile.velocity.Length() < 18f) { - projectile.velocity *= 1.02f; + Projectile.velocity *= 1.02f; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0f, 0.35f, 0.35f); + Lighting.AddLight(Projectile.Center, 0f, 0.35f, 0.35f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 295) + if (Projectile.timeLeft > 295) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/MonstrousKnife.cs b/Projectiles/Melee/MonstrousKnife.cs index dc9fea9f14..da42aa734d 100644 --- a/Projectiles/Melee/MonstrousKnife.cs +++ b/Projectiles/Melee/MonstrousKnife.cs @@ -14,51 +14,51 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 2; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 2; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 30f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 30f) { - projectile.alpha += 10; - if (projectile.damage > 1) - projectile.damage = (int)(projectile.damage * 0.9); - projectile.knockBack = projectile.knockBack * 0.9f; - if (projectile.alpha >= 255) - projectile.Kill(); + Projectile.alpha += 10; + if (Projectile.damage > 1) + Projectile.damage = (int)(Projectile.damage * 0.9); + Projectile.knockBack = Projectile.knockBack * 0.9f; + if (Projectile.alpha >= 255) + Projectile.Kill(); } - if (projectile.ai[0] < 30f) - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; + if (Projectile.ai[0] < 30f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; } public override void Kill(int timeLeft) { for (int dustIndex = 0; dustIndex < 3; ++dustIndex) { - int redDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 182, 0f, 0f, 100, new Color(), 0.8f); + int redDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 182, 0f, 0f, 100, new Color(), 0.8f); Dust dust = Main.dust[redDust]; dust.noGravity = true; dust.velocity *= 1.2f; - dust.velocity -= projectile.oldVelocity * 0.3f; + dust.velocity -= Projectile.oldVelocity * 0.3f; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - if (target.lifeMax <= 5 || Main.player[projectile.owner].moonLeech) + if (target.lifeMax <= 5 || Main.player[Projectile.owner].moonLeech) return; - if (Main.player[projectile.owner].lifeSteal <= 0f) + if (Main.player[Projectile.owner].lifeSteal <= 0f) return; float healAmt = damage * Main.rand.NextFloat(0.075f, 0.9f); @@ -69,18 +69,18 @@ namespace CalamityMod.Projectiles.Melee healAmt = CalamityMod.lifeStealCap; if (Main.rand.NextBool(3)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); } public override void OnHitPvp(Player target, int damage, bool crit) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - if (Main.player[projectile.owner].moonLeech) + if (Main.player[Projectile.owner].moonLeech) return; - if (Main.player[projectile.owner].lifeSteal <= 0f) + if (Main.player[Projectile.owner].lifeSteal <= 0f) return; float healAmt = damage * Main.rand.NextFloat(0.075f, 0.9f); @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Melee healAmt = CalamityMod.lifeStealCap; if (Main.rand.NextBool(3)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); } } } diff --git a/Projectiles/Melee/MourningSkull.cs b/Projectiles/Melee/MourningSkull.cs index f8995eef3b..5f6bb21f92 100644 --- a/Projectiles/Melee/MourningSkull.cs +++ b/Projectiles/Melee/MourningSkull.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -12,65 +13,65 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Mourning Skull"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.extraUpdates = 2; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 2; } public override void AI() { - if (projectile.ai[0] < 0f) + if (Projectile.ai[0] < 0f) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 50; + Projectile.alpha -= 50; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } - if (projectile.ai[0] >= 0f && projectile.ai[0] < 200f) + if (Projectile.ai[0] >= 0f && Projectile.ai[0] < 200f) { - int num554 = (int)projectile.ai[0]; + int num554 = (int)Projectile.ai[0]; if (Main.npc[num554].active) { float num555 = 8f; - Vector2 vector44 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector44 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num556 = Main.npc[num554].position.X - vector44.X; float num557 = Main.npc[num554].position.Y - vector44.Y; float num558 = (float)Math.Sqrt((double)(num556 * num556 + num557 * num557)); num558 = num555 / num558; num556 *= num558; num557 *= num558; - projectile.velocity.X = (projectile.velocity.X * 14f + num556) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num557) / 15f; + Projectile.velocity.X = (Projectile.velocity.X * 14f + num556) / 15f; + Projectile.velocity.Y = (Projectile.velocity.Y * 14f + num557) / 15f; } else { @@ -78,45 +79,45 @@ namespace CalamityMod.Projectiles.Melee int num3; for (int num560 = 0; num560 < 200; num560 = num3 + 1) { - if (Main.npc[num560].CanBeChasedBy(projectile, false)) + if (Main.npc[num560].CanBeChasedBy(Projectile, false)) { float num561 = Main.npc[num560].position.X + (float)(Main.npc[num560].width / 2); float num562 = Main.npc[num560].position.Y + (float)(Main.npc[num560].height / 2); - float num563 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num561) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num562); - if (num563 < num559 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num560].position, Main.npc[num560].width, Main.npc[num560].height)) + float num563 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num561) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num562); + if (num563 < num559 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num560].position, Main.npc[num560].width, Main.npc[num560].height)) { num559 = num563; - projectile.ai[0] = (float)num560; + Projectile.ai[0] = (float)num560; } } num3 = num560; } } - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } int num564 = 8; - int num565 = Dust.NewDust(new Vector2(projectile.position.X + (float)num564, projectile.position.Y + (float)num564), projectile.width - num564 * 2, projectile.height - num564 * 2, Main.rand.NextBool(2) ? 5 : 6, 0f, 0f, 0, default, 1f); + int num565 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num564, Projectile.position.Y + (float)num564), Projectile.width - num564 * 2, Projectile.height - num564 * 2, Main.rand.NextBool(2) ? 5 : 6, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num565]; dust.velocity *= 0.5f; dust = Main.dust[num565]; - dust.velocity += projectile.velocity * 0.5f; + dust.velocity += Projectile.velocity * 0.5f; Main.dust[num565].noGravity = true; Main.dust[num565].noLight = true; Main.dust[num565].scale = 1.4f; return; } - projectile.Kill(); + Projectile.Kill(); } public override Color? GetAlpha(Color lightColor) @@ -126,16 +127,16 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -145,10 +146,10 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -156,13 +157,13 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.OnFire, 300); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int k = 0; k < 2; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.35), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.35), Projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Melee/MourningstarFlail.cs b/Projectiles/Melee/MourningstarFlail.cs index beb0772a82..437e9bfa99 100644 --- a/Projectiles/Melee/MourningstarFlail.cs +++ b/Projectiles/Melee/MourningstarFlail.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.extraUpdates = 1; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; + Projectile.extraUpdates = 1; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -31,13 +31,13 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(BuffID.Daybreak, 180); // Note: This is being left as the solar explosion projectile for now, since the weapon is in a good balancing position right now. // If it is to be rebalanced, consider replacing it with the FuckYou projectile (which does not mess with I-frames) - if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) + if (Projectile.localAI[1] <= 0f && Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ProjectileID.SolarWhipSwordExplosion, projectile.damage, knockback, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ProjectileID.SolarWhipSwordExplosion, Projectile.damage, knockback, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); Main.projectile[proj].usesLocalNPCImmunity = true; Main.projectile[proj].localNPCHitCooldown = 4; } - projectile.localAI[1] = 4f; + Projectile.localAI[1] = 4f; } } } diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 4b764cd802..f7af5ae20b 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -25,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee // A "slash" is only present during 2 specific frames (ones with a slash effect) right before they transition to the next frame. // Note: This bool is unused. Murasama formerly only dealt damage when on these frames, but it created a few issues with player usability. - public bool Slashing => CurrentFrame % 7 == 0 && projectile.frameCounter % 3 == 2; + public bool Slashing => CurrentFrame % 7 == 0 && Projectile.frameCounter % 3 == 2; public override void SetStaticDefaults() { @@ -34,39 +35,39 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 236; - projectile.height = 180; - projectile.scale = 2f; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ownerHitCheck = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 21; - projectile.frameCounter = 0; - projectile.Calamity().trueMelee = true; + Projectile.width = 236; + Projectile.height = 180; + Projectile.scale = 2f; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.ownerHitCheck = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 21; + Projectile.frameCounter = 0; + Projectile.Calamity().trueMelee = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.frameCounter <= 1) + if (Projectile.frameCounter <= 1) return false; - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; Vector2 origin = texture.Size() / new Vector2(2f, 7f) * 0.5f; Rectangle frame = texture.Frame(2, 7, frameX, frameY); - SpriteEffects spriteEffects = projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); return false; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; //Frames and crap - projectile.frameCounter++; - if (projectile.frameCounter % 3 == 0) + Projectile.frameCounter++; + if (Projectile.frameCounter % 3 == 0) { CurrentFrame++; if (frameX >= 2) @@ -76,47 +77,47 @@ namespace CalamityMod.Projectiles.Melee // Play a "droning" noise every so often. if (Slashing) { - Main.PlaySound(SoundID.Item15, projectile.Center); + SoundEngine.PlaySound(SoundID.Item15, Projectile.Center); } // Create idle light and dust. - Vector2 origin = projectile.Center + projectile.velocity * 3f; + Vector2 origin = Projectile.Center + Projectile.velocity * 3f; Lighting.AddLight(origin, 3f, 0.2f, 0.2f); if (Main.rand.NextBool(3)) { - int redDust = Dust.NewDust(origin - projectile.Size / 2f, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.velocity.X, projectile.velocity.Y, 100, default, 2f); + int redDust = Dust.NewDust(origin - Projectile.Size / 2f, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 2f); Main.dust[redDust].noGravity = true; - Main.dust[redDust].position -= projectile.velocity; + Main.dust[redDust].position -= Projectile.velocity; } Vector2 playerRotatedPoint = player.RotatedRelativePoint(player.MountedCenter, true); - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { if (player.channel && !player.noItems && !player.CCed) HandleChannelMovement(player, playerRotatedPoint); else - projectile.Kill(); + Projectile.Kill(); } // Rotation and directioning. - float velocityAngle = projectile.velocity.ToRotation(); - projectile.rotation = velocityAngle + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; - projectile.direction = (Math.Cos(velocityAngle) > 0).ToDirectionInt(); + float velocityAngle = Projectile.velocity.ToRotation(); + Projectile.rotation = velocityAngle + (Projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + Projectile.direction = (Math.Cos(velocityAngle) > 0).ToDirectionInt(); // Positioning close to the end of the player's arm. - float offset = 80f * projectile.scale; - projectile.position = playerRotatedPoint - projectile.Size * 0.5f + velocityAngle.ToRotationVector2() * offset; + float offset = 80f * Projectile.scale; + Projectile.position = playerRotatedPoint - Projectile.Size * 0.5f + velocityAngle.ToRotationVector2() * offset; // Sprite and player directioning. - projectile.spriteDirection = projectile.direction; - player.ChangeDir(projectile.direction); + Projectile.spriteDirection = Projectile.direction; + player.ChangeDir(Projectile.direction); // Prevents the projectile from dying - projectile.timeLeft = 2; + Projectile.timeLeft = 2; // Player item-based field manipulation. - player.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); - player.heldProj = projectile.whoAmI; + player.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; } @@ -124,18 +125,18 @@ namespace CalamityMod.Projectiles.Melee public void HandleChannelMovement(Player player, Vector2 playerRotatedPoint) { float speed = 1f; - if (player.ActiveItem().shoot == projectile.type) + if (player.ActiveItem().shoot == Projectile.type) { - speed = player.ActiveItem().shootSpeed * projectile.scale; + speed = player.ActiveItem().shootSpeed * Projectile.scale; } Vector2 newVelocity = (Main.MouseWorld - playerRotatedPoint).SafeNormalize(Vector2.UnitX * player.direction) * speed; // Sync if a velocity component changes. - if (projectile.velocity.X != newVelocity.X || projectile.velocity.Y != newVelocity.Y) + if (Projectile.velocity.X != newVelocity.X || Projectile.velocity.Y != newVelocity.Y) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity = newVelocity; + Projectile.velocity = newVelocity; } public override Color? GetAlpha(Color lightColor) => new Color(200, 0, 0, 0); diff --git a/Projectiles/Melee/Nebudust.cs b/Projectiles/Melee/Nebudust.cs index b7c0f710cd..881e7bc3d3 100644 --- a/Projectiles/Melee/Nebudust.cs +++ b/Projectiles/Melee/Nebudust.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -17,36 +18,36 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 6; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 6; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0f); float num461 = 25f; - if (projectile.ai[0] > 60f) + if (Projectile.ai[0] > 60f) { - num461 -= (projectile.ai[0] - 60f) / 2f; + num461 -= (Projectile.ai[0] - 60f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - Main.PlaySound(SoundID.Item105, projectile.position); + SoundEngine.PlaySound(SoundID.Item105, Projectile.position); } - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -57,10 +58,10 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 269, 0f, 0f, 100, default, 1f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 269, 0f, 0f, 100, default, 1f); Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; + Main.dust[num467].position.X = Projectile.Center.X; + Main.dust[num467].position.Y = Projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; diff --git a/Projectiles/Melee/NebulaShot.cs b/Projectiles/Melee/NebulaShot.cs index 051877112f..f5e7cbf656 100644 --- a/Projectiles/Melee/NebulaShot.cs +++ b/Projectiles/Melee/NebulaShot.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,39 +17,39 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.timeLeft = 600; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 5; + Projectile.timeLeft = 600; } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item12, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item12, Projectile.position); } - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 15; + Projectile.alpha -= 15; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); + Lighting.AddLight(Projectile.Center, 0.4f, 0.2f, 0.4f); for (int num121 = 0; num121 < 5; num121++) { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(3) ? 56 : 242, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + Dust dust4 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; dust4.velocity = Vector2.Zero; - dust4.position -= projectile.velocity / 5f * (float)num121; + dust4.position -= Projectile.velocity / 5f * (float)num121; dust4.noGravity = true; dust4.scale = 0.8f; dust4.noLight = true; diff --git a/Projectiles/Melee/NebulashFlail.cs b/Projectiles/Melee/NebulashFlail.cs index cb3a780e2d..d534aa0693 100644 --- a/Projectiles/Melee/NebulashFlail.cs +++ b/Projectiles/Melee/NebulashFlail.cs @@ -16,16 +16,16 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 3; } public override Color SpecialDrawColor => new Color(255, 200, 0); public override int ExudeDustType => ModContent.DustType(); @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee return true; } float num8 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity, 16f * Projectile.scale, ref num8)) { return true; } @@ -55,11 +55,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 240); - if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) + if (Projectile.localAI[1] <= 0f && Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage / 2, knockback, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage / 2, knockback, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); } - projectile.localAI[1] = 4f; + Projectile.localAI[1] = 4f; } } } diff --git a/Projectiles/Melee/NeptuneOrb.cs b/Projectiles/Melee/NeptuneOrb.cs index 49aa5e4d08..52291de9dd 100644 --- a/Projectiles/Melee/NeptuneOrb.cs +++ b/Projectiles/Melee/NeptuneOrb.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -19,52 +20,52 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.ignoreWater = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0f, 1f); - if (projectile.timeLeft % 20 == 19 && projectile.owner == Main.myPlayer) + Lighting.AddLight(Projectile.Center, 0f, 0f, 1f); + if (Projectile.timeLeft % 20 == 19 && Projectile.owner == Main.myPlayer) { - int splitDamage = projectile.damage / 2; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 15f, ModContent.ProjectileType(), splitDamage, projectile.knockBack, projectile.owner, 0f, 0f); + int splitDamage = Projectile.damage / 2; + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 15f, ModContent.ProjectileType(), splitDamage, Projectile.knockBack, Projectile.owner, 0f, 0f); } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 295) + if (Projectile.timeLeft > 295) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(50, 50, 255, projectile.alpha); + return new Color(50, 50, 255, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int dustIndex = 0; dustIndex <= 30; dustIndex++) { float num463 = (float)Main.rand.Next(-10, 11); @@ -74,21 +75,21 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; dust.velocity.Y = num464; } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/NightStabber.cs b/Projectiles/Melee/NightStabber.cs index 99b9dee17f..6167c1d571 100644 --- a/Projectiles/Melee/NightStabber.cs +++ b/Projectiles/Melee/NightStabber.cs @@ -14,39 +14,39 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 180; - projectile.melee = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Melee; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 2; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } } - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 7f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 7f, 20f); } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 14, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Melee/Oathblade.cs b/Projectiles/Melee/Oathblade.cs index e1b1968ca8..ee31854169 100644 --- a/Projectiles/Melee/Oathblade.cs +++ b/Projectiles/Melee/Oathblade.cs @@ -11,29 +11,29 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Oathblade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 58; - projectile.height = 58; - projectile.aiStyle = 18; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = true; - projectile.penetrate = 1; + Projectile.width = 58; + Projectile.height = 58; + Projectile.aiStyle = 18; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = true; + Projectile.penetrate = 1; aiType = ProjectileID.DemonScythe; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.35f); + Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0.35f); if (Main.rand.NextBool(3)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/OathswordFlame.cs b/Projectiles/Melee/OathswordFlame.cs index 329e0c292a..631b73982c 100644 --- a/Projectiles/Melee/OathswordFlame.cs +++ b/Projectiles/Melee/OathswordFlame.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,25 +15,25 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.timeLeft = 240; - projectile.Opacity = 0f; - projectile.melee = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.timeLeft = 240; + Projectile.Opacity = 0f; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.08f, 0f, 1f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 700f, 15f, 10f); + Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.08f, 0f, 1f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, false, 700f, 15f, 10f); } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha) * projectile.Opacity; + return new Color(200, 200, 200, Projectile.alpha) * Projectile.Opacity; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -42,11 +43,11 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 100); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 100); for (int k = 0; k < 10; k++) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 73, Projectile.oldVelocity.X * 2.5f, Projectile.oldVelocity.Y * 2.5f); } } } diff --git a/Projectiles/Melee/OceanBeam.cs b/Projectiles/Melee/OceanBeam.cs index c87195247d..9a850b850c 100644 --- a/Projectiles/Melee/OceanBeam.cs +++ b/Projectiles/Melee/OceanBeam.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -12,80 +13,80 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Spear"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - projectile.penetrate = 3; - projectile.timeLeft = 600; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.penetrate = 3; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 24) + Projectile.frameCounter++; + if (Projectile.frameCounter > 24) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 60f) - projectile.tileCollide = true; + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 60f) + Projectile.tileCollide = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); } return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.oldVelocity.X * 0.25f, projectile.oldVelocity.Y * 0.25f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 245, projectile.oldVelocity.X * 0.25f, projectile.oldVelocity.Y * 0.25f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.oldVelocity.X * 0.25f, Projectile.oldVelocity.Y * 0.25f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 245, Projectile.oldVelocity.X * 0.25f, Projectile.oldVelocity.Y * 0.25f); } } } diff --git a/Projectiles/Melee/OldLordOathswordProj.cs b/Projectiles/Melee/OldLordOathswordProj.cs index 6abb8d0763..3d0cac3fa7 100644 --- a/Projectiles/Melee/OldLordOathswordProj.cs +++ b/Projectiles/Melee/OldLordOathswordProj.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -23,12 +24,12 @@ namespace CalamityMod.Projectiles.Melee public int Direction = 1; public SwingState CurrentState; - public ref float ChargeTime => ref projectile.ai[0]; - public ref float GeneralTime => ref projectile.ai[1]; - public ref float PostSwingRepositionDelay => ref projectile.localAI[0]; + public ref float ChargeTime => ref Projectile.ai[0]; + public ref float GeneralTime => ref Projectile.ai[1]; + public ref float PostSwingRepositionDelay => ref Projectile.localAI[0]; public ref bool RMBChannel => ref (Owner.HeldItem.modItem as OldLordOathsword).RMBchannel; public bool LMBUse => Owner.altFunctionUse != 2 && !RMBChannel && Owner.itemAnimation > 0; - public ref float ChargePower => ref projectile.localAI[1]; + public ref float ChargePower => ref Projectile.localAI[1]; public const int MaxChargeTime = 60; public override string Texture => "CalamityMod/Items/Weapons/Melee/OldLordOathsword"; @@ -39,22 +40,22 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Old Lord Oathsword"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = projectile.height = 70; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 90000; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 12; - projectile.noEnchantments = true; - projectile.Calamity().trueMelee = true; + Projectile.width = Projectile.height = 70; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 90000; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; + Projectile.noEnchantments = true; + Projectile.Calamity().trueMelee = true; } public override void SendExtraAI(BinaryWriter writer) @@ -76,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee public override void SafeAI() { // Handle right click behaviors. - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) Owner.Calamity().rightClickListener = true; if (!Owner.Calamity().mouseRight) @@ -92,7 +93,7 @@ namespace CalamityMod.Projectiles.Melee DecideCurrentState(); // Glue the sword to its owner. - projectile.position = Owner.RotatedRelativePoint(Owner.MountedCenter, true) - projectile.Size / 2f + Vector2.UnitY * Owner.gfxOffY; + Projectile.position = Owner.RotatedRelativePoint(Owner.MountedCenter, true) - Projectile.Size / 2f + Vector2.UnitY * Owner.gfxOffY; // Use the direction of the owner when not spinning. if (CurrentState != SwingState.Spinning) @@ -133,8 +134,8 @@ namespace CalamityMod.Projectiles.Melee // Emit fire dust. for (int i = 0; i < 4; i++) { - Vector2 dustSpawnPosition = projectile.Center + (projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Main.rand.NextFloat(projectile.width) + Main.rand.NextVector2Circular(6f, 6f); - Vector2 dustVelocity = (projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Main.rand.NextFloat(6f) + Main.rand.NextVector2Circular(2.4f, 2.4f); + Vector2 dustSpawnPosition = Projectile.Center + (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Main.rand.NextFloat(Projectile.width) + Main.rand.NextVector2Circular(6f, 6f); + Vector2 dustVelocity = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Main.rand.NextFloat(6f) + Main.rand.NextVector2Circular(2.4f, 2.4f); Dust fire = Dust.NewDustPerfect(dustSpawnPosition, 6, dustVelocity); fire.scale = 1.7f; @@ -142,10 +143,10 @@ namespace CalamityMod.Projectiles.Melee } // Release flames. - if (Main.myPlayer == projectile.owner && GeneralTime % 6f == 5f) - Projectile.NewProjectile(projectile.Center, Main.rand.NextVector2CircularEdge(8f, 8f), ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner); + if (Main.myPlayer == Projectile.owner && GeneralTime % 6f == 5f) + Projectile.NewProjectile(Projectile.Center, Main.rand.NextVector2CircularEdge(8f, 8f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { Owner.velocity = Vector2.Lerp(Owner.velocity, Owner.SafeDirectionTo(Main.MouseWorld) * 23f, 0.125f); NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, Main.myPlayer); @@ -162,7 +163,7 @@ namespace CalamityMod.Projectiles.Melee // Hold the blade upwards if not firing. if (CurrentState == SwingState.Default) { - projectile.Opacity = 0f; + Projectile.Opacity = 0f; if (PostSwingRepositionDelay > 0f) PostSwingRepositionDelay--; @@ -170,14 +171,14 @@ namespace CalamityMod.Projectiles.Melee baseRotation = (MathHelper.PiOver2 + 0.36f) * -Direction; // Disable afterimages. - projectile.oldPos = new Vector2[projectile.oldPos.Length]; + Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; } else { PostSwingRepositionDelay = PostSwingRepositionDelay == -1f ? 0f : 12f; // See the Bladecrest Oathsword Projectile code. - projectile.Opacity = 1f; + Projectile.Opacity = 1f; } // Raise the blade and do charge effects upwards if channeling. @@ -194,7 +195,7 @@ namespace CalamityMod.Projectiles.Melee ChargePower = MathHelper.Clamp(ChargePower + 1f, 0f, MaxChargeTime); // Disable afterimages. - projectile.oldPos = new Vector2[projectile.oldPos.Length]; + Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; ChargeTime++; } @@ -209,7 +210,7 @@ namespace CalamityMod.Projectiles.Melee idealRotation += MathHelper.Pi; // Define rotation. - projectile.rotation = projectile.rotation.AngleTowards(idealRotation, swingSpeedInterpolant * 0.45f).AngleLerp(idealRotation, swingSpeedInterpolant * 0.2f); + Projectile.rotation = Projectile.rotation.AngleTowards(idealRotation, swingSpeedInterpolant * 0.45f).AngleLerp(idealRotation, swingSpeedInterpolant * 0.2f); // Decide how far out the blade should go. float bladeOffsetFactor = 0.5f + chargeInterpolant * 0.3f; @@ -217,10 +218,10 @@ namespace CalamityMod.Projectiles.Melee bladeOffsetFactor += Utils.InverseLerp(0.5f, 0.7f, swingCompletion, true) * Utils.InverseLerp(1f, 0.7f, swingCompletion, true) * 0.45f; // Offset the blade so that the handle is attached to the owner's hand. - Vector2 bladeOffset = (projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * projectile.width * bladeOffsetFactor; + Vector2 bladeOffset = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Projectile.width * bladeOffsetFactor; if (Owner.itemAnimation <= 0 || chargeInterpolant > 0f) bladeOffset += new Vector2(Direction * horizontalBladeOffset, 8f).RotatedBy(Owner.fullRotation) * (1f - PostSwingRepositionDelay / 12f); - projectile.position += bladeOffset; + Projectile.position += bladeOffset; // Create charge dust. if (CurrentState == SwingState.Channeling) @@ -231,7 +232,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < chargeDustCount; i++) { - Vector2 dustSpawnPosition = projectile.Center + (projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Main.rand.NextFloat(projectile.width) + Main.rand.NextVector2Circular(6f, 6f); + Vector2 dustSpawnPosition = Projectile.Center + (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Main.rand.NextFloat(Projectile.width) + Main.rand.NextVector2Circular(6f, 6f); Vector2 dustVelocity = bladeOffset.SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(6f) + Main.rand.NextVector2Circular(2.4f, 2.4f); Dust dust = Dust.NewDustPerfect(dustSpawnPosition, 267, dustVelocity); @@ -243,10 +244,10 @@ namespace CalamityMod.Projectiles.Melee // Create a burst of charge dust before becoming fully charged. if (ChargePower == MaxChargeTime - 1f) { - Main.PlaySound(SoundID.Item74, projectile.Center); + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); for (int i = 0; i < 30; i++) { - Vector2 dustSpawnPosition = projectile.Center; + Vector2 dustSpawnPosition = Projectile.Center; Vector2 dustVelocity = (MathHelper.TwoPi * i / 30f).ToRotationVector2() * 5f; Dust dust = Dust.NewDustPerfect(dustSpawnPosition, 267, dustVelocity); dust.color = Color.Violet; @@ -283,19 +284,19 @@ namespace CalamityMod.Projectiles.Melee if (CurrentState != SwingState.Spinning) { - Main.PlaySound(SoundID.DD2_BookStaffCast, Owner.Center); + SoundEngine.PlaySound(SoundID.DD2_BookStaffCast, Owner.Center); CurrentState = SwingState.Spinning; - projectile.netUpdate = true; + Projectile.netUpdate = true; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.Opacity <= 0f) + if (Projectile.Opacity <= 0f) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, 2, lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, 2, lightColor); spriteBatch.EnterShaderRegion(); GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(0.95f, 0.85f, 0.5f)); @@ -304,9 +305,9 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(0.7f - ((Main.GlobalTime * 30) % 30f / 60f)); GameShaders.Misc["CalamityMod:BasicTint"].Apply(); - var texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/OldLordOathsword"); + var texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/OldLordOathsword"); - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, projectile.Size / 2f, projectile.scale, projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, Projectile.Size / 2f, Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); spriteBatch.ExitShaderRegion(); return false; diff --git a/Projectiles/Melee/OmnibladeSwing.cs b/Projectiles/Melee/OmnibladeSwing.cs index e834f1099f..89b9fc0cf4 100644 --- a/Projectiles/Melee/OmnibladeSwing.cs +++ b/Projectiles/Melee/OmnibladeSwing.cs @@ -7,65 +7,65 @@ namespace CalamityMod.Projectiles.Melee { public class OmnibladeSwing : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { DisplayName.SetDefault("Omniblade"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 246; - projectile.height = 184; - projectile.scale = 1.15f; + Projectile.width = 246; + Projectile.height = 184; + Projectile.scale = 1.15f; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ownerHitCheck = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 3; - projectile.Calamity().trueMelee = true; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.ownerHitCheck = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 3; + Projectile.Calamity().trueMelee = true; } public override void AI() { - projectile.frameCounter++; - projectile.frame = projectile.frameCounter / 3; - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.Kill(); + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 3; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.Kill(); Vector2 playerRotatedPoint = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { if (Owner.channel && !Owner.noItems && !Owner.CCed) HandleChannelMovement(playerRotatedPoint); else - projectile.Kill(); + Projectile.Kill(); } // Rotation and directioning. - projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); // Sprite and player directioning. - projectile.spriteDirection = -projectile.direction; - if (projectile.direction == 1) - projectile.Left = Owner.Center; + Projectile.spriteDirection = -Projectile.direction; + if (Projectile.direction == 1) + Projectile.Left = Owner.Center; else - projectile.Right = Owner.Center; - projectile.position.X += projectile.spriteDirection == -1 ? -116f : 88f; - projectile.position.Y -= projectile.scale * 66f; - Owner.ChangeDir(projectile.direction); + Projectile.Right = Owner.Center; + Projectile.position.X += Projectile.spriteDirection == -1 ? -116f : 88f; + Projectile.position.Y -= Projectile.scale * 66f; + Owner.ChangeDir(Projectile.direction); // Prevents the projectile from dying - projectile.timeLeft = 2; + Projectile.timeLeft = 2; // Player item-based field manipulation. - Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); - Owner.heldProj = projectile.whoAmI; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; } @@ -75,10 +75,10 @@ namespace CalamityMod.Projectiles.Melee Vector2 newVelocity = Vector2.UnitX * (Main.MouseWorld.X > playerRotatedPoint.X).ToDirectionInt(); // Sync if a velocity component changes. - if (projectile.velocity.X != newVelocity.X || projectile.velocity.Y != newVelocity.Y) - projectile.netUpdate = true; + if (Projectile.velocity.X != newVelocity.X || Projectile.velocity.Y != newVelocity.Y) + Projectile.netUpdate = true; - projectile.velocity = newVelocity; + Projectile.velocity = newVelocity; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -94,6 +94,6 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 170); // Don't suffer from the same issues Murasama did in the past; encouraging people to kill their wrists for some extra DPS is bad lmao - public override bool CanDamage() => projectile.frameCounter > 6; + public override bool CanDamage() => Projectile.frameCounter > 6; } } diff --git a/Projectiles/Melee/Orbacle.cs b/Projectiles/Melee/Orbacle.cs index e65bbda83a..29e9b964ab 100644 --- a/Projectiles/Melee/Orbacle.cs +++ b/Projectiles/Melee/Orbacle.cs @@ -15,31 +15,31 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.timeLeft = Lifetime; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = Lifetime; - projectile.alpha = 80; + Projectile.alpha = 80; // Auric orbs never hit the same enemy more than once. - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { spriteBatch.SetBlendState(BlendState.Additive); - Texture2D texture = Main.projectileTexture[projectile.type]; - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() * 0.5f; Color color = new Color(83, 137, 230); // Auric Blue but slightly more blue. (#5389e6) - spriteBatch.Draw(texture, drawPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, drawPosition, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); spriteBatch.SetBlendState(BlendState.AlphaBlend); return false; } @@ -48,13 +48,13 @@ namespace CalamityMod.Projectiles.Melee // Produces golden dust while in flight int dustType = Main.rand.NextBool(3) ? 244 : 246; float scale = 0.8f + Main.rand.NextFloat(0.6f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); Main.dust[idx].noGravity = true; - Main.dust[idx].velocity = projectile.velocity / 3f; + Main.dust[idx].velocity = Projectile.velocity / 3f; Main.dust[idx].scale = scale; - projectile.alpha += 4; - projectile.velocity *= 0.88f; + Projectile.alpha += 4; + Projectile.velocity *= 0.88f; } } } diff --git a/Projectiles/Melee/PhosphorescentGauntletPunches.cs b/Projectiles/Melee/PhosphorescentGauntletPunches.cs index 6662efab02..13a4a23967 100644 --- a/Projectiles/Melee/PhosphorescentGauntletPunches.cs +++ b/Projectiles/Melee/PhosphorescentGauntletPunches.cs @@ -10,43 +10,43 @@ namespace CalamityMod.Projectiles.Melee { public class PhosphorescentGauntletPunches : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public bool HasPerformedLunge { - get => projectile.ai[0] == 1f; + get => Projectile.ai[0] == 1f; set { int newValue = value.ToInt(); - if (projectile.ai[0] != newValue) + if (Projectile.ai[0] != newValue) { - projectile.ai[0] = newValue; - projectile.netUpdate = true; + Projectile.ai[0] = newValue; + Projectile.netUpdate = true; } } } - public ref float Time => ref projectile.ai[1]; + public ref float Time => ref Projectile.ai[1]; public const float LungeSpeed = 19f; public override void SetStaticDefaults() { DisplayName.SetDefault("Punch"); - Main.projFrames[projectile.type] = 14; + Main.projFrames[Projectile.type] = 14; } public override void SetDefaults() { - projectile.scale = 1.6f; - projectile.width = projectile.height = (int)(projectile.scale * 60); - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ownerHitCheck = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 12; - projectile.frameCounter = 0; - projectile.Calamity().trueMelee = true; + Projectile.scale = 1.6f; + Projectile.width = Projectile.height = (int)(Projectile.scale * 60); + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.ownerHitCheck = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; + Projectile.frameCounter = 0; + Projectile.Calamity().trueMelee = true; } #region AI @@ -55,8 +55,8 @@ namespace CalamityMod.Projectiles.Melee if (!HasPerformedLunge) PerformLunge(); - Vector2 topLeft = projectile.Center + projectile.velocity.RotatedBy(-MathHelper.PiOver2) * 40f; - Vector2 topRight = projectile.Center + projectile.velocity.RotatedBy(MathHelper.PiOver2) * 40f; + Vector2 topLeft = Projectile.Center + Projectile.velocity.RotatedBy(-MathHelper.PiOver2) * 40f; + Vector2 topRight = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2) * 40f; if (Time >= 8f && !Collision.CanHitLine(topLeft, 8, 8, topRight, 8, 8)) ReelBack(); HandleProjectileVisuals(); @@ -66,9 +66,9 @@ namespace CalamityMod.Projectiles.Melee internal void PerformLunge() { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - Owner.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction) * LungeSpeed; + Owner.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction) * LungeSpeed; HasPerformedLunge = true; } @@ -79,26 +79,26 @@ namespace CalamityMod.Projectiles.Melee // Create some visual effects. if (!Main.dedServ) { - Vector2 topLeft = projectile.Center + projectile.velocity.RotatedBy(-MathHelper.PiOver2) * 40f; - Vector2 top = projectile.Center + projectile.velocity * 70f; - Vector2 topRight = projectile.Center + projectile.velocity.RotatedBy(MathHelper.PiOver2) * 40f; + Vector2 topLeft = Projectile.Center + Projectile.velocity.RotatedBy(-MathHelper.PiOver2) * 40f; + Vector2 top = Projectile.Center + Projectile.velocity * 70f; + Vector2 topRight = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2) * 40f; foreach (Vector2 spawnPosition in new BezierCurve(topLeft, top, topRight).GetPoints(50)) { - Dust sulphurousAcid = Dust.NewDustPerfect(spawnPosition + projectile.velocity * 16f, (int)CalamityDusts.SulfurousSeaAcid); - sulphurousAcid.velocity = projectile.velocity * 4f; + Dust sulphurousAcid = Dust.NewDustPerfect(spawnPosition + Projectile.velocity * 16f, (int)CalamityDusts.SulfurousSeaAcid); + sulphurousAcid.velocity = Projectile.velocity * 4f; sulphurousAcid.noGravity = true; sulphurousAcid.scale = 1.2f; } } - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; // Reel back after collision. - Owner.velocity = Vector2.Reflect(Owner.velocity.SafeNormalize(Vector2.Zero), projectile.velocity.SafeNormalize(Vector2.Zero)) * Owner.velocity.Length(); + Owner.velocity = Vector2.Reflect(Owner.velocity.SafeNormalize(Vector2.Zero), Projectile.velocity.SafeNormalize(Vector2.Zero)) * Owner.velocity.Length(); // Create on-hit tile dust. - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width + 16, projectile.height + 16); - projectile.Kill(); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width + 16, Projectile.height + 16); + Projectile.Kill(); } internal static void GenerateDustOnOwnerHand(Player player) @@ -132,23 +132,23 @@ namespace CalamityMod.Projectiles.Melee internal void HandleProjectileVisuals() { - float velocityAngle = projectile.velocity.ToRotation(); - projectile.rotation = velocityAngle + MathHelper.Pi; - projectile.frameCounter++; - if (projectile.frameCounter % 3 == 2) + float velocityAngle = Projectile.velocity.ToRotation(); + Projectile.rotation = velocityAngle + MathHelper.Pi; + Projectile.frameCounter++; + if (Projectile.frameCounter % 3 == 2) { - projectile.frame++; + Projectile.frame++; // Die at the end of the final punch. - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.Kill(); + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.Kill(); } } internal void HandlePositioning() { - projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter); - projectile.Center += projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction) * 30f; + Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter); + Projectile.Center += Projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction) * 30f; } #endregion @@ -157,11 +157,11 @@ namespace CalamityMod.Projectiles.Melee // Manual drawing is used to correct the origin of the projectile when drawn. public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D punchTexture = ModContent.GetTexture(Texture); - Rectangle frame = punchTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Texture2D punchTexture = ModContent.Request(Texture); + Rectangle frame = punchTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; - SpriteEffects directionEffect = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - spriteBatch.Draw(punchTexture, projectile.Center - Main.screenPosition, frame, lightColor, projectile.rotation, origin, projectile.scale, directionEffect, 0f); + SpriteEffects directionEffect = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + spriteBatch.Draw(punchTexture, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, origin, Projectile.scale, directionEffect, 0f); return false; } #endregion diff --git a/Projectiles/Melee/PhotonRipperProjectile.cs b/Projectiles/Melee/PhotonRipperProjectile.cs index 3951e0ea04..3055fc12fd 100644 --- a/Projectiles/Melee/PhotonRipperProjectile.cs +++ b/Projectiles/Melee/PhotonRipperProjectile.cs @@ -4,22 +4,23 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class PhotonRipperProjectile : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public const float ZeroChargeDamageRatio = 0.36f; public const float ToothDamageRatio = 0.1666667f; public const int ToothShootRate = 5; // One chainsaw tooth is emitted every this many frames. public const int ChargeUpTime = 150; - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; // This is the damage dealt by the chainsaw teeth. It is recalculated every frame in two steps: // 1) The chainsaw's damage itself is calculated as a long-lasting holdout (like Last Prism -- in case buffs wear off or similar) // 2) The chainsaw teeth damage scales with charging up. The chainsaw's own damage does not. - public ref float ToothDamage => ref projectile.ai[1]; + public ref float ToothDamage => ref Projectile.ai[1]; public float ChargeUpPower => MathHelper.Clamp((float)Math.Pow(Time / ChargeUpTime, 1.6D), 0f, 1f); // Seriously though Draedon this seems a bit over the top lmfao. @@ -27,29 +28,29 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 132; - projectile.height = 56; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ownerHitCheck = true; + Projectile.width = 132; + Projectile.height = 56; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.ownerHitCheck = true; // No reason to ID-static the chainsaw -- multiple players can true melee simultaneously! - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Texture2D glowmaskTexture = ModContent.GetTexture("CalamityMod/Projectiles/Melee/PhotonRipperGlowmask"); - Rectangle glowmaskRectangle = glowmaskTexture.Frame(1, 6, 0, projectile.frame); + Texture2D texture = Main.projectileTexture[Projectile.type]; + Texture2D glowmaskTexture = ModContent.Request("CalamityMod/Projectiles/Melee/PhotonRipperGlowmask"); + Rectangle glowmaskRectangle = glowmaskTexture.Frame(1, 6, 0, Projectile.frame); Vector2 origin = texture.Size() * 0.5f; - Vector2 drawPosition = projectile.Center - Main.screenPosition; - SpriteEffects direction = projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, drawPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, direction, 0f); - spriteBatch.Draw(glowmaskTexture, drawPosition, glowmaskRectangle, Color.White, projectile.rotation, origin, projectile.scale, direction, 0f); + spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0f); + spriteBatch.Draw(glowmaskTexture, drawPosition, glowmaskRectangle, Color.White, Projectile.rotation, origin, Projectile.scale, direction, 0f); return false; } @@ -57,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee { // Recalculate damage every frame for balance reasons, as this is a long-lasting holdout. // This is important because you could start using it while benefitting from Auric Tesla standstill bonus, for example. - projectile.damage = (int)((Owner.ActiveItem()?.damage ?? 0) * Owner.MeleeDamage()); + Projectile.damage = (int)((Owner.ActiveItem()?.damage ?? 0) * Owner.MeleeDamage()); DetermineDamage(); PlayChainsawSounds(); @@ -66,12 +67,12 @@ namespace CalamityMod.Projectiles.Melee // It uses vector transformation on a Z rotation matrix based on said rotation under the hood. // This is essentially just the pure mathematical definition of the RotatedBy method. Vector2 playerRotatedPosition = Owner.RotatedRelativePoint(Owner.MountedCenter); - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { if (Owner.channel && !Owner.noItems && !Owner.CCed) HandleChannelMovement(playerRotatedPosition); else - projectile.Kill(); + Projectile.Kill(); } DetermineVisuals(playerRotatedPosition); @@ -83,27 +84,27 @@ namespace CalamityMod.Projectiles.Melee // Prevent the projectile from dying normally. However, if anything for whatever reason // goes wrong it will immediately be destroyed on the next frame. - projectile.timeLeft = 2; + Projectile.timeLeft = 2; Time++; } public void PlayChainsawSounds() { - if (projectile.soundDelay <= 0) + if (Projectile.soundDelay <= 0) { - Main.PlaySound(SoundID.Item22, projectile.Center); - projectile.soundDelay = (int)MathHelper.Lerp(30f, 12f, ChargeUpPower); + SoundEngine.PlaySound(SoundID.Item22, Projectile.Center); + Projectile.soundDelay = (int)MathHelper.Lerp(30f, 12f, ChargeUpPower); } } public void DetermineDamage() { // Set the initial tooth damage the instant the projectile is created. - if (Main.myPlayer == projectile.owner && ToothDamage == 0f) + if (Main.myPlayer == Projectile.owner && ToothDamage == 0f) { - ToothDamage = ToothDamageRatio * projectile.damage; - projectile.netUpdate = true; + ToothDamage = ToothDamageRatio * Projectile.damage; + Projectile.netUpdate = true; } // And then do time based damage calculations. This does not execute if the original damage is 0. @@ -112,42 +113,42 @@ namespace CalamityMod.Projectiles.Melee { float fullMult = ToothDamageRatio; float zeroMult = ZeroChargeDamageRatio * ToothDamageRatio; - ToothDamage = (int)MathHelper.SmoothStep(projectile.damage * zeroMult, projectile.damage * fullMult, ChargeUpPower); + ToothDamage = (int)MathHelper.SmoothStep(Projectile.damage * zeroMult, Projectile.damage * fullMult, ChargeUpPower); } } public void DetermineVisuals(Vector2 playerRotatedPosition) { - float directionAngle = projectile.velocity.ToRotation(); - projectile.rotation = directionAngle; + float directionAngle = Projectile.velocity.ToRotation(); + Projectile.rotation = directionAngle; - int oldDirection = projectile.spriteDirection; + int oldDirection = Projectile.spriteDirection; if (oldDirection == -1) - projectile.rotation += MathHelper.Pi; + Projectile.rotation += MathHelper.Pi; - projectile.direction = projectile.spriteDirection = (Math.Cos(directionAngle) > 0).ToDirectionInt(); + Projectile.direction = Projectile.spriteDirection = (Math.Cos(directionAngle) > 0).ToDirectionInt(); // If the direction differs from what it originaly was, undo the previous 180 degree turn. // If this is not done, the chainsaw will have 1 frame of rotational "jitter" when the direction changes based on the // original angle. This effect looks very strange in-game. - if (projectile.spriteDirection != oldDirection) - projectile.rotation -= MathHelper.Pi; + if (Projectile.spriteDirection != oldDirection) + Projectile.rotation -= MathHelper.Pi; // Positioning close to the player's arm. - projectile.position = playerRotatedPosition - projectile.Size * 0.5f + directionAngle.ToRotationVector2() * 30f; + Projectile.position = playerRotatedPosition - Projectile.Size * 0.5f + directionAngle.ToRotationVector2() * 30f; // Update the position a tiny bit every frame at random to make it look like the saw is vibrating. // It is reset on the next frame. - projectile.position += Main.rand.NextVector2Circular(1.4f, 1.4f); + Projectile.position += Main.rand.NextVector2Circular(1.4f, 1.4f); // Update glowmask frames. // Smoothstep is essentially like a linear interpolation but instead of being a straight line its // curve is pseudo-logistic, with low increases at the ends of the curve. - projectile.frameCounter += (int)MathHelper.SmoothStep(12f, 33f, ChargeUpPower); - if (projectile.frameCounter >= 32) + Projectile.frameCounter += (int)MathHelper.SmoothStep(12f, 33f, ChargeUpPower); + if (Projectile.frameCounter >= 32) { - projectile.frame = (projectile.frame + 1) % 6; - projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % 6; + Projectile.frameCounter = 0; } } @@ -156,26 +157,26 @@ namespace CalamityMod.Projectiles.Melee Vector2 idealAimDirection = (Main.MouseWorld - playerRotatedPosition).SafeNormalize(Vector2.UnitX * Owner.direction); float angularAimVelocity = 0.15f; - float directionAngularDisparity = projectile.velocity.AngleBetween(idealAimDirection) / MathHelper.Pi; + float directionAngularDisparity = Projectile.velocity.AngleBetween(idealAimDirection) / MathHelper.Pi; // Increase the turn speed if close to the ideal direction, since successive linear interpolations // are asymptotic. angularAimVelocity += MathHelper.Lerp(0f, 0.25f, Utils.InverseLerp(0.28f, 0.08f, directionAngularDisparity, true)); if (directionAngularDisparity > 0.02f) - projectile.velocity = Vector2.Lerp(projectile.velocity, idealAimDirection, angularAimVelocity); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealAimDirection, angularAimVelocity); else - projectile.velocity = idealAimDirection; + Projectile.velocity = idealAimDirection; - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction); } public void ManipulatePlayerValues() { - Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.ChangeDir(projectile.direction); + Owner.ChangeDir(Projectile.direction); } public void EmitPrettyDust() @@ -185,14 +186,14 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { - Vector2 spawnPosition = projectile.Center + projectile.velocity * 35f; + Vector2 spawnPosition = Projectile.Center + Projectile.velocity * 35f; // Spawn the dust a little bit on the chainsaw. X variance is less than Y variance to ensure that dust does not // spawn too far from the blade. - spawnPosition += Main.rand.NextVector2CircularEdge(9f, 35f).RotatedBy(projectile.velocity.ToRotation() + MathHelper.PiOver2); + spawnPosition += Main.rand.NextVector2CircularEdge(9f, 35f).RotatedBy(Projectile.velocity.ToRotation() + MathHelper.PiOver2); Dust rainbowSpark = Dust.NewDustPerfect(spawnPosition, 261); - rainbowSpark.velocity = projectile.velocity * 3f + Main.rand.NextVector2CircularEdge(1.5f, 1.5f); + rainbowSpark.velocity = Projectile.velocity * 3f + Main.rand.NextVector2CircularEdge(1.5f, 1.5f); rainbowSpark.noGravity = true; rainbowSpark.color = Main.hslToRgb((Time / 40f + Main.rand.NextFloat(-0.1f, 0.1f)) % 1f, 0.95f, 0.6f); rainbowSpark.scale = Main.rand.NextFloat(0.9f, 1.25f); @@ -203,12 +204,12 @@ namespace CalamityMod.Projectiles.Melee { // Play the sound that the crystal vile shard uses. // Hopefully this isn't too cancerous to listen to, given the shoot rate of the crystals. - Main.PlaySound(SoundID.Item101, projectile.Center); + SoundEngine.PlaySound(SoundID.Item101, Projectile.Center); - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - float shootReach = MathHelper.SmoothStep(projectile.width * 1.8f, projectile.width * 5.3f + 16f, ChargeUpPower); + float shootReach = MathHelper.SmoothStep(Projectile.width * 1.8f, Projectile.width * 5.3f + 16f, ChargeUpPower); // Incorporate item shoot speed into the range of the crystals. // This means that projectile speed boosts will improve the range of the chainsaw. @@ -222,7 +223,7 @@ namespace CalamityMod.Projectiles.Melee if (distanceFromMouse < shootReach && distanceFromMouse > 40f) shootReach = distanceFromMouse + 32f; - Projectile.NewProjectile(Owner.Center, projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, projectile.owner, shootReach, projectile.whoAmI); + Projectile.NewProjectile(Owner.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -230,9 +231,9 @@ namespace CalamityMod.Projectiles.Melee // Collision is done as a line to bypass the fact that hitboxes cannot rotate and that // this projectile is notably flat in terms of sprite shape. float _ = 0f; - float width = projectile.scale * 36f; - Vector2 start = projectile.Center; - Vector2 end = projectile.Center + projectile.velocity * 70f; + float width = Projectile.scale * 36f; + Vector2 start = Projectile.Center; + Vector2 end = Projectile.Center + Projectile.velocity * 70f; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, width, ref _); } } diff --git a/Projectiles/Melee/PlagueBeeDust.cs b/Projectiles/Melee/PlagueBeeDust.cs index 541c6a0d58..f9bb102cf0 100644 --- a/Projectiles/Melee/PlagueBeeDust.cs +++ b/Projectiles/Melee/PlagueBeeDust.cs @@ -14,53 +14,53 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Dust"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 70; - projectile.height = 70; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 150; - projectile.alpha = 100; + Projectile.width = 70; + Projectile.height = 70; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 150; + Projectile.alpha = 100; } public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.ai[1]++; - Lighting.AddLight(projectile.Center, 0.05f, 0.4f, 0f); - if (projectile.ai[1] < 60f) + Player player = Main.player[Projectile.owner]; + Projectile.ai[1]++; + Lighting.AddLight(Projectile.Center, 0.05f, 0.4f, 0f); + if (Projectile.ai[1] < 60f) { - if (projectile.ai[0] > 7f) + if (Projectile.ai[0] > 7f) { float scalar = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { scalar = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { scalar = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { scalar = 0.75f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] % 2f == 0f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] % 2f == 0f) { - int spawnX = (int)(projectile.width / 2); - int spawnY = (int)(projectile.width / 2); - int bee = Projectile.NewProjectile(projectile.Center.X + (float)Main.rand.Next(-spawnX, spawnX), projectile.Center.Y + (float)Main.rand.Next(-spawnY, spawnY), projectile.velocity.X, projectile.velocity.Y, player.beeType(), player.beeDamage(projectile.damage / 3), player.beeKB(0f), projectile.owner); + int spawnX = (int)(Projectile.width / 2); + int spawnY = (int)(Projectile.width / 2); + int bee = Projectile.NewProjectile(Projectile.Center.X + (float)Main.rand.Next(-spawnX, spawnX), Projectile.Center.Y + (float)Main.rand.Next(-spawnY, spawnY), Projectile.velocity.X, Projectile.velocity.Y, player.beeType(), player.beeDamage(Projectile.damage / 3), player.beeKB(0f), Projectile.owner); if (bee.WithinBounds(Main.maxProjectiles)) { Main.projectile[bee].Calamity().forceMelee = true; @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee } //Dust int dustType = 89; - int plague = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int plague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[plague]; if (Main.rand.NextBool(3)) { @@ -88,46 +88,46 @@ namespace CalamityMod.Projectiles.Melee } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } } else { - projectile.damage = (int)(projectile.damage * 0.6); - projectile.velocity *= 0.85f; + Projectile.damage = (int)(Projectile.damage * 0.6); + Projectile.velocity *= 0.85f; //Fade out - if (projectile.alpha < 255) - projectile.alpha += 5; - if (projectile.alpha >= 255) - projectile.Kill(); + if (Projectile.alpha < 255) + Projectile.alpha += 5; + if (Projectile.alpha >= 255) + Projectile.Kill(); } //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; + target.immune[Projectile.owner] = 8; target.AddBuff(ModContent.BuffType(), 180); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/PlagueDust.cs b/Projectiles/Melee/PlagueDust.cs index 8ebbaa6664..04e64f9909 100644 --- a/Projectiles/Melee/PlagueDust.cs +++ b/Projectiles/Melee/PlagueDust.cs @@ -11,50 +11,50 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Dust"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 70; - projectile.height = 70; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 150; - projectile.alpha = 100; + Projectile.width = 70; + Projectile.height = 70; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 150; + Projectile.alpha = 100; } public override void AI() { - projectile.ai[1]++; - Lighting.AddLight(projectile.Center, 0.05f, 0.4f, 0f); - if (projectile.ai[1] < 60) + Projectile.ai[1]++; + Lighting.AddLight(Projectile.Center, 0.05f, 0.4f, 0f); + if (Projectile.ai[1] < 60) { - if (projectile.ai[0] > 7f) + if (Projectile.ai[0] > 7f) { float scalar = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { scalar = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { scalar = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { scalar = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; //Dust int dustType = 89; - int plague = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int plague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[plague]; if (Main.rand.NextBool(3)) { @@ -73,45 +73,45 @@ namespace CalamityMod.Projectiles.Melee } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } } else { - projectile.damage = (int)(projectile.damage * 0.6); - projectile.velocity *= 0.85f; + Projectile.damage = (int)(Projectile.damage * 0.6); + Projectile.velocity *= 0.85f; //Fade out - if (projectile.alpha < 255) - projectile.alpha += 5; - if (projectile.alpha >= 255) - projectile.Kill(); + if (Projectile.alpha < 255) + Projectile.alpha += 5; + if (Projectile.alpha >= 255) + Projectile.Kill(); } //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; target.AddBuff(ModContent.BuffType(), 120); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/PlagueSeeker.cs b/Projectiles/Melee/PlagueSeeker.cs index fb7f6ff7f8..2f7b039002 100644 --- a/Projectiles/Melee/PlagueSeeker.cs +++ b/Projectiles/Melee/PlagueSeeker.cs @@ -15,20 +15,20 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.melee = true; - projectile.timeLeft = 180; - projectile.extraUpdates = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 180; + Projectile.extraUpdates = 1; } // Reduce damage of projectiles if more than the cap are active public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - int projectileCount = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + int projectileCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type]; int cap = 3; int oldDamage = damage; if (projectileCount > cap) @@ -39,23 +39,23 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 3; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 0.75f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 0.75f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } } - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/PrismRay.cs b/Projectiles/Melee/PrismRay.cs index 75eb6339d0..80a27637bc 100644 --- a/Projectiles/Melee/PrismRay.cs +++ b/Projectiles/Melee/PrismRay.cs @@ -11,60 +11,60 @@ namespace CalamityMod.Projectiles.Melee public Vector2 StartingPosition; public Color RayColor => CalamityUtils.MulticolorLerp(RayHue, CalamityUtils.ExoPalette); public Color HueDownscaledRayColor => RayColor * 0.66f; - public ref float RayHue => ref projectile.ai[0]; - public ref float Time => ref projectile.localAI[1]; + public ref float RayHue => ref Projectile.ai[0]; + public ref float Time => ref Projectile.localAI[1]; public const int Lifetime = 30; public override string Texture => "CalamityMod/Projectiles/StarProj"; public override void SetStaticDefaults() { DisplayName.SetDefault("Prismatic Light"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 14; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 900; - projectile.friendly = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.melee = true; + Projectile.width = Projectile.height = 14; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 900; + Projectile.friendly = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { DelegateMethods.v3_1 = RayColor.ToVector3() * 0.5f; - Utils.PlotTileLine(StartingPosition, projectile.Center, 8f, DelegateMethods.CastLight); - if (projectile.localAI[0] == 0f) + Utils.PlotTileLine(StartingPosition, Projectile.Center, 8f, DelegateMethods.CastLight); + if (Projectile.localAI[0] == 0f) { - projectile.direction = Main.rand.NextBool(2).ToDirectionInt(); - projectile.localAI[0] = 1f; + Projectile.direction = Main.rand.NextBool(2).ToDirectionInt(); + Projectile.localAI[0] = 1f; } - projectile.rotation = Time / 20f * MathHelper.TwoPi * projectile.direction; - projectile.alpha = Utils.Clamp(projectile.alpha - 18, 0, 255); - if (projectile.alpha == 0) - Lighting.AddLight(projectile.Center, RayColor.ToVector3() * 0.5f); + Projectile.rotation = Time / 20f * MathHelper.TwoPi * Projectile.direction; + Projectile.alpha = Utils.Clamp(Projectile.alpha - 18, 0, 255); + if (Projectile.alpha == 0) + Lighting.AddLight(Projectile.Center, RayColor.ToVector3() * 0.5f); for (int i = 0; i < 2; i++) { if (Main.rand.NextBool(10)) { - Dust verticalMagic = Dust.NewDustDirect(projectile.Center, 0, 0, 267, 0f, 0f, 225, RayColor, 1.5f); + Dust verticalMagic = Dust.NewDustDirect(Projectile.Center, 0, 0, 267, 0f, 0f, 225, RayColor, 1.5f); verticalMagic.noGravity = true; verticalMagic.noLight = true; - verticalMagic.scale = projectile.Opacity; - verticalMagic.position = projectile.Center; - verticalMagic.velocity = Vector2.UnitY.RotatedBy(projectile.rotation + MathHelper.TwoPi * i / 2f) * 2.5f; + verticalMagic.scale = Projectile.Opacity; + verticalMagic.position = Projectile.Center; + verticalMagic.velocity = Vector2.UnitY.RotatedBy(Projectile.rotation + MathHelper.TwoPi * i / 2f) * 2.5f; } } if (Main.rand.NextBool(10)) { - Vector2 dustSpawnPosition = projectile.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(20f, 120f); + Vector2 dustSpawnPosition = Projectile.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(20f, 120f); Point dustTileCoords = dustSpawnPosition.ToTileCoordinates(); bool canSpawnDust = true; if (!WorldGen.InWorld(dustTileCoords.X, dustTileCoords.Y, 0)) @@ -89,41 +89,41 @@ namespace CalamityMod.Projectiles.Melee risingMagic.color = new Color(255, 255, 255, 255); } } - projectile.scale = projectile.Opacity * 0.5f; - projectile.velocity = Vector2.Zero; + Projectile.scale = Projectile.Opacity * 0.5f; + Projectile.velocity = Vector2.Zero; Time++; if (Time >= Lifetime) - projectile.Kill(); + Projectile.Kill(); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float _ = 0f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), StartingPosition, projectile.Center, projectile.scale * 22f, ref _); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), StartingPosition, Projectile.Center, Projectile.scale * 22f, ref _); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 baseDrawPosition = projectile.Center + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture = Main.projectileTexture[projectile.type]; - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Vector2 baseDrawPosition = Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 origin = frame.Size() / 2f; - Color fadedRayColor = projectile.GetAlpha(lightColor); + Color fadedRayColor = Projectile.GetAlpha(lightColor); Color fullbrightRayColor = HueDownscaledRayColor.MultiplyRGBA(new Color(255, 255, 255, 0)); // Draw the stars at the end of the laser. for (int i = 0; i < 6; i++) { - Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 6f + Main.GlobalTime * 3f).ToRotationVector2() * projectile.scale * 4f; - spriteBatch.Draw(texture, drawPosition, frame, fullbrightRayColor, projectile.rotation, origin, projectile.scale * 2f, SpriteEffects.None, 0f); - spriteBatch.Draw(texture, drawPosition, frame, fullbrightRayColor, 0f, origin, projectile.scale * 2f, SpriteEffects.None, 0f); + Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 6f + Main.GlobalTime * 3f).ToRotationVector2() * Projectile.scale * 4f; + spriteBatch.Draw(texture, drawPosition, frame, fullbrightRayColor, Projectile.rotation, origin, Projectile.scale * 2f, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, drawPosition, frame, fullbrightRayColor, 0f, origin, Projectile.scale * 2f, SpriteEffects.None, 0f); } // Draw the shimmering ray itself. - if (projectile.Opacity > 0.3f) + if (Projectile.Opacity > 0.3f) { - Vector2 drawOffset = (StartingPosition - projectile.Center) * 0.5f; + Vector2 drawOffset = (StartingPosition - Projectile.Center) * 0.5f; Vector2 scale = new Vector2(1f, drawOffset.Length() * 2f / texture.Height); float rotation = drawOffset.ToRotation() + MathHelper.PiOver2; @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { Vector2 drawPosition = baseDrawPosition; - drawPosition += (MathHelper.TwoPi * i / 3f + Main.GlobalTime * 3f).ToRotationVector2() * projectile.scale * 2.5f; + drawPosition += (MathHelper.TwoPi * i / 3f + Main.GlobalTime * 3f).ToRotationVector2() * Projectile.scale * 2.5f; drawPosition += drawOffset; spriteBatch.Draw(texture, drawPosition, frame, fullbrightRayColor * drawFade * 0.8f, rotation, origin, scale, SpriteEffects.None, 0f); @@ -148,19 +148,19 @@ namespace CalamityMod.Projectiles.Melee CreateKillExplosionBurstDust(Main.rand.Next(7, 13)); // Adjust values and do damage before dying. - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - Vector2 oldSize = projectile.Size; - projectile.position = projectile.Center; - projectile.width = projectile.height = 60; - projectile.Center = projectile.position; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - projectile.position = projectile.Center; - projectile.Size = oldSize; - projectile.Center = projectile.position; + Vector2 oldSize = Projectile.Size; + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 60; + Projectile.Center = Projectile.position; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.Size = oldSize; + Projectile.Center = Projectile.position; } public void CreateKillExplosionBurstDust(int dustCount) @@ -175,8 +175,8 @@ namespace CalamityMod.Projectiles.Melee for (float i = 0f; i < dustCount; i++) { - Dust explosionDust = Dust.NewDustDirect(projectile.Center, 0, 0, 267, 0f, 0f, 0, brightenedRayColor, 1f); - explosionDust.position = projectile.Center; + Dust explosionDust = Dust.NewDustDirect(Projectile.Center, 0, 0, 267, 0f, 0f, 0, brightenedRayColor, 1f); + explosionDust.position = Projectile.Center; explosionDust.velocity = baseExplosionDirection.RotatedBy(MathHelper.TwoPi * i / dustCount) * outwardFireSpeedFactor * Main.rand.NextFloat(0.8f, 1.2f); explosionDust.noGravity = true; explosionDust.scale = 1.1f; @@ -189,8 +189,8 @@ namespace CalamityMod.Projectiles.Melee } for (float i = 0f; i < dustCount; i++) { - Dust explosionDust = Dust.NewDustDirect(projectile.Center, 0, 0, 267, 0f, 0f, 0, brightenedRayColor, 1f); - explosionDust.position = projectile.Center; + Dust explosionDust = Dust.NewDustDirect(Projectile.Center, 0, 0, 267, 0f, 0f, 0, brightenedRayColor, 1f); + explosionDust.position = Projectile.Center; explosionDust.velocity = baseExplosionDirection.RotatedBy(MathHelper.TwoPi * i / dustCount) * outwardFireSpeedFactor * Main.rand.NextFloat(0.8f, 1.2f); explosionDust.velocity *= Main.rand.NextFloat() * 0.8f; explosionDust.noGravity = true; @@ -204,6 +204,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override Color? GetAlpha(Color lightColor) => new Color(projectile.Opacity, projectile.Opacity, projectile.Opacity, 0); + public override Color? GetAlpha(Color lightColor) => new Color(Projectile.Opacity, Projectile.Opacity, Projectile.Opacity, 0); } } diff --git a/Projectiles/Melee/PrismTooth.cs b/Projectiles/Melee/PrismTooth.cs index 05a7dac1e0..ba16a9c6d6 100644 --- a/Projectiles/Melee/PrismTooth.cs +++ b/Projectiles/Melee/PrismTooth.cs @@ -13,34 +13,34 @@ namespace CalamityMod.Projectiles.Melee { internal PrimitiveTrail TrailDrawer; public const int Lifetime = 80; - public Player Owner => Main.player[projectile.owner]; - public ref float ShootReach => ref projectile.ai[0]; - public ref float Time => ref projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float ShootReach => ref Projectile.ai[0]; + public ref float Time => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Photon Ripper"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 36; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 36; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 52; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 5; - projectile.usesIDStaticNPCImmunity = true; + Projectile.width = 30; + Projectile.height = 52; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 5; + Projectile.usesIDStaticNPCImmunity = true; // THIS IS INTENTIONALLY VERY LOW. Do not increase this; it is essential for Photon Ripper to function properly. - projectile.idStaticNPCHitCooldown = 4; - projectile.timeLeft = Lifetime; - projectile.melee = true; + Projectile.idStaticNPCHitCooldown = 4; + Projectile.timeLeft = Lifetime; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi * Time / Lifetime; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi * Time / Lifetime; Vector2 baseDirection = (MathHelper.TwoPi * Time / Lifetime - MathHelper.PiOver2).ToRotationVector2(); baseDirection.X *= 0.25f; @@ -58,32 +58,32 @@ namespace CalamityMod.Projectiles.Melee // In this context, the velocity is simply the initial direction as a unit vector- it does not // actually influence movement in any way. - positionOffset = positionOffset.RotatedBy(projectile.velocity.ToRotation() - MathHelper.PiOver2); + positionOffset = positionOffset.RotatedBy(Projectile.velocity.ToRotation() - MathHelper.PiOver2); - projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter) + projectile.velocity * 42f + positionOffset; - projectile.Opacity = Utils.InverseLerp(0f, 12f, Time, true) * Utils.InverseLerp(Lifetime, Lifetime - 12f, Lifetime - projectile.timeLeft, true); + Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter) + Projectile.velocity * 42f + positionOffset; + Projectile.Opacity = Utils.InverseLerp(0f, 12f, Time, true) * Utils.InverseLerp(Lifetime, Lifetime - 12f, Lifetime - Projectile.timeLeft, true); // Destroy trees within the range of the past 20 oldPos positions. for (int i = 0; i < 20; i++) { - Point pointToCheck = (projectile.oldPos[i] + projectile.Size * 0.5f).ToTileCoordinates(); + Point pointToCheck = (Projectile.oldPos[i] + Projectile.Size * 0.5f).ToTileCoordinates(); AbsolutelyFuckingAnnihilateTrees(pointToCheck.X, pointToCheck.Y); } // Emit light. - Lighting.AddLight(projectile.Center, Vector3.One * 0.7f); + Lighting.AddLight(Projectile.Center, Vector3.One * 0.7f); Time++; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); public void AbsolutelyFuckingAnnihilateTrees(int x, int y) { Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(x, y); // Ignore tiles that are not active and are not breakable by axes. - if (!tileAtPosition.active() || !Main.tileAxe[tileAtPosition.type]) + if (!tileAtPosition.active() || !Main.tileAxe[tileAtPosition.TileType]) return; // Don't attempt to mine the tile if for whatever reason it's not supposed to be broken. @@ -101,12 +101,12 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) => Color.White; - internal float WidthFunction(float completionRatio) => projectile.scale * 24f * (1f - Utils.InverseLerp(0.7f, 1f, completionRatio, true)) + 1f; + internal float WidthFunction(float completionRatio) => Projectile.scale * 24f * (1f - Utils.InverseLerp(0.7f, 1f, completionRatio, true)) + 1f; internal Color ColorFunction(float completionRatio) { - float hue = (projectile.identity % 9f / 9f + completionRatio * 0.7f) % 1f; - return Color.Lerp(Color.White, Main.hslToRgb(hue, 0.95f, 0.55f), 0.35f) * projectile.Opacity; + float hue = (Projectile.identity % 9f / 9f + completionRatio * 0.7f) % 1f; + return Color.Lerp(Color.White, Main.hslToRgb(hue, 0.95f, 0.55f), 0.35f) * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -120,21 +120,21 @@ namespace CalamityMod.Projectiles.Melee // Variable adjustment vector used to prevent the trail for starting somewhat that isn't behind // the crystal. This may appear in small amounts, with offsets of a few pixels, but at the speed // these crystals go, it's probably not something to worry too much about. - Vector2 generalOffset = projectile.rotation.ToRotationVector2().RotatedBy(MathHelper.PiOver2) * 15f; - generalOffset += projectile.rotation.ToRotationVector2() * -5f * (float)Math.Sin(projectile.rotation); + Vector2 generalOffset = Projectile.rotation.ToRotationVector2().RotatedBy(MathHelper.PiOver2) * 15f; + generalOffset += Projectile.rotation.ToRotationVector2() * -5f * (float)Math.Sin(Projectile.rotation); // Mess with the oldPos array so that the trail always points towards the crystal. - Vector2 oldPosition = projectile.oldPos[1]; - projectile.oldPos[1] = projectile.oldPos[0] - projectile.rotation.ToRotationVector2() * Vector2.Distance(projectile.oldPos[0], projectile.oldPos[1]); + Vector2 oldPosition = Projectile.oldPos[1]; + Projectile.oldPos[1] = Projectile.oldPos[0] - Projectile.rotation.ToRotationVector2() * Vector2.Distance(Projectile.oldPos[0], Projectile.oldPos[1]); // Revert back if the above calculations caused any NaNs. - if (projectile.oldPos[1].HasNaNs()) - projectile.oldPos[1] = oldPosition; + if (Projectile.oldPos[1].HasNaNs()) + Projectile.oldPos[1] = oldPosition; spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:PrismaticStreak"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/ScarletDevilStreak")); + GameShaders.Misc["CalamityMod:PrismaticStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/ScarletDevilStreak")); - TrailDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f + generalOffset - Main.screenPosition, 65); + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f + generalOffset - Main.screenPosition, 65); spriteBatch.ExitShaderRegion(); return true; } diff --git a/Projectiles/Melee/PrismaticBeam.cs b/Projectiles/Melee/PrismaticBeam.cs index f8969e4369..6c40ae9f48 100644 --- a/Projectiles/Melee/PrismaticBeam.cs +++ b/Projectiles/Melee/PrismaticBeam.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -42,15 +43,15 @@ namespace CalamityMod.Projectiles.Melee public const int ChargeupTime = 100; - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override Color LaserOverlayColor => CalamityUtils.MulticolorLerp(Main.GlobalTime / ColorSet.Length % 1f, ColorSet); public override Color LightCastColor => LaserOverlayColor; public override float Lifetime => 300f; public override float MaxScale => 1.5f; public override float MaxLaserLength => 2200f; - public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); - public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); - public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); public override void SetStaticDefaults() { @@ -59,25 +60,25 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ranged = true; - projectile.melee = true; - projectile.scale = 1.5f; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.hide = true; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().PierceResistHarshness = 0.06f; - projectile.Calamity().PierceResistCap = 0.4f; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.DamageType = DamageClass.Melee; + Projectile.scale = 1.5f; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.hide = true; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Calamity().PierceResistHarshness = 0.06f; + Projectile.Calamity().PierceResistCap = 0.4f; } public override void DetermineScale() { - projectile.scale = Time < ChargeupTime ? 0f : Utils.InverseLerp(0f, 40f, projectile.timeLeft, true) * MaxScale; + Projectile.scale = Time < ChargeupTime ? 0f : Utils.InverseLerp(0f, 40f, Projectile.timeLeft, true) * MaxScale; } public override float DetermineLaserLength() @@ -88,25 +89,25 @@ namespace CalamityMod.Projectiles.Melee public override bool PreAI() { // Multiplayer support here, only run this code if the client running it is the owner of the projectile - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); - projectile.direction = Main.MouseWorld.X > Owner.Center.X ? 1 : -1; - projectile.netUpdate = true; + Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.direction = Main.MouseWorld.X > Owner.Center.X ? 1 : -1; + Projectile.netUpdate = true; } - int dir = projectile.direction; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.Center = Owner.Center + projectile.velocity * 80f; + int dir = Projectile.direction; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.Center = Owner.Center + Projectile.velocity * 80f; Owner.ChangeDir(dir); - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.itemRotation = CalamityUtils.WrapAngle90Degrees(projectile.rotation - MathHelper.PiOver2); + Owner.itemRotation = CalamityUtils.WrapAngle90Degrees(Projectile.rotation - MathHelper.PiOver2); if (!Owner.channel) { - projectile.Kill(); + Projectile.Kill(); return false; } @@ -114,10 +115,10 @@ namespace CalamityMod.Projectiles.Melee { // Crate charge-up dust. int dustCount = (int)(Time / 20f); - Vector2 spawnPos = projectile.Center; + Vector2 spawnPos = Projectile.Center; for (int k = 0; k < dustCount + 1; k++) { - Dust dust = Dust.NewDustDirect(spawnPos, 1, 1, 267, projectile.velocity.X / 2f, projectile.velocity.Y / 2f); + Dust dust = Dust.NewDustDirect(spawnPos, 1, 1, 267, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); dust.position += Main.rand.NextVector2Square(-10f, 10f); dust.velocity = Main.rand.NextVector2Unit() * (10f - dustCount * 2f) / 10f; dust.color = Main.rand.Next(Colors); @@ -132,7 +133,7 @@ namespace CalamityMod.Projectiles.Melee // Play a cool sound when fully charged. if (!PlayedSound) { - Main.PlaySound(SoundID.Item68, projectile.position); + SoundEngine.PlaySound(SoundID.Item68, Projectile.position); PlayedSound = true; } return true; @@ -144,8 +145,8 @@ namespace CalamityMod.Projectiles.Melee public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * LaserLength, projectile.width + 16, DelegateMethods.CutTiles); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * LaserLength, Projectile.width + 16, DelegateMethods.CutTiles); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/PrismaticWave.cs b/Projectiles/Melee/PrismaticWave.cs index 5d2c8c9652..7b55209850 100644 --- a/Projectiles/Melee/PrismaticWave.cs +++ b/Projectiles/Melee/PrismaticWave.cs @@ -41,72 +41,72 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Wave"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 36; - projectile.height = 36; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 360; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 36; + Projectile.height = 36; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.timeLeft = 360; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) + Projectile.scale -= 0.02f; + Projectile.alpha += 30; + if (Projectile.alpha >= 250) { - projectile.alpha = 255; - projectile.localAI[0] = 1f; + Projectile.alpha = 255; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) + Projectile.scale += 0.02f; + Projectile.alpha -= 30; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[0] = 0f; + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; } } - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); if (Main.rand.NextBool(2)) { - int rainbow = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 267, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, alpha, Main.rand.Next(colors)); + int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 267, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, alpha, Main.rand.Next(colors)); Main.dust[rainbow].noGravity = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 355) + if (Projectile.timeLeft > 355) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 3; k++) { - int rainbow = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 267, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, alpha, Main.rand.Next(colors)); + int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 267, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, alpha, Main.rand.Next(colors)); Main.dust[rainbow].noGravity = true; } } @@ -131,14 +131,14 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(ModContent.BuffType(), 150); target.AddBuff(BuffID.Daybreak, 150); - projectile.velocity *= 0.75f; + Projectile.velocity *= 0.75f; } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 150); target.AddBuff(BuffID.Daybreak, 150); - projectile.velocity *= 0.75f; + Projectile.velocity *= 0.75f; } } } diff --git a/Projectiles/Melee/ProfanedSwordProj.cs b/Projectiles/Melee/ProfanedSwordProj.cs index ed2cd7bc35..3dfe4adccb 100644 --- a/Projectiles/Melee/ProfanedSwordProj.cs +++ b/Projectiles/Melee/ProfanedSwordProj.cs @@ -20,36 +20,36 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 113; + Projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; - projectile.melee = true; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(45f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.ToRadians(45f); if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { - projectile.rotation -= MathHelper.ToRadians(90f); + Projectile.rotation -= MathHelper.ToRadians(90f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -57,26 +57,26 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[Projectile.owner] = 6; target.AddBuff(ModContent.BuffType(), 180); - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { if (explosionCount < 3) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), knockback, projectile.owner); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), knockback, Projectile.owner); explosionCount++; } } - if (projectile.damage > 1) - projectile.damage = (int)(projectile.damage * 0.6); - if (projectile.damage <= 0) - projectile.damage = 1; + if (Projectile.damage > 1) + Projectile.damage = (int)(Projectile.damage * 0.6); + if (Projectile.damage <= 0) + Projectile.damage = 1; } } } diff --git a/Projectiles/Melee/PwnagehammerEcho.cs b/Projectiles/Melee/PwnagehammerEcho.cs index 25cc7d9b5a..aa2ee16270 100644 --- a/Projectiles/Melee/PwnagehammerEcho.cs +++ b/Projectiles/Melee/PwnagehammerEcho.cs @@ -13,31 +13,31 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Pwnagehammer Echo"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.aiStyle = 0; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; + Projectile.width = 40; + Projectile.height = 40; + Projectile.aiStyle = 0; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override Color? GetAlpha(Color lightColor) @@ -47,28 +47,28 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] < 42f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] < 42f) { - projectile.velocity.Y *= 0.9575f; - projectile.rotation += MathHelper.ToRadians(projectile.ai[0] * 0.5f) * projectile.localAI[0]; + Projectile.velocity.Y *= 0.9575f; + Projectile.rotation += MathHelper.ToRadians(Projectile.ai[0] * 0.5f) * Projectile.localAI[0]; } - else if (projectile.ai[0] < 44f) + else if (Projectile.ai[0] < 44f) { - if (projectile.ai[1] < 0f) + if (Projectile.ai[1] < 0f) { - projectile.Kill(); + Projectile.Kill(); return; } - NPC target = Main.npc[(int)projectile.ai[1]]; - if (!target.CanBeChasedBy(projectile, false) || !target.active) - projectile.Kill(); + NPC target = Main.npc[(int)Projectile.ai[1]]; + if (!target.CanBeChasedBy(Projectile, false) || !target.active) + Projectile.Kill(); else { float velConst = 3f; - projectile.velocity = new Vector2((target.Center.X - projectile.Center.X) / velConst, (target.Center.Y - projectile.Center.Y) / velConst); - projectile.rotation += MathHelper.ToRadians(48f) * projectile.localAI[0]; + Projectile.velocity = new Vector2((target.Center.X - Projectile.Center.X) / velConst, (target.Center.Y - Projectile.Center.Y) / velConst); + Projectile.rotation += MathHelper.ToRadians(48f) * Projectile.localAI[0]; } } @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee { Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(projectile.position.X, projectile.position.Y) + offset, DustID.GoldFlame, new Vector2(projectile.velocity.X * 0.2f + velOffset.X, projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); + Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.position.X, Projectile.position.Y) + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); dust.noGravity = true; } @@ -84,28 +84,28 @@ namespace CalamityMod.Projectiles.Melee { Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(projectile.position.X, projectile.position.Y) + offset, DustID.GoldFlame, new Vector2(projectile.velocity.X * 0.2f + velOffset.X, projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); + Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.position.X, Projectile.position.Y) + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); dust.noGravity = true; } } public override bool? CanHitNPC(NPC target) { - if (projectile.ai[0] <= 42f) + if (Projectile.ai[0] <= 42f) return false; return null; } - public override bool CanHitPvp(Player target) => projectile.ai[0] > 42f; + public override bool CanHitPvp(Player target) => Projectile.ai[0] > 42f; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.localAI[0] = target.whoAmI; + Projectile.localAI[0] = target.whoAmI; } public override bool PreKill(int timeLeft) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float numberOfDusts = 32f; float rotFactor = 360f / numberOfDusts; @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Melee float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(15f, 0).RotatedBy(rot); Vector2 velOffset = new Vector2(12.5f, 0).RotatedBy(rot); - int dust = Dust.NewDust(projectile.position + offset, projectile.width, projectile.height, 269, velOffset.X, velOffset.Y); + int dust = Dust.NewDust(Projectile.position + offset, Projectile.width, Projectile.height, 269, velOffset.X, velOffset.Y); Main.dust[dust].noGravity = true; Main.dust[dust].velocity = velOffset; Main.dust[dust].scale = 2.5f; @@ -125,12 +125,12 @@ namespace CalamityMod.Projectiles.Melee for (int k = 0; k < Main.maxNPCs; k++) { NPC npc = Main.npc[k]; - Vector2 vec = npc.Center - projectile.Center; + Vector2 vec = npc.Center - Projectile.Center; float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y); - if (distanceTo < distance && npc.CanBeChasedBy(projectile, false) && k != projectile.localAI[0]) + 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); + float alldamage = Projectile.damage * 0.5f; + double damage = npc.StrikeNPC((int)alldamage, Projectile.knockBack, Projectile.velocity.X > 0f ? 1 : -1, true); player.addDPS((int)damage); } } @@ -140,18 +140,18 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height); Vector2 origin = sourceRectangle.Size() / 2f; - for (int i = 0; i < projectile.oldPos.Length; i++) + for (int i = 0; i < Projectile.oldPos.Length; i++) { - float rot = MathHelper.ToRadians(22.5f) * Math.Sign(projectile.velocity.X); - Vector2 drawPos = projectile.oldPos[i] - Main.screenPosition + origin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); - spriteBatch.Draw(texture, drawPos, new Rectangle?(), color, projectile.rotation - i * rot, origin, projectile.scale, spriteEffects, 0f); + float rot = MathHelper.ToRadians(22.5f) * Math.Sign(Projectile.velocity.X); + Vector2 drawPos = Projectile.oldPos[i] - Main.screenPosition + origin + new Vector2(0f, Projectile.gfxOffY); + Color color = Projectile.GetAlpha(lightColor) * ((Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); + spriteBatch.Draw(texture, drawPos, new Rectangle?(), color, Projectile.rotation - i * rot, origin, Projectile.scale, spriteEffects, 0f); } return false; } diff --git a/Projectiles/Melee/PwnagehammerProj.cs b/Projectiles/Melee/PwnagehammerProj.cs index 02a00c8cc1..aa8dcab344 100644 --- a/Projectiles/Melee/PwnagehammerProj.cs +++ b/Projectiles/Melee/PwnagehammerProj.cs @@ -6,6 +6,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,80 +17,80 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Pwnagehammer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 40; - projectile.friendly = true; - projectile.timeLeft = 3600; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = Projectile.height = 40; + Projectile.friendly = true; + Projectile.timeLeft = 3600; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() { - projectile.direction = projectile.spriteDirection = projectile.velocity.X > 0f ? 1 : -1; - projectile.rotation += MathHelper.ToRadians(22.5f) * projectile.direction; + Projectile.direction = Projectile.spriteDirection = Projectile.velocity.X > 0f ? 1 : -1; + Projectile.rotation += MathHelper.ToRadians(22.5f) * Projectile.direction; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { float distance = 400f; - if (projectile.ai[1] == -1) + if (Projectile.ai[1] == -1) { // used for finding a target for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - Vector2 vec = npc.Center - projectile.Center; + Vector2 vec = npc.Center - Projectile.Center; float distanceTo = vec.Length(); distanceTo -= (float)Math.Sqrt(npc.width * npc.width + npc.height * npc.height) * 0.75f; - if (distanceTo < distance && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - projectile.ai[1] = i; + if (distanceTo < distance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) + Projectile.ai[1] = i; } } } else { - int index = (int)projectile.ai[1]; + int index = (int)Projectile.ai[1]; float speed = 34f; float inertia = 15f; - if (!Main.npc[index].CanBeChasedBy(projectile, false)) - projectile.ai[1] = -1; + if (!Main.npc[index].CanBeChasedBy(Projectile, false)) + Projectile.ai[1] = -1; - Vector2 direction = Main.npc[index].Center - projectile.Center; + Vector2 direction = Main.npc[index].Center - Projectile.Center; direction.Normalize(); direction *= speed; - projectile.velocity = (projectile.velocity * (inertia - 1) + direction) / inertia; + Projectile.velocity = (Projectile.velocity * (inertia - 1) + direction) / inertia; } } else { - projectile.velocity.X *= 0.9711f; - projectile.velocity.Y += 0.426f; + Projectile.velocity.X *= 0.9711f; + Projectile.velocity.Y += 0.426f; } if (Main.rand.NextBool(2)) { Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(projectile.Center.X, projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2(projectile.velocity.X * 0.2f + velOffset.X, projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); + Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); dust.noGravity = true; } @@ -97,15 +98,15 @@ namespace CalamityMod.Projectiles.Melee { Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(projectile.Center.X, projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2(projectile.velocity.X * 0.2f + velOffset.X, projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); + Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); dust.noGravity = true; } } public override void Kill(int timeLeft) { - Player player = Main.player[projectile.owner]; - if (projectile.ai[0] == 1f) + Player player = Main.player[Projectile.owner]; + if (Projectile.ai[0] == 1f) { float numberOfDusts = 40f; float rotFactor = 360f / numberOfDusts; @@ -114,20 +115,20 @@ namespace CalamityMod.Projectiles.Melee float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(15f, 0).RotatedBy(rot); Vector2 velOffset = new Vector2(10f, 0).RotatedBy(rot); - Dust dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); + Dust dust = Dust.NewDustPerfect(Projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; dust.velocity = velOffset; dust.scale = 2.5f; if (i % 2 == 0) { - dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); + dust = Dust.NewDustPerfect(Projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; dust.velocity = velOffset * 2f; dust.scale = 2.5f; } if (i % 4 == 0) { - dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); + dust = Dust.NewDustPerfect(Projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; dust.velocity = velOffset / 2f; dust.scale = 2.5f; @@ -139,20 +140,20 @@ namespace CalamityMod.Projectiles.Melee for (int k = 0; k < Main.maxNPCs; k++) { NPC npc = Main.npc[k]; - Vector2 vec = npc.Center - projectile.Center; + Vector2 vec = npc.Center - Projectile.Center; float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y); distanceTo -= (float)Math.Sqrt(npc.width * npc.width + npc.height * npc.height) * 0.75f; - if (distanceTo < distance && npc.CanBeChasedBy(projectile, false) && k != projectile.localAI[0]) + if (distanceTo < distance && npc.CanBeChasedBy(Projectile, false) && k != Projectile.localAI[0]) { - float alldamage = projectile.damage * 1.25f; - double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, projectile.velocity.X > 0f ? 1 : -1); + float alldamage = Projectile.damage * 1.25f; + double damage = npc.StrikeNPC((int)alldamage, Projectile.knockBack, Projectile.velocity.X > 0f ? 1 : -1); player.addDPS((int)damage); } } - SoundEffectInstance sound1 = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PwnagehammerHoming"), projectile.Center); + SoundEffectInstance sound1 = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PwnagehammerHoming"), Projectile.Center); if (sound1 != null) sound1.Volume = 0.3f; - SoundEffectInstance sound2 = Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEffectInstance sound2 = SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); if (sound2 != null) sound2.Volume = 0.22f; } @@ -165,7 +166,7 @@ namespace CalamityMod.Projectiles.Melee float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(15f, 0).RotatedBy(rot); Vector2 velOffset = new Vector2(12.5f, 0).RotatedBy(rot); - Dust dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); + Dust dust = Dust.NewDustPerfect(Projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; dust.velocity = velOffset; dust.scale = 2.5f; @@ -176,23 +177,23 @@ namespace CalamityMod.Projectiles.Melee for (int k = 0; k < Main.maxNPCs; k++) { NPC npc = Main.npc[k]; - Vector2 vec = npc.Center - projectile.Center; + Vector2 vec = npc.Center - Projectile.Center; float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y); distanceTo -= (float)Math.Sqrt(npc.width * npc.width + npc.height * npc.height) * 0.75f; - if (distanceTo < distance && npc.CanBeChasedBy(projectile, false) && k != projectile.localAI[0]) + if (distanceTo < distance && npc.CanBeChasedBy(Projectile, false) && k != Projectile.localAI[0]) { - float alldamage = projectile.damage * 0.75f; - double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, projectile.velocity.X > 0f ? 1 : -1); + float alldamage = Projectile.damage * 0.75f; + double damage = npc.StrikeNPC((int)alldamage, Projectile.knockBack, Projectile.velocity.X > 0f ? 1 : -1); player.addDPS((int)damage); } } - SoundEffectInstance sound1 = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PwnagehammerSound"), projectile.Center); + SoundEffectInstance sound1 = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PwnagehammerSound"), Projectile.Center); if (sound1 != null) { sound1.Volume = 0.16f; sound1.Pitch = Main.rand.NextFloat(-0.08f, 0.08f); } - SoundEffectInstance sound2 = Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEffectInstance sound2 = SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); if (sound2 != null) sound2.Volume = 0.11f; } @@ -200,33 +201,33 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (projectile.ai[0] == 1f && Main.myPlayer == projectile.owner) + if (Projectile.ai[0] == 1f && Main.myPlayer == Projectile.owner) { crit = true; - int hammer = Projectile.NewProjectile(projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), projectile.damage * 2, projectile.knockBack, projectile.owner, 0f, projectile.ai[1]); - Main.projectile[hammer].localAI[0] = Math.Sign(projectile.velocity.X); + int hammer = Projectile.NewProjectile(Projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner, 0f, Projectile.ai[1]); + Main.projectile[hammer].localAI[0] = Math.Sign(Projectile.velocity.X); Main.projectile[hammer].netUpdate = true; } } public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) { - if (projectile.ai[0] == 1f && Main.myPlayer == projectile.owner) + if (Projectile.ai[0] == 1f && Main.myPlayer == Projectile.owner) { - int hammer = Projectile.NewProjectile(projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), projectile.damage * 2, projectile.knockBack, projectile.owner, 0f, projectile.ai[1]); - Main.projectile[hammer].localAI[0] = Math.Sign(projectile.velocity.X); + int hammer = Projectile.NewProjectile(Projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner, 0f, Projectile.ai[1]); + Main.projectile[hammer].localAI[0] = Math.Sign(Projectile.velocity.X); Main.projectile[hammer].netUpdate = true; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.localAI[0] = target.whoAmI; + Projectile.localAI[0] = target.whoAmI; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/RSSolarFlare.cs b/Projectiles/Melee/RSSolarFlare.cs index 23b580be57..893089507e 100644 --- a/Projectiles/Melee/RSSolarFlare.cs +++ b/Projectiles/Melee/RSSolarFlare.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class RSSolarFlare : ModProjectile @@ -12,97 +13,97 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Flare"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 46; - projectile.height = 46; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.alpha = 150; - projectile.melee = true; - projectile.timeLeft = 120; + Projectile.width = 46; + Projectile.height = 46; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.alpha = 150; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 120; } public override void AI() { - if (projectile.timeLeft < 60) + if (Projectile.timeLeft < 60) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale -= 0.02f; - projectile.alpha += 15; - if (projectile.alpha >= 150) + Projectile.scale -= 0.02f; + Projectile.alpha += 15; + if (Projectile.alpha >= 150) { - projectile.alpha = 150; - projectile.localAI[0] = 1f; + Projectile.alpha = 150; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale += 0.02f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) + Projectile.scale += 0.02f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[0] = 0f; + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; } } - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.velocity.X *= 0.975f; + Projectile.velocity.Y *= 0.975f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - Lighting.AddLight(projectile.Center, 0.75f, 0.75f, 0f); + Lighting.AddLight(Projectile.Center, 0.75f, 0.75f, 0f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (i = 0; i < 1; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 159, 0f, 0f, 100, default, 0.5f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 159, 0f, 0f, 100, default, 0.5f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -112,10 +113,10 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 35; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default, 1f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 32, 0f, 0f, 100, default, 1f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 159, 0f, 0f, 100, default, 0.5f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 159, 0f, 0f, 100, default, 0.5f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Melee/RainBolt.cs b/Projectiles/Melee/RainBolt.cs index 10d3cbd221..21772c0c58 100644 --- a/Projectiles/Melee/RainBolt.cs +++ b/Projectiles/Melee/RainBolt.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class RainBolt : ModProjectile @@ -15,40 +16,40 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item9, projectile.Center); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); + Projectile.localAI[0] += 1f; } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 20f); else - projectile.velocity *= 0.95f; + Projectile.velocity *= 0.95f; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item60, projectile.Center); + SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); for (int k = 0; k < 5; k++) { - int rain = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)); + int rain = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)); Main.dust[rain].noGravity = true; Main.dust[rain].velocity *= 4f; } diff --git a/Projectiles/Melee/RainbowBoom.cs b/Projectiles/Melee/RainbowBoom.cs index 32f244db54..e645b5da80 100644 --- a/Projectiles/Melee/RainbowBoom.cs +++ b/Projectiles/Melee/RainbowBoom.cs @@ -15,54 +15,54 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 100; - projectile.height = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 20; - projectile.melee = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 5; + Projectile.width = 100; + Projectile.height = 100; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 20; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; } public override void AI() { bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -73,10 +73,10 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; + Main.dust[num467].position.X = Projectile.Center.X; + Main.dust[num467].position.Y = Projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.damage = (int)(projectile.damage * 0.9); + Projectile.damage = (int)(Projectile.damage * 0.9); } } } diff --git a/Projectiles/Melee/Razorwind.cs b/Projectiles/Melee/Razorwind.cs index 5486f450fc..3884403f6b 100644 --- a/Projectiles/Melee/Razorwind.cs +++ b/Projectiles/Melee/Razorwind.cs @@ -13,47 +13,47 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Razorwind"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.alpha = 255; - projectile.friendly = true; - projectile.melee = true; - projectile.timeLeft = 300; - projectile.extraUpdates = 2; - projectile.penetrate = 3; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.width = 40; + Projectile.height = 40; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 2; + Projectile.penetrate = 3; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override void AI() { - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; - projectile.alpha -= 5; - if (projectile.alpha < 50) + Projectile.alpha -= 5; + if (Projectile.alpha < 50) { - projectile.alpha = 50; + Projectile.alpha = 50; } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 4f) { for (int num468 = 0; num468 < 3; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255), 2f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255), 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 250f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 250f, 12f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) => false; @@ -62,18 +62,18 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); } } public override Color? GetAlpha(Color lightColor) { - return new Color(53, Main.DiscoG, 255, projectile.alpha); + return new Color(53, Main.DiscoG, 255, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/RedDust.cs b/Projectiles/Melee/RedDust.cs index 4319ef7feb..29dd9b6530 100644 --- a/Projectiles/Melee/RedDust.cs +++ b/Projectiles/Melee/RedDust.cs @@ -13,62 +13,62 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.timeLeft = 3600; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 3600; } public override void AI() { - projectile.rotation += projectile.velocity.X * 0.02f; - if (projectile.velocity.X < 0f) + Projectile.rotation += Projectile.velocity.X * 0.02f; + if (Projectile.velocity.X < 0f) { - projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; + Projectile.rotation -= Math.Abs(Projectile.velocity.Y) * 0.02f; } else { - projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; + Projectile.rotation += Math.Abs(Projectile.velocity.Y) * 0.02f; } - projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 60f) + Projectile.velocity *= 0.98f; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 60f) { - if (projectile.timeLeft > 85) - projectile.timeLeft = 85; - if (projectile.alpha < 255) + if (Projectile.timeLeft > 85) + Projectile.timeLeft = 85; + if (Projectile.alpha < 255) { - projectile.alpha += 2; - if (projectile.alpha > 255) + Projectile.alpha += 2; + if (Projectile.alpha > 255) { - projectile.alpha = 255; + Projectile.alpha = 255; } } - else if (projectile.owner == Main.myPlayer) + else if (Projectile.owner == Main.myPlayer) { - projectile.Kill(); + Projectile.Kill(); } } - else if (projectile.alpha > 80) + else if (Projectile.alpha > 80) { - projectile.alpha -= 30; - if (projectile.alpha < 80) + Projectile.alpha -= 30; + if (Projectile.alpha < 80) { - projectile.alpha = 80; + Projectile.alpha = 80; } } } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } diff --git a/Projectiles/Melee/RedtideWhirlpool.cs b/Projectiles/Melee/RedtideWhirlpool.cs index c613d11a32..f25e117542 100644 --- a/Projectiles/Melee/RedtideWhirlpool.cs +++ b/Projectiles/Melee/RedtideWhirlpool.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class RedtideWhirlpool : ModProjectile @@ -12,74 +13,74 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Whirlpool"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 60; - projectile.height = 60; - projectile.scale = 0.5f; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.melee = true; + Projectile.width = 60; + Projectile.height = 60; + Projectile.scale = 0.5f; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0f, projectile.scale * 1.5f); + Lighting.AddLight(Projectile.Center, 0f, 0f, Projectile.scale * 1.5f); int num626 = 6; for (int num627 = 0; num627 < num626; num627++) { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + projectile.Center; + Vector2 vector45 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + Projectile.Center; Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num628 = Dust.NewDust(vector45 + value15, 0, 0, 172, value15.X * 2f, value15.Y * 2f, 100, default, projectile.scale); + int num628 = Dust.NewDust(vector45 + value15, 0, 0, 172, value15.X * 2f, value15.Y * 2f, 100, default, Projectile.scale); Main.dust[num628].noGravity = true; Main.dust[num628].noLight = true; Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; + Main.dust[num628].velocity -= Projectile.velocity; } - if (projectile.scale <= 1f) + if (Projectile.scale <= 1f) { - projectile.scale *= 1.015f; + Projectile.scale *= 1.015f; } - if (projectile.scale >= 1f) + if (Projectile.scale >= 1f) { - projectile.Kill(); + Projectile.Kill(); } - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 3) + if (Projectile.frame >= 3) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCDeath19, projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath19, Projectile.position); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 172, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; diff --git a/Projectiles/Melee/RemsRevengeProj.cs b/Projectiles/Melee/RemsRevengeProj.cs index 32fb3af373..f9f8506c91 100644 --- a/Projectiles/Melee/RemsRevengeProj.cs +++ b/Projectiles/Melee/RemsRevengeProj.cs @@ -15,34 +15,34 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Rem's Revenge"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.alpha = 255; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.extraUpdates = 1; - projectile.scale = 2f; - projectile.tileCollide = false; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 255; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.extraUpdates = 1; + Projectile.scale = 2f; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; - Vector2 projVector = player.Center - projectile.Center; - projectile.rotation = projVector.ToRotation() - MathHelper.PiOver2; + Player player = Main.player[Projectile.owner]; + Vector2 projVector = player.Center - Projectile.Center; + Projectile.rotation = projVector.ToRotation() - MathHelper.PiOver2; if (player.dead) { - projectile.Kill(); + Projectile.Kill(); return; } player.itemAnimation = 10; @@ -50,58 +50,58 @@ namespace CalamityMod.Projectiles.Melee if (projVector.X < 0f) { player.ChangeDir(1); - projectile.direction = 1; + Projectile.direction = 1; } else { player.ChangeDir(-1); - projectile.direction = -1; + Projectile.direction = -1; } - player.itemRotation = (projVector * -1f * (float)projectile.direction).ToRotation(); - projectile.spriteDirection = (projVector.X > 0f) ? -1 : 1; - if (projectile.ai[0] == 0f && projVector.Length() > 850f) + player.itemRotation = (projVector * -1f * (float)Projectile.direction).ToRotation(); + Projectile.spriteDirection = (projVector.X > 0f) ? -1 : 1; + if (Projectile.ai[0] == 0f && projVector.Length() > 850f) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } - if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) + if (Projectile.ai[0] == 1f || Projectile.ai[0] == 2f) { - projectile.extraUpdates = 2; + Projectile.extraUpdates = 2; float playerDist = projVector.Length(); if (playerDist > 1500f) { - projectile.Kill(); + Projectile.Kill(); return; } if (playerDist > 1000f) { - projectile.ai[0] = 2f; + Projectile.ai[0] = 2f; } - projectile.tileCollide = false; + Projectile.tileCollide = false; float returnSpeed = 15f; - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { returnSpeed = 30f; } - projectile.velocity = Vector2.Normalize(projVector) * returnSpeed; + Projectile.velocity = Vector2.Normalize(projVector) * returnSpeed; if (projVector.Length() < returnSpeed) { - projectile.Kill(); + Projectile.Kill(); return; } } - projectile.ai[1] += 1f; - if (projectile.ai[1] > 5f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 5f) { - projectile.alpha = 0; + Projectile.alpha = 0; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D chainTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Chains/RemsRevengeChain"); - Vector2 projCenter = projectile.Center; + Texture2D chainTexture = ModContent.Request("CalamityMod/ExtraTextures/Chains/RemsRevengeChain"); + Vector2 projCenter = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)chainTexture.Width * 0.5f, (float)chainTexture.Height * 0.5f); float chainHeight = (float)chainTexture.Height; @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -142,11 +142,11 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(ModContent.BuffType(), 240); hitCounter++; if (hitCounter < 6) - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); if (hitCounter > 3) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Melee/RendingNeedle.cs b/Projectiles/Melee/RendingNeedle.cs index 1840a70c51..2da8dd3cdb 100644 --- a/Projectiles/Melee/RendingNeedle.cs +++ b/Projectiles/Melee/RendingNeedle.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -18,61 +19,61 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Rending Needle"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } const float MaxTime = 30; - public float Timer => MaxTime - projectile.timeLeft; + public float Timer => MaxTime - Projectile.timeLeft; public override void SetDefaults() { - projectile.width = projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = (int)MaxTime; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.timeLeft = (int)MaxTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 44f * projectile.scale; - Vector2 start = -Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * 16f; + float bladeLenght = 44f * Projectile.scale; + Vector2 start = -Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 16f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center + start, projectile.Center + start + Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint); } public override void AI() { - projectile.scale = 2.4f; - projectile.Opacity = 0.6f; - Lighting.AddLight(projectile.Center, 0.75f, 1f, 0.24f); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.scale = 2.4f; + Projectile.Opacity = 0.6f; + Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.velocity *= (1 - (float)Math.Pow(Timer / MaxTime, 3) * 0.3f); + Projectile.velocity *= (1 - (float)Math.Pow(Timer / MaxTime, 3) * 0.3f); if (Main.rand.Next(2) == 0) { - Particle smoke = new HeavySmokeParticle(projectile.Center, projectile.velocity * 0.5f, Color.Lerp(Color.DodgerBlue, Color.MediumVioletRed, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f) * projectile.scale * 0.6f, 0.28f, 0, false, 0, true); + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, Color.Lerp(Color.DodgerBlue, Color.MediumVioletRed, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f) * Projectile.scale * 0.6f, 0.28f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); if (Main.rand.Next(3) == 0) { - Particle smokeGlow = new HeavySmokeParticle(projectile.Center, projectile.velocity * 0.5f, Main.hslToRgb(Main.rand.NextFloat(), 1, 0.7f), 20, Main.rand.NextFloat(0.4f, 0.7f) * projectile.scale * 0.6f, 0.8f, 0, true, 0.05f, true); + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, Main.hslToRgb(Main.rand.NextFloat(), 1, 0.7f), 20, Main.rand.NextFloat(0.4f, 0.7f) * Projectile.scale * 0.6f, 0.8f, 0, true, 0.05f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } } - if (projectile.velocity.Length() < 1.0f) - projectile.Kill(); + if (Projectile.velocity.Length() < 1.0f) + Projectile.Kill(); } internal Color ColorFunction(float completionRatio) { float fadeToEnd = MathHelper.Lerp(0.65f, 1f, (float)Math.Cos(-Main.GlobalTime * 3f) * 0.5f + 0.5f); - float fadeOpacity = Utils.InverseLerp(1f, 0.64f, completionRatio, true) * projectile.Opacity; + float fadeOpacity = Utils.InverseLerp(1f, 0.64f, completionRatio, true) * Projectile.Opacity; Color endColor = Color.Lerp(Color.Cyan, Color.Crimson, (float)Math.Sin(completionRatio * MathHelper.Pi * 1.6f - Main.GlobalTime * 4f) * 0.5f + 0.5f); return Color.Lerp(Color.White, endColor, fadeToEnd) * fadeOpacity; @@ -81,13 +82,13 @@ namespace CalamityMod.Projectiles.Melee internal float WidthFunction(float completionRatio) { float expansionCompletion = (float)Math.Pow(1 - completionRatio, 2); - return MathHelper.Lerp(0f, 14f * projectile.scale, expansionCompletion); + return MathHelper.Lerp(0f, 14f * Projectile.scale, expansionCompletion); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 35) + if (Projectile.timeLeft > 35) return false; Texture2D texture = GetTexture("CalamityMod/Projectiles/Melee/RendingNeedle"); @@ -95,10 +96,10 @@ namespace CalamityMod.Projectiles.Melee if (TrailDrawer is null) TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/ScarletDevilStreak")); - TrailDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f - Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * 30.5f - Main.screenPosition, 30); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/ScarletDevilStreak")); + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 30.5f - Main.screenPosition, 30); - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.5f), projectile.rotation, texture.Size() / 2f, projectile.scale, SpriteEffects.None, 0); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.5f), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -111,7 +112,7 @@ namespace CalamityMod.Projectiles.Melee Color color = Main.hslToRgb((Main.GlobalTime * 0.6f) % 1, 1, 0.85f); float rotation = Main.GlobalTime * 8f; - Vector2 sparkCenter = projectile.Center - Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * 30.5f - Main.screenPosition; + Vector2 sparkCenter = Projectile.Center - Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 30.5f - Main.screenPosition; spriteBatch.Draw(bloomTexture, sparkCenter, null, color* 0.5f, 0, bloomTexture.Size() / 2f, 4 * properBloomSize, SpriteEffects.None, 0); spriteBatch.Draw(starTexture, sparkCenter, null, color * 0.5f, rotation + MathHelper.PiOver4, starTexture.Size() / 2f, 2 * 0.75f, SpriteEffects.None, 0); @@ -126,18 +127,18 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.DD2_WitherBeastDeath, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath, Projectile.Center); for (int i = 0; i < 10; i++) { Vector2 particleSpeed = Main.rand.NextVector2CircularEdge(1, 1) * Main.rand.NextFloat(1.2f, 2.3f); - Particle energyLeak = new SquishyLightParticle(projectile.Center + Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * 40f, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Cyan, 60, 1, 1.5f, hueShift: 0.02f); + Particle energyLeak = new SquishyLightParticle(Projectile.Center + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 40f, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Cyan, 60, 1, 1.5f, hueShift: 0.02f); GeneralParticleHandler.SpawnParticle(energyLeak); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : projectile.Center + projectile.rotation.ToRotationVector2() * 60f; + Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f; for (int i = 0; i < 10; i++) { Vector2 particleSpeed = Main.rand.NextVector2CircularEdge(1, 1) * Main.rand.NextFloat(2.6f, 4f); diff --git a/Projectiles/Melee/Rox1.cs b/Projectiles/Melee/Rox1.cs index 34dcb0051a..0cde8fc116 100644 --- a/Projectiles/Melee/Rox1.cs +++ b/Projectiles/Melee/Rox1.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -10,44 +11,44 @@ namespace CalamityMod.Projectiles.Melee { public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.extraUpdates = 1; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.extraUpdates = 1; } public override void AI() { //Gravity - projectile.velocity.Y = projectile.velocity.Y + 0.13f; - if (projectile.velocity.Y > 16f) + Projectile.velocity.Y = Projectile.velocity.Y + 0.13f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } //Projectile rotation - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.spriteDirection = projectile.direction; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.spriteDirection = Projectile.direction; //Dust trail if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 191, projectile.velocity.X * 0.4f, projectile.velocity.Y * 0.4f, 160, default, 0.7f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 191, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f, 160, default, 0.7f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { //Changes the texture of the projectile - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Melee/Rox2"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, 20)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/Rox2"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, 20)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Melee/Rox3"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, 20)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/Rox3"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, 20)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } return true; @@ -57,10 +58,10 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 8; i++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 191, -projectile.velocity.X * 0.4f, -projectile.velocity.Y * 0.4f, 120, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 191, -Projectile.velocity.X * 0.4f, -Projectile.velocity.Y * 0.4f, 120, default, 1.2f); } - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } } diff --git a/Projectiles/Melee/RoxShockwave.cs b/Projectiles/Melee/RoxShockwave.cs index cdbe8bba8c..6f6efd755c 100644 --- a/Projectiles/Melee/RoxShockwave.cs +++ b/Projectiles/Melee/RoxShockwave.cs @@ -7,13 +7,13 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.penetrate = -1; - projectile.width = 450; - projectile.height = 450; - projectile.melee = true; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.timeLeft = 40; + Projectile.penetrate = -1; + Projectile.width = 450; + Projectile.height = 450; + Projectile.DamageType = DamageClass.Melee; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 40; } } } diff --git a/Projectiles/Melee/RoxSlam.cs b/Projectiles/Melee/RoxSlam.cs index a810776487..05f4a0e938 100644 --- a/Projectiles/Melee/RoxSlam.cs +++ b/Projectiles/Melee/RoxSlam.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -11,21 +12,21 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 35; - projectile.friendly = true; - projectile.melee = true; - projectile.timeLeft = 400; - projectile.tileCollide = true; + Projectile.width = 10; + Projectile.height = 35; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 400; + Projectile.tileCollide = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; //Kills the projectile if the alt attack ended if (player.itemAnimation == 0) { - projectile.Kill(); + Projectile.Kill(); } //Makes the projectiles track the player float posX; @@ -39,42 +40,42 @@ namespace CalamityMod.Projectiles.Melee { posX = player.Center.X - 8; } - projectile.Center = new Vector2(posX, posY - (player.height / 10f)); + Projectile.Center = new Vector2(posX, posY - (player.height / 10f)); } public override bool OnTileCollide(Vector2 oldVelocity) { //This will only happen if the cooldown was full - if (projectile.ai[0] == 1 && Main.myPlayer == projectile.owner) + if (Projectile.ai[0] == 1 && Main.myPlayer == Projectile.owner) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; //Bounce player.velocity.Y = -18f; //reset player fall damage player.fallStart = (int)(player.position.Y / 16f); //Spawns the shockwave - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 300, 12, projectile.owner); - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.Kill(); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 300, 12, Projectile.owner); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.Kill(); //Pretty things for (int dustexplode = 0; dustexplode < 360; dustexplode++) { Vector2 dustd = new Vector2(17f, 17f).RotatedBy(MathHelper.ToRadians(dustexplode)); - int d = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 51, dustd.X, dustd.Y, 100, default, 3f); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 51, dustd.X, dustd.Y, 100, default, 3f); Main.dust[d].noGravity = true; - Main.dust[d].position = projectile.Center; + Main.dust[d].position = Projectile.Center; } return false; } //If the cooldown wasnt full, just bounce - else if (Main.myPlayer == projectile.owner) + else if (Main.myPlayer == Projectile.owner) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.velocity.Y = -14f; //reset player fall damage player.fallStart = (int)(player.position.Y / 16f); - Main.PlaySound(SoundID.Tink, projectile.position); - projectile.Kill(); + SoundEngine.PlaySound(SoundID.Tink, Projectile.position); + Projectile.Kill(); return false; } diff --git a/Projectiles/Melee/SHIV.cs b/Projectiles/Melee/SHIV.cs index 408ec8954e..b5ef15ca01 100644 --- a/Projectiles/Melee/SHIV.cs +++ b/Projectiles/Melee/SHIV.cs @@ -11,36 +11,36 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Shiv"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.aiStyle = 27; - projectile.extraUpdates = 1; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; + Projectile.aiStyle = 27; + Projectile.extraUpdates = 1; } public override void AI() { - if (projectile.velocity.Length() < 25f && projectile.timeLeft % 2 == 0) - projectile.velocity *= 1.04f; + if (Projectile.velocity.Length() < 25f && Projectile.timeLeft % 2 == 0) + Projectile.velocity *= 1.04f; - int rainbow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); Main.dust[rainbow].noGravity = true; Main.dust[rainbow].velocity = Vector2.Zero; } public override void Kill(int timeLeft) { - int rainbow = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[rainbow].noGravity = true; } @@ -53,10 +53,10 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/SandBlade.cs b/Projectiles/Melee/SandBlade.cs index 1df68774f2..32fad3d317 100644 --- a/Projectiles/Melee/SandBlade.cs +++ b/Projectiles/Melee/SandBlade.cs @@ -11,43 +11,43 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - projectile.rotation += 0.5f; - projectile.ai[1] += 1f; - if (projectile.ai[1] <= 30f) + Projectile.rotation += 0.5f; + Projectile.ai[1] += 1f; + if (Projectile.ai[1] <= 30f) { - projectile.velocity.X *= 0.925f; - projectile.velocity.Y *= 0.925f; + Projectile.velocity.X *= 0.925f; + Projectile.velocity.Y *= 0.925f; } - else if (projectile.ai[1] > 30f && projectile.ai[1] <= 59f) + else if (Projectile.ai[1] > 30f && Projectile.ai[1] <= 59f) { - projectile.velocity.X *= 1.15f; - projectile.velocity.Y *= 1.15f; + Projectile.velocity.X *= 1.15f; + Projectile.velocity.Y *= 1.15f; } - else if (projectile.ai[1] == 60f) + else if (Projectile.ai[1] == 60f) { - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, 0f, 0f); } } } diff --git a/Projectiles/Melee/SandFire.cs b/Projectiles/Melee/SandFire.cs index 46afa9c908..1406d97fcf 100644 --- a/Projectiles/Melee/SandFire.cs +++ b/Projectiles/Melee/SandFire.cs @@ -15,38 +15,38 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.timeLeft = 60; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 60; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0f); + Lighting.AddLight(Projectile.Center, 0.25f, 0.25f, 0f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 5; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 159, 0f, 0f, 100, default, 0.5f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 159, 0f, 0f, 100, default, 0.5f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Melee/ScourgeoftheCosmosMini.cs b/Projectiles/Melee/ScourgeoftheCosmosMini.cs index a34ae71e82..5035c81fc2 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosMini.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosMini.cs @@ -13,74 +13,74 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Miniature Cosmic Scourge"); - Main.projFrames[projectile.type] = 2; + Main.projFrames[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.extraUpdates = 3; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 3; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 270 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 270 && target.CanBeChasedBy(Projectile); public override void AI() { - if (projectile.alpha > 0) - projectile.alpha -= 50; + if (Projectile.alpha > 0) + Projectile.alpha -= 50; else - projectile.extraUpdates = 1; + Projectile.extraUpdates = 1; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - projectile.frameCounter++; - if (projectile.frameCounter >= 6) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 1) - projectile.frame = 0; + if (Projectile.frame > 1) + Projectile.frame = 0; for (int num369 = 0; num369 < 1; num369++) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - float num370 = projectile.velocity.X / 3f * num369; - float num371 = projectile.velocity.Y / 3f * num369; - int num372 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); + float num370 = Projectile.velocity.X / 3f * num369; + float num371 = Projectile.velocity.Y / 3f * num369; + int num372 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num372]; - dust.position.X = projectile.Center.X - num370; - dust.position.Y = projectile.Center.Y - num371; + dust.position.X = Projectile.Center.X - num370; + dust.position.Y = Projectile.Center.Y - num371; dust.velocity *= 0f; dust.scale = 0.5f; } - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - MathHelper.PiOver2; - float num373 = projectile.position.X; - float num374 = projectile.position.Y; + float num373 = Projectile.position.X; + float num374 = Projectile.position.Y; float num375 = 100000f; bool flag10 = false; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 30f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 30f) { - projectile.ai[0] = 30f; + Projectile.ai[0] = 30f; for (int num376 = 0; num376 < Main.maxNPCs; num376++) { - if (Main.npc[num376].CanBeChasedBy(projectile, false)) + if (Main.npc[num376].CanBeChasedBy(Projectile, false)) { float num377 = Main.npc[num376].position.X + Main.npc[num376].width / 2; float num378 = Main.npc[num376].position.Y + Main.npc[num376].height / 2; - float num379 = Math.Abs(projectile.position.X + projectile.width / 2 - num377) + Math.Abs(projectile.position.Y + projectile.height / 2 - num378); - if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height)) + float num379 = Math.Abs(Projectile.position.X + Projectile.width / 2 - num377) + Math.Abs(Projectile.position.Y + Projectile.height / 2 - num378); + if (num379 < 800f && num379 < num375 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height)) { num375 = num379; num373 = num377; @@ -92,42 +92,42 @@ namespace CalamityMod.Projectiles.Melee } if (!flag10) { - num373 = projectile.position.X + projectile.width / 2 + projectile.velocity.X * 100f; - num374 = projectile.position.Y + projectile.height / 2 + projectile.velocity.Y * 100f; + num373 = Projectile.position.X + Projectile.width / 2 + Projectile.velocity.X * 100f; + num374 = Projectile.position.Y + Projectile.height / 2 + Projectile.velocity.Y * 100f; } float num380 = 10f; float num381 = 0.16f; - Vector2 vector30 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); + Vector2 vector30 = new Vector2(Projectile.position.X + Projectile.width * 0.5f, Projectile.position.Y + Projectile.height * 0.5f); float num382 = num373 - vector30.X; float num383 = num374 - vector30.Y; float num384 = (float)Math.Sqrt(num382 * num382 + num383 * num383); num384 = num380 / num384; num382 *= num384; num383 *= num384; - if (projectile.velocity.X < num382) + if (Projectile.velocity.X < num382) { - projectile.velocity.X = projectile.velocity.X + num381; - if (projectile.velocity.X < 0f && num382 > 0f) - projectile.velocity.X = projectile.velocity.X + num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X + num381; + if (Projectile.velocity.X < 0f && num382 > 0f) + Projectile.velocity.X = Projectile.velocity.X + num381 * 2f; } - else if (projectile.velocity.X > num382) + else if (Projectile.velocity.X > num382) { - projectile.velocity.X = projectile.velocity.X - num381; - if (projectile.velocity.X > 0f && num382 < 0f) - projectile.velocity.X = projectile.velocity.X - num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X - num381; + if (Projectile.velocity.X > 0f && num382 < 0f) + Projectile.velocity.X = Projectile.velocity.X - num381 * 2f; } - if (projectile.velocity.Y < num383) + if (Projectile.velocity.Y < num383) { - projectile.velocity.Y = projectile.velocity.Y + num381; - if (projectile.velocity.Y < 0f && num383 > 0f) - projectile.velocity.Y = projectile.velocity.Y + num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + num381; + if (Projectile.velocity.Y < 0f && num383 > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num381 * 2f; } - else if (projectile.velocity.Y > num383) + else if (Projectile.velocity.Y > num383) { - projectile.velocity.Y = projectile.velocity.Y - num381; - if (projectile.velocity.Y > 0f && num383 < 0f) - projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - num381; + if (Projectile.velocity.Y > 0f && num383 < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num381 * 2f; } } @@ -135,24 +135,24 @@ namespace CalamityMod.Projectiles.Melee { bounce--; if (bounce <= 0) - projectile.Kill(); + Projectile.Kill(); else { - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; } return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; Vector2 origin = new Vector2(9f, 10f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/ScourgeoftheCosmosMiniGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Melee/ScourgeoftheCosmosMiniGlow"), Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } } } diff --git a/Projectiles/Melee/ScourgeoftheCosmosProj.cs b/Projectiles/Melee/ScourgeoftheCosmosProj.cs index 24c3743925..24dbd9663e 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosProj.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosProj.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,57 +15,57 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Scourge"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 36; - projectile.alpha = 255; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; + Projectile.width = Projectile.height = 36; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; } public override void AI() { - if (projectile.alpha <= 200) + if (Projectile.alpha <= 200) { int num3; for (int num20 = 0; num20 < 2; num20 = num3 + 1) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - float num21 = projectile.velocity.X / 4f * num20; - float num22 = projectile.velocity.Y / 4f * num20; - int num23 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); - Main.dust[num23].position.X = projectile.Center.X - num21; - Main.dust[num23].position.Y = projectile.Center.Y - num22; + float num21 = Projectile.velocity.X / 4f * num20; + float num22 = Projectile.velocity.Y / 4f * num20; + int num23 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + Main.dust[num23].position.X = Projectile.Center.X - num21; + Main.dust[num23].position.Y = Projectile.Center.Y - num22; Dust dust = Main.dust[num23]; dust.velocity *= 0f; Main.dust[num23].scale = 0.7f; num3 = num20; } } - projectile.alpha -= 50; - if (projectile.alpha < 0) - projectile.alpha = 0; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 0.785f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 180f) + Projectile.alpha -= 50; + if (Projectile.alpha < 0) + Projectile.alpha = 0; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 0.785f; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 180f) { - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.97f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.4f; + Projectile.velocity.X = Projectile.velocity.X * 0.97f; } - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -72,15 +73,15 @@ namespace CalamityMod.Projectiles.Melee { bounce--; if (bounce <= 0) - projectile.Kill(); + Projectile.Kill(); else { - Main.PlaySound(SoundID.NPCHit4, projectile.position); - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; - if (projectile.owner == Main.myPlayer) + SoundEngine.PlaySound(SoundID.NPCHit4, Projectile.position); + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; + if (Projectile.owner == Main.myPlayer) { int num626 = 1; if (Main.rand.NextBool(10)) @@ -92,7 +93,7 @@ namespace CalamityMod.Projectiles.Melee float num629 = Main.rand.Next(-35, 36) * 0.02f; num628 *= 10f; num629 *= 10f; - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)(projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.35f, Main.myPlayer); num3 = num627; } } @@ -102,12 +103,12 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCHit4, projectile.position); + SoundEngine.PlaySound(SoundID.NPCHit4, Projectile.position); int num3; for (int num622 = 0; num622 < 10; num622 = num3 + 1) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - int num623 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); + int num623 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num623]; dust.scale *= 1.1f; Main.dust[num623].noGravity = true; @@ -116,7 +117,7 @@ namespace CalamityMod.Projectiles.Melee for (int num624 = 0; num624 < 15; num624 = num3 + 1) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - int num625 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); + int num625 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num625]; dust.velocity *= 2.5f; dust = Main.dust[num625]; @@ -124,7 +125,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num625].noGravity = true; num3 = num624; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { int num626 = 3; if (Main.rand.NextBool(10)) @@ -135,7 +136,7 @@ namespace CalamityMod.Projectiles.Melee float num629 = Main.rand.Next(-35, 36) * 0.02f; num628 *= 10f; num629 *= 10f; - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)(projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.35f, Main.myPlayer); num3 = num627; } } diff --git a/Projectiles/Melee/SeashineSwordProj.cs b/Projectiles/Melee/SeashineSwordProj.cs index 23fe2fe003..54dd4db0f8 100644 --- a/Projectiles/Melee/SeashineSwordProj.cs +++ b/Projectiles/Melee/SeashineSwordProj.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -9,13 +10,13 @@ namespace CalamityMod.Projectiles.Melee { public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.melee = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.DamageType = DamageClass.Melee; } public override Color? GetAlpha(Color lightColor) @@ -25,19 +26,19 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); if (Main.rand.NextBool(2)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 1.2f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 1.2f); } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.oldVelocity.X, projectile.oldVelocity.Y, 0, new Color(255, 255, 255), 1.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 0, new Color(255, 255, 255), 1.5f); } } } diff --git a/Projectiles/Melee/ShortBeam.cs b/Projectiles/Melee/ShortBeam.cs index 7e498f350e..cf000c62d3 100644 --- a/Projectiles/Melee/ShortBeam.cs +++ b/Projectiles/Melee/ShortBeam.cs @@ -14,32 +14,32 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 60; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.timeLeft = 60; aiType = ProjectileID.LightBeam; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.2f / 255f, 0f, (255 - projectile.alpha) * 0.2f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.2f / 255f, 0f, (255 - Projectile.alpha) * 0.2f / 255f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 73, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 55) + if (Projectile.timeLeft > 55) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -47,13 +47,13 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 73, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[Projectile.owner] = 7; } } } diff --git a/Projectiles/Melee/ShortNightBeam.cs b/Projectiles/Melee/ShortNightBeam.cs index 637e4c97a8..460000d45f 100644 --- a/Projectiles/Melee/ShortNightBeam.cs +++ b/Projectiles/Melee/ShortNightBeam.cs @@ -14,32 +14,32 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 60; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.timeLeft = 60; aiType = ProjectileID.TerraBeam; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.1f / 255f); + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.1f / 255f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 21, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 21, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 55) + if (Projectile.timeLeft > 55) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -47,13 +47,13 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 21, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 21, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[Projectile.owner] = 7; } } } diff --git a/Projectiles/Melee/ShortTerraBeam.cs b/Projectiles/Melee/ShortTerraBeam.cs index 1b02f69623..5bb959a3a7 100644 --- a/Projectiles/Melee/ShortTerraBeam.cs +++ b/Projectiles/Melee/ShortTerraBeam.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -15,53 +16,53 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 4; - projectile.timeLeft = 120; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 4; + Projectile.timeLeft = 120; aiType = ProjectileID.TerraBeam; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.75f / 255f, 0f); + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.75f / 255f, 0f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 115) + if (Projectile.timeLeft > 115) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[Projectile.owner] = 7; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); int num3; for (int num795 = 4; num795 < 31; num795 = num3 + 1) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / (float)num795); + float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[num798]; dust.velocity *= 0.05f; num3 = num795; diff --git a/Projectiles/Melee/SolarNeedle.cs b/Projectiles/Melee/SolarNeedle.cs index 6d94186d22..9a79972880 100644 --- a/Projectiles/Melee/SolarNeedle.cs +++ b/Projectiles/Melee/SolarNeedle.cs @@ -8,6 +8,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -17,45 +18,45 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Solar Needle"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } const float MaxTime = 30; - public float Timer => MaxTime - projectile.timeLeft; - public ref float Empowered => ref projectile.ai[0]; + public float Timer => MaxTime - Projectile.timeLeft; + public ref float Empowered => ref Projectile.ai[0]; public override void SetDefaults() { - projectile.width = projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = (int)MaxTime; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = (int)MaxTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 44f * projectile.scale; - Vector2 start = -Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * 16f; + float bladeLenght = 44f * Projectile.scale; + Vector2 start = -Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 16f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center + start, projectile.Center + start + Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint); } public override void AI() { - projectile.scale = 2.4f; - projectile.Opacity = 0.6f; - Lighting.AddLight(projectile.Center, 0.75f, 1f, 0.24f); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.scale = 2.4f; + Projectile.Opacity = 0.6f; + Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.velocity *= (1 - (float)Math.Pow(Timer / MaxTime, 3)); + Projectile.velocity *= (1 - (float)Math.Pow(Timer / MaxTime, 3)); if (Main.rand.NextBool(3)) { - int dustTrail = Dust.NewDust(projectile.Center, 14, 14, 66, projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + int dustTrail = Dust.NewDust(Projectile.Center, 14, 14, 66, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); Main.dust[dustTrail].noGravity = true; } @@ -64,16 +65,16 @@ namespace CalamityMod.Projectiles.Melee int dustType = Main.rand.Next(3); dustType = dustType == 0 ? 15 : dustType == 1 ? 57 : 58; - Dust.NewDust(projectile.Center, 14, 14, dustType, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 150, default, 1.3f); + Dust.NewDust(Projectile.Center, 14, 14, dustType, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 150, default, 1.3f); } - if (projectile.velocity.Length() < 1.0f) - projectile.Kill(); + if (Projectile.velocity.Length() < 1.0f) + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 35) + if (Projectile.timeLeft > 35) return false; Texture2D texture = GetTexture("CalamityMod/Projectiles/Melee/SolarNeedle"); @@ -91,13 +92,13 @@ namespace CalamityMod.Projectiles.Melee for (float i = 0; i < 1; i += 0.125f) { - spriteBatch.Draw(texture, projectile.Center + (i * MathHelper.TwoPi + projectile.rotation).ToRotationVector2() * outlineThickness - Main.screenPosition, null, outlineColor, projectile.rotation, texture.Size() / 2f, projectile.scale, 0f, 0f); + spriteBatch.Draw(texture, Projectile.Center + (i * MathHelper.TwoPi + Projectile.rotation).ToRotationVector2() * outlineThickness - Main.screenPosition, null, outlineColor, Projectile.rotation, texture.Size() / 2f, Projectile.scale, 0f, 0f); } CalamityUtils.ExitShaderRegion(spriteBatch); } - DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -110,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee Color color = Main.hslToRgb((Main.GlobalTime * 0.6f) % 1, 1, 0.85f); float rotation = Main.GlobalTime * 8f; - Vector2 sparkCenter = projectile.Center - Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * 30.5f - Main.screenPosition; + Vector2 sparkCenter = Projectile.Center - Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 30.5f - Main.screenPosition; spriteBatch.Draw(bloomTexture, sparkCenter, null, color* 0.5f, 0, bloomTexture.Size() / 2f, 4 * properBloomSize, SpriteEffects.None, 0); spriteBatch.Draw(starTexture, sparkCenter, null, color * 0.5f, rotation + MathHelper.PiOver4, starTexture.Size() / 2f, 2 * 0.75f, SpriteEffects.None, 0); @@ -125,18 +126,18 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.DD2_WitherBeastDeath, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath, Projectile.Center); for (int i = 0; i < 10; i++) { Vector2 particleSpeed = Main.rand.NextVector2CircularEdge(1, 1) * Main.rand.NextFloat(1.2f, 2.3f); - Particle energyLeak = new SquishyLightParticle(projectile.Center + Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * 40f, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Cyan, 60, 1, 1.5f, hueShift: 0.02f); + Particle energyLeak = new SquishyLightParticle(Projectile.Center + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 40f, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Cyan, 60, 1, 1.5f, hueShift: 0.02f); GeneralParticleHandler.SpawnParticle(energyLeak); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : projectile.Center + projectile.rotation.ToRotationVector2() * 60f; + Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f; for (int i = 0; i < 10; i++) { Vector2 particleSpeed = Main.rand.NextVector2CircularEdge(1, 1) * Main.rand.NextFloat(2.6f, 4f); diff --git a/Projectiles/Melee/SolsticeBeam.cs b/Projectiles/Melee/SolsticeBeam.cs index 0526bb5abe..eef623c430 100644 --- a/Projectiles/Melee/SolsticeBeam.cs +++ b/Projectiles/Melee/SolsticeBeam.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class SolsticeBeam : ModProjectile @@ -16,41 +17,41 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.ai[1] == 0f) + Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0.5f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item60, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item60, Projectile.position); } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) + Projectile.scale -= 0.02f; + Projectile.alpha += 30; + if (Projectile.alpha >= 250) { - projectile.alpha = 255; - projectile.localAI[0] = 1f; + Projectile.alpha = 255; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) + Projectile.scale += 0.02f; + Projectile.alpha -= 30; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[0] = 0f; + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; } } int dustType = 0; @@ -92,7 +93,7 @@ namespace CalamityMod.Projectiles.Melee } if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f); Main.dust[dust].noGravity = true; } } @@ -125,16 +126,16 @@ namespace CalamityMod.Projectiles.Melee blue = 250; break; } - return new Color(red, green, blue, projectile.alpha); + return new Color(red, green, blue, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -177,16 +178,16 @@ namespace CalamityMod.Projectiles.Melee }); break; } - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int num795 = 0; num795 < 27; num795++) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, dustType, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / (float)num795); + float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Dust dust = Main.dust[num798]; dust.noGravity = true; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, dustType, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust.velocity *= 0.05f; } } diff --git a/Projectiles/Melee/SoulScythe.cs b/Projectiles/Melee/SoulScythe.cs index ecdb9b4b4e..dc65b6f195 100644 --- a/Projectiles/Melee/SoulScythe.cs +++ b/Projectiles/Melee/SoulScythe.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -12,48 +13,48 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 18; - projectile.alpha = 55; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 420; - projectile.ignoreWater = true; - projectile.tileCollide = false; + Projectile.width = 50; + Projectile.height = 50; + Projectile.aiStyle = 18; + Projectile.alpha = 55; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.timeLeft = 420; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; aiType = ProjectileID.DeathSickle; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.5f, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[Projectile.owner] = 6; target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(BuffID.CursedInferno, 90); if (target.life <= (target.lifeMax * 0.15f)) { - Main.PlaySound(SoundID.Item14, projectile.position); - if (projectile.owner == Main.myPlayer) + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(target.Center.X, target.Center.Y, Projectile.velocity.X * 0f, Projectile.velocity.Y * 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/SoulScytheExplosion.cs b/Projectiles/Melee/SoulScytheExplosion.cs index 85ebf68df2..60db2f39e9 100644 --- a/Projectiles/Melee/SoulScytheExplosion.cs +++ b/Projectiles/Melee/SoulScytheExplosion.cs @@ -17,25 +17,25 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 60; - projectile.height = 60; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.timeLeft = 5; + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.timeLeft = 5; } public override void AI() { - if (projectile.timeLeft == 5) + if (Projectile.timeLeft == 5) { for (int num621 = 0; num621 < 30; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -45,10 +45,10 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 50; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Melee/Spark.cs b/Projectiles/Melee/Spark.cs index 9d14e8a39b..eca89825dd 100644 --- a/Projectiles/Melee/Spark.cs +++ b/Projectiles/Melee/Spark.cs @@ -14,47 +14,47 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.melee = true; + Projectile.width = 6; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + Projectile.velocity.X = Projectile.velocity.X * -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + Projectile.rotation += Projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[num199]; expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; @@ -74,14 +74,14 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + Projectile.velocity.X = Projectile.velocity.X * 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) + Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } diff --git a/Projectiles/Melee/SpatialSpear.cs b/Projectiles/Melee/SpatialSpear.cs index b9f6f9d3df..35ef41d90f 100644 --- a/Projectiles/Melee/SpatialSpear.cs +++ b/Projectiles/Melee/SpatialSpear.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class SpatialSpear : ModProjectile @@ -16,68 +17,68 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 90; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 90; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.05f, 1f, 0.05f); - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver4; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 30f) + Lighting.AddLight(Projectile.Center, 0.05f, 1f, 0.05f); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 30f) { - projectile.ai[0] = 30f; - projectile.velocity.Y += 0.1f; - if (projectile.velocity.Y > 16f) + Projectile.ai[0] = 30f; + Projectile.velocity.Y += 0.1f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } - projectile.velocity.X *= 0.98f; + Projectile.velocity.X *= 0.98f; } - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) + Projectile.scale -= 0.01f; + Projectile.alpha += 15; + if (Projectile.alpha >= 125) { - projectile.alpha = 130; - projectile.localAI[1] = 1f; + Projectile.alpha = 130; + Projectile.localAI[1] = 1f; } } - else if (projectile.localAI[1] == 1f) + else if (Projectile.localAI[1] == 1f) { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[1] = 0f; + Projectile.alpha = 0; + Projectile.localAI[1] = 0f; } } if (Main.rand.NextBool(8)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 30f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 30f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; int numProj = 2; float rotation = MathHelper.ToRadians(10); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj + 1; i++) { - Vector2 perturbedSpeed = projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } } } @@ -85,11 +86,11 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 85) + if (Projectile.timeLeft > 85) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -102,16 +103,16 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int num795 = 4; num795 < 12; num795++) { - float num796 = projectile.oldVelocity.X * (30f / num795); - float num797 = projectile.oldVelocity.Y * (30f / num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / num795); + float num797 = Projectile.oldVelocity.Y * (30f / num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[num798]; dust.velocity *= 0.05f; } diff --git a/Projectiles/Melee/SpatialSpear2.cs b/Projectiles/Melee/SpatialSpear2.cs index ad71a3ec45..46daaea2b2 100644 --- a/Projectiles/Melee/SpatialSpear2.cs +++ b/Projectiles/Melee/SpatialSpear2.cs @@ -16,57 +16,57 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 2; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 2; + Projectile.timeLeft = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.05f, 0.05f, 1f); - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver4; - if (projectile.localAI[1] == 0f) + Lighting.AddLight(Projectile.Center, 0.05f, 0.05f, 1f); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; + if (Projectile.localAI[1] == 0f) { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) + Projectile.scale -= 0.01f; + Projectile.alpha += 15; + if (Projectile.alpha >= 125) { - projectile.alpha = 130; - projectile.localAI[1] = 1f; + Projectile.alpha = 130; + Projectile.localAI[1] = 1f; } } - else if (projectile.localAI[1] == 1f) + else if (Projectile.localAI[1] == 1f) { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[1] = 0f; + Projectile.alpha = 0; + Projectile.localAI[1] = 0f; } } if (Main.rand.NextBool(8)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 30f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 30f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; int numProj = 2; float rotation = MathHelper.ToRadians(10); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj + 1; i++) { - Vector2 perturbedSpeed = projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } } } @@ -74,11 +74,11 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 55) + if (Projectile.timeLeft > 55) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -93,13 +93,13 @@ namespace CalamityMod.Projectiles.Melee { for (int num795 = 4; num795 < 12; num795++) { - float num796 = projectile.oldVelocity.X * (30f / num795); - float num797 = projectile.oldVelocity.Y * (30f / num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / num795); + float num797 = Projectile.oldVelocity.Y * (30f / num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 56, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 56, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[num798]; dust.velocity *= 0.05f; } diff --git a/Projectiles/Melee/SpatialSpear3.cs b/Projectiles/Melee/SpatialSpear3.cs index 67a8389742..0cbfae4389 100644 --- a/Projectiles/Melee/SpatialSpear3.cs +++ b/Projectiles/Melee/SpatialSpear3.cs @@ -16,55 +16,55 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 40; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 40; } public override void AI() { - Lighting.AddLight(projectile.Center, 1f, 0.05f, 0.05f); - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver4; - if (projectile.localAI[1] == 0f) + Lighting.AddLight(Projectile.Center, 1f, 0.05f, 0.05f); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; + if (Projectile.localAI[1] == 0f) { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) + Projectile.scale -= 0.01f; + Projectile.alpha += 15; + if (Projectile.alpha >= 125) { - projectile.alpha = 130; - projectile.localAI[1] = 1f; + Projectile.alpha = 130; + Projectile.localAI[1] = 1f; } } - else if (projectile.localAI[1] == 1f) + else if (Projectile.localAI[1] == 1f) { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[1] = 0f; + Projectile.alpha = 0; + Projectile.localAI[1] = 0f; } } if (Main.rand.NextBool(8)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 73, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 30f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 30f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; int numProj = 2; float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj + 1; i++) { - Vector2 perturbedSpeed = projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } } } @@ -72,11 +72,11 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 35) + if (Projectile.timeLeft > 35) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -91,13 +91,13 @@ namespace CalamityMod.Projectiles.Melee { for (int num795 = 4; num795 < 12; num795++) { - float num796 = projectile.oldVelocity.X * (30f / num795); - float num797 = projectile.oldVelocity.Y * (30f / num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / num795); + float num797 = Projectile.oldVelocity.Y * (30f / num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[num798]; dust.velocity *= 0.05f; } diff --git a/Projectiles/Melee/SpatialSpear4.cs b/Projectiles/Melee/SpatialSpear4.cs index e97cd62ad2..b634cd4678 100644 --- a/Projectiles/Melee/SpatialSpear4.cs +++ b/Projectiles/Melee/SpatialSpear4.cs @@ -16,52 +16,52 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 25; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 25; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.05f); - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver4; - if (projectile.localAI[1] == 0f) + Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0.05f); + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; + if (Projectile.localAI[1] == 0f) { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) + Projectile.scale -= 0.01f; + Projectile.alpha += 15; + if (Projectile.alpha >= 125) { - projectile.alpha = 130; - projectile.localAI[1] = 1f; + Projectile.alpha = 130; + Projectile.localAI[1] = 1f; } } - else if (projectile.localAI[1] == 1f) + else if (Projectile.localAI[1] == 1f) { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[1] = 0f; + Projectile.alpha = 0; + Projectile.localAI[1] = 0f; } } if (Main.rand.NextBool(8)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 20) + if (Projectile.timeLeft > 20) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -76,13 +76,13 @@ namespace CalamityMod.Projectiles.Melee { for (int num795 = 4; num795 < 12; num795++) { - float num796 = projectile.oldVelocity.X * (30f / num795); - float num797 = projectile.oldVelocity.Y * (30f / num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 244, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / num795); + float num797 = Projectile.oldVelocity.Y * (30f / num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 244, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 244, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 244, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[num798]; dust.velocity *= 0.05f; } diff --git a/Projectiles/Melee/Spears/AmidiasTridentProj.cs b/Projectiles/Melee/Spears/AmidiasTridentProj.cs index 3beca2fd09..83895a1eca 100644 --- a/Projectiles/Melee/Spears/AmidiasTridentProj.cs +++ b/Projectiles/Melee/Spears/AmidiasTridentProj.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 70; - projectile.aiStyle = 19; - projectile.melee = true; - projectile.timeLeft = 90; - projectile.height = 70; - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; + Projectile.width = 70; + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 90; + Projectile.height = 70; + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.hide = true; } public override float InitialSpeed => 3f; @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float ForwardSpeed => 0.75f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 0.8f, projectile.velocity.Y * 0.8f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, Projectile.velocity.X * 0.8f, Projectile.velocity.Y * 0.8f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.85f, Projectile.owner, 0f, 0f); }; } } diff --git a/Projectiles/Melee/Spears/AstralPikeProj.cs b/Projectiles/Melee/Spears/AstralPikeProj.cs index a0dbd9d3b8..22f6eaf00e 100644 --- a/Projectiles/Melee/Spears/AstralPikeProj.cs +++ b/Projectiles/Melee/Spears/AstralPikeProj.cs @@ -16,18 +16,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether projectile is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + Projectile.width = 40; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether projectile is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 40; //The height of the .png file in pixels divided by 2. + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; @@ -36,20 +36,20 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void ExtraBehavior() { if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - target.immune[projectile.owner] = 6; + target.immune[Projectile.owner] = 6; if (crit) { for (int i = 0; i < 3; i++) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile star = CalamityUtils.ProjectileBarrage(projectile.Center, target.Center, Main.rand.NextBool(), 800f, 800f, 800f, 800f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), 1f, projectile.owner, true); + Projectile star = CalamityUtils.ProjectileBarrage(Projectile.Center, target.Center, Main.rand.NextBool(), 800f, 800f, 800f, 800f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 1f, Projectile.owner, true); if (star.whoAmI.WithinBounds(Main.maxProjectiles)) { star.Calamity().forceMelee = true; diff --git a/Projectiles/Melee/Spears/BansheeHookProj.cs b/Projectiles/Melee/Spears/BansheeHookProj.cs index 021f333c99..d6fc362d7c 100644 --- a/Projectiles/Melee/Spears/BansheeHookProj.cs +++ b/Projectiles/Melee/Spears/BansheeHookProj.cs @@ -16,59 +16,59 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 40; - projectile.melee = true; - projectile.timeLeft = 90; - projectile.height = 40; - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.alpha = 255; + Projectile.width = 40; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 90; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.hide = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.alpha = 255; } public override SpearType SpearAiType => SpearType.GhastlyGlaiveSpear; public override float TravelSpeed => 22f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(projectile.Center + projectile.velocity * 0.5f, - projectile.velocity * 0.8f, ModContent.ProjectileType(), - projectile.damage, projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center + Projectile.velocity * 0.5f, + Projectile.velocity * 0.8f, ModContent.ProjectileType(), + Projectile.damage, Projectile.knockBack * 0.85f, Projectile.owner, 0f, 0f); }; public override void ExtraBehavior() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; Vector2 playerRelativePoint = player.RotatedRelativePoint(player.MountedCenter); float itemAnimationCompletion = player.itemAnimation / (float)player.itemAnimationMax; float completionAsAngle = (1f - itemAnimationCompletion) * MathHelper.TwoPi; - float startingVelocityRotation = projectile.velocity.ToRotation(); - float startingVelocitySpeed = projectile.velocity.Length(); + float startingVelocityRotation = Projectile.velocity.ToRotation(); + float startingVelocitySpeed = Projectile.velocity.Length(); // The motion moves in an imaginary circle, but the cane does not because it relies on // its ai[0] X multiplier, giving it the "swiping" motion. Vector2 flatVelocity = Vector2.UnitX.RotatedBy(MathHelper.Pi + completionAsAngle) * - new Vector2(startingVelocitySpeed, projectile.ai[0]); + new Vector2(startingVelocitySpeed, Projectile.ai[0]); Vector2 destination = playerRelativePoint + flatVelocity.RotatedBy(startingVelocityRotation) + new Vector2(startingVelocitySpeed + TravelSpeed + 40f, 0f).RotatedBy(startingVelocityRotation); Vector2 directionTowardsEnd = player.SafeDirectionTo(destination, Vector2.UnitX * player.direction); - Vector2 initalVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY); + Vector2 initalVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); float dustCount = 2f; int i = 0; while (i < dustCount) { - Dust dust = Dust.NewDustDirect(projectile.Center, 14, 14, 60, 0f, 0f, 110, default, 1f); + Dust dust = Dust.NewDustDirect(Projectile.Center, 14, 14, 60, 0f, 0f, 110, default, 1f); dust.velocity = player.SafeDirectionTo(dust.position) * 2f; - dust.position = projectile.Center + + dust.position = Projectile.Center + initalVelocity.RotatedBy(completionAsAngle * 2f + i / dustCount * MathHelper.TwoPi) * 10f; dust.scale = 1f + Main.rand.NextFloat(0.6f); dust.velocity += initalVelocity * 3f; @@ -77,9 +77,9 @@ namespace CalamityMod.Projectiles.Melee.Spears } if (Main.rand.NextBool(3)) { - Dust dust = Dust.NewDustDirect(projectile.Center, 20, 20, 60, 0f, 0f, 110, default, 1f); + Dust dust = Dust.NewDustDirect(Projectile.Center, 20, 20, 60, 0f, 0f, 110, default, 1f); dust.velocity = player.SafeDirectionTo(dust.position) * 2f; - dust.position = projectile.Center + directionTowardsEnd * -110f; + dust.position = Projectile.Center + directionTowardsEnd * -110f; dust.scale = 0.45f + Main.rand.NextFloat(0.4f); dust.fadeIn = 0.7f + Main.rand.NextFloat(0.4f); dust.noGravity = true; @@ -89,45 +89,45 @@ namespace CalamityMod.Projectiles.Melee.Spears public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 drawPosition = projectile.position + new Vector2(projectile.width, projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D alternateHookTexture = projectile.spriteDirection == -1 ? ModContent.GetTexture("CalamityMod/Projectiles/Melee/Spears/BansheeHookAlt") : Main.projectileTexture[projectile.type]; - Vector2 origin = new Vector2(projectile.spriteDirection == 1 ? alternateHookTexture.Width + 8f : -8f, -8f); + Vector2 drawPosition = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D alternateHookTexture = Projectile.spriteDirection == -1 ? ModContent.Request("CalamityMod/Projectiles/Melee/Spears/BansheeHookAlt") : Main.projectileTexture[Projectile.type]; + Vector2 origin = new Vector2(Projectile.spriteDirection == 1 ? alternateHookTexture.Width + 8f : -8f, -8f); spriteBatch.Draw(alternateHookTexture, drawPosition, null, - new Color(255, 255, 255, 127), projectile.rotation, - origin, projectile.scale, SpriteEffects.None, 0f); + new Color(255, 255, 255, 127), Projectile.rotation, + origin, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 drawPosition = projectile.position + new Vector2(projectile.width, projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture = projectile.spriteDirection == -1 ? ModContent.GetTexture("CalamityMod/Projectiles/Melee/Spears/BansheeHookAltGlow") : ModContent.GetTexture("CalamityMod/Projectiles/Melee/Spears/BansheeHookGlow"); - Vector2 origin = new Vector2(projectile.spriteDirection == 1 ? texture.Width - -8f : -8f, -8f); //-8 -8 - spriteBatch.Draw(texture, drawPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + Vector2 drawPosition = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture = Projectile.spriteDirection == -1 ? ModContent.Request("CalamityMod/Projectiles/Melee/Spears/BansheeHookAltGlow") : ModContent.Request("CalamityMod/Projectiles/Melee/Spears/BansheeHookGlow"); + Vector2 origin = new Vector2(Projectile.spriteDirection == 1 ? texture.Width - -8f : -8f, -8f); //-8 -8 + spriteBatch.Draw(texture, drawPosition, null, Color.White, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - float angle = projectile.rotation - MathHelper.PiOver4 * Math.Sign(projectile.velocity.X) + - (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + float angle = Projectile.rotation - MathHelper.PiOver4 * Math.Sign(Projectile.velocity.X) + + (Projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; float areaCheck = -95f; float reduntantVariable = 0f; if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), - targetHitbox.Size(), projectile.Center, - projectile.Center + angle.ToRotationVector2() * areaCheck, - (TravelSpeed + 1f) * projectile.scale, ref reduntantVariable)) + targetHitbox.Size(), Projectile.Center, + Projectile.Center + angle.ToRotationVector2() * areaCheck, + (TravelSpeed + 1f) * Projectile.scale, ref reduntantVariable)) return true; return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * 0.25), - 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + 10f, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); } } } diff --git a/Projectiles/Melee/Spears/BrimlanceProj.cs b/Projectiles/Melee/Spears/BrimlanceProj.cs index d1fa2963a9..20ce126a3b 100644 --- a/Projectiles/Melee/Spears/BrimlanceProj.cs +++ b/Projectiles/Melee/Spears/BrimlanceProj.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.Calamity().trueMelee = true; + Projectile.width = 40; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 40; //The height of the .png file in pixels divided by 2. + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.hide = true; + Projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; @@ -36,21 +36,21 @@ namespace CalamityMod.Projectiles.Melee.Spears { if (Main.rand.NextBool(4)) { - int idx = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.direction * 2, 0f, 150, default, 1f); + int idx = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.direction * 2, 0f, 150, default, 1f); Main.dust[idx].noGravity = true; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; - if (projectile.owner == Main.myPlayer) + target.immune[Projectile.owner] = 7; + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.65), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.65), knockback, Main.myPlayer); for (int i = 0; i < 3; i++) { Vector2 fireVelocity = new Vector2(0f, Main.rand.NextFloat(7f, 10f)).RotatedByRandom(MathHelper.TwoPi); - Projectile.NewProjectile(target.Center, fireVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(target.Center, fireVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs index 0a31aa733c..d1233fa1d1 100644 --- a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs +++ b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs @@ -13,18 +13,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether projectile is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + Projectile.width = 40; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether projectile is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 40; //The height of the .png file in pixels divided by 2. + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; @@ -33,18 +33,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void ExtraBehavior() { if (Main.rand.NextBool(4)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[Projectile.owner] = 7; target.AddBuff(ModContent.BuffType(), 300); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 4; i++) { - int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity * 0.5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner); + int proj = Projectile.NewProjectile(Projectile.Center, Projectile.velocity * 0.5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); Main.projectile[proj].extraUpdates += i; } } diff --git a/Projectiles/Melee/Spears/EarthenPikeSpear.cs b/Projectiles/Melee/Spears/EarthenPikeSpear.cs index 2c2ea50d3f..eca700144e 100644 --- a/Projectiles/Melee/Spears/EarthenPikeSpear.cs +++ b/Projectiles/Melee/Spears/EarthenPikeSpear.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether projectile is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.scale = 1.5f; - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; + Projectile.width = 40; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether projectile is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 40; //The height of the .png file in pixels divided by 2. + Projectile.scale = 1.5f; + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; } public override float InitialSpeed => 3f; @@ -34,19 +34,19 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void ExtraBehavior() { if (Main.rand.NextBool(4)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 32, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 6f) { - projectile.localAI[0] = 0f; - if (Main.myPlayer == projectile.owner) + Projectile.localAI[0] = 0f; + if (Main.myPlayer == Projectile.owner) { - float velocityY = projectile.velocity.Y * 1.25f; + float velocityY = Projectile.velocity.Y * 1.25f; if (velocityY < 0.1f) velocityY = 0.1f; - int proj = Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X * 1.25f, velocityY, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + int proj = Projectile.NewProjectile(Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, + Projectile.velocity.X * 1.25f, velocityY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMelee = true; } @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; + target.immune[Projectile.owner] = 8; target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs index e7c78c7c78..8b8226aad1 100644 --- a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs +++ b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs @@ -16,18 +16,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 95; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 95; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + Projectile.width = 95; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 95; //The height of the .png file in pixels divided by 2. + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; @@ -35,9 +35,9 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void ExtraBehavior() { if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.NextBool(3) ? 16 : 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 127, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - Vector2 goreVec = projectile.Center + projectile.velocity; + Vector2 goreVec = Projectile.Center + Projectile.velocity; if (Main.rand.NextBool(8)) { int smoke = Gore.NewGore(goreVec, default, Main.rand.Next(375, 378), 1f); @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[Projectile.owner] = 6; OnHitEffects(target.Center, crit); target.AddBuff(BuffID.OnFire, 240); } @@ -60,9 +60,9 @@ namespace CalamityMod.Projectiles.Melee.Spears private void OnHitEffects(Vector2 targetPos, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int boom = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int boom = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (boom.WithinBounds(Main.maxProjectiles)) Main.projectile[boom].Calamity().forceMelee = true; } @@ -70,9 +70,9 @@ namespace CalamityMod.Projectiles.Melee.Spears { for (int i = 0; i < 2; i++) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 2f, projectile.owner, true); + CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 2f, Projectile.owner, true); } } } diff --git a/Projectiles/Melee/Spears/FulgurationHalberdProj.cs b/Projectiles/Melee/Spears/FulgurationHalberdProj.cs index af41c624f1..5ae00de262 100644 --- a/Projectiles/Melee/Spears/FulgurationHalberdProj.cs +++ b/Projectiles/Melee/Spears/FulgurationHalberdProj.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether projectile is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.scale = 1.5f; - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + Projectile.width = 40; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether projectile is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 40; //The height of the .png file in pixels divided by 2. + Projectile.scale = 1.5f; + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float ForwardSpeed => 0.95f; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; + target.immune[Projectile.owner] = 8; target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 0576d6d1a2..39e23f1c9e 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -12,20 +12,20 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.Calamity().trueMelee = true; + Projectile.width = 40; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 40; //The height of the .png file in pixels divided by 2. + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; + Projectile.Calamity().trueMelee = true; } // These numbers sure are common, huh? yeah, they are @@ -36,17 +36,17 @@ namespace CalamityMod.Projectiles.Melee.Spears { if (Main.rand.NextBool(4)) { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, projectile.direction * 2, 0f, 150, default, 1f); + int num = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 60, Projectile.direction * 2, 0f, 150, default, 1f); Main.dust[num].noGravity = true; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) + if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) return; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.statLife += 1; player.HealEffect(1); } diff --git a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs index 784facd3d5..bb2af257de 100644 --- a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs +++ b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 54; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 54; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; + Projectile.width = 54; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 54; //The height of the .png file in pixels divided by 2. + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; } public override float InitialSpeed => 3f; @@ -31,15 +31,15 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void ExtraBehavior() { if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 59, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 59, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 6f) { - projectile.localAI[0] = 0f; - if (Main.myPlayer == projectile.owner) + Projectile.localAI[0] = 0f; + if (Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, + Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs index cfaf6d0f24..ed0c86b375 100644 --- a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs +++ b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; + Projectile.width = 40; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 40; //The height of the .png file in pixels divided by 2. + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; } public override float InitialSpeed => 3f; @@ -34,12 +34,12 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float ForwardSpeed => 0.95f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, ModContent.ProjectileType(), (int)(projectile.damage * 0.65), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, Projectile.velocity.X * 2.4f, Projectile.velocity.Y * 2.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.65), Projectile.knockBack * 0.85f, Projectile.owner, 0f, 0f); }; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; + target.immune[Projectile.owner] = 8; OnHitEffects(target.Center, crit); target.AddBuff(BuffID.Venom, 300); } @@ -54,9 +54,9 @@ namespace CalamityMod.Projectiles.Melee.Spears { if (crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile petal = CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, true); + Projectile petal = CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ProjectileID.FlowerPetal, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, true); if (petal.whoAmI.WithinBounds(Main.maxProjectiles)) { petal.Calamity().forceMelee = true; diff --git a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs index b1d858dc5f..b6001d2a21 100644 --- a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs +++ b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs @@ -15,19 +15,19 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 40; - projectile.aiStyle = 19; - projectile.melee = true; - projectile.timeLeft = 90; - projectile.height = 40; - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + Projectile.width = 40; + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 90; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; } public override float InitialSpeed => 3f; @@ -35,8 +35,8 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float ForwardSpeed => 0.95f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X * 3.5f, projectile.velocity.Y * 3.5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, + Projectile.velocity.X * 3.5f, Projectile.velocity.Y * 3.5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.85f, Projectile.owner, 0f, 0f); }; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs index 4f8192da22..dda3410b47 100644 --- a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs +++ b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs @@ -10,18 +10,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 50; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 50; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + Projectile.width = 50; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 50; //The height of the .png file in pixels divided by 2. + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/NadirSpear.cs b/Projectiles/Melee/Spears/NadirSpear.cs index dbef07797b..93a02ea729 100644 --- a/Projectiles/Melee/Spears/NadirSpear.cs +++ b/Projectiles/Melee/Spears/NadirSpear.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Projectiles.BaseProjectiles; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee.Spears { public class NadirSpear : BaseSpearProjectile @@ -15,17 +16,17 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 55; - projectile.height = 55; - projectile.aiStyle = 19; - projectile.melee = true; - projectile.timeLeft = 90; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + Projectile.width = 55; + Projectile.height = 55; + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 90; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; } public override float InitialSpeed => 5.5f; @@ -33,15 +34,15 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float ForwardSpeed => 1.1f; public override Action EffectBeforeReelback => (proj) => { - int damage = projectile.damage / 4; - float kb = projectile.knockBack * 0.5f; - Vector2 projPos = projectile.Center + projectile.velocity; - Vector2 projVel = projectile.velocity * 0.75f; - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projPos, projVel, ModContent.ProjectileType(), damage, kb, projectile.owner, 0f, 0f); + int damage = Projectile.damage / 4; + float kb = Projectile.knockBack * 0.5f; + Vector2 projPos = Projectile.Center + Projectile.velocity; + Vector2 projVel = Projectile.velocity * 0.75f; + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(projPos, projVel, ModContent.ProjectileType(), damage, kb, Projectile.owner, 0f, 0f); // Play a screaming soul sound effect (unused Shadowflame Hex Doll noise) - Main.PlaySound(SoundID.Item104, projectile.Center); + SoundEngine.PlaySound(SoundID.Item104, Projectile.Center); // Create a circle of purple dust where the projectile comes out, looking like the edge of a portal int circleDust = 18; @@ -52,9 +53,9 @@ namespace CalamityMod.Projectiles.Melee.Spears float angle = i * (MathHelper.TwoPi / circleDust); Vector2 dustVel = baseDustVel.RotatedBy(angle); - int idx = Dust.NewDust(projectile.Center, 1, 1, dustID); + int idx = Dust.NewDust(Projectile.Center, 1, 1, dustID); Main.dust[idx].noGravity = true; - Main.dust[idx].position = projectile.Center; + Main.dust[idx].position = Projectile.Center; Main.dust[idx].velocity = dustVel; Main.dust[idx].scale = 2.4f; } @@ -65,8 +66,8 @@ namespace CalamityMod.Projectiles.Melee.Spears for (int i = 0; i < movingDust; ++i) { int dustID = Main.rand.NextBool(4) ? 27 : 118; - Vector2 corner = 0.5f * projectile.position + 0.5f * projectile.Center; - int idx = Dust.NewDust(corner, projectile.width / 2, projectile.height / 2, dustID); + Vector2 corner = 0.5f * Projectile.position + 0.5f * Projectile.Center; + int idx = Dust.NewDust(corner, Projectile.width / 2, Projectile.height / 2, dustID); Main.dust[idx].noGravity = true; Main.dust[idx].velocity = Vector2.Zero; diff --git a/Projectiles/Melee/Spears/SausageMakerSpear.cs b/Projectiles/Melee/Spears/SausageMakerSpear.cs index d2f7c8499f..ceeb761cc8 100644 --- a/Projectiles/Melee/Spears/SausageMakerSpear.cs +++ b/Projectiles/Melee/Spears/SausageMakerSpear.cs @@ -12,18 +12,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 44; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 42; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + Projectile.width = 44; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 42; //The height of the .png file in pixels divided by 2. + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; @@ -32,15 +32,15 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void ExtraBehavior() { if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 2; i++) { - Projectile.NewProjectile(projectile.Center, projectile.velocity * 1.2f, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Projectile.velocity * 1.2f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs index 59a817a738..c40c23add7 100644 --- a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs +++ b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs @@ -16,19 +16,19 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 7; + Projectile.width = 40; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 40; //The height of the .png file in pixels divided by 2. + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 7; } public override float InitialSpeed => 3f; @@ -36,14 +36,14 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float ForwardSpeed => 0.6f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, + Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); }; public override void ExtraBehavior() { if (Main.rand.NextBool(5)) { - int idx = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int idx = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, Projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[idx].noGravity = true; } } diff --git a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs index 083414ef43..acb72b72b8 100644 --- a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs +++ b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs @@ -14,17 +14,17 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether projectile is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; + Projectile.width = 40; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether projectile is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 40; //The height of the .png file in pixels divided by 2. + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; } public override float InitialSpeed => 3f; @@ -32,18 +32,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float ForwardSpeed => 0.95f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, ModContent.ProjectileType(), (int)(projectile.damage * 0.8), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, + Projectile.velocity.X * 2.4f, Projectile.velocity.Y * 2.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.85f, Projectile.owner, 0f, 0f); }; public override void ExtraBehavior() { if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 29, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 29, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; + target.immune[Projectile.owner] = 8; target.AddBuff(BuffID.Frostburn, 120); } } diff --git a/Projectiles/Melee/Spears/StreamGougeProj.cs b/Projectiles/Melee/Spears/StreamGougeProj.cs index d2a355d718..96a5ad9fbb 100644 --- a/Projectiles/Melee/Spears/StreamGougeProj.cs +++ b/Projectiles/Melee/Spears/StreamGougeProj.cs @@ -7,6 +7,7 @@ using System.IO; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee.Spears { @@ -14,13 +15,13 @@ namespace CalamityMod.Projectiles.Melee.Spears { public int Time; - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public float SpinCompletion => Utils.InverseLerp(0f, StreamGouge.SpinTime, Time, true); - public ref float InitialDirection => ref projectile.ai[0]; + public ref float InitialDirection => ref Projectile.ai[0]; - public ref float SpinDirection => ref projectile.ai[1]; + public ref float SpinDirection => ref Projectile.ai[1]; public override void SetStaticDefaults() { @@ -29,18 +30,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.penetrate = -1; - projectile.melee = true; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.hide = true; - projectile.timeLeft = 90000; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = projectile.MaxUpdates * 13; + Projectile.width = 40; + Projectile.height = 40; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.hide = true; + Projectile.timeLeft = 90000; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 13; } public override void SendExtraAI(BinaryWriter writer) @@ -57,34 +58,34 @@ namespace CalamityMod.Projectiles.Melee.Spears { // Play a strong slash sound on the first frame to accompany the spin. if (Time == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MeatySlash"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MeatySlash"), Projectile.Center); // Define the initial direction. if (InitialDirection == 0f) { - InitialDirection = projectile.velocity.ToRotation(); + InitialDirection = Projectile.velocity.ToRotation(); SpinDirection = Main.rand.NextBool().ToDirectionInt(); - projectile.netUpdate = true; + Projectile.netUpdate = true; } else { float stabOffset = (float)Math.Sin(Time / 3f) * 15f; float spearReach = MathHelper.Lerp(-10f, stabOffset + 90f, Utils.InverseLerp(0f, StreamGouge.SpearFireTime, Time - StreamGouge.SpinTime, true)); - projectile.velocity = InitialDirection.ToRotationVector2() * spearReach; + Projectile.velocity = InitialDirection.ToRotationVector2() * spearReach; } // Define the current rotation. - projectile.rotation = (float)Math.Pow(SpinCompletion, 0.82) * MathHelper.Pi * SpinDirection * 4f + InitialDirection - MathHelper.PiOver4 + MathHelper.Pi; + Projectile.rotation = (float)Math.Pow(SpinCompletion, 0.82) * MathHelper.Pi * SpinDirection * 4f + InitialDirection - MathHelper.PiOver4 + MathHelper.Pi; // Manipulate player variables. DeterminePlayerVariables(); // Create portals near the mouse once charged. - if (Main.myPlayer == projectile.owner && Time >= StreamGouge.SpinTime + StreamGouge.SpearFireTime && Time % 9f == 8f) + if (Main.myPlayer == Projectile.owner && Time >= StreamGouge.SpinTime + StreamGouge.SpearFireTime && Time % 9f == 8f) { Vector2 portalSpawnPosition = Main.MouseWorld + Main.rand.NextVector2Unit() * Main.rand.NextFloat(50f, 140f); Vector2 spearVelocity = (Main.MouseWorld - portalSpawnPosition).SafeNormalize(Vector2.UnitY); - Projectile.NewProjectile(portalSpawnPosition, spearVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(portalSpawnPosition, spearVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } Time++; @@ -93,38 +94,38 @@ namespace CalamityMod.Projectiles.Melee.Spears public void DeterminePlayerVariables() { bool spearStillInUse = Owner.channel && !Owner.noItems && !Owner.CCed; - Owner.direction = (Math.Cos(projectile.rotation - MathHelper.Pi + MathHelper.PiOver4) > 0f).ToDirectionInt(); - Owner.heldProj = projectile.whoAmI; + Owner.direction = (Math.Cos(Projectile.rotation - MathHelper.Pi + MathHelper.PiOver4) > 0f).ToDirectionInt(); + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = Owner.itemAnimation = 2; - Owner.itemRotation = CalamityUtils.WrapAngle90Degrees(MathHelper.WrapAngle(projectile.rotation - MathHelper.Pi + MathHelper.PiOver4)); - projectile.Center = Owner.Center; + Owner.itemRotation = CalamityUtils.WrapAngle90Degrees(MathHelper.WrapAngle(Projectile.rotation - MathHelper.Pi + MathHelper.PiOver4)); + Projectile.Center = Owner.Center; // Die if the spear is no longer in use. if (!spearStillInUse) - projectile.Kill(); + Projectile.Kill(); } public void DrawPortal(SpriteBatch spriteBatch, Vector2 drawPosition, float opacity) { - Texture2D portalTexture = ModContent.GetTexture("CalamityMod/Projectiles/Melee/StreamGougePortal"); + Texture2D portalTexture = ModContent.Request("CalamityMod/Projectiles/Melee/StreamGougePortal"); Vector2 origin = portalTexture.Size() * 0.5f; Color baseColor = Color.White; float rotation = Main.GlobalTime * 6f; // Black portal. Color color = Color.Lerp(baseColor, Color.Black, 0.55f).MultiplyRGB(Color.DarkGray) * opacity; - spriteBatch.Draw(portalTexture, drawPosition, null, color, rotation, origin, projectile.scale * 1.2f, SpriteEffects.None, 0f); - spriteBatch.Draw(portalTexture, drawPosition, null, color, -rotation, origin, projectile.scale * 1.2f, SpriteEffects.None, 0f); + spriteBatch.Draw(portalTexture, drawPosition, null, color, rotation, origin, Projectile.scale * 1.2f, SpriteEffects.None, 0f); + spriteBatch.Draw(portalTexture, drawPosition, null, color, -rotation, origin, Projectile.scale * 1.2f, SpriteEffects.None, 0f); spriteBatch.SetBlendState(BlendState.Additive); // Cyan portal. color = Color.Lerp(baseColor, Color.Cyan, 0.55f) * opacity * 1.6f; - spriteBatch.Draw(portalTexture, drawPosition, null, color, rotation * 0.6f, origin, projectile.scale * 1.2f, SpriteEffects.None, 0f); + spriteBatch.Draw(portalTexture, drawPosition, null, color, rotation * 0.6f, origin, Projectile.scale * 1.2f, SpriteEffects.None, 0f); // Magenta portal. color = Color.Lerp(baseColor, Color.Fuchsia, 0.55f) * opacity * 1.6f; - spriteBatch.Draw(portalTexture, drawPosition, null, color, rotation * -0.6f, origin, projectile.scale * 1.2f, SpriteEffects.None, 0f); + spriteBatch.Draw(portalTexture, drawPosition, null, color, rotation * -0.6f, origin, Projectile.scale * 1.2f, SpriteEffects.None, 0f); spriteBatch.SetBlendState(BlendState.AlphaBlend); } @@ -134,18 +135,18 @@ namespace CalamityMod.Projectiles.Melee.Spears // Draw the spin smear texture. if (SpinCompletion >= 0f && SpinCompletion < 1f) { - Texture2D smear = ModContent.GetTexture("CalamityMod/Particles/SemiCircularSmear"); + Texture2D smear = ModContent.Request("CalamityMod/Particles/SemiCircularSmear"); spriteBatch.EnterShaderRegion(BlendState.Additive); - float rotation = projectile.rotation - MathHelper.Pi / 5f; + float rotation = Projectile.rotation - MathHelper.Pi / 5f; if (SpinDirection == -1f) rotation += MathHelper.Pi; Color smearColor = Color.Fuchsia * CalamityUtils.Convert01To010(SpinCompletion) * 0.9f; Vector2 smearOrigin = smear.Size() * 0.5f; - spriteBatch.Draw(smear, Owner.Center - Main.screenPosition, null, smearColor, rotation, smearOrigin, projectile.scale * 1.45f, 0, 0); + spriteBatch.Draw(smear, Owner.Center - Main.screenPosition, null, smearColor, rotation, smearOrigin, Projectile.scale * 1.45f, 0, 0); spriteBatch.ExitShaderRegion(); } @@ -154,25 +155,25 @@ namespace CalamityMod.Projectiles.Melee.Spears bool portalIsInteractable = portalOpacity >= 1f; Vector2 portalDrawPosition = Owner.Center + InitialDirection.ToRotationVector2() * 130f - Main.screenPosition; - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; if (portalIsInteractable) { spriteBatch.EnterShaderRegion(); - Vector2 intersectionNormal = portalDrawPosition + Main.screenPosition - projectile.Center; - Vector2 worldOffset = projectile.rotation.ToRotationVector2() * -45f; - Vector2 intersectionOffset = (portalDrawPosition + Main.screenPosition - projectile.Center) * -1.5f; + Vector2 intersectionNormal = portalDrawPosition + Main.screenPosition - Projectile.Center; + Vector2 worldOffset = Projectile.rotation.ToRotationVector2() * -45f; + Vector2 intersectionOffset = (portalDrawPosition + Main.screenPosition - Projectile.Center) * -1.5f; GameShaders.Misc["CalamityMod:IntersectionClip"].Shader.Parameters["uIntersectionPosition"].SetValue(portalDrawPosition + intersectionOffset); GameShaders.Misc["CalamityMod:IntersectionClip"].Shader.Parameters["uIntersectionNormal"].SetValue(intersectionNormal); GameShaders.Misc["CalamityMod:IntersectionClip"].Shader.Parameters["uIntersectionCutoffDirection"].SetValue(-1f); - GameShaders.Misc["CalamityMod:IntersectionClip"].Shader.Parameters["uWorldPosition"].SetValue(projectile.Center - Main.screenPosition + worldOffset); + GameShaders.Misc["CalamityMod:IntersectionClip"].Shader.Parameters["uWorldPosition"].SetValue(Projectile.Center - Main.screenPosition + worldOffset); GameShaders.Misc["CalamityMod:IntersectionClip"].Shader.Parameters["uSize"].SetValue(texture.Size()); - GameShaders.Misc["CalamityMod:IntersectionClip"].Shader.Parameters["uRotation"].SetValue(projectile.rotation); + GameShaders.Misc["CalamityMod:IntersectionClip"].Shader.Parameters["uRotation"].SetValue(Projectile.rotation); GameShaders.Misc["CalamityMod:IntersectionClip"].Apply(); } - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() * 0.5f; - spriteBatch.Draw(texture, drawPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, origin, 1f, 0, 0); + spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, 1f, 0, 0); if (portalIsInteractable) spriteBatch.ExitShaderRegion(); diff --git a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs index 2e057840d9..98dacc4938 100644 --- a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs +++ b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs @@ -16,19 +16,19 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 46; //The width of the .png file in pixels divided by 2. - projectile.height = 46; //The height of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether projectile is a melee-class weapon. - projectile.timeLeft = 90; - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 15; + Projectile.width = 46; //The width of the .png file in pixels divided by 2. + Projectile.height = 46; //The height of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether projectile is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 15; } public override float InitialSpeed => 3f; @@ -36,12 +36,12 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float ForwardSpeed => 0.95f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, ModContent.ProjectileType(), (int)(projectile.damage * 0.65), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, Projectile.velocity.X * 2.4f, Projectile.velocity.Y * 2.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.65), Projectile.knockBack * 0.85f, Projectile.owner, 0f, 0f); }; public override void ExtraBehavior() { if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 33, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -63,9 +63,9 @@ namespace CalamityMod.Projectiles.Melee.Spears for (int i = 0; i < projAmt; ++i) { int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(25f, 35f), type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner); + CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(25f, 35f), type, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); } } } diff --git a/Projectiles/Melee/Spears/TerraLanceProjectile.cs b/Projectiles/Melee/Spears/TerraLanceProjectile.cs index 7172dcf6ab..e2fde262db 100644 --- a/Projectiles/Melee/Spears/TerraLanceProjectile.cs +++ b/Projectiles/Melee/Spears/TerraLanceProjectile.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 40; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 40; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; + Projectile.width = 40; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 40; //The height of the .png file in pixels divided by 2. + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; } public override float InitialSpeed => 3f; @@ -31,18 +31,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float ForwardSpeed => 0.95f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X * 1.4f, projectile.velocity.Y * 1.4f, ModContent.ProjectileType(), (int)(projectile.damage * 0.7), projectile.knockBack * 0.7f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, + Projectile.velocity.X * 1.4f, Projectile.velocity.Y * 1.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.7f, Projectile.owner, 0f, 0f); }; public override void ExtraBehavior() { if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; } } } diff --git a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs index 1963029dd3..8273a51915 100644 --- a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs +++ b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs @@ -14,17 +14,17 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 56; //The width of the .png file in pixels divided by 2. - projectile.aiStyle = 19; - projectile.melee = true; //Dictates whether this is a melee-class weapon. - projectile.timeLeft = 90; - projectile.height = 56; //The height of the .png file in pixels divided by 2. - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; + Projectile.width = 56; //The width of the .png file in pixels divided by 2. + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. + Projectile.timeLeft = 90; + Projectile.height = 56; //The height of the .png file in pixels divided by 2. + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; } public override float InitialSpeed => 3f; @@ -32,8 +32,8 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float ForwardSpeed => 0.95f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X * 1.6f, projectile.velocity.Y * 1.6f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y, + Projectile.velocity.X * 1.6f, Projectile.velocity.Y * 1.6f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); }; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Spears/YateveoBloomSpear.cs b/Projectiles/Melee/Spears/YateveoBloomSpear.cs index 0fecc2edee..913e3ec167 100644 --- a/Projectiles/Melee/Spears/YateveoBloomSpear.cs +++ b/Projectiles/Melee/Spears/YateveoBloomSpear.cs @@ -12,18 +12,18 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 40; - projectile.aiStyle = 19; - projectile.melee = true; - projectile.timeLeft = 90; - projectile.height = 40; - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + Projectile.width = 40; + Projectile.aiStyle = 19; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 90; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee.Spears default: break; } - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType, 0f, 0f); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, 0f, 0f); Main.dust[dust].noGravity = true; Main.dust[dust].scale = 1.5f; } diff --git a/Projectiles/Melee/SpineOfThanatosProjectile.cs b/Projectiles/Melee/SpineOfThanatosProjectile.cs index 0c354d7094..0a27d095e0 100644 --- a/Projectiles/Melee/SpineOfThanatosProjectile.cs +++ b/Projectiles/Melee/SpineOfThanatosProjectile.cs @@ -6,23 +6,24 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class SpineOfThanatosProjectile : ModProjectile { public List WhipPoints = new List(); - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public float CurrentBendFactor => MaximumBendFactor * CalamityUtils.Convert01To010(Time / Lifetime); - public Vector2 WhipEnd => projectile.Center + WhipOutwardness; + public Vector2 WhipEnd => Projectile.Center + WhipOutwardness; // This wrapper exists solely for clarity as to the definition of velocity in the context of this projectile. // You may notice that the Center property of this projectile is constantly set to be near the player. However, since // ShouldUpdatePosition is not overriden to false, it still gains its velocity as usual for 1 frame before being reset again. - public ref Vector2 WhipOutwardness => ref projectile.velocity; - public ref float Time => ref projectile.ai[0]; - public ref float SwingDirection => ref projectile.ai[1]; - public ref float InitialDirectionRotation => ref projectile.localAI[0]; + public ref Vector2 WhipOutwardness => ref Projectile.velocity; + public ref float Time => ref Projectile.ai[0]; + public ref float SwingDirection => ref Projectile.ai[1]; + public ref float InitialDirectionRotation => ref Projectile.localAI[0]; public const int Lifetime = 125; public const int FlyBackTime = 40; public const int FinalWhipRayShootRate = 10; @@ -32,18 +33,18 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 58; - projectile.height = 70; - projectile.scale = 0.75f; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.extraUpdates = 2; - projectile.timeLeft = Lifetime; - projectile.ownerHitCheck = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 22; + Projectile.width = 58; + Projectile.height = 70; + Projectile.scale = 0.75f; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.extraUpdates = 2; + Projectile.timeLeft = Lifetime; + Projectile.ownerHitCheck = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 22; } public void DetermineWhipPoints() @@ -63,13 +64,13 @@ namespace CalamityMod.Projectiles.Melee bendOffset *= CurrentBendFactor * CalamityUtils.Convert01To010(i / 12f); // Smoothly zero out the bending effects if the current position is near the owner. - bendOffset *= Utils.InverseLerp(0f, 300f, Owner.Distance(Vector2.Lerp(startingPosition, projectile.Center, i / 12f) + bendOffset), true); - initialPoints.Add(Vector2.Lerp(startingPosition, projectile.Center, i / 12f) + bendOffset); + bendOffset *= Utils.InverseLerp(0f, 300f, Owner.Distance(Vector2.Lerp(startingPosition, Projectile.Center, i / 12f) + bendOffset), true); + initialPoints.Add(Vector2.Lerp(startingPosition, Projectile.Center, i / 12f) + bendOffset); } - initialPoints.Add(projectile.Center); + initialPoints.Add(Projectile.Center); BezierCurve bezierCurve = new BezierCurve(initialPoints.ToArray()); - int totalChains = (int)(projectile.Distance(startingPosition) / 24f / projectile.scale); + int totalChains = (int)(Projectile.Distance(startingPosition) / 24f / Projectile.scale); totalChains = (int)MathHelper.Clamp(totalChains, 40f, 440f); WhipPoints = bezierCurve.GetPoints(totalChains); @@ -83,19 +84,19 @@ namespace CalamityMod.Projectiles.Melee // It uses vector transformation on a Z rotation matrix based on said rotation under the hood. // This is essentially just the pure mathematical definition of the RotatedBy method. Vector2 playerRotatedPosition = Owner.RotatedRelativePoint(Owner.MountedCenter); - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { if (!Owner.noItems && !Owner.CCed) HandleChannelMovement(playerRotatedPosition); else - projectile.Kill(); + Projectile.Kill(); } ManipulatePlayerValues(); // Create a bunch of prismatic lasers outward from the non-arcing whip right before it comes back // to its owner. - if (SwingDirection == 0f && projectile.timeLeft == FlyBackTime) + if (SwingDirection == 0f && Projectile.timeLeft == FlyBackTime) CreateBadassPrismExplosion(); Time++; } @@ -106,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee if (InitialDirectionRotation == 0f) InitialDirectionRotation = WhipOutwardness.ToRotation() - MathHelper.PiOver2; - float attackCompletionRatio = Utils.InverseLerp(Lifetime, FlyBackTime, projectile.timeLeft, true); + float attackCompletionRatio = Utils.InverseLerp(Lifetime, FlyBackTime, Projectile.timeLeft, true); // Normally swing from a "cone" to a collision area that causes both whips to collide. float baseSwingAngle = MathHelper.Lerp(-1.1f, 1.57f, 1f - attackCompletionRatio); @@ -115,7 +116,7 @@ namespace CalamityMod.Projectiles.Melee swingDirection = swingDirection.RotatedBy(InitialDirectionRotation); // If the whip is ready to return to its owner, have its outwardness approach the player again. - if (projectile.timeLeft < FlyBackTime) + if (Projectile.timeLeft < FlyBackTime) WhipOutwardness = Vector2.Lerp(WhipOutwardness, InitialDirectionRotation.ToRotationVector2(), 0.1f); else { @@ -125,8 +126,8 @@ namespace CalamityMod.Projectiles.Melee swingSpeedIncrement *= 0.84f; WhipOutwardness += swingSpeedIncrement; } - projectile.Center = playerRotatedPosition; - projectile.rotation = WhipOutwardness.ToRotation(); + Projectile.Center = playerRotatedPosition; + Projectile.rotation = WhipOutwardness.ToRotation(); } public void ManipulatePlayerValues() @@ -135,31 +136,31 @@ namespace CalamityMod.Projectiles.Melee Owner.itemAnimation = 2; if (SwingDirection == 0f) { - Owner.itemRotation = WhipOutwardness.ToRotation() * projectile.direction; - Owner.ChangeDir(projectile.direction); + Owner.itemRotation = WhipOutwardness.ToRotation() * Projectile.direction; + Owner.ChangeDir(Projectile.direction); } } public void CreateBadassPrismExplosion() { - var sound = Main.PlaySound(SoundID.DD2_DarkMageHealImpact, Owner.Center); + var sound = SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Owner.Center); if (sound != null) sound.Pitch = MathHelper.Clamp(sound.Pitch + 0.15f, 0f, 1f); - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - Projectile.NewProjectile(WhipEnd, Vector2.Zero, ModContent.ProjectileType(), projectile.damage * 2, 0f, projectile.owner); + Projectile.NewProjectile(WhipEnd, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 2, 0f, Projectile.owner); // Fire a bunch of rays rays. - int rayDamage = (int)(projectile.damage * 1.5); + int rayDamage = (int)(Projectile.damage * 1.5); NPC potentialTarget = WhipEnd.ClosestNPCAt(700f); for (int i = 0; i < LaserRayCount; i++) { - float rayRotation = projectile.rotation + MathHelper.Lerp(-0.57f, 0.57f, i / (float)LaserRayCount); + float rayRotation = Projectile.rotation + MathHelper.Lerp(-0.57f, 0.57f, i / (float)LaserRayCount); float targetAimDisparity = 0f; if (potentialTarget != null) - targetAimDisparity = projectile.rotation.ToRotationVector2().AngleBetween((potentialTarget.Center - projectile.Center).SafeNormalize(Vector2.Zero)); + targetAimDisparity = Projectile.rotation.ToRotationVector2().AngleBetween((potentialTarget.Center - Projectile.Center).SafeNormalize(Vector2.Zero)); // By default, make the prism rays go outward a good amount based on their rotation // to give a fan look. @@ -171,7 +172,7 @@ namespace CalamityMod.Projectiles.Melee if (potentialTarget != null && targetAimDisparity < MathHelper.Pi * 0.27f) prismEndPosition = potentialTarget.Center + potentialTarget.velocity * 4f; - int prismRay = Projectile.NewProjectile(prismEndPosition, Vector2.Zero, ModContent.ProjectileType(), rayDamage, projectile.knockBack * 0.2f, projectile.owner); + int prismRay = Projectile.NewProjectile(prismEndPosition, Vector2.Zero, ModContent.ProjectileType(), rayDamage, Projectile.knockBack * 0.2f, Projectile.owner); if (Main.projectile.IndexInRange(prismRay)) { Main.projectile[prismRay].ModProjectile().RayHue = i / (float)LaserRayCount; @@ -191,15 +192,15 @@ namespace CalamityMod.Projectiles.Melee whipTexturePath = "CalamityMod/Projectiles/Melee/SpineOfThanatosTail"; else whipTexturePath = $"CalamityMod/Projectiles/Melee/SpineOfThanatosBody{i % 2 + 1}"; - Texture2D whipSegmentTexture = ModContent.GetTexture(whipTexturePath); - Texture2D whipSegmentGlowmaskTexture = ModContent.GetTexture($"{whipTexturePath}Glowmask"); + Texture2D whipSegmentTexture = ModContent.Request(whipTexturePath); + Texture2D whipSegmentGlowmaskTexture = ModContent.Request($"{whipTexturePath}Glowmask"); Vector2 origin = whipSegmentTexture.Size() * 0.5f; float rotation = (WhipPoints[i + 1] - WhipPoints[i]).ToRotation() + MathHelper.PiOver2; Vector2 drawPosition = WhipPoints[i] - Main.screenPosition; - Color color = projectile.GetAlpha(Lighting.GetColor((int)WhipPoints[i].X / 16, (int)WhipPoints[i].Y / 16)); - spriteBatch.Draw(whipSegmentTexture, drawPosition, null, color, rotation, origin, projectile.scale, SpriteEffects.None, 0f); - spriteBatch.Draw(whipSegmentGlowmaskTexture, drawPosition, null, Color.White, rotation, origin, projectile.scale, SpriteEffects.None, 0f); + Color color = Projectile.GetAlpha(Lighting.GetColor((int)WhipPoints[i].X / 16, (int)WhipPoints[i].Y / 16)); + spriteBatch.Draw(whipSegmentTexture, drawPosition, null, color, rotation, origin, Projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(whipSegmentGlowmaskTexture, drawPosition, null, Color.White, rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } return false; @@ -210,7 +211,7 @@ namespace CalamityMod.Projectiles.Melee if (WhipPoints.Count <= 1) return false; - float width = projectile.scale * 38f; + float width = Projectile.scale * 38f; for (int i = 0; i < WhipPoints.Count - 1; i++) { float _ = 0f; diff --git a/Projectiles/Melee/StarnightBeam.cs b/Projectiles/Melee/StarnightBeam.cs index dea080bc1b..82cefa6b86 100644 --- a/Projectiles/Melee/StarnightBeam.cs +++ b/Projectiles/Melee/StarnightBeam.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -11,54 +12,54 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 600; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.timeLeft = 600; aiType = ProjectileID.LightBeam; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.4f, 0f, 0.4f); + Lighting.AddLight(Projectile.Center, 0.4f, 0f, 0.4f); } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); int num3; for (int num795 = 4; num795 < 31; num795 = num3 + 1) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / (float)num795); + float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Dust dust = Main.dust[num798]; dust.noGravity = true; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 73, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust.velocity *= 0.05f; num3 = num795; } diff --git a/Projectiles/Melee/StellarContemptHammer.cs b/Projectiles/Melee/StellarContemptHammer.cs index 38a44f7355..858ab27b11 100644 --- a/Projectiles/Melee/StellarContemptHammer.cs +++ b/Projectiles/Melee/StellarContemptHammer.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -20,21 +21,21 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Stellar Contempt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 44; - projectile.height = 44; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = Lifetime; + Projectile.width = 44; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = Lifetime; } public override void AI() @@ -43,84 +44,84 @@ namespace CalamityMod.Projectiles.Melee drawOriginOffsetY = -10; drawOriginOffsetX = 0; - Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0.6f); + Lighting.AddLight(Projectile.Center, 0.7f, 0.3f, 0.6f); // The hammer makes sound while flying. - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, (int)projectile.position.X, (int)projectile.position.Y); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, (int)Projectile.position.X, (int)Projectile.position.Y); } // ai[0] stores whether the hammer is returning. If 0, it isn't. If 1, it is. - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= ReboundTime) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= ReboundTime) { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } } else { - projectile.tileCollide = false; + Projectile.tileCollide = false; float returnSpeed = StellarContemptMelee.Speed; float acceleration = 3.2f; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; // Delete the hammer if it's excessively far away. Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); dist = returnSpeed / dist; xDist *= dist; yDist *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) + if (Projectile.velocity.X < xDist) { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X = Projectile.velocity.X + acceleration; + if (Projectile.velocity.X < 0f && xDist > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > xDist) + else if (Projectile.velocity.X > xDist) { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X = Projectile.velocity.X - acceleration; + if (Projectile.velocity.X > 0f && xDist < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < yDist) + if (Projectile.velocity.Y < yDist) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; + if (Projectile.velocity.Y < 0f && yDist > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > yDist) + else if (Projectile.velocity.Y > yDist) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; + if (Projectile.velocity.Y > 0f && yDist < 0f) + Projectile.velocity.Y -= acceleration; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); } // Rotate the hammer as it flies. - projectile.rotation += RotationIncrement; + Projectile.rotation += RotationIncrement; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -173,12 +174,12 @@ namespace CalamityMod.Projectiles.Melee private void SpawnFlares(Vector2 targetPos, int width, int height) { // Play the Lunar Flare sound centered on the user, not the target (consistent with Lunar Flare and Stellar Striker) - Player user = Main.player[projectile.owner]; - Main.PlaySound(SoundID.Item88, projectile.position); - projectile.netUpdate = true; + Player user = Main.player[Projectile.owner]; + SoundEngine.PlaySound(SoundID.Item88, Projectile.position); + Projectile.netUpdate = true; int numFlares = 2; - int flareDamage = (int)(0.3f * projectile.damage); + int flareDamage = (int)(0.3f * Projectile.damage); float flareKB = 4f; for (int i = 0; i < numFlares; ++i) { @@ -206,7 +207,7 @@ namespace CalamityMod.Projectiles.Melee velocity *= flareSpeed; float AI1 = Main.rand.Next(3); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); if (proj.WithinBounds(Main.maxProjectiles)) diff --git a/Projectiles/Melee/StormBeam.cs b/Projectiles/Melee/StormBeam.cs index 9e12201233..0652941e4b 100644 --- a/Projectiles/Melee/StormBeam.cs +++ b/Projectiles/Melee/StormBeam.cs @@ -11,42 +11,42 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.25f); + Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0.25f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, false, 200f, 12f, 20f); } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.oldVelocity.X, projectile.oldVelocity.Y); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.oldVelocity.X, Projectile.oldVelocity.Y); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/StormMark.cs b/Projectiles/Melee/StormMark.cs index e5c897a4d9..6fcb49abba 100644 --- a/Projectiles/Melee/StormMark.cs +++ b/Projectiles/Melee/StormMark.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class StormMark : ModProjectile @@ -16,28 +17,28 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 25; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.timeLeft = 900; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 25; } public override void AI() { Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = -1; - Main.PlaySound(SoundID.Item60, projectile.Center); + Projectile.soundDelay = -1; + SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); } - if (projectile.localAI[1] < 30f) + if (Projectile.localAI[1] < 30f) { for (int num1134 = 0; num1134 < 1; num1134++) { @@ -48,10 +49,10 @@ namespace CalamityMod.Projectiles.Melee value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); value81.X *= -1f; Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 187, 0f, 0f, 0, default, 0.5f)]; dust34.position = position4; - dust34.customData = projectile.Center + value82; + dust34.customData = Projectile.Center + value82; dust34.fadeIn = 1f; dust34.scale = 0.3f; if (value81.X > -1.2f) @@ -61,50 +62,50 @@ namespace CalamityMod.Projectiles.Melee dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; } } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + Projectile.localAI[0] = 0.8f; + Projectile.direction = 1; + Point point9 = Projectile.Center.ToTileCoordinates(); + Projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) + Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; + if (Projectile.localAI[1] < 33f) { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 8; + Projectile.alpha -= 8; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } - if (projectile.localAI[1] > 103f) + if (Projectile.localAI[1] > 103f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 16; + Projectile.alpha += 16; } - if (projectile.alpha > 255) + if (Projectile.alpha > 255) { - projectile.alpha = 255; + Projectile.alpha = 255; } } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); } for (int num1135 = 0; num1135 < 2; num1135++) { if (Main.rand.NextBool(10)) { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1f)]; + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust dust35 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1f)]; dust35.noGravity = true; dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; + dust35.scale = Projectile.Opacity * Projectile.localAI[0]; + dust35.position = Projectile.Center; dust35.velocity = value83 * 2.5f; } } @@ -113,47 +114,47 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(10)) { Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1.5f)]; + Dust dust36 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1.5f)]; dust36.noGravity = true; dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; + dust36.scale = Projectile.Opacity * Projectile.localAI[0]; + dust36.position = Projectile.Center; dust36.velocity = value84 * 2.5f; } } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + Projectile.velocity = Vector2.Zero; + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, 0f, 0f); } - if (projectile.localAI[1] >= 120f) + if (Projectile.localAI[1] >= 120f) { - projectile.Kill(); + Projectile.Kill(); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Color alpha5 = projectile.GetAlpha(color25); + Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[Projectile.type]; + Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alpha5 = Projectile.GetAlpha(color25); Vector2 origin7 = rectangle11.Size() / 2f; Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, Projectile.rotation, origin7, Projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Melee/StormRulerProj.cs b/Projectiles/Melee/StormRulerProj.cs index 4c9633fb8d..0614b4c4a8 100644 --- a/Projectiles/Melee/StormRulerProj.cs +++ b/Projectiles/Melee/StormRulerProj.cs @@ -12,61 +12,61 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Ruler"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 600; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.25f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0.25f); + if (Projectile.localAI[0] == 0f) { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) + Projectile.scale -= 0.02f; + Projectile.alpha += 30; + if (Projectile.alpha >= 250) { - projectile.alpha = 255; - projectile.localAI[0] = 1f; + Projectile.alpha = 255; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) + Projectile.scale += 0.02f; + Projectile.alpha -= 30; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[0] = 0f; + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; } } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/StreamGougePortal.cs b/Projectiles/Melee/StreamGougePortal.cs index 2f18b23461..ff2ee9a216 100644 --- a/Projectiles/Melee/StreamGougePortal.cs +++ b/Projectiles/Melee/StreamGougePortal.cs @@ -5,13 +5,14 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class StreamGougePortal : ModProjectile { - public Vector2 SpearCenter => Vector2.Lerp(projectile.Center + projectile.velocity + projectile.velocity.SafeNormalize(Vector2.Zero) * 42f, projectile.Center, 1f - projectile.scale); - public ref float Time => ref projectile.ai[0]; + public Vector2 SpearCenter => Vector2.Lerp(Projectile.Center + Projectile.velocity + Projectile.velocity.SafeNormalize(Vector2.Zero) * 42f, Projectile.Center, 1f - Projectile.scale); + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { @@ -20,68 +21,68 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.timeLeft = StreamGouge.PortalLifetime; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.timeLeft = StreamGouge.PortalLifetime; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { // Play a slice sound when spawning. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlayTrackedSound(CalamityUtils.GetTrackableSound("Sounds/Custom/SwiftSlice"), projectile.Center); - projectile.localAI[0] = 1f; + Main.PlayTrackedSound(CalamityUtils.GetTrackableSound("Sounds/Custom/SwiftSlice"), Projectile.Center); + Projectile.localAI[0] = 1f; } float spearOutwardness = MathHelper.Lerp(4f, 52f, Utils.InverseLerp(0f, 18f, Time, true)); - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * spearOutwardness; - projectile.Opacity = Utils.InverseLerp(0f, 8f, Time, true) * Utils.InverseLerp(0f, 10f, projectile.timeLeft, true); - projectile.scale = projectile.Opacity; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * spearOutwardness; + Projectile.Opacity = Utils.InverseLerp(0f, 8f, Time, true) * Utils.InverseLerp(0f, 10f, Projectile.timeLeft, true); + Projectile.scale = Projectile.Opacity; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; Time++; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/StreamGouge"); + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/StreamGouge"); Vector2 spearDrawPosition = SpearCenter - Main.screenPosition; Vector2 spearOrigin = texture.Size() * 0.5f; - Color spearColor = Main.hslToRgb(projectile.identity % 10f / 40f + 0.67f, 1f, 0.5f); + Color spearColor = Main.hslToRgb(Projectile.identity % 10f / 40f + 0.67f, 1f, 0.5f); spearColor.A = 0; for (int i = 0; i < 2; i++) - spriteBatch.Draw(texture, spearDrawPosition, null, spearColor * projectile.Opacity, projectile.rotation, spearOrigin, projectile.scale, 0, 0); + spriteBatch.Draw(texture, spearDrawPosition, null, spearColor * Projectile.Opacity, Projectile.rotation, spearOrigin, Projectile.scale, 0, 0); - Texture2D portalTexture = ModContent.GetTexture("CalamityMod/Projectiles/Melee/StreamGougePortal"); + Texture2D portalTexture = ModContent.Request("CalamityMod/Projectiles/Melee/StreamGougePortal"); Vector2 origin = portalTexture.Size() * 0.5f; Color baseColor = Color.White; - Vector2 drawPosition = projectile.Center - Main.screenPosition; - float rotation = Main.GlobalTime * 6f + projectile.identity * 1.45f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float rotation = Main.GlobalTime * 6f + Projectile.identity * 1.45f; // Black portal. - Color color = Color.Lerp(baseColor, Color.Black, 0.55f).MultiplyRGB(Color.DarkGray) * projectile.Opacity; - spriteBatch.Draw(portalTexture, drawPosition, null, color, rotation, origin, projectile.scale * 1.2f, SpriteEffects.None, 0f); - spriteBatch.Draw(portalTexture, drawPosition, null, color, -rotation, origin, projectile.scale * 1.2f, SpriteEffects.None, 0f); + Color color = Color.Lerp(baseColor, Color.Black, 0.55f).MultiplyRGB(Color.DarkGray) * Projectile.Opacity; + spriteBatch.Draw(portalTexture, drawPosition, null, color, rotation, origin, Projectile.scale * 1.2f, SpriteEffects.None, 0f); + spriteBatch.Draw(portalTexture, drawPosition, null, color, -rotation, origin, Projectile.scale * 1.2f, SpriteEffects.None, 0f); spriteBatch.SetBlendState(BlendState.Additive); // Cyan portal. - color = Color.Lerp(baseColor, Color.Cyan, 0.55f) * projectile.Opacity * 1.4f; - spriteBatch.Draw(portalTexture, drawPosition, null, color, rotation * 0.6f, origin, projectile.scale * 1.2f, SpriteEffects.None, 0f); + color = Color.Lerp(baseColor, Color.Cyan, 0.55f) * Projectile.Opacity * 1.4f; + spriteBatch.Draw(portalTexture, drawPosition, null, color, rotation * 0.6f, origin, Projectile.scale * 1.2f, SpriteEffects.None, 0f); // Magenta portal. - color = Color.Lerp(baseColor, Color.Fuchsia, 0.55f) * projectile.Opacity * 1.4f; - spriteBatch.Draw(portalTexture, drawPosition, null, color, rotation * -0.7f, origin, projectile.scale * 1.2f, SpriteEffects.None, 0f); + color = Color.Lerp(baseColor, Color.Fuchsia, 0.55f) * Projectile.Opacity * 1.4f; + spriteBatch.Draw(portalTexture, drawPosition, null, color, rotation * -0.7f, origin, Projectile.scale * 1.2f, SpriteEffects.None, 0f); spriteBatch.SetBlendState(BlendState.AlphaBlend); return false; } @@ -89,12 +90,12 @@ namespace CalamityMod.Projectiles.Melee // Create impact and cosmic parallax particles when hitting enemies. public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(SoundID.Item74, target.Center); + SoundEngine.PlaySound(SoundID.Item74, target.Center); if (Main.netMode == NetmodeID.Server) return; Color impactColor = Color.Lerp(Color.Cyan, Color.White, Main.rand.NextFloat(0.3f, 0.64f)); - Vector2 impactPoint = Vector2.Lerp(projectile.Center, target.Center, 0.65f); + Vector2 impactPoint = Vector2.Lerp(Projectile.Center, target.Center, 0.65f); ImpactParticle impactParticle = new ImpactParticle(impactPoint, 0.1f, 20, Main.rand.NextFloat(0.4f, 0.5f), impactColor); GeneralParticleHandler.SpawnParticle(impactParticle); @@ -104,7 +105,7 @@ namespace CalamityMod.Projectiles.Melee FusableParticleManager.GetParticleSetByType()?.SpawnParticle(spawnPosition, 60f); float scale = MathHelper.Lerp(24f, 64f, CalamityUtils.Convert01To010(i / 19f)); - spawnPosition = target.Center + projectile.velocity.SafeNormalize(Vector2.UnitY) * MathHelper.Lerp(-40f, 90f, i / 19f); + spawnPosition = target.Center + Projectile.velocity.SafeNormalize(Vector2.UnitY) * MathHelper.Lerp(-40f, 90f, i / 19f); FusableParticleManager.GetParticleSetByType()?.SpawnParticle(spawnPosition, scale); } } @@ -112,8 +113,8 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float _ = 0f; - Vector2 start = SpearCenter - projectile.velocity.SafeNormalize(Vector2.UnitY) * projectile.scale * 50f; - Vector2 end = SpearCenter + projectile.velocity.SafeNormalize(Vector2.UnitY) * projectile.scale * 50f; + Vector2 start = SpearCenter - Projectile.velocity.SafeNormalize(Vector2.UnitY) * Projectile.scale * 50f; + Vector2 end = SpearCenter + Projectile.velocity.SafeNormalize(Vector2.UnitY) * Projectile.scale * 50f; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, 15f, ref _); } diff --git a/Projectiles/Melee/SulphurousGrabberBubble.cs b/Projectiles/Melee/SulphurousGrabberBubble.cs index 3b2a15a946..98cf753033 100644 --- a/Projectiles/Melee/SulphurousGrabberBubble.cs +++ b/Projectiles/Melee/SulphurousGrabberBubble.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class SulphurousGrabberBubble : ModProjectile @@ -14,33 +15,33 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.alpha = 60; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 120; - projectile.melee = true; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.alpha = 60; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - projectile.velocity.X *= 0.9f; - projectile.velocity.Y *= 0.9f; + Projectile.velocity.X *= 0.9f; + Projectile.velocity.Y *= 0.9f; if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); int num190 = Main.rand.Next(5, 9); for (int num191 = 0; num191 < num190; num191++) { - int num192 = Dust.NewDust(projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1.4f); + int num192 = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1.4f); Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, Projectile.Center, 0.5f); Main.dust[num192].noGravity = true; } } diff --git a/Projectiles/Melee/SulphurousGrabberBubble2.cs b/Projectiles/Melee/SulphurousGrabberBubble2.cs index d2a4433105..af9c4fce5c 100644 --- a/Projectiles/Melee/SulphurousGrabberBubble2.cs +++ b/Projectiles/Melee/SulphurousGrabberBubble2.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class SulphurousGrabberBubble2 : ModProjectile @@ -14,34 +15,34 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.alpha = 60; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 120; - projectile.melee = true; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.alpha = 60; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - projectile.ai[0]++; - projectile.velocity.X *= 0.9f; - projectile.velocity.Y *= 0.9f; + Projectile.ai[0]++; + Projectile.velocity.X *= 0.9f; + Projectile.velocity.Y *= 0.9f; if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); int num190 = Main.rand.Next(5, 9); for (int num191 = 0; num191 < num190; num191++) { - int num192 = Dust.NewDust(projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1.4f); + int num192 = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1.4f); Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, Projectile.Center, 0.5f); Main.dust[num192].noGravity = true; } } diff --git a/Projectiles/Melee/SunlightBlade.cs b/Projectiles/Melee/SunlightBlade.cs index ad3ba67f58..12e7a53193 100644 --- a/Projectiles/Melee/SunlightBlade.cs +++ b/Projectiles/Melee/SunlightBlade.cs @@ -11,37 +11,37 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 18; - projectile.alpha = 100; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = 5; - projectile.timeLeft = 180; - projectile.ignoreWater = true; + Projectile.width = 50; + Projectile.height = 50; + Projectile.aiStyle = 18; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 5; + Projectile.timeLeft = 180; + Projectile.ignoreWater = true; aiType = ProjectileID.DeathSickle; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 3; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0f); + Lighting.AddLight(Projectile.Center, 0.25f, 0.25f, 0f); } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/SwordsplosionBlue.cs b/Projectiles/Melee/SwordsplosionBlue.cs index da0668c385..b0252278d3 100644 --- a/Projectiles/Melee/SwordsplosionBlue.cs +++ b/Projectiles/Melee/SwordsplosionBlue.cs @@ -16,43 +16,43 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 3; - projectile.timeLeft = 200; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 3; + Projectile.timeLeft = 200; aiType = ProjectileID.EnchantedBeam; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.3f / 255f, (255 - projectile.alpha) * 0.4f / 255f, (255 - projectile.alpha) * 1f / 255f); - if (projectile.localAI[1] > 7f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 1f / 255f); + if (Projectile.localAI[1] > 7f) { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); + int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[num308].velocity *= 0.1f; Main.dust[num308].noGravity = true; } - projectile.rotation = projectile.velocity.ToRotation() + (float)Math.Atan(90); + Projectile.rotation = Projectile.velocity.ToRotation() + (float)Math.Atan(90); } public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); + return new Color(Main.DiscoR, 203, 103, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 195) + if (Projectile.timeLeft > 195) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 7; k++) { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); + int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[num308].noGravity = true; } } diff --git a/Projectiles/Melee/SwordsplosionGreen.cs b/Projectiles/Melee/SwordsplosionGreen.cs index 52b8ddd669..1a16f526b3 100644 --- a/Projectiles/Melee/SwordsplosionGreen.cs +++ b/Projectiles/Melee/SwordsplosionGreen.cs @@ -16,42 +16,42 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.timeLeft = 300; aiType = ProjectileID.EnchantedBeam; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.3f / 255f, (255 - projectile.alpha) * 0.4f / 255f, (255 - projectile.alpha) * 1f / 255f); - if (projectile.localAI[1] > 7f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 1f / 255f); + if (Projectile.localAI[1] > 7f) { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(53, Main.DiscoG, 255), 1.2f); + int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(53, Main.DiscoG, 255), 1.2f); Main.dust[num308].velocity *= 0.1f; Main.dust[num308].noGravity = true; } - projectile.rotation = projectile.velocity.ToRotation() + (float)Math.Atan(90); + Projectile.rotation = Projectile.velocity.ToRotation() + (float)Math.Atan(90); } public override Color? GetAlpha(Color lightColor) { - return new Color(53, Main.DiscoG, 255, projectile.alpha); + return new Color(53, Main.DiscoG, 255, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 295) + if (Projectile.timeLeft > 295) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 7; k++) { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 150, new Color(53, Main.DiscoG, 255), 1.2f); + int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(53, Main.DiscoG, 255), 1.2f); Main.dust[num308].noGravity = true; } } diff --git a/Projectiles/Melee/SwordsplosionPurple.cs b/Projectiles/Melee/SwordsplosionPurple.cs index a32f0f6007..d9c5981265 100644 --- a/Projectiles/Melee/SwordsplosionPurple.cs +++ b/Projectiles/Melee/SwordsplosionPurple.cs @@ -17,42 +17,42 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.timeLeft = 300; aiType = ProjectileID.EnchantedBeam; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.3f / 255f, (255 - projectile.alpha) * 0.4f / 255f, (255 - projectile.alpha) * 1f / 255f); - if (projectile.localAI[1] > 7f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 1f / 255f); + if (Projectile.localAI[1] > 7f) { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); Main.dust[num308].velocity *= 0.1f; Main.dust[num308].noGravity = true; } - projectile.rotation = projectile.velocity.ToRotation() + (float)Math.Atan(90); + Projectile.rotation = Projectile.velocity.ToRotation() + (float)Math.Atan(90); } public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, 100, 255, projectile.alpha); + return new Color(Main.DiscoR, 100, 255, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 295) + if (Projectile.timeLeft > 295) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 7; k++) { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); Main.dust[num308].noGravity = true; } } diff --git a/Projectiles/Melee/SwordsplosionRed.cs b/Projectiles/Melee/SwordsplosionRed.cs index 2789d6416c..68a456e040 100644 --- a/Projectiles/Melee/SwordsplosionRed.cs +++ b/Projectiles/Melee/SwordsplosionRed.cs @@ -16,43 +16,43 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 3; - projectile.timeLeft = 200; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 3; + Projectile.timeLeft = 200; aiType = ProjectileID.EnchantedBeam; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.3f / 255f, (255 - projectile.alpha) * 0.4f / 255f, (255 - projectile.alpha) * 1f / 255f); - if (projectile.localAI[1] > 7f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 1f / 255f); + if (Projectile.localAI[1] > 7f) { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(255, Main.DiscoG, 53), 1.2f); + int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(255, Main.DiscoG, 53), 1.2f); Main.dust[num308].velocity *= 0.1f; Main.dust[num308].noGravity = true; } - projectile.rotation = projectile.velocity.ToRotation() + (float)Math.Atan(90); + Projectile.rotation = Projectile.velocity.ToRotation() + (float)Math.Atan(90); } public override Color? GetAlpha(Color lightColor) { - return new Color(255, Main.DiscoG, 53, projectile.alpha); + return new Color(255, Main.DiscoG, 53, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 195) + if (Projectile.timeLeft > 195) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 7; k++) { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 150, new Color(255, Main.DiscoG, 53), 1.2f); + int num308 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 150, new Color(255, Main.DiscoG, 53), 1.2f); Main.dust[num308].noGravity = true; } } diff --git a/Projectiles/Melee/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs index ef539f833b..c9f3fbef3a 100644 --- a/Projectiles/Melee/TaintedBladeSlasher.cs +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -7,15 +7,16 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TaintedBladeSlasher : ModProjectile { internal PrimitiveTrail TrailDrawer = null; - public ref float SwordItemID => ref projectile.ai[1]; - public ref float VerticalOffset => ref projectile.localAI[0]; - public ref float Time => ref projectile.localAI[1]; + public ref float SwordItemID => ref Projectile.ai[1]; + public ref float VerticalOffset => ref Projectile.localAI[0]; + public ref float Time => ref Projectile.localAI[1]; public float AttackCompletionRatio { get @@ -26,8 +27,8 @@ namespace CalamityMod.Projectiles.Melee return completionRatio; } } - public Player Owner => Main.player[projectile.owner]; - public int Variant => (int)projectile.ai[0] % 2; + public Player Owner => Main.player[Projectile.owner]; + public int Variant => (int)Projectile.ai[0] % 2; public const float ForearmLength = 80f; public const float ArmLength = 108f; @@ -75,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee { float backArmRotation = Owner.AngleTo(BackArmAimPosition); Vector2 fromArmDrawPosition = Owner.Center + backArmRotation.ToRotationVector2() * ForearmLength; - Vector2 backOffset = (projectile.Center - fromArmDrawPosition).SafeNormalize(Vector2.Zero) * ArmLength + IdleMoveOffset; + Vector2 backOffset = (Projectile.Center - fromArmDrawPosition).SafeNormalize(Vector2.Zero) * ArmLength + IdleMoveOffset; return fromArmDrawPosition + backOffset; } } @@ -85,7 +86,7 @@ namespace CalamityMod.Projectiles.Melee { float backArmRotation = Owner.AngleTo(BackArmAimPosition); Vector2 fromArmDrawPosition = Owner.Center + backArmRotation.ToRotationVector2() * ForearmLength; - Vector2 backOffset = (projectile.Center - fromArmDrawPosition).SafeNormalize(Vector2.Zero) * ArmLength + IdleMoveOffset; + Vector2 backOffset = (Projectile.Center - fromArmDrawPosition).SafeNormalize(Vector2.Zero) * ArmLength + IdleMoveOffset; float bladeRotation = backOffset.ToRotation() - MathHelper.PiOver4 + MathHelper.Pi; return -(bladeRotation + MathHelper.PiOver4 + BladeRotationOffset).ToRotationVector2(); } @@ -104,21 +105,21 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Blade"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 70; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 70; } public override void SetDefaults() { - projectile.width = projectile.height = 4; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 90000; - projectile.usesLocalNPCImmunity = true; - projectile.noEnchantments = true; - projectile.Calamity().trueMelee = true; + Projectile.width = Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 90000; + Projectile.usesLocalNPCImmunity = true; + Projectile.noEnchantments = true; + Projectile.Calamity().trueMelee = true; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(VerticalOffset); @@ -130,7 +131,7 @@ namespace CalamityMod.Projectiles.Melee CalamityPlayer.EnchantHeldItemEffects(Owner, Owner.Calamity(), Owner.ActiveItem()); if (!Owner.Calamity().bladeArmEnchant || Owner.ActiveItem().type != SwordItemID || Owner.CCed || !Owner.active || Owner.dead) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -160,7 +161,7 @@ namespace CalamityMod.Projectiles.Melee // The blade can be kept in a static location when not being swung. // This can result in insane damage coming from "poking" enemies. // To accomodate for this, the hit countdown is increased when not attacking. - projectile.localNPCHitCooldown = 24; + Projectile.localNPCHitCooldown = 24; } else { @@ -170,28 +171,28 @@ namespace CalamityMod.Projectiles.Melee // Make a fire/swing sound. if (Owner.itemAnimation == 21) - Main.PlaySound(SoundID.DD2_FlameburstTowerShot, Owner.Center); - projectile.localNPCHitCooldown = 3; + SoundEngine.PlaySound(SoundID.DD2_FlameburstTowerShot, Owner.Center); + Projectile.localNPCHitCooldown = 3; } if (AttackCompletionRatio < 0.16f) - projectile.oldPos = new Vector2[projectile.oldPos.Length]; + Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; // Very, very quickly approach the swing destination while attacking. // Also gain a temporary extra update. if (Owner.itemAnimation > 0) { - projectile.Center = Vector2.Lerp(projectile.Center, destination, 0.19f); - projectile.extraUpdates = 1; + Projectile.Center = Vector2.Lerp(Projectile.Center, destination, 0.19f); + Projectile.extraUpdates = 1; } // Idly move towards the destination. - if (projectile.Center != destination) - projectile.Center += (destination - projectile.Center).SafeNormalize(Vector2.Zero) * MathHelper.Min(projectile.Distance(destination), 12f + Owner.velocity.Length()); + if (Projectile.Center != destination) + Projectile.Center += (destination - Projectile.Center).SafeNormalize(Vector2.Zero) * MathHelper.Min(Projectile.Distance(destination), 12f + Owner.velocity.Length()); // Ensure that the position is never too far from the destination. - if (!projectile.WithinRange(destination, 300f)) - projectile.Center = destination; + if (!Projectile.WithinRange(destination, 300f)) + Projectile.Center = destination; Time++; } @@ -211,26 +212,26 @@ namespace CalamityMod.Projectiles.Melee if (TrailDrawer is null) TrailDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction, specialShader: GameShaders.Misc["CalamityMod:FadingSolidTrail"]); - Texture2D forearmTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/TaintedForearm"); - Texture2D armTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/TaintedArm"); - Texture2D handTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/TaintedHand"); + Texture2D forearmTexture = ModContent.Request("CalamityMod/ExtraTextures/TaintedForearm"); + Texture2D armTexture = ModContent.Request("CalamityMod/ExtraTextures/TaintedArm"); + Texture2D handTexture = ModContent.Request("CalamityMod/ExtraTextures/TaintedHand"); // Reflect the 1st hand variant horizontally. SpriteEffects handDirection = SpriteEffects.None; if (Variant == (Owner.direction == -1).ToInt()) { - handTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/TaintedHand2"); + handTexture = ModContent.Request("CalamityMod/ExtraTextures/TaintedHand2"); handDirection = SpriteEffects.FlipHorizontally; } Texture2D bladeTexture = Main.itemTexture[(int)SwordItemID]; // Draw the arms. float backArmRotation = Owner.AngleTo(BackArmAimPosition); - spriteBatch.Draw(forearmTexture, Owner.Center - Main.screenPosition, null, Color.White, backArmRotation - MathHelper.PiOver2, Vector2.UnitX * forearmTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(forearmTexture, Owner.Center - Main.screenPosition, null, Color.White, backArmRotation - MathHelper.PiOver2, Vector2.UnitX * forearmTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); Vector2 frontArmDrawPosition = Owner.Center + backArmRotation.ToRotationVector2() * ForearmLength + IdleMoveOffset; - float frontArmRotation = projectile.AngleFrom(frontArmDrawPosition); - spriteBatch.Draw(armTexture, frontArmDrawPosition - Main.screenPosition, null, Color.White, frontArmRotation - MathHelper.PiOver2, Vector2.UnitX * armTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + float frontArmRotation = Projectile.AngleFrom(frontArmDrawPosition); + spriteBatch.Draw(armTexture, frontArmDrawPosition - Main.screenPosition, null, Color.White, frontArmRotation - MathHelper.PiOver2, Vector2.UnitX * armTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); float handRotation = frontArmRotation + MathHelper.PiOver2 + MathHelper.Pi; float bladeRotation = handRotation - MathHelper.PiOver4 + MathHelper.Pi + BladeRotationOffset; @@ -240,7 +241,7 @@ namespace CalamityMod.Projectiles.Melee // Draw the trail behind the blade. if (Owner.itemAnimation > 0) { - GameShaders.Misc["CalamityMod:FadingSolidTrail"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/BladeTrailUVMap")); + GameShaders.Misc["CalamityMod:FadingSolidTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/BladeTrailUVMap")); GameShaders.Misc["CalamityMod:FadingSolidTrail"].Shader.Parameters["shouldFlip"].SetValue((float)(Owner.direction == -1).ToInt()); Vector2 bottom = BladeCenterPosition - BladeOffsetDirection * BladeFrame.Height * 0.5f - Main.screenPosition; @@ -254,26 +255,26 @@ namespace CalamityMod.Projectiles.Melee if (Owner.direction == -1) Utils.Swap(ref TrailDrawer.OverridingStickPointStart, ref TrailDrawer.OverridingStickPointEnd); - Vector2[] drawPoints = new Vector2[projectile.oldPos.Length]; + Vector2[] drawPoints = new Vector2[Projectile.oldPos.Length]; Vector2 perpendicularDirection = BladeOffsetDirection.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.PiOver2); for (int i = 1; i < drawPoints.Length; i++) { - if (projectile.oldPos[i] == Vector2.Zero) + if (Projectile.oldPos[i] == Vector2.Zero) continue; - drawPoints[i] = projectile.Center + perpendicularDirection.RotatedBy(i * -0.014f * Owner.direction) * i * -Owner.direction * 6f; + drawPoints[i] = Projectile.Center + perpendicularDirection.RotatedBy(i * -0.014f * Owner.direction) * i * -Owner.direction * 6f; } - TrailDrawer.Draw(drawPoints, BladeCenterPosition - projectile.position - Main.screenPosition, 67); + TrailDrawer.Draw(drawPoints, BladeCenterPosition - Projectile.position - Main.screenPosition, 67); } // Draw the blade. Vector2 bladeDrawPosition = BladeCenterPosition - Main.screenPosition; SpriteEffects bladeDirection = Owner.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - spriteBatch.Draw(bladeTexture, bladeDrawPosition, BladeFrame, Color.White, bladeRotation, BladeFrame.Size() * 0.5f, projectile.scale, bladeDirection, 0f); + spriteBatch.Draw(bladeTexture, bladeDrawPosition, BladeFrame, Color.White, bladeRotation, BladeFrame.Size() * 0.5f, Projectile.scale, bladeDirection, 0f); // Draw the hand. - spriteBatch.Draw(handTexture, FrontArmEnd - Main.screenPosition, null, projectile.GetAlpha(Color.White), handRotation, handTexture.Size() * 0.5f, projectile.scale, handDirection, 0f); + spriteBatch.Draw(handTexture, FrontArmEnd - Main.screenPosition, null, Projectile.GetAlpha(Color.White), handRotation, handTexture.Size() * 0.5f, Projectile.scale, handDirection, 0f); return false; } diff --git a/Projectiles/Melee/TemporalFloeNumberTwo.cs b/Projectiles/Melee/TemporalFloeNumberTwo.cs index 40e9ebeae3..f4b85e51eb 100644 --- a/Projectiles/Melee/TemporalFloeNumberTwo.cs +++ b/Projectiles/Melee/TemporalFloeNumberTwo.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TemporalFloeNumberTwo : ModProjectile @@ -17,52 +18,52 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.coldDamage = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.tileCollide = false; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.coldDamage = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.tileCollide = false; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.35f / 255f); + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); if (Main.rand.NextBool(2)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, 0f, 0f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(50, 50, 255, projectile.alpha); + return new Color(50, 50, 255, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int num795 = 0; num795 < 27; num795++) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / (float)num795); + float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 56, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Dust dust = Main.dust[num798]; dust.noGravity = true; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 56, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust.velocity *= 0.05f; } } diff --git a/Projectiles/Melee/TemporalFloeSwordProjectile.cs b/Projectiles/Melee/TemporalFloeSwordProjectile.cs index 596fbfce9e..6c6bb9a7f7 100644 --- a/Projectiles/Melee/TemporalFloeSwordProjectile.cs +++ b/Projectiles/Melee/TemporalFloeSwordProjectile.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TemporalFloeSwordProjectile : ModProjectile @@ -15,43 +16,43 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.coldDamage = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.coldDamage = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.35f / 255f); + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); if (Main.rand.NextBool(2)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, 0f, 0f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(50, 50, 255, projectile.alpha); + return new Color(50, 50, 255, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); // Get Terraria's current strange time variable double time = Main.time; @@ -94,11 +95,11 @@ namespace CalamityMod.Projectiles.Melee Vector2 minuteVector = minuteAngle.ToRotationVector2() * projSpeed; int projType = ModContent.ProjectileType(); - int dmg = projectile.damage / 2; - float kback = projectile.knockBack * 0.5f; + int dmg = Projectile.damage / 2; + float kback = Projectile.knockBack * 0.5f; - Projectile.NewProjectile(projectile.Center, hourVector, projType, dmg, kback, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center, minuteVector, projType, dmg, kback, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, hourVector, projType, dmg, kback, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, minuteVector, projType, dmg, kback, Projectile.owner, 0f, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs index 61166530e7..d6d05635e1 100644 --- a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs +++ b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TenebreusTidesWaterProjectile : ModProjectile @@ -11,54 +12,54 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Water Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.ignoreWater = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; - projectile.tileCollide = false; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.tileCollide = false; aiType = ProjectileID.LightBeam; } public override void AI() { - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0f, (255 - projectile.alpha) * 1f / 255f); - int water = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0f, 0f, (255 - Projectile.alpha) * 1f / 255f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; - Main.dust[water].velocity += projectile.velocity * 0.1f; + Main.dust[water].velocity += Projectile.velocity * 0.1f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft == 300) + if (Projectile.timeLeft == 300) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override Color? GetAlpha(Color lightColor) => new Color(50, 50, 255, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(50, 50, 255, Projectile.alpha); public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X -= (float)(projectile.width / 2); - projectile.position.Y -= (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X -= (float)(Projectile.width / 2); + Projectile.position.Y -= (float)(Projectile.height / 2); for (int dustIndex = 0; dustIndex <= 30; dustIndex++) { Vector2 dustVel = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11)); @@ -67,11 +68,11 @@ namespace CalamityMod.Projectiles.Melee dist = dustSpeed / dist; dustVel.X *= dist; dustVel.Y *= dist; - int water = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[water]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity = dustVel; @@ -97,9 +98,9 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < projAmt; ++i) { int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(25f, 35f), type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner); + CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(25f, 35f), type, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); } } } diff --git a/Projectiles/Melee/TenebreusTidesWaterSpear.cs b/Projectiles/Melee/TenebreusTidesWaterSpear.cs index d8c0167d81..b1000894a1 100644 --- a/Projectiles/Melee/TenebreusTidesWaterSpear.cs +++ b/Projectiles/Melee/TenebreusTidesWaterSpear.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Tenebreus Tides Water Spear"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.penetrate = penetrationAmt; - projectile.timeLeft = 600; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.penetrate = penetrationAmt; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void SendExtraAI(BinaryWriter writer) @@ -47,85 +47,85 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); // If projectile hasn't hit anything yet - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 7f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 7f) { - int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; - Main.dust[water].velocity += projectile.velocity * 0.1f; + Main.dust[water].velocity += Projectile.velocity * 0.1f; } float scalar = 0.01f; int alphaAmt = 5; int alphaCeiling = alphaAmt * 15; int alphaFloor = 0; - if (projectile.localAI[0] > 7f) + if (Projectile.localAI[0] > 7f) { - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - projectile.scale -= scalar; + Projectile.scale -= scalar; - projectile.alpha += alphaAmt; - if (projectile.alpha > alphaCeiling) + Projectile.alpha += alphaAmt; + if (Projectile.alpha > alphaCeiling) { - projectile.alpha = alphaCeiling; - projectile.localAI[1] = 1f; + Projectile.alpha = alphaCeiling; + Projectile.localAI[1] = 1f; } } - else if (projectile.localAI[1] == 1f) + else if (Projectile.localAI[1] == 1f) { - projectile.scale += scalar; + Projectile.scale += scalar; - projectile.alpha -= alphaAmt; - if (projectile.alpha <= alphaFloor) + Projectile.alpha -= alphaAmt; + if (Projectile.alpha <= alphaFloor) { - projectile.alpha = alphaFloor; - projectile.localAI[1] = 0f; + Projectile.alpha = alphaFloor; + Projectile.localAI[1] = 0f; } } } } // If projectile has hit an enemy and has 'split' - else if (projectile.ai[0] >= 1f && projectile.ai[0] < (float)(1 + penetrationAmt)) + else if (Projectile.ai[0] >= 1f && Projectile.ai[0] < (float)(1 + penetrationAmt)) { - projectile.alpha += 15; - projectile.velocity *= 0.98f; - projectile.localAI[0] = 0f; + Projectile.alpha += 15; + Projectile.velocity *= 0.98f; + Projectile.localAI[0] = 0f; - if (projectile.alpha >= 255) + if (Projectile.alpha >= 255) { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.Kill(); + Projectile.Kill(); return; } int whoAmI = -1; - Vector2 targetSpot = projectile.Center; + Vector2 targetSpot = Projectile.Center; float detectRange = 700f; for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); if (targetDist < detectRange) { detectRange = targetDist; @@ -137,57 +137,57 @@ namespace CalamityMod.Projectiles.Melee if (whoAmI >= 0) { - projectile.netUpdate = true; - projectile.ai[0] += (float)penetrationAmt; - projectile.position = targetSpot + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * 100f - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + Projectile.netUpdate = true; + Projectile.ai[0] += (float)penetrationAmt; + Projectile.position = targetSpot + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * 100f - new Vector2((float)Projectile.width, (float)Projectile.height) / 2f; dontDraw = true; - projectile.velocity = Vector2.Normalize(targetSpot - projectile.Center) * 18f; + Projectile.velocity = Vector2.Normalize(targetSpot - Projectile.Center) * 18f; } else - projectile.Kill(); + Projectile.Kill(); } if (Main.rand.NextBool(3)) { - int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; - Main.dust[water].velocity += projectile.velocity * 0.1f; + Main.dust[water].velocity += Projectile.velocity * 0.1f; } } // If 'split' projectile has a target - else if (projectile.ai[0] >= (float)(1 + penetrationAmt) && projectile.ai[0] < (float)(1 + penetrationAmt * 2)) + else if (Projectile.ai[0] >= (float)(1 + penetrationAmt) && Projectile.ai[0] < (float)(1 + penetrationAmt * 2)) { - projectile.scale = 0.9f; + Projectile.scale = 0.9f; - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 15f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 15f) { - projectile.alpha += 51; - projectile.velocity *= 0.8f; + Projectile.alpha += 51; + Projectile.velocity *= 0.8f; - if (projectile.alpha >= 255) - projectile.Kill(); + if (Projectile.alpha >= 255) + Projectile.Kill(); } else { - projectile.alpha -= 125; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 125; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; - int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; - Main.dust[water].velocity += projectile.velocity * 0.1f; + Main.dust[water].velocity += Projectile.velocity * 0.1f; } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0f, (255 - projectile.alpha) * 1f / 255f); + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0f, 0f, (255 - Projectile.alpha) * 1f / 255f); if (dontDraw) drawInt++; if (drawInt > 1) @@ -197,26 +197,26 @@ namespace CalamityMod.Projectiles.Melee } } - public override Color? GetAlpha(Color lightColor) => new Color(50, 50, 255, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(50, 50, 255, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { if (dontDraw) return false; - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), Projectile.scale, spriteEffects, 0f); return false; } public override bool CanDamage() { // Do not do damage if a tile is hit OR if projectile has 'split' and hasn't been live for more than 5 frames - if ((((int)(projectile.ai[0] - 1f) / penetrationAmt == 0 && penetrationAmt < 3) || projectile.ai[1] < 5f) && projectile.ai[0] != 0f) + if ((((int)(Projectile.ai[0] - 1f) / penetrationAmt == 0 && penetrationAmt < 3) || Projectile.ai[1] < 5f) && Projectile.ai[0] != 0f) return false; return true; } @@ -224,8 +224,8 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { // If 'split' projectile hits an enemy - if (projectile.ai[0] >= (float)(1 + penetrationAmt) && projectile.ai[0] < (float)(1 + penetrationAmt * 2)) - projectile.ai[0] = 0f; + if (Projectile.ai[0] >= (float)(1 + penetrationAmt) && Projectile.ai[0] < (float)(1 + penetrationAmt * 2)) + Projectile.ai[0] = 0f; // Becomes 5 on first hit, then 4, and so on penetrationAmt--; @@ -233,13 +233,13 @@ namespace CalamityMod.Projectiles.Melee // Hits enemy, ai[0] = 0f + 4f = 4f on first hit // ai[0] = 4f - 1f = 3f on second hit // ai[0] = 3f - 1f = 2f on third hit - if (projectile.ai[0] == 0f) - projectile.ai[0] += (float)penetrationAmt; + if (Projectile.ai[0] == 0f) + Projectile.ai[0] += (float)penetrationAmt; else - projectile.ai[0] -= (float)(penetrationAmt + 1); + Projectile.ai[0] -= (float)(penetrationAmt + 1); - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/TenebreusTidesWaterSword.cs b/Projectiles/Melee/TenebreusTidesWaterSword.cs index ad74619dca..a2219527dc 100644 --- a/Projectiles/Melee/TenebreusTidesWaterSword.cs +++ b/Projectiles/Melee/TenebreusTidesWaterSword.cs @@ -20,16 +20,16 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.penetrate = penetrationAmt; - projectile.timeLeft = 600; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.penetrate = penetrationAmt; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void SendExtraAI(BinaryWriter writer) @@ -44,74 +44,74 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(45f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.ToRadians(45f); // If projectile hasn't hit anything yet - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 7f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 7f) { - int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; - Main.dust[water].velocity += projectile.velocity * 0.1f; + Main.dust[water].velocity += Projectile.velocity * 0.1f; } float scalar = 0.01f; int alphaAmt = 5; int alphaCeiling = alphaAmt * 15; int alphaFloor = 0; - if (projectile.localAI[0] > 7f) + if (Projectile.localAI[0] > 7f) { - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - projectile.scale -= scalar; + Projectile.scale -= scalar; - projectile.alpha += alphaAmt; - if (projectile.alpha > alphaCeiling) + Projectile.alpha += alphaAmt; + if (Projectile.alpha > alphaCeiling) { - projectile.alpha = alphaCeiling; - projectile.localAI[1] = 1f; + Projectile.alpha = alphaCeiling; + Projectile.localAI[1] = 1f; } } - else if (projectile.localAI[1] == 1f) + else if (Projectile.localAI[1] == 1f) { - projectile.scale += scalar; + Projectile.scale += scalar; - projectile.alpha -= alphaAmt; - if (projectile.alpha <= alphaFloor) + Projectile.alpha -= alphaAmt; + if (Projectile.alpha <= alphaFloor) { - projectile.alpha = alphaFloor; - projectile.localAI[1] = 0f; + Projectile.alpha = alphaFloor; + Projectile.localAI[1] = 0f; } } } } // If projectile has hit an enemy and has 'split' - else if (projectile.ai[0] >= 1f && projectile.ai[0] < (float)(1 + penetrationAmt)) + else if (Projectile.ai[0] >= 1f && Projectile.ai[0] < (float)(1 + penetrationAmt)) { - projectile.alpha += 15; - projectile.velocity *= 0.98f; - projectile.localAI[0] = 0f; + Projectile.alpha += 15; + Projectile.velocity *= 0.98f; + Projectile.localAI[0] = 0f; - if (projectile.alpha >= 255) + if (Projectile.alpha >= 255) { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.Kill(); + Projectile.Kill(); return; } int whoAmI = -1; - Vector2 targetSpot = projectile.Center; + Vector2 targetSpot = Projectile.Center; float detectRange = 700f; for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); if (targetDist < detectRange) { detectRange = targetDist; @@ -123,57 +123,57 @@ namespace CalamityMod.Projectiles.Melee if (whoAmI >= 0) { - projectile.netUpdate = true; - projectile.ai[0] += (float)penetrationAmt; - projectile.position = targetSpot + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * 100f - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + Projectile.netUpdate = true; + Projectile.ai[0] += (float)penetrationAmt; + Projectile.position = targetSpot + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * 100f - new Vector2((float)Projectile.width, (float)Projectile.height) / 2f; dontDraw = true; - projectile.velocity = Vector2.Normalize(targetSpot - projectile.Center) * 18f; + Projectile.velocity = Vector2.Normalize(targetSpot - Projectile.Center) * 18f; } else - projectile.Kill(); + Projectile.Kill(); } if (Main.rand.NextBool(3)) { - int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; - Main.dust[water].velocity += projectile.velocity * 0.1f; + Main.dust[water].velocity += Projectile.velocity * 0.1f; } } // If 'split' projectile has a target - else if (projectile.ai[0] >= (float)(1 + penetrationAmt) && projectile.ai[0] < (float)(1 + penetrationAmt * 2)) + else if (Projectile.ai[0] >= (float)(1 + penetrationAmt) && Projectile.ai[0] < (float)(1 + penetrationAmt * 2)) { - projectile.scale = 0.9f; + Projectile.scale = 0.9f; - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 15f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 15f) { - projectile.alpha += 51; - projectile.velocity *= 0.8f; + Projectile.alpha += 51; + Projectile.velocity *= 0.8f; - if (projectile.alpha >= 255) - projectile.Kill(); + if (Projectile.alpha >= 255) + Projectile.Kill(); } else { - projectile.alpha -= 125; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 125; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; - int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; - Main.dust[water].velocity += projectile.velocity * 0.1f; + Main.dust[water].velocity += Projectile.velocity * 0.1f; } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0f, (255 - projectile.alpha) * 1f / 255f); + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0f, 0f, (255 - Projectile.alpha) * 1f / 255f); if (dontDraw) drawInt++; if (drawInt > 1) @@ -183,24 +183,24 @@ namespace CalamityMod.Projectiles.Melee } } - public override Color? GetAlpha(Color lightColor) => new Color(50, 50, 255, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(50, 50, 255, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { if (dontDraw) return false; - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)texture.Height / 2f), projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)texture.Height / 2f), Projectile.scale, spriteEffects, 0f); return false; } public override bool CanDamage() { // Do not do damage if a tile is hit OR if projectile has 'split' and hasn't been live for more than 5 frames - if ((((int)(projectile.ai[0] - 1f) / penetrationAmt == 0 && penetrationAmt < 3) || projectile.ai[1] < 5f) && projectile.ai[0] != 0f) + if ((((int)(Projectile.ai[0] - 1f) / penetrationAmt == 0 && penetrationAmt < 3) || Projectile.ai[1] < 5f) && Projectile.ai[0] != 0f) return false; return true; } @@ -208,8 +208,8 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { // If 'split' projectile hits an enemy - if (projectile.ai[0] >= (float)(1 + penetrationAmt) && projectile.ai[0] < (float)(1 + penetrationAmt * 2)) - projectile.ai[0] = 0f; + if (Projectile.ai[0] >= (float)(1 + penetrationAmt) && Projectile.ai[0] < (float)(1 + penetrationAmt * 2)) + Projectile.ai[0] = 0f; // Becomes 5 on first hit, then 4, and so on penetrationAmt--; @@ -217,13 +217,13 @@ namespace CalamityMod.Projectiles.Melee // Hits enemy, ai[0] = 0f + 4f = 4f on first hit // ai[0] = 4f - 1f = 3f on second hit // ai[0] = 3f - 1f = 2f on third hit - if (projectile.ai[0] == 0f) - projectile.ai[0] += (float)penetrationAmt; + if (Projectile.ai[0] == 0f) + Projectile.ai[0] += (float)penetrationAmt; else - projectile.ai[0] -= (float)(penetrationAmt + 1); + Projectile.ai[0] -= (float)(penetrationAmt + 1); - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/TerraEdgeBeam.cs b/Projectiles/Melee/TerraEdgeBeam.cs index d37bbb0e95..1d3260e5ab 100644 --- a/Projectiles/Melee/TerraEdgeBeam.cs +++ b/Projectiles/Melee/TerraEdgeBeam.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,19 +15,19 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 600; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.timeLeft = 600; aiType = ProjectileID.TerraBeam; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 1.3f / 255f, 0f); + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 1.3f / 255f, 0f); } public override Color? GetAlpha(Color lightColor) @@ -41,17 +42,17 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); int num3; for (int num795 = 4; num795 < 31; num795 = num3 + 1) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / (float)num795); + float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[num798]; dust.velocity *= 0.05f; num3 = num795; diff --git a/Projectiles/Melee/TerraSpear.cs b/Projectiles/Melee/TerraSpear.cs index d44ca9fed3..2cca4bbc78 100644 --- a/Projectiles/Melee/TerraSpear.cs +++ b/Projectiles/Melee/TerraSpear.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,58 +17,58 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 180; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 1f / 255f, 0f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.localAI[1] == 0f) + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 1f / 255f, 0f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + if (Projectile.localAI[1] == 0f) { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) + Projectile.scale -= 0.01f; + Projectile.alpha += 15; + if (Projectile.alpha >= 125) { - projectile.alpha = 130; - projectile.localAI[1] = 1f; + Projectile.alpha = 130; + Projectile.localAI[1] = 1f; } } - else if (projectile.localAI[1] == 1f) + else if (Projectile.localAI[1] == 1f) { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[1] = 0f; + Projectile.alpha = 0; + Projectile.localAI[1] = 0f; } } if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); int num3; for (int num795 = 4; num795 < 31; num795 = num3 + 1) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / (float)num795); + float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[num798]; dust.velocity *= 0.05f; num3 = num795; @@ -76,17 +77,17 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 175) + if (Projectile.timeLeft > 175) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; } } } diff --git a/Projectiles/Melee/TerracottaExplosion.cs b/Projectiles/Melee/TerracottaExplosion.cs index 32732df08f..49f7e5d36c 100644 --- a/Projectiles/Melee/TerracottaExplosion.cs +++ b/Projectiles/Melee/TerracottaExplosion.cs @@ -15,55 +15,55 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.timeLeft = 5; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.35f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.35f, 0f); bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -74,10 +74,10 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 1.5f); Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; + Main.dust[num467].position.X = Projectile.Center.X; + Main.dust[num467].position.Y = Projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[Projectile.owner] = 6; } } } diff --git a/Projectiles/Melee/TerratomereProjectile.cs b/Projectiles/Melee/TerratomereProjectile.cs index 512fd60f4b..8380cb2cbb 100644 --- a/Projectiles/Melee/TerratomereProjectile.cs +++ b/Projectiles/Melee/TerratomereProjectile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TerratomereProjectile : ModProjectile @@ -14,22 +15,22 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.tileCollide = false; + Projectile.width = 30; + Projectile.height = 30; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.tileCollide = false; aiType = ProjectileID.TerraBeam; } public override void AI() { - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.75f / 255f, 0f); + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.75f / 255f, 0f); } public override Color? GetAlpha(Color lightColor) @@ -44,17 +45,17 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); int num3; for (int num795 = 4; num795 < 31; num795 = num3 + 1) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / (float)num795); + float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[num798]; dust.velocity *= 0.05f; num3 = num795; diff --git a/Projectiles/Melee/TerrorBeam.cs b/Projectiles/Melee/TerrorBeam.cs index 6fec0b0ea3..167367fb2a 100644 --- a/Projectiles/Melee/TerrorBeam.cs +++ b/Projectiles/Melee/TerrorBeam.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -13,51 +14,51 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Terror Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 7; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.light = 1f; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 7; + Projectile.alpha = 255; + Projectile.timeLeft = 600; + Projectile.light = 1f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } private void SpawnTerrorBlast() { int projID = ModContent.ProjectileType(); - int blastDamage = (int)(projectile.damage * TerrorBlade.TerrorBlastMultiplier); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, projID, blastDamage, projectile.knockBack, projectile.owner); + int blastDamage = (int)(Projectile.damage * TerrorBlade.TerrorBlastMultiplier); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, projID, blastDamage, Projectile.knockBack, Projectile.owner); } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { SpawnTerrorBlast(); } - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -65,46 +66,46 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer && projectile.localAI[0] == 0f) + if (Projectile.owner == Main.myPlayer && Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; SpawnTerrorBlast(); } } public override void AI() { - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - Main.PlaySound(SoundID.Item60, projectile.position); - projectile.localAI[1] += 1f; + SoundEngine.PlaySound(SoundID.Item60, Projectile.position); + Projectile.localAI[1] += 1f; } - projectile.alpha -= 40; - if (projectile.alpha < 0) + Projectile.alpha -= 40; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 0, 0, projectile.alpha); + return new Color(255, 0, 0, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override void Kill(int timeLeft) { // If no on-hit explosion was ever generated, spawn it for free when the beam expires. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) SpawnTerrorBlast(); } } diff --git a/Projectiles/Melee/TerrorBlast.cs b/Projectiles/Melee/TerrorBlast.cs index 67f070e523..9fcf8d8ea1 100644 --- a/Projectiles/Melee/TerrorBlast.cs +++ b/Projectiles/Melee/TerrorBlast.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TerrorBlast : ModProjectile @@ -15,47 +16,47 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = projectile.height = 2; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 30; + Projectile.width = Projectile.height = 2; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 30; // This projectile can only hit when it explodes, so these values aren't a problem. - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.melee = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = DamageClass.Melee; } // Terror Blasts do nothing until they explode. - public override bool CanDamage() => projectile.localAI[0] > 0f; + public override bool CanDamage() => Projectile.localAI[0] > 0f; public override void Kill(int timeLeft) { // Explode on death, becoming an enormous hitbox and spawning a ton of dust. - Main.PlaySound(SoundID.Item60, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 400; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item60, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 400; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 6; i++) - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); for (int i = 0; i < 60; i++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } // Guarantee a hit on all nearby enemies when the projectile explodes. Changing localAI[0] enables it to hit. - projectile.localAI[0] = 1f; - projectile.Damage(); + Projectile.localAI[0] = 1f; + Projectile.Damage(); } } } diff --git a/Projectiles/Melee/ThanatosBoom.cs b/Projectiles/Melee/ThanatosBoom.cs index 5e1f3c483b..eb0c53c9a2 100644 --- a/Projectiles/Melee/ThanatosBoom.cs +++ b/Projectiles/Melee/ThanatosBoom.cs @@ -11,23 +11,23 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = projectile.height = 54; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 45; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.melee = true; + Projectile.width = Projectile.height = 54; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 45; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { CreateExplosionDust(); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } } @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee float lifePersistance = Main.rand.NextFloat(0.8f, 1.7f); for (int i = 0; i < 60; i++) { - Dust energy = Dust.NewDustPerfect(projectile.Center, 267); + Dust energy = Dust.NewDustPerfect(Projectile.Center, 267); energy.velocity = (MathHelper.TwoPi * i / 60f).ToRotationVector2() * speed; energy.noGravity = true; energy.color = Main.hslToRgb(Main.rand.NextFloat(), 0.7f, 0.625f); diff --git a/Projectiles/Melee/ThornBase.cs b/Projectiles/Melee/ThornBase.cs index 5957657200..cf37e252b9 100644 --- a/Projectiles/Melee/ThornBase.cs +++ b/Projectiles/Melee/ThornBase.cs @@ -13,55 +13,55 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.aiStyle = 4; + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.aiStyle = 4; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; - if (projectile.ai[0] == 0f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + if (Projectile.ai[0] == 0f) { - projectile.alpha -= 50; - if (projectile.alpha > 0) + Projectile.alpha -= 50; + if (Projectile.alpha > 0) return; - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) + Projectile.alpha = 0; + Projectile.ai[0] = 1f; + if (Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; + Projectile.ai[1] += 1f; + Projectile.position += Projectile.velocity * 1f; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - int type = projectile.type; - if (projectile.ai[1] >= 6f) + int type = Projectile.type; + if (Projectile.ai[1] >= 6f) type = ModContent.ProjectileType(); - int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, type, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[number].ai[1] = projectile.ai[1] + 1f; + int number = Projectile.NewProjectile(Projectile.position.X + Projectile.velocity.X + (float)(Projectile.width / 2), Projectile.position.Y + Projectile.velocity.Y + (float)(Projectile.height / 2), Projectile.velocity.X, Projectile.velocity.Y, type, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Main.projectile[number].ai[1] = Projectile.ai[1] + 1f; } } else { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170) { for (int index = 0; index < 3; ++index) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 18, projectile.velocity.X * 0.025f, projectile.velocity.Y * 0.025f, 170, new Color(), 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 18, Projectile.velocity.X * 0.025f, Projectile.velocity.Y * 0.025f, 170, new Color(), 1.2f); } - Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, 0f, 0f, 170, new Color(), 1.1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 170, new Color(), 1.1f); } - projectile.alpha += 3; - if (projectile.alpha < 255) + Projectile.alpha += 3; + if (Projectile.alpha < 255) return; - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Melee/ThornTip.cs b/Projectiles/Melee/ThornTip.cs index 8e5a9a060e..d2c8352cb0 100644 --- a/Projectiles/Melee/ThornTip.cs +++ b/Projectiles/Melee/ThornTip.cs @@ -11,15 +11,15 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.melee = true; + Projectile.width = 28; + Projectile.height = 28; + Projectile.aiStyle = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; aiType = ProjectileID.VilethornTip; } } diff --git a/Projectiles/Melee/TinyCrystal.cs b/Projectiles/Melee/TinyCrystal.cs index f661f764dd..13d704cf50 100644 --- a/Projectiles/Melee/TinyCrystal.cs +++ b/Projectiles/Melee/TinyCrystal.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,29 +17,29 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 90; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 90; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 75 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 75 && target.CanBeChasedBy(Projectile); public override void AI() { - int dustType = projectile.ai[0] == 0f ? 56 : 73; + int dustType = Projectile.ai[0] == 0f ? 56 : 73; for (int num92 = 0; num92 < 2; num92++) { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; + float num93 = Projectile.velocity.X / 3f * (float)num92; + float num94 = Projectile.velocity.Y / 3f * (float)num92; int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, dustType, 0f, 0f, 100, default, 1.2f); + int num96 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num95, Projectile.position.Y + (float)num95), Projectile.width - num95 * 2, Projectile.height - num95 * 2, dustType, 0f, 0f, 100, default, 1.2f); Main.dust[num96].noGravity = true; Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; + Main.dust[num96].velocity += Projectile.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[num96]; expr_47FA_cp_0.position.X -= num93; Dust expr_4815_cp_0 = Main.dust[num96]; @@ -48,28 +49,28 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(10)) { int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, dustType, 0f, 0f, 100, default, 0.6f); + int num98 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num97, Projectile.position.Y + (float)num97), Projectile.width - num97 * 2, Projectile.height - num97 * 2, dustType, 0f, 0f, 100, default, 0.6f); Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; + Main.dust[num98].velocity += Projectile.velocity * 0.5f; } - if (projectile.timeLeft < 75) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 9f, 20f); + if (Projectile.timeLeft < 75) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 9f, 20f); } public override void Kill(int timeLeft) { - int dustType = projectile.ai[0] == 0f ? 56 : 73; + int dustType = Projectile.ai[0] == 0f ? 56 : 73; for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - int buffType = projectile.ai[0] == 0f ? BuffID.Frostburn : BuffID.OnFire; + int buffType = Projectile.ai[0] == 0f ? BuffID.Frostburn : BuffID.OnFire; target.AddBuff(buffType, 90); } } diff --git a/Projectiles/Melee/TinyFlare.cs b/Projectiles/Melee/TinyFlare.cs index 030222d459..74d57257d3 100644 --- a/Projectiles/Melee/TinyFlare.cs +++ b/Projectiles/Melee/TinyFlare.cs @@ -14,30 +14,30 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.melee = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.tileCollide = false; - projectile.extraUpdates = 1; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { for (int num468 = 0; num468 < 3; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default, 0.75f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, 0.75f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 10f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 10f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Tornado.cs b/Projectiles/Melee/Tornado.cs index 54b5c9b37f..056087cd73 100644 --- a/Projectiles/Melee/Tornado.cs +++ b/Projectiles/Melee/Tornado.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class Tornado : ModProjectile @@ -18,32 +19,32 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; } public override void AI() { //only 3 tornado can exist at a time - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 10f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] >= 10f) { - projectile.localAI[1] = 0f; + Projectile.localAI[1] = 0f; int projCount = 0; int oldestTornado = 0; float tornadoAge = 0f; - int projType = projectile.type; + int projType = Projectile.type; for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { Projectile proj = Main.projectile[projIndex]; - if (proj.active && proj.owner == projectile.owner && proj.type == projType && proj.ai[0] < 900f) + if (proj.active && proj.owner == Projectile.owner && proj.type == projType && proj.ai[0] < 900f) { projCount++; if (proj.ai[0] > tornadoAge) @@ -63,37 +64,37 @@ namespace CalamityMod.Projectiles.Melee } float num1125 = 900f; - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = -1; - Main.PlaySound(SoundID.Item122, projectile.Center); + Projectile.soundDelay = -1; + SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= num1125) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= num1125) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.localAI[0] >= 30f) + if (Projectile.localAI[0] >= 30f) { - projectile.damage = 0; - if (projectile.ai[0] < num1125 - 120f) + Projectile.damage = 0; + if (Projectile.ai[0] < num1125 - 120f) { - float num1126 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1126; - projectile.netUpdate = true; + float num1126 = Projectile.ai[0] % 60f; + Projectile.ai[0] = num1125 - 120f + num1126; + Projectile.netUpdate = true; } } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; + float num472 = Projectile.Center.X; + float num473 = Projectile.Center.Y; float num474 = 600f; for (int num475 = 0; num475 < 200; num475++) { NPC npc = Main.npc[num475]; - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { float npcCenterX = npc.position.X + (float)(npc.width / 2); float npcCenterY = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); + float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); if (num478 < num474) { if (npc.position.X < num472) @@ -117,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee } float num1127 = 15f; float num1128 = 15f; - Point point8 = projectile.Center.ToTileCoordinates(); + Point point8 = Projectile.Center.ToTileCoordinates(); int num1129; int num1130; Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); @@ -128,14 +129,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); value74.X = value74.Y * 0.2f; - projectile.width = (int)(value74.X * 0.65f); - projectile.height = (int)value74.Y; - projectile.Center = vector146; - if (projectile.owner == Main.myPlayer) + Projectile.width = (int)(value74.X * 0.65f); + Projectile.height = (int)value74.Y; + Projectile.Center = vector146; + if (Projectile.owner == Main.myPlayer) { bool flag74 = false; - Vector2 center16 = Main.player[projectile.owner].Center; - Vector2 top = Main.player[projectile.owner].Top; + Vector2 center16 = Main.player[Projectile.owner].Center; + Vector2 top = Main.player[Projectile.owner].Top; for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) { Vector2 position2 = Vector2.Lerp(value72, value73, num1131); @@ -145,14 +146,14 @@ namespace CalamityMod.Projectiles.Melee break; } } - if (!flag74 && projectile.ai[0] < num1125 - 120f) + if (!flag74 && Projectile.ai[0] < num1125 - 120f) { - float num1132 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1132; - projectile.netUpdate = true; + float num1132 = Projectile.ai[0] % 60f; + Projectile.ai[0] = num1125 - 120f + num1132; + Projectile.netUpdate = true; } } - if (projectile.ai[0] < num1125 - 120f) + if (Projectile.ai[0] < num1125 - 120f) { return; } @@ -163,13 +164,13 @@ namespace CalamityMod.Projectiles.Melee float num226 = 600f; float num227 = 15f; float num228 = 15f; - float num229 = projectile.ai[0]; + float num229 = Projectile.ai[0]; float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); if (num229 > num226 - 60f) { scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); } - Point point5 = projectile.Center.ToTileCoordinates(); + Point point5 = Projectile.Center.ToTileCoordinates(); int num230; int num231; Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); @@ -182,7 +183,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); vector33.X = vector33.Y * num232; new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Texture2D texture2D23 = Main.projectileTexture[Projectile.type]; Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); Vector2 origin3 = rectangle9.Size() / 2f; float num233 = -0.06283186f * num229; diff --git a/Projectiles/Melee/TriactisHammerProj.cs b/Projectiles/Melee/TriactisHammerProj.cs index c3c26dbef8..2a90c305f1 100644 --- a/Projectiles/Melee/TriactisHammerProj.cs +++ b/Projectiles/Melee/TriactisHammerProj.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -15,87 +16,87 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Triactis' True Paladinian Mage-Hammer of Might"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 160; - projectile.height = 160; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.melee = true; + Projectile.width = 160; + Projectile.height = 160; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.75f); - if (projectile.soundDelay == 0) + Lighting.AddLight(Projectile.Center, 0f, 0.5f, 0.75f); + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 30f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 30f) { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } } else { - projectile.tileCollide = false; + Projectile.tileCollide = false; float num42 = 20f; float num43 = 5f; - Vector2 vector2 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - vector2.Y; + Vector2 vector2 = new Vector2(Projectile.position.X + Projectile.width * 0.5f, Projectile.position.Y + Projectile.height * 0.5f); + float num44 = Main.player[Projectile.owner].position.X + Main.player[Projectile.owner].width / 2 - vector2.X; + float num45 = Main.player[Projectile.owner].position.Y + Main.player[Projectile.owner].height / 2 - vector2.Y; float num46 = (float)Math.Sqrt(num44 * num44 + num45 * num45); if (num46 > 3000f) - projectile.Kill(); + Projectile.Kill(); num46 = num42 / num46; num44 *= num46; num45 *= num46; - if (projectile.velocity.X < num44) + if (Projectile.velocity.X < num44) { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - projectile.velocity.X = projectile.velocity.X + num43; + Projectile.velocity.X = Projectile.velocity.X + num43; + if (Projectile.velocity.X < 0f && num44 > 0f) + Projectile.velocity.X = Projectile.velocity.X + num43; } - else if (projectile.velocity.X > num44) + else if (Projectile.velocity.X > num44) { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - projectile.velocity.X = projectile.velocity.X - num43; + Projectile.velocity.X = Projectile.velocity.X - num43; + if (Projectile.velocity.X > 0f && num44 < 0f) + Projectile.velocity.X = Projectile.velocity.X - num43; } - if (projectile.velocity.Y < num45) + if (Projectile.velocity.Y < num45) { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - projectile.velocity.Y = projectile.velocity.Y + num43; + Projectile.velocity.Y = Projectile.velocity.Y + num43; + if (Projectile.velocity.Y < 0f && num45 > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num43; } - else if (projectile.velocity.Y > num45) + else if (Projectile.velocity.Y > num45) { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - projectile.velocity.Y = projectile.velocity.Y - num43; + Projectile.velocity.Y = Projectile.velocity.Y - num43; + if (Projectile.velocity.Y > 0f && num45 < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num43; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + Rectangle rectangle = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[Projectile.owner].position.X, (int)Main.player[Projectile.owner].position.Y, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height); if (rectangle.Intersects(value2)) - projectile.Kill(); + Projectile.Kill(); } } - projectile.rotation += 0.5f; + Projectile.rotation += 0.5f; } public override Color? GetAlpha(Color lightColor) @@ -105,12 +106,12 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(SoundID.Item14, projectile.position); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -120,22 +121,22 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(SoundID.Item14, projectile.position); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -145,17 +146,17 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/TrueAncientBeam.cs b/Projectiles/Melee/TrueAncientBeam.cs index e953e816c0..43520561d8 100644 --- a/Projectiles/Melee/TrueAncientBeam.cs +++ b/Projectiles/Melee/TrueAncientBeam.cs @@ -7,6 +7,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -18,47 +19,47 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("True Ancient Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } const float MaxTime = 40; - public float Timer => MaxTime - projectile.timeLeft; + public float Timer => MaxTime - Projectile.timeLeft; public override void SetDefaults() { - projectile.width = projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = (int)MaxTime; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = (int)MaxTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 44f * projectile.scale; - Vector2 start = -Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * 16f; + float bladeLenght = 44f * Projectile.scale; + Vector2 start = -Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 16f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center + start, projectile.Center + start + Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint); } public override void AI() { - if (projectile.timeLeft < MaxTime - 5) - projectile.tileCollide = true; + if (Projectile.timeLeft < MaxTime - 5) + Projectile.tileCollide = true; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; - projectile.scale = 2.4f; - projectile.Opacity = 0.6f; - Lighting.AddLight(projectile.Center, 0.75f, 1f, 0.24f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.scale = 2.4f; + Projectile.Opacity = 0.6f; + Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); - projectile.velocity *= (1 - (float)Math.Pow(Timer / MaxTime, 3)); + Projectile.velocity *= (1 - (float)Math.Pow(Timer / MaxTime, 3)); if (Main.rand.NextBool(3)) { - int dustTrail = Dust.NewDust(projectile.Center, 14, 14, 66, projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + int dustTrail = Dust.NewDust(Projectile.Center, 14, 14, 66, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); Main.dust[dustTrail].noGravity = true; } @@ -67,21 +68,21 @@ namespace CalamityMod.Projectiles.Melee int dustType = Main.rand.Next(3); dustType = dustType == 0 ? 15 : dustType == 1 ? 57 : 58; - Dust.NewDust(projectile.Center, 14, 14, dustType, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 150, default, 1.3f); + Dust.NewDust(Projectile.Center, 14, 14, dustType, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 150, default, 1.3f); } - if (projectile.velocity.Length() < 1.0f) - projectile.Kill(); + if (Projectile.velocity.Length() < 1.0f) + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 35) + if (Projectile.timeLeft > 35) return false; - DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -94,7 +95,7 @@ namespace CalamityMod.Projectiles.Melee Color color = Main.hslToRgb((Main.GlobalTime * 0.6f) % 1, 1, 0.85f); float rotation = Main.GlobalTime * 8f; - Vector2 sparkCenter = projectile.Center - Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * 30.5f - Main.screenPosition; + Vector2 sparkCenter = Projectile.Center - Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 30.5f - Main.screenPosition; spriteBatch.Draw(bloomTexture, sparkCenter, null, color* 0.5f, 0, bloomTexture.Size() / 2f, 4 * properBloomSize, SpriteEffects.None, 0); spriteBatch.Draw(starTexture, sparkCenter, null, color * 0.5f, rotation + MathHelper.PiOver4, starTexture.Size() / 2f, 2 * 0.75f, SpriteEffects.None, 0); @@ -109,18 +110,18 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.DD2_WitherBeastDeath, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath, Projectile.Center); for (int i = 0; i < 10; i++) { Vector2 particleSpeed = Main.rand.NextVector2CircularEdge(1, 1) * Main.rand.NextFloat(1.2f, 2.3f); - Particle energyLeak = new SquishyLightParticle(projectile.Center + Utils.SafeNormalize(projectile.velocity, Vector2.Zero) * 40f, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Cyan, 60, 1, 1.5f, hueShift: 0.02f); + Particle energyLeak = new SquishyLightParticle(Projectile.Center + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 40f, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Cyan, 60, 1, 1.5f, hueShift: 0.02f); GeneralParticleHandler.SpawnParticle(energyLeak); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : projectile.Center + projectile.rotation.ToRotationVector2() * 60f; + Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f; for (int i = 0; i < 10; i++) { Vector2 particleSpeed = Main.rand.NextVector2CircularEdge(1, 1) * Main.rand.NextFloat(2.6f, 4f); diff --git a/Projectiles/Melee/TrueAncientBlast.cs b/Projectiles/Melee/TrueAncientBlast.cs index bf54289480..7ca4a438d9 100644 --- a/Projectiles/Melee/TrueAncientBlast.cs +++ b/Projectiles/Melee/TrueAncientBlast.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -18,31 +19,31 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Ancient Energy Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } const float MaxTime = 20; - public float Timer => MaxTime - projectile.timeLeft; + public float Timer => MaxTime - Projectile.timeLeft; - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 8; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - projectile.timeLeft = 20; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 8; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + Projectile.timeLeft = 20; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 20f, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity, 20f, ref collisionPoint); } public override bool ShouldUpdatePosition() => false; @@ -51,13 +52,13 @@ namespace CalamityMod.Projectiles.Melee { if (Timer == 0) { - Particle Star = new GenericSparkle(projectile.Center, Vector2.Zero, Color.White, Color.HotPink, Main.rand.NextFloat(2f, 2.5f), 20, 0.1f, 3f); + Particle Star = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Color.HotPink, Main.rand.NextFloat(2f, 2.5f), 20, 0.1f, 3f); GeneralParticleHandler.SpawnParticle(Star); - Star = new GenericSparkle(projectile.Center + projectile.velocity, Vector2.Zero, Color.White, Color.PaleGoldenrod, Main.rand.NextFloat(2f, 2.5f), 20, 0.1f, 3f); + Star = new GenericSparkle(Projectile.Center + Projectile.velocity, Vector2.Zero, Color.White, Color.PaleGoldenrod, Main.rand.NextFloat(2f, 2.5f), 20, 0.1f, 3f); GeneralParticleHandler.SpawnParticle(Star); - Main.PlaySound(SoundID.Item84, projectile.Center); + SoundEngine.PlaySound(SoundID.Item84, Projectile.Center); } } @@ -69,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 10; i++) { - Vector2 particleSpeed = Utils.SafeNormalize(projectile.velocity, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f); + Vector2 particleSpeed = Utils.SafeNormalize(Projectile.velocity, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f); Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Cyan, 60, 1, 1.5f, hueShift: 0.02f); GeneralParticleHandler.SpawnParticle(energyLeak); } @@ -78,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { //Add some damage falloff - damage = (int)(damage * Math.Pow((1 - TrueArkoftheAncients.blastFalloffStrenght), projectile.numHits * TrueArkoftheAncients.blastFalloffSpeed)); + damage = (int)(damage * Math.Pow((1 - TrueArkoftheAncients.blastFalloffStrenght), Projectile.numHits * TrueArkoftheAncients.blastFalloffSpeed)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -88,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee float displace = 10 * (1f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.8f)); - float angle = projectile.velocity.ToRotation(); + float angle = Projectile.velocity.ToRotation(); float drawRotation = angle + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, sword.Height); @@ -108,15 +109,15 @@ namespace CalamityMod.Projectiles.Melee Vector2 origin = new Vector2(tex.Width / 2f, tex.Height); float size = Timer / MaxTime > 0.5f ? (float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.2f + 0.8f : (float)Math.Sin(Timer / MaxTime * MathHelper.Pi); size *= 3; - Vector2 scale = new Vector2(size, projectile.velocity.Length() / tex.Height); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.LightPink, rot, origin, scale, SpriteEffects.None, 0); + Vector2 scale = new Vector2(size, Projectile.velocity.Length() / tex.Height); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Color.LightPink, rot, origin, scale, SpriteEffects.None, 0); //Cap the lines Texture2D cap = GetTexture("CalamityMod/Particles/BloomLineCap"); scale = new Vector2(size, size); origin = new Vector2(cap.Width / 2f, cap.Height); - spriteBatch.Draw(cap, projectile.Center - Main.screenPosition, null, Color.LightPink, rot + MathHelper.Pi, origin, scale, SpriteEffects.None, 0); - spriteBatch.Draw(cap, projectile.Center + projectile.velocity - Main.screenPosition, null, Color.LightPink, rot, origin, scale, SpriteEffects.None, 0); + spriteBatch.Draw(cap, Projectile.Center - Main.screenPosition, null, Color.LightPink, rot + MathHelper.Pi, origin, scale, SpriteEffects.None, 0); + spriteBatch.Draw(cap, Projectile.Center + Projectile.velocity - Main.screenPosition, null, Color.LightPink, rot, origin, scale, SpriteEffects.None, 0); spriteBatch.End(); diff --git a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs index e70900f8cf..316f795680 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -19,10 +20,10 @@ namespace CalamityMod.Projectiles.Melee private bool initialized = false; const float MaxTime = 340; static float ParryTime = 15; - public Vector2 DistanceFromPlayer => projectile.velocity * 10 * (1f + ((float)Math.Sin(Timer / ParryTime * MathHelper.Pi) * 0.8f)); - public float Timer => MaxTime - projectile.timeLeft; - public ref float AlreadyParried => ref projectile.ai[1]; - public Player Owner => Main.player[projectile.owner]; + public Vector2 DistanceFromPlayer => Projectile.velocity * 10 * (1f + ((float)Math.Sin(Timer / ParryTime * MathHelper.Pi) * 0.8f)); + public float Timer => MaxTime - Projectile.timeLeft; + public ref float AlreadyParried => ref Projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { @@ -30,12 +31,12 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 75; - projectile.width = projectile.height = 75; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 75; + Projectile.width = Projectile.height = 75; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; } public override bool CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; @@ -44,8 +45,8 @@ namespace CalamityMod.Projectiles.Melee { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 100f * projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (projectile.velocity * bladeLenght), 24, ref collisionPoint); + float bladeLenght = 100f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint); } public void GeneralParryEffects() @@ -53,9 +54,9 @@ namespace CalamityMod.Projectiles.Melee TrueArkoftheAncients sword = (Owner.HeldItem.modItem as TrueArkoftheAncients); if (sword != null) sword.Charge = 10f; - Main.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); - Main.PlaySound(SoundID.Item67); - CombatText.NewText(projectile.Hitbox, new Color(111, 247, 200), "Parry!", true); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); + SoundEngine.PlaySound(SoundID.Item67); + CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), "Parry!", true); AlreadyParried = 1f; } @@ -70,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee if (target.damage > 0) Owner.GiveIFrames(35); - Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : projectile.Center + projectile.rotation.ToRotationVector2() * 60f; + Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f; Particle spark = new GenericSparkle(particleOrigin, Vector2.Zero, Color.White, Color.HotPink, 1.2f, 35, 0.1f, 2); GeneralParticleHandler.SpawnParticle(spark); @@ -86,21 +87,21 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - projectile.timeLeft = (int)MaxTime; - Main.PlaySound(SoundID.DD2_SkyDragonsFuryShot, projectile.Center); + Projectile.timeLeft = (int)MaxTime; + SoundEngine.PlaySound(SoundID.DD2_SkyDragonsFuryShot, Projectile.Center); - projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - projectile.velocity.Normalize(); - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); + Projectile.velocity.Normalize(); + Projectile.rotation = Projectile.velocity.ToRotation(); initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } //Manage position and rotation - projectile.Center = Owner.Center + DistanceFromPlayer ; - projectile.scale = 1.4f + ((float)Math.Sin(Timer / 160 * MathHelper.Pi) * 0.6f); //SWAGGER + Projectile.Center = Owner.Center + DistanceFromPlayer ; + Projectile.scale = 1.4f + ((float)Math.Sin(Timer / 160 * MathHelper.Pi) * 0.6f); //SWAGGER if (Timer > ParryTime) return; @@ -108,7 +109,7 @@ namespace CalamityMod.Projectiles.Melee if (AlreadyParried == 0) { float collisionPoint = 0f; - float bladeLenght = 100f * projectile.scale; + float bladeLenght = 100f * Projectile.scale; for (int k = 0; k < Main.maxProjectiles; k++) { @@ -117,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee if (proj.active && proj.hostile && proj.damage > 1 && //Only parry harmful projectiles proj.velocity.Length() * (proj.extraUpdates + 1) > 1f && //Only parry projectiles that move semi-quickly proj.Size.Length() < 300 && //Only parry projectiles that aren't too large - Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (projectile.velocity * bladeLenght), 24, ref collisionPoint)) + Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint)) { GeneralParryEffects(); @@ -138,9 +139,9 @@ namespace CalamityMod.Projectiles.Melee } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; - Owner.direction = Math.Sign(projectile.velocity.X); - Owner.itemRotation = projectile.rotation; + Owner.heldProj = Projectile.whoAmI; + Owner.direction = Math.Sign(Projectile.velocity.X); + Owner.itemRotation = Projectile.rotation; if (Owner.direction != 1) { Owner.itemRotation -= MathHelper.Pi; @@ -166,7 +167,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawPos = Owner.Center - Main.screenPosition + new Vector2(0, -36) - barBG.Size() / 2; Rectangle frame = new Rectangle(0, 0, (int)((Timer - ParryTime) / (MaxTime - ParryTime) * barFG.Width), barFG.Height); - float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? projectile.timeLeft / 8f : 1f; + float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? Projectile.timeLeft / 8f : 1f; Color color = Main.hslToRgb((Main.GlobalTime * 1.2f) % 1, 1, 0.85f + (float)Math.Sin(Main.GlobalTime * 7f) * 0.1f); spriteBatch.Draw(barBG, drawPos, color * opacity); @@ -179,20 +180,20 @@ namespace CalamityMod.Projectiles.Melee Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncients"); Texture2D glowmask = GetTexture("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncientsGlow"); - float drawRotation = projectile.rotation + MathHelper.PiOver4; + float drawRotation = Projectile.rotation + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, sword.Height); - Vector2 drawOffset = Owner.Center + projectile.velocity * DistanceFromPlayer.Length() - Main.screenPosition; + Vector2 drawOffset = Owner.Center + Projectile.velocity * DistanceFromPlayer.Length() - Main.screenPosition; - spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); - spriteBatch.Draw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + spriteBatch.Draw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); if (AlreadyParried > 0) { drawOrigin = new Vector2(0f, 48f); Rectangle frame = new Rectangle(24, 0, 48, 48); - drawOffset = Owner.Center + projectile.velocity * (DistanceFromPlayer.Length() + 34) - Main.screenPosition; - spriteBatch.Draw(glowmask, drawOffset, frame, Main.hslToRgb(Main.GlobalTime % 1, 1, 0.8f) * (1 - AlreadyParried / ParryTime), drawRotation, drawOrigin, projectile.scale + AlreadyParried / ParryTime, 0f, 0f); + drawOffset = Owner.Center + Projectile.velocity * (DistanceFromPlayer.Length() + 34) - Main.screenPosition; + spriteBatch.Draw(glowmask, drawOffset, frame, Main.hslToRgb(Main.GlobalTime % 1, 1, 0.8f) * (1 - AlreadyParried / ParryTime), drawRotation, drawOrigin, Projectile.scale + AlreadyParried / ParryTime, 0f, 0f); } return false; @@ -202,7 +203,7 @@ namespace CalamityMod.Projectiles.Melee { //Play a blip when it dies, to indicate to the player its ready to get used again if (Main.myPlayer == Owner.whoAmI) - Main.PlaySound(SoundID.Item35); + SoundEngine.PlaySound(SoundID.Item35); } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs index 34fbb9d1a0..b9ea2f505b 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs @@ -9,6 +9,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee @@ -19,44 +20,44 @@ namespace CalamityMod.Projectiles.Melee private bool initialized = false; Vector2 direction = Vector2.Zero; - public float SwingDirection => projectile.ai[0] * Math.Sign(direction.X); - public ref float Charge => ref projectile.ai[1]; - public ref float HasFired => ref projectile.localAI[0]; + public float SwingDirection => Projectile.ai[0] * Math.Sign(direction.X); + public ref float Charge => ref Projectile.ai[1]; + public ref float HasFired => ref Projectile.localAI[0]; const float MaxTime = 35; private float SwingWidth = MathHelper.PiOver2 * 1.5f; public Vector2 DistanceFromPlayer => direction * 30; - public float Timer => MaxTime - projectile.timeLeft; - public Player Owner => Main.player[projectile.owner]; + public float Timer => MaxTime - Projectile.timeLeft; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { DisplayName.SetDefault("Ark of the Ancients"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 60; - projectile.width = projectile.height = 60; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = (int)MaxTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 60; + Projectile.width = Projectile.height = 60; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = (int)MaxTime; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 88f * projectile.scale; - Vector2 holdPoint = DistanceFromPlayer.Length() * projectile.rotation.ToRotationVector2(); + float bladeLenght = 88f * Projectile.scale; + Vector2 holdPoint = DistanceFromPlayer.Length() * Projectile.rotation.ToRotationVector2(); - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint); } @@ -71,37 +72,37 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - projectile.timeLeft = (int)MaxTime; - var sound = Main.PlaySound(Charge > 0 ? SoundID.DD2_PhantomPhoenixShot : SoundID.DD2_MonkStaffSwing, projectile.Center); + Projectile.timeLeft = (int)MaxTime; + var sound = SoundEngine.PlaySound(Charge > 0 ? SoundID.DD2_PhantomPhoenixShot : SoundID.DD2_MonkStaffSwing, Projectile.Center); if (Charge > 0) CalamityUtils.SafeVolumeChange(ref sound, 2.5f); - direction = projectile.velocity; + direction = Projectile.velocity; direction.Normalize(); - projectile.rotation = direction.ToRotation(); + Projectile.rotation = direction.ToRotation(); initialized = true; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } //Manage position and rotation - projectile.Center = Owner.Center + DistanceFromPlayer; + Projectile.Center = Owner.Center + DistanceFromPlayer; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Lerp(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, SwingRatio()); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Lerp(SwingWidth / 2 * SwingDirection, -SwingWidth / 2 * SwingDirection, SwingRatio()); - projectile.scale = 1.4f + ((float)Math.Sin(SwingRatio() * MathHelper.Pi) * 0.6f) + (Charge / 10f) * 0.6f; + Projectile.scale = 1.4f + ((float)Math.Sin(SwingRatio() * MathHelper.Pi) * 0.6f) + (Charge / 10f) * 0.6f; if (Owner.whoAmI == Main.myPlayer && SwingRatio() > 0.5f && HasFired == 0f && Charge > 0) { - Projectile.NewProjectile(Owner.Center + direction * 30f, projectile.velocity * 2f, ProjectileType(), (int)(projectile.damage * TrueArkoftheAncients.beamDamageMultiplier), 2f, Owner.whoAmI) ; + Projectile.NewProjectile(Owner.Center + direction * 30f, Projectile.velocity * 2f, ProjectileType(), (int)(Projectile.damage * TrueArkoftheAncients.beamDamageMultiplier), 2f, Owner.whoAmI) ; HasFired = 1f; } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; - Owner.direction = Math.Sign(projectile.velocity.X); - Owner.itemRotation = projectile.rotation; + Owner.heldProj = Projectile.whoAmI; + Owner.direction = Math.Sign(Projectile.velocity.X); + Owner.itemRotation = Projectile.rotation; if (Owner.direction != 1) { Owner.itemRotation -= MathHelper.Pi; @@ -110,8 +111,8 @@ namespace CalamityMod.Projectiles.Melee if (Charge > 0 && Main.rand.Next(2) == 0) { - Vector2 particleOrigin = projectile.Center + projectile.rotation.ToRotationVector2() * 85 * projectile.scale; - Vector2 particleSpeed = projectile.rotation.ToRotationVector2().RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(1.2f, 2f); + Vector2 particleOrigin = Projectile.Center + Projectile.rotation.ToRotationVector2() * 85 * Projectile.scale; + Vector2 particleSpeed = Projectile.rotation.ToRotationVector2().RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(1.2f, 2f); Particle energyLeak = new CritSpark(particleOrigin, particleSpeed + Owner.velocity, Color.White, Color.Cyan, Main.rand.NextFloat(0.6f, 1.6f), 20 + Main.rand.Next(10), 0.1f, 1.5f, hueShift: 0.02f); GeneralParticleHandler.SpawnParticle(energyLeak); } @@ -127,23 +128,23 @@ namespace CalamityMod.Projectiles.Melee float extraAngle = Owner.direction < 0 ? MathHelper.PiOver2 : 0f; - float drawAngle = projectile.rotation; - float drawRotation = projectile.rotation + MathHelper.PiOver4 + extraAngle; + float drawAngle = Projectile.rotation; + float drawRotation = Projectile.rotation + MathHelper.PiOver4 + extraAngle; Vector2 drawOrigin = new Vector2(Owner.direction < 0 ? sword.Width : 0f , sword.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - if (CalamityConfig.Instance.Afterimages && Timer > ProjectileID.Sets.TrailCacheLength[projectile.type]) + if (CalamityConfig.Instance.Afterimages && Timer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) { - for (int i = 0; i < projectile.oldRot.Length; ++i) + for (int i = 0; i < Projectile.oldRot.Length; ++i) { - Color color = Main.hslToRgb((i / (float)projectile.oldRot.Length) * 0.7f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f)); - float afterimageRotation = projectile.oldRot[i] + MathHelper.PiOver4; - spriteBatch.Draw(glowmask, drawOffset, null, color * 0.15f, afterimageRotation + extraAngle, drawOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), flip, 0f); + Color color = Main.hslToRgb((i / (float)Projectile.oldRot.Length) * 0.7f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f)); + float afterimageRotation = Projectile.oldRot[i] + MathHelper.PiOver4; + spriteBatch.Draw(glowmask, drawOffset, null, color * 0.15f, afterimageRotation + extraAngle, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), flip, 0f); } } - spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, flip, 0f); - spriteBatch.Draw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, flip, 0f); + spriteBatch.Draw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f); + spriteBatch.Draw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f); if (Charge > 0 && Timer / MaxTime > 0.5f) { @@ -156,7 +157,7 @@ namespace CalamityMod.Projectiles.Melee float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * Timer / MaxTime) * SwingDirection; Color smearColor = Main.hslToRgb(((Timer - MaxTime * 0.5f ) / (MaxTime * 0.5f)) * 0.7f, 1, 0.6f); - spriteBatch.Draw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, projectile.scale * 1.4f, SpriteEffects.None, 0); + spriteBatch.Draw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 1.4f, SpriteEffects.None, 0); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Melee/TrueBiomeBladeHoldout.cs b/Projectiles/Melee/TrueBiomeBladeHoldout.cs index 152aec661b..017fa4434d 100644 --- a/Projectiles/Melee/TrueBiomeBladeHoldout.cs +++ b/Projectiles/Melee/TrueBiomeBladeHoldout.cs @@ -9,17 +9,18 @@ using Terraria.ID; using Terraria.ModLoader; using static CalamityMod.CalamityUtils; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TrueBiomeBladeHoldout : ModProjectile //Visuals { - private Player Owner => Main.player[projectile.owner]; + private Player Owner => Main.player[Projectile.owner]; public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.modItem as OmegaBiomeBlade).CanUseItem(Owner) : false; public bool OwnerMayChannel => Owner.itemAnimation == 0 && OwnerCanUseItem && Owner.Calamity().mouseRight && Owner.active && !Owner.dead; - public ref float ChanneledState => ref projectile.ai[0]; - public ref float ChannelTimer => ref projectile.ai[1]; - public ref float Initialized => ref projectile.localAI[0]; + public ref float ChanneledState => ref Projectile.ai[0]; + public ref float ChannelTimer => ref Projectile.ai[1]; + public ref float Initialized => ref Projectile.localAI[0]; private Item associatedItem; const int ChannelTime = 120; @@ -32,13 +33,13 @@ namespace CalamityMod.Projectiles.Melee public bool drawIndrawHeldProjInFrontOfHeldItemAndArms = true; public override void SetDefaults() { - projectile.width = projectile.height = 36; - projectile.aiStyle = -1; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.tileCollide = false; - projectile.damage = 0; + Projectile.width = Projectile.height = 36; + Projectile.aiStyle = -1; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.tileCollide = false; + Projectile.damage = 0; } public CurveSegment anticipation = new CurveSegment(EasingType.SineBump, 0f, 0f, -0.3f); @@ -54,12 +55,12 @@ namespace CalamityMod.Projectiles.Melee //If dropped, kill it instantly if (Owner.HeldItem.type != ItemType()) { - projectile.Kill(); + Projectile.Kill(); return; } if (Owner.whoAmI == Main.myPlayer) - Main.PlaySound(SoundID.DD2_DarkMageHealImpact); + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact); associatedItem = Owner.HeldItem; //Switch up the attunements @@ -71,21 +72,21 @@ namespace CalamityMod.Projectiles.Melee if (!OwnerMayChannel && ChanneledState == 0f) //IF the channeling gets interrupted for any reason { - projectile.Center = Owner.Top + new Vector2(18f, 0f); + Projectile.Center = Owner.Top + new Vector2(18f, 0f); ChanneledState = 1f; - projectile.timeLeft = 60; + Projectile.timeLeft = 60; return; } if (ChanneledState == 0f) { - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.itemRotation = (-Vector2.UnitY).ToRotation(); - projectile.Center = Owner.Top + new Vector2(0f, -20f * SwordHeight() - 50f); - projectile.rotation = -MathHelper.PiOver4; // No more silly turnaround with the repaired one? + Projectile.Center = Owner.Top + new Vector2(0f, -20f * SwordHeight() - 50f); + Projectile.rotation = -MathHelper.PiOver4; // No more silly turnaround with the repaired one? ChannelTimer++; - projectile.timeLeft = 60; + Projectile.timeLeft = 60; if (ChannelTimer == ChannelTime - 15) { @@ -109,22 +110,22 @@ namespace CalamityMod.Projectiles.Melee if (ChannelTimer >= ChannelTime - 15) { Vector2 Shake = Main.rand.NextVector2Circular(6f, 6f); - projectile.Center += Shake; + Projectile.Center += Shake; - Vector2 Bottom = projectile.Center + Vector2.UnitY * 20f; + Vector2 Bottom = Projectile.Center + Vector2.UnitY * 20f; Particle Sparkle = new ElectricSpark(Bottom, -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(10f, 20f), Color.White, Main.rand.NextBool() ? Main.rand.NextBool() ? Color.Goldenrod : Color.GreenYellow : Main.rand.NextBool() ? Color.Cyan : Color.Magenta, 1f + Main.rand.NextFloat(0f, 1f), 34, rotationSpeed: 0.1f, bloomScale: 4f); GeneralParticleHandler.SpawnParticle(Sparkle); } if (ChannelTimer >= ChannelTime) { - projectile.timeLeft = 60; + Projectile.timeLeft = 60; ChanneledState = 2f; //State where it stays invisible doing nothing. Acts as a cooldown } } if (ChanneledState == 1f) - projectile.position += Vector2.UnitY * -0.3f * (1f + projectile.timeLeft / 60f); + Projectile.position += Vector2.UnitY * -0.3f * (1f + Projectile.timeLeft / 60f); } public void Attune(OmegaBiomeBlade item) @@ -154,15 +155,15 @@ namespace CalamityMod.Projectiles.Melee //If the owner already had the attunement , break out of it (And unswap) if (item.secondaryAttunement == attunement) { - Main.PlaySound(SoundID.DD2_LightningBugZap, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_LightningBugZap, Projectile.Center); item.secondaryAttunement = item.mainAttunement; item.mainAttunement = attunement; return; } //Chunger - var Sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThunderStrike"), projectile.Center); + var Sound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThunderStrike"), Projectile.Center); CalamityUtils.SafeVolumeChange(ref Sound, 0.4f); - Particle thunder = new ThunderBoltVFX(projectile.Center + Vector2.UnitY * 20f, Main.rand.NextBool() ? Main.rand.NextBool() ? Color.Goldenrod : Color.GreenYellow : Main.rand.NextBool() ? Color.Cyan : Color.Magenta, 0f, 1.5f, Vector2.One, 1f, 15f, projectile, 20f); + Particle thunder = new ThunderBoltVFX(Projectile.Center + Vector2.UnitY * 20f, Main.rand.NextBool() ? Main.rand.NextBool() ? Color.Goldenrod : Color.GreenYellow : Main.rand.NextBool() ? Color.Cyan : Color.Magenta, 0f, 1.5f, Vector2.One, 1f, 15f, Projectile, 20f); GeneralParticleHandler.SpawnParticle(thunder); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 5) @@ -192,7 +193,7 @@ namespace CalamityMod.Projectiles.Melee if (ChanneledState == 0f && ChannelTimer > 10f) { Texture2D tex = GetTexture(Texture); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, lightColor, projectile.rotation, tex.Size() / 2, 1, 0, 0); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2, 1, 0, 0); return false; @@ -200,9 +201,9 @@ namespace CalamityMod.Projectiles.Melee else if (ChanneledState == 1f) { Texture2D tex = GetTexture(Texture); - Vector2 squishyScale = new Vector2(Math.Abs((float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * projectile.timeLeft / 30f)), 1f); - SpriteEffects flip = (float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * projectile.timeLeft / 30f) > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(tex, projectile.position - Main.screenPosition, null, lightColor * (projectile.timeLeft / 60f), 0, tex.Size() / 2, squishyScale * (2f - (projectile.timeLeft / 60f)), flip, 0); + Vector2 squishyScale = new Vector2(Math.Abs((float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f)), 1f); + SpriteEffects flip = (float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f) > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(tex, Projectile.position - Main.screenPosition, null, lightColor * (Projectile.timeLeft / 60f), 0, tex.Size() / 2, squishyScale * (2f - (Projectile.timeLeft / 60f)), flip, 0); return false; } diff --git a/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs b/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs index d598f860fb..ea398ffdcb 100644 --- a/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs +++ b/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs @@ -9,17 +9,18 @@ using CalamityMod.Particles; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; using CalamityMod.DataStructures; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class ChainedMeatHook : ModProjectile { public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChainedHook"; - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; - public float Timer => MaxTwirlTime - projectile.timeLeft; + public float Timer => MaxTwirlTime - Projectile.timeLeft; public static float MaxTwirlTime = 30; - public ref float Twirling => ref projectile.ai[0]; + public ref float Twirling => ref Projectile.ai[0]; public bool MayIExist => Owner.active && (Owner.HeldItem.modItem is OmegaBiomeBlade blade) && blade.secondaryAttunement != null && blade.secondaryAttunement.id == AttunementID.FlailBlade; @@ -32,14 +33,14 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 66; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; - projectile.timeLeft = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 66; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; + Projectile.timeLeft = 1; } public override bool? CanHitNPC(NPC target) => Twirling == 1f && !target.friendly; @@ -48,64 +49,64 @@ namespace CalamityMod.Projectiles.Melee { if (!MayIExist) { - projectile.Kill(); + Projectile.Kill(); return; } if (Twirling == 0) { - projectile.velocity = Vector2.Zero; - projectile.timeLeft = 2; + Projectile.velocity = Vector2.Zero; + Projectile.timeLeft = 2; Vector2 idealPosition = Owner.Center - Owner.direction * Vector2.UnitX * 40f + Vector2.One.RotatedBy(Main.GlobalTime) * 10f; - if ((idealPosition - projectile.Center).Length() > 1500f) - projectile.Center = idealPosition; - projectile.Center = Vector2.Lerp(projectile.Center, idealPosition, 0.05f); - projectile.Center = projectile.Center.MoveTowards(idealPosition, 4f); + if ((idealPosition - Projectile.Center).Length() > 1500f) + Projectile.Center = idealPosition; + Projectile.Center = Vector2.Lerp(Projectile.Center, idealPosition, 0.05f); + Projectile.Center = Projectile.Center.MoveTowards(idealPosition, 4f); } if (Twirling == 1f) { - if (projectile.timeLeft == MaxTwirlTime) + if (Projectile.timeLeft == MaxTwirlTime) { - projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - Main.PlaySound(SoundID.Item71, projectile.Center); + Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); + SoundEngine.PlaySound(SoundID.Item71, Projectile.Center); for (int i = 0; i < 4; i++) { - Particle Sparkle = new CritSpark(projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * projectile.scale, Color.White, Main.rand.NextBool() ? Color.Cyan : Color.MediumTurquoise, 0.4f + Main.rand.NextFloat(0f, 0.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * Projectile.scale, Color.White, Main.rand.NextBool() ? Color.Cyan : Color.MediumTurquoise, 0.4f + Main.rand.NextFloat(0f, 0.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } if (smear == null) { - smear = new CircularSmearVFX(Owner.Center, Color.HotPink, projectile.velocity.ToRotation(), projectile.scale * 1.5f); + smear = new CircularSmearVFX(Owner.Center, Color.HotPink, Projectile.velocity.ToRotation(), Projectile.scale * 1.5f); GeneralParticleHandler.SpawnParticle(smear); } } - projectile.velocity = projectile.velocity.RotatedBy(MathHelper.TwoPi * -2f * (1 / MaxTwirlTime)); - projectile.velocity.Normalize(); - projectile.rotation = projectile.velocity.ToRotation(); - projectile.Center = Owner.Center + (projectile.velocity * 140 * (1 + 0.3f * (float)Math.Sin(projectile.timeLeft / MaxTwirlTime * MathHelper.Pi))); + Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.TwoPi * -2f * (1 / MaxTwirlTime)); + Projectile.velocity.Normalize(); + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.Center = Owner.Center + (Projectile.velocity * 140 * (1 + 0.3f * (float)Math.Sin(Projectile.timeLeft / MaxTwirlTime * MathHelper.Pi))); //Update the variables of the smear if (smear != null) { - smear.Rotation = projectile.rotation + MathHelper.PiOver2; + smear.Rotation = Projectile.rotation + MathHelper.PiOver2; smear.Time = 0; smear.Position = Owner.Center; smear.Scale = 3.4f; - smear.Color = Color.MediumTurquoise * 0.9f * (float)Math.Sin(projectile.timeLeft / MaxTwirlTime * MathHelper.Pi); + smear.Color = Color.MediumTurquoise * 0.9f * (float)Math.Sin(Projectile.timeLeft / MaxTwirlTime * MathHelper.Pi); } - if (projectile.timeLeft == 1) + if (Projectile.timeLeft == 1) { - Main.PlaySound(SoundID.Item101, projectile.Center); + SoundEngine.PlaySound(SoundID.Item101, Projectile.Center); for (int i = 0; i < 4; i++) { - Particle Sparkle = new CritSpark(projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * projectile.scale, Color.White, Main.rand.NextBool() ? Color.Cyan : Color.MediumTurquoise, 0.4f + Main.rand.NextFloat(0f, 0.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * Projectile.scale, Color.White, Main.rand.NextBool() ? Color.Cyan : Color.MediumTurquoise, 0.4f + Main.rand.NextFloat(0f, 0.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } Twirling = 0f; @@ -120,10 +121,10 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item105, projectile.Center); + SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); for (int i = 0; i < 10; i++) { - Particle Sparkle = new CritSpark(projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * projectile.scale, Color.White, Main.rand.NextBool() ? Color.Cyan : Color.MediumTurquoise, 0.4f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * Projectile.scale, Color.White, Main.rand.NextBool() ? Color.Cyan : Color.MediumTurquoise, 0.4f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } } @@ -133,13 +134,13 @@ namespace CalamityMod.Projectiles.Melee Texture2D handle = GetTexture("CalamityMod/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChainedHookBody"); Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChainedHook"); - float drawAngle = (projectile.Center - Owner.Center).ToRotation(); + float drawAngle = (Projectile.Center - Owner.Center).ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, handle.Height); - Vector2 drawOffset = projectile.Center - Main.screenPosition; + Vector2 drawOffset = Projectile.Center - Main.screenPosition; - spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); @@ -147,7 +148,7 @@ namespace CalamityMod.Projectiles.Melee //Update the parameters drawOrigin = new Vector2(0f, blade.Height); - spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); drawChain(spriteBatch); @@ -162,15 +163,15 @@ namespace CalamityMod.Projectiles.Melee { Texture2D chainTex = GetTexture("CalamityMod/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChainedChain"); - int dist = (int)Vector2.Distance(Owner.Center, projectile.Center) / 16; + int dist = (int)Vector2.Distance(Owner.Center, Projectile.Center) / 16; Vector2[] Nodes = new Vector2[dist + 1]; Nodes[0] = Owner.Center; - Nodes[dist] = projectile.Center; + Nodes[dist] = Projectile.Center; for (int i = 1; i < dist + 1; i++) { Rectangle frame = new Rectangle(0, 0 + 18 * (i % 2), 12, 18); - Vector2 positionAlongLine = Vector2.Lerp(Owner.Center, projectile.Center, i / (float)dist); //Get the position of the segment along the line, as if it were a flat line + Vector2 positionAlongLine = Vector2.Lerp(Owner.Center, Projectile.Center, i / (float)dist); //Get the position of the segment along the line, as if it were a flat line Nodes[i] = positionAlongLine; float rotation = (Nodes[i] - Nodes[i - 1]).ToRotation() - MathHelper.PiOver2; //Calculate rotation based on direction from last point diff --git a/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs b/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs index 51b5181999..317a3ed9c7 100644 --- a/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs +++ b/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs @@ -12,20 +12,20 @@ namespace CalamityMod.Projectiles.Melee public class GhastlyChain : ModProjectile { public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChainedChain"; - public Player Owner => Main.player[projectile.owner]; - public float Timer => 20 - projectile.timeLeft; + public Player Owner => Main.player[Projectile.owner]; + public float Timer => 20 - Projectile.timeLeft; public float Gravity; public NPC NPCfrom { - get => Main.npc[(int)projectile.ai[0]]; - set => projectile.ai[0] = value.whoAmI; + get => Main.npc[(int)Projectile.ai[0]]; + set => Projectile.ai[0] = value.whoAmI; } public NPC Target { - get => Main.npc[(int)projectile.ai[1]]; - set => projectile.ai[1] = value.whoAmI; + get => Main.npc[(int)Projectile.ai[1]]; + set => Projectile.ai[1] = value.whoAmI; } public override void SetStaticDefaults() @@ -34,21 +34,21 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 8; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - projectile.timeLeft = 20; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 8; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + Projectile.timeLeft = 20; } public override bool? CanHitNPC(NPC target) => target == Target; public override void AI() { - projectile.Center = Target.Center; + Projectile.Center = Target.Center; } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) @@ -66,8 +66,8 @@ namespace CalamityMod.Projectiles.Melee spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - float opacity = projectile.timeLeft > 10 ? 1 : projectile.timeLeft / 10f; - Vector2 Shake = projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - projectile.timeLeft / 5f) * 0.5f; + float opacity = Projectile.timeLeft > 10 ? 1 : Projectile.timeLeft / 10f; + Vector2 Shake = Projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - Projectile.timeLeft / 5f) * 0.5f; BezierCurve curve = new BezierCurve(new Vector2[] { Target.Center, Target.Center + Vector2.UnitY * Gravity, NPCfrom.Center + Vector2.UnitY * Gravity, NPCfrom.Center }); int numPoints = 20; diff --git a/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs b/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs index 5e0373893d..80f55cfbdc 100644 --- a/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs +++ b/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs @@ -10,6 +10,7 @@ using static Terraria.ModLoader.ModContent; using CalamityMod.Particles; using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -18,9 +19,9 @@ namespace CalamityMod.Projectiles.Melee private NPC[] excludedTargets = new NPC[4]; public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained"; - public Player Owner => Main.player[projectile.owner]; - public ref float ChainSwapTimer => ref projectile.ai[0]; - public ref float SnapCoyoteTime => ref projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float ChainSwapTimer => ref Projectile.ai[0]; + public ref float SnapCoyoteTime => ref Projectile.ai[1]; private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; const float MaxTangleReach = 400f; //How long can tangling vines from crits be @@ -39,13 +40,13 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 80; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = OmegaBiomeBlade.FlailBladeAttunement_LocalIFrames; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 80; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = OmegaBiomeBlade.FlailBladeAttunement_LocalIFrames; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -121,7 +122,7 @@ namespace CalamityMod.Projectiles.Melee { if (crit) { - Main.PlaySound(mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/SwiftSlice"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/SwiftSlice"), Projectile.Center); excludedTargets[0] = target; for (int i = 0; i < 3; i++) { @@ -162,19 +163,19 @@ namespace CalamityMod.Projectiles.Melee { if (!OwnerCanShoot) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - projectile.velocity.Normalize(); - projectile.rotation = projectile.velocity.ToRotation(); - projectile.Center = Owner.Center + (projectile.velocity * 60); + Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); + Projectile.velocity.Normalize(); + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.Center = Owner.Center + (Projectile.velocity * 60); //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; - Owner.direction = Math.Sign(projectile.velocity.X); - Owner.itemRotation = projectile.rotation; + Owner.heldProj = Projectile.whoAmI; + Owner.direction = Math.Sign(Projectile.velocity.X); + Owner.itemRotation = Projectile.rotation; if (Owner.direction != 1) { Owner.itemRotation -= 3.14f; @@ -182,18 +183,18 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); Owner.itemTime = 2; Owner.itemAnimation = 2; - projectile.timeLeft = 2; + Projectile.timeLeft = 2; if (ChainSwapTimer % OmegaBiomeBlade.FlailBladeAttunement_FlailTime == 1) { - Main.PlaySound(SoundID.DD2_OgreSpit, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_OgreSpit, Projectile.Center); Vector2 smearPos = Owner.Center + whip1.X.ToRotationVector2() * OmegaBiomeBlade.FlailBladeAttunement_Reach * Main.rand.NextFloat(0.7f, 1.1f); Vector2 squish = new Vector2(Main.rand.NextFloat(3f, 4f), Main.rand.NextFloat(0.5f, 1f)); if (smear == null) { - smear = new SemiCircularSmearVFX(smearPos, Color.PowderBlue * 0.5f, whip1.X + MathHelper.Pi, projectile.scale * 1.5f, squish); + smear = new SemiCircularSmearVFX(smearPos, Color.PowderBlue * 0.5f, whip1.X + MathHelper.Pi, Projectile.scale * 1.5f, squish); smear.Lifetime = 2; GeneralParticleHandler.SpawnParticle(smear); } @@ -210,7 +211,7 @@ namespace CalamityMod.Projectiles.Melee if (smear2 == null) { - smear2 = new SemiCircularSmearVFX(smearPos, Color.PowderBlue * 0.5f, whip2.X + MathHelper.Pi, projectile.scale * 1.5f, squish); + smear2 = new SemiCircularSmearVFX(smearPos, Color.PowderBlue * 0.5f, whip2.X + MathHelper.Pi, Projectile.scale * 1.5f, squish); smear2.Lifetime = 2; GeneralParticleHandler.SpawnParticle(smear2); } @@ -225,14 +226,14 @@ namespace CalamityMod.Projectiles.Melee if (smear != null) { - smear.Rotation = smear.Rotation.AngleTowards(projectile.velocity.ToRotation(), 0.01f); + smear.Rotation = smear.Rotation.AngleTowards(Projectile.velocity.ToRotation(), 0.01f); smear.Time = 0; (smear as SemiCircularSmearVFX).Squish.Y *= 0.985f; (smear as SemiCircularSmearVFX).Squish.X *= 1.01f; } if (smear2 != null) { - smear2.Rotation = smear2.Rotation.AngleTowards(projectile.velocity.ToRotation(), 0.01f); + smear2.Rotation = smear2.Rotation.AngleTowards(Projectile.velocity.ToRotation(), 0.01f); smear2.Time = 0; (smear2 as SemiCircularSmearVFX).Squish.Y *= 0.985f; (smear2 as SemiCircularSmearVFX).Squish.X *= 1.01f; @@ -250,13 +251,13 @@ namespace CalamityMod.Projectiles.Melee //float drawRotation = (projBottom - chainPositions[chainPositions.Length - 2]).ToRotation() + MathHelper.PiOver4; //Face away from the last point of the bezier curve - Vector2 drawPos = projectile.Center - projectile.velocity * 55f; + Vector2 drawPos = Projectile.Center - Projectile.velocity * 55f; Vector2 drawOrigin = new Vector2(0f, handle.Height); - float drawRotation = projectile.rotation + MathHelper.PiOver4; + float drawRotation = Projectile.rotation + MathHelper.PiOver4; //lightColor = Lighting.GetColor((int)(projectile.Center.X / 16f), (int)(projectile.Center.Y / 16f)); - spriteBatch.Draw(handle, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending @@ -278,7 +279,7 @@ namespace CalamityMod.Projectiles.Melee spriteBatch.Draw(flailBlade, chainPositions3[chainPositions3.Length - 2] - Main.screenPosition, bladeFrame, Color.White, flailRotation, flailOrigin, 1, SpriteEffects.None, 0); drawOrigin = new Vector2(0f, blade.Height); - spriteBatch.Draw(blade, drawPos - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawPos - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Back to normal spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -335,7 +336,7 @@ namespace CalamityMod.Projectiles.Melee if (ChainSwapTimer % 6 == 0 || whip1.Y == 0) { - whip1.X = projectile.velocity.RotatedBy(Main.rand.NextFloat(MathHelper.PiOver4 / 16f, -MathHelper.PiOver4 / 16f)).ToRotation(); //X is the orientation + whip1.X = Projectile.velocity.RotatedBy(Main.rand.NextFloat(MathHelper.PiOver4 / 16f, -MathHelper.PiOver4 / 16f)).ToRotation(); //X is the orientation whip1.Y = Main.rand.NextFloat(0.2f, 100f);//Y is the "seed" ChainSwapTimer++; @@ -343,7 +344,7 @@ namespace CalamityMod.Projectiles.Melee if ((ChainSwapTimer - 2) % 6 == 0 || whip2.Y == 0) { - whip2.X = projectile.velocity.RotatedBy(Main.rand.NextFloat(MathHelper.Pi / 16f, -MathHelper.Pi / 16f)).ToRotation(); //X is the orientation + whip2.X = Projectile.velocity.RotatedBy(Main.rand.NextFloat(MathHelper.Pi / 16f, -MathHelper.Pi / 16f)).ToRotation(); //X is the orientation whip2.Y = Main.rand.NextFloat(0.2f, 100f);//Y is the "seed" ChainSwapTimer++; @@ -351,7 +352,7 @@ namespace CalamityMod.Projectiles.Melee if ((ChainSwapTimer - 4) % 6 == 0 || whip3.Y == 0) { - whip3.X = projectile.velocity.RotatedBy(Main.rand.NextFloat(MathHelper.Pi / 16f, -MathHelper.Pi / 16f)).ToRotation(); //X is the orientation + whip3.X = Projectile.velocity.RotatedBy(Main.rand.NextFloat(MathHelper.Pi / 16f, -MathHelper.Pi / 16f)).ToRotation(); //X is the orientation whip3.Y = Main.rand.NextFloat(0.2f, 100f);//Y is the "seed" ChainSwapTimer++; diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs b/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs index 58a899201c..1f157d246d 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs +++ b/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs @@ -10,6 +10,7 @@ using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -18,11 +19,11 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTides"; private bool initialized = false; Vector2 direction = Vector2.Zero; - public Player Owner => Main.player[projectile.owner]; - public ref float Charge => ref projectile.ai[0]; //Charge - public ref float State => ref projectile.ai[1]; //State 0 is "charging", State 1 is "thrusting" - public ref float CurrentIndicator => ref projectile.localAI[0]; //What "indicator" stage are you on. - public ref float OverCharge => ref projectile.localAI[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Charge => ref Projectile.ai[0]; //Charge + public ref float State => ref Projectile.ai[1]; //State 0 is "charging", State 1 is "thrusting" + public ref float CurrentIndicator => ref Projectile.localAI[0]; //What "indicator" stage are you on. + public ref float OverCharge => ref Projectile.localAI[1]; private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; const float MaxCharge = 500; @@ -36,14 +37,14 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 70; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 70; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; } public override bool CanDamage() @@ -54,8 +55,8 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 145 * projectile.scale; - float bladeWidth = 25 * projectile.scale; + float bladeLenght = 145 * Projectile.scale; + float bladeWidth = 25 * Projectile.scale; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); } @@ -72,8 +73,8 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao { - projectile.velocity = Vector2.Zero; - Main.PlaySound(SoundID.Item101, projectile.Center); + Projectile.velocity = Vector2.Zero; + SoundEngine.PlaySound(SoundID.Item101, Projectile.Center); initialized = true; } @@ -83,21 +84,21 @@ namespace CalamityMod.Projectiles.Melee { if (Charge / MaxCharge < 0.25f) { - Main.PlaySound(SoundID.Item109, projectile.Center); - projectile.Kill(); + SoundEngine.PlaySound(SoundID.Item109, Projectile.Center); + Projectile.Kill(); return; } else { - var dashSound = Main.PlaySound(SoundID.Item120, projectile.Center); + var dashSound = SoundEngine.PlaySound(SoundID.Item120, Projectile.Center); CalamityUtils.SafeVolumeChange(ref dashSound, 0.5f); State = 1f; - projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; //Keep that even, if its an odd number itll fuck off and wont reset the players velocity on death - dashDuration = projectile.timeLeft; - lastDisplacement = projectile.Center - Owner.Center; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; //Keep that even, if its an odd number itll fuck off and wont reset the players velocity on death + dashDuration = Projectile.timeLeft; + lastDisplacement = Projectile.Center - Owner.Center; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } } } @@ -106,15 +107,15 @@ namespace CalamityMod.Projectiles.Melee { direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); - projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement()); + Projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement()); Charge++; OverCharge--; - projectile.timeLeft = 2; + Projectile.timeLeft = 2; if ((Charge / MaxCharge >= 0.25f && CurrentIndicator == 0f) || (Charge / MaxCharge >= 0.5f && CurrentIndicator == 1f) || (Charge / MaxCharge >= 0.75f && CurrentIndicator == 2f) && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Owner.Center, Vector2.Zero, ProjectileType(), (int)(projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BlastDamageReduction), 10f, Owner.whoAmI, 1f + CurrentIndicator * 0.15f); - var chargeSound = Main.PlaySound(mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AstralBeaconOrbPulse"), projectile.Center); + Projectile.NewProjectile(Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BlastDamageReduction), 10f, Owner.whoAmI, 1f + CurrentIndicator * 0.15f); + var chargeSound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AstralBeaconOrbPulse"), Projectile.Center); if (chargeSound != null) chargeSound.Pitch = -0.2f + 0.1f * CurrentIndicator; CurrentIndicator++; @@ -126,9 +127,9 @@ namespace CalamityMod.Projectiles.Melee Charge = MaxCharge; if (Owner.whoAmI == Main.myPlayer && CurrentIndicator < 4f) { - Projectile.NewProjectile(Owner.Center, Vector2.Zero, ProjectileType(), (int)(projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BlastDamageReduction), 10f, Owner.whoAmI, 1f + CurrentIndicator * 0.15f); + Projectile.NewProjectile(Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BlastDamageReduction), 10f, Owner.whoAmI, 1f + CurrentIndicator * 0.15f); OverCharge = 20f; - Main.PlaySound(mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AstralBeaconUse"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AstralBeaconUse"), Projectile.Center); CurrentIndicator++; } } @@ -136,36 +137,36 @@ namespace CalamityMod.Projectiles.Melee if (State == 1f) { - projectile.Center = Owner.Center + Vector2.Lerp(lastDisplacement, direction * 40f, MathHelper.Clamp(((dashDuration - projectile.timeLeft) / dashDuration) * 2f, 0f, 1f)); + Projectile.Center = Owner.Center + Vector2.Lerp(lastDisplacement, direction * 40f, MathHelper.Clamp(((dashDuration - Projectile.timeLeft) / dashDuration) * 2f, 0f, 1f)); Owner.fallStart = (int)(Owner.position.Y / 16f); Owner.Calamity().LungingDown = true; - if (Collision.SolidCollision(Owner.Center + (direction * 120 * projectile.scale) - Vector2.One * 5f, 10, 10)) + if (Collision.SolidCollision(Owner.Center + (direction * 120 * Projectile.scale) - Vector2.One * 5f, 10, 10)) { SlamDown(); - projectile.timeLeft = 0; + Projectile.timeLeft = 0; Owner.Calamity().LungingDown = false; - projectile.active = false; - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.active = false; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } Owner.velocity = direction * 30f; float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); float strength = (float)Math.Sin(variation * 2f + MathHelper.PiOver2); - Particle Sparkle = new CritSpark(projectile.Center, Owner.velocity - direction.RotatedBy(variation) * (1 + strength) * 2f * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center, Owner.velocity - direction.RotatedBy(variation) * (1 + strength) * 2f * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } - Lighting.AddLight(projectile.Center, new Vector3(1f, 0.56f, 0.56f) * Charge / MaxCharge); + Lighting.AddLight(Projectile.Center, new Vector3(1f, 0.56f, 0.56f) * Charge / MaxCharge); //Manage position and rotation - projectile.rotation = direction.ToRotation(); + Projectile.rotation = direction.ToRotation(); //Scaling based on charge - projectile.scale = 1f + (Charge / MaxCharge * 0.3f); + Projectile.scale = 1f + (Charge / MaxCharge * 0.3f); Owner.direction = Math.Sign(direction.X); Owner.itemRotation = direction.ToRotation(); @@ -182,7 +183,7 @@ namespace CalamityMod.Projectiles.Melee public void SlamDown() { - var slamSound = Main.PlaySound(SoundID.DD2_MonkStaffGroundImpact, projectile.Center); + var slamSound = SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Projectile.Center); CalamityUtils.SafeVolumeChange(ref slamSound, 1.5f); if (Owner.whoAmI != Main.myPlayer || Owner.velocity.Y == 0f) @@ -191,7 +192,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 15) Main.LocalPlayer.Calamity().GeneralScreenShakePower = 15; - Projectile proj = Projectile.NewProjectileDirect(Owner.Center + (direction * 120 * projectile.scale), -direction, ProjectileType(), (int)(projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), 1f); + Projectile proj = Projectile.NewProjectileDirect(Owner.Center + (direction * 120 * Projectile.scale), -direction, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), 1f); proj.timeLeft = 81; @@ -207,7 +208,7 @@ namespace CalamityMod.Projectiles.Melee bool validPositionFound = false; for (float i = 0f; i < 1; i += 1 / distance) { - Vector2 positionToCheck = Owner.Center + (direction * 120 * projectile.scale) + direction.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; + Vector2 positionToCheck = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) widestAngle = i; @@ -221,9 +222,9 @@ namespace CalamityMod.Projectiles.Melee if (validPositionFound) { - Vector2 projPosition = Owner.Center + (direction * 120 * projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; + Vector2 projPosition = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; Vector2 monolithRotation = direction.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), (int)(projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); + Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); if (proj.modProjectile is MercurialTidesMonolith monolith) { monolith.WaitTimer = (1 - projSize) * 34f; @@ -257,9 +258,9 @@ namespace CalamityMod.Projectiles.Melee float drawRotation = drawAngle + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, handle.Height); - Vector2 drawOffset = projectile.Center - Main.screenPosition; + Vector2 drawOffset = Projectile.Center - Main.screenPosition; - spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); @@ -276,7 +277,7 @@ namespace CalamityMod.Projectiles.Melee //Update the parameters drawOrigin = new Vector2(0f, blade.Height); - spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Back to normal spriteBatch.End(); @@ -293,7 +294,7 @@ namespace CalamityMod.Projectiles.Melee Owner.Calamity().LungingDown = false; - projectile.active = false; + Projectile.active = false; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs b/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs index 847b3866a3..bac25348f5 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs +++ b/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs @@ -10,16 +10,17 @@ using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; using CalamityMod.Particles; using CalamityMod.Items.Weapons.Melee; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class MercurialTidesMonolith : ModProjectile { public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith"; - public Player Owner => Main.player[projectile.owner]; - public float Timer => (100f - projectile.timeLeft) / 100f; - public ref float Variant => ref projectile.ai[0]; //Yes - public ref float Size => ref projectile.ai[1]; //Yes + public Player Owner => Main.player[Projectile.owner]; + public float Timer => (100f - Projectile.timeLeft) / 100f; + public ref float Variant => ref Projectile.ai[0]; //Yes + public ref float Size => ref Projectile.ai[1]; //Yes public float WaitTimer; //How long until the monoliths appears public Vector2 OriginDirection; //The direction of the original strike public float Facing; //The direction of the original strike @@ -45,13 +46,13 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 70; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 102; - projectile.hide = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 70; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 102; + Projectile.hide = true; } public override bool CanDamage() => WaitTimer <= 0; @@ -59,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + ((projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Height()), Width(), ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + ((Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Height()), Width(), ref collisionPoint); } public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) @@ -69,27 +70,27 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (projectile.velocity != Vector2.Zero) + if (Projectile.velocity != Vector2.Zero) { SurfaceUp(); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.velocity = Vector2.Zero; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity = Vector2.Zero; } if (WaitTimer > 0) { - projectile.timeLeft = 102; + Projectile.timeLeft = 102; WaitTimer--; } - if (projectile.timeLeft == 100) + if (Projectile.timeLeft == 100) { if (Size >= 1) //Big monoliths create sparkles even before sprouting up { for (int i = 0; i < 20; i++) { - Particle Sparkle = new CritSpark(projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } } @@ -100,16 +101,16 @@ namespace CalamityMod.Projectiles.Melee } } - if (projectile.timeLeft == 80) + if (Projectile.timeLeft == 80) { - Vector2 particleDirection = (projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); - Main.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, projectile.Center); + Vector2 particleDirection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, Projectile.Center); for (int i = 0; i < 8; i++) { Vector2 hitPositionDisplace = particleDirection.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(0f, 10f); Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2)) * Main.rand.NextFloat(5f, 15f); - Particle smoke = new SmallSmokeParticle(projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.DarkOrange, Color.MediumTurquoise, Main.rand.NextFloat()), new Color(130, 130, 130), Main.rand.NextFloat(2.8f, 3.6f) * Size, 165 - Main.rand.Next(30), 0.1f); + Particle smoke = new SmallSmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.DarkOrange, Color.MediumTurquoise, Main.rand.NextFloat()), new Color(130, 130, 130), Main.rand.NextFloat(2.8f, 3.6f) * Size, 165 - Main.rand.Next(30), 0.1f); GeneralParticleHandler.SpawnParticle(smoke); } for (int i = 0; i < 6; i++) @@ -117,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 hitPositionDisplace = particleDirection.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(10f, 30f); Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4)); - Particle Rock = new StoneDebrisParticle(projectile.Center + hitPositionDisplace * 3, flyDirection * Main.rand.NextFloat(3f, 6f), Color.Lerp(Color.DarkSlateBlue, Color.LightSlateGray, Main.rand.NextFloat()), (1f + Main.rand.NextFloat(0f, 2.4f)) * Size, 30 + Main.rand.Next(50), 0.1f); + Particle Rock = new StoneDebrisParticle(Projectile.Center + hitPositionDisplace * 3, flyDirection * Main.rand.NextFloat(3f, 6f), Color.Lerp(Color.DarkSlateBlue, Color.LightSlateGray, Main.rand.NextFloat()), (1f + Main.rand.NextFloat(0f, 2.4f)) * Size, 30 + Main.rand.Next(50), 0.1f); GeneralParticleHandler.SpawnParticle(Rock); } } @@ -128,14 +129,14 @@ namespace CalamityMod.Projectiles.Melee { for (float i = 0; i < 40; i += 0.5f) { - Vector2 positionToCheck = projectile.Center + projectile.velocity * i; + Vector2 positionToCheck = Projectile.Center + Projectile.velocity * i; if (!Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) { - projectile.Center = projectile.Center + projectile.velocity * i; + Projectile.Center = Projectile.Center + Projectile.velocity * i; return; } } - projectile.Center = projectile.Center + projectile.velocity * 40f; + Projectile.Center = Projectile.Center + Projectile.velocity * 40f; } public bool SideSprouts(float facing, float distance, float projSize) @@ -145,7 +146,7 @@ namespace CalamityMod.Projectiles.Melee bool validPositionFound = false; for (float i = 0f; i < 1; i += 1 / distance) { - Vector2 positionToCheck = projectile.Center + OriginDirection.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; + Vector2 positionToCheck = Projectile.Center + OriginDirection.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) widestAngle = i; @@ -159,9 +160,9 @@ namespace CalamityMod.Projectiles.Melee if (validPositionFound) { - Vector2 projPosition = projectile.Center + OriginDirection.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; + Vector2 projPosition = Projectile.Center + OriginDirection.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; Vector2 monolithRotation = OriginDirection.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize); + Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize); if (proj.modProjectile is MercurialTidesMonolith monolith) { monolith.WaitTimer = (float)Math.Sqrt(1.0 - Math.Pow(projSize - 1.0, 2)) * 3f; @@ -178,7 +179,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.HeldItem.modItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_MonolithProc) sword.OnHitProc = true; - if (projectile.numHits > 0) + if (Projectile.numHits > 0) damage = (int)(damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageFalloff); } @@ -190,13 +191,13 @@ namespace CalamityMod.Projectiles.Melee Texture2D tex = GetTexture("CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith"); - Vector2 Shake = projectile.timeLeft < 70 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (70 - projectile.timeLeft / 30f) * 0.05f; + Vector2 Shake = Projectile.timeLeft < 70 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (70 - Projectile.timeLeft / 30f) * 0.05f; - float drawAngle = projectile.rotation; + float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight); - Vector2 drawPosition = projectile.Center - Main.screenPosition - (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height); float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f); @@ -212,11 +213,11 @@ namespace CalamityMod.Projectiles.Melee Texture2D tex = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith_Glow"); - float drawAngle = projectile.rotation; + float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight); - Vector2 drawPosition = projectile.Center - Main.screenPosition - (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height); float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f); diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs b/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs index 04750e9252..64daa89be4 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs +++ b/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs @@ -7,16 +7,17 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class MercurialTidesBlast : ModProjectile { public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave"; - public Player Owner => Main.player[projectile.owner]; - public float Timer => (60f - projectile.timeLeft) / 100f; - public ref float Variant => ref projectile.ai[0]; //Yes - public ref float Size => ref projectile.ai[0]; //Yes + public Player Owner => Main.player[Projectile.owner]; + public float Timer => (60f - Projectile.timeLeft) / 100f; + public ref float Variant => ref Projectile.ai[0]; //Yes + public ref float Size => ref Projectile.ai[0]; //Yes public Particle BloomRing; @@ -26,61 +27,61 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 170; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 60; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 170; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; } - public override bool CanDamage() => projectile.timeLeft < 40; + public override bool CanDamage() => Projectile.timeLeft < 40; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - return Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center - (projHitbox.Size() * projectile.scale * 0.5f), projHitbox.Size() * projectile.scale); + return Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - (projHitbox.Size() * Projectile.scale * 0.5f), projHitbox.Size() * Projectile.scale); } public override void AI() { - projectile.velocity = Vector2.Zero; - projectile.scale = (1 + (float)Math.Sin(projectile.timeLeft / 60f * MathHelper.Pi) * 0.2f) * Size; + Projectile.velocity = Vector2.Zero; + Projectile.scale = (1 + (float)Math.Sin(Projectile.timeLeft / 60f * MathHelper.Pi) * 0.2f) * Size; - if (projectile.timeLeft == 60) + if (Projectile.timeLeft == 60) { - Main.PlaySound(SoundID.Item79, projectile.Center); - Particle Sparkle = new GenericSparkle(projectile.Center, Vector2.Zero, Color.White, Main.rand.NextBool() ? Color.Aqua : Color.SpringGreen, projectile.scale, 20, 0.2f, 2); + SoundEngine.PlaySound(SoundID.Item79, Projectile.Center); + Particle Sparkle = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Main.rand.NextBool() ? Color.Aqua : Color.SpringGreen, Projectile.scale, 20, 0.2f, 2); GeneralParticleHandler.SpawnParticle(Sparkle); } - if (projectile.timeLeft == 40) + if (Projectile.timeLeft == 40) { - Main.PlaySound(SoundID.DD2_ExplosiveTrapExplode, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, Projectile.Center); - BloomRing = new BloomRing(projectile.Center, Vector2.Zero, Color.Aqua, projectile.scale, 40); + BloomRing = new BloomRing(Projectile.Center, Vector2.Zero, Color.Aqua, Projectile.scale, 40); GeneralParticleHandler.SpawnParticle(BloomRing); - Particle Bloom = new StrongBloom(projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.Aqua * 0.6f : Color.SpringGreen * 0.6f, projectile.scale * (1f + Main.rand.NextFloat(0f, 1.5f)), 20); + Particle Bloom = new StrongBloom(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.Aqua * 0.6f : Color.SpringGreen * 0.6f, Projectile.scale * (1f + Main.rand.NextFloat(0f, 1.5f)), 20); GeneralParticleHandler.SpawnParticle(Bloom); for (int i = 0; i < 10; i++) { - Particle Sparkle = new CritSpark(projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * projectile.scale, Color.White, Main.rand.NextBool() ? Color.DarkSlateBlue : Color.Chocolate, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * Projectile.scale, Color.White, Main.rand.NextBool() ? Color.DarkSlateBlue : Color.Chocolate, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } for (float i = 0f; i < 1; i += 0.05f) { float rotation = i * MathHelper.TwoPi; - Particle Sparkle = new CritSpark(projectile.Center + rotation.ToRotationVector2() * 65f * projectile.scale, rotation.ToRotationVector2() * 10f, Color.White, Main.rand.NextBool() ? Color.Aqua : Color.SpringGreen, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center + rotation.ToRotationVector2() * 65f * Projectile.scale, rotation.ToRotationVector2() * 10f, Color.White, Main.rand.NextBool() ? Color.Aqua : Color.SpringGreen, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } } if (BloomRing != null) { - BloomRing.Scale = projectile.scale; + BloomRing.Scale = Projectile.scale; } } @@ -94,14 +95,14 @@ namespace CalamityMod.Projectiles.Melee { Texture2D tex = GetTexture("CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave"); - float drawAngle = projectile.rotation; - int animFrame = 6 - (int)Math.Ceiling(projectile.timeLeft / 10f); + float drawAngle = Projectile.rotation; + int animFrame = 6 - (int)Math.Ceiling(Projectile.timeLeft / 10f); Rectangle frame = new Rectangle(0, 0 + animFrame * 168, 170, 166); - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 drawOrigin = frame.Size() / 2f; - spriteBatch.Draw(tex, drawPosition, frame, Color.White, drawAngle, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(tex, drawPosition, frame, Color.White, drawAngle, drawOrigin, Projectile.scale, 0f, 0f); return false; diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs index 0a9453c690..b79e1c26ee 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -17,12 +18,12 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_SanguineFury"; private bool initialized = false; Vector2 direction = Vector2.Zero; - public ref float Shred => ref projectile.ai[0]; //How much the attack is, attacking + public ref float Shred => ref Projectile.ai[0]; //How much the attack is, attacking public float ShredRatio => MathHelper.Clamp(Shred / (maxShred * 0.5f), 0f, 1f); - public ref float PogoCooldown => ref projectile.ai[1]; //Cooldown for the pogo - public ref float BounceTime => ref projectile.localAI[0]; - public ref float ChargeSoundCooldown => ref projectile.localAI[1]; - public Player Owner => Main.player[projectile.owner]; + public ref float PogoCooldown => ref Projectile.ai[1]; //Cooldown for the pogo + public ref float BounceTime => ref Projectile.localAI[0]; + public ref float ChargeSoundCooldown => ref Projectile.localAI[1]; + public Player Owner => Main.player[Projectile.owner]; public bool CanPogo => Owner.velocity.Y != 0 && PogoCooldown <= 0; //Only pogo when in the air and if the cooldown is zero private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; @@ -40,27 +41,27 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 70; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames; - projectile.timeLeft = OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 70; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames; + Projectile.timeLeft = OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames; } public override bool CanDamage() { - return projectile.timeLeft <= 2; //Prevent spam click abuse + return Projectile.timeLeft <= 2; //Prevent spam click abuse } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 130 * projectile.scale; - float bladeWidth = 86 * projectile.scale; + float bladeLenght = 130 * Projectile.scale; + float bladeWidth = 86 * Projectile.scale; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); } @@ -72,9 +73,9 @@ namespace CalamityMod.Projectiles.Melee Owner.velocity = -direction.SafeNormalize(Vector2.Zero) * pogoStrenght; //Bounce Owner.fallStart = (int)(Owner.position.Y / 16f); PogoCooldown = 30; //Cooldown - Main.PlaySound(SoundID.DD2_MonkStaffGroundImpact, projectile.position); + SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Projectile.position); - Vector2 hitPosition = Owner.Center + (direction * 100 * projectile.scale); + Vector2 hitPosition = Owner.Center + (direction * 100 * Projectile.scale); BounceTime = 20f; //Used only for animation for (int i = 0; i < 8; i++) @@ -102,7 +103,7 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao { - Main.PlaySound(SoundID.Item90, projectile.Center); + SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); initialized = true; foreach (Projectile proj in Main.projectile) @@ -127,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee if (!OwnerCanShoot) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -136,17 +137,17 @@ namespace CalamityMod.Projectiles.Melee if (Shred < 0) Shred = 0; - Lighting.AddLight(projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio); + Lighting.AddLight(Projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio); //Manage position and rotation direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); - projectile.rotation = direction.ToRotation(); - projectile.Center = Owner.Center + (direction * 60); + Projectile.rotation = direction.ToRotation(); + Projectile.Center = Owner.Center + (direction * 60); //Scaling based on shred - projectile.localNPCHitCooldown = OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames - (int)(MathHelper.Lerp(0, OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames - OmegaBiomeBlade.SuperPogoAttunement_LocalIFramesCharged, ShredRatio)); //Increase the hit frequency - projectile.scale = 1f + (ShredRatio * 1f); //SWAGGER + Projectile.localNPCHitCooldown = OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames - (int)(MathHelper.Lerp(0, OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames - OmegaBiomeBlade.SuperPogoAttunement_LocalIFramesCharged, ShredRatio)); //Increase the hit frequency + Projectile.scale = 1f + (ShredRatio * 1f); //SWAGGER if ((Wheel == null || !Wheel.active) && Dashing) @@ -154,10 +155,10 @@ namespace CalamityMod.Projectiles.Melee Dashing = false; Owner.velocity *= 0.1f; //Abrupt stop - Main.PlaySound(mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/MeatySlash"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/MeatySlash"), Projectile.Center); if (Owner.whoAmI == Main.myPlayer) { - Projectile proj = Projectile.NewProjectileDirect(Owner.Center - DashStart / 2f, Vector2.Zero, ProjectileType(), (int)(projectile.damage * OmegaBiomeBlade.SuperPogoAttunement_SlashDamageBoost), 0, Owner.whoAmI); + Projectile proj = Projectile.NewProjectileDirect(Owner.Center - DashStart / 2f, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.SuperPogoAttunement_SlashDamageBoost), 0, Owner.whoAmI); if (proj.modProjectile is SanguineFuryDash dash) { dash.DashStart = DashStart; @@ -179,15 +180,15 @@ namespace CalamityMod.Projectiles.Melee } - if (Collision.SolidCollision(Owner.Center + (direction * 100 * projectile.scale) - Vector2.One * 5f, 10, 10) && !Dashing) + if (Collision.SolidCollision(Owner.Center + (direction * 100 * Projectile.scale) - Vector2.One * 5f, 10, 10) && !Dashing) { Pogo(); - projectile.netUpdate = true; - projectile.netSpam = 0; + Projectile.netUpdate = true; + Projectile.netSpam = 0; } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.direction = Math.Sign(direction.X); Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) @@ -203,7 +204,7 @@ namespace CalamityMod.Projectiles.Melee { if (ChargeSoundCooldown <= 0) { - var chargeSound = Main.PlaySound(SoundID.DD2_SonicBoomBladeSlash); + var chargeSound = SoundEngine.PlaySound(SoundID.DD2_SonicBoomBladeSlash); CalamityUtils.SafeVolumeChange(ref chargeSound, 2.5f); ChargeSoundCooldown = 20; } @@ -216,8 +217,8 @@ namespace CalamityMod.Projectiles.Melee Shred -= OmegaBiomeBlade.SuperPogoAttunement_ShredDecayRate; PogoCooldown--; BounceTime--; - if (projectile.timeLeft <= 2) - projectile.timeLeft = 2; + if (Projectile.timeLeft <= 2) + Projectile.timeLeft = 2; } //Since the iframes vary, adjust the damage to be consistent no matter the iframes. The true scaling happens between the BaseDamage and the FulLChargeDamage @@ -230,7 +231,7 @@ namespace CalamityMod.Projectiles.Melee float currentDamage = (int)(MathHelper.Lerp(OmegaBiomeBlade.SuperPogoAttunement_BaseDamage * deviationFromBaseDamage, OmegaBiomeBlade.SuperPogoAttunement_FullChargeDamage * deviationFromBaseDamage, ShredRatio)); //Adjust the damage to make it constant based on the local iframes - float damageReduction = projectile.localNPCHitCooldown / (float)OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames; + float damageReduction = Projectile.localNPCHitCooldown / (float)OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames; damage = (int)(currentDamage * damageReduction); } @@ -241,7 +242,7 @@ namespace CalamityMod.Projectiles.Melee float currentDamage = (int)(MathHelper.Lerp(OmegaBiomeBlade.SuperPogoAttunement_BaseDamage * deviationFromBaseDamage, OmegaBiomeBlade.SuperPogoAttunement_FullChargeDamage * deviationFromBaseDamage, ShredRatio)); //Adjust the damage to make it constant based on the local iframes - float damageReduction = projectile.localNPCHitCooldown / (float)OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames; + float damageReduction = Projectile.localNPCHitCooldown / (float)OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames; damage = (int)(currentDamage * damageReduction); } @@ -259,7 +260,7 @@ namespace CalamityMod.Projectiles.Melee // get lifted up if (PogoCooldown <= 0) { - Main.PlaySound(SoundID.NPCHit30, projectile.Center); //Sizzle + SoundEngine.PlaySound(SoundID.NPCHit30, Projectile.Center); //Sizzle Shred += 62; //Augment the shredspeed if (Owner.velocity.Y > 0) Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly @@ -270,10 +271,10 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCHit43, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit43, Projectile.Center); if (ShredRatio > 0.8 && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, direction * 16f, ProjectileType(), (int)(projectile.damage * OmegaBiomeBlade.SuperPogoAttunement_ShotDamageBoost), projectile.knockBack, Owner.whoAmI, Shred); + Projectile.NewProjectile(Projectile.Center, direction * 16f, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.SuperPogoAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred); } if (Dashing) { @@ -295,7 +296,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition; - spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); @@ -308,7 +309,7 @@ namespace CalamityMod.Projectiles.Melee //Update the parameters drawOrigin = new Vector2(0f, blade.Height); - spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); for (int i = 0; i < bladeAmount; i++) //Draw extra copies @@ -326,7 +327,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawDisplacementAngle = direction.RotatedBy(MathHelper.PiOver2) * circleCompletion.ToRotationVector2().Y * (20 + 40 * ShredRatio); //How far perpendicularly Vector2 drawOffsetFromBounce = direction * MathHelper.Clamp(BounceTime, 0f, 20f) / 20f * 20f; - spriteBatch.Draw(blade, drawOffsetStraight + drawDisplacementAngle + drawOffsetFromBounce, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffsetStraight + drawDisplacementAngle + drawOffsetFromBounce, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); } //Back to normal diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs index 63150b3b16..f3ebf5bc3d 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Melee public class SanguineFuryDash : ModProjectile { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public Player Owner => Main.player[projectile.owner]; - public float Timer => 20 - projectile.timeLeft; + public Player Owner => Main.player[Projectile.owner]; + public float Timer => 20 - Projectile.timeLeft; public Vector2 DashStart; public Vector2 DashEnd; @@ -24,14 +24,14 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 8; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 60; - projectile.timeLeft = 20; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 8; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; + Projectile.timeLeft = 20; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -70,9 +70,9 @@ namespace CalamityMod.Projectiles.Melee Texture2D lineTex = GetTexture("CalamityMod/Particles/ThinEndedLine"); - Vector2 Shake = projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - projectile.timeLeft / 5f) * 0.5f; - float bump = (float)Math.Sin(((20f - projectile.timeLeft) / 20f) * MathHelper.Pi); - float raise = (float)Math.Sin(((20f - projectile.timeLeft) / 20f) * MathHelper.PiOver2); + Vector2 Shake = Projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - Projectile.timeLeft / 5f) * 0.5f; + float bump = (float)Math.Sin(((20f - Projectile.timeLeft) / 20f) * MathHelper.Pi); + float raise = (float)Math.Sin(((20f - Projectile.timeLeft) / 20f) * MathHelper.PiOver2); float rot = (DashEnd - DashStart).ToRotation() + MathHelper.PiOver2; Vector2 origin = new Vector2(lineTex.Width / 2f, lineTex.Height); diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs index a5f8d01ab3..6e9c282903 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs @@ -6,6 +6,7 @@ using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,11 +15,11 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_SanguineFuryExtra"; private bool initialized = false; Vector2 direction = Vector2.Zero; - public ref float Shred => ref projectile.ai[0]; + public ref float Shred => ref Projectile.ai[0]; public float ShredRatio => MathHelper.Clamp(Shred / (SanguineFury.maxShred * 0.5f), 0f, 1f); - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; - public float Timer => MaxTime - projectile.timeLeft; + public float Timer => MaxTime - Projectile.timeLeft; public const float MaxTime = 120; @@ -30,54 +31,54 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 45; - projectile.tileCollide = true; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 45; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.velocity *= 0.95f; + Projectile.velocity *= 0.95f; return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 84 * projectile.scale; - float bladeWidth = 76 * projectile.scale; + float bladeLenght = 84 * Projectile.scale; + float bladeWidth = 76 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center - direction * bladeLenght / 2, projectile.Center + direction * bladeLenght / 2, bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLenght / 2, Projectile.Center + direction * bladeLenght / 2, bladeWidth, ref collisionPoint); } public override void AI() { if (!initialized) { - Main.PlaySound(SoundID.Item90, projectile.Center); + SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); initialized = true; direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); - projectile.rotation = direction.ToRotation(); + Projectile.rotation = direction.ToRotation(); - projectile.timeLeft = (int)MaxTime; - projectile.velocity = direction * 16f; + Projectile.timeLeft = (int)MaxTime; + Projectile.velocity = direction * 16f; - projectile.scale = 1f + ShredRatio; //SWAGGER - projectile.netUpdate = true; + Projectile.scale = 1f + ShredRatio; //SWAGGER + Projectile.netUpdate = true; } - projectile.velocity *= 0.96f; - projectile.position += projectile.velocity; + Projectile.velocity *= 0.96f; + Projectile.position += Projectile.velocity; } @@ -98,13 +99,13 @@ namespace CalamityMod.Projectiles.Melee float drawAngleWheel = MathHelper.WrapAngle(i * MathHelper.PiOver2 + (Main.GlobalTime * 6)); Vector2 drawOrigin = new Vector2(0f, tex.Height); - Vector2 drawPositionWheel = projectile.Center - drawAngleWheel.ToRotationVector2() * 20f - Main.screenPosition; + Vector2 drawPositionWheel = Projectile.Center - drawAngleWheel.ToRotationVector2() * 20f - Main.screenPosition; //Vector2 drawPosition = Vector2.Lerp(drawPositionShot, drawPositionWheel, transition); - float opacityFade = projectile.timeLeft > 15 ? 1 : projectile.timeLeft / 15f; + float opacityFade = Projectile.timeLeft > 15 ? 1 : Projectile.timeLeft / 15f; - spriteBatch.Draw(tex, drawPositionWheel, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f * opacityFade, drawAngleWheel, drawOrigin, projectile.scale * 0.85f, 0f, 0f); + spriteBatch.Draw(tex, drawPositionWheel, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f * opacityFade, drawAngleWheel, drawOrigin, Projectile.scale * 0.85f, 0f, 0f); } //Back to normal @@ -116,10 +117,10 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item60, projectile.Center); + SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); for (int i = 0; i < 10; i++) { - Particle Sparkle = new CritSpark(projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * projectile.scale, Color.White, Main.rand.NextBool() ? Color.Crimson : Color.DarkRed, 0.4f + Main.rand.NextFloat(0f, 3.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * Projectile.scale, Color.White, Main.rand.NextBool() ? Color.Crimson : Color.DarkRed, 0.4f + Main.rand.NextFloat(0f, 3.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } } diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs index 33f130fbb7..bc1e6b62e4 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs @@ -10,6 +10,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -18,8 +19,8 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride"; private bool initialized = false; Vector2 direction = Vector2.Zero; - public ref float CurrentState => ref projectile.ai[0]; - public Player Owner => Main.player[projectile.owner]; + public ref float CurrentState => ref Projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; public const float throwOutTime = 90f; public const float throwOutDistance = 440f; @@ -28,13 +29,13 @@ namespace CalamityMod.Projectiles.Melee public float snapTimer => (throwTimer / throwOutTime) < snapPoint ? 0 : ((throwTimer / throwOutTime) - snapPoint) / (1f - snapPoint); public static float retractionPoint = 0.6f; public float retractionTimer => (throwTimer / throwOutTime) < retractionPoint ? 0 : ((throwTimer / throwOutTime) - retractionPoint) / (1f - retractionPoint); - public ref float Empowerment => ref projectile.ai[1]; + public ref float Empowerment => ref Projectile.ai[1]; public float OverEmpowerment = 0f; //Used to keep cooldowns working when the spin is full - public ref float hasMadeSound => ref projectile.localAI[0]; - public ref float hasMadeChargeSound => ref projectile.localAI[1]; + public ref float hasMadeSound => ref Projectile.localAI[0]; + public ref float hasMadeChargeSound => ref Projectile.localAI[1]; public const float maxEmpowerment = 600f; - public float throwTimer => throwOutTime - projectile.timeLeft; + public float throwTimer => throwOutTime - Projectile.timeLeft; public float AngleReset = 0f; @@ -46,75 +47,75 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Swordsmith's Pride"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.melee = true; - projectile.width = projectile.height = 74; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = OmegaBiomeBlade.WhirlwindAttunement_LocalIFrames; + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 74; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = OmegaBiomeBlade.WhirlwindAttunement_LocalIFrames; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 140 * projectile.scale; - float bladeWidth = 25 * projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); + float bladeLenght = 140 * Projectile.scale; + float bladeWidth = 25 * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); } public CurveSegment launch = new CurveSegment(EasingType.CircOut, 0f, 0f, 1f, 4); public CurveSegment hold = new CurveSegment(EasingType.Linear, snapPoint, 1f, 0f); public CurveSegment retract = new CurveSegment(EasingType.PolyInOut, retractionPoint, 1f, -1.05f, 3); - internal float ThrowCurve() => PiecewiseAnimation((throwOutTime - projectile.timeLeft) / throwOutTime, new CurveSegment[] { launch, hold, retract }); + internal float ThrowCurve() => PiecewiseAnimation((throwOutTime - Projectile.timeLeft) / throwOutTime, new CurveSegment[] { launch, hold, retract }); public override void AI() { if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao { - Main.PlaySound(SoundID.Item90, projectile.Center); - projectile.velocity = Vector2.Zero; + SoundEngine.PlaySound(SoundID.Item90, Projectile.Center); + Projectile.velocity = Vector2.Zero; direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); initialized = true; } - projectile.rotation = direction.ToRotation(); //Only done for afterimages + Projectile.rotation = direction.ToRotation(); //Only done for afterimages if (!OwnerCanShoot) { if (CurrentState == 2f || (CurrentState == 0f && Empowerment / maxEmpowerment < 0.5)) { - Main.PlaySound(SoundID.Item77, projectile.Center); - projectile.Kill(); + SoundEngine.PlaySound(SoundID.Item77, Projectile.Center); + Projectile.Kill(); return; } else if (CurrentState == 0f) { CurrentState = 1f; - Main.PlaySound(SoundID.Item80, projectile.Center); + SoundEngine.PlaySound(SoundID.Item80, Projectile.Center); direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES for (int i = 0; i <= 8; i++) { float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); float strength = (float)Math.Sin(variation * 2f + MathHelper.PiOver2); - Particle Sparkle = new CritSpark(projectile.Center, Owner.velocity + direction.RotatedBy(variation) * (1 + strength) * 2f * Main.rand.NextFloat(7.5f, 20f), Color.White, Color.HotPink, 2f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 2f); + Particle Sparkle = new CritSpark(Projectile.Center, Owner.velocity + direction.RotatedBy(variation) * (1 + strength) * 2f * Main.rand.NextFloat(7.5f, 20f), Color.White, Color.HotPink, 2f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 2f); GeneralParticleHandler.SpawnParticle(Sparkle); } for (int i = 0; i <= 8; i++) { float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); float strength = (float)Math.Sin(variation * 2f + MathHelper.PiOver2); - Particle Sparkle = new CritSpark(projectile.Center, Owner.velocity + direction.RotatedBy(variation) * (1 + strength) * Main.rand.NextFloat(7.5f, 20f), Color.White, Color.GreenYellow, 2f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 2f); + Particle Sparkle = new CritSpark(Projectile.Center, Owner.velocity + direction.RotatedBy(variation) * (1 + strength) * Main.rand.NextFloat(7.5f, 20f), Color.White, Color.GreenYellow, 2f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 2f); GeneralParticleHandler.SpawnParticle(Sparkle); } } @@ -126,7 +127,7 @@ namespace CalamityMod.Projectiles.Melee if (hasMadeChargeSound == 0f && Empowerment / maxEmpowerment >= 0.5) { hasMadeChargeSound = 1f; - Main.PlaySound(SoundID.Item76, projectile.Center); + SoundEngine.PlaySound(SoundID.Item76, Projectile.Center); } float rotation = direction.ToRotation(); @@ -137,7 +138,7 @@ namespace CalamityMod.Projectiles.Melee { CanDirectFire = true; hasMadeSound = 1f; - Main.PlaySound(SoundID.Item71, projectile.Center); + SoundEngine.PlaySound(SoundID.Item71, Projectile.Center); } @@ -148,7 +149,7 @@ namespace CalamityMod.Projectiles.Melee { shotDirection = (shotDirection.ToRotation().AngleTowards(Owner.AngleTo(lastTarget.Center), MathHelper.PiOver2)).ToRotationVector2() * 15f; } - Projectile.NewProjectile(Owner.Center, shotDirection, ProjectileType(), (int)(projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI); + Projectile.NewProjectile(Owner.Center, shotDirection, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI); } @@ -158,7 +159,7 @@ namespace CalamityMod.Projectiles.Melee Color currentColor = Color.Lerp(Color.HotPink, Color.GreenYellow, (float)Math.Sin(Main.GlobalTime * 2f)) * (((Empowerment / maxEmpowerment) - 0.75f) / 0.25f * 0.8f); if (smear == null) { - smear = new CircularSmearVFX(Owner.Center, Color.HotPink, direction.ToRotation(), projectile.scale * 1.5f); + smear = new CircularSmearVFX(Owner.Center, Color.HotPink, direction.ToRotation(), Projectile.scale * 1.5f); GeneralParticleHandler.SpawnParticle(smear); } //Update the variables of the smear @@ -167,7 +168,7 @@ namespace CalamityMod.Projectiles.Melee smear.Rotation = direction.ToRotation() + MathHelper.PiOver2; smear.Time = 0; smear.Position = Owner.Center; - smear.Scale = projectile.scale * 1.9f; + smear.Scale = Projectile.scale * 1.9f; smear.Color = currentColor; } @@ -178,25 +179,25 @@ namespace CalamityMod.Projectiles.Melee } else { - sightLine.Position = Owner.Center + Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * projectile.scale * 1.88f * 40; - (sightLine as LineVFX).LineVector = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * projectile.scale * 1.88f * 38f; + sightLine.Position = Owner.Center + Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * Projectile.scale * 1.88f * 40; + (sightLine as LineVFX).LineVector = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * Projectile.scale * 1.88f * 38f; sightLine.Scale = 0.2f; sightLine.Time = 0; sightLine.Color = currentColor * 0.7f; } - float rotationAdjusted = MathHelper.WrapAngle(projectile.rotation) + MathHelper.Pi; + float rotationAdjusted = MathHelper.WrapAngle(Projectile.rotation) + MathHelper.Pi; float mouseAngleAdjusted = MathHelper.WrapAngle(Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One).ToRotation()) + MathHelper.Pi; float deltaAngleShoot = Math.Abs(MathHelper.WrapAngle(rotationAdjusted - mouseAngleAdjusted)); if (CanDirectFire && deltaAngleShoot < 0.1f) { - Particle Blink = new GenericSparkle(Owner.Center + Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One) * projectile.scale * 1.88f * 78f, Owner.velocity, Color.White, currentColor, 1.5f, 10, 0.1f, 3f); + Particle Blink = new GenericSparkle(Owner.Center + Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One) * Projectile.scale * 1.88f * 78f, Owner.velocity, Color.White, currentColor, 1.5f, 10, 0.1f, 3f); GeneralParticleHandler.SpawnParticle(Blink); if (Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Owner.Center, Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One) * 15f, ProjectileType(), (int)(projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI); + Projectile.NewProjectile(Owner.Center, Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One) * 15f, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI); } CanDirectFire = false; AngleReset = Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One).ToRotation(); @@ -205,7 +206,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool()) { - float maxDistance = projectile.scale * 1.9f * 78f; + float maxDistance = Projectile.scale * 1.9f * 78f; Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance); Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 2f * (1f + distance.Length() / 15f); Particle glitter = new CritSpark(Owner.Center + distance, Owner.velocity + angularVelocity, Color.White, currentColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f); @@ -215,13 +216,13 @@ namespace CalamityMod.Projectiles.Melee //Manage position and rotation - projectile.scale = 1 + Empowerment / maxEmpowerment * 1.5f; + Projectile.scale = 1 + Empowerment / maxEmpowerment * 1.5f; direction = direction.RotatedBy(MathHelper.Clamp(Empowerment / maxEmpowerment, 0.4f, 1f) * MathHelper.PiOver4 * 0.20f); direction.Normalize(); - projectile.rotation = direction.ToRotation(); - projectile.Center = Owner.Center + (direction * projectile.scale * 10); - projectile.timeLeft = (int)throwOutTime + 1; + Projectile.rotation = direction.ToRotation(); + Projectile.Center = Owner.Center + (direction * Projectile.scale * 10); + Projectile.timeLeft = (int)throwOutTime + 1; Empowerment++; if (Empowerment > maxEmpowerment) { @@ -232,12 +233,12 @@ namespace CalamityMod.Projectiles.Melee if (CurrentState == 1f) { - projectile.Center = Owner.Center + (direction * projectile.scale * 10) + (direction * throwOutDistance * ThrowCurve()); - projectile.scale = (1 + Empowerment / maxEmpowerment * 1.5f) * MathHelper.Clamp(1 - retractionTimer, 0.3f, 1f); + Projectile.Center = Owner.Center + (direction * Projectile.scale * 10) + (direction * throwOutDistance * ThrowCurve()); + Projectile.scale = (1 + Empowerment / maxEmpowerment * 1.5f) * MathHelper.Clamp(1 - retractionTimer, 0.3f, 1f); } //Make the owner look like theyre holding the sword bla bla - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.direction = Math.Sign(direction.X); Owner.itemRotation = direction.ToRotation(); if (Owner.direction != 1) @@ -299,9 +300,9 @@ namespace CalamityMod.Projectiles.Melee float drawRotation = drawAngle + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, handle.Height); - Vector2 drawOffset = projectile.Center - Main.screenPosition; + Vector2 drawOffset = Projectile.Center - Main.screenPosition; - spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); //Turn on additive blending spriteBatch.End(); @@ -312,11 +313,11 @@ namespace CalamityMod.Projectiles.Melee //Afterimages if (CalamityConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) { - for (int i = 0; i < projectile.oldRot.Length; ++i) + for (int i = 0; i < Projectile.oldRot.Length; ++i) { - Color color = projectile.GetAlpha(lightColor) * (1f - (i / (float)projectile.oldRot.Length)); - float afterimageRotation = projectile.oldRot[i] + MathHelper.PiOver4; - Main.spriteBatch.Draw(blade, drawOffset, null, color * MathHelper.Lerp(0f, 0.5f, MathHelper.Clamp((Empowerment / maxEmpowerment - 0.4f) / 0.1f, 0f, 1f)), afterimageRotation, drawOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), 0f, 0f); + Color color = Projectile.GetAlpha(lightColor) * (1f - (i / (float)Projectile.oldRot.Length)); + float afterimageRotation = Projectile.oldRot[i] + MathHelper.PiOver4; + Main.spriteBatch.Draw(blade, drawOffset, null, color * MathHelper.Lerp(0f, 0.5f, MathHelper.Clamp((Empowerment / maxEmpowerment - 0.4f) / 0.1f, 0f, 1f)), afterimageRotation, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), 0f, 0f); } } @@ -330,7 +331,7 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:BasicTint"].Apply(); } - spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f * opacityFade, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f * opacityFade, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); if (CurrentState == 1f && snapTimer > 0) { @@ -352,15 +353,15 @@ namespace CalamityMod.Projectiles.Melee Vector2 Shake = retractProgress > 0 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (1f - snapProgress) * 10f; - int dist = (int)Vector2.Distance(Owner.Center, projectile.Center) / 16; + int dist = (int)Vector2.Distance(Owner.Center, Projectile.Center) / 16; Vector2[] Nodes = new Vector2[dist + 1]; Nodes[0] = Owner.Center; - Nodes[dist] = projectile.Center; + Nodes[dist] = Projectile.Center; for (int i = 1; i < dist + 1; i++) { Rectangle frame = new Rectangle(0, 0 + 18 * (i % 2), 12, 18); - Vector2 positionAlongLine = Vector2.Lerp(Owner.Center, projectile.Center, i / (float)dist); //Get the position of the segment along the line, as if it were a flat line + Vector2 positionAlongLine = Vector2.Lerp(Owner.Center, Projectile.Center, i / (float)dist); //Get the position of the segment along the line, as if it were a flat line Nodes[i] = positionAlongLine + Shake * (float)Math.Sin(i / (float)dist * MathHelper.Pi); float rotation = (Nodes[i] - Nodes[i - 1]).ToRotation() - MathHelper.PiOver2; //Calculate rotation based on direction from last point diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs index 1afeb0110a..26ea478088 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs @@ -8,33 +8,34 @@ using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Buffs.StatDebuffs; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class SwordsmithsPrideBeam : ModProjectile { public NPC target; - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam"; public override void SetStaticDefaults() { DisplayName.SetDefault("Swordsmith's Projection"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 32; - projectile.aiStyle = 27; + Projectile.width = Projectile.height = 32; + Projectile.aiStyle = 27; aiType = ProjectileID.LightBeam; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 80; - projectile.extraUpdates = 1; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 80; + Projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override void AI() @@ -52,35 +53,35 @@ namespace CalamityMod.Projectiles.Melee } } - else if ((projectile.Center - target.Center).Length() >= (projectile.Center + projectile.velocity - target.Center).Length() && CalamityUtils.AngleBetween(projectile.velocity, target.Center - projectile.Center) < MathHelper.PiOver4) //Home in + else if ((Projectile.Center - target.Center).Length() >= (Projectile.Center + Projectile.velocity - target.Center).Length() && CalamityUtils.AngleBetween(Projectile.velocity, target.Center - Projectile.Center) < MathHelper.PiOver4) //Home in { - projectile.timeLeft = 70; //Remain alive - float angularTurnSpeed = MathHelper.ToRadians(MathHelper.Lerp(15, 2.5f, MathHelper.Clamp(projectile.Distance(target.Center) / 10f, 0f, 1f))); - float idealDirection = projectile.AngleTo(target.Center); - float updatedDirection = projectile.velocity.ToRotation().AngleTowards(idealDirection, angularTurnSpeed); - projectile.velocity = updatedDirection.ToRotationVector2() * projectile.velocity.Length(); + Projectile.timeLeft = 70; //Remain alive + float angularTurnSpeed = MathHelper.ToRadians(MathHelper.Lerp(15, 2.5f, MathHelper.Clamp(Projectile.Distance(target.Center) / 10f, 0f, 1f))); + float idealDirection = Projectile.AngleTo(target.Center); + float updatedDirection = Projectile.velocity.ToRotation().AngleTowards(idealDirection, angularTurnSpeed); + Projectile.velocity = updatedDirection.ToRotationVector2() * Projectile.velocity.Length(); } - Lighting.AddLight(projectile.Center, 0.75f, 1f, 0.24f); - int dustParticle = Dust.NewDust(projectile.position, projectile.width, projectile.height, 75, 0f, 0f, 100, default, 0.9f); + Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); + int dustParticle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 0.9f); Main.dust[dustParticle].noGravity = true; Main.dust[dustParticle].velocity *= 0.5f; - Main.dust[dustParticle].velocity += projectile.velocity * 0.1f; + Main.dust[dustParticle].velocity += Projectile.velocity * 0.1f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 75) + if (Projectile.timeLeft > 75) return false; - DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); spriteBatch.End(); //Haha sup babe what if i restarted the spritebatch way too many times haha /blushes spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D tex = Main.projectileTexture[projectile.type]; + Texture2D tex = Main.projectileTexture[Projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.Lerp(Color.HotPink, Color.GreenYellow, (float)Math.Sin(Main.GlobalTime * 2f)), projectile.rotation, tex.Size() * 0.5f, 1f, 0f, 0f); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.HotPink, Color.GreenYellow, (float)Math.Sin(Main.GlobalTime * 2f)), Projectile.rotation, tex.Size() * 0.5f, 1f, 0f, 0f); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -90,13 +91,13 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item43, projectile.Center); + SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); for (int i = 0; i <= 15; i++) { - Vector2 displace = (projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f; - int dustParticle = Dust.NewDust(projectile.Center + displace, projectile.width, projectile.height, 75, 0f, 0f, 100, default, 2f); + Vector2 displace = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f; + int dustParticle = Dust.NewDust(Projectile.Center + displace, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 2f); Main.dust[dustParticle].noGravity = true; - Main.dust[dustParticle].velocity = projectile.oldVelocity; + Main.dust[dustParticle].velocity = Projectile.oldVelocity; } } diff --git a/Projectiles/Melee/TrueCausticEdgeProjectile.cs b/Projectiles/Melee/TrueCausticEdgeProjectile.cs index 6c2ce843ca..a0a3adc94f 100644 --- a/Projectiles/Melee/TrueCausticEdgeProjectile.cs +++ b/Projectiles/Melee/TrueCausticEdgeProjectile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -11,34 +12,34 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Edge"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 3; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.35f, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.35f, 0f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -49,22 +50,22 @@ namespace CalamityMod.Projectiles.Melee public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); } return false; } @@ -77,17 +78,17 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); int num3; for (int num795 = 4; num795 < 31; num795 = num3 + 1) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 44, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f); + float num796 = Projectile.oldVelocity.X * (30f / (float)num795); + float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 44, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 44, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f); + num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 44, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); dust = Main.dust[num798]; dust.velocity *= 0.05f; num3 = num795; diff --git a/Projectiles/Melee/TumbleweedFlail.cs b/Projectiles/Melee/TumbleweedFlail.cs index 82d406939d..fa397ca685 100644 --- a/Projectiles/Melee/TumbleweedFlail.cs +++ b/Projectiles/Melee/TumbleweedFlail.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TumbleweedFlail : ModProjectile @@ -15,90 +16,90 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.alpha = 255; + Projectile.width = 34; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 255; } public override void AI() { - Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - if (Main.player[projectile.owner].dead) + Vector2 vector62 = Main.player[Projectile.owner].Center - Projectile.Center; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; + if (Main.player[Projectile.owner].dead) { - projectile.Kill(); + Projectile.Kill(); return; } - Main.player[projectile.owner].itemAnimation = 10; - Main.player[projectile.owner].itemTime = 10; + Main.player[Projectile.owner].itemAnimation = 10; + Main.player[Projectile.owner].itemTime = 10; float arg_1DC8F_0 = vector62.X; if (vector62.X < 0f) { - Main.player[projectile.owner].ChangeDir(1); - projectile.direction = 1; + Main.player[Projectile.owner].ChangeDir(1); + Projectile.direction = 1; } else { - Main.player[projectile.owner].ChangeDir(-1); - projectile.direction = -1; + Main.player[Projectile.owner].ChangeDir(-1); + Projectile.direction = -1; } - Main.player[projectile.owner].itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); - projectile.spriteDirection = (vector62.X > 0f) ? -1 : 1; - if (projectile.ai[0] == 0f && vector62.Length() > 400f) + Main.player[Projectile.owner].itemRotation = (vector62 * -1f * (float)Projectile.direction).ToRotation(); + Projectile.spriteDirection = (vector62.X > 0f) ? -1 : 1; + if (Projectile.ai[0] == 0f && vector62.Length() > 400f) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } - if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) + if (Projectile.ai[0] == 1f || Projectile.ai[0] == 2f) { float num693 = vector62.Length(); if (num693 > 1500f) { - projectile.Kill(); + Projectile.Kill(); return; } if (num693 > 600f) { - projectile.ai[0] = 2f; + Projectile.ai[0] = 2f; } - projectile.tileCollide = false; + Projectile.tileCollide = false; float num694 = 20f; - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { num694 = 40f; } - projectile.velocity = Vector2.Normalize(vector62) * num694; + Projectile.velocity = Vector2.Normalize(vector62) * num694; if (vector62.Length() < num694) { - projectile.Kill(); + Projectile.Kill(); return; } } - projectile.ai[1] += 1f; - if (projectile.ai[1] > 5f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 5f) { - projectile.alpha = 0; + Projectile.alpha = 0; } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - projectile.ai[0] = 1f; - projectile.netUpdate = true; - Main.PlaySound(SoundID.NPCHit11, projectile.position); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; + SoundEngine.PlaySound(SoundID.NPCHit11, Projectile.position); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = ModContent.GetTexture("CalamityMod/ExtraTextures/Chains/TumbleweedChain"); - Vector2 vector17 = projectile.Center; + Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/TumbleweedChain"); + Vector2 vector17 = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); float num91 = (float)texture2D2.Height; @@ -134,10 +135,10 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(SoundID.NPCDeath15, projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath15, Projectile.position); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 32, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -147,17 +148,17 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer, 0f, 0f); } - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Melee/TumbleweedRolling.cs b/Projectiles/Melee/TumbleweedRolling.cs index c66090359f..bfaf011c05 100644 --- a/Projectiles/Melee/TumbleweedRolling.cs +++ b/Projectiles/Melee/TumbleweedRolling.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TumbleweedRolling : ModProjectile @@ -15,45 +16,45 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 44; - projectile.height = 44; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 8; - projectile.timeLeft = 300; - projectile.melee = true; + Projectile.width = 44; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 8; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - if ((projectile.velocity.X != projectile.velocity.X && (projectile.velocity.X < -3f || projectile.velocity.X > 3f)) || - (projectile.velocity.Y != projectile.velocity.Y && (projectile.velocity.Y < -3f || projectile.velocity.Y > 3f))) + if ((Projectile.velocity.X != Projectile.velocity.X && (Projectile.velocity.X < -3f || Projectile.velocity.X > 3f)) || + (Projectile.velocity.Y != Projectile.velocity.Y && (Projectile.velocity.Y < -3f || Projectile.velocity.Y > 3f))) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.NPCHit11, projectile.position); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.NPCHit11, Projectile.position); } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; } - projectile.rotation += projectile.velocity.X * 0.05f; + Projectile.rotation += Projectile.velocity.X * 0.05f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCDeath15, projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath15, Projectile.position); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 32, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -63,10 +64,10 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Melee/TyphonsGreedBubble.cs b/Projectiles/Melee/TyphonsGreedBubble.cs index 0fab0a8d6f..14efe8e84a 100644 --- a/Projectiles/Melee/TyphonsGreedBubble.cs +++ b/Projectiles/Melee/TyphonsGreedBubble.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class TyphonsGreedBubble : ModProjectile @@ -12,70 +13,70 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Typhon's Greed"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - float inertia = 50f * projectile.ai[1]; //100 - float speed = 10f * projectile.ai[1]; //5 + float inertia = 50f * Projectile.ai[1]; //100 + float speed = 10f * Projectile.ai[1]; //5 float num954 = 40f; - if (Math.Abs(projectile.velocity.X) > 0.2f) + if (Math.Abs(Projectile.velocity.X) > 0.2f) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } - projectile.rotation = projectile.velocity.ToRotation(); - Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.7f); + Projectile.rotation = Projectile.velocity.ToRotation(); + Lighting.AddLight(Projectile.Center, 0f, 0.1f, 0.7f); - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player.active && !player.dead) { - if (projectile.Distance(player.Center) > num954) + if (Projectile.Distance(player.Center) > num954) { - Vector2 moveDirection = projectile.SafeDirectionTo(player.Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * speed) / inertia; + Vector2 moveDirection = Projectile.SafeDirectionTo(player.Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * speed) / inertia; } } else { - if (projectile.timeLeft > 30) + if (Projectile.timeLeft > 30) { - projectile.timeLeft = 30; + Projectile.timeLeft = 30; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; Main.spriteBatch.Draw(texture2D13, - projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), + Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), - projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -86,30 +87,30 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item21, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X -= (float)(projectile.width / 2); - projectile.position.Y -= (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item21, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X -= (float)(Projectile.width / 2); + Projectile.position.Y -= (float)(Projectile.height / 2); for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 6; num194++) { - int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); } } } diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index b2d5f6262b..c546e28198 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 110; - projectile.height = 110; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.melee = true; - projectile.hide = true; - projectile.ignoreWater = true; - projectile.ownerHitCheck = true; + Projectile.width = 110; + Projectile.height = 110; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Melee; + Projectile.hide = true; + Projectile.ignoreWater = true; + Projectile.ownerHitCheck = true; } public override void AI() @@ -35,61 +35,61 @@ namespace CalamityMod.Projectiles.Melee float num = 50f; float num2 = 2f; float scaleFactor = 20f; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float num3 = -0.7853982f; Vector2 value = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 value2 = Vector2.Zero; if (player.dead) { - projectile.Kill(); + Projectile.Kill(); return; } Lighting.AddLight(player.Center, 0f, 0.2f, 1.45f); - int num9 = Math.Sign(projectile.velocity.X); - projectile.velocity = new Vector2((float)num9, 0f); - if (projectile.ai[0] == 0f) + int num9 = Math.Sign(Projectile.velocity.X); + Projectile.velocity = new Vector2((float)num9, 0f); + if (Projectile.ai[0] == 0f) { - projectile.rotation = new Vector2((float)num9, -player.gravDir).ToRotation() + num3 + 3.14159274f; - if (projectile.velocity.X < 0f) + Projectile.rotation = new Vector2((float)num9, -player.gravDir).ToRotation() + num3 + 3.14159274f; + if (Projectile.velocity.X < 0f) { - projectile.rotation -= 1.57079637f; + Projectile.rotation -= 1.57079637f; } } - projectile.alpha -= 128; - if (projectile.alpha < 0) + Projectile.alpha -= 128; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - float arg_5DB_0 = projectile.ai[0] / num; + float arg_5DB_0 = Projectile.ai[0] / num; float num10 = 1f; - projectile.ai[0] += num10; - projectile.rotation += 6.28318548f * num2 / num * (float)num9; - bool flag2 = projectile.ai[0] == (float)(int)(num / 2f); - if (projectile.ai[0] >= num || (flag2 && !player.controlUseItem)) + Projectile.ai[0] += num10; + Projectile.rotation += 6.28318548f * num2 / num * (float)num9; + bool flag2 = Projectile.ai[0] == (float)(int)(num / 2f); + if (Projectile.ai[0] >= num || (flag2 && !player.controlUseItem)) { - projectile.Kill(); + Projectile.Kill(); player.reuseDelay = 2; } else if (flag2) { int expectedDirection = (player.SafeDirectionTo(Main.MouseWorld).X > 0f).ToDirectionInt(); - if (expectedDirection != projectile.velocity.X) + if (expectedDirection != Projectile.velocity.X) { player.ChangeDir(expectedDirection); - projectile.velocity = Vector2.UnitX * expectedDirection; - projectile.rotation -= MathHelper.Pi; - projectile.netUpdate = true; + Projectile.velocity = Vector2.UnitX * expectedDirection; + Projectile.rotation -= MathHelper.Pi; + Projectile.netUpdate = true; } } - float num12 = projectile.rotation - 0.7853982f * (float)num9; - value2 = (num12 + ((num9 == -1) ? 3.14159274f : 0f)).ToRotationVector2() * (projectile.ai[0] / num) * scaleFactor; - Vector2 value3 = projectile.Center + (num12 + ((num9 == -1) ? 3.14159274f : 0f)).ToRotationVector2() * 30f; + float num12 = Projectile.rotation - 0.7853982f * (float)num9; + value2 = (num12 + ((num9 == -1) ? 3.14159274f : 0f)).ToRotationVector2() * (Projectile.ai[0] / num) * scaleFactor; + Vector2 value3 = Projectile.Center + (num12 + ((num9 == -1) ? 3.14159274f : 0f)).ToRotationVector2() * 30f; Vector2 vector2 = num12.ToRotationVector2(); - Vector2 value4 = vector2.RotatedBy((double)(1.57079637f * (float)projectile.spriteDirection), default); + Vector2 value4 = vector2.RotatedBy((double)(1.57079637f * (float)Projectile.spriteDirection), default); if (Main.rand.NextBool(2)) { Dust dust3 = Dust.NewDustDirect(value3 - new Vector2(5f), 10, 10, 33, player.velocity.X, player.velocity.Y, 150, default, 1f); - dust3.velocity = projectile.SafeDirectionTo(dust3.position) * 0.1f + dust3.velocity * 0.1f; + dust3.velocity = Projectile.SafeDirectionTo(dust3.position) * 0.1f + dust3.velocity * 0.1f; } for (int j = 0; j < 4; j++) { @@ -111,8 +111,8 @@ namespace CalamityMod.Projectiles.Melee } if (Main.rand.Next(6) != 0) { - Dust dust4 = Dust.NewDustDirect(projectile.position, 0, 0, 186, 0f, 0f, 100, default, 1f); - dust4.position = projectile.Center + vector2 * (60f + Main.rand.NextFloat() * 20f) * scaleFactor3; + Dust dust4 = Dust.NewDustDirect(Projectile.position, 0, 0, 186, 0f, 0f, 100, default, 1f); + dust4.position = Projectile.Center + vector2 * (60f + Main.rand.NextFloat() * 20f) * scaleFactor3; dust4.velocity = value4 * (4f + 4f * Main.rand.NextFloat()) * scaleFactor3 * scaleFactor2; dust4.noGravity = true; dust4.noLight = true; @@ -123,21 +123,21 @@ namespace CalamityMod.Projectiles.Melee } } } - projectile.position = value - projectile.Size / 2f; - projectile.position += value2; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.position = value - Projectile.Size / 2f; + Projectile.position += value2; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = MathHelper.WrapAngle(projectile.rotation); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] % 12f == 0f) + player.itemRotation = MathHelper.WrapAngle(Projectile.rotation); + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] % 12f == 0f) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile bubble = CalamityUtils.ProjectileBarrage(projectile.Center, player.Center, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, true); + Projectile bubble = CalamityUtils.ProjectileBarrage(Projectile.Center, player.Center, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, true); bubble.ai[1] = Main.rand.NextFloat() + 0.5f; } } @@ -145,16 +145,16 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) + Rectangle myRect = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && - ((projectile.friendly && (!Main.npc[i].friendly || (Main.npc[i].type == NPCID.Guide && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || - (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) + ((Projectile.friendly && (!Main.npc[i].friendly || (Main.npc[i].type == NPCID.Guide && Projectile.owner < 255 && Main.player[Projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && Projectile.owner < 255 && Main.player[Projectile.owner].killClothier))) || + (Projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (Projectile.owner < 0 || Main.npc[i].immune[Projectile.owner] == 0 || Projectile.maxPenetrate == 1)) { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + if (Main.npc[i].noTileCollide || !Projectile.ownerHitCheck || Projectile.CanHit(Main.npc[i])) { bool flag3; if (Main.npc[i].type == NPCID.SolarCrawltipedeTail) @@ -165,20 +165,20 @@ namespace CalamityMod.Projectiles.Melee rect.Y -= num5; rect.Width += num5 * 2; rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); + flag3 = Projectile.Colliding(myRect, rect); } else { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + flag3 = Projectile.Colliding(myRect, Main.npc[i].getRect()); } if (flag3) { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + if (Main.npc[i].reflectingProjectiles && Projectile.CanReflect()) { - Main.npc[i].ReflectProjectile(projectile.whoAmI); + Main.npc[i].ReflectProjectile(Projectile.whoAmI); return; } - hitDirection = (Main.player[projectile.owner].Center.X < Main.npc[i].Center.X) ? 1 : -1; + hitDirection = (Main.player[Projectile.owner].Center.X < Main.npc[i].Center.X) ? 1 : -1; } } } @@ -189,9 +189,9 @@ namespace CalamityMod.Projectiles.Melee public override void CutTiles() { float num5 = 60f; - float f = projectile.rotation - 0.7853982f * (float)Math.Sign(projectile.velocity.X); + float f = Projectile.rotation - 0.7853982f * (float)Math.Sign(Projectile.velocity.X); DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Utils.PlotTileLine(projectile.Center + f.ToRotationVector2() * -num5, projectile.Center + f.ToRotationVector2() * num5, (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Utils.PlotTileLine(Projectile.Center + f.ToRotationVector2() * -num5, Projectile.Center + f.ToRotationVector2() * num5, (float)Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -200,10 +200,10 @@ namespace CalamityMod.Projectiles.Melee { return true; } - float f = projectile.rotation - 0.7853982f * (float)Math.Sign(projectile.velocity.X); + float f = Projectile.rotation - 0.7853982f * (float)Math.Sign(Projectile.velocity.X); float num2 = 0f; float num3 = 110f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center + f.ToRotationVector2() * -num3, projectile.Center + f.ToRotationVector2() * num3, 23f * projectile.scale, ref num2)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + f.ToRotationVector2() * -num3, Projectile.Center + f.ToRotationVector2() * num3, 23f * Projectile.scale, ref num2)) { return true; } @@ -213,7 +213,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - target.immune[projectile.owner] = 6; + target.immune[Projectile.owner] = 6; } } } diff --git a/Projectiles/Melee/UltimusCleaverDust.cs b/Projectiles/Melee/UltimusCleaverDust.cs index 11d8f15354..8c194c4ba9 100644 --- a/Projectiles/Melee/UltimusCleaverDust.cs +++ b/Projectiles/Melee/UltimusCleaverDust.cs @@ -13,52 +13,52 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.timeLeft = 90; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.tileCollide = false; - projectile.melee = true; + Projectile.width = 6; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 90; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + Projectile.velocity.X = Projectile.velocity.X * -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 1f); + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 1f); Dust expr_8976_cp_0 = Main.dust[num199]; expr_8976_cp_0.position.X -= 2f; Dust expr_8994_cp_0 = Main.dust[num199]; @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(2)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; expr_8A4E_cp_0.position.X -= 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; @@ -80,19 +80,19 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num200].velocity *= 0.1f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + Projectile.velocity.X = Projectile.velocity.X * 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; + Projectile.rotation = -Projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 150f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 150f, 12f, 20f); } } } diff --git a/Projectiles/Melee/UrchinBall.cs b/Projectiles/Melee/UrchinBall.cs index c28910c676..7e202e8f53 100644 --- a/Projectiles/Melee/UrchinBall.cs +++ b/Projectiles/Melee/UrchinBall.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -18,25 +19,25 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.alpha = 255; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + Projectile.width = 34; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 255; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 3; } public override void AI() { - Player player = Main.player[projectile.owner]; - Vector2 vector62 = player.Center - projectile.Center; - projectile.rotation = vector62.ToRotation() - 1.57f; + Player player = Main.player[Projectile.owner]; + Vector2 vector62 = player.Center - Projectile.Center; + Projectile.rotation = vector62.ToRotation() - 1.57f; if (player.dead) { - projectile.Kill(); + Projectile.Kill(); return; } player.itemAnimation = 10; @@ -44,72 +45,72 @@ namespace CalamityMod.Projectiles.Melee if (vector62.X < 0f) { player.ChangeDir(1); - projectile.direction = 1; + Projectile.direction = 1; } else { player.ChangeDir(-1); - projectile.direction = -1; + Projectile.direction = -1; } - player.itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); - projectile.spriteDirection = (vector62.X > 0f) ? -1 : 1; - if (projectile.ai[0] == 0f && vector62.Length() > 400f) + player.itemRotation = (vector62 * -1f * (float)Projectile.direction).ToRotation(); + Projectile.spriteDirection = (vector62.X > 0f) ? -1 : 1; + if (Projectile.ai[0] == 0f && vector62.Length() > 400f) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } - if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) + if (Projectile.ai[0] == 1f || Projectile.ai[0] == 2f) { if (spike) { spike = false; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); } - projectile.usesLocalNPCImmunity = false; + Projectile.usesLocalNPCImmunity = false; float num693 = vector62.Length(); if (num693 > 1500f) { - projectile.Kill(); + Projectile.Kill(); return; } if (num693 > 600f) { - projectile.ai[0] = 2f; + Projectile.ai[0] = 2f; } - projectile.tileCollide = false; + Projectile.tileCollide = false; float num694 = 20f; - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { num694 = 40f; } - projectile.velocity = Vector2.Normalize(vector62) * num694; + Projectile.velocity = Vector2.Normalize(vector62) * num694; if (vector62.Length() < num694) { - projectile.Kill(); + Projectile.Kill(); return; } } - projectile.ai[1] += 1f; - if (projectile.ai[1] > 5f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 5f) { - projectile.alpha = 0; + Projectile.alpha = 0; } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - projectile.ai[0] = 1f; - projectile.netUpdate = true; - Main.PlaySound(SoundID.Dig, projectile.position); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = ModContent.GetTexture("CalamityMod/ExtraTextures/Chains/UrchinFlailChain"); - Vector2 vector17 = projectile.Center; + Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/UrchinFlailChain"); + Vector2 vector17 = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); float num91 = (float)texture2D2.Height; @@ -146,8 +147,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { spike = true; - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; target.AddBuff(BuffID.Venom, 180); } } diff --git a/Projectiles/Melee/UrchinBallSpike.cs b/Projectiles/Melee/UrchinBallSpike.cs index 08b154b270..18e64b82f1 100644 --- a/Projectiles/Melee/UrchinBallSpike.cs +++ b/Projectiles/Melee/UrchinBallSpike.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -14,31 +15,31 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = -1; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; aiType = ProjectileID.BoneJavelin; } public override void AI() { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.velocity.X = projectile.velocity.X * 0.99f; - projectile.velocity.Y = projectile.velocity.Y + 0.15f; - projectile.rotation += 0.4f * (float)projectile.direction; - projectile.spriteDirection = projectile.direction; + Projectile.velocity.X = Projectile.velocity.X * 0.99f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.15f; + Projectile.rotation += 0.4f * (float)Projectile.direction; + Projectile.spriteDirection = Projectile.direction; } //Sticky Behaviour - projectile.StickyProjAI(6); + Projectile.StickyProjAI(6); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(6, false); + Projectile.ModifyHitNPCSticky(6, false); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -52,16 +53,16 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 13; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 13; + Projectile.height = 20; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 1f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 1f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 2f; } diff --git a/Projectiles/Melee/UrchinSpikeFugu.cs b/Projectiles/Melee/UrchinSpikeFugu.cs index c54a8cd04a..cab3ca7405 100644 --- a/Projectiles/Melee/UrchinSpikeFugu.cs +++ b/Projectiles/Melee/UrchinSpikeFugu.cs @@ -15,30 +15,30 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 90; - projectile.noEnchantments = true; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 90; + Projectile.noEnchantments = true; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] == 0f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + if (Projectile.ai[0] == 0f) { float maxRange = 100f; int npcIndex = -1; for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { - float targetDist = (npc.Center - projectile.Center).Length(); + float targetDist = (npc.Center - Projectile.Center).Length(); if (targetDist < maxRange) { npcIndex = i; @@ -46,32 +46,32 @@ namespace CalamityMod.Projectiles.Melee } } } - projectile.ai[0] = (float)(npcIndex + 1); - if (projectile.ai[0] == 0f) + Projectile.ai[0] = (float)(npcIndex + 1); + if (Projectile.ai[0] == 0f) { - projectile.ai[0] = -15f; + Projectile.ai[0] = -15f; } - if (projectile.ai[0] > 0f) + if (Projectile.ai[0] > 0f) { float scaleFactor5 = (float)Main.rand.Next(35, 75) / 30f; - projectile.velocity = (projectile.velocity * 20f + Vector2.Normalize(Main.npc[(int)projectile.ai[0] - 1].Center - projectile.Center + new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101))) * scaleFactor5) / 21f; - projectile.netUpdate = true; + Projectile.velocity = (Projectile.velocity * 20f + Vector2.Normalize(Main.npc[(int)Projectile.ai[0] - 1].Center - Projectile.Center + new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101))) * scaleFactor5) / 21f; + Projectile.netUpdate = true; } } - else if (projectile.ai[0] > 0f) + else if (Projectile.ai[0] > 0f) { - Vector2 value16 = Vector2.Normalize(Main.npc[(int)projectile.ai[0] - 1].Center - projectile.Center); - projectile.velocity = (projectile.velocity * 40f + value16 * 12f) / 41f; + Vector2 value16 = Vector2.Normalize(Main.npc[(int)Projectile.ai[0] - 1].Center - Projectile.Center); + Projectile.velocity = (Projectile.velocity * 40f + value16 * 12f) / 41f; } else { - projectile.ai[0] += 1f; - projectile.alpha -= 25; - if (projectile.alpha < 0) + Projectile.ai[0] += 1f; + Projectile.alpha -= 25; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - projectile.velocity.Y = projectile.velocity.Y + 0.015f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.015f; } } diff --git a/Projectiles/Melee/ViolenceSlashProjectile.cs b/Projectiles/Melee/ViolenceSlashProjectile.cs index 40116749b4..ae54ca6cd7 100644 --- a/Projectiles/Melee/ViolenceSlashProjectile.cs +++ b/Projectiles/Melee/ViolenceSlashProjectile.cs @@ -13,40 +13,40 @@ namespace CalamityMod.Projectiles.Melee public class ViolenceSlashProjectile : ModProjectile { internal PrimitiveTrail SliceAfterimageDrawer = null; - internal Player Owner => Main.player[projectile.owner]; - internal ref float Time => ref projectile.ai[0]; + internal Player Owner => Main.player[Projectile.owner]; + internal ref float Time => ref Projectile.ai[0]; internal float SwingSine => (float)Math.Sin(MathHelper.TwoPi * Time / 50f); public override string Texture => "CalamityMod/Items/Weapons/Melee/Violence"; public override void SetStaticDefaults() { DisplayName.SetDefault("Violence"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 36; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 36; } public override void SetDefaults() { - projectile.width = projectile.height = 142; - projectile.aiStyle = -1; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 90000; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 142; + Projectile.aiStyle = -1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.timeLeft = 90000; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; + Projectile.tileCollide = false; } public override void AI() { // Fade in. - projectile.Opacity = Utils.InverseLerp(0f, 15f, Time, true); + Projectile.Opacity = Utils.InverseLerp(0f, 15f, Time, true); if (!Owner.channel) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -54,67 +54,67 @@ namespace CalamityMod.Projectiles.Melee DoMovement(); // Create some demonic light at the tip of the spear. - Lighting.AddLight(projectile.Center + (projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * projectile.height * 0.45f, Color.Red.ToVector3() * 0.4f); + Lighting.AddLight(Projectile.Center + (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * Projectile.height * 0.45f, Color.Red.ToVector3() * 0.4f); Time++; } internal void DoMovement() { - projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter) + (projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * projectile.height * 0.45f; - projectile.rotation = SwingSine * MathHelper.ToRadians(87f); + Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter) + (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Projectile.height * 0.45f; + Projectile.rotation = SwingSine * MathHelper.ToRadians(87f); - if (Main.myPlayer == projectile.owner && !projectile.WithinRange(Main.MouseWorld, projectile.height + 15f)) + if (Main.myPlayer == Projectile.owner && !Projectile.WithinRange(Main.MouseWorld, Projectile.height + 15f)) { - projectile.velocity = projectile.SafeDirectionTo(Main.MouseWorld); - projectile.netSpam = 0; - projectile.netUpdate = true; + Projectile.velocity = Projectile.SafeDirectionTo(Main.MouseWorld); + Projectile.netSpam = 0; + Projectile.netUpdate = true; } - projectile.rotation += projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.rotation += Projectile.velocity.ToRotation() + MathHelper.PiOver4; } internal void ManipulatePlayerFields() { Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.ChangeDir((Math.Cos(projectile.rotation - MathHelper.PiOver4) > 0f).ToDirectionInt()); + Owner.ChangeDir((Math.Cos(Projectile.rotation - MathHelper.PiOver4) > 0f).ToDirectionInt()); } internal Color PrimitiveColorFunction(float completionRatio) { - float averageRotation = projectile.oldRot.Average(angle => MathHelper.WrapAngle(angle) + MathHelper.Pi); - float opacity = projectile.Opacity * Utils.InverseLerp(0.75f, 0.45f, completionRatio, true) * 0.5f; + float averageRotation = Projectile.oldRot.Average(angle => MathHelper.WrapAngle(angle) + MathHelper.Pi); + float opacity = Projectile.Opacity * Utils.InverseLerp(0.75f, 0.45f, completionRatio, true) * 0.5f; opacity *= Utils.InverseLerp(0.125f, 0.15f, Math.Abs(SwingSine), true); - float rotationAdjusted = MathHelper.WrapAngle(projectile.rotation) + MathHelper.Pi; - float oldRotationAdjusted = MathHelper.WrapAngle(projectile.oldRot[1]) + MathHelper.Pi; + float rotationAdjusted = MathHelper.WrapAngle(Projectile.rotation) + MathHelper.Pi; + float oldRotationAdjusted = MathHelper.WrapAngle(Projectile.oldRot[1]) + MathHelper.Pi; return Color.Lerp(Color.Red * 1.1f, Color.DarkRed, Utils.InverseLerp(0f, 0.5f, completionRatio, true)) * opacity; } - internal float PrimitiveWidthFunction(float completionRatio) => projectile.height * 0.48f; + internal float PrimitiveWidthFunction(float completionRatio) => Projectile.height * 0.48f; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { if (SliceAfterimageDrawer is null) SliceAfterimageDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction, specialShader: GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"]); - GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/SwordSlashTexture")); + GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/SwordSlashTexture")); - Texture2D spearProjectile = Main.projectileTexture[projectile.type]; + Texture2D spearProjectile = Main.projectileTexture[Projectile.type]; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; List positions = new List(); for (int i = 0; i < 16; i++) { - Vector2 position = projectile.position + (projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (PrimitiveWidthFunction(0f) - 30f) * projectile.scale * 0.5f; + Vector2 position = Projectile.position + (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (PrimitiveWidthFunction(0f) - 30f) * Projectile.scale * 0.5f; float angleOffset = MathHelper.Pi * 0.25f * -Math.Sign(SwingSine) * i / 16f; - position += (projectile.rotation - MathHelper.PiOver4 + MathHelper.PiOver2).ToRotationVector2().RotatedBy(angleOffset) * -SwingSine * i * 12f; + position += (Projectile.rotation - MathHelper.PiOver4 + MathHelper.PiOver2).ToRotationVector2().RotatedBy(angleOffset) * -SwingSine * i * 12f; positions.Add(position); } - SliceAfterimageDrawer.Draw(positions, projectile.Size * 0.5f - Main.screenPosition, 50); + SliceAfterimageDrawer.Draw(positions, Projectile.Size * 0.5f - Main.screenPosition, 50); return true; } } diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index 7f057047c7..39cfe4fafb 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -6,80 +6,81 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class ViolenceThrownProjectile : ModProjectile { internal PrimitiveTrail StreakDrawer = null; - internal Player Owner => Main.player[projectile.owner]; - internal ref float Time => ref projectile.ai[0]; + internal Player Owner => Main.player[Projectile.owner]; + internal ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Items/Weapons/Melee/Violence"; public override void SetStaticDefaults() { DisplayName.SetDefault("Violence"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 36; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 36; } public override void SetDefaults() { - projectile.width = projectile.height = 142; - projectile.aiStyle = -1; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 90000; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 142; + Projectile.aiStyle = -1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.timeLeft = 90000; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; + Projectile.tileCollide = false; } public override void AI() { // Fade in. - projectile.Opacity = Utils.InverseLerp(0f, 15f, Time, true); + Projectile.Opacity = Utils.InverseLerp(0f, 15f, Time, true); if (Owner.channel) { HomeTowardsMouse(); - projectile.rotation += 0.45f / projectile.MaxUpdates; + Projectile.rotation += 0.45f / Projectile.MaxUpdates; } else { ReturnToOwner(); - float idealAngle = projectile.AngleTo(Owner.Center) - MathHelper.PiOver4; - projectile.rotation = projectile.rotation.AngleLerp(idealAngle, 0.1f); - projectile.rotation = projectile.rotation.AngleTowards(idealAngle, 0.25f); + float idealAngle = Projectile.AngleTo(Owner.Center) - MathHelper.PiOver4; + Projectile.rotation = Projectile.rotation.AngleLerp(idealAngle, 0.1f); + Projectile.rotation = Projectile.rotation.AngleTowards(idealAngle, 0.25f); } ManipulatePlayerFields(); // Create some demonic light at the tip of the spear. - Lighting.AddLight(projectile.Center + (projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * projectile.height * 0.45f, Color.Red.ToVector3() * 0.4f); + Lighting.AddLight(Projectile.Center + (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * Projectile.height * 0.45f, Color.Red.ToVector3() * 0.4f); Time++; } internal void HomeTowardsMouse() { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - if (projectile.WithinRange(Main.MouseWorld, projectile.velocity.Length() * 0.7f)) - projectile.Center = Main.MouseWorld; + if (Projectile.WithinRange(Main.MouseWorld, Projectile.velocity.Length() * 0.7f)) + Projectile.Center = Main.MouseWorld; else - projectile.velocity = (projectile.velocity * 3f + projectile.DirectionTo(Main.MouseWorld) * 19f) / 4f; - projectile.netSpam = 0; - projectile.netUpdate = true; + Projectile.velocity = (Projectile.velocity * 3f + Projectile.DirectionTo(Main.MouseWorld) * 19f) / 4f; + Projectile.netSpam = 0; + Projectile.netUpdate = true; } internal void ReturnToOwner() { - projectile.Center = Vector2.Lerp(projectile.Center, Owner.Center, 0.02f); - projectile.velocity = projectile.SafeDirectionTo(Owner.Center) * 22f; - if (projectile.Hitbox.Intersects(Owner.Hitbox)) + Projectile.Center = Vector2.Lerp(Projectile.Center, Owner.Center, 0.02f); + Projectile.velocity = Projectile.SafeDirectionTo(Owner.Center) * 22f; + if (Projectile.Hitbox.Intersects(Owner.Hitbox)) { for (int i = 0; i < 75; i++) { @@ -88,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee fire.scale = 1.4f; fire.noGravity = true; } - projectile.Kill(); + Projectile.Kill(); } } @@ -103,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.netMode != NetmodeID.Server) { // Play a splatter and impact sound. - Main.PlaySound(SoundID.DD2_CrystalCartImpact, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact, Projectile.Center); float damageInterpolant = Utils.InverseLerp(950f, 2000f, damage, true); float impactAngularVelocity = MathHelper.Lerp(0.08f, 0.2f, damageInterpolant); @@ -111,14 +112,14 @@ namespace CalamityMod.Projectiles.Melee impactAngularVelocity *= Main.rand.NextBool().ToDirectionInt() * Main.rand.NextFloat(0.75f, 1.25f); Color impactColor = Color.Lerp(Color.Silver, Color.Gold, Main.rand.NextFloat(0.5f)); - Vector2 impactPoint = Vector2.Lerp(projectile.Center, target.Center, 0.65f); + Vector2 impactPoint = Vector2.Lerp(Projectile.Center, target.Center, 0.65f); Vector2 bloodSpawnPosition = target.Center + Main.rand.NextVector2Circular(target.width, target.height) * 0.04f; - Vector2 splatterDirection = (projectile.Center - bloodSpawnPosition).SafeNormalize(Vector2.UnitY); + Vector2 splatterDirection = (Projectile.Center - bloodSpawnPosition).SafeNormalize(Vector2.UnitY); // Emit blood if the target is organic. if (target.Organic()) { - Main.PlaySound(SoundID.NPCHit18, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit18, Projectile.Center); for (int i = 0; i < 6; i++) { int bloodLifetime = Main.rand.Next(22, 36); @@ -179,7 +180,7 @@ namespace CalamityMod.Projectiles.Melee internal Color PrimitiveColorFunction(float completionRatio) { - float fadeInterpolant = (float)Math.Cos(Main.GlobalTime * -9f + completionRatio * 6f + projectile.identity * 2f) * 0.5f + 0.5f; + float fadeInterpolant = (float)Math.Cos(Main.GlobalTime * -9f + completionRatio * 6f + Projectile.identity * 2f) * 0.5f + 0.5f; // Adjust the fade interpolant to be on a different scale via a linear interpolation. fadeInterpolant = MathHelper.Lerp(0.15f, 0.75f, fadeInterpolant); @@ -189,7 +190,7 @@ namespace CalamityMod.Projectiles.Melee frontFade = Color.Lerp(frontFade, Color.DarkRed, 0.5f); Color backFade = new Color(255, 145, 115); - return Color.Lerp(frontFade, backFade, (float)Math.Pow(completionRatio, 1.2D)) * (float)Math.Pow(1f - completionRatio, 1.1D) * projectile.Opacity; + return Color.Lerp(frontFade, backFade, (float)Math.Pow(completionRatio, 1.2D)) * (float)Math.Pow(1f - completionRatio, 1.1D) * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -197,35 +198,35 @@ namespace CalamityMod.Projectiles.Melee if (StreakDrawer is null) StreakDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/FabstaffStreak")); - Texture2D spearProjectile = Main.projectileTexture[projectile.type]; + Texture2D spearProjectile = Main.projectileTexture[Projectile.type]; // Not cloning the points causes the below operations to be applied to the original oldPos value by reference // and thus causes it to be consistently added over and over, which is not intended behavior. - Vector2[] drawPoints = (Vector2[])projectile.oldPos.Clone(); - Vector2 aimAheadDirection = (projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + Vector2[] drawPoints = (Vector2[])Projectile.oldPos.Clone(); + Vector2 aimAheadDirection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); if (Owner.channel) { drawPoints[0] += aimAheadDirection * -12f; - drawPoints[1] = drawPoints[0] - (projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * Vector2.Distance(drawPoints[0], drawPoints[1]); + drawPoints[1] = drawPoints[0] - (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * Vector2.Distance(drawPoints[0], drawPoints[1]); } for (int i = 0; i < drawPoints.Length; i++) - drawPoints[i] -= (projectile.oldRot[i] + MathHelper.PiOver4).ToRotationVector2() * projectile.height * 0.5f; + drawPoints[i] -= (Projectile.oldRot[i] + MathHelper.PiOver4).ToRotationVector2() * Projectile.height * 0.5f; - if (Time > projectile.oldPos.Length) - StreakDrawer.Draw(drawPoints, projectile.Size * 0.5f - Main.screenPosition, 88); + if (Time > Projectile.oldPos.Length) + StreakDrawer.Draw(drawPoints, Projectile.Size * 0.5f - Main.screenPosition, 88); - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; for (int i = 0; i < 6; i++) { - float rotation = projectile.oldRot[i] - MathHelper.PiOver2; + float rotation = Projectile.oldRot[i] - MathHelper.PiOver2; if (Owner.channel) rotation += 0.2f; - Color afterimageColor = Color.Lerp(lightColor, Color.Transparent, 1f - (float)Math.Pow(Utils.InverseLerp(0, 6, i), 1.4D)) * projectile.Opacity; - spriteBatch.Draw(spearProjectile, drawPosition, null, afterimageColor, rotation, spearProjectile.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + Color afterimageColor = Color.Lerp(lightColor, Color.Transparent, 1f - (float)Math.Pow(Utils.InverseLerp(0, 6, i), 1.4D)) * Projectile.Opacity; + spriteBatch.Draw(spearProjectile, drawPosition, null, afterimageColor, rotation, spearProjectile.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); } return false; diff --git a/Projectiles/Melee/VoidEssence.cs b/Projectiles/Melee/VoidEssence.cs index 1aaaf9215b..ec5ffff190 100644 --- a/Projectiles/Melee/VoidEssence.cs +++ b/Projectiles/Melee/VoidEssence.cs @@ -17,46 +17,46 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Void Essence"); - Main.projFrames[projectile.type] = NumAnimationFrames; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = NumAnimationFrames; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.height = 24; - projectile.width = 24; - projectile.melee = true; - projectile.timeLeft = 100; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.alpha = 80; + Projectile.height = 24; + Projectile.width = 24; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 100; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 80; - projectile.penetrate = 8; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.extraUpdates = 1; + Projectile.penetrate = 8; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; + Projectile.extraUpdates = 1; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; drawOffsetX = 1; drawOriginOffsetY = 4; // Update animation - projectile.frameCounter++; - if (projectile.frameCounter > AnimationFrameTime) + Projectile.frameCounter++; + if (Projectile.frameCounter > AnimationFrameTime) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= NumAnimationFrames) - projectile.frame = 0; + if (Projectile.frame >= NumAnimationFrames) + Projectile.frame = 0; // Produce light - Lighting.AddLight(projectile.Center, 0.9f, 0.9f, 1.0f); + Lighting.AddLight(Projectile.Center, 0.9f, 0.9f, 1.0f); // Continuously trail dust int trailDust = 1; @@ -64,25 +64,25 @@ namespace CalamityMod.Projectiles.Melee { int dustID = Main.rand.NextBool(8) ? 66 : 143; - int idx = Dust.NewDust(projectile.position - projectile.velocity, projectile.width, projectile.height, dustID); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, Projectile.width, Projectile.height, dustID); Main.dust[idx].noGravity = true; - Main.dust[idx].velocity += projectile.velocity * 0.8f; + Main.dust[idx].velocity += Projectile.velocity * 0.8f; } // If tentacle is currently on cooldown, reduce the cooldown. - if (projectile.ai[0] > 0f) - projectile.ai[0] -= 1f; + if (Projectile.ai[0] > 0f) + Projectile.ai[0] -= 1f; // Home in on nearby enemies if homing is enabled - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) HomingAI(); // Fade out if about to despawn - if (projectile.timeLeft <= 40 && projectile.timeLeft % 5 == 0) + if (Projectile.timeLeft <= 40 && Projectile.timeLeft % 5 == 0) { - projectile.alpha += 20; - if (projectile.alpha > 255) - projectile.alpha = 255; + Projectile.alpha += 20; + if (Projectile.alpha > 255) + Projectile.alpha = 255; } } @@ -99,9 +99,9 @@ namespace CalamityMod.Projectiles.Melee continue; // Won't home in through walls and won't chase invulnerable targets. - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1)) + if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < maxHomingRange) { targetIdx = i; @@ -115,48 +115,48 @@ namespace CalamityMod.Projectiles.Melee if (hasHomingTarget) { NPC target = Main.npc[targetIdx]; - Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * Nadir.ShootSpeed; + Vector2 homingVector = (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * Nadir.ShootSpeed; float homingRatio = 35f; - projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); + Projectile.velocity = (Projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); // If the target is close enough and tentacle is off cooldown, summon one. // maxHomingRange doubles as the distance to the target. - if (projectile.ai[0] <= 0f && maxHomingRange <= TentacleRange) + if (Projectile.ai[0] <= 0f && maxHomingRange <= TentacleRange) { - Vector2 projVel = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero); + Vector2 projVel = (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero); projVel *= 6f; SpawnTentacle(projVel); - projectile.ai[0] = TentacleCooldown; + Projectile.ai[0] = TentacleCooldown; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 95) + if (Projectile.timeLeft > 95) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { // Rapidly screech to a halt upon touching an enemy and disable homing. - projectile.velocity *= 0.4f; - projectile.ai[1] = 1f; + Projectile.velocity *= 0.4f; + Projectile.ai[1] = 1f; // Fade out a bit with every hit - projectile.alpha += 20; - if (projectile.alpha > 255) - projectile.alpha = 255; + Projectile.alpha += 20; + if (Projectile.alpha > 255) + Projectile.alpha = 255; // Explode into dust (as if being shredded apart on contact) int onHitDust = Main.rand.Next(6, 11); for (int i = 0; i < onHitDust; ++i) { int dustID = Main.rand.NextBool() ? 198 : 199; - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f); Main.dust[idx].noGravity = true; float speed = Main.rand.NextFloat(1.4f, 2.6f); @@ -173,7 +173,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < killDust; ++i) { int dustID = Main.rand.NextBool() ? 198 : 199; - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f); Main.dust[idx].noGravity = true; float speed = Main.rand.NextFloat(2.0f, 3.1f); @@ -193,8 +193,8 @@ namespace CalamityMod.Projectiles.Melee private void SpawnTentacle(Vector2 tentacleVelocity) { - int damage = projectile.damage; - float kb = projectile.knockBack; + int damage = Projectile.damage; + float kb = Projectile.knockBack; // Randomize tentacle behavior variables float ai0 = Main.rand.NextFloat(0.01f, 0.08f); @@ -202,8 +202,8 @@ namespace CalamityMod.Projectiles.Melee float ai1 = Main.rand.NextFloat(0.01f, 0.08f); ai1 *= Main.rand.NextBool() ? -1f : 1f; - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, tentacleVelocity, ModContent.ProjectileType(), damage, kb, projectile.owner, ai0, ai1); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center, tentacleVelocity, ModContent.ProjectileType(), damage, kb, Projectile.owner, ai0, ai1); } } } diff --git a/Projectiles/Melee/VoidTentacle.cs b/Projectiles/Melee/VoidTentacle.cs index ca8501a57a..4d1939a806 100644 --- a/Projectiles/Melee/VoidTentacle.cs +++ b/Projectiles/Melee/VoidTentacle.cs @@ -14,75 +14,75 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - projectile.height = 160; - projectile.width = 160; - projectile.melee = true; - projectile.friendly = true; - projectile.MaxUpdates = 3; + Projectile.height = 160; + Projectile.width = 160; + Projectile.DamageType = DamageClass.Melee; + Projectile.friendly = true; + Projectile.MaxUpdates = 3; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; } public override void AI() { // HOW CAN THIS CODE EVER RUN - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - if (Math.Abs(projectile.velocity.X) < 1f) - projectile.velocity.X = -projectile.velocity.X; + if (Math.Abs(Projectile.velocity.X) < 1f) + Projectile.velocity.X = -Projectile.velocity.X; else - projectile.Kill(); + Projectile.Kill(); } - if (projectile.velocity.Y != projectile.velocity.Y) + if (Projectile.velocity.Y != Projectile.velocity.Y) { - if (Math.Abs(projectile.velocity.Y) < 1f) - projectile.velocity.Y = -projectile.velocity.Y; + if (Math.Abs(Projectile.velocity.Y) < 1f) + Projectile.velocity.Y = -Projectile.velocity.Y; else - projectile.Kill(); + Projectile.Kill(); } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) + Vector2 center10 = Projectile.Center; + Projectile.scale = 1f - Projectile.localAI[0]; + Projectile.width = (int)(20f * Projectile.scale); + Projectile.height = Projectile.width; + Projectile.position.X = center10.X - (float)(Projectile.width / 2); + Projectile.position.Y = center10.Y - (float)(Projectile.height / 2); + if ((double)Projectile.localAI[0] < 0.1) { - projectile.localAI[0] += 0.01f; + Projectile.localAI[0] += 0.01f; } else { - projectile.localAI[0] += 0.025f; + Projectile.localAI[0] += 0.025f; } - if (projectile.localAI[0] >= 0.95f) + if (Projectile.localAI[0] >= 0.95f) { - projectile.Kill(); + Projectile.Kill(); } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; - if (projectile.velocity.Length() > 16f) + Projectile.velocity.X = Projectile.velocity.X + Projectile.ai[0] * 1.5f; + Projectile.velocity.Y = Projectile.velocity.Y + Projectile.ai[1] * 1.5f; + if (Projectile.velocity.Length() > 16f) { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; + Projectile.velocity.Normalize(); + Projectile.velocity *= 16f; } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) + Projectile.ai[0] *= 1.05f; + Projectile.ai[1] *= 1.05f; + if (Projectile.scale < 1f) { int i = 0; - while (i < projectile.scale * 4f) + while (i < Projectile.scale * 4f) { int dustID = Main.rand.NextBool(5) ? 199 : 175; - int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustID, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.1f); - Main.dust[idx].position = (Main.dust[idx].position + projectile.Center) / 2f; + int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustID, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); + Main.dust[idx].position = (Main.dust[idx].position + Projectile.Center) / 2f; Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 0.1f; - Main.dust[idx].velocity -= projectile.velocity * (1.3f - projectile.scale); - Main.dust[idx].fadeIn = (float)(100 + projectile.owner); - Main.dust[idx].scale += projectile.scale * 0.75f; + Main.dust[idx].velocity -= Projectile.velocity * (1.3f - Projectile.scale); + Main.dust[idx].fadeIn = (float)(100 + Projectile.owner); + Main.dust[idx].scale += Projectile.scale * 0.75f; i++; } } diff --git a/Projectiles/Melee/Waterfall.cs b/Projectiles/Melee/Waterfall.cs index fa3e1c434b..b67e6e5a64 100644 --- a/Projectiles/Melee/Waterfall.cs +++ b/Projectiles/Melee/Waterfall.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,30 +17,30 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.alpha = 255; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - projectile.penetrate = 3; - projectile.timeLeft /= 2; - projectile.melee = true; - projectile.tileCollide = false; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.penetrate = 3; + Projectile.timeLeft /= 2; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; } public override void AI() { for (int num92 = 0; num92 < 2; num92++) { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; + float num93 = Projectile.velocity.X / 3f * (float)num92; + float num94 = Projectile.velocity.Y / 3f * (float)num92; int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 56, 0f, 0f, 100, default, 1.2f); + int num96 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num95, Projectile.position.Y + (float)num95), Projectile.width - num95 * 2, Projectile.height - num95 * 2, 56, 0f, 0f, 100, default, 1.2f); Main.dust[num96].noGravity = true; Main.dust[num96].velocity *= 0.25f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; + Main.dust[num96].velocity += Projectile.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[num96]; expr_47FA_cp_0.position.X -= num93; Dust expr_4815_cp_0 = Main.dust[num96]; @@ -47,53 +48,53 @@ namespace CalamityMod.Projectiles.Melee } for (int num105 = 0; num105 < 2; num105++) { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; + float num99 = Projectile.velocity.X / 3f * (float)num105; + float num100 = Projectile.velocity.Y / 3f * (float)num105; int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 245, 0f, 0f, 100, default, 1.2f); + int num102 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num101, Projectile.position.Y + (float)num101), Projectile.width - num101 * 2, Projectile.height - num101 * 2, 245, 0f, 0f, 100, default, 1.2f); Main.dust[num102].noGravity = true; Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.25f; + Main.dust[num102].velocity += Projectile.velocity * 0.25f; Dust expr_47FA_cp_0 = Main.dust[num102]; expr_47FA_cp_0.position.X -= num99; Dust expr_4815_cp_0 = Main.dust[num102]; expr_4815_cp_0.position.Y -= num100; } - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 60f) - projectile.tileCollide = true; + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 60f) + Projectile.tileCollide = true; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - Main.PlaySound(SoundID.Item10, projectile.Center); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); } return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.Center); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.oldVelocity.X * 0.25f, projectile.oldVelocity.Y * 0.25f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 245, projectile.oldVelocity.X * 0.25f, projectile.oldVelocity.Y * 0.25f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.oldVelocity.X * 0.25f, Projectile.oldVelocity.Y * 0.25f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 245, Projectile.oldVelocity.X * 0.25f, Projectile.oldVelocity.Y * 0.25f); } } } diff --git a/Projectiles/Melee/WhiteBoltAura.cs b/Projectiles/Melee/WhiteBoltAura.cs index 9425aa48c1..b8eaccad86 100644 --- a/Projectiles/Melee/WhiteBoltAura.cs +++ b/Projectiles/Melee/WhiteBoltAura.cs @@ -13,51 +13,51 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 100; - projectile.height = 2; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; + Projectile.width = 100; + Projectile.height = 2; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; } public override void AI() { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 7200f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 7200f) { - projectile.alpha += 5; - if (projectile.alpha > 255) + Projectile.alpha += 5; + if (Projectile.alpha > 255) { - projectile.alpha = 255; - projectile.Kill(); + Projectile.alpha = 255; + Projectile.Kill(); } } else { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 12f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 12f) { - projectile.ai[0] = 0f; - if (projectile.owner == Main.myPlayer) + Projectile.ai[0] = 0f; + if (Projectile.owner == Main.myPlayer) { - int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); - int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); + int num414 = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); + int num415 = (int)(Projectile.position.Y + (float)Projectile.height + 4f); + Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); } } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 10f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 10f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; int num416 = 0; int num417 = 0; float num418 = 0f; - int num419 = projectile.type; + int num419 = Projectile.type; for (int num420 = 0; num420 < 1000; num420++) { - if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) + if (Main.projectile[num420].active && Main.projectile[num420].owner == Projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) { num416++; if (Main.projectile[num420].ai[1] > num418) diff --git a/Projectiles/Melee/WhiteBoltAuraBlah.cs b/Projectiles/Melee/WhiteBoltAuraBlah.cs index 0185ccf490..e7b7afa092 100644 --- a/Projectiles/Melee/WhiteBoltAuraBlah.cs +++ b/Projectiles/Melee/WhiteBoltAuraBlah.cs @@ -13,51 +13,51 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 100; - projectile.height = 2; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 1200; + Projectile.width = 100; + Projectile.height = 2; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 1200; } public override void AI() { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 7200f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 7200f) { - projectile.alpha += 5; - if (projectile.alpha > 255) + Projectile.alpha += 5; + if (Projectile.alpha > 255) { - projectile.alpha = 255; - projectile.Kill(); + Projectile.alpha = 255; + Projectile.Kill(); } } else { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 12f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 12f) { - projectile.ai[0] = 0f; - if (projectile.owner == Main.myPlayer) + Projectile.ai[0] = 0f; + if (Projectile.owner == Main.myPlayer) { - int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); - int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 10f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); + int num414 = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); + int num415 = (int)(Projectile.position.Y + (float)Projectile.height + 4f); + Projectile.NewProjectile((float)num414, (float)num415, 0f, 10f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); } } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 10f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 10f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; int num416 = 0; int num417 = 0; float num418 = 0f; - int num419 = projectile.type; + int num419 = Projectile.type; for (int num420 = 0; num420 < 1000; num420++) { - if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) + if (Main.projectile[num420].active && Main.projectile[num420].owner == Projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) { num416++; if (Main.projectile[num420].ai[1] > num418) diff --git a/Projectiles/Melee/WhiteOrb.cs b/Projectiles/Melee/WhiteOrb.cs index de8351df18..23ce048d70 100644 --- a/Projectiles/Melee/WhiteOrb.cs +++ b/Projectiles/Melee/WhiteOrb.cs @@ -14,25 +14,25 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.ignoreWater = true; - projectile.timeLeft = 60; - projectile.melee = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.ignoreWater = true; + Projectile.timeLeft = 60; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.2f, 0.2f, 0.2f); + Lighting.AddLight(Projectile.Center, 0.2f, 0.2f, 0.2f); for (int num457 = 0; num457 < 2; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1.25f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 91, 0f, 0f, 100, default, 1.25f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } } } diff --git a/Projectiles/Melee/WhiteOrbBlah.cs b/Projectiles/Melee/WhiteOrbBlah.cs index 77f4551c27..20514bf6bc 100644 --- a/Projectiles/Melee/WhiteOrbBlah.cs +++ b/Projectiles/Melee/WhiteOrbBlah.cs @@ -14,25 +14,25 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.extraUpdates = 2; - projectile.penetrate = 1; - projectile.ignoreWater = true; - projectile.timeLeft = 60; - projectile.melee = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.extraUpdates = 2; + Projectile.penetrate = 1; + Projectile.ignoreWater = true; + Projectile.timeLeft = 60; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); for (int num457 = 0; num457 < 2; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } } } diff --git a/Projectiles/Melee/Whiterain.cs b/Projectiles/Melee/Whiterain.cs index b528cc8fbc..4d0902153a 100644 --- a/Projectiles/Melee/Whiterain.cs +++ b/Projectiles/Melee/Whiterain.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class Whiterain : ModProjectile @@ -15,36 +16,36 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.extraUpdates = 1; - projectile.penetrate = 2; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 120; - projectile.melee = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.extraUpdates = 1; + Projectile.penetrate = 2; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item125, projectile.Center); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item125, Projectile.Center); } - Lighting.AddLight(projectile.Center, 0.2f, 0.2f, 0.2f); + Lighting.AddLight(Projectile.Center, 0.2f, 0.2f, 0.2f); for (int num457 = 0; num457 < 2; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1.25f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 91, 0f, 0f, 100, default, 1.25f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); } } } diff --git a/Projectiles/Melee/WhiterainBlah.cs b/Projectiles/Melee/WhiterainBlah.cs index 00eab5438d..e2adcc4eba 100644 --- a/Projectiles/Melee/WhiterainBlah.cs +++ b/Projectiles/Melee/WhiterainBlah.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { public class WhiterainBlah : ModProjectile @@ -15,36 +16,36 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.extraUpdates = 2; - projectile.penetrate = 2; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 180; - projectile.melee = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.extraUpdates = 2; + Projectile.penetrate = 2; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Melee; } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item125, projectile.Center); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item125, Projectile.Center); } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); for (int num457 = 0; num457 < 2; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); } } } diff --git a/Projectiles/Melee/YateveoBloomProj.cs b/Projectiles/Melee/YateveoBloomProj.cs index baddd106e5..de8191a4a6 100644 --- a/Projectiles/Melee/YateveoBloomProj.cs +++ b/Projectiles/Melee/YateveoBloomProj.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -16,111 +17,111 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.alpha = 255; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 255; } public override void AI() { - Vector2 vector62 = Main.player[projectile.owner].MountedCenter - projectile.Center; - projectile.rotation = vector62.ToRotation() - 1.57f; + Vector2 vector62 = Main.player[Projectile.owner].MountedCenter - Projectile.Center; + Projectile.rotation = vector62.ToRotation() - 1.57f; float distance = vector62.Length(); - if (Main.player[projectile.owner].dead) + if (Main.player[Projectile.owner].dead) { - projectile.Kill(); + Projectile.Kill(); return; } - Main.player[projectile.owner].itemAnimation = 10; - Main.player[projectile.owner].itemTime = 10; + Main.player[Projectile.owner].itemAnimation = 10; + Main.player[Projectile.owner].itemTime = 10; if (vector62.X < 0f) { - Main.player[projectile.owner].ChangeDir(1); - projectile.direction = 1; + Main.player[Projectile.owner].ChangeDir(1); + Projectile.direction = 1; } else { - Main.player[projectile.owner].ChangeDir(-1); - projectile.direction = -1; + Main.player[Projectile.owner].ChangeDir(-1); + Projectile.direction = -1; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; if (distance > 210f) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } - else if (!Main.player[projectile.owner].channel) + else if (!Main.player[Projectile.owner].channel) { - if (projectile.velocity.Y < 0f) - projectile.velocity.Y = projectile.velocity.Y * 0.9f; + if (Projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y * 0.9f; - projectile.velocity.Y = projectile.velocity.Y + 1f; - projectile.velocity.X = projectile.velocity.X * 0.9f; + Projectile.velocity.Y = Projectile.velocity.Y + 1f; + Projectile.velocity.X = Projectile.velocity.X * 0.9f; } } else { - float num211 = 14f / Main.player[projectile.owner].meleeSpeed * 1.25f; - float num212 = 0.9f / Main.player[projectile.owner].meleeSpeed * 1.25f; + float num211 = 14f / Main.player[Projectile.owner].meleeSpeed * 1.25f; + float num212 = 0.9f / Main.player[Projectile.owner].meleeSpeed * 1.25f; - if (projectile.ai[1] == 1f) - projectile.tileCollide = false; + if (Projectile.ai[1] == 1f) + Projectile.tileCollide = false; - if (!Main.player[projectile.owner].channel || distance > 375f || !projectile.tileCollide) + if (!Main.player[Projectile.owner].channel || distance > 375f || !Projectile.tileCollide) { - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; - if (projectile.tileCollide) - projectile.netUpdate = true; + if (Projectile.tileCollide) + Projectile.netUpdate = true; - projectile.tileCollide = false; + Projectile.tileCollide = false; if (distance < 20f) - projectile.Kill(); + Projectile.Kill(); } - if (!projectile.tileCollide) + if (!Projectile.tileCollide) num212 *= 2f; - if (distance > 80f || !projectile.tileCollide) + if (distance > 80f || !Projectile.tileCollide) { distance = num211 / distance; vector62.X *= distance; vector62.Y *= distance; - Vector2 vector21 = new Vector2(projectile.velocity.X, projectile.velocity.Y); - float num217 = vector62.X - projectile.velocity.X; - float num218 = vector62.Y - projectile.velocity.Y; + Vector2 vector21 = new Vector2(Projectile.velocity.X, Projectile.velocity.Y); + float num217 = vector62.X - Projectile.velocity.X; + float num218 = vector62.Y - Projectile.velocity.Y; float num219 = (float)Math.Sqrt((double)(num217 * num217 + num218 * num218)); num219 = num212 / num219; num217 *= num219; num218 *= num219; - projectile.velocity.X = projectile.velocity.X * 0.98f; - projectile.velocity.Y = projectile.velocity.Y * 0.98f; - projectile.velocity.X = projectile.velocity.X + num217; - projectile.velocity.Y = projectile.velocity.Y + num218; + Projectile.velocity.X = Projectile.velocity.X * 0.98f; + Projectile.velocity.Y = Projectile.velocity.Y * 0.98f; + Projectile.velocity.X = Projectile.velocity.X + num217; + Projectile.velocity.Y = Projectile.velocity.Y + num218; } else { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 6f) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 6f) { - projectile.velocity.X = projectile.velocity.X * 0.96f; - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.X = Projectile.velocity.X * 0.96f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - if (Main.player[projectile.owner].velocity.X == 0f) - projectile.velocity.X = projectile.velocity.X * 0.96f; + if (Main.player[Projectile.owner].velocity.X == 0f) + Projectile.velocity.X = Projectile.velocity.X * 0.96f; } } @@ -143,40 +144,40 @@ namespace CalamityMod.Projectiles.Melee default: break; } - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType, 0f, 0f); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, 0f, 0f); Main.dust[dust].noGravity = true; Main.dust[dust].scale = 1.5f; } - if (projectile.alpha == 255 && distance > 10f) - projectile.alpha = 0; + if (Projectile.alpha == 255 && distance > 10f) + Projectile.alpha = 0; } public override bool OnTileCollide(Vector2 oldVelocity) { bool hitTile = false; - if (oldVelocity.X != projectile.velocity.X) + if (oldVelocity.X != Projectile.velocity.X) { hitTile = Math.Abs(oldVelocity.X) > 4f; - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -oldVelocity.X * 0.2f; + Projectile.position.X = Projectile.position.X + Projectile.velocity.X; + Projectile.velocity.X = -oldVelocity.X * 0.2f; } - if (oldVelocity.Y != projectile.velocity.Y) + if (oldVelocity.Y != Projectile.velocity.Y) { hitTile = Math.Abs(oldVelocity.Y) > 4f; - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -oldVelocity.Y * 0.2f; + Projectile.position.Y = Projectile.position.Y + Projectile.velocity.Y; + Projectile.velocity.Y = -oldVelocity.Y * 0.2f; } - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; if (hitTile) { - projectile.netUpdate = true; - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); + Projectile.netUpdate = true; + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); } return false; @@ -184,10 +185,10 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = ModContent.GetTexture("CalamityMod/ExtraTextures/Chains/YateveoBloomChain"); - Vector2 vector17 = projectile.Center; + Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/YateveoBloomChain"); + Vector2 vector17 = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); float num91 = (float)texture2D2.Height; diff --git a/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs index f961244035..5a4c097451 100644 --- a/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs +++ b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs @@ -11,38 +11,38 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Air Spinner"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 8f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 300f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 10.5f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 8f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 300f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 10.5f; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1.05f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1.05f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 60f, 5, ModContent.ProjectileType(), 0.25); - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 6f, 60f, 5, ModContent.ProjectileType(), 0.25); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/AortaYoyo.cs b/Projectiles/Melee/Yoyos/AortaYoyo.cs index 2e07e185d5..3fc8196c6c 100644 --- a/Projectiles/Melee/Yoyos/AortaYoyo.cs +++ b/Projectiles/Melee/Yoyos/AortaYoyo.cs @@ -11,38 +11,38 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Aorta"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 11f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 260f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 8.5f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 11f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 260f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 8.5f; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 240f, 6f, 180f, 3, ModContent.ProjectileType(), 0.25); - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 240f, 6f, 180f, 3, ModContent.ProjectileType(), 0.25); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/AzathothYoyo.cs b/Projectiles/Melee/Yoyos/AzathothYoyo.cs index 03489221ca..23ee4864df 100644 --- a/Projectiles/Melee/Yoyos/AzathothYoyo.cs +++ b/Projectiles/Melee/Yoyos/AzathothYoyo.cs @@ -11,42 +11,42 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Azathoth"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 700f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 18f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 700f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 18f; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 24; - projectile.height = 24; - projectile.scale = 1.2f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.aiStyle = 99; + Projectile.width = 24; + Projectile.height = 24; + Projectile.scale = 1.2f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } public override void AI() { if (Main.rand.NextBool(6)) { - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, projectile.velocity * 0.35f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center, Projectile.velocity * 0.35f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs b/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs index e004843e11..68373acecc 100644 --- a/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs +++ b/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs @@ -12,48 +12,48 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Fault"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 14f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 420f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 13f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 14f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 420f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 13f; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1.15f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1.15f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.NextBool(3) ? 16 : 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 127, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); if (Main.rand.NextBool(8)) { - int smoke = Gore.NewGore(projectile.position, default, Main.rand.Next(375, 378), 0.5f); + int smoke = Gore.NewGore(Projectile.position, default, Main.rand.Next(375, 378), 0.5f); Main.gore[smoke].behindTiles = true; } - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.OnFire, 240); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int boom = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int boom = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (boom.WithinBounds(Main.maxProjectiles)) Main.projectile[boom].Calamity().forceMelee = true; } @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/CnidarianYoyo.cs b/Projectiles/Melee/Yoyos/CnidarianYoyo.cs index b3bbaf97d8..71ae9af985 100644 --- a/Projectiles/Melee/Yoyos/CnidarianYoyo.cs +++ b/Projectiles/Melee/Yoyos/CnidarianYoyo.cs @@ -12,36 +12,36 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Cnidarian"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 7f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 240f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 11f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 7f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 240f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 11f; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1.15f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1.15f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 180f, 5, ModContent.ProjectileType(), 0.75); - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 6f, 180f, 5, ModContent.ProjectileType(), 0.75); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs index 33f68226a1..ae24ff22f4 100644 --- a/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs +++ b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs @@ -11,30 +11,30 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("The God's Gambit"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 320f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 14f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 320f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 14f; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1.15f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1.15f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 30f, 5, ProjectileID.SlimeGun, 0.75); - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 6f, 30f, 5, ProjectileID.SlimeGun, 0.75); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -44,8 +44,8 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs index de32042a8d..1b88a2abd4 100644 --- a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -11,46 +11,46 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Lacerator"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 560f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 18f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 560f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 18f; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1.1f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1.1f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override void AI() { - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) + if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) return; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.lifeRegenTime += 2; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs index c1a52e2bef..c351f058df 100644 --- a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs +++ b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs @@ -7,6 +7,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee.Yoyos { @@ -20,26 +21,26 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("The Microwave"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 450f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 14f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 450f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 14f; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(soundCooldown); @@ -52,21 +53,21 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { mmmmmm = ModContent.GetSound("CalamityMod/Sounds/Custom/MMMMMMMMMMMMM").CreateInstance(); mmmmmm.IsLooped = true; - CalamityUtils.ApplySoundStats(ref mmmmmm, projectile.Center); + CalamityUtils.ApplySoundStats(ref mmmmmm, Projectile.Center); Main.PlaySoundInstance(mmmmmm); } else if (!mmmmmm.IsDisposed) - CalamityUtils.ApplySoundStats(ref mmmmmm, projectile.Center); + CalamityUtils.ApplySoundStats(ref mmmmmm, Projectile.Center); // Spawn invisible but damaging aura projectile - if (projectile.owner == Main.myPlayer && !spawnedAura) + if (Projectile.owner == Main.myPlayer && !spawnedAura) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.35), projectile.knockBack, projectile.owner, projectile.identity, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack, Projectile.owner, Projectile.identity, 0f); spawnedAura = true; } // Decrement sound cooldown - if (soundCooldown > 0 && projectile.FinalExtraUpdate()) + if (soundCooldown > 0 && Projectile.FinalExtraUpdate()) soundCooldown--; // Dust circle appears for all players, even though the aura projectile is only spawned by the owner @@ -82,16 +83,16 @@ namespace CalamityMod.Projectiles.Melee.Yoyos ModContent.DustType(), ModContent.DustType() }); - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType); - Main.dust[dust].position = projectile.Center + dustOffset; + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType); + Main.dust[dust].position = Projectile.Center + dustOffset; Main.dust[dust].fadeIn = 1f; Main.dust[dust].velocity *= 0.2f; Main.dust[dust].scale = 0.1599999999f; } // Delete the projectile if it is farther than 200 blocks away from the player - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) - projectile.Kill(); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) + Projectile.Kill(); } public override void Kill(int timeLeft) @@ -102,14 +103,14 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Rectangle frame = new Rectangle(0, 0, 20, 16); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/MicrowaveYoyoGlow"), projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/MicrowaveYoyoGlow"), Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -117,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos target.AddBuff(ModContent.BuffType(), 240); if (target.life <= 0 && soundCooldown <= 0) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)projectile.Center.X, (int)projectile.Center.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)Projectile.Center.X, (int)Projectile.Center.Y); soundCooldown = 45; } } @@ -127,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos target.AddBuff(ModContent.BuffType(), 240); if (target.statLife <= 0 && soundCooldown <= 0) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)projectile.Center.X, (int)projectile.Center.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)Projectile.Center.X, (int)Projectile.Center.Y); soundCooldown = 45; } } diff --git a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs index 9f32284807..2f70a29c7a 100644 --- a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs @@ -18,26 +18,26 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("The Obliterator"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 640f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 13f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 640f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 13f; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1.6f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = UpdatesPerFrame; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3 * UpdatesPerFrame; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1.6f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = UpdatesPerFrame; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 3 * UpdatesPerFrame; } // localAI[1] is the shot counter. Every 5 frames, The Obliterator tries to fire a laser at a nearby target. @@ -45,22 +45,22 @@ namespace CalamityMod.Projectiles.Melee.Yoyos // localAI[1] counts up to 19 (4 x 5 - 1), then resets back to 0 for a 20-frame cycle. public override void AI() { - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); // Only do stuff once per frame, despite the yoyo's extra updates. extraUpdateCounter = (extraUpdateCounter + 1) % UpdatesPerFrame; if (extraUpdateCounter != UpdatesPerFrame - 1) return; - Lighting.AddLight(projectile.Center, 0.8f, 0.3f, 1f); + Lighting.AddLight(Projectile.Center, 0.8f, 0.3f, 1f); - projectile.localAI[1]++; - if (projectile.localAI[1] >= 4 * FramesPerShot) - projectile.localAI[1] = 0f; + Projectile.localAI[1]++; + if (Projectile.localAI[1] >= 4 * FramesPerShot) + Projectile.localAI[1] = 0f; // Attempt to fire a laser every 5 frames - if(projectile.localAI[1] % FramesPerShot == 0f) + if(Projectile.localAI[1] % FramesPerShot == 0f) { List targets = new List(); float laserRange = 300f; @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (n is null || !n.active) continue; - if (n.CanBeChasedBy(projectile, false) && (n.Center - projectile.Center).Length() <= laserRange && Collision.CanHit(projectile.Center, 1, 1, n.Center, 1, 1)) + if (n.CanBeChasedBy(Projectile, false) && (n.Center - Projectile.Center).Length() <= laserRange && Collision.CanHit(Projectile.Center, 1, 1, n.Center, 1, 1)) { targets.Add(i); // Bosses are added 5 times instead of 1 so that they are preferentially but not exclusively targeted. @@ -83,27 +83,27 @@ namespace CalamityMod.Projectiles.Melee.Yoyos return; // Pick which of the four corners the laser is spawning in - Vector2 laserSpawnPosition = projectile.Center; + Vector2 laserSpawnPosition = Projectile.Center; Vector2 offset; - if (projectile.localAI[1] < FramesPerShot) + if (Projectile.localAI[1] < FramesPerShot) offset = new Vector2(7, 7); - else if (projectile.localAI[1] < 2 * FramesPerShot) + else if (Projectile.localAI[1] < 2 * FramesPerShot) offset = new Vector2(-7, 7); - else if (projectile.localAI[1] < 3 * FramesPerShot) + else if (Projectile.localAI[1] < 3 * FramesPerShot) offset = new Vector2(-7, -7); else offset = new Vector2(7, -7); - laserSpawnPosition += offset.RotatedBy(projectile.rotation); + laserSpawnPosition += offset.RotatedBy(Projectile.rotation); ref NPC target = ref Main.npc[targets[Main.rand.Next(targets.Count)]]; const float laserSpeed = 6f; - int laserDamage = (int)(projectile.damage * 0.5f); + int laserDamage = (int)(Projectile.damage * 0.5f); const float laserKB = 3f; - Vector2 velocity = target.Center - projectile.Center; + Vector2 velocity = target.Center - Projectile.Center; velocity = velocity.SafeNormalize(Vector2.Zero) * laserSpeed; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(laserSpawnPosition, velocity, ModContent.ProjectileType(), laserDamage, laserKB, projectile.owner); + int proj = Projectile.NewProjectile(laserSpawnPosition, velocity, ModContent.ProjectileType(), laserDamage, laserKB, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMelee = true; } @@ -112,14 +112,14 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Vector2 origin = new Vector2(10f, 10f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/ObliteratorYoyoGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 2f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/ObliteratorYoyoGlow"), Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 2f, SpriteEffects.None, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Yoyos/OblivionYoyo.cs b/Projectiles/Melee/Yoyos/OblivionYoyo.cs index 20786bf122..6aa7dbd36f 100644 --- a/Projectiles/Melee/Yoyos/OblivionYoyo.cs +++ b/Projectiles/Melee/Yoyos/OblivionYoyo.cs @@ -11,33 +11,33 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Oblivion"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 400f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16.5f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 400f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 16.5f; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1.1f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1.1f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 48f, 5, ModContent.ProjectileType(), 0.5); - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 6f, 48f, 5, ModContent.ProjectileType(), 0.5); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/OracleYoyo.cs b/Projectiles/Melee/Yoyos/OracleYoyo.cs index 553ec8552f..0e347f433c 100644 --- a/Projectiles/Melee/Yoyos/OracleYoyo.cs +++ b/Projectiles/Melee/Yoyos/OracleYoyo.cs @@ -6,6 +6,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Melee.Yoyos { @@ -18,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos // The aura turns on and begins damaging enemies at 20 charge. // The yoyo "supercharges" at 50 charge. // Its size caps out at 100 charge. - public ref float AuraCharge => ref projectile.localAI[1]; + public ref float AuraCharge => ref Projectile.localAI[1]; private const float MaxCharge = 200f; private const float MinAuraRadius = 20f; @@ -39,12 +40,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("The Oracle"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 800f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 800f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 16f; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SendExtraAI(BinaryWriter writer) @@ -61,25 +62,25 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 20; - projectile.height = 20; - projectile.scale = 1.2f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = UpdatesPerFrame; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 7 * UpdatesPerFrame; + Projectile.aiStyle = 99; + Projectile.width = 20; + Projectile.height = 20; + Projectile.scale = 1.2f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = UpdatesPerFrame; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 7 * UpdatesPerFrame; } public override void AI() { - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); // Only do stuff once per frame, despite the yoyo's extra updates. - if (!projectile.FinalExtraUpdate()) + if (!Projectile.FinalExtraUpdate()) return; // Produces golden dust constantly while in flight. This helps light the yoyo. @@ -87,14 +88,14 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { int dustType = Main.rand.NextBool(3) ? 244 : 246; float scale = 0.8f + Main.rand.NextFloat(0.6f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); Main.dust[idx].noGravity = true; Main.dust[idx].velocity = Vector2.Zero; Main.dust[idx].scale = scale; } // The yoyo makes its own faint yellow light (unnoticeable once the lightning aura gets going) - Lighting.AddLight(projectile.Center, 0.6f, 0.42f, 0.1f); + Lighting.AddLight(Projectile.Center, 0.6f, 0.42f, 0.1f); // The aura discharges over time based on its current charge. float discharge = MinDischargeRate + DischargeRateScaleFactor * AuraCharge; @@ -114,10 +115,10 @@ namespace CalamityMod.Projectiles.Melee.Yoyos float auraRadius = AuraCharge > MaxAuraRadius ? MaxAuraRadius : AuraCharge; DrawRedLightningAura(auraRadius); - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 22; - Main.PlaySound(SoundID.Item93, (int)projectile.Center.X, (int)projectile.Center.Y); + Projectile.soundDelay = 22; + SoundEngine.PlaySound(SoundID.Item93, (int)Projectile.Center.X, (int)Projectile.Center.Y); } if (AuraFrame % AuraLocalIFrames == 0) @@ -129,14 +130,14 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } } else - projectile.soundDelay = 2; + Projectile.soundDelay = 2; AuraFrame = (AuraFrame + 1) % AuraLocalIFrames; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -150,7 +151,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos AuraCharge += ChargePerHit; // Fire Auric orbs every few hits while supercharged. - if (AuraCharge > SuperchargeThreshold && projectile.numHits % HitsPerOrbVolley == 0) + if (AuraCharge > SuperchargeThreshold && Projectile.numHits % HitsPerOrbVolley == 0) FireAuricOrbs(); } @@ -159,7 +160,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { // Light emits from the yoyo itself while the aura is active, eventually becoming insanely bright float brightness = radius * 0.03f; - Lighting.AddLight(projectile.Center, brightness, 0.2f * brightness, 0.1f * brightness); + Lighting.AddLight(Projectile.Center, brightness, 0.2f * brightness, 0.1f * brightness); // Number of particles on the circumference scales directly with the circumference float dustDensity = 0.2f; @@ -174,8 +175,8 @@ namespace CalamityMod.Projectiles.Melee.Yoyos dustOffset = dustOffset.RotatedBy(angleIncrement); int dustType = 260; float scale = 1.6f + Main.rand.NextFloat(0.9f); - int idx = Dust.NewDust(projectile.Center, 1, 1, dustType); - Main.dust[idx].position = projectile.Center + dustOffset; + int idx = Dust.NewDust(Projectile.Center, 1, 1, dustType); + Main.dust[idx].position = Projectile.Center + dustOffset; Main.dust[idx].noGravity = true; Main.dust[idx].noLight = true; Main.dust[idx].velocity *= 0.5f; @@ -202,8 +203,8 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Vector2 partialRadius = (float)j / dustPerArc * radiusVec; int dustType = 260; float scale = 1.6f + Main.rand.NextFloat(0.9f); - int idx = Dust.NewDust(projectile.Center, 1, 1, dustType); - Main.dust[idx].position = projectile.Center + partialRadius; + int idx = Dust.NewDust(Projectile.Center, 1, 1, dustType); + Main.dust[idx].position = Projectile.Center + partialRadius; Main.dust[idx].noGravity = true; Main.dust[idx].noLight = true; Main.dust[idx].velocity *= 0.3f; @@ -212,15 +213,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } // Make extra sound when these arcs happen - Main.PlaySound(SoundID.NPCHit53, (int)projectile.Center.X, (int)projectile.Center.Y); + SoundEngine.PlaySound(SoundID.NPCHit53, (int)Projectile.Center.X, (int)Projectile.Center.Y); } } private void DealAuraDamage(float radius, int baseDamage) { - if (projectile.owner != Main.myPlayer) + if (Projectile.owner != Main.myPlayer) return; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; for (int i = 0; i < Main.maxNPCs; ++i) { @@ -229,10 +230,10 @@ namespace CalamityMod.Projectiles.Melee.Yoyos continue; // Shock any valid target within range. Check all four corners of their hitbox. - float d1 = Vector2.Distance(projectile.Center, target.Hitbox.TopLeft()); - float d2 = Vector2.Distance(projectile.Center, target.Hitbox.TopRight()); - float d3 = Vector2.Distance(projectile.Center, target.Hitbox.BottomLeft()); - float d4 = Vector2.Distance(projectile.Center, target.Hitbox.BottomRight()); + float d1 = Vector2.Distance(Projectile.Center, target.Hitbox.TopLeft()); + float d2 = Vector2.Distance(Projectile.Center, target.Hitbox.TopRight()); + float d3 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomLeft()); + float d4 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomRight()); float dist = MathHelper.Min(d1, d2); dist = MathHelper.Min(dist, d3); dist = MathHelper.Min(dist, d4); @@ -240,12 +241,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (dist <= radius) { int finalDamage = (int)(baseDamage * owner.MeleeDamage()); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile p = Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ModContent.ProjectileType(), finalDamage, 0f, projectile.owner, i); + Projectile p = Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ModContent.ProjectileType(), finalDamage, 0f, Projectile.owner, i); if (p.whoAmI.WithinBounds(Main.maxProjectiles)) { - p.melee = true; + p.DamageType = DamageClass.Melee; p.Calamity().forceMelee = true; } } @@ -256,11 +257,11 @@ namespace CalamityMod.Projectiles.Melee.Yoyos private void FireAuricOrbs() { // Play a sound when orbs are fired - Main.PlaySound(SoundID.Item92, (int)projectile.Center.X, (int)projectile.Center.Y); + SoundEngine.PlaySound(SoundID.Item92, (int)Projectile.Center.X, (int)Projectile.Center.Y); int numOrbs = 3; int orbID = ModContent.ProjectileType(); - int orbDamage = projectile.damage * 3; + int orbDamage = Projectile.damage * 3; float orbKB = 8f; float angleVariance = MathHelper.TwoPi / numOrbs; float spinOffsetAngle = MathHelper.Pi / (2f * numOrbs); @@ -272,8 +273,8 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Vector2 velocity = new Vector2(posVec.X, posVec.Y).RotatedBy(spinOffsetAngle); velocity.Normalize(); velocity *= 18f; - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center + posVec, velocity, orbID, orbDamage, orbKB, Main.myPlayer, 0.0f, 0.0f); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center + posVec, velocity, orbID, orbDamage, orbKB, Main.myPlayer, 0.0f, 0.0f); } } } diff --git a/Projectiles/Melee/Yoyos/PandemicYoyo.cs b/Projectiles/Melee/Yoyos/PandemicYoyo.cs index e4863483c9..1f7ad75b76 100644 --- a/Projectiles/Melee/Yoyos/PandemicYoyo.cs +++ b/Projectiles/Melee/Yoyos/PandemicYoyo.cs @@ -12,30 +12,30 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Pandemic"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 450f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16.5f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 450f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 16.5f; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 180f, 5, ModContent.ProjectileType(), 0.75); - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 6f, 180f, 5, ModContent.ProjectileType(), 0.75); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -45,8 +45,8 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs index da8515ef30..fc8c22e06b 100644 --- a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs +++ b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs @@ -11,36 +11,36 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Quagmire"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 12f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 400f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 15f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 12f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 400f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 15f; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1.25f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1.25f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - if (projectile.owner == Main.myPlayer) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 44, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + if (Projectile.owner == Main.myPlayer) { int proj; if (Main.rand.NextBool(10)) { - proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ProjectileID.SporeGas, (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner); + proj = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.35f, Projectile.velocity.Y * 0.35f, ProjectileID.SporeGas, (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().forceMelee = true; @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } if (Main.rand.NextBool(30)) { - proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, ProjectileID.SporeGas2, (int)(projectile.damage * 0.6), projectile.knockBack, projectile.owner); + proj = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, ProjectileID.SporeGas2, (int)(Projectile.damage * 0.6), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().forceMelee = true; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } if (Main.rand.NextBool(50)) { - proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.15f, projectile.velocity.Y * 0.15f, ProjectileID.SporeGas3, (int)(projectile.damage * 0.7), projectile.knockBack, projectile.owner); + proj = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.15f, Projectile.velocity.Y * 0.15f, ProjectileID.SporeGas3, (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().forceMelee = true; @@ -78,8 +78,8 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Melee/Yoyos/RiptideYoyo.cs b/Projectiles/Melee/Yoyos/RiptideYoyo.cs index dc13750757..9873a860a3 100644 --- a/Projectiles/Melee/Yoyos/RiptideYoyo.cs +++ b/Projectiles/Melee/Yoyos/RiptideYoyo.cs @@ -9,57 +9,57 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Riptide"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 7.5f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 220f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 12.5f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 7.5f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 220f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 12.5f; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1f; - projectile.friendly = true; - projectile.melee = true; - projectile.alpha = 150; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.alpha = 150; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); if (Main.rand.NextBool(90)) { switch (Main.rand.Next(1, 9)) { case 1: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0, -10, ModContent.ProjectileType(), 4, 0.0f, projectile.owner, 1.2f/*X Increment*/, 0.2f/*Y Increment*/); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0, -10, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 1.2f/*X Increment*/, 0.2f/*Y Increment*/); break; case 2: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 5, -5, ModContent.ProjectileType(), 4, 0.0f, projectile.owner, 0.7f/*X Increment*/, 0.7f/*Y Increment*/); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 5, -5, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 0.7f/*X Increment*/, 0.7f/*Y Increment*/); break; case 3: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 10, 0, ModContent.ProjectileType(), 4, 0.0f, projectile.owner, 0.2f/*X Increment*/, 1.2f/*Y Increment*/); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 10, 0, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 0.2f/*X Increment*/, 1.2f/*Y Increment*/); break; case 4: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 5, 5, ModContent.ProjectileType(), 4, 0.0f, projectile.owner, -0.7f/*X Increment*/, 0.7f/*Y Increment*/); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 5, 5, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -0.7f/*X Increment*/, 0.7f/*Y Increment*/); break; case 5: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0, 10, ModContent.ProjectileType(), 4, 0.0f, projectile.owner, -1.2f/*X Increment*/, -0.2f/*Y Increment*/); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, -0, 10, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -1.2f/*X Increment*/, -0.2f/*Y Increment*/); break; case 6: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -5, 5, ModContent.ProjectileType(), 4, 0.0f, projectile.owner, -0.7f/*X Increment*/, -0.7f/*Y Increment*/); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, -5, 5, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -0.7f/*X Increment*/, -0.7f/*Y Increment*/); break; case 7: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -10, -0, ModContent.ProjectileType(), 4, 0.0f, projectile.owner, -0.2f/*X Increment*/, -1.2f/*Y Increment*/); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, -10, -0, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -0.2f/*X Increment*/, -1.2f/*Y Increment*/); break; case 8: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -10, -10, ModContent.ProjectileType(), 4, 0.0f, projectile.owner, 0.7f/*X Increment*/, -0.7f/*Y Increment*/); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, -10, -10, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 0.7f/*X Increment*/, -0.7f/*Y Increment*/); break; } } diff --git a/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs index c49e9ad5de..a3037b4c84 100644 --- a/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs +++ b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs @@ -11,36 +11,36 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Shimmerspark"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 16f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 350f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 17f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 16f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 350f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 17f; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 120f, 5, ProjectileID.HallowStar); - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 6f, 120f, 5, ProjectileID.HallowStar); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs index f08fefa735..baa9f22a84 100644 --- a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs +++ b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs @@ -13,42 +13,42 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Solar Flare"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 560f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 18f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 560f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 18f; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1.15f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1.15f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override void AI() { if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 240); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner); + int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMelee = true; } @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs index c61cf9cf20..8d3fdc9be5 100644 --- a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs +++ b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs @@ -18,44 +18,44 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurous Grabber Yoyo"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 350f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 350f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 16f; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 18; - projectile.height = 18; - projectile.scale = 1f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.aiStyle = 99; + Projectile.width = 18; + Projectile.height = 18; + Projectile.scale = 1f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { if (bubbleStronk) { - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 20f; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10 * projectile.extraUpdates; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 20f; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10 * Projectile.extraUpdates; bubbleStronkCounter++; } else { - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16f; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = false; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 16f; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = false; bubbleStronkCounter = 0; } @@ -65,9 +65,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos for (int i = 0; i < Main.maxProjectiles; i++) { Projectile proj = Main.projectile[i]; - if (proj.active && proj.type == ModContent.ProjectileType() && proj.ai[0] >= 40f && proj.owner == projectile.owner) + if (proj.active && proj.type == ModContent.ProjectileType() && proj.ai[0] >= 40f && proj.owner == Projectile.owner) { - if (projectile.Hitbox.Intersects(proj.Hitbox)) + if (Projectile.Hitbox.Intersects(proj.Hitbox)) { proj.Kill(); bubbleStronk = true; @@ -89,24 +89,24 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (Main.rand.NextBool(10)) projType = ModContent.ProjectileType(); float angle = MathHelper.TwoPi / bubbleAmt * i + (float)Math.Sin(arbitraryTimer / 20f) * MathHelper.PiOver2; - Projectile.NewProjectile(projectile.Center, angle.ToRotationVector2() * 8f, projType, projectile.damage / 4, projectile.knockBack / 4, projectile.owner); + Projectile.NewProjectile(Projectile.Center, angle.ToRotationVector2() * 8f, projType, Projectile.damage / 4, Projectile.knockBack / 4, Projectile.owner); } bubbleCounter = 0; } } - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); if (bubbleStronk) { - tex = ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/SulphurousGrabberYoyoBubble"); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, tex); + tex = ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SulphurousGrabberYoyoBubble"); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, tex); } return false; } diff --git a/Projectiles/Melee/Yoyos/VerdantYoyo.cs b/Projectiles/Melee/Yoyos/VerdantYoyo.cs index 92197f6db5..8a356924e7 100644 --- a/Projectiles/Melee/Yoyos/VerdantYoyo.cs +++ b/Projectiles/Melee/Yoyos/VerdantYoyo.cs @@ -11,44 +11,44 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Verdant"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 560f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 17f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 560f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 17f; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1.1f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 9; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1.1f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 9; } public override void AI() { - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 75, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 75, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 12f, 54f, 5, ProjectileID.CrystalLeafShot, 0.8); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 12f, 54f, 5, ProjectileID.CrystalLeafShot, 0.8); - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/YinYoyo.cs b/Projectiles/Melee/Yoyos/YinYoyo.cs index 132277db2d..cf302739fd 100644 --- a/Projectiles/Melee/Yoyos/YinYoyo.cs +++ b/Projectiles/Melee/Yoyos/YinYoyo.cs @@ -11,36 +11,36 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Yin-Yo"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 14f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 350f; - ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 17f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 14f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 350f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 17f; } public override void SetDefaults() { - projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1f; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.aiStyle = 99; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 10f, 144f, 5, Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()); - if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks - projectile.Kill(); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 10f, 144f, 5, Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()); + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Pets/Akato.cs b/Projectiles/Pets/Akato.cs index 13ccc7fabe..ff98ca2eff 100644 --- a/Projectiles/Pets/Akato.cs +++ b/Projectiles/Pets/Akato.cs @@ -8,26 +8,26 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Akato"); - Main.projFrames[projectile.type] = 6; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 60; - projectile.height = 60; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; + Projectile.netImportant = true; + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } CalamityPlayer modPlayer = player.Calamity(); @@ -37,18 +37,18 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.akato) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - projectile.FloatingPetAI(true, 0.02f); - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.FloatingPetAI(true, 0.02f); + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) + if (Projectile.frame > 5) { - projectile.frame = 0; + Projectile.frame = 0; } } } diff --git a/Projectiles/Pets/Astrophage.cs b/Projectiles/Pets/Astrophage.cs index 087b233a36..9569cbb7c0 100644 --- a/Projectiles/Pets/Astrophage.cs +++ b/Projectiles/Pets/Astrophage.cs @@ -11,25 +11,25 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Astrophage"); - Main.projFrames[projectile.type] = 5; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 35; - projectile.height = 35; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = true; + Projectile.netImportant = true; + Projectile.width = 35; + Projectile.height = 35; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.tileCollide = true; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { - Player player = Main.player[projectile.owner]; - Vector2 center2 = projectile.Center; + Player player = Main.player[Projectile.owner]; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); fallThrough = playerDistance > 200f; @@ -38,10 +38,10 @@ namespace CalamityMod.Projectiles.Pets public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } CalamityPlayer modPlayer = player.Calamity(); @@ -51,120 +51,120 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.astrophage) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) + if (Projectile.position.X == Projectile.oldPosition.X && Projectile.position.Y == Projectile.oldPosition.Y && Projectile.velocity.X == 0) { - projectile.frame = 0; + Projectile.frame = 0; } - else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) + else if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y) { - projectile.frame = 1; - projectile.frameCounter = 0; + Projectile.frame = 1; + Projectile.frameCounter = 0; } else { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) + if (Projectile.frame > 4) { - projectile.frame = 0; + Projectile.frame = 0; } } - Vector2 vector46 = projectile.position; + Vector2 vector46 = Projectile.position; if (!fly) { - projectile.rotation = 0; - Vector2 center2 = projectile.Center; + Projectile.rotation = 0; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); - if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) + if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X))) { - projectile.velocity.Y = -5f; + Projectile.velocity.Y = -5f; } - projectile.velocity.Y += 0.20f; - if (projectile.velocity.Y > 7f) + Projectile.velocity.Y += 0.20f; + if (Projectile.velocity.Y > 7f) { - projectile.velocity.Y = 7f; + Projectile.velocity.Y = 7f; } if (playerDistance > 600f) { fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 0f; } if (playerDistance > 100f) { - if (player.position.X - projectile.position.X > 0f) + if (player.position.X - Projectile.position.X > 0f) { - projectile.velocity.X += 0.10f; - if (projectile.velocity.X > 7f) + Projectile.velocity.X += 0.10f; + if (Projectile.velocity.X > 7f) { - projectile.velocity.X = 7f; + Projectile.velocity.X = 7f; } } else { - projectile.velocity.X -= 0.10f; - if (projectile.velocity.X < -7f) + Projectile.velocity.X -= 0.10f; + if (Projectile.velocity.X < -7f) { - projectile.velocity.X = -7f; + Projectile.velocity.X = -7f; } } } if (playerDistance < 100f) { - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - if (projectile.velocity.X > 0.5f) + if (Projectile.velocity.X > 0.5f) { - projectile.velocity.X -= 0.15f; + Projectile.velocity.X -= 0.15f; } - else if (projectile.velocity.X < -0.5f) + else if (Projectile.velocity.X < -0.5f) { - projectile.velocity.X += 0.15f; + Projectile.velocity.X += 0.15f; } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + else if (Projectile.velocity.X < 0.5f && Projectile.velocity.X > -0.5f) { - projectile.velocity.X = 0f; + Projectile.velocity.X = 0f; } } } } else if (fly) { - projectile.alpha += 15; - if (projectile.alpha >= 255) + Projectile.alpha += 15; + if (Projectile.alpha >= 255) { - projectile.position.X = player.position.X; - projectile.position.Y = player.position.Y; + Projectile.position.X = player.position.X; + Projectile.position.Y = player.position.Y; fly = false; - projectile.alpha = 0; + Projectile.alpha = 0; } } - if (projectile.velocity.X > 0.25f) + if (Projectile.velocity.X > 0.25f) { - projectile.spriteDirection = -1; + Projectile.spriteDirection = -1; } - else if (projectile.velocity.X < -0.25f) + else if (Projectile.velocity.X < -0.25f) { - projectile.spriteDirection = 1; + Projectile.spriteDirection = 1; } } private bool HoleBelow() //pretty much the same as the one used in mantis { int tileWidth = 4; - int tileX = (int)(projectile.Center.X / 16f) - tileWidth; - if (projectile.velocity.X > 0) + int tileX = (int)(Projectile.Center.X / 16f) - tileWidth; + if (Projectile.velocity.X > 0) { tileX += tileWidth; } - int tileY = (int)((projectile.position.Y + projectile.height) / 16f); + int tileY = (int)((Projectile.position.Y + Projectile.height) / 16f); for (int y = tileY; y < tileY + 2; y++) { for (int x = tileX; x < tileX + tileWidth; x++) diff --git a/Projectiles/Pets/BabyGhostBell.cs b/Projectiles/Pets/BabyGhostBell.cs index 10798b29e0..c538f5f51c 100644 --- a/Projectiles/Pets/BabyGhostBell.cs +++ b/Projectiles/Pets/BabyGhostBell.cs @@ -11,27 +11,27 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Baby Ghost Bell"); - Main.projFrames[projectile.type] = 4; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.LightPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + Main.projPet[Projectile.type] = true; + ProjectileID.Sets.LightPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; + Projectile.netImportant = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } CalamityPlayer modPlayer = player.Calamity(); @@ -41,27 +41,27 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.babyGhostBell) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } underwater = Collision.DrownCollision(player.position, player.width, player.height, player.gravDir); if (underwater) { - Lighting.AddLight(projectile.Center, 0.3f, 0.9f, 1.5f); + Lighting.AddLight(Projectile.Center, 0.3f, 0.9f, 1.5f); } else { - Lighting.AddLight(projectile.Center, 0.1f, 0.3f, 0.5f); + Lighting.AddLight(Projectile.Center, 0.1f, 0.3f, 0.5f); } - projectile.FloatingPetAI(false, 0.05f, true); - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.FloatingPetAI(false, 0.05f, true); + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } } diff --git a/Projectiles/Pets/Bear.cs b/Projectiles/Pets/Bear.cs index 314c5c0be7..ee878e0bcd 100644 --- a/Projectiles/Pets/Bear.cs +++ b/Projectiles/Pets/Bear.cs @@ -16,25 +16,25 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Bear"); - Main.projFrames[projectile.type] = 22; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 22; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 44; - projectile.height = 44; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = true; + Projectile.netImportant = true; + Projectile.width = 44; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.tileCollide = true; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { - Player player = Main.player[projectile.owner]; - Vector2 center2 = projectile.Center; + Player player = Main.player[Projectile.owner]; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); fallThrough = playerDistance > 200f; @@ -43,10 +43,10 @@ namespace CalamityMod.Projectiles.Pets public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } CalamityPlayer modPlayer = player.Calamity(); @@ -56,150 +56,150 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.bearPet) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - Vector2 vector46 = projectile.position; + Vector2 vector46 = Projectile.position; if (easyfix) { - projectile.position.Y += -3f; + Projectile.position.Y += -3f; easyfix = false; } if (!fly) { - projectile.rotation = 0; - Vector2 center2 = projectile.Center; + Projectile.rotation = 0; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); - if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) + if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X))) { - projectile.velocity.Y = -5f; + Projectile.velocity.Y = -5f; } - projectile.velocity.Y += 0.20f; + Projectile.velocity.Y += 0.20f; - if (projectile.velocity.Y > 7f) + if (Projectile.velocity.Y > 7f) { - projectile.velocity.Y = 7f; + Projectile.velocity.Y = 7f; } if (playerDistance > 600f) { fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - projectile.tileCollide = false; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 0f; + Projectile.tileCollide = false; } if (playerDistance > 100f) { - if (player.position.X - projectile.position.X > 0f) + if (player.position.X - Projectile.position.X > 0f) { - projectile.velocity.X += 0.10f; + Projectile.velocity.X += 0.10f; - if (projectile.velocity.X > 7f) + if (Projectile.velocity.X > 7f) { - projectile.velocity.X = 7f; + Projectile.velocity.X = 7f; } } else { - projectile.velocity.X -= 0.10f; + Projectile.velocity.X -= 0.10f; - if (projectile.velocity.X < -7f) + if (Projectile.velocity.X < -7f) { - projectile.velocity.X = -7f; + Projectile.velocity.X = -7f; } } } if (playerDistance < 100f) { - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - if (projectile.velocity.X > 0.5f) + if (Projectile.velocity.X > 0.5f) { - projectile.velocity.X -= 0.15f; + Projectile.velocity.X -= 0.15f; } - else if (projectile.velocity.X < -0.5f) + else if (Projectile.velocity.X < -0.5f) { - projectile.velocity.X += 0.15f; + Projectile.velocity.X += 0.15f; } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + else if (Projectile.velocity.X < 0.5f && Projectile.velocity.X > -0.5f) { - projectile.velocity.X = 0f; + Projectile.velocity.X = 0f; } } } - if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) + if (Projectile.position.X == Projectile.oldPosition.X && Projectile.position.Y == Projectile.oldPosition.Y && Projectile.velocity.X == 0) { - projectile.frameCounter++; + Projectile.frameCounter++; switch (chosenIdle) { case 1: if (idleTimer == 0) { - projectile.frame = 0; + Projectile.frame = 0; } ++idleTimer; - if (projectile.frameCounter > 5) + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { chosenIdle = 0; } - if (projectile.frame < 1) + if (Projectile.frame < 1) { - projectile.frame = 1; + Projectile.frame = 1; } break; case 2: if (idleTimer == 0) { - projectile.frame = 0; + Projectile.frame = 0; } ++idleTimer; - if (projectile.frameCounter > 5) + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 9) + if (Projectile.frame > 9) { chosenIdle = 0; } - if (projectile.frame < 4) + if (Projectile.frame < 4) { - projectile.frame = 4; + Projectile.frame = 4; } break; case 3: if (idleTimer == 0) { - projectile.frame = 0; + Projectile.frame = 0; } ++idleTimer; - if (projectile.frameCounter > 5) + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 12) + if (Projectile.frame > 12) { chosenIdle = 0; } - if (projectile.frame < 10) + if (Projectile.frame < 10) { - projectile.frame = 10; + Projectile.frame = 10; } break; } if (chosenIdle == 0) { - projectile.frame = 0; - projectile.frameCounter = 5; + Projectile.frame = 0; + Projectile.frameCounter = 5; ++idleTimer; if (idleTimer > 120) { @@ -208,39 +208,39 @@ namespace CalamityMod.Projectiles.Pets } } } - else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) + else if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y) { - projectile.frame = 13; - projectile.frameCounter = 0; + Projectile.frame = 13; + Projectile.frameCounter = 0; } else { - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 17) + if (Projectile.frame > 17) { - projectile.frame = 14; + Projectile.frame = 14; } - if (projectile.frame < 14) + if (Projectile.frame < 14) { - projectile.frame = 14; + Projectile.frame = 14; } } } else if (fly) { float num16 = 0.3f; - projectile.tileCollide = false; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float horiPos = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; - float vertiPos = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; + Projectile.tileCollide = false; + Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X; + float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y; vertiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)Main.rand.Next(-10, 21); - horiPos += (float)(60 * -(float)Main.player[projectile.owner].direction); + horiPos += (float)(60 * -(float)Main.player[Projectile.owner].direction); vertiPos -= 60f; float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); float num21 = 18f; @@ -248,9 +248,9 @@ namespace CalamityMod.Projectiles.Pets if (playerDistance > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (playerDistance < 100f) { @@ -263,17 +263,17 @@ namespace CalamityMod.Projectiles.Pets { playerStill = 0; } - if (playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerStill > 60 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { fly = false; - projectile.tileCollide = true; + Projectile.tileCollide = true; } } if (playerDistance < 50f) { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f) { - projectile.velocity *= 0.90f; + Projectile.velocity *= 0.90f; } num16 = 0.01f; } @@ -292,74 +292,74 @@ namespace CalamityMod.Projectiles.Pets vertiPos *= playerDistance; } - if (projectile.velocity.X <= horiPos) + if (Projectile.velocity.X <= horiPos) { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) + Projectile.velocity.X = Projectile.velocity.X + num16; + if (num16 > 0.05f && Projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + num16; + Projectile.velocity.X = Projectile.velocity.X + num16; } } - if (projectile.velocity.X > horiPos) + if (Projectile.velocity.X > horiPos) { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) + Projectile.velocity.X = Projectile.velocity.X - num16; + if (num16 > 0.05f && Projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - num16; + Projectile.velocity.X = Projectile.velocity.X - num16; } } - if (projectile.velocity.Y <= vertiPos) + if (Projectile.velocity.Y <= vertiPos) { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num16; + if (num16 > 0.05f && Projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f; } } - if (projectile.velocity.Y > vertiPos) + if (Projectile.velocity.Y > vertiPos) { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num16; + if (num16 > 0.05f && Projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; } } - projectile.rotation = projectile.velocity.X * 0.03f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.rotation = Projectile.velocity.X * 0.03f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 21) + if (Projectile.frame > 21) { - projectile.frame = 18; + Projectile.frame = 18; } - if (projectile.frame < 18) + if (Projectile.frame < 18) { - projectile.frame = 18; + Projectile.frame = 18; } } - if (projectile.velocity.X > 0.25f) + if (Projectile.velocity.X > 0.25f) { - projectile.spriteDirection = -1; + Projectile.spriteDirection = -1; } - else if (projectile.velocity.X < -0.25f) + else if (Projectile.velocity.X < -0.25f) { - projectile.spriteDirection = 1; + Projectile.spriteDirection = 1; } } private bool HoleBelow() //pretty much the same as the one used in mantis { int tileWidth = 4; - int tileX = (int)(projectile.Center.X / 16f) - tileWidth; - if (projectile.velocity.X > 0) + int tileX = (int)(Projectile.Center.X / 16f) - tileWidth; + if (Projectile.velocity.X > 0) { tileX += tileWidth; } - int tileY = (int)((projectile.position.Y + projectile.height) / 16f); + int tileY = (int)((Projectile.position.Y + Projectile.height) / 16f); for (int y = tileY; y < tileY + 2; y++) { for (int x = tileX; x < tileX + tileWidth; x++) diff --git a/Projectiles/Pets/BendyPet.cs b/Projectiles/Pets/BendyPet.cs index c34c5016f1..30e644b68b 100644 --- a/Projectiles/Pets/BendyPet.cs +++ b/Projectiles/Pets/BendyPet.cs @@ -13,33 +13,33 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Dreamfog Dragon"); - Main.projFrames[projectile.type] = 5; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.LightPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + Main.projPet[Projectile.type] = true; + ProjectileID.Sets.LightPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 38; - projectile.height = 56; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.ignoreWater = true; - projectile.tileCollide = false; + Projectile.netImportant = true; + Projectile.width = 38; + Projectile.height = 56; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; } public override void AI() { //Set up namespaces - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); //If the player dies or something, kill thte projectile if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } if (player.dead) @@ -50,19 +50,19 @@ namespace CalamityMod.Projectiles.Pets //Prevent the projectile from losing its timeLeft if (modPlayer.bendyPet) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } //Update frames - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } //Highlight nearby danger sources @@ -70,19 +70,19 @@ namespace CalamityMod.Projectiles.Pets player.detectCreature = true; //Generate less light if returning to the player - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Lighting.AddLight(projectile.Center, 0.8118f, 0.2529f, 1.3294f); //138, 43, 226 + Lighting.AddLight(Projectile.Center, 0.8118f, 0.2529f, 1.3294f); //138, 43, 226 } else { - Lighting.AddLight(projectile.Center, 0.4329f, 0.1349f, 0.709f); + Lighting.AddLight(Projectile.Center, 0.4329f, 0.1349f, 0.709f); } float idleMvt = 0.2f; float projSpeed = 5f; //Calculate where the pet should reside based on pressed controls - Vector2 projVec = player.Center - projectile.Center; + Vector2 projVec = player.Center - Projectile.Center; projVec.Y += player.gfxOffY; if (player.controlLeft) { @@ -107,139 +107,139 @@ namespace CalamityMod.Projectiles.Pets float playerDist = projVec.Length(); if (playerDist > 1000f) { - projectile.position.X += projVec.X; - projectile.position.Y += projVec.Y; + Projectile.position.X += projVec.X; + Projectile.position.Y += projVec.Y; } //Returning to player AI - if (projectile.localAI[0] == 1f) + if (Projectile.localAI[0] == 1f) { //If close enough, the player isn't moving too much, and isn't moving vertically, return to normal if (playerDist < 10f && Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y) < projSpeed && player.velocity.Y == 0f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } //Go faster projSpeed = 12f; if (playerDist < projSpeed) { - projectile.velocity.X = projVec.X; - projectile.velocity.Y = projVec.Y; + Projectile.velocity.X = projVec.X; + Projectile.velocity.Y = projVec.Y; } else { playerDist = projSpeed / playerDist; - projectile.velocity.X = projVec.X * playerDist; - projectile.velocity.Y = projVec.Y * playerDist; + Projectile.velocity.X = projVec.X * playerDist; + Projectile.velocity.Y = projVec.Y * playerDist; } //Set projectile direction and rotation - if (projectile.velocity.X > 0.5f) + if (Projectile.velocity.X > 0.5f) { - projectile.direction = -1; + Projectile.direction = -1; } - else if (projectile.velocity.X < -0.5f) + else if (Projectile.velocity.X < -0.5f) { - projectile.direction = 1; + Projectile.direction = 1; } - projectile.spriteDirection = projectile.direction; - projectile.rotation = projectile.velocity.X * 0.05f; + Projectile.spriteDirection = Projectile.direction; + Projectile.rotation = Projectile.velocity.X * 0.05f; return; } //If too far, return to the player if (playerDist > 200f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } //Set projectile direction and rotation - if (projectile.velocity.X > 0.5f) + if (Projectile.velocity.X > 0.5f) { - projectile.direction = -1; + Projectile.direction = -1; } - else if (projectile.velocity.X < -0.5f) + else if (Projectile.velocity.X < -0.5f) { - projectile.direction = 1; + Projectile.direction = 1; } - projectile.spriteDirection = projectile.direction; + Projectile.spriteDirection = Projectile.direction; if (playerDist < 10f) { - projectile.velocity.X = projVec.X; - projectile.velocity.Y = projVec.Y; - projectile.rotation = projectile.velocity.X * 0.05f; + Projectile.velocity.X = projVec.X; + Projectile.velocity.Y = projVec.Y; + Projectile.rotation = Projectile.velocity.X * 0.05f; if (playerDist < projSpeed) { - projectile.position += projectile.velocity; - projectile.velocity *= 0f; + Projectile.position += Projectile.velocity; + Projectile.velocity *= 0f; idleMvt = 0f; } - projectile.direction = -player.direction; + Projectile.direction = -player.direction; } playerDist = projSpeed / playerDist; projVec.X *= playerDist; projVec.Y *= playerDist; - if (projectile.velocity.X < projVec.X) + if (Projectile.velocity.X < projVec.X) { - projectile.velocity.X += idleMvt; - if (projectile.velocity.X < 0f) + Projectile.velocity.X += idleMvt; + if (Projectile.velocity.X < 0f) { - projectile.velocity.X *= 0.99f; + Projectile.velocity.X *= 0.99f; } } - if (projectile.velocity.X > projVec.X) + if (Projectile.velocity.X > projVec.X) { - projectile.velocity.X -= idleMvt; - if (projectile.velocity.X > 0f) + Projectile.velocity.X -= idleMvt; + if (Projectile.velocity.X > 0f) { - projectile.velocity.X *= 0.99f; + Projectile.velocity.X *= 0.99f; } } - if (projectile.velocity.Y < projVec.Y) + if (Projectile.velocity.Y < projVec.Y) { - projectile.velocity.Y += idleMvt; - if (projectile.velocity.Y < 0f) + Projectile.velocity.Y += idleMvt; + if (Projectile.velocity.Y < 0f) { - projectile.velocity.Y *= 0.99f; + Projectile.velocity.Y *= 0.99f; } } - if (projectile.velocity.Y > projVec.Y) + if (Projectile.velocity.Y > projVec.Y) { - projectile.velocity.Y -= idleMvt; - if (projectile.velocity.Y > 0f) + Projectile.velocity.Y -= idleMvt; + if (Projectile.velocity.Y > 0f) { - projectile.velocity.Y *= 0.99f; + Projectile.velocity.Y *= 0.99f; } } //Rotation if moving - if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) + if (Projectile.velocity.X != 0f || Projectile.velocity.Y != 0f) { - projectile.rotation = projectile.velocity.X * 0.05f; + Projectile.rotation = Projectile.velocity.X * 0.05f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), Projectile.scale, spriteEffects, 0f); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/BendyPetGlow"); - int height = texture.Height / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Pets/BendyPetGlow"); + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; Color rainbow = CalamityUtils.MulticolorLerp(Main.GlobalTime / 2f % 1f, new Color[] { @@ -251,7 +251,7 @@ namespace CalamityMod.Projectiles.Pets new Color(255, 0, 255, 50), //Fuschia }); - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), rainbow, projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), rainbow, Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), Projectile.scale, spriteEffects, 0f); } } } diff --git a/Projectiles/Pets/BrimlingPet.cs b/Projectiles/Pets/BrimlingPet.cs index dac6e4c26f..72d56c8ced 100644 --- a/Projectiles/Pets/BrimlingPet.cs +++ b/Projectiles/Pets/BrimlingPet.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using System; @@ -11,26 +11,26 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Brimling"); - Main.projFrames[projectile.type] = 8; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 8; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 62; - projectile.height = 60; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; + Projectile.netImportant = true; + Projectile.width = 62; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } CalamityPlayer modPlayer = player.Calamity(); @@ -40,17 +40,17 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.brimling) { - projectile.timeLeft = 4; + Projectile.timeLeft = 4; } float num16 = 0.5f; - projectile.tileCollide = false; + Projectile.tileCollide = false; int num17 = 100; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num18 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; - float num19 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; + Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float num18 = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X; + float num19 = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y; num19 += (float)Main.rand.Next(-10, 21); num18 += (float)Main.rand.Next(-10, 21); - num18 += (float)(60 * -(float)Main.player[projectile.owner].direction); + num18 += (float)(60 * -(float)Main.player[Projectile.owner].direction); num19 -= 60f; float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); float num21 = 18f; @@ -60,29 +60,29 @@ namespace CalamityMod.Projectiles.Pets float num27 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); if (num27 > 1000f) { - projectile.position.X = projectile.position.X + num18; - projectile.position.Y = projectile.position.Y + num19; + Projectile.position.X = Projectile.position.X + num18; + Projectile.position.Y = Projectile.position.Y + num19; for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0, -1f, 0, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0, -1f, 0, default, 1f); } } - if (num20 < (float)num17 && Main.player[projectile.owner].velocity.Y == 0f && - projectile.position.Y + (float)projectile.height <= Main.player[projectile.owner].position.Y + (float)Main.player[projectile.owner].height && - !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (num20 < (float)num17 && Main.player[Projectile.owner].velocity.Y == 0f && + Projectile.position.Y + (float)Projectile.height <= Main.player[Projectile.owner].position.Y + (float)Main.player[Projectile.owner].height && + !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - if (projectile.velocity.Y < -6f) + Projectile.ai[0] = 0f; + if (Projectile.velocity.Y < -6f) { - projectile.velocity.Y = -6f; + Projectile.velocity.Y = -6f; } } if (num20 < 50f) { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f) { - projectile.velocity *= 0.90f; + Projectile.velocity *= 0.90f; } num16 = 0.01f; } @@ -102,79 +102,79 @@ namespace CalamityMod.Projectiles.Pets } //Les changements de velocité ici - if (projectile.velocity.X < num18) + if (Projectile.velocity.X < num18) { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) + Projectile.velocity.X = Projectile.velocity.X + num16; + if (num16 > 0.05f && Projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + num16; + Projectile.velocity.X = Projectile.velocity.X + num16; } } - if (projectile.velocity.X > num18) + if (Projectile.velocity.X > num18) { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) + Projectile.velocity.X = Projectile.velocity.X - num16; + if (num16 > 0.05f && Projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - num16; + Projectile.velocity.X = Projectile.velocity.X - num16; } } - if (projectile.velocity.Y < num19) + if (Projectile.velocity.Y < num19) { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num16; + if (num16 > 0.05f && Projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f; } } - if (projectile.velocity.Y > num19) + if (Projectile.velocity.Y > num19) { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num16; + if (num16 > 0.05f && Projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; } } - if ((double)projectile.velocity.X > 0.25) + if ((double)Projectile.velocity.X > 0.25) { - projectile.direction = -1; + Projectile.direction = -1; } - else if ((double)projectile.velocity.X < -0.25) + else if ((double)Projectile.velocity.X < -0.25) { - projectile.direction = 1; + Projectile.direction = 1; } //On gère le sprite et les frames ici - Player projOwner = Main.player[projectile.owner]; + Player projOwner = Main.player[Projectile.owner]; - projectile.spriteDirection = -projOwner.direction; - projectile.rotation = projectile.velocity.X * 0.03f; + Projectile.spriteDirection = -projOwner.direction; + Projectile.rotation = Projectile.velocity.X * 0.03f; - projectile.frameCounter++; + Projectile.frameCounter++; if (projOwner.statLife >= projOwner.statLifeMax2 / 4) { - if (projectile.frameCounter > 5) + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; return; } } else { - if (projectile.frameCounter > 5) + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 7) + if (Projectile.frame > 7) { - projectile.frame = 4; + Projectile.frame = 4; return; } } diff --git a/Projectiles/Pets/ChibiiDoggo.cs b/Projectiles/Pets/ChibiiDoggo.cs index 04838a9b6e..d6fc67cc77 100644 --- a/Projectiles/Pets/ChibiiDoggo.cs +++ b/Projectiles/Pets/ChibiiDoggo.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Pets { @@ -20,38 +21,38 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Chibii Devourer"); - Main.projFrames[projectile.type] = 11; //same as black cat - Main.projPet[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 11; //same as black cat + Main.projPet[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 38; - projectile.height = 46; - projectile.aiStyle = 26; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.scale = 0.8f; + Projectile.netImportant = true; + Projectile.width = 38; + Projectile.height = 46; + Projectile.aiStyle = 26; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.scale = 0.8f; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 1; - trueType = projectile.type; + trueType = Projectile.type; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); - Texture2D texture2D3 = ModContent.GetTexture("CalamityMod/Projectiles/Pets/ChibiiDoggoMonochrome"); - int num156 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num156 * projectile.frame; + Color color25 = Lighting.GetColor((int)(Projectile.Center.X / 16), (int)(Projectile.Center.Y / 16)); + Texture2D texture2D3 = ModContent.Request("CalamityMod/Projectiles/Pets/ChibiiDoggoMonochrome"); + int num156 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y3 = num156 * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num156); Vector2 origin2 = rectangle.Size() / 2f; int num157 = 8; @@ -63,7 +64,7 @@ namespace CalamityMod.Projectiles.Pets while ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) { Color color26 = color25; - color26 = projectile.GetAlpha(color26); + color26 = Projectile.GetAlpha(color26); goto IL_6899; IL_6881: num161 += num158; @@ -74,21 +75,21 @@ namespace CalamityMod.Projectiles.Pets { num164 = (float)(num159 - num161); } - color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value4 = projectile.oldPos[num161]; - float num165 = projectile.rotation; + color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + Vector2 value4 = Projectile.oldPos[num161]; + float num165 = Projectile.rotation; SpriteEffects effects = spriteEffects; - Main.spriteBatch.Draw(texture2D3, value4 + projectile.Size / 2f - Main.screenPosition + new Vector2(0, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + projectile.rotation * num160 * (float)(num161 - 1) * projectile.spriteDirection, origin2, projectile.scale, effects, 0f); + Main.spriteBatch.Draw(texture2D3, value4 + Projectile.Size / 2f - Main.screenPosition + new Vector2(0, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + Projectile.rotation * num160 * (float)(num161 - 1) * Projectile.spriteDirection, origin2, Projectile.scale, effects, 0f); goto IL_6881; } - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(Main.projectileTexture[Projectile.type], Projectile.position + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, origin2, Projectile.scale, spriteEffects, 0f); return false; } public override bool PreAI() { - projectile.type = 319; //tricks AI 26 into thinking this is a black cat, makes it act like black cat - Player player = Main.player[projectile.owner]; + Projectile.type = 319; //tricks AI 26 into thinking this is a black cat, makes it act like black cat + Player player = Main.player[Projectile.owner]; player.blackCat = false; //ensure doesnt interact weird with actual black cat return true; } @@ -100,13 +101,13 @@ namespace CalamityMod.Projectiles.Pets { yFlip = !yFlip; - if (yFlip && projectile.velocity.Y > 0) - projectile.position.Y -= projectile.velocity.Y; + if (yFlip && Projectile.velocity.Y > 0) + Projectile.position.Y -= Projectile.velocity.Y; } public void SpawnDoggo() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; string doggoType = "DevourerofGodsHead"; if (player.name == "Terry") @@ -120,18 +121,18 @@ namespace CalamityMod.Projectiles.Pets Main.NewText("Don't get cocky, kid!", Color.Cyan); } - int type = mod.NPCType(doggoType); + int type = Mod.Find(doggoType).Type; - int n = NPC.NewNPC((int)projectile.position.X, (int)projectile.position.Y, type); + int n = NPC.NewNPC((int)Projectile.position.X, (int)Projectile.position.Y, type); NetMessage.SendData(MessageID.SyncNPC, -1, -1, (NetworkText)null, n, 0.0f, 0.0f, 0.0f, 0, 0, 0); Main.npc[n].netUpdate = true; } public override void AI() { - projectile.type = trueType; //asserts real type after running black Cat AI 26 (ensures chibii pet isnt drawn as black cat and other weird stuff) + Projectile.type = trueType; //asserts real type after running black Cat AI 26 (ensures chibii pet isnt drawn as black cat and other weird stuff) - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { @@ -139,19 +140,19 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.chibii) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } //creates dust whenever switching between flying and grounded like when player spawns/despawns mount - if (previousCollide != projectile.tileCollide) + if (previousCollide != Projectile.tileCollide) { - previousCollide = projectile.tileCollide; + previousCollide = Projectile.tileCollide; for (int i = 0; i < 10; i++) //resets oldpos so trail doesn't "snap" to chibii from previous position after unhiding - projectile.oldPos[i] = projectile.position; + Projectile.oldPos[i] = Projectile.position; for (int i = 0; i < 77; i++) //loop to make lots of dust { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 182, projectile.velocity.X * 0.7f, projectile.velocity.Y * 0.7f, 100, default, 2.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 182, Projectile.velocity.X * 0.7f, Projectile.velocity.Y * 0.7f, 100, default, 2.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.5f; @@ -172,9 +173,9 @@ namespace CalamityMod.Projectiles.Pets } } - if (projectile.tileCollide) + if (Projectile.tileCollide) { - projectile.hide = false; + Projectile.hide = false; //if (projectile.extraUpdates == 1) PreventFastfall(); @@ -187,16 +188,16 @@ namespace CalamityMod.Projectiles.Pets } else { - projectile.hide = true; + Projectile.hide = true; //projectile.extraUpdates = 1; if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)projectile.identity); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Projectile.owner, (float)Projectile.identity); } //companion cube lighting check and stab Color color; - color = Lighting.GetColor((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16); + color = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16); Vector3 vector3_1 = color.ToVector3(); color = Lighting.GetColor((int)player.Center.X / 16, (int)player.Center.Y / 16); Vector3 vector3_2 = color.ToVector3(); @@ -219,18 +220,18 @@ namespace CalamityMod.Projectiles.Pets if (Main.rand.NextBool(2)) { int style = 5 + Main.rand.Next(5); - Main.PlaySound(SoundID.Meowmere, (int)projectile.position.X, (int)projectile.position.Y, style, 4f, 0.0f); //nya + SoundEngine.PlaySound(SoundID.Meowmere, (int)Projectile.position.X, (int)Projectile.position.Y, style, 4f, 0.0f); //nya } else { - Main.PlaySound(SoundID.Roar, (int)player.position.X, (int)player.position.Y, 2, 2f); //REEEEEEE + SoundEngine.PlaySound(SoundID.Roar, (int)player.position.X, (int)player.position.Y, 2, 2f); //REEEEEEE } notlocalai1 = -600f; } else { notlocalai1 = (float)(Main.rand.Next(30) * -10 - 300); - Main.PlaySound(SoundID.Item1, projectile.Center); + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); if (Main.rand.NextBool(2)) { player.Hurt(PlayerDeathReason.ByOther(6), 500, 0, false, false, false, -1); @@ -244,7 +245,7 @@ namespace CalamityMod.Projectiles.Pets if (Main.netMode != NetmodeID.MultiplayerClient) SpawnDoggo(); } - projectile.netUpdate = true; + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Pets/ChibiiDoggoFly.cs b/Projectiles/Pets/ChibiiDoggoFly.cs index a768c69c89..d889fd705a 100644 --- a/Projectiles/Pets/ChibiiDoggoFly.cs +++ b/Projectiles/Pets/ChibiiDoggoFly.cs @@ -11,34 +11,34 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Chibii Devourer (Flying)"); - Main.projPet[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projPet[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 24; - projectile.height = 46; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.scale = 0.8f; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; + Projectile.netImportant = true; + Projectile.width = 24; + Projectile.height = 46; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.scale = 0.8f; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 1; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); - Texture2D texture2D3 = ModContent.GetTexture("CalamityMod/Projectiles/Pets/ChibiiDoggoFlyMonochrome"); - int num156 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num156 * projectile.frame; + Color color25 = Lighting.GetColor((int)(Projectile.Center.X / 16), (int)(Projectile.Center.Y / 16)); + Texture2D texture2D3 = ModContent.Request("CalamityMod/Projectiles/Pets/ChibiiDoggoFlyMonochrome"); + int num156 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y3 = num156 * Projectile.frame; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num156); Vector2 origin2 = rectangle.Size() / 2f; int num157 = 12; @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Pets while ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) { Color color26 = color25; - color26 = projectile.GetAlpha(color26); + color26 = Projectile.GetAlpha(color26); goto IL_6899; IL_6881: num161 += num158; @@ -60,25 +60,25 @@ namespace CalamityMod.Projectiles.Pets { num164 = (float)(num159 - num161); } - color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value4 = projectile.oldPos[num161]; - float num165 = projectile.rotation; + color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[Projectile.type] * 1.5f); + Vector2 value4 = Projectile.oldPos[num161]; + float num165 = Projectile.rotation; SpriteEffects effects = spriteEffects; - Main.spriteBatch.Draw(texture2D3, value4 + projectile.Size / 2f - Main.screenPosition + new Vector2(0, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + projectile.rotation * num160 * (float)(num161 - 1) * projectile.spriteDirection, origin2, projectile.scale, effects, 0f); + Main.spriteBatch.Draw(texture2D3, value4 + Projectile.Size / 2f - Main.screenPosition + new Vector2(0, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + Projectile.rotation * num160 * (float)(num161 - 1) * Projectile.spriteDirection, origin2, Projectile.scale, effects, 0f); goto IL_6881; } - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(Main.projectileTexture[Projectile.type], Projectile.position + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, origin2, Projectile.scale, spriteEffects, 0f); return false; } public override bool PreAI() { //parent projectile might spawn more than one ChibiiDoggoFly sometimes - if (Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] > 1) + if (Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] > 1) { - projectile.hide = true; - projectile.Kill(); - Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()]--; + Projectile.hide = true; + Projectile.Kill(); + Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()]--; return false; } @@ -87,10 +87,10 @@ namespace CalamityMod.Projectiles.Pets public override void AI() { - if (Main.player[projectile.owner].Calamity().chibii) - projectile.timeLeft = 2; + if (Main.player[Projectile.owner].Calamity().chibii) + Projectile.timeLeft = 2; - int byUuid = (int)projectile.ai[0]; //contains identity of parent projectile in main.projectile array + int byUuid = (int)Projectile.ai[0]; //contains identity of parent projectile in main.projectile array //basically slaved to parent's position //this projectile only exists because i fucking hate that tile collision desync i got when using full-sized flying sprites in ChibiiDoggo @@ -98,14 +98,14 @@ namespace CalamityMod.Projectiles.Pets { //projectile.position.X = Main.projectile[byUuid].position.X - 22; //projectile.position.Y = Main.projectile[byUuid].position.Y; - projectile.Center = Main.projectile[byUuid].Center; - projectile.rotation = Main.projectile[byUuid].rotation; - projectile.spriteDirection = Main.projectile[byUuid].spriteDirection; + Projectile.Center = Main.projectile[byUuid].Center; + Projectile.rotation = Main.projectile[byUuid].rotation; + Projectile.spriteDirection = Main.projectile[byUuid].spriteDirection; if (Main.projectile[byUuid].tileCollide) - projectile.hide = true; + Projectile.hide = true; else - projectile.hide = false; + Projectile.hide = false; } } } diff --git a/Projectiles/Pets/DaawnlightSpiritOriginMinion.cs b/Projectiles/Pets/DaawnlightSpiritOriginMinion.cs index 594b17ec49..593a6b0a56 100644 --- a/Projectiles/Pets/DaawnlightSpiritOriginMinion.cs +++ b/Projectiles/Pets/DaawnlightSpiritOriginMinion.cs @@ -7,29 +7,29 @@ namespace CalamityMod.Projectiles.Pets { public class DaawnlightSpiritOriginMinion : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { DisplayName.SetDefault("Daawnlight"); - Main.projFrames[projectile.type] = 12; + Main.projFrames[Projectile.type] = 12; } public override void SetDefaults() { - projectile.width = 146; - projectile.height = 164; - projectile.netImportant = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 18000; - projectile.tileCollide = false; + Projectile.width = 146; + Projectile.height = 164; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 18000; + Projectile.tileCollide = false; } public override void AI() { if (!Owner.active) { - projectile.active = false; + Projectile.active = false; return; } HandlePetStuff(); @@ -42,38 +42,38 @@ namespace CalamityMod.Projectiles.Pets if (Owner.dead || !Owner.Calamity().spiritOrigin && !Owner.Calamity().spiritOriginVanity) Owner.Calamity().spiritOriginPet = false; if (Owner.Calamity().spiritOriginPet) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } public void DoMovement() { - if (projectile.WithinRange(Owner.Center, 100f)) - projectile.velocity *= 0.975f; + if (Projectile.WithinRange(Owner.Center, 100f)) + Projectile.velocity *= 0.975f; else { - float flySpeed = MathHelper.Clamp(11f + projectile.Distance(Owner.Center) * 0.015f, 11f, 25f); - projectile.velocity = projectile.velocity.MoveTowards(projectile.SafeDirectionTo(Owner.Center) * flySpeed, flySpeed * 0.02f); - if (!projectile.WithinRange(Owner.Center, 2200f)) + float flySpeed = MathHelper.Clamp(11f + Projectile.Distance(Owner.Center) * 0.015f, 11f, 25f); + Projectile.velocity = Projectile.velocity.MoveTowards(Projectile.SafeDirectionTo(Owner.Center) * flySpeed, flySpeed * 0.02f); + if (!Projectile.WithinRange(Owner.Center, 2200f)) { - projectile.Center = Owner.Center; - projectile.velocity = -Vector2.UnitY * 4f; - projectile.netUpdate = true; + Projectile.Center = Owner.Center; + Projectile.velocity = -Vector2.UnitY * 4f; + Projectile.netUpdate = true; } } - if (MathHelper.Distance(projectile.Center.X, Owner.Center.X) > 80f) - projectile.spriteDirection = (projectile.Center.X > Owner.Center.X).ToDirectionInt(); + if (MathHelper.Distance(Projectile.Center.X, Owner.Center.X) > 80f) + Projectile.spriteDirection = (Projectile.Center.X > Owner.Center.X).ToDirectionInt(); } public void HandleFrames() { if (Owner.Calamity().spiritOriginBullseyeShootCountdown > 0) - projectile.frame = (int)MathHelper.Lerp(5f, Main.projFrames[projectile.type] - 0.1f, 1f - Owner.Calamity().spiritOriginBullseyeShootCountdown / 45f); + Projectile.frame = (int)MathHelper.Lerp(5f, Main.projFrames[Projectile.type] - 0.1f, 1f - Owner.Calamity().spiritOriginBullseyeShootCountdown / 45f); else { - projectile.frameCounter++; - if (projectile.frameCounter % 7 == 6) - projectile.frame = (projectile.frame + 1) % 5; + Projectile.frameCounter++; + if (Projectile.frameCounter % 7 == 6) + Projectile.frame = (Projectile.frame + 1) % 5; } } diff --git a/Projectiles/Pets/DannyDevitoPet.cs b/Projectiles/Pets/DannyDevitoPet.cs index 7c62901f25..e4a22ce629 100644 --- a/Projectiles/Pets/DannyDevitoPet.cs +++ b/Projectiles/Pets/DannyDevitoPet.cs @@ -13,25 +13,25 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Danny Devito"); - Main.projFrames[projectile.type] = 8; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 8; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 42; - projectile.height = 42; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = true; + Projectile.netImportant = true; + Projectile.width = 42; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.tileCollide = true; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { - Player player = Main.player[projectile.owner]; - Vector2 center2 = projectile.Center; + Player player = Main.player[Projectile.owner]; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); fallThrough = playerDistance > 200f; @@ -40,10 +40,10 @@ namespace CalamityMod.Projectiles.Pets public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } CalamityPlayer modPlayer = player.Calamity(); @@ -53,114 +53,114 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.trashMan) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - Vector2 vector46 = projectile.position; + Vector2 vector46 = Projectile.position; if (!fly) { - projectile.rotation = 0; - Vector2 center2 = projectile.Center; + Projectile.rotation = 0; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); - if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) + if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X))) { - projectile.velocity.Y = -5f; + Projectile.velocity.Y = -5f; } - projectile.velocity.Y += 0.20f; - if (projectile.velocity.Y > 7f) + Projectile.velocity.Y += 0.20f; + if (Projectile.velocity.Y > 7f) { - projectile.velocity.Y = 7f; + Projectile.velocity.Y = 7f; } if (playerDistance > 600f) { fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - projectile.tileCollide = false; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 0f; + Projectile.tileCollide = false; } if (playerDistance > 100f) { - if (player.position.X - projectile.position.X > 0f) + if (player.position.X - Projectile.position.X > 0f) { - projectile.velocity.X += 0.10f; - if (projectile.velocity.X > 7f) + Projectile.velocity.X += 0.10f; + if (Projectile.velocity.X > 7f) { - projectile.velocity.X = 7f; + Projectile.velocity.X = 7f; } } else { - projectile.velocity.X -= 0.10f; - if (projectile.velocity.X < -7f) + Projectile.velocity.X -= 0.10f; + if (Projectile.velocity.X < -7f) { - projectile.velocity.X = -7f; + Projectile.velocity.X = -7f; } } } if (playerDistance < 100f) { - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - if (projectile.velocity.X > 0.5f) + if (Projectile.velocity.X > 0.5f) { - projectile.velocity.X -= 0.15f; + Projectile.velocity.X -= 0.15f; } - else if (projectile.velocity.X < -0.5f) + else if (Projectile.velocity.X < -0.5f) { - projectile.velocity.X += 0.15f; + Projectile.velocity.X += 0.15f; } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + else if (Projectile.velocity.X < 0.5f && Projectile.velocity.X > -0.5f) { - projectile.velocity.X = 0f; + Projectile.velocity.X = 0f; } } } - if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) + if (Projectile.position.X == Projectile.oldPosition.X && Projectile.position.Y == Projectile.oldPosition.Y && Projectile.velocity.X == 0) { - projectile.frame = 0; + Projectile.frame = 0; } - else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) + else if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y) { - projectile.frame = 1; - projectile.frameCounter = 0; + Projectile.frame = 1; + Projectile.frameCounter = 0; } else { - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 6) + if (Projectile.frame > 6) { - projectile.frame = 2; + Projectile.frame = 2; } - if (projectile.frame < 2) + if (Projectile.frame < 2) { - projectile.frame = 2; + Projectile.frame = 2; } } } else if (fly) { float num16 = 0.3f; - projectile.tileCollide = false; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float horiPos = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; - float vertiPos = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; + Projectile.tileCollide = false; + Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X; + float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y; vertiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)Main.rand.Next(-10, 21); - horiPos += (float)(60 * -(float)Main.player[projectile.owner].direction); + horiPos += (float)(60 * -(float)Main.player[Projectile.owner].direction); vertiPos -= 60f; float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); float num21 = 18f; float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); if (playerDistance > 1200f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (playerDistance < 100f) { @@ -173,17 +173,17 @@ namespace CalamityMod.Projectiles.Pets { playerStill = 0; } - if (playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerStill > 60 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { fly = false; - projectile.tileCollide = true; + Projectile.tileCollide = true; } } if (playerDistance < 50f) { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f) { - projectile.velocity *= 0.90f; + Projectile.velocity *= 0.90f; } num16 = 0.01f; } @@ -201,48 +201,48 @@ namespace CalamityMod.Projectiles.Pets horiPos *= playerDistance; vertiPos *= playerDistance; } - if (projectile.velocity.X <= horiPos) + if (Projectile.velocity.X <= horiPos) { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) + Projectile.velocity.X = Projectile.velocity.X + num16; + if (num16 > 0.05f && Projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + num16; + Projectile.velocity.X = Projectile.velocity.X + num16; } } - if (projectile.velocity.X > horiPos) + if (Projectile.velocity.X > horiPos) { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) + Projectile.velocity.X = Projectile.velocity.X - num16; + if (num16 > 0.05f && Projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - num16; + Projectile.velocity.X = Projectile.velocity.X - num16; } } - if (projectile.velocity.Y <= vertiPos) + if (Projectile.velocity.Y <= vertiPos) { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num16; + if (num16 > 0.05f && Projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f; } } - if (projectile.velocity.Y > vertiPos) + if (Projectile.velocity.Y > vertiPos) { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num16; + if (num16 > 0.05f && Projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; } } - projectile.rotation = projectile.velocity.X * 0.03f; - projectile.frame = 7; + Projectile.rotation = Projectile.velocity.X * 0.03f; + Projectile.frame = 7; } - if (projectile.velocity.X > 0.25f) + if (Projectile.velocity.X > 0.25f) { - projectile.spriteDirection = -1; + Projectile.spriteDirection = -1; } - else if (projectile.velocity.X < -0.25f) + else if (Projectile.velocity.X < -0.25f) { - projectile.spriteDirection = 1; + Projectile.spriteDirection = 1; } } @@ -296,12 +296,12 @@ namespace CalamityMod.Projectiles.Pets private bool HoleBelow() //pretty much the same as the one used in mantis { int tileWidth = 4; - int tileX = (int)(projectile.Center.X / 16f) - tileWidth; - if (projectile.velocity.X > 0) + int tileX = (int)(Projectile.Center.X / 16f) - tileWidth; + if (Projectile.velocity.X > 0) { tileX += tileWidth; } - int tileY = (int)((projectile.position.Y + projectile.height) / 16f); + int tileY = (int)((Projectile.position.Y + Projectile.height) / 16f); for (int y = tileY; y < tileY + 2; y++) { for (int x = tileX; x < tileX + tileWidth; x++) diff --git a/Projectiles/Pets/FlakPet.cs b/Projectiles/Pets/FlakPet.cs index 336a41b607..1b9ba903a8 100644 --- a/Projectiles/Pets/FlakPet.cs +++ b/Projectiles/Pets/FlakPet.cs @@ -15,25 +15,25 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Flak Hermit"); - Main.projFrames[projectile.type] = 7; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 7; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = true; + Projectile.netImportant = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.tileCollide = true; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { - Player player = Main.player[projectile.owner]; - Vector2 center2 = projectile.Center; + Player player = Main.player[Projectile.owner]; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); fallThrough = playerDistance > 200f; @@ -42,10 +42,10 @@ namespace CalamityMod.Projectiles.Pets public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } CalamityPlayer modPlayer = player.Calamity(); @@ -55,122 +55,122 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.flakPet) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - Vector2 vector46 = projectile.position; + Vector2 vector46 = Projectile.position; if (!fly) { - projectile.rotation = 0; - Vector2 center2 = projectile.Center; + Projectile.rotation = 0; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); - if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) + if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X))) { - projectile.velocity.Y = -5f; + Projectile.velocity.Y = -5f; } - projectile.velocity.Y += 0.20f; - if (projectile.velocity.Y > 7f) + Projectile.velocity.Y += 0.20f; + if (Projectile.velocity.Y > 7f) { - projectile.velocity.Y = 7f; + Projectile.velocity.Y = 7f; } if (playerDistance > 600f) { fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 0f; } if (playerDistance > 100f) { - if (player.position.X - projectile.position.X > 0f) + if (player.position.X - Projectile.position.X > 0f) { - projectile.velocity.X += 0.10f; - if (projectile.velocity.X > 7f) + Projectile.velocity.X += 0.10f; + if (Projectile.velocity.X > 7f) { - projectile.velocity.X = 7f; + Projectile.velocity.X = 7f; } } else { - projectile.velocity.X -= 0.10f; - if (projectile.velocity.X < -7f) + Projectile.velocity.X -= 0.10f; + if (Projectile.velocity.X < -7f) { - projectile.velocity.X = -7f; + Projectile.velocity.X = -7f; } } } if (playerDistance < 100f) { - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - if (projectile.velocity.X > 0.5f) + if (Projectile.velocity.X > 0.5f) { - projectile.velocity.X -= 0.15f; + Projectile.velocity.X -= 0.15f; } - else if (projectile.velocity.X < -0.5f) + else if (Projectile.velocity.X < -0.5f) { - projectile.velocity.X += 0.15f; + Projectile.velocity.X += 0.15f; } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + else if (Projectile.velocity.X < 0.5f && Projectile.velocity.X > -0.5f) { - projectile.velocity.X = 0f; + Projectile.velocity.X = 0f; } } } - if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) + if (Projectile.position.X == Projectile.oldPosition.X && Projectile.position.Y == Projectile.oldPosition.Y && Projectile.velocity.X == 0) { if (!hiding) { idleTimer++; - projectile.frame = 2; + Projectile.frame = 2; } if (idleTimer > 300) { hiding = true; - if (projectile.frame > 0) + if (Projectile.frame > 0) { - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame--; - projectile.frameCounter = 0; + Projectile.frame--; + Projectile.frameCounter = 0; } - if (projectile.frame < 0) + if (Projectile.frame < 0) { - projectile.frame = 0; + Projectile.frame = 0; } } } } - else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) + else if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y) { idleTimer = 0; hiding = false; - projectile.frame = 2; - projectile.frameCounter = 0; + Projectile.frame = 2; + Projectile.frameCounter = 0; } else { idleTimer = 0; hiding = false; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) + if (Projectile.frame > 5) { - projectile.frame = 2; + Projectile.frame = 2; } } } else if (fly) { float num16 = 0.3f; - projectile.tileCollide = false; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float horiPos = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; - float vertiPos = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; + Projectile.tileCollide = false; + Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X; + float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y; vertiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)(60 * -(float)player.direction); @@ -180,9 +180,9 @@ namespace CalamityMod.Projectiles.Pets float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); if (playerDistance > 1200f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (playerDistance < 100f) { @@ -195,17 +195,17 @@ namespace CalamityMod.Projectiles.Pets { playerStill = 0; } - if (playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerStill > 60 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { fly = false; - projectile.tileCollide = true; + Projectile.tileCollide = true; } } if (playerDistance < 50f) { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f) { - projectile.velocity *= 0.90f; + Projectile.velocity *= 0.90f; } num16 = 0.01f; } @@ -223,62 +223,62 @@ namespace CalamityMod.Projectiles.Pets horiPos *= playerDistance; vertiPos *= playerDistance; } - if (projectile.velocity.X <= horiPos) + if (Projectile.velocity.X <= horiPos) { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) + Projectile.velocity.X = Projectile.velocity.X + num16; + if (num16 > 0.05f && Projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + num16; + Projectile.velocity.X = Projectile.velocity.X + num16; } } - if (projectile.velocity.X > horiPos) + if (Projectile.velocity.X > horiPos) { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) + Projectile.velocity.X = Projectile.velocity.X - num16; + if (num16 > 0.05f && Projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - num16; + Projectile.velocity.X = Projectile.velocity.X - num16; } } - if (projectile.velocity.Y <= vertiPos) + if (Projectile.velocity.Y <= vertiPos) { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num16; + if (num16 > 0.05f && Projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f; } } - if (projectile.velocity.Y > vertiPos) + if (Projectile.velocity.Y > vertiPos) { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num16; + if (num16 > 0.05f && Projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; } } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * projectile.direction; - projectile.frame = 6; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; + Projectile.frame = 6; hiding = false; idleTimer = 0; } - if (projectile.velocity.X > 0.25f) + if (Projectile.velocity.X > 0.25f) { - projectile.spriteDirection = -1; + Projectile.spriteDirection = -1; } - else if (projectile.velocity.X < -0.25f) + else if (Projectile.velocity.X < -0.25f) { - projectile.spriteDirection = 1; + Projectile.spriteDirection = 1; } } private bool HoleBelow() //pretty much the same as the one used in mantis { int tileWidth = 4; - int tileX = (int)(projectile.Center.X / 16f) - tileWidth; - if (projectile.velocity.X > 0) + int tileX = (int)(Projectile.Center.X / 16f) - tileWidth; + if (Projectile.velocity.X > 0) { tileX += tileWidth; } - int tileY = (int)((projectile.position.Y + projectile.height) / 16f); + int tileY = (int)((Projectile.position.Y + Projectile.height) / 16f); for (int y = tileY; y < tileY + 2; y++) { for (int x = tileX; x < tileX + tileWidth; x++) diff --git a/Projectiles/Pets/FoxPet.cs b/Projectiles/Pets/FoxPet.cs index f42289fef6..9a791152f9 100644 --- a/Projectiles/Pets/FoxPet.cs +++ b/Projectiles/Pets/FoxPet.cs @@ -9,28 +9,28 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Fox"); - Main.projFrames[projectile.type] = 11; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 11; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 24; - projectile.height = 32; - projectile.friendly = true; - projectile.aiStyle = 26; + Projectile.netImportant = true; + Projectile.width = 24; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.aiStyle = 26; aiType = ProjectileID.Puppy; - projectile.penetrate = -1; - projectile.timeLeft *= 5; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } CalamityPlayer modPlayer = player.Calamity(); @@ -40,9 +40,9 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.fox) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - projectile.spriteDirection = projectile.direction; + Projectile.spriteDirection = Projectile.direction; } } } diff --git a/Projectiles/Pets/KendraPet.cs b/Projectiles/Pets/KendraPet.cs index 0fbba4d37a..e8ad5c1112 100644 --- a/Projectiles/Pets/KendraPet.cs +++ b/Projectiles/Pets/KendraPet.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Pets { public class KendraPet : ModProjectile @@ -17,25 +18,25 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Kendra"); - Main.projFrames[projectile.type] = 31; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 31; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 46; - projectile.height = 46; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = true; + Projectile.netImportant = true; + Projectile.width = 46; + Projectile.height = 46; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.tileCollide = true; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { - Player player = Main.player[projectile.owner]; - Vector2 center2 = projectile.Center; + Player player = Main.player[Projectile.owner]; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); fallThrough = playerDistance > 200f; @@ -44,10 +45,10 @@ namespace CalamityMod.Projectiles.Pets public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } CalamityPlayer modPlayer = player.Calamity(); @@ -57,138 +58,138 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.kendra) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - Vector2 vector46 = projectile.position; + Vector2 vector46 = Projectile.position; if (!fly) { - projectile.rotation = 0; - Vector2 center2 = projectile.Center; + Projectile.rotation = 0; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); - if (projectile.velocity.Y == 0f && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) + if (Projectile.velocity.Y == 0f && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X))) { - projectile.velocity.Y = -5f; + Projectile.velocity.Y = -5f; } - projectile.velocity.Y += 0.2f; - if (projectile.velocity.Y > 7f) + Projectile.velocity.Y += 0.2f; + if (Projectile.velocity.Y > 7f) { - projectile.velocity.Y = 7f; + Projectile.velocity.Y = 7f; } if (playerDistance > 600f) { fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - projectile.tileCollide = false; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 0f; + Projectile.tileCollide = false; } if (playerDistance > 100f) { - if (player.position.X - projectile.position.X > 0f) + if (player.position.X - Projectile.position.X > 0f) { - projectile.velocity.X += 0.1f; - if (projectile.velocity.X > 7f) + Projectile.velocity.X += 0.1f; + if (Projectile.velocity.X > 7f) { - projectile.velocity.X = 7f; + Projectile.velocity.X = 7f; } } else { - projectile.velocity.X -= 0.1f; - if (projectile.velocity.X < -7f) + Projectile.velocity.X -= 0.1f; + if (Projectile.velocity.X < -7f) { - projectile.velocity.X = -7f; + Projectile.velocity.X = -7f; } } } if (playerDistance < 100f) { - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - if (projectile.velocity.X > 0.5f) + if (Projectile.velocity.X > 0.5f) { - projectile.velocity.X -= 0.15f; + Projectile.velocity.X -= 0.15f; } - else if (projectile.velocity.X < -0.5f) + else if (Projectile.velocity.X < -0.5f) { - projectile.velocity.X += 0.15f; + Projectile.velocity.X += 0.15f; } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + else if (Projectile.velocity.X < 0.5f && Projectile.velocity.X > -0.5f) { - projectile.velocity.X = 0f; + Projectile.velocity.X = 0f; } } } - if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) + if (Projectile.position.X == Projectile.oldPosition.X && Projectile.position.Y == Projectile.oldPosition.Y && Projectile.velocity.X == 0) { - projectile.frameCounter++; + Projectile.frameCounter++; switch (chosenIdle) { case 1: if (idleTimer == 0) { - projectile.frame = 0; + Projectile.frame = 0; } idleTimer++; - if (projectile.frameCounter > 6) + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) + if (Projectile.frame > 4) { chosenIdle = 0; } - if (projectile.frame < 1) + if (Projectile.frame < 1) { - projectile.frame = 1; + Projectile.frame = 1; } break; case 2: if (idleTimer == 0) { - projectile.frame = 0; + Projectile.frame = 0; } idleTimer++; - if (projectile.frameCounter > 6) + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 13) + if (Projectile.frame > 13) { chosenIdle = 0; } - if (projectile.frame < 5) + if (Projectile.frame < 5) { - projectile.frame = 5; + Projectile.frame = 5; } break; case 3: if (idleTimer == 0) { - projectile.frame = 0; + Projectile.frame = 0; } idleTimer++; - if (projectile.frameCounter > 6) + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 24) + if (Projectile.frame > 24) { chosenIdle = 0; } - if (projectile.frame < 19) + if (Projectile.frame < 19) { - projectile.frame = 19; + Projectile.frame = 19; } break; } if (chosenIdle == 0) { - projectile.frame = 0; - projectile.frameCounter = 6; + Projectile.frame = 0; + Projectile.frameCounter = 6; idleTimer++; if (idleTimer > 360) { @@ -198,55 +199,55 @@ namespace CalamityMod.Projectiles.Pets idleBarkTimer++; if (idleBarkTimer > 1080 && Main.rand.NextBool(2)) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/KendraBark"), (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/KendraBark"), (int)Projectile.position.X, (int)Projectile.position.Y); chosenIdle = 3; idleBarkTimer = 0; idleTimer = 0; } } } - else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) + else if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y) { - projectile.frame = 16; - projectile.frameCounter = 0; + Projectile.frame = 16; + Projectile.frameCounter = 0; } else { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 18) + if (Projectile.frame > 18) { - projectile.frame = 14; + Projectile.frame = 14; } - if (projectile.frame < 14) + if (Projectile.frame < 14) { - projectile.frame = 14; + Projectile.frame = 14; } } } else if (fly) { float num16 = 0.3f; - projectile.tileCollide = false; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float horiPos = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; - float vertiPos = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; + Projectile.tileCollide = false; + Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X; + float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y; vertiPos += (float)Main.rand.Next(-10, 21); horiPos += (float)Main.rand.Next(-10, 21); - horiPos += (float)(60 * -(float)Main.player[projectile.owner].direction); + horiPos += (float)(60 * -(float)Main.player[Projectile.owner].direction); vertiPos -= 60f; float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); float num21 = 18.5f; float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); if (playerDistance > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (playerDistance < 100f) { @@ -259,17 +260,17 @@ namespace CalamityMod.Projectiles.Pets { playerStill = 0; } - if (playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerStill > 60 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { fly = false; - projectile.tileCollide = true; + Projectile.tileCollide = true; } } if (playerDistance < 50f) { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f) { - projectile.velocity *= 0.9f; + Projectile.velocity *= 0.9f; } num16 = 0.01f; } @@ -287,83 +288,83 @@ namespace CalamityMod.Projectiles.Pets horiPos *= playerDistance; vertiPos *= playerDistance; } - if (projectile.velocity.X <= horiPos) + if (Projectile.velocity.X <= horiPos) { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) + Projectile.velocity.X = Projectile.velocity.X + num16; + if (num16 > 0.05f && Projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + num16; + Projectile.velocity.X = Projectile.velocity.X + num16; } } - if (projectile.velocity.X > horiPos) + if (Projectile.velocity.X > horiPos) { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) + Projectile.velocity.X = Projectile.velocity.X - num16; + if (num16 > 0.05f && Projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - num16; + Projectile.velocity.X = Projectile.velocity.X - num16; } } - if (projectile.velocity.Y <= vertiPos) + if (Projectile.velocity.Y <= vertiPos) { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num16; + if (num16 > 0.05f && Projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f; } } - if (projectile.velocity.Y > vertiPos) + if (Projectile.velocity.Y > vertiPos) { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num16; + if (num16 > 0.05f && Projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; } } - projectile.rotation = projectile.velocity.X * 0.015f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.rotation = Projectile.velocity.X * 0.015f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 30) + if (Projectile.frame > 30) { - projectile.frame = 25; + Projectile.frame = 25; } - if (projectile.frame < 25) + if (Projectile.frame < 25) { - projectile.frame = 25; + Projectile.frame = 25; } } - if (projectile.velocity.X > 0.25f) + if (Projectile.velocity.X > 0.25f) { - projectile.spriteDirection = -1; + Projectile.spriteDirection = -1; } - else if (projectile.velocity.X < -0.25f) + else if (Projectile.velocity.X < -0.25f) { - projectile.spriteDirection = 1; + Projectile.spriteDirection = 1; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, spriteEffects, 0f); return false; } private bool HoleBelow() { int tileWidth = 4; - int tileX = (int)(projectile.Center.X / 16f) - tileWidth; - if (projectile.velocity.X > 0) + int tileX = (int)(Projectile.Center.X / 16f) - tileWidth; + if (Projectile.velocity.X > 0) { tileX += tileWidth; } - int tileY = (int)((projectile.position.Y + projectile.height) / 16f); + int tileY = (int)((Projectile.position.Y + Projectile.height) / 16f); for (int y = tileY; y < tileY + 2; y++) { for (int x = tileX; x < tileX + tileWidth; x++) diff --git a/Projectiles/Pets/LadShark.cs b/Projectiles/Pets/LadShark.cs index bed4347013..8b0138ca01 100644 --- a/Projectiles/Pets/LadShark.cs +++ b/Projectiles/Pets/LadShark.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Pets { public class LadShark : ModProjectile @@ -11,28 +12,28 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Lad Shark"); - Main.projPet[projectile.type] = true; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.aiStyle = 26; + Projectile.netImportant = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.aiStyle = 26; aiType = ProjectileID.BabySkeletronHead; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } if (player.dead) @@ -41,14 +42,14 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.ladShark) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; //occasionally burst in hearts if (Main.rand.NextBool(10000)) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { int heartCount = Main.rand.Next(20, 31); for (int i = 0; i < heartCount; i++) @@ -56,18 +57,18 @@ namespace CalamityMod.Projectiles.Pets Vector2 velocity = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); velocity.Normalize(); velocity.X *= 0.66f; - int heart = Gore.NewGore(projectile.Center, velocity * Main.rand.NextFloat(3f, 5f) * 0.33f, 331, Main.rand.NextFloat(40f, 120f) * 0.01f); + int heart = Gore.NewGore(Projectile.Center, velocity * Main.rand.NextFloat(3f, 5f) * 0.33f, 331, Main.rand.NextFloat(40f, 120f) * 0.01f); Main.gore[heart].sticky = false; Main.gore[heart].velocity *= 5f; } - Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 15); //mouse squeak sound + SoundEngine.PlaySound(SoundID.Zombie, (int)Projectile.position.X, (int)Projectile.position.Y, 15); //mouse squeak sound float radius = 240f; // 15 blocks for (int j = 0; j < Main.maxNPCs; j++) { NPC npc = Main.npc[j]; - if (npc.active && !npc.dontTakeDamage && Vector2.Distance(projectile.Center, npc.Center) <= radius) + if (npc.active && !npc.dontTakeDamage && Vector2.Distance(Projectile.Center, npc.Center) <= radius) { if (npc.Calamity().ladHearts <= 0) npc.Calamity().ladHearts = CalamityUtils.SecondsToFrames(9f); @@ -76,7 +77,7 @@ namespace CalamityMod.Projectiles.Pets for (int k = 0; k < Main.maxPlayers; k++) { Player players = Main.player[k]; - if (!players.dead && Vector2.Distance(projectile.Center, players.Center) <= radius) + if (!players.dead && Vector2.Distance(Projectile.Center, players.Center) <= radius) { if (players.Calamity().ladHearts <= 0) players.Calamity().ladHearts = CalamityUtils.SecondsToFrames(9f); diff --git a/Projectiles/Pets/LeviPet.cs b/Projectiles/Pets/LeviPet.cs index 53020c9a74..dca47de5c6 100644 --- a/Projectiles/Pets/LeviPet.cs +++ b/Projectiles/Pets/LeviPet.cs @@ -8,27 +8,27 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Levi"); - Main.projFrames[projectile.type] = 5; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; + Projectile.netImportant = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } if (player.dead) @@ -37,18 +37,18 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.leviPet) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - projectile.FloatingPetAI(false, 0.05f); - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.FloatingPetAI(false, 0.05f); + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) + if (Projectile.frame > 4) { - projectile.frame = 0; + Projectile.frame = 0; } } } diff --git a/Projectiles/Pets/LittleLightProj.cs b/Projectiles/Pets/LittleLightProj.cs index 949f2c7e4d..4e66805fea 100644 --- a/Projectiles/Pets/LittleLightProj.cs +++ b/Projectiles/Pets/LittleLightProj.cs @@ -8,24 +8,24 @@ namespace CalamityMod.Projectiles.Pets { public class LittleLightProj : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public Color LightColor => new Color(160, 251, 255); - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Little Light"); - Main.projFrames[projectile.type] = 9; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.LightPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 9; + Main.projPet[Projectile.type] = true; + ProjectileID.Sets.LightPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 24; - projectile.friendly = true; - projectile.netImportant = true; - projectile.penetrate = -1; + Projectile.width = Projectile.height = 24; + Projectile.friendly = true; + Projectile.netImportant = true; + Projectile.penetrate = -1; } public override void AI() @@ -38,11 +38,11 @@ namespace CalamityMod.Projectiles.Pets HoverTowardsOwnersShoulder(); // Look in the same direction as the projectile's owner. - projectile.spriteDirection = Owner.direction; + Projectile.spriteDirection = Owner.direction; // Emit light. // Suspicious Looking Tentacle uses 1.5f as a brightness factor, for reference. - Lighting.AddLight(projectile.Center, LightColor.ToVector3() * 2.5f); + Lighting.AddLight(Projectile.Center, LightColor.ToVector3() * 2.5f); Time++; } @@ -52,31 +52,31 @@ namespace CalamityMod.Projectiles.Pets // No logic should be run if the player is no longer active in the game. if (!Owner.active) { - projectile.Kill(); + Projectile.Kill(); return true; } if (Owner.dead) Owner.Calamity().littleLightPet = false; if (Owner.Calamity().littleLightPet) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; return false; } public void HandleFrames() { - projectile.frameCounter++; - projectile.frame = projectile.frameCounter / 5 % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; } public void DoSpinEffect() { // Spin around from time to time. - if (projectile.frameCounter % 180f > 150f) - projectile.rotation += MathHelper.TwoPi / 30f; + if (Projectile.frameCounter % 180f > 150f) + Projectile.rotation += MathHelper.TwoPi / 30f; else - projectile.rotation = 0f; + Projectile.rotation = 0f; } public void HoverTowardsOwnersShoulder() @@ -88,13 +88,13 @@ namespace CalamityMod.Projectiles.Pets // Hover in the air a little bit over time so that the pet doesn't seem static. destination.Y += (float)Math.Sin(MathHelper.TwoPi * Time / 45f) * 5f; - projectile.Center = Vector2.Lerp(projectile.Center, destination, 0.125f); - if (projectile.WithinRange(destination, 10f)) - projectile.Center = destination; + Projectile.Center = Vector2.Lerp(Projectile.Center, destination, 0.125f); + if (Projectile.WithinRange(destination, 10f)) + Projectile.Center = destination; else - projectile.Center += projectile.SafeDirectionTo(destination) * 4f; + Projectile.Center += Projectile.SafeDirectionTo(destination) * 4f; - projectile.Center = destination; + Projectile.Center = destination; } } } diff --git a/Projectiles/Pets/MiniHiveMind.cs b/Projectiles/Pets/MiniHiveMind.cs index 189f06d29e..989502a1e4 100644 --- a/Projectiles/Pets/MiniHiveMind.cs +++ b/Projectiles/Pets/MiniHiveMind.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Pets { public class MiniHiveMind : ModProjectile @@ -14,38 +15,38 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Mini Hive Mind"); - Main.projFrames[projectile.type] = 16; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 16; + Main.projPet[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 38; - projectile.height = 44; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = false; + Projectile.netImportant = true; + Projectile.width = 38; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } //Delete the projectile if the player doesnt have the buff if (!player.HasBuff(ModContent.BuffType())) { - projectile.Kill(); + Projectile.Kill(); } if (player.dead) @@ -54,13 +55,13 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.hiveMindPet) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } if (charging <= 0) - projectile.FloatingPetAI(true, 0.05f); + Projectile.FloatingPetAI(true, 0.05f); - Vector2 playerVec = player.Center - projectile.Center; + Vector2 playerVec = player.Center - Projectile.Center; float playerDist = playerVec.Length(); if (reelBackCooldown > 0) reelBackCooldown--; @@ -68,47 +69,47 @@ namespace CalamityMod.Projectiles.Pets charging--; if (reelBackCooldown <= 0 && Main.rand.NextBool(500) && playerDist < 100f && charging <= 0) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { //Do a backwards charge away from the player reelBackCooldown = 300; playerVec.Normalize(); - projectile.velocity = playerVec * 8f; + Projectile.velocity = playerVec * 8f; charging = 50; - Main.PlaySound(SoundID.ForceRoar, (int)projectile.Center.X, (int)projectile.Center.Y, -1, 0.5f, 0f); - projectile.netUpdate = true; + SoundEngine.PlaySound(SoundID.ForceRoar, (int)Projectile.Center.X, (int)Projectile.Center.Y, -1, 0.5f, 0f); + Projectile.netUpdate = true; } } if (charging < 22 && charging > 0) - projectile.alpha += 12; + Projectile.alpha += 12; if (charging == 1) { float xOffset = Main.rand.NextFloat(400f, 600f) * (Main.rand.NextBool() ? -1f : 1f); float yOffset = Main.rand.NextFloat(400f, 600f) * (Main.rand.NextBool() ? -1f : 1f); Vector2 teleportPos = new Vector2(player.Center.X + xOffset, player.Center.Y + yOffset); - projectile.Center = teleportPos; - projectile.alpha = 255; - projectile.netUpdate = true; + Projectile.Center = teleportPos; + Projectile.alpha = 255; + Projectile.netUpdate = true; } - if (projectile.alpha > 0 && charging <= 0) - projectile.alpha -= 12; - if (projectile.alpha < 0) - projectile.alpha = 0; - if (projectile.alpha > 255) - projectile.alpha = 255; + if (Projectile.alpha > 0 && charging <= 0) + Projectile.alpha -= 12; + if (Projectile.alpha < 0) + Projectile.alpha = 0; + if (Projectile.alpha > 255) + Projectile.alpha = 255; if (charging > 0) { - projectile.rotation.AngleTowards(0f, 0.1f); + Projectile.rotation.AngleTowards(0f, 0.1f); } //Animation - if (projectile.frameCounter++ % 6 == 0) + if (Projectile.frameCounter++ % 6 == 0) { - projectile.frame++; + Projectile.frame++; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } } } diff --git a/Projectiles/Pets/PerforaMini.cs b/Projectiles/Pets/PerforaMini.cs index 2afef314b0..f52db570bd 100644 --- a/Projectiles/Pets/PerforaMini.cs +++ b/Projectiles/Pets/PerforaMini.cs @@ -10,37 +10,37 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Perforamini"); - Main.projFrames[projectile.type] = 8; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 8; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = false; + Projectile.netImportant = true; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; - Vector2 perfcenter = projectile.Center; + Player player = Main.player[Projectile.owner]; + Vector2 perfcenter = Projectile.Center; Vector2 vectorperf = player.Center - perfcenter; float playerdistance = vectorperf.Length(); if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } //Delete the projectile if the player doesnt have the buff or is very far away (dunno if this needs to be deleted) if (!player.HasBuff(ModContent.BuffType()) || playerdistance >= 4000f) { - projectile.Kill(); + Projectile.Kill(); } CalamityPlayer modPlayer = player.Calamity(); @@ -50,31 +50,31 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.perfmini) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - projectile.FloatingPetAI(true, 0.1f); + Projectile.FloatingPetAI(true, 0.1f); //Dust if (Main.rand.NextBool(50)) { - int d1 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.5f); - int d2 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 170, 0f, 0f, 170, default, 0.5f); + int d1 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.5f); + int d2 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 170, 0f, 0f, 170, default, 0.5f); Main.dust[d2].noLight = true; - Main.dust[d1].position = projectile.Center; - Main.dust[d2].position = projectile.Center; + Main.dust[d1].position = Projectile.Center; + Main.dust[d2].position = Projectile.Center; } //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) + if (Projectile.frame > 5) { - projectile.frame = 0; + Projectile.frame = 0; } } } diff --git a/Projectiles/Pets/PineapplePetProj.cs b/Projectiles/Pets/PineapplePetProj.cs index 0bd8650953..59619f7f3d 100644 --- a/Projectiles/Pets/PineapplePetProj.cs +++ b/Projectiles/Pets/PineapplePetProj.cs @@ -9,27 +9,27 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Pineapple"); - Main.projFrames[projectile.type] = 5; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; + Projectile.netImportant = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } if (player.dead) @@ -38,43 +38,43 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.pineapplePet) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; - projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frameCounter = 0; } float passiveMvtFloat = 0.1f; - projectile.tileCollide = false; + Projectile.tileCollide = false; float range = 200f; - float xDist = player.Center.X - projectile.Center.X - 2f; - float yDist = player.Center.Y - projectile.Center.Y - 60f; + float xDist = player.Center.X - Projectile.Center.X - 2f; + float yDist = player.Center.Y - Projectile.Center.Y - 60f; Vector2 playerVector = new Vector2(xDist, yDist); float playerDist = playerVector.Length(); float returnSpeed = 7f; - if (playerDist < range && player.velocity.Y == 0f && (projectile.position.Y + projectile.height <= player.position.Y + player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height))) + if (playerDist < range && player.velocity.Y == 0f && (Projectile.position.Y + Projectile.height <= player.position.Y + player.height && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height))) { - projectile.ai[0] = 0f; - if (projectile.velocity.Y < -6f) - projectile.velocity.Y = -6f; + Projectile.ai[0] = 0f; + if (Projectile.velocity.Y < -6f) + Projectile.velocity.Y = -6f; } //Teleport to player if too far if (playerDist > 2000f) { - projectile.position.X = player.Center.X - projectile.width / 2; - projectile.position.Y = player.Center.Y - projectile.height / 2; - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - Projectile.width / 2; + Projectile.position.Y = player.Center.Y - Projectile.height / 2; + Projectile.netUpdate = true; } if (playerDist < 4f) { - projectile.velocity.X = xDist; - projectile.velocity.Y = yDist; + Projectile.velocity.X = xDist; + Projectile.velocity.Y = yDist; passiveMvtFloat = 0f; } else @@ -88,33 +88,33 @@ namespace CalamityMod.Projectiles.Pets xDist *= speedMult; yDist *= speedMult; } - if (projectile.velocity.X < xDist) + if (Projectile.velocity.X < xDist) { - projectile.velocity.X += passiveMvtFloat; - if (projectile.velocity.X < 0f) - projectile.velocity.X += passiveMvtFloat; + Projectile.velocity.X += passiveMvtFloat; + if (Projectile.velocity.X < 0f) + Projectile.velocity.X += passiveMvtFloat; } - if (projectile.velocity.X > xDist) + if (Projectile.velocity.X > xDist) { - projectile.velocity.X -= passiveMvtFloat; - if (projectile.velocity.X > 0f) - projectile.velocity.X -= passiveMvtFloat; + Projectile.velocity.X -= passiveMvtFloat; + if (Projectile.velocity.X > 0f) + Projectile.velocity.X -= passiveMvtFloat; } - if (projectile.velocity.Y < yDist) + if (Projectile.velocity.Y < yDist) { - projectile.velocity.Y += passiveMvtFloat; - if (projectile.velocity.Y < 0f) - projectile.velocity.Y += passiveMvtFloat; + Projectile.velocity.Y += passiveMvtFloat; + if (Projectile.velocity.Y < 0f) + Projectile.velocity.Y += passiveMvtFloat; } - if (projectile.velocity.Y > yDist) + if (Projectile.velocity.Y > yDist) { - projectile.velocity.Y -= passiveMvtFloat; - if (projectile.velocity.Y > 0f) - projectile.velocity.Y -= passiveMvtFloat; + Projectile.velocity.Y -= passiveMvtFloat; + if (Projectile.velocity.Y > 0f) + Projectile.velocity.Y -= passiveMvtFloat; } - projectile.direction = -player.direction; - projectile.spriteDirection = 1; - projectile.rotation = projectile.velocity.Y * 0.05f * -projectile.direction; + Projectile.direction = -player.direction; + Projectile.spriteDirection = 1; + Projectile.rotation = Projectile.velocity.Y * 0.05f * -Projectile.direction; } } } diff --git a/Projectiles/Pets/PlaguebringerBab.cs b/Projectiles/Pets/PlaguebringerBab.cs index a7c711188b..1f78bb307e 100644 --- a/Projectiles/Pets/PlaguebringerBab.cs +++ b/Projectiles/Pets/PlaguebringerBab.cs @@ -8,27 +8,27 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Plaguebringer Bab"); - Main.projFrames[projectile.type] = 4; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; + Projectile.netImportant = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } if (player.dead) @@ -37,18 +37,18 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.plaguebringerBab) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - projectile.FloatingPetAI(false, 0.05f); - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.FloatingPetAI(false, 0.05f); + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 2; + Projectile.frame = 2; } } } diff --git a/Projectiles/Pets/RadiatorPet.cs b/Projectiles/Pets/RadiatorPet.cs index 7d7ea67050..933b23751a 100644 --- a/Projectiles/Pets/RadiatorPet.cs +++ b/Projectiles/Pets/RadiatorPet.cs @@ -12,26 +12,26 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Radiator"); - Main.projFrames[projectile.type] = 4; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.LightPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + Main.projPet[Projectile.type] = true; + ProjectileID.Sets.LightPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 34; - projectile.height = 22; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = true; + Projectile.netImportant = true; + Projectile.width = 34; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.tileCollide = true; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { - Player player = Main.player[projectile.owner]; - Vector2 center2 = projectile.Center; + Player player = Main.player[Projectile.owner]; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); fallThrough = playerDistance > 200f; @@ -40,10 +40,10 @@ namespace CalamityMod.Projectiles.Pets public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } CalamityPlayer modPlayer = player.Calamity(); @@ -53,121 +53,121 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.radiator) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) + if (Projectile.position.X == Projectile.oldPosition.X && Projectile.position.Y == Projectile.oldPosition.Y && Projectile.velocity.X == 0) { - projectile.frame = 0; + Projectile.frame = 0; } - else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) + else if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y) { - projectile.frame = 1; - projectile.frameCounter = 0; + Projectile.frame = 1; + Projectile.frameCounter = 0; } else { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } - Lighting.AddLight(projectile.Center, 0.4f, 1f, 0.5f); - Vector2 vector46 = projectile.position; + Lighting.AddLight(Projectile.Center, 0.4f, 1f, 0.5f); + Vector2 vector46 = Projectile.position; if (!fly) { - projectile.rotation = 0; - Vector2 center2 = projectile.Center; + Projectile.rotation = 0; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); - if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) + if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X))) { - projectile.velocity.Y = -5f; + Projectile.velocity.Y = -5f; } - projectile.velocity.Y += 0.20f; - if (projectile.velocity.Y > 7f) + Projectile.velocity.Y += 0.20f; + if (Projectile.velocity.Y > 7f) { - projectile.velocity.Y = 7f; + Projectile.velocity.Y = 7f; } if (playerDistance > 600f) { fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 0f; } if (playerDistance > 100f) { - if (player.position.X - projectile.position.X > 0f) + if (player.position.X - Projectile.position.X > 0f) { - projectile.velocity.X += 0.10f; - if (projectile.velocity.X > 7f) + Projectile.velocity.X += 0.10f; + if (Projectile.velocity.X > 7f) { - projectile.velocity.X = 7f; + Projectile.velocity.X = 7f; } } else { - projectile.velocity.X -= 0.10f; - if (projectile.velocity.X < -7f) + Projectile.velocity.X -= 0.10f; + if (Projectile.velocity.X < -7f) { - projectile.velocity.X = -7f; + Projectile.velocity.X = -7f; } } } if (playerDistance < 100f) { - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - if (projectile.velocity.X > 0.5f) + if (Projectile.velocity.X > 0.5f) { - projectile.velocity.X -= 0.15f; + Projectile.velocity.X -= 0.15f; } - else if (projectile.velocity.X < -0.5f) + else if (Projectile.velocity.X < -0.5f) { - projectile.velocity.X += 0.15f; + Projectile.velocity.X += 0.15f; } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + else if (Projectile.velocity.X < 0.5f && Projectile.velocity.X > -0.5f) { - projectile.velocity.X = 0f; + Projectile.velocity.X = 0f; } } } } else if (fly) { - projectile.alpha += 15; - if (projectile.alpha >= 255) + Projectile.alpha += 15; + if (Projectile.alpha >= 255) { - projectile.position.X = player.position.X; - projectile.position.Y = player.position.Y; + Projectile.position.X = player.position.X; + Projectile.position.Y = player.position.Y; fly = false; - projectile.alpha = 0; + Projectile.alpha = 0; } } - if (projectile.velocity.X > 0.25f) + if (Projectile.velocity.X > 0.25f) { - projectile.spriteDirection = -1; + Projectile.spriteDirection = -1; } - else if (projectile.velocity.X < -0.25f) + else if (Projectile.velocity.X < -0.25f) { - projectile.spriteDirection = 1; + Projectile.spriteDirection = 1; } } private bool HoleBelow() //pretty much the same as the one used in mantis { int tileWidth = 4; - int tileX = (int)(projectile.Center.X / 16f) - tileWidth; - if (projectile.velocity.X > 0) + int tileX = (int)(Projectile.Center.X / 16f) - tileWidth; + if (Projectile.velocity.X > 0) { tileX += tileWidth; } - int tileY = (int)((projectile.position.Y + projectile.height) / 16f); + int tileY = (int)((Projectile.position.Y + Projectile.height) / 16f); for (int y = tileY; y < tileY + 2; y++) { for (int x = tileX; x < tileX + tileWidth; x++) diff --git a/Projectiles/Pets/RotomPet.cs b/Projectiles/Pets/RotomPet.cs index 14d9c52ae6..d008a97165 100644 --- a/Projectiles/Pets/RotomPet.cs +++ b/Projectiles/Pets/RotomPet.cs @@ -20,27 +20,27 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Rotom"); - Main.projFrames[projectile.type] = 4; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; + Projectile.netImportant = true; + Projectile.width = Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } if (player.dead) @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.rotomPet) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } if (!initialized) @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Pets UpdateForm(player); UpdateFrames(); - projectile.FloatingPetAI(true, 0.05f); + Projectile.FloatingPetAI(true, 0.05f); } private void UpdateForm(Player player) @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Pets int dustAmt = 25; for (int i = 0; i < dustAmt; i++) { - int electric = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 132, 0f, 0f, 0, default, 1f); + int electric = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 132, 0f, 0f, 0, default, 1f); Main.dust[electric].velocity *= 2f; Main.dust[electric].scale *= 1.15f; } @@ -95,41 +95,41 @@ namespace CalamityMod.Projectiles.Pets private void UpdateFrames() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Drawing(spriteBatch, lightColor, - Main.projectileTexture[projectile.type], - ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomDex"), - ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomWash"), - ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomHeat"), - ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomFrost"), - ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomMow"), - ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomFan")); + Main.projectileTexture[Projectile.type], + ModContent.Request("CalamityMod/Projectiles/Pets/RotomDex"), + ModContent.Request("CalamityMod/Projectiles/Pets/RotomWash"), + ModContent.Request("CalamityMod/Projectiles/Pets/RotomHeat"), + ModContent.Request("CalamityMod/Projectiles/Pets/RotomFrost"), + ModContent.Request("CalamityMod/Projectiles/Pets/RotomMow"), + ModContent.Request("CalamityMod/Projectiles/Pets/RotomFan")); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Drawing(spriteBatch, Color.White, - ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomPetGlow"), - ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomDexGlow"), - ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomWashGlow"), - ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomHeatGlow"), - ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomFrostGlow"), - ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomMowGlow"), - ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomFanGlow")); + ModContent.Request("CalamityMod/Projectiles/Pets/RotomPetGlow"), + ModContent.Request("CalamityMod/Projectiles/Pets/RotomDexGlow"), + ModContent.Request("CalamityMod/Projectiles/Pets/RotomWashGlow"), + ModContent.Request("CalamityMod/Projectiles/Pets/RotomHeatGlow"), + ModContent.Request("CalamityMod/Projectiles/Pets/RotomFrostGlow"), + ModContent.Request("CalamityMod/Projectiles/Pets/RotomMowGlow"), + ModContent.Request("CalamityMod/Projectiles/Pets/RotomFanGlow")); } private void Drawing(SpriteBatch spriteBatch, Color color, Texture2D normal, Texture2D dex, Texture2D wash, Texture2D heat, Texture2D frost, Texture2D mow, Texture2D fan) @@ -159,13 +159,13 @@ namespace CalamityMod.Projectiles.Pets break; } - int height = texture.Height / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), color, projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), color, Projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), Projectile.scale, spriteEffects, 0f); } public override bool CanDamage() => false; diff --git a/Projectiles/Pets/SCalPet.cs b/Projectiles/Pets/SCalPet.cs index 0dc380c706..754dd2109b 100644 --- a/Projectiles/Pets/SCalPet.cs +++ b/Projectiles/Pets/SCalPet.cs @@ -9,27 +9,27 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Supreme Calamitas"); - Main.projFrames[projectile.type] = 6; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; + Projectile.netImportant = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } if (player.dead) @@ -38,15 +38,15 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.scalPet) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - projectile.FloatingPetAI(false, 0.05f); - projectile.rotation -= projectile.spriteDirection * MathHelper.PiOver2; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.FloatingPetAI(false, 0.05f); + Projectile.rotation -= Projectile.spriteDirection * MathHelper.PiOver2; + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; - projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frameCounter = 0; } } } diff --git a/Projectiles/Pets/SirenYoung.cs b/Projectiles/Pets/SirenYoung.cs index fd7b730d9f..ea843a57d5 100644 --- a/Projectiles/Pets/SirenYoung.cs +++ b/Projectiles/Pets/SirenYoung.cs @@ -15,29 +15,29 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Ocean Spirit"); - Main.projFrames[projectile.type] = 17; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.LightPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 17; + Main.projPet[Projectile.type] = true; + ProjectileID.Sets.LightPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 38; - projectile.height = 58; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.ignoreWater = true; - projectile.tileCollide = false; + Projectile.netImportant = true; + Projectile.width = 38; + Projectile.height = 58; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } CalamityPlayer modPlayer = player.Calamity(); @@ -47,40 +47,40 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.sirenPet) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } bool sleepy = sleepyTimer >= 180; if (!sleepy) { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } } if (underwater) { - if (projectile.frame >= 8) + if (Projectile.frame >= 8) { - projectile.frame = 0; + Projectile.frame = 0; } } else { - if (projectile.frame >= 16) + if (Projectile.frame >= 16) { - projectile.frame = sleepy ? 16 : 8; + Projectile.frame = sleepy ? 16 : 8; } } underwater = player.IsUnderwater(); if (underwater) { - if (projectile.frame == 16) - projectile.frame = 0; + if (Projectile.frame == 16) + Projectile.frame = 0; if (sleepyTimer > 0) sleepyTimer--; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { lightLevel = 0; } @@ -99,25 +99,25 @@ namespace CalamityMod.Projectiles.Pets else { lightLevel = 2; - projectile.frame = 16; + Projectile.frame = 16; } } switch (lightLevel) { case 0: - Lighting.AddLight(projectile.Center, 0f, 2f, 2.5f); //4.5 + Lighting.AddLight(Projectile.Center, 0f, 2f, 2.5f); //4.5 break; case 1: - Lighting.AddLight(projectile.Center, 0f, 1.32f, 1.65f); //3 + Lighting.AddLight(Projectile.Center, 0f, 1.32f, 1.65f); //3 break; case 2: - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.7f); + Lighting.AddLight(Projectile.Center, 0f, 0.5f, 0.7f); break; } float velAdjustment = 0.2f; float speedLimit = 5f; - Vector2 playerVec = player.Center - projectile.Center; + Vector2 playerVec = player.Center - Projectile.Center; playerVec.Y += player.gfxOffY; if (player.controlLeft && !sleepy) { @@ -140,94 +140,94 @@ namespace CalamityMod.Projectiles.Pets playerVec.Y -= 60f; } - if (projectile.velocity.X < -0.25f || (player.controlLeft && !sleepy)) + if (Projectile.velocity.X < -0.25f || (player.controlLeft && !sleepy)) { - projectile.direction = -1; //face left + Projectile.direction = -1; //face left } - else if (projectile.velocity.X > 0.25f || (player.controlRight && !sleepy)) + else if (Projectile.velocity.X > 0.25f || (player.controlRight && !sleepy)) { - projectile.direction = 1; //face right + Projectile.direction = 1; //face right } - projectile.spriteDirection = projectile.direction; + Projectile.spriteDirection = Projectile.direction; float playerDist = playerVec.Length(); if (playerDist > 1000f) { - projectile.position.X += playerVec.X; - projectile.position.Y += playerVec.Y; + Projectile.position.X += playerVec.X; + Projectile.position.Y += playerVec.Y; } - if (projectile.localAI[0] == 1f) + if (Projectile.localAI[0] == 1f) { if (playerDist < 10f && player.velocity.Length() < speedLimit && player.velocity.Y == 0f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } speedLimit = 12f; if (playerDist < speedLimit) { - projectile.velocity = playerVec; + Projectile.velocity = playerVec; } else { playerDist = speedLimit / playerDist; - projectile.velocity = playerVec * playerDist; + Projectile.velocity = playerVec * playerDist; } - projectile.rotation = projectile.velocity.X * 0.05f; + Projectile.rotation = Projectile.velocity.X * 0.05f; return; } if (playerDist > 200f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } if (playerDist < 10f) { - projectile.velocity.X = playerVec.X; - projectile.velocity.Y = playerVec.Y; - projectile.rotation = projectile.velocity.X * 0.05f; + Projectile.velocity.X = playerVec.X; + Projectile.velocity.Y = playerVec.Y; + Projectile.rotation = Projectile.velocity.X * 0.05f; if (playerDist < speedLimit) { - projectile.position += projectile.velocity; - projectile.velocity *= 0f; + Projectile.position += Projectile.velocity; + Projectile.velocity *= 0f; velAdjustment = 0f; } } playerDist = speedLimit / playerDist; playerVec *= playerDist; - if (projectile.velocity.X < playerVec.X) + if (Projectile.velocity.X < playerVec.X) { - projectile.velocity.X += velAdjustment; - if (projectile.velocity.X < 0f) + Projectile.velocity.X += velAdjustment; + if (Projectile.velocity.X < 0f) { - projectile.velocity.X *= 0.99f; + Projectile.velocity.X *= 0.99f; } } - if (projectile.velocity.X > playerVec.X) + if (Projectile.velocity.X > playerVec.X) { - projectile.velocity.X -= velAdjustment; - if (projectile.velocity.X > 0f) + Projectile.velocity.X -= velAdjustment; + if (Projectile.velocity.X > 0f) { - projectile.velocity.X *= 0.99f; + Projectile.velocity.X *= 0.99f; } } - if (projectile.velocity.Y < playerVec.Y) + if (Projectile.velocity.Y < playerVec.Y) { - projectile.velocity.Y += velAdjustment; - if (projectile.velocity.Y < 0f) + Projectile.velocity.Y += velAdjustment; + if (Projectile.velocity.Y < 0f) { - projectile.velocity.Y *= 0.99f; + Projectile.velocity.Y *= 0.99f; } } - if (projectile.velocity.Y > playerVec.Y) + if (Projectile.velocity.Y > playerVec.Y) { - projectile.velocity.Y -= velAdjustment; - if (projectile.velocity.Y > 0f) + Projectile.velocity.Y -= velAdjustment; + if (Projectile.velocity.Y > 0f) { - projectile.velocity.Y *= 0.99f; + Projectile.velocity.Y *= 0.99f; } } - if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) + if (Projectile.velocity.X != 0f || Projectile.velocity.Y != 0f) { - projectile.rotation = projectile.velocity.X * 0.05f; + Projectile.rotation = Projectile.velocity.X * 0.05f; } } } diff --git a/Projectiles/Pets/Sparks.cs b/Projectiles/Pets/Sparks.cs index 647af2ae0a..d4279b3435 100644 --- a/Projectiles/Pets/Sparks.cs +++ b/Projectiles/Pets/Sparks.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Pets { @@ -15,37 +16,37 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Sparks"); - Main.projFrames[projectile.type] = 4; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.LightPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + Main.projPet[Projectile.type] = true; + ProjectileID.Sets.LightPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 44; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = true; - projectile.ignoreWater = true; + Projectile.width = 32; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; } private void Pickup() { int defaultItemGrabRange = 38; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; for (int itemIndex = 0; itemIndex < Main.maxItems; itemIndex++) { Item item = Main.item[itemIndex]; - if (item.active && item.noGrabDelay == 0 && item.owner == projectile.owner && ItemLoader.CanPickup(item, player)) + if (item.active && item.noGrabDelay == 0 && item.owner == Projectile.owner && ItemLoader.CanPickup(item, player)) { int num = defaultItemGrabRange;//Player.defaultItemGrabRange; - 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 (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.ActiveItem().type != ItemID.None || player.itemAnimation <= 0)) + if (Projectile.owner == Main.myPlayer && (player.ActiveItem().type != ItemID.None || player.itemAnimation <= 0)) { // TODO, fix this maybe? if (!ItemLoader.OnPickup(item, player)) @@ -114,7 +115,7 @@ namespace CalamityMod.Projectiles.Pets } else { - Main.item[itemIndex] = player.GetItem(projectile.owner, item, false, false); + Main.item[itemIndex] = player.GetItem(Projectile.owner, item, false, false); if (Main.netMode == NetmodeID.MultiplayerClient) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, itemIndex, 0f, 0f, 0f, 0, 0, 0); @@ -130,11 +131,11 @@ namespace CalamityMod.Projectiles.Pets NPC npc = Main.npc[npcIndex]; if (npc.active && (npc.type == NPCID.Butterfly || npc.type == NPCID.GoldButterfly)) { - if (new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height).Intersects(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height))) + if (new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height).Intersects(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height))) { npc.life = 0; npc.active = false; - Main.PlaySound(SoundID.Item2, projectile.position); + SoundEngine.PlaySound(SoundID.Item2, Projectile.position); npc.netUpdate = true; } } @@ -143,35 +144,35 @@ namespace CalamityMod.Projectiles.Pets private void PassiveAI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float SAImovement = 0.05f; for (int index = 0; index < Main.projectile.Length; index++) { Projectile proj = Main.projectile[index]; bool flag23 = Main.projPet[proj.type]; - if (index != projectile.whoAmI && proj.active && proj.owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < (float)projectile.width) + if (index != Projectile.whoAmI && proj.active && proj.owner == Projectile.owner && flag23 && Math.Abs(Projectile.position.X - proj.position.X) + Math.Abs(Projectile.position.Y - proj.position.Y) < (float)Projectile.width) { - if (projectile.position.X < proj.position.X) + if (Projectile.position.X < proj.position.X) { - projectile.velocity.X -= SAImovement; + Projectile.velocity.X -= SAImovement; } else { - projectile.velocity.X += SAImovement; + Projectile.velocity.X += SAImovement; } - if (projectile.position.Y < proj.position.Y) + if (Projectile.position.Y < proj.position.Y) { - projectile.velocity.Y -= SAImovement; + Projectile.velocity.Y -= SAImovement; } else { - projectile.velocity.Y += SAImovement; + Projectile.velocity.Y += SAImovement; } } } float num16 = 0.5f; - projectile.tileCollide = false; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Projectile.tileCollide = false; + Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float xDist = player.position.X + (float)(player.width / 2) - vector3.X; float yDist = player.position.Y + (float)(player.height / 2) - vector3.Y; yDist += (float)Main.rand.Next(-10, 21); @@ -181,27 +182,27 @@ namespace CalamityMod.Projectiles.Pets float playerDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); float num21 = 18f; if (playerDist < 160f) - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; if (playerDist < 100f && player.velocity.Y == 0f && - projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && - !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + Projectile.position.Y + (float)Projectile.height <= player.position.Y + (float)player.height && + !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - if (projectile.velocity.Y < -6f) + if (Projectile.velocity.Y < -6f) { - projectile.velocity.Y = -6f; + Projectile.velocity.Y = -6f; } } if (playerDist > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (playerDist < 50f) { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f) { - projectile.velocity *= 0.99f; + Projectile.velocity *= 0.99f; } num16 = 0.01f; } @@ -219,63 +220,63 @@ namespace CalamityMod.Projectiles.Pets xDist *= playerDist; yDist *= playerDist; } - if (projectile.velocity.X < xDist) + if (Projectile.velocity.X < xDist) { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) + Projectile.velocity.X = Projectile.velocity.X + num16; + if (num16 > 0.05f && Projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + num16; + Projectile.velocity.X = Projectile.velocity.X + num16; } } - if (projectile.velocity.X > xDist) + if (Projectile.velocity.X > xDist) { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) + Projectile.velocity.X = Projectile.velocity.X - num16; + if (num16 > 0.05f && Projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - num16; + Projectile.velocity.X = Projectile.velocity.X - num16; } } - if (projectile.velocity.Y < yDist) + if (Projectile.velocity.Y < yDist) { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num16; + if (num16 > 0.05f && Projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f; } } - if (projectile.velocity.Y > yDist) + if (Projectile.velocity.Y > yDist) { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num16; + if (num16 > 0.05f && Projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; } } } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); //Change color based on health if (player.statLife >= (int)((double)player.statLifeMax2 * 0.75)) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { color = 0; //gold } } else if (player.statLife >= (int)((double)player.statLifeMax2 * 0.5)) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { color = 1; //blue } } else { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { color = 2; //green } @@ -284,42 +285,42 @@ namespace CalamityMod.Projectiles.Pets //give off light based on Dragonfly color if (color == 0) //gold { - Lighting.AddLight(projectile.Center, 1.5f, 1.5f, 0.1f); + Lighting.AddLight(Projectile.Center, 1.5f, 1.5f, 0.1f); } else if (color == 1) //blue { - Lighting.AddLight(projectile.Center, 0.1f, 0.1f, 1.5f); + Lighting.AddLight(Projectile.Center, 0.1f, 0.1f, 1.5f); } else //green { - Lighting.AddLight(projectile.Center, 0.1f, 1.5f, 0.1f); + Lighting.AddLight(Projectile.Center, 0.1f, 1.5f, 0.1f); } //framing and sprite direction - projectile.spriteDirection = projectile.direction; - projectile.rotation = projectile.velocity.X * 0.05f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.spriteDirection = Projectile.direction; + Projectile.rotation = Projectile.velocity.X * 0.05f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } - if ((double)projectile.velocity.X >= 0.25) + if ((double)Projectile.velocity.X >= 0.25) { - projectile.direction = 1; + Projectile.direction = 1; } - else if ((double)projectile.velocity.X < -0.25) + else if ((double)Projectile.velocity.X < -0.25) { - projectile.direction = -1; + Projectile.direction = -1; } if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } if (player.dead) @@ -328,21 +329,21 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.sparks) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } Pickup(); //pickup items bool flag24 = false; - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] > 30f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 30f) { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.numUpdates = 0; - projectile.netUpdate = true; + Projectile.ai[1] = 1f; + Projectile.ai[0] = 0f; + Projectile.numUpdates = 0; + Projectile.netUpdate = true; } else { @@ -355,14 +356,14 @@ namespace CalamityMod.Projectiles.Pets } //find a target - Vector2 targetLocation = projectile.position; + Vector2 targetLocation = Projectile.position; bool foundFood = false; float range = 160f; //10 block range for (int itemIndex = 0; itemIndex < Main.maxItems; itemIndex++) { Item item = Main.item[itemIndex]; - if (item.active && item.noGrabDelay == 0 && item.owner == projectile.owner && ItemLoader.CanPickup(item, Main.player[item.owner]) && Main.player[item.owner].ItemSpace(item)) + if (item.active && item.noGrabDelay == 0 && item.owner == Projectile.owner && ItemLoader.CanPickup(item, Main.player[item.owner]) && Main.player[item.owner].ItemSpace(item)) { if (ItemID.Sets.NebulaPickup[item.type]) { @@ -377,8 +378,8 @@ namespace CalamityMod.Projectiles.Pets continue; } - float itemDist = Vector2.Distance(item.Center, projectile.Center); - float distanceToPotential = Vector2.Distance(projectile.Center, targetLocation); + float itemDist = Vector2.Distance(item.Center, Projectile.Center); + float distanceToPotential = Vector2.Distance(Projectile.Center, targetLocation); if (distanceToPotential < itemDist && itemDist < range) { range = itemDist; @@ -393,8 +394,8 @@ namespace CalamityMod.Projectiles.Pets NPC npc = Main.npc[npcIndex]; if (npc.active && (npc.type == NPCID.Butterfly || npc.type == NPCID.GoldButterfly)) { - float npcDist = Vector2.Distance(npc.Center, projectile.Center); - float distanceToPotential = Vector2.Distance(projectile.Center, targetLocation); + float npcDist = Vector2.Distance(npc.Center, Projectile.Center); + float distanceToPotential = Vector2.Distance(Projectile.Center, targetLocation); if (distanceToPotential < npcDist && npcDist < range) { range = npcDist; @@ -409,54 +410,54 @@ namespace CalamityMod.Projectiles.Pets { num647 = 200f; } - if (Vector2.Distance(player.Center, projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > num647) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } - if (foundFood && projectile.ai[0] == 0f) + if (foundFood && Projectile.ai[0] == 0f) { - Vector2 vector47 = targetLocation - projectile.Center; + Vector2 vector47 = targetLocation - Projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 18f; vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 9f; vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } } else { PassiveAI(); } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 3); + Projectile.ai[1] += (float)Main.rand.Next(1, 3); } - if (projectile.ai[1] > 30f) + if (Projectile.ai[1] > 30f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - if (projectile.ai[1] == 0f && foundFood && range < 300f) + if (Projectile.ai[1] == 0f && foundFood && range < 300f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner) { - projectile.ai[0] = 2f; - Vector2 value20 = targetLocation - projectile.Center; + Projectile.ai[0] = 2f; + Vector2 value20 = targetLocation - Projectile.Center; value20.Normalize(); - projectile.velocity = value20 * 12f; - projectile.netUpdate = true; + Projectile.velocity = value20 * 12f; + Projectile.netUpdate = true; } } } @@ -464,17 +465,17 @@ namespace CalamityMod.Projectiles.Pets public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; if (color == 1) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/SparksBlue"); + texture = ModContent.Request("CalamityMod/Projectiles/Pets/SparksBlue"); if (color == 2) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/SparksGreen"); - int height = texture.Height / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; + texture = ModContent.Request("CalamityMod/Projectiles/Pets/SparksGreen"); + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Pets/ThirdSage.cs b/Projectiles/Pets/ThirdSage.cs index f415b455e9..b3a22f85be 100644 --- a/Projectiles/Pets/ThirdSage.cs +++ b/Projectiles/Pets/ThirdSage.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Pets { @@ -10,27 +11,27 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Third Sage"); - Main.projPet[projectile.type] = true; - Main.projFrames[projectile.type] = 7; + Main.projPet[Projectile.type] = true; + Main.projFrames[Projectile.type] = 7; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 42; - projectile.height = 42; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = false; + Projectile.netImportant = true; + Projectile.width = 42; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } CalamityPlayer modPlayer = player.Calamity(); @@ -40,29 +41,29 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.thirdSage) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - projectile.FloatingPetAI(true, 0.1f); + Projectile.FloatingPetAI(true, 0.1f); //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4 && projectile.ai[1] < 45) + if (Projectile.frame > 4 && Projectile.ai[1] < 45) { - projectile.frame = 0; - projectile.ai[1]++; + Projectile.frame = 0; + Projectile.ai[1]++; } - else if (projectile.frame == 4 && projectile.ai[1] >= 45) + else if (Projectile.frame == 4 && Projectile.ai[1] >= 45) { - Main.PlaySound(SoundID.Zombie, projectile.Center, 32); + SoundEngine.PlaySound(SoundID.Zombie, Projectile.Center, 32); } - else if (projectile.frame > 6) + else if (Projectile.frame > 6) { - projectile.frame = 0; - projectile.ai[1] = 0; + Projectile.frame = 0; + Projectile.ai[1] = 0; } } } diff --git a/Projectiles/Pets/YharonSonPet.cs b/Projectiles/Pets/YharonSonPet.cs index 4261eb2bbd..f0cd1115e1 100644 --- a/Projectiles/Pets/YharonSonPet.cs +++ b/Projectiles/Pets/YharonSonPet.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Projectiles.Pets { public class YharonSonPet : ModProjectile { - public Player player => Main.player[projectile.owner]; + public Player player => Main.player[Projectile.owner]; private static int xFrameAmt = 3; private static int yFrameAmt = 16; @@ -27,27 +27,27 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Son of Yharon"); - Main.projPet[projectile.type] = true; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 104; - projectile.height = 82; - projectile.friendly = true; - projectile.penetrate = -1; + Projectile.netImportant = true; + Projectile.width = 104; + Projectile.height = 82; + Projectile.friendly = true; + Projectile.penetrate = -1; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.frameCounter <= 1) + if (Projectile.frameCounter <= 1) return false; - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; Vector2 origin = texture.Size() / new Vector2((float)xFrameAmt, (float)yFrameAmt) * 0.5f; Rectangle frame = texture.Frame(xFrameAmt, yFrameAmt, frameX, frameY); - SpriteEffects spriteEffects = projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, frame, lightColor, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); return false; } @@ -56,8 +56,8 @@ namespace CalamityMod.Projectiles.Pets private void SittingFrames() { - projectile.frameCounter++; - if (projectile.frameCounter % 6 == 0) + Projectile.frameCounter++; + if (Projectile.frameCounter % 6 == 0) { if (CurrentlyFlying()) CurrentFrame = 3; @@ -80,8 +80,8 @@ namespace CalamityMod.Projectiles.Pets private void FlyingFrames() { - projectile.frameCounter++; - if (projectile.frameCounter % 6 == 0) + Projectile.frameCounter++; + if (Projectile.frameCounter % 6 == 0) { if (CurrentlySitting()) CurrentFrame = 1; @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Pets { if (!player.active) { - projectile.active = false; + Projectile.active = false; return; } CalamityPlayer modPlayer = player.Calamity(); @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Pets } if (modPlayer.yharonPet) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } @@ -123,37 +123,37 @@ namespace CalamityMod.Projectiles.Pets // Fly toward the player if they are using Rocket Boots if (player.rocketDelay2 > 0) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } - float xDist = player.Center.X - projectile.Center.X; - float yDist = player.Center.Y - projectile.Center.Y; + float xDist = player.Center.X - Projectile.Center.X; + float yDist = player.Center.Y - Projectile.Center.Y; Vector2 playerVector = new Vector2(xDist, yDist); float playerDist = playerVector.Length(); //Teleport to player if too far if (playerDist > 2000f) { - projectile.position.X = player.Center.X - projectile.width / 2; - projectile.position.Y = player.Center.Y - projectile.height / 2; - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - Projectile.width / 2; + Projectile.position.Y = player.Center.Y - Projectile.height / 2; + Projectile.netUpdate = true; } // Otherwise, make sure we're not going crazy in the y velocity and try to fly back toward the player else if (playerDist > (CurrentlySitting() ? 300f : 200f)) { - if (yDist > 0f && projectile.velocity.Y < 0f) + if (yDist > 0f && Projectile.velocity.Y < 0f) { - projectile.velocity.Y = 0f; + Projectile.velocity.Y = 0f; } - if (yDist < 0f && projectile.velocity.Y > 0f) + if (yDist < 0f && Projectile.velocity.Y > 0f) { - projectile.velocity.Y = 0f; + Projectile.velocity.Y = 0f; } - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } // Fly toward the player - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { FlyingPetAI(); } @@ -162,7 +162,7 @@ namespace CalamityMod.Projectiles.Pets { SitDownAttempt(); } - projectile.spriteDirection = projectile.direction; + Projectile.spriteDirection = Projectile.direction; DontSitInMidair(); } @@ -171,9 +171,9 @@ namespace CalamityMod.Projectiles.Pets if (CurrentlySitting()) { bool noSolidGround = true; - for (int i = (int)projectile.BottomLeft.X / 16; i < (int)projectile.BottomRight.X / 16; i++) + for (int i = (int)Projectile.BottomLeft.X / 16; i < (int)Projectile.BottomRight.X / 16; i++) { - Tile tileBelow = CalamityUtils.ParanoidTileRetrieval(i, (int)(projectile.Bottom.Y / 16)); + Tile tileBelow = CalamityUtils.ParanoidTileRetrieval(i, (int)(Projectile.Bottom.Y / 16)); if (tileBelow.IsTileSolidGround()) { noSolidGround = false; @@ -181,17 +181,17 @@ namespace CalamityMod.Projectiles.Pets } } if (noSolidGround) - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } } private void FlyingPetAI() { float passiveMvtFloat = 0.2f; - projectile.tileCollide = false; + Projectile.tileCollide = false; float range = 200f; - float xDist = player.Center.X - projectile.Center.X; - float yDist = player.Center.Y - projectile.Center.Y; + float xDist = player.Center.X - Projectile.Center.X; + float yDist = player.Center.Y - Projectile.Center.Y; yDist += Main.rand.NextFloat(-10, 20); xDist += Main.rand.NextFloat(-10, 20); xDist += 60f * -(float)player.direction; @@ -201,19 +201,19 @@ namespace CalamityMod.Projectiles.Pets float returnSpeed = 12f; //If player is close enough, try and land - if (playerDist < range && player.velocity.Y == 0f && projectile.Bottom.Y <= player.Bottom.Y && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerDist < range && player.velocity.Y == 0f && Projectile.Bottom.Y <= player.Bottom.Y && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - if (projectile.velocity.Y < -6f) + Projectile.ai[0] = 0f; + if (Projectile.velocity.Y < -6f) { - projectile.velocity.Y = -6f; + Projectile.velocity.Y = -6f; } } if (playerDist < 60f) { - playerVector.X = projectile.velocity.X; - playerVector.Y = projectile.velocity.Y; + playerVector.X = Projectile.velocity.X; + playerVector.Y = Projectile.velocity.Y; } else { @@ -221,57 +221,57 @@ namespace CalamityMod.Projectiles.Pets playerVector.X *= playerDist; playerVector.Y *= playerDist; } - if (projectile.velocity.X < playerVector.X) + if (Projectile.velocity.X < playerVector.X) { - projectile.velocity.X += passiveMvtFloat; - if (projectile.velocity.X < 0f) + Projectile.velocity.X += passiveMvtFloat; + if (Projectile.velocity.X < 0f) { - projectile.velocity.X += passiveMvtFloat * 1.5f; + Projectile.velocity.X += passiveMvtFloat * 1.5f; } } - if (projectile.velocity.X > playerVector.X) + if (Projectile.velocity.X > playerVector.X) { - projectile.velocity.X -= passiveMvtFloat; - if (projectile.velocity.X > 0f) + Projectile.velocity.X -= passiveMvtFloat; + if (Projectile.velocity.X > 0f) { - projectile.velocity.X -= passiveMvtFloat * 1.5f; + Projectile.velocity.X -= passiveMvtFloat * 1.5f; } } - if (projectile.velocity.Y < playerVector.Y) + if (Projectile.velocity.Y < playerVector.Y) { - projectile.velocity.Y += passiveMvtFloat; - if (projectile.velocity.Y < 0f) + Projectile.velocity.Y += passiveMvtFloat; + if (Projectile.velocity.Y < 0f) { - projectile.velocity.Y += passiveMvtFloat * 1.5f; + Projectile.velocity.Y += passiveMvtFloat * 1.5f; } } - if (projectile.velocity.Y > playerVector.Y) + if (Projectile.velocity.Y > playerVector.Y) { - projectile.velocity.Y -= passiveMvtFloat; - if (projectile.velocity.Y > 0f) + Projectile.velocity.Y -= passiveMvtFloat; + if (Projectile.velocity.Y > 0f) { - projectile.velocity.Y -= passiveMvtFloat * 1.5f; + Projectile.velocity.Y -= passiveMvtFloat * 1.5f; } } - if (projectile.velocity.X >= 0.5f) + if (Projectile.velocity.X >= 0.5f) { - projectile.direction = -1; + Projectile.direction = -1; } - else if (projectile.velocity.X < -0.5f) + else if (Projectile.velocity.X < -0.5f) { - projectile.direction = 1; + Projectile.direction = 1; } - else if (player.Center.X < projectile.Center.X) + else if (player.Center.X < Projectile.Center.X) { - projectile.direction = 1; + Projectile.direction = 1; } - else if (player.Center.X > projectile.Center.X) + else if (player.Center.X > Projectile.Center.X) { - projectile.direction = -1; + Projectile.direction = -1; } //Tilting - projectile.rotation = projectile.velocity.X * 0.075f; + Projectile.rotation = Projectile.velocity.X * 0.075f; // Frames while flying FlyingFrames(); @@ -279,7 +279,7 @@ namespace CalamityMod.Projectiles.Pets private void SitDownAttempt() { - projectile.tileCollide = true; + Projectile.tileCollide = true; bool tooRight = false; bool tooLeft = false; @@ -287,62 +287,62 @@ namespace CalamityMod.Projectiles.Pets float xAdjust = 0.08f; float xVelMax = 6.5f; - if (player.Center.X < projectile.Center.X - 85f) + if (player.Center.X < Projectile.Center.X - 85f) { tooRight = true; } - else if (player.Center.X > projectile.Center.X + 85f) + else if (player.Center.X > Projectile.Center.X + 85f) { tooLeft = true; } if (tooRight) { - if (projectile.velocity.X > -3.5f) + if (Projectile.velocity.X > -3.5f) { - projectile.velocity.X -= xAdjust; + Projectile.velocity.X -= xAdjust; } else { - projectile.velocity.X -= xAdjust * 0.25f; + Projectile.velocity.X -= xAdjust * 0.25f; } } else if (tooLeft) { - if (projectile.velocity.X < 3.5f) + if (Projectile.velocity.X < 3.5f) { - projectile.velocity.X += xAdjust; + Projectile.velocity.X += xAdjust; } else { - projectile.velocity.X += xAdjust * 0.25f; + Projectile.velocity.X += xAdjust * 0.25f; } } else { - projectile.velocity.X *= 0.9f; - if (projectile.velocity.X >= 0f - xAdjust && projectile.velocity.X <= xAdjust) + Projectile.velocity.X *= 0.9f; + if (Projectile.velocity.X >= 0f - xAdjust && Projectile.velocity.X <= xAdjust) { - projectile.velocity.X = 0f; + Projectile.velocity.X = 0f; } } - projectile.velocity.X *= 0.95f; - if (projectile.velocity.X > -0.1f && projectile.velocity.X < 0.1f) + Projectile.velocity.X *= 0.95f; + if (Projectile.velocity.X > -0.1f && Projectile.velocity.X < 0.1f) { - projectile.velocity.X = 0f; + Projectile.velocity.X = 0f; } - if (player.Bottom.Y - 8f > projectile.Bottom.Y) + if (player.Bottom.Y - 8f > Projectile.Bottom.Y) { abovePlayer = true; } - Collision.StepUp(ref projectile.position, ref projectile.velocity, projectile.width, projectile.height, ref projectile.stepSpeed, ref projectile.gfxOffY); - if (projectile.velocity.Y == 0f) + Collision.StepUp(ref Projectile.position, ref Projectile.velocity, Projectile.width, Projectile.height, ref Projectile.stepSpeed, ref Projectile.gfxOffY); + if (Projectile.velocity.Y == 0f) { - if (!abovePlayer && projectile.velocity.X != 0f) + if (!abovePlayer && Projectile.velocity.X != 0f) { - int i = (int)projectile.Center.X / 16; - int j = (int)projectile.Center.Y / 16 + 1; + int i = (int)Projectile.Center.X / 16; + int j = (int)Projectile.Center.Y / 16 + 1; if (tooRight) { i--; @@ -356,51 +356,51 @@ namespace CalamityMod.Projectiles.Pets } // Cap X velocity when attempting to sit - if (projectile.velocity.X > xVelMax) + if (Projectile.velocity.X > xVelMax) { - projectile.velocity.X = xVelMax; + Projectile.velocity.X = xVelMax; } - if (projectile.velocity.X < -xVelMax) + if (Projectile.velocity.X < -xVelMax) { - projectile.velocity.X = -xVelMax; + Projectile.velocity.X = -xVelMax; } // Handle frames and sitting direction/rotation - bool sitting = projectile.position.X == projectile.oldPosition.X; - if (projectile.velocity.Y == 0f && sitting) + bool sitting = Projectile.position.X == Projectile.oldPosition.X; + if (Projectile.velocity.Y == 0f && sitting) { - if (player.Center.X < projectile.Center.X) + if (player.Center.X < Projectile.Center.X) { - projectile.direction = 1; + Projectile.direction = 1; } - else if (player.Center.X > projectile.Center.X) + else if (player.Center.X > Projectile.Center.X) { - projectile.direction = -1; + Projectile.direction = -1; } - projectile.rotation = 0f; + Projectile.rotation = 0f; // Frames while sitting SittingFrames(); } else { - if (projectile.velocity.X >= 0.5f) + if (Projectile.velocity.X >= 0.5f) { - projectile.direction = -1; + Projectile.direction = -1; } - else if (projectile.velocity.X < -0.5f) + else if (Projectile.velocity.X < -0.5f) { - projectile.direction = 1; + Projectile.direction = 1; } - else if (player.Center.X < projectile.Center.X) + else if (player.Center.X < Projectile.Center.X) { - projectile.direction = 1; + Projectile.direction = 1; } - else if (player.Center.X > projectile.Center.X) + else if (player.Center.X > Projectile.Center.X) { - projectile.direction = -1; + Projectile.direction = -1; } - projectile.rotation = projectile.velocity.X * 0.075f; + Projectile.rotation = Projectile.velocity.X * 0.075f; // Frames while flying FlyingFrames(); diff --git a/Projectiles/Ranged/AMR2.cs b/Projectiles/Ranged/AMR2.cs index 797aeb955a..fb2ab84c53 100644 --- a/Projectiles/Ranged/AMR2.cs +++ b/Projectiles/Ranged/AMR2.cs @@ -13,20 +13,20 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 5; - projectile.scale = 1.18f; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.extraUpdates = 5; + Projectile.scale = 1.18f; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } } } diff --git a/Projectiles/Ranged/AMRShot.cs b/Projectiles/Ranged/AMRShot.cs index b516f2c8a8..c801876767 100644 --- a/Projectiles/Ranged/AMRShot.cs +++ b/Projectiles/Ranged/AMRShot.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -16,34 +17,34 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 10; - projectile.scale = 1.18f; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 4; + Projectile.height = 4; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.extraUpdates = 10; + Projectile.scale = 1.18f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - float num107 = (float)Math.Sqrt(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y); - if (projectile.alpha > 0) - projectile.alpha -= (byte)(num107 * 0.9); - if (projectile.alpha < 0) - projectile.alpha = 0; + float num107 = (float)Math.Sqrt(Projectile.velocity.X * Projectile.velocity.X + Projectile.velocity.Y * Projectile.velocity.Y); + if (Projectile.alpha > 0) + Projectile.alpha -= (byte)(num107 * 0.9); + if (Projectile.alpha < 0) + Projectile.alpha = 0; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; } public override Color? GetAlpha(Color lightColor) { - if (projectile.alpha < 140) + if (Projectile.alpha < 140) return new Color(255, 255, 255, 100); return Color.Transparent; @@ -51,8 +52,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } @@ -79,10 +80,10 @@ namespace CalamityMod.Projectiles.Ranged int extraProjectileAmt = 8; for (int x = 0; x < extraProjectileAmt; x++) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { bool fromRight = x > 3; - CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, fromRight, 500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.1), projectile.knockBack * 0.1f, projectile.owner); + CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, fromRight, 500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack * 0.1f, Projectile.owner); } } } diff --git a/Projectiles/Ranged/AccelerationBulletProj.cs b/Projectiles/Ranged/AccelerationBulletProj.cs index a2b10b96b0..544d45dffa 100644 --- a/Projectiles/Ranged/AccelerationBulletProj.cs +++ b/Projectiles/Ranged/AccelerationBulletProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,41 +12,41 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Acceleration Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 3; aiType = ProjectileID.Bullet; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.velocity *= 1.01f; - if (projectile.velocity.Length() >= 12f) + Projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() >= 12f) { - projectile.velocity *= 0.5f; - projectile.extraUpdates++; - projectile.netUpdate = true; + Projectile.velocity *= 0.5f; + Projectile.extraUpdates++; + Projectile.netUpdate = true; } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 91, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; + int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 91, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = Projectile.alpha; Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; } @@ -54,23 +55,23 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 10); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 10); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 91, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 91, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/AcidBulletProj.cs b/Projectiles/Ranged/AcidBulletProj.cs index b299b950ec..ecfbf2d007 100644 --- a/Projectiles/Ranged/AcidBulletProj.cs +++ b/Projectiles/Ranged/AcidBulletProj.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -12,35 +13,35 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 3; aiType = ProjectileID.Bullet; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { if (Main.rand.NextBool(2)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 107, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; + int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 107, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = Projectile.alpha; Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; } @@ -49,14 +50,14 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } @@ -75,7 +76,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/AngelicBeam.cs b/Projectiles/Ranged/AngelicBeam.cs index 9380deac3f..b55afbaf18 100644 --- a/Projectiles/Ranged/AngelicBeam.cs +++ b/Projectiles/Ranged/AngelicBeam.cs @@ -14,21 +14,21 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.alpha = 255; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.alpha = 255; // Hitscan laser with a long range - projectile.timeLeft = 200; - projectile.extraUpdates = 200; + Projectile.timeLeft = 200; + Projectile.extraUpdates = 200; - projectile.penetrate = -1; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 20; + Projectile.penetrate = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 20; } public override void AI() @@ -37,10 +37,10 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 7; ++i) { int dustType = 262; // Main.rand.NextBool() ? 244 : 246; - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); Main.dust[idx].noGravity = true; - Main.dust[idx].position -= i * 0.1666f * projectile.velocity; + Main.dust[idx].position -= i * 0.1666f * Projectile.velocity; Main.dust[idx].velocity *= 1f; float scale = Main.rand.NextFloat(0.8f, 1.4f); Main.dust[idx].scale = scale; @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged if (Main.rand.NextBool()) { int dustType = Main.rand.NextBool() ? 244 : 246; - int idx = Dust.NewDust(projectile.position, 1, 1, dustType); + int idx = Dust.NewDust(Projectile.position, 1, 1, dustType); Main.dust[idx].noGravity = true; float ySpeed = Main.rand.NextFloat(3.0f, 5.6f); diff --git a/Projectiles/Ranged/AquaBlast.cs b/Projectiles/Ranged/AquaBlast.cs index a5f7fd5fe7..7ab081d057 100644 --- a/Projectiles/Ranged/AquaBlast.cs +++ b/Projectiles/Ranged/AquaBlast.cs @@ -8,46 +8,46 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Aqua Blast"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.75f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.75f / 255f); for (int num457 = 0; num457 < 2; num457++) { - Vector2 dspeed = -projectile.velocity * Main.rand.NextFloat(0.5f * 0.8f); - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1f); + Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f * 0.8f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity = dspeed; } @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int lol = 0; lol < 10; lol++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1f); } } } diff --git a/Projectiles/Ranged/AquaBlastToxic.cs b/Projectiles/Ranged/AquaBlastToxic.cs index d717bda51b..8ad2d755de 100644 --- a/Projectiles/Ranged/AquaBlastToxic.cs +++ b/Projectiles/Ranged/AquaBlastToxic.cs @@ -10,45 +10,45 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Aqua Blast Toxic"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.4f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.4f / 255f); for (int num457 = 0; num457 < 2; num457++) { - Vector2 dspeed = -projectile.velocity * Main.rand.NextFloat(0.5f * 0.8f); - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 1f); + Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f * 0.8f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 1f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity = dspeed; } @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int lol = 0; lol < 10; lol++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 1f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 1f); } } diff --git a/Projectiles/Ranged/Aquashard.cs b/Projectiles/Ranged/Aquashard.cs index b7561514f8..f0692dad7e 100644 --- a/Projectiles/Ranged/Aquashard.cs +++ b/Projectiles/Ranged/Aquashard.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -14,41 +15,41 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.aiStyle = 1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.aiStyle = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y += 0.01f; + Projectile.velocity.X *= 0.9995f; + Projectile.velocity.Y += 0.01f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { int projAmt = Main.rand.Next(1, 3); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < projAmt; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner); } } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 27); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 27); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 154, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/AquashardSplit.cs b/Projectiles/Ranged/AquashardSplit.cs index c36e5564a4..69a60c8d8f 100644 --- a/Projectiles/Ranged/AquashardSplit.cs +++ b/Projectiles/Ranged/AquashardSplit.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -15,32 +16,32 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.aiStyle = 1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.aiStyle = 1; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y += 0.01f; + Projectile.velocity.X *= 0.9995f; + Projectile.velocity.Y += 0.01f; - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 6f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 6f, 20f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 27); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 27); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 154, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/ArcherfishShot.cs b/Projectiles/Ranged/ArcherfishShot.cs index bfc9395a66..a76f5a53b9 100644 --- a/Projectiles/Ranged/ArcherfishShot.cs +++ b/Projectiles/Ranged/ArcherfishShot.cs @@ -17,25 +17,25 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.penetrate = 2; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.extraUpdates = 2; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.penetrate = 2; + Projectile.alpha = 255; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 2; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - if (projectile.localAI[0] < 5f) + if (Projectile.localAI[0] < 5f) { - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; return; } int num3; @@ -43,10 +43,10 @@ namespace CalamityMod.Projectiles.Ranged { for (int num587 = 0; num587 < 6; num587 = num3 + 1) { - float num588 = projectile.velocity.X / 6f * (float)num587; - float num589 = projectile.velocity.Y / 6f * (float)num587; + float num588 = Projectile.velocity.X / 6f * (float)num587; + float num589 = Projectile.velocity.Y / 6f * (float)num587; int num590 = 6; - int num591 = Dust.NewDust(new Vector2(projectile.position.X + (float)num590, projectile.position.Y + (float)num590), projectile.width - num590 * 2, projectile.height - num590 * 2, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 1.2f); + int num591 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num590, Projectile.position.Y + (float)num590), Projectile.width - num590 * 2, Projectile.height - num590 * 2, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 1.2f); Dust dust; if (Main.rand.NextBool(2)) { @@ -67,8 +67,8 @@ namespace CalamityMod.Projectiles.Ranged dust = Main.dust[num591]; dust.velocity *= 0.3f; dust = Main.dust[num591]; - dust.velocity += projectile.velocity * 0.5f; - Main.dust[num591].position = projectile.Center; + dust.velocity += Projectile.velocity * 0.5f; + Main.dust[num591].position = Projectile.Center; Dust var_2_18F52_cp_0_cp_0 = Main.dust[num591]; var_2_18F52_cp_0_cp_0.position.X -= num588; Dust var_2_18F74_cp_0_cp_0 = Main.dust[num591]; @@ -80,11 +80,11 @@ namespace CalamityMod.Projectiles.Ranged if (Main.rand.NextBool(4)) { int num592 = 6; - int num593 = Dust.NewDust(new Vector2(projectile.position.X + (float)num592, projectile.position.Y + (float)num592), projectile.width - num592 * 2, projectile.height - num592 * 2, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 0.65f); + int num593 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num592, Projectile.position.Y + (float)num592), Projectile.width - num592 * 2, Projectile.height - num592 * 2, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 0.65f); Dust dust = Main.dust[num593]; dust.velocity *= 0.5f; dust = Main.dust[num593]; - dust.velocity += projectile.velocity * 0.5f; + dust.velocity += Projectile.velocity * 0.5f; } num3 = num586; } @@ -92,11 +92,11 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.velocity = projectile.oldVelocity * 0.2f; + Projectile.velocity = Projectile.oldVelocity * 0.2f; int num3; for (int num362 = 0; num362 < 100; num362 = num3 + 1) { - int num363 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 1.2f); + int num363 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 1.2f); Dust dust; if (Main.rand.NextBool(2)) { @@ -124,14 +124,14 @@ namespace CalamityMod.Projectiles.Ranged dust = Main.dust[num363]; dust.velocity *= 0.3f; dust = Main.dust[num363]; - dust.velocity += projectile.velocity; + dust.velocity += Projectile.velocity; dust = Main.dust[num363]; dust.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; Dust expr_C6F7_cp_0_cp_0 = Main.dust[num363]; expr_C6F7_cp_0_cp_0.velocity.X += (float)Main.rand.Next(-50, 51) * 0.015f; Dust expr_C726_cp_0_cp_0 = Main.dust[num363]; expr_C726_cp_0_cp_0.velocity.Y += (float)Main.rand.Next(-50, 51) * 0.015f; - Main.dust[num363].position = projectile.Center; + Main.dust[num363].position = Projectile.Center; num3 = num362; } } diff --git a/Projectiles/Ranged/ArcticArrowProj.cs b/Projectiles/Ranged/ArcticArrowProj.cs index bf1aacaae4..4fa2079b8c 100644 --- a/Projectiles/Ranged/ArcticArrowProj.cs +++ b/Projectiles/Ranged/ArcticArrowProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -17,46 +18,46 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.aiStyle = 1; - projectile.coldDamage = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.aiStyle = 1; + Projectile.coldDamage = true; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 27); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 27); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 20; + Projectile.height = 20; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { diff --git a/Projectiles/Ranged/AstralCannonProjectile.cs b/Projectiles/Ranged/AstralCannonProjectile.cs index a088f395b2..621bfe4945 100644 --- a/Projectiles/Ranged/AstralCannonProjectile.cs +++ b/Projectiles/Ranged/AstralCannonProjectile.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class AstralCannonProjectile : ModProjectile @@ -15,62 +16,62 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Crystal"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 5; + Projectile.alpha -= 5; } else { - projectile.alpha = 0; - projectile.tileCollide = true; + Projectile.alpha = 0; + Projectile.tileCollide = true; } - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } - Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); - projectile.velocity *= 1.075f; + Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); + Projectile.velocity *= 1.075f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -81,26 +82,26 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 192; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Zombie, (int)projectile.Center.X, (int)projectile.Center.Y, 103, 1f, 0f); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 192; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Zombie, (int)Projectile.Center.X, (int)Projectile.Center.Y, 103, 1f, 0f); for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index 852582ba75..9fbd3a6147 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class AstralRound : ModProjectile @@ -13,45 +14,45 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.light = 0.25f; - projectile.extraUpdates = 2; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.light = 0.25f; + Projectile.extraUpdates = 2; aiType = ProjectileID.Bullet; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override bool PreAI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); - projectile.spriteDirection = projectile.direction; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); + Projectile.spriteDirection = Projectile.direction; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { if (Main.rand.NextBool(2)) { @@ -60,17 +61,17 @@ namespace CalamityMod.Projectiles.Ranged ModContent.DustType(), ModContent.DustType() }); - int astral = Dust.NewDust(projectile.position, 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); - Main.dust[astral].alpha = projectile.alpha; + int astral = Dust.NewDust(Projectile.position, 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); + Main.dust[astral].alpha = Projectile.alpha; Main.dust[astral].velocity *= 0f; Main.dust[astral].noGravity = true; } } if (speed == 0f) - speed = projectile.velocity.Length(); + speed = Projectile.velocity.Length(); - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, speed, 12f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, speed, 12f); return false; } diff --git a/Projectiles/Ranged/AstralSandgun.cs b/Projectiles/Ranged/AstralSandgun.cs index 8698047db5..3b424d8d6a 100644 --- a/Projectiles/Ranged/AstralSandgun.cs +++ b/Projectiles/Ranged/AstralSandgun.cs @@ -10,29 +10,29 @@ namespace CalamityMod.Projectiles.Ranged { public override void SetDefaults() { - projectile.knockBack = 6f; - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = -1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = -1; + Projectile.knockBack = 6f; + Projectile.width = 10; + Projectile.height = 10; + Projectile.aiStyle = -1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; base.SetDefaults(); - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void Kill(int timeLeft) { - int tileX = (int)(projectile.Center.X / 16f); - int tileY = (int)(projectile.Center.Y / 16f); + int tileX = (int)(Projectile.Center.X / 16f); + int tileY = (int)(Projectile.Center.Y / 16f); //Move the set tile upwards based on certain conditions - if (Main.tile[tileX, tileY].halfBrick() && projectile.velocity.Y > 0f && Math.Abs(projectile.velocity.Y) > Math.Abs(projectile.velocity.X)) + if (Main.tile[tileX, tileY].halfBrick() && Projectile.velocity.Y > 0f && Math.Abs(Projectile.velocity.Y) > Math.Abs(Projectile.velocity.X)) { tileY--; } if (!Main.tile[tileX, tileY].active()) { - if (Main.tile[tileX, tileY].type == TileID.MinecartTrack) + if (Main.tile[tileX, tileY].TileType == TileID.MinecartTrack) return; WorldGen.PlaceTile(tileX, tileY, ModContent.TileType(), false, true); @@ -44,14 +44,14 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.rand.NextBool(2)) { - int i = Dust.NewDust(projectile.position, projectile.width, projectile.height, 108, 0f, projectile.velocity.Y * 0.5f); + int i = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 108, 0f, Projectile.velocity.Y * 0.5f); Main.dust[i].velocity.X *= 0.2f; } - projectile.velocity.Y += 0.2f; - projectile.rotation += 0.1f; - if (projectile.velocity.Y > 10f) + Projectile.velocity.Y += 0.2f; + Projectile.rotation += 0.1f; + if (Projectile.velocity.Y > 10f) { - projectile.velocity.Y = 10f; + Projectile.velocity.Y = 10f; } base.AI(); } diff --git a/Projectiles/Ranged/AstrealArrow.cs b/Projectiles/Ranged/AstrealArrow.cs index fbff4391b6..b53760c3c5 100644 --- a/Projectiles/Ranged/AstrealArrow.cs +++ b/Projectiles/Ranged/AstrealArrow.cs @@ -12,67 +12,67 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Astreal Arrow"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 18; + Projectile.height = 18; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) + Projectile.scale -= 0.02f; + Projectile.alpha += 30; + if (Projectile.alpha >= 250) { - projectile.alpha = 255; - projectile.localAI[0] = 1f; + Projectile.alpha = 255; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) + Projectile.scale += 0.02f; + Projectile.alpha -= 30; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[0] = 0f; + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; } } - if (projectile.velocity.Length() < 16f) + if (Projectile.velocity.Length() < 16f) { - switch ((int)projectile.ai[0]) + switch ((int)Projectile.ai[0]) { case 0: - projectile.velocity.X *= 1.02f; + Projectile.velocity.X *= 1.02f; break; case 1: - projectile.velocity.Y *= 1.02f; + Projectile.velocity.Y *= 1.02f; break; case 2: - projectile.velocity.X += 0.1f; - projectile.velocity.Y *= 1.01f; + Projectile.velocity.X += 0.1f; + Projectile.velocity.Y *= 1.01f; break; case 3: - projectile.velocity.Y += 0.1f; - projectile.velocity.X *= 1.01f; + Projectile.velocity.Y += 0.1f; + Projectile.velocity.X *= 1.01f; break; default: break; @@ -80,23 +80,23 @@ namespace CalamityMod.Projectiles.Ranged } if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - projectile.ai[1] += Main.rand.Next(2) + 1; - if (projectile.ai[1] >= 135f) + Projectile.ai[1] += Main.rand.Next(2) + 1; + if (Projectile.ai[1] >= 135f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - if (projectile.owner == Main.myPlayer) + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, projectile.velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Ranged/AstrealFlame.cs b/Projectiles/Ranged/AstrealFlame.cs index 79bf2c0859..fecbab9a2b 100644 --- a/Projectiles/Ranged/AstrealFlame.cs +++ b/Projectiles/Ranged/AstrealFlame.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -12,49 +13,49 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.alpha = 255; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.alpha = 255; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.alpha -= 5; + Projectile.alpha -= 5; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 20f); } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 48; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 74); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 48; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 74); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -64,10 +65,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 15; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Ranged/AuralisBullet.cs b/Projectiles/Ranged/AuralisBullet.cs index 2454c66814..71a4f31e3b 100644 --- a/Projectiles/Ranged/AuralisBullet.cs +++ b/Projectiles/Ranged/AuralisBullet.cs @@ -17,29 +17,29 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 5; - projectile.alpha = 255; - projectile.timeLeft = 200; - projectile.extraUpdates = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 5; + Projectile.alpha = 255; + Projectile.timeLeft = 200; + Projectile.extraUpdates = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 6f) { for (int d = 0; d < 5; d++) { - Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X, projectile.velocity.Y, 100, CalamityUtils.ColorSwap(Auralis.blueColor, Auralis.greenColor, 1f), 1f)]; + Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, Projectile.velocity.X, Projectile.velocity.Y, 100, CalamityUtils.ColorSwap(Auralis.blueColor, Auralis.greenColor, 1f), 1f)]; dust.velocity = Vector2.Zero; - dust.position -= projectile.velocity / 5f * d; + dust.position -= Projectile.velocity / 5f * d; dust.noGravity = true; dust.scale = 0.65f; dust.noLight = true; diff --git a/Projectiles/Ranged/AuroraFire.cs b/Projectiles/Ranged/AuroraFire.cs index 7aa08245a3..0a1e405627 100644 --- a/Projectiles/Ranged/AuroraFire.cs +++ b/Projectiles/Ranged/AuroraFire.cs @@ -22,41 +22,41 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - if (projectile.ai[0] % 2 == 0) - projectile.ai[0]++; + if (Projectile.ai[0] % 2 == 0) + Projectile.ai[0]++; if (!initialized) { - int pointCount = (int)projectile.ai[0]; + int pointCount = (int)Projectile.ai[0]; radianAmt = 180 + (int)(360 / (pointCount * 2)); - projectile.timeLeft = framesBeforeTurning * pointCount - 1; + Projectile.timeLeft = framesBeforeTurning * pointCount - 1; initialized = true; } //Velocity movement - projectile.localAI[1]++; - if (projectile.localAI[1] % framesBeforeTurning == 0) + Projectile.localAI[1]++; + if (Projectile.localAI[1] % framesBeforeTurning == 0) { - projectile.velocity = projectile.velocity.RotatedBy(MathHelper.ToRadians(radianAmt)); + Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.ToRadians(radianAmt)); } //Dust behavior - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { int dustType = Utils.SelectRandom(Main.rand, new int[] { @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged }); for (int i = 0; i < 5; i++) { - int astral = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f); + int astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.8f); Dust dust = Main.dust[astral]; dust.noGravity = true; dust.velocity *= 0f; @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Ranged } //rotation code for when sproot - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/BallistaGreatArrow.cs b/Projectiles/Ranged/BallistaGreatArrow.cs index 9ec0fdc764..882dced2e5 100644 --- a/Projectiles/Ranged/BallistaGreatArrow.cs +++ b/Projectiles/Ranged/BallistaGreatArrow.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class BallistaGreatArrow : ModProjectile @@ -12,57 +13,57 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Ballista Great Arrow"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 2; - projectile.aiStyle = 1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 2; + Projectile.aiStyle = 1; aiType = ProjectileID.WoodenArrowFriendly; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 12; + target.immune[Projectile.owner] = 12; target.AddBuff(ModContent.BuffType(), 180); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 14); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 14); float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 3; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.2), projectile.knockBack / 5, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.2), projectile.knockBack / 5, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.2), Projectile.knockBack / 5, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.2), Projectile.knockBack / 5, Projectile.owner, 0f, 0f); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/BeeRPG.cs b/Projectiles/Ranged/BeeRPG.cs index def5781353..9cc06354ef 100644 --- a/Projectiles/Ranged/BeeRPG.cs +++ b/Projectiles/Ranged/BeeRPG.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -19,12 +20,12 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 95; + Projectile.DamageType = DamageClass.Ranged; } private static void DefineFalseLauncher() @@ -36,7 +37,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { for (int num246 = 0; num246 < 2; num246++) { @@ -44,70 +45,70 @@ namespace CalamityMod.Projectiles.Ranged float num248 = 0f; if (num246 == 1) { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; + num247 = Projectile.velocity.X * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + if (Math.Abs(Projectile.velocity.X) < 15f && Math.Abs(Projectile.velocity.Y) < 15f) { - projectile.velocity *= 2f; + Projectile.velocity *= 2f; } else if (Main.rand.NextBool(2)) { - int num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + int num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 32); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - if (projectile.owner == Main.myPlayer) + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 32); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + if (Projectile.owner == Main.myPlayer) { int num516 = 12; for (int num517 = 0; num517 < num516; num517++) { if (num517 % 2 != 1 || Main.rand.NextBool(3)) { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; + Vector2 value20 = Projectile.position; + Vector2 value21 = Projectile.oldVelocity; value21.Normalize(); value21 *= 8f; float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; value20 -= value21 * (float)num517; - num518 += projectile.oldVelocity.X / 6f; - num519 += projectile.oldVelocity.Y / 6f; - int bee = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 4), Main.player[projectile.owner].beeKB(0f), Main.myPlayer); + num518 += Projectile.oldVelocity.X / 6f; + num519 += Projectile.oldVelocity.Y / 6f; + int bee = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 4), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); if (bee.WithinBounds(Main.maxProjectiles)) { Main.projectile[bee].penetrate = 2; @@ -116,10 +117,10 @@ namespace CalamityMod.Projectiles.Ranged } } } - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 14); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -129,18 +130,18 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); // Construct a fake item to use with vanilla code for the sake of picking ammo. if (FalseLauncher is null) DefineFalseLauncher(); - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int projID = ProjectileID.RocketI; float shootSpeed = 0f; bool canShoot = true; @@ -153,11 +154,11 @@ namespace CalamityMod.Projectiles.Ranged else if (projID == ProjectileID.RocketIV) blastRadius = 6; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 14); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 14); - if (projectile.owner == Main.myPlayer && blastRadius > 0) + if (Projectile.owner == Main.myPlayer && blastRadius > 0) { - CalamityUtils.ExplodeandDestroyTiles(projectile, blastRadius, true, new List() { }, new List() { }); + CalamityUtils.ExplodeandDestroyTiles(Projectile, blastRadius, true, new List() { }, new List() { }); } } diff --git a/Projectiles/Ranged/BigCoral.cs b/Projectiles/Ranged/BigCoral.cs index 8bd9aa79a2..4f38da8abd 100644 --- a/Projectiles/Ranged/BigCoral.cs +++ b/Projectiles/Ranged/BigCoral.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -15,36 +16,36 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 18; - projectile.height = 34; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 18; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.aiStyle = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.velocity.X *= 0.999f; - projectile.velocity.Y = projectile.velocity.Y + 0.025f; - projectile.rotation = projectile.velocity.ToRotation(); - if (projectile.direction == -1) - projectile.rotation += MathHelper.Pi; + Projectile.velocity.X *= 0.999f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.025f; + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.direction == -1) + Projectile.rotation += MathHelper.Pi; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 10); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 32; - projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 10); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 32; + Projectile.height = 32; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 51, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 51, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; } diff --git a/Projectiles/Ranged/BigNuke.cs b/Projectiles/Ranged/BigNuke.cs index f7f75963af..1f25e215a3 100644 --- a/Projectiles/Ranged/BigNuke.cs +++ b/Projectiles/Ranged/BigNuke.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -13,16 +14,16 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Big Nuke"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = projectile.height = 16; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; + Projectile.width = Projectile.height = 16; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 95; + Projectile.DamageType = DamageClass.Ranged; } private static void DefineFalseLauncher() @@ -34,27 +35,27 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - Main.PlaySound(SoundID.Item11, (int)projectile.Center.X, (int)projectile.Center.Y); - projectile.ai[0] = 1f; + SoundEngine.PlaySound(SoundID.Item11, (int)Projectile.Center.X, (int)Projectile.Center.Y); + Projectile.ai[0] = 1f; } //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 7) + Projectile.frameCounter++; + if (Projectile.frameCounter > 7) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.velocity.Length() >= 8f) + if (Projectile.velocity.Length() >= 8f) { for (int num246 = 0; num246 < 2; num246++) { @@ -62,40 +63,40 @@ namespace CalamityMod.Projectiles.Ranged float num248 = 0f; if (num246 == 1) { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; + num247 = Projectile.velocity.X * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 720); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 720); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 14); for (int num621 = 0; num621 < 90; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -105,18 +106,18 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 180; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 9); + CalamityUtils.ExplosionGores(Projectile.Center, 9); // Construct a fake item to use with vanilla code for the sake of picking ammo. if (FalseLauncher is null) DefineFalseLauncher(); - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int projID = ProjectileID.RocketI; float shootSpeed = 0f; bool canShoot = true; @@ -124,11 +125,11 @@ namespace CalamityMod.Projectiles.Ranged float kb = 0f; player.PickAmmo(FalseLauncher, ref projID, ref shootSpeed, ref canShoot, ref damage, ref kb, true); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 16); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 16); - if (projectile.owner == Main.myPlayer && (projID == ProjectileID.RocketII || projID == ProjectileID.RocketIV)) + if (Projectile.owner == Main.myPlayer && (projID == ProjectileID.RocketII || projID == ProjectileID.RocketIV)) { - CalamityUtils.ExplodeandDestroyTiles(projectile, 23, true, new List() { }, new List() { }); + CalamityUtils.ExplodeandDestroyTiles(Projectile, 23, true, new List() { }, new List() { }); } } } diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index dc2e121b0f..4eca09899e 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -20,54 +21,54 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.scale = 2f; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 5; - projectile.timeLeft = 300; + Projectile.width = 6; + Projectile.height = 6; + Projectile.scale = 2f; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; + Projectile.timeLeft = 300; } public override void AI() { if (!playedSound) { - Main.PlaySound(SoundID.Item34, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item34, (int)Projectile.position.X, (int)Projectile.position.Y); playedSound = true; } - if (projectile.scale <= 3f) - projectile.scale *= 1.01f; + if (Projectile.scale <= 3f) + Projectile.scale *= 1.01f; - Lighting.AddLight(projectile.Center, 1f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 1f, 0f, 0f); - if (projectile.ai[0] > 7f) + if (Projectile.ai[0] > 7f) { float num296 = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { num296 = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { num296 = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num297 = 5; if (Main.rand.NextBool(2)) { for (int num298 = 0; num298 < 1; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { @@ -83,7 +84,7 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; dust.scale *= num296; - dust.velocity += projectile.velocity; + dust.velocity += Projectile.velocity; if (!dust.noGravity) { dust.velocity *= 0.5f; @@ -93,70 +94,70 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; - if (projectile.timeLeft == 160) - projectile.ai[1] = 1f; + if (Projectile.timeLeft == 160) + Projectile.ai[1] = 1f; - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.tileCollide = false; + Projectile.tileCollide = false; - projectile.extraUpdates = 2; + Projectile.extraUpdates = 2; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; // Delete the projectile if it's excessively far away. Vector2 playerCenter = player.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); dist = 20f / dist; xDist *= dist; yDist *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) + if (Projectile.velocity.X < xDist) { - projectile.velocity.X = projectile.velocity.X + 5f; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += 5f; + Projectile.velocity.X = Projectile.velocity.X + 5f; + if (Projectile.velocity.X < 0f && xDist > 0f) + Projectile.velocity.X += 5f; } - else if (projectile.velocity.X > xDist) + else if (Projectile.velocity.X > xDist) { - projectile.velocity.X = projectile.velocity.X - 5f; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= 5f; + Projectile.velocity.X = Projectile.velocity.X - 5f; + if (Projectile.velocity.X > 0f && xDist < 0f) + Projectile.velocity.X -= 5f; } - if (projectile.velocity.Y < yDist) + if (Projectile.velocity.Y < yDist) { - projectile.velocity.Y = projectile.velocity.Y + 5f; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += 5f; + Projectile.velocity.Y = Projectile.velocity.Y + 5f; + if (Projectile.velocity.Y < 0f && yDist > 0f) + Projectile.velocity.Y += 5f; } - else if (projectile.velocity.Y > yDist) + else if (Projectile.velocity.Y > yDist) { - projectile.velocity.Y = projectile.velocity.Y - 5f; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= 5f; + Projectile.velocity.Y = Projectile.velocity.Y - 5f; + if (Projectile.velocity.Y > 0f && yDist < 0f) + Projectile.velocity.Y -= 5f; } // Delete the projectile if it touches its owner. Has a chance to heal the player again - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - if (projectile.Hitbox.Intersects(player.Hitbox)) + if (Projectile.Hitbox.Intersects(player.Hitbox)) { - if (Main.rand.NextBool(3) && !Main.player[projectile.owner].moonLeech) + if (Main.rand.NextBool(3) && !Main.player[Projectile.owner].moonLeech) { player.statLife += 1; player.HealEffect(1); } - projectile.Kill(); + Projectile.Kill(); } } } @@ -167,10 +168,10 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(ModContent.BuffType(), 240); target.AddBuff(ModContent.BuffType(), 240); - if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) + if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) return; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (Main.rand.NextBool(2)) { int healAmt = Main.rand.Next(1, 4); diff --git a/Projectiles/Ranged/BloodClotFriendly.cs b/Projectiles/Ranged/BloodClotFriendly.cs index d6d50cc43f..95225f959c 100644 --- a/Projectiles/Ranged/BloodClotFriendly.cs +++ b/Projectiles/Ranged/BloodClotFriendly.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,32 +12,32 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Clot"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.aiStyle = 1; + Projectile.extraUpdates = 3; aiType = ProjectileID.Bullet; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 2; num468++) { - Vector2 dspeed = -projectile.velocity * 0.7f; - int num469 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, dspeed.X, dspeed.Y, 100, default, 2f); + Vector2 dspeed = -Projectile.velocity * 0.7f; + int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 5, dspeed.X, dspeed.Y, 100, default, 2f); Main.dust[num469].noGravity = true; } } @@ -44,14 +45,14 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } } diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index a369d39e24..c203200b4b 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -7,6 +7,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -17,64 +18,64 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Bloodfire Arrow"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - MathHelper.ToRadians(90); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.ToRadians(90); - if (projectile.timeLeft % 15 == 0) + if (Projectile.timeLeft % 15 == 0) { for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } - if (projectile.ai[1] == 80f) //means it's from Arterial Assault's wooden arrow conversion - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + if (Projectile.ai[1] == 80f) //means it's from Arterial Assault's wooden arrow conversion + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } public override void Kill(int timeLeft) { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 20; + Projectile.height = 20; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 0.5f; if (Main.rand.NextBool(2)) { @@ -88,10 +89,10 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 180); - if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) + if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) return; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int chance = 3; if (player.ActiveItem().type == ModContent.ItemType()) @@ -106,7 +107,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/BloodfireBulletProj.cs b/Projectiles/Ranged/BloodfireBulletProj.cs index a22bd17b5a..9fedd7f236 100644 --- a/Projectiles/Ranged/BloodfireBulletProj.cs +++ b/Projectiles/Ranged/BloodfireBulletProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -13,41 +14,41 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Bloodfire Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ranged = true; - projectile.extraUpdates = 4; - projectile.timeLeft = Lifetime; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 4; + Projectile.timeLeft = Lifetime; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.spriteDirection = projectile.direction; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.spriteDirection = Projectile.direction; // Lighting - Lighting.AddLight(projectile.Center, 0.9f, 0f, 0.15f); + Lighting.AddLight(Projectile.Center, 0.9f, 0f, 0.15f); // Dust - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { int dustID = 90; float scale = Main.rand.NextFloat(0.6f, 0.9f); - Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, dustID); - Vector2 posOffset = projectile.velocity.SafeNormalize(Vector2.Zero) * 12f; + Dust d = Dust.NewDustDirect(Projectile.Center, 0, 0, dustID); + Vector2 posOffset = Projectile.velocity.SafeNormalize(Vector2.Zero) * 12f; d.position += posOffset - 2f * Vector2.UnitY; d.noGravity = true; d.velocity *= 0.6f; - d.velocity += projectile.velocity * 0.15f; + d.velocity += Projectile.velocity * 0.15f; d.scale = scale; } } @@ -57,12 +58,12 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) => damage += OnHitEffect(Main.player[projectile.owner]); - public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) => damage += OnHitEffect(Main.player[projectile.owner]); + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) => damage += OnHitEffect(Main.player[Projectile.owner]); + public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) => damage += OnHitEffect(Main.player[Projectile.owner]); // Returns the amount of bonus damage that should be dealt. Boosts life regeneration appropriately as a side effect. private int OnHitEffect(Player owner) @@ -87,13 +88,13 @@ namespace CalamityMod.Projectiles.Ranged int dustID = 90; int dustCount = 3; for(int i = 0; i < dustCount; ++i) - _ = Dust.NewDust(projectile.Center, 0, 0, dustID, Scale: 1.2f); + _ = Dust.NewDust(Projectile.Center, 0, 0, dustID, Scale: 1.2f); } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Item10, projectile.Center); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); return true; } } diff --git a/Projectiles/Ranged/BloodflareSoul.cs b/Projectiles/Ranged/BloodflareSoul.cs index 89addc3260..0be623eff8 100644 --- a/Projectiles/Ranged/BloodflareSoul.cs +++ b/Projectiles/Ranged/BloodflareSoul.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -12,78 +13,78 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 1.2f; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 900; + Projectile.width = 30; + Projectile.height = 30; + Projectile.scale = 1.2f; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.timeLeft = 900; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, 0f, 0f, 0, default, 1f); + int num822 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 60, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; Main.dust[num822].scale = 1.3f; Main.dust[num822].noGravity = true; - float num953 = 30f * projectile.ai[1]; //100 - float scaleFactor12 = 6f * projectile.ai[1]; //5 + float num953 = 30f * Projectile.ai[1]; //100 + float scaleFactor12 = 6f * Projectile.ai[1]; //5 float num954 = 600f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + if (Projectile.Distance(Main.player[Projectile.owner].Center) > num954) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 11f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 11f, 20f); } else { - if (projectile.timeLeft > 30) + if (Projectile.timeLeft > 30) { - projectile.timeLeft = 30; + Projectile.timeLeft = 30; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -92,23 +93,23 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 39, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = projectile.height = 110; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 39, 1f, 0f); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 110; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 60, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 2f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.Damage(); + Projectile.Damage(); } } } diff --git a/Projectiles/Ranged/BlueExoArrow.cs b/Projectiles/Ranged/BlueExoArrow.cs index 73d739d372..3f6f88db72 100644 --- a/Projectiles/Ranged/BlueExoArrow.cs +++ b/Projectiles/Ranged/BlueExoArrow.cs @@ -15,51 +15,51 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.arrow = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } float num55 = 40f; float num56 = 1.5f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); } } } - public override Color? GetAlpha(Color lightColor) => new Color(0, 0, 250, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(0, 0, 250, Projectile.alpha); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(40f, 1.5f, lightColor); public override void OnHitPvp(Player target, int damage, bool crit) { @@ -77,9 +77,9 @@ namespace CalamityMod.Projectiles.Ranged { for (int x = 0; x < 3; x++) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(2), 500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.7), projectile.knockBack * 0.7f, projectile.owner); + CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, Main.rand.NextBool(2), 500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.7f, Projectile.owner); } } } diff --git a/Projectiles/Ranged/BlueExoArrow2.cs b/Projectiles/Ranged/BlueExoArrow2.cs index e1b2a0fc1d..52e0267e8d 100644 --- a/Projectiles/Ranged/BlueExoArrow2.cs +++ b/Projectiles/Ranged/BlueExoArrow2.cs @@ -14,50 +14,50 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.timeLeft = 300; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.arrow = true; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 5; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } float num55 = 40f; float num56 = 1.5f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); } } } - public override Color? GetAlpha(Color lightColor) => new Color(0, 0, 250, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(0, 0, 250, Projectile.alpha); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(40f, 1.5f, lightColor); } } diff --git a/Projectiles/Ranged/Bolt.cs b/Projectiles/Ranged/Bolt.cs index de477a1ebe..84f12776b2 100644 --- a/Projectiles/Ranged/Bolt.cs +++ b/Projectiles/Ranged/Bolt.cs @@ -11,49 +11,49 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - projectile.velocity *= 1.015f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (projectile.timeLeft % 30 == 0) + Projectile.velocity *= 1.015f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.timeLeft % 30 == 0) { for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -62,25 +62,25 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 32; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); int num212 = Main.rand.Next(4, 8); for (int num213 = 0; num213 < num212; num213++) { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + int num214 = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); Main.dust[num214].velocity *= 2f; Main.dust[num214].noGravity = true; } diff --git a/Projectiles/Ranged/BoltArrow.cs b/Projectiles/Ranged/BoltArrow.cs index ebb0970a1c..5f2bb140dc 100644 --- a/Projectiles/Ranged/BoltArrow.cs +++ b/Projectiles/Ranged/BoltArrow.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -15,62 +16,62 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 15f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 15f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage = (int)(projectile.damage * 0.6f); - projectile.Damage(); - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 92); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 32; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage = (int)(Projectile.damage * 0.6f); + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 92); int num212 = Main.rand.Next(10, 20); for (int num213 = 0; num213 < num212; num213++) { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + int num214 = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); Main.dust[num214].velocity *= 2f; Main.dust[num214].noGravity = true; } diff --git a/Projectiles/Ranged/BouncingShotgunPellet.cs b/Projectiles/Ranged/BouncingShotgunPellet.cs index 5c4e2a90ed..131d0b40a8 100644 --- a/Projectiles/Ranged/BouncingShotgunPellet.cs +++ b/Projectiles/Ranged/BouncingShotgunPellet.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class BouncingShotgunPellet : ModProjectile @@ -15,52 +16,52 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.ranged = true; - projectile.friendly = true; - projectile.aiStyle = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Ranged; + Projectile.friendly = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.timeLeft = 180; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.timeLeft = 180; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override bool OnTileCollide(Vector2 oldVelocity) { bounce--; if (bounce <= 0) - projectile.Kill(); + Projectile.Kill(); else { - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; - Main.PlaySound(SoundID.Item10, projectile.Center); - projectile.damage /= 2; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + Projectile.damage /= 2; } return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => Main.PlaySound(SoundID.Item10, projectile.Center); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - public override void OnHitPvp(Player target, int damage, bool crit) => Main.PlaySound(SoundID.Item10, projectile.Center); + public override void OnHitPvp(Player target, int damage, bool crit) => SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 32); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 32); for (int d = 0; d < 2; d++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); } for (int d = 0; d < 20; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 0, default, 2.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 0, default, 2.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1.5f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 1.5f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Ranged/BrimstoneBallFriendly.cs b/Projectiles/Ranged/BrimstoneBallFriendly.cs index 5d225898ab..52a1939484 100644 --- a/Projectiles/Ranged/BrimstoneBallFriendly.cs +++ b/Projectiles/Ranged/BrimstoneBallFriendly.cs @@ -14,24 +14,24 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.scale = 1.2f; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 6; - projectile.aiStyle = 14; - projectile.timeLeft = 300; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1.2f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 6; + Projectile.aiStyle = 14; + Projectile.timeLeft = 300; } public override void AI() { - projectile.rotation += 0.12f * projectile.direction; - Lighting.AddLight(projectile.Center, 0.25f, 0f, 0f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.rotation += 0.12f * Projectile.direction; + Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0f); + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 150, default, 1.5f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 150, default, 1.5f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; @@ -40,29 +40,29 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; } return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Ranged/BrimstoneBolt.cs b/Projectiles/Ranged/BrimstoneBolt.cs index 0a1ef6d594..e808b3821a 100644 --- a/Projectiles/Ranged/BrimstoneBolt.cs +++ b/Projectiles/Ranged/BrimstoneBolt.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -18,39 +19,39 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 300; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 300; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); } - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 15; + Projectile.alpha -= 15; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - Lighting.AddLight(projectile.Center, 0.7f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.7f, 0f, 0f); for (int num121 = 0; num121 < 5; num121++) { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + Dust dust4 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; dust4.velocity = Vector2.Zero; - dust4.position -= projectile.velocity / 5f * (float)num121; + dust4.position -= Projectile.velocity / 5f * (float)num121; dust4.noGravity = true; dust4.scale = 0.8f; dust4.noLight = true; diff --git a/Projectiles/Ranged/BrimstoneFireFriendly.cs b/Projectiles/Ranged/BrimstoneFireFriendly.cs index 2ca12f0bac..8156d87b66 100644 --- a/Projectiles/Ranged/BrimstoneFireFriendly.cs +++ b/Projectiles/Ranged/BrimstoneFireFriendly.cs @@ -15,45 +15,45 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 90; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - if (projectile.timeLeft > 90) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); + if (Projectile.timeLeft > 90) { - projectile.timeLeft = 90; + Projectile.timeLeft = 90; } - if (projectile.ai[0] > 7f) + if (Projectile.ai[0] > 7f) { float num296 = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { num296 = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { num296 = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num297 = 235; if (Main.rand.NextBool(2)) { for (int num298 = 0; num298 < 1; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); if (Main.rand.NextBool(3)) { Main.dust[num299].noGravity = true; @@ -77,14 +77,14 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[Projectile.owner] = 7; target.AddBuff(ModContent.BuffType(), 240); } } diff --git a/Projectiles/Ranged/ButcherGun.cs b/Projectiles/Ranged/ButcherGun.cs index 7cf00ca114..c74b594d2a 100644 --- a/Projectiles/Ranged/ButcherGun.cs +++ b/Projectiles/Ranged/ButcherGun.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -17,86 +18,86 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 66; - projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 66; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.ai[0] += 1f; + Player player = Main.player[Projectile.owner]; + Projectile.ai[0] += 1f; int incrementAmt = 0; float spreadMult = 0.15f; - if (projectile.ai[0] >= 80f) + if (Projectile.ai[0] >= 80f) { incrementAmt++; spreadMult = 0.13f; } - if (projectile.ai[0] >= 160f) + if (Projectile.ai[0] >= 160f) { incrementAmt++; spreadMult = 0.11f; } - if (projectile.ai[0] >= 240f) + if (Projectile.ai[0] >= 240f) { incrementAmt++; spreadMult = 0.09f; } - if (projectile.ai[0] >= 320f) + if (Projectile.ai[0] >= 320f) { incrementAmt++; spreadMult = 0.07f; } - if (projectile.ai[0] >= 400f) + if (Projectile.ai[0] >= 400f) { incrementAmt++; spreadMult = 0.05f; } - if (projectile.ai[0] >= 480f) + if (Projectile.ai[0] >= 480f) { incrementAmt++; spreadMult = 0.04f; } - if (projectile.ai[0] >= 560f) + if (Projectile.ai[0] >= 560f) { incrementAmt++; spreadMult = 0.03f; } - if (projectile.ai[0] >= 640f) //8 + if (Projectile.ai[0] >= 640f) //8 { incrementAmt++; spreadMult = 0.02f; } int shootDelayBase = 40; int incrementMult = 3; - projectile.ai[1] -= 1f; + Projectile.ai[1] -= 1f; bool willShoot = false; - if (projectile.ai[1] <= 0f) + if (Projectile.ai[1] <= 0f) { - projectile.ai[1] = (float)(shootDelayBase - incrementMult * incrementAmt); + Projectile.ai[1] = (float)(shootDelayBase - incrementMult * incrementAmt); willShoot = true; } bool canShoot = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; - if (projectile.localAI[0] > 0f) + if (Projectile.localAI[0] > 0f) { - projectile.localAI[0] -= 1f; + Projectile.localAI[0] -= 1f; } - if (projectile.soundDelay <= 0 && canShoot) + if (Projectile.soundDelay <= 0 && canShoot) { - projectile.soundDelay = shootDelayBase - incrementMult * incrementAmt; - if (projectile.ai[0] != 1f) + Projectile.soundDelay = shootDelayBase - incrementMult * incrementAmt; + if (Projectile.ai[0] != 1f) { - Main.PlaySound(SoundID.Item38, projectile.position); + SoundEngine.PlaySound(SoundID.Item38, Projectile.position); } - projectile.localAI[0] = 12f; + Projectile.localAI[0] = 12f; } Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); - if (willShoot && Main.myPlayer == projectile.owner) + if (willShoot && Main.myPlayer == Projectile.owner) { int projType = ProjectileID.Bullet; float speedMult = 14f; @@ -106,7 +107,7 @@ namespace CalamityMod.Projectiles.Ranged { 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; + float speed = player.ActiveItem().shootSpeed * Projectile.scale; Vector2 targetPos = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - source; if (player.gravDir == -1f) { @@ -118,15 +119,15 @@ namespace CalamityMod.Projectiles.Ranged velMult = -Vector2.UnitY; } velMult *= speed; - if (velMult.X != projectile.velocity.X || velMult.Y != projectile.velocity.Y) + if (velMult.X != Projectile.velocity.X || velMult.Y != Projectile.velocity.Y) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity = velMult * 0.55f; + Projectile.velocity = velMult * 0.55f; int randomBulletCount = Main.rand.Next(3, 5); //3 to 4 bullets for (int projIndex = 0; projIndex < randomBulletCount; projIndex++) { - Vector2 bulletVel = Vector2.Normalize(projectile.velocity) * speedMult * (0.6f + Main.rand.NextFloat() * spreadMult); + Vector2 bulletVel = Vector2.Normalize(Projectile.velocity) * speedMult * (0.6f + Main.rand.NextFloat() * spreadMult); if (float.IsNaN(bulletVel.X) || float.IsNaN(bulletVel.Y)) { bulletVel = -Vector2.UnitY; @@ -134,30 +135,30 @@ namespace CalamityMod.Projectiles.Ranged source += Utils.RandomVector2(Main.rand, -5f, 5f); bulletVel.X += (float)Main.rand.Next(-15, 16) * spreadMult; bulletVel.Y += (float)Main.rand.Next(-15, 16) * spreadMult; - int num44 = Projectile.NewProjectile(source, bulletVel, projType, damage, kback, projectile.owner, 0f, 0f); + int num44 = Projectile.NewProjectile(source, bulletVel, projType, damage, kback, Projectile.owner, 0f, 0f); Main.projectile[num44].noDropItem = true; Main.projectile[num44].extraUpdates += incrementAmt / 2; //0 to 4 } } else { - projectile.Kill(); + Projectile.Kill(); } } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; float rotationAmt = 0f; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { rotationAmt = MathHelper.Pi; } - projectile.rotation = projectile.velocity.ToRotation() + rotationAmt; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.rotation = Projectile.velocity.ToRotation() + rotationAmt; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); } public override bool CanDamage() => false; diff --git a/Projectiles/Ranged/CardClub.cs b/Projectiles/Ranged/CardClub.cs index ed72dc9786..8de0af6d36 100644 --- a/Projectiles/Ranged/CardClub.cs +++ b/Projectiles/Ranged/CardClub.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class CardClub : ModProjectile @@ -11,32 +12,32 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Club"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); - projectile.rotation -= (MathHelper.ToRadians(90) * projectile.direction); - projectile.spriteDirection = projectile.direction; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f); + Projectile.rotation -= (MathHelper.ToRadians(90) * Projectile.direction); + Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool(2)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; } @@ -44,8 +45,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } @@ -53,10 +54,10 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = -8; i <= 8; i += 8) { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.ToRadians(i)); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner, 0f, 0f); } - Main.PlaySound(SoundID.Item110, projectile.Center); + SoundEngine.PlaySound(SoundID.Item110, Projectile.Center); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -66,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/CardClubSplit.cs b/Projectiles/Ranged/CardClubSplit.cs index d9e3fdb2e5..04630ac6d5 100644 --- a/Projectiles/Ranged/CardClubSplit.cs +++ b/Projectiles/Ranged/CardClubSplit.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class CardClubSplit : ModProjectile @@ -11,46 +12,46 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Club"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); - projectile.rotation -= (MathHelper.ToRadians(90) * projectile.direction); - projectile.spriteDirection = projectile.direction; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f); + Projectile.rotation -= (MathHelper.ToRadians(90) * Projectile.direction); + Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool(2)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; } - if (projectile.alpha < 128) + if (Projectile.alpha < 128) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } @@ -58,7 +59,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 2; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 30, projectile.oldVelocity.X * 0.15f, projectile.oldVelocity.Y * 0.15f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 30, Projectile.oldVelocity.X * 0.15f, Projectile.oldVelocity.Y * 0.15f); } } @@ -69,13 +70,13 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override bool CanDamage() { - return projectile.alpha < 128; + return Projectile.alpha < 128; } } } diff --git a/Projectiles/Ranged/CardDiamond.cs b/Projectiles/Ranged/CardDiamond.cs index 982b53758e..2eb774139d 100644 --- a/Projectiles/Ranged/CardDiamond.cs +++ b/Projectiles/Ranged/CardDiamond.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class CardDiamond : ModProjectile @@ -11,32 +12,32 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Diamond"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); - projectile.rotation -= (MathHelper.ToRadians(90) * projectile.direction); - projectile.spriteDirection = projectile.direction; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f); + Projectile.rotation -= (MathHelper.ToRadians(90) * Projectile.direction); + Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool(2)) { - int num137 = Dust.NewDust(projectile.position, 1, 1, 30, 0f, 0f, 0, default, 0.5f); + int num137 = Dust.NewDust(Projectile.position, 1, 1, 30, 0f, 0f, 0, default, 0.5f); Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; } @@ -44,24 +45,24 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 50; - projectile.Center = projectile.position; - projectile.maxPenetrate = projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.Center); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 50; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int d = 0; d < 10; d++) { - int paper = Dust.NewDust(projectile.position, projectile.width, projectile.height, 30, 0f, 0f, 100, default, 2f); + int paper = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 30, 0f, 0f, 100, default, 2f); Main.dust[paper].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -71,13 +72,13 @@ namespace CalamityMod.Projectiles.Ranged } for (int d = 0; d < 15; d++) { - int paper = Dust.NewDust(projectile.position, projectile.width, projectile.height, 30, 0f, 0f, 100, default, 3f); + int paper = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 30, 0f, 0f, 100, default, 3f); Main.dust[paper].noGravity = true; Main.dust[paper].velocity *= 5f; - paper = Dust.NewDust(projectile.position, projectile.width, projectile.height, 30, 0f, 0f, 100, default, 2f); + paper = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 30, 0f, 0f, 100, default, 2f); Main.dust[paper].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -87,7 +88,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index d0cc0c7579..a8ee500af3 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class CardHeart : ModProjectile @@ -11,32 +12,32 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Heart"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); - projectile.rotation -= (MathHelper.ToRadians(90) * projectile.direction); - projectile.spriteDirection = projectile.direction; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f); + Projectile.rotation -= (MathHelper.ToRadians(90) * Projectile.direction); + Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool(2)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; } @@ -44,8 +45,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 2; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 30, projectile.oldVelocity.X * 0.15f, projectile.oldVelocity.Y * 0.15f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 30, Projectile.oldVelocity.X * 0.15f, Projectile.oldVelocity.Y * 0.15f); } } @@ -61,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 120); - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player.moonLeech) return; @@ -71,7 +72,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/CardSpade.cs b/Projectiles/Ranged/CardSpade.cs index e1a4292862..09dc6ff955 100644 --- a/Projectiles/Ranged/CardSpade.cs +++ b/Projectiles/Ranged/CardSpade.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class CardSpade : ModProjectile @@ -11,34 +12,34 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Spade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); - projectile.rotation -= (MathHelper.ToRadians(90) * projectile.direction); - projectile.spriteDirection = projectile.direction; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f); + Projectile.rotation -= (MathHelper.ToRadians(90) * Projectile.direction); + Projectile.spriteDirection = Projectile.direction; if (Main.rand.NextBool(2)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; } @@ -46,8 +47,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } @@ -55,7 +56,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 2; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 30, projectile.oldVelocity.X * 0.15f, projectile.oldVelocity.Y * 0.15f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 30, Projectile.oldVelocity.X * 0.15f, Projectile.oldVelocity.Y * 0.15f); } } @@ -66,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/ChargedBlast.cs b/Projectiles/Ranged/ChargedBlast.cs index 832f01e52d..283ec0563f 100644 --- a/Projectiles/Ranged/ChargedBlast.cs +++ b/Projectiles/Ranged/ChargedBlast.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ChargedBlast : ModProjectile @@ -16,44 +17,44 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.extraUpdates = 3; + Projectile.alpha = 255; + Projectile.timeLeft = 600; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0f, 0.3f, 0.7f); float num55 = 100f; float num56 = 3f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); return; } } @@ -61,18 +62,18 @@ namespace CalamityMod.Projectiles.Ranged public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(100f, 3f, lightColor); public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item62, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item62, (int)Projectile.position.X, (int)Projectile.position.Y); int projectiles = Main.rand.Next(2, 5); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int k = 0; k < projectiles; k++) { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, (float)Main.rand.Next(-10, 11) * 2f, (float)Main.rand.Next(-10, 11) * 2f, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.85), (float)(int)((double)projectile.knockBack * 0.5), Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, (float)Main.rand.Next(-10, 11) * 2f, (float)Main.rand.Next(-10, 11) * 2f, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.85), (float)(int)((double)Projectile.knockBack * 0.5), Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Ranged/ChargedBlast2.cs b/Projectiles/Ranged/ChargedBlast2.cs index 6a57cc9aba..45e43e344e 100644 --- a/Projectiles/Ranged/ChargedBlast2.cs +++ b/Projectiles/Ranged/ChargedBlast2.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ChargedBlast2 : ModProjectile @@ -16,43 +17,43 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 3; - projectile.extraUpdates = 2; - projectile.alpha = 255; - projectile.timeLeft = 200; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 3; + Projectile.extraUpdates = 2; + Projectile.alpha = 255; + Projectile.timeLeft = 200; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0f, 0.3f, 0.7f); float num55 = 30f; float num56 = 1f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); return; } } @@ -60,25 +61,25 @@ namespace CalamityMod.Projectiles.Ranged public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(100f, 3f, lightColor); public override bool OnTileCollide(Vector2 oldVelocity) { - Main.PlaySound(SoundID.Item10, (int)projectile.position.X, (int)projectile.position.Y); - projectile.penetrate--; - if (projectile.penetrate <= 0) + SoundEngine.PlaySound(SoundID.Item10, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -86,12 +87,12 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 160, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 160, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 3; + target.immune[Projectile.owner] = 3; } } } diff --git a/Projectiles/Ranged/ChargedBlast3.cs b/Projectiles/Ranged/ChargedBlast3.cs index 1d798fc029..9447073060 100644 --- a/Projectiles/Ranged/ChargedBlast3.cs +++ b/Projectiles/Ranged/ChargedBlast3.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ChargedBlast3 : ModProjectile @@ -16,70 +17,70 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 4; - projectile.extraUpdates = 3; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 4; + Projectile.extraUpdates = 3; + Projectile.alpha = 255; + Projectile.timeLeft = 300; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0f, 0.3f, 0.7f); float num55 = 50f; float num56 = 1.5f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); } } } public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(100f, 3f, lightColor); public override bool OnTileCollide(Vector2 oldVelocity) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(SoundID.Item62, (int)projectile.position.X, (int)projectile.position.Y); - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack, Projectile.owner, 0f, 0f); + SoundEngine.PlaySound(SoundID.Item62, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -87,14 +88,14 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack, projectile.owner, 1f, 0f); - Main.PlaySound(SoundID.Item62, (int)projectile.position.X, (int)projectile.position.Y); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack, Projectile.owner, 1f, 0f); + SoundEngine.PlaySound(SoundID.Item62, (int)Projectile.position.X, (int)Projectile.position.Y); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 2; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0f); + target.immune[Projectile.owner] = 2; + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Ranged/ChargedDartExplosion.cs b/Projectiles/Ranged/ChargedDartExplosion.cs index 5aa895414a..2929a5d51a 100644 --- a/Projectiles/Ranged/ChargedDartExplosion.cs +++ b/Projectiles/Ranged/ChargedDartExplosion.cs @@ -16,27 +16,27 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.timeLeft = 5; + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.timeLeft = 5; } public override void AI() { - if (projectile.timeLeft == 5) + if (Projectile.timeLeft == 5) { - if (projectile.ai[1] == 0f) //small, on hit npc and tile collide + if (Projectile.ai[1] == 0f) //small, on hit npc and tile collide { for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -46,19 +46,19 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } else //big, on kill { - projectile.height = projectile.width = 100; + Projectile.height = Projectile.width = 100; for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -68,10 +68,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Ranged/ChickenCannonHeld.cs b/Projectiles/Ranged/ChickenCannonHeld.cs index df47023c01..4ead772772 100644 --- a/Projectiles/Ranged/ChickenCannonHeld.cs +++ b/Projectiles/Ranged/ChickenCannonHeld.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -10,38 +11,38 @@ namespace CalamityMod.Projectiles.Ranged { static float FireRate = 33f; //The first shot from the holdout doesnt consume ammo, this is because the ammo is already consumed by the fact the player needs to consume ammo to shoot it - public ref float FreeShotLoaded => ref projectile.ai[0]; - public ref float FramesTillNextShot => ref projectile.ai[1]; + public ref float FreeShotLoaded => ref Projectile.ai[0]; + public ref float FramesTillNextShot => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Chicken Cannon"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 126; - projectile.height = 44; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 126; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Player player = Main.player[Projectile.owner]; + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } @@ -53,13 +54,13 @@ namespace CalamityMod.Projectiles.Ranged shouldShoot = true; } bool canShoot = player.channel && (player.HasAmmo(player.ActiveItem(), true) || FreeShotLoaded > 0) && !player.noItems && !player.CCed; - if (projectile.soundDelay <= 0 && canShoot) + if (Projectile.soundDelay <= 0 && canShoot) { - projectile.soundDelay = (int)FireRate; - Main.PlaySound(SoundID.Item61, projectile.position); + Projectile.soundDelay = (int)FireRate; + SoundEngine.PlaySound(SoundID.Item61, Projectile.position); } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { int projType = ModContent.ProjectileType(); // PickAmmo screws up with Rockets as per usual so this variable is reset right afterward float speedMult2 = 14.5f; @@ -74,17 +75,17 @@ namespace CalamityMod.Projectiles.Ranged direction.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - source.Y; } Vector2 speedMult = Vector2.Normalize(direction); - float shootSpeed = player.ActiveItem().shootSpeed * projectile.scale; + float shootSpeed = player.ActiveItem().shootSpeed * Projectile.scale; if (float.IsNaN(speedMult.X) || float.IsNaN(speedMult.Y)) { speedMult = -Vector2.UnitY; } speedMult *= shootSpeed; - if (speedMult.X != projectile.velocity.X || speedMult.Y != projectile.velocity.Y) + if (speedMult.X != Projectile.velocity.X || speedMult.Y != Projectile.velocity.Y) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity = speedMult * 0.55f; + Projectile.velocity = speedMult * 0.55f; if (shouldShoot) { @@ -96,31 +97,31 @@ namespace CalamityMod.Projectiles.Ranged projType = ModContent.ProjectileType(); kBack = player.GetWeaponKnockback(player.ActiveItem(), kBack); - Vector2 velocity = Vector2.Normalize(projectile.velocity) * speedMult2; + Vector2 velocity = Vector2.Normalize(Projectile.velocity) * speedMult2; if (float.IsNaN(velocity.X) || float.IsNaN(velocity.Y)) { velocity = -Vector2.UnitY; } - Projectile.NewProjectile(source, velocity, projType, dmg, kBack, projectile.owner); + Projectile.NewProjectile(source, velocity, projType, dmg, kBack, Projectile.owner); } } else if (!canShoot) { - projectile.Kill(); + Projectile.Kill(); } } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; if (player.itemTime < 2) player.itemTime = 2; if (player.itemAnimation < 2) player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); + player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * Projectile.direction, Projectile.velocity.X * Projectile.direction); } public override bool CanDamage() => false; diff --git a/Projectiles/Ranged/ChickenExplosion.cs b/Projectiles/Ranged/ChickenExplosion.cs index a1ea46359f..5f61e5323b 100644 --- a/Projectiles/Ranged/ChickenExplosion.cs +++ b/Projectiles/Ranged/ChickenExplosion.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -17,25 +18,25 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 1000; - projectile.height = 1000; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 150; - projectile.ranged = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; + Projectile.width = 1000; + Projectile.height = 1000; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 150; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.01f / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item20, (int)projectile.position.X, (int)projectile.position.Y); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item20, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.localAI[0] += 1f; } EmitDust(); @@ -50,13 +51,13 @@ namespace CalamityMod.Projectiles.Ranged { // The exponent being greater than 1 gives the randomness a bias towards 0. This means that more dust will spawn // closer to the center than the edge. - Vector2 dustSpawnOffset = Main.rand.NextVector2Unit() * (float)Math.Pow(Main.rand.NextFloat(), 2.4D) * projectile.Size * 0.5f; + Vector2 dustSpawnOffset = Main.rand.NextVector2Unit() * (float)Math.Pow(Main.rand.NextFloat(), 2.4D) * Projectile.Size * 0.5f; // Dust should fly off more quickly the farther away it is from the center. // At 5% out, a speed of 5 pixels/second is achieved. At 85%, a speed of 15 pixels/second is. // Direction is determined based on the outward direction rotated by anywhere from -90 to 90 degrees. Vector2 dustVelocity = dustSpawnOffset.SafeNormalize(Vector2.UnitY).RotatedByRandom(MathHelper.PiOver2 * Main.rand.NextFloatDirection()); - dustVelocity *= MathHelper.Lerp(5f, 15f, Utils.InverseLerp(0.05f, 0.85f, (dustSpawnOffset / projectile.Size / 0.5f).Length())); + dustVelocity *= MathHelper.Lerp(5f, 15f, Utils.InverseLerp(0.05f, 0.85f, (dustSpawnOffset / Projectile.Size / 0.5f).Length())); // Fire variants. int dustType = 6; @@ -67,12 +68,12 @@ namespace CalamityMod.Projectiles.Ranged if (Main.rand.NextBool(7)) dustType = 31; - Dust flame = Dust.NewDustPerfect(projectile.Center + dustSpawnOffset, dustType, dustVelocity); + Dust flame = Dust.NewDustPerfect(Projectile.Center + dustSpawnOffset, dustType, dustVelocity); flame.scale = Main.rand.NextFloat(0.85f, 1.3f); flame.noGravity = true; } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, projectile.Size.Length() * 0.5f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.Size.Length() * 0.5f, targetHitbox); } } diff --git a/Projectiles/Ranged/ChickenRocket.cs b/Projectiles/Ranged/ChickenRocket.cs index 400e3806ac..5b8a0dfcea 100644 --- a/Projectiles/Ranged/ChickenRocket.cs +++ b/Projectiles/Ranged/ChickenRocket.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -15,71 +16,71 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.MaxUpdates = 2; - projectile.timeLeft = 300; - projectile.ranged = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; } public override void AI() { - float speed = projectile.velocity.Length(); + float speed = Projectile.velocity.Length(); if (speed >= 12f) { // If the rocket is going fast enough, emit some dust. for (int i = 0; i < 2; i++) { - float dx = i == 1 ? projectile.velocity.X * 0.5f : 0f; - float dy = i == 1 ? projectile.velocity.Y * 0.5f : 0f; - int d = Dust.NewDust(new Vector2(projectile.position.X + 3f + dx, projectile.position.Y + 3f + dy) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + float dx = i == 1 ? Projectile.velocity.X * 0.5f : 0f; + float dy = i == 1 ? Projectile.velocity.Y * 0.5f : 0f; + int d = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dx, Projectile.position.Y + 3f + dy) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); Main.dust[d].scale *= 2f + Main.rand.NextFloat(); Main.dust[d].velocity *= 0.2f; Main.dust[d].noGravity = true; - d = Dust.NewDust(new Vector2(projectile.position.X + 3f + dx, projectile.position.Y + 3f + dy) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); + d = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dx, Projectile.position.Y + 3f + dy) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); Main.dust[d].fadeIn = 1f + Main.rand.NextFloat(0.5f); Main.dust[d].velocity *= 0.05f; } // Exponentially accelerate if not going fast enough yet. if (speed < 18f) - projectile.velocity *= 1.006f; + Projectile.velocity *= 1.006f; // When going at very high speed, emit even more dust. else if (Main.rand.NextBool()) { - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[d].scale = 0.1f + Main.rand.NextFloat(0.5f); Main.dust[d].fadeIn = 1.5f + Main.rand.NextFloat(0.5f); Main.dust[d].noGravity = true; - Main.dust[d].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy(projectile.rotation) * 1.1f; + Main.dust[d].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy(Projectile.rotation) * 1.1f; Main.rand.Next(2); - d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[d].scale = 1f + Main.rand.NextFloat(0.5f); Main.dust[d].noGravity = true; - Main.dust[d].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy(projectile.rotation) * 1.1f; + Main.dust[d].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy(Projectile.rotation) * 1.1f; } } - projectile.ai[0] += 1f; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.ai[0] += 1f; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; // Slight gravity, equivalent to Plasma Grenade. - projectile.velocity.Y += 0.09f; + Projectile.velocity.Y += 0.09f; } // Instead of dying instantly on collision, fly straight up for a moment. public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.velocity.X = 0f; - projectile.velocity.Y = -15f; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = -15f; // If there isn't much time left anyway, just explode immediately on collision. - if (projectile.timeLeft > 20) - projectile.timeLeft = 20; + if (Projectile.timeLeft > 20) + Projectile.timeLeft = 20; else return true; @@ -88,18 +89,18 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 1040; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - if (projectile.owner == Main.myPlayer) + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 1040; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } - Main.PlaySound(SoundID.Item14, (int)projectile.Center.X, (int)projectile.Center.Y); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.Center.X, (int)Projectile.Center.Y); for (int i = 0; i < 40; i++) { - int d = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int d = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[d].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -109,10 +110,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int i = 0; i < 70; i++) { - int d = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int d = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 5f; - d = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + d = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[d].velocity *= 2f; } } diff --git a/Projectiles/Ranged/ClamorRifleProj.cs b/Projectiles/Ranged/ClamorRifleProj.cs index 790ac59727..b9129075c0 100644 --- a/Projectiles/Ranged/ClamorRifleProj.cs +++ b/Projectiles/Ranged/ClamorRifleProj.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ClamorRifleProj : ModProjectile @@ -13,32 +14,32 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.ranged = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Ranged; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation += 0.15f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 3f) + Projectile.rotation += 0.15f; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 3f) { - Lighting.AddLight(projectile.Center, new Vector3(44, 191, 232) * (1.3f / 255)); + Lighting.AddLight(Projectile.Center, new Vector3(44, 191, 232) * (1.3f / 255)); for (int num151 = 0; num151 < 2; num151++) { int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1f); + int num155 = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1f); Main.dust[num155].noGravity = true; Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; + Main.dust[num155].velocity += Projectile.velocity * 0.5f; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 150f, 12f, 25f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 150f, 12f, 25f); } /*public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -51,15 +52,15 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { int bulletAmt = 2; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int b = 0; b < bulletAmt; b++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.45), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.45), 0f, Projectile.owner, 0f, 0f); } } - Main.PlaySound(SoundID.Item118, projectile.Center); + SoundEngine.PlaySound(SoundID.Item118, Projectile.Center); } } } diff --git a/Projectiles/Ranged/ClamorRifleProjSplit.cs b/Projectiles/Ranged/ClamorRifleProjSplit.cs index 7934ddb274..04c667df11 100644 --- a/Projectiles/Ranged/ClamorRifleProjSplit.cs +++ b/Projectiles/Ranged/ClamorRifleProjSplit.cs @@ -14,35 +14,35 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.scale = 0.9f; - projectile.timeLeft = 180; - projectile.penetrate = 1; - projectile.ranged = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.scale = 0.9f; + Projectile.timeLeft = 180; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Ranged; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.rotation += 0.15f; + Projectile.rotation += 0.15f; - Lighting.AddLight(projectile.Center, new Vector3(44, 191, 232) * (1.3f/255)); + Lighting.AddLight(Projectile.Center, new Vector3(44, 191, 232) * (1.3f/255)); for (int num151 = 0; num151 < 2; num151++) { int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1f); + int num155 = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 68, 0f, 0f, 100, default, 1f); Main.dust[num155].noGravity = true; Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; + Main.dust[num155].velocity += Projectile.velocity * 0.5f; } - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 12f, 25f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 12f, 25f); } /* override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/ClaretCannonProj.cs b/Projectiles/Ranged/ClaretCannonProj.cs index 1ed7557a6d..f45b524c0e 100644 --- a/Projectiles/Ranged/ClaretCannonProj.cs +++ b/Projectiles/Ranged/ClaretCannonProj.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -13,34 +14,34 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Claret Cannon"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f); } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } @@ -48,7 +49,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 2; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.oldVelocity.X * 0.15f, projectile.oldVelocity.Y * 0.15f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X * 0.15f, Projectile.oldVelocity.Y * 0.15f); } } @@ -56,10 +57,10 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 180); - if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) + if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) return; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (Main.rand.NextBool(2)) { player.statLife += 1; @@ -69,7 +70,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/ClockworkBowHoldout.cs b/Projectiles/Ranged/ClockworkBowHoldout.cs index fd8765efb2..4e9c39a4bf 100644 --- a/Projectiles/Ranged/ClockworkBowHoldout.cs +++ b/Projectiles/Ranged/ClockworkBowHoldout.cs @@ -6,6 +6,7 @@ using Terraria.ModLoader; using Terraria.Graphics.Shaders; using Microsoft.Xna.Framework.Graphics; using CalamityMod.Items.Weapons.Ranged; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged @@ -19,13 +20,13 @@ namespace CalamityMod.Projectiles.Ranged //Main.projFrames[projectile.type] = 9; might animate the bow's string getting drawn but not rn } - private Player Owner => Main.player[projectile.owner]; + private Player Owner => Main.player[Projectile.owner]; private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; - private ref float CurrentChargingFrames => ref projectile.ai[0]; - private ref float LoadedBolts => ref projectile.ai[1]; - private ref float FramesToLoadBolt => ref projectile.localAI[0]; - private ref float LastDirection => ref projectile.localAI[1]; + private ref float CurrentChargingFrames => ref Projectile.ai[0]; + private ref float LoadedBolts => ref Projectile.ai[1]; + private ref float FramesToLoadBolt => ref Projectile.localAI[0]; + private ref float LastDirection => ref Projectile.localAI[1]; //private ref float Overfilled => ref projectile.localAI[1]; Until i implement the bow animation there is no need for that private float angularSpread = MathHelper.ToRadians(16); @@ -35,19 +36,19 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 48; - projectile.height = 96; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 48; + Projectile.height = 96; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } public override void AI() { Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 tipPosition = armPosition + projectile.velocity * projectile.width * 0.5f; + Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f; // If the player releases left click, shoot out the arrows if (!OwnerCanShoot) @@ -55,7 +56,7 @@ namespace CalamityMod.Projectiles.Ranged if (LoadedBolts <= 0f) //If theres no arrows to shoot { - projectile.Kill(); + Projectile.Kill(); return; } // Fire the spread of arrows @@ -74,7 +75,7 @@ namespace CalamityMod.Projectiles.Ranged ++CurrentChargingFrames; if (CurrentChargingFrames - FramesToLoadBolt / 2 <= 0.01) - Main.PlaySound(SoundID.Item17); //Click + SoundEngine.PlaySound(SoundID.Item17); //Click if (CurrentChargingFrames >= FramesToLoadBolt && LoadedBolts < ClockworkBow.MaxBolts) { @@ -89,10 +90,10 @@ namespace CalamityMod.Projectiles.Ranged FramesToLoadBolt *= 0.950f; if (LoadedBolts >= ClockworkBow.MaxBolts) - Main.PlaySound(SoundID.Item23); + SoundEngine.PlaySound(SoundID.Item23); else { - var loadSound = Main.PlaySound(SoundID.Item108); + var loadSound = SoundEngine.PlaySound(SoundID.Item108); if (loadSound != null) loadSound.Volume *= 0.3f; } @@ -116,7 +117,7 @@ namespace CalamityMod.Projectiles.Ranged ShootProjectiles(tipPosition, spreadForThisProjectile); } - Main.PlaySound(SoundID.Item38);//play the sound + SoundEngine.PlaySound(SoundID.Item38);//play the sound } else if (LoadedBolts != 0) { @@ -130,7 +131,7 @@ namespace CalamityMod.Projectiles.Ranged float spreadForThisProjectile = MathHelper.Lerp(-increment, increment, i / (float)(MathHelper.Lerp(LoadedBolts - 1, LoadedBolts, MathHelper.Clamp((CurrentChargingFrames * 2 / FramesToLoadBolt), 0f, 1f)))); ShootProjectiles(tipPosition, spreadForThisProjectile); } - Main.PlaySound(SoundID.Item38);//play the sound + SoundEngine.PlaySound(SoundID.Item38);//play the sound } FramesToLoadBolt = Owner.ActiveItem().useAnimation; //reset the reload time @@ -139,7 +140,7 @@ namespace CalamityMod.Projectiles.Ranged public void ShootProjectiles(Vector2 tipPosition, float projectileRotation) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; Item heldItem = Owner.ActiveItem(); @@ -153,48 +154,48 @@ namespace CalamityMod.Projectiles.Ranged projectileType = ModContent.ProjectileType(); knockback = Owner.GetWeaponKnockback(heldItem, knockback); - Vector2 shootVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(projectileRotation) * shootSpeed; + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(projectileRotation) * shootSpeed; - Projectile.NewProjectile(tipPosition, shootVelocity, projectileType, BoltDamage, knockback, projectile.owner, 0f, 0f); + Projectile.NewProjectile(tipPosition, shootVelocity, projectileType, BoltDamage, knockback, Projectile.owner, 0f, 0f); } private void UpdateProjectileHeldVariables(Vector2 armPosition) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { float interpolant = Utils.InverseLerp(5f, 25f, Owner.Distance(Main.MouseWorld), true); - Vector2 oldVelocity = projectile.velocity; - projectile.velocity = Vector2.Lerp(projectile.velocity, Owner.SafeDirectionTo(Main.MouseWorld), interpolant); - if (projectile.velocity != oldVelocity) + Vector2 oldVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Owner.SafeDirectionTo(Main.MouseWorld), interpolant); + if (Projectile.velocity != oldVelocity) { - projectile.netSpam = 0; - projectile.netUpdate = true; + Projectile.netSpam = 0; + Projectile.netUpdate = true; } } - projectile.position = armPosition - projectile.Size * 0.5f + projectile.velocity.SafeNormalize(Vector2.Zero) * 35f; - projectile.rotation = projectile.velocity.ToRotation(); - int oldDirection = projectile.spriteDirection; + Projectile.position = armPosition - Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.Zero) * 35f; + Projectile.rotation = Projectile.velocity.ToRotation(); + int oldDirection = Projectile.spriteDirection; if (oldDirection == -1) - projectile.rotation += MathHelper.Pi; + Projectile.rotation += MathHelper.Pi; - projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + Projectile.direction = Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); // If the direction differs from what it originaly was, undo the previous 180 degree turn. // If this is not done, the bow will have 1 frame of rotational "jitter" when the direction changes based on the // original angle. This effect looks very strange in-game. - if (projectile.spriteDirection != oldDirection) - projectile.rotation -= MathHelper.Pi; + if (Projectile.spriteDirection != oldDirection) + Projectile.rotation -= MathHelper.Pi; - projectile.timeLeft = 3; + Projectile.timeLeft = 3; } private void ManipulatePlayerVariables() { - Owner.ChangeDir(projectile.direction); - Owner.heldProj = projectile.whoAmI; + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } @@ -237,13 +238,13 @@ namespace CalamityMod.Projectiles.Ranged } Color Transparency = Color.White * (1 - Shift); - var BoltTexture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/PrecisionBolt"); - Vector2 PointingTo = new Vector2((float)Math.Cos(projectile.rotation + BoltAngle), (float)Math.Sin(projectile.rotation + BoltAngle)); //It's called trigonometry we do a little trigonometry + var BoltTexture = ModContent.Request("CalamityMod/Projectiles/Ranged/PrecisionBolt"); + Vector2 PointingTo = new Vector2((float)Math.Cos(Projectile.rotation + BoltAngle), (float)Math.Sin(Projectile.rotation + BoltAngle)); //It's called trigonometry we do a little trigonometry Vector2 ShiftDown = PointingTo.RotatedBy(-MathHelper.PiOver2); float FlipFactor = Owner.direction < 0 ? MathHelper.Pi : 0f; Vector2 drawPosition = Owner.Center + PointingTo.RotatedBy(FlipFactor) * (20f + (Shift * 40)) - ShiftDown.RotatedBy(FlipFactor) * (BoltTexture.Width / 2) - Main.screenPosition; - spriteBatch.Draw(BoltTexture, drawPosition, null, Transparency, projectile.rotation + BoltAngle + MathHelper.PiOver2 + FlipFactor, BoltTexture.Size(), 1f, 0, 0); + spriteBatch.Draw(BoltTexture, drawPosition, null, Transparency, Projectile.rotation + BoltAngle + MathHelper.PiOver2 + FlipFactor, BoltTexture.Size(), 1f, 0, 0); if (i == LoadedBolts - 1 || LoadedBolts == ClockworkBow.MaxBolts) //Don't forget to exit the shader region spriteBatch.ExitShaderRegion(); diff --git a/Projectiles/Ranged/CondemnationArrow.cs b/Projectiles/Ranged/CondemnationArrow.cs index 46f937111f..89c467e9ed 100644 --- a/Projectiles/Ranged/CondemnationArrow.cs +++ b/Projectiles/Ranged/CondemnationArrow.cs @@ -4,43 +4,44 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class CondemnationArrow : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Condemning Arrow"); - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 9; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 9; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 90; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.arrow = true; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 26; + Projectile.height = 90; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { //Sound is played in the first frame instead of in the weapon shoot for proper mp sync - if (projectile.timeLeft == 300) - Main.PlaySound(SoundID.DD2_BallistaTowerShot, projectile.Center); + if (Projectile.timeLeft == 300) + SoundEngine.PlaySound(SoundID.DD2_BallistaTowerShot, Projectile.Center); - Lighting.AddLight(projectile.Center, Color.Violet.ToVector3()); - projectile.Opacity = Utils.InverseLerp(0f, 20f, Time, true); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, Color.Violet.ToVector3()); + Projectile.Opacity = Utils.InverseLerp(0f, 20f, Time, true); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Time++; // Release side arrows every so often. @@ -48,8 +49,8 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = -1; i <= 1; i += 2) { - Vector2 shootVelocity = projectile.velocity.RotatedBy(i * 0.036f); - Projectile.NewProjectile(projectile.Center, shootVelocity, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner); + Vector2 shootVelocity = Projectile.velocity.RotatedBy(i * 0.036f); + Projectile.NewProjectile(Projectile.Center, shootVelocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); } } } @@ -58,13 +59,13 @@ namespace CalamityMod.Projectiles.Ranged { Color c1 = new Color(226, 40, 40, 0); Color c2 = new Color(205, 0, 194, 0); - Color fadeColor = Color.Lerp(c1, c2, (float)Math.Cos(projectile.identity * 1.41f + Main.GlobalTime * 8f) * 0.5f + 0.5f); - return Color.Lerp(lightColor, fadeColor, 0.5f) * projectile.Opacity; + Color fadeColor = Color.Lerp(c1, c2, (float)Math.Cos(Projectile.identity * 1.41f + Main.GlobalTime * 8f) * 0.5f + 0.5f); + return Color.Lerp(lightColor, fadeColor, 0.5f) * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } @@ -76,10 +77,10 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 30; i++) { - Dust fire = Dust.NewDustPerfect(projectile.Center, 130); - fire.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.8f) * new Vector2(4f, 1.25f) * Main.rand.NextFloat(0.9f, 1f); - fire.velocity = fire.velocity.RotatedBy(projectile.rotation - MathHelper.PiOver2); - fire.velocity += projectile.velocity * 0.7f; + Dust fire = Dust.NewDustPerfect(Projectile.Center, 130); + fire.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.8f) * new Vector2(4f, 1.25f) * Main.rand.NextFloat(0.9f, 1f); + fire.velocity = fire.velocity.RotatedBy(Projectile.rotation - MathHelper.PiOver2); + fire.velocity += Projectile.velocity * 0.7f; fire.noGravity = true; fire.color = Color.Lerp(Color.White, Color.Purple, Main.rand.NextFloat()); @@ -87,10 +88,10 @@ namespace CalamityMod.Projectiles.Ranged fire = Dust.CloneDust(fire); fire.velocity = Main.rand.NextVector2Circular(3f, 3f); - fire.velocity += projectile.velocity * 0.6f; + fire.velocity += Projectile.velocity * 0.6f; } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); } } diff --git a/Projectiles/Ranged/CondemnationArrowHoming.cs b/Projectiles/Ranged/CondemnationArrowHoming.cs index 749f556b2e..02db12ffcd 100644 --- a/Projectiles/Ranged/CondemnationArrowHoming.cs +++ b/Projectiles/Ranged/CondemnationArrowHoming.cs @@ -10,37 +10,37 @@ namespace CalamityMod.Projectiles.Ranged public class CondemnationArrowHoming : ModProjectile { public override string Texture => "CalamityMod/Projectiles/Ranged/CondemnationArrow"; - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Condemning Echo"); - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 9; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 9; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 45; - projectile.scale = 0.5f; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; + Projectile.width = 14; + Projectile.height = 45; + Projectile.scale = 0.5f; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 300; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.Violet.ToVector3()); - projectile.Opacity = Utils.InverseLerp(0f, 20f, Time, true) * Utils.InverseLerp(0f, 20f, projectile.timeLeft, true); + Lighting.AddLight(Projectile.Center, Color.Violet.ToVector3()); + Projectile.Opacity = Utils.InverseLerp(0f, 20f, Time, true) * Utils.InverseLerp(0f, 20f, Projectile.timeLeft, true); - NPC potentialTarget = projectile.Center.ClosestNPCAt(1500f, false); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(1500f, false); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 29f + projectile.SafeDirectionTo(potentialTarget.Center) * 21f) / 30f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity = (Projectile.velocity * 29f + Projectile.SafeDirectionTo(potentialTarget.Center) * 21f) / 30f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Time++; } @@ -48,12 +48,12 @@ namespace CalamityMod.Projectiles.Ranged { Color c1 = new Color(226, 40, 40, 0); Color c2 = new Color(205, 0, 194, 0); - return Color.Lerp(c1, c2, (float)Math.Cos(projectile.identity * 1.41f + Main.GlobalTime * 8f) * 0.5f + 0.5f) * projectile.Opacity; + return Color.Lerp(c1, c2, (float)Math.Cos(Projectile.identity * 1.41f + Main.GlobalTime * 8f) * 0.5f + 0.5f) * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 10; i++) { - Dust fire = Dust.NewDustPerfect(projectile.Center, 267); + Dust fire = Dust.NewDustPerfect(Projectile.Center, 267); fire.velocity = Main.rand.NextVector2Circular(2f, 2f); fire.color = Color.Lerp(Color.Red, Color.Purple, Main.rand.NextFloat()); fire.scale = Main.rand.NextFloat(1f, 1.1f); @@ -73,6 +73,6 @@ namespace CalamityMod.Projectiles.Ranged } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); } } diff --git a/Projectiles/Ranged/CondemnationHoldout.cs b/Projectiles/Ranged/CondemnationHoldout.cs index 290f67a304..bfb2cb1ead 100644 --- a/Projectiles/Ranged/CondemnationHoldout.cs +++ b/Projectiles/Ranged/CondemnationHoldout.cs @@ -3,35 +3,36 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class CondemnationHoldout : ModProjectile { - private Player Owner => Main.player[projectile.owner]; + private Player Owner => Main.player[Projectile.owner]; private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; - private ref float CurrentChargingFrames => ref projectile.ai[0]; - private ref float ArrowsLoaded => ref projectile.ai[1]; - private ref float FramesToLoadNextArrow => ref projectile.localAI[0]; + private ref float CurrentChargingFrames => ref Projectile.ai[0]; + private ref float ArrowsLoaded => ref Projectile.ai[1]; + private ref float FramesToLoadNextArrow => ref Projectile.localAI[0]; public override string Texture => "CalamityMod/Items/Weapons/Ranged/Condemnation"; public override void SetStaticDefaults() => DisplayName.SetDefault("Condemnation"); public override void SetDefaults() { - projectile.width = 130; - projectile.height = 42; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 130; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } public override void AI() { Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 tipPosition = armPosition + projectile.velocity * projectile.width * 0.5f; + Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f; // Fire arrows if the owner stops channeling or otherwise cannot use the weapon. if (!OwnerCanShoot) @@ -39,7 +40,7 @@ namespace CalamityMod.Projectiles.Ranged // No arrows left to shoot? The bow disappears. if (ArrowsLoaded <= 0f) { - projectile.Kill(); + Projectile.Kill(); return; } @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged // Frame 1 effects: Record how fast the Condemnation item being used is, to determine how fast to load arrows. if (FramesToLoadNextArrow == 0f) { - Main.PlaySound(SoundID.Item20, projectile.Center); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); FramesToLoadNextArrow = Owner.ActiveItem().useAnimation; } @@ -75,12 +76,12 @@ namespace CalamityMod.Projectiles.Ranged --FramesToLoadNextArrow; // Play a sound for additional notification that an arrow has been loaded. - var loadSound = Main.PlaySound(SoundID.Item108); + var loadSound = SoundEngine.PlaySound(SoundID.Item108); if (loadSound != null) loadSound.Volume *= 0.3f; if (ArrowsLoaded >= Condemnation.MaxLoadedArrows) - Main.PlaySound(SoundID.MaxMana); + SoundEngine.PlaySound(SoundID.MaxMana); } } @@ -113,14 +114,14 @@ namespace CalamityMod.Projectiles.Ranged Dust chargeMagic = Dust.NewDustPerfect(tipPosition + Main.rand.NextVector2Circular(20f, 20f), 267); chargeMagic.velocity = (tipPosition - chargeMagic.position) * 0.1f + Owner.velocity; chargeMagic.scale = Main.rand.NextFloat(1f, 1.5f); - chargeMagic.color = projectile.GetAlpha(Color.White); + chargeMagic.color = Projectile.GetAlpha(Color.White); chargeMagic.noGravity = true; } } public void ShootProjectiles(Vector2 tipPosition) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; Item heldItem = Owner.ActiveItem(); @@ -135,40 +136,40 @@ namespace CalamityMod.Projectiles.Ranged projectileType = ModContent.ProjectileType(); knockback = Owner.GetWeaponKnockback(heldItem, knockback); - Vector2 shootVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * shootSpeed; + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * shootSpeed; - Projectile.NewProjectile(tipPosition, shootVelocity, projectileType, arrowDamage, knockback, projectile.owner, 0f, 0f); + Projectile.NewProjectile(tipPosition, shootVelocity, projectileType, arrowDamage, knockback, Projectile.owner, 0f, 0f); } private void UpdateProjectileHeldVariables(Vector2 armPosition) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - float interpolant = Utils.InverseLerp(5f, 25f, projectile.Distance(Main.MouseWorld), true); - Vector2 oldVelocity = projectile.velocity; - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(Main.MouseWorld), interpolant); - if (projectile.velocity != oldVelocity) + float interpolant = Utils.InverseLerp(5f, 25f, Projectile.Distance(Main.MouseWorld), true); + Vector2 oldVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), interpolant); + if (Projectile.velocity != oldVelocity) { - projectile.netSpam = 0; - projectile.netUpdate = true; + Projectile.netSpam = 0; + Projectile.netUpdate = true; } } - projectile.position = armPosition - projectile.Size * 0.5f; - projectile.rotation = projectile.velocity.ToRotation(); - if (projectile.spriteDirection == -1) - projectile.rotation += MathHelper.Pi; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; + Projectile.position = armPosition - Projectile.Size * 0.5f; + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.spriteDirection == -1) + Projectile.rotation += MathHelper.Pi; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; } private void ManipulatePlayerVariables() { - Owner.ChangeDir(projectile.direction); - Owner.heldProj = projectile.whoAmI; + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } public override bool CanDamage() => false; diff --git a/Projectiles/Ranged/ContagionArrow.cs b/Projectiles/Ranged/ContagionArrow.cs index 47d2af4e1f..96bcb371bb 100644 --- a/Projectiles/Ranged/ContagionArrow.cs +++ b/Projectiles/Ranged/ContagionArrow.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ContagionArrow : ModProjectile @@ -14,48 +15,48 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Contagion Arrow"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.ranged = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Ranged; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; addBallTimer--; if (addBallTimer <= 0) { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 100) + if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 100) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } addBallTimer = 10; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f); - if (projectile.ai[0] <= 60f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0f / 255f); + if (Projectile.ai[0] <= 60f) { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; return; } - projectile.velocity.Y = projectile.velocity.Y + 0.075f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.075f; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } @@ -66,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/ContagionBall.cs b/Projectiles/Ranged/ContagionBall.cs index 65587577ff..622846dfd1 100644 --- a/Projectiles/Ranged/ContagionBall.cs +++ b/Projectiles/Ranged/ContagionBall.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ContagionBall : ModProjectile @@ -14,27 +15,27 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 60; - projectile.ranged = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 60; + Projectile.DamageType = DamageClass.Ranged; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, (int)projectile.Center.X, (int)projectile.Center.Y); - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 44, 0f, 0f, 100, default, 0.15f); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.Center.X, (int)Projectile.Center.Y); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 44, 0f, 0f, 100, default, 0.15f); Main.dust[num622].velocity *= 1.2f; if (Main.rand.NextBool(2)) { diff --git a/Projectiles/Ranged/ContagionBow.cs b/Projectiles/Ranged/ContagionBow.cs index 89ac2dd550..f817a6091e 100644 --- a/Projectiles/Ranged/ContagionBow.cs +++ b/Projectiles/Ranged/ContagionBow.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ContagionBow : ModProjectile @@ -17,81 +18,81 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 42; - projectile.height = 84; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.ranged = true; + Projectile.width = 42; + Projectile.height = 84; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.type == ModContent.ProjectileType()) + if (Projectile.type == ModContent.ProjectileType()) { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num2 = 0; - if (projectile.ai[0] >= 40f) + if (Projectile.ai[0] >= 40f) { num2++; } - if (projectile.ai[0] >= 80f) + if (Projectile.ai[0] >= 80f) { num2++; } - if (projectile.ai[0] >= 120f) + if (Projectile.ai[0] >= 120f) { num2++; } int num3 = 24; int num4 = 6; - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; bool flag = false; - if (projectile.ai[1] >= (float)(num3 - num4 * num2)) + if (Projectile.ai[1] >= (float)(num3 - num4 * num2)) { - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; flag = true; } - projectile.frameCounter += 1 + num2; - if (projectile.frameCounter >= 4) + Projectile.frameCounter += 1 + num2; + if (Projectile.frameCounter >= 4) { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame >= 3) + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame >= 3) { - projectile.frame = 0; + Projectile.frame = 0; } } - if (projectile.soundDelay <= 0) + if (Projectile.soundDelay <= 0) { - projectile.soundDelay = num3 - num4 * num2; - if (projectile.ai[0] != 1f) + Projectile.soundDelay = num3 - num4 * num2; + if (Projectile.ai[0] != 1f) { - Main.PlaySound(SoundID.Item5, projectile.Center); + SoundEngine.PlaySound(SoundID.Item5, Projectile.Center); } } - if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) + if (Projectile.ai[1] == 1f && Projectile.ai[0] != 1f) { Vector2 vector2 = Vector2.UnitX * 24f; - vector2 = vector2.RotatedBy((double)(projectile.rotation - MathHelper.PiOver2), default); - Vector2 value = projectile.Center + vector2; + vector2 = vector2.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default); + Vector2 value = Projectile.Center + vector2; for (int i = 0; i < 2; i++) { - int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 44, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, default, 0.25f); + int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 44, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f, 100, default, 0.25f); Main.dust[num5].velocity *= 0.66f; Main.dust[num5].noGravity = true; Main.dust[num5].scale = 1.4f; } } - if (flag && Main.myPlayer == projectile.owner) + if (flag && Main.myPlayer == Projectile.owner) { bool flag2 = player.channel && !player.noItems && !player.CCed; if (flag2) { - float speed = player.ActiveItem().shootSpeed * projectile.scale; + float speed = player.ActiveItem().shootSpeed * Projectile.scale; Vector2 spawnPos = vector; Vector2 direction = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - spawnPos; if (player.gravDir == -1f) @@ -104,45 +105,45 @@ namespace CalamityMod.Projectiles.Ranged velocity = -Vector2.UnitY; } velocity *= speed; - if (velocity.X != projectile.velocity.X || velocity.Y != projectile.velocity.Y) + if (velocity.X != Projectile.velocity.X || velocity.Y != Projectile.velocity.Y) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity = velocity; + Projectile.velocity = velocity; int projType = ModContent.ProjectileType(); float velocityMult = 14f; float randNum = 7f; spawnPos += new Vector2(Main.rand.NextFloat(-randNum, randNum), Main.rand.NextFloat(-randNum, randNum)); - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * velocityMult; + Vector2 spinningpoint = Vector2.Normalize(Projectile.velocity) * velocityMult; spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.2 - 0.1, default); if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) { spinningpoint = -Vector2.UnitY; } - Projectile.NewProjectile(spawnPos, spinningpoint, projType, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(spawnPos, spinningpoint, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } else { - projectile.Kill(); + Projectile.Kill(); } } } - projectile.rotation = projectile.velocity.ToRotation(); - Vector2 displayOffset = new Vector2(5f, 0f).RotatedBy(projectile.rotation); - projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; - if (projectile.spriteDirection == -1) - projectile.rotation += MathHelper.Pi; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.rotation = Projectile.velocity.ToRotation(); + Vector2 displayOffset = new Vector2(5f, 0f).RotatedBy(Projectile.rotation); + Projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; + if (Projectile.spriteDirection == -1) + Projectile.rotation += MathHelper.Pi; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); } public override bool CanDamage() => false; - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.ai[0] > 0f; + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.ai[0] > 0f; } } diff --git a/Projectiles/Ranged/CorossiveFlames.cs b/Projectiles/Ranged/CorossiveFlames.cs index 259f04e352..b3b503ed36 100644 --- a/Projectiles/Ranged/CorossiveFlames.cs +++ b/Projectiles/Ranged/CorossiveFlames.cs @@ -15,41 +15,41 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 90; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); - if (projectile.ai[0] > 7f) + Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0f); + if (Projectile.ai[0] > 7f) { float num296 = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { num296 = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { num296 = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num297 = 89; if (Main.rand.NextBool(2)) { for (int num298 = 0; num298 < 1; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { @@ -77,14 +77,14 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 4; + target.immune[Projectile.owner] = 4; target.AddBuff(ModContent.BuffType(), 240); } } diff --git a/Projectiles/Ranged/CorrodedShell.cs b/Projectiles/Ranged/CorrodedShell.cs index 6bd1a5c08b..6326c87a48 100644 --- a/Projectiles/Ranged/CorrodedShell.cs +++ b/Projectiles/Ranged/CorrodedShell.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class CorrodedShell : ModProjectile @@ -17,31 +18,31 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.ignoreWater = true; - projectile.penetrate = 6; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.aiStyle = 1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 6; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.aiStyle = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y *= 0.9995f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity.X *= 0.9995f; + Projectile.velocity.Y *= 0.9995f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (projectile.timeLeft % 3 == 0) + if (Projectile.timeLeft % 3 == 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int aura = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.15), projectile.knockBack, projectile.owner); + int aura = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.15), Projectile.knockBack, Projectile.owner); if (aura.WithinBounds(Main.maxProjectiles)) { Main.projectile[aura].Calamity().forceRanged = true; @@ -53,17 +54,17 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position = projectile.position - projectile.Size / 2f; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.Damage(); - Main.PlaySound(SoundID.Item92, (int)projectile.Center.X, (int)projectile.Center.Y); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 32; + Projectile.position = Projectile.position - Projectile.Size / 2f; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item92, (int)Projectile.Center.X, (int)Projectile.Center.Y); int count = Main.rand.Next(6, 15); for (int i = 0; i < count; i++) { - int idx = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Ranged/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index 414e851361..c71377cff4 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -14,43 +14,43 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 100; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 100; } public override void AI() { - if (projectile.scale <= 1.5f) + if (Projectile.scale <= 1.5f) { - projectile.scale *= 1.01f; + Projectile.scale *= 1.01f; } - Lighting.AddLight(projectile.Center, 0.25f, 0f, 0.1f); - if (projectile.ai[0] > 7f) + Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0.1f); + if (Projectile.ai[0] > 7f) { float scalar = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { scalar = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { scalar = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { scalar = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int dustType = Main.rand.NextBool(4) ? 61 : 62; if (Main.rand.NextBool(2)) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[fire]; if (Main.rand.NextBool(3)) { @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; dust.scale *= scalar; - dust.velocity += projectile.velocity; + dust.velocity += Projectile.velocity; if (!dust.noGravity) { dust.velocity *= 0.5f; @@ -75,14 +75,14 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 3; + target.immune[Projectile.owner] = 3; } } } diff --git a/Projectiles/Ranged/DWArrow.cs b/Projectiles/Ranged/DWArrow.cs index 53d45c27b9..0abbc092ab 100644 --- a/Projectiles/Ranged/DWArrow.cs +++ b/Projectiles/Ranged/DWArrow.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -15,38 +16,38 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.arrow = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.extraUpdates = 5; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.arrow = true; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = (projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi)) + MathHelper.ToRadians(90) *projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = (Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi)) + MathHelper.ToRadians(90) *Projectile.direction; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item12, (int)projectile.position.X, (int)projectile.position.Y); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item12, (int)Projectile.position.X, (int)Projectile.position.Y); } - Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); + Lighting.AddLight(Projectile.Center, 0.4f, 0.2f, 0.4f); for (int num121 = 0; num121 < 2; num121++) { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(3) ? 56 : 242, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + Dust dust4 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; dust4.velocity = Vector2.Zero; - dust4.position -= projectile.velocity / 5f * (float)num121; + dust4.position -= Projectile.velocity / 5f * (float)num121; dust4.noGravity = true; dust4.scale = 0.8f; dust4.noLight = true; @@ -61,19 +62,19 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D texture; - if (projectile.localAI[1] == 0f) - projectile.localAI[1] = Main.rand.Next(1, 3); - switch (projectile.localAI[1]) + if (Projectile.localAI[1] == 0f) + Projectile.localAI[1] = Main.rand.Next(1, 3); + switch (Projectile.localAI[1]) { case 2f: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/DWArrow2"); + texture = ModContent.Request("CalamityMod/Projectiles/Ranged/DWArrow2"); break; default: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/DWArrow"); + texture = ModContent.Request("CalamityMod/Projectiles/Ranged/DWArrow"); break; } - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Ranged/DaemonsFlameArrow.cs b/Projectiles/Ranged/DaemonsFlameArrow.cs index c1f5b87044..908f8a7fa5 100644 --- a/Projectiles/Ranged/DaemonsFlameArrow.cs +++ b/Projectiles/Ranged/DaemonsFlameArrow.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class DaemonsFlameArrow : ModProjectile @@ -16,65 +17,65 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.penetrate = 5; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.rotation += 0.15f; - Lighting.AddLight(projectile.Center, new Vector3(245, 124, 110) * (1.7f / 255)); + Projectile.rotation += 0.15f; + Lighting.AddLight(Projectile.Center, new Vector3(245, 124, 110) * (1.7f / 255)); x++; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 30f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 30f) { - projectile.velocity.Y = (float)(((double)projectile.ai[1]) * Math.Sin(x / 4)); + Projectile.velocity.Y = (float)(((double)Projectile.ai[1]) * Math.Sin(x / 4)); } for (int num151 = 0; num151 < 2; num151++) { int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 60, 0f, 0f, 100, default, 1.6f); + int num155 = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 60, 0f, 0f, 100, default, 1.6f); Main.dust[num155].noGravity = true; Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; + Main.dust[num155].velocity += Projectile.velocity * 0.5f; } if (Main.rand.NextBool(13)) { int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 60, 0f, 0f, 100, default, 1f); + int num157 = Dust.NewDust(new Vector2(Projectile.Center.X, Projectile.Center.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 60, 0f, 0f, 100, default, 1f); Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; + Main.dust[num157].velocity += Projectile.velocity * 0.5f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); // Massively inflate the projectile's hitbox - projectile.position = projectile.Center; - projectile.width = projectile.height = 160; - projectile.position.X = projectile.position.X - projectile.width / 2; - projectile.position.Y = projectile.position.Y - projectile.height / 2; + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 160; + Projectile.position.X = Projectile.position.X - Projectile.width / 2; + Projectile.position.Y = Projectile.position.Y - Projectile.height / 2; // Allow infinite piercing and completely ignoring iframes for this one last hit - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = false; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 0; - projectile.Damage(); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 0; + Projectile.Damage(); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -84,10 +85,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Ranged/DaemonsFlameBow.cs b/Projectiles/Ranged/DaemonsFlameBow.cs index 345048f7e8..f58f15564d 100644 --- a/Projectiles/Ranged/DaemonsFlameBow.cs +++ b/Projectiles/Ranged/DaemonsFlameBow.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -12,83 +13,83 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Daemon's Flame"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 54; - projectile.height = 116; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 54; + Projectile.height = 116; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.7f, 0.5f); - Player player = Main.player[projectile.owner]; + Lighting.AddLight(Projectile.Center, 0f, 0.7f, 0.5f); + Player player = Main.player[Projectile.owner]; float num = 0f; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { num = 3.14159274f; } - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num39 = 0; - if (projectile.ai[0] >= 30f) + if (Projectile.ai[0] >= 30f) { num39++; } - if (projectile.ai[0] >= 60f) + if (Projectile.ai[0] >= 60f) { num39++; } - if (projectile.ai[0] >= 90f) + if (Projectile.ai[0] >= 90f) { num39++; } - if (projectile.ai[0] >= 120f) + if (Projectile.ai[0] >= 120f) { num39++; } int num40 = 24; int num41 = 2; - projectile.ai[1] -= 1f; + Projectile.ai[1] -= 1f; bool flag15 = false; - if (projectile.ai[1] <= 0f) + if (Projectile.ai[1] <= 0f) { - projectile.ai[1] = (float)(num40 - num41 * num39); + Projectile.ai[1] = (float)(num40 - num41 * num39); flag15 = true; - int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); + int arg_1EF4_0 = (int)Projectile.ai[0] / (num40 - num41 * num39); } bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; - if (projectile.localAI[0] > 0f) + if (Projectile.localAI[0] > 0f) { - projectile.localAI[0] -= 1f; + Projectile.localAI[0] -= 1f; } - if (projectile.soundDelay <= 0 && flag16) + if (Projectile.soundDelay <= 0 && flag16) { - projectile.soundDelay = num40 - num41 * num39; - if (projectile.ai[0] != 1f) + Projectile.soundDelay = num40 - num41 * num39; + if (Projectile.ai[0] != 1f) { - Main.PlaySound(SoundID.Item5, projectile.position); + SoundEngine.PlaySound(SoundID.Item5, Projectile.position); } - projectile.localAI[0] = 12f; + Projectile.localAI[0] = 12f; } - if (flag15 && Main.myPlayer == projectile.owner) + if (flag15 && Main.myPlayer == Projectile.owner) { int num42 = ProjectileID.WoodenArrowFriendly; float scaleFactor11 = 14f; @@ -98,7 +99,7 @@ namespace CalamityMod.Projectiles.Ranged { 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; + 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) @@ -111,58 +112,58 @@ namespace CalamityMod.Projectiles.Ranged value19 = -Vector2.UnitY; } value19 *= scaleFactor12; - if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) + if (value19.X != Projectile.velocity.X || value19.Y != Projectile.velocity.Y) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity = value19 * 0.55f; + Projectile.velocity = value19 * 0.55f; for (int num43 = 0; num43 < 4; num43++) { - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + Vector2 vector20 = Vector2.Normalize(Projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) { vector20 = -Vector2.UnitY; } Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); - int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); + int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, Projectile.owner, 0f, 0f); Main.projectile[num44].noDropItem = true; } - Vector2 vector2 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + Vector2 vector2 = Vector2.Normalize(Projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); if (float.IsNaN(vector2.X) || float.IsNaN(vector2.Y)) { vector2 = -Vector2.UnitY; } float speedY = vector2.Y; Vector2 vector3 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); - Projectile.NewProjectile(vector3.X, vector3.Y, vector2.X, vector2.Y, ModContent.ProjectileType(), weaponDamage2, weaponKnockback2, projectile.owner, 0.0f, speedY); + Projectile.NewProjectile(vector3.X, vector3.Y, vector2.X, vector2.Y, ModContent.ProjectileType(), weaponDamage2, weaponKnockback2, Projectile.owner, 0.0f, speedY); } else { - projectile.Kill(); + Projectile.Kill(); } } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; Vector2 origin = new Vector2(27f, 58f); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Ranged/DaemonsFlameBowGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Ranged/DaemonsFlameBowGlow"), Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); } public override bool CanDamage() => false; diff --git a/Projectiles/Ranged/DesertMark.cs b/Projectiles/Ranged/DesertMark.cs index d048b75112..5e3330ad02 100644 --- a/Projectiles/Ranged/DesertMark.cs +++ b/Projectiles/Ranged/DesertMark.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -17,28 +18,28 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 900; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = -1; - Main.PlaySound(SoundID.Item, projectile.Center, 60); + Projectile.soundDelay = -1; + SoundEngine.PlaySound(SoundID.Item, Projectile.Center, 60); } - if (projectile.localAI[1] < 30f) + if (Projectile.localAI[1] < 30f) { for (int num1134 = 0; num1134 < 1; num1134++) { @@ -49,10 +50,10 @@ namespace CalamityMod.Projectiles.Ranged value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); value81.X *= -1f; Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default, 0.5f)]; dust34.position = position4; - dust34.customData = projectile.Center + value82; + dust34.customData = Projectile.Center + value82; dust34.fadeIn = 1f; dust34.scale = 0.3f; if (value81.X > -1.2f) @@ -62,50 +63,50 @@ namespace CalamityMod.Projectiles.Ranged dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; } } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + Projectile.localAI[0] = 0.8f; + Projectile.direction = 1; + Point point9 = Projectile.Center.ToTileCoordinates(); + Projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) + Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; + if (Projectile.localAI[1] < 33f) { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 8; + Projectile.alpha -= 8; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } - if (projectile.localAI[1] > 103f) + if (Projectile.localAI[1] > 103f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 16; + Projectile.alpha += 16; } - if (projectile.alpha > 255) + if (Projectile.alpha > 255) { - projectile.alpha = 255; + Projectile.alpha = 255; } } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); } for (int num1135 = 0; num1135 < 2; num1135++) { if (Main.rand.NextBool(10)) { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust dust35 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; dust35.noGravity = true; dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; + dust35.scale = Projectile.Opacity * Projectile.localAI[0]; + dust35.position = Projectile.Center; dust35.velocity = value83 * 2.5f; } } @@ -114,48 +115,48 @@ namespace CalamityMod.Projectiles.Ranged if (Main.rand.NextBool(10)) { Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; + Dust dust36 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; dust36.noGravity = true; dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; + dust36.scale = Projectile.Opacity * Projectile.localAI[0]; + dust36.position = Projectile.Center; dust36.velocity = value84 * 2.5f; } } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + Projectile.velocity = Vector2.Zero; + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner, 0f, 0f); } - if (projectile.localAI[1] >= 120f) + if (Projectile.localAI[1] >= 120f) { - projectile.Kill(); + Projectile.Kill(); return; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Color alpha5 = projectile.GetAlpha(color25); + Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[Projectile.type]; + Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alpha5 = Projectile.GetAlpha(color25); Vector2 origin7 = rectangle11.Size() / 2f; Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, Projectile.rotation, origin7, Projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Ranged/DesertTornado.cs b/Projectiles/Ranged/DesertTornado.cs index c4c7ce5e8b..7a241d36e6 100644 --- a/Projectiles/Ranged/DesertTornado.cs +++ b/Projectiles/Ranged/DesertTornado.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -17,32 +18,32 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 1200; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { //only 1 tornado can exist at a time - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 10f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] >= 10f) { - projectile.localAI[1] = 0f; + Projectile.localAI[1] = 0f; int projCount = 0; int oldestTornado = 0; float tornadoAge = 0f; - int projType = projectile.type; + int projType = Projectile.type; for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { Projectile proj = Main.projectile[projIndex]; - if (proj.active && proj.owner == projectile.owner && proj.type == projType && proj.ai[0] < 900f) + if (proj.active && proj.owner == Projectile.owner && proj.type == projType && proj.ai[0] < 900f) { projCount++; if (proj.ai[0] > tornadoAge) @@ -61,29 +62,29 @@ namespace CalamityMod.Projectiles.Ranged } float lifeSpan = 900f; - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = -1; - Main.PlaySound(SoundID.Item, projectile.Center, 122); + Projectile.soundDelay = -1; + SoundEngine.PlaySound(SoundID.Item, Projectile.Center, 122); } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= lifeSpan) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= lifeSpan) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.localAI[0] >= 30f) + if (Projectile.localAI[0] >= 30f) { - projectile.damage = 0; - if (projectile.ai[0] < lifeSpan - 120f) + Projectile.damage = 0; + if (Projectile.ai[0] < lifeSpan - 120f) { - float num1126 = projectile.ai[0] % 60f; - projectile.ai[0] = lifeSpan - 120f + num1126; - projectile.netUpdate = true; + float num1126 = Projectile.ai[0] % 60f; + Projectile.ai[0] = lifeSpan - 120f + num1126; + Projectile.netUpdate = true; } } float num1127 = 15f; float num1128 = 15f; - Point point8 = projectile.Center.ToTileCoordinates(); + Point point8 = Projectile.Center.ToTileCoordinates(); int num1129; int num1130; Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); @@ -94,14 +95,14 @@ namespace CalamityMod.Projectiles.Ranged Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); value74.X = value74.Y * 0.2f; - projectile.width = (int)(value74.X * 0.65f); - projectile.height = (int)value74.Y; - projectile.Center = vector146; - if (projectile.owner == Main.myPlayer) + Projectile.width = (int)(value74.X * 0.65f); + Projectile.height = (int)value74.Y; + Projectile.Center = vector146; + if (Projectile.owner == Main.myPlayer) { bool flag74 = false; - Vector2 center16 = Main.player[projectile.owner].Center; - Vector2 top = Main.player[projectile.owner].Top; + Vector2 center16 = Main.player[Projectile.owner].Center; + Vector2 top = Main.player[Projectile.owner].Top; for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) { Vector2 position2 = Vector2.Lerp(value72, value73, num1131); @@ -111,14 +112,14 @@ namespace CalamityMod.Projectiles.Ranged break; } } - if (!flag74 && projectile.ai[0] < lifeSpan - 120f) + if (!flag74 && Projectile.ai[0] < lifeSpan - 120f) { - float num1132 = projectile.ai[0] % 60f; - projectile.ai[0] = lifeSpan - 120f + num1132; - projectile.netUpdate = true; + float num1132 = Projectile.ai[0] % 60f; + Projectile.ai[0] = lifeSpan - 120f + num1132; + Projectile.netUpdate = true; } } - if (projectile.ai[0] < lifeSpan - 120f) + if (Projectile.ai[0] < lifeSpan - 120f) { return; } @@ -129,13 +130,13 @@ namespace CalamityMod.Projectiles.Ranged float num226 = 600f; float num227 = 15f; float num228 = 15f; - float num229 = projectile.ai[0]; + float num229 = Projectile.ai[0]; float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); if (num229 > num226 - 60f) { scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); } - Point point5 = projectile.Center.ToTileCoordinates(); + Point point5 = Projectile.Center.ToTileCoordinates(); int num230; int num231; Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); @@ -148,7 +149,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); vector33.X = vector33.Y * num232; new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Texture2D texture2D23 = Main.projectileTexture[Projectile.type]; Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); Vector2 origin3 = rectangle9.Size() / 2f; float num233 = -0.06283186f * num229; diff --git a/Projectiles/Ranged/DragonsBreathRound.cs b/Projectiles/Ranged/DragonsBreathRound.cs index f824d19528..a1b8031211 100644 --- a/Projectiles/Ranged/DragonsBreathRound.cs +++ b/Projectiles/Ranged/DragonsBreathRound.cs @@ -12,57 +12,57 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Dragon's Breath Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.extraUpdates = 10; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.ranged = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.extraUpdates = 10; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Ranged; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) +MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) +MathHelper.ToRadians(90) * Projectile.direction; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - float num93 = projectile.velocity.X / 3f; - float num94 = projectile.velocity.Y / 3f; + float num93 = Projectile.velocity.X / 3f; + float num94 = Projectile.velocity.Y / 3f; int num95 = 4; - int idx = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 127, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(new Vector2(Projectile.position.X + (float)num95, Projectile.position.Y + (float)num95), Projectile.width - num95 * 2, Projectile.height - num95 * 2, 127, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[idx]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.1f; + dust.velocity += Projectile.velocity * 0.1f; dust.position.X -= num93; dust.position.Y -= num94; if (Main.rand.NextBool(20)) { int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 127, 0f, 0f, 100, default, 0.6f); + int num98 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num97, Projectile.position.Y + (float)num97), Projectile.width - num97 * 2, Projectile.height - num97 * 2, 127, 0f, 0f, 100, default, 0.6f); Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; + Main.dust[num98].velocity += Projectile.velocity * 0.5f; } } } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceRanged = true; } @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } } diff --git a/Projectiles/Ranged/DrataliornusBow.cs b/Projectiles/Ranged/DrataliornusBow.cs index 4204c9b125..0588f44bcf 100644 --- a/Projectiles/Ranged/DrataliornusBow.cs +++ b/Projectiles/Ranged/DrataliornusBow.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -17,27 +18,27 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 64; - projectile.height = 84; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 64; + Projectile.height = 84; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } public override void AI() //mostly phangasm code { - Lighting.AddLight(projectile.Center, 255f / 255f, 154f / 255f, 58f / 255f); - Player player = Main.player[projectile.owner]; + Lighting.AddLight(Projectile.Center, 255f / 255f, 154f / 255f, 58f / 255f); + Player player = Main.player[Projectile.owner]; - projectile.ai[1]--; //usetime timer + Projectile.ai[1]--; //usetime timer - if (projectile.ai[0] >= 0) //spinup timer + if (Projectile.ai[0] >= 0) //spinup timer { - projectile.ai[0]++; + Projectile.ai[0]++; - switch ((int)projectile.ai[0]) + switch ((int)Projectile.ai[0]) { case 36: case 72: @@ -48,17 +49,17 @@ namespace CalamityMod.Projectiles.Ranged case 252: case 288: case 324: - projectile.localAI[0]++; + Projectile.localAI[0]++; break; case 360: - projectile.localAI[0]++; - projectile.ai[0] = -1f; //fully spun up, don't need timer anymore + Projectile.localAI[0]++; + Projectile.ai[0] = -1f; //fully spun up, don't need timer anymore const int num226 = 36; //dusts indicate fully spun up for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * 9f; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * 9f; vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * 6.28318548f / num226, default) + player.Center; Vector2 vector7 = vector6 - player.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 127, 0f, 0f, 0, default, 4f); @@ -72,22 +73,22 @@ namespace CalamityMod.Projectiles.Ranged int baseUseTime = 38; int modifier = 3; bool timeToFire = false; - if (projectile.ai[1] <= 0f) + if (Projectile.ai[1] <= 0f) { - projectile.ai[1] = baseUseTime - modifier * projectile.localAI[0]; + Projectile.ai[1] = baseUseTime - modifier * Projectile.localAI[0]; timeToFire = true; } bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; - if (projectile.soundDelay <= 0 && canFire) + if (Projectile.soundDelay <= 0 && canFire) { - projectile.soundDelay = baseUseTime - modifier * (int)projectile.localAI[0]; - if (projectile.ai[0] != 1f) - Main.PlaySound(SoundID.Item5, projectile.position); + Projectile.soundDelay = baseUseTime - modifier * (int)Projectile.localAI[0]; + if (Projectile.ai[0] != 1f) + SoundEngine.PlaySound(SoundID.Item5, Projectile.position); } - if (timeToFire && Main.myPlayer == projectile.owner) + if (timeToFire && Main.myPlayer == Projectile.owner) { if (canFire) //fire an angery flame { @@ -102,20 +103,20 @@ namespace CalamityMod.Projectiles.Ranged knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack); Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); - projectile.velocity = Main.screenPosition - playerPosition; - projectile.velocity.X += Main.mouseX; - projectile.velocity.Y += Main.mouseY; + Projectile.velocity = Main.screenPosition - playerPosition; + Projectile.velocity.X += Main.mouseX; + Projectile.velocity.Y += Main.mouseY; if (player.gravDir == -1f) - projectile.velocity.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - playerPosition.Y; + Projectile.velocity.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - playerPosition.Y; - projectile.velocity.Normalize(); + Projectile.velocity.Normalize(); - float variation = (1f + projectile.localAI[0]) * 3f; //variation increases as fire rate increases + float variation = (1f + Projectile.localAI[0]) * 3f; //variation increases as fire rate increases Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); - Vector2 speed = projectile.velocity * scaleFactor * (0.6f + Main.rand.NextFloat() * 0.6f); + Vector2 speed = Projectile.velocity * scaleFactor * (0.6f + Main.rand.NextFloat() * 0.6f); float ai0 = 0f; - if (projectile.ai[0] < 0f) //if fully spun up + if (Projectile.ai[0] < 0f) //if fully spun up { if (Main.rand.NextBool(3)) //chance to shoot homing { @@ -128,29 +129,29 @@ namespace CalamityMod.Projectiles.Ranged } } - Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, ai0, 0f); + Projectile.NewProjectile(position, speed, type, damage, knockBack, Projectile.owner, ai0, 0f); - projectile.netUpdate = true; + Projectile.netUpdate = true; } else { - projectile.Kill(); + Projectile.Kill(); } } //display projectile - projectile.rotation = projectile.velocity.ToRotation(); - Vector2 displayOffset = new Vector2(32, 0).RotatedBy(projectile.rotation); - projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; - if (projectile.spriteDirection == -1) - projectile.rotation += MathHelper.Pi; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.rotation = Projectile.velocity.ToRotation(); + Vector2 displayOffset = new Vector2(32, 0).RotatedBy(Projectile.rotation); + Projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; + if (Projectile.spriteDirection == -1) + Projectile.rotation += MathHelper.Pi; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); + player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * Projectile.direction, Projectile.velocity.X * Projectile.direction); } public override bool CanDamage() diff --git a/Projectiles/Ranged/DrataliornusExoArrow.cs b/Projectiles/Ranged/DrataliornusExoArrow.cs index ea6427fefb..296d7db66d 100644 --- a/Projectiles/Ranged/DrataliornusExoArrow.cs +++ b/Projectiles/Ranged/DrataliornusExoArrow.cs @@ -17,45 +17,45 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 4; - projectile.timeLeft = 60; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.arrow = true; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.extraUpdates = 4; + Projectile.timeLeft = 60; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } float num55 = 100f; float num56 = 3f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); return; } } @@ -69,15 +69,15 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 0; + target.immune[Projectile.owner] = 0; target.AddBuff(BuffID.Daybreak, 180); target.AddBuff(ModContent.BuffType(), 180); target.ExoDebuffs(); } - public override Color? GetAlpha(Color lightColor) => new Color(250, 25, 0, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(250, 25, 0, Projectile.alpha); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(100f, 3f, lightColor); } } diff --git a/Projectiles/Ranged/DrataliornusFlame.cs b/Projectiles/Ranged/DrataliornusFlame.cs index 54ddddc11b..9d10c5332d 100644 --- a/Projectiles/Ranged/DrataliornusFlame.cs +++ b/Projectiles/Ranged/DrataliornusFlame.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class DrataliornusFlame : ModProjectile @@ -17,61 +18,61 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.scale = 1.5f; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.arrow = true; - projectile.hide = true; - projectile.timeLeft = 180; + Projectile.width = 18; + Projectile.height = 18; + Projectile.scale = 1.5f; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.hide = true; + Projectile.timeLeft = 180; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); - if (projectile.hide) //called on first AI tick only - more initializations + if (Projectile.hide) //called on first AI tick only - more initializations { - projectile.hide = false; - projectile.ai[1] = -1f; + Projectile.hide = false; + Projectile.ai[1] = -1f; - if (projectile.ai[0] != 0f) //if empowered fireball + if (Projectile.ai[0] != 0f) //if empowered fireball { - projectile.extraUpdates = 1; - projectile.localAI[0] = Main.rand.Next(30); + Projectile.extraUpdates = 1; + Projectile.localAI[0] = Main.rand.Next(30); - if (projectile.ai[0] == 2f) //if homing fireball - projectile.timeLeft += 180; + if (Projectile.ai[0] == 2f) //if homing fireball + Projectile.timeLeft += 180; } - projectile.netUpdate = true; + Projectile.netUpdate = true; } //intangible until it's in completely open space - if (!projectile.tileCollide && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (!Projectile.tileCollide && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.tileCollide = true; - projectile.netUpdate = true; + Projectile.tileCollide = true; + Projectile.netUpdate = true; } - projectile.localAI[0]++; - if (projectile.localAI[0] > 60f) //dragon dust trail counter, but only empowered proj spawns it + Projectile.localAI[0]++; + if (Projectile.localAI[0] > 60f) //dragon dust trail counter, but only empowered proj spawns it { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; - if (projectile.ai[0] != 0f && projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 3, projectile.knockBack * 3f, projectile.owner); + if (Projectile.ai[0] != 0f && Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 3f, Projectile.owner); } - projectile.localAI[1]++; - if (projectile.localAI[1] > 12f) //homing counter, checks every 12/2=6 ticks + Projectile.localAI[1]++; + if (Projectile.localAI[1] > 12f) //homing counter, checks every 12/2=6 ticks { - projectile.localAI[1] = 0f; + Projectile.localAI[1] = 0f; - if (projectile.ai[0] == 2f && projectile.ai[1] < 0f) //if homing fireball and no target + if (Projectile.ai[0] == 2f && Projectile.ai[1] < 0f) //if homing fireball and no target { int possibleTarget = -1; float closestDistance = 700f; @@ -81,9 +82,9 @@ namespace CalamityMod.Projectiles.Ranged NPC npc = Main.npc[i]; if (npc.active && npc.chaseable && npc.lifeMax > 5 && !npc.dontTakeDamage && !npc.friendly && - !npc.immortal && Collision.CanHit(projectile.Center, 0, 0, npc.Center, 0, 0)) + !npc.immortal && Collision.CanHit(Projectile.Center, 0, 0, npc.Center, 0, 0)) { - float distance = Vector2.Distance(projectile.Center, npc.Center); + float distance = Vector2.Distance(Projectile.Center, npc.Center); if (closestDistance > distance) { @@ -93,19 +94,19 @@ namespace CalamityMod.Projectiles.Ranged } } - projectile.ai[1] = possibleTarget; - projectile.netUpdate = true; + Projectile.ai[1] = possibleTarget; + Projectile.netUpdate = true; } } - if (projectile.ai[1] != -1f) //if has target + if (Projectile.ai[1] != -1f) //if has target { - NPC npc = Main.npc[(int)projectile.ai[1]]; + NPC npc = Main.npc[(int)Projectile.ai[1]]; if (npc.active && npc.chaseable && !npc.dontTakeDamage) //do homing { - Vector2 distance = npc.Center - projectile.Center; - double angle = distance.ToRotation() - projectile.velocity.ToRotation(); + Vector2 distance = npc.Center - Projectile.Center; + double angle = distance.ToRotation() - Projectile.velocity.ToRotation(); if (angle > Math.PI) angle -= 2.0 * Math.PI; if (angle < -Math.PI) @@ -113,7 +114,7 @@ namespace CalamityMod.Projectiles.Ranged if (Math.Abs(angle) > Math.PI * 0.75) { - projectile.velocity = projectile.velocity.RotatedBy(angle * 0.07); + Projectile.velocity = Projectile.velocity.RotatedBy(angle * 0.07); } else { @@ -121,35 +122,35 @@ namespace CalamityMod.Projectiles.Ranged float difference = 12.7f / range; distance *= difference; distance /= 7f; - projectile.velocity += distance; + Projectile.velocity += distance; if (range > 70f) { - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; } } } else //target not valid, stop homing { - projectile.ai[1] = -1; - projectile.netUpdate = true; + Projectile.ai[1] = -1; + Projectile.netUpdate = true; } } - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.5f + Main.rand.NextFloat()); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f + Main.rand.NextFloat()); Main.dust[d].noGravity = true; - Lighting.AddLight(projectile.Center, 255f / 255f, 154f / 255f, 58f / 255f); + Lighting.AddLight(Projectile.Center, 255f / 255f, 154f / 255f, 58f / 255f); } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 154, 58, projectile.alpha); + return new Color(255, 154, 58, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture2D13.Width, texture2D13.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)texture2D13.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture2D13.Width, texture2D13.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)texture2D13.Height / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -157,57 +158,57 @@ namespace CalamityMod.Projectiles.Ranged { if (timeLeft != 0) { - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); - if (projectile.ai[0] != 0f && projectile.owner == Main.myPlayer) //if empowered, make exo arrow and dragon dust + if (Projectile.ai[0] != 0f && Projectile.owner == Main.myPlayer) //if empowered, make exo arrow and dragon dust { - Vector2 vector3 = projectile.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); - Vector2 speed = projectile.Center - vector3; + Vector2 vector3 = Projectile.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); + Vector2 speed = Projectile.Center - vector3; speed /= 30f; - Projectile.NewProjectile(vector3.X, vector3.Y, speed.X, speed.Y, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(vector3.X, vector3.Y, speed.X, speed.Y, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 3, projectile.knockBack * 2f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 2f, Projectile.owner); } - projectile.position = projectile.Center; - projectile.width = 180; - projectile.height = 180; - projectile.position.X = projectile.position.X - 90; - projectile.position.Y = projectile.position.Y - 90; + Projectile.position = Projectile.Center; + Projectile.width = 180; + Projectile.height = 180; + Projectile.position.X = Projectile.position.X - 90; + Projectile.position.Y = Projectile.position.Y - 90; //just dusts const int num226 = 24; float modifier = 4f + 8f * Main.rand.NextFloat(); for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * modifier; - vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * 6.28318548f / num226, default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * modifier; + vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * 6.28318548f / num226, default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 174, 0f, 0f, 45, default, 2f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } for (int num193 = 0; num193 < 4; num193++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 174, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 174, 0f, 0f, 50, default, 1.5f); - int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 174, 0f, 0f, 50, default, 1f); + int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 174, 0f, 0f, 50, default, 1f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 2f; } for (int num194 = 0; num194 < 12; num194++) { - int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 0, default, 3f); + int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 0, default, 3f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; } - projectile.timeLeft = 0; //should avoid infinite loop if a hit npc calls proj.Kill() - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 3; - projectile.Damage(); + Projectile.timeLeft = 0; //should avoid infinite loop if a hit npc calls proj.Kill() + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 3; + Projectile.Damage(); } } @@ -215,49 +216,49 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 240); - if (projectile.ai[0] != 0f && projectile.owner == Main.myPlayer) //if empowered + if (Projectile.ai[0] != 0f && Projectile.owner == Main.myPlayer) //if empowered { - if (projectile.timeLeft != 0) //will not be called on npcs hit by explosion (only direct hits) + if (Projectile.timeLeft != 0) //will not be called on npcs hit by explosion (only direct hits) { //make exo arrow, make meteor Vector2 vector3 = target.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); Vector2 speed = target.Center - vector3; speed /= 30f; - Projectile.NewProjectile(vector3.X, vector3.Y, speed.X, speed.Y, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(vector3.X, vector3.Y, speed.X, speed.Y, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); Vector2 vel = new Vector2(Main.rand.Next(-400, 401), Main.rand.Next(500, 801)); Vector2 pos = target.Center - vel; vel.X += Main.rand.Next(-100, 101); vel.Normalize(); vel *= 30f; - Projectile.NewProjectile(pos, vel + target.velocity, ModContent.ProjectileType(), (int)(projectile.damage * 1.5f), projectile.knockBack * 5f, projectile.owner); + Projectile.NewProjectile(pos, vel + target.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack * 5f, Projectile.owner); } } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 0; + target.immune[Projectile.owner] = 0; target.AddBuff(BuffID.Daybreak, 240); target.AddBuff(ModContent.BuffType(), 240); - if (projectile.ai[0] != 0f && projectile.owner == Main.myPlayer) //if empowered + if (Projectile.ai[0] != 0f && Projectile.owner == Main.myPlayer) //if empowered { - if (projectile.timeLeft != 0) //will not be called on npcs hit by explosion (only direct hits) + if (Projectile.timeLeft != 0) //will not be called on npcs hit by explosion (only direct hits) { //make exo arrow, make meteor Vector2 vector3 = target.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); Vector2 speed = target.Center - vector3; speed /= 30f; - Projectile.NewProjectile(vector3.X, vector3.Y, speed.X, speed.Y, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(vector3.X, vector3.Y, speed.X, speed.Y, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); Vector2 vel = new Vector2(Main.rand.Next(-400, 401), Main.rand.Next(500, 801)); Vector2 pos = target.Center - vel; vel.X += Main.rand.Next(-100, 101); vel.Normalize(); vel *= 30f; - Projectile.NewProjectile(pos, vel + target.velocity, ModContent.ProjectileType(), projectile.damage * 3, projectile.knockBack * 5f, projectile.owner); + Projectile.NewProjectile(pos, vel + target.velocity, ModContent.ProjectileType(), Projectile.damage * 3, Projectile.knockBack * 5f, Projectile.owner); } } } diff --git a/Projectiles/Ranged/DrizzlefishFire.cs b/Projectiles/Ranged/DrizzlefishFire.cs index 5258eddd04..1dc6f946ed 100644 --- a/Projectiles/Ranged/DrizzlefishFire.cs +++ b/Projectiles/Ranged/DrizzlefishFire.cs @@ -17,25 +17,25 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = 5; - projectile.extraUpdates = 1; - projectile.timeLeft = 90; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 5; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 90; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { //Changes the texture of the projectile - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/DrizzlefishFire2"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, 16, 16)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Ranged/DrizzlefishFire2"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, 16, 16)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } return true; @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { int dustType = 235; - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { if (Main.rand.NextBool(2)) { @@ -64,51 +64,51 @@ namespace CalamityMod.Projectiles.Ranged { int numProj = 2; float rotation = MathHelper.ToRadians(Main.rand.Next(15,26)); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { for (int i = 0; i < numProj + 1; i++) { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f); } } else { for (int i = 0; i < numProj + 1; i++) { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } - projectile.Kill(); + Projectile.Kill(); } - Lighting.AddLight(projectile.Center, 0.25f, 0f, 0f); - if (projectile.timeLeft > 90) + Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0f); + if (Projectile.timeLeft > 90) { - projectile.timeLeft = 90; + Projectile.timeLeft = 90; } - if (projectile.ai[0] > 7f) + if (Projectile.ai[0] > 7f) { float num296 = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { num296 = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { num296 = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; for (int num298 = 0; num298 < 2; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); if (Main.rand.NextBool(3)) { Main.dust[num299].noGravity = true; @@ -131,14 +131,14 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { target.AddBuff(BuffID.OnFire, 180); } diff --git a/Projectiles/Ranged/DrizzlefishFireSplit.cs b/Projectiles/Ranged/DrizzlefishFireSplit.cs index c3b38bc083..40635e4682 100644 --- a/Projectiles/Ranged/DrizzlefishFireSplit.cs +++ b/Projectiles/Ranged/DrizzlefishFireSplit.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = 5; - projectile.timeLeft = 90; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 15; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 5; + Projectile.timeLeft = 90; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 15; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { //Changes the texture of the projectile - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/DrizzlefishFire2"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, 16, 16)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Ranged/DrizzlefishFire2"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, 16, 16)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } return true; @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { int dustType = 235; - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { if (Main.rand.NextBool(2)) { @@ -58,30 +58,30 @@ namespace CalamityMod.Projectiles.Ranged { dustType = 235; } - Lighting.AddLight(projectile.Center, 0.25f, 0f, 0f); - if (projectile.timeLeft > 90) + Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0f); + if (Projectile.timeLeft > 90) { - projectile.timeLeft = 90; + Projectile.timeLeft = 90; } - if (projectile.ai[0] > 7f) + if (Projectile.ai[0] > 7f) { float num296 = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { num296 = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { num296 = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; for (int num298 = 0; num298 < 2; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); if (Main.rand.NextBool(3)) { Main.dust[num299].noGravity = true; @@ -104,14 +104,14 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { target.AddBuff(BuffID.OnFire, 120); } diff --git a/Projectiles/Ranged/DrizzlefishFireball.cs b/Projectiles/Ranged/DrizzlefishFireball.cs index 73a4791e2f..1d44dbd20d 100644 --- a/Projectiles/Ranged/DrizzlefishFireball.cs +++ b/Projectiles/Ranged/DrizzlefishFireball.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 5; - projectile.aiStyle = 14; - projectile.timeLeft = 300; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 5; + Projectile.aiStyle = 14; + Projectile.timeLeft = 300; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.25f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0f); int dustType = 235; - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { if (Main.rand.NextBool(2)) { @@ -46,12 +46,12 @@ namespace CalamityMod.Projectiles.Ranged { dustType = 235; } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 5; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -60,13 +60,13 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { target.AddBuff(BuffID.OnFire, 180); } diff --git a/Projectiles/Ranged/DualpoonProj.cs b/Projectiles/Ranged/DualpoonProj.cs index 9e389e9cdd..2d4130e0f1 100644 --- a/Projectiles/Ranged/DualpoonProj.cs +++ b/Projectiles/Ranged/DualpoonProj.cs @@ -13,28 +13,28 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.ranged = true; - projectile.extraUpdates = 0; - projectile.timeLeft = 300; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 0; + Projectile.timeLeft = 300; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player.dead) { - projectile.Kill(); + Projectile.Kill(); return; } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - if (projectile.Center.X > player.Center.X) + if (Projectile.Center.X > player.Center.X) { player.ChangeDir(1); } @@ -43,56 +43,56 @@ namespace CalamityMod.Projectiles.Ranged player.ChangeDir(-1); } } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.extraUpdates = 0; + Projectile.extraUpdates = 0; } else { - projectile.extraUpdates = 1; + Projectile.extraUpdates = 1; } - Vector2 playerVector = player.Center - projectile.Center; + Vector2 playerVector = player.Center - Projectile.Center; float playerDist = playerVector.Length(); - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { if (playerDist > 700f) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } else if (playerDist > 350f) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; - projectile.ai[1] += 1f; - if (projectile.ai[1] > 5f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 5f) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.ai[1] > 8f) + if (Projectile.ai[1] > 8f) { - projectile.ai[1] = 8f; + Projectile.ai[1] = 8f; } - if (projectile.ai[1] >= 10f) + if (Projectile.ai[1] >= 10f) { - projectile.ai[1] = 15f; - projectile.velocity.Y += 0.3f; + Projectile.ai[1] = 15f; + Projectile.velocity.Y += 0.3f; } } - else if (projectile.ai[0] == 1f) + else if (Projectile.ai[0] == 1f) { - projectile.tileCollide = false; - projectile.rotation = (float)Math.Atan2((double)playerVector.Y, (double)playerVector.X) - MathHelper.PiOver2; + Projectile.tileCollide = false; + Projectile.rotation = (float)Math.Atan2((double)playerVector.Y, (double)playerVector.X) - MathHelper.PiOver2; float returnSpeed = 20f; if (playerDist < 50f) { - projectile.Kill(); + Projectile.Kill(); } playerDist = returnSpeed / playerDist; playerVector.X *= playerDist; playerVector.Y *= playerDist; - projectile.velocity.X = playerVector.X; - projectile.velocity.Y = playerVector.Y; + Projectile.velocity.X = playerVector.X; + Projectile.velocity.Y = playerVector.Y; } } } diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index ce616e9bd2..5197dbea52 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -16,45 +17,45 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Arrow"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.aiStyle = 1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.aiStyle = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 32; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); for (int num621 = 0; num621 < 2; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -64,28 +65,28 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 6; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); - float x = projectile.position.X + Main.rand.Next(-400, 400); - float y = projectile.position.Y - Main.rand.Next(500, 800); + CalamityUtils.ExplosionGores(Projectile.Center, 3); + float x = Projectile.position.X + Main.rand.Next(-400, 400); + float y = Projectile.position.Y - Main.rand.Next(500, 800); Vector2 vector = new Vector2(x, y); - float num15 = projectile.position.X + (projectile.width / 2) - vector.X; - float num16 = projectile.position.Y + (projectile.height / 2) - vector.Y; + float num15 = Projectile.position.X + (Projectile.width / 2) - vector.X; + float num16 = Projectile.position.Y + (Projectile.height / 2) - vector.Y; num15 += Main.rand.Next(-100, 101); int num17 = 25; float num18 = (float)Math.Sqrt(num15 * num15 + num16 * num16); num18 = num17 / num18; num15 *= num18; num16 *= num18; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), projectile.damage / 2, 5f, projectile.owner, 0f, 0f); - Main.projectile[num19].ai[1] = projectile.position.Y; + int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), Projectile.damage / 2, 5f, Projectile.owner, 0f, 0f); + Main.projectile[num19].ai[1] = Projectile.position.Y; } } @@ -96,7 +97,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/EmesisGore.cs b/Projectiles/Ranged/EmesisGore.cs index 08c79013d8..315d949dc9 100644 --- a/Projectiles/Ranged/EmesisGore.cs +++ b/Projectiles/Ranged/EmesisGore.cs @@ -17,15 +17,15 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 10; - projectile.timeLeft = 600; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 10; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } public override void SendExtraAI(BinaryWriter writer) { @@ -37,28 +37,28 @@ namespace CalamityMod.Projectiles.Ranged } public override void AI() { - projectile.StickyProjAI(15); + Projectile.StickyProjAI(15); // Override the default DOT used in the method above. - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.localAI[0] = 5f; - projectile.velocity = Vector2.Zero; + Projectile.localAI[0] = 5f; + Projectile.velocity = Vector2.Zero; HurtCounter++; if (HurtCounter % HurtTimeIncrement == 0) { - Main.npc[(int)projectile.ai[1]].HitEffect(0, 50.0); + Main.npc[(int)Projectile.ai[1]].HitEffect(0, 50.0); } } else { - projectile.rotation += (projectile.velocity.X > 0).ToDirectionInt() * MathHelper.ToRadians(8f); + Projectile.rotation += (Projectile.velocity.X > 0).ToDirectionInt() * MathHelper.ToRadians(8f); } - if (projectile.timeLeft % 12 == 11) + if (Projectile.timeLeft % 12 == 11) { - for (int i = 0; i < (projectile.ai[0] == 1f ? 3 : 1); i++) + for (int i = 0; i < (Projectile.ai[0] == 1f ? 3 : 1); i++) { - Dust dust = Dust.NewDustDirect(projectile.position, 10, 10, 27); + Dust dust = Dust.NewDustDirect(Projectile.position, 10, 10, 27); dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi); dust.noGravity = true; } @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(8, true); + Projectile.ModifyHitNPCSticky(8, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Ranged/EnhancedNanoRoundProj.cs b/Projectiles/Ranged/EnhancedNanoRoundProj.cs index 0ce45e0ab1..1a04bd7d00 100644 --- a/Projectiles/Ranged/EnhancedNanoRoundProj.cs +++ b/Projectiles/Ranged/EnhancedNanoRoundProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,36 +12,36 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Enhanced Nano Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 3; aiType = ProjectileID.Bullet; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.25f); + Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0.25f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 229, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; + int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 229, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = Projectile.alpha; Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; } @@ -49,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } @@ -64,12 +65,12 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(BuffID.Confused, 300); if (target.life <= 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 2; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 0f, Projectile.owner, 0f, 0f); } } } @@ -77,11 +78,11 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item93, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item93, (int)Projectile.position.X, (int)Projectile.position.Y); int num212 = Main.rand.Next(5, 10); for (int num213 = 0; num213 < num212; num213++) { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 229, 0f, 0f, 100, default, 2f); + int num214 = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 229, 0f, 0f, 100, default, 2f); Main.dust[num214].velocity *= 2f; Main.dust[num214].noGravity = true; } diff --git a/Projectiles/Ranged/EssenceFire.cs b/Projectiles/Ranged/EssenceFire.cs index 5dbc116f41..5ce3ef8407 100644 --- a/Projectiles/Ranged/EssenceFire.cs +++ b/Projectiles/Ranged/EssenceFire.cs @@ -16,48 +16,48 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 65; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 65; } public override void AI() { - if (projectile.scale <= 1.5f) + if (Projectile.scale <= 1.5f) { - projectile.scale *= 1.01f; + Projectile.scale *= 1.01f; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.45f / 255f); - if (projectile.timeLeft > 65) - projectile.timeLeft = 65; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.45f / 255f); + if (Projectile.timeLeft > 65) + Projectile.timeLeft = 65; - if (projectile.ai[0] > 5f) + if (Projectile.ai[0] > 5f) { float num296 = 1f; - if (projectile.ai[0] == 6f) + if (Projectile.ai[0] == 6f) { num296 = 0.25f; } - else if (projectile.ai[0] == 7f) + else if (Projectile.ai[0] == 7f) { num296 = 0.5f; } - else if (projectile.ai[0] == 8f) + else if (Projectile.ai[0] == 8f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int dustType = (int)CalamityDusts.PurpleCosmilite; if (Main.rand.NextBool(2)) { for (int num298 = 0; num298 < 1; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; dust.scale *= num296; - dust.velocity += projectile.velocity; + dust.velocity += Projectile.velocity; if (!dust.noGravity) { dust.velocity *= 0.5f; @@ -83,15 +83,15 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * projectile.direction; + Projectile.rotation += 0.3f * Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 240); - target.immune[projectile.owner] = 1; + target.immune[Projectile.owner] = 1; } } } diff --git a/Projectiles/Ranged/ExoFire.cs b/Projectiles/Ranged/ExoFire.cs index 129ae06db1..dfb0d31225 100644 --- a/Projectiles/Ranged/ExoFire.cs +++ b/Projectiles/Ranged/ExoFire.cs @@ -17,34 +17,34 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 3; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 5; - projectile.timeLeft = 180; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 3; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; + Projectile.timeLeft = 180; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] <= 3f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] <= 3f) return; float dustScale = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { dustScale = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { dustScale = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { dustScale = 0.75f; } @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i < 2; i++) { - Dust d = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, dustID, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 0.6f); + Dust d = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustID, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 0.6f); if (Main.rand.NextBool(3)) { d.scale *= 1.5f; @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Ranged d.velocity.X *= 0.8f; d.velocity.Y *= 0.8f; d.scale *= dustScale; - d.velocity += projectile.velocity; + d.velocity += Projectile.velocity; } } } diff --git a/Projectiles/Ranged/ExoFlare.cs b/Projectiles/Ranged/ExoFlare.cs index 278ea6f872..d4f53f7d76 100644 --- a/Projectiles/Ranged/ExoFlare.cs +++ b/Projectiles/Ranged/ExoFlare.cs @@ -14,75 +14,75 @@ namespace CalamityMod.Projectiles.Ranged public float OffsetSpeed { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public float OffsetRotation { - get => projectile.ai[1]; - set => projectile.ai[1] = value; + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; } public override void SetStaticDefaults() { DisplayName.SetDefault("Exo Flare"); - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; } public override void SetDefaults() { - projectile.width = projectile.height = 24; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; - projectile.timeLeft = 160; + Projectile.width = Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; + Projectile.timeLeft = 160; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { OffsetRotation = Main.rand.NextFloat(MathHelper.TwoPi); OffsetSpeed = Main.rand.NextFloat(MathHelper.ToRadians(2.5f), MathHelper.ToRadians(4f)) * Main.rand.NextBool(2).ToDirectionInt(); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } // Ensure that the owner projectile index is a valid one. - if (!Main.projectile.IndexInRange((int)projectile.localAI[1])) + if (!Main.projectile.IndexInRange((int)Projectile.localAI[1])) { - projectile.Kill(); + Projectile.Kill(); return; } - Projectile owner = Main.projectile[(int)projectile.localAI[1]]; + Projectile owner = Main.projectile[(int)Projectile.localAI[1]]; // Ensure the owner is the correct projectile. if (owner.type != ModContent.ProjectileType()) - projectile.Kill(); + Projectile.Kill(); // Movement around the owner. - projectile.Center = owner.Center + OffsetRotation.ToRotationVector2() * (float)Math.Cos(OffsetRotation * 0.3f) * owner.Size * 0.5f; - projectile.rotation = (projectile.position - projectile.oldPos[1]).ToRotation(); + Projectile.Center = owner.Center + OffsetRotation.ToRotationVector2() * (float)Math.Cos(OffsetRotation * 0.3f) * owner.Size * 0.5f; + Projectile.rotation = (Projectile.position - Projectile.oldPos[1]).ToRotation(); OffsetRotation += OffsetSpeed; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D lightTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/PhotovisceratorLight"); - for (int i = 0; i < projectile.oldPos.Length; i++) + Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/PhotovisceratorLight"); + for (int i = 0; i < Projectile.oldPos.Length; i++) { - float colorInterpolation = (float)Math.Cos(projectile.timeLeft / 16f + Main.GlobalTime / 20f + i / (float)projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; + float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 16f + Main.GlobalTime / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; Color color = Color.Lerp(Color.LightGreen, Color.LightPink, colorInterpolation) * 0.4f; color.A = 0; - Vector2 drawPosition = projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Color outerColor = color; Color innerColor = color * 0.5f; float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTime % 60f * MathHelper.TwoPi); // Become smaller the futher along the old positions we are. - intensity *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)projectile.oldPos.Length); + intensity *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)Projectile.oldPos.Length); Vector2 outerScale = new Vector2(1.65f) * intensity; Vector2 innerScale = new Vector2(1.65f) * intensity * 0.7f; diff --git a/Projectiles/Ranged/ExoFlareCluster.cs b/Projectiles/Ranged/ExoFlareCluster.cs index 15345ce820..5d840129e1 100644 --- a/Projectiles/Ranged/ExoFlareCluster.cs +++ b/Projectiles/Ranged/ExoFlareCluster.cs @@ -15,68 +15,68 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Exo Flare Cluster"); - ProjectileID.Sets.NeedsUUID[projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.timeLeft = 180; + Projectile.width = Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.timeLeft = 180; } public override void AI() { // localAI[0] is used by the sticky AI method, so use localAI[1] to spawn the flares. - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { if (Main.netMode != NetmodeID.Server) { int projID = ModContent.ProjectileType(); - int flareDamage = (int)(0.6f * projectile.damage); - float flareKB = projectile.knockBack; + int flareDamage = (int)(0.6f * Projectile.damage); + float flareKB = Projectile.knockBack; for (int i = 0; i < 4; i++) { - Projectile p = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, projID, flareDamage, flareKB, projectile.owner); - p.localAI[1] = Projectile.GetByUUID(projectile.owner, projectile.whoAmI); + Projectile p = Projectile.NewProjectileDirect(Projectile.Center, Vector2.Zero, projID, flareDamage, flareKB, Projectile.owner); + p.localAI[1] = Projectile.GetByUUID(Projectile.owner, Projectile.whoAmI); } } - projectile.localAI[1] = 1f; + Projectile.localAI[1] = 1f; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxDistanceFromTarget, true, true); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(MaxDistanceFromTarget, true, true); if (potentialTarget != null) { - if (projectile.Distance(potentialTarget.Center) > MinDistanceFromTarget) + if (Projectile.Distance(potentialTarget.Center) > MinDistanceFromTarget) { - float angleOffset = projectile.AngleTo(potentialTarget.Center) - projectile.velocity.ToRotation(); + float angleOffset = Projectile.AngleTo(potentialTarget.Center) - Projectile.velocity.ToRotation(); angleOffset = MathHelper.WrapAngle(angleOffset); - projectile.velocity = projectile.velocity.RotatedBy(MathHelper.Clamp(angleOffset, -0.1f, 0.1f)); + Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.Clamp(angleOffset, -0.1f, 0.1f)); } } } - projectile.StickyProjAI(5); + Projectile.StickyProjAI(5); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(4, true); + Projectile.ModifyHitNPCSticky(4, true); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.width == 50) + if (Projectile.width == 50) { int width = (int)MathHelper.Min(target.Hitbox.Width, 60); int height = (int)MathHelper.Min(target.Hitbox.Height, 60); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, width, height); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, width, height); } target.ExoDebuffs(2f); } diff --git a/Projectiles/Ranged/ExoLight.cs b/Projectiles/Ranged/ExoLight.cs index d8144bb296..fb98c97304 100644 --- a/Projectiles/Ranged/ExoLight.cs +++ b/Projectiles/Ranged/ExoLight.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -18,35 +19,35 @@ namespace CalamityMod.Projectiles.Ranged public const float MaxRadius = 90f; public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public int DustType { - get => (int)projectile.ai[1]; - set => projectile.ai[1] = value; + get => (int)Projectile.ai[1]; + set => Projectile.ai[1] = value; } public float YDirection { - get => projectile.localAI[1]; - set => projectile.localAI[1] = value; + get => Projectile.localAI[1]; + set => Projectile.localAI[1] = value; } public override void SetStaticDefaults() { DisplayName.SetDefault("Exo Light"); - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; } public override void SetDefaults() { - projectile.width = projectile.height = 40; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 127; + Projectile.width = Projectile.height = 40; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.alpha = 127; } public override void SendExtraAI(BinaryWriter writer) @@ -62,23 +63,23 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, Color.DarkSlateGray.ToVector3()); - projectile.alpha = (int)MathHelper.Lerp(255, 127, Utils.InverseLerp(0f, 25f, Time, true)); - projectile.scale = MathHelper.Lerp(0.001f, 1f, Utils.InverseLerp(0f, 25f, Time, true)); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, Color.DarkSlateGray.ToVector3()); + Projectile.alpha = (int)MathHelper.Lerp(255, 127, Utils.InverseLerp(0f, 25f, Time, true)); + Projectile.scale = MathHelper.Lerp(0.001f, 1f, Utils.InverseLerp(0f, 25f, Time, true)); + if (Projectile.localAI[0] == 0f) { - InitialCenter = projectile.Center; - if (Main.myPlayer == projectile.owner) + InitialCenter = Projectile.Center; + if (Main.myPlayer == Projectile.owner) { Destination = Main.MouseWorld; - projectile.netUpdate = true; + Projectile.netUpdate = true; } DustType = Main.rand.NextBool(2) ? 107 : 234; if (Main.rand.NextBool(4)) { DustType = 269; } - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } if (Destination == Vector2.Zero) @@ -86,8 +87,8 @@ namespace CalamityMod.Projectiles.Ranged if (Time <= 90f) { - projectile.position = Vector2.Lerp(InitialCenter, Destination, Time / 90f); - projectile.position.Y += (float)Math.Sin(Time / 90f * MathHelper.TwoPi) * 75f; + Projectile.position = Vector2.Lerp(InitialCenter, Destination, Time / 90f); + Projectile.position.Y += (float)Math.Sin(Time / 90f * MathHelper.TwoPi) * 75f; } else if (Time < 180f) { @@ -99,12 +100,12 @@ namespace CalamityMod.Projectiles.Ranged radius *= 1f + (float)Math.Cos(Main.GlobalTime / 24f) * 0.25f; if (radius < 5f) radius = 5f; - projectile.Center = Destination + ((Time - 90) / 90f * MathHelper.ToRadians(720f) + (YDirection == -1).ToInt() * MathHelper.Pi).ToRotationVector2() * radius; + Projectile.Center = Destination + ((Time - 90) / 90f * MathHelper.ToRadians(720f) + (YDirection == -1).ToInt() * MathHelper.Pi).ToRotationVector2() * radius; } else if (Time == 180f) - projectile.Kill(); + Projectile.Kill(); - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; Time++; } @@ -113,8 +114,8 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 9; i++) { float angle = Time / 45f + i / 9f * MathHelper.TwoPi; - Vector2 offsetSpan = angle.ToRotationVector2() * projectile.Size * 0.65f * projectile.scale; - Vector2 edgePosition = projectile.Center + offsetSpan.RotatedBy(projectile.rotation); + Vector2 offsetSpan = angle.ToRotationVector2() * Projectile.Size * 0.65f * Projectile.scale; + Vector2 edgePosition = Projectile.Center + offsetSpan.RotatedBy(Projectile.rotation); Dust dust = Dust.NewDustPerfect(edgePosition + Main.rand.NextVector2Circular(4f, 4f), DustType); dust.velocity = Vector2.Zero; dust.noGravity = true; @@ -129,33 +130,33 @@ namespace CalamityMod.Projectiles.Ranged Color.PaleGreen, Color.Violet, Color.SlateGray - }) * projectile.Opacity; + }) * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D lightTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/PhotovisceratorLight"); - for (int i = 0; i < projectile.oldPos.Length; i++) + Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/PhotovisceratorLight"); + for (int i = 0; i < Projectile.oldPos.Length; i++) { - float colorInterpolation = (float)Math.Cos(projectile.timeLeft / 16f + Main.GlobalTime / 20f + i / (float)projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; + float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 16f + Main.GlobalTime / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; Color color = CalamityUtils.MulticolorLerp(MathHelper.Clamp(colorInterpolation, 0f, 0.99f), new Color[] { Color.PaleGreen, Color.Violet, Color.SlateGray - }) * projectile.Opacity; + }) * Projectile.Opacity; color.A = 0; - Vector2 drawPosition = projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Color outerColor = color; Color innerColor = color * 0.5f; float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTime % 60f * MathHelper.TwoPi); // Become smaller the futher along the old positions we are. - intensity *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)projectile.oldPos.Length); + intensity *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)Projectile.oldPos.Length); Vector2 outerScale = new Vector2(1.25f) * intensity; Vector2 innerScale = new Vector2(1.25f) * intensity * 0.7f; - outerColor *= intensity * projectile.scale; - innerColor *= intensity * projectile.scale; + outerColor *= intensity * Projectile.scale; + innerColor *= intensity * Projectile.scale; spriteBatch.Draw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 0.6f, SpriteEffects.None, 0); spriteBatch.Draw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 0.6f, SpriteEffects.None, 0); } @@ -164,14 +165,14 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int projID = ModContent.ProjectileType(); for (int i = 0; i < 3; i++) { Vector2 vel = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 16f; - Projectile.NewProjectileDirect(projectile.Center, vel, projID, projectile.damage, projectile.knockBack * 0.3f, projectile.owner); + Projectile.NewProjectileDirect(Projectile.Center, vel, projID, Projectile.damage, Projectile.knockBack * 0.3f, Projectile.owner); } } } diff --git a/Projectiles/Ranged/ExoMark.cs b/Projectiles/Ranged/ExoMark.cs index b73065b0fe..7e77bfc443 100644 --- a/Projectiles/Ranged/ExoMark.cs +++ b/Projectiles/Ranged/ExoMark.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ExoMark : ModProjectile @@ -16,28 +17,28 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 9; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 900; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 9; } public override void AI() { Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = -1; - Main.PlaySound(SoundID.Item60, (int)projectile.Center.X, (int)projectile.Center.Y); + Projectile.soundDelay = -1; + SoundEngine.PlaySound(SoundID.Item60, (int)Projectile.Center.X, (int)Projectile.Center.Y); } - if (projectile.localAI[1] < 30f) + if (Projectile.localAI[1] < 30f) { float value79 = -0.5f; float value80 = 0.9f; @@ -46,10 +47,10 @@ namespace CalamityMod.Projectiles.Ranged value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); value81.X *= -1f; Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 107, 0f, 0f, 0, default, 0.5f)]; dust34.position = position4; - dust34.customData = projectile.Center + value82; + dust34.customData = Projectile.Center + value82; dust34.fadeIn = 1f; dust34.scale = 0.3f; if (value81.X > -1.2f) @@ -58,50 +59,50 @@ namespace CalamityMod.Projectiles.Ranged } dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + Projectile.localAI[0] = 0.8f; + Projectile.direction = 1; + Point point9 = Projectile.Center.ToTileCoordinates(); + Projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) + Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; + if (Projectile.localAI[1] < 33f) { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 8; + Projectile.alpha -= 8; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } - if (projectile.localAI[1] > 103f) + if (Projectile.localAI[1] > 103f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 16; + Projectile.alpha += 16; } - if (projectile.alpha > 255) + if (Projectile.alpha > 255) { - projectile.alpha = 255; + Projectile.alpha = 255; } } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); } for (int num1135 = 0; num1135 < 2; num1135++) { if (Main.rand.NextBool(10)) { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 107, 0f, 0f, 225, newColor3, 1f)]; + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust dust35 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 107, 0f, 0f, 225, newColor3, 1f)]; dust35.noGravity = true; dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; + dust35.scale = Projectile.Opacity * Projectile.localAI[0]; + dust35.position = Projectile.Center; dust35.velocity = value83 * 2.5f; } } @@ -110,47 +111,47 @@ namespace CalamityMod.Projectiles.Ranged if (Main.rand.NextBool(10)) { Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 107, 0f, 0f, 225, newColor3, 1.5f)]; + Dust dust36 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 107, 0f, 0f, 225, newColor3, 1.5f)]; dust36.noGravity = true; dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; + dust36.scale = Projectile.Opacity * Projectile.localAI[0]; + dust36.position = Projectile.Center; dust36.velocity = value84 * 2.5f; } } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + Projectile.velocity = Vector2.Zero; + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner, 1f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner, 1f, 0f); } - if (projectile.localAI[1] >= 120f) + if (Projectile.localAI[1] >= 120f) { - projectile.Kill(); + Projectile.Kill(); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Color alpha5 = projectile.GetAlpha(color25); + Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[Projectile.type]; + Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alpha5 = Projectile.GetAlpha(color25); Vector2 origin7 = rectangle11.Size() / 2f; Color color47 = Main.hslToRgb(0f, 3f, 0f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, Projectile.rotation, origin7, Projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Ranged/ExoSpark.cs b/Projectiles/Ranged/ExoSpark.cs index fa6efd2040..ad3d7b81ba 100644 --- a/Projectiles/Ranged/ExoSpark.cs +++ b/Projectiles/Ranged/ExoSpark.cs @@ -18,33 +18,33 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Exo Spark"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 14; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 28; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.frame = Main.rand.Next(3); - projectile.localAI[0] = 1f; - projectile.netUpdate = true; + Projectile.frame = Main.rand.Next(3); + Projectile.localAI[0] = 1f; + Projectile.netUpdate = true; } - NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxTargetDistance); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(MaxTargetDistance); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * (HomingInertia - 1) + projectile.SafeDirectionTo(potentialTarget.Center) * 16f) / HomingInertia; + Projectile.velocity = (Projectile.velocity * (HomingInertia - 1) + Projectile.SafeDirectionTo(potentialTarget.Center) * 16f) / HomingInertia; - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); if (!Main.dedServ) { GenerateCircularDust(); @@ -56,8 +56,8 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 12; i++) { float angle = i / 12f * MathHelper.TwoPi; - Vector2 spawnPosition = projectile.Center + angle.ToRotationVector2().RotatedBy(projectile.rotation) * new Vector2(10f, 6f); - Dust dust = Dust.NewDustPerfect(spawnPosition, FrameToDustIDTable[projectile.frame]); + Vector2 spawnPosition = Projectile.Center + angle.ToRotationVector2().RotatedBy(Projectile.rotation) * new Vector2(10f, 6f); + Dust dust = Dust.NewDustPerfect(spawnPosition, FrameToDustIDTable[Projectile.frame]); dust.velocity = Vector2.Zero; dust.scale = 0.5f; dust.noGravity = true; diff --git a/Projectiles/Ranged/ExoTornado.cs b/Projectiles/Ranged/ExoTornado.cs index 45f0fa1cff..40e7fd843f 100644 --- a/Projectiles/Ranged/ExoTornado.cs +++ b/Projectiles/Ranged/ExoTornado.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ExoTornado : ModProjectile @@ -16,43 +17,43 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 240; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 240; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { float num1125 = 165f; //900 - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = -1; - Main.PlaySound(SoundID.Item122, projectile.position); + Projectile.soundDelay = -1; + SoundEngine.PlaySound(SoundID.Item122, Projectile.position); } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= num1125) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= num1125) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.localAI[0] >= 30f) + if (Projectile.localAI[0] >= 30f) { - projectile.damage = 0; - if (projectile.ai[0] < num1125 - 120f) + Projectile.damage = 0; + if (Projectile.ai[0] < num1125 - 120f) { - float num1126 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1126; - projectile.netUpdate = true; + float num1126 = Projectile.ai[0] % 60f; + Projectile.ai[0] = num1125 - 120f + num1126; + Projectile.netUpdate = true; } } float num1127 = 30f; //15 float num1128 = 30f; //15 - Point point8 = projectile.Center.ToTileCoordinates(); + Point point8 = Projectile.Center.ToTileCoordinates(); int num1129; int num1130; Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); @@ -63,14 +64,14 @@ namespace CalamityMod.Projectiles.Ranged Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); value74.X = value74.Y * 0.2f; - projectile.width = (int)(value74.X * 0.65f); - projectile.height = (int)value74.Y; - projectile.Center = vector146; - if (projectile.owner == Main.myPlayer) + Projectile.width = (int)(value74.X * 0.65f); + Projectile.height = (int)value74.Y; + Projectile.Center = vector146; + if (Projectile.owner == Main.myPlayer) { bool flag74 = false; - Vector2 center16 = Main.player[projectile.owner].Center; - Vector2 top = Main.player[projectile.owner].Top; + Vector2 center16 = Main.player[Projectile.owner].Center; + Vector2 top = Main.player[Projectile.owner].Top; for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) { Vector2 position2 = Vector2.Lerp(value72, value73, num1131); @@ -80,14 +81,14 @@ namespace CalamityMod.Projectiles.Ranged break; } } - if (!flag74 && projectile.ai[0] < num1125 - 120f) + if (!flag74 && Projectile.ai[0] < num1125 - 120f) { - float num1132 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1132; - projectile.netUpdate = true; + float num1132 = Projectile.ai[0] % 60f; + Projectile.ai[0] = num1125 - 120f + num1132; + Projectile.netUpdate = true; } } - if (projectile.ai[0] < num1125 - 120f) + if (Projectile.ai[0] < num1125 - 120f) { return; } @@ -98,14 +99,14 @@ namespace CalamityMod.Projectiles.Ranged float num226 = 150f; //600 float num227 = 30f; //15 float num228 = 30f; //15 - float num229 = projectile.ai[0]; + float num229 = Projectile.ai[0]; float maxAlpha = 0.3f; float scale5 = MathHelper.Clamp(num229 / 30f, 0f, maxAlpha); //Fade in if (num229 > num226 - 60f) { scale5 = MathHelper.Lerp(maxAlpha, 0f, (num229 - (num226 - 60f)) / 60f); //Fade out } - Point point5 = projectile.Center.ToTileCoordinates(); + Point point5 = Projectile.Center.ToTileCoordinates(); int num230; int num231; Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); @@ -118,7 +119,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); vector33.X = vector33.Y * num232; new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Texture2D texture2D23 = Main.projectileTexture[Projectile.type]; Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); Vector2 origin3 = rectangle9.Size() / 2f; float num233 = -0.06283186f * num229; diff --git a/Projectiles/Ranged/ExplodingStake.cs b/Projectiles/Ranged/ExplodingStake.cs index 8f50f44d4c..f5d874691d 100644 --- a/Projectiles/Ranged/ExplodingStake.cs +++ b/Projectiles/Ranged/ExplodingStake.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -16,38 +17,38 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 8; - projectile.alpha = 255; - projectile.scale = 0.8f; - projectile.extraUpdates = 3; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 8; + Projectile.alpha = 255; + Projectile.scale = 0.8f; + Projectile.extraUpdates = 3; + Projectile.aiStyle = 1; aiType = ProjectileID.Stake; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 6, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -55,16 +56,16 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ItemID.Stake); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ItemID.Stake); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; - if (projectile.owner == Main.myPlayer) + target.immune[Projectile.owner] = 5; + if (Projectile.owner == Main.myPlayer) { - int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int boom = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (boom.WithinBounds(Main.maxProjectiles)) Main.projectile[boom].Calamity().forceRanged = true; } diff --git a/Projectiles/Ranged/FallenStarProj.cs b/Projectiles/Ranged/FallenStarProj.cs index 47af8f1f0e..723f75d408 100644 --- a/Projectiles/Ranged/FallenStarProj.cs +++ b/Projectiles/Ranged/FallenStarProj.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -16,90 +17,90 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.aiStyle = 0; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.alpha = 50; - projectile.light = 1f; - projectile.tileCollide = true; - projectile.ignoreWater = false; - projectile.usesLocalNPCImmunity = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.aiStyle = 0; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.alpha = 50; + Projectile.light = 1f; + Projectile.tileCollide = true; + Projectile.ignoreWater = false; + Projectile.usesLocalNPCImmunity = true; } public override void AI() { - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); - Main.PlaySound(SoundID.Item9, projectile.Center); + Projectile.soundDelay = 20 + Main.rand.Next(40); + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } - projectile.alpha += (int)(25f * projectile.localAI[0]); - if (projectile.alpha > 200) + Projectile.alpha += (int)(25f * Projectile.localAI[0]); + if (Projectile.alpha > 200) { - projectile.alpha = 200; - projectile.localAI[0] = -1f; + Projectile.alpha = 200; + Projectile.localAI[0] = -1f; } - if (projectile.alpha < 50) + if (Projectile.alpha < 50) { - projectile.alpha = 50; - projectile.localAI[0] = 1f; + Projectile.alpha = 50; + Projectile.localAI[0] = 1f; } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * projectile.direction; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float newdamage = projectile.damage * 0.9375f; - projectile.damage = (int)newdamage; - if (projectile.damage < 1) - projectile.damage = 1; + float newdamage = Projectile.damage * 0.9375f; + Projectile.damage = (int)newdamage; + if (Projectile.damage < 1) + Projectile.damage = 1; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.Center); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); int dustAmt = 10; int goreAmt = 6; for (int i = 0; i < dustAmt; i++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 58, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 150, default, 1.2f); } for (int i = 0; i < dustAmt; i++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 57, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 57, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 150, default, 1.2f); } for (int i = 0; i < goreAmt; i++) { - Gore.NewGore(projectile.position, projectile.velocity * 0.05f, Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, Projectile.velocity * 0.05f, Main.rand.Next(16, 18), 1f); } } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, lightColor.A - projectile.alpha); + return new Color(200, 200, 200, lightColor.A - Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - Vector2 offsets = new Vector2(0f, projectile.gfxOffY) - Main.screenPosition; - Color alpha = projectile.GetAlpha(lightColor); + Texture2D tex = Main.projectileTexture[Projectile.type]; + Vector2 offsets = new Vector2(0f, Projectile.gfxOffY) - Main.screenPosition; + Color alpha = Projectile.GetAlpha(lightColor); Rectangle spriteRec = new Microsoft.Xna.Framework.Rectangle(0, 0, tex.Width, tex.Height); Vector2 spriteOrigin = spriteRec.Size() / 2f; - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D aura = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/FallenStarAura"); - Vector2 drawStart = projectile.Center + projectile.velocity; - Vector2 drawStart2 = projectile.Center - projectile.velocity * 0.5f; + Texture2D aura = ModContent.Request("CalamityMod/Projectiles/Ranged/FallenStarAura"); + Vector2 drawStart = Projectile.Center + Projectile.velocity; + Vector2 drawStart2 = Projectile.Center - Projectile.velocity * 0.5f; Vector2 spinPoint = new Vector2(0f, -10f); - float time = Main.player[projectile.owner].miscCounter % 216000f / 60f; + float time = Main.player[Projectile.owner].miscCounter % 216000f / 60f; Rectangle auraRec = aura.Frame(); Color blue = Color.Blue * 0.2f; Color white = Color.White * 0.5f; @@ -108,9 +109,9 @@ namespace CalamityMod.Projectiles.Ranged Vector2 auraOrigin = new Vector2(auraRec.Width / 2f, 10f); //Draw the aura - spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time), auraRec, blue, projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.5f, SpriteEffects.None, 0); - spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.TwoPi / 3f), auraRec, blue, projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.1f, SpriteEffects.None, 0); - spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.Pi * 4f / 3f), auraRec, blue, projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.3f, SpriteEffects.None, 0); + spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time), auraRec, blue, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.5f, SpriteEffects.None, 0); + spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.TwoPi / 3f), auraRec, blue, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.1f, SpriteEffects.None, 0); + spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.Pi * 4f / 3f), auraRec, blue, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.3f, SpriteEffects.None, 0); for (float d = 0f; d < 1f; d += 0.5f) { float scaleMult = time % 0.5f / 0.5f; @@ -120,11 +121,11 @@ namespace CalamityMod.Projectiles.Ranged { colorMult = 2f - colorMult; } - spriteBatch.Draw(aura, drawStart2 + offsets, auraRec, white * colorMult, projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 0.3f + scaleMult * 0.5f, SpriteEffects.None, 0); + spriteBatch.Draw(aura, drawStart2 + offsets, auraRec, white * colorMult, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 0.3f + scaleMult * 0.5f, SpriteEffects.None, 0); } //Draw the actual projectile - spriteBatch.Draw(tex, projectile.Center + offsets, spriteRec, alpha, projectile.rotation, spriteOrigin, projectile.scale + 0.1f, spriteEffects, 0); + spriteBatch.Draw(tex, Projectile.Center + offsets, spriteRec, alpha, Projectile.rotation, spriteOrigin, Projectile.scale + 0.1f, spriteEffects, 0); return false; } } diff --git a/Projectiles/Ranged/FeatherLarge.cs b/Projectiles/Ranged/FeatherLarge.cs index 19578b5fb6..ba48097193 100644 --- a/Projectiles/Ranged/FeatherLarge.cs +++ b/Projectiles/Ranged/FeatherLarge.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -12,36 +13,36 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Feather"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -50,7 +51,7 @@ namespace CalamityMod.Projectiles.Ranged int num3; for (int num611 = 0; num611 < 10; num611 = num3 + 1) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 42, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 1f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 42, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); num3 = num611; } } diff --git a/Projectiles/Ranged/FishronRPG.cs b/Projectiles/Ranged/FishronRPG.cs index 9a55f7a242..2f11c36883 100644 --- a/Projectiles/Ranged/FishronRPG.cs +++ b/Projectiles/Ranged/FishronRPG.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class FishronRPG : ModProjectile @@ -14,21 +15,21 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 95; + Projectile.DamageType = DamageClass.Ranged; } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -36,26 +37,26 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item92, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item92, Projectile.position); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + if (Projectile.owner == Main.myPlayer && Projectile.timeLeft <= 3) { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; + Projectile.tileCollide = false; + Projectile.ai[1] = 0f; + Projectile.alpha = 255; + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 200; + Projectile.height = 200; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.knockBack = 10f; } else { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { for (int num246 = 0; num246 < 2; num246++) { @@ -63,44 +64,44 @@ namespace CalamityMod.Projectiles.Ranged float num248 = 0f; if (num246 == 1) { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; + num247 = Projectile.velocity.X * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default, 1f); + int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 33, 0f, 0f, 100, default, 1f); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); + num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 48; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item92, projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 48; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item92, Projectile.position); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -110,10 +111,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Ranged/FlakKrakenGun.cs b/Projectiles/Ranged/FlakKrakenGun.cs index 926baa6c95..97049f5aba 100644 --- a/Projectiles/Ranged/FlakKrakenGun.cs +++ b/Projectiles/Ranged/FlakKrakenGun.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -17,49 +18,49 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 152; - projectile.height = 58; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 152; + Projectile.height = 58; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float num = 0f; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { num = 3.14159274f; } float num26 = 30f; - if (projectile.ai[0] > 90f) + if (Projectile.ai[0] > 90f) { num26 = 15f; } - if (projectile.ai[0] > 120f) + if (Projectile.ai[0] > 120f) { num26 = 5f; } - projectile.damage = (int)(player.ActiveItem().damage * player.RangedDamage()); - projectile.ai[0] += 1f; - projectile.ai[1] += 1f; + Projectile.damage = (int)(player.ActiveItem().damage * player.RangedDamage()); + Projectile.ai[0] += 1f; + Projectile.ai[1] += 1f; int num27 = 10; bool flag10 = false; - if (projectile.ai[0] % num26 == 0f) + if (Projectile.ai[0] % num26 == 0f) { flag10 = true; } - if (projectile.ai[1] >= 1f) + if (Projectile.ai[1] >= 1f) { - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; flag10 = true; - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - float scaleFactor5 = player.ActiveItem().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) @@ -71,30 +72,30 @@ namespace CalamityMod.Projectiles.Ranged { vector11 = -Vector2.UnitY; } - vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(projectile.velocity), 0.92f)); //0.92 + vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(Projectile.velocity), 0.92f)); //0.92 vector11 *= scaleFactor5; - if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) + if (vector11.X != Projectile.velocity.X || vector11.Y != Projectile.velocity.Y) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity = vector11; + Projectile.velocity = vector11; } } - if (projectile.soundDelay <= 0) + if (Projectile.soundDelay <= 0) { - projectile.soundDelay = num27; - projectile.soundDelay *= 2; - if (projectile.ai[0] != 1f && projectile.ai[0] <= 500f) + Projectile.soundDelay = num27; + Projectile.soundDelay *= 2; + if (Projectile.ai[0] != 1f && Projectile.ai[0] <= 500f) { - Main.PlaySound(SoundID.Item15, projectile.position); + SoundEngine.PlaySound(SoundID.Item15, Projectile.position); } } - if (flag10 && Main.myPlayer == projectile.owner) + if (flag10 && Main.myPlayer == Projectile.owner) { bool flag12 = player.channel && !player.noItems && !player.CCed; if (flag12) { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; @@ -109,25 +110,25 @@ namespace CalamityMod.Projectiles.Ranged num79 = 0f; } vector2 += new Vector2(num78, num79); - int num29 = projectile.damage; - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, ModContent.ProjectileType(), num29, projectile.knockBack, projectile.owner, 0f, (float)projectile.whoAmI); - projectile.netUpdate = true; + int num29 = Projectile.damage; + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, ModContent.ProjectileType(), num29, Projectile.knockBack, Projectile.owner, 0f, (float)Projectile.whoAmI); + Projectile.netUpdate = true; } } else { - projectile.Kill(); + Projectile.Kill(); } } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); } public override bool CanDamage() => false; diff --git a/Projectiles/Ranged/FlakKrakenProj.cs b/Projectiles/Ranged/FlakKrakenProj.cs index c6c6448c5e..66979b131a 100644 --- a/Projectiles/Ranged/FlakKrakenProj.cs +++ b/Projectiles/Ranged/FlakKrakenProj.cs @@ -12,53 +12,53 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Kraken"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 54; - projectile.height = 54; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.scale = 0.002f; - projectile.timeLeft = 36000; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + Projectile.width = 54; + Projectile.height = 54; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.scale = 0.002f; + Projectile.timeLeft = 36000; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; } public override void AI() { - if (projectile.type != ModContent.ProjectileType() || - !Main.projectile[(int)projectile.ai[1]].active || - Main.projectile[(int)projectile.ai[1]].type != ModContent.ProjectileType()) + if (Projectile.type != ModContent.ProjectileType() || + !Main.projectile[(int)Projectile.ai[1]].active || + Main.projectile[(int)Projectile.ai[1]].type != ModContent.ProjectileType()) { - projectile.Kill(); + Projectile.Kill(); return; } // This code uses player-specific fields (such as the mouse), and does not need to be run for anyone // other than its owner. - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - projectile.rotation += 0.2f; - if (projectile.localAI[0] < 1f) + Projectile.rotation += 0.2f; + if (Projectile.localAI[0] < 1f) { - projectile.localAI[0] += 0.002f; - projectile.scale += 0.002f; - projectile.width = projectile.height = (int)(50f * projectile.scale); + Projectile.localAI[0] += 0.002f; + Projectile.scale += 0.002f; + Projectile.width = Projectile.height = (int)(50f * Projectile.scale); } else { - projectile.width = projectile.height = 50; + Projectile.width = Projectile.height = 50; } - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Ranged vector2 += new Vector2(num78, num79); float speed = 30f; float speedScale = 3f; - Vector2 vectorPos = projectile.Center; + Vector2 vectorPos = Projectile.Center; if (Vector2.Distance(vector2, vectorPos) < 90f) { speed = 10f; @@ -96,53 +96,53 @@ namespace CalamityMod.Projectiles.Ranged num680 = speed / num680; num678 *= num680; num679 *= num680; - if (projectile.velocity.X < num678) + if (Projectile.velocity.X < num678) { - projectile.velocity.X = projectile.velocity.X + speedScale; - if (projectile.velocity.X < 0f && num678 > 0f) + Projectile.velocity.X = Projectile.velocity.X + speedScale; + if (Projectile.velocity.X < 0f && num678 > 0f) { - projectile.velocity.X = projectile.velocity.X + speedScale; + Projectile.velocity.X = Projectile.velocity.X + speedScale; } } - else if (projectile.velocity.X > num678) + else if (Projectile.velocity.X > num678) { - projectile.velocity.X = projectile.velocity.X - speedScale; - if (projectile.velocity.X > 0f && num678 < 0f) + Projectile.velocity.X = Projectile.velocity.X - speedScale; + if (Projectile.velocity.X > 0f && num678 < 0f) { - projectile.velocity.X = projectile.velocity.X - speedScale; + Projectile.velocity.X = Projectile.velocity.X - speedScale; } } - if (projectile.velocity.Y < num679) + if (Projectile.velocity.Y < num679) { - projectile.velocity.Y = projectile.velocity.Y + speedScale; - if (projectile.velocity.Y < 0f && num679 > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + speedScale; + if (Projectile.velocity.Y < 0f && num679 > 0f) { - projectile.velocity.Y = projectile.velocity.Y + speedScale; + Projectile.velocity.Y = Projectile.velocity.Y + speedScale; } } - else if (projectile.velocity.Y > num679) + else if (Projectile.velocity.Y > num679) { - projectile.velocity.Y = projectile.velocity.Y - speedScale; - if (projectile.velocity.Y > 0f && num679 < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - speedScale; + if (Projectile.velocity.Y > 0f && num679 < 0f) { - projectile.velocity.Y = projectile.velocity.Y - speedScale; + Projectile.velocity.Y = Projectile.velocity.Y - speedScale; } } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - damage = (int)(damage * projectile.localAI[0]); + damage = (int)(damage * Projectile.localAI[0]); } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 200, 50, projectile.alpha); + return new Color(255, 200, 50, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/FlamingStake.cs b/Projectiles/Ranged/FlamingStake.cs index 113d8dd961..4cf428ceb6 100644 --- a/Projectiles/Ranged/FlamingStake.cs +++ b/Projectiles/Ranged/FlamingStake.cs @@ -17,30 +17,30 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 10; - projectile.alpha = 255; - projectile.extraUpdates = 3; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 10; + Projectile.alpha = 255; + Projectile.extraUpdates = 3; + Projectile.aiStyle = 1; aiType = ProjectileID.Stake; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 6, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -48,13 +48,13 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ItemID.Stake); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ItemID.Stake); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; target.AddBuff(BuffID.OnFire, 240); } diff --git a/Projectiles/Ranged/FlareBat.cs b/Projectiles/Ranged/FlareBat.cs index adcb93cb7d..ca0df9c8fc 100644 --- a/Projectiles/Ranged/FlareBat.cs +++ b/Projectiles/Ranged/FlareBat.cs @@ -8,78 +8,78 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Bat"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.light = 0.25f; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 3; + Projectile.timeLeft = 300; + Projectile.light = 0.25f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + int num103 = (int)Player.FindClosest(Projectile.Center, 1, 1); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] < 110f && Projectile.ai[1] > 30f) { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; + float scaleFactor2 = Projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - Projectile.Center; vector11.Normalize(); vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 24f + vector11) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; } - if (projectile.ai[0] < 0f) + if (Projectile.ai[0] < 0f) { - if (projectile.velocity.Length() < 18f) + if (Projectile.velocity.Length() < 18f) { - projectile.velocity *= 1.02f; + Projectile.velocity *= 1.02f; } } - int num192 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 0, default, 1f); + int num192 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 0, default, 1f); Main.dust[num192].noGravity = true; Main.dust[num192].velocity *= 0.2f; - Main.dust[num192].position = (Main.dust[num192].position + projectile.Center) / 2f; - projectile.frameCounter++; - if (projectile.frameCounter >= 2) + Main.dust[num192].position = (Main.dust[num192].position + Projectile.Center) / 2f; + Projectile.frameCounter++; + if (Projectile.frameCounter >= 2) { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame >= 5) + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame >= 5) { - projectile.frame = 0; + Projectile.frame = 0; } } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) * Projectile.direction; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.Kill(); + Projectile.Kill(); } /*public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 6, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/Flash.cs b/Projectiles/Ranged/Flash.cs index 954611ad1d..8c538eadb4 100644 --- a/Projectiles/Ranged/Flash.cs +++ b/Projectiles/Ranged/Flash.cs @@ -18,54 +18,54 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 200; - projectile.height = 200; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; + Projectile.width = 200; + Projectile.height = 200; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 5; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f); - Color dustColor = projectile.ai[1] == 1f ? CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f) : default; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); + Color dustColor = Projectile.ai[1] == 1f ? CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f) : default; bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -76,11 +76,11 @@ namespace CalamityMod.Projectiles.Ranged num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 264, 0f, 0f, 100, dustColor, 2f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 264, 0f, 0f, 100, dustColor, 2f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Ranged/FlashBulletProj.cs b/Projectiles/Ranged/FlashBulletProj.cs index 0b10be93dc..061e52bc10 100644 --- a/Projectiles/Ranged/FlashBulletProj.cs +++ b/Projectiles/Ranged/FlashBulletProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,35 +12,35 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Flash Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 3; aiType = ProjectileID.Bullet; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.1f, 0.1f, 0.1f); + Lighting.AddLight(Projectile.Center, 0.1f, 0.1f, 0.1f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 264, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; + int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 264, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = Projectile.alpha; Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; } @@ -48,20 +49,20 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item93, projectile.position); - if (projectile.owner == Main.myPlayer) + SoundEngine.PlaySound(SoundID.Item93, Projectile.position); + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 0f, Projectile.owner, 0f, 0f); } for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 264, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 264, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/FlurrystormCannonShooting.cs b/Projectiles/Ranged/FlurrystormCannonShooting.cs index 7644e9cfe9..af3023c2bb 100644 --- a/Projectiles/Ranged/FlurrystormCannonShooting.cs +++ b/Projectiles/Ranged/FlurrystormCannonShooting.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,92 +12,92 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Flurrystorm Cannon"); - Main.projFrames[projectile.type] = 2; + Main.projFrames[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 68; - projectile.height = 38; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.coldDamage = true; + Projectile.width = 68; + Projectile.height = 38; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.coldDamage = true; } public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Player player = Main.player[Projectile.owner]; + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 2) + if (Projectile.frame >= 2) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int fireRate = 0; - if (projectile.ai[0] >= 60f) + if (Projectile.ai[0] >= 60f) { fireRate++; } - if (projectile.ai[0] >= 120f) + if (Projectile.ai[0] >= 120f) { fireRate++; } - if (projectile.ai[0] >= 180f) + if (Projectile.ai[0] >= 180f) { fireRate++; } - if (projectile.ai[0] >= 240f) + if (Projectile.ai[0] >= 240f) { fireRate++; } - if (projectile.ai[0] >= 300f) + if (Projectile.ai[0] >= 300f) { fireRate++; } - if (projectile.ai[0] >= 360f) + if (Projectile.ai[0] >= 360f) { fireRate++; } - if (projectile.ai[0] >= 420f) + if (Projectile.ai[0] >= 420f) { fireRate++; } - if (projectile.ai[0] >= 480f) //full speed after 8 seconds + if (Projectile.ai[0] >= 480f) //full speed after 8 seconds { fireRate++; } int initialRate = 24; int fireRateMult = 2; - projectile.ai[1] -= 1f; + Projectile.ai[1] -= 1f; bool shouldShoot = false; - if (projectile.ai[1] <= 0f) + if (Projectile.ai[1] <= 0f) { - projectile.ai[1] = (float)(initialRate - fireRateMult * fireRate); + Projectile.ai[1] = (float)(initialRate - fireRateMult * fireRate); shouldShoot = true; } bool canShoot = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; - if (projectile.localAI[0] > 0f) + if (Projectile.localAI[0] > 0f) { - projectile.localAI[0] -= 1f; + Projectile.localAI[0] -= 1f; } - if (projectile.soundDelay <= 0 && canShoot) + if (Projectile.soundDelay <= 0 && canShoot) { - projectile.soundDelay = initialRate - fireRateMult * fireRate; - if (projectile.ai[0] != 1f) + Projectile.soundDelay = initialRate - fireRateMult * fireRate; + if (Projectile.ai[0] != 1f) { - Main.PlaySound(SoundID.Item11, projectile.position); + SoundEngine.PlaySound(SoundID.Item11, Projectile.position); } - projectile.localAI[0] = 12f; + Projectile.localAI[0] = 12f; } - if (shouldShoot && Main.myPlayer == projectile.owner) + if (shouldShoot && Main.myPlayer == Projectile.owner) { int projType = ProjectileID.SnowBallFriendly; float speedMult2 = 14f; @@ -106,7 +107,7 @@ namespace CalamityMod.Projectiles.Ranged { player.PickAmmo(player.ActiveItem(), ref projType, ref speedMult2, ref canShoot, ref dmg, ref kBack, false); kBack = player.GetWeaponKnockback(player.ActiveItem(), kBack); - float shootSpeed = player.ActiveItem().shootSpeed * projectile.scale; + float shootSpeed = player.ActiveItem().shootSpeed * Projectile.scale; Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 direction = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - source; if (player.gravDir == -1f) @@ -119,13 +120,13 @@ namespace CalamityMod.Projectiles.Ranged speedMult = -Vector2.UnitY; } speedMult *= shootSpeed; - if (speedMult.X != projectile.velocity.X || speedMult.Y != projectile.velocity.Y) + if (speedMult.X != Projectile.velocity.X || speedMult.Y != Projectile.velocity.Y) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity = speedMult * 0.55f; + Projectile.velocity = speedMult * 0.55f; - Vector2 snowballVel = Vector2.Normalize(projectile.velocity) * speedMult2 * (0.6f + Main.rand.NextFloat(0f, 0.15f)); + Vector2 snowballVel = Vector2.Normalize(Projectile.velocity) * speedMult2 * (0.6f + Main.rand.NextFloat(0f, 0.15f)); if (float.IsNaN(snowballVel.X) || float.IsNaN(snowballVel.Y)) { snowballVel = -Vector2.UnitY; @@ -133,41 +134,41 @@ namespace CalamityMod.Projectiles.Ranged Vector2 sourceS = source + Utils.RandomVector2(Main.rand, -5f, 5f); snowballVel.X += Main.rand.NextFloat(-2.25f, 2.25f); snowballVel.Y += Main.rand.NextFloat(-2.25f, 2.25f); - int snowball = Projectile.NewProjectile(sourceS, snowballVel, projType, dmg, kBack, projectile.owner); + int snowball = Projectile.NewProjectile(sourceS, snowballVel, projType, dmg, kBack, Projectile.owner); if (snowball.WithinBounds(Main.maxProjectiles)) { Main.projectile[snowball].noDropItem = true; Main.projectile[snowball].Calamity().forceRanged = true; - Main.projectile[snowball].thrown = false; + // Main.projectile[snowball].thrown = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; Main.projectile[snowball].extraUpdates += Main.rand.Next(0,2); } if (Main.rand.NextBool(5)) //ice chunk { - Vector2 chunkVel = Vector2.Normalize(projectile.velocity) * speedMult2 * (0.6f + Main.rand.NextFloat() * 0.8f); + Vector2 chunkVel = Vector2.Normalize(Projectile.velocity) * speedMult2 * (0.6f + Main.rand.NextFloat() * 0.8f); if (float.IsNaN(chunkVel.X) || float.IsNaN(chunkVel.Y)) { chunkVel = -Vector2.UnitY; } Vector2 sourceC = source + Utils.RandomVector2(Main.rand, -15f, 15f); - int iceChunk = Projectile.NewProjectile(sourceC, chunkVel, ModContent.ProjectileType(), (int)(dmg * 1.5), (int)(kBack * 1.5), projectile.owner, 0f, chunkVel.Y); + int iceChunk = Projectile.NewProjectile(sourceC, chunkVel, ModContent.ProjectileType(), (int)(dmg * 1.5), (int)(kBack * 1.5), Projectile.owner, 0f, chunkVel.Y); Main.projectile[iceChunk].extraUpdates += fireRate / 2; //0 to 2 } } else { - projectile.Kill(); + Projectile.Kill(); } } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); + player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * Projectile.direction, Projectile.velocity.X * Projectile.direction); } public override bool CanDamage() diff --git a/Projectiles/Ranged/FlurrystormIceChunk.cs b/Projectiles/Ranged/FlurrystormIceChunk.cs index ac60f45d89..d6decc4756 100644 --- a/Projectiles/Ranged/FlurrystormIceChunk.cs +++ b/Projectiles/Ranged/FlurrystormIceChunk.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.StatDebuffs; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -14,14 +15,14 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.coldDamage = true; - projectile.penetrate = 1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.coldDamage = true; + Projectile.penetrate = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() @@ -29,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged //icicle dust if (Main.rand.NextBool(2)) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.1f); Main.dust[index2].noGravity = true; } } @@ -42,10 +43,10 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int index1 = 0; index1 < 5; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, default, 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, default, 1f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 1.5f; Main.dust[index2].scale *= 0.9f; @@ -54,20 +55,20 @@ namespace CalamityMod.Projectiles.Ranged while (split < 3) { //Calculate the velocity of the projectile - float shardspeedX = -projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); - float shardspeedY = -projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; + float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); + float shardspeedY = -Projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; //Prevents the projectile speed from being too low if (shardspeedX < 2f && shardspeedX > -2f) { - shardspeedX += -projectile.velocity.X; + shardspeedX += -Projectile.velocity.X; } if (shardspeedY > 2f && shardspeedY < 2f) { - shardspeedY += -projectile.velocity.Y; + shardspeedY += -Projectile.velocity.Y; } //Spawn the projectile - Projectile.NewProjectile(projectile.position.X + shardspeedX, projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 2f, projectile.owner); + Projectile.NewProjectile(Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 2f, Projectile.owner); split += 1; } } diff --git a/Projectiles/Ranged/FlurrystormIceShard.cs b/Projectiles/Ranged/FlurrystormIceShard.cs index 6f087bfb18..c4ef5e72ec 100644 --- a/Projectiles/Ranged/FlurrystormIceShard.cs +++ b/Projectiles/Ranged/FlurrystormIceShard.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.StatDebuffs; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -14,21 +15,21 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 10; - projectile.height = 10; - projectile.ranged = true; - projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.DamageType = DamageClass.Ranged; + Projectile.coldDamage = true; } public override void AI() { //Rotation and gravity - projectile.rotation += 0.6f * projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.27f; - if (projectile.velocity.Y > 16f) + Projectile.rotation += 0.6f * Projectile.direction; + Projectile.velocity.Y = Projectile.velocity.Y + 0.27f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } @@ -41,12 +42,12 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); //Dust effect int splash = 0; while (splash < 4) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.10f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); splash += 1; } } diff --git a/Projectiles/Ranged/FossilShard.cs b/Projectiles/Ranged/FossilShard.cs index 4374226565..f2ca7f717a 100644 --- a/Projectiles/Ranged/FossilShard.cs +++ b/Projectiles/Ranged/FossilShard.cs @@ -13,22 +13,22 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.timeLeft = 120; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.aiStyle = 1; + Projectile.timeLeft = 120; aiType = ProjectileID.WoodenArrowFriendly; } public override void AI() { - if (projectile.velocity.Y <= 0f) - projectile.velocity.Y = 0.1f; - projectile.rotation += projectile.velocity.Y; - projectile.velocity.Y *= 1.05f; + if (Projectile.velocity.Y <= 0f) + Projectile.velocity.Y = 0.1f; + Projectile.rotation += Projectile.velocity.Y; + Projectile.velocity.Y *= 1.05f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i <= 2; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 32, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/FungiOrb.cs b/Projectiles/Ranged/FungiOrb.cs index d4867961d9..a475a9e2e2 100644 --- a/Projectiles/Ranged/FungiOrb.cs +++ b/Projectiles/Ranged/FungiOrb.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -14,29 +15,29 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; - Lighting.AddLight(projectile.Center, new Vector3(0, 244, 252) * (1.2f / 255)); + Lighting.AddLight(Projectile.Center, new Vector3(0, 244, 252) * (1.2f / 255)); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - Vector2 dspeed = -projectile.velocity * 0.5f; - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1f); + Vector2 dspeed = -Projectile.velocity * 0.5f; + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity = dspeed; @@ -45,18 +46,18 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int f = 0; f < 3; f++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner); } } - Main.PlaySound(SoundID.NPCDeath1, projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/FungiOrb2.cs b/Projectiles/Ranged/FungiOrb2.cs index 656458e47b..8d401fd815 100644 --- a/Projectiles/Ranged/FungiOrb2.cs +++ b/Projectiles/Ranged/FungiOrb2.cs @@ -15,44 +15,44 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.timeLeft = 180; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.aiStyle = 1; + Projectile.timeLeft = 180; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; - Lighting.AddLight(projectile.Center, new Vector3(0, 244, 252) * (1.2f / 255)); + Lighting.AddLight(Projectile.Center, new Vector3(0, 244, 252) * (1.2f / 255)); - projectile.velocity.Y += 0.1f; - projectile.velocity.X *= 0.95f; + Projectile.velocity.Y += 0.1f; + Projectile.velocity.X *= 0.95f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - Vector2 dspeed = -projectile.velocity * 0.5f; - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1f); + Vector2 dspeed = -Projectile.velocity * 0.5f; + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity = dspeed; } - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 6f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 6f, 20f); } public override void Kill(int timeLeft) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/GemTechGreenFlechette.cs b/Projectiles/Ranged/GemTechGreenFlechette.cs index 099cdcb63e..b572f4b23a 100644 --- a/Projectiles/Ranged/GemTechGreenFlechette.cs +++ b/Projectiles/Ranged/GemTechGreenFlechette.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,54 +12,54 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Gem Tech Flechette"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.MaxUpdates = 3; - projectile.timeLeft = projectile.MaxUpdates * 180; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = Projectile.MaxUpdates * 180; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.Opacity = Utils.InverseLerp(180f, 174f, projectile.timeLeft, true); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.Opacity = Utils.InverseLerp(180f, 174f, Projectile.timeLeft, true); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { // Create a circular puff of green dust. float initialSpeed = Main.rand.NextFloat(2.5f, 4.5f); for (int i = 0; i < 12; i++) { - Dust crystalShard = Dust.NewDustPerfect(projectile.Center, 267); + Dust crystalShard = Dust.NewDustPerfect(Projectile.Center, 267); crystalShard.velocity = (MathHelper.TwoPi * i / 12f).ToRotationVector2() * initialSpeed * Main.rand.NextFloat(0.6f, 1f); crystalShard.velocity = crystalShard.velocity.RotatedByRandom(0.37f); crystalShard.scale = 1.25f; crystalShard.color = Color.ForestGreen; crystalShard.noGravity = true; } - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } } public override void Kill(int timeLeft) { // Play a shatter sound. - Main.PlaySound(SoundID.Item27, projectile.Center); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); // Create a circular puff of green dust. float initialSpeed = Main.rand.NextFloat(2.5f, 4.5f); for (int i = 0; i < 16; i++) { - Dust crystalShard = Dust.NewDustPerfect(projectile.Center, 267); + Dust crystalShard = Dust.NewDustPerfect(Projectile.Center, 267); crystalShard.velocity = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * initialSpeed; crystalShard.scale = 1.25f; crystalShard.color = Color.ForestGreen; @@ -68,20 +69,20 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - int afterimageCount = ProjectileID.Sets.TrailCacheLength[projectile.type]; - Texture2D texture = Main.projectileTexture[projectile.type]; - Vector2 drawPosition = projectile.Center - Main.screenPosition; + int afterimageCount = ProjectileID.Sets.TrailCacheLength[Projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() * 0.5f; for (int i = 0; i < afterimageCount; i++) { - if (projectile.oldPos[i] == Vector2.Zero) + if (Projectile.oldPos[i] == Vector2.Zero) continue; float scaleFactor = MathHelper.Lerp(1f, 0.6f, i / (float)(afterimageCount - 1f)); Color drawColor = Color.Lerp(Color.LightGreen, Color.White, i / (float)(afterimageCount - 1f)); drawColor.A = (byte)(int)MathHelper.Lerp(105f, 0f, i / (float)(afterimageCount - 1f)); - drawPosition -= projectile.velocity.SafeNormalize(Vector2.Zero) * scaleFactor * 4.5f; - spriteBatch.Draw(texture, drawPosition, null, drawColor, projectile.rotation, origin, projectile.scale * scaleFactor, SpriteEffects.None, 0f); + drawPosition -= Projectile.velocity.SafeNormalize(Vector2.Zero) * scaleFactor * 4.5f; + spriteBatch.Draw(texture, drawPosition, null, drawColor, Projectile.rotation, origin, Projectile.scale * scaleFactor, SpriteEffects.None, 0f); } return false; } diff --git a/Projectiles/Ranged/GodSlayerSlugProj.cs b/Projectiles/Ranged/GodSlayerSlugProj.cs index 8cacd3e226..5adac9444c 100644 --- a/Projectiles/Ranged/GodSlayerSlugProj.cs +++ b/Projectiles/Ranged/GodSlayerSlugProj.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -18,128 +19,128 @@ namespace CalamityMod.Projectiles.Ranged private const float MouseAimDeviation = 13f; private const int TextureHeight = 136; - private bool BlueMode => projectile.ai[0] != 0f; + private bool BlueMode => Projectile.ai[0] != 0f; public override string Texture => "CalamityMod/Projectiles/Ranged/GodSlayerSlugPurple"; private static Texture2D TextureBlue; public override void SetStaticDefaults() { DisplayName.SetDefault("God Slayer Slug"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; if (Main.netMode != NetmodeID.Server) - TextureBlue = mod.GetTexture("Projectiles/Ranged/GodSlayerSlugBlue"); + TextureBlue = Mod.Assets.Request("Projectiles/Ranged/GodSlayerSlugBlue").Value; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.alpha = 255; - projectile.MaxUpdates = 6; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.timeLeft = Lifetime; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.alpha = 255; + Projectile.MaxUpdates = 6; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.timeLeft = Lifetime; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } - public override void SendExtraAI(BinaryWriter writer) => writer.Write(projectile.tileCollide); - public override void ReceiveExtraAI(BinaryReader reader) => projectile.tileCollide = reader.ReadBoolean(); + public override void SendExtraAI(BinaryWriter writer) => writer.Write(Projectile.tileCollide); + public override void ReceiveExtraAI(BinaryReader reader) => Projectile.tileCollide = reader.ReadBoolean(); public override void AI() { // Store the original velocity if it has yet to be initialized. This is needed for the warp. - if (projectile.localAI[0] == 0f) - projectile.localAI[0] = projectile.velocity.Length(); + if (Projectile.localAI[0] == 0f) + Projectile.localAI[0] = Projectile.velocity.Length(); // Rapidly fade into visibility. - if (projectile.alpha > 0) - projectile.alpha -= 17; + if (Projectile.alpha > 0) + Projectile.alpha -= 17; // Add light appropriate to the bullet's current state. if (BlueMode) - Lighting.AddLight(projectile.Center, 0.06f, 0.24f, 0.29f); + Lighting.AddLight(Projectile.Center, 0.06f, 0.24f, 0.29f); else - Lighting.AddLight(projectile.Center, 0.3f, 0.2f, 0.32f); + Lighting.AddLight(Projectile.Center, 0.3f, 0.2f, 0.32f); // If the bullet has struck at least one target, increment the counter for turning blue. - if (projectile.numHits > 0 && CalamityUtils.FinalExtraUpdate(projectile) && !BlueMode) - ++projectile.ai[1]; + if (Projectile.numHits > 0 && CalamityUtils.FinalExtraUpdate(Projectile) && !BlueMode) + ++Projectile.ai[1]; // If the bullet has struck at least one target but hasn't hit anything for several frames, turn blue and warp. // Obviously if the bullet is already blue, it can't turn blue again. - if (!BlueMode && projectile.ai[1] >= TurnBlueFrameDelay) + if (!BlueMode && Projectile.ai[1] >= TurnBlueFrameDelay) TurnBlue(true); // When blue, ignore walls for the first several updates. - if (BlueMode && projectile.ai[1] > 0f) + if (BlueMode && Projectile.ai[1] > 0f) { - --projectile.ai[1]; - if (projectile.ai[1] == 0f) - projectile.tileCollide = true; + --Projectile.ai[1]; + if (Projectile.ai[1] == 0f) + Projectile.tileCollide = true; } } private void TurnBlue(bool setPosition = false) { // Switch to blue mode officially - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; // Provide several frames of passing through walls to prevent frustration - projectile.ai[1] = BlueNoCollideFrames; - projectile.tileCollide = false; + Projectile.ai[1] = BlueNoCollideFrames; + Projectile.tileCollide = false; // Reduce damage, but remove piercing. Reset local iframes so the bullet, turned blue, may always strike again. - projectile.damage = (int)(0.28f * projectile.damage); - projectile.penetrate = 1; + Projectile.damage = (int)(0.28f * Projectile.damage); + Projectile.penetrate = 1; for (int i = 0; i < Main.maxNPCs; i++) - projectile.localNPCImmunity[i] = 0; + Projectile.localNPCImmunity[i] = 0; // Reset projectile lifetime so it can fly again for its full possible range - projectile.timeLeft = Lifetime - NoDrawFrames * projectile.MaxUpdates; + Projectile.timeLeft = Lifetime - NoDrawFrames * Projectile.MaxUpdates; - if (!setPosition || Main.myPlayer != projectile.owner) + if (!setPosition || Main.myPlayer != Projectile.owner) return; // The bullet disappears in a puff of dust. - ProduceWarpCrossDust(projectile.Center, (int)CalamityDusts.PurpleCosmilite); + ProduceWarpCrossDust(Projectile.Center, (int)CalamityDusts.PurpleCosmilite); // The warp must be performed client side because it requires knowledge of the player's mouse position. - projectile.netUpdate = true; - projectile.tileCollide = false; + Projectile.netUpdate = true; + Projectile.tileCollide = false; // Step 1 of the warp: Place the bullet behind the player, opposite the mouse cursor. Vector2 playerToMouseVec = CalamityUtils.SafeDirectionTo(Main.LocalPlayer, Main.MouseWorld, -Vector2.UnitY); float warpDist = Main.rand.NextFloat(70f, 96f); float warpAngle = Main.rand.NextFloat(-MathHelper.Pi / 3f, MathHelper.Pi / 3f); Vector2 warpOffset = -warpDist * playerToMouseVec.RotatedBy(warpAngle); - projectile.position = Main.LocalPlayer.MountedCenter + warpOffset; + Projectile.position = Main.LocalPlayer.MountedCenter + warpOffset; // Step 2 of the warp: Angle the bullet so that it is pointing at the mouse cursor. // This intentionally has a slight inaccuracy. Vector2 mouseTargetVec = Main.MouseWorld + Main.rand.NextVector2Circular(MouseAimDeviation, MouseAimDeviation); - Vector2 bulletToMouseVec = CalamityUtils.SafeDirectionTo(projectile, mouseTargetVec, -Vector2.UnitY); - projectile.velocity = bulletToMouseVec * projectile.localAI[0]; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Vector2 bulletToMouseVec = CalamityUtils.SafeDirectionTo(Projectile, mouseTargetVec, -Vector2.UnitY); + Projectile.velocity = bulletToMouseVec * Projectile.localAI[0]; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; // Set all old positions to the bullet's warp position so that there aren't weird afterimages. // If an old position is uninitialized (0,0 aka never used), then don't change it. - for (int i = 0; i < ProjectileID.Sets.TrailCacheLength[projectile.type]; ++i) + for (int i = 0; i < ProjectileID.Sets.TrailCacheLength[Projectile.type]; ++i) { - Vector2 oldPosElem = projectile.oldPos[i]; + Vector2 oldPosElem = Projectile.oldPos[i]; if (!(oldPosElem == Vector2.Zero)) - projectile.oldPos[i] = projectile.position; + Projectile.oldPos[i] = Projectile.position; } // Now that the bullet has warped, produce a tiny puff of dust at its back for effect. - Vector2 warpInDustPos = projectile.Center - bulletToMouseVec * TextureHeight; + Vector2 warpInDustPos = Projectile.Center - bulletToMouseVec * TextureHeight; ProduceWarpCrossDust(warpInDustPos, (int)CalamityDusts.BlueCosmilite); } @@ -147,10 +148,10 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft >= Lifetime - NoDrawFrames * projectile.MaxUpdates) + if (Projectile.timeLeft >= Lifetime - NoDrawFrames * Projectile.MaxUpdates) return false; // Use the blue bullet texture if the bullet has turned blue. - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor, BlueMode ? TextureBlue : null); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor, BlueMode ? TextureBlue : null); return false; } @@ -160,8 +161,8 @@ namespace CalamityMod.Projectiles.Ranged // Turn blue to set stats correctly, if not already done. if (!BlueMode) TurnBlue(false); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 48); - projectile.Damage(); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 48); + Projectile.Damage(); // Create a fancy triangle of dust. int dustID = (int)CalamityDusts.BlueCosmilite; @@ -171,8 +172,8 @@ namespace CalamityMod.Projectiles.Ranged { float speed = MathHelper.Lerp(0.2f, 3.6f, i / (float)(numDust - 1)); Vector2 dustVel = Vector2.UnitX.RotatedBy(triangleAngle) * speed; - Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, dustID); - d.position = projectile.Center; + Dust d = Dust.NewDustDirect(Projectile.Center, 0, 0, dustID); + d.position = Projectile.Center; d.velocity = dustVel; d.noGravity = true; d.scale *= Main.rand.NextFloat(1.1f, 1.4f); @@ -184,14 +185,14 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { // If the projectile has hit something but hasn't turned blue, turn it blue and warp it behind the player. - if (projectile.numHits > 0 && !BlueMode) + if (Projectile.numHits > 0 && !BlueMode) { TurnBlue(true); return false; } - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.Center, 1); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center, 1); return true; } @@ -201,7 +202,7 @@ namespace CalamityMod.Projectiles.Ranged { float speed = Main.rand.NextFloat(2.0f, 4.1f); Vector2 dustVel = Vector2.UnitX * speed; - Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, dustID); + Dust d = Dust.NewDustDirect(Projectile.Center, 0, 0, dustID); d.position = dustPos; d.velocity = dustVel; d.noGravity = true; diff --git a/Projectiles/Ranged/GoliathRocket.cs b/Projectiles/Ranged/GoliathRocket.cs index 4d3101a0cd..a02bceedfa 100644 --- a/Projectiles/Ranged/GoliathRocket.cs +++ b/Projectiles/Ranged/GoliathRocket.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class GoliathRocket : ModProjectile @@ -19,12 +20,12 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 95; + Projectile.DamageType = DamageClass.Ranged; } private static void DefineFalseLauncher() @@ -36,7 +37,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { for (int num246 = 0; num246 < 2; num246++) { @@ -44,70 +45,70 @@ namespace CalamityMod.Projectiles.Ranged float num248 = 0f; if (num246 == 1) { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; + num247 = Projectile.velocity.X * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + if (Math.Abs(Projectile.velocity.X) < 15f && Math.Abs(Projectile.velocity.Y) < 15f) { - projectile.velocity *= 1.1f; + Projectile.velocity *= 1.1f; } else if (Main.rand.NextBool(2)) { - int num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + int num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 160); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - if (projectile.owner == Main.myPlayer) + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 160); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + if (Projectile.owner == Main.myPlayer) { int num516 = 2; for (int num517 = 0; num517 < num516; num517++) { if (num517 % 2 != 1 || Main.rand.NextBool(3)) { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; + Vector2 value20 = Projectile.position; + Vector2 value21 = Projectile.oldVelocity; value21.Normalize(); value21 *= 8f; float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; value20 -= value21 * (float)num517; - num518 += projectile.oldVelocity.X / 6f; - num519 += projectile.oldVelocity.Y / 6f; - int bee = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage), Main.player[projectile.owner].beeKB(0f), Main.myPlayer); + num518 += Projectile.oldVelocity.X / 6f; + num519 += Projectile.oldVelocity.Y / 6f; + int bee = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); if (bee.WithinBounds(Main.maxProjectiles)) { Main.projectile[bee].penetrate = 2; @@ -116,10 +117,10 @@ namespace CalamityMod.Projectiles.Ranged } } } - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -129,18 +130,18 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); // Construct a fake item to use with vanilla code for the sake of picking ammo. if (FalseLauncher is null) DefineFalseLauncher(); - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int projID = ProjectileID.RocketI; float shootSpeed = 0f; bool canShoot = true; @@ -153,11 +154,11 @@ namespace CalamityMod.Projectiles.Ranged else if (projID == ProjectileID.RocketIV) blastRadius = 9; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 14); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 14); - if (projectile.owner == Main.myPlayer && blastRadius > 0) + if (Projectile.owner == Main.myPlayer && blastRadius > 0) { - CalamityUtils.ExplodeandDestroyTiles(projectile, blastRadius, true, new List() { }, new List() { }); + CalamityUtils.ExplodeandDestroyTiles(Projectile, blastRadius, true, new List() { }, new List() { }); } } diff --git a/Projectiles/Ranged/GreenExoArrow.cs b/Projectiles/Ranged/GreenExoArrow.cs index 2da0e02ad4..c269936444 100644 --- a/Projectiles/Ranged/GreenExoArrow.cs +++ b/Projectiles/Ranged/GreenExoArrow.cs @@ -15,44 +15,44 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.arrow = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } float num55 = 40f; float num56 = 1.5f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); } } } @@ -61,15 +61,15 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs(); - public override Color? GetAlpha(Color lightColor) => new Color(0, 250, 0, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(0, 250, 0, Projectile.alpha); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(40f, 1.5f, lightColor); public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(),projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(),Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Ranged/HalleysComet.cs b/Projectiles/Ranged/HalleysComet.cs index 25d03f014e..30063d52f6 100644 --- a/Projectiles/Ranged/HalleysComet.cs +++ b/Projectiles/Ranged/HalleysComet.cs @@ -14,44 +14,44 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = 10; - projectile.extraUpdates = 10; - projectile.timeLeft = 600; + Projectile.width = Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 10; + Projectile.extraUpdates = 10; + Projectile.timeLeft = 600; } public override void AI() { - if (projectile.scale <= 1.5f) + if (Projectile.scale <= 1.5f) { - projectile.scale *= 1.01f; + Projectile.scale *= 1.01f; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.45f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.45f / 255f); - if (projectile.ai[0]++ > 5f) + if (Projectile.ai[0]++ > 5f) { float dustScaleSize = 1f; - if (projectile.ai[0] == 6f) + if (Projectile.ai[0] == 6f) { dustScaleSize = 0.25f; } - else if (projectile.ai[0] == 7f) + else if (Projectile.ai[0] == 7f) { dustScaleSize = 0.5f; } - else if (projectile.ai[0] == 8f) + else if (Projectile.ai[0] == 8f) { dustScaleSize = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int dustType = 176; for (int i = 0; i < 3; i++) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 1, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 1, default, 1f); Dust dust = Main.dust[fire]; if (Main.rand.NextBool(3)) { @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; dust.scale *= dustScaleSize; - dust.velocity += projectile.velocity; + dust.velocity += Projectile.velocity; if (!dust.noGravity) { dust.velocity *= 0.5f; @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Ranged } } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/HandheldTankShell.cs b/Projectiles/Ranged/HandheldTankShell.cs index f5f7e9bd73..5b10589e70 100644 --- a/Projectiles/Ranged/HandheldTankShell.cs +++ b/Projectiles/Ranged/HandheldTankShell.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -14,13 +15,13 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.extraUpdates = 11; - projectile.timeLeft = 1800; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.extraUpdates = 11; + Projectile.timeLeft = 1800; } public override void AI() @@ -28,15 +29,15 @@ namespace CalamityMod.Projectiles.Ranged drawOffsetX = -8; drawOriginOffsetY = 0; drawOriginOffsetX = -2; - projectile.rotation = projectile.velocity.ToRotation(); - Vector2 pos = projectile.Center; - projectile.localAI[0] += 1f; + Projectile.rotation = Projectile.velocity.ToRotation(); + Vector2 pos = Projectile.Center; + Projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 7f) // projectile has had more than 8 updates, draw fire trail + if (Projectile.localAI[0] > 7f) // projectile has had more than 8 updates, draw fire trail { for (int i = 0; i < 5; ++i) { - pos -= projectile.velocity * ((float)i * 0.25f); + pos -= Projectile.velocity * ((float)i * 0.25f); int idx = Dust.NewDust(pos, 1, 1, 158, 0f, 0f, 0, default, 1f); Main.dust[idx].noGravity = true; Main.dust[idx].position = pos; @@ -68,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged // Choose a random speed and angle to belch out the smoke float dustSpeed = Main.rand.NextFloat(3.0f, 13.0f); float angleRandom = 0.06f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); @@ -86,20 +87,20 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { // Grenade Launcher + Lunar Flare sounds for maximum meaty explosion - Main.PlaySound(SoundID.Item62, projectile.Center); - Main.PlaySound(SoundID.Item88, projectile.Center); + SoundEngine.PlaySound(SoundID.Item62, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item88, Projectile.Center); // Transform the projectile's hitbox into a big explosion - projectile.position = projectile.Center; - projectile.width = projectile.height = 140; - projectile.position.X = projectile.position.X - projectile.width / 2; - projectile.position.Y = projectile.position.Y - projectile.height / 2; + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 140; + Projectile.position.X = Projectile.position.X - Projectile.width / 2; + Projectile.position.Y = Projectile.position.Y - Projectile.height / 2; // Rocket III type explosion is now a utility for convenience - projectile.LargeFieryExplosion(); + Projectile.LargeFieryExplosion(); // Make the explosion cause damage to nearby targets (makes projectile hit twice) - projectile.Damage(); + Projectile.Damage(); } } } diff --git a/Projectiles/Ranged/HighExplosivePeanutShell.cs b/Projectiles/Ranged/HighExplosivePeanutShell.cs index de4687820a..92d4351951 100644 --- a/Projectiles/Ranged/HighExplosivePeanutShell.cs +++ b/Projectiles/Ranged/HighExplosivePeanutShell.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -13,33 +14,33 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("High Explosive Peanut Shell"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 9; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 9; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.ranged = true; - projectile.extraUpdates = 4; - projectile.timeLeft = Lifetime; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 4; + Projectile.timeLeft = Lifetime; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation(); - projectile.spriteDirection = 1; + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.spriteDirection = 1; // Lighting - Lighting.AddLight(projectile.Center, 0.75f, 0.65f, 0.08f); + Lighting.AddLight(Projectile.Center, 0.75f, 0.65f, 0.08f); // Dirty dust, done dirt cheap { int dustID = 7; // wood flakes float scale = Main.rand.NextFloat(1f, 1.4f); - Dust d = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, dustID); + Dust d = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustID); d.noGravity = true; d.scale = scale; @@ -47,46 +48,46 @@ namespace CalamityMod.Projectiles.Ranged d.velocity *= 0.2f; float angleDeviation = 0.17f; float angle = Main.rand.NextFloat(-angleDeviation, angleDeviation); - Vector2 sprayVelocity = projectile.velocity.RotatedBy(angle) * 0.6f; + Vector2 sprayVelocity = Projectile.velocity.RotatedBy(angle) * 0.6f; d.velocity += sprayVelocity; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { // Grenade Launcher + Lunar Flare sounds for maximum meaty explosion - Main.PlaySound(SoundID.Item62, projectile.Center); - Main.PlaySound(SoundID.Item88, projectile.Center); + SoundEngine.PlaySound(SoundID.Item62, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item88, Projectile.Center); // Massively inflate the projectile's hitbox - projectile.position = projectile.Center; - projectile.width = projectile.height = 140; - projectile.position.X = projectile.position.X - projectile.width / 2; - projectile.position.Y = projectile.position.Y - projectile.height / 2; + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 140; + Projectile.position.X = Projectile.position.X - Projectile.width / 2; + Projectile.position.Y = Projectile.position.Y - Projectile.height / 2; // Allow infinite piercing and ignoring iframes for this one extra hit - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; // Rocket III type explosion is now a utility for convenience - projectile.LargeFieryExplosion(); + Projectile.LargeFieryExplosion(); // Deal damage again. The explosion deals half the damage of the direct hit. - projectile.damage /= 2; - projectile.Damage(); + Projectile.damage /= 2; + Projectile.Damage(); } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); return true; // the projectile does indeed die on collision } } diff --git a/Projectiles/Ranged/HiveBomb.cs b/Projectiles/Ranged/HiveBomb.cs index d480af014c..faddfe262d 100644 --- a/Projectiles/Ranged/HiveBomb.cs +++ b/Projectiles/Ranged/HiveBomb.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class HiveBomb : ModProjectile @@ -19,12 +20,12 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 95; + Projectile.DamageType = DamageClass.Ranged; } private static void DefineFalseLauncher() @@ -36,7 +37,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { for (int num246 = 0; num246 < 2; num246++) { @@ -44,70 +45,70 @@ namespace CalamityMod.Projectiles.Ranged float num248 = 0f; if (num246 == 1) { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; + num247 = Projectile.velocity.X * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + if (Math.Abs(Projectile.velocity.X) < 15f && Math.Abs(Projectile.velocity.Y) < 15f) { - projectile.velocity *= 1.1f; + Projectile.velocity *= 1.1f; } else if (Main.rand.NextBool(2)) { - int num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + int num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 64); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - if (projectile.owner == Main.myPlayer) + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 64); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + if (Projectile.owner == Main.myPlayer) { int num516 = 6; for (int num517 = 0; num517 < num516; num517++) { if (num517 % 2 != 1 || Main.rand.NextBool(3)) { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; + Vector2 value20 = Projectile.position; + Vector2 value21 = Projectile.oldVelocity; value21.Normalize(); value21 *= 8f; float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; value20 -= value21 * (float)num517; - num518 += projectile.oldVelocity.X / 6f; - num519 += projectile.oldVelocity.Y / 6f; - int bee = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 3), Main.player[projectile.owner].beeKB(0f), Main.myPlayer); + num518 += Projectile.oldVelocity.X / 6f; + num519 += Projectile.oldVelocity.Y / 6f; + int bee = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 3), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); if (bee.WithinBounds(Main.maxProjectiles)) { Main.projectile[bee].penetrate = 2; @@ -116,10 +117,10 @@ namespace CalamityMod.Projectiles.Ranged } } } - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -129,18 +130,18 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); // Construct a fake item to use with vanilla code for the sake of picking ammo. if (FalseLauncher is null) DefineFalseLauncher(); - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int projID = ProjectileID.RocketI; float shootSpeed = 0f; bool canShoot = true; @@ -153,11 +154,11 @@ namespace CalamityMod.Projectiles.Ranged else if (projID == ProjectileID.RocketIV) blastRadius = 7; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 14); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 14); - if (projectile.owner == Main.myPlayer && blastRadius > 0) + if (Projectile.owner == Main.myPlayer && blastRadius > 0) { - CalamityUtils.ExplodeandDestroyTiles(projectile, blastRadius, true, new List() { }, new List() { }); + CalamityUtils.ExplodeandDestroyTiles(Projectile, blastRadius, true, new List() { }, new List() { }); } } diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index 9e257f334b..6525a0f7ba 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class HiveMissile : ModProjectile @@ -18,13 +19,13 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.scale = 0.75f; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.scale = 0.75f; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 95; + Projectile.DamageType = DamageClass.Ranged; } private static void DefineFalseLauncher() @@ -36,7 +37,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { for (int num246 = 0; num246 < 2; num246++) { @@ -44,70 +45,70 @@ namespace CalamityMod.Projectiles.Ranged float num248 = 0f; if (num246 == 1) { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; + num247 = Projectile.velocity.X * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + if (Math.Abs(Projectile.velocity.X) < 15f && Math.Abs(Projectile.velocity.Y) < 15f) { - projectile.velocity *= 1.5f; + Projectile.velocity *= 1.5f; } else if (Main.rand.NextBool(2)) { - int num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + int num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 80); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - if (projectile.owner == Main.myPlayer) + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 80); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + if (Projectile.owner == Main.myPlayer) { int num516 = 3; for (int num517 = 0; num517 < num516; num517++) { if (num517 % 2 != 1 || Main.rand.NextBool(3)) { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; + Vector2 value20 = Projectile.position; + Vector2 value21 = Projectile.oldVelocity; value21.Normalize(); value21 *= 8f; float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; value20 -= value21 * (float)num517; - num518 += projectile.oldVelocity.X / 6f; - num519 += projectile.oldVelocity.Y / 6f; - int bee = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 2), Main.player[projectile.owner].beeKB(0f), Main.myPlayer); + num518 += Projectile.oldVelocity.X / 6f; + num519 += Projectile.oldVelocity.Y / 6f; + int bee = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 2), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); if (bee.WithinBounds(Main.maxProjectiles)) { Main.projectile[bee].penetrate = 2; @@ -116,10 +117,10 @@ namespace CalamityMod.Projectiles.Ranged } } } - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 90, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 90, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -129,18 +130,18 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 90, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 90, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 90, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 90, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); // Construct a fake item to use with vanilla code for the sake of picking ammo. if (FalseLauncher is null) DefineFalseLauncher(); - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int projID = ProjectileID.RocketI; float shootSpeed = 0f; bool canShoot = true; @@ -153,11 +154,11 @@ namespace CalamityMod.Projectiles.Ranged else if (projID == ProjectileID.RocketIV) blastRadius = 8; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 14); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 14); - if (projectile.owner == Main.myPlayer && blastRadius > 0) + if (Projectile.owner == Main.myPlayer && blastRadius > 0) { - CalamityUtils.ExplodeandDestroyTiles(projectile, blastRadius, true, new List() { }, new List() { }); + CalamityUtils.ExplodeandDestroyTiles(Projectile, blastRadius, true, new List() { }, new List() { }); } } } diff --git a/Projectiles/Ranged/HolyFireBulletProj.cs b/Projectiles/Ranged/HolyFireBulletProj.cs index d2d0251d81..54b53aea10 100644 --- a/Projectiles/Ranged/HolyFireBulletProj.cs +++ b/Projectiles/Ranged/HolyFireBulletProj.cs @@ -17,40 +17,40 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Fire Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ranged = true; - projectile.MaxUpdates = 5; - projectile.timeLeft = Lifetime; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.MaxUpdates = 5; + Projectile.timeLeft = Lifetime; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); - projectile.spriteDirection = projectile.direction; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); + Projectile.spriteDirection = Projectile.direction; // Flaking dust - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { if (Main.rand.NextBool()) { float scale = Main.rand.NextFloat(0.6f, 1.6f); - int dustID = Dust.NewDust(projectile.Center, 1, 1, 244); - Main.dust[dustID].position = projectile.Center; + int dustID = Dust.NewDust(Projectile.Center, 1, 1, 244); + Main.dust[dustID].position = Projectile.Center; Main.dust[dustID].noGravity = true; Main.dust[dustID].scale = scale; float angleDeviation = 0.17f; float angle = Main.rand.NextFloat(-angleDeviation, angleDeviation); - Vector2 sprayVelocity = projectile.velocity.RotatedBy(angle) * 0.6f; + Vector2 sprayVelocity = Projectile.velocity.RotatedBy(angle) * 0.6f; Main.dust[dustID].velocity = sprayVelocity; } } @@ -60,21 +60,21 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } public override void Kill(int timeLeft) { // Spawn an on-hit explosion which deals 75% of the projectile's damage. - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int blastDamage = (int)(projectile.damage * HolyFireBullet.ExplosionMultiplier); + int blastDamage = (int)(Projectile.damage * HolyFireBullet.ExplosionMultiplier); float scale = 0.85f + Main.rand.NextFloat() * 1.15f; - int boom = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), blastDamage, projectile.knockBack, projectile.owner, 0f, scale); + int boom = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), blastDamage, Projectile.knockBack, Projectile.owner, 0f, scale); // Only declare the explosion as ranged class if the bullet itself is ranged class. - if (boom.WithinBounds(Main.maxProjectiles) && projectile.ranged) + if (boom.WithinBounds(Main.maxProjectiles) && Projectile.ranged) Main.projectile[boom].Calamity().forceRanged = true; } @@ -82,13 +82,13 @@ namespace CalamityMod.Projectiles.Ranged for (int k = 0; k < 4; k++) { float scale = Main.rand.NextFloat(1.4f, 1.8f); - int dustID = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244); + int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244); Main.dust[dustID].noGravity = false; Main.dust[dustID].scale = scale; float angleDeviation = 0.25f; float angle = Main.rand.NextFloat(-angleDeviation, angleDeviation); float velMult = Main.rand.NextFloat(0.08f, 0.14f); - Vector2 shrapnelVelocity = projectile.oldVelocity.RotatedBy(angle) * velMult; + Vector2 shrapnelVelocity = Projectile.oldVelocity.RotatedBy(angle) * velMult; Main.dust[dustID].velocity = shrapnelVelocity; } } diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 310fa835b3..3787d3ffe9 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -13,22 +13,22 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Hyperius Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 3; aiType = ProjectileID.Bullet; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() @@ -36,10 +36,10 @@ namespace CalamityMod.Projectiles.Ranged if (currentColor == Color.Black) { int startPoint = Main.rand.Next(6); - projectile.localAI[0] = startPoint; + Projectile.localAI[0] = startPoint; currentColor = GetStartingColor(startPoint); } - Visuals(projectile, ref currentColor); + Visuals(Projectile, ref currentColor); } internal static void Visuals(Projectile projectile, ref Color c) @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } @@ -86,9 +86,9 @@ namespace CalamityMod.Projectiles.Ranged private void OnHitEffects(Vector2 targetPos) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.6), 1f, projectile.owner, true); + CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), 1f, Projectile.owner, true); } } @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Ranged int dustType = dustTypes[Main.rand.Next(3)]; float scale = Main.rand.NextFloat(0.4f, 0.9f); float velScale = Main.rand.NextFloat(3f, 5.5f); - int dustID = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); Main.dust[dustID].noGravity = true; Main.dust[dustID].scale = scale; Main.dust[dustID].velocity *= velScale; diff --git a/Projectiles/Ranged/HyperiusSplit.cs b/Projectiles/Ranged/HyperiusSplit.cs index 520f3bee4f..a318358bd9 100644 --- a/Projectiles/Ranged/HyperiusSplit.cs +++ b/Projectiles/Ranged/HyperiusSplit.cs @@ -14,22 +14,22 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Hyperius Bad Time"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { // Intentionally large bullet hitbox to make Hyperius swarm more forgiving with hits - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 360; - projectile.extraUpdates = 1; + Projectile.width = 8; + Projectile.height = 8; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 360; + Projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; } @@ -38,10 +38,10 @@ namespace CalamityMod.Projectiles.Ranged if (currentColor == Color.Black) { int startPoint = Main.rand.Next(6); - projectile.localAI[0] = startPoint; + Projectile.localAI[0] = startPoint; currentColor = HyperiusBulletProj.GetStartingColor(startPoint); } - HyperiusBulletProj.Visuals(projectile, ref currentColor); + HyperiusBulletProj.Visuals(Projectile, ref currentColor); } // This projectile is always fullbright. @@ -52,9 +52,9 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft == 360) + if (Projectile.timeLeft == 360) return false; - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged int dustType = dustTypes[Main.rand.Next(3)]; float scale = Main.rand.NextFloat(0.4f, 0.9f); float velScale = Main.rand.NextFloat(3f, 5.5f); - int dustID = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); Main.dust[dustID].noGravity = true; Main.dust[dustID].scale = scale; Main.dust[dustID].velocity *= velScale; diff --git a/Projectiles/Ranged/IcicleArrowProj.cs b/Projectiles/Ranged/IcicleArrowProj.cs index 1400f08ae6..a880054805 100644 --- a/Projectiles/Ranged/IcicleArrowProj.cs +++ b/Projectiles/Ranged/IcicleArrowProj.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,17 +12,17 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.coldDamage = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.coldDamage = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 10; + Projectile.height = 10; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.coldDamage = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.coldDamage = true; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void SetStaticDefaults() @@ -34,10 +35,10 @@ namespace CalamityMod.Projectiles.Ranged //icicle dust if (Main.rand.NextBool(2)) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.1f); Main.dust[index2].noGravity = true; } - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -47,21 +48,21 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int index1 = 0; index1 < 5; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, new Color(), 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 68, 0f, 0f, 0, new Color(), 1f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 1.5f; Main.dust[index2].scale *= 0.9f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int index = 0; index < 3; ++index) { - 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; - Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 3, 0f, projectile.owner); + 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; + Projectile.NewProjectile(Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, Projectile.damage / 3, 0f, Projectile.owner); } } } diff --git a/Projectiles/Ranged/IcyBulletProj.cs b/Projectiles/Ranged/IcyBulletProj.cs index 10fcd39736..c0f1bb9710 100644 --- a/Projectiles/Ranged/IcyBulletProj.cs +++ b/Projectiles/Ranged/IcyBulletProj.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -12,36 +13,36 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Icy Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.timeLeft = 600; - projectile.friendly = true; - projectile.ranged = true; - projectile.coldDamage = true; - projectile.penetrate = 3; - projectile.extraUpdates = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - projectile.coldDamage = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.timeLeft = 600; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.coldDamage = true; + Projectile.penetrate = 3; + Projectile.extraUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + Projectile.coldDamage = true; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { if (Main.rand.NextBool(3)) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88, projectile.velocity.X, projectile.velocity.Y, 0, default, 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 88, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1f); Main.dust[index2].noGravity = true; } } @@ -55,31 +56,31 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int index1 = 0; index1 < 5; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88, 0f, 0f, 0, new Color(), 0.9f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 88, 0f, 0f, 0, new Color(), 0.9f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 1.5f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int index = 0; index < 2; ++index) { - 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; - Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 2, 0f, projectile.owner); + 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; + Projectile.NewProjectile(Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, Projectile.damage / 2, 0f, Projectile.owner); } } } diff --git a/Projectiles/Ranged/IlluminatedBullet.cs b/Projectiles/Ranged/IlluminatedBullet.cs index 2916a4a736..3585d52347 100644 --- a/Projectiles/Ranged/IlluminatedBullet.cs +++ b/Projectiles/Ranged/IlluminatedBullet.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -12,49 +13,49 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Illuminated Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 3; // Invisible for the first few frames - projectile.alpha = 255; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.alpha = 255; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, 1f, 0.7f, 0f); // Projectile becomes visible after a few frames - if (projectile.timeLeft == 298) - projectile.alpha = 0; + if (Projectile.timeLeft == 298) + Projectile.alpha = 0; // Once projectile is visible, spawn trailing sparkles - if (projectile.timeLeft <= 298 && Main.rand.NextBool(5)) + if (Projectile.timeLeft <= 298 && Main.rand.NextBool(5)) { - int idx = Dust.NewDust(projectile.Center, 1, 1, 228, 0f, 0f); + int idx = Dust.NewDust(Projectile.Center, 1, 1, 228, 0f, 0f); Main.dust[idx].noGravity = true; Main.dust[idx].noLight = true; - Main.dust[idx].position = projectile.Center; + Main.dust[idx].position = Projectile.Center; Main.dust[idx].velocity = Vector2.Zero; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } @@ -66,8 +67,8 @@ namespace CalamityMod.Projectiles.Ranged // On impact, make impact dust and play a sound. public override void Kill(int timeLeft) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Item10, projectile.position); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); } } } diff --git a/Projectiles/Ranged/ImpactRound.cs b/Projectiles/Ranged/ImpactRound.cs index f974a974ea..3dc47ca43c 100644 --- a/Projectiles/Ranged/ImpactRound.cs +++ b/Projectiles/Ranged/ImpactRound.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -18,36 +19,36 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 7; - projectile.scale = 1.18f; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.extraUpdates = 7; + Projectile.scale = 1.18f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - if (!initialized && projectile.ranged) //Ranged check prevents quiver splits triggering the sound + if (!initialized && Projectile.ranged) //Ranged check prevents quiver splits triggering the sound { initialized = true; if (Main.netMode != NetmodeID.Server) { - var sound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); + var sound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); sound = sound.WithVolume(sound.Volume * 0.45f); - Main.PlaySound(sound, projectile.Center); + SoundEngine.PlaySound(sound, Projectile.Center); } } } @@ -60,6 +61,6 @@ namespace CalamityMod.Projectiles.Ranged damage = (int)(damage * damageMult); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.timeLeft < 600; + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.timeLeft < 600; } } diff --git a/Projectiles/Ranged/KarasawaShot.cs b/Projectiles/Ranged/KarasawaShot.cs index 2de840783f..af20d2673e 100644 --- a/Projectiles/Ranged/KarasawaShot.cs +++ b/Projectiles/Ranged/KarasawaShot.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class KarasawaShot : ModProjectile @@ -20,42 +21,42 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.5f); + Lighting.AddLight(Projectile.Center, 0f, 0.5f, 0.5f); int dustTypeOnTimer = dust1; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 15f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 15f) { for (int num447 = 0; num447 < 2; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); + Projectile.alpha = 255; int num448 = Dust.NewDust(vector33, 1, 1, dustTypeOnTimer, 0f, 0f, 0, default, 1f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[num448].velocity *= 0.2f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] == 48f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] == 48f) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; if (dustTypeOnTimer == dust1) dustTypeOnTimer = dust2; @@ -70,37 +71,37 @@ namespace CalamityMod.Projectiles.Ranged { int dustType = num41 == 0 ? dust1 : dust2; Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 * 1.5f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); + value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 * 1.5f; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 0.75f; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; + Main.dust[num42].position = Projectile.Center + value8; + Main.dust[num42].velocity = Projectile.velocity; } } } - if (projectile.localAI[0] == 15f) + if (Projectile.localAI[0] == 15f) { float angleRandom = 0.1f; for (int num53 = 0; num53 < 40; num53++) { float dustSpeed = Main.rand.NextFloat(6.0f, 12.0f); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool(2) ? dust1 : dust2; - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); Dust dust = Main.dust[num54]; - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity *= randomDustType == dust2 ? 2f : 4f; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.velocity *= randomDustType == dust2 ? 1.33f : 2.66f; @@ -111,14 +112,14 @@ namespace CalamityMod.Projectiles.Ranged for (int num55 = 0; num55 < 20; num55++) { float dustSpeed = Main.rand.NextFloat(6.0f, 12.0f); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); int randomDustType = Main.rand.NextBool(2) ? dust1 : dust2; - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); Dust dust = Main.dust[num56]; - dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; dust.noGravity = true; dust.velocity *= randomDustType == dust2 ? 0.33f : 0.66f; @@ -137,23 +138,23 @@ namespace CalamityMod.Projectiles.Ranged { int height = 150; - Main.PlaySound(SoundID.NPCDeath43, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCDeath43, Projectile.Center); - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) // 108 dusts { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.3f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.3f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, Main.rand.NextBool(2) ? dust1 : dust2, vector7.X * 0.3f, vector7.Y * 0.3f, 100, default, 2f); Main.dust[num228].noGravity = true; @@ -171,7 +172,7 @@ namespace CalamityMod.Projectiles.Ranged { random = !random; Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f); - Dust d = Dust.NewDustPerfect(projectile.Center, random ? dust1 : dust2, velocity); + Dust d = Dust.NewDustPerfect(Projectile.Center, random ? dust1 : dust2, velocity); d.noGravity = true; d.customData = 0.025f; d.scale = 2f; diff --git a/Projectiles/Ranged/LeafArrow.cs b/Projectiles/Ranged/LeafArrow.cs index 5288c74bd8..3910d8c85f 100644 --- a/Projectiles/Ranged/LeafArrow.cs +++ b/Projectiles/Ranged/LeafArrow.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -12,81 +13,81 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Arrow"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.alpha -= 2; - projectile.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f; - projectile.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f; - if (projectile.localAI[0] == 0f) + Projectile.alpha -= 2; + Projectile.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f; + Projectile.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f; + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) + Projectile.scale += 0.05f; + if ((double)Projectile.scale > 1.2) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } } else { - projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) + Projectile.scale -= 0.05f; + if ((double)Projectile.scale < 0.8) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 3.14f; - if (projectile.localAI[1] <= 30f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 3.14f; + if (Projectile.localAI[1] <= 30f) { - projectile.localAI[1] += 1f; - projectile.velocity.Y *= 0.975f; - projectile.velocity.X *= 0.975f; + Projectile.localAI[1] += 1f; + Projectile.velocity.Y *= 0.975f; + Projectile.velocity.X *= 0.975f; } - else if (projectile.localAI[1] <= 60f) + else if (Projectile.localAI[1] <= 60f) { - projectile.localAI[1] += 1f; - projectile.velocity.Y *= 1.025f; - projectile.velocity.X *= 1.025f; + Projectile.localAI[1] += 1f; + Projectile.velocity.Y *= 1.025f; + Projectile.velocity.X *= 1.025f; } else { - projectile.localAI[1] = 0f; + Projectile.localAI[1] = 0f; } } public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); + return new Color(Main.DiscoR, 203, 103, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Grass, projectile.position); - projectile.localAI[1] += 1f; + SoundEngine.PlaySound(SoundID.Grass, Projectile.position); + Projectile.localAI[1] += 1f; for (int num407 = 0; num407 < 5; num407++) { - int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + int num408 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[num408].noGravity = true; Main.dust[num408].velocity *= 3f; Main.dust[num408].scale = 1.5f; diff --git a/Projectiles/Ranged/LunarBolt.cs b/Projectiles/Ranged/LunarBolt.cs index abc055a81a..5270d454a1 100644 --- a/Projectiles/Ranged/LunarBolt.cs +++ b/Projectiles/Ranged/LunarBolt.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class LunarBolt : ModProjectile @@ -13,59 +14,59 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 180; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 180; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - if (projectile.alpha < 170) + if (Projectile.alpha < 170) { for (int d = 0; d < 5; d++) { - Vector2 dspeed = -projectile.velocity * 0.5f; - int index = Dust.NewDust(projectile.Center, 1, 1, 206, 0f, 0f, 0, default, 1.2f); - Main.dust[index].alpha = projectile.alpha; + Vector2 dspeed = -Projectile.velocity * 0.5f; + int index = Dust.NewDust(Projectile.Center, 1, 1, 206, 0f, 0f, 0, default, 1.2f); + Main.dust[index].alpha = Projectile.alpha; Main.dust[index].velocity = dspeed; Main.dust[index].noGravity = true; } for (int d = 0; d < 5; d++) { - Vector2 dspeed2 = -projectile.velocity * 0.5f; - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 0, default, 0.7f); - Main.dust[index].alpha = projectile.alpha; + Vector2 dspeed2 = -Projectile.velocity * 0.5f; + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 0.7f); + Main.dust[index].alpha = Projectile.alpha; Main.dust[index].velocity = dspeed2; Main.dust[index].noGravity = true; } } - if (projectile.alpha > 50) + if (Projectile.alpha > 50) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 50) + if (Projectile.alpha < 50) { - projectile.alpha = 50; + Projectile.alpha = 50; } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Item10, projectile.Center); - projectile.ai[0]++; + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + Projectile.ai[0]++; } return false; } diff --git a/Projectiles/Ranged/LunarBolt2.cs b/Projectiles/Ranged/LunarBolt2.cs index 911a6d841c..ea8500be0a 100644 --- a/Projectiles/Ranged/LunarBolt2.cs +++ b/Projectiles/Ranged/LunarBolt2.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class LunarBolt2 : ModProjectile @@ -15,59 +16,59 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 180; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 180; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - if (projectile.alpha < 170) + if (Projectile.alpha < 170) { for (int d = 0; d < 5; d++) { - Vector2 dspeed = -projectile.velocity * 0.5f; - int index = Dust.NewDust(projectile.Center, 1, 1, 206, 0f, 0f, 0, default, 1.2f); - Main.dust[index].alpha = projectile.alpha; + Vector2 dspeed = -Projectile.velocity * 0.5f; + int index = Dust.NewDust(Projectile.Center, 1, 1, 206, 0f, 0f, 0, default, 1.2f); + Main.dust[index].alpha = Projectile.alpha; Main.dust[index].velocity = dspeed; Main.dust[index].noGravity = true; } for (int d = 0; d < 5; d++) { - Vector2 dspeed2 = -projectile.velocity * 0.5f; - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 0, default, 0.7f); - Main.dust[index].alpha = projectile.alpha; + Vector2 dspeed2 = -Projectile.velocity * 0.5f; + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 0.7f); + Main.dust[index].alpha = Projectile.alpha; Main.dust[index].velocity = dspeed2; Main.dust[index].noGravity = true; } } - if (projectile.alpha > 50) + if (Projectile.alpha > 50) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 50) + if (Projectile.alpha < 50) { - projectile.alpha = 50; + Projectile.alpha = 50; } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Item10, projectile.Center); - projectile.ai[0]++; + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + Projectile.ai[0]++; } return false; } diff --git a/Projectiles/Ranged/LuxorsGiftRanged.cs b/Projectiles/Ranged/LuxorsGiftRanged.cs index 3bf7a34bf8..681c6931eb 100644 --- a/Projectiles/Ranged/LuxorsGiftRanged.cs +++ b/Projectiles/Ranged/LuxorsGiftRanged.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,26 +12,26 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Gift"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 180; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 180; } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -39,57 +40,57 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 250) + Projectile.scale -= 0.01f; + Projectile.alpha += 15; + if (Projectile.alpha >= 250) { - projectile.alpha = 255; - projectile.localAI[0] = 1f; + Projectile.alpha = 255; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[0] = 0f; + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; } } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 3f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 3f) { for (int l = 0; l < 12; l++) { - Vector2 offset = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 offset = Vector2.UnitX * (float)-(float)Projectile.width / 2f; offset += -Vector2.UnitY.RotatedBy((double)(l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); - offset = offset.RotatedBy((double)(projectile.rotation - MathHelper.PiOver2), default); - int electric = Dust.NewDust(projectile.Center, 0, 0, 135, 0f, 0f, 160, default, 1f); + offset = offset.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default); + int electric = Dust.NewDust(Projectile.Center, 0, 0, 135, 0f, 0f, 160, default, 1f); Main.dust[electric].scale = 1.1f; Main.dust[electric].noGravity = true; - Main.dust[electric].position = projectile.Center + offset; - Main.dust[electric].velocity = projectile.velocity * 0.1f; - Main.dust[electric].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[electric].position) * 1.25f; + Main.dust[electric].position = Projectile.Center + offset; + Main.dust[electric].velocity = Projectile.velocity * 0.1f; + Main.dust[electric].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[electric].position) * 1.25f; } } } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 16); - projectile.maxPenetrate = projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item92, projectile.position); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 16); + Projectile.maxPenetrate = Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item92, Projectile.position); int dustAmt = Main.rand.Next(10, 20); for (int d = 0; d < dustAmt; d++) { - int electric = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + int electric = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); Main.dust[electric].velocity *= 2f; Main.dust[electric].noGravity = true; } @@ -97,7 +98,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/MaelstromHoldout.cs b/Projectiles/Ranged/MaelstromHoldout.cs index ebd0815c62..725c97ea7f 100644 --- a/Projectiles/Ranged/MaelstromHoldout.cs +++ b/Projectiles/Ranged/MaelstromHoldout.cs @@ -3,47 +3,48 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class MaelstromHoldout : ModProjectile { - private Player Owner => Main.player[projectile.owner]; + private Player Owner => Main.player[Projectile.owner]; private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; - private ref float CurrentChargingFrames => ref projectile.ai[0]; - private ref float ArrowsLoaded => ref projectile.ai[1]; - private ref float FramesToLoadNextArrow => ref projectile.localAI[0]; + private ref float CurrentChargingFrames => ref Projectile.ai[0]; + private ref float ArrowsLoaded => ref Projectile.ai[1]; + private ref float FramesToLoadNextArrow => ref Projectile.localAI[0]; public override string Texture => "CalamityMod/Items/Weapons/Ranged/TheMaelstrom"; public override void SetStaticDefaults() => DisplayName.SetDefault("The Maelstrom"); public override void SetDefaults() { - projectile.width = 78; - projectile.height = 137; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.ranged = true; + Projectile.width = 78; + Projectile.height = 137; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; } public override void AI() { Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 shootPosition = armPosition + projectile.velocity * projectile.width * 0.5f; + Vector2 shootPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f; // Destroy the holdout projectile if the owner is no longer eligible to hold it. if (!OwnerCanShoot) { - projectile.Kill(); + Projectile.Kill(); return; } // Frame 1 effects: Record how fast the hold item being used is, to determine how fast to load arrows. if (FramesToLoadNextArrow == 0f) { - Main.PlaySound(SoundID.Item20, projectile.Center); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); FramesToLoadNextArrow = Owner.ActiveItem().useAnimation; } @@ -77,10 +78,10 @@ namespace CalamityMod.Projectiles.Ranged } // Play a shoot sound. - Main.PlaySound(SoundID.Item66, projectile.Center); - Main.PlaySound(SoundID.Item96, projectile.Center); + SoundEngine.PlaySound(SoundID.Item66, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item96, Projectile.Center); - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; Item heldItem = Owner.ActiveItem(); @@ -96,40 +97,40 @@ namespace CalamityMod.Projectiles.Ranged projectileType = ModContent.ProjectileType(); knockback = Owner.GetWeaponKnockback(heldItem, knockback); - Vector2 shootVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * shootSpeed; + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * shootSpeed; - Projectile.NewProjectile(shootPosition, shootVelocity, projectileType, arrowDamage, knockback, projectile.owner, 0f, 0f); + Projectile.NewProjectile(shootPosition, shootVelocity, projectileType, arrowDamage, knockback, Projectile.owner, 0f, 0f); } private void UpdateProjectileHeldVariables(Vector2 armPosition) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - float aimInterpolant = Utils.InverseLerp(5f, 25f, projectile.Distance(Main.MouseWorld), true); - Vector2 oldVelocity = projectile.velocity; - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(Main.MouseWorld), aimInterpolant); - if (projectile.velocity != oldVelocity) + float aimInterpolant = Utils.InverseLerp(5f, 25f, Projectile.Distance(Main.MouseWorld), true); + Vector2 oldVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), aimInterpolant); + if (Projectile.velocity != oldVelocity) { - projectile.netSpam = 0; - projectile.netUpdate = true; + Projectile.netSpam = 0; + Projectile.netUpdate = true; } } - projectile.position = armPosition - projectile.Size * 0.5f + projectile.velocity * 24f; - projectile.rotation = projectile.velocity.ToRotation(); - if (projectile.spriteDirection == -1) - projectile.rotation += MathHelper.Pi; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; + Projectile.position = armPosition - Projectile.Size * 0.5f + Projectile.velocity * 24f; + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.spriteDirection == -1) + Projectile.rotation += MathHelper.Pi; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; } private void ManipulatePlayerVariables() { - Owner.ChangeDir(projectile.direction); - Owner.heldProj = projectile.whoAmI; + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } public override bool CanDamage() => false; diff --git a/Projectiles/Ranged/MagnaStrike.cs b/Projectiles/Ranged/MagnaStrike.cs index bd8a37854b..7f392f7147 100644 --- a/Projectiles/Ranged/MagnaStrike.cs +++ b/Projectiles/Ranged/MagnaStrike.cs @@ -10,40 +10,40 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Strike"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.scale = 0.5f; - projectile.alpha = 200; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.scale = 0.5f; + Projectile.alpha = 200; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - if (projectile.scale <= 1.5f) + if (Projectile.scale <= 1.5f) { - projectile.scale *= 1.01f; + Projectile.scale *= 1.01f; } - projectile.alpha -= 2; - if (projectile.alpha == 0) + Projectile.alpha -= 2; + if (Projectile.alpha == 0) { - projectile.alpha = 200; + Projectile.alpha = 200; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/MagnomalyAura.cs b/Projectiles/Ranged/MagnomalyAura.cs index 4000a38eea..af1054ed80 100644 --- a/Projectiles/Ranged/MagnomalyAura.cs +++ b/Projectiles/Ranged/MagnomalyAura.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.ranged = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; - projectile.width = 200; - projectile.height = 200; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 200; + Projectile.height = 200; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; } public override void AI() @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < Main.projectile.Length; i++) { Projectile p = Main.projectile[i]; - if (p.identity == projectile.ai[0] && p.active && p.type == ModContent.ProjectileType()) + if (p.identity == Projectile.ai[0] && p.active && p.type == ModContent.ProjectileType()) { parent = p; active = true; @@ -46,19 +46,19 @@ namespace CalamityMod.Projectiles.Ranged if (active) { - projectile.Center = parent.Center; + Projectile.Center = parent.Center; } else { - projectile.Kill(); + Projectile.Kill(); } if (!parent.active) { - projectile.Kill(); + Projectile.Kill(); } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); } } diff --git a/Projectiles/Ranged/MagnomalyBeam.cs b/Projectiles/Ranged/MagnomalyBeam.cs index 1ca66c9841..f21a2264ed 100644 --- a/Projectiles/Ranged/MagnomalyBeam.cs +++ b/Projectiles/Ranged/MagnomalyBeam.cs @@ -16,56 +16,56 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.timeLeft = 300; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 5; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void AI() { - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; } - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.25f / 255f, Main.DiscoG * 0.25f / 255f, Main.DiscoB * 0.25f / 255f); + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.25f / 255f, Main.DiscoG * 0.25f / 255f, Main.DiscoB * 0.25f / 255f); float num55 = 100f; float num56 = 2f; //3 - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); } } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 2f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(100f, 2f, lightColor); - public override Color? GetAlpha(Color lightColor) => new Color(0, 250, 75, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(0, 250, 75, Projectile.alpha); public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs(); diff --git a/Projectiles/Ranged/MagnomalyExplosion.cs b/Projectiles/Ranged/MagnomalyExplosion.cs index 3ccbc41224..cd47d5fa92 100644 --- a/Projectiles/Ranged/MagnomalyExplosion.cs +++ b/Projectiles/Ranged/MagnomalyExplosion.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 192; - projectile.height = 192; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.alpha = 255; + Projectile.width = 192; + Projectile.height = 192; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.alpha = 255; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/MagnomalyRocket.cs b/Projectiles/Ranged/MagnomalyRocket.cs index 9a292afb2e..ee19f917ae 100644 --- a/Projectiles/Ranged/MagnomalyRocket.cs +++ b/Projectiles/Ranged/MagnomalyRocket.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class MagnomalyRocket : ModProjectile @@ -12,57 +13,57 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Nuke"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 22; - projectile.friendly = true; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = Projectile.height = 22; + Projectile.friendly = true; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void AI() { //Lighting - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.25f / 255f, Main.DiscoG * 0.25f / 255f, Main.DiscoB * 0.25f / 255f); + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.25f / 255f, Main.DiscoG * 0.25f / 255f, Main.DiscoB * 0.25f / 255f); //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 7) + Projectile.frameCounter++; + if (Projectile.frameCounter > 7) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; int dustType = Main.rand.NextBool(2) ? 107 : 234; if (Main.rand.NextBool(4)) { dustType = 269; } - if (projectile.owner == Main.myPlayer && !spawnedAura) + if (Projectile.owner == Main.myPlayer && !spawnedAura) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack * 0.5f, projectile.owner, projectile.identity, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack * 0.5f, Projectile.owner, Projectile.identity, 0f); spawnedAura = true; } - float dustOffsetX = projectile.velocity.X * 0.5f; - float dustOffsetY = projectile.velocity.Y * 0.5f; + float dustOffsetX = Projectile.velocity.X * 0.5f; + float dustOffsetY = Projectile.velocity.Y * 0.5f; if (Main.rand.NextBool(2)) { - int exo = Dust.NewDust(new Vector2(projectile.position.X + 3f + dustOffsetX, projectile.position.Y + 3f + dustOffsetY) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, dustType, 0f, 0f, 100, default, 0.5f); + int exo = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dustOffsetX, Projectile.position.Y + 3f + dustOffsetY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, dustType, 0f, 0f, 100, default, 0.5f); Main.dust[exo].scale *= (float)Main.rand.Next(10) * 0.1f; Main.dust[exo].velocity *= 0.2f; Main.dust[exo].noGravity = true; @@ -70,23 +71,23 @@ namespace CalamityMod.Projectiles.Ranged } else { - int exo = Dust.NewDust(new Vector2(projectile.position.X + 3f + dustOffsetX, projectile.position.Y + 3f + dustOffsetY) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, dustType, 0f, 0f, 100, default, 0.25f); + int exo = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dustOffsetX, Projectile.position.Y + 3f + dustOffsetY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, dustType, 0f, 0f, 100, default, 0.25f); Main.dust[exo].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[exo].velocity *= 0.05f; Main.dust[exo].noGravity = true; Main.dust[exo].noLight = true; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 192); - Main.PlaySound(SoundID.Item14, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 192); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); //DO NOT REMOVE THIS PROJECTILE - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); int dustType = Main.rand.NextBool(2) ? 107 : 234; if (Main.rand.NextBool(4)) @@ -95,7 +96,7 @@ namespace CalamityMod.Projectiles.Ranged } for (int d = 0; d < 30; d++) { - int exo = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1f); + int exo = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); Main.dust[exo].velocity *= 3f; Main.dust[exo].noGravity = true; Main.dust[exo].noLight = true; @@ -107,20 +108,20 @@ namespace CalamityMod.Projectiles.Ranged } for (int d = 0; d < 40; d++) { - int exo = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.5f); + int exo = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.5f); Main.dust[exo].noGravity = true; Main.dust[exo].noLight = true; Main.dust[exo].velocity *= 5f; - exo = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.75f); + exo = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.75f); Main.dust[exo].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 9); + CalamityUtils.ExplosionGores(Projectile.Center, 9); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -138,17 +139,17 @@ namespace CalamityMod.Projectiles.Ranged private void OnHitEffects() { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { float random = Main.rand.Next(30, 90); float spread = random * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; for (int i = 0; i < 4; i++) { double offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int proj1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack / 4, projectile.owner, 0f, 1f); - int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack / 4, projectile.owner, 0f, 1f); + int proj1 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack / 4, Projectile.owner, 0f, 1f); + int proj2 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack / 4, Projectile.owner, 0f, 1f); } } } diff --git a/Projectiles/Ranged/MechanicalBarracuda.cs b/Projectiles/Ranged/MechanicalBarracuda.cs index 3f9fece03a..1bb61f42ad 100644 --- a/Projectiles/Ranged/MechanicalBarracuda.cs +++ b/Projectiles/Ranged/MechanicalBarracuda.cs @@ -7,23 +7,23 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Barracuda"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; - projectile.friendly = true; - projectile.aiStyle = 39; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.ranged = true; + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.aiStyle = 39; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Ranged; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; } } } diff --git a/Projectiles/Ranged/MeowFire.cs b/Projectiles/Ranged/MeowFire.cs index 5ee0befe82..fea9024ee1 100644 --- a/Projectiles/Ranged/MeowFire.cs +++ b/Projectiles/Ranged/MeowFire.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -16,38 +17,38 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 90; } public override void AI() { - if (projectile.ai[0] > 7f) + if (Projectile.ai[0] > 7f) { float num296 = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { num296 = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { num296 = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num297 = 56; for (int num298 = 0; num298 < 2; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { @@ -63,7 +64,7 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; dust.scale *= num296; - dust.velocity += projectile.velocity; + dust.velocity += Projectile.velocity; if (!dust.noGravity) { dust.velocity *= 0.5f; @@ -72,24 +73,24 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; - Main.PlaySound(SoundID.Item57, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 10; - projectile.height = 10; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + target.immune[Projectile.owner] = 8; + SoundEngine.PlaySound(SoundID.Item57, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 10; + Projectile.height = 10; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -99,10 +100,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1.5f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1.5f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } target.AddBuff(BuffID.Frostburn, 180); diff --git a/Projectiles/Ranged/MeowFire2.cs b/Projectiles/Ranged/MeowFire2.cs index 21dd2d961d..d7a07aba29 100644 --- a/Projectiles/Ranged/MeowFire2.cs +++ b/Projectiles/Ranged/MeowFire2.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -16,38 +17,38 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 90; } public override void AI() { - if (projectile.ai[0] > 7f) + if (Projectile.ai[0] > 7f) { float num296 = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { num296 = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { num296 = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num297 = 73; for (int num298 = 0; num298 < 2; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { @@ -63,7 +64,7 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; dust.scale *= num296; - dust.velocity += projectile.velocity; + dust.velocity += Projectile.velocity; if (!dust.noGravity) { dust.velocity *= 0.5f; @@ -72,24 +73,24 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; - Main.PlaySound(SoundID.Item58, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 10; - projectile.height = 10; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + target.immune[Projectile.owner] = 8; + SoundEngine.PlaySound(SoundID.Item58, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 10; + Projectile.height = 10; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -99,10 +100,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.5f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1.5f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } target.AddBuff(BuffID.OnFire, 180); diff --git a/Projectiles/Ranged/MiniRocket.cs b/Projectiles/Ranged/MiniRocket.cs index 6947898475..acfbe11983 100644 --- a/Projectiles/Ranged/MiniRocket.cs +++ b/Projectiles/Ranged/MiniRocket.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class MiniRocket : ModProjectile @@ -12,17 +13,17 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Rocket"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 95; + Projectile.DamageType = DamageClass.Ranged; } private static void DefineFalseLauncher() @@ -34,27 +35,27 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - Main.PlaySound(SoundID.Item11, (int)projectile.Center.X, (int)projectile.Center.Y); - projectile.ai[0] = 1f; + SoundEngine.PlaySound(SoundID.Item11, (int)Projectile.Center.X, (int)Projectile.Center.Y); + Projectile.ai[0] = 1f; } //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 7) + Projectile.frameCounter++; + if (Projectile.frameCounter > 7) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.velocity.Length() >= 8f) + if (Projectile.velocity.Length() >= 8f) { for (int num246 = 0; num246 < 2; num246++) { @@ -62,33 +63,33 @@ namespace CalamityMod.Projectiles.Ranged float num248 = 0f; if (num246 == 1) { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; + num247 = Projectile.velocity.X * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 32); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.position); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 32); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -98,18 +99,18 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); // Construct a fake item to use with vanilla code for the sake of picking ammo. if (FalseLauncher is null) DefineFalseLauncher(); - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int projID = ProjectileID.RocketI; float shootSpeed = 0f; bool canShoot = true; @@ -122,11 +123,11 @@ namespace CalamityMod.Projectiles.Ranged else if (projID == ProjectileID.RocketIV) blastRadius = 6; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 14); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 14); - if (projectile.owner == Main.myPlayer && blastRadius > 0) + if (Projectile.owner == Main.myPlayer && blastRadius > 0) { - CalamityUtils.ExplodeandDestroyTiles(projectile, blastRadius, true, new List() { }, new List() { }); + CalamityUtils.ExplodeandDestroyTiles(Projectile, blastRadius, true, new List() { }, new List() { }); } } } diff --git a/Projectiles/Ranged/MiniSharkron.cs b/Projectiles/Ranged/MiniSharkron.cs index 449168df30..e4ee36b239 100644 --- a/Projectiles/Ranged/MiniSharkron.cs +++ b/Projectiles/Ranged/MiniSharkron.cs @@ -9,35 +9,35 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Mini Sharkron"); - Main.projFrames[projectile.type] = 2; + Main.projFrames[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.aiStyle = 1; aiType = ProjectileID.MiniSharkron; - projectile.friendly = true; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void Kill(int timeLeft) { for (int d = 0; d < 15; ++d) { - int idx = Dust.NewDust(projectile.Center - Vector2.One * 10f, 50, 50, DustID.Blood, 0f, -2f, 0, default, 1f); + int idx = Dust.NewDust(Projectile.Center - Vector2.One * 10f, 50, 50, DustID.Blood, 0f, -2f, 0, default, 1f); Dust dust = Main.dust[idx]; dust.velocity /= 2f; } - int tail = Gore.NewGore(projectile.Center, projectile.velocity * 0.8f, 584, 1f); + int tail = Gore.NewGore(Projectile.Center, Projectile.velocity * 0.8f, 584, 1f); Main.gore[tail].timeLeft /= 10; - int body = Gore.NewGore(projectile.Center, projectile.velocity * 0.9f, 585, 1f); + int body = Gore.NewGore(Projectile.Center, Projectile.velocity * 0.9f, 585, 1f); Main.gore[body].timeLeft /= 10; - int head = Gore.NewGore(projectile.Center, projectile.velocity * 1f, 586, 1f); + int head = Gore.NewGore(Projectile.Center, Projectile.velocity * 1f, 586, 1f); Main.gore[head].timeLeft /= 10; } } diff --git a/Projectiles/Ranged/Minibirb.cs b/Projectiles/Ranged/Minibirb.cs index 59220a8b62..eb62410853 100644 --- a/Projectiles/Ranged/Minibirb.cs +++ b/Projectiles/Ranged/Minibirb.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -10,53 +11,53 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Minibirb"); - Main.projFrames[projectile.type] = 2; + Main.projFrames[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 8; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.light = 0.25f; - projectile.extraUpdates = 1; + Projectile.width = 24; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.light = 0.25f; + Projectile.extraUpdates = 1; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.NPCHit51, projectile.Center); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.NPCHit51, Projectile.Center); return true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(SoundID.NPCHit51, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit51, Projectile.Center); } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 1) + if (Projectile.frame > 1) { - projectile.frame = 0; + Projectile.frame = 0; } if (Main.rand.Next(5) == 0) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? MathHelper.Pi : 0f); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? MathHelper.Pi : 0f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 10f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 10f, 20f); } } } diff --git a/Projectiles/Ranged/MistArrow.cs b/Projectiles/Ranged/MistArrow.cs index d7eae618d4..d10a042026 100644 --- a/Projectiles/Ranged/MistArrow.cs +++ b/Projectiles/Ranged/MistArrow.cs @@ -10,54 +10,54 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Arrow"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.timeLeft = 300; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.aiStyle = 1; + Projectile.timeLeft = 300; aiType = ProjectileID.WoodenArrowFriendly; - projectile.arrow = true; - projectile.coldDamage = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.arrow = true; + Projectile.coldDamage = true; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 9) + Projectile.frameCounter++; + if (Projectile.frameCounter > 9) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 2) + if (Projectile.frame > 2) { - projectile.frame = 0; + Projectile.frame = 0; } //Fade in - if (projectile.alpha > 5) - projectile.alpha -= 15; - if (projectile.alpha < 5) - projectile.alpha = 5; + if (Projectile.alpha > 5) + Projectile.alpha -= 15; + if (Projectile.alpha < 5) + Projectile.alpha = 5; //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - Vector2 dspeed = -projectile.velocity * Main.rand.NextFloat(0.3f, 0.6f); - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, new Color(237, 242, 242, 200), 1.2f); + Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.6f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, new Color(237, 242, 242, 200), 1.2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity = dspeed; } @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 31, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 100, new Color(237, 242, 242, 200), 1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 31, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 100, new Color(237, 242, 242, 200), 1f); } } diff --git a/Projectiles/Ranged/MortarRoundProj.cs b/Projectiles/Ranged/MortarRoundProj.cs index cc87fd4ae5..6ca67619c1 100644 --- a/Projectiles/Ranged/MortarRoundProj.cs +++ b/Projectiles/Ranged/MortarRoundProj.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -20,18 +21,18 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 150; - projectile.ranged = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 150; + Projectile.DamageType = DamageClass.Ranged; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (projectile.velocity.Length() >= 8f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.velocity.Length() >= 8f) { for (int d = 0; d < 2; d++) { @@ -39,14 +40,14 @@ namespace CalamityMod.Projectiles.Ranged float yOffset = 0f; if (d == 1) { - xOffset = projectile.velocity.X * 0.5f; - yOffset = projectile.velocity.Y * 0.5f; + xOffset = Projectile.velocity.X * 0.5f; + yOffset = Projectile.velocity.Y * 0.5f; } - int fire = Dust.NewDust(new Vector2(projectile.position.X + 3f + xOffset, projectile.position.Y + 3f + yOffset) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, DustID.Fire, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xOffset, Projectile.position.Y + 3f + yOffset) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Fire, 0f, 0f, 100, default, 1f); Main.dust[fire].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[fire].velocity *= 0.2f; Main.dust[fire].noGravity = true; - int smoke = Dust.NewDust(new Vector2(projectile.position.X + 3f + xOffset, projectile.position.Y + 3f + yOffset) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, DustID.Smoke, 0f, 0f, 100, default, 0.5f); + int smoke = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xOffset, Projectile.position.Y + 3f + yOffset) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Smoke, 0f, 0f, 100, default, 0.5f); Main.dust[smoke].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[smoke].velocity *= 0.05f; } @@ -55,24 +56,24 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 200); - projectile.maxPenetrate = projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.knockBack *= 5f; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 200); + Projectile.maxPenetrate = Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.knockBack *= 5f; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int d = 0; d < 40; d++) { - int smoke = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); + int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Main.dust[smoke].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -82,19 +83,19 @@ namespace CalamityMod.Projectiles.Ranged } for (int d = 0; d < 70; d++) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 14); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 14); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ExplodeandDestroyTiles(projectile, 5, false, new List() + CalamityUtils.ExplodeandDestroyTiles(Projectile, 5, false, new List() { ModContent.TileType(), ModContent.TileType() diff --git a/Projectiles/Ranged/Nanomachine.cs b/Projectiles/Ranged/Nanomachine.cs index d36f295434..cb5e79fbe5 100644 --- a/Projectiles/Ranged/Nanomachine.cs +++ b/Projectiles/Ranged/Nanomachine.cs @@ -12,86 +12,86 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Bullet"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.extraUpdates = 1; + Projectile.width = 16; + Projectile.height = 16; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.localAI[1] == 0) - projectile.localAI[1] = Main.rand.Next(1, 3); - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/Nanomachine"); - if (projectile.localAI[1] == 2) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/Nanomachine2"); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, texture); + if (Projectile.localAI[1] == 0) + Projectile.localAI[1] = Main.rand.Next(1, 3); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Ranged/Nanomachine"); + if (Projectile.localAI[1] == 2) + texture = ModContent.Request("CalamityMod/Projectiles/Ranged/Nanomachine2"); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, texture); return false; } public override void AI() { //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 2) + if (Projectile.frame > 2) { - projectile.frame = 0; + Projectile.frame = 0; } //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; - Vector2 dspeed = -projectile.velocity * Main.rand.NextFloat(0.5f, 0.8f); - float x2 = projectile.Center.X - projectile.velocity.X / 10f; - float y2 = projectile.Center.Y - projectile.velocity.Y / 10f; + Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f, 0.8f); + float x2 = Projectile.Center.X - Projectile.velocity.X / 10f; + float y2 = Projectile.Center.Y - Projectile.velocity.Y / 10f; int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 229, 0f, 0f, 0, default, 0.8f); - Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].alpha = Projectile.alpha; Main.dust[num137].position.X = x2; Main.dust[num137].position.Y = y2; Main.dust[num137].velocity = dspeed; Main.dust[num137].noGravity = true; - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; + float num138 = (float)Math.Sqrt((double)(Projectile.velocity.X * Projectile.velocity.X + Projectile.velocity.Y * Projectile.velocity.Y)); + float num139 = Projectile.localAI[0]; if (num139 == 0f) { - projectile.localAI[0] = num138; + Projectile.localAI[0] = num138; num139 = num138; } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; + float num140 = Projectile.position.X; + float num141 = Projectile.position.Y; float num142 = 800f; bool flag4 = false; int num143 = 0; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { for (int num144 = 0; num144 < 200; num144++) { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) + if (Main.npc[num144].CanBeChasedBy(Projectile, false) && (Projectile.ai[1] == 0f || Projectile.ai[1] == (float)(num144 + 1))) { float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) + float num147 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num145) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num146); + if (num147 < num142 && Collision.CanHit(new Vector2(Projectile.position.X + (float)(Projectile.width / 2), Projectile.position.Y + (float)(Projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) { num142 = num147; num140 = num145; @@ -103,18 +103,18 @@ namespace CalamityMod.Projectiles.Ranged } if (flag4) { - projectile.ai[1] = (float)(num143 + 1); + Projectile.ai[1] = (float)(num143 + 1); } flag4 = false; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) + int num148 = (int)(Projectile.ai[1] - 1f); + if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(Projectile, true) && !Main.npc[num148].dontTakeDamage) { float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); + float num151 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num149) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num150); if (num151 < 1000f) { flag4 = true; @@ -124,17 +124,17 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; } } - if (!projectile.friendly) + if (!Projectile.friendly) { flag4 = false; } if (flag4) { float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector13 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num153 = num140 - vector13.X; float num154 = num141 - vector13.Y; float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); @@ -142,8 +142,8 @@ namespace CalamityMod.Projectiles.Ranged num153 *= num155; num154 *= num155; int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; + Projectile.velocity.X = (Projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; + Projectile.velocity.Y = (Projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; } } diff --git a/Projectiles/Ranged/NapalmArrowProj.cs b/Projectiles/Ranged/NapalmArrowProj.cs index cb30a5d787..f32e5c053d 100644 --- a/Projectiles/Ranged/NapalmArrowProj.cs +++ b/Projectiles/Ranged/NapalmArrowProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class NapalmArrowProj : ModProjectile @@ -16,33 +17,33 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.aiStyle = 1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.aiStyle = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, DustID.Fire, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Fire, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 32); - Main.PlaySound(SoundID.Item14, projectile.position); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 32); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int j = 0; j < 5; j++) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -52,19 +53,19 @@ namespace CalamityMod.Projectiles.Ranged } for (int k = 0; k < 10; k++) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); - if (projectile.owner == Main.myPlayer) + CalamityUtils.ExplosionGores(Projectile.Center, 3); + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 3; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f, 0.1f); - int flames = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, projectile.owner); + int flames = Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 0f, Projectile.owner); if (flames.WithinBounds(Main.maxProjectiles)) { Main.projectile[flames].Calamity().forceRanged = true; diff --git a/Projectiles/Ranged/NeedlerProj.cs b/Projectiles/Ranged/NeedlerProj.cs index 528667fe58..e6f32db922 100644 --- a/Projectiles/Ranged/NeedlerProj.cs +++ b/Projectiles/Ranged/NeedlerProj.cs @@ -13,34 +13,34 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.ranged = true; - projectile.extraUpdates = 2; - projectile.aiStyle = 93; + Projectile.width = 10; + Projectile.height = 10; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 2; + Projectile.aiStyle = 93; aiType = ProjectileID.NailFriendly; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 1; } public override void AI() { - projectile.alpha -= 10; - if (projectile.alpha < 0) + Projectile.alpha -= 10; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 4f) { for (int num468 = 0; num468 < 2; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, default, 0.75f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 46, 0f, 0f, 100, default, 0.75f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -49,13 +49,13 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 48; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 48; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -65,10 +65,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Ranged/NorfleetCannon.cs b/Projectiles/Ranged/NorfleetCannon.cs index dee6a914f1..0ae39cd008 100644 --- a/Projectiles/Ranged/NorfleetCannon.cs +++ b/Projectiles/Ranged/NorfleetCannon.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -17,39 +18,39 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 140; - projectile.height = 42; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 140; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.ai[1]--; - if (projectile.ai[0] >= 0f) + Player player = Main.player[Projectile.owner]; + Projectile.ai[1]--; + if (Projectile.ai[0] >= 0f) { - projectile.ai[0] += 1f; - switch ((int)projectile.ai[0]) + Projectile.ai[0] += 1f; + switch ((int)Projectile.ai[0]) { case 90: case 180: case 270: case 360: case 450: - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; break; case 540: - projectile.localAI[0] += 1f; - projectile.ai[0] = -1f; - Main.PlaySound(SoundID.Item14, projectile.Center); + Projectile.localAI[0] += 1f; + Projectile.ai[0] = -1f; + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { - Vector2 source = Vector2.Normalize(projectile.velocity) * 9f; + Vector2 source = Vector2.Normalize(Projectile.velocity) * 9f; source = source.RotatedBy((d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt, default) + player.Center; Vector2 dustVel = source - player.Center; int index = Dust.NewDust(source + dustVel, 0, 0, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 0, default, 4f); @@ -62,19 +63,19 @@ namespace CalamityMod.Projectiles.Ranged int baseUseTime = 75; //Ranges from 75 to 63 use time int modifier = 2; bool timeToFire = false; - if (projectile.ai[1] <= 0f) + if (Projectile.ai[1] <= 0f) { - projectile.ai[1] = baseUseTime - modifier * projectile.localAI[0]; + Projectile.ai[1] = baseUseTime - modifier * Projectile.localAI[0]; timeToFire = true; } bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; - if (projectile.soundDelay <= 0 && canFire) + if (Projectile.soundDelay <= 0 && canFire) { - projectile.soundDelay = baseUseTime - modifier * (int)projectile.localAI[0]; - if (projectile.ai[0] != 1f) - Main.PlaySound(SoundID.Item92, projectile.Center); + Projectile.soundDelay = baseUseTime - modifier * (int)Projectile.localAI[0]; + if (Projectile.ai[0] != 1f) + SoundEngine.PlaySound(SoundID.Item92, Projectile.Center); } - if (timeToFire && Main.myPlayer == projectile.owner) + if (timeToFire && Main.myPlayer == Projectile.owner) { if (canFire) { @@ -87,42 +88,42 @@ namespace CalamityMod.Projectiles.Ranged player.PickAmmo(player.ActiveItem(), ref type, ref shootSpeed, 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; - projectile.velocity.Y += Main.mouseY; + Projectile.velocity = Main.screenPosition - playerPosition; + Projectile.velocity.X += Main.mouseX; + Projectile.velocity.Y += Main.mouseY; if (player.gravDir == -1f) - projectile.velocity.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - playerPosition.Y; - projectile.velocity.Normalize(); - float variation = (1f + projectile.localAI[0]) * 3f; + Projectile.velocity.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - playerPosition.Y; + Projectile.velocity.Normalize(); + float variation = (1f + Projectile.localAI[0]) * 3f; Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); - Vector2 speed = projectile.velocity * shootSpeed * Main.rand.NextFloat(0.6f, 1.2f); + Vector2 speed = Projectile.velocity * shootSpeed * Main.rand.NextFloat(0.6f, 1.2f); type = ModContent.ProjectileType(); speed.X += Main.rand.NextFloat(-1.5f, 1.5f); speed.Y += Main.rand.NextFloat(-1.5f, 1.5f); - Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner); + Projectile.NewProjectile(position, speed, type, damage, knockBack, Projectile.owner); speed.X += Main.rand.NextFloat(-1.5f, 1.5f); speed.Y += Main.rand.NextFloat(-1.5f, 1.5f); - Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner); - projectile.netUpdate = true; + Projectile.NewProjectile(position, speed, type, damage, knockBack, Projectile.owner); + Projectile.netUpdate = true; } } else { - projectile.Kill(); + Projectile.Kill(); } } - projectile.rotation = projectile.velocity.ToRotation(); - Vector2 displayOffset = new Vector2(0f, -10f * projectile.direction).RotatedBy(projectile.rotation); - projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; - if (projectile.spriteDirection == -1) - projectile.rotation += MathHelper.Pi; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.rotation = Projectile.velocity.ToRotation(); + Vector2 displayOffset = new Vector2(0f, -10f * Projectile.direction).RotatedBy(Projectile.rotation); + Projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; + if (Projectile.spriteDirection == -1) + Projectile.rotation += MathHelper.Pi; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); + player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * Projectile.direction, Projectile.velocity.X * Projectile.direction); } public override bool CanDamage() => false; diff --git a/Projectiles/Ranged/NorfleetComet.cs b/Projectiles/Ranged/NorfleetComet.cs index 09eac424c1..9cfe9e27e9 100644 --- a/Projectiles/Ranged/NorfleetComet.cs +++ b/Projectiles/Ranged/NorfleetComet.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -16,21 +17,21 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Comet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ignoreWater = true; + Projectile.width = 34; + Projectile.height = 34; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.ignoreWater = true; } public override void AI() @@ -39,80 +40,80 @@ namespace CalamityMod.Projectiles.Ranged noTileHitCounter -= randomToSubtract; if (noTileHitCounter == 0) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 18f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 18f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { - Vector2 dustOffset = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 dustOffset = Vector2.UnitX * (float)-(float)Projectile.width / 2f; dustOffset += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); - dustOffset = dustOffset.RotatedBy((double)(projectile.rotation - MathHelper.PiOver2), default); - int idx = Dust.NewDust(projectile.Center, 0, 0, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 160, default, 1f); + dustOffset = dustOffset.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default); + int idx = Dust.NewDust(Projectile.Center, 0, 0, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 160, default, 1f); Main.dust[idx].scale = 1.1f; Main.dust[idx].noGravity = true; - Main.dust[idx].position = projectile.Center + dustOffset; - Main.dust[idx].velocity = projectile.velocity * 0.1f; - Main.dust[idx].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[idx].position) * 1.25f; + Main.dust[idx].position = Projectile.Center + dustOffset; + Main.dust[idx].velocity = Projectile.velocity * 0.1f; + Main.dust[idx].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[idx].position) * 1.25f; } } - projectile.alpha -= 15; + Projectile.alpha -= 15; int alphaLimit = 150; - if (projectile.alpha < alphaLimit) + if (Projectile.alpha < alphaLimit) { - projectile.alpha = alphaLimit; + Projectile.alpha = alphaLimit; } - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Main.rand.NextBool(16)) { - Vector2 dustOffset = Vector2.UnitX.RotatedByRandom(Math.PI * 0.5).RotatedBy((double)projectile.velocity.ToRotation(), default); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Vector2 dustOffset = Vector2.UnitX.RotatedByRandom(Math.PI * 0.5).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(2) ? 221 : 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); Main.dust[idx].velocity = dustOffset * 0.66f; - Main.dust[idx].position = projectile.Center + dustOffset * 12f; + Main.dust[idx].position = Projectile.Center + dustOffset * 12f; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.light = 0.5f; + Projectile.light = 0.5f; if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(2) ? 221 : 244, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } } } public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, 100, 255, projectile.alpha); + return new Color(Main.DiscoR, 100, 255, Projectile.alpha); } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), projectile.knockBack * 0.1f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), Projectile.knockBack * 0.1f, Projectile.owner); } - Main.PlaySound(SoundID.Item10, projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 144); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 144); for (int d = 0; d < 4; d++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 50, default, 1.5f); } for (int d = 0; d < 20; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 0, default, 2.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 0, default, 2.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 50, default, 1.5f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 50, default, 1.5f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } @@ -120,9 +121,9 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft >= 600) + if (Projectile.timeLeft >= 600) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/NorfleetExplosion.cs b/Projectiles/Ranged/NorfleetExplosion.cs index cadda74cf8..e0e0213523 100644 --- a/Projectiles/Ranged/NorfleetExplosion.cs +++ b/Projectiles/Ranged/NorfleetExplosion.cs @@ -14,27 +14,27 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 500; - projectile.height = 500; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.ranged = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 500; + Projectile.height = 500; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 30; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.01f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); Vector2 dustVel = CalamityUtils.RandomVelocity(120f, 36f, 108f, 1f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[idx]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += Main.rand.NextFloat(-10f, 10f); dust.position.Y += Main.rand.NextFloat(-10f, 10f); dust.velocity = dustVel; diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs index 8cc0042cb4..e7eac11e5d 100644 --- a/Projectiles/Ranged/Nuke.cs +++ b/Projectiles/Ranged/Nuke.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class Nuke : ModProjectile @@ -16,20 +17,20 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Nuke"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 125; - projectile.ranged = true; + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 125; + Projectile.DamageType = DamageClass.Ranged; } private static void DefineFalseLauncher() @@ -42,40 +43,40 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 7) + Projectile.frameCounter++; + if (Projectile.frameCounter > 7) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 2) + if (Projectile.frame > 2) { - projectile.frame = 0; + Projectile.frame = 0; } //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; flarePowderTimer--; if (flarePowderTimer <= 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); } flarePowderTimer = 12; } - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { - float num247 = projectile.velocity.X * 0.5f; - float num248 = projectile.velocity.Y * 0.5f; - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default, 1f); + float num247 = Projectile.velocity.X * 0.5f; + float num248 = Projectile.velocity.Y * 0.5f; + int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 1f); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); + num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; @@ -84,16 +85,16 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 192); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.position); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 192); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 40; i++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -103,18 +104,18 @@ namespace CalamityMod.Projectiles.Ranged } for (int i = 0; i < 60; i++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[idx].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 10); + CalamityUtils.ExplosionGores(Projectile.Center, 10); // Construct a fake item to use with vanilla code for the sake of picking ammo. if (FalseLauncher is null) DefineFalseLauncher(); - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int projID = ProjectileID.RocketI; float shootSpeed = 0f; bool canShoot = true; @@ -127,17 +128,17 @@ namespace CalamityMod.Projectiles.Ranged else if (projID == ProjectileID.RocketIV) blastRadius = 12; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 22); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 22); - if (projectile.owner == Main.myPlayer && blastRadius > 0) + if (Projectile.owner == Main.myPlayer && blastRadius > 0) { - CalamityUtils.ExplodeandDestroyTiles(projectile, blastRadius, true, new List() { }, new List() { }); + CalamityUtils.ExplodeandDestroyTiles(Projectile, blastRadius, true, new List() { }, new List() { }); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/NullShot.cs b/Projectiles/Ranged/NullShot.cs index c23190374d..ce26318011 100644 --- a/Projectiles/Ranged/NullShot.cs +++ b/Projectiles/Ranged/NullShot.cs @@ -16,26 +16,26 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.ranged = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Ranged; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 3f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 3f) { for (int num134 = 0; num134 < 10; num134++) { - float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; - float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; + float x = Projectile.position.X - Projectile.velocity.X / 10f * (float)num134; + float y = Projectile.position.Y - Projectile.velocity.Y / 10f * (float)num134; int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 160, 0f, 0f, 0, default, 2f); - Main.dust[num135].alpha = projectile.alpha; + Main.dust[num135].alpha = Projectile.alpha; Main.dust[num135].position.X = x; Main.dust[num135].position.Y = y; Main.dust[num135].velocity *= 0f; diff --git a/Projectiles/Ranged/NullShot2.cs b/Projectiles/Ranged/NullShot2.cs index d59f6a7f45..9fa4d8b3df 100644 --- a/Projectiles/Ranged/NullShot2.cs +++ b/Projectiles/Ranged/NullShot2.cs @@ -16,27 +16,27 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 3f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 3f) { for (int num134 = 0; num134 < 10; num134++) { - float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; - float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; + float x = Projectile.position.X - Projectile.velocity.X / 10f * (float)num134; + float y = Projectile.position.Y - Projectile.velocity.Y / 10f * (float)num134; int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num135].alpha = projectile.alpha; + Main.dust[num135].alpha = Projectile.alpha; Main.dust[num135].position.X = x; Main.dust[num135].position.Y = y; Main.dust[num135].velocity *= 0f; diff --git a/Projectiles/Ranged/OnyxSharkBomb.cs b/Projectiles/Ranged/OnyxSharkBomb.cs index f96a4328ab..6ecc4a2adc 100644 --- a/Projectiles/Ranged/OnyxSharkBomb.cs +++ b/Projectiles/Ranged/OnyxSharkBomb.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -12,24 +13,24 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Shark"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.ranged = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { for (int num246 = 0; num246 < 2; num246++) { @@ -37,14 +38,14 @@ namespace CalamityMod.Projectiles.Ranged float num248 = 0f; if (num246 == 1) { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; + num247 = Projectile.velocity.X * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 109, 0f, 0f, 100, default, 0.5f); + int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 109, 0f, 0f, 100, default, 0.5f); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 159, 0f, 0f, 100, default, 0.25f); + num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 159, 0f, 0f, 100, default, 0.25f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } @@ -53,40 +54,40 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 32; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 109, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 109, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; for (i = 0; i < 2; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Ranged/OpalStrike.cs b/Projectiles/Ranged/OpalStrike.cs index 1dd3534689..84c536bbcc 100644 --- a/Projectiles/Ranged/OpalStrike.cs +++ b/Projectiles/Ranged/OpalStrike.cs @@ -10,35 +10,35 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Strike"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 20; - projectile.friendly = true; - projectile.scale = 0.5f; - projectile.alpha = 200; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.scale = 0.5f; + Projectile.alpha = 200; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - if (projectile.scale <= 1.5f) - projectile.scale *= 1.01f; - projectile.alpha -= 2; - if (projectile.alpha == 0) - projectile.alpha = 200; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.scale <= 1.5f) + Projectile.scale *= 1.01f; + Projectile.alpha -= 2; + if (Projectile.alpha == 0) + Projectile.alpha = 200; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/OrangeExoArrow.cs b/Projectiles/Ranged/OrangeExoArrow.cs index 77407f29f5..fef0ac30e1 100644 --- a/Projectiles/Ranged/OrangeExoArrow.cs +++ b/Projectiles/Ranged/OrangeExoArrow.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -17,51 +18,51 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.arrow = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } float num55 = 40f; float num56 = 1.5f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); } } } - public override Color? GetAlpha(Color lightColor) => new Color(250, 100, 0, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(250, 100, 0, Projectile.alpha); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(40f, 1.5f, lightColor); public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs(); @@ -69,24 +70,24 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 188); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 188); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int d = 0; d < 4; d++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 50, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 50, default, 1f); } for (int d = 0; d < 40; d++) { - int orange = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 0, default, 1.5f); + int orange = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 0, default, 1.5f); Main.dust[orange].noGravity = true; Main.dust[orange].noLight = true; Main.dust[orange].velocity *= 3f; - orange = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 50, default, 1f); + orange = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 50, default, 1f); Main.dust[orange].velocity *= 2f; Main.dust[orange].noGravity = true; Main.dust[orange].noLight = true; diff --git a/Projectiles/Ranged/PhangasmBow.cs b/Projectiles/Ranged/PhangasmBow.cs index 96845ba68d..a817f6d081 100644 --- a/Projectiles/Ranged/PhangasmBow.cs +++ b/Projectiles/Ranged/PhangasmBow.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -17,65 +18,65 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 40; - projectile.height = 82; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 40; + Projectile.height = 82; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.7f, 0.5f); - Player player = Main.player[projectile.owner]; + Lighting.AddLight(Projectile.Center, 0f, 0.7f, 0.5f); + Player player = Main.player[Projectile.owner]; float num = 0f; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { num = MathHelper.Pi; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num39 = 0; - if (projectile.ai[0] >= 90f) + if (Projectile.ai[0] >= 90f) { num39++; } - if (projectile.ai[0] >= 180f) + if (Projectile.ai[0] >= 180f) { num39++; } - if (projectile.ai[0] >= 270f) + if (Projectile.ai[0] >= 270f) { num39++; } int num40 = 24; int num41 = 2; - projectile.ai[1] -= 1f; + Projectile.ai[1] -= 1f; bool flag15 = false; - if (projectile.ai[1] <= 0f) + if (Projectile.ai[1] <= 0f) { - projectile.ai[1] = (float)(num40 - num41 * num39); + Projectile.ai[1] = (float)(num40 - num41 * num39); flag15 = true; - int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); + int arg_1EF4_0 = (int)Projectile.ai[0] / (num40 - num41 * num39); } bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; - if (projectile.localAI[0] > 0f) + if (Projectile.localAI[0] > 0f) { - projectile.localAI[0] -= 1f; + Projectile.localAI[0] -= 1f; } - if (projectile.soundDelay <= 0 && flag16) + if (Projectile.soundDelay <= 0 && flag16) { - projectile.soundDelay = num40 - num41 * num39; - if (projectile.ai[0] != 1f) + Projectile.soundDelay = num40 - num41 * num39; + if (Projectile.ai[0] != 1f) { - Main.PlaySound(SoundID.Item5, projectile.position); + SoundEngine.PlaySound(SoundID.Item5, Projectile.position); } - projectile.localAI[0] = 12f; + Projectile.localAI[0] = 12f; } player.phantasmTime = 2; - if (flag15 && Main.myPlayer == projectile.owner) + if (flag15 && Main.myPlayer == Projectile.owner) { int num42 = ProjectileID.WoodenArrowFriendly; float scaleFactor11 = 14f; @@ -85,7 +86,7 @@ namespace CalamityMod.Projectiles.Ranged { 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; + 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) @@ -98,37 +99,37 @@ namespace CalamityMod.Projectiles.Ranged value19 = -Vector2.UnitY; } value19 *= scaleFactor12; - if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) + if (value19.X != Projectile.velocity.X || value19.Y != Projectile.velocity.Y) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity = value19 * 0.55f; + Projectile.velocity = value19 * 0.55f; for (int num43 = 0; num43 < 5; num43++) { - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + Vector2 vector20 = Vector2.Normalize(Projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) { vector20 = -Vector2.UnitY; } Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); - int num44 = Projectile.NewProjectile(vector21, vector20, num42, weaponDamage2, weaponKnockback2, projectile.owner); + int num44 = Projectile.NewProjectile(vector21, vector20, num42, weaponDamage2, weaponKnockback2, Projectile.owner); Main.projectile[num44].noDropItem = true; } } else { - projectile.Kill(); + Projectile.Kill(); } } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); } public override bool CanDamage() => false; diff --git a/Projectiles/Ranged/PiercingBullet.cs b/Projectiles/Ranged/PiercingBullet.cs index 9f6f1bd7ff..fed6e13d97 100644 --- a/Projectiles/Ranged/PiercingBullet.cs +++ b/Projectiles/Ranged/PiercingBullet.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class PiercingBullet : ModProjectile @@ -17,20 +18,20 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 10; - projectile.scale = 1.18f; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.extraUpdates = 10; + Projectile.scale = 1.18f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) @@ -43,15 +44,15 @@ namespace CalamityMod.Projectiles.Ranged damage = (int)(damage * (1 / (1 - target.Calamity().DR))); //Then proceed to ignore all defense - int penetratableDefense = Math.Max(target.defense - Main.player[projectile.owner].armorPenetration, 0); + int penetratableDefense = Math.Max(target.defense - Main.player[Projectile.owner].armorPenetration, 0); int penetratedDefense = Math.Min(penetratableDefense, target.defense); damage += (int)(0.5f * penetratedDefense); } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } @@ -74,9 +75,9 @@ namespace CalamityMod.Projectiles.Ranged int bulletCount = 10; for (int x = 0; x < bulletCount; x++) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, x < bulletCount / 2, 500f, 500f, 0f, 500f, 12f, ModContent.ProjectileType(), (int)(projectile.damage * 0.2), projectile.knockBack, projectile.owner); + CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, x < bulletCount / 2, 500f, 500f, 0f, 500f, 12f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.2), Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Ranged/PlagueArrow.cs b/Projectiles/Ranged/PlagueArrow.cs index b3384f72d6..c815294d16 100644 --- a/Projectiles/Ranged/PlagueArrow.cs +++ b/Projectiles/Ranged/PlagueArrow.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,45 +12,45 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Arrow"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.timeLeft = 600; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 1; + Projectile.timeLeft = 600; aiType = ProjectileID.WoodenArrowFriendly; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - if (projectile.owner == Main.myPlayer) + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); int num516 = 6; for (int num517 = 0; num517 < num516; num517++) { if (num517 % 2 != 1 || Main.rand.NextBool(3)) { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; + Vector2 value20 = Projectile.position; + Vector2 value21 = Projectile.oldVelocity; value21.Normalize(); value21 *= 8f; float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; value20 -= value21 * (float)num517; - num518 += projectile.oldVelocity.X / 6f; - num519 += projectile.oldVelocity.Y / 6f; - int bee = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 2), Main.player[projectile.owner].beeKB(0f), Main.myPlayer); + num518 += Projectile.oldVelocity.X / 6f; + num519 += Projectile.oldVelocity.Y / 6f; + int bee = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 2), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer); if (bee.WithinBounds(Main.maxProjectiles)) { Main.projectile[bee].penetrate = 2; @@ -62,7 +63,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/PlagueExplosionFriendly.cs b/Projectiles/Ranged/PlagueExplosionFriendly.cs index aad7897bfe..e49e26175f 100644 --- a/Projectiles/Ranged/PlagueExplosionFriendly.cs +++ b/Projectiles/Ranged/PlagueExplosionFriendly.cs @@ -16,53 +16,53 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 60; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.05f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.01f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -73,11 +73,11 @@ namespace CalamityMod.Projectiles.Ranged num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 0.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 0.5f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Ranged/PlanarRipperBolt.cs b/Projectiles/Ranged/PlanarRipperBolt.cs index 68328b1717..4881aacb18 100644 --- a/Projectiles/Ranged/PlanarRipperBolt.cs +++ b/Projectiles/Ranged/PlanarRipperBolt.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -17,47 +18,47 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.extraUpdates = 10; - projectile.timeLeft = 600; - projectile.ranged = true; - projectile.aiStyle = 1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.extraUpdates = 10; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Ranged; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); + CalamityPlayer modPlayer = Main.player[Projectile.owner].Calamity(); target.AddBuff(BuffID.Electrified, 180); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { if (target.life <= 0) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } if (crit) { @@ -71,13 +72,13 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitPvp(Player target, int damage, bool crit) { - CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); + CalamityPlayer modPlayer = Main.player[Projectile.owner].Calamity(); target.AddBuff(BuffID.Electrified, 180); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { if (target.statLife <= 0) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } if (crit) { @@ -91,34 +92,34 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 10; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.damage = (int)(projectile.damage * 0.6f); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 10; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.damage = (int)(Projectile.damage * 0.6f); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, (Main.rand.NextBool(2) ? 93 : 92), 0.5f, 0f); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, (Main.rand.NextBool(2) ? 93 : 92), 0.5f, 0f); for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(projectile.Center, 1, 1, 132, projectile.velocity.X, projectile.velocity.Y, 0, default, 0.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 132, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 0.5f); Main.dust[dust].noGravity = true; } int num212 = Main.rand.Next(10, 20); for (int num213 = 0; num213 < num212; num213++) { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + int num214 = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); Main.dust[num214].velocity *= 2f; Main.dust[num214].noGravity = true; } diff --git a/Projectiles/Ranged/PlanarRipperExplosion.cs b/Projectiles/Ranged/PlanarRipperExplosion.cs index 1cf889b655..7a2abad3dd 100644 --- a/Projectiles/Ranged/PlanarRipperExplosion.cs +++ b/Projectiles/Ranged/PlanarRipperExplosion.cs @@ -16,33 +16,33 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 30; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.15f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.01f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.15f / 255f); float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -53,11 +53,11 @@ namespace CalamityMod.Projectiles.Ranged num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 132, 0f, 0f, 100, default, 0.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 132, 0f, 0f, 100, default, 0.5f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Ranged public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.damage = (int)(projectile.damage * 0.75); + Projectile.damage = (int)(Projectile.damage * 0.75); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs index 8986ddda26..ca03a746f3 100644 --- a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs +++ b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -18,19 +19,19 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.arrow = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 600; + Projectile.arrow = true; } public override void AI() { - switch ((int)projectile.ai[1]) + switch ((int)Projectile.ai[1]) { case 0: dustType = 15; @@ -54,11 +55,11 @@ namespace CalamityMod.Projectiles.Ranged dustType = 57; break; } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2.2f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2.2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } public override void Kill(int timeLeft) @@ -67,30 +68,30 @@ namespace CalamityMod.Projectiles.Ranged float num50 = 2.1f; float num51 = 1.1f; float num52 = 2.5f; - Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); + Vector2 value3 = (Projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); int num3; for (int num53 = 0; num53 < 20; num53 = num3 + 1) { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 200, default, num50); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 200, default, num50); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 3f; dust = Main.dust[num54]; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, num51); + Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; Main.dust[num54].noGravity = true; @@ -101,8 +102,8 @@ namespace CalamityMod.Projectiles.Ranged } for (int num55 = 0; num55 < 10; num55 = num3 + 1) { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, num52); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; dust.velocity *= 0.5f; diff --git a/Projectiles/Ranged/PlasmaBlast.cs b/Projectiles/Ranged/PlasmaBlast.cs index 9a869cb061..1e51472a86 100644 --- a/Projectiles/Ranged/PlasmaBlast.cs +++ b/Projectiles/Ranged/PlasmaBlast.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,106 +12,106 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.alpha = 150; - projectile.friendly = true; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ignoreWater = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.alpha = 150; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.ignoreWater = true; } public override void AI() { - if (projectile.Center.Y > projectile.ai[1]) + if (Projectile.Center.Y > Projectile.ai[1]) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); - Main.PlaySound(SoundID.Item9, projectile.position); + Projectile.soundDelay = 20 + Main.rand.Next(40); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 12f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 12f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 221, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } - projectile.alpha -= 15; + Projectile.alpha -= 15; int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) + if (Projectile.Center.Y >= Projectile.ai[1]) { num58 = 0; } - if (projectile.alpha < num58) + if (Projectile.alpha < num58) { - projectile.alpha = num58; + Projectile.alpha = num58; } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 221, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 221, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; + Main.dust[num59].position = Projectile.Center + value3 * 12f; } if (Main.rand.NextBool(48)) { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + int num60 = Gore.NewGore(Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; + Main.gore[num60].velocity += Projectile.velocity * 0.3f; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.light = 0.9f; + Projectile.light = 0.9f; if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 221, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 221, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20)) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.1f / 255f, (255 - projectile.alpha) * 0.7f / 255f, (255 - projectile.alpha) * 0.15f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.1f / 255f, (255 - Projectile.alpha) * 0.7f / 255f, (255 - Projectile.alpha) * 0.15f / 255f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 221, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 221, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/PlasmaExplosion.cs b/Projectiles/Ranged/PlasmaExplosion.cs index 23e50e2a8f..a56e7c65aa 100644 --- a/Projectiles/Ranged/PlasmaExplosion.cs +++ b/Projectiles/Ranged/PlasmaExplosion.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class PlasmaExplosion : ModProjectile @@ -16,60 +17,60 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 400; - projectile.height = 400; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + Projectile.width = 400; + Projectile.height = 400; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 1f / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 1f / 255f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item93, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item93, Projectile.position); + Projectile.localAI[0] += 1f; } bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -80,12 +81,12 @@ namespace CalamityMod.Projectiles.Ranged num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, - projectile.ai[1] == 1f ? 173 : 221, 0f, 0f, 100, default, 2f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, + Projectile.ai[1] == 1f ? 173 : 221, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Ranged/PolarStar.cs b/Projectiles/Ranged/PolarStar.cs index 862e4a7419..4a81402abe 100644 --- a/Projectiles/Ranged/PolarStar.cs +++ b/Projectiles/Ranged/PolarStar.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -22,27 +23,27 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; - projectile.ranged = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; } public override void AI() { //Looking pretty at boost two or three - if (projectile.ai[1] == 2f || projectile.ai[1] == 1f) + if (Projectile.ai[1] == 2f || Projectile.ai[1] == 1f) { Vector2 value7 = new Vector2(5f, 10f); - Lighting.AddLight(projectile.Center, 0.25f, 0f, 0.25f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) + Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0.25f); + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 48f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } else { @@ -50,90 +51,90 @@ namespace CalamityMod.Projectiles.Ranged { int dustType = d == 0 ? dust1 : dust2; Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)d * MathHelper.Pi), default) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); + value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)d * MathHelper.Pi), default) * value7; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = dustType == dust1 ? 1.5f : 1f; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; - int num458 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f); + Main.dust[num42].position = Projectile.Center + value8; + Main.dust[num42].velocity = Projectile.velocity; + int num458 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 0.8f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0f; } } } - if (projectile.ai[1] == 2f) //Boost three + if (Projectile.ai[1] == 2f) //Boost three { - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } - else if (projectile.ai[1] == 1f) //Boost two + else if (Projectile.ai[1] == 1f) //Boost two { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } float num55 = 30f; float num56 = 1f; - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); } } } else //No boosts { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } float num55 = 40f; float num56 = 1.5f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); } } } } - public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, Projectile.alpha); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(40f, 1.5f, lightColor); public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; - if ((target.damage > 5 || target.boss) && projectile.owner == Main.myPlayer && !target.SpawnedFromStatue) + Player player = Main.player[Projectile.owner]; + if ((target.damage > 5 || target.boss) && Projectile.owner == Main.myPlayer && !target.SpawnedFromStatue) { player.AddBuff(ModContent.BuffType(), 180); } @@ -141,42 +142,42 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); return true; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 62, 0.5f); - if (projectile.ai[1] == 1f) //Boost two + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 62, 0.5f); + if (Projectile.ai[1] == 1f) //Boost two { int projectiles = Main.rand.Next(2, 5); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int k = 0; k < projectiles; k++) { - int split = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, (float)Main.rand.Next(-10, 11) * 2f, (float)Main.rand.Next(-10, 11) * 2f, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.85), (float)(int)((double)projectile.knockBack * 0.5), Main.myPlayer, 0f, 0f); + int split = Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, (float)Main.rand.Next(-10, 11) * 2f, (float)Main.rand.Next(-10, 11) * 2f, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.85), (float)(int)((double)Projectile.knockBack * 0.5), Main.myPlayer, 0f, 0f); } } } - if (projectile.ai[1] == 2f) //Boost three + if (Projectile.ai[1] == 2f) //Boost three { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 150); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 150); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); int dustAmt = 36; for (int d = 0; d < dustAmt; d++) // 108 dusts { - Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.3f; - source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 dustVel = source - projectile.Center; + Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.3f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 dustVel = source - Projectile.Center; int i = Dust.NewDust(source + dustVel, 0, 0, Main.rand.NextBool(2) ? dust1 : dust2, dustVel.X * 0.3f, dustVel.Y * 0.3f, 100, default, 2f); Main.dust[i].noGravity = true; @@ -194,7 +195,7 @@ namespace CalamityMod.Projectiles.Ranged { random = !random; Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f); - Dust d = Dust.NewDustPerfect(projectile.Center, random ? dust1 : dust2, velocity); + Dust d = Dust.NewDustPerfect(Projectile.Center, random ? dust1 : dust2, velocity); d.noGravity = true; d.customData = 0.025f; d.scale = 2f; diff --git a/Projectiles/Ranged/PrecisionBolt.cs b/Projectiles/Ranged/PrecisionBolt.cs index fa5685d6d1..60d6fc51ce 100644 --- a/Projectiles/Ranged/PrecisionBolt.cs +++ b/Projectiles/Ranged/PrecisionBolt.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -16,15 +17,15 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 72; - projectile.height = 72; - projectile.friendly = true; - projectile.timeLeft = 119; - projectile.penetrate = 1; - projectile.MaxUpdates = 2; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; + Projectile.width = 72; + Projectile.height = 72; + Projectile.friendly = true; + Projectile.timeLeft = 119; + Projectile.penetrate = 1; + Projectile.MaxUpdates = 2; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; } public override string Texture => "CalamityMod/Projectiles/Ranged/PrecisionBolt"; @@ -35,15 +36,15 @@ namespace CalamityMod.Projectiles.Ranged // Choose the angular turn speed of the bolt on recalibration. // This will overshoot significantly at first but will regress to finer movements as time goes on. // The exponent in the equation below serves to dampen the turn speed more quickly. It will not hit targets otherwise. - float turnSpeedFactor = (float)Math.Pow(MathHelper.Clamp(projectile.timeLeft - 40, 0f, 120f) / 120f, 4D); + float turnSpeedFactor = (float)Math.Pow(MathHelper.Clamp(Projectile.timeLeft - 40, 0f, 120f) / 120f, 4D); float turnAngle = MathHelper.ToRadians(turnSpeedFactor * 75f); // Select the velocity which has less of a disparity in terms of angular distance compared to the ideal direction. - Vector2 leftTurnVelocity = projectile.velocity.RotatedBy(-turnAngle); - Vector2 righTurnVelocity = projectile.velocity.RotatedBy(turnAngle); - float leftDirectionImprecision = leftTurnVelocity.AngleBetween(projectile.SafeDirectionTo(potentialTarget.Center)); - float rightDirectionImprecision = righTurnVelocity.AngleBetween(projectile.SafeDirectionTo(potentialTarget.Center)); - potentialTarget = projectile.Center.ClosestNPCAt(512f, true); + Vector2 leftTurnVelocity = Projectile.velocity.RotatedBy(-turnAngle); + Vector2 righTurnVelocity = Projectile.velocity.RotatedBy(turnAngle); + float leftDirectionImprecision = leftTurnVelocity.AngleBetween(Projectile.SafeDirectionTo(potentialTarget.Center)); + float rightDirectionImprecision = righTurnVelocity.AngleBetween(Projectile.SafeDirectionTo(potentialTarget.Center)); + potentialTarget = Projectile.Center.ClosestNPCAt(512f, true); if (leftDirectionImprecision < rightDirectionImprecision) return leftTurnVelocity; @@ -53,28 +54,28 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, Color.LightSteelBlue.ToVector3()); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, Color.LightSteelBlue.ToVector3()); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (potentialTarget == null) //(Re)target - potentialTarget = projectile.Center.ClosestNPCAt(512f, true); + potentialTarget = Projectile.Center.ClosestNPCAt(512f, true); if (potentialTarget != null) { //Do some funny slight homing just in case float angularTurnSpeed = MathHelper.ToRadians(2.5f); - float idealDirection = projectile.AngleTo(potentialTarget.Center); - float updatedDirection = projectile.velocity.ToRotation().AngleTowards(idealDirection, angularTurnSpeed); - projectile.velocity = updatedDirection.ToRotationVector2() * projectile.velocity.Length(); + float idealDirection = Projectile.AngleTo(potentialTarget.Center); + float updatedDirection = Projectile.velocity.ToRotation().AngleTowards(idealDirection, angularTurnSpeed); + Projectile.velocity = updatedDirection.ToRotationVector2() * Projectile.velocity.Length(); - if (projectile.timeLeft % 6 == 0) // Do the STRONG homing + if (Projectile.timeLeft % 6 == 0) // Do the STRONG homing { - Main.PlaySound(SoundID.Item93, projectile.Center); - projectile.velocity = Recalibrate(); + SoundEngine.PlaySound(SoundID.Item93, Projectile.Center); + Projectile.velocity = Recalibrate(); } } - Dust trail = Dust.NewDustPerfect(projectile.Center, 267); //Dust trail kinda poopy but idk how to make a cool trail :( + Dust trail = Dust.NewDustPerfect(Projectile.Center, 267); //Dust trail kinda poopy but idk how to make a cool trail :( trail.velocity = Vector2.Zero; trail.color = Color.Yellow; trail.scale = Main.rand.NextFloat(1f, 1.1f); @@ -87,11 +88,11 @@ namespace CalamityMod.Projectiles.Ranged // Release a burst of magic dust on death. if (Main.dedServ) return; - Main.PlaySound(SoundID.Item94, projectile.Center); + SoundEngine.PlaySound(SoundID.Item94, Projectile.Center); for (int i = 0; i < 10; i++) { - Dust zap = Dust.NewDustPerfect(projectile.Center, 267); - zap.velocity = projectile.velocity; + Dust zap = Dust.NewDustPerfect(Projectile.Center, 267); + zap.velocity = Projectile.velocity; zap.color = Color.Yellow; zap.scale = Main.rand.NextFloat(1f, 1.1f); zap.noGravity = true; diff --git a/Projectiles/Ranged/PrismComet.cs b/Projectiles/Ranged/PrismComet.cs index e6d35db890..9fabd6007e 100644 --- a/Projectiles/Ranged/PrismComet.cs +++ b/Projectiles/Ranged/PrismComet.cs @@ -3,57 +3,58 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class PrismComet : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Projectiles/Melee/Exocomet"; public override void SetStaticDefaults() { DisplayName.SetDefault("Comet"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.scale = 0.86f; - projectile.width = projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 50; + Projectile.scale = 0.86f; + Projectile.width = Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.alpha = 50; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.LightSeaGreen.ToVector3()); - projectile.frameCounter++; - if (projectile.frameCounter % 6 == 5) - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Lighting.AddLight(Projectile.Center, Color.LightSeaGreen.ToVector3()); + Projectile.frameCounter++; + if (Projectile.frameCounter % 6 == 5) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; - projectile.alpha = Utils.Clamp(projectile.alpha - 25, 30, 255); + Projectile.alpha = Utils.Clamp(Projectile.alpha - 25, 30, 255); - if (projectile.alpha < 40) + if (Projectile.alpha < 40) ReleaseIdleDust(); // Home onto any targets after a short amount of time. if (Time >= 25f) { - NPC potentialTarget = projectile.Center.ClosestNPCAt(1050f); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(1050f); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 12f + projectile.SafeDirectionTo(potentialTarget.Center) * 19f) / 13f; + Projectile.velocity = (Projectile.velocity * 12f + Projectile.SafeDirectionTo(potentialTarget.Center) * 19f) / 13f; } else - projectile.velocity *= 1.05f; + Projectile.velocity *= 1.05f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Time++; } @@ -62,41 +63,41 @@ namespace CalamityMod.Projectiles.Ranged if (Main.dedServ) return; - Dust prismEnergy = Dust.NewDustDirect(projectile.position - projectile.velocity * 4f, 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + Dust prismEnergy = Dust.NewDustDirect(Projectile.position - Projectile.velocity * 4f, 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); prismEnergy.velocity *= -0.25f; - prismEnergy.velocity -= projectile.velocity * 0.3f; + prismEnergy.velocity -= Projectile.velocity * 0.3f; - prismEnergy = Dust.NewDustDirect(projectile.position - projectile.velocity * 4f, 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + prismEnergy = Dust.NewDustDirect(Projectile.position - Projectile.velocity * 4f, 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); prismEnergy.velocity *= -0.25f; - prismEnergy.position -= projectile.velocity * 0.5f; - prismEnergy.velocity -= projectile.velocity * 0.3f; + prismEnergy.position -= Projectile.velocity * 0.5f; + prismEnergy.velocity -= Projectile.velocity * 0.3f; } public override bool CanDamage() => Time >= 20f; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } public override Color? GetAlpha(Color lightColor) { - Color color = Color.Honeydew * projectile.Opacity; + Color color = Color.Honeydew * Projectile.Opacity; color.A = 0; return color; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 103, 1f, 0f); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 80); - projectile.Damage(); + SoundEngine.PlaySound(SoundID.Zombie, (int)Projectile.position.X, (int)Projectile.position.Y, 103, 1f, 0f); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 80); + Projectile.Damage(); - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); } } } diff --git a/Projectiles/Ranged/PrismEnergyBullet.cs b/Projectiles/Ranged/PrismEnergyBullet.cs index bc97bfa811..a96606dc11 100644 --- a/Projectiles/Ranged/PrismEnergyBullet.cs +++ b/Projectiles/Ranged/PrismEnergyBullet.cs @@ -4,68 +4,69 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class PrismEnergyBullet : ModProjectile { - public ref float CurrentLaserLength => ref projectile.ai[0]; - public ref float Time => ref projectile.ai[1]; + public ref float CurrentLaserLength => ref Projectile.ai[0]; + public ref float Time => ref Projectile.ai[1]; public override string Texture => "CalamityMod/Projectiles/LaserProj"; public override void SetStaticDefaults() => DisplayName.SetDefault("Prism Rocket"); public override void SetDefaults() { - projectile.scale = 1.7f; - projectile.width = projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 13; - projectile.extraUpdates = 1; - projectile.ranged = true; + Projectile.scale = 1.7f; + Projectile.width = Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 13; + Projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Ranged; } public override void AI() { - if (projectile.timeLeft == 300) - Main.PlaySound(SoundID.Item14, projectile.Center); + if (Projectile.timeLeft == 300) + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - CurrentLaserLength = (int)MathHelper.Lerp(1f, 70f, Utils.InverseLerp(0f, 15f, Time, true) * Utils.InverseLerp(0f, 15f, projectile.timeLeft, true)); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + CurrentLaserLength = (int)MathHelper.Lerp(1f, 70f, Utils.InverseLerp(0f, 15f, Time, true) * Utils.InverseLerp(0f, 15f, Projectile.timeLeft, true)); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Time++; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; for (int i = 0; i < 3; i++) { - Vector2 shootVelocity = projectile.velocity.RotatedBy(MathHelper.Lerp(-0.3f, 0.3f, i / 2f)) * 0.4f; - Projectile.NewProjectile(projectile.Center, shootVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Vector2 shootVelocity = Projectile.velocity.RotatedBy(MathHelper.Lerp(-0.3f, 0.3f, i / 2f)) * 0.4f; + Projectile.NewProjectile(Projectile.Center, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; Vector2 origin = texture.Size() * 0.5f; - Vector2 currentDirection = projectile.velocity.SafeNormalize(Vector2.Zero); + Vector2 currentDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); for (int i = 0; i < CurrentLaserLength; i++) { - float scale = MathHelper.Lerp(1f, 0.2f, i / CurrentLaserLength) * projectile.scale; - Vector2 drawPosition = projectile.Center - currentDirection * i * 4f - Main.screenPosition; + float scale = MathHelper.Lerp(1f, 0.2f, i / CurrentLaserLength) * Projectile.scale; + Vector2 drawPosition = Projectile.Center - currentDirection * i * 4f - Main.screenPosition; Color drawColor = Color.Lerp(Color.Lime, Color.YellowGreen, (float)Math.Cos(i / CurrentLaserLength * 2.1f - Main.GlobalTime * 2.5f) * 0.5f + 0.5f); drawColor = Color.Lerp(drawColor, Color.Yellow, 0.55f); drawColor = Color.Lerp(drawColor, Color.White, (float)Math.Pow(i / CurrentLaserLength, 3D)); drawColor.A = 0; - spriteBatch.Draw(texture, drawPosition, null, drawColor, projectile.rotation, origin, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, drawPosition, null, drawColor, Projectile.rotation, origin, scale, SpriteEffects.None, 0f); } return false; } diff --git a/Projectiles/Ranged/PrismExplosionLarge.cs b/Projectiles/Ranged/PrismExplosionLarge.cs index 75d968045f..549458e7a4 100644 --- a/Projectiles/Ranged/PrismExplosionLarge.cs +++ b/Projectiles/Ranged/PrismExplosionLarge.cs @@ -11,47 +11,47 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = projectile.height = 520; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 150; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 11; - projectile.scale = 0.35f; + Projectile.width = Projectile.height = 520; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 150; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 11; + Projectile.scale = 0.35f; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.White.ToVector3() * 1.5f); - projectile.frameCounter++; - if (projectile.frameCounter % 8 == 7) - projectile.frame++; + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 1.5f); + Projectile.frameCounter++; + if (Projectile.frameCounter % 8 == 7) + Projectile.frame++; - if (projectile.frame >= 18) - projectile.Kill(); - projectile.scale *= 1.0115f; - projectile.Opacity = Utils.InverseLerp(5f, 36f, projectile.timeLeft, true); + if (Projectile.frame >= 18) + Projectile.Kill(); + Projectile.scale *= 1.0115f; + Projectile.Opacity = Utils.InverseLerp(5f, 36f, Projectile.timeLeft, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Texture2D lightTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/PhotovisceratorLight"); - Rectangle frame = texture.Frame(3, 6, projectile.frame / 6, projectile.frame % 6); - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/PhotovisceratorLight"); + Rectangle frame = texture.Frame(3, 6, Projectile.frame / 6, Projectile.frame % 6); + Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = frame.Size() * 0.5f; for (int i = 0; i < 36; i++) { - Vector2 lightDrawPosition = drawPosition + (MathHelper.TwoPi * i / 36f + Main.GlobalTime * 5f).ToRotationVector2() * projectile.scale * 20f; - Color lightBurstColor = CalamityUtils.MulticolorLerp(projectile.timeLeft / 144f, CalamityUtils.ExoPalette); - lightBurstColor = Color.Lerp(lightBurstColor, Color.White, 0.4f) * projectile.Opacity * 0.04f; + Vector2 lightDrawPosition = drawPosition + (MathHelper.TwoPi * i / 36f + Main.GlobalTime * 5f).ToRotationVector2() * Projectile.scale * 20f; + Color lightBurstColor = CalamityUtils.MulticolorLerp(Projectile.timeLeft / 144f, CalamityUtils.ExoPalette); + lightBurstColor = Color.Lerp(lightBurstColor, Color.White, 0.4f) * Projectile.Opacity * 0.04f; lightBurstColor.A = 0; - spriteBatch.Draw(lightTexture, lightDrawPosition, null, lightBurstColor, 0f, lightTexture.Size() * 0.5f, projectile.scale * 4.5f, SpriteEffects.None, 0f); + spriteBatch.Draw(lightTexture, lightDrawPosition, null, lightBurstColor, 0f, lightTexture.Size() * 0.5f, Projectile.scale * 4.5f, SpriteEffects.None, 0f); } spriteBatch.Draw(texture, drawPosition, frame, Color.White, 0f, origin, 1.6f, SpriteEffects.None, 0f); return false; diff --git a/Projectiles/Ranged/PrismExplosionSmall.cs b/Projectiles/Ranged/PrismExplosionSmall.cs index 9deb548cfd..51c9857a3b 100644 --- a/Projectiles/Ranged/PrismExplosionSmall.cs +++ b/Projectiles/Ranged/PrismExplosionSmall.cs @@ -10,43 +10,43 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); - Main.projFrames[projectile.type] = 7; + Main.projFrames[Projectile.type] = 7; } public override void SetDefaults() { - projectile.width = projectile.height = 130; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 150; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 11; - projectile.scale = 0.5f; + Projectile.width = Projectile.height = 130; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 150; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 11; + Projectile.scale = 0.5f; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.White.ToVector3() * 1.15f); - projectile.frameCounter++; - if (projectile.frameCounter % 8 == 7) - projectile.frame++; + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 1.15f); + Projectile.frameCounter++; + if (Projectile.frameCounter % 8 == 7) + Projectile.frame++; - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.Kill(); - projectile.scale *= 1.0115f; - projectile.Opacity = Utils.InverseLerp(5f, 36f, projectile.timeLeft, true); + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.Kill(); + Projectile.scale *= 1.0115f; + Projectile.Opacity = Utils.InverseLerp(5f, 36f, Projectile.timeLeft, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Texture2D lightTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/PhotovisceratorLight"); - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/PhotovisceratorLight"); + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = frame.Size() * 0.5f; spriteBatch.Draw(texture, drawPosition, frame, Color.White, 0f, origin, 1f, SpriteEffects.None, 0f); diff --git a/Projectiles/Ranged/PrismMine.cs b/Projectiles/Ranged/PrismMine.cs index 6dd01e07dc..18425b1f3e 100644 --- a/Projectiles/Ranged/PrismMine.cs +++ b/Projectiles/Ranged/PrismMine.cs @@ -10,31 +10,31 @@ namespace CalamityMod.Projectiles.Ranged public class PrismMine : ModProjectile { public List MinesToConnectTo = new List(); - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public const float DamageFactorLowerBound = 0.425f; public const float MineConnectDistanceMax = 1200f; public override void SetStaticDefaults() => DisplayName.SetDefault("Mine"); public override void SetDefaults() { - projectile.width = projectile.height = 40; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 7; - projectile.timeLeft = 280; + Projectile.width = Projectile.height = 40; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 7; + Projectile.timeLeft = 280; } public override void AI() { - projectile.velocity *= 0.96f; - Lighting.AddLight(projectile.Center, Color.Cyan.ToVector3()); + Projectile.velocity *= 0.96f; + Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3()); - float idealScale = MathHelper.Lerp(0.93f, 1.07f, (float)Math.Sin(MathHelper.TwoPi * projectile.timeLeft / 14f) * 0.5f + 0.5f); - projectile.scale = MathHelper.Lerp(0.15f, idealScale, Utils.InverseLerp(0f, 15f, Time, true) * Utils.InverseLerp(0f, 15f, projectile.timeLeft, true)); + float idealScale = MathHelper.Lerp(0.93f, 1.07f, (float)Math.Sin(MathHelper.TwoPi * Projectile.timeLeft / 14f) * 0.5f + 0.5f); + Projectile.scale = MathHelper.Lerp(0.15f, idealScale, Utils.InverseLerp(0f, 15f, Time, true) * Utils.InverseLerp(0f, 15f, Projectile.timeLeft, true)); Time++; } @@ -42,11 +42,11 @@ namespace CalamityMod.Projectiles.Ranged { foreach (Projectile mine in LocateOtherMines()) { - if (projectile.timeLeft <= 12) + if (Projectile.timeLeft <= 12) break; float _ = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, mine.Center, 20f, ref _)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, mine.Center, 20f, ref _)) return true; } return base.Colliding(projHitbox, targetHitbox); @@ -55,11 +55,11 @@ namespace CalamityMod.Projectiles.Ranged public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { // Have the damage be reduced based on hit count. This effect becomes stronger the more hits, before hitting a lower bound. - float damageFactor = 1f - 3f * (float)Math.Pow(projectile.numHits / 14f, 2D) + 2f * (float)Math.Pow(projectile.numHits / 14f, 3D); + float damageFactor = 1f - 3f * (float)Math.Pow(Projectile.numHits / 14f, 2D) + 2f * (float)Math.Pow(Projectile.numHits / 14f, 3D); // The above equation is a polynomial that will eventually shoot off to infinity if the hit count somehow gets high enough. // To amend this, the limit is reached by default after enough hits have been made. - if (projectile.numHits > 12 || damageFactor < DamageFactorLowerBound) + if (Projectile.numHits > 12 || damageFactor < DamageFactorLowerBound) damageFactor = DamageFactorLowerBound; damage = (int)(damage * damageFactor); @@ -71,9 +71,9 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < Main.maxProjectiles; i++) { Projectile proj = Main.projectile[i]; - if (proj.type != projectile.type || !proj.active || proj.timeLeft <= 12 || i == projectile.whoAmI) + if (proj.type != Projectile.type || !proj.active || proj.timeLeft <= 12 || i == Projectile.whoAmI) continue; - if (!projectile.WithinRange(proj.Center, MineConnectDistanceMax)) + if (!Projectile.WithinRange(proj.Center, MineConnectDistanceMax)) continue; mines.Add(proj); @@ -84,40 +84,40 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D baseTexture = Main.projectileTexture[projectile.type]; - Texture2D glowTexture = ModContent.GetTexture($"{Texture}Glowmask"); - Texture2D laserTexture = ModContent.GetTexture($"CalamityMod/Projectiles/Ranged/PrismMineArc"); + Texture2D baseTexture = Main.projectileTexture[Projectile.type]; + Texture2D glowTexture = ModContent.Request($"{Texture}Glowmask"); + Texture2D laserTexture = ModContent.Request($"CalamityMod/Projectiles/Ranged/PrismMineArc"); void drawLineTo(Vector2 destination, Color laserColor) { - float rotation = projectile.AngleTo(destination); - float remainingDistance = projectile.Distance(destination) - 30f; + float rotation = Projectile.AngleTo(destination); + float remainingDistance = Projectile.Distance(destination) - 30f; float laserScale = 0.5f; - Rectangle frame = laserTexture.Frame(1, 7, 0, (int)(Main.GlobalTime * 10f + projectile.identity * 3f) % 7); + Rectangle frame = laserTexture.Frame(1, 7, 0, (int)(Main.GlobalTime * 10f + Projectile.identity * 3f) % 7); Vector2 laserOrigin = frame.Size() * 0.5f; while (remainingDistance > frame.Height * laserScale) { - Vector2 laserDrawPosition = projectile.Center + projectile.SafeDirectionTo(destination, -Vector2.UnitY) * remainingDistance - Main.screenPosition; + Vector2 laserDrawPosition = Projectile.Center + Projectile.SafeDirectionTo(destination, -Vector2.UnitY) * remainingDistance - Main.screenPosition; spriteBatch.Draw(laserTexture, laserDrawPosition, frame, laserColor, rotation, laserOrigin, laserScale, SpriteEffects.None, 0f); remainingDistance -= frame.Height * laserScale; } } Vector2 origin = baseTexture.Size() * 0.5f; - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; foreach (Projectile mine in LocateOtherMines()) { - float fade = Utils.InverseLerp(8f, 24f, projectile.timeLeft, true) * Utils.InverseLerp(8f, 24f, mine.timeLeft, true); + float fade = Utils.InverseLerp(8f, 24f, Projectile.timeLeft, true) * Utils.InverseLerp(8f, 24f, mine.timeLeft, true); drawLineTo(mine.Center, Color.White * fade); } - spriteBatch.Draw(baseTexture, drawPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(baseTexture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); Rectangle glowFrame = glowTexture.Frame(1, 6, 0, (int)Time / 4 % 6); Color glowColor = Color.White * 0.5f; glowColor.A = 0; - spriteBatch.Draw(glowTexture, drawPosition, glowFrame, glowColor, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(glowTexture, drawPosition, glowFrame, glowColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Ranged/PrismaticEnergyBlast.cs b/Projectiles/Ranged/PrismaticEnergyBlast.cs index 8dd15b9ecf..4cff4131a5 100644 --- a/Projectiles/Ranged/PrismaticEnergyBlast.cs +++ b/Projectiles/Ranged/PrismaticEnergyBlast.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Ranged { public bool ExplodedYet { - get => projectile.ai[1] == 1f; - set => projectile.ai[1] = value.ToInt(); + get => Projectile.ai[1] == 1f; + set => Projectile.ai[1] = value.ToInt(); } public override string Texture => "CalamityMod/ExtraTextures/Lasers/PrismLaserStart"; public override float MaxScale => 1f; @@ -19,98 +19,98 @@ namespace CalamityMod.Projectiles.Ranged public override float Lifetime => 50f; public override Color LaserOverlayColor => Color.White; public override Color LightCastColor => LaserOverlayColor; - public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/PrismLaserStart"); - public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/PrismLaserMid"); - public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/PrismLaserEnd"); + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/PrismLaserStart"); + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/PrismLaserMid"); + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/PrismLaserEnd"); public override void SetStaticDefaults() { DisplayName.SetDefault("Energy Blast"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.penetrate = 100; - projectile.extraUpdates = 1; - projectile.timeLeft = 450; + Projectile.width = Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.penetrate = 100; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 450; } public override bool PreAI() { - projectile.frameCounter++; - if (projectile.frameCounter % 5 == 4) - projectile.frame++; + Projectile.frameCounter++; + if (Projectile.frameCounter % 5 == 4) + Projectile.frame++; - Vector2 laserEnd = projectile.position + projectile.velocity * LaserLength; + Vector2 laserEnd = Projectile.position + Projectile.velocity * LaserLength; if (Collision.SolidCollision(laserEnd, 84, 84)) - CreateExplosion(laserEnd + projectile.Size * 0.5f); + CreateExplosion(laserEnd + Projectile.Size * 0.5f); return true; } public void CreateExplosion(Vector2 laserEnd) { - if (Main.myPlayer != projectile.owner || ExplodedYet || LaserLength <= 60f) + if (Main.myPlayer != Projectile.owner || ExplodedYet || LaserLength <= 60f) return; - Projectile.NewProjectile(laserEnd, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner); + Projectile.NewProjectile(laserEnd, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner); if (!ExplodedYet) { ExplodedYet = true; - projectile.netUpdate = true; + Projectile.netUpdate = true; } } public override float DetermineLaserLength() { - if (projectile.penetrate == 100) + if (Projectile.penetrate == 100) return DetermineLaserLength_CollideWithTiles(8); return LaserLength; } - public override bool CanDamage() => projectile.penetrate == 100; + public override bool CanDamage() => Projectile.penetrate == 100; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - LaserLength = projectile.Distance(target.Center); + LaserLength = Projectile.Distance(target.Center); CreateExplosion(target.Center); } public override void Kill(int timeLeft) { - Vector2 laserEnd = projectile.Center + projectile.velocity * LaserLength; + Vector2 laserEnd = Projectile.Center + Projectile.velocity * LaserLength; CreateExplosion(laserEnd); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { // Start texture drawing. - Rectangle beginFrame = LaserBeginTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Rectangle beginFrame = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); spriteBatch.Draw(LaserBeginTexture, - projectile.Center - Main.screenPosition, + Projectile.Center - Main.screenPosition, beginFrame, Color.White, - projectile.rotation, + Projectile.rotation, beginFrame.Size() / 2f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); // Prepare things for body drawing. float laserBodyLength = LaserLength; - laserBodyLength -= (LaserBeginTexture.Height * 0.5f + LaserEndTexture.Height) * projectile.scale / Main.projFrames[projectile.type]; - Vector2 centerOnLaser = projectile.Center; + laserBodyLength -= (LaserBeginTexture.Height * 0.5f + LaserEndTexture.Height) * Projectile.scale / Main.projFrames[Projectile.type]; + Vector2 centerOnLaser = Projectile.Center; // Body drawing. - Rectangle middleFrame = LaserMiddleTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Rectangle middleFrame = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); if (laserBodyLength > 30f) { - float laserOffset = (LaserMiddleTexture.Height - 10f) * projectile.scale / Main.projFrames[projectile.type]; + float laserOffset = (LaserMiddleTexture.Height - 10f) * Projectile.scale / Main.projFrames[Projectile.type]; float incrementalBodyLength = 0f; while (incrementalBodyLength + 1f < laserBodyLength) { @@ -118,26 +118,26 @@ namespace CalamityMod.Projectiles.Ranged centerOnLaser - Main.screenPosition, middleFrame, Color.White, - projectile.rotation, + Projectile.rotation, middleFrame.Width * 0.5f * Vector2.UnitX, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); incrementalBodyLength += laserOffset; - centerOnLaser += projectile.velocity * laserOffset; + centerOnLaser += Projectile.velocity * laserOffset; } } // End texture drawing. - Rectangle endFrame = LaserEndTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Rectangle endFrame = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 laserEndCenter = centerOnLaser - Main.screenPosition; spriteBatch.Draw(LaserEndTexture, laserEndCenter, endFrame, Color.White, - projectile.rotation, + Projectile.rotation, endFrame.Size() * new Vector2(0.5f, 0f), - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); return false; diff --git a/Projectiles/Ranged/PristineFire.cs b/Projectiles/Ranged/PristineFire.cs index e922328e20..f00c9f89fb 100644 --- a/Projectiles/Ranged/PristineFire.cs +++ b/Projectiles/Ranged/PristineFire.cs @@ -20,38 +20,38 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 120; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 120; } public override void AI() { - if (projectile.scale <= 1.5f) + if (Projectile.scale <= 1.5f) { - projectile.scale *= 1.01f; + Projectile.scale *= 1.01f; } - Lighting.AddLight(projectile.Center, 1f, 1f, 0.25f); - if (projectile.timeLeft > 90) + Lighting.AddLight(Projectile.Center, 1f, 1f, 0.25f); + if (Projectile.timeLeft > 90) { - projectile.timeLeft = 120; + Projectile.timeLeft = 120; } int dustTypeOnTimer = dust1; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 5f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 5f) { for (int num447 = 0; num447 < 2; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); + Projectile.alpha = 255; int num448 = Dust.NewDust(vector33, 1, 1, dustTypeOnTimer, 0f, 0f, 0, default, 1f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; @@ -60,10 +60,10 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num448].noLight = true; Main.dust[num448].color = CalamityUtils.ColorSwap(new Color(255, 168, 53), new Color(255, 249, 0), 2f); } - projectile.ai[0] += 1f; - if (projectile.ai[0] == 48f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] == 48f) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; if (dustTypeOnTimer == dust1) dustTypeOnTimer = dust2; @@ -78,12 +78,12 @@ namespace CalamityMod.Projectiles.Ranged { int dustType = num41 == 0 ? dust1 : dust2; Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 * 1.5f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); + value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 * 1.5f; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 0.75f; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; + Main.dust[num42].position = Projectile.Center + value8; + Main.dust[num42].velocity = Projectile.velocity; Main.dust[num42].noLight = true; Main.dust[num42].color = CalamityUtils.ColorSwap(new Color(255, 168, 53), new Color(255, 249, 0), 2f); } @@ -107,27 +107,27 @@ namespace CalamityMod.Projectiles.Ranged float num50 = 1.7f; float num51 = 0.8f; float num52 = 2f; - Vector2 value3 = (projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Vector2 value3 = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); for (int num53 = 0; num53 < 40; num53++) { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 200, default, num50); + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 200, default, num50); Dust dust = Main.dust[num54]; - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; dust.velocity += value4 * Main.rand.NextFloat(); dust.color = CalamityUtils.ColorSwap(new Color(255, 168, 53), new Color(255, 249, 0), 2f); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, num51); - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, num51); + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.velocity *= 2f; dust.noGravity = true; dust.fadeIn = 1f; @@ -136,9 +136,9 @@ namespace CalamityMod.Projectiles.Ranged } for (int num55 = 0; num55 < 20; num55++) { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, num52); + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, num52); Dust dust = Main.dust[num56]; - dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; dust.noGravity = true; dust.velocity *= 0.5f; dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); diff --git a/Projectiles/Ranged/PristineSecondary.cs b/Projectiles/Ranged/PristineSecondary.cs index 206c2759af..4255bd2672 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -20,48 +20,48 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 3; - projectile.timeLeft = 150; + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 3; + Projectile.timeLeft = 150; } public override void AI() { - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; int dustType = Utils.SelectRandom(Main.rand, new int[] { dust1, dust2 }); - Lighting.AddLight(projectile.Center, 1f, 1f, 0.25f); - if (projectile.ai[0] > 7f) + Lighting.AddLight(Projectile.Center, 1f, 1f, 0.25f); + if (Projectile.ai[0] > 7f) { float num296 = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { num296 = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { num296 = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; if (Main.rand.NextBool(2)) { for (int num298 = 0; num298 < 1; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { @@ -91,9 +91,9 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/ProBolt.cs b/Projectiles/Ranged/ProBolt.cs index 5f1f1b79e8..a4b8e4acf4 100644 --- a/Projectiles/Ranged/ProBolt.cs +++ b/Projectiles/Ranged/ProBolt.cs @@ -11,38 +11,38 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 3; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 3; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) *projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) *Projectile.direction; - Lighting.AddLight(projectile.Center, new Vector3(158, 240, 240) * (1.5f / 255)); + Lighting.AddLight(Projectile.Center, new Vector3(158, 240, 240) * (1.5f / 255)); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - Vector2 dspeed = -projectile.velocity * 0.8f; - float x = projectile.Center.X - projectile.velocity.X / 10f; - float y = projectile.Center.Y - projectile.velocity.Y / 10f; + Vector2 dspeed = -Projectile.velocity * 0.8f; + float x = Projectile.Center.X - Projectile.velocity.X / 10f; + float y = Projectile.Center.Y - Projectile.velocity.Y / 10f; int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 160, 0f, 0f, 0, default, 1.25f); - Main.dust[num135].alpha = projectile.alpha; + Main.dust[num135].alpha = Projectile.alpha; Main.dust[num135].position.X = x; Main.dust[num135].position.Y = y; Main.dust[num135].velocity = dspeed; @@ -52,26 +52,26 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -81,13 +81,13 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 160, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); //206 160 226 + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 160, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); //206 160 226 } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[Projectile.owner] = 7; } } } diff --git a/Projectiles/Ranged/PumplerGrenade.cs b/Projectiles/Ranged/PumplerGrenade.cs index b1d615941c..5dfb779928 100644 --- a/Projectiles/Ranged/PumplerGrenade.cs +++ b/Projectiles/Ranged/PumplerGrenade.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -14,56 +15,56 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 16; - projectile.height = 22; - projectile.friendly = true; - projectile.timeLeft = 180; - projectile.penetrate = 1; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 16; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.timeLeft = 180; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override string Texture => "CalamityMod/Projectiles/Ranged/PumplerGrenade"; private void Explode(bool NPCHit = false) { - Main.PlaySound(SoundID.Item14, projectile.Center); - if (Main.myPlayer == projectile.owner) + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + if (Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage), projectile.knockBack, projectile.owner, NPCHit ? 1 : 0); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage), Projectile.knockBack, Projectile.owner, NPCHit ? 1 : 0); } - projectile.Kill(); + Projectile.Kill(); } public override void AI() { - if (projectile.timeLeft == 1) + if (Projectile.timeLeft == 1) Explode(); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - Point tileCoords = projectile.Bottom.ToTileCoordinates(); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Point tileCoords = Projectile.Bottom.ToTileCoordinates(); if (Main.tile[tileCoords.X, tileCoords.Y + 1].nactive() && - WorldGen.SolidTile(Main.tile[tileCoords.X, tileCoords.Y + 1]) && projectile.timeLeft < 165) + WorldGen.SolidTile(Main.tile[tileCoords.X, tileCoords.Y + 1]) && Projectile.timeLeft < 165) { Explode(); - projectile.Kill(); + Projectile.Kill(); } else { - projectile.velocity.Y += 0.4f; - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; + Projectile.velocity.Y += 0.4f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; } } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.velocity *= -1f; + Projectile.velocity *= -1f; return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Explode(true); } diff --git a/Projectiles/Ranged/PumplerGrenadeExplosion.cs b/Projectiles/Ranged/PumplerGrenadeExplosion.cs index 40f5f07d46..42ae940ae8 100644 --- a/Projectiles/Ranged/PumplerGrenadeExplosion.cs +++ b/Projectiles/Ranged/PumplerGrenadeExplosion.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Ranged { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - private bool NPCHit => projectile.ai[0] == 1; + private bool NPCHit => Projectile.ai[0] == 1; public override void SetStaticDefaults() { @@ -19,32 +19,32 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 70; - projectile.height = 70; - projectile.friendly = true; - projectile.timeLeft = 5; - projectile.penetrate = -1; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 70; + Projectile.height = 70; + Projectile.friendly = true; + Projectile.timeLeft = 5; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } private void SmokeBoom() { for (int i = 0; i < 15; i++) { - Particle smoke = new SmallSmokeParticle(projectile.Center + Main.rand.NextVector2Circular(15f, 15f), Vector2.Zero, Color.Orange, new Color(40, 40, 40), Main.rand.NextFloat(0.8f, 1.6f), 145 - Main.rand.Next(30)); - smoke.Velocity = (smoke.Position - projectile.Center) * 0.2f + projectile.velocity; + Particle smoke = new SmallSmokeParticle(Projectile.Center + Main.rand.NextVector2Circular(15f, 15f), Vector2.Zero, Color.Orange, new Color(40, 40, 40), Main.rand.NextFloat(0.8f, 1.6f), 145 - Main.rand.Next(30)); + smoke.Velocity = (smoke.Position - Projectile.Center) * 0.2f + Projectile.velocity; GeneralParticleHandler.SpawnParticle(smoke); } } public override bool? CanHitNPC(NPC target) { - float blastRadius = projectile.height / 2f; + float blastRadius = Projectile.height / 2f; //Get the absolute value of the distance between the target's hitbox center & the explosion's center - float distanceX = Math.Abs(projectile.Center.X - target.Hitbox.Center.X); - float distanceY = Math.Abs(projectile.Center.Y - target.Hitbox.Center.Y); + float distanceX = Math.Abs(Projectile.Center.X - target.Hitbox.Center.X); + float distanceY = Math.Abs(Projectile.Center.Y - target.Hitbox.Center.Y); //If the distance is just too big for the two to intersect, return false if (distanceX > (target.Hitbox.Width / 2f + blastRadius) || distanceY > (target.Hitbox.Height / 2f + blastRadius)) @@ -64,11 +64,11 @@ namespace CalamityMod.Projectiles.Ranged //Bigger explosion if no npc gets hit if (!NPCHit) { - projectile.width = 120; - projectile.height = 120; + Projectile.width = 120; + Projectile.height = 120; } - if (projectile.timeLeft == 5) + if (Projectile.timeLeft == 5) SmokeBoom(); } } diff --git a/Projectiles/Ranged/PumplerHoldout.cs b/Projectiles/Ranged/PumplerHoldout.cs index 364411e7ea..1ba695e24c 100644 --- a/Projectiles/Ranged/PumplerHoldout.cs +++ b/Projectiles/Ranged/PumplerHoldout.cs @@ -7,6 +7,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.Graphics.Shaders; using CalamityMod.Particles; +using Terraria.Audio; //TY dom for coding condemnation, great reference, would steal code from again :) @@ -20,35 +21,35 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Pumpler"); - Main.projFrames[projectile.type] = 9; + Main.projFrames[Projectile.type] = 9; } - private Player Owner => Main.player[projectile.owner]; + private Player Owner => Main.player[Projectile.owner]; private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; - private ref float CurrentChargingFrames => ref projectile.ai[0]; - private ref float PumpkinsCharge => ref projectile.ai[1]; - private ref float FramesToLoadNextPumpkin => ref projectile.localAI[0]; - private ref float Overfilled => ref projectile.localAI[1]; //This functionally is a "IsPlayingShootAnim" variable + private ref float CurrentChargingFrames => ref Projectile.ai[0]; + private ref float PumpkinsCharge => ref Projectile.ai[1]; + private ref float FramesToLoadNextPumpkin => ref Projectile.localAI[0]; + private ref float Overfilled => ref Projectile.localAI[1]; //This functionally is a "IsPlayingShootAnim" variable private float angularSpread = MathHelper.ToRadians(15); public override string Texture => "CalamityMod/Projectiles/Ranged/PumplerHoldout"; public override void SetDefaults() { - projectile.width = 72; - projectile.height = 34; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 72; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } public override void AI() { Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 tipPosition = armPosition + projectile.velocity * projectile.width * 0.5f; + Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f; // Unloads all pumpkins if you can't shoot/stop holding out the projectile or if the gun is overfilled if (!OwnerCanShoot || Overfilled == 1f) @@ -56,21 +57,21 @@ namespace CalamityMod.Projectiles.Ranged if (PumpkinsCharge <= 0f && Overfilled == 0f) //If the projectile isnt playing its animation and if there arent any pumpkins loaded, kill it { - projectile.Kill(); + Projectile.Kill(); return; } //Animation stuff start - projectile.frameCounter++; - if (projectile.frameCounter >= 10) //10 fps anim + Projectile.frameCounter++; + if (Projectile.frameCounter >= 10) //10 fps anim { - projectile.frame++; - if (projectile.frame >= Main.projFrames[projectile.type] - 1) - projectile.frame = 0; - projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Projectile.type] - 1) + Projectile.frame = 0; + Projectile.frameCounter = 0; } // Shoot anim is done? Remove the shoot anim tag - if (projectile.frame == 0 && Overfilled == 1f) + if (Projectile.frame == 0 && Overfilled == 1f) Overfilled = 0f; //Animation stuff end @@ -92,17 +93,17 @@ namespace CalamityMod.Projectiles.Ranged // Also accelerate charging, because it's fucking awesome. <- Agreeing with dom so hard i made it increase harder if (CurrentChargingFrames >= FramesToLoadNextPumpkin && PumpkinsCharge < Pumpler.MaxPumpkins) { - projectile.frame = (projectile.frame + 1); //next anim frame + Projectile.frame = (Projectile.frame + 1); //next anim frame CurrentChargingFrames = 0f; ++PumpkinsCharge; FramesToLoadNextPumpkin *= 0.850f; //CombatText.NewText(projectile.Hitbox, new Color(255*(PumpkinsCharge/5), 151 * (PumpkinsCharge / 5), 78 * (PumpkinsCharge / 5)), ((int)PumpkinsCharge).ToString(), true); //Colors don't properly shift towards orange, they remain white fsr. I assume its float fuckery. Also the numbers appear too high up if (PumpkinsCharge >= Pumpler.MaxPumpkins) - Main.PlaySound(SoundID.Item69); + SoundEngine.PlaySound(SoundID.Item69); else { - var loadSound = Main.PlaySound(SoundID.Item108); + var loadSound = SoundEngine.PlaySound(SoundID.Item108); if (loadSound != null) loadSound.Volume *= 0.3f; } @@ -145,18 +146,18 @@ namespace CalamityMod.Projectiles.Ranged } } - Main.PlaySound(SoundID.Item96);//play the sound + SoundEngine.PlaySound(SoundID.Item96);//play the sound SmokeBurst(tipPosition); FramesToLoadNextPumpkin = Owner.ActiveItem().useAnimation; //reset the reload time PumpkinsCharge = 0; //Unload the barrel if (!(Overfilled == 1f)) Overfilled = 1f; //Make the shoot anim play - projectile.frame = 6; //Initialize the animation + Projectile.frame = 6; //Initialize the animation } public void ShootProjectiles(Vector2 tipPosition, float projectileRotation) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; Item heldItem = Owner.ActiveItem(); @@ -164,54 +165,54 @@ namespace CalamityMod.Projectiles.Ranged int PumpkinDamage = (int)(heldItem.damage * Owner.RangedDamage()); float shootSpeed = heldItem.shootSpeed * 1.5f; float knockback = Owner.GetWeaponKnockback(heldItem, heldItem.knockBack); - Vector2 shootVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(projectileRotation) * shootSpeed; - Projectile.NewProjectile(tipPosition, shootVelocity, projectileType, PumpkinDamage, knockback, projectile.owner, 0f, 0f); + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(projectileRotation) * shootSpeed; + Projectile.NewProjectile(tipPosition, shootVelocity, projectileType, PumpkinDamage, knockback, Projectile.owner, 0f, 0f); } private void UpdateProjectileHeldVariables(Vector2 armPosition) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { float interpolant = Utils.InverseLerp(5f, 25f, Owner.Distance(Main.MouseWorld), true); - Vector2 oldVelocity = projectile.velocity; - projectile.velocity = Vector2.Lerp(projectile.velocity, Owner.SafeDirectionTo(Main.MouseWorld), interpolant); - if (projectile.velocity != oldVelocity) + Vector2 oldVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Owner.SafeDirectionTo(Main.MouseWorld), interpolant); + if (Projectile.velocity != oldVelocity) { - projectile.netSpam = 0; - projectile.netUpdate = true; + Projectile.netSpam = 0; + Projectile.netUpdate = true; } } //Please someone kill me i dont want to deal with offset moments, //Dom oomfie! - projectile.position = armPosition - projectile.Size * 0.5f + projectile.velocity.SafeNormalize(Vector2.Zero) * 30f; - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.position = armPosition - Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.Zero) * 30f; + Projectile.rotation = Projectile.velocity.ToRotation(); - projectile.position = armPosition - projectile.Size * 0.5f + projectile.velocity.SafeNormalize(Vector2.Zero) * 35f; - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.position = armPosition - Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.Zero) * 35f; + Projectile.rotation = Projectile.velocity.ToRotation(); - int oldDirection = projectile.spriteDirection; + int oldDirection = Projectile.spriteDirection; if (oldDirection == -1) - projectile.rotation += MathHelper.Pi; + Projectile.rotation += MathHelper.Pi; - projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + Projectile.direction = Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); // If the direction differs from what it originaly was, undo the previous 180 degree turn. // If this is not done, the gun will have 1 frame of rotational "jitter" when the direction changes based on the // original angle. This effect looks very strange in-game. - if (projectile.spriteDirection != oldDirection) - projectile.rotation -= MathHelper.Pi; + if (Projectile.spriteDirection != oldDirection) + Projectile.rotation -= MathHelper.Pi; - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } private void ManipulatePlayerVariables() { - Owner.ChangeDir(projectile.direction); - Owner.heldProj = projectile.whoAmI; + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -229,9 +230,9 @@ namespace CalamityMod.Projectiles.Ranged GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1f - 0.04f * (PumpkinsCharge - 1), 0.8f, 0.5f)); GameShaders.Misc["CalamityMod:BasicTint"].Apply(); - Vector2 drawPosition = projectile.Center - Main.screenPosition; - Rectangle frameRectangle = Main.projectileTexture[projectile.type].Frame(1, 9, 0, projectile.frame); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPosition, frameRectangle, lightColor, projectile.rotation, frameRectangle.Size() * 0.5f, 1f, projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Rectangle frameRectangle = Main.projectileTexture[Projectile.type].Frame(1, 9, 0, Projectile.frame); + spriteBatch.Draw(Main.projectileTexture[Projectile.type], drawPosition, frameRectangle, lightColor, Projectile.rotation, frameRectangle.Size() * 0.5f, 1f, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); spriteBatch.ExitShaderRegion(); diff --git a/Projectiles/Ranged/RainbowBlast.cs b/Projectiles/Ranged/RainbowBlast.cs index b99b48f9d6..d86eb0d2dd 100644 --- a/Projectiles/Ranged/RainbowBlast.cs +++ b/Projectiles/Ranged/RainbowBlast.cs @@ -11,39 +11,39 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.ranged = true; - projectile.timeLeft = 300; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 300; } public override void AI() { //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - Lighting.AddLight(projectile.Center, new Vector3(Main.DiscoR, Main.DiscoG, Main.DiscoB) * (1.5f / 255)); + Lighting.AddLight(Projectile.Center, new Vector3(Main.DiscoR, Main.DiscoG, Main.DiscoB) * (1.5f / 255)); - projectile.localAI[0] ++; - if (projectile.localAI[0] > 5f) + Projectile.localAI[0] ++; + if (Projectile.localAI[0] > 5f) { - Vector2 dspeed = -projectile.velocity * 0.5f; - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, dspeed.X, dspeed.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); + Vector2 dspeed = -Projectile.velocity * 0.5f; + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, dspeed.X, dspeed.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity = dspeed; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/RainbowFront.cs b/Projectiles/Ranged/RainbowFront.cs index bbe5250ec2..9ed000ed3d 100644 --- a/Projectiles/Ranged/RainbowFront.cs +++ b/Projectiles/Ranged/RainbowFront.cs @@ -13,53 +13,53 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.penetrate = -1; - projectile.ranged = true; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.scale = 1.25f; + Projectile.width = 12; + Projectile.height = 12; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Ranged; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.scale = 1.25f; } public override void AI() { int num1 = 1200; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - projectile.localAI[0] = 3f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * (1f / 1000f), projectile.velocity.Y * (1f / 1000f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.localAI[0] = 3f; + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * (1f / 1000f), Projectile.velocity.Y * (1f / 1000f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } - if (projectile.timeLeft > num1) - projectile.timeLeft = num1; + if (Projectile.timeLeft > num1) + Projectile.timeLeft = num1; } float num2 = 1f; - if (projectile.velocity.Y < 0f) - num2 -= projectile.velocity.Y / 3f; - projectile.ai[0] += num2; - if (projectile.ai[0] > 30f) + if (Projectile.velocity.Y < 0f) + num2 -= Projectile.velocity.Y / 3f; + Projectile.ai[0] += num2; + if (Projectile.ai[0] > 30f) { - projectile.velocity.Y += 0.5f; - if (projectile.velocity.Y > 0f) + Projectile.velocity.Y += 0.5f; + if (Projectile.velocity.Y > 0f) { - projectile.velocity.X *= 0.95f; + Projectile.velocity.X *= 0.95f; } else { - projectile.velocity.X *= 1.05f; + Projectile.velocity.X *= 1.05f; } } - float x = projectile.velocity.X; - float y = projectile.velocity.Y; - float num3 = 15.95f * projectile.scale / (float)Math.Sqrt((double)x * (double)x + (double)y * (double)y); + float x = Projectile.velocity.X; + float y = Projectile.velocity.Y; + float num3 = 15.95f * Projectile.scale / (float)Math.Sqrt((double)x * (double)x + (double)y * (double)y); float num4 = x * num3; float num5 = y * num3; - projectile.velocity.X = num4; - projectile.velocity.Y = num5; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - MathHelper.PiOver2; + Projectile.velocity.X = num4; + Projectile.velocity.Y = num5; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; } public override Color? GetAlpha(Color lightColor) => Color.Transparent; diff --git a/Projectiles/Ranged/RainbowTrail.cs b/Projectiles/Ranged/RainbowTrail.cs index 6840176d84..cc2e7b6297 100644 --- a/Projectiles/Ranged/RainbowTrail.cs +++ b/Projectiles/Ranged/RainbowTrail.cs @@ -13,19 +13,19 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 46; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.ranged = true; - projectile.alpha = 255; - projectile.light = 0.3f; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.scale = 1.25f; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 46; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Ranged; + Projectile.alpha = 255; + Projectile.light = 0.3f; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.scale = 1.25f; } - public override Color? GetAlpha(Color lightColor) => new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + public override Color? GetAlpha(Color lightColor) => new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } } diff --git a/Projectiles/Ranged/RealmRavagerBullet.cs b/Projectiles/Ranged/RealmRavagerBullet.cs index ccfd9c632e..6646c651df 100644 --- a/Projectiles/Ranged/RealmRavagerBullet.cs +++ b/Projectiles/Ranged/RealmRavagerBullet.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,56 +12,56 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Explosive Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.ranged = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Ranged; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.extraUpdates = 3; - projectile.penetrate = 1; - projectile.timeLeft = 90; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.extraUpdates = 3; + Projectile.penetrate = 1; + Projectile.timeLeft = 90; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 32); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 32); for (int d = 0; d < 2; d++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); } for (int d = 0; d < 20; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 0, default, 2.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 0, default, 2.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1.5f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 1.5f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); } } } diff --git a/Projectiles/Ranged/RocketFire.cs b/Projectiles/Ranged/RocketFire.cs index d3d52ed2b9..c162e3cdab 100644 --- a/Projectiles/Ranged/RocketFire.cs +++ b/Projectiles/Ranged/RocketFire.cs @@ -14,95 +14,95 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = 120; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 120; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } public override void AI() { //make it face the way it's going - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.rotation = -projectile.velocity.X * 0.05f + MathHelper.PiOver2; + Projectile.rotation = -Projectile.velocity.X * 0.05f + MathHelper.PiOver2; } else { - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); } - projectile.ai[1]--; + Projectile.ai[1]--; //frames if (!initialized) { initialized = true; - projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); } - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } //movement - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X *= -0.1f; + Projectile.velocity.X *= -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X *= -0.5f; + Projectile.velocity.X *= -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y *= -0.5f; + Projectile.velocity.Y *= -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X *= 0.97f; - if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) + Projectile.velocity.X *= 0.97f; + if (Projectile.velocity.X > -0.01f && Projectile.velocity.X < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; } - if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) + if (Projectile.velocity.Y < 0.25f && Projectile.velocity.Y > 0.15f) { - projectile.velocity.X *= 0.8f; + Projectile.velocity.X *= 0.8f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } //dust if (Main.rand.NextBool(4)) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Ranged } if (Main.rand.NextBool(10)) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.ai[1] = 10f; + Projectile.ai[1] = 10f; return false; } @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/RubberMortarRoundProj.cs b/Projectiles/Ranged/RubberMortarRoundProj.cs index 7738d447c8..48d9dd1f12 100644 --- a/Projectiles/Ranged/RubberMortarRoundProj.cs +++ b/Projectiles/Ranged/RubberMortarRoundProj.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -20,20 +21,20 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (projectile.velocity.Length() >= 8f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.velocity.Length() >= 8f) { for (int d = 0; d < 2; d++) { @@ -41,14 +42,14 @@ namespace CalamityMod.Projectiles.Ranged float yOffset = 0f; if (d == 1) { - xOffset = projectile.velocity.X * 0.5f; - yOffset = projectile.velocity.Y * 0.5f; + xOffset = Projectile.velocity.X * 0.5f; + yOffset = Projectile.velocity.Y * 0.5f; } - int fire = Dust.NewDust(new Vector2(projectile.position.X + 3f + xOffset, projectile.position.Y + 3f + yOffset) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, DustID.Fire, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xOffset, Projectile.position.Y + 3f + yOffset) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Fire, 0f, 0f, 100, default, 1f); Main.dust[fire].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[fire].velocity *= 0.2f; Main.dust[fire].noGravity = true; - int smoke = Dust.NewDust(new Vector2(projectile.position.X + 3f + xOffset, projectile.position.Y + 3f + yOffset) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, DustID.Smoke, 0f, 0f, 100, default, 0.5f); + int smoke = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xOffset, Projectile.position.Y + 3f + yOffset) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Smoke, 0f, 0f, 100, default, 0.5f); Main.dust[smoke].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[smoke].velocity *= 0.05f; } @@ -57,69 +58,69 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - int penetrateAmt = projectile.penetrate; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 200); - projectile.maxPenetrate = projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.Center); - projectile.penetrate = penetrateAmt; + int penetrateAmt = Projectile.penetrate; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 200); + Projectile.maxPenetrate = Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + Projectile.penetrate = penetrateAmt; SpawnDust(); - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 14); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 14); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { DestroyTiles(); } - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); - projectile.active = false; + Projectile.Kill(); + Projectile.active = false; } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - projectile.velocity *= 1.25f; + Projectile.velocity *= 1.25f; } return false; } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 200); - projectile.maxPenetrate = projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.knockBack *= 5f; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 200); + Projectile.maxPenetrate = Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.knockBack *= 5f; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); SpawnDust(); - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 14); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 14); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { DestroyTiles(); } @@ -129,7 +130,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int d = 0; d < 40; d++) { - int smoke = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); + int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Main.dust[smoke].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -139,17 +140,17 @@ namespace CalamityMod.Projectiles.Ranged } for (int d = 0; d < 70; d++) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } } private void DestroyTiles() { - CalamityUtils.ExplodeandDestroyTiles(projectile, 5, false, new List() + CalamityUtils.ExplodeandDestroyTiles(Projectile, 5, false, new List() { ModContent.TileType(), ModContent.TileType() diff --git a/Projectiles/Ranged/SandWater.cs b/Projectiles/Ranged/SandWater.cs index d9ab2316b3..303af7e9a1 100644 --- a/Projectiles/Ranged/SandWater.cs +++ b/Projectiles/Ranged/SandWater.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class SandWater : ModProjectile @@ -16,30 +17,30 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 60; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 60; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f); + Lighting.AddLight(Projectile.Center, 0f, 0f, 0.5f); for (int num457 = 0; num457 < 10; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.9f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.9f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item21, projectile.position); + SoundEngine.PlaySound(SoundID.Item21, Projectile.position); for (int dust = 0; dust <= 40; dust++) { float num463 = (float)Main.rand.Next(-10, 11); @@ -49,11 +50,11 @@ namespace CalamityMod.Projectiles.Ranged num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.6f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.6f); Dust dust2 = Main.dust[num467]; dust2.noGravity = true; - dust2.position.X = projectile.Center.X; - dust2.position.Y = projectile.Center.Y; + dust2.position.X = Projectile.Center.X; + dust2.position.Y = Projectile.Center.Y; dust2.position.X += (float)Main.rand.Next(-10, 11); dust2.position.Y += (float)Main.rand.Next(-10, 11); dust2.velocity.X = num463; diff --git a/Projectiles/Ranged/SandstormBullet.cs b/Projectiles/Ranged/SandstormBullet.cs index a70e79cd7f..b8ace498ae 100644 --- a/Projectiles/Ranged/SandstormBullet.cs +++ b/Projectiles/Ranged/SandstormBullet.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -14,36 +15,36 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Sandstorm"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - projectile.aiStyle = 1; - projectile.alpha = 255; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; + Projectile.aiStyle = 1; + Projectile.alpha = 255; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - projectile.alpha -= 50; - if (projectile.alpha < 0) + Projectile.alpha -= 50; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -51,27 +52,27 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 32; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.2f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -82,7 +83,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/SandyWaifuShark.cs b/Projectiles/Ranged/SandyWaifuShark.cs index e7ded77f15..3e9b70e4e5 100644 --- a/Projectiles/Ranged/SandyWaifuShark.cs +++ b/Projectiles/Ranged/SandyWaifuShark.cs @@ -10,61 +10,61 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Shark"); - Main.projFrames[projectile.type] = 8; + Main.projFrames[Projectile.type] = 8; } public override void SetDefaults() { - projectile.width = 60; - projectile.height = 60; - projectile.scale = 0.75f; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 240; + Projectile.width = 60; + Projectile.height = 60; + Projectile.scale = 0.75f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 210 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 210 && target.CanBeChasedBy(Projectile); public override void AI() { - int num192 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 32, 0f, 0f, 0, default, 0.5f); + int num192 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 32, 0f, 0f, 0, default, 0.5f); Main.dust[num192].noGravity = true; Main.dust[num192].velocity *= 0.2f; - Main.dust[num192].position = (Main.dust[num192].position + projectile.Center) / 2f; + Main.dust[num192].position = (Main.dust[num192].position + Projectile.Center) / 2f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 7) - projectile.frame = 0; + if (Projectile.frame > 7) + Projectile.frame = 0; - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2(-projectile.velocity.Y, -projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2(-Projectile.velocity.Y, -Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); } - if (projectile.timeLeft < 210) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 8f, 20f); + if (Projectile.timeLeft < 210) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 8f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, spriteEffects, 0f); return false; } @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/ScorchedEarthBlast.cs b/Projectiles/Ranged/ScorchedEarthBlast.cs index 9f8ebdcdd6..1ff406c6b0 100644 --- a/Projectiles/Ranged/ScorchedEarthBlast.cs +++ b/Projectiles/Ranged/ScorchedEarthBlast.cs @@ -22,16 +22,16 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { // Width and height don't actually do anything because the explosion uses custom collision - projectile.width = projectile.height = 300; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = Lifetime; + Projectile.width = Projectile.height = 300; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } // localAI[0] = frame counter @@ -39,25 +39,25 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { // Play sound on frame 1 and initialize dust quantity - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[1] = StartDustQuantity; + Projectile.localAI[1] = StartDustQuantity; } // Pure dust projectile DrawProjectile(); // Increment frame counter - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } private void DrawProjectile() { // Taper down the dust amount for the last bit of the projectile's life - if (projectile.localAI[0] >= Lifetime - 15) - projectile.localAI[1] -= 1f; + if (Projectile.localAI[0] >= Lifetime - 15) + Projectile.localAI[1] -= 1f; - int dustCount = (int)projectile.localAI[1]; + int dustCount = (int)Projectile.localAI[1]; for (int i = 0; i < dustCount; ++i) { int dustType = Main.rand.NextBool() ? 6 : 244; @@ -69,9 +69,9 @@ namespace CalamityMod.Projectiles.Ranged speed = randVelocity / speed; randX *= speed; randY *= speed; - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); - Main.dust[idx].position.X = projectile.Center.X + Main.rand.NextFloat(-10f, 10f); - Main.dust[idx].position.Y = projectile.Center.Y + Main.rand.NextFloat(-10f, 10f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); + Main.dust[idx].position.X = Projectile.Center.X + Main.rand.NextFloat(-10f, 10f); + Main.dust[idx].position.Y = Projectile.Center.Y + Main.rand.NextFloat(-10f, 10f); Main.dust[idx].velocity.X = randX; Main.dust[idx].velocity.Y = randY; Main.dust[idx].scale = scale; @@ -84,6 +84,6 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(BuffID.Daybreak, 300); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, ExplosionRadius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); } } diff --git a/Projectiles/Ranged/ScorchedEarthClusterBomb.cs b/Projectiles/Ranged/ScorchedEarthClusterBomb.cs index 69cb9daaa7..fed8cd32dd 100644 --- a/Projectiles/Ranged/ScorchedEarthClusterBomb.cs +++ b/Projectiles/Ranged/ScorchedEarthClusterBomb.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ScorchedEarthClusterBomb : ModProjectile @@ -13,39 +14,39 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 120; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -2; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 120; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -2; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation(); - projectile.velocity *= 0.95f; - if (projectile.velocity.Length() < 0.5f && projectile.timeLeft > 10) - projectile.timeLeft = 10; + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.velocity *= 0.95f; + if (Projectile.velocity.Length() < 0.5f && Projectile.timeLeft > 10) + Projectile.timeLeft = 10; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 10; i++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, default, 1f); } int projAmt = Main.rand.Next(2, 4); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int k = 0; k < projAmt; k++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); } } } diff --git a/Projectiles/Ranged/ScorchedEarthRocket.cs b/Projectiles/Ranged/ScorchedEarthRocket.cs index c5db2ebe63..a62a413911 100644 --- a/Projectiles/Ranged/ScorchedEarthRocket.cs +++ b/Projectiles/Ranged/ScorchedEarthRocket.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ScorchedEarthRocket : ModProjectile @@ -10,77 +11,77 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Rocket"); - Main.projFrames[projectile.type] = 10; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 10; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.extraUpdates = 1; + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; } public override void AI() { //Lighting - Lighting.AddLight(projectile.Center, 1f, 0.79f, 0.3f); + Lighting.AddLight(Projectile.Center, 1f, 0.79f, 0.3f); //Animation - projectile.frameCounter++; - if (projectile.frameCounter > (projectile.frame == 1 ? 10 : 7)) + Projectile.frameCounter++; + if (Projectile.frameCounter > (Projectile.frame == 1 ? 10 : 7)) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 6; + Projectile.frame = 6; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 400f, 5f, 30f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 400f, 5f, 30f); //Rotation - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); - float xVel = projectile.velocity.X * 0.5f; - float yVel = projectile.velocity.Y * 0.5f; - int d = Dust.NewDust(new Vector2(projectile.position.X + 3f + xVel, projectile.position.Y + 3f + yVel) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default, 1f); + float xVel = Projectile.velocity.X * 0.5f; + float yVel = Projectile.velocity.Y * 0.5f; + int d = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xVel, Projectile.position.Y + 3f + yVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 1f); Main.dust[d].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[d].velocity *= 0.2f; Main.dust[d].noGravity = true; - d = Dust.NewDust(new Vector2(projectile.position.X + 3f + xVel, projectile.position.Y + 3f + yVel) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); + d = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xVel, Projectile.position.Y + 3f + yVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); Main.dust[d].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[d].velocity *= 0.05f; } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 300); - Main.PlaySound(SoundID.Item14, projectile.position); - CalamityUtils.ExplosionGores(projectile.Center, 10); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 300); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + CalamityUtils.ExplosionGores(Projectile.Center, 10); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack * 2f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 2f, Projectile.owner); for (int j = 0; j < 5; j++) { Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(8f, 10f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack * 0.25f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/SeaDragonRocket.cs b/Projectiles/Ranged/SeaDragonRocket.cs index 911a178010..6cace9b76f 100644 --- a/Projectiles/Ranged/SeaDragonRocket.cs +++ b/Projectiles/Ranged/SeaDragonRocket.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class SeaDragonRocket : ModProjectile @@ -14,21 +15,21 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 95; + Projectile.DamageType = DamageClass.Ranged; } public override void AI() { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { for (int i = 0; i < 5; i++) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -36,26 +37,26 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[fire].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item109, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item109, Projectile.position); } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.owner == Main.myPlayer && Projectile.timeLeft <= 3) { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.Center.X; - projectile.position.Y = projectile.Center.Y; - projectile.width = 200; - projectile.height = 200; - projectile.position.X -= (float)(projectile.width / 2); - projectile.position.Y -= (float)(projectile.height / 2); - projectile.knockBack = 10f; + Projectile.tileCollide = false; + Projectile.ai[1] = 0f; + Projectile.alpha = 255; + Projectile.position.X = Projectile.Center.X; + Projectile.position.Y = Projectile.Center.Y; + Projectile.width = 200; + Projectile.height = 200; + Projectile.position.X -= (float)(Projectile.width / 2); + Projectile.position.Y -= (float)(Projectile.height / 2); + Projectile.knockBack = 10f; } else { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { for (int j = 0; j < 2; j++) { @@ -63,34 +64,34 @@ namespace CalamityMod.Projectiles.Ranged float num248 = 0f; if (j == 1) { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; + num247 = Projectile.velocity.X * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int explosion = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, DustID.Fire, 0f, 0f, 100, default, 1f); + int explosion = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Fire, 0f, 0f, 100, default, 1f); Main.dust[explosion].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[explosion].velocity *= 0.2f; Main.dust[explosion].noGravity = true; - explosion = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); + explosion = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); Main.dust[explosion].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[explosion].velocity *= 0.05f; } } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 192); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item110, projectile.position); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 192); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item110, Projectile.position); for (int i = 0; i < 15; i++) { - int smoke = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); Main.dust[smoke].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -100,19 +101,19 @@ namespace CalamityMod.Projectiles.Ranged } for (int j = 0; j < 25; j++) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } int projAmt = Main.rand.Next(2, 4); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int k = 0; k < projAmt; k++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), 0f, Projectile.owner); } } } diff --git a/Projectiles/Ranged/SeasSearingBubble.cs b/Projectiles/Ranged/SeasSearingBubble.cs index a62dfe9e2a..010e2e14b4 100644 --- a/Projectiles/Ranged/SeasSearingBubble.cs +++ b/Projectiles/Ranged/SeasSearingBubble.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -12,75 +13,75 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Searing Bubble"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 2; - projectile.timeLeft = 480; - projectile.ranged = true; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = 2; + Projectile.timeLeft = 480; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; } - if (projectile.timeLeft < 475) + if (Projectile.timeLeft < 475) { for (int num105 = 0; num105 < 2; num105++) { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; + float num99 = Projectile.velocity.X / 3f * (float)num105; + float num100 = Projectile.velocity.Y / 3f * (float)num105; int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 202, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 1.2f); + int num102 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num101, Projectile.position.Y + (float)num101), Projectile.width - num101 * 2, Projectile.height - num101 * 2, 202, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 1.2f); Dust dust = Main.dust[num102]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.1f; + dust.velocity += Projectile.velocity * 0.1f; dust.position.X -= num99; dust.position.Y -= num100; } if (Main.rand.NextBool(10)) { int num103 = 4; - int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 202, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 0.6f); + int num104 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num103, Projectile.position.Y + (float)num103), Projectile.width - num103 * 2, Projectile.height - num103 * 2, 202, 0f, 0f, 150, new Color(60, Main.DiscoG, 190), 0.6f); Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += projectile.velocity * 0.5f; + Main.dust[num104].velocity += Projectile.velocity * 0.5f; } } } public override Color? GetAlpha(Color lightColor) { - return new Color(60, Main.DiscoG, 190, projectile.alpha); + return new Color(60, Main.DiscoG, 190, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item96, projectile.position); + SoundEngine.PlaySound(SoundID.Item96, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 202, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, new Color(60, Main.DiscoG, 190)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 202, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, new Color(60, Main.DiscoG, 190)); } } @@ -100,15 +101,15 @@ namespace CalamityMod.Projectiles.Ranged private void OnHitEffects(Vector2 targetPos) { - Main.PlaySound(SoundID.Item96, projectile.Center); - if (projectile.ai[0] == 1f) + SoundEngine.PlaySound(SoundID.Item96, Projectile.Center); + if (Projectile.ai[0] == 1f) { for (int x = 0; x < 2; x++) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { float angle = Main.rand.NextFloat(MathHelper.TwoPi); - Projectile bubble = CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(20f, 25f), ModContent.ProjectileType(), projectile.damage / 2, 1f, projectile.owner); + Projectile bubble = CalamityUtils.ProjectileBarrage(Projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(20f, 25f), ModContent.ProjectileType(), Projectile.damage / 2, 1f, Projectile.owner); bubble.rotation = angle; bubble.tileCollide = false; bubble.usesLocalNPCImmunity = true; diff --git a/Projectiles/Ranged/SeasSearingSecondary.cs b/Projectiles/Ranged/SeasSearingSecondary.cs index b86e4e4683..7cf73d4295 100644 --- a/Projectiles/Ranged/SeasSearingSecondary.cs +++ b/Projectiles/Ranged/SeasSearingSecondary.cs @@ -17,34 +17,34 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 16; - projectile.height = 32; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 16; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.scale <= 3.6f) + if (Projectile.scale <= 3.6f) { - projectile.scale *= 1.01f; - projectile.width = (int)(16f * projectile.scale); - projectile.height = (int)(32f * projectile.scale); + Projectile.scale *= 1.01f; + Projectile.width = (int)(16f * Projectile.scale); + Projectile.height = (int)(32f * Projectile.scale); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 3; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 217, 0f, 0f, 100, new Color(60, Main.DiscoG, 190), projectile.scale); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 217, 0f, 0f, 100, new Color(60, Main.DiscoG, 190), Projectile.scale); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - int num470 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 202, 0f, 0f, 100, new Color(60, Main.DiscoG, 190), projectile.scale); + int num470 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 202, 0f, 0f, 100, new Color(60, Main.DiscoG, 190), Projectile.scale); Main.dust[num470].noGravity = true; Main.dust[num470].velocity *= 0f; } @@ -53,9 +53,9 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int endoftime = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int endoftime = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); Main.projectile[endoftime].localAI[1] = 1f; } } diff --git a/Projectiles/Ranged/SeasSearingSpout.cs b/Projectiles/Ranged/SeasSearingSpout.cs index 9515bd1a75..6aec9e3dac 100644 --- a/Projectiles/Ranged/SeasSearingSpout.cs +++ b/Projectiles/Ranged/SeasSearingSpout.cs @@ -11,23 +11,23 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Spout"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 150; - projectile.height = 42; - projectile.scale = 0.6f; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.width = 150; + Projectile.height = 42; + Projectile.scale = 0.6f; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.timeLeft = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() @@ -37,91 +37,91 @@ namespace CalamityMod.Projectiles.Ranged float num615 = 1f; int num616 = 150; int num617 = 42; - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); + Projectile.direction = Projectile.spriteDirection = -Math.Sign(Projectile.velocity.X); } - projectile.frameCounter++; - if (projectile.frameCounter > 2) + Projectile.frameCounter++; + if (Projectile.frameCounter > 2) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 6) + if (Projectile.frame >= 6) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.scale = ((float)(num613 + num614) - Projectile.ai[1]) * num615 / (float)(num614 + num613); + Projectile.width = (int)((float)num616 * Projectile.scale); + Projectile.height = (int)((float)num617 * Projectile.scale); + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } - if (projectile.ai[1] != -1f) + if (Projectile.ai[1] != -1f) { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); + Projectile.scale = ((float)(num613 + num614) - Projectile.ai[1]) * num615 / (float)(num614 + num613); + Projectile.width = (int)((float)num616 * Projectile.scale); + Projectile.height = (int)((float)num617 * Projectile.scale); } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (!Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.alpha -= 30; - if (projectile.alpha < 60) + Projectile.alpha -= 30; + if (Projectile.alpha < 60) { - projectile.alpha = 60; + Projectile.alpha = 60; } } else { - projectile.alpha += 30; - if (projectile.alpha > 150) + Projectile.alpha += 30; + if (Projectile.alpha > 150) { - projectile.alpha = 150; + Projectile.alpha = 150; } } - if (projectile.ai[0] > 0f) + if (Projectile.ai[0] > 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + if (Projectile.ai[0] == 1f && Projectile.ai[1] > 0f && Projectile.owner == Main.myPlayer) { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + Projectile.netUpdate = true; + Vector2 center = Projectile.Center; + center.Y -= (float)num617 * Projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - Projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); center.Y -= (float)num617 * num618 / 2f; center.Y += 2f; - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + Projectile.NewProjectile(center.X, center.Y, Projectile.velocity.X, Projectile.velocity.Y, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 10f, Projectile.ai[1] - 1f); } - if (projectile.ai[0] <= 0f) + if (Projectile.ai[0] <= 0f) { float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)-(float)projectile.direction; - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)-(float)projectile.direction; + float num623 = (float)Projectile.width / 5f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; + Projectile.position.X = Projectile.position.X - num624 * (float)-(float)Projectile.direction; + Projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; + Projectile.position.X = Projectile.position.X + num624 * (float)-(float)Projectile.direction; } } public override Color? GetAlpha(Color lightColor) { - return new Color(60, Main.DiscoG, 190, projectile.alpha); + return new Color(60, Main.DiscoG, 190, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Ranged/SepticSkewerBacteria.cs b/Projectiles/Ranged/SepticSkewerBacteria.cs index eb14a1914e..de0177edc7 100644 --- a/Projectiles/Ranged/SepticSkewerBacteria.cs +++ b/Projectiles/Ranged/SepticSkewerBacteria.cs @@ -16,15 +16,15 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.ranged = true; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; } public override void AI() @@ -34,83 +34,83 @@ namespace CalamityMod.Projectiles.Ranged { num297 = 46; } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, 0f, 0f, 100, default, 2f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, 0f, 0f, 100, default, 2f); Main.dust[num469].noGravity = true; - float num944 = 1f - (float)projectile.alpha / 255f; - num944 *= projectile.scale; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 90f) + float num944 = 1f - (float)Projectile.alpha / 255f; + num944 *= Projectile.scale; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 90f) { - projectile.localAI[0] *= -1f; + Projectile.localAI[0] *= -1f; } - if (projectile.localAI[0] >= 0f) + if (Projectile.localAI[0] >= 0f) { - projectile.scale += 0.003f; + Projectile.scale += 0.003f; } else { - projectile.scale -= 0.003f; + Projectile.scale -= 0.003f; } - projectile.rotation += 0.0025f * projectile.scale; + Projectile.rotation += 0.0025f * Projectile.scale; float num945 = 1f; float num946 = 1f; - if (projectile.identity % 6 == 0) + if (Projectile.identity % 6 == 0) { num946 *= -1f; } - if (projectile.identity % 6 == 1) + if (Projectile.identity % 6 == 1) { num945 *= -1f; } - if (projectile.identity % 6 == 2) + if (Projectile.identity % 6 == 2) { num946 *= -1f; num945 *= -1f; } - if (projectile.identity % 6 == 3) + if (Projectile.identity % 6 == 3) { num946 = 0f; } - if (projectile.identity % 6 == 4) + if (Projectile.identity % 6 == 4) { num945 = 0f; } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 60f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 60f) { - projectile.localAI[1] = -180f; + Projectile.localAI[1] = -180f; } - if (projectile.localAI[1] >= -60f) + if (Projectile.localAI[1] >= -60f) { - projectile.velocity.X = projectile.velocity.X + 0.002f * num946; - projectile.velocity.Y = projectile.velocity.Y + 0.002f * num945; + Projectile.velocity.X = Projectile.velocity.X + 0.002f * num946; + Projectile.velocity.Y = Projectile.velocity.Y + 0.002f * num945; } else { - projectile.velocity.X = projectile.velocity.X - 0.002f * num946; - projectile.velocity.Y = projectile.velocity.Y - 0.002f * num945; + Projectile.velocity.X = Projectile.velocity.X - 0.002f * num946; + Projectile.velocity.Y = Projectile.velocity.Y - 0.002f * num945; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5400f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5400f) { - projectile.damage = 0; - projectile.ai[1] = 1f; - if (projectile.alpha < 255) + Projectile.damage = 0; + Projectile.ai[1] = 1f; + if (Projectile.alpha < 255) { - projectile.alpha += 5; - if (projectile.alpha > 255) + Projectile.alpha += 5; + if (Projectile.alpha > 255) { - projectile.alpha = 255; + Projectile.alpha = 255; } } - else if (projectile.owner == Main.myPlayer) + else if (Projectile.owner == Main.myPlayer) { - projectile.Kill(); + Projectile.Kill(); } } else { - float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; + float num947 = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; if (num947 > 4f) { num947 *= 1.1f; @@ -139,19 +139,19 @@ namespace CalamityMod.Projectiles.Ranged { num947 *= 1.7f; } - projectile.ai[0] += num947; - if (projectile.alpha > 50) + Projectile.ai[0] += num947; + if (Projectile.alpha > 50) { - projectile.alpha -= 10; - if (projectile.alpha < 50) + Projectile.alpha -= 10; + if (Projectile.alpha < 50) { - projectile.alpha = 50; + Projectile.alpha = 50; } } } - if ((double)projectile.velocity.Length() > 0.2) + if ((double)Projectile.velocity.Length() > 0.2) { - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; } } @@ -162,16 +162,16 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 56; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 56; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 171, vector7.X, vector7.Y, 100, default, 0.5f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index 3be3bfc2bd..7ea697b7a9 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -14,49 +14,49 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - projectile.timeLeft = 900; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.timeLeft = 900; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 171, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 171, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - Vector2 vector62 = player.Center - projectile.Center; - projectile.ai[1] += 1f; - if (projectile.ai[1] > 5f) + Vector2 vector62 = player.Center - Projectile.Center; + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 5f) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.ai[1] % 8f == 0f && projectile.owner == Main.myPlayer && Main.rand.NextBool(5)) + if (Projectile.ai[1] % 8f == 0f && Projectile.owner == Main.myPlayer && Main.rand.NextBool(5)) { Vector2 vector63 = vector62 * -1f; vector63.Normalize(); vector63 *= Main.rand.Next(45, 65) * 0.1f; vector63 = vector63.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver2); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.175), projectile.knockBack * 0.2f, projectile.owner, -10f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.175), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f); } if (player.dead) { - projectile.Kill(); + Projectile.Kill(); return; } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - if (projectile.position.X + (float)(projectile.width / 2) > player.position.X + (float)(player.width / 2)) + if (Projectile.position.X + (float)(Projectile.width / 2) > player.position.X + (float)(player.width / 2)) { player.ChangeDir(1); } @@ -65,60 +65,60 @@ namespace CalamityMod.Projectiles.Ranged player.ChangeDir(-1); } } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.extraUpdates = 2; + Projectile.extraUpdates = 2; } else { - projectile.extraUpdates = 3; + Projectile.extraUpdates = 3; } - Vector2 vector14 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector14 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float xDist = player.position.X + (float)(player.width / 2) - vector14.X; float yDist = player.position.Y + (float)(player.height / 2) - vector14.Y; float playerDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { if (playerDist > 2000f) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.ai[1] += 1f; - if (projectile.ai[1] > 5f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 5f) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.ai[1] > 8f) + if (Projectile.ai[1] > 8f) { - projectile.ai[1] = 8f; + Projectile.ai[1] = 8f; } - if (projectile.ai[1] >= 10f) + if (Projectile.ai[1] >= 10f) { - projectile.ai[1] = 15f; - projectile.velocity.Y = projectile.velocity.Y + 0.3f; + Projectile.ai[1] = 15f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.3f; } } - else if (projectile.ai[0] == 1f) + else if (Projectile.ai[0] == 1f) { - projectile.tileCollide = false; - projectile.rotation = (float)Math.Atan2((double)yDist, (double)xDist) - 1.57f; + Projectile.tileCollide = false; + Projectile.rotation = (float)Math.Atan2((double)yDist, (double)xDist) - 1.57f; float returnSpeed = 20f; if (playerDist < 50f) { - projectile.Kill(); + Projectile.Kill(); } playerDist = returnSpeed / playerDist; xDist *= playerDist; yDist *= playerDist; - projectile.velocity.X = xDist; - projectile.velocity.Y = yDist; + Projectile.velocity.X = xDist; + Projectile.velocity.Y = yDist; } } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; return false; } diff --git a/Projectiles/Ranged/ShadeFire.cs b/Projectiles/Ranged/ShadeFire.cs index 2817333c6c..71fa982005 100644 --- a/Projectiles/Ranged/ShadeFire.cs +++ b/Projectiles/Ranged/ShadeFire.cs @@ -14,45 +14,45 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 80; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 80; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.35f / 255f); - if (projectile.timeLeft > 80) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); + if (Projectile.timeLeft > 80) { - projectile.timeLeft = 80; + Projectile.timeLeft = 80; } - if (projectile.ai[0] > 7f) + if (Projectile.ai[0] > 7f) { float num296 = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { num296 = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { num296 = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num297 = 14; if (Main.rand.NextBool(2)) { for (int num298 = 0; num298 < 3; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; dust.scale *= num296; - dust.velocity += projectile.velocity; + dust.velocity += Projectile.velocity; if (!dust.noGravity) { dust.velocity *= 0.5f; @@ -78,9 +78,9 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } } } diff --git a/Projectiles/Ranged/Shell.cs b/Projectiles/Ranged/Shell.cs index 4036c27298..35561d69c1 100644 --- a/Projectiles/Ranged/Shell.cs +++ b/Projectiles/Ranged/Shell.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class Shell : ModProjectile @@ -13,35 +14,35 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 34; - projectile.height = 18; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 5; - projectile.aiStyle = 1; - projectile.arrow = true; - projectile.timeLeft = 600; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 34; + Projectile.height = 18; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 5; + Projectile.aiStyle = 1; + Projectile.arrow = true; + Projectile.timeLeft = 600; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.velocity *= 0.9995f; + Projectile.velocity *= 0.9995f; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 34; - projectile.height = 18; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 34; + Projectile.height = 18; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(0, 255, 255), 1.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(0, 255, 255), 1.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; } diff --git a/Projectiles/Ranged/Shockblast.cs b/Projectiles/Ranged/Shockblast.cs index a3d9b5b2c8..4a6ef4c00e 100644 --- a/Projectiles/Ranged/Shockblast.cs +++ b/Projectiles/Ranged/Shockblast.cs @@ -15,37 +15,37 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0f, 0.25f); + Lighting.AddLight(Projectile.Center, 0f, 0f, 0.25f); float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while (num462 < num461) { - float sizeMultiplier = (projectile.ai[1] * 0.5f) + 1f; + float sizeMultiplier = (Projectile.ai[1] * 0.5f) + 1f; float num463 = Main.rand.Next(-10, 11) * sizeMultiplier; float num464 = Main.rand.Next(-10, 11) * sizeMultiplier; float num465 = Main.rand.Next(3, 9) * sizeMultiplier; @@ -53,12 +53,12 @@ namespace CalamityMod.Projectiles.Ranged num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 185); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 185); Dust dust = Main.dust[num467]; dust.scale = sizeMultiplier; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += Main.rand.Next(-10, 11); dust.position.Y += Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index c6d3dc2f40..fe7f55ebcb 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -12,57 +12,57 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.light = 0.5f; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.light = 0.5f; + Projectile.extraUpdates = 3; aiType = ProjectileID.Bullet; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, projectile.ai[1]); - Main.projectile[proj].scale = (projectile.ai[1] * 0.5f) + 1f; + int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, Projectile.ai[1]); + Main.projectile[proj].scale = (Projectile.ai[1] * 0.5f) + 1f; } return true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override bool PreAI() { //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num136 = 0; num136 < 2; num136++) { - Vector2 dspeed = -projectile.velocity * Main.rand.NextFloat(0.5f, 0.7f); - float x2 = projectile.Center.X - projectile.velocity.X / 10f * num136; - float y2 = projectile.Center.Y - projectile.velocity.Y / 10f * num136; + Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f, 0.7f); + float x2 = Projectile.Center.X - Projectile.velocity.X / 10f * num136; + float y2 = Projectile.Center.Y - Projectile.velocity.Y / 10f * num136; int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 185, 0f, 0f, 0, default, 1f); - Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].alpha = Projectile.alpha; Main.dust[num137].position.X = x2; Main.dust[num137].position.Y = y2; Main.dust[num137].velocity = dspeed; @@ -75,13 +75,13 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, projectile.ai[1]); - Main.projectile[proj].scale = (projectile.ai[1] * 0.5f) + 1f; + int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, Projectile.ai[1]); + Main.projectile[proj].scale = (Projectile.ai[1] * 0.5f) + 1f; } - if (Main.player[projectile.owner].moonLeech) + if (Main.player[Projectile.owner].moonLeech) return; float healAmt = damage * 0.05f; @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Ranged if (healAmt > CalamityMod.lifeStealCap) healAmt = CalamityMod.lifeStealCap; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); } } } diff --git a/Projectiles/Ranged/Shroom.cs b/Projectiles/Ranged/Shroom.cs index af2a730d4f..99c06bbf78 100644 --- a/Projectiles/Ranged/Shroom.cs +++ b/Projectiles/Ranged/Shroom.cs @@ -11,37 +11,37 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Shroom"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.alpha = 80; - projectile.penetrate = 2; - projectile.tileCollide = false; - projectile.timeLeft = 120; - projectile.ranged = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.alpha = 80; + Projectile.penetrate = 2; + Projectile.tileCollide = false; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Ranged; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.6f); - projectile.rotation += 1f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + Lighting.AddLight(Projectile.Center, 0f, 0.2f, 0.6f); + Projectile.rotation += 1f; + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/Sickness.cs b/Projectiles/Ranged/Sickness.cs index d1a7362ee0..6e0bb776e9 100644 --- a/Projectiles/Ranged/Sickness.cs +++ b/Projectiles/Ranged/Sickness.cs @@ -16,53 +16,53 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 5; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.05f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.01f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -73,11 +73,11 @@ namespace CalamityMod.Projectiles.Ranged num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 0.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 0.5f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Ranged/SicknessRound.cs b/Projectiles/Ranged/SicknessRound.cs index 9938e6d6c1..ae1aa1a8ba 100644 --- a/Projectiles/Ranged/SicknessRound.cs +++ b/Projectiles/Ranged/SicknessRound.cs @@ -11,41 +11,41 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.light = 0.25f; - projectile.extraUpdates = 4; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.light = 0.25f; + Projectile.extraUpdates = 4; aiType = ProjectileID.Bullet; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override bool PreAI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - Vector2 dspeed = -projectile.velocity * 0.5f; - float x2 = projectile.Center.X - projectile.velocity.X / 10f; - float y2 = projectile.Center.Y - projectile.velocity.Y / 10f; + Vector2 dspeed = -Projectile.velocity * 0.5f; + float x2 = Projectile.Center.X - Projectile.velocity.X / 10f; + float y2 = Projectile.Center.Y - Projectile.velocity.Y / 10f; int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, dspeed.X, dspeed.Y, 0, default, 1f); - Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].alpha = Projectile.alpha; Main.dust[num137].position.X = x2; Main.dust[num137].position.Y = y2; Main.dust[num137].velocity = dspeed; @@ -53,8 +53,8 @@ namespace CalamityMod.Projectiles.Ranged } //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = (projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi)) + MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = (Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi)) + MathHelper.ToRadians(90) * Projectile.direction; return false; } @@ -66,14 +66,14 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, Main.myPlayer); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), + (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Main.myPlayer); } } } diff --git a/Projectiles/Ranged/SicknessRound2.cs b/Projectiles/Ranged/SicknessRound2.cs index 77a3174d5b..4a2bf38edd 100644 --- a/Projectiles/Ranged/SicknessRound2.cs +++ b/Projectiles/Ranged/SicknessRound2.cs @@ -11,50 +11,50 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.light = 0.15f; - projectile.extraUpdates = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.light = 0.15f; + Projectile.extraUpdates = 1; aiType = ProjectileID.WoodenArrowFriendly; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override bool PreAI() { - Vector2 dspeed = -projectile.velocity * 0.5f; - float x2 = projectile.Center.X - projectile.velocity.X / 10f; - float y2 = projectile.Center.Y - projectile.velocity.Y / 10f; + Vector2 dspeed = -Projectile.velocity * 0.5f; + float x2 = Projectile.Center.X - Projectile.velocity.X / 10f; + float y2 = Projectile.Center.Y - Projectile.velocity.Y / 10f; int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f); - Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].alpha = Projectile.alpha; Main.dust[num137].position.X = x2; Main.dust[num137].position.Y = y2; Main.dust[num137].velocity = dspeed; Main.dust[num137].noGravity = true; //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 12f, 25f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 12f, 25f); return false; } @@ -66,8 +66,8 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Ranged/SlagRound.cs b/Projectiles/Ranged/SlagRound.cs index c077e904de..ee65967e5c 100644 --- a/Projectiles/Ranged/SlagRound.cs +++ b/Projectiles/Ranged/SlagRound.cs @@ -13,30 +13,30 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.extraUpdates = 3; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.aiStyle = 1; + Projectile.extraUpdates = 3; aiType = ProjectileID.Bullet; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - Vector2 dspeed = -projectile.velocity * 0.7f; - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default, 1f); + Vector2 dspeed = -Projectile.velocity * 0.7f; + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 32, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity = dspeed; } @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } @@ -57,20 +57,20 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 32, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (i = 0; i <= 1; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.35), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.35), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Ranged/SlimeBolt.cs b/Projectiles/Ranged/SlimeBolt.cs index df82641be0..29a76b0d15 100644 --- a/Projectiles/Ranged/SlimeBolt.cs +++ b/Projectiles/Ranged/SlimeBolt.cs @@ -14,42 +14,42 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 2; - projectile.timeLeft = 400; + Projectile.width = 6; + Projectile.height = 6; + Projectile.aiStyle = 27; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 2; + Projectile.timeLeft = 400; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.25f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.01f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 20, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - projectile.velocity *= 0.75f; + Projectile.velocity *= 0.75f; } return false; } @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 20, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Ranged/SmallCoral.cs b/Projectiles/Ranged/SmallCoral.cs index 0bddc359e4..93fd3aa149 100644 --- a/Projectiles/Ranged/SmallCoral.cs +++ b/Projectiles/Ranged/SmallCoral.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class SmallCoral : ModProjectile @@ -13,36 +14,36 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 16; - projectile.height = 22; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 16; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.aiStyle = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y = projectile.velocity.Y + 0.01f; - projectile.rotation = projectile.velocity.ToRotation(); - if (projectile.direction == -1) - projectile.rotation += MathHelper.Pi; + Projectile.velocity.X *= 0.9995f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.01f; + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.direction == -1) + Projectile.rotation += MathHelper.Pi; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.Center); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 16; - projectile.height = 16; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 16; + Projectile.height = 16; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 51, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 51, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 2f; } diff --git a/Projectiles/Ranged/SparkSpreaderFire.cs b/Projectiles/Ranged/SparkSpreaderFire.cs index cb5409c373..d9aed39845 100644 --- a/Projectiles/Ranged/SparkSpreaderFire.cs +++ b/Projectiles/Ranged/SparkSpreaderFire.cs @@ -15,51 +15,51 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = projectile.height = 12; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 3; - projectile.extraUpdates = 1; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.width = Projectile.height = 12; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 3; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.45f / 255f, (255 - projectile.alpha) * 0.05f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.45f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); - if (projectile.wet && !projectile.lavaWet) + if (Projectile.wet && !Projectile.lavaWet) { - projectile.Kill(); + Projectile.Kill(); } if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 35, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 80, default, 0.75f); - Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 50, default, 0.75f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 35, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 80, default, 0.75f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 50, default, 0.75f); } - if (projectile.ai[0]++ > 7f) + if (Projectile.ai[0]++ > 7f) { float dustScaleSize = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { dustScaleSize = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { dustScaleSize = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { dustScaleSize = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int dustType = DustID.Fire; for (int i = 0; i < 2; i++) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 10, default, 0.75f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 10, default, 0.75f); Dust dust = Main.dust[fire]; if (Main.rand.Next(3) == 0) { @@ -76,11 +76,11 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; dust.scale *= dustScaleSize; - dust.velocity += projectile.velocity; + dust.velocity += Projectile.velocity; } } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/SporeBomb.cs b/Projectiles/Ranged/SporeBomb.cs index fe01e47791..1d12cf6637 100644 --- a/Projectiles/Ranged/SporeBomb.cs +++ b/Projectiles/Ranged/SporeBomb.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,81 +12,81 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Bomb"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.light = 0.2f; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; + Projectile.light = 0.2f; } public override void AI() { - projectile.alpha -= 2; - if (projectile.localAI[0] == 0f) + Projectile.alpha -= 2; + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.05f; - if (projectile.scale > 1.2f) + Projectile.scale += 0.05f; + if (Projectile.scale > 1.2f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } } else { - projectile.scale -= 0.05f; - if (projectile.scale < 0.8f) + Projectile.scale -= 0.05f; + if (Projectile.scale < 0.8f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 20f && projectile.ai[0] < 40f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 20f && Projectile.ai[0] < 40f) { - projectile.velocity.Y = projectile.velocity.Y + 0.3f; - projectile.velocity.X = projectile.velocity.X * 0.98f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.3f; + Projectile.velocity.X = Projectile.velocity.X * 0.98f; } - else if (projectile.ai[0] >= 40f && projectile.ai[0] < 60f) + else if (Projectile.ai[0] >= 40f && Projectile.ai[0] < 60f) { - projectile.velocity.Y = projectile.velocity.Y - 0.3f; - projectile.velocity.X = projectile.velocity.X * 1.02f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.3f; + Projectile.velocity.X = Projectile.velocity.X * 1.02f; } - else if (projectile.ai[0] >= 60f) + else if (Projectile.ai[0] >= 60f) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; } } public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); + return new Color(Main.DiscoR, 203, 103, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int d = 0; d < 25; d++) { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 1.5f; Main.dust[index].scale = 1.5f; } int sporeAmt = Main.rand.Next(3, 7); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int s = 0; s < sporeAmt; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int proj = Projectile.NewProjectile(projectile.Center, velocity, ProjectileID.SporeGas + Main.rand.Next(3), (int)(projectile.damage * 0.25), 0f, projectile.owner); + int proj = Projectile.NewProjectile(Projectile.Center, velocity, ProjectileID.SporeGas + Main.rand.Next(3), (int)(Projectile.damage * 0.25), 0f, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().forceRanged = true; @@ -98,7 +99,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/SputterComet.cs b/Projectiles/Ranged/SputterComet.cs index 9be340ba81..a2df16395e 100644 --- a/Projectiles/Ranged/SputterComet.cs +++ b/Projectiles/Ranged/SputterComet.cs @@ -5,6 +5,7 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -13,46 +14,46 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Comet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; + Projectile.width = 8; + Projectile.height = 8; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.1f, 0.3f, 0.8f); + Lighting.AddLight(Projectile.Center, 0.1f, 0.3f, 0.8f); if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; + int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = Projectile.alpha; Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -65,11 +66,11 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } for (int num480 = 0; num480 < 3; num480++) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } } } diff --git a/Projectiles/Ranged/SputterCometBig.cs b/Projectiles/Ranged/SputterCometBig.cs index e7c6207fd0..e31b616ae5 100644 --- a/Projectiles/Ranged/SputterCometBig.cs +++ b/Projectiles/Ranged/SputterCometBig.cs @@ -5,6 +5,7 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -13,47 +14,47 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Comet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; + Projectile.width = 8; + Projectile.height = 8; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); + Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; + int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = Projectile.alpha; Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 150f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 150f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -64,20 +65,20 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item93, projectile.position); - if (projectile.owner == Main.myPlayer) + SoundEngine.PlaySound(SoundID.Item93, Projectile.position); + if (Projectile.owner == Main.myPlayer) { - int flash = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + int flash = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); Main.projectile[flash].usesLocalNPCImmunity = true; Main.projectile[flash].localNPCHitCooldown = 10; } for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } for (int num480 = 0; num480 < 3; num480++) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } } } diff --git a/Projectiles/Ranged/SpykerProj.cs b/Projectiles/Ranged/SpykerProj.cs index 8839bfb3b4..59a5e56a6e 100644 --- a/Projectiles/Ranged/SpykerProj.cs +++ b/Projectiles/Ranged/SpykerProj.cs @@ -11,38 +11,38 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Spyker"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.ranged = true; - projectile.extraUpdates = 2; - projectile.aiStyle = 93; + Projectile.width = 10; + Projectile.height = 10; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 2; + Projectile.aiStyle = 93; aiType = ProjectileID.NailFriendly; } public override void AI() { - projectile.alpha -= 10; - if (projectile.alpha < 0) + Projectile.alpha -= 10; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 4f) { for (int num468 = 0; num468 < 2; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, default, 0.75f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 46, 0f, 0f, 100, default, 0.75f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -51,32 +51,32 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 1; + target.immune[Projectile.owner] = 1; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - if (projectile.owner == Main.myPlayer) + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 32; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + if (Projectile.owner == Main.myPlayer) { for (int p = 0; p < 3; p++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner); } } for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -86,10 +86,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Ranged/StarfleetMK2Gun.cs b/Projectiles/Ranged/StarfleetMK2Gun.cs index ce44e99b01..24b0c218f4 100644 --- a/Projectiles/Ranged/StarfleetMK2Gun.cs +++ b/Projectiles/Ranged/StarfleetMK2Gun.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -19,40 +20,40 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 122; - projectile.height = 50; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 122; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 32f / 255f, 208f / 255f, 255f / 255f); - Player player = Main.player[projectile.owner]; - projectile.ai[1]--; - if (projectile.ai[0] >= 0f) + Lighting.AddLight(Projectile.Center, 32f / 255f, 208f / 255f, 255f / 255f); + Player player = Main.player[Projectile.owner]; + Projectile.ai[1]--; + if (Projectile.ai[0] >= 0f) { - projectile.ai[0] += 1f; - switch ((int)projectile.ai[0]) + Projectile.ai[0] += 1f; + switch ((int)Projectile.ai[0]) { case 90: case 180: case 270: case 360: case 450: - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; break; case 540: - projectile.localAI[0] += 1f; - projectile.ai[0] = -1f; - Main.PlaySound(SoundID.Item14, projectile.Center); + Projectile.localAI[0] += 1f; + Projectile.ai[0] = -1f; + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { - Vector2 source = Vector2.Normalize(projectile.velocity) * 9f; + Vector2 source = Vector2.Normalize(Projectile.velocity) * 9f; source = source.RotatedBy((d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt, default) + player.Center; Vector2 dustVel = source - player.Center; int index = Dust.NewDust(source + dustVel, 0, 0, 221, 0f, 0f, 0, default, 4f); @@ -65,19 +66,19 @@ namespace CalamityMod.Projectiles.Ranged int baseUseTime = 27; //Ranges from 27 to 15 use time int modifier = 2; bool timeToFire = false; - if (projectile.ai[1] <= 0f) + if (Projectile.ai[1] <= 0f) { - projectile.ai[1] = baseUseTime - modifier * projectile.localAI[0]; + Projectile.ai[1] = baseUseTime - modifier * Projectile.localAI[0]; timeToFire = true; } bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; - if (projectile.soundDelay <= 0 && canFire) + if (Projectile.soundDelay <= 0 && canFire) { - projectile.soundDelay = baseUseTime - modifier * (int)projectile.localAI[0]; - if (projectile.ai[0] != 1f) - Main.PlaySound(SoundID.Item92, projectile.Center); + Projectile.soundDelay = baseUseTime - modifier * (int)Projectile.localAI[0]; + if (Projectile.ai[0] != 1f) + SoundEngine.PlaySound(SoundID.Item92, Projectile.Center); } - if (timeToFire && Main.myPlayer == projectile.owner) + if (timeToFire && Main.myPlayer == Projectile.owner) { if (canFire) { @@ -90,15 +91,15 @@ namespace CalamityMod.Projectiles.Ranged { knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack); Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); - projectile.velocity = Main.screenPosition - playerPosition; - projectile.velocity.X += Main.mouseX; - projectile.velocity.Y += Main.mouseY; + Projectile.velocity = Main.screenPosition - playerPosition; + Projectile.velocity.X += Main.mouseX; + Projectile.velocity.Y += Main.mouseY; if (player.gravDir == -1f) - projectile.velocity.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - playerPosition.Y; - projectile.velocity.Normalize(); - float variation = (1f + projectile.localAI[0]) * 3f; + Projectile.velocity.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - playerPosition.Y; + Projectile.velocity.Normalize(); + float variation = (1f + Projectile.localAI[0]) * 3f; Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); - Vector2 speed = projectile.velocity * shootSpeed * Main.rand.NextFloat(0.6f, 1.2f); + Vector2 speed = Projectile.velocity * shootSpeed * Main.rand.NextFloat(0.6f, 1.2f); type = Utils.SelectRandom(Main.rand, new int[] { ModContent.ProjectileType(), @@ -107,7 +108,7 @@ namespace CalamityMod.Projectiles.Ranged ModContent.ProjectileType(), ProjectileID.Starfury }); - int star = Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner); + int star = Projectile.NewProjectile(position, speed, type, damage, knockBack, Projectile.owner); if (star.WithinBounds(Main.maxProjectiles)) { Main.projectile[star].penetrate = 1; @@ -115,26 +116,26 @@ namespace CalamityMod.Projectiles.Ranged Main.projectile[star].Calamity().forceRanged = true; Main.projectile[star].netUpdate = true; } - projectile.netUpdate = true; + Projectile.netUpdate = true; } } else { - projectile.Kill(); + Projectile.Kill(); } } - projectile.rotation = projectile.velocity.ToRotation(); - Vector2 displayOffset = new Vector2(27f, -10f * projectile.direction).RotatedBy(projectile.rotation); - projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; - if (projectile.spriteDirection == -1) - projectile.rotation += MathHelper.Pi; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.rotation = Projectile.velocity.ToRotation(); + Vector2 displayOffset = new Vector2(27f, -10f * Projectile.direction).RotatedBy(Projectile.rotation); + Projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; + if (Projectile.spriteDirection == -1) + Projectile.rotation += MathHelper.Pi; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); + player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * Projectile.direction, Projectile.velocity.X * Projectile.direction); } public override bool CanDamage() => false; diff --git a/Projectiles/Ranged/StormSurgeTornado.cs b/Projectiles/Ranged/StormSurgeTornado.cs index 1f29cc4e4b..c93f2dc08f 100644 --- a/Projectiles/Ranged/StormSurgeTornado.cs +++ b/Projectiles/Ranged/StormSurgeTornado.cs @@ -10,51 +10,51 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Surge"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 66; - projectile.height = 66; - projectile.scale = 0.5f; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 2; - projectile.ranged = true; + Projectile.width = 66; + Projectile.height = 66; + Projectile.scale = 0.5f; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 2; + Projectile.DamageType = DamageClass.Ranged; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 1.25f, 1.25f); - if (projectile.scale <= 2f) + Lighting.AddLight(Projectile.Center, 0f, 1.25f, 1.25f); + if (Projectile.scale <= 2f) { - projectile.scale *= 1.03f; + Projectile.scale *= 1.03f; } - if (projectile.scale >= 2f) + if (Projectile.scale >= 2f) { - projectile.Kill(); + Projectile.Kill(); } - projectile.frameCounter++; - if (projectile.frameCounter > 2) + Projectile.frameCounter++; + if (Projectile.frameCounter > 2) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 6) + if (Projectile.frame >= 6) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Ranged/SulphuricBlast.cs b/Projectiles/Ranged/SulphuricBlast.cs index a91996e882..b56c053065 100644 --- a/Projectiles/Ranged/SulphuricBlast.cs +++ b/Projectiles/Ranged/SulphuricBlast.cs @@ -13,40 +13,40 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphuric Blast"); - Main.projFrames[projectile.type] = 20; + Main.projFrames[Projectile.type] = 20; } public override void SetDefaults() { - projectile.width = 36; - projectile.height = 36; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.MaxUpdates = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = projectile.MaxUpdates * 12; + Projectile.width = 36; + Projectile.height = 36; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.MaxUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12; } public override void AI() { - if (projectile.FinalExtraUpdate()) - projectile.frameCounter++; - projectile.frame = projectile.frameCounter / 4 % Main.projFrames[projectile.type]; + if (Projectile.FinalExtraUpdate()) + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 4 % Main.projFrames[Projectile.type]; - projectile.StickyProjAI(8); - projectile.Opacity = Utils.InverseLerp(CalamityUtils.SecondsToFrames(TotalSecondsToStick), CalamityUtils.SecondsToFrames(TotalSecondsToStick * 0.5f), projectile.localAI[0], true); + Projectile.StickyProjAI(8); + Projectile.Opacity = Utils.InverseLerp(CalamityUtils.SecondsToFrames(TotalSecondsToStick), CalamityUtils.SecondsToFrames(TotalSecondsToStick * 0.5f), Projectile.localAI[0], true); // Emit sulpuric gas. - if (Main.netMode != NetmodeID.Server && projectile.FinalExtraUpdate() && projectile.velocity.Length() > 3f) + if (Main.netMode != NetmodeID.Server && Projectile.FinalExtraUpdate() && Projectile.velocity.Length() > 3f) { Color color = new Color(136, 211, 113, 127); Color fadeColor = new Color(165, 165, 86); - Vector2 gasSpawnPosition = projectile.Center + Main.rand.NextVector2Circular(8f, 8f); - Vector2 gasVelocity = projectile.velocity * 1.2f + projectile.velocity.RotatedBy(0.75f) * 0.3f; + Vector2 gasSpawnPosition = Projectile.Center + Main.rand.NextVector2Circular(8f, 8f); + Vector2 gasVelocity = Projectile.velocity * 1.2f + Projectile.velocity.RotatedBy(0.75f) * 0.3f; gasVelocity *= Main.rand.NextFloat(0.24f, 0.6f); Particle gas = new MediumMistParticle(gasSpawnPosition, gasVelocity, color, fadeColor, Main.rand.NextFloat(0.5f, 1f), 205 - Main.rand.Next(50), 0.02f); @@ -54,16 +54,16 @@ namespace CalamityMod.Projectiles.Ranged } // Home in on enemies if not sticking to anything. - if (projectile.ai[0] != 1f) + if (Projectile.ai[0] != 1f) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 720f, 16f, projectile.MaxUpdates * 20f); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 720f, 16f, Projectile.MaxUpdates * 20f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(2, true); + Projectile.ModifyHitNPCSticky(2, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -77,10 +77,10 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Ranged/SuperballBulletProj.cs b/Projectiles/Ranged/SuperballBulletProj.cs index 2799dfd6cc..e1b802304e 100644 --- a/Projectiles/Ranged/SuperballBulletProj.cs +++ b/Projectiles/Ranged/SuperballBulletProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,33 +12,33 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Superball Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 5; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 5; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { if (Main.rand.NextBool(3)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 87, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; + int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 87, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = Projectile.alpha; Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; } @@ -46,38 +47,38 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; - if (projectile.extraUpdates < 5) - projectile.extraUpdates++; + if (Projectile.extraUpdates < 5) + Projectile.extraUpdates++; - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); } return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 87, projectile.oldVelocity.X * 0.05f, projectile.oldVelocity.Y * 0.05f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 87, Projectile.oldVelocity.X * 0.05f, Projectile.oldVelocity.Y * 0.05f); } } } diff --git a/Projectiles/Ranged/SurgeDriverHoldout.cs b/Projectiles/Ranged/SurgeDriverHoldout.cs index 463423cf42..617c301951 100644 --- a/Projectiles/Ranged/SurgeDriverHoldout.cs +++ b/Projectiles/Ranged/SurgeDriverHoldout.cs @@ -1,34 +1,35 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class SurgeDriverHoldout : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; - public ref float ShootCountdown => ref projectile.ai[0]; + public ref float ShootCountdown => ref Projectile.ai[0]; public override void SetStaticDefaults() => DisplayName.SetDefault("Surge Driver"); public override void SetDefaults() { - projectile.width = 192; - projectile.height = 52; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 192; + Projectile.height = 52; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } public override void AI() { if (!OwnerCanShoot) - projectile.Kill(); + Projectile.Kill(); Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - armPosition += projectile.velocity.SafeNormalize(Owner.direction * Vector2.UnitX) * 32f; + armPosition += Projectile.velocity.SafeNormalize(Owner.direction * Vector2.UnitX) * 32f; armPosition.Y -= 12f; UpdateProjectileHeldVariables(armPosition); @@ -37,25 +38,25 @@ namespace CalamityMod.Projectiles.Ranged ShootCountdown--; if (ShootCountdown <= 0f) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { ShootProjectiles(armPosition); ShootCountdown = 28f; - projectile.netUpdate = true; + Projectile.netUpdate = true; } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), Projectile.Center); } } public void ShootProjectiles(Vector2 armPosition) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; Item heldItem = Owner.ActiveItem(); int projectileType = ModContent.ProjectileType(); - float shootSpeed = heldItem.shootSpeed * projectile.scale * 0.64f; + float shootSpeed = heldItem.shootSpeed * Projectile.scale * 0.64f; int damage = (int)(Owner.GetWeaponDamage(heldItem) * 6.66); float knockback = heldItem.knockBack; @@ -64,36 +65,36 @@ namespace CalamityMod.Projectiles.Ranged projectileType = ModContent.ProjectileType(); knockback = Owner.GetWeaponKnockback(heldItem, knockback); - Vector2 shootDirection = (Main.MouseWorld - projectile.Center).SafeNormalize(-Vector2.UnitY); + Vector2 shootDirection = (Main.MouseWorld - Projectile.Center).SafeNormalize(-Vector2.UnitY); Vector2 shootVelocity = shootDirection * shootSpeed; // Sync if the shoot direction changes. - if (shootDirection.X != projectile.velocity.X || shootDirection.Y != projectile.velocity.Y) - projectile.netUpdate = true; + if (shootDirection.X != Projectile.velocity.X || shootDirection.Y != Projectile.velocity.Y) + Projectile.netUpdate = true; Vector2 gunTip = armPosition + shootDirection * heldItem.scale * 130f; - Projectile.NewProjectile(gunTip, shootVelocity, projectileType, damage, knockback, projectile.owner, 0f, 0f); + Projectile.NewProjectile(gunTip, shootVelocity, projectileType, damage, knockback, Projectile.owner, 0f, 0f); - projectile.velocity = shootDirection; + Projectile.velocity = shootDirection; } public void UpdateProjectileHeldVariables(Vector2 armPosition) { - projectile.position = armPosition - projectile.Size * 0.5f; - projectile.rotation = projectile.velocity.ToRotation(); - if (projectile.spriteDirection == -1) - projectile.rotation += MathHelper.Pi; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; + Projectile.position = armPosition - Projectile.Size * 0.5f; + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.spriteDirection == -1) + Projectile.rotation += MathHelper.Pi; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; } public void ManipulatePlayerVariables() { - Owner.ChangeDir(projectile.direction); - Owner.heldProj = projectile.whoAmI; + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } } } diff --git a/Projectiles/Ranged/TealExoArrow.cs b/Projectiles/Ranged/TealExoArrow.cs index 8f7f2b288b..593fd236bb 100644 --- a/Projectiles/Ranged/TealExoArrow.cs +++ b/Projectiles/Ranged/TealExoArrow.cs @@ -16,40 +16,40 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.arrow = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.arrow = true; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (Projectile.alpha > 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; float num55 = 40f; float num56 = 1.5f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - projectile.localAI[0] = num55; + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) + Projectile.localAI[0] = num55; } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - projectile.Kill(); + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) + Projectile.Kill(); } } @@ -57,8 +57,8 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs(); - public override Color? GetAlpha(Color lightColor) => new Color(0, 100, 100, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(0, 100, 100, Projectile.alpha); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(40f, 1.5f, lightColor); } } diff --git a/Projectiles/Ranged/TelluricGlareArrow.cs b/Projectiles/Ranged/TelluricGlareArrow.cs index 50b65b243a..1eee59aaf7 100644 --- a/Projectiles/Ranged/TelluricGlareArrow.cs +++ b/Projectiles/Ranged/TelluricGlareArrow.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -24,34 +25,34 @@ namespace CalamityMod.Projectiles.Ranged { DisplayName.SetDefault("Radiant Arrow"); // While this projectile doesn't have afterimages, it keeps track of old positions for its primitive drawcode. - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 21; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 21; } public override void SetDefaults() { - projectile.width = projectile.height = 24; - projectile.arrow = true; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = Lifetime; - projectile.MaxUpdates = 3; - projectile.penetrate = 2; // Can hit up to two enemies. Will explode extremely soon after hitting the first, though. - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = Projectile.height = 24; + Projectile.arrow = true; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = Lifetime; + Projectile.MaxUpdates = 3; + Projectile.penetrate = 2; // Can hit up to two enemies. Will explode extremely soon after hitting the first, though. + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } - public override bool CanDamage() => projectile.timeLeft < Lifetime - 4; + public override bool CanDamage() => Projectile.timeLeft < Lifetime - 4; - public override void AI() => Lighting.AddLight(projectile.Center, ShaderColorOne.ToVector3()); + public override void AI() => Lighting.AddLight(Projectile.Center, ShaderColorOne.ToVector3()); private void RestrictLifetime() { - if (projectile.timeLeft > 8) - projectile.timeLeft = 8; + if (Projectile.timeLeft > 8) + Projectile.timeLeft = 8; } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -99,21 +100,21 @@ namespace CalamityMod.Projectiles.Ranged if (TrailDrawer is null) TrailDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/TelluricGlareStreak")); - Vector2 overallOffset = projectile.Size * 0.5f - Main.screenPosition; - overallOffset += projectile.velocity * 1.4f; - TrailDrawer.Draw(projectile.oldPos, overallOffset, 92); // 58 + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/TelluricGlareStreak")); + Vector2 overallOffset = Projectile.Size * 0.5f - Main.screenPosition; + overallOffset += Projectile.velocity * 1.4f; + TrailDrawer.Draw(Projectile.oldPos, overallOffset, 92); // 58 return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); // Explode into a bunch of holy fire on death. for (int i = 0; i < 10; i++) { - Dust holyFire = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); + Dust holyFire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); holyFire.velocity *= 3f; if (Main.rand.NextBool(2)) @@ -124,11 +125,11 @@ namespace CalamityMod.Projectiles.Ranged } for (int i = 0; i < 20; i++) { - Dust holyFire = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + Dust holyFire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); holyFire.noGravity = true; holyFire.velocity *= 5f; - holyFire = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + holyFire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); holyFire.velocity *= 2f; } } diff --git a/Projectiles/Ranged/TerraArrowMain.cs b/Projectiles/Ranged/TerraArrowMain.cs index 4d7d18cab1..e26604f2a7 100644 --- a/Projectiles/Ranged/TerraArrowMain.cs +++ b/Projectiles/Ranged/TerraArrowMain.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class TerraArrowMain : ModProjectile @@ -16,42 +17,42 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { if (!initialized) { - projectile.velocity *= 0.5f; + Projectile.velocity *= 0.5f; initialized = true; } - if (projectile.FinalExtraUpdate() && initialized) + if (Projectile.FinalExtraUpdate() && initialized) { - projectile.velocity *= 1.003f; - if (projectile.velocity.Length() >= 22f) + Projectile.velocity *= 1.003f; + if (Projectile.velocity.Length() >= 22f) { - projectile.Kill(); + Projectile.Kill(); } } - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 32); - Main.PlaySound(SoundID.Item60, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 32); + SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); for (int d = 0; d < 3; d++) { - int terra = Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 100, default, 2f); + int terra = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 2f); Main.dust[terra].velocity *= 1.2f; if (Main.rand.NextBool(2)) { @@ -59,12 +60,12 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[terra].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int a = 0; a < 2; a++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 0f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Ranged/TerraArrowSplit.cs b/Projectiles/Ranged/TerraArrowSplit.cs index 87ed765170..aef43f0d16 100644 --- a/Projectiles/Ranged/TerraArrowSplit.cs +++ b/Projectiles/Ranged/TerraArrowSplit.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class TerraArrowSplit : ModProjectile @@ -15,40 +16,40 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 120; - projectile.aiStyle = 1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 120; + Projectile.aiStyle = 1; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 90 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.alpha -= 5; - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.alpha -= 5; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (projectile.timeLeft < 90) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 12f, 20f); + if (Projectile.timeLeft < 90) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 12f, 20f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item60, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 30; - projectile.height = 30; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item60, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 30; + Projectile.height = 30; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 2; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, default, 2f); if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; diff --git a/Projectiles/Ranged/TerraBulletMain.cs b/Projectiles/Ranged/TerraBulletMain.cs index db8117a890..7bb29fbe9b 100644 --- a/Projectiles/Ranged/TerraBulletMain.cs +++ b/Projectiles/Ranged/TerraBulletMain.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,39 +12,39 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Terra Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.alpha = 255; - projectile.extraUpdates = 3; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.alpha = 255; + Projectile.extraUpdates = 3; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.4f, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.4f, 0f); // localAI is used as an invisibility counter. The bullet fades into existence after 15 startup frames. - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { // After 15 frames, the alpha will be exactly 0 - if (projectile.alpha > 0) - projectile.alpha -= 17; + if (Projectile.alpha > 0) + Projectile.alpha -= 17; // Dust type 74, scale 0.8, no gravity, no light, no velocity - Vector2 pos = projectile.Center - projectile.velocity * 0.1f; + Vector2 pos = Projectile.Center - Projectile.velocity * 0.1f; Dust d = Dust.NewDustDirect(pos, 0, 0, 74, Scale: 0.8f); d.position = pos; d.velocity = Vector2.Zero; @@ -54,21 +55,21 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int b = 0; b < 2; b++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 0f, Projectile.owner, 0f, 0f); } } - Main.PlaySound(SoundID.Item118, projectile.position); + SoundEngine.PlaySound(SoundID.Item118, Projectile.position); } } } diff --git a/Projectiles/Ranged/TerraBulletSplit.cs b/Projectiles/Ranged/TerraBulletSplit.cs index 729253a2e8..d8d66c3cdc 100644 --- a/Projectiles/Ranged/TerraBulletSplit.cs +++ b/Projectiles/Ranged/TerraBulletSplit.cs @@ -13,53 +13,53 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 120; - projectile.extraUpdates = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 120; + Projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 90 && target.CanBeChasedBy(Projectile); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.alpha > 0) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + if (Projectile.alpha > 0) { - projectile.alpha -= 85; + Projectile.alpha -= 85; } - float x2 = projectile.position.X - projectile.velocity.X / 10f; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f; + float x2 = Projectile.position.X - Projectile.velocity.X / 10f; + float y2 = Projectile.position.Y - Projectile.velocity.Y / 10f; int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 74, 0f, 0f, 0, default, 0.8f); - Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].alpha = Projectile.alpha; Main.dust[num137].position.X = x2; Main.dust[num137].position.Y = y2; Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; if (speed == 0f) - speed = projectile.velocity.Length(); + speed = Projectile.velocity.Length(); - if (projectile.timeLeft < 90) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, speed, 12f); + if (Projectile.timeLeft < 90) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, speed, 12f); } } } diff --git a/Projectiles/Ranged/TerraFireGreen.cs b/Projectiles/Ranged/TerraFireGreen.cs index 76f82c7c99..b57a12feda 100644 --- a/Projectiles/Ranged/TerraFireGreen.cs +++ b/Projectiles/Ranged/TerraFireGreen.cs @@ -16,45 +16,45 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 120; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 120; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.45f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - if (projectile.timeLeft > 120) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.45f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); + if (Projectile.timeLeft > 120) { - projectile.timeLeft = 120; + Projectile.timeLeft = 120; } - if (projectile.ai[0] > 7f) + if (Projectile.ai[0] > 7f) { float num296 = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { num296 = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { num296 = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num297 = 107; if (Main.rand.NextBool(2)) { for (int num298 = 0; num298 < 3; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 0.75f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 0.75f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; dust.scale *= num296; - dust.velocity += projectile.velocity; + dust.velocity += Projectile.velocity; if (!dust.noGravity) { dust.velocity *= 0.5f; @@ -80,14 +80,14 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; target.AddBuff(BuffID.CursedInferno, 90); } } diff --git a/Projectiles/Ranged/TerraFireGreen2.cs b/Projectiles/Ranged/TerraFireGreen2.cs index 8b502dc371..785b926ced 100644 --- a/Projectiles/Ranged/TerraFireGreen2.cs +++ b/Projectiles/Ranged/TerraFireGreen2.cs @@ -16,43 +16,43 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = 2; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 9; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 2; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 90; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 9; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.15f, 0.45f, 0f); - if (projectile.ai[0] > 7f) + Lighting.AddLight(Projectile.Center, 0.15f, 0.45f, 0f); + if (Projectile.ai[0] > 7f) { float num296 = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { num296 = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { num296 = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num297 = 66; if (Main.rand.NextBool(2)) { for (int num298 = 0; num298 < 2; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { @@ -69,15 +69,15 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; dust.scale *= num296; - dust.velocity += projectile.velocity; + dust.velocity += Projectile.velocity; } } } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/TheMaelstromExplosion.cs b/Projectiles/Ranged/TheMaelstromExplosion.cs index 79a63ccd60..6c49d843bd 100644 --- a/Projectiles/Ranged/TheMaelstromExplosion.cs +++ b/Projectiles/Ranged/TheMaelstromExplosion.cs @@ -12,29 +12,29 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 75; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 75; } public override void SetDefaults() { - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.scale = 0.1f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.scale = 0.1f; // Hardcoded spaghetti appearss to make the scale setting above tamper with the hitbox. - projectile.width = projectile.height = (int)(120 / projectile.scale); - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; + Projectile.width = Projectile.height = (int)(120 / Projectile.scale); + Projectile.timeLeft = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; } public override void AI() { - projectile.scale = MathHelper.Lerp(projectile.scale, 1f, 0.125f); - projectile.Opacity = projectile.scale * Utils.InverseLerp(0f, 30f, projectile.timeLeft, true); + Projectile.scale = MathHelper.Lerp(Projectile.scale, 1f, 0.125f); + Projectile.Opacity = Projectile.scale * Utils.InverseLerp(0f, 30f, Projectile.timeLeft, true); // Emit sparks and dust. if (Main.netMode != NetmodeID.Server) @@ -44,11 +44,11 @@ namespace CalamityMod.Projectiles.Ranged Color sparkColor = Color.Lerp(Color.Cyan, Color.DarkBlue, Main.rand.NextFloat(0.7f)); Vector2 sparkVelocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(3f, 8f); - SparkParticle spark = new SparkParticle(projectile.Center, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); + SparkParticle spark = new SparkParticle(Projectile.Center, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); GeneralParticleHandler.SpawnParticle(spark); - Vector2 dustSpawnOffset = Main.rand.NextVector2Circular(projectile.width, projectile.height) * projectile.scale * 0.4f; - Dust electricity = Dust.NewDustPerfect(projectile.Center + dustSpawnOffset, 267); + Vector2 dustSpawnOffset = Main.rand.NextVector2Circular(Projectile.width, Projectile.height) * Projectile.scale * 0.4f; + Dust electricity = Dust.NewDustPerfect(Projectile.Center + dustSpawnOffset, 267); electricity.color = Color.Cyan; electricity.color.A = 84; electricity.scale *= Main.rand.NextFloat(0.7f, 1.2f); @@ -60,26 +60,26 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; Vector2 origin = texture.Size() * 0.5f; - float scale = projectile.scale * projectile.width / texture.Width; - Color frontAfterimageColor = projectile.GetAlpha(Color.Lerp(Color.Cyan, Color.DarkBlue, projectile.identity / 7f % 0.8f)) * 0.2f; + float scale = Projectile.scale * Projectile.width / texture.Width; + Color frontAfterimageColor = Projectile.GetAlpha(Color.Lerp(Color.Cyan, Color.DarkBlue, Projectile.identity / 7f % 0.8f)) * 0.2f; frontAfterimageColor.A = 0; for (int i = 0; i < 12; i++) { - Vector2 drawOffset = (MathHelper.TwoPi * i / 12f + projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 2f; - Vector2 afterimageDrawPosition = projectile.Center + drawOffset - Main.screenPosition; - spriteBatch.Draw(texture, afterimageDrawPosition, null, frontAfterimageColor, projectile.rotation, origin, scale, SpriteEffects.None, 0f); + Vector2 drawOffset = (MathHelper.TwoPi * i / 12f + Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 2f; + Vector2 afterimageDrawPosition = Projectile.Center + drawOffset - Main.screenPosition; + spriteBatch.Draw(texture, afterimageDrawPosition, null, frontAfterimageColor, Projectile.rotation, origin, scale, SpriteEffects.None, 0f); } return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - return CalamityUtils.CircularHitboxCollision(projectile.Center, projectile.Size.Length() * projectile.scale / 1.414f, targetHitbox); + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.Size.Length() * Projectile.scale / 1.414f, targetHitbox); } - public override bool CanDamage() => projectile.Opacity > 0.4f; + public override bool CanDamage() => Projectile.Opacity > 0.4f; } } diff --git a/Projectiles/Ranged/TheMaelstromShark.cs b/Projectiles/Ranged/TheMaelstromShark.cs index f502598166..4146cf0977 100644 --- a/Projectiles/Ranged/TheMaelstromShark.cs +++ b/Projectiles/Ranged/TheMaelstromShark.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -14,91 +15,91 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Reaper Shark"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 44; - projectile.height = 44; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.Opacity = 0f; - projectile.ranged = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 44; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.Opacity = 0f; + Projectile.DamageType = DamageClass.Ranged; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.frameCounter++; - projectile.frame = projectile.frameCounter / 5 % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; - projectile.rotation = projectile.velocity.ToRotation(); - projectile.spriteDirection = (Math.Cos(projectile.rotation) > 0f).ToDirectionInt(); - if (projectile.spriteDirection == -1) - projectile.rotation += MathHelper.Pi; + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.spriteDirection = (Math.Cos(Projectile.rotation) > 0f).ToDirectionInt(); + if (Projectile.spriteDirection == -1) + Projectile.rotation += MathHelper.Pi; - projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.1f, 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.1f, 0f, 1f); } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); return true; } internal Color ColorFunction(float completionRatio) { - float fadeOpacity = Utils.InverseLerp(0.94f, 0.54f, completionRatio, true) * projectile.Opacity; + float fadeOpacity = Utils.InverseLerp(0.94f, 0.54f, completionRatio, true) * Projectile.Opacity; return Color.Lerp(Color.Cyan, Color.White, 0.4f) * fadeOpacity; } internal float WidthFunction(float completionRatio) { float expansionCompletion = 1f - (float)Math.Pow(1f - Utils.InverseLerp(0f, 0.3f, completionRatio, true), 2D); - return MathHelper.Lerp(0f, 12f * projectile.Opacity, expansionCompletion); + return MathHelper.Lerp(0f, 12f * Projectile.Opacity, expansionCompletion); } public override void Kill(int timeLeft) { // Create death effects for the shark, including a death sound, gore, and some blood. - Main.PlaySound(SoundID.NPCDeath1, projectile.Center); - Gore.NewGore(projectile.position, projectile.velocity, mod.GetGoreSlot("Gores/MaelstromReaperShark1"), projectile.scale); - Gore.NewGore(projectile.position, projectile.velocity, mod.GetGoreSlot("Gores/MaelstromReaperShark2"), projectile.scale); - Gore.NewGore(projectile.position, projectile.velocity, mod.GetGoreSlot("Gores/MaelstromReaperShark3"), projectile.scale); + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); + Gore.NewGore(Projectile.position, Projectile.velocity, Mod.GetGoreSlot("Gores/MaelstromReaperShark1"), Projectile.scale); + Gore.NewGore(Projectile.position, Projectile.velocity, Mod.GetGoreSlot("Gores/MaelstromReaperShark2"), Projectile.scale); + Gore.NewGore(Projectile.position, Projectile.velocity, Mod.GetGoreSlot("Gores/MaelstromReaperShark3"), Projectile.scale); for (int i = 0; i < 12; i++) { - Dust blood = Dust.NewDustPerfect(projectile.Center, 5); + Dust blood = Dust.NewDustPerfect(Projectile.Center, 5); blood.velocity = Main.rand.NextVector2Circular(6f, 6f); blood.scale *= Main.rand.NextFloat(0.7f, 1.3f); blood.noGravity = true; } - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Texture2D texture = Main.projectileTexture[Projectile.type]; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; - Vector2 drawPosition = projectile.Center - Main.screenPosition; - SpriteEffects direction = projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; if (LightningTrailDrawer is null) LightningTrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/ScarletDevilStreak")); - LightningTrailDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f - Main.screenPosition, 60); - spriteBatch.Draw(texture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, direction, 0f); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/ScarletDevilStreak")); + LightningTrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 60); + spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0f); return false; } } diff --git a/Projectiles/Ranged/ThePackMinissile.cs b/Projectiles/Ranged/ThePackMinissile.cs index f05dfe1431..71d72ac9f0 100644 --- a/Projectiles/Ranged/ThePackMinissile.cs +++ b/Projectiles/Ranged/ThePackMinissile.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ThePackMinissile : ModProjectile @@ -10,42 +11,42 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Pack Minissile"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.ignoreWater = true; + Projectile.width = 30; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 15f); - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 15f); + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 10; i++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default, 1f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 255, 0f, 0f, 0, default, 1f); } } diff --git a/Projectiles/Ranged/ThePackMissile.cs b/Projectiles/Ranged/ThePackMissile.cs index 6d59abf800..80d2f49648 100644 --- a/Projectiles/Ranged/ThePackMissile.cs +++ b/Projectiles/Ranged/ThePackMissile.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ThePackMissile : ModProjectile @@ -11,48 +12,48 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Pack Missile"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - Vector2 targetCenter = projectile.Center; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Vector2 targetCenter = Projectile.Center; float minTargetDistance = 2500f; bool homeIn = false; for (int i = 0; i < 200; i++) { - if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + if (Main.npc[i].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) { - float distanceFromTarget = projectile.Center.ManhattanDistance(Main.npc[i].Center); + float distanceFromTarget = Projectile.Center.ManhattanDistance(Main.npc[i].Center); if (distanceFromTarget < 200f) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int j = 0; j < 5; j++) { Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(6f, 12f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); } } - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.Kill(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.Kill(); return; } else if (distanceFromTarget < minTargetDistance) @@ -65,33 +66,33 @@ namespace CalamityMod.Projectiles.Ranged } if (homeIn) { - projectile.velocity = (projectile.velocity * 15f + projectile.SafeDirectionTo(targetCenter) * 30f) / 16f; + Projectile.velocity = (Projectile.velocity * 15f + Projectile.SafeDirectionTo(targetCenter) * 30f) / 16f; return; } - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } public override void Kill(int timeLeft) { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 400; - projectile.height = 400; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 400; + Projectile.height = 400; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default, 1.5f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 255, 0f, 0f, 0, default, 1.5f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -101,18 +102,18 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 60; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default, 2f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 255, 0f, 0f, 0, default, 2f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default, 1.5f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 255, 0f, 0f, 0, default, 1.5f); Main.dust[num624].velocity *= 2f; } - projectile.Damage(); + Projectile.Damage(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/TitRail.cs b/Projectiles/Ranged/TitRail.cs index 36245102ba..3212b200b8 100644 --- a/Projectiles/Ranged/TitRail.cs +++ b/Projectiles/Ranged/TitRail.cs @@ -14,25 +14,25 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 5; - projectile.extraUpdates = 100; - projectile.timeLeft = 180; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 5; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 180; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { for (int num447 = 0; num447 < 4; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); + Projectile.alpha = 255; int num448 = Dust.NewDust(vector33, 1, 1, 91, 0f, 0f, 0, default, 1f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[Projectile.owner] = 7; } } } diff --git a/Projectiles/Ranged/TorrentialArrow.cs b/Projectiles/Ranged/TorrentialArrow.cs index e248f291a1..c8a93201c4 100644 --- a/Projectiles/Ranged/TorrentialArrow.cs +++ b/Projectiles/Ranged/TorrentialArrow.cs @@ -15,52 +15,52 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.arrow = true; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.arrow = true; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } float num55 = 40f; float num56 = 1.5f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); } } } - public override Color? GetAlpha(Color lightColor) => new Color(53, Main.DiscoG, 255, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(53, Main.DiscoG, 255, Projectile.alpha); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(40f, 1.5f, lightColor); } } diff --git a/Projectiles/Ranged/ToxicArrow.cs b/Projectiles/Ranged/ToxicArrow.cs index 0ad3ea756e..738c247f88 100644 --- a/Projectiles/Ranged/ToxicArrow.cs +++ b/Projectiles/Ranged/ToxicArrow.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class ToxicArrow : ModProjectile @@ -15,37 +16,37 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.timeLeft = 240; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position = projectile.position - projectile.Size / 2f; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); - Main.PlaySound(SoundID.Item92, projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 32; + Projectile.position = Projectile.position - Projectile.Size / 2f; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item92, Projectile.position); int count = Main.rand.Next(6, 15); for (int i = 0; i < count; i++) { - int idx = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Ranged/ToxicannonDrop.cs b/Projectiles/Ranged/ToxicannonDrop.cs index 11d33e414c..03bba7c4ca 100644 --- a/Projectiles/Ranged/ToxicannonDrop.cs +++ b/Projectiles/Ranged/ToxicannonDrop.cs @@ -14,40 +14,40 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Acid"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 20; - projectile.friendly = true; - projectile.tileCollide = true; - projectile.ignoreWater = false; - projectile.timeLeft = 420; - projectile.ranged = true; + Projectile.width = 14; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.ignoreWater = false; + Projectile.timeLeft = 420; + Projectile.DamageType = DamageClass.Ranged; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (projectile.velocity.Y <= 8f) + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (Projectile.velocity.Y <= 8f) { - projectile.velocity.Y += 0.15f; + Projectile.velocity.Y += 0.15f; } - projectile.tileCollide = projectile.timeLeft <= 300; + Projectile.tileCollide = Projectile.timeLeft <= 300; } public override bool OnTileCollide(Vector2 oldVelocity) { // Water drip for (int i = 0; i < 4; i++) { - int idx = Dust.NewDust(projectile.position - projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); Dust dust = Main.dust[idx]; dust.position.X -= 2f; Main.dust[idx].alpha = 38; Main.dust[idx].velocity *= 0.1f; - Main.dust[idx].velocity -= projectile.velocity * 0.025f; + Main.dust[idx].velocity -= Projectile.velocity * 0.025f; Main.dust[idx].scale = 2f; } return true; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Ranged/ToxicannonShot.cs b/Projectiles/Ranged/ToxicannonShot.cs index 99d9e78d04..beca86718a 100644 --- a/Projectiles/Ranged/ToxicannonShot.cs +++ b/Projectiles/Ranged/ToxicannonShot.cs @@ -15,33 +15,33 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Cannon Shot"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 50; - projectile.friendly = true; - projectile.timeLeft = 480; - projectile.ranged = true; - projectile.tileCollide = true; - projectile.ignoreWater = false; + Projectile.width = 30; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.timeLeft = 480; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = true; + Projectile.ignoreWater = false; } public override void AI() { - if (projectile.ai[0]++ <= 30f) + if (Projectile.ai[0]++ <= 30f) { - projectile.alpha = (int)MathHelper.Lerp(255f, 0f, projectile.ai[0] / 30f); + Projectile.alpha = (int)MathHelper.Lerp(255f, 0f, Projectile.ai[0] / 30f); } - if (projectile.velocity.Y < 20f) - projectile.velocity.Y += 0.3f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.velocity.Y < 20f) + Projectile.velocity.Y += 0.3f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Math.Sign(projectile.velocity.Y) != Math.Sign(projectile.oldVelocity.Y) && projectile.ai[0] >= 5f) + if (Math.Sign(Projectile.velocity.Y) != Math.Sign(Projectile.oldVelocity.Y) && Projectile.ai[0] >= 5f) { - projectile.Kill(); + Projectile.Kill(); } } @@ -51,21 +51,21 @@ namespace CalamityMod.Projectiles.Ranged } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 180); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 180); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); for (int i = 0; i <= 40; i++) { - int idx = Dust.NewDust(projectile.position, 230, 230, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + int idx = Dust.NewDust(Projectile.position, 230, 230, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); Main.dust[idx].noGravity = true; - Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (Main.dust[idx].position - projectile.Center).Length() / 25f; + Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (Main.dust[idx].position - Projectile.Center).Length() / 25f; Main.dust[idx].scale = 2.5f; } for (int i = 0; i <= 90; i++) { - int idx = Dust.NewDust(projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid); + int idx = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid); Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 12f; Main.dust[idx].scale = 3f; Main.dust[idx].noGravity = true; @@ -77,15 +77,15 @@ namespace CalamityMod.Projectiles.Ranged { float angle = MathHelper.TwoPi * i / count; angle += Main.rand.NextFloat(0.1f, 0.35f) * Main.rand.NextBool(2).ToDirectionInt(); - Projectile.NewProjectile(projectile.Center, angle.ToRotationVector2() * Main.rand.NextFloat(4f, 16f), - ModContent.ProjectileType(), projectile.damage, 2.5f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, angle.ToRotationVector2() * Main.rand.NextFloat(4f, 16f), + ModContent.ProjectileType(), Projectile.damage, 2.5f, Projectile.owner); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/TriploonProj.cs b/Projectiles/Ranged/TriploonProj.cs index 1f13c758a4..aeac5be4f5 100644 --- a/Projectiles/Ranged/TriploonProj.cs +++ b/Projectiles/Ranged/TriploonProj.cs @@ -13,28 +13,28 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.ranged = true; - projectile.extraUpdates = 0; - projectile.timeLeft = 300; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 0; + Projectile.timeLeft = 300; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player.dead) { - projectile.Kill(); + Projectile.Kill(); return; } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - if (projectile.Center.X > player.Center.X) + if (Projectile.Center.X > player.Center.X) { player.ChangeDir(1); } @@ -43,56 +43,56 @@ namespace CalamityMod.Projectiles.Ranged player.ChangeDir(-1); } } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.extraUpdates = 0; + Projectile.extraUpdates = 0; } else { - projectile.extraUpdates = 1; + Projectile.extraUpdates = 1; } - Vector2 playerVector = player.Center - projectile.Center; + Vector2 playerVector = player.Center - Projectile.Center; float playerDist = playerVector.Length(); - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { if (playerDist > 700f) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } else if (playerDist > 350f) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; - projectile.ai[1] += 1f; - if (projectile.ai[1] > 5f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 5f) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.ai[1] > 8f) + if (Projectile.ai[1] > 8f) { - projectile.ai[1] = 8f; + Projectile.ai[1] = 8f; } - if (projectile.ai[1] >= 10f) + if (Projectile.ai[1] >= 10f) { - projectile.ai[1] = 15f; - projectile.velocity.Y += 0.3f; + Projectile.ai[1] = 15f; + Projectile.velocity.Y += 0.3f; } } - else if (projectile.ai[0] == 1f) + else if (Projectile.ai[0] == 1f) { - projectile.tileCollide = false; - projectile.rotation = (float)Math.Atan2((double)playerVector.Y, (double)playerVector.X) - MathHelper.PiOver2; + Projectile.tileCollide = false; + Projectile.rotation = (float)Math.Atan2((double)playerVector.Y, (double)playerVector.X) - MathHelper.PiOver2; float returnSpeed = 20f; if (playerDist < 50f) { - projectile.Kill(); + Projectile.Kill(); } playerDist = returnSpeed / playerDist; playerVector.X *= playerDist; playerVector.Y *= playerDist; - projectile.velocity.X = playerVector.X; - projectile.velocity.Y = playerVector.Y; + Projectile.velocity.X = playerVector.X; + Projectile.velocity.Y = playerVector.Y; } } } diff --git a/Projectiles/Ranged/TyphoonArrow.cs b/Projectiles/Ranged/TyphoonArrow.cs index 91321016d3..e545241ddf 100644 --- a/Projectiles/Ranged/TyphoonArrow.cs +++ b/Projectiles/Ranged/TyphoonArrow.cs @@ -12,23 +12,23 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.timeLeft = 600; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 1; + Projectile.timeLeft = 600; aiType = ProjectileID.WoodenArrowFriendly; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Ranged/TyphoonBubble.cs b/Projectiles/Ranged/TyphoonBubble.cs index b8a7482aba..493d0050a5 100644 --- a/Projectiles/Ranged/TyphoonBubble.cs +++ b/Projectiles/Ranged/TyphoonBubble.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class TyphoonBubble : ModProjectile @@ -12,57 +13,57 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Bubble"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 1; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 1; } public override void AI() { - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - int num625 = (int)projectile.ai[1] - 1; + int num625 = (int)Projectile.ai[1] - 1; if (num625 < 255) { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 10f) { int num626 = 6; for (int num627 = 0; num627 < num626; num627++) { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + projectile.Center; + Vector2 vector45 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + Projectile.Center; Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); int num628 = Dust.NewDust(vector45 + value15, 0, 0, 172, value15.X * 2f, value15.Y * 2f, 100, default, 1.4f); Main.dust[num628].noGravity = true; Main.dust[num628].noLight = true; Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; + Main.dust[num628].velocity -= Projectile.velocity; } - projectile.alpha -= 5; - if (projectile.alpha < 100) + Projectile.alpha -= 5; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + Projectile.rotation += Projectile.velocity.X * 0.1f; + Projectile.frame = (int)(Projectile.localAI[0] / 3f) % 3; } - Vector2 value16 = Main.player[num625].Center - projectile.Center; + Vector2 value16 = Main.player[num625].Center - Projectile.Center; float num629 = 4f; - num629 += projectile.localAI[0] / 20f; - projectile.velocity = Vector2.Normalize(value16) * num629; + num629 += Projectile.localAI[0] / 20f; + Projectile.velocity = Vector2.Normalize(value16) * num629; if (value16.Length() < 50f) { - projectile.Kill(); + Projectile.Kill(); } } } @@ -70,56 +71,56 @@ namespace CalamityMod.Projectiles.Ranged { float num630 = 0.209439516f; float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) + float num632 = (float)(Math.Cos((double)(num630 * Projectile.ai[0])) - 0.5) * num631; + Projectile.velocity.Y = Projectile.velocity.Y - num632; + Projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * Projectile.ai[0])) - 0.5) * num631; + Projectile.velocity.Y = Projectile.velocity.Y + num632; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 10f) { - projectile.alpha -= 5; - if (projectile.alpha < 100) + Projectile.alpha -= 5; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + Projectile.rotation += Projectile.velocity.X * 0.1f; + Projectile.frame = (int)(Projectile.localAI[0] / 3f) % 3; } } - if (projectile.wet) + if (Projectile.wet) { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); + Projectile.position.Y = Projectile.position.Y - 16f; + Projectile.Kill(); } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCDeath19, projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath19, Projectile.position); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 172, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - if (projectile.ai[1] < 1f) + if (Projectile.ai[1] < 1f) { - if (projectile.localAI[1] == 1f) + if (Projectile.localAI[1] == 1f) { - int num230 = Projectile.NewProjectile(projectile.Center.X - (float)(projectile.direction * 30), projectile.Center.Y - 4f, (float)-(float)projectile.direction * 0.01f, 0f, ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner, 16f, 8f); + int num230 = Projectile.NewProjectile(Projectile.Center.X - (float)(Projectile.direction * 30), Projectile.Center.Y - 4f, (float)-(float)Projectile.direction * 0.01f, 0f, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, 16f, 8f); Main.projectile[num230].netUpdate = true; } else { - int num230 = Projectile.NewProjectile(projectile.Center.X - (float)(projectile.direction * 30), projectile.Center.Y - 4f, (float)-(float)projectile.direction * 0.01f, 0f, ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner, 16f, 8f); + int num230 = Projectile.NewProjectile(Projectile.Center.X - (float)(Projectile.direction * 30), Projectile.Center.Y - 4f, (float)-(float)Projectile.direction * 0.01f, 0f, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, 16f, 8f); Main.projectile[num230].netUpdate = true; } } diff --git a/Projectiles/Ranged/UltimaBolt.cs b/Projectiles/Ranged/UltimaBolt.cs index fc8b096d84..011535f481 100644 --- a/Projectiles/Ranged/UltimaBolt.cs +++ b/Projectiles/Ranged/UltimaBolt.cs @@ -10,36 +10,36 @@ namespace CalamityMod.Projectiles.Ranged { public float Bounces { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public float DefaultHue => ((float)Math.Sin(Main.GlobalTime * 2.5f) + 1) * 0.5f; public const int MaxBounces = 1; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; DisplayName.SetDefault("Ultima Bolt"); } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 42; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 18; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } - public Color GetColorFromHue(float hue) => Main.hslToRgb(hue, 1f, 0.725f) * projectile.Opacity; + public Color GetColorFromHue(float hue) => Main.hslToRgb(hue, 1f, 0.725f) * Projectile.Opacity; public override Color? GetAlpha(Color lightColor) => GetColorFromHue(DefaultHue); public void ProduceExplosionDust(int dustCount) @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i < dustCount; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, 267); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 267); dust.color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.8f); dust.scale = Main.rand.NextFloat(1f, 1.25f); dust.velocity = Main.rand.NextVector2Circular(7f, 7f); @@ -61,17 +61,17 @@ namespace CalamityMod.Projectiles.Ranged { if (Bounces >= MaxBounces) { - projectile.Kill(); + Projectile.Kill(); return false; } - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } Bounces++; ProduceExplosionDust(24); @@ -81,22 +81,22 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = ModContent.GetTexture(Texture); - for (int i = 0; i < projectile.oldPos.Length; i++) + Texture2D texture = ModContent.Request(Texture); + for (int i = 0; i < Projectile.oldPos.Length; i++) { if (i > 0) { - CalamityUtils.DistanceClamp(ref projectile.oldPos[i], ref projectile.oldPos[i - 1], 8f); // Ensure the max distance between the old positions isn't too great. It looks weird if it is. + CalamityUtils.DistanceClamp(ref Projectile.oldPos[i], ref Projectile.oldPos[i - 1], 8f); // Ensure the max distance between the old positions isn't too great. It looks weird if it is. } - float completionRatio = i / (float)projectile.oldPos.Length; + float completionRatio = i / (float)Projectile.oldPos.Length; Color color = GetColorFromHue((DefaultHue + completionRatio * 0.5f) % 1f) * (float)Math.Pow(1f - completionRatio, 2); spriteBatch.Draw(texture, - projectile.oldPos[i] + texture.Size() * 0.5f - Main.screenPosition, + Projectile.oldPos[i] + texture.Size() * 0.5f - Main.screenPosition, null, color, - projectile.rotation, + Projectile.rotation, texture.Size() * 0.5f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); } @@ -105,8 +105,8 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 90, 90); - projectile.Damage(); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 90, 90); + Projectile.Damage(); ProduceExplosionDust(32); } } diff --git a/Projectiles/Ranged/UltimaBowProjectile.cs b/Projectiles/Ranged/UltimaBowProjectile.cs index ab1711307e..b637fed53f 100644 --- a/Projectiles/Ranged/UltimaBowProjectile.cs +++ b/Projectiles/Ranged/UltimaBowProjectile.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -13,8 +14,8 @@ namespace CalamityMod.Projectiles.Ranged public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public const float PositioningOffset = 35f; public override void SetStaticDefaults() @@ -24,22 +25,22 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 82; - projectile.height = 114; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; + Projectile.width = 82; + Projectile.height = 114; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; } public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.direction = (Math.Cos(projectile.velocity.ToRotation()) > 0).ToDirectionInt(); + Player player = Main.player[Projectile.owner]; + Projectile.direction = (Math.Cos(Projectile.velocity.ToRotation()) > 0).ToDirectionInt(); AttemptToFireProjectiles(player); AttachToPlayer(player); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; Time++; } @@ -48,10 +49,10 @@ namespace CalamityMod.Projectiles.Ranged bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; if (!canFire) { - projectile.Kill(); + Projectile.Kill(); return; } - if (projectile.owner == Main.myPlayer && Time % player.ActiveItem().useTime == 0) + if (Projectile.owner == Main.myPlayer && Time % player.ActiveItem().useTime == 0) { int type = ProjectileID.WoodenArrowFriendly; // This doesn't really matter. It's overwritten anyway. But it is passed into the PickAmmo method. float shotSpeed = player.ActiveItem().shootSpeed; @@ -60,16 +61,16 @@ namespace CalamityMod.Projectiles.Ranged player.PickAmmo(player.ActiveItem(), ref type, ref shotSpeed, ref canFire, ref damage, ref knockBack); // Pick ammo and consume it (this incorporates the bow's chance to not consume ammo). - Main.PlaySound(player.ActiveItem().UseSound, projectile.Center); + SoundEngine.PlaySound(player.ActiveItem().UseSound, Projectile.Center); type = ModContent.ProjectileType(); float shootLaserChance = Utils.InverseLerp(Ultima.FullChargeTime * 0.35f, Ultima.FullChargeTime, Time, true); Vector2 shotPosition = player.RotatedRelativePoint(player.MountedCenter, true); - shotPosition += projectile.velocity.ToRotation().ToRotationVector2().RotatedByRandom(MathHelper.ToRadians(40f)).RotatedBy(-0.25f * projectile.spriteDirection) * 42f; + shotPosition += Projectile.velocity.ToRotation().ToRotationVector2().RotatedByRandom(MathHelper.ToRadians(40f)).RotatedBy(-0.25f * Projectile.spriteDirection) * 42f; - projectile.velocity = player.SafeDirectionTo(Main.MouseWorld); + Projectile.velocity = player.SafeDirectionTo(Main.MouseWorld); - Vector2 shotVelocity = projectile.velocity * shotSpeed; // The velocity should always be a unit vector. + Vector2 shotVelocity = Projectile.velocity * shotSpeed; // The velocity should always be a unit vector. // Fire a laser. if (Main.rand.NextFloat() <= shootLaserChance) @@ -82,26 +83,26 @@ namespace CalamityMod.Projectiles.Ranged { // To ensure that the sparks don't spawn on top of the laser itself. float offsetAngle = Main.rand.NextFloat(0.2f, 0.5f) * Main.rand.NextBool(2).ToDirectionInt(); - Vector2 sparkVelocity = projectile.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY).RotatedByRandom(0.5f) * 13f; + Vector2 sparkVelocity = Projectile.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY).RotatedByRandom(0.5f) * 13f; sparkVelocity = sparkVelocity.RotatedBy(offsetAngle); - Projectile.NewProjectile(shotPosition, sparkVelocity, ModContent.ProjectileType(), damage / 3, knockBack, projectile.owner); + Projectile.NewProjectile(shotPosition, sparkVelocity, ModContent.ProjectileType(), damage / 3, knockBack, Projectile.owner); } knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack); - Projectile.NewProjectile(shotPosition, shotVelocity, type, damage, knockBack, projectile.owner); - projectile.netUpdate = true; + Projectile.NewProjectile(shotPosition, shotVelocity, type, damage, knockBack, Projectile.owner); + Projectile.netUpdate = true; } } public void AttachToPlayer(Player player) { - projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + projectile.velocity.ToRotation().ToRotationVector2() * PositioningOffset; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + Projectile.velocity.ToRotation().ToRotationVector2() * PositioningOffset; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = player.itemAnimation = 2; - player.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + player.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } public override bool CanDamage() => false; diff --git a/Projectiles/Ranged/UltimaRay.cs b/Projectiles/Ranged/UltimaRay.cs index 6021e677df..261701611c 100644 --- a/Projectiles/Ranged/UltimaRay.cs +++ b/Projectiles/Ranged/UltimaRay.cs @@ -12,17 +12,17 @@ namespace CalamityMod.Projectiles.Ranged public float HueOffset { - get => projectile.ai[1]; - set => projectile.ai[1] = value; + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; } public override float MaxScale => 0.7f; public override float MaxLaserLength => 2400f; public override float Lifetime => 50f; public override Color LaserOverlayColor => Main.hslToRgb((float)Math.Sin(Main.GlobalTime * 2.3f + HueOffset) * 0.5f + 0.5f, 1f, 0.775f) * Utils.InverseLerp(Lifetime, 0f, Time, true); public override Color LightCastColor => LaserOverlayColor; - public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); - public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); - public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); public override void SetStaticDefaults() { @@ -31,23 +31,23 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = projectile.height = 22; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.localNPCHitCooldown = 10; - projectile.usesLocalNPCImmunity = true; + Projectile.width = Projectile.height = 22; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; } public override bool PreAI() { // Initialization. Using the AI hook would override the base laser's code, and we don't want that. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { HueOffset = Main.rand.NextFloat(MathHelper.Pi / 5f); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } return true; } diff --git a/Projectiles/Ranged/UltimaSpark.cs b/Projectiles/Ranged/UltimaSpark.cs index 7cc133ac60..56dc077444 100644 --- a/Projectiles/Ranged/UltimaSpark.cs +++ b/Projectiles/Ranged/UltimaSpark.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Ranged public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public const int DustType = 261; public const float MaxHomingDistance = 1200f; @@ -22,13 +22,13 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = projectile.height = 8; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.timeLeft = 240; - projectile.extraUpdates = 1; + Projectile.width = Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; + Projectile.extraUpdates = 1; } public override void AI() @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i < 3; i++) { - Vector2 spawnPosition = Vector2.Lerp(projectile.oldPosition, projectile.position, i / 3f); + Vector2 spawnPosition = Vector2.Lerp(Projectile.oldPosition, Projectile.position, i / 3f); Dust dust = Dust.NewDustPerfect(spawnPosition, DustType); dust.color = Main.hslToRgb((Main.rand.NextFloat(-0.04f, 0.04f) + Time / 80f) % 1f, 0.8f, 0.6f); dust.scale = 2.3f; @@ -48,10 +48,10 @@ namespace CalamityMod.Projectiles.Ranged } } - NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxHomingDistance); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(MaxHomingDistance); if (potentialTarget != null) { - projectile.velocity = (projectile.velocity * 8f + projectile.SafeDirectionTo(potentialTarget.Center) * 18f) / 9f; + Projectile.velocity = (Projectile.velocity * 8f + Projectile.SafeDirectionTo(potentialTarget.Center) * 18f) / 9f; return; } @@ -61,12 +61,12 @@ namespace CalamityMod.Projectiles.Ranged // Make a complete 90 degree turn in 30 frames. if (updatedTime % 120f > 90f) { - projectile.velocity = projectile.velocity.RotatedBy(MathHelper.PiOver2 / 20f); + Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.PiOver2 / 20f); } // Arc around quickly for 60 frames. else if (updatedTime % 120f > 30f) { - projectile.velocity = projectile.velocity.RotatedBy((float)Math.Sin((updatedTime - 30f) % 60f / 60f * MathHelper.TwoPi) * MathHelper.ToRadians(15f)); + Projectile.velocity = Projectile.velocity.RotatedBy((float)Math.Sin((updatedTime - 30f) % 60f / 60f * MathHelper.TwoPi) * MathHelper.ToRadians(15f)); } } @@ -75,13 +75,13 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 60, 60); - projectile.Damage(); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 60, 60); + Projectile.Damage(); if (!Main.dedServ) { for (int i = 0; i < 20; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, DustType); + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustType); dust.color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.7f); dust.scale = Main.rand.NextFloat(0.9f, 1.25f); dust.velocity = Main.rand.NextVector2Circular(6f, 6f); diff --git a/Projectiles/Ranged/UniversalGenesisStar.cs b/Projectiles/Ranged/UniversalGenesisStar.cs index 1ab855b0d1..91b16a6997 100644 --- a/Projectiles/Ranged/UniversalGenesisStar.cs +++ b/Projectiles/Ranged/UniversalGenesisStar.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -13,48 +14,48 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 22; - projectile.height = 20; - projectile.friendly = true; - projectile.ranged = true; - projectile.alpha = 50; - projectile.tileCollide = false; - projectile.penetrate = 5; - projectile.timeLeft = 180; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 22; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.alpha = 50; + Projectile.tileCollide = false; + Projectile.penetrate = 5; + Projectile.timeLeft = 180; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.soundDelay == 0 && projectile.ai[0] == 0f) + if (Projectile.soundDelay == 0 && Projectile.ai[0] == 0f) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); } } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * projectile.direction; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; if (Main.rand.NextBool(48)) { - int idx = Gore.NewGore(projectile.Center, projectile.velocity * 0.2f, 16, 1f); + int idx = Gore.NewGore(Projectile.Center, Projectile.velocity * 0.2f, 16, 1f); Main.gore[idx].velocity *= 0.66f; - Main.gore[idx].velocity += projectile.velocity * 0.3f; + Main.gore[idx].velocity += Projectile.velocity * 0.3f; } if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20)) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } @@ -70,25 +71,25 @@ namespace CalamityMod.Projectiles.Ranged public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - Texture2D tex = Main.projectileTexture[projectile.type]; - Vector2 offsets = new Vector2(0f, projectile.gfxOffY) - Main.screenPosition; - Color alpha = projectile.GetAlpha(lightColor); + Texture2D tex = Main.projectileTexture[Projectile.type]; + Vector2 offsets = new Vector2(0f, Projectile.gfxOffY) - Main.screenPosition; + Color alpha = Projectile.GetAlpha(lightColor); Rectangle spriteRec = new Microsoft.Xna.Framework.Rectangle(0, 0, tex.Width, tex.Height); Vector2 spriteOrigin = spriteRec.Size() / 2f; - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D aura = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/FallenStarAura"); - Vector2 drawStart = projectile.Center + projectile.velocity; - Vector2 drawStart2 = projectile.Center - projectile.velocity * 0.5f; + Texture2D aura = ModContent.Request("CalamityMod/Projectiles/Ranged/FallenStarAura"); + Vector2 drawStart = Projectile.Center + Projectile.velocity; + Vector2 drawStart2 = Projectile.Center - Projectile.velocity * 0.5f; Vector2 spinPoint = new Vector2(0f, -10f); - float time = Main.player[projectile.owner].miscCounter % 216000f / 60f; + float time = Main.player[Projectile.owner].miscCounter % 216000f / 60f; Rectangle auraRec = aura.Frame(); Color blue = Color.Blue * 0.2f; Color white = Color.White * 0.5f; @@ -97,9 +98,9 @@ namespace CalamityMod.Projectiles.Ranged Vector2 auraOrigin = new Vector2(auraRec.Width / 2f, 10f); //Draw the aura - spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time), auraRec, blue, projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.5f, SpriteEffects.None, 0); - spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.TwoPi / 3f), auraRec, blue, projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.1f, SpriteEffects.None, 0); - spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.Pi * 4f / 3f), auraRec, blue, projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.3f, SpriteEffects.None, 0); + spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time), auraRec, blue, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.5f, SpriteEffects.None, 0); + spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.TwoPi / 3f), auraRec, blue, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.1f, SpriteEffects.None, 0); + spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.Pi * 4f / 3f), auraRec, blue, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.3f, SpriteEffects.None, 0); for (float d = 0f; d < 1f; d += 0.5f) { float scaleMult = time % 0.5f / 0.5f; @@ -109,24 +110,24 @@ namespace CalamityMod.Projectiles.Ranged { colorMult = 2f - colorMult; } - spriteBatch.Draw(aura, drawStart2 + offsets, auraRec, white * colorMult, projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 0.3f + scaleMult * 0.5f, SpriteEffects.None, 0); + spriteBatch.Draw(aura, drawStart2 + offsets, auraRec, white * colorMult, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 0.3f + scaleMult * 0.5f, SpriteEffects.None, 0); } } //Draw the actual projectile - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - projectile.position += projectile.Size; - projectile.width = 50; - projectile.height = 50; - projectile.position -= projectile.Size; + Projectile.position += Projectile.Size; + Projectile.width = 50; + Projectile.height = 50; + Projectile.position -= Projectile.Size; for (int i = 0; i < 5; i++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 16, 0f, 0f, 100, default, 1.2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 16, 0f, 0f, 100, default, 1.2f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -136,7 +137,7 @@ namespace CalamityMod.Projectiles.Ranged } for (int i = 0; i < 3; i++) { - Gore.NewGore(projectile.position, projectile.velocity * 0.05f, Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, Projectile.velocity * 0.05f, Main.rand.Next(16, 18), 1f); } } } diff --git a/Projectiles/Ranged/UniversalGenesisStarcaller.cs b/Projectiles/Ranged/UniversalGenesisStarcaller.cs index 386054613a..9f1b8a803a 100644 --- a/Projectiles/Ranged/UniversalGenesisStarcaller.cs +++ b/Projectiles/Ranged/UniversalGenesisStarcaller.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,64 +12,64 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Starcaller Shot"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; + Projectile.width = 18; + Projectile.height = 18; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.23f, 0.19f, 0.25f); + Lighting.AddLight(Projectile.Center, 0.23f, 0.19f, 0.25f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { if (Main.rand.NextBool(2)) { - int idx = Dust.NewDust(projectile.position, 1, 1, 173, 0f, 0f, 0, default, 0.5f); - Main.dust[idx].alpha = projectile.alpha; + int idx = Dust.NewDust(Projectile.position, 1, 1, 173, 0f, 0f, 0, default, 0.5f); + Main.dust[idx].alpha = Projectile.alpha; Main.dust[idx].velocity *= 0f; Main.dust[idx].noGravity = true; } } - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Item11.WithPitchVariance(0.05f), projectile.Center); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Item11.WithPitchVariance(0.05f), Projectile.Center); return true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } @@ -92,17 +93,17 @@ namespace CalamityMod.Projectiles.Ranged int maxDistance = 480; // 30 blocks bool bossFound = false; int life = 0; - Vector2 targetVec = projectile.Center; + Vector2 targetVec = Projectile.Center; for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; if (bossFound && !npc.IsABoss()) continue; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); //Calculate distance between target and the projectile to know if it's too far or not - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); if (targetDist < (maxDistance + extraDist) && (npc.IsABoss() || npc.life > life)) { if (npc.IsABoss()) @@ -114,7 +115,7 @@ namespace CalamityMod.Projectiles.Ranged } for (int n = 0; n < 2; n++) { - Projectile star = CalamityUtils.ProjectileRain(targetVec, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner); + Projectile star = CalamityUtils.ProjectileRain(targetVec, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); star.ai[0] = n; } } @@ -123,11 +124,11 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } for (int g = 0; g < 3; g++) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } } } diff --git a/Projectiles/Ranged/VanquisherArrowMain.cs b/Projectiles/Ranged/VanquisherArrowMain.cs index 87cf532b57..4d6d9bda48 100644 --- a/Projectiles/Ranged/VanquisherArrowMain.cs +++ b/Projectiles/Ranged/VanquisherArrowMain.cs @@ -17,46 +17,46 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.timeLeft = 90; - projectile.extraUpdates = 1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.arrow = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 90; + Projectile.extraUpdates = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (projectile.timeLeft % 45 == 0) + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (Projectile.timeLeft % 45 == 0) { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 6) - Projectile.NewProjectile(projectile.Center, projectile.velocity * 0.25f, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner); + if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 6) + Projectile.NewProjectile(Projectile.Center, Projectile.velocity * 0.25f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); } } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Color color = Color.White; - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * (b2 / 255f)); color = new Color(b2, b2, b2, a2); } - Rectangle frame = new Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Ammo/VanquisherArrowGlow"), projectile.Center - Main.screenPosition, frame, color, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + Rectangle frame = new Rectangle(0, 0, Main.projectileTexture[Projectile.type].Width, Main.projectileTexture[Projectile.type].Height); + spriteBatch.Draw(ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow"), Projectile.Center - Main.screenPosition, frame, color, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0f); } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * (b2 / 255f)); return new Color(b2, b2, b2, a2); } diff --git a/Projectiles/Ranged/VeriumBulletProj.cs b/Projectiles/Ranged/VeriumBulletProj.cs index 63855af248..8793d0f7fd 100644 --- a/Projectiles/Ranged/VeriumBulletProj.cs +++ b/Projectiles/Ranged/VeriumBulletProj.cs @@ -12,71 +12,71 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Verium Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 2; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 2; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } public override bool PreAI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); - projectile.spriteDirection = projectile.direction; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); + Projectile.spriteDirection = Projectile.direction; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { if (Main.rand.NextBool(2)) { - int purple = Dust.NewDust(projectile.position, 1, 1, 70, 0f, 0f, 0, default, 0.5f); - Main.dust[purple].alpha = projectile.alpha; + int purple = Dust.NewDust(Projectile.position, 1, 1, 70, 0f, 0f, 0, default, 0.5f); + Main.dust[purple].alpha = Projectile.alpha; Main.dust[purple].velocity *= 0f; Main.dust[purple].noGravity = true; } } - if (projectile.ai[0] > 0f) - projectile.ai[0]--; + if (Projectile.ai[0] > 0f) + Projectile.ai[0]--; if (speed == 0f) - speed = projectile.velocity.Length(); - if (projectile.penetrate == 1 && projectile.ai[0] <= 0f) + speed = Projectile.velocity.Length(); + if (Projectile.penetrate == 1 && Projectile.ai[0] <= 0f) { float inertia = 15f; - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; float maxDistance = 300f; bool homeIn = false; - int targetIndex = (int)projectile.ai[1]; + int targetIndex = (int)Projectile.ai[1]; NPC target = Main.npc[targetIndex]; - if (target.CanBeChasedBy(projectile, false)) + if (target.CanBeChasedBy(Projectile, false)) { float extraDistance = (target.width / 2) + (target.height / 2); bool canHit = true; if (extraDistance < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, target.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1); - if (Vector2.Distance(target.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + if (Vector2.Distance(target.Center, Projectile.Center) < (maxDistance + extraDistance) && canHit) { center = target.Center; homeIn = true; @@ -88,15 +88,15 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDistance = (npc.width / 2) + (npc.height / 2); bool canHit = true; if (extraDistance < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance) && canHit) { center = npc.Center; homeIn = true; @@ -106,37 +106,37 @@ namespace CalamityMod.Projectiles.Ranged } } - if (!projectile.friendly) + if (!Projectile.friendly) { homeIn = false; } if (homeIn) { - Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * inertia + moveDirection * speed) / (inertia + 1f); + Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * inertia + moveDirection * speed) / (inertia + 1f); } return false; } return true; } - public override bool? CanHitNPC(NPC target) => projectile.ai[0] <= 0f && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.ai[0] <= 0f && target.CanBeChasedBy(Projectile); - public override bool CanHitPvp(Player target) => projectile.ai[0] <= 0f; + public override bool CanHitPvp(Player target) => Projectile.ai[0] <= 0f; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.ai[0] = 10f; - projectile.damage /= 2; + Projectile.ai[0] = 10f; + Projectile.damage /= 2; if (target.life > 0) - projectile.ai[1] = target.whoAmI; + Projectile.ai[1] = target.whoAmI; } public override void OnHitPvp(Player target, int damage, bool crit) { - projectile.ai[0] = 10f; - projectile.damage /= 2; + Projectile.ai[0] = 10f; + Projectile.damage /= 2; } } } diff --git a/Projectiles/Ranged/Voidragon.cs b/Projectiles/Ranged/Voidragon.cs index 8c52e85306..de267c0f65 100644 --- a/Projectiles/Ranged/Voidragon.cs +++ b/Projectiles/Ranged/Voidragon.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -11,102 +12,102 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.alpha = 150; - projectile.friendly = true; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ignoreWater = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.alpha = 150; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.ignoreWater = true; } public override void AI() { - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 150 + Main.rand.Next(40); - Main.PlaySound(SoundID.Item92, projectile.position); + Projectile.soundDelay = 150 + Main.rand.Next(40); + SoundEngine.PlaySound(SoundID.Item92, Projectile.position); } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 12f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 12f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } - projectile.alpha -= 15; + Projectile.alpha -= 15; int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) + if (Projectile.Center.Y >= Projectile.ai[1]) { num58 = 0; } - if (projectile.alpha < num58) + if (Projectile.alpha < num58) { - projectile.alpha = num58; + Projectile.alpha = num58; } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; + Main.dust[num59].position = Projectile.Center + value3 * 12f; } if (Main.rand.NextBool(48)) { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + int num60 = Gore.NewGore(Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; + Main.gore[num60].velocity += Projectile.velocity * 0.3f; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.light = 0.9f; + Projectile.light = 0.9f; if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20)) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.1f / 255f, (255 - projectile.alpha) * 0.7f / 255f, (255 - projectile.alpha) * 0.15f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.1f / 255f, (255 - Projectile.alpha) * 0.7f / 255f, (255 - Projectile.alpha) * 0.15f / 255f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f); } - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/VoidragonTentacle.cs b/Projectiles/Ranged/VoidragonTentacle.cs index a8f34e1e8c..07847a331c 100644 --- a/Projectiles/Ranged/VoidragonTentacle.cs +++ b/Projectiles/Ranged/VoidragonTentacle.cs @@ -17,83 +17,83 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.MaxUpdates = 3; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 40; + Projectile.height = 40; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.MaxUpdates = 3; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() { - projectile.localAI[1]++; - if (projectile.velocity.X != projectile.velocity.X) + Projectile.localAI[1]++; + if (Projectile.velocity.X != Projectile.velocity.X) { - if (Math.Abs(projectile.velocity.X) < 1f) + if (Math.Abs(Projectile.velocity.X) < 1f) { - projectile.velocity.X = -projectile.velocity.X; + Projectile.velocity.X = -Projectile.velocity.X; } else { - projectile.Kill(); + Projectile.Kill(); } } - if (projectile.velocity.Y != projectile.velocity.Y) + if (Projectile.velocity.Y != Projectile.velocity.Y) { - if (Math.Abs(projectile.velocity.Y) < 1f) + if (Math.Abs(Projectile.velocity.Y) < 1f) { - projectile.velocity.Y = -projectile.velocity.Y; + Projectile.velocity.Y = -Projectile.velocity.Y; } else { - projectile.Kill(); + Projectile.Kill(); } } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if (projectile.localAI[0] < 0.1f) + Vector2 center10 = Projectile.Center; + Projectile.scale = 1f - Projectile.localAI[0]; + Projectile.width = (int)(20f * Projectile.scale); + Projectile.height = Projectile.width; + Projectile.position.X = center10.X - (float)(Projectile.width / 2); + Projectile.position.Y = center10.Y - (float)(Projectile.height / 2); + if (Projectile.localAI[0] < 0.1f) { - projectile.localAI[0] += 0.01f; + Projectile.localAI[0] += 0.01f; } else { - projectile.localAI[0] += 0.025f; + Projectile.localAI[0] += 0.025f; } - if (projectile.localAI[0] >= 0.95f) + if (Projectile.localAI[0] >= 0.95f) { - projectile.Kill(); + Projectile.Kill(); } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; - if (projectile.velocity.Length() > 16f) + Projectile.velocity.X = Projectile.velocity.X + Projectile.ai[0] * 1.5f; + Projectile.velocity.Y = Projectile.velocity.Y + Projectile.ai[1] * 1.5f; + if (Projectile.velocity.Length() > 16f) { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; + Projectile.velocity.Normalize(); + Projectile.velocity *= 16f; } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f && projectile.localAI[1] > 5f) + Projectile.ai[0] *= 1.05f; + Projectile.ai[1] *= 1.05f; + if (Projectile.scale < 1f && Projectile.localAI[1] > 5f) { int dustAmount = 0; - while ((float)dustAmount < projectile.scale * 10f) + while ((float)dustAmount < Projectile.scale * 10f) { - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.3f); - Main.dust[dust].position = (Main.dust[dust].position + projectile.Center) / 2f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.3f); + Main.dust[dust].position = (Main.dust[dust].position + Projectile.Center) / 2f; Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.1f; - Main.dust[dust].velocity -= projectile.velocity * (1.1f - projectile.scale); - Main.dust[dust].fadeIn = (float)(125 + projectile.owner); - Main.dust[dust].scale += projectile.scale * 0.75f; + Main.dust[dust].velocity -= Projectile.velocity * (1.1f - Projectile.scale); + Main.dust[dust].fadeIn = (float)(125 + Projectile.owner); + Main.dust[dust].scale += Projectile.scale * 0.75f; dustAmount++; } } diff --git a/Projectiles/Ranged/WaterSpout.cs b/Projectiles/Ranged/WaterSpout.cs index 7d1e4ad356..c17ea9d9ab 100644 --- a/Projectiles/Ranged/WaterSpout.cs +++ b/Projectiles/Ranged/WaterSpout.cs @@ -10,23 +10,23 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Spout"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 150; - projectile.height = 42; - projectile.scale = 0.6f; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 60; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 150; + Projectile.height = 42; + Projectile.scale = 0.6f; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.timeLeft = 60; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -36,86 +36,86 @@ namespace CalamityMod.Projectiles.Ranged float num615 = 1f; int num616 = 150; int num617 = 42; - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); + Projectile.direction = Projectile.spriteDirection = -Math.Sign(Projectile.velocity.X); } - projectile.frameCounter++; - if (projectile.frameCounter > 2) + Projectile.frameCounter++; + if (Projectile.frameCounter > 2) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 6) + if (Projectile.frame >= 6) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.scale = ((float)(num613 + num614) - Projectile.ai[1]) * num615 / (float)(num614 + num613); + Projectile.width = (int)((float)num616 * Projectile.scale); + Projectile.height = (int)((float)num617 * Projectile.scale); + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } - if (projectile.ai[1] != -1f) + if (Projectile.ai[1] != -1f) { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); + Projectile.scale = ((float)(num613 + num614) - Projectile.ai[1]) * num615 / (float)(num614 + num613); + Projectile.width = (int)((float)num616 * Projectile.scale); + Projectile.height = (int)((float)num617 * Projectile.scale); } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (!Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.alpha -= 30; - if (projectile.alpha < 60) + Projectile.alpha -= 30; + if (Projectile.alpha < 60) { - projectile.alpha = 60; + Projectile.alpha = 60; } } else { - projectile.alpha += 30; - if (projectile.alpha > 150) + Projectile.alpha += 30; + if (Projectile.alpha > 150) { - projectile.alpha = 150; + Projectile.alpha = 150; } } - if (projectile.ai[0] > 0f) + if (Projectile.ai[0] > 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + if (Projectile.ai[0] == 1f && Projectile.ai[1] > 0f && Projectile.owner == Main.myPlayer) { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + Projectile.netUpdate = true; + Vector2 center = Projectile.Center; + center.Y -= (float)num617 * Projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - Projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); center.Y -= (float)num617 * num618 / 2f; center.Y += 2f; - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + Projectile.NewProjectile(center.X, center.Y, Projectile.velocity.X, Projectile.velocity.Y, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 10f, Projectile.ai[1] - 1f); } - if (projectile.ai[0] <= 0f) + if (Projectile.ai[0] <= 0f) { float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)-(float)projectile.direction; - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)-(float)projectile.direction; + float num623 = (float)Projectile.width / 5f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; + Projectile.position.X = Projectile.position.X - num624 * (float)-(float)Projectile.direction; + Projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; + Projectile.position.X = Projectile.position.X + num624 * (float)-(float)Projectile.direction; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Rogue/AbyssalMirrorProjectile.cs b/Projectiles/Rogue/AbyssalMirrorProjectile.cs index baa3ab48dd..731d748031 100644 --- a/Projectiles/Rogue/AbyssalMirrorProjectile.cs +++ b/Projectiles/Rogue/AbyssalMirrorProjectile.cs @@ -8,28 +8,28 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Lumenyl Fluid"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 0; - projectile.penetrate = -1; - projectile.tileCollide = true; - projectile.ignoreWater = true; - projectile.timeLeft = 50; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 12; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 0; + Projectile.penetrate = -1; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 50; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.timeLeft < 25) - { projectile.alpha += 10; } + if (Projectile.timeLeft < 25) + { Projectile.alpha += 10; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/AccretionDisk2.cs b/Projectiles/Rogue/AccretionDisk2.cs index 895b3f0cf6..a97b1ac396 100644 --- a/Projectiles/Rogue/AccretionDisk2.cs +++ b/Projectiles/Rogue/AccretionDisk2.cs @@ -14,30 +14,30 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Accretion Disk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 56; - projectile.height = 56; - projectile.alpha = 120; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 60; + Projectile.width = 56; + Projectile.height = 56; + Projectile.alpha = 120; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.aiStyle = 3; + Projectile.timeLeft = 60; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { if (Main.rand.NextBool(10)) { - int num250 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.5f); + int num250 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.5f); Main.dust[num250].noGravity = true; Main.dust[num250].velocity *= 0f; } @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/AccretionDiskProj.cs b/Projectiles/Rogue/AccretionDiskProj.cs index e2ebc3645a..87fe6ff17e 100644 --- a/Projectiles/Rogue/AccretionDiskProj.cs +++ b/Projectiles/Rogue/AccretionDiskProj.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -17,22 +18,22 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Disk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 56; - projectile.height = 56; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.penetrate = -1; - projectile.timeLeft = Lifetime; - projectile.Calamity().rogue = true; + Projectile.width = 56; + Projectile.height = 56; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime; + Projectile.Calamity().rogue = true; } public override void AI() @@ -45,71 +46,71 @@ namespace CalamityMod.Projectiles.Rogue private void BoomerangAI() { // Boomerang rotation - projectile.rotation += 0.4f * projectile.direction; + Projectile.rotation += 0.4f * Projectile.direction; // Boomerang sound - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } // Returns after some number of frames in the air - int timeMult = projectile.Calamity().stealthStrike ? 3 : 1; - if (projectile.timeLeft < Lifetime * timeMult - ReboundTime * timeMult) - projectile.ai[0] = 1f; + int timeMult = Projectile.Calamity().stealthStrike ? 3 : 1; + if (Projectile.timeLeft < Lifetime * timeMult - ReboundTime * timeMult) + Projectile.ai[0] = 1f; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float returnSpeed = 9f; float acceleration = 0.4f; - Vector2 playerVec = player.Center - projectile.Center; + Vector2 playerVec = player.Center - Projectile.Center; float dist = playerVec.Length(); // Delete the projectile if it's excessively far away. if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); playerVec.Normalize(); playerVec *= returnSpeed; // Home back in on the player. - if (projectile.velocity.X < playerVec.X) + if (Projectile.velocity.X < playerVec.X) { - projectile.velocity.X += acceleration; - if (projectile.velocity.X < 0f && playerVec.X > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X += acceleration; + if (Projectile.velocity.X < 0f && playerVec.X > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > playerVec.X) + else if (Projectile.velocity.X > playerVec.X) { - projectile.velocity.X -= acceleration; - if (projectile.velocity.X > 0f && playerVec.X < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X -= acceleration; + if (Projectile.velocity.X > 0f && playerVec.X < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < playerVec.Y) + if (Projectile.velocity.Y < playerVec.Y) { - projectile.velocity.Y += acceleration; - if (projectile.velocity.Y < 0f && playerVec.Y > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y += acceleration; + if (Projectile.velocity.Y < 0f && playerVec.Y > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > playerVec.Y) + else if (Projectile.velocity.Y > playerVec.Y) { - projectile.velocity.Y -= acceleration; - if (projectile.velocity.Y > 0f && playerVec.Y < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y -= acceleration; + if (Projectile.velocity.Y > 0f && playerVec.Y < 0f) + Projectile.velocity.Y -= acceleration; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(player.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(player.Hitbox)) + Projectile.Kill(); } } private void SpawnProjectilesNearEnemies() { - if (!projectile.friendly) + if (!Projectile.friendly) return; float maxDistance = 300f; @@ -118,15 +119,15 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDistance = npc.width / 2 + npc.height / 2; bool canHit = true; if (extraDistance < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); - if (Vector2.Distance(npc.Center, projectile.Center) < maxDistance + extraDistance && canHit) + if (Vector2.Distance(npc.Center, Projectile.Center) < maxDistance + extraDistance && canHit) { homeIn = true; break; @@ -136,22 +137,22 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { - int counter = projectile.Calamity().stealthStrike ? 35 : 50; - if (Main.player[projectile.owner].miscCounter % counter == 0) + int counter = Projectile.Calamity().stealthStrike ? 35 : 50; + if (Main.player[Projectile.owner].miscCounter % counter == 0) { int splitProj = ModContent.ProjectileType(); - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[splitProj] < 25) + if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[splitProj] < 25) { float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int disk = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), splitProj, projectile.damage, projectile.knockBack, projectile.owner); - int disk2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), splitProj, projectile.damage, projectile.knockBack, projectile.owner); - if (projectile.Calamity().stealthStrike) + int disk = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), splitProj, Projectile.damage, Projectile.knockBack, Projectile.owner); + int disk2 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), splitProj, Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Projectile.Calamity().stealthStrike) { Main.projectile[disk].idStaticNPCHitCooldown = Main.projectile[disk2].idStaticNPCHitCooldown = 6; Main.projectile[disk].usesIDStaticNPCImmunity = Main.projectile[disk2].usesIDStaticNPCImmunity = true; @@ -167,12 +168,12 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(3)) { - int rainbow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); Main.dust[rainbow].noGravity = true; Main.dust[rainbow].velocity *= 0f; } - Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); + Lighting.AddLight(Projectile.Center, 0.15f, 1f, 0.25f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -180,8 +181,8 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 90); target.AddBuff(BuffID.Frostburn, 90); target.AddBuff(ModContent.BuffType(), 90); - if (!projectile.Calamity().stealthStrike) - projectile.ai[0] = 1f; + if (!Projectile.Calamity().stealthStrike) + Projectile.ai[0] = 1f; } public override void OnHitPvp(Player target, int damage, bool crit) @@ -189,13 +190,13 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 90); target.AddBuff(BuffID.Frostburn, 90); target.AddBuff(ModContent.BuffType(), 90); - if (!projectile.Calamity().stealthStrike) - projectile.ai[0] = 1f; + if (!Projectile.Calamity().stealthStrike) + Projectile.ai[0] = 1f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/AcidBarrelDrop.cs b/Projectiles/Rogue/AcidBarrelDrop.cs index 3047ed8062..3c8a8c97eb 100644 --- a/Projectiles/Rogue/AcidBarrelDrop.cs +++ b/Projectiles/Rogue/AcidBarrelDrop.cs @@ -14,40 +14,40 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Acid"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 20; - projectile.friendly = true; - projectile.tileCollide = true; - projectile.ignoreWater = false; - projectile.timeLeft = 420; - projectile.Calamity().rogue = true; + Projectile.width = 14; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.ignoreWater = false; + Projectile.timeLeft = 420; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (projectile.velocity.Y <= 8f) + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (Projectile.velocity.Y <= 8f) { - projectile.velocity.Y += 0.15f; + Projectile.velocity.Y += 0.15f; } - projectile.tileCollide = projectile.timeLeft <= 300; + Projectile.tileCollide = Projectile.timeLeft <= 300; } public override bool OnTileCollide(Vector2 oldVelocity) { // Water drip for (int i = 0; i < 4; i++) { - int idx = Dust.NewDust(projectile.position - projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f); Dust dust = Main.dust[idx]; dust.position.X -= 2f; Main.dust[idx].alpha = 38; Main.dust[idx].velocity *= 0.1f; - Main.dust[idx].velocity -= projectile.velocity * 0.025f; + Main.dust[idx].velocity -= Projectile.velocity * 0.025f; Main.dust[idx].scale = 0.75f; } return true; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Rogue/AcidShrapnel.cs b/Projectiles/Rogue/AcidShrapnel.cs index 8863bf7e1e..16e9664d06 100644 --- a/Projectiles/Rogue/AcidShrapnel.cs +++ b/Projectiles/Rogue/AcidShrapnel.cs @@ -15,32 +15,32 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Shrapnel"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 160; - projectile.tileCollide = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; + Projectile.width = 12; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 160; + Projectile.tileCollide = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; } public override void AI() { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; if (HitTile) { - projectile.velocity.X = 0f; - projectile.rotation = MathHelper.Pi; + Projectile.velocity.X = 0f; + Projectile.rotation = MathHelper.Pi; } else - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -50,18 +50,18 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - projectile.Kill(); + Projectile.Kill(); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - projectile.Kill(); + Projectile.Kill(); } public override void Kill(int timeLeft) { for (int i = 0; i < 15; i++) { - Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid); dust.velocity = Vector2.UnitY.RotatedBy(i / 15f * MathHelper.TwoPi) * 3f * (float)Math.Cos(i / 15f * MathHelper.TwoPi); dust.scale = 2.5f; dust.noGravity = true; diff --git a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs index e619388163..7431435ce8 100644 --- a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs +++ b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 2; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 2; + Projectile.timeLeft = 600; aiType = ProjectileID.Shuriken; - projectile.Calamity().rogue = true; - projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; + Projectile.localNPCHitCooldown = 10; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.Center.X, (int)projectile.Center.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.Center.X, (int)Projectile.Center.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } @@ -55,11 +55,11 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects() { - if (projectile.Calamity().stealthStrike && Main.myPlayer == projectile.owner) + if (Projectile.Calamity().stealthStrike && Main.myPlayer == Projectile.owner) { for (int n = 0; n < 3; n++) { - Projectile lightning = CalamityUtils.ProjectileRain(projectile.Center, 400f, 100f, -800f, -500f, 8f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile lightning = CalamityUtils.ProjectileRain(Projectile.Center, 400f, 100f, -800f, -500f, 8f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); lightning.ai[0] = Main.rand.Next(2); } } diff --git a/Projectiles/Rogue/AlphaSeeker.cs b/Projectiles/Rogue/AlphaSeeker.cs index bcdae6038a..5d92203b4b 100644 --- a/Projectiles/Rogue/AlphaSeeker.cs +++ b/Projectiles/Rogue/AlphaSeeker.cs @@ -25,39 +25,39 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = lifetime; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 1; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = lifetime; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 1; } public override void AI() { if (!initialized) { - projectile.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); - projectile.localAI[1] = Main.rand.NextFloat(-rotateSpeed, rotateSpeed); + Projectile.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); + Projectile.localAI[1] = Main.rand.NextFloat(-rotateSpeed, rotateSpeed); initialized = true; } // ai[0], when set to 1, makes the projectile cling to a parent projectile instead. // in this case, ai[1] is the index of the parent projectile. // otherwise, ai[1] is the index of the homing target, because it homes in. - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { // projectile.localAI[0] controls the distance from the parent projectile - projectile.tileCollide = false; + Projectile.tileCollide = false; Projectile parent = Main.projectile[0]; bool active = false; for (int i = 0; i < Main.projectile.Length; i++) { Projectile p = Main.projectile[i]; - if (p.identity == projectile.ai[1] && p.active) + if (p.identity == Projectile.ai[1] && p.active) { parent = p; active = true; @@ -66,35 +66,35 @@ namespace CalamityMod.Projectiles.Rogue if (active) { - Vector2 pos = new Vector2(0, projectile.localAI[0]); - pos = pos.RotatedBy(projectile.rotation); + Vector2 pos = new Vector2(0, Projectile.localAI[0]); + pos = pos.RotatedBy(Projectile.rotation); - projectile.Center = parent.Center + pos; - projectile.rotation += projectile.localAI[1]; + Projectile.Center = parent.Center + pos; + Projectile.rotation += Projectile.localAI[1]; - if (projectile.timeLeft > returnTime) + if (Projectile.timeLeft > returnTime) { - projectile.localAI[0] += moveSpeed; + Projectile.localAI[0] += moveSpeed; } else { - projectile.localAI[0] -= moveSpeed; + Projectile.localAI[0] -= moveSpeed; } // Also look for an enemy to home in on every few frames. If you find one, switch to homing mode. - if (projectile.timeLeft % 6 == 0) + if (Projectile.timeLeft % 6 == 0) { int targetID = AcquireTarget(); if (targetID != -1) { - projectile.ai[0] = 0f; // Switch to homing mode - projectile.ai[1] = targetID + 1f; // Already have a target loaded in + Projectile.ai[0] = 0f; // Switch to homing mode + Projectile.ai[1] = targetID + 1f; // Already have a target loaded in } } } else { - projectile.Kill(); + Projectile.Kill(); } } else @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Rogue HomingAI(); } - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity.Y = -0.15f; } @@ -111,12 +111,12 @@ namespace CalamityMod.Projectiles.Rogue private void HomingAI() { // If we don't currently have a target, go try and get one! - int targetID = (int)projectile.ai[1] - 1; + int targetID = (int)Projectile.ai[1] - 1; if (targetID < 0) targetID = AcquireTarget(); // Save the target, whether we have one or not. - projectile.ai[1] = targetID + 1f; + Projectile.ai[1] = targetID + 1f; // If there's no target, just don't do anything. Otherwise home in. if (targetID < 0) @@ -125,10 +125,10 @@ namespace CalamityMod.Projectiles.Rogue // Adds a multiple of the towards-target vector to its velocity every frame. float homingFactor = 2.5f; - Vector2 posDiff = target.Center - projectile.Center; + Vector2 posDiff = target.Center - Projectile.Center; posDiff = posDiff.SafeNormalize(Vector2.Zero); posDiff *= homingFactor; - Vector2 newVelocity = projectile.velocity += posDiff; + Vector2 newVelocity = Projectile.velocity += posDiff; // Caps speed to make sure it doesn't go too fast. if (newVelocity.Length() >= MaxSpeed) @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Rogue newVelocity *= MaxSpeed; } - projectile.velocity = newVelocity; + Projectile.velocity = newVelocity; } // TODO -- shamelessly copied from Nanoblack Reaper. This should be made into a Utils function ASAP @@ -151,10 +151,10 @@ namespace CalamityMod.Projectiles.Rogue if (!npc.active || npc.type == NPCID.TargetDummy) continue; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float xDist = projectile.Center.X - npc.Center.X; - float yDist = projectile.Center.Y - npc.Center.Y; + float xDist = Projectile.Center.X - npc.Center.X; + float yDist = Projectile.Center.Y - npc.Center.Y; float distToNPC = (float)Math.Sqrt(xDist * xDist + yDist * yDist); if (distToNPC < minDist) { diff --git a/Projectiles/Rogue/AlphaVirusProjectile.cs b/Projectiles/Rogue/AlphaVirusProjectile.cs index bfb35ea9f7..70daba02c9 100644 --- a/Projectiles/Rogue/AlphaVirusProjectile.cs +++ b/Projectiles/Rogue/AlphaVirusProjectile.cs @@ -5,6 +5,7 @@ using CalamityMod.NPCs.StormWeaver; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -24,57 +25,57 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 5; - projectile.timeLeft = lifetime; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.extraUpdates = 1; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 5; + Projectile.timeLeft = lifetime; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.extraUpdates = 1; } public override void AI() { - projectile.rotation += 0.05f * projectile.direction; + Projectile.rotation += 0.05f * Projectile.direction; - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - if (projectile.ai[0] > finalVelocity) + if (Projectile.ai[0] > finalVelocity) { - projectile.ai[0] -= decelerationRate; - if (projectile.ai[0] < finalVelocity) + Projectile.ai[0] -= decelerationRate; + if (Projectile.ai[0] < finalVelocity) { - projectile.ai[0] = finalVelocity; + Projectile.ai[0] = finalVelocity; } - projectile.velocity.Normalize(); - projectile.velocity *= projectile.ai[0]; + Projectile.velocity.Normalize(); + Projectile.velocity *= Projectile.ai[0]; } - if (projectile.timeLeft < lifetime - 30 && projectile.timeLeft % 15 == 0 && projectile.ai[0] <= finalVelocity) + if (Projectile.timeLeft < lifetime - 30 && Projectile.timeLeft % 15 == 0 && Projectile.ai[0] <= finalVelocity) { int projID = ModContent.ProjectileType(); - int damage = (int)(projectile.damage * 0.125f); + int damage = (int)(Projectile.damage * 0.125f); float kb = 1f; float ai0 = 1f; // Stealth strike spawned seekers set ai[0] to 1, which makes them cling to the parent projectile. Vector2 vel = Main.rand.NextVector2CircularEdge(5f, 5f); - Projectile.NewProjectile(projectile.Center, vel, projID, damage, kb, projectile.owner, ai0, projectile.identity); + Projectile.NewProjectile(Projectile.Center, vel, projID, damage, kb, Projectile.owner, ai0, Projectile.identity); } } else { - projectile.timeLeft--; + Projectile.timeLeft--; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float dist1 = Vector2.Distance(projectile.Center, target.Hitbox.TopLeft()); - float dist2 = Vector2.Distance(projectile.Center, target.Hitbox.TopRight()); - float dist3 = Vector2.Distance(projectile.Center, target.Hitbox.BottomLeft()); - float dist4 = Vector2.Distance(projectile.Center, target.Hitbox.BottomRight()); + float dist1 = Vector2.Distance(Projectile.Center, target.Hitbox.TopLeft()); + float dist2 = Vector2.Distance(Projectile.Center, target.Hitbox.TopRight()); + float dist3 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomLeft()); + float dist4 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -84,7 +85,7 @@ namespace CalamityMod.Projectiles.Rogue if (dist4 < minDist) minDist = dist4; - if (minDist <= projectile.width) + if (minDist <= Projectile.width) { target.AddBuff(ModContent.BuffType(), 120); } @@ -92,10 +93,10 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - float dist1 = Vector2.Distance(projectile.Center, target.Hitbox.TopLeft()); - float dist2 = Vector2.Distance(projectile.Center, target.Hitbox.TopRight()); - float dist3 = Vector2.Distance(projectile.Center, target.Hitbox.BottomLeft()); - float dist4 = Vector2.Distance(projectile.Center, target.Hitbox.BottomRight()); + float dist1 = Vector2.Distance(Projectile.Center, target.Hitbox.TopLeft()); + float dist2 = Vector2.Distance(Projectile.Center, target.Hitbox.TopRight()); + float dist3 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomLeft()); + float dist4 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -105,7 +106,7 @@ namespace CalamityMod.Projectiles.Rogue if (dist4 < minDist) minDist = dist4; - if (minDist <= projectile.width) + if (minDist <= Projectile.width) { target.AddBuff(ModContent.BuffType(), 120); } @@ -118,10 +119,10 @@ namespace CalamityMod.Projectiles.Rogue damage /= 5; } - float dist1 = Vector2.Distance(projectile.Center, target.Hitbox.TopLeft()); - float dist2 = Vector2.Distance(projectile.Center, target.Hitbox.TopRight()); - float dist3 = Vector2.Distance(projectile.Center, target.Hitbox.BottomLeft()); - float dist4 = Vector2.Distance(projectile.Center, target.Hitbox.BottomRight()); + float dist1 = Vector2.Distance(Projectile.Center, target.Hitbox.TopLeft()); + float dist2 = Vector2.Distance(Projectile.Center, target.Hitbox.TopRight()); + float dist3 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomLeft()); + float dist4 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomRight()); float minDist = dist1; if (dist2 < minDist) @@ -131,7 +132,7 @@ namespace CalamityMod.Projectiles.Rogue if (dist4 < minDist) minDist = dist4; - if (minDist > projectile.width) + if (minDist > Projectile.width) { damage /= 5; knockback = 0f; @@ -141,85 +142,85 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { // Aura effect - Texture2D aura = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/AlphaVirusAura"); + Texture2D aura = ModContent.Request("CalamityMod/Projectiles/Rogue/AlphaVirusAura"); float scaleStep = 0.03f; float rotationOffset = 0.03f; float drawTransparency = 0.1f; - if (projectile.timeLeft > lifetime - 10) + if (Projectile.timeLeft > lifetime - 10) { - drawTransparency = (lifetime - projectile.timeLeft) * (drawTransparency / 10); + drawTransparency = (lifetime - Projectile.timeLeft) * (drawTransparency / 10); } - else if (projectile.timeLeft < 25) + else if (Projectile.timeLeft < 25) { - drawTransparency = projectile.timeLeft * (drawTransparency / 25); + drawTransparency = Projectile.timeLeft * (drawTransparency / 25); } Color drawCol = Color.White; for (int i = 0; i < 10; i++) { - spriteBatch.Draw(aura, projectile.Center - Main.screenPosition, null, drawCol * drawTransparency, -(projectile.rotation * 0.2f) + (rotationOffset * i * i), aura.Size() / 2f, projectile.scale - (i * scaleStep), SpriteEffects.None, 0f); + spriteBatch.Draw(aura, Projectile.Center - Main.screenPosition, null, drawCol * drawTransparency, -(Projectile.rotation * 0.2f) + (rotationOffset * i * i), aura.Size() / 2f, Projectile.scale - (i * scaleStep), SpriteEffects.None, 0f); } // Dust - for (int i = 0; i < (lifetime - projectile.timeLeft) / 30; i++) + for (int i = 0; i < (lifetime - Projectile.timeLeft) / 30; i++) { - float min = projectile.width / 2; + float min = Projectile.width / 2; float max = radius; Vector2 pos = new Vector2(0f, -Main.rand.NextFloat(min, max)); pos = pos.RotatedByRandom(MathHelper.TwoPi); Vector2 velocity = -pos * 0.02f; - pos += projectile.Center; + pos += Projectile.Center; int dust = Dust.NewDust(pos, 1, 1, 89, 0f, 0f, 100, default, 1f); Main.dust[dust].noGravity = true; - Main.dust[dust].velocity = velocity + projectile.velocity; + Main.dust[dust].velocity = velocity + Projectile.velocity; } // Main sprite - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } public override void Kill(int timeLeft) { int numSeekers = 6; - int damage = projectile.damage; + int damage = Projectile.damage; float kb = 1f; float speed = 10f; for (int i = 0; i < numSeekers; i++) { Vector2 velocity = (MathHelper.Pi * i / 3f).ToRotationVector2() * speed; - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), damage, kb, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), damage, kb, Projectile.owner, 0f, 0f); } int numDust = 20; for (int i = 0; i < numDust; i++) { - float min = projectile.width / 2; + float min = Projectile.width / 2; float max = radius; Vector2 velocity = new Vector2(0f, -Main.rand.NextFloat(min, max)); velocity = velocity.RotatedByRandom(MathHelper.TwoPi); velocity *= 0.1f; - int dust = Dust.NewDust(projectile.Center, 1, 1, 89, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 89, 0f, 0f, 100, default, 1f); Main.dust[dust].noGravity = true; - Main.dust[dust].velocity = velocity + projectile.velocity; + Main.dust[dust].velocity = velocity + Projectile.velocity; } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); } } diff --git a/Projectiles/Rogue/AntumbraShardProjectile.cs b/Projectiles/Rogue/AntumbraShardProjectile.cs index b576d4106c..c0bd3ae1f2 100644 --- a/Projectiles/Rogue/AntumbraShardProjectile.cs +++ b/Projectiles/Rogue/AntumbraShardProjectile.cs @@ -14,42 +14,42 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Antumbra Shard"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.aiStyle = 113; + Projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - if (projectile.spriteDirection == -1) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + if (Projectile.spriteDirection == -1) { - projectile.rotation -= 1.57f; + Projectile.rotation -= 1.57f; } if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 62, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 62, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - if (projectile.timeLeft % 12 == 0) + if (Projectile.timeLeft % 12 == 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - int star = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + int star = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); Main.projectile[star].Calamity().rogue = true; } } @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -66,26 +66,26 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.damage /= 2; - if (projectile.damage < 1) + Projectile.damage /= 2; + if (Projectile.damage < 1) { - projectile.damage = 1; + Projectile.damage = 1; } - target.immune[projectile.owner] = 2; + target.immune[Projectile.owner] = 2; } public override void OnHitPvp(Player target, int damage, bool crit) { - projectile.damage /= 2; - if (projectile.damage < 1) + Projectile.damage /= 2; + if (Projectile.damage < 1) { - projectile.damage = 1; + Projectile.damage = 1; } } } diff --git a/Projectiles/Rogue/ApoctolithProj.cs b/Projectiles/Rogue/ApoctolithProj.cs index 0f82af6a13..2eebfb6a09 100644 --- a/Projectiles/Rogue/ApoctolithProj.cs +++ b/Projectiles/Rogue/ApoctolithProj.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -20,26 +21,26 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; } public override void AI() { //Constant rotation and gravity - projectile.rotation += 0.4f * projectile.direction; - projectile.velocity.Y += 0.3f; - if (projectile.velocity.Y > 16f) + Projectile.rotation += 0.4f * Projectile.direction; + Projectile.velocity.Y += 0.3f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } //Dust trail if (Main.rand.NextBool(13)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 180, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 180, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150, default, 0.9f); } } @@ -50,14 +51,14 @@ namespace CalamityMod.Projectiles.Rogue if (crit) target.Calamity().miscDefenseLoss = Math.Min(target.defense, 15); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) target.AddBuff(ModContent.BuffType(), 120); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 240); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { target.AddBuff(ModContent.BuffType(), 120); } @@ -65,35 +66,35 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Tink, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Tink, (int)Projectile.position.X, (int)Projectile.position.Y); //Dust on impact int dust_splash = 0; while (dust_splash < 9) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 180, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.15f, 120, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 180, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1.5f); dust_splash += 1; } // This only triggers if stealth is full - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { int split = 0; while (split < 5) { //Calculate the velocity of the projectile - float shardspeedX = -projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); - float shardspeedY = -projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; + float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); + float shardspeedY = -Projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; //Prevents the projectile speed from being too low if (shardspeedX < 2f && shardspeedX > -2f) { - shardspeedX += -projectile.velocity.X; + shardspeedX += -Projectile.velocity.X; } if (shardspeedY > 2f && shardspeedY < 2f) { - shardspeedY += -projectile.velocity.Y; + shardspeedY += -Projectile.velocity.Y; } //Spawn the projectile - int shard = Projectile.NewProjectile(projectile.position.X + shardspeedX, projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack / 2f, projectile.owner); + int shard = Projectile.NewProjectile(Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack / 2f, Projectile.owner); Main.projectile[shard].frame = Main.rand.Next(3); split += 1; } @@ -102,17 +103,17 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; + Texture2D tex = Main.projectileTexture[Projectile.type]; Vector2 origin = new Vector2(32f, 33f); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ApoctolithGlow"); + Texture2D tex = ModContent.Request("CalamityMod/Items/Weapons/Rogue/ApoctolithGlow"); Vector2 origin = new Vector2(32f, 33f); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } } } diff --git a/Projectiles/Rogue/ApoctolithShard.cs b/Projectiles/Rogue/ApoctolithShard.cs index ab0381a4f3..97bd0b2c11 100644 --- a/Projectiles/Rogue/ApoctolithShard.cs +++ b/Projectiles/Rogue/ApoctolithShard.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -12,35 +13,35 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Apoctolith Shard"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.width = 13; - projectile.height = 13; - projectile.Calamity().rogue = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.width = 13; + Projectile.height = 13; + Projectile.Calamity().rogue = true; } public override void AI() { //Rotation and gravity - projectile.rotation += 0.6f * projectile.direction; - projectile.velocity.Y += 0.27f; - if (projectile.velocity.Y > 16f) + Projectile.rotation += 0.6f * Projectile.direction; + Projectile.velocity.Y += 0.27f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y); //Dust effect int splash = 0; while (splash < 4) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 67, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.10f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 67, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); splash += 1; } } diff --git a/Projectiles/Rogue/AshenStalactiteDebris.cs b/Projectiles/Rogue/AshenStalactiteDebris.cs index e21e355fb9..a0c89f496b 100644 --- a/Projectiles/Rogue/AshenStalactiteDebris.cs +++ b/Projectiles/Rogue/AshenStalactiteDebris.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,36 +17,36 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 50; - projectile.Calamity().rogue = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 50; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation += 0.2f; - projectile.velocity.Y += 0.2f; - if (projectile.velocity.Y > 16f) + Projectile.rotation += 0.2f; + Projectile.velocity.Y += 0.2f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 3; i++) { - Dust.NewDust(projectile.Center, 1, 1, 1, projectile.velocity.X, projectile.velocity.Y); + Dust.NewDust(Projectile.Center, 1, 1, 1, Projectile.velocity.X, Projectile.velocity.Y); } } } diff --git a/Projectiles/Rogue/AshenStalactiteProj.cs b/Projectiles/Rogue/AshenStalactiteProj.cs index b457b77321..6b2931b7e0 100644 --- a/Projectiles/Rogue/AshenStalactiteProj.cs +++ b/Projectiles/Rogue/AshenStalactiteProj.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -18,37 +19,37 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 25; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 25; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(45f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.ToRadians(45f); - projectile.velocity.Y += 0.1f; - if (projectile.velocity.Y > 16f) + Projectile.velocity.Y += 0.1f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } @@ -56,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 10; i++) { - Dust.NewDust(projectile.Center, 1, 1, 1, projectile.velocity.X, projectile.velocity.Y); + Dust.NewDust(Projectile.Center, 1, 1, 1, Projectile.velocity.X, Projectile.velocity.Y); } } } diff --git a/Projectiles/Rogue/AshenStalagmiteProj.cs b/Projectiles/Rogue/AshenStalagmiteProj.cs index 63332c7a73..ad8e04f017 100644 --- a/Projectiles/Rogue/AshenStalagmiteProj.cs +++ b/Projectiles/Rogue/AshenStalagmiteProj.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -17,37 +18,37 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 100; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 100; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 2.355f; - projectile.velocity.Y += 0.075f; - if (projectile.velocity.Y > 16f) + Projectile.velocity.Y += 0.075f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -55,8 +56,8 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 6; i++) { - int dustIndex = Dust.NewDust(projectile.Center, 1, 1, 1, projectile.velocity.X, projectile.velocity.Y); - Projectile.NewProjectile(projectile.Center, Main.dust[dustIndex].velocity, ModContent.ProjectileType(), projectile.damage / 2, 0, projectile.owner, 0, 0); + int dustIndex = Dust.NewDust(Projectile.Center, 1, 1, 1, Projectile.velocity.X, Projectile.velocity.Y); + Projectile.NewProjectile(Projectile.Center, Main.dust[dustIndex].velocity, ModContent.ProjectileType(), Projectile.damage / 2, 0, Projectile.owner, 0, 0); } } } diff --git a/Projectiles/Rogue/AuroradicalSplitter.cs b/Projectiles/Rogue/AuroradicalSplitter.cs index eea1537cf5..1da3f8ce0f 100644 --- a/Projectiles/Rogue/AuroradicalSplitter.cs +++ b/Projectiles/Rogue/AuroradicalSplitter.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class AuroradicalSplitter : ModProjectile @@ -21,53 +22,53 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Auroradical Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 100; - projectile.penetrate = -1; - projectile.timeLeft = 50; - projectile.Calamity().rogue = true; - projectile.localNPCHitCooldown = 10; - projectile.usesLocalNPCImmunity = true; + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 100; + Projectile.penetrate = -1; + Projectile.timeLeft = 50; + Projectile.Calamity().rogue = true; + Projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; } public override void AI() { //Rotation - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; //Lighting - Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); + Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); //sound effects - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 9); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 9); } } //Change the scale size a little bit to make it pulse in and out float scaleAmt = (float)Main.mouseTextColor / 200f - 0.35f; scaleAmt *= 0.2f; - projectile.scale = scaleAmt + 0.95f; + Projectile.scale = scaleAmt + 0.95f; //Spawn dust - projectile.ai[0] += 1f; - if (projectile.ai[0] > 15f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 15f) { - int astral = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 100, default, 0.8f); + int astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 100, default, 0.8f); Main.dust[astral].noGravity = true; Main.dust[astral].velocity *= 0f; } @@ -75,11 +76,11 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { @@ -93,35 +94,35 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 9, 1f, 0f); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 9, 1f, 0f); for (float i = 0; i < 5; i++) { float angle = MathHelper.TwoPi / 5f * i; - int star = Projectile.NewProjectile(projectile.Center, angle.ToRotationVector2() * 5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.87), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[star].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + int star = Projectile.NewProjectile(Projectile.Center, angle.ToRotationVector2() * 5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.87), Projectile.knockBack, Projectile.owner, 0f, 0f); + Main.projectile[star].Calamity().stealthStrike = Projectile.Calamity().stealthStrike; } - projectile.position = projectile.Center; - projectile.width = projectile.height = 96; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 96; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int d = 0; d < 2; d++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 50, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 50, default, 1f); } for (int d = 0; d < 20; d++) { - int astral = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 0, default, 1.5f); + int astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 0, default, 1.5f); Main.dust[astral].noGravity = true; Main.dust[astral].velocity *= 3f; - astral = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 50, default, 1f); + astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 50, default, 1f); Main.dust[astral].velocity *= 2f; Main.dust[astral].noGravity = true; } for (int g = 0; g < 3; g++) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } } } diff --git a/Projectiles/Rogue/AuroradicalStar.cs b/Projectiles/Rogue/AuroradicalStar.cs index 4d1d93238f..d4bb762f68 100644 --- a/Projectiles/Rogue/AuroradicalStar.cs +++ b/Projectiles/Rogue/AuroradicalStar.cs @@ -7,6 +7,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class AuroradicalStar : ModProjectile @@ -20,51 +21,51 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Auroradical Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 100; - projectile.penetrate = 1; - projectile.timeLeft = 485; - projectile.Calamity().rogue = true; + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 100; + Projectile.penetrate = 1; + Projectile.timeLeft = 485; + Projectile.Calamity().rogue = true; } public override void AI() { //Rotation - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; //Lighting - Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); + Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); //sound effects - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 9); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 9); } } //Change the scale size a little bit to make it pulse in and out float scaleAmt = (float)Main.mouseTextColor / 200f - 0.35f; scaleAmt *= 0.2f; - projectile.scale = scaleAmt + 0.95f; + Projectile.scale = scaleAmt + 0.95f; //Spawn dust - projectile.ai[0] += 1f; - if (projectile.ai[0] > 15f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 15f) { - int astral = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 100, default, 0.8f); + int astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 100, default, 0.8f); Main.dust[astral].noGravity = true; Main.dust[astral].velocity *= 0f; } @@ -75,11 +76,11 @@ namespace CalamityMod.Projectiles.Rogue int i; for (i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].CanBeChasedBy(projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance)) + if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance)) { targetIndex = i; break; @@ -88,28 +89,28 @@ namespace CalamityMod.Projectiles.Rogue } if (targetIndex != -1) { - Vector2 targetVec = Main.npc[i].Center - projectile.Center; + Vector2 targetVec = Main.npc[i].Center - Projectile.Center; if (targetVec.Length() < 60f) { - projectile.Kill(); + Projectile.Kill(); return; } - if (projectile.ai[0] >= 120f) + if (Projectile.ai[0] >= 120f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] < 120f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] < 120f) { float speedMult = 25f; targetVec.Normalize(); targetVec *= speedMult; - projectile.velocity = (projectile.velocity * 15f + targetVec) / 16f; - projectile.velocity.Normalize(); - projectile.velocity *= speedMult; + Projectile.velocity = (Projectile.velocity * 15f + targetVec) / 16f; + Projectile.velocity.Normalize(); + Projectile.velocity *= speedMult; } - else if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) + else if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 18f) { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; + Projectile.velocity.X *= 1.01f; + Projectile.velocity.Y *= 1.01f; } } } @@ -117,11 +118,11 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { @@ -131,12 +132,12 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffect(Vector2 targetPos, int width) { - if (projectile.Calamity().stealthStrike && Main.myPlayer == projectile.owner) + if (Projectile.Calamity().stealthStrike && Main.myPlayer == Projectile.owner) { Vector2 pos = new Vector2(targetPos.X + width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (targetPos - pos) / 40f; - int dmg = projectile.damage / 2; - int comet = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, projectile.knockBack, projectile.owner); + int dmg = Projectile.damage / 2; + int comet = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, Projectile.knockBack, Projectile.owner); if (comet.WithinBounds(Main.maxProjectiles)) { Main.projectile[comet].Calamity().forceRogue = true; @@ -153,27 +154,27 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 9, 1f, 0f); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 96); - projectile.localNPCHitCooldown = 10; - projectile.usesLocalNPCImmunity = true; - projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 9, 1f, 0f); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 96); + Projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.Damage(); for (int d = 0; d < 2; d++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 50, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 50, default, 1f); } for (int d = 0; d < 20; d++) { - int astral = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 0, default, 1.5f); + int astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 0, default, 1.5f); Main.dust[astral].noGravity = true; Main.dust[astral].velocity *= 3f; - astral = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 50, default, 1f); + astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 50, default, 1f); Main.dust[astral].velocity *= 2f; Main.dust[astral].noGravity = true; } for (int g = 0; g < 3; g++) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } } } diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index b03de6897f..f3ca0201bc 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,70 +17,70 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 200; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 200; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; } public override void AI() { if (Main.rand.NextBool(6)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 14, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.StickToTiles(true, false); - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + Projectile.StickToTiles(true, false); + if (Projectile.owner == Main.myPlayer && Projectile.timeLeft <= 3) { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 128); + Projectile.tileCollide = false; + Projectile.ai[1] = 0f; + Projectile.alpha = 255; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 128); } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 10f) { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 10f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X *= 0.97f; - if (Math.Abs(projectile.velocity.X) < 0.01f) + Projectile.velocity.X *= 0.97f; + if (Math.Abs(Projectile.velocity.X) < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 128); - Main.PlaySound(SoundID.Item14, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 128); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); int projAmt = Main.rand.Next(3, 5); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int s = 0; s < projAmt; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); } int cloudAmt = Main.rand.Next(8, 13); for (int c = 0; c < cloudAmt; c++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 1f, Projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); } } for (int d = 0; d < 5; d++) { - int boom = Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, 0f, 0f, 100, default, 2f); + int boom = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 2f); Main.dust[boom].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -89,25 +90,25 @@ namespace CalamityMod.Projectiles.Rogue } for (int d = 0; d < 9; d++) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 180); - projectile.Kill(); + Projectile.Kill(); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Venom, 180); - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Rogue/BallisticPoisonBombSpike.cs b/Projectiles/Rogue/BallisticPoisonBombSpike.cs index 09212c1286..7a4856f85b 100644 --- a/Projectiles/Rogue/BallisticPoisonBombSpike.cs +++ b/Projectiles/Rogue/BallisticPoisonBombSpike.cs @@ -14,30 +14,30 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.extraUpdates = 2; - projectile.aiStyle = 93; + Projectile.width = 10; + Projectile.height = 10; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.alpha = 255; + Projectile.extraUpdates = 2; + Projectile.aiStyle = 93; aiType = ProjectileID.NailFriendly; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.alpha -= 10; - if (projectile.alpha < 0) + Projectile.alpha -= 10; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 4f) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 0.75f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, default, 0.75f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 120); - target.immune[projectile.owner] = 1; + target.immune[Projectile.owner] = 1; } public override void OnHitPvp(Player target, int damage, bool crit) @@ -56,13 +56,13 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 32; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 2; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -72,10 +72,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 2; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Rogue/BarrelShrapnel.cs b/Projectiles/Rogue/BarrelShrapnel.cs index 29658ceac8..bfea0582a6 100644 --- a/Projectiles/Rogue/BarrelShrapnel.cs +++ b/Projectiles/Rogue/BarrelShrapnel.cs @@ -11,33 +11,33 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Shrapnel"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 160; - projectile.tileCollide = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; + Projectile.width = 12; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 160; + Projectile.tileCollide = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; } public override void AI() { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; if (hitTile) { - projectile.velocity.X = 0f; - projectile.rotation = MathHelper.Pi; + Projectile.velocity.X = 0f; + Projectile.rotation = MathHelper.Pi; } else { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -47,12 +47,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.OnFire, 60 * 4); - projectile.Kill(); + Projectile.Kill(); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.OnFire, 60 * 4); - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Rogue/BettyExplosion.cs b/Projectiles/Rogue/BettyExplosion.cs index ebf76d4bf5..accce6d771 100644 --- a/Projectiles/Rogue/BettyExplosion.cs +++ b/Projectiles/Rogue/BettyExplosion.cs @@ -15,31 +15,31 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 75; - projectile.height = 75; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 20; - projectile.Calamity().rogue = true; + Projectile.width = 75; + Projectile.height = 75; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 20; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) SpawnExplosionDust(); - if (projectile.ai[0] <= 1f) - projectile.ai[0]++; + if (Projectile.ai[0] <= 1f) + Projectile.ai[0]++; } void SpawnExplosionDust() { // Sparks and such - Vector2 corner = projectile.position; + Vector2 corner = Projectile.position; for (int i = 0; i < 15; i++) { - int idx = Dust.NewDust(corner, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(corner, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -49,15 +49,15 @@ namespace CalamityMod.Projectiles.Rogue } for (int i = 0; i < 25; i++) { - int idx = Dust.NewDust(corner, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int idx = Dust.NewDust(corner, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(corner, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + idx = Dust.NewDust(corner, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[idx].velocity *= 2f; } // Smoke, which counts as a Gore - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } } diff --git a/Projectiles/Rogue/BileExplosion.cs b/Projectiles/Rogue/BileExplosion.cs index de12e88bd6..aa6437707f 100644 --- a/Projectiles/Rogue/BileExplosion.cs +++ b/Projectiles/Rogue/BileExplosion.cs @@ -17,37 +17,37 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.Calamity().rogue = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.Calamity().rogue = true; } public override void AI() { //projectile.ai[0] == 1f means spawned by Skyfin Bombers SS - projectile.position = projectile.Center; - if (projectile.Calamity().stealthStrike || projectile.ai[0] == 1f) - projectile.width = projectile.height = 120; + Projectile.position = Projectile.Center; + if (Projectile.Calamity().stealthStrike || Projectile.ai[0] == 1f) + Projectile.width = Projectile.height = 120; else - projectile.width = projectile.height = 70; - projectile.position -= projectile.Size / 2f; + Projectile.width = Projectile.height = 70; + Projectile.position -= Projectile.Size / 2f; for (int i = 0; i < 15; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); - dust.velocity = projectile.width / 33.333f * Vector2.One.RotatedByRandom(MathHelper.TwoPi); - dust.scale = projectile.width == 120 ? 3.1f : 2.2f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); + dust.velocity = Projectile.width / 33.333f * Vector2.One.RotatedByRandom(MathHelper.TwoPi); + dust.scale = Projectile.width == 120 ? 3.1f : 2.2f; dust.noGravity = true; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.ai[0] != 1f) + if (Projectile.ai[0] != 1f) { - target.immune[projectile.owner] = 9; + target.immune[Projectile.owner] = 9; } target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Rogue/BlastBarrelProjectile.cs b/Projectiles/Rogue/BlastBarrelProjectile.cs index fc6b0ab545..ac0036a8d0 100644 --- a/Projectiles/Rogue/BlastBarrelProjectile.cs +++ b/Projectiles/Rogue/BlastBarrelProjectile.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,71 +16,71 @@ namespace CalamityMod.Projectiles.Rogue public float OldVelocityX = 0f; public float RemainingBounces { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } - public bool CollideX => projectile.oldPosition.X == projectile.position.X; + public bool CollideX => Projectile.oldPosition.X == Projectile.position.X; public override void SetStaticDefaults() { DisplayName.SetDefault("Barrel"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 48; - projectile.height = 48; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.ignoreWater = true; - projectile.timeLeft = 480; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 48; + Projectile.height = 48; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.ignoreWater = true; + Projectile.timeLeft = 480; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - RemainingBounces = projectile.Calamity().stealthStrike ? 3 : 1; - projectile.localAI[0] = 1f; + RemainingBounces = Projectile.Calamity().stealthStrike ? 3 : 1; + Projectile.localAI[0] = 1f; } - projectile.rotation += Math.Sign(projectile.velocity.X) * MathHelper.ToRadians(8f); - if (projectile.velocity.Y < 10f) - projectile.velocity.Y += 0.2f; + Projectile.rotation += Math.Sign(Projectile.velocity.X) * MathHelper.ToRadians(8f); + if (Projectile.velocity.Y < 10f) + Projectile.velocity.Y += 0.2f; if (CollideX && BounceEffectCooldown == 0) { BounceEffects(); - projectile.velocity.X = -OldVelocityX; + Projectile.velocity.X = -OldVelocityX; } else if (BounceEffectCooldown > 0) BounceEffectCooldown--; - if (projectile.velocity.X != 0f) - OldVelocityX = Math.Sign(projectile.velocity.X) * 12f; + if (Projectile.velocity.X != 0f) + OldVelocityX = Math.Sign(Projectile.velocity.X) * 12f; } public void BounceEffects() { int projectileCount = 12; - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { projectileCount += 4; // More shit the closer we are to death } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < projectileCount; i++) { if (Main.rand.NextBool(3)) { Vector2 shrapnelVelocity = (Vector2.UnitY * Main.rand.NextFloat(-19f, -4f)).RotatedByRandom(MathHelper.ToRadians(30f)); - Projectile.NewProjectile(projectile.Center, projectile.velocity + shrapnelVelocity, ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Projectile.velocity + shrapnelVelocity, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner); } else { Vector2 fireVelocity = (Vector2.UnitY * Main.rand.NextFloat(-19f, -4f)).RotatedByRandom(MathHelper.ToRadians(40f)); - Projectile fire = Projectile.NewProjectileDirect(projectile.Center, projectile.velocity + fireVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.75f), 1f, projectile.owner); + Projectile fire = Projectile.NewProjectileDirect(Projectile.Center, Projectile.velocity + fireVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), 1f, Projectile.owner); fire.timeLeft = 300; fire.penetrate = 3; } @@ -89,14 +90,14 @@ namespace CalamityMod.Projectiles.Rogue BounceEffectCooldown = 15; if (RemainingBounces <= 0) { - projectile.Kill(); + Projectile.Kill(); } - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); } public override bool OnTileCollide(Vector2 oldVelocity) => false; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/BlazingStarProj.cs b/Projectiles/Rogue/BlazingStarProj.cs index 222280fc47..e4b0f26cc9 100644 --- a/Projectiles/Rogue/BlazingStarProj.cs +++ b/Projectiles/Rogue/BlazingStarProj.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -17,116 +18,116 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Blazing Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 32; - projectile.friendly = true; - projectile.tileCollide = true; - projectile.ignoreWater = true; - projectile.penetrate = 5; - projectile.timeLeft = Lifetime; - projectile.Calamity().rogue = true; + Projectile.width = 34; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 5; + Projectile.timeLeft = Lifetime; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.Calamity().stealthStrike) - projectile.penetrate = projectile.maxPenetrate = -1; + if (Projectile.Calamity().stealthStrike) + Projectile.penetrate = Projectile.maxPenetrate = -1; // Boomerang rotation - projectile.rotation += 0.4f * projectile.direction; + Projectile.rotation += 0.4f * Projectile.direction; // Boomerang sound - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } // Returns after some number of frames in the air - if (projectile.timeLeft < Lifetime - ReboundTime) - projectile.ai[0] = 1f; + if (Projectile.timeLeft < Lifetime - ReboundTime) + Projectile.ai[0] = 1f; - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { - projectile.tileCollide = false; + Projectile.tileCollide = false; float returnSpeed = BlazingStar.Speed * 2.5f; float acceleration = 2f; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; // Delete the projectile if it's excessively far away. // Relying on the length instead of a second square root call for Normalize is used here for general performance since both the distance // and normalized vector are used in this code. - float distanceToPlayer = projectile.Distance(owner.Center); - Vector2 velocity = (owner.Center - projectile.Center) / distanceToPlayer * returnSpeed; + float distanceToPlayer = Projectile.Distance(owner.Center); + Vector2 velocity = (owner.Center - Projectile.Center) / distanceToPlayer * returnSpeed; // Kill the projectile is if it's super far from the player. if (distanceToPlayer > 3000f) - projectile.Kill(); + Projectile.Kill(); // Home back in on the player. // No, projectiles do not have a SimpleFlyMovement extension method like NPCs do. - if (projectile.velocity.X < velocity.X) + if (Projectile.velocity.X < velocity.X) { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && velocity.X > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X = Projectile.velocity.X + acceleration; + if (Projectile.velocity.X < 0f && velocity.X > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > velocity.X) + else if (Projectile.velocity.X > velocity.X) { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && velocity.X < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X = Projectile.velocity.X - acceleration; + if (Projectile.velocity.X > 0f && velocity.X < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < velocity.Y) + if (Projectile.velocity.Y < velocity.Y) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && velocity.Y > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; + if (Projectile.velocity.Y < 0f && velocity.Y > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > velocity.Y) + else if (Projectile.velocity.Y > velocity.Y) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && velocity.Y < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; + if (Projectile.velocity.Y > 0f && velocity.Y < 0f) + Projectile.velocity.Y -= acceleration; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } // Make the star bounce on tiles. public override bool OnTileCollide(Vector2 oldVelocity) { // Impacts the terrain even though it bounces off. - Main.PlaySound(SoundID.Dig, projectile.Center); - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; return false; } } diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 033ee89ef7..7d5307d954 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -18,49 +18,49 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Bloodsoaked Crasher"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 6; - projectile.timeLeft = 600; //10 seconds and counting (but not actually because extra updates) - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - projectile.extraUpdates = 1; + Projectile.width = Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 6; + Projectile.timeLeft = 600; //10 seconds and counting (but not actually because extra updates) + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.extraUpdates = 1; } public override void AI() { - float speed = projectile.velocity.Length(); + float speed = Projectile.velocity.Length(); if (grind > 0) { grind--; // Suddenly stop when on top of enemies. - projectile.velocity.X *= 0.75f; - projectile.velocity.Y *= 0.75f; + Projectile.velocity.X *= 0.75f; + Projectile.velocity.Y *= 0.75f; } else { // Gravity - projectile.velocity.Y += 0.11f; + Projectile.velocity.Y += 0.11f; // Cap velocity. - speed = projectile.velocity.Length(); + speed = Projectile.velocity.Length(); if (speed > MaxSpeed) - projectile.velocity *= MaxSpeed / speed; + Projectile.velocity *= MaxSpeed / speed; } // Spin constantly, but even faster when grinding or going fast float spinRate = grind > 0 ? 0.28f : 0.09f; if (grind <= 0) spinRate += speed * 0.005f; - projectile.rotation += spinRate * projectile.direction; + Projectile.rotation += spinRate * Projectile.direction; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -68,17 +68,17 @@ namespace CalamityMod.Projectiles.Rogue bounce--; if (bounce <= 0) { - projectile.Kill(); //you can only bounce so much 'til death + Projectile.Kill(); //you can only bounce so much 'til death } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -87,13 +87,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - OnHitEffects(!target.canGhostHeal || Main.player[projectile.owner].moonLeech); + OnHitEffects(!target.canGhostHeal || Main.player[Projectile.owner].moonLeech); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - OnHitEffects(Main.player[projectile.owner].moonLeech); + OnHitEffects(Main.player[Projectile.owner].moonLeech); } private void OnHitEffects(bool cannotLifesteal) @@ -102,12 +102,12 @@ namespace CalamityMod.Projectiles.Rogue if (grind > 15) grind = 15; // except when it's too much - if (projectile.Calamity().stealthStrike && projectile.owner == Main.myPlayer) //stealth strike attack + if (Projectile.Calamity().stealthStrike && Projectile.owner == Main.myPlayer) //stealth strike attack { int projID = ModContent.ProjectileType(); - int bloodDamage = projectile.damage; + int bloodDamage = Projectile.damage; float bloodKB = 1f; - int stealth = Projectile.NewProjectile(projectile.Center, Vector2.Zero, projID, bloodDamage, bloodKB, projectile.owner, 1f, 0.85f + Main.rand.NextFloat() * 1.15f); + int stealth = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, projID, bloodDamage, bloodKB, Projectile.owner, 1f, 0.85f + Main.rand.NextFloat() * 1.15f); if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().forceRogue = true; @@ -118,14 +118,14 @@ namespace CalamityMod.Projectiles.Rogue if (cannotLifesteal || Main.rand.NextBool(2)) //canGhostHeal be like lol return; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.statLife += 1; player.HealEffect(1); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) //afterimages { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/BlueFlamePillar.cs b/Projectiles/Rogue/BlueFlamePillar.cs index 5cab04db5b..af88439bff 100644 --- a/Projectiles/Rogue/BlueFlamePillar.cs +++ b/Projectiles/Rogue/BlueFlamePillar.cs @@ -16,20 +16,20 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 80; - projectile.height = 322; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 180; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.Calamity().rogue = true; + Projectile.width = 80; + Projectile.height = 322; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.Calamity().rogue = true; } public override void AI() { //2-6 - projectile.frameCounter += 1; - if (projectile.frameCounter % 7 == 6) + Projectile.frameCounter += 1; + if (Projectile.frameCounter % 7 == 6) { frameY += 1; if (frameY >= 6) @@ -39,20 +39,20 @@ namespace CalamityMod.Projectiles.Rogue } if (frameX >= 3) { - projectile.Kill(); + Projectile.Kill(); } } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.position.Y -= projectile.height / 2; //position adjustments - projectile.localAI[0] = 1f; + Projectile.position.Y -= Projectile.height / 2; //position adjustments + Projectile.localAI[0] = 1f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; + Texture2D tex = Main.projectileTexture[Projectile.type]; Rectangle frame = new Rectangle(frameX * 80, frameY * 322, 80, 322); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Rogue/BlunderBoosterLightning.cs b/Projectiles/Rogue/BlunderBoosterLightning.cs index 957c4c6bd3..48153f7827 100644 --- a/Projectiles/Rogue/BlunderBoosterLightning.cs +++ b/Projectiles/Rogue/BlunderBoosterLightning.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,53 +16,53 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = 3; - projectile.timeLeft = 120; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = 3; + Projectile.timeLeft = 120; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; - if (projectile.timeLeft < 55 && projectile.ai[1] != 1f) + if (Projectile.timeLeft < 55 && Projectile.ai[1] != 1f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - projectile.ai[1]++; - if (projectile.ai[1] >= 15f) + Projectile.ai[1]++; + if (Projectile.ai[1] >= 15f) { float minDist = 999f; int index = -1; for (int i = 0; i < Main.npc.Length; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < minDist) { minDist = dist; @@ -73,14 +74,14 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocityNew; if (minDist < 999f && index != -1) { - velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew = Main.npc[index].Center - Projectile.Center; velocityNew.Normalize(); velocityNew *= 2f; - projectile.velocity += velocityNew; - if (projectile.velocity.Length() > 10f) + Projectile.velocity += velocityNew; + if (Projectile.velocity.Length() > 10f) { - projectile.velocity.Normalize(); - projectile.velocity *= 10f; + Projectile.velocity.Normalize(); + Projectile.velocity *= 10f; } } } @@ -99,25 +100,25 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D sprite; - if (projectile.ai[0] == 0f) - sprite = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/BlunderBoosterLightning"); + if (Projectile.ai[0] == 0f) + sprite = ModContent.Request("CalamityMod/Projectiles/Rogue/BlunderBoosterLightning"); else - sprite = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/BlunderBoosterLightning2"); + sprite = ModContent.Request("CalamityMod/Projectiles/Rogue/BlunderBoosterLightning2"); Color drawColour = Color.White; Vector2 origin = new Vector2(frameWidth / 2, frameHeight / 2); - spriteBatch.Draw(sprite, projectile.Center - Main.screenPosition, new Rectangle(0, frameHeight * projectile.frame, frameWidth, frameHeight), drawColour, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(sprite, Projectile.Center - Main.screenPosition, new Rectangle(0, frameHeight * Projectile.frame, frameWidth, frameHeight), drawColour, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 93, 0.25f, 0f); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 93, 0.25f, 0f); for (int i = 0; i < 5; i++) { int dustType = 60; - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 0.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 0.5f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Rogue/BouncingBettyProjectile.cs b/Projectiles/Rogue/BouncingBettyProjectile.cs index 4a4bbd31b9..92c1fe9ee7 100644 --- a/Projectiles/Rogue/BouncingBettyProjectile.cs +++ b/Projectiles/Rogue/BouncingBettyProjectile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class BouncingBettyProjectile : ModProjectile @@ -13,21 +14,21 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 16; - projectile.height = 22; - projectile.friendly = true; - projectile.timeLeft = 600; - projectile.penetrate = 3; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; + Projectile.width = 16; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.timeLeft = 600; + Projectile.penetrate = 3; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; } private void Explode() { - Main.PlaySound(SoundID.Item14, projectile.Center); - if (Main.myPlayer == projectile.owner) + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + if (Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 8f, projectile.owner); - if (projectile.Calamity().stealthStrike) + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 8f, Projectile.owner); + if (Projectile.Calamity().stealthStrike) { int projectileCount = 12; for (int i = 0; i < projectileCount; i++) @@ -35,12 +36,12 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(2)) { Vector2 shrapnelVelocity = (Vector2.UnitY * Main.rand.NextFloat(-12f, -4f)).RotatedByRandom(MathHelper.ToRadians(30f)); - Projectile.NewProjectile(projectile.Center, projectile.velocity + shrapnelVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), 3f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Projectile.velocity + shrapnelVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 3f, Projectile.owner); } else { Vector2 fireVelocity = (Vector2.UnitY * Main.rand.NextFloat(-12f, -4f)).RotatedByRandom(MathHelper.ToRadians(40f)); - Projectile fire = Projectile.NewProjectileDirect(projectile.Center, projectile.velocity + fireVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.6f), 1f, projectile.owner); + Projectile fire = Projectile.NewProjectileDirect(Projectile.Center, Projectile.velocity + fireVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6f), 1f, Projectile.owner); fire.localNPCHitCooldown = 9; fire.timeLeft = 240; } @@ -50,32 +51,32 @@ namespace CalamityMod.Projectiles.Rogue } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - Point tileCoords = projectile.Bottom.ToTileCoordinates(); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Point tileCoords = Projectile.Bottom.ToTileCoordinates(); if (Main.tile[tileCoords.X, tileCoords.Y + 1].nactive() && WorldGen.SolidTile(Main.tile[tileCoords.X, tileCoords.Y + 1]) && - projectile.timeLeft < 575) + Projectile.timeLeft < 575) { Explode(); - projectile.Kill(); + Projectile.Kill(); } else { - projectile.velocity.Y += 0.4f; - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; + Projectile.velocity.Y += 0.4f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; } } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.velocity *= -1f; + Projectile.velocity *= -1f; return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Explode(); - projectile.velocity *= -1f; + Projectile.velocity *= -1f; } } } diff --git a/Projectiles/Rogue/BouncingBettyShrapnel.cs b/Projectiles/Rogue/BouncingBettyShrapnel.cs index faaeeb0618..746de968b5 100644 --- a/Projectiles/Rogue/BouncingBettyShrapnel.cs +++ b/Projectiles/Rogue/BouncingBettyShrapnel.cs @@ -10,33 +10,33 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Shrapnel"); - Main.projFrames[projectile.type] = 1; + Main.projFrames[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.tileCollide = true; - projectile.Calamity().rogue = true; + Projectile.width = 12; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.tileCollide = true; + Projectile.Calamity().rogue = true; } public override bool OnTileCollide(Vector2 oldVelocity) => false; public override void AI() { - if (Math.Abs(projectile.position.Y - projectile.oldPosition.Y) > 4f) + if (Math.Abs(Projectile.position.Y - Projectile.oldPosition.Y) > 4f) { - projectile.velocity.X = 0f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity.X = 0f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } else { - projectile.rotation = MathHelper.Pi; + Projectile.rotation = MathHelper.Pi; } - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; } } } diff --git a/Projectiles/Rogue/BouncingEyeballProjectile.cs b/Projectiles/Rogue/BouncingEyeballProjectile.cs index da8c602865..b9b12f9894 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectile.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectile.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static System.Math; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,60 +16,60 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Eyeball"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 26; - projectile.friendly = true; - projectile.tileCollide = true; - projectile.timeLeft = 300; - projectile.penetrate = 2; - projectile.Calamity().rogue = true; + Projectile.width = 30; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.timeLeft = 300; + Projectile.penetrate = 2; + Projectile.Calamity().rogue = true; } public override bool OnTileCollide(Vector2 oldVelocity) { - Main.PlaySound(SoundID.NPCHit, (int)projectile.Center.X, (int)projectile.Center.Y, 19, 0.7f); + SoundEngine.PlaySound(SoundID.NPCHit, (int)Projectile.Center.X, (int)Projectile.Center.Y, 19, 0.7f); Bounces--; if (Bounces <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; } public override void AI() { - if (projectile.velocity.Y <= 10f) - projectile.velocity.Y += 0.15f; - projectile.rotation += MathHelper.ToRadians(5f) * Sign(projectile.velocity.X); + if (Projectile.velocity.Y <= 10f) + Projectile.velocity.Y += 0.15f; + Projectile.rotation += MathHelper.ToRadians(5f) * Sign(Projectile.velocity.X); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCHit, (int)projectile.Center.X, (int)projectile.Center.Y, 19, 0.7f); + SoundEngine.PlaySound(SoundID.NPCHit, (int)Projectile.Center.X, (int)Projectile.Center.Y, 19, 0.7f); int dustCount = Main.rand.Next(8, 16); for (int index = 0; index < dustCount; index++) { - Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(4f, 9f) + projectile.velocity / 2f; - Dust.NewDust(projectile.Center, 4, 4, DustID.Blood, velocity.X, velocity.Y); + Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(4f, 9f) + Projectile.velocity / 2f; + Dust.NewDust(Projectile.Center, 4, 4, DustID.Blood, velocity.X, velocity.Y); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs index a51307a88c..9de07f6a94 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -14,56 +15,56 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Eyeball"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 26; - projectile.friendly = true; - projectile.tileCollide = true; - projectile.timeLeft = 280; - projectile.penetrate = -1; - projectile.Calamity().rogue = true; + Projectile.width = 30; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.timeLeft = 280; + Projectile.penetrate = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation(); - if (Math.Abs(projectile.velocity.X) > 23f) + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Math.Abs(Projectile.velocity.X) > 23f) { - projectile.velocity.X = Math.Sign(projectile.velocity.X) * 23f; + Projectile.velocity.X = Math.Sign(Projectile.velocity.X) * 23f; } - if (Math.Abs(projectile.velocity.Y) > 23f) + if (Math.Abs(Projectile.velocity.Y) > 23f) { - projectile.velocity.Y = Math.Sign(projectile.velocity.Y) * 23f; + Projectile.velocity.Y = Math.Sign(Projectile.velocity.Y) * 23f; } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.velocity != oldVelocity) + if (Projectile.velocity != oldVelocity) { - projectile.velocity = Main.rand.NextFloat(-1.15f, -0.85f) * oldVelocity * Bounciness; + Projectile.velocity = Main.rand.NextFloat(-1.15f, -0.85f) * oldVelocity * Bounciness; } - Main.PlaySound(SoundID.NPCHit, (int)projectile.Center.X, (int)projectile.Center.Y, 19, 0.7f); + SoundEngine.PlaySound(SoundID.NPCHit, (int)Projectile.Center.X, (int)Projectile.Center.Y, 19, 0.7f); return false; } public override void Kill(int timeLeft) { // Explode into a large display of blood. - Main.PlaySound(SoundID.NPCHit, (int)projectile.Center.X, (int)projectile.Center.Y, 19, 0.7f); + SoundEngine.PlaySound(SoundID.NPCHit, (int)Projectile.Center.X, (int)Projectile.Center.Y, 19, 0.7f); int dustCount = Main.rand.Next(15, 26); for (int index = 0; index < dustCount; index++) { - Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(4f, 9f) + projectile.velocity / 2f; - Dust.NewDust(projectile.Center, 4, 4, DustID.Blood, velocity.X, velocity.Y); + Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(4f, 9f) + Projectile.velocity / 2f; + Dust.NewDust(Projectile.Center, 4, 4, DustID.Blood, velocity.X, velocity.Y); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/BouncyBol.cs b/Projectiles/Rogue/BouncyBol.cs index 66c23446b1..9b87a57645 100644 --- a/Projectiles/Rogue/BouncyBol.cs +++ b/Projectiles/Rogue/BouncyBol.cs @@ -20,28 +20,28 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 8; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.aiStyle = 14; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 8; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; + Projectile.aiStyle = 14; } public override void AI() { - if (hasHitEnemy == true && projectile.timeLeft < 575) + if (hasHitEnemy == true && Projectile.timeLeft < 575) { - projectile.velocity.X *= 1.005f; //you broke up, time to yeet yourself out - projectile.velocity.Y *= 1.005f; - if (projectile.velocity.X > 16f) + Projectile.velocity.X *= 1.005f; //you broke up, time to yeet yourself out + Projectile.velocity.Y *= 1.005f; + if (Projectile.velocity.X > 16f) { - projectile.velocity.X = 16f; + Projectile.velocity.X = 16f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } } @@ -66,9 +66,9 @@ namespace CalamityMod.Projectiles.Rogue { previousNPCs.Add(i); } - if (npc.CanBeChasedBy(projectile, false) && npc != target && !hasHitNPC) + if (npc.CanBeChasedBy(Projectile, false) && npc != target && !hasHitNPC) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < minDist) { minDist = dist; @@ -80,32 +80,32 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocityNew; if (minDist < 999f) { - if (projectile.Calamity().stealthStrike && hasHitEnemy == false) + if (Projectile.Calamity().stealthStrike && hasHitEnemy == false) { - projectile.damage = (int)(projectile.damage * 1.5f); + Projectile.damage = (int)(Projectile.damage * 1.5f); } else { - projectile.damage = (int)(projectile.damage * 1.1f); + Projectile.damage = (int)(Projectile.damage * 1.1f); } hasHitEnemy = true; targetNPC = index; - velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew = Main.npc[index].Center - Projectile.Center; velocityNew.Normalize(); velocityNew *= 15f; - projectile.velocity = velocityNew; + Projectile.velocity = velocityNew; } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X * 1.001f; + Projectile.velocity.X = -oldVelocity.X * 1.001f; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y * 1.001f; + Projectile.velocity.Y = -oldVelocity.Y * 1.001f; } return false; } diff --git a/Projectiles/Rogue/BrackishFlaskProj.cs b/Projectiles/Rogue/BrackishFlaskProj.cs index f7b03493e5..e9467a59ee 100644 --- a/Projectiles/Rogue/BrackishFlaskProj.cs +++ b/Projectiles/Rogue/BrackishFlaskProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -17,20 +18,20 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 180; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 2; + Projectile.timeLeft = 180; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item107, projectile.Center); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); int randomDust = Utils.SelectRandom(Main.rand, new int[] { 33, @@ -38,26 +39,26 @@ namespace CalamityMod.Projectiles.Rogue }); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X, projectile.oldVelocity.Y); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.oldVelocity.X, Projectile.oldVelocity.Y); } float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -32f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, -32f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 1f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, 1f, 0f); } } } diff --git a/Projectiles/Rogue/BrackishSpear.cs b/Projectiles/Rogue/BrackishSpear.cs index 6629949215..6477247aeb 100644 --- a/Projectiles/Rogue/BrackishSpear.cs +++ b/Projectiles/Rogue/BrackishSpear.cs @@ -16,73 +16,73 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 52; - projectile.height = 52; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; + Projectile.width = 52; + Projectile.height = 52; + Projectile.aiStyle = 4; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; aiType = ProjectileID.CrystalVileShardHead; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 6; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 6; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.ai[0] == 0f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + if (Projectile.ai[0] == 0f) { - projectile.alpha -= 50; - if (projectile.alpha <= 0) + Projectile.alpha -= 50; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) + Projectile.alpha = 0; + Projectile.ai[0] = 1f; + if (Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; + Projectile.ai[1] += 1f; + Projectile.position += Projectile.velocity * 1f; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - int projType = projectile.type; - if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) + int projType = Projectile.type; + if (Projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) { projType = ModContent.ProjectileType(); } - int dmg = projectile.damage; - float kBack = projectile.knockBack; - int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, projType, dmg, kBack, projectile.owner, 0f, projectile.ai[1] + 1f); + int dmg = Projectile.damage; + float kBack = Projectile.knockBack; + int number = Projectile.NewProjectile(Projectile.position.X + Projectile.velocity.X + (float)(Projectile.width / 2), Projectile.position.Y + Projectile.velocity.Y + (float)(Projectile.height / 2), Projectile.velocity.X, Projectile.velocity.Y, projType, dmg, kBack, Projectile.owner, 0f, Projectile.ai[1] + 1f); NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); } } } else { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170) { for (int num55 = 0; num55 < 8; num55++) { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); + int num56 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); Main.dust[num56].noGravity = true; Main.dust[num56].velocity *= 0.5f; } } - projectile.alpha += 7; - if (projectile.alpha >= 255) + Projectile.alpha += 7; + if (Projectile.alpha >= 255) { - projectile.Kill(); + Projectile.Kill(); } } if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 206, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); } } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { @@ -102,13 +102,13 @@ namespace CalamityMod.Projectiles.Rogue float rotation = MathHelper.ToRadians(20); for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + int projectile2 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); Main.projectile[projectile2].penetrate = 1; } for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 206, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); } } } diff --git a/Projectiles/Rogue/BrackishSpear2.cs b/Projectiles/Rogue/BrackishSpear2.cs index 210476b71c..8105396fe4 100644 --- a/Projectiles/Rogue/BrackishSpear2.cs +++ b/Projectiles/Rogue/BrackishSpear2.cs @@ -16,60 +16,60 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 52; - projectile.height = 52; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; + Projectile.width = 52; + Projectile.height = 52; + Projectile.aiStyle = 4; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; aiType = ProjectileID.CrystalVileShardShaft; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.ai[0] == 0f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + if (Projectile.ai[0] == 0f) { - projectile.alpha -= 50; - if (projectile.alpha <= 0) + Projectile.alpha -= 50; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) + Projectile.alpha = 0; + Projectile.ai[0] = 1f; + if (Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; + Projectile.ai[1] += 1f; + Projectile.position += Projectile.velocity * 1f; } } } else { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170) { for (int num55 = 0; num55 < 8; num55++) { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); + int num56 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); Main.dust[num56].noGravity = true; Main.dust[num56].velocity *= 0.5f; } } - projectile.alpha += 7; - if (projectile.alpha >= 255) + Projectile.alpha += 7; + if (Projectile.alpha >= 255) { - projectile.Kill(); + Projectile.Kill(); } } if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 206, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); } } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 206, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); } } } diff --git a/Projectiles/Rogue/BrackishWater.cs b/Projectiles/Rogue/BrackishWater.cs index 3fcbc0e0f0..1e3a313fea 100644 --- a/Projectiles/Rogue/BrackishWater.cs +++ b/Projectiles/Rogue/BrackishWater.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -14,42 +15,42 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 60; - projectile.Calamity().rogue = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 60; + Projectile.Calamity().rogue = true; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.5f / 255f); - if (projectile.localAI[0] == 0f && projectile.ai[0] == 1f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); + if (Projectile.localAI[0] == 0f && Projectile.ai[0] == 1f) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 21); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 21); + Projectile.localAI[0] += 1f; } - if (projectile.timeLeft % 2 == 0) + if (Projectile.timeLeft % 2 == 0) { int randomDust = Utils.SelectRandom(Main.rand, new int[] { 33, 89 }); - int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); + int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; - Main.dust[water].velocity += projectile.velocity * 0.1f; + Main.dust[water].velocity += Projectile.velocity * 0.1f; } } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } diff --git a/Projectiles/Rogue/BrackishWaterBlast.cs b/Projectiles/Rogue/BrackishWaterBlast.cs index 92c6c9d34e..4c7c147826 100644 --- a/Projectiles/Rogue/BrackishWaterBlast.cs +++ b/Projectiles/Rogue/BrackishWaterBlast.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -17,63 +18,63 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 130; - projectile.height = 130; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.Calamity().rogue = true; + Projectile.width = 130; + Projectile.height = 130; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.Calamity().rogue = true; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.75f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.75f / 255f); int randomDust = Utils.SelectRandom(Main.rand, new int[] { 33, 89 }); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 21); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 21); + Projectile.localAI[0] += 1f; } bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; float num462 = 0f; while (num462 < num461) { @@ -84,11 +85,11 @@ namespace CalamityMod.Projectiles.Rogue num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 0.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 0.5f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; @@ -99,7 +100,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[Projectile.owner] = 6; target.AddBuff(BuffID.Venom, 90); target.AddBuff(BuffID.Poisoned, 180); } diff --git a/Projectiles/Rogue/Brick.cs b/Projectiles/Rogue/Brick.cs index 97687621a9..070338219b 100644 --- a/Projectiles/Rogue/Brick.cs +++ b/Projectiles/Rogue/Brick.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ModLoader; using CalamityMod.Items.Weapons.Rogue; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,25 +17,25 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 19; - projectile.height = 19; - projectile.friendly = true; - projectile.Calamity().rogue = true; + Projectile.width = 19; + Projectile.height = 19; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; } public override void AI() { //Constant rotation and gravity - projectile.rotation += 0.4f * projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.3f; - if (projectile.velocity.Y > 16f) + Projectile.rotation += 0.4f * Projectile.direction; + Projectile.velocity.Y = Projectile.velocity.Y + 0.3f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } //Dust trail if (Main.rand.NextBool(13)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 22, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 22, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150, default, 0.9f); } } @@ -42,38 +43,38 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 50); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 50); //Dust on impact int dust_splash = 0; while (dust_splash < 9) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 9, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.15f, 120, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 9, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1.5f); dust_splash += 1; } // This only triggers if stealth is full - if (projectile.ai[0] == 1) + if (Projectile.ai[0] == 1) { int split = 0; while (split < 3) { //Calculate the velocity of the projectile - float shardspeedX = -projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); - float shardspeedY = -projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; + float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); + float shardspeedY = -Projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; //Prevents the projectile speed from being too low if (shardspeedX < 2f && shardspeedX > -2f) { - shardspeedX += -projectile.velocity.X; + shardspeedX += -Projectile.velocity.X; } if (shardspeedY > 2f && shardspeedY < 2f) { - shardspeedY += -projectile.velocity.Y; + shardspeedY += -Projectile.velocity.Y; } //Spawn the projectile - Projectile.NewProjectile(projectile.position.X + shardspeedX, projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), projectile.knockBack / 2f, projectile.owner); + Projectile.NewProjectile(Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), Projectile.knockBack / 2f, Projectile.owner); split += 1; } } diff --git a/Projectiles/Rogue/BrickFragment.cs b/Projectiles/Rogue/BrickFragment.cs index ec6521d053..fa959858fe 100644 --- a/Projectiles/Rogue/BrickFragment.cs +++ b/Projectiles/Rogue/BrickFragment.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -9,40 +10,40 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Brick Fragment"); - Main.projFrames[projectile.type] = 2; + Main.projFrames[Projectile.type] = 2; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 13; - projectile.height = 13; - projectile.Calamity().rogue = true; + Projectile.friendly = true; + Projectile.width = 13; + Projectile.height = 13; + Projectile.Calamity().rogue = true; } public override void AI() { //Choose the sprite of the projectile - if (projectile.ai[0] != 1) + if (Projectile.ai[0] != 1) { - projectile.frame = Main.rand.Next(2); - projectile.ai[0] += 1; + Projectile.frame = Main.rand.Next(2); + Projectile.ai[0] += 1; } //Rotation and gravity - projectile.rotation += 0.6f * projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.27f; - if (projectile.velocity.Y > 16f) + Projectile.rotation += 0.6f * Projectile.direction; + Projectile.velocity.Y = Projectile.velocity.Y + 0.27f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y); //Dust effect int splash = 0; while (splash < 4) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 9, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.10f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 9, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); splash += 1; } } diff --git a/Projectiles/Rogue/Brimblade2.cs b/Projectiles/Rogue/Brimblade2.cs index 4e84c91d56..91d223ac3b 100644 --- a/Projectiles/Rogue/Brimblade2.cs +++ b/Projectiles/Rogue/Brimblade2.cs @@ -16,15 +16,15 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.aiStyle = 3; - projectile.timeLeft = 180; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 3; + Projectile.timeLeft = 180; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 180); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 180); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/BrimbladeProj.cs b/Projectiles/Rogue/BrimbladeProj.cs index 32df2efb70..55003d2b59 100644 --- a/Projectiles/Rogue/BrimbladeProj.cs +++ b/Projectiles/Rogue/BrimbladeProj.cs @@ -17,52 +17,52 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 180; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 3; + Projectile.timeLeft = 180; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - int numProj = projectile.Calamity().stealthStrike ? 3 : 2; + int numProj = Projectile.Calamity().stealthStrike ? 3 : 2; float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj + 1; i++) { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.25f, perturbedSpeed.Y * 0.25f, ModContent.ProjectileType(), (int)(projectile.damage * 0.6), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X * 0.25f, perturbedSpeed.Y * 0.25f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } } for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - int numProj = projectile.Calamity().stealthStrike ? 3 : 2; + int numProj = Projectile.Calamity().stealthStrike ? 3 : 2; float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj + 1; i++) { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.25f, perturbedSpeed.Y * 0.25f, ModContent.ProjectileType(), (int)(projectile.damage * 0.6), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X * 0.25f, perturbedSpeed.Y * 0.25f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } } for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/BurningStrifeProj.cs b/Projectiles/Rogue/BurningStrifeProj.cs index 66b69d470f..e7e617b8ea 100644 --- a/Projectiles/Rogue/BurningStrifeProj.cs +++ b/Projectiles/Rogue/BurningStrifeProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,53 +16,53 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.timeLeft = 720; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; + Projectile.width = 14; + Projectile.height = 14; + Projectile.timeLeft = 720; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; } public override void AI() { - projectile.ai[0]++; + Projectile.ai[0]++; //Rotation code - projectile.rotation += projectile.velocity.X * 0.05f * projectile.direction; + Projectile.rotation += Projectile.velocity.X * 0.05f * Projectile.direction; //Gravity - projectile.velocity.Y += 0.05f; - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; + Projectile.velocity.Y += 0.05f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; //Dust - if (projectile.ai[0] >= 25f) + if (Projectile.ai[0] >= 25f) { - Dust.NewDust(projectile.Center, 1, 1, DustID.Shadowflame, -projectile.velocity.X * 0.3f, -projectile.velocity.Y * 0.3f, 0, default, 1.1f); - projectile.ai[0] = 0f; + Dust.NewDust(Projectile.Center, 1, 1, DustID.Shadowflame, -Projectile.velocity.X * 0.3f, -Projectile.velocity.Y * 0.3f, 0, default, 1.1f); + Projectile.ai[0] = 0f; } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y * 0.7f; - projectile.velocity.X *= 0.9f; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y * 0.7f; + Projectile.velocity.X *= 0.9f; return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.ShadowFlame, 180); - if (projectile.Calamity().stealthStrike && projectile.penetrate != 1) + if (Projectile.Calamity().stealthStrike && Projectile.penetrate != 1) { - Main.PlaySound(SoundID.Item, projectile.Center, 103); - int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), projectile.knockBack, projectile.owner); + SoundEngine.PlaySound(SoundID.Item, Projectile.Center, 103); + int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), Projectile.knockBack, Projectile.owner); Main.projectile[proj].timeLeft += 20; - Main.projectile[proj].Center = projectile.Center; + Main.projectile[proj].Center = Projectile.Center; Main.projectile[proj].Calamity().rogue = true; } } @@ -69,12 +70,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.ShadowFlame, 180); - if (projectile.Calamity().stealthStrike && projectile.penetrate != 1) + if (Projectile.Calamity().stealthStrike && Projectile.penetrate != 1) { - Main.PlaySound(SoundID.Item, projectile.Center, 103); - int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), projectile.knockBack, projectile.owner); + SoundEngine.PlaySound(SoundID.Item, Projectile.Center, 103); + int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), Projectile.knockBack, Projectile.owner); Main.projectile[proj].timeLeft += 20; - Main.projectile[proj].Center = projectile.Center; + Main.projectile[proj].Center = Projectile.Center; Main.projectile[proj].Calamity().rogue = true; } } @@ -82,12 +83,12 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { int proj; - Main.PlaySound(SoundID.Item, projectile.Center, 103); - if(projectile.Calamity().stealthStrike) - proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), projectile.knockBack, projectile.owner); + SoundEngine.PlaySound(SoundID.Item, Projectile.Center, 103); + if(Projectile.Calamity().stealthStrike) + proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), Projectile.knockBack, Projectile.owner); else - proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), projectile.knockBack, projectile.owner); - Main.projectile[proj].Center = projectile.Center; + proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), Projectile.knockBack, Projectile.owner); + Main.projectile[proj].Center = Projectile.Center; Main.projectile[proj].Calamity().rogue = true; } } diff --git a/Projectiles/Rogue/ButcherKnife.cs b/Projectiles/Rogue/ButcherKnife.cs index 984c6ac6ba..55bbe18dbd 100644 --- a/Projectiles/Rogue/ButcherKnife.cs +++ b/Projectiles/Rogue/ButcherKnife.cs @@ -15,131 +15,131 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Butcher Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 60; - projectile.tileCollide = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; + Projectile.tileCollide = true; } public override void AI() { if (Main.rand.NextBool(2)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } drawOffsetX = -11; drawOriginOffsetY = -10; drawOriginOffsetX = 0; // ai[0] stores whether the knife is returning. If 0, it isn't. If 1, it is. - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= ReboundTime) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= ReboundTime) { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } } else { - projectile.tileCollide = false; + Projectile.tileCollide = false; float returnSpeed = 16f; float acceleration = 3.2f; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; // Delete the knife if it's excessively far away. Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); dist = returnSpeed / dist; xDist *= dist; yDist *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) + if (Projectile.velocity.X < xDist) { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X = Projectile.velocity.X + acceleration; + if (Projectile.velocity.X < 0f && xDist > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > xDist) + else if (Projectile.velocity.X > xDist) { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X = Projectile.velocity.X - acceleration; + if (Projectile.velocity.X > 0f && xDist < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < yDist) + if (Projectile.velocity.Y < yDist) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; + if (Projectile.velocity.Y < 0f && yDist > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > yDist) + else if (Projectile.velocity.Y > yDist) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; + if (Projectile.velocity.Y > 0f && yDist < 0f) + Projectile.velocity.Y -= acceleration; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); } // Rotate the knife as it flies. - projectile.rotation += RotationIncrement; + Projectile.rotation += RotationIncrement; return; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) + Projectile.ai[0] += 0.1f; + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.AddBuff(BuffID.WellFed, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.AddBuff(BuffID.WellFed, 180); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/CarvingFork.cs b/Projectiles/Rogue/CarvingFork.cs index d89b5aba0c..87ec227193 100644 --- a/Projectiles/Rogue/CarvingFork.cs +++ b/Projectiles/Rogue/CarvingFork.cs @@ -11,51 +11,51 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Carving Fork"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 113; + Projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + Projectile.extraUpdates = 1; } public override void AI() { if (Main.rand.Next(5) == 0) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.AddBuff(BuffID.WellFed, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.AddBuff(BuffID.WellFed, 180); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/CelestialReaperAfterimage.cs b/Projectiles/Rogue/CelestialReaperAfterimage.cs index 350e07218b..c3c1384983 100644 --- a/Projectiles/Rogue/CelestialReaperAfterimage.cs +++ b/Projectiles/Rogue/CelestialReaperAfterimage.cs @@ -14,31 +14,31 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 66; - projectile.height = 76; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 51; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.timeLeft = 180; + Projectile.width = 66; + Projectile.height = 76; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 51; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.timeLeft = 180; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.rotation += MathHelper.ToRadians(30f); // Buzzsaw scythe. + Projectile.rotation += MathHelper.ToRadians(30f); // Buzzsaw scythe. - if (projectile.timeLeft < 150) + if (Projectile.timeLeft < 150) { - NPC target = projectile.Center.ClosestNPCAt(640f); + NPC target = Projectile.Center.ClosestNPCAt(640f); if (target != null) - projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(target.Center) * 20f) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(target.Center) * 20f) / 21f; } - projectile.alpha += 5; + Projectile.alpha += 5; } } } diff --git a/Projectiles/Rogue/CelestialReaperProjectile.cs b/Projectiles/Rogue/CelestialReaperProjectile.cs index 2fda751e12..41b4e7ef9c 100644 --- a/Projectiles/Rogue/CelestialReaperProjectile.cs +++ b/Projectiles/Rogue/CelestialReaperProjectile.cs @@ -18,43 +18,43 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 66; - projectile.height = 76; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 6; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.timeLeft = 600; + Projectile.width = 66; + Projectile.height = 76; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 6; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.timeLeft = 600; } public override void AI() { - projectile.rotation += MathHelper.ToRadians(30f) / (float)Math.Log(6f - projectile.penetrate + 2f) / 1.4f; // Slow down the more hits the scythe has accumulated. + Projectile.rotation += MathHelper.ToRadians(30f) / (float)Math.Log(6f - Projectile.penetrate + 2f) / 1.4f; // Slow down the more hits the scythe has accumulated. if (HomingCooldown > 0) { HomingCooldown--; } else { - NPC target = projectile.Center.ClosestNPCAt(640f); + NPC target = Projectile.Center.ClosestNPCAt(640f); if (target != null) - projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(target.Center) * 20f) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(target.Center) * 20f) / 21f; } // This code is only run on stealth strikes and periodically spawns damaging afterimages. - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { // Afterimages are spawned three times as fast after at least one hit has occurred. - float framesNeeded = projectile.numHits > 0 ? 20f : 60f; - if (projectile.timeLeft % (int)framesNeeded == 0f) + float framesNeeded = Projectile.numHits > 0 ? 20f : 60f; + if (Projectile.timeLeft % (int)framesNeeded == 0f) { int projID = ModContent.ProjectileType(); - int damage = (int)(projectile.damage * 0.25f); - float kb = projectile.knockBack * 0.5f; - Projectile.NewProjectile(projectile.Center, projectile.velocity, projID, damage, kb, projectile.owner); + int damage = (int)(Projectile.damage * 0.25f); + float kb = Projectile.knockBack * 0.5f; + Projectile.NewProjectile(Projectile.Center, Projectile.velocity, projID, damage, kb, Projectile.owner); } } } @@ -67,22 +67,22 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { HomingCooldown = 25; - projectile.velocity *= -0.75f; // Bounce off of the enemy. + Projectile.velocity *= -0.75f; // Bounce off of the enemy. } public override void Kill(int timeLeft) { - bool ss = projectile.Calamity().stealthStrike; + bool ss = Projectile.Calamity().stealthStrike; int numSplits = 4; int projID = ModContent.ProjectileType(); - int damage = (int)(projectile.damage * (ss ? 0.25f : 0.5f)); - float kb = projectile.knockBack * 0.5f; + int damage = (int)(Projectile.damage * (ss ? 0.25f : 0.5f)); + float kb = Projectile.knockBack * 0.5f; float speed = 12f; for (float i = 0; i < numSplits; ++i) { float angle = MathHelper.TwoPi * i / numSplits; Vector2 velocity = angle.ToRotationVector2() * speed; - Projectile.NewProjectile(projectile.Center, velocity, projID, damage, kb, projectile.owner); + Projectile.NewProjectile(Projectile.Center, velocity, projID, damage, kb, Projectile.owner); } } } diff --git a/Projectiles/Rogue/Celestus2.cs b/Projectiles/Rogue/Celestus2.cs index 7c4f63f305..5846569acc 100644 --- a/Projectiles/Rogue/Celestus2.cs +++ b/Projectiles/Rogue/Celestus2.cs @@ -11,38 +11,38 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Celestus"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 48; - projectile.height = 48; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 4; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; - projectile.timeLeft = 85; - projectile.Calamity().rogue = true; + Projectile.width = 48; + Projectile.height = 48; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 4; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; + Projectile.timeLeft = 85; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation += 2f; - projectile.velocity.X *= 1.02f; - projectile.velocity.Y *= 1.02f; - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); + Projectile.rotation += 2f; + Projectile.velocity.X *= 1.02f; + Projectile.velocity.Y *= 1.02f; + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/CelestusBoomerang.cs b/Projectiles/Rogue/CelestusBoomerang.cs index d5adfe1b27..b397bf5e07 100644 --- a/Projectiles/Rogue/CelestusBoomerang.cs +++ b/Projectiles/Rogue/CelestusBoomerang.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,117 +17,117 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Celestus"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 94; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - projectile.Calamity().rogue = true; + Projectile.width = Projectile.height = 94; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + Projectile.Calamity().rogue = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (!initialized) { - speed = projectile.velocity.Length(); + speed = Projectile.velocity.Length(); initialized = true; } - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); - projectile.rotation += 1f; + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); + Projectile.rotation += 1f; - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } - switch (projectile.ai[0]) + switch (Projectile.ai[0]) { case 0f: - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 40f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 40f) { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } break; case 1f: float returnSpeed = 25f; float acceleration = 5f; - Vector2 playerVec = player.Center - projectile.Center; + Vector2 playerVec = player.Center - Projectile.Center; if (playerVec.Length() > 4000f) { - projectile.Kill(); + Projectile.Kill(); } playerVec.Normalize(); playerVec *= returnSpeed; - if (projectile.velocity.X < playerVec.X) + if (Projectile.velocity.X < playerVec.X) { - projectile.velocity.X += acceleration; - if (projectile.velocity.X < 0f && playerVec.X > 0f) + Projectile.velocity.X += acceleration; + if (Projectile.velocity.X < 0f && playerVec.X > 0f) { - projectile.velocity.X += acceleration; + Projectile.velocity.X += acceleration; } } - else if (projectile.velocity.X > playerVec.X) + else if (Projectile.velocity.X > playerVec.X) { - projectile.velocity.X -= acceleration; - if (projectile.velocity.X > 0f && playerVec.X < 0f) + Projectile.velocity.X -= acceleration; + if (Projectile.velocity.X > 0f && playerVec.X < 0f) { - projectile.velocity.X -= acceleration; + Projectile.velocity.X -= acceleration; } } - if (projectile.velocity.Y < playerVec.Y) + if (Projectile.velocity.Y < playerVec.Y) { - projectile.velocity.Y += acceleration; - if (projectile.velocity.Y < 0f && playerVec.Y > 0f) + Projectile.velocity.Y += acceleration; + if (Projectile.velocity.Y < 0f && playerVec.Y > 0f) { - projectile.velocity.Y += acceleration; + Projectile.velocity.Y += acceleration; } } - else if (projectile.velocity.Y > playerVec.Y) + else if (Projectile.velocity.Y > playerVec.Y) { - projectile.velocity.Y -= acceleration; - if (projectile.velocity.Y > 0f && playerVec.Y < 0f) + Projectile.velocity.Y -= acceleration; + if (Projectile.velocity.Y > 0f && playerVec.Y < 0f) { - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y -= acceleration; } } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Rectangle projHitbox = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle projHitbox = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); Rectangle playerHitbox = new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height); if (projHitbox.Intersects(playerHitbox)) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - projectile.velocity *= -1f; - projectile.timeLeft = 600; - projectile.penetrate = 1; - projectile.localNPCHitCooldown = -1; - projectile.ai[0] = 2f; - projectile.netUpdate = true; + Projectile.velocity *= -1f; + Projectile.timeLeft = 600; + Projectile.penetrate = 1; + Projectile.localNPCHitCooldown = -1; + Projectile.ai[0] = 2f; + Projectile.netUpdate = true; } else - projectile.Kill(); + Projectile.Kill(); } } break; case 2f: - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, speed, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 250f, speed, 20f); break; default: break; @@ -149,25 +150,25 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects() { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(projectile.damage * 0.7), projectile.knockBack, projectile.owner); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(projectile.damage * 0.7), projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); } } - Main.PlaySound(SoundID.Item122, projectile.Center); + SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/CinquedeaProj.cs b/Projectiles/Rogue/CinquedeaProj.cs index 94ed686c48..3629c74832 100644 --- a/Projectiles/Rogue/CinquedeaProj.cs +++ b/Projectiles/Rogue/CinquedeaProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,19 +16,19 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Cinquedea"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; } public override void AI() @@ -35,56 +36,56 @@ namespace CalamityMod.Projectiles.Rogue drawOriginOffsetY = 11; drawOffsetX = -22; - bool stealthstrike = projectile.ai[1] == 1 && projectile.penetrate == 1; - if (projectile.spriteDirection == 1) + bool stealthstrike = Projectile.ai[1] == 1 && Projectile.penetrate == 1; + if (Projectile.spriteDirection == 1) { - gravspin = projectile.velocity.Y * 0.03f; + gravspin = Projectile.velocity.Y * 0.03f; } - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { - gravspin = projectile.velocity.Y * -0.03f; + gravspin = Projectile.velocity.Y * -0.03f; } - projectile.ai[0]++; + Projectile.ai[0]++; //Fucking slopes - if (projectile.ai[0] > 2f) + if (Projectile.ai[0] > 2f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } //Face-forward rotation code - if ((projectile.ai[0] <= 80 && !stealthstrike) || stealthstrike || projectile.velocity.Y <= 0) + if ((Projectile.ai[0] <= 80 && !stealthstrike) || stealthstrike || Projectile.velocity.Y <= 0) { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); //Rotating 45 degrees if shooting right - if (projectile.spriteDirection == 1) + if (Projectile.spriteDirection == 1) { - projectile.rotation += MathHelper.ToRadians(45f); + Projectile.rotation += MathHelper.ToRadians(45f); } //Rotating 45 degrees if shooting left - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { - projectile.rotation -= MathHelper.ToRadians(45f); + Projectile.rotation -= MathHelper.ToRadians(45f); } } //Stealth strike if (stealthstrike) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 7f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 250f, 7f, 20f); } //Gravity code else { - if (projectile.ai[0] > 80) + if (Projectile.ai[0] > 80) { - projectile.velocity.Y = projectile.velocity.Y + 0.15f; - if (projectile.velocity.Y > 0) + Projectile.velocity.Y = Projectile.velocity.Y + 0.15f; + if (Projectile.velocity.Y > 0) { - projectile.rotation += gravspin; + Projectile.rotation += gravspin; } - if (projectile.velocity.Y > 10f) + if (Projectile.velocity.Y > 10f) { - projectile.velocity.Y = 10f; + Projectile.velocity.Y = 10f; } } } @@ -92,21 +93,21 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); return true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.ai[1] == 1f && projectile.penetrate == 1) - projectile.timeLeft = 180; + if (Projectile.ai[1] == 1f && Projectile.penetrate == 1) + Projectile.timeLeft = 180; } } } diff --git a/Projectiles/Rogue/CircletMark.cs b/Projectiles/Rogue/CircletMark.cs index b43061a3f6..b400302bcf 100644 --- a/Projectiles/Rogue/CircletMark.cs +++ b/Projectiles/Rogue/CircletMark.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -17,28 +18,28 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.Calamity().rogue = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 900; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.Calamity().rogue = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = -1; - Main.PlaySound(SoundID.Item, projectile.Center, 60); + Projectile.soundDelay = -1; + SoundEngine.PlaySound(SoundID.Item, Projectile.Center, 60); } - if (projectile.localAI[1] < 30f) + if (Projectile.localAI[1] < 30f) { for (int num1134 = 0; num1134 < 1; num1134++) { @@ -49,10 +50,10 @@ namespace CalamityMod.Projectiles.Rogue value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); value81.X *= -1f; Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default, 0.5f)]; dust34.position = position4; - dust34.customData = projectile.Center + value82; + dust34.customData = Projectile.Center + value82; dust34.fadeIn = 1f; dust34.scale = 0.3f; if (value81.X > -1.2f) @@ -62,50 +63,50 @@ namespace CalamityMod.Projectiles.Rogue dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; } } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + Projectile.localAI[0] = 0.8f; + Projectile.direction = 1; + Point point9 = Projectile.Center.ToTileCoordinates(); + Projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) + Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; + if (Projectile.localAI[1] < 33f) { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 8; + Projectile.alpha -= 8; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } - if (projectile.localAI[1] > 103f) + if (Projectile.localAI[1] > 103f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 16; + Projectile.alpha += 16; } - if (projectile.alpha > 255) + if (Projectile.alpha > 255) { - projectile.alpha = 255; + Projectile.alpha = 255; } } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); } for (int num1135 = 0; num1135 < 2; num1135++) { if (Main.rand.NextBool(10)) { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust dust35 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; dust35.noGravity = true; dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; + dust35.scale = Projectile.Opacity * Projectile.localAI[0]; + dust35.position = Projectile.Center; dust35.velocity = value83 * 2.5f; } } @@ -114,48 +115,48 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(10)) { Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; + Dust dust36 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; dust36.noGravity = true; dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; + dust36.scale = Projectile.Opacity * Projectile.localAI[0]; + dust36.position = Projectile.Center; dust36.velocity = value84 * 2.5f; } } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + Projectile.velocity = Vector2.Zero; + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner, 0f, 0f); } - if (projectile.localAI[1] >= 120f) + if (Projectile.localAI[1] >= 120f) { - projectile.Kill(); + Projectile.Kill(); return; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Color alpha5 = projectile.GetAlpha(color25); + Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[Projectile.type]; + Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alpha5 = Projectile.GetAlpha(color25); Vector2 origin7 = rectangle11.Size() / 2f; Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, Projectile.rotation, origin7, Projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Rogue/CircletTornado.cs b/Projectiles/Rogue/CircletTornado.cs index 1b305392db..2da73db8b0 100644 --- a/Projectiles/Rogue/CircletTornado.cs +++ b/Projectiles/Rogue/CircletTornado.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -17,32 +18,32 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 1200; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() { //only 1 tornado can exist at a time - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 10f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] >= 10f) { - projectile.localAI[1] = 0f; + Projectile.localAI[1] = 0f; int projCount = 0; int oldestTornado = 0; float tornadoAge = 0f; - int projType = projectile.type; + int projType = Projectile.type; for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { Projectile proj = Main.projectile[projIndex]; - if (proj.active && proj.owner == projectile.owner && proj.type == projType && proj.ai[0] < 900f) + if (proj.active && proj.owner == Projectile.owner && proj.type == projType && proj.ai[0] < 900f) { projCount++; if (proj.ai[0] > tornadoAge) @@ -61,29 +62,29 @@ namespace CalamityMod.Projectiles.Rogue } float lifeSpan = 900f; - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = -1; - Main.PlaySound(SoundID.Item, projectile.Center, 122); + Projectile.soundDelay = -1; + SoundEngine.PlaySound(SoundID.Item, Projectile.Center, 122); } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= lifeSpan) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= lifeSpan) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.localAI[0] >= 30f) + if (Projectile.localAI[0] >= 30f) { - projectile.damage = 0; - if (projectile.ai[0] < lifeSpan - 120f) + Projectile.damage = 0; + if (Projectile.ai[0] < lifeSpan - 120f) { - float num1126 = projectile.ai[0] % 60f; - projectile.ai[0] = lifeSpan - 120f + num1126; - projectile.netUpdate = true; + float num1126 = Projectile.ai[0] % 60f; + Projectile.ai[0] = lifeSpan - 120f + num1126; + Projectile.netUpdate = true; } } float num1127 = 15f; float num1128 = 15f; - Point point8 = projectile.Center.ToTileCoordinates(); + Point point8 = Projectile.Center.ToTileCoordinates(); int num1129; int num1130; Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); @@ -94,14 +95,14 @@ namespace CalamityMod.Projectiles.Rogue Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); value74.X = value74.Y * 0.2f; - projectile.width = (int)(value74.X * 0.65f); - projectile.height = (int)value74.Y; - projectile.Center = vector146; - if (projectile.owner == Main.myPlayer) + Projectile.width = (int)(value74.X * 0.65f); + Projectile.height = (int)value74.Y; + Projectile.Center = vector146; + if (Projectile.owner == Main.myPlayer) { bool flag74 = false; - Vector2 center16 = Main.player[projectile.owner].Center; - Vector2 top = Main.player[projectile.owner].Top; + Vector2 center16 = Main.player[Projectile.owner].Center; + Vector2 top = Main.player[Projectile.owner].Top; for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) { Vector2 position2 = Vector2.Lerp(value72, value73, num1131); @@ -111,14 +112,14 @@ namespace CalamityMod.Projectiles.Rogue break; } } - if (!flag74 && projectile.ai[0] < lifeSpan - 120f) + if (!flag74 && Projectile.ai[0] < lifeSpan - 120f) { - float num1132 = projectile.ai[0] % 60f; - projectile.ai[0] = lifeSpan - 120f + num1132; - projectile.netUpdate = true; + float num1132 = Projectile.ai[0] % 60f; + Projectile.ai[0] = lifeSpan - 120f + num1132; + Projectile.netUpdate = true; } } - if (projectile.ai[0] < lifeSpan - 120f) + if (Projectile.ai[0] < lifeSpan - 120f) { return; } @@ -129,13 +130,13 @@ namespace CalamityMod.Projectiles.Rogue float num226 = 600f; float num227 = 15f; float num228 = 15f; - float num229 = projectile.ai[0]; + float num229 = Projectile.ai[0]; float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); if (num229 > num226 - 60f) { scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); } - Point point5 = projectile.Center.ToTileCoordinates(); + Point point5 = Projectile.Center.ToTileCoordinates(); int num230; int num231; Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); @@ -148,7 +149,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); vector33.X = vector33.Y * num232; new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Texture2D texture2D23 = Main.projectileTexture[Projectile.type]; Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); Vector2 origin3 = rectangle9.Size() / 2f; float num233 = -0.06283186f * num229; diff --git a/Projectiles/Rogue/CobaltEnergy.cs b/Projectiles/Rogue/CobaltEnergy.cs index 832918c7b9..9ccac5f7db 100644 --- a/Projectiles/Rogue/CobaltEnergy.cs +++ b/Projectiles/Rogue/CobaltEnergy.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -22,38 +23,38 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { for (int index = 0; index < 2; ++index) { - int ruby = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 88, projectile.velocity.X, projectile.velocity.Y, 90, new Color(), 1.2f); + int ruby = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 88, Projectile.velocity.X, Projectile.velocity.Y, 90, new Color(), 1.2f); Dust dust = Main.dust[ruby]; dust.noGravity = true; dust.velocity *= 0.3f; } - if (!hasHitEnemy && projectile.timeLeft < 575) + if (!hasHitEnemy && Projectile.timeLeft < 575) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } else if (hasHitEnemy) { if (targetNPC >= 0) { - Vector2 newVelocity = Main.npc[targetNPC].Center - projectile.Center; + Vector2 newVelocity = Main.npc[targetNPC].Center - Projectile.Center; newVelocity.Normalize(); newVelocity *= 15f; - projectile.velocity = newVelocity; + Projectile.velocity = newVelocity; } } } @@ -78,9 +79,9 @@ namespace CalamityMod.Projectiles.Rogue { previousNPCs.Add(i); } - if (npc.CanBeChasedBy(projectile, false) && npc != target && !hasHitNPC) + if (npc.CanBeChasedBy(Projectile, false) && npc != target && !hasHitNPC) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < minDist) { minDist = dist; @@ -94,34 +95,34 @@ namespace CalamityMod.Projectiles.Rogue { hasHitEnemy = true; targetNPC = index; - velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew = Main.npc[index].Center - Projectile.Center; velocityNew.Normalize(); velocityNew *= 15f; - projectile.velocity = velocityNew; + Projectile.velocity = velocityNew; } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); for (int index1 = 0; index1 < 15; ++index1) { - int ruby = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 88, projectile.oldVelocity.X, projectile.oldVelocity.Y, 50, new Color(), 1.2f); + int ruby = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 88, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 50, new Color(), 1.2f); Dust dust = Main.dust[ruby]; dust.noGravity = true; dust.scale *= 1.25f; diff --git a/Projectiles/Rogue/CobaltKunaiProjectile.cs b/Projectiles/Rogue/CobaltKunaiProjectile.cs index 906baefa81..151cfd3802 100644 --- a/Projectiles/Rogue/CobaltKunaiProjectile.cs +++ b/Projectiles/Rogue/CobaltKunaiProjectile.cs @@ -17,32 +17,32 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.aiStyle = 2; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.aiStyle = 2; + Projectile.timeLeft = 600; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -50,8 +50,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } } diff --git a/Projectiles/Rogue/ConsecratedWaterProjectile.cs b/Projectiles/Rogue/ConsecratedWaterProjectile.cs index b9ea5aae91..cf75065365 100644 --- a/Projectiles/Rogue/ConsecratedWaterProjectile.cs +++ b/Projectiles/Rogue/ConsecratedWaterProjectile.cs @@ -2,7 +2,8 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -17,28 +18,28 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 22; - projectile.height = 34; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 200; - projectile.tileCollide = true; - projectile.ignoreWater = true; - projectile.alpha = 0; - projectile.Calamity().rogue = true; + Projectile.width = 22; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 200; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.alpha = 0; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.ai[0] += 1f; //arbitrary timer - if (projectile.ai[0] > 75f) + Projectile.ai[0] += 1f; //arbitrary timer + if (Projectile.ai[0] > 75f) { //considering making small methods in a projectile utils file. Things like this are everywhere lol - if (projectile.velocity.Y < 10f) + if (Projectile.velocity.Y < 10f) { - projectile.velocity.Y += 0.15f; + Projectile.velocity.Y += 0.15f; } } - projectile.rotation += MathHelper.ToRadians(projectile.velocity.Length()); + Projectile.rotation += MathHelper.ToRadians(Projectile.velocity.Length()); } public override void Kill(int timeLeft) { @@ -46,29 +47,29 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i< 30;i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); - Dust.NewDust(projectile.Center, 1, 1, DustID.BlueCrystalShard, dspeed.X, dspeed.Y, 0, default, 1.1f); + Dust.NewDust(Projectile.Center, 1, 1, DustID.BlueCrystalShard, dspeed.X, dspeed.Y, 0, default, 1.1f); } - Main.PlaySound(SoundID.Item107, projectile.Bottom); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Bottom); //normal - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { Point result; - if (WorldUtils.Find(projectile.Top.ToTileCoordinates(), Searches.Chain((GenSearch)new Searches.Down(80), (GenCondition)new Conditions.IsSolid()), out result)) + if (WorldUtils.Find(Projectile.Top.ToTileCoordinates(), Searches.Chain((GenSearch)new Searches.Down(80), (GenCondition)new Conditions.IsSolid()), out result)) { - Projectile.NewProjectile(result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner); + Projectile.NewProjectile(result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner); } } //stealth strike - else if (projectile.ai[1] == 1f) + else if (Projectile.ai[1] == 1f) { //3 pillars instead of 1 for (float i = -1f; i <= 1f; i += 1f) { Point result; - if (WorldUtils.Find((projectile.Top + i * Main.rand.NextFloat(56f, 108f) * Vector2.UnitX).ToTileCoordinates(), Searches.Chain((GenSearch)new Searches.Down(80), (GenCondition)new Conditions.IsSolid()), out result)) + if (WorldUtils.Find((Projectile.Top + i * Main.rand.NextFloat(56f, 108f) * Vector2.UnitX).ToTileCoordinates(), Searches.Chain((GenSearch)new Searches.Down(80), (GenCondition)new Conditions.IsSolid()), out result)) { - Projectile.NewProjectile(result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner); + Projectile.NewProjectile(result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner); } } } diff --git a/Projectiles/Rogue/ContaminatedBileFlask.cs b/Projectiles/Rogue/ContaminatedBileFlask.cs index 7d92eabebd..38fe61255c 100644 --- a/Projectiles/Rogue/ContaminatedBileFlask.cs +++ b/Projectiles/Rogue/ContaminatedBileFlask.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,32 +17,32 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.tileCollide = true; - projectile.alpha = 0; - projectile.Calamity().rogue = true; + Projectile.width = Projectile.height = 24; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.tileCollide = true; + Projectile.alpha = 0; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.ai[0]++ > 45f) + if (Projectile.ai[0]++ > 45f) { - if (projectile.velocity.Y < 10f) + if (Projectile.velocity.Y < 10f) { - projectile.velocity.Y += 0.15f; + Projectile.velocity.Y += 0.15f; } } - projectile.rotation += MathHelper.ToRadians(projectile.velocity.Length()); + Projectile.rotation += MathHelper.ToRadians(Projectile.velocity.Length()); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item107, projectile.Bottom); - Projectile explosion = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Bottom); + Projectile explosion = Projectile.NewProjectileDirect(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); if (explosion.whoAmI.WithinBounds(Main.maxProjectiles)) { - explosion.Calamity().stealthStrike = projectile.Calamity().stealthStrike; + explosion.Calamity().stealthStrike = Projectile.Calamity().stealthStrike; explosion.timeLeft = explosion.Calamity().stealthStrike ? 60 : 20; } } diff --git a/Projectiles/Rogue/CorpusAvertorClone.cs b/Projectiles/Rogue/CorpusAvertorClone.cs index 4d92ce9aa3..a2ba3302e3 100644 --- a/Projectiles/Rogue/CorpusAvertorClone.cs +++ b/Projectiles/Rogue/CorpusAvertorClone.cs @@ -14,58 +14,58 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Corpus Avertor"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.04f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.04f; - projectile.velocity.X *= 1.005f; - projectile.velocity.Y *= 1.005f; + Projectile.velocity.X *= 1.005f; + Projectile.velocity.Y *= 1.005f; - switch ((int)projectile.ai[0]) + switch ((int)Projectile.ai[0]) { case 20: - projectile.scale = 0.7f; + Projectile.scale = 0.7f; break; case 40: - projectile.scale = 0.8f; + Projectile.scale = 0.8f; break; case 60: - projectile.scale = 0.9f; + Projectile.scale = 0.9f; break; default: break; } - projectile.width = projectile.height = (int)(24f * projectile.scale); + Projectile.width = Projectile.height = (int)(24f * Projectile.scale); - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 150f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 150f, 12f, 20f); } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) - return new Color((int)(150f * (projectile.timeLeft / 85f)), 0, 0, projectile.timeLeft / 5 * 3); + if (Projectile.timeLeft < 85) + return new Color((int)(150f * (Projectile.timeLeft / 85f)), 0, 0, Projectile.timeLeft / 5 * 3); return new Color(150, 0, 0, 50); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Rogue if (heal > CalamityMod.lifeStealCap) heal = CalamityMod.lifeStealCap; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); } public override void OnHitPvp(Player target, int damage, bool crit) @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Rogue if (heal > CalamityMod.lifeStealCap) heal = CalamityMod.lifeStealCap; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); } } } diff --git a/Projectiles/Rogue/CorpusAvertorProj.cs b/Projectiles/Rogue/CorpusAvertorProj.cs index 1bd5bece27..bec688e7c0 100644 --- a/Projectiles/Rogue/CorpusAvertorProj.cs +++ b/Projectiles/Rogue/CorpusAvertorProj.cs @@ -14,47 +14,47 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Corpus Avertor"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f; - if (projectile.ai[0] < 120f) - projectile.ai[0] += 1f; + if (Projectile.ai[0] < 120f) + Projectile.ai[0] += 1f; - if (projectile.ai[0] < 61f) + if (Projectile.ai[0] < 61f) { - if (projectile.ai[0] % 20f == 0f) + if (Projectile.ai[0] % 20f == 0f) { - Vector2 velocity = new Vector2(projectile.velocity.X, projectile.velocity.Y); - float mult = projectile.ai[0] / 80f; // Ranges from 0.25 to 0.5 to 0.75 + Vector2 velocity = new Vector2(Projectile.velocity.X, Projectile.velocity.Y); + float mult = Projectile.ai[0] / 80f; // Ranges from 0.25 to 0.5 to 0.75 velocity *= mult; - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), - (int)(projectile.damage * mult), projectile.knockBack * mult, projectile.owner, projectile.ai[0]); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), + (int)(Projectile.damage * mult), Projectile.knockBack * mult, Projectile.owner, Projectile.ai[0]); } } else { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; + Projectile.velocity.X *= 1.01f; + Projectile.velocity.Y *= 1.01f; - int scale = (int)((projectile.ai[0] - 60f) * 4.25f); - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); + int scale = (int)((Projectile.ai[0] - 60f) * 4.25f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 5, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; } @@ -62,9 +62,9 @@ namespace CalamityMod.Projectiles.Rogue public override Color? GetAlpha(Color lightColor) { - if (projectile.ai[0] >= 61f) + if (Projectile.ai[0] >= 61f) { - int scale = (int)((projectile.ai[0] - 60f) * 4.25f); + int scale = (int)((Projectile.ai[0] - 60f) * 4.25f); return new Color(scale, 0, 0, 50); } return new Color(0, 0, 0, 50); @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Rogue if (heal > CalamityMod.lifeStealCap) heal = CalamityMod.lifeStealCap; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); } public override void OnHitPvp(Player target, int damage, bool crit) @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Rogue if (heal > CalamityMod.lifeStealCap) heal = CalamityMod.lifeStealCap; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); } } } diff --git a/Projectiles/Rogue/CorpusAvertorStealth.cs b/Projectiles/Rogue/CorpusAvertorStealth.cs index 3dba9b4f44..9e312c62e2 100644 --- a/Projectiles/Rogue/CorpusAvertorStealth.cs +++ b/Projectiles/Rogue/CorpusAvertorStealth.cs @@ -16,41 +16,41 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Corpus Avertor"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f; - if (projectile.ai[0] < 120f) - projectile.ai[0] += 1f; + if (Projectile.ai[0] < 120f) + Projectile.ai[0] += 1f; - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; + Projectile.velocity.X *= 1.01f; + Projectile.velocity.Y *= 1.01f; - int scale = (int)((projectile.ai[0] - 60f) * 4.25f); - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); + int scale = (int)((Projectile.ai[0] - 60f) * 4.25f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 5, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; } - public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects(int damage) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (Main.rand.NextBool(7)) { int lifeLossAmt = (int)Math.Ceiling(player.statLife * 0.5); @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Rogue if (heal > CalamityMod.lifeStealCap) heal = CalamityMod.lifeStealCap; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, player, heal, ProjectileID.VampireHeal, 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, player, heal, ProjectileID.VampireHeal, 1200f, 3f); } } } diff --git a/Projectiles/Rogue/Corrocloud1.cs b/Projectiles/Rogue/Corrocloud1.cs index 31117c9140..0ed0d49c1a 100644 --- a/Projectiles/Rogue/Corrocloud1.cs +++ b/Projectiles/Rogue/Corrocloud1.cs @@ -10,31 +10,31 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Corrocloud"); - Main.projFrames[projectile.type] = 8; + Main.projFrames[Projectile.type] = 8; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = 4; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = 4; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; } public override void AI() { - projectile.velocity *= 0.99f; - projectile.ai[0] += 1f; - if (projectile.ai[0] % 7f == 6f) + Projectile.velocity *= 0.99f; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] % 7f == 6f) { - projectile.frame++; + Projectile.frame++; } - if (projectile.frame >= 8) - projectile.Kill(); + if (Projectile.frame >= 8) + Projectile.Kill(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 8; i++) { - Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid); } } } diff --git a/Projectiles/Rogue/Corrocloud2.cs b/Projectiles/Rogue/Corrocloud2.cs index 3fa2194cc2..ec305b0448 100644 --- a/Projectiles/Rogue/Corrocloud2.cs +++ b/Projectiles/Rogue/Corrocloud2.cs @@ -10,31 +10,31 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Corrocloud"); - Main.projFrames[projectile.type] = 8; + Main.projFrames[Projectile.type] = 8; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = 4; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = 4; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; } public override void AI() { - projectile.velocity *= 0.99f; - projectile.ai[0] += 1f; - if (projectile.ai[0] % 7f == 6f) + Projectile.velocity *= 0.99f; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] % 7f == 6f) { - projectile.frame++; + Projectile.frame++; } - if (projectile.frame >= 8) - projectile.Kill(); + if (Projectile.frame >= 8) + Projectile.Kill(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 8; i++) { - Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid); } } } diff --git a/Projectiles/Rogue/Corrocloud3.cs b/Projectiles/Rogue/Corrocloud3.cs index e7bb9f9392..43ddde186d 100644 --- a/Projectiles/Rogue/Corrocloud3.cs +++ b/Projectiles/Rogue/Corrocloud3.cs @@ -10,31 +10,31 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Corrocloud"); - Main.projFrames[projectile.type] = 8; + Main.projFrames[Projectile.type] = 8; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = 4; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = 4; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; } public override void AI() { - projectile.velocity *= 0.99f; - projectile.ai[0] += 1f; - if (projectile.ai[0] % 7f == 6f) + Projectile.velocity *= 0.99f; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] % 7f == 6f) { - projectile.frame++; + Projectile.frame++; } - if (projectile.frame >= 8) - projectile.Kill(); + if (Projectile.frame >= 8) + Projectile.Kill(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 8; i++) { - Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid); } } } diff --git a/Projectiles/Rogue/CosmicKunaiProj.cs b/Projectiles/Rogue/CosmicKunaiProj.cs index d807736053..030f692ed5 100644 --- a/Projectiles/Rogue/CosmicKunaiProj.cs +++ b/Projectiles/Rogue/CosmicKunaiProj.cs @@ -14,25 +14,25 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.Calamity().rogue = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.alpha += 17; - if (projectile.alpha >= 255) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.alpha += 17; + if (Projectile.alpha >= 255) { - projectile.Kill(); + Projectile.Kill(); } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.5f / 255f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); } } } diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index 9263cc7522..7dcf2c165a 100644 --- a/Projectiles/Rogue/CosmicScythe.cs +++ b/Projectiles/Rogue/CosmicScythe.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,65 +17,65 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 400; - projectile.alpha = 100; - projectile.penetrate = 5; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 1; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 400; + Projectile.alpha = 100; + Projectile.penetrate = 5; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 1; } public override void AI() { - projectile.rotation += 0.5f * (float)projectile.direction; - int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + Projectile.rotation += 0.5f * (float)Projectile.direction; + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); Main.dust[shadow].noGravity = true; Main.dust[shadow].velocity *= 0f; - projectile.velocity *= 0.95f; - if (projectile.timeLeft == 400) + Projectile.velocity *= 0.95f; + if (Projectile.timeLeft == 400) { - originalDamage = projectile.damage; - projectile.damage = 0; + originalDamage = Projectile.damage; + Projectile.damage = 0; } - if (projectile.timeLeft <= 375) + if (Projectile.timeLeft <= 375) { - if (projectile.timeLeft > 350) - projectile.velocity *= 1.06f; - projectile.damage = (int)(originalDamage * 1.25); - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); + if (Projectile.timeLeft > 350) + Projectile.velocity *= 1.06f; + Projectile.damage = (int)(originalDamage * 1.25); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - int buffType = projectile.ai[0] == 1f ? BuffID.ShadowFlame : ModContent.BuffType(); + int buffType = Projectile.ai[0] == 1f ? BuffID.ShadowFlame : ModContent.BuffType(); target.AddBuff(buffType, 60, false); - projectile.Kill(); + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 50); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 50); for (int d = 0; d < 4; d++) { - int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, default, 2f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 2f); Main.dust[shadow].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -84,10 +85,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int d = 0; d < 12; d++) { - int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, default, 3f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 3f); Main.dust[shadow].noGravity = true; Main.dust[shadow].velocity *= 5f; - shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, default, 2f); + shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 2f); Main.dust[shadow].velocity *= 2f; } } diff --git a/Projectiles/Rogue/CraniumSMASH.cs b/Projectiles/Rogue/CraniumSMASH.cs index ad709787d8..2d609e97bc 100644 --- a/Projectiles/Rogue/CraniumSMASH.cs +++ b/Projectiles/Rogue/CraniumSMASH.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,33 +16,33 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 192; - projectile.height = 192; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 10; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -2; + Projectile.width = 192; + Projectile.height = 192; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 10; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -2; } public override void AI() { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) SpawnExplosionDust(); - if (projectile.ai[0] <= 1f) - projectile.ai[0]++; + if (Projectile.ai[0] <= 1f) + Projectile.ai[0]++; } void SpawnExplosionDust() { - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - CalamityUtils.ExplosionGores(projectile.Center, 3); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 14); + CalamityUtils.ExplosionGores(Projectile.Center, 3); for (int num194 = 0; num194 < 25; num194++) { - int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f); + int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 2f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 0f; } diff --git a/Projectiles/Rogue/CraniumSmasherExplosive.cs b/Projectiles/Rogue/CraniumSmasherExplosive.cs index e318c6ae94..3f69e3be5d 100644 --- a/Projectiles/Rogue/CraniumSmasherExplosive.cs +++ b/Projectiles/Rogue/CraniumSmasherExplosive.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class CraniumSmasherExplosive : ModProjectile @@ -12,45 +13,45 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.localNPCHitCooldown = 15; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.localNPCHitCooldown = 15; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 5f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - projectile.rotation += projectile.velocity.X * 0.02f; - projectile.velocity.Y = projectile.velocity.Y + 0.085f; - projectile.velocity.X = projectile.velocity.X * 0.99f; + Projectile.rotation += Projectile.velocity.X * 0.02f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.085f; + Projectile.velocity.X = Projectile.velocity.X * 0.99f; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 192; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); - CalamityUtils.ExplosionGores(projectile.Center, 3); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 192; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); + CalamityUtils.ExplosionGores(Projectile.Center, 3); for (int num194 = 0; num194 < 25; num194++) { - int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f); + int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 2f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 0f; } diff --git a/Projectiles/Rogue/CraniumSmasherProj.cs b/Projectiles/Rogue/CraniumSmasherProj.cs index 0ac5521c1f..f75ec8024a 100644 --- a/Projectiles/Rogue/CraniumSmasherProj.cs +++ b/Projectiles/Rogue/CraniumSmasherProj.cs @@ -14,36 +14,36 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 5; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 5; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 3f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 3f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - projectile.rotation += projectile.velocity.X * 0.02f; - projectile.velocity.Y = projectile.velocity.Y + 0.085f; - projectile.velocity.X = projectile.velocity.X * 0.99f; + Projectile.rotation += Projectile.velocity.X * 0.02f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.085f; + Projectile.velocity.X = Projectile.velocity.X * 0.99f; } public override void Kill(int timeLeft) { for (int i = 0; i < 5; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.oldVelocity.X / 2, projectile.oldVelocity.Y / 2, 0, default, 2f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.oldVelocity.X / 2, projectile.oldVelocity.Y / 2, 0, default, 1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.oldVelocity.X / 2, Projectile.oldVelocity.Y / 2, 0, default, 2f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 6, Projectile.oldVelocity.X / 2, Projectile.oldVelocity.Y / 2, 0, default, 1f); } } diff --git a/Projectiles/Rogue/CraniumSmasherStealth.cs b/Projectiles/Rogue/CraniumSmasherStealth.cs index 1418a6e304..020fa3b26e 100644 --- a/Projectiles/Rogue/CraniumSmasherStealth.cs +++ b/Projectiles/Rogue/CraniumSmasherStealth.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -17,64 +18,64 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 5; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 5; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 5f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - projectile.rotation += projectile.velocity.X * 0.02f; - projectile.velocity.Y = projectile.velocity.Y + 0.085f; - projectile.velocity.X = projectile.velocity.X * 0.99f; + Projectile.rotation += Projectile.velocity.X * 0.02f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.085f; + Projectile.velocity.X = Projectile.velocity.X * 0.99f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int smash = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[smash].Center = projectile.Center; + int smash = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); + Main.projectile[smash].Center = Projectile.Center; } } public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int smash = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[smash].Center = projectile.Center; + int smash = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); + Main.projectile[smash].Center = Projectile.Center; } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 192; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - CalamityUtils.ExplosionGores(projectile.Center, 3); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 192; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 14); + CalamityUtils.ExplosionGores(Projectile.Center, 3); for (int num194 = 0; num194 < 25; num194++) { - int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f); + int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 100, default, 2f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 0f; } @@ -82,8 +83,8 @@ namespace CalamityMod.Projectiles.Rogue public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/CraniumSmasherGlow"); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, tex.Size() / 2, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = ModContent.Request("CalamityMod/Projectiles/Rogue/CraniumSmasherGlow"); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0f); } } } diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index d7f125a72d..4ee85d1fcf 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -15,40 +15,40 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.aiStyle = 2; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 14; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.aiStyle = 2; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 14; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -56,14 +56,14 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[Projectile.owner] = 7; target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Rogue/CrystalPiercerProjectile.cs b/Projectiles/Rogue/CrystalPiercerProjectile.cs index b42a436a09..701802ca3d 100644 --- a/Projectiles/Rogue/CrystalPiercerProjectile.cs +++ b/Projectiles/Rogue/CrystalPiercerProjectile.cs @@ -13,40 +13,40 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal Piercer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 113; + Projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; - projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - projectile.rotation += projectile.spriteDirection * MathHelper.ToRadians(45f); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.rotation += Projectile.spriteDirection * MathHelper.ToRadians(45f); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - if (projectile.timeLeft % 4 == 0) + if (Projectile.timeLeft % 4 == 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X + Main.rand.NextFloat(-15f, 15f), projectile.Center.Y + Main.rand.NextFloat(-15f, 15f), projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), projectile.knockBack * 0.4f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X + Main.rand.NextFloat(-15f, 15f), Projectile.Center.Y + Main.rand.NextFloat(-15f, 15f), Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack * 0.4f, Projectile.owner, 0f, 0f); } } } @@ -54,14 +54,14 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } //glowmask effect if stealth strike public override Color? GetAlpha(Color lightColor) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) return new Color(200, 200, 200, 200); else return null; @@ -71,11 +71,11 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } diff --git a/Projectiles/Rogue/CrystalPiercerShard.cs b/Projectiles/Rogue/CrystalPiercerShard.cs index 55a466a5fe..25a6272fa2 100644 --- a/Projectiles/Rogue/CrystalPiercerShard.cs +++ b/Projectiles/Rogue/CrystalPiercerShard.cs @@ -15,21 +15,21 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.Calamity().rogue = true; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation += projectile.direction * 0.05f; + Projectile.rotation += Projectile.direction * 0.05f; if (!initialized) { - projectile.scale = Main.rand.NextFloat(0.85f, 1.15f); + Projectile.scale = Main.rand.NextFloat(0.85f, 1.15f); initialized = true; } } diff --git a/Projectiles/Rogue/Crystalline2.cs b/Projectiles/Rogue/Crystalline2.cs index 830a5a9c1b..752e717ce4 100644 --- a/Projectiles/Rogue/Crystalline2.cs +++ b/Projectiles/Rogue/Crystalline2.cs @@ -16,30 +16,30 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; //projectile.aiStyle = 113; - projectile.timeLeft = 30; + Projectile.timeLeft = 30; //aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.localAI[0]++; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - if (projectile.localAI[0] == 10f && projectile.ai[1] == 1f) + Projectile.localAI[0]++; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + if (Projectile.localAI[0] == 10f && Projectile.ai[1] == 1f) { int numProj = 2; float rotation = MathHelper.ToRadians(50); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj + 1; i++) { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X * 0.8f, projectile.velocity.Y * 0.8f).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - int proj = Projectile.NewProjectile(projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 2f); + Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X * 0.8f, Projectile.velocity.Y * 0.8f).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + int proj = Projectile.NewProjectile(Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, 0f, 2f); Main.projectile[proj].timeLeft = 20; } } @@ -48,10 +48,10 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft == (projectile.ai[1] == 2f ? 20 : 30)) + if (Projectile.timeLeft == (Projectile.ai[1] == 2f ? 20 : 30)) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -59,14 +59,14 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 154, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - if (projectile.ai[1] >= 1f) + if (Projectile.ai[1] >= 1f) { for (int i = 0; i < 3; i++) { Vector2 projspeed = new Vector2(Main.rand.NextFloat(-8f, 8f), Main.rand.NextFloat(-8f, 8f)); - int shard = Projectile.NewProjectile(projectile.Center, projspeed, ProjectileID.CrystalShard, (int)(projectile.damage * 0.4f), 2f, projectile.owner); + int shard = Projectile.NewProjectile(Projectile.Center, projspeed, ProjectileID.CrystalShard, (int)(Projectile.damage * 0.4f), 2f, Projectile.owner); if (shard.WithinBounds(Main.maxProjectiles)) Main.projectile[shard].Calamity().forceRogue = true; } diff --git a/Projectiles/Rogue/CrystallineProj.cs b/Projectiles/Rogue/CrystallineProj.cs index dd051895c6..214718d472 100644 --- a/Projectiles/Rogue/CrystallineProj.cs +++ b/Projectiles/Rogue/CrystallineProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class CrystallineProj : ModProjectile @@ -16,31 +17,31 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 120; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 113; + Projectile.timeLeft = 120; aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - projectile.ai[1] += 1f; - if (projectile.ai[1] == 30f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] == 30f) { int numProj = 2; float rotation = MathHelper.ToRadians(50); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj + 1; i++) { - float AI1 = projectile.Calamity().stealthStrike ? 1f : 0f; - Vector2 perturbedSpeed = projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, AI1); + float AI1 = Projectile.Calamity().stealthStrike ? 1f : 0f; + Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, 0f, AI1); } } } @@ -48,17 +49,17 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item27, (int)Projectile.position.X, (int)Projectile.position.Y); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 154, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/CursedDaggerProj.cs b/Projectiles/Rogue/CursedDaggerProj.cs index 5f537e3d3c..0b35e95ccc 100644 --- a/Projectiles/Rogue/CursedDaggerProj.cs +++ b/Projectiles/Rogue/CursedDaggerProj.cs @@ -18,32 +18,32 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.aiStyle = 2; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.aiStyle = 2; + Projectile.timeLeft = 600; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; - projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - if (projectile.timeLeft % 8 == 0) + if (Projectile.timeLeft % 8 == 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { Vector2 velocity = new Vector2(Main.rand.NextFloat(-14f, 14f), Main.rand.NextFloat(-14f, 14f)); - int flame = Projectile.NewProjectile(projectile.Center, velocity, Main.rand.NextBool(2) ? ProjectileID.CursedFlameFriendly : ProjectileID.CursedDartFlame, (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner); + int flame = Projectile.NewProjectile(Projectile.Center, velocity, Main.rand.NextBool(2) ? ProjectileID.CursedFlameFriendly : ProjectileID.CursedDartFlame, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); if (flame.WithinBounds(Main.maxProjectiles)) { Main.projectile[flame].Calamity().forceRogue = true; @@ -59,26 +59,26 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 10; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -86,19 +86,19 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.CursedInferno, projectile.Calamity().stealthStrike ? 600 : 120); + target.AddBuff(BuffID.CursedInferno, Projectile.Calamity().stealthStrike ? 600 : 120); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.CursedInferno, projectile.Calamity().stealthStrike ? 600 : 120); + target.AddBuff(BuffID.CursedInferno, Projectile.Calamity().stealthStrike ? 600 : 120); } } } diff --git a/Projectiles/Rogue/DeepSeaDumbbell1.cs b/Projectiles/Rogue/DeepSeaDumbbell1.cs index 8523f3e4d6..9176eaf68d 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell1.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell1.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -18,32 +19,32 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; } public override void AI() { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; + Projectile.rotation += Math.Abs(Projectile.velocity.X) * 0.01f * (float)Projectile.direction; } public override bool OnTileCollide(Vector2 oldVelocity) { - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 43, 0.35f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 43, 0.35f, 0f); - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.75), projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.75), Projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; @@ -61,14 +62,14 @@ namespace CalamityMod.Projectiles.Rogue num629 *= -10f; } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); num3 = num627; } } - projectile.Kill(); + Projectile.Kill(); return false; } @@ -77,15 +78,15 @@ namespace CalamityMod.Projectiles.Rogue { target.AddBuff(ModContent.BuffType(), 240); - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 43, 0.35f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 43, 0.35f, 0f); - projectile.velocity.X = -projectile.velocity.X; - projectile.velocity.Y = -projectile.velocity.Y; + Projectile.velocity.X = -Projectile.velocity.X; + Projectile.velocity.Y = -Projectile.velocity.Y; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.75), projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.75), Projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; @@ -103,29 +104,29 @@ namespace CalamityMod.Projectiles.Rogue num629 *= -10f; } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); num3 = num627; } } - projectile.Kill(); + Projectile.Kill(); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 240); - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 43, 0.35f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 43, 0.35f, 0f); - projectile.velocity.X = -projectile.velocity.X; - projectile.velocity.Y = -projectile.velocity.Y; + Projectile.velocity.X = -Projectile.velocity.X; + Projectile.velocity.Y = -Projectile.velocity.Y; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.75), projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.75), Projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; @@ -143,14 +144,14 @@ namespace CalamityMod.Projectiles.Rogue num629 *= -10f; } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); num3 = num627; } } - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Rogue/DeepSeaDumbbell2.cs b/Projectiles/Rogue/DeepSeaDumbbell2.cs index c765cb9cd4..db4d837e17 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell2.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell2.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -18,39 +19,39 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; } public override void AI() { - if (projectile.ai[0] < 60f) - projectile.ai[0] += 1f; + if (Projectile.ai[0] < 60f) + Projectile.ai[0] += 1f; else { - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); } - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; + Projectile.rotation += Math.Abs(Projectile.velocity.X) * 0.01f * (float)Projectile.direction; } public override bool OnTileCollide(Vector2 oldVelocity) { - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 43, 0.35f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 43, 0.35f, 0f); - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.75), projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.75), Projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; @@ -68,14 +69,14 @@ namespace CalamityMod.Projectiles.Rogue num629 *= -10f; } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); num3 = num627; } } - projectile.Kill(); + Projectile.Kill(); return false; } @@ -84,15 +85,15 @@ namespace CalamityMod.Projectiles.Rogue { target.AddBuff(ModContent.BuffType(), 180); - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 43, 0.35f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 43, 0.35f, 0f); - projectile.velocity.X = -projectile.velocity.X; - projectile.velocity.Y = -projectile.velocity.Y; + Projectile.velocity.X = -Projectile.velocity.X; + Projectile.velocity.Y = -Projectile.velocity.Y; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.75), projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.75), Projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; @@ -110,29 +111,29 @@ namespace CalamityMod.Projectiles.Rogue num629 *= -10f; } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); num3 = num627; } } - projectile.Kill(); + Projectile.Kill(); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 43, 0.35f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 43, 0.35f, 0f); - projectile.velocity.X = -projectile.velocity.X; - projectile.velocity.Y = -projectile.velocity.Y; + Projectile.velocity.X = -Projectile.velocity.X; + Projectile.velocity.Y = -Projectile.velocity.Y; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.75), projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.75), Projectile.knockBack * 0.75f, Main.myPlayer, 0f, 0f); float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; @@ -150,14 +151,14 @@ namespace CalamityMod.Projectiles.Rogue num629 *= -10f; } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); num3 = num627; } } - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Rogue/DeepSeaDumbbell3.cs b/Projectiles/Rogue/DeepSeaDumbbell3.cs index 931a572a3c..7eee9e6356 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell3.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell3.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -18,31 +19,31 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; } public override void AI() { - if (projectile.ai[0] < 60f) - projectile.ai[0] += 1f; + if (Projectile.ai[0] < 60f) + Projectile.ai[0] += 1f; else { - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); } - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; + Projectile.rotation += Math.Abs(Projectile.velocity.X) * 0.01f * (float)Projectile.direction; } public override bool OnTileCollide(Vector2 oldVelocity) { - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 43, 0.35f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 43, 0.35f, 0f); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; @@ -60,14 +61,14 @@ namespace CalamityMod.Projectiles.Rogue num629 *= -10f; } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); num3 = num627; } } - projectile.Kill(); + Projectile.Kill(); return false; } @@ -76,9 +77,9 @@ namespace CalamityMod.Projectiles.Rogue { target.AddBuff(ModContent.BuffType(), 120); - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 43, 0.35f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 43, 0.35f, 0f); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; @@ -96,23 +97,23 @@ namespace CalamityMod.Projectiles.Rogue num629 *= -10f; } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); num3 = num627; } } - projectile.Kill(); + Projectile.Kill(); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 43, 0.35f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 43, 0.35f, 0f); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { float num628 = (float)Main.rand.Next(-35, 36) * 0.01f; float num629 = (float)Main.rand.Next(-35, 36) * 0.01f; @@ -130,14 +131,14 @@ namespace CalamityMod.Projectiles.Rogue num629 *= -10f; } - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.25), projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), + (int)((double)Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Main.myPlayer, 0f, 0f); num3 = num627; } } - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Rogue/DeepSeaDumbbellWeight.cs b/Projectiles/Rogue/DeepSeaDumbbellWeight.cs index 14fd47d60f..8860a36940 100644 --- a/Projectiles/Rogue/DeepSeaDumbbellWeight.cs +++ b/Projectiles/Rogue/DeepSeaDumbbellWeight.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,46 +17,46 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; } public override void AI() { - projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.99f; - if (projectile.velocity.Y > 16f) + Projectile.rotation += Math.Abs(Projectile.velocity.X) * 0.04f * (float)Projectile.direction; + Projectile.velocity.Y = Projectile.velocity.Y + 0.4f; + Projectile.velocity.X = Projectile.velocity.X * 0.99f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 43, 0.35f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 43, 0.35f, 0f); - projectile.position = projectile.Center; - projectile.width = projectile.height = 36; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 36; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.25f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.25f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 33, vector7.X, vector7.Y, 100, default, 1f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } - projectile.Damage(); + Projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/DeepWounderProjectile.cs b/Projectiles/Rogue/DeepWounderProjectile.cs index 5654ab22dd..c57815a2b2 100644 --- a/Projectiles/Rogue/DeepWounderProjectile.cs +++ b/Projectiles/Rogue/DeepWounderProjectile.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -19,28 +20,28 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation += 0.2f * projectile.direction; + Projectile.rotation += 0.2f * Projectile.direction; - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { int spriteWidth = 52; int spriteHeight = 48; - Vector2 spriteCenter = projectile.Center - new Vector2(spriteWidth / 2, spriteHeight / 2); + Vector2 spriteCenter = Projectile.Center - new Vector2(spriteWidth / 2, spriteHeight / 2); for (int i = 0; i < 30; i++) { - int dust = Dust.NewDust(spriteCenter, spriteWidth, spriteHeight, 33, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default, 1f); + int dust = Dust.NewDust(spriteCenter, spriteWidth, spriteHeight, 33, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); Main.dust[dust].noGravity = true; } @@ -49,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 waterVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); waterVelocity.Normalize(); waterVelocity *= 3; - Projectile.NewProjectile(spriteCenter, waterVelocity, ModContent.ProjectileType(), 20, 1, projectile.owner, 0, 0); + Projectile.NewProjectile(spriteCenter, waterVelocity, ModContent.ProjectileType(), 20, 1, Projectile.owner, 0, 0); } } } @@ -58,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue { target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { target.AddBuff(ModContent.BuffType(), 120); } @@ -68,7 +69,7 @@ namespace CalamityMod.Projectiles.Rogue { target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { target.AddBuff(ModContent.BuffType(), 120); } @@ -76,23 +77,23 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - if (projectile.direction > 0) + Texture2D tex = Main.projectileTexture[Projectile.type]; + if (Projectile.direction > 0) { - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); } else { - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.FlipHorizontally, 0f); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.FlipHorizontally, 0f); } return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } } diff --git a/Projectiles/Rogue/DeepWounderWater.cs b/Projectiles/Rogue/DeepWounderWater.cs index 5b853c4049..300f8948c7 100644 --- a/Projectiles/Rogue/DeepWounderWater.cs +++ b/Projectiles/Rogue/DeepWounderWater.cs @@ -15,43 +15,43 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 50; - projectile.Calamity().rogue = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 50; + Projectile.Calamity().rogue = true; } public override void AI() { for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, projectile.velocity.X, projectile.velocity.Y); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, Projectile.velocity.X, Projectile.velocity.Y); Main.dust[dust].noGravity = true; } - projectile.rotation += 0.2f; + Projectile.rotation += 0.2f; - projectile.velocity.Y += 0.2f; - if (projectile.velocity.Y > 16f) + Projectile.velocity.Y += 0.2f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + Projectile.Kill(); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Rogue/DeificThunderboltProj.cs b/Projectiles/Rogue/DeificThunderboltProj.cs index 77cf8dda89..a6446531fc 100644 --- a/Projectiles/Rogue/DeificThunderboltProj.cs +++ b/Projectiles/Rogue/DeificThunderboltProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -13,47 +14,47 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Deific Thunderbolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - Main.projFrames[projectile.type] = 8; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Projectile.type] = 8; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } if (!playedSound) { - Main.PlaySound(SoundID.Item92, (int)projectile.position.X, (int)projectile.position.Y); //electrosphere launcher fire sound + SoundEngine.PlaySound(SoundID.Item92, (int)Projectile.position.X, (int)Projectile.position.Y); //electrosphere launcher fire sound playedSound = true; } if (Main.rand.NextBool(8)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 132, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 132, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -70,27 +71,27 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 10; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 132, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 132, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - bool stealthStrike = projectile.Calamity().stealthStrike; + bool stealthStrike = Projectile.Calamity().stealthStrike; if (stealthStrike) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)Projectile.position.X, (int)Projectile.position.Y); } int amt = stealthStrike ? 5 : 1; float damageMult = stealthStrike ? 0.5f : 1f; for (int n = 0; n < amt; n++) { - Vector2 spawnPoint = new Vector2(projectile.Center.X + (float)Main.rand.Next(-100, 101), projectile.Center.Y - (float)Main.rand.Next(700, 801)); + Vector2 spawnPoint = new Vector2(Projectile.Center.X + (float)Main.rand.Next(-100, 101), Projectile.Center.Y - (float)Main.rand.Next(700, 801)); float randomVelocity = Main.rand.NextFloat() - 0.5f; Vector2 fireTo = new Vector2(spawnPoint.X + 100f * randomVelocity, spawnPoint.Y + 900); Vector2 ai0 = fireTo - spawnPoint; float ai = (float)Main.rand.Next(100); Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(0.78539818525314331)) * 9f; - int proj = Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, velocity.X, velocity.Y, ProjectileID.CultistBossLightningOrbArc, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, ai0.ToRotation(), ai); + int proj = Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, velocity.X, velocity.Y, ProjectileID.CultistBossLightningOrbArc, (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner, ai0.ToRotation(), ai); Main.projectile[proj].extraUpdates += 9; //Does not force to Rogue because lightning is extremely abusable with Moonstone Crown Main.projectile[proj].friendly = true; @@ -104,7 +105,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/DesecratedBubble.cs b/Projectiles/Rogue/DesecratedBubble.cs index a11e7b7654..80317c2e29 100644 --- a/Projectiles/Rogue/DesecratedBubble.cs +++ b/Projectiles/Rogue/DesecratedBubble.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class DesecratedBubble : ModProjectile @@ -13,60 +14,60 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 120; - projectile.Calamity().rogue = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 120; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.scale += 0.002f; - if (projectile.alpha <= 0) + Projectile.scale += 0.002f; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - else if (projectile.alpha > 50) + else if (Projectile.alpha > 50) { - projectile.alpha -= 20; + Projectile.alpha -= 20; } - if (projectile.timeLeft <= 100) + if (Projectile.timeLeft <= 100) { - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; } else { - projectile.velocity *= 0.995f; + Projectile.velocity *= 0.995f; } - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 8f, 20f); } } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item54, (int)Projectile.position.X, (int)Projectile.position.Y); int num190 = Main.rand.Next(5, 9); for (int num191 = 0; num191 < num190; num191++) { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 179, 0f, 0f, 100, default, 1.4f); + int num192 = Dust.NewDust(Projectile.Center, 0, 0, 179, 0f, 0f, 100, default, 1.4f); Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, Projectile.Center, 0.5f); Main.dust[num192].noGravity = true; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { target.AddBuff(BuffID.Ichor, 180); target.AddBuff(BuffID.CursedInferno, 180); @@ -75,7 +76,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { target.AddBuff(BuffID.Ichor, 180); target.AddBuff(BuffID.CursedInferno, 180); @@ -85,13 +86,13 @@ namespace CalamityMod.Projectiles.Rogue // Cannot deal damage for the first several frames of existence. public override bool? CanHitNPC(NPC target) { - if (projectile.timeLeft >= 100) + if (Projectile.timeLeft >= 100) { return false; } return null; } - public override bool CanHitPvp(Player target) => projectile.timeLeft < 100; + public override bool CanHitPvp(Player target) => Projectile.timeLeft < 100; } } diff --git a/Projectiles/Rogue/DesecratedWaterProj.cs b/Projectiles/Rogue/DesecratedWaterProj.cs index 24d2cd420b..dcc609e66a 100644 --- a/Projectiles/Rogue/DesecratedWaterProj.cs +++ b/Projectiles/Rogue/DesecratedWaterProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class DesecratedWaterProj : ModProjectile @@ -16,50 +17,50 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 25; - projectile.height = 25; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 300; + Projectile.width = 25; + Projectile.height = 25; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 2; + Projectile.timeLeft = 300; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Shatter, (int) projectile.position.X, (int) projectile.position.Y, 1, 1f, 0.0f); + SoundEngine.PlaySound(SoundID.Shatter, (int) Projectile.position.X, (int) Projectile.position.Y, 1, 1f, 0.0f); Vector2 vector2 = new Vector2(20f, 20f); for (int index = 0; index < 10; ++index) - Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 191, 0.0f, 0.0f); + Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 191, 0.0f, 0.0f); for (int index1 = 0; index1 < 20; ++index1) { - int index2 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 179, 0.0f, 0.0f, 100, new Color(), 2.5f); + int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 179, 0.0f, 0.0f, 100, new Color(), 2.5f); Main.dust[index2].noGravity = true; Dust dust1 = Main.dust[index2]; dust1.velocity = dust1.velocity * 5f; - int index3 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 179, 0.0f, 0.0f, 100, new Color(), 1.5f); + int index3 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 179, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust2 = Main.dust[index3]; dust2.velocity = dust2.velocity * 3f; } - int num220 = (projectile.Calamity().stealthStrike ? Main.rand.Next(10, 16) : Main.rand.Next(5, 11)); - if (projectile.owner == Main.myPlayer) + int num220 = (Projectile.Calamity().stealthStrike ? Main.rand.Next(10, 16) : Main.rand.Next(5, 11)); + if (Projectile.owner == Main.myPlayer) { for (int num221 = 0; num221 < num220; num221++) { Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); value17.Normalize(); value17 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 1f, projectile.owner, (projectile.Calamity().stealthStrike ? 1f : 0f), 1f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 1f, Projectile.owner, (Projectile.Calamity().stealthStrike ? 1f : 0f), 1f); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index 5e93e241e4..b8b0fb5c8e 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class DestructionBolt : ModProjectile @@ -12,58 +13,58 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Destruction Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - projectile.tileCollide = false; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; + Projectile.tileCollide = false; } public override void AI() { if (Main.rand.Next(8) == 0) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - if (projectile.alpha > 0) - projectile.alpha -= 8; + if (Projectile.alpha > 0) + Projectile.alpha -= 8; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; float num29 = 5f; float num30 = 300f; float scaleFactor = 6f; Vector2 value7 = new Vector2(10f, 20f); - int num32 = 3 * projectile.MaxUpdates; - if (projectile.ai[1] == 0f) + int num32 = 3 * Projectile.MaxUpdates; + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - projectile.localAI[0] = (float)-(float)Main.rand.Next(48); + Projectile.ai[1] = 1f; + Projectile.localAI[0] = (float)-(float)Main.rand.Next(48); } - else if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) + else if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) { - if (projectile.alpha < 128) + if (Projectile.alpha < 128) { int num35 = -1; float num36 = num30; for (int num37 = 0; num37 < Main.maxNPCs; num37++) { - if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(projectile, false)) + if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(Projectile, false)) { Vector2 center3 = Main.npc[num37].Center; - float num38 = Vector2.Distance(center3, projectile.Center); - if (num38 < num36 && num35 == -1 && Collision.CanHitLine(projectile.Center, 1, 1, center3, 1, 1)) + float num38 = Vector2.Distance(center3, Projectile.Center); + if (num38 < num36 && num35 == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, center3, 1, 1)) { num36 = num38; num35 = num37; @@ -72,34 +73,34 @@ namespace CalamityMod.Projectiles.Rogue } if (num36 < 4f) { - projectile.Kill(); + Projectile.Kill(); return; } if (num35 != -1) { - projectile.ai[1] = num29 + 1f; - projectile.ai[0] = (float)num35; - projectile.netUpdate = true; + Projectile.ai[1] = num29 + 1f; + Projectile.ai[0] = (float)num35; + Projectile.netUpdate = true; } } } - else if (projectile.ai[1] > num29) + else if (Projectile.ai[1] > num29) { - projectile.ai[1] += 1f; - int num39 = (int)projectile.ai[0]; - if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(projectile, false)) + Projectile.ai[1] += 1f; + int num39 = (int)Projectile.ai[0]; + if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(Projectile, false)) { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 1f; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } else { - projectile.velocity.ToRotation(); - Vector2 vector6 = Main.npc[num39].Center - projectile.Center; + Projectile.velocity.ToRotation(); + Vector2 vector6 = Main.npc[num39].Center - Projectile.Center; if (vector6.Length() < 10f) { - projectile.Kill(); + Projectile.Kill(); return; } if (vector6 != Vector2.Zero) @@ -108,50 +109,50 @@ namespace CalamityMod.Projectiles.Rogue vector6 *= scaleFactor; } float num40 = 30f; - projectile.velocity = (projectile.velocity * (num40 - 1f) + vector6) / num40; + Projectile.velocity = (Projectile.velocity * (num40 - 1f) + vector6) / num40; } } - if (projectile.ai[1] >= 1f && projectile.ai[1] < num29) + if (Projectile.ai[1] >= 1f && Projectile.ai[1] < num29) { - projectile.ai[1] += 1f; - if (projectile.ai[1] == num29) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] == num29) { - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 48f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override bool CanDamage() { - return projectile.alpha < 128; + return Projectile.alpha < 128; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -161,13 +162,13 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 45; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 9); + CalamityUtils.ExplosionGores(Projectile.Center, 9); } } } diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index 6084870689..0ae17b4b73 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -21,26 +22,26 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 94; - projectile.height = 94; - projectile.friendly = true; - projectile.penetrate = 16; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 94; + Projectile.height = 94; + Projectile.friendly = true; + Projectile.penetrate = 16; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void AI() { if (Main.rand.NextBool(8)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 191, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 191, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.rotation += Math.Sign(projectile.velocity.X) * MathHelper.ToRadians(8f); - if (projectile.Calamity().stealthStrike || hitCount > 16) + Projectile.rotation += Math.Sign(Projectile.velocity.X) * MathHelper.ToRadians(8f); + if (Projectile.Calamity().stealthStrike || hitCount > 16) hitCount = 16; } @@ -56,29 +57,29 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, Radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox); public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Vector2 vector2 = new Vector2(20f, 20f); for (int index1 = 0; index1 < 10; ++index1) { - int index2 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); + int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust = Main.dust[index2]; dust.velocity = dust.velocity * 1.4f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < hitCount; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Rogue/DragonShit.cs b/Projectiles/Rogue/DragonShit.cs index ead922e7ba..601ee52b18 100644 --- a/Projectiles/Rogue/DragonShit.cs +++ b/Projectiles/Rogue/DragonShit.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,62 +16,62 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 64; - projectile.height = 64; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 420; - projectile.Calamity().rogue = true; + Projectile.width = 64; + Projectile.height = 64; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 420; + Projectile.Calamity().rogue = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 380 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 380 && target.CanBeChasedBy(Projectile); public override void AI() { - target = projectile.Center.ClosestNPCAt(1200f); - if (projectile.localAI[0] == 0f) + target = Projectile.Center.ClosestNPCAt(1200f); + if (Projectile.localAI[0] == 0f) { - projectile.ai[0] = Utils.SelectRandom(Main.rand, -1f, 1f); - projectile.localAI[0] = 1f; + Projectile.ai[0] = Utils.SelectRandom(Main.rand, -1f, 1f); + Projectile.localAI[0] = 1f; } - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; - if (projectile.timeLeft >= 380) + if (Projectile.timeLeft >= 380) { - projectile.velocity *= 1.07f; + Projectile.velocity *= 1.07f; } else if (target != null) { - projectile.velocity = (projectile.velocity * 23f + projectile.SafeDirectionTo(target.Center) * 14.975f) / 24f; + Projectile.velocity = (Projectile.velocity * 23f + Projectile.SafeDirectionTo(target.Center) * 14.975f) / 24f; } else { - projectile.timeLeft = Math.Min(projectile.timeLeft, 15); - projectile.alpha += 17; - projectile.velocity = rotationVector; - rotationVector = rotationVector.RotatedBy(MathHelper.ToRadians(14.975f * projectile.ai[0])); + Projectile.timeLeft = Math.Min(Projectile.timeLeft, 15); + Projectile.alpha += 17; + Projectile.velocity = rotationVector; + rotationVector = rotationVector.RotatedBy(MathHelper.ToRadians(14.975f * Projectile.ai[0])); } } // Reduce damage of projectiles if more than the cap are active public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - int projectileCount = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + int projectileCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type]; int cap = 5; int oldDamage = damage; if (projectileCount > cap) @@ -81,24 +82,24 @@ namespace CalamityMod.Projectiles.Rogue } } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D projectileTexture = Main.projectileTexture[projectile.type]; - int frameHeight = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int frameY = frameHeight * projectile.frame; - Main.spriteBatch.Draw(projectileTexture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, projectileTexture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)projectileTexture.Width / 2f, (float)frameHeight / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D projectileTexture = Main.projectileTexture[Projectile.type]; + int frameHeight = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int frameY = frameHeight * Projectile.frame; + Main.spriteBatch.Draw(projectileTexture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, projectileTexture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)projectileTexture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 80); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 80); for (int d = 0; d < 5; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -108,13 +109,13 @@ namespace CalamityMod.Projectiles.Rogue } for (int d = 0; d < 8; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[idx].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } } } diff --git a/Projectiles/Rogue/DukesDecapitatorBubble.cs b/Projectiles/Rogue/DukesDecapitatorBubble.cs index 2d1f6e59e9..1fe50f7217 100644 --- a/Projectiles/Rogue/DukesDecapitatorBubble.cs +++ b/Projectiles/Rogue/DukesDecapitatorBubble.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,65 +17,65 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; } public override void AI() { - if (projectile.localAI[0] > 2f) + if (Projectile.localAI[0] > 2f) { - projectile.alpha -= 20; - if (projectile.alpha < 100) + Projectile.alpha -= 20; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } } else { - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (projectile.ai[0] > 30f) + if (Projectile.ai[0] > 30f) { - if (projectile.velocity.Y > -8f) + if (Projectile.velocity.Y > -8f) { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.05f; } - projectile.velocity.X = projectile.velocity.X * 0.98f; + Projectile.velocity.X = Projectile.velocity.X * 0.98f; } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation = projectile.velocity.X * 0.1f; - if (projectile.wet) + Projectile.rotation = Projectile.velocity.X * 0.1f; + if (Projectile.wet) { - if (projectile.velocity.Y > 0f) + if (Projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; + Projectile.velocity.Y = Projectile.velocity.Y * 0.98f; } - if (projectile.velocity.Y > -8f) + if (Projectile.velocity.Y > -8f) { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; } - projectile.velocity.X = projectile.velocity.X * 0.94f; + Projectile.velocity.X = Projectile.velocity.X * 0.94f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); int num190 = Main.rand.Next(5, 9); for (int num191 = 0; num191 < num190; num191++) { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); + int num192 = Dust.NewDust(Projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, Projectile.Center, 0.5f); Main.dust[num192].noGravity = true; } } diff --git a/Projectiles/Rogue/DukesDecapitatorProj.cs b/Projectiles/Rogue/DukesDecapitatorProj.cs index f2315a16f0..248b195444 100644 --- a/Projectiles/Rogue/DukesDecapitatorProj.cs +++ b/Projectiles/Rogue/DukesDecapitatorProj.cs @@ -14,54 +14,54 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Decapitator"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; } public override void AI() { - CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); - if (projectile.velocity.X != 0 || projectile.velocity.Y != 0) + CalamityPlayer modPlayer = Main.player[Projectile.owner].Calamity(); + if (Projectile.velocity.X != 0 || Projectile.velocity.Y != 0) { - projectile.velocity *= 0.99f; + Projectile.velocity *= 0.99f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] == 5f) - projectile.tileCollide = true; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] == 5f) + Projectile.tileCollide = true; - if ((projectile.ai[0] % 15f) == 0f && rotationAmount > 0) + if ((Projectile.ai[0] % 15f) == 0f && rotationAmount > 0) { rotationAmount -= 0.05f; - if (projectile.Calamity().stealthStrike && projectile.owner == Main.myPlayer) + if (Projectile.Calamity().stealthStrike && Projectile.owner == Main.myPlayer) { float velocityX = Main.rand.NextFloat(-0.8f, 0.8f); float velocityY = Main.rand.NextFloat(-0.8f, -0.8f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocityX, velocityY, ModContent.ProjectileType(), (int)(projectile.damage * 0.8), projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, velocityX, velocityY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack, Projectile.owner); } } if (rotationAmount <= 0f) - projectile.Kill(); + Projectile.Kill(); - projectile.rotation += rotationAmount; + Projectile.rotation += rotationAmount; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.velocity = Vector2.Zero; + Projectile.velocity = Vector2.Zero; rotationAmount -= 0.05f; } @@ -69,13 +69,13 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 20; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 49, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.75f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 49, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.75f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/DuneHopperProjectile.cs b/Projectiles/Rogue/DuneHopperProjectile.cs index bcc9338f29..96a1a7c854 100644 --- a/Projectiles/Rogue/DuneHopperProjectile.cs +++ b/Projectiles/Rogue/DuneHopperProjectile.cs @@ -12,44 +12,44 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Scourge"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.penetrate = 6; - projectile.Calamity().rogue = true; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.penetrate = 6; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 20f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 20f) { - if (projectile.velocity.Y < 24f) + if (Projectile.velocity.Y < 24f) { - projectile.velocity.Y += 0.4f; + Projectile.velocity.Y += 0.4f; } } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, projectile.Calamity().stealthStrike ? 4 : 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, Projectile.Calamity().stealthStrike ? 4 : 2); return false; } } diff --git a/Projectiles/Rogue/DuststormCloud.cs b/Projectiles/Rogue/DuststormCloud.cs index b175832205..8a9f561842 100644 --- a/Projectiles/Rogue/DuststormCloud.cs +++ b/Projectiles/Rogue/DuststormCloud.cs @@ -7,59 +7,59 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 38; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - projectile.Calamity().rogue = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 5; + Projectile.width = 38; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 3600; + Projectile.Calamity().rogue = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.velocity *= 0.995f; - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 120f) + Projectile.velocity *= 0.995f; + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 120f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 5; - if (projectile.alpha > 255) + Projectile.alpha += 5; + if (Projectile.alpha > 255) { - projectile.alpha = 255; + Projectile.alpha = 255; } } - else if (projectile.owner == Main.myPlayer) + else if (Projectile.owner == Main.myPlayer) { - projectile.Kill(); + Projectile.Kill(); } } - else if (projectile.alpha > 80) + else if (Projectile.alpha > 80) { - projectile.alpha -= 30; - if (projectile.alpha < 80) + Projectile.alpha -= 30; + if (Projectile.alpha < 80) { - projectile.alpha = 80; + Projectile.alpha = 80; } } } diff --git a/Projectiles/Rogue/DuststormCloudStealth.cs b/Projectiles/Rogue/DuststormCloudStealth.cs index 3a092f808b..9b2a0fc5d6 100644 --- a/Projectiles/Rogue/DuststormCloudStealth.cs +++ b/Projectiles/Rogue/DuststormCloudStealth.cs @@ -9,59 +9,59 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 38; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - projectile.Calamity().rogue = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 4; + Projectile.width = 38; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 3600; + Projectile.Calamity().rogue = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 4; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.velocity *= 0.998f; - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 120f) + Projectile.velocity *= 0.998f; + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 120f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 3; - if (projectile.alpha > 255) + Projectile.alpha += 3; + if (Projectile.alpha > 255) { - projectile.alpha = 255; + Projectile.alpha = 255; } } - else if (projectile.owner == Main.myPlayer) + else if (Projectile.owner == Main.myPlayer) { - projectile.Kill(); + Projectile.Kill(); } } - else if (projectile.alpha > 80) + else if (Projectile.alpha > 80) { - projectile.alpha -= 30; - if (projectile.alpha < 80) + Projectile.alpha -= 30; + if (Projectile.alpha < 80) { - projectile.alpha = 80; + Projectile.alpha = 80; } } } diff --git a/Projectiles/Rogue/DuststormInABottleProj.cs b/Projectiles/Rogue/DuststormInABottleProj.cs index 12770aa971..9b6b0b1df2 100644 --- a/Projectiles/Rogue/DuststormInABottleProj.cs +++ b/Projectiles/Rogue/DuststormInABottleProj.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class DuststormInABottleProj : ModProjectile @@ -15,35 +16,35 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 180; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 2; + Projectile.timeLeft = 180; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void Kill(int timeLeft) { - bool stealth = projectile.Calamity().stealthStrike; - Main.PlaySound(SoundID.Item107, projectile.Center); + bool stealth = Projectile.Calamity().stealthStrike; + SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); for (int k = 0; k < 15; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.oldVelocity.X, projectile.oldVelocity.Y); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 85, Projectile.oldVelocity.X, Projectile.oldVelocity.Y); } int cloudAmt = Main.rand.Next(20, 31); if (stealth) cloudAmt *= 2; int projType = stealth ? ModContent.ProjectileType() : ModContent.ProjectileType(); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int index = 0; index < cloudAmt; index++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); - Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, projectile.knockBack * 0.5f, projectile.owner, stealth ? 1f : 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectile(Projectile.Center, velocity, projType, Projectile.damage, Projectile.knockBack * 0.5f, Projectile.owner, stealth ? 1f : 0f, (float)Main.rand.Next(-45, 1)); } } } diff --git a/Projectiles/Rogue/EclipseMirrorBurst.cs b/Projectiles/Rogue/EclipseMirrorBurst.cs index 1f3cd76a55..2ec638665a 100644 --- a/Projectiles/Rogue/EclipseMirrorBurst.cs +++ b/Projectiles/Rogue/EclipseMirrorBurst.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 752; - projectile.height = 752; - projectile.friendly = true; - projectile.alpha = 0; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 150; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.Calamity().rogue = true; + Projectile.width = 752; + Projectile.height = 752; + Projectile.friendly = true; + Projectile.alpha = 0; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 150; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.Calamity().rogue = true; } public override void AI() @@ -45,22 +45,22 @@ namespace CalamityMod.Projectiles.Rogue } if (frameX > 0 && frameY > 0) { - projectile.Kill(); + Projectile.Kill(); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; spriteBatch.Draw ( texture, - projectile.Center - Main.screenPosition, + Projectile.Center - Main.screenPosition, new Rectangle(frameX * 752, frameY * 752, 752, 752), Color.White, - projectile.rotation, - projectile.Size / 2f, - projectile.scale, + Projectile.rotation, + Projectile.Size / 2f, + Projectile.scale, SpriteEffects.None, 0f ); diff --git a/Projectiles/Rogue/EclipsesFallMain.cs b/Projectiles/Rogue/EclipsesFallMain.cs index 3c8f29984b..30ce37401c 100644 --- a/Projectiles/Rogue/EclipsesFallMain.cs +++ b/Projectiles/Rogue/EclipsesFallMain.cs @@ -13,32 +13,32 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Eclipse's Fall"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.extraUpdates = 1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.extraUpdates = 1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void AI() { if (Main.rand.NextBool(8)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 138, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 138, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -58,13 +58,13 @@ namespace CalamityMod.Projectiles.Rogue { float dmgMult = 0.08f * Main.rand.NextFloat(4f, 7f); float kBMult = 0.1f * Main.rand.NextFloat(7f, 10f); - CalamityUtils.ProjectileRain(targetPos, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(projectile.damage * dmgMult), projectile.knockBack * kBMult, projectile.owner); + CalamityUtils.ProjectileRain(targetPos, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(Projectile.damage * dmgMult), Projectile.knockBack * kBMult, Projectile.owner); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/EclipsesSmol.cs b/Projectiles/Rogue/EclipsesSmol.cs index b47d23e22e..95ceab8043 100644 --- a/Projectiles/Rogue/EclipsesSmol.cs +++ b/Projectiles/Rogue/EclipsesSmol.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class EclipsesSmol : ModProjectile @@ -14,28 +15,28 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 150; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 150; + Projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int i = 0; i < 2; i++) { - int dustInt = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.2f); + int dustInt = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 138, 0f, 0f, 100, default, 1.2f); Main.dust[dustInt].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -45,18 +46,18 @@ namespace CalamityMod.Projectiles.Rogue } for (int j = 0; j < 3; j++) { - int moreDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.7f); + int moreDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 138, 0f, 0f, 100, default, 1.7f); Main.dust[moreDust].noGravity = true; Main.dust[moreDust].velocity *= 5f; - moreDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1f); + moreDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 138, 0f, 0f, 100, default, 1f); Main.dust[moreDust].velocity *= 2f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 9d39d5088e..0cfc24a5d8 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -17,36 +17,36 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Eclipse's Fall"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 25; - projectile.height = 25; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 25; + Projectile.height = 25; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } // Uses localAI[1] to decide how many frames until the next spear drops. public override void AI() { // Behavior when not sticking to anything - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { // Keep the spear oriented in the correct direction - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; // Spawn dust while flying if (Main.rand.NextBool(8)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 138, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 138, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } // Behavior when having impaled a target @@ -55,40 +55,40 @@ namespace CalamityMod.Projectiles.Rogue // Eclipse's Fall is guaranteed to impale for 10 seconds, no more, no less if (!changedTimeLeft) { - projectile.timeLeft = 600; + Projectile.timeLeft = 600; changedTimeLeft = true; } // Spawn spears. As this uses local AI, it's done client-side only. - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - projectile.localAI[1] -= 1f; + Projectile.localAI[1] -= 1f; - if (projectile.localAI[1] <= 0f) + if (Projectile.localAI[1] <= 0f) { // Set up the spear counter for next time. Used to be every 5 frames there was a 50% chance; now it's more reliable but slower. - projectile.localAI[1] = Main.rand.Next(8, 14); // 8 to 13 frames between each spearfall + Projectile.localAI[1] = Main.rand.Next(8, 14); // 8 to 13 frames between each spearfall int type = ModContent.ProjectileType(); - int smolDamage = (int)(projectile.damage * 0.22f); + int smolDamage = (int)(Projectile.damage * 0.22f); float smolKB = 3f; // Used to be a 50% chance each spearfall for 1 or 2. Now is consistent. int numSpears = spawnTwoSpears ? 2 : 1; spawnTwoSpears = !spawnTwoSpears; for (int i = 0; i < numSpears; ++i) - CalamityUtils.ProjectileRain(projectile.Center, 400f, 100f, 500f, 800f, 29f, type, smolDamage, smolKB, projectile.owner); + CalamityUtils.ProjectileRain(Projectile.Center, 400f, 100f, 500f, 800f, 29f, type, smolDamage, smolKB, Projectile.owner); } } } // Sticky behavior. Lets the projectile impale enemies and sticks to its impaled enemy automatically. - projectile.StickyProjAI(10); + Projectile.StickyProjAI(10); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { // Impale the enemy on contact ("sticky behavior"). - projectile.ModifyHitNPCSticky(1, true); + Projectile.ModifyHitNPCSticky(1, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -102,19 +102,19 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override bool? CanHitNPC(NPC target) { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { return false; } return null; } - public override bool CanHitPvp(Player target) => projectile.ai[0] != 1f; + public override bool CanHitPvp(Player target) => Projectile.ai[0] != 1f; } } diff --git a/Projectiles/Rogue/EnchantedAxe2.cs b/Projectiles/Rogue/EnchantedAxe2.cs index 2755d7be5b..37dd881d14 100644 --- a/Projectiles/Rogue/EnchantedAxe2.cs +++ b/Projectiles/Rogue/EnchantedAxe2.cs @@ -15,27 +15,27 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = 2; - projectile.timeLeft = 150; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = 2; + Projectile.timeLeft = 150; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation += 0.4f * projectile.direction; + Projectile.rotation += 0.4f * Projectile.direction; return; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, new Color(255, 255, 255, 128), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, new Color(255, 255, 255, 128), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Rogue/EnchantedAxeProj.cs b/Projectiles/Rogue/EnchantedAxeProj.cs index d4dceb78db..51cf73d220 100644 --- a/Projectiles/Rogue/EnchantedAxeProj.cs +++ b/Projectiles/Rogue/EnchantedAxeProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,55 +17,55 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Enchanted Axe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - if (projectile.timeLeft < 585) + if (Projectile.timeLeft < 585) { recall = true; - projectile.tileCollide = false; + Projectile.tileCollide = false; } } else { - if (projectile.timeLeft < 590) + if (Projectile.timeLeft < 590) { recall = true; - projectile.tileCollide = false; + Projectile.tileCollide = false; } } - projectile.rotation += 0.4f * projectile.direction; + Projectile.rotation += 0.4f * Projectile.direction; if (recall) { - Vector2 posDiff = Main.player[projectile.owner].position - projectile.position; + Vector2 posDiff = Main.player[Projectile.owner].position - Projectile.position; if (posDiff.Length() > 30f) { posDiff.Normalize(); - projectile.velocity = posDiff * 30f; + Projectile.velocity = posDiff * 30f; } else { - projectile.timeLeft = 0; - Kill(projectile.timeLeft); + Projectile.timeLeft = 0; + Kill(Projectile.timeLeft); } if (summonAxe) @@ -75,9 +76,9 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < Main.npc.Length; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < minDist) { minDist = dist; @@ -88,48 +89,48 @@ namespace CalamityMod.Projectiles.Rogue Vector2 newAxeVelocity; if (minDist < 999f) { - newAxeVelocity = Main.npc[index].Center - projectile.Center; + newAxeVelocity = Main.npc[index].Center - Projectile.Center; } else { - newAxeVelocity = -projectile.velocity; + newAxeVelocity = -Projectile.velocity; } newAxeVelocity.Normalize(); newAxeVelocity *= 20f; - int p = Projectile.NewProjectile(projectile.position, newAxeVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 1.2f), 2, projectile.owner, 0, 0); - Main.projectile[p].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + int p = Projectile.NewProjectile(Projectile.position, newAxeVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), 2, Projectile.owner, 0, 0); + Main.projectile[p].Calamity().stealthStrike = Projectile.Calamity().stealthStrike; summonAxe = false; } } else { - if (projectile.timeLeft % 7 == 1 && projectile.Calamity().stealthStrike) + if (Projectile.timeLeft % 7 == 1 && Projectile.Calamity().stealthStrike) { float axeSpeed = 15f; - int axeDamage = projectile.damage / 2; - Projectile.NewProjectile(projectile.position, new Vector2(1f, 0f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, projectile.owner, 0, 0); - Projectile.NewProjectile(projectile.position, new Vector2(0f, 1f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, projectile.owner, 0, 0); - Projectile.NewProjectile(projectile.position, new Vector2(-1f, 0f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, projectile.owner, 0, 0); - Projectile.NewProjectile(projectile.position, new Vector2(0f, -1f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, projectile.owner, 0, 0); - Projectile.NewProjectile(projectile.position, Vector2.Normalize(new Vector2(1f, 1f)) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, projectile.owner, 0, 0); - Projectile.NewProjectile(projectile.position, Vector2.Normalize(new Vector2(1f, -1f)) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, projectile.owner, 0, 0); - Projectile.NewProjectile(projectile.position, Vector2.Normalize(new Vector2(-1f, -1f)) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, projectile.owner, 0, 0); - Projectile.NewProjectile(projectile.position, Vector2.Normalize(new Vector2(-1f, 1f)) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, projectile.owner, 0, 0); + int axeDamage = Projectile.damage / 2; + Projectile.NewProjectile(Projectile.position, new Vector2(1f, 0f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.position, new Vector2(0f, 1f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.position, new Vector2(-1f, 0f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.position, new Vector2(0f, -1f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.position, Vector2.Normalize(new Vector2(1f, 1f)) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.position, Vector2.Normalize(new Vector2(1f, -1f)) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.position, Vector2.Normalize(new Vector2(-1f, -1f)) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.position, Vector2.Normalize(new Vector2(-1f, 1f)) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, Projectile.owner, 0, 0); } } - if (projectile.position == Main.player[projectile.owner].position) + if (Projectile.position == Main.player[Projectile.owner].position) { - Kill(projectile.timeLeft); + Kill(Projectile.timeLeft); } return; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -139,10 +140,10 @@ namespace CalamityMod.Projectiles.Rogue { return false; } - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); recall = true; - projectile.tileCollide = false; + Projectile.tileCollide = false; return false; } } diff --git a/Projectiles/Rogue/EpidemicShredderProjectile.cs b/Projectiles/Rogue/EpidemicShredderProjectile.cs index c348432cdb..9a7bc005b4 100644 --- a/Projectiles/Rogue/EpidemicShredderProjectile.cs +++ b/Projectiles/Rogue/EpidemicShredderProjectile.cs @@ -18,33 +18,33 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.penetrate = 6; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; + Projectile.width = 34; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.penetrate = 6; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; } public override void AI() { - projectile.rotation += Math.Sign(projectile.velocity.X) * MathHelper.ToRadians(10f); - if (projectile.ai[0] > 0f) + Projectile.rotation += Math.Sign(Projectile.velocity.X) * MathHelper.ToRadians(10f); + if (Projectile.ai[0] > 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; } - if (projectile.timeLeft < 580f) + if (Projectile.timeLeft < 580f) { - projectile.velocity = (projectile.velocity * 18f + projectile.SafeDirectionTo(Main.player[projectile.owner].Center) * 18f) / 19f; - if (Main.player[projectile.owner].Hitbox.Intersects(projectile.Hitbox)) - projectile.Kill(); + Projectile.velocity = (Projectile.velocity * 18f + Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center) * 18f) / 19f; + if (Main.player[Projectile.owner].Hitbox.Intersects(Projectile.Hitbox)) + Projectile.Kill(); } - if (projectile.timeLeft % 5 == 0 && projectile.Calamity().stealthStrike) + if (Projectile.timeLeft % 5 == 0 && Projectile.Calamity().stealthStrike) { - int projIndex2 = Projectile.NewProjectile(projectile.Center, (projectile.velocity * -1f).RotatedByRandom(MathHelper.ToRadians(15f)), ModContent.ProjectileType(), (int)(projectile.damage * 0.25f), 2f, projectile.owner); + int projIndex2 = Projectile.NewProjectile(Projectile.Center, (Projectile.velocity * -1f).RotatedByRandom(MathHelper.ToRadians(15f)), ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), 2f, Projectile.owner); if (projIndex2.WithinBounds(Main.maxProjectiles)) Main.projectile[projIndex2].Calamity().forceRogue = true; } @@ -52,51 +52,51 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.penetrate > 1) + if (Projectile.penetrate > 1) { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - int projIndex1 = Projectile.NewProjectile(projectile.Center, projectile.velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25f), 2f, projectile.owner); + int projIndex1 = Projectile.NewProjectile(Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), 2f, Projectile.owner); if (projIndex1.WithinBounds(Main.maxProjectiles)) Main.projectile[projIndex1].Calamity().forceRogue = true; - projectile.ai[0] = 12f; //0.2th of a second cooldown + Projectile.ai[0] = 12f; //0.2th of a second cooldown } - projectile.penetrate--; + Projectile.penetrate--; } else - projectile.tileCollide = false; + Projectile.tileCollide = false; return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - int projectileIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25f), 2f, projectile.owner); + int projectileIndex = Projectile.NewProjectile(Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), 2f, Projectile.owner); if (projectileIndex.WithinBounds(Main.maxProjectiles)) Main.projectile[projectileIndex].Calamity().forceRogue = true; - projectile.ai[0] = 12f; //0.2th of a second cooldown + Projectile.ai[0] = 12f; //0.2th of a second cooldown } target.AddBuff(ModContent.BuffType(), 240); } public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - int projectileIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25f), 2f, projectile.owner); + int projectileIndex = Projectile.NewProjectile(Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), 2f, Projectile.owner); if (projectileIndex.WithinBounds(Main.maxProjectiles)) Main.projectile[projectileIndex].Calamity().forceRogue = true; - projectile.ai[0] = 12f; //0.2th of a second cooldown + Projectile.ai[0] = 12f; //0.2th of a second cooldown } target.AddBuff(ModContent.BuffType(), 240); } diff --git a/Projectiles/Rogue/EquanimityDarkShard.cs b/Projectiles/Rogue/EquanimityDarkShard.cs index 5ad573c28d..448496421b 100644 --- a/Projectiles/Rogue/EquanimityDarkShard.cs +++ b/Projectiles/Rogue/EquanimityDarkShard.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -14,31 +15,31 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 14; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 0; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.timeLeft = 120; - projectile.Calamity().rogue = true; + Projectile.width = 12; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 0; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.timeLeft = 120; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.velocity.Y += 0.1f; - projectile.rotation += 0.4f * projectile.direction; - if (projectile.timeLeft < 130) + Projectile.velocity.Y += 0.1f; + Projectile.rotation += 0.4f * Projectile.direction; + if (Projectile.timeLeft < 130) { float minDist = 999f; int index = 0; for (int i = 0; i < Main.npc.Length; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < minDist) { minDist = dist; @@ -50,26 +51,26 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocityNew; if (minDist < 999f) { - velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew = Main.npc[index].Center - Projectile.Center; velocityNew.Normalize(); - projectile.velocity += velocityNew; - if (projectile.velocity.Length() > 10f) + Projectile.velocity += velocityNew; + if (Projectile.velocity.Length() > 10f) { - projectile.velocity.Normalize(); - projectile.velocity *= 10f; + Projectile.velocity.Normalize(); + Projectile.velocity *= 10f; } } } - if (projectile.timeLeft < 51) + if (Projectile.timeLeft < 51) { - projectile.alpha += 5; + Projectile.alpha += 5; } } public override bool? CanHitNPC(NPC target) { - if (projectile.timeLeft < 130) + if (Projectile.timeLeft < 130) { return null; } @@ -81,9 +82,9 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return true; } } diff --git a/Projectiles/Rogue/EquanimityLightShard.cs b/Projectiles/Rogue/EquanimityLightShard.cs index 8bd6302beb..b8a0a37c40 100644 --- a/Projectiles/Rogue/EquanimityLightShard.cs +++ b/Projectiles/Rogue/EquanimityLightShard.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -14,31 +15,31 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 14; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 0; - projectile.penetrate = 3; - projectile.tileCollide = true; - projectile.timeLeft = 120; - projectile.Calamity().rogue = true; + Projectile.width = 12; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 0; + Projectile.penetrate = 3; + Projectile.tileCollide = true; + Projectile.timeLeft = 120; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.velocity.Y += 0.1f; - projectile.rotation += 0.4f * projectile.direction; + Projectile.velocity.Y += 0.1f; + Projectile.rotation += 0.4f * Projectile.direction; - if (projectile.timeLeft < 51) + if (Projectile.timeLeft < 51) { - projectile.alpha += 5; + Projectile.alpha += 5; } } public override bool? CanHitNPC(NPC target) { - if (projectile.timeLeft < 130) + if (Projectile.timeLeft < 130) { return null; } @@ -50,9 +51,9 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return true; } } diff --git a/Projectiles/Rogue/EquanimityProj.cs b/Projectiles/Rogue/EquanimityProj.cs index 10629ad8c3..59f1e5266f 100644 --- a/Projectiles/Rogue/EquanimityProj.cs +++ b/Projectiles/Rogue/EquanimityProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,32 +16,32 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Equanimity"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 36; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.Calamity().rogue = true; + Projectile.width = 28; + Projectile.height = 36; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.Calamity().rogue = true; } public override void AI() { - if ((Main.player[projectile.owner].position - projectile.position).Length() > 600f) + if ((Main.player[Projectile.owner].position - Projectile.position).Length() > 600f) { recall = true; - projectile.tileCollide = false; + Projectile.tileCollide = false; } - projectile.rotation += 0.4f * projectile.direction; + Projectile.rotation += 0.4f * Projectile.direction; if (recall) { @@ -49,23 +50,23 @@ namespace CalamityMod.Projectiles.Rogue Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); shardVelocity.Normalize(); shardVelocity *= 5f; - Projectile.NewProjectile(projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.15f), 0f, projectile.owner); - if (projectile.Calamity().stealthStrike) + Projectile.NewProjectile(Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.15f), 0f, Projectile.owner); + if (Projectile.Calamity().stealthStrike) { - Projectile.NewProjectile(projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.15f), 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.15f), 0f, Projectile.owner); } } - Vector2 posDiff = Main.player[projectile.owner].position - projectile.position; + Vector2 posDiff = Main.player[Projectile.owner].position - Projectile.position; if (posDiff.Length() > 30f) { posDiff.Normalize(); - projectile.velocity = posDiff * 30f; + Projectile.velocity = posDiff * 30f; } else { - projectile.timeLeft = 0; - Kill(projectile.timeLeft); + Projectile.timeLeft = 0; + Kill(Projectile.timeLeft); } return; } @@ -83,10 +84,10 @@ namespace CalamityMod.Projectiles.Rogue Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); shardVelocity.Normalize(); shardVelocity *= 5f; - Projectile.NewProjectile(projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.1f), 0f, projectile.owner); - if (projectile.Calamity().stealthStrike) + Projectile.NewProjectile(Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 0f, Projectile.owner); + if (Projectile.Calamity().stealthStrike) { - Projectile.NewProjectile(projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.1f), 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 0f, Projectile.owner); } } } @@ -104,10 +105,10 @@ namespace CalamityMod.Projectiles.Rogue Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); shardVelocity.Normalize(); shardVelocity *= 5f; - Projectile.NewProjectile(projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.1f), 0f, projectile.owner); - if (projectile.Calamity().stealthStrike) + Projectile.NewProjectile(Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 0f, Projectile.owner); + if (Projectile.Calamity().stealthStrike) { - Projectile.NewProjectile(projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.1f), 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 0f, Projectile.owner); } } } @@ -115,7 +116,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 3); return false; } @@ -125,10 +126,10 @@ namespace CalamityMod.Projectiles.Rogue { return false; } - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); recall = true; - projectile.tileCollide = false; + Projectile.tileCollide = false; return false; } } diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index 4a1dfaaca5..7633131903 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -22,22 +22,22 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Eradicator"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = projectile.height = 58; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.MaxUpdates = 2; - projectile.timeLeft = Lifetime; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 18; - projectile.Calamity().rogue = true; + Projectile.width = Projectile.height = 58; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = Lifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 18; + Projectile.Calamity().rogue = true; } public override void AI() @@ -47,84 +47,84 @@ namespace CalamityMod.Projectiles.Rogue // // On the frame the disc begins returning, send a net update. - if (projectile.timeLeft == Lifetime - ReboundTime) - projectile.netUpdate = true; + if (Projectile.timeLeft == Lifetime - ReboundTime) + Projectile.netUpdate = true; // The disc runs its returning AI if it has existed longer than ReboundTime frames. - if (projectile.timeLeft <= Lifetime - ReboundTime) + if (Projectile.timeLeft <= Lifetime - ReboundTime) { float returnSpeed = Eradicator.Speed * 1.3f; float acceleration = 0.25f; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; // Delete the disc if it's excessively far away. Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); dist = returnSpeed / dist; xDist *= dist; yDist *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) + if (Projectile.velocity.X < xDist) { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X = Projectile.velocity.X + acceleration; + if (Projectile.velocity.X < 0f && xDist > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > xDist) + else if (Projectile.velocity.X > xDist) { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X = Projectile.velocity.X - acceleration; + if (Projectile.velocity.X > 0f && xDist < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < yDist) + if (Projectile.velocity.Y < yDist) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; + if (Projectile.velocity.Y < 0f && yDist > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > yDist) + else if (Projectile.velocity.Y > yDist) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; + if (Projectile.velocity.Y > 0f && yDist < 0f) + Projectile.velocity.Y -= acceleration; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); } // Lighting. - Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.25f); + Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0.25f); // Rotate the disc as it flies. - float spin = projectile.direction <= 0 ? -1f : 1f; - projectile.rotation += spin * RotationIncrement; + float spin = Projectile.direction <= 0 ? -1f : 1f; + Projectile.rotation += spin * RotationIncrement; // If attached to something (this only occurs for stealth strikes), do the buzzsaw grind and spam lasers everywhere. - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) StealthStrikeGrind(spin); else { // Fire lasers at up to 2 nearby targets every 8 frames for 40% damage. // Stealth strike lasers have an intentionally lower ratio of 12%. - double laserDamageRatio = projectile.Calamity().stealthStrike ? 0.12D : 0.4D; - float laserFrames = projectile.MaxUpdates * 8f; - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, laserFrames, 2, ModContent.ProjectileType(), laserDamageRatio, true); + double laserDamageRatio = Projectile.Calamity().stealthStrike ? 0.12D : 0.4D; + float laserFrames = Projectile.MaxUpdates * 8f; + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 6f, laserFrames, 2, ModContent.ProjectileType(), laserDamageRatio, true); } } private void StealthStrikeGrind(float spinDir) { // Spin extra fast to visually shred the enemy. - projectile.rotation += spinDir * RotationIncrement * 0.8f; + Projectile.rotation += spinDir * RotationIncrement * 0.8f; // Randomly fire lasers while grinding. Each laser only does 12% damage. randomLaserCharge += Main.rand.NextFloat(0.09f, 0.14f); @@ -133,8 +133,8 @@ namespace CalamityMod.Projectiles.Rogue randomLaserCharge -= 1f; Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int laserDamage = (int)(projectile.damage * 0.12D); - Projectile laser = Projectile.NewProjectileDirect(projectile.Center, velocity, ModContent.ProjectileType(), laserDamage, 0f, projectile.owner); + int laserDamage = (int)(Projectile.damage * 0.12D); + Projectile laser = Projectile.NewProjectileDirect(Projectile.Center, velocity, ModContent.ProjectileType(), laserDamage, 0f, Projectile.owner); if (laser.whoAmI.WithinBounds(Main.maxProjectiles)) { laser.Calamity().forceRogue = true; @@ -148,21 +148,21 @@ namespace CalamityMod.Projectiles.Rogue } // Stay stuck to the target. - projectile.StickyProjAI(6, true); + Projectile.StickyProjAI(6, true); // If still attached to a target, do nothing. - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) return; // If the target died, look for a new one. const float turnSpeed = 30f; const float speedMult = 5f; const float homingRange = 600f; - NPC uDie = projectile.Center.ClosestNPCAt(homingRange, true, true); + NPC uDie = Projectile.Center.ClosestNPCAt(homingRange, true, true); if (uDie != null) { - Vector2 distNorm = (uDie.Center - projectile.Center).SafeNormalize(Vector2.UnitX); - projectile.velocity = (projectile.velocity * (turnSpeed - 1f) + distNorm * speedMult) / turnSpeed; + Vector2 distNorm = (uDie.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + Projectile.velocity = (Projectile.velocity * (turnSpeed - 1f) + distNorm * speedMult) / turnSpeed; } } @@ -184,32 +184,32 @@ namespace CalamityMod.Projectiles.Rogue private void OnHit() { // Non-stealth strikes do nothing special on hit. - if (!projectile.Calamity().stealthStrike) + if (!Projectile.Calamity().stealthStrike) return; // On the first frame of impact, slow down massively so it'll effectively stay stuck to an enemy. - if (projectile.ai[0] == 0f && projectile.ai[1] == 0f) + if (Projectile.ai[0] == 0f && Projectile.ai[1] == 0f) { - projectile.velocity *= 0.1f; + Projectile.velocity *= 0.1f; // Provide a fixed amount of grind time so that DPS can't vary wildly. - projectile.timeLeft = 90; + Projectile.timeLeft = 90; } // Apply sticky AI. - projectile.ModifyHitNPCSticky(3, true); + Projectile.ModifyHitNPCSticky(3, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Vector2 origin = new Vector2(31f, 29f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/EradicatorGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/EradicatorGlow"), Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); } } } diff --git a/Projectiles/Rogue/ExecutionersBladeProj.cs b/Projectiles/Rogue/ExecutionersBladeProj.cs index 90aefc3a5f..937fda2960 100644 --- a/Projectiles/Rogue/ExecutionersBladeProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeProj.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -13,12 +14,12 @@ namespace CalamityMod.Projectiles.Rogue private void handleStealth(Vector2 position) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Main.PlaySound(SoundID.Item73, projectile.Center); + SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); for (int i = 0; i < 20; i++) { - Projectile.NewProjectile(new Vector2(position.X + (-600 + i * 60), position.Y - 800), new Vector2(0f, 2.5f), ModContent.ProjectileType(), (int)(projectile.damage * 1.2f), projectile.knockBack, projectile.owner); + Projectile.NewProjectile(new Vector2(position.X + (-600 + i * 60), position.Y - 800), new Vector2(0f, 2.5f), ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), Projectile.knockBack, Projectile.owner); } } } @@ -26,44 +27,44 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 64; - projectile.height = 64; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 240; + Projectile.width = 64; + Projectile.height = 64; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 2; + Projectile.timeLeft = 240; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0f, 0.65f); + Lighting.AddLight(Projectile.Center, 0.5f, 0f, 0.65f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 250f, 12f, 20f); } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Vector2 origin = new Vector2(32f, 32f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ExecutionersBladeGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/ExecutionersBladeGlow"), Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { handleStealth(target.Center); } @@ -72,7 +73,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { handleStealth(target.Center); } @@ -80,11 +81,11 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 128); - Main.PlaySound(SoundID.Item74, (int)projectile.position.X, (int)projectile.position.Y); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 128); + SoundEngine.PlaySound(SoundID.Item74, (int)Projectile.position.X, (int)Projectile.position.Y); for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -94,17 +95,17 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/ExecutionersBladeStealthProj.cs b/Projectiles/Rogue/ExecutionersBladeStealthProj.cs index 2d7f36af76..4c221eeca2 100644 --- a/Projectiles/Rogue/ExecutionersBladeStealthProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeStealthProj.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -14,34 +15,34 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 64; - projectile.height = 64; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 200; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 1; + Projectile.width = 64; + Projectile.height = 64; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 200; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 1; } public override void AI() { - if (projectile.timeLeft >= 150 && projectile.FinalExtraUpdate()) - projectile.velocity.Y *= 1.3f; - projectile.rotation += 0.5f * (float)projectile.direction; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + if (Projectile.timeLeft >= 150 && Projectile.FinalExtraUpdate()) + Projectile.velocity.Y *= 1.3f; + Projectile.rotation += 0.5f * (float)Projectile.direction; + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Vector2 origin = new Vector2(32f, 32f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ExecutionersBladeGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/ExecutionersBladeGlow"), Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -56,11 +57,11 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 128); - Main.PlaySound(SoundID.Item74, (int)projectile.position.X, (int)projectile.position.Y); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 128); + SoundEngine.PlaySound(SoundID.Item74, (int)Projectile.position.X, (int)Projectile.position.Y); for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -70,17 +71,17 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index 6acf91c60d..5bcfa3b5fe 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -17,40 +18,40 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 0; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 1; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 0; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 1; } public override void AI() { - projectile.velocity.Y += 0.1f; - projectile.rotation += 0.05f * projectile.direction; + Projectile.velocity.Y += 0.1f; + Projectile.rotation += 0.05f * Projectile.direction; // Damage Scaling - if (projectile.velocity.Y > 0 && projectile.ai[0] < 2f) + if (Projectile.velocity.Y > 0 && Projectile.ai[0] < 2f) { - projectile.ai[0] += 0.015f; + Projectile.ai[0] += 0.015f; } - if (projectile.ai[0] > 2f) + if (Projectile.ai[0] > 2f) { - projectile.ai[0] = 2f; + Projectile.ai[0] = 2f; } - projectile.damage = (int)(projectile.ai[1] * projectile.ai[0]); + Projectile.damage = (int)(Projectile.ai[1] * Projectile.ai[0]); // Dust Effects - Vector2 dustLeft = (new Vector2(-1, 0)).RotatedBy(projectile.rotation); - Vector2 dustRight = (new Vector2(1, 0)).RotatedBy(projectile.rotation); - Vector2 dustUp = (new Vector2(0, -1)).RotatedBy(projectile.rotation); - Vector2 dustDown = (new Vector2(0, 1) * 2f).RotatedBy(projectile.rotation); + Vector2 dustLeft = (new Vector2(-1, 0)).RotatedBy(Projectile.rotation); + Vector2 dustRight = (new Vector2(1, 0)).RotatedBy(Projectile.rotation); + Vector2 dustUp = (new Vector2(0, -1)).RotatedBy(Projectile.rotation); + Vector2 dustDown = (new Vector2(0, 1) * 2f).RotatedBy(Projectile.rotation); float minSpeed = 1.5f; float maxSpeed = 5f; @@ -58,68 +59,68 @@ namespace CalamityMod.Projectiles.Rogue float maxScale = 1.4f; int dustType = 175; - int dustCount = (int)(5 * (projectile.ai[0] - 1f)); + int dustCount = (int)(5 * (Projectile.ai[0] - 1f)); for (int i = 0; i < dustCount; i++) { - int left = Dust.NewDust(projectile.Center, 1, 1, dustType, 0f, 0f); + int left = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); Main.dust[left].noGravity = true; - Main.dust[left].position = projectile.Center; - Main.dust[left].velocity = dustLeft * Main.rand.NextFloat(minSpeed, maxSpeed) + projectile.velocity; + Main.dust[left].position = Projectile.Center; + Main.dust[left].velocity = dustLeft * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; Main.dust[left].scale = Main.rand.NextFloat(minScale, maxScale); - int right = Dust.NewDust(projectile.Center, 1, 1, dustType, 0f, 0f); + int right = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); Main.dust[right].noGravity = true; - Main.dust[right].position = projectile.Center; - Main.dust[right].velocity = dustRight * Main.rand.NextFloat(minSpeed, maxSpeed) + projectile.velocity; + Main.dust[right].position = Projectile.Center; + Main.dust[right].velocity = dustRight * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; Main.dust[right].scale = Main.rand.NextFloat(minScale, maxScale); - int up = Dust.NewDust(projectile.Center, 1, 1, dustType, 0f, 0f); + int up = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); Main.dust[up].noGravity = true; - Main.dust[up].position = projectile.Center; - Main.dust[up].velocity = dustUp * Main.rand.NextFloat(minSpeed, maxSpeed) + projectile.velocity; + Main.dust[up].position = Projectile.Center; + Main.dust[up].velocity = dustUp * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; Main.dust[up].scale = Main.rand.NextFloat(minScale, maxScale); - int down = Dust.NewDust(projectile.Center, 1, 1, dustType, 0f, 0f); + int down = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); Main.dust[down].noGravity = true; - Main.dust[down].position = projectile.Center; - Main.dust[down].velocity = dustDown * Main.rand.NextFloat(minSpeed, maxSpeed) + projectile.velocity; + Main.dust[down].position = Projectile.Center; + Main.dust[down].velocity = dustDown * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; Main.dust[down].scale = Main.rand.NextFloat(minScale, maxScale); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.Center); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + Projectile.Kill(); return true; } public override void Kill(int timeLeft) { //Crystal smash sound - Main.PlaySound(SoundID.Item27, projectile.Center); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); // Light burst - int p = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.8f), 0, projectile.owner, projectile.ai[0] - 1f, 0); - Main.projectile[p].rotation = projectile.rotation; + int p = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0, Projectile.owner, Projectile.ai[0] - 1f, 0); + Main.projectile[p].rotation = Projectile.rotation; // Stars - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { int numStars = Main.rand.Next(4, 7); for (int i = 0; i < numStars; i++) { - Vector2 pos = new Vector2(projectile.Center.X + (float)projectile.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); - float speedX = (projectile.Center.X - pos.X) / 20f; - float speedY = (projectile.Center.Y - pos.Y) / 20f; - Projectile.NewProjectile(pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType(), projectile.damage / 2, 3, projectile.owner, Main.rand.NextFloat(-3f, 3f), 0f); + Vector2 pos = new Vector2(Projectile.Center.X + (float)Projectile.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + float speedX = (Projectile.Center.X - pos.X) / 20f; + float speedY = (Projectile.Center.Y - pos.Y) / 20f; + Projectile.NewProjectile(pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType(), Projectile.damage / 2, 3, Projectile.owner, Main.rand.NextFloat(-3f, 3f), 0f); } } } diff --git a/Projectiles/Rogue/ExorcismShockwave.cs b/Projectiles/Rogue/ExorcismShockwave.cs index 03f724a5b7..c4b0e476d2 100644 --- a/Projectiles/Rogue/ExorcismShockwave.cs +++ b/Projectiles/Rogue/ExorcismShockwave.cs @@ -17,26 +17,26 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = (int)radius * 2; - projectile.height = (int)radius * 2; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 9; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = (int)radius * 2; + Projectile.height = (int)radius * 2; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 9; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.timeLeft >= 5) + if (Projectile.timeLeft >= 5) { - projectile.alpha = (int)((1 - projectile.ai[0]) * 255f); + Projectile.alpha = (int)((1 - Projectile.ai[0]) * 255f); // Blast wave should be brighter the higher the charge of the projectile when it is killed - int numDust = (int)(40 * projectile.ai[0]) + 10; + int numDust = (int)(40 * Projectile.ai[0]) + 10; for (int i = 0; i < numDust; i++) { @@ -61,24 +61,24 @@ namespace CalamityMod.Projectiles.Rogue circleVelocity.Normalize(); circleVelocity *= radius / 10f; - int circle = Dust.NewDust(projectile.Center, 1, 1, dustType, circleVelocity.X, circleVelocity.Y, 0, default, 1.5f); + int circle = Dust.NewDust(Projectile.Center, 1, 1, dustType, circleVelocity.X, circleVelocity.Y, 0, default, 1.5f); Main.dust[circle].noGravity = true; } // Cross - Vector2 dustLeft = (new Vector2(-1, 0)).RotatedBy(projectile.rotation); - Vector2 dustRight = (new Vector2(1, 0)).RotatedBy(projectile.rotation); - Vector2 dustUp = (new Vector2(0, -1)).RotatedBy(projectile.rotation); - Vector2 dustDown = (new Vector2(0, 1) * 2f).RotatedBy(projectile.rotation); + Vector2 dustLeft = (new Vector2(-1, 0)).RotatedBy(Projectile.rotation); + Vector2 dustRight = (new Vector2(1, 0)).RotatedBy(Projectile.rotation); + Vector2 dustUp = (new Vector2(0, -1)).RotatedBy(Projectile.rotation); + Vector2 dustDown = (new Vector2(0, 1) * 2f).RotatedBy(Projectile.rotation); int dustScale = 7; - Vector2 dustPos = projectile.Center - new Vector2((dustScale - 1) * 0.5f, (dustScale - 1) * 0.5f); + Vector2 dustPos = Projectile.Center - new Vector2((dustScale - 1) * 0.5f, (dustScale - 1) * 0.5f); float minSpeed = 0f; float maxSpeed = 5f; float minScale = 1.9f; float maxScale = 2.1f; - int dustCount = (int)(5 * projectile.ai[0]); + int dustCount = (int)(5 * Projectile.ai[0]); for (int i = 0; i < dustCount; i++) { @@ -123,10 +123,10 @@ namespace CalamityMod.Projectiles.Rogue public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - float dist1 = Vector2.Distance(projectile.Center, target.Hitbox.TopLeft()); - float dist2 = Vector2.Distance(projectile.Center, target.Hitbox.TopRight()); - float dist3 = Vector2.Distance(projectile.Center, target.Hitbox.BottomLeft()); - float dist4 = Vector2.Distance(projectile.Center, target.Hitbox.BottomRight()); + float dist1 = Vector2.Distance(Projectile.Center, target.Hitbox.TopLeft()); + float dist2 = Vector2.Distance(Projectile.Center, target.Hitbox.TopRight()); + float dist3 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomLeft()); + float dist4 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomRight()); float damageScale = dist1; if (dist2 < damageScale) @@ -141,6 +141,6 @@ namespace CalamityMod.Projectiles.Rogue damage = (int)(damage * damageScale); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); } } diff --git a/Projectiles/Rogue/ExorcismStar.cs b/Projectiles/Rogue/ExorcismStar.cs index e3ff35b421..472c01f393 100644 --- a/Projectiles/Rogue/ExorcismStar.cs +++ b/Projectiles/Rogue/ExorcismStar.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,35 +17,35 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation += projectile.ai[0]; - if (projectile.soundDelay == 0) + Projectile.rotation += Projectile.ai[0]; + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, new Color(255, 255, 255, 128), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, new Color(255, 255, 255, 128), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Rogue/ExplosiveSun.cs b/Projectiles/Rogue/ExplosiveSun.cs index 18e0a6e938..c55ff98f13 100644 --- a/Projectiles/Rogue/ExplosiveSun.cs +++ b/Projectiles/Rogue/ExplosiveSun.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,39 +17,39 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; + Projectile.width = 22; + Projectile.height = 22; //projectile.aiStyle = 115; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.light = 0.5f; - projectile.alpha = 50; - projectile.scale = 1.2f; - projectile.timeLeft = 60; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.light = 0.5f; + Projectile.alpha = 50; + Projectile.scale = 1.2f; + Projectile.timeLeft = 60; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; + Projectile.velocity.X *= 0.985f; + Projectile.velocity.Y *= 0.985f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { //Changes the texture of the projectile - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/ExplosiveSun2"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, texture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Rogue/ExplosiveSun2"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/ExplosiveSun3"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, texture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Rogue/ExplosiveSun3"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } return true; @@ -66,23 +67,23 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 192; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 192; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); if (Main.rand.NextBool(3)) { - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14, 0.5f); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 14, 0.5f); } for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -92,10 +93,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Rogue/FantasyTalismanProj.cs b/Projectiles/Rogue/FantasyTalismanProj.cs index 692fc8642c..afc9e99025 100644 --- a/Projectiles/Rogue/FantasyTalismanProj.cs +++ b/Projectiles/Rogue/FantasyTalismanProj.cs @@ -11,42 +11,42 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Talisman"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 175, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 175, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.StickyProjAI(4); - if (projectile.ai[0] == 1f) + Projectile.StickyProjAI(4); + if (Projectile.ai[0] == 1f) { - if (projectile.timeLeft % 10 == 0) + if (Projectile.timeLeft % 10 == 0) { if (Main.rand.NextBool(2)) { - int spiritDamage = projectile.damage / 2; - Projectile ghost = CalamityGlobalProjectile.SpawnOrb(projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); + int spiritDamage = Projectile.damage / 2; + Projectile ghost = CalamityGlobalProjectile.SpawnOrb(Projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) { ghost.Calamity().forceRogue = true; @@ -59,13 +59,13 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(3, true); + Projectile.ModifyHitNPCSticky(3, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Rogue/FantasyTalismanStealth.cs b/Projectiles/Rogue/FantasyTalismanStealth.cs index b81fcd9a69..28a5af61f5 100644 --- a/Projectiles/Rogue/FantasyTalismanStealth.cs +++ b/Projectiles/Rogue/FantasyTalismanStealth.cs @@ -13,55 +13,55 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Talisman"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 175, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 175, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - if (projectile.ai[0] != 1f) + if (Projectile.ai[0] != 1f) { - if (projectile.timeLeft % 10 == 0) + if (Projectile.timeLeft % 10 == 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { // Use a tiny velocity to ensure that rotation works correctly. // The speed should be so low that it will make no meaningful mechanical difference. - Vector2 soulVelocity = projectile.velocity.SafeNormalize(Vector2.Zero) * 0.0001f; - Projectile.NewProjectile(projectile.Center, soulVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Vector2 soulVelocity = Projectile.velocity.SafeNormalize(Vector2.Zero) * 0.0001f; + Projectile.NewProjectile(Projectile.Center, soulVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } - projectile.StickyProjAI(4); - if (projectile.ai[0] == 1f) + Projectile.StickyProjAI(4); + if (Projectile.ai[0] == 1f) { - if (projectile.timeLeft % 4 == 0) + if (Projectile.timeLeft % 4 == 0) { if (Main.rand.NextBool(2)) { - int spiritDamage = projectile.damage / 2; - Projectile ghost = CalamityGlobalProjectile.SpawnOrb(projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); + int spiritDamage = Projectile.damage / 2; + Projectile ghost = CalamityGlobalProjectile.SpawnOrb(Projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) { ghost.Calamity().forceRogue = true; @@ -74,13 +74,13 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(1, true); + Projectile.ModifyHitNPCSticky(1, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Rogue/FeatherKnifeProjectile.cs b/Projectiles/Rogue/FeatherKnifeProjectile.cs index 3aed80bce2..6a68987c6c 100644 --- a/Projectiles/Rogue/FeatherKnifeProjectile.cs +++ b/Projectiles/Rogue/FeatherKnifeProjectile.cs @@ -18,29 +18,29 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.aiStyle = 2; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.aiStyle = 2; + Projectile.timeLeft = 600; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void AI() { - if (projectile.timeLeft % 35 == 0) + if (Projectile.timeLeft % 35 == 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(projectile.position, new Vector2(projectile.velocity.X / 20, 2), ModContent.ProjectileType(), (int)(projectile.damage * 0.4), projectile.knockBack, projectile.owner); + int proj = Projectile.NewProjectile(Projectile.position, new Vector2(Projectile.velocity.X / 20, 2), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceRogue = true; } @@ -49,15 +49,15 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - int proj = Projectile.NewProjectile(projectile.position, new Vector2(projectile.velocity.X / 20, 2), ModContent.ProjectileType(), (int)(projectile.damage * 0.69), projectile.knockBack, projectile.owner); + int proj = Projectile.NewProjectile(Projectile.position, new Vector2(Projectile.velocity.X / 20, 2), ModContent.ProjectileType(), (int)(Projectile.damage * 0.69), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceRogue = true; } public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2) && !projectile.noDropItem) - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + if (Main.rand.NextBool(2) && !Projectile.noDropItem) + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } } diff --git a/Projectiles/Rogue/FinalDawnFireSlash.cs b/Projectiles/Rogue/FinalDawnFireSlash.cs index 6a2972d386..0693072f57 100644 --- a/Projectiles/Rogue/FinalDawnFireSlash.cs +++ b/Projectiles/Rogue/FinalDawnFireSlash.cs @@ -5,6 +5,7 @@ using Terraria.ModLoader; using Microsoft.Xna.Framework.Graphics; using CalamityMod.CalPlayer; using CalamityMod.Buffs.DamageOverTime; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,67 +16,67 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("The Final Dawn"); - Main.projFrames[projectile.type] = 11; + Main.projFrames[Projectile.type] = 11; } public override void SetDefaults() { - projectile.width = 300; - projectile.height = 398; - projectile.friendly = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.ownerHitCheck = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 300; + Projectile.height = 398; + Projectile.friendly = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.ownerHitCheck = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player is null || player.dead) - projectile.Kill(); + Projectile.Kill(); - player.direction = projectile.direction; - player.heldProj = projectile.whoAmI; + player.direction = Projectile.direction; + player.heldProj = Projectile.whoAmI; AdjustPlayerPositionValues(player); - projectile.ai[0]++; - if(projectile.ai[0] >= 4) + Projectile.ai[0]++; + if(Projectile.ai[0] >= 4) { - projectile.ai[1]++; - projectile.ai[0] = 0; - if (projectile.ai[1] == 5) + Projectile.ai[1]++; + Projectile.ai[0] = 0; + if (Projectile.ai[1] == 5) { - projectile.friendly = true; - Main.PlaySound(SoundID.Item71, projectile.Center); + Projectile.friendly = true; + SoundEngine.PlaySound(SoundID.Item71, Projectile.Center); } } - if (projectile.ai[1] >= 11) + if (Projectile.ai[1] >= 11) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.frame = (int)projectile.ai[1]; + Projectile.frame = (int)Projectile.ai[1]; AdjustPlayerItemFrameValues(player); } public void AdjustPlayerPositionValues(Player player) { - projectile.Center = player.Center; - projectile.position.X += 60 * player.direction; - projectile.position.Y -= 30; + Projectile.Center = player.Center; + Projectile.position.X += 60 * player.direction; + Projectile.position.Y -= 30; } public void AdjustPlayerItemFrameValues(Player player) { - if (projectile.ai[1] < 5) + if (Projectile.ai[1] < 5) { player.bodyFrame.Y = player.bodyFrame.Height; } - else if (projectile.ai[1] < 8) + else if (Projectile.ai[1] < 8) { player.bodyFrame.Y = 3 * player.bodyFrame.Height; } @@ -84,12 +85,12 @@ namespace CalamityMod.Projectiles.Rogue player.bodyFrame.Y = 4 * player.bodyFrame.Height; } - projectile.spriteDirection = player.direction; - player.heldProj = projectile.whoAmI; + Projectile.spriteDirection = player.direction; + player.heldProj = Projectile.whoAmI; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - CalamityPlayer calamityPlayer = Main.player[projectile.owner].Calamity(); + CalamityPlayer calamityPlayer = Main.player[Projectile.owner].Calamity(); // Restore stealth if (!HasRegeneratedStealth) { @@ -105,29 +106,29 @@ namespace CalamityMod.Projectiles.Rogue int width = 918 / 3; int height = 1990 / 5; - Vector2 drawCenter = projectile.Center; - Rectangle frameRectangle = new Rectangle(projectile.frame / 5 * width, projectile.frame % 5 * height, width, height); + Vector2 drawCenter = Projectile.Center; + Rectangle frameRectangle = new Rectangle(Projectile.frame / 5 * width, Projectile.frame % 5 * height, width, height); - Texture2D scytheTexture = Main.projectileTexture[projectile.type]; - Texture2D glowTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnFireSlash_Glow"); + Texture2D scytheTexture = Main.projectileTexture[Projectile.type]; + Texture2D glowTexture = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnFireSlash_Glow"); Main.spriteBatch.Draw(scytheTexture, drawCenter - Main.screenPosition, frameRectangle, - projectile.GetAlpha(lightColor), - projectile.rotation, + Projectile.GetAlpha(lightColor), + Projectile.rotation, frameRectangle.Size() / 2, - projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); Main.spriteBatch.Draw(glowTexture, drawCenter - Main.screenPosition, frameRectangle, - projectile.GetAlpha(Color.White), - projectile.rotation, + Projectile.GetAlpha(Color.White), + Projectile.rotation, frameRectangle.Size() / 2, - projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); return false; } diff --git a/Projectiles/Rogue/FinalDawnFireball.cs b/Projectiles/Rogue/FinalDawnFireball.cs index 71782b6b52..bf64bb7e23 100644 --- a/Projectiles/Rogue/FinalDawnFireball.cs +++ b/Projectiles/Rogue/FinalDawnFireball.cs @@ -14,70 +14,70 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("The Final Dawn"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 36; - projectile.height = 80; - projectile.Calamity().rogue = true; - projectile.penetrate = 1; - projectile.hostile = false; - projectile.friendly = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.alpha = 50; - projectile.timeLeft = 180; + Projectile.width = 36; + Projectile.height = 80; + Projectile.Calamity().rogue = true; + Projectile.penetrate = 1; + Projectile.hostile = false; + Projectile.friendly = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 50; + Projectile.timeLeft = 180; } public override void AI() { - NPC chargeAt = Main.npc[(int)projectile.ai[1]]; + NPC chargeAt = Main.npc[(int)Projectile.ai[1]]; if(!chargeAt.active) - projectile.Kill(); + Projectile.Kill(); - int idx = Dust.NewDust(projectile.position, projectile.width , projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.0f); - Main.dust[idx].velocity = projectile.velocity * 0.5f; + int idx = Dust.NewDust(Projectile.position, Projectile.width , Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.0f); + Main.dust[idx].velocity = Projectile.velocity * 0.5f; Main.dust[idx].noGravity = true; Main.dust[idx].noLight = true; - projectile.ai[0]++; - if (projectile.ai[0] >= 20) + Projectile.ai[0]++; + if (Projectile.ai[0] >= 20) { - projectile.friendly = true; - NPC npc = Main.npc[(int)projectile.ai[1]]; - Vector2 desiredVelocity = projectile.SafeDirectionTo(npc.Center) * DesiredSpeed; - projectile.velocity = Vector2.Lerp(projectile.velocity, desiredVelocity, 1f / InterpolationTime); + Projectile.friendly = true; + NPC npc = Main.npc[(int)Projectile.ai[1]]; + Vector2 desiredVelocity = Projectile.SafeDirectionTo(npc.Center) * DesiredSpeed; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, desiredVelocity, 1f / InterpolationTime); if(!npc.active) - projectile.Kill(); + Projectile.Kill(); } - projectile.frameCounter++; - if (projectile.frameCounter >= 5) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 5) { - projectile.frame++; - projectile.frameCounter = 0; - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + Projectile.frame++; + Projectile.frameCounter = 0; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; } } public override void Kill(int timeLeft) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D glowmask = Main.projectileTexture[projectile.type]; - int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int yStart = height * projectile.frame; + Texture2D glowmask = Main.projectileTexture[Projectile.type]; + int height = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int yStart = height * Projectile.frame; Main.spriteBatch.Draw(glowmask, - projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), + Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle?(new Rectangle(0, yStart, glowmask.Width, height)), - projectile.GetAlpha(Color.White), projectile.rotation, - new Vector2(glowmask.Width / 2f, height / 2f), projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.GetAlpha(Color.White), Projectile.rotation, + new Vector2(glowmask.Width / 2f, height / 2f), Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); return false; } diff --git a/Projectiles/Rogue/FinalDawnFlame.cs b/Projectiles/Rogue/FinalDawnFlame.cs index e5e22fd216..18c69b4853 100644 --- a/Projectiles/Rogue/FinalDawnFlame.cs +++ b/Projectiles/Rogue/FinalDawnFlame.cs @@ -27,27 +27,27 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("The Final Dawn"); - Main.projFrames[projectile.type] = 8; + Main.projFrames[Projectile.type] = 8; } public override void SetDefaults() { - projectile.scale = 1f; - projectile.width = 1000; - projectile.height = 100; - projectile.penetrate = -1; - projectile.hostile = false; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.alpha = 255; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.scale = 1f; + Projectile.width = 1000; + Projectile.height = 100; + Projectile.penetrate = -1; + Projectile.hostile = false; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.alpha = 255; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; Flames = new Flame[TotalFlames]; for (int i = 0; i < Flames.Length; i++) { - Vector2 flamePosition = Main.rand.NextVector2Circular(projectile.width * 0.36f, projectile.height / 2); + Vector2 flamePosition = Main.rand.NextVector2Circular(Projectile.width * 0.36f, Projectile.height / 2); Flames[i].Position = flamePosition; Flames[i].Frame = Main.rand.Next(8); @@ -59,8 +59,8 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; if (Flames.Length > 0) @@ -69,10 +69,10 @@ namespace CalamityMod.Projectiles.Rogue { int frameHeight2 = frameHeight * Flames[i].Frame; spriteBatch.Draw(texture, - projectile.Center + Flames[i].Position - Main.screenPosition, + Projectile.Center + Flames[i].Position - Main.screenPosition, new Rectangle?(new Rectangle(0, frameHeight2, texture.Width, frameHeight)), - projectile.GetAlpha(Color.White) * Flames[i].Alpha, - projectile.rotation, + Projectile.GetAlpha(Color.White) * Flames[i].Alpha, + Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Flames[i].Scale, Flames[i].Direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, @@ -104,10 +104,10 @@ namespace CalamityMod.Projectiles.Rogue if (flame.Frame >= 8) { - if (projectile.ai[0] < 570) + if (Projectile.ai[0] < 570) { - Vector2 pos = new Vector2(Main.rand.NextFloat(projectile.width * 0.36f)).RotatedByRandom(MathHelper.TwoPi); - float widthHeightRatio = (float)projectile.height / projectile.width; + Vector2 pos = new Vector2(Main.rand.NextFloat(Projectile.width * 0.36f)).RotatedByRandom(MathHelper.TwoPi); + float widthHeightRatio = (float)Projectile.height / Projectile.width; pos.Y *= widthHeightRatio; flame.Position = pos; @@ -124,24 +124,24 @@ namespace CalamityMod.Projectiles.Rogue } public void AlphaAdjustments() { - projectile.ai[0]++; - if (projectile.ai[0] < 570) + Projectile.ai[0]++; + if (Projectile.ai[0] < 570) { - projectile.alpha -= 10; - if (projectile.alpha < 0) projectile.alpha = 0; + Projectile.alpha -= 10; + if (Projectile.alpha < 0) Projectile.alpha = 0; } else { - projectile.friendly = false; - projectile.alpha += 5; - if (projectile.alpha > 255) + Projectile.friendly = false; + Projectile.alpha += 5; + if (Projectile.alpha > 255) { - projectile.alpha = 255; + Projectile.alpha = 255; } } - if (projectile.ai[0] >= 600 && projectile.alpha >= 255) + if (Projectile.ai[0] >= 600 && Projectile.alpha >= 255) { - projectile.Kill(); + Projectile.Kill(); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs index 3e164c77ca..167c4cab62 100644 --- a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs +++ b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs @@ -4,6 +4,7 @@ using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework.Graphics; using CalamityMod.Buffs.DamageOverTime; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -12,83 +13,83 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("The Final Dawn"); - Main.projFrames[projectile.type] = 9; + Main.projFrames[Projectile.type] = 9; } public override void SetDefaults() { - projectile.width = 600; - projectile.height = 156; - projectile.friendly = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.ownerHitCheck = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 600; + Projectile.height = 156; + Projectile.friendly = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.ownerHitCheck = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player is null || player.dead) - projectile.Kill(); + Projectile.Kill(); - projectile.Center = player.Center; - player.heldProj = projectile.whoAmI; - projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + Projectile.Center = player.Center; + player.heldProj = Projectile.whoAmI; + Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); - projectile.ai[0]++; - if (projectile.ai[0] >= 4) + Projectile.ai[0]++; + if (Projectile.ai[0] >= 4) { - projectile.ai[1]++; - projectile.ai[0] = 0; - if (projectile.ai[1] == 3) + Projectile.ai[1]++; + Projectile.ai[0] = 0; + if (Projectile.ai[1] == 3) { - projectile.friendly = true; - Main.PlaySound(SoundID.Item71, projectile.position); + Projectile.friendly = true; + SoundEngine.PlaySound(SoundID.Item71, Projectile.position); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner); } } } - if (projectile.ai[1] >= 9) + if (Projectile.ai[1] >= 9) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.frame = (int)projectile.ai[1]; + Projectile.frame = (int)Projectile.ai[1]; - if (projectile.ai[1] < 2) player.bodyFrame.Y = 1 * player.bodyFrame.Height; + if (Projectile.ai[1] < 2) player.bodyFrame.Y = 1 * player.bodyFrame.Height; else player.bodyFrame.Y = 3 * player.bodyFrame.Height; - if (projectile.ai[1] == 4 || projectile.ai[1] == 5) player.direction = -1 * projectile.spriteDirection; - else player.direction = 1 * projectile.spriteDirection; + if (Projectile.ai[1] == 4 || Projectile.ai[1] == 5) player.direction = -1 * Projectile.spriteDirection; + else player.direction = 1 * Projectile.spriteDirection; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D scytheTexture = Main.projectileTexture[projectile.type]; - Texture2D scytheGlowTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnHorizontalSlash_Glow"); - int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int yStart = height * projectile.frame; + Texture2D scytheTexture = Main.projectileTexture[Projectile.type]; + Texture2D scytheGlowTexture = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnHorizontalSlash_Glow"); + int height = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int yStart = height * Projectile.frame; Main.spriteBatch.Draw(scytheTexture, - projectile.Center - Main.screenPosition + projectile.gfxOffY * Vector2.UnitY, + Projectile.Center - Main.screenPosition + Projectile.gfxOffY * Vector2.UnitY, new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), - projectile.GetAlpha(lightColor), projectile.rotation, - new Vector2((float)scytheTexture.Width / 2f, (float)height / 2f), projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.GetAlpha(lightColor), Projectile.rotation, + new Vector2((float)scytheTexture.Width / 2f, (float)height / 2f), Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); Main.spriteBatch.Draw(scytheGlowTexture, - projectile.Center - Main.screenPosition + projectile.gfxOffY * Vector2.UnitY, + Projectile.Center - Main.screenPosition + Projectile.gfxOffY * Vector2.UnitY, new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), - projectile.GetAlpha(Color.White), - projectile.rotation, + Projectile.GetAlpha(Color.White), + Projectile.rotation, new Vector2((float)scytheTexture.Width / 2f, (float)height / 2f), - projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); return false; } diff --git a/Projectiles/Rogue/FinalDawnProjectile.cs b/Projectiles/Rogue/FinalDawnProjectile.cs index 4277fea088..085a093aa8 100644 --- a/Projectiles/Rogue/FinalDawnProjectile.cs +++ b/Projectiles/Rogue/FinalDawnProjectile.cs @@ -13,44 +13,44 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("The Final Dawn"); - Main.projFrames[projectile.type] = 2; + Main.projFrames[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = false; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.tileCollide = false; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = false; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; //projectile.extraUpdates = 2; } public override bool ShouldUpdatePosition() => false; public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player is null || player.dead) - projectile.Kill(); + Projectile.Kill(); if (Main.myPlayer == player.whoAmI) { - projectile.velocity = Main.MouseWorld - player.Center; - projectile.velocity.Normalize(); + Projectile.velocity = Main.MouseWorld - player.Center; + Projectile.velocity.Normalize(); } - player.direction = projectile.direction; - player.heldProj = projectile.whoAmI; - projectile.Center = player.Center; - projectile.position.Y -= 44; - projectile.position.X -= 46 * player.direction; + player.direction = Projectile.direction; + player.heldProj = Projectile.whoAmI; + Projectile.Center = player.Center; + Projectile.position.Y -= 44; + Projectile.position.X -= 46 * player.direction; player.bodyFrame.Y = player.bodyFrame.Height; - if (projectile.ai[0] < MaxChargeTime) + if (Projectile.ai[0] < MaxChargeTime) { // Charging dust - Vector2 dustCenter = new Vector2(projectile.Center.X, projectile.Center.Y - 40); - int flame = Dust.NewDust(dustCenter, projectile.width, projectile.height, ModContent.DustType(), 0, 0, 100, default, 2f); + Vector2 dustCenter = new Vector2(Projectile.Center.X, Projectile.Center.Y - 40); + int flame = Dust.NewDust(dustCenter, Projectile.width, Projectile.height, ModContent.DustType(), 0, 0, 100, default, 2f); Main.dust[flame].noGravity = true; Main.dust[flame].fadeIn = 1.5f; Main.dust[flame].scale = 1.4f; @@ -59,31 +59,31 @@ namespace CalamityMod.Projectiles.Rogue Vector2 newVelocity = dustCenter - Main.dust[flame].position; Main.dust[flame].velocity = newVelocity * 0.1f; } - if (projectile.ai[0] == MaxChargeTime) + if (Projectile.ai[0] == MaxChargeTime) { int dustCount = 36; for (int i = 0; i < dustCount; i++) { - Vector2 startingPosition = projectile.Center + new Vector2(0, -40); - Vector2 offset = Vector2.UnitX * projectile.width * 0.1875f; + Vector2 startingPosition = Projectile.Center + new Vector2(0, -40); + Vector2 offset = Vector2.UnitX * Projectile.width * 0.1875f; offset = offset.RotatedBy((i - (dustCount / 2 - 1)) * MathHelper.TwoPi / dustCount); int dustIdx = Dust.NewDust(startingPosition + offset, 0, 0, ModContent.DustType(), offset.X * 2f, offset.Y * 2f, 100, default, 3.4f); Main.dust[dustIdx].noGravity = true; Main.dust[dustIdx].noLight = true; Main.dust[dustIdx].velocity = Vector2.Normalize(offset) * 5f; } - projectile.frame = 1; + Projectile.frame = 1; } - projectile.ai[0]++; + Projectile.ai[0]++; - projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { if (!player.channel || player.noItems || player.CCed) { AttemptExecuteAttacks(player); - projectile.Kill(); + Projectile.Kill(); } } } @@ -91,30 +91,30 @@ namespace CalamityMod.Projectiles.Rogue public void AttemptExecuteAttacks(Player player) { //projectile.ai[1] == 1f if spawned via Venerated Locket - if (projectile.ai[0] >= MaxChargeTime && !player.noItems && !player.CCed) + if (Projectile.ai[0] >= MaxChargeTime && !player.noItems && !player.CCed) { // Far range attack if (player.controlUp) { // Stealth Strike - if (player.Calamity().StealthStrikeAvailable() && projectile.ai[1] != 1f) + if (player.Calamity().StealthStrikeAvailable() && Projectile.ai[1] != 1f) { int stealth = Projectile.NewProjectile(player.Center, player.SafeDirectionTo(Main.MouseWorld) * 38f, ModContent.ProjectileType(), - (int)(projectile.damage * 1.05f), - projectile.knockBack, - projectile.owner); + (int)(Projectile.damage * 1.05f), + Projectile.knockBack, + Projectile.owner); Main.projectile[stealth].Calamity().stealthStrike = true; player.Calamity().ConsumeStealthByAttacking(); } else { - Projectile.NewProjectile(projectile.Center, - projectile.SafeDirectionTo(Main.MouseWorld) * 38f, - ModContent.ProjectileType(), projectile.damage, - projectile.knockBack, projectile.owner); - if (projectile.ai[1] != 1f) + Projectile.NewProjectile(Projectile.Center, + Projectile.SafeDirectionTo(Main.MouseWorld) * 38f, + ModContent.ProjectileType(), Projectile.damage, + Projectile.knockBack, Projectile.owner); + if (Projectile.ai[1] != 1f) player.Calamity().ConsumeStealthByAttacking(); } } @@ -122,26 +122,26 @@ namespace CalamityMod.Projectiles.Rogue else { // Stealth - if (player.Calamity().StealthStrikeAvailable() && projectile.ai[1] != 1f) + if (player.Calamity().StealthStrikeAvailable() && Projectile.ai[1] != 1f) { - int stealth = Projectile.NewProjectile(projectile.Center, - projectile.velocity, + int stealth = Projectile.NewProjectile(Projectile.Center, + Projectile.velocity, ModContent.ProjectileType(), - (int)(projectile.damage * 1.275f), - projectile.knockBack, - projectile.owner); + (int)(Projectile.damage * 1.275f), + Projectile.knockBack, + Projectile.owner); Main.projectile[stealth].Calamity().stealthStrike = true; player.Calamity().ConsumeStealthByAttacking(); } else { //This one doesn't consume stealth since it replenishes stealth on hits - Projectile.NewProjectile(projectile.Center, - projectile.velocity, + Projectile.NewProjectile(Projectile.Center, + Projectile.velocity, ModContent.ProjectileType(), - projectile.damage, - projectile.knockBack, - projectile.owner); + Projectile.damage, + Projectile.knockBack, + Projectile.owner); } } } @@ -151,27 +151,27 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D scytheTexture = Main.projectileTexture[projectile.type]; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnProjectile_Glow"); - int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int yStart = height * projectile.frame; + Texture2D scytheTexture = Main.projectileTexture[Projectile.type]; + Texture2D glowmask = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnProjectile_Glow"); + int height = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int yStart = height * Projectile.frame; Main.spriteBatch.Draw(scytheTexture, - projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), - projectile.GetAlpha(lightColor), - projectile.rotation, + Projectile.GetAlpha(lightColor), + Projectile.rotation, new Vector2(scytheTexture.Width / 2f, height / 2f), - projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); Main.spriteBatch.Draw(glowmask, - projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), - projectile.GetAlpha(Color.White), - projectile.rotation, + Projectile.GetAlpha(Color.White), + Projectile.rotation, new Vector2(scytheTexture.Width / 2f, height / 2f), - projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); return false; } diff --git a/Projectiles/Rogue/FinalDawnReticle.cs b/Projectiles/Rogue/FinalDawnReticle.cs index b73788a903..2ac89ea327 100644 --- a/Projectiles/Rogue/FinalDawnReticle.cs +++ b/Projectiles/Rogue/FinalDawnReticle.cs @@ -14,66 +14,66 @@ namespace CalamityMod.Projectiles.Rogue } public override void SetDefaults() { - projectile.scale = 1.5f; - projectile.width = 120; - projectile.height = 120; - projectile.penetrate = -1; - projectile.hostile = false; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.alpha = 0; + Projectile.scale = 1.5f; + Projectile.width = 120; + Projectile.height = 120; + Projectile.penetrate = -1; + Projectile.hostile = false; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.alpha = 0; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (projectile.ai[1] == 0) - projectile.ai[1] = 1; - if (projectile.ai[0] == 0) + if (Projectile.ai[1] == 0) + Projectile.ai[1] = 1; + if (Projectile.ai[0] == 0) { int dustCount = 36; for (int i = 0; i < dustCount; i++) { - Vector2 startingPosition = projectile.Center + 10f * Vector2.UnitX; - Vector2 offset = Vector2.UnitX * projectile.width * 0.1875f; + Vector2 startingPosition = Projectile.Center + 10f * Vector2.UnitX; + Vector2 offset = Vector2.UnitX * Projectile.width * 0.1875f; offset = offset.RotatedBy((i - (dustCount / 2 - 1)) * MathHelper.TwoPi / 20f); int dustIdx = Dust.NewDust(startingPosition + offset, 0, 0, ModContent.DustType(), offset.X * 2f, offset.Y * 2f, 100, default, 3.4f); Main.dust[dustIdx].noGravity = true; Main.dust[dustIdx].noLight = true; Main.dust[dustIdx].velocity = Vector2.Normalize(offset) * 5f; } - projectile.ai[0] = 1; + Projectile.ai[0] = 1; } - projectile.alpha += 8; - projectile.scale *= 0.98f; - projectile.ai[1] *= 1.01f; - if(projectile.alpha >= 255) - projectile.Kill(); + Projectile.alpha += 8; + Projectile.scale *= 0.98f; + Projectile.ai[1] *= 1.01f; + if(Projectile.alpha >= 255) + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D ring = Main.projectileTexture[projectile.type]; - Texture2D symbol = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnReticleSymbol"); + Texture2D ring = Main.projectileTexture[Projectile.type]; + Texture2D symbol = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnReticleSymbol"); spriteBatch.Draw(symbol, - projectile.Center - Main.screenPosition, + Projectile.Center - Main.screenPosition, null, - projectile.GetAlpha(Color.White), - projectile.rotation, + Projectile.GetAlpha(Color.White), + Projectile.rotation, new Vector2(symbol.Width / 2, symbol.Height / 2), - projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); spriteBatch.Draw(ring, - projectile.Center - Main.screenPosition, + Projectile.Center - Main.screenPosition, null, - projectile.GetAlpha(Color.White), - projectile.rotation, + Projectile.GetAlpha(Color.White), + Projectile.rotation, new Vector2(ring.Width / 2, ring.Height / 2), - projectile.ai[1], - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.ai[1], + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); return false; } diff --git a/Projectiles/Rogue/FinalDawnThrow.cs b/Projectiles/Rogue/FinalDawnThrow.cs index 96c24de412..c3d05737ff 100644 --- a/Projectiles/Rogue/FinalDawnThrow.cs +++ b/Projectiles/Rogue/FinalDawnThrow.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,80 +16,80 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("The Final Dawn"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 80; - projectile.height = 80; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.light = 0.0f; - projectile.extraUpdates = 2; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 80; + Projectile.height = 80; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.light = 0.0f; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player is null || player.dead) - projectile.Kill(); + Projectile.Kill(); - if (projectile.localAI[0] == 0) + if (Projectile.localAI[0] == 0) { - Main.PlaySound(SoundID.Item71, projectile.Center); - projectile.localAI[0] = 1; + SoundEngine.PlaySound(SoundID.Item71, Projectile.Center); + Projectile.localAI[0] = 1; } - projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation += 0.25f * projectile.direction; + Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation += 0.25f * Projectile.direction; - projectile.ai[0]++; - if (projectile.ai[0] >= 30) + Projectile.ai[0]++; + if (Projectile.ai[0] >= 30) { - Vector2 desiredVelocity = projectile.SafeDirectionTo(player.Center) * DesiredSpeed; - projectile.velocity = Vector2.Lerp(projectile.velocity, desiredVelocity, 1f / InterpolationTime); + Vector2 desiredVelocity = Projectile.SafeDirectionTo(player.Center) * DesiredSpeed; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, desiredVelocity, 1f / InterpolationTime); - float distance = projectile.Distance(player.Center); + float distance = Projectile.Distance(player.Center); if (distance < 64) - projectile.Kill(); + Projectile.Kill(); } - int idx = Dust.NewDust(projectile.position, projectile.width , projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width , Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); Main.dust[idx].velocity *= 0.5f; - Main.dust[idx].velocity += projectile.velocity * 0.5f; + Main.dust[idx].velocity += Projectile.velocity * 0.5f; Main.dust[idx].noGravity = true; Main.dust[idx].noLight = false; Main.dust[idx].scale = 1.0f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D scytheTexture = Main.projectileTexture[projectile.type]; - Texture2D scytheGlowTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnThrow_Glow"); - int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int yStart = height * projectile.frame; + Texture2D scytheTexture = Main.projectileTexture[Projectile.type]; + Texture2D scytheGlowTexture = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnThrow_Glow"); + int height = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int yStart = height * Projectile.frame; Main.spriteBatch.Draw(scytheTexture, - projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), - projectile.GetAlpha(lightColor), - projectile.rotation, + Projectile.GetAlpha(lightColor), + Projectile.rotation, new Vector2(scytheTexture.Width / 2f, height / 2f), - projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); Main.spriteBatch.Draw(scytheGlowTexture, - projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), - projectile.GetAlpha(Color.White), - projectile.rotation, + Projectile.GetAlpha(Color.White), + Projectile.rotation, new Vector2(scytheTexture.Width / 2f, height / 2f), - projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); return false; } diff --git a/Projectiles/Rogue/FinalDawnThrow2.cs b/Projectiles/Rogue/FinalDawnThrow2.cs index 674b72d802..b510d60421 100644 --- a/Projectiles/Rogue/FinalDawnThrow2.cs +++ b/Projectiles/Rogue/FinalDawnThrow2.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -13,22 +14,22 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("The Final Dawn"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 200; - projectile.height = 200; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.light = 0.0f; - projectile.extraUpdates = 1; - projectile.tileCollide = true; // We don't want people getting stuck in walls right - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = projectile.MaxUpdates * 13; + Projectile.width = 200; + Projectile.height = 200; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.light = 0.0f; + Projectile.extraUpdates = 1; + Projectile.tileCollide = true; // We don't want people getting stuck in walls right + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 13; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { @@ -40,14 +41,14 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { // Spawn homing flames that chase the HIT enemy only. This is also limited to one burst - if (Main.myPlayer == projectile.owner && !HasHitEnemy) + if (Main.myPlayer == Projectile.owner && !HasHitEnemy) { for (int i = 0; i < 6; i++) { Vector2 velocity = Utils.NextVector2Circular(Main.rand, 7.2f, 7.2f); - Projectile.NewProjectile(projectile.Center, velocity, + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), - (int)(projectile.damage * 0.3), projectile.knockBack, projectile.owner, 0f, + (int)(Projectile.damage * 0.3), Projectile.knockBack, Projectile.owner, 0f, target.whoAmI); } HasHitEnemy = true; @@ -55,15 +56,15 @@ namespace CalamityMod.Projectiles.Rogue } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player is null || player.dead) - projectile.Kill(); + Projectile.Kill(); - if (projectile.localAI[0] == 0) + if (Projectile.localAI[0] == 0) { - Main.PlaySound(SoundID.Item71, projectile.position); - projectile.localAI[0] = 1; + SoundEngine.PlaySound(SoundID.Item71, Projectile.position); + Projectile.localAI[0] = 1; } // Kill any hooks from the projectile owner. @@ -78,13 +79,13 @@ namespace CalamityMod.Projectiles.Rogue proj.Kill(); } - projectile.spriteDirection = projectile.velocity.X > 0 ? 1 : -1; - projectile.rotation += 0.25f * projectile.direction; - player.Center = projectile.Center; + Projectile.spriteDirection = Projectile.velocity.X > 0 ? 1 : -1; + Projectile.rotation += 0.25f * Projectile.direction; + player.Center = Projectile.Center; player.fullRotationOrigin = player.Center - player.position; - player.fullRotation = projectile.rotation; - player.direction = projectile.direction; - player.heldProj = projectile.whoAmI; + player.fullRotation = Projectile.rotation; + player.direction = Projectile.direction; + player.heldProj = Projectile.whoAmI; player.bodyFrame.Y = player.bodyFrame.Height; player.immuneNoBlink = true; player.immuneTime = 4; @@ -92,54 +93,54 @@ namespace CalamityMod.Projectiles.Rogue player.hurtCooldowns[k] = player.immuneTime; // This is to make sure the player doesn't get yeeted out of the world, which crashes the game pretty much all of the time - bool worldEdge = projectile.Center.X < 1000 || projectile.Center.Y < 1000 || projectile.Center.X > Main.maxTilesX * 16 - 1000 || projectile.Center.Y > Main.maxTilesY * 16 - 1000; + bool worldEdge = Projectile.Center.X < 1000 || Projectile.Center.Y < 1000 || Projectile.Center.X > Main.maxTilesX * 16 - 1000 || Projectile.Center.Y > Main.maxTilesY * 16 - 1000; - projectile.ai[0]++; - if(projectile.ai[0] >= 60 || worldEdge) + Projectile.ai[0]++; + if(Projectile.ai[0] >= 60 || worldEdge) { - projectile.Kill(); + Projectile.Kill(); } - int idx = Dust.NewDust(projectile.position, projectile.width , projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 2.5f); - Main.dust[idx].velocity = projectile.velocity * -0.5f; + int idx = Dust.NewDust(Projectile.position, Projectile.width , Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 2.5f); + Main.dust[idx].velocity = Projectile.velocity * -0.5f; Main.dust[idx].noGravity = true; Main.dust[idx].noLight = false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float scytheRotation = player.fullRotation; - Texture2D scytheTexture = Main.projectileTexture[projectile.type]; - Texture2D glowScytheTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnThrow2_Glow"); - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; + Texture2D scytheTexture = Main.projectileTexture[Projectile.type]; + Texture2D glowScytheTexture = ModContent.Request("CalamityMod/Projectiles/Rogue/FinalDawnThrow2_Glow"); + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; Vector2 origin = new Vector2(scytheTexture.Width / 2f + 40f * player.direction, num214 * 1.1f); Main.spriteBatch.Draw(scytheTexture, - player.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + player.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, new Rectangle?(new Rectangle(0, y6, scytheTexture.Width, num214)), - projectile.GetAlpha(lightColor), + Projectile.GetAlpha(lightColor), scytheRotation, origin, - projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); Main.spriteBatch.Draw(glowScytheTexture, - player.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + player.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, new Rectangle?(new Rectangle(0, y6, scytheTexture.Width, num214)), - projectile.GetAlpha(Color.White), + Projectile.GetAlpha(Color.White), scytheRotation, origin, - projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); return false; } public override void Kill(int timeLeft) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.fullRotation = 0; } } diff --git a/Projectiles/Rogue/FlameScytheProjectile.cs b/Projectiles/Rogue/FlameScytheProjectile.cs index 9e4ad4970f..88bcc1c71d 100644 --- a/Projectiles/Rogue/FlameScytheProjectile.cs +++ b/Projectiles/Rogue/FlameScytheProjectile.cs @@ -4,7 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.Projectiles.Rogue { @@ -19,44 +19,44 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.alpha = 55; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 3; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 600; + Projectile.alpha = 55; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.25f, 0.15f, 0f); + Lighting.AddLight(Projectile.Center, 0.25f, 0.15f, 0f); if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.NextBool(3) ? 16 : 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - Vector2 goreVec = new Vector2(projectile.position.X + projectile.width / 2 + projectile.velocity.X, projectile.position.Y + projectile.height / 2 + projectile.velocity.Y); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 127, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Vector2 goreVec = new Vector2(Projectile.position.X + Projectile.width / 2 + Projectile.velocity.X, Projectile.position.Y + Projectile.height / 2 + Projectile.velocity.Y); if (Main.rand.NextBool(8)) { int smoke = Gore.NewGore(goreVec, default, Main.rand.Next(375, 378), 0.75f); Main.gore[smoke].behindTiles = true; } - if (projectile.localAI[0] > 0f) - projectile.localAI[0]--; + if (Projectile.localAI[0] > 0f) + Projectile.localAI[0]--; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[Projectile.owner] = 6; target.AddBuff(BuffID.OnFire, 240); OnHitEffects(target.Center); } @@ -69,18 +69,18 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects(Vector2 position) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceRogue = true; - if (projectile.Calamity().stealthStrike && projectile.localAI[0] <= 0f) + if (Projectile.Calamity().stealthStrike && Projectile.localAI[0] <= 0f) { Point result; - if (WorldUtils.Find(projectile.Top.ToTileCoordinates(), Searches.Chain((GenSearch)new Searches.Down(80), (GenCondition)new Conditions.IsSolid()), out result)) + if (WorldUtils.Find(Projectile.Top.ToTileCoordinates(), Searches.Chain((GenSearch)new Searches.Down(80), (GenCondition)new Conditions.IsSolid()), out result)) { - Projectile.NewProjectile(result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 1.5f), 2f, projectile.owner, 1f); - projectile.localAI[0] = 30f; + Projectile.NewProjectile(result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 2f, Projectile.owner, 1f); + Projectile.localAI[0] = 30f; } } } diff --git a/Projectiles/Rogue/Fork.cs b/Projectiles/Rogue/Fork.cs index 6d33bbc15f..a13eac4af8 100644 --- a/Projectiles/Rogue/Fork.cs +++ b/Projectiles/Rogue/Fork.cs @@ -11,44 +11,44 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Fork"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 113; + Projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 1; } public override void AI() { if (Main.rand.Next(5) == 0) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; target.AddBuff(ModContent.BuffType(), 180); player.AddBuff(BuffID.WellFed, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; target.AddBuff(BuffID.Bleeding, 300); target.AddBuff(ModContent.BuffType(), 180); player.AddBuff(BuffID.WellFed, 180); @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/FossilShardThrown.cs b/Projectiles/Rogue/FossilShardThrown.cs index b02e34420c..797fb3b097 100644 --- a/Projectiles/Rogue/FossilShardThrown.cs +++ b/Projectiles/Rogue/FossilShardThrown.cs @@ -15,20 +15,20 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.timeLeft = 90; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 1; + Projectile.timeLeft = 90; aiType = ProjectileID.WoodenArrowFriendly; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation += projectile.velocity.Y; - projectile.velocity.Y *= 1.05f; + Projectile.rotation += Projectile.velocity.Y; + Projectile.velocity.Y *= 1.05f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 32, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/FrostShardFriendly.cs b/Projectiles/Rogue/FrostShardFriendly.cs index 91fd036264..36cb7c2d4e 100644 --- a/Projectiles/Rogue/FrostShardFriendly.cs +++ b/Projectiles/Rogue/FrostShardFriendly.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -9,69 +10,69 @@ namespace CalamityMod.Projectiles.Rogue { public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.aiStyle = 1; - projectile.coldDamage = true; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.Calamity().rogue = true; - projectile.coldDamage = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.aiStyle = 1; + Projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.Calamity().rogue = true; + Projectile.coldDamage = true; } public override void SetStaticDefaults() { DisplayName.SetDefault("Frost Shard"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frameCounter = 0; - projectile.frame++; + Projectile.frameCounter = 0; + Projectile.frame++; } - if (projectile.frame >= 5) - projectile.frame = 0; + if (Projectile.frame >= 5) + Projectile.frame = 0; - projectile.velocity.Y += 0.2f; - if (projectile.localAI[0] == 0f || projectile.localAI[0] == 2f) + Projectile.velocity.Y += 0.2f; + if (Projectile.localAI[0] == 0f || Projectile.localAI[0] == 2f) { - projectile.scale += 0.01f; - projectile.alpha -= 50; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 50; + if (Projectile.alpha <= 0) { - projectile.localAI[0] = 1f; - projectile.alpha = 0; + Projectile.localAI[0] = 1f; + Projectile.alpha = 0; } } - else if (projectile.localAI[0] == 1.0) + else if (Projectile.localAI[0] == 1.0) { - projectile.scale -= 0.01f; - projectile.alpha += 50; - if (projectile.alpha >= byte.MaxValue) + Projectile.scale -= 0.01f; + Projectile.alpha += 50; + if (Projectile.alpha >= byte.MaxValue) { - projectile.localAI[0] = 2f; - projectile.alpha = byte.MaxValue; + Projectile.localAI[0] = 2f; + Projectile.alpha = byte.MaxValue; } } } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override void Kill(int timeLeft) { - if (projectile.ai[0] != 1f || Main.rand.NextBool(20)) - Main.PlaySound(SoundID.Item27, projectile.position); + if (Projectile.ai[0] != 1f || Main.rand.NextBool(20)) + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int index1 = 0; index1 < 3; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 76); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 76); Main.dust[index2].noGravity = true; Main.dust[index2].noLight = true; Main.dust[index2].scale = 0.7f; diff --git a/Projectiles/Rogue/FrostyFlareProj.cs b/Projectiles/Rogue/FrostyFlareProj.cs index fe2ec03a04..c3030239b5 100644 --- a/Projectiles/Rogue/FrostyFlareProj.cs +++ b/Projectiles/Rogue/FrostyFlareProj.cs @@ -12,13 +12,13 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.coldDamage = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void SetStaticDefaults() @@ -28,45 +28,45 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (projectile.owner != Main.myPlayer) + if (Projectile.owner != Main.myPlayer) return; bool shoot = false; - if (projectile.timeLeft % 30f == 0f) + if (Projectile.timeLeft % 30f == 0f) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) shoot = true; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.velocity.X *= 0.99f; - projectile.velocity.Y += 0.25f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity.X *= 0.99f; + Projectile.velocity.Y += 0.25f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (shoot) { Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); - Vector2 pos = projectile.Center - vel; + Vector2 pos = Projectile.Center - vel; vel.X += Main.rand.Next(-50, 51); vel.Normalize(); vel *= 30f; - int shard = Projectile.NewProjectile(pos, vel + projectile.velocity / 4f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[shard].alpha = projectile.alpha; + int shard = Projectile.NewProjectile(pos, vel + Projectile.velocity / 4f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Main.projectile[shard].alpha = Projectile.alpha; } - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172); Main.dust[index2].noGravity = true; } else { - projectile.ignoreWater = true; - projectile.tileCollide = false; - int id = (int)projectile.ai[1]; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + int id = (int)Projectile.ai[1]; if (id >= 0 && id < Main.maxNPCs && Main.npc[id].active && !Main.npc[id].dontTakeDamage) { - projectile.Center = Main.npc[id].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[id].gfxOffY; + Projectile.Center = Main.npc[id].Center - Projectile.velocity * 2f; + Projectile.gfxOffY = Main.npc[id].gfxOffY; if (shoot) { @@ -75,13 +75,13 @@ namespace CalamityMod.Projectiles.Rogue vel.X += Main.rand.Next(-50, 51); vel.Normalize(); vel *= 30f; - int shard = Projectile.NewProjectile(pos, vel + Main.npc[id].velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[shard].alpha = projectile.alpha; + int shard = Projectile.NewProjectile(pos, vel + Main.npc[id].velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Main.projectile[shard].alpha = Projectile.alpha; } } else { - projectile.Kill(); + Projectile.Kill(); } } } @@ -90,12 +90,12 @@ namespace CalamityMod.Projectiles.Rogue { target.AddBuff(BuffID.Frostburn, 180); target.AddBuff(ModContent.BuffType(), 30); - target.immune[projectile.owner] = 0; - projectile.ai[0] = 1f; - projectile.ai[1] = target.whoAmI; - projectile.velocity = target.Center - projectile.Center; - projectile.velocity *= 0.75f; - projectile.netUpdate = true; + target.immune[Projectile.owner] = 0; + Projectile.ai[0] = 1f; + Projectile.ai[1] = target.whoAmI; + Projectile.velocity = target.Center - Projectile.Center; + Projectile.velocity *= 0.75f; + Projectile.netUpdate = true; const int maxFlares = 5; int flaresFound = 0; @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Rogue int oldestFlareTimeLeft = 300; for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == projectile.type && i != projectile.whoAmI && Main.projectile[i].ai[1] == target.whoAmI) + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == Projectile.type && i != Projectile.whoAmI && Main.projectile[i].ai[1] == target.whoAmI) { flaresFound++; if (Main.projectile[i].timeLeft < oldestFlareTimeLeft) @@ -127,6 +127,6 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 30); } - public override bool CanDamage() => projectile.ai[0] == 0f; + public override bool CanDamage() => Projectile.ai[0] == 0f; } } diff --git a/Projectiles/Rogue/FrostyFlareStealth.cs b/Projectiles/Rogue/FrostyFlareStealth.cs index 30ef3bbc1e..e4d6864a4a 100644 --- a/Projectiles/Rogue/FrostyFlareStealth.cs +++ b/Projectiles/Rogue/FrostyFlareStealth.cs @@ -12,13 +12,13 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.coldDamage = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void SetStaticDefaults() @@ -28,35 +28,35 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (projectile.owner != Main.myPlayer) + if (Projectile.owner != Main.myPlayer) return; bool shoot = false; - if (projectile.timeLeft % 30f == 0f) + if (Projectile.timeLeft % 30f == 0f) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) shoot = true; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.velocity.X *= 0.99f; - projectile.velocity.Y += 0.25f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity.X *= 0.99f; + Projectile.velocity.Y += 0.25f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (shoot) { Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); - Vector2 pos = projectile.Center - vel; + Vector2 pos = Projectile.Center - vel; vel.X += Main.rand.Next(-50, 51); vel.Normalize(); vel *= 30f; - int flare = Projectile.NewProjectile(pos, vel + projectile.velocity / 4f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + int flare = Projectile.NewProjectile(pos, vel + Projectile.velocity / 4f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); Main.projectile[flare].alpha = 150; } - if (projectile.timeLeft % 10 == 0) + if (Projectile.timeLeft % 10 == 0) { - int snowflake = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, ProjectileID.NorthPoleSnowflake, (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, Main.rand.Next(3)); + int snowflake = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0f, Projectile.velocity.Y * 0f, ProjectileID.NorthPoleSnowflake, (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, Main.rand.Next(3)); if (snowflake.WithinBounds(Main.maxProjectiles)) { Main.projectile[snowflake].Calamity().forceRogue = true; @@ -64,18 +64,18 @@ namespace CalamityMod.Projectiles.Rogue } } - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172); Main.dust[index2].noGravity = true; } else { - projectile.ignoreWater = true; - projectile.tileCollide = false; - int id = (int)projectile.ai[1]; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + int id = (int)Projectile.ai[1]; if (id.WithinBounds(Main.maxNPCs) && Main.npc[id].active && !Main.npc[id].dontTakeDamage) { - projectile.Center = Main.npc[id].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[id].gfxOffY; + Projectile.Center = Main.npc[id].Center - Projectile.velocity * 2f; + Projectile.gfxOffY = Main.npc[id].gfxOffY; if (shoot) { @@ -84,13 +84,13 @@ namespace CalamityMod.Projectiles.Rogue vel.X += Main.rand.Next(-50, 51); vel.Normalize(); vel *= 30f; - int flare = Projectile.NewProjectile(pos, vel + Main.npc[id].velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + int flare = Projectile.NewProjectile(pos, vel + Main.npc[id].velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); Main.projectile[flare].alpha = 150; } } else { - projectile.Kill(); + Projectile.Kill(); } } } @@ -99,12 +99,12 @@ namespace CalamityMod.Projectiles.Rogue { target.AddBuff(BuffID.Frostburn, 180); target.AddBuff(ModContent.BuffType(), 30); - target.immune[projectile.owner] = 0; - projectile.ai[0] = 1f; - projectile.ai[1] = target.whoAmI; - projectile.velocity = target.Center - projectile.Center; - projectile.velocity *= 0.75f; - projectile.netUpdate = true; + target.immune[Projectile.owner] = 0; + Projectile.ai[0] = 1f; + Projectile.ai[1] = target.whoAmI; + Projectile.velocity = target.Center - Projectile.Center; + Projectile.velocity *= 0.75f; + Projectile.netUpdate = true; const int maxFlares = 1; int flaresFound = 0; @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Rogue int oldestFlareTimeLeft = 300; for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == projectile.type && i != projectile.whoAmI && Main.projectile[i].ai[1] == target.whoAmI) + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == Projectile.type && i != Projectile.whoAmI && Main.projectile[i].ai[1] == target.whoAmI) { flaresFound++; if (Main.projectile[i].timeLeft < oldestFlareTimeLeft) @@ -136,6 +136,6 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 30); } - public override bool CanDamage() => projectile.ai[0] == 0f; + public override bool CanDamage() => Projectile.ai[0] == 0f; } } diff --git a/Projectiles/Rogue/GacruxianHome.cs b/Projectiles/Rogue/GacruxianHome.cs index 8c9e1e9aa7..203f6e7136 100644 --- a/Projectiles/Rogue/GacruxianHome.cs +++ b/Projectiles/Rogue/GacruxianHome.cs @@ -18,39 +18,39 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 18; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.penetrate = 3; - projectile.timeLeft = 120; - projectile.ignoreWater = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.aiStyle = 18; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 120; + Projectile.ignoreWater = true; aiType = ProjectileID.DeathSickle; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; } public override void AI() { if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - if (projectile.timeLeft % 30 == 0 && projectile.owner == Main.myPlayer) + if (Projectile.timeLeft % 30 == 0 && Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner); + int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceRogue = true; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 250f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 250f, 12f, 20f); } public override void Kill(int timeLeft) { for (int i = 0; i <= 10; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/GacruxianProj.cs b/Projectiles/Rogue/GacruxianProj.cs index 2414c07299..17a6b8792c 100644 --- a/Projectiles/Rogue/GacruxianProj.cs +++ b/Projectiles/Rogue/GacruxianProj.cs @@ -18,32 +18,32 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 113; + Projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - if (projectile.timeLeft % 15 == 0) + if (Projectile.timeLeft % 15 == 0) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), Projectile.knockBack, Projectile.owner); } else { - int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner); + int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceRogue = true; } @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 10; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/GelDartProjectile.cs b/Projectiles/Rogue/GelDartProjectile.cs index 21cafb3185..0ff415c943 100644 --- a/Projectiles/Rogue/GelDartProjectile.cs +++ b/Projectiles/Rogue/GelDartProjectile.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class GelDartProjectile : ModProjectile @@ -18,25 +19,25 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 4; - projectile.aiStyle = 2; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 4; + Projectile.aiStyle = 2; + Projectile.timeLeft = 600; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.owner == Main.myPlayer && projectile.Calamity().stealthStrike) + if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) { - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - if (projectile.timeLeft % 8 == 0) + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; + if (Projectile.timeLeft % 8 == 0) { Vector2 velocity = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int slime = Projectile.NewProjectile(projectile.Center, velocity, ProjectileID.SlimeGun, (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner); + int slime = Projectile.NewProjectile(Projectile.Center, velocity, ProjectileID.SlimeGun, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); if (slime.WithinBounds(Main.maxProjectiles)) { Main.projectile[slime].Calamity().forceRogue = true; @@ -49,30 +50,30 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - if (projectile.velocity != oldVelocity) + if (Projectile.velocity != oldVelocity) { - projectile.velocity = Main.rand.NextFloat(-1.15f, -0.85f) * oldVelocity * 1.35f; - Main.PlaySound(SoundID.Item56, projectile.position); // Minecart bumper sound + Projectile.velocity = Main.rand.NextFloat(-1.15f, -0.85f) * oldVelocity * 1.35f; + SoundEngine.PlaySound(SoundID.Item56, Projectile.position); // Minecart bumper sound } } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } } @@ -81,8 +82,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -90,21 +91,21 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Slimed, 120); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) target.AddBuff(BuffID.Slow, 120); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Slimed, 120); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) target.AddBuff(BuffID.Slow, 120); } } diff --git a/Projectiles/Rogue/GhoulishGougerBoomerang.cs b/Projectiles/Rogue/GhoulishGougerBoomerang.cs index 5a821088da..7321216354 100644 --- a/Projectiles/Rogue/GhoulishGougerBoomerang.cs +++ b/Projectiles/Rogue/GhoulishGougerBoomerang.cs @@ -15,55 +15,55 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Ghoulish Gouger"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 58; - projectile.height = 58; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 36; - projectile.Calamity().rogue = true; + Projectile.width = 58; + Projectile.height = 58; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 36; + Projectile.Calamity().rogue = true; } public override void AI() { // Boomerang glows pink - Lighting.AddLight(projectile.Center, 0.7f, 0f, 0.15f); + Lighting.AddLight(Projectile.Center, 0.7f, 0f, 0.15f); // Frame 1, pick a direction for the scythe. This direction isn't changed from that point on - if (projectile.ai[0] == 0f) - projectile.spriteDirection = projectile.direction; + if (Projectile.ai[0] == 0f) + Projectile.spriteDirection = Projectile.direction; // Main boomerang logic. projectile.ai[0] is a frame counter. - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; // On the first returning frame, send a net update. - if (projectile.ai[0] == FramesBeforeReturning) - projectile.netUpdate = true; + if (Projectile.ai[0] == FramesBeforeReturning) + Projectile.netUpdate = true; // Once returning, use boomerang return AI. - if (projectile.ai[0] >= FramesBeforeReturning) + if (Projectile.ai[0] >= FramesBeforeReturning) { float returnSpeed = 16f; float acceleration = 1.15f; - Player owner = Main.player[projectile.owner]; - Vector2 delta = owner.Center - projectile.Center; + Player owner = Main.player[Projectile.owner]; + Vector2 delta = owner.Center - Projectile.Center; float dx = delta.X; float dy = delta.Y; // If the boomerang is excessively far away, destroy it. float dist = delta.Length(); if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); // Homing vector math (the boomerang homes in on the player using rather ugly code) dist = returnSpeed / dist; @@ -71,75 +71,75 @@ namespace CalamityMod.Projectiles.Rogue dy *= dist; // X/Y specific boomerang return code. This is what gives them their unique flight path. - if (projectile.velocity.X < dx) + if (Projectile.velocity.X < dx) { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && dx > 0f) + Projectile.velocity.X = Projectile.velocity.X + acceleration; + if (Projectile.velocity.X < 0f && dx > 0f) { - projectile.velocity.X = projectile.velocity.X + acceleration; + Projectile.velocity.X = Projectile.velocity.X + acceleration; } } - else if (projectile.velocity.X > dx) + else if (Projectile.velocity.X > dx) { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && dx < 0f) + Projectile.velocity.X = Projectile.velocity.X - acceleration; + if (Projectile.velocity.X > 0f && dx < 0f) { - projectile.velocity.X = projectile.velocity.X - acceleration; + Projectile.velocity.X = Projectile.velocity.X - acceleration; } } - if (projectile.velocity.Y < dy) + if (Projectile.velocity.Y < dy) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && dy > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; + if (Projectile.velocity.Y < 0f && dy > 0f) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; } } - else if (projectile.velocity.Y > dy) + else if (Projectile.velocity.Y > dy) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && dy < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; + if (Projectile.velocity.Y > 0f && dy < 0f) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; } } // Destroy the boomerang when it returns to the player. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); } // Rotate the scythe as it flies. - float spin = projectile.spriteDirection <= 0 ? -1f : 1f; - projectile.rotation += spin * 0.31f; + float spin = Projectile.spriteDirection <= 0 ? -1f : 1f; + Projectile.rotation += spin * 0.31f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Vector2 origin = new Vector2(37f, 34f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/GhoulishGougerGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/GhoulishGougerGlow"), Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner != Main.myPlayer || !projectile.Calamity().stealthStrike) + if (Projectile.owner != Main.myPlayer || !Projectile.Calamity().stealthStrike) return; // Stealth strike on-hit souls can only happen once. // This prevents https://youtu.be/2vAWZhg1dBE - if (projectile.numHits > 0) + if (Projectile.numHits > 0) return; int numSouls = 8; int projID = ModContent.ProjectileType(); - int soulDamage = projectile.damage; + int soulDamage = Projectile.damage; float soulKB = 0f; float speed = 6f; Vector2 velocity = Main.rand.NextVector2CircularEdge(speed, speed); @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Rogue { // Each soul has randomized player homing strength float ai1 = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(projectile.Center, velocity, projID, soulDamage, soulKB, projectile.owner, 0f, ai1); + Projectile.NewProjectile(Projectile.Center, velocity, projID, soulDamage, soulKB, Projectile.owner, 0f, ai1); // Rotate direction for the next soul velocity = velocity.RotatedBy(MathHelper.TwoPi / numSouls); diff --git a/Projectiles/Rogue/GildedDaggerProj.cs b/Projectiles/Rogue/GildedDaggerProj.cs index 62bde3f9b5..f0bf369e3c 100644 --- a/Projectiles/Rogue/GildedDaggerProj.cs +++ b/Projectiles/Rogue/GildedDaggerProj.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -20,51 +21,51 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; } public override void AI() { if (Main.rand.NextBool(7)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, DustID.GoldCoin, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.GoldCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } if (hasHitEnemy) { - projectile.rotation += projectile.direction * 0.4f; + Projectile.rotation += Projectile.direction * 0.4f; } else { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.PiOver2); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.PiOver2); //Rotating 90 degrees if shooting right - if (projectile.spriteDirection == 1) + if (Projectile.spriteDirection == 1) { - projectile.rotation += MathHelper.ToRadians(90f); + Projectile.rotation += MathHelper.ToRadians(90f); } } - if (!projectile.Calamity().stealthStrike && projectile.timeLeft < 575) + if (!Projectile.Calamity().stealthStrike && Projectile.timeLeft < 575) { - projectile.velocity.Y += 0.5f; - if (projectile.velocity.Y > 16f) + Projectile.velocity.Y += 0.5f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } - else if (projectile.Calamity().stealthStrike && hasHitEnemy) + else if (Projectile.Calamity().stealthStrike && hasHitEnemy) { if (targetNPC >= 0 && Main.npc[targetNPC].active) { - Vector2 newVelocity = Main.npc[targetNPC].Center - projectile.Center; + Vector2 newVelocity = Main.npc[targetNPC].Center - Projectile.Center; newVelocity.Normalize(); newVelocity *= 15f; - projectile.velocity = newVelocity; + Projectile.velocity = newVelocity; } } } @@ -89,9 +90,9 @@ namespace CalamityMod.Projectiles.Rogue { previousNPCs.Add(i); } - if (npc.CanBeChasedBy(projectile, false) && npc != target && !hasHitNPC) + if (npc.CanBeChasedBy(Projectile, false) && npc != target && !hasHitNPC) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < minDist) { minDist = dist; @@ -103,31 +104,31 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocityNew; if (minDist < 999f) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - projectile.damage = (int)(projectile.damage * 1.05f); + Projectile.damage = (int)(Projectile.damage * 1.05f); } hasHitEnemy = true; targetNPC = index; - velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew = Main.npc[index].Center - Projectile.Center; velocityNew.Normalize(); velocityNew *= 15f; - projectile.velocity = velocityNew; + Projectile.velocity = velocityNew; } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -135,7 +136,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 1f; } } diff --git a/Projectiles/Rogue/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index ecfbbd80dd..e46775847c 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -18,115 +19,115 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Glaive"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.tileCollide = true; - projectile.penetrate = 3; - projectile.timeLeft = Lifetime; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.penetrate = 3; + Projectile.timeLeft = Lifetime; drawOffsetX = -10; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { // ai[1] = 1 means that the projectile is a stealth strike, in which case it pierces infinitely. - if (projectile.ai[1] == 1f) - projectile.penetrate = projectile.maxPenetrate = -1; + if (Projectile.ai[1] == 1f) + Projectile.penetrate = Projectile.maxPenetrate = -1; // Boomerang rotation - projectile.rotation += 0.4f * (float)projectile.direction; + Projectile.rotation += 0.4f * (float)Projectile.direction; // Boomerang sound - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } // Returns after some number of frames in the air - if (projectile.timeLeft < Lifetime - ReboundTime) - projectile.ai[0] = 1f; + if (Projectile.timeLeft < Lifetime - ReboundTime) + Projectile.ai[0] = 1f; - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { - projectile.tileCollide = false; + Projectile.tileCollide = false; float returnSpeed = Glaive.Speed * 1.6f; float acceleration = 1.4f; - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { returnSpeed *= Glaive.StealthSpeedMult; acceleration *= Glaive.StealthSpeedMult; } - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; // Delete the projectile if it's excessively far away. Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); dist = returnSpeed / dist; xDist *= dist; yDist *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) + if (Projectile.velocity.X < xDist) { - projectile.velocity.X += acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X += acceleration; + if (Projectile.velocity.X < 0f && xDist > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > xDist) + else if (Projectile.velocity.X > xDist) { - projectile.velocity.X -= acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X -= acceleration; + if (Projectile.velocity.X > 0f && xDist < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < yDist) + if (Projectile.velocity.Y < yDist) { - projectile.velocity.Y += acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y += acceleration; + if (Projectile.velocity.Y < 0f && yDist > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > yDist) + else if (Projectile.velocity.Y > yDist) { - projectile.velocity.Y -= acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y -= acceleration; + if (Projectile.velocity.Y > 0f && yDist < 0f) + Projectile.velocity.Y -= acceleration; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { // After its last hit, starts returning instead of vanishing. Can pierce infinitely on the way back. - if (projectile.penetrate == 1) + if (Projectile.penetrate == 1) { - projectile.penetrate = -1; - projectile.ai[0] = 1f; + Projectile.penetrate = -1; + Projectile.ai[0] = 1f; } } @@ -134,18 +135,18 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { // Impacts the terrain even though it bounces off. - Main.PlaySound(SoundID.Dig, projectile.Center); - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; return false; } } diff --git a/Projectiles/Rogue/GleamingDaggerProj.cs b/Projectiles/Rogue/GleamingDaggerProj.cs index 88de665009..5f8637b4f4 100644 --- a/Projectiles/Rogue/GleamingDaggerProj.cs +++ b/Projectiles/Rogue/GleamingDaggerProj.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -20,51 +21,51 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; } public override void AI() { if (Main.rand.NextBool(7)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, DustID.PlatinumCoin, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PlatinumCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } if (hasHitEnemy) { - projectile.rotation += projectile.direction * 0.4f; + Projectile.rotation += Projectile.direction * 0.4f; } else { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.PiOver2); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.PiOver2); //Rotating 90 degrees if shooting right - if (projectile.spriteDirection == 1) + if (Projectile.spriteDirection == 1) { - projectile.rotation += MathHelper.ToRadians(90f); + Projectile.rotation += MathHelper.ToRadians(90f); } } - if (!projectile.Calamity().stealthStrike && projectile.timeLeft < 575) + if (!Projectile.Calamity().stealthStrike && Projectile.timeLeft < 575) { - projectile.velocity.Y += 0.5f; - if (projectile.velocity.Y > 16f) + Projectile.velocity.Y += 0.5f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } - else if (projectile.Calamity().stealthStrike && hasHitEnemy) + else if (Projectile.Calamity().stealthStrike && hasHitEnemy) { if (targetNPC >= 0 && Main.npc[targetNPC].active) { - Vector2 newVelocity = Main.npc[targetNPC].Center - projectile.Center; + Vector2 newVelocity = Main.npc[targetNPC].Center - Projectile.Center; newVelocity.Normalize(); newVelocity *= 15f; - projectile.velocity = newVelocity; + Projectile.velocity = newVelocity; } } } @@ -89,9 +90,9 @@ namespace CalamityMod.Projectiles.Rogue { previousNPCs.Add(i); } - if (npc.CanBeChasedBy(projectile, false) && npc != target && !hasHitNPC) + if (npc.CanBeChasedBy(Projectile, false) && npc != target && !hasHitNPC) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < minDist) { minDist = dist; @@ -103,31 +104,31 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocityNew; if (minDist < 999f) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - projectile.damage = (int)(projectile.damage * 1.05f); + Projectile.damage = (int)(Projectile.damage * 1.05f); } hasHitEnemy = true; targetNPC = index; - velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew = Main.npc[index].Center - Projectile.Center; velocityNew.Normalize(); velocityNew *= 15f; - projectile.velocity = velocityNew; + Projectile.velocity = velocityNew; } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -135,7 +136,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.PlatinumCoin, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.PlatinumCoin, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 1f; } } diff --git a/Projectiles/Rogue/GodsParanoiaDart.cs b/Projectiles/Rogue/GodsParanoiaDart.cs index ae4fdd426a..9a321b3873 100644 --- a/Projectiles/Rogue/GodsParanoiaDart.cs +++ b/Projectiles/Rogue/GodsParanoiaDart.cs @@ -11,42 +11,42 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Kunai"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.aiStyle = 27; + Projectile.width = 10; + Projectile.height = 10; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; + Projectile.aiStyle = 27; } public override void AI() { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (MathHelper.Pi / 2); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (MathHelper.Pi / 2); - projectile.velocity.X *= 1.025f; - projectile.velocity.Y *= 1.025f; - if (projectile.velocity.X > 12f) + Projectile.velocity.X *= 1.025f; + Projectile.velocity.Y *= 1.025f; + if (Projectile.velocity.X > 12f) { - projectile.velocity.X = 12f; + Projectile.velocity.X = 12f; } - if (projectile.velocity.Y > 12f) + if (Projectile.velocity.Y > 12f) { - projectile.velocity.Y = 12f; + Projectile.velocity.Y = 12f; } if (Main.rand.NextBool(3)) { - Dust flame = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 0, default, 1f); + Dust flame = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 0, default, 1f); flame.velocity *= 0.1f; flame.scale = 1.3f; flame.noGravity = true; @@ -55,19 +55,19 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 192; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.damage /= 2; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 192; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.damage /= 2; + Projectile.Damage(); for (int i = 0; i < 2; i++) { - Dust flame = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); + Dust flame = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); flame.velocity *= 3f; if (Main.rand.NextBool(2)) flame.scale = 0.5f; @@ -92,10 +92,10 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) + if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/GodsParanoiaProj.cs b/Projectiles/Rogue/GodsParanoiaProj.cs index 0994734fb4..49ec1e2675 100644 --- a/Projectiles/Rogue/GodsParanoiaProj.cs +++ b/Projectiles/Rogue/GodsParanoiaProj.cs @@ -17,39 +17,39 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("God's Paranoia"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 15; - projectile.height = 15; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.width = 15; + Projectile.height = 15; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.25f); + Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0.25f); if (Main.rand.NextBool(2)) { - Dust flame = Dust.NewDustDirect(projectile.position, 1, 1, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 0, default, 0.5f); - flame.alpha = projectile.alpha; + Dust flame = Dust.NewDustDirect(Projectile.position, 1, 1, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 0, default, 0.5f); + flame.alpha = Projectile.alpha; flame.velocity = Vector2.Zero; flame.noGravity = true; } - projectile.StickyProjAI(50); + Projectile.StickyProjAI(50); - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { kunaiStabbing++; if (kunaiStabbing >= 20) @@ -57,9 +57,9 @@ namespace CalamityMod.Projectiles.Rogue kunaiStabbing = 0; float startOffsetX = Main.rand.NextFloat(100f, 200f) * (Main.rand.NextBool() ? -1f : 1f); float startOffsetY = Main.rand.NextFloat(100f, 200f) * (Main.rand.NextBool() ? -1f : 1f); - Vector2 startPos = new Vector2(projectile.position.X + startOffsetX, projectile.position.Y + startOffsetY); - float dx = projectile.position.X - startPos.X; - float dy = projectile.position.Y - startPos.Y; + Vector2 startPos = new Vector2(Projectile.position.X + startOffsetX, Projectile.position.Y + startOffsetY); + float dx = Projectile.position.X - startPos.X; + float dy = Projectile.position.Y - startPos.Y; // Add some randomness / inaccuracy dx += Main.rand.NextFloat(-5f, 5f); @@ -71,11 +71,11 @@ namespace CalamityMod.Projectiles.Rogue dy *= dist; Vector2 kunaiSp = new Vector2(dx, dy); float angle = Main.rand.NextFloat(MathHelper.TwoPi); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 3; i++) { - int idx = Projectile.NewProjectile(startPos, kunaiSp, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack / 2f, projectile.owner, 0f, 0f); + int idx = Projectile.NewProjectile(startPos, kunaiSp, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack / 2f, Projectile.owner, 0f, 0f); Main.projectile[idx].rotation = angle; } } @@ -83,22 +83,22 @@ namespace CalamityMod.Projectiles.Rogue } else { - projectile.rotation += 0.2f * (float)projectile.direction; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, projectile.Calamity().stealthStrike ? 12f : 7f, 20f); + Projectile.rotation += 0.2f * (float)Projectile.direction; + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 300f, Projectile.Calamity().stealthStrike ? 12f : 7f, 20f); } - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.killSpikyBalls == true) { - projectile.active = false; - projectile.netUpdate = true; + Projectile.active = false; + Projectile.netUpdate = true; } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(10, true); + Projectile.ModifyHitNPCSticky(10, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/GreenDonkeyKongReference.cs b/Projectiles/Rogue/GreenDonkeyKongReference.cs index 052ec8a90d..1c427b03fc 100644 --- a/Projectiles/Rogue/GreenDonkeyKongReference.cs +++ b/Projectiles/Rogue/GreenDonkeyKongReference.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,56 +17,56 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Barrel"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 48; - projectile.height = 48; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 480; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 48; + Projectile.height = 48; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 480; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } - public bool CollideX => projectile.oldPosition.X == projectile.position.X; + public bool CollideX => Projectile.oldPosition.X == Projectile.position.X; public override void AI() { - bool stealthS = projectile.Calamity().stealthStrike; - if (projectile.localAI[0] == 0f) + bool stealthS = Projectile.Calamity().stealthStrike; + if (Projectile.localAI[0] == 0f) { - projectile.ai[1] = stealthS.ToInt() == 0 ? 1 : 3; - projectile.localAI[0] = 1f; + Projectile.ai[1] = stealthS.ToInt() == 0 ? 1 : 3; + Projectile.localAI[0] = 1f; } - projectile.rotation += Math.Sign(projectile.velocity.X) * MathHelper.ToRadians(8f); - if (projectile.velocity.Y < 15f) + Projectile.rotation += Math.Sign(Projectile.velocity.X) * MathHelper.ToRadians(8f); + if (Projectile.velocity.Y < 15f) { - projectile.velocity.Y += 0.3f; + Projectile.velocity.Y += 0.3f; } if (CollideX && cooldown == 0) { BounceEffects(); - projectile.velocity.X = -oldVelocityX; + Projectile.velocity.X = -oldVelocityX; } else if (cooldown > 0) { cooldown -= 1f; } - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - oldVelocityX = Math.Sign(projectile.velocity.X) * 12f; + oldVelocityX = Math.Sign(Projectile.velocity.X) * 12f; } } public override bool OnTileCollide(Vector2 oldVelocity) => false; public void BounceEffects() { - bool stealthS = projectile.Calamity().stealthStrike; + bool stealthS = Projectile.Calamity().stealthStrike; int projectileCount = 8; - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); if (stealthS) { projectileCount += 5; //more shit the closer we are to death @@ -75,15 +76,15 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(3)) { Vector2 shrapnelVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(30f)); - Projectile.NewProjectile(projectile.Center, projectile.velocity + shrapnelVelocity, - ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Projectile.velocity + shrapnelVelocity, + ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner); } else { Vector2 acidVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); - int acidIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity + acidVelocity, + int acidIndex = Projectile.NewProjectile(Projectile.Center, Projectile.velocity + acidVelocity, ModContent.ProjectileType(), - (int)(projectile.damage * 0.75f), 1f, projectile.owner); + (int)(Projectile.damage * 0.75f), 1f, Projectile.owner); if (acidIndex.WithinBounds(Main.maxProjectiles)) { Main.projectile[acidIndex].Calamity().forceRogue = true; @@ -99,9 +100,9 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 6; i++) { Vector2 acidVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); - int acidIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity + acidVelocity, + int acidIndex = Projectile.NewProjectile(Projectile.Center, Projectile.velocity + acidVelocity, ModContent.ProjectileType(), - (int)(projectile.damage * 0.667f), 1f, projectile.owner); + (int)(Projectile.damage * 0.667f), 1f, Projectile.owner); if (acidIndex.WithinBounds(Main.maxProjectiles)) { Main.projectile[acidIndex].Calamity().forceRogue = true; @@ -110,16 +111,16 @@ namespace CalamityMod.Projectiles.Rogue } } - projectile.ai[1]--; + Projectile.ai[1]--; cooldown = 15; - if (projectile.ai[1] <= 0) + if (Projectile.ai[1] <= 0) { - projectile.Kill(); + Projectile.Kill(); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/HeavenfallenEnergy.cs b/Projectiles/Rogue/HeavenfallenEnergy.cs index e821005505..9a69828a32 100644 --- a/Projectiles/Rogue/HeavenfallenEnergy.cs +++ b/Projectiles/Rogue/HeavenfallenEnergy.cs @@ -16,33 +16,33 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void AI() { int num154 = 14; int coolDust; - projectile.ai[0] += 1; - if (projectile.ai[0] % 2 == 0) + Projectile.ai[0] += 1; + if (Projectile.ai[0] % 2 == 0) { - if (projectile.ai[0] % 4 == 0) + if (Projectile.ai[0] % 4 == 0) { - coolDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); } else { - coolDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); } Main.dust[coolDust].noGravity = true; Main.dust[coolDust].velocity *= 0.1f; - Main.dust[coolDust].velocity += projectile.velocity * 0.5f; + Main.dust[coolDust].velocity += Projectile.velocity * 0.5f; } } diff --git a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs index bae95d4c4f..0478b76238 100644 --- a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs +++ b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -18,83 +19,83 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Heavenfallen Stardisk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; + Projectile.width = 34; + Projectile.height = 34; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - if (projectile.timeLeft % 5f == 0f) //every 5 ticks + if (Projectile.timeLeft % 5f == 0f) //every 5 ticks { if (Main.rand.NextBool(2)) { int energyAmt = Main.rand.Next(1, 4); //1 to 3 energy for (int n = 0; n < energyAmt; n++) { - CalamityUtils.ProjectileRain(projectile.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), projectile.knockBack * 0.4f, projectile.owner); + CalamityUtils.ProjectileRain(Projectile.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack * 0.4f, Projectile.owner); } } } } - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 20; + Projectile.alpha -= 20; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } for (int i = 0; i < 2; i++) { - int blueDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + int blueDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[blueDust].noGravity = true; Main.dust[blueDust].velocity *= 0f; } for (int i = 0; i < 2; i++) { - int orangeDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + int orangeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[orangeDust].noGravity = true; Main.dust[orangeDust].velocity *= 0f; } - projectile.rotation += 0.5f; + Projectile.rotation += 0.5f; - if (player.position.Y != player.oldPosition.Y && projectile.ai[0] == 0f) + if (player.position.Y != player.oldPosition.Y && Projectile.ai[0] == 0f) { explode = true; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; - if (Main.myPlayer == projectile.owner && projectile.ai[0] == 20f) + if (Main.myPlayer == Projectile.owner && Projectile.ai[0] == 20f) { if (player.channel) { float num115 = 20f; - float num116 = (float)Main.mouseX + Main.screenPosition.X - projectile.Center.X; - float num117 = (float)Main.mouseY + Main.screenPosition.Y - projectile.Center.Y; + float num116 = (float)Main.mouseX + Main.screenPosition.X - Projectile.Center.X; + float num117 = (float)Main.mouseY + Main.screenPosition.Y - Projectile.Center.Y; if (player.gravDir == -1f) { - num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projectile.Center.Y; + num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - Projectile.Center.Y; } float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); if (num118 > num115) @@ -103,35 +104,35 @@ namespace CalamityMod.Projectiles.Rogue num116 *= num118; num117 *= num118; int num119 = (int)(num116 * 1000f); - int num120 = (int)(projectile.velocity.X * 1000f); + int num120 = (int)(Projectile.velocity.X * 1000f); int num121 = (int)(num117 * 1000f); - int num122 = (int)(projectile.velocity.Y * 1000f); + int num122 = (int)(Projectile.velocity.Y * 1000f); if (num119 != num120 || num121 != num122) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; + Projectile.velocity.X = num116; + Projectile.velocity.Y = num117; } else { int num123 = (int)(num116 * 1000f); - int num124 = (int)(projectile.velocity.X * 1000f); + int num124 = (int)(Projectile.velocity.X * 1000f); int num125 = (int)(num117 * 1000f); - int num126 = (int)(projectile.velocity.Y * 1000f); + int num126 = (int)(Projectile.velocity.Y * 1000f); if (num123 != num124 || num125 != num126) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; + Projectile.velocity.X = num116; + Projectile.velocity.Y = num117; } } - else if (projectile.ai[0] == 20f) + else if (Projectile.ai[0] == 20f) { - projectile.netUpdate = true; + Projectile.netUpdate = true; float num127 = 20f; - Vector2 vector11 = projectile.Center; + Vector2 vector11 = Projectile.Center; float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; if (player.gravDir == -1f) @@ -139,18 +140,18 @@ namespace CalamityMod.Projectiles.Rogue num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; } float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || projectile.ai[0] < 0f) + if (num130 == 0f || Projectile.ai[0] < 0f) { vector11 = player.Center; - num128 = projectile.Center.X - vector11.X; - num129 = projectile.Center.Y - vector11.Y; + num128 = Projectile.Center.X - vector11.X; + num129 = Projectile.Center.Y - vector11.Y; num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); } num130 = num127 / num130; num128 *= num130; num129 *= num130; - projectile.velocity.X = num128; - projectile.velocity.Y = num129; + Projectile.velocity.X = num128; + Projectile.velocity.Y = num129; } } } @@ -167,35 +168,35 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int i = 0; i < 10; i++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } for (int i = 0; i < 10; i++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } if (explode && player.position.Y != player.oldPosition.Y) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(projectile.damage * 0.4), projectile.knockBack * 0.4f, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(projectile.damage * 0.4), projectile.knockBack * 0.4f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack * 0.4f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack * 0.4f, Projectile.owner, 0f, 0f); } } } @@ -203,7 +204,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/HellsSunProj.cs b/Projectiles/Rogue/HellsSunProj.cs index 87ec17701b..bd5ab713cd 100644 --- a/Projectiles/Rogue/HellsSunProj.cs +++ b/Projectiles/Rogue/HellsSunProj.cs @@ -17,33 +17,33 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 15; - projectile.height = 15; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = 20; - projectile.timeLeft = 1200; + Projectile.width = 15; + Projectile.height = 15; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = 20; + Projectile.timeLeft = 1200; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; } public override void AI() { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; - if (projectile.ai[0] >= 70f) + if (Projectile.ai[0] >= 70f) { - projectile.velocity.X *= 0.96f; - projectile.velocity.Y *= 0.96f; - projectile.localAI[1]++; - if (projectile.Calamity().stealthStrike) + Projectile.velocity.X *= 0.96f; + Projectile.velocity.Y *= 0.96f; + Projectile.localAI[1]++; + if (Projectile.Calamity().stealthStrike) { - if (projectile.localAI[1] >= 30f) + if (Projectile.localAI[1] >= 30f) { - Vector2 velocity = projectile.velocity; + Vector2 velocity = Projectile.velocity; Vector2 vector2_1 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101)); vector2_1.Normalize(); Vector2 vector2_2 = vector2_1 * ((float) Main.rand.Next(10, 41) * 0.1f); @@ -51,15 +51,15 @@ namespace CalamityMod.Projectiles.Rogue vector2_2 *= 2f; Vector2 vector2_3 = velocity * 0.25f + vector2_2; Vector2 vector2_5 = vector2_3 * 0.8f; - Projectile.NewProjectile(projectile.Center.X - vector2_5.X, projectile.Center.Y - vector2_5.Y, vector2_5.X, vector2_5.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, Main.rand.Next(3), 0.0f); - projectile.localAI[1] = 0.0f; + Projectile.NewProjectile(Projectile.Center.X - vector2_5.X, Projectile.Center.Y - vector2_5.Y, vector2_5.X, vector2_5.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Main.rand.Next(3), 0.0f); + Projectile.localAI[1] = 0.0f; } } else { - if (projectile.localAI[1] >= 60f) + if (Projectile.localAI[1] >= 60f) { - Vector2 velocity = projectile.velocity; + Vector2 velocity = Projectile.velocity; Vector2 vector2_1 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101)); vector2_1.Normalize(); Vector2 vector2_2 = vector2_1 * ((float) Main.rand.Next(10, 41) * 0.1f); @@ -67,22 +67,22 @@ namespace CalamityMod.Projectiles.Rogue vector2_2 *= 2f; Vector2 vector2_3 = velocity * 0.25f + vector2_2; Vector2 vector2_5 = vector2_3 * 0.8f; - Projectile.NewProjectile(projectile.Center.X - vector2_5.X, projectile.Center.Y - vector2_5.Y, vector2_5.X, vector2_5.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, Main.rand.Next(3), 0.0f); - projectile.localAI[1] = 0.0f; + Projectile.NewProjectile(Projectile.Center.X - vector2_5.X, Projectile.Center.Y - vector2_5.Y, vector2_5.X, vector2_5.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Main.rand.Next(3), 0.0f); + Projectile.localAI[1] = 0.0f; } } } else { - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.killSpikyBalls == true) { - projectile.active = false; - projectile.netUpdate = true; + Projectile.active = false; + Projectile.netUpdate = true; } } diff --git a/Projectiles/Rogue/Honeycomb.cs b/Projectiles/Rogue/Honeycomb.cs index f528ae0636..e96d40afa3 100644 --- a/Projectiles/Rogue/Honeycomb.cs +++ b/Projectiles/Rogue/Honeycomb.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items.Weapons.Rogue; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -20,20 +21,20 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 300; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 2; + Projectile.timeLeft = 300; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { Player player = Main.player[Main.myPlayer]; - Vector2 posDiff = player.Center - projectile.Center; + Vector2 posDiff = player.Center - Projectile.Center; if (posDiff.Length() <= radius) { player.AddBuff(BuffID.Honey, 300); @@ -46,36 +47,36 @@ namespace CalamityMod.Projectiles.Rogue while (split < 3) { //Calculate the velocity of the projectile - float shardspeedX = -projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); - float shardspeedY = -projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; + float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); + float shardspeedY = -Projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; //Prevents the projectile speed from being too low if (shardspeedX < 2f && shardspeedX > -2f) { - shardspeedX += -projectile.velocity.X; + shardspeedX += -Projectile.velocity.X; } if (shardspeedY > 2f && shardspeedY < 2f) { - shardspeedY += -projectile.velocity.Y; + shardspeedY += -Projectile.velocity.Y; } //Spawn the projectile - Projectile.NewProjectile(projectile.position.X + shardspeedX, projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 2f, projectile.owner, Main.rand.Next(3), 0f); + Projectile.NewProjectile(Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 2f, Projectile.owner, Main.rand.Next(3), 0f); split += 1; } - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -83,76 +84,76 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.velocity.X = -projectile.velocity.X; - projectile.velocity.Y = -projectile.velocity.Y; + Projectile.velocity.X = -Projectile.velocity.X; + Projectile.velocity.Y = -Projectile.velocity.Y; int split = 0; while (split < 3) { //Calculate the velocity of the projectile - float shardspeedX = -projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); - float shardspeedY = -projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; + float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); + float shardspeedY = -Projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; //Prevents the projectile speed from being too low if (shardspeedX < 2f && shardspeedX > -2f) { - shardspeedX += -projectile.velocity.X; + shardspeedX += -Projectile.velocity.X; } if (shardspeedY > 2f && shardspeedY < 2f) { - shardspeedY += -projectile.velocity.Y; + shardspeedY += -Projectile.velocity.Y; } //Spawn the projectile - Projectile.NewProjectile(projectile.position.X + shardspeedX, projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 2f, projectile.owner, Main.rand.Next(3), 0f); + Projectile.NewProjectile(Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 2f, Projectile.owner, Main.rand.Next(3), 0f); split += 1; } } public override void OnHitPvp(Player target, int damage, bool crit) { - projectile.velocity.X = -projectile.velocity.X; - projectile.velocity.Y = -projectile.velocity.Y; + Projectile.velocity.X = -Projectile.velocity.X; + Projectile.velocity.Y = -Projectile.velocity.Y; int split = 0; while (split < 3) { //Calculate the velocity of the projectile - float shardspeedX = -projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); - float shardspeedY = -projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; + float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); + float shardspeedY = -Projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; //Prevents the projectile speed from being too low if (shardspeedX < 2f && shardspeedX > -2f) { - shardspeedX += -projectile.velocity.X; + shardspeedX += -Projectile.velocity.X; } if (shardspeedY > 2f && shardspeedY < 2f) { - shardspeedY += -projectile.velocity.Y; + shardspeedY += -Projectile.velocity.Y; } //Spawn the projectile - Projectile.NewProjectile(projectile.position.X + shardspeedX, projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 2f, projectile.owner, Main.rand.Next(3), 0f); + Projectile.NewProjectile(Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 2f, Projectile.owner, Main.rand.Next(3), 0f); split += 1; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCDeath1, projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.position); //Dust on impact int dust_splash = 0; while (dust_splash < 9) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 9, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.15f, 159, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 9, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 159, default, 1.5f); dust_splash += 1; } if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } } diff --git a/Projectiles/Rogue/HoneycombFragment.cs b/Projectiles/Rogue/HoneycombFragment.cs index 2d7d1320eb..9217e6b024 100644 --- a/Projectiles/Rogue/HoneycombFragment.cs +++ b/Projectiles/Rogue/HoneycombFragment.cs @@ -14,25 +14,25 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 14; - projectile.height = 14; - projectile.Calamity().rogue = true; + Projectile.friendly = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { //Changes the texture of the projectile - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/HoneycombFragment2"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, 12, 14)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Rogue/HoneycombFragment2"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, 12, 14)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/HoneycombFragment3"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, 16, 14)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Rogue/HoneycombFragment3"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, 16, 14)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } return true; @@ -41,11 +41,11 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { //Rotation and gravity - projectile.rotation += 0.6f * projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.27f; - if (projectile.velocity.Y > 16f) + Projectile.rotation += 0.6f * Projectile.direction; + Projectile.velocity.Y = Projectile.velocity.Y + 0.27f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue int splash = 0; while (splash < 4) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 9, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.10f, 159, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 9, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 159, default, 0.9f); splash += 1; } } diff --git a/Projectiles/Rogue/HypothermiaChunk.cs b/Projectiles/Rogue/HypothermiaChunk.cs index 4c10079e84..afbd31fd23 100644 --- a/Projectiles/Rogue/HypothermiaChunk.cs +++ b/Projectiles/Rogue/HypothermiaChunk.cs @@ -11,42 +11,42 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Ice Chunk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 80; - projectile.extraUpdates = 4; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.tileCollide = false; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 80; + Projectile.extraUpdates = 4; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.tileCollide = false; } public override void AI() { //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - Lighting.AddLight(projectile.Center, 0.1f, 0f, 0.5f); - if (projectile.ai[0] < 0.2f) + Lighting.AddLight(Projectile.Center, 0.1f, 0f, 0.5f); + if (Projectile.ai[0] < 0.2f) { - projectile.ai[0] += 0.1f; + Projectile.ai[0] += 0.1f; } else { - projectile.tileCollide = true; + Projectile.tileCollide = true; } if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 191, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.8f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 191, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 0.8f); } } @@ -54,20 +54,20 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 3; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 191, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.8f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 191, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 0.8f); } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { int numSplits = Main.rand.NextBool() ? 4 : 3; int type = ModContent.ProjectileType(); - int shardDamage = (int)(projectile.damage * 0.5f); - float shardKB = projectile.knockBack * 0.75f; + int shardDamage = (int)(Projectile.damage * 0.5f); + float shardKB = Projectile.knockBack * 0.75f; for (int i = 0; i < numSplits; ++i) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); int texID = Main.rand.Next(4); - Projectile.NewProjectile(projectile.Center, velocity, type, shardDamage, shardKB, Main.myPlayer, texID, 1f); + Projectile.NewProjectile(Projectile.Center, velocity, type, shardDamage, shardKB, Main.myPlayer, texID, 1f); } } } @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/HypothermiaShard.cs b/Projectiles/Rogue/HypothermiaShard.cs index 14c1f328a1..b4adff39bb 100644 --- a/Projectiles/Rogue/HypothermiaShard.cs +++ b/Projectiles/Rogue/HypothermiaShard.cs @@ -16,52 +16,52 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.scale = 1f; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 50; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 3; + Projectile.width = 6; + Projectile.height = 6; + Projectile.scale = 1f; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 50; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 3; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.1f, 0f, 0.5f); - projectile.rotation += projectile.velocity.X * 0.2f; + Lighting.AddLight(Projectile.Center, 0.1f, 0f, 0.5f); + Projectile.rotation += Projectile.velocity.X * 0.2f; counter += 0.25f; if (Main.rand.NextBool(10)) { - int num300 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 191, 0f, 0f, 0, default, 0.8f); + int num300 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 191, 0f, 0f, 0, default, 0.8f); Main.dust[num300].noGravity = true; Main.dust[num300].velocity *= 0.2f; } - projectile.velocity *= 0.996f; + Projectile.velocity *= 0.996f; if (counter > 100f) { - projectile.scale -= 0.05f; - if ((double)projectile.scale <= 0.2) + Projectile.scale -= 0.05f; + if ((double)Projectile.scale <= 0.2) { - projectile.scale = 0.2f; - projectile.Kill(); + Projectile.scale = 0.2f; + Projectile.Kill(); } - projectile.width = (int)(6f * projectile.scale); - projectile.height = (int)(6f * projectile.scale); + Projectile.width = (int)(6f * Projectile.scale); + Projectile.height = (int)(6f * Projectile.scale); } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } return false; } @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 191, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.8f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 191, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 0.8f); } } @@ -87,20 +87,20 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { //Changes the texture of the projectile - Texture2D texture = Main.projectileTexture[projectile.type]; - if (projectile.ai[0] == 1f) + Texture2D texture = Main.projectileTexture[Projectile.type]; + if (Projectile.ai[0] == 1f) { - texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/HypothermiaShard2"); + texture = ModContent.Request("CalamityMod/Projectiles/Rogue/HypothermiaShard2"); } - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/HypothermiaShard3"); + texture = ModContent.Request("CalamityMod/Projectiles/Rogue/HypothermiaShard3"); } - if (projectile.ai[0] == 3f) + if (Projectile.ai[0] == 3f) { - texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/HypothermiaShard4"); + texture = ModContent.Request("CalamityMod/Projectiles/Rogue/HypothermiaShard4"); } - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Rogue/IceStarProjectile.cs b/Projectiles/Rogue/IceStarProjectile.cs index 55d98f0e14..9cef17b373 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class IceStarProjectile : ModProjectile @@ -21,45 +22,45 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.aiStyle = 2; - projectile.timeLeft = 280; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.aiStyle = 2; + Projectile.timeLeft = 280; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; - projectile.coldDamage = true; + Projectile.Calamity().rogue = true; + Projectile.coldDamage = true; } public override void AI() { - if (!initStealth && projectile.Calamity().stealthStrike) + if (!initStealth && Projectile.Calamity().stealthStrike) { - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 9; - projectile.tileCollide = false; - initialVelocity = projectile.velocity; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 9; + Projectile.tileCollide = false; + initialVelocity = Projectile.velocity; initStealth = true; } - projectile.rotation += 0.5f; + Projectile.rotation += 0.5f; if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - Vector2 center = projectile.Center; - float maxDistance = projectile.Calamity().stealthStrike ? 800f : 400f; + Vector2 center = Projectile.Center; + float maxDistance = Projectile.Calamity().stealthStrike ? 800f : 400f; bool homeIn = false; for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].CanBeChasedBy(projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) { center = Main.npc[i].Center; homeIn = true; @@ -70,25 +71,25 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { - Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * 20f + moveDirection * 14f) / (21f); + Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 14f) / (21f); } - projectile.velocity = initStealth && !homeIn ? initialVelocity : projectile.velocity; + Projectile.velocity = initStealth && !homeIn ? initialVelocity : Projectile.velocity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } @@ -96,10 +97,10 @@ namespace CalamityMod.Projectiles.Rogue { if (initStealth) { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 15) + if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 15) { float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; @@ -107,11 +108,11 @@ namespace CalamityMod.Projectiles.Rogue { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), - ModContent.ProjectileType(), projectile.damage / 8, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), + ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f), - ModContent.ProjectileType(), projectile.damage / 8, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f), + ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } } } @@ -121,10 +122,10 @@ namespace CalamityMod.Projectiles.Rogue { if (initStealth) { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 15) + if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 15) { float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; @@ -132,11 +133,11 @@ namespace CalamityMod.Projectiles.Rogue { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), - ModContent.ProjectileType(), projectile.damage / 8, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), + ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f), - ModContent.ProjectileType(), projectile.damage / 8, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f), + ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Rogue/IcebreakerHammer.cs b/Projectiles/Rogue/IcebreakerHammer.cs index f619891510..431acaa4d4 100644 --- a/Projectiles/Rogue/IcebreakerHammer.cs +++ b/Projectiles/Rogue/IcebreakerHammer.cs @@ -21,44 +21,44 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 120; + Projectile.width = 30; + Projectile.height = 30; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 3; + Projectile.timeLeft = 120; aiType = ProjectileID.WoodenBoomerang; - projectile.coldDamage = true; + Projectile.coldDamage = true; } public override void AI() { if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { target.AddBuff(BuffID.Frostburn, 180); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { if (explosionCount < 3) //max amount of explosions to prevent worm memes { - int ice = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 1.5), projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int ice = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (ice.WithinBounds(Main.maxProjectiles)) Main.projectile[ice].Calamity().forceRogue = true; explosionCount++; @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < Main.maxNPCs; i++) { NPC nPC = Main.npc[i]; - if (nPC.active && !nPC.dontTakeDamage && !nPC.buffImmune[buffType] && Vector2.Distance(projectile.Center, nPC.Center) <= radius) + if (nPC.active && !nPC.dontTakeDamage && !nPC.buffImmune[buffType] && Vector2.Distance(Projectile.Center, nPC.Center) <= radius) { if (nPC.FindBuffIndex(buffType) == -1) nPC.AddBuff(buffType, 60, false); @@ -82,14 +82,14 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { target.AddBuff(BuffID.Frostburn, 180); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { //no explosion count cap in pvp - int ice = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 1.5), projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int ice = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (ice.WithinBounds(Main.maxProjectiles)) Main.projectile[ice].Calamity().forceRogue = true; @@ -98,9 +98,9 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < Main.maxPlayers; i++) { - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; Player player = Main.player[i]; - if ((owner.team != player.team || player.team == 0) && player.hostile && owner.hostile && !player.dead && !player.buffImmune[buffType] && Vector2.Distance(projectile.Center, player.Center) <= radius) + if ((owner.team != player.team || player.team == 0) && player.hostile && owner.hostile && !player.dead && !player.buffImmune[buffType] && Vector2.Distance(Projectile.Center, player.Center) <= radius) { if (player.FindBuffIndex(buffType) == -1) player.AddBuff(buffType, 60, false); diff --git a/Projectiles/Rogue/IchorSpearProj.cs b/Projectiles/Rogue/IchorSpearProj.cs index 05b67b8837..c81380e132 100644 --- a/Projectiles/Rogue/IchorSpearProj.cs +++ b/Projectiles/Rogue/IchorSpearProj.cs @@ -18,38 +18,38 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.aiStyle = 113; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.aiStyle = 113; + Projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; - projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 246, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.spriteDirection == -1) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + if (Projectile.spriteDirection == -1) { - projectile.rotation -= 1.57f; + Projectile.rotation -= 1.57f; } - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - if (projectile.timeLeft % 8 == 0) + if (Projectile.timeLeft % 8 == 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { Vector2 velocity = new Vector2(Main.rand.NextFloat(-14f, 14f), Main.rand.NextFloat(-14f, 14f)); - int ichor = Projectile.NewProjectile(projectile.Center, velocity, Main.rand.NextBool(2) ? ProjectileID.GoldenShowerFriendly : ProjectileID.IchorSplash, (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner); + int ichor = Projectile.NewProjectile(Projectile.Center, velocity, Main.rand.NextBool(2) ? ProjectileID.GoldenShowerFriendly : ProjectileID.IchorSplash, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); if (ichor.WithinBounds(Main.maxProjectiles)) { Main.projectile[ichor].Calamity().forceRogue = true; @@ -64,8 +64,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -73,18 +73,18 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 10; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 246, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Ichor, projectile.Calamity().stealthStrike ? 600 : 120); + target.AddBuff(BuffID.Ichor, Projectile.Calamity().stealthStrike ? 600 : 120); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Ichor, projectile.Calamity().stealthStrike ? 600 : 120); + target.AddBuff(BuffID.Ichor, Projectile.Calamity().stealthStrike ? 600 : 120); } } } diff --git a/Projectiles/Rogue/InfernalKrisCinder.cs b/Projectiles/Rogue/InfernalKrisCinder.cs index beab91e6a7..dc2698b8a9 100644 --- a/Projectiles/Rogue/InfernalKrisCinder.cs +++ b/Projectiles/Rogue/InfernalKrisCinder.cs @@ -14,37 +14,37 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.alpha = 0; - projectile.penetrate = 3; - projectile.tileCollide = true; - projectile.timeLeft = 120; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.alpha = 0; + Projectile.penetrate = 3; + Projectile.tileCollide = true; + Projectile.timeLeft = 120; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.velocity.Y += 0.1f; - projectile.rotation += 0.4f * projectile.direction; + Projectile.velocity.Y += 0.1f; + Projectile.rotation += 0.4f * Projectile.direction; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); float minScale = 1.9f; float maxScale = 2.5f; int numDust = 2; for (int i = 0; i < numDust; i++) { - Dust.NewDust(projectile.position, 4, 4, 6, projectile.velocity.X, projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + Dust.NewDust(Projectile.position, 4, 4, 6, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); } - projectile.Kill(); + Projectile.Kill(); return true; } @@ -62,15 +62,15 @@ namespace CalamityMod.Projectiles.Rogue { // If this is a stealth strike, make the blade glow orange Color glowColour = new Color(255, 215, 100, 100); - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, glowColour, projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, glowColour, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); float minScale = 1.9f; float maxScale = 2.5f; int numDust = 2; for (int i = 0; i < numDust; i++) { - int dust = Dust.NewDust(projectile.position, 4, 4, 6, 0f, -2f, 0, default, Main.rand.NextFloat(minScale, maxScale)); + int dust = Dust.NewDust(Projectile.position, 4, 4, 6, 0f, -2f, 0, default, Main.rand.NextFloat(minScale, maxScale)); Main.dust[dust].noGravity = true; } return false; diff --git a/Projectiles/Rogue/InfernalKrisExplosion.cs b/Projectiles/Rogue/InfernalKrisExplosion.cs index 4e0b748822..29076f8d28 100644 --- a/Projectiles/Rogue/InfernalKrisExplosion.cs +++ b/Projectiles/Rogue/InfernalKrisExplosion.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = (int)radius * 2; - projectile.height = (int)radius * 2; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 9; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = (int)radius * 2; + Projectile.height = (int)radius * 2; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 9; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.timeLeft >= 5) + if (Projectile.timeLeft >= 5) { int numDust = 40; int dustType = 6; @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue circleVelocity.Normalize(); circleVelocity *= Main.rand.NextFloat(minRange, maxRange); - int circle = Dust.NewDust(projectile.Center, 1, 1, dustType, circleVelocity.X, circleVelocity.Y, 0, default, 2f); + int circle = Dust.NewDust(Projectile.Center, 1, 1, dustType, circleVelocity.X, circleVelocity.Y, 0, default, 2f); Main.dust[circle].noGravity = true; Main.dust[circle].velocity = circleVelocity; } @@ -63,6 +63,6 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(BuffID.OnFire, 180); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); } } diff --git a/Projectiles/Rogue/InfernalKrisProjectile.cs b/Projectiles/Rogue/InfernalKrisProjectile.cs index 5f0fb57abc..50670b7c3f 100644 --- a/Projectiles/Rogue/InfernalKrisProjectile.cs +++ b/Projectiles/Rogue/InfernalKrisProjectile.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -17,57 +18,57 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Infernal Kris"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.timeLeft < spinTime) + if (Projectile.timeLeft < spinTime) { - projectile.rotation += 0.4f * projectile.direction; + Projectile.rotation += 0.4f * Projectile.direction; float minScale = 1.9f; float maxScale = 2.5f; - int dust = Dust.NewDust(projectile.position - new Vector2(10, 10), 30, 30, 6, projectile.velocity.X, projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + int dust = Dust.NewDust(Projectile.position - new Vector2(10, 10), 30, 30, 6, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); Main.dust[dust].noGravity = true; } else { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; } - projectile.velocity.Y += 0.01f; - if (projectile.velocity.Y > 10f) + Projectile.velocity.Y += 0.01f; + if (Projectile.velocity.Y > 10f) { - projectile.velocity.Y = 10f; + Projectile.velocity.Y = 10f; } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (projectile.timeLeft < spinTime) + if (Projectile.timeLeft < spinTime) { - damage = (int)(projectile.damage * 1.75f) + Main.rand.Next(0, 6); + damage = (int)(Projectile.damage * 1.75f) + Main.rand.Next(0, 6); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - int debuffTime = 60 * (projectile.Calamity().stealthStrike ? Main.rand.Next(4,8) : Main.rand.Next(3,6)); + int debuffTime = 60 * (Projectile.Calamity().stealthStrike ? Main.rand.Next(4,8) : Main.rand.Next(3,6)); target.AddBuff(BuffID.OnFire, debuffTime); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { int sparkCount = Main.rand.Next(3, 7); for (int i = 0; i < sparkCount; i++) @@ -78,19 +79,19 @@ namespace CalamityMod.Projectiles.Rogue sparkVelocity.Normalize(); sparkVelocity *= 3; - Projectile.NewProjectile(projectile.Center, sparkVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.4f), 0, projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.Center, sparkVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0, Projectile.owner, 0, 0); } - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.4f), 0, projectile.owner, 0, 0); - Main.PlaySound(SoundID.Item74, projectile.position); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0, Projectile.owner, 0, 0); + SoundEngine.PlaySound(SoundID.Item74, Projectile.position); } } public override void OnHitPvp(Player target, int damage, bool crit) { - int debuffTime = 60 * (projectile.Calamity().stealthStrike ? Main.rand.Next(4,8) : Main.rand.Next(3,6)); + int debuffTime = 60 * (Projectile.Calamity().stealthStrike ? Main.rand.Next(4,8) : Main.rand.Next(3,6)); target.AddBuff(BuffID.OnFire, debuffTime); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { int sparkCount = Main.rand.Next(3, 7); for (int i = 0; i < sparkCount; i++) @@ -101,65 +102,65 @@ namespace CalamityMod.Projectiles.Rogue sparkVelocity.Normalize(); sparkVelocity *= 3; - Projectile.NewProjectile(projectile.Center, sparkVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.4f), 0, projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.Center, sparkVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0, Projectile.owner, 0, 0); } - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.4f), 0, projectile.owner, 0, 0); - Main.PlaySound(SoundID.Item74, projectile.position); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0, Projectile.owner, 0, 0); + SoundEngine.PlaySound(SoundID.Item74, Projectile.position); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { // If this is a stealth strike, make the blade glow orange Color glowColour = new Color(255, 215, 100, 100); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], glowColour, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], glowColour, 1); float minScale = 1.9f; float maxScale = 2.5f; - int dust = Dust.NewDust(projectile.position, 10, 10, 6, projectile.velocity.X, projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + int dust = Dust.NewDust(Projectile.position, 10, 10, 6, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); Main.dust[dust].noGravity = true; } else { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); } return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - projectile.ai[0] = 0; - projectile.ai[1] = 0; + Projectile.ai[0] = 0; + Projectile.ai[1] = 0; - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { if (oldVelocity.X < 0) { - projectile.ai[0] = 1; + Projectile.ai[0] = 1; } if (oldVelocity.X > 0) { - projectile.ai[0] = -1; + Projectile.ai[0] = -1; } } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { if (oldVelocity.Y < 0) { - projectile.ai[1] = 1; + Projectile.ai[1] = 1; } if (oldVelocity.Y > 0) { - projectile.ai[1] = -1; + Projectile.ai[1] = -1; } } - Main.PlaySound(SoundID.Item74, projectile.position); - projectile.Kill(); + SoundEngine.PlaySound(SoundID.Item74, Projectile.position); + Projectile.Kill(); return false; } @@ -167,10 +168,10 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.Next(4) == 0) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { int sparkCount = Main.rand.Next(3, 7); for (int i = 0; i < sparkCount; i++) @@ -178,24 +179,24 @@ namespace CalamityMod.Projectiles.Rogue int sparkScatter = 1; Vector2 sparkVelocity = new Vector2(Main.rand.NextFloat(-sparkScatter, sparkScatter), Main.rand.NextFloat(-sparkScatter, sparkScatter)); - if (projectile.ai[0] != 0) + if (Projectile.ai[0] != 0) { sparkVelocity.X *= -1; } - if (projectile.ai[1] != 0) + if (Projectile.ai[1] != 0) { sparkVelocity.Y *= -1; } - sparkVelocity.X += projectile.ai[0]; - sparkVelocity.Y += projectile.ai[1]; + sparkVelocity.X += Projectile.ai[0]; + sparkVelocity.Y += Projectile.ai[1]; sparkVelocity.Normalize(); sparkVelocity *= 3; - Projectile.NewProjectile(projectile.Center, sparkVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.4f), 0, projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.Center, sparkVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0, Projectile.owner, 0, 0); } - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.4f), 0, projectile.owner, 0, 0); - Main.PlaySound(SoundID.Item74, projectile.position); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0, Projectile.owner, 0, 0); + SoundEngine.PlaySound(SoundID.Item74, Projectile.position); } } } diff --git a/Projectiles/Rogue/InkBombProjectile.cs b/Projectiles/Rogue/InkBombProjectile.cs index 0ee41dcc15..92d6c06bd8 100644 --- a/Projectiles/Rogue/InkBombProjectile.cs +++ b/Projectiles/Rogue/InkBombProjectile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class InkBombProjectile : ModProjectile @@ -13,23 +14,23 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 14; - projectile.height = 22; - projectile.friendly = true; - projectile.alpha = 0; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.ignoreWater = true; - projectile.timeLeft = 50; - projectile.Calamity().rogue = true; + Projectile.width = 14; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.alpha = 0; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 50; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.velocity.Y += 0.1f; - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.velocity.Y += 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; - if (projectile.timeLeft == 1) + if (Projectile.timeLeft == 1) CreateInk(); } @@ -52,8 +53,8 @@ namespace CalamityMod.Projectiles.Rogue private void CreateInk() { - Player player = Main.player[projectile.owner]; - Main.PlaySound(SoundID.Item14, projectile.position); + Player player = Main.player[Projectile.owner]; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 20; i++) { int projType = Main.rand.Next(0, 3); @@ -70,10 +71,10 @@ namespace CalamityMod.Projectiles.Rogue inkType = ModContent.ProjectileType(); break; } - int inkID = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), inkType, (int)(22 * player.RogueDamage()), 7, projectile.owner); + int inkID = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), inkType, (int)(22 * player.RogueDamage()), 7, Projectile.owner); Main.projectile[inkID].timeLeft += Main.rand.Next(-20, 25); } - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Rogue/InkCloud.cs b/Projectiles/Rogue/InkCloud.cs index 639fb85145..94e4cd2a0f 100644 --- a/Projectiles/Rogue/InkCloud.cs +++ b/Projectiles/Rogue/InkCloud.cs @@ -13,25 +13,25 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 32; - projectile.height = 28; - projectile.friendly = true; - projectile.alpha = 0; - projectile.penetrate = -1; - projectile.tileCollide = true; - projectile.ignoreWater = true; - projectile.timeLeft = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 32; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.alpha = 0; + Projectile.penetrate = -1; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 100; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.timeLeft < 50) - projectile.alpha += 5; - if (projectile.timeLeft < 75) - projectile.velocity *= 0.95f; + if (Projectile.timeLeft < 50) + Projectile.alpha += 5; + if (Projectile.timeLeft < 75) + Projectile.velocity *= 0.95f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/InkCloud2.cs b/Projectiles/Rogue/InkCloud2.cs index fb36ca7334..669a2a12a0 100644 --- a/Projectiles/Rogue/InkCloud2.cs +++ b/Projectiles/Rogue/InkCloud2.cs @@ -13,25 +13,25 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 36; - projectile.height = 30; - projectile.friendly = true; - projectile.alpha = 0; - projectile.penetrate = -1; - projectile.tileCollide = true; - projectile.ignoreWater = true; - projectile.timeLeft = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 36; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.alpha = 0; + Projectile.penetrate = -1; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 100; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.timeLeft < 50) - projectile.alpha += 5; - if (projectile.timeLeft < 75) - projectile.velocity *= 0.95f; + if (Projectile.timeLeft < 50) + Projectile.alpha += 5; + if (Projectile.timeLeft < 75) + Projectile.velocity *= 0.95f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/InkCloud3.cs b/Projectiles/Rogue/InkCloud3.cs index bb8d519e44..68a6abf2d0 100644 --- a/Projectiles/Rogue/InkCloud3.cs +++ b/Projectiles/Rogue/InkCloud3.cs @@ -13,25 +13,25 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 24; - projectile.friendly = true; - projectile.alpha = 0; - projectile.penetrate = -1; - projectile.tileCollide = true; - projectile.ignoreWater = true; - projectile.timeLeft = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 30; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.alpha = 0; + Projectile.penetrate = -1; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 100; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.timeLeft < 50) - projectile.alpha += 5; - if (projectile.timeLeft < 75) - projectile.velocity *= 0.95f; + if (Projectile.timeLeft < 50) + Projectile.alpha += 5; + if (Projectile.timeLeft < 75) + Projectile.velocity *= 0.95f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/IronFranciscaProj.cs b/Projectiles/Rogue/IronFranciscaProj.cs index 4a4668493d..53fe24700b 100644 --- a/Projectiles/Rogue/IronFranciscaProj.cs +++ b/Projectiles/Rogue/IronFranciscaProj.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,45 +16,45 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Iron Francisca"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.penetrate = -1; + Projectile.penetrate = -1; } float rotateratio = 0.019f; - float rotation = (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * rotateratio; - projectile.rotation += rotation * projectile.direction; + float rotation = (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * rotateratio; + Projectile.rotation += rotation * Projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - if (projectile.velocity.Y > 16f) + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } - if (projectile.ai[0] == 0) + if (Projectile.ai[0] == 0) { - projectile.damage *= 2; + Projectile.damage *= 2; } - projectile.ai[0]++; - if (projectile.ai[0] == 10) + Projectile.ai[0]++; + if (Projectile.ai[0] == 10) { - projectile.damage /= 2; + Projectile.damage /= 2; } return; @@ -61,8 +62,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -70,15 +71,15 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.Next(4) == 0) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } } diff --git a/Projectiles/Rogue/JawsProjectile.cs b/Projectiles/Rogue/JawsProjectile.cs index bb7feb64cb..924858162e 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -14,29 +15,29 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Reaper Tooth"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.Calamity().stealthStrike) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + if (Projectile.Calamity().stealthStrike) { int dustType = Utils.SelectRandom(Main.rand, new int[] { @@ -46,56 +47,56 @@ namespace CalamityMod.Projectiles.Rogue 180 }); - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f); Main.dust[dust].noGravity = true; } } //Sticky Behaviour - projectile.StickyProjAI(15); + Projectile.StickyProjAI(15); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(6, false); + Projectile.ModifyHitNPCSticky(6, false); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; target.AddBuff(BuffID.Venom, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { target.AddBuff(ModContent.BuffType(), 120); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(100f * player.RogueDamage()), 10f, projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(100f * player.RogueDamage()), 10f, Projectile.owner, 0, 0); } } public override void OnHitPvp(Player target, int damage, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; target.AddBuff(BuffID.Venom, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { target.AddBuff(ModContent.BuffType(), 120); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(100f * player.RogueDamage()), 10f, projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(100f * player.RogueDamage()), 10f, Projectile.owner, 0, 0); } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -111,7 +112,7 @@ namespace CalamityMod.Projectiles.Rogue 180 }); - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, 0, 0, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0, 0, 0, default, 1.5f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Rogue/JawsShockwave.cs b/Projectiles/Rogue/JawsShockwave.cs index 2a1de7f686..49aa223d02 100644 --- a/Projectiles/Rogue/JawsShockwave.cs +++ b/Projectiles/Rogue/JawsShockwave.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 320; - projectile.height = 320; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 320; + Projectile.height = 320; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.timeLeft >= 5) + if (Projectile.timeLeft >= 5) { for (int i = 0; i < 50; i++) { @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Rogue dustVelocity.Normalize(); dustVelocity *= 16; - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, dustVelocity.X, dustVelocity.Y, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, dustVelocity.X, dustVelocity.Y, 0, default, 1.5f); Main.dust[dust].noGravity = true; } } @@ -72,6 +72,6 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 240); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 160f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 160f, targetHitbox); } } diff --git a/Projectiles/Rogue/JewelSpike.cs b/Projectiles/Rogue/JewelSpike.cs index 81b2d10b46..c82d68eff8 100644 --- a/Projectiles/Rogue/JewelSpike.cs +++ b/Projectiles/Rogue/JewelSpike.cs @@ -8,51 +8,51 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Spike"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 36; - projectile.height = 44; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 40; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 36; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 40; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.velocity *= 0f; + Projectile.velocity *= 0f; - if (Main.rand.NextBool(5) && projectile.frame < 3) + if (Main.rand.NextBool(5) && Projectile.frame < 3) { - int crystalDust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 87, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + int crystalDust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 87, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); Main.dust[crystalDust].noGravity = true; } - projectile.frameCounter++; - if (projectile.frameCounter > 4 && projectile.frame > 0) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4 && Projectile.frame > 0) { - projectile.frame--; - projectile.frameCounter = 0; + Projectile.frame--; + Projectile.frameCounter = 0; } - if (projectile.frame < 0) - projectile.frame = 0; + if (Projectile.frame < 0) + Projectile.frame = 0; } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int index = 0; index < 3; ++index) { - 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; - Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 4, 0f, projectile.owner); + 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; + Projectile.NewProjectile(Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, Projectile.damage / 4, 0f, Projectile.owner); } } } diff --git a/Projectiles/Rogue/KelvinCatalystBoomerang.cs b/Projectiles/Rogue/KelvinCatalystBoomerang.cs index 66b1d7d66d..9326bbc218 100644 --- a/Projectiles/Rogue/KelvinCatalystBoomerang.cs +++ b/Projectiles/Rogue/KelvinCatalystBoomerang.cs @@ -6,6 +6,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -17,31 +18,31 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Kelvin Catalyst"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; - projectile.coldDamage = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; + Projectile.coldDamage = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); writer.Write(AIState); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); AIState = reader.ReadInt32(); } @@ -56,10 +57,10 @@ namespace CalamityMod.Projectiles.Rogue switch (AIState) { case 0: - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 75f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 75f) { - ResetStats(projectile.Calamity().stealthStrike); + ResetStats(Projectile.Calamity().stealthStrike); } break; case 1: @@ -67,9 +68,9 @@ namespace CalamityMod.Projectiles.Rogue break; case 2: // Will target the targetted NPC that minions use btw - projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 40f, 9f, 4f, new Vector2(0f, -60f), 40f, 9f, true, true); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 120) + Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 40f, 9f, 4f, new Vector2(0f, -60f), 40f, 9f, true, true); + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 120) { ResetStats(false); } @@ -79,83 +80,83 @@ namespace CalamityMod.Projectiles.Rogue private void ReturnToPlayer() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float returnSpeed = 20f; float acceleration = 2f; - Vector2 playerVec = player.Center - projectile.Center; + Vector2 playerVec = player.Center - Projectile.Center; float dist = playerVec.Length(); // Delete the projectile if it's excessively far away. if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); playerVec.Normalize(); playerVec *= returnSpeed; // Home back in on the player. - if (projectile.velocity.X < playerVec.X) + if (Projectile.velocity.X < playerVec.X) { - projectile.velocity.X += acceleration; - if (projectile.velocity.X < 0f && playerVec.X > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X += acceleration; + if (Projectile.velocity.X < 0f && playerVec.X > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > playerVec.X) + else if (Projectile.velocity.X > playerVec.X) { - projectile.velocity.X -= acceleration; - if (projectile.velocity.X > 0f && playerVec.X < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X -= acceleration; + if (Projectile.velocity.X > 0f && playerVec.X < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < playerVec.Y) + if (Projectile.velocity.Y < playerVec.Y) { - projectile.velocity.Y += acceleration; - if (projectile.velocity.Y < 0f && playerVec.Y > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y += acceleration; + if (Projectile.velocity.Y < 0f && playerVec.Y > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > playerVec.Y) + else if (Projectile.velocity.Y > playerVec.Y) { - projectile.velocity.Y -= acceleration; - if (projectile.velocity.Y > 0f && playerVec.Y < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y -= acceleration; + if (Projectile.velocity.Y > 0f && playerVec.Y < 0f) + Projectile.velocity.Y -= acceleration; } - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(player.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(player.Hitbox)) + Projectile.Kill(); } private void VisualAudioEffects() { - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.3f / 255f, Main.DiscoR * 0.4f / 255f, Main.DiscoR * 0.5f / 255f); + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.3f / 255f, Main.DiscoR * 0.4f / 255f, Main.DiscoR * 0.5f / 255f); - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; - projectile.rotation += 0.25f; + Projectile.rotation += 0.25f; } public override bool OnTileCollide(Vector2 oldVelocity) { - ResetStats(projectile.Calamity().stealthStrike); - if (projectile.velocity.X != oldVelocity.X) - projectile.velocity.X = -oldVelocity.X; - if (projectile.velocity.Y != oldVelocity.Y) - projectile.velocity.Y = -oldVelocity.Y; + ResetStats(Projectile.Calamity().stealthStrike); + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; return false; } private void ResetStats(bool chaseEnemies) { AIState = chaseEnemies ? 2 : 1; - projectile.localAI[0] = 0f; - projectile.width = projectile.height = 60; - projectile.tileCollide = false; - projectile.netUpdate = true; + Projectile.localAI[0] = 0f; + Projectile.width = Projectile.height = 60; + Projectile.tileCollide = false; + Projectile.netUpdate = true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -173,27 +174,27 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects() { int projType = ModContent.ProjectileType(); - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[projType] < 25) + if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[projType] < 25) { float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), projType, projectile.damage / 6, projectile.knockBack * 0.5f, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), projType, Projectile.damage / 6, Projectile.knockBack * 0.5f, Projectile.owner); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f), projType, projectile.damage / 6, projectile.knockBack * 0.5f, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f), projType, Projectile.damage / 6, Projectile.knockBack * 0.5f, Projectile.owner); } } - Main.PlaySound(SoundID.Item30, projectile.position); + SoundEngine.PlaySound(SoundID.Item30, Projectile.position); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/Knife.cs b/Projectiles/Rogue/Knife.cs index 1c79033992..53cfa055e1 100644 --- a/Projectiles/Rogue/Knife.cs +++ b/Projectiles/Rogue/Knife.cs @@ -11,49 +11,49 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 113; + Projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 1; } public override void AI() { if (Main.rand.Next(5) == 0) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.AddBuff(BuffID.WellFed, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.AddBuff(BuffID.WellFed, 180); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/KylieBoomerang.cs b/Projectiles/Rogue/KylieBoomerang.cs index 3fa2c7c5e4..51bdb437f6 100644 --- a/Projectiles/Rogue/KylieBoomerang.cs +++ b/Projectiles/Rogue/KylieBoomerang.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -21,130 +22,130 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 40; - projectile.height = 40; - projectile.penetrate = -1; - projectile.timeLeft = 360; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; + Projectile.friendly = true; + Projectile.width = 40; + Projectile.height = 40; + Projectile.penetrate = -1; + Projectile.timeLeft = 360; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { //Constant rotation - projectile.rotation += 0.2f; + Projectile.rotation += 0.2f; timer++; //Dust trail if (Main.rand.Next(15) == 0) { - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 7, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 100, default, 0f); - Main.dust[d].position = projectile.Center; + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 7, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 100, default, 0f); + Main.dust[d].position = Projectile.Center; } //Constant sound effects - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 15; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 15; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } //Slopes REEEEEEEEEEEE if (timer == 3f) - projectile.tileCollide = true; + Projectile.tileCollide = true; //Decide the range of the boomerang depending on stealth - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) ReboundTime = 27f; else ReboundTime = 55f; // ai[0] stores whether the boomerang is returning. If 0, it isn't. If 1, it is. - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= ReboundTime) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= ReboundTime) { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } } else { - projectile.tileCollide = false; + Projectile.tileCollide = false; float returnSpeed = Kylie.Speed * 1.5f; float acceleration = 3.2f; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; // Delete the boomerang if it's excessively far away. Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); dist = returnSpeed / dist; xDist *= dist; yDist *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) + if (Projectile.velocity.X < xDist) { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X = Projectile.velocity.X + acceleration; + if (Projectile.velocity.X < 0f && xDist > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > xDist) + else if (Projectile.velocity.X > xDist) { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X = Projectile.velocity.X - acceleration; + if (Projectile.velocity.X > 0f && xDist < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < yDist) + if (Projectile.velocity.Y < yDist) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; + if (Projectile.velocity.Y < 0f && yDist > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > yDist) + else if (Projectile.velocity.Y > yDist) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; + if (Projectile.velocity.Y > 0f && yDist < 0f) + Projectile.velocity.Y -= acceleration; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { //Start homing at player if you hit an enemy - projectile.ai[0] = 1; + Projectile.ai[0] = 1; } public override bool OnTileCollide(Vector2 oldVelocity) { //Bounce off tiles and start homing on player if it hits a tile - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - if (projectile.velocity.X != oldVelocity.X) + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - projectile.ai[0] = 1; + Projectile.ai[0] = 1; return false; } diff --git a/Projectiles/Rogue/LatcherMineProjectile.cs b/Projectiles/Rogue/LatcherMineProjectile.cs index f22f4b8f43..a4bf192ff4 100644 --- a/Projectiles/Rogue/LatcherMineProjectile.cs +++ b/Projectiles/Rogue/LatcherMineProjectile.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -11,55 +12,55 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Latcher Mine"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 27; - projectile.height = 15; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.scale = 1.5f; - projectile.alpha = 0; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 27; + Projectile.height = 15; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.scale = 1.5f; + Projectile.alpha = 0; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.rotation += (projectile.velocity.X > 0) ? 0.3f : -0.3f; - if (projectile.velocity.Y < 7f) + Projectile.rotation += (Projectile.velocity.X > 0) ? 0.3f : -0.3f; + if (Projectile.velocity.Y < 7f) { - projectile.velocity.Y += 0.24f; + Projectile.velocity.Y += 0.24f; } } - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - projectile.tileCollide = false; - int secondsToLive = (projectile.Calamity().stealthStrike ? 14 : 6); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.tileCollide = false; + int secondsToLive = (Projectile.Calamity().stealthStrike ? 14 : 6); bool readyToKillSelf = false; //There was something along the lines of "var_2_2CB4E_cp_0" doing this exact iterative expression, but in 4 times as many lines and barely decipherable variables and copies of arrays. //*shudder* - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= (float)(60 * secondsToLive)) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= (float)(60 * secondsToLive)) { readyToKillSelf = true; } - else if ((int)projectile.ai[1] < 0 || (int)projectile.ai[1] >= 200) + else if ((int)Projectile.ai[1] < 0 || (int)Projectile.ai[1] >= 200) { readyToKillSelf = true; } - else if (Main.npc[(int)projectile.ai[1]].active && !Main.npc[(int)projectile.ai[1]].dontTakeDamage) + else if (Main.npc[(int)Projectile.ai[1]].active && !Main.npc[(int)Projectile.ai[1]].dontTakeDamage) { - projectile.Center = Main.npc[(int)projectile.ai[1]].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[(int)projectile.ai[1]].gfxOffY; - projectile.timeLeft = (int)MathHelper.Min(projectile.timeLeft, 120); + Projectile.Center = Main.npc[(int)Projectile.ai[1]].Center - Projectile.velocity * 2f; + Projectile.gfxOffY = Main.npc[(int)Projectile.ai[1]].gfxOffY; + Projectile.timeLeft = (int)MathHelper.Min(Projectile.timeLeft, 120); } else { @@ -67,55 +68,55 @@ namespace CalamityMod.Projectiles.Rogue } if (readyToKillSelf) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.timeLeft == 1) + if (Projectile.timeLeft == 1) { - projectile.Kill(); + Projectile.Kill(); } } - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - projectile.velocity = Vector2.UnitY * 3f; - projectile.rotation = 0f; + Projectile.velocity = Vector2.UnitY * 3f; + Projectile.rotation = 0f; } - if (projectile.timeLeft == 110 * (projectile.Calamity().stealthStrike ? 2 : 1) || - projectile.timeLeft == 60 * (projectile.Calamity().stealthStrike ? 2 : 1) || - projectile.timeLeft == 24 * (projectile.Calamity().stealthStrike ? 2 : 1)) + if (Projectile.timeLeft == 110 * (Projectile.Calamity().stealthStrike ? 2 : 1) || + Projectile.timeLeft == 60 * (Projectile.Calamity().stealthStrike ? 2 : 1) || + Projectile.timeLeft == 24 * (Projectile.Calamity().stealthStrike ? 2 : 1)) { - projectile.frame++; + Projectile.frame++; } - if (projectile.timeLeft < 24 * (projectile.Calamity().stealthStrike ? 2 : 1)) + if (Projectile.timeLeft < 24 * (Projectile.Calamity().stealthStrike ? 2 : 1)) { - projectile.frameCounter += 1; - if (projectile.frameCounter % 2 == 1) + Projectile.frameCounter += 1; + if (Projectile.frameCounter % 2 == 1) { - projectile.frame += 1; - if (projectile.frame >= 4) + Projectile.frame += 1; + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } } } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - projectile.height = 10; - if (projectile.localAI[1] == 0f) + Projectile.height = 10; + if (Projectile.localAI[1] == 0f) { - projectile.timeLeft = 14 * 60; - projectile.localAI[1] = 1f; + Projectile.timeLeft = 14 * 60; + Projectile.localAI[1] = 1f; } - projectile.ai[0] = 2f; + Projectile.ai[0] = 2f; } - return !projectile.Calamity().stealthStrike; + return !Projectile.Calamity().stealthStrike; } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projdmg = projectile.damage; - projectile.ModifyHitNPCSticky(6, false); + projdmg = Projectile.damage; + Projectile.ModifyHitNPCSticky(6, false); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -129,23 +130,23 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Dig, projectile.Center); - projectile.position = projectile.Center; - projectile.width = projectile.height = (projectile.Calamity().stealthStrike ? 240 : 100); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.Damage(); - for (int i = 0; i < (projectile.Calamity().stealthStrike ? 7 : 4); i++) + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = (Projectile.Calamity().stealthStrike ? 240 : 100); + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.Damage(); + for (int i = 0; i < (Projectile.Calamity().stealthStrike ? 7 : 4); i++) { - if (Main.rand.NextBool(2) && projectile.Calamity().stealthStrike) + if (Main.rand.NextBool(2) && Projectile.Calamity().stealthStrike) { Vector2 shrapnelVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); - Projectile.NewProjectile(projectile.Top, shrapnelVelocity, ModContent.ProjectileType(), projdmg, 3f, projectile.owner); + Projectile.NewProjectile(Projectile.Top, shrapnelVelocity, ModContent.ProjectileType(), projdmg, 3f, Projectile.owner); } else { Vector2 fireVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); - int fireIndex = Projectile.NewProjectile(projectile.Top, fireVelocity, ModContent.ProjectileType(), projdmg / 3, 1f, projectile.owner); + int fireIndex = Projectile.NewProjectile(Projectile.Top, fireVelocity, ModContent.ProjectileType(), projdmg / 3, 1f, Projectile.owner); Main.projectile[fireIndex].localNPCHitCooldown = -2; } } diff --git a/Projectiles/Rogue/LeadTomahawkProj.cs b/Projectiles/Rogue/LeadTomahawkProj.cs index a8a0bd162f..8fdc164707 100644 --- a/Projectiles/Rogue/LeadTomahawkProj.cs +++ b/Projectiles/Rogue/LeadTomahawkProj.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,45 +16,45 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Lead Tomahawk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.penetrate = -1; + Projectile.penetrate = -1; } float rotateratio = 0.019f; - float rotation = (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * rotateratio; - projectile.rotation += rotation * projectile.direction; + float rotation = (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * rotateratio; + Projectile.rotation += rotation * Projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - if (projectile.velocity.Y > 16f) + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } - if (projectile.ai[0] == 0) + if (Projectile.ai[0] == 0) { - projectile.damage *= 2; + Projectile.damage *= 2; } - projectile.ai[0]++; - if (projectile.ai[0] == 10) + Projectile.ai[0]++; + if (Projectile.ai[0] == 10) { - projectile.damage /= 2; + Projectile.damage /= 2; } return; @@ -61,8 +62,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -70,15 +71,15 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.Next(4) == 0) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } } diff --git a/Projectiles/Rogue/LeonidCometBig.cs b/Projectiles/Rogue/LeonidCometBig.cs index b8f9cc9748..1e47da86bb 100644 --- a/Projectiles/Rogue/LeonidCometBig.cs +++ b/Projectiles/Rogue/LeonidCometBig.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class LeonidCometBig : ModProjectile @@ -12,20 +13,20 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Comet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 42; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.tileCollide = false; - projectile.extraUpdates = 2; + Projectile.width = 50; + Projectile.height = 42; + Projectile.aiStyle = 1; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 2; aiType = ProjectileID.Meteor1; } @@ -41,57 +42,57 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/LeonidCometBigGlow"); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, tex.Size() / 2, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = ModContent.Request("CalamityMod/Projectiles/Rogue/LeonidCometBigGlow"); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item89, projectile.position); - projectile.position.X += (float)(projectile.width / 2); - projectile.position.Y += (float)(projectile.height / 2); - projectile.width = (int)(128f * projectile.scale); - projectile.height = (int)(128f * projectile.scale); - projectile.position.X -= (float)(projectile.width / 2); - projectile.position.Y -= (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item89, Projectile.position); + Projectile.position.X += (float)(Projectile.width / 2); + Projectile.position.Y += (float)(Projectile.height / 2); + Projectile.width = (int)(128f * Projectile.scale); + Projectile.height = (int)(128f * Projectile.scale); + Projectile.position.X -= (float)(Projectile.width / 2); + Projectile.position.Y -= (float)(Projectile.height / 2); for (int index = 0; index < 8; ++index) - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0.0f, 0.0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0.0f, 0.0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); for (int index1 = 0; index1 < 32; ++index1) { - int index2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 2.5f); + int index2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 2.5f); Dust dust1 = Main.dust[index2]; dust1.noGravity = true; dust1.velocity *= 3f; - int index3 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); + int index3 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); Dust dust2 = Main.dust[index3]; dust2.velocity *= 2f; dust2.noGravity = true; } for (int index1 = 0; index1 < 2; ++index1) { - int index2 = Gore.NewGore(projectile.position + new Vector2((float) (projectile.width * Main.rand.Next(100)) / 100f, (float) (projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f); + int index2 = Gore.NewGore(Projectile.position + new Vector2((float) (Projectile.width * Main.rand.Next(100)) / 100f, (float) (Projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f); Gore gore = Main.gore[index2]; gore.velocity *= 0.3f; gore.velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f; gore.velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.localAI[1] = -1f; - projectile.maxPenetrate = 0; - projectile.Damage(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.localAI[1] = -1f; + Projectile.maxPenetrate = 0; + Projectile.Damage(); } for (int index1 = 0; index1 < 5; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, Utils.SelectRandom(Main.rand, new int[3]{ DustID.Fire, 259, 158 }), 2.5f * (float) projectile.direction, -2.5f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Utils.SelectRandom(Main.rand, new int[3]{ DustID.Fire, 259, 158 }), 2.5f * (float) Projectile.direction, -2.5f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1f); Dust dust1 = Main.dust[index2]; dust1.alpha = 200; dust1.velocity *= 2.4f; diff --git a/Projectiles/Rogue/LeonidCometSmall.cs b/Projectiles/Rogue/LeonidCometSmall.cs index 3c27e8176a..0878e59898 100644 --- a/Projectiles/Rogue/LeonidCometSmall.cs +++ b/Projectiles/Rogue/LeonidCometSmall.cs @@ -7,6 +7,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class LeonidCometSmall : ModProjectile @@ -18,37 +19,37 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.alpha = 255; + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.alpha = 255; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), projectile.rotation, tex.Size() / 2, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/LeonidProgenitorGlow"); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, tex.Size() / 2, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = ModContent.Request("CalamityMod/Items/Weapons/Rogue/LeonidProgenitorGlow"); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0f); } public override void AI() { - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; if (Main.rand.NextBool(4)) { int randomDust = Utils.SelectRandom(Main.rand, new int[] @@ -58,51 +59,51 @@ namespace CalamityMod.Projectiles.Rogue }); if (Main.rand.NextBool(2)) { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.6f); + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.6f); Main.dust[index].noGravity = true; } if (Main.rand.NextBool(2)) { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.6f); + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.6f); Main.dust[index].noGravity = true; } - int index1 = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.2f); + int index1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.2f); Main.dust[index1].noGravity = true; Main.dust[index1].velocity *= 2f; - Main.dust[index1].velocity += projectile.velocity; - Main.dust[index1].fadeIn = projectile.ai[1] != -1f ? 1.22f : 1.5f; + Main.dust[index1].velocity += Projectile.velocity; + Main.dust[index1].fadeIn = Projectile.ai[1] != -1f ? 1.22f : 1.5f; } - if (projectile.ai[0] >= 0f) + if (Projectile.ai[0] >= 0f) { - ++projectile.ai[0]; - if (projectile.ai[0] >= 20f) + ++Projectile.ai[0]; + if (Projectile.ai[0] >= 20f) { - projectile.velocity.Y += 0.2f; - if (projectile.velocity.Y > 0f) - projectile.velocity.X *= 0.98f; - if (projectile.velocity.Y > 12f) - projectile.velocity.Y = 12f; + Projectile.velocity.Y += 0.2f; + if (Projectile.velocity.Y > 0f) + Projectile.velocity.X *= 0.98f; + if (Projectile.velocity.Y > 12f) + Projectile.velocity.Y = 12f; } } - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; } public override void Kill(int timeLeft) { - if (projectile.owner != Main.myPlayer) + if (Projectile.owner != Main.myPlayer) return; - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner); - projectile.ai[1] = -1f; - projectile.position = projectile.Center; - projectile.width = projectile.height = 40; - projectile.Center = projectile.position; - projectile.Damage(); - Main.PlaySound(SoundID.Item89, projectile.position); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 3, 0f, Projectile.owner); + Projectile.ai[1] = -1f; + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 40; + Projectile.Center = Projectile.position; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item89, Projectile.position); for (int index1 = 0; index1 < 2; ++index1) { - int index2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); + int index2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); Dust dust = Main.dust[index2]; - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * Projectile.width / 2f; } for (int index1 = 0; index1 < 10; ++index1) { @@ -111,17 +112,17 @@ namespace CalamityMod.Projectiles.Rogue ModContent.DustType(), ModContent.DustType() }); - int index2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 2.5f); + int index2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 2.5f); Dust dust = Main.dust[index2]; - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 2f; } for (int index1 = 0; index1 < 5; ++index1) { - int index2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); + int index2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); Dust dust = Main.dust[index2]; - dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)projectile.velocity.ToRotation(), new Vector2()) * projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)Projectile.velocity.ToRotation(), new Vector2()) * Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 2f; } diff --git a/Projectiles/Rogue/LeonidProgenitorBombshell.cs b/Projectiles/Rogue/LeonidProgenitorBombshell.cs index 894c5b53d0..29dad1f592 100644 --- a/Projectiles/Rogue/LeonidProgenitorBombshell.cs +++ b/Projectiles/Rogue/LeonidProgenitorBombshell.cs @@ -7,6 +7,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -21,13 +22,13 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.Calamity().rogue = true; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.Calamity().rogue = true; } public override void AI() @@ -37,47 +38,47 @@ namespace CalamityMod.Projectiles.Rogue ModContent.DustType(), ModContent.DustType() }); - int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 0.8f); + int astral = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 0.8f); Main.dust[astral].noGravity = true; Main.dust[astral].velocity *= 0f; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 10f) { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 10f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if (Projectile.velocity.X > -0.01f && Projectile.velocity.X < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, lightColor, projectile.rotation, tex.Size() / 2, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/LeonidProgenitorGlow"); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, tex.Size() / 2, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = ModContent.Request("CalamityMod/Items/Weapons/Rogue/LeonidProgenitorGlow"); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item62, projectile.position); - if (Main.myPlayer == projectile.owner) + SoundEngine.PlaySound(SoundID.Item62, Projectile.position); + if (Main.myPlayer == Projectile.owner) { - int flash = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 1f); + int flash = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 1f); if (flash.WithinBounds(Main.maxProjectiles)) { Main.projectile[flash].Calamity().forceRogue = true; @@ -85,10 +86,10 @@ namespace CalamityMod.Projectiles.Rogue Main.projectile[flash].localNPCHitCooldown = 10; } - Vector2 pos = new Vector2(projectile.Center.X + projectile.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); - Vector2 velocity = (projectile.Center - pos) / 40f; - int dmg = projectile.damage / 2; - Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + Vector2 pos = new Vector2(Projectile.Center.X + Projectile.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 velocity = (Projectile.Center - pos) / 40f; + int dmg = Projectile.damage / 2; + Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, Projectile.knockBack, Projectile.owner, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); } } @@ -106,7 +107,7 @@ namespace CalamityMod.Projectiles.Rogue private void StealthStrikeEffect() { - if (!projectile.Calamity().stealthStrike || Main.myPlayer != projectile.owner) + if (!Projectile.Calamity().stealthStrike || Main.myPlayer != Projectile.owner) return; Vector2 spinningpoint = new Vector2(0f, 6f); @@ -115,11 +116,11 @@ namespace CalamityMod.Projectiles.Rogue float num3 = -(num1 * 2f) / (cometAmt - 1f); for (int projIndex = 0; projIndex < cometAmt; ++projIndex) { - int index2 = Projectile.NewProjectile(projectile.Center, spinningpoint.RotatedBy((double)num1 + (double)num3 * (double)projIndex, new Vector2()), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, -1f); + int index2 = Projectile.NewProjectile(Projectile.Center, spinningpoint.RotatedBy((double)num1 + (double)num3 * (double)projIndex, new Vector2()), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, -1f); Projectile proj = Main.projectile[index2]; - for (int index3 = 0; index3 < projectile.localNPCImmunity.Length; ++index3) + for (int index3 = 0; index3 < Projectile.localNPCImmunity.Length; ++index3) { - proj.localNPCImmunity[index3] = projectile.localNPCImmunity[index3]; + proj.localNPCImmunity[index3] = Projectile.localNPCImmunity[index3]; } } } diff --git a/Projectiles/Rogue/LeonidStar.cs b/Projectiles/Rogue/LeonidStar.cs index 2d4624a422..62a4f63854 100644 --- a/Projectiles/Rogue/LeonidStar.cs +++ b/Projectiles/Rogue/LeonidStar.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -20,38 +21,38 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 22; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.Calamity().rogue = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -2; + Projectile.width = 22; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.Calamity().rogue = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -2; } public override void AI() { if (!initialized) { - projectile.rotation += Main.rand.NextFloat(); + Projectile.rotation += Main.rand.NextFloat(); initialized = true; } - projectile.ai[0]++; - if (projectile.ai[0] > 120f) + Projectile.ai[0]++; + if (Projectile.ai[0] > 120f) { - projectile.scale *= 0.98f; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, projectile.scale); - if (projectile.scale <= 0.05f) - projectile.Kill(); + Projectile.scale *= 0.98f; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, Projectile.scale); + if (Projectile.scale <= 0.05f) + Projectile.Kill(); } - projectile.rotation += projectile.direction * 0.05f; - if (projectile.soundDelay == 0) + Projectile.rotation += Projectile.direction * 0.05f; + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(9)) { - Main.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); } } } @@ -82,7 +83,7 @@ namespace CalamityMod.Projectiles.Rogue ModContent.DustType() }); - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, Projectile.velocity.X, Projectile.velocity.Y, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); Main.dust[dust].noGravity = true; } for (int num480 = 0; num480 < 3; num480++) @@ -90,7 +91,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); velocity.SafeNormalize(default); velocity *= Main.rand.Next(1, 6) * 0.01f; - Gore.NewGore(projectile.position, velocity, Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, velocity, Main.rand.Next(16, 18), 1f); } } } diff --git a/Projectiles/Rogue/LeviathanTooth.cs b/Projectiles/Rogue/LeviathanTooth.cs index 4600c80119..85bc09684b 100644 --- a/Projectiles/Rogue/LeviathanTooth.cs +++ b/Projectiles/Rogue/LeviathanTooth.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -12,44 +13,44 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Leviathan Tooth"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.timeLeft < 575 && !projectile.Calamity().stealthStrike) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + if (Projectile.timeLeft < 575 && !Projectile.Calamity().stealthStrike) { - projectile.velocity.Y += 0.5f; - if (projectile.velocity.Y > 16f) + Projectile.velocity.Y += 0.5f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } } //Sticky Behaviour - projectile.StickyProjAI(15); + Projectile.StickyProjAI(15); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(6, false); + Projectile.ModifyHitNPCSticky(6, false); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -64,25 +65,25 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - if (projectile.Calamity().lineColor == 1) - tex = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/LeviathanTooth2"); - if (projectile.Calamity().lineColor == 2) - tex = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/LeviathanTooth3"); + Texture2D tex = Main.projectileTexture[Projectile.type]; + if (Projectile.Calamity().lineColor == 1) + tex = ModContent.Request("CalamityMod/Projectiles/Rogue/LeviathanTooth2"); + if (Projectile.Calamity().lineColor == 2) + tex = ModContent.Request("CalamityMod/Projectiles/Rogue/LeviathanTooth3"); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - if (projectile.Calamity().stealthStrike) + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); + if (Projectile.Calamity().stealthStrike) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, tex); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, tex); } return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } @@ -90,7 +91,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(projectile.Center, 1, 1, 33, 0, 0, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 33, 0, 0, 0, default, 1.5f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Rogue/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index 95091f5d87..7ace6e569b 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -19,58 +20,58 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.Calamity().rogue = true; - projectile.timeLeft = CalamityUtils.SecondsToFrames(20f); + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.Calamity().rogue = true; + Projectile.timeLeft = CalamityUtils.SecondsToFrames(20f); } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 45f) + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 45f) { float horizontalMult = 0.98f; float fallSpeed = 0.35f; - projectile.velocity.X *= horizontalMult; - projectile.velocity.Y += fallSpeed; + Projectile.velocity.X *= horizontalMult; + Projectile.velocity.Y += fallSpeed; } - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - if (projectile.timeLeft % 8 == 0 && projectile.owner == Main.myPlayer) + if (Projectile.timeLeft % 8 == 0 && Projectile.owner == Main.myPlayer) { - Vector2 velocity = projectile.DirectionFrom(Main.player[projectile.owner].Center); + Vector2 velocity = Projectile.DirectionFrom(Main.player[Projectile.owner].Center); velocity *= Main.rand.NextFloat(4.5f, 6.5f); velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * Math.PI * 0.5, default); - int spike = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, -10f, 0f); + int spike = Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, -10f, 0f); if (spike.WithinBounds(Main.maxProjectiles)) Main.projectile[spike].Calamity().forceRogue = true; } } } //Sticky Behaviour - projectile.StickyProjAI(15); + Projectile.StickyProjAI(15); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(6, false); + Projectile.ModifyHitNPCSticky(6, false); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -84,28 +85,28 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; + Texture2D tex = Main.projectileTexture[Projectile.type]; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, spriteEffects, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Dig, projectile.position); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 72); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 72); for (int d = 0; d < 3; d++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int d = 0; d < 30; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Rogue/LostSoulFriendly.cs b/Projectiles/Rogue/LostSoulFriendly.cs index 1995f545e3..80ea1580b6 100644 --- a/Projectiles/Rogue/LostSoulFriendly.cs +++ b/Projectiles/Rogue/LostSoulFriendly.cs @@ -10,52 +10,52 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Lost Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 240; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 1; - projectile.alpha = 150; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 1; + Projectile.alpha = 150; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } - public override bool? CanHitNPC(NPC target) => (projectile.timeLeft < 210 || projectile.ai[0] == 2f) && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => (Projectile.timeLeft < 210 || Projectile.ai[0] == 2f) && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; - Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0.25f); - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Lighting.AddLight(Projectile.Center, 0.25f, 0.25f, 0.25f); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - if (projectile.ai[0] != 1f && (projectile.timeLeft < 210 || projectile.ai[0] == 2f)) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); + if (Projectile.ai[0] != 1f && (Projectile.timeLeft < 210 || Projectile.ai[0] == 2f)) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 20f); } // Reduce damage of projectiles if more than the cap are active public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (!projectile.Calamity().rogue) + if (!Projectile.Calamity().rogue) { - int projectileCount = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + int projectileCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type]; int cap = 5; int oldDamage = damage; if (projectileCount > cap) @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int j = 0; j <= 10; j++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 175, 0f, 0f, 100, default, 1f); } } @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/LuminousShard.cs b/Projectiles/Rogue/LuminousShard.cs index fe2613d7a2..3aaae18101 100644 --- a/Projectiles/Rogue/LuminousShard.cs +++ b/Projectiles/Rogue/LuminousShard.cs @@ -16,40 +16,40 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 18; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.Calamity().rogue = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 90 && target.CanBeChasedBy(Projectile); public override void AI() { - if (projectile.ai[0] == 0f && projectile.velocity.X == 0f && projectile.velocity.Y == -2f) + if (Projectile.ai[0] == 0f && Projectile.velocity.X == 0f && Projectile.velocity.Y == -2f) gravity = true; - projectile.ai[0] = 1f; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Projectile.ai[0] = 1f; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; if (gravity) - projectile.velocity.Y *= 1.05f; + Projectile.velocity.Y *= 1.05f; - if (projectile.timeLeft < 90) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 10f, 20f); + if (Projectile.timeLeft < 90) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 10f, 20f); } public override void Kill(int timeLeft) { for (int i = 0; i <= 2; i++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 176, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, default, 0.75f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 176, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, default, 0.75f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 177, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, default, 0.75f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 177, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, default, 0.75f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; } diff --git a/Projectiles/Rogue/LuminousStrikerProj.cs b/Projectiles/Rogue/LuminousStrikerProj.cs index 95bdd05980..277d5b144a 100644 --- a/Projectiles/Rogue/LuminousStrikerProj.cs +++ b/Projectiles/Rogue/LuminousStrikerProj.cs @@ -14,59 +14,59 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Luminous Striker"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 4; - projectile.localNPCHitCooldown = 13; - projectile.usesLocalNPCImmunity = true; - projectile.timeLeft = 120; - projectile.Calamity().rogue = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 4; + Projectile.localNPCHitCooldown = 13; + Projectile.usesLocalNPCImmunity = true; + Projectile.timeLeft = 120; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.ai[0] == 0f && projectile.Calamity().stealthStrike) + if (Projectile.ai[0] == 0f && Projectile.Calamity().stealthStrike) { - projectile.timeLeft = 600; - projectile.ai[0] = 1f; + Projectile.timeLeft = 600; + Projectile.ai[0] = 1f; } if (Main.rand.NextBool(4)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 176, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 176, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver4; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; - if (projectile.timeLeft % 4 == 0) + if (Projectile.timeLeft % 4 == 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - Projectile.NewProjectile(projectile.Center.X + Main.rand.NextFloat(-15f, 15f), projectile.Center.Y + Main.rand.NextFloat(-15f, 15f), projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack * 0.25f, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X + Main.rand.NextFloat(-15f, 15f), Projectile.Center.Y + Main.rand.NextFloat(-15f, 15f), Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner); } else - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, -2f, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack * 0.25f, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0f, -2f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 7; i++) { @@ -77,14 +77,14 @@ namespace CalamityMod.Projectiles.Rogue } speed.Normalize(); speed *= Main.rand.Next(30, 61) * 0.1f * 2f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack * 0.25f, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner); } } } public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 7; i++) { @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Rogue } speed.Normalize(); speed *= Main.rand.Next(30, 61) * 0.1f * 2f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack * 0.25f, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner); } } } @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 10; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 176, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 176, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/LunarKunaiProj.cs b/Projectiles/Rogue/LunarKunaiProj.cs index df1e154e9c..b510c1b7c3 100644 --- a/Projectiles/Rogue/LunarKunaiProj.cs +++ b/Projectiles/Rogue/LunarKunaiProj.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.CalPlayer; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,80 +16,80 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Kunai"); - Main.projFrames[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void AI() { - CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); - projectile.ai[0] += 1f; - if(projectile.ai[0] == 1f && modPlayer.StealthStrikeAvailable()) + CalamityPlayer modPlayer = Main.player[Projectile.owner].Calamity(); + Projectile.ai[0] += 1f; + if(Projectile.ai[0] == 1f && modPlayer.StealthStrikeAvailable()) lunarEnhance = true; - else if (projectile.ai[0] >= 50f) + else if (Projectile.ai[0] >= 50f) lunarEnhance = true; if (lunarEnhance) - projectile.frame = 1; + Projectile.frame = 1; else - projectile.frame = 0; + Projectile.frame = 0; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, lunarEnhance ? 300f : 150f, lunarEnhance ? 12f : 8f, 20f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, lunarEnhance ? 300f : 150f, lunarEnhance ? 12f : 8f, 20f); if (Main.rand.Next(6) == 0 && lunarEnhance) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } public override void Kill(int timeLeft) { if (lunarEnhance) { - Main.PlaySound(SoundID.Item14, projectile.Center); - projectile.position = projectile.Center; - projectile.width = projectile.height = 28; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.damage /= 4; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 28; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.damage /= 4; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; for (int num194 = 0; num194 < 10; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 0, default, 1.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 0, default, 1.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 1f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 229, 0f, 0f, 100, default, 1f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - projectile.Damage(); + Projectile.Damage(); } else { for (int i = 0; i < 5; i++) { - int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 265, 0f, 0f, 100, default, 1f); + int num304 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 265, 0f, 0f, 100, default, 1f); Main.dust[num304].noGravity = true; Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; + Main.dust[num304].velocity -= Projectile.oldVelocity * 0.3f; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/LuxorsGiftRogue.cs b/Projectiles/Rogue/LuxorsGiftRogue.cs index f783897502..c0ebc71f5e 100644 --- a/Projectiles/Rogue/LuxorsGiftRogue.cs +++ b/Projectiles/Rogue/LuxorsGiftRogue.cs @@ -12,71 +12,71 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Gift"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 4; - projectile.aiStyle = 2; - projectile.alpha = 255; - projectile.timeLeft = 300; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.penetrate = 4; + Projectile.aiStyle = 2; + Projectile.alpha = 255; + Projectile.timeLeft = 300; aiType = ProjectileID.ThrowingKnife; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.localAI[0] == 0f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + if (Projectile.localAI[0] == 0f) { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 250) + Projectile.scale -= 0.01f; + Projectile.alpha += 15; + if (Projectile.alpha >= 250) { - projectile.alpha = 255; - projectile.localAI[0] = 1f; + Projectile.alpha = 255; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[0] = 0f; + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; } } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 3f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 3f) { for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; + Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 1f); + vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); + int num9 = Dust.NewDust(Projectile.Center, 0, 0, 173, 0f, 0f, 160, default, 1f); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Main.dust[num9].position = Projectile.Center + vector3; + Main.dust[num9].velocity = Projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -85,20 +85,20 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/MalachiteBolt.cs b/Projectiles/Rogue/MalachiteBolt.cs index 82c6e781f8..d18ce37ea5 100644 --- a/Projectiles/Rogue/MalachiteBolt.cs +++ b/Projectiles/Rogue/MalachiteBolt.cs @@ -14,39 +14,39 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Malachite"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.alpha = 255; - projectile.extraUpdates = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().rogue = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.alpha = 255; + Projectile.extraUpdates = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; - projectile.alpha -= 3; - if (projectile.alpha < 100) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + Projectile.alpha -= 3; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 4f) { for (int num468 = 0; num468 < 3; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -55,26 +55,26 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, 203, 103, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, 203, 103, Projectile.alpha); public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.penetrate <= 1) + if (Projectile.penetrate <= 1) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 160; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 160; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); for (int num621 = 0; num621 < 70; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -84,10 +84,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[num624].velocity *= 2f; } } @@ -95,18 +95,18 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.penetrate <= 1) + if (Projectile.penetrate <= 1) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 160; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 160; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); for (int num621 = 0; num621 < 70; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -116,10 +116,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[num624].velocity *= 2f; } } @@ -127,13 +127,13 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 16; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 16; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 7; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -143,10 +143,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 3; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Rogue/MalachiteProj.cs b/Projectiles/Rogue/MalachiteProj.cs index ad2aa19365..88685b0135 100644 --- a/Projectiles/Rogue/MalachiteProj.cs +++ b/Projectiles/Rogue/MalachiteProj.cs @@ -13,40 +13,40 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Malachite"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.extraUpdates = 3; - projectile.aiStyle = 93; + Projectile.width = 12; + Projectile.height = 12; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.alpha = 255; + Projectile.extraUpdates = 3; + Projectile.aiStyle = 93; aiType = ProjectileID.NailFriendly; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 1; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.alpha -= 3; - if (projectile.alpha < 30) + Projectile.alpha -= 3; + if (Projectile.alpha < 30) { - projectile.alpha = 30; + Projectile.alpha = 30; } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 4f) { for (int num468 = 0; num468 < 3; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -55,21 +55,21 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, 203, 103, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, 203, 103, Projectile.alpha); public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 48; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 48; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 7; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -79,10 +79,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 15; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Rogue/MalachiteStealth.cs b/Projectiles/Rogue/MalachiteStealth.cs index ab22d5a024..df455cf02f 100644 --- a/Projectiles/Rogue/MalachiteStealth.cs +++ b/Projectiles/Rogue/MalachiteStealth.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -14,37 +15,37 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Malachite"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.Calamity().rogue = true; - projectile.tileCollide = false; - projectile.timeLeft = lifeSpan; - projectile.extraUpdates = 2; + Projectile.width = 12; + Projectile.height = 12; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.Calamity().rogue = true; + Projectile.tileCollide = false; + Projectile.timeLeft = lifeSpan; + Projectile.extraUpdates = 2; } public override void AI() { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 10f, 25f); - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 300f, 10f, 25f); + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 4f) { for (int num468 = 0; num468 < 3; num468++) { - int num469 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -52,41 +53,41 @@ namespace CalamityMod.Projectiles.Rogue } else { - int id = (int)projectile.ai[1]; + int id = (int)Projectile.ai[1]; if (id.WithinBounds(Main.maxNPCs) && Main.npc[id].active && !Main.npc[id].dontTakeDamage) { - projectile.Center = Main.npc[id].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[id].gfxOffY; + Projectile.Center = Main.npc[id].Center - Projectile.velocity * 2f; + Projectile.gfxOffY = Main.npc[id].gfxOffY; } else { - projectile.Kill(); + Projectile.Kill(); } } - projectile.alpha -= 3; - if (projectile.alpha < 30) + Projectile.alpha -= 3; + if (Projectile.alpha < 30) { - projectile.alpha = 30; + Projectile.alpha = 30; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, 203, 103, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, 203, 103, Projectile.alpha); public override void Kill(int timeLeft) { - projectile.ai[0] = 2f; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 112); - Main.PlaySound(SoundID.Item14, projectile.position); + Projectile.ai[0] = 2f; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 112); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 7; i++) { - int dusty = Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[dusty].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -96,26 +97,26 @@ namespace CalamityMod.Projectiles.Rogue } for (int j = 0; j < 15; j++) { - int green = Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int green = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[green].noGravity = true; Main.dust[green].velocity *= 5f; - green = Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + green = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[green].velocity *= 2f; } - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 0; - projectile.extraUpdates = 0; - projectile.ai[0] = 1f; - projectile.ai[1] = target.whoAmI; - projectile.velocity = target.Center - projectile.Center; - projectile.velocity *= 0.75f; - projectile.netUpdate = true; + target.immune[Projectile.owner] = 0; + Projectile.extraUpdates = 0; + Projectile.ai[0] = 1f; + Projectile.ai[1] = target.whoAmI; + Projectile.velocity = target.Center - Projectile.Center; + Projectile.velocity *= 0.75f; + Projectile.netUpdate = true; const int maxKunai = 3; int kunaiFound = 0; @@ -123,7 +124,7 @@ namespace CalamityMod.Projectiles.Rogue int oldestKunaiTimeLeft = lifeSpan; for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == projectile.type && i != projectile.whoAmI && Main.projectile[i].ai[1] == target.whoAmI) + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == Projectile.type && i != Projectile.whoAmI && Main.projectile[i].ai[1] == target.whoAmI) { kunaiFound++; if (Main.projectile[i].timeLeft < oldestKunaiTimeLeft) @@ -141,6 +142,6 @@ namespace CalamityMod.Projectiles.Rogue } } - public override bool CanDamage() => projectile.ai[0] != 1f; + public override bool CanDamage() => Projectile.ai[0] != 1f; } } diff --git a/Projectiles/Rogue/MangroveChakramFlower.cs b/Projectiles/Rogue/MangroveChakramFlower.cs index 9c9b091948..672691277d 100644 --- a/Projectiles/Rogue/MangroveChakramFlower.cs +++ b/Projectiles/Rogue/MangroveChakramFlower.cs @@ -2,6 +2,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class MangroveChakramFlower : ModProjectile @@ -15,20 +16,20 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.friendly = true; - projectile.timeLeft = 60; - projectile.penetrate = -1; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.width = Projectile.height = 30; + Projectile.friendly = true; + Projectile.timeLeft = 60; + Projectile.penetrate = -1; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() { - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.985f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; + Projectile.velocity.X *= 0.95f; + Projectile.velocity.Y *= 0.985f; for (int dust = 0; dust < 2; dust++) { int randomDust = Utils.SelectRandom(Main.rand, new int[] @@ -37,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue 58, 204 }); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } @@ -51,9 +52,9 @@ namespace CalamityMod.Projectiles.Rogue 58, 204 }); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - Main.PlaySound(SoundID.Item105, projectile.position); + SoundEngine.PlaySound(SoundID.Item105, Projectile.position); } } } diff --git a/Projectiles/Rogue/MangroveChakramProjectile.cs b/Projectiles/Rogue/MangroveChakramProjectile.cs index f91ce93c55..b0fe0ecdef 100644 --- a/Projectiles/Rogue/MangroveChakramProjectile.cs +++ b/Projectiles/Rogue/MangroveChakramProjectile.cs @@ -17,49 +17,49 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 600; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 3; + Projectile.timeLeft = 600; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0f); if (Main.rand.NextBool(5)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - if (projectile.Calamity().stealthStrike) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 44, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + if (Projectile.Calamity().stealthStrike) { // Die early. - if (projectile.timeLeft < 240) - projectile.Kill(); + if (Projectile.timeLeft < 240) + Projectile.Kill(); - projectile.localAI[0] += Main.rand.Next(0,3); - if (projectile.localAI[0] >= 10f) + Projectile.localAI[0] += Main.rand.Next(0,3); + if (Projectile.localAI[0] >= 10f) { - projectile.localAI[0] = 0f; - Vector2 flowerSpawnPosition = projectile.Center + Main.rand.NextVector2Square(-10f, 10f); - Vector2 flowerShootVelocity = projectile.velocity.RotatedByRandom(0.1f) * 0.25f; - Projectile.NewProjectile(flowerSpawnPosition, flowerShootVelocity, ModContent.ProjectileType(), projectile.damage / 4, 0f, projectile.owner); + Projectile.localAI[0] = 0f; + Vector2 flowerSpawnPosition = Projectile.Center + Main.rand.NextVector2Square(-10f, 10f); + Vector2 flowerShootVelocity = Projectile.velocity.RotatedByRandom(0.1f) * 0.25f; + Projectile.NewProjectile(flowerSpawnPosition, flowerShootVelocity, ModContent.ProjectileType(), Projectile.damage / 4, 0f, Projectile.owner); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[Projectile.owner] = 6; target.AddBuff(BuffID.CursedInferno, 120); } diff --git a/Projectiles/Rogue/MetalChunk.cs b/Projectiles/Rogue/MetalChunk.cs index 209230b1c6..48eabcbfc0 100644 --- a/Projectiles/Rogue/MetalChunk.cs +++ b/Projectiles/Rogue/MetalChunk.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,51 +17,51 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; //Its hella heavy so ofc - projectile.extraUpdates = 1; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; //Its hella heavy so ofc + Projectile.extraUpdates = 1; } public override void AI() { //Gravity - projectile.velocity.Y += 0.11f; - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; + Projectile.velocity.Y += 0.11f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; //Rotation - projectile.rotation += 0.14f * projectile.direction; - if (projectile.Calamity().stealthStrike) + Projectile.rotation += 0.14f * Projectile.direction; + if (Projectile.Calamity().stealthStrike) { - projectile.ai[0]++; - if(projectile.ai[0] >= 10f) + Projectile.ai[0]++; + if(Projectile.ai[0] >= 10f) { Vector2 speed = new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-6f, 6f)); - Projectile.NewProjectile(projectile.Center, speed, ModContent.ProjectileType(), (int)(projectile.damage * 0.3f), 0f, projectile.owner, 0f, 0f); - projectile.ai[0] = 0f; + Projectile.NewProjectile(Projectile.Center, speed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 0f, Projectile.owner, 0f, 0f); + Projectile.ai[0] = 0f; } } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCHit42, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit42, Projectile.Center); for (int i = 0; i < 3; i++) { - Vector2 S1 = new Vector2(-projectile.velocity.X, -projectile.velocity.Y).RotatedBy(MathHelper.ToRadians(Main.rand.Next(-45, 46))); - int proj = Projectile.NewProjectile(projectile.Center, S1, ProjectileID.SpikyBall, (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + Vector2 S1 = new Vector2(-Projectile.velocity.X, -Projectile.velocity.Y).RotatedBy(MathHelper.ToRadians(Main.rand.Next(-45, 46))); + int proj = Projectile.NewProjectile(Projectile.Center, S1, ProjectileID.SpikyBall, (int)(Projectile.damage * 0.3), 0f, Projectile.owner, 0f, 0f); Main.projectile[proj].timeLeft = 600; Main.projectile[proj].usesLocalNPCImmunity = true; Main.projectile[proj].localNPCHitCooldown = 20; - S1 = new Vector2(-projectile.velocity.X * 0.7f, -projectile.velocity.Y*0.7f).RotatedBy(MathHelper.ToRadians(Main.rand.Next(-45, 46))); - Projectile.NewProjectile(projectile.Center, S1, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + S1 = new Vector2(-Projectile.velocity.X * 0.7f, -Projectile.velocity.Y*0.7f).RotatedBy(MathHelper.ToRadians(Main.rand.Next(-45, 46))); + Projectile.NewProjectile(Projectile.Center, S1, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 0f, Projectile.owner, 0f, 0f); } //Dust for (int i = 0; i < 20; i++) { - Dust.NewDust(projectile.Center, 1, 1, DustID.Lead, 0f, 0f, 0, default, 1.1f); + Dust.NewDust(Projectile.Center, 1, 1, DustID.Lead, 0f, 0f, 0, default, 1.1f); } } } diff --git a/Projectiles/Rogue/MetalShard.cs b/Projectiles/Rogue/MetalShard.cs index 79ff5c1708..49601585ec 100644 --- a/Projectiles/Rogue/MetalShard.cs +++ b/Projectiles/Rogue/MetalShard.cs @@ -4,6 +4,7 @@ using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,32 +17,32 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 12; - projectile.height = 12; - projectile.Calamity().rogue = true; - projectile.penetrate = 10; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 60; + Projectile.friendly = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.Calamity().rogue = true; + Projectile.penetrate = 10; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; } public override void AI() { //Rotation - if (projectile.ai[0] == 0f) - projectile.rotation += 0.1f; + if (Projectile.ai[0] == 0f) + Projectile.rotation += 0.1f; //Gravity - projectile.velocity.Y += 0.1f; - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; + Projectile.velocity.Y += 0.1f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; //Sticky Behaviour - projectile.StickyProjAI(15); + Projectile.StickyProjAI(15); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(8 , true); + Projectile.ModifyHitNPCSticky(8 , true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -56,19 +57,19 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D texture; - if (projectile.localAI[1] == 0f) - projectile.localAI[1] = Main.rand.Next(1, 4); - switch (projectile.localAI[1]) + if (Projectile.localAI[1] == 0f) + Projectile.localAI[1] = Main.rand.Next(1, 4); + switch (Projectile.localAI[1]) { - case 2f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/MetalShard2"); + case 2f: texture = ModContent.Request("CalamityMod/Projectiles/Rogue/MetalShard2"); break; - case 3f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/MetalShard3"); + case 3f: texture = ModContent.Request("CalamityMod/Projectiles/Rogue/MetalShard3"); break; - default: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/MetalShard"); + default: texture = ModContent.Request("CalamityMod/Projectiles/Rogue/MetalShard"); break; } - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -76,13 +77,13 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 6; i++) { - Dust.NewDust(projectile.Center, projectile.width, projectile.height, DustID.Lead, 0f, 0f, 0, default, 1f); + Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Lead, 0f, 0f, 0, default, 1f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - Main.PlaySound(SoundID.Dig, projectile.Center); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); return true; } } diff --git a/Projectiles/Rogue/MeteorFistProj.cs b/Projectiles/Rogue/MeteorFistProj.cs index 823898ff73..bbc3484684 100644 --- a/Projectiles/Rogue/MeteorFistProj.cs +++ b/Projectiles/Rogue/MeteorFistProj.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,18 +16,18 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 360; - projectile.Calamity().rogue = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 360; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.velocity.Length() >= 4f) + if (Projectile.velocity.Length() >= 4f) { for (int num246 = 0; num246 < 2; num246++) { @@ -34,10 +35,10 @@ namespace CalamityMod.Projectiles.Rogue float num248 = 0f; if (num246 == 1) { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; + num247 = Projectile.velocity.X * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); + int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; @@ -45,55 +46,55 @@ namespace CalamityMod.Projectiles.Rogue } // Almost instantly accelerate to very high speed - if (projectile.velocity.Length() < 12f) + if (Projectile.velocity.Length() < 12f) { - projectile.velocity *= 1.25f; + Projectile.velocity *= 1.25f; } else if (Main.rand.NextBool(2)) { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 0.5f); + int num252 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 0.5f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 0.5f); + num252 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 0.5f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } - projectile.ai[0] += 1f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.ai[0] > 10f || Projectile.ai[0] > 5f) { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 10f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X *= 0.97f; - if (Math.Abs(projectile.velocity.X) < 0.01f) + Projectile.velocity.X *= 0.97f; + if (Math.Abs(Projectile.velocity.X) < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - if (!projectile.Calamity().stealthStrike) - projectile.velocity.Y += 0.1f; + if (!Projectile.Calamity().stealthStrike) + Projectile.velocity.Y += 0.1f; } } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 32); - projectile.maxPenetrate = projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.position); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 32); + Projectile.maxPenetrate = Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -103,13 +104,13 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -118,14 +119,14 @@ namespace CalamityMod.Projectiles.Rogue float minDist = 999f; int index = 0; // Get the closest enemy to the fist - if (projectile.Calamity().stealthStrike && projectile.ai[1] > 0f && projectile.penetrate != -1) + if (Projectile.Calamity().stealthStrike && Projectile.ai[1] > 0f && Projectile.penetrate != -1) { for (int i = 0; i < Main.npc.Length; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false) && npc != target) + if (npc.CanBeChasedBy(Projectile, false) && npc != target) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < minDist) { minDist = dist; @@ -136,16 +137,16 @@ namespace CalamityMod.Projectiles.Rogue Vector2 newFistVelocity; if (minDist < 999f) { - newFistVelocity = Main.npc[index].Center - projectile.Center; + newFistVelocity = Main.npc[index].Center - Projectile.Center; } else { - newFistVelocity = -projectile.velocity; + newFistVelocity = -Projectile.velocity; } newFistVelocity.Normalize(); newFistVelocity *= 10f; - float AI1 = projectile.ai[1] - 1f; - int p = Projectile.NewProjectile(projectile.position, newFistVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0, AI1); + float AI1 = Projectile.ai[1] - 1f; + int p = Projectile.NewProjectile(Projectile.position, newFistVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, AI1); Main.projectile[p].Calamity().stealthStrike = true; } } diff --git a/Projectiles/Rogue/MoltenAmputatorProj.cs b/Projectiles/Rogue/MoltenAmputatorProj.cs index 6ac60a44ee..a914d2e74d 100644 --- a/Projectiles/Rogue/MoltenAmputatorProj.cs +++ b/Projectiles/Rogue/MoltenAmputatorProj.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,27 +17,27 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Molten Amputator"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 74; - projectile.height = 74; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.timeLeft = 180; - projectile.Calamity().rogue = true; + Projectile.width = 74; + Projectile.height = 74; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; + Projectile.timeLeft = 180; + Projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -51,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue } iAmSpeed.Normalize(); iAmSpeed *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, iAmSpeed.X, iAmSpeed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, iAmSpeed.X, iAmSpeed.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 0f, Projectile.owner, 0f, 0f); } } @@ -60,58 +61,58 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { // Stealth strikes constantly spawn molten blobs. - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { // If the stealth blob timer isn't set up yet, set it up - if (projectile.ai[1] == 0f) - projectile.ai[1] = FramesPerBlob; + if (Projectile.ai[1] == 0f) + Projectile.ai[1] = FramesPerBlob; else { - projectile.ai[1]--; - if (projectile.ai[1] <= 0f) + Projectile.ai[1]--; + if (Projectile.ai[1] <= 0f) { SpawnBlobs(1); - projectile.ai[1] = FramesPerBlob; + Projectile.ai[1] = FramesPerBlob; } } } // Frame 1, pick a direction for the scythe. This direction isn't changed from that point on - if (projectile.ai[0] == 0f) - projectile.spriteDirection = projectile.direction; + if (Projectile.ai[0] == 0f) + Projectile.spriteDirection = Projectile.direction; // Boomerang glows orange - Lighting.AddLight(projectile.Center, 0.65f, 0.45f, 0f); + Lighting.AddLight(Projectile.Center, 0.65f, 0.45f, 0f); // Boomerang noises - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } // Main boomerang logic. projectile.ai[0] is a frame counter. - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; // On the first returning frame, send a net update. - if (projectile.ai[0] == FramesBeforeReturning) - projectile.netUpdate = true; + if (Projectile.ai[0] == FramesBeforeReturning) + Projectile.netUpdate = true; // Once returning, use boomerang return AI. - if (projectile.ai[0] >= FramesBeforeReturning) + if (Projectile.ai[0] >= FramesBeforeReturning) { float returnSpeed = MoltenAmputator.Speed * 2f; float acceleration = 1.15f; - Player owner = Main.player[projectile.owner]; - Vector2 delta = owner.Center - projectile.Center; + Player owner = Main.player[Projectile.owner]; + Vector2 delta = owner.Center - Projectile.Center; float dx = delta.X; float dy = delta.Y; // If the boomerang is excessively far away, destroy it. float dist = delta.Length(); if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); // Homing vector math (the boomerang homes in on the player using rather ugly code) dist = returnSpeed / dist; @@ -119,75 +120,75 @@ namespace CalamityMod.Projectiles.Rogue dy *= dist; // X/Y specific boomerang return code. This is what gives them their unique flight path. - if (projectile.velocity.X < dx) + if (Projectile.velocity.X < dx) { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && dx > 0f) + Projectile.velocity.X = Projectile.velocity.X + acceleration; + if (Projectile.velocity.X < 0f && dx > 0f) { - projectile.velocity.X = projectile.velocity.X + acceleration; + Projectile.velocity.X = Projectile.velocity.X + acceleration; } } - else if (projectile.velocity.X > dx) + else if (Projectile.velocity.X > dx) { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && dx < 0f) + Projectile.velocity.X = Projectile.velocity.X - acceleration; + if (Projectile.velocity.X > 0f && dx < 0f) { - projectile.velocity.X = projectile.velocity.X - acceleration; + Projectile.velocity.X = Projectile.velocity.X - acceleration; } } - if (projectile.velocity.Y < dy) + if (Projectile.velocity.Y < dy) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && dy > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; + if (Projectile.velocity.Y < 0f && dy > 0f) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; } } - else if (projectile.velocity.Y > dy) + else if (Projectile.velocity.Y > dy) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && dy < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; + if (Projectile.velocity.Y > 0f && dy < 0f) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; } } // Destroy the boomerang when it returns to the player. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); } // Rotate the scythe as it flies. - float spin = projectile.spriteDirection <= 0 ? -1f : 1f; - projectile.rotation += spin * 0.38f; + float spin = Projectile.spriteDirection <= 0 ? -1f : 1f; + Projectile.rotation += spin * 0.38f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int blobCount = projectile.Calamity().stealthStrike ? 4 : 2; + int blobCount = Projectile.Calamity().stealthStrike ? 4 : 2; SpawnBlobs(blobCount); } - Main.PlaySound(SoundID.Item20, projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int blobCount = projectile.Calamity().stealthStrike ? 4 : 2; + int blobCount = Projectile.Calamity().stealthStrike ? 4 : 2; SpawnBlobs(blobCount); } - Main.PlaySound(SoundID.Item20, projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/MoltenBlobThrown.cs b/Projectiles/Rogue/MoltenBlobThrown.cs index e022e00f39..f4e668c5a9 100644 --- a/Projectiles/Rogue/MoltenBlobThrown.cs +++ b/Projectiles/Rogue/MoltenBlobThrown.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class MoltenBlobThrown : ModProjectile @@ -11,43 +12,43 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Molten Blob"); - Main.projFrames[projectile.type] = 2; + Main.projFrames[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.Calamity().rogue = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.velocity.X *= 0.95f; - if (projectile.wet || projectile.lavaWet) + Projectile.velocity.X *= 0.95f; + if (Projectile.wet || Projectile.lavaWet) { - projectile.velocity.Y = 0f; + Projectile.velocity.Y = 0f; } else { - projectile.velocity.Y = projectile.velocity.Y + 0.1f; - if (projectile.velocity.Y > 5f) + Projectile.velocity.Y = Projectile.velocity.Y + 0.1f; + if (Projectile.velocity.Y > 5f) { - projectile.velocity.Y = 5f; + Projectile.velocity.Y = 5f; } } - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 1) + if (Projectile.frame > 1) { - projectile.frame = 0; + Projectile.frame = 0; } } @@ -61,21 +62,21 @@ namespace CalamityMod.Projectiles.Rogue public override Color? GetAlpha(Color lightColor) { - return new Color(250, 150, 0, projectile.alpha); + return new Color(250, 150, 0, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 10; - projectile.height = 10; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 10; + Projectile.height = 10; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; @@ -84,9 +85,9 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); } } } diff --git a/Projectiles/Rogue/MonkeyDart.cs b/Projectiles/Rogue/MonkeyDart.cs index cb30ebf317..1520654e9e 100644 --- a/Projectiles/Rogue/MonkeyDart.cs +++ b/Projectiles/Rogue/MonkeyDart.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -12,41 +13,41 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Monkey Dart"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 6; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 6; drawOffsetX = -10; drawOriginOffsetY = 0; drawOriginOffsetX = 0; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; - projectile.extraUpdates = 2; - projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; + Projectile.extraUpdates = 2; + Projectile.Calamity().rogue = true; } public override void AI() { //Code to make it not shoot backwards - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); //Gravity - projectile.velocity.Y = projectile.velocity.Y + 0.04f; - if (projectile.velocity.Y > 16f) + Projectile.velocity.Y = Projectile.velocity.Y + 0.04f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } //Dust trail if (Main.rand.Next(25) == 0) { - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 21, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 150, default, 0.9f); - Main.dust[d].position = projectile.Center; + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 21, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150, default, 0.9f); + Main.dust[d].position = Projectile.Center; Main.dust[d].noLight = true; } } @@ -59,20 +60,20 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Dig, projectile.position); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); //Dust splash int dustsplash = 0; while (dustsplash < 4) { - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 1, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 100, default, 0.9f); - Main.dust[d].position = projectile.Center; + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 1, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 100, default, 0.9f); + Main.dust[d].position = Projectile.Center; dustsplash += 1; } //Randomly not consume item if it wasnt a stealth strike - if (Main.rand.Next(4) == 0 && projectile.ai[0] != 1) + if (Main.rand.Next(4) == 0 && Projectile.ai[0] != 1) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, 27, 27, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, 27, 27, ModContent.ItemType()); } } @@ -80,26 +81,26 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { //This makes the projectile only bounce once - if (projectile.ai[0] == 1) + if (Projectile.ai[0] == 1) { - if (projectile.ai[1] >= 1f) + if (Projectile.ai[1] >= 1f) { - projectile.Kill(); + Projectile.Kill(); } else { //Code for bouncing - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - if (projectile.velocity.X != oldVelocity.X) + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; } return false; } @@ -108,9 +109,9 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.ai[0] == 1) + if (Projectile.ai[0] == 1) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } return true; diff --git a/Projectiles/Rogue/MoonSigil.cs b/Projectiles/Rogue/MoonSigil.cs index e185d0e8c8..ae3b655177 100644 --- a/Projectiles/Rogue/MoonSigil.cs +++ b/Projectiles/Rogue/MoonSigil.cs @@ -13,38 +13,38 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.ignoreWater = true; - projectile.timeLeft = 250; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().rogue = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.ignoreWater = true; + Projectile.timeLeft = 250; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.timeLeft < 52) + if (Projectile.timeLeft < 52) { - projectile.alpha += 5; - projectile.scale -= 0.013f; + Projectile.alpha += 5; + Projectile.scale -= 0.013f; } - if (projectile.alpha >= 255) + if (Projectile.alpha >= 255) { - projectile.alpha = 255; - projectile.Kill(); + Projectile.alpha = 255; + Projectile.Kill(); return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 8f, 20f); } // Reduce damage of projectiles if more than the cap are active public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - int projectileCount = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + int projectileCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type]; int cap = 5; int oldDamage = damage; if (projectileCount > cap) @@ -64,9 +64,9 @@ namespace CalamityMod.Projectiles.Rogue for (int j = 0; j < 5; j++) { Vector2 dustspeed = new Vector2(dustSp, dustSp).RotatedBy(MathHelper.ToRadians(dustD)); - int d = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 31, dustspeed.X, dustspeed.Y, 200, new Color(213, 242, 232, 200), 1f); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 31, dustspeed.X, dustspeed.Y, 200, new Color(213, 242, 232, 200), 1f); Main.dust[d].noGravity = true; - Main.dust[d].position = projectile.Center; + Main.dust[d].position = Projectile.Center; Main.dust[d].velocity = dustspeed; dustSp += 0.2f; } @@ -77,20 +77,20 @@ namespace CalamityMod.Projectiles.Rogue public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/MoonSigil"); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Rogue/MoonSigil"); spriteBatch.Draw ( texture, new Vector2 ( - projectile.position.X - Main.screenPosition.X + projectile.width * 0.5f, - projectile.position.Y - Main.screenPosition.Y + projectile.height - 20 * 0.5f + Projectile.position.X - Main.screenPosition.X + Projectile.width * 0.5f, + Projectile.position.Y - Main.screenPosition.Y + Projectile.height - 20 * 0.5f ), new Rectangle(0, 0, 20, 20), Color.White, - projectile.rotation, + Projectile.rotation, new Vector2(10, 10), - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f ); diff --git a/Projectiles/Rogue/MycorootProj.cs b/Projectiles/Rogue/MycorootProj.cs index fe474d2eca..d500be334d 100644 --- a/Projectiles/Rogue/MycorootProj.cs +++ b/Projectiles/Rogue/MycorootProj.cs @@ -16,32 +16,32 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.Calamity().rogue = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.Calamity().rogue = true; } public override void AI() { if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, 0f, 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, 0f, 0f); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - projectile.alpha += 20; - if (projectile.alpha >= 255) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + Projectile.alpha += 20; + if (Projectile.alpha >= 255) { - projectile.Kill(); + Projectile.Kill(); } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.5f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Rogue/MythrilKnifeProjectile.cs b/Projectiles/Rogue/MythrilKnifeProjectile.cs index 4683ef7795..360ec75c94 100644 --- a/Projectiles/Rogue/MythrilKnifeProjectile.cs +++ b/Projectiles/Rogue/MythrilKnifeProjectile.cs @@ -19,32 +19,32 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 2; + Projectile.timeLeft = 600; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; @@ -52,8 +52,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -61,13 +61,13 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (!projectile.Calamity().stealthStrike) + if (!Projectile.Calamity().stealthStrike) return; target.AddBuff(BuffID.CursedInferno, 300); @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - if (!projectile.Calamity().stealthStrike) + if (!Projectile.Calamity().stealthStrike) return; target.AddBuff(BuffID.CursedInferno, 300); diff --git a/Projectiles/Rogue/NanoblackMain.cs b/Projectiles/Rogue/NanoblackMain.cs index de14c579d4..1504066043 100644 --- a/Projectiles/Rogue/NanoblackMain.cs +++ b/Projectiles/Rogue/NanoblackMain.cs @@ -22,23 +22,23 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Nanoblack Reaper"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 56; - projectile.height = 56; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.timeLeft = Lifetime; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - projectile.Calamity().rogue = true; + Projectile.width = 56; + Projectile.height = 56; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 2; + Projectile.timeLeft = Lifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.Calamity().rogue = true; } public override void AI() @@ -48,8 +48,8 @@ namespace CalamityMod.Projectiles.Rogue drawOriginOffsetX = 0; // Initialize the frame counter and random blade delay on the very first frame. - if (projectile.timeLeft == Lifetime) - projectile.ai[1] = projectile.Calamity().stealthStrike ? 4f : GetBladeDelay(); + if (Projectile.timeLeft == Lifetime) + Projectile.ai[1] = Projectile.Calamity().stealthStrike ? 4f : GetBladeDelay(); // Produces electricity and green firework sparks constantly while in flight. if (Main.rand.NextBool(3)) @@ -57,94 +57,94 @@ namespace CalamityMod.Projectiles.Rogue int dustType = Main.rand.NextBool(5) ? 226 : 220; float scale = 0.8f + Main.rand.NextFloat(0.3f); float velocityMult = Main.rand.NextFloat(0.3f, 0.6f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); Main.dust[idx].noGravity = true; - Main.dust[idx].velocity = velocityMult * projectile.velocity; + Main.dust[idx].velocity = velocityMult * Projectile.velocity; Main.dust[idx].scale = scale; } // ai[0] is a frame counter. ai[1] is a countdown to spawning the next nanoblack energy blade. - projectile.ai[0] += 1f; - projectile.ai[1] -= 1f; + Projectile.ai[0] += 1f; + Projectile.ai[1] -= 1f; // On the frame the scythe begins returning, send a net update. - if (projectile.ai[0] == ReboundTime) - projectile.netUpdate = true; + if (Projectile.ai[0] == ReboundTime) + Projectile.netUpdate = true; // The scythe runs its returning AI if the frame counter is greater than ReboundTime. - if (projectile.ai[0] >= ReboundTime) + if (Projectile.ai[0] >= ReboundTime) { float returnSpeed = NanoblackReaperRogue.Speed; float acceleration = 2.4f; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; // Delete the scythe if it's excessively far away. Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); dist = returnSpeed / dist; xDist *= dist; yDist *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) + if (Projectile.velocity.X < xDist) { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X = Projectile.velocity.X + acceleration; + if (Projectile.velocity.X < 0f && xDist > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > xDist) + else if (Projectile.velocity.X > xDist) { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X = Projectile.velocity.X - acceleration; + if (Projectile.velocity.X > 0f && xDist < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < yDist) + if (Projectile.velocity.Y < yDist) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; + if (Projectile.velocity.Y < 0f && yDist > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > yDist) + else if (Projectile.velocity.Y > yDist) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; + if (Projectile.velocity.Y > 0f && yDist < 0f) + Projectile.velocity.Y -= acceleration; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); } // Create nanoblack energy blades at a somewhat-random rate while in flight. (or full-sized scythes afterimages if stealth strike) - if (projectile.ai[1] <= 0f) + if (Projectile.ai[1] <= 0f) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { SpawnScytheAfterimage(); - projectile.ai[1] = 4f; + Projectile.ai[1] = 4f; } else { SpawnEnergyBlade(); - projectile.ai[1] = GetBladeDelay(); + Projectile.ai[1] = GetBladeDelay(); } } // Rotate the scythe as it flies. - float spin = projectile.direction <= 0 ? -1f : 1f; - projectile.rotation += spin * RotationIncrement; + float spin = Projectile.direction <= 0 ? -1f : 1f; + Projectile.rotation += spin * RotationIncrement; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -156,28 +156,28 @@ namespace CalamityMod.Projectiles.Rogue private void SpawnEnergyBlade() { int bladeID = ModContent.ProjectileType(); - int bladeDamage = projectile.damage / 3; + int bladeDamage = Projectile.damage / 3; float bladeKB = 3f; - float spin = projectile.direction <= 0 ? -1f : 1f; + float spin = Projectile.direction <= 0 ? -1f : 1f; float d = 16f; float velocityMult = 0.9f; Vector2 directOffset = new Vector2(Main.rand.NextFloat(-d, d), Main.rand.NextFloat(-d, d)); - Vector2 velocityOffset = Main.rand.NextFloat(-velocityMult, velocityMult) * projectile.velocity; - Vector2 pos = projectile.Center + directOffset + velocityOffset; - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(pos, Vector2.Zero, bladeID, bladeDamage, bladeKB, projectile.owner, 0f, spin); + Vector2 velocityOffset = Main.rand.NextFloat(-velocityMult, velocityMult) * Projectile.velocity; + Vector2 pos = Projectile.Center + directOffset + velocityOffset; + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(pos, Vector2.Zero, bladeID, bladeDamage, bladeKB, Projectile.owner, 0f, spin); } private void SpawnScytheAfterimage() { int bladeID = ModContent.ProjectileType(); - int bladeDamage = projectile.damage / 2; + int bladeDamage = Projectile.damage / 2; float bladeKB = 4f; - float spin = projectile.direction <= 0 ? -1f : 1f; + float spin = Projectile.direction <= 0 ? -1f : 1f; float d = 16f; float velocityMult = 0.9f; - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, Vector2.Zero, bladeID, bladeDamage, bladeKB, projectile.owner, 0f, spin); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, bladeID, bladeDamage, bladeKB, Projectile.owner, 0f, spin); } } } diff --git a/Projectiles/Rogue/NanoblackSplit.cs b/Projectiles/Rogue/NanoblackSplit.cs index 73fb8e60f2..102489602c 100644 --- a/Projectiles/Rogue/NanoblackSplit.cs +++ b/Projectiles/Rogue/NanoblackSplit.cs @@ -23,23 +23,23 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Nanoblack Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 4; - projectile.extraUpdates = 1; - projectile.timeLeft = Lifetime; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - projectile.Calamity().rogue = true; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 4; + Projectile.extraUpdates = 1; + Projectile.timeLeft = Lifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.Calamity().rogue = true; } // ai[0] = Index of current NPC target. If 0 or negative, the projectile has no target @@ -52,22 +52,22 @@ namespace CalamityMod.Projectiles.Rogue // On the very first frame, clear any invalid starting target variable and create some dust. // Also grab the damage type based on ai[0]. - if (projectile.timeLeft == Lifetime) + if (Projectile.timeLeft == Lifetime) SpawnDust(); // Spin in the specified starting direction and slow down spin over time // Loses 1.66% of current speed every frame // Also update current orientation to reflect current spin direction - float currentSpin = projectile.ai[1]; - projectile.direction = currentSpin <= 0f ? 1 : -1; - projectile.spriteDirection = projectile.direction; - projectile.rotation += currentSpin * MaxRotationSpeed; + float currentSpin = Projectile.ai[1]; + Projectile.direction = currentSpin <= 0f ? 1 : -1; + Projectile.spriteDirection = Projectile.direction; + Projectile.rotation += currentSpin * MaxRotationSpeed; float spinReduction = 0.0166f * currentSpin; - projectile.ai[1] -= spinReduction; + Projectile.ai[1] -= spinReduction; // If about to disappear, shrink by 8% every frame - if (projectile.timeLeft < 15) - projectile.scale *= 0.92f; + if (Projectile.timeLeft < 15) + Projectile.scale *= 0.92f; // Search for and home in on nearby targets HomingAI(); @@ -76,39 +76,39 @@ namespace CalamityMod.Projectiles.Rogue private void HomingAI() { // If we don't currently have a target, go try and get one! - int targetID = (int)projectile.ai[0] - 1; + int targetID = (int)Projectile.ai[0] - 1; if (targetID < 0) targetID = AcquireTarget(); // Save the target, whether we have one or not. - projectile.ai[0] = targetID + 1f; + Projectile.ai[0] = targetID + 1f; // If we don't have a target, then just slow down a bit. if (targetID < 0) { - projectile.velocity *= 0.94f; + Projectile.velocity *= 0.94f; return; } // Homing behavior depends on how far the blade is from its target. NPC target = Main.npc[targetID]; - float xDist = projectile.Center.X - target.Center.X; - float yDist = projectile.Center.Y - target.Center.Y; + float xDist = Projectile.Center.X - target.Center.X; + float yDist = Projectile.Center.Y - target.Center.Y; float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); // If the target is too far away, stop homing in on it. if (dist > HomingBreakRange) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; return; } // Adds a multiple of the towards-target vector to its velocity every frame. float homingFactor = CalcHomingFactor(dist); - Vector2 posDiff = target.Center - projectile.Center; + Vector2 posDiff = target.Center - Projectile.Center; posDiff = posDiff.SafeNormalize(Vector2.Zero); posDiff *= homingFactor; - Vector2 newVelocity = projectile.velocity += posDiff; + Vector2 newVelocity = Projectile.velocity += posDiff; // Caps speed to make sure it doesn't go too fast. if (newVelocity.Length() >= MaxSpeed) @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Rogue newVelocity *= MaxSpeed; } - projectile.velocity = newVelocity; + Projectile.velocity = newVelocity; } // Returns the ID of the NPC to be targeted by this energy blade. @@ -138,10 +138,10 @@ namespace CalamityMod.Projectiles.Rogue if (bossFound && !npc.boss) continue; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float xDist = projectile.Center.X - npc.Center.X; - float yDist = projectile.Center.Y - npc.Center.Y; + float xDist = Projectile.Center.X - npc.Center.X; + float yDist = Projectile.Center.Y - npc.Center.Y; float distToNPC = (float)Math.Sqrt(xDist * xDist + yDist * yDist); if (distToNPC < minDist) { @@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -176,16 +176,16 @@ namespace CalamityMod.Projectiles.Rogue public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { float fWidthOverTwo = SpriteWidth / 2f; - float fHeightOverTwo = projectile.height / 2f; + float fHeightOverTwo = Projectile.height / 2f; // Make sure the glowmask matches the blade's own orientation SpriteEffects eff = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) eff = SpriteEffects.FlipHorizontally; Vector2 origin = new Vector2(fWidthOverTwo, fHeightOverTwo); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Rogue/NanoblackSplitGlow"), - projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, - origin, projectile.scale, eff, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Rogue/NanoblackSplitGlow"), + Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, + origin, Projectile.scale, eff, 0f); } // Spawns a tiny bit of dust when the energy blade vanishes. @@ -198,12 +198,12 @@ namespace CalamityMod.Projectiles.Rogue private void SpawnDust() { int dustCount = Main.rand.Next(3, 6); - Vector2 corner = projectile.position; + Vector2 corner = Projectile.position; for (int i = 0; i < dustCount; ++i) { int dustType = 229; float scale = 0.6f + Main.rand.NextFloat(0.4f); - int idx = Dust.NewDust(corner, projectile.width, projectile.height, dustType); + int idx = Dust.NewDust(corner, Projectile.width, Projectile.height, dustType); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; Main.dust[idx].scale = scale; diff --git a/Projectiles/Rogue/NanoblackStealthSplit.cs b/Projectiles/Rogue/NanoblackStealthSplit.cs index 6802bb97cc..53cb1b1027 100644 --- a/Projectiles/Rogue/NanoblackStealthSplit.cs +++ b/Projectiles/Rogue/NanoblackStealthSplit.cs @@ -25,23 +25,23 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Nanoblack Afterimage"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 56; - projectile.height = 56; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 12; - projectile.extraUpdates = 1; - projectile.timeLeft = Lifetime; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - projectile.Calamity().rogue = true; + Projectile.width = 56; + Projectile.height = 56; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 12; + Projectile.extraUpdates = 1; + Projectile.timeLeft = Lifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.Calamity().rogue = true; } // ai[0] = Index of current NPC target. If 0 or negative, the projectile has no target @@ -55,28 +55,28 @@ namespace CalamityMod.Projectiles.Rogue int dustType = Main.rand.NextBool(5) ? 226 : 220; float scale = 0.8f + Main.rand.NextFloat(0.3f); float velocityMult = Main.rand.NextFloat(0.3f, 0.6f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); Main.dust[idx].noGravity = true; - Main.dust[idx].velocity = velocityMult * projectile.velocity; + Main.dust[idx].velocity = velocityMult * Projectile.velocity; Main.dust[idx].scale = scale; } // Spin in the specified starting direction and slow down spin over time // Loses 1.66% of current speed every frame // Also update current orientation to reflect current spin direction - if (projectile.timeLeft > 200) + if (Projectile.timeLeft > 200) { - float currentSpin = projectile.ai[1]; - projectile.direction = currentSpin <= 0f ? -1 : 1; - projectile.spriteDirection = projectile.direction; - projectile.rotation += currentSpin * MaxRotationSpeed; + float currentSpin = Projectile.ai[1]; + Projectile.direction = currentSpin <= 0f ? -1 : 1; + Projectile.spriteDirection = Projectile.direction; + Projectile.rotation += currentSpin * MaxRotationSpeed; float spinReduction = 0.0166f * currentSpin; - projectile.ai[1] -= spinReduction; + Projectile.ai[1] -= spinReduction; } // Search for and home in on nearby targets after the given time, and stops spinning else { - projectile.rotation = 0f; + Projectile.rotation = 0f; HomingAI(); } } @@ -84,39 +84,39 @@ namespace CalamityMod.Projectiles.Rogue private void HomingAI() { // If we don't currently have a target, go try and get one! - int targetID = (int)projectile.ai[0] - 1; + int targetID = (int)Projectile.ai[0] - 1; if (targetID < 0) targetID = AcquireTarget(); // Save the target, whether we have one or not. - projectile.ai[0] = targetID + 1f; + Projectile.ai[0] = targetID + 1f; // If we don't have a target, then just slow down a bit. if (targetID < 0) { - projectile.velocity *= 0.94f; + Projectile.velocity *= 0.94f; return; } // Homing behavior depends on how far the blade is from its target. NPC target = Main.npc[targetID]; - float xDist = projectile.Center.X - target.Center.X; - float yDist = projectile.Center.Y - target.Center.Y; + float xDist = Projectile.Center.X - target.Center.X; + float yDist = Projectile.Center.Y - target.Center.Y; float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); // If the target is too far away, stop homing in on it. if (dist > HomingBreakRange) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; return; } // Adds a multiple of the towards-target vector to its velocity every frame. float homingFactor = CalcHomingFactor(dist); - Vector2 posDiff = target.Center - projectile.Center; + Vector2 posDiff = target.Center - Projectile.Center; posDiff = posDiff.SafeNormalize(Vector2.Zero); posDiff *= homingFactor; - Vector2 newVelocity = projectile.velocity += posDiff; + Vector2 newVelocity = Projectile.velocity += posDiff; // Caps speed to make sure it doesn't go too fast. if (newVelocity.Length() >= MaxSpeed) @@ -125,10 +125,10 @@ namespace CalamityMod.Projectiles.Rogue newVelocity *= MaxSpeed; } - projectile.velocity = newVelocity; + Projectile.velocity = newVelocity; //The afterimage's blade always tries to face its target - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); } // Returns the ID of the NPC to be targeted by this energy blade. @@ -149,10 +149,10 @@ namespace CalamityMod.Projectiles.Rogue if (bossFound && !npc.boss) continue; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float xDist = projectile.Center.X - npc.Center.X; - float yDist = projectile.Center.Y - npc.Center.Y; + float xDist = Projectile.Center.X - npc.Center.X; + float yDist = Projectile.Center.Y - npc.Center.Y; float distToNPC = (float)Math.Sqrt(xDist * xDist + yDist * yDist); if (distToNPC < minDist) { @@ -179,7 +179,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -193,12 +193,12 @@ namespace CalamityMod.Projectiles.Rogue private void SpawnDust() { int dustCount = Main.rand.Next(3, 6); - Vector2 corner = projectile.position; + Vector2 corner = Projectile.position; for (int i = 0; i < dustCount; ++i) { int dustType = 229; float scale = 0.6f + Main.rand.NextFloat(0.4f); - int idx = Dust.NewDust(corner, projectile.width, projectile.height, dustType); + int idx = Dust.NewDust(corner, Projectile.width, Projectile.height, dustType); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; Main.dust[idx].scale = scale; diff --git a/Projectiles/Rogue/NastyChollaBol.cs b/Projectiles/Rogue/NastyChollaBol.cs index d82e56b36b..2f893ac0b6 100644 --- a/Projectiles/Rogue/NastyChollaBol.cs +++ b/Projectiles/Rogue/NastyChollaBol.cs @@ -17,48 +17,48 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 200; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 200; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; } public override void AI() { if (Main.rand.NextBool(12)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 157, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 157, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } //Sticky Behaviour - projectile.StickyProjAI(15); - if (projectile.ai[0] != 1f) + Projectile.StickyProjAI(15); + if (Projectile.ai[0] != 1f) { - projectile.StickToTiles(true, false); - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 10f) + Projectile.StickToTiles(true, false); + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 10f) { - projectile.localAI[1] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.localAI[1] = 10f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X *= 0.97f; - if (Math.Abs(projectile.velocity.X) < 0.01f) + Projectile.velocity.X *= 0.97f; + if (Math.Abs(Projectile.velocity.X) < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(20, false); + Projectile.ModifyHitNPCSticky(20, false); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -82,14 +82,14 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int needleAmt = Main.rand.Next(2, 4); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int n = 0; n < needleAmt; n++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)((NastyCholla.BaseDamage/4) * player.RogueDamage()), 0f, projectile.owner, 0f, 0f); + int shard = Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)((NastyCholla.BaseDamage/4) * player.RogueDamage()), 0f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Rogue/NastyChollaNeedle.cs b/Projectiles/Rogue/NastyChollaNeedle.cs index 252945baa3..3401d9f60f 100644 --- a/Projectiles/Rogue/NastyChollaNeedle.cs +++ b/Projectiles/Rogue/NastyChollaNeedle.cs @@ -14,33 +14,33 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.penetrate = 3; - projectile.timeLeft = 180; - projectile.aiStyle = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -2; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 180; + Projectile.aiStyle = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -2; } public override void AI() { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); //Rotating 45 degrees if shooting right - if (projectile.spriteDirection == 1) + if (Projectile.spriteDirection == 1) { - projectile.rotation += MathHelper.ToRadians(45f); + Projectile.rotation += MathHelper.ToRadians(45f); } //Rotating 45 degrees if shooting right - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { - projectile.rotation -= MathHelper.ToRadians(45f); + Projectile.rotation -= MathHelper.ToRadians(45f); } - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y = projectile.velocity.Y + 0.01f; + Projectile.velocity.X *= 0.9995f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.01f; } //So you can stick a needle up the Tinkerer's ass diff --git a/Projectiles/Rogue/NiceCock.cs b/Projectiles/Rogue/NiceCock.cs index d0ea4236c1..dc844428b3 100644 --- a/Projectiles/Rogue/NiceCock.cs +++ b/Projectiles/Rogue/NiceCock.cs @@ -4,6 +4,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { // The file name is a specific request from the patron @@ -31,18 +32,18 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 44; - projectile.height = 70; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.timeLeft = 180; - projectile.alpha = 255; + Projectile.width = 44; + Projectile.height = 70; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.timeLeft = 180; + Projectile.alpha = 255; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(homing); @@ -52,9 +53,9 @@ namespace CalamityMod.Projectiles.Rogue public override bool? CanHitNPC(NPC target) { // Do not deal damage before fully opaque - if (projectile.alpha >= 10) + if (Projectile.alpha >= 10) return false; - int index = (int)projectile.ai[1]; + int index = (int)Projectile.ai[1]; if (Main.npc[index] is null || !Main.npc[index].active || Main.npc[index].life < 0) return false; // Do not deal damage to any NPC that isn't the specified target @@ -65,35 +66,35 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); // Fireballs disappear if you can't stealth strike if (!modPlayer.wearingRogueArmor || modPlayer.rogueStealthMax <= 0) - projectile.Kill(); + Projectile.Kill(); - projectile.alpha -= 5; + Projectile.alpha -= 5; if (!initialized) { // Pick a random frame to start on - projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); initialized = true; } - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; - int index = (int)projectile.ai[1]; + int index = (int)Projectile.ai[1]; // If the target doesn't exist or is dead, spontaneously combust if (Main.npc[index] is null || !Main.npc[index].active || Main.npc[index].life < 0) - projectile.Kill(); + Projectile.Kill(); // Decrement the timer. This should last a second as stealth strikes will initialize this at 61. if (Timer > 1) @@ -106,8 +107,8 @@ namespace CalamityMod.Projectiles.Rogue if (homing) { // Home in on the target - Vector2 moveDirection = projectile.SafeDirectionTo(target.Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * 20f + moveDirection * 15f) / 21f; + Vector2 moveDirection = Projectile.SafeDirectionTo(target.Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 15f) / 21f; } else { @@ -117,20 +118,20 @@ namespace CalamityMod.Projectiles.Rogue float circleDist = MathHelper.Min((height > width ? height : width) * 3f, (Main.LogicCheckScreenWidth * Main.LogicCheckScreenHeight) / 2); if (circleDist > Main.LogicCheckScreenWidth / 3) circleDist = Main.LogicCheckScreenWidth / 3; - projectile.Center = target.Center + projectile.ai[0].ToRotationVector2() * circleDist; - projectile.ai[0] -= MathHelper.ToRadians(4f); + Projectile.Center = target.Center + Projectile.ai[0].ToRotationVector2() * circleDist; + Projectile.ai[0] -= MathHelper.ToRadians(4f); } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item74, projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 50); + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 50); // Create into some rainbow-colored dust when dead for (int d = 0; d < 5; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 267, 0f, 0f, 150, Main.rand.Next(colors), 2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 267, 0f, 0f, 150, Main.rand.Next(colors), 2f); Main.dust[idx].velocity *= 3f; Main.dust[idx].noGravity = true; if (Main.rand.NextBool(2)) @@ -141,10 +142,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int d = 0; d < 8; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 267, 0f, 0f, 150, Main.rand.Next(colors), 3f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 267, 0f, 0f, 150, Main.rand.Next(colors), 3f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 267, 0f, 0f, 150, Main.rand.Next(colors), 2f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 267, 0f, 0f, 150, Main.rand.Next(colors), 2f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Rogue/NightsGazeProjectile.cs b/Projectiles/Rogue/NightsGazeProjectile.cs index 5f2ca54d5c..19b8f8d59c 100644 --- a/Projectiles/Rogue/NightsGazeProjectile.cs +++ b/Projectiles/Rogue/NightsGazeProjectile.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,38 +16,38 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Night's Gaze"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } - private int SplitProjDamage => (int)(projectile.damage * 0.6f); + private int SplitProjDamage => (int)(Projectile.damage * 0.6f); public override void AI() { - if (projectile.ai[0] == 0f) - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.ToRadians(45); + if (Projectile.ai[0] == 0f) + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.ToRadians(45); - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { if (Main.rand.NextBool(8)) { int projID = ModContent.ProjectileType(); int starDamage = SplitProjDamage; float starKB = 5f; - Vector2 velocity = projectile.velocity; + Vector2 velocity = Projectile.velocity; - int p = Projectile.NewProjectile(projectile.Center, velocity, projID, starDamage, starKB, projectile.owner, 1f, 0f); + int p = Projectile.NewProjectile(Projectile.Center, velocity, projID, starDamage, starKB, Projectile.owner, 1f, 0f); Main.projectile[p].penetrate = 1; } } @@ -54,13 +55,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), projectile.timeLeft); + target.AddBuff(ModContent.BuffType(), Projectile.timeLeft); OnHitEffects(); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), projectile.timeLeft); + target.AddBuff(ModContent.BuffType(), Projectile.timeLeft); OnHitEffects(); } @@ -76,36 +77,36 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < onHitCount; i++) { int projID = Main.rand.NextBool(chanceOfStar) ? starID : sparkID; - Vector2 velocity = projectile.oldVelocity.RotateRandom(MathHelper.ToRadians(spread)); + Vector2 velocity = Projectile.oldVelocity.RotateRandom(MathHelper.ToRadians(spread)); float speed = Main.rand.NextFloat(1.5f, 2f); float moveDuration = Main.rand.Next(5, 15); - Projectile.NewProjectile(projectile.Center, velocity * speed, projID, projectileDamage, kb, projectile.owner, 0f, moveDuration); + Projectile.NewProjectile(Projectile.Center, velocity * speed, projID, projectileDamage, kb, Projectile.owner, 0f, moveDuration); } - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 62, 0.6f); - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 68, 0.2f); - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 122, 0.4f); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 62, 0.6f); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 68, 0.2f); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 122, 0.4f); } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/NightsGazeGlow"); + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Rogue/NightsGazeGlow"); Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / 2f); - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); } public override void Kill(int timeLeft) @@ -119,7 +120,7 @@ namespace CalamityMod.Projectiles.Rogue 132 }); - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X / 3f, projectile.velocity.Y / 3f, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, Projectile.velocity.X / 3f, Projectile.velocity.Y / 3f, 0, default, 1.5f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Rogue/NightsGazeSpark.cs b/Projectiles/Rogue/NightsGazeSpark.cs index 3ba90aa841..0dbc5650b2 100644 --- a/Projectiles/Rogue/NightsGazeSpark.cs +++ b/Projectiles/Rogue/NightsGazeSpark.cs @@ -17,30 +17,30 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 5; - projectile.timeLeft = lifetime; - projectile.Calamity().rogue = true; - projectile.localAI[0] = 10f; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 5; + Projectile.timeLeft = lifetime; + Projectile.Calamity().rogue = true; + Projectile.localAI[0] = 10f; } public override void AI() { - projectile.rotation += projectile.direction * projectile.ai[0]; + Projectile.rotation += Projectile.direction * Projectile.ai[0]; - if (projectile.timeLeft < (lifetime - projectile.ai[1]) && projectile.localAI[0] >= 0) + if (Projectile.timeLeft < (lifetime - Projectile.ai[1]) && Projectile.localAI[0] >= 0) { - projectile.velocity.Normalize(); - projectile.velocity *= projectile.localAI[0]; - projectile.localAI[0]--; + Projectile.velocity.Normalize(); + Projectile.velocity *= Projectile.localAI[0]; + Projectile.localAI[0]--; } - if (projectile.localAI[0] == 0) + if (Projectile.localAI[0] == 0) { - projectile.Kill(); + Projectile.Kill(); } for (int i = 0; i < 3; i++) @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue break; } - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= dustVelocity; } @@ -79,8 +79,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + Projectile.Kill(); return false; } @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Rogue break; } - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.75f; } diff --git a/Projectiles/Rogue/NightsGazeStar.cs b/Projectiles/Rogue/NightsGazeStar.cs index c1fb4de6bd..82a4d6186f 100644 --- a/Projectiles/Rogue/NightsGazeStar.cs +++ b/Projectiles/Rogue/NightsGazeStar.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,35 +16,35 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Night's Gaze Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 5; - projectile.timeLeft = lifetime; - projectile.Calamity().rogue = true; - projectile.localAI[0] = 10f; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 5; + Projectile.timeLeft = lifetime; + Projectile.Calamity().rogue = true; + Projectile.localAI[0] = 10f; } public override void AI() { - projectile.rotation += projectile.direction * 0.05f; + Projectile.rotation += Projectile.direction * 0.05f; - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - if (projectile.timeLeft < (lifetime - projectile.ai[1]) && projectile.localAI[0] >= 0) + if (Projectile.timeLeft < (lifetime - Projectile.ai[1]) && Projectile.localAI[0] >= 0) { - projectile.velocity.Normalize(); - projectile.velocity *= projectile.localAI[0]; - projectile.localAI[0]--; + Projectile.velocity.Normalize(); + Projectile.velocity *= Projectile.localAI[0]; + Projectile.localAI[0]--; } - else if (projectile.timeLeft >= (lifetime - projectile.ai[1])) + else if (Projectile.timeLeft >= (lifetime - Projectile.ai[1])) { for (int i = 0; i < 3; i++) { @@ -55,22 +56,22 @@ namespace CalamityMod.Projectiles.Rogue 132 }); - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= dustVelocity; } } } - else if (projectile.ai[0] == 1f) + else if (Projectile.ai[0] == 1f) { float minDist = 999f; int index = 0; for (int i = 0; i < Main.npc.Length; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < minDist) { minDist = dist; @@ -81,18 +82,18 @@ namespace CalamityMod.Projectiles.Rogue if (minDist < 999f) { - Vector2 velocityNew = Main.npc[index].Center - projectile.Center; + Vector2 velocityNew = Main.npc[index].Center - Projectile.Center; float speed = 10f; velocityNew.Normalize(); - projectile.velocity = velocityNew * speed; + Projectile.velocity = velocityNew * speed; } } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); } } } @@ -109,14 +110,14 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + Projectile.Kill(); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], Color.White, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.White, 1); return false; } @@ -131,7 +132,7 @@ namespace CalamityMod.Projectiles.Rogue 132 }); - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Rogue/NychthemeronOrb.cs b/Projectiles/Rogue/NychthemeronOrb.cs index 9014c542a7..f28039e682 100644 --- a/Projectiles/Rogue/NychthemeronOrb.cs +++ b/Projectiles/Rogue/NychthemeronOrb.cs @@ -20,15 +20,15 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -37,43 +37,43 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < Main.projectile.Length; i++) { Projectile p = Main.projectile[i]; - if (p.identity == projectile.ai[1] && p.active) + if (p.identity == Projectile.ai[1] && p.active) { isActive = true; } } if (!isActive) { - projectile.localAI[0] = 1f; - projectile.penetrate = 1; + Projectile.localAI[0] = 1f; + Projectile.penetrate = 1; } - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { // Orbit - projectile.rotation += rotationSpeeds[(int)projectile.localAI[1]]; + Projectile.rotation += rotationSpeeds[(int)Projectile.localAI[1]]; Vector2 relativePos = new Vector2(0, -1); - relativePos *= playerDists[(int)projectile.localAI[1]]; - relativePos = relativePos.RotatedBy(projectile.rotation); - projectile.Center = player.Center + relativePos; - velocity = projectile.position - projectile.oldPosition; + relativePos *= playerDists[(int)Projectile.localAI[1]]; + relativePos = relativePos.RotatedBy(Projectile.rotation); + Projectile.Center = player.Center + relativePos; + velocity = Projectile.position - Projectile.oldPosition; } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - if (projectile.timeLeft > 240 && projectile.Calamity().lineColor == 1) - projectile.timeLeft = 240; + if (Projectile.timeLeft > 240 && Projectile.Calamity().lineColor == 1) + Projectile.timeLeft = 240; // Follow Enemy float minDist = 999f; int index = 0; for (int i = 0; i < Main.npc.Length; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < minDist) { minDist = dist; @@ -85,34 +85,34 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocityNew; if (minDist < 999f) { - velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew = Main.npc[index].Center - Projectile.Center; velocityNew.Normalize(); - projectile.velocity += velocityNew; - if (projectile.velocity.Length() > 10f) + Projectile.velocity += velocityNew; + if (Projectile.velocity.Length() > 10f) { - projectile.velocity.Normalize(); - projectile.velocity *= 10f; + Projectile.velocity.Normalize(); + Projectile.velocity *= 10f; } - velocity = projectile.velocity; + velocity = Projectile.velocity; } else { - projectile.velocity = velocity; + Projectile.velocity = velocity; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texLight = Main.projectileTexture[projectile.type]; - Texture2D texDark = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/NychthemeronOrb2"); - if (projectile.ai[0] == 0f) + Texture2D texLight = Main.projectileTexture[Projectile.type]; + Texture2D texDark = ModContent.Request("CalamityMod/Projectiles/Rogue/NychthemeronOrb2"); + if (Projectile.ai[0] == 0f) { - spriteBatch.Draw(texLight, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, texLight.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texLight, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, texLight.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); } - else if (projectile.ai[0] == 1f) + else if (Projectile.ai[0] == 1f) { - spriteBatch.Draw(texDark, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, texDark.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texDark, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, texDark.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); } return false; } diff --git a/Projectiles/Rogue/NychthemeronProjectile.cs b/Projectiles/Rogue/NychthemeronProjectile.cs index b301d3e83d..973747584b 100644 --- a/Projectiles/Rogue/NychthemeronProjectile.cs +++ b/Projectiles/Rogue/NychthemeronProjectile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -19,72 +20,72 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 4; - projectile.timeLeft = lifetime; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 4; + Projectile.timeLeft = lifetime; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { // Thrown out and floating in the air - projectile.velocity *= 0.99f; + Projectile.velocity *= 0.99f; } else { - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; - projectile.tileCollide = false; + Projectile.tileCollide = false; // Recall to the player - Vector2 toPlayer = owner.Center - projectile.Center; + Vector2 toPlayer = owner.Center - Projectile.Center; toPlayer.Normalize(); - toPlayer *= projectile.ai[0]; - projectile.velocity = toPlayer; + toPlayer *= Projectile.ai[0]; + Projectile.velocity = toPlayer; - projectile.ai[0] += 0.5f; - projectile.extraUpdates = 1; - if (projectile.ai[0] > 20f) + Projectile.ai[0] += 0.5f; + Projectile.extraUpdates = 1; + if (Projectile.ai[0] > 20f) { - projectile.ai[0] = 20f; + Projectile.ai[0] = 20f; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner && projectile.Hitbox.Intersects(owner.Hitbox)) + if (Main.myPlayer == Projectile.owner && Projectile.Hitbox.Intersects(owner.Hitbox)) { - projectile.Kill(); + Projectile.Kill(); } } - projectile.rotation += 0.4f * projectile.direction * ((float)projectile.timeLeft / (float)lifetime); + Projectile.rotation += 0.4f * Projectile.direction * ((float)Projectile.timeLeft / (float)lifetime); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); float minScale = 0.9f; float maxScale = 1.1f; int numDust = 2; for (int i = 0; i < numDust; i++) { - Dust.NewDust(projectile.position, 4, 4, 236, projectile.velocity.X, projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); - Dust.NewDust(projectile.position, 4, 4, 240, projectile.velocity.X, projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + Dust.NewDust(Projectile.position, 4, 4, 236, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + Dust.NewDust(Projectile.position, 4, 4, 240, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); } - projectile.Kill(); + Projectile.Kill(); return false; } @@ -97,8 +98,8 @@ namespace CalamityMod.Projectiles.Rogue int numDust = 2; for (int i = 0; i < numDust; i++) { - Dust.NewDust(projectile.position, 4, 4, 236, projectile.velocity.X, projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); - Dust.NewDust(projectile.position, 4, 4, 240, projectile.velocity.X, projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + Dust.NewDust(Projectile.position, 4, 4, 236, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); + Dust.NewDust(Projectile.position, 4, 4, 240, Projectile.velocity.X, Projectile.velocity.Y, 0, default, Main.rand.NextFloat(minScale, maxScale)); } } } diff --git a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs index a22541246b..294f208ccd 100644 --- a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs +++ b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class OrichalcumSpikedGemstoneProjectile : ModProjectile @@ -17,40 +18,40 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.aiStyle = 2; - projectile.penetrate = 6; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.aiStyle = 2; + Projectile.penetrate = 6; + Projectile.timeLeft = 600; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; - projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; + Projectile.localNPCHitCooldown = 10; } public override bool OnTileCollide(Vector2 oldVelocity) { - Vector2 velocity = projectile.velocity; - if (projectile.velocity.Y != velocity.Y && (velocity.Y < -3f || velocity.Y > 3f)) + Vector2 velocity = Projectile.velocity; + if (Projectile.velocity.Y != velocity.Y && (velocity.Y < -3f || velocity.Y > 3f)) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.Center); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); } - if (projectile.velocity.X != velocity.X) + if (Projectile.velocity.X != velocity.X) { - projectile.velocity.X = velocity.X * -0.5f; + Projectile.velocity.X = velocity.X * -0.5f; } - if (projectile.velocity.Y != velocity.Y && velocity.Y > 1f) + if (Projectile.velocity.Y != velocity.Y && velocity.Y > 1f) { - projectile.velocity.Y = velocity.Y * -0.5f; + Projectile.velocity.Y = velocity.Y * -0.5f; } return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -66,12 +67,12 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffect(Vector2 targetPos) { - if (Main.myPlayer != projectile.owner || !projectile.Calamity().stealthStrike) + if (Main.myPlayer != Projectile.owner || !Projectile.Calamity().stealthStrike) return; for (int i = 0; i < 2; i++) { - int direction = Main.player[projectile.owner].direction; + int direction = Main.player[Projectile.owner].direction; float xStart = Main.screenPosition.X; if (direction < 0) xStart += Main.screenWidth; @@ -83,7 +84,7 @@ namespace CalamityMod.Projectiles.Rogue float speedMult = 24f / pathToTravel.Length(); pathToTravel.X *= speedMult; pathToTravel.Y *= speedMult; - int petal = Projectile.NewProjectile(startPos, pathToTravel, ProjectileID.FlowerPetal, projectile.damage, 0f, projectile.owner); + int petal = Projectile.NewProjectile(startPos, pathToTravel, ProjectileID.FlowerPetal, Projectile.damage, 0f, Projectile.owner); if (petal.WithinBounds(Main.maxProjectiles)) Main.projectile[petal].Calamity().forceRogue = true; } @@ -93,7 +94,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } } diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.cs b/Projectiles/Rogue/PalladiumJavelinProjectile.cs index dc9f70033d..7ae6a02c4f 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -18,68 +18,68 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 113; + Projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; - projectile.localNPCHitCooldown = 10; - projectile.usesLocalNPCImmunity = true; + Projectile.Calamity().rogue = true; + Projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; //Stealth strike behavior - if (!projectile.Calamity().stealthStrike || projectile.owner != Main.myPlayer || projectile.Calamity().lineColor >= 2) + if (!Projectile.Calamity().stealthStrike || Projectile.owner != Main.myPlayer || Projectile.Calamity().lineColor >= 2) return; - projectile.localAI[0]++; - if (projectile.localAI[0] >= 30f) + Projectile.localAI[0]++; + if (Projectile.localAI[0] >= 30f) { Vector2 vector2 = new Vector2(20f, 20f); for (int index1 = 0; index1 < 10; ++index1) { - int index2 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 87, 0f, 0f, 100, new Color(), 1.5f); + int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 87, 0f, 0f, 100, new Color(), 1.5f); Dust dust = Main.dust[index2]; dust.velocity *= 1.4f; } for (int index1 = 0; index1 < 5; ++index1) { - Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 144, 0f, 0f, 0, default, 1f); + Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 144, 0f, 0f, 0, default, 1f); } - int javelin = Projectile.NewProjectile(projectile.Center, projectile.velocity.RotatedBy(MathHelper.ToRadians(5f)), projectile.type, projectile.damage, projectile.knockBack, projectile.owner); - int javelin2 = Projectile.NewProjectile(projectile.Center, projectile.velocity.RotatedBy(MathHelper.ToRadians(-5f)), projectile.type, projectile.damage, projectile.knockBack, projectile.owner); + int javelin = Projectile.NewProjectile(Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(5f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner); + int javelin2 = Projectile.NewProjectile(Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(-5f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner); if (javelin.WithinBounds(Main.maxProjectiles)) { - Main.projectile[javelin].Calamity().lineColor = projectile.Calamity().lineColor + 1; + Main.projectile[javelin].Calamity().lineColor = Projectile.Calamity().lineColor + 1; Main.projectile[javelin].Calamity().stealthStrike = true; } if (javelin2.WithinBounds(Main.maxProjectiles)) { - Main.projectile[javelin2].Calamity().lineColor = projectile.Calamity().lineColor + 1; + Main.projectile[javelin2].Calamity().lineColor = Projectile.Calamity().lineColor + 1; Main.projectile[javelin2].Calamity().stealthStrike = true; } - projectile.Kill(); + Projectile.Kill(); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2) && !projectile.Calamity().stealthStrike) + if (Main.rand.NextBool(2) && !Projectile.Calamity().stealthStrike) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } } diff --git a/Projectiles/Rogue/PanSpark.cs b/Projectiles/Rogue/PanSpark.cs index dda22194a0..ec34186263 100644 --- a/Projectiles/Rogue/PanSpark.cs +++ b/Projectiles/Rogue/PanSpark.cs @@ -13,95 +13,95 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Spark"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 120; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 120; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; } public override void AI() { //make it face the way it's going - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.rotation = -projectile.velocity.X * 0.05f + MathHelper.PiOver2; + Projectile.rotation = -Projectile.velocity.X * 0.05f + MathHelper.PiOver2; } else { - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); } - projectile.ai[1]--; + Projectile.ai[1]--; //frames if (!initialized) { initialized = true; - projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); } - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } //movement - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X *= -0.1f; + Projectile.velocity.X *= -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X *= -0.5f; + Projectile.velocity.X *= -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y *= -0.5f; + Projectile.velocity.Y *= -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X *= 0.97f; - if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) + Projectile.velocity.X *= 0.97f; + if (Projectile.velocity.X > -0.01f && Projectile.velocity.X < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; } - if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) + if (Projectile.velocity.Y < 0.25f && Projectile.velocity.Y > 0.15f) { - projectile.velocity.X *= 0.8f; + Projectile.velocity.X *= 0.8f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } //dust if (Main.rand.NextBool(4)) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Rogue } if (Main.rand.NextBool(10)) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.ai[1] = 10f; + Projectile.ai[1] = 10f; return false; } @@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/PartisanExplosion.cs b/Projectiles/Rogue/PartisanExplosion.cs index 8861ec9548..dcce24b12c 100644 --- a/Projectiles/Rogue/PartisanExplosion.cs +++ b/Projectiles/Rogue/PartisanExplosion.cs @@ -16,16 +16,16 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 100; - projectile.height = 100; - projectile.Calamity().rogue = true; - projectile.friendly = true; - projectile.timeLeft = 10; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.width = 100; + Projectile.height = 100; + Projectile.Calamity().rogue = true; + Projectile.friendly = true; + Projectile.timeLeft = 10; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -39,8 +39,8 @@ namespace CalamityMod.Projectiles.Rogue { float speedx = Main.rand.NextFloat(-0.9f, 0.9f); float speedy = Main.rand.NextFloat(-0.9f, 0.9f); - int d = Dust.NewDust(projectile.position, 33, 33, 244, speedx, speedy, 120, default(Color), 2.6f); - Main.dust[d].position = projectile.Center; + int d = Dust.NewDust(Projectile.position, 33, 33, 244, speedx, speedy, 120, default(Color), 2.6f); + Main.dust[d].position = Projectile.Center; } } } diff --git a/Projectiles/Rogue/PenumbraBomb.cs b/Projectiles/Rogue/PenumbraBomb.cs index 0278612628..0e0764bf06 100644 --- a/Projectiles/Rogue/PenumbraBomb.cs +++ b/Projectiles/Rogue/PenumbraBomb.cs @@ -3,6 +3,7 @@ using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -13,28 +14,28 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Penumbra Bomb"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.timeLeft = 150; - projectile.extraUpdates = 2; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.alpha = 255; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 150; + Projectile.extraUpdates = 2; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; } public override void AI() { - projectile.ai[0]++; + Projectile.ai[0]++; //Hitbox Fixing - if (projectile.direction == 1) + if (Projectile.direction == 1) { drawOffsetX = -4; drawOriginOffsetX = -5; @@ -46,28 +47,28 @@ namespace CalamityMod.Projectiles.Rogue } //Alpha - if (projectile.alpha > 10) - projectile.alpha -= 7; + if (Projectile.alpha > 10) + Projectile.alpha -= 7; else - projectile.alpha = 10; + Projectile.alpha = 10; //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = (projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi)) + (MathHelper.ToRadians(180)*projectile.direction); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = (Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi)) + (MathHelper.ToRadians(180)*Projectile.direction); //Dust - float dfreq = projectile.Calamity().stealthStrike ? 4f : 2f; - if (projectile.ai[0] == dfreq) + float dfreq = Projectile.Calamity().stealthStrike ? 4f : 2f; + if (Projectile.ai[0] == dfreq) { - Vector2 dustspeed = projectile.velocity * Main.rand.NextFloat(0.5f,0.8f); - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Shadowflame, dustspeed.X, dustspeed.Y, 0, new Color(38, 30, 43), 1.4f); + Vector2 dustspeed = Projectile.velocity * Main.rand.NextFloat(0.5f,0.8f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, dustspeed.X, dustspeed.Y, 0, new Color(38, 30, 43), 1.4f); Main.dust[d].velocity = dustspeed; - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { Vector2 dustspeed2 = new Vector2 (Main.rand.NextFloat(-3f,3f),Main.rand.NextFloat(-3f,3f)); - int d2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Shadowflame, dustspeed2.X, dustspeed2.Y, 0, new Color(38, 30, 43), 1.3f); + int d2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, dustspeed2.X, dustspeed2.Y, 0, new Color(38, 30, 43), 1.3f); Main.dust[d2].velocity = dustspeed2; } - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; } } @@ -75,37 +76,37 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { //Dark soul projectiles - int ad = projectile.Calamity().stealthStrike ? 40 : 60; - float dmgMult = projectile.Calamity().stealthStrike ? 0.08f : 0.15f; + int ad = Projectile.Calamity().stealthStrike ? 40 : 60; + float dmgMult = Projectile.Calamity().stealthStrike ? 0.08f : 0.15f; int randrot = Main.rand.Next(-30,31); for (int i = 0; i < 360; i += ad) { Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(i + randrot)); - Projectile.NewProjectile(projectile.Center, SoulSpeed, ModContent.ProjectileType(), (int)(projectile.damage * dmgMult), 3f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, SoulSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * dmgMult), 3f, Projectile.owner, 0f, 0f); } //Dust - int maxDust = projectile.Calamity().stealthStrike ? 100 : 70; + int maxDust = Projectile.Calamity().stealthStrike ? 100 : 70; for (int i = 0; i < maxDust; i++) { Vector2 dustspeed = new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-6f, 6f)); - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Shadowflame, dustspeed.X, dustspeed.Y, 0, new Color(38, 30, 43), 1.6f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, dustspeed.X, dustspeed.Y, 0, new Color(38, 30, 43), 1.6f); } - Main.PlaySound(SoundID.Item14, projectile.Center); - projectile.width = 110; - projectile.height = 110; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + Projectile.width = 110; + Projectile.height = 110; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/PenumbraSoul.cs b/Projectiles/Rogue/PenumbraSoul.cs index 228ac4aa36..eee6fd3d22 100644 --- a/Projectiles/Rogue/PenumbraSoul.cs +++ b/Projectiles/Rogue/PenumbraSoul.cs @@ -12,30 +12,30 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Penumbra Soul"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.height = 18; - projectile.width = 18; - projectile.timeLeft = 150; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.alpha = 80; + Projectile.height = 18; + Projectile.width = 18; + Projectile.timeLeft = 150; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.alpha = 80; - projectile.penetrate = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.extraUpdates = 1; + Projectile.penetrate = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.extraUpdates = 1; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; drawOffsetX = 1; drawOriginOffsetY = 4; @@ -45,48 +45,48 @@ namespace CalamityMod.Projectiles.Rogue { int dustID = DustID.Shadowflame; - int idx = Dust.NewDust(projectile.position - projectile.velocity, projectile.width, projectile.height, dustID,0f,0f, 0, new Color(38, 30, 43)); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, Projectile.width, Projectile.height, dustID,0f,0f, 0, new Color(38, 30, 43)); Main.dust[idx].noGravity = true; - Main.dust[idx].velocity += projectile.velocity * 0.8f; + Main.dust[idx].velocity += Projectile.velocity * 0.8f; } // If tentacle is currently on cooldown, reduce the cooldown. - if (projectile.ai[0] > 0f) - projectile.ai[0] -= 1f; + if (Projectile.ai[0] > 0f) + Projectile.ai[0] -= 1f; // Home in on nearby enemies if homing is enabled - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) HomingAI(); } private void HomingAI() { - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, Penumbra.ShootSpeed * 1.5f, 35f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, Penumbra.ShootSpeed * 1.5f, 35f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { // Rapidly screech to a halt upon touching an enemy and disable homing. - projectile.velocity *= 0.4f; - projectile.ai[1] = 1f; + Projectile.velocity *= 0.4f; + Projectile.ai[1] = 1f; // Fade out a bit with every hit - projectile.alpha += 20; - if (projectile.alpha > 255) - projectile.alpha = 255; + Projectile.alpha += 20; + if (Projectile.alpha > 255) + Projectile.alpha = 255; // Explode into dust (as if being shredded apart on contact) int onHitDust = Main.rand.Next(6, 11); for (int i = 0; i < onHitDust; ++i) { int dustID = DustID.Shadowflame; - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f,0, new Color(38, 30, 43)); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f,0, new Color(38, 30, 43)); Main.dust[idx].noGravity = true; float speed = Main.rand.NextFloat(1.4f, 2.6f); @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < killDust; ++i) { int dustID = DustID.Shadowflame; - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f, 0, new Color(38, 30, 43)); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 0, new Color(38, 30, 43)); Main.dust[idx].noGravity = true; float speed = Main.rand.NextFloat(2.0f, 3.1f); diff --git a/Projectiles/Rogue/PhantasmalRuinGhost.cs b/Projectiles/Rogue/PhantasmalRuinGhost.cs index 8cf7e7528e..b0b1d8af41 100644 --- a/Projectiles/Rogue/PhantasmalRuinGhost.cs +++ b/Projectiles/Rogue/PhantasmalRuinGhost.cs @@ -14,38 +14,38 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 240; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 240; + Projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; } public override void AI() { // Set the projectile's direction correctly - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; // The projectile rapidly fades in as it starts existing - if (projectile.timeLeft >= 207) - projectile.alpha += 6; + if (Projectile.timeLeft >= 207) + Projectile.alpha += 6; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 40f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 300f, 12f, 40f); } public override Color? GetAlpha(Color lightColor) => new Color(100, 200, 255, 100); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 239) + if (Projectile.timeLeft > 239) return false; - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Rogue/PhantasmalRuinProj.cs b/Projectiles/Rogue/PhantasmalRuinProj.cs index faebe8b40c..c90e44b983 100644 --- a/Projectiles/Rogue/PhantasmalRuinProj.cs +++ b/Projectiles/Rogue/PhantasmalRuinProj.cs @@ -16,51 +16,51 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Phantasmal Ruin"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = Lifetime; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = Lifetime; + Projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 3); return false; } public override void AI() { // Set the projectile's direction correctly - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; // Dust and light - Dust d = Dust.NewDustDirect(projectile.position + projectile.velocity, projectile.width, projectile.height, 175, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, default, 0.85f); + Dust d = Dust.NewDustDirect(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 175, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, default, 0.85f); d.noLight = true; - Lighting.AddLight(projectile.Center + projectile.velocity * 0.1f, 0.4f, 0.7f, 0.9f); + Lighting.AddLight(Projectile.Center + Projectile.velocity * 0.1f, 0.4f, 0.7f, 0.9f); // Fire sub projectiles occasionally - bool shouldFireSubProjectile = (Lifetime - projectile.timeLeft) % (projectile.MaxUpdates * FramesPerSubProjectile) == 8; - if (projectile.owner == Main.myPlayer && shouldFireSubProjectile) + bool shouldFireSubProjectile = (Lifetime - Projectile.timeLeft) % (Projectile.MaxUpdates * FramesPerSubProjectile) == 8; + if (Projectile.owner == Main.myPlayer && shouldFireSubProjectile) { - bool ss = projectile.Calamity().stealthStrike; + bool ss = Projectile.Calamity().stealthStrike; int projID = ss ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = (int)(projectile.damage * 0.25f); - float kb = projectile.knockBack * (ss ? 1f : 0.25f); + int damage = (int)(Projectile.damage * 0.25f); + float kb = Projectile.knockBack * (ss ? 1f : 0.25f); Vector2 velocity = ss - ? (projectile.velocity * 0.4f).RotatedBy(Main.rand.NextFloat(-0.04f, 0.04f)) - : (projectile.velocity * 0.08f) + Main.rand.NextVector2Circular(0.4f, 0.4f); - Projectile.NewProjectile(projectile.Center, velocity, projID, damage, kb, projectile.owner); + ? (Projectile.velocity * 0.4f).RotatedBy(Main.rand.NextFloat(-0.04f, 0.04f)) + : (Projectile.velocity * 0.08f) + Main.rand.NextVector2Circular(0.4f, 0.4f); + Projectile.NewProjectile(Projectile.Center, velocity, projID, damage, kb, Projectile.owner); } } @@ -69,12 +69,12 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects() { - if (projectile.owner != Main.myPlayer) + if (Projectile.owner != Main.myPlayer) return; int numSouls = 4; int projID = ModContent.ProjectileType(); - int soulDamage = (int)(projectile.damage * 0.1f); + int soulDamage = (int)(Projectile.damage * 0.1f); float soulKB = 0f; float speed = 5f; float startAngle = Main.rand.NextFloat(-0.07f, 0.07f) + MathHelper.PiOver4; @@ -84,9 +84,9 @@ namespace CalamityMod.Projectiles.Rogue // Each pair of souls has randomized player homing strength float ai1 = Main.rand.NextFloat() + 0.5f; if (Main.rand.NextBool(2)) - Projectile.NewProjectile(projectile.Center, velocity, projID, soulDamage, soulKB, projectile.owner, 0f, ai1); + Projectile.NewProjectile(Projectile.Center, velocity, projID, soulDamage, soulKB, Projectile.owner, 0f, ai1); if (Main.rand.NextBool(2)) - Projectile.NewProjectile(projectile.Center, -velocity, projID, soulDamage, soulKB, projectile.owner, 0f, ai1); + Projectile.NewProjectile(Projectile.Center, -velocity, projID, soulDamage, soulKB, Projectile.owner, 0f, ai1); // Rotate direction for the next pair of souls. velocity = velocity.RotatedBy(MathHelper.TwoPi / numSouls); diff --git a/Projectiles/Rogue/PhantasmalSoul.cs b/Projectiles/Rogue/PhantasmalSoul.cs index 66b89e1576..53ee619f01 100644 --- a/Projectiles/Rogue/PhantasmalSoul.cs +++ b/Projectiles/Rogue/PhantasmalSoul.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -17,47 +18,47 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Phantasmal Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = projectile.height = 36; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = Lifetime; + Projectile.width = Projectile.height = 36; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.timeLeft = Lifetime; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < Lifetime - NoHomingFrames && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < Lifetime - NoHomingFrames && target.CanBeChasedBy(Projectile); public override void AI() { // Handle animation - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; // Activate homing on enemies after a brief delay - if (projectile.timeLeft < Lifetime - NoHomingFrames) - projectile.ai[0] = 1f; + if (Projectile.timeLeft < Lifetime - NoHomingFrames) + Projectile.ai[0] = 1f; // Occasional dust if (Main.rand.NextBool(4)) { int dustID = 173; - Dust d = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, dustID); + Dust d = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustID); d.velocity *= 0.1f; d.scale = 1.3f; d.noGravity = true; @@ -65,51 +66,51 @@ namespace CalamityMod.Projectiles.Rogue } // Purple light - Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); // Make sure the soul is always facing forwards - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - float inertia = 40f * projectile.ai[1]; // ranges from 20 to 60 - float homingSpeed = 8f * projectile.ai[1]; // ranges from 4 to 12 + float inertia = 40f * Projectile.ai[1]; // ranges from 20 to 60 + float homingSpeed = 8f * Projectile.ai[1]; // ranges from 4 to 12 float playerHomingRange = 900f; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; if (owner.active && !owner.dead) { // If you are too far away from the projectiles, they home in on you. - if (projectile.Distance(Main.player[projectile.owner].Center) > playerHomingRange) + if (Projectile.Distance(Main.player[Projectile.owner].Center) > playerHomingRange) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * homingSpeed) / inertia; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * homingSpeed) / inertia; return; } // Otherwise, if homing on enemies is enabled, they home in on enemies. - if (projectile.ai[0] == 1f) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 10f, 20f); + if (Projectile.ai[0] == 1f) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 10f, 20f); } // If the owner is dead these projectiles disappear rapidly. - else if (projectile.timeLeft > 30) - projectile.timeLeft = 30; + else if (Projectile.timeLeft > 30) + Projectile.timeLeft = 30; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > Lifetime - NoDrawFrames) + if (Projectile.timeLeft > Lifetime - NoDrawFrames) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } // Get darker when about to disappear public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -123,18 +124,18 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < dustCount; i++) { Vector2 velocity = Main.rand.NextVector2Circular(1f, 1f); - velocity = 12f * velocity + projectile.velocity * 0.1f; - Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, dustID); + velocity = 12f * velocity + Projectile.velocity * 0.1f; + Dust d = Dust.NewDustDirect(Projectile.Center, 0, 0, dustID); d.velocity = velocity; d.noGravity = true; d.noLight = true; } // Special quieter version of this noise used by Soul Edge and similar - Main.PlaySound(SoulEdge.ProjectileDeathSound, projectile.Center); + SoundEngine.PlaySound(SoulEdge.ProjectileDeathSound, Projectile.Center); } // Cannot deal damage for the first several frames of existence. - public override bool CanHitPvp(Player target) => projectile.timeLeft < Lifetime - NoHitFrames; + public override bool CanHitPvp(Player target) => Projectile.timeLeft < Lifetime - NoHitFrames; } } diff --git a/Projectiles/Rogue/PhantomLanceProj.cs b/Projectiles/Rogue/PhantomLanceProj.cs index c48abd7612..dce260130f 100644 --- a/Projectiles/Rogue/PhantomLanceProj.cs +++ b/Projectiles/Rogue/PhantomLanceProj.cs @@ -14,53 +14,53 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Phantom Lance"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void AI() { - if (!projectile.Calamity().stealthStrike) + if (!Projectile.Calamity().stealthStrike) { - if (projectile.timeLeft <= 255) - projectile.alpha += 1; - if (projectile.timeLeft >= 75) + if (Projectile.timeLeft <= 255) + Projectile.alpha += 1; + if (Projectile.timeLeft >= 75) { - projectile.velocity.X *= 0.995f; - projectile.velocity.Y *= 0.995f; + Projectile.velocity.X *= 0.995f; + Projectile.velocity.Y *= 0.995f; } } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 175, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, default, 0.85f); - projectile.ai[0]++; - if (projectile.ai[0] % 18f == 0f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 175, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, default, 0.85f); + Projectile.ai[0]++; + if (Projectile.ai[0] % 18f == 0f) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - float damageMult = projectile.timeLeft * 0.7f / 300f; - if (projectile.Calamity().stealthStrike) + float damageMult = Projectile.timeLeft * 0.7f / 300f; + if (Projectile.Calamity().stealthStrike) damageMult = 0.7f; - int soulDamage = (int)(projectile.damage * damageMult); - int soul = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), soulDamage, projectile.knockBack, projectile.owner); + int soulDamage = (int)(Projectile.damage * damageMult); + int soul = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), soulDamage, Projectile.knockBack, Projectile.owner); if (soul.WithinBounds(Main.maxProjectiles)) { Main.projectile[soul].Calamity().forceRogue = true; @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 10; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 175, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 175, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/PlaguedFuelPackCloud.cs b/Projectiles/Rogue/PlaguedFuelPackCloud.cs index 29ad9f3c6b..162b5ebc63 100644 --- a/Projectiles/Rogue/PlaguedFuelPackCloud.cs +++ b/Projectiles/Rogue/PlaguedFuelPackCloud.cs @@ -13,29 +13,29 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 28; - projectile.height = 24; - projectile.friendly = true; - projectile.alpha = 0; - projectile.penetrate = -1; - projectile.tileCollide = true; - projectile.ignoreWater = true; - projectile.timeLeft = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 28; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.alpha = 0; + Projectile.penetrate = -1; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 100; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.timeLeft < 50) - projectile.alpha += 5; - if (projectile.timeLeft < 75) - projectile.velocity *= 0.95f; + if (Projectile.timeLeft < 50) + Projectile.alpha += 5; + if (Projectile.timeLeft < 75) + Projectile.velocity *= 0.95f; if (Main.rand.NextBool(150)) { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X * 0.4f, projectile.velocity.Y * 0.4f, 100, default, 2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X * 0.4f, projectile.velocity.Y * 0.4f, 100, default, 3.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f, 100, default, 3.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; diff --git a/Projectiles/Rogue/PlaguenadeBee.cs b/Projectiles/Rogue/PlaguenadeBee.cs index c13f84ec0c..2808af5251 100644 --- a/Projectiles/Rogue/PlaguenadeBee.cs +++ b/Projectiles/Rogue/PlaguenadeBee.cs @@ -11,58 +11,58 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Bee"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 240; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 240; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.owner != Main.myPlayer) - projectile.Kill(); + if (Projectile.owner != Main.myPlayer) + Projectile.Kill(); - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - projectile.rotation += projectile.spriteDirection * MathHelper.ToRadians(45f); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.rotation += Projectile.spriteDirection * MathHelper.ToRadians(45f); - projectile.frameCounter++; - if (projectile.frameCounter >= 3) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; float maxDistance = 800f; bool homeIn = false; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 30f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 30f) { for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { NPC npc = Main.npc[npcIndex]; - if (npc.CanBeChasedBy(projectile, false) && !npc.wet) + if (npc.CanBeChasedBy(Projectile, false) && !npc.wet) { float extraDistance = (npc.width / 2) + (npc.height / 2); bool canHit = true; if (extraDistance < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance) && canHit) { center = npc.Center; homeIn = true; @@ -73,73 +73,73 @@ namespace CalamityMod.Projectiles.Rogue } if (!homeIn) { - center.X = projectile.Center.X + projectile.velocity.X * 100f; - center.Y = projectile.Center.Y + projectile.velocity.Y * 100f; + center.X = Projectile.Center.X + Projectile.velocity.X * 100f; + center.Y = Projectile.Center.Y + Projectile.velocity.Y * 100f; } float speed = 10f; float velocityTweak = 0.14f; - Vector2 projPos = projectile.Center; + Vector2 projPos = Projectile.Center; Vector2 velocity = center - projPos; float targetDist = velocity.Length(); targetDist = speed / targetDist; velocity.X *= targetDist; velocity.Y *= targetDist; - if (projectile.velocity.X < velocity.X) + if (Projectile.velocity.X < velocity.X) { - projectile.velocity.X += velocityTweak; - if (projectile.velocity.X < 0f && velocity.X > 0f) + Projectile.velocity.X += velocityTweak; + if (Projectile.velocity.X < 0f && velocity.X > 0f) { - projectile.velocity.X += velocityTweak * 2f; + Projectile.velocity.X += velocityTweak * 2f; } } - else if (projectile.velocity.X > velocity.X) + else if (Projectile.velocity.X > velocity.X) { - projectile.velocity.X -= velocityTweak; - if (projectile.velocity.X > 0f && velocity.X < 0f) + Projectile.velocity.X -= velocityTweak; + if (Projectile.velocity.X > 0f && velocity.X < 0f) { - projectile.velocity.X -= velocityTweak * 2f; + Projectile.velocity.X -= velocityTweak * 2f; } } - if (projectile.velocity.Y < velocity.Y) + if (Projectile.velocity.Y < velocity.Y) { - projectile.velocity.Y += velocityTweak; - if (projectile.velocity.Y < 0f && velocity.Y > 0f) + Projectile.velocity.Y += velocityTweak; + if (Projectile.velocity.Y < 0f && velocity.Y > 0f) { - projectile.velocity.Y += velocityTweak * 2f; + Projectile.velocity.Y += velocityTweak * 2f; } } - else if (projectile.velocity.Y > velocity.Y) + else if (Projectile.velocity.Y > velocity.Y) { - projectile.velocity.Y -= velocityTweak; - if (projectile.velocity.Y > 0f && velocity.Y < 0f) + Projectile.velocity.Y -= velocityTweak; + if (Projectile.velocity.Y > 0f && velocity.Y < 0f) { - projectile.velocity.Y -= velocityTweak * 2f; + Projectile.velocity.Y -= velocityTweak * 2f; } } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int drawStart = frameHeight * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, spriteEffects, 0f); return false; } @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 2; i++) { - int plague = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X, projectile.velocity.Y, 50, default, 1f); + int plague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 1f); Main.dust[plague].noGravity = true; } } diff --git a/Projectiles/Rogue/PlaguenadeProj.cs b/Projectiles/Rogue/PlaguenadeProj.cs index d5844af734..037488775d 100644 --- a/Projectiles/Rogue/PlaguenadeProj.cs +++ b/Projectiles/Rogue/PlaguenadeProj.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class PlaguenadeProj : ModProjectile @@ -17,87 +18,87 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 180; - projectile.Calamity().rogue = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 180; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X *= 0.97f; - if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) + Projectile.velocity.X *= 0.97f; + if (Projectile.velocity.X > -0.01f && Projectile.velocity.X < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; - if (projectile.velocity.Y > 16f) + Projectile.rotation += Projectile.velocity.X * 0.1f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = oldVelocity.X * -0.5f; + Projectile.velocity.X = oldVelocity.X * -0.5f; } - if (projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y > 1f) + if (Projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y > 1f) { - projectile.velocity.Y = oldVelocity.Y * -0.5f; + Projectile.velocity.Y = oldVelocity.Y * -0.5f; } return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Player player = Main.player[projectile.owner]; - int projAmt = projectile.Calamity().stealthStrike ? 28 : 20; + Player player = Main.player[Projectile.owner]; + int projAmt = Projectile.Calamity().stealthStrike ? 28 : 20; for (int projIndex = 0; projIndex < projAmt; projIndex++) { float speedX = (float)Main.rand.Next(-35, 36) * 0.02f; float speedY = (float)Main.rand.Next(-35, 36) * 0.02f; - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, speedX, speedY, ModContent.ProjectileType(), player.beeDamage(projectile.damage), player.beeKB(0f), projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, speedX, speedY, ModContent.ProjectileType(), player.beeDamage(Projectile.damage), player.beeKB(0f), Projectile.owner, 0f, 0f); } - Main.PlaySound(SoundID.Item14, projectile.position); - if (projectile.Calamity().stealthStrike) + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + if (Projectile.Calamity().stealthStrike) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 75; + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 75; } - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); for (int i = 0; i < 10; i++) { - int smoke = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[smoke].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -107,13 +108,13 @@ namespace CalamityMod.Projectiles.Rogue } for (int j = 0; j < 15; j++) { - int plague = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); + int plague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); Main.dust[plague].noGravity = true; Main.dust[plague].velocity *= 5f; - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } } diff --git a/Projectiles/Rogue/PoisonBol.cs b/Projectiles/Rogue/PoisonBol.cs index f77b06b409..ed6880d082 100644 --- a/Projectiles/Rogue/PoisonBol.cs +++ b/Projectiles/Rogue/PoisonBol.cs @@ -17,37 +17,37 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.timeLeft = 1200; - projectile.Calamity().rogue = true; - projectile.aiStyle = 14; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 45; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 5; + Projectile.timeLeft = 1200; + Projectile.Calamity().rogue = true; + Projectile.aiStyle = 14; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 45; } public override void AI() { if (Main.rand.NextBool(20)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 44, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - if (projectile.timeLeft < 20) - projectile.alpha += 13; - if (projectile.Calamity().stealthStrike) + if (Projectile.timeLeft < 20) + Projectile.alpha += 13; + if (Projectile.Calamity().stealthStrike) { - projectile.localAI[1]++; - if (projectile.localAI[1] % 35f == 0f) + Projectile.localAI[1]++; + if (Projectile.localAI[1] % 35f == 0f) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 20f); if (Main.rand.NextBool(3)) velocity *= 2f; - velocity += projectile.velocity * 0.25f; + velocity += Projectile.velocity * 0.25f; velocity *= 0.8f; - int proj = Projectile.NewProjectile(projectile.Center - velocity, velocity, Main.rand.Next(569,572), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner); + int proj = Projectile.NewProjectile(Projectile.Center - velocity, velocity, Main.rand.Next(569,572), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().forceRogue = true; @@ -57,12 +57,12 @@ namespace CalamityMod.Projectiles.Rogue } } - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.killSpikyBalls) { - projectile.active = false; - projectile.netUpdate = true; + Projectile.active = false; + Projectile.netUpdate = true; } } diff --git a/Projectiles/Rogue/PrismRocket.cs b/Projectiles/Rogue/PrismRocket.cs index 6c6e4e339b..b9fec50d8a 100644 --- a/Projectiles/Rogue/PrismRocket.cs +++ b/Projectiles/Rogue/PrismRocket.cs @@ -7,50 +7,50 @@ namespace CalamityMod.Projectiles.Rogue { public class PrismRocket : ModProjectile { - public float ExponentialAccelerationFactor => projectile.Calamity().stealthStrike ? 1.027f : 1.015f; - public float MaxHomingSpeed => projectile.Calamity().stealthStrike ? 26f : 21f; + public float ExponentialAccelerationFactor => Projectile.Calamity().stealthStrike ? 1.027f : 1.015f; + public float MaxHomingSpeed => Projectile.Calamity().stealthStrike ? 26f : 21f; public const int Lifetime = 150; public override void SetStaticDefaults() { DisplayName.SetDefault("Prism Rocket"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; } public override void SetDefaults() { - projectile.width = projectile.height = 16; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = Lifetime; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 9; - projectile.Calamity().rogue = true; + Projectile.width = Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = Lifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 9; + Projectile.Calamity().rogue = true; } public override void AI() { - NPC potentialTarget = projectile.Center.ClosestNPCAt(800f, true); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(800f, true); if (potentialTarget != null) AttackTarget(potentialTarget); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; EmitDust(); } public void AttackTarget(NPC target) { - float newSpeed = projectile.velocity.Length() * ExponentialAccelerationFactor; + float newSpeed = Projectile.velocity.Length() * ExponentialAccelerationFactor; if (newSpeed > MaxHomingSpeed) newSpeed = MaxHomingSpeed; - if (!projectile.WithinRange(target.Center, 30f)) + if (!Projectile.WithinRange(target.Center, 30f)) { - projectile.velocity = (projectile.velocity * 5f + projectile.SafeDirectionTo(target.Center) * newSpeed) / 6f; - projectile.velocity = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(target.Center), 0.15f).ToRotationVector2() * newSpeed; + Projectile.velocity = (Projectile.velocity * 5f + Projectile.SafeDirectionTo(target.Center) * newSpeed) / 6f; + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.AngleTo(target.Center), 0.15f).ToRotationVector2() * newSpeed; } } @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Rogue if (!Main.rand.NextBool(3)) continue; - Dust dust = Dust.NewDustPerfect(projectile.Center - (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f, 261); + Dust dust = Dust.NewDustPerfect(Projectile.Center - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f, 261); dust.color = Color.Cyan; dust.velocity = Main.rand.NextVector2Unit(); dust.scale = Main.rand.NextFloat(0.75f, 1.05f); diff --git a/Projectiles/Rogue/PrismShurikenBlade.cs b/Projectiles/Rogue/PrismShurikenBlade.cs index ed08abf2ec..e04daba486 100644 --- a/Projectiles/Rogue/PrismShurikenBlade.cs +++ b/Projectiles/Rogue/PrismShurikenBlade.cs @@ -12,18 +12,18 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = projectile.height = 22; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 1; - projectile.timeLeft = projectile.MaxUpdates * 300; + Projectile.width = Projectile.height = 22; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 1; + Projectile.timeLeft = Projectile.MaxUpdates * 300; } public override void AI() { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 850f, 19f, 30f); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + CalamityGlobalProjectile.HomeInOnNPC(Projectile, false, 850f, 19f, 30f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override void Kill(int timeLeft) @@ -33,8 +33,8 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 15; i++) { - Vector2 circularOffsetDirection = (MathHelper.TwoPi * i / 15f).ToRotationVector2().RotatedBy(projectile.velocity.ToRotation() - MathHelper.PiOver2); - Vector2 spawnPosition = projectile.Center - (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * projectile.height * 1.25f; + Vector2 circularOffsetDirection = (MathHelper.TwoPi * i / 15f).ToRotationVector2().RotatedBy(Projectile.velocity.ToRotation() - MathHelper.PiOver2); + Vector2 spawnPosition = Projectile.Center - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Projectile.height * 1.25f; spawnPosition += circularOffsetDirection * new Vector2(12f, 7f); Dust energy = Dust.NewDustPerfect(spawnPosition, 261); @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } } diff --git a/Projectiles/Rogue/Prismalline2.cs b/Projectiles/Rogue/Prismalline2.cs index 73e3fa99ba..607d56019e 100644 --- a/Projectiles/Rogue/Prismalline2.cs +++ b/Projectiles/Rogue/Prismalline2.cs @@ -16,26 +16,26 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 60; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 113; + Projectile.timeLeft = 60; aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 154, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/Prismalline3.cs b/Projectiles/Rogue/Prismalline3.cs index cb326fd890..f0349b18e2 100644 --- a/Projectiles/Rogue/Prismalline3.cs +++ b/Projectiles/Rogue/Prismalline3.cs @@ -16,29 +16,29 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.Calamity().rogue = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.Calamity().rogue = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 12f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -46,15 +46,15 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 154, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { int shardCount = Main.rand.Next(1,4); for (int s = 0; s < shardCount; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner); + int shard = Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 3, 0f, Projectile.owner); if (shard.WithinBounds(Main.maxProjectiles)) { Main.projectile[shard].Calamity().forceRogue = true; diff --git a/Projectiles/Rogue/PrismallineProj.cs b/Projectiles/Rogue/PrismallineProj.cs index f00a522091..bd41991c16 100644 --- a/Projectiles/Rogue/PrismallineProj.cs +++ b/Projectiles/Rogue/PrismallineProj.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class PrismallineProj : ModProjectile @@ -20,41 +21,41 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.aiStyle = 113; - projectile.timeLeft = 180; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.aiStyle = 113; + Projectile.timeLeft = 180; aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - projectile.ai[1] += 1f; - if (projectile.ai[1] == 40f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] == 40f) { int numProj = 4; int numSpecProj = 0; float rotation = MathHelper.ToRadians(50); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - if (!projectile.Calamity().stealthStrike) + if (!Projectile.Calamity().stealthStrike) { for (int i = 0; i < numProj + 1; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f, 0.2f); if (numSpecProj < 2 && !hitEnemy) { - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 1.1), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1.1), Projectile.knockBack, Projectile.owner, 0f, 0f); ++numSpecProj; } else { - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); } } } @@ -64,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue for (int num252 = 0; num252 < shardCount; num252++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner); + int shard = Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner); if (shard.WithinBounds(Main.maxProjectiles)) { Main.projectile[shard].Calamity().forceRogue = true; @@ -75,7 +76,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < numProj + 1; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f, 0.2f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 1.15), projectile.knockBack, projectile.owner, 1f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1.15), Projectile.knockBack, Projectile.owner, 1f, 0f); } } } @@ -84,25 +85,25 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 154, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { int shardCount = Main.rand.Next(1,4); for (int s = 0; s < shardCount; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner); + int shard = Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner); if (shard.WithinBounds(Main.maxProjectiles)) { Main.projectile[shard].Calamity().forceRogue = true; @@ -115,14 +116,14 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { hitEnemy = true; - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) target.AddBuff(ModContent.BuffType(), 30); } public override void OnHitPvp(Player target, int damage, bool crit) { hitEnemy = true; - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) target.AddBuff(ModContent.BuffType(), 30); } } diff --git a/Projectiles/Rogue/ProfanedPartisanProj.cs b/Projectiles/Rogue/ProfanedPartisanProj.cs index 0679864c7b..4712794ad5 100644 --- a/Projectiles/Rogue/ProfanedPartisanProj.cs +++ b/Projectiles/Rogue/ProfanedPartisanProj.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,51 +16,51 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Profaned Partisan"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 9; - projectile.timeLeft = 600; - projectile.extraUpdates = 3; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 12; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 9; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 3; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; } public override void AI() { - if (projectile.ai[0] < 0.4f) + if (Projectile.ai[0] < 0.4f) { - projectile.ai[0] += 0.1f; + Projectile.ai[0] += 0.1f; } else { - projectile.tileCollide = true; + Projectile.tileCollide = true; } //Backwards projectile fix - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); //Rotating 45 degrees if shooting right - if (projectile.spriteDirection == 1) + if (Projectile.spriteDirection == 1) { - projectile.rotation += MathHelper.ToRadians(45f); + Projectile.rotation += MathHelper.ToRadians(45f); drawOffsetX = -26; drawOriginOffsetX = 13; drawOriginOffsetY = 2; } //Rotating 45 degrees if shooting right - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { - projectile.rotation -= MathHelper.ToRadians(45f); + Projectile.rotation -= MathHelper.ToRadians(45f); drawOffsetX = 2; drawOriginOffsetX = -13; drawOriginOffsetY = 2; @@ -67,23 +68,23 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(3)) { - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.1f); - Main.dust[d].position = projectile.Center; + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); + Main.dust[d].position = Projectile.Center; Main.dust[d].velocity *= 0.3f; - Main.dust[d].velocity += projectile.velocity * 0.85f; + Main.dust[d].velocity += Projectile.velocity * 0.85f; } - Lighting.AddLight(projectile.Center, 1f, 0.8f, 0.2f); + Lighting.AddLight(Projectile.Center, 1f, 0.8f, 0.2f); - if (projectile.Calamity().stealthStrike) //Stealth strike + if (Projectile.Calamity().stealthStrike) //Stealth strike { - Vector2 spearPosition = new Vector2(projectile.Center.X + Main.rand.NextFloat(-15f, 15f), projectile.Center.Y + Main.rand.NextFloat(-15f, 15f)); - Vector2 spearSpeed = projectile.velocity; - if (projectile.timeLeft % 18 == 0) + Vector2 spearPosition = new Vector2(Projectile.Center.X + Main.rand.NextFloat(-15f, 15f), Projectile.Center.Y + Main.rand.NextFloat(-15f, 15f)); + Vector2 spearSpeed = Projectile.velocity; + if (Projectile.timeLeft % 18 == 0) { int projID = ModContent.ProjectileType(); - int spearDamage = (int)(projectile.damage * 0.4f); + int spearDamage = (int)(Projectile.damage * 0.4f); float spearKB = 1f; - Projectile.NewProjectile(spearPosition, spearSpeed, projID, spearDamage, spearKB, projectile.owner); + Projectile.NewProjectile(spearPosition, spearSpeed, projID, spearDamage, spearKB, Projectile.owner); } } } @@ -92,19 +93,19 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 20; i++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 50, default, 2.6f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 50, default, 2.6f); } - Main.PlaySound(SoundID.Item45, projectile.position); + SoundEngine.PlaySound(SoundID.Item45, Projectile.position); int projID = ModContent.ProjectileType(); - int explosionDamage = (int)(projectile.damage * 0.8f); + int explosionDamage = (int)(Projectile.damage * 0.8f); float explosionKB = 8f; - Projectile.NewProjectile(projectile.Center, Vector2.Zero, projID, explosionDamage, explosionKB, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, projID, explosionDamage, explosionKB, Projectile.owner); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/ProfanedPartisanSpear.cs b/Projectiles/Rogue/ProfanedPartisanSpear.cs index 6c9d6d0812..5d03ff852f 100644 --- a/Projectiles/Rogue/ProfanedPartisanSpear.cs +++ b/Projectiles/Rogue/ProfanedPartisanSpear.cs @@ -17,35 +17,35 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.timeLeft = 600; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.timeLeft = 600; } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.ai[1] != 1f) + if (Projectile.ai[1] != 1f) { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - projectile.ai[1] = 1f; - projectile.ai[0] = 1f; - projectile.extraUpdates = 2; - if (projectile.timeLeft > 280) - projectile.timeLeft = 280; + Projectile.ai[1] = 1f; + Projectile.ai[0] = 1f; + Projectile.extraUpdates = 2; + if (Projectile.timeLeft > 280) + Projectile.timeLeft = 280; } return false; } @@ -64,36 +64,36 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects() { - if (projectile.ai[1] != 1f) + if (Projectile.ai[1] != 1f) { - projectile.velocity.X *= -1f; - projectile.velocity.Y *= -1f; - projectile.ai[1] = 1f; - projectile.ai[0] = 1f; - projectile.extraUpdates = 2; - if (projectile.timeLeft > 280) - projectile.timeLeft = 280; + Projectile.velocity.X *= -1f; + Projectile.velocity.Y *= -1f; + Projectile.ai[1] = 1f; + Projectile.ai[0] = 1f; + Projectile.extraUpdates = 2; + if (Projectile.timeLeft > 280) + Projectile.timeLeft = 280; } } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) timer++; if (timer >= 5) - projectile.penetrate = 1; + Projectile.penetrate = 1; if (timer >= 10) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 7f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 7f, 20f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Rogue/RadiantExplosion.cs b/Projectiles/Rogue/RadiantExplosion.cs index 0c23cbed94..2c1cb89ef1 100644 --- a/Projectiles/Rogue/RadiantExplosion.cs +++ b/Projectiles/Rogue/RadiantExplosion.cs @@ -23,53 +23,53 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 150; - projectile.height = 150; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 10; - projectile.Calamity().rogue = true; + Projectile.width = 150; + Projectile.height = 150; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 10; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.ai[0] == 1f || (projectile.Calamity().stealthStrike && !updatedTime)) + if (Projectile.ai[0] == 1f || (Projectile.Calamity().stealthStrike && !updatedTime)) { - projectile.timeLeft = 100; - projectile.ai[0] = 0f; + Projectile.timeLeft = 100; + Projectile.ai[0] = 0f; updatedTime = true; } - if (projectile.timeLeft >= (updatedTime ? 80 : 6)) + if (Projectile.timeLeft >= (updatedTime ? 80 : 6)) { for (int i = 0; i < 5; i++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } for (int i = 0; i < 5; i++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } } - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; + float num472 = Projectile.Center.X; + float num473 = Projectile.Center.Y; float num474 = 600f; for (int num475 = 0; num475 < Main.maxNPCs; num475++) { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + if (Main.npc[num475].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { float npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); float npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); + float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); if (num478 < num474) { if (Main.npc[num475].position.X < num472) @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Rogue ProjectileID.HallowStar, ModContent.ProjectileType() }); - Projectile star = CalamityUtils.ProjectileRain(targetPos, 400f, 100f, 500f, 800f, 25f, projType, (int)(projectile.damage * 0.75), 5f, projectile.owner); + Projectile star = CalamityUtils.ProjectileRain(targetPos, 400f, 100f, 500f, 800f, 25f, projType, (int)(Projectile.damage * 0.75), 5f, Projectile.owner); if (star.whoAmI.WithinBounds(Main.maxProjectiles)) { star.Calamity().forceRogue = true; diff --git a/Projectiles/Rogue/RadiantStar2.cs b/Projectiles/Rogue/RadiantStar2.cs index c6b31572e1..e45f516044 100644 --- a/Projectiles/Rogue/RadiantStar2.cs +++ b/Projectiles/Rogue/RadiantStar2.cs @@ -17,39 +17,39 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Radiant Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 270 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 270 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - if (projectile.ai[0] == 1f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + if (Projectile.ai[0] == 1f) { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = projectile.Calamity().stealthStrike ? 1800f : 600f; + float num472 = Projectile.Center.X; + float num473 = Projectile.Center.Y; + float num474 = Projectile.Calamity().stealthStrike ? 1800f : 600f; float homingSpeed = 0.25f; for (int num475 = 0; num475 < Main.maxNPCs; num475++) { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + if (Main.npc[num475].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { float npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); float npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); + float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); if (num478 < num474) { if (Main.npc[num475].position.X < num472) @@ -72,8 +72,8 @@ namespace CalamityMod.Projectiles.Rogue } } } - else if (projectile.timeLeft < 270) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, projectile.Calamity().stealthStrike ? 900f : 450f, 12f, 20f); + else if (Projectile.timeLeft < 270) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, Projectile.Calamity().stealthStrike ? 900f : 450f, 12f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/RadiantStarKnife.cs b/Projectiles/Rogue/RadiantStarKnife.cs index 7b5f4ae3f2..7474a93940 100644 --- a/Projectiles/Rogue/RadiantStarKnife.cs +++ b/Projectiles/Rogue/RadiantStarKnife.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,38 +17,38 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Radiant Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 4; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 4; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - if (projectile.ai[0] == 1f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + if (Projectile.ai[0] == 1f) { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = projectile.Calamity().stealthStrike ? 1800f : 600f; + float num472 = Projectile.Center.X; + float num473 = Projectile.Center.Y; + float num474 = Projectile.Calamity().stealthStrike ? 1800f : 600f; float homingSpeed = 0.25f; for (int num475 = 0; num475 < Main.npc.Length; num475++) { NPC npc = Main.npc[num475]; - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1) && !npc.boss) + if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1) && !npc.boss) { float num476 = npc.position.X + (float)(npc.width / 2); float num477 = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num476) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num477); if (num478 < num474) { if (npc.position.X < num472) @@ -70,12 +71,12 @@ namespace CalamityMod.Projectiles.Rogue } } } - projectile.ai[1] += 1f; - if (projectile.ai[1] == 25f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] == 25f) { - int numProj = projectile.Calamity().stealthStrike ? 5 : 3; + int numProj = Projectile.Calamity().stealthStrike ? 5 : 3; float rotation = MathHelper.ToRadians(50); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj; i++) { @@ -86,20 +87,20 @@ namespace CalamityMod.Projectiles.Rogue } speed.Normalize(); speed *= (float)Main.rand.Next(30, 61) * 0.1f * 2.5f; - int stabber2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack, projectile.owner, - projectile.ai[0] == 1f ? 1f : 0f, 0f); - Main.projectile[stabber2].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + int stabber2 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, + Projectile.ai[0] == 1f ? 1f : 0f, 0f); + Main.projectile[stabber2].Calamity().stealthStrike = Projectile.Calamity().stealthStrike; } - Main.PlaySound(SoundID.Item14, projectile.position); - int boomer = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.75f), projectile.knockBack, projectile.owner); - if (projectile.Calamity().stealthStrike && boomer.WithinBounds(Main.maxProjectiles)) + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + int boomer = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); + if (Projectile.Calamity().stealthStrike && boomer.WithinBounds(Main.maxProjectiles)) { Main.projectile[boomer].Calamity().stealthStrike = true; Main.projectile[boomer].height = 300; Main.projectile[boomer].width = 300; } - Main.projectile[boomer].Center = projectile.Center; - projectile.active = false; + Main.projectile[boomer].Center = Projectile.Center; + Projectile.active = false; } } } @@ -116,16 +117,16 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index b9db841d80..c29ae2c01d 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -14,47 +15,47 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("The Reaper"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 70; - projectile.height = 70; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = projectile.MaxUpdates * 90; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 32; // can't hit too fast, but can hit many many times - projectile.Calamity().rogue = true; + Projectile.width = 70; + Projectile.height = 70; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = Projectile.MaxUpdates * 90; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 32; // can't hit too fast, but can hit many many times + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; // If the Reaper lands a hit, switch to second behavior mode immediately. - if (projectile.ai[1] >= 60f || projectile.numHits > 0) + if (Projectile.ai[1] >= 60f || Projectile.numHits > 0) { - projectile.localAI[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.localAI[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } // Initial homing before landing a hit. else - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 12f, 14f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 250f, 12f, 14f); } // Homing after landing a hit. This homing repeatedly turns on and off. @@ -62,14 +63,14 @@ namespace CalamityMod.Projectiles.Rogue { float homingRange = 700f; bool noHomingThisFrame = false; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] > 40f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 40f) { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 1f; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } else noHomingThisFrame = true; @@ -78,14 +79,14 @@ namespace CalamityMod.Projectiles.Rogue if (noHomingThisFrame) return; - Vector2 homingTarget = projectile.Center; + Vector2 homingTarget = Projectile.Center; bool foundTarget = false; for (int i = 0; i < Main.maxNPCs; i++) { NPC nPC2 = Main.npc[i]; - if (nPC2.CanBeChasedBy(projectile, false)) + if (nPC2.CanBeChasedBy(Projectile, false)) { - float npcDist = Vector2.Distance(nPC2.Center, projectile.Center); + float npcDist = Vector2.Distance(nPC2.Center, Projectile.Center); if (!foundTarget) { homingRange = npcDist; @@ -96,9 +97,9 @@ namespace CalamityMod.Projectiles.Rogue } } - if (foundTarget && projectile.ai[0] == 0f) + if (foundTarget && Projectile.ai[0] == 0f) { - Vector2 delta = homingTarget - projectile.Center; + Vector2 delta = homingTarget - Projectile.Center; float distance = delta.Length(); delta /= distance; @@ -106,47 +107,47 @@ namespace CalamityMod.Projectiles.Rogue { float homingScalar = 11f; delta *= homingScalar; - projectile.velocity = (projectile.velocity * 40f + delta) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + delta) / 41f; } else { float homingScalar = 3.6f; delta *= -homingScalar; // yes this is intentionally backwards - projectile.velocity = (projectile.velocity * 40f + delta) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + delta) / 41f; } } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 4); + Projectile.ai[1] += (float)Main.rand.Next(1, 4); } - if (projectile.ai[1] > 40f) + if (Projectile.ai[1] > 40f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - if (projectile.ai[1] == 0f && foundTarget && homingRange < 500f) + if (Projectile.ai[1] == 0f && foundTarget && homingRange < 500f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner) { - projectile.ai[0] = 1f; - Vector2 value20 = homingTarget - projectile.Center; + Projectile.ai[0] = 1f; + Vector2 value20 = homingTarget - Projectile.Center; value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; + Projectile.velocity = value20 * 8f; + Projectile.netUpdate = true; } } } } - projectile.rotation += 0.07f; + Projectile.rotation += 0.07f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -162,16 +163,16 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item21, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 100; - projectile.height = 100; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item21, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 100; + Projectile.height = 100; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -181,10 +182,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 8; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Rogue/RefractionRotorProjectile.cs b/Projectiles/Rogue/RefractionRotorProjectile.cs index c4390ac034..dd1ba41490 100644 --- a/Projectiles/Rogue/RefractionRotorProjectile.cs +++ b/Projectiles/Rogue/RefractionRotorProjectile.cs @@ -15,36 +15,36 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Prism Shuriken"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 16; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 16; } public override void SetDefaults() { - projectile.width = 142; - projectile.height = 126; - projectile.friendly = true; - projectile.penetrate = 10; - projectile.timeLeft = 300; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().rogue = true; + Projectile.width = 142; + Projectile.height = 126; + Projectile.friendly = true; + Projectile.penetrate = 10; + Projectile.timeLeft = 300; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.alpha = Utils.Clamp(projectile.alpha - 18, 0, 255); - projectile.rotation += projectile.velocity.Length() * Math.Sign(projectile.velocity.X) * 0.036f; + Projectile.alpha = Utils.Clamp(Projectile.alpha - 18, 0, 255); + Projectile.rotation += Projectile.velocity.Length() * Math.Sign(Projectile.velocity.X) * 0.036f; } - public override bool CanDamage() => projectile.alpha <= 128; + public override bool CanDamage() => Projectile.alpha <= 128; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.timeLeft > 20) - projectile.timeLeft = 20; + if (Projectile.timeLeft > 20) + Projectile.timeLeft = 20; } public override void Kill(int timeLeft) @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 15; i++) { - Dust rainbowBurst = Dust.NewDustPerfect(projectile.Center, 267); + Dust rainbowBurst = Dust.NewDustPerfect(Projectile.Center, 267); rainbowBurst.color = Main.hslToRgb(i / 80f, 0.9f, 0.6f); rainbowBurst.velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(3f, 5.5f); rainbowBurst.scale = Main.rand.NextFloat(1.4f, 2.4f); @@ -63,54 +63,54 @@ namespace CalamityMod.Projectiles.Rogue rainbowBurst.noGravity = true; } - if (!projectile.Calamity().stealthStrike) + if (!Projectile.Calamity().stealthStrike) { - int goreType = mod.GetGoreSlot("Gores/PrismShurikenBlade"); + int goreType = Mod.GetGoreSlot("Gores/PrismShurikenBlade"); for (int i = 0; i < 6; i++) { - Vector2 shootDirection = (MathHelper.TwoPi * i / 6f + projectile.rotation + MathHelper.PiOver2).ToRotationVector2(); - Vector2 spawnPosition = projectile.Center + projectile.Size * 0.5f * projectile.scale * shootDirection * 0.85f; + Vector2 shootDirection = (MathHelper.TwoPi * i / 6f + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2(); + Vector2 spawnPosition = Projectile.Center + Projectile.Size * 0.5f * Projectile.scale * shootDirection * 0.85f; if (!WorldGen.SolidTile((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16)) - Gore.NewGorePerfect(spawnPosition, projectile.velocity * 0.5f + shootDirection * 7f, goreType, projectile.scale); + Gore.NewGorePerfect(spawnPosition, Projectile.velocity * 0.5f + shootDirection * 7f, goreType, Projectile.scale); } } } int shootType = ModContent.ProjectileType(); - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; // Release a circle of damaging blades if this projectile is a stealth strike. - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { int bladeType = ModContent.ProjectileType(); - int rocketDamage = (int)(projectile.damage * 0.8); + int rocketDamage = (int)(Projectile.damage * 0.8); for (int i = 0; i < 6; i++) { - Vector2 shootDirection = (MathHelper.TwoPi * i / 6f + projectile.rotation + MathHelper.PiOver2).ToRotationVector2(); - Vector2 spawnPosition = projectile.Center + projectile.Size * 0.5f * projectile.scale * shootDirection * 0.85f; - Projectile.NewProjectile(spawnPosition, projectile.velocity * 0.5f + shootDirection * 7f, bladeType, rocketDamage, projectile.knockBack, projectile.owner); + Vector2 shootDirection = (MathHelper.TwoPi * i / 6f + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2(); + Vector2 spawnPosition = Projectile.Center + Projectile.Size * 0.5f * Projectile.scale * shootDirection * 0.85f; + Projectile.NewProjectile(spawnPosition, Projectile.velocity * 0.5f + shootDirection * 7f, bladeType, rocketDamage, Projectile.knockBack, Projectile.owner); } } if (CalamityUtils.CountProjectiles(shootType) > 24) return; - int energyDamage = (int)(projectile.damage * 0.495); + int energyDamage = (int)(Projectile.damage * 0.495); float baseDirectionRotation = Main.rand.NextFloat(MathHelper.TwoPi); for (int i = 0; i < EnergyShotCount; i++) { Vector2 shootVelocity = (MathHelper.TwoPi * i / EnergyShotCount + baseDirectionRotation).ToRotationVector2() * 9f; - Projectile.NewProjectile(projectile.Center + shootVelocity, shootVelocity, shootType, energyDamage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center + shootVelocity, shootVelocity, shootType, energyDamage, Projectile.knockBack, Projectile.owner); } } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/RefractionRotorGlowmask"); - Vector2 drawPosition = projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY; + Texture2D glowmask = ModContent.Request("CalamityMod/Projectiles/Rogue/RefractionRotorGlowmask"); + Vector2 drawPosition = Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; Vector2 origin = glowmask.Size() * 0.5f; - spriteBatch.Draw(glowmask, drawPosition, null, projectile.GetAlpha(Color.White), projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(glowmask, drawPosition, null, Projectile.GetAlpha(Color.White), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } } } diff --git a/Projectiles/Rogue/RegulusEnergy.cs b/Projectiles/Rogue/RegulusEnergy.cs index d3ab22ae4a..a90cab9b56 100644 --- a/Projectiles/Rogue/RegulusEnergy.cs +++ b/Projectiles/Rogue/RegulusEnergy.cs @@ -17,54 +17,54 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; } public override void AI() { int num154 = 14; int coolDust; - projectile.ai[0] += 1; - if (projectile.ai[0] % 2 == 0) + Projectile.ai[0] += 1; + if (Projectile.ai[0] % 2 == 0) { - if (projectile.ai[0] % 4 == 0) + if (Projectile.ai[0] % 4 == 0) { - coolDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); } else { - coolDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); } Main.dust[coolDust].noGravity = true; Main.dust[coolDust].velocity *= 0.1f; - Main.dust[coolDust].velocity += projectile.velocity * 0.5f; + Main.dust[coolDust].velocity += Projectile.velocity * 0.5f; } - if (projectile.ai[0] < 90) + if (Projectile.ai[0] < 90) { - projectile.velocity.X *= 0.98f; - projectile.velocity.Y *= 0.98f; + Projectile.velocity.X *= 0.98f; + Projectile.velocity.Y *= 0.98f; } else { - projectile.extraUpdates = 1; + Projectile.extraUpdates = 1; - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; float maxDistance = 500f; bool homeIn = false; for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].CanBeChasedBy(projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) { center = Main.npc[i].Center; homeIn = true; @@ -75,33 +75,33 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { - Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * 20f + moveDirection * 12f) / (21f); + Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 12f) / (21f); } else - projectile.Kill(); + Projectile.Kill(); } - projectile.rotation += 0.25f; + Projectile.rotation += 0.25f; } public override bool CanDamage() { - return projectile.ai[0] >= 90; + return Projectile.ai[0] >= 90; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 24; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 24; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, ModContent.DustType(), vector7.X * 0.5f, vector7.Y * 0.5f, 100, default, 0.75f); Main.dust[num228].noGravity = true; } diff --git a/Projectiles/Rogue/RegulusRiotProj.cs b/Projectiles/Rogue/RegulusRiotProj.cs index 155ed117a4..37fa391d31 100644 --- a/Projectiles/Rogue/RegulusRiotProj.cs +++ b/Projectiles/Rogue/RegulusRiotProj.cs @@ -6,6 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Dusts; using CalamityMod.Buffs.DamageOverTime; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,85 +17,85 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Regulus Riot"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.extraUpdates = 1; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = projectile.MaxUpdates * 15; + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.extraUpdates = 1; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 15; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 20; + Projectile.alpha -= 20; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - int blueDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100); + int blueDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100); Main.dust[blueDust].noGravity = true; Main.dust[blueDust].velocity = Vector2.Zero; - int orangeDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100); + int orangeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100); Main.dust[orangeDust].noGravity = true; Main.dust[orangeDust].velocity = Vector2.Zero; - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int behaviorInt = 0; - if (projectile.velocity.Length() <= 8f) //4 + if (Projectile.velocity.Length() <= 8f) //4 { behaviorInt = 1; } if (behaviorInt == 0) { - projectile.rotation -= 0.104719758f; + Projectile.rotation -= 0.104719758f; - if (projectile.ai[0] >= 30f) + if (Projectile.ai[0] >= 30f) { - projectile.extraUpdates = 2; - projectile.velocity *= 0.98f; - projectile.rotation -= 0.0174532924f; + Projectile.extraUpdates = 2; + Projectile.velocity *= 0.98f; + Projectile.rotation -= 0.0174532924f; } - if (projectile.velocity.Length() < 8.2f) //4.1 + if (Projectile.velocity.Length() < 8.2f) //4.1 { - projectile.velocity.Normalize(); - projectile.velocity *= 4f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 1; + Projectile.velocity.Normalize(); + Projectile.velocity *= 4f; + Projectile.ai[0] = 0f; + Projectile.extraUpdates = 1; } } else if (behaviorInt == 1) { - projectile.rotation -= 0.104719758f; - Vector2 targetCenter = projectile.Center; + Projectile.rotation -= 0.104719758f; + Vector2 targetCenter = Projectile.Center; float homingRange = 300f; bool homeIn = false; int targetIndex = 0; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { NPC npc = Main.npc[npcIndex]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { Vector2 npcCenter = npc.Center; - if (projectile.Distance(npcCenter) < homingRange) + if (Projectile.Distance(npcCenter) < homingRange) { - homingRange = projectile.Distance(npcCenter); + homingRange = Projectile.Distance(npcCenter); targetCenter = npcCenter; homeIn = true; targetIndex = npcIndex; @@ -104,25 +105,25 @@ namespace CalamityMod.Projectiles.Rogue } if (homeIn) { - if (projectile.ai[1] != (float)(targetIndex + 1)) + if (Projectile.ai[1] != (float)(targetIndex + 1)) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.ai[1] = (float)(targetIndex + 1); + Projectile.ai[1] = (float)(targetIndex + 1); } homeIn = false; } - if (projectile.ai[1] != 0f) + if (Projectile.ai[1] != 0f) { - int npcIndex2 = (int)(projectile.ai[1] - 1f); + int npcIndex2 = (int)(Projectile.ai[1] - 1f); NPC npc2 = Main.npc[npcIndex2]; - if (npc2.active && npc2.CanBeChasedBy(projectile, true) && projectile.Distance(npc2.Center) < 1000f) + if (npc2.active && npc2.CanBeChasedBy(Projectile, true) && Projectile.Distance(npc2.Center) < 1000f) { homeIn = true; targetCenter = Main.npc[npcIndex2].Center; } } - if (!projectile.friendly) + if (!Projectile.friendly) { homeIn = false; } @@ -130,20 +131,20 @@ namespace CalamityMod.Projectiles.Rogue { float homeSpeed = 24f; float turnMult = 10f; - Vector2 projCenter = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 projCenter = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float xDist = targetCenter.X - projCenter.X; float yDist = targetCenter.Y - projCenter.Y; float totalDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); totalDist = homeSpeed / totalDist; xDist *= totalDist; yDist *= totalDist; - projectile.velocity.X = (projectile.velocity.X * (turnMult - 1f) + xDist) / turnMult; - projectile.velocity.Y = (projectile.velocity.Y * (turnMult - 1f) + yDist) / turnMult; + Projectile.velocity.X = (Projectile.velocity.X * (turnMult - 1f) + xDist) / turnMult; + Projectile.velocity.Y = (Projectile.velocity.Y * (turnMult - 1f) + yDist) / turnMult; } } - if (projectile.ai[0] >= 180f) + if (Projectile.ai[0] >= 180f) { - projectile.Kill(); + Projectile.Kill(); } } @@ -159,38 +160,38 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int i = 0; i < 10; i++) { - int blueDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + int blueDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); Main.dust[blueDust].noGravity = true; Main.dust[blueDust].velocity = Vector2.Zero; } for (int i = 0; i < 10; i++) { - int orangeDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + int orangeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); Main.dust[orangeDust].noGravity = true; Main.dust[orangeDust].velocity = Vector2.Zero; } - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { float spread = 60f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 6f; double offsetAngle; for (int i = 0; i < 3; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Rogue/RotBallProjectile.cs b/Projectiles/Rogue/RotBallProjectile.cs index 504554f809..15598db069 100644 --- a/Projectiles/Rogue/RotBallProjectile.cs +++ b/Projectiles/Rogue/RotBallProjectile.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.aiStyle = 2; - projectile.timeLeft = 600; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.aiStyle = 2; + Projectile.timeLeft = 600; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; - projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; + Projectile.localNPCHitCooldown = 10; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -39,15 +39,15 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer && projectile.Calamity().stealthStrike) + if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -10f, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, -10f, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Rogue/SacrificeProjectile.cs b/Projectiles/Rogue/SacrificeProjectile.cs index 4c553e7c43..d6310a539a 100644 --- a/Projectiles/Rogue/SacrificeProjectile.cs +++ b/Projectiles/Rogue/SacrificeProjectile.cs @@ -9,29 +9,29 @@ namespace CalamityMod.Projectiles.Rogue { public class SacrificeProjectile : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public bool StickingToAnything => projectile.ai[0] == 1f; - public bool ReturningToOwner => projectile.ai[0] == 2f; + public Player Owner => Main.player[Projectile.owner]; + public bool StickingToAnything => Projectile.ai[0] == 1f; + public bool ReturningToOwner => Projectile.ai[0] == 2f; public bool AbleToHealOwner = true; public override string Texture => "CalamityMod/Items/Weapons/Rogue/Sacrifice"; public override void SetStaticDefaults() { DisplayName.SetDefault("Sacrificial Dagger"); - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; } public override void SetDefaults() { - projectile.width = projectile.height = 62; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = Projectile.height = 62; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(AbleToHealOwner); @@ -43,16 +43,16 @@ namespace CalamityMod.Projectiles.Rogue { if (ReturningToOwner) { - projectile.timeLeft = 2; - projectile.velocity = projectile.SafeDirectionTo(Owner.Center) * 24f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi + MathHelper.PiOver4; + Projectile.timeLeft = 2; + Projectile.velocity = Projectile.SafeDirectionTo(Owner.Center) * 24f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi + MathHelper.PiOver4; // Heal the player and disappear when touching them. - if (projectile.Hitbox.Intersects(Owner.Hitbox)) + if (Projectile.Hitbox.Intersects(Owner.Hitbox)) { if (!Owner.moonLeech && AbleToHealOwner) { - int healAmount = projectile.Calamity().stealthStrike ? 50 : 4; + int healAmount = Projectile.Calamity().stealthStrike ? 50 : 4; Owner.HealEffect(healAmount); Owner.statLife += healAmount; @@ -60,16 +60,16 @@ namespace CalamityMod.Projectiles.Rogue Owner.statLife = Owner.statLifeMax2; } - projectile.Kill(); + Projectile.Kill(); } } else if (!StickingToAnything) - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; - else if (!Main.dedServ && projectile.timeLeft % 40f == 39f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + else if (!Main.dedServ && Projectile.timeLeft % 40f == 39f) { for (int i = 0; i < 60; i++) { - Dust blood = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(50f, 50f), 267); + Dust blood = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(50f, 50f), 267); blood.velocity = Main.rand.NextVector2Circular(3f, 3f); blood.noGravity = true; blood.color = Color.Lerp(Color.Red, Color.DarkRed, Main.rand.NextFloat(0.25f, 1f)); @@ -77,21 +77,21 @@ namespace CalamityMod.Projectiles.Rogue } } - if (StickingToAnything && projectile.timeLeft > 90) - projectile.timeLeft = 90; + if (StickingToAnything && Projectile.timeLeft > 90) + Projectile.timeLeft = 90; - projectile.StickyProjAI(50); + Projectile.StickyProjAI(50); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(15, true); - projectile.velocity *= 0.5f; + Projectile.ModifyHitNPCSticky(15, true); + Projectile.velocity *= 0.5f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } @@ -99,8 +99,8 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - Dust blood = Dust.NewDustDirect(projectile.Center, 1, 1, 5, 0, 0, 0, default, 1.5f); - blood.position += projectile.velocity.SafeNormalize(Vector2.Zero) * projectile.scale * 42f; + Dust blood = Dust.NewDustDirect(Projectile.Center, 1, 1, 5, 0, 0, 0, default, 1.5f); + blood.position += Projectile.velocity.SafeNormalize(Vector2.Zero) * Projectile.scale * 42f; blood.noGravity = true; } } diff --git a/Projectiles/Rogue/SandDollarProj.cs b/Projectiles/Rogue/SandDollarProj.cs index 31f8649e35..f0b344d2b3 100644 --- a/Projectiles/Rogue/SandDollarProj.cs +++ b/Projectiles/Rogue/SandDollarProj.cs @@ -14,26 +14,26 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 28; - projectile.Calamity().rogue = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 300; + Projectile.width = 30; + Projectile.height = 28; + Projectile.Calamity().rogue = true; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 3; + Projectile.timeLeft = 300; aiType = ProjectileID.Bananarang; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) + Projectile.ai[0] += 0.1f; + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } return false; } diff --git a/Projectiles/Rogue/SandDollarStealth.cs b/Projectiles/Rogue/SandDollarStealth.cs index 36d7019211..8a65c4ff70 100644 --- a/Projectiles/Rogue/SandDollarStealth.cs +++ b/Projectiles/Rogue/SandDollarStealth.cs @@ -16,16 +16,16 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 28; - projectile.Calamity().rogue = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 300; + Projectile.width = 30; + Projectile.height = 28; + Projectile.Calamity().rogue = true; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 3; + Projectile.timeLeft = 300; aiType = ProjectileID.Bananarang; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -41,12 +41,12 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects() { int coralAmt = Main.rand.Next(1, 4); - if (projectile.owner == Main.myPlayer && projectile.Calamity().stealthStrike) + if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) { for (int coralCount = 0; coralCount < coralAmt; coralCount++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int coral = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner); + int coral = Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 3, 0f, Projectile.owner); if (coral.WithinBounds(Main.maxProjectiles)) Main.projectile[coral].Calamity().forceRogue = true; } @@ -55,14 +55,14 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) + Projectile.ai[0] += 0.1f; + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } return false; } diff --git a/Projectiles/Rogue/SandslasherProj.cs b/Projectiles/Rogue/SandslasherProj.cs index a1047a5066..01a68e013c 100644 --- a/Projectiles/Rogue/SandslasherProj.cs +++ b/Projectiles/Rogue/SandslasherProj.cs @@ -13,47 +13,47 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Sandslasher"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; - projectile.Calamity().rogue = true; - projectile.timeLeft = 600; + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; + Projectile.Calamity().rogue = true; + Projectile.timeLeft = 600; } public override void AI() { - projectile.ai[0] += 1f; - projectile.ai[1] += 1f; - if (projectile.ai[0] == 3f) - projectile.tileCollide = true; - if(projectile.velocity.X < 0f) + Projectile.ai[0] += 1f; + Projectile.ai[1] += 1f; + if (Projectile.ai[0] == 3f) + Projectile.tileCollide = true; + if(Projectile.velocity.X < 0f) { - projectile.velocity.X -= 0.07f; - if ((projectile.ai[0] %= 30f) == 0f) - projectile.damage -= (int)(projectile.velocity.X * 2f); + Projectile.velocity.X -= 0.07f; + if ((Projectile.ai[0] %= 30f) == 0f) + Projectile.damage -= (int)(Projectile.velocity.X * 2f); } - else if(projectile.velocity.X > 0f) + else if(Projectile.velocity.X > 0f) { - projectile.velocity.X += 0.07f; - if ((projectile.ai[0] %= 30f) == 0f) - projectile.damage += (int)(projectile.velocity.X * 2f); + Projectile.velocity.X += 0.07f; + if ((Projectile.ai[0] %= 30f) == 0f) + Projectile.damage += (int)(Projectile.velocity.X * 2f); } - projectile.rotation += 0.1f * projectile.direction + (projectile.velocity.X /85); - if(projectile.Calamity().stealthStrike && projectile.ai[1] >= 5f) + Projectile.rotation += 0.1f * Projectile.direction + (Projectile.velocity.X /85); + if(Projectile.Calamity().stealthStrike && Projectile.ai[1] >= 5f) { Vector2 speed = new Vector2(Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f)); - Projectile.NewProjectile(projectile.position, speed, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), 0f, projectile.owner); - projectile.ai[1] = 0; + Projectile.NewProjectile(Projectile.position, speed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner); + Projectile.ai[1] = 0; } } @@ -61,13 +61,13 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 15; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, default, 1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 85, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, default, 1f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/ScarletBlast.cs b/Projectiles/Rogue/ScarletBlast.cs index 907772b72d..cbb530fe6a 100644 --- a/Projectiles/Rogue/ScarletBlast.cs +++ b/Projectiles/Rogue/ScarletBlast.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class ScarletBlast : ModProjectile @@ -16,60 +17,60 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 500; - projectile.height = 500; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().rogue = true; + Projectile.width = 500; + Projectile.height = 500; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 30; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.55f, 0.25f, 0f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, 0.55f, 0.25f, 0f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.localAI[0] += 1f; } bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -80,11 +81,11 @@ namespace CalamityMod.Projectiles.Rogue num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 130, 0f, 0f, 100, default, 1.25f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 130, 0f, 0f, 100, default, 1.25f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Rogue/ScarletDevilBullet.cs b/Projectiles/Rogue/ScarletDevilBullet.cs index 1394dda647..4cf9354b5f 100644 --- a/Projectiles/Rogue/ScarletDevilBullet.cs +++ b/Projectiles/Rogue/ScarletDevilBullet.cs @@ -12,35 +12,35 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.timeLeft = 140; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.timeLeft = 140; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] <= 60f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] <= 60f) { - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; + Projectile.velocity.X *= 0.975f; + Projectile.velocity.Y *= 0.975f; } else { - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; float maxDistance = 1000f; bool homeIn = false; for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].CanBeChasedBy(projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance)) + if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance)) { center = Main.npc[i].Center; homeIn = true; @@ -51,13 +51,13 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { - Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * 10f + moveDirection * 30f) / (11f); + Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 10f + moveDirection * 30f) / (11f); } else { - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 0f; } } } @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool CanDamage() { - if (projectile.Calamity().stealthStrike && projectile.ai[0] < 60f) + if (Projectile.Calamity().stealthStrike && Projectile.ai[0] < 60f) return false; return base.CanDamage(); } diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 438966d732..f7fb1f98fe 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -5,55 +5,56 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class ScarletDevilProjectile : ModProjectile { internal PrimitiveTrail TrailDrawer; - public ref float ShootTimer => ref projectile.ai[0]; + public ref float ShootTimer => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Items/Weapons/Rogue/ScarletDevil"; public override void SetStaticDefaults() { DisplayName.SetDefault("Spear the Gungnir"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 45; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 45; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - ProjectileID.Sets.TrailCacheLength[projectile.type] = 45; - projectile.width = 108; - projectile.height = 108; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 45; + Projectile.width = 108; + Projectile.height = 108; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.55f, 0.25f, 0f); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Lighting.AddLight(Projectile.Center, 0.55f, 0.25f, 0f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; if (!Main.dedServ) { - for (int i = 0; i < (projectile.Calamity().stealthStrike && Main.rand.NextBool(2) ? 2 : 1); i++) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 130, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.85f); + for (int i = 0; i < (Projectile.Calamity().stealthStrike && Main.rand.NextBool(2) ? 2 : 1); i++) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 130, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.85f); } ShootTimer++; - if (!projectile.Calamity().stealthStrike && projectile.oldPos.Length != 6) - projectile.oldPos = new Vector2[6]; + if (!Projectile.Calamity().stealthStrike && Projectile.oldPos.Length != 6) + Projectile.oldPos = new Vector2[6]; - if ((ShootTimer %= 5f) == 0f && !projectile.Calamity().stealthStrike) + if ((ShootTimer %= 5f) == 0f && !Projectile.Calamity().stealthStrike) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) GenerateSideBullets(2, MathHelper.ToRadians(15f)); } } @@ -62,10 +63,10 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < totalBullets; i++) { - Vector2 perturbedSpeed = new Vector2(-projectile.velocity.X / 3, -projectile.velocity.Y / 3).RotatedBy(MathHelper.Lerp(-rotationalOffset, rotationalOffset, i / (totalBullets - 1))); + Vector2 perturbedSpeed = new Vector2(-Projectile.velocity.X / 3, -Projectile.velocity.Y / 3).RotatedBy(MathHelper.Lerp(-rotationalOffset, rotationalOffset, i / (totalBullets - 1))); for (int j = 0; j < 2; j++) { - Projectile.NewProjectile(projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(projectile.damage * 0.03), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.03), 0f, Projectile.owner, 0f, 0f); perturbedSpeed *= 1.05f; } } @@ -79,7 +80,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 40; i++) { Vector2 shootVelocity = (MathHelper.TwoPi * i / 40f).ToRotationVector2() * starSpeed; - int bullet = Projectile.NewProjectile(projectile.Center + shootVelocity, shootVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.01), 0f, projectile.owner); + int bullet = Projectile.NewProjectile(Projectile.Center + shootVelocity, shootVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.01), 0f, Projectile.owner); if (Main.projectile.IndexInRange(bullet)) Main.projectile[bullet].Calamity().stealthStrike = true; } @@ -100,7 +101,7 @@ namespace CalamityMod.Projectiles.Rogue for (int j = 0; j < pointsOnStarSegment; j++) { Vector2 shootVelocity = Vector2.Lerp(start, end, j / (float)pointsOnStarSegment) * starSpeed; - int bullet = Projectile.NewProjectile(projectile.Center + shootVelocity, shootVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.01), 0f, projectile.owner); + int bullet = Projectile.NewProjectile(Projectile.Center + shootVelocity, shootVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.01), 0f, Projectile.owner); if (Main.projectile.IndexInRange(bullet)) Main.projectile[bullet].Calamity().stealthStrike = true; } @@ -115,21 +116,21 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item122, projectile.position); + SoundEngine.PlaySound(SoundID.Item122, Projectile.position); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 150); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.0075), 0f, projectile.owner); - if (!projectile.Calamity().stealthStrike) + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 150); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.0075), 0f, Projectile.owner); + if (!Projectile.Calamity().stealthStrike) return; - if (!Main.player[projectile.owner].moonLeech) + if (!Main.player[Projectile.owner].moonLeech) { // Give on-heal effects from stealth strikes. - Main.player[projectile.owner].statLife += 120; - Main.player[projectile.owner].HealEffect(120); + Main.player[Projectile.owner].statLife += 120; + Main.player[Projectile.owner].HealEffect(120); } // And spawn a bloom of bullets. @@ -138,14 +139,14 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 150); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.0075), 0f, projectile.owner); - if (!projectile.Calamity().stealthStrike) + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 150); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.0075), 0f, Projectile.owner); + if (!Projectile.Calamity().stealthStrike) return; // Give on-heal effects from stealth strikes. - Main.player[projectile.owner].statLife += 120; - Main.player[projectile.owner].HealEffect(120); + Main.player[Projectile.owner].statLife += 120; + Main.player[Projectile.owner].HealEffect(120); // And spawn a bloom of bullets. SpawnOnStealthStrikeBullets(); @@ -167,9 +168,9 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (!projectile.Calamity().stealthStrike) + if (!Projectile.Calamity().stealthStrike) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(100, 100, 100)); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(100, 100, 100)); return true; } else @@ -177,10 +178,10 @@ namespace CalamityMod.Projectiles.Rogue if (TrailDrawer is null) TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, PrimitiveTrail.RigidPointRetreivalFunction, GameShaders.Misc["CalamityMod:OverpoweredTouhouSpearShader"]); - GameShaders.Misc["CalamityMod:OverpoweredTouhouSpearShader"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/ScarletDevilStreak")); - TrailDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f - Main.screenPosition + projectile.velocity.SafeNormalize(Vector2.Zero) * 86f, 60); + GameShaders.Misc["CalamityMod:OverpoweredTouhouSpearShader"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/ScarletDevilStreak")); + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.Zero) * 86f, 60); - Texture2D spearTexture = ModContent.GetTexture(Texture); + Texture2D spearTexture = ModContent.Request(Texture); for (int i = 0; i < 7; i++) { @@ -188,7 +189,7 @@ namespace CalamityMod.Projectiles.Rogue drawColor.A = 0; Vector2 drawOffset = (i / 7f * MathHelper.TwoPi).ToRotationVector2() * 2f; - spriteBatch.Draw(spearTexture, projectile.Center - Main.screenPosition + drawOffset, null, drawColor, projectile.rotation, spearTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(spearTexture, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor, Projectile.rotation, spearTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); } } return false; diff --git a/Projectiles/Rogue/ScourgeVenomCloud.cs b/Projectiles/Rogue/ScourgeVenomCloud.cs index f3072c440d..34228dc2d1 100644 --- a/Projectiles/Rogue/ScourgeVenomCloud.cs +++ b/Projectiles/Rogue/ScourgeVenomCloud.cs @@ -11,63 +11,63 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Venom Cloud"); - Main.projFrames[projectile.type] = 10; + Main.projFrames[Projectile.type] = 10; } public override void SetDefaults() { - projectile.width = 45; - projectile.height = 45; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - projectile.Calamity().rogue = true; + Projectile.width = 45; + Projectile.height = 45; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 3600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.ai[0] += 1f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.ai[0] += 1f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.ai[0] < 219f) //255 - frameCounter tick * number of disippation frames + if (Projectile.ai[0] < 219f) //255 - frameCounter tick * number of disippation frames { - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } } - else if (projectile.owner == Main.myPlayer && projectile.frame >= Main.projFrames[projectile.type]) + else if (Projectile.owner == Main.myPlayer && Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.Kill(); + Projectile.Kill(); } - projectile.velocity *= 0.98f; - if (projectile.alpha > 110) + Projectile.velocity *= 0.98f; + if (Projectile.alpha > 110) { - projectile.alpha -= 30; - if (projectile.alpha < 110) + Projectile.alpha -= 30; + if (Projectile.alpha < 110) { - projectile.alpha = 110; + Projectile.alpha = 110; } } - if (Math.Abs(projectile.velocity.X) > 0.1f) + if (Math.Abs(Projectile.velocity.X) > 0.1f) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 120); - if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) //stealth strike attack + if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) //stealth strike attack { target.AddBuff(ModContent.BuffType(), 120); } @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Venom, 120); - if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) //stealth strike attack + if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) //stealth strike attack { target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Rogue/ScourgeoftheDesertProj.cs b/Projectiles/Rogue/ScourgeoftheDesertProj.cs index 8ea261ac7d..55ec18d3f2 100644 --- a/Projectiles/Rogue/ScourgeoftheDesertProj.cs +++ b/Projectiles/Rogue/ScourgeoftheDesertProj.cs @@ -17,68 +17,68 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Scourge"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.aiStyle = 113; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.aiStyle = 113; aiType = ProjectileID.BoneJavelin; - projectile.penetrate = 3; - projectile.Calamity().rogue = true; + Projectile.penetrate = 3; + Projectile.Calamity().rogue = true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { if (StealthDamageCap == 0) { - BaseDamage = projectile.damage; + BaseDamage = Projectile.damage; } - projectile.damage = (int)((BaseDamage * ((StealthDamageCap > 10 ? 10 : StealthDamageCap) * 20) / 100) + BaseDamage); //20% damage boost per hit, max of 200% + Projectile.damage = (int)((BaseDamage * ((StealthDamageCap > 10 ? 10 : StealthDamageCap) * 20) / 100) + BaseDamage); //20% damage boost per hit, max of 200% StealthDamageCap++; } } public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { if (StealthDamageCap == 0) { - BaseDamage = projectile.damage; + BaseDamage = Projectile.damage; } - projectile.damage = (int)((BaseDamage * ((StealthDamageCap > 10 ? 10 : StealthDamageCap) * 20) / 100) + BaseDamage); //20% damage boost per hit, max of 200% + Projectile.damage = (int)((BaseDamage * ((StealthDamageCap > 10 ? 10 : StealthDamageCap) * 20) / 100) + BaseDamage); //20% damage boost per hit, max of 200% StealthDamageCap++; } } public override void AI() { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - projectile.penetrate = 20 - StealthDamageCap; - projectile.velocity.Y *= 1.025f; - Dust.NewDust(projectile.position, projectile.width, projectile.height, 32); + Projectile.penetrate = 20 - StealthDamageCap; + Projectile.velocity.Y *= 1.025f; + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 32); } - projectile.velocity.X *= 1.025f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver4; - if (projectile.spriteDirection == -1) + Projectile.velocity.X *= 1.025f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver4; + if (Projectile.spriteDirection == -1) { - projectile.rotation -= 1.57f; + Projectile.rotation -= 1.57f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs index c4acefef7e..b7d6c82a61 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,41 +16,41 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Moist Scourge"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.aiStyle = 113; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.aiStyle = 113; aiType = ProjectileID.BoneJavelin; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 1200; - projectile.Calamity().rogue = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 1200; + Projectile.Calamity().rogue = true; } public override void AI() { if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 85, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - projectile.velocity.X *= 1.015f; - projectile.velocity.Y *= 1.015f; - projectile.velocity.X = Math.Min(16f, projectile.velocity.X); - projectile.velocity.Y = Math.Min(16f, projectile.velocity.Y); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + Projectile.velocity.X *= 1.015f; + Projectile.velocity.Y *= 1.015f; + Projectile.velocity.X = Math.Min(16f, Projectile.velocity.X); + Projectile.velocity.Y = Math.Min(16f, Projectile.velocity.Y); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 180); - if (projectile.Calamity().stealthStrike) //stealth strike attack + if (Projectile.Calamity().stealthStrike) //stealth strike attack { target.AddBuff(ModContent.BuffType(), 180); } @@ -58,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Venom, 180); - if (projectile.Calamity().stealthStrike) //stealth strike attack + if (Projectile.Calamity().stealthStrike) //stealth strike attack { target.AddBuff(ModContent.BuffType(), 180); } @@ -66,26 +67,26 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int dustIndex = 0; dustIndex < 8; dustIndex++) { - int dusty = Dust.NewDust(projectile.position, projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); + int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); Main.dust[dusty].velocity *= 1f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { int cloudNumber = Main.rand.Next(2, 6); for (int cloudIndex = 0; cloudIndex < cloudNumber; cloudIndex++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 1f, projectile.owner, 0f, projectile.Calamity().stealthStrike ? 1f : 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 1f, Projectile.owner, 0f, Projectile.Calamity().stealthStrike ? 1f : 0f); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SeafoamBombProj.cs b/Projectiles/Rogue/SeafoamBombProj.cs index 24c28fb284..eb1db3dee1 100644 --- a/Projectiles/Rogue/SeafoamBombProj.cs +++ b/Projectiles/Rogue/SeafoamBombProj.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SeafoamBombProj : ModProjectile @@ -12,42 +13,42 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 14; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 240; - projectile.Calamity().rogue = true; + Projectile.width = 14; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.velocity.Y = projectile.velocity.Y + 0.15f; - projectile.velocity.X = projectile.velocity.X * 0.99f; + Projectile.rotation += Projectile.velocity.X * 0.1f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.15f; + Projectile.velocity.X = Projectile.velocity.X * 0.99f; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = projectile.Calamity().stealthStrike ? 256 : 128; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.Center); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = Projectile.Calamity().stealthStrike ? 256 : 128; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int i = 0; i < (projectile.Calamity().stealthStrike ? 5 : 1); i++) + for (int i = 0; i < (Projectile.Calamity().stealthStrike ? 5 : 1); i++) { - float posX = projectile.Center.X + (projectile.Calamity().stealthStrike ? Main.rand.Next(-50, 51) : 0); - float posY = projectile.Center.Y + (projectile.Calamity().stealthStrike ? Main.rand.Next(-50, 51) : 0); - Projectile.NewProjectile(posX, posY, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.4), 0f, projectile.owner, 0f, 0f); + float posX = Projectile.Center.X + (Projectile.Calamity().stealthStrike ? Main.rand.Next(-50, 51) : 0); + float posY = Projectile.Center.Y + (Projectile.Calamity().stealthStrike ? Main.rand.Next(-50, 51) : 0); + Projectile.NewProjectile(posX, posY, 0f, 0f, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.4), 0f, Projectile.owner, 0f, 0f); } - CalamityUtils.ExplosionGores(projectile.Center, (projectile.Calamity().stealthStrike ? 6 : 3)); + CalamityUtils.ExplosionGores(Projectile.Center, (Projectile.Calamity().stealthStrike ? 6 : 3)); } } } diff --git a/Projectiles/Rogue/SeafoamBubble.cs b/Projectiles/Rogue/SeafoamBubble.cs index 6876119d55..9fe8976cf0 100644 --- a/Projectiles/Rogue/SeafoamBubble.cs +++ b/Projectiles/Rogue/SeafoamBubble.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,53 +17,53 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = 180; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.scale = 1f; - projectile.localNPCHitCooldown = 30; - projectile.Calamity().rogue = true; + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 180; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.scale = 1f; + Projectile.localNPCHitCooldown = 30; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.alpha < 50) + Projectile.ai[0] += 1f; + if (Projectile.alpha < 50) { - projectile.alpha = 50; + Projectile.alpha = 50; } - else if (projectile.alpha > 50) + else if (Projectile.alpha > 50) { - projectile.alpha -= 10; + Projectile.alpha -= 10; } - projectile.scale += 0.002f; - if (projectile.ai[0] % 60 == 0) + Projectile.scale += 0.002f; + if (Projectile.ai[0] % 60 == 0) { - projectile.damage *= 2; + Projectile.damage *= 2; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 60; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 60; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num3; for (int num246 = 0; num246 < 25; num246 = num3 + 1) { - int num247 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 154, 0f, 0f, 0, default, 1f); - Main.dust[num247].position = (Main.dust[num247].position + projectile.position) / 2f; + int num247 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 154, 0f, 0f, 0, default, 1f); + Main.dust[num247].position = (Main.dust[num247].position + Projectile.position) / 2f; Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); Main.dust[num247].velocity.Normalize(); Dust dust = Main.dust[num247]; dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[num247].alpha = projectile.alpha; + Main.dust[num247].alpha = Projectile.alpha; num3 = num246; } } diff --git a/Projectiles/Rogue/SealedSingularityBlackhole.cs b/Projectiles/Rogue/SealedSingularityBlackhole.cs index c607d5d36a..40a06a9232 100644 --- a/Projectiles/Rogue/SealedSingularityBlackhole.cs +++ b/Projectiles/Rogue/SealedSingularityBlackhole.cs @@ -13,53 +13,53 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Blackhole"); - Main.projFrames[projectile.type] = 7; + Main.projFrames[Projectile.type] = 7; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.Calamity().rogue = true; - projectile.tileCollide = false; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.Calamity().rogue = true; + Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } public override void AI() { // Update animation - if (projectile.timeLeft % 5 == 0) + if (Projectile.timeLeft % 5 == 0) { - projectile.frame++; + Projectile.frame++; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } //Succcc - float projCenX = projectile.Center.X; - float projCenY = projectile.Center.Y; - float maxDistance = projectile.Calamity().stealthStrike ? 1000f : 500f; - float succPower = projectile.Calamity().stealthStrike ? 0.25f : 0.1f; + float projCenX = Projectile.Center.X; + float projCenY = Projectile.Center.Y; + float maxDistance = Projectile.Calamity().stealthStrike ? 1000f : 500f; + float succPower = Projectile.Calamity().stealthStrike ? 0.25f : 0.1f; for (int index = 0; index < Main.maxNPCs; index++) { NPC npc = Main.npc[index]; - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1)) + if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1)) { if (CalamityGlobalNPC.ShouldAffectNPC(npc) || npc.type == ModContent.NPCType()) { float extraDistance = (npc.width / 2) + (npc.height / 2); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) { if (npc.position.X < projCenX) { @@ -82,17 +82,17 @@ namespace CalamityMod.Projectiles.Rogue } } - projectile.ai[0]++; - if (projectile.ai[0] > 300f) + Projectile.ai[0]++; + if (Projectile.ai[0] > 300f) { - projectile.scale *= 0.95f; - projectile.Opacity *= 0.95f; - projectile.height = (int)(projectile.height * projectile.scale); - projectile.width = (int)(projectile.width * projectile.scale); + Projectile.scale *= 0.95f; + Projectile.Opacity *= 0.95f; + Projectile.height = (int)(Projectile.height * Projectile.scale); + Projectile.width = (int)(Projectile.width * Projectile.scale); } - if (projectile.scale <= 0.05f) + if (Projectile.scale <= 0.05f) { - projectile.Kill(); + Projectile.Kill(); } } diff --git a/Projectiles/Rogue/SealedSingularityGore.cs b/Projectiles/Rogue/SealedSingularityGore.cs index 25641ec174..e8b70207d4 100644 --- a/Projectiles/Rogue/SealedSingularityGore.cs +++ b/Projectiles/Rogue/SealedSingularityGore.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,31 +16,31 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.friendly = true; - projectile.width = projectile.height = 25; - projectile.Calamity().rogue = true; - projectile.timeLeft = 300; + Projectile.friendly = true; + Projectile.width = Projectile.height = 25; + Projectile.Calamity().rogue = true; + Projectile.timeLeft = 300; } public override void AI() { //Rotation and gravity - projectile.rotation += 0.6f * projectile.direction; - projectile.velocity.Y += 0.27f; - if (projectile.velocity.Y > 16f) + Projectile.rotation += 0.6f * Projectile.direction; + Projectile.velocity.Y += 0.27f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y); //Dust effect int splash = 0; while (splash < 4) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.10f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); splash += 1; } } @@ -47,16 +48,16 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D texture; - switch (projectile.ai[0]) + switch (Projectile.ai[0]) { - case 1f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SealedSingularityGore2"); + case 1f: texture = ModContent.Request("CalamityMod/Projectiles/Rogue/SealedSingularityGore2"); break; - case 2f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SealedSingularityGore3"); + case 2f: texture = ModContent.Request("CalamityMod/Projectiles/Rogue/SealedSingularityGore3"); break; - default: texture = Main.projectileTexture[projectile.type]; + default: texture = Main.projectileTexture[Projectile.type]; break; } - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Rogue/SealedSingularityProj.cs b/Projectiles/Rogue/SealedSingularityProj.cs index 87fb24df73..f082494516 100644 --- a/Projectiles/Rogue/SealedSingularityProj.cs +++ b/Projectiles/Rogue/SealedSingularityProj.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,48 +17,48 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; + Projectile.width = 34; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; } public override void AI() { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; - if (projectile.ai[0] >= 70f) + if (Projectile.ai[0] >= 70f) { - projectile.velocity *= 0.96f; + Projectile.velocity *= 0.96f; } else { - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } } public override void Kill (int timeLeft) { - if (projectile.owner != Main.myPlayer) + if (Projectile.owner != Main.myPlayer) return; //glass-pot break sound - Main.PlaySound(SoundID.Shatter, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.Shatter, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); - int blackhole = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, projectile.Calamity().stealthStrike ? -180f : 0f, 0f); + int blackhole = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.Calamity().stealthStrike ? -180f : 0f, 0f); if (blackhole.WithinBounds(Main.maxProjectiles)) { - Main.projectile[blackhole].Center = projectile.Center; - Main.projectile[blackhole].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + Main.projectile[blackhole].Center = Projectile.Center; + Main.projectile[blackhole].Calamity().stealthStrike = Projectile.Calamity().stealthStrike; } for (int index = 0; index < 3; ++index) { - 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; - Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 0f, projectile.owner, index, 0f); + 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; + Projectile.NewProjectile(Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 0f, Projectile.owner, index, 0f); } } } diff --git a/Projectiles/Rogue/SearedPanProjectile.cs b/Projectiles/Rogue/SearedPanProjectile.cs index 50cd1c9ba5..932d886d7c 100644 --- a/Projectiles/Rogue/SearedPanProjectile.cs +++ b/Projectiles/Rogue/SearedPanProjectile.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SearedPanProjectile : ModProjectile @@ -20,35 +21,35 @@ namespace CalamityMod.Projectiles.Rogue internal SearedPanTypes PanType { - get => (SearedPanTypes)(int)projectile.ai[0]; - set => projectile.ai[0] = (int)value; + get => (SearedPanTypes)(int)Projectile.ai[0]; + set => Projectile.ai[0] = (int)value; } public override void SetStaticDefaults() { DisplayName.SetDefault("Pan"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 420; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 2; + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 420; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 2; } public override void AI() { if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -61,7 +62,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; target.AddBuff(BuffID.Bleeding, 300); target.AddBuff(ModContent.BuffType(), 180); OnHitEffects(-1, target.statLife, true); @@ -69,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects(int targetIndex, int health, bool specialEffects) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); // Don't spawn fireballs or increment the special effects counter if you can't even stealth strike @@ -91,9 +92,9 @@ namespace CalamityMod.Projectiles.Rogue for (int t = 0; t < 4; t++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.2), 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.2), 0f, Projectile.owner); } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/SearedPanSmash"), (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/SearedPanSmash"), (int)Projectile.position.X, (int)Projectile.position.Y); // Stealth strikes also cause any existing fireballs to home in on their targets FireballStuff(true); @@ -102,7 +103,7 @@ namespace CalamityMod.Projectiles.Rogue // Stealth strikes then summon five fireballs to circle the hit enemy, they will home in on their own after a second. for (int t = 0; t < 5; t++) { - int i = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.1), 0f, projectile.owner, 0f, targetIndex); + int i = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), 0f, Projectile.owner, 0f, targetIndex); Main.projectile[i].ModProjectile().Timer = 61; } FireballPositions(targetIndex); @@ -110,7 +111,7 @@ namespace CalamityMod.Projectiles.Rogue else if (PanType == SearedPanTypes.Golden) { modPlayer.searedPanCounter = 0; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/SearedPanSmash"), (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/SearedPanSmash"), (int)Projectile.position.X, (int)Projectile.position.Y); // Golden pans simply cause all fireballs to home in on their targets FireballStuff(true); } @@ -119,7 +120,7 @@ namespace CalamityMod.Projectiles.Rogue // Summon three fireballs to circle the hit enemy for (int t = 0; t < 3; t++) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.1), 0f, projectile.owner, 0f, targetIndex); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), 0f, Projectile.owner, 0f, targetIndex); } FireballPositions(targetIndex); } @@ -127,11 +128,11 @@ namespace CalamityMod.Projectiles.Rogue private void FireballStuff(bool activate) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < Main.maxProjectiles; i++) { - if (!Main.projectile[i].active || Main.projectile[i].owner != projectile.owner) + if (!Main.projectile[i].active || Main.projectile[i].owner != Projectile.owner) continue; if (Main.projectile[i].modProjectile is NiceCock) { @@ -154,7 +155,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < Main.maxProjectiles; i++) { // Keep the loop as short as possible - if (!Main.projectile[i].active || Main.projectile[i].owner != projectile.owner || !Main.projectile[i].Calamity().rogue || targetIndex != (int)Main.projectile[i].ai[1]) + if (!Main.projectile[i].active || Main.projectile[i].owner != Projectile.owner || !Main.projectile[i].Calamity().rogue || targetIndex != (int)Main.projectile[i].ai[1]) continue; if (Main.projectile[i].modProjectile is NiceCock) { @@ -168,7 +169,7 @@ namespace CalamityMod.Projectiles.Rogue float angle = 0f; for (int i = 0; i < Main.maxProjectiles; i++) { - if (!Main.projectile[i].active || Main.projectile[i].owner != projectile.owner || !Main.projectile[i].Calamity().rogue || targetIndex != (int)Main.projectile[i].ai[1]) + if (!Main.projectile[i].active || Main.projectile[i].owner != Projectile.owner || !Main.projectile[i].Calamity().rogue || targetIndex != (int)Main.projectile[i].ai[1]) continue; if (Main.projectile[i].modProjectile is NiceCock) { @@ -199,7 +200,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SeashellBoomerangProjectile.cs b/Projectiles/Rogue/SeashellBoomerangProjectile.cs index 67bcbfed44..15e29fc805 100644 --- a/Projectiles/Rogue/SeashellBoomerangProjectile.cs +++ b/Projectiles/Rogue/SeashellBoomerangProjectile.cs @@ -15,20 +15,20 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 240; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 3; + Projectile.timeLeft = 240; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.Calamity().stealthStrike) - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 10f, 20f, 5, ModContent.ProjectileType()); + if (Projectile.Calamity().stealthStrike) + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 300f, 10f, 20f, 5, ModContent.ProjectileType()); } } } diff --git a/Projectiles/Rogue/SeraphimAngelicLight.cs b/Projectiles/Rogue/SeraphimAngelicLight.cs index 44f828a549..57512a5736 100644 --- a/Projectiles/Rogue/SeraphimAngelicLight.cs +++ b/Projectiles/Rogue/SeraphimAngelicLight.cs @@ -7,32 +7,32 @@ namespace CalamityMod.Projectiles.Rogue { public class SeraphimAngelicLight : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Light Orb"); - Main.projFrames[projectile.type] = 10; + Main.projFrames[Projectile.type] = 10; } public override void SetDefaults() { - projectile.width = 82; - projectile.height = 82; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 10; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; + Projectile.width = 82; + Projectile.height = 82; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 10; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.scale = CalamityUtils.Convert01To010(projectile.timeLeft / 10f); - projectile.Opacity = (float)Math.Sqrt(projectile.scale); - projectile.velocity *= 0.8f; - projectile.frame = Main.projFrames[projectile.type] - projectile.timeLeft; + Projectile.scale = CalamityUtils.Convert01To010(Projectile.timeLeft / 10f); + Projectile.Opacity = (float)Math.Sqrt(Projectile.scale); + Projectile.velocity *= 0.8f; + Projectile.frame = Main.projFrames[Projectile.type] - Projectile.timeLeft; } public override void Kill(int timeLeft) @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Rogue // Release a puff of golden light dust. for (int i = 0; i < 15; i++) { - Dust light = Dust.NewDustPerfect(projectile.Center, 267); + Dust light = Dust.NewDustPerfect(Projectile.Center, 267); light.color = Color.Lerp(Color.Gold, Color.White, Main.rand.NextFloat(0.5f, 1f)); light.velocity = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * 5f; light.scale = 1.35f; @@ -48,16 +48,16 @@ namespace CalamityMod.Projectiles.Rogue } // Release a laser at the nearest target, if one exists. - NPC potentialTarget = projectile.Center.ClosestNPCAt(1300f, true, true); - if (Main.myPlayer != projectile.owner || potentialTarget is null) + NPC potentialTarget = Projectile.Center.ClosestNPCAt(1300f, true, true); + if (Main.myPlayer != Projectile.owner || potentialTarget is null) return; - int damage = projectile.damage; - Vector2 laserDirection = projectile.SafeDirectionTo(potentialTarget.Center); - Projectile.NewProjectile(projectile.Center, laserDirection, ModContent.ProjectileType(), damage, 0f, projectile.owner); + int damage = Projectile.damage; + Vector2 laserDirection = Projectile.SafeDirectionTo(potentialTarget.Center); + Projectile.NewProjectile(Projectile.Center, laserDirection, ModContent.ProjectileType(), damage, 0f, Projectile.owner); } - public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 255 - projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 255 - Projectile.alpha); public override bool CanDamage() => false; } diff --git a/Projectiles/Rogue/SeraphimAngelicLight2.cs b/Projectiles/Rogue/SeraphimAngelicLight2.cs index b487b74d9b..8b54caaf9e 100644 --- a/Projectiles/Rogue/SeraphimAngelicLight2.cs +++ b/Projectiles/Rogue/SeraphimAngelicLight2.cs @@ -7,35 +7,35 @@ namespace CalamityMod.Projectiles.Rogue { public class SeraphimAngelicLight2 : ModProjectile { - public bool FireSmallLaser => projectile.ai[0] == 1f; - public ref float Time => ref projectile.ai[1]; + public bool FireSmallLaser => Projectile.ai[0] == 1f; + public ref float Time => ref Projectile.ai[1]; public const int Lifetime = SeraphimProjectile.SlowdownTime + SeraphimDagger.SlowdownTime; public override string Texture => "CalamityMod/Projectiles/Rogue/SeraphimAngelicLight"; public override void SetStaticDefaults() { DisplayName.SetDefault("Light Orb"); - Main.projFrames[projectile.type] = 10; + Main.projFrames[Projectile.type] = 10; } public override void SetDefaults() { - projectile.width = 82; - projectile.height = 82; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = Lifetime; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; + Projectile.width = 82; + Projectile.height = 82; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.scale = CalamityUtils.Convert01To010(projectile.timeLeft / (float)Lifetime); - projectile.Opacity = (float)Math.Sqrt(projectile.scale); - projectile.velocity *= 0.8f; - projectile.frame = (int)(Utils.InverseLerp(Lifetime, 0f, projectile.timeLeft, true) * Main.projFrames[projectile.type]); + Projectile.scale = CalamityUtils.Convert01To010(Projectile.timeLeft / (float)Lifetime); + Projectile.Opacity = (float)Math.Sqrt(Projectile.scale); + Projectile.velocity *= 0.8f; + Projectile.frame = (int)(Utils.InverseLerp(Lifetime, 0f, Projectile.timeLeft, true) * Main.projFrames[Projectile.type]); } public override void Kill(int timeLeft) @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Rogue // Release a puff of golden light dust. for (int i = 0; i < 16; i++) { - Dust light = Dust.NewDustPerfect(projectile.Center, 267); + Dust light = Dust.NewDustPerfect(Projectile.Center, 267); light.color = Color.Lerp(Color.Gold, Color.White, Main.rand.NextFloat(0.5f, 1f)); light.velocity = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * 5f; light.scale = 0.9f; @@ -51,18 +51,18 @@ namespace CalamityMod.Projectiles.Rogue } // Release a laser at the nearest target, if one exists. - NPC potentialTarget = projectile.Center.ClosestNPCAt(1300f, true, true); - if (Main.myPlayer != projectile.owner || potentialTarget is null) + NPC potentialTarget = Projectile.Center.ClosestNPCAt(1300f, true, true); + if (Main.myPlayer != Projectile.owner || potentialTarget is null) return; - int damage = projectile.damage; - Vector2 laserDirection = projectile.SafeDirectionTo(potentialTarget.Center); - int laser = Projectile.NewProjectile(projectile.Center, laserDirection, ModContent.ProjectileType(), damage, 0f, projectile.owner); + int damage = Projectile.damage; + Vector2 laserDirection = Projectile.SafeDirectionTo(potentialTarget.Center); + int laser = Projectile.NewProjectile(Projectile.Center, laserDirection, ModContent.ProjectileType(), damage, 0f, Projectile.owner); if (Main.projectile.IndexInRange(laser)) Main.projectile[laser].scale = 0.5f; } - public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 255 - projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 255 - Projectile.alpha); public override bool CanDamage() => false; } diff --git a/Projectiles/Rogue/SeraphimBeamLarge.cs b/Projectiles/Rogue/SeraphimBeamLarge.cs index f9c78518cf..466cffa839 100644 --- a/Projectiles/Rogue/SeraphimBeamLarge.cs +++ b/Projectiles/Rogue/SeraphimBeamLarge.cs @@ -5,6 +5,7 @@ using System.IO; using System.Linq; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -14,8 +15,8 @@ namespace CalamityMod.Projectiles.Rogue public int OwnerIndex { - get => (int)projectile.ai[1]; - set => projectile.ai[1] = value; + get => (int)Projectile.ai[1]; + set => Projectile.ai[1] = value; } public override float MaxScale => 1f; public override float MaxLaserLength => 1000f; @@ -26,49 +27,49 @@ namespace CalamityMod.Projectiles.Rogue { Color c1 = Color.Goldenrod; Color c2 = Color.Orange; - Color color = Color.Lerp(c1, c2, projectile.identity % 5f / 5f) * 1.1f; + Color color = Color.Lerp(c1, c2, Projectile.identity % 5f / 5f) * 1.1f; color.A = 25; return color; } } public override Color LightCastColor => Color.Transparent; - public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SeraphimBeamLarge"); - public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/SeraphimBeamLargeMiddle"); - public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/SeraphimBeamLargeEnd"); + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/Projectiles/Rogue/SeraphimBeamLarge"); + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/SeraphimBeamLargeMiddle"); + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/SeraphimBeamLargeEnd"); public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Beam"); - Main.projFrames[projectile.type] = 10; + Main.projFrames[Projectile.type] = 10; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - writer.Write(projectile.scale); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); + writer.Write(Projectile.scale); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - projectile.scale = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); + Projectile.scale = reader.ReadSingle(); } public override void AttachToSomething() { } @@ -76,17 +77,17 @@ namespace CalamityMod.Projectiles.Rogue public override void UpdateLaserMotion() { // Update the direction and rotation of the laser. - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY); - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override float DetermineLaserLength() { float[] sampledLengths = new float[10]; - Collision.LaserScan(projectile.Center, projectile.velocity, projectile.width * projectile.scale, MaxLaserLength, sampledLengths); + Collision.LaserScan(Projectile.Center, Projectile.velocity, Projectile.width * Projectile.scale, MaxLaserLength, sampledLengths); float newLaserLength = sampledLengths.Average(); - if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) return MaxLaserLength; return newLaserLength; @@ -94,35 +95,35 @@ namespace CalamityMod.Projectiles.Rogue public override void PostAI() { - if (projectile.frameCounter == 0) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), projectile.Center); + if (Projectile.frameCounter == 0) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), Projectile.Center); // Determine frames. - projectile.frameCounter++; - if (projectile.frameCounter % 5f == 4f) - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + if (Projectile.frameCounter % 5f == 4f) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { // This should never happen, but just in case- - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) return false; Color beamColor = LaserOverlayColor; - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); // Start texture drawing. - Vector2 centerOnLaser = projectile.Center + projectile.velocity * projectile.scale * 116f; + Vector2 centerOnLaser = Projectile.Center + Projectile.velocity * Projectile.scale * 116f; spriteBatch.Draw(LaserBeginTexture, centerOnLaser - Main.screenPosition, startFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserBeginTexture.Size() / 2f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); @@ -132,32 +133,32 @@ namespace CalamityMod.Projectiles.Rogue // Body drawing. if (laserBodyLength > 0f) { - float laserOffset = middleFrameArea.Height * projectile.scale; + float laserOffset = middleFrameArea.Height * Projectile.scale; float incrementalBodyLength = 0f; while (incrementalBodyLength + 1f < laserBodyLength) { - centerOnLaser += projectile.velocity * laserOffset; + centerOnLaser += Projectile.velocity * laserOffset; incrementalBodyLength += laserOffset; spriteBatch.Draw(LaserMiddleTexture, centerOnLaser - Main.screenPosition, middleFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserMiddleTexture.Size() * 0.5f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); } } - Vector2 laserEndCenter = centerOnLaser + projectile.velocity * endFrameArea.Height - Main.screenPosition; + Vector2 laserEndCenter = centerOnLaser + Projectile.velocity * endFrameArea.Height - Main.screenPosition; spriteBatch.Draw(LaserEndTexture, laserEndCenter, endFrameArea, beamColor, - projectile.rotation, + Projectile.rotation, LaserEndTexture.Size() * 0.5f, - projectile.scale, + Projectile.scale, SpriteEffects.None, 0f); return false; diff --git a/Projectiles/Rogue/SeraphimDagger.cs b/Projectiles/Rogue/SeraphimDagger.cs index 34c8f67a1b..29c6298505 100644 --- a/Projectiles/Rogue/SeraphimDagger.cs +++ b/Projectiles/Rogue/SeraphimDagger.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -11,44 +12,44 @@ namespace CalamityMod.Projectiles.Rogue { public const int SlowdownTime = 45; public const int AimTime = 25; - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() => DisplayName.SetDefault("Seraphim"); public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 150; - projectile.MaxUpdates = 2; - projectile.alpha = 0; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = projectile.MaxUpdates * 15; - projectile.Calamity().rogue = true; + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 150; + Projectile.MaxUpdates = 2; + Projectile.alpha = 0; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 15; + Projectile.Calamity().rogue = true; } public override void AI() { // Initialize rotation. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.ai[1] = Main.rand.NextFloat(-0.8f, 0.8f); - projectile.localAI[0] = 1f; + Projectile.ai[1] = Main.rand.NextFloat(-0.8f, 0.8f); + Projectile.localAI[0] = 1f; } // Handle fade effects. - projectile.Opacity = Utils.InverseLerp(0f, 8f, Time, true) * Utils.InverseLerp(0f, 8f, projectile.timeLeft, true); + Projectile.Opacity = Utils.InverseLerp(0f, 8f, Time, true) * Utils.InverseLerp(0f, 8f, Projectile.timeLeft, true); // Very rapidly slow down and spin. if (Time <= SlowdownTime) { float angularVelocityInterpolant = (float)Math.Pow(1f - Utils.InverseLerp(0f, SlowdownTime, Time, true), 2D); float angularVelocity = angularVelocityInterpolant * MathHelper.Pi / 6f; - projectile.rotation += angularVelocity; - projectile.velocity *= 0.95f; + Projectile.rotation += angularVelocity; + Projectile.velocity *= 0.95f; } // Aim at nearby targets. @@ -56,38 +57,38 @@ namespace CalamityMod.Projectiles.Rogue { if (Time == SlowdownTime + 25f) { - Main.PlaySound(SoundID.DD2_WyvernDiveDown, projectile.Center); - Main.PlaySound(SoundID.DD2_DarkMageHealImpact, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_WyvernDiveDown, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Projectile.Center); } - NPC potentialTarget = projectile.Center.ClosestNPCAt(1600f); - float idealRotation = projectile.AngleTo(potentialTarget?.Center ?? projectile.Center - Vector2.UnitY) + MathHelper.PiOver4; - projectile.rotation = projectile.rotation.AngleLerp(idealRotation, 0.08f).AngleTowards(idealRotation, 0.1f); - projectile.velocity *= 0.9f; + NPC potentialTarget = Projectile.Center.ClosestNPCAt(1600f); + float idealRotation = Projectile.AngleTo(potentialTarget?.Center ?? Projectile.Center - Vector2.UnitY) + MathHelper.PiOver4; + Projectile.rotation = Projectile.rotation.AngleLerp(idealRotation, 0.08f).AngleTowards(idealRotation, 0.1f); + Projectile.velocity *= 0.9f; // And fire. if (Time == SlowdownTime + AimTime) { - projectile.rotation = idealRotation; - projectile.velocity = (idealRotation - MathHelper.PiOver4).ToRotationVector2() * 14f; + Projectile.rotation = idealRotation; + Projectile.velocity = (idealRotation - MathHelper.PiOver4).ToRotationVector2() * 14f; } } // Accelerate. - else if (projectile.velocity.Length() < 28f) - projectile.velocity *= 1.045f; + else if (Projectile.velocity.Length() < 28f) + Projectile.velocity *= 1.045f; Time++; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; Vector2 origin = texture.Size() * 0.5f; - Vector2 baseDrawPosition = projectile.Center - Main.screenPosition; + Vector2 baseDrawPosition = Projectile.Center - Main.screenPosition; - float endFade = Utils.InverseLerp(0f, 12f, projectile.timeLeft, true); - Color mainColor = Color.Goldenrod * projectile.Opacity * endFade * 1.5f; + float endFade = Utils.InverseLerp(0f, 12f, Projectile.timeLeft, true); + Color mainColor = Color.Goldenrod * Projectile.Opacity * endFade * 1.5f; mainColor.A = 74; Color afterimageLightColor = Color.White * endFade; afterimageLightColor.A = 74; @@ -95,16 +96,16 @@ namespace CalamityMod.Projectiles.Rogue // Distribute many knives as they dissipate into light. for (int i = 0; i < 12; i++) { - Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 12f).ToRotationVector2() * (1f - projectile.Opacity) * 6f; - spriteBatch.Draw(texture, drawPosition, null, afterimageLightColor, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 12f).ToRotationVector2() * (1f - Projectile.Opacity) * 6f; + spriteBatch.Draw(texture, drawPosition, null, afterimageLightColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } // Draw specialized afterimages. for (int i = 0; i < 10; i++) { - Vector2 drawPosition = baseDrawPosition - projectile.velocity * i * 0.45f; + Vector2 drawPosition = baseDrawPosition - Projectile.velocity * i * 0.45f; Color afterimageColor = mainColor * (1f - i / 10f); - spriteBatch.Draw(texture, drawPosition, null, afterimageColor, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, drawPosition, null, afterimageColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } return false; } diff --git a/Projectiles/Rogue/SeraphimProjectile.cs b/Projectiles/Rogue/SeraphimProjectile.cs index 8e8758d680..bcc32d2e72 100644 --- a/Projectiles/Rogue/SeraphimProjectile.cs +++ b/Projectiles/Rogue/SeraphimProjectile.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Rogue public const int SlowdownTime = 50; public static readonly float SlowdownFactor = (float)Math.Pow(SlowdownSpeed / InitialSpeed, 1f / SlowdownTime); - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Items/Weapons/Rogue/Seraphim"; @@ -22,37 +22,37 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 82; - projectile.height = 82; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = SlowdownTime; - projectile.alpha = 0; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 14; - projectile.Calamity().rogue = true; + Projectile.width = 82; + Projectile.height = 82; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = SlowdownTime; + Projectile.alpha = 0; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 14; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; // Very rapidly slow down and fade out, transforming into light. if (Time <= SlowdownTime) { - projectile.Opacity = (float)Math.Pow(1f - Time / SlowdownTime, 2D); - projectile.velocity *= SlowdownFactor; + Projectile.Opacity = (float)Math.Pow(1f - Time / SlowdownTime, 2D); + Projectile.velocity *= SlowdownFactor; - int lightDustCount = (int)MathHelper.Lerp(8f, 1f, projectile.Opacity); + int lightDustCount = (int)MathHelper.Lerp(8f, 1f, Projectile.Opacity); for (int i = 0; i < lightDustCount; i++) { - Vector2 dustSpawnPosition = projectile.Center + Main.rand.NextVector2Unit() * (1f - projectile.Opacity) * 45f; + Vector2 dustSpawnPosition = Projectile.Center + Main.rand.NextVector2Unit() * (1f - Projectile.Opacity) * 45f; Dust light = Dust.NewDustPerfect(dustSpawnPosition, 267); light.color = Color.Lerp(Color.Gold, Color.White, Main.rand.NextFloat(0.5f, 1f)); light.velocity = Main.rand.NextVector2Circular(10f, 10f); - light.scale = MathHelper.Lerp(1.3f, 0.8f, projectile.Opacity) * Main.rand.NextFloat(0.8f, 1.2f); + light.scale = MathHelper.Lerp(1.3f, 0.8f, Projectile.Opacity) * Main.rand.NextFloat(0.8f, 1.2f); light.noGravity = true; } } @@ -62,59 +62,59 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; // Create a light projectile that explodes into a laserbeam. - int damage = projectile.damage; - float kb = projectile.knockBack; - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), damage, kb, projectile.owner); + int damage = Projectile.damage; + float kb = Projectile.knockBack; + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), damage, kb, Projectile.owner); // As well as a fan of light daggers. - NPC potentialTarget = projectile.Center.ClosestNPCAt(1600f); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(1600f); for (int i = 0; i < Seraphim.SplitDaggerCount; i++) { float offsetAngle = MathHelper.Lerp(-0.9f, 0.9f, i / (float)(Seraphim.SplitDaggerCount - 1f)); // Make the fan point away from nearby targets. if (potentialTarget != null) - offsetAngle -= projectile.AngleTo(potentialTarget.Center); + offsetAngle -= Projectile.AngleTo(potentialTarget.Center); Vector2 fanVelocity = offsetAngle.ToRotationVector2() * 10f; - Projectile.NewProjectile(projectile.Center, fanVelocity, ModContent.ProjectileType(), damage / 2, kb, projectile.owner, i); + Projectile.NewProjectile(Projectile.Center, fanVelocity, ModContent.ProjectileType(), damage / 2, kb, Projectile.owner, i); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.velocity *= 0.4f; + Projectile.velocity *= 0.4f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; Vector2 origin = texture.Size() * 0.5f; - Vector2 baseDrawPosition = projectile.Center - Main.screenPosition; + Vector2 baseDrawPosition = Projectile.Center - Main.screenPosition; - float endFade = Utils.InverseLerp(0f, 12f, projectile.timeLeft, true); - Color mainColor = Color.White * projectile.Opacity * endFade * 1.5f; - mainColor.A = (byte)(255 - projectile.alpha); + float endFade = Utils.InverseLerp(0f, 12f, Projectile.timeLeft, true); + Color mainColor = Color.White * Projectile.Opacity * endFade * 1.5f; + mainColor.A = (byte)(255 - Projectile.alpha); Color afterimageLightColor = Color.White * endFade; - afterimageLightColor.A = (byte)(255 - projectile.alpha); + afterimageLightColor.A = (byte)(255 - Projectile.alpha); // Distribute many knives as they dissipate into light. for (int i = 0; i < 18; i++) { - Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 18f).ToRotationVector2() * (1f - projectile.Opacity) * 16f; - spriteBatch.Draw(texture, drawPosition, null, afterimageLightColor, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 18f).ToRotationVector2() * (1f - Projectile.Opacity) * 16f; + spriteBatch.Draw(texture, drawPosition, null, afterimageLightColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } // Draw specialized afterimages. for (int i = 0; i < 8; i++) { - Vector2 drawPosition = baseDrawPosition - projectile.velocity * i * 0.3f; + Vector2 drawPosition = baseDrawPosition - Projectile.velocity * i * 0.3f; Color afterimageColor = mainColor * (1f - i / 8f); - spriteBatch.Draw(texture, drawPosition, null, afterimageColor, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, drawPosition, null, afterimageColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } return false; } diff --git a/Projectiles/Rogue/ShadowBlackhole.cs b/Projectiles/Rogue/ShadowBlackhole.cs index c7ccc69dd0..fc46c2152e 100644 --- a/Projectiles/Rogue/ShadowBlackhole.cs +++ b/Projectiles/Rogue/ShadowBlackhole.cs @@ -11,49 +11,49 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Blackhole"); - Main.projFrames[projectile.type] = 7; + Main.projFrames[Projectile.type] = 7; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.Calamity().rogue = true; - projectile.tileCollide = false; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 20; + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.Calamity().rogue = true; + Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 20; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } public override void AI() { // Update animation - if (projectile.timeLeft % 5 == 0) + if (Projectile.timeLeft % 5 == 0) { - projectile.frame++; + Projectile.frame++; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.ai[0]++; - if (projectile.ai[0] > 120f) + Projectile.ai[0]++; + if (Projectile.ai[0] > 120f) { - projectile.scale *= 0.95f; - projectile.Opacity *= 0.95f; - CalamityGlobalProjectile.ExpandHitboxBy(projectile, projectile.scale); + Projectile.scale *= 0.95f; + Projectile.Opacity *= 0.95f; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, Projectile.scale); } - if (projectile.scale <= 0.05f) + if (Projectile.scale <= 0.05f) { - projectile.Kill(); + Projectile.Kill(); } } diff --git a/Projectiles/Rogue/ShatteredExplosion.cs b/Projectiles/Rogue/ShatteredExplosion.cs index 6a13ef485e..589a5612ec 100644 --- a/Projectiles/Rogue/ShatteredExplosion.cs +++ b/Projectiles/Rogue/ShatteredExplosion.cs @@ -17,31 +17,31 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 150; - projectile.height = 150; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 15; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.Calamity().rogue = true; + Projectile.width = 150; + Projectile.height = 150; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 15; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; dust = false; } - projectile.localAI[0] += 1f; - if (dust && projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (dust && Projectile.localAI[0] > 4f) { for (int i = 0; i < 5; i++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1.5f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 1.5f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } diff --git a/Projectiles/Rogue/ShatteredSunKnife.cs b/Projectiles/Rogue/ShatteredSunKnife.cs index 8dd51fe6f9..e0314de08a 100644 --- a/Projectiles/Rogue/ShatteredSunKnife.cs +++ b/Projectiles/Rogue/ShatteredSunKnife.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,60 +16,60 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Shattered Sun"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 56; - projectile.height = 56; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 4; - projectile.timeLeft = 300; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.Calamity().rogue = true; + Projectile.width = 56; + Projectile.height = 56; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 4; + Projectile.timeLeft = 300; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 5f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] < 5f) { - projectile.alpha -= 50; + Projectile.alpha -= 50; } - if (projectile.ai[1] == 5f) + if (Projectile.ai[1] == 5f) { - projectile.alpha = 0; - projectile.tileCollide = false; + Projectile.alpha = 0; + Projectile.tileCollide = false; } - if (projectile.ai[1] == 20f) + if (Projectile.ai[1] == 20f) { int numProj = 5; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { int spread = 6; int projID = ModContent.ProjectileType(); - int splitDamage = (int)(0.75f * projectile.damage); + int splitDamage = (int)(0.75f * Projectile.damage); float splitKB = 1f; for (int i = 0; i < numProj; i++) { - Vector2 perturbedspeed = new Vector2(projectile.velocity.X, projectile.velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(projectile.Center, perturbedspeed * 0.2f, projID, splitDamage, splitKB, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + Vector2 perturbedspeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); + int proj = Projectile.NewProjectile(Projectile.Center, perturbedspeed * 0.2f, projID, splitDamage, splitKB, Projectile.owner, 0f, 0f); + Main.projectile[proj].Calamity().stealthStrike = Projectile.Calamity().stealthStrike; spread -= Main.rand.Next(2, 6); } - Main.PlaySound(SoundID.Item27, projectile.position); - projectile.active = false; + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + Projectile.active = false; for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -77,27 +78,27 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 16; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } } - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; + float num472 = Projectile.Center.X; + float num473 = Projectile.Center.Y; float num474 = 600f; for (int num475 = 0; num475 < Main.maxNPCs; num475++) { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + if (Main.npc[num475].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { float npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); float npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); + float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); if (num478 < num474) { if (Main.npc[num475].position.X < num472) @@ -124,17 +125,17 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } private void ShatteredExplosion() { int projID = ModContent.ProjectileType(); - int explosionDamage = (int)(projectile.damage * 0.45f); + int explosionDamage = (int)(Projectile.damage * 0.45f); float explosionKB = 3f; - Projectile.NewProjectile(projectile.Center, Vector2.Zero, projID, explosionDamage, explosionKB, projectile.owner, 0f, 0f); - Main.PlaySound(SoundID.Item14, projectile.position); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, projID, explosionDamage, explosionKB, Projectile.owner, 0f, 0f); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => ShatteredExplosion(); @@ -149,10 +150,10 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 246, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 1f); } } } diff --git a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs index dcb93ac967..499a8053ef 100644 --- a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs +++ b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -17,21 +18,21 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Scorched Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 56; - projectile.height = 56; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.Calamity().rogue = true; - projectile.tileCollide = false; - projectile.timeLeft = 500; + Projectile.width = 56; + Projectile.height = 56; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.Calamity().rogue = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 500; } public override void AI() @@ -39,53 +40,53 @@ namespace CalamityMod.Projectiles.Rogue counter++; if (counter == 1) { - stealthOrigin = projectile.ai[0] == 1f; - projectile.alpha += (int) projectile.ai[1]; - projectile.ai[0] = 0f; + stealthOrigin = Projectile.ai[0] == 1f; + Projectile.alpha += (int) Projectile.ai[1]; + Projectile.ai[0] = 0f; } - if (counter == 20 && !projectile.Calamity().stealthStrike && !stealthOrigin) + if (counter == 20 && !Projectile.Calamity().stealthStrike && !stealthOrigin) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } if (counter % 5 == 0) { - projectile.velocity *= 1.15f; + Projectile.velocity *= 1.15f; } if (counter % 10 == 0) { - if (!stealthOrigin && projectile.alpha < 200) - projectile.alpha += 6; + if (!stealthOrigin && Projectile.alpha < 200) + Projectile.alpha += 6; } - if (counter % 9 == 0 || (counter % 5 == 0 && projectile.Calamity().stealthStrike)) + if (counter % 9 == 0 || (counter % 5 == 0 && Projectile.Calamity().stealthStrike)) { - int timesToSpawnDust = projectile.Calamity().stealthStrike ? 2 : 1; + int timesToSpawnDust = Projectile.Calamity().stealthStrike ? 2 : 1; for (int i = 0; i < timesToSpawnDust; i++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, projectile.Calamity().stealthStrike ? 1.8f : 1.3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, Projectile.Calamity().stealthStrike ? 1.8f : 1.3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, projectile.Calamity().stealthStrike ? 1.8f : 1.3f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, Projectile.Calamity().stealthStrike ? 1.8f : 1.3f); Main.dust[num624].velocity *= 2f; } } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 2.355f; + if (Projectile.spriteDirection == -1) { - projectile.rotation -= 1.57f; + Projectile.rotation -= 1.57f; } - Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + Lighting.AddLight(Projectile.Center, 0.7f, 0.3f, 0f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); float num633; - Vector2 vector46 = projectile.position; + Vector2 vector46 = Projectile.position; bool flag25 = false; for (int num645 = 0; num645 < 200; num645++) { NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); if (!flag25) { num633 = num646; @@ -94,37 +95,37 @@ namespace CalamityMod.Projectiles.Rogue } } } - if (flag25 && projectile.ai[0] == 0f) + if (flag25 && Projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - projectile.Center; + Vector2 vector47 = vector46 - Projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 8f; vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 4f; vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } } - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; + float num472 = Projectile.Center.X; + float num473 = Projectile.Center.Y; float num474 = 600f; for (int num475 = 0; num475 < Main.maxNPCs; num475++) { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + if (Main.npc[num475].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { float npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); float npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); + float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); if (num478 < num474) { if (Main.npc[num475].position.X < num472) @@ -151,18 +152,18 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { int numProj = 2; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; Vector2 correctedVelocity = target.Center - owner.Center; correctedVelocity.Normalize(); correctedVelocity *= 10f; @@ -170,13 +171,13 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < numProj; i++) { Vector2 perturbedspeed = new Vector2(correctedVelocity.X, correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - int projDamage = (int)(projectile.damage * 0.6f); + int projDamage = (int)(Projectile.damage * 0.6f); float kb = 1f; - int proj = Projectile.NewProjectile(owner.Center.X, owner.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, projectile.type, projDamage, kb, projectile.owner, 1f, projectile.alpha); + int proj = Projectile.NewProjectile(owner.Center.X, owner.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, Projectile.type, projDamage, kb, Projectile.owner, 1f, Projectile.alpha); spread -= Main.rand.Next(2, 6); Main.projectile[proj].ai[0] = 1f; } - projectile.Kill(); + Projectile.Kill(); } } target.AddBuff(ModContent.BuffType(), 180); @@ -184,12 +185,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { int numProj = 2; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; Vector2 correctedVelocity = target.Center - owner.Center; correctedVelocity.Normalize(); correctedVelocity *= 10f; @@ -197,13 +198,13 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < numProj; i++) { Vector2 perturbedspeed = new Vector2(correctedVelocity.X, correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - int projDamage = (int)(projectile.damage * 0.6f); + int projDamage = (int)(Projectile.damage * 0.6f); float kb = 1f; - int proj = Projectile.NewProjectile(owner.Center.X, owner.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, projectile.type, projDamage, kb, projectile.owner, 1f, projectile.alpha); + int proj = Projectile.NewProjectile(owner.Center.X, owner.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, Projectile.type, projDamage, kb, Projectile.owner, 1f, Projectile.alpha); spread -= Main.rand.Next(2, 6); Main.projectile[proj].ai[0] = 1f; } - projectile.Kill(); + Projectile.Kill(); } } target.AddBuff(ModContent.BuffType(), 180); @@ -211,15 +212,15 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = Projectile.height = 200; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 4; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -229,14 +230,14 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 12; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } } } diff --git a/Projectiles/Rogue/ShinobiBladeProjectile.cs b/Projectiles/Rogue/ShinobiBladeProjectile.cs index f3e7f1b93c..d2fde0a36a 100644 --- a/Projectiles/Rogue/ShinobiBladeProjectile.cs +++ b/Projectiles/Rogue/ShinobiBladeProjectile.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -14,55 +15,55 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Shinobi Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 16; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = Projectile.height = 16; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.PiOver2 * projectile.spriteDirection; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.PiOver2 * Projectile.spriteDirection; if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 15); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 15); Main.dust[dust].noGravity = true; } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + Projectile.Kill(); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (target.life <= 0) - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], 10, ModContent.ProjectileType(), 1200f, 0f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 10, ModContent.ProjectileType(), 1200f, 0f); } public override void OnHitPvp(Player target, int damage, bool crit) { if (target.statLife <= 0) - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], 10, ModContent.ProjectileType(), 1200f, 0f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 10, ModContent.ProjectileType(), 1200f, 0f); } public override void Kill(int timeLeft) @@ -70,7 +71,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 5; i++) { int dustType = 42; - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X / 2, projectile.velocity.Y / 2, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, Projectile.velocity.X / 2, Projectile.velocity.Y / 2, 0, default, 1.5f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Rogue/ShockGrenadeBolt.cs b/Projectiles/Rogue/ShockGrenadeBolt.cs index 8e00b12f5d..76f03ab81b 100644 --- a/Projectiles/Rogue/ShockGrenadeBolt.cs +++ b/Projectiles/Rogue/ShockGrenadeBolt.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,50 +16,50 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = 3; - projectile.timeLeft = 120; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = 3; + Projectile.timeLeft = 120; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; - if (projectile.timeLeft < 55) + if (Projectile.timeLeft < 55) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { float minDist = 999f; int index = 0; for (int i = 0; i < Main.npc.Length; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < minDist) { minDist = dist; @@ -70,14 +71,14 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocityNew; if (minDist < 999f) { - velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew = Main.npc[index].Center - Projectile.Center; velocityNew.Normalize(); velocityNew *= 2f; - projectile.velocity += velocityNew; - if (projectile.velocity.Length() > 10f) + Projectile.velocity += velocityNew; + if (Projectile.velocity.Length() > 10f) { - projectile.velocity.Normalize(); - projectile.velocity *= 10f; + Projectile.velocity.Normalize(); + Projectile.velocity *= 10f; } } } @@ -96,25 +97,25 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D sprite; - if (projectile.ai[0] == 0f) - sprite = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/ShockGrenadeBolt"); + if (Projectile.ai[0] == 0f) + sprite = ModContent.Request("CalamityMod/Projectiles/Rogue/ShockGrenadeBolt"); else - sprite = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/ShockGrenadeBolt2"); + sprite = ModContent.Request("CalamityMod/Projectiles/Rogue/ShockGrenadeBolt2"); Color drawColour = Color.White; Vector2 origin = new Vector2(frameWidth / 2, frameHeight / 2); - spriteBatch.Draw(sprite, projectile.Center - Main.screenPosition, new Rectangle(0, frameHeight * projectile.frame, frameWidth, frameHeight), drawColour, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(sprite, Projectile.Center - Main.screenPosition, new Rectangle(0, frameHeight * Projectile.frame, frameWidth, frameHeight), drawColour, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 93, 0.25f, 0f); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 93, 0.25f, 0f); for (int i = 0; i < 5; i++) { int dustType = 132; - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 0.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 0.5f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Rogue/ShockGrenadeExplosion.cs b/Projectiles/Rogue/ShockGrenadeExplosion.cs index 12ca8eb4c2..c49f6bede3 100644 --- a/Projectiles/Rogue/ShockGrenadeExplosion.cs +++ b/Projectiles/Rogue/ShockGrenadeExplosion.cs @@ -18,21 +18,21 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 320; - projectile.height = 320; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 320; + Projectile.height = 320; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.timeLeft >= 8) + if (Projectile.timeLeft >= 8) { for (int i = 0; i < 50; i++) { @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue dustVelocity.Normalize(); dustVelocity *= 8; - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, dustVelocity.X, dustVelocity.Y, 0, default, 0.75f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, dustVelocity.X, dustVelocity.Y, 0, default, 0.75f); Main.dust[dust].noGravity = true; } } @@ -62,6 +62,6 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(BuffID.Electrified, 180); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); } } diff --git a/Projectiles/Rogue/ShockGrenadeProjectile.cs b/Projectiles/Rogue/ShockGrenadeProjectile.cs index 7037aeebbb..380c4f5d6f 100644 --- a/Projectiles/Rogue/ShockGrenadeProjectile.cs +++ b/Projectiles/Rogue/ShockGrenadeProjectile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -20,113 +21,113 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.velocity.Y += 0.1f; - if (projectile.velocity.Y >= 16f) + Projectile.velocity.Y += 0.1f; + if (Projectile.velocity.Y >= 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } - projectile.rotation += projectile.direction * 0.2f; + Projectile.rotation += Projectile.direction * 0.2f; } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - projectile.localAI[0] = 0; - projectile.localAI[1] = 0; + Projectile.localAI[0] = 0; + Projectile.localAI[1] = 0; - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { if (oldVelocity.X < 0) { - projectile.localAI[0] = 1; + Projectile.localAI[0] = 1; } if (oldVelocity.X > 0) { - projectile.localAI[0] = -1; + Projectile.localAI[0] = -1; } } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { if (oldVelocity.Y < 0) { - projectile.localAI[1] = 1; + Projectile.localAI[1] = 1; } if (oldVelocity.Y > 0) { - projectile.localAI[1] = -1; + Projectile.localAI[1] = -1; } } - projectile.Kill(); + Projectile.Kill(); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Vector2 origin = new Vector2(spriteWidth / 2, spriteHeight / 2); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ShockGrenadeGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/ShockGrenadeGlow"), Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 94, 0.75f, 0f); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 94, 0.75f, 0f); int boltCount = Main.rand.Next(5, 11); for (int i = 0; i < boltCount; i++) { int boltScatter = 1; Vector2 boltVelocity = new Vector2(Main.rand.NextFloat(-boltScatter, boltScatter), Main.rand.NextFloat(-boltScatter * 2, boltScatter * 2)); - if (projectile.localAI[0] != 0) + if (Projectile.localAI[0] != 0) { boltVelocity.X *= -1; } - if (projectile.localAI[1] != 0) + if (Projectile.localAI[1] != 0) { boltVelocity.Y *= -1; } - boltVelocity.X += projectile.localAI[0]; - boltVelocity.Y += projectile.localAI[1] * 2; + boltVelocity.X += Projectile.localAI[0]; + boltVelocity.Y += Projectile.localAI[1] * 2; boltVelocity.Normalize(); boltVelocity *= 10; int boltType = Main.rand.Next(0, 2); - int boltDamage = projectile.damage / 2; + int boltDamage = Projectile.damage / 2; int boltAI = 0; - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { boltAI = 1; } - Projectile.NewProjectile(projectile.Center, boltVelocity, ModContent.ProjectileType(), boltDamage, 0, projectile.owner, boltType, boltAI); + Projectile.NewProjectile(Projectile.Center, boltVelocity, ModContent.ProjectileType(), boltDamage, 0, Projectile.owner, boltType, boltAI); } - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - int auraDamage = projectile.damage / 4; - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 1, projectile.owner, 0, 0); + int auraDamage = Projectile.damage / 4; + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 1, Projectile.owner, 0, 0); - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 93, 0.5f, 0f); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 93, 0.5f, 0f); } - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 3, projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 3, Projectile.owner, 0, 0); } } } diff --git a/Projectiles/Rogue/ShockTeslaAura.cs b/Projectiles/Rogue/ShockTeslaAura.cs index d7f18a9747..e6869fc942 100644 --- a/Projectiles/Rogue/ShockTeslaAura.cs +++ b/Projectiles/Rogue/ShockTeslaAura.cs @@ -22,53 +22,53 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 218; - projectile.height = 218; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = lifetime; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - projectile.Calamity().rogue = true; + Projectile.width = 218; + Projectile.height = 218; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = lifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.localAI[0]++; - projectile.frameCounter = 0; + Projectile.localAI[0]++; + Projectile.frameCounter = 0; } - if (projectile.localAI[0] >= framesY) + if (Projectile.localAI[0] >= framesY) { - projectile.localAI[0] = 0; - projectile.localAI[1]++; + Projectile.localAI[0] = 0; + Projectile.localAI[1]++; } - if (projectile.localAI[1] >= framesX) + if (Projectile.localAI[1] >= framesX) { - projectile.localAI[1] = 0; + Projectile.localAI[1] = 0; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D sprite = Main.projectileTexture[projectile.type]; + Texture2D sprite = Main.projectileTexture[Projectile.type]; Color drawColour = Color.White; - Rectangle sourceRect = new Rectangle(projectile.width * (int)projectile.localAI[1], projectile.height * (int)projectile.localAI[0], projectile.width, projectile.height); - Vector2 origin = new Vector2(projectile.width / 2, projectile.height / 2); + Rectangle sourceRect = new Rectangle(Projectile.width * (int)Projectile.localAI[1], Projectile.height * (int)Projectile.localAI[0], Projectile.width, Projectile.height); + Vector2 origin = new Vector2(Projectile.width / 2, Projectile.height / 2); float opacity = 1f; int sparkCount = 0; int fadeTime = 20; - if (projectile.timeLeft < fadeTime) + if (Projectile.timeLeft < fadeTime) { - opacity = projectile.timeLeft * (1f / fadeTime); - sparkCount = fadeTime - projectile.timeLeft; + opacity = Projectile.timeLeft * (1f / fadeTime); + sparkCount = fadeTime - Projectile.timeLeft; } for (int i = 0; i < sparkCount * 2; i++) @@ -84,11 +84,11 @@ namespace CalamityMod.Projectiles.Rogue dustPos.Normalize(); dustPos *= radius + Main.rand.NextFloat(-rangeDiff, rangeDiff); - int dust = Dust.NewDust(projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); + int dust = Dust.NewDust(Projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); Main.dust[dust].noGravity = true; } - spriteBatch.Draw(sprite, projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(sprite, Projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); return false; } @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Rogue { knockbackMultiplier = 0; } - Vector2 trueKnockback = target.Center - projectile.Center; + Vector2 trueKnockback = target.Center - Projectile.Center; trueKnockback.Normalize(); target.velocity = trueKnockback * knockbackMultiplier; } @@ -117,6 +117,6 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(BuffID.Electrified, 180); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); } } diff --git a/Projectiles/Rogue/ShroomerangProj.cs b/Projectiles/Rogue/ShroomerangProj.cs index 8881987183..1afdf2b95d 100644 --- a/Projectiles/Rogue/ShroomerangProj.cs +++ b/Projectiles/Rogue/ShroomerangProj.cs @@ -18,55 +18,55 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 300; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 3; + Projectile.timeLeft = 300; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.5f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - if (projectile.timeLeft % 15 == 0 && projectile.owner == Main.myPlayer) + if (Projectile.timeLeft % 15 == 0 && Projectile.owner == Main.myPlayer) { - Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; + Vector2 vector62 = Main.player[Projectile.owner].Center - Projectile.Center; Vector2 vector63 = vector62 * -1f; vector63.Normalize(); vector63 *= (float)Main.rand.Next(45, 65) * 0.1f; vector63 = vector63.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.1), projectile.knockBack * 0.2f, projectile.owner, -10f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; - if (projectile.Calamity().stealthStrike) + Player player = Main.player[Projectile.owner]; + if (Projectile.Calamity().stealthStrike) player.AddBuff(ModContent.BuffType(), 720); } public override void OnHitPvp(Player target, int damage, bool crit) { - Player player = Main.player[projectile.owner]; - if (projectile.Calamity().stealthStrike) + Player player = Main.player[Projectile.owner]; + if (Projectile.Calamity().stealthStrike) player.AddBuff(ModContent.BuffType(), 720); } } diff --git a/Projectiles/Rogue/ShroomerangSpore.cs b/Projectiles/Rogue/ShroomerangSpore.cs index 29273bd79c..caed4f705b 100644 --- a/Projectiles/Rogue/ShroomerangSpore.cs +++ b/Projectiles/Rogue/ShroomerangSpore.cs @@ -17,15 +17,15 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - projectile.Calamity().rogue = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 3600; + Projectile.Calamity().rogue = true; } public override bool PreAI() @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Rogue if (!initialized) { initialized = true; - projectile.localAI[0] = Main.rand.Next(-60, 61); //used for mycoroot stealth strike for minor randomization + Projectile.localAI[0] = Main.rand.Next(-60, 61); //used for mycoroot stealth strike for minor randomization } return true; @@ -41,13 +41,13 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 56); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 56); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 56, vector7.X, vector7.Y, 100, default, 0.5f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; diff --git a/Projectiles/Rogue/SkyBomberGas.cs b/Projectiles/Rogue/SkyBomberGas.cs index 23cccb4571..4a227560c9 100644 --- a/Projectiles/Rogue/SkyBomberGas.cs +++ b/Projectiles/Rogue/SkyBomberGas.cs @@ -14,27 +14,27 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 32; - projectile.height = 28; - projectile.friendly = true; - projectile.alpha = 0; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().rogue = true; + Projectile.width = 32; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.alpha = 0; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 100; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.timeLeft < 50) - projectile.alpha += 5; - if (projectile.timeLeft < 75) + if (Projectile.timeLeft < 50) + Projectile.alpha += 5; + if (Projectile.timeLeft < 75) { - projectile.velocity *= 0.95f; - projectile.scale += 0.002f; + Projectile.velocity *= 0.95f; + Projectile.scale += 0.002f; } } @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 8; i++) { - Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid); } } } diff --git a/Projectiles/Rogue/SkyStabberProj.cs b/Projectiles/Rogue/SkyStabberProj.cs index 81ab639c8b..a96d7b7ee7 100644 --- a/Projectiles/Rogue/SkyStabberProj.cs +++ b/Projectiles/Rogue/SkyStabberProj.cs @@ -19,52 +19,52 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 15; - projectile.height = 15; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.tileCollide = true; - projectile.penetrate = 20; - projectile.timeLeft = Lifetime; + Projectile.width = 15; + Projectile.height = 15; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.tileCollide = true; + Projectile.penetrate = 20; + Projectile.timeLeft = Lifetime; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) + if (Projectile.ai[0] >= 90f) { - projectile.velocity.X *= 0.98f; - projectile.velocity.Y *= 0.98f; + Projectile.velocity.X *= 0.98f; + Projectile.velocity.Y *= 0.98f; } else { - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.killSpikyBalls) { - projectile.active = false; - projectile.netUpdate = true; + Projectile.active = false; + Projectile.netUpdate = true; } } // Makes the projectile bounce infinitely, as it stops mid-air anyway. public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - if (projectile.velocity.X != oldVelocity.X) + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X * 0.6f; + Projectile.velocity.X = -oldVelocity.X * 0.6f; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y * 0.6f; + Projectile.velocity.Y = -oldVelocity.Y * 0.6f; } return false; } @@ -81,11 +81,11 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects(Vector2 targetPos) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { for (int n = 0; n < 4; n++) { - Projectile feather = CalamityUtils.ProjectileRain(targetPos, 400f, 100f, 500f, 800f, 20f, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack * 0.25f, projectile.owner); + Projectile feather = CalamityUtils.ProjectileRain(targetPos, 400f, 100f, 500f, 800f, 20f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner); if (feather.whoAmI.WithinBounds(Main.maxProjectiles)) feather.Calamity().forceRogue = true; } diff --git a/Projectiles/Rogue/SkyfinNuke.cs b/Projectiles/Rogue/SkyfinNuke.cs index 3535322c3a..e864006650 100644 --- a/Projectiles/Rogue/SkyfinNuke.cs +++ b/Projectiles/Rogue/SkyfinNuke.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -18,82 +19,82 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 720; - projectile.alpha = 0; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 1; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 720; + Projectile.alpha = 0; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 1; } public override void AI() { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); const float turnSpeed = 20f; - float speedMult = projectile.Calamity().stealthStrike ? 9f : 12f; + float speedMult = Projectile.Calamity().stealthStrike ? 9f : 12f; const float homingRange = 300f; - if (!projectile.Calamity().stealthStrike) //normal attack + if (!Projectile.Calamity().stealthStrike) //normal attack { - projectile.ai[0]++; - if (projectile.ai[0] > 30f) //0.5 seconds + Projectile.ai[0]++; + if (Projectile.ai[0] > 30f) //0.5 seconds { - NPC target = projectile.Center.ClosestNPCAt(homingRange); + NPC target = Projectile.Center.ClosestNPCAt(homingRange); // Ignore targets above the nuke if (target != null) { - if (target.Bottom.Y < projectile.Top.Y) + if (target.Bottom.Y < Projectile.Top.Y) { target = null; } } if (target != null) { - Vector2 distNorm = (target.Center - projectile.Center).SafeNormalize(Vector2.UnitX); - projectile.velocity = (projectile.velocity * (turnSpeed - 1f) + distNorm * speedMult) / turnSpeed; + Vector2 distNorm = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + Projectile.velocity = (Projectile.velocity * (turnSpeed - 1f) + distNorm * speedMult) / turnSpeed; } } } else { //More range - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, homingRange, speedMult, turnSpeed); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, homingRange, speedMult, turnSpeed); } } public override void Kill(int timeLeft) { - projectile.extraUpdates = 0; + Projectile.extraUpdates = 0; //Dust for (int i = 0; i < 30;i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); - Dust.NewDust(projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid, dspeed.X, dspeed.Y, 0, default, 1.1f); + Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid, dspeed.X, dspeed.Y, 0, default, 1.1f); } - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); int cloudAmt = Main.rand.Next(2, 5); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int c = 0; c < cloudAmt; c++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 10f, 50f, 0.01f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), projectile.knockBack * 0.4f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack * 0.4f, Projectile.owner); } - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - int explode = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), projectile.knockBack * 0.4f, projectile.owner, 1f); + int explode = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack * 0.4f, Projectile.owner, 1f); Main.projectile[explode].usesLocalNPCImmunity = true; Main.projectile[explode].localNPCHitCooldown = 30; } } - Main.PlaySound(SoundID.Item14, projectile.Bottom); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Bottom); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/SlickCaneProjectile.cs b/Projectiles/Rogue/SlickCaneProjectile.cs index 3103427fbf..d92e3b9ef7 100644 --- a/Projectiles/Rogue/SlickCaneProjectile.cs +++ b/Projectiles/Rogue/SlickCaneProjectile.cs @@ -19,20 +19,20 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 42; - projectile.height = 36; - projectile.Calamity().rogue = true; - projectile.timeLeft = 90; - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - projectile.alpha = 180; + Projectile.width = 42; + Projectile.height = 36; + Projectile.Calamity().rogue = true; + Projectile.timeLeft = 90; + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.hide = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 2; + Projectile.alpha = 180; } public override SpearType SpearAiType => SpearType.GhastlyGlaiveSpear; public override float TravelSpeed => 8f; @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue // Initialization. Using the AI hook would override the base spear's code, and we don't want that. if (!initialized) { - Main.player[projectile.owner].Calamity().ConsumeStealthByAttacking(); + Main.player[Projectile.owner].Calamity().ConsumeStealthByAttacking(); initialized = true; } return true; @@ -50,24 +50,24 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 drawPosition = projectile.position + new Vector2(projectile.width, projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D alternateHookTexture = projectile.spriteDirection == -1 ? ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SlickCaneProjectileAlt") : Main.projectileTexture[projectile.type]; - Vector2 origin = new Vector2(projectile.spriteDirection == 1 ? alternateHookTexture.Width + 8f : -8f, -8f); + Vector2 drawPosition = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D alternateHookTexture = Projectile.spriteDirection == -1 ? ModContent.Request("CalamityMod/Projectiles/Rogue/SlickCaneProjectileAlt") : Main.projectileTexture[Projectile.type]; + Vector2 origin = new Vector2(Projectile.spriteDirection == 1 ? alternateHookTexture.Width + 8f : -8f, -8f); spriteBatch.Draw(alternateHookTexture, drawPosition, null, - lightColor, projectile.rotation, - origin, projectile.scale, SpriteEffects.None, 0f); + lightColor, Projectile.rotation, + origin, Projectile.scale, SpriteEffects.None, 0f); return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - float f2 = projectile.rotation - MathHelper.PiOver4 * - Math.Sign(projectile.velocity.X) + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + float f2 = Projectile.rotation - MathHelper.PiOver4 * + Math.Sign(Projectile.velocity.X) + (Projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; float velocityMagnitude = 0f; float scaleFactor = 35f; if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), - projectile.Center, projectile.Center + f2.ToRotationVector2() * scaleFactor, - (TravelSpeed + 1f) * projectile.scale, ref velocityMagnitude)) + Projectile.Center, Projectile.Center + f2.ToRotationVector2() * scaleFactor, + (TravelSpeed + 1f) * Projectile.scale, ref velocityMagnitude)) { return true; } @@ -75,13 +75,13 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) { float moneyValueToDrop = target.value / Main.rand.NextFloat(15f, 35f); // Maximum of 50 silver, not counting steath strikes moneyValueToDrop = (int)MathHelper.Clamp(moneyValueToDrop, 0, 5000f); - if (projectile.Calamity().stealthStrike && Main.rand.NextBool(15)) + if (Projectile.Calamity().stealthStrike && Main.rand.NextBool(15)) { moneyValueToDrop += Item.buyPrice(0, Main.rand.Next(1, 4), Main.rand.Next(0, 100), Main.rand.Next(0, 100)); } diff --git a/Projectiles/Rogue/SludgeSplotchProj1.cs b/Projectiles/Rogue/SludgeSplotchProj1.cs index 0c5507a798..eea013e467 100644 --- a/Projectiles/Rogue/SludgeSplotchProj1.cs +++ b/Projectiles/Rogue/SludgeSplotchProj1.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,28 +16,28 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.velocity.Y += 0.1f; - if (projectile.velocity.Y >= 16f) + Projectile.velocity.Y += 0.1f; + if (Projectile.velocity.Y >= 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); int numDust = 2; for (int i = 0; i < numDust; i++) { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 191, 0f, 0f, 225, new Color(255, 255, 255), 3); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 191, 0f, 0f, 225, new Color(255, 255, 255), 3); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = Main.dust[dust].velocity * 0.25f; @@ -45,64 +46,64 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - projectile.ai[0] = 0; - projectile.ai[1] = 0; + Projectile.ai[0] = 0; + Projectile.ai[1] = 0; - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { if (oldVelocity.X < 0) { - projectile.ai[0] = 1; + Projectile.ai[0] = 1; } if (oldVelocity.X > 0) { - projectile.ai[0] = -1; + Projectile.ai[0] = -1; } } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { if (oldVelocity.Y < 0) { - projectile.ai[1] = 1; + Projectile.ai[1] = 1; } if (oldVelocity.Y > 0) { - projectile.ai[1] = -1; + Projectile.ai[1] = -1; } } } - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 9, 2, 0); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 9, 2, 0); + Projectile.Kill(); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Slow, 120); - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 9, 2, 0); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 9, 2, 0); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Slow, 120); - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 9, 2, 0); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 9, 2, 0); } public override void Kill(int timeLeft) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { int sparkCount = Main.rand.Next(3, 6); for (int i = 0; i < sparkCount; i++) @@ -113,7 +114,7 @@ namespace CalamityMod.Projectiles.Rogue sparkVelocity.Normalize(); sparkVelocity *= 7; - Projectile.NewProjectile(projectile.Center, sparkVelocity, ModContent.ProjectileType(), 7, 0, projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.Center, sparkVelocity, ModContent.ProjectileType(), 7, 0, Projectile.owner, 0, 0); } } @@ -122,9 +123,9 @@ namespace CalamityMod.Projectiles.Rogue float spread = 3f; for (int i = 0; i < numDust; i++) { - Vector2 velocity = projectile.velocity + new Vector2(Main.rand.NextFloat(-spread, spread), Main.rand.NextFloat(-spread, spread)); + Vector2 velocity = Projectile.velocity + new Vector2(Main.rand.NextFloat(-spread, spread), Main.rand.NextFloat(-spread, spread)); - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, velocity.X, velocity.Y, 175, default, 3f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, velocity.X, velocity.Y, 175, default, 3f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Rogue/SludgeSplotchProj2.cs b/Projectiles/Rogue/SludgeSplotchProj2.cs index 4a833a2ca4..1ce101eba1 100644 --- a/Projectiles/Rogue/SludgeSplotchProj2.cs +++ b/Projectiles/Rogue/SludgeSplotchProj2.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,27 +16,27 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 150; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 150; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.velocity.Y += 0.1f; - if (projectile.velocity.Y >= 16f) + Projectile.velocity.Y += 0.1f; + if (Projectile.velocity.Y >= 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 191, 0f, 0f, 225, new Color(255, 255, 255), 2); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 191, 0f, 0f, 225, new Color(255, 255, 255), 2); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = Main.dust[dust].velocity * 0.25f; @@ -43,17 +44,17 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 28, 0.3f, 0); - projectile.Kill(); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.position.X, (int)Projectile.position.Y, 28, 0.3f, 0); + Projectile.Kill(); return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -74,9 +75,9 @@ namespace CalamityMod.Projectiles.Rogue float spread = 2f; for (int i = 0; i < numDust; i++) { - Vector2 velocity = projectile.velocity + new Vector2(Main.rand.NextFloat(-spread, spread), Main.rand.NextFloat(-spread, spread)); + Vector2 velocity = Projectile.velocity + new Vector2(Main.rand.NextFloat(-spread, spread), Main.rand.NextFloat(-spread, spread)); - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, velocity.X, velocity.Y, 175, default, 2f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, velocity.X, velocity.Y, 175, default, 2f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Rogue/SnapClamProj.cs b/Projectiles/Rogue/SnapClamProj.cs index c1b629a4c9..f215f88bc3 100644 --- a/Projectiles/Rogue/SnapClamProj.cs +++ b/Projectiles/Rogue/SnapClamProj.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SnapClamProj : ModProjectile @@ -14,17 +15,17 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Snap Clam"); - Main.projFrames[projectile.type] = 2; + Main.projFrames[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 13; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; + Projectile.width = 20; + Projectile.height = 13; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; } public override void AI() @@ -35,25 +36,25 @@ namespace CalamityMod.Projectiles.Rogue if (clamCounter >= 30) { openClam = false; - projectile.damage = (int)(projectile.damage * 0.8); + Projectile.damage = (int)(Projectile.damage * 0.8); } } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.velocity.X = projectile.velocity.X * 0.99f; - projectile.velocity.Y = projectile.velocity.Y + 0.15f; - projectile.rotation += 0.4f * (float)projectile.direction; - projectile.spriteDirection = projectile.direction; + Projectile.velocity.X = Projectile.velocity.X * 0.99f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.15f; + Projectile.rotation += 0.4f * (float)Projectile.direction; + Projectile.spriteDirection = Projectile.direction; } //Sticky Behaviour - projectile.StickyProjAI(15); + Projectile.StickyProjAI(15); if (openClam && !onEnemy) { - projectile.frame = 1; + Projectile.frame = 1; } else { - projectile.frame = 0; + Projectile.frame = 0; } } @@ -62,7 +63,7 @@ namespace CalamityMod.Projectiles.Rogue if (openClam) { onEnemy = true; - projectile.ModifyHitNPCSticky(2, false); + Projectile.ModifyHitNPCSticky(2, false); } } @@ -77,16 +78,16 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 13; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 13; + Projectile.height = 20; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 0, new Color(115, 124, 124), 1f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(115, 124, 124), 1f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 2f; } diff --git a/Projectiles/Rogue/SnapClamStealth.cs b/Projectiles/Rogue/SnapClamStealth.cs index 130d518944..41910bfe92 100644 --- a/Projectiles/Rogue/SnapClamStealth.cs +++ b/Projectiles/Rogue/SnapClamStealth.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SnapClamStealth : ModProjectile @@ -16,19 +17,19 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Snap Clam"); - Main.projFrames[projectile.type] = 2; + Main.projFrames[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 13; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.localNPCHitCooldown = 10; - projectile.usesLocalNPCImmunity = true; + Projectile.width = 20; + Projectile.height = 13; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; } public override void AI() @@ -39,25 +40,25 @@ namespace CalamityMod.Projectiles.Rogue if (clamCounter >= 30) { openClam = false; - projectile.damage = (int)(projectile.damage * 0.8); + Projectile.damage = (int)(Projectile.damage * 0.8); } } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.velocity.X = projectile.velocity.X * 0.99f; - projectile.velocity.Y = projectile.velocity.Y + 0.15f; - projectile.rotation += 0.4f * (float)projectile.direction; - projectile.spriteDirection = projectile.direction; + Projectile.velocity.X = Projectile.velocity.X * 0.99f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.15f; + Projectile.rotation += 0.4f * (float)Projectile.direction; + Projectile.spriteDirection = Projectile.direction; } //Sticky Behaviour - projectile.StickyProjAI(15); + Projectile.StickyProjAI(15); if (openClam && !onEnemy) { - projectile.frame = 1; + Projectile.frame = 1; } else { - projectile.frame = 0; + Projectile.frame = 0; } } @@ -66,7 +67,7 @@ namespace CalamityMod.Projectiles.Rogue if (openClam) { onEnemy = true; - projectile.ModifyHitNPCSticky(5, false); + Projectile.ModifyHitNPCSticky(5, false); } } @@ -81,16 +82,16 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 13; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 13; + Projectile.height = 20; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 0, new Color(115, 124, 124), 1f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(115, 124, 124), 1f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 2f; } diff --git a/Projectiles/Rogue/SpearofDestinyProjectile.cs b/Projectiles/Rogue/SpearofDestinyProjectile.cs index fd41f568b1..63929b2e63 100644 --- a/Projectiles/Rogue/SpearofDestinyProjectile.cs +++ b/Projectiles/Rogue/SpearofDestinyProjectile.cs @@ -15,54 +15,54 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.aiStyle = 113; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.aiStyle = 113; + Projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { if (!initialized) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - projectile.penetrate++; - projectile.tileCollide = false; + Projectile.penetrate++; + Projectile.tileCollide = false; } initialized = true; } if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 246, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; float maxDistance = 300f; bool homeIn = false; for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].CanBeChasedBy(projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - bool canHit = projectile.Calamity().stealthStrike || Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); + bool canHit = Projectile.Calamity().stealthStrike || Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance) && canHit) { center = Main.npc[i].Center; homeIn = true; @@ -73,15 +73,15 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { - projectile.extraUpdates = 2; - Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * 20f + moveDirection * 12f) / (21f); + Projectile.extraUpdates = 2; + Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 12f) / (21f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 10; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 246, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } @@ -105,10 +105,10 @@ namespace CalamityMod.Projectiles.Rogue public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - Texture2D tex = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SpearofDestinyGlow"); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, tex.Size() / 2, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = ModContent.Request("CalamityMod/Projectiles/Rogue/SpearofDestinyGlow"); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0f); } } } diff --git a/Projectiles/Rogue/SpearofPaleolithProj.cs b/Projectiles/Rogue/SpearofPaleolithProj.cs index 727ffcd88b..434d78fa76 100644 --- a/Projectiles/Rogue/SpearofPaleolithProj.cs +++ b/Projectiles/Rogue/SpearofPaleolithProj.cs @@ -16,49 +16,49 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 113; + Projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.Calamity().stealthStrike && !stealthInit) + if (Projectile.Calamity().stealthStrike && !stealthInit) { - projectile.velocity *= 0.5f; - projectile.timeLeft = 1800; + Projectile.velocity *= 0.5f; + Projectile.timeLeft = 1800; stealthInit = true; } if (Main.rand.NextBool(4)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - if (projectile.timeLeft % 3 == 0) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + if (Projectile.timeLeft % 3 == 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 10; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Rogue/SpentFuelContainerProjectile.cs b/Projectiles/Rogue/SpentFuelContainerProjectile.cs index f95b7d6ed0..d3385b6f9e 100644 --- a/Projectiles/Rogue/SpentFuelContainerProjectile.cs +++ b/Projectiles/Rogue/SpentFuelContainerProjectile.cs @@ -3,7 +3,8 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -18,26 +19,26 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 22; - projectile.height = 34; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 200; - projectile.tileCollide = true; - projectile.alpha = 0; - projectile.Calamity().rogue = true; + Projectile.width = 22; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 200; + Projectile.tileCollide = true; + Projectile.alpha = 0; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.ai[0] += 1f; //arbitrary timer - if (projectile.ai[0] > 75f) + Projectile.ai[0] += 1f; //arbitrary timer + if (Projectile.ai[0] > 75f) { - if (projectile.velocity.Y < 10f) + if (Projectile.velocity.Y < 10f) { - projectile.velocity.Y += 0.15f; + Projectile.velocity.Y += 0.15f; } } - projectile.rotation += MathHelper.ToRadians(projectile.velocity.Length()); + Projectile.rotation += MathHelper.ToRadians(Projectile.velocity.Length()); } public override void Kill(int timeLeft) { @@ -45,16 +46,16 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 30; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); - Dust.NewDust(projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid, dspeed.X, dspeed.Y, 0, default, 1.1f); + Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid, dspeed.X, dspeed.Y, 0, default, 1.1f); } - Main.PlaySound(SoundID.Item107, projectile.Bottom); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Bottom); Point result; - if (WorldUtils.Find(projectile.Top.ToTileCoordinates(), Searches.Chain((GenSearch)new Searches.Down(80), (GenCondition)new Conditions.IsSolid()), out result)) + if (WorldUtils.Find(Projectile.Top.ToTileCoordinates(), Searches.Chain((GenSearch)new Searches.Down(80), (GenCondition)new Conditions.IsSolid()), out result)) { - int proj = Projectile.NewProjectile(result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner); + int proj = Projectile.NewProjectile(result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + Main.projectile[proj].Calamity().stealthStrike = Projectile.Calamity().stealthStrike; } } } diff --git a/Projectiles/Rogue/SphereBladed.cs b/Projectiles/Rogue/SphereBladed.cs index 81eb07df18..3cf0ba06bd 100644 --- a/Projectiles/Rogue/SphereBladed.cs +++ b/Projectiles/Rogue/SphereBladed.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SphereBladed : ModProjectile @@ -11,116 +12,116 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Bladed Sphere"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.tileCollide = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; - projectile.timeLeft = 300; - projectile.tileCollide = false; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; } public override void AI() { - Lighting.AddLight(projectile.Center, 1f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 1f, 0f, 0f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100); } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 25f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 25f) { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } } else { float num42 = 16f; float num43 = 3.2f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + Vector2 vector2 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float num44 = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector2.Y; float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); if (num46 > 3000f) { - projectile.Kill(); + Projectile.Kill(); } num46 = num42 / num46; num44 *= num46; num45 *= num46; - if (projectile.velocity.X < num44) + if (Projectile.velocity.X < num44) { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) + Projectile.velocity.X = Projectile.velocity.X + num43; + if (Projectile.velocity.X < 0f && num44 > 0f) { - projectile.velocity.X = projectile.velocity.X + num43; + Projectile.velocity.X = Projectile.velocity.X + num43; } } - else if (projectile.velocity.X > num44) + else if (Projectile.velocity.X > num44) { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) + Projectile.velocity.X = Projectile.velocity.X - num43; + if (Projectile.velocity.X > 0f && num44 < 0f) { - projectile.velocity.X = projectile.velocity.X - num43; + Projectile.velocity.X = Projectile.velocity.X - num43; } } - if (projectile.velocity.Y < num45) + if (Projectile.velocity.Y < num45) { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num43; + if (Projectile.velocity.Y < 0f && num45 > 0f) { - projectile.velocity.Y = projectile.velocity.Y + num43; + Projectile.velocity.Y = Projectile.velocity.Y + num43; } } - else if (projectile.velocity.Y > num45) + else if (Projectile.velocity.Y > num45) { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num43; + if (Projectile.velocity.Y > 0f && num45 < 0f) { - projectile.velocity.Y = projectile.velocity.Y - num43; + Projectile.velocity.Y = Projectile.velocity.Y - num43; } } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + Rectangle rectangle = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[Projectile.owner].position.X, (int)Main.player[Projectile.owner].position.Y, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height); if (rectangle.Intersects(value2)) { - projectile.Kill(); + Projectile.Kill(); } } } - projectile.rotation += 0.5f; + Projectile.rotation += 0.5f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(SoundID.NPCHit34, projectile.position); + SoundEngine.PlaySound(SoundID.NPCHit34, Projectile.position); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SphereBlue.cs b/Projectiles/Rogue/SphereBlue.cs index ad819d5181..7ccd8a3570 100644 --- a/Projectiles/Rogue/SphereBlue.cs +++ b/Projectiles/Rogue/SphereBlue.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SphereBlue : ModProjectile @@ -10,53 +11,53 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Blue Thruster Sphere"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 1; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0f, 1f); + Lighting.AddLight(Projectile.Center, 0f, 0f, 1f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100); } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 5f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - projectile.rotation += projectile.velocity.X * 0.02f; - projectile.velocity.Y = projectile.velocity.Y + 0.085f; - projectile.velocity.X = projectile.velocity.X * 0.99f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); + Projectile.rotation += Projectile.velocity.X * 0.02f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.085f; + Projectile.velocity.X = Projectile.velocity.X * 0.99f; + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 192; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.NPCDeath37, projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 192; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.NPCDeath37, Projectile.position); for (int num625 = 0; num625 < 3; num625++) { float scaleFactor10 = 0.33f; @@ -68,9 +69,9 @@ namespace CalamityMod.Projectiles.Rogue { scaleFactor10 = 1f; } - int defectiveBruh = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(660, 662), 1f); + int defectiveBruh = Gore.NewGore(new Vector2(Projectile.position.X + (float)(Projectile.width / 2) - 24f, Projectile.position.Y + (float)(Projectile.height / 2) - 24f), default, Main.rand.Next(660, 662), 1f); Main.gore[defectiveBruh].velocity *= scaleFactor10; - Main.gore[defectiveBruh].velocity += projectile.velocity; + Main.gore[defectiveBruh].velocity += Projectile.velocity; } for (int num194 = 0; num194 < 25; num194++) { @@ -79,7 +80,7 @@ namespace CalamityMod.Projectiles.Rogue 226, 229 }); - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 0f; } @@ -87,7 +88,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SphereSpiked.cs b/Projectiles/Rogue/SphereSpiked.cs index 2d535ab9ce..7b7db66aad 100644 --- a/Projectiles/Rogue/SphereSpiked.cs +++ b/Projectiles/Rogue/SphereSpiked.cs @@ -3,6 +3,7 @@ using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SphereSpiked : ModProjectile @@ -12,33 +13,33 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Spiked Sphere"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.ignoreWater = true; - projectile.aiStyle = 3; - projectile.timeLeft = 300; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.ignoreWater = true; + Projectile.aiStyle = 3; + Projectile.timeLeft = 300; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 1f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 1f, 0f, 0f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100); } - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.extraUpdates = 1; + Projectile.extraUpdates = 1; } } @@ -50,12 +51,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(SoundID.NPCHit34, projectile.position); + SoundEngine.PlaySound(SoundID.NPCHit34, Projectile.position); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SphereYellow.cs b/Projectiles/Rogue/SphereYellow.cs index dde9d8b65b..90e5666d09 100644 --- a/Projectiles/Rogue/SphereYellow.cs +++ b/Projectiles/Rogue/SphereYellow.cs @@ -3,6 +3,7 @@ using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class SphereYellow : ModProjectile @@ -10,57 +11,57 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Yellow Thruster Sphere"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 300; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 3; + Projectile.timeLeft = 300; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 1f, 1f, 0f); + Lighting.AddLight(Projectile.Center, 1f, 1f, 0f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 229, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100); } - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.extraUpdates = 1; + Projectile.extraUpdates = 1; } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(SoundID.NPCHit34, projectile.position); + SoundEngine.PlaySound(SoundID.NPCHit34, Projectile.position); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/StealthNimbus.cs b/Projectiles/Rogue/StealthNimbus.cs index b449c4f5a2..55df628ac1 100644 --- a/Projectiles/Rogue/StealthNimbus.cs +++ b/Projectiles/Rogue/StealthNimbus.cs @@ -11,79 +11,79 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Nimbus"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 54; - projectile.height = 24; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.Calamity().rogue = true; + Projectile.width = 54; + Projectile.height = 24; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - if (projectile.ai[0] == 1f) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/StealthNimbus2"); - int height = texture.Height / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + if (Projectile.ai[0] == 1f) + texture = ModContent.Request("CalamityMod/Projectiles/Rogue/StealthNimbus2"); + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), Projectile.scale, spriteEffects, 0f); return false; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 5) + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame > 5) { - projectile.frame = 0; + Projectile.frame = 0; } } - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 3600f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 3600f) { - projectile.alpha += 5; - if (projectile.alpha > 255) + Projectile.alpha += 5; + if (Projectile.alpha > 255) { - projectile.alpha = 255; - projectile.Kill(); + Projectile.alpha = 255; + Projectile.Kill(); } } else { - if (projectile.timeLeft % 8 == 0) + if (Projectile.timeLeft % 8 == 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); - int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, projectile.ai[0], 0f); + int num414 = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); + int num415 = (int)(Projectile.position.Y + (float)Projectile.height + 4f); + Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, Projectile.ai[0], 0f); } } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 10f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 10f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; int projCount = 0; int oldestCloud = 0; float cloudAge = 0f; - int projType = projectile.type; + int projType = Projectile.type; for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { Projectile proj = Main.projectile[projIndex]; - if (proj.active && proj.owner == projectile.owner && proj.type == projType && proj.ai[1] < 3600f) + if (proj.active && proj.owner == Projectile.owner && proj.type == projType && proj.ai[1] < 3600f) { projCount++; if (proj.ai[1] > cloudAge) diff --git a/Projectiles/Rogue/StealthNimbusCloud.cs b/Projectiles/Rogue/StealthNimbusCloud.cs index 7ef01ba50c..beadd59bf5 100644 --- a/Projectiles/Rogue/StealthNimbusCloud.cs +++ b/Projectiles/Rogue/StealthNimbusCloud.cs @@ -11,44 +11,44 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Nimbus"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.netImportant = true; - projectile.penetrate = -1; - projectile.timeLeft = 25; - projectile.Calamity().rogue = true; + Projectile.width = 28; + Projectile.height = 28; + Projectile.netImportant = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 25; + Projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - if (projectile.ai[0] == 1f) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/StealthNimbusCloud2"); - int height = texture.Height / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + if (Projectile.ai[0] == 1f) + texture = ModContent.Request("CalamityMod/Projectiles/Rogue/StealthNimbusCloud2"); + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), Projectile.scale, spriteEffects, 0f); return false; } public override void AI() { - projectile.rotation += projectile.velocity.X * 0.02f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.rotation += Projectile.velocity.X * 0.02f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 3) + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; return; } } @@ -56,9 +56,9 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, projectile.ai[0], 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f); } } diff --git a/Projectiles/Rogue/StealthRain.cs b/Projectiles/Rogue/StealthRain.cs index 5a2d27617c..d39dbf9cad 100644 --- a/Projectiles/Rogue/StealthRain.cs +++ b/Projectiles/Rogue/StealthRain.cs @@ -17,30 +17,30 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 4; - projectile.height = 40; - projectile.friendly = true; - projectile.extraUpdates = 1; - projectile.penetrate = 3; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 15; + Projectile.width = 4; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.extraUpdates = 1; + Projectile.penetrate = 3; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 15; } public override void AI() { - projectile.alpha = 50; + Projectile.alpha = 50; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { //Changes the texture of the projectile - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/StealthRain2"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Rogue/StealthRain2"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } return true; @@ -48,20 +48,20 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - int dustType = projectile.ai[0] == 0f ? 14 : 114; + int dustType = Projectile.ai[0] == 0f ? 14 : 114; - int num310 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + (float)projectile.height - 2f), 2, 2, dustType, 0f, 0f, 0, default, 1f); + int num310 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + (float)Projectile.height - 2f), 2, 2, dustType, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num310]; dust.position.X -= 2f; dust.alpha = 38; dust.velocity *= 0.1f; - dust.velocity += -projectile.oldVelocity * 0.25f; + dust.velocity += -Projectile.oldVelocity * 0.25f; dust.scale = 0.95f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - int buffType = projectile.ai[0] == 0f ? BuffID.CursedInferno : ModContent.BuffType(); + int buffType = Projectile.ai[0] == 0f ? BuffID.CursedInferno : ModContent.BuffType(); target.AddBuff(buffType, 90); } } diff --git a/Projectiles/Rogue/StellarKnifeProj.cs b/Projectiles/Rogue/StellarKnifeProj.cs index 59356e616b..bffbc6df03 100644 --- a/Projectiles/Rogue/StellarKnifeProj.cs +++ b/Projectiles/Rogue/StellarKnifeProj.cs @@ -16,67 +16,67 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Stellar Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 34; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.tileCollide = true; - projectile.Calamity().rogue = true; + Projectile.width = 32; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.tileCollide = true; + Projectile.Calamity().rogue = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { //synthesized timeLeft - projectile.localAI[1]++; - if (projectile.localAI[1] > 600f) - projectile.Kill(); + Projectile.localAI[1]++; + if (Projectile.localAI[1] > 600f) + Projectile.Kill(); - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.ai[0] = 0f; - projectile.damage = (int)(projectile.damage * (projectile.ai[1] == 1f ? 0.9f : 0.75f)); - projectile.ai[1] = 0f; + Projectile.ai[0] = 0f; + Projectile.damage = (int)(Projectile.damage * (Projectile.ai[1] == 1f ? 0.9f : 0.75f)); + Projectile.ai[1] = 0f; } - projectile.ai[1] += 0.75f; - if (projectile.ai[1] <= 60f) + Projectile.ai[1] += 0.75f; + if (Projectile.ai[1] <= 60f) { - projectile.rotation -= 1f; - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; + Projectile.rotation -= 1f; + Projectile.velocity.X *= 0.985f; + Projectile.velocity.Y *= 0.985f; } else { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; float maxDistance = 600f; bool homeIn = false; for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + if (Main.npc[i].CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) { float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance)) + if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance)) { center = Main.npc[i].Center; homeIn = true; @@ -87,18 +87,18 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { - projectile.timeLeft = 600; //when homing in, the projectile cannot run out of timeLeft, but synthesized timeLeft still runs + Projectile.timeLeft = 600; //when homing in, the projectile cannot run out of timeLeft, but synthesized timeLeft still runs - Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * 10f + moveDirection * 30f) / (10f + 1f); + Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 10f + moveDirection * 30f) / (10f + 1f); } else { //shorten knife lifespan if it hasn't found a target - if (projectile.timeLeft > 60) - projectile.timeLeft = 60; - projectile.velocity.X *= 0.92f; - projectile.velocity.Y *= 0.92f; + if (Projectile.timeLeft > 60) + Projectile.timeLeft = 60; + Projectile.velocity.X *= 0.92f; + Projectile.velocity.Y *= 0.92f; } } } @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/StickyBol.cs b/Projectiles/Rogue/StickyBol.cs index 4a8f2a86b5..b43d81b74d 100644 --- a/Projectiles/Rogue/StickyBol.cs +++ b/Projectiles/Rogue/StickyBol.cs @@ -17,15 +17,15 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.timeLeft = 300; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 60; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 5; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; } public override void AI() @@ -33,35 +33,35 @@ namespace CalamityMod.Projectiles.Rogue Color color = new Color(0, 80, 255, 100); if (Main.rand.NextBool(12)) { - Dust.NewDust(projectile.position + Vector2.One * 6f, projectile.width - 12, projectile.height - 12, 4, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 175, color, 1.2f); + Dust.NewDust(Projectile.position + Vector2.One * 6f, Projectile.width - 12, Projectile.height - 12, 4, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 175, color, 1.2f); } //Sticky Behaviour - projectile.StickyProjAI(10); - if (projectile.ai[0] != 1f) + Projectile.StickyProjAI(10); + if (Projectile.ai[0] != 1f) { - projectile.StickToTiles(true, false); - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 10f) + Projectile.StickToTiles(true, false); + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 10f) { - projectile.localAI[1] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.localAI[1] = 10f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X *= 0.97f; - if (Math.Abs(projectile.velocity.X) < 0.01f) + Projectile.velocity.X *= 0.97f; + if (Math.Abs(Projectile.velocity.X) < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.ModifyHitNPCSticky(5, true); + Projectile.ModifyHitNPCSticky(5, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Rogue/StormfrontRazorProjectile.cs b/Projectiles/Rogue/StormfrontRazorProjectile.cs index 68fc49e27d..eae868b980 100644 --- a/Projectiles/Rogue/StormfrontRazorProjectile.cs +++ b/Projectiles/Rogue/StormfrontRazorProjectile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -13,71 +14,71 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Stormfront Knife"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 5; - projectile.timeLeft = 300; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 5; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter >= 6) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } drawOriginOffsetX = 50; drawOriginOffsetY = 20; - projectile.ai[0]++; - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - projectile.rotation += projectile.spriteDirection * MathHelper.ToRadians(45f); - if (projectile.ai[1] == 0) + Projectile.ai[0]++; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.rotation += Projectile.spriteDirection * MathHelper.ToRadians(45f); + if (Projectile.ai[1] == 0) { - projectile.ai[1] = 1; + Projectile.ai[1] = 1; } - float sparkFreq = 125f / projectile.ai[1]; - if (projectile.ai[0] >= sparkFreq) + float sparkFreq = 125f / Projectile.ai[1]; + if (Projectile.ai[0] >= sparkFreq) { Vector2 sparkS = new Vector2(Main.rand.NextFloat(-14f, 14f), Main.rand.NextFloat(-14f, 14f)); - Projectile.NewProjectile(projectile.Center, sparkS, ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner); - projectile.ai[0] = 0; + Projectile.NewProjectile(Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner); + Projectile.ai[0] = 0; } if (Main.rand.NextBool(10)) { - int d = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); Main.dust[d].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[d].noGravity = true; - Main.dust[d].position = projectile.Center; + Main.dust[d].position = Projectile.Center; } } public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); return true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/Stormfrontspark.cs b/Projectiles/Rogue/Stormfrontspark.cs index 3a345d2a88..4179646aaf 100644 --- a/Projectiles/Rogue/Stormfrontspark.cs +++ b/Projectiles/Rogue/Stormfrontspark.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.width = 6; - projectile.height = 12; - projectile.timeLeft = 240; - projectile.penetrate = -1; - projectile.Calamity().rogue = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.width = 6; + Projectile.height = 12; + Projectile.timeLeft = 240; + Projectile.penetrate = -1; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + Projectile.rotation += Projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); Dust dust = Main.dust[num199]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue dust.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); Dust dust2 = Main.dust[num200]; dust2.position.X -= 2f; dust2.position.Y += 2f; @@ -43,15 +43,15 @@ namespace CalamityMod.Projectiles.Rogue dust2.noGravity = true; dust2.velocity *= 0.1f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + Projectile.velocity.X = Projectile.velocity.X * 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; - projectile.velocity.Y += 0.15f; - if (projectile.velocity.Y > 16f) + Projectile.rotation = -Projectile.velocity.X * 0.05f; + Projectile.velocity.Y += 0.15f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } diff --git a/Projectiles/Rogue/SubductionFlameburst.cs b/Projectiles/Rogue/SubductionFlameburst.cs index ac094f54f2..0bc5aecacd 100644 --- a/Projectiles/Rogue/SubductionFlameburst.cs +++ b/Projectiles/Rogue/SubductionFlameburst.cs @@ -17,23 +17,23 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 81; - projectile.height = 322; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 180; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 81; + Projectile.height = 322; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { //2-6 - projectile.frameCounter += 1; - if (projectile.frameCounter % 7 == 6) + Projectile.frameCounter += 1; + if (Projectile.frameCounter % 7 == 6) { frameY += 1; if (frameY >= 4) @@ -43,21 +43,21 @@ namespace CalamityMod.Projectiles.Rogue } if (frameX >= 3) { - projectile.Kill(); + Projectile.Kill(); } } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.position.Y -= projectile.height / 2; //position adjustments - projectile.localAI[0] = 1f; + Projectile.position.Y -= Projectile.height / 2; //position adjustments + Projectile.localAI[0] = 1f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - Rectangle frame = new Rectangle(frameX * projectile.width, frameY * projectile.height, projectile.width, projectile.height); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + Rectangle frame = new Rectangle(frameX * Projectile.width, frameY * Projectile.height, Projectile.width, Projectile.height); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Rogue/SulphuricNukesplosion.cs b/Projectiles/Rogue/SulphuricNukesplosion.cs index a8b36a7bb8..4273892984 100644 --- a/Projectiles/Rogue/SulphuricNukesplosion.cs +++ b/Projectiles/Rogue/SulphuricNukesplosion.cs @@ -26,16 +26,16 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 140; - projectile.height = 290; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.Calamity().rogue = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 11; + Projectile.width = 140; + Projectile.height = 290; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.Calamity().rogue = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 11; } public override bool PreAI() @@ -44,20 +44,20 @@ namespace CalamityMod.Projectiles.Rogue { if (boomerTime == 0) { - projectile.timeLeft = boomerTime == 0 ? 99 : projectile.timeLeft; - projectile.position = projectile.Center; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.idStaticNPCHitCooldown = 9; + Projectile.timeLeft = boomerTime == 0 ? 99 : Projectile.timeLeft; + Projectile.position = Projectile.Center; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.idStaticNPCHitCooldown = 9; boomerTime = 1; } - if (projectile.timeLeft <= 15) + if (Projectile.timeLeft <= 15) dustloop--; - projectile.Damage(); + Projectile.Damage(); } if (stealthyNuke && frameX >= 1) @@ -75,9 +75,9 @@ namespace CalamityMod.Projectiles.Rogue speed = randVelocity / speed; randX *= speed; randY *= speed; - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); - Main.dust[idx].position.X = projectile.Center.X + Main.rand.NextFloat(-10f, 10f); - Main.dust[idx].position.Y = projectile.Center.Y + Main.rand.NextFloat(-10f, 10f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); + Main.dust[idx].position.X = Projectile.Center.X + Main.rand.NextFloat(-10f, 10f); + Main.dust[idx].position.Y = Projectile.Center.Y + Main.rand.NextFloat(-10f, 10f); Main.dust[idx].velocity.X = randX; Main.dust[idx].velocity.Y = randY; Main.dust[idx].scale = scale; @@ -94,14 +94,14 @@ namespace CalamityMod.Projectiles.Rogue { if (boomerTime == -1) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { stealthyNuke = true; } //2-6 - projectile.frameCounter += 1; - if (projectile.frameCounter % 6 == 0) + Projectile.frameCounter += 1; + if (Projectile.frameCounter % 6 == 0) { frameY += 1; if (frameY >= 7) @@ -112,18 +112,18 @@ namespace CalamityMod.Projectiles.Rogue if (frameX >= 2) { if (!stealthyNuke) - projectile.Kill(); + Projectile.Kill(); else { boomerTime = 0; - projectile.hide = true; + Projectile.hide = true; } } } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.position.Y -= projectile.height / 2; //position adjustments - projectile.localAI[0] = 1f; + Projectile.position.Y -= Projectile.height / 2; //position adjustments + Projectile.localAI[0] = 1f; } } } @@ -140,8 +140,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Rectangle frame = new Rectangle(frameX * projectile.width, frameY * projectile.height, projectile.width, projectile.height); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SulphuricNukesplosion"), projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + Rectangle frame = new Rectangle(frameX * Projectile.width, frameY * Projectile.height, Projectile.width, Projectile.height); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Rogue/SulphuricNukesplosion"), Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0f); return false; } @@ -150,7 +150,7 @@ namespace CalamityMod.Projectiles.Rogue if (boomerTime == -1) projHitbox.Intersects(targetHitbox); - return CalamityUtils.CircularHitboxCollision(projectile.Center, 200f, targetHitbox); + return CalamityUtils.CircularHitboxCollision(Projectile.Center, 200f, targetHitbox); } } } diff --git a/Projectiles/Rogue/SupernovaBomb.cs b/Projectiles/Rogue/SupernovaBomb.cs index ada3d30ed5..b5a6e2e5ed 100644 --- a/Projectiles/Rogue/SupernovaBomb.cs +++ b/Projectiles/Rogue/SupernovaBomb.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -14,19 +15,19 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Supernova Bomb"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 200; - projectile.tileCollide = true; - projectile.Calamity().rogue = true; + Projectile.width = 34; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 200; + Projectile.tileCollide = true; + Projectile.Calamity().rogue = true; } public override void AI() @@ -39,62 +40,62 @@ namespace CalamityMod.Projectiles.Rogue } if (Main.rand.NextBool(6)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, num298, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, num298, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); //velocity - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 10f) { - projectile.ai[0] = 10f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 10f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X *= 0.97f; - if (Math.Abs(projectile.velocity.X) < 0.01f) + Projectile.velocity.X *= 0.97f; + if (Math.Abs(Projectile.velocity.X) < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; } //rotation - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; //stealth strike - if (projectile.Calamity().stealthStrike && projectile.timeLeft % 8 == 0 && projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, Vector2.UnitY * 2f, ModContent.ProjectileType(), (int)(projectile.damage * 0.48), projectile.knockBack, projectile.owner, 0f, 0f); + if (Projectile.Calamity().stealthStrike && Projectile.timeLeft % 8 == 0 && Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center, Vector2.UnitY * 2f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.48), Projectile.knockBack, Projectile.owner, 0f, 0f); } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 128; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(SoundID.Item14, projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 128; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); //spawn projectiles int projAmt = Main.rand.Next(3, 5); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); for (int i = 0; i < projAmt; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.6), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), 0f, Projectile.owner, 0f, 0f); } float spread = MathHelper.Pi / 3f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 6f; double offsetAngle; for (int i = 0; i < 3; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); } } @@ -106,7 +107,7 @@ namespace CalamityMod.Projectiles.Rogue } for (int d = 0; d < 5; d++) { - int exo = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + int exo = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[exo].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -116,15 +117,15 @@ namespace CalamityMod.Projectiles.Rogue } for (int d = 0; d < 9; d++) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } //gore cloud effects - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -139,7 +140,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SupernovaBoom.cs b/Projectiles/Rogue/SupernovaBoom.cs index aac5065876..6d59891428 100644 --- a/Projectiles/Rogue/SupernovaBoom.cs +++ b/Projectiles/Rogue/SupernovaBoom.cs @@ -20,22 +20,22 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 408; - projectile.height = 410; - projectile.scale = 2f; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = frameLength * horizontalFrames * verticalFrames / 5; + Projectile.width = 408; + Projectile.height = 410; + Projectile.scale = 2f; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = frameLength * horizontalFrames * verticalFrames / 5; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter % frameLength == frameLength - 1) + Projectile.frameCounter++; + if (Projectile.frameCounter % frameLength == frameLength - 1) { frameY++; if (frameY >= verticalFrames) @@ -45,11 +45,11 @@ namespace CalamityMod.Projectiles.Rogue } if (frameX >= horizontalFrames) { - projectile.Kill(); + Projectile.Kill(); } } - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); /*float dustSpeed = (float)Main.rand.Next(12, 36); Vector2 dustVel = CalamityUtils.RandomVelocity(40f, dustSpeed, dustSpeed, 1f); @@ -68,17 +68,17 @@ namespace CalamityMod.Projectiles.Rogue dust.velocity = dustVel;*/ } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture = Main.projectileTexture[Projectile.type]; int length = texture.Width / horizontalFrames; int height = texture.Height / verticalFrames; - Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Rectangle frame = new Rectangle(frameX * length, frameY * height, length, height); Vector2 origin = new Vector2(length / 2f, height / 2f); - spriteBatch.Draw(texture, drawPos, frame, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, drawPos, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Rogue/SupernovaHoming.cs b/Projectiles/Rogue/SupernovaHoming.cs index 4dd8871b0e..2ce9ff37de 100644 --- a/Projectiles/Rogue/SupernovaHoming.cs +++ b/Projectiles/Rogue/SupernovaHoming.cs @@ -15,12 +15,12 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; } public override void AI() @@ -31,33 +31,33 @@ namespace CalamityMod.Projectiles.Rogue { num298 = 269; } - projectile.ai[0] += 1; - if (projectile.ai[0] % 2 == 0) + Projectile.ai[0] += 1; + if (Projectile.ai[0] % 2 == 0) { - int coolDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, num298, 0f, 0f, 100, default, 1.5f); + int coolDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, num298, 0f, 0f, 100, default, 1.5f); Main.dust[coolDust].noGravity = true; Main.dust[coolDust].velocity *= 0.1f; - Main.dust[coolDust].velocity += projectile.velocity * 0.5f; + Main.dust[coolDust].velocity += Projectile.velocity * 0.5f; } - if (projectile.ai[0] < 90) + if (Projectile.ai[0] < 90) { - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; } else { - projectile.extraUpdates = 1; + Projectile.extraUpdates = 1; - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; float maxDistance = 500f; bool homeIn = false; for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].CanBeChasedBy(projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) { center = Main.npc[i].Center; homeIn = true; @@ -68,33 +68,33 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { - Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * 20f + moveDirection * 12f) / (21f); + Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 12f) / (21f); } else - projectile.Kill(); + Projectile.Kill(); } - projectile.rotation += 0.25f; + Projectile.rotation += 0.25f; } public override bool CanDamage() { - return projectile.ai[0] >= 90; + return Projectile.ai[0] >= 90; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 24; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 24; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 234, vector7.X * 0.5f, vector7.Y * 0.5f, 100, default, 0.75f); Main.dust[num228].noGravity = true; } diff --git a/Projectiles/Rogue/SupernovaSpike.cs b/Projectiles/Rogue/SupernovaSpike.cs index 2044f9a597..d66c990426 100644 --- a/Projectiles/Rogue/SupernovaSpike.cs +++ b/Projectiles/Rogue/SupernovaSpike.cs @@ -18,47 +18,47 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.extraUpdates = 2; - projectile.aiStyle = 93; + Projectile.width = 10; + Projectile.height = 10; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.alpha = 255; + Projectile.extraUpdates = 2; + Projectile.aiStyle = 93; aiType = ProjectileID.NailFriendly; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; } public override void AI() { - projectile.alpha -= 10; - if (projectile.alpha < 0) + Projectile.alpha -= 10; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } int num298 = Main.rand.NextBool(2) ? 107 : 234; if (Main.rand.NextBool(4)) { num298 = 269; } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 4f) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num298, 0f, 0f, 100, default, 0.75f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num298, 0f, 0f, 100, default, 0.75f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } if (currentColor == Color.Black) { int startPoint = Main.rand.Next(6); - projectile.localAI[0] = startPoint; + Projectile.localAI[0] = startPoint; currentColor = GetStartingColor(startPoint); } - Visuals(projectile, ref currentColor); + Visuals(Projectile, ref currentColor); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -99,10 +99,10 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 32; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num298 = Main.rand.NextBool(2) ? 107 : 234; if (Main.rand.NextBool(4)) { @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Rogue } for (int num621 = 0; num621 < 2; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num298, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num298, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -120,10 +120,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 2; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Rogue/SylvanSlash.cs b/Projectiles/Rogue/SylvanSlash.cs index 85c0ed115e..dfa622c98f 100644 --- a/Projectiles/Rogue/SylvanSlash.cs +++ b/Projectiles/Rogue/SylvanSlash.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -11,72 +12,72 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Slash"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.penetrate = 2; - projectile.alpha = 120; - projectile.timeLeft = 200; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.tileCollide = false; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.penetrate = 2; + Projectile.alpha = 120; + Projectile.timeLeft = 200; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.tileCollide = false; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item92, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item92, Projectile.position); + Projectile.localAI[0] += 1f; } - Lighting.AddLight(projectile.Center, 0.1f, 1f, 2f); - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; - projectile.velocity.Y += projectile.ai[0]; + Lighting.AddLight(Projectile.Center, 0.1f, 1f, 2f); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; + Projectile.velocity.Y += Projectile.ai[0]; if (Main.rand.NextBool(2)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 111, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 111, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 195) + if (Projectile.timeLeft > 195) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override void Kill(int timeLeft) { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 111, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 111, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.velocity *= 0.5f; + Projectile.velocity *= 0.5f; } public override void OnHitPvp(Player target, int damage, bool crit) { - projectile.velocity *= 0.5f; + Projectile.velocity *= 0.5f; } } } diff --git a/Projectiles/Rogue/SylvanSlashAttack.cs b/Projectiles/Rogue/SylvanSlashAttack.cs index cdedb3c3d5..bba95e8146 100644 --- a/Projectiles/Rogue/SylvanSlashAttack.cs +++ b/Projectiles/Rogue/SylvanSlashAttack.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.CalPlayer; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -12,50 +13,50 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Sylvan Slash"); - Main.projFrames[projectile.type] = 28; + Main.projFrames[Projectile.type] = 28; } public override void SetDefaults() { - projectile.width = 68; - projectile.height = 68; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 68; + Projectile.height = 68; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } public override void AI() { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float num = 0f; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { num = MathHelper.Pi; } - if (++projectile.frame >= Main.projFrames[projectile.type]) + if (++Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.soundDelay--; - if (projectile.soundDelay <= 0) + Projectile.soundDelay--; + if (Projectile.soundDelay <= 0) { - Main.PlaySound(SoundID.Item15, projectile.Center); - projectile.soundDelay = 24; + SoundEngine.PlaySound(SoundID.Item15, Projectile.Center); + Projectile.soundDelay = 24; } if (player.channel && !player.noItems && !player.CCed) { float scaleFactor6 = 1f; - if (player.ActiveItem().shoot == projectile.type) + if (player.ActiveItem().shoot == Projectile.type) { - scaleFactor6 = player.ActiveItem().shootSpeed * projectile.scale; + scaleFactor6 = player.ActiveItem().shootSpeed * Projectile.scale; } Vector2 vector13 = Main.MouseWorld - vector; vector13.Normalize(); @@ -64,45 +65,45 @@ namespace CalamityMod.Projectiles.Rogue vector13 = Vector2.UnitX * (float)player.direction; } vector13 *= scaleFactor6; - if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y) + if (vector13.X != Projectile.velocity.X || vector13.Y != Projectile.velocity.Y) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity = vector13; + Projectile.velocity = vector13; } else { - projectile.Kill(); + Projectile.Kill(); } - Vector2 vector14 = projectile.Center + projectile.velocity * 3f; + Vector2 vector14 = Projectile.Center + Projectile.velocity * 3f; Lighting.AddLight(vector14, 0.2f, 2f, 3f); if (Main.rand.NextBool(3)) { - int num30 = Dust.NewDust(vector14 - projectile.Size / 2f, projectile.width, projectile.height, 111, projectile.velocity.X, projectile.velocity.Y, 100, default, 2f); + int num30 = Dust.NewDust(vector14 - Projectile.Size / 2f, Projectile.width, Projectile.height, 111, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 2f); Main.dust[num30].noGravity = true; - Main.dust[num30].position -= projectile.velocity; + Main.dust[num30].position -= Projectile.velocity; } - projectile.position = player.RotatedRelativePoint(Main.MouseWorld, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; + Projectile.position = player.RotatedRelativePoint(Main.MouseWorld, true) - Projectile.Size / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + num; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); - if (projectile.ai[0] > 0) - projectile.ai[0]--; + if (Projectile.ai[0] > 0) + Projectile.ai[0]--; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - if (projectile.ai[0] <= 0f) + if (Projectile.ai[0] <= 0f) { if ((target.damage > 5 || target.boss) && !target.SpawnedFromStatue) { @@ -111,7 +112,7 @@ namespace CalamityMod.Projectiles.Rogue if (modPlayer.rogueStealth < modPlayer.rogueStealthMax) { modPlayer.rogueStealth += 0.05f; - projectile.ai[0] = 3f; + Projectile.ai[0] = 3f; if (modPlayer.rogueStealth > modPlayer.rogueStealthMax) modPlayer.rogueStealth = modPlayer.rogueStealthMax; } @@ -121,20 +122,20 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(8)) { float speedMult = Main.rand.NextFloat(3,6); - Vector2 vector1 = new Vector2(projectile.Center.X - player.Center.X, projectile.Center.Y - player.Center.Y); + Vector2 vector1 = new Vector2(Projectile.Center.X - player.Center.X, Projectile.Center.Y - player.Center.Y); vector1.Normalize(); - Projectile.NewProjectile(player.Center.X, player.Center.Y, -vector1.X * speedMult, -vector1.Y * speedMult, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, -vector1.X * speedMult, -vector1.Y * speedMult, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); } } } public override void OnHitPvp(Player target, int damage, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - if (projectile.ai[0] <= 0f) + if (Projectile.ai[0] <= 0f) { if (modPlayer.wearingRogueArmor && modPlayer.rogueStealthMax != 0) { @@ -149,9 +150,9 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(8)) { float speedMult = Main.rand.NextFloat(3,6); - Vector2 vector1 = new Vector2(projectile.Center.X - player.Center.X, projectile.Center.Y - player.Center.Y); + Vector2 vector1 = new Vector2(Projectile.Center.X - player.Center.X, Projectile.Center.Y - player.Center.Y); vector1.Normalize(); - Projectile.NewProjectile(player.Center.X, player.Center.Y, -vector1.X * speedMult, -vector1.Y * speedMult, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, -vector1.X * speedMult, -vector1.Y * speedMult, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Rogue/TalonLargeProj.cs b/Projectiles/Rogue/TalonLargeProj.cs index 4851f42e86..76a94fe13c 100644 --- a/Projectiles/Rogue/TalonLargeProj.cs +++ b/Projectiles/Rogue/TalonLargeProj.cs @@ -11,55 +11,55 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Huge Terror Talon"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 10; - projectile.tileCollide = false; - projectile.timeLeft = 180; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 10; + Projectile.tileCollide = false; + Projectile.timeLeft = 180; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { if (Main.rand.Next(5) == 0) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 85, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } if (Main.rand.Next(10) == 0) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 111, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 111, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - projectile.ai[0]++; - if (projectile.ai[0] > 2f) + Projectile.ai[0]++; + if (Projectile.ai[0] > 2f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } public override void Kill(int timeLeft) { for (int i = 0; i <= 10; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 85, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/TalonSmallProj.cs b/Projectiles/Rogue/TalonSmallProj.cs index 8229349373..58f8a1dcb4 100644 --- a/Projectiles/Rogue/TalonSmallProj.cs +++ b/Projectiles/Rogue/TalonSmallProj.cs @@ -18,14 +18,14 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; SineFrequency = 0.15f; SineAmplitude = 0.06f; @@ -35,56 +35,56 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { // On-spawn effects - if (projectile.ai[0] == 0) + if (Projectile.ai[0] == 0) { // Store the X and Y of the spawn velocity so it can be used for trig calculations - projectile.localAI[0] = projectile.velocity.X; - projectile.localAI[1] = projectile.velocity.Y; + Projectile.localAI[0] = Projectile.velocity.X; + Projectile.localAI[1] = Projectile.velocity.Y; } // Doesn't collide with tiles for the first 2 frames - projectile.tileCollide = projectile.ai[0] > 2f; + Projectile.tileCollide = Projectile.ai[0] > 2f; // Apply fancy sine movement, then slight gravity, then cap velocity. // Original velocity is reconstructed so that it can be used in the calculation - Vector2 originalVelocity = new Vector2(projectile.localAI[0], projectile.localAI[1]); + Vector2 originalVelocity = new Vector2(Projectile.localAI[0], Projectile.localAI[1]); ApplySineVelocity(originalVelocity); // projectile.velocity.Y += 0.08f; - float currentSpeed = projectile.velocity.Length(); + float currentSpeed = Projectile.velocity.Length(); float maxSpeed = 1.4f * originalVelocity.Length(); if (currentSpeed > maxSpeed) - projectile.velocity *= maxSpeed / currentSpeed; + Projectile.velocity *= maxSpeed / currentSpeed; // spawn dust if (Main.rand.Next(5) == 0) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 85, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } // freely spins instead of facing forwards - projectile.rotation += RotationIncrement; - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.ai[0]++; + Projectile.rotation += RotationIncrement; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.ai[0]++; } private void ApplySineVelocity(Vector2 baseVelocity) { - float radians = projectile.ai[1] * (-MathHelper.PiOver2 + SineFrequency * projectile.ai[0]); - projectile.velocity += SineAmplitude * baseVelocity.RotatedBy(radians); + float radians = Projectile.ai[1] * (-MathHelper.PiOver2 + SineFrequency * Projectile.ai[0]); + Projectile.velocity += SineAmplitude * baseVelocity.RotatedBy(radians); } public override void Kill(int timeLeft) { for (int i = 0; i <= 5; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 85, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Rogue/TarraThornRight.cs b/Projectiles/Rogue/TarraThornRight.cs index 375ba43b03..52f070874e 100644 --- a/Projectiles/Rogue/TarraThornRight.cs +++ b/Projectiles/Rogue/TarraThornRight.cs @@ -15,59 +15,59 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; - projectile.aiStyle = 4; + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.aiStyle = 4; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; - if (projectile.ai[0] == 0f) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + if (Projectile.ai[0] == 0f) { - projectile.alpha -= 50; - if (projectile.alpha > 0) + Projectile.alpha -= 50; + if (Projectile.alpha > 0) return; - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) + Projectile.alpha = 0; + Projectile.ai[0] = 1f; + if (Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; + Projectile.ai[1] += 1f; + Projectile.position += Projectile.velocity * 1f; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - int type = projectile.type; - if (projectile.ai[1] >= 10f) + int type = Projectile.type; + if (Projectile.ai[1] >= 10f) type = ModContent.ProjectileType(); - int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, type, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[number].ai[1] = projectile.ai[1] + 1f; + int number = Projectile.NewProjectile(Projectile.position.X + Projectile.velocity.X + (float)(Projectile.width / 2), Projectile.position.Y + Projectile.velocity.Y + (float)(Projectile.height / 2), Projectile.velocity.X, Projectile.velocity.Y, type, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Main.projectile[number].ai[1] = Projectile.ai[1] + 1f; } } else { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170) { for (int index1 = 0; index1 < 8; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 7, projectile.velocity.X * 0.025f, projectile.velocity.Y * 0.025f, 200, new Color(), 1.3f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 7, Projectile.velocity.X * 0.025f, Projectile.velocity.Y * 0.025f, 200, new Color(), 1.3f); Dust dust = Main.dust[index2]; dust.noGravity = true; dust.velocity *= 0.5f; } } - projectile.alpha += 3; - if (projectile.alpha < 255) + Projectile.alpha += 3; + if (Projectile.alpha < 255) return; - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Rogue/TarraThornTip.cs b/Projectiles/Rogue/TarraThornTip.cs index 1f8efc7925..f3e860a944 100644 --- a/Projectiles/Rogue/TarraThornTip.cs +++ b/Projectiles/Rogue/TarraThornTip.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 28; + Projectile.height = 28; + Projectile.aiStyle = 4; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; aiType = ProjectileID.NettleBurstEnd; } } diff --git a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs index c3dd9b8259..a97b62df16 100644 --- a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs +++ b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs @@ -19,33 +19,33 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 6; - projectile.aiStyle = 113; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 6; + Projectile.aiStyle = 113; + Projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.extraUpdates = 1; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -53,29 +53,29 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { float random = Main.rand.Next(30, 90); float spread = random * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; int projID = ModContent.ProjectileType(); - int splitDamage = (int)(projectile.damage * 0.25f); + int splitDamage = (int)(Projectile.damage * 0.25f); float splitKB = 1f; for (int i = 0; i < 4; i++) { double offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f) * 2f, (float)(Math.Cos(offsetAngle) * 5f) * 2f, projID, splitDamage, splitKB, projectile.owner); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f) * 2f, (float)(-Math.Cos(offsetAngle) * 5f) * 2f, projID, splitDamage, splitKB, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f) * 2f, (float)(Math.Cos(offsetAngle) * 5f) * 2f, projID, splitDamage, splitKB, Projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f) * 2f, (float)(-Math.Cos(offsetAngle) * 5f) * 2f, projID, splitDamage, splitKB, Projectile.owner); } } } diff --git a/Projectiles/Rogue/TerraDiskProjectile.cs b/Projectiles/Rogue/TerraDiskProjectile.cs index f93ca3955f..da351b4547 100644 --- a/Projectiles/Rogue/TerraDiskProjectile.cs +++ b/Projectiles/Rogue/TerraDiskProjectile.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -18,20 +19,20 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Terra Disk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = projectile.height = 46; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.penetrate = -1; - projectile.Calamity().rogue = true; + Projectile.width = Projectile.height = 46; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.penetrate = -1; + Projectile.Calamity().rogue = true; } public override void AI() @@ -48,88 +49,88 @@ namespace CalamityMod.Projectiles.Rogue if (initialized) return; - Lifetime = projectile.Calamity().stealthStrike ? 360 : 180; - ReboundTime = projectile.Calamity().stealthStrike ? 90 : 45; - projectile.timeLeft = Lifetime; + Lifetime = Projectile.Calamity().stealthStrike ? 360 : 180; + ReboundTime = Projectile.Calamity().stealthStrike ? 90 : 45; + Projectile.timeLeft = Lifetime; initialized = true; } private void BoomerangAI() { // Boomerang rotation - projectile.rotation += 0.4f * projectile.direction; + Projectile.rotation += 0.4f * Projectile.direction; // Boomerang sound - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } // Returns after some number of frames in the air - if (projectile.timeLeft < Lifetime - ReboundTime) - projectile.ai[0] = 1f; + if (Projectile.timeLeft < Lifetime - ReboundTime) + Projectile.ai[0] = 1f; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { //Ignore tiles and fly faster - projectile.tileCollide = false; - projectile.extraUpdates = 1; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float returnSpeed = 16f; float acceleration = 1.4f; - Vector2 playerVec = player.Center - projectile.Center; + Vector2 playerVec = player.Center - Projectile.Center; float dist = playerVec.Length(); // Delete the projectile if it's excessively far away. if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); playerVec.Normalize(); playerVec *= returnSpeed; // Home back in on the player. - if (projectile.velocity.X < playerVec.X) + if (Projectile.velocity.X < playerVec.X) { - projectile.velocity.X += acceleration; - if (projectile.velocity.X < 0f && playerVec.X > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X += acceleration; + if (Projectile.velocity.X < 0f && playerVec.X > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > playerVec.X) + else if (Projectile.velocity.X > playerVec.X) { - projectile.velocity.X -= acceleration; - if (projectile.velocity.X > 0f && playerVec.X < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X -= acceleration; + if (Projectile.velocity.X > 0f && playerVec.X < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < playerVec.Y) + if (Projectile.velocity.Y < playerVec.Y) { - projectile.velocity.Y += acceleration; - if (projectile.velocity.Y < 0f && playerVec.Y > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y += acceleration; + if (Projectile.velocity.Y < 0f && playerVec.Y > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > playerVec.Y) + else if (Projectile.velocity.Y > playerVec.Y) { - projectile.velocity.Y -= acceleration; - if (projectile.velocity.Y > 0f && playerVec.Y < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y -= acceleration; + if (Projectile.velocity.Y > 0f && playerVec.Y < 0f) + Projectile.velocity.Y -= acceleration; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(player.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(player.Hitbox)) + Projectile.Kill(); } } private void StealthStrikeAI() { - if (!projectile.Calamity().stealthStrike) + if (!Projectile.Calamity().stealthStrike) return; - if (projectile.timeLeft % 8f == 0f && Main.myPlayer == projectile.owner) + if (Projectile.timeLeft % 8f == 0f && Main.myPlayer == Projectile.owner) { - int disk = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack / 4f, projectile.owner, projectile.identity, Main.rand.NextFloat(0.02f, 0.1f)); + int disk = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack / 4f, Projectile.owner, Projectile.identity, Main.rand.NextFloat(0.02f, 0.1f)); Main.projectile[disk].timeLeft *= 2; Main.projectile[disk].idStaticNPCHitCooldown = 8; Main.projectile[disk].usesIDStaticNPCImmunity = true; @@ -139,7 +140,7 @@ namespace CalamityMod.Projectiles.Rogue private void SpawnProjectilesNearEnemies() { - if (!projectile.friendly) + if (!Projectile.friendly) return; const float maxDistance = 300f; @@ -148,15 +149,15 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDistance = npc.width / 2 + npc.height / 2; bool canHit = true; if (extraDistance < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); - if (Vector2.Distance(npc.Center, projectile.Center) < maxDistance + extraDistance && canHit) + if (Vector2.Distance(npc.Center, Projectile.Center) < maxDistance + extraDistance && canHit) { homeIn = true; break; @@ -166,20 +167,20 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { - if (Main.player[projectile.owner].miscCounter % 50 == 0) + if (Main.player[Projectile.owner].miscCounter % 50 == 0) { int splitProj = ModContent.ProjectileType(); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { float spread = 60f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 6f; double offsetAngle; for (int i = 0; i < 3; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), splitProj, projectile.damage / 2, projectile.knockBack / 2f, projectile.owner); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), splitProj, projectile.damage / 2, projectile.knockBack / 2f, projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), splitProj, Projectile.damage / 2, Projectile.knockBack / 2f, Projectile.owner); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), splitProj, Projectile.damage / 2, Projectile.knockBack / 2f, Projectile.owner); } } } @@ -188,42 +189,42 @@ namespace CalamityMod.Projectiles.Rogue private void LightingandDust() { - Lighting.AddLight(projectile.Center, 0f, 0.75f, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.75f, 0f); if (!Main.rand.NextBool(5)) return; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { // Return to the player after striking an enemy. Stealth strikes don't return immediately. - if (!projectile.Calamity().stealthStrike || projectile.ai[1] > 3) - projectile.ai[0] = 1f; - projectile.ai[1]++; + if (!Projectile.Calamity().stealthStrike || Projectile.ai[1] > 3) + Projectile.ai[0] = 1f; + Projectile.ai[1]++; } // Make it bounce on tiles. public override bool OnTileCollide(Vector2 oldVelocity) { // Impacts the terrain even though it bounces off. - Main.PlaySound(SoundID.Dig, projectile.Center); - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; return false; } } diff --git a/Projectiles/Rogue/TerraDiskProjectile2.cs b/Projectiles/Rogue/TerraDiskProjectile2.cs index 838816955d..4e2a379ecf 100644 --- a/Projectiles/Rogue/TerraDiskProjectile2.cs +++ b/Projectiles/Rogue/TerraDiskProjectile2.cs @@ -12,23 +12,23 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Terra Disk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.alpha = 75; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 60; + Projectile.width = 40; + Projectile.height = 40; + Projectile.alpha = 75; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.aiStyle = 3; + Projectile.timeLeft = 60; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() @@ -39,17 +39,17 @@ namespace CalamityMod.Projectiles.Rogue private void StealthStrikeAI() { - if (projectile.aiStyle == 3) + if (Projectile.aiStyle == 3) return; - projectile.rotation += 0.4f * projectile.direction; + Projectile.rotation += 0.4f * Projectile.direction; Projectile parent = Main.projectile[0]; bool active = false; for (int i = 0; i < Main.maxProjectiles; i++) { Projectile p = Main.projectile[i]; - if (p.identity == projectile.ai[0] && p.active && p.type == ModContent.ProjectileType()) + if (p.identity == Projectile.ai[0] && p.active && p.type == ModContent.ProjectileType()) { parent = p; active = true; @@ -59,38 +59,38 @@ namespace CalamityMod.Projectiles.Rogue if (active) { - Vector2 vector = parent.Center - projectile.Center; - projectile.Center = parent.Center + new Vector2(80, 0).RotatedBy(rotation); - double rotateAmt = (double)projectile.ai[1]; + Vector2 vector = parent.Center - Projectile.Center; + Projectile.Center = parent.Center + new Vector2(80, 0).RotatedBy(rotation); + double rotateAmt = (double)Projectile.ai[1]; rotation += rotateAmt; if (rotation >= 360) { rotation = 0; } - projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; + Projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; } else { - projectile.Kill(); + Projectile.Kill(); } if (!parent.active) { - projectile.Kill(); + Projectile.Kill(); } } private void LightingandDust() { - Lighting.AddLight(projectile.Center, 0f, 0.75f, 0f); + Lighting.AddLight(Projectile.Center, 0f, 0.75f, 0f); if (!Main.rand.NextBool(5)) return; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X, Projectile.velocity.Y); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/TheAtomSplitterDuplicate.cs b/Projectiles/Rogue/TheAtomSplitterDuplicate.cs index 4f5042ac4a..ce4ce36d52 100644 --- a/Projectiles/Rogue/TheAtomSplitterDuplicate.cs +++ b/Projectiles/Rogue/TheAtomSplitterDuplicate.cs @@ -8,54 +8,54 @@ namespace CalamityMod.Projectiles.Rogue { public class TheAtomSplitterDuplicate : ModProjectile { - public ref float Time => ref projectile.ai[0]; - public ref float Lifetime => ref projectile.ai[1]; + public ref float Time => ref Projectile.ai[0]; + public ref float Lifetime => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Atom Splitter"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.scale = 0.66f; - projectile.width = projectile.height = (int)(124f * projectile.scale); - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; - projectile.timeLeft = 900; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; + Projectile.scale = 0.66f; + Projectile.width = Projectile.height = (int)(124f * Projectile.scale); + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; + Projectile.timeLeft = 900; + Projectile.extraUpdates = 1; + Projectile.Calamity().rogue = true; } public override void AI() { // Accelerate until at a certain speed. - if (projectile.velocity.Length() < 20f) - projectile.velocity *= 1.02f; + if (Projectile.velocity.Length() < 20f) + Projectile.velocity *= 1.02f; - projectile.Opacity = CalamityUtils.Convert01To010(Time / Lifetime) * 0.6f; + Projectile.Opacity = CalamityUtils.Convert01To010(Time / Lifetime) * 0.6f; if (Time >= Lifetime) - projectile.Kill(); + Projectile.Kill(); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; Time++; } - public override bool CanDamage() => projectile.alpha < 180; + public override bool CanDamage() => Projectile.alpha < 180; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { if (Time <= 1f) return false; - Color drawColor = CalamityUtils.MulticolorLerp((Time / 35f + projectile.identity / 4f) % 1f, CalamityUtils.ExoPalette); + Color drawColor = CalamityUtils.MulticolorLerp((Time / 35f + Projectile.identity / 4f) % 1f, CalamityUtils.ExoPalette); drawColor.A = 0; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], drawColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], drawColor); return false; } } diff --git a/Projectiles/Rogue/TheAtomSplitterProjectile.cs b/Projectiles/Rogue/TheAtomSplitterProjectile.cs index 1767f7f469..ab028e01cd 100644 --- a/Projectiles/Rogue/TheAtomSplitterProjectile.cs +++ b/Projectiles/Rogue/TheAtomSplitterProjectile.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Rogue private const float NormalSplitMultiplier = 0.7f; private const float StealthSplitMultiplier = 0.144f; - public ref float HitTargetIndex => ref projectile.ai[0]; - public ref float Time => ref projectile.ai[1]; + public ref float HitTargetIndex => ref Projectile.ai[0]; + public ref float Time => ref Projectile.ai[1]; public override string Texture => "CalamityMod/Items/Weapons/Rogue/TheAtomSplitter"; @@ -22,51 +22,51 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = projectile.height = 124; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = Projectile.height = 124; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void SendExtraAI(BinaryWriter writer) { // timeLeft is not synced by default. However, it is changed during an operation that is only // performed from one client's perspective, therefore it must be synced in this context. - writer.Write(projectile.timeLeft); - writer.Write((byte)projectile.alpha); - writer.Write(projectile.scale); + writer.Write(Projectile.timeLeft); + writer.Write((byte)Projectile.alpha); + writer.Write(Projectile.scale); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.timeLeft = reader.ReadInt32(); - projectile.alpha = reader.ReadByte(); - projectile.scale = reader.ReadSingle(); + Projectile.timeLeft = reader.ReadInt32(); + Projectile.alpha = reader.ReadByte(); + Projectile.scale = reader.ReadSingle(); } public override void AI() { // Accelerate until at a certain speed. - if (projectile.velocity.Length() < 20f) - projectile.velocity *= 1.02f; + if (Projectile.velocity.Length() < 20f) + Projectile.velocity *= 1.02f; - if (projectile.alpha < 10) + if (Projectile.alpha < 10) EmitDustFromTip(); // Stick to the target for a while and release a bunch of duplicates. if (Main.npc.IndexInRange((int)HitTargetIndex) && Main.npc[(int)HitTargetIndex].active) { - if (projectile.alpha < 255) - projectile.alpha = Utils.Clamp(projectile.alpha + 30, 0, 255); + if (Projectile.alpha < 255) + Projectile.alpha = Utils.Clamp(Projectile.alpha + 30, 0, 255); - bool stealth = projectile.Calamity().stealthStrike; + bool stealth = Projectile.Calamity().stealthStrike; int shootRate = stealth ? 2 : 4; - if (projectile.timeLeft % shootRate == shootRate - 1) + if (Projectile.timeLeft % shootRate == shootRate - 1) { NPC target = Main.npc[(int)HitTargetIndex]; FireDuplicateAtTarget(target, stealth ? 305f : 200f, stealth); @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Rogue FireExtraDuplicatesAtTarget(target); } } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; Time++; } @@ -83,18 +83,18 @@ namespace CalamityMod.Projectiles.Rogue if (Main.dedServ) return; - float dustVelocityArcOffset = 1.5f + (float)Math.Sin(MathHelper.TwoPi * projectile.timeLeft / 35f) * 0.25f; + float dustVelocityArcOffset = 1.5f + (float)Math.Sin(MathHelper.TwoPi * Projectile.timeLeft / 35f) * 0.25f; - float colorInterpolant = (float)Math.Cos(MathHelper.TwoPi * projectile.timeLeft / 75f) * 0.5f + 0.5f; + float colorInterpolant = (float)Math.Cos(MathHelper.TwoPi * Projectile.timeLeft / 75f) * 0.5f + 0.5f; Color dustColor = CalamityUtils.MulticolorLerp(colorInterpolant, CalamityUtils.ExoPalette); - Vector2 currentDirection = projectile.velocity.SafeNormalize(-Vector2.UnitY); - Vector2 tipPosition = projectile.Center + currentDirection * (projectile.height * 0.67f - 3f); + Vector2 currentDirection = Projectile.velocity.SafeNormalize(-Vector2.UnitY); + Vector2 tipPosition = Projectile.Center + currentDirection * (Projectile.height * 0.67f - 3f); tipPosition += Main.rand.NextVector2CircularEdge(0.35f, 0.35f); for (float direction = -1f; direction <= 1f; direction += 2f) { Dust prismaticEnergy = Dust.NewDustPerfect(tipPosition, 267); - prismaticEnergy.velocity = currentDirection.RotatedBy(direction * dustVelocityArcOffset) * -7f + projectile.velocity; + prismaticEnergy.velocity = currentDirection.RotatedBy(direction * dustVelocityArcOffset) * -7f + Projectile.velocity; prismaticEnergy.scale = 1.2f; prismaticEnergy.color = dustColor; prismaticEnergy.noGravity = true; @@ -106,25 +106,25 @@ namespace CalamityMod.Projectiles.Rogue public void FireDuplicateAtTarget(NPC target, float baseOutwardness, bool stealth) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; Vector2 spawnPosition = target.Center + Main.rand.NextVector2CircularEdge(baseOutwardness, baseOutwardness) * Main.rand.NextFloat(0.9f, 1.15f); Vector2 shootVelocity = (target.Center - spawnPosition).SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(12f, 14f); - int damage = (int)(projectile.damage * (stealth ? StealthSplitMultiplier : NormalSplitMultiplier)); - Projectile.NewProjectile(spawnPosition, shootVelocity, ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner, 0f, baseOutwardness / 9f); + int damage = (int)(Projectile.damage * (stealth ? StealthSplitMultiplier : NormalSplitMultiplier)); + Projectile.NewProjectile(spawnPosition, shootVelocity, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner, 0f, baseOutwardness / 9f); } public void FireExtraDuplicatesAtTarget(NPC target) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; Vector2 spawnPosition = target.Center + Vector2.UnitY * Main.rand.NextBool(2).ToDirectionInt() * Main.rand.NextFloat(200f, 270f); spawnPosition.X += Main.rand.NextFloatDirection() * target.width * 0.45f; - int damage = (int)(projectile.damage * StealthSplitMultiplier); + int damage = (int)(Projectile.damage * StealthSplitMultiplier); Vector2 shootVelocity = Vector2.UnitY * (target.Center.Y - spawnPosition.Y > 0f).ToDirectionInt() * Main.rand.NextFloat(14f, 16.5f); - Projectile.NewProjectile(spawnPosition, shootVelocity, ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner, 0f, 24f); + Projectile.NewProjectile(spawnPosition, shootVelocity, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner, 0f, 24f); } public void ReleaseHitDust(Vector2 spawnPosition) @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.dedServ) return; - int dustCount = projectile.Calamity().stealthStrike ? 60 : 40; + int dustCount = Projectile.Calamity().stealthStrike ? 60 : 40; Vector2 baseDustVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * 1.4f; Vector2 outwardFireSpeedFactor = new Vector2(2.1f, 2f); @@ -142,8 +142,8 @@ namespace CalamityMod.Projectiles.Rogue Dust explosionDust = Dust.NewDustDirect(spawnPosition, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); explosionDust.position = spawnPosition; explosionDust.velocity = baseDustVelocity.RotatedBy(MathHelper.TwoPi * i / dustCount) * outwardFireSpeedFactor * Main.rand.NextFloat(0.8f, 1.2f); - explosionDust.velocity += projectile.velocity * Main.rand.NextFloat(0.6f, 0.85f); - if (projectile.Calamity().stealthStrike) + explosionDust.velocity += Projectile.velocity * Main.rand.NextFloat(0.6f, 0.85f); + if (Projectile.Calamity().stealthStrike) explosionDust.velocity *= 1.6f; explosionDust.noGravity = true; @@ -159,7 +159,7 @@ namespace CalamityMod.Projectiles.Rogue } } - public override bool CanDamage() => projectile.alpha < 80; + public override bool CanDamage() => Projectile.alpha < 80; public override bool? CanHitNPC(NPC target) { @@ -170,12 +170,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - ReleaseHitDust(target.Center - projectile.velocity * 3f); + ReleaseHitDust(target.Center - Projectile.velocity * 3f); if (!Main.npc.IndexInRange((int)HitTargetIndex)) { HitTargetIndex = target.whoAmI; - projectile.timeLeft = projectile.Calamity().stealthStrike ? 100 : 60; - projectile.netUpdate = true; + Projectile.timeLeft = Projectile.Calamity().stealthStrike ? 100 : 60; + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Rogue/TheSyringeCinder.cs b/Projectiles/Rogue/TheSyringeCinder.cs index 4e32884777..3eaa19e0da 100644 --- a/Projectiles/Rogue/TheSyringeCinder.cs +++ b/Projectiles/Rogue/TheSyringeCinder.cs @@ -11,79 +11,79 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Syringe Cinder"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 120; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().rogue = true; - projectile.alpha = 100; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 120; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; + Projectile.alpha = 100; } public override void AI() { //make it face the way it's going - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.rotation = -projectile.velocity.X * 0.05f; + Projectile.rotation += Projectile.velocity.X * 0.1f; + Projectile.rotation = -Projectile.velocity.X * 0.05f; } else { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + ((3 * MathHelper.Pi) / 2); - projectile.spriteDirection = ((projectile.velocity.X > 0f) ? -1 : 1); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + ((3 * MathHelper.Pi) / 2); + Projectile.spriteDirection = ((Projectile.velocity.X > 0f) ? -1 : 1); } //frames - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } //movement - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + Projectile.velocity.X = Projectile.velocity.X * -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } if (Main.rand.NextBool(4)) { - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 1f); + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num199]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Rogue } if (Main.rand.NextBool(10)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num200]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -101,19 +101,19 @@ namespace CalamityMod.Projectiles.Rogue dust.noGravity = true; dust.velocity *= 0.1f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + Projectile.velocity.X = Projectile.velocity.X * 0.8f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; return false; } diff --git a/Projectiles/Rogue/TheSyringeProj.cs b/Projectiles/Rogue/TheSyringeProj.cs index e1f5559b5a..fffd263ba8 100644 --- a/Projectiles/Rogue/TheSyringeProj.cs +++ b/Projectiles/Rogue/TheSyringeProj.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -14,36 +15,36 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Syringe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.light = 0.5f; - projectile.extraUpdates = 1; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.light = 0.5f; + Projectile.extraUpdates = 1; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { if (Main.rand.NextBool(8)) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.Next(2) == 1 ? 107 : 89, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.Next(2) == 1 ? 107 : 89, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - projectile.damage += projectile.Calamity().defDamage / 200; + Projectile.damage += Projectile.Calamity().defDamage / 200; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -59,39 +60,39 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 100); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item107, projectile.position); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 100); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item107, Projectile.position); for (int k = 0; k < 7; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 89, projectile.oldVelocity.X, projectile.oldVelocity.Y); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 89, Projectile.oldVelocity.X, Projectile.oldVelocity.Y); } int fireAmt = Main.rand.Next(1, 3); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int f = 0; f < fireAmt; f++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, Main.myPlayer); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Main.myPlayer); } for (int s = 0; s < 2; ++s) { - float SpeedX = -projectile.velocity.X * Main.rand.NextFloat(0.4f, 0.7f) + Main.rand.NextFloat(-8f, 8f); - float SpeedY = -projectile.velocity.Y * Main.rand.NextFloat(0.4f, 0.7f) + Main.rand.NextFloat(-8f, 8f); - Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 0f, Main.myPlayer, Main.rand.Next(3), 0f); + float SpeedX = -Projectile.velocity.X * Main.rand.NextFloat(0.4f, 0.7f) + Main.rand.NextFloat(-8f, 8f); + float SpeedY = -Projectile.velocity.Y * Main.rand.NextFloat(0.4f, 0.7f) + Main.rand.NextFloat(-8f, 8f); + Projectile.NewProjectile(Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 0f, Main.myPlayer, Main.rand.Next(3), 0f); } } - if (projectile.owner == Main.myPlayer && projectile.ai[1] == 1) + if (Projectile.owner == Main.myPlayer && Projectile.ai[1] == 1) { for (int b = 0; b < 5; b++) { float speedX = Main.rand.NextFloat(-0.7f, 0.7f); float speedY = Main.rand.NextFloat(-0.7f, 0.7f); - int bee = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX, speedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, Main.myPlayer); + int bee = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, speedX, speedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Main.myPlayer); Main.projectile[bee].penetrate = 1; } } diff --git a/Projectiles/Rogue/TheSyringeS1.cs b/Projectiles/Rogue/TheSyringeS1.cs index 3d622fc888..b495d7d729 100644 --- a/Projectiles/Rogue/TheSyringeS1.cs +++ b/Projectiles/Rogue/TheSyringeS1.cs @@ -11,45 +11,45 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Shrapnel"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.aiStyle = 24; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.light = 0.5f; - projectile.alpha = 50; - projectile.scale = 1.2f; - projectile.timeLeft = 180; - projectile.tileCollide = false; - projectile.Calamity().rogue = true; + Projectile.width = 6; + Projectile.height = 6; + Projectile.aiStyle = 24; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.light = 0.5f; + Projectile.alpha = 50; + Projectile.scale = 1.2f; + Projectile.timeLeft = 180; + Projectile.tileCollide = false; + Projectile.Calamity().rogue = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void PostAI() { - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 10f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 10f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { //Changes the texture of the projectile - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/TheSyringeS2"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, 6)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Rogue/TheSyringeS2"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, 6)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/TheSyringeS3"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, 6)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Rogue/TheSyringeS3"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, 6)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } return true; diff --git a/Projectiles/Rogue/ThiefsDimeProj.cs b/Projectiles/Rogue/ThiefsDimeProj.cs index e4234a3d37..e321ad38e8 100644 --- a/Projectiles/Rogue/ThiefsDimeProj.cs +++ b/Projectiles/Rogue/ThiefsDimeProj.cs @@ -12,44 +12,44 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Thief's Dime"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.Calamity().rogue = true; - projectile.timeLeft = 18000; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.timeLeft *= 5; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 20; + Projectile.height = 20; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.Calamity().rogue = true; + Projectile.timeLeft = 18000; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.timeLeft *= 5; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) + if (Projectile.frame > 4) { - projectile.frame = 0; + Projectile.frame = 0; } - bool flag64 = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool flag64 = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.thiefsDime) { - projectile.active = false; + Projectile.active = false; return; } if (flag64) @@ -60,25 +60,25 @@ namespace CalamityMod.Projectiles.Rogue } if (modPlayer.tDime) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.01f / 255f); - Vector2 vector = player.Center - projectile.Center; - projectile.rotation = vector.ToRotation() - 1.57f; - projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + Vector2 vector = player.Center - Projectile.Center; + Projectile.rotation = vector.ToRotation() - 1.57f; + Projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); rotation += 0.03; if (rotation >= 360) { rotation = 0; } - projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; + Projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Midas, 360); - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) { if (Main.rand.NextBool(5)) diff --git a/Projectiles/Rogue/TimeBoltKnife.cs b/Projectiles/Rogue/TimeBoltKnife.cs index db619c1434..bf57066f4b 100644 --- a/Projectiles/Rogue/TimeBoltKnife.cs +++ b/Projectiles/Rogue/TimeBoltKnife.cs @@ -6,6 +6,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { public class TimeBoltKnife : ModProjectile @@ -19,21 +20,21 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Time Bolt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = penetrationAmt; - projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = penetrationAmt; + Projectile.timeLeft = 600; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; } public override void SendExtraAI(BinaryWriter writer) @@ -50,7 +51,7 @@ namespace CalamityMod.Projectiles.Rogue { if (!initialized) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { maxPenetrate = 11; penetrationAmt = maxPenetrate; @@ -58,24 +59,24 @@ namespace CalamityMod.Projectiles.Rogue initialized = true; } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.03f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.03f; // If projectile hasn't hit anything yet - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.tileCollide = true; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 7f) + Projectile.tileCollide = true; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 7f) { int dustType = Utils.SelectRandom(Main.rand, new int[] { 226, 229 }); - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; Vector2 vector74 = new Vector2(-4f, 4f); vector74 += new Vector2(-4f, 4f); - vector74 = vector74.RotatedBy((double)projectile.rotation, default); + vector74 = vector74.RotatedBy((double)Projectile.rotation, default); int dust = Dust.NewDust(center + vector74 + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 1f); Dust dust2 = Main.dust[dust]; dust2.velocity *= 0.1f; @@ -86,58 +87,58 @@ namespace CalamityMod.Projectiles.Rogue int alphaAmt = 5; int alphaCeiling = alphaAmt * 15; int alphaFloor = 0; - if (projectile.localAI[0] > 7f) + if (Projectile.localAI[0] > 7f) { - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - projectile.scale -= scalar; + Projectile.scale -= scalar; - projectile.alpha += alphaAmt; - if (projectile.alpha > alphaCeiling) + Projectile.alpha += alphaAmt; + if (Projectile.alpha > alphaCeiling) { - projectile.alpha = alphaCeiling; - projectile.localAI[1] = 1f; + Projectile.alpha = alphaCeiling; + Projectile.localAI[1] = 1f; } } - else if (projectile.localAI[1] == 1f) + else if (Projectile.localAI[1] == 1f) { - projectile.scale += scalar; + Projectile.scale += scalar; - projectile.alpha -= alphaAmt; - if (projectile.alpha <= alphaFloor) + Projectile.alpha -= alphaAmt; + if (Projectile.alpha <= alphaFloor) { - projectile.alpha = alphaFloor; - projectile.localAI[1] = 0f; + Projectile.alpha = alphaFloor; + Projectile.localAI[1] = 0f; } } } } // If projectile has hit an enemy and has 'split' - else if (projectile.ai[0] >= 1f && projectile.ai[0] < (float)(1 + penetrationAmt)) + else if (Projectile.ai[0] >= 1f && Projectile.ai[0] < (float)(1 + penetrationAmt)) { - projectile.tileCollide = false; - projectile.alpha += 15; - projectile.velocity *= 0.98f; - projectile.localAI[0] = 0f; + Projectile.tileCollide = false; + Projectile.alpha += 15; + Projectile.velocity *= 0.98f; + Projectile.localAI[0] = 0f; - if (projectile.alpha >= 255) + if (Projectile.alpha >= 255) { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.Kill(); + Projectile.Kill(); return; } int whoAmI = -1; - Vector2 targetSpot = projectile.Center; + Vector2 targetSpot = Projectile.Center; float detectRange = 1000f; for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); if (targetDist < detectRange) { detectRange = targetDist; @@ -149,13 +150,13 @@ namespace CalamityMod.Projectiles.Rogue if (whoAmI >= 0) { - projectile.netUpdate = true; - projectile.ai[0] += (float)penetrationAmt; - projectile.position = targetSpot + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * 100f - new Vector2((float)projectile.width, (float)projectile.height) / 2f; - projectile.velocity = Vector2.Normalize(targetSpot - projectile.Center) * 18f; + Projectile.netUpdate = true; + Projectile.ai[0] += (float)penetrationAmt; + Projectile.position = targetSpot + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * 100f - new Vector2((float)Projectile.width, (float)Projectile.height) / 2f; + Projectile.velocity = Vector2.Normalize(targetSpot - Projectile.Center) * 18f; } else - projectile.Kill(); + Projectile.Kill(); } if (Main.rand.NextBool(3)) @@ -165,10 +166,10 @@ namespace CalamityMod.Projectiles.Rogue 226, 229 }); - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; Vector2 vector75 = new Vector2(-4f, 4f); vector75 += new Vector2(-4f, 4f); - vector75 = vector75.RotatedBy((double)projectile.rotation, default); + vector75 = vector75.RotatedBy((double)Projectile.rotation, default); int dust = Dust.NewDust(center + vector75 + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 0.6f); Dust dust2 = Main.dust[dust]; dust2.velocity *= 0.1f; @@ -177,64 +178,64 @@ namespace CalamityMod.Projectiles.Rogue } // If 'split' projectile has a target - else if (projectile.ai[0] >= (float)(1 + penetrationAmt) && projectile.ai[0] < (float)(1 + penetrationAmt * 2)) + else if (Projectile.ai[0] >= (float)(1 + penetrationAmt) && Projectile.ai[0] < (float)(1 + penetrationAmt * 2)) { - projectile.scale = 0.9f; - projectile.tileCollide = false; + Projectile.scale = 0.9f; + Projectile.tileCollide = false; - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 15f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 15f) { - projectile.alpha += 51; - projectile.velocity *= 0.8f; + Projectile.alpha += 51; + Projectile.velocity *= 0.8f; - if (projectile.alpha >= 255) - projectile.Kill(); + if (Projectile.alpha >= 255) + Projectile.Kill(); } else { - projectile.alpha -= 125; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 125; + if (Projectile.alpha < 0) + Projectile.alpha = 0; - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; int dustType = Utils.SelectRandom(Main.rand, new int[] { 226, 229 }); - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; Vector2 vector76 = new Vector2(-4f, 4f); vector76 += new Vector2(-4f, 4f); - vector76 = vector76.RotatedBy((double)projectile.rotation, default); + vector76 = vector76.RotatedBy((double)Projectile.rotation, default); int dust = Dust.NewDust(center + vector76 + Vector2.One * -4f, 8, 8, dustType, 0f, 0f, 100, default, 0.6f); Dust dust2 = Main.dust[dust]; dust2.velocity *= 0.1f; dust2.noGravity = true; } - float colorScale = (float)projectile.alpha / 255f; - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.3f * colorScale, 0.4f * colorScale, 1f * colorScale); + float colorScale = (float)Projectile.alpha / 255f; + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0.3f * colorScale, 0.4f * colorScale, 1f * colorScale); } - public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 200) * ((255f - (float)projectile.alpha) / 255f); + public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 200) * ((255f - (float)Projectile.alpha) / 255f); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - projectile.velocity = oldVelocity / 2f; + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; + Projectile.velocity = oldVelocity / 2f; if (penetrationAmt == maxPenetrate) SlowTime(); @@ -247,7 +248,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool CanDamage() { // Do not do damage if a tile is hit OR if projectile has 'split' and hasn't been live for more than 5 frames - if ((((int)(projectile.ai[0] - 1f) / penetrationAmt == 0 && penetrationAmt < 3) || projectile.ai[1] < 5f) && projectile.ai[0] != 0f) + if ((((int)(Projectile.ai[0] - 1f) / penetrationAmt == 0 && penetrationAmt < 3) || Projectile.ai[1] < 5f) && Projectile.ai[0] != 0f) return false; return true; } @@ -258,8 +259,8 @@ namespace CalamityMod.Projectiles.Rogue SlowTime(); // If 'split' projectile hits an enemy - if (projectile.ai[0] >= (float)(1 + penetrationAmt) && projectile.ai[0] < (float)(1 + penetrationAmt * 2)) - projectile.ai[0] = 0f; + if (Projectile.ai[0] >= (float)(1 + penetrationAmt) && Projectile.ai[0] < (float)(1 + penetrationAmt * 2)) + Projectile.ai[0] = 0f; // Becomes 5 on first hit, then 4, and so on penetrationAmt--; @@ -267,20 +268,20 @@ namespace CalamityMod.Projectiles.Rogue // Hits enemy, ai[0] = 0f + 4f = 4f on first hit // ai[0] = 4f - 1f = 3f on second hit // ai[0] = 3f - 1f = 2f on third hit - if (projectile.ai[0] == 0f) - projectile.ai[0] += (float)penetrationAmt; + if (Projectile.ai[0] == 0f) + Projectile.ai[0] += (float)penetrationAmt; else - projectile.ai[0] -= (float)(penetrationAmt + 1); + Projectile.ai[0] -= (float)(penetrationAmt + 1); - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } private void SlowTime() { - Main.PlaySound(SoundID.Item114, projectile.Center); + SoundEngine.PlaySound(SoundID.Item114, Projectile.Center); - float radius = projectile.Calamity().stealthStrike ? 500f : 300f; + float radius = Projectile.Calamity().stealthStrike ? 500f : 300f; int numDust = (int)(0.2f * MathHelper.TwoPi * radius); float angleIncrement = MathHelper.TwoPi / (float)numDust; Vector2 dustOffset = new Vector2(radius, 0f); @@ -293,8 +294,8 @@ namespace CalamityMod.Projectiles.Rogue 226, 229 }); - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType); - Main.dust[dust].position = projectile.Center + dustOffset; + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType); + Main.dust[dust].position = Projectile.Center + dustOffset; if (Main.rand.Next(6) != 0) Main.dust[dust].noGravity = true; Main.dust[dust].fadeIn = 1f; @@ -307,7 +308,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.buffImmune[buffType] && Vector2.Distance(projectile.Center, npc.Center) <= radius) + if (npc.active && !npc.dontTakeDamage && !npc.buffImmune[buffType] && Vector2.Distance(Projectile.Center, npc.Center) <= radius) { if (npc.FindBuffIndex(buffType) == -1) npc.AddBuff(buffType, 60, false); @@ -317,7 +318,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/Projectiles/Rogue/TitaniumClone.cs b/Projectiles/Rogue/TitaniumClone.cs index 6cf49362b3..7c6992b881 100644 --- a/Projectiles/Rogue/TitaniumClone.cs +++ b/Projectiles/Rogue/TitaniumClone.cs @@ -13,38 +13,38 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Shuriken"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.alpha = 150; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 200; - projectile.Calamity().rogue = true; - projectile.extraUpdates = 1; + Projectile.width = 28; + Projectile.height = 28; + Projectile.alpha = 150; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 200; + Projectile.Calamity().rogue = true; + Projectile.extraUpdates = 1; } public override void AI() { - projectile.rotation += RotationIncrement; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 30f) + Projectile.rotation += RotationIncrement; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 30f) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); } } - public override bool CanDamage() => projectile.ai[0] >= 30f; + public override bool CanDamage() => Projectile.ai[0] >= 30f; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/TitaniumShurikenProjectile.cs b/Projectiles/Rogue/TitaniumShurikenProjectile.cs index 5bc0f36384..7a3ce1c381 100644 --- a/Projectiles/Rogue/TitaniumShurikenProjectile.cs +++ b/Projectiles/Rogue/TitaniumShurikenProjectile.cs @@ -17,113 +17,113 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Shuriken"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 2; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.aiStyle = 2; + Projectile.timeLeft = 600; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; - projectile.localNPCHitCooldown = 20; + Projectile.Calamity().rogue = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { drawOffsetX = -11; drawOriginOffsetY = -10; drawOriginOffsetX = 0; // ai[0] stores whether the knife is returning. If 0, it isn't. If 1, it is. - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= ReboundTime) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= ReboundTime) { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } } else { - projectile.tileCollide = false; + Projectile.tileCollide = false; float returnSpeed = 16f; float acceleration = 3.2f; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; // Delete the shuriken if it's excessively far away. Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); dist = returnSpeed / dist; xDist *= dist; yDist *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) + if (Projectile.velocity.X < xDist) { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X = Projectile.velocity.X + acceleration; + if (Projectile.velocity.X < 0f && xDist > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > xDist) + else if (Projectile.velocity.X > xDist) { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X = Projectile.velocity.X - acceleration; + if (Projectile.velocity.X > 0f && xDist < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < yDist) + if (Projectile.velocity.Y < yDist) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y = Projectile.velocity.Y + acceleration; + if (Projectile.velocity.Y < 0f && yDist > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > yDist) + else if (Projectile.velocity.Y > yDist) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y = Projectile.velocity.Y - acceleration; + if (Projectile.velocity.Y > 0f && yDist < 0f) + Projectile.velocity.Y -= acceleration; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) { - projectile.Kill(); //boomerangs return to you so you get a refund - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Projectile.Kill(); //boomerangs return to you so you get a refund + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } // Rotate the shuriken as it flies. - projectile.rotation += RotationIncrement; + Projectile.rotation += RotationIncrement; return; } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } return false; } @@ -132,29 +132,29 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - if (projectile.Calamity().stealthStrike) + Texture2D tex = Main.projectileTexture[Projectile.type]; + if (Projectile.Calamity().stealthStrike) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); } else { - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); } return false; } public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2) && !projectile.Calamity().stealthStrike) + if (Main.rand.NextBool(2) && !Projectile.Calamity().stealthStrike) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer && projectile.Calamity().stealthStrike) + if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) { int projNumber = Main.rand.Next(1,3); for (int index2 = 0; index2 < projNumber; index2++) @@ -163,14 +163,14 @@ namespace CalamityMod.Projectiles.Rogue float yVector = (float)Main.rand.Next(-35, 36) * 0.02f; xVector *= 10f; yVector *= 10f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, xVector, yVector, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, xVector, yVector, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.owner == Main.myPlayer && projectile.Calamity().stealthStrike) + if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) { int projNumber = Main.rand.Next(1,3); for (int index2 = 0; index2 < projNumber; index2++) @@ -179,7 +179,7 @@ namespace CalamityMod.Projectiles.Rogue float yVector = (float)Main.rand.Next(-35, 36) * 0.02f; xVector *= 10f; yVector *= 10f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, xVector, yVector, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, xVector, yVector, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Rogue/ToothBallProjectile.cs b/Projectiles/Rogue/ToothBallProjectile.cs index 54337eb7ce..4107c27037 100644 --- a/Projectiles/Rogue/ToothBallProjectile.cs +++ b/Projectiles/Rogue/ToothBallProjectile.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.aiStyle = 2; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.aiStyle = 2; + Projectile.timeLeft = 600; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; - projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; + Projectile.localNPCHitCooldown = 10; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -39,15 +39,15 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer && projectile.Calamity().stealthStrike) + if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -10f, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner, 1f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, -10f, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner, 1f, 0f); } } } diff --git a/Projectiles/Rogue/TotalMeltdown.cs b/Projectiles/Rogue/TotalMeltdown.cs index 86af54f637..9fcd692f0f 100644 --- a/Projectiles/Rogue/TotalMeltdown.cs +++ b/Projectiles/Rogue/TotalMeltdown.cs @@ -8,25 +8,25 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); - Main.projFrames[projectile.type] = 13; + Main.projFrames[Projectile.type] = 13; } public override void SetDefaults() { - projectile.width = 120; - projectile.height = 122; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.penetrate = -1; - projectile.timeLeft = Main.projFrames[projectile.type] * 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.width = 120; + Projectile.height = 122; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.penetrate = -1; + Projectile.timeLeft = Main.projFrames[Projectile.type] * 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() { - if (projectile.timeLeft % 5f == 4f) - projectile.frame++; + if (Projectile.timeLeft % 5f == 4f) + Projectile.frame++; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/TotalityFire.cs b/Projectiles/Rogue/TotalityFire.cs index 4d9a445f15..cbc5687c8b 100644 --- a/Projectiles/Rogue/TotalityFire.cs +++ b/Projectiles/Rogue/TotalityFire.cs @@ -13,95 +13,95 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 120; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Calamity().rogue = true; - projectile.ignoreWater = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 120; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().rogue = true; + Projectile.ignoreWater = true; } public override void AI() { //make it face the way it's going - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.rotation = -projectile.velocity.X * 0.05f + MathHelper.PiOver2; + Projectile.rotation = -Projectile.velocity.X * 0.05f + MathHelper.PiOver2; } else { - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); } - projectile.ai[1]--; + Projectile.ai[1]--; //frames if (!initialized) { initialized = true; - projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); + Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); } - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } //movement - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X *= -0.1f; + Projectile.velocity.X *= -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X *= -0.5f; + Projectile.velocity.X *= -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y *= -0.5f; + Projectile.velocity.Y *= -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X *= 0.97f; - if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) + Projectile.velocity.X *= 0.97f; + if (Projectile.velocity.X > -0.01f && Projectile.velocity.X < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; } - if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) + if (Projectile.velocity.Y < 0.25f && Projectile.velocity.Y > 0.15f) { - projectile.velocity.X *= 0.8f; + Projectile.velocity.X *= 0.8f; } - if (projectile.velocity.Y > 16f) + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } //dust if (Main.rand.NextBool(4)) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Rogue } if (Main.rand.NextBool(10)) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.ai[1] = 10f; + Projectile.ai[1] = 10f; return false; } @@ -139,7 +139,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/TotalityFlask.cs b/Projectiles/Rogue/TotalityFlask.cs index d4a47fd807..c41be3ead1 100644 --- a/Projectiles/Rogue/TotalityFlask.cs +++ b/Projectiles/Rogue/TotalityFlask.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -16,69 +17,69 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 68; - projectile.timeLeft = 180; - projectile.Calamity().rogue = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.aiStyle = 68; + Projectile.timeLeft = 180; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - if (projectile.timeLeft % 10 == 0) + if (Projectile.timeLeft % 10 == 0) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), Projectile.knockBack, Projectile.owner, 0f, 0f); } } } Vector2 spinningpoint = new Vector2(4f, -8f); - float rotation = projectile.rotation; - if (projectile.direction == -1) + float rotation = Projectile.rotation; + if (Projectile.direction == -1) spinningpoint.X = -4f; Vector2 vector2 = spinningpoint.RotatedBy((double)rotation, new Vector2()); for (int index1 = 0; index1 < 1; ++index1) { - int index2 = Dust.NewDust(projectile.Center + vector2 - Vector2.One * 5f, 4, 4, 6, 0.0f, 0.0f, 0, new Color(), 1f); + int index2 = Dust.NewDust(Projectile.Center + vector2 - Vector2.One * 5f, 4, 4, 6, 0.0f, 0.0f, 0, new Color(), 1f); Main.dust[index2].scale = 1.5f; Main.dust[index2].noGravity = true; Main.dust[index2].velocity = Main.dust[index2].velocity * 0.25f + Vector2.Normalize(vector2) * 1f; - Main.dust[index2].velocity = Main.dust[index2].velocity.RotatedBy(-MathHelper.PiOver2 * (double)projectile.direction, new Vector2()); + Main.dust[index2].velocity = Main.dust[index2].velocity.RotatedBy(-MathHelper.PiOver2 * (double)Projectile.direction, new Vector2()); } } public override void Kill(int timeLeft) { - if (projectile.owner != Main.myPlayer) + if (Projectile.owner != Main.myPlayer) return; //glass-pot break sound - Main.PlaySound(SoundID.Shatter, (int) projectile.position.X, (int) projectile.position.Y, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.Shatter, (int) Projectile.position.X, (int) Projectile.position.Y, 1, 1f, 0f); - int meltdown = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[meltdown].Center = projectile.Center; //makes it centered because it's not without this + int meltdown = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Main.projectile[meltdown].Center = Projectile.Center; //makes it centered because it's not without this Vector2 vector2 = new Vector2(20f, 20f); for (int d = 0; d < 5; ++d) - Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 191, 0.0f, 0.0f, 0, Color.Red, 1f); + Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 191, 0.0f, 0.0f, 0, Color.Red, 1f); for (int d = 0; d < 10; ++d) { - int index2 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); + int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust = Main.dust[index2]; dust.velocity *= 1.4f; } for (int d = 0; d < 20; ++d) { - int index2 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 2.5f); + int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 2.5f); Dust dust1 = Main.dust[index2]; dust1.noGravity = true; dust1.velocity *= 5f; - int index3 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 1.5f); + int index3 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust2 = Main.dust[index3]; dust2.velocity *= 3f; } @@ -86,7 +87,7 @@ namespace CalamityMod.Projectiles.Rogue for (int t = 0; t < tarAmt; t++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Rogue/TotalityTar.cs b/Projectiles/Rogue/TotalityTar.cs index d7de8480bf..854de45f4b 100644 --- a/Projectiles/Rogue/TotalityTar.cs +++ b/Projectiles/Rogue/TotalityTar.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,54 +16,54 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().rogue = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 30; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Calamity().rogue = true; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X *= -0.1f; + Projectile.velocity.X *= -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X *= -0.5f; + Projectile.velocity.X *= -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y *= -0.5f; + Projectile.velocity.Y *= -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X *= 0.97f; - if (Math.Abs(projectile.velocity.X) < 0.01f) + Projectile.velocity.X *= 0.97f; + if (Math.Abs(Projectile.velocity.X) < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; - if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) + Projectile.rotation += Projectile.velocity.X * 0.1f; + if (Projectile.velocity.Y < 0.25f && Projectile.velocity.Y > 0.15f) { - projectile.velocity.X *= 0.8f; + Projectile.velocity.X *= 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) + Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } @@ -83,33 +84,33 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item74, projectile.position); + SoundEngine.PlaySound(SoundID.Item74, Projectile.position); Vector2 vector2 = new Vector2(20f, 20f); for (int index = 0; index < 3; ++index) - Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 191, 0.0f, 0.0f, 0, Color.Red, 1f); + Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 191, 0.0f, 0.0f, 0, Color.Red, 1f); for (int index1 = 0; index1 < 5; ++index1) { - int index2 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); + int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust = Main.dust[index2]; dust.velocity *= 1.4f; } for (int index1 = 0; index1 < 10; ++index1) { - int index2 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 2.5f); + int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 2.5f); Dust dust1 = Main.dust[index2]; dust1.noGravity = true; dust1.velocity *= 5f; - int index3 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 1.5f); + int index3 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust2 = Main.dust[index3]; dust2.velocity *= 3f; } int fireAmt = Main.rand.Next(2, 4); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int f = 0; f < fireAmt; f++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, 1f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, 1f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Rogue/ToxicantTwisterDust.cs b/Projectiles/Rogue/ToxicantTwisterDust.cs index e71505255f..fd973a1139 100644 --- a/Projectiles/Rogue/ToxicantTwisterDust.cs +++ b/Projectiles/Rogue/ToxicantTwisterDust.cs @@ -15,19 +15,19 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.tileCollide = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.Calamity().rogue = true; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.Calamity().rogue = true; } public override void AI() { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 0f; } diff --git a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs index 7a2884100c..2b0858442d 100644 --- a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs +++ b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -21,112 +22,112 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 42; - projectile.height = 46; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = lifeTime; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 12; + Projectile.width = 42; + Projectile.height = 46; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = lifeTime; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; } public override void AI() { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - if (projectile.timeLeft % 20 == 0 && Main.myPlayer == projectile.owner) + if (Projectile.timeLeft % 20 == 0 && Main.myPlayer == Projectile.owner) { for (int i = 0; i < 2; i++) - Projectile.NewProjectile(projectile.Center, projectile.velocity.RotatedByRandom(0.1f) * -0.6f, ModContent.ProjectileType(), (int)(projectile.damage * 0.35), 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Projectile.velocity.RotatedByRandom(0.1f) * -0.6f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), 0f, Projectile.owner); } - projectile.rotation += 0.06f * (projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation += 0.06f * (Projectile.velocity.X > 0).ToDirectionInt(); } // Boomerang rotation - projectile.rotation += 0.4f * projectile.direction; + Projectile.rotation += 0.4f * Projectile.direction; // Boomerang sound - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } - projectile.ai[1]++; - if (projectile.ai[0] != 0f) + Projectile.ai[1]++; + if (Projectile.ai[0] != 0f) { float returnSpeed = 30f; float acceleration = 1.4f; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; // Delete the projectile if it's excessively far away. - Vector2 projVector = owner.Center - projectile.Center; + Vector2 projVector = owner.Center - Projectile.Center; float dist = projVector.Length(); if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); dist = returnSpeed / dist; projVector.X *= dist; projVector.Y *= dist; // Home back in on the player. - if (projectile.velocity.X < projVector.X) + if (Projectile.velocity.X < projVector.X) { - projectile.velocity.X += acceleration; - if (projectile.velocity.X < 0f && projVector.X > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X += acceleration; + if (Projectile.velocity.X < 0f && projVector.X > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > projVector.X) + else if (Projectile.velocity.X > projVector.X) { - projectile.velocity.X -= acceleration; - if (projectile.velocity.X > 0f && projVector.X < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X -= acceleration; + if (Projectile.velocity.X > 0f && projVector.X < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < projVector.Y) + if (Projectile.velocity.Y < projVector.Y) { - projectile.velocity.Y += acceleration; - if (projectile.velocity.Y < 0f && projVector.Y > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y += acceleration; + if (Projectile.velocity.Y < 0f && projVector.Y > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > projVector.Y) + else if (Projectile.velocity.Y > projVector.Y) { - projectile.velocity.Y -= acceleration; - if (projectile.velocity.Y > 0f && projVector.Y < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y -= acceleration; + if (Projectile.velocity.Y > 0f && projVector.Y < 0f) + Projectile.velocity.Y -= acceleration; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); } - else if (projectile.ai[1] > 40f) + else if (Projectile.ai[1] > 40f) { - NPC closestTarget = projectile.Center.ClosestNPCAt(1769f, true, true); + NPC closestTarget = Projectile.Center.ClosestNPCAt(1769f, true, true); if (closestTarget != null) { - projectile.extraUpdates = 1; + Projectile.extraUpdates = 1; targetIndex = closestTarget.whoAmI; float inertia = 20f; - float homingVelocity = projectile.Calamity().stealthStrike ? 30f : 20f; - Vector2 moveDirection = projectile.SafeDirectionTo(closestTarget.Center, Vector2.UnitY); + float homingVelocity = Projectile.Calamity().stealthStrike ? 30f : 20f; + Vector2 moveDirection = Projectile.SafeDirectionTo(closestTarget.Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * inertia + moveDirection * homingVelocity) / (inertia + 1f); + Projectile.velocity = (Projectile.velocity * inertia + moveDirection * homingVelocity) / (inertia + 1f); } } else { - projectile.velocity *= 0.985f; + Projectile.velocity *= 0.985f; } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (projectile.ai[1] <= 40f && projectile.ai[0] != 1f) + if (Projectile.ai[1] <= 40f && Projectile.ai[0] != 1f) { damage /= 3; } @@ -135,21 +136,21 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (targetIndex == target.whoAmI) - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; target.AddBuff(ModContent.BuffType(), 180); - Main.PlaySound(SoundID.Item20, projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); for (int k = 0; k < 10; k++) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } public override void OnHitPvp(Player target, int damage, bool crit) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; target.AddBuff(ModContent.BuffType(), 180); - Main.PlaySound(SoundID.Item20, projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); for (int k = 0; k < 10; k++) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Rogue/TurbulanceProjectile.cs b/Projectiles/Rogue/TurbulanceProjectile.cs index 67fc92639f..d0e1c48248 100644 --- a/Projectiles/Rogue/TurbulanceProjectile.cs +++ b/Projectiles/Rogue/TurbulanceProjectile.cs @@ -13,42 +13,42 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Turbulance"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 20; - projectile.friendly = true; - projectile.timeLeft = 600; - projectile.extraUpdates = 2; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 2; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.tileCollide = false; } public override void AI() { - projectile.ai[0]++; - projectile.tileCollide = projectile.ai[0] >= 2f; + Projectile.ai[0]++; + Projectile.tileCollide = Projectile.ai[0] >= 2f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); } if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 16, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 16, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - if (projectile.Calamity().stealthStrike) //Stealth strike + if (Projectile.Calamity().stealthStrike) //Stealth strike { - if (projectile.timeLeft % 14 == 0) + if (Projectile.timeLeft % 14 == 0) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack / 2, projectile.owner, 1f, 1f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack / 2, Projectile.owner, 1f, 1f); } } } @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 10; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 50, new Color(53, Main.DiscoG, 255)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 50, new Color(53, Main.DiscoG, 255)); } } @@ -79,19 +79,19 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects(bool homeIn) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int w = 0; w < 4; w++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 3, projectile.knockBack / 3, Main.myPlayer, 0f, homeIn ? 1f : 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack / 3, Main.myPlayer, 0f, homeIn ? 1f : 0f); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/TurbulanceWindSlash.cs b/Projectiles/Rogue/TurbulanceWindSlash.cs index feef78d42b..296545a933 100644 --- a/Projectiles/Rogue/TurbulanceWindSlash.cs +++ b/Projectiles/Rogue/TurbulanceWindSlash.cs @@ -10,64 +10,64 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Wind Slash"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 0; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - projectile.timeLeft = 180; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 0; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.Calamity().rogue = true; + Projectile.timeLeft = 180; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.velocity *= 0.99f; - if (projectile.localAI[0] == 0f) + Projectile.velocity *= 0.99f; + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.005f; + Projectile.scale += 0.005f; } - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 30; + Projectile.alpha -= 30; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - projectile.frameCounter++; - if (projectile.frameCounter > 1) + Projectile.frameCounter++; + if (Projectile.frameCounter > 1) { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame >= 4) + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } } - if (projectile.ai[0] == 1f) //stealth strike + if (Projectile.ai[0] == 1f) //stealth strike { - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, projectile.ai[0] == 1f ? 900f : 450f, 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, Projectile.ai[0] == 1f ? 900f : 450f, 8f, 20f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); } } } diff --git a/Projectiles/Rogue/UmbraphileBoom.cs b/Projectiles/Rogue/UmbraphileBoom.cs index 0540edc568..29bcff299e 100644 --- a/Projectiles/Rogue/UmbraphileBoom.cs +++ b/Projectiles/Rogue/UmbraphileBoom.cs @@ -17,15 +17,15 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 60; - projectile.height = 60; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void Kill(int timeLeft) @@ -35,10 +35,10 @@ namespace CalamityMod.Projectiles.Rogue int dustType = Main.rand.NextBool() ? 246 : 176; float dustSpeed = Main.rand.NextFloat(3f, 9f); Vector2 dustVel = CalamityUtils.RandomVelocity(10f, dustSpeed, dustSpeed, 1f); - int boom = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1f); + int boom = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[boom]; dust.noGravity = true; - dust.position = projectile.Center; + dust.position = Projectile.Center; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity = dustVel; diff --git a/Projectiles/Rogue/UrchinStingerProj.cs b/Projectiles/Rogue/UrchinStingerProj.cs index 2d6605036f..4be178cb8e 100644 --- a/Projectiles/Rogue/UrchinStingerProj.cs +++ b/Projectiles/Rogue/UrchinStingerProj.cs @@ -20,39 +20,39 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.aiStyle = 2; - projectile.timeLeft = 600; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.aiStyle = 2; + Projectile.timeLeft = 600; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override bool PreAI() { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - projectile.StickyProjAI(15); - projectile.localAI[1]++; - if (projectile.localAI[1] <= 20f && projectile.ai[0] != 1f) + Projectile.StickyProjAI(15); + Projectile.localAI[1]++; + if (Projectile.localAI[1] <= 20f && Projectile.ai[0] != 1f) { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction; } - if (projectile.localAI[1] > 20f && projectile.ai[0] != 1f) + if (Projectile.localAI[1] > 20f && Projectile.ai[0] != 1f) { - projectile.velocity.Y += 0.4f; - projectile.velocity.X *= 0.97f; - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; - projectile.rotation += 0.2f * projectile.direction; + Projectile.velocity.Y += 0.4f; + Projectile.velocity.X *= 0.97f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + Projectile.rotation += 0.2f * Projectile.direction; } - if (projectile.localAI[0] % 40 == 0 && projectile.ai[0] == 1f) + if (Projectile.localAI[0] % 40 == 0 && Projectile.ai[0] == 1f) { Vector2 projspeed = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); - int proj = Projectile.NewProjectile(projectile.Center, projspeed, ModContent.ProjectileType(), (int)(projdmg * 0.5f), 1f, projectile.owner); + int proj = Projectile.NewProjectile(Projectile.Center, projspeed, ModContent.ProjectileType(), (int)(projdmg * 0.5f), 1f, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceRogue = true; } @@ -63,16 +63,16 @@ namespace CalamityMod.Projectiles.Rogue public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { - projdmg = projectile.damage; - projectile.ModifyHitNPCSticky(4, false); + projdmg = Projectile.damage; + Projectile.ModifyHitNPCSticky(4, false); } } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { if (targetHitbox.Width > 8 && targetHitbox.Height > 8) { @@ -95,8 +95,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } } diff --git a/Projectiles/Rogue/ValariBoomerang.cs b/Projectiles/Rogue/ValariBoomerang.cs index 6c0e4f79cb..536fcbfed3 100644 --- a/Projectiles/Rogue/ValariBoomerang.cs +++ b/Projectiles/Rogue/ValariBoomerang.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -23,18 +24,18 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 40; - projectile.height = 40; - projectile.penetrate = -1; - projectile.timeLeft = 360; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.width = 40; + Projectile.height = 40; + Projectile.penetrate = -1; + Projectile.timeLeft = 360; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.coldDamage = true; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() @@ -42,104 +43,104 @@ namespace CalamityMod.Projectiles.Rogue //Dust trail if (Main.rand.Next(5) == 0) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } //Constant rotation - projectile.rotation += 0.2f; + Projectile.rotation += 0.2f; timer++; //Constant sound effects - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 15; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 15; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } //Slopes REEEEEEEEEEEE if (timer == 3f) - projectile.tileCollide = true; + Projectile.tileCollide = true; //Decide the range of the boomerang depending on stealth - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) ReboundTime = 27f; else ReboundTime = 55f; // ai[0] stores whether the boomerang is returning. If 0, it isn't. If 1, it is. - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= ReboundTime) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= ReboundTime) { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } } else { - projectile.tileCollide = false; + Projectile.tileCollide = false; float returnSpeed = FrostcrushValari.Speed * 1.5f; float acceleration = 3.2f; - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; // Delete the boomerang if it's excessively far away. Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; + float xDist = playerCenter.X - Projectile.Center.X; + float yDist = playerCenter.Y - Projectile.Center.Y; float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); if (dist > 3000f) - projectile.Kill(); + Projectile.Kill(); dist = returnSpeed / dist; xDist *= dist; yDist *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) + if (Projectile.velocity.X < xDist) { - projectile.velocity.X += acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; + Projectile.velocity.X += acceleration; + if (Projectile.velocity.X < 0f && xDist > 0f) + Projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > xDist) + else if (Projectile.velocity.X > xDist) { - projectile.velocity.X -= acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; + Projectile.velocity.X -= acceleration; + if (Projectile.velocity.X > 0f && xDist < 0f) + Projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < yDist) + if (Projectile.velocity.Y < yDist) { - projectile.velocity.Y += acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; + Projectile.velocity.Y += acceleration; + if (Projectile.velocity.Y < 0f && yDist > 0f) + Projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > yDist) + else if (Projectile.velocity.Y > yDist) { - projectile.velocity.Y -= acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y -= acceleration; + if (Projectile.velocity.Y > 0f && yDist < 0f) + Projectile.velocity.Y -= acceleration; } // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); + if (Main.myPlayer == Projectile.owner) + if (Projectile.Hitbox.Intersects(owner.Hitbox)) + Projectile.Kill(); } } private void OnHitEffects() { //Start homing at player if you hit an enemy - projectile.ai[0] = 1; + Projectile.ai[0] = 1; int icicleAmt = Main.rand.Next(2, 4); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < icicleAmt; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(projectile.Center, velocity, Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner); + int shard = Projectile.NewProjectile(Projectile.Center, velocity, Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(), Projectile.damage / 3, 0f, Projectile.owner); } } } @@ -164,17 +165,17 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { //Bounce off tiles and start homing on player if it hits a tile - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); - if (projectile.velocity.X != oldVelocity.X) + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - projectile.ai[0] = 1; + Projectile.ai[0] = 1; return false; } } diff --git a/Projectiles/Rogue/Valaricicle.cs b/Projectiles/Rogue/Valaricicle.cs index a180a909e9..30810cfcbf 100644 --- a/Projectiles/Rogue/Valaricicle.cs +++ b/Projectiles/Rogue/Valaricicle.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -13,33 +14,33 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.aiStyle = 1; - projectile.coldDamage = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.aiStyle = 1; + Projectile.coldDamage = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y += 0.01f; + Projectile.velocity.X *= 0.9995f; + Projectile.velocity.Y += 0.01f; - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 8f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 8f, 20f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Rogue/Valaricicle2.cs b/Projectiles/Rogue/Valaricicle2.cs index 331d31c893..e2409786ac 100644 --- a/Projectiles/Rogue/Valaricicle2.cs +++ b/Projectiles/Rogue/Valaricicle2.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -13,33 +14,33 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.Calamity().rogue = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.aiStyle = 1; - projectile.coldDamage = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.Calamity().rogue = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.aiStyle = 1; + Projectile.coldDamage = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y += 0.01f; + Projectile.velocity.X *= 0.9995f; + Projectile.velocity.Y += 0.01f; - if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 8f, 20f); + if (Projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 8f, 20f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Rogue/ValedictionBoomerang.cs b/Projectiles/Rogue/ValedictionBoomerang.cs index 7c8bdd5c32..bb39d33277 100644 --- a/Projectiles/Rogue/ValedictionBoomerang.cs +++ b/Projectiles/Rogue/ValedictionBoomerang.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -15,106 +16,106 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Valediction"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 70; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.Calamity().rogue = true; + Projectile.width = Projectile.height = 70; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.Calamity().rogue = true; } public override void AI() { - Player player = Main.player[projectile.owner]; - if (projectile.soundDelay == 0) + Player player = Main.player[Projectile.owner]; + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); + Projectile.soundDelay = 8; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 60f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= 60f) { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } else { - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); } } else { float returnSpeed = 30f; float acceleration = 5f; - Vector2 projVector = player.Center - projectile.Center; + Vector2 projVector = player.Center - Projectile.Center; float playerDist = projVector.Length(); if (playerDist > 3000f) { - projectile.Kill(); + Projectile.Kill(); } playerDist = returnSpeed / playerDist; projVector.X *= playerDist; projVector.Y *= playerDist; - if (projectile.velocity.X < projVector.X) + if (Projectile.velocity.X < projVector.X) { - projectile.velocity.X += acceleration; - if (projectile.velocity.X < 0f && projVector.X > 0f) + Projectile.velocity.X += acceleration; + if (Projectile.velocity.X < 0f && projVector.X > 0f) { - projectile.velocity.X += acceleration; + Projectile.velocity.X += acceleration; } } - else if (projectile.velocity.X > projVector.X) + else if (Projectile.velocity.X > projVector.X) { - projectile.velocity.X -= acceleration; - if (projectile.velocity.X > 0f && projVector.X < 0f) + Projectile.velocity.X -= acceleration; + if (Projectile.velocity.X > 0f && projVector.X < 0f) { - projectile.velocity.X -= acceleration; + Projectile.velocity.X -= acceleration; } } - if (projectile.velocity.Y < projVector.Y) + if (Projectile.velocity.Y < projVector.Y) { - projectile.velocity.Y += acceleration; - if (projectile.velocity.Y < 0f && projVector.Y > 0f) + Projectile.velocity.Y += acceleration; + if (Projectile.velocity.Y < 0f && projVector.Y > 0f) { - projectile.velocity.Y += acceleration; + Projectile.velocity.Y += acceleration; } } - else if (projectile.velocity.Y > projVector.Y) + else if (Projectile.velocity.Y > projVector.Y) { - projectile.velocity.Y -= acceleration; - if (projectile.velocity.Y > 0f && projVector.Y < 0f) + Projectile.velocity.Y -= acceleration; + if (Projectile.velocity.Y > 0f && projVector.Y < 0f) { - projectile.velocity.Y -= acceleration; + Projectile.velocity.Y -= acceleration; } } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Rectangle projHitbox = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle projHitbox = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); Rectangle playerHitbox = new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height); if (projHitbox.Intersects(playerHitbox)) { - projectile.Kill(); + Projectile.Kill(); } } } - projectile.rotation += 0.5f; + Projectile.rotation += 0.5f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -133,10 +134,10 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects() { int typhoonAmt = 3; - int typhoonDamage = (int)(projectile.damage * 0.3f); - if (projectile.owner == Main.myPlayer && projectile.numHits < 1 && projectile.Calamity().stealthStrike) + int typhoonDamage = (int)(Projectile.damage * 0.3f); + if (Projectile.owner == Main.myPlayer && Projectile.numHits < 1 && Projectile.Calamity().stealthStrike) { - Main.PlaySound(SoundID.Item84, projectile.position); + SoundEngine.PlaySound(SoundID.Item84, Projectile.position); for (int typhoonCount = 0; typhoonCount < typhoonAmt; typhoonCount++) { Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); @@ -146,7 +147,7 @@ namespace CalamityMod.Projectiles.Rogue } velocity.Normalize(); velocity *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile typhoon = Projectile.NewProjectileDirect(projectile.Center, velocity, ModContent.ProjectileType(), typhoonDamage, 0f, projectile.owner); + Projectile typhoon = Projectile.NewProjectileDirect(Projectile.Center, velocity, ModContent.ProjectileType(), typhoonDamage, 0f, Projectile.owner); if (typhoon.whoAmI.WithinBounds(Main.maxProjectiles)) { typhoon.Calamity().forceRogue = true; @@ -159,13 +160,13 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item21, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 100; - projectile.Center = projectile.position; + SoundEngine.PlaySound(SoundID.Item21, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 100; + Projectile.Center = Projectile.position; for (int d = 0; d < 5; d++) { - int water = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); Main.dust[water].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -175,10 +176,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int d = 0; d < 8; d++) { - int water = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 3f); + int water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 3f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 5f; - water = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + water = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); Main.dust[water].velocity *= 2f; } } diff --git a/Projectiles/Rogue/VeneratedKnife.cs b/Projectiles/Rogue/VeneratedKnife.cs index f2d8b77e1b..7d0a2a9d64 100644 --- a/Projectiles/Rogue/VeneratedKnife.cs +++ b/Projectiles/Rogue/VeneratedKnife.cs @@ -13,35 +13,35 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Venerated Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = lifetime; - projectile.Calamity().rogue = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = lifetime; + Projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (projectile.timeLeft < lifetime - 5) + if (Projectile.timeLeft < lifetime - 5) { float minDist = 999f; int index = 0; for (int i = 0; i < Main.npc.Length; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < minDist) { minDist = dist; @@ -53,14 +53,14 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocityNew; if (minDist < 999f) { - velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew = Main.npc[index].Center - Projectile.Center; velocityNew.Normalize(); velocityNew *= 5f; - projectile.velocity += velocityNew; - if (projectile.velocity.Length() > 15f) + Projectile.velocity += velocityNew; + if (Projectile.velocity.Length() > 15f) { - projectile.velocity.Normalize(); - projectile.velocity *= 15f; + Projectile.velocity.Normalize(); + Projectile.velocity *= 15f; } } } @@ -69,15 +69,15 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - Texture2D knife1 = Main.projectileTexture[projectile.type]; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3, knife1); + Texture2D knife1 = Main.projectileTexture[Projectile.type]; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 3, knife1); } - else if (projectile.ai[0] == 1f) + else if (Projectile.ai[0] == 1f) { - Texture2D knife2 = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/VeneratedKnife2"); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3, knife2); + Texture2D knife2 = ModContent.Request("CalamityMod/Projectiles/Rogue/VeneratedKnife2"); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 3, knife2); } return false; } @@ -85,16 +85,16 @@ namespace CalamityMod.Projectiles.Rogue public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 origin = new Vector2(projectile.width / 2, projectile.height / 2); - if (projectile.ai[0] == 0f) + Vector2 origin = new Vector2(Projectile.width / 2, Projectile.height / 2); + if (Projectile.ai[0] == 0f) { - Texture2D knife1Glow = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/VeneratedKnifeGlow"); - spriteBatch.Draw(knife1Glow, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + Texture2D knife1Glow = ModContent.Request("CalamityMod/Projectiles/Rogue/VeneratedKnifeGlow"); + spriteBatch.Draw(knife1Glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); } - else if (projectile.ai[0] == 1f) + else if (Projectile.ai[0] == 1f) { - Texture2D knife2Glow = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/VeneratedKnife2Glow"); - spriteBatch.Draw(knife2Glow, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + Texture2D knife2Glow = ModContent.Request("CalamityMod/Projectiles/Rogue/VeneratedKnife2Glow"); + spriteBatch.Draw(knife2Glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); } } @@ -103,16 +103,16 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 5; i++) { int dustType = 0; - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { dustType = 111; } - else if (projectile.ai[0] == 1f) + else if (Projectile.ai[0] == 1f) { dustType = 112; } - int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, 0, 0, 0, default, 1.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0, 0, 0, default, 1.5f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Rogue/WebBallBol.cs b/Projectiles/Rogue/WebBallBol.cs index 81aeb2f3c8..f4fd3b5d5d 100644 --- a/Projectiles/Rogue/WebBallBol.cs +++ b/Projectiles/Rogue/WebBallBol.cs @@ -15,26 +15,26 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - projectile.aiStyle = 14; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; + Projectile.aiStyle = 14; } public override void AI() { if (Main.rand.NextBool(12)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 30, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 30, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { target.AddBuff(BuffID.Webbed, 120); } @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike) { target.AddBuff(BuffID.Webbed, 120); } diff --git a/Projectiles/Rogue/WrathwingCinder.cs b/Projectiles/Rogue/WrathwingCinder.cs index f7fabbe202..c810029b73 100644 --- a/Projectiles/Rogue/WrathwingCinder.cs +++ b/Projectiles/Rogue/WrathwingCinder.cs @@ -4,6 +4,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -14,69 +15,69 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Wrathwing Eruption"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 480; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.width = 34; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 480; + Projectile.Calamity().rogue = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.velocity.Y < 0f) + if (Projectile.velocity.Y < 0f) { - projectile.velocity.Y *= 0.97f; + Projectile.velocity.Y *= 0.97f; } else { - projectile.velocity.Y *= 1.03f; - if (projectile.velocity.Y > 16f) + Projectile.velocity.Y *= 1.03f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } - if (projectile.velocity.Y > -1f && projectile.localAI[1] == 0f) + if (Projectile.velocity.Y > -1f && Projectile.localAI[1] == 0f) { - projectile.localAI[1] = 1f; - projectile.velocity.Y = 1f; + Projectile.localAI[1] = 1f; + Projectile.velocity.Y = 1f; } - projectile.velocity.X *= 0.995f; - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.velocity.X *= 0.995f; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; // commented out sound because it was way too loud /* @@ -87,44 +88,44 @@ namespace CalamityMod.Projectiles.Rogue } */ - if (projectile.ai[0] >= 2f) + if (Projectile.ai[0] >= 2f) { - projectile.alpha -= 25; - if (projectile.alpha < 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } if (Main.rand.NextBool(16)) { - Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 200, default, 1f); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 200, default, 1f); dust.scale *= 0.7f; - dust.velocity += projectile.velocity * 0.25f; + dust.velocity += Projectile.velocity * 0.25f; } } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 14, 0.5f, 0f); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 144); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 14, 0.5f, 0f); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 144); for (int d = 0; d < 2; d++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1.5f); } for (int d = 0; d < 20; d++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 0, default, 2.5f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 0, default, 2.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 3f; - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.5f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 100, default, 1.5f); Main.dust[idx].velocity *= 2f; Main.dust[idx].noGravity = true; } diff --git a/Projectiles/Rogue/WrathwingFireball.cs b/Projectiles/Rogue/WrathwingFireball.cs index 88c7012af2..5f8a65974b 100644 --- a/Projectiles/Rogue/WrathwingFireball.cs +++ b/Projectiles/Rogue/WrathwingFireball.cs @@ -11,69 +11,69 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Wrathwing Fireball"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.aiStyle = 1; + Projectile.width = 34; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.aiStyle = 1; aiType = ProjectileID.DD2BetsyFireball; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override void AI() { // Cancel out the first ten frames of Betsy fireball gravity, and half of all gravity thereafter - projectile.velocity.Y -= 0.1f; + Projectile.velocity.Y -= 0.1f; // Animation - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; // Keep the fireball rotated the correct way because the sheet faces down, not up - projectile.rotation += MathHelper.Pi; + Projectile.rotation += MathHelper.Pi; } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int frameY = frameHeight * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int frameY = frameHeight * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; if (CalamityConfig.Instance.Afterimages) { - for (int i = 0; i < projectile.oldPos.Length; i++) + for (int i = 0; i < Projectile.oldPos.Length; i++) { - Vector2 drawPos = projectile.oldPos[i] + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - Color color2 = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), color2, projectile.rotation, rectangle.Size() / 2f, projectile.scale, spriteEffects, 0f); + Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color color2 = Projectile.GetAlpha(lightColor) * ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), color2, Projectile.rotation, rectangle.Size() / 2f, Projectile.scale, spriteEffects, 0f); } } - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, texture.Width, frameHeight)), - projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); + Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, spriteEffects, 0f); return false; } @@ -81,24 +81,24 @@ namespace CalamityMod.Projectiles.Rogue // Expand hitbox and explode on hit. public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 144); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 144); // Allow infinite piercing and ignoring iframes for this one extra AoE hit - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.Damage(); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Damage(); for (int i = 0; i < 2; i++) - Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 50, default, 1.5f); for (int i = 0; i < 20; i++) { - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 0, default, 2.5f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 0, default, 2.5f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 3f; - d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 50, default, 1.5f); + d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 50, default, 1.5f); Main.dust[d].velocity *= 2f; Main.dust[d].noGravity = true; } diff --git a/Projectiles/Rogue/WrathwingSpear.cs b/Projectiles/Rogue/WrathwingSpear.cs index 6181fa17fb..f8e4f32bb9 100644 --- a/Projectiles/Rogue/WrathwingSpear.cs +++ b/Projectiles/Rogue/WrathwingSpear.cs @@ -13,76 +13,76 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Wrathwing"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 62; - projectile.height = 62; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + Projectile.width = 62; + Projectile.height = 62; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().rogue = true; } public override void AI() { // Spit fireballs constantly, but slightly randomly. Always spits one fireball immediately upon being thrown. - if (projectile.owner == Main.myPlayer && projectile.ai[0] <= 0f) + if (Projectile.owner == Main.myPlayer && Projectile.ai[0] <= 0f) { - projectile.ai[0] = Main.rand.NextFloat(15f, 19f); + Projectile.ai[0] = Main.rand.NextFloat(15f, 19f); int fireballID = ModContent.ProjectileType(); - int damage = (int)(projectile.damage * 0.8f); + int damage = (int)(Projectile.damage * 0.8f); float angleDiff = Main.rand.NextFloat(-FireballAngleVariance, FireballAngleVariance); - Vector2 velocity = projectile.velocity.RotatedBy(angleDiff) * 1.06f; - float kb = projectile.knockBack * 0.6f; - Projectile.NewProjectile(projectile.Center, velocity, fireballID, damage, kb, projectile.owner); + Vector2 velocity = Projectile.velocity.RotatedBy(angleDiff) * 1.06f; + float kb = Projectile.knockBack * 0.6f; + Projectile.NewProjectile(Projectile.Center, velocity, fireballID, damage, kb, Projectile.owner); } - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; // Homing // The item's default velocity is 28. Homing speed is intentionally a bit lower. - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 450f, 23f, 30f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 450f, 23f, 30f); // Animation - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) - projectile.frame = 0; + if (Projectile.frame > 3) + Projectile.frame = 0; // Rotation - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; } public override void Kill(int timeLeft) { // Stealth strikes create an eruption on hit. - if (projectile.owner == Main.myPlayer && projectile.Calamity().stealthStrike) + if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) { int eruptionID = ModContent.ProjectileType(); - int damage = (int)(projectile.damage * 0.375f); + int damage = (int)(Projectile.damage * 0.375f); float kb = 0f; // Spawns 13 erupting fireballs in total. for (int x = -6; x <= 6; x++) { - Vector2 pos = projectile.Center + Vector2.UnitY * Main.rand.NextFloat(44f, 60f); + Vector2 pos = Projectile.Center + Vector2.UnitY * Main.rand.NextFloat(44f, 60f); pos.X += Main.rand.NextFloat(-14f, 14f); float ySpeed = x % 2 == 0 ? -13f : -19f; ySpeed *= Main.rand.NextFloat(0.85f, 1.05f); Vector2 velocity = new Vector2(x, ySpeed); - Projectile.NewProjectile(pos, velocity, eruptionID, damage, kb, projectile.owner); + Projectile.NewProjectile(pos, velocity, eruptionID, damage, kb, Projectile.owner); } } @@ -90,14 +90,14 @@ namespace CalamityMod.Projectiles.Rogue for (int k = 0; k < 36; k++) { float scale = Main.rand.NextFloat(1.4f, 1.8f); - Vector2 corner = projectile.Center - Vector2.One * 2f; + Vector2 corner = Projectile.Center - Vector2.One * 2f; int dustID = Dust.NewDust(corner, 4, 4, DustID.CopperCoin); Main.dust[dustID].noGravity = false; Main.dust[dustID].scale = scale; float angleDeviation = 0.25f; float angle = Main.rand.NextFloat(-angleDeviation, angleDeviation); float velMult = Main.rand.NextFloat(0.08f, 0.14f); - Vector2 shrapnelVelocity = projectile.velocity.RotatedBy(angle) * velMult; + Vector2 shrapnelVelocity = Projectile.velocity.RotatedBy(angle) * velMult; Main.dust[dustID].velocity = shrapnelVelocity; } } @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/WulfrumKnifeProj.cs b/Projectiles/Rogue/WulfrumKnifeProj.cs index 3c71ca9ff6..a24e64341d 100644 --- a/Projectiles/Rogue/WulfrumKnifeProj.cs +++ b/Projectiles/Rogue/WulfrumKnifeProj.cs @@ -17,20 +17,20 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.aiStyle = 2; - projectile.timeLeft = 600; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.aiStyle = 2; + Projectile.timeLeft = 600; aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(2)) { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + Item.NewItem((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } } diff --git a/Projectiles/Summon/AndromedaDeathRay.cs b/Projectiles/Summon/AndromedaDeathRay.cs index 129ec11556..d336e5eafe 100644 --- a/Projectiles/Summon/AndromedaDeathRay.cs +++ b/Projectiles/Summon/AndromedaDeathRay.cs @@ -21,20 +21,20 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = TrueTimeLeft; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + Projectile.width = 18; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = TrueTimeLeft; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; } // Netcode for sending and receiving shit @@ -42,60 +42,60 @@ namespace CalamityMod.Projectiles.Summon public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); writer.Write(AngularMultiplier); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); AngularMultiplier = reader.ReadSingle(); } public override void AI() { - Projectile owner = Main.projectile[(int)projectile.ai[0]]; - Player player = Main.player[projectile.owner]; + Projectile owner = Main.projectile[(int)Projectile.ai[0]]; + Player player = Main.player[Projectile.owner]; if (owner.type != ModContent.ProjectileType() || !owner.active) - projectile.Kill(); + Projectile.Kill(); if (owner.active) { - projectile.Center = player.Center + new Vector2(owner.spriteDirection == 1 ? 48f : 22f, -28f); + Projectile.Center = player.Center + new Vector2(owner.spriteDirection == 1 ? 48f : 22f, -28f); if (player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot) { - projectile.Center = player.Center + new Vector2(owner.spriteDirection == 1 ? 24f : 2f, 0f); + Projectile.Center = player.Center + new Vector2(owner.spriteDirection == 1 ? 24f : 2f, 0f); } } // How fat the laser is - float laserSize = 0.6f + (float)Math.Sin(projectile.localAI[0] / 7f) * 0.025f; // The sine gives a pulsating effect to the laser + float laserSize = 0.6f + (float)Math.Sin(Projectile.localAI[0] / 7f) * 0.025f; // The sine gives a pulsating effect to the laser - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= TrueTimeLeft) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= TrueTimeLeft) { - projectile.Kill(); + Projectile.Kill(); return; } // Causes the effect where the laser appears to expand/contract at the beginning and end of its life - projectile.scale = (float)Math.Sin(projectile.localAI[0] * MathHelper.Pi / TrueTimeLeft) * 5f * laserSize; - if (projectile.scale > laserSize) + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * MathHelper.Pi / TrueTimeLeft) * 5f * laserSize; + if (Projectile.scale > laserSize) { - projectile.scale = laserSize; + Projectile.scale = laserSize; } - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; // Generate dust form the beginning of the ray, giving an illusion of electricity escaping the laser cannon. if (!Main.dedServ) { for (int i = 0; i < 4; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, 133); - dust.velocity = projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(2f, 3.5f) + Main.player[projectile.owner].velocity * 1.5f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, 133); + dust.velocity = Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(2f, 3.5f) + Main.player[Projectile.owner].velocity * 1.5f; dust.fadeIn = Main.rand.NextFloat(0.6f, 0.85f); if (player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot) { @@ -106,26 +106,26 @@ namespace CalamityMod.Projectiles.Summon } } - Vector2 samplingPoint = projectile.Center; + Vector2 samplingPoint = Projectile.Center; float[] samples = new float[3]; float determinedLength = 0f; - Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, maximumLength, samples); + Collision.LaserScan(samplingPoint, Projectile.velocity, Projectile.width * Projectile.scale, maximumLength, samples); for (int i = 0; i < samples.Length; i++) { determinedLength += samples[i]; } determinedLength /= samples.Length; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], determinedLength, 0.5f); - Vector2 beamEndPosiiton = projectile.Center + projectile.velocity * projectile.localAI[1]; + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], determinedLength, 0.5f); + Vector2 beamEndPosiiton = Projectile.Center + Projectile.velocity * Projectile.localAI[1]; // Dust at the end of the beam, if there's a tile there. if (Collision.SolidCollision(beamEndPosiiton, 16, 16) && !Main.dedServ) { if (AngularMultiplier == 0f) AngularMultiplier = Main.rand.NextFloat(1f, 4f); - float angle = projectile.localAI[0] / 18f; + float angle = Projectile.localAI[0] / 18f; float x = (float)Math.Sin(angle * AngularMultiplier) * (float)Math.Cos(angle); float y = (float)Math.Cos(angle * AngularMultiplier) * (float)Math.Sin(angle); Vector2 velocity = new Vector2(x * 4.5f, y * 2f); @@ -141,30 +141,30 @@ namespace CalamityMod.Projectiles.Summon // Draw light blue light across the laser DelegateMethods.v3_1 = Color.SkyBlue.ToVector3(); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) { return false; } - Texture2D laserTailTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AndromedaDeathrayBegin"); - Texture2D laserBodyTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AndromedaDeathrayMid"); - Texture2D laserHeadTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AndromedaDeathrayEnd"); - float laserLength = projectile.localAI[1]; + Texture2D laserTailTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/AndromedaDeathrayBegin"); + Texture2D laserBodyTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/AndromedaDeathrayMid"); + Texture2D laserHeadTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/AndromedaDeathrayEnd"); + float laserLength = Projectile.localAI[1]; Color drawColor = new Color(1f, 1f, 1f) * 0.9f; // Laser tail logic - Main.spriteBatch.Draw(laserTailTexture, projectile.Center - Main.screenPosition, null, drawColor, projectile.rotation, laserTailTexture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(laserTailTexture, Projectile.Center - Main.screenPosition, null, drawColor, Projectile.rotation, laserTailTexture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); // Laser body logic - laserLength -= (laserTailTexture.Height / 2 + laserHeadTexture.Height) * projectile.scale; - Vector2 centerDelta = projectile.Center; - centerDelta += projectile.velocity * projectile.scale * laserTailTexture.Height / 2f; + laserLength -= (laserTailTexture.Height / 2 + laserHeadTexture.Height) * Projectile.scale; + Vector2 centerDelta = Projectile.Center; + centerDelta += Projectile.velocity * Projectile.scale * laserTailTexture.Height / 2f; if (laserLength > 0f) { float laserLengthDelta = 0f; @@ -175,9 +175,9 @@ namespace CalamityMod.Projectiles.Summon { sourceRectangle.Height = (int)(laserLength - laserLengthDelta); } - Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); - laserLengthDelta += sourceRectangle.Height * projectile.scale; - centerDelta += projectile.velocity * sourceRectangle.Height * projectile.scale; + Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, Projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), Projectile.scale, SpriteEffects.None, 0f); + laserLengthDelta += sourceRectangle.Height * Projectile.scale; + centerDelta += Projectile.velocity * sourceRectangle.Height * Projectile.scale; sourceRectangle.Y += 16; if (sourceRectangle.Y + sourceRectangle.Height > laserBodyTexture.Height) { @@ -188,15 +188,15 @@ namespace CalamityMod.Projectiles.Summon // Laser head logic - Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, projectile.rotation, laserHeadTexture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, Projectile.rotation, laserHeadTexture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Projectile.localAI[1], (float)Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -206,7 +206,7 @@ namespace CalamityMod.Projectiles.Summon return true; } float value = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref value)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref value)) { return true; } diff --git a/Projectiles/Summon/AndromedaRegislash.cs b/Projectiles/Summon/AndromedaRegislash.cs index a40f89821a..ec0eb71608 100644 --- a/Projectiles/Summon/AndromedaRegislash.cs +++ b/Projectiles/Summon/AndromedaRegislash.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class AndromedaRegislash : ModProjectile @@ -11,73 +12,73 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Regislash"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 582; - projectile.height = 304; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.light = 3f; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + Projectile.width = 582; + Projectile.height = 304; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.light = 3f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; } public override void AI() { - Player player = Main.player[projectile.owner]; - if (projectile.localAI[0] == 0f) + Player player = Main.player[Projectile.owner]; + if (Projectile.localAI[0] == 0f) { - if (CalamityUtils.CountProjectiles(projectile.type) > 1) + if (CalamityUtils.CountProjectiles(Projectile.type) > 1) { - projectile.Kill(); + Projectile.Kill(); return; } - Main.PlaySound(SoundID.DD2_DrakinShot, projectile.Center); - projectile.rotation = projectile.AngleTo(Main.MouseWorld); - projectile.localAI[0] = 1f; + SoundEngine.PlaySound(SoundID.DD2_DrakinShot, Projectile.Center); + Projectile.rotation = Projectile.AngleTo(Main.MouseWorld); + Projectile.localAI[0] = 1f; } - projectile.position = player.Center - projectile.Size / 2f; - if (Math.Abs(Math.Cos(projectile.rotation)) > 0.675f) + Projectile.position = player.Center - Projectile.Size / 2f; + if (Math.Abs(Math.Cos(Projectile.rotation)) > 0.675f) { - projectile.position.X += Math.Sign(Math.Cos(projectile.rotation)) * 295f; + Projectile.position.X += Math.Sign(Math.Cos(Projectile.rotation)) * 295f; } - projectile.position.Y += (float)Math.Sin(projectile.rotation) * 325f; - projectile.frameCounter++; - if (projectile.frameCounter % 7 == 6) + Projectile.position.Y += (float)Math.Sin(Projectile.rotation) * 325f; + Projectile.frameCounter++; + if (Projectile.frameCounter % 7 == 6) { - projectile.frame++; + Projectile.frame++; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.Kill(); + Projectile.Kill(); } - projectile.direction = ((player.Center.X - projectile.Center.X) < 0).ToDirectionInt(); - projectile.spriteDirection = projectile.direction; + Projectile.direction = ((player.Center.X - Projectile.Center.X) < 0).ToDirectionInt(); + Projectile.spriteDirection = Projectile.direction; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Vector2 startPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int frameY = frameHeight * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Vector2 startPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int frameY = frameHeight * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); Vector2 origin = rectangle.Size() / 2f; - float rotation = projectile.rotation; - float scale = projectile.scale; + float rotation = Projectile.rotation; + float scale = Projectile.scale; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipVertically; - Main.spriteBatch.Draw(texture, startPos, rectangle, projectile.GetAlpha(lightColor), rotation, origin, scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, startPos, rectangle, Projectile.GetAlpha(lightColor), rotation, origin, scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs b/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs index 6c2ebda104..f1b92d6036 100644 --- a/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs +++ b/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using System.IO; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon.AndromedaUI { @@ -14,7 +15,7 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI public static readonly Vector2 LeftBracketOffset = new Vector2(-8f, -6f); public static readonly Vector2 RightBracketOffset = new Vector2(8f, -6f); public static readonly Vector2 TopBracketOffset = new Vector2(2f, 27f); - public GiantIbanRobotOfDoom AttachedRobot => (GiantIbanRobotOfDoom)Main.projectile[(int)projectile.localAI[0]].modProjectile; + public GiantIbanRobotOfDoom AttachedRobot => (GiantIbanRobotOfDoom)Main.projectile[(int)Projectile.localAI[0]].modProjectile; // These properties are here to mitigate the need for typing out long and cumbersome slews of the same code to access the robot's variables. @@ -62,24 +63,24 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI public override void SetDefaults() { - projectile.width = 62; - projectile.height = 58; - projectile.ignoreWater = true; - projectile.timeLeft = 36000; - projectile.tileCollide = false; - projectile.friendly = true; + Projectile.width = 62; + Projectile.height = 58; + Projectile.ignoreWater = true; + Projectile.timeLeft = 36000; + Projectile.tileCollide = false; + Projectile.friendly = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(FadeoutTime); - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { FadeoutTime = reader.ReadInt32(); - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override void AI() @@ -87,53 +88,53 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI // Death fade-out effect if (FadeoutTime > 0) { - projectile.alpha = (int)MathHelper.Lerp(0f, 255f, 1f - FadeoutTime / (float)FadeoutTimeMax); + Projectile.alpha = (int)MathHelper.Lerp(0f, 255f, 1f - FadeoutTime / (float)FadeoutTimeMax); FadeoutTime--; } else if (FadeoutTime == 0) { - projectile.Kill(); + Projectile.Kill(); } // Kill the UI immediately if there is no robot, and halt the AI - if (Main.projectile[(int)projectile.localAI[0]].type != ModContent.ProjectileType() || - !Main.projectile[(int)projectile.localAI[0]].active) + if (Main.projectile[(int)Projectile.localAI[0]].type != ModContent.ProjectileType() || + !Main.projectile[(int)Projectile.localAI[0]].active) { - projectile.Kill(); + Projectile.Kill(); return; } // Fade-in effect - projectile.localAI[1]++; - if (projectile.localAI[1] < 40f) + Projectile.localAI[1]++; + if (Projectile.localAI[1] < 40f) { - projectile.alpha = (int)MathHelper.Lerp(255f, 0f, projectile.localAI[1] / 40f); + Projectile.alpha = (int)MathHelper.Lerp(255f, 0f, Projectile.localAI[1] / 40f); } // Adjust the position of the UI. - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { if (PlayerOffset == Vector2.Zero) { - PlayerOffset = Main.player[projectile.owner].Center - projectile.Center; + PlayerOffset = Main.player[Projectile.owner].Center - Projectile.Center; } - projectile.Center = Main.player[projectile.owner].Center - PlayerOffset; + Projectile.Center = Main.player[Projectile.owner].Center - PlayerOffset; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { // Should be invisible for players that do not control the UI - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { // Draw the background UI - spriteBatch.Draw(ModContent.GetTexture(Texture), - projectile.Center - Main.screenPosition, + spriteBatch.Draw(ModContent.Request(Texture), + Projectile.Center - Main.screenPosition, null, - Color.White * projectile.Opacity, + Color.White * Projectile.Opacity, 0f, - projectile.Size * 0.5f, - projectile.scale, + Projectile.Size * 0.5f, + Projectile.scale, SpriteEffects.None, 0f); DrawBrackets(spriteBatch); @@ -153,17 +154,17 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI public void DrawBrackets(SpriteBatch spriteBatch) { - Texture2D leftBracketTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/LeftBracket" + (LeftBracketActive ? "Lit" : "")); - Texture2D leftBracketTextureHovered = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/LeftBracketHovered"); + Texture2D leftBracketTexture = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/LeftBracket" + (LeftBracketActive ? "Lit" : "")); + Texture2D leftBracketTextureHovered = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/LeftBracketHovered"); - Texture2D rightBracketTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/RightBracket" + (RightBracketActive ? "Lit" : "")); - Texture2D rightBracketTextureHovered = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/RightBracketHovered"); + Texture2D rightBracketTexture = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/RightBracket" + (RightBracketActive ? "Lit" : "")); + Texture2D rightBracketTextureHovered = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/RightBracketHovered"); - Texture2D topBracketTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/TopBracket" + (BottomBracketActive ? "Lit" : "")); - Texture2D topBracketTextureHovered = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/TopBracketHovered"); + Texture2D topBracketTexture = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/TopBracket" + (BottomBracketActive ? "Lit" : "")); + Texture2D topBracketTextureHovered = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/TopBracketHovered"); // Top bracket - Vector2 topBracketPosition = projectile.Bottom + TopBracketOffset; + Vector2 topBracketPosition = Projectile.Bottom + TopBracketOffset; Rectangle topBracketFrame = new Rectangle((int)topBracketPosition.X - topBracketTexture.Width / 2, (int)topBracketPosition.Y - 24, topBracketTexture.Width - 18, topBracketTexture.Height - 12); @@ -172,15 +173,15 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI spriteBatch.Draw(topBracketSelect ? topBracketTextureHovered : topBracketTexture, topBracketPosition - Main.screenPosition, null, - Color.White * projectile.Opacity, + Color.White * Projectile.Opacity, 0f, - projectile.Size * 0.5f, - projectile.scale, + Projectile.Size * 0.5f, + Projectile.scale, SpriteEffects.None, 0f); // Left bracket - Vector2 leftBracketPosition = projectile.Center + LeftBracketOffset; + Vector2 leftBracketPosition = Projectile.Center + LeftBracketOffset; Rectangle leftBracketFrame = new Rectangle((int)leftBracketPosition.X - leftBracketTexture.Width / 2, (int)leftBracketPosition.Y - 24, leftBracketTexture.Width - 12, leftBracketTexture.Height - 18); @@ -189,15 +190,15 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI spriteBatch.Draw(leftBracketSelect ? leftBracketTextureHovered : leftBracketTexture, leftBracketPosition - Main.screenPosition, null, - Color.White * projectile.Opacity, + Color.White * Projectile.Opacity, 0f, - projectile.Size * 0.5f, - projectile.scale, + Projectile.Size * 0.5f, + Projectile.scale, SpriteEffects.None, 0f); // Right bracket - Vector2 rightBracketPosition = projectile.Center + RightBracketOffset + (projectile.width / 2 - 1) * Vector2.UnitX; + Vector2 rightBracketPosition = Projectile.Center + RightBracketOffset + (Projectile.width / 2 - 1) * Vector2.UnitX; Rectangle rightBracketFrame = new Rectangle((int)rightBracketPosition.X - rightBracketTexture.Width / 2, (int)rightBracketPosition.Y - 24, rightBracketTexture.Width - 12, rightBracketTexture.Height - 18); @@ -206,17 +207,17 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI spriteBatch.Draw(rightBracketSelect ? rightBracketTextureHovered : rightBracketTexture, rightBracketPosition - Main.screenPosition, null, - Color.White * projectile.Opacity, + Color.White * Projectile.Opacity, 0f, - projectile.Size * 0.5f, - projectile.scale, + Projectile.Size * 0.5f, + Projectile.scale, SpriteEffects.None, 0f); if (leftBracketSelect || rightBracketSelect || topBracketSelect) { Main.blockMouse = true; - if (Main.mouseLeft && Main.projectile[(int)projectile.localAI[0]].ai[0] <= 0f) + if (Main.mouseLeft && Main.projectile[(int)Projectile.localAI[0]].ai[0] <= 0f) { if (leftBracketSelect) { @@ -235,7 +236,7 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI LeftBracketActive = RightBracketActive = false; TopIconActive = false; } - Main.projectile[(int)projectile.localAI[0]].ai[0] = 30f; + Main.projectile[(int)Projectile.localAI[0]].ai[0] = 30f; } } } @@ -255,14 +256,14 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI public void DrawLeftIcon(SpriteBatch spriteBatch) { // Define icons to draw - Texture2D smallIndicator = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/SmallIcon"); - Texture2D smallIndicatorLocked = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/Lock"); + Texture2D smallIndicator = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/SmallIcon"); + Texture2D smallIndicatorLocked = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/Lock"); Texture2D textureToDraw = smallIndicator; // An offset is required for said icons, as they have difference sizes. Don't touch them unless the sprites are modified. // Bless whoever is tasked's soul if they are indeed changed Vector2 iconOffset = new Vector2(2f, 28f); - Vector2 drawPosition = projectile.Center + iconOffset; + Vector2 drawPosition = Projectile.Center + iconOffset; bool eitherBracketActive = LeftBracketActive || BottomBracketActive; @@ -271,7 +272,7 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI { textureToDraw = smallIndicatorLocked; iconOffset = new Vector2(7f, 30f); - drawPosition = projectile.Center + iconOffset; + drawPosition = Projectile.Center + iconOffset; } bool wasActive = LeftIconActive; LeftIconActive = textureToDraw == smallIndicator; // In simpler terms, LeftIconActive = Whether the robot is small vs if it's big. @@ -280,7 +281,7 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI { if (!Main.dedServ) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; for (int i = 0; i < 45; i++) { Dust dust = Dust.NewDustPerfect(player.Center + Utils.NextVector2Circular(Main.rand, 60f, 90f), 26); @@ -298,10 +299,10 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI spriteBatch.Draw(textureToDraw, drawPosition - Main.screenPosition, null, - Color.White * projectile.Opacity, + Color.White * Projectile.Opacity, 0f, - projectile.Size * 0.5f, - projectile.scale, + Projectile.Size * 0.5f, + Projectile.scale, SpriteEffects.None, 0f); } @@ -309,10 +310,10 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI public void DrawRightIcon(SpriteBatch spriteBatch) { // Define icons to draw - Texture2D thunderIndicator = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/ThunderIcon"); - Texture2D thunderIndicatorHovered = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/ThunderIconHovered"); - Texture2D thunderIndicatorCharge = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/ThunderIconCharge"); - Texture2D thunderIndicatorLocked = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/Lock"); + Texture2D thunderIndicator = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/ThunderIcon"); + Texture2D thunderIndicatorHovered = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/ThunderIconHovered"); + Texture2D thunderIndicatorCharge = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/ThunderIconCharge"); + Texture2D thunderIndicatorLocked = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/Lock"); Texture2D textureToDraw = thunderIndicatorLocked; // An offset is required for said icons, as they have difference sizes. Don't touch them unless the sprites are modified. @@ -333,7 +334,7 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI iconOffset = new Vector2(36f, 30f); } - drawPosition = projectile.Center + iconOffset; + drawPosition = Projectile.Center + iconOffset; // Otherwise do mouse click/hover checks, and, assuming the cooldown is at 0, perform the special attack and restart the cooldown. if (textureToDraw != thunderIndicatorLocked && RightIconCooldown <= 0) @@ -347,47 +348,47 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI textureToDraw = thunderIndicatorHovered; // Prevent clicking affecting other things. For example, disallow weapon firing. Main.blockMouse = true; - if (Main.mouseLeft && Main.projectile[(int)projectile.localAI[0]].ai[0] <= 0f) + if (Main.mouseLeft && Main.projectile[(int)Projectile.localAI[0]].ai[0] <= 0f) { FadeoutTime = FadeoutTimeMax; RightIconCooldown = GiantIbanRobotOfDoom.RightIconCooldownMax; // A cooldown value. This ensures that the game will not register another click // one frame after the first one. - Main.projectile[(int)projectile.localAI[0]].ai[0] = 30f; + Main.projectile[(int)Projectile.localAI[0]].ai[0] = 30f; // Explosion effect if (!Main.dedServ) { for (int i = 0; i < 80; i++) { - Dust dust = Dust.NewDustPerfect(Main.projectile[(int)projectile.localAI[0]].Center, Utils.SelectRandom(Main.rand, 226, 263)); + Dust dust = Dust.NewDustPerfect(Main.projectile[(int)Projectile.localAI[0]].Center, Utils.SelectRandom(Main.rand, 226, 263)); dust.velocity = Main.rand.NextVector2Circular(14f, 14f); dust.fadeIn = 1.1f; dust.noGravity = true; } } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), Projectile.Center); } } } // And finally draw the cooldown texture + the icon float chargeCompletionRatio = 1f - (RightIconCooldown / (float)GiantIbanRobotOfDoom.RightIconCooldownMax); spriteBatch.Draw(thunderIndicatorCharge, - projectile.Center + new Vector2(34f, 30f) - Main.screenPosition, + Projectile.Center + new Vector2(34f, 30f) - Main.screenPosition, new Rectangle(0, 0, thunderIndicatorCharge.Width, (int)(chargeCompletionRatio * thunderIndicatorCharge.Height)), // Fill up vertically - Color.White * projectile.Opacity, + Color.White * Projectile.Opacity, 0f, - projectile.Size * 0.5f, - projectile.scale, + Projectile.Size * 0.5f, + Projectile.scale, SpriteEffects.None, 0f); spriteBatch.Draw(textureToDraw, drawPosition - Main.screenPosition, null, - Color.White * projectile.Opacity, + Color.White * Projectile.Opacity, 0f, - projectile.Size * 0.5f, - projectile.scale, + Projectile.Size * 0.5f, + Projectile.scale, SpriteEffects.None, 1f); } @@ -395,17 +396,17 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI public void DrawTopIcon(SpriteBatch spriteBatch) { // Define icons to draw - Texture2D meleeIndicator = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/MeleeIcon"); - Texture2D rangedIndicator = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/RangedIcon"); - Texture2D attackIndicatorLocked = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/Lock"); - Texture2D meleeIndicatorHovered = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/MeleeIconHovered"); - Texture2D rangedIndicatorHovered = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/RangedIconHovered"); + Texture2D meleeIndicator = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/MeleeIcon"); + Texture2D rangedIndicator = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/RangedIcon"); + Texture2D attackIndicatorLocked = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/Lock"); + Texture2D meleeIndicatorHovered = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/MeleeIconHovered"); + Texture2D rangedIndicatorHovered = ModContent.Request("CalamityMod/Projectiles/Summon/AndromedaUI/RangedIconHovered"); Texture2D textureToDraw = TopIconActive ? meleeIndicator : rangedIndicator; // An offset is required for said icons, as they have difference sizes. Don't touch them unless the sprites are modified. // Bless whoever is tasked's soul if they are indeed changed Vector2 iconOffset = new Vector2(22f, 8f); - Vector2 drawPosition = projectile.Center + iconOffset; + Vector2 drawPosition = Projectile.Center + iconOffset; bool eitherBracketActive = LeftBracketActive || RightBracketActive; @@ -414,7 +415,7 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI { textureToDraw = attackIndicatorLocked; iconOffset = new Vector2(22f, 6f); - drawPosition = projectile.Center + iconOffset; + drawPosition = Projectile.Center + iconOffset; } // Otherwise do mouse click/hover checks, and, assuming the cooldown is at 0, perform the special attack and restart the cooldown. else if (eitherBracketActive) @@ -427,12 +428,12 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI textureToDraw = TopIconActive ? meleeIndicatorHovered : rangedIndicatorHovered; // Prevent clicking affecting other things. For example, disallow weapon firing. Main.blockMouse = true; - if (Main.mouseLeft && Main.projectile[(int)projectile.localAI[0]].ai[0] <= 0f) + if (Main.mouseLeft && Main.projectile[(int)Projectile.localAI[0]].ai[0] <= 0f) { TopIconActive = !TopIconActive; // A cooldown value. This ensures that the game will not register another click // one frame after the first one. - Main.projectile[(int)projectile.localAI[0]].ai[0] = 30f; + Main.projectile[(int)Projectile.localAI[0]].ai[0] = 30f; } } } @@ -440,10 +441,10 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI spriteBatch.Draw(textureToDraw, drawPosition - Main.screenPosition, null, - Color.White * projectile.Opacity, + Color.White * Projectile.Opacity, 0f, - projectile.Size * 0.5f, - projectile.scale, + Projectile.Size * 0.5f, + Projectile.scale, SpriteEffects.None, 0f); } diff --git a/Projectiles/Summon/AngelBolt.cs b/Projectiles/Summon/AngelBolt.cs index 56c16d7570..2903c58cd7 100644 --- a/Projectiles/Summon/AngelBolt.cs +++ b/Projectiles/Summon/AngelBolt.cs @@ -13,27 +13,27 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 200; - projectile.friendly = true; - projectile.timeLeft = 45; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.extraUpdates = 200; + Projectile.friendly = true; + Projectile.timeLeft = 45; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; } public override void AI() { - if (projectile.timeLeft % 2f == 0f) + if (Projectile.timeLeft % 2f == 0f) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * 0.25f; int num448 = Dust.NewDust(vector33, 1, 1, (int)CalamityDusts.ProfanedFire, 0f, 0f, 0, default, 1.25f); Main.dust[num448].position = vector33; Main.dust[num448].noGravity = true; diff --git a/Projectiles/Summon/AngelOrb.cs b/Projectiles/Summon/AngelOrb.cs index d35127d0b9..6eb93d2f87 100644 --- a/Projectiles/Summon/AngelOrb.cs +++ b/Projectiles/Summon/AngelOrb.cs @@ -11,27 +11,27 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Orb"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 30; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 150f, 3f, 6f, 2, ModContent.ProjectileType(), 1D, true); + CalamityGlobalProjectile.MagnetSphereHitscan(Projectile, 150f, 3f, 6f, 2, ModContent.ProjectileType(), 1D, true); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); diff --git a/Projectiles/Summon/AngelRay.cs b/Projectiles/Summon/AngelRay.cs index ea79495d8c..db88c90952 100644 --- a/Projectiles/Summon/AngelRay.cs +++ b/Projectiles/Summon/AngelRay.cs @@ -13,36 +13,36 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Ray"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.penetrate = 10; - projectile.extraUpdates = 200; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.penetrate = 10; + Projectile.extraUpdates = 200; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.2f, 0.01f, 0.1f); - projectile.ai[0] += 1f; - if (projectile.ai[0] % 6f == 0f && projectile.owner == Main.myPlayer) + Lighting.AddLight(Projectile.Center, 0.2f, 0.01f, 0.1f); + Projectile.ai[0] += 1f; + if (Projectile.ai[0] % 6f == 0f && Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } - if (projectile.ai[0] > 16f && projectile.ai[0] % 2f == 0f) + if (Projectile.ai[0] > 16f && Projectile.ai[0] % 2f == 0f) { - Vector2 source = projectile.position; + Vector2 source = Projectile.position; int pink = Dust.NewDust(source, 1, 1, (int)CalamityDusts.ProfanedFire, 0f, 0f, 0, default, 1.25f); Main.dust[pink].noGravity = true; Main.dust[pink].noLight = true; @@ -54,20 +54,20 @@ namespace CalamityMod.Projectiles.Summon public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; diff --git a/Projectiles/Summon/AngelicAllianceArchangel.cs b/Projectiles/Summon/AngelicAllianceArchangel.cs index 4391434742..343de98ad4 100644 --- a/Projectiles/Summon/AngelicAllianceArchangel.cs +++ b/Projectiles/Summon/AngelicAllianceArchangel.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Archangel"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 60; - projectile.height = 68; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.extraUpdates = 1; + Projectile.width = 60; + Projectile.height = 68; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(lifeSpan); @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.divineBless || player.dead || !player.active) @@ -50,116 +50,116 @@ namespace CalamityMod.Projectiles.Summon } // Initialization and dust - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 10; i++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } // Rotate around the player - double deg = projectile.ai[1]; + double deg = Projectile.ai[1]; double rad = deg * (Math.PI / 180); double dist = 300; - projectile.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - projectile.width / 2; - projectile.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - projectile.height / 2; - projectile.ai[1] += 1f; + Projectile.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - Projectile.width / 2; + Projectile.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - Projectile.height / 2; + Projectile.ai[1] += 1f; - if (!projectile.FinalExtraUpdate()) + if (!Projectile.FinalExtraUpdate()) return; lifeSpan--; if (lifeSpan <= 0) { - projectile.alpha += 30; - if (projectile.alpha >= 255) + Projectile.alpha += 30; + if (Projectile.alpha >= 255) { - projectile.Kill(); + Projectile.Kill(); return; } } // Give off some light float lightScalar = Main.rand.NextFloat(0.9f, 1.1f) * Main.essScale; - Lighting.AddLight(projectile.Center, 0.3f * lightScalar, 0.26f * lightScalar, 0.15f * lightScalar); + Lighting.AddLight(Projectile.Center, 0.3f * lightScalar, 0.26f * lightScalar, 0.15f * lightScalar); // Get a target - NPC target = projectile.Center.MinionHoming(2000f, player, false, true); + NPC target = Projectile.Center.MinionHoming(2000f, player, false, true); // Shoot the target if (target != null) { - Vector2 direction = target.Center - projectile.Center; + Vector2 direction = target.Center - Projectile.Center; direction.Normalize(); direction *= 6f; if (direction.X >= 0.25f) { - projectile.direction = -1; + Projectile.direction = -1; } else if (direction.X < -0.25f) { - projectile.direction = 1; + Projectile.direction = 1; } - projectile.ai[0]++; + Projectile.ai[0]++; int timerLimit = 120; - if (projectile.ai[0] > timerLimit && projectile.alpha < 50) + if (Projectile.ai[0] > timerLimit && Projectile.alpha < 50) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { int type = ModContent.ProjectileType(); - Projectile.NewProjectile(projectile.Center, direction * 0.5f, type, projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, direction * 0.5f, type, Projectile.damage, Projectile.knockBack, Projectile.owner); } - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } } else { - Vector2 direction = player.Center - projectile.Center; + Vector2 direction = player.Center - Projectile.Center; direction.Normalize(); direction *= 6f; if (direction.X >= 0.25f) { - projectile.direction = -1; + Projectile.direction = -1; } else if (direction.X < -0.25f) { - projectile.direction = 1; + Projectile.direction = 1; } } - projectile.spriteDirection = projectile.direction; + Projectile.spriteDirection = Projectile.direction; // Frames - projectile.frameCounter++; - if (projectile.frameCounter > 7) + Projectile.frameCounter++; + if (Projectile.frameCounter > 7) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int frameY = frameHeight * projectile.frame; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int frameY = frameHeight * Projectile.frame; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, spriteEffects, 0f); return false; } diff --git a/Projectiles/Summon/ApexShark.cs b/Projectiles/Summon/ApexShark.cs index 7a0ce2262e..9b5b6b2b92 100644 --- a/Projectiles/Summon/ApexShark.cs +++ b/Projectiles/Summon/ApexShark.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -16,71 +17,71 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Ancient Mineral Shark"); - Main.projFrames[projectile.type] = 8; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 8; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 40; + Projectile.height = 40; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { if (HitCooldown > 0) HitCooldown--; - Player player = Main.player[projectile.owner]; - if (projectile.localAI[0] == 0f) + Player player = Main.player[Projectile.owner]; + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 85, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } - projectile.localAI[0]++; + Projectile.localAI[0]++; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 7) + if (Projectile.frame > 7) { - projectile.frame = 0; + Projectile.frame = 0; } float num633 = 1200f; float num634 = 1500f; float num635 = 2200f; float num636 = 150f; - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); @@ -92,22 +93,22 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.apexShark) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); bool flag24 = false; - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 60f) + Projectile.ai[1] += 1f; + Projectile.extraUpdates = 1; + if (Projectile.ai[1] > 60f) { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; + Projectile.ai[1] = 1f; + Projectile.ai[0] = 0f; + Projectile.extraUpdates = 0; + Projectile.numUpdates = 0; + Projectile.netUpdate = true; } else { @@ -118,14 +119,14 @@ namespace CalamityMod.Projectiles.Summon { return; } - Vector2 vector46 = projectile.position; + Vector2 vector46 = Projectile.position; bool flag25 = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, projectile.Center); + float num646 = Vector2.Distance(npc.Center, Projectile.Center); if (!flag25 && num646 < num633) { num633 = num646; @@ -139,9 +140,9 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); if (!flag25 && num646 < num633) { num633 = num646; @@ -156,27 +157,27 @@ namespace CalamityMod.Projectiles.Summon { num647 = num635; } - if (Vector2.Distance(player.Center, projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > num647) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } - if (flag25 && projectile.ai[0] == 0f) + if (flag25 && Projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - projectile.Center; + Vector2 vector47 = vector46 - Projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 13f; //8 vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 6f; vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } } else @@ -184,66 +185,66 @@ namespace CalamityMod.Projectiles.Summon bool flag26 = false; if (!flag26) { - flag26 = projectile.ai[0] == 1f; + flag26 = Projectile.ai[0] == 1f; } float num650 = 10f; if (flag26) { num650 = 21f; } - Vector2 center2 = projectile.Center; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); if (num651 > 200f && num650 < 8f) { num650 = 1f; } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (num651 < num636 && flag26 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (num651 > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - if (projectile.ai[1] > 0f) + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 4); + Projectile.ai[1] += (float)Main.rand.Next(1, 4); } - if (projectile.ai[1] > 60f) + if (Projectile.ai[1] > 60f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) + if (Projectile.ai[1] == 0f && flag25 && num633 < 500f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner) { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; + Projectile.ai[0] = 2f; + Vector2 value20 = vector46 - Projectile.Center; value20.Normalize(); - projectile.velocity = value20 * 13f; //8 - projectile.netUpdate = true; + Projectile.velocity = value20 * 13f; //8 + Projectile.netUpdate = true; } } } @@ -252,11 +253,11 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 70, 0.5f); - projectile.velocity = new Vector2(0f, 5f).RotatedBy(projectile.velocity.ToRotation() + 1.5f); - int sand = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.7f), (int)(projectile.knockBack * 0.7f), projectile.owner, 0f, 0f); - Main.projectile[sand].Center = projectile.Center; - projectile.netUpdate = true; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 70, 0.5f); + Projectile.velocity = new Vector2(0f, 5f).RotatedBy(Projectile.velocity.ToRotation() + 1.5f); + int sand = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7f), (int)(Projectile.knockBack * 0.7f), Projectile.owner, 0f, 0f); + Main.projectile[sand].Center = Projectile.Center; + Projectile.netUpdate = true; HitCooldown = 20; } diff --git a/Projectiles/Summon/ApparatusExplosion.cs b/Projectiles/Summon/ApparatusExplosion.cs index b2bcd87820..722ea16d02 100644 --- a/Projectiles/Summon/ApparatusExplosion.cs +++ b/Projectiles/Summon/ApparatusExplosion.cs @@ -8,35 +8,35 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - Main.projFrames[projectile.type] = 10; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Projectile.type] = 10; } public override void SetDefaults() { - projectile.width = 42; - projectile.height = 44; - projectile.friendly = true; - projectile.minion = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 42; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { // Bluish cyan light - Lighting.AddLight(projectile.Center, 0.1f, 0.5f, 1f); + Lighting.AddLight(Projectile.Center, 0.1f, 0.5f, 1f); - projectile.frameCounter++; - if (projectile.frameCounter >= 6) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Summon/AquaticStarMinion.cs b/Projectiles/Summon/AquaticStarMinion.cs index 78f6446e7e..d993c0f8c1 100644 --- a/Projectiles/Summon/AquaticStarMinion.cs +++ b/Projectiles/Summon/AquaticStarMinion.cs @@ -12,42 +12,42 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Aquatic Star"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 32; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 32; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -57,19 +57,19 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.aStar) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.rotation += projectile.velocity.X * 0.04f; + Projectile.rotation += Projectile.velocity.X * 0.04f; - projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 9.5f, false, false); + Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 9.5f, false, false); } public override bool OnTileCollide(Vector2 oldVelocity) => false; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 5; + target.immune[Projectile.owner] = 5; } } } diff --git a/Projectiles/Summon/AstrageldonLaser.cs b/Projectiles/Summon/AstrageldonLaser.cs index 19816759e5..c3d6b7274b 100644 --- a/Projectiles/Summon/AstrageldonLaser.cs +++ b/Projectiles/Summon/AstrageldonLaser.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class AstrageldonLaser : ModProjectile @@ -12,53 +13,53 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Laser"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.minion = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -2; - projectile.extraUpdates = 1; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -2; + Projectile.extraUpdates = 1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 3) + if (Projectile.frame >= 3) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[0] = 1f; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 12); + Projectile.ai[0] = 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 12); } - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -68,12 +69,12 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/AstrageldonSummon.cs b/Projectiles/Summon/AstrageldonSummon.cs index 0fb80dcd66..5d3a1bf18a 100644 --- a/Projectiles/Summon/AstrageldonSummon.cs +++ b/Projectiles/Summon/AstrageldonSummon.cs @@ -20,27 +20,27 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Astrageldon"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 64; - projectile.height = 62; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.alpha = 75; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.aiStyle = 26; + Projectile.width = 64; + Projectile.height = 62; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 1; + Projectile.alpha = 75; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.aiStyle = 26; aiType = ProjectileID.BabySlime; } @@ -53,28 +53,28 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[projectile.owner];; + Player player = Main.player[Projectile.owner];; CalamityPlayer modPlayer = player.Calamity(); - CalamityGlobalProjectile modProj = projectile.Calamity(); + CalamityGlobalProjectile modProj = Projectile.Calamity(); //hitbox size scaling - float scale = (float)Math.Log(projectile.minionSlots, 10f) + 1f; - if (projectile.scale != scale) - projectile.scale = scale; - projectile.width = (int)(64f * projectile.scale); - projectile.height = (int)(62f * projectile.scale); + float scale = (float)Math.Log(Projectile.minionSlots, 10f) + 1f; + if (Projectile.scale != scale) + Projectile.scale = scale; + Projectile.width = (int)(64f * Projectile.scale); + Projectile.height = (int)(62f * Projectile.scale); //on spawn effects and flexible minions if (!dust) { modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; + modProj.spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 16; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int dusty = Dust.NewDust(vector6 + vector7, 0, 0, ModContent.DustType(), vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; @@ -88,11 +88,11 @@ namespace CalamityMod.Projectiles.Summon int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } //Bool setup - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -102,24 +102,24 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.aSlime) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - if (projectile.frame == 0 || projectile.frame == 1) + if (Projectile.frame == 0 || Projectile.frame == 1) { float mindistance = 1000f; float longdistance = 2000f; float longestdistance = 3000f; - Vector2 objectivepos = projectile.position; + Vector2 objectivepos = Projectile.position; bool gotoenemy = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - bool lineOfSight = Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); - float disttoobjective = Vector2.Distance(npc.Center, projectile.Center); + bool lineOfSight = Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height); + float disttoobjective = Vector2.Distance(npc.Center, Projectile.Center); if ((!gotoenemy && disttoobjective < mindistance) && lineOfSight) { @@ -134,10 +134,10 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.npc.Length; num645++) { NPC npc = Main.npc[num645]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - bool lineOfSight = Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); - float disttoobjective = Vector2.Distance(npc.Center, projectile.Center); + bool lineOfSight = Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height); + float disttoobjective = Vector2.Distance(npc.Center, Projectile.Center); if ((!gotoenemy && disttoobjective < mindistance) && lineOfSight) { @@ -156,7 +156,7 @@ namespace CalamityMod.Projectiles.Summon if (gotoenemy) { float teleportRange = objectivepos.Length(); - float scaleAddition = projectile.scale * 5f; + float scaleAddition = Projectile.scale * 5f; if (teleportCounter <= 0 && teleportRange >= 800f) { float num461 = 50f; @@ -175,20 +175,20 @@ namespace CalamityMod.Projectiles.Summon num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; dust.velocity.Y = num464; num462++; } - projectile.position.X = objectivepos.X - (float)(projectile.width / 2) + Main.rand.NextFloat(-100f, 100f); - projectile.position.Y = objectivepos.Y - (float)(projectile.height / 2) - Main.rand.NextFloat(0f + scaleAddition, 200f + scaleAddition); - projectile.netUpdate = true; + Projectile.position.X = objectivepos.X - (float)(Projectile.width / 2) + Main.rand.NextFloat(-100f, 100f); + Projectile.position.Y = objectivepos.Y - (float)(Projectile.height / 2) - Main.rand.NextFloat(0f + scaleAddition, 200f + scaleAddition); + Projectile.netUpdate = true; teleportCounter = 600; } if (teleportCounter > 0) @@ -202,20 +202,20 @@ namespace CalamityMod.Projectiles.Summon if (attackCounter > 300) { attackCounter = 0; - projectile.netUpdate = true; + Projectile.netUpdate = true; } float scaleFactor3 = 6f; int projType = ModContent.ProjectileType(); if (gotoenemy && attackCounter == 0) { attackCounter += 2; - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Vector2 laserVel = objectivepos - projectile.Center; + Vector2 laserVel = objectivepos - Projectile.Center; laserVel.Normalize(); laserVel *= scaleFactor3; - int laser = Projectile.NewProjectile(projectile.Center, laserVel, projType, projectile.damage, 0f, projectile.owner); - projectile.netUpdate = true; + int laser = Projectile.NewProjectile(Projectile.Center, laserVel, projType, Projectile.damage, 0f, Projectile.owner); + Projectile.netUpdate = true; } } } @@ -230,10 +230,10 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int y6 = height * projectile.frame; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int y6 = height * Projectile.frame; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Summon/AstralProbeRound.cs b/Projectiles/Summon/AstralProbeRound.cs index 55c348a9dc..9cd5b715db 100644 --- a/Projectiles/Summon/AstralProbeRound.cs +++ b/Projectiles/Summon/AstralProbeRound.cs @@ -5,6 +5,7 @@ using CalamityMod.Dusts; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class AstralProbeRound : ModProjectile @@ -14,29 +15,29 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.minionSlots = 0f; - projectile.minion = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.extraUpdates = 2; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.minionSlots = 0f; + Projectile.minion = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 2; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Main.rand.NextBool(3)) { int randomDust = Utils.SelectRandom(Main.rand, new int[] @@ -44,14 +45,14 @@ namespace CalamityMod.Projectiles.Summon ModContent.DustType(), ModContent.DustType() }); - int astral = Dust.NewDust(projectile.position, 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); - Main.dust[astral].alpha = projectile.alpha; + int astral = Dust.NewDust(Projectile.position, 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); + Main.dust[astral].alpha = Projectile.alpha; Main.dust[astral].velocity *= 0f; Main.dust[astral].noGravity = true; } - NPC potentialTarget = projectile.Center.MinionHoming(1200f, Main.player[projectile.owner]); + NPC potentialTarget = Projectile.Center.MinionHoming(1200f, Main.player[Projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 17f) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 17f) / 21f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -61,13 +62,13 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 10); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 10); for (int k = 0; k < 5; k++) { int randomDust = Main.rand.Next(2); @@ -79,7 +80,7 @@ namespace CalamityMod.Projectiles.Summon { randomDust = ModContent.DustType(); } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Summon/AstralProbeSummon.cs b/Projectiles/Summon/AstralProbeSummon.cs index e711e56a5a..4ddcdac295 100644 --- a/Projectiles/Summon/AstralProbeSummon.cs +++ b/Projectiles/Summon/AstralProbeSummon.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -16,54 +17,54 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Probe"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.timeLeft *= 5; - projectile.penetrate = -1; - projectile.minion = true; + Projectile.width = 22; + Projectile.height = 22; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.timeLeft *= 5; + Projectile.penetrate = -1; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; rotationVariation = Main.rand.NextDouble() * 0.015; int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 dustSource = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - dustSource = dustSource.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 dustVel = dustSource - projectile.Center; + Vector2 dustSource = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + dustSource = dustSource.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 dustVel = dustSource - Projectile.Center; int astral = Dust.NewDust(dustSource + dustVel, 0, 0, (Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType()), dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); Main.dust[astral].noGravity = true; Main.dust[astral].velocity = dustVel; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + Projectile.damage = damage2; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) { @@ -73,51 +74,51 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.aProbe) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - NPC target = projectile.Center.MinionHoming(1000f, player, true, true); - Vector2 vector = player.Center - projectile.Center; + NPC target = Projectile.Center.MinionHoming(1000f, player, true, true); + Vector2 vector = player.Center - Projectile.Center; if (target != null) { - projectile.spriteDirection = projectile.direction = ((target.Center.X - projectile.Center.X) > 0).ToDirectionInt(); - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(target.Center) + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi), 0.1f); + Projectile.spriteDirection = Projectile.direction = ((target.Center.X - Projectile.Center.X) > 0).ToDirectionInt(); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(target.Center) + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi), 0.1f); } else { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.rotation.AngleLerp(vector.ToRotation() - (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi * projectile.direction), 0.1f); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.rotation.AngleLerp(vector.ToRotation() - (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi * Projectile.direction), 0.1f); } - projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); + Projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); rotation += 0.03 + rotationVariation; if (rotation >= 360) { rotation = 0; } - projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; + Projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 3); + Projectile.ai[1] += (float)Main.rand.Next(1, 3); } - if (projectile.ai[1] > 80f) + if (Projectile.ai[1] > 80f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } float speedMult = 6f; int projType = ModContent.ProjectileType(); - if (target != null && projectile.ai[1] == 0f) + if (target != null && Projectile.ai[1] == 0f) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 12, 0.5f, 0f); - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 12, 0.5f, 0f); + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner) { - Vector2 velocity = target.Center - projectile.Center; + Vector2 velocity = target.Center - Projectile.Center; velocity.Normalize(); velocity *= speedMult; - Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, 0f, projectile.owner, target.whoAmI, 0f); - projectile.netUpdate = true; + Projectile.NewProjectile(Projectile.Center, velocity, projType, Projectile.damage, 0f, Projectile.owner, target.whoAmI, 0f); + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Summon/AureusBomber.cs b/Projectiles/Summon/AureusBomber.cs index 82baa57253..59f79a4b53 100644 --- a/Projectiles/Summon/AureusBomber.cs +++ b/Projectiles/Summon/AureusBomber.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -14,29 +15,29 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Aureus Bomber"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 1; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 1; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 60; - projectile.height = 60; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 0; - projectile.timeLeft = 300; - projectile.penetrate = 1; - projectile.minion = true; - projectile.tileCollide = false; + Projectile.width = 60; + Projectile.height = 60; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 0; + Projectile.timeLeft = 300; + Projectile.penetrate = 1; + Projectile.minion = true; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int dustType = Utils.SelectRandom(Main.rand, new int[] { ModContent.DustType(), @@ -44,85 +45,85 @@ namespace CalamityMod.Projectiles.Summon }); //on spawn effects && minion flexibility - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, dustType, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } //anti sticking movement - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); //get in a line Vector2 idlePosition = player.Center; idlePosition.Y -= 48f; - float minionPositionOffsetX = (10 + projectile.minionPos * 40) * -player.direction; + float minionPositionOffsetX = (10 + Projectile.minionPos * 40) * -player.direction; idlePosition.X += minionPositionOffsetX; - Vector2 vectorToIdlePosition = idlePosition - projectile.Center; + Vector2 vectorToIdlePosition = idlePosition - Projectile.Center; float idleDistance = vectorToIdlePosition.Length(); //dust effects if (Main.rand.NextBool(10)) { - int index = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0.0f, 0.0f, 100, Color.Transparent, 2f); + int index = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0.0f, 0.0f, 100, Color.Transparent, 2f); Main.dust[index].velocity *= 0.3f; Main.dust[index].noGravity = true; Main.dust[index].noLight = true; } //frames - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 3) + if (Projectile.frame >= 3) { - projectile.frame = 0; + Projectile.frame = 0; } //direction - if (projectile.velocity.X > 0f) - projectile.spriteDirection = projectile.direction = -1; - else if (projectile.velocity.X < 0f) - projectile.spriteDirection = projectile.direction = 1; + if (Projectile.velocity.X > 0f) + Projectile.spriteDirection = Projectile.direction = -1; + else if (Projectile.velocity.X < 0f) + Projectile.spriteDirection = Projectile.direction = 1; //tile collision - projectile.tileCollide = true; - if (projectile.ai[0] == 1f) - projectile.tileCollide = false; + Projectile.tileCollide = true; + if (Projectile.ai[0] == 1f) + Projectile.tileCollide = false; //find nearby NPCs - Vector2 objectivePos = projectile.position; + Vector2 objectivePos = Projectile.position; float minDist = 400f; bool enemyFound = false; int npcIndex = -1; - NPC targetedNPC = projectile.OwnerMinionAttackTargetNPC; - if (targetedNPC != null && targetedNPC.CanBeChasedBy((object) projectile, false)) + NPC targetedNPC = Projectile.OwnerMinionAttackTargetNPC; + if (targetedNPC != null && targetedNPC.CanBeChasedBy((object) Projectile, false)) { - float distToEnemy = Vector2.Distance(targetedNPC.Center, projectile.Center); - if (((double) Vector2.Distance(projectile.Center, objectivePos) > (double) distToEnemy && (double) distToEnemy < (double) minDist || !enemyFound) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, targetedNPC.position, targetedNPC.width, targetedNPC.height)) + float distToEnemy = Vector2.Distance(targetedNPC.Center, Projectile.Center); + if (((double) Vector2.Distance(Projectile.Center, objectivePos) > (double) distToEnemy && (double) distToEnemy < (double) minDist || !enemyFound) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, targetedNPC.position, targetedNPC.width, targetedNPC.height)) { minDist = distToEnemy; objectivePos = targetedNPC.Center; @@ -135,10 +136,10 @@ namespace CalamityMod.Projectiles.Summon for (int index = 0; index < Main.npc.Length; ++index) { NPC npc = Main.npc[index]; - if (npc.CanBeChasedBy((object) projectile, false)) + if (npc.CanBeChasedBy((object) Projectile, false)) { - float distToEnemy = Vector2.Distance(npc.Center, projectile.Center); - if (((double) Vector2.Distance(projectile.Center, objectivePos) > (double) distToEnemy && (double) distToEnemy < (double) minDist || !enemyFound) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float distToEnemy = Vector2.Distance(npc.Center, Projectile.Center); + if (((double) Vector2.Distance(Projectile.Center, objectivePos) > (double) distToEnemy && (double) distToEnemy < (double) minDist || !enemyFound) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { minDist = distToEnemy; objectivePos = npc.Center; @@ -154,37 +155,37 @@ namespace CalamityMod.Projectiles.Summon maxDistToEnemy = 1000; //if too far, return to the player - if ((double) Vector2.Distance(player.Center, projectile.Center) > (double) maxDistToEnemy) + if ((double) Vector2.Distance(player.Center, Projectile.Center) > (double) maxDistToEnemy) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } //movement if NPC found - if (enemyFound && projectile.ai[0] == 0f) + if (enemyFound && Projectile.ai[0] == 0f) { float homingStrength = 15f; - Vector2 projPos = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 projPos = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float distX = objectivePos.X - projPos.X; float distY = objectivePos.Y - projPos.Y; float distToTarget = (float)Math.Sqrt((double)(distX * distX + distY * distY)); distToTarget = homingStrength / distToTarget; distX *= distToTarget; distY *= distToTarget; - projectile.velocity.X = (projectile.velocity.X * 20f + distX) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + distY) / 21f; + Projectile.velocity.X = (Projectile.velocity.X * 20f + distX) / 21f; + Projectile.velocity.Y = (Projectile.velocity.Y * 20f + distY) / 21f; } else { //if player not in line of sight, go through tiles - if (!Collision.CanHitLine(projectile.Center, 1, 1, player.Center, 1, 1)) - projectile.ai[0] = 1f; + if (!Collision.CanHitLine(Projectile.Center, 1, 1, player.Center, 1, 1)) + Projectile.ai[0] = 1f; float speedToPlayer = 6f; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) speedToPlayer = 15f; - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; Vector2 playerPos = player.Center - center + new Vector2(0.0f, -60f); playerPos = player.Center - center; float distToPlayer = playerPos.Length(); @@ -193,17 +194,17 @@ namespace CalamityMod.Projectiles.Summon speedToPlayer *= 0.75f; //idle distance - if (distToPlayer < idleDistance && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (distToPlayer < idleDistance && Projectile.ai[0] == 1f && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } //way too far so teleport memes if (distToPlayer > 2000f) { - projectile.position.X = player.Center.X - (float) (projectile.width / 2); - projectile.position.Y = player.Center.Y - (float) (projectile.width / 2); + Projectile.position.X = player.Center.X - (float) (Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float) (Projectile.width / 2); } if (distToPlayer > 10f) @@ -211,17 +212,17 @@ namespace CalamityMod.Projectiles.Summon playerPos.Normalize(); if (distToPlayer < 50f) speedToPlayer /= 2f; - projectile.velocity = (projectile.velocity * 20f + playerPos * speedToPlayer) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + playerPos * speedToPlayer) / 21f; } else { - projectile.direction = player.direction; - projectile.velocity = projectile.velocity * 0.9f; + Projectile.direction = player.direction; + Projectile.velocity = Projectile.velocity * 0.9f; } } //stop if you trying to return to the player - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) return; //stop if you didn't find an enemy @@ -229,34 +230,34 @@ namespace CalamityMod.Projectiles.Summon return; //face said enemy - if ((objectivePos - projectile.Center).X > 0f) - projectile.spriteDirection = projectile.direction = -1; - else if ((objectivePos - projectile.Center).X < 0f) - projectile.spriteDirection = projectile.direction = 1; + if ((objectivePos - Projectile.Center).X > 0f) + Projectile.spriteDirection = Projectile.direction = -1; + else if ((objectivePos - Projectile.Center).X < 0f) + Projectile.spriteDirection = Projectile.direction = 1; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 150; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 150; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 14); for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 50, default, 1f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } @@ -266,7 +267,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/BabyBloodCrawler.cs b/Projectiles/Summon/BabyBloodCrawler.cs index 953adbb198..7e04d4ae80 100644 --- a/Projectiles/Summon/BabyBloodCrawler.cs +++ b/Projectiles/Summon/BabyBloodCrawler.cs @@ -15,25 +15,25 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Baby Blood Crawler"); - Main.projFrames[projectile.type] = 11; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 11; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1f; - projectile.aiStyle = 26; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 26; + Projectile.height = 26; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 1f; + Projectile.aiStyle = 26; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; aiType = ProjectileID.VenomSpider; - projectile.tileCollide = false; + Projectile.tileCollide = false; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) @@ -44,16 +44,16 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); for (int j = 0; j < Main.maxProjectiles; j++) { Projectile proj = Main.projectile[j]; // Short circuits to make the loop as fast as possible - if (!proj.active || proj.owner != projectile.owner || !proj.minion || proj.Calamity().lineColor != 0) + if (!proj.active || proj.owner != Projectile.owner || !proj.minion || proj.Calamity().lineColor != 0) continue; - if (proj.type == projectile.type) + if (proj.type == Projectile.type) { spiderCount += (int)proj.minionSlots; proj.Calamity().lineColor = 1; @@ -62,14 +62,14 @@ namespace CalamityMod.Projectiles.Summon if (dust == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 16; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 5, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; @@ -77,14 +77,14 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.scabRipper) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } } @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Summon int immuneTime = 16 - spiderCount; if (immuneTime < 5) immuneTime = 5; //cap to prevent potential insanity - target.immune[projectile.owner] = immuneTime; + target.immune[Projectile.owner] = immuneTime; OnHitEffects(target.Center); } @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Summon int projAmt = Main.rand.Next(1, 3); for (int n = 0; n < projAmt; n++) { - CalamityUtils.ProjectileRain(targetPos, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(projectile.damage * Main.rand.NextFloat(0.7f, 1f)), projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), projectile.owner); + CalamityUtils.ProjectileRain(targetPos, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(Projectile.damage * Main.rand.NextFloat(0.7f, 1f)), Projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), Projectile.owner); } } } diff --git a/Projectiles/Summon/BabyPlaguebringer.cs b/Projectiles/Summon/BabyPlaguebringer.cs index 378f172aa9..c4b77571e1 100644 --- a/Projectiles/Summon/BabyPlaguebringer.cs +++ b/Projectiles/Summon/BabyPlaguebringer.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class BabyPlaguebringer : ModProjectile @@ -15,35 +16,35 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Baby Plaguebringer"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 56; - projectile.height = 46; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.extraUpdates = 0; - projectile.minionSlots = 0f; - projectile.timeLeft = 360; - projectile.penetrate = 3; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 56; + Projectile.height = 46; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.extraUpdates = 0; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 360; + Projectile.penetrate = 3; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if ((double)Math.Abs(Projectile.velocity.X) > 0.2) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } float num633 = 800f; float num634 = 1200f; @@ -53,30 +54,30 @@ namespace CalamityMod.Projectiles.Summon //lighting float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight(projectile.Center, 0f * num, 0.75f * num, 0f * num); + Lighting.AddLight(Projectile.Center, 0f * num, 0.75f * num, 0f * num); bool flag24 = false; - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.ai[1] += 1f; + Projectile.extraUpdates = 1; + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 2) + if (Projectile.frame > 2) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.ai[1] > 30f) + if (Projectile.ai[1] > 30f) { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; + Projectile.ai[1] = 1f; + Projectile.ai[0] = 0f; + Projectile.extraUpdates = 0; + Projectile.numUpdates = 0; + Projectile.netUpdate = true; } else { @@ -87,14 +88,14 @@ namespace CalamityMod.Projectiles.Summon { return; } - Vector2 vector46 = projectile.position; + Vector2 vector46 = Projectile.position; bool flag25 = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, projectile.Center); + float num646 = Vector2.Distance(npc.Center, Projectile.Center); if (!flag25 && num646 < num633) { num633 = num646; @@ -108,9 +109,9 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); if (!flag25 && num646 < num633) { num633 = num646; @@ -125,27 +126,27 @@ namespace CalamityMod.Projectiles.Summon { num647 = num635; } - if (Vector2.Distance(player.Center, projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > num647) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } - if (flag25 && projectile.ai[0] == 0f) + if (flag25 && Projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - projectile.Center; + Vector2 vector47 = vector46 - Projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 8f; vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 4f; vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } } else @@ -153,74 +154,74 @@ namespace CalamityMod.Projectiles.Summon bool flag26 = false; if (!flag26) { - flag26 = projectile.ai[0] == 1f; + flag26 = Projectile.ai[0] == 1f; } float num650 = 6f; if (flag26) { num650 = 15f; } - Vector2 center2 = projectile.Center; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); if (num651 > 200f && num650 < 8f) { num650 = 8f; } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (num651 < num636 && flag26 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (num651 > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } } - projectile.frameCounter++; - if (projectile.frameCounter > 12) + Projectile.frameCounter++; + if (Projectile.frameCounter > 12) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 2; + Projectile.frame = 2; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 4); + Projectile.ai[1] += (float)Main.rand.Next(1, 4); } - if (projectile.ai[1] > 40f) + if (Projectile.ai[1] > 40f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) + if (Projectile.ai[1] == 0f && flag25 && num633 < 500f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner) { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; + Projectile.ai[0] = 2f; + Vector2 value20 = vector46 - Projectile.Center; value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; + Projectile.velocity = value20 * 8f; + Projectile.netUpdate = true; } } } @@ -228,16 +229,16 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCHit4, projectile.position); + SoundEngine.PlaySound(SoundID.NPCHit4, Projectile.position); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, spriteEffects, 0f); return false; } diff --git a/Projectiles/Summon/BelladonnaPetal.cs b/Projectiles/Summon/BelladonnaPetal.cs index aff7831ea1..6c04c0530f 100644 --- a/Projectiles/Summon/BelladonnaPetal.cs +++ b/Projectiles/Summon/BelladonnaPetal.cs @@ -9,33 +9,33 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 12; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 360; + Projectile.width = 10; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 360; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.velocity.X *= 0.99f; - if (projectile.velocity.Y < 9f) - projectile.velocity.Y += 0.085f; - projectile.tileCollide = projectile.timeLeft <= 180; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity.X *= 0.99f; + if (Projectile.velocity.Y < 9f) + Projectile.velocity.Y += 0.085f; + Projectile.tileCollide = Projectile.timeLeft <= 180; } public override void Kill(int timeLeft) { for (int i = 0; i < 5; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, DustID.Grass); + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.Grass); dust.velocity = Main.rand.NextVector2Circular(2f, 2f) ; dust.noGravity = true; } diff --git a/Projectiles/Summon/BelladonnaSpirit.cs b/Projectiles/Summon/BelladonnaSpirit.cs index 5af2942018..8b32cbb9fb 100644 --- a/Projectiles/Summon/BelladonnaSpirit.cs +++ b/Projectiles/Summon/BelladonnaSpirit.cs @@ -11,55 +11,55 @@ namespace CalamityMod.Projectiles.Summon { public float PetalFireTimer { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public override void SetStaticDefaults() { DisplayName.SetDefault("Belladonna Spirit"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 48; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 28; + Projectile.height = 48; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 1; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { Initialize(player); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } - if (projectile.frameCounter++ > 6f) + if (Projectile.frameCounter++ > 6f) { - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; - projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frameCounter = 0; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isCorrectProjectile) { @@ -69,16 +69,16 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.belladonaSpirit) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - if (projectile.velocity.X > 0.25f) - projectile.spriteDirection = 1; - else if (projectile.velocity.X < -0.25f) - projectile.spriteDirection = -1; + if (Projectile.velocity.X > 0.25f) + Projectile.spriteDirection = 1; + else if (Projectile.velocity.X < -0.25f) + Projectile.spriteDirection = -1; - NPC potentialTarget = projectile.Center.MinionHoming(1200f, player); + NPC potentialTarget = Projectile.Center.MinionHoming(1200f, player); if (potentialTarget is null) { Vector2 targetPosition = player.Bottom; @@ -88,54 +88,54 @@ namespace CalamityMod.Projectiles.Summon { TargetNPC(potentialTarget); } - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); } public void Initialize(Player player) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 45; i++) { float angle = MathHelper.TwoPi / 45f * i; Vector2 velocity = angle.ToRotationVector2() * 4f; - Dust dust = Dust.NewDustPerfect(projectile.Center + velocity * 2.75f, 39, velocity); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velocity * 2.75f, 39, velocity); dust.noGravity = true; } } public void FollowPlayer(Player player, Vector2 targetPosition) { - projectile.velocity.X = (player.Center.X + player.direction * 75f - projectile.Center.X) / 60f; - if (projectile.Distance(player.Center) > 2500f || - targetPosition.Y - projectile.Top.Y > 360f) + Projectile.velocity.X = (player.Center.X + player.direction * 75f - Projectile.Center.X) / 60f; + if (Projectile.Distance(player.Center) > 2500f || + targetPosition.Y - Projectile.Top.Y > 360f) { - projectile.Center = player.Center; - projectile.netUpdate = true; + Projectile.Center = player.Center; + Projectile.netUpdate = true; } - else if (targetPosition.Y - projectile.Top.Y < -550f) + else if (targetPosition.Y - Projectile.Top.Y < -550f) { - projectile.velocity.Y += Math.Sign(targetPosition.Y - targetPosition.Y) * 0.08f; + Projectile.velocity.Y += Math.Sign(targetPosition.Y - targetPosition.Y) * 0.08f; } else { - projectile.velocity.Y = (targetPosition.Y - projectile.Center.Y) / 60f; + Projectile.velocity.Y = (targetPosition.Y - Projectile.Center.Y) / 60f; } } public void TargetNPC(NPC target) { Vector2 targetPosition = target.Center; - if (Math.Abs(targetPosition.X - projectile.Center.X) < 180f) + if (Math.Abs(targetPosition.X - Projectile.Center.X) < 180f) { - projectile.velocity.X *= 0.95f; + Projectile.velocity.X *= 0.95f; PetalFireTimer++; - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) FirePetals(target); } else { - projectile.velocity.X += (targetPosition.X - projectile.Center.X + target.spriteDirection * 75f > 0).ToDirectionInt() * 0.5f; - projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -12f, 12f); + Projectile.velocity.X += (targetPosition.X - Projectile.Center.X + target.spriteDirection * 75f > 0).ToDirectionInt() * 0.5f; + Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -12f, 12f); } - projectile.velocity.Y = (targetPosition.Y - projectile.Center.Y + target.spriteDirection * 75f) / 90f; + Projectile.velocity.Y = (targetPosition.Y - Projectile.Center.Y + target.spriteDirection * 75f) / 90f; } public void FirePetals(NPC target) { @@ -144,12 +144,12 @@ namespace CalamityMod.Projectiles.Summon for (int i = -1; i <= 1; i++) { float angle = Main.rand.NextFloat(-0.1f, 0.1f) + i * 0.05f; - Projectile.NewProjectile(projectile.Center + new Vector2(0f, -6f), - projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 7.5f, + Projectile.NewProjectile(Projectile.Center + new Vector2(0f, -6f), + Projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 7.5f, ModContent.ProjectileType(), - projectile.damage, - projectile.knockBack, - projectile.owner); + Projectile.damage, + Projectile.knockBack, + Projectile.owner); } } @@ -158,12 +158,12 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 5; i++) { float angle = MathHelper.Lerp(MathHelper.ToRadians(-Main.rand.NextFloat(30f, 36f)), MathHelper.ToRadians(Main.rand.NextFloat(30f, 36f)), i / 4f); - Projectile.NewProjectile(projectile.Center + Vector2.UnitY * -6f, + Projectile.NewProjectile(Projectile.Center + Vector2.UnitY * -6f, Vector2.UnitY.RotatedBy(angle) * -9f, ModContent.ProjectileType(), - projectile.damage, - projectile.knockBack, - projectile.owner); + Projectile.damage, + Projectile.knockBack, + Projectile.owner); } } } diff --git a/Projectiles/Summon/BlackHawkBullet.cs b/Projectiles/Summon/BlackHawkBullet.cs index e59b17622a..b995788ab6 100644 --- a/Projectiles/Summon/BlackHawkBullet.cs +++ b/Projectiles/Summon/BlackHawkBullet.cs @@ -9,26 +9,26 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Black Hawk Bullet"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 0; - projectile.extraUpdates = 4; - projectile.scale = 1.18f; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.light = 0.5f; + Projectile.alpha = 0; + Projectile.extraUpdates = 4; + Projectile.scale = 1.18f; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; } public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index 52761b8bc9..9b62086b6a 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class BlackHawkSummon : ModProjectile @@ -12,52 +13,52 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Black Hawk"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 36; - projectile.height = 36; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.aiStyle = 66; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = true; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 36; + Projectile.height = 36; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.aiStyle = 66; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = true; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { //Set namespaces - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - CalamityGlobalProjectile modProj = projectile.Calamity(); + CalamityGlobalProjectile modProj = Projectile.Calamity(); //On spawn effects - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { //Set constants modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; + modProj.spawnedPlayerMinionProjectileDamageValue = Projectile.damage; //Spawn dust int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 direction = Vector2.Normalize(projectile.velocity) * new Vector2(projectile.width / 2f, projectile.height) * 0.75f; - direction = direction.RotatedBy((double)((dustIndex - (dustAmt / 2f - 1f)) * MathHelper.TwoPi / dustAmt), default) + projectile.Center; - Vector2 dustVel = direction - projectile.Center; + Vector2 direction = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; + direction = direction.RotatedBy((double)((dustIndex - (dustAmt / 2f - 1f)) * MathHelper.TwoPi / dustAmt), default) + Projectile.Center; + Vector2 dustVel = direction - Projectile.Center; int fire = Dust.NewDust(direction + dustVel, 0, 0, 258, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity = dustVel; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } //Flexible minion damage update @@ -65,23 +66,23 @@ namespace CalamityMod.Projectiles.Summon { int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } //Update frames - projectile.frameCounter++; - if (projectile.frameCounter >= 4) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } //Set up buff and timeLeft - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) { @@ -91,25 +92,25 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.blackhawk) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } //Anti sticky movement to prevent overlapping minions - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); float maxDistance = 700f; - Vector2 targetVec = projectile.position; + Vector2 targetVec = Projectile.position; bool foundTarget = false; //If targeting something, prioritize that enemy if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); //Calculate distance between target and the projectile to know if it's too far or not - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); if (!foundTarget && targetDist < (maxDistance + extraDist)) { maxDistance = targetDist; @@ -123,11 +124,11 @@ namespace CalamityMod.Projectiles.Summon for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { NPC npc = Main.npc[npcIndex]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); //Calculate distance between target and the projectile to know if it's too far or not - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); if (!foundTarget && targetDist < (maxDistance + extraDist)) { maxDistance = targetDist; @@ -145,16 +146,16 @@ namespace CalamityMod.Projectiles.Summon //Max travel distance increases if targeting something separationAnxietyDist = 2600f; } - if (Vector2.Distance(player.Center, projectile.Center) > separationAnxietyDist) + if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } //If a target is found, move toward it - if (foundTarget && projectile.ai[0] == 0f) + if (foundTarget && Projectile.ai[0] == 0f) { - Vector2 vecToTarget = targetVec - projectile.Center; + Vector2 vecToTarget = targetVec - Projectile.Center; float targetDist = vecToTarget.Length(); vecToTarget.Normalize(); //If farther than 200 pixels, move toward it @@ -162,14 +163,14 @@ namespace CalamityMod.Projectiles.Summon { float speedMult = 18f; vecToTarget *= speedMult; - projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; } //Otherwise, back it up slowly else { float speedMult = -9f; vecToTarget *= speedMult; - projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; } } @@ -179,7 +180,7 @@ namespace CalamityMod.Projectiles.Summon bool returningToPlayer = false; if (!returningToPlayer) { - returningToPlayer = projectile.ai[0] == 1f; + returningToPlayer = Projectile.ai[0] == 1f; } //Move faster if actively returning to the player float speedMult = 12f; @@ -187,7 +188,7 @@ namespace CalamityMod.Projectiles.Summon { speedMult = 30f; } - Vector2 vecToPlayer = player.Center - projectile.Center + new Vector2(0f, -120f); + Vector2 vecToPlayer = player.Center - Projectile.Center + new Vector2(0f, -120f); float playerDist = vecToPlayer.Length(); //Speed up if near the player if (playerDist < 200f && speedMult < 16f) @@ -197,69 +198,69 @@ namespace CalamityMod.Projectiles.Summon //If close enough to the player, return to normal if (playerDist < 600f && returningToPlayer) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } //If abnormally far, teleport to the player if (playerDist > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } //Move toward player if more than 70 pixels away if (playerDist > 70f) { vecToPlayer.Normalize(); vecToPlayer *= speedMult; - projectile.velocity = (projectile.velocity * 40f + vecToPlayer) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vecToPlayer) / 41f; } //Move if still - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } } //Update rotation if (foundTarget) { - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(targetVec) + MathHelper.Pi, 0.1f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(targetVec) + MathHelper.Pi, 0.1f); } else { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi; } //Increment attack cooldown - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += Main.rand.Next(1, 4); + Projectile.ai[1] += Main.rand.Next(1, 4); } //Set the minion to be ready for attack - if (projectile.ai[1] > 130f) + if (Projectile.ai[1] > 130f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } //Return if on attack cooldown, has no target, or returning to the player - if (projectile.ai[0] != 0f || !foundTarget || projectile.ai[1] != 0f) + if (Projectile.ai[0] != 0f || !foundTarget || Projectile.ai[1] != 0f) return; //Shoot a bullet - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { float projSpeed = 6f; int projType = ModContent.ProjectileType(); - Main.PlaySound(SoundID.Item20, projectile.Center); - projectile.ai[1] += 2f; - Vector2 velocity = targetVec - projectile.Center; + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + Projectile.ai[1] += 2f; + Vector2 velocity = targetVec - Projectile.Center; velocity.Normalize(); velocity *= projSpeed; - Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, projectile.knockBack, projectile.owner); - projectile.netUpdate = true; + Projectile.NewProjectile(Projectile.Center, velocity, projType, Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.netUpdate = true; } } @@ -268,28 +269,28 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int y6 = frameHeight * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int y6 = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, spriteEffects, 0f); return false; } //Pretty glowmask public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/BlackHawkGlow"); - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int y6 = frameHeight * projectile.frame; + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Summon/BlackHawkGlow"); + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int y6 = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), Color.White, projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), Color.White, Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, spriteEffects, 0f); } } } diff --git a/Projectiles/Summon/BloodBreath.cs b/Projectiles/Summon/BloodBreath.cs index c33db801fd..0b11c1ac9b 100644 --- a/Projectiles/Summon/BloodBreath.cs +++ b/Projectiles/Summon/BloodBreath.cs @@ -9,33 +9,33 @@ namespace CalamityMod.Projectiles.Summon public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 2; - projectile.extraUpdates = 3; - projectile.timeLeft = 40; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 9; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = 2; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 40; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 9; } public override void AI() { - Lighting.AddLight(projectile.Center, projectile.Opacity * 0.77f, projectile.Opacity * 0.15f, projectile.Opacity * 0.08f); + Lighting.AddLight(Projectile.Center, Projectile.Opacity * 0.77f, Projectile.Opacity * 0.15f, Projectile.Opacity * 0.08f); Time++; if (Time > 7f) { @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Summon Time++; if (Main.rand.NextBool(2)) { - Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100); if (Main.rand.NextBool(3)) { dust.noGravity = true; @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Summon dust.scale *= dustScale; } } - projectile.rotation += 0.3f * projectile.direction; + Projectile.rotation += 0.3f * Projectile.direction; } } } diff --git a/Projectiles/Summon/BloodClotMinion.cs b/Projectiles/Summon/BloodClotMinion.cs index ae4a14a663..11e42f58d1 100644 --- a/Projectiles/Summon/BloodClotMinion.cs +++ b/Projectiles/Summon/BloodClotMinion.cs @@ -13,70 +13,70 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Clot"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 36; - projectile.height = 36; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 36; + Projectile.height = 36; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 1; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 5, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - int num1262 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, 0f, 0f, 0, default, 1f); + int num1262 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 5, 0f, 0f, 0, default, 1f); Main.dust[num1262].velocity *= 0.1f; Main.dust[num1262].scale = 0.7f; Main.dust[num1262].noGravity = true; - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -86,34 +86,34 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.bClot) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.MinionAntiClump(); - float num535 = projectile.position.X; - float num536 = projectile.position.Y; + Projectile.MinionAntiClump(); + float num535 = Projectile.position.X; + float num536 = Projectile.position.Y; float num537 = 1300f; bool flag19 = false; int num538 = 1100; - if (projectile.ai[1] != 0f) + if (Projectile.ai[1] != 0f) { num538 = 1800; } - if (Math.Abs(projectile.Center.X - player.Center.X) + Math.Abs(projectile.Center.Y - player.Center.Y) > (float)num538) + if (Math.Abs(Projectile.Center.X - player.Center.X) + Math.Abs(Projectile.Center.Y - player.Center.Y) > (float)num538) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float num539 = npc.position.X + (float)(npc.width / 2); float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float num541 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num539) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num540); + if (num541 < num537 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { num535 = num539; num536 = num540; @@ -125,12 +125,12 @@ namespace CalamityMod.Projectiles.Summon { for (int num542 = 0; num542 < Main.maxNPCs; num542++) { - if (Main.npc[num542].CanBeChasedBy(projectile, false)) + if (Main.npc[num542].CanBeChasedBy(Projectile, false)) { float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); - if (num545 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num542].position, Main.npc[num542].width, Main.npc[num542].height)) + float num545 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num543) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num544); + if (num545 < num537 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num542].position, Main.npc[num542].width, Main.npc[num542].height)) { num537 = num545; num535 = num543; @@ -144,61 +144,61 @@ namespace CalamityMod.Projectiles.Summon if (!flag19) { float num546 = 8f; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { num546 = 12f; } - Vector2 vector42 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector42 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num547 = player.Center.X - vector42.X; float num548 = player.Center.Y - vector42.Y - 60f; float num549 = (float)Math.Sqrt((double)(num547 * num547 + num548 * num548)); - if (num549 < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (num549 < 100f && Projectile.ai[0] == 1f && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; } if (num549 > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.width / 2); + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.width / 2); } if (num549 > 70f) { num549 = num546 / num549; num547 *= num549; num548 *= num549; - projectile.velocity.X = (projectile.velocity.X * 20f + num547) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num548) / 21f; + Projectile.velocity.X = (Projectile.velocity.X * 20f + num547) / 21f; + Projectile.velocity.Y = (Projectile.velocity.Y * 20f + num548) / 21f; } else { - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; } - projectile.rotation = projectile.velocity.X * 0.05f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + Projectile.rotation = Projectile.velocity.X * 0.05f; + if ((double)Math.Abs(Projectile.velocity.X) > 0.2) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; return; } } else { - if (projectile.ai[1] == -1f) + if (Projectile.ai[1] == -1f) { - projectile.ai[1] = 11f; + Projectile.ai[1] = 11f; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] -= 1f; + Projectile.ai[1] -= 1f; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { float num550 = 8f; //12 - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -209,20 +209,20 @@ namespace CalamityMod.Projectiles.Summon num553 = num550 / num553; num551 *= num553; num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; + Projectile.velocity.X = (Projectile.velocity.X * 14f + num551) / 15f; + Projectile.velocity.Y = (Projectile.velocity.Y * 14f + num552) / 15f; } else { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 10f) { - projectile.velocity *= 1.05f; + Projectile.velocity *= 1.05f; } } - projectile.rotation = projectile.velocity.X * 0.05f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + Projectile.rotation = Projectile.velocity.X * 0.05f; + if ((double)Math.Abs(Projectile.velocity.X) > 0.2) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; return; } } @@ -230,16 +230,16 @@ namespace CalamityMod.Projectiles.Summon public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) + Rectangle myRect = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == NPCID.Guide && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || - (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) + ((Projectile.friendly && (!Main.npc[i].friendly || Projectile.type == 318 || (Main.npc[i].type == NPCID.Guide && Projectile.owner < 255 && Main.player[Projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && Projectile.owner < 255 && Main.player[Projectile.owner].killClothier))) || + (Projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (Projectile.owner < 0 || Main.npc[i].immune[Projectile.owner] == 0 || Projectile.maxPenetrate == 1)) { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + if (Main.npc[i].noTileCollide || !Projectile.ownerHitCheck || Projectile.CanHit(Main.npc[i])) { bool flag3; if (Main.npc[i].type == NPCID.SolarCrawltipedeTail) @@ -250,21 +250,21 @@ namespace CalamityMod.Projectiles.Summon rect.Y -= num5; rect.Width += num5 * 2; rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); + flag3 = Projectile.Colliding(myRect, rect); } else { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + flag3 = Projectile.Colliding(myRect, Main.npc[i].getRect()); } if (flag3) { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + if (Main.npc[i].reflectingProjectiles && Projectile.CanReflect()) { - Main.npc[i].ReflectProjectile(projectile.whoAmI); + Main.npc[i].ReflectProjectile(Projectile.whoAmI); return; } - projectile.ai[1] = -1f; - projectile.netUpdate = true; + Projectile.ai[1] = -1f; + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Summon/BloodRain.cs b/Projectiles/Summon/BloodRain.cs index deeb0d98b0..963193ede7 100644 --- a/Projectiles/Summon/BloodRain.cs +++ b/Projectiles/Summon/BloodRain.cs @@ -11,30 +11,30 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Rain"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.aiStyle = 45; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.alpha = 255; - projectile.scale = 1.1f; - projectile.minion = true; + Projectile.width = 2; + Projectile.height = 2; + Projectile.aiStyle = 45; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.alpha = 255; + Projectile.scale = 1.1f; + Projectile.minion = true; aiType = ProjectileID.RainFriendly; } public override void AI() { - int blood = Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f); + int blood = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 5, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f); Dust dust = Main.dust[blood]; dust.velocity = Vector2.Zero; - dust.position -= projectile.velocity / 5f; + dust.position -= Projectile.velocity / 5f; dust.noGravity = true; dust.scale = 2f; dust.noLight = true; diff --git a/Projectiles/Summon/BloodSpit.cs b/Projectiles/Summon/BloodSpit.cs index 9342cd422b..4388f97711 100644 --- a/Projectiles/Summon/BloodSpit.cs +++ b/Projectiles/Summon/BloodSpit.cs @@ -11,31 +11,31 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Spit"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 150; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 150; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } public override void AI() { - Lighting.AddLight(projectile.Center, projectile.Opacity * 0.77f, projectile.Opacity * 0.15f, projectile.Opacity * 0.08f); - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (projectile.frameCounter++ > 4) + Lighting.AddLight(Projectile.Center, Projectile.Opacity * 0.77f, Projectile.Opacity * 0.15f, Projectile.Opacity * 0.08f); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (Projectile.frameCounter++ > 4) { - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; - projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frameCounter = 0; } } @@ -43,15 +43,15 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 15; i++) { - Dust dust = Dust.NewDustDirect(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust dust = Dust.NewDustDirect(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); dust.velocity = Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 2f); dust.noGravity = true; } - Main.player[projectile.owner].HealEffect(OnDeathHealValue, false); - Main.player[projectile.owner].statLife += OnDeathHealValue; - if (Main.player[projectile.owner].statLife > Main.player[projectile.owner].statLifeMax2) - Main.player[projectile.owner].statLife = Main.player[projectile.owner].statLifeMax2; + Main.player[Projectile.owner].HealEffect(OnDeathHealValue, false); + Main.player[Projectile.owner].statLife += OnDeathHealValue; + if (Main.player[Projectile.owner].statLife > Main.player[Projectile.owner].statLifeMax2) + Main.player[Projectile.owner].statLife = Main.player[Projectile.owner].statLifeMax2; } } } diff --git a/Projectiles/Summon/BoneMatter.cs b/Projectiles/Summon/BoneMatter.cs index fe8d9dcd88..28a725b344 100644 --- a/Projectiles/Summon/BoneMatter.cs +++ b/Projectiles/Summon/BoneMatter.cs @@ -8,28 +8,28 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Bone Matter"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 32; - projectile.friendly = true; - projectile.minion = true; - projectile.tileCollide = true; - projectile.penetrate = 1; + Projectile.width = 26; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.tileCollide = true; + Projectile.penetrate = 1; } public override void AI() { - if (projectile.frameCounter++ % 9 == 8) + if (Projectile.frameCounter++ % 9 == 8) { - projectile.frame++; - if (projectile.frame >= Main.projFrames[projectile.type]) + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Summon/BoneMatter2.cs b/Projectiles/Summon/BoneMatter2.cs index d483457b2c..b4d9dc75a7 100644 --- a/Projectiles/Summon/BoneMatter2.cs +++ b/Projectiles/Summon/BoneMatter2.cs @@ -8,29 +8,29 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Bone Matter"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 28; - projectile.friendly = true; - projectile.minion = true; - projectile.tileCollide = true; - projectile.penetrate = 1; + Projectile.width = 26; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.tileCollide = true; + Projectile.penetrate = 1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter % 9 == 8) + Projectile.frameCounter++; + if (Projectile.frameCounter % 9 == 8) { - projectile.frame++; - if (projectile.frame >= Main.projFrames[projectile.type]) + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Summon/BrimseekerAuraBall.cs b/Projectiles/Summon/BrimseekerAuraBall.cs index 7d15eaa910..d9ddb6e7d4 100644 --- a/Projectiles/Summon/BrimseekerAuraBall.cs +++ b/Projectiles/Summon/BrimseekerAuraBall.cs @@ -9,16 +9,16 @@ namespace CalamityMod.Projectiles.Summon public class BrimseekerAuraBall : ModProjectile { public bool Initialized = false; - public Projectile ParentProjectile => CalamityUtils.FindProjectileByIdentity((int)projectile.ai[0], projectile.owner); + public Projectile ParentProjectile => CalamityUtils.FindProjectileByIdentity((int)Projectile.ai[0], Projectile.owner); public float Outwardness { - get => projectile.localAI[0]; - set => projectile.localAI[0] = value; + get => Projectile.localAI[0]; + set => Projectile.localAI[0] = value; } public float RotationalSpeed { - get => projectile.localAI[1]; - set => projectile.localAI[1] = value; + get => Projectile.localAI[1]; + set => Projectile.localAI[1] = value; } public const float OutwardnessMovementStep = 4f; public const float MaxRotationalSpeed = 0.08f; @@ -26,46 +26,46 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Seeker"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.tileCollide = false; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.tileCollide = false; } public override void AI() { if (!Initialized) { - projectile.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); + Projectile.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); RotationalSpeed = Main.rand.NextFloat(-MaxRotationalSpeed, MaxRotationalSpeed); Initialized = true; } if (ParentProjectile is null) { - projectile.Kill(); + Projectile.Kill(); return; } - Vector2 offsetRelativeToTarget = Vector2.UnitY.RotatedBy(projectile.rotation) * Outwardness; + Vector2 offsetRelativeToTarget = Vector2.UnitY.RotatedBy(Projectile.rotation) * Outwardness; - projectile.Center = ParentProjectile.Center + offsetRelativeToTarget; - projectile.rotation += RotationalSpeed; + Projectile.Center = ParentProjectile.Center + offsetRelativeToTarget; + Projectile.rotation += RotationalSpeed; - if (projectile.timeLeft % 200 / OutwardnessMovementStep < 100 / OutwardnessMovementStep) + if (Projectile.timeLeft % 200 / OutwardnessMovementStep < 100 / OutwardnessMovementStep) Outwardness += OutwardnessMovementStep; else Outwardness -= OutwardnessMovementStep; - Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); dust.noGravity = true; dust.velocity.Y = -0.15f; } diff --git a/Projectiles/Summon/BrimstoneDartMinion.cs b/Projectiles/Summon/BrimstoneDartMinion.cs index 3b30f1771c..d16c50b287 100644 --- a/Projectiles/Summon/BrimstoneDartMinion.cs +++ b/Projectiles/Summon/BrimstoneDartMinion.cs @@ -14,44 +14,44 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Brimfire"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 18; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.penetrate = 1; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.alpha = 255; + Projectile.width = Projectile.height = 18; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.penetrate = 1; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.alpha = 255; } public override void AI() { - projectile.frameCounter++; - projectile.frame = projectile.frameCounter / 5 % Main.projFrames[projectile.type]; - projectile.Opacity = Utils.InverseLerp(300f, 285f, projectile.timeLeft, true) * Utils.InverseLerp(0f, 15f, projectile.timeLeft, true); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.Opacity = Utils.InverseLerp(300f, 285f, Projectile.timeLeft, true) * Utils.InverseLerp(0f, 15f, Projectile.timeLeft, true); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (projectile.velocity.Length() < 35f) - projectile.velocity *= 1.036f; + if (Projectile.velocity.Length() < 35f) + Projectile.velocity *= 1.036f; - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 240); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/BrimstoneDartSummon.cs b/Projectiles/Summon/BrimstoneDartSummon.cs index a4ac6a0e12..a6bcefabe9 100644 --- a/Projectiles/Summon/BrimstoneDartSummon.cs +++ b/Projectiles/Summon/BrimstoneDartSummon.cs @@ -13,40 +13,40 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Dart"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = projectile.height = 24; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.width = Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override void AI() { - if (projectile.velocity.Length() < 21f) - projectile.velocity *= 1.02f; + if (Projectile.velocity.Length() < 21f) + Projectile.velocity *= 1.02f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.frameCounter++; - if (projectile.frameCounter % 5 == 4) - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + if (Projectile.frameCounter % 5 == 4) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; - projectile.Opacity = Utils.InverseLerp(0f, 40f, projectile.timeLeft, true); + Projectile.Opacity = Utils.InverseLerp(0f, 40f, Projectile.timeLeft, true); - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -61,8 +61,8 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 15; i++) { - Dust brimstone = Dust.NewDustPerfect(projectile.Center, 267); - brimstone.velocity = projectile.velocity.RotatedByRandom(0.26f) * Main.rand.NextFloat(0.3f, 0.8f); + Dust brimstone = Dust.NewDustPerfect(Projectile.Center, 267); + brimstone.velocity = Projectile.velocity.RotatedByRandom(0.26f) * Main.rand.NextFloat(0.3f, 0.8f); brimstone.scale = Main.rand.NextFloat(1.5f, 1.85f); brimstone.color = Color.DarkRed; brimstone.noGravity = true; @@ -71,8 +71,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/BrimstoneElementalMinion.cs b/Projectiles/Summon/BrimstoneElementalMinion.cs index 89f59cf552..678b89ac17 100644 --- a/Projectiles/Summon/BrimstoneElementalMinion.cs +++ b/Projectiles/Summon/BrimstoneElementalMinion.cs @@ -15,36 +15,36 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Elemental"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 78; - projectile.height = 126; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 78; + Projectile.height = 126; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - bool flag64 = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool flag64 = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.brimstoneWaifu && !modPlayer.allWaifus) { - projectile.active = false; + Projectile.active = false; return; } if (flag64) @@ -55,66 +55,66 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.bWaifu) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } dust--; if (dust >= 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); + int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); Main.dust[num503].velocity *= 2f; Main.dust[num503].scale *= 1.15f; } } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - projectile.frameCounter++; - if (projectile.frameCounter > 16) + Projectile.frameCounter++; + if (Projectile.frameCounter > 16) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight(projectile.Center, 1.25f * num, 0f * num, 0.5f * num); - if (Math.Abs(projectile.velocity.X) > 0.2f) + Lighting.AddLight(Projectile.Center, 1.25f * num, 0f * num, 0.5f * num); + if (Math.Abs(Projectile.velocity.X) > 0.2f) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } float num633 = 700f; float num636 = 400f; //150 - projectile.MinionAntiClump(); - Vector2 vector46 = projectile.position; + Projectile.MinionAntiClump(); + Vector2 vector46 = Projectile.position; bool flag25 = false; - if (projectile.ai[0] != 1f) + if (Projectile.ai[0] != 1f) { - projectile.tileCollide = false; + Projectile.tileCollide = false; } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) + if (Projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16))) { - projectile.tileCollide = false; + Projectile.tileCollide = false; } if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float num646 = Vector2.Distance(npc.Center, Projectile.Center); + if ((!flag25 && num646 < num633) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { vector46 = npc.Center; flag25 = true; @@ -126,10 +126,10 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); + if ((!flag25 && num646 < num633) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num633 = num646; vector46 = nPC2.Center; @@ -138,79 +138,79 @@ namespace CalamityMod.Projectiles.Summon } } } - if (Vector2.Distance(player.Center, projectile.Center) > 1200f) + if (Vector2.Distance(player.Center, Projectile.Center) > 1200f) { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.tileCollide = false; + Projectile.netUpdate = true; } bool flag26 = false; if (!flag26) { - flag26 = projectile.ai[0] == 1f; + flag26 = Projectile.ai[0] == 1f; } float num650 = 5f; //6 if (flag26) { num650 = 12f; //15 } - Vector2 center2 = projectile.Center; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(-500f, -60f); //-60 float num651 = vector48.Length(); if (num651 > 200f && num650 < 6.5f) //200 and 8 { num650 = 6.5f; //8 } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (num651 < num636 && flag26 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (num651 > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.18f; - projectile.velocity.Y = -0.08f; + Projectile.velocity.X = -0.18f; + Projectile.velocity.Y = -0.08f; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 4); + Projectile.ai[1] += (float)Main.rand.Next(1, 4); } - if (projectile.ai[1] > 160f) + if (Projectile.ai[1] > 160f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } // Prevent firing immediately - if (projectile.localAI[0] < 120f) - projectile.localAI[0] += 1f; + if (Projectile.localAI[0] < 120f) + Projectile.localAI[0] += 1f; - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { float scaleFactor3 = 14f; int num658 = ModContent.ProjectileType(); - if (flag25 && projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) + if (flag25 && Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, vector46, 0, 0)) { - Vector2 value19 = vector46 - projectile.Center; + Vector2 value19 = vector46 - Projectile.Center; value19.Normalize(); value19 *= scaleFactor3; - int fire = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, projectile.owner, 0f, 0f); - projectile.netUpdate = true; + int fire = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, value19.X, value19.Y, num658, Projectile.damage, 0f, Projectile.owner, 0f, 0f); + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Summon/BrimstoneExplosionMinion.cs b/Projectiles/Summon/BrimstoneExplosionMinion.cs index bb026dec76..3c6c18ede2 100644 --- a/Projectiles/Summon/BrimstoneExplosionMinion.cs +++ b/Projectiles/Summon/BrimstoneExplosionMinion.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class BrimstoneExplosionMinion : ModProjectile @@ -14,43 +15,43 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 130; - projectile.height = 130; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 180; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 130; + Projectile.height = 130; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, 0.9f, 0f, 0f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); + Projectile.localAI[0] += 1f; } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -61,11 +62,11 @@ namespace CalamityMod.Projectiles.Summon num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Summon/BrimstoneFireSummon.cs b/Projectiles/Summon/BrimstoneFireSummon.cs index a04d83c75d..f7d0b381c4 100644 --- a/Projectiles/Summon/BrimstoneFireSummon.cs +++ b/Projectiles/Summon/BrimstoneFireSummon.cs @@ -13,47 +13,47 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 2; - projectile.extraUpdates = 3; - projectile.timeLeft = 50; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 9; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = 2; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 50; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 9; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - if (projectile.ai[0] > 7f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); + if (Projectile.ai[0] > 7f) { float scalar = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { scalar = 0.25f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { scalar = 0.5f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { scalar = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int dustType = (int)CalamityDusts.Brimstone; if (Main.rand.NextBool(2)) { - int brim = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int brim = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[brim]; if (Main.rand.NextBool(3)) { @@ -73,9 +73,9 @@ namespace CalamityMod.Projectiles.Summon } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/BrimstoneFireballMinion.cs b/Projectiles/Summon/BrimstoneFireballMinion.cs index 882cc555ae..b937a94ba9 100644 --- a/Projectiles/Summon/BrimstoneFireballMinion.cs +++ b/Projectiles/Summon/BrimstoneFireballMinion.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class BrimstoneFireballMinion : ModProjectile @@ -14,69 +15,69 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Brimfire"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 200; - projectile.penetrate = 2; - projectile.extraUpdates = 1; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.alpha = 255; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 200; + Projectile.penetrate = 2; + Projectile.extraUpdates = 1; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.alpha = 255; } public override void AI() { //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 9) + Projectile.frameCounter++; + if (Projectile.frameCounter > 9) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 6) + if (Projectile.frame >= 6) { - projectile.frame = 0; + Projectile.frame = 0; } //Fade in - if (projectile.alpha > 5) - projectile.alpha -= 15; - if (projectile.alpha < 5) - projectile.alpha = 5; + if (Projectile.alpha > 5) + Projectile.alpha -= 15; + if (Projectile.alpha < 5) + Projectile.alpha = 5; //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90) * projectile.direction; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90) * Projectile.direction; - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); + Main.dust[num458].velocity += Projectile.velocity * 0.1f; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); + Projectile.localAI[0] += 1f; } } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - int fire = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int fire = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } @@ -87,7 +88,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/BrimstoneLaserSummon.cs b/Projectiles/Summon/BrimstoneLaserSummon.cs index 7ad564cf6f..64527cc19e 100644 --- a/Projectiles/Summon/BrimstoneLaserSummon.cs +++ b/Projectiles/Summon/BrimstoneLaserSummon.cs @@ -12,30 +12,30 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Laser"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.aiStyle = 1; + Projectile.width = 2; + Projectile.height = 2; + Projectile.aiStyle = 1; aiType = ProjectileID.DeathLaser; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.alpha = 120; - projectile.timeLeft = 300; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = 1; + Projectile.alpha = 120; + Projectile.timeLeft = 300; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - projectile.velocity.X *= 1.05f; - projectile.velocity.Y *= 1.05f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); + Projectile.velocity.X *= 1.05f; + Projectile.velocity.Y *= 1.05f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -48,6 +48,6 @@ namespace CalamityMod.Projectiles.Summon target.AddBuff(ModContent.BuffType(), 120); } - public override Color? GetAlpha(Color lightColor) => new Color(250, 50, 50, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(250, 50, 50, Projectile.alpha); } } diff --git a/Projectiles/Summon/BrittleStarMinion.cs b/Projectiles/Summon/BrittleStarMinion.cs index 8e618a66bd..34ab7e4e46 100644 --- a/Projectiles/Summon/BrittleStarMinion.cs +++ b/Projectiles/Summon/BrittleStarMinion.cs @@ -12,43 +12,43 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Brittle Star"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; + Projectile.width = 30; + Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -58,12 +58,12 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.bStar) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.rotation += projectile.velocity.X * 0.04f; + Projectile.rotation += Projectile.velocity.X * 0.04f; - projectile.ChargingMinionAI(600f, 800f, 1200f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 9.5f, false, false); + Projectile.ChargingMinionAI(600f, 800f, 1200f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 9.5f, false, false); } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Summon/CalamariInk.cs b/Projectiles/Summon/CalamariInk.cs index c5da704bc7..39cbff5ace 100644 --- a/Projectiles/Summon/CalamariInk.cs +++ b/Projectiles/Summon/CalamariInk.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class CalamariInk : ModProjectile @@ -12,46 +13,46 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Ink"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.extraUpdates = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.extraUpdates = 1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) + if (Projectile.frame > 4) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - MathHelper.PiOver2; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int targetIdx = -1; float maxHomingRange = 400f; bool hasHomingTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < maxHomingRange) { targetIdx = player.MinionAttackTargetNPC; @@ -60,15 +61,15 @@ namespace CalamityMod.Projectiles.Summon } } } - else if (Main.npc[(int)projectile.ai[0]].active && projectile.ai[0] != -1f) + else if (Main.npc[(int)Projectile.ai[0]].active && Projectile.ai[0] != -1f) { - NPC npc = Main.npc[(int)projectile.ai[0]]; - if (npc.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[(int)Projectile.ai[0]]; + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < maxHomingRange) { - targetIdx = (int)projectile.ai[0]; + targetIdx = (int)Projectile.ai[0]; maxHomingRange = dist; hasHomingTarget = true; } @@ -82,9 +83,9 @@ namespace CalamityMod.Projectiles.Summon if (npc is null || !npc.active) continue; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < maxHomingRange) { targetIdx = i; @@ -99,18 +100,18 @@ namespace CalamityMod.Projectiles.Summon if (hasHomingTarget) { NPC target = Main.npc[targetIdx]; - Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * 10f; + Vector2 homingVector = (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * 10f; float homingRatio = 20f; - projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); + Projectile.velocity = (Projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -121,14 +122,14 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 48; - projectile.position.X = projectile.position.X - (projectile.width / 2); - projectile.position.Y = projectile.position.Y - (projectile.height / 2); - Main.PlaySound(SoundID.NPCKilled, (int)projectile.Center.X, (int)projectile.Center.Y, 28); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 48; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.Center.X, (int)Projectile.Center.Y, 28); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 54, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 54, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -138,10 +139,10 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 15; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 109, 0f, 0f, 100, default, 1.5f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 109, 0f, 0f, 100, default, 1.5f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 109, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 109, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Summon/CalamariMinion.cs b/Projectiles/Summon/CalamariMinion.cs index bf9b70ff0b..0b92fd87f3 100644 --- a/Projectiles/Summon/CalamariMinion.cs +++ b/Projectiles/Summon/CalamariMinion.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -14,72 +15,72 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Calamari"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.width = 40; + Projectile.height = 40; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() { - if (projectile.owner < 0 || projectile.owner >= Main.maxPlayers) + if (Projectile.owner < 0 || Projectile.owner >= Main.maxPlayers) { - projectile.Kill(); + Projectile.Kill(); return; } - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); //66% = 1.66 - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; //300 * 1.66 = 498 (new value) + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); //66% = 1.66 + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; //300 * 1.66 = 498 (new value) int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 109, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.localAI[1] += 1f; + Projectile.localAI[1] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) //15% = 1.15 != 1.66 + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) //15% = 1.15 != 1.66 { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / //498 - projectile.Calamity().spawnedPlayerMinionDamageValue * //1.66 498 / 1.66 = 300 (original value) + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / //498 + Projectile.Calamity().spawnedPlayerMinionDamageValue * //1.66 498 / 1.66 = 300 (original value) player.MinionDamage()); //300 * 1.15 = 345 (new value) - projectile.damage = damage2; + Projectile.damage = damage2; } - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) + if (Projectile.frame > 4) { - projectile.frame = 0; + Projectile.frame = 0; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -89,53 +90,53 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.calamari) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } if (Main.rand.NextBool(600)) { - Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 35); + SoundEngine.PlaySound(SoundID.Zombie, (int)Projectile.position.X, (int)Projectile.position.Y, 35); } - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - projectile.ai[1] -= 1f; - if (projectile.ai[1] > 3f) + Projectile.ai[1] -= 1f; + if (Projectile.ai[1] > 3f) { - Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 34); - int num = Dust.NewDust(projectile.Center, 0, 0, 109, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.4f); + SoundEngine.PlaySound(SoundID.Zombie, (int)Projectile.position.X, (int)Projectile.position.Y, 34); + int num = Dust.NewDust(Projectile.Center, 0, 0, 109, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.4f); Main.dust[num].scale = 0.5f + (float)Main.rand.NextDouble() * 0.3f; Main.dust[num].velocity /= 2.5f; Main.dust[num].noGravity = true; Main.dust[num].noLight = true; } - if (projectile.ai[1] != 0f) + if (Projectile.ai[1] != 0f) { return; } - projectile.ai[1] = 15f; - projectile.ai[0] = 0f; - projectile.velocity /= 5f; - projectile.velocity.Y = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; + Projectile.ai[1] = 15f; + Projectile.ai[0] = 0f; + Projectile.velocity /= 5f; + Projectile.velocity.Y = 0f; + Projectile.extraUpdates = 0; + Projectile.numUpdates = 0; + Projectile.netUpdate = true; + Projectile.extraUpdates = 0; + Projectile.numUpdates = 0; } - if (projectile.extraUpdates > 1) + if (Projectile.extraUpdates > 1) { - projectile.extraUpdates = 0; + Projectile.extraUpdates = 0; } - if (projectile.numUpdates > 1) + if (Projectile.numUpdates > 1) { - projectile.numUpdates = 0; + Projectile.numUpdates = 0; } - if (projectile.localAI[0] > 0f) + if (Projectile.localAI[0] > 0f) { - projectile.localAI[0] -= 1f; + Projectile.localAI[0] -= 1f; } - projectile.MinionAntiClump(); - Vector2 vector = projectile.position; + Projectile.MinionAntiClump(); + Vector2 vector = Projectile.position; float num10 = 3000f; bool flag = false; Vector2 center = player.Center; @@ -145,11 +146,11 @@ namespace CalamityMod.Projectiles.Summon if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { Vector2 vector2 = npc.position + npc.Size * value; float num12 = Vector2.Distance(vector2, center); - if (!flag && num12 < num10 && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + if (!flag && num12 < num10 && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { vector = vector2; flag = true; @@ -162,11 +163,11 @@ namespace CalamityMod.Projectiles.Summon for (int k = 0; k < Main.maxNPCs; k++) { NPC nPC = Main.npc[k]; - if (nPC.CanBeChasedBy(projectile, false)) + if (nPC.CanBeChasedBy(Projectile, false)) { Vector2 vector3 = nPC.position + nPC.Size * value; float num13 = Vector2.Distance(vector3, center); - if (!flag && num13 < num10 && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC.position, nPC.width, nPC.height)) + if (!flag && num13 < num10 && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC.position, nPC.width, nPC.height)) { num10 = num13; vector = vector3; @@ -181,14 +182,14 @@ namespace CalamityMod.Projectiles.Summon { num16 = 4000; } - if (Vector2.Distance(player.Center, projectile.Center) > num16) + if (Vector2.Distance(player.Center, Projectile.Center) > num16) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } - if (flag && projectile.ai[0] == 0f) + if (flag && Projectile.ai[0] == 0f) { - Vector2 vector4 = vector - projectile.Center; + Vector2 vector4 = vector - Projectile.Center; float num17 = vector4.Length(); vector4.Normalize(); vector4 = vector - Vector2.UnitY * 80f; @@ -198,33 +199,33 @@ namespace CalamityMod.Projectiles.Summon num18 = 0; } Tile tile = Main.tile[(int)vector4.X / 16, num18]; - if (tile != null && tile.active() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type]) + if (tile != null && tile.active() && Main.tileSolid[tile.TileType] && !Main.tileSolidTop[tile.TileType]) { vector4 += Vector2.UnitY * 16f; tile = Main.tile[(int)vector4.X / 16, (int)vector4.Y / 16]; - if (tile != null && tile.active() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type]) + if (tile != null && tile.active() && Main.tileSolid[tile.TileType] && !Main.tileSolidTop[tile.TileType]) { vector4 += Vector2.UnitY * 16f; } } - vector4 -= projectile.Center; + vector4 -= Projectile.Center; num17 = vector4.Length(); vector4.Normalize(); - if (num17 > 300f && num17 <= 1600f && projectile.localAI[0] == 0f) + if (num17 > 300f && num17 <= 1600f && Projectile.localAI[0] == 0f) { - projectile.ai[0] = 2f; - projectile.ai[1] = (int)(num17 / 10f); - projectile.extraUpdates = (int)(projectile.ai[1] * 2f); - projectile.velocity = vector4 * 10f; - projectile.localAI[0] = 60f; + Projectile.ai[0] = 2f; + Projectile.ai[1] = (int)(num17 / 10f); + Projectile.extraUpdates = (int)(Projectile.ai[1] * 2f); + Projectile.velocity = vector4 * 10f; + Projectile.localAI[0] = 60f; return; } if (num17 > 200f) { float scaleFactor2 = 20f; vector4 *= scaleFactor2; - projectile.velocity.X = (projectile.velocity.X * 40f + vector4.X) / 41f; - projectile.velocity.Y = (projectile.velocity.Y * 40f + vector4.Y) / 41f; + Projectile.velocity.X = (Projectile.velocity.X * 40f + vector4.X) / 41f; + Projectile.velocity.Y = (Projectile.velocity.Y * 40f + vector4.Y) / 41f; } if (num17 > 70f && num17 < 130f) { @@ -234,97 +235,97 @@ namespace CalamityMod.Projectiles.Summon scaleFactor3 = -7.5f; } vector4 *= scaleFactor3; - projectile.velocity = (projectile.velocity * 20f + vector4) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + vector4) / 21f; if (Math.Abs(vector4.X) > Math.Abs(vector4.Y)) { - projectile.velocity.X = (projectile.velocity.X * 10f + vector4.X) / 11f; + Projectile.velocity.X = (Projectile.velocity.X * 10f + vector4.X) / 11f; } } else { - projectile.velocity *= 0.97f; + Projectile.velocity *= 0.97f; } } else { - if (!Collision.CanHitLine(projectile.Center, 1, 1, Main.player[projectile.owner].Center, 1, 1)) + if (!Collision.CanHitLine(Projectile.Center, 1, 1, Main.player[Projectile.owner].Center, 1, 1)) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } float num21 = 12f; //6 - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { num21 = 18f; //15 } - Vector2 center2 = projectile.Center; + Vector2 center2 = Projectile.Center; Vector2 vector6 = player.Center - center2 + new Vector2(0f, -60f); float num23 = vector6.Length(); if (num23 > 200f && num21 < 13.5f) { num21 = 13.5f; //9 } - if (num23 < 800f && projectile.ai[0] == 1f) + if (num23 < 800f && Projectile.ai[0] == 1f) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (num23 > 4000f) { - projectile.position.X = player.Center.X - (projectile.width / 2); - projectile.position.Y = player.Center.Y - (projectile.width / 2); + Projectile.position.X = player.Center.X - (Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (Projectile.width / 2); } if (num23 > 70f) { vector6.Normalize(); vector6 *= num21; - projectile.velocity = (projectile.velocity * 20f + vector6) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + vector6) / 21f; } else { - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; } } - projectile.rotation = projectile.velocity.X * 0.025f; - if (projectile.ai[1] > 0f) + Projectile.rotation = Projectile.velocity.X * 0.025f; + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; if (Main.rand.Next(2) != 0) { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; } } - if (projectile.ai[1] > 20f) + if (Projectile.ai[1] > 20f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { float scaleFactor4 = 12f; int num28 = ModContent.ProjectileType(); if (flag) { - if (Math.Abs((vector - projectile.Center).ToRotation() - MathHelper.PiOver2) > MathHelper.PiOver4) + if (Math.Abs((vector - Projectile.Center).ToRotation() - MathHelper.PiOver2) > MathHelper.PiOver4) { - projectile.velocity += Vector2.Normalize(vector - projectile.Center - Vector2.UnitY * 80f); + Projectile.velocity += Vector2.Normalize(vector - Projectile.Center - Vector2.UnitY * 80f); return; } - if ((vector - projectile.Center).Length() <= 600f && projectile.ai[1] == 0f) + if ((vector - Projectile.Center).Length() <= 600f && Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner) { - Main.PlaySound(SoundID.Item111, (int)projectile.position.X, (int)projectile.position.Y); - Vector2 vector7 = vector - projectile.Center; + SoundEngine.PlaySound(SoundID.Item111, (int)Projectile.position.X, (int)Projectile.position.Y); + Vector2 vector7 = vector - Projectile.Center; vector7.Normalize(); vector7 *= scaleFactor4; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y + 20, vector7.X, vector7.Y, num28, projectile.damage, 0f, Main.myPlayer, targetIndex, 0f); - projectile.netUpdate = true; + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y + 20, vector7.X, vector7.Y, num28, Projectile.damage, 0f, Main.myPlayer, targetIndex, 0f); + Projectile.netUpdate = true; } } } @@ -333,10 +334,10 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index 2cf59e15e3..a35be8e96b 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -19,54 +19,54 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Calamitamini"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 36; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = Projectile.height = 36; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { - Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 dustVel = source - projectile.Center; + Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 dustVel = source - Projectile.Center; int brim = Dust.NewDust(source + dustVel, 0, 0, (int)CalamityDusts.Brimstone, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); Main.dust[brim].noGravity = true; Main.dust[brim].velocity = dustVel; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + Projectile.damage = damage2; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) { @@ -76,36 +76,36 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.cEyes) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 2) + if (Projectile.frame > 2) { - projectile.frame = 0; + Projectile.frame = 0; } - Vector2 targetVec = projectile.position; + Vector2 targetVec = Projectile.position; float maxDistance = Range; bool foundTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); bool canHit = true; if (extraDist < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); if (!foundTarget && targetDist < (maxDistance + extraDist) && canHit) { targetVec = npc.Center; @@ -118,13 +118,13 @@ namespace CalamityMod.Projectiles.Summon for (int index = 0; index < Main.maxNPCs; index++) { NPC npc = Main.npc[index]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); bool canHit = true; if (extraDist < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); if (!foundTarget && targetDist < (maxDistance + extraDist) && canHit) { targetVec = npc.Center; @@ -138,28 +138,28 @@ namespace CalamityMod.Projectiles.Summon { sepAnxietyDist = SeparationAnxietyMax; } - if (Vector2.Distance(player.Center, projectile.Center) > sepAnxietyDist) + if (Vector2.Distance(player.Center, Projectile.Center) > sepAnxietyDist) { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.tileCollide = false; + Projectile.netUpdate = true; } - if (foundTarget && projectile.ai[0] == 0f) + if (foundTarget && Projectile.ai[0] == 0f) { - Vector2 vecToTarget = targetVec - projectile.Center; + Vector2 vecToTarget = targetVec - Projectile.Center; float targetDist = vecToTarget.Length(); vecToTarget.Normalize(); if (targetDist > 200f) { float speedMult = 8f; //6 vecToTarget *= speedMult; - projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; } else { float speedMult = -4f; vecToTarget *= speedMult; - projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; } } else @@ -167,76 +167,76 @@ namespace CalamityMod.Projectiles.Summon bool returningToPlayer = false; if (!returningToPlayer) { - returningToPlayer = projectile.ai[0] == 1f; + returningToPlayer = Projectile.ai[0] == 1f; } float returnSpeed = 6f; if (returningToPlayer) { returnSpeed = 18f; } - Vector2 returnSpot = player.Center - projectile.Center + new Vector2(0f, -60f); + Vector2 returnSpot = player.Center - Projectile.Center + new Vector2(0f, -60f); float playerDist = returnSpot.Length(); if (playerDist > 200f && returnSpeed < 10f) { returnSpeed = 10f; } - if (playerDist < SafeDist && returningToPlayer && !Collision.SolidCollision(projectile.Center, projectile.width, projectile.height)) + if (playerDist < SafeDist && returningToPlayer && !Collision.SolidCollision(Projectile.Center, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (playerDist > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (playerDist > 70f) { returnSpot.Normalize(); returnSpot *= returnSpeed; - projectile.velocity = (projectile.velocity * 40f + returnSpot) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + returnSpot) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } } //Update rotation if (foundTarget) { - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(targetVec) + MathHelper.Pi, 0.1f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(targetVec) + MathHelper.Pi, 0.1f); } else { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 4); + Projectile.ai[1] += (float)Main.rand.Next(1, 4); } - if (projectile.ai[1] > 110f) + if (Projectile.ai[1] > 110f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { float projSpeed = 8f; int projType = ModContent.ProjectileType(); - if (foundTarget && projectile.ai[1] == 0f) + if (foundTarget && Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.Center, projectile.width, projectile.height, targetVec, 0, 0)) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.Center, Projectile.width, Projectile.height, targetVec, 0, 0)) { - Vector2 velocity = targetVec - projectile.Center; + Vector2 velocity = targetVec - Projectile.Center; velocity.Normalize(); velocity *= projSpeed; - Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - projectile.netUpdate = true; + Projectile.NewProjectile(Projectile.Center, velocity, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.netUpdate = true; } } } @@ -244,11 +244,11 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int yStart = frameHeight * projectile.frame; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, yStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int yStart = frameHeight * Projectile.frame; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, yStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, spriteEffects, 0f); return false; } diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index ea1bc68287..ba2770113b 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -13,54 +13,54 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Cataclymini"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 32; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = Projectile.height = 32; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0.5f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { - Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 dustVel = source - projectile.Center; + Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 dustVel = source - Projectile.Center; int brim = Dust.NewDust(source + dustVel, 0, 0, (int)CalamityDusts.Brimstone, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); Main.dust[brim].noGravity = true; Main.dust[brim].velocity = dustVel; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + Projectile.damage = damage2; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (correctMinion) { if (player.dead) @@ -69,36 +69,36 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.cEyes) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 2) + if (Projectile.frame > 2) { - projectile.frame = 0; + Projectile.frame = 0; } bool foundTarget = false; - Vector2 targetVec = projectile.position; + Vector2 targetVec = Projectile.position; float maxDistance = Calamitamini.Range; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); bool canHit = true; if (extraDist < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); if (!foundTarget && targetDist < (maxDistance + extraDist) && canHit) { targetVec = npc.Center; @@ -111,13 +111,13 @@ namespace CalamityMod.Projectiles.Summon for (int index = 0; index < Main.maxNPCs; index++) { NPC npc = Main.npc[index]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); bool canHit = true; if (extraDist < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); if (!foundTarget && targetDist < (maxDistance + extraDist) && canHit) { targetVec = npc.Center; @@ -131,28 +131,28 @@ namespace CalamityMod.Projectiles.Summon { sepAnxietyDist = Calamitamini.SeparationAnxietyMax; } - if (Vector2.Distance(player.Center, projectile.Center) > sepAnxietyDist) + if (Vector2.Distance(player.Center, Projectile.Center) > sepAnxietyDist) { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.tileCollide = false; + Projectile.netUpdate = true; } - if (foundTarget && projectile.ai[0] == 0f) + if (foundTarget && Projectile.ai[0] == 0f) { - Vector2 vecToTarget = targetVec - projectile.Center; + Vector2 vecToTarget = targetVec - Projectile.Center; float targetDist = vecToTarget.Length(); vecToTarget.Normalize(); if (targetDist > 200f) { float speedMult = 8f; //6 vecToTarget *= speedMult; - projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; } else { float speedMult = -4f; vecToTarget *= speedMult; - projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; } } else @@ -160,77 +160,77 @@ namespace CalamityMod.Projectiles.Summon bool returningToPlayer = false; if (!returningToPlayer) { - returningToPlayer = projectile.ai[0] == 1f; + returningToPlayer = Projectile.ai[0] == 1f; } float returnSpeed = 6f; if (returningToPlayer) { returnSpeed = 18f; } - Vector2 returnSpot = player.Center - projectile.Center + new Vector2(0f, -60f); + Vector2 returnSpot = player.Center - Projectile.Center + new Vector2(0f, -60f); float playerDist = returnSpot.Length(); if (playerDist > 200f && returnSpeed < 10f) { returnSpeed = 10f; } - if (playerDist < Calamitamini.SafeDist && returningToPlayer && !Collision.SolidCollision(projectile.Center, projectile.width, projectile.height)) + if (playerDist < Calamitamini.SafeDist && returningToPlayer && !Collision.SolidCollision(Projectile.Center, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (playerDist > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (playerDist > 70f) { returnSpot.Normalize(); returnSpot *= returnSpeed; - projectile.velocity = (projectile.velocity * 40f + returnSpot) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + returnSpot) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.25f; - projectile.velocity.Y = -0.15f; + Projectile.velocity.X = -0.25f; + Projectile.velocity.Y = -0.15f; } } //Update rotation if (foundTarget) { - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(targetVec) + MathHelper.Pi, 0.1f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(targetVec) + MathHelper.Pi, 0.1f); } else { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 30); + Projectile.ai[1] += (float)Main.rand.Next(1, 30); } - if (projectile.ai[1] > 90f) + if (Projectile.ai[1] > 90f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { float projSpeed = 8f; int projType = ModContent.ProjectileType(); - if (foundTarget && projectile.ai[1] == 0f) + if (foundTarget && Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.Center, projectile.width, projectile.height, targetVec, 0, 0)) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.Center, Projectile.width, Projectile.height, targetVec, 0, 0)) { - Vector2 velocity = targetVec - projectile.Center; + Vector2 velocity = targetVec - Projectile.Center; velocity.Normalize(); velocity *= projSpeed; - Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - projectile.netUpdate = true; + Projectile.NewProjectile(Projectile.Center, velocity, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.netUpdate = true; } } } @@ -238,11 +238,11 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int yStart = frameHeight * projectile.frame; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, yStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int yStart = frameHeight * Projectile.frame; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, yStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, spriteEffects, 0f); return false; } diff --git a/Projectiles/Summon/CataclysmSummon.cs b/Projectiles/Summon/CataclysmSummon.cs index 8a50392cb4..9a3a19cb2c 100644 --- a/Projectiles/Summon/CataclysmSummon.cs +++ b/Projectiles/Summon/CataclysmSummon.cs @@ -4,50 +4,51 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class CataclysmSummon : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public bool LookingAtPlayer => Time < 45f; public override string Texture => "CalamityMod/NPCs/SupremeCalamitas/SupremeCataclysm"; public override void SetStaticDefaults() { DisplayName.SetDefault("Cataclysm"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[projectile.type] = false; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = false; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = false; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = false; } public override void SetDefaults() { - projectile.width = projectile.height = 100; - projectile.netImportant = true; - projectile.friendly = true; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 90000; - projectile.penetrate = -1; - projectile.Opacity = 0f; - projectile.tileCollide = false; - projectile.minion = true; + Projectile.width = Projectile.height = 100; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.Opacity = 0f; + Projectile.tileCollide = false; + Projectile.minion = true; } public override void AI() { if (LookingAtPlayer) - projectile.frame = (int)Math.Round(MathHelper.Lerp(0f, 9f, Time / 45f)); + Projectile.frame = (int)Math.Round(MathHelper.Lerp(0f, 9f, Time / 45f)); else { float punchInterpolant = ((Time - 45f) / 35f) % 1f; - projectile.frame = (int)Math.Round(MathHelper.Lerp(12f, 21f, punchInterpolant)); + Projectile.frame = (int)Math.Round(MathHelper.Lerp(12f, 21f, punchInterpolant)); } - Behavior(projectile, Main.player[projectile.owner], ref Time); + Behavior(Projectile, Main.player[Projectile.owner], ref Time); } public static void Behavior(Projectile projectile, Player owner, ref float time) @@ -74,8 +75,8 @@ namespace CalamityMod.Projectiles.Summon projectile.rotation = projectile.velocity.X * 0.0125f; projectile.damage = (int)(projectile.damage * 1.45); - Main.PlaySound(SoundID.DD2_BetsyFlameBreath, owner.Center); - Main.PlaySound(SoundID.DD2_WyvernDiveDown, owner.Center); + SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath, owner.Center); + SoundEngine.PlaySound(SoundID.DD2_WyvernDiveDown, owner.Center); } time++; @@ -102,26 +103,26 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Rectangle frame = texture.Frame(3, 9, projectile.frame / 9, projectile.frame % 9); + Texture2D texture = Main.projectileTexture[Projectile.type]; + Rectangle frame = texture.Frame(3, 9, Projectile.frame / 9, Projectile.frame % 9); Vector2 origin = frame.Size() * 0.5f; - for (int i = 0; i < projectile.oldPos.Length; i++) + for (int i = 0; i < Projectile.oldPos.Length; i++) { - float afterimageRot = projectile.oldRot[i]; - SpriteEffects sfxForThisAfterimage = projectile.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + float afterimageRot = Projectile.oldRot[i]; + SpriteEffects sfxForThisAfterimage = Projectile.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 drawPos = projectile.oldPos[i] + projectile.Size * 0.5f - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY; - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / projectile.oldPos.Length); - spriteBatch.Draw(texture, drawPos, frame, color, afterimageRot, origin, projectile.scale, sfxForThisAfterimage, 0f); + Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; + Color color = Projectile.GetAlpha(lightColor) * ((float)(Projectile.oldPos.Length - i) / Projectile.oldPos.Length); + spriteBatch.Draw(texture, drawPos, frame, color, afterimageRot, origin, Projectile.scale, sfxForThisAfterimage, 0f); } - SpriteEffects direction = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, direction, 0f); + SpriteEffects direction = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0f); return false; } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = 70; - public override bool CanDamage() => projectile.Opacity >= 1f; + public override bool CanDamage() => Projectile.Opacity >= 1f; } } diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index fc898f8a4f..3e0283bd49 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -13,54 +13,54 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Catastromini"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 36; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 8; + Projectile.width = Projectile.height = 36; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0.5f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { - Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 dustVel = source - projectile.Center; + Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 dustVel = source - Projectile.Center; int brim = Dust.NewDust(source + dustVel, 0, 0, (int)CalamityDusts.Brimstone, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); Main.dust[brim].noGravity = true; Main.dust[brim].velocity = dustVel; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + Projectile.damage = damage2; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (correctMinion) { if (player.dead) @@ -69,32 +69,32 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.cEyes) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; - projectile.frameCounter++; - if (projectile.frameCounter > (projectile.ai[0] == 2f ? 1 : 3)) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi; + Projectile.frameCounter++; + if (Projectile.frameCounter > (Projectile.ai[0] == 2f ? 1 : 3)) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 2) + if (Projectile.frame > 2) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.ChargingMinionAI(Calamitamini.Range, Calamitamini.SeparationAnxietyMin, Calamitamini.SeparationAnxietyMax, Calamitamini.SafeDist, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 8f, false, true); + Projectile.ChargingMinionAI(Calamitamini.Range, Calamitamini.SeparationAnxietyMin, Calamitamini.SeparationAnxietyMax, Calamitamini.SafeDist, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 8f, false, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int yStart = frameHeight * projectile.frame; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, yStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int yStart = frameHeight * Projectile.frame; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, yStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Summon/CatastropheSummon.cs b/Projectiles/Summon/CatastropheSummon.cs index b56241a327..63c7c7118c 100644 --- a/Projectiles/Summon/CatastropheSummon.cs +++ b/Projectiles/Summon/CatastropheSummon.cs @@ -9,68 +9,68 @@ namespace CalamityMod.Projectiles.Summon { public class CatastropheSummon : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public bool LookingAtPlayer => Time < 45f; public override string Texture => "CalamityMod/NPCs/SupremeCalamitas/SupremeCatastrophe"; public override void SetStaticDefaults() { DisplayName.SetDefault("Catastrophe"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[projectile.type] = false; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = false; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = false; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = false; } public override void SetDefaults() { - projectile.width = projectile.height = 120; - projectile.netImportant = true; - projectile.friendly = true; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 90000; - projectile.penetrate = -1; - projectile.Opacity = 0f; - projectile.tileCollide = false; - projectile.minion = true; + Projectile.width = Projectile.height = 120; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.Opacity = 0f; + Projectile.tileCollide = false; + Projectile.minion = true; } public override void AI() { if (LookingAtPlayer) - projectile.frame = (int)Math.Round(MathHelper.Lerp(0f, 6f, Time / 45f)); + Projectile.frame = (int)Math.Round(MathHelper.Lerp(0f, 6f, Time / 45f)); else { float slashInterpolant = ((Time - 45f) / 27f) % 1f; - projectile.frame = (int)Math.Round(MathHelper.Lerp(6f, 15f, slashInterpolant)); + Projectile.frame = (int)Math.Round(MathHelper.Lerp(6f, 15f, slashInterpolant)); } - CataclysmSummon.Behavior(projectile, Main.player[projectile.owner], ref Time); + CataclysmSummon.Behavior(Projectile, Main.player[Projectile.owner], ref Time); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Rectangle frame = texture.Frame(2, 8, projectile.frame / 8, projectile.frame % 8); + Texture2D texture = Main.projectileTexture[Projectile.type]; + Rectangle frame = texture.Frame(2, 8, Projectile.frame / 8, Projectile.frame % 8); Vector2 origin = frame.Size() * 0.5f; - for (int i = 0; i < projectile.oldPos.Length; i++) + for (int i = 0; i < Projectile.oldPos.Length; i++) { - float afterimageRot = projectile.oldRot[i]; - SpriteEffects sfxForThisAfterimage = projectile.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + float afterimageRot = Projectile.oldRot[i]; + SpriteEffects sfxForThisAfterimage = Projectile.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 drawPos = projectile.oldPos[i] + projectile.Size * 0.5f - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY; - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / projectile.oldPos.Length); - spriteBatch.Draw(texture, drawPos, frame, color, afterimageRot, origin, projectile.scale, sfxForThisAfterimage, 0f); + Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; + Color color = Projectile.GetAlpha(lightColor) * ((float)(Projectile.oldPos.Length - i) / Projectile.oldPos.Length); + spriteBatch.Draw(texture, drawPos, frame, color, afterimageRot, origin, Projectile.scale, sfxForThisAfterimage, 0f); } - SpriteEffects direction = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, direction, 0f); + SpriteEffects direction = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0f); return false; } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = 70; - public override bool CanDamage() => projectile.Opacity >= 1f; + public override bool CanDamage() => Projectile.Opacity >= 1f; } } diff --git a/Projectiles/Summon/CausticStaffProjectile.cs b/Projectiles/Summon/CausticStaffProjectile.cs index e19a77c21f..0ae89e2b92 100644 --- a/Projectiles/Summon/CausticStaffProjectile.cs +++ b/Projectiles/Summon/CausticStaffProjectile.cs @@ -10,49 +10,49 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Thorn"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.timeLeft = 360; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.extraUpdates = 1; - projectile.tileCollide = false; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 360; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.extraUpdates = 1; + Projectile.tileCollide = false; } public override void AI() { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 0, default, 0.5f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 0, default, 0.5f); Dust dust = Main.dust[fire]; dust.velocity *= 0.1f; dust.scale = 1.3f; dust.noGravity = true; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.velocity.X *= 0.99f; - if (projectile.velocity.Y < 9f) - projectile.velocity.Y += 0.085f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity.X *= 0.99f; + if (Projectile.velocity.Y < 9f) + Projectile.velocity.Y += 0.085f; } public override void Kill(int timeLeft) { for (int i = 0; i < 5; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, DustID.Fire); + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.Fire); dust.noGravity = true; dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if ((player.ActiveItem().summon && !player.ActiveItem().melee && !player.ActiveItem().ranged && @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon player.ActiveItem().axe > 0) { int duration = Main.rand.Next(60, 181); // Anywhere between 1 and 3 seconds - switch ((int)projectile.ai[0]) + switch ((int)Projectile.ai[0]) { case 0: if (target.Calamity().marked <= 0) diff --git a/Projectiles/Summon/CausticStaffSummon.cs b/Projectiles/Summon/CausticStaffSummon.cs index 2708a44b10..2c0f9ad9c8 100644 --- a/Projectiles/Summon/CausticStaffSummon.cs +++ b/Projectiles/Summon/CausticStaffSummon.cs @@ -14,41 +14,41 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Caustic Dragon"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; + Projectile.width = 26; + Projectile.height = 26; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); //Spawn dust and record initial damage values if (!initialized) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int dusty = Dust.NewDust(vector6 + vector7, 0, 0, DustID.Fire, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; @@ -58,16 +58,16 @@ namespace CalamityMod.Projectiles.Summon } //if minion damage changes, update it - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } //If the correct minion, set bools and apply buffs - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) { @@ -77,27 +77,27 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.causticDragon) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } //Anti sticky movement to prevent minions from stacking - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); //Set tile collision for only when trying to return to the player - projectile.tileCollide = projectile.ai[0] != 1f; + Projectile.tileCollide = Projectile.ai[0] != 1f; //Find an enemy - Vector2 targetPos = projectile.position; + Vector2 targetPos = Projectile.position; float maxRange = 900f; bool foundEnemy = false; int targetIndex = -1; //If the player has targetted an enemy, choose that one - NPC target = projectile.OwnerMinionAttackTargetNPC; - if (target != null && target.CanBeChasedBy(projectile, false)) + NPC target = Projectile.OwnerMinionAttackTargetNPC; + if (target != null && target.CanBeChasedBy(Projectile, false)) { - float targetDist = Vector2.Distance(target.Center, projectile.Center); - if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, target.position, target.width, target.height)) + float targetDist = Vector2.Distance(target.Center, Projectile.Center); + if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, target.position, target.width, target.height)) { maxRange = targetDist; targetPos = target.Center; @@ -111,10 +111,10 @@ namespace CalamityMod.Projectiles.Summon for (int index = 0; index < Main.maxNPCs; ++index) { NPC npc = Main.npc[index]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float targetDist = Vector2.Distance(npc.Center, projectile.Center); - if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { maxRange = targetDist; targetPos = npc.Center; @@ -129,58 +129,58 @@ namespace CalamityMod.Projectiles.Summon float maxDistanceFromPlayer = 1300f; if (foundEnemy) maxDistanceFromPlayer = 1600f; - if (Vector2.Distance(player.Center, projectile.Center) > maxDistanceFromPlayer && projectile.ai[0] != 1f) + if (Vector2.Distance(player.Center, Projectile.Center) > maxDistanceFromPlayer && Projectile.ai[0] != 1f) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } //Move toward an enemy if one has been found - if (foundEnemy && projectile.ai[0] == 0f) + if (foundEnemy && Projectile.ai[0] == 0f) { - Vector2 homeInVector = targetPos - projectile.Center; + Vector2 homeInVector = targetPos - Projectile.Center; float targetDist = homeInVector.Length(); homeInVector.Normalize(); if (targetDist > 200f) { float velocity = 6f; - projectile.velocity = (projectile.velocity * 40f + homeInVector * velocity) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + homeInVector * velocity) / 41f; } else { if (targetDist < 150f) { float velocity = -4f; - projectile.velocity = (projectile.velocity * 40f + homeInVector * velocity) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + homeInVector * velocity) / 41f; } else - projectile.velocity *= 0.97f; + Projectile.velocity *= 0.97f; } } else { //Return to the player if you can't see the player - if (!Collision.CanHitLine(projectile.Center, 1, 1, player.Center, 1, 1)) - projectile.ai[0] = 1f; + if (!Collision.CanHitLine(Projectile.Center, 1, 1, player.Center, 1, 1)) + Projectile.ai[0] = 1f; //Set speed to home in on the player. If returning to the player, go faster float speed = 9f; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) speed = 22f; //Find the player and align accordingly. Get in a line if there's more than one. - Vector2 playerPos = player.Center - projectile.Center; - projectile.netUpdate = true; + Vector2 playerPos = player.Center - Projectile.Center; + Projectile.netUpdate = true; int minionPosition = 1; - for (int index = 0; index < projectile.whoAmI; ++index) + for (int index = 0; index < Projectile.whoAmI; ++index) { Projectile proj = Main.projectile[index]; // Short circuits to make the loop as fast as possible - if (!proj.active || proj.owner != projectile.owner || !proj.minion) + if (!proj.active || proj.owner != Projectile.owner || !proj.minion) continue; - if (proj.type == projectile.type) + if (proj.type == Projectile.type) ++minionPosition; } playerPos.X -= 10f * player.direction; @@ -193,17 +193,17 @@ namespace CalamityMod.Projectiles.Summon if (playerDist > 200f && speed < 15f) speed = 15f; //If you were trying to chase the player but are close enough now, return to normal - if (playerDist < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerDist < 100f && Projectile.ai[0] == 1f && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } //Teleport to the player if really, really far if (playerDist > 2000f) { - projectile.position.X = player.Center.X - projectile.width / 2f; - projectile.position.Y = player.Center.Y - projectile.width / 2f; - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - Projectile.width / 2f; + Projectile.position.Y = player.Center.Y - Projectile.width / 2f; + Projectile.netUpdate = true; } //Home in on the player if (playerDist > 10f) @@ -211,87 +211,87 @@ namespace CalamityMod.Projectiles.Summon playerPos.Normalize(); if (playerDist < 50f) speed /= 2f; - projectile.velocity = (projectile.velocity * 20f + playerPos * speed) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + playerPos * speed) / 21f; } else { - projectile.direction = player.direction; - projectile.velocity *= 0.9f; + Projectile.direction = player.direction; + Projectile.velocity *= 0.9f; } } //Rotation - projectile.rotation = projectile.velocity.X * 0.05f; + Projectile.rotation = Projectile.velocity.X * 0.05f; //Cycle through animation - projectile.frameCounter++; - if (projectile.frameCounter >= 6) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } //Occasionally spawn fiery dust if (Main.rand.NextBool(6)) { - int fire = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, new Color(), 2f); + int fire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, new Color(), 2f); Main.dust[fire].velocity *= 0.3f; Main.dust[fire].noGravity = true; Main.dust[fire].noLight = true; } //Set projectile direction based on its movement - if (projectile.velocity.X > 0f) - projectile.spriteDirection = projectile.direction = -1; - else if (projectile.velocity.X < 0f) - projectile.spriteDirection = projectile.direction = 1; + if (Projectile.velocity.X > 0f) + Projectile.spriteDirection = Projectile.direction = -1; + else if (Projectile.velocity.X < 0f) + Projectile.spriteDirection = Projectile.direction = 1; //Increment firing cooldown - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += Main.rand.Next(1,4); + Projectile.ai[1] += Main.rand.Next(1,4); if (Main.rand.NextBool(3)) - ++projectile.ai[1]; + ++Projectile.ai[1]; } //Determine if it should shoot - if (projectile.ai[1] > 90f) + if (Projectile.ai[1] > 90f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } //Return if trying to return to the player or no enemy has been found - if (projectile.ai[0] != 0f || !foundEnemy) + if (Projectile.ai[0] != 0f || !foundEnemy) return; //Set projectile direction based on target location - Vector2 targetVec = targetPos - projectile.Center; + Vector2 targetVec = targetPos - Projectile.Center; if (targetVec.X > 0f) - projectile.spriteDirection = projectile.direction = -1; + Projectile.spriteDirection = Projectile.direction = -1; else if (targetVec.X < 0f) - projectile.spriteDirection = projectile.direction = 1; + Projectile.spriteDirection = Projectile.direction = 1; //Return if firing cooldown isn't perfect - if (projectile.ai[1] != 0f) + if (Projectile.ai[1] != 0f) return; - ++projectile.ai[1]; - if (Main.myPlayer != projectile.owner) + ++Projectile.ai[1]; + if (Main.myPlayer != Projectile.owner) return; //Fire projectile float speedMult = 16f; targetVec.Normalize(); targetVec *= speedMult; - int spike = Projectile.NewProjectile(projectile.Center, targetVec, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, debuffToInflict, 0f); + int spike = Projectile.NewProjectile(Projectile.Center, targetVec, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, debuffToInflict, 0f); debuffToInflict++; if (debuffToInflict >= 5f) debuffToInflict = 0f; Main.projectile[spike].netUpdate = true; - projectile.netUpdate = true; + Projectile.netUpdate = true; } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Summon/ChaosFlame.cs b/Projectiles/Summon/ChaosFlame.cs index 1724d57d05..2c398fbe38 100644 --- a/Projectiles/Summon/ChaosFlame.cs +++ b/Projectiles/Summon/ChaosFlame.cs @@ -13,44 +13,44 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Chaos Flame"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.penetrate = 1; - projectile.minionSlots = 0f; - projectile.minion = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.penetrate = 1; + Projectile.minionSlots = 0f; + Projectile.minion = true; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation(); - if (projectile.frameCounter++ % 4 == 0) + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.frameCounter++ % 4 == 0) { - projectile.frame++; + Projectile.frame++; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0f / 255f); + if (Projectile.localAI[0] == 0f) { - projectile.scale = 1f - Main.rand.NextFloat() * 0.5f; - projectile.localAI[0] += 1f; + Projectile.scale = 1f - Main.rand.NextFloat() * 0.5f; + Projectile.localAI[0] += 1f; } if (Main.rand.NextBool(4)) { - int flame = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f); + int flame = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f); Main.dust[flame].noGravity = true; Main.dust[flame].velocity *= 0f; } @@ -63,10 +63,10 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft == 300) + if (Projectile.timeLeft == 300) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Summon/ChaosSpirit.cs b/Projectiles/Summon/ChaosSpirit.cs index f200ec5bf8..f05dc5a0f2 100644 --- a/Projectiles/Summon/ChaosSpirit.cs +++ b/Projectiles/Summon/ChaosSpirit.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -13,34 +14,34 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Hydrothermic Vent"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 34; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; + Projectile.width = 26; + Projectile.height = 34; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; } public override void AI() { - bool flag64 = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool flag64 = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.chaosSpirit) { - projectile.active = false; + Projectile.active = false; return; } if (flag64) @@ -51,75 +52,75 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.cSpirit) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } dust--; if (dust >= 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, Main.rand.NextBool(3) ? 16 : 127, 0f, 0f, 0, default, 1f); + int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, Main.rand.NextBool(3) ? 16 : 127, 0f, 0f, 0, default, 1f); Main.dust[num503].velocity *= 2f; Main.dust[num503].scale *= 1.15f; } } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 1f / 255f, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0f / 255f); - projectile.frameCounter++; - if (projectile.frameCounter > 9) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 1f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0f / 255f); + Projectile.frameCounter++; + if (Projectile.frameCounter > 9) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } bool reversedGravity = player.gravDir == -1f; - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2) + player.gfxOffY - 60f; + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2) + player.gfxOffY - 60f; if (reversedGravity) { - projectile.position.Y += 120f; - projectile.rotation = MathHelper.Pi; + Projectile.position.Y += 120f; + Projectile.rotation = MathHelper.Pi; } else { - projectile.rotation = 0f; + Projectile.rotation = 0f; } - projectile.position.X = (float)(int)projectile.position.X; - projectile.position.Y = (float)(int)projectile.position.Y; + Projectile.position.X = (float)(int)Projectile.position.X; + Projectile.position.Y = (float)(int)Projectile.position.Y; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; return; } bool foundTarget = false; - Vector2 targetVec = projectile.Center; + Vector2 targetVec = Projectile.Center; Vector2 half = new Vector2(0.5f); float range = 1000f; int targetIndex = -1; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { Vector2 sizeCheck = npc.position + npc.Size * half; float npcDist = Vector2.Distance(sizeCheck, targetVec); - if (npcDist < range && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + if (npcDist < range && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { range = npcDist; targetVec = sizeCheck; @@ -133,11 +134,11 @@ namespace CalamityMod.Projectiles.Summon for (int k = 0; k < Main.maxNPCs; k++) { NPC npc = Main.npc[k]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { Vector2 sizeCheck = npc.position + npc.Size * half; float npcDist = Vector2.Distance(sizeCheck, targetVec); - if (npcDist < range && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + if (npcDist < range && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { range = npcDist; targetVec = sizeCheck; @@ -152,18 +153,18 @@ namespace CalamityMod.Projectiles.Summon { int projectileType = ModContent.ProjectileType(); //If the target is above the minion, fire directly at it at double speed - if (reversedGravity ? (Main.npc[targetIndex].Bottom.Y > projectile.Top.Y) : (Main.npc[targetIndex].Bottom.Y < projectile.Top.Y)) + if (reversedGravity ? (Main.npc[targetIndex].Bottom.Y > Projectile.Top.Y) : (Main.npc[targetIndex].Bottom.Y < Projectile.Top.Y)) { - Vector2 source = new Vector2(projectile.Center.X - 4f, projectile.Center.Y - yAdjust); + Vector2 source = new Vector2(Projectile.Center.X - 4f, Projectile.Center.Y - yAdjust); float speed = Main.rand.Next(14, 19); //modify the speed the projectile are shot. Lower number = slower projectile. - Vector2 velocity = targetVec - projectile.Center; + Vector2 velocity = targetVec - Projectile.Center; float targetDist = velocity.Length(); targetDist = speed / targetDist; velocity.X *= targetDist; velocity.Y *= targetDist; - Projectile.NewProjectile(source, velocity, projectileType, projectile.damage, 5f, projectile.owner, 0f, 0f); - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.ai[0] = 10f; + Projectile.NewProjectile(source, velocity, projectileType, Projectile.damage, 5f, Projectile.owner, 0f, 0f); + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.ai[0] = 10f; } //Otherwise, fire away like a volcano else @@ -175,11 +176,11 @@ namespace CalamityMod.Projectiles.Summon float velocityY = Main.rand.NextFloat(-10f, -7f); if (reversedGravity) velocityY *= -1f; - int flame = Projectile.NewProjectile(projectile.oldPosition.X + (projectile.width / 2), projectile.oldPosition.Y + (projectile.height / 2), velocityX, velocityY, projectileType, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int flame = Projectile.NewProjectile(Projectile.oldPosition.X + (Projectile.width / 2), Projectile.oldPosition.Y + (Projectile.height / 2), velocityX, velocityY, projectileType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); Main.projectile[flame].aiStyle = 1; } - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.ai[0] = 20f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.ai[0] = 20f; } } diff --git a/Projectiles/Summon/Cinder.cs b/Projectiles/Summon/Cinder.cs index 2ed4c226a8..734087fc0d 100644 --- a/Projectiles/Summon/Cinder.cs +++ b/Projectiles/Summon/Cinder.cs @@ -15,77 +15,77 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Cinder"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; - projectile.minion = true; + Projectile.width = 6; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 300; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.minion = true; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X *= -0.1f; + Projectile.velocity.X *= -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X *= -0.5f; + Projectile.velocity.X *= -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y *= -0.5f; + Projectile.velocity.Y *= -0.5f; } - projectile.ai[0]++; - if (projectile.ai[0] > 5f) + Projectile.ai[0]++; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X *= 0.97f; - if (Math.Abs(projectile.velocity.X) < 0.01) + Projectile.velocity.X *= 0.97f; + if (Math.Abs(Projectile.velocity.X) < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } } - if (projectile.ai[0] >= FallDelay && projectile.velocity.Y < FallSpeedMax) + if (Projectile.ai[0] >= FallDelay && Projectile.velocity.Y < FallSpeedMax) { - projectile.velocity.Y += FallAcceleration; + Projectile.velocity.Y += FallAcceleration; } - projectile.rotation += projectile.velocity.X * 0.1f; - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); + Projectile.rotation += Projectile.velocity.X * 0.1f; + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); Main.dust[idx].position += new Vector2(2f); Main.dust[idx].scale += Main.rand.NextFloat(0.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity.Y -= 2f; if (Main.rand.NextBool(2)) { - idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); Main.dust[idx].position += new Vector2(2f); Main.dust[idx].scale += 0.3f + Main.rand.NextFloat(0.5f); Main.dust[idx].noGravity = true; Main.dust[idx].velocity.Y -= 2f; } - if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) + if (Projectile.velocity.Y < 0.25f && Projectile.velocity.Y > 0.15f) { - projectile.velocity.X *= 0.8f; + Projectile.velocity.X *= 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) + Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } diff --git a/Projectiles/Summon/CinderBlossom.cs b/Projectiles/Summon/CinderBlossom.cs index 9c206dc57b..d5aee60c40 100644 --- a/Projectiles/Summon/CinderBlossom.cs +++ b/Projectiles/Summon/CinderBlossom.cs @@ -10,35 +10,35 @@ namespace CalamityMod.Projectiles.Summon { public float Time { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public override void SetStaticDefaults() { DisplayName.SetDefault("Cinder Blossom"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 36; - projectile.height = 40; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 36; + Projectile.height = 40; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - bool isCorrectMinion = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool isCorrectMinion = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); if (isCorrectMinion) @@ -49,50 +49,50 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.cinderBlossom) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) - projectile.position.Y += 120f; - projectile.position.X = (int)projectile.position.X; - projectile.position.Y = (int)projectile.position.Y; - projectile.position = projectile.position.Floor(); - projectile.rotation += MathHelper.ToRadians(1.5f) * player.direction; + Projectile.position.Y += 120f; + Projectile.position.X = (int)Projectile.position.X; + Projectile.position.Y = (int)Projectile.position.Y; + Projectile.position = Projectile.position.Floor(); + Projectile.rotation += MathHelper.ToRadians(1.5f) * player.direction; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { Initialize(player); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - NPC potentialTarget = projectile.Center.MinionHoming(700f, player); + NPC potentialTarget = Projectile.Center.MinionHoming(700f, player); if (potentialTarget != null) { - if (Time++ % 35f == 34f && Collision.CanHit(projectile.position, projectile.width, projectile.height, potentialTarget.position, potentialTarget.width, potentialTarget.height)) + if (Time++ % 35f == 34f && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, potentialTarget.position, potentialTarget.width, potentialTarget.height)) { - Vector2 velocity = projectile.SafeDirectionTo(potentialTarget.Center) * Main.rand.NextFloat(10f, 18f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Vector2 velocity = Projectile.SafeDirectionTo(potentialTarget.Center) * Main.rand.NextFloat(10f, 18f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } - Lighting.AddLight(projectile.Center, Color.Orange.ToVector3()); + Lighting.AddLight(Projectile.Center, Color.Orange.ToVector3()); } public void Initialize(Player player) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 36; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, DustID.Fire); + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.Fire); dust.noGravity = true; dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2f, 6f); } diff --git a/Projectiles/Summon/CloudElementalMinion.cs b/Projectiles/Summon/CloudElementalMinion.cs index 3040bb5632..4ebec94e46 100644 --- a/Projectiles/Summon/CloudElementalMinion.cs +++ b/Projectiles/Summon/CloudElementalMinion.cs @@ -14,38 +14,38 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Cloudy Waifu"); - Main.projFrames[projectile.type] = 8; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 8; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 58; - projectile.height = 116; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 58; + Projectile.height = 116; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.cloudWaifu && !modPlayer.allWaifus) { - projectile.active = false; + Projectile.active = false; return; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (correctMinion) { if (player.dead) @@ -54,48 +54,48 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.cWaifu) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } dust--; if (dust >= 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { - int index = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 16, 0f, 0f, 0, default, 1f); + int index = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 16, 0f, 0f, 0, default, 1f); Main.dust[index].velocity *= 2f; Main.dust[index].scale *= 1.15f; } } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + Projectile.damage = damage2; } - if (Math.Abs(projectile.velocity.X) > 0.2f) + if (Math.Abs(Projectile.velocity.X) > 0.2f) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; lightScalar *= Main.essScale; - Lighting.AddLight(projectile.Center, 0.25f * lightScalar, 0.55f * lightScalar, 0.75f * lightScalar); + Lighting.AddLight(Projectile.Center, 0.25f * lightScalar, 0.55f * lightScalar, 0.75f * lightScalar); - projectile.frameCounter++; - if (projectile.frameCounter > 16) + Projectile.frameCounter++; + if (Projectile.frameCounter > 16) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 7) + if (Projectile.frame > 7) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.ChargingMinionAI(500f, 800f, 1200f, 400f, 0, 30f, 8f, 4f, new Vector2(500f, -60f), 40f, 8f, false, true, 1); + Projectile.ChargingMinionAI(500f, 800f, 1200f, 400f, 0, 30f, 8f, 4f, new Vector2(500f, -60f), 40f, 8f, false, true, 1); } } } diff --git a/Projectiles/Summon/ColdDivinityPointyThing.cs b/Projectiles/Summon/ColdDivinityPointyThing.cs index eede4514b5..841439f86d 100644 --- a/Projectiles/Summon/ColdDivinityPointyThing.cs +++ b/Projectiles/Summon/ColdDivinityPointyThing.cs @@ -7,6 +7,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -20,7 +21,7 @@ namespace CalamityMod.Projectiles.Summon private void homingAi() { - if (projectile.timeLeft <= 240) + if (Projectile.timeLeft <= 240) { if (target != null) { @@ -29,11 +30,11 @@ namespace CalamityMod.Projectiles.Summon target = null; } if (target == null) - target = CalamityUtils.MinionHoming(projectile.Center, 1000f, Main.player[projectile.owner]); + target = CalamityUtils.MinionHoming(Projectile.Center, 1000f, Main.player[Projectile.owner]); if (target != null) //target found { float num550 = 40f; - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num551 = target.Center.X - vector43.X; float num552 = target.Center.Y - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -44,8 +45,8 @@ namespace CalamityMod.Projectiles.Summon num553 = num550 / num553; num551 *= num553; num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 20f + num551) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num552) / 21f; + Projectile.velocity.X = (Projectile.velocity.X * 20f + num551) / 21f; + Projectile.velocity.Y = (Projectile.velocity.Y * 20f + num552) / 21f; } } } @@ -53,23 +54,23 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Ice Castle Shard"); - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 60; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 28; + Projectile.height = 60; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void SendExtraAI(BinaryWriter writer) { @@ -93,7 +94,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < dustAmt; i++) { - Dust.NewDust(projectile.Center, projectile.width, projectile.height, DustID.Ice, Main.rand.NextFloat(1, 3), Main.rand.NextFloat(1, 3), 0, Color.Cyan, Main.rand.NextFloat(0.5f, 1.5f)); + Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Ice, Main.rand.NextFloat(1, 3), Main.rand.NextFloat(1, 3), 0, Color.Cyan, Main.rand.NextFloat(0.5f, 1.5f)); } } @@ -101,41 +102,41 @@ namespace CalamityMod.Projectiles.Summon { if (recharging == -1) { - recharging = projectile.ai[1] == 0f ? 210 : 0; + recharging = Projectile.ai[1] == 0f ? 210 : 0; dust(30); } - if (projectile.ai[1] == 1f && projectile.timeLeft > 1000) + if (Projectile.ai[1] == 1f && Projectile.timeLeft > 1000) { - projectile.ai[1] = 0f; - projectile.timeLeft = 250; + Projectile.ai[1] = 0f; + Projectile.timeLeft = 250; circling = circlingPlayer = false; - projectile.netUpdate = true; + Projectile.netUpdate = true; } - else if (projectile.ai[1] >= 2f && projectile.timeLeft > 900) + else if (Projectile.ai[1] >= 2f && Projectile.timeLeft > 900) { - target = CalamityUtils.MinionHoming(projectile.Center, 1000f, Main.player[projectile.owner]); + target = CalamityUtils.MinionHoming(Projectile.Center, 1000f, Main.player[Projectile.owner]); if (target != null) { - projectile.timeLeft = 669; - projectile.ai[1]++; + Projectile.timeLeft = 669; + Projectile.ai[1]++; circlingPlayer = false; float height = target.getRect().Height; float width = target.getRect().Width; floatyDistance = MathHelper.Min((height > width ? height : width) * 3f, (Main.LogicCheckScreenWidth * Main.LogicCheckScreenHeight) / 2); if (floatyDistance > Main.LogicCheckScreenWidth / 3) floatyDistance = Main.LogicCheckScreenWidth / 3; - projectile.penetrate = -1; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 4; - projectile.netUpdate = true; + Projectile.penetrate = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 4; + Projectile.netUpdate = true; } } if (circlingPlayer) { - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - if (projectile.penetrate == 1) + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + if (Projectile.penetrate == 1) { - projectile.penetrate++; + Projectile.penetrate++; } } return true; @@ -143,20 +144,20 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } if (player.dead) @@ -165,17 +166,17 @@ namespace CalamityMod.Projectiles.Summon } if (circlingPlayer) { - projectile.minionSlots = 1f; - projectile.timeLeft = 2; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 2; if (!modPlayer.coldDivinity && recharging > 0) - projectile.Kill(); + Projectile.Kill(); } if (circling && !circlingPlayer) { if (target != null && (!target.active || target.life <= 0)) { - projectile.Kill(); + Projectile.Kill(); } } if (recharging > 0) @@ -184,23 +185,23 @@ namespace CalamityMod.Projectiles.Summon if (recharging == 0) { dust(15); - SoundEffectInstance sound = Main.PlaySound(SoundID.Item30, projectile.position); + SoundEffectInstance sound = SoundEngine.PlaySound(SoundID.Item30, Projectile.position); if (sound != null) { sound.Pitch = 0.2f; } - projectile.netUpdate = true; + Projectile.netUpdate = true; } } if (circling) { - if (circling && !circlingPlayer && projectile.timeLeft < 120) + if (circling && !circlingPlayer && Projectile.timeLeft < 120) { recharging = 0; - projectile.usesIDStaticNPCImmunity = false; - projectile.penetrate = 1; + Projectile.usesIDStaticNPCImmunity = false; + Projectile.penetrate = 1; float applicableDist = target.getRect().Width > target.getRect().Height ? target.getRect().Width : target.getRect().Height; - if (projectile.timeLeft > 60) + if (Projectile.timeLeft > 60) floatyDistance += 5; else floatyDistance -= 10; @@ -209,42 +210,42 @@ namespace CalamityMod.Projectiles.Summon { float math = recharging == 0 ? 90f :(300 - recharging) / 3; float regularDistance = math > 90f ? 90f : math; - projectile.Center = player.Center + projectile.ai[0].ToRotationVector2() * regularDistance; - projectile.rotation = projectile.ai[0] + (float)Math.Atan(90); - projectile.ai[0] -= MathHelper.ToRadians(4f); - NPC target = recharging > 0 ? null : CalamityUtils.MinionHoming(projectile.Center, 800f, player); - if (target != null && projectile.owner == Main.myPlayer) + Projectile.Center = player.Center + Projectile.ai[0].ToRotationVector2() * regularDistance; + Projectile.rotation = Projectile.ai[0] + (float)Math.Atan(90); + Projectile.ai[0] -= MathHelper.ToRadians(4f); + NPC target = recharging > 0 ? null : CalamityUtils.MinionHoming(Projectile.Center, 800f, player); + if (target != null && Projectile.owner == Main.myPlayer) { recharging = 180; - Vector2 velocity = projectile.ai[0].ToRotationVector2().RotatedBy(Math.Atan(0)); + Vector2 velocity = Projectile.ai[0].ToRotationVector2().RotatedBy(Math.Atan(0)); velocity.Normalize(); velocity *= 20f; - Projectile.NewProjectile(projectile.position, velocity, projectile.type, (int)(projectile.damage * 1.05f), projectile.knockBack, projectile.owner, projectile.ai[0], 1f); + Projectile.NewProjectile(Projectile.position, velocity, Projectile.type, (int)(Projectile.damage * 1.05f), Projectile.knockBack, Projectile.owner, Projectile.ai[0], 1f); } - projectile.netUpdate = projectile.owner == Main.myPlayer; + Projectile.netUpdate = Projectile.owner == Main.myPlayer; } else { - projectile.Center = target.Center + projectile.ai[0].ToRotationVector2() * floatyDistance; - projectile.rotation = projectile.ai[0] + (float)Math.Atan(90); - Vector2 vec = projectile.rotation.ToRotationVector2() - target.Center; + Projectile.Center = target.Center + Projectile.ai[0].ToRotationVector2() * floatyDistance; + Projectile.rotation = Projectile.ai[0] + (float)Math.Atan(90); + Vector2 vec = Projectile.rotation.ToRotationVector2() - target.Center; vec.Normalize(); - if (projectile.timeLeft <= 120) - projectile.rotation = projectile.timeLeft <= 60 ? projectile.ai[0] - (float)Math.Atan(90) : projectile.rotation - (MathHelper.Distance(projectile.rotation, -projectile.rotation) / (120 - 60)); - projectile.ai[0] -= MathHelper.ToRadians(4f); + if (Projectile.timeLeft <= 120) + Projectile.rotation = Projectile.timeLeft <= 60 ? Projectile.ai[0] - (float)Math.Atan(90) : Projectile.rotation - (MathHelper.Distance(Projectile.rotation, -Projectile.rotation) / (120 - 60)); + Projectile.ai[0] -= MathHelper.ToRadians(4f); } } else { - projectile.rotation = projectile.velocity.ToRotation() + (float)Math.Atan(90); + Projectile.rotation = Projectile.velocity.ToRotation() + (float)Math.Atan(90); homingAi(); } } public override bool CanDamage() { - return recharging <= 0 && (circlingPlayer || (circling && (projectile.timeLeft >= 120 || projectile.timeLeft <= 45)) || !circling) && !projectile.hide; + return recharging <= 0 && (circlingPlayer || (circling && (Projectile.timeLeft >= 120 || Projectile.timeLeft <= 45)) || !circling) && !Projectile.hide; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -253,7 +254,7 @@ namespace CalamityMod.Projectiles.Summon int circlers = 0; for (int i = 0; i < Main.projectile.Length; i++) { - if (Main.projectile[i].active && Main.projectile[i].owner == projectile.owner && Main.projectile[i].type == projectile.type) + if (Main.projectile[i].active && Main.projectile[i].owner == Projectile.owner && Main.projectile[i].type == Projectile.type) { ColdDivinityPointyThing pointy = (ColdDivinityPointyThing)Main.projectile[i].modProjectile; if (Main.projectile[i].ai[1] > 2f) @@ -261,15 +262,15 @@ namespace CalamityMod.Projectiles.Summon } } circlers = (int)MathHelper.Min(Main.rand.Next(15, 21), circlers); - if (projectile.ai[1] > 2f) - projectile.ai[1]++; - if (projectile.ai[1] >= (30f - circlers) && projectile.timeLeft >= 120) - recharging = projectile.timeLeft > 121 ? projectile.timeLeft - 121 : 0; + if (Projectile.ai[1] > 2f) + Projectile.ai[1]++; + if (Projectile.ai[1] >= (30f - circlers) && Projectile.timeLeft >= 120) + recharging = Projectile.timeLeft > 121 ? Projectile.timeLeft - 121 : 0; - if (circling && target == this.target && projectile.timeLeft < 60) + if (circling && target == this.target && Projectile.timeLeft < 60) { - if (projectile.timeLeft < 60) - projectile.Kill(); + if (Projectile.timeLeft < 60) + Projectile.Kill(); } else if (circlingPlayer) { @@ -280,13 +281,13 @@ namespace CalamityMod.Projectiles.Summon public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (circling && target == this.target && projectile.timeLeft < 60) + if (circling && target == this.target && Projectile.timeLeft < 60) { dust(30); - Main.PlaySound(SoundID.NPCHit5, projectile.position); + SoundEngine.PlaySound(SoundID.NPCHit5, Projectile.position); damage = (int)(damage * 1.1f); } - else if (circling && target == this.target && projectile.timeLeft > 60) + else if (circling && target == this.target && Projectile.timeLeft > 60) { dust(5); damage = (int)(damage * 0.2f); //nerfffffff the nerf because nerf? nerf. @@ -305,7 +306,7 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.NPCHit5, projectile.position); + SoundEngine.PlaySound(SoundID.NPCHit5, Projectile.position); dust(20); } @@ -318,7 +319,7 @@ namespace CalamityMod.Projectiles.Summon { if (!circling || (!circlingPlayer && recharging == 0)) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, !circlingPlayer ? 1 : 3); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, !circlingPlayer ? 1 : 3); } return true; } diff --git a/Projectiles/Summon/CorroslimeMinion.cs b/Projectiles/Summon/CorroslimeMinion.cs index d1228d80ce..a1fb4706f3 100644 --- a/Projectiles/Summon/CorroslimeMinion.cs +++ b/Projectiles/Summon/CorroslimeMinion.cs @@ -15,28 +15,28 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Corroslime"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.alpha = 75; - projectile.aiStyle = 26; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 26; + Projectile.height = 26; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 1; + Projectile.alpha = 75; + Projectile.aiStyle = 26; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; aiType = ProjectileID.BabySlime; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 23; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 23; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) @@ -47,18 +47,18 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 16; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 14, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; @@ -66,14 +66,14 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -83,17 +83,17 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.cSlime) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Summon/CorruptionSlimeGodMinion.cs b/Projectiles/Summon/CorruptionSlimeGodMinion.cs index 5bd9b0ac92..08a7457323 100644 --- a/Projectiles/Summon/CorruptionSlimeGodMinion.cs +++ b/Projectiles/Summon/CorruptionSlimeGodMinion.cs @@ -13,28 +13,28 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Slime God"); - Main.projFrames[projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 2; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 0f; - projectile.alpha = 75; - projectile.aiStyle = 26; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 26; + Projectile.height = 26; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 0f; + Projectile.alpha = 75; + Projectile.aiStyle = 26; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; aiType = ProjectileID.BabySlime; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 23; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 23; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) @@ -45,18 +45,18 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 16; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 173, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; @@ -64,18 +64,18 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (!modPlayer.slimeGod) { - projectile.active = false; + Projectile.active = false; return; } if (flag64) @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.sGod) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } } diff --git a/Projectiles/Summon/CosmicBlast.cs b/Projectiles/Summon/CosmicBlast.cs index f784cc45b1..01d2763a6a 100644 --- a/Projectiles/Summon/CosmicBlast.cs +++ b/Projectiles/Summon/CosmicBlast.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class CosmicBlast : ModProjectile @@ -10,48 +11,48 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.minionSlots = 0f; - projectile.minion = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.minionSlots = 0f; + Projectile.minion = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; } public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Player player = Main.player[Projectile.owner]; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } if (Main.rand.NextBool(8)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); Main.dust[num59].noGravity = true; Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; + Main.dust[num59].position = Projectile.Center + value3 * 12f; } - NPC potentialTarget = projectile.Center.MinionHoming(1200f, Main.player[projectile.owner]); + NPC potentialTarget = Projectile.Center.MinionHoming(1200f, Main.player[Projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 40f) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 40f) / 21f; } public override Color? GetAlpha(Color lightColor) @@ -71,36 +72,36 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 144; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Zombie, (int)projectile.Center.X, (int)projectile.Center.Y, 103); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 144; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Zombie, (int)Projectile.Center.X, (int)Projectile.Center.Y, 103); for (int num193 = 0; num193 < 3; num193++) { - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[dust].noGravity = true; } for (int num194 = 0; num194 < 30; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } diff --git a/Projectiles/Summon/CosmicBlastBig.cs b/Projectiles/Summon/CosmicBlastBig.cs index 97bb83f0d7..fc47a7d9f3 100644 --- a/Projectiles/Summon/CosmicBlastBig.cs +++ b/Projectiles/Summon/CosmicBlastBig.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class CosmicBlastBig : ModProjectile @@ -10,63 +11,63 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.minion = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; - if (projectile.soundDelay == 0) + Player player = Main.player[Projectile.owner]; + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item9, (int)Projectile.position.X, (int)Projectile.position.Y); } } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; if (Main.rand.NextBool(8)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); Main.dust[num59].noGravity = true; Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; + Main.dust[num59].position = Projectile.Center + value3 * 12f; } if (Main.rand.NextBool(24)) { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + int num60 = Gore.NewGore(Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; + Main.gore[num60].velocity += Projectile.velocity * 0.3f; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { if (Main.rand.NextBool(5)) { - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); Main.dust[num59].noGravity = true; } if (Main.rand.NextBool(10)) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } - NPC potentialTarget = projectile.Center.MinionHoming(600f, Main.player[projectile.owner]); + NPC potentialTarget = Projectile.Center.MinionHoming(600f, Main.player[Projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 45f) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 45f) / 21f; } public override Color? GetAlpha(Color lightColor) @@ -86,27 +87,27 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 288; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Zombie, (int)projectile.Center.X, (int)projectile.Center.Y, 103); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 288; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Zombie, (int)Projectile.Center.X, (int)Projectile.Center.Y, 103); for (int num193 = 0; num193 < 3; num193++) { - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[dust].noGravity = true; } for (int num194 = 0; num194 < 30; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } diff --git a/Projectiles/Summon/CosmicEnergySpiral.cs b/Projectiles/Summon/CosmicEnergySpiral.cs index 2c6e3ba78a..44245cd377 100644 --- a/Projectiles/Summon/CosmicEnergySpiral.cs +++ b/Projectiles/Summon/CosmicEnergySpiral.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class CosmicEnergySpiral : ModProjectile @@ -14,46 +15,46 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Energy"); - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projPet[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 78; - projectile.height = 78; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 10f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.extraUpdates = 1; + Projectile.width = 78; + Projectile.height = 78; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 10f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.extraUpdates = 1; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, (float)Main.DiscoR / 255f, (float)Main.DiscoG / 255f, (float)Main.DiscoB / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, (float)Main.DiscoR / 255f, (float)Main.DiscoG / 255f, (float)Main.DiscoB / 255f); + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -63,23 +64,23 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.cEnergy) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } float num633 = 1400f; //700 float num634 = 1600f; //800 float num635 = 2400f; //1200 float num636 = 800f; - projectile.rotation += projectile.velocity.X * 0.1f; - Vector2 vector46 = projectile.position; + Projectile.rotation += Projectile.velocity.X * 0.1f; + Vector2 vector46 = Projectile.position; bool flag25 = false; int target = 0; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, projectile.Center); + float num646 = Vector2.Distance(npc.Center, Projectile.Center); if (!flag25 && num646 < num633) { vector46 = npc.Center; @@ -93,9 +94,9 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); if (!flag25 && num646 < num633) { num633 = num646; @@ -111,27 +112,27 @@ namespace CalamityMod.Projectiles.Summon { num647 = num635; } - if (Vector2.Distance(player.Center, projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > num647) { - projectile.ai[1] = 1f; - projectile.netUpdate = true; + Projectile.ai[1] = 1f; + Projectile.netUpdate = true; } - if (flag25 && projectile.ai[1] == 0f) + if (flag25 && Projectile.ai[1] == 0f) { - Vector2 vector47 = vector46 - projectile.Center; + Vector2 vector47 = vector46 - Projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 6f; //6 vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 4f; //4 vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } } else @@ -139,69 +140,69 @@ namespace CalamityMod.Projectiles.Summon bool flag26 = false; if (!flag26) { - flag26 = projectile.ai[1] == 1f; + flag26 = Projectile.ai[1] == 1f; } float num650 = 6f; if (flag26) { num650 = 15f; } - Vector2 center2 = projectile.Center; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); if (num651 > 200f && num650 < 8f) { num650 = 8f; } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (num651 < num636 && flag26 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } if (num651 > 2000f) //2000 { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } } float num395 = (float)Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; - projectile.scale = num395 + 0.95f; + Projectile.scale = num395 + 0.95f; if (justSpawned) { justSpawned = false; - projectile.ai[0] = 100f; + Projectile.ai[0] = 100f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; return; } - float num396 = projectile.position.X; - float num397 = projectile.position.Y; + float num396 = Projectile.position.X; + float num397 = Projectile.position.Y; float num398 = 1200f; bool flag11 = false; for (int num399 = 0; num399 < Main.maxNPCs; num399++) { - if (Main.npc[num399].CanBeChasedBy(projectile, false)) + if (Main.npc[num399].CanBeChasedBy(Projectile, false)) { float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); - float num402 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num400) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num401); + float num402 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num400) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num401); if (num402 < num398) { num398 = num402; @@ -213,22 +214,22 @@ namespace CalamityMod.Projectiles.Summon } if (flag11) { - Main.PlaySound(SoundID.Item105, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item105, (int)Projectile.position.X, (int)Projectile.position.Y); int blastAmt = Main.rand.Next(5, 8); for (int b = 0; b < blastAmt; b++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 2f, projectile.owner, (float)target, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 2f, Projectile.owner, (float)target, 0f); } float speed = 15f; - float num404 = num396 - projectile.Center.X; - float num405 = num397 - projectile.Center.Y; + float num404 = num396 - Projectile.Center.X; + float num405 = num397 - Projectile.Center.Y; float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); num406 = speed / num406; num404 *= num406; num405 *= num406; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner, (float)target, 0f); - projectile.ai[0] = 100f; + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, num404, num405, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, (float)target, 0f); + Projectile.ai[0] = 100f; } } } diff --git a/Projectiles/Summon/CosmicViperConcussionMissile.cs b/Projectiles/Summon/CosmicViperConcussionMissile.cs index 7d2be62372..4eef915294 100644 --- a/Projectiles/Summon/CosmicViperConcussionMissile.cs +++ b/Projectiles/Summon/CosmicViperConcussionMissile.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class CosmicViperConcussionMissile : ModProjectile @@ -11,50 +12,50 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Concussion Missile"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.alpha = 255; - projectile.extraUpdates = 4; - projectile.scale = 1.18f; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.alpha = 255; + Projectile.extraUpdates = 4; + Projectile.scale = 1.18f; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; } public override void AI() { - float colorScale = (float)projectile.alpha / 255f; - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 1f * colorScale, 0.1f * colorScale, 1f * colorScale); + float colorScale = (float)Projectile.alpha / 255f; + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 1f * colorScale, 0.1f * colorScale, 1f * colorScale); - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -70,19 +71,19 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { diff --git a/Projectiles/Summon/CosmicViperHomingRocket.cs b/Projectiles/Summon/CosmicViperHomingRocket.cs index 104614b612..8bde681326 100644 --- a/Projectiles/Summon/CosmicViperHomingRocket.cs +++ b/Projectiles/Summon/CosmicViperHomingRocket.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class CosmicViperHomingRocket : ModProjectile @@ -11,74 +12,74 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Homing Rocket"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 1; - projectile.scale = 1.18f; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.extraUpdates = 1; + Projectile.scale = 1.18f; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - float colorScale = (float)projectile.alpha / 255f; - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 1f * colorScale, 0.1f * colorScale, 1f * colorScale); + float colorScale = (float)Projectile.alpha / 255f; + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 1f * colorScale, 0.1f * colorScale, 1f * colorScale); - Player player = Main.player[projectile.owner]; - Vector2 center = projectile.Center; + Player player = Main.player[Projectile.owner]; + Vector2 center = Projectile.Center; float maxDistance = 800f; bool homeIn = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDistance = (float)(npc.width / 2) + (float)(npc.height / 2); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) { center = npc.Center; homeIn = true; } } } - else if (Main.npc[(int)projectile.ai[0]].active && projectile.ai[0] != -1f) + else if (Main.npc[(int)Projectile.ai[0]].active && Projectile.ai[0] != -1f) { - NPC npc = Main.npc[(int)projectile.ai[0]]; - if (npc.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[(int)Projectile.ai[0]]; + if (npc.CanBeChasedBy(Projectile, false)) { float extraDistance = (float)(npc.width / 2) + (float)(npc.height / 2); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) { center = npc.Center; homeIn = true; @@ -89,11 +90,11 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].CanBeChasedBy(projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance)) + if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance)) { center = Main.npc[i].Center; homeIn = true; @@ -105,17 +106,17 @@ namespace CalamityMod.Projectiles.Summon if (homeIn) { - Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); float homingInertia = 20f; float homingVelocity = 20f; - projectile.velocity = (projectile.velocity * homingInertia + moveDirection * homingVelocity) / (homingInertia + 1f); + Projectile.velocity = (Projectile.velocity * homingInertia + moveDirection * homingVelocity) / (homingInertia + 1f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -131,19 +132,19 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { diff --git a/Projectiles/Summon/CosmicViperSplitRocket1.cs b/Projectiles/Summon/CosmicViperSplitRocket1.cs index 7b1c8ca2dd..5b3af142d7 100644 --- a/Projectiles/Summon/CosmicViperSplitRocket1.cs +++ b/Projectiles/Summon/CosmicViperSplitRocket1.cs @@ -11,38 +11,38 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Rocket Shard"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.alpha = 255; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.penetrate = 1; - projectile.timeLeft = 60; - projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 60; + Projectile.tileCollide = false; } public override void AI() { - float colorScale = (float)projectile.alpha / 255f; - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 1f * colorScale, 0.1f * colorScale, 1f * colorScale); + float colorScale = (float)Projectile.alpha / 255f; + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 1f * colorScale, 0.1f * colorScale, 1f * colorScale); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { //Changes the texture of the projectile - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/CosmicViperSplitRocket2"); - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Summon/CosmicViperSplitRocket2"); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } return true; diff --git a/Projectiles/Summon/CosmicViperSplittingRocket.cs b/Projectiles/Summon/CosmicViperSplittingRocket.cs index 1c7644420f..9e0487c246 100644 --- a/Projectiles/Summon/CosmicViperSplittingRocket.cs +++ b/Projectiles/Summon/CosmicViperSplittingRocket.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class CosmicViperSplittingRocket : ModProjectile @@ -11,47 +12,47 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Splitting Rocket"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - float colorScale = (float)projectile.alpha / 255f; - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 1f * colorScale, 0.1f * colorScale, 1f * colorScale); - Vector2 center = projectile.Center; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + float colorScale = (float)Projectile.alpha / 255f; + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 1f * colorScale, 0.1f * colorScale, 1f * colorScale); + Vector2 center = Projectile.Center; float maxDistance = 800f; float explode = 16f; bool homeIn = false; - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDistance = (float)(npc.width / 2) + (float)(npc.height / 2); - if (Vector2.Distance(npc.Center, projectile.Center) < (explode + extraDistance)) + if (Vector2.Distance(npc.Center, Projectile.Center) < (explode + extraDistance)) { int numProj = 4; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj; i++) { @@ -62,31 +63,31 @@ namespace CalamityMod.Projectiles.Summon } speed.Normalize(); speed *= (float)Main.rand.Next(30, 61) * 0.1f * 2f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); } } - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); - projectile.Kill(); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.Kill(); return; } - else if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + else if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) { center = npc.Center; homeIn = true; } } } - else if (Main.npc[(int)projectile.ai[0]].active && projectile.ai[0] != -1f) + else if (Main.npc[(int)Projectile.ai[0]].active && Projectile.ai[0] != -1f) { - NPC npc = Main.npc[(int)projectile.ai[0]]; - if (npc.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[(int)Projectile.ai[0]]; + if (npc.CanBeChasedBy(Projectile, false)) { float extraDistance = (float)(npc.width / 2) + (float)(npc.height / 2); - if (Vector2.Distance(npc.Center, projectile.Center) < (explode + extraDistance)) + if (Vector2.Distance(npc.Center, Projectile.Center) < (explode + extraDistance)) { int numProj = 4; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj; i++) { @@ -97,14 +98,14 @@ namespace CalamityMod.Projectiles.Summon } speed.Normalize(); speed *= (float)Main.rand.Next(30, 61) * 0.1f * 2f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); } } - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); - projectile.Kill(); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.Kill(); return; } - else if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + else if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) { center = npc.Center; homeIn = true; @@ -116,14 +117,14 @@ namespace CalamityMod.Projectiles.Summon for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { NPC npc = Main.npc[npcIndex]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDistance = (float)(npc.width / 2) + (float)(npc.height / 2); - if (Vector2.Distance(npc.Center, projectile.Center) < (explode + extraDistance)) + if (Vector2.Distance(npc.Center, Projectile.Center) < (explode + extraDistance)) { int numProj = 4; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < numProj; i++) { @@ -134,14 +135,14 @@ namespace CalamityMod.Projectiles.Summon } speed.Normalize(); speed *= (float)Main.rand.Next(30, 61) * 0.1f * 2f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.25f), projectile.knockBack, projectile.owner, Main.rand.Next(2), 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), Projectile.knockBack, Projectile.owner, Main.rand.Next(2), 0f); } } - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); - projectile.Kill(); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.Kill(); return; } - else if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + else if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) { center = npc.Center; homeIn = true; @@ -151,38 +152,38 @@ namespace CalamityMod.Projectiles.Summon } if (homeIn) { - Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); float homingInertia = 15f; float homingVelocity = 30f; - projectile.velocity = (projectile.velocity * homingInertia + moveDirection * homingVelocity) / (homingInertia + 1f); + Projectile.velocity = (Projectile.velocity * homingInertia + moveDirection * homingVelocity) / (homingInertia + 1f); } - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } } public override void Kill(int timeLeft) { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -208,7 +209,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/CosmicViperSummon.cs b/Projectiles/Summon/CosmicViperSummon.cs index a7c3e8f96f..a38515f1a0 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class CosmicViperSummon : ModProjectile @@ -12,69 +13,69 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Viper"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 48; - projectile.height = 48; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.aiStyle = 66; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 48; + Projectile.height = 48; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.aiStyle = 66; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int dusty = Dust.NewDust(vector6 + vector7, 0, 0, dustType, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity = vector7; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - projectile.frameCounter++; - if (projectile.frameCounter >= 4) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 3) + if (Projectile.frame >= 3) { - projectile.frame = 0; + Projectile.frame = 0; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) { @@ -84,27 +85,27 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.cosmicViper) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - float colorScale = (float)projectile.alpha / 255f; - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 1f * colorScale, 0.1f * colorScale, 1f * colorScale); + float colorScale = (float)Projectile.alpha / 255f; + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 1f * colorScale, 0.1f * colorScale, 1f * colorScale); - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); float detectRange = 1100f; - Vector2 targetVec = projectile.position; + Vector2 targetVec = Projectile.position; bool foundTarget = false; int targetIndex = -1; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); //Calculate distance between target and the projectile to know if it's too far or not - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); if (!foundTarget && targetDist < (detectRange + extraDist)) { detectRange = targetDist; @@ -119,11 +120,11 @@ namespace CalamityMod.Projectiles.Summon for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { NPC npc = Main.npc[npcIndex]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); //Calculate distance between target and the projectile to know if it's too far or not - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); if (!foundTarget && targetDist < (detectRange + extraDist)) { detectRange = targetDist; @@ -139,26 +140,26 @@ namespace CalamityMod.Projectiles.Summon { returnDist = 2600f; } - if (Vector2.Distance(player.Center, projectile.Center) > returnDist) + if (Vector2.Distance(player.Center, Projectile.Center) > returnDist) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } - if (foundTarget && projectile.ai[0] == 0f) + if (foundTarget && Projectile.ai[0] == 0f) { - Vector2 targetVector = targetVec - projectile.Center; + Vector2 targetVector = targetVec - Projectile.Center; float targetDist = targetVector.Length(); targetVector.Normalize(); float speedMult = 18f; //12 if (targetDist > 200f) { targetVector *= speedMult; - projectile.velocity = (projectile.velocity * 40f + targetVector) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + targetVector) / 41f; } else { targetVector *= -(speedMult / 2); - projectile.velocity = (projectile.velocity * 40f + targetVector) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + targetVector) / 41f; } } else @@ -167,14 +168,14 @@ namespace CalamityMod.Projectiles.Summon bool returnToPlayer = false; if (!returnToPlayer) { - returnToPlayer = projectile.ai[0] == 1f; + returnToPlayer = Projectile.ai[0] == 1f; } float velocityMult = 12f; if (returnToPlayer) { velocityMult = 30f; } - Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, -120f); + Vector2 playerVec = player.Center - Projectile.Center + new Vector2(0f, -120f); float playerDist = playerVec.Length(); if (playerDist > 200f && velocityMult < 16f) { @@ -182,61 +183,61 @@ namespace CalamityMod.Projectiles.Summon } if (playerDist < safeDist && returnToPlayer) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (playerDist > 2000f) { - projectile.Center = player.Center; - projectile.netUpdate = true; + Projectile.Center = player.Center; + Projectile.netUpdate = true; } if (playerDist > 70f) { playerVec.Normalize(); playerVec *= velocityMult; - projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + playerVec) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } } if (foundTarget) { - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(targetVec) + MathHelper.Pi, 0.1f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(targetVec) + MathHelper.Pi, 0.1f); } else { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi; int dustType = Main.rand.NextBool(3) ? 56 : 242; - float xVelOffset = projectile.velocity.X / 3f; - float yVelOffset = projectile.velocity.Y / 3f; - int trail = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); + float xVelOffset = Projectile.velocity.X / 3f; + float yVelOffset = Projectile.velocity.Y / 3f; + int trail = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[trail]; - dust.position.X = projectile.Center.X - xVelOffset; - dust.position.Y = projectile.Center.Y - yVelOffset; + dust.position.X = Projectile.Center.X - xVelOffset; + dust.position.Y = Projectile.Center.Y - yVelOffset; dust.velocity *= 0f; dust.scale = 0.5f; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 5); + Projectile.ai[1] += (float)Main.rand.Next(1, 5); } - if (projectile.ai[1] > 90f) + if (Projectile.ai[1] > 90f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { float speedMult = 6f; - if (foundTarget && projectile.ai[1] == 0f) + if (foundTarget && Projectile.ai[1] == 0f) { //play cool sound - Main.PlaySound(SoundID.Item20, projectile.Center); - projectile.ai[1] += 2f; - if (Main.myPlayer == projectile.owner) + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + Projectile.ai[1] += 2f; + if (Main.myPlayer == Projectile.owner) { int projType; float dmgMult; @@ -256,7 +257,7 @@ namespace CalamityMod.Projectiles.Summon dmgMult = 1.5f; } - Vector2 velocity = targetVec - projectile.Center; + Vector2 velocity = targetVec - Projectile.Center; velocity.Normalize(); velocity *= speedMult; @@ -264,8 +265,8 @@ namespace CalamityMod.Projectiles.Summon velocity.Y += Main.rand.NextFloat(-30f, 30f) * 0.05f; velocity.X += Main.rand.NextFloat(-30f, 30f) * 0.05f; - Projectile.NewProjectile(projectile.Center, velocity, projType, (int)(projectile.damage * dmgMult), projectile.knockBack, projectile.owner, targetIndex, 0f); - projectile.netUpdate = true; + Projectile.NewProjectile(Projectile.Center, velocity, projType, (int)(Projectile.damage * dmgMult), Projectile.knockBack, Projectile.owner, targetIndex, 0f); + Projectile.netUpdate = true; } } } @@ -275,27 +276,27 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int y6 = frameHeight * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int y6 = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, spriteEffects, 0f); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/CosmicViperGlow"); - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int y6 = frameHeight * projectile.frame; + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Summon/CosmicViperGlow"); + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int y6 = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), Color.White, projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), Color.White, Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, spriteEffects, 0f); } } } diff --git a/Projectiles/Summon/CosmilampMinion.cs b/Projectiles/Summon/CosmilampMinion.cs index bfafc8355c..196205d1fd 100644 --- a/Projectiles/Summon/CosmilampMinion.cs +++ b/Projectiles/Summon/CosmilampMinion.cs @@ -15,77 +15,77 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmilamp"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 2f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 24; - projectile.extraUpdates = 1; + Projectile.width = 20; + Projectile.height = 20; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 2f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 24; + Projectile.extraUpdates = 1; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 204, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - projectile.frameCounter++; - if (projectile.frameCounter >= 4) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.75f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.75f / 255f); float num395 = (float)Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - int num1262 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 204, 0f, 0f, 0, default, 1f); + Projectile.scale = num395 + 0.95f; + int num1262 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 204, 0f, 0f, 0, default, 1f); Main.dust[num1262].velocity *= 0.1f; Main.dust[num1262].scale = 0.7f; Main.dust[num1262].noGravity = true; - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -95,34 +95,34 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.cLamp) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.MinionAntiClump(); - float num535 = projectile.position.X; - float num536 = projectile.position.Y; + Projectile.MinionAntiClump(); + float num535 = Projectile.position.X; + float num536 = Projectile.position.Y; float num537 = 3000f; bool flag19 = false; int num538 = 2500; - if (projectile.ai[1] != 0f) + if (Projectile.ai[1] != 0f) { num538 = 4000; } - if (Math.Abs(projectile.Center.X - Main.player[projectile.owner].Center.X) + Math.Abs(projectile.Center.Y - Main.player[projectile.owner].Center.Y) > (float)num538) + if (Math.Abs(Projectile.Center.X - Main.player[Projectile.owner].Center.X) + Math.Abs(Projectile.Center.Y - Main.player[Projectile.owner].Center.Y) > (float)num538) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float num539 = npc.position.X + (float)(npc.width / 2); float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float num541 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num539) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num540); + if (num541 < num537 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { num535 = num539; num536 = num540; @@ -134,11 +134,11 @@ namespace CalamityMod.Projectiles.Summon { for (int num542 = 0; num542 < Main.maxNPCs; num542++) { - if (Main.npc[num542].CanBeChasedBy(projectile, false)) + if (Main.npc[num542].CanBeChasedBy(Projectile, false)) { float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); + float num545 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num543) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num544); if (num545 < num537) { num537 = num545; @@ -153,61 +153,61 @@ namespace CalamityMod.Projectiles.Summon if (!flag19) { float num546 = 12f; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { num546 = 18f; } - Vector2 vector42 = projectile.Center; + Vector2 vector42 = Projectile.Center; float num547 = player.Center.X - vector42.X; float num548 = player.Center.Y - vector42.Y - 60f; float num549 = (float)Math.Sqrt((double)(num547 * num547 + num548 * num548)); - if (num549 < 400f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (num549 < 400f && Projectile.ai[0] == 1f && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; } if (num549 > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); + Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.width / 2); } if (num549 > 70f) { num549 = num546 / num549; num547 *= num549; num548 *= num549; - projectile.velocity.X = (projectile.velocity.X * 20f + num547) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num548) / 21f; + Projectile.velocity.X = (Projectile.velocity.X * 20f + num547) / 21f; + Projectile.velocity.Y = (Projectile.velocity.Y * 20f + num548) / 21f; } else { - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; } - projectile.rotation = projectile.velocity.X * 0.05f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + Projectile.rotation = Projectile.velocity.X * 0.05f; + if ((double)Math.Abs(Projectile.velocity.X) > 0.2) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; return; } } else { - if (projectile.ai[1] == -1f) + if (Projectile.ai[1] == -1f) { - projectile.ai[1] = 17f; + Projectile.ai[1] = 17f; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] -= 1f; + Projectile.ai[1] -= 1f; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { float num550 = 24f; //12 - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -218,20 +218,20 @@ namespace CalamityMod.Projectiles.Summon num553 = num550 / num553; num551 *= num553; num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; + Projectile.velocity.X = (Projectile.velocity.X * 14f + num551) / 15f; + Projectile.velocity.Y = (Projectile.velocity.Y * 14f + num552) / 15f; } else { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 10f) { - projectile.velocity *= 1.05f; + Projectile.velocity *= 1.05f; } } - projectile.rotation = projectile.velocity.X * 0.05f; - if (Math.Abs(projectile.velocity.X) > 0.2f) + Projectile.rotation = Projectile.velocity.X * 0.05f; + if (Math.Abs(Projectile.velocity.X) > 0.2f) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; return; } } @@ -239,16 +239,16 @@ namespace CalamityMod.Projectiles.Summon public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) + Rectangle myRect = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 200; i++) { if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == NPCID.Guide && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || - (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) + ((Projectile.friendly && (!Main.npc[i].friendly || Projectile.type == 318 || (Main.npc[i].type == NPCID.Guide && Projectile.owner < 255 && Main.player[Projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && Projectile.owner < 255 && Main.player[Projectile.owner].killClothier))) || + (Projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (Projectile.owner < 0 || Main.npc[i].immune[Projectile.owner] == 0 || Projectile.maxPenetrate == 1)) { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + if (Main.npc[i].noTileCollide || !Projectile.ownerHitCheck || Projectile.CanHit(Main.npc[i])) { bool flag3; if (Main.npc[i].type == NPCID.SolarCrawltipedeTail) @@ -259,21 +259,21 @@ namespace CalamityMod.Projectiles.Summon rect.Y -= num5; rect.Width += num5 * 2; rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); + flag3 = Projectile.Colliding(myRect, rect); } else { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + flag3 = Projectile.Colliding(myRect, Main.npc[i].getRect()); } if (flag3) { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + if (Main.npc[i].reflectingProjectiles && Projectile.CanReflect()) { - Main.npc[i].ReflectProjectile(projectile.whoAmI); + Main.npc[i].ReflectProjectile(Projectile.whoAmI); return; } - projectile.ai[1] = -1f; - projectile.netUpdate = true; + Projectile.ai[1] = -1f; + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Summon/CrimslimeMinion.cs b/Projectiles/Summon/CrimslimeMinion.cs index 0d682163fd..57312ea0ca 100644 --- a/Projectiles/Summon/CrimslimeMinion.cs +++ b/Projectiles/Summon/CrimslimeMinion.cs @@ -15,28 +15,28 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Crimslime"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.alpha = 75; - projectile.aiStyle = 26; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 26; + Projectile.height = 26; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 1; + Projectile.alpha = 75; + Projectile.aiStyle = 26; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; aiType = ProjectileID.BabySlime; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 23; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 23; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) @@ -47,18 +47,18 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 16; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 5, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; @@ -66,14 +66,14 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -83,17 +83,17 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.cSlime2) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Summon/CrimsonSlimeGodMinion.cs b/Projectiles/Summon/CrimsonSlimeGodMinion.cs index bab1788060..563131760a 100644 --- a/Projectiles/Summon/CrimsonSlimeGodMinion.cs +++ b/Projectiles/Summon/CrimsonSlimeGodMinion.cs @@ -13,28 +13,28 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Slime God"); - Main.projFrames[projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 2; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 0f; - projectile.alpha = 75; - projectile.aiStyle = 26; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 26; + Projectile.height = 26; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 0f; + Projectile.alpha = 75; + Projectile.aiStyle = 26; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; aiType = ProjectileID.BabySlime; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 23; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 23; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) @@ -45,18 +45,18 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 16; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 5, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; @@ -64,18 +64,18 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (!modPlayer.slimeGod) { - projectile.active = false; + Projectile.active = false; return; } if (flag64) @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.sGod) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } } diff --git a/Projectiles/Summon/DaedalusCrystal.cs b/Projectiles/Summon/DaedalusCrystal.cs index 7bd5688e0c..e8fd3b4ff3 100644 --- a/Projectiles/Summon/DaedalusCrystal.cs +++ b/Projectiles/Summon/DaedalusCrystal.cs @@ -14,33 +14,33 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Daedalus Crystal"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 46; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; + Projectile.width = 26; + Projectile.height = 46; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; } public override void AI() { - bool flag64 = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool flag64 = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.daedalusCrystal) { - projectile.active = false; + Projectile.active = false; return; } if (flag64) @@ -51,65 +51,65 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.dCrystal) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } dust--; if (dust >= 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 173, 0f, 0f, 0, default, 1f); + int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 173, 0f, 0f, 0, default, 1f); Main.dust[num503].velocity *= 2f; Main.dust[num503].scale *= 1.15f; } } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.75f / 255f); - projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.75f / 255f); + Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { - projectile.position.Y += 120f; - projectile.rotation = MathHelper.Pi; + Projectile.position.Y += 120f; + Projectile.rotation = MathHelper.Pi; } else { - projectile.rotation = 0f; + Projectile.rotation = 0f; } - projectile.position.X = (int)projectile.position.X; - projectile.position.Y = (int)projectile.position.Y; + Projectile.position.X = (int)Projectile.position.X; + Projectile.position.Y = (int)Projectile.position.Y; float num395 = (float)Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - if (projectile.owner == Main.myPlayer) + Projectile.scale = num395 + 0.95f; + if (Projectile.owner == Main.myPlayer) { - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; return; } bool flag18 = false; - float num506 = projectile.Center.X; - float num507 = projectile.Center.Y; + float num506 = Projectile.Center.X; + float num507 = Projectile.Center.Y; float num508 = 1000f; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float num539 = npc.position.X + (float)(npc.width / 2); float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float num541 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num539) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num540); + if (num541 < num508 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { num506 = num539; num507 = num540; @@ -121,12 +121,12 @@ namespace CalamityMod.Projectiles.Summon { for (int num512 = 0; num512 < Main.maxNPCs; num512++) { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) + if (Main.npc[num512].CanBeChasedBy(Projectile, false)) { float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + float num515 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num513) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) { num508 = num515; num506 = num513; @@ -140,19 +140,19 @@ namespace CalamityMod.Projectiles.Summon { float num516 = num506; float num517 = num507; - num506 -= projectile.Center.X; - num507 -= projectile.Center.Y; + num506 -= Projectile.Center.X; + num507 -= Projectile.Center.Y; int projectileType = ModContent.ProjectileType(); float num403 = Main.rand.Next(10, 15); //modify the speed the projectile are shot. Lower number = slower projectile. - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector29 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num404 = num516 - vector29.X; float num405 = num517 - vector29.Y; float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); num406 = num403 / num406; num404 *= num406; num405 *= num406; - Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, projectileType, projectile.damage, 5f, projectile.owner, 0f, 0f); - projectile.ai[0] = 50f; + Projectile.NewProjectile(Projectile.Center.X - 4f, Projectile.Center.Y, num404, num405, projectileType, Projectile.damage, 5f, Projectile.owner, 0f, 0f); + Projectile.ai[0] = 50f; } } } diff --git a/Projectiles/Summon/DaedalusCrystalShot.cs b/Projectiles/Summon/DaedalusCrystalShot.cs index 80030f8659..a7784753e7 100644 --- a/Projectiles/Summon/DaedalusCrystalShot.cs +++ b/Projectiles/Summon/DaedalusCrystalShot.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -12,43 +13,43 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal Shot"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.netImportant = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.minion = true; - projectile.minionSlots = 0f; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.netImportant = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.minion = true; + Projectile.minionSlots = 0f; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item73, (int)projectile.position.X, (int)projectile.position.Y); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item73, (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.localAI[0] += 1f; } for (int num457 = 0; num457 < 5; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item74, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item74, (int)Projectile.position.X, (int)Projectile.position.Y); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -58,10 +59,10 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Summon/DaedalusGolem.cs b/Projectiles/Summon/DaedalusGolem.cs index f1411879a4..09caf66f81 100644 --- a/Projectiles/Summon/DaedalusGolem.cs +++ b/Projectiles/Summon/DaedalusGolem.cs @@ -6,7 +6,8 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -17,32 +18,32 @@ namespace CalamityMod.Projectiles.Summon public const int ChargedPelletAttackTime = 30; public const int ChargedLaserAttackTime = 120; public const float Gravity = 0.35f; - public bool Stuck => StuckWalkThroughWallsTimer >= 40f || Collision.SolidCollision(projectile.Center, 2, 2); - public Vector2 ArmPosition => projectile.Center + new Vector2(projectile.spriteDirection == 1 ? -4f : 32f, 0f); - public Player Owner => Main.player[projectile.owner]; - public ref float StuckWalkThroughWallsTimer => ref projectile.ai[0]; - public ref float StuckJumpSpeed => ref projectile.ai[1]; + public bool Stuck => StuckWalkThroughWallsTimer >= 40f || Collision.SolidCollision(Projectile.Center, 2, 2); + public Vector2 ArmPosition => Projectile.Center + new Vector2(Projectile.spriteDirection == 1 ? -4f : 32f, 0f); + public Player Owner => Main.player[Projectile.owner]; + public ref float StuckWalkThroughWallsTimer => ref Projectile.ai[0]; + public ref float StuckJumpSpeed => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Daedalus Golem"); - Main.projFrames[projectile.type] = 18; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 18; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 58; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.timeLeft = 90000; - projectile.penetrate = -1; - projectile.minion = true; - projectile.tileCollide = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 28; + Projectile.height = 58; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 1; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.minion = true; + Projectile.tileCollide = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void SendExtraAI(BinaryWriter writer) @@ -60,8 +61,8 @@ namespace CalamityMod.Projectiles.Summon #region AI public override void AI() { - Main.projFrames[projectile.type] = 16; - bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + Main.projFrames[Projectile.type] = 16; + bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); Owner.AddBuff(ModContent.BuffType(), 3600); if (isCorrectProjectile) { @@ -69,24 +70,24 @@ namespace CalamityMod.Projectiles.Summon Owner.Calamity().daedalusGolem = false; if (Owner.Calamity().daedalusGolem) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } AdjustMinionDamage(); // Fall down. - if (projectile.velocity.Y < 15f) - projectile.velocity.Y += Gravity; + if (Projectile.velocity.Y < 15f) + Projectile.velocity.Y += Gravity; Vector2 destination; - NPC potentialTarget = projectile.Center.MinionHoming(900f, Owner); + NPC potentialTarget = Projectile.Center.MinionHoming(900f, Owner); if (potentialTarget is null) - destination = Owner.Center - Vector2.UnitX * (80f + (projectile.identity * 28f) % 560f) * Owner.direction; + destination = Owner.Center - Vector2.UnitX * (80f + (Projectile.identity * 28f) % 560f) * Owner.direction; else { - Vector2 destA = potentialTarget.Center + Vector2.UnitX * (130f + (projectile.identity * 28f) % 560f); - Vector2 destB = potentialTarget.Center - Vector2.UnitX * (130f + (projectile.identity * 28f) % 560f); - if ((projectile.Center - destA).Length() < (projectile.Center - destB).Length()) + Vector2 destA = potentialTarget.Center + Vector2.UnitX * (130f + (Projectile.identity * 28f) % 560f); + Vector2 destB = potentialTarget.Center - Vector2.UnitX * (130f + (Projectile.identity * 28f) % 560f); + if ((Projectile.Center - destA).Length() < (Projectile.Center - destB).Length()) destination = destA; else destination = destB; @@ -105,11 +106,11 @@ namespace CalamityMod.Projectiles.Summon StuckWalkThroughWallsTimer = Utils.Clamp(StuckWalkThroughWallsTimer, 0, 160); - if (projectile.Distance(Owner.Center) > 3500f) + if (Projectile.Distance(Owner.Center) > 3500f) { - projectile.Center = Owner.Center; + Projectile.Center = Owner.Center; StuckWalkThroughWallsTimer = 0; - projectile.netImportant = true; + Projectile.netImportant = true; } if ((MoveToDestination(destination) || AttackTimer > 0) && potentialTarget != null) { @@ -117,17 +118,17 @@ namespace CalamityMod.Projectiles.Summon if (AttackTimer == 1) { UsingChargedLaserAttack = Main.rand.NextBool(7); - projectile.netUpdate = true; + Projectile.netUpdate = true; } if (AttackTimer >= (UsingChargedLaserAttack ? ChargedLaserAttackTime : ChargedPelletAttackTime)) { AttackTimer = 0; - projectile.netUpdate = true; + Projectile.netUpdate = true; } - if (MathHelper.Distance(potentialTarget.Center.X, projectile.Center.X) > 30f) - projectile.spriteDirection = (potentialTarget.Center.X - projectile.Center.X < 0).ToDirectionInt(); + if (MathHelper.Distance(potentialTarget.Center.X, Projectile.Center.X) > 30f) + Projectile.spriteDirection = (potentialTarget.Center.X - Projectile.Center.X < 0).ToDirectionInt(); if (UsingChargedLaserAttack) { @@ -142,59 +143,59 @@ namespace CalamityMod.Projectiles.Summon } else if (AttackTimer >= ChargedLaserAttackTime / 2 && AttackTimer <= ChargedLaserAttackTime / 2 + 60 && AttackTimer % 16 == 15) { - Main.PlaySound(SoundID.Item122, ArmPosition); - if (Main.myPlayer == projectile.owner) + SoundEngine.PlaySound(SoundID.Item122, ArmPosition); + if (Main.myPlayer == Projectile.owner) { - Vector2 initialVelocity = projectile.SafeDirectionTo(potentialTarget.Center) * 2f; + Vector2 initialVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 2f; if (Main.rand.NextBool(2)) initialVelocity = initialVelocity.RotatedByRandom(0.4f); float initialAngle = initialVelocity.ToRotation(); - Projectile.NewProjectile(ArmPosition, initialVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, initialAngle, Main.rand.Next(100)); + Projectile.NewProjectile(ArmPosition, initialVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, initialAngle, Main.rand.Next(100)); } } } - else if (!UsingChargedLaserAttack && AttackTimer == ChargedPelletAttackTime / 2 && Main.myPlayer == projectile.owner) + else if (!UsingChargedLaserAttack && AttackTimer == ChargedPelletAttackTime / 2 && Main.myPlayer == Projectile.owner) { - Vector2 initialVelocity = projectile.SafeDirectionTo(potentialTarget.Center + potentialTarget.velocity * 15f) * 19f; - Projectile.NewProjectile(ArmPosition, initialVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Vector2 initialVelocity = Projectile.SafeDirectionTo(potentialTarget.Center + potentialTarget.velocity * 15f) * 19f; + Projectile.NewProjectile(ArmPosition, initialVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } else if (potentialTarget is null && AttackTimer != 0) { AttackTimer = 0; - projectile.netUpdate = true; + Projectile.netUpdate = true; } } public void AdjustMinionDamage() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } - if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int newDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int newDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - projectile.damage = newDamage; + Projectile.damage = newDamage; } } public bool MoveToDestination(Vector2 destination) { - Tile tileBelow = CalamityUtils.ParanoidTileRetrieval((int)(projectile.Bottom.X / 16), (int)(projectile.Bottom.Y / 16)); + Tile tileBelow = CalamityUtils.ParanoidTileRetrieval((int)(Projectile.Bottom.X / 16), (int)(Projectile.Bottom.Y / 16)); // Float to the destination if stuck. if (Stuck) { StuckJumpSpeed = 0f; - projectile.tileCollide = false; + Projectile.tileCollide = false; - if (projectile.DistanceSQ(destination - Vector2.UnitY * 16f) > 10f * 10f) - projectile.velocity = projectile.SafeDirectionTo(destination - Vector2.UnitY * 16f) * 6f; + if (Projectile.DistanceSQ(destination - Vector2.UnitY * 16f) > 10f * 10f) + Projectile.velocity = Projectile.SafeDirectionTo(destination - Vector2.UnitY * 16f) * 6f; else StuckWalkThroughWallsTimer = 0; @@ -202,24 +203,24 @@ namespace CalamityMod.Projectiles.Summon return false; } - projectile.tileCollide = true; + Projectile.tileCollide = true; // Don't bother moving any more if super close to the destination. // Just slow down and face the player. - if (Math.Abs(projectile.Center.X - destination.X) < 55 + Math.Abs(projectile.velocity.X)) + if (Math.Abs(Projectile.Center.X - destination.X) < 55 + Math.Abs(Projectile.velocity.X)) { StuckJumpSpeed = 0f; - projectile.velocity.X *= 0.8f; + Projectile.velocity.X *= 0.8f; return true; } - int currentWalkDirection = Math.Sign(projectile.velocity.X); + int currentWalkDirection = Math.Sign(Projectile.velocity.X); int tilesSearchedAhead = 0; Tile tileBelowAhead; do { - tileBelowAhead = CalamityUtils.ParanoidTileRetrieval((int)(projectile.Bottom.X / 16) + currentWalkDirection, (int)(projectile.Bottom.Y / 16)); + tileBelowAhead = CalamityUtils.ParanoidTileRetrieval((int)(Projectile.Bottom.X / 16) + currentWalkDirection, (int)(Projectile.Bottom.Y / 16)); if (tileBelowAhead.IsTileSolidGround()) break; @@ -228,34 +229,34 @@ namespace CalamityMod.Projectiles.Summon } while (tilesSearchedAhead < 4); - int directionToWalk = Math.Sign(destination.X - projectile.Center.X); + int directionToWalk = Math.Sign(destination.X - Projectile.Center.X); float idealWalkSpeed = 10f * directionToWalk; float walkAcceleration = directionToWalk != currentWalkDirection ? 0.325f : 0.2f; - projectile.velocity.X = MathHelper.Lerp(projectile.velocity.X, idealWalkSpeed, walkAcceleration); + Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, idealWalkSpeed, walkAcceleration); // Jump if there's a gap or a wall. - if (tileBelow.IsTileSolidGround() || Collision.SolidCollision(projectile.Center, 10, 10)) + if (tileBelow.IsTileSolidGround() || Collision.SolidCollision(Projectile.Center, 10, 10)) { - if (Math.Abs(projectile.oldPosition.X - projectile.position.X) < 2f || - Collision.SolidCollision(projectile.Center, 2, 2) || - !Collision.CanHitLine(projectile.position, projectile.width, projectile.height, Owner.position, Owner.width, Owner.height)) + if (Math.Abs(Projectile.oldPosition.X - Projectile.position.X) < 2f || + Collision.SolidCollision(Projectile.Center, 2, 2) || + !Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, Owner.position, Owner.width, Owner.height)) { - projectile.velocity.Y = -12f - StuckJumpSpeed; - projectile.netSpam -= 10; + Projectile.velocity.Y = -12f - StuckJumpSpeed; + Projectile.netSpam -= 10; StuckJumpSpeed += 3.5f; StuckJumpSpeed = Utils.Clamp(StuckJumpSpeed, 0f, 14f); StuckWalkThroughWallsTimer += 10f; - projectile.netUpdate = true; + Projectile.netUpdate = true; } else if (tilesSearchedAhead > 0) { - projectile.velocity.X = 7f; + Projectile.velocity.X = 7f; - projectile.velocity.Y = -(5f + tilesSearchedAhead * 2f); - projectile.netSpam -= 10; - projectile.netUpdate = true; + Projectile.velocity.Y = -(5f + tilesSearchedAhead * 2f); + Projectile.netSpam -= 10; + Projectile.netUpdate = true; } else { @@ -264,7 +265,7 @@ namespace CalamityMod.Projectiles.Summon } } - projectile.spriteDirection = (Owner.Center.X - projectile.Center.X < 0).ToDirectionInt(); + Projectile.spriteDirection = (Owner.Center.X - Projectile.Center.X < 0).ToDirectionInt(); return false; } #endregion @@ -273,7 +274,7 @@ namespace CalamityMod.Projectiles.Summon public override bool OnTileCollide(Vector2 oldVelocity) => false; public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { - fallThrough = projectile.Bottom.Y < Owner.Top.Y; + fallThrough = Projectile.Bottom.Y < Owner.Top.Y; return true; } @@ -289,34 +290,34 @@ namespace CalamityMod.Projectiles.Summon int endingBeamFrame = 15; // Walking frames. Moves more quickly the faster the walk. - projectile.frameCounter++; - Tile tileBelow = CalamityUtils.ParanoidTileRetrieval((int)(projectile.Bottom.X / 16), (int)(projectile.Bottom.Y / 16)); + Projectile.frameCounter++; + Tile tileBelow = CalamityUtils.ParanoidTileRetrieval((int)(Projectile.Bottom.X / 16), (int)(Projectile.Bottom.Y / 16)); if (Stuck) { - projectile.frame = 5; + Projectile.frame = 5; } else if (AttackTimer > 0) { if (UsingChargedLaserAttack) - projectile.frame = (int)MathHelper.Lerp(startingBeamFrame, endingBeamFrame + 1, Utils.InverseLerp(0f, ChargedLaserAttackTime, AttackTimer, true)); + Projectile.frame = (int)MathHelper.Lerp(startingBeamFrame, endingBeamFrame + 1, Utils.InverseLerp(0f, ChargedLaserAttackTime, AttackTimer, true)); else - projectile.frame = (int)MathHelper.Lerp(startingPelletFrame, endingPelletFrame + 1, Utils.InverseLerp(0f, ChargedPelletAttackTime, AttackTimer, true)); + Projectile.frame = (int)MathHelper.Lerp(startingPelletFrame, endingPelletFrame + 1, Utils.InverseLerp(0f, ChargedPelletAttackTime, AttackTimer, true)); } - else if (Math.Abs(projectile.velocity.X) > 5f && Math.Abs(projectile.velocity.Y) < 2f && tileBelow.IsTileSolidGround()) + else if (Math.Abs(Projectile.velocity.X) > 5f && Math.Abs(Projectile.velocity.Y) < 2f && tileBelow.IsTileSolidGround()) { - if (projectile.frameCounter >= Utils.Clamp(2, 6, (int)Math.Abs(projectile.velocity.X * 0.8))) + if (Projectile.frameCounter >= Utils.Clamp(2, 6, (int)Math.Abs(Projectile.velocity.X * 0.8))) { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame >= endingWalkFrame) - projectile.frame = startingWalkFrame; + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame >= endingWalkFrame) + Projectile.frame = startingWalkFrame; } - projectile.frame = Utils.Clamp(projectile.frame, startingWalkFrame, endingWalkFrame); + Projectile.frame = Utils.Clamp(Projectile.frame, startingWalkFrame, endingWalkFrame); } - else if (Math.Abs(projectile.velocity.X) <= 1f) + else if (Math.Abs(Projectile.velocity.X) <= 1f) { - projectile.frame = 0; + Projectile.frame = 0; } } diff --git a/Projectiles/Summon/DaedalusLightning.cs b/Projectiles/Summon/DaedalusLightning.cs index b5fbd0c13b..733275630d 100644 --- a/Projectiles/Summon/DaedalusLightning.cs +++ b/Projectiles/Summon/DaedalusLightning.cs @@ -15,41 +15,41 @@ namespace CalamityMod.Projectiles.Summon public const int MaximumBranchingIterations = 3; public const float LightningTurnRandomnessFactor = 1.7f; - public ref float InitialVelocityAngle => ref projectile.ai[0]; + public ref float InitialVelocityAngle => ref Projectile.ai[0]; // Technically not a ratio, and more of a seed, but it is used in a 0-2pi squash // later in the code to get an arbitrary unit vector (which is then checked). - public ref float BaseTurnAngleRatio => ref projectile.ai[1]; - public ref float AccumulatedXMovementSpeeds => ref projectile.localAI[0]; - public ref float BranchingIteration => ref projectile.localAI[1]; + public ref float BaseTurnAngleRatio => ref Projectile.ai[1]; + public ref float AccumulatedXMovementSpeeds => ref Projectile.localAI[0]; + public ref float BranchingIteration => ref Projectile.localAI[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Daedalus Lightning"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 100; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 100; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.minion = true; - projectile.alpha = 255; - projectile.penetrate = 2; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.extraUpdates = 20; - projectile.timeLeft = 45 * projectile.extraUpdates; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.alpha = 255; + Projectile.penetrate = 2; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 20; + Projectile.timeLeft = 45 * Projectile.extraUpdates; // Readjust the velocity magnitude the moment this projectile is created // to make velocity setting outside the scope of this projectile less irritating // to consider alongside extraUpdate multipliers. // Also set the initial angle. - if (projectile.velocity != Vector2.Zero) + if (Projectile.velocity != Vector2.Zero) { - projectile.velocity /= projectile.extraUpdates; + Projectile.velocity /= Projectile.extraUpdates; } } @@ -69,18 +69,18 @@ namespace CalamityMod.Projectiles.Summon { // frameCounter in this context is really just an arbitrary timer // which allows random turning to occur. - projectile.frameCounter++; + Projectile.frameCounter++; - projectile.scale = (float)Math.Sin(MathHelper.Pi * projectile.timeLeft / (45f * (projectile.MaxUpdates - 1))) * 4f; - if (projectile.scale > 1f) - projectile.scale = 1f; + Projectile.scale = (float)Math.Sin(MathHelper.Pi * Projectile.timeLeft / (45f * (Projectile.MaxUpdates - 1))) * 4f; + if (Projectile.scale > 1f) + Projectile.scale = 1f; - Lighting.AddLight(projectile.Center, Color.Pink.ToVector3()); - if (projectile.frameCounter >= projectile.extraUpdates * 2) + Lighting.AddLight(Projectile.Center, Color.Pink.ToVector3()); + if (Projectile.frameCounter >= Projectile.extraUpdates * 2) { - projectile.frameCounter = 0; + Projectile.frameCounter = 0; - float originalSpeed = MathHelper.Min(6f, projectile.velocity.Length()); + float originalSpeed = MathHelper.Min(6f, Projectile.velocity.Length()); UnifiedRandom unifiedRandom = new UnifiedRandom((int)BaseTurnAngleRatio); int turnTries = 0; Vector2 newBaseDirection = -Vector2.UnitY; @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Summon // This mess of math basically encourages movement at the ends of an extraUpdate cycle, // discourages super frequenent randomness as the accumulated X speed changes get larger, // or if the original speed is quite large. - if (Math.Abs(potentialBaseDirection.X * (projectile.extraUpdates + 1) * 2f * originalSpeed + AccumulatedXMovementSpeeds) > projectile.MaxUpdates * LightningTurnRandomnessFactor) + if (Math.Abs(potentialBaseDirection.X * (Projectile.extraUpdates + 1) * 2f * originalSpeed + AccumulatedXMovementSpeeds) > Projectile.MaxUpdates * LightningTurnRandomnessFactor) { canChangeLightningDirection = false; } @@ -117,11 +117,11 @@ namespace CalamityMod.Projectiles.Summon } while (turnTries < 100); - if (projectile.velocity != Vector2.Zero) + if (Projectile.velocity != Vector2.Zero) { - AccumulatedXMovementSpeeds += newBaseDirection.X * (projectile.extraUpdates + 1) * 2f * originalSpeed; - projectile.velocity = newBaseDirection.RotatedBy(InitialVelocityAngle + MathHelper.PiOver2) * originalSpeed; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + AccumulatedXMovementSpeeds += newBaseDirection.X * (Projectile.extraUpdates + 1) * 2f * originalSpeed; + Projectile.velocity = newBaseDirection.RotatedBy(InitialVelocityAngle + MathHelper.PiOver2) * originalSpeed; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } } } @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Summon #region Drawing internal float WidthFunction(float completionRatio) { - float baseWidth = MathHelper.Lerp(2f, 6f, (float)Math.Sin(MathHelper.Pi * 4f * completionRatio) * 0.5f + 0.5f) * projectile.scale; + float baseWidth = MathHelper.Lerp(2f, 6f, (float)Math.Sin(MathHelper.Pi * 4f * completionRatio) * 0.5f + 0.5f) * Projectile.scale; return baseWidth * (float)Math.Sin(MathHelper.Pi * completionRatio); } internal Color ColorFunction(float completionRatio) @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Summon if (LightningDrawer is null) LightningDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, PrimitiveTrail.RigidPointRetreivalFunction); - LightningDrawer.Draw(projectile.oldPos.Where(oldPos => oldPos != Vector2.Zero), projectile.Size * 0.5f - Main.screenPosition, 300); + LightningDrawer.Draw(Projectile.oldPos.Where(oldPos => oldPos != Vector2.Zero), Projectile.Size * 0.5f - Main.screenPosition, 300); return false; } #endregion diff --git a/Projectiles/Summon/DaedalusPellet.cs b/Projectiles/Summon/DaedalusPellet.cs index 065202b6a3..c74b745b2d 100644 --- a/Projectiles/Summon/DaedalusPellet.cs +++ b/Projectiles/Summon/DaedalusPellet.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class DaedalusPellet : ModProjectile @@ -10,55 +11,55 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Pellet"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.minion = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -2; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -2; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - if (projectile.frame >= 3) + Projectile.frame++; + if (Projectile.frame >= 3) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.frameCounter = 0; + Projectile.frameCounter = 0; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[0] = 1f; - Main.PlaySound(SoundID.DD2_SkyDragonsFuryShot, projectile.Center); + Projectile.ai[0] = 1f; + SoundEngine.PlaySound(SoundID.DD2_SkyDragonsFuryShot, Projectile.Center); } - projectile.alpha = Utils.Clamp(projectile.alpha - 50, 0, 255); + Projectile.alpha = Utils.Clamp(Projectile.alpha - 50, 0, 255); } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } } diff --git a/Projectiles/Summon/DankCreeperMinion.cs b/Projectiles/Summon/DankCreeperMinion.cs index 8581d100c5..6c37aae470 100644 --- a/Projectiles/Summon/DankCreeperMinion.cs +++ b/Projectiles/Summon/DankCreeperMinion.cs @@ -14,55 +14,55 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Dank Creeper"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 30; + Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 1; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 14, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -72,34 +72,34 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.dCreeper) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.MinionAntiClump(); - float num535 = projectile.position.X; - float num536 = projectile.position.Y; + Projectile.MinionAntiClump(); + float num535 = Projectile.position.X; + float num536 = Projectile.position.Y; float num537 = 1300f; bool flag19 = false; int num538 = 1100; - if (projectile.ai[1] != 0f) + if (Projectile.ai[1] != 0f) { num538 = 1800; } - if (Math.Abs(projectile.Center.X - Main.player[projectile.owner].Center.X) + Math.Abs(projectile.Center.Y - Main.player[projectile.owner].Center.Y) > (float)num538) + if (Math.Abs(Projectile.Center.X - Main.player[Projectile.owner].Center.X) + Math.Abs(Projectile.Center.Y - Main.player[Projectile.owner].Center.Y) > (float)num538) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float num539 = npc.position.X + (float)(npc.width / 2); float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float num541 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num539) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num540); + if (num541 < num537 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { num535 = num539; num536 = num540; @@ -111,12 +111,12 @@ namespace CalamityMod.Projectiles.Summon { for (int num542 = 0; num542 < Main.maxNPCs; num542++) { - if (Main.npc[num542].CanBeChasedBy(projectile, false)) + if (Main.npc[num542].CanBeChasedBy(Projectile, false)) { float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); - if (num545 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num542].position, Main.npc[num542].width, Main.npc[num542].height)) + float num545 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num543) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num544); + if (num545 < num537 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num542].position, Main.npc[num542].width, Main.npc[num542].height)) { num537 = num545; num535 = num543; @@ -130,61 +130,61 @@ namespace CalamityMod.Projectiles.Summon if (!flag19) { float num546 = 8f; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { num546 = 12f; } - Vector2 vector42 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector42 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num547 = player.Center.X - vector42.X; float num548 = player.Center.Y - vector42.Y - 60f; float num549 = (float)Math.Sqrt((double)(num547 * num547 + num548 * num548)); - if (num549 < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (num549 < 100f && Projectile.ai[0] == 1f && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; } if (num549 > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.width / 2); + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.width / 2); } if (num549 > 70f) { num549 = num546 / num549; num547 *= num549; num548 *= num549; - projectile.velocity.X = (projectile.velocity.X * 20f + num547) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num548) / 21f; + Projectile.velocity.X = (Projectile.velocity.X * 20f + num547) / 21f; + Projectile.velocity.Y = (Projectile.velocity.Y * 20f + num548) / 21f; } else { - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; } - projectile.rotation = projectile.velocity.X * 0.05f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + Projectile.rotation = Projectile.velocity.X * 0.05f; + if ((double)Math.Abs(Projectile.velocity.X) > 0.2) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; return; } } else { - if (projectile.ai[1] == -1f) + if (Projectile.ai[1] == -1f) { - projectile.ai[1] = 11f; + Projectile.ai[1] = 11f; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] -= 1f; + Projectile.ai[1] -= 1f; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { float num550 = 8f; //12 - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -195,20 +195,20 @@ namespace CalamityMod.Projectiles.Summon num553 = num550 / num553; num551 *= num553; num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; + Projectile.velocity.X = (Projectile.velocity.X * 14f + num551) / 15f; + Projectile.velocity.Y = (Projectile.velocity.Y * 14f + num552) / 15f; } else { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 10f) { - projectile.velocity *= 1.05f; + Projectile.velocity *= 1.05f; } } - projectile.rotation = projectile.velocity.X * 0.05f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + Projectile.rotation = Projectile.velocity.X * 0.05f; + if ((double)Math.Abs(Projectile.velocity.X) > 0.2) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; return; } } @@ -216,16 +216,16 @@ namespace CalamityMod.Projectiles.Summon public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) + Rectangle myRect = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == NPCID.Guide && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || - (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) + ((Projectile.friendly && (!Main.npc[i].friendly || Projectile.type == 318 || (Main.npc[i].type == NPCID.Guide && Projectile.owner < 255 && Main.player[Projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && Projectile.owner < 255 && Main.player[Projectile.owner].killClothier))) || + (Projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (Projectile.owner < 0 || Main.npc[i].immune[Projectile.owner] == 0 || Projectile.maxPenetrate == 1)) { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + if (Main.npc[i].noTileCollide || !Projectile.ownerHitCheck || Projectile.CanHit(Main.npc[i])) { bool flag3; if (Main.npc[i].type == NPCID.SolarCrawltipedeTail) @@ -236,21 +236,21 @@ namespace CalamityMod.Projectiles.Summon rect.Y -= num5; rect.Width += num5 * 2; rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); + flag3 = Projectile.Colliding(myRect, rect); } else { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + flag3 = Projectile.Colliding(myRect, Main.npc[i].getRect()); } if (flag3) { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + if (Main.npc[i].reflectingProjectiles && Projectile.CanReflect()) { - Main.npc[i].ReflectProjectile(projectile.whoAmI); + Main.npc[i].ReflectProjectile(Projectile.whoAmI); return; } - projectile.ai[1] = -1f; - projectile.netUpdate = true; + Projectile.ai[1] = -1f; + Projectile.netUpdate = true; } } } @@ -260,8 +260,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Summon/DazzlingStabber.cs b/Projectiles/Summon/DazzlingStabber.cs index 99c39730e1..cf805c5c09 100644 --- a/Projectiles/Summon/DazzlingStabber.cs +++ b/Projectiles/Summon/DazzlingStabber.cs @@ -10,45 +10,45 @@ namespace CalamityMod.Projectiles.Summon { public class DazzlingStabber : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float AttackDelay => ref projectile.ai[0]; - public ref float RestOffsetAngle => ref projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float AttackDelay => ref Projectile.ai[0]; + public ref float RestOffsetAngle => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Dazzling Stabber"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 25; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 25; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 58; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 90000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; - projectile.light = 1f; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 26; + Projectile.height = 58; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.light = 1f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.White.ToVector3()); + Lighting.AddLight(Projectile.Center, Color.White.ToVector3()); ApplyPlayerBuffs(); AdjustDamageDynamically(); UpdateFrames(); - NPC potentialTarget = projectile.Center.MinionHoming(1100f, Owner); + NPC potentialTarget = Projectile.Center.MinionHoming(1100f, Owner); if (potentialTarget != null) SliceTarget(potentialTarget); @@ -59,35 +59,35 @@ namespace CalamityMod.Projectiles.Summon public void ApplyPlayerBuffs() { Owner.AddBuff(ModContent.BuffType(), 3600); - if (projectile.type == ModContent.ProjectileType()) + if (Projectile.type == ModContent.ProjectileType()) { if (Owner.dead) Owner.Calamity().providenceStabber = false; if (Owner.Calamity().providenceStabber) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } public void AdjustDamageDynamically() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1f; } - if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - projectile.damage = trueDamage; + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); + Projectile.damage = trueDamage; } } public void UpdateFrames() { - projectile.frameCounter++; - if (projectile.frameCounter % 6 == 0) - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + if (Projectile.frameCounter % 6 == 0) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; } public void SliceTarget(NPC target) @@ -102,65 +102,65 @@ namespace CalamityMod.Projectiles.Summon // Reset the velocity to fly upward if there is very little motion to ensure // that the summon does not get stuck. - if (projectile.velocity.Length() < 3f) - projectile.velocity = Vector2.UnitY * -12f; + if (Projectile.velocity.Length() < 3f) + Projectile.velocity = Vector2.UnitY * -12f; // If close to the target, slow down dramatically. - if (projectile.velocity.Length() > 5f && projectile.WithinRange(target.Center, 90f)) - projectile.velocity *= 0.93f; + if (Projectile.velocity.Length() > 5f && Projectile.WithinRange(target.Center, 90f)) + Projectile.velocity *= 0.93f; // Otherwise, if not close, speed up dramatically. - else if (projectile.velocity.Length() < 40f) - projectile.velocity *= 1.03f; + else if (Projectile.velocity.Length() < 40f) + Projectile.velocity *= 1.03f; float angularTurnSpeed = 0.35f; - float angleToTargetCoords = projectile.AngleTo(target.Center); + float angleToTargetCoords = Projectile.AngleTo(target.Center); - if (!projectile.WithinRange(target.Center, 200f)) - projectile.velocity = projectile.velocity.ToRotation().AngleTowards(angleToTargetCoords, angularTurnSpeed).ToRotationVector2() * projectile.velocity.Length(); + if (!Projectile.WithinRange(target.Center, 200f)) + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(angleToTargetCoords, angularTurnSpeed).ToRotationVector2() * Projectile.velocity.Length(); // If not super close to the target but the target is very much in the line of sight of the summon, charge. - if (!projectile.WithinRange(target.Center, 75f) && Vector2.Dot(projectile.SafeDirectionTo(target.Center), projectile.velocity.SafeNormalize(Vector2.Zero)) > 0.85f) + if (!Projectile.WithinRange(target.Center, 75f) && Vector2.Dot(Projectile.SafeDirectionTo(target.Center), Projectile.velocity.SafeNormalize(Vector2.Zero)) > 0.85f) { - projectile.velocity = projectile.SafeDirectionTo(target.Center) * 36f; + Projectile.velocity = Projectile.SafeDirectionTo(target.Center) * 36f; AttackDelay = 15f; - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public void ReturnToRestingPosition() { - projectile.rotation = projectile.rotation.AngleTowards(RestOffsetAngle, 0.25f); + Projectile.rotation = Projectile.rotation.AngleTowards(RestOffsetAngle, 0.25f); // Rapidly approach the resting position. Vector2 destination = Owner.Center + Vector2.UnitY.RotatedBy(RestOffsetAngle) * -120f; - projectile.velocity = (destination - projectile.Center) / 10f; + Projectile.velocity = (destination - Projectile.Center) / 10f; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - for (int i = 1; i < projectile.oldPos.Length; i++) - CalamityUtils.DistanceClamp(ref projectile.oldPos[i - 1], ref projectile.oldPos[i], 6f); + for (int i = 1; i < Projectile.oldPos.Length; i++) + CalamityUtils.DistanceClamp(ref Projectile.oldPos[i - 1], ref Projectile.oldPos[i], 6f); - Texture2D trailSegmentTexture = ModContent.GetTexture("CalamityMod/Projectiles/StarProj"); - for (int i = 2; i < projectile.oldPos.Length; i++) + Texture2D trailSegmentTexture = ModContent.Request("CalamityMod/Projectiles/StarProj"); + for (int i = 2; i < Projectile.oldPos.Length; i++) { - float completionRatio = i / (float)projectile.oldPos.Length; - float rotation = (projectile.oldPos[i - 1] - projectile.oldPos[i]).ToRotation() + MathHelper.PiOver2; - float scale = MathHelper.Lerp(0.7f, 0.1f, completionRatio) * projectile.scale; + float completionRatio = i / (float)Projectile.oldPos.Length; + float rotation = (Projectile.oldPos[i - 1] - Projectile.oldPos[i]).ToRotation() + MathHelper.PiOver2; + float scale = MathHelper.Lerp(0.7f, 0.1f, completionRatio) * Projectile.scale; Color color = Color.Lerp(Color.LightPink, Color.Goldenrod, completionRatio * 3f % 1f) * 1.5f; // Become dimmer the slower the projectile is moving. - color *= Utils.InverseLerp(1f, 8f, projectile.velocity.Length(), true); + color *= Utils.InverseLerp(1f, 8f, Projectile.velocity.Length(), true); // As well as how close the projectile is to pointing away from its rotation. - color *= Utils.InverseLerp(0.65f, 0.45f, projectile.velocity.AngleBetween(-(projectile.rotation + MathHelper.PiOver2).ToRotationVector2()) / MathHelper.Pi, true); + color *= Utils.InverseLerp(0.65f, 0.45f, Projectile.velocity.AngleBetween(-(Projectile.rotation + MathHelper.PiOver2).ToRotationVector2()) / MathHelper.Pi, true); spriteBatch.Draw(trailSegmentTexture, - projectile.oldPos[i] + projectile.Size * 0.5f + new Vector2(0f, 8f).RotatedBy(projectile.rotation) - Main.screenPosition, + Projectile.oldPos[i] + Projectile.Size * 0.5f + new Vector2(0f, 8f).RotatedBy(Projectile.rotation) - Main.screenPosition, null, color, rotation, diff --git a/Projectiles/Summon/DeathstareBeam.cs b/Projectiles/Summon/DeathstareBeam.cs index 19cbb4f8b5..b5b3cd3494 100644 --- a/Projectiles/Summon/DeathstareBeam.cs +++ b/Projectiles/Summon/DeathstareBeam.cs @@ -9,45 +9,45 @@ namespace CalamityMod.Projectiles.Summon { public class DeathstareBeam : ModProjectile { - public ref float OwnerUUID => ref projectile.ai[0]; + public ref float OwnerUUID => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; - projectile.ignoreWater = true; - projectile.timeLeft = 10; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 10; } public override void AI() { if (!Main.projectile.IndexInRange((int)OwnerUUID)) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.Opacity = Utils.InverseLerp(1f, 0f, 1f - projectile.timeLeft / 10f, true); - projectile.Center = Main.projectile[(int)OwnerUUID].Center - projectile.velocity; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.Opacity = Utils.InverseLerp(1f, 0f, 1f - Projectile.timeLeft / 10f, true); + Projectile.Center = Main.projectile[(int)OwnerUUID].Center - Projectile.velocity; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D beamTexture = Main.projectileTexture[projectile.type]; - Vector2 drawPosition = projectile.Center + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Vector2 drawScale = new Vector2(0.55f, projectile.velocity.Length() / beamTexture.Height * 20f); - Color color = Color.White * 2.1f * projectile.Opacity; + Texture2D beamTexture = Main.projectileTexture[Projectile.type]; + Vector2 drawPosition = Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Vector2 drawScale = new Vector2(0.55f, Projectile.velocity.Length() / beamTexture.Height * 20f); + Color color = Color.White * 2.1f * Projectile.Opacity; - if (Math.Abs(projectile.rotation) > 0.008f) - spriteBatch.Draw(beamTexture, drawPosition, null, color, projectile.rotation, beamTexture.Frame().Bottom(), drawScale, SpriteEffects.None, 0f); + if (Math.Abs(Projectile.rotation) > 0.008f) + spriteBatch.Draw(beamTexture, drawPosition, null, color, Projectile.rotation, beamTexture.Frame().Bottom(), drawScale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Summon/DeathstareEyeball.cs b/Projectiles/Summon/DeathstareEyeball.cs index db84de3491..4cf968ea26 100644 --- a/Projectiles/Summon/DeathstareEyeball.cs +++ b/Projectiles/Summon/DeathstareEyeball.cs @@ -13,38 +13,38 @@ namespace CalamityMod.Projectiles.Summon // This does not need to be synced. It is used solely for drawcode/visuals and is intended to be local. public float PupilScale = 1f; public const int BeamFireRate = 60; - public Player Owner => Main.player[projectile.owner]; - public ref float Time => ref projectile.ai[1]; - public ref float PupilAngle => ref projectile.localAI[0]; - public ref float PupilOutwardness => ref projectile.localAI[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[1]; + public ref float PupilAngle => ref Projectile.localAI[0]; + public ref float PupilOutwardness => ref Projectile.localAI[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Eyeball"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.NeedsUUID[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 16; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 90000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; + Projectile.width = Projectile.height = 16; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; } #region AI public override void AI() { - Lighting.AddLight(projectile.Center, Color.Blue.ToVector3()); + Lighting.AddLight(Projectile.Center, Color.Blue.ToVector3()); - bool isCorrectMinion = projectile.type == ModContent.ProjectileType(); + bool isCorrectMinion = Projectile.type == ModContent.ProjectileType(); CalamityPlayer modPlayer = Owner.Calamity(); Owner.AddBuff(ModContent.BuffType(), 3600); @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Summon if (Owner.dead) modPlayer.deathstareEyeball = false; if (modPlayer.deathstareEyeball) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } Vector2 destination = Owner.Center + Vector2.UnitY * (Owner.gfxOffY - 110f); @@ -62,33 +62,33 @@ namespace CalamityMod.Projectiles.Summon destination.Y += 220f; // Very quickly fly towards above (or below if gravity is reversed) the player. - projectile.Center = Vector2.Lerp(projectile.Center, destination, 0.36f); + Projectile.Center = Vector2.Lerp(Projectile.Center, destination, 0.36f); - projectile.position = projectile.position.Floor(); - projectile.rotation = (projectile.position.X - projectile.oldPosition.X) * 0.07f + Owner.velocity.X * 0.2f; - projectile.rotation = Utils.Clamp(projectile.rotation, -0.4f, 0.4f); + Projectile.position = Projectile.position.Floor(); + Projectile.rotation = (Projectile.position.X - Projectile.oldPosition.X) * 0.07f + Owner.velocity.X * 0.2f; + Projectile.rotation = Utils.Clamp(Projectile.rotation, -0.4f, 0.4f); - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { Initialize(Owner); - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } - if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - NPC potentialTarget = projectile.Center.MinionHoming(720f, Owner); + NPC potentialTarget = Projectile.Center.MinionHoming(720f, Owner); if (potentialTarget is null) DoHoveringAI(); else DoAttackingAI(potentialTarget); - projectile.frame = (int)(Time / 5) % 4; + Projectile.frame = (int)(Time / 5) % 4; Time++; } @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Summon public void DoHoveringAI() { // Roll the pupil around if there's little movement from the eye and player. - if (Time % 180f > 120f && Math.Abs(projectile.rotation) < 0.03f) + if (Time % 180f > 120f && Math.Abs(Projectile.rotation) < 0.03f) { float idealAngle = Utils.InverseLerp(120f, 180f, Time % 180f, true) * MathHelper.TwoPi; @@ -119,11 +119,11 @@ namespace CalamityMod.Projectiles.Summon if (Time % BeamFireRate == BeamFireRate - 20) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Vector2 velocity = (target.Center - projectile.Center) / 15f; - int beam = Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[beam].ai[0] = Projectile.GetByUUID(projectile.owner, projectile.whoAmI); + Vector2 velocity = (target.Center - Projectile.Center) / 15f; + int beam = Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Main.projectile[beam].ai[0] = Projectile.GetByUUID(Projectile.owner, Projectile.whoAmI); Main.projectile[beam].Damage(); } PupilScale = 1.5f; @@ -138,21 +138,21 @@ namespace CalamityMod.Projectiles.Summon else { PupilScale = MathHelper.Lerp(PupilScale, 1f, 0.175f); - PupilAngle = PupilAngle.AngleTowards(projectile.AngleTo(target.Center), MathHelper.ToRadians(15f)); + PupilAngle = PupilAngle.AngleTowards(Projectile.AngleTo(target.Center), MathHelper.ToRadians(15f)); } } public void Initialize(Player player) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; if (!Main.dedServ) return; for (int i = 0; i < 25; i++) { - Dust dust = Dust.NewDustDirect(projectile.position, 52, 52, DustID.Blood); + Dust dust = Dust.NewDustDirect(Projectile.position, 52, 52, DustID.Blood); dust.noGravity = true; dust.scale = Main.rand.NextFloat(1.2f, 1.5f); } @@ -162,17 +162,17 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D eyeTexture = Main.projectileTexture[projectile.type]; - Rectangle frame = eyeTexture.Frame(1, 4, 0, projectile.frame); + Texture2D eyeTexture = Main.projectileTexture[Projectile.type]; + Rectangle frame = eyeTexture.Frame(1, 4, 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; SpriteEffects spriteEffects = Owner.gravDir == 1 ? SpriteEffects.None : SpriteEffects.FlipVertically; - spriteBatch.Draw(eyeTexture, projectile.Center - Main.screenPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(eyeTexture, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); // Pupil drawing. - Texture2D pupilTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/DeathstareEyePupil"); - Vector2 pupilDrawPosition = projectile.Center - Main.screenPosition + PupilAngle.ToRotationVector2() * PupilOutwardness; + Texture2D pupilTexture = ModContent.Request("CalamityMod/Projectiles/Summon/DeathstareEyePupil"); + Vector2 pupilDrawPosition = Projectile.Center - Main.screenPosition + PupilAngle.ToRotationVector2() * PupilOutwardness; pupilDrawPosition -= Vector2.UnitY * 4f; - spriteBatch.Draw(pupilTexture, pupilDrawPosition, null, projectile.GetAlpha(lightColor), PupilAngle, pupilTexture.Size() * 0.5f, PupilScale, spriteEffects, 0f); + spriteBatch.Draw(pupilTexture, pupilDrawPosition, null, Projectile.GetAlpha(lightColor), PupilAngle, pupilTexture.Size() * 0.5f, PupilScale, spriteEffects, 0f); return false; } diff --git a/Projectiles/Summon/DormantBrimseekerAura.cs b/Projectiles/Summon/DormantBrimseekerAura.cs index a54d5b88dd..2b70e565a3 100644 --- a/Projectiles/Summon/DormantBrimseekerAura.cs +++ b/Projectiles/Summon/DormantBrimseekerAura.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class DormantBrimseekerAura : ModProjectile @@ -13,57 +14,57 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Dormant Brimseeker Aura Projecter"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 30; - projectile.height = 30; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.tileCollide = true; + Projectile.friendly = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; } public override void AI() { - projectile.rotation = projectile.rotation.AngleLerp(-MathHelper.PiOver4, 0.045f); - projectile.velocity *= 0.975f; - if (Math.Abs(projectile.rotation + MathHelper.PiOver4) < 0.04f) + Projectile.rotation = Projectile.rotation.AngleLerp(-MathHelper.PiOver4, 0.045f); + Projectile.velocity *= 0.975f; + if (Math.Abs(Projectile.rotation + MathHelper.PiOver4) < 0.04f) { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.DD2_EtherianPortalOpen, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalOpen, Projectile.Center); for (int i = 0; i < 30; i++) { float angle = 1.4f * (i / 30f) - 0.7f; - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.Brimstone); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.Brimstone); dust.velocity = new Vector2(0f, -14f).RotatedBy(angle); dust.noGravity = true; } for (int i = 0; i < 50; i++) { float angle = 2.4f * (i / 50f) - 1.2f; - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.Brimstone); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.Brimstone); dust.velocity = new Vector2(0f, 8f).RotatedBy(angle); } - projectile.timeLeft = 820; - projectile.localAI[0] = 1f; + Projectile.timeLeft = 820; + Projectile.localAI[0] = 1f; } else { - if (projectile.localAI[1] < 400f) + if (Projectile.localAI[1] < 400f) { - projectile.localAI[1] += 6f; + Projectile.localAI[1] += 6f; } - projectile.ai[1] += MathHelper.ToRadians(1.2f); + Projectile.ai[1] += MathHelper.ToRadians(1.2f); for (int i = 0; i < 85; i++) { - float angle = MathHelper.TwoPi / 85f * i + projectile.ai[1]; - Dust dust = Dust.NewDustPerfect(projectile.Center + angle.ToRotationVector2() * projectile.localAI[1], (int)CalamityDusts.Brimstone); + float angle = MathHelper.TwoPi / 85f * i + Projectile.ai[1]; + Dust dust = Dust.NewDustPerfect(Projectile.Center + angle.ToRotationVector2() * Projectile.localAI[1], (int)CalamityDusts.Brimstone); dust.noGravity = true; dust.velocity = Vector2.Zero; if (Main.rand.NextBool(360)) @@ -72,9 +73,9 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && - Main.projectile[i].owner == projectile.owner && Main.projectile[i].localAI[1] == 0f) + Main.projectile[i].owner == Projectile.owner && Main.projectile[i].localAI[1] == 0f) { - if (Main.projectile[i].Distance(projectile.Center) < projectile.localAI[1]) + if (Main.projectile[i].Distance(Projectile.Center) < Projectile.localAI[1]) { for (int j = 0; j < 30; j++) { @@ -82,15 +83,15 @@ namespace CalamityMod.Projectiles.Summon dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 7f; } Main.projectile[i].localAI[1] = 1f; - Main.PlaySound(SoundID.Item45, Main.projectile[i].Center); + SoundEngine.PlaySound(SoundID.Item45, Main.projectile[i].Center); } } } if (Main.rand.NextBool(50)) { - int idx = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner, projectile.identity); - Main.projectile[idx].timeLeft = projectile.timeLeft; + int idx = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, Projectile.identity); + Main.projectile[idx].timeLeft = Projectile.timeLeft; } } } @@ -100,14 +101,14 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.projectile.Length; i++) { if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && - Main.projectile[i].owner == projectile.owner && Main.projectile[i].localAI[1] == 1f) + Main.projectile[i].owner == Projectile.owner && Main.projectile[i].localAI[1] == 1f) { for (int j = 0; j < 30; j++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.Brimstone); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.Brimstone); dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 7f; } - Main.PlaySound(SoundID.Item29, Main.projectile[i].Center); + SoundEngine.PlaySound(SoundID.Item29, Main.projectile[i].Center); Main.projectile[i].localAI[1] = 0f; } } diff --git a/Projectiles/Summon/DormantBrimseekerBab.cs b/Projectiles/Summon/DormantBrimseekerBab.cs index 3afad601ac..d7916bf67e 100644 --- a/Projectiles/Summon/DormantBrimseekerBab.cs +++ b/Projectiles/Summon/DormantBrimseekerBab.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -18,56 +19,56 @@ namespace CalamityMod.Projectiles.Summon { get { - return (projectile.localAI[1] == 1f) ? 21 : 38; + return (Projectile.localAI[1] == 1f) ? 21 : 38; } } public override void SetStaticDefaults() { DisplayName.SetDefault("Dormant Brimseeker"); - Main.projFrames[projectile.type] = 8; + Main.projFrames[Projectile.type] = 8; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 46; - projectile.height = 36; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 1f; - projectile.ignoreWater = true; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 46; + Projectile.height = 36; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 1f; + Projectile.ignoreWater = true; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) { @@ -77,107 +78,107 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.brimseeker) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); + NPC potentialTarget = Projectile.Center.MinionHoming(DistanceToCheck, player); if (potentialTarget == null) { - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { - projectile.ai[0] = 0f; // Disable charge animation when not attacking + Projectile.ai[0] = 0f; // Disable charge animation when not attacking } - projectile.rotation = projectile.rotation.AngleTowards(0f, 0.1f); - projectile.direction = projectile.spriteDirection = (projectile.velocity.X < 0).ToDirectionInt(); - projectile.ai[1] += MathHelper.ToRadians(3f); - if (projectile.ai[1] >= MathHelper.Pi * 4f) + Projectile.rotation = Projectile.rotation.AngleTowards(0f, 0.1f); + Projectile.direction = Projectile.spriteDirection = (Projectile.velocity.X < 0).ToDirectionInt(); + Projectile.ai[1] += MathHelper.ToRadians(3f); + if (Projectile.ai[1] >= MathHelper.Pi * 4f) { - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; } - Vector2 destination = player.Center + projectile.ai[1].ToRotationVector2() * new Vector2(1f, (float)Math.Cos(projectile.ai[1])) * 200f; + Vector2 destination = player.Center + Projectile.ai[1].ToRotationVector2() * new Vector2(1f, (float)Math.Cos(Projectile.ai[1])) * 200f; - projectile.velocity = (projectile.velocity * 18f + projectile.SafeDirectionTo(destination) * 14f) / 20f; + Projectile.velocity = (Projectile.velocity * 18f + Projectile.SafeDirectionTo(destination) * 14f) / 20f; - projectile.frameCounter++; - if (projectile.frameCounter >= 6) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 6) { - projectile.frameCounter = 0; - projectile.frame++; + Projectile.frameCounter = 0; + Projectile.frame++; } - if (projectile.frame >= 4 + (projectile.localAI[1] == 1f).ToInt() * 4) + if (Projectile.frame >= 4 + (Projectile.localAI[1] == 1f).ToInt() * 4) { - projectile.frame = (projectile.localAI[1] == 1f).ToInt() * 4; + Projectile.frame = (Projectile.localAI[1] == 1f).ToInt() * 4; } - projectile.MinionAntiClump(0.1f); - if (projectile.Distance(player.Center) > 2700f) + Projectile.MinionAntiClump(0.1f); + if (Projectile.Distance(player.Center) > 2700f) { - projectile.Center = player.Center; - projectile.netUpdate = true; + Projectile.Center = player.Center; + Projectile.netUpdate = true; } } else { - if (projectile.Distance(potentialTarget.Center) < 1100f && projectile.ai[0] == 0f) + if (Projectile.Distance(potentialTarget.Center) < 1100f && Projectile.ai[0] == 0f) { - Main.PlaySound(SoundID.DD2_DrakinShot, projectile.Center); - projectile.ai[0]++; - float acceleration = (projectile.localAI[1] == 1f) ? 1.6f : 0.8f; - float minSpeed = (projectile.localAI[1] == 1f) ? 13f : 8f; - float maxSpeed = (projectile.localAI[1] == 1f) ? 21f : 18f; - projectile.velocity = projectile.SafeDirectionTo(potentialTarget.Center) * MathHelper.Clamp(projectile.velocity.Length() + acceleration, minSpeed, maxSpeed); - projectile.rotation = projectile.AngleTo(potentialTarget.Center) + (projectile.spriteDirection == 1).ToInt() * MathHelper.Pi; + SoundEngine.PlaySound(SoundID.DD2_DrakinShot, Projectile.Center); + Projectile.ai[0]++; + float acceleration = (Projectile.localAI[1] == 1f) ? 1.6f : 0.8f; + float minSpeed = (Projectile.localAI[1] == 1f) ? 13f : 8f; + float maxSpeed = (Projectile.localAI[1] == 1f) ? 21f : 18f; + Projectile.velocity = Projectile.SafeDirectionTo(potentialTarget.Center) * MathHelper.Clamp(Projectile.velocity.Length() + acceleration, minSpeed, maxSpeed); + Projectile.rotation = Projectile.AngleTo(potentialTarget.Center) + (Projectile.spriteDirection == 1).ToInt() * MathHelper.Pi; } - else if (projectile.ai[0] > 0) + else if (Projectile.ai[0] > 0) { - projectile.ai[0]++; + Projectile.ai[0]++; SeekingTarget = false; } - else if (projectile.Distance(potentialTarget.Center) >= 1100f) + else if (Projectile.Distance(potentialTarget.Center) >= 1100f) { - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(potentialTarget.Center) + (projectile.spriteDirection == 1).ToInt() * MathHelper.Pi, 0.1f); - projectile.velocity = projectile.SafeDirectionTo(potentialTarget.Center) * MathHelper.Clamp(projectile.velocity.Length() + 2f, 6f, 15f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(potentialTarget.Center) + (Projectile.spriteDirection == 1).ToInt() * MathHelper.Pi, 0.1f); + Projectile.velocity = Projectile.SafeDirectionTo(potentialTarget.Center) * MathHelper.Clamp(Projectile.velocity.Length() + 2f, 6f, 15f); SeekingTarget = true; - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; } - if (projectile.ai[0] >= MaxChargeTime) + if (Projectile.ai[0] >= MaxChargeTime) { - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(potentialTarget.Center) + (projectile.spriteDirection == 1).ToInt() * MathHelper.Pi, 0.1f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(potentialTarget.Center) + (Projectile.spriteDirection == 1).ToInt() * MathHelper.Pi, 0.1f); } - projectile.frameCounter++; - if (projectile.frameCounter >= 6) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 6) { - projectile.frameCounter = 0; - projectile.frame++; + Projectile.frameCounter = 0; + Projectile.frame++; } - if (projectile.frame >= 8) + if (Projectile.frame >= 8) { - projectile.frame = 4; + Projectile.frame = 4; } - if (projectile.ai[0] >= MaxChargeTime + TurnTime) - projectile.ai[0] = 0f; + if (Projectile.ai[0] >= MaxChargeTime + TurnTime) + Projectile.ai[0] = 0f; } - Lighting.AddLight(projectile.Center, Color.Red.ToVector3()); + Lighting.AddLight(Projectile.Center, Color.Red.ToVector3()); } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - if ((projectile.ai[0] > 0f && projectile.ai[0] <= MaxChargeTime && projectile.velocity.Length() >= 8f) || SeekingTarget) + if ((Projectile.ai[0] > 0f && Projectile.ai[0] <= MaxChargeTime && Projectile.velocity.Length() >= 8f) || SeekingTarget) { - Texture2D projectileTexture = ModContent.GetTexture(Texture); + Texture2D projectileTexture = ModContent.Request(Texture); Texture2D flameTexture = Main.extraTexture[ExtrasID.MeteorHeadFlame]; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - float completionRatio = projectile.ai[0] / 30f; - if (projectile.ai[0] > 30f) - completionRatio = 1f - (30f - projectile.ai[0]) / 30f; + float completionRatio = Projectile.ai[0] / 30f; + if (Projectile.ai[0] > 30f) + completionRatio = 1f - (30f - Projectile.ai[0]) / 30f; - Vector2 modifiedProjectileTexture = new Vector2(projectileTexture.Width / 2,projectileTexture.Height / Main.projFrames[projectile.type] / 2); + Vector2 modifiedProjectileTexture = new Vector2(projectileTexture.Width / 2,projectileTexture.Height / Main.projFrames[Projectile.type] / 2); for (int oldPositionDrawIndex = 6; oldPositionDrawIndex >= 0; oldPositionDrawIndex--) { Color drawColor = Color.Lerp(Color.LightGoldenrodYellow, new Color(142, 24, 67), completionRatio); @@ -188,7 +189,7 @@ namespace CalamityMod.Projectiles.Summon drawColor.B = (byte)(drawColor.B * (10 - oldPositionDrawIndex) / 20); drawColor.A = (byte)(drawColor.A * (10 - oldPositionDrawIndex) / 20); drawColor *= completionRatio; - int yFrame = ((int)projectile.ai[0] / 2 - oldPositionDrawIndex) % 4; + int yFrame = ((int)Projectile.ai[0] / 2 - oldPositionDrawIndex) % 4; if (yFrame < 0) { yFrame += 4; @@ -196,10 +197,10 @@ namespace CalamityMod.Projectiles.Summon Rectangle flameFrameRectangle = flameTexture.Frame(1, 4, 0, yFrame); Vector2 flameOrigin = new Vector2(flameTexture.Width / 2, flameTexture.Height / 8 + 14); spriteBatch.Draw(flameTexture, - new Vector2(projectile.oldPos[oldPositionDrawIndex].X - Main.screenPosition.X + projectile.width / 2 - projectileTexture.Width * projectile.scale / 2f + modifiedProjectileTexture.X * projectile.scale, projectile.oldPos[oldPositionDrawIndex].Y - Main.screenPosition.Y + projectile.height - projectileTexture.Height * projectile.scale / Main.projFrames[projectile.type] + 4f + modifiedProjectileTexture.Y * projectile.scale + projectile.gfxOffY), + new Vector2(Projectile.oldPos[oldPositionDrawIndex].X - Main.screenPosition.X + Projectile.width / 2 - projectileTexture.Width * Projectile.scale / 2f + modifiedProjectileTexture.X * Projectile.scale, Projectile.oldPos[oldPositionDrawIndex].Y - Main.screenPosition.Y + Projectile.height - projectileTexture.Height * Projectile.scale / Main.projFrames[Projectile.type] + 4f + modifiedProjectileTexture.Y * Projectile.scale + Projectile.gfxOffY), new Rectangle?(flameFrameRectangle), drawColor, - projectile.oldRot[oldPositionDrawIndex] + projectile.oldSpriteDirection[oldPositionDrawIndex] * MathHelper.PiOver2, + Projectile.oldRot[oldPositionDrawIndex] + Projectile.oldSpriteDirection[oldPositionDrawIndex] * MathHelper.PiOver2, flameOrigin, MathHelper.Lerp(0.1f, 1.2f, (10f - oldPositionDrawIndex) / 10f), spriteEffects, diff --git a/Projectiles/Summon/DormantBrimseekerSummoner.cs b/Projectiles/Summon/DormantBrimseekerSummoner.cs index ab0aacee88..5ccf1674ef 100644 --- a/Projectiles/Summon/DormantBrimseekerSummoner.cs +++ b/Projectiles/Summon/DormantBrimseekerSummoner.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class DormantBrimseekerSummoner : ModProjectile @@ -12,48 +13,48 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Dormant Brimseeker"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 30; - projectile.height = 30; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.tileCollide = true; + Projectile.friendly = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; } public override void AI() { - projectile.rotation = projectile.rotation.AngleLerp(-MathHelper.PiOver4, 0.045f); - projectile.velocity *= 0.975f; - if (projectile.ai[0]++ == 110f) + Projectile.rotation = Projectile.rotation.AngleLerp(-MathHelper.PiOver4, 0.045f); + Projectile.velocity *= 0.975f; + if (Projectile.ai[0]++ == 110f) { - Main.PlaySound(SoundID.Item100, projectile.Center); + SoundEngine.PlaySound(SoundID.Item100, Projectile.Center); } - if (projectile.ai[0]++ >= 90f) + if (Projectile.ai[0]++ >= 90f) { - for (int i = 0; i < (180 - (int)projectile.ai[0]) / 2; i++) + for (int i = 0; i < (180 - (int)Projectile.ai[0]) / 2; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.Brimstone); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.Brimstone); dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1f, 4f); dust.noGravity = true; } - projectile.alpha = (int)(255 * (projectile.ai[0] - 90f) / 90f); + Projectile.alpha = (int)(255 * (Projectile.ai[0] - 90f) / 90f); } - if (projectile.ai[0] >= 180f) + if (Projectile.ai[0] >= 180f) { - projectile.Kill(); + Projectile.Kill(); } } public override void Kill(int timeLeft) { - Projectile.NewProjectile(projectile.Center, Vector2.UnitY * 7f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.UnitY * 7f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Summon/Dreadmine.cs b/Projectiles/Summon/Dreadmine.cs index 8fd9fbe546..1d4ed007c1 100644 --- a/Projectiles/Summon/Dreadmine.cs +++ b/Projectiles/Summon/Dreadmine.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class Dreadmine : ModProjectile @@ -10,79 +11,79 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Mine"); - ProjectileID.Sets.SentryShot[projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 58; - projectile.height = 58; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 3600; + Projectile.width = 58; + Projectile.height = 58; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 3600; } public override void AI() { float num945 = 1f; float num946 = 1f; - if (projectile.identity % 6 == 0) + if (Projectile.identity % 6 == 0) { num946 *= -1f; } - if (projectile.identity % 6 == 1) + if (Projectile.identity % 6 == 1) { num945 *= -1f; } - if (projectile.identity % 6 == 2) + if (Projectile.identity % 6 == 2) { num946 *= -1f; num945 *= -1f; } - if (projectile.identity % 6 == 3) + if (Projectile.identity % 6 == 3) { num946 = 0f; } - if (projectile.identity % 6 == 4) + if (Projectile.identity % 6 == 4) { num945 = 0f; } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 60f) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 60f) { - projectile.localAI[1] = -180f; + Projectile.localAI[1] = -180f; } - if (projectile.localAI[1] >= -60f) + if (Projectile.localAI[1] >= -60f) { - projectile.velocity.X = projectile.velocity.X + 0.002f * num946; - projectile.velocity.Y = projectile.velocity.Y + 0.002f * num945; + Projectile.velocity.X = Projectile.velocity.X + 0.002f * num946; + Projectile.velocity.Y = Projectile.velocity.Y + 0.002f * num945; } else { - projectile.velocity.X = projectile.velocity.X - 0.002f * num946; - projectile.velocity.Y = projectile.velocity.Y - 0.002f * num945; + Projectile.velocity.X = Projectile.velocity.X - 0.002f * num946; + Projectile.velocity.Y = Projectile.velocity.Y - 0.002f * num945; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5400f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5400f) { - projectile.ai[1] = 1f; - if (projectile.ai[0] < 5500f) + Projectile.ai[1] = 1f; + if (Projectile.ai[0] < 5500f) { return; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - projectile.Kill(); + Projectile.Kill(); } } else { - float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; + float num947 = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; if (num947 > 4f) { num947 *= 1.1f; @@ -111,27 +112,27 @@ namespace CalamityMod.Projectiles.Summon { num947 *= 1.7f; } - projectile.ai[0] += num947; - if (projectile.alpha > 0) + Projectile.ai[0] += num947; + if (Projectile.alpha > 0) { - projectile.alpha -= 25; - if (projectile.alpha < 0) + Projectile.alpha -= 25; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } } bool flag49 = false; Vector2 center12 = new Vector2(0f, 0f); float num948 = 600f; - if (Main.player[projectile.owner].HasMinionAttackTargetNPC) + if (Main.player[Projectile.owner].HasMinionAttackTargetNPC) { - NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[Main.player[Projectile.owner].MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(Projectile, false)) { float num950 = npc.position.X + (float)(npc.width / 2); float num951 = npc.position.Y + (float)(npc.height / 2); - float num952 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num950) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num951); + float num952 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num950) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num951); if (num952 < num948) { num948 = num952; @@ -144,11 +145,11 @@ namespace CalamityMod.Projectiles.Summon { for (int num949 = 0; num949 < Main.npc.Length; num949++) { - if (Main.npc[num949].CanBeChasedBy(projectile, false)) + if (Main.npc[num949].CanBeChasedBy(Projectile, false)) { float num950 = Main.npc[num949].position.X + (float)(Main.npc[num949].width / 2); float num951 = Main.npc[num949].position.Y + (float)(Main.npc[num949].height / 2); - float num952 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num950) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num951); + float num952 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num950) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num951); if (num952 < num948) { num948 = num952; @@ -160,33 +161,33 @@ namespace CalamityMod.Projectiles.Summon } if (flag49) { - Vector2 vector101 = center12 - projectile.Center; + Vector2 vector101 = center12 - Projectile.Center; vector101.Normalize(); vector101 *= 0.75f; - projectile.velocity = (projectile.velocity * 10f + vector101) / 10.8f; //11 + Projectile.velocity = (Projectile.velocity * 10f + vector101) / 10.8f; //11 return; } - if ((double)projectile.velocity.Length() > 0.2) + if ((double)Projectile.velocity.Length() > 0.2) { - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 112; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 112; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, (int)Projectile.position.X, (int)Projectile.position.Y); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -196,13 +197,13 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } } } diff --git a/Projectiles/Summon/DreadmineTurret.cs b/Projectiles/Summon/DreadmineTurret.cs index d8f41a1015..7aef30cbd0 100644 --- a/Projectiles/Summon/DreadmineTurret.cs +++ b/Projectiles/Summon/DreadmineTurret.cs @@ -12,53 +12,53 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Dreadmine Turret"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; + Projectile.width = 26; + Projectile.height = 26; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.sentry = true; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.penetrate = -1; } public override void AI() { - Player player = Main.player[projectile.owner]; - if (projectile.localAI[0] == 0f) + Player player = Main.player[Projectile.owner]; + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(6.28318548f * projectile.ai[0] / 300f)) * 0.5f); - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 300f) + Projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(6.28318548f * Projectile.ai[0] / 300f)) * 0.5f); + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 300f) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (Main.rand.NextBool(15)) { @@ -78,20 +78,20 @@ namespace CalamityMod.Projectiles.Summon for (int j = 0; j < num2; j++) { int num5 = Main.rand.Next(200 - j * 2, 400 + j * 2); - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; center.X += (float)Main.rand.Next(-num5, num5 + 1); center.Y += (float)Main.rand.Next(-num5, num5 + 1); if (!Collision.SolidCollision(center, num3, num3)) { center.X += (float)(num3 / 2); center.Y += (float)(num3 / 2); - if (Collision.CanHit(new Vector2(projectile.Center.X, projectile.position.Y), 1, 1, center, 1, 1) || - Collision.CanHit(new Vector2(projectile.Center.X, projectile.position.Y - 50f), 1, 1, center, 1, 1)) + if (Collision.CanHit(new Vector2(Projectile.Center.X, Projectile.position.Y), 1, 1, center, 1, 1) || + Collision.CanHit(new Vector2(Projectile.Center.X, Projectile.position.Y - 50f), 1, 1, center, 1, 1)) { int num6 = (int)center.X / 16; int num7 = (int)center.Y / 16; bool flag = false; - if (Main.rand.NextBool(3) && Main.tile[num6, num7] != null && Main.tile[num6, num7].wall > 0) + if (Main.rand.NextBool(3) && Main.tile[num6, num7] != null && Main.tile[num6, num7].WallType > 0) { flag = true; } @@ -117,9 +117,9 @@ namespace CalamityMod.Projectiles.Summon break; } } - if (flag && Main.myPlayer == projectile.owner) + if (flag && Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(center.X, center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(center.X, center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Summon/EXPLODINGFROG.cs b/Projectiles/Summon/EXPLODINGFROG.cs index 1e4bf05127..16ac6ceda0 100644 --- a/Projectiles/Summon/EXPLODINGFROG.cs +++ b/Projectiles/Summon/EXPLODINGFROG.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class EXPLODINGFROG : ModProjectile @@ -12,91 +13,91 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("A not frog of the explosive variety"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 44; - projectile.height = 26; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; + Projectile.width = 44; + Projectile.height = 26; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.sentry = true; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.penetrate = -1; } public override void AI() { - if (projectile.frameCounter++ > 5) + if (Projectile.frameCounter++ > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - Player player = Main.player[projectile.owner]; - if (projectile.localAI[0] == 0f) + Player player = Main.player[Projectile.owner]; + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - bool canExplode = projectile.Center.ClosestNPCAt(MinExplodeDistance) != null; + bool canExplode = Projectile.Center.ClosestNPCAt(MinExplodeDistance) != null; if (player.HasMinionAttackTargetNPC) { - canExplode = Main.npc[player.MinionAttackTargetNPC].Distance(projectile.Center) < MinExplodeDistance; + canExplode = Main.npc[player.MinionAttackTargetNPC].Distance(Projectile.Center) < MinExplodeDistance; } if (canExplode) - projectile.ai[0]++; - if (projectile.ai[0] >= ExplodeWaitTime) + Projectile.ai[0]++; + if (Projectile.ai[0] >= ExplodeWaitTime) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { // Goop projectiles for (int i = 0; i < 3; i++) { - Projectile.NewProjectile(projectile.Center, + Projectile.NewProjectile(Projectile.Center, new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), - ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Projectile.NewProjectile(projectile.Center, + ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.Center, new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), - ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } // Normally I would do something like mod.ProjectileType($"FrogGore1 + i") in a loop, but I suppose I'll let it go. - Projectile.NewProjectile(projectile.Center, + Projectile.NewProjectile(Projectile.Center, new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), - ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Projectile.NewProjectile(projectile.Center, + ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.Center, new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), - ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Projectile.NewProjectile(projectile.Center, + ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.Center, new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), - ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } // WoF vomit sound. - Main.PlaySound(SoundID.NPCKilled, projectile.Center, 13); - projectile.Kill(); + SoundEngine.PlaySound(SoundID.NPCKilled, Projectile.Center, 13); + Projectile.Kill(); } - projectile.velocity.Y += 0.5f; + Projectile.velocity.Y += 0.5f; - if (projectile.velocity.Y > 10f) + if (Projectile.velocity.Y > 10f) { - projectile.velocity.Y = 10f; + Projectile.velocity.Y = 10f; } - projectile.StickToTiles(false, false); + Projectile.StickToTiles(false, false); } public override bool CanDamage() => false; diff --git a/Projectiles/Summon/ElementalAxeMinion.cs b/Projectiles/Summon/ElementalAxeMinion.cs index acb92d9971..3c7bc16198 100644 --- a/Projectiles/Summon/ElementalAxeMinion.cs +++ b/Projectiles/Summon/ElementalAxeMinion.cs @@ -14,46 +14,46 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Axe"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 52; - projectile.height = 52; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.width = 52; + Projectile.height = 52; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -63,23 +63,23 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.eAxe) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.rotation += 0.075f; + Projectile.rotation += 0.075f; - projectile.ChargingMinionAI(1600f, 1800f, 2500f, 400f, 1, 30f, 24f, 12f, new Vector2(0f, -60f), 30f, 16f, true, true); + Projectile.ChargingMinionAI(1600f, 1800f, 2500f, 400f, 1, 30f, 24f, 12f, new Vector2(0f, -60f), 30f, 16f, true, true); } public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Summon/EndoBeam.cs b/Projectiles/Summon/EndoBeam.cs index 6f234bf436..2e9a3c022d 100644 --- a/Projectiles/Summon/EndoBeam.cs +++ b/Projectiles/Summon/EndoBeam.cs @@ -25,21 +25,21 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Ray"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = timeToExist; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.coldDamage = true; + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = timeToExist; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.coldDamage = true; } // Netcode for sending and receiving shit @@ -47,14 +47,14 @@ namespace CalamityMod.Projectiles.Summon public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() @@ -64,58 +64,58 @@ namespace CalamityMod.Projectiles.Summon //int damage = 1000; //float angularChange = MathHelper.Pi / 180f; //Projectile.NewProjectile(projectile.Center, directionVector, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, angularChange, (float)projectile.whoAmI); - Projectile body = Main.projectile[(int)projectile.ai[1]]; + Projectile body = Main.projectile[(int)Projectile.ai[1]]; if (body.type != ModContent.ProjectileType() || !body.active) - projectile.Kill(); + Projectile.Kill(); - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) { - projectile.velocity = -Vector2.UnitY; + Projectile.velocity = -Vector2.UnitY; } - if (Main.projectile[(int)projectile.ai[1]].active) + if (Main.projectile[(int)Projectile.ai[1]].active) { - projectile.Center = Main.projectile[(int)projectile.ai[1]].Center; + Projectile.Center = Main.projectile[(int)Projectile.ai[1]].Center; } - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) { - projectile.velocity = -Vector2.UnitY; + Projectile.velocity = -Vector2.UnitY; } // How fat the laser is float laserSize = 1f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= timeToExist) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= timeToExist) { - projectile.Kill(); + Projectile.Kill(); return; } // Causes the effect where the laser appears to expand/contract at the beginning and end of its life - projectile.scale = (float)Math.Sin((double)(projectile.localAI[0] * MathHelper.Pi / timeToExist)) * 10f * laserSize; - if (projectile.scale > laserSize) + Projectile.scale = (float)Math.Sin((double)(Projectile.localAI[0] * MathHelper.Pi / timeToExist)) * 10f * laserSize; + if (Projectile.scale > laserSize) { - projectile.scale = laserSize; + Projectile.scale = laserSize; } // The heart of the "sweeping rotation" part of the laser // Basically converts the velocity to a rotation, increments some value to that rotation, // and then converts the rotation to a velocity - float velocityAsRotation = projectile.velocity.ToRotation(); - velocityAsRotation += projectile.ai[0]; - projectile.rotation = velocityAsRotation - MathHelper.PiOver2; - projectile.velocity = velocityAsRotation.ToRotationVector2(); + float velocityAsRotation = Projectile.velocity.ToRotation(); + velocityAsRotation += Projectile.ai[0]; + Projectile.rotation = velocityAsRotation - MathHelper.PiOver2; + Projectile.velocity = velocityAsRotation.ToRotationVector2(); - Vector2 samplingPoint = projectile.Center; + Vector2 samplingPoint = Projectile.Center; float[] samples = new float[3]; float determinedLength = 0f; if (LaserTileCollision) { - Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, maximumLength, samples); + Collision.LaserScan(samplingPoint, Projectile.velocity, Projectile.width * Projectile.scale, maximumLength, samples); for (int i = 0; i < samples.Length; i++) { determinedLength += samples[i]; @@ -128,46 +128,46 @@ namespace CalamityMod.Projectiles.Summon } float lerpDelta = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], determinedLength, lerpDelta); + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], determinedLength, lerpDelta); DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], (float)Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) { return false; } - Texture2D laserTailTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/LaserBegin"); - Texture2D laserBodyTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/LaserMid"); - Texture2D laserHeadTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/LaserEnd"); - float laserLength = projectile.localAI[1]; + Texture2D laserTailTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/LaserBegin"); + Texture2D laserBodyTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/LaserMid"); + Texture2D laserHeadTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/LaserEnd"); + float laserLength = Projectile.localAI[1]; Color drawColor = new Color(1f, 1f, 1f) * 0.9f; // Laser tail logic - Main.spriteBatch.Draw(laserTailTexture, projectile.Center - Main.screenPosition, null, drawColor, projectile.rotation, laserTailTexture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(laserTailTexture, Projectile.Center - Main.screenPosition, null, drawColor, Projectile.rotation, laserTailTexture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); // Laser body logic - laserLength -= (float)(laserTailTexture.Height / 2 + laserHeadTexture.Height) * projectile.scale; - Vector2 centerDelta = projectile.Center; - centerDelta += projectile.velocity * projectile.scale * (float)laserTailTexture.Height / 2f; + laserLength -= (float)(laserTailTexture.Height / 2 + laserHeadTexture.Height) * Projectile.scale; + Vector2 centerDelta = Projectile.Center; + centerDelta += Projectile.velocity * Projectile.scale * (float)laserTailTexture.Height / 2f; if (laserLength > 0f) { float laserLengthDelta = 0f; - Rectangle sourceRectangle = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 16); + Rectangle sourceRectangle = new Rectangle(0, 16 * (Projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 16); while (laserLengthDelta + 1f < laserLength) { if (laserLength - laserLengthDelta < (float)sourceRectangle.Height) { sourceRectangle.Height = (int)(laserLength - laserLengthDelta); } - Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, projectile.rotation, new Vector2((float)(sourceRectangle.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - laserLengthDelta += (float)sourceRectangle.Height * projectile.scale; - centerDelta += projectile.velocity * (float)sourceRectangle.Height * projectile.scale; + Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, Projectile.rotation, new Vector2((float)(sourceRectangle.Width / 2), 0f), Projectile.scale, SpriteEffects.None, 0f); + laserLengthDelta += (float)sourceRectangle.Height * Projectile.scale; + centerDelta += Projectile.velocity * (float)sourceRectangle.Height * Projectile.scale; sourceRectangle.Y += 16; if (sourceRectangle.Y + sourceRectangle.Height > laserBodyTexture.Height) { @@ -178,15 +178,15 @@ namespace CalamityMod.Projectiles.Summon // Laser head logic - Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, projectile.rotation, laserHeadTexture.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, Projectile.rotation, laserHeadTexture.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Projectile.localAI[1], (float)Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -196,7 +196,7 @@ namespace CalamityMod.Projectiles.Summon return true; } float value = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref value)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref value)) { return true; } diff --git a/Projectiles/Summon/EndoCooperBody.cs b/Projectiles/Summon/EndoCooperBody.cs index dfa8ab78e2..c508b5ccd2 100644 --- a/Projectiles/Summon/EndoCooperBody.cs +++ b/Projectiles/Summon/EndoCooperBody.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -17,29 +18,29 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Ascened Cooper"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.minion = true; - projectile.minionSlots = 10f; - projectile.netImportant = true; - projectile.width = 90; - projectile.height = 90; - projectile.timeLeft = 18000; - projectile.timeLeft *= 5; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.extraUpdates = 1; - projectile.coldDamage = true; + Projectile.minion = true; + Projectile.minionSlots = 10f; + Projectile.netImportant = true; + Projectile.width = 90; + Projectile.height = 90; + Projectile.timeLeft = 18000; + Projectile.timeLeft *= 5; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.extraUpdates = 1; + Projectile.coldDamage = true; } public override void AI() @@ -52,13 +53,13 @@ namespace CalamityMod.Projectiles.Summon { dusttype = 80; } - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dusttype , projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 50, default, 0.6f); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dusttype , Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 50, default, 0.6f); Main.dust[dust].noGravity = true; } //Apply the buff - bool flag64 = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool flag64 = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) @@ -69,20 +70,20 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.endoCooper) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } //Spawn effects - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - AttackMode = (int)projectile.ai[0]; - LimbID = (int)projectile.ai[1]; - projectile.ai[0] = 0f; - projectile.ai[1] = 0f; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + AttackMode = (int)Projectile.ai[0]; + LimbID = (int)Projectile.ai[1]; + Projectile.ai[0] = 0f; + Projectile.ai[1] = 0f; + Projectile.localAI[0] += 1f; for (int i = 0; i < 60; i++) { int dusttype = Main.rand.NextBool(2) ? 68 : 67; @@ -91,18 +92,18 @@ namespace CalamityMod.Projectiles.Summon dusttype = 80; } Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(projectile.Center, 1, 1, dusttype, dspeed.X, dspeed.Y, 50, default, 0.8f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dusttype, dspeed.X, dspeed.Y, 50, default, 0.8f); Main.dust[dust].noGravity = true; } } - projectile.localAI[1] = AttackMode; + Projectile.localAI[1] = AttackMode; //Damage Update - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + Projectile.damage = damage2; } //Variables float mindistance = 2000f; @@ -137,21 +138,21 @@ namespace CalamityMod.Projectiles.Summon } if (limbs.type != ModContent.ProjectileType() || !limbs.active) - projectile.Kill(); + Projectile.Kill(); - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); bool flag24 = false; - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - projectile.ai[1] += 1f; - projectile.extraUpdates = 2; - if (projectile.ai[1] > 30f) + Projectile.ai[1] += 1f; + Projectile.extraUpdates = 2; + if (Projectile.ai[1] > 30f) { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 1; - projectile.numUpdates = 0; - projectile.netUpdate = true; + Projectile.ai[1] = 1f; + Projectile.ai[0] = 0f; + Projectile.extraUpdates = 1; + Projectile.numUpdates = 0; + Projectile.netUpdate = true; } else { @@ -162,14 +163,14 @@ namespace CalamityMod.Projectiles.Summon { return; } - Vector2 objectivepos = projectile.position; + Vector2 objectivepos = Projectile.position; bool gotoenemy = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float disttoobjective = Vector2.Distance(npc.Center, projectile.Center); + float disttoobjective = Vector2.Distance(npc.Center, Projectile.Center); if (!gotoenemy && disttoobjective < mindistance) { mindistance = disttoobjective; @@ -183,9 +184,9 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + if (nPC2.CanBeChasedBy(Projectile, false)) { - float disttoobjective = Vector2.Distance(nPC2.Center, projectile.Center); + float disttoobjective = Vector2.Distance(nPC2.Center, Projectile.Center); if (!gotoenemy && disttoobjective < mindistance) { mindistance = disttoobjective; @@ -200,14 +201,14 @@ namespace CalamityMod.Projectiles.Summon { maxdisttoenemy = longestdistance; } - if (Vector2.Distance(player.Center, projectile.Center) > maxdisttoenemy) + if (Vector2.Distance(player.Center, Projectile.Center) > maxdisttoenemy) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } - if (gotoenemy && projectile.ai[0] == 0f) + if (gotoenemy && Projectile.ai[0] == 0f) { - Vector2 speedtoenemy = objectivepos - projectile.Center; + Vector2 speedtoenemy = objectivepos - Projectile.Center; float disttospeed = speedtoenemy.Length(); speedtoenemy.Normalize(); float stopdistance = AttackMode == 3 ? 120f : 200f; @@ -215,13 +216,13 @@ namespace CalamityMod.Projectiles.Summon { float scaleFactor2 = chasespeed1; //8 speedtoenemy *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + speedtoenemy) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + speedtoenemy) / 41f; } else { float scalefactor3 = chasespeed2; //4 speedtoenemy *= -scalefactor3; - projectile.velocity = (projectile.velocity * 40f + speedtoenemy) / 41f; //41 + Projectile.velocity = (Projectile.velocity * 40f + speedtoenemy) / 41f; //41 } } else @@ -229,72 +230,72 @@ namespace CalamityMod.Projectiles.Summon bool gotoplayer = false; if (!gotoplayer) { - gotoplayer = projectile.ai[0] == 1f; + gotoplayer = Projectile.ai[0] == 1f; } float speedtoplayer = 8f; if (gotoplayer) { speedtoplayer = 16f; } - Vector2 center2 = projectile.Center; + Vector2 center2 = Projectile.Center; Vector2 playerpos = player.Center - center2 + new Vector2(0f, -60f); float lenghttoplayer = playerpos.Length(); if (lenghttoplayer > 200f && speedtoplayer < 8f) { speedtoplayer = 10f; } - if (lenghttoplayer < idledistance && gotoplayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (lenghttoplayer < idledistance && gotoplayer && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (lenghttoplayer > 2700f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (lenghttoplayer > 70f) { playerpos.Normalize(); playerpos *= speedtoplayer; - projectile.velocity = (projectile.velocity * 40f + playerpos) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + playerpos) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 4); + Projectile.ai[1] += (float)Main.rand.Next(1, 4); } - if (projectile.ai[1] > firerate) + if (Projectile.ai[1] > firerate) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - if (projectile.ai[1] == 0f && gotoenemy && mindistance < 600f) + if (Projectile.ai[1] == 0f && gotoenemy && mindistance < 600f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner) { switch (AttackMode) { case 0: - Main.PlaySound(SoundID.Item15, (int)projectile.position.X, (int)projectile.position.Y); - Vector2 aimlaser = objectivepos - projectile.Center; + SoundEngine.PlaySound(SoundID.Item15, (int)Projectile.position.X, (int)Projectile.position.Y); + Vector2 aimlaser = objectivepos - Projectile.Center; aimlaser.Normalize(); aimlaser = aimlaser.RotatedBy(MathHelper.ToRadians(30 * -laserdirection)); float angularChange = (MathHelper.Pi / 180f) * 1.1f * laserdirection; //aimlaser *= 12f; - Projectile.NewProjectile(projectile.Center, aimlaser, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, angularChange, (float)projectile.whoAmI); + Projectile.NewProjectile(Projectile.Center, aimlaser, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, angularChange, (float)Projectile.whoAmI); laserdirection *= -1; break; @@ -308,45 +309,45 @@ namespace CalamityMod.Projectiles.Summon { limbs.ai[0] = 3f; } - projectile.netUpdate = true; + Projectile.netUpdate = true; break; - case 2: projectile.ai[0] = 2f; - Vector2 aimtoenemy = objectivepos - projectile.Center; + case 2: Projectile.ai[0] = 2f; + Vector2 aimtoenemy = objectivepos - Projectile.Center; aimtoenemy.Normalize(); - projectile.velocity = aimtoenemy * 18f; - projectile.netUpdate = true; + Projectile.velocity = aimtoenemy * 18f; + Projectile.netUpdate = true; break; case 3: limbs.ai[0] = 4f; - projectile.netUpdate = true; + Projectile.netUpdate = true; break; default:break; } } } } - if (limbs.ai[0] == 2f && projectile.ai[1] == 0f) + if (limbs.ai[0] == 2f && Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; limbs.ai[0] = 3f; - projectile.netUpdate = true; + Projectile.netUpdate = true; } //Tilting and change directions - projectile.spriteDirection = projectile.direction; - projectile.rotation = projectile.velocity.X * 0.07f; + Projectile.spriteDirection = Projectile.direction; + Projectile.rotation = Projectile.velocity.X * 0.07f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Rectangle frame = new Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Summon/EndoCooperBody_Glow"), projectile.Center - Main.screenPosition, frame, Color.LightSkyBlue, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + Rectangle frame = new Rectangle(0, 0, Main.projectileTexture[Projectile.type].Width, Main.projectileTexture[Projectile.type].Height); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Summon/EndoCooperBody_Glow"), Projectile.Center - Main.screenPosition, frame, Color.LightSkyBlue, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/EndoCooperLimbs.cs b/Projectiles/Summon/EndoCooperLimbs.cs index b3754669ae..b94dbe65b7 100644 --- a/Projectiles/Summon/EndoCooperLimbs.cs +++ b/Projectiles/Summon/EndoCooperLimbs.cs @@ -7,6 +7,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -16,37 +17,37 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Ascened Cooper"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.netImportant = true; - projectile.width = 90; - projectile.height = 90; - projectile.timeLeft = 18000; - projectile.timeLeft *= 5; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.extraUpdates = 1; - projectile.coldDamage = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.netImportant = true; + Projectile.width = 90; + Projectile.height = 90; + Projectile.timeLeft = 18000; + Projectile.timeLeft *= 5; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.extraUpdates = 1; + Projectile.coldDamage = true; } public override void AI() { - Projectile body = Main.projectile[(int)projectile.ai[1]]; + Projectile body = Main.projectile[(int)Projectile.ai[1]]; //Apply the buff - bool flag64 = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool flag64 = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); @@ -58,18 +59,18 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.endoCooper) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } //Spawn effects - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; - AttackMode = (int)projectile.ai[0]; - projectile.ai[0] = 0f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; + AttackMode = (int)Projectile.ai[0]; + Projectile.ai[0] = 0f; SpawnDust(); } @@ -78,49 +79,49 @@ namespace CalamityMod.Projectiles.Summon //Rotation if (AttackMode == 3) { - projectile.rotation += 0.015f; + Projectile.rotation += 0.015f; } else { float rotateratio = 0.007f; float rotation = (Math.Abs(body.velocity.X) + Math.Abs(body.velocity.Y)) * rotateratio; - projectile.rotation += rotation * body.direction; + Projectile.rotation += rotation * body.direction; } //Damage Update - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + Projectile.damage = damage2; } //Keep the limbs in place if (body.type != ModContent.ProjectileType() || !body.active) - projectile.Kill(); - projectile.Center = body.Center; + Projectile.Kill(); + Projectile.Center = body.Center; //"Destroy" limbs - if (projectile.ai[0] == 1f && AttackMode == 1) + if (Projectile.ai[0] == 1f && AttackMode == 1) { - projectile.alpha = 255; + Projectile.alpha = 255; SpawnShards(); - projectile.ai[0] = 2f; - projectile.netUpdate = true; + Projectile.ai[0] = 2f; + Projectile.netUpdate = true; } //Respawn limbs - if (projectile.ai[0] == 3f) + if (Projectile.ai[0] == 3f) { SpawnDust(); - projectile.alpha = 255; - projectile.ai[0] = 0f; + Projectile.alpha = 255; + Projectile.ai[0] = 0f; } //Flames - if (projectile.ai[0] == 4f) + if (Projectile.ai[0] == 4f) { SpawnFlames(); - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; } @@ -129,23 +130,23 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { SpawnDust(); - Main.PlaySound(SoundID.NPCHit5, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit5, Projectile.Center); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) return false; - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) return; - Rectangle frame = new Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Summon/EndoCooperLimbs_Glow"), projectile.Center - Main.screenPosition, frame, Color.LightSkyBlue, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + Rectangle frame = new Rectangle(0, 0, Main.projectileTexture[Projectile.type].Width, Main.projectileTexture[Projectile.type].Height); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Summon/EndoCooperLimbs_Glow"), Projectile.Center - Main.screenPosition, frame, Color.LightSkyBlue, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -163,18 +164,18 @@ namespace CalamityMod.Projectiles.Summon private void SpawnShards() { SpawnDust(); - Main.PlaySound(SoundID.NPCHit5, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCHit5, Projectile.Center); if (AttackMode == 1) { for (int i = 0; i < 360; i += 60) { float dmgmult = 0.8f; - Vector2 pspeed1 = new Vector2(Main.rand.NextFloat(3f, 8f), Main.rand.NextFloat(3f, 8f)).RotatedBy(MathHelper.ToRadians(i + 20 + MathHelper.ToDegrees(projectile.rotation))); - Projectile.NewProjectile(projectile.Center, pspeed1, ModContent.ProjectileType(), (int)(projectile.damage * dmgmult), 1f, projectile.owner, 0f, 0f); + Vector2 pspeed1 = new Vector2(Main.rand.NextFloat(3f, 8f), Main.rand.NextFloat(3f, 8f)).RotatedBy(MathHelper.ToRadians(i + 20 + MathHelper.ToDegrees(Projectile.rotation))); + Projectile.NewProjectile(Projectile.Center, pspeed1, ModContent.ProjectileType(), (int)(Projectile.damage * dmgmult), 1f, Projectile.owner, 0f, 0f); Vector2 pspeed2 = pspeed1.RotatedBy(MathHelper.ToRadians(Main.rand.Next(5, 13))) * Main.rand.NextFloat(0.6f, 1.3f); - Projectile.NewProjectile(projectile.Center, pspeed2, ModContent.ProjectileType(), (int)(projectile.damage * dmgmult), 1f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, pspeed2, ModContent.ProjectileType(), (int)(Projectile.damage * dmgmult), 1f, Projectile.owner, 0f, 0f); Vector2 pspeed3 = pspeed1.RotatedBy(MathHelper.ToRadians(Main.rand.Next(-12, -1))) * Main.rand.NextFloat(0.6f, 1.3f); - Projectile.NewProjectile(projectile.Center, pspeed3, ModContent.ProjectileType(), (int)(projectile.damage * dmgmult), 1f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, pspeed3, ModContent.ProjectileType(), (int)(Projectile.damage * dmgmult), 1f, Projectile.owner, 0f, 0f); } } } @@ -189,20 +190,20 @@ namespace CalamityMod.Projectiles.Summon dusttype = 80; } Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(projectile.Center, 1, 1, dusttype, dspeed.X, dspeed.Y, 50, default, 1.1f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dusttype, dspeed.X, dspeed.Y, 50, default, 1.1f); Main.dust[dust].noGravity = true; } } private void SpawnFlames() { - Main.PlaySound(SoundID.Item34, projectile.Center); + SoundEngine.PlaySound(SoundID.Item34, Projectile.Center); for (int i = 0; i < 360; i += 60) { float dmgmult = 0.9f; - Vector2 pspeed1 = new Vector2(0.9f, 0.9f).RotatedBy(MathHelper.ToRadians(i + 20 + MathHelper.ToDegrees(projectile.rotation))); - int flame = Projectile.NewProjectile(projectile.Center, pspeed1, ModContent.ProjectileType(), (int)(projectile.damage * dmgmult), 1f, projectile.owner, 0f, 0f); + Vector2 pspeed1 = new Vector2(0.9f, 0.9f).RotatedBy(MathHelper.ToRadians(i + 20 + MathHelper.ToDegrees(Projectile.rotation))); + int flame = Projectile.NewProjectile(Projectile.Center, pspeed1, ModContent.ProjectileType(), (int)(Projectile.damage * dmgmult), 1f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Summon/EndoFire.cs b/Projectiles/Summon/EndoFire.cs index 272aa4e452..79112cb0d6 100644 --- a/Projectiles/Summon/EndoFire.cs +++ b/Projectiles/Summon/EndoFire.cs @@ -16,24 +16,24 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Endo Fire"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = -1; - projectile.extraUpdates = 10; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 5; - projectile.timeLeft = 300; - projectile.tileCollide = false; - projectile.coldDamage = true; + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = -1; + Projectile.extraUpdates = 10; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.coldDamage = true; } public override void AI() @@ -50,24 +50,24 @@ namespace CalamityMod.Projectiles.Summon speedY = Main.rand.NextBool(2) ? 1.03f : 0.97f; speedYChoice = true; } - projectile.velocity.X *= speedX; - projectile.velocity.X *= speedY; - if (projectile.ai[0] > 20f) + Projectile.velocity.X *= speedX; + Projectile.velocity.X *= speedY; + if (Projectile.ai[0] > 20f) { float num296 = 1f; - if (projectile.ai[0] == 21f) + if (Projectile.ai[0] == 21f) { num296 = 0.25f; } - else if (projectile.ai[0] == 22f) + else if (Projectile.ai[0] == 22f) { num296 = 0.5f; } - else if (projectile.ai[0] == 23f) + else if (Projectile.ai[0] == 23f) { num296 = 0.75f; } - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int num297 = Main.rand.NextBool(2) ? 68 : 67; if (Main.rand.NextBool(4)) { @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(2)) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 0.8f); + int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 0.8f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { @@ -92,14 +92,14 @@ namespace CalamityMod.Projectiles.Summon dust.velocity.X *= 0.8f; dust.velocity.Y *= 0.8f; dust.scale *= num296; - dust.velocity += projectile.velocity; + dust.velocity += Projectile.velocity; dust.noLight = true; } } else { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } } diff --git a/Projectiles/Summon/EndoHydraBody.cs b/Projectiles/Summon/EndoHydraBody.cs index 6b48673ee7..19233b6366 100644 --- a/Projectiles/Summon/EndoHydraBody.cs +++ b/Projectiles/Summon/EndoHydraBody.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -11,53 +12,53 @@ namespace CalamityMod.Projectiles.Summon { public int TargetNPCIndex { - get => (int)projectile.ai[0]; - set => projectile.ai[0] = value; + get => (int)Projectile.ai[0]; + set => Projectile.ai[0] = value; } public const float DistanceToCheck = 2800f; public override void SetStaticDefaults() { DisplayName.SetDefault("Hydra Body"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.NeedsUUID[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 52; - projectile.height = 86; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.coldDamage = true; + Projectile.width = 52; + Projectile.height = 86; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.coldDamage = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { TargetNPCIndex = -1; - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) { @@ -67,7 +68,7 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.endoHydra) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } @@ -75,26 +76,26 @@ namespace CalamityMod.Projectiles.Summon returnLocation.X -= (18 + player.width / 2) * player.direction; returnLocation.Y -= 25f; - NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); + NPC potentialTarget = Projectile.Center.MinionHoming(DistanceToCheck, player); if (potentialTarget != null) { if (TargetNPCIndex != potentialTarget.whoAmI) { TargetNPCIndex = potentialTarget.whoAmI; - Main.PlaySound(SoundID.Zombie, projectile.Center, 53); // Ethereal whisper indicating a new target has been spotted. - projectile.netUpdate = true; + SoundEngine.PlaySound(SoundID.Zombie, Projectile.Center, 53); // Ethereal whisper indicating a new target has been spotted. + Projectile.netUpdate = true; } } - if (projectile.frameCounter++ > (potentialTarget is null ? 8 : 6)) + if (Projectile.frameCounter++ > (potentialTarget is null ? 8 : 6)) { - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; - projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + Projectile.frameCounter = 0; } - projectile.Center = Vector2.Lerp(projectile.Center, returnLocation, 0.25f); - projectile.direction = projectile.spriteDirection = player.direction; - Lighting.AddLight(projectile.Center - Vector2.UnitY * 21f, 0.25f, 0.865f, 0.825f); + Projectile.Center = Vector2.Lerp(Projectile.Center, returnLocation, 0.25f); + Projectile.direction = Projectile.spriteDirection = player.direction; + Lighting.AddLight(Projectile.Center - Vector2.UnitY * 21f, 0.25f, 0.865f, 0.825f); } public override bool CanDamage() => false; diff --git a/Projectiles/Summon/EndoHydraHead.cs b/Projectiles/Summon/EndoHydraHead.cs index c8b4671ab4..02d3018eac 100644 --- a/Projectiles/Summon/EndoHydraHead.cs +++ b/Projectiles/Summon/EndoHydraHead.cs @@ -16,36 +16,36 @@ namespace CalamityMod.Projectiles.Summon public Vector2 DeltaPosition; public Vector2 DeltaPositionMoving; public Vector2[] OldVelocities = new Vector2[20]; - public int BodyUUIDIndex => Projectile.GetByUUID(projectile.owner, projectile.ai[0]); + public int BodyUUIDIndex => Projectile.GetByUUID(Projectile.owner, Projectile.ai[0]); public float Time { - get => projectile.ai[1]; - set => projectile.ai[1] = value; + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; } public override void SetStaticDefaults() { DisplayName.SetDefault("Hydra Head"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.coldDamage = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.coldDamage = true; } public override void ReceiveExtraAI(BinaryReader reader) { @@ -59,47 +59,47 @@ namespace CalamityMod.Projectiles.Summon } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (BodyUUIDIndex < 0 || BodyUUIDIndex >= Main.projectile.Length) { - projectile.Kill(); + Projectile.Kill(); return; } Projectile body = Main.projectile[BodyUUIDIndex]; if (!body.active) { - projectile.Kill(); + Projectile.Kill(); return; } - int totalHeads = CalamityUtils.CountProjectiles(projectile.type); - if (projectile.localAI[0] == 0f) + int totalHeads = CalamityUtils.CountProjectiles(Projectile.type); + if (Projectile.localAI[0] == 0f) { DeltaPosition = DeltaPositionMoving = new Vector2(Main.rand.NextFloat(-72f - 8f * totalHeads, 72f + 8f * totalHeads), -Main.rand.NextFloat(8f, 84f + 4f * totalHeads)); - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - projectile.netUpdate = true; + Projectile.netUpdate = true; if (!Main.dedServ) { for (int i = 0; i < 18; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, 113); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 113); dust.velocity = new Vector2(0f, -5f).RotatedBy(i / 18f * MathHelper.TwoPi); dust.noGravity = true; dust.scale = 1.2f; } } - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } Time++; @@ -115,56 +115,56 @@ namespace CalamityMod.Projectiles.Summon if (body.ai[0] >= 0 && body.ai[0] < Main.maxNPCs) { NPC target = Main.npc[(int)body.ai[0]]; - bool targetAliveAndInLineOfSight = target.active && projectile.Distance(target.Center) < EndoHydraBody.DistanceToCheck; - if (targetAliveAndInLineOfSight && target.CanBeChasedBy() && Main.myPlayer == projectile.owner) + bool targetAliveAndInLineOfSight = target.active && Projectile.Distance(target.Center) < EndoHydraBody.DistanceToCheck; + if (targetAliveAndInLineOfSight && target.CanBeChasedBy() && Main.myPlayer == Projectile.owner) { if (Time % 40f == 24f) - Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(target.Center) * 6f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 6f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); if (Time % 40f >= 33f) - projectile.frame = Main.projFrames[projectile.type] - 1; + Projectile.frame = Main.projFrames[Projectile.type] - 1; else if (Time % 40f >= 27f) - projectile.frame = Main.projFrames[projectile.type] - 2; + Projectile.frame = Main.projFrames[Projectile.type] - 2; else if (Time % 40f >= 22f) - projectile.frame = Main.projFrames[projectile.type] - 3; + Projectile.frame = Main.projFrames[Projectile.type] - 3; else if (Time % 40f >= 17f) - projectile.frame = Main.projFrames[projectile.type] - 4; + Projectile.frame = Main.projFrames[Projectile.type] - 4; - projectile.direction = projectile.spriteDirection = (player.Center.X - projectile.Center.X > 0).ToDirectionInt(); - if (Math.Abs(player.Center.X - projectile.Center.X) < 80f) - projectile.direction = projectile.spriteDirection = player.direction; - returnPosition.X -= 48f * (target.Center.X - projectile.Center.X > 0).ToDirectionInt(); + Projectile.direction = Projectile.spriteDirection = (player.Center.X - Projectile.Center.X > 0).ToDirectionInt(); + if (Math.Abs(player.Center.X - Projectile.Center.X) < 80f) + Projectile.direction = Projectile.spriteDirection = player.direction; + returnPosition.X -= 48f * (target.Center.X - Projectile.Center.X > 0).ToDirectionInt(); } else { - projectile.direction = projectile.spriteDirection = (player.Center.X - projectile.Center.X > 0).ToDirectionInt(); - if (Math.Abs(player.Center.X - projectile.Center.X) < 80f) - projectile.direction = projectile.spriteDirection = player.direction; - projectile.frame = 0; + Projectile.direction = Projectile.spriteDirection = (player.Center.X - Projectile.Center.X > 0).ToDirectionInt(); + if (Math.Abs(player.Center.X - Projectile.Center.X) < 80f) + Projectile.direction = Projectile.spriteDirection = player.direction; + Projectile.frame = 0; } } else { - projectile.direction = projectile.spriteDirection = player.direction; - projectile.frame = 0; + Projectile.direction = Projectile.spriteDirection = player.direction; + Projectile.frame = 0; } - float distanceFromTarget = projectile.Distance(returnPosition); + float distanceFromTarget = Projectile.Distance(returnPosition); if (distanceFromTarget > 7f) { float speed = MathHelper.Lerp(2f, 17f, Utils.InverseLerp(10f, 70f, distanceFromTarget, true)); - projectile.velocity = (projectile.velocity * 9f + projectile.SafeDirectionTo(returnPosition) * speed) / 10f; + Projectile.velocity = (Projectile.velocity * 9f + Projectile.SafeDirectionTo(returnPosition) * speed) / 10f; } - if (projectile.Center.Y > body.Center.Y - 50f) - projectile.Center = new Vector2(projectile.Center.X, body.Center.Y - 50f); + if (Projectile.Center.Y > body.Center.Y - 50f) + Projectile.Center = new Vector2(Projectile.Center.X, body.Center.Y - 50f); - if (projectile.Distance(returnPosition) > 120f) + if (Projectile.Distance(returnPosition) > 120f) { - projectile.Center = returnPosition + projectile.DirectionFrom(returnPosition) * 120f; + Projectile.Center = returnPosition + Projectile.DirectionFrom(returnPosition) * 120f; } - projectile.MinionAntiClump(0.15f); + Projectile.MinionAntiClump(0.15f); AdjustOldVelocityArray(); } @@ -174,14 +174,14 @@ namespace CalamityMod.Projectiles.Summon { OldVelocities[i] = OldVelocities[i - 1]; } - OldVelocities[0] = projectile.velocity; + OldVelocities[0] = Projectile.velocity; } public override void Kill(int timeLeft) { for (int i = 0; i < 10; i++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 67); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 67); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -192,9 +192,9 @@ namespace CalamityMod.Projectiles.Summon if (!body.active) return false; - Texture2D chain = ModContent.GetTexture("CalamityMod/Projectiles/Summon/EndoHydraChain"); + Texture2D chain = ModContent.Request("CalamityMod/Projectiles/Summon/EndoHydraChain"); Vector2 start = body.Center + new Vector2(body.spriteDirection == 1 ? 12 : -14, -30f); - Vector2 end = projectile.Center + (projectile.spriteDirection == 1).ToInt() * 10 * Vector2.UnitX; + Vector2 end = Projectile.Center + (Projectile.spriteDirection == 1).ToInt() * 10 * Vector2.UnitX; List controlPoints = new List { @@ -220,7 +220,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < chainPoints.Count; i++) { Vector2 positionAtPoint = chainPoints[i]; - if (Vector2.Distance(positionAtPoint, projectile.Center) < 10f) + if (Vector2.Distance(positionAtPoint, Projectile.Center) < 10f) continue; float angleAtPoint = i == chainPoints.Count - 1 ? (end - chainPoints[i]).ToRotation() : (chainPoints[i + 1] - chainPoints[i]).ToRotation(); angleAtPoint += MathHelper.PiOver2; @@ -237,15 +237,15 @@ namespace CalamityMod.Projectiles.Summon // PreDraw is used instead of PostDraw because of draw order. Drawing the chains after the head // would cause them to be drawn on top of the head, which we do not want. - Texture2D headTexture = ModContent.GetTexture(Texture); + Texture2D headTexture = ModContent.Request(Texture); spriteBatch.Draw(headTexture, - projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, - headTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame), + Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, + headTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame), lightColor, - projectile.rotation, - projectile.Size * 0.5f, - projectile.scale, - projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, + Projectile.rotation, + Projectile.Size * 0.5f, + Projectile.scale, + Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Summon/EndoIceShard.cs b/Projectiles/Summon/EndoIceShard.cs index c7c8d3599f..d0b07b6939 100644 --- a/Projectiles/Summon/EndoIceShard.cs +++ b/Projectiles/Summon/EndoIceShard.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -12,66 +13,66 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Endo Ice Shard"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 14; - projectile.height = 14; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.alpha = 255; - projectile.timeLeft = 240; - projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 240; + Projectile.coldDamage = true; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - Lighting.AddLight(projectile.Center, new Vector3(46, 203, 255) * (1.2f / 255)); - projectile.ai[0]++; - projectile.ai[1]++; - if (projectile.ai[0] >= 30f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, new Vector3(46, 203, 255) * (1.2f / 255)); + Projectile.ai[0]++; + Projectile.ai[1]++; + if (Projectile.ai[0] >= 30f) { - Vector2 dspeed = projectile.velocity * Main.rand.NextFloat(0.3f,0.6f); - int dust = Dust.NewDust(projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Vector2 dspeed = Projectile.velocity * Main.rand.NextFloat(0.3f,0.6f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); Main.dust[dust].noGravity = true; - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; } //Homing - if (projectile.ai[1] > 20f) + if (Projectile.ai[1] > 20f) HomingAI(); //Fade in - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 15; + Projectile.alpha -= 15; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } private void HomingAI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int targetIdx = -1; float maxHomingRange = 800f; bool hasHomingTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < maxHomingRange) { targetIdx = player.MinionAttackTargetNPC; @@ -88,9 +89,9 @@ namespace CalamityMod.Projectiles.Summon if (npc == null || !npc.active) continue; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < maxHomingRange) { targetIdx = i; @@ -105,26 +106,26 @@ namespace CalamityMod.Projectiles.Summon if (hasHomingTarget) { NPC target = Main.npc[targetIdx]; - Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * 32f; + Vector2 homingVector = (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * 32f; float homingRatio = 40f; - projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); + Projectile.velocity = (Projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); Main.dust[dust].noGravity = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/EndoRay.cs b/Projectiles/Summon/EndoRay.cs index ffe7483e57..a087a6f60e 100644 --- a/Projectiles/Summon/EndoRay.cs +++ b/Projectiles/Summon/EndoRay.cs @@ -11,33 +11,33 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Ray"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.minion = true; - projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = 265; - projectile.coldDamage = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 100; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.penetrate = 10; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 265; + Projectile.coldDamage = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 100; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 5f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 5f) { for (int i = 0; i < 3; i++) { - Vector2 spawnPosition = projectile.position; - spawnPosition -= projectile.velocity * i * 0.25f; + Vector2 spawnPosition = Projectile.position; + spawnPosition -= Projectile.velocity * i * 0.25f; int idx = Dust.NewDust(spawnPosition, 1, 1, 113, 0f, 0f, 0, default, 1.25f); Main.dust[idx].position = spawnPosition; Main.dust[idx].scale = Main.rand.NextFloat(0.71f, 0.93f); diff --git a/Projectiles/Summon/EnergyOrb.cs b/Projectiles/Summon/EnergyOrb.cs index 8975ba564f..e060911d04 100644 --- a/Projectiles/Summon/EnergyOrb.cs +++ b/Projectiles/Summon/EnergyOrb.cs @@ -15,29 +15,29 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.alpha = 100; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 200; - projectile.minion = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 200; + Projectile.minion = true; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - int num469 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 132, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 132, 0f, 0f, 100, default, 1f); if (Main.rand.Next(6) != 0) Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } - NPC potentialTarget = projectile.Center.MinionHoming(400f, Main.player[projectile.owner]); + NPC potentialTarget = Projectile.Center.MinionHoming(400f, Main.player[Projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 10f) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 10f) / 21f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/EyeOfNightCell.cs b/Projectiles/Summon/EyeOfNightCell.cs index 48cfb2dbec..3c0da6b4eb 100644 --- a/Projectiles/Summon/EyeOfNightCell.cs +++ b/Projectiles/Summon/EyeOfNightCell.cs @@ -10,39 +10,39 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Cell"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = projectile.height = 10; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 2; - projectile.timeLeft = 180; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 90; + Projectile.friendly = true; + Projectile.width = Projectile.height = 10; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 2; + Projectile.timeLeft = 180; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 90; } public override void AI() { - if (!Main.dedServ && projectile.velocity.Length() > 5f) - Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid).noGravity = true; + if (!Main.dedServ && Projectile.velocity.Length() > 5f) + Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid).noGravity = true; - projectile.StickyProjAI(3); + Projectile.StickyProjAI(3); } public override void Kill(int timeLeft) { if (!Main.dedServ) for (int i = 0; i < 10; i++) - Dust.NewDustDirect(projectile.position, 36, 36, (int)CalamityDusts.SulfurousSeaAcid).noGravity = true; + Dust.NewDustDirect(Projectile.position, 36, 36, (int)CalamityDusts.SulfurousSeaAcid).noGravity = true; } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) => projectile.ModifyHitNPCSticky(4, true); + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) => Projectile.ModifyHitNPCSticky(4, true); public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.CursedInferno, 120); diff --git a/Projectiles/Summon/EyeOfNightSummon.cs b/Projectiles/Summon/EyeOfNightSummon.cs index 4f794b68e5..6c04070af8 100644 --- a/Projectiles/Summon/EyeOfNightSummon.cs +++ b/Projectiles/Summon/EyeOfNightSummon.cs @@ -9,31 +9,31 @@ namespace CalamityMod.Projectiles.Summon { public class EyeOfNightSummon : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float HoverTime => ref projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + public ref float HoverTime => ref Projectile.ai[0]; public const int ShootRate = 60; public override void SetStaticDefaults() { DisplayName.SetDefault("Eye of Night"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 16; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 90000; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.tileCollide = false; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 19; + Projectile.width = Projectile.height = 16; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 19; } public override void AI() @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon ProvidePlayerMinionBuffs(); DynamicallyUpdateDamage(); GenerateVisuals(); - NPC potentialTarget = projectile.Center.MinionHoming(750f, Owner); + NPC potentialTarget = Projectile.Center.MinionHoming(750f, Owner); if (potentialTarget is null) FlyNearOwner(); else @@ -54,27 +54,27 @@ namespace CalamityMod.Projectiles.Summon // Verify player/minion state integrity. The minion cannot stay alive if the // owner is dead or if the caller of the AI is invalid. - if (projectile.type != ModContent.ProjectileType()) + if (Projectile.type != ModContent.ProjectileType()) return; if (Owner.dead) Owner.Calamity().eyeOfNight = false; if (Owner.Calamity().eyeOfNight) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } internal void DynamicallyUpdateDamage() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1f; } - if (Owner.MinionDamage() == projectile.Calamity().spawnedPlayerMinionDamageValue) + if (Owner.MinionDamage() == Projectile.Calamity().spawnedPlayerMinionDamageValue) return; - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - projectile.damage = trueDamage; + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); + Projectile.damage = trueDamage; } internal void GenerateVisuals() @@ -83,54 +83,54 @@ namespace CalamityMod.Projectiles.Summon if (Main.dedServ) return; - projectile.rotation += projectile.velocity.X * 0.075f; + Projectile.rotation += Projectile.velocity.X * 0.075f; } internal void FlyNearOwner() { - Vector2 destination = Owner.Top - Vector2.UnitY * 45f + (projectile.identity * 0.9f).ToRotationVector2() * 16f; - Vector2 idealVelocity = projectile.SafeDirectionTo(destination) * MathHelper.Lerp(2.3f, 8f, Utils.InverseLerp(16f, 160f, projectile.Distance(destination))); - if (projectile.velocity.Length() < 0.4f) - projectile.velocity = Vector2.UnitY.RotatedBy(Main.rand.NextFloat(0.5f, 1.1f) * Main.rand.NextBool(2).ToDirectionInt()) * -3.6f; - else if (!projectile.WithinRange(destination, 20f)) - projectile.velocity = projectile.velocity * 0.9f + idealVelocity * 0.1f; + Vector2 destination = Owner.Top - Vector2.UnitY * 45f + (Projectile.identity * 0.9f).ToRotationVector2() * 16f; + Vector2 idealVelocity = Projectile.SafeDirectionTo(destination) * MathHelper.Lerp(2.3f, 8f, Utils.InverseLerp(16f, 160f, Projectile.Distance(destination))); + if (Projectile.velocity.Length() < 0.4f) + Projectile.velocity = Vector2.UnitY.RotatedBy(Main.rand.NextFloat(0.5f, 1.1f) * Main.rand.NextBool(2).ToDirectionInt()) * -3.6f; + else if (!Projectile.WithinRange(destination, 20f)) + Projectile.velocity = Projectile.velocity * 0.9f + idealVelocity * 0.1f; - if (!projectile.WithinRange(Owner.Center, 1800f)) + if (!Projectile.WithinRange(Owner.Center, 1800f)) { - projectile.Center = Owner.Center; - projectile.velocity = -Vector2.UnitY * 4f; - projectile.netUpdate = true; + Projectile.Center = Owner.Center; + Projectile.velocity = -Vector2.UnitY * 4f; + Projectile.netUpdate = true; } // Slow down a bit over time. - projectile.velocity *= 0.985f; + Projectile.velocity *= 0.985f; } internal void AttackTarget(NPC target) { - if (Main.myPlayer == projectile.owner && HoverTime % 70f == 69f) + if (Main.myPlayer == Projectile.owner && HoverTime % 70f == 69f) { - Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(target.Center) * 8f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 8f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); HoverTime++; } Vector2 destination = target.Center; - Vector2 destinationOffset = Vector2.Max(target.Size * 1.2f, Vector2.One * 90f).RotatedBy(projectile.identity * 0.96f + HoverTime / 15f); + Vector2 destinationOffset = Vector2.Max(target.Size * 1.2f, Vector2.One * 90f).RotatedBy(Projectile.identity * 0.96f + HoverTime / 15f); // Make the offset pulsate over time. - destinationOffset *= MathHelper.Lerp(0.7f, 1.3f, (float)Math.Cos(projectile.identity * 1.11f + HoverTime / 14f) * 0.5f + 0.5f); + destinationOffset *= MathHelper.Lerp(0.7f, 1.3f, (float)Math.Cos(Projectile.identity * 1.11f + HoverTime / 14f) * 0.5f + 0.5f); - destinationOffset.Y += (float)Math.Sin(projectile.identity * 1.16f + HoverTime / 15f + MathHelper.PiOver2) * MathHelper.Min(target.height * 0.8f, 70f); + destinationOffset.Y += (float)Math.Sin(Projectile.identity * 1.16f + HoverTime / 15f + MathHelper.PiOver2) * MathHelper.Min(target.height * 0.8f, 70f); destination += destinationOffset; // Fly towards the destination faster the farther the eye already is to it. - float flySpeed = MathHelper.Lerp(5f, 15f, Utils.InverseLerp(40f, 250f, projectile.Distance(destination), true)); + float flySpeed = MathHelper.Lerp(5f, 15f, Utils.InverseLerp(40f, 250f, Projectile.Distance(destination), true)); - if (projectile.WithinRange(destination, 24f + target.velocity.Length() * 2f)) + if (Projectile.WithinRange(destination, 24f + target.velocity.Length() * 2f)) HoverTime++; - projectile.velocity = (destination - projectile.Center).SafeNormalize(Vector2.Zero) * flySpeed; + Projectile.velocity = (destination - Projectile.Center).SafeNormalize(Vector2.Zero) * flySpeed; } public override bool CanDamage() => false; diff --git a/Projectiles/Summon/FlameBlast.cs b/Projectiles/Summon/FlameBlast.cs index 1e9146bfe1..63a6f7a18a 100644 --- a/Projectiles/Summon/FlameBlast.cs +++ b/Projectiles/Summon/FlameBlast.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class FlameBlast : ModProjectile @@ -13,36 +14,36 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); - ProjectileID.Sets.SentryShot[projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 180; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 180; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (count == 0f) { - Main.PlaySound(SoundID.Item73, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item73, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 20; + Projectile.height = 20; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -52,33 +53,33 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } count += 1f; } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 5; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 0.75f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 0.75f); Main.dust[num469].velocity *= 0f; } } - NPC potentialTarget = projectile.Center.MinionHoming(300f, Main.player[projectile.owner]); + NPC potentialTarget = Projectile.Center.MinionHoming(300f, Main.player[Projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 25f) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 25f) / 21f; } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 244, Projectile.oldVelocity.X * 0f, Projectile.oldVelocity.Y * 0f); } } } diff --git a/Projectiles/Summon/FlameBurst.cs b/Projectiles/Summon/FlameBurst.cs index 29678996d2..afadefcf67 100644 --- a/Projectiles/Summon/FlameBurst.cs +++ b/Projectiles/Summon/FlameBurst.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class FlameBurst : ModProjectile @@ -13,36 +14,36 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Burst"); - ProjectileID.Sets.SentryShot[projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 180; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 180; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (count == 0f) { - Main.PlaySound(SoundID.Item73, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item73, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 20; + Projectile.height = 20; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -52,33 +53,33 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } count += 1f; } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 5; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 0.75f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 0.75f); Main.dust[num469].velocity *= 0f; } } - NPC potentialTarget = projectile.Center.MinionHoming(1200f, Main.player[projectile.owner]); + NPC potentialTarget = Projectile.Center.MinionHoming(1200f, Main.player[Projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 20f) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 20f) / 21f; } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 246, Projectile.oldVelocity.X * 0f, Projectile.oldVelocity.Y * 0f); } } } diff --git a/Projectiles/Summon/FleshBallMinion.cs b/Projectiles/Summon/FleshBallMinion.cs index 57a813b4c6..b7318b490e 100644 --- a/Projectiles/Summon/FleshBallMinion.cs +++ b/Projectiles/Summon/FleshBallMinion.cs @@ -9,34 +9,34 @@ namespace CalamityMod.Projectiles.Summon { public class FleshBallMinion : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public bool SittingOnGround => Math.Abs(projectile.velocity.X) < 1.55f && projectile.velocity.Y == 0f; - public ref float HopTimer => ref projectile.ai[0]; - public ref float HopAmount => ref projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public bool SittingOnGround => Math.Abs(Projectile.velocity.X) < 1.55f && Projectile.velocity.Y == 0f; + public ref float HopTimer => ref Projectile.ai[0]; + public ref float HopAmount => ref Projectile.ai[1]; public const float Gravity = 0.25f; public const float MaxFallSpeed = 12f; public override void SetStaticDefaults() { DisplayName.SetDefault("Flesh Ball"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 32; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 90000; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.tileCollide = false; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 60; + Projectile.width = Projectile.height = 32; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; } public override void AI() @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Summon HopTimer++; SufferFromSeparationAnxiety(); - NPC potentialTarget = projectile.Center.MinionHoming(950f, Owner, false); + NPC potentialTarget = Projectile.Center.MinionHoming(950f, Owner, false); if (potentialTarget is null) GoNearOwner(); else @@ -61,26 +61,26 @@ namespace CalamityMod.Projectiles.Summon // Verify player/minion state integrity. The minion cannot stay alive if the // owner is dead or if the caller of the AI is invalid. - if (projectile.type != ModContent.ProjectileType()) + if (Projectile.type != ModContent.ProjectileType()) return; if (Owner.dead) Owner.Calamity().fleshBall = false; if (Owner.Calamity().fleshBall) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } internal void DetermineFrames() { - projectile.frameCounter++; - if (projectile.frameCounter % 5 == 4) - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + if (Projectile.frameCounter % 5 == 4) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; } internal void EnforceGravity() { - if (projectile.velocity.Y < MaxFallSpeed) - projectile.velocity.Y += Gravity; + if (Projectile.velocity.Y < MaxFallSpeed) + Projectile.velocity.Y += Gravity; } internal void GenerateVisuals() @@ -89,74 +89,74 @@ namespace CalamityMod.Projectiles.Summon if (Main.dedServ) return; - projectile.rotation += projectile.velocity.X * 0.05f; + Projectile.rotation += Projectile.velocity.X * 0.05f; - Vector2 shootOffsetDirection = -Vector2.UnitY.RotatedBy(projectile.rotation + projectile.direction * 0.2f); - Dust blood = Dust.NewDustDirect(projectile.Center + shootOffsetDirection * 10f - new Vector2(4f), 0, 0, DustID.Blood, newColor: Color.Transparent); + Vector2 shootOffsetDirection = -Vector2.UnitY.RotatedBy(Projectile.rotation + Projectile.direction * 0.2f); + Dust blood = Dust.NewDustDirect(Projectile.Center + shootOffsetDirection * 10f - new Vector2(4f), 0, 0, DustID.Blood, newColor: Color.Transparent); blood.velocity = shootOffsetDirection.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(3f, 4f); blood.noGravity = true; } internal void SufferFromSeparationAnxiety() { - float teleportPromptDistance = Collision.CanHitLine(projectile.Center, 1, 1, Owner.Center, 1, 1) ? 1900f : 805f; - if (Main.myPlayer == projectile.owner && !projectile.WithinRange(Owner.Center, teleportPromptDistance)) + float teleportPromptDistance = Collision.CanHitLine(Projectile.Center, 1, 1, Owner.Center, 1, 1) ? 1900f : 805f; + if (Main.myPlayer == Projectile.owner && !Projectile.WithinRange(Owner.Center, teleportPromptDistance)) { - projectile.Center = Owner.Center; - projectile.netUpdate = true; + Projectile.Center = Owner.Center; + Projectile.netUpdate = true; } } internal void GoNearOwner() { - projectile.tileCollide = true; + Projectile.tileCollide = true; - bool closeToPlayer = projectile.WithinRange(Owner.Center, 150f); + bool closeToPlayer = Projectile.WithinRange(Owner.Center, 150f); if (!closeToPlayer && SittingOnGround && HopTimer % 30f == 29f) { - projectile.velocity = projectile.SafeDirectionTo(Owner.Center) * 9f + new Vector2(Math.Sign(projectile.velocity.X) * 2f, -9f); + Projectile.velocity = Projectile.SafeDirectionTo(Owner.Center) * 9f + new Vector2(Math.Sign(Projectile.velocity.X) * 2f, -9f); // Don't collide with tiles for 1 frame, to prevent slopes from being a nuisance. - projectile.tileCollide = false; - projectile.netUpdate = true; + Projectile.tileCollide = false; + Projectile.netUpdate = true; } } internal void AttackTarget(NPC target) { - projectile.tileCollide = true; + Projectile.tileCollide = true; if (SittingOnGround && HopTimer % 20f == 19f) { - projectile.velocity = projectile.SafeDirectionTo(target.Center) * 6f + new Vector2(Math.Sign(projectile.velocity.X) * 2f, -7f); + Projectile.velocity = Projectile.SafeDirectionTo(target.Center) * 6f + new Vector2(Math.Sign(Projectile.velocity.X) * 2f, -7f); HopAmount++; // Release a bunch of blood. - if (Main.myPlayer == projectile.owner && HopAmount % 3f == 2f) + if (Main.myPlayer == Projectile.owner && HopAmount % 3f == 2f) { for (int i = 0; i < 2; i++) { Vector2 shootVelocity = -Vector2.UnitY.RotatedByRandom(0.3f) * Main.rand.NextFloat(6f, 11f); - int blood = Projectile.NewProjectile(projectile.Top, shootVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + int blood = Projectile.NewProjectile(Projectile.Top, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } // Don't collide with tiles for 1 frame, to prevent slopes from being a nuisance. - projectile.tileCollide = false; - projectile.netUpdate = true; + Projectile.tileCollide = false; + Projectile.netUpdate = true; } } // Prevent immediate death on tile collision, and slow down on tile collision. public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.velocity.X *= 0.9f; + Projectile.velocity.X *= 0.9f; return false; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { - fallThrough = projectile.Bottom.Y < Owner.Top.Y; + fallThrough = Projectile.Bottom.Y < Owner.Top.Y; return true; } } diff --git a/Projectiles/Summon/FleshBlood.cs b/Projectiles/Summon/FleshBlood.cs index bf7af39283..b0e1db06bf 100644 --- a/Projectiles/Summon/FleshBlood.cs +++ b/Projectiles/Summon/FleshBlood.cs @@ -11,36 +11,36 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Blood"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.minion = true; - projectile.penetrate = 1; - projectile.timeLeft = LifeTime; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.penetrate = 1; + Projectile.timeLeft = LifeTime; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < LifeTime - 30 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < LifeTime - 30 && target.CanBeChasedBy(Projectile); public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int i = 0; i < 2; i++) { - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Blood, 0f, 0f, 100, default, 1f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 0f; } } - if (projectile.timeLeft < LifeTime - 30) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 6f, 20f); + if (Projectile.timeLeft < LifeTime - 30) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 6f, 20f); } } } diff --git a/Projectiles/Summon/FlowersOfMortalityPetal.cs b/Projectiles/Summon/FlowersOfMortalityPetal.cs index 1d9379350c..5d084072d6 100644 --- a/Projectiles/Summon/FlowersOfMortalityPetal.cs +++ b/Projectiles/Summon/FlowersOfMortalityPetal.cs @@ -10,36 +10,36 @@ namespace CalamityMod.Projectiles.Summon { public class FlowersOfMortalityPetal : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float OffsetAngle => ref projectile.ai[0]; - public ref float Time => ref projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float OffsetAngle => ref Projectile.ai[0]; + public ref float Time => ref Projectile.ai[1]; public float Hue => OffsetAngle % MathHelper.TwoPi / MathHelper.TwoPi % 1f; public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Petal"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 90000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; + Projectile.width = Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0.5f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; } public override void AI() { - bool isCorrectMinion = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool isCorrectMinion = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); if (isCorrectMinion) @@ -47,56 +47,56 @@ namespace CalamityMod.Projectiles.Summon if (player.dead) modPlayer.flowersOfMortality = false; if (modPlayer.flowersOfMortality) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } SetProjectileDamage(); Time++; - NPC potentialTarget = projectile.Center.MinionHoming(1050f, Owner); - if (Time % 50f == 49f && Main.myPlayer == projectile.owner && potentialTarget != null) + NPC potentialTarget = Projectile.Center.MinionHoming(1050f, Owner); + if (Time % 50f == 49f && Main.myPlayer == Projectile.owner && potentialTarget != null) { - Vector2 shootVelocity = projectile.SafeDirectionTo(potentialTarget.Center) * 10f; - Projectile.NewProjectile(projectile.Center, shootVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Vector2 shootVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 10f; + Projectile.NewProjectile(Projectile.Center, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } - projectile.Center = player.Center + OffsetAngle.ToRotationVector2() * (150f + (float)Math.Sin(Time * 0.08f) * 15f); - projectile.rotation += MathHelper.ToRadians(7f); + Projectile.Center = player.Center + OffsetAngle.ToRotationVector2() * (150f + (float)Math.Sin(Time * 0.08f) * 15f); + Projectile.rotation += MathHelper.ToRadians(7f); OffsetAngle += MathHelper.ToRadians(6f); } public void SetProjectileDamage() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 36; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, 261); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 261); dust.noGravity = true; dust.color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f); dust.velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(2f, 7f); } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D petalTexture = Main.projectileTexture[projectile.type]; - Texture2D coreTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/FlowersOfMortalityCore"); + Texture2D petalTexture = Main.projectileTexture[Projectile.type]; + Texture2D coreTexture = ModContent.Request("CalamityMod/Projectiles/Summon/FlowersOfMortalityCore"); Color drawColor = Main.hslToRgb(Hue, 0.95f, 0.5f) * 2.3f; - Vector2 drawPosition = projectile.Center - Main.screenPosition; - spriteBatch.Draw(petalTexture, drawPosition, null, projectile.GetAlpha(drawColor), projectile.rotation, petalTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); - spriteBatch.Draw(coreTexture, drawPosition, null, projectile.GetAlpha(lightColor), 0f, coreTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + spriteBatch.Draw(petalTexture, drawPosition, null, Projectile.GetAlpha(drawColor), Projectile.rotation, petalTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(coreTexture, drawPosition, null, Projectile.GetAlpha(lightColor), 0f, coreTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Summon/FlyingOrthocera.cs b/Projectiles/Summon/FlyingOrthocera.cs index d57903de9b..f39c6e459d 100644 --- a/Projectiles/Summon/FlyingOrthocera.cs +++ b/Projectiles/Summon/FlyingOrthocera.cs @@ -12,68 +12,68 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Flying Orthocera"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 46; - projectile.height = 42; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; + Projectile.width = 46; + Projectile.height = 42; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.sentry = true; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.penetrate = -1; } public override void AI() { - Player player = Main.player[projectile.owner]; - if (projectile.localAI[0] == 0f) + Player player = Main.player[Projectile.owner]; + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 56; i++) { float angle = MathHelper.TwoPi / 56f * i; - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); dust.scale = 1.5f; dust.velocity = angle.ToRotationVector2() * 7f; dust.noGravity = true; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - projectile.frameCounter++; - if (projectile.frameCounter % 5f == 4f) + Projectile.frameCounter++; + if (Projectile.frameCounter % 5f == 4f) { - projectile.frame++; + Projectile.frame++; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - NPC potentialTarget = projectile.Center.MinionHoming(SearchDistance, player); + NPC potentialTarget = Projectile.Center.MinionHoming(SearchDistance, player); if (potentialTarget != null) { - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(potentialTarget.Center) - MathHelper.PiOver4, 0.085f); - projectile.spriteDirection = (projectile.rotation < MathHelper.Pi).ToDirectionInt(); - if (projectile.ai[0]++ % 30f == 29f) + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(potentialTarget.Center) - MathHelper.PiOver4, 0.085f); + Projectile.spriteDirection = (Projectile.rotation < MathHelper.Pi).ToDirectionInt(); + if (Projectile.ai[0]++ % 30f == 29f) { - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(potentialTarget.Center, Vector2.UnitY) * 11f, ModContent.ProjectileType(), projectile.damage, 4f, projectile.owner); + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center, Vector2.UnitY) * 11f, ModContent.ProjectileType(), Projectile.damage, 4f, Projectile.owner); } } else { - projectile.rotation = projectile.rotation.AngleTowards(0f, 0.15f); + Projectile.rotation = Projectile.rotation.AngleTowards(0f, 0.15f); } } } diff --git a/Projectiles/Summon/FlyingOrthoceraStream.cs b/Projectiles/Summon/FlyingOrthoceraStream.cs index edebdd27e9..48c5a96e38 100644 --- a/Projectiles/Summon/FlyingOrthoceraStream.cs +++ b/Projectiles/Summon/FlyingOrthoceraStream.cs @@ -12,59 +12,59 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Stream"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.extraUpdates = 2; - projectile.tileCollide = false; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 8; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; } public override void AI() { - projectile.ai[1]++; - if (projectile.ai[1] >= 4f) + Projectile.ai[1]++; + if (Projectile.ai[1] >= 4f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - projectile.scale -= 0.002f; - if (projectile.scale <= 0f) + Projectile.scale -= 0.002f; + if (Projectile.scale <= 0f) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.ai[0] <= 3f) + if (Projectile.ai[0] <= 3f) { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; return; } - projectile.velocity.Y += 0.03f; + Projectile.velocity.Y += 0.03f; for (int i = 0; i < 3; i++) { - Vector2 positionDelta = projectile.velocity / 3f * i; + Vector2 positionDelta = Projectile.velocity / 3f * i; int spawnDelta = 14; - int dustIdx = Dust.NewDust(new Vector2(projectile.position.X + spawnDelta, projectile.position.Y + spawnDelta), projectile.width - spawnDelta * 2, projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); + int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[dustIdx]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.5f; + dust.velocity += Projectile.velocity * 0.5f; dust.position -= positionDelta; } if (Main.rand.NextBool(8)) { int spawnDelta = 16; - int dustIdx = Dust.NewDust(new Vector2(projectile.position.X + spawnDelta, projectile.position.Y + spawnDelta), projectile.width - spawnDelta * 2, projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 0.5f); + int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 0.5f); Main.dust[dustIdx].velocity *= 0.25f; - Main.dust[dustIdx].velocity += projectile.velocity * 0.5f; + Main.dust[dustIdx].velocity += Projectile.velocity * 0.5f; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/ForbiddenCircletEater.cs b/Projectiles/Summon/ForbiddenCircletEater.cs index 5b7c2b3d12..b2fa4823fc 100644 --- a/Projectiles/Summon/ForbiddenCircletEater.cs +++ b/Projectiles/Summon/ForbiddenCircletEater.cs @@ -11,75 +11,75 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Circlet Eater"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.minion = true; - projectile.extraUpdates = 3; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.minion = true; + Projectile.extraUpdates = 3; } public override void AI() { - Player player = Main.player[projectile.owner]; - if (projectile.alpha > 0) + Player player = Main.player[Projectile.owner]; + if (Projectile.alpha > 0) { - projectile.alpha -= 50; + Projectile.alpha -= 50; } else { - projectile.extraUpdates = 0; + Projectile.extraUpdates = 0; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - projectile.frameCounter++; - if (projectile.frameCounter >= 6) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } for (int num369 = 0; num369 < 1; num369++) { int dustType = 159; - float num370 = projectile.velocity.X / 3f * (float)num369; - float num371 = projectile.velocity.Y / 3f * (float)num369; - int num372 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); + float num370 = Projectile.velocity.X / 3f * (float)num369; + float num371 = Projectile.velocity.Y / 3f * (float)num369; + int num372 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num372]; - dust.position.X = projectile.Center.X - num370; - dust.position.Y = projectile.Center.Y - num371; + dust.position.X = Projectile.Center.X - num370; + dust.position.Y = Projectile.Center.Y - num371; dust.velocity *= 0f; dust.scale = 0.5f; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; - float num373 = projectile.position.X; - float num374 = projectile.position.Y; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; + float num373 = Projectile.position.X; + float num374 = Projectile.position.Y; float num375 = 100000f; bool flag10 = false; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 30f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 30f) { if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float num377 = npc.position.X + (float)(npc.width / 2); float num378 = npc.position.Y + (float)(npc.height / 2); - float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); - if (num379 < 640f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float num379 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num377) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num378); + if (num379 < 640f && num379 < num375 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { num375 = num379; num373 = num377; @@ -93,12 +93,12 @@ namespace CalamityMod.Projectiles.Summon for (int num376 = 0; num376 < Main.maxNPCs; num376++) { NPC npc = Main.npc[num376]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float num377 = npc.position.X + (float)(npc.width / 2); float num378 = npc.position.Y + (float)(npc.height / 2); - float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); - if (num379 < 640f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float num379 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num377) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num378); + if (num379 < 640f && num379 < num375 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { num375 = num379; num373 = num377; @@ -111,48 +111,48 @@ namespace CalamityMod.Projectiles.Summon } if (!flag10) { - num373 = projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X * 100f; - num374 = projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y * 100f; + num373 = Projectile.position.X + (float)(Projectile.width / 2) + Projectile.velocity.X * 100f; + num374 = Projectile.position.Y + (float)(Projectile.height / 2) + Projectile.velocity.Y * 100f; } float num380 = 10f; float num381 = 0.16f; - Vector2 vector30 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector30 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num382 = num373 - vector30.X; float num383 = num374 - vector30.Y; float num384 = (float)Math.Sqrt((double)(num382 * num382 + num383 * num383)); num384 = num380 / num384; num382 *= num384; num383 *= num384; - if (projectile.velocity.X < num382) + if (Projectile.velocity.X < num382) { - projectile.velocity.X = projectile.velocity.X + num381; - if (projectile.velocity.X < 0f && num382 > 0f) + Projectile.velocity.X = Projectile.velocity.X + num381; + if (Projectile.velocity.X < 0f && num382 > 0f) { - projectile.velocity.X = projectile.velocity.X + num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X + num381 * 2f; } } - else if (projectile.velocity.X > num382) + else if (Projectile.velocity.X > num382) { - projectile.velocity.X = projectile.velocity.X - num381; - if (projectile.velocity.X > 0f && num382 < 0f) + Projectile.velocity.X = Projectile.velocity.X - num381; + if (Projectile.velocity.X > 0f && num382 < 0f) { - projectile.velocity.X = projectile.velocity.X - num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X - num381 * 2f; } } - if (projectile.velocity.Y < num383) + if (Projectile.velocity.Y < num383) { - projectile.velocity.Y = projectile.velocity.Y + num381; - if (projectile.velocity.Y < 0f && num383 > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num381; + if (Projectile.velocity.Y < 0f && num383 > 0f) { - projectile.velocity.Y = projectile.velocity.Y + num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + num381 * 2f; } } - else if (projectile.velocity.Y > num383) + else if (Projectile.velocity.Y > num383) { - projectile.velocity.Y = projectile.velocity.Y - num381; - if (projectile.velocity.Y > 0f && num383 < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num381; + if (Projectile.velocity.Y > 0f && num383 < 0f) { - projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - num381 * 2f; } } } @@ -162,23 +162,23 @@ namespace CalamityMod.Projectiles.Summon bounce--; if (bounce <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - projectile.ai[0] += 15f; - if (projectile.velocity.X != oldVelocity.X) + Projectile.ai[0] += 15f; + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; } - public override bool CanDamage() => projectile.ai[0] >= 30f; + public override bool CanDamage() => Projectile.ai[0] >= 30f; } } diff --git a/Projectiles/Summon/FrogGore1.cs b/Projectiles/Summon/FrogGore1.cs index 0eaee31999..2527e226dc 100644 --- a/Projectiles/Summon/FrogGore1.cs +++ b/Projectiles/Summon/FrogGore1.cs @@ -9,37 +9,37 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gore from a not frog of the explosive variety"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 14; - projectile.height = 14; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.timeLeft = 360; - projectile.alpha = 255; + Projectile.friendly = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.timeLeft = 360; + Projectile.alpha = 255; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] < 10f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] < 10f) { - projectile.alpha = 255 - (int)(255 * projectile.ai[0] / 10f); + Projectile.alpha = 255 - (int)(255 * Projectile.ai[0] / 10f); } - projectile.velocity.Y += 0.2f; - projectile.rotation += projectile.velocity.X * 0.03f; + Projectile.velocity.Y += 0.2f; + Projectile.rotation += Projectile.velocity.X * 0.03f; } public override void Kill(int timeLeft) { for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) { - Dust.NewDustPerfect(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + Dust.NewDustPerfect(Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), (int)CalamityDusts.SulfurousSeaAcid, Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } diff --git a/Projectiles/Summon/FrogGore2.cs b/Projectiles/Summon/FrogGore2.cs index 02e664f585..94c9e2b6d0 100644 --- a/Projectiles/Summon/FrogGore2.cs +++ b/Projectiles/Summon/FrogGore2.cs @@ -9,37 +9,37 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gore from a not frog of the explosive variety"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 14; - projectile.height = 14; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.timeLeft = 360; - projectile.alpha = 255; + Projectile.friendly = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.timeLeft = 360; + Projectile.alpha = 255; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] < 10f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] < 10f) { - projectile.alpha = 255 - (int)(255 * projectile.ai[0] / 10f); + Projectile.alpha = 255 - (int)(255 * Projectile.ai[0] / 10f); } - projectile.velocity.Y += 0.2f; - projectile.rotation += projectile.velocity.X * 0.03f; + Projectile.velocity.Y += 0.2f; + Projectile.rotation += Projectile.velocity.X * 0.03f; } public override void Kill(int timeLeft) { for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) { - Dust.NewDustPerfect(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + Dust.NewDustPerfect(Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), (int)CalamityDusts.SulfurousSeaAcid, Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } diff --git a/Projectiles/Summon/FrogGore3.cs b/Projectiles/Summon/FrogGore3.cs index b1376fd67e..29a1111ad8 100644 --- a/Projectiles/Summon/FrogGore3.cs +++ b/Projectiles/Summon/FrogGore3.cs @@ -9,37 +9,37 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gore from a not frog of the explosive variety"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 14; - projectile.height = 16; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.timeLeft = 360; - projectile.alpha = 255; + Projectile.friendly = true; + Projectile.width = 14; + Projectile.height = 16; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.timeLeft = 360; + Projectile.alpha = 255; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] < 10f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] < 10f) { - projectile.alpha = 255 - (int)(255 * projectile.ai[0] / 10f); + Projectile.alpha = 255 - (int)(255 * Projectile.ai[0] / 10f); } - projectile.velocity.Y += 0.2f; - projectile.rotation += projectile.velocity.X * 0.03f; + Projectile.velocity.Y += 0.2f; + Projectile.rotation += Projectile.velocity.X * 0.03f; } public override void Kill(int timeLeft) { for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) { - Dust.NewDustPerfect(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + Dust.NewDustPerfect(Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), (int)CalamityDusts.SulfurousSeaAcid, Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } diff --git a/Projectiles/Summon/FrogGore4.cs b/Projectiles/Summon/FrogGore4.cs index 31a83ff00a..78609d9770 100644 --- a/Projectiles/Summon/FrogGore4.cs +++ b/Projectiles/Summon/FrogGore4.cs @@ -9,37 +9,37 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gore from a not frog of the explosive variety"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 14; - projectile.height = 16; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.timeLeft = 360; - projectile.alpha = 255; + Projectile.friendly = true; + Projectile.width = 14; + Projectile.height = 16; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.timeLeft = 360; + Projectile.alpha = 255; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] < 10f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] < 10f) { - projectile.alpha = 255 - (int)(255 * projectile.ai[0] / 10f); + Projectile.alpha = 255 - (int)(255 * Projectile.ai[0] / 10f); } - projectile.velocity.Y += 0.2f; - projectile.rotation += projectile.velocity.X * 0.03f; + Projectile.velocity.Y += 0.2f; + Projectile.rotation += Projectile.velocity.X * 0.03f; } public override void Kill(int timeLeft) { for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) { - Dust.NewDustPerfect(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + Dust.NewDustPerfect(Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), (int)CalamityDusts.SulfurousSeaAcid, Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } diff --git a/Projectiles/Summon/FrogGore5.cs b/Projectiles/Summon/FrogGore5.cs index 3afc0756ba..114264b19f 100644 --- a/Projectiles/Summon/FrogGore5.cs +++ b/Projectiles/Summon/FrogGore5.cs @@ -9,37 +9,37 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gore from a not frog of the explosive variety"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 14; - projectile.height = 16; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.timeLeft = 360; - projectile.alpha = 255; + Projectile.friendly = true; + Projectile.width = 14; + Projectile.height = 16; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.timeLeft = 360; + Projectile.alpha = 255; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] < 10f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] < 10f) { - projectile.alpha = 255 - (int)(255 * projectile.ai[0] / 10f); + Projectile.alpha = 255 - (int)(255 * Projectile.ai[0] / 10f); } - projectile.velocity.Y += 0.2f; - projectile.rotation += projectile.velocity.X * 0.03f; + Projectile.velocity.Y += 0.2f; + Projectile.rotation += Projectile.velocity.X * 0.03f; } public override void Kill(int timeLeft) { for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) { - Dust.NewDustPerfect(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + Dust.NewDustPerfect(Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), (int)CalamityDusts.SulfurousSeaAcid, Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } diff --git a/Projectiles/Summon/FrostBeam.cs b/Projectiles/Summon/FrostBeam.cs index 3f52561bb2..285c7ced7c 100644 --- a/Projectiles/Summon/FrostBeam.cs +++ b/Projectiles/Summon/FrostBeam.cs @@ -12,31 +12,31 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.extraUpdates = 220; - projectile.timeLeft = 200; - projectile.coldDamage = true; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = 1; + Projectile.extraUpdates = 220; + Projectile.timeLeft = 200; + Projectile.coldDamage = true; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 5f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 5f) { for (int i = 0; i < 6; i++) { - Vector2 spawnPosition = projectile.position; - spawnPosition -= projectile.velocity * i * 0.25f; + Vector2 spawnPosition = Projectile.position; + spawnPosition -= Projectile.velocity * i * 0.25f; int idx = Dust.NewDust(spawnPosition, 1, 1, 113, 0f, 0f, 0, default, 1.25f); Main.dust[idx].position = spawnPosition; Main.dust[idx].scale = Main.rand.NextFloat(0.75f, 0.85f); @@ -47,17 +47,17 @@ namespace CalamityMod.Projectiles.Summon } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 70; - projectile.position -= projectile.Size * 0.5f; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 3; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 70; + Projectile.position -= Projectile.Size * 0.5f; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 3; + Projectile.Damage(); int flowerPetalCount = Main.rand.Next(3, 5 + 1); - float thetaDelta = projectile.velocity.ToRotation(); + float thetaDelta = Projectile.velocity.ToRotation(); float weaveDistanceMin = 2f; float weaveDistanceOutwardMax = 3f; float weaveDistanceInner = 0.5f; @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Summon // instead of weaving backwards. (float)(Math.Sin(thetaDelta + theta * flowerPetalCount) + 0.5f + weaveDistanceInner) * weaveDistanceOutwardMax); - Dust dust = Dust.NewDustPerfect(projectile.Center, 113, velocity); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 113, velocity); dust.noGravity = true; dust.scale = 1.35f; } diff --git a/Projectiles/Summon/FrostBlossom.cs b/Projectiles/Summon/FrostBlossom.cs index 136db27df0..d5eb67f858 100644 --- a/Projectiles/Summon/FrostBlossom.cs +++ b/Projectiles/Summon/FrostBlossom.cs @@ -12,30 +12,30 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Frost Blossom"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 36; - projectile.height = 40; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.coldDamage = true; + Projectile.width = 36; + Projectile.height = 40; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.coldDamage = true; } public override void AI() { - bool isCorrectMinion = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool isCorrectMinion = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); if (isCorrectMinion) @@ -46,50 +46,50 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.frostBlossom) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { - projectile.position.Y += 120f; - projectile.rotation = MathHelper.Pi; + Projectile.position.Y += 120f; + Projectile.rotation = MathHelper.Pi; } else { - projectile.rotation = 0f; + Projectile.rotation = 0f; } - projectile.position.X = (int)projectile.position.X; - projectile.position.Y = (int)projectile.position.Y; - projectile.scale = 1f + (float)Math.Sin(projectile.ai[0]++ / 40f) * 0.085f; - projectile.Opacity = 1f - (float)Math.Sin(projectile.ai[1] / 45f) * 0.075f - 0.075f; // Range of 1f to 0.85f - if (projectile.localAI[0] == 0f) + Projectile.position.X = (int)Projectile.position.X; + Projectile.position.Y = (int)Projectile.position.Y; + Projectile.scale = 1f + (float)Math.Sin(Projectile.ai[0]++ / 40f) * 0.085f; + Projectile.Opacity = 1f - (float)Math.Sin(Projectile.ai[1] / 45f) * 0.075f - 0.075f; // Range of 1f to 0.85f + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 36; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, 113); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 113); dust.noGravity = true; dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2f, 7f); } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - NPC potentialTarget = projectile.Center.MinionHoming(500f, player); + NPC potentialTarget = Projectile.Center.MinionHoming(500f, player); if (potentialTarget != null) { - if (projectile.ai[1]++ % 35f == 34f && Collision.CanHit(projectile.position, projectile.width, projectile.height, potentialTarget.position, potentialTarget.width, potentialTarget.height)) + if (Projectile.ai[1]++ % 35f == 34f && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, potentialTarget.position, potentialTarget.width, potentialTarget.height)) { - Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(potentialTarget.Center) * 20f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center) * 20f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Summon/FrostMistFriendly.cs b/Projectiles/Summon/FrostMistFriendly.cs index db615e5ab6..4a22b87dcc 100644 --- a/Projectiles/Summon/FrostMistFriendly.cs +++ b/Projectiles/Summon/FrostMistFriendly.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class FrostMistFriendly : ModProjectile @@ -11,41 +12,41 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Mist"); - Main.projFrames[projectile.type] = 8; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 8; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; - projectile.coldDamage = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.alpha = 255; + Projectile.coldDamage = true; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -53,64 +54,64 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item30, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item30, Projectile.position); } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) + Projectile.scale -= 0.02f; + Projectile.alpha += 30; + if (Projectile.alpha >= 250) { - projectile.alpha = 255; - projectile.localAI[0] = 1f; + Projectile.alpha = 255; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) + Projectile.scale += 0.02f; + Projectile.alpha -= 30; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[0] = 0f; + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; } } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + int num103 = (int)Player.FindClosest(Projectile.Center, 1, 1); + Projectile.ai[1] += 1f; + if (Projectile.ai[1] < 110f && Projectile.ai[1] > 30f) { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; + float scaleFactor2 = Projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - Projectile.Center; vector11.Normalize(); vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 24f + vector11) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; } - if (projectile.ai[0] < 0f) + if (Projectile.ai[0] < 0f) { - if (projectile.velocity.Length() < 18f) + if (Projectile.velocity.Length() < 18f) { - projectile.velocity *= 1.02f; + Projectile.velocity *= 1.02f; } } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.35f / 255f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } } } diff --git a/Projectiles/Summon/FungalClumpMinion.cs b/Projectiles/Summon/FungalClumpMinion.cs index bfbf6adda8..def3709a94 100644 --- a/Projectiles/Summon/FungalClumpMinion.cs +++ b/Projectiles/Summon/FungalClumpMinion.cs @@ -15,35 +15,35 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Fungal Clump"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.netImportant = true; - projectile.friendly = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; + Projectile.width = 40; + Projectile.height = 40; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (!modPlayer.fungalClump) { - projectile.active = false; + Projectile.active = false; return; } if (correctMinion) @@ -54,57 +54,57 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.fClump) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } //Initializing dust and damage - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 56, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } //Flexible damage correction - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } //Periodically create dust if (Main.rand.NextBool(16)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f); } //Anti-sticky movement failsafe - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); //If too far from player, increase speed to chase after player float playerRange = 500f; //Range is boosted if chasing after an enemy - if (projectile.ai[1] != 0f || projectile.friendly) + if (Projectile.ai[1] != 0f || Projectile.friendly) playerRange = 1400f; - if (Math.Abs(projectile.Center.X - player.Center.X) + Math.Abs(projectile.Center.Y - player.Center.Y) > playerRange) + if (Math.Abs(Projectile.Center.X - player.Center.X) + Math.Abs(Projectile.Center.Y - player.Center.Y) > playerRange) returnToPlayer = true; //Find an npc to target, or if minion targetting is used, choose that npc - Vector2 targetVec = projectile.Center; + Vector2 targetVec = Projectile.Center; float range = 900f; bool npcFound = false; Vector2 half = new Vector2(0.5f); @@ -113,13 +113,13 @@ namespace CalamityMod.Projectiles.Summon if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { //Check the size of the target to make it easier to hit fat targets like Levi Vector2 sizeCheck = npc.position + npc.Size * half; - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); //Some minions will ignore tiles when choosing a target like Ice Claspers, others will not - bool canHit = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); + bool canHit = Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height); if (!npcFound && targetDist < range && canHit) { range = targetDist; @@ -134,11 +134,11 @@ namespace CalamityMod.Projectiles.Summon for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { NPC npc = Main.npc[npcIndex]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { Vector2 sizeCheck = npc.position + npc.Size * half; - float targetDist = Vector2.Distance(npc.Center, projectile.Center); - bool canHit = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + bool canHit = Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height); if (!npcFound && targetDist < range && canHit) { range = targetDist; @@ -151,78 +151,78 @@ namespace CalamityMod.Projectiles.Summon } //Tile collision depends on if returning to the player or not - projectile.tileCollide = !returnToPlayer; + Projectile.tileCollide = !returnToPlayer; if (!npcFound) { - projectile.friendly = true; + Projectile.friendly = true; float homingSpeed = 8f; float turnSpeed = 20f; if (returnToPlayer) //move faster if returning to the player homingSpeed = 12f; - Vector2 playerVector = player.Center - projectile.Center; + Vector2 playerVector = player.Center - Projectile.Center; playerVector.Y -= 60f; float playerDist = playerVector.Length(); - if (playerDist < 100f && returnToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerDist < 100f && returnToPlayer && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) returnToPlayer = false; if (playerDist > 2000f) { - projectile.position.X = player.Center.X - projectile.width / 2; - projectile.position.Y = player.Center.Y - projectile.width / 2; + Projectile.position.X = player.Center.X - Projectile.width / 2; + Projectile.position.Y = player.Center.Y - Projectile.width / 2; } //If more than 70 pixels away, move toward the player if (playerDist > 70f) { playerVector.Normalize(); playerVector *= homingSpeed; - projectile.velocity = (projectile.velocity * turnSpeed + playerVector) / (turnSpeed + 1f); + Projectile.velocity = (Projectile.velocity * turnSpeed + playerVector) / (turnSpeed + 1f); } //Minions never stay still else { - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; } - projectile.friendly = false; - projectile.rotation = projectile.velocity.X * 0.05f; - if (Math.Abs(projectile.velocity.X) <= 0f) + Projectile.friendly = false; + Projectile.rotation = Projectile.velocity.X * 0.05f; + if (Math.Abs(Projectile.velocity.X) <= 0f) return; - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } else { - if (projectile.ai[1] == -1f) - projectile.ai[1] = 17f; - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] == -1f) + Projectile.ai[1] = 17f; + if (Projectile.ai[1] > 0f) { - projectile.ai[1] -= 1f; + Projectile.ai[1] -= 1f; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.friendly = true; + Projectile.friendly = true; float minionSpeed = 8f; float turnSpeed = 14f; - float targetDist = projectile.Distance(targetVec); + float targetDist = Projectile.Distance(targetVec); if (targetDist < 100f) minionSpeed = 10f; - Vector2 homingVelocity = projectile.SafeDirectionTo(targetVec) * minionSpeed; - projectile.velocity = (projectile.velocity * turnSpeed + homingVelocity) / (turnSpeed + 1f); + Vector2 homingVelocity = Projectile.SafeDirectionTo(targetVec) * minionSpeed; + Projectile.velocity = (Projectile.velocity * turnSpeed + homingVelocity) / (turnSpeed + 1f); } else { - projectile.friendly = false; - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) - projectile.velocity *= 1.05f; + Projectile.friendly = false; + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 10f) + Projectile.velocity *= 1.05f; } - projectile.rotation = projectile.velocity.X * 0.05f; - if (Math.Abs(projectile.velocity.X) <= 0.2f) + Projectile.rotation = Projectile.velocity.X * 0.05f; + if (Math.Abs(Projectile.velocity.X) <= 0.2f) return; - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } } @@ -241,7 +241,7 @@ namespace CalamityMod.Projectiles.Summon if (healAmt > CalamityMod.lifeStealCap) healAmt = CalamityMod.lifeStealCap; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Summon/GammaCanister.cs b/Projectiles/Summon/GammaCanister.cs index 4e73e67f94..a8626a85a6 100644 --- a/Projectiles/Summon/GammaCanister.cs +++ b/Projectiles/Summon/GammaCanister.cs @@ -11,45 +11,45 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gamma Canister"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 28; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.tileCollide = true; - projectile.ignoreWater = true; + Projectile.width = 20; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.alpha = 255; + Projectile.timeLeft = 300; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; } public override void AI() { - NPC potentialTarget = projectile.Center.MinionHoming(1450f, Main.player[projectile.owner]); - if (projectile.timeLeft >= 180) - projectile.velocity.Y += Gravity; + NPC potentialTarget = Projectile.Center.MinionHoming(1450f, Main.player[Projectile.owner]); + if (Projectile.timeLeft >= 180) + Projectile.velocity.Y += Gravity; else if (potentialTarget != null) { // This looks quite stupid but the weapon is going to be useless otherwise and I'm not reworking this thing a 3rd time. - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(potentialTarget.Center) * 18f, 0.18f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(potentialTarget.Center) * 18f, 0.18f); } - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - projectile.alpha = Utils.Clamp(projectile.alpha - 22, 0, 255); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.alpha = Utils.Clamp(Projectile.alpha - 22, 0, 255); } public override void Kill(int timeLeft) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; for (int i = 0; i < 6; i++) { Vector2 shootVelocity = (MathHelper.TwoPi * i / 12f).ToRotationVector2() * Main.rand.NextFloat(6f, 17f); - Projectile.NewProjectile(projectile.Center + shootVelocity * 2f, shootVelocity, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.4f, projectile.owner); + Projectile.NewProjectile(Projectile.Center + shootVelocity * 2f, shootVelocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.4f, Projectile.owner); } } } diff --git a/Projectiles/Summon/GammaHead.cs b/Projectiles/Summon/GammaHead.cs index 165ba7267f..0ea9ef5f71 100644 --- a/Projectiles/Summon/GammaHead.cs +++ b/Projectiles/Summon/GammaHead.cs @@ -17,38 +17,38 @@ namespace CalamityMod.Projectiles.Summon public Vector2 CurrentPositionOffset; public Vector2 IdealPositionOffset; public Vector2[] OldVelocities = new Vector2[20]; - public Player Owner => Main.player[projectile.owner]; - public ref float Time => ref projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; public Vector2 DrawStartPosition { get { - if (projectile.owner < 0 || projectile.owner >= Main.player.Length) + if (Projectile.owner < 0 || Projectile.owner >= Main.player.Length) return Vector2.Zero; - return Main.player[projectile.owner].Top + Vector2.UnitY * 8f; + return Main.player[Projectile.owner].Top + Vector2.UnitY * 8f; } } public override void SetStaticDefaults() { DisplayName.SetDefault("Gamma Head"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 36; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 32; + Projectile.height = 36; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void SendExtraAI(BinaryWriter writer) @@ -67,27 +67,27 @@ namespace CalamityMod.Projectiles.Summon { Vector2 returnPosition = DrawStartPosition + CurrentPositionOffset; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { PerformInitializationEffects(); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } ApplyMinionBuffs(); - projectile.direction = projectile.spriteDirection = Owner.direction; + Projectile.direction = Projectile.spriteDirection = Owner.direction; float idealRotation = 0f; - NPC potentialTarget = projectile.Center.MinionHoming(950f, Owner); + NPC potentialTarget = Projectile.Center.MinionHoming(950f, Owner); if (potentialTarget != null) NoticeTarget(potentialTarget, ref returnPosition, ref idealRotation); else - projectile.frame = 0; + Projectile.frame = 0; - projectile.rotation = projectile.rotation.AngleLerp(idealRotation, 0.15f); - projectile.rotation = projectile.rotation.AngleTowards(idealRotation, 0.15f); + Projectile.rotation = Projectile.rotation.AngleLerp(idealRotation, 0.15f); + Projectile.rotation = Projectile.rotation.AngleTowards(idealRotation, 0.15f); - projectile.Center = new Vector2(projectile.Center.X, MathHelper.Clamp(projectile.Center.Y, 1f, returnPosition.Y - 8f)); + Projectile.Center = new Vector2(Projectile.Center.X, MathHelper.Clamp(Projectile.Center.Y, 1f, returnPosition.Y - 8f)); MoveTowardsDestination(returnPosition); AdjustOldVelocityArray(); @@ -96,12 +96,12 @@ namespace CalamityMod.Projectiles.Summon public void PerformInitializationEffects() { - int totalHeads = CalamityUtils.CountProjectiles(projectile.type); + int totalHeads = CalamityUtils.CountProjectiles(Projectile.type); CurrentPositionOffset = IdealPositionOffset = new Vector2(Main.rand.NextFloat(-72f - 8f * totalHeads, 72f + 8f * totalHeads), -Main.rand.NextFloat(8f, 84f + 4f * totalHeads)); - projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - projectile.netUpdate = true; + Projectile.netUpdate = true; if (Main.dedServ) return; @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Summon // Release a circle of sulphuric dust. for (int i = 0; i < 18; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); dust.velocity = new Vector2(0f, -5f).RotatedBy(i / 18f * MathHelper.TwoPi); dust.noGravity = true; dust.scale = 1.35f; @@ -119,57 +119,57 @@ namespace CalamityMod.Projectiles.Summon public void ApplyMinionBuffs() { Owner.AddBuff(ModContent.BuffType(), 3600); - if (projectile.type == ModContent.ProjectileType()) + if (Projectile.type == ModContent.ProjectileType()) { if (Owner.dead) Owner.Calamity().gammaHead = false; if (Owner.Calamity().gammaHead) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } public void NoticeTarget(NPC target, ref Vector2 returnPosition, ref float idealRotation) { // Reel back a bit if a valid target has been located. - returnPosition -= (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * 16f; + returnPosition -= (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * 16f; // And release canisters from time to time. int canisterShootRate = 100; // Open the mouth prior to firing. if (Time % canisterShootRate > canisterShootRate - 20) - projectile.frame = (int)(Main.projFrames[projectile.type] * Utils.InverseLerp(canisterShootRate - 20, canisterShootRate - 4, Time % canisterShootRate, true)); - projectile.frame %= Main.projFrames[projectile.type]; + Projectile.frame = (int)(Main.projFrames[Projectile.type] * Utils.InverseLerp(canisterShootRate - 20, canisterShootRate - 4, Time % canisterShootRate, true)); + Projectile.frame %= Main.projFrames[Projectile.type]; - Vector2 spawnPosition = projectile.Center; + Vector2 spawnPosition = Projectile.Center; float shootSpeed = MathHelper.Lerp(8f, 29f, Utils.InverseLerp(90f, 850f, target.Distance(spawnPosition), true)); - Vector2 shootVelocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(spawnPosition, target.Center, GammaCanister.Gravity, shootSpeed, projectile.SafeDirectionTo(target.Center)); + Vector2 shootVelocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(spawnPosition, target.Center, GammaCanister.Gravity, shootSpeed, Projectile.SafeDirectionTo(target.Center)); float fireAngle = shootVelocity.ToRotation(); // Direction affecting. if (target.Center.X - spawnPosition.X < 0) fireAngle += MathHelper.Pi; - if (projectile.direction == (target.Center.X < spawnPosition.X).ToDirectionInt()) + if (Projectile.direction == (target.Center.X < spawnPosition.X).ToDirectionInt()) fireAngle += MathHelper.Pi; idealRotation = fireAngle; // Shoot the actual canister. - if (Main.myPlayer == projectile.owner && Time % canisterShootRate == canisterShootRate - 1) - Projectile.NewProjectile(spawnPosition, shootVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + if (Main.myPlayer == Projectile.owner && Time % canisterShootRate == canisterShootRate - 1) + Projectile.NewProjectile(spawnPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } public void MoveTowardsDestination(Vector2 returnPosition) { - float distanceFromTarget = projectile.Distance(returnPosition); + float distanceFromTarget = Projectile.Distance(returnPosition); if (distanceFromTarget > 7f) { float flySpeed = MathHelper.Lerp(2f, 17f, Utils.InverseLerp(10f, 70f, distanceFromTarget, true)); - projectile.velocity = (projectile.velocity * 9f + projectile.SafeDirectionTo(returnPosition) * flySpeed) / 10f; + Projectile.velocity = (Projectile.velocity * 9f + Projectile.SafeDirectionTo(returnPosition) * flySpeed) / 10f; } - int totalHeads = CalamityUtils.CountProjectiles(projectile.type); + int totalHeads = CalamityUtils.CountProjectiles(Projectile.type); int moveRate = 40 + totalHeads * 4; // Reset the ideal offset from time to time. @@ -180,15 +180,15 @@ namespace CalamityMod.Projectiles.Summon CurrentPositionOffset = Vector2.Lerp(CurrentPositionOffset, IdealPositionOffset, 0.125f); // Clamp the Y position. - if (projectile.Center.Y > Owner.Top.Y - 46f) - projectile.Center = new Vector2(projectile.Center.X, Owner.Top.Y - 46f); + if (Projectile.Center.Y > Owner.Top.Y - 46f) + Projectile.Center = new Vector2(Projectile.Center.X, Owner.Top.Y - 46f); // Clamp the center so that it does not go too far from the return position. - if (projectile.Distance(returnPosition) > 120f) - projectile.Center = returnPosition + projectile.DirectionFrom(returnPosition) * 120f; + if (Projectile.Distance(returnPosition) > 120f) + Projectile.Center = returnPosition + Projectile.DirectionFrom(returnPosition) * 120f; // Disallow heads from getting too close to each other. - projectile.MinionAntiClump(0.15f); + Projectile.MinionAntiClump(0.15f); } public void AdjustOldVelocityArray() @@ -196,7 +196,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = OldVelocities.Length - 1; i > 0; i--) OldVelocities[i] = OldVelocities[i - 1]; - OldVelocities[0] = projectile.velocity; + OldVelocities[0] = Projectile.velocity; } public override void Kill(int timeLeft) @@ -205,13 +205,13 @@ namespace CalamityMod.Projectiles.Summon return; for (int i = 0; i < 10; i++) - Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid, Main.rand.NextVector2CircularEdge(4f, 4f)).noGravity = true; + Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid, Main.rand.NextVector2CircularEdge(4f, 4f)).noGravity = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D chain = ModContent.GetTexture("CalamityMod/Projectiles/Summon/GammaHeadChain"); - Vector2 end = projectile.Center + (projectile.spriteDirection == 1).ToInt() * 10 * Vector2.UnitX; + Texture2D chain = ModContent.Request("CalamityMod/Projectiles/Summon/GammaHeadChain"); + Vector2 end = Projectile.Center + (Projectile.spriteDirection == 1).ToInt() * 10 * Vector2.UnitX; List controlPoints = new List { @@ -236,7 +236,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < chainPoints.Count; i++) { Vector2 positionAtPoint = chainPoints[i]; - if (Vector2.Distance(positionAtPoint, projectile.Center) < 10f) + if (Vector2.Distance(positionAtPoint, Projectile.Center) < 10f) continue; float angleAtPoint = i == chainPoints.Count - 1 ? (end - chainPoints[i]).ToRotation() : (chainPoints[i + 1] - chainPoints[i]).ToRotation(); angleAtPoint += MathHelper.PiOver2; @@ -251,15 +251,15 @@ namespace CalamityMod.Projectiles.Summon 0f); } - Texture2D headTexture = ModContent.GetTexture(Texture); + Texture2D headTexture = ModContent.Request(Texture); spriteBatch.Draw(headTexture, - projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, - headTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame), + Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, + headTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame), lightColor, - projectile.rotation, - projectile.Size * 0.5f, - projectile.scale, - projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, + Projectile.rotation, + Projectile.Size * 0.5f, + Projectile.scale, + Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); return false; diff --git a/Projectiles/Summon/GastricBelcher.cs b/Projectiles/Summon/GastricBelcher.cs index 3a16a6977f..4d475b77af 100644 --- a/Projectiles/Summon/GastricBelcher.cs +++ b/Projectiles/Summon/GastricBelcher.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -16,39 +17,39 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gastric Belcher"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 40; + Projectile.height = 40; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { //Set namespaces - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - CalamityGlobalProjectile modProj = projectile.Calamity(); + CalamityGlobalProjectile modProj = Projectile.Calamity(); //On spawn effects if (!initialized) { //Set constants modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; + modProj.spawnedPlayerMinionProjectileDamageValue = Projectile.damage; //Spawn dust int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) @@ -58,9 +59,9 @@ namespace CalamityMod.Projectiles.Summon 33, 89 }); - Vector2 direction = Vector2.Normalize(projectile.velocity) * new Vector2(projectile.width / 2f, projectile.height) * 0.75f; - direction = direction.RotatedBy((double)((dustIndex - (dustAmt / 2f - 1f)) * MathHelper.TwoPi / dustAmt), default) + projectile.Center; - Vector2 dustVel = direction - projectile.Center; + Vector2 direction = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; + direction = direction.RotatedBy((double)((dustIndex - (dustAmt / 2f - 1f)) * MathHelper.TwoPi / dustAmt), default) + Projectile.Center; + Vector2 dustVel = direction - Projectile.Center; int water = Dust.NewDust(direction + dustVel, 0, 0, randomDust, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); Main.dust[water].noGravity = true; Main.dust[water].velocity = dustVel; @@ -73,21 +74,21 @@ namespace CalamityMod.Projectiles.Summon { int damage2 = (int)(modProj.spawnedPlayerMinionProjectileDamageValue / modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } //Update frames - if (projectile.frameCounter++ % 6 == 0) + if (Projectile.frameCounter++ % 6 == 0) { - projectile.frame++; + Projectile.frame++; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } //Set up buff and timeLeft - bool typeCheck = projectile.type == ModContent.ProjectileType(); + bool typeCheck = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (typeCheck) { @@ -97,28 +98,28 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.gastricBelcher) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } //Anti sticky movement to prevent overlapping minions - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); //Find a target float maxDistance = 700f; - Vector2 targetVec = projectile.position; + Vector2 targetVec = Projectile.position; bool foundTarget = false; //If targeting something, prioritize that enemy if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); bool canHit = true; if (extraDist < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); if (!foundTarget && targetDist < (maxDistance + extraDist) && canHit) { maxDistance = targetDist; @@ -132,13 +133,13 @@ namespace CalamityMod.Projectiles.Summon for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { NPC npc = Main.npc[npcIndex]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); bool canHit = true; if (extraDist < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); if (!foundTarget && targetDist < (maxDistance + extraDist) && canHit) { maxDistance = targetDist; @@ -156,16 +157,16 @@ namespace CalamityMod.Projectiles.Summon //Max travel distance increases if targeting something returnDist = 2200f; } - if (Vector2.Distance(player.Center, projectile.Center) > returnDist) + if (Vector2.Distance(player.Center, Projectile.Center) > returnDist) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } //If a target is found, move toward it - if (foundTarget && projectile.ai[0] == 0f) + if (foundTarget && Projectile.ai[0] == 0f) { - Vector2 vecToTarget = targetVec - projectile.Center; + Vector2 vecToTarget = targetVec - Projectile.Center; float targetDist = vecToTarget.Length(); vecToTarget.Normalize(); //If farther than 200 pixels, move toward it @@ -173,14 +174,14 @@ namespace CalamityMod.Projectiles.Summon { float speedMult = (targetDist > 400f) ? 12f : (targetDist > 250) ? 6f : 3f; vecToTarget *= speedMult; - projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; } //Otherwise, back it up slowly else { float speedMult = -3f; vecToTarget *= speedMult; - projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; } } @@ -190,7 +191,7 @@ namespace CalamityMod.Projectiles.Summon bool returningToPlayer = false; if (!returningToPlayer) { - returningToPlayer = projectile.ai[0] == 1f; + returningToPlayer = Projectile.ai[0] == 1f; } //Move faster if actively returning to the player float speedMult = 10f; @@ -198,7 +199,7 @@ namespace CalamityMod.Projectiles.Summon { speedMult = 21f; } - Vector2 vecToPlayer = player.Center - projectile.Center + new Vector2(0f, -60f); + Vector2 vecToPlayer = player.Center - Projectile.Center + new Vector2(0f, -60f); float playerDist = vecToPlayer.Length(); //Slow down if near the player if (playerDist < 200f && speedMult > 8f) @@ -206,77 +207,77 @@ namespace CalamityMod.Projectiles.Summon speedMult = 1f; } //If close enough to the player, return to normal - if (playerDist < 150f && returningToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerDist < 150f && returningToPlayer && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } //If abnormally far, teleport to the player if (playerDist > 2000f) { - projectile.position.X = player.Center.X - (projectile.width / 2f); - projectile.position.Y = player.Center.Y - (projectile.height / 2f); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (Projectile.width / 2f); + Projectile.position.Y = player.Center.Y - (Projectile.height / 2f); + Projectile.netUpdate = true; } //Move toward player if more than 70 pixels away if (playerDist > 70f) { vecToPlayer.Normalize(); vecToPlayer *= speedMult; - projectile.velocity = (projectile.velocity * 40f + vecToPlayer) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vecToPlayer) / 41f; } //Move if still - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } } //Update sprite direction and rotation if (foundTarget) { - projectile.spriteDirection = projectile.direction = ((targetVec.X - projectile.Center.X) > 0).ToDirectionInt(); - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(targetVec) + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi), 0.1f); + Projectile.spriteDirection = Projectile.direction = ((targetVec.X - Projectile.Center.X) > 0).ToDirectionInt(); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(targetVec) + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi), 0.1f); } else { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } //Increment attack cooldown - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += Main.rand.Next(1, 4); + Projectile.ai[1] += Main.rand.Next(1, 4); } //Set the minion to be ready for attack - if (projectile.ai[1] > 90f) + if (Projectile.ai[1] > 90f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } //Return if on attack cooldown, has no target, or returning to the player - if (projectile.ai[0] != 0f || !foundTarget || projectile.ai[1] != 0f) + if (Projectile.ai[0] != 0f || !foundTarget || Projectile.ai[1] != 0f) return; - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { //Play vomit sound if (modPlayer.soundCooldown <= 0) { - Main.PlaySound(SoundID.NPCKilled, (int)projectile.Center.X, (int)projectile.Center.Y, 13, 0.5f, 0f); + SoundEngine.PlaySound(SoundID.NPCKilled, (int)Projectile.Center.X, (int)Projectile.Center.Y, 13, 0.5f, 0f); modPlayer.soundCooldown = Main.rand.Next(120, 180); } //Increment the attack counter - projectile.ai[1]++; + Projectile.ai[1]++; int projType = ModContent.ProjectileType(); //Calculate the general velocity - Vector2 velocity = targetVec - projectile.Center; + Vector2 velocity = targetVec - Projectile.Center; velocity.Normalize(); //Add some inaccuracy for the vomit projectiles @@ -286,7 +287,7 @@ namespace CalamityMod.Projectiles.Summon vomitVel.X += Main.rand.NextFloat(-30f, 30f) * 0.05f; //Fire the vomit projectile - Projectile.NewProjectile(projectile.Center, vomitVel, projType, projectile.damage, projectile.knockBack, projectile.owner, Main.rand.Next(3), 0f); + Projectile.NewProjectile(Projectile.Center, vomitVel, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, Main.rand.Next(3), 0f); //Fire 5 bubbles for every three attacks if (bubbleCounter++ % 3 == 2) @@ -299,11 +300,11 @@ namespace CalamityMod.Projectiles.Summon bubbleVel.Y += Main.rand.NextFloat(-50f, 50f) * 0.05f; bubbleVel.X += Main.rand.NextFloat(-50f, 50f) * 0.05f; - Projectile.NewProjectile(projectile.Center, bubbleVel, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, bubbleVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } - projectile.netUpdate = true; + Projectile.netUpdate = true; } } @@ -312,14 +313,14 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = frameHeight * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Summon/GastricBelcherBubble.cs b/Projectiles/Summon/GastricBelcherBubble.cs index cd61259846..6d676c4ea3 100644 --- a/Projectiles/Summon/GastricBelcherBubble.cs +++ b/Projectiles/Summon/GastricBelcherBubble.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class GastricBelcherBubble : ModProjectile @@ -9,29 +10,29 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gastric Bubble"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = projectile.height = 18; - projectile.minion = true; - projectile.timeLeft = 180; - projectile.aiStyle = 72; + Projectile.friendly = true; + Projectile.width = Projectile.height = 18; + Projectile.minion = true; + Projectile.timeLeft = 180; + Projectile.aiStyle = 72; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); - Vector2 center = projectile.Center; + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); + Vector2 center = Projectile.Center; for (int dustIndex = 0; dustIndex < 10; ++dustIndex) { - int scalar = (int)(10 * projectile.ai[1]); - int bubble = Dust.NewDust(projectile.Center - Vector2.One * scalar, scalar * 2, scalar * 2, 212, 0.0f, 0.0f, 0, new Color(), 1f); + int scalar = (int)(10 * Projectile.ai[1]); + int bubble = Dust.NewDust(Projectile.Center - Vector2.One * scalar, scalar * 2, scalar * 2, 212, 0.0f, 0.0f, 0, new Color(), 1f); Dust dust = Main.dust[bubble]; - Vector2 dustVec = Vector2.Normalize(dust.position - projectile.Center); - dust.position = projectile.Center + dustVec * scalar * projectile.scale; + Vector2 dustVec = Vector2.Normalize(dust.position - Projectile.Center); + dust.position = Projectile.Center + dustVec * scalar * Projectile.scale; dust.velocity = dustIndex >= 30 ? dustVec * Main.rand.Next(45, 91) / 10f : dustVec * dust.velocity.Length(); dust.color = Main.hslToRgb(0.4f + Main.rand.NextFloat() * 0.2f, 0.9f, 0.5f); dust.color = Color.Lerp(dust.color, Color.White, 0.3f); diff --git a/Projectiles/Summon/GastricBelcherVomit.cs b/Projectiles/Summon/GastricBelcherVomit.cs index d1d414ab32..b102f7b1cc 100644 --- a/Projectiles/Summon/GastricBelcherVomit.cs +++ b/Projectiles/Summon/GastricBelcherVomit.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class GastricBelcherVomit : ModProjectile @@ -10,39 +11,39 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gastric Vomit"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = projectile.height = 18; - projectile.minion = true; - projectile.timeLeft = 300; - projectile.penetrate = 3; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.friendly = true; + Projectile.width = Projectile.height = 18; + Projectile.minion = true; + Projectile.timeLeft = 300; + Projectile.penetrate = 3; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { //Rotation and gravity - projectile.rotation += 0.6f * projectile.direction; - projectile.velocity.Y += 0.27f; - if (projectile.velocity.Y > 16f) + Projectile.rotation += 0.6f * Projectile.direction; + Projectile.velocity.Y += 0.27f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y); //Dust effect int splash = 0; while (splash < 4) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 233, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.10f, 150, default, 0.9f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 233, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); splash += 1; } } @@ -50,16 +51,16 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D texture; - switch (projectile.ai[0]) + switch (Projectile.ai[0]) { - case 1f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/GastricBelcherVomit2"); + case 1f: texture = ModContent.Request("CalamityMod/Projectiles/Summon/GastricBelcherVomit2"); break; - case 2f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/GastricBelcherVomit3"); + case 2f: texture = ModContent.Request("CalamityMod/Projectiles/Summon/GastricBelcherVomit3"); break; - default: texture = Main.projectileTexture[projectile.type]; + default: texture = Main.projectileTexture[Projectile.type]; break; } - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Summon/GhostFire.cs b/Projectiles/Summon/GhostFire.cs index e3c86d6bda..7b706553d4 100644 --- a/Projectiles/Summon/GhostFire.cs +++ b/Projectiles/Summon/GhostFire.cs @@ -11,32 +11,32 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 80; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 50; - projectile.minion = true; - projectile.minionSlots = 0f; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 80; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 50; + Projectile.minion = true; + Projectile.minionSlots = 0f; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 6f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 6f) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * 0.25f; + Projectile.alpha = 255; int num448 = Dust.NewDust(vector33, 1, 1, 180, 0f, 0f, 0, default, 0.2f); Main.dust[num448].position = vector33; Main.dust[num448].noGravity = true; diff --git a/Projectiles/Summon/GhostlyMine.cs b/Projectiles/Summon/GhostlyMine.cs index 7305f3e90d..4e09047ff7 100644 --- a/Projectiles/Summon/GhostlyMine.cs +++ b/Projectiles/Summon/GhostlyMine.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -20,46 +21,46 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 900; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.minion = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 900; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (start) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.ai[1] = projectile.ai[0]; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.ai[1] = Projectile.ai[0]; start = false; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - double deg = (double)projectile.ai[1]; + double deg = (double)Projectile.ai[1]; double rad = deg * (Math.PI / 180); double dist = 550; - projectile.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - projectile.width / 2; - projectile.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - projectile.height / 2; - projectile.ai[1] += 1f; + Projectile.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - Projectile.width / 2; + Projectile.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - Projectile.height / 2; + Projectile.ai[1] += 1f; if (spawnDust) { for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -69,10 +70,10 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 15; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } spawnDust = false; @@ -81,9 +82,9 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -92,14 +93,14 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 160; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(SoundID.Item14, projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 160; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num621 = 0; num621 < 30; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -109,10 +110,10 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 60; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Summon/GiantIbanRobotOfDoom.cs b/Projectiles/Summon/GiantIbanRobotOfDoom.cs index 15730810f1..63f2d552e2 100644 --- a/Projectiles/Summon/GiantIbanRobotOfDoom.cs +++ b/Projectiles/Summon/GiantIbanRobotOfDoom.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using System; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -29,8 +30,8 @@ namespace CalamityMod.Projectiles.Summon } public float ClickCooldown { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public bool LeftBracketActive = false; public bool RightBracketActive = true; // This is supposed to be the default bracket, according to Iban. Ask him before changing this. @@ -56,26 +57,26 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Andromeda"); - ProjectileID.Sets.NeedsUUID[projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 152; - projectile.height = 212; - projectile.netImportant = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 18000; - projectile.timeLeft *= 5; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 11; + Projectile.width = 152; + Projectile.height = 212; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 18000; + Projectile.timeLeft *= 5; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 11; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; InitializeValues(player); HandleCooldowns(player); ManipulatePlayerValues(player); @@ -86,18 +87,18 @@ namespace CalamityMod.Projectiles.Summon } public void InitializeValues(Player player) { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } } public void HandleCooldowns(Player player) @@ -117,10 +118,10 @@ namespace CalamityMod.Projectiles.Summon if (!player.active || player.dead) { player.Calamity().andromedaState = AndromedaPlayerState.Inactive; - projectile.Kill(); + Projectile.Kill(); return; } - projectile.Center = player.Center + Vector2.UnitY * (6f + player.gfxOffY); + Projectile.Center = player.Center + Vector2.UnitY * (6f + player.gfxOffY); player.Calamity().andromedaState = LeftIconActive ? AndromedaPlayerState.SmallRobot : AndromedaPlayerState.LargeRobot; player.channel = false; if (RightIconCooldown > RightIconAttackTime) @@ -130,7 +131,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 4; i++) { Vector2 spinningPoint = new Vector2(0f, -28f).RotatedBy(RightIconCooldown / 60f * MathHelper.TwoPi) - .RotatedBy(projectile.velocity.ToRotation()) + .RotatedBy(Projectile.velocity.ToRotation()) .RotatedBy(MathHelper.Lerp(MathHelper.ToRadians(-40f), MathHelper.ToRadians(40f), i / 4f)); Vector2 center = player.Center + new Vector2(6f, -2f).RotatedBy(player.velocity.ToRotation()); @@ -152,11 +153,11 @@ namespace CalamityMod.Projectiles.Summon ExitChargeModeEarly(player); } - player.velocity = Vector2.Lerp(player.velocity, projectile.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * RightIconLungeSpeed, 0.225f); - projectile.rotation = player.velocity.ToRotation() + MathHelper.PiOver2; + player.velocity = Vector2.Lerp(player.velocity, Projectile.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * RightIconLungeSpeed, 0.225f); + Projectile.rotation = player.velocity.ToRotation() + MathHelper.PiOver2; } else - projectile.rotation = 0f; + Projectile.rotation = 0f; if (player.mount != null) // Kill any mounts { @@ -198,7 +199,7 @@ namespace CalamityMod.Projectiles.Summon 0, 0f, player.whoAmI); - ui.localAI[0] = Projectile.GetByUUID(projectile.owner, projectile.whoAmI); + ui.localAI[0] = Projectile.GetByUUID(Projectile.owner, Projectile.whoAmI); ui.netUpdate = true; } } @@ -210,7 +211,7 @@ namespace CalamityMod.Projectiles.Summon } public void SetFrames(Player player) { - projectile.frameCounter++; + Projectile.frameCounter++; if (RightIconCooldown <= RightIconAttackTime) { if (Math.Abs(player.velocity.Y) != 0f) @@ -238,14 +239,14 @@ namespace CalamityMod.Projectiles.Summon // Quickly go to flying frames if (CurrentFrame == 0) { - if (projectile.frameCounter >= 4) + if (Projectile.frameCounter >= 4) { CurrentFrame++; - projectile.frameCounter = 0; + Projectile.frameCounter = 0; } } // Flying frames - else if (projectile.frameCounter % 4 == 3) + else if (Projectile.frameCounter % 4 == 3) { CurrentFrame++; if (CurrentFrame >= 6) @@ -255,7 +256,7 @@ namespace CalamityMod.Projectiles.Summon // Dust effect Vector2 dustOffset = new Vector2(94f, 58f); - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { dustOffset.X = 214 - dustOffset.X; } @@ -263,8 +264,8 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 2; i++) { - Dust dust = Dust.NewDustPerfect(projectile.position + dustOffset, 263); - dust.velocity = Vector2.Normalize(dust.position - projectile.Top).RotatedByRandom(0.4f) * Main.rand.NextFloat(4f, 7f) + projectile.velocity; + Dust dust = Dust.NewDustPerfect(Projectile.position + dustOffset, 263); + dust.velocity = Vector2.Normalize(dust.position - Projectile.Top).RotatedByRandom(0.4f) * Main.rand.NextFloat(4f, 7f) + Projectile.velocity; dust.color = Color.SkyBlue; dust.scale = Main.rand.NextFloat(0.9f, 1.35f); dust.noGravity = true; @@ -277,15 +278,15 @@ namespace CalamityMod.Projectiles.Summon } public void SetWalkingFrames() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int walkInterval = (int)MathHelper.Clamp(8 - Math.Abs(player.velocity.X) / 3.5f, 1, 8); if (player.velocity.X == 0f) { CurrentFrame = 0; } - else if (projectile.frameCounter >= walkInterval) + else if (Projectile.frameCounter >= walkInterval) { - projectile.frameCounter = 0; + Projectile.frameCounter = 0; CurrentFrame++; if (CurrentFrame >= 13) { @@ -300,12 +301,12 @@ namespace CalamityMod.Projectiles.Summon { if (RightIconCooldown > RightIconAttackTime) { - projectile.spriteDirection = (Math.Cos(projectile.rotation) > 0).ToDirectionInt(); + Projectile.spriteDirection = (Math.Cos(Projectile.rotation) > 0).ToDirectionInt(); return; } if (player.velocity.X != 0) // So that the original sprite direction is maintained when there is no X movement. { - projectile.spriteDirection = (player.velocity.X > 0).ToDirectionInt(); + Projectile.spriteDirection = (player.velocity.X > 0).ToDirectionInt(); } int slashIndex = -1; @@ -313,7 +314,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && - Main.projectile[i].owner == projectile.owner) + Main.projectile[i].owner == Projectile.owner) { slashIndex = i; break; @@ -324,7 +325,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.projectile[slashIndex].frameCounter > 0) // To ensure that the starting variables of the blade have been initialized { - projectile.spriteDirection = (Math.Cos(Main.projectile[slashIndex].rotation) > 0).ToDirectionInt(); // ai[1] is the blade's starting rotation + Projectile.spriteDirection = (Math.Cos(Main.projectile[slashIndex].rotation) > 0).ToDirectionInt(); // ai[1] is the blade's starting rotation } } @@ -334,7 +335,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && - Main.projectile[i].owner == projectile.owner) + Main.projectile[i].owner == Projectile.owner) { laserBeamIndex = i; break; @@ -343,16 +344,16 @@ namespace CalamityMod.Projectiles.Summon if (laserBeamIndex != -1) { - projectile.spriteDirection = (Math.Cos(Main.projectile[laserBeamIndex].velocity.ToRotation()) > 0).ToDirectionInt(); // ai[1] is the blade's starting rotation + Projectile.spriteDirection = (Math.Cos(Main.projectile[laserBeamIndex].velocity.ToRotation()) > 0).ToDirectionInt(); // ai[1] is the blade's starting rotation } } public void FireLaserBeam(Player player) { if (LaserCooldown % (AndromedaDeathRay.TrueTimeLeft - 10) == (AndromedaDeathRay.TrueTimeLeft - 11)) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), Projectile.Center); int damage = LaserBaseDamage; if (player.HeldItem != null) { @@ -381,14 +382,14 @@ namespace CalamityMod.Projectiles.Summon damage = (int)(damage * player.AverageDamage()); } } - Vector2 laserVelocity = (Main.MouseWorld - (Main.player[projectile.owner].Center + new Vector2(projectile.spriteDirection == 1 ? 48f : 22f, -28f))).SafeNormalize(Vector2.UnitX * projectile.spriteDirection); - Projectile deathLaser = Projectile.NewProjectileDirect(projectile.Center, + Vector2 laserVelocity = (Main.MouseWorld - (Main.player[Projectile.owner].Center + new Vector2(Projectile.spriteDirection == 1 ? 48f : 22f, -28f))).SafeNormalize(Vector2.UnitX * Projectile.spriteDirection); + Projectile deathLaser = Projectile.NewProjectileDirect(Projectile.Center, laserVelocity, ModContent.ProjectileType(), damage, 8f, - projectile.owner, - projectile.whoAmI); + Projectile.owner, + Projectile.whoAmI); if (player.HeldItem != null && deathLaser.whoAmI.WithinBounds(Main.maxProjectiles)) { if (player.HeldItem.magic) @@ -422,7 +423,7 @@ namespace CalamityMod.Projectiles.Summon public void ExitChargeModeEarly(Player player) { RightIconCooldown = RightIconAttackTime; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), projectile.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), Projectile.Center); SpecialAttackExplosionDust(player); } public void SpecialAttackExplosionDust(Player player) @@ -437,13 +438,13 @@ namespace CalamityMod.Projectiles.Summon for (int speedSign = -1; speedSign <= 1; speedSign += 2) { float angle = MathHelper.Lerp(0f, MathHelper.TwoPi / 10f, (outwardness - 190f) / 170f); - Dust dust = Dust.NewDustPerfect(projectile.Center, 221); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 221); dust.noGravity = true; dust.scale = 1.6f; dust.position = player.Center + outwardness * (MathHelper.TwoPi / 10f * angleInterval).ToRotationVector2().RotatedBy(angle); dust.velocity = player.SafeDirectionTo(dust.position) * 8f * speedSign; - dust = Dust.NewDustPerfect(projectile.Center, 221); + dust = Dust.NewDustPerfect(Projectile.Center, 221); dust.noGravity = true; dust.scale = 1.6f; dust.position = player.Center + outwardness * (MathHelper.TwoPi / 10f * angleInterval).ToRotationVector2().RotatedBy(-angle); @@ -480,7 +481,7 @@ namespace CalamityMod.Projectiles.Summon public override bool CanDamage() => false; public override void Kill(int timeLeft) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; player.width = 20; player.height = 42; } diff --git a/Projectiles/Summon/HallowedStarSummon.cs b/Projectiles/Summon/HallowedStarSummon.cs index c4a78e6523..2a0a36011a 100644 --- a/Projectiles/Summon/HallowedStarSummon.cs +++ b/Projectiles/Summon/HallowedStarSummon.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -16,21 +17,21 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Star"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.alpha = 50; - projectile.penetrate = 1; - projectile.tileCollide = false; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.alpha = 50; + Projectile.penetrate = 1; + Projectile.tileCollide = false; } public override void AI() @@ -39,43 +40,43 @@ namespace CalamityMod.Projectiles.Summon noTileHitCounter -= randomToSubtract; if (noTileHitCounter == 0) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item9, projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.position); } } - projectile.alpha -= 15; + Projectile.alpha -= 15; int alphaMin = 150; - if (projectile.Center.Y >= projectile.ai[1]) + if (Projectile.Center.Y >= Projectile.ai[1]) { alphaMin = 0; } - if (projectile.alpha < alphaMin) + if (Projectile.alpha < alphaMin) { - projectile.alpha = alphaMin; + Projectile.alpha = alphaMin; } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * projectile.direction; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; if (Main.rand.NextBool(48)) { - int idx = Gore.NewGore(projectile.Center, projectile.velocity * 0.2f, 16, 1f); + int idx = Gore.NewGore(Projectile.Center, Projectile.velocity * 0.2f, 16, 1f); Main.gore[idx].velocity *= 0.66f; - Main.gore[idx].velocity += projectile.velocity * 0.3f; + Main.gore[idx].velocity += Projectile.velocity * 0.3f; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.light = 0.9f; + Projectile.light = 0.9f; if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType(), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20)) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } } @@ -87,24 +88,24 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - return new Color(200, 45, 250, projectile.alpha); + return new Color(200, 45, 250, Projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - projectile.position += projectile.Size; - projectile.width = 50; - projectile.height = 50; - projectile.position -= projectile.Size; + Projectile.position += Projectile.Size; + Projectile.width = 50; + Projectile.height = 50; + Projectile.position -= Projectile.Size; for (int i = 0; i < 5; i++) { - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, 16, 0f, 0f, 100, default, 1.2f); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 16, 0f, 0f, 100, default, 1.2f); Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -114,7 +115,7 @@ namespace CalamityMod.Projectiles.Summon } for (int i = 0; i < 3; i++) { - Gore.NewGore(projectile.position, projectile.velocity * 0.05f, Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, Projectile.velocity * 0.05f, Main.rand.Next(16, 18), 1f); } } } diff --git a/Projectiles/Summon/HauntedDishes.cs b/Projectiles/Summon/HauntedDishes.cs index 518a44adea..838c85fed3 100644 --- a/Projectiles/Summon/HauntedDishes.cs +++ b/Projectiles/Summon/HauntedDishes.cs @@ -15,41 +15,41 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("HauntedDishes"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - Main.projFrames[projectile.type] = 19; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Projectile.type] = 19; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 40; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 40; + Projectile.height = 40; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - CalamityGlobalProjectile modProj = projectile.Calamity(); + CalamityGlobalProjectile modProj = Projectile.Calamity(); if (dust == 0f) { modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; + modProj.spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int num227 = 0; num227 < dustAmt; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int dusty = Dust.NewDust(vector6 + vector7, 0, 0, 7, vector7.X * 1.1f, vector7.Y * 1.1f, 100, default, 1.4f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; @@ -61,9 +61,9 @@ namespace CalamityMod.Projectiles.Summon { int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool projTypeCheck = projectile.type == ModContent.ProjectileType(); + bool projTypeCheck = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (projTypeCheck) { @@ -73,63 +73,63 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.hauntedDishes) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } bool flag1 = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; - int num1 = 60 + 30 * projectile.minionPos; - if (projectile.lavaWet) + int num1 = 60 + 30 * Projectile.minionPos; + if (Projectile.lavaWet) { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; + Projectile.ai[0] = 1f; + Projectile.ai[1] = 0f; } int num2 = 10; - int num3 = 40 * (projectile.minionPos + 1) * player.direction; - if (player.position.X + (float) (player.width / 2) < projectile.position.X + (float) (projectile.width / 2) - (float) num2 + (float) num3) + int num3 = 40 * (Projectile.minionPos + 1) * player.direction; + if (player.position.X + (float) (player.width / 2) < Projectile.position.X + (float) (Projectile.width / 2) - (float) num2 + (float) num3) flag1 = true; - else if (player.position.X + (float) (player.width / 2) > projectile.position.X + (float) (projectile.width / 2) + (float) num2 + (float) num3) + else if (player.position.X + (float) (player.width / 2) > Projectile.position.X + (float) (Projectile.width / 2) + (float) num2 + (float) num3) flag2 = true; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { int conflict1 = 500; - conflict1 += 40 * projectile.minionPos; - if (projectile.localAI[0] > 0f) + conflict1 += 40 * Projectile.minionPos; + if (Projectile.localAI[0] > 0f) conflict1 += 500; - Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); + Vector2 vector2 = new Vector2(Projectile.position.X + (float) Projectile.width * 0.5f, Projectile.position.Y + (float) Projectile.height * 0.5f); float playerX = player.position.X + (float) (player.width / 2) - vector2.X; float playerY = player.position.Y + (float) (player.height / 2) - vector2.Y; float playerDist = (float)Math.Sqrt(playerX * playerX + playerY * playerY); if (playerDist > 1500f) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } if (playerDist > 2000f) //teleport to player if too far { - projectile.position.X = player.position.X + (float) (player.width / 2) - (float) (projectile.width / 2); - projectile.position.Y = player.position.Y + (float) (player.height / 2) - (float) (projectile.height / 2); + Projectile.position.X = player.position.X + (float) (player.width / 2) - (float) (Projectile.width / 2); + Projectile.position.Y = player.position.Y + (float) (player.height / 2) - (float) (Projectile.height / 2); } } - if (projectile.ai[0] != 0f) //flying back to the player + if (Projectile.ai[0] != 0f) //flying back to the player { - projectile.tileCollide = false; + Projectile.tileCollide = false; float npcDetectRange = 1200f; bool npcFound = false; int num6 = -1; for (int index = 0; index < Main.maxNPCs; ++index) { NPC npc2 = Main.npc[index]; - if (npc2.CanBeChasedBy((object) projectile, false)) + if (npc2.CanBeChasedBy((object) Projectile, false)) { float npcX = npc2.position.X + (float) (npc2.width / 2); float npcY = npc2.position.Y + (float) (npc2.height / 2); float npcDist = (float) Math.Abs(player.position.X + (float) (player.width / 2) - npcX) + (float) Math.Abs(player.position.Y + (float) (player.height / 2) - npcY); if (npcDist < npcDetectRange) { - if (Collision.CanHit(projectile.position, projectile.width, projectile.height, npc2.position, npc2.width, npc2.height)) + if (Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc2.position, npc2.width, npc2.height)) num6 = index; npcFound = true; break; @@ -139,13 +139,13 @@ namespace CalamityMod.Projectiles.Summon //return to normal if npc found if (npcFound && num6 >= 0) - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; - Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); + Vector2 vector2 = new Vector2(Projectile.position.X + (float) Projectile.width * 0.5f, Projectile.position.Y + (float) Projectile.height * 0.5f); float xDist = player.position.X + (float) (player.width / 2) - vector2.X; xDist -= (float) (40 * player.direction); if (!npcFound) - xDist -= (float) (40 * projectile.minionPos * player.direction); + xDist -= (float) (40 * Projectile.minionPos * player.direction); float yDist = player.position.Y + (float) (player.height / 2) - vector2.Y; yDist -= 60f; float playerDist2 = (float) Math.Sqrt(xDist * xDist + yDist * yDist); @@ -156,23 +156,23 @@ namespace CalamityMod.Projectiles.Summon num11 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); //if close enough to the player and has tile to stand on, return to normal - if (playerDist2 < 100f && player.velocity.Y == 0f && (projectile.position.Y + (float) projectile.height <= player.position.Y + (float) player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height))) + if (playerDist2 < 100f && player.velocity.Y == 0f && (Projectile.position.Y + (float) Projectile.height <= player.position.Y + (float) player.height && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height))) { - projectile.ai[0] = 0f; - if (projectile.velocity.Y < -6f) - projectile.velocity.Y = -6f; + Projectile.ai[0] = 0f; + if (Projectile.velocity.Y < -6f) + Projectile.velocity.Y = -6f; } if (playerDist2 > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (playerDist2 < 50f) { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f) { - projectile.velocity *= 0.99f; + Projectile.velocity *= 0.99f; } conflict2 = 0.01f; } @@ -190,86 +190,86 @@ namespace CalamityMod.Projectiles.Summon xDist *= playerDist2; yDist *= playerDist2; } - if (projectile.velocity.X < xDist) + if (Projectile.velocity.X < xDist) { - projectile.velocity.X = projectile.velocity.X + conflict2; - if (conflict2 > 0.05f && projectile.velocity.X < 0f) + Projectile.velocity.X = Projectile.velocity.X + conflict2; + if (conflict2 > 0.05f && Projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + conflict2; + Projectile.velocity.X = Projectile.velocity.X + conflict2; } } - if (projectile.velocity.X > xDist) + if (Projectile.velocity.X > xDist) { - projectile.velocity.X = projectile.velocity.X - conflict2; - if (conflict2 > 0.05f && projectile.velocity.X > 0f) + Projectile.velocity.X = Projectile.velocity.X - conflict2; + if (conflict2 > 0.05f && Projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - conflict2; + Projectile.velocity.X = Projectile.velocity.X - conflict2; } } - if (projectile.velocity.Y < yDist) + if (Projectile.velocity.Y < yDist) { - projectile.velocity.Y = projectile.velocity.Y + conflict2; - if (conflict2> 0.05f && projectile.velocity.Y < 0f) + Projectile.velocity.Y = Projectile.velocity.Y + conflict2; + if (conflict2> 0.05f && Projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + conflict2 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + conflict2 * 2f; } } - if (projectile.velocity.Y > yDist) + if (Projectile.velocity.Y > yDist) { - projectile.velocity.Y = projectile.velocity.Y - conflict2; - if (conflict2 > 0.05f && projectile.velocity.Y > 0f) + Projectile.velocity.Y = Projectile.velocity.Y - conflict2; + if (conflict2 > 0.05f && Projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - conflict2 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - conflict2 * 2f; } } - if (projectile.frame < 15) + if (Projectile.frame < 15) { - projectile.frame = 15; + Projectile.frame = 15; } else { - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 19) + if (Projectile.frame >= 19) { - projectile.frame = 15; + Projectile.frame = 15; } } - if (projectile.velocity.X > 0.5f) - projectile.spriteDirection = 1; - else if (projectile.velocity.X < -0.5f) - projectile.spriteDirection = -1; - projectile.rotation = projectile.spriteDirection != 1 ? (float) Math.Atan2((double) projectile.velocity.Y, (double) projectile.velocity.X) + 3.14f : (float) Math.Atan2((double) projectile.velocity.Y, (double) projectile.velocity.X); + if (Projectile.velocity.X > 0.5f) + Projectile.spriteDirection = 1; + else if (Projectile.velocity.X < -0.5f) + Projectile.spriteDirection = -1; + Projectile.rotation = Projectile.spriteDirection != 1 ? (float) Math.Atan2((double) Projectile.velocity.Y, (double) Projectile.velocity.X) + 3.14f : (float) Math.Atan2((double) Projectile.velocity.Y, (double) Projectile.velocity.X); } else { - float conflict3 = (float) (40 * projectile.minionPos); + float conflict3 = (float) (40 * Projectile.minionPos); float attackCooldown = 30f; int num4 = 60; - --projectile.localAI[0]; - if (projectile.localAI[0] < 0f) - projectile.localAI[0] = 0f; - if (projectile.ai[1] > 0f) + --Projectile.localAI[0]; + if (Projectile.localAI[0] < 0f) + Projectile.localAI[0] = 0f; + if (Projectile.ai[1] > 0f) { - --projectile.ai[1]; + --Projectile.ai[1]; } else { - float num5 = projectile.position.X; - float num6 = projectile.position.Y; + float num5 = Projectile.position.X; + float num6 = Projectile.position.Y; float num7 = 100000f; float num8 = num7; int num9 = -1; - NPC minionAttackTargetNpc = projectile.OwnerMinionAttackTargetNPC; - if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) projectile, false)) + NPC minionAttackTargetNpc = Projectile.OwnerMinionAttackTargetNPC; + if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) Projectile, false)) { float num10 = minionAttackTargetNpc.position.X + (float) (minionAttackTargetNpc.width / 2); float num11 = minionAttackTargetNpc.position.Y + (float) (minionAttackTargetNpc.height / 2); - float num12 = Math.Abs(projectile.position.X + (float) (projectile.width / 2) - num10) + Math.Abs(projectile.position.Y + (float) (projectile.height / 2) - num11); + float num12 = Math.Abs(Projectile.position.X + (float) (Projectile.width / 2) - num10) + Math.Abs(Projectile.position.Y + (float) (Projectile.height / 2) - num11); if (num12 < num7) { if (num9 == -1 && num12 <= num8) @@ -278,7 +278,7 @@ namespace CalamityMod.Projectiles.Summon num5 = num10; num6 = num11; } - if (Collision.CanHit(projectile.position, projectile.width, projectile.height, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height)) + if (Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height)) { num7 = num12; num5 = num10; @@ -291,11 +291,11 @@ namespace CalamityMod.Projectiles.Summon { for (int index = 0; index < Main.maxNPCs; ++index) { - if (Main.npc[index].CanBeChasedBy((object) projectile, false)) + if (Main.npc[index].CanBeChasedBy((object) Projectile, false)) { float num10 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2); float num11 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2); - float num12 = Math.Abs(projectile.position.X + (float) (projectile.width / 2) - num10) + Math.Abs(projectile.position.Y + (float) (projectile.height / 2) - num11); + float num12 = Math.Abs(Projectile.position.X + (float) (Projectile.width / 2) - num10) + Math.Abs(Projectile.position.Y + (float) (Projectile.height / 2) - num11); if (num12 < num7) { if (num9 == -1 && num12 <= num8) @@ -304,7 +304,7 @@ namespace CalamityMod.Projectiles.Summon num5 = num10; num6 = num11; } - if (Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height)) + if (Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height)) { num7 = num12; num5 = num10; @@ -318,11 +318,11 @@ namespace CalamityMod.Projectiles.Summon if (num9 == -1 && num8 < num7) num7 = num8; float num13 = 400f; - if ((double) projectile.position.Y > Main.worldSurface * 16.0) + if ((double) Projectile.position.Y > Main.worldSurface * 16.0) num13 = 200f; if (num7 < num13 + conflict3 && num9 == -1) { - float num10 = num5 - (projectile.position.X + (float) (projectile.width / 2)); + float num10 = num5 - (Projectile.position.X + (float) (Projectile.width / 2)); if (num10 < -5f) { flag1 = true; @@ -336,8 +336,8 @@ namespace CalamityMod.Projectiles.Summon } else if (num9 >= 0 && num7 < 800f + conflict3) { - projectile.localAI[0] = (float) num4; - float num10 = num5 - (projectile.position.X + (float) (projectile.width / 2)); + Projectile.localAI[0] = (float) num4; + float num10 = num5 - (Projectile.position.X + (float) (Projectile.width / 2)); if (num10 > 300f || num10 < -300f) { if (num10 < -50f) @@ -351,11 +351,11 @@ namespace CalamityMod.Projectiles.Summon flag1 = false; } } - else if (projectile.owner == Main.myPlayer) + else if (Projectile.owner == Main.myPlayer) { - projectile.ai[1] = attackCooldown; + Projectile.ai[1] = attackCooldown; double num11 = 12.0; - Vector2 vector2 = new Vector2(projectile.Center.X, projectile.Center.Y - 8f); + Vector2 vector2 = new Vector2(Projectile.Center.X, Projectile.Center.Y - 8f); float num12 = num5 - vector2.X + Main.rand.NextFloat(-6f, 6f); float num14 = (float) ((double) (Math.Abs(num12) * 0.1f) * (double) Main.rand.Next(0, 100) * (1.0 / 1000.0)); float num15 = num6 - vector2.Y + Main.rand.NextFloat(-6f, 6f) - num14; @@ -363,29 +363,29 @@ namespace CalamityMod.Projectiles.Summon float num17 = (float) (num11 / num16); float SpeedX = num12 * num17; float SpeedY = num15 * num17; - int damage = projectile.damage; + int damage = Projectile.damage; int Type = ModContent.ProjectileType(); - int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX * 2f, SpeedY * 2f, Type, damage, projectile.knockBack, projectile.owner, 0f, 0f); + int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX * 2f, SpeedY * 2f, Type, damage, Projectile.knockBack, Projectile.owner, 0f, 0f); if (SpeedX < 0f) - projectile.direction = -1; + Projectile.direction = -1; if (SpeedX > 0f) - projectile.direction = 1; - projectile.netUpdate = true; + Projectile.direction = 1; + Projectile.netUpdate = true; } } } Vector2 vector2_1 = Vector2.Zero; bool flag7 = false; - if (projectile.ai[1] != 0f) + if (Projectile.ai[1] != 0f) { flag1 = false; flag2 = false; } - else if (projectile.localAI[0] == 0f) - projectile.direction = player.direction; + else if (Projectile.localAI[0] == 0f) + Projectile.direction = player.direction; if (!flag7) - projectile.rotation = 0f; - projectile.tileCollide = true; + Projectile.rotation = 0f; + Projectile.tileCollide = true; float num18 = 0.08f; float num19 = 6.5f; num19 = 6f; @@ -397,44 +397,44 @@ namespace CalamityMod.Projectiles.Summon } if (flag1) { - if (projectile.velocity.X > -3.5f) - projectile.velocity.X -= num18; + if (Projectile.velocity.X > -3.5f) + Projectile.velocity.X -= num18; else - projectile.velocity.X -= num18 * 0.25f; + Projectile.velocity.X -= num18 * 0.25f; } else if (flag2) { - if (projectile.velocity.X < 3.5f) - projectile.velocity.X += num18; + if (Projectile.velocity.X < 3.5f) + Projectile.velocity.X += num18; else - projectile.velocity.X += num18 * 0.25f; + Projectile.velocity.X += num18 * 0.25f; } else { - projectile.velocity.X *= 0.9f; - if (projectile.velocity.X >= -num18 && projectile.velocity.X <= num18) - projectile.velocity.X = 0f; + Projectile.velocity.X *= 0.9f; + if (Projectile.velocity.X >= -num18 && Projectile.velocity.X <= num18) + Projectile.velocity.X = 0f; } if (flag1 | flag2) { - int conflict4 = (int) ((double) projectile.position.X + (double) (projectile.width / 2)) / 16; - int j = (int) ((double) projectile.position.Y + (double) (projectile.height / 2)) / 16; + int conflict4 = (int) ((double) Projectile.position.X + (double) (Projectile.width / 2)) / 16; + int j = (int) ((double) Projectile.position.Y + (double) (Projectile.height / 2)) / 16; if (flag1) --conflict4; if (flag2) ++conflict4; - if (WorldGen.SolidTile(conflict4 + (int) projectile.velocity.X, j)) + if (WorldGen.SolidTile(conflict4 + (int) Projectile.velocity.X, j)) flag4 = true; } - if (player.position.Y + player.height - 8f > projectile.position.Y + projectile.height) + if (player.position.Y + player.height - 8f > Projectile.position.Y + Projectile.height) flag3 = true; - Collision.StepUp(ref projectile.position, ref projectile.velocity, projectile.width, projectile.height, ref projectile.stepSpeed, ref projectile.gfxOffY, 1, false, 0); - if (projectile.velocity.Y == 0f) + Collision.StepUp(ref Projectile.position, ref Projectile.velocity, Projectile.width, Projectile.height, ref Projectile.stepSpeed, ref Projectile.gfxOffY, 1, false, 0); + if (Projectile.velocity.Y == 0f) { - if (!flag3 && ((double) projectile.velocity.X < 0.0 || (double) projectile.velocity.X > 0.0)) + if (!flag3 && ((double) Projectile.velocity.X < 0.0 || (double) Projectile.velocity.X > 0.0)) { - int i = (int) ((double) projectile.position.X + (double) (projectile.width / 2)) / 16; - int j = (int) ((double) projectile.position.Y + (double) (projectile.height / 2)) / 16 + 1; + int i = (int) ((double) Projectile.position.X + (double) (Projectile.width / 2)) / 16; + int j = (int) ((double) Projectile.position.Y + (double) (Projectile.height / 2)) / 16 + 1; if (flag1) --i; if (flag2) @@ -443,139 +443,139 @@ namespace CalamityMod.Projectiles.Summon } if (flag4) { - int i1 = (int) ((double) projectile.position.X + (double) (projectile.width / 2)) / 16; - int j = (int) ((double) projectile.position.Y + (double) projectile.height) / 16 + 1; - if (WorldGen.SolidTile(i1, j) || Main.tile[i1, j].halfBrick() || ((int) Main.tile[i1, j].slope() > 0 || projectile.type == 200)) + int i1 = (int) ((double) Projectile.position.X + (double) (Projectile.width / 2)) / 16; + int j = (int) ((double) Projectile.position.Y + (double) Projectile.height) / 16 + 1; + if (WorldGen.SolidTile(i1, j) || Main.tile[i1, j].halfBrick() || ((int) Main.tile[i1, j].slope() > 0 || Projectile.type == 200)) { - if (projectile.type == 200) + if (Projectile.type == 200) { - projectile.velocity.Y = -3.1f; + Projectile.velocity.Y = -3.1f; } else { try { - int conflict5 = (int) ((double) projectile.position.X + (double) (projectile.width / 2)) / 16; - int conflict7 = (int) ((double) projectile.position.Y + (double) (projectile.height / 2)) / 16; + int conflict5 = (int) ((double) Projectile.position.X + (double) (Projectile.width / 2)) / 16; + int conflict7 = (int) ((double) Projectile.position.Y + (double) (Projectile.height / 2)) / 16; if (flag1) --conflict5; if (flag2) ++conflict5; - int i2 = conflict5 + (int) projectile.velocity.X; + int i2 = conflict5 + (int) Projectile.velocity.X; if (!WorldGen.SolidTile(i2, conflict7 - 1) && !WorldGen.SolidTile(i2, conflict7 - 2)) - projectile.velocity.Y = -5.1f; + Projectile.velocity.Y = -5.1f; else if (!WorldGen.SolidTile(i2, conflict7 - 2)) - projectile.velocity.Y = -7.1f; + Projectile.velocity.Y = -7.1f; else if (WorldGen.SolidTile(i2, conflict7 - 5)) - projectile.velocity.Y = -11.1f; + Projectile.velocity.Y = -11.1f; else if (WorldGen.SolidTile(i2, conflict7 - 4)) - projectile.velocity.Y = -10.1f; + Projectile.velocity.Y = -10.1f; else - projectile.velocity.Y = -9.1f; + Projectile.velocity.Y = -9.1f; } catch { - projectile.velocity.Y = -9.1f; + Projectile.velocity.Y = -9.1f; } } } } - else if (projectile.type == 266 && flag1 | flag2) - projectile.velocity.Y -= 6f; + else if (Projectile.type == 266 && flag1 | flag2) + Projectile.velocity.Y -= 6f; } - if (projectile.velocity.X > num19) - projectile.velocity.X = num19; - if (projectile.velocity.X < -num19) - projectile.velocity.X = -num19; - if (projectile.velocity.X < 0f) - projectile.direction = -1; - if (projectile.velocity.X > 0f) - projectile.direction = 1; - if (projectile.velocity.X > num18 & flag2) - projectile.direction = 1; - if (projectile.velocity.X < -num18 & flag1) - projectile.direction = -1; - if (projectile.direction == -1) - projectile.spriteDirection = -1; - if (projectile.direction == 1) - projectile.spriteDirection = 1; - if (projectile.ai[1] > 0f) + if (Projectile.velocity.X > num19) + Projectile.velocity.X = num19; + if (Projectile.velocity.X < -num19) + Projectile.velocity.X = -num19; + if (Projectile.velocity.X < 0f) + Projectile.direction = -1; + if (Projectile.velocity.X > 0f) + Projectile.direction = 1; + if (Projectile.velocity.X > num18 & flag2) + Projectile.direction = 1; + if (Projectile.velocity.X < -num18 & flag1) + Projectile.direction = -1; + if (Projectile.direction == -1) + Projectile.spriteDirection = -1; + if (Projectile.direction == 1) + Projectile.spriteDirection = 1; + if (Projectile.ai[1] > 0f) { - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - projectile.localAI[1] = 1f; - projectile.frame = 9; + Projectile.localAI[1] = 1f; + Projectile.frame = 9; } - if (projectile.frame >= 9 && projectile.frame <= 14) + if (Projectile.frame >= 9 && Projectile.frame <= 14) { - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame == 14) - projectile.frame = 9; + if (Projectile.frame == 14) + Projectile.frame = 9; } } - else if (projectile.velocity.Y == 0f) + else if (Projectile.velocity.Y == 0f) { - projectile.localAI[1] = 0f; - if (projectile.velocity.X == 0f) + Projectile.localAI[1] = 0f; + if (Projectile.velocity.X == 0f) { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 3) + if (Projectile.frame >= 3) { - projectile.frame = 0; + Projectile.frame = 0; } } - else if (projectile.velocity.X < -0.8f || projectile.velocity.X > 0.8f) + else if (Projectile.velocity.X < -0.8f || Projectile.velocity.X > 0.8f) { - projectile.frameCounter = projectile.frameCounter + (int) Math.Abs(projectile.velocity.X); - projectile.frameCounter++; - if (projectile.frameCounter > 20) + Projectile.frameCounter = Projectile.frameCounter + (int) Math.Abs(Projectile.velocity.X); + Projectile.frameCounter++; + if (Projectile.frameCounter > 20) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame < 4) - projectile.frame = 3; - if (projectile.frame >= 9) - projectile.frame = 3; + if (Projectile.frame < 4) + Projectile.frame = 3; + if (Projectile.frame >= 9) + Projectile.frame = 3; } else { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 3) + if (Projectile.frame >= 3) { - projectile.frame = 0; + Projectile.frame = 0; } } } - else if (projectile.velocity.Y < 0f) + else if (Projectile.velocity.Y < 0f) { - projectile.frameCounter = 0; - projectile.frame = 3; + Projectile.frameCounter = 0; + Projectile.frame = 3; } - else if (projectile.velocity.Y > 0f) + else if (Projectile.velocity.Y > 0f) { - projectile.frameCounter = 0; - projectile.frame = 3; + Projectile.frameCounter = 0; + Projectile.frame = 3; } - projectile.velocity.Y += 0.4f; - if (projectile.velocity.Y > 10f) - projectile.velocity.Y = 10f; - Vector2 velocity = projectile.velocity; + Projectile.velocity.Y += 0.4f; + if (Projectile.velocity.Y > 10f) + Projectile.velocity.Y = 10f; + Vector2 velocity = Projectile.velocity; } } @@ -594,7 +594,7 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - int index = Gore.NewGore(new Vector2(projectile.position.X - (float) (projectile.width / 2), projectile.position.Y - (float) (projectile.height / 2)), new Vector2(0.0f, 0.0f), Main.rand.Next(61, 64), projectile.scale); + int index = Gore.NewGore(new Vector2(Projectile.position.X - (float) (Projectile.width / 2), Projectile.position.Y - (float) (Projectile.height / 2)), new Vector2(0.0f, 0.0f), Main.rand.Next(61, 64), Projectile.scale); Main.gore[index].velocity *= 0.1f; } } diff --git a/Projectiles/Summon/HermitCrabMinion.cs b/Projectiles/Summon/HermitCrabMinion.cs index e1191f4b32..079d32036b 100644 --- a/Projectiles/Summon/HermitCrabMinion.cs +++ b/Projectiles/Summon/HermitCrabMinion.cs @@ -15,24 +15,24 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Hermit Crab"); - Main.projFrames[projectile.type] = 9; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 9; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 38; - projectile.height = 36; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 38; + Projectile.height = 36; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 1; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) @@ -43,29 +43,29 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (spawnDust) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 20; for (int num502 = 0; num502 < num501; num502++) { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 33, 0f, 0f, 0, default, 1f); + int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 33, 0f, 0f, 0, default, 1f); Main.dust[num503].velocity *= 2f; Main.dust[num503].scale *= 1.15f; } spawnDust = false; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -75,36 +75,36 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.hCrab) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - Vector2 vector46 = projectile.position; + Vector2 vector46 = Projectile.position; if (!fly) { - Vector2 center2 = projectile.Center; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); - if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 205f && projectile.position.X == projectile.oldPosition.X))) + if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 205f && Projectile.position.X == Projectile.oldPosition.X))) { - projectile.velocity.Y = -10f; + Projectile.velocity.Y = -10f; } - projectile.velocity.Y += 0.6f; - if (projectile.velocity.X != 0f) + Projectile.velocity.Y += 0.6f; + if (Projectile.velocity.X != 0f) { - projectile.frameCounter++; + Projectile.frameCounter++; } else { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.frameCounter > 4) + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 5) + if (Projectile.frame >= 5) { - projectile.frame = 1; + Projectile.frame = 1; } float num633 = 600f; bool chaseNPC = false; @@ -112,9 +112,9 @@ namespace CalamityMod.Projectiles.Summon if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, projectile.Center); + float num646 = Vector2.Distance(npc.Center, Projectile.Center); if (!chaseNPC && num646 < num633) { num633 = num646; @@ -129,9 +129,9 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC npcTarget = Main.npc[num645]; - if (npcTarget.CanBeChasedBy(projectile, false)) + if (npcTarget.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npcTarget.Center, projectile.Center); + float num646 = Vector2.Distance(npcTarget.Center, Projectile.Center); if (!chaseNPC && num646 < num633) { num633 = num646; @@ -144,23 +144,23 @@ namespace CalamityMod.Projectiles.Summon } if (chaseNPC) { - if (npcPositionX - projectile.position.X > 0f) + if (npcPositionX - Projectile.position.X > 0f) { switch (Main.rand.Next(1, 2)) { case 1: - projectile.velocity.X += 0.10f; + Projectile.velocity.X += 0.10f; break; case 2: - projectile.velocity.X += 0.15f; + Projectile.velocity.X += 0.15f; break; } - if (projectile.velocity.X > 9f) + if (Projectile.velocity.X > 9f) { - projectile.velocity.X = 9f; + Projectile.velocity.X = 9f; } } else @@ -169,26 +169,26 @@ namespace CalamityMod.Projectiles.Summon { case 1: - projectile.velocity.X -= 0.10f; + Projectile.velocity.X -= 0.10f; break; case 2: - projectile.velocity.X -= 0.15f; + Projectile.velocity.X -= 0.15f; break; } - if (projectile.velocity.X < -9f) + if (Projectile.velocity.X < -9f) { - projectile.velocity.X = -9f; + Projectile.velocity.X = -9f; } } if (playerDistance > 1000f) { fly = true; chaseNPC = false; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - projectile.tileCollide = false; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 0f; + Projectile.tileCollide = false; } } else @@ -196,32 +196,32 @@ namespace CalamityMod.Projectiles.Summon if (playerDistance > 600f) { fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - projectile.tileCollide = false; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 0f; + Projectile.tileCollide = false; } if (playerDistance > 200f) { - if (player.position.X - projectile.position.X > 0f) + if (player.position.X - Projectile.position.X > 0f) { switch (Main.rand.Next(1, 3)) { case 1: - projectile.velocity.X += 0.05f; + Projectile.velocity.X += 0.05f; break; case 2: - projectile.velocity.X += 0.10f; + Projectile.velocity.X += 0.10f; break; case 3: - projectile.velocity.X += 0.15f; + Projectile.velocity.X += 0.15f; break; } - if (projectile.velocity.X > 9f) + if (Projectile.velocity.X > 9f) { - projectile.velocity.X = 9f; + Projectile.velocity.X = 9f; } } else @@ -229,65 +229,65 @@ namespace CalamityMod.Projectiles.Summon switch (Main.rand.Next(1, 3)) { case 1: - projectile.velocity.X -= 0.05f; + Projectile.velocity.X -= 0.05f; break; case 2: - projectile.velocity.X -= 0.10f; + Projectile.velocity.X -= 0.10f; break; case 3: - projectile.velocity.X -= 0.15f; + Projectile.velocity.X -= 0.15f; break; } - if (projectile.velocity.X < -9f) + if (Projectile.velocity.X < -9f) { - projectile.velocity.X = -9f; + Projectile.velocity.X = -9f; } } } if (playerDistance < 200f) { - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - if (projectile.velocity.X > 0.5f) + if (Projectile.velocity.X > 0.5f) { switch (Main.rand.Next(1, 3)) { case 1: - projectile.velocity.X -= 0.05f; + Projectile.velocity.X -= 0.05f; break; case 2: - projectile.velocity.X -= 0.10f; + Projectile.velocity.X -= 0.10f; break; case 3: - projectile.velocity.X -= 0.15f; + Projectile.velocity.X -= 0.15f; break; } } - else if (projectile.velocity.X < -0.5f) + else if (Projectile.velocity.X < -0.5f) { switch (Main.rand.Next(1, 3)) { case 1: - projectile.velocity.X += 0.05f; + Projectile.velocity.X += 0.05f; break; case 2: - projectile.velocity.X += 0.10f; + Projectile.velocity.X += 0.10f; break; case 3: - projectile.velocity.X += 0.15f; + Projectile.velocity.X += 0.15f; break; } } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + else if (Projectile.velocity.X < 0.5f && Projectile.velocity.X > -0.5f) { - projectile.velocity.X = 0f; + Projectile.velocity.X = 0f; } } } @@ -295,29 +295,29 @@ namespace CalamityMod.Projectiles.Summon } else if (fly) { - Vector2 center2 = projectile.Center; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, 0f); float playerDistance = vector48.Length(); vector48.Normalize(); vector48 *= 8f; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; - projectile.rotation = projectile.velocity.X * 0.03f; - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.rotation = Projectile.velocity.X * 0.03f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 9) + if (Projectile.frame >= 9) { - projectile.frame = 5; + Projectile.frame = 5; } if (playerDistance > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (playerDistance < 100f) { @@ -329,33 +329,33 @@ namespace CalamityMod.Projectiles.Summon { playerStill = 0; } - if (playerStill > 30 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerStill > 30 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { fly = false; - projectile.tileCollide = true; - projectile.rotation = 0; + Projectile.tileCollide = true; + Projectile.rotation = 0; } } } - if (projectile.velocity.X > 0.25f) + if (Projectile.velocity.X > 0.25f) { - projectile.spriteDirection = 1; + Projectile.spriteDirection = 1; } - else if (projectile.velocity.X < -0.25f) + else if (Projectile.velocity.X < -0.25f) { - projectile.spriteDirection = -1; + Projectile.spriteDirection = -1; } } private bool HoleBelow() { int tileWidth = 4; - int tileX = (int)(projectile.Center.X / 16f) - tileWidth; - if (projectile.velocity.X > 0) + int tileX = (int)(Projectile.Center.X / 16f) - tileWidth; + if (Projectile.velocity.X > 0) { tileX += tileWidth; } - int tileY = (int)((projectile.position.Y + projectile.height) / 16f); + int tileY = (int)((Projectile.position.Y + Projectile.height) / 16f); for (int y = tileY; y < tileY + 2; y++) { for (int x = tileX; x < tileX + tileWidth; x++) diff --git a/Projectiles/Summon/HerringMinion.cs b/Projectiles/Summon/HerringMinion.cs index b03fd470d5..b137d5177a 100644 --- a/Projectiles/Summon/HerringMinion.cs +++ b/Projectiles/Summon/HerringMinion.cs @@ -16,70 +16,70 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Herring"); - Main.projFrames[projectile.type] = 8; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 8; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0.5f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (dust > 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 33, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } dust--; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - if (Math.Abs(projectile.velocity.X) > 0.2f) + if (Math.Abs(Projectile.velocity.X) > 0.2f) { - projectile.spriteDirection = projectile.direction; + Projectile.spriteDirection = Projectile.direction; } - projectile.rotation = projectile.velocity.X * 0.005f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.rotation = Projectile.velocity.X * 0.005f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -89,26 +89,26 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.herring) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.ChargingMinionAI(600f, 800f, 1200f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 7f, false, true); + Projectile.ChargingMinionAI(600f, 800f, 1200f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 7f, false, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, spriteEffects, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; + target.immune[Projectile.owner] = 8; } } } diff --git a/Projectiles/Summon/Hive.cs b/Projectiles/Summon/Hive.cs index a92daff5e8..67f40bd8f3 100644 --- a/Projectiles/Summon/Hive.cs +++ b/Projectiles/Summon/Hive.cs @@ -11,67 +11,67 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Hive"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 38; - projectile.height = 62; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; + Projectile.width = 38; + Projectile.height = 62; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.sentry = true; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.penetrate = -1; } public override void AI() { - Player player = Main.player[projectile.owner]; - if (projectile.localAI[0] == 0f) + Player player = Main.player[Projectile.owner]; + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) + if (Projectile.frame > 5) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.velocity.Y += 0.5f; + Projectile.velocity.Y += 0.5f; - if (projectile.velocity.Y > 10f) + if (Projectile.velocity.Y > 10f) { - projectile.velocity.Y = 10f; + Projectile.velocity.Y = 10f; } - projectile.StickToTiles(false, false); + Projectile.StickToTiles(false, false); int target = 0; float num633 = 800f; - Vector2 vector46 = projectile.position; + Vector2 vector46 = Projectile.position; bool flag25 = false; - if (Main.player[projectile.owner].HasMinionAttackTargetNPC) + if (Main.player[Projectile.owner].HasMinionAttackTargetNPC) { - NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[Main.player[Projectile.owner].MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, projectile.Center); + float num646 = Vector2.Distance(npc.Center, Projectile.Center); if (!flag25 && num646 < num633) { vector46 = npc.Center; @@ -85,9 +85,9 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); if (!flag25 && num646 < num633) { num633 = num646; @@ -98,19 +98,19 @@ namespace CalamityMod.Projectiles.Summon } } } - if (projectile.owner == Main.myPlayer && flag25) + if (Projectile.owner == Main.myPlayer && flag25) { - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; return; } - projectile.ai[1] += 1f; - if ((projectile.ai[1] % 15f) == 0f) + Projectile.ai[1] += 1f; + if ((Projectile.ai[1] % 15f) == 0f) { float velocityX = Main.rand.NextFloat(-0.4f, 0.4f); float velocityY = Main.rand.NextFloat(-0.3f, -0.5f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocityX, velocityY, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, (float)target, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, velocityX, velocityY, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, (float)target, 0f); } } } diff --git a/Projectiles/Summon/Hiveling.cs b/Projectiles/Summon/Hiveling.cs index f80a3d4193..a680c5d75b 100644 --- a/Projectiles/Summon/Hiveling.cs +++ b/Projectiles/Summon/Hiveling.cs @@ -13,60 +13,60 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Hiveling"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.SentryShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.minion = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 240; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; } public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Player player = Main.player[Projectile.owner]; + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2 + MathHelper.PiOver4; - projectile.spriteDirection = -projectile.direction; - projectile.rotation = projectile.velocity.X * 0.05f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 + MathHelper.PiOver4; + Projectile.spriteDirection = -Projectile.direction; + Projectile.rotation = Projectile.velocity.X * 0.05f; - NPC potentialTarget = projectile.Center.MinionHoming(1200f, Main.player[projectile.owner]); + NPC potentialTarget = Projectile.Center.MinionHoming(1200f, Main.player[Projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 30f + projectile.SafeDirectionTo(potentialTarget.Center) * 10f) / 31f; + Projectile.velocity = (Projectile.velocity * 30f + Projectile.SafeDirectionTo(potentialTarget.Center) * 10f) / 31f; } public override void Kill(int timeLeft) { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/HomingGammaBullet.cs b/Projectiles/Summon/HomingGammaBullet.cs index 933b4065ff..a970857f28 100644 --- a/Projectiles/Summon/HomingGammaBullet.cs +++ b/Projectiles/Summon/HomingGammaBullet.cs @@ -13,30 +13,30 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gamma Bullet"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 12; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.alpha = 255; - projectile.timeLeft = 360; - projectile.tileCollide = true; - projectile.ignoreWater = true; + Projectile.width = 24; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.alpha = 255; + Projectile.timeLeft = 360; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; } public override void AI() { - projectile.alpha = Utils.Clamp(projectile.alpha - 35, 0, 255); - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.alpha = Utils.Clamp(Projectile.alpha - 35, 0, 255); + Projectile.rotation = Projectile.velocity.ToRotation(); - NPC potentialTarget = projectile.Center.MinionHoming(1000f, Main.player[projectile.owner]); - if (potentialTarget != null && !projectile.WithinRange(potentialTarget.Center, 100f) && projectile.timeLeft < 290) - projectile.velocity = (projectile.velocity * 6f + projectile.SafeDirectionTo(potentialTarget.Center) * 15f) / 7f; + NPC potentialTarget = Projectile.Center.MinionHoming(1000f, Main.player[Projectile.owner]); + if (potentialTarget != null && !Projectile.WithinRange(potentialTarget.Center, 100f) && Projectile.timeLeft < 290) + Projectile.velocity = (Projectile.velocity * 6f + Projectile.SafeDirectionTo(potentialTarget.Center) * 15f) / 7f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 240); @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 3; i++) { - Dust sulphuricAcid = Dust.NewDustDirect(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Dust sulphuricAcid = Dust.NewDustDirect(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); sulphuricAcid.noGravity = true; sulphuricAcid.velocity *= 1.8f; diff --git a/Projectiles/Summon/HowlsHeartCalcifer.cs b/Projectiles/Summon/HowlsHeartCalcifer.cs index 4fc4e568d8..2b24b3007e 100644 --- a/Projectiles/Summon/HowlsHeartCalcifer.cs +++ b/Projectiles/Summon/HowlsHeartCalcifer.cs @@ -9,29 +9,29 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Calcifer"); - Main.projFrames[projectile.type] = 4; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.LightPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + Main.projPet[Projectile.type] = true; + ProjectileID.Sets.LightPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; + Projectile.netImportant = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (!modPlayer.howlsHeart && !modPlayer.howlsHeartVanity || !player.active) { - projectile.active = false; + Projectile.active = false; return; } if (correctMinion) @@ -42,21 +42,21 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.howlTrio) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } if (!modPlayer.howlsHeartVanity) - Lighting.AddLight(projectile.Center, 0.75f, 0.485f, 0f); - projectile.FloatingPetAI(false, 0.04f, true); - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Lighting.AddLight(Projectile.Center, 0.75f, 0.485f, 0f); + Projectile.FloatingPetAI(false, 0.04f, true); + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } } diff --git a/Projectiles/Summon/HowlsHeartFireball.cs b/Projectiles/Summon/HowlsHeartFireball.cs index b0fdc6d846..45f826164d 100644 --- a/Projectiles/Summon/HowlsHeartFireball.cs +++ b/Projectiles/Summon/HowlsHeartFireball.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -10,62 +11,62 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Fireball"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 20; - projectile.friendly = true; - projectile.netImportant = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.minion = true; - projectile.minionSlots = 0f; + Projectile.width = 12; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.netImportant = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.minion = true; + Projectile.minionSlots = 0f; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; //Cycle through animation - projectile.frameCounter++; - if (projectile.frameCounter >= 6) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; float maxDistance = 500f; bool homeIn = false; - int target = (int)projectile.ai[0]; + int target = (int)Projectile.ai[0]; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDistance = (npc.width / 2) + (npc.height / 2); bool canHit = true; if (extraDistance < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance) && canHit) { center = npc.Center; homeIn = true; } } } - else if (Main.npc[target].CanBeChasedBy(projectile, false)) + else if (Main.npc[target].CanBeChasedBy(Projectile, false)) { NPC npc = Main.npc[target]; @@ -73,9 +74,9 @@ namespace CalamityMod.Projectiles.Summon bool canHit = true; if (extraDistance < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance) && canHit) { center = npc.Center; homeIn = true; @@ -86,15 +87,15 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDistance = (npc.width / 2) + (npc.height / 2); bool canHit = true; if (extraDistance < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance) && canHit) { center = npc.Center; homeIn = true; @@ -106,29 +107,29 @@ namespace CalamityMod.Projectiles.Summon if (homeIn) { - Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * 20f + moveDirection * 21f) / (21f); + Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 21f) / (21f); } - int blueT = Dust.NewDust(projectile.position, projectile.width, projectile.height, 59, 0f, 0f, 100, default, 0.6f); + int blueT = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 59, 0f, 0f, 100, default, 0.6f); Main.dust[blueT].noGravity = true; Main.dust[blueT].velocity *= 0.5f; - Main.dust[blueT].velocity += projectile.velocity * 0.1f; + Main.dust[blueT].velocity += Projectile.velocity * 0.1f; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item45, projectile.position); - int blue = Dust.NewDust(projectile.position, projectile.width, projectile.height, 59, 0f, 0f, 100, default, 1f); + SoundEngine.PlaySound(SoundID.Item45, Projectile.position); + int blue = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 59, 0f, 0f, 100, default, 1f); Main.dust[blue].velocity *= 0.5f; if (Main.rand.NextBool(2)) { Main.dust[blue].scale = 0.5f; Main.dust[blue].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } - int torch = Dust.NewDust(projectile.position, projectile.width, projectile.height, 59, 0f, 0f, 100, default, 1.4f); + int torch = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 59, 0f, 0f, 100, default, 1.4f); Main.dust[torch].noGravity = true; - Dust.NewDust(projectile.position, projectile.width, projectile.height, 59, 0f, 0f, 100, default, 0.8f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 59, 0f, 0f, 100, default, 0.8f); } } } diff --git a/Projectiles/Summon/HowlsHeartHowl.cs b/Projectiles/Summon/HowlsHeartHowl.cs index 2417727c94..81b0b0b6a5 100644 --- a/Projectiles/Summon/HowlsHeartHowl.cs +++ b/Projectiles/Summon/HowlsHeartHowl.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class HowlsHeartHowl : ModProjectile @@ -12,41 +13,41 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Howl"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 72; - projectile.height = 54; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; + Projectile.width = 72; + Projectile.height = 54; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); //Spawn dust and record initial damage values if (!initialized) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int dusty = Dust.NewDust(vector6 + vector7, 0, 0, 191, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; @@ -56,19 +57,19 @@ namespace CalamityMod.Projectiles.Summon } //if minion damage changes, update it - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } //If the correct minion, set bools - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (!modPlayer.howlsHeart && !modPlayer.howlsHeartVanity || !player.active) { - projectile.active = false; + Projectile.active = false; return; } if (correctMinion) @@ -79,26 +80,26 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.howlTrio) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } //Anti sticky movement although there should only be one //Set tile collision for only when trying to return to the player - projectile.tileCollide = projectile.ai[0] != 1f; + Projectile.tileCollide = Projectile.ai[0] != 1f; //Find an enemy - Vector2 targetPos = projectile.position; + Vector2 targetPos = Projectile.position; float maxRange = 900f; bool foundEnemy = false; int targetIndex = -1; //If the player has targetted an enemy, choose that one - NPC target = projectile.OwnerMinionAttackTargetNPC; - if (target != null && target.CanBeChasedBy(projectile, false) && !modPlayer.howlsHeartVanity) + NPC target = Projectile.OwnerMinionAttackTargetNPC; + if (target != null && target.CanBeChasedBy(Projectile, false) && !modPlayer.howlsHeartVanity) { - float targetDist = Vector2.Distance(target.Center, projectile.Center); - if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, target.position, target.width, target.height)) + float targetDist = Vector2.Distance(target.Center, Projectile.Center); + if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, target.position, target.width, target.height)) { maxRange = targetDist; targetPos = target.Center; @@ -112,10 +113,10 @@ namespace CalamityMod.Projectiles.Summon for (int index = 0; index < Main.maxNPCs; ++index) { NPC npc = Main.npc[index]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float targetDist = Vector2.Distance(npc.Center, projectile.Center); - if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { maxRange = targetDist; targetPos = npc.Center; @@ -130,53 +131,53 @@ namespace CalamityMod.Projectiles.Summon float maxDistanceFromPlayer = 1300f; if (foundEnemy) maxDistanceFromPlayer = 1600f; - if (Vector2.Distance(player.Center, projectile.Center) > maxDistanceFromPlayer && projectile.ai[0] != 1f) + if (Vector2.Distance(player.Center, Projectile.Center) > maxDistanceFromPlayer && Projectile.ai[0] != 1f) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } //Move toward an enemy if one has been found - if (foundEnemy && projectile.ai[0] == 0f) + if (foundEnemy && Projectile.ai[0] == 0f) { - Vector2 homeInVector = targetPos - projectile.Center; + Vector2 homeInVector = targetPos - Projectile.Center; float targetDist = homeInVector.Length(); homeInVector.Normalize(); if (targetDist > 200f) { float velocity = 6f; - projectile.velocity = (projectile.velocity * 40f + homeInVector * velocity) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + homeInVector * velocity) / 41f; } else { if (targetDist < 150f) { float velocity = -4f; - projectile.velocity = (projectile.velocity * 40f + homeInVector * velocity) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + homeInVector * velocity) / 41f; } else - projectile.velocity *= 0.97f; + Projectile.velocity *= 0.97f; } } else { //Return to the player if you can't see the player - if (!Collision.CanHitLine(projectile.Center, 1, 1, player.Center, 1, 1)) - projectile.ai[0] = 1f; + if (!Collision.CanHitLine(Projectile.Center, 1, 1, player.Center, 1, 1)) + Projectile.ai[0] = 1f; //Set speed to home in on the player. If returning to the player, go faster float speed = 9f; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) speed = 22f; //Find the player and align accordingly. Get in a line if there's more than one. - Vector2 playerPos = player.Center - projectile.Center; - projectile.netUpdate = true; + Vector2 playerPos = player.Center - Projectile.Center; + Projectile.netUpdate = true; int minionPosition = 1; - for (int index = 0; index < projectile.whoAmI; ++index) + for (int index = 0; index < Projectile.whoAmI; ++index) { Projectile proj = Main.projectile[index]; - if (proj.active && proj.owner == projectile.owner && proj.type == projectile.type) + if (proj.active && proj.owner == Projectile.owner && proj.type == Projectile.type) ++minionPosition; } playerPos.X -= 10f * player.direction; @@ -189,17 +190,17 @@ namespace CalamityMod.Projectiles.Summon if (playerDist > 200f && speed < 15f) speed = 15f; //If you were trying to chase the player but are close enough now, return to normal - if (playerDist < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerDist < 100f && Projectile.ai[0] == 1f && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } //Teleport to the player if really, really far if (playerDist > 2000f) { - projectile.position.X = player.Center.X - projectile.width / 2f; - projectile.position.Y = player.Center.Y - projectile.width / 2f; - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - Projectile.width / 2f; + Projectile.position.Y = player.Center.Y - Projectile.width / 2f; + Projectile.netUpdate = true; } //Home in on the player if (playerDist > 10f) @@ -207,77 +208,77 @@ namespace CalamityMod.Projectiles.Summon playerPos.Normalize(); if (playerDist < 50f) speed /= 2f; - projectile.velocity = (projectile.velocity * 20f + playerPos * speed) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + playerPos * speed) / 21f; } else { - projectile.direction = -player.direction; - projectile.velocity *= 0.9f; + Projectile.direction = -player.direction; + Projectile.velocity *= 0.9f; } } //Rotation - projectile.rotation = projectile.velocity.X * 0.05f; + Projectile.rotation = Projectile.velocity.X * 0.05f; //Cycle through animation - projectile.frameCounter++; - if (projectile.frameCounter >= 6) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } //Set projectile direction based on its movement - if (projectile.velocity.X > 0f) - projectile.spriteDirection = projectile.direction = -1; - else if (projectile.velocity.X < 0f) - projectile.spriteDirection = projectile.direction = 1; + if (Projectile.velocity.X > 0f) + Projectile.spriteDirection = Projectile.direction = -1; + else if (Projectile.velocity.X < 0f) + Projectile.spriteDirection = Projectile.direction = 1; //Increment firing cooldown - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += Main.rand.Next(1,4); + Projectile.ai[1] += Main.rand.Next(1,4); if (Main.rand.NextBool(3)) - ++projectile.ai[1]; + ++Projectile.ai[1]; } //Determine if it should shoot - if (projectile.ai[1] > 90f) + if (Projectile.ai[1] > 90f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } //Return if trying to return to the player or no enemy has been found - if (projectile.ai[0] != 0f || !foundEnemy) + if (Projectile.ai[0] != 0f || !foundEnemy) return; //Set projectile direction based on target location - Vector2 targetVec = targetPos - projectile.Center; + Vector2 targetVec = targetPos - Projectile.Center; if (targetVec.X > 0f) - projectile.spriteDirection = projectile.direction = -1; + Projectile.spriteDirection = Projectile.direction = -1; else if (targetVec.X < 0f) - projectile.spriteDirection = projectile.direction = 1; + Projectile.spriteDirection = Projectile.direction = 1; //Return if firing cooldown isn't perfect - if (projectile.ai[1] != 0f) + if (Projectile.ai[1] != 0f) return; - ++projectile.ai[1]; - if (Main.myPlayer != projectile.owner) + ++Projectile.ai[1]; + if (Main.myPlayer != Projectile.owner) return; //Fire projectile float speedMult = 16f; targetVec.Normalize(); targetVec *= speedMult; - Main.PlaySound(SoundID.Item20, projectile.position); - int fireball = Projectile.NewProjectile(projectile.Center, targetVec, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, targetIndex, 0f); + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + int fireball = Projectile.NewProjectile(Projectile.Center, targetVec, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, targetIndex, 0f); Main.projectile[fireball].netUpdate = true; Main.projectile[fireball].frame = Main.rand.Next(4); - projectile.netUpdate = true; + Projectile.netUpdate = true; } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Summon/HowlsHeartTurnipHead.cs b/Projectiles/Summon/HowlsHeartTurnipHead.cs index 397b32046c..7c9925af51 100644 --- a/Projectiles/Summon/HowlsHeartTurnipHead.cs +++ b/Projectiles/Summon/HowlsHeartTurnipHead.cs @@ -11,25 +11,25 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Turnip-Head"); - Main.projFrames[projectile.type] = 5; - Main.projPet[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + Main.projPet[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.width = 70; - projectile.height = 82; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = true; + Projectile.netImportant = true; + Projectile.width = 70; + Projectile.height = 82; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.tileCollide = true; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { - Player player = Main.player[projectile.owner]; - Vector2 center2 = projectile.Center; + Player player = Main.player[Projectile.owner]; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); fallThrough = playerDistance > 200f; @@ -38,14 +38,14 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); //If the correct minion, set bools - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (!modPlayer.howlsHeart && !modPlayer.howlsHeartVanity || !player.active) { - projectile.active = false; + Projectile.active = false; return; } if (correctMinion) @@ -56,73 +56,73 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.howlTrio) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - Vector2 vector46 = projectile.position; + Vector2 vector46 = Projectile.position; if (!fly) { - projectile.rotation = 0; - Vector2 playerVec = player.Center - projectile.Center; + Projectile.rotation = 0; + Vector2 playerVec = player.Center - Projectile.Center; float playerDistance = playerVec.Length(); - if (projectile.velocity.Y == 0f) + if (Projectile.velocity.Y == 0f) { - projectile.velocity.Y = -3f; + Projectile.velocity.Y = -3f; } - projectile.velocity.Y += 0.2f; - if (projectile.velocity.Y > 7f) + Projectile.velocity.Y += 0.2f; + if (Projectile.velocity.Y > 7f) { - projectile.velocity.Y = 7f; + Projectile.velocity.Y = 7f; } if (playerDistance > 600f) { fly = true; - projectile.velocity.X = 0f; + Projectile.velocity.X = 0f; } if (playerDistance > 100f) { - if (player.position.X - projectile.position.X > 0f) + if (player.position.X - Projectile.position.X > 0f) { - projectile.velocity.X += 0.10f; - if (projectile.velocity.X > 7f) + Projectile.velocity.X += 0.10f; + if (Projectile.velocity.X > 7f) { - projectile.velocity.X = 7f; + Projectile.velocity.X = 7f; } } else { - projectile.velocity.X -= 0.10f; - if (projectile.velocity.X < -7f) + Projectile.velocity.X -= 0.10f; + if (Projectile.velocity.X < -7f) { - projectile.velocity.X = -7f; + Projectile.velocity.X = -7f; } } } if (playerDistance < 100f) { - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - if (projectile.velocity.X > 0.5f) + if (Projectile.velocity.X > 0.5f) { - projectile.velocity.X -= 0.15f; + Projectile.velocity.X -= 0.15f; } - else if (projectile.velocity.X < -0.5f) + else if (Projectile.velocity.X < -0.5f) { - projectile.velocity.X += 0.15f; + Projectile.velocity.X += 0.15f; } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + else if (Projectile.velocity.X < 0.5f && Projectile.velocity.X > -0.5f) { - projectile.velocity.X = 0f; + Projectile.velocity.X = 0f; } } } @@ -130,31 +130,31 @@ namespace CalamityMod.Projectiles.Summon else if (fly) { //still hopping - if (projectile.velocity.Y == 0f) + if (Projectile.velocity.Y == 0f) { - projectile.velocity.Y = -3f; + Projectile.velocity.Y = -3f; } - projectile.velocity.Y += 0.2f; - if (projectile.velocity.Y > 7f) + Projectile.velocity.Y += 0.2f; + if (Projectile.velocity.Y > 7f) { - projectile.velocity.Y = 7f; + Projectile.velocity.Y = 7f; } - projectile.alpha += 15; - if (projectile.alpha >= 255) + Projectile.alpha += 15; + if (Projectile.alpha >= 255) { - projectile.position.X = player.position.X; - projectile.position.Y = player.position.Y - 5f; + Projectile.position.X = player.position.X; + Projectile.position.Y = player.position.Y - 5f; fly = false; - projectile.alpha = 0; + Projectile.alpha = 0; } } - if (projectile.velocity.X > 0.25f) + if (Projectile.velocity.X > 0.25f) { - projectile.spriteDirection = -1; + Projectile.spriteDirection = -1; } - else if (projectile.velocity.X < -0.25f) + else if (Projectile.velocity.X < -0.25f) { - projectile.spriteDirection = 1; + Projectile.spriteDirection = 1; } } diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index e4cdac2a8e..02c9c5767b 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -16,66 +16,66 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Ice Clasper"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.coldDamage = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.coldDamage = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (dust > 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 67, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } dust--; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) + if (Projectile.frame > 5) { - projectile.frame = 0; + Projectile.frame = 0; } - Lighting.AddLight((int)(projectile.Center.X / 16f), (int)(projectile.Center.Y / 16f), 0.05f, 0.15f, 0.2f); - bool flag64 = projectile.type == ModContent.ProjectileType(); + Lighting.AddLight((int)(Projectile.Center.X / 16f), (int)(Projectile.Center.Y / 16f), 0.05f, 0.15f, 0.2f); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -85,27 +85,27 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.iClasper) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 40f, 9f, 4f, new Vector2(0f, -60f), 40f, 9f, true, true); + Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 40f, 9f, 4f, new Vector2(0f, -60f), 40f, 9f, true, true); - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; + target.immune[Projectile.owner] = 7; } } } diff --git a/Projectiles/Summon/IceSentry.cs b/Projectiles/Summon/IceSentry.cs index 9e99f338d8..cf0653ac01 100644 --- a/Projectiles/Summon/IceSentry.cs +++ b/Projectiles/Summon/IceSentry.cs @@ -12,122 +12,122 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Ice Sentry"); - Main.projFrames[projectile.type] = 18; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 18; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 94; - projectile.height = 94; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.sentry = true; - projectile.coldDamage = true; + Projectile.width = 94; + Projectile.height = 94; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.sentry = true; + Projectile.coldDamage = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (setDamage) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; setDamage = false; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - projectile.velocity = Vector2.Zero; + Projectile.velocity = Vector2.Zero; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frameCounter = 0; - projectile.frame++; + Projectile.frameCounter = 0; + Projectile.frame++; } - if (projectile.ai[1] < 300f) + if (Projectile.ai[1] < 300f) { - projectile.localAI[1] = 1f; - if (projectile.frame >= 9) - projectile.frame = 0; + Projectile.localAI[1] = 1f; + if (Projectile.frame >= 9) + Projectile.frame = 0; } else { - if (projectile.frame >= 18) - projectile.frame = 9; + if (Projectile.frame >= 18) + Projectile.frame = 9; - projectile.localAI[1]++; - if (projectile.localAI[1] > 2) + Projectile.localAI[1]++; + if (Projectile.localAI[1] > 2) { - projectile.localAI[1] = 0; + Projectile.localAI[1] = 0; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { Vector2 speed = new Vector2(Main.rand.Next(-1000, 1001), Main.rand.Next(-1000, 1001)); speed.Normalize(); speed *= 15f; - int shard = Projectile.NewProjectile(projectile.Center + speed, speed, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack / 2, projectile.owner); + int shard = Projectile.NewProjectile(Projectile.Center + speed, speed, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack / 2, Projectile.owner); } } } - NPC minionAttackTargetNpc = projectile.OwnerMinionAttackTargetNPC; - if (minionAttackTargetNpc != null && projectile.ai[0] != minionAttackTargetNpc.whoAmI && minionAttackTargetNpc.CanBeChasedBy(projectile) && Collision.CanHit(projectile.Center, 0, 0, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height)) + NPC minionAttackTargetNpc = Projectile.OwnerMinionAttackTargetNPC; + if (minionAttackTargetNpc != null && Projectile.ai[0] != minionAttackTargetNpc.whoAmI && minionAttackTargetNpc.CanBeChasedBy(Projectile) && Collision.CanHit(Projectile.Center, 0, 0, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height)) { - projectile.ai[0] = minionAttackTargetNpc.whoAmI; - projectile.ai[1] = 0f; - projectile.localAI[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = minionAttackTargetNpc.whoAmI; + Projectile.ai[1] = 0f; + Projectile.localAI[0] = 0f; + Projectile.netUpdate = true; } - if (projectile.ai[0] >= 0 && projectile.ai[0] < Main.maxNPCs) + if (Projectile.ai[0] >= 0 && Projectile.ai[0] < Main.maxNPCs) { - NPC npc = Main.npc[(int)projectile.ai[0]]; + NPC npc = Main.npc[(int)Projectile.ai[0]]; - bool rememberTarget = npc.CanBeChasedBy(projectile); + bool rememberTarget = npc.CanBeChasedBy(Projectile); if (rememberTarget) { - projectile.localAI[0]++; + Projectile.localAI[0]++; - if (projectile.ai[1] < 300f) - projectile.ai[1]++; + if (Projectile.ai[1] < 300f) + Projectile.ai[1]++; - float delay = 60f - projectile.ai[1] / 60f * 10f; - if (projectile.localAI[0] > delay) + float delay = 60f - Projectile.ai[1] / 60f * 10f; + if (Projectile.localAI[0] > delay) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; - rememberTarget = Collision.CanHit(projectile.Center, 0, 0, npc.position, npc.width, npc.height); - if (rememberTarget && projectile.owner == Main.myPlayer) + rememberTarget = Collision.CanHit(Projectile.Center, 0, 0, npc.position, npc.width, npc.height); + if (rememberTarget && Projectile.owner == Main.myPlayer) { - Vector2 speed = npc.Center - projectile.Center; + Vector2 speed = npc.Center - Projectile.Center; speed.Normalize(); speed *= 8f; - if (projectile.ai[1] >= 300f) + if (Projectile.ai[1] >= 300f) speed = speed.RotatedBy(MathHelper.ToRadians(Main.rand.Next(-5, 6))) * 1.5f + npc.velocity / 2f; - Projectile.NewProjectile(projectile.Center, speed + npc.velocity / 2f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, speed + npc.velocity / 2f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } if (!rememberTarget) { - projectile.ai[0] = -1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = -1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } } else { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; float maxDistance = 1000f; int possibleTarget = -1; @@ -135,9 +135,9 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile)) + if (npc.CanBeChasedBy(Projectile)) { - float npcDistance = projectile.Distance(npc.Center); + float npcDistance = Projectile.Distance(npc.Center); if (npcDistance < maxDistance) { maxDistance = npcDistance; @@ -149,9 +149,9 @@ namespace CalamityMod.Projectiles.Summon if (possibleTarget > 0) { //Main.NewText("new target acquired"); - projectile.ai[0] = possibleTarget; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = possibleTarget; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Summon/IceSentryFrostBolt.cs b/Projectiles/Summon/IceSentryFrostBolt.cs index 7b3cd1078d..6597bebce3 100644 --- a/Projectiles/Summon/IceSentryFrostBolt.cs +++ b/Projectiles/Summon/IceSentryFrostBolt.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -13,89 +14,89 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Ball"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.SentryShot[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 2; - projectile.timeLeft = 480; - projectile.minion = true; - projectile.coldDamage = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 2; + Projectile.timeLeft = 480; + Projectile.minion = true; + Projectile.coldDamage = true; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.3f / 255f, (255 - projectile.alpha) * 0.45f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.01f / 255f, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.45f / 255f); for (int num105 = 0; num105 < 2; num105++) { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; + float num99 = Projectile.velocity.X / 3f * (float)num105; + float num100 = Projectile.velocity.Y / 3f * (float)num105; int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); + int num102 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num101, Projectile.position.Y + (float)num101), Projectile.width - num101 * 2, Projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[num102]; dust.noGravity = true; dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.1f; + dust.velocity += Projectile.velocity * 0.1f; dust.position.X -= num99; dust.position.Y -= num100; } if (Main.rand.NextBool(10)) { int num103 = 4; - int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); + int num104 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num103, Projectile.position.Y + (float)num103), Projectile.width - num103 * 2, Projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += projectile.velocity * 0.5f; + Main.dust[num104].velocity += Projectile.velocity * 0.5f; } - projectile.rotation += 0.3f * (float)projectile.direction; + Projectile.rotation += 0.3f * (float)Projectile.direction; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.penetrate--; - if (projectile.penetrate <= 0) + Projectile.penetrate--; + if (Projectile.penetrate <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } - Main.PlaySound(SoundID.Item10, projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); } return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 27); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 27); for (int k = 0; k < 5; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Summon/IceSentryShard.cs b/Projectiles/Summon/IceSentryShard.cs index ca3d5b3553..0eef99610f 100644 --- a/Projectiles/Summon/IceSentryShard.cs +++ b/Projectiles/Summon/IceSentryShard.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -11,58 +12,58 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.aiStyle = 1; - projectile.coldDamage = true; - projectile.friendly = true; - projectile.minion = true; - projectile.penetrate = 1; - projectile.coldDamage = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.aiStyle = 1; + Projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.penetrate = 1; + Projectile.coldDamage = true; } public override void SetStaticDefaults() { DisplayName.SetDefault("Frost Shard"); - ProjectileID.Sets.SentryShot[projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void AI() { - projectile.velocity.Y += 0.2f; - if (projectile.localAI[0] == 0f || projectile.localAI[0] == 2f) + Projectile.velocity.Y += 0.2f; + if (Projectile.localAI[0] == 0f || Projectile.localAI[0] == 2f) { - projectile.scale += 0.01f; - projectile.alpha -= 50; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 50; + if (Projectile.alpha <= 0) { - projectile.localAI[0] = 1f; - projectile.alpha = 0; + Projectile.localAI[0] = 1f; + Projectile.alpha = 0; } } - else if (projectile.localAI[0] == 1.0) + else if (Projectile.localAI[0] == 1.0) { - projectile.scale -= 0.01f; - projectile.alpha += 50; - if (projectile.alpha >= byte.MaxValue) + Projectile.scale -= 0.01f; + Projectile.alpha += 50; + if (Projectile.alpha >= byte.MaxValue) { - projectile.localAI[0] = 2f; - projectile.alpha = byte.MaxValue; + Projectile.localAI[0] = 2f; + Projectile.alpha = byte.MaxValue; } } } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int index1 = 0; index1 < 3; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 76); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 76); Main.dust[index2].noGravity = true; Main.dust[index2].noLight = true; Main.dust[index2].scale = 0.7f; diff --git a/Projectiles/Summon/IgneousBlade.cs b/Projectiles/Summon/IgneousBlade.cs index 5b860b747d..52bb35111f 100644 --- a/Projectiles/Summon/IgneousBlade.cs +++ b/Projectiles/Summon/IgneousBlade.cs @@ -15,25 +15,25 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Igneous Blade"); - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; } public override void SetDefaults() { - projectile.width = 52; - projectile.height = 86; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 7; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 52; + Projectile.height = 86; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 7; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void SendExtraAI(BinaryWriter writer) { @@ -45,22 +45,22 @@ namespace CalamityMod.Projectiles.Summon } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) { @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.igneousExaltation) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } @@ -78,26 +78,26 @@ namespace CalamityMod.Projectiles.Summon if (!Firing) { const float outwardPosition = 180f; - projectile.Center = player.Center + projectile.ai[0].ToRotationVector2() * outwardPosition; - projectile.rotation = projectile.ai[0] + MathHelper.PiOver2 + MathHelper.PiOver4; - projectile.ai[0] -= MathHelper.ToRadians(4f); + Projectile.Center = player.Center + Projectile.ai[0].ToRotationVector2() * outwardPosition; + Projectile.rotation = Projectile.ai[0] + MathHelper.PiOver2 + MathHelper.PiOver4; + Projectile.ai[0] -= MathHelper.ToRadians(4f); } else { - if (projectile.penetrate == -1) //limit penetration for worm memes - projectile.penetrate = 3; + if (Projectile.penetrate == -1) //limit penetration for worm memes + Projectile.penetrate = 3; - projectile.ai[0]--; - if (projectile.ai[0] == 1) - projectile.Kill(); + Projectile.ai[0]--; + if (Projectile.ai[0] == 1) + Projectile.Kill(); - if (projectile.ai[0] % 10f == 9f) + if (Projectile.ai[0] % 10f == 9f) { for (int i = 0; i < 20; i++) { float angle = MathHelper.TwoPi / 20f * i; - Dust dust = Dust.NewDustPerfect(projectile.position + angle.ToRotationVector2().RotatedBy(projectile.rotation) * new Vector2(14f, 21f), DustID.Fire); - dust.velocity = angle.ToRotationVector2().RotatedBy(projectile.rotation) * 2f; + Dust dust = Dust.NewDustPerfect(Projectile.position + angle.ToRotationVector2().RotatedBy(Projectile.rotation) * new Vector2(14f, 21f), DustID.Fire); + dust.velocity = angle.ToRotationVector2().RotatedBy(Projectile.rotation) * 2f; dust.noGravity = true; } } @@ -107,23 +107,23 @@ namespace CalamityMod.Projectiles.Summon { if (Firing) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - projectile.ai[0] = 50; + Projectile.ai[0] = 50; for (int i = 0; i < 3; i++) { Vector2 spawnPosition = target.Center - new Vector2(0f, 550f).RotatedByRandom(MathHelper.ToRadians(8f)); Projectile.NewProjectile(spawnPosition, Vector2.Normalize(target.Center - spawnPosition) * 24f, ModContent.ProjectileType(), - (int)(projectile.damage * 0.666), projectile.knockBack, projectile.owner); + (int)(Projectile.damage * 0.666), Projectile.knockBack, Projectile.owner); } for (int i = 0; i < Main.rand.Next(28, 41); i++) { Dust.NewDustPerfect( - projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), 6, Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } - projectile.netUpdate = true; + Projectile.netUpdate = true; } } } @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Summon { for (int j = 0; j < 40; j++) { - Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 6); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 6); dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool(2).ToDirectionInt(); dust.noGravity = true; } @@ -140,29 +140,29 @@ namespace CalamityMod.Projectiles.Summon { if (Firing) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/IgneousBlade"); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Summon/IgneousBlade"); Rectangle rectangle = new Rectangle(0, 0, texture.Width, texture.Height); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; if (Lighting.NotRetro) { - for (int i = 0; i < projectile.oldPos.Length; i++) + for (int i = 0; i < Projectile.oldPos.Length; i++) { - Vector2 drawPos = projectile.oldPos[i] + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - Color color = Color.Lerp(Color.White, Color.Red, i / (float)projectile.oldPos.Length) * - ((projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); - float scale = MathHelper.Lerp(projectile.scale * 1.35f, projectile.scale * 0.6f, i / (float)projectile.oldPos.Length); + Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color color = Color.Lerp(Color.White, Color.Red, i / (float)Projectile.oldPos.Length) * + ((Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); + float scale = MathHelper.Lerp(Projectile.scale * 1.35f, Projectile.scale * 0.6f, i / (float)Projectile.oldPos.Length); Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, - projectile.rotation, + Projectile.rotation, rectangle.Size() / 2f, scale, spriteEffects, 0f); } } - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Rectangle?(rectangle), Color.White, - projectile.rotation, + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle?(rectangle), Color.White, + Projectile.rotation, rectangle.Size() / 2f, 1.35f, spriteEffects, 0f); return false; } diff --git a/Projectiles/Summon/IgneousBladeStrike.cs b/Projectiles/Summon/IgneousBladeStrike.cs index aad255f129..578e8e4a3a 100644 --- a/Projectiles/Summon/IgneousBladeStrike.cs +++ b/Projectiles/Summon/IgneousBladeStrike.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class IgneousBladeStrike : ModProjectile @@ -11,38 +12,38 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Blade"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 86; - projectile.height = 36; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.timeLeft = 360; - projectile.alpha = 127; + Projectile.friendly = true; + Projectile.width = 86; + Projectile.height = 36; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; + Projectile.timeLeft = 360; + Projectile.alpha = 127; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2 + MathHelper.PiOver4; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 + MathHelper.PiOver4; } public override void Kill(int timeLeft) { for (int i = 0; i < Main.rand.Next(28, 41); i++) { Dust.NewDustPerfect( - projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), 6, Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); } } } diff --git a/Projectiles/Summon/IrradiatedAura.cs b/Projectiles/Summon/IrradiatedAura.cs index 6bf6e0ff40..a34176233b 100644 --- a/Projectiles/Summon/IrradiatedAura.cs +++ b/Projectiles/Summon/IrradiatedAura.cs @@ -17,20 +17,20 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 180; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.4f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.4f / 255f); int randomDust = Main.rand.Next(4); if (randomDust == 3) { @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Summon } for (int num468 = 0; num468 < (Main.rand.NextBool(2) ? 1 : 2); num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); if (randomDust == 89) { Main.dust[num469].scale *= 0.35f; diff --git a/Projectiles/Summon/LanternFlame.cs b/Projectiles/Summon/LanternFlame.cs index d045da9492..d0212c6ee9 100644 --- a/Projectiles/Summon/LanternFlame.cs +++ b/Projectiles/Summon/LanternFlame.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class LanternFlame : ModProjectile @@ -12,62 +13,62 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.SentryShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.minion = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.alpha = 255; - projectile.tileCollide = false; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.alpha = 255; + Projectile.tileCollide = false; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 1f / 255f, 0f, 0f); - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 1f / 255f, 0f, 0f); + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 10; + Projectile.alpha -= 10; } - if (projectile.alpha <= 25) + if (Projectile.alpha <= 25) { - NPC potentialTarget = projectile.Center.MinionHoming(700f, Main.player[projectile.owner]); + NPC potentialTarget = Projectile.Center.MinionHoming(700f, Main.player[Projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 16f) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 16f) / 21f; } } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 48; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 48; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -77,10 +78,10 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 15; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -90,7 +91,7 @@ namespace CalamityMod.Projectiles.Summon target.AddBuff(ModContent.BuffType(), 180); if (playSound) { - Main.PlaySound(SoundID.Item74, projectile.position); + SoundEngine.PlaySound(SoundID.Item74, Projectile.position); } playSound = false; } diff --git a/Projectiles/Summon/LanternSoul.cs b/Projectiles/Summon/LanternSoul.cs index 165621e808..2a36758a60 100644 --- a/Projectiles/Summon/LanternSoul.cs +++ b/Projectiles/Summon/LanternSoul.cs @@ -12,56 +12,56 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Lantern"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; + Projectile.width = 26; + Projectile.height = 26; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.sentry = true; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.penetrate = -1; } public override void AI() { - Lighting.AddLight(projectile.Center, 1f, 0f, 0f); - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Lighting.AddLight(Projectile.Center, 1f, 0f, 0f); + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (count == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; count += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(6.28318548f * projectile.ai[0] / 300f)) * 0.5f); - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 300f) + Projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(6.28318548f * Projectile.ai[0] / 300f)) * 0.5f); + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 300f) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } int num = 0; @@ -74,18 +74,18 @@ namespace CalamityMod.Projectiles.Summon } if (num < 20) { - projectile.ai[1] += (float)Main.rand.Next(2,6) + 1f; - if (projectile.ai[1] >= 75f) + Projectile.ai[1] += (float)Main.rand.Next(2,6) + 1f; + if (Projectile.ai[1] >= 75f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - if (projectile.owner == Main.myPlayer) + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; + if (Projectile.owner == Main.myPlayer) { float startOffsetX = Main.rand.NextFloat(15f, 200f) * (Main.rand.NextBool() ? -1f : 1f); float startOffsetY = Main.rand.NextFloat(15f, 200f) * (Main.rand.NextBool() ? -1f : 1f); - Vector2 startPos = new Vector2(projectile.position.X + startOffsetX, projectile.position.Y + startOffsetY); + Vector2 startPos = new Vector2(Projectile.position.X + startOffsetX, Projectile.position.Y + startOffsetY); Vector2 speed = new Vector2(0f, 0f); - Projectile.NewProjectile(startPos, speed, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(startPos, speed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Summon/LostSoulGiant.cs b/Projectiles/Summon/LostSoulGiant.cs index 02d6004070..736c66801e 100644 --- a/Projectiles/Summon/LostSoulGiant.cs +++ b/Projectiles/Summon/LostSoulGiant.cs @@ -4,32 +4,33 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class LostSoulGiant : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.scale = 0.8f; - projectile.width = projectile.height = 52; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.scale = 0.8f; + Projectile.width = Projectile.height = 52; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } - public override void AI() => DoSoulAI(projectile, ref Time); + public override void AI() => DoSoulAI(Projectile, ref Time); public static void DoSoulAI(Projectile projectile, ref float time) { @@ -61,27 +62,27 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - Color baseColor = Color.Lerp(Color.IndianRed, Color.DarkViolet, projectile.identity % 5f / 5f * 0.5f); + Color baseColor = Color.Lerp(Color.IndianRed, Color.DarkViolet, Projectile.identity % 5f / 5f * 0.5f); Color color = Color.Lerp(baseColor * 1.5f, baseColor, (float)Math.Cos(Main.GlobalTime * 2.7f) * 0.04f + 0.45f); color.A = 0; - return color * projectile.Opacity; + return color * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects direction = projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = Main.projectileTexture[projectile.type]; - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { - for (int j = 0; j < projectile.oldPos.Length / 2; j++) + for (int j = 0; j < Projectile.oldPos.Length / 2; j++) { - float fade = (float)Math.Pow(1f - Utils.InverseLerp(0f, projectile.oldPos.Length / 2, j, true), 2D); - Color drawColor = Color.Lerp(projectile.GetAlpha(lightColor), Color.White * projectile.Opacity, j / projectile.oldPos.Length) * fade; - Vector2 drawPosition = projectile.oldPos[j] + projectile.Size * 0.5f + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 1.5f - Main.screenPosition; - float rotation = projectile.oldRot[j]; + float fade = (float)Math.Pow(1f - Utils.InverseLerp(0f, Projectile.oldPos.Length / 2, j, true), 2D); + Color drawColor = Color.Lerp(Projectile.GetAlpha(lightColor), Color.White * Projectile.Opacity, j / Projectile.oldPos.Length) * fade; + Vector2 drawPosition = Projectile.oldPos[j] + Projectile.Size * 0.5f + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 1.5f - Main.screenPosition; + float rotation = Projectile.oldRot[j]; - spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); } } @@ -91,16 +92,16 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { // Play a wraith death sound. - Main.PlaySound(SoundID.NPCDeath52, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCDeath52, Projectile.Center); if (Main.dedServ) return; for (int i = 0; i < 45; i++) { - Dust ectoplasm = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(60f, 60f), 264); + Dust ectoplasm = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(60f, 60f), 264); ectoplasm.velocity = Main.rand.NextVector2Circular(2f, 2f); - ectoplasm.color = projectile.GetAlpha(Color.White); + ectoplasm.color = Projectile.GetAlpha(Color.White); ectoplasm.scale = 1.45f; ectoplasm.noGravity = true; ectoplasm.noLight = true; diff --git a/Projectiles/Summon/LostSoulGold.cs b/Projectiles/Summon/LostSoulGold.cs index c89cdc565e..7945a382b4 100644 --- a/Projectiles/Summon/LostSoulGold.cs +++ b/Projectiles/Summon/LostSoulGold.cs @@ -4,55 +4,56 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class LostSoulGold : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Gold Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = projectile.height = 38; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = Projectile.height = 38; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } - public override void AI() => LostSoulGiant.DoSoulAI(projectile, ref Time); + public override void AI() => LostSoulGiant.DoSoulAI(Projectile, ref Time); public override Color? GetAlpha(Color lightColor) { - Color baseColor = Color.Lerp(Color.DarkGoldenrod, Color.Gold, projectile.identity % 5f / 5f); + Color baseColor = Color.Lerp(Color.DarkGoldenrod, Color.Gold, Projectile.identity % 5f / 5f); Color color = Color.Lerp(baseColor, Color.White, (float)Math.Cos(Main.GlobalTime * 2.7f) * 0.04f + 0.5f); color.A = 127; - return color * projectile.Opacity; + return color * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects direction = projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = Main.projectileTexture[projectile.type]; - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { - for (int j = 0; j < projectile.oldPos.Length / 2; j++) + for (int j = 0; j < Projectile.oldPos.Length / 2; j++) { - float fade = (float)Math.Pow(1f - Utils.InverseLerp(0f, projectile.oldPos.Length / 2, j, true), 2D); - Color drawColor = Color.Lerp(projectile.GetAlpha(lightColor), Color.White * projectile.Opacity, j / projectile.oldPos.Length) * fade; - Vector2 drawPosition = projectile.oldPos[j] + projectile.Size * 0.5f + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 0.8f - Main.screenPosition; - float rotation = projectile.oldRot[j]; + float fade = (float)Math.Pow(1f - Utils.InverseLerp(0f, Projectile.oldPos.Length / 2, j, true), 2D); + Color drawColor = Color.Lerp(Projectile.GetAlpha(lightColor), Color.White * Projectile.Opacity, j / Projectile.oldPos.Length) * fade; + Vector2 drawPosition = Projectile.oldPos[j] + Projectile.Size * 0.5f + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 0.8f - Main.screenPosition; + float rotation = Projectile.oldRot[j]; - spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); } } @@ -62,16 +63,16 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { // Play a wraith death sound. - Main.PlaySound(SoundID.NPCDeath52, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCDeath52, Projectile.Center); if (Main.dedServ) return; for (int i = 0; i < 45; i++) { - Dust ectoplasm = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(42f, 42f), 264); + Dust ectoplasm = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(42f, 42f), 264); ectoplasm.velocity = Main.rand.NextVector2Circular(1.75f, 1.75f); - ectoplasm.color = projectile.GetAlpha(Color.White); + ectoplasm.color = Projectile.GetAlpha(Color.White); ectoplasm.scale = 1.45f; ectoplasm.noGravity = true; ectoplasm.noLight = true; diff --git a/Projectiles/Summon/LostSoulLarge.cs b/Projectiles/Summon/LostSoulLarge.cs index aab781fe8f..e4e09dfa73 100644 --- a/Projectiles/Summon/LostSoulLarge.cs +++ b/Projectiles/Summon/LostSoulLarge.cs @@ -4,56 +4,57 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class LostSoulLarge : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.scale = 0.75f; - projectile.width = projectile.height = 46; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.scale = 0.75f; + Projectile.width = Projectile.height = 46; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } - public override void AI() => LostSoulGiant.DoSoulAI(projectile, ref Time); + public override void AI() => LostSoulGiant.DoSoulAI(Projectile, ref Time); public override Color? GetAlpha(Color lightColor) { - Color baseColor = Color.Lerp(Color.Orange, Color.IndianRed, projectile.identity % 5f / 5f * 0.5f); + Color baseColor = Color.Lerp(Color.Orange, Color.IndianRed, Projectile.identity % 5f / 5f * 0.5f); Color color = Color.Lerp(baseColor * 1.5f, baseColor, (float)Math.Cos(Main.GlobalTime * 2.7f) * 0.04f + 0.45f); color.A = 0; - return color * projectile.Opacity; + return color * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects direction = projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = Main.projectileTexture[projectile.type]; - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { - for (int j = 0; j < projectile.oldPos.Length / 2; j++) + for (int j = 0; j < Projectile.oldPos.Length / 2; j++) { - float fade = (float)Math.Pow(1f - Utils.InverseLerp(0f, projectile.oldPos.Length / 2, j, true), 2D); - Color drawColor = Color.Lerp(projectile.GetAlpha(lightColor), Color.White * projectile.Opacity, j / projectile.oldPos.Length) * fade; - Vector2 drawPosition = projectile.oldPos[j] + projectile.Size * 0.5f + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 1.25f - Main.screenPosition; - float rotation = projectile.oldRot[j]; + float fade = (float)Math.Pow(1f - Utils.InverseLerp(0f, Projectile.oldPos.Length / 2, j, true), 2D); + Color drawColor = Color.Lerp(Projectile.GetAlpha(lightColor), Color.White * Projectile.Opacity, j / Projectile.oldPos.Length) * fade; + Vector2 drawPosition = Projectile.oldPos[j] + Projectile.Size * 0.5f + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 1.25f - Main.screenPosition; + float rotation = Projectile.oldRot[j]; - spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); } } @@ -63,16 +64,16 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { // Play a wraith death sound. - Main.PlaySound(SoundID.NPCDeath52, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCDeath52, Projectile.Center); if (Main.dedServ) return; for (int i = 0; i < 45; i++) { - Dust ectoplasm = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(42f, 42f), 264); + Dust ectoplasm = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(42f, 42f), 264); ectoplasm.velocity = Main.rand.NextVector2Circular(1.75f, 1.75f); - ectoplasm.color = projectile.GetAlpha(Color.White); + ectoplasm.color = Projectile.GetAlpha(Color.White); ectoplasm.scale = 1.45f; ectoplasm.noGravity = true; ectoplasm.noLight = true; diff --git a/Projectiles/Summon/LostSoulSmall.cs b/Projectiles/Summon/LostSoulSmall.cs index 06b23fbd9b..2240188893 100644 --- a/Projectiles/Summon/LostSoulSmall.cs +++ b/Projectiles/Summon/LostSoulSmall.cs @@ -4,55 +4,56 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class LostSoulSmall : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Soul"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = projectile.height = 38; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; + Projectile.width = Projectile.height = 38; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; } - public override void AI() => LostSoulGiant.DoSoulAI(projectile, ref Time); + public override void AI() => LostSoulGiant.DoSoulAI(Projectile, ref Time); public override Color? GetAlpha(Color lightColor) { - Color baseColor = Color.Lerp(Color.Orange, Color.IndianRed, projectile.identity % 5f / 5f * 0.425f); + Color baseColor = Color.Lerp(Color.Orange, Color.IndianRed, Projectile.identity % 5f / 5f * 0.425f); Color color = Color.Lerp(baseColor * 1.5f, baseColor, (float)Math.Cos(Main.GlobalTime * 2.7f) * 0.04f + 0.45f); color.A = 0; - return color * projectile.Opacity; + return color * Projectile.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects direction = projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Texture2D texture = Main.projectileTexture[projectile.type]; - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); for (int i = 0; i < 4; i++) { - for (int j = 0; j < projectile.oldPos.Length / 2; j++) + for (int j = 0; j < Projectile.oldPos.Length / 2; j++) { - float fade = (float)Math.Pow(1f - Utils.InverseLerp(0f, projectile.oldPos.Length / 2, j, true), 2D); - Color drawColor = Color.Lerp(projectile.GetAlpha(lightColor), Color.White * projectile.Opacity, j / projectile.oldPos.Length) * fade; - Vector2 drawPosition = projectile.oldPos[j] + projectile.Size * 0.5f + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 0.8f - Main.screenPosition; - float rotation = projectile.oldRot[j]; + float fade = (float)Math.Pow(1f - Utils.InverseLerp(0f, Projectile.oldPos.Length / 2, j, true), 2D); + Color drawColor = Color.Lerp(Projectile.GetAlpha(lightColor), Color.White * Projectile.Opacity, j / Projectile.oldPos.Length) * fade; + Vector2 drawPosition = Projectile.oldPos[j] + Projectile.Size * 0.5f + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 0.8f - Main.screenPosition; + float rotation = Projectile.oldRot[j]; - spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); } } @@ -62,16 +63,16 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { // Play a wraith death sound. - Main.PlaySound(SoundID.NPCDeath52, projectile.Center); + SoundEngine.PlaySound(SoundID.NPCDeath52, Projectile.Center); if (Main.dedServ) return; for (int i = 0; i < 45; i++) { - Dust ectoplasm = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(42f, 42f), 264); + Dust ectoplasm = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(42f, 42f), 264); ectoplasm.velocity = Main.rand.NextVector2Circular(1.75f, 1.75f); - ectoplasm.color = projectile.GetAlpha(Color.White); + ectoplasm.color = Projectile.GetAlpha(Color.White); ectoplasm.scale = 1.45f; ectoplasm.noGravity = true; ectoplasm.noLight = true; diff --git a/Projectiles/Summon/LuxorsGiftSummon.cs b/Projectiles/Summon/LuxorsGiftSummon.cs index 06b1cc6a62..3ca1af836d 100644 --- a/Projectiles/Summon/LuxorsGiftSummon.cs +++ b/Projectiles/Summon/LuxorsGiftSummon.cs @@ -14,95 +14,95 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gift"); - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 180000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 14; + Projectile.height = 14; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 180000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (dust > 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } dust--; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 250) + Projectile.scale -= 0.01f; + Projectile.alpha += 15; + if (Projectile.alpha >= 250) { - projectile.alpha = 255; - projectile.localAI[0] = 1f; + Projectile.alpha = 255; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) + Projectile.scale += 0.01f; + Projectile.alpha -= 15; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[0] = 0f; + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; } } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); if (flag64) { if (!modPlayer.luxorsGift || player.dead) { - projectile.Kill(); + Projectile.Kill(); } } - projectile.ChargingMinionAI(700f, 1000f, 2200f, 150f, 0, 40f, 9f, 4f, new Vector2(0f, -60f), 40f, 9f, true, true); + Projectile.ChargingMinionAI(700f, 1000f, 2200f, 150f, 0, 40f, 9f, 4f, new Vector2(0f, -60f), 40f, 9f, true, true); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Summon/MK2FlaskSummon.cs b/Projectiles/Summon/MK2FlaskSummon.cs index 0e3cbe02f3..584baf87b8 100644 --- a/Projectiles/Summon/MK2FlaskSummon.cs +++ b/Projectiles/Summon/MK2FlaskSummon.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class MK2FlaskSummon : ModProjectile @@ -12,43 +13,43 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Flask"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 26; - projectile.height = 26; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.timeLeft = 240; + Projectile.friendly = true; + Projectile.width = 26; + Projectile.height = 26; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.timeLeft = 240; } public override void AI() { - projectile.velocity.Y += 0.2f; - projectile.rotation += 0.1f * (projectile.velocity.X > 0).ToDirectionInt(); + Projectile.velocity.Y += 0.2f; + Projectile.rotation += 0.1f * (Projectile.velocity.X > 0).ToDirectionInt(); } public override void Kill(int timeLeft) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { for (int i = 0; i < Main.rand.Next(18, 21); i++) { - Dust.NewDustPerfect(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + Dust.NewDustPerfect(Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), (int)CalamityDusts.Plague, Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } - Main.PlaySound(SoundID.Item107, projectile.Center); - int idx = Projectile.NewProjectile(projectile.Center, Vector2.UnitY * 6f, ModContent.ProjectileType(), projectile.damage, 4f, projectile.owner); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); + int idx = Projectile.NewProjectile(Projectile.Center, Vector2.UnitY * 6f, ModContent.ProjectileType(), Projectile.damage, 4f, Projectile.owner); int beeArrayIndex = 0; for (int i = 0; i < Main.projectile.Length; i++) { - if (Main.projectile[i].active && Main.projectile[i].owner == projectile.owner && Main.projectile[i].type == ModContent.ProjectileType()) + if (Main.projectile[i].active && Main.projectile[i].owner == Projectile.owner && Main.projectile[i].type == ModContent.ProjectileType()) { Main.projectile[i].ai[1] = beeArrayIndex; beeArrayIndex++; diff --git a/Projectiles/Summon/MK2RocketHoming.cs b/Projectiles/Summon/MK2RocketHoming.cs index b4785a598d..03d6d130a2 100644 --- a/Projectiles/Summon/MK2RocketHoming.cs +++ b/Projectiles/Summon/MK2RocketHoming.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class MK2RocketHoming : ModProjectile @@ -11,42 +12,42 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Rocket"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.extraUpdates = 1; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 14; + Projectile.height = 14; + Projectile.extraUpdates = 1; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - Player player = Main.player[projectile.owner]; - NPC potentialTarget = projectile.Center.MinionHoming(1000f, player); + Player player = Main.player[Projectile.owner]; + NPC potentialTarget = Projectile.Center.MinionHoming(1000f, player); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 24f + projectile.SafeDirectionTo(potentialTarget.Center) * 14f) / 25f; + Projectile.velocity = (Projectile.velocity * 24f + Projectile.SafeDirectionTo(potentialTarget.Center) * 14f) / 25f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } } @@ -57,12 +58,12 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 599) + if (Projectile.timeLeft > 599) return false; return true; } diff --git a/Projectiles/Summon/MK2RocketNormal.cs b/Projectiles/Summon/MK2RocketNormal.cs index c15caefb8c..b5b5a01d0c 100644 --- a/Projectiles/Summon/MK2RocketNormal.cs +++ b/Projectiles/Summon/MK2RocketNormal.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class MK2RocketNormal : ModProjectile @@ -11,38 +12,38 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Rocket"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.light = 0.5f; - projectile.extraUpdates = 1; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 14; + Projectile.height = 14; + Projectile.light = 0.5f; + Projectile.extraUpdates = 1; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -52,12 +53,12 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 599) + if (Projectile.timeLeft > 599) return false; return true; } diff --git a/Projectiles/Summon/MagicAxe.cs b/Projectiles/Summon/MagicAxe.cs index 36f9fc8cf2..3b03a922de 100644 --- a/Projectiles/Summon/MagicAxe.cs +++ b/Projectiles/Summon/MagicAxe.cs @@ -13,51 +13,51 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Axe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 52; - projectile.height = 52; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0; - projectile.timeLeft = 180; - projectile.penetrate = -1; - projectile.minion = true; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - projectile.alpha = 255; + Projectile.width = 52; + Projectile.height = 52; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0; + Projectile.timeLeft = 180; + Projectile.penetrate = -1; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.alpha = 255; } public override void AI() { - projectile.rotation += 0.075f; - projectile.alpha -= 50; + Projectile.rotation += 0.075f; + Projectile.alpha -= 50; counter++; if (counter == 30) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } else if (counter < 30) { return; } - projectile.ChargingMinionAI(MagicHat.Range, 1200f, 2500f, 400f, 1, 30f, 24f, 12f, new Vector2(0f, -60f), 30f, 16f, true, true, 3); + Projectile.ChargingMinionAI(MagicHat.Range, 1200f, 2500f, 400f, 1, 30f, 24f, 12f, new Vector2(0f, -60f), 30f, 16f, true, true, 3); } - public override Color? GetAlpha(Color lightColor) => new Color(0, 255, 111, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(0, 255, 111, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Summon/MagicBat.cs b/Projectiles/Summon/MagicBat.cs index 84dd3d0e15..e180e0e051 100644 --- a/Projectiles/Summon/MagicBat.cs +++ b/Projectiles/Summon/MagicBat.cs @@ -11,39 +11,39 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Baseball Bat"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 150; - projectile.Calamity().rogue = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 150; + Projectile.Calamity().rogue = true; } - public override void AI() => projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + public override void AI() => Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - public override Color? GetAlpha(Color lightColor) => new Color(80, 200, 120, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(80, 200, 120, Projectile.alpha); public override void Kill(int timeLeft) { for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); Main.dust[dust].noGravity = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Summon/MagicBird.cs b/Projectiles/Summon/MagicBird.cs index 0db80b7445..3e90688f2e 100644 --- a/Projectiles/Summon/MagicBird.cs +++ b/Projectiles/Summon/MagicBird.cs @@ -11,76 +11,76 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Bird"); - Main.projFrames[projectile.type] = 7; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 7; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 14; - projectile.height = 14; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.alpha = 255; - projectile.timeLeft = 180; + Projectile.friendly = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 180; } public override void AI() { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 7) + if (Projectile.frame >= 7) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.ai[0]++ % 20f == 0f) + if (Projectile.ai[0]++ % 20f == 0f) { - Vector2 dspeed = projectile.velocity * Main.rand.NextFloat(0.3f,0.6f); - int dust = Dust.NewDust(projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Vector2 dspeed = Projectile.velocity * Main.rand.NextFloat(0.3f,0.6f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); Main.dust[dust].noGravity = true; } //Homing - if (projectile.ai[1]++ > 30f) + if (Projectile.ai[1]++ > 30f) HomingAI(); //Fade in - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 15; + Projectile.alpha -= 15; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } private void HomingAI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int targetIdx = -1; float maxHomingRange = MagicHat.Range; bool hasHomingTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < maxHomingRange) { targetIdx = player.MinionAttackTargetNPC; @@ -97,9 +97,9 @@ namespace CalamityMod.Projectiles.Summon if (npc is null || !npc.active) continue; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); + float dist = (Projectile.Center - npc.Center).Length(); if (dist < maxHomingRange) { targetIdx = i; @@ -114,9 +114,9 @@ namespace CalamityMod.Projectiles.Summon if (hasHomingTarget) { NPC target = Main.npc[targetIdx]; - Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * 32f; + Vector2 homingVector = (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * 32f; float homingRatio = 15f; - projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); + Projectile.velocity = (Projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); } } @@ -125,16 +125,16 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); Main.dust[dust].noGravity = true; } } - public override Color? GetAlpha(Color lightColor) => new Color(255, 239, 0, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(255, 239, 0, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/MagicBullet.cs b/Projectiles/Summon/MagicBullet.cs index 378790cdb8..f387db0f99 100644 --- a/Projectiles/Summon/MagicBullet.cs +++ b/Projectiles/Summon/MagicBullet.cs @@ -13,25 +13,25 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 7; - projectile.scale = 1.18f; - projectile.friendly = true; - projectile.minion = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.extraUpdates = 7; + Projectile.scale = 1.18f; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -61,9 +61,9 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - return new Color(189, 51, 164, projectile.alpha); + return new Color(189, 51, 164, Projectile.alpha); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.timeLeft < 600; + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.timeLeft < 600; } } diff --git a/Projectiles/Summon/MagicHammer.cs b/Projectiles/Summon/MagicHammer.cs index 2378e7d723..a92c0273d6 100644 --- a/Projectiles/Summon/MagicHammer.cs +++ b/Projectiles/Summon/MagicHammer.cs @@ -12,45 +12,45 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Hammer"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 60; - projectile.height = 60; - projectile.alpha = 255; - projectile.friendly = true; - projectile.minion = true; - projectile.penetrate = 6; - projectile.timeLeft = 180; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 60; + Projectile.height = 60; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.penetrate = 6; + Projectile.timeLeft = 180; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } public override void AI() { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 10f && Main.rand.NextBool(3)) + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] > 10f && Main.rand.NextBool(3)) { - projectile.alpha -= 5; - if (projectile.alpha < 50) + Projectile.alpha -= 5; + if (Projectile.alpha < 50) { - projectile.alpha = 50; + Projectile.alpha = 50; } } - projectile.rotation += 0.075f; + Projectile.rotation += 0.075f; counter++; if (counter == 30) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } else if (counter < 30) { @@ -58,19 +58,19 @@ namespace CalamityMod.Projectiles.Summon } int targetIndex = -1; - Vector2 targetVec = projectile.Center; + Vector2 targetVec = Projectile.Center; float maxDistance = MagicHat.Range; - if (projectile.localAI[0] > 0f) + if (Projectile.localAI[0] > 0f) { - projectile.localAI[0] -= 1f; + Projectile.localAI[0] -= 1f; } - Player player = Main.player[projectile.owner]; - if (projectile.ai[0] == 0f && projectile.localAI[0] == 0f) + Player player = Main.player[Projectile.owner]; + if (Projectile.ai[0] == 0f && Projectile.localAI[0] == 0f) { if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == player.MinionAttackTargetNPC + 1f)) + if (npc.CanBeChasedBy(Projectile, false) && (Projectile.ai[0] == 0f || Projectile.ai[0] == player.MinionAttackTargetNPC + 1f)) { float targetDist = Vector2.Distance(npc.Center, targetVec); if (targetDist < maxDistance) @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.npc.Length; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == i + 1f)) + if (npc.CanBeChasedBy(Projectile, false) && (Projectile.ai[0] == 0f || Projectile.ai[0] == i + 1f)) { float targetDist = Vector2.Distance(npc.Center, targetVec); if (targetDist < maxDistance) @@ -98,20 +98,20 @@ namespace CalamityMod.Projectiles.Summon } if (targetIndex >= 0) { - projectile.ai[0] = targetIndex + 1f; - projectile.netUpdate = true; + Projectile.ai[0] = targetIndex + 1f; + Projectile.netUpdate = true; } } - if (projectile.localAI[0] == 0f && projectile.ai[0] == 0f) + if (Projectile.localAI[0] == 0f && Projectile.ai[0] == 0f) { - projectile.localAI[0] = 30f; + Projectile.localAI[0] = 30f; } bool canHome = false; - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { - int target = (int)(projectile.ai[0] - 1f); + int target = (int)(Projectile.ai[0] - 1f); NPC npc = Main.npc[target]; - if (npc.CanBeChasedBy(projectile, false) && npc.immune[projectile.owner] == 0) + if (npc.CanBeChasedBy(Projectile, false) && npc.immune[Projectile.owner] == 0) { float targetDist = Vector2.Distance(npc.Center, targetVec); if (targetDist < maxDistance * 1.25f) @@ -122,39 +122,39 @@ namespace CalamityMod.Projectiles.Summon } else { - projectile.ai[0] = 0f; + Projectile.ai[0] = 0f; canHome = false; - projectile.netUpdate = true; + Projectile.netUpdate = true; } } if (canHome) { - Vector2 velocity = targetVec - projectile.Center; - float trajectory = projectile.velocity.ToRotation(); + Vector2 velocity = targetVec - Projectile.Center; + float trajectory = Projectile.velocity.ToRotation(); float target = velocity.ToRotation(); float rotateAmt = target - trajectory; rotateAmt = MathHelper.WrapAngle(rotateAmt); - projectile.velocity = projectile.velocity.RotatedBy(rotateAmt * 0.25, default); + Projectile.velocity = Projectile.velocity.RotatedBy(rotateAmt * 0.25, default); } - float speed = projectile.velocity.Length(); - projectile.velocity.Normalize(); - projectile.velocity *= speed + 0.0025f; + float speed = Projectile.velocity.Length(); + Projectile.velocity.Normalize(); + Projectile.velocity *= speed + 0.0025f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override Color? GetAlpha(Color lightColor) => new Color(255, 56, 0, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(255, 56, 0, Projectile.alpha); public override void Kill(int timeLeft) { for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Summon/MagicHat.cs b/Projectiles/Summon/MagicHat.cs index 172d361f24..83ba0d855d 100644 --- a/Projectiles/Summon/MagicHat.cs +++ b/Projectiles/Summon/MagicHat.cs @@ -13,35 +13,35 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Magic Hat"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 5f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - CalamityGlobalProjectile modProj = projectile.Calamity(); + CalamityGlobalProjectile modProj = Projectile.Calamity(); //set up minion buffs and bools - bool hatExists = projectile.type == ModContent.ProjectileType(); + bool hatExists = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (hatExists) { @@ -51,52 +51,52 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.magicHat) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } //projectile movement - projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { - projectile.position.Y += 120f; - projectile.rotation = MathHelper.Pi; + Projectile.position.Y += 120f; + Projectile.rotation = MathHelper.Pi; } else { - projectile.rotation = 0f; + Projectile.rotation = 0f; } - projectile.position.X = (int)projectile.position.X; - projectile.position.Y = (int)projectile.position.Y; + Projectile.position.X = (int)Projectile.position.X; + Projectile.position.Y = (int)Projectile.position.Y; //Change the summons scale size a little bit to make it pulse in and out float scalar = (float)Main.mouseTextColor / 200f - 0.35f; scalar *= 0.2f; - projectile.scale = scalar + 0.95f; + Projectile.scale = scalar + 0.95f; //on summon dust and flexible damage - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { int dustAmt = 50; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - int dustEffects = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 234, 0f, 0f, 0, default, 1f); + int dustEffects = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 234, 0f, 0f, 0, default, 1f); Main.dust[dustEffects].velocity *= 2f; Main.dust[dustEffects].scale *= 1.15f; } modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + modProj.spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) { int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } //finding an enemy, then shooting projectiles if it's detected - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { float detectionRange = Range; bool enemyDetected = false; @@ -104,11 +104,11 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDistance = (npc.width / 2) + (npc.height / 2); - if (Vector2.Distance(npc.Center, projectile.Center) < (detectionRange + extraDistance)) + if (Vector2.Distance(npc.Center, Projectile.Center) < (detectionRange + extraDistance)) { enemyDetected = true; break; @@ -117,8 +117,8 @@ namespace CalamityMod.Projectiles.Summon } if (enemyDetected) { - projectile.ai[1] += 1f; - if (projectile.ai[1] % 5f == 0f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] % 5f == 0f) { int amount = Main.rand.Next(1, 2); for (int i = 0; i < amount; i++) @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Summon }); float velocityX = Main.rand.NextFloat(-10f, 10f); float velocityY = Main.rand.NextFloat(-15f, -8f); - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), velocityX, velocityY, projType, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.oldPosition.X + (float)(Projectile.width / 2), Projectile.oldPosition.Y + (float)(Projectile.height / 2), velocityX, velocityY, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Summon/MagicRifle.cs b/Projectiles/Summon/MagicRifle.cs index e47813df0d..c2d679eb03 100644 --- a/Projectiles/Summon/MagicRifle.cs +++ b/Projectiles/Summon/MagicRifle.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -11,36 +12,36 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Rifle"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 180; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 180; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; } public override void AI() { //Set player namespace - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; //Anti sticky movement to prevent overlapping minions - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); //Try not to do anything at first counter++; if (counter == 30) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } else if (counter < 30) { @@ -48,17 +49,17 @@ namespace CalamityMod.Projectiles.Summon } float homingRange = MagicHat.Range; - Vector2 targetVec = projectile.position; + Vector2 targetVec = Projectile.position; bool foundTarget = false; //If targeting something, prioritize that enemy if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); //Calculate distance between target and the projectile to know if it's too far or not - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); if (!foundTarget && targetDist < (homingRange + extraDist)) { homingRange = targetDist; @@ -72,11 +73,11 @@ namespace CalamityMod.Projectiles.Summon for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { NPC npc = Main.npc[npcIndex]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); //Calculate distance between target and the projectile to know if it's too far or not - float targetDist = Vector2.Distance(npc.Center, projectile.Center); + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); if (!foundTarget && targetDist < (homingRange + extraDist)) { homingRange = targetDist; @@ -94,16 +95,16 @@ namespace CalamityMod.Projectiles.Summon //Max travel distance increases if targeting something separationAnxietyDist = 2600f; } - if (Vector2.Distance(player.Center, projectile.Center) > separationAnxietyDist) + if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } //If a target is found, move toward it - if (foundTarget && projectile.ai[0] == 0f) + if (foundTarget && Projectile.ai[0] == 0f) { - Vector2 vecToTarget = targetVec - projectile.Center; + Vector2 vecToTarget = targetVec - Projectile.Center; float targetDist = vecToTarget.Length(); vecToTarget.Normalize(); //If farther than 200 pixels, move toward it @@ -111,14 +112,14 @@ namespace CalamityMod.Projectiles.Summon { float speedMult = 18f; //12 vecToTarget *= speedMult; - projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; } //Otherwise, back it up slowly else { float speedMult = -9f; vecToTarget *= speedMult; - projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; } } @@ -128,7 +129,7 @@ namespace CalamityMod.Projectiles.Summon bool returningToPlayer = false; if (!returningToPlayer) { - returningToPlayer = projectile.ai[0] == 1f; + returningToPlayer = Projectile.ai[0] == 1f; } //Move faster if actively returning to the player float speedMult = 12f; @@ -136,7 +137,7 @@ namespace CalamityMod.Projectiles.Summon { speedMult = 30f; } - Vector2 vecToPlayer = player.Center - projectile.Center + new Vector2(0f, -120f); + Vector2 vecToPlayer = player.Center - Projectile.Center + new Vector2(0f, -120f); float playerDist = vecToPlayer.Length(); //Speed up if near the player if (playerDist < 200f && speedMult < 16f) @@ -146,82 +147,82 @@ namespace CalamityMod.Projectiles.Summon //If close enough to the player, return to normal if (playerDist < 600f && returningToPlayer) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } //If abnormally far, teleport to the player if (playerDist > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } //Move toward player if more than 70 pixels away if (playerDist > 70f) { vecToPlayer.Normalize(); vecToPlayer *= speedMult; - projectile.velocity = (projectile.velocity * 40f + vecToPlayer) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vecToPlayer) / 41f; } //Move if still - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } } //Update rotation if (foundTarget) { - projectile.spriteDirection = projectile.direction = ((targetVec.X - projectile.Center.X) > 0).ToDirectionInt(); - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(targetVec) + (projectile.spriteDirection == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(135)), 0.1f); + Projectile.spriteDirection = Projectile.direction = ((targetVec.X - Projectile.Center.X) > 0).ToDirectionInt(); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(targetVec) + (Projectile.spriteDirection == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(135)), 0.1f); } else { - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(135)); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(135)); } //Increment attack cooldown - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += Main.rand.Next(1, 4); + Projectile.ai[1] += Main.rand.Next(1, 4); } //Set the minion to be ready for attack - if (projectile.ai[1] > 90f) + if (Projectile.ai[1] > 90f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } //Return if on attack cooldown, has no target, or returning to the player - if (projectile.ai[0] != 0f || !foundTarget || projectile.ai[1] != 0f) + if (Projectile.ai[0] != 0f || !foundTarget || Projectile.ai[1] != 0f) return; //Shoot a bullet - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { float projSpeed = 6f; int projType = ModContent.ProjectileType(); if (Main.rand.NextBool(6)) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20, 0.1f); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20, 0.1f); } - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner) { - Vector2 velocity = targetVec - projectile.Center; + Vector2 velocity = targetVec - Projectile.Center; velocity.Normalize(); velocity *= projSpeed; - Main.PlaySound(SoundID.Item40, projectile.position); - Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, 0f, projectile.owner); - projectile.netUpdate = true; + SoundEngine.PlaySound(SoundID.Item40, Projectile.position); + Projectile.NewProjectile(Projectile.Center, velocity, projType, Projectile.damage, 0f, Projectile.owner); + Projectile.netUpdate = true; } } } - public override Color? GetAlpha(Color lightColor) => new Color(148, 0, 211, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(148, 0, 211, Projectile.alpha); public override bool CanDamage() => false; @@ -230,7 +231,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Summon/MagicUmbrella.cs b/Projectiles/Summon/MagicUmbrella.cs index e3e5a930e2..5d634dbb4d 100644 --- a/Projectiles/Summon/MagicUmbrella.cs +++ b/Projectiles/Summon/MagicUmbrella.cs @@ -12,50 +12,50 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Umbrella"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 180; - projectile.penetrate = 10; - projectile.tileCollide = false; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.alpha = 255; + Projectile.width = 14; + Projectile.height = 14; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 180; + Projectile.penetrate = 10; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.alpha = 255; } public override void AI() { - projectile.rotation += 0.075f; - projectile.alpha -= 50; + Projectile.rotation += 0.075f; + Projectile.alpha -= 50; counter++; if (counter == 30) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } else if (counter < 30) { return; } - projectile.ChargingMinionAI(MagicHat.Range, 1600f, 2200f, 150f, 0, 40f, 9f, 4f, new Vector2(0f, -60f), 40f, 9f, true, true); + Projectile.ChargingMinionAI(MagicHat.Range, 1600f, 2200f, 150f, 0, 40f, 9f, 4f, new Vector2(0f, -60f), 40f, 9f, true, true); } - public override Color? GetAlpha(Color lightColor) => new Color(75, 255, 255, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(75, 255, 255, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 10; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); Main.dust[dust].noGravity = true; } } @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Summon targetDist = speed / targetDist; velocity.X *= targetDist; velocity.Y *= targetDist; - Projectile.NewProjectile(source, velocity, ModContent.ProjectileType(), (int)(projectile.damage * Main.rand.NextFloat(0.3f, 0.6f)), projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), projectile.owner, 0f, 0f); + Projectile.NewProjectile(source, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * Main.rand.NextFloat(0.3f, 0.6f)), Projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index e16ca33892..31bdb71d67 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -14,25 +14,25 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Mechworm"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.NeedsUUID[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 90000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.hide = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.minionSlots = 0.5f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.hide = true; } // Arbitrary function used to identify a projectile based owner and identity. @@ -182,18 +182,18 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { int _ = -1; - SegmentAI(projectile, 16, ref _); + SegmentAI(Projectile, 16, ref _); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - Vector2 drawPosition = projectile.Center - Main.screenPosition; - spriteBatch.Draw(tex, drawPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + spriteBatch.Draw(tex, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } - public override bool CanDamage() => projectile.alpha == 0; + public override bool CanDamage() => Projectile.alpha == 0; public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) { diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index 4d55aafefd..8b2e8c8240 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -9,6 +9,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -32,8 +33,8 @@ namespace CalamityMod.Projectiles.Summon internal const int LaserRedirectFrames = 30; internal const float MaxAttackFlySpeed = 33f; - internal ref float Time => ref projectile.ai[1]; - internal ref float TotalWormSegments => ref projectile.localAI[0]; + internal ref float Time => ref Projectile.ai[1]; + internal ref float TotalWormSegments => ref Projectile.localAI[0]; private static bool Use_TML_0_11_7_7_Hacky_Netcode = true; @@ -45,35 +46,35 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Mechworm"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - ProjectileID.Sets.NeedsUUID[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; if (ModLoader.version.CompareTo(new Version(0, 11, 7, 7)) > 0) { Use_TML_0_11_7_7_Hacky_Netcode = false; - mod.Logger.Info("ModLoader version > 0.11.7.7 detected. Mechworm UUID workaround is disabled."); + Mod.Logger.Info("ModLoader version > 0.11.7.7 detected. Mechworm UUID workaround is disabled."); } else - mod.Logger.Info("ModLoader version <= 0.11.7.7 detected. Mechworm UUID workaround is enabled."); + Mod.Logger.Info("ModLoader version <= 0.11.7.7 detected. Mechworm UUID workaround is enabled."); } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.penetrate = -1; - projectile.timeLeft = 18000; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.hide = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 18000; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.hide = true; } #region Syncing @@ -83,14 +84,14 @@ namespace CalamityMod.Projectiles.Summon // TML 0.11.7.7 SPECIFIC FIX (because they were too slow to update): Write an extra UUID here. // This is necessary because NetMessage case 27 and MessageBuffer case 27 are out of order with each other. if (Use_TML_0_11_7_7_Hacky_Netcode) - writer.Write((short)projectile.projUUID); + writer.Write((short)Projectile.projUUID); byte enumByte = (byte)CurrentAttackState; writer.Write(enumByte); writer.Write(AttackStateTimer); // localAI and alpha are not normally synced, so sync those writer.Write(TotalWormSegments); - writer.Write(projectile.alpha); + writer.Write(Projectile.alpha); writer.Write(EndRiftGateUUID); writer.WriteVector2(TeleportStartingPoint); writer.WriteVector2(TeleportEndingPoint); @@ -102,7 +103,7 @@ namespace CalamityMod.Projectiles.Summon CurrentAttackState = (AttackState)enumByte; AttackStateTimer = reader.ReadInt32(); TotalWormSegments = reader.ReadSingle(); - projectile.alpha = reader.ReadInt32(); + Projectile.alpha = reader.ReadInt32(); EndRiftGateUUID = reader.ReadInt32(); TeleportStartingPoint = reader.ReadVector2(); TeleportEndingPoint = reader.ReadVector2(); @@ -119,19 +120,19 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { // If the mechworm is opaque enough, produce light. - if (projectile.alpha <= 128) - Lighting.AddLight(projectile.Center, Color.DarkMagenta.ToVector3()); + if (Projectile.alpha <= 128) + Lighting.AddLight(Projectile.Center, Color.DarkMagenta.ToVector3()); // Stops the mechworm from getting too close to the world boundary. Projectiles can instantly cause crashes when they cross the world boundary. - projectile.Center = Vector2.Clamp(projectile.Center, WorldTopLeft(10), WorldBottomRight(10)); + Projectile.Center = Vector2.Clamp(Projectile.Center, WorldTopLeft(10), WorldBottomRight(10)); - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; // Produce some dust when the worm is summoned. if (Time < 3 && !Main.dedServ) for (int i = 0; i < 50; i++) { - Dust purpleElectricity = Dust.NewDustDirect(projectile.position + Vector2.UnitY * 16f, projectile.width, projectile.height - 16, 234, 0f, 0f, 0, default, 1f); + Dust purpleElectricity = Dust.NewDustDirect(Projectile.position + Vector2.UnitY * 16f, Projectile.width, Projectile.height - 16, 234, 0f, 0f, 0, default, 1f); purpleElectricity.velocity *= 2f; purpleElectricity.scale *= 1.15f; } @@ -142,49 +143,49 @@ namespace CalamityMod.Projectiles.Summon if (owner.dead) modPlayer.mWorm = false; if (modPlayer.mWorm) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; Time++; if (!Main.projectile.IndexInRange(EndRiftGateUUID)) { // Very rapidly fade-in. - projectile.alpha = Utils.Clamp(projectile.alpha - 42, 0, 255); + Projectile.alpha = Utils.Clamp(Projectile.alpha - 42, 0, 255); } - else if (projectile.Hitbox.Intersects(Main.projectile[EndRiftGateUUID].Hitbox)) + else if (Projectile.Hitbox.Intersects(Main.projectile[EndRiftGateUUID].Hitbox)) { // Disappear if touching the mechworm portal. // It will look like it's teleporting, when in reality, it's // just an invisible, uninteractable projectile for the time being. - if (projectile.alpha != 255) + if (Projectile.alpha != 255) { for (int i = 0; i < 35; i++) { - Dust burstDust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.PurpleCosmilite); + Dust burstDust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.PurpleCosmilite); burstDust.velocity = (MathHelper.TwoPi * i / 35f).ToRotationVector2().RotatedByRandom(0.035f) * 12f; burstDust.noGravity = true; - burstDust = Dust.NewDustDirect(projectile.Center, 70, 70, (int)CalamityDusts.PurpleCosmilite); + burstDust = Dust.NewDustDirect(Projectile.Center, 70, 70, (int)CalamityDusts.PurpleCosmilite); burstDust.velocity = Main.rand.NextVector2CircularEdge(6f, 6f); burstDust.scale = Main.rand.NextFloat(1.3f, 1.75f); } - Main.PlaySound(SoundID.Item8, projectile.Center); - projectile.alpha = 255; + SoundEngine.PlaySound(SoundID.Item8, Projectile.Center); + Projectile.alpha = 255; } } // Mechworm has an extremely generous default aggro range of 2200, but if it's already attacking, its bloodlust is insatiable. - NPC potentialTarget = projectile.Center.MinionHoming(AttackStateTimer > 0 ? 999999f : 2200f, owner); + NPC potentialTarget = Projectile.Center.MinionHoming(AttackStateTimer > 0 ? 999999f : 2200f, owner); // Teleport to the player if the worm is very far away from them. - if (projectile.Distance(owner.Center) > 2700f) + if (Projectile.Distance(owner.Center) > 2700f) { - projectile.Center = owner.Center; + Projectile.Center = owner.Center; // Reset the worm's velocity when it returns to the player so that it doesn't instantly yeet off somewhere. - projectile.velocity = Main.rand.NextVector2CircularEdge(3f, 3f); - projectile.netUpdate = true; + Projectile.velocity = Main.rand.NextVector2CircularEdge(3f, 3f); + Projectile.netUpdate = true; } // Don't bother attacking if the target is close to the world edge, to prevent issues. @@ -200,18 +201,18 @@ namespace CalamityMod.Projectiles.Summon else PlayerFollowMovement(owner); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; // Update the segment direction based on the velocity. - int previousDirection = projectile.direction; - projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0f).ToDirectionInt(); + int previousDirection = Projectile.direction; + Projectile.direction = Projectile.spriteDirection = (Projectile.velocity.X > 0f).ToDirectionInt(); // If it changed for some reason, fire a net update. This update cannot be blocked by netSpam. - if (previousDirection != projectile.direction) + if (previousDirection != Projectile.direction) { - projectile.netUpdate = true; - if (projectile.netSpam > 59) - projectile.netSpam = 59; + Projectile.netUpdate = true; + if (Projectile.netSpam > 59) + Projectile.netSpam = 59; } } @@ -220,7 +221,7 @@ namespace CalamityMod.Projectiles.Summon int tailType = ModContent.ProjectileType(); for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].type != tailType || !Main.projectile[i].active || Main.projectile[i].owner != projectile.owner) + if (Main.projectile[i].type != tailType || !Main.projectile[i].active || Main.projectile[i].owner != Projectile.owner) continue; return true; } @@ -235,18 +236,18 @@ namespace CalamityMod.Projectiles.Summon if (EndRiftGateUUID != -1) { EndRiftGateUUID = -1; - projectile.netUpdate = true; + Projectile.netUpdate = true; } // If any attack was in use previously, send a net update now that attack mode is off. if (AttackStateTimer != 0) { AttackStateTimer = 0; - projectile.netUpdate = true; + Projectile.netUpdate = true; } float hoverAcceleration = 0.2f; - float distanceFromOwner = projectile.Distance(owner.Center); + float distanceFromOwner = Projectile.Distance(owner.Center); if (distanceFromOwner < 200f) hoverAcceleration = 0.12f; if (distanceFromOwner < 140f) @@ -254,21 +255,21 @@ namespace CalamityMod.Projectiles.Summon if (distanceFromOwner > 100f) { - if (Math.Abs(owner.Center.X - projectile.Center.X) > 20f) - projectile.velocity.X += hoverAcceleration * Math.Sign(owner.Center.X - projectile.Center.X); - if (Math.Abs(owner.Center.Y - projectile.Center.Y) > 10f) - projectile.velocity.Y += hoverAcceleration * Math.Sign(owner.Center.Y - projectile.Center.Y); + if (Math.Abs(owner.Center.X - Projectile.Center.X) > 20f) + Projectile.velocity.X += hoverAcceleration * Math.Sign(owner.Center.X - Projectile.Center.X); + if (Math.Abs(owner.Center.Y - Projectile.Center.Y) > 10f) + Projectile.velocity.Y += hoverAcceleration * Math.Sign(owner.Center.Y - Projectile.Center.Y); } - else if (projectile.velocity.Length() > 1f) - projectile.velocity *= 0.96f; + else if (Projectile.velocity.Length() > 1f) + Projectile.velocity *= 0.96f; - if (Math.Abs(projectile.velocity.Y) < 1f) - projectile.velocity.Y -= 0.1f; + if (Math.Abs(Projectile.velocity.Y) < 1f) + Projectile.velocity.Y -= 0.1f; // The worm's max speed is more strictly capped for the first few seconds. float maxSpeed = Time < StartupLethargy ? 13f : 25f; - if (projectile.velocity.Length() > maxSpeed) - projectile.velocity = Vector2.Normalize(projectile.velocity) * maxSpeed; + if (Projectile.velocity.Length() > maxSpeed) + Projectile.velocity = Vector2.Normalize(Projectile.velocity) * maxSpeed; } private void LaserAttackMovement(NPC target) @@ -277,25 +278,25 @@ namespace CalamityMod.Projectiles.Summon if (EndRiftGateUUID != -1) { EndRiftGateUUID = -1; - projectile.netUpdate = true; + Projectile.netUpdate = true; } // If the timer indicates the worm is in redirect mode, then angle towards the target. if (AttackStateTimer % (LaserChargeFrames + LaserRedirectFrames) < LaserRedirectFrames) { float angularTurnSpeed = MathHelper.ToRadians(18f); - float newSpeed = MathHelper.Lerp(projectile.velocity.Length(), 24f, 0.35f); + float newSpeed = MathHelper.Lerp(Projectile.velocity.Length(), 24f, 0.35f); - if (projectile.Distance(target.Center) > 1100f) - newSpeed = MathHelper.Lerp(projectile.velocity.Length(), 38f, 0.35f); + if (Projectile.Distance(target.Center) > 1100f) + newSpeed = MathHelper.Lerp(Projectile.velocity.Length(), 38f, 0.35f); - projectile.velocity = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(target.Center), angularTurnSpeed).ToRotationVector2() * newSpeed; + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.AngleTo(target.Center), angularTurnSpeed).ToRotationVector2() * newSpeed; // If the worm is very close to aiming directly at the target, immediately switch from redirecting to charging. - if (Vector2.Dot(projectile.velocity.SafeNormalize(Vector2.Zero), projectile.SafeDirectionTo(target.Center)) > 0.86f) + if (Vector2.Dot(Projectile.velocity.SafeNormalize(Vector2.Zero), Projectile.SafeDirectionTo(target.Center)) > 0.86f) { AttackStateTimer += LaserRedirectFrames - (AttackStateTimer % LaserChargeFrames); - projectile.netUpdate = true; + Projectile.netUpdate = true; } } @@ -303,19 +304,19 @@ namespace CalamityMod.Projectiles.Summon if (AttackStateTimer % (LaserChargeFrames + LaserRedirectFrames) == LaserChargeFrames) { // Charge and fire three lasers. - projectile.velocity = projectile.SafeDirectionTo(target.Center) * MaxAttackFlySpeed; + Projectile.velocity = Projectile.SafeDirectionTo(target.Center) * MaxAttackFlySpeed; - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { for (int i = 0; i < 3; i++) { - Vector2 perturbedSpeed = projectile.velocity.RotatedBy(MathHelper.Lerp(-0.15f, 0.15f, i / 3f)) * 0.3f; - Projectile.NewProjectile(projectile.Center, perturbedSpeed, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-0.15f, 0.15f, i / 3f)) * 0.3f; + Projectile.NewProjectile(Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } - Main.PlaySound(SoundID.Item12, projectile.Center); - projectile.netUpdate = true; + SoundEngine.PlaySound(SoundID.Item12, Projectile.Center); + Projectile.netUpdate = true; } // If neither of the above if-statements trigger, the worm just moves forwards in a straight line and this AI function does nothing. @@ -328,7 +329,7 @@ namespace CalamityMod.Projectiles.Summon { CurrentAttackState = AttackState.LaserCharge; EndRiftGateUUID = -1; - projectile.netUpdate = true; + Projectile.netUpdate = true; return; } @@ -345,14 +346,14 @@ namespace CalamityMod.Projectiles.Summon TeleportEndingPoint = target.Center - offset; } else - TeleportEndingPoint = projectile.Center + projectile.velocity * chargeTime / 2f; + TeleportEndingPoint = Projectile.Center + Projectile.velocity * chargeTime / 2f; // On the starting frame of a teleport, spawn portals. - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(TeleportStartingPoint, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, projectile.owner); - int endGateIndex = Projectile.NewProjectile(TeleportEndingPoint, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, projectile.owner); - EndRiftGateUUID = Projectile.GetByUUID(projectile.owner, endGateIndex); + Projectile.NewProjectile(TeleportStartingPoint, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Projectile.owner); + int endGateIndex = Projectile.NewProjectile(TeleportEndingPoint, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Projectile.owner); + EndRiftGateUUID = Projectile.GetByUUID(Projectile.owner, endGateIndex); Main.projectile[EndRiftGateUUID].ai[0] = chargeTime; Main.projectile[EndRiftGateUUID].timeLeft = chargeTime; @@ -360,27 +361,27 @@ namespace CalamityMod.Projectiles.Summon // Dont teleport on the very first portal summon. if (AttackStateTimer != 0) - projectile.Center = TeleportStartingPoint; + Projectile.Center = TeleportStartingPoint; // Reset the alpha and position across the entire worm for the next charge. for (int i = 0; i < Main.maxProjectiles; i++) { Projectile otherProj = Main.projectile[i]; - if (!otherProj.active || otherProj.owner != projectile.owner || i == projectile.whoAmI) + if (!otherProj.active || otherProj.owner != Projectile.owner || i == Projectile.whoAmI) continue; if (otherProj.type == ModContent.ProjectileType() || otherProj.type == ModContent.ProjectileType()) { otherProj.alpha = 0; if (AttackStateTimer != 0) - otherProj.Center = projectile.Center; + otherProj.Center = Projectile.Center; // There is no need to set the other projectiles to net update. They will do so when the head does. } } - projectile.alpha = 0; - projectile.velocity = projectile.SafeDirectionTo(TeleportEndingPoint) * (MaxAttackFlySpeed + target.velocity.Length() * 0.45f); - projectile.netUpdate = true; + Projectile.alpha = 0; + Projectile.velocity = Projectile.SafeDirectionTo(TeleportEndingPoint) * (MaxAttackFlySpeed + target.velocity.Length() * 0.45f); + Projectile.netUpdate = true; } } @@ -395,7 +396,7 @@ namespace CalamityMod.Projectiles.Summon CurrentAttackState = CurrentAttackState == AttackState.LaserCharge ? AttackState.PortalGateCharge : AttackState.LaserCharge; AttackStateTimer = 0; - projectile.netUpdate = true; + Projectile.netUpdate = true; } } @@ -405,7 +406,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxProjectiles; i++) { Projectile proj = Main.projectile[i]; - if (proj.type != portalType || !proj.active || proj.owner != projectile.owner) + if (proj.type != portalType || !proj.active || proj.owner != Projectile.owner) continue; proj.Kill(); @@ -421,17 +422,17 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.alpha > 200) + if (Projectile.alpha > 200) return; Vector2 origin = new Vector2(21f, 25f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Summon/MechwormHeadGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Summon/MechwormHeadGlow"), Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); } public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) diff --git a/Projectiles/Summon/MechwormLaser.cs b/Projectiles/Summon/MechwormLaser.cs index 0ed2a1b3da..a9e8c0e15f 100644 --- a/Projectiles/Summon/MechwormLaser.cs +++ b/Projectiles/Summon/MechwormLaser.cs @@ -14,57 +14,57 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Laser"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 4; - projectile.extraUpdates = 2; - projectile.timeLeft = 600; - projectile.minion = true; - projectile.minionSlots = 0; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 4; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 600; + Projectile.minion = true; + Projectile.minionSlots = 0; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() { // Very quickly fade in. - projectile.alpha = Utils.Clamp(projectile.alpha - 25, 0, 255); + Projectile.alpha = Utils.Clamp(Projectile.alpha - 25, 0, 255); - Lighting.AddLight(projectile.Center, Color.Cyan.ToVector3()); - if (projectile.ai[1] == 0f) + Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3()); + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += 6f; - if (projectile.localAI[0] > 30) - projectile.localAI[0] = 30; + Projectile.localAI[0] += 6f; + if (Projectile.localAI[0] > 30) + Projectile.localAI[0] = 30; } else { - projectile.localAI[0] -= 6f; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= 6f; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); } } } - public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.Fuchsia, Color.Cyan, (float)Math.Sin(Main.GlobalTime * 1.9f + projectile.identity * 2.4f) * 0.5f + 0.5f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.Fuchsia, Color.Cyan, (float)Math.Sin(Main.GlobalTime * 1.9f + Projectile.identity * 2.4f) * 0.5f + 0.5f); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(100f, 3f, lightColor); public override void Kill(int timeLeft) { int dustAmt = Main.rand.Next(3, 7); for (int d = 0; d < dustAmt; d++) { - int rainbow = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.1f); + int rainbow = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.1f); Main.dust[rainbow].velocity *= 2f; Main.dust[rainbow].noGravity = true; } diff --git a/Projectiles/Summon/MechwormTail.cs b/Projectiles/Summon/MechwormTail.cs index a00363ac84..a68642810e 100644 --- a/Projectiles/Summon/MechwormTail.cs +++ b/Projectiles/Summon/MechwormTail.cs @@ -15,31 +15,31 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Mechworm"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.NeedsUUID[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.netImportant = true; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.hide = true; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.netImportant = true; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.hide = true; } public override void AI() { - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; if (owner.maxMinions > playerMinionSlots) playerMinionSlots = owner.maxMinions; @@ -49,20 +49,20 @@ namespace CalamityMod.Projectiles.Summon playerMinionSlots = owner.maxMinions; } - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; - MechwormBody.SegmentAI(projectile, 16, ref playerMinionSlots); + MechwormBody.SegmentAI(Projectile, 16, ref playerMinionSlots); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - Vector2 drawPosition = projectile.Center - Main.screenPosition; - spriteBatch.Draw(tex, drawPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + spriteBatch.Draw(tex, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } - public override bool CanDamage() => projectile.alpha == 0; + public override bool CanDamage() => Projectile.alpha == 0; public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) { diff --git a/Projectiles/Summon/MechwormTeleportRift.cs b/Projectiles/Summon/MechwormTeleportRift.cs index dbc46cb77d..68d97136b2 100644 --- a/Projectiles/Summon/MechwormTeleportRift.cs +++ b/Projectiles/Summon/MechwormTeleportRift.cs @@ -11,40 +11,40 @@ namespace CalamityMod.Projectiles.Summon { public override string Texture => "CalamityMod/Projectiles/StarProj"; - public ref float GeneralRotationalOffset => ref projectile.ai[0]; + public ref float GeneralRotationalOffset => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Rift"); - ProjectileID.Sets.NeedsUUID[projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 170; - projectile.scale = 0.25f; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.Opacity = 0f; - projectile.penetrate = -1; - projectile.timeLeft = 45; - projectile.netImportant = true; + Projectile.width = Projectile.height = 170; + Projectile.scale = 0.25f; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.Opacity = 0f; + Projectile.penetrate = -1; + Projectile.timeLeft = 45; + Projectile.netImportant = true; } public override void AI() { - if (projectile.ai[0] == 0f) - projectile.ai[0] = 45f; + if (Projectile.ai[0] == 0f) + Projectile.ai[0] = 45f; GeneralRotationalOffset += MathHelper.Pi / 8f; - projectile.Opacity = MathHelper.Clamp(GeneralRotationalOffset, 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(GeneralRotationalOffset, 0f, 1f); - if (projectile.Opacity == 1f && Main.rand.NextBool(15)) + if (Projectile.Opacity == 1f && Main.rand.NextBool(15)) { - Dust dust = Dust.NewDustDirect(projectile.Center, 0, 0, 267, 0f, 0f, 100, new Color(150, 100, 255, 255), 1f); + Dust dust = Dust.NewDustDirect(Projectile.Center, 0, 0, 267, 0f, 0f, 100, new Color(150, 100, 255, 255), 1f); dust.velocity.X = 0f; dust.noGravity = true; - dust.position = projectile.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(4f, 20f); + dust.position = Projectile.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(4f, 20f); dust.fadeIn = 1f; dust.scale = 0.5f; } @@ -52,12 +52,12 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - float currentFade = Utils.InverseLerp(0f, 5f, projectile.timeLeft, true) * Utils.InverseLerp(projectile.ai[0], projectile.ai[0] - 5f, projectile.timeLeft, true); + float currentFade = Utils.InverseLerp(0f, 5f, Projectile.timeLeft, true) * Utils.InverseLerp(Projectile.ai[0], Projectile.ai[0] - 5f, Projectile.timeLeft, true); currentFade *= (1f + 0.2f * (float)Math.Cos(Main.GlobalTime % 30f * MathHelper.Pi * 3f)) * 0.8f; - Texture2D texture = Main.projectileTexture[projectile.type]; - Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - Color baseColor = new Color(150, 100, 255, 255) * projectile.Opacity; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color baseColor = new Color(150, 100, 255, 255) * Projectile.Opacity; baseColor *= 0.5f; baseColor.A = 0; Color colorA = baseColor; @@ -65,10 +65,10 @@ namespace CalamityMod.Projectiles.Summon colorA *= currentFade; colorB *= currentFade; Vector2 origin = texture.Size() / 2f; - Vector2 scale = new Vector2(3f, 7f) * projectile.Opacity * projectile.scale * currentFade; + Vector2 scale = new Vector2(3f, 7f) * Projectile.Opacity * Projectile.scale * currentFade; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver2, origin, scale, spriteEffects, 0); diff --git a/Projectiles/Summon/MidnightSunBeaconProj.cs b/Projectiles/Summon/MidnightSunBeaconProj.cs index 355f5f3d32..a7c1d8c0e7 100644 --- a/Projectiles/Summon/MidnightSunBeaconProj.cs +++ b/Projectiles/Summon/MidnightSunBeaconProj.cs @@ -12,46 +12,46 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Midnight Sun Beacon"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 32; - projectile.height = 32; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 420; + Projectile.friendly = true; + Projectile.width = 32; + Projectile.height = 32; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 420; } public override void AI() { - projectile.rotation = projectile.rotation.AngleLerp(-MathHelper.PiOver4, 0.08f); - if (Math.Abs(projectile.rotation + MathHelper.PiOver4) < 0.02f && projectile.ai[0] == 0f) + Projectile.rotation = Projectile.rotation.AngleLerp(-MathHelper.PiOver4, 0.08f); + if (Math.Abs(Projectile.rotation + MathHelper.PiOver4) < 0.02f && Projectile.ai[0] == 0f) { - projectile.ai[1] = 85f; - projectile.ai[0] = 1f; + Projectile.ai[1] = 85f; + Projectile.ai[0] = 1f; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - Projectile.NewProjectile(projectile.Center, Vector2.UnitY * 30f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, - projectile.owner); - projectile.Kill(); + Projectile.NewProjectile(Projectile.Center, Vector2.UnitY * 30f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, + Projectile.owner); + Projectile.Kill(); } - if (projectile.ai[1] > 0) - projectile.ai[1]--; - if (projectile.ai[1] > 1f && - projectile.ai[1] <= 60f) + if (Projectile.ai[1] > 0) + Projectile.ai[1]--; + if (Projectile.ai[1] > 1f && + Projectile.ai[1] <= 60f) { - projectile.velocity.Y -= 0.4f; + Projectile.velocity.Y -= 0.4f; } else - projectile.velocity *= 0.96f; + Projectile.velocity *= 0.96f; } public override bool CanDamage() => false; } diff --git a/Projectiles/Summon/MidnightSunBeam.cs b/Projectiles/Summon/MidnightSunBeam.cs index b297c99203..09760c1e07 100644 --- a/Projectiles/Summon/MidnightSunBeam.cs +++ b/Projectiles/Summon/MidnightSunBeam.cs @@ -16,22 +16,22 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = TrueTimeLeft; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; + Projectile.width = 18; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = TrueTimeLeft; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; } // Netcode for sending and receiving shit @@ -39,105 +39,105 @@ namespace CalamityMod.Projectiles.Summon public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - Projectile body = Main.projectile[(int)projectile.ai[1]]; + Projectile body = Main.projectile[(int)Projectile.ai[1]]; if (body.type != ModContent.ProjectileType() || !body.active) - projectile.Kill(); + Projectile.Kill(); - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) { - projectile.velocity = -Vector2.UnitY; + Projectile.velocity = -Vector2.UnitY; } - if (Main.projectile[(int)projectile.ai[1]].active) + if (Main.projectile[(int)Projectile.ai[1]].active) { - projectile.Center = Main.projectile[(int)projectile.ai[1]].Center; + Projectile.Center = Main.projectile[(int)Projectile.ai[1]].Center; } - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) { - projectile.velocity = -Vector2.UnitY; + Projectile.velocity = -Vector2.UnitY; } // How fat the laser is float laserSize = 1f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= TrueTimeLeft) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= TrueTimeLeft) { - projectile.Kill(); + Projectile.Kill(); return; } // Causes the effect where the laser appears to expand/contract at the beginning and end of its life - projectile.scale = (float)Math.Sin(projectile.localAI[0] * MathHelper.Pi / TrueTimeLeft) * 10f * laserSize; - if (projectile.scale > laserSize) + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * MathHelper.Pi / TrueTimeLeft) * 10f * laserSize; + if (Projectile.scale > laserSize) { - projectile.scale = laserSize; + Projectile.scale = laserSize; } // The heart of the "sweeping rotation" part of the laser // Basically converts the velocity to a rotation, increments some value to that rotation, // and then converts the rotation to a velocity float velocityAsRotation = body.rotation + MathHelper.PiOver2; - projectile.rotation = velocityAsRotation - MathHelper.PiOver2; - projectile.velocity = velocityAsRotation.ToRotationVector2(); + Projectile.rotation = velocityAsRotation - MathHelper.PiOver2; + Projectile.velocity = velocityAsRotation.ToRotationVector2(); - Vector2 samplingPoint = projectile.Center; + Vector2 samplingPoint = Projectile.Center; float[] samples = new float[3]; - projectile.localAI[1] = body.ai[1]; + Projectile.localAI[1] = body.ai[1]; // Draw light blue light across the laser DelegateMethods.v3_1 = new Vector3(0.52f, 0.93f, 0.97f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) { return false; } - Texture2D laserTailTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/MidnightSunBeamBegin"); - Texture2D laserBodyTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/MidnightSunBeamMid"); - Texture2D laserHeadTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/MidnightSunBeamEnd"); - float laserLength = projectile.localAI[1]; + Texture2D laserTailTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/MidnightSunBeamBegin"); + Texture2D laserBodyTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/MidnightSunBeamMid"); + Texture2D laserHeadTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/MidnightSunBeamEnd"); + float laserLength = Projectile.localAI[1]; Color drawColor = new Color(1f, 1f, 1f) * 0.9f; // Laser tail logic - Main.spriteBatch.Draw(laserTailTexture, projectile.Center - Main.screenPosition, null, drawColor, projectile.rotation, laserTailTexture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(laserTailTexture, Projectile.Center - Main.screenPosition, null, drawColor, Projectile.rotation, laserTailTexture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); // Laser body logic - laserLength -= (laserTailTexture.Height / 2 + laserHeadTexture.Height) * projectile.scale; - Vector2 centerDelta = projectile.Center; - centerDelta += projectile.velocity * projectile.scale * (float)laserTailTexture.Height / 2f; + laserLength -= (laserTailTexture.Height / 2 + laserHeadTexture.Height) * Projectile.scale; + Vector2 centerDelta = Projectile.Center; + centerDelta += Projectile.velocity * Projectile.scale * (float)laserTailTexture.Height / 2f; if (laserLength > 0f) { float laserLengthDelta = 0f; - Rectangle sourceRectangle = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 16); + Rectangle sourceRectangle = new Rectangle(0, 16 * (Projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 16); while (laserLengthDelta + 1f < laserLength) { if (laserLength - laserLengthDelta < sourceRectangle.Height) { sourceRectangle.Height = (int)(laserLength - laserLengthDelta); } - Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); - laserLengthDelta += sourceRectangle.Height * projectile.scale; - centerDelta += projectile.velocity * sourceRectangle.Height * projectile.scale; + Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, Projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), Projectile.scale, SpriteEffects.None, 0f); + laserLengthDelta += sourceRectangle.Height * Projectile.scale; + centerDelta += Projectile.velocity * sourceRectangle.Height * Projectile.scale; sourceRectangle.Y += 16; if (sourceRectangle.Y + sourceRectangle.Height > laserBodyTexture.Height) { @@ -148,15 +148,15 @@ namespace CalamityMod.Projectiles.Summon // Laser head logic - Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, projectile.rotation, laserHeadTexture.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, Projectile.rotation, laserHeadTexture.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Projectile.localAI[1], (float)Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -166,7 +166,7 @@ namespace CalamityMod.Projectiles.Summon return true; } float value = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref value)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref value)) { return true; } diff --git a/Projectiles/Summon/MidnightSunShot.cs b/Projectiles/Summon/MidnightSunShot.cs index 906334b153..b40eef9c92 100644 --- a/Projectiles/Summon/MidnightSunShot.cs +++ b/Projectiles/Summon/MidnightSunShot.cs @@ -10,30 +10,30 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Midnight Shot"); - Main.projFrames[projectile.type] = 1; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 1; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.alpha = 255; - projectile.MaxUpdates = 3; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.alpha = 255; + Projectile.MaxUpdates = 3; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = 1; - projectile.timeLeft = 120; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Summon/MidnightSunUFO.cs b/Projectiles/Summon/MidnightSunUFO.cs index 46e2479b34..bf8c92be75 100644 --- a/Projectiles/Summon/MidnightSunUFO.cs +++ b/Projectiles/Summon/MidnightSunUFO.cs @@ -7,6 +7,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -16,53 +17,53 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Midnight Sun UFO"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.SentryShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 58; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; + Projectile.width = 26; + Projectile.height = 58; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; } public override bool CanDamage() => false; public override void AI() { - Lighting.AddLight(projectile.Center, Color.SkyBlue.ToVector3()); - Player player = Main.player[projectile.owner]; + Lighting.AddLight(Projectile.Center, Color.SkyBlue.ToVector3()); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.velocity.Y = Main.rand.NextFloat(8f, 11f) * Main.rand.NextBool(2).ToDirectionInt(); - projectile.velocity.Y = Main.rand.NextFloat(3f, 5f) * Main.rand.NextBool(2).ToDirectionInt(); + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.velocity.Y = Main.rand.NextFloat(8f, 11f) * Main.rand.NextBool(2).ToDirectionInt(); + Projectile.velocity.Y = Main.rand.NextFloat(3f, 5f) * Main.rand.NextBool(2).ToDirectionInt(); // This AI variable doubles as the random frame on which this UFO chooses to shoot its machine gun. - projectile.localAI[0] = Main.rand.Next(1, (int)MidnightSunBeacon.MachineGunRate); + Projectile.localAI[0] = Main.rand.Next(1, (int)MidnightSunBeacon.MachineGunRate); } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) { @@ -72,78 +73,78 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.midnightUFO) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); + NPC potentialTarget = Projectile.Center.MinionHoming(DistanceToCheck, player); - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } if (potentialTarget != null) { - projectile.ai[0]++; - if (projectile.ai[0] % 360f < 180f) + Projectile.ai[0]++; + if (Projectile.ai[0] % 360f < 180f) { - projectile.rotation = projectile.rotation.AngleTowards(0f, 0.2f); - float angle = MathHelper.ToRadians(2f * projectile.ai[0] % 180f); + Projectile.rotation = Projectile.rotation.AngleTowards(0f, 0.2f); + float angle = MathHelper.ToRadians(2f * Projectile.ai[0] % 180f); Vector2 destination = potentialTarget.Center - new Vector2((float)Math.Cos(angle) * potentialTarget.width * 0.65f, 250f); - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(destination) * 24f, 0.03f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(destination) * 24f, 0.03f); - if (projectile.ai[0] % MidnightSunBeacon.MachineGunRate == projectile.localAI[0] && potentialTarget.Top.Y > projectile.Bottom.Y) + if (Projectile.ai[0] % MidnightSunBeacon.MachineGunRate == Projectile.localAI[0] && potentialTarget.Top.Y > Projectile.Bottom.Y) { - Vector2 laserVelocity = projectile.SafeDirectionTo(potentialTarget.Center, Vector2.UnitY).RotatedByRandom(0.15f) * 25f; - Projectile.NewProjectile(projectile.Bottom, laserVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Vector2 laserVelocity = Projectile.SafeDirectionTo(potentialTarget.Center, Vector2.UnitY).RotatedByRandom(0.15f) * 25f; + Projectile.NewProjectile(Projectile.Bottom, laserVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } - projectile.MinionAntiClump(0.35f); - projectile.ai[1] = 0f; + Projectile.MinionAntiClump(0.35f); + Projectile.ai[1] = 0f; } else { // Move very, very quickly above the target. - Vector2 hoverDestination = potentialTarget.Top - Vector2.UnitY * 40f + (projectile.minionPos + projectile.ai[0] / 7f).ToRotationVector2() * 40f; - projectile.Center = Vector2.Lerp(projectile.Center, hoverDestination, 0.1f).MoveTowards(hoverDestination, 20f); - projectile.velocity = projectile.velocity.MoveTowards(Vector2.Zero, 4f); - projectile.ai[1] = Math.Abs(hoverDestination.Y - potentialTarget.Bottom.Y) + MathHelper.Lerp(30f, 50f, projectile.identity % 7f / 7f); + Vector2 hoverDestination = potentialTarget.Top - Vector2.UnitY * 40f + (Projectile.minionPos + Projectile.ai[0] / 7f).ToRotationVector2() * 40f; + Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.1f).MoveTowards(hoverDestination, 20f); + Projectile.velocity = Projectile.velocity.MoveTowards(Vector2.Zero, 4f); + Projectile.ai[1] = Math.Abs(hoverDestination.Y - potentialTarget.Bottom.Y) + MathHelper.Lerp(30f, 50f, Projectile.identity % 7f / 7f); - if (projectile.ai[0] % 360f == 240f) + if (Projectile.ai[0] % 360f == 240f) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Main.PlaySound(SoundID.Item122, projectile.Center); - Vector2 laserVelocity = projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.UnitY); - Projectile.NewProjectile(projectile.Center, laserVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, projectile.whoAmI); + SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); + Vector2 laserVelocity = Projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.UnitY); + Projectile.NewProjectile(Projectile.Center, laserVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, Projectile.whoAmI); } } } } else { - projectile.velocity = (projectile.velocity * 15f + projectile.SafeDirectionTo(player.Center - new Vector2(player.direction * -80f, 160f)) * 19f) / 16f; + Projectile.velocity = (Projectile.velocity * 15f + Projectile.SafeDirectionTo(player.Center - new Vector2(player.direction * -80f, 160f)) * 19f) / 16f; - Vector2 distanceVector = player.Center - projectile.Center; + Vector2 distanceVector = player.Center - Projectile.Center; if (distanceVector.Length() > DistanceToCheck * 1.5f) { - projectile.Center = player.Center; - projectile.netUpdate = true; + Projectile.Center = player.Center; + Projectile.netUpdate = true; } - projectile.MinionAntiClump(0.35f); - projectile.rotation = projectile.velocity.X * 0.03f; + Projectile.MinionAntiClump(0.35f); + Projectile.rotation = Projectile.velocity.X * 0.03f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index 99078e2af6..9294140b62 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -15,23 +15,23 @@ namespace CalamityMod.Projectiles.Summon private int ai = 3; private void updateDamage(int type) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); float baseDamage = (modPlayer.profanedCrystal && !modPlayer.profanedCrystalBuffs) ? 0f : (75f + (modPlayer.profanedCrystalBuffs ? 420f : 0f)); - projectile.damage = baseDamage == 0 ? 0 : (int)(baseDamage * player.MinionDamage() * 0.7f); + Projectile.damage = baseDamage == 0 ? 0 : (int)(baseDamage * player.MinionDamage() * 0.7f); ai = type; if (baseDamage >= 420f) { - projectile.localNPCHitCooldown = 6; + Projectile.localNPCHitCooldown = 6; } else if (baseDamage == 0) { - projectile.localNPCHitCooldown = 69; + Projectile.localNPCHitCooldown = 69; } else { - projectile.localNPCHitCooldown = 9; + Projectile.localNPCHitCooldown = 9; } } @@ -52,18 +52,18 @@ namespace CalamityMod.Projectiles.Summon { case 1: //offensive bab (profaned soul artifact) case 2: //Empowered bab WEEEEEEEEEE (profaned soul crystal) - if (projectile.ai[1] <= -1f) + if (Projectile.ai[1] <= -1f) { - projectile.ai[1] = 17f; + Projectile.ai[1] = 17f; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] -= type; + Projectile.ai[1] -= type; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { float num550 = 24f; //12 - Vector2 vector43 = projectile.Center; + Vector2 vector43 = Projectile.Center; float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -80,51 +80,51 @@ namespace CalamityMod.Projectiles.Summon num553 = num550 / num553; num551 *= num553; num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * (type == 1 ? 12f : 20f) + num551) / (type == 1 ? 13f : 21f); - projectile.velocity.Y = (projectile.velocity.Y * (type == 1 ? 12f : 20f) + num552) / (type == 1 ? 13f : 21f); + Projectile.velocity.X = (Projectile.velocity.X * (type == 1 ? 12f : 20f) + num551) / (type == 1 ? 13f : 21f); + Projectile.velocity.Y = (Projectile.velocity.Y * (type == 1 ? 12f : 20f) + num552) / (type == 1 ? 13f : 21f); } else { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 10f) { - projectile.velocity *= 1.05f; + Projectile.velocity *= 1.05f; } } break; case 3: //bored bab - (idle) float num16 = 0.5f; - projectile.tileCollide = false; + Projectile.tileCollide = false; int num17 = 100; - Vector2 vector3 = projectile.Center; + Vector2 vector3 = Projectile.Center; float num18 = player.Center.X - vector3.X; float num19 = player.Center.Y - vector3.Y; num19 += (float)Main.rand.Next(-10, 21); num18 += (float)Main.rand.Next(-10, 21); - num18 += (float)(60 * -(float)Main.player[projectile.owner].direction); + num18 += (float)(60 * -(float)Main.player[Projectile.owner].direction); num19 -= 60f; float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); float num21 = 18f; if (num20 < (float)num17 && player.velocity.Y == 0f && - projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && - !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + Projectile.position.Y + (float)Projectile.height <= player.position.Y + (float)player.height && + !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - if (projectile.velocity.Y < -6f) + Projectile.ai[0] = 0f; + if (Projectile.velocity.Y < -6f) { - projectile.velocity.Y = -6f; + Projectile.velocity.Y = -6f; } } if (num20 > 2000f) { - projectile.position = player.position; - projectile.netUpdate = true; + Projectile.position = player.position; + Projectile.netUpdate = true; } if (num20 < 50f) { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f) { - projectile.velocity *= 0.90f; + Projectile.velocity *= 0.90f; } num16 = 0.01f; } @@ -143,36 +143,36 @@ namespace CalamityMod.Projectiles.Summon num19 *= num20; } - if (projectile.velocity.X < num18) + if (Projectile.velocity.X < num18) { - projectile.velocity.X += num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) + Projectile.velocity.X += num16; + if (num16 > 0.05f && Projectile.velocity.X < 0f) { - projectile.velocity.X += num16; + Projectile.velocity.X += num16; } } - if (projectile.velocity.X > num18) + if (Projectile.velocity.X > num18) { - projectile.velocity.X -= num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) + Projectile.velocity.X -= num16; + if (num16 > 0.05f && Projectile.velocity.X > 0f) { - projectile.velocity.X -= num16; + Projectile.velocity.X -= num16; } } - if (projectile.velocity.Y < num19) + if (Projectile.velocity.Y < num19) { - projectile.velocity.Y += num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) + Projectile.velocity.Y += num16; + if (num16 > 0.05f && Projectile.velocity.Y < 0f) { - projectile.velocity.Y += num16 * 2f; + Projectile.velocity.Y += num16 * 2f; } } - if (projectile.velocity.Y > num19) + if (Projectile.velocity.Y > num19) { - projectile.velocity.Y -= num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) + Projectile.velocity.Y -= num16; + if (num16 > 0.05f && Projectile.velocity.Y > 0f) { - projectile.velocity.Y -= num16 * 2f; + Projectile.velocity.Y -= num16 * 2f; } } break; @@ -182,33 +182,33 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Offensive Guardian"); // *swears at u* - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.tileCollide = false; - projectile.width = 60; - projectile.height = 88; - projectile.minionSlots = 0f; - projectile.minion = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 18000; - projectile.timeLeft *= 5; - projectile.usesLocalNPCImmunity = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Projectile.netImportant = true; + Projectile.tileCollide = false; + Projectile.width = 60; + Projectile.height = 88; + Projectile.minionSlots = 0f; + Projectile.minion = true; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 18000; + Projectile.timeLeft *= 5; + Projectile.usesLocalNPCImmunity = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (Main.player[projectile.owner].Calamity().profanedCrystalBuffs && !Main.player[projectile.owner].Calamity().endoCooper) + if (Main.player[Projectile.owner].Calamity().profanedCrystalBuffs && !Main.player[Projectile.owner].Calamity().endoCooper) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } else @@ -219,14 +219,14 @@ namespace CalamityMod.Projectiles.Summon public override bool? CanCutTiles() { - if (projectile.damage == 0) + if (Projectile.damage == 0) return false; return null; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { @@ -234,25 +234,25 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.gOffense) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } if (!modPlayer.pArtifact || (!modPlayer.profanedCrystal && !modPlayer.WearingPostMLSummonerSet)) { modPlayer.gOffense = false; - projectile.active = false; + Projectile.active = false; return; } - projectile.MinionAntiClump(); - float num535 = projectile.position.X; - float num536 = projectile.position.Y; + Projectile.MinionAntiClump(); + float num535 = Projectile.position.X; + float num536 = Projectile.position.Y; float num537 = 3000f; bool flag19 = false; - NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) + NPC ownerMinionAttackTargetNPC2 = Projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(Projectile, false)) { float num539 = ownerMinionAttackTargetNPC2.Center.X; float num540 = ownerMinionAttackTargetNPC2.Center.Y; - float num541 = Math.Abs(projectile.Center.X - num539) + Math.Abs(projectile.Center.Y - num540); + float num541 = Math.Abs(Projectile.Center.X - num539) + Math.Abs(Projectile.Center.Y - num540); if (num541 < num537) { num537 = num541; @@ -266,11 +266,11 @@ namespace CalamityMod.Projectiles.Summon int num3; for (int num542 = 0; num542 < Main.maxNPCs; num542 = num3 + 1) { - if (Main.npc[num542].CanBeChasedBy(projectile, false)) + if (Main.npc[num542].CanBeChasedBy(Projectile, false)) { float num543 = Main.npc[num542].Center.X; float num544 = Main.npc[num542].Center.Y; - float num545 = Math.Abs(projectile.Center.X - num543) + Math.Abs(projectile.Center.Y - num544); + float num545 = Math.Abs(Projectile.Center.X - num543) + Math.Abs(Projectile.Center.Y - num544); if (num545 < num537) { num537 = num545; @@ -282,7 +282,7 @@ namespace CalamityMod.Projectiles.Summon num3 = num542; } } - if (!flag19 || projectile.damage == 0) + if (!flag19 || Projectile.damage == 0) { AI(3, num535, num536, player); } @@ -295,43 +295,43 @@ namespace CalamityMod.Projectiles.Summon AI(1, num535, num536, player); } } - if (projectile.velocity.X > 0.25f) + if (Projectile.velocity.X > 0.25f) { - projectile.direction = -1; + Projectile.direction = -1; } - else if (projectile.velocity.X < -0.25f) + else if (Projectile.velocity.X < -0.25f) { - projectile.direction = 1; + Projectile.direction = 1; } - if (Math.Abs(projectile.velocity.X) > 0.2f) + if (Math.Abs(Projectile.velocity.X) > 0.2f) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; - if (projectile.frame % 2 == 0) - projectile.netUpdate = true; + Projectile.frame++; + Projectile.frameCounter = 0; + if (Projectile.frame % 2 == 0) + Projectile.netUpdate = true; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Main.player[projectile.owner].Calamity().angelicAlliance) + if (Main.player[Projectile.owner].Calamity().angelicAlliance) target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - if (Main.player[projectile.owner].Calamity().angelicAlliance) + if (Main.player[Projectile.owner].Calamity().angelicAlliance) target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index 52e74b925d..c584e8cd36 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -15,23 +15,23 @@ namespace CalamityMod.Projectiles.Summon private int ai = 3; private void updateDamage(int type) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); float baseDamage = (modPlayer.profanedCrystal && !modPlayer.profanedCrystalBuffs) ? 0f : (75f + (modPlayer.profanedCrystalBuffs ? 420f : 0f)); - projectile.damage = baseDamage == 0 ? 0 : (int)(baseDamage * player.MinionDamage()); + Projectile.damage = baseDamage == 0 ? 0 : (int)(baseDamage * player.MinionDamage()); ai = type; if (baseDamage >= 420f) { - projectile.localNPCHitCooldown = 6; + Projectile.localNPCHitCooldown = 6; } else if (baseDamage == 0) { - projectile.localNPCHitCooldown = 69; + Projectile.localNPCHitCooldown = 69; } else { - projectile.localNPCHitCooldown = 9; + Projectile.localNPCHitCooldown = 9; } } @@ -52,18 +52,18 @@ namespace CalamityMod.Projectiles.Summon { case 1: //defensive bab (profaned soul artifact) case 2: //Empowered bab WEEEEEEEEEE (profaned soul crystal) - if (projectile.ai[1] <= -1f) + if (Projectile.ai[1] <= -1f) { - projectile.ai[1] = 17f; + Projectile.ai[1] = 17f; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] -= type; + Projectile.ai[1] -= type; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { float num550 = 24f; //12 - Vector2 vector43 = projectile.Center; + Vector2 vector43 = Projectile.Center; float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -78,22 +78,22 @@ namespace CalamityMod.Projectiles.Summon num553 = num550 / num553; num551 *= num553; num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * (type == 1 ? 12f : 20f) + num551) / (type == 1 ? 13f : 21f); - projectile.velocity.Y = (projectile.velocity.Y * (type == 1 ? 12f : 20f) + num552) / (type == 1 ? 13f : 21f); + Projectile.velocity.X = (Projectile.velocity.X * (type == 1 ? 12f : 20f) + num551) / (type == 1 ? 13f : 21f); + Projectile.velocity.Y = (Projectile.velocity.Y * (type == 1 ? 12f : 20f) + num552) / (type == 1 ? 13f : 21f); } else { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 10f) { - projectile.velocity *= 1.05f; + Projectile.velocity *= 1.05f; } } break; case 3: //bored bab - (idle) float num16 = 0.5f; - projectile.tileCollide = false; + Projectile.tileCollide = false; int num17 = 100; - Vector2 vector3 = projectile.Center; + Vector2 vector3 = Projectile.Center; float num18 = player.Center.X - vector3.X; float num19 = player.Center.Y - vector3.Y; num19 += (float)Main.rand.Next(-10, 21); @@ -104,25 +104,25 @@ namespace CalamityMod.Projectiles.Summon float num21 = 18f; if (num20 < (float)num17 && player.velocity.Y == 0f && - projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && - !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + Projectile.position.Y + (float)Projectile.height <= player.position.Y + (float)player.height && + !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - if (projectile.velocity.Y < -6f) + Projectile.ai[0] = 0f; + if (Projectile.velocity.Y < -6f) { - projectile.velocity.Y = -6f; + Projectile.velocity.Y = -6f; } } if (num20 > 2000f) { - projectile.position = player.position; - projectile.netUpdate = true; + Projectile.position = player.position; + Projectile.netUpdate = true; } if (num20 < 50f) { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f) { - projectile.velocity *= 0.90f; + Projectile.velocity *= 0.90f; } num16 = 0.01f; } @@ -141,36 +141,36 @@ namespace CalamityMod.Projectiles.Summon num19 *= num20; } - if (projectile.velocity.X < num18) + if (Projectile.velocity.X < num18) { - projectile.velocity.X += num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) + Projectile.velocity.X += num16; + if (num16 > 0.05f && Projectile.velocity.X < 0f) { - projectile.velocity.X += num16; + Projectile.velocity.X += num16; } } - if (projectile.velocity.X > num18) + if (Projectile.velocity.X > num18) { - projectile.velocity.X -= num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) + Projectile.velocity.X -= num16; + if (num16 > 0.05f && Projectile.velocity.X > 0f) { - projectile.velocity.X -= num16; + Projectile.velocity.X -= num16; } } - if (projectile.velocity.Y < num19) + if (Projectile.velocity.Y < num19) { - projectile.velocity.Y += num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) + Projectile.velocity.Y += num16; + if (num16 > 0.05f && Projectile.velocity.Y < 0f) { - projectile.velocity.Y += num16 * 2f; + Projectile.velocity.Y += num16 * 2f; } } - if (projectile.velocity.Y > num19) + if (Projectile.velocity.Y > num19) { - projectile.velocity.Y -= num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) + Projectile.velocity.Y -= num16; + if (num16 > 0.05f && Projectile.velocity.Y > 0f) { - projectile.velocity.Y -= num16 * 2f; + Projectile.velocity.Y -= num16 * 2f; } } break; @@ -180,40 +180,40 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Defensive Guardian"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.tileCollide = false; - projectile.width = 62; - projectile.height = 80; - projectile.minionSlots = 0f; - projectile.minion = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 18000; - projectile.timeLeft *= 5; - projectile.usesLocalNPCImmunity = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Projectile.netImportant = true; + Projectile.tileCollide = false; + Projectile.width = 62; + Projectile.height = 80; + Projectile.minionSlots = 0f; + Projectile.minion = true; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 18000; + Projectile.timeLeft *= 5; + Projectile.usesLocalNPCImmunity = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override bool? CanCutTiles() { - if (projectile.damage == 0) + if (Projectile.damage == 0) return false; return null; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (Main.player[projectile.owner].Calamity().profanedCrystalBuffs && !Main.player[projectile.owner].Calamity().endoCooper) + if (Main.player[Projectile.owner].Calamity().profanedCrystalBuffs && !Main.player[Projectile.owner].Calamity().endoCooper) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } else @@ -224,7 +224,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (player.dead) @@ -233,25 +233,25 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.gDefense) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } if (!modPlayer.pArtifact || (modPlayer.minionSlotStat < 10 && !modPlayer.profanedCrystal)) { modPlayer.gDefense = false; - projectile.active = false; + Projectile.active = false; return; } - projectile.MinionAntiClump(); - float num535 = projectile.position.X; - float num536 = projectile.position.Y; + Projectile.MinionAntiClump(); + float num535 = Projectile.position.X; + float num536 = Projectile.position.Y; float num537 = 3000f; bool flag19 = false; - NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) + NPC ownerMinionAttackTargetNPC2 = Projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(Projectile, false)) { float num539 = ownerMinionAttackTargetNPC2.Center.X; float num540 = ownerMinionAttackTargetNPC2.Center.Y; - float num541 = Math.Abs(projectile.Center.X - num539) + Math.Abs(projectile.Center.Y - num540); + float num541 = Math.Abs(Projectile.Center.X - num539) + Math.Abs(Projectile.Center.Y - num540); if (num541 < num537) { num537 = num541; @@ -265,11 +265,11 @@ namespace CalamityMod.Projectiles.Summon int num3; for (int num542 = 0; num542 < Main.maxNPCs; num542 = num3 + 1) { - if (Main.npc[num542].CanBeChasedBy(projectile, false)) + if (Main.npc[num542].CanBeChasedBy(Projectile, false)) { float num543 = Main.npc[num542].Center.X; float num544 = Main.npc[num542].Center.Y; - float num545 = Math.Abs(projectile.Center.X - num543) + Math.Abs(projectile.Center.Y - num544); + float num545 = Math.Abs(Projectile.Center.X - num543) + Math.Abs(Projectile.Center.Y - num544); if (num545 < num537) { num537 = num545; @@ -281,7 +281,7 @@ namespace CalamityMod.Projectiles.Summon num3 = num542; } } - if (!flag19 || projectile.damage == 0) + if (!flag19 || Projectile.damage == 0) { AI(3, num535, num536, player); } @@ -292,43 +292,43 @@ namespace CalamityMod.Projectiles.Summon else AI(1, num535, num536, player); } - if (projectile.velocity.X > 0.25f) + if (Projectile.velocity.X > 0.25f) { - projectile.direction = -1; + Projectile.direction = -1; } - else if (projectile.velocity.X < -0.25f) + else if (Projectile.velocity.X < -0.25f) { - projectile.direction = 1; + Projectile.direction = 1; } - if (Math.Abs(projectile.velocity.X) > 0.2f) + if (Math.Abs(Projectile.velocity.X) > 0.2f) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; - if (projectile.frame % 2 == 0) - projectile.netUpdate = true; + Projectile.frame++; + Projectile.frameCounter = 0; + if (Projectile.frame % 2 == 0) + Projectile.netUpdate = true; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Main.player[projectile.owner].Calamity().angelicAlliance) + if (Main.player[Projectile.owner].Calamity().angelicAlliance) target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - if (Main.player[projectile.owner].Calamity().angelicAlliance) + if (Main.player[Projectile.owner].Calamity().angelicAlliance) target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Summon/MiniGuardianHealer.cs b/Projectiles/Summon/MiniGuardianHealer.cs index 5a0348f571..5265a2ea3f 100644 --- a/Projectiles/Summon/MiniGuardianHealer.cs +++ b/Projectiles/Summon/MiniGuardianHealer.cs @@ -12,28 +12,28 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Healer Guardian"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.netImportant = true; - projectile.tileCollide = false; - projectile.width = 68; - projectile.height = 82; - projectile.friendly = true; - projectile.minionSlots = 0f; - projectile.minion = true; - projectile.penetrate = -1; - projectile.timeLeft = 18000; - projectile.timeLeft *= 5; + Projectile.netImportant = true; + Projectile.tileCollide = false; + Projectile.width = 68; + Projectile.height = 82; + Projectile.friendly = true; + Projectile.minionSlots = 0f; + Projectile.minion = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 18000; + Projectile.timeLeft *= 5; } public override bool? CanCutTiles() { - CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); + CalamityPlayer modPlayer = Main.player[Projectile.owner].Calamity(); bool psa = modPlayer.pArtifact && !modPlayer.profanedCrystal; if (!psa && !modPlayer.profanedCrystalBuffs) return false; @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (player.dead) { @@ -50,19 +50,19 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.gHealer) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } if (!modPlayer.pArtifact || player.dead) { - projectile.active = false; + Projectile.active = false; return; } - projectile.MinionAntiClump(); - Player projOwner = Main.player[projectile.owner]; + Projectile.MinionAntiClump(); + Player projOwner = Main.player[Projectile.owner]; float num16 = 0.5f; - projectile.tileCollide = false; + Projectile.tileCollide = false; int num17 = 100; - Vector2 vector3 = projectile.Center; + Vector2 vector3 = Projectile.Center; float num18 = projOwner.Center.X - vector3.X; float num19 = projOwner.Center.Y - vector3.Y; num19 += (float)Main.rand.Next(-10, 21); @@ -73,25 +73,25 @@ namespace CalamityMod.Projectiles.Summon float num21 = 18f; if (num20 < (float)num17 && projOwner.velocity.Y == 0f && - projectile.position.Y + (float)projectile.height <= projOwner.position.Y + (float)projOwner.height && - !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + Projectile.position.Y + (float)Projectile.height <= projOwner.position.Y + (float)projOwner.height && + !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - if (projectile.velocity.Y < -6f) + Projectile.ai[0] = 0f; + if (Projectile.velocity.Y < -6f) { - projectile.velocity.Y = -6f; + Projectile.velocity.Y = -6f; } } if (num20 > 2000f) { - projectile.position = projOwner.position; - projectile.netUpdate = true; + Projectile.position = projOwner.position; + Projectile.netUpdate = true; } if (num20 < 50f) { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f) { - projectile.velocity *= 0.90f; + Projectile.velocity *= 0.90f; } num16 = 0.01f; } @@ -110,61 +110,61 @@ namespace CalamityMod.Projectiles.Summon num19 *= num20; } - if (projectile.velocity.X < num18) + if (Projectile.velocity.X < num18) { - projectile.velocity.X += num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) + Projectile.velocity.X += num16; + if (num16 > 0.05f && Projectile.velocity.X < 0f) { - projectile.velocity.X += num16; + Projectile.velocity.X += num16; } } - if (projectile.velocity.X > num18) + if (Projectile.velocity.X > num18) { - projectile.velocity.X -= num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) + Projectile.velocity.X -= num16; + if (num16 > 0.05f && Projectile.velocity.X > 0f) { - projectile.velocity.X -= num16; + Projectile.velocity.X -= num16; } } - if (projectile.velocity.Y < num19) + if (Projectile.velocity.Y < num19) { - projectile.velocity.Y += num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) + Projectile.velocity.Y += num16; + if (num16 > 0.05f && Projectile.velocity.Y < 0f) { - projectile.velocity.Y += num16 * 2f; + Projectile.velocity.Y += num16 * 2f; } } - if (projectile.velocity.Y > num19) + if (Projectile.velocity.Y > num19) { - projectile.velocity.Y -= num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) + Projectile.velocity.Y -= num16; + if (num16 > 0.05f && Projectile.velocity.Y > 0f) { - projectile.velocity.Y -= num16 * 2f; + Projectile.velocity.Y -= num16 * 2f; } } - if (projectile.velocity.X > 0.25f) + if (Projectile.velocity.X > 0.25f) { - projectile.direction = -1; + Projectile.direction = -1; } - else if (projectile.velocity.X < -0.25f) + else if (Projectile.velocity.X < -0.25f) { - projectile.direction = 1; + Projectile.direction = 1; } - if (Math.Abs(projectile.velocity.X) > 0.2f) + if (Math.Abs(Projectile.velocity.X) > 0.2f) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } } diff --git a/Projectiles/Summon/MiniSandShark.cs b/Projectiles/Summon/MiniSandShark.cs index 5c50869d16..81aa7fcd98 100644 --- a/Projectiles/Summon/MiniSandShark.cs +++ b/Projectiles/Summon/MiniSandShark.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class MiniSandShark : ModProjectile @@ -11,78 +12,78 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Mini Sand Shark"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.minion = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.minionSlots = 0f; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; + Projectile.width = 32; + Projectile.height = 32; + Projectile.minion = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.minionSlots = 0f; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 300; } public override void AI() { - projectile.alpha -= 40; - if (projectile.alpha < 0) + Projectile.alpha -= 40; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.NPCDeath19, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.NPCDeath19, Projectile.position); } - if (projectile.ai[0] >= 45f) + if (Projectile.ai[0] >= 45f) { - projectile.ai[0] = 45f; - projectile.velocity.Y = projectile.velocity.Y + 0.025f; + Projectile.ai[0] = 45f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.025f; } - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Main.projectileTexture[projectile.type]; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, texture.Size() / 2f, projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2f, Projectile.scale, spriteEffects, 0f); return false; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.2f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; diff --git a/Projectiles/Summon/MortalityBeam.cs b/Projectiles/Summon/MortalityBeam.cs index 9e9cef2f94..367cb3f9d8 100644 --- a/Projectiles/Summon/MortalityBeam.cs +++ b/Projectiles/Summon/MortalityBeam.cs @@ -11,38 +11,38 @@ namespace CalamityMod.Projectiles.Summon { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.minionSlots = 0f; - projectile.minion = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.minionSlots = 0f; + Projectile.minion = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.White.ToVector3()); + Lighting.AddLight(Projectile.Center, Color.White.ToVector3()); if (!Main.dedServ) { for (int i = -1; i <= 1; i += 2) { float offset = (float)Math.Sin(Time / 45f * MathHelper.TwoPi) * 10f * i; - Vector2 rotatedOffset = new Vector2(offset, 2f).RotatedBy(projectile.velocity.ToRotation() + MathHelper.PiOver2); + Vector2 rotatedOffset = new Vector2(offset, 2f).RotatedBy(Projectile.velocity.ToRotation() + MathHelper.PiOver2); - Dust rainbowDust = Dust.NewDustPerfect(projectile.Center + rotatedOffset, 261); + Dust rainbowDust = Dust.NewDustPerfect(Projectile.Center + rotatedOffset, 261); rainbowDust.color = Main.hslToRgb(Main.rand.NextFloat(), 0.9f, 0.5f); rainbowDust.velocity = Vector2.Zero; rainbowDust.scale = 1.5f; @@ -51,9 +51,9 @@ namespace CalamityMod.Projectiles.Summon } Time++; - NPC potentialTarget = projectile.Center.MinionHoming(1000f, Main.player[projectile.owner], false); + NPC potentialTarget = Projectile.Center.MinionHoming(1000f, Main.player[Projectile.owner], false); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 5f + projectile.SafeDirectionTo(potentialTarget.Center) * 13f) / 6f; + Projectile.velocity = (Projectile.velocity * 5f + Projectile.SafeDirectionTo(potentialTarget.Center) * 13f) / 6f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -65,13 +65,13 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { float redHue = Main.rgbToHsl(Color.Red).X; float greenHue = Main.rgbToHsl(Color.SeaGreen).X; float blueHue = Main.rgbToHsl(Color.Blue).X; - Vector2 spawnPosition = projectile.Center + Main.rand.NextVector2CircularEdge(10f, 10f); - Projectile bolt = Projectile.NewProjectileDirect(spawnPosition, Main.rand.NextVector2CircularEdge(9f, 9f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2CircularEdge(10f, 10f); + Projectile bolt = Projectile.NewProjectileDirect(spawnPosition, Main.rand.NextVector2CircularEdge(9f, 9f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); bolt.localAI[0] = Utils.SelectRandom(Main.rand, redHue, greenHue, blueHue); } } diff --git a/Projectiles/Summon/MortalityBolt.cs b/Projectiles/Summon/MortalityBolt.cs index 4deacbba47..e26e5988de 100644 --- a/Projectiles/Summon/MortalityBolt.cs +++ b/Projectiles/Summon/MortalityBolt.cs @@ -9,35 +9,35 @@ namespace CalamityMod.Projectiles.Summon { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public Color ProjectileColor => Main.hslToRgb(projectile.localAI[0], 1f, 0.5f); + public Color ProjectileColor => Main.hslToRgb(Projectile.localAI[0], 1f, 0.5f); public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.minionSlots = 0f; - projectile.minion = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.minionSlots = 0f; + Projectile.minion = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.White.ToVector3()); + Lighting.AddLight(Projectile.Center, Color.White.ToVector3()); if (!Main.dedServ) { for (int i = 0; i < 4; i++) { - Dust rainbowDust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(5f, 5f), 261); + Dust rainbowDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5f, 5f), 261); rainbowDust.color = ProjectileColor; - rainbowDust.velocity += projectile.velocity; + rainbowDust.velocity += Projectile.velocity; rainbowDust.noGravity = true; } } @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 15; i++) { - Dust rainbowDust = Dust.NewDustDirect(projectile.Center + Main.rand.NextVector2Circular(5f, 5f), 40, 40, 261); + Dust rainbowDust = Dust.NewDustDirect(Projectile.Center + Main.rand.NextVector2Circular(5f, 5f), 40, 40, 261); rainbowDust.color = ProjectileColor; rainbowDust.noGravity = true; } diff --git a/Projectiles/Summon/OldDukeHeadCorpse.cs b/Projectiles/Summon/OldDukeHeadCorpse.cs index ddd06e2ad9..180585b685 100644 --- a/Projectiles/Summon/OldDukeHeadCorpse.cs +++ b/Projectiles/Summon/OldDukeHeadCorpse.cs @@ -10,69 +10,69 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Absolutely Disgusting Shark Puker"); - Main.projFrames[projectile.type] = 2; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 2; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 64; - projectile.height = 60; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; + Projectile.width = 64; + Projectile.height = 60; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.sentry = true; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.penetrate = -1; } public override void AI() { - Player player = Main.player[projectile.owner]; - if (projectile.localAI[0] == 0f) + Player player = Main.player[Projectile.owner]; + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - NPC target = projectile.Center.MinionHoming(845f, player, false); + NPC target = Projectile.Center.MinionHoming(845f, player, false); // No sense in targeting something below this sentry. if (target != null) { - if (target.Bottom.Y > projectile.Top.Y) + if (target.Bottom.Y > Projectile.Top.Y) { target = null; } } - projectile.frame = (target != null).ToInt(); + Projectile.frame = (target != null).ToInt(); if (target != null) { - projectile.ai[0] += 1f; - if (Main.myPlayer == projectile.owner && - projectile.ai[0] % 8f == 0f) + Projectile.ai[0] += 1f; + if (Main.myPlayer == Projectile.owner && + Projectile.ai[0] % 8f == 0f) { - float angle = (float)Math.Atan(Math.Abs(target.Center.X - projectile.Center.X) / 450f); - angle *= Math.Sign(target.Center.X - projectile.Center.X); - Projectile.NewProjectile(projectile.Top + Vector2.UnitY * 7f, + float angle = (float)Math.Atan(Math.Abs(target.Center.X - Projectile.Center.X) / 450f); + angle *= Math.Sign(target.Center.X - Projectile.Center.X); + Projectile.NewProjectile(Projectile.Top + Vector2.UnitY * 7f, new Vector2(0f, -Main.rand.NextFloat(21f, 30.5f)).RotatedBy(angle), - ModContent.ProjectileType(), projectile.damage, 5f, - projectile.owner); + ModContent.ProjectileType(), Projectile.damage, 5f, + Projectile.owner); } } - projectile.velocity.Y += 0.5f; + Projectile.velocity.Y += 0.5f; - if (projectile.velocity.Y > 10f) + if (Projectile.velocity.Y > 10f) { - projectile.velocity.Y = 10f; + Projectile.velocity.Y = 10f; } - projectile.StickToTiles(false, false); + Projectile.StickToTiles(false, false); } public override bool CanDamage() => false; diff --git a/Projectiles/Summon/OldDukeSharkVomit.cs b/Projectiles/Summon/OldDukeSharkVomit.cs index 314695da1a..14217211cc 100644 --- a/Projectiles/Summon/OldDukeSharkVomit.cs +++ b/Projectiles/Summon/OldDukeSharkVomit.cs @@ -12,58 +12,58 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Puke"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 36; - projectile.height = 36; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.timeLeft = 360; - projectile.alpha = 255; + Projectile.friendly = true; + Projectile.width = 36; + Projectile.height = 36; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.timeLeft = 360; + Projectile.alpha = 255; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] < 10f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] < 10f) { - projectile.alpha = 255 - (int)(255 * projectile.ai[0] / 10f); + Projectile.alpha = 255 - (int)(255 * Projectile.ai[0] / 10f); } - projectile.velocity.Y += 0.2f; - if (projectile.velocity.X < 0f) + Projectile.velocity.Y += 0.2f; + if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); } else { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } //Homing - if (projectile.ai[0] > 20f) + if (Projectile.ai[0] > 20f) HomingAI(); } private void HomingAI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; int targetIdx = -1; float maxHomingRange = 600f; bool hasHomingTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); - if (dist < maxHomingRange && Collision.CanHit(projectile.Center, projectile.width, projectile.height, npc.Center, npc.width, npc.height)) + float dist = (Projectile.Center - npc.Center).Length(); + if (dist < maxHomingRange && Collision.CanHit(Projectile.Center, Projectile.width, Projectile.height, npc.Center, npc.width, npc.height)) { targetIdx = player.MinionAttackTargetNPC; maxHomingRange = dist; @@ -79,10 +79,10 @@ namespace CalamityMod.Projectiles.Summon if (npc is null || !npc.active) continue; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float dist = (projectile.Center - npc.Center).Length(); - if (dist < maxHomingRange && Collision.CanHit(projectile.Center, projectile.width, projectile.height, npc.Center, npc.width, npc.height)) + float dist = (Projectile.Center - npc.Center).Length(); + if (dist < maxHomingRange && Collision.CanHit(Projectile.Center, Projectile.width, Projectile.height, npc.Center, npc.width, npc.height)) { targetIdx = i; maxHomingRange = dist; @@ -96,17 +96,17 @@ namespace CalamityMod.Projectiles.Summon if (hasHomingTarget) { NPC target = Main.npc[targetIdx]; - Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * 25f; + Vector2 homingVector = (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * 25f; float homingRatio = 20f; - projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); + Projectile.velocity = (Projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Main.projectileTexture[projectile.type]; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, texture.Size() / 2f, projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2f, Projectile.scale, spriteEffects, 0f); return false; } @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < Main.rand.Next(28, 41); i++) { - Dust.NewDustPerfect(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), + Dust.NewDustPerfect(Projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(10f), (int)CalamityDusts.SulfurousSeaAcid, Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } diff --git a/Projectiles/Summon/PerditionBeacon.cs b/Projectiles/Summon/PerditionBeacon.cs index 67c4dce427..6e6871bbe0 100644 --- a/Projectiles/Summon/PerditionBeacon.cs +++ b/Projectiles/Summon/PerditionBeacon.cs @@ -11,57 +11,57 @@ namespace CalamityMod.Projectiles.Summon { public class PerditionBeacon : ModProjectile { - public ref float AttackTime => ref projectile.ai[0]; - public ref float AttackTimer => ref projectile.ai[1]; - public ref float DownwardCrossFade => ref projectile.localAI[1]; - public Player Owner => Main.player[projectile.owner]; + public ref float AttackTime => ref Projectile.ai[0]; + public ref float AttackTimer => ref Projectile.ai[1]; + public ref float DownwardCrossFade => ref Projectile.localAI[1]; + public Player Owner => Main.player[Projectile.owner]; // Only attack targets if one is explicitly defined. Don't default to a closest target. public NPC Target => Owner.HasMinionAttackTargetNPC ? Main.npc[Owner.MinionAttackTargetNPC] : null; public override void SetStaticDefaults() { DisplayName.SetDefault("Perdition Beacon"); - Main.projFrames[projectile.type] = 16; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 16; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 48; - projectile.height = 90; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.sentry = true; - projectile.light = 1f; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; - projectile.alpha = 255; + Projectile.width = 48; + Projectile.height = 90; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.sentry = true; + Projectile.light = 1f; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.penetrate = -1; + Projectile.alpha = 255; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { DoInitializationEffects(); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } // Dynamically adjust damage of the minion. - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int newDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = newDamage; + int newDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + Projectile.damage = newDamage; } // Fade in. - projectile.alpha = Utils.Clamp(projectile.alpha - 8, 0, 255); + Projectile.alpha = Utils.Clamp(Projectile.alpha - 8, 0, 255); HandleFrames(); FollowOwner(); ProvidePlayerMinionBuffs(); - if (Target != null && projectile.WithinRange(Target.Center, 2200f)) + if (Target != null && Projectile.WithinRange(Target.Center, 2200f)) { AttackTarget(); DownwardCrossFade = MathHelper.Clamp(DownwardCrossFade + 0.025f, 0f, 1f); @@ -78,8 +78,8 @@ namespace CalamityMod.Projectiles.Summon internal void DoInitializationEffects() { - projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; // Release a burst of fire dust on spawn. if (Main.dedServ) @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 55; i++) { - Dust fire = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(35f, 35f), 267); + Dust fire = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(35f, 35f), 267); fire.velocity = Vector2.Lerp(fire.velocity, Vector2.UnitY * -Main.rand.NextFloat(3.5f, 6f), 0.5f); fire.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 0.67f)); fire.scale = Main.rand.NextFloat(1.2f, 1.5f); @@ -101,30 +101,30 @@ namespace CalamityMod.Projectiles.Summon // Verify player/minion state integrity. The minion cannot stay alive if the // owner is dead or if the caller of the AI is invalid. - if (projectile.type != ModContent.ProjectileType()) + if (Projectile.type != ModContent.ProjectileType()) return; if (Owner.dead) Owner.Calamity().perditionBeacon = false; if (Owner.Calamity().perditionBeacon) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } internal void HandleFrames() { - projectile.frameCounter++; - if (projectile.frameCounter % 5 == 4) - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + if (Projectile.frameCounter % 5 == 4) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; } internal void FollowOwner() { - Vector2 destination = Owner.Top - Vector2.UnitY * MathHelper.Lerp(20f, 40f, (float)Math.Cos(projectile.timeLeft / 24f) * 0.5f + 0.5f); - projectile.Center = Vector2.Lerp(projectile.Center, destination, 0.025f); - projectile.Center += (destination - projectile.Center).SafeNormalize(Vector2.Zero) * 3f; + Vector2 destination = Owner.Top - Vector2.UnitY * MathHelper.Lerp(20f, 40f, (float)Math.Cos(Projectile.timeLeft / 24f) * 0.5f + 0.5f); + Projectile.Center = Vector2.Lerp(Projectile.Center, destination, 0.025f); + Projectile.Center += (destination - Projectile.Center).SafeNormalize(Vector2.Zero) * 3f; - if (projectile.WithinRange(destination, 5f) || !projectile.WithinRange(destination, 2200f)) - projectile.Center = destination; + if (Projectile.WithinRange(destination, 5f) || !Projectile.WithinRange(destination, 2200f)) + Projectile.Center = destination; } internal void AttackTarget() @@ -138,13 +138,13 @@ namespace CalamityMod.Projectiles.Summon int shootRate = (int)MathHelper.Lerp(24f, 6f, Utils.InverseLerp(0f, 300f, AttackTime, true)); AttackTimer++; - if (AttackTimer < shootRate || Main.myPlayer != projectile.owner) + if (AttackTimer < shootRate || Main.myPlayer != Projectile.owner) return; AttackTimer = 0f; - projectile.netUpdate = true; + Projectile.netUpdate = true; - WeightedRandom rng = new WeightedRandom(projectile.identity * 2167 + (int)(Main.GlobalTime * 20)); + WeightedRandom rng = new WeightedRandom(Projectile.identity * 2167 + (int)(Main.GlobalTime * 20)); rng.Add(ModContent.ProjectileType(), 0.5f); rng.Add(ModContent.ProjectileType(), 0.6f); rng.Add(ModContent.ProjectileType(), 0.8f); @@ -152,7 +152,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 spawnPosition = Target.Center + Vector2.UnitY.RotatedByRandom(0.27f) * 1150f; Vector2 shootVelocity = (Target.Center - spawnPosition).SafeNormalize(-Vector2.UnitY).RotatedByRandom(0.09f) * Main.rand.NextFloat(19f, 31f); - int soul = Projectile.NewProjectile(spawnPosition, shootVelocity, rng.Get(), projectile.damage, projectile.knockBack, projectile.owner); + int soul = Projectile.NewProjectile(spawnPosition, shootVelocity, rng.Get(), Projectile.damage, Projectile.knockBack, Projectile.owner); if (Main.projectile.IndexInRange(soul)) Main.projectile[soul].Calamity().forceMinion = true; } @@ -162,12 +162,12 @@ namespace CalamityMod.Projectiles.Summon if (Target is null) return; - Texture2D crossTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/PerditionCross"); + Texture2D crossTexture = ModContent.Request("CalamityMod/Projectiles/Summon/PerditionCross"); Vector2 drawPosition = Target.Bottom - Main.screenPosition; drawPosition.Y -= 12f; Color drawColor = Color.White * DownwardCrossFade; - spriteBatch.Draw(crossTexture, drawPosition, null, drawColor, projectile.rotation, crossTexture.Size() * 0.5f, projectile.scale * 0.85f, SpriteEffects.None, 0f); + spriteBatch.Draw(crossTexture, drawPosition, null, drawColor, Projectile.rotation, crossTexture.Size() * 0.5f, Projectile.scale * 0.85f, SpriteEffects.None, 0f); } public override bool CanDamage() => false; diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index d7c8f9e9b5..5cf34fe9b8 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -14,54 +15,54 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Phantom"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.extraUpdates = 1; + Projectile.width = 30; + Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0.5f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.extraUpdates = 1; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2(projectile.width / 2f, projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / num226) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / num226) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 180, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -71,22 +72,22 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.pGuy) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); float num633 = 3000f; float num634 = 3500f; float num635 = 4000f; float num636 = 600f; - Vector2 vector46 = projectile.position; + Vector2 vector46 = Projectile.position; bool flag25 = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, projectile.Center); + float num646 = Vector2.Distance(npc.Center, Projectile.Center); if (!flag25 && num646 < num633) { num633 = num646; @@ -100,9 +101,9 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); if (!flag25 && num646 < num633) { num633 = num646; @@ -117,27 +118,27 @@ namespace CalamityMod.Projectiles.Summon { num647 = num635; } - if (Vector2.Distance(player.Center, projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > num647) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } - if (flag25 && projectile.ai[0] == 0f) + if (flag25 && Projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - projectile.Center; + Vector2 vector47 = vector46 - Projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 18f; vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 12f; vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } } else @@ -145,14 +146,14 @@ namespace CalamityMod.Projectiles.Summon bool flag26 = false; if (!flag26) { - flag26 = projectile.ai[0] == 1f; + flag26 = Projectile.ai[0] == 1f; } float num650 = 12f; if (flag26) { num650 = 30f; } - Vector2 center2 = projectile.Center; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f); float num651 = vector48.Length(); if (num651 > 200f && num650 < 16f) @@ -161,59 +162,59 @@ namespace CalamityMod.Projectiles.Summon } if (num651 < num636 && flag26) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (num651 > 3500f) { - projectile.position.X = player.Center.X - (projectile.width / 2); - projectile.position.Y = player.Center.Y - (projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (Projectile.height / 2); + Projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } } if (flag25) { - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(vector46), 0.1f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(vector46), 0.1f); } else { - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += Main.rand.Next(1, 3); + Projectile.ai[1] += Main.rand.Next(1, 3); } - if (projectile.ai[1] > 75f) + if (Projectile.ai[1] > 75f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { float scaleFactor3 = 6f; int num658 = ModContent.ProjectileType(); - if (flag25 && projectile.ai[1] == 0f) + if (flag25 && Projectile.ai[1] == 0f) { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner) { - Vector2 value19 = vector46 - projectile.Center; + Vector2 value19 = vector46 - Projectile.Center; value19.Normalize(); value19 *= scaleFactor3; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - projectile.netUpdate = true; + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, value19.X, value19.Y, num658, Projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.netUpdate = true; } } } @@ -221,7 +222,7 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - return new Color(100, 250, 250, projectile.alpha); + return new Color(100, 250, 250, Projectile.alpha); } public override bool CanDamage() diff --git a/Projectiles/Summon/PhantomicDagger.cs b/Projectiles/Summon/PhantomicDagger.cs index 37539e4138..92a64743ad 100644 --- a/Projectiles/Summon/PhantomicDagger.cs +++ b/Projectiles/Summon/PhantomicDagger.cs @@ -15,22 +15,22 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Phantom Dagger"); - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 38; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 600; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.alpha = 200; - projectile.minion = true; + Projectile.width = 12; + Projectile.height = 38; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 600; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.alpha = 200; + Projectile.minion = true; } public override bool? CanHitNPC(NPC target) @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon int cap = (int)(damage * 1.05f); // Capped at 5% dr ignoring damage = Math.Min((int)(damage * (1 / (1 - target.Calamity().DR))), cap); - int projectileCount = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + int projectileCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type]; int cap2 = 3; int oldDamage = damage; if (projectileCount > cap2) @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Summon { for (int d = 0; d < 4; d++) { - int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); Main.dust[shadow].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -85,10 +85,10 @@ namespace CalamityMod.Projectiles.Summon } for (int d = 0; d < 12; d++) { - int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); Main.dust[shadow].noGravity = true; Main.dust[shadow].velocity *= 5f; - shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); + shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); Main.dust[shadow].velocity *= 2f; } @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Summon { if (CalamityConfig.Instance.Afterimages) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); } return true; } @@ -109,30 +109,30 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 3; i++) { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); //new Color(99, 54, 84) + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); //new Color(99, 54, 84) Main.dust[dust].noGravity = true; } } - if (projectile.alpha != 0) + if (Projectile.alpha != 0) { - projectile.rotation -= 0.25f; - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (projectile.alpha < 3) + Projectile.rotation -= 0.25f; + Projectile.velocity.X *= 0.985f; + Projectile.velocity.Y *= 0.985f; + if (Projectile.alpha < 3) { - projectile.alpha = 0; + Projectile.alpha = 0; homing = true; } else - projectile.alpha -= 3; + Projectile.alpha -= 3; } else { - NPC target = CalamityUtils.MinionHoming(projectile.Center, 1500f, Main.player[projectile.owner]); + NPC target = CalamityUtils.MinionHoming(Projectile.Center, 1500f, Main.player[Projectile.owner]); if (target != null) { float num550 = 40f; - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num551 = target.Center.X - vector43.X; float num552 = target.Center.Y - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -143,14 +143,14 @@ namespace CalamityMod.Projectiles.Summon num553 = num550 / num553; num551 *= num553; num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 25f + num551) / 26f; - projectile.velocity.Y = (projectile.velocity.Y * 25f + num552) / 26f; + Projectile.velocity.X = (Projectile.velocity.X * 25f + num551) / 26f; + Projectile.velocity.Y = (Projectile.velocity.Y * 25f + num552) / 26f; } else { - projectile.velocity *= 0.9f; + Projectile.velocity *= 0.9f; } - projectile.rotation = projectile.velocity.ToRotation() + (float)Math.Atan(90); + Projectile.rotation = Projectile.velocity.ToRotation() + (float)Math.Atan(90); } } } diff --git a/Projectiles/Summon/PhantomicShield.cs b/Projectiles/Summon/PhantomicShield.cs index 0f5b65f2ee..2cd3e68fea 100644 --- a/Projectiles/Summon/PhantomicShield.cs +++ b/Projectiles/Summon/PhantomicShield.cs @@ -14,22 +14,22 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Phantomic Bulwark"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 38; - projectile.height = 56; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 38; + Projectile.height = 56; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void SendExtraAI(BinaryWriter writer) @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Summon { for (int d = 0; d < 6; d++) { - int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); Main.dust[shadow].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -56,27 +56,27 @@ namespace CalamityMod.Projectiles.Summon } for (int d = 0; d < 18; d++) { - int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); Main.dust[shadow].noGravity = true; Main.dust[shadow].velocity *= 5f; - shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); + shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); Main.dust[shadow].velocity *= 2f; } } public override void AI() { - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; NPC target = CalamityUtils.MinionHoming(owner.position, 1500f, owner); if (target != null) { Vector2 pos1 = owner.position; Vector2 pos2 = target.position; - projectile.ai[0] = (pos2 - pos1).ToRotation(); + Projectile.ai[0] = (pos2 - pos1).ToRotation(); } else { - projectile.ai[0] -= MathHelper.ToRadians(2f); + Projectile.ai[0] -= MathHelper.ToRadians(2f); } if (target == null) { @@ -87,21 +87,21 @@ namespace CalamityMod.Projectiles.Summon deathTimer = 240; } if (owner.dead || deathTimer <= 0) - projectile.Kill(); - projectile.Center = owner.Center + projectile.ai[0].ToRotationVector2() * floatDist; - projectile.rotation = (owner.Center - projectile.Center).ToRotation(); + Projectile.Kill(); + Projectile.Center = owner.Center + Projectile.ai[0].ToRotationVector2() * floatDist; + Projectile.rotation = (owner.Center - Projectile.Center).ToRotation(); - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; - if (projectile.frame % 2 == 0) - projectile.netUpdate = true; + Projectile.frame++; + Projectile.frameCounter = 0; + if (Projectile.frame % 2 == 0) + Projectile.netUpdate = true; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } } diff --git a/Projectiles/Summon/PinkButterfly.cs b/Projectiles/Summon/PinkButterfly.cs index 1e9334a775..a21e15b4bd 100644 --- a/Projectiles/Summon/PinkButterfly.cs +++ b/Projectiles/Summon/PinkButterfly.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class PinkButterfly : ModProjectile @@ -13,73 +14,73 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Pink Butterfly"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0.5f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.5f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 73, vector7.X, vector7.Y, 100, default, 1.1f); Main.dust[num228].noGravity = true; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - if (Math.Abs(projectile.velocity.X) > 0.2f) + if (Math.Abs(Projectile.velocity.X) > 0.2f) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } - projectile.rotation = projectile.velocity.X * 0.02f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.rotation = Projectile.velocity.X * 0.02f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - Lighting.AddLight(projectile.Center, 0.3f, 0.2f, 0.3f); + Lighting.AddLight(Projectile.Center, 0.3f, 0.2f, 0.3f); float num633 = 1200f; float num634 = 1500f; float num635 = 2400f; float num636 = 150f; - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -89,24 +90,24 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.resButterfly) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); bool flag24 = false; if (flag24) { return; } - Vector2 vector46 = projectile.position; + Vector2 vector46 = Projectile.position; bool flag25 = false; int targetIndex = -1; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if ((npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) + if ((npc.CanBeChasedBy(Projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) { - float num646 = Vector2.Distance(npc.Center, projectile.Center); + float num646 = Vector2.Distance(npc.Center, Projectile.Center); if (!flag25 && num646 < num633) { vector46 = npc.Center; @@ -120,9 +121,9 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; - if ((nPC2.CanBeChasedBy(projectile, false) || nPC2.type == NPCID.DukeFishron) && nPC2.active) + if ((nPC2.CanBeChasedBy(Projectile, false) || nPC2.type == NPCID.DukeFishron) && nPC2.active) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); if (!flag25 && num646 < num633) { num633 = num646; @@ -138,27 +139,27 @@ namespace CalamityMod.Projectiles.Summon { num647 = num635; } - if (Vector2.Distance(player.Center, projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > num647) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } - if (flag25 && projectile.ai[0] == 0f) + if (flag25 && Projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - projectile.Center; + Vector2 vector47 = vector46 - Projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 12f; vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 6f; vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } } else @@ -166,71 +167,71 @@ namespace CalamityMod.Projectiles.Summon bool flag26 = false; if (!flag26) { - flag26 = projectile.ai[0] == 1f; + flag26 = Projectile.ai[0] == 1f; } float num650 = 10f; if (flag26) { num650 = 24f; } - Vector2 center2 = projectile.Center; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(-40f, -40f); float num651 = vector48.Length(); if (num651 > 200f && num650 < 12f) { num650 = 12f; } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (num651 < num636 && flag26 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (num651 > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } } // Projectile fire timer - if (projectile.ai[1] > 0f) - projectile.ai[1] += (float)Main.rand.Next(1, 3); + if (Projectile.ai[1] > 0f) + Projectile.ai[1] += (float)Main.rand.Next(1, 3); // Reset timer - if (projectile.ai[1] > 300f) + if (Projectile.ai[1] > 300f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } // Prevent firing immediately - if (projectile.localAI[0] < 120f) - projectile.localAI[0] += 1f; + if (Projectile.localAI[0] < 120f) + Projectile.localAI[0] += 1f; // Fire projectiles - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { float velocity = 8f; int projectileType = ModContent.ProjectileType(); - if (flag25 && projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) + if (flag25 && Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner) { - Main.PlaySound(SoundID.Item8, projectile.position); - Vector2 value19 = vector46 - projectile.Center; + SoundEngine.PlaySound(SoundID.Item8, Projectile.position); + Vector2 value19 = vector46 - Projectile.Center; value19.Normalize(); value19 *= velocity; int numProj = 2; @@ -238,9 +239,9 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < numProj + 1; i++) { Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center, perturbedSpeed, projectileType, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, targetIndex, 0f); + Projectile.NewProjectile(Projectile.Center, perturbedSpeed, projectileType, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, targetIndex, 0f); } - projectile.netUpdate = true; + Projectile.netUpdate = true; } } } @@ -248,11 +249,11 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, spriteEffects, 0f); return false; } diff --git a/Projectiles/Summon/PlagueBeeSmall.cs b/Projectiles/Summon/PlagueBeeSmall.cs index 276915a556..defb981217 100644 --- a/Projectiles/Summon/PlagueBeeSmall.cs +++ b/Projectiles/Summon/PlagueBeeSmall.cs @@ -13,59 +13,59 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Bee"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 420; - projectile.ignoreWater = true; - projectile.minion = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 420; + Projectile.ignoreWater = true; + Projectile.minion = true; } public override void AI() { - if (projectile.owner != Main.myPlayer) - projectile.Kill(); + if (Projectile.owner != Main.myPlayer) + Projectile.Kill(); - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - projectile.rotation += projectile.spriteDirection * MathHelper.ToRadians(45f); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.rotation += Projectile.spriteDirection * MathHelper.ToRadians(45f); - projectile.frameCounter++; - if (projectile.frameCounter >= 3) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; float maxDistance = 800f; bool homeIn = false; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 30f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 30f) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false) && !npc.wet) + if (npc.CanBeChasedBy(Projectile, false) && !npc.wet) { float extraDistance = (npc.width / 2) + (npc.height / 2); bool canHit = true; if (extraDistance < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance) && canHit) { center = npc.Center; homeIn = true; @@ -77,15 +77,15 @@ namespace CalamityMod.Projectiles.Summon for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { NPC npc = Main.npc[npcIndex]; - if (npc.CanBeChasedBy(projectile, false) && !npc.wet) + if (npc.CanBeChasedBy(Projectile, false) && !npc.wet) { float extraDistance = (npc.width / 2) + (npc.height / 2); bool canHit = true; if (extraDistance < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance) && canHit) { center = npc.Center; homeIn = true; @@ -97,73 +97,73 @@ namespace CalamityMod.Projectiles.Summon } if (!homeIn) { - center.X = projectile.Center.X + projectile.velocity.X * 100f; - center.Y = projectile.Center.Y + projectile.velocity.Y * 100f; + center.X = Projectile.Center.X + Projectile.velocity.X * 100f; + center.Y = Projectile.Center.Y + Projectile.velocity.Y * 100f; } float speed = 10f; float velocityTweak = 0.14f; - Vector2 projPos = projectile.Center; + Vector2 projPos = Projectile.Center; Vector2 velocity = center - projPos; float targetDist = velocity.Length(); targetDist = speed / targetDist; velocity.X *= targetDist; velocity.Y *= targetDist; - if (projectile.velocity.X < velocity.X) + if (Projectile.velocity.X < velocity.X) { - projectile.velocity.X += velocityTweak; - if (projectile.velocity.X < 0f && velocity.X > 0f) + Projectile.velocity.X += velocityTweak; + if (Projectile.velocity.X < 0f && velocity.X > 0f) { - projectile.velocity.X += velocityTweak * 2f; + Projectile.velocity.X += velocityTweak * 2f; } } - else if (projectile.velocity.X > velocity.X) + else if (Projectile.velocity.X > velocity.X) { - projectile.velocity.X -= velocityTweak; - if (projectile.velocity.X > 0f && velocity.X < 0f) + Projectile.velocity.X -= velocityTweak; + if (Projectile.velocity.X > 0f && velocity.X < 0f) { - projectile.velocity.X -= velocityTweak * 2f; + Projectile.velocity.X -= velocityTweak * 2f; } } - if (projectile.velocity.Y < velocity.Y) + if (Projectile.velocity.Y < velocity.Y) { - projectile.velocity.Y += velocityTweak; - if (projectile.velocity.Y < 0f && velocity.Y > 0f) + Projectile.velocity.Y += velocityTweak; + if (Projectile.velocity.Y < 0f && velocity.Y > 0f) { - projectile.velocity.Y += velocityTweak * 2f; + Projectile.velocity.Y += velocityTweak * 2f; } } - else if (projectile.velocity.Y > velocity.Y) + else if (Projectile.velocity.Y > velocity.Y) { - projectile.velocity.Y -= velocityTweak; - if (projectile.velocity.Y > 0f && velocity.Y < 0f) + Projectile.velocity.Y -= velocityTweak; + if (Projectile.velocity.Y > 0f && velocity.Y < 0f) { - projectile.velocity.Y -= velocityTweak * 2f; + Projectile.velocity.Y -= velocityTweak * 2f; } } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } return false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int drawStart = frameHeight * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int drawStart = frameHeight * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, spriteEffects, 0f); return false; } @@ -171,7 +171,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 2; i++) { - int plague = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X, projectile.velocity.Y, 50, default, 1f); + int plague = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 1f); Main.dust[plague].noGravity = true; } } diff --git a/Projectiles/Summon/PlaguePrincess.cs b/Projectiles/Summon/PlaguePrincess.cs index bd686586fa..e95846e631 100644 --- a/Projectiles/Summon/PlaguePrincess.cs +++ b/Projectiles/Summon/PlaguePrincess.cs @@ -19,38 +19,38 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Virili"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 96; - projectile.height = 116; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.tileCollide = false; + Projectile.width = 96; + Projectile.height = 116; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - projectile.minionSlots = projectile.ai[0]; + Projectile.minionSlots = Projectile.ai[0]; //bools and crap - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) { @@ -60,54 +60,54 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.virili) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } //dust and flexible damage if (dust) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 89, 0f, 0f, 0, default, 1f); + int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 89, 0f, 0f, 0, default, 1f); Main.dust[num503].velocity *= 2f; Main.dust[num503].scale *= 1.15f; } dust = false; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } //framing - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } //direction - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if ((double)Math.Abs(Projectile.velocity.X) > 0.2) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } //Lighting float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight(projectile.Center, 0f * num, 1.25f * num, 0f * num); + Lighting.AddLight(Projectile.Center, 0f * num, 1.25f * num, 0f * num); //change modes every 10 seconds modeCounter++; @@ -120,24 +120,24 @@ namespace CalamityMod.Projectiles.Summon } //anti sticking movement - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); //anti-sticking also applies to the player float antiStickFloat = 0.05f; - if (projectile.position.X < player.position.X) + if (Projectile.position.X < player.position.X) { - projectile.velocity.X -= antiStickFloat; + Projectile.velocity.X -= antiStickFloat; } else { - projectile.velocity.X += antiStickFloat; + Projectile.velocity.X += antiStickFloat; } - if (projectile.position.Y < player.position.Y) + if (Projectile.position.Y < player.position.Y) { - projectile.velocity.Y -= antiStickFloat; + Projectile.velocity.Y -= antiStickFloat; } else { - projectile.velocity.Y += antiStickFloat; + Projectile.velocity.Y += antiStickFloat; } bool cancelAttack = false; @@ -145,15 +145,15 @@ namespace CalamityMod.Projectiles.Summon { if (AIint == 2) { - projectile.ai[1] += 1f; - projectile.extraUpdates = 2; - if (projectile.ai[1] > 30f) + Projectile.ai[1] += 1f; + Projectile.extraUpdates = 2; + if (Projectile.ai[1] > 30f) { - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; AIint = 0; - projectile.extraUpdates = 1; - projectile.numUpdates = 0; - projectile.netUpdate = true; + Projectile.extraUpdates = 1; + Projectile.numUpdates = 0; + Projectile.netUpdate = true; } else { @@ -162,7 +162,7 @@ namespace CalamityMod.Projectiles.Summon } else { - projectile.extraUpdates = 1; + Projectile.extraUpdates = 1; } if (cancelAttack) { @@ -171,22 +171,22 @@ namespace CalamityMod.Projectiles.Summon } if (mode == 0 || mode == 1) { - projectile.extraUpdates = 1; + Projectile.extraUpdates = 1; if (AIint == 2) AIint = 0; } float num633 = 1040f; float num636 = 400f; //150 - Vector2 targetLocation = projectile.position; + Vector2 targetLocation = Projectile.position; bool targetFound = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((!targetFound && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float num646 = Vector2.Distance(npc.Center, Projectile.Center); + if ((!targetFound && num646 < num633) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { num633 = num646; targetLocation = npc.Center; @@ -199,10 +199,10 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!targetFound && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); + if ((!targetFound && num646 < num633) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num633 = num646; targetLocation = nPC2.Center; @@ -213,31 +213,31 @@ namespace CalamityMod.Projectiles.Summon } //head back to player if too far - if (Vector2.Distance(player.Center, projectile.Center) > 1200f) + if (Vector2.Distance(player.Center, Projectile.Center) > 1200f) { AIint = 1; - projectile.netUpdate = true; + Projectile.netUpdate = true; } if (targetFound && AIint == 0) { - Vector2 targetVector = targetLocation - projectile.Center; + Vector2 targetVector = targetLocation - Projectile.Center; float targetDist = targetVector.Length(); targetVector.Normalize(); if (targetDist > 200f) { float scaleFactor2 = 8f; targetVector *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + targetVector) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + targetVector) / 41f; } else if (mode == 2) //charging { float scaleFactor3 = 4f; targetVector *= -scaleFactor3; - projectile.velocity = (projectile.velocity * 40f + targetVector) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + targetVector) / 41f; } - else if (projectile.velocity.Y > -1f) - projectile.velocity.Y -= 0.1f; + else if (Projectile.velocity.Y > -1f) + Projectile.velocity.Y -= 0.1f; } else //idle movement { @@ -253,34 +253,34 @@ namespace CalamityMod.Projectiles.Summon { speedFloat = 12f; //15 } - Vector2 projVector = projectile.Center; + Vector2 projVector = Projectile.Center; Vector2 playerVector = player.Center - projVector + new Vector2(0, -60f); //-60 float playerDist = playerVector.Length(); if (playerDist > 200f && speedFloat < 6.5f) //200 and 8 { speedFloat = 6.5f; //8 } - if (playerDist < num636 && returningToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerDist < num636 && returningToPlayer && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { AIint = 0; - projectile.netUpdate = true; + Projectile.netUpdate = true; } if (playerDist > 2000f) //if too far, teleport to player { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (playerDist > 70f) { playerVector.Normalize(); playerVector *= speedFloat; - projectile.velocity = (projectile.velocity * 40f + playerVector) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + playerVector) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.18f; - projectile.velocity.Y = -0.08f; + Projectile.velocity.X = -0.18f; + Projectile.velocity.Y = -0.08f; } } @@ -293,74 +293,74 @@ namespace CalamityMod.Projectiles.Summon else if (mode == 2) cooldown = 80f; - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 4); + Projectile.ai[1] += (float)Main.rand.Next(1, 4); } - if (projectile.ai[1] > cooldown) + if (Projectile.ai[1] > cooldown) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } if (AIint == 0) { if (mode == 0) { - if (targetFound && projectile.ai[1] == 0f) + if (targetFound && Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; float scaleFactor4 = 14f; int projType = ModContent.ProjectileType(); - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, targetLocation, 0, 0)) + if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, targetLocation, 0, 0)) { - Vector2 projVect = targetLocation - projectile.Center; + Vector2 projVect = targetLocation - Projectile.Center; projVect.Normalize(); projVect *= scaleFactor4; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projVect.X, projVect.Y, projType, (int)(projectile.damage * 0.6f), 0f, Main.myPlayer, 0f, 0f); - projectile.netUpdate = true; + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, projVect.X, projVect.Y, projType, (int)(Projectile.damage * 0.6f), 0f, Main.myPlayer, 0f, 0f); + Projectile.netUpdate = true; } } } else if (mode == 1) { - if (targetFound && projectile.ai[1] == 0f) + if (targetFound && Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; int smallBee = ModContent.ProjectileType(); int bigBee = ModContent.ProjectileType(); int projType = smallBee; if (player.ownedProjectileCounts[bigBee] < 1 && Main.rand.NextBool(3)) projType = bigBee; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, targetLocation, 0, 0)) + if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, targetLocation, 0, 0)) { for (int beeIndex = 0; beeIndex < (projType == bigBee ? 1 : Main.rand.Next(1,5)); beeIndex++) { - Vector2 projVect2 = targetLocation - projectile.Center; + Vector2 projVect2 = targetLocation - Projectile.Center; projVect2.Normalize(); float SpeedX = projVect2.X + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = projVect2.Y + (float)Main.rand.Next(-30, 31) * 0.05f; - int bee = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, projType, (int)(projectile.damage * 0.8f), 0f, Main.myPlayer, 0f, 0f); + int bee = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, SpeedX, SpeedY, projType, (int)(Projectile.damage * 0.8f), 0f, Main.myPlayer, 0f, 0f); if (projType == bigBee) { Main.projectile[bee].frame = 2; } - projectile.netUpdate = true; + Projectile.netUpdate = true; } } } } else if (mode == 2) { - if (projectile.ai[1] == 0f && targetFound && num633 < 500f) + if (Projectile.ai[1] == 0f && targetFound && num633 < 500f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner) { AIint = 2; - Vector2 targetVect = targetLocation - projectile.Center; + Vector2 targetVect = targetLocation - Projectile.Center; targetVect.Normalize(); - projectile.velocity = targetVect * 8f; - projectile.netUpdate = true; + Projectile.velocity = targetVect * 8f; + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Summon/PlaguebringerMK2.cs b/Projectiles/Summon/PlaguebringerMK2.cs index 4f11fb197f..7fa927766c 100644 --- a/Projectiles/Summon/PlaguebringerMK2.cs +++ b/Projectiles/Summon/PlaguebringerMK2.cs @@ -13,43 +13,43 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Plaguebringer MK2"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 40; - projectile.height = 38; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 40; + Projectile.height = 38; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) { @@ -59,52 +59,52 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.plaguebringerMK2) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); + NPC potentialTarget = Projectile.Center.MinionHoming(DistanceToCheck, player); if (potentialTarget != null) { - int sign = (potentialTarget.Center.X - projectile.Center.X < 0).ToDirectionInt(); - float x = (125f + 40f * (int)(projectile.ai[1] % 10f)) * sign; - int y = -160 - 50 * (int)(projectile.ai[1] / 10); + int sign = (potentialTarget.Center.X - Projectile.Center.X < 0).ToDirectionInt(); + float x = (125f + 40f * (int)(Projectile.ai[1] % 10f)) * sign; + int y = -160 - 50 * (int)(Projectile.ai[1] / 10); Vector2 destination = potentialTarget.Center + new Vector2(x, y); - if (projectile.Distance(destination) < 6f) + if (Projectile.Distance(destination) < 6f) { - projectile.velocity *= 0.9f; + Projectile.velocity *= 0.9f; } else - projectile.velocity = projectile.SafeDirectionTo(destination) * projectile.Distance(destination) / 36f; + Projectile.velocity = Projectile.SafeDirectionTo(destination) * Projectile.Distance(destination) / 36f; - int timeNeeded = (int)MathHelper.Lerp(60f, 18f, MathHelper.Clamp(projectile.localAI[1] / 320f, 0f, 1f)); - if (projectile.ai[0] >= timeNeeded && Main.myPlayer == projectile.owner) + int timeNeeded = (int)MathHelper.Lerp(60f, 18f, MathHelper.Clamp(Projectile.localAI[1] / 320f, 0f, 1f)); + if (Projectile.ai[0] >= timeNeeded && Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(projectile.Center, - projectile.SafeDirectionTo(potentialTarget.Center) * 14f, + Projectile.NewProjectile(Projectile.Center, + Projectile.SafeDirectionTo(potentialTarget.Center) * 14f, ModContent.ProjectileType(), - (int)(projectile.damage * 0.9), + (int)(Projectile.damage * 0.9), 3f, - projectile.owner); - Projectile.NewProjectile(projectile.Center, - projectile.SafeDirectionTo(potentialTarget.Center) * 11.5f, + Projectile.owner); + Projectile.NewProjectile(Projectile.Center, + Projectile.SafeDirectionTo(potentialTarget.Center) * 11.5f, ModContent.ProjectileType(), - (int)(projectile.damage * 0.9), + (int)(Projectile.damage * 0.9), 3f, - projectile.owner); - projectile.ai[0] = 0; + Projectile.owner); + Projectile.ai[0] = 0; } - else projectile.ai[0]++; - projectile.localAI[1]++; - projectile.direction = projectile.spriteDirection = -sign; + else Projectile.ai[0]++; + Projectile.localAI[1]++; + Projectile.direction = Projectile.spriteDirection = -sign; } else { - projectile.localAI[1] = 0; - float x = (45f + 35f * (int)(projectile.ai[1] % 10f)) * -player.direction; - int y = -60 - 50 * (int)(projectile.ai[1] / 10); - Vector2 distanceToDestination = player.Center - projectile.Center + new Vector2(x, y); + Projectile.localAI[1] = 0; + float x = (45f + 35f * (int)(Projectile.ai[1] % 10f)) * -player.direction; + int y = -60 - 50 * (int)(Projectile.ai[1] / 10); + Vector2 distanceToDestination = player.Center - Projectile.Center + new Vector2(x, y); float distance = distanceToDestination.Length(); if (distance > 10f) { @@ -113,31 +113,31 @@ namespace CalamityMod.Projectiles.Summon { speed /= 2f; } - Vector2 velocity = distanceToDestination.SafeNormalize(projectile.direction * Vector2.UnitX) * speed; - projectile.velocity = (projectile.velocity * 20f + velocity) / 21f; + Vector2 velocity = distanceToDestination.SafeNormalize(Projectile.direction * Vector2.UnitX) * speed; + Projectile.velocity = (Projectile.velocity * 20f + velocity) / 21f; if (distance > 2250f) { - projectile.Center = player.Center; - projectile.netUpdate = true; + Projectile.Center = player.Center; + Projectile.netUpdate = true; } } else { - projectile.direction = player.direction; - projectile.velocity *= 0.9f; + Projectile.direction = player.direction; + Projectile.velocity *= 0.9f; } - projectile.direction = projectile.spriteDirection = player.direction; + Projectile.direction = Projectile.spriteDirection = player.direction; } - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } } diff --git a/Projectiles/Summon/PlaguebringerSummon.cs b/Projectiles/Summon/PlaguebringerSummon.cs index 862809757a..9689a083ae 100644 --- a/Projectiles/Summon/PlaguebringerSummon.cs +++ b/Projectiles/Summon/PlaguebringerSummon.cs @@ -17,56 +17,56 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Lil' Plaguebringer"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; + Projectile.width = 30; + Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.frameCounter++ > 6f) + if (Projectile.frameCounter++ > 6f) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 3) //dashing frames are unused + if (Projectile.frame >= 3) //dashing frames are unused { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) { @@ -76,24 +76,24 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.plaguebringerPatronSummon) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } if (!modPlayer.plaguebringerPatronSet) - projectile.Kill(); + Projectile.Kill(); - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); int buffType = ModContent.BuffType(); float range = auraRange; bool dealDamage = auraCounter++ % 60 == 59; - int dmg = projectile.damage; - if (projectile.owner == Main.myPlayer) + int dmg = Projectile.damage; + if (Projectile.owner == Main.myPlayer) { for (int l = 0; l < Main.maxNPCs; l++) { NPC npc = Main.npc[l]; - if (npc.active && !npc.friendly && npc.damage > 0 && !npc.dontTakeDamage && !npc.buffImmune[buffType] && Vector2.Distance(projectile.Center, npc.Center) <= range) + if (npc.active && !npc.friendly && npc.damage > 0 && !npc.dontTakeDamage && !npc.buffImmune[buffType] && Vector2.Distance(Projectile.Center, npc.Center) <= range) { if (npc.FindBuffIndex(buffType) == -1) { @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Summon } if (dealDamage) { - Projectile aura = Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), dmg, 0f, projectile.owner, l); + Projectile aura = Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), dmg, 0f, Projectile.owner, l); if (aura.whoAmI.WithinBounds(Main.maxProjectiles)) aura.Calamity().forceMinion = true; } @@ -110,9 +110,9 @@ namespace CalamityMod.Projectiles.Summon } float passiveMvtFloat = 0.5f; - projectile.tileCollide = false; + Projectile.tileCollide = false; float safeDist = 100f; - Vector2 projPos = new Vector2(projectile.Center.X, projectile.Center.Y); + Vector2 projPos = new Vector2(Projectile.Center.X, Projectile.Center.Y); float xDist = player.Center.X - projPos.X; float yDist = player.Center.Y - projPos.Y; yDist += Main.rand.NextFloat(-10f, 20f); @@ -124,28 +124,28 @@ namespace CalamityMod.Projectiles.Summon //If player is close enough, resume normal if (playerDist < safeDist && player.velocity.Y == 0f && - projectile.position.Y + projectile.height <= player.position.Y + player.height && - !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + Projectile.position.Y + Projectile.height <= player.position.Y + player.height && + !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - if (projectile.velocity.Y < -6f) + if (Projectile.velocity.Y < -6f) { - projectile.velocity.Y = -6f; + Projectile.velocity.Y = -6f; } } //Teleport to player if too far if (playerDist > 2000f) { - projectile.position.X = player.Center.X - projectile.width / 2; - projectile.position.Y = player.Center.Y - projectile.height / 2; - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - Projectile.width / 2; + Projectile.position.Y = player.Center.Y - Projectile.height / 2; + Projectile.netUpdate = true; } if (playerDist < 50f) { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f) { - projectile.velocity *= 0.99f; + Projectile.velocity *= 0.99f; } passiveMvtFloat = 0.01f; } @@ -163,49 +163,49 @@ namespace CalamityMod.Projectiles.Summon playerVector.X *= playerDist; playerVector.Y *= playerDist; } - if (projectile.velocity.X < playerVector.X) + if (Projectile.velocity.X < playerVector.X) { - projectile.velocity.X += passiveMvtFloat; - if (passiveMvtFloat > 0.05f && projectile.velocity.X < 0f) + Projectile.velocity.X += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && Projectile.velocity.X < 0f) { - projectile.velocity.X += passiveMvtFloat; + Projectile.velocity.X += passiveMvtFloat; } } - if (projectile.velocity.X > playerVector.X) + if (Projectile.velocity.X > playerVector.X) { - projectile.velocity.X -= passiveMvtFloat; - if (passiveMvtFloat > 0.05f && projectile.velocity.X > 0f) + Projectile.velocity.X -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && Projectile.velocity.X > 0f) { - projectile.velocity.X -= passiveMvtFloat; + Projectile.velocity.X -= passiveMvtFloat; } } - if (projectile.velocity.Y < playerVector.Y) + if (Projectile.velocity.Y < playerVector.Y) { - projectile.velocity.Y += passiveMvtFloat; - if (passiveMvtFloat > 0.05f && projectile.velocity.Y < 0f) + Projectile.velocity.Y += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && Projectile.velocity.Y < 0f) { - projectile.velocity.Y += passiveMvtFloat * 2f; + Projectile.velocity.Y += passiveMvtFloat * 2f; } } - if (projectile.velocity.Y > playerVector.Y) + if (Projectile.velocity.Y > playerVector.Y) { - projectile.velocity.Y -= passiveMvtFloat; - if (passiveMvtFloat > 0.05f && projectile.velocity.Y > 0f) + Projectile.velocity.Y -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && Projectile.velocity.Y > 0f) { - projectile.velocity.Y -= passiveMvtFloat * 2f; + Projectile.velocity.Y -= passiveMvtFloat * 2f; } } - if (projectile.velocity.X >= 0.25f) + if (Projectile.velocity.X >= 0.25f) { - projectile.direction = -1; + Projectile.direction = -1; } - else if (projectile.velocity.X < -0.25f) + else if (Projectile.velocity.X < -0.25f) { - projectile.direction = 1; + Projectile.direction = 1; } //Tilting and change directions - projectile.spriteDirection = projectile.direction; - projectile.rotation = projectile.velocity.X * 0.01f; + Projectile.spriteDirection = Projectile.direction; + Projectile.rotation = Projectile.velocity.X * 0.01f; } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Summon/PlantSeed.cs b/Projectiles/Summon/PlantSeed.cs index 899f0f581d..ba5791f4ee 100644 --- a/Projectiles/Summon/PlantSeed.cs +++ b/Projectiles/Summon/PlantSeed.cs @@ -10,45 +10,45 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Seed"); - Main.projFrames[projectile.type] = 2; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 2; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 2; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 2) + if (Projectile.frame >= 2) { - projectile.frame = 0; + Projectile.frame = 0; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Summon/PlantSeedGreen.cs b/Projectiles/Summon/PlantSeedGreen.cs index 448873644e..3a624161e7 100644 --- a/Projectiles/Summon/PlantSeedGreen.cs +++ b/Projectiles/Summon/PlantSeedGreen.cs @@ -10,59 +10,59 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Seed"); - Main.projFrames[projectile.type] = 2; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 2; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 3; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.extraUpdates = 3; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 2) + if (Projectile.frame >= 2) { - projectile.frame = 0; + Projectile.frame = 0; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Poisoned, 180); - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) target.AddBuff(BuffID.Venom, 90); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Poisoned, 180); - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) target.AddBuff(BuffID.Venom, 90); } } diff --git a/Projectiles/Summon/PlantSporeCloud.cs b/Projectiles/Summon/PlantSporeCloud.cs index a2585bc352..c7e6cc5f5e 100644 --- a/Projectiles/Summon/PlantSporeCloud.cs +++ b/Projectiles/Summon/PlantSporeCloud.cs @@ -13,47 +13,47 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Spore Cloud"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 60; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.alpha = 60; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - projectile.rotation += projectile.direction * 0.05f; + Projectile.velocity.X *= 0.985f; + Projectile.velocity.Y *= 0.985f; + Projectile.rotation += Projectile.direction * 0.05f; if (counter % 5 == 0) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); counter++; if (counter > 300) - projectile.alpha += 5; - if (projectile.alpha >= 255) - projectile.Kill(); + Projectile.alpha += 5; + if (Projectile.alpha >= 255) + Projectile.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - if (projectile.ai[0] == 1f) - tex = ModContent.GetTexture("CalamityMod/Projectiles/Summon/PlantSporeCloud2"); - if (projectile.ai[0] == 2f) - tex = ModContent.GetTexture("CalamityMod/Projectiles/Summon/PlantSporeCloud3"); + Texture2D tex = Main.projectileTexture[Projectile.type]; + if (Projectile.ai[0] == 1f) + tex = ModContent.Request("CalamityMod/Projectiles/Summon/PlantSporeCloud2"); + if (Projectile.ai[0] == 2f) + tex = ModContent.Request("CalamityMod/Projectiles/Summon/PlantSporeCloud3"); - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Summon/PlantSummon.cs b/Projectiles/Summon/PlantSummon.cs index fc807e99f6..5c611ca461 100644 --- a/Projectiles/Summon/PlantSummon.cs +++ b/Projectiles/Summon/PlantSummon.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -20,39 +21,39 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Plantera"); - Main.projFrames[projectile.type] = 8; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - ProjectileID.Sets.NeedsUUID[projectile.type] = true; + Main.projFrames[Projectile.type] = 8; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.NeedsUUID[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 38; - projectile.height = 38; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 3f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 12; - projectile.extraUpdates = 0; + Projectile.width = 38; + Projectile.height = 38; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 3f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; + Projectile.extraUpdates = 0; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - CalamityGlobalProjectile modProj = projectile.Calamity(); + CalamityGlobalProjectile modProj = Projectile.Calamity(); if (player.statLife <= (int)(player.statLifeMax2 * 0.75)) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { enraged = true; } @@ -60,7 +61,7 @@ namespace CalamityMod.Projectiles.Summon else { enraged = false; - projectile.extraUpdates = 0; + Projectile.extraUpdates = 0; } Framing(); @@ -68,7 +69,7 @@ namespace CalamityMod.Projectiles.Summon if (!initialized) { modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; + modProj.spawnedPlayerMinionProjectileDamageValue = Projectile.damage; SpawnDust(); SpawnTentacles(); initialized = true; @@ -77,10 +78,10 @@ namespace CalamityMod.Projectiles.Summon { int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) { @@ -90,7 +91,7 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.plantera) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } @@ -100,18 +101,18 @@ namespace CalamityMod.Projectiles.Summon if (!enraged) { - if (projectile.ai[0] >= 2f) - projectile.ai[0] = 0f; - Vector2 targetVec = projectile.position; + if (Projectile.ai[0] >= 2f) + Projectile.ai[0] = 0f; + Vector2 targetVec = Projectile.position; bool foundTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); //Calculate distance between target and the projectile to know if it's too far or not - float npcDist = Vector2.Distance(npc.Center, projectile.Center); + float npcDist = Vector2.Distance(npc.Center, Projectile.Center); if (!foundTarget && npcDist < (range + extraDist)) { range = npcDist; @@ -125,11 +126,11 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); //Calculate distance between target and the projectile to know if it's too far or not - float npcDist = Vector2.Distance(npc.Center, projectile.Center); + float npcDist = Vector2.Distance(npc.Center, Projectile.Center); if (!foundTarget && npcDist < (range + extraDist)) { range = npcDist; @@ -142,7 +143,7 @@ namespace CalamityMod.Projectiles.Summon CheckIfShouldReturnToPlayer(foundTarget); - if (foundTarget && projectile.ai[0] == 0f) + if (foundTarget && Projectile.ai[0] == 0f) { StayCertainDistFromTarget(targetVec); } @@ -154,11 +155,11 @@ namespace CalamityMod.Projectiles.Summon HandleRotation(foundTarget, targetVec); IncrementAttackCounter(); - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { float projSpeed = 6f; int projType = Main.rand.NextBool(2) ? greenSeed : pinkSeed; - int projDmg = (int)(projectile.damage * 0.7f); + int projDmg = (int)(Projectile.damage * 0.7f); float speedMult = 1f; if (Main.rand.NextBool(4)) { @@ -167,15 +168,15 @@ namespace CalamityMod.Projectiles.Summon if (projType == thornBall) { speedMult = 2f; - projDmg = (int)(projectile.damage * 1.2f); + projDmg = (int)(Projectile.damage * 1.2f); } - if (projectile.ai[1] == 0f && foundTarget && range < 500f) + if (Projectile.ai[1] == 0f && foundTarget && range < 500f) { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner) { - Vector2 velocity = targetVec - projectile.Center; + Vector2 velocity = targetVec - Projectile.Center; if (projType != thornBall && Main.rand.NextBool(3)) { FireShotgun(velocity, 0.7f); @@ -185,9 +186,9 @@ namespace CalamityMod.Projectiles.Summon velocity.Normalize(); velocity *= projSpeed; velocity *= speedMult; - Projectile.NewProjectile(projectile.Center, velocity, projType, projDmg, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, projType, projDmg, Projectile.knockBack, Projectile.owner, 0f, 0f); } - projectile.netUpdate = true; + Projectile.netUpdate = true; } } } @@ -195,17 +196,17 @@ namespace CalamityMod.Projectiles.Summon else //enraged { bool charging = false; - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 30f) + Projectile.ai[1] += 1f; + Projectile.extraUpdates = 1; + if (Projectile.ai[1] > 30f) { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; + Projectile.ai[1] = 1f; + Projectile.ai[0] = 0f; + Projectile.extraUpdates = 0; + Projectile.numUpdates = 0; + Projectile.netUpdate = true; } else { @@ -216,16 +217,16 @@ namespace CalamityMod.Projectiles.Summon { return; } - Vector2 targetVec = projectile.position; + Vector2 targetVec = Projectile.position; bool foundTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); //Calculate distance between target and the projectile to know if it's too far or not - float npcDist = Vector2.Distance(npc.Center, projectile.Center); + float npcDist = Vector2.Distance(npc.Center, Projectile.Center); if (!foundTarget && npcDist < (range + extraDist)) { range = npcDist; @@ -239,11 +240,11 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC npc = Main.npc[num645]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); //Calculate distance between target and the projectile to know if it's too far or not - float npcDist = Vector2.Distance(npc.Center, projectile.Center); + float npcDist = Vector2.Distance(npc.Center, Projectile.Center); if (!foundTarget && npcDist < (range + extraDist)) { range = npcDist; @@ -258,7 +259,7 @@ namespace CalamityMod.Projectiles.Summon CheckIfShouldReturnToPlayer(foundTarget); - if (foundTarget && projectile.ai[0] == 0f) + if (foundTarget && Projectile.ai[0] == 0f) { StayCertainDistFromTarget(targetVec); } @@ -267,30 +268,30 @@ namespace CalamityMod.Projectiles.Summon PassiveAI(); } IncrementAttackCounter(); - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - if (projectile.ai[1] == 0f && foundTarget && range < 500f) + if (Projectile.ai[1] == 0f && foundTarget && range < 500f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner) { - projectile.ai[0] = 2f; - Vector2 whereIsTarget = targetVec - projectile.Center; + Projectile.ai[0] = 2f; + Vector2 whereIsTarget = targetVec - Projectile.Center; whereIsTarget.Normalize(); int projType = thornBall; if (Main.rand.NextBool(2)) { Vector2 projVelocity = whereIsTarget * 2f; - int projDmg = (int)(projectile.damage * 1.5f); - Projectile.NewProjectile(projectile.Center, projVelocity, projType, projDmg, projectile.knockBack, projectile.owner, 0f, 1f); + int projDmg = (int)(Projectile.damage * 1.5f); + Projectile.NewProjectile(Projectile.Center, projVelocity, projType, projDmg, Projectile.knockBack, Projectile.owner, 0f, 1f); } if (Main.rand.NextBool(3)) { FireShotgun(whereIsTarget, 0.8f); } float chargeSpeed = 8f; - projectile.velocity = whereIsTarget * chargeSpeed; - projectile.netUpdate = true; + Projectile.velocity = whereIsTarget * chargeSpeed; + Projectile.netUpdate = true; } } } @@ -299,52 +300,52 @@ namespace CalamityMod.Projectiles.Summon private void CheckIfShouldReturnToPlayer(bool targetLocated) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; float separationAnxietyDist = 1300f; if (targetLocated) { separationAnxietyDist = 2600f; } - if (Vector2.Distance(player.Center, projectile.Center) > separationAnxietyDist) + if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } } private void StayCertainDistFromTarget(Vector2 whereIsTarget) { - Vector2 targetPos = whereIsTarget - projectile.Center; + Vector2 targetPos = whereIsTarget - Projectile.Center; float targetDist = targetPos.Length(); targetPos.Normalize(); if (targetDist > 200f) { float speedMult = 8f; targetPos *= speedMult; - projectile.velocity = (projectile.velocity * 40f + targetPos) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + targetPos) / 41f; } else { float reverseSpeedMult = 4f; targetPos *= -reverseSpeedMult; - projectile.velocity = (projectile.velocity * 40f + targetPos) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + targetPos) / 41f; } } private void PassiveAI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; bool returningToPlayer = false; if (!returningToPlayer) { - returningToPlayer = projectile.ai[0] == 1f; + returningToPlayer = Projectile.ai[0] == 1f; } float returnSpeed = 12f; if (returningToPlayer) { returnSpeed = 30f; } - Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, -120f); + Vector2 playerVec = player.Center - Projectile.Center + new Vector2(0f, -120f); float playerDist = playerVec.Length(); if (playerDist > 200f && returnSpeed < 16f) { @@ -352,38 +353,38 @@ namespace CalamityMod.Projectiles.Summon } if (playerDist < 600f && returningToPlayer) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (playerDist > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (playerDist > 70f) { playerVec.Normalize(); playerVec *= returnSpeed; - projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + playerVec) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } } private void IncrementAttackCounter() { - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 4); + Projectile.ai[1] += (float)Main.rand.Next(1, 4); } - if (projectile.ai[1] > 40f) + if (Projectile.ai[1] > 40f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } } @@ -401,12 +402,12 @@ namespace CalamityMod.Projectiles.Summon { projType = Main.rand.NextBool(2) ? greenSeed : pinkSeed; } - int projDmg = (int)(projectile.damage * attackMult); + int projDmg = (int)(Projectile.damage * attackMult); Vector2 projVelocity = whereIsTarget * projSpeedMult; for (int i = -8; i <= 8; i += 8) { Vector2 perturbedSpeed = projVelocity.RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(projectile.Center, perturbedSpeed, projType, projDmg, projectile.knockBack * attackMult, projectile.owner, Main.rand.Next(3), 1f); + Projectile.NewProjectile(Projectile.Center, perturbedSpeed, projType, projDmg, Projectile.knockBack * attackMult, Projectile.owner, Main.rand.Next(3), 1f); } } @@ -414,32 +415,32 @@ namespace CalamityMod.Projectiles.Summon { if (targetFound && !enraged) { - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(whereIsTarget) + MathHelper.Pi, 0.1f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(whereIsTarget) + MathHelper.Pi, 0.1f); } else { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi; } } private void Framing() { - if (projectile.frameCounter++ % 8 == 7) + if (Projectile.frameCounter++ % 8 == 7) { - projectile.frame++; + Projectile.frame++; } if (!enraged) { - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } } else { - if (projectile.frame >= 8) + if (Projectile.frame >= 8) { - projectile.frame = 4; + Projectile.frame = 4; } } } @@ -449,9 +450,9 @@ namespace CalamityMod.Projectiles.Summon int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - source = source.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 dustVel = source - projectile.Center; + Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 dustVel = source - Projectile.Center; int terra = Dust.NewDust(source + dustVel, 0, 0, 107, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); Main.dust[terra].noGravity = true; Main.dust[terra].velocity = dustVel; @@ -460,12 +461,12 @@ namespace CalamityMod.Projectiles.Summon private void SpawnTentacles() { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { int tentacleAmt = 6; for (int tentacleIndex = 0; tentacleIndex < tentacleAmt; tentacleIndex++) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, tentacleIndex, Projectile.GetByUUID(projectile.owner, projectile.whoAmI)); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, tentacleIndex, Projectile.GetByUUID(Projectile.owner, Projectile.whoAmI)); } } } @@ -486,14 +487,14 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Summon/PlantTentacle.cs b/Projectiles/Summon/PlantTentacle.cs index 82b94dc403..f104333f9f 100644 --- a/Projectiles/Summon/PlantTentacle.cs +++ b/Projectiles/Summon/PlantTentacle.cs @@ -16,81 +16,81 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Tentacle"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 22; - projectile.height = 24; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 12; + Projectile.width = 22; + Projectile.height = 24; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 12; } public override void AI() { - Player player = Main.player[projectile.owner]; - if (projectile.ai[1] < 0 || projectile.ai[1] >= Main.maxProjectiles) + Player player = Main.player[Projectile.owner]; + if (Projectile.ai[1] < 0 || Projectile.ai[1] >= Main.maxProjectiles) { - projectile.Kill(); + Projectile.Kill(); return; } // If something has gone wrong with either the tentacle or the host plant, destroy the proj. - Projectile hostPlant = Main.projectile[(int)projectile.ai[1]]; - if (projectile.type != ModContent.ProjectileType() || !hostPlant.active || hostPlant.type != ModContent.ProjectileType()) + Projectile hostPlant = Main.projectile[(int)Projectile.ai[1]]; + if (Projectile.type != ModContent.ProjectileType() || !hostPlant.active || hostPlant.type != ModContent.ProjectileType()) { - projectile.Kill(); + Projectile.Kill(); return; } - if (projectile.frameCounter++ % 6 == 0) + if (Projectile.frameCounter++ % 6 == 0) { - projectile.frame++; + Projectile.frame++; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } if (!initialized) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; initialized = true; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + Projectile.damage = trueDamage; } if (player.Calamity().plantera) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - projectile.rotation = (projectile.Center - hostPlant.Center).ToRotation() + MathHelper.Pi; + Projectile.rotation = (Projectile.Center - hostPlant.Center).ToRotation() + MathHelper.Pi; - projectile.MinionAntiClump(1f); + Projectile.MinionAntiClump(1f); counter++; if (counter % 30 == 0) //changes every half second { desiredDistance = Main.rand.NextFloat(175f, 225f); } - Vector2 targetPos = hostPlant.Center - projectile.Center; + Vector2 targetPos = hostPlant.Center - Projectile.Center; float targetDist = targetPos.Length(); targetPos.Normalize(); if (targetDist > desiredDistance) @@ -98,49 +98,49 @@ namespace CalamityMod.Projectiles.Summon float speedMult = 10f; speedMult += (targetDist - desiredDistance) * 0.2f; //+0.2f for every 1f away from the desired distance targetPos *= speedMult; - projectile.velocity = (projectile.velocity * 40f + targetPos) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + targetPos) / 41f; } else { float reverseSpeedMult = 5f; targetPos *= -reverseSpeedMult; - projectile.velocity = (projectile.velocity * 40f + targetPos) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + targetPos) / 41f; } if (targetDist > 2000f) { - projectile.position.X = hostPlant.Center.X - (float)(projectile.width / 2); - projectile.position.Y = hostPlant.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = hostPlant.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = hostPlant.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } - if (projectile.ai[0] >= 3f) + if (Projectile.ai[0] >= 3f) { - if (hostPlant.Center.X - projectile.Center.X > 0) + if (hostPlant.Center.X - Projectile.Center.X > 0) { - projectile.velocity.X += 0.05f; + Projectile.velocity.X += 0.05f; } } else { - if (hostPlant.Center.X - projectile.Center.X < 0) + if (hostPlant.Center.X - Projectile.Center.X < 0) { - projectile.velocity.X -= 0.05f; + Projectile.velocity.X -= 0.05f; } } - if (projectile.ai[0] % 2f == 0f) + if (Projectile.ai[0] % 2f == 0f) { - if (hostPlant.Center.Y - projectile.Center.Y > 0) + if (hostPlant.Center.Y - Projectile.Center.Y > 0) { - projectile.velocity.Y += 0.05f; + Projectile.velocity.Y += 0.05f; } } else { - if (hostPlant.Center.Y - projectile.Center.Y < 0) + if (hostPlant.Center.Y - Projectile.Center.Y < 0) { - projectile.velocity.Y -= 0.05f; + Projectile.velocity.Y -= 0.05f; } } } @@ -149,28 +149,28 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < 10; i++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 107); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.ai[1] < 0 || projectile.ai[1] >= Main.maxProjectiles) + if (Projectile.ai[1] < 0 || Projectile.ai[1] >= Main.maxProjectiles) { return false; } // If something has gone wrong with either the tentacle or the host plant, return. - Projectile hostPlant = Main.projectile[(int)projectile.ai[1]]; - if (projectile.type != ModContent.ProjectileType() || !hostPlant.active || hostPlant.type != ModContent.ProjectileType()) + Projectile hostPlant = Main.projectile[(int)Projectile.ai[1]]; + if (Projectile.type != ModContent.ProjectileType() || !hostPlant.active || hostPlant.type != ModContent.ProjectileType()) { return false; } Vector2 source = hostPlant.Center; Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D chain = ModContent.GetTexture("CalamityMod/ExtraTextures/Chains/PlantationChain"); - Vector2 goal = projectile.Center; + Texture2D chain = ModContent.Request("CalamityMod/ExtraTextures/Chains/PlantationChain"); + Vector2 goal = Projectile.Center; Rectangle? sourceRectangle = null; float textureHeight = (float)chain.Height; Vector2 drawVector = source - goal; @@ -207,19 +207,19 @@ namespace CalamityMod.Projectiles.Summon public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { //Only 1 tentacle needs to draw this, the last one spawned because it's latest in the projectile array. - if (projectile.ai[0] < 5) + if (Projectile.ai[0] < 5) { return; } - if (projectile.ai[1] < 0 || projectile.ai[1] >= Main.maxProjectiles) + if (Projectile.ai[1] < 0 || Projectile.ai[1] >= Main.maxProjectiles) { return; } // If something has gone wrong with either the tentacle or the host plant, return. - Projectile hostPlant = Main.projectile[(int)projectile.ai[1]]; - if (projectile.type != ModContent.ProjectileType() || !hostPlant.active || hostPlant.type != ModContent.ProjectileType()) + Projectile hostPlant = Main.projectile[(int)Projectile.ai[1]]; + if (Projectile.type != ModContent.ProjectileType() || !hostPlant.active || hostPlant.type != ModContent.ProjectileType()) { return; } diff --git a/Projectiles/Summon/PlantThornBall.cs b/Projectiles/Summon/PlantThornBall.cs index 6008721bce..11d310e0b4 100644 --- a/Projectiles/Summon/PlantThornBall.cs +++ b/Projectiles/Summon/PlantThornBall.cs @@ -10,40 +10,40 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Thorn Ball"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.minion = true; - projectile.aiStyle = 14; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.extraUpdates = 1; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 300; + Projectile.minion = true; + Projectile.aiStyle = 14; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.extraUpdates = 1; } public override void AI() { if (Main.rand.NextBool(12)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 44, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.velocity.X != oldVelocity.X) + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X * 1.001f; + Projectile.velocity.X = -oldVelocity.X * 1.001f; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y * 1.001f; + Projectile.velocity.Y = -oldVelocity.Y * 1.001f; } return false; } @@ -51,14 +51,14 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Poisoned, 180); - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) target.AddBuff(BuffID.Venom, 90); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Poisoned, 180); - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) target.AddBuff(BuffID.Venom, 90); } } diff --git a/Projectiles/Summon/PlateProjectile.cs b/Projectiles/Summon/PlateProjectile.cs index 47685f3aec..f99d6d7a8e 100644 --- a/Projectiles/Summon/PlateProjectile.cs +++ b/Projectiles/Summon/PlateProjectile.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class PlateProjectile : ModProjectile @@ -9,48 +10,48 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Plate"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - Main.projFrames[projectile.type] = 5; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 16; - projectile.friendly = true; - projectile.minion = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.aiStyle = 1; + Projectile.width = 10; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.aiStyle = 1; } public override void AI() { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y = projectile.velocity.Y + 0.01f; - projectile.rotation -= MathHelper.ToRadians(90) * projectile.direction; - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.velocity.X *= 0.9995f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.01f; + Projectile.rotation -= MathHelper.ToRadians(90) * Projectile.direction; + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 5) + if (Projectile.frame >= 5) { - projectile.frame = 0; + Projectile.frame = 0; } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Shatter, (int)projectile.Center.X, (int)projectile.Center.Y); - if (projectile.owner == Main.myPlayer) + SoundEngine.PlaySound(SoundID.Shatter, (int)Projectile.Center.X, (int)Projectile.Center.Y); + if (Projectile.owner == Main.myPlayer) { for (int index = 0; index < 3; ++index) { - 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); + 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); if (shard.WithinBounds(Main.maxProjectiles)) Main.projectile[shard].Calamity().forceMinion = true; } diff --git a/Projectiles/Summon/PolypLauncherProjectile.cs b/Projectiles/Summon/PolypLauncherProjectile.cs index 7bdf0668b6..a38d6a2895 100644 --- a/Projectiles/Summon/PolypLauncherProjectile.cs +++ b/Projectiles/Summon/PolypLauncherProjectile.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -12,44 +13,44 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Polyp Chunk"); - ProjectileID.Sets.SentryShot[projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.tileCollide = true; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.alpha = 255; - projectile.minion = true; - projectile.minionSlots = 0f; + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.alpha = 255; + Projectile.minion = true; + Projectile.minionSlots = 0f; } public override void AI() { - if (projectile.velocity.Y <= 10f) + if (Projectile.velocity.Y <= 10f) { - projectile.velocity.Y += Gravity; + Projectile.velocity.Y += Gravity; } - projectile.ai[0]++; - if (projectile.ai[0] < 10) + Projectile.ai[0]++; + if (Projectile.ai[0] < 10) { - projectile.alpha = (int)MathHelper.Lerp(255, 0, projectile.ai[0] / 10f); + Projectile.alpha = (int)MathHelper.Lerp(255, 0, Projectile.ai[0] / 10f); } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.1f * projectile.direction; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.1f * Projectile.direction; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item10, projectile.Center); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); //Dust on impact int dust_splash = 0; while (dust_splash < 9) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 225, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.15f, 120, default, 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 225, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1f); dust_splash += 1; } int split = 0; @@ -57,21 +58,21 @@ namespace CalamityMod.Projectiles.Summon while (split < shardAmt) { //Calculate the velocity of the projectile - float shardspeedX = -projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); - float shardspeedY = -projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; + float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); + float shardspeedY = -Projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; //Prevents the projectile speed from being too low if (shardspeedX < 2f && shardspeedX > -2f) { - shardspeedX += -projectile.velocity.X; + shardspeedX += -Projectile.velocity.X; } if (shardspeedY > 2f && shardspeedY < 2f) { - shardspeedY += -projectile.velocity.Y; + shardspeedY += -Projectile.velocity.Y; } Vector2 shardSpeed = new Vector2(shardspeedX, shardspeedY); //Spawn the projectile - int shard = Projectile.NewProjectile(projectile.Center + shardSpeed, shardSpeed, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack / 2f, projectile.owner, Main.rand.Next(3)); + int shard = Projectile.NewProjectile(Projectile.Center + shardSpeed, shardSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack / 2f, Projectile.owner, Main.rand.Next(3)); split += 1; } } diff --git a/Projectiles/Summon/PolypLauncherSentry.cs b/Projectiles/Summon/PolypLauncherSentry.cs index 0d01eff6a8..a272c8ea48 100644 --- a/Projectiles/Summon/PolypLauncherSentry.cs +++ b/Projectiles/Summon/PolypLauncherSentry.cs @@ -10,72 +10,72 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Polyp Launcher"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 42; - projectile.height = 25; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; + Projectile.width = 42; + Projectile.height = 25; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.sentry = true; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.penetrate = -1; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.velocity.Y += 0.5f; - if (projectile.velocity.Y > 10f) + Projectile.velocity.Y += 0.5f; + if (Projectile.velocity.Y > 10f) { - projectile.velocity.Y = 10f; + Projectile.velocity.Y = 10f; } - projectile.StickToTiles(false, false); + Projectile.StickToTiles(false, false); - if (projectile.ai[0] > 0f) + if (Projectile.ai[0] > 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; return; } - projectile.ai[1] += Main.rand.Next(1,3); + Projectile.ai[1] += Main.rand.Next(1,3); - NPC potentialTarget = projectile.Center.MinionHoming(800f, player, false); + NPC potentialTarget = Projectile.Center.MinionHoming(800f, player, false); - if (projectile.owner == Main.myPlayer && potentialTarget != null) + if (Projectile.owner == Main.myPlayer && potentialTarget != null) { - if (projectile.ai[1] > 40f) + if (Projectile.ai[1] > 40f) { - Vector2 spawnPosition = new Vector2(projectile.oldPosition.X + (projectile.width / 2), projectile.oldPosition.Y + (projectile.height / 2)); + Vector2 spawnPosition = new Vector2(Projectile.oldPosition.X + (Projectile.width / 2), Projectile.oldPosition.Y + (Projectile.height / 2)); float shootSpeed = 16f; float gravity = -PolypLauncherProjectile.Gravity; @@ -83,11 +83,11 @@ namespace CalamityMod.Projectiles.Summon float angle = 0.25f * (float)Math.Asin(MathHelper.Clamp(gravity * distance * 1.5f / (float)Math.Pow(shootSpeed, 2), -1f, 1f)); Vector2 velocity = new Vector2(0f, -shootSpeed).RotatedBy(angle).RotatedByRandom(0.1f); - velocity.X *= (potentialTarget.Center.X - projectile.Center.X < 0).ToDirectionInt(); + velocity.X *= (potentialTarget.Center.X - Projectile.Center.X < 0).ToDirectionInt(); - Projectile.NewProjectile(spawnPosition, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.NewProjectile(spawnPosition, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Summon/PolypLauncherShrapnel.cs b/Projectiles/Summon/PolypLauncherShrapnel.cs index ccaf5e6282..be0f7760ba 100644 --- a/Projectiles/Summon/PolypLauncherShrapnel.cs +++ b/Projectiles/Summon/PolypLauncherShrapnel.cs @@ -10,28 +10,28 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Polyp Shrapnel"); - ProjectileID.Sets.SentryShot[projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.friendly = true; - projectile.width = 13; - projectile.height = 13; - projectile.ignoreWater = true; - projectile.timeLeft = 120; - projectile.minion = true; - projectile.minionSlots = 0f; + Projectile.friendly = true; + Projectile.width = 13; + Projectile.height = 13; + Projectile.ignoreWater = true; + Projectile.timeLeft = 120; + Projectile.minion = true; + Projectile.minionSlots = 0f; } public override void AI() { //Rotation and gravity - projectile.rotation += 0.6f * projectile.direction; - projectile.velocity.Y += 0.27f; - if (projectile.velocity.Y > 16f) + Projectile.rotation += 0.6f * Projectile.direction; + Projectile.velocity.Y += 0.27f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon int splash = 0; while (splash < 4) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 225, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.10f, 150, default, 0.7f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 225, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.7f); splash += 1; } } @@ -49,16 +49,16 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { //Changes the texture of the projectile - Texture2D texture = Main.projectileTexture[projectile.type]; - if (projectile.ai[0] == 1f) + Texture2D texture = Main.projectileTexture[Projectile.type]; + if (Projectile.ai[0] == 1f) { - texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/PolypLauncherShrapnel2"); + texture = ModContent.Request("CalamityMod/Projectiles/Summon/PolypLauncherShrapnel2"); } - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/PolypLauncherShrapnel3"); + texture = ModContent.Request("CalamityMod/Projectiles/Summon/PolypLauncherShrapnel3"); } - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, texture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Summon/PowerfulRaven.cs b/Projectiles/Summon/PowerfulRaven.cs index 835a9ec8e8..2f7eecf586 100644 --- a/Projectiles/Summon/PowerfulRaven.cs +++ b/Projectiles/Summon/PowerfulRaven.cs @@ -16,47 +16,47 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Super Raven"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 24; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 30; + Projectile.height = 24; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.ai[0] = -1f; - projectile.localAI[0] = 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.ai[0] = -1f; + Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) { @@ -66,95 +66,95 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.powerfulRaven) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); + NPC potentialTarget = Projectile.Center.MinionHoming(DistanceToCheck, player); if (potentialTarget != null) { - projectile.ai[1] += 1f; - if (projectile.Distance(potentialTarget.Center) > TeleportDistance) + Projectile.ai[1] += 1f; + if (Projectile.Distance(potentialTarget.Center) > TeleportDistance) { - projectile.Center = potentialTarget.Center + Utils.NextVector2Unit(Main.rand) * potentialTarget.Size * 1.3f; - projectile.netUpdate = true; + Projectile.Center = potentialTarget.Center + Utils.NextVector2Unit(Main.rand) * potentialTarget.Size * 1.3f; + Projectile.netUpdate = true; } else { - if (projectile.ai[1] % 45f == 28f || projectile.Distance(potentialTarget.Center) > 450f) + if (Projectile.ai[1] % 45f == 28f || Projectile.Distance(potentialTarget.Center) > 450f) { if (Main.rand.NextBool(6)) { - projectile.Center = potentialTarget.Center + Utils.NextVector2Unit(Main.rand) * potentialTarget.Size * 1.3f; - projectile.netUpdate = true; + Projectile.Center = potentialTarget.Center + Utils.NextVector2Unit(Main.rand) * potentialTarget.Size * 1.3f; + Projectile.netUpdate = true; for (int i = 0; i < 40; i++) { float angle = MathHelper.TwoPi / 40f * i; float lerp = MathHelper.Lerp(0f, 1f, (float)Math.Sin(i / 8f * MathHelper.TwoPi) * 0.5f + 0.5f); - Dust dust = Dust.NewDustPerfect(projectile.position, DustID.Fire); + Dust dust = Dust.NewDustPerfect(Projectile.position, DustID.Fire); dust.velocity = Vector2.Lerp(Vector2.Zero, angle.ToRotationVector2() * 6f, lerp); dust.noGravity = true; } } - projectile.velocity = (potentialTarget.Center - projectile.Center) / 50f; - if (projectile.velocity.Length() < 34f) + Projectile.velocity = (potentialTarget.Center - Projectile.Center) / 50f; + if (Projectile.velocity.Length() < 34f) { - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX) * 34f; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 34f; } for (int i = 0; i < 20; i++) { float angle = MathHelper.TwoPi / 20f * i; - Dust dust = Dust.NewDustPerfect(projectile.position + angle.ToRotationVector2().RotatedBy(projectile.rotation) * new Vector2(14f, 21f), DustID.Fire); - dust.velocity = angle.ToRotationVector2().RotatedBy(projectile.rotation) * 2f; + Dust dust = Dust.NewDustPerfect(Projectile.position + angle.ToRotationVector2().RotatedBy(Projectile.rotation) * new Vector2(14f, 21f), DustID.Fire); + dust.velocity = angle.ToRotationVector2().RotatedBy(Projectile.rotation) * 2f; dust.noGravity = true; } } - if (projectile.ai[1] % 45f >= 28f) + if (Projectile.ai[1] % 45f >= 28f) { - projectile.frame = Main.projFrames[projectile.type] - 1; - Lighting.AddLight(projectile.Center, 1f, 1f, 1f); + Projectile.frame = Main.projFrames[Projectile.type] - 1; + Lighting.AddLight(Projectile.Center, 1f, 1f, 1f); } else { - projectile.velocity *= 0.95f; - projectile.rotation = projectile.rotation.AngleTowards(0f, 0.3f); - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.velocity *= 0.95f; + Projectile.rotation = Projectile.rotation.AngleTowards(0f, 0.3f); + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type] - 1) + if (Projectile.frame >= Main.projFrames[Projectile.type] - 1) { - projectile.frame = 0; + Projectile.frame = 0; } } } } else { - projectile.rotation = projectile.rotation.AngleTowards(0f, 0.2f); - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.rotation = Projectile.rotation.AngleTowards(0f, 0.2f); + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type] - 1) + if (Projectile.frame >= Main.projFrames[Projectile.type] - 1) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.Distance(player.Center) > SeparationAnxietyDistance) + if (Projectile.Distance(player.Center) > SeparationAnxietyDistance) { - projectile.Center = player.Center; - projectile.velocity = Utils.NextVector2Unit(Main.rand) * 12f; - projectile.netUpdate = true; + Projectile.Center = player.Center; + Projectile.velocity = Utils.NextVector2Unit(Main.rand) * 12f; + Projectile.netUpdate = true; } - else if (!projectile.WithinRange(player.Center, 90f)) - projectile.velocity = (projectile.velocity * 19f + projectile.SafeDirectionTo(player.Center) * 12f) / 20f; + else if (!Projectile.WithinRange(player.Center, 90f)) + Projectile.velocity = (Projectile.velocity * 19f + Projectile.SafeDirectionTo(player.Center) * 12f) / 20f; } - projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + Projectile.direction = Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); } } } diff --git a/Projectiles/Summon/PrincessMissile.cs b/Projectiles/Summon/PrincessMissile.cs index 5861282d0f..b073c90b0a 100644 --- a/Projectiles/Summon/PrincessMissile.cs +++ b/Projectiles/Summon/PrincessMissile.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class PrincessMissile : ModProjectile @@ -14,93 +15,93 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Hive Bomb"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.minion = true; - projectile.tileCollide = true; - projectile.penetrate = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.tileCollide = true; + Projectile.penetrate = 1; } public override void AI() { - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - if (Math.Abs(projectile.velocity.X) >= 3f || Math.Abs(projectile.velocity.Y) >= 3f) + if (Math.Abs(Projectile.velocity.X) >= 3f || Math.Abs(Projectile.velocity.Y) >= 3f) { float num247 = 0f; float num248 = 0f; if (Main.rand.Next(2) == 1) { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; + num247 = Projectile.velocity.X * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); + int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.25f); + num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.25f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } else if (Main.rand.NextBool(4)) { - int num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 0.5f); + int num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 0.5f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; + Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(50, 250, 50, projectile.alpha); + return new Color(50, 250, 50, Projectile.alpha); } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 64; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -110,13 +111,13 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index db25d4e5a1..9d928dddc5 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -16,44 +17,44 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Profaned Energy"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 60; - projectile.height = 60; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; + Projectile.width = 60; + Projectile.height = 60; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.sentry = true; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.penetrate = -1; } public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.frameCounter++; - if (projectile.frameCounter > 5) + Player player = Main.player[Projectile.owner]; + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } if (count == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - Main.PlaySound(SoundID.Item20, projectile.Center); + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); for (int i = 0; i < 5; i++) { - int holy = Dust.NewDust(projectile.Center, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); + int holy = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); Main.dust[holy].velocity *= 3f; - Main.dust[holy].position = projectile.Center; + Main.dust[holy].position = Projectile.Center; if (Main.rand.NextBool(2)) { Main.dust[holy].scale = 0.5f; @@ -62,44 +63,44 @@ namespace CalamityMod.Projectiles.Summon } for (int j = 0; j < 10; j++) { - int fire = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - Main.dust[fire].position = projectile.Center; - fire = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[fire].position = Projectile.Center; + fire = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; - Main.dust[fire].position = projectile.Center; + Main.dust[fire].position = Projectile.Center; } count += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; return; } bool flag18 = false; - float num506 = projectile.Center.X; - float num507 = projectile.Center.Y; + float num506 = Projectile.Center.X; + float num507 = Projectile.Center.Y; float num508 = 1000f; int target = 0; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float num539 = npc.Center.X; float num540 = npc.Center.Y; - float num541 = Math.Abs(projectile.Center.X - num539) + Math.Abs(projectile.Center.Y - num540); - if (num541 < num508 && Collision.CanHit(projectile.Center, projectile.width, projectile.height, npc.Center, npc.width, npc.height)) + float num541 = Math.Abs(Projectile.Center.X - num539) + Math.Abs(Projectile.Center.Y - num540); + if (num541 < num508 && Collision.CanHit(Projectile.Center, Projectile.width, Projectile.height, npc.Center, npc.width, npc.height)) { num506 = num539; num507 = num540; @@ -112,12 +113,12 @@ namespace CalamityMod.Projectiles.Summon { for (int num512 = 0; num512 < Main.maxNPCs; num512++) { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) + if (Main.npc[num512].CanBeChasedBy(Projectile, false)) { float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + float num515 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num513) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) { num508 = num515; num506 = num513; @@ -132,15 +133,15 @@ namespace CalamityMod.Projectiles.Summon { float num516 = num506; float num517 = num507; - num506 -= projectile.Center.X; - num507 -= projectile.Center.Y; + num506 -= Projectile.Center.X; + num507 -= Projectile.Center.Y; if (num506 < 0f) { - projectile.spriteDirection = 1; + Projectile.spriteDirection = 1; } else { - projectile.spriteDirection = -1; + Projectile.spriteDirection = -1; } int projectileType = Utils.SelectRandom(Main.rand, new int[] { @@ -148,15 +149,15 @@ namespace CalamityMod.Projectiles.Summon ModContent.ProjectileType() }); float speed = 25f; - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector29 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num404 = num516 - vector29.X; float num405 = num517 - vector29.Y; float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); num406 = speed / num406; num404 *= num406; num405 *= num406; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, projectileType, projectile.damage, projectile.knockBack, projectile.owner, (float)target, 0f); - projectile.ai[0] = 16f; + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, num404, num405, projectileType, Projectile.damage, Projectile.knockBack, Projectile.owner, (float)target, 0f); + Projectile.ai[0] = 16f; } } } diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs index 116c3d0b09..87fc4c7a12 100644 --- a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -18,15 +18,15 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Bab Fireball"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } private void Split(bool hit, bool chaseable) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; bool enrage = player.statLife <= (int)((double)player.statLifeMax2 * 0.5); player.Calamity().rollBabSpears(hit ? 1 : 0, chaseable); int outerSplits = enrage ? 20 : 10; @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon float mult = enrage ? 0.4f : 0.6f; if (!hit) mult = enrage ? 0.2f : 0.1f; //punishing to miss - int damage = (int)((projectile.damage * 0.2f) * mult); + int damage = (int)((Projectile.damage * 0.2f) * mult); float outerAngleVariance = MathHelper.TwoPi / (float)outerSplits; float outerOffsetAngle = MathHelper.Pi / (2f * outerSplits); @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 velocity = new Vector2(outerPosVec.X, outerPosVec.Y).RotatedBy(outerOffsetAngle); velocity.Normalize(); velocity *= 8f; - int proj = Projectile.NewProjectile(projectile.Center + outerPosVec, velocity, ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner, 0f, 0f); + int proj = Projectile.NewProjectile(Projectile.Center + outerPosVec, velocity, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner, 0f, 0f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMinion = true; if (innerSplits > 0) //only runs if there's still inner splits to create @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Summon velocity = new Vector2(innerPosVec.X, innerPosVec.Y).RotatedBy(innerOffsetAngle); velocity.Normalize(); velocity *= 5f; - proj = Projectile.NewProjectile(projectile.Center + innerPosVec, velocity, ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner, 0f, 0f); + proj = Projectile.NewProjectile(Projectile.Center + innerPosVec, velocity, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner, 0f, 0f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMinion = true; } @@ -69,104 +69,104 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 180; - projectile.height = 180; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 75; - projectile.minion = true; - projectile.scale = 0.6f; + Projectile.width = 180; + Projectile.height = 180; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 75; + Projectile.minion = true; + Projectile.scale = 0.6f; } public override bool PreAI() { - projectile.Calamity().overridesMinionDamagePrevention = true; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.Calamity().overridesMinionDamagePrevention = true; + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.timeLeft == 50) + if (Projectile.timeLeft == 50) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.wet && !projectile.lavaWet && projectile.timeLeft < 70) //timeleft check because projectile lavawet isn't set until after the first frame + if (Projectile.wet && !Projectile.lavaWet && Projectile.timeLeft < 70) //timeleft check because projectile lavawet isn't set until after the first frame { - projectile.Kill(); + Projectile.Kill(); } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if ((double)Math.Abs(Projectile.velocity.X) > 0.2) { - projectile.rotation = projectile.direction; + Projectile.rotation = Projectile.direction; } - if (projectile.velocity.X < 0f) + if (Projectile.velocity.X < 0f) { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } else { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); } return false; } public override void AI() { - int num469 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3, texture2D13); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 3, texture2D13); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { Split(true, target.chaseable); } - projectile.active = false; + Projectile.active = false; } public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { Split(true, true); } - projectile.active = false; + Projectile.active = false; } public override void Kill(int timeLeft) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { Split(false, false); } - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); for (int num193 = 0; num193 < 6; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 50, default, 1.5f); } for (int num194 = 0; num194 < 60; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, default, 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 0, default, 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 50, default, 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } @@ -184,65 +184,65 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Bab Fire"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.minion = true; - projectile.gfxOffY = -25f; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 600; + Projectile.minion = true; + Projectile.gfxOffY = -25f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override bool PreAI() { - projectile.Calamity().overridesMinionDamagePrevention = true; + Projectile.Calamity().overridesMinionDamagePrevention = true; return true; } public override void AI() { - Lighting.AddLight(projectile.Center, 5, 1, 0); - if (projectile.timeLeft == 600) + Lighting.AddLight(Projectile.Center, 5, 1, 0); + if (Projectile.timeLeft == 600) { - damage = projectile.damage; - projectile.damage = 0; + damage = Projectile.damage; + Projectile.damage = 0; } - if (projectile.timeLeft > 550) - projectile.velocity *= 0.95f; - int num469 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + if (Projectile.timeLeft > 550) + Projectile.velocity *= 0.95f; + int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - if (projectile.timeLeft <= 550) + if (Projectile.timeLeft <= 550) { - if (projectile.penetrate == -1) - projectile.damage = damage; - projectile.penetrate = 1; - if (projectile.timeLeft > 500) - projectile.velocity *= 1.06f; - float num535 = projectile.position.X; - float num536 = projectile.position.Y; + if (Projectile.penetrate == -1) + Projectile.damage = damage; + Projectile.penetrate = 1; + if (Projectile.timeLeft > 500) + Projectile.velocity *= 1.06f; + float num535 = Projectile.position.X; + float num536 = Projectile.position.Y; float num537 = 3000f; bool flag19 = false; - NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) + NPC ownerMinionAttackTargetNPC2 = Projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(Projectile, false)) { float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + float num541 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num539) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num540); if (num541 < num537) { num537 = num541; @@ -257,11 +257,11 @@ namespace CalamityMod.Projectiles.Summon int num3; for (int num542 = 0; num542 < Main.npc.Length; num542 = num3 + 1) { - if (Main.npc[num542].CanBeChasedBy(projectile, false)) + if (Main.npc[num542].CanBeChasedBy(Projectile, false)) { float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); + float num545 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num543) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num544); if (num545 < num537) { num537 = num545; @@ -276,10 +276,10 @@ namespace CalamityMod.Projectiles.Summon } if (flag19) { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { float num550 = 24f; //12 - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -290,8 +290,8 @@ namespace CalamityMod.Projectiles.Summon num553 = num550 / num553; num551 *= num553; num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; + Projectile.velocity.X = (Projectile.velocity.X * 14f + num551) / 15f; + Projectile.velocity.Y = (Projectile.velocity.Y * 14f + num552) / 15f; } } } @@ -299,12 +299,12 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.player[projectile.owner].Calamity().rollBabSpears(35, target.chaseable); + Main.player[Projectile.owner].Calamity().rollBabSpears(35, target.chaseable); } public override void OnHitPvp(Player target, int damage, bool crit) { - Main.player[projectile.owner].Calamity().rollBabSpears(35, true); + Main.player[Projectile.owner].Calamity().rollBabSpears(35, true); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) @@ -320,11 +320,11 @@ namespace CalamityMod.Projectiles.Summon bool instakill = target.type == ModContent.NPCType() || target.type == ModContent.NPCType() || target.type == ModContent.NPCType() || target.type == ModContent.NPCType(); if (!instakill && this.target != null && target != this.target) { - if (projectile.getRect().Intersects(target.getRect())) + if (Projectile.getRect().Intersects(target.getRect())) { hits++; if (hits >= 100) - projectile.Kill(); + Projectile.Kill(); } return false; } @@ -334,15 +334,15 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 14); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = Projectile.height = 200; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 4; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -352,10 +352,10 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 12; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } @@ -371,86 +371,86 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Friendly Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 50; - projectile.minion = true; - projectile.alpha = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 50; + Projectile.minion = true; + Projectile.alpha = 100; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - projectile.velocity *= 1.06f; - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - Lighting.AddLight(projectile.Center, 5, 1, 0); + Projectile.velocity *= 1.06f; + Projectile.rotation = Projectile.velocity.ToRotation() + 1.57079637f; + Lighting.AddLight(Projectile.Center, 5, 1, 0); } public override bool PreAI() { - projectile.Calamity().overridesMinionDamagePrevention = true; - if (projectile.timeLeft == 50 && projectile.ai[1] == 1f) - projectile.penetrate = 3; + Projectile.Calamity().overridesMinionDamagePrevention = true; + if (Projectile.timeLeft == 50 && Projectile.ai[1] == 1f) + Projectile.penetrate = 3; return true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); + writer.Write(Projectile.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); } public override bool? CanHitNPC(NPC target) { - if (projectile.timeLeft > 133 && projectile.ai[0] < 2f) + if (Projectile.timeLeft > 133 && Projectile.ai[0] < 2f) return false; return null; } public override bool CanHitPvp(Player target) { - return projectile.timeLeft <= 133 || projectile.ai[0] == 2f; + return Projectile.timeLeft <= 133 || Projectile.ai[0] == 2f; } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (projectile.ai[0] == 1f && projectile.penetrate == 1) + if (Projectile.ai[0] == 1f && Projectile.penetrate == 1) { handleSpecialHit(target.Center); } - int chance = projectile.ai[0] == 2f ? 20 : 10 * projectile.penetrate; - Main.player[projectile.owner].Calamity().rollBabSpears(chance, target.chaseable); + int chance = Projectile.ai[0] == 2f ? 20 : 10 * Projectile.penetrate; + Main.player[Projectile.owner].Calamity().rollBabSpears(chance, target.chaseable); } public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) { - if (projectile.ai[0] == 1f && projectile.penetrate == 1) + if (Projectile.ai[0] == 1f && Projectile.penetrate == 1) { handleSpecialHit(target.Center); } - int chance = projectile.ai[0] == 2f ? 20 : 10 * projectile.penetrate; - Main.player[projectile.owner].Calamity().rollBabSpears(chance, true); + int chance = Projectile.ai[0] == 2f ? 20 : 10 * Projectile.penetrate; + Main.player[Projectile.owner].Calamity().rollBabSpears(chance, true); } private void handleSpecialHit(Vector2 targCenter) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < 10; ++i) { @@ -460,43 +460,43 @@ namespace CalamityMod.Projectiles.Summon float speed = Main.rand.NextFloat(15f, 18f); Vector2 velocity = startDir * (-speed); - Projectile.NewProjectile(startPoint, velocity, ModContent.ProjectileType(), (int)(0.25f * projectile.damage), 0f, projectile.owner, 2f, 0f); + Projectile.NewProjectile(startPoint, velocity, ModContent.ProjectileType(), (int)(0.25f * Projectile.damage), 0f, Projectile.owner, 2f, 0f); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft > 133) + if (Projectile.timeLeft > 133) { - projectile.localAI[0] += 5f; - byte b2 = (byte)(((int)projectile.localAI[0]) * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); + Projectile.localAI[0] += 5f; + byte b2 = (byte)(((int)Projectile.localAI[0]) * 3); + byte a2 = (byte)((float)Projectile.alpha * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } private void onHit() { - Main.PlaySound(new LegacySoundStyle(2, 74, Terraria.Audio.SoundType.Sound), (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(new LegacySoundStyle(2, 74, Terraria.Audio.SoundType.Sound), (int)Projectile.position.X, (int)Projectile.position.Y); if (Main.rand.NextBool(2) || Main.rand.NextBool(3)) //so it's not exactly 1 in 2, but it's not more or less consistently either. { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = Projectile.height = 200; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 4; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -506,10 +506,10 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 12; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } @@ -539,16 +539,16 @@ namespace CalamityMod.Projectiles.Summon private void swarmAI() { - float num535 = projectile.position.X; - float num536 = projectile.position.Y; + float num535 = Projectile.position.X; + float num536 = Projectile.position.Y; float num537 = 2000f; bool flag19 = false; - NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) + NPC ownerMinionAttackTargetNPC2 = Projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(Projectile, false)) { float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + float num541 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num539) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num540); if (num541 < num537) { num537 = num541; @@ -562,11 +562,11 @@ namespace CalamityMod.Projectiles.Summon { for (int num542 = 0; num542 < Main.npc.Length; num542++) { - if (Main.npc[num542].CanBeChasedBy(projectile, false)) + if (Main.npc[num542].CanBeChasedBy(Projectile, false)) { float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); + float num545 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num543) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num544); if (num545 < num537) { num537 = num545; @@ -580,15 +580,15 @@ namespace CalamityMod.Projectiles.Summon } if (flag19) { - projectile.tileCollide = false; - if (projectile.timeLeft < 20) + Projectile.tileCollide = false; + if (Projectile.timeLeft < 20) { - projectile.timeLeft = 50; + Projectile.timeLeft = 50; kill = true; } float num550 = 40f; - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -599,21 +599,21 @@ namespace CalamityMod.Projectiles.Summon num553 = num550 / num553; num551 *= num553; num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; + Projectile.velocity.X = (Projectile.velocity.X * 14f + num551) / 15f; + Projectile.velocity.Y = (Projectile.velocity.Y * 14f + num552) / 15f; } else { if (kill) - projectile.Kill(); - projectile.tileCollide = true; + Projectile.Kill(); + Projectile.tileCollide = true; } } private void swarm(Vector2 targetPos) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { float swarmAmount = Main.rand.Next(6, 10); //6-9 for (float i = 0; i < swarmAmount; i++) @@ -621,10 +621,10 @@ namespace CalamityMod.Projectiles.Summon float x = targetPos.X + Main.rand.Next(-500, 501); float y = targetPos.Y - 500 + Main.rand.Next(-200, 1); Vector2 pos = new Vector2(x, y); - Vector2 correctedVelocity = projectile.position - pos; + Vector2 correctedVelocity = Projectile.position - pos; correctedVelocity.Normalize(); correctedVelocity *= 25f; - int proj = Projectile.NewProjectile(pos, correctedVelocity, ModContent.ProjectileType(), (int)((double)projectile.damage * 1.5f), projectile.knockBack, projectile.owner, 2); + int proj = Projectile.NewProjectile(pos, correctedVelocity, ModContent.ProjectileType(), (int)((double)Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner, 2); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMinion = true; ((ProfanedCrystalRangedHuges)Main.projectile[proj].modProjectile).boomerSwarm = true; @@ -635,40 +635,40 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Bab Boomer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 60; - projectile.height = 50; - projectile.friendly = true; - projectile.minion = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 175; - projectile.localNPCHitCooldown = -1; - projectile.usesLocalNPCImmunity = true; + Projectile.width = 60; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.timeLeft = 175; + Projectile.localNPCHitCooldown = -1; + Projectile.usesLocalNPCImmunity = true; } public override bool PreAI() { - projectile.Calamity().overridesMinionDamagePrevention = true; - bool begin = projectile.timeLeft == 175; - if (projectile.ai[0] >= 1 && begin) + Projectile.Calamity().overridesMinionDamagePrevention = true; + bool begin = Projectile.timeLeft == 175; + if (Projectile.ai[0] >= 1 && begin) { - projectile.scale = 1.5f; - projectile.width += 25; - projectile.height += 25; - boomerSwarm = projectile.ai[0] == 2; - if (boomerSwarm && projectile.ai[1] == 0f) + Projectile.scale = 1.5f; + Projectile.width += 25; + Projectile.height += 25; + boomerSwarm = Projectile.ai[0] == 2; + if (boomerSwarm && Projectile.ai[1] == 0f) { - projectile.timeLeft = 200; - projectile.ai[1] = 1f; + Projectile.timeLeft = 200; + Projectile.ai[1] = 1f; } } return true; @@ -676,28 +676,28 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (projectile.timeLeft == 175 && projectile.scale == 1.5f) - Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); + if (Projectile.timeLeft == 175 && Projectile.scale == 1.5f) + Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, Projectile.Center); - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 2) + if (Projectile.frame > 2) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.timeLeft == 145 && projectile.ai[0] < 2f) + if (Projectile.timeLeft == 145 && Projectile.ai[0] < 2f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; - projectile.velocity *= boomerSwarm ? 1.03f : 1.02f; + Projectile.velocity *= boomerSwarm ? 1.03f : 1.02f; - int num469 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; if (boomerSwarm) @@ -706,7 +706,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -720,29 +720,29 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.player[projectile.owner].Calamity().rollBabSpears(projectile.ai[0] == 1f ? 1 : 10, target.chaseable); - if (projectile.scale == 1.5f && projectile.ai[0] != 2f) + Main.player[Projectile.owner].Calamity().rollBabSpears(Projectile.ai[0] == 1f ? 1 : 10, target.chaseable); + if (Projectile.scale == 1.5f && Projectile.ai[0] != 2f) swarm(target.Center); } public override void OnHitPvp(Player target, int damage, bool crit) { - Main.player[projectile.owner].Calamity().rollBabSpears(projectile.scale == 1.5f ? 1 : 10, true); - if (projectile.scale == 1.5f && projectile.ai[0] != 2f) + Main.player[Projectile.owner].Calamity().rollBabSpears(Projectile.scale == 1.5f ? 1 : 10, true); + if (Projectile.scale == 1.5f && Projectile.ai[0] != 2f) swarm(target.Center); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 14); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = Projectile.height = 200; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 4; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -752,13 +752,13 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 12; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - if (projectile.scale != 1.5f) + if (Projectile.scale != 1.5f) return; for (int num625 = 0; num625 < 3; num625++) { @@ -773,7 +773,7 @@ namespace CalamityMod.Projectiles.Summon } for (int i = 0; i < 4; i++) { - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + int num626 = Gore.NewGore(new Vector2(Projectile.position.X + (float)(Projectile.width / 2) - 24f, Projectile.position.Y + (float)(Projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Gore gore = Main.gore[num626]; gore.velocity *= scaleFactor10; if (i == 0 || i == 2) @@ -797,69 +797,69 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Bab Boomer Orb"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.scale = 1.5f; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 240; - projectile.minion = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.scale = 1.5f; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; + Projectile.minion = true; } public override bool PreAI() { - projectile.Calamity().overridesMinionDamagePrevention = true; + Projectile.Calamity().overridesMinionDamagePrevention = true; return true; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.ai[0] == 0f) { + if (Projectile.ai[0] == 0f) { } - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (projectile.timeLeft == 210) - projectile.tileCollide = true; + Projectile.velocity.X *= 1.01f; + Projectile.velocity.Y *= 1.01f; + if (Projectile.timeLeft == 210) + Projectile.tileCollide = true; } public override bool? CanHitNPC(NPC target) { - if (projectile.ai[0] == 1f && projectile.timeLeft > 210) + if (Projectile.ai[0] == 1f && Projectile.timeLeft > 210) return false; return null; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 14); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 14); if (!Main.rand.NextBool(3)) //1 in 3 chance for dust return; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -869,22 +869,22 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 15; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 247, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.player[projectile.owner].Calamity().rollBabSpears(50, target.chaseable); + Main.player[Projectile.owner].Calamity().rollBabSpears(50, target.chaseable); } public override void OnHitPvp(Player target, int damage, bool crit) { - Main.player[projectile.owner].Calamity().rollBabSpears(50, true); + Main.player[Projectile.owner].Calamity().rollBabSpears(50, true); } } @@ -903,45 +903,45 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 150; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.scale = 0.8f; + Projectile.width = 34; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 150; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.scale = 0.8f; } private void ai() { - if (projectile.timeLeft > 90) + if (Projectile.timeLeft > 90) { - projectile.rotation += 1f; - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; + Projectile.rotation += 1f; + Projectile.velocity.X *= 0.985f; + Projectile.velocity.Y *= 0.985f; } else { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 2.355f; + if (Projectile.spriteDirection == -1) { - projectile.rotation -= 1.57f; + Projectile.rotation -= 1.57f; } - float num535 = projectile.position.X; - float num536 = projectile.position.Y; + float num535 = Projectile.position.X; + float num536 = Projectile.position.Y; float num537 = 2000f; bool flag19 = false; - NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) + NPC ownerMinionAttackTargetNPC2 = Projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(Projectile, false)) { float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + float num541 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num539) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num540); if (num541 < num537) { num537 = num541; @@ -955,11 +955,11 @@ namespace CalamityMod.Projectiles.Summon int num3; for (int num542 = 0; num542 < 200; num542 = num3 + 1) { - if (Main.npc[num542].CanBeChasedBy(projectile, false)) + if (Main.npc[num542].CanBeChasedBy(Projectile, false)) { float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); + float num545 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num543) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num544); if (num545 < num537) { num537 = num545; @@ -974,10 +974,10 @@ namespace CalamityMod.Projectiles.Summon if (flag19) //target found { if (Main.rand.NextBool()) - projectile.timeLeft++; - projectile.tileCollide = false; + Projectile.timeLeft++; + Projectile.tileCollide = false; float num550 = 40f; - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -988,13 +988,13 @@ namespace CalamityMod.Projectiles.Summon num553 = num550 / num553; num551 *= num553; num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; + Projectile.velocity.X = (Projectile.velocity.X * 14f + num551) / 15f; + Projectile.velocity.Y = (Projectile.velocity.Y * 14f + num552) / 15f; } else { - projectile.tileCollide = true; + Projectile.tileCollide = true; } } @@ -1002,50 +1002,50 @@ namespace CalamityMod.Projectiles.Summon public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override bool PreAI() { - projectile.Calamity().overridesMinionDamagePrevention = true; + Projectile.Calamity().overridesMinionDamagePrevention = true; return true; } public override void AI() { ai(); - Color newColor2 = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); - if (projectile.alpha > 0) + Color newColor2 = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); + if (Projectile.alpha > 0) { - projectile.alpha -= 8; + Projectile.alpha -= 8; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - Lighting.AddLight(projectile.Center, newColor2.ToVector3() * 0.5f); + Lighting.AddLight(Projectile.Center, newColor2.ToVector3() * 0.5f); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; int num3; for (int num979 = 0; num979 < 2; num979 = num3 + 1) { if (Main.rand.NextBool(10)) { - Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust24 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust dust24 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; dust24.noGravity = true; dust24.noLight = true; - dust24.scale = projectile.Opacity * projectile.localAI[0]; - dust24.position = projectile.Center; + dust24.scale = Projectile.Opacity * Projectile.localAI[0]; + dust24.position = Projectile.Center; dust24.velocity = value55 * 2.5f; } num3 = num979; @@ -1055,11 +1055,11 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(10)) { Vector2 value56 = Vector2.UnitY.RotatedBy((double)((float)num980 * 3.14159274f), default); - Dust dust25 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + Dust dust25 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; dust25.noGravity = true; dust25.noLight = true; - dust25.scale = projectile.Opacity * projectile.localAI[0]; - dust25.position = projectile.Center; + dust25.scale = Projectile.Opacity * Projectile.localAI[0]; + dust25.position = Projectile.Center; dust25.velocity = value56 * 2.5f; } num3 = num980; @@ -1075,7 +1075,7 @@ namespace CalamityMod.Projectiles.Summon vector136.Normalize(); } vector136 *= 20f + Main.rand.NextFloat() * 100f; - Vector2 vector137 = projectile.Center + vector136; + Vector2 vector137 = Projectile.Center + vector136; Point point3 = vector137.ToTileCoordinates(); bool flag52 = true; if (!WorldGen.InWorld(point3.X, point3.Y, 0)) @@ -1107,41 +1107,41 @@ namespace CalamityMod.Projectiles.Summon public override bool? CanHitNPC(NPC target) { - if (projectile.timeLeft > 90) + if (Projectile.timeLeft > 90) return false; return null; } public override bool CanHitPvp(Player target) { - return projectile.timeLeft <= 90; + return Projectile.timeLeft <= 90; } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Main.player[projectile.owner].Calamity().rollBabSpears(projectile.ai[0] == 0f ? 0 : 10, target.chaseable); + Main.player[Projectile.owner].Calamity().rollBabSpears(Projectile.ai[0] == 0f ? 0 : 10, target.chaseable); } public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) { - Main.player[projectile.owner].Calamity().rollBabSpears(projectile.ai[0] == 0f ? 0 : 10, true); + Main.player[Projectile.owner].Calamity().rollBabSpears(Projectile.ai[0] == 0f ? 0 : 10, true); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 27); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 27); Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); float num69 = (float)Main.rand.Next(7, 13); Vector2 value5 = new Vector2(2.1f, 2f); - Color newColor = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); + Color newColor = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); newColor.A = 255; float num72; for (float num70 = 0f; num70 < num69; num70 = num72 + 1f) { - int num71 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num71].position = projectile.Center; + int num71 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[num71].position = Projectile.Center; Main.dust[num71].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num70 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[num71].noGravity = true; Main.dust[num71].scale = 2f; @@ -1156,8 +1156,8 @@ namespace CalamityMod.Projectiles.Summon } for (float num73 = 0f; num73 < num69; num73 = num72 + 1f) { - int num74 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num74].position = projectile.Center; + int num74 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[num74].position = Projectile.Center; Main.dust[num74].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num73 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); Dust dust = Main.dust[num74]; dust.velocity *= Main.rand.NextFloat() * 0.8f; @@ -1176,7 +1176,7 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } } @@ -1189,54 +1189,54 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Bab Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.alpha = 100; - projectile.timeLeft = 300; - projectile.extraUpdates = 1; - projectile.minion = true; - projectile.scale = 0.9f; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.alpha = 100; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 1; + Projectile.minion = true; + Projectile.scale = 0.9f; } public override void AI() { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - if (projectile.timeLeft == 300) + if (Projectile.timeLeft == 300) { - projectile.velocity *= 0.01f; + Projectile.velocity *= 0.01f; } - else if (projectile.timeLeft > 250) + else if (Projectile.timeLeft > 250) { - projectile.velocity *= 1.1f; + Projectile.velocity *= 1.1f; } - else if (projectile.timeLeft == 250) + else if (Projectile.timeLeft == 250) { - projectile.velocity *= 5f; + Projectile.velocity *= 5f; } - if (projectile.timeLeft <= 250) + if (Projectile.timeLeft <= 250) { - float num535 = projectile.position.X; - float num536 = projectile.position.Y; + float num535 = Projectile.position.X; + float num536 = Projectile.position.Y; float num537 = 3000f; bool flag19 = false; - NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) + NPC ownerMinionAttackTargetNPC2 = Projectile.OwnerMinionAttackTargetNPC; + if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(Projectile, false)) { float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + float num541 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num539) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num540); if (num541 < num537) { num537 = num541; @@ -1249,11 +1249,11 @@ namespace CalamityMod.Projectiles.Summon { for (int num542 = 0; num542 < Main.npc.Length; num542++) { - if (Main.npc[num542].CanBeChasedBy(projectile, false)) + if (Main.npc[num542].CanBeChasedBy(Projectile, false)) { float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); + float num545 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num543) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num544); if (num545 < num537) { num537 = num545; @@ -1266,10 +1266,10 @@ namespace CalamityMod.Projectiles.Summon } if (flag19) { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { float num550 = 24f; //12 - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -1280,40 +1280,40 @@ namespace CalamityMod.Projectiles.Summon num553 = num550 / num553; num551 *= num553; num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; + Projectile.velocity.X = (Projectile.velocity.X * 14f + num551) / 15f; + Projectile.velocity.Y = (Projectile.velocity.Y * 14f + num552) / 15f; } } } - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + Projectile.rotation = Projectile.velocity.ToRotation() + 1.57079637f; } public override bool? CanHitNPC(NPC target) { - if (projectile.timeLeft > 250) + if (Projectile.timeLeft > 250) return false; return null; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 14); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 14); if (Main.rand.NextBool(3)) { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = Projectile.height = 200; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 4; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -1323,10 +1323,10 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 12; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } diff --git a/Projectiles/Summon/PurpleButterfly.cs b/Projectiles/Summon/PurpleButterfly.cs index c786e6fc15..de64b8ab99 100644 --- a/Projectiles/Summon/PurpleButterfly.cs +++ b/Projectiles/Summon/PurpleButterfly.cs @@ -15,70 +15,70 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Purple Butterfly"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0.5f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (dust > 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.5f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 173, vector7.X, vector7.Y, 100, default, 1.8f); Main.dust[num228].noGravity = true; } dust--; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - if (Math.Abs(projectile.velocity.X) > 0.2f) + if (Math.Abs(Projectile.velocity.X) > 0.2f) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } - projectile.rotation = projectile.velocity.X * 0.02f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.rotation = Projectile.velocity.X * 0.02f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - Lighting.AddLight(projectile.Center, 0.3f, 0f, 0.5f); - projectile.ChargingMinionAI(1200f, 1500f, 2400f, 150f, 0, 30f, 18f, 9f, new Vector2(0f, -60f), 30f, 12f, true, true); - bool flag64 = projectile.type == ModContent.ProjectileType(); + Lighting.AddLight(Projectile.Center, 0.3f, 0f, 0.5f); + Projectile.ChargingMinionAI(1200f, 1500f, 2400f, 150f, 0, 30f, 18f, 9f, new Vector2(0f, -60f), 30f, 12f, true, true); + bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { @@ -88,24 +88,24 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.resButterfly) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, spriteEffects, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 8; + target.immune[Projectile.owner] = 8; } } } diff --git a/Projectiles/Summon/RadiantResolutionAura.cs b/Projectiles/Summon/RadiantResolutionAura.cs index 963925a66c..184ae3721a 100644 --- a/Projectiles/Summon/RadiantResolutionAura.cs +++ b/Projectiles/Summon/RadiantResolutionAura.cs @@ -10,9 +10,9 @@ namespace CalamityMod.Projectiles.Summon { public class RadiantResolutionAura : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float AllocatedSlots => ref projectile.ai[0]; - public ref float GeneralTimer => ref projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float AllocatedSlots => ref Projectile.ai[0]; + public ref float GeneralTimer => ref Projectile.ai[1]; public const float TargetCheckDistance = 1600f; public const int RadiantOrbAppearRateLowerBound = 7; @@ -20,27 +20,27 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Radiant Aura"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 66; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 90000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; + Projectile.width = Projectile.height = 66; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; } public override void AI() { // Emit some light. - Lighting.AddLight(projectile.Center, Vector3.One * 1.2f); + Lighting.AddLight(Projectile.Center, Vector3.One * 1.2f); // Ensure that the projectile using this AI is the correct projectile and that the owner has the appropriate buffs. VerifyIdentityOfCaller(); @@ -50,11 +50,11 @@ namespace CalamityMod.Projectiles.Summon // Store the allocated slots in the minionSlots field so that the amount of slots the projectile is holding // is always correct. - projectile.minionSlots = projectile.ai[0]; + Projectile.minionSlots = Projectile.ai[0]; // Stay near the target and spin around. - projectile.Center = Owner.Center - Vector2.UnitY * 16f; - projectile.rotation += MathHelper.ToRadians(AllocatedSlots * 0.85f + 3f); + Projectile.Center = Owner.Center - Vector2.UnitY * 16f; + Projectile.rotation += MathHelper.ToRadians(AllocatedSlots * 0.85f + 3f); float damageMultiplier = (float)Math.Log(AllocatedSlots, 3D) + 1f; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon if (softcappedDamageMultiplier > 3f) softcappedDamageMultiplier = ((damageMultiplier - 3f) * 0.1f) + 3f; - int radiantOrbDamage = (int)(projectile.damage * softcappedDamageMultiplier); + int radiantOrbDamage = (int)(Projectile.damage * softcappedDamageMultiplier); int radiantOrbAppearRate = (int)(130 * Math.Pow(0.9, AllocatedSlots)); // Hard-cap the orb appear rate and damage. @@ -76,39 +76,39 @@ namespace CalamityMod.Projectiles.Summon // Attack nearby targets. GeneralTimer++; - NPC potentialTarget = projectile.Center.MinionHoming(TargetCheckDistance, Owner); - if (potentialTarget != null && Main.myPlayer == projectile.owner) + NPC potentialTarget = Projectile.Center.MinionHoming(TargetCheckDistance, Owner); + if (potentialTarget != null && Main.myPlayer == Projectile.owner) AttackTarget(potentialTarget, radiantOrbAppearRate, radiantOrbDamage); } public void VerifyIdentityOfCaller() { Owner.AddBuff(ModContent.BuffType(), 3600); - bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); if (isCorrectProjectile) { if (Owner.dead) Owner.Calamity().radiantResolution = false; if (Owner.Calamity().radiantResolution) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } public void HandleDynamicMinionDamage() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } - if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } } @@ -119,21 +119,21 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 2; i++) { float angle = MathHelper.Lerp(-MathHelper.ToRadians(20f), MathHelper.ToRadians(20f), i / 2f); - Vector2 fireVelocity = projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 15f; - Projectile.NewProjectile(projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, projectile.knockBack, projectile.owner); + Vector2 fireVelocity = Projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 15f; + Projectile.NewProjectile(Projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, Projectile.knockBack, Projectile.owner); } } if (GeneralTimer % radiantOrbAppearRate == radiantOrbAppearRate - 1) { - Vector2 spawnPosition = projectile.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(100f, 360f); - Vector2 bootlegRadianceOrbVelocity = projectile.SafeDirectionTo(target.Center) * 2f; - Projectile.NewProjectile(spawnPosition, bootlegRadianceOrbVelocity, ModContent.ProjectileType(), radiantOrbDamage, projectile.knockBack * 4f, projectile.owner); + Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(100f, 360f); + Vector2 bootlegRadianceOrbVelocity = Projectile.SafeDirectionTo(target.Center) * 2f; + Projectile.NewProjectile(spawnPosition, bootlegRadianceOrbVelocity, ModContent.ProjectileType(), radiantOrbDamage, Projectile.knockBack * 4f, Projectile.owner); for (int i = 0; i < 3; i++) { float angle = MathHelper.Lerp(-MathHelper.ToRadians(30f), MathHelper.ToRadians(30f), i / 3f); - Vector2 fireVelocity = projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 19f; - Projectile.NewProjectile(projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, projectile.knockBack, projectile.owner); + Vector2 fireVelocity = Projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 19f; + Projectile.NewProjectile(Projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, Projectile.knockBack, Projectile.owner); } } } @@ -142,12 +142,12 @@ namespace CalamityMod.Projectiles.Summon public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D currentTexture = ModContent.GetTexture(Texture); + Texture2D currentTexture = ModContent.Request(Texture); spriteBatch.Draw(currentTexture, - projectile.Center - Main.screenPosition, + Projectile.Center - Main.screenPosition, null, lightColor, - projectile.rotation + MathHelper.PiOver2, + Projectile.rotation + MathHelper.PiOver2, currentTexture.Size() / 2f, 1f, SpriteEffects.None, diff --git a/Projectiles/Summon/RadiantResolutionFire.cs b/Projectiles/Summon/RadiantResolutionFire.cs index 9a3183fe0a..4ab2729abc 100644 --- a/Projectiles/Summon/RadiantResolutionFire.cs +++ b/Projectiles/Summon/RadiantResolutionFire.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class RadiantResolutionFire : ModProjectile @@ -12,42 +13,42 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 10; - projectile.friendly = true; - projectile.light = 1f; - projectile.timeLeft = 300; - projectile.minion = true; - projectile.tileCollide = false; + Projectile.width = Projectile.height = 10; + Projectile.friendly = true; + Projectile.light = 1f; + Projectile.timeLeft = 300; + Projectile.minion = true; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.ProfanedFire); + Player player = Main.player[Projectile.owner]; + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire); dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi); dust.noGravity = true; - NPC potentialTarget = projectile.Center.MinionHoming(1750f, player); + NPC potentialTarget = Projectile.Center.MinionHoming(1750f, player); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 19f + projectile.SafeDirectionTo(potentialTarget.Center) * 20f) / 20f; + Projectile.velocity = (Projectile.velocity * 19f + Projectile.SafeDirectionTo(potentialTarget.Center) * 20f) / 20f; } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 60); - projectile.maxPenetrate = projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 3; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 60); + Projectile.maxPenetrate = Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 3; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int i = 0; i < 20; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.ProfanedFire); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire); dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2f, 6f); dust.noGravity = true; } diff --git a/Projectiles/Summon/RadiantResolutionOrb.cs b/Projectiles/Summon/RadiantResolutionOrb.cs index bb7ab99e98..792744fdb2 100644 --- a/Projectiles/Summon/RadiantResolutionOrb.cs +++ b/Projectiles/Summon/RadiantResolutionOrb.cs @@ -8,54 +8,54 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Sun"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 62; - projectile.height = 64; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.alpha = 255; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + Projectile.width = 62; + Projectile.height = 64; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.alpha = 255; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 9; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 9; + if (Projectile.alpha < 0) + Projectile.alpha = 0; } - Player player = Main.player[projectile.owner]; - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Player player = Main.player[Projectile.owner]; + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.ai[0]++ < 30f) + if (Projectile.ai[0]++ < 30f) { - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; } else { - NPC potentialTarget = projectile.Center.MinionHoming(2000f, player); + NPC potentialTarget = Projectile.Center.MinionHoming(2000f, player); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 7f + projectile.SafeDirectionTo(potentialTarget.Center) * 19f) / 8f; + Projectile.velocity = (Projectile.velocity * 7f + Projectile.SafeDirectionTo(potentialTarget.Center) * 19f) / 8f; } } } diff --git a/Projectiles/Summon/RustShrapnel.cs b/Projectiles/Summon/RustShrapnel.cs index 6af2946d43..23b40d7e1f 100644 --- a/Projectiles/Summon/RustShrapnel.cs +++ b/Projectiles/Summon/RustShrapnel.cs @@ -17,36 +17,36 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Shrapnel"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.tileCollide = true; - projectile.minionSlots = 0f; - projectile.minion = true; + Projectile.width = 12; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; + Projectile.tileCollide = true; + Projectile.minionSlots = 0f; + Projectile.minion = true; } public override void AI() { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; if (HitTile) { - projectile.velocity.X = 0f; - projectile.rotation = MathHelper.Pi; + Projectile.velocity.X = 0f; + Projectile.rotation = MathHelper.Pi; } else { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } - projectile.velocity.Y += 0.4f; - projectile.velocity.X *= 0.96f; + Projectile.velocity.Y += 0.4f; + Projectile.velocity.X *= 0.96f; } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -56,18 +56,18 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - projectile.Kill(); + Projectile.Kill(); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - projectile.Kill(); + Projectile.Kill(); } public override void Kill(int timeLeft) { for (int i = 0; i < 15; i++) { - Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid); dust.velocity = Vector2.One.RotatedBy(i / 15f * MathHelper.TwoPi) * 3f * (float)Math.Cos(i / 15f * MathHelper.TwoPi); dust.scale = 2.5f; dust.noGravity = true; @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Summon } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/RustyDrone.cs b/Projectiles/Summon/RustyDrone.cs index 60b4db1241..7ad4ea9b37 100644 --- a/Projectiles/Summon/RustyDrone.cs +++ b/Projectiles/Summon/RustyDrone.cs @@ -26,62 +26,62 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Rusty Drone"); - Main.projFrames[projectile.type] = 12; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 12; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 36; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.alpha = 255; - projectile.Calamity().overridesMinionDamagePrevention = true; // Will only do damage once, and the location of said damage must be deliberate. + Projectile.width = 36; + Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.alpha = 255; + Projectile.Calamity().overridesMinionDamagePrevention = true; // Will only do damage once, and the location of said damage must be deliberate. } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - int oldDamage = projectile.damage; - projectile.damage = 1; // For the initial tiny prick effect - projectile.Damage(); - projectile.damage = oldDamage; - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.Center -= Vector2.UnitY * 1400f; - projectile.localAI[0] += 1f; + int oldDamage = Projectile.damage; + Projectile.damage = 1; // For the initial tiny prick effect + Projectile.Damage(); + Projectile.damage = oldDamage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.Center -= Vector2.UnitY * 1400f; + Projectile.localAI[0] += 1f; } - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha = (int)MathHelper.Lerp(projectile.alpha, 0f, 0.02f); - projectile.velocity = Vector2.UnitY * 10f; + Projectile.alpha = (int)MathHelper.Lerp(Projectile.alpha, 0f, 0.02f); + Projectile.velocity = Vector2.UnitY * 10f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isCorrectProjectile) { @@ -91,60 +91,60 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.rustyDrone) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); + NPC potentialTarget = Projectile.Center.MinionHoming(DistanceToCheck, player); if (potentialTarget == null) { - if (projectile.Distance(player.Center) > 120f) + if (Projectile.Distance(player.Center) > 120f) { - projectile.velocity = (projectile.velocity * PlayerHomingInertia + projectile.SafeDirectionTo(player.Top) * PlayerHomingSpeed) / (PlayerHomingInertia + 1); + Projectile.velocity = (Projectile.velocity * PlayerHomingInertia + Projectile.SafeDirectionTo(player.Top) * PlayerHomingSpeed) / (PlayerHomingInertia + 1); } - if (projectile.frame >= 8) + if (Projectile.frame >= 8) { - projectile.frame = 0; + Projectile.frame = 0; } } else { // A bit above the target, and always on the opposite side of the target's sprite direction. Vector2 destination = potentialTarget.Top + Vector2.UnitX * -potentialTarget.spriteDirection * Main.rand.NextFloat(50f, 75f) - Vector2.UnitY * 42f; - projectile.velocity = (projectile.velocity * NPCHomingInertia + projectile.SafeDirectionTo(destination) * NPCHomingSpeed) / (NPCHomingInertia + 1); - if (projectile.frame < 8) + Projectile.velocity = (Projectile.velocity * NPCHomingInertia + Projectile.SafeDirectionTo(destination) * NPCHomingSpeed) / (NPCHomingInertia + 1); + if (Projectile.frame < 8) { - projectile.frame = 8; + Projectile.frame = 8; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 8; + Projectile.frame = 8; } - if (projectile.Distance(destination) < 55f) + if (Projectile.Distance(destination) < 55f) { - if (projectile.ai[0]++ % AttackRate == AttackRate - 1) + if (Projectile.ai[0]++ % AttackRate == AttackRate - 1) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(potentialTarget.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, projectile.owner, projectile.whoAmI, potentialTarget.whoAmI); + Projectile.NewProjectile(potentialTarget.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Projectile.owner, Projectile.whoAmI, potentialTarget.whoAmI); } } } } - projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.X * 0.05f; - projectile.ai[1]++; - if (projectile.ai[1] >= 360f) + Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.X * 0.05f; + Projectile.ai[1]++; + if (Projectile.ai[1] >= 360f) { - Utils.PoofOfSmoke(projectile.Center); + Utils.PoofOfSmoke(Projectile.Center); for (int i = 0; i < 4; i++) { - Projectile.NewProjectile(projectile.Center, Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 8f, ModContent.ProjectileType(), - (int)(ExplosionShrapnelBaseDamage * player.MinionDamage()), 2f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 8f, ModContent.ProjectileType(), + (int)(ExplosionShrapnelBaseDamage * player.MinionDamage()), 2f, Projectile.owner); } - projectile.Kill(); + Projectile.Kill(); } } - public override bool CanDamage() => projectile.localAI[0] == 0f; // Only do damage from the initial 1 damage prick, and never again. This is a support summon. + public override bool CanDamage() => Projectile.localAI[0] == 0f; // Only do damage from the initial 1 damage prick, and never again. This is a support summon. } } diff --git a/Projectiles/Summon/RustyDroneTargetIndicator.cs b/Projectiles/Summon/RustyDroneTargetIndicator.cs index 90a1e8da8d..eaf41d732b 100644 --- a/Projectiles/Summon/RustyDroneTargetIndicator.cs +++ b/Projectiles/Summon/RustyDroneTargetIndicator.cs @@ -17,21 +17,21 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Target Indicator"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.alpha = 50; + Projectile.width = 34; + Projectile.height = 34; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.alpha = 50; } public override void SendExtraAI(BinaryWriter writer) { @@ -45,49 +45,49 @@ namespace CalamityMod.Projectiles.Summon } public override void AI() { - if (projectile.ai[0] < 0 || projectile.ai[0] >= Main.projectile.Length || projectile.ai[1] < 0 || projectile.ai[1] >= Main.npc.Length) + if (Projectile.ai[0] < 0 || Projectile.ai[0] >= Main.projectile.Length || Projectile.ai[1] < 0 || Projectile.ai[1] >= Main.npc.Length) { - projectile.Kill(); + Projectile.Kill(); return; } - if (Main.projectile[(int)projectile.ai[0]].type != ModContent.ProjectileType() || - !Main.projectile[(int)projectile.ai[0]].active) + if (Main.projectile[(int)Projectile.ai[0]].type != ModContent.ProjectileType() || + !Main.projectile[(int)Projectile.ai[0]].active) { - projectile.Kill(); + Projectile.Kill(); } - if (!Main.npc[(int)projectile.ai[1]].active) + if (!Main.npc[(int)Projectile.ai[1]].active) { - projectile.Kill(); + Projectile.Kill(); } - projectile.Center = Vector2.Lerp(projectile.Center, Main.npc[(int)projectile.ai[1]].Center + DeltaPositionRelativetoTarget * Outwardness, 3f / TurnRate); - if (projectile.localAI[0] == 0f) + Projectile.Center = Vector2.Lerp(Projectile.Center, Main.npc[(int)Projectile.ai[1]].Center + DeltaPositionRelativetoTarget * Outwardness, 3f / TurnRate); + if (Projectile.localAI[0] == 0f) { DeltaPositionRelativetoTarget = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } - projectile.localAI[1]++; - if (projectile.localAI[1] % TurnRate == TurnRate - 1f) + Projectile.localAI[1]++; + if (Projectile.localAI[1] % TurnRate == TurnRate - 1f) { Outwardness *= 0.6f; DeltaPositionRelativetoTarget = DeltaPositionRelativetoTarget.RotatedByRandom(MathHelper.PiOver4); - projectile.scale = 1.5f; - projectile.netUpdate = true; + Projectile.scale = 1.5f; + Projectile.netUpdate = true; } - if (projectile.scale > 1f && Outwardness > 4f) + if (Projectile.scale > 1f && Outwardness > 4f) { - projectile.scale = MathHelper.Lerp(projectile.scale, 1f, 0.025f); + Projectile.scale = MathHelper.Lerp(Projectile.scale, 1f, 0.025f); } else if (Outwardness <= 4f) { Outwardness *= 0.935f; - if (projectile.timeLeft > 40) + if (Projectile.timeLeft > 40) { - projectile.timeLeft = 40; - Main.npc[(int)projectile.ai[1]].AddBuff(BuffID.Poisoned, BuffTime); - Main.npc[(int)projectile.ai[1]].AddBuff(ModContent.BuffType(), BuffTime); + Projectile.timeLeft = 40; + Main.npc[(int)Projectile.ai[1]].AddBuff(BuffID.Poisoned, BuffTime); + Main.npc[(int)Projectile.ai[1]].AddBuff(ModContent.BuffType(), BuffTime); } - projectile.alpha = (int)MathHelper.Lerp(projectile.alpha, 255f, 1f / 40f); - projectile.scale += 0.05f; + Projectile.alpha = (int)MathHelper.Lerp(Projectile.alpha, 255f, 1f / 40f); + Projectile.scale += 0.05f; } } } diff --git a/Projectiles/Summon/SageNeedle.cs b/Projectiles/Summon/SageNeedle.cs index 22fe90c8a1..ab2ecd96e6 100644 --- a/Projectiles/Summon/SageNeedle.cs +++ b/Projectiles/Summon/SageNeedle.cs @@ -12,34 +12,34 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Sage Needle"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 150; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = Projectile.height = 16; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 150; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(48f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(48f); // Don't collide with tiles unless the needle is falling. - projectile.tileCollide = projectile.velocity.Y > 0f; - if (projectile.velocity.Y < 12f) - projectile.velocity.Y += 0.16f; + Projectile.tileCollide = Projectile.velocity.Y > 0f; + if (Projectile.velocity.Y < 12f) + Projectile.velocity.Y += 0.16f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - int totalSageSpirits = Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()]; + int totalSageSpirits = Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()]; // A slightly-smoothened curve that's a little less potent than a linear curve. // Has the potential to eventually surpass a linear curve, but this is infeasible, only happening @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 6; i++) { - Dust redGrass = Dust.NewDustDirect(projectile.position + projectile.velocity, projectile.width, projectile.height, DustID.Grass, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust redGrass = Dust.NewDustDirect(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Grass, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); redGrass.velocity = Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 3f); redGrass.noGravity = true; redGrass.color = Color.Lerp(Color.IndianRed, Color.MediumVioletRed, Main.rand.NextFloat()); diff --git a/Projectiles/Summon/SageSpirit.cs b/Projectiles/Summon/SageSpirit.cs index ad51088f75..ffb25e4579 100644 --- a/Projectiles/Summon/SageSpirit.cs +++ b/Projectiles/Summon/SageSpirit.cs @@ -10,11 +10,11 @@ namespace CalamityMod.Projectiles.Summon { public class SageSpirit : ModProjectile { - internal Player Owner => Main.player[projectile.owner]; - internal ref float AttackTimer => ref projectile.ai[0]; - internal ref float PlayerFlyTime => ref projectile.ai[1]; - internal ref float SageSpiritIndex => ref projectile.localAI[0]; - internal ref float GeneralTime => ref projectile.localAI[1]; + internal Player Owner => Main.player[Projectile.owner]; + internal ref float AttackTimer => ref Projectile.ai[0]; + internal ref float PlayerFlyTime => ref Projectile.ai[1]; + internal ref float SageSpiritIndex => ref Projectile.localAI[0]; + internal ref float GeneralTime => ref Projectile.localAI[1]; internal bool Initialized = false; internal Vector2 PlayerFlyStart; internal Vector2 PlayerFlyOffsetAtEnds; @@ -24,23 +24,23 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Sage Spirit"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 48; - projectile.height = 72; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 90000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; + Projectile.width = 48; + Projectile.height = 72; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; } public override void SendExtraAI(BinaryWriter writer) @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Summon ProvidePlayerMinionBuffs(); Initialize(); DetermineFrames(); - NPC potentialTarget = projectile.Center.MinionHoming(750f, Owner); + NPC potentialTarget = Projectile.Center.MinionHoming(750f, Owner); if (potentialTarget is null) FlyNearOwner(); else @@ -85,13 +85,13 @@ namespace CalamityMod.Projectiles.Summon // Verify player/minion state integrity. The minion cannot stay alive if the // owner is dead or if the caller of the AI is invalid. - if (projectile.type != ModContent.ProjectileType()) + if (Projectile.type != ModContent.ProjectileType()) return; if (Owner.dead) Owner.Calamity().sageSpirit = false; if (Owner.Calamity().sageSpirit) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } internal void Initialize() @@ -102,16 +102,16 @@ namespace CalamityMod.Projectiles.Summon Initialized = true; PlayerFlyTime = 1f; PlayerFlyOffsetAtEnds = Vector2.UnitY; - PlayerFlyStart = projectile.Center; - PlayerFlyDestination = projectile.Center - Vector2.UnitY * 10f; - projectile.netUpdate = true; + PlayerFlyStart = Projectile.Center; + PlayerFlyDestination = Projectile.Center - Vector2.UnitY * 10f; + Projectile.netUpdate = true; } internal void DetermineFrames() { - projectile.frameCounter++; - if (projectile.frameCounter % 5 == 4) - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + if (Projectile.frameCounter % 5 == 4) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; } internal void ResetOwnerFlyValues() @@ -119,38 +119,38 @@ namespace CalamityMod.Projectiles.Summon PlayerFlyTime = 0f; PlayerFlyOffsetAtEnds = Vector2.Zero; PlayerFlyStart = PlayerFlyDestination = -Vector2.One; - projectile.netUpdate = true; + Projectile.netUpdate = true; } internal void FlyNearOwner() { Vector2 destination = Owner.Center + Vector2.UnitX * Owner.width * 1.6f * Owner.direction; - int totalSageSpirits = Owner.ownedProjectileCounts[projectile.type]; + int totalSageSpirits = Owner.ownedProjectileCounts[Projectile.type]; destination += (SageSpiritIndex * MathHelper.TwoPi / totalSageSpirits).ToRotationVector2() * 70f; if (PlayerFlyTime >= 1f) { - projectile.Center = PlayerFlyDestination; + Projectile.Center = PlayerFlyDestination; ResetOwnerFlyValues(); return; } - float distanceFromDestination = projectile.Distance(destination); + float distanceFromDestination = Projectile.Distance(destination); if (float.IsNaN(distanceFromDestination)) distanceFromDestination = 0f; // Determine owner values if they are still in the air. if (PlayerFlyTime <= 0f) { - PlayerFlyStart = projectile.Center; + PlayerFlyStart = Projectile.Center; PlayerFlyOffsetAtEnds = Vector2.UnitY * distanceFromDestination; PlayerFlyDestination = destination; - projectile.netUpdate = true; + Projectile.netUpdate = true; PlayerFlyTime = 0.01f; return; } - projectile.position.Y += (float)Math.Cos(GeneralTime / 60f * MathHelper.TwoPi + projectile.identity * 1.1f) * 0.5f; + Projectile.position.Y += (float)Math.Cos(GeneralTime / 60f * MathHelper.TwoPi + Projectile.identity * 1.1f) * 0.5f; if (distanceFromDestination < 160f && PlayerFlyTime <= 0f) return; @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.Summon // The other 2 points at the ends are intended to be used to determine how the resulting curve should arc. // In this context, since the offset at the start is down, it'll actually go up because it's starting at the bottom // and then going up, bending between the 2 middle points. - projectile.Center = Vector2.CatmullRom( + Projectile.Center = Vector2.CatmullRom( PlayerFlyStart + PlayerFlyOffsetAtEnds, PlayerFlyStart, PlayerFlyDestination, @@ -174,19 +174,19 @@ namespace CalamityMod.Projectiles.Summon { AttackTimer++; - int totalSageSpirits = Owner.ownedProjectileCounts[projectile.type]; + int totalSageSpirits = Owner.ownedProjectileCounts[Projectile.type]; Vector2 destinationOffsetFactor = Vector2.Max(target.Size, new Vector2(160f)) * new Vector2(0.6f, 0.37f); Vector2 destination = target.Center + (AttackTimer / 12f).ToRotationVector2() * destinationOffsetFactor; destination += (SageSpiritIndex * MathHelper.TwoPi / totalSageSpirits).ToRotationVector2() * 130f; - projectile.Center = Vector2.Lerp(projectile.Center, destination, 0.1f); + Projectile.Center = Vector2.Lerp(Projectile.Center, destination, 0.1f); // Frequently release a bunch of spikes. - if (projectile.owner == Main.myPlayer && AttackTimer % ShootRate == ShootRate - 1) + if (Projectile.owner == Main.myPlayer && AttackTimer % ShootRate == ShootRate - 1) { for (int i = 0; i < 3; i++) { Vector2 spikeVelocity = -Vector2.UnitY.RotatedBy(MathHelper.Lerp(-0.43f, 0.43f, i / 3f)) * 6f; - Projectile.NewProjectile(projectile.Top, spikeVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Top, spikeVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Summon/SakuraBullet.cs b/Projectiles/Summon/SakuraBullet.cs index 249d687eb8..db8f227342 100644 --- a/Projectiles/Summon/SakuraBullet.cs +++ b/Projectiles/Summon/SakuraBullet.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -11,54 +12,54 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Sakura Bullet"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.netImportant = true; - projectile.penetrate = 1; - projectile.timeLeft = 150; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.extraUpdates = 1; - projectile.tileCollide = false; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.netImportant = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 150; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.extraUpdates = 1; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + Player player = Main.player[Projectile.owner]; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f; - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; float maxDistance = 400f; bool homeIn = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if ((npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) + if ((npc.CanBeChasedBy(Projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) { float extraDistance = (npc.width / 2) + (npc.height / 2); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) { center = npc.Center; homeIn = true; } } } - else if (projectile.ai[0] != -1f) + else if (Projectile.ai[0] != -1f) { - NPC npc = Main.npc[(int)projectile.ai[0]]; - if ((npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) + NPC npc = Main.npc[(int)Projectile.ai[0]]; + if ((npc.CanBeChasedBy(Projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) { float extraDistance = (npc.width / 2) + (npc.height / 2); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) { center = npc.Center; homeIn = true; @@ -70,11 +71,11 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if ((npc.CanBeChasedBy(projectile, false) || (npc.type == NPCID.DukeFishron && (!npc.dontTakeDamage || npc.ai[0] > 9f))) && npc.active) + if ((npc.CanBeChasedBy(Projectile, false) || (npc.type == NPCID.DukeFishron && (!npc.dontTakeDamage || npc.ai[0] > 9f))) && npc.active) { float extraDistance = (npc.width / 2) + (npc.height / 2); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) { center = npc.Center; homeIn = true; @@ -86,29 +87,29 @@ namespace CalamityMod.Projectiles.Summon if (homeIn) { - Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * 20f + moveDirection * 11f) / (21f); + Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 11f) / (21f); } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 0.6f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 0.6f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item25, projectile.position); - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1f); + SoundEngine.PlaySound(SoundID.Item25, Projectile.position); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 0.5f; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 1.4f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1.4f); Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 0.8f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 0.8f); } } } diff --git a/Projectiles/Summon/SandBolt.cs b/Projectiles/Summon/SandBolt.cs index 8178a6a414..0b0f1e84a7 100644 --- a/Projectiles/Summon/SandBolt.cs +++ b/Projectiles/Summon/SandBolt.cs @@ -10,30 +10,30 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.light = 1f; - projectile.timeLeft = 300; - projectile.minion = true; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.light = 1f; + Projectile.timeLeft = 300; + Projectile.minion = true; } public override void AI() { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 32, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f); } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Summon/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index e3b028fad9..94072eb580 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -15,40 +16,40 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Sand Healer"); - Main.projFrames[projectile.type] = 6; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + Main.projPet[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 42; - projectile.height = 98; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 42; + Projectile.height = 98; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.sandBoobWaifu && !modPlayer.allWaifus) { - projectile.active = false; + Projectile.active = false; return; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (correctMinion) { if (player.dead) @@ -57,134 +58,134 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.dWaifu) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } dust--; if (dust >= 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { - int sand = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 32, 0f, 0f, 0, default, 1f); + int sand = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 32, 0f, 0f, 0, default, 1f); Main.dust[sand].velocity *= 2f; Main.dust[sand].scale *= 1.15f; } } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - projectile.frameCounter++; - if (projectile.frameCounter > 16) + Projectile.frameCounter++; + if (Projectile.frameCounter > 16) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - if (Math.Abs(projectile.velocity.X) > 0.2f) + if (Math.Abs(Projectile.velocity.X) > 0.2f) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; lightScalar *= Main.essScale; - Lighting.AddLight(projectile.Center, 0.7f * lightScalar, 0.6f * lightScalar, 0f * lightScalar); + Lighting.AddLight(Projectile.Center, 0.7f * lightScalar, 0.6f * lightScalar, 0f * lightScalar); - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); - if (Vector2.Distance(player.Center, projectile.Center) > 400f) + if (Vector2.Distance(player.Center, Projectile.Center) > 400f) { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.tileCollide = false; + Projectile.netUpdate = true; } float safeDist = 100f; //150 bool returning = false; if (!returning) { - returning = projectile.ai[0] == 1f; + returning = Projectile.ai[0] == 1f; } float returnSpeed = 7f; //6 if (returning) { returnSpeed = 18f; //15 } - Vector2 playerVec = player.Center - projectile.Center + new Vector2(-250f, -60f); //-60 + Vector2 playerVec = player.Center - Projectile.Center + new Vector2(-250f, -60f); //-60 float playerDist = playerVec.Length(); if (playerDist > 200f && returnSpeed < 10f) //200 and 8 { returnSpeed = 10f; //8 } - if (playerDist < safeDist && returning && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerDist < safeDist && returning && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (playerDist > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (playerDist > 70f) { playerVec.Normalize(); playerVec *= returnSpeed; - projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + playerVec) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.22f; - projectile.velocity.Y = -0.12f; + Projectile.velocity.X = -0.22f; + Projectile.velocity.Y = -0.12f; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 4); + Projectile.ai[1] += (float)Main.rand.Next(1, 4); } - if (projectile.ai[1] > 220f) + if (Projectile.ai[1] > 220f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - if (projectile.localAI[0] < 120f) + if (Projectile.localAI[0] < 120f) { - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { int healProj = ModContent.ProjectileType(); - if (projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) + if (Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && player.statLife < player.statLifeMax2) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner && player.statLife < player.statLifeMax2) { - Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 6); + SoundEngine.PlaySound(SoundID.Dig, (int)Projectile.position.X, (int)Projectile.position.Y, 6); int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { - Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 dustVel = source - projectile.Center; + Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 dustVel = source - Projectile.Center; int green = Dust.NewDust(source + dustVel, 0, 0, 107, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, new Color(0, 200, 0), 1f); Main.dust[green].noGravity = true; Main.dust[green].noLight = true; Main.dust[green].velocity = dustVel; } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -6f, healProj, 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, -6f, healProj, 0, 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index 8546336614..d54229f766 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -14,38 +14,38 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Waifu"); - Main.projFrames[projectile.type] = 12; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 12; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 42; - projectile.height = 98; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 42; + Projectile.height = 98; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.sandWaifu && !modPlayer.allWaifus) { - projectile.active = false; + Projectile.active = false; return; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); if (flag64) { if (player.dead) @@ -54,32 +54,32 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.sWaifu) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } dust--; if (dust >= 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 32, 0f, 0f, 0, default, 1f); + int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 32, 0f, 0f, 0, default, 1f); Main.dust[num503].velocity *= 2f; Main.dust[num503].scale *= 1.15f; } } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - if (Math.Abs(projectile.velocity.X) > 0.2f) + if (Math.Abs(Projectile.velocity.X) > 0.2f) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } float num633 = 700f; //700 float num634 = 800f; @@ -87,24 +87,24 @@ namespace CalamityMod.Projectiles.Summon float num636 = 200f; //150 float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight(projectile.Center, 0.7f * num, 0.6f * num, 0f * num); - projectile.MinionAntiClump(); - Vector2 vector46 = projectile.position; + Lighting.AddLight(Projectile.Center, 0.7f * num, 0.6f * num, 0f * num); + Projectile.MinionAntiClump(); + Vector2 vector46 = Projectile.position; bool flag25 = false; - if (projectile.ai[0] != 1f) + if (Projectile.ai[0] != 1f) { - projectile.tileCollide = false; + Projectile.tileCollide = false; } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) + if (Projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16))) { - projectile.tileCollide = false; + Projectile.tileCollide = false; } if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, projectile.Center); + float num646 = Vector2.Distance(npc.Center, Projectile.Center); if (!flag25 && num646 < num633) { vector46 = npc.Center; @@ -117,10 +117,10 @@ namespace CalamityMod.Projectiles.Summon for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); + if ((!flag25 && num646 < num633) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num633 = num646; vector46 = nPC2.Center; @@ -132,57 +132,57 @@ namespace CalamityMod.Projectiles.Summon float num647 = num634; if (flag25) { - if (projectile.frame < 6) + if (Projectile.frame < 6) { - projectile.frame = 6; + Projectile.frame = 6; } - projectile.frameCounter++; - if (projectile.frameCounter > 12) + Projectile.frameCounter++; + if (Projectile.frameCounter > 12) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 11) + if (Projectile.frame > 11) { - projectile.frame = 6; + Projectile.frame = 6; } num647 = num635; } else { - projectile.frameCounter++; - if (projectile.frameCounter > 12) + Projectile.frameCounter++; + if (Projectile.frameCounter > 12) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 5) + if (Projectile.frame > 5) { - projectile.frame = 0; + Projectile.frame = 0; } } - if (Vector2.Distance(player.Center, projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > num647) { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.tileCollide = false; + Projectile.netUpdate = true; } - if (flag25 && projectile.ai[0] == 0f) + if (flag25 && Projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - projectile.Center; + Vector2 vector47 = vector46 - Projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 8f; vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 4f; vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } } else @@ -190,71 +190,71 @@ namespace CalamityMod.Projectiles.Summon bool flag26 = false; if (!flag26) { - flag26 = projectile.ai[0] == 1f; + flag26 = Projectile.ai[0] == 1f; } float num650 = 6f; //6 if (flag26) { num650 = 15f; //16 } - Vector2 center2 = projectile.Center; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(250f, -60f); //-60 float num651 = vector48.Length(); if (num651 > 200f && num650 < 8f) //200 and 8 { num650 = 8f; //8 } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (num651 < num636 && flag26 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (num651 > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.195f; - projectile.velocity.Y = -0.095f; + Projectile.velocity.X = -0.195f; + Projectile.velocity.Y = -0.095f; } } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 4); + Projectile.ai[1] += (float)Main.rand.Next(1, 4); } - if (projectile.ai[1] > 220f) + if (Projectile.ai[1] > 220f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } // Prevent firing immediately - if (projectile.localAI[0] < 120f) - projectile.localAI[0] += 1f; + if (Projectile.localAI[0] < 120f) + Projectile.localAI[0] += 1f; - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { float scaleFactor3 = 11f; int num658 = ModContent.ProjectileType(); - if (flag25 && projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) + if (flag25 && Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, vector46, 0, 0)) { - Vector2 value19 = vector46 - projectile.Center; + Vector2 value19 = vector46 - Projectile.Center; value19.Normalize(); value19 *= scaleFactor3; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - projectile.netUpdate = true; + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, value19.X, value19.Y, num658, Projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Summon/SandMark.cs b/Projectiles/Summon/SandMark.cs index c6949bf53d..c46d58eb52 100644 --- a/Projectiles/Summon/SandMark.cs +++ b/Projectiles/Summon/SandMark.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class SandMark : ModProjectile @@ -12,33 +13,33 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Mark"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.minion = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 900; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.minion = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() { Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = -1; - Main.PlaySound(SoundID.Item60, projectile.Center); + Projectile.soundDelay = -1; + SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); } - if (projectile.localAI[1] < 30f) + if (Projectile.localAI[1] < 30f) { for (int num1134 = 0; num1134 < 1; num1134++) { @@ -49,10 +50,10 @@ namespace CalamityMod.Projectiles.Summon value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); value81.X *= -1f; Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default, 0.5f)]; dust34.position = position4; - dust34.customData = projectile.Center + value82; + dust34.customData = Projectile.Center + value82; dust34.fadeIn = 1f; dust34.scale = 0.3f; if (value81.X > -1.2f) @@ -62,50 +63,50 @@ namespace CalamityMod.Projectiles.Summon dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; } } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + Projectile.localAI[0] = 0.8f; + Projectile.direction = 1; + Point point9 = Projectile.Center.ToTileCoordinates(); + Projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) + Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; + if (Projectile.localAI[1] < 33f) { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 8; + Projectile.alpha -= 8; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } - if (projectile.localAI[1] > 103f) + if (Projectile.localAI[1] > 103f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 16; + Projectile.alpha += 16; } - if (projectile.alpha > 255) + if (Projectile.alpha > 255) { - projectile.alpha = 255; + Projectile.alpha = 255; } } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); } for (int num1135 = 0; num1135 < 2; num1135++) { if (Main.rand.NextBool(10)) { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust dust35 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; dust35.noGravity = true; dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; + dust35.scale = Projectile.Opacity * Projectile.localAI[0]; + dust35.position = Projectile.Center; dust35.velocity = value83 * 2.5f; } } @@ -114,48 +115,48 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(10)) { Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; + Dust dust36 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; dust36.noGravity = true; dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; + dust36.scale = Projectile.Opacity * Projectile.localAI[0]; + dust36.position = Projectile.Center; dust36.velocity = value84 * 2.5f; } } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + Projectile.velocity = Vector2.Zero; + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner, 0f, 0f); } - if (projectile.localAI[1] >= 120f) + if (Projectile.localAI[1] >= 120f) { - projectile.Kill(); + Projectile.Kill(); return; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Color alpha5 = projectile.GetAlpha(color25); + Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[Projectile.type]; + Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alpha5 = Projectile.GetAlpha(color25); Vector2 origin7 = rectangle11.Size() / 2f; Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, Projectile.rotation, origin7, Projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Summon/SandTornado.cs b/Projectiles/Summon/SandTornado.cs index aae22d47cd..30ff0e1d67 100644 --- a/Projectiles/Summon/SandTornado.cs +++ b/Projectiles/Summon/SandTornado.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class SandTornado : ModProjectile @@ -12,48 +13,48 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Tornado"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.minion = true; - projectile.penetrate = NPC.downedMoonlord ? -1 : 3; - projectile.timeLeft = 1200; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.penetrate = NPC.downedMoonlord ? -1 : 3; + Projectile.timeLeft = 1200; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { float num1125 = 900f; - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = -1; - Main.PlaySound(SoundID.Item122, projectile.position); + Projectile.soundDelay = -1; + SoundEngine.PlaySound(SoundID.Item122, Projectile.position); } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= num1125) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= num1125) { - projectile.Kill(); + Projectile.Kill(); } - if (projectile.localAI[0] >= 30f) + if (Projectile.localAI[0] >= 30f) { - projectile.damage = 0; - if (projectile.ai[0] < num1125 - 120f) + Projectile.damage = 0; + if (Projectile.ai[0] < num1125 - 120f) { - float num1126 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1126; - projectile.netUpdate = true; + float num1126 = Projectile.ai[0] % 60f; + Projectile.ai[0] = num1125 - 120f + num1126; + Projectile.netUpdate = true; } } float num1127 = 15f; float num1128 = 15f; - Point point8 = projectile.Center.ToTileCoordinates(); + Point point8 = Projectile.Center.ToTileCoordinates(); int num1129; int num1130; Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); @@ -64,14 +65,14 @@ namespace CalamityMod.Projectiles.Summon Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); value74.X = value74.Y * 0.2f; - projectile.width = (int)(value74.X * 0.65f); - projectile.height = (int)value74.Y; - projectile.Center = vector146; - if (projectile.owner == Main.myPlayer) + Projectile.width = (int)(value74.X * 0.65f); + Projectile.height = (int)value74.Y; + Projectile.Center = vector146; + if (Projectile.owner == Main.myPlayer) { bool flag74 = false; - Vector2 center16 = Main.player[projectile.owner].Center; - Vector2 top = Main.player[projectile.owner].Top; + Vector2 center16 = Main.player[Projectile.owner].Center; + Vector2 top = Main.player[Projectile.owner].Top; for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) { Vector2 position2 = Vector2.Lerp(value72, value73, num1131); @@ -81,14 +82,14 @@ namespace CalamityMod.Projectiles.Summon break; } } - if (!flag74 && projectile.ai[0] < num1125 - 120f) + if (!flag74 && Projectile.ai[0] < num1125 - 120f) { - float num1132 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1132; - projectile.netUpdate = true; + float num1132 = Projectile.ai[0] % 60f; + Projectile.ai[0] = num1125 - 120f + num1132; + Projectile.netUpdate = true; } } - if (projectile.ai[0] < num1125 - 120f) + if (Projectile.ai[0] < num1125 - 120f) { return; } @@ -99,13 +100,13 @@ namespace CalamityMod.Projectiles.Summon float num226 = 600f; float num227 = 15f; float num228 = 15f; - float num229 = projectile.ai[0]; + float num229 = Projectile.ai[0]; float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); if (num229 > num226 - 60f) { scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); } - Point point5 = projectile.Center.ToTileCoordinates(); + Point point5 = Projectile.Center.ToTileCoordinates(); int num230; int num231; Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); @@ -118,7 +119,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); vector33.X = vector33.Y * num232; new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Texture2D texture2D23 = Main.projectileTexture[Projectile.type]; Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); Vector2 origin3 = rectangle9.Size() / 2f; float num233 = -0.06283186f * num229; diff --git a/Projectiles/Summon/SandnadoMinion.cs b/Projectiles/Summon/SandnadoMinion.cs index 1b287fb674..b6bc5ca486 100644 --- a/Projectiles/Summon/SandnadoMinion.cs +++ b/Projectiles/Summon/SandnadoMinion.cs @@ -14,55 +14,55 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Sandnado"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 40; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; + Projectile.width = 28; + Projectile.height = 40; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { - Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 dustVel = source - projectile.Center; + Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 dustVel = source - Projectile.Center; int sand = Dust.NewDust(source + dustVel, 0, 0, 85, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.4f); Main.dust[sand].noGravity = true; Main.dust[sand].noLight = true; Main.dust[sand].velocity = dustVel; } - projectile.localAI[1] += 1f; + Projectile.localAI[1] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) { @@ -72,36 +72,36 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.sandnado) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.MinionAntiClump(0.1f); - if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + Projectile.MinionAntiClump(0.1f); + if (Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.alpha += 20; - if (projectile.alpha > 150) + Projectile.alpha += 20; + if (Projectile.alpha > 150) { - projectile.alpha = 150; + Projectile.alpha = 150; } } else { - projectile.alpha -= 50; - if (projectile.alpha < 60) + Projectile.alpha -= 50; + if (Projectile.alpha < 60) { - projectile.alpha = 60; + Projectile.alpha = 60; } } - Vector2 targetPos = projectile.position; + Vector2 targetPos = Projectile.position; float range = 1800f; bool foundTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float npcDist = Vector2.Distance(npc.Center, projectile.Center); - if ((!foundTarget && npcDist < range) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float npcDist = Vector2.Distance(npc.Center, Projectile.Center); + if ((!foundTarget && npcDist < range) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { range = npcDist; targetPos = npc.Center; @@ -115,10 +115,10 @@ namespace CalamityMod.Projectiles.Summon for (int k = 0; k < Main.maxNPCs; k++) { NPC npc = Main.npc[k]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float npcDist = Vector2.Distance(npc.Center, projectile.Center); - if ((!foundTarget && npcDist < range) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float npcDist = Vector2.Distance(npc.Center, Projectile.Center); + if ((!foundTarget && npcDist < range) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { range = npcDist; targetPos = npc.Center; @@ -132,132 +132,132 @@ namespace CalamityMod.Projectiles.Summon { sepAnxietyDist = 3000f; } - if (Vector2.Distance(player.Center, projectile.Center) > sepAnxietyDist) + if (Vector2.Distance(player.Center, Projectile.Center) > sepAnxietyDist) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } - if (foundTarget && projectile.ai[0] == 0f) + if (foundTarget && Projectile.ai[0] == 0f) { - Vector2 targetDir = targetPos - projectile.Center; + Vector2 targetDir = targetPos - Projectile.Center; float targetDist = targetDir.Length(); targetDir.Normalize(); if (targetDist > 400f) { float speedMult = 6f; targetDir *= speedMult; - projectile.velocity = (projectile.velocity * 20f + targetDir) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + targetDir) / 21f; } else { - projectile.velocity *= 0.96f; + Projectile.velocity *= 0.96f; } if (targetDist > 200f) { float speedMult = 12f; targetDir *= speedMult; - projectile.velocity = (projectile.velocity * 40f + targetDir) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + targetDir) / 41f; } - if (projectile.velocity.Y > -1f) + if (Projectile.velocity.Y > -1f) { - projectile.velocity.Y -= 0.1f; + Projectile.velocity.Y -= 0.1f; } } else { - if (!Collision.CanHitLine(projectile.Center, 1, 1, player.Center, 1, 1)) + if (!Collision.CanHitLine(Projectile.Center, 1, 1, player.Center, 1, 1)) { - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; } float returnSpeed = 12f; - Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, -20f); + Vector2 playerVec = player.Center - Projectile.Center + new Vector2(0f, -20f); float playerDist = playerVec.Length(); if (playerDist > 200f && returnSpeed < 12f) { returnSpeed = 12f; } - if (playerDist < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerDist < 100f && Projectile.ai[0] == 1f && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (playerDist > 2000f) { - projectile.position = player.position; - projectile.netUpdate = true; + Projectile.position = player.position; + Projectile.netUpdate = true; } if (Math.Abs(playerVec.X) > 40f || Math.Abs(playerVec.Y) > 10f) { playerVec.Normalize(); playerVec *= returnSpeed; playerVec *= new Vector2(1.25f, 0.65f); - projectile.velocity = (projectile.velocity * 20f + playerVec) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + playerVec) / 21f; } else { - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; } } - projectile.rotation = projectile.velocity.X * 0.05f; - projectile.frameCounter++; + Projectile.rotation = Projectile.velocity.X * 0.05f; + Projectile.frameCounter++; int two = 2; - if (projectile.frameCounter >= 6 * two) + if (Projectile.frameCounter >= 6 * two) { - projectile.frameCounter = 0; + Projectile.frameCounter = 0; } - projectile.frame = projectile.frameCounter / two; + Projectile.frame = Projectile.frameCounter / two; if (Main.rand.NextBool(5)) { - int sand = Dust.NewDust(projectile.position, projectile.width, projectile.height, 85, 0f, 0f, 100, default, 2f); + int sand = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 2f); Main.dust[sand].velocity *= 0.3f; Main.dust[sand].noGravity = true; Main.dust[sand].noLight = true; } - if (projectile.velocity.X > 0f) + if (Projectile.velocity.X > 0f) { - projectile.spriteDirection = projectile.direction = -1; + Projectile.spriteDirection = Projectile.direction = -1; } - else if (projectile.velocity.X < 0f) + else if (Projectile.velocity.X < 0f) { - projectile.spriteDirection = projectile.direction = 1; + Projectile.spriteDirection = Projectile.direction = 1; } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; if (Main.rand.Next(3) != 0) { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; } } - if (projectile.ai[1] > 75f) + if (Projectile.ai[1] > 75f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { float speed = 14f; int projType = ModContent.ProjectileType(); if (foundTarget) { - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (!Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner) { - Vector2 velocity = targetPos - projectile.Center; + Vector2 velocity = targetPos - Projectile.Center; velocity.Normalize(); velocity *= speed; - int shark = Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, projectile.knockBack, projectile.owner); + int shark = Projectile.NewProjectile(Projectile.Center, velocity, projType, Projectile.damage, Projectile.knockBack, Projectile.owner); Main.projectile[shark].netUpdate = true; - projectile.netUpdate = true; + Projectile.netUpdate = true; } } } @@ -267,10 +267,10 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int frame = frameHeight * projectile.frame; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frame, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture = Main.projectileTexture[Projectile.type]; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + int frame = frameHeight * Projectile.frame; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frame, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Summon/SeekerSummonProj.cs b/Projectiles/Summon/SeekerSummonProj.cs index 17ced5dca6..153760c78d 100644 --- a/Projectiles/Summon/SeekerSummonProj.cs +++ b/Projectiles/Summon/SeekerSummonProj.cs @@ -3,53 +3,54 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class SeekerSummonProj : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float CircleAngleRatio => ref projectile.ai[0]; - public ref float Time => ref projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float CircleAngleRatio => ref Projectile.ai[0]; + public ref float Time => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Soul Seeker"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 84; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 90000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = projectile.MaxUpdates * 8; - projectile.alpha = 255; + Projectile.width = Projectile.height = 84; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 8; + Projectile.alpha = 255; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { DoInitializationEffects(); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } ProvidePlayerMinionBuffs(); DetermineFrames(); - projectile.alpha = Utils.Clamp(projectile.alpha - 15, 0, 255); - NPC potentialTarget = projectile.Center.MinionHoming(2050f, Owner); + Projectile.alpha = Utils.Clamp(Projectile.alpha - 15, 0, 255); + NPC potentialTarget = Projectile.Center.MinionHoming(2050f, Owner); if (potentialTarget is null) FlyNearOwner(); else @@ -64,7 +65,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 40; i++) { - Dust brimstoneFire = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(50f, 50f), DustID.Fireworks); + Dust brimstoneFire = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(50f, 50f), DustID.Fireworks); brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 5f); brimstoneFire.scale = 1f + brimstoneFire.velocity.Length() * 0.1f; brimstoneFire.color = Color.Lerp(Color.White, Color.OrangeRed, Main.rand.NextFloat()); @@ -78,42 +79,42 @@ namespace CalamityMod.Projectiles.Summon // Verify player/minion state integrity. The minion cannot stay alive if the // owner is dead or if the caller of the AI is invalid. - if (projectile.type != ModContent.ProjectileType()) + if (Projectile.type != ModContent.ProjectileType()) return; if (Owner.dead) Owner.Calamity().soulSeeker = false; if (Owner.Calamity().soulSeeker) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } internal void DetermineFrames() { - projectile.frameCounter++; - if (projectile.frameCounter % 5 == 4) - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + Projectile.frameCounter++; + if (Projectile.frameCounter % 5 == 4) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; } internal void FlyNearOwner() { // Make an imp laugh sound every so often. if (Main.rand.NextBool(1600)) - Main.PlaySound(SoundID.DD2_KoboldFlyerHurt); + SoundEngine.PlaySound(SoundID.DD2_KoboldFlyerHurt); Vector2 destination = Owner.Center + (MathHelper.TwoPi * CircleAngleRatio - MathHelper.PiOver2).ToRotationVector2() * 310f; - projectile.Center = Vector2.Lerp(projectile.Center, destination, 0.03f); + Projectile.Center = Vector2.Lerp(Projectile.Center, destination, 0.03f); - if (!projectile.WithinRange(destination, 20f)) - projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(destination) * 16f) / 21f; + if (!Projectile.WithinRange(destination, 20f)) + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(destination) * 16f) / 21f; - if (!projectile.WithinRange(Owner.Center, 1800f)) + if (!Projectile.WithinRange(Owner.Center, 1800f)) { - projectile.Center = Owner.Center; - projectile.velocity = -Vector2.UnitY * 4f; - projectile.netUpdate = true; + Projectile.Center = Owner.Center; + Projectile.velocity = -Vector2.UnitY * 4f; + Projectile.netUpdate = true; } - projectile.spriteDirection = (destination.X - projectile.Center.X > 0f).ToDirectionInt(); + Projectile.spriteDirection = (destination.X - Projectile.Center.X > 0f).ToDirectionInt(); } internal void AttackTarget(NPC target) @@ -123,29 +124,29 @@ namespace CalamityMod.Projectiles.Summon { // Make an imp scream sound every so often. if (Main.rand.NextBool(400)) - Main.PlaySound(SoundID.DD2_KoboldFlyerChargeScream); + SoundEngine.PlaySound(SoundID.DD2_KoboldFlyerChargeScream); - projectile.velocity *= 0.9f; + Projectile.velocity *= 0.9f; if (Time % 16f == 15f) { float shootSpeed = 23f; - Vector2 eyePosition = projectile.Center + new Vector2(projectile.spriteDirection * 22f, -12f); + Vector2 eyePosition = Projectile.Center + new Vector2(Projectile.spriteDirection * 22f, -12f); Vector2 aheadAim = (target.Center - eyePosition) / target.velocity.Length() / shootSpeed; - Vector2 shootVelocity = (target.Center + aheadAim - eyePosition).SafeNormalize(Vector2.UnitX * projectile.spriteDirection) * shootSpeed; - projectile.spriteDirection = (shootVelocity.X > 0f).ToDirectionInt(); + Vector2 shootVelocity = (target.Center + aheadAim - eyePosition).SafeNormalize(Vector2.UnitX * Projectile.spriteDirection) * shootSpeed; + Projectile.spriteDirection = (shootVelocity.X > 0f).ToDirectionInt(); if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(eyePosition, shootVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(eyePosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } return; } - projectile.spriteDirection = (projectile.velocity.X > 0f).ToDirectionInt(); - if (!projectile.WithinRange(target.Center, 400f)) - projectile.velocity = (projectile.velocity * 10f + projectile.SafeDirectionTo(target.Center) * 22f) / 11f; - else if (projectile.velocity.Length() < 28f) - projectile.velocity = projectile.SafeDirectionTo(target.Center) * 29f; + Projectile.spriteDirection = (Projectile.velocity.X > 0f).ToDirectionInt(); + if (!Projectile.WithinRange(target.Center, 400f)) + Projectile.velocity = (Projectile.velocity * 10f + Projectile.SafeDirectionTo(target.Center) * 22f) / 11f; + else if (Projectile.velocity.Length() < 28f) + Projectile.velocity = Projectile.SafeDirectionTo(target.Center) * 29f; } } } diff --git a/Projectiles/Summon/SepulcherMinion.cs b/Projectiles/Summon/SepulcherMinion.cs index bc8adf0f5c..b0238da1e9 100644 --- a/Projectiles/Summon/SepulcherMinion.cs +++ b/Projectiles/Summon/SepulcherMinion.cs @@ -9,6 +9,7 @@ using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -81,22 +82,22 @@ namespace CalamityMod.Projectiles.Summon public int PlayerAttackCountdown; public SepulcherSegment[] Segments = new SepulcherSegment[24]; public List Arms = new List(); - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public AIState CurrentAIState { - get => (AIState)(int)projectile.ai[0]; + get => (AIState)(int)Projectile.ai[0]; set { // Don't do anything unless the caller is the owner of this projectile- changes will be synced to other clients in MP. - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return; - projectile.ai[0] = (int)value; - projectile.netUpdate = true; + Projectile.ai[0] = (int)value; + Projectile.netUpdate = true; } } - public ref float JawRotation => ref projectile.localAI[0]; - public ref float JawSnapTimer => ref projectile.localAI[1]; + public ref float JawRotation => ref Projectile.localAI[0]; + public ref float JawSnapTimer => ref Projectile.localAI[1]; public const int HeartCreationRate = 420; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -104,28 +105,28 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Sepulcher"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 54; - projectile.height = 54; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.penetrate = -1; - projectile.minionSlots = 4f; - projectile.timeLeft = 90000; - projectile.Opacity = 0f; - projectile.tileCollide = false; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.hide = true; + Projectile.width = 54; + Projectile.height = 54; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + Projectile.penetrate = -1; + Projectile.minionSlots = 4f; + Projectile.timeLeft = 90000; + Projectile.Opacity = 0f; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; + Projectile.hide = true; } #region Syncing @@ -176,7 +177,7 @@ namespace CalamityMod.Projectiles.Summon UpdateSegments(); // Fade in rapidly. - projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.2f, 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.2f, 0f, 1f); NPC potentialTarget = AttemptToFindTarget(1450f); @@ -208,7 +209,7 @@ namespace CalamityMod.Projectiles.Summon // Determine whether the projectile can attack its owner based on the attakc countdown. - projectile.hostile = PlayerAttackCountdown > 0; + Projectile.hostile = PlayerAttackCountdown > 0; switch (CurrentAIState) { @@ -236,7 +237,7 @@ namespace CalamityMod.Projectiles.Summon int heartType = ModContent.NPCType(); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].type != heartType || !Main.npc[i].active || Main.npc[i].target != projectile.owner) + if (Main.npc[i].type != heartType || !Main.npc[i].active || Main.npc[i].target != Projectile.owner) continue; heartsAttachedToOwner++; } @@ -247,7 +248,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextFloat() < chanceToBecomeAngry) { PlayerAttackCountdown = 300; - projectile.netUpdate = true; + Projectile.netUpdate = true; } else if (Main.netMode != NetmodeID.MultiplayerClient) NPC.NewNPC((int)Owner.Center.X, (int)Owner.Center.Y, heartType); @@ -264,16 +265,16 @@ namespace CalamityMod.Projectiles.Summon public void Initialize() { - if (projectile.ai[1] != 0f) + if (Projectile.ai[1] != 0f) return; for (int i = 0; i < Segments.Length; i++) - Segments[i].CurrentPosition = projectile.Center - projectile.velocity.SafeNormalize(Vector2.UnitY) * i * 0.2f; + Segments[i].CurrentPosition = Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitY) * i * 0.2f; - projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.ai[1] = 1f; - if (Main.myPlayer == projectile.owner) + Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.ai[1] = 1f; + if (Main.myPlayer == Projectile.owner) { float rotationalOffset = 0f; for (byte i = 3; i < Segments.Length - 2; i += 2) @@ -284,7 +285,7 @@ namespace CalamityMod.Projectiles.Summon Arms.Add(new SepulcherArm(Segments[i].CurrentPosition, i, rotationalOffset + MathHelper.Pi, false, true)); rotationalOffset = MathHelper.WrapAngle(rotationalOffset + MathHelper.Pi / 6f); } - projectile.netUpdate = true; + Projectile.netUpdate = true; } } @@ -295,23 +296,23 @@ namespace CalamityMod.Projectiles.Summon if (Owner.dead) Owner.Calamity().sepulcher = false; if (Owner.Calamity().sepulcher) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } public void HandleFlexibleDamage() { // Adjust the damage of this projectile if the owner's current minion damage factor has changed for any reason. - if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - projectile.damage = trueDamage; + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); + Projectile.damage = trueDamage; } } public void UpdateSegments() { - float aheadRotation = projectile.rotation; - Vector2 aheadPosition = projectile.Center; + float aheadRotation = Projectile.rotation; + Vector2 aheadPosition = Projectile.Center; // Connect all segments to each-other and calculate their rotations. for (int i = 0; i < Segments.Length; i++) @@ -343,8 +344,8 @@ namespace CalamityMod.Projectiles.Summon float sideFactor = MathHelper.Lerp(200f, 18f, Utils.InverseLerp(-0.51f, -0.06f, Arms[i].Rotation, true)); float aheadFactor = MathHelper.Lerp(284f, 680f, Utils.InverseLerp(-0.51f, -0.06f, Arms[i].Rotation, true)); int direction = Arms[i].Direction.ToDirectionInt(); - idealMovePosition += (segmentToAttachTo.Rotation + Arms[i].Rotation * direction - MathHelper.PiOver2).ToRotationVector2() * projectile.scale * aheadFactor; - idealMovePosition += (segmentToAttachTo.Rotation + Arms[i].Rotation * direction - MathHelper.PiOver2 + MathHelper.PiOver2 * direction).ToRotationVector2() * projectile.scale * sideFactor; + idealMovePosition += (segmentToAttachTo.Rotation + Arms[i].Rotation * direction - MathHelper.PiOver2).ToRotationVector2() * Projectile.scale * aheadFactor; + idealMovePosition += (segmentToAttachTo.Rotation + Arms[i].Rotation * direction - MathHelper.PiOver2 + MathHelper.PiOver2 * direction).ToRotationVector2() * Projectile.scale * sideFactor; Arms[i].Center = idealMovePosition; Vector2 offsetFromSegment = Vector2.Zero; @@ -356,7 +357,7 @@ namespace CalamityMod.Projectiles.Summon Arms[i].Limbs[1].Rotation = (Arms[i].Center - Arms[i].Limbs[0].Center).ToRotation(); Arms[i].Limbs[1].Center = Arms[i].Limbs[0].Center + offsetFromSegment * 0.5f + (Arms[i].Center - Arms[i].Limbs[0].Center).SafeNormalize(Vector2.UnitY) * 64f; - float rotationalVelocityFactor = Utils.InverseLerp(0f, 6f, projectile.velocity.Length(), true); + float rotationalVelocityFactor = Utils.InverseLerp(0f, 6f, Projectile.velocity.Length(), true); if (CurrentAIState == AIState.AttackEnemy_Charge) rotationalVelocityFactor *= 0.85f; if (CurrentAIState == AIState.AttackOwner) @@ -380,27 +381,27 @@ namespace CalamityMod.Projectiles.Summon public void HoverNearOwner() { // Teleport to the owner if it's very far away. - if (!projectile.WithinRange(Owner.Center, 3200f)) + if (!Projectile.WithinRange(Owner.Center, 3200f)) { - projectile.Center = Owner.Center; - projectile.velocity = Main.rand.NextVector2CircularEdge(4f, 4f); - projectile.netUpdate = true; + Projectile.Center = Owner.Center; + Projectile.velocity = Main.rand.NextVector2CircularEdge(4f, 4f); + Projectile.netUpdate = true; } // Attempt to move towards the owner. - if (!projectile.WithinRange(Owner.Center, 540f)) + if (!Projectile.WithinRange(Owner.Center, 540f)) { Vector2 destination = Owner.Center + (IdleTimer / 31f).ToRotationVector2() * 240f; - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(destination) * 18f, 0.03f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(destination) * 18f, 0.03f); - float updatedDirectionRotation = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(destination), 0.04f); - projectile.velocity = updatedDirectionRotation.ToRotationVector2() * projectile.velocity.Length(); + float updatedDirectionRotation = Projectile.velocity.ToRotation().AngleTowards(Projectile.AngleTo(destination), 0.04f); + Projectile.velocity = updatedDirectionRotation.ToRotationVector2() * Projectile.velocity.Length(); } - else if (projectile.velocity.Length() < 16f) - projectile.velocity *= 1.03f; + else if (Projectile.velocity.Length() < 16f) + Projectile.velocity *= 1.03f; // Determine the head rotation. - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public void AttackEnemyWithDarts(NPC target) @@ -408,19 +409,19 @@ namespace CalamityMod.Projectiles.Summon Vector2 destination = target.Center + ((AttackTimer / 20f).ToRotationVector2() * 320f); // Step towards the ideal velocity with an acceleration of 1 pixel/second^2. - projectile.velocity = projectile.velocity.MoveTowards(projectile.SafeDirectionTo(destination) * 24f, 1f); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity = Projectile.velocity.MoveTowards(Projectile.SafeDirectionTo(destination) * 24f, 1f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; // Release a burst of darts from all segments at the target. - if (Main.myPlayer == projectile.owner && AttackTimer % 60 > 60 - Segments.Length) + if (Main.myPlayer == Projectile.owner && AttackTimer % 60 > 60 - Segments.Length) { int segmentToFireFrom = 60 - AttackTimer % 60; Vector2 spawnPosition = Segments[segmentToFireFrom].CurrentPosition; Vector2 shootVelocity = (target.Center - spawnPosition).SafeNormalize(Vector2.UnitY) * 8f; - Projectile.NewProjectile(spawnPosition, shootVelocity, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(spawnPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); } - if (Main.myPlayer == projectile.owner && AttackTimer > 430) + if (Main.myPlayer == Projectile.owner && AttackTimer > 430) { CurrentAIState = AIState.AttackEnemy_Charge; AttackTimer = 0; @@ -429,36 +430,36 @@ namespace CalamityMod.Projectiles.Summon public void AttackEnemyByCharging(NPC target) { - if (!projectile.WithinRange(target.Center, 350f)) + if (!Projectile.WithinRange(target.Center, 350f)) { Vector2 destination = target.Center + (AttackTimer / 25f).ToRotationVector2() * MathHelper.Min(target.width * 0.35f, 150f); - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(destination) * 34f, 0.08f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(destination) * 34f, 0.08f); - float updatedDirectionRotation = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(destination), 0.12f); - projectile.velocity = updatedDirectionRotation.ToRotationVector2() * projectile.velocity.Length(); + float updatedDirectionRotation = Projectile.velocity.ToRotation().AngleTowards(Projectile.AngleTo(destination), 0.12f); + Projectile.velocity = updatedDirectionRotation.ToRotationVector2() * Projectile.velocity.Length(); } - else if (projectile.velocity.Length() < 29f) + else if (Projectile.velocity.Length() < 29f) { - projectile.velocity *= 1.035f; + Projectile.velocity *= 1.035f; if (JawSnapTimer <= 0f) { // Open the mouth of the jaw if close but not super close to the target. - if (projectile.WithinRange(target.Center, 270f)) + if (Projectile.WithinRange(target.Center, 270f)) JawRotation = JawRotation.AngleLerp(0.87f, 0.12f); // If really close, snap. - if (projectile.WithinRange(target.Center, 165f)) + if (Projectile.WithinRange(target.Center, 165f)) { - Main.PlaySound(SoundID.DD2_SkeletonHurt, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_SkeletonHurt, Projectile.Center); JawSnapTimer = 45f; } } } // Determine the head rotation. - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Main.myPlayer == projectile.owner && AttackTimer > 480) + if (Main.myPlayer == Projectile.owner && AttackTimer > 480) { CurrentAIState = AIState.AttackEnemy_ReleaseDartBurst; AttackTimer = 0; @@ -468,36 +469,36 @@ namespace CalamityMod.Projectiles.Summon public void AttackOwner() { // Attempt to angle towards the owner. - float newSpeed = MathHelper.Lerp(projectile.velocity.Length(), 21f, 0.025f); + float newSpeed = MathHelper.Lerp(Projectile.velocity.Length(), 21f, 0.025f); - if (!projectile.WithinRange(Owner.Center, 370f)) + if (!Projectile.WithinRange(Owner.Center, 370f)) { - Vector2 idealVelocity = projectile.SafeDirectionTo(Owner.Center) * newSpeed; - projectile.velocity = projectile.velocity.MoveTowards(idealVelocity, 2f); + Vector2 idealVelocity = Projectile.SafeDirectionTo(Owner.Center) * newSpeed; + Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 2f); float idealAimDirection = idealVelocity.ToRotation(); - projectile.velocity = projectile.velocity.ToRotation().AngleLerp(idealAimDirection, 0.05f).ToRotationVector2() * projectile.velocity.Length(); + Projectile.velocity = Projectile.velocity.ToRotation().AngleLerp(idealAimDirection, 0.05f).ToRotationVector2() * Projectile.velocity.Length(); } - else if (projectile.velocity.Length() < 36f) + else if (Projectile.velocity.Length() < 36f) { - projectile.velocity *= 1.03f; + Projectile.velocity *= 1.03f; if (JawSnapTimer <= 0f) { // Open the mouth of the jaw if close but not super close to the owner. - if (projectile.WithinRange(Owner.Center, 300f)) + if (Projectile.WithinRange(Owner.Center, 300f)) JawRotation = JawRotation.AngleLerp(0.87f, 0.12f); // If really close, snap. - if (projectile.WithinRange(Owner.Center, 180f)) + if (Projectile.WithinRange(Owner.Center, 180f)) { - Main.PlaySound(SoundID.DD2_SkeletonHurt, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_SkeletonHurt, Projectile.Center); JawSnapTimer = 45f; } } } // Determine the head rotation. - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public NPC AttemptToFindTarget(float searchDistance) @@ -508,7 +509,7 @@ namespace CalamityMod.Projectiles.Summon if (Owner.HasMinionAttackTargetNPC) { NPC targetedNPC = Main.npc[Owner.MinionAttackTargetNPC]; - if (targetedNPC.WithinRange(projectile.Center, searchDistance) && targetedNPC.CanBeChasedBy() && targetedNPC.type != heartType) + if (targetedNPC.WithinRange(Projectile.Center, searchDistance) && targetedNPC.CanBeChasedBy() && targetedNPC.type != heartType) return targetedNPC; } @@ -519,9 +520,9 @@ namespace CalamityMod.Projectiles.Summon { float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); - if (Main.npc[i].WithinRange(projectile.Center, distance + extraDistance)) + if (Main.npc[i].WithinRange(Projectile.Center, distance + extraDistance)) { - distance = Main.npc[i].DistanceSQ(projectile.Center); + distance = Main.npc[i].DistanceSQ(Projectile.Center); closestTarget = Main.npc[i]; } } @@ -541,15 +542,15 @@ namespace CalamityMod.Projectiles.Summon Color backAfterimageColor = Color.Red * angerFactor; backAfterimageColor.A = 0; - Texture2D eyesTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionEyes"); - Texture2D jawTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionJaw"); - Texture2D headTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionHead"); - Texture2D bodyTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionBody"); - Texture2D bodyTexture2 = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionBodyAlt"); - Texture2D tailTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionTail"); - Texture2D armTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherArm"); - Texture2D foreArmTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherForeArm"); - Texture2D handTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherHand"); + Texture2D eyesTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SepulcherMinionEyes"); + Texture2D jawTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SepulcherMinionJaw"); + Texture2D headTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SepulcherMinionHead"); + Texture2D bodyTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SepulcherMinionBody"); + Texture2D bodyTexture2 = ModContent.Request("CalamityMod/Projectiles/Summon/SepulcherMinionBodyAlt"); + Texture2D tailTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SepulcherMinionTail"); + Texture2D armTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SepulcherArm"); + Texture2D foreArmTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SepulcherForeArm"); + Texture2D handTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SepulcherHand"); Vector2 drawPosition; @@ -564,10 +565,10 @@ namespace CalamityMod.Projectiles.Summon for (int j = 0; j < 4; j++) { Vector2 drawOffset = (MathHelper.TwoPi * j / 4f).ToRotationVector2() * afterimageOutwardness; - spriteBatch.Draw(foreArmTexture, forearmDrawPosition + drawOffset, null, backAfterimageColor, Arms[i].Limbs[0].Rotation + MathHelper.PiOver2, foreArmTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(foreArmTexture, forearmDrawPosition + drawOffset, null, backAfterimageColor, Arms[i].Limbs[0].Rotation + MathHelper.PiOver2, foreArmTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); } } - spriteBatch.Draw(foreArmTexture, forearmDrawPosition, null, drawColor, Arms[i].Limbs[0].Rotation + MathHelper.PiOver2, foreArmTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(foreArmTexture, forearmDrawPosition, null, drawColor, Arms[i].Limbs[0].Rotation + MathHelper.PiOver2, foreArmTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); Vector2 armDrawPosition = Arms[i].Limbs[1].Center - Main.screenPosition; drawColor = Lighting.GetColor((int)(Arms[i].Limbs[1].Center.X / 16), (int)(Arms[i].Limbs[1].Center.Y / 16)); @@ -577,10 +578,10 @@ namespace CalamityMod.Projectiles.Summon for (int j = 0; j < 4; j++) { Vector2 drawOffset = (MathHelper.TwoPi * j / 4f).ToRotationVector2() * afterimageOutwardness; - spriteBatch.Draw(armTexture, armDrawPosition + drawOffset, null, backAfterimageColor, Arms[i].Limbs[1].Rotation + MathHelper.PiOver2, armTexture.Size() * new Vector2(0.5f, 0f), projectile.scale, SpriteEffects.FlipVertically, 0f); + spriteBatch.Draw(armTexture, armDrawPosition + drawOffset, null, backAfterimageColor, Arms[i].Limbs[1].Rotation + MathHelper.PiOver2, armTexture.Size() * new Vector2(0.5f, 0f), Projectile.scale, SpriteEffects.FlipVertically, 0f); } } - spriteBatch.Draw(armTexture, armDrawPosition, null, drawColor, Arms[i].Limbs[1].Rotation + MathHelper.PiOver2, armTexture.Size() * new Vector2(0.5f, 0f), projectile.scale, SpriteEffects.FlipVertically, 0f); + spriteBatch.Draw(armTexture, armDrawPosition, null, drawColor, Arms[i].Limbs[1].Rotation + MathHelper.PiOver2, armTexture.Size() * new Vector2(0.5f, 0f), Projectile.scale, SpriteEffects.FlipVertically, 0f); Vector2 handDrawPosition = armDrawPosition; SpriteEffects handDirection = Arms[i].Direction ? SpriteEffects.None : SpriteEffects.FlipHorizontally; @@ -590,10 +591,10 @@ namespace CalamityMod.Projectiles.Summon for (int j = 0; j < 4; j++) { Vector2 drawOffset = (MathHelper.TwoPi * j / 4f).ToRotationVector2() * afterimageOutwardness; - spriteBatch.Draw(handTexture, handDrawPosition + drawOffset, null, backAfterimageColor, Arms[i].Limbs[1].Rotation - MathHelper.PiOver2, handTexture.Size() * new Vector2(0.5f, 0f), projectile.scale, handDirection, 0f); + spriteBatch.Draw(handTexture, handDrawPosition + drawOffset, null, backAfterimageColor, Arms[i].Limbs[1].Rotation - MathHelper.PiOver2, handTexture.Size() * new Vector2(0.5f, 0f), Projectile.scale, handDirection, 0f); } } - spriteBatch.Draw(handTexture, handDrawPosition, null, drawColor, Arms[i].Limbs[1].Rotation - MathHelper.PiOver2, handTexture.Size() * new Vector2(0.5f, 0f), projectile.scale, handDirection, 0f); + spriteBatch.Draw(handTexture, handDrawPosition, null, drawColor, Arms[i].Limbs[1].Rotation - MathHelper.PiOver2, handTexture.Size() * new Vector2(0.5f, 0f), Projectile.scale, handDirection, 0f); } // Draw the segments. @@ -613,13 +614,13 @@ namespace CalamityMod.Projectiles.Summon for (int j = 0; j < 4; j++) { Vector2 drawOffset = (MathHelper.TwoPi * j / 4f).ToRotationVector2() * afterimageOutwardness; - spriteBatch.Draw(textureToUse, drawPosition + drawOffset, null, backAfterimageColor, Segments[i].Rotation, textureToUse.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(textureToUse, drawPosition + drawOffset, null, backAfterimageColor, Segments[i].Rotation, textureToUse.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); } } - spriteBatch.Draw(textureToUse, drawPosition, null, projectile.GetAlpha(lightColor), Segments[i].Rotation, textureToUse.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(textureToUse, drawPosition, null, Projectile.GetAlpha(lightColor), Segments[i].Rotation, textureToUse.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); } - drawPosition = projectile.Center - Main.screenPosition; + drawPosition = Projectile.Center - Main.screenPosition; lightColor = Lighting.GetColor((int)(drawPosition.X + Main.screenPosition.X) / 16, (int)(drawPosition.Y + Main.screenPosition.Y) / 16); // Draw the jaws. @@ -627,10 +628,10 @@ namespace CalamityMod.Projectiles.Summon { float jawBaseOffset = 24f; SpriteEffects jawSpriteEffect = i == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 jawPosition = projectile.Center - Main.screenPosition; - jawPosition += Vector2.UnitX.RotatedBy(projectile.rotation + JawRotation * i) * i * (jawBaseOffset + (float)Math.Sin(JawRotation) * 14f); - jawPosition -= Vector2.UnitY.RotatedBy(projectile.rotation) * (26f + (float)Math.Sin(JawRotation) * 8f); - spriteBatch.Draw(jawTexture, jawPosition, null, projectile.GetAlpha(lightColor), projectile.rotation + JawRotation * i, jawTexture.Size() * 0.5f, projectile.scale * 1.25f, jawSpriteEffect, 0f); + Vector2 jawPosition = Projectile.Center - Main.screenPosition; + jawPosition += Vector2.UnitX.RotatedBy(Projectile.rotation + JawRotation * i) * i * (jawBaseOffset + (float)Math.Sin(JawRotation) * 14f); + jawPosition -= Vector2.UnitY.RotatedBy(Projectile.rotation) * (26f + (float)Math.Sin(JawRotation) * 8f); + spriteBatch.Draw(jawTexture, jawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation + JawRotation * i, jawTexture.Size() * 0.5f, Projectile.scale * 1.25f, jawSpriteEffect, 0f); } // Draw the head. @@ -639,19 +640,19 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 4; i++) { Vector2 drawOffset = (MathHelper.TwoPi * i / 4f).ToRotationVector2() * afterimageOutwardness; - spriteBatch.Draw(headTexture, drawPosition + drawOffset, null, backAfterimageColor, projectile.rotation, headTexture.Size() * 0.5f, projectile.scale * 1.25f, SpriteEffects.None, 0f); + spriteBatch.Draw(headTexture, drawPosition + drawOffset, null, backAfterimageColor, Projectile.rotation, headTexture.Size() * 0.5f, Projectile.scale * 1.25f, SpriteEffects.None, 0f); } } - spriteBatch.Draw(headTexture, drawPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, headTexture.Size() * 0.5f, projectile.scale * 1.25f, SpriteEffects.None, 0f); + spriteBatch.Draw(headTexture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, headTexture.Size() * 0.5f, Projectile.scale * 1.25f, SpriteEffects.None, 0f); // Draw demonic eyes if enraged. if (afterimageOutwardness > 0f) { - for (int i = 0; i < (int)(projectile.oldPos.Length * angerFactor); i++) + for (int i = 0; i < (int)(Projectile.oldPos.Length * angerFactor); i++) { - drawPosition = projectile.Center - Main.screenPosition - projectile.velocity.SafeNormalize(Vector2.Zero) * 3f * i; - Color fadeColor = Color.White * (1f - i / (float)projectile.oldPos.Length); - spriteBatch.Draw(eyesTexture, drawPosition, null, projectile.GetAlpha(fadeColor), projectile.oldRot[i], eyesTexture.Size() * 0.5f, projectile.scale * 1.25f, SpriteEffects.None, 0f); + drawPosition = Projectile.Center - Main.screenPosition - Projectile.velocity.SafeNormalize(Vector2.Zero) * 3f * i; + Color fadeColor = Color.White * (1f - i / (float)Projectile.oldPos.Length); + spriteBatch.Draw(eyesTexture, drawPosition, null, Projectile.GetAlpha(fadeColor), Projectile.oldRot[i], eyesTexture.Size() * 0.5f, Projectile.scale * 1.25f, SpriteEffects.None, 0f); } } diff --git a/Projectiles/Summon/Shellfish.cs b/Projectiles/Summon/Shellfish.cs index 2df69616c2..70b4f1003e 100644 --- a/Projectiles/Summon/Shellfish.cs +++ b/Projectiles/Summon/Shellfish.cs @@ -17,24 +17,24 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Shellfish"); - Main.projFrames[projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 2; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 28; - projectile.height = 24; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 2; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 120; + Projectile.width = 28; + Projectile.height = 24; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 2; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 120; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) @@ -45,30 +45,30 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - CalamityGlobalProjectile modProj = projectile.Calamity(); + CalamityGlobalProjectile modProj = Projectile.Calamity(); if (spawnDust) { modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; + modProj.spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 20; for (int d = 0; d < dustAmt; d++) { - int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 33, 0f, 0f, 0, default, 1f); + int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 33, 0f, 0f, 0, default, 1f); Main.dust[water].velocity *= 2f; Main.dust[water].scale *= 1.15f; } spawnDust = false; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) { @@ -78,30 +78,30 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.shellfish) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 1) + if (Projectile.frame > 1) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; if (!fly) { - projectile.tileCollide = true; - Vector2 playerVec = player.Center - projectile.Center; + Projectile.tileCollide = true; + Vector2 playerVec = player.Center - Projectile.Center; float playerDistance = playerVec.Length(); - if (projectile.velocity.Y == 0f && (projectile.velocity.X != 0f || playerDistance > 200f)) + if (Projectile.velocity.Y == 0f && (Projectile.velocity.X != 0f || playerDistance > 200f)) { float jumpHeight = Utils.SelectRandom(Main.rand, new float[] { @@ -109,18 +109,18 @@ namespace CalamityMod.Projectiles.Summon 7.5f, 10f }); - projectile.velocity.Y -= jumpHeight; + Projectile.velocity.Y -= jumpHeight; } - projectile.velocity.Y += 0.3f; + Projectile.velocity.Y += 0.3f; float maxDistance = 1000f; bool chaseNPC = false; float npcPositionX = 0f; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float npcDist = Vector2.Distance(npc.Center, projectile.Center); + float npcDist = Vector2.Distance(npc.Center, Projectile.Center); if (!chaseNPC && npcDist < maxDistance) { npcPositionX = npc.Center.X; @@ -133,9 +133,9 @@ namespace CalamityMod.Projectiles.Summon for (int index = 0; index < Main.maxNPCs; index++) { NPC npc = Main.npc[index]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float npcDist = Vector2.Distance(npc.Center, projectile.Center); + float npcDist = Vector2.Distance(npc.Center, Projectile.Center); if (!chaseNPC && npcDist < maxDistance) { npcPositionX = npc.Center.X; @@ -146,18 +146,18 @@ namespace CalamityMod.Projectiles.Summon } if (chaseNPC) { - if (npcPositionX - projectile.position.X > 0f) + if (npcPositionX - Projectile.position.X > 0f) { float rightDist = Utils.SelectRandom(Main.rand, new float[] { 0.15f, 0.2f }); - projectile.velocity.X += rightDist; + Projectile.velocity.X += rightDist; - if (projectile.velocity.X > 8f) + if (Projectile.velocity.X > 8f) { - projectile.velocity.X = 8f; + Projectile.velocity.X = 8f; } } else @@ -167,11 +167,11 @@ namespace CalamityMod.Projectiles.Summon 0.15f, 0.2f }); - projectile.velocity.X -= leftDist; + Projectile.velocity.X -= leftDist; - if (projectile.velocity.X < -8f) + if (Projectile.velocity.X < -8f) { - projectile.velocity.X = -8f; + Projectile.velocity.X = -8f; } } } @@ -180,13 +180,13 @@ namespace CalamityMod.Projectiles.Summon if (playerDistance > 800f) { fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - projectile.tileCollide = false; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 0f; + Projectile.tileCollide = false; } if (playerDistance > 200f) { - if (player.position.X - projectile.position.X > 0f) + if (player.position.X - Projectile.position.X > 0f) { float rightDist = Utils.SelectRandom(Main.rand, new float[] { @@ -194,11 +194,11 @@ namespace CalamityMod.Projectiles.Summon 0.1f, 0.15f }); - projectile.velocity.X += rightDist; + Projectile.velocity.X += rightDist; - if (projectile.velocity.X > 6f) + if (Projectile.velocity.X > 6f) { - projectile.velocity.X = 6f; + Projectile.velocity.X = 6f; } } else @@ -209,19 +209,19 @@ namespace CalamityMod.Projectiles.Summon 0.1f, 0.15f }); - projectile.velocity.X -= leftDist; + Projectile.velocity.X -= leftDist; - if (projectile.velocity.X < -6f) + if (Projectile.velocity.X < -6f) { - projectile.velocity.X = -6f; + Projectile.velocity.X = -6f; } } } if (playerDistance < 200f) { - if (projectile.velocity.X != 0f) + if (Projectile.velocity.X != 0f) { - if (projectile.velocity.X > 0.5f) + if (Projectile.velocity.X > 0.5f) { float leftDist = Utils.SelectRandom(Main.rand, new float[] { @@ -229,9 +229,9 @@ namespace CalamityMod.Projectiles.Summon 0.1f, 0.15f }); - projectile.velocity.X -= leftDist; + Projectile.velocity.X -= leftDist; } - else if (projectile.velocity.X < -0.5f) + else if (Projectile.velocity.X < -0.5f) { float rightDist = Utils.SelectRandom(Main.rand, new float[] { @@ -239,11 +239,11 @@ namespace CalamityMod.Projectiles.Summon 0.1f, 0.15f }); - projectile.velocity.X += rightDist; + Projectile.velocity.X += rightDist; } - else if (Math.Abs(projectile.velocity.X) < 0.5f) + else if (Math.Abs(Projectile.velocity.X) < 0.5f) { - projectile.velocity.X = 0f; + Projectile.velocity.X = 0f; } } } @@ -251,17 +251,17 @@ namespace CalamityMod.Projectiles.Summon } else if (fly) { - Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, 0f); + Vector2 playerVec = player.Center - Projectile.Center + new Vector2(0f, 0f); float playerDistance = playerVec.Length(); playerVec.Normalize(); playerVec *= 14f; - projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + playerVec) / 41f; - projectile.rotation = projectile.velocity.X * 0.03f; + Projectile.rotation = Projectile.velocity.X * 0.03f; if (playerDistance > 1500f) { - projectile.Center = player.Center; - projectile.netUpdate = true; + Projectile.Center = player.Center; + Projectile.netUpdate = true; } if (playerDistance < 100f) { @@ -273,39 +273,39 @@ namespace CalamityMod.Projectiles.Summon { playerStill = 0; } - if (playerStill > 30 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerStill > 30 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { fly = false; - projectile.tileCollide = true; - projectile.rotation = 0; - projectile.velocity.X *= 0.3f; - projectile.velocity.Y *= 0.3f; + Projectile.tileCollide = true; + Projectile.rotation = 0; + Projectile.velocity.X *= 0.3f; + Projectile.velocity.Y *= 0.3f; } } } - if (projectile.velocity.X > 0.25f) + if (Projectile.velocity.X > 0.25f) { - projectile.spriteDirection = -1; + Projectile.spriteDirection = -1; } - else if (projectile.velocity.X < -0.25f) + else if (Projectile.velocity.X < -0.25f) { - projectile.spriteDirection = 1; + Projectile.spriteDirection = 1; } } - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.rotation = 0; - projectile.tileCollide = false; + Projectile.rotation = 0; + Projectile.tileCollide = false; bool breakAway = false; bool spawnDust = false; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] % 30f == 0f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] % 30f == 0f) { spawnDust = true; } - int npcIndex = (int)projectile.ai[1]; + int npcIndex = (int)Projectile.ai[1]; NPC host = Main.npc[npcIndex]; - if (projectile.localAI[0] >= 600000f) //tryna make it stay on there "forever" without glitching + if (Projectile.localAI[0] >= 600000f) //tryna make it stay on there "forever" without glitching { breakAway = true; } @@ -315,8 +315,8 @@ namespace CalamityMod.Projectiles.Summon } else if (host.active && !host.dontTakeDamage && host.defense < 9999) { - projectile.Center = host.Center - projectile.velocity * 2f; - projectile.gfxOffY = host.gfxOffY; + Projectile.Center = host.Center - Projectile.velocity * 2f; + Projectile.gfxOffY = host.gfxOffY; if (spawnDust) { host.HitEffect(0, 1.0); @@ -328,30 +328,30 @@ namespace CalamityMod.Projectiles.Summon } if (breakAway) { - projectile.ai[0] = 0f; - projectile.localAI[0] = 0f; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; + Projectile.ai[0] = 0f; + Projectile.localAI[0] = 0f; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 0f; } } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Player player = Main.player[projectile.owner]; - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Player player = Main.player[Projectile.owner]; + Rectangle myRect = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { NPC npc = Main.npc[npcIndex]; //covers most edge cases like voodoo dolls if (npc.active && !npc.dontTakeDamage && npc.defense < 9999 && npc.Calamity().DR < 0.99f && - ((projectile.friendly && (!npc.friendly || (npc.type == NPCID.Guide && projectile.owner < Main.maxPlayers && player.killGuide) || (npc.type == NPCID.Clothier && projectile.owner < Main.maxPlayers && player.killClothier))) || - (projectile.hostile && npc.friendly && !npc.dontTakeDamageFromHostiles)) && (projectile.owner < 0 || npc.immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) + ((Projectile.friendly && (!npc.friendly || (npc.type == NPCID.Guide && Projectile.owner < Main.maxPlayers && player.killGuide) || (npc.type == NPCID.Clothier && Projectile.owner < Main.maxPlayers && player.killClothier))) || + (Projectile.hostile && npc.friendly && !npc.dontTakeDamageFromHostiles)) && (Projectile.owner < 0 || npc.immune[Projectile.owner] == 0 || Projectile.maxPenetrate == 1)) { - if (npc.noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(npc)) + if (npc.noTileCollide || !Projectile.ownerHitCheck || Projectile.CanHit(npc)) { bool stickingToNPC; //Solar Crawltipede tail has special collision @@ -363,29 +363,29 @@ namespace CalamityMod.Projectiles.Summon rect.Y -= num5; rect.Width += num5 * 2; rect.Height += num5 * 2; - stickingToNPC = projectile.Colliding(myRect, rect); + stickingToNPC = Projectile.Colliding(myRect, rect); } else { - stickingToNPC = projectile.Colliding(myRect, npc.getRect()); + stickingToNPC = Projectile.Colliding(myRect, npc.getRect()); } if (stickingToNPC) { //reflect projectile if the npc can reflect it (like Selenians) - if (npc.reflectingProjectiles && projectile.CanReflect()) + if (npc.reflectingProjectiles && Projectile.CanReflect()) { - npc.ReflectProjectile(projectile.whoAmI); + npc.ReflectProjectile(Projectile.whoAmI); return; } //let the projectile know it is sticking and the npc it is sticking too - projectile.ai[0] = 1f; - projectile.ai[1] = npcIndex; + Projectile.ai[0] = 1f; + Projectile.ai[1] = npcIndex; //follow the NPC - projectile.velocity = (npc.Center - projectile.Center) * 0.75f; + Projectile.velocity = (npc.Center - Projectile.Center) * 0.75f; - projectile.netUpdate = true; + Projectile.netUpdate = true; //Count how many projectiles are attached, delete as necessary Point[] array2 = new Point[10]; @@ -393,7 +393,7 @@ namespace CalamityMod.Projectiles.Summon for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { Projectile proj = Main.projectile[projIndex]; - if (projIndex != projectile.whoAmI && proj.active && proj.owner == Main.myPlayer && proj.type == projectile.type && proj.ai[0] == 1f && proj.ai[1] == (float)npcIndex) + if (projIndex != Projectile.whoAmI && proj.active && proj.owner == Main.myPlayer && proj.type == Projectile.type && proj.ai[0] == 1f && proj.ai[1] == (float)npcIndex) { array2[projCount++] = new Point(projIndex, proj.timeLeft); if (projCount >= array2.Length) @@ -430,7 +430,7 @@ namespace CalamityMod.Projectiles.Summon return null; } - public override bool CanDamage() => projectile.ai[0] == 0f; + public override bool CanDamage() => Projectile.ai[0] == 0f; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Summon/SilvaCrystal.cs b/Projectiles/Summon/SilvaCrystal.cs index 2190db47b7..ffba747817 100644 --- a/Projectiles/Summon/SilvaCrystal.cs +++ b/Projectiles/Summon/SilvaCrystal.cs @@ -15,45 +15,45 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Silva Crystal"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 22; - projectile.height = 52; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.penetrate = -1; + Projectile.width = 22; + Projectile.height = 52; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.alpha = 255; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.penetrate = -1; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[1] == 0f) + if (Projectile.localAI[1] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[1] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[1] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool flag64 = Projectile.type == ModContent.ProjectileType(); if (!modPlayer.silvaSummon) { - projectile.active = false; + Projectile.active = false; return; } if (flag64) @@ -64,61 +64,61 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.sCrystal) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { - projectile.position.Y += 120f; - projectile.rotation = MathHelper.Pi; + Projectile.position.Y += 120f; + Projectile.rotation = MathHelper.Pi; } else { - projectile.rotation = 0f; + Projectile.rotation = 0f; } - projectile.position.X = (int)projectile.position.X; - projectile.position.Y = (int)projectile.position.Y; + Projectile.position.X = (int)Projectile.position.X; + Projectile.position.Y = (int)Projectile.position.Y; float num1072 = 1500f; - projectile.velocity = Vector2.Zero; - projectile.alpha -= 5; - if (projectile.alpha < 0) + Projectile.velocity = Vector2.Zero; + Projectile.alpha -= 5; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.direction == 0) + if (Projectile.direction == 0) { - projectile.direction = Main.player[projectile.owner].direction; + Projectile.direction = Main.player[Projectile.owner].direction; } - if (projectile.alpha == 0 && Main.rand.NextBool(15)) + if (Projectile.alpha == 0 && Main.rand.NextBool(15)) { - Dust dust34 = Main.dust[Dust.NewDust(projectile.Top, 0, 0, 267, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f)]; + Dust dust34 = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, 267, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f)]; dust34.velocity.X = 0f; dust34.noGravity = true; dust34.fadeIn = 1f; - dust34.position = projectile.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f); + dust34.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f); dust34.scale = 0.5f; } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 60f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] >= 60f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } - if (projectile.ai[0] < 0f) + if (Projectile.ai[0] < 0f) { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { int num1074 = -1; float num1075 = num1072; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float num1076 = projectile.Distance(npc.Center); - if (num1076 < num1075 && Collision.CanHitLine(projectile.Center, 0, 0, npc.Center, 0, 0)) + float num1076 = Projectile.Distance(npc.Center); + if (num1076 < num1075 && Collision.CanHitLine(Projectile.Center, 0, 0, npc.Center, 0, 0)) { num1075 = num1076; num1074 = npc.whoAmI; @@ -131,10 +131,10 @@ namespace CalamityMod.Projectiles.Summon for (int num1077 = 0; num1077 < Main.maxNPCs; num1077 = num30 + 1) { NPC nPC16 = Main.npc[num1077]; - if (nPC16.CanBeChasedBy(projectile, false)) + if (nPC16.CanBeChasedBy(Projectile, false)) { - float num1078 = projectile.Distance(nPC16.Center); - if (num1078 < num1075 && Collision.CanHitLine(projectile.Center, 0, 0, nPC16.Center, 0, 0)) + float num1078 = Projectile.Distance(nPC16.Center); + if (num1078 < num1075 && Collision.CanHitLine(Projectile.Center, 0, 0, nPC16.Center, 0, 0)) { num1075 = num1078; num1074 = num1077; @@ -145,42 +145,42 @@ namespace CalamityMod.Projectiles.Summon } if (num1074 != -1) { - projectile.ai[0] = 1f; - projectile.ai[1] = (float)num1074; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.ai[1] = (float)num1074; + Projectile.netUpdate = true; return; } } - if (projectile.ai[0] > 0f) + if (Projectile.ai[0] > 0f) { - int num1079 = (int)projectile.ai[1]; - if (!Main.npc[num1079].CanBeChasedBy(projectile, false)) + int num1079 = (int)Projectile.ai[1]; + if (!Main.npc[num1079].CanBeChasedBy(Projectile, false)) { - projectile.ai[0] = 0f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; return; } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 5f) { - int num1082 = (projectile.SafeDirectionTo(Main.npc[num1079].Center, Vector2.UnitY).X > 0f) ? 1 : -1; - projectile.direction = num1082; - projectile.ai[0] = -20f; - projectile.netUpdate = true; - if (projectile.owner == Main.myPlayer) + int num1082 = (Projectile.SafeDirectionTo(Main.npc[num1079].Center, Vector2.UnitY).X > 0f) ? 1 : -1; + Projectile.direction = num1082; + Projectile.ai[0] = -20f; + Projectile.netUpdate = true; + if (Projectile.owner == Main.myPlayer) { - Vector2 vector155 = Main.npc[num1079].position + Main.npc[num1079].Size * Utils.RandomVector2(Main.rand, 0f, 1f) - projectile.Center; + Vector2 vector155 = Main.npc[num1079].position + Main.npc[num1079].Size * Utils.RandomVector2(Main.rand, 0f, 1f) - Projectile.Center; int num31; for (int num1083 = 0; num1083 < 3; num1083 = num31 + 1) { - Vector2 vector156 = projectile.Center + vector155; + Vector2 vector156 = Projectile.Center + vector155; if (num1083 > 0) { - vector156 = projectile.Center + vector155.RotatedByRandom(0.78539818525314331) * (Main.rand.NextFloat() * 0.5f + 0.75f); + vector156 = Projectile.Center + vector155.RotatedByRandom(0.78539818525314331) * (Main.rand.NextFloat() * 0.5f + 0.75f); } float x4 = Main.rgbToHsl(new Color(Main.DiscoR, 203, 103)).X; - Projectile.NewProjectile(vector156.X, vector156.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, x4, (float)projectile.whoAmI); + Projectile.NewProjectile(vector156.X, vector156.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, x4, (float)Projectile.whoAmI); num31 = num1083; } return; @@ -191,24 +191,24 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 127 - projectile.alpha / 2); + return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 127 - Projectile.alpha / 2); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Vector2 vector59 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = Main.projectileTexture[projectile.type]; - Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Color alpha5 = projectile.GetAlpha(color25); + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + Vector2 vector59 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D34 = Main.projectileTexture[Projectile.type]; + Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alpha5 = Projectile.GetAlpha(color25); Vector2 origin11 = rectangle17.Size() / 2f; - float scaleFactor5 = (float)Math.Cos((double)(6.28318548f * (projectile.localAI[0] / 60f))) + 3f + 3f; + float scaleFactor5 = (float)Math.Cos((double)(6.28318548f * (Projectile.localAI[0] / 60f))) + 3f + 3f; for (float num286 = 0f; num286 < 4f; num286 += 1f) { SpriteBatch spritebatch = Main.spriteBatch; double arg_F8BE_1 = (double)(num286 * MathHelper.PiOver2); Vector2 center = default; - spritebatch.Draw(texture2D34, vector59 + Vector2.UnitY.RotatedBy(arg_F8BE_1, center) * scaleFactor5, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * 0.2f, projectile.rotation, origin11, projectile.scale, SpriteEffects.None, 0f); + spritebatch.Draw(texture2D34, vector59 + Vector2.UnitY.RotatedBy(arg_F8BE_1, center) * scaleFactor5, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * 0.2f, Projectile.rotation, origin11, Projectile.scale, SpriteEffects.None, 0f); } return false; } diff --git a/Projectiles/Summon/SilvaCrystalExplosion.cs b/Projectiles/Summon/SilvaCrystalExplosion.cs index 3a153b26ba..f31f69088e 100644 --- a/Projectiles/Summon/SilvaCrystalExplosion.cs +++ b/Projectiles/Summon/SilvaCrystalExplosion.cs @@ -12,63 +12,63 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 900; - projectile.minion = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 900; + Projectile.minion = true; } public override void AI() { - Color newColor2 = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); - int num978 = (int)projectile.ai[1]; + Color newColor2 = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); + int num978 = (int)Projectile.ai[1]; if (num978 < 0 || num978 >= 1000 || (!Main.projectile[num978].active && Main.projectile[num978].type != ModContent.ProjectileType())) { - projectile.ai[1] = -1f; + Projectile.ai[1] = -1f; } else { DelegateMethods.v3_1 = newColor2.ToVector3() * 0.5f; - Utils.PlotTileLine(projectile.Center, Main.projectile[num978].Center, 8f, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Main.projectile[num978].Center, 8f, new Utils.PerLinePoint(DelegateMethods.CastLight)); } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = Main.rand.NextFloat() * 0.8f + 0.8f; - projectile.direction = (Main.rand.Next(2) > 0) ? 1 : -1; + Projectile.localAI[0] = Main.rand.NextFloat() * 0.8f + 0.8f; + Projectile.direction = (Main.rand.Next(2) > 0) ? 1 : -1; } - projectile.rotation = projectile.localAI[1] / 20f * 6.28318548f * (float)projectile.direction; - if (projectile.alpha > 0) + Projectile.rotation = Projectile.localAI[1] / 20f * 6.28318548f * (float)Projectile.direction; + if (Projectile.alpha > 0) { - projectile.alpha -= 8; + Projectile.alpha -= 8; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - Lighting.AddLight(projectile.Center, newColor2.ToVector3() * 0.5f); + Lighting.AddLight(Projectile.Center, newColor2.ToVector3() * 0.5f); } int num3; for (int num979 = 0; num979 < 2; num979 = num3 + 1) { if (Main.rand.NextBool(10)) { - Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust24 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust dust24 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; dust24.noGravity = true; dust24.noLight = true; - dust24.scale = projectile.Opacity * projectile.localAI[0]; - dust24.position = projectile.Center; + dust24.scale = Projectile.Opacity * Projectile.localAI[0]; + dust24.position = Projectile.Center; dust24.velocity = value55 * 2.5f; } num3 = num979; @@ -78,11 +78,11 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(10)) { Vector2 value56 = Vector2.UnitY.RotatedBy((double)((float)num980 * 3.14159274f), default); - Dust dust25 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + Dust dust25 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; dust25.noGravity = true; dust25.noLight = true; - dust25.scale = projectile.Opacity * projectile.localAI[0]; - dust25.position = projectile.Center; + dust25.scale = Projectile.Opacity * Projectile.localAI[0]; + dust25.position = Projectile.Center; dust25.velocity = value56 * 2.5f; } num3 = num980; @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Summon vector136.Normalize(); } vector136 *= 20f + Main.rand.NextFloat() * 100f; - Vector2 vector137 = projectile.Center + vector136; + Vector2 vector137 = Projectile.Center + vector136; Point point3 = vector137.ToTileCoordinates(); bool flag52 = true; if (!WorldGen.InWorld(point3.X, point3.Y, 0)) @@ -126,32 +126,32 @@ namespace CalamityMod.Projectiles.Summon dust27.color = new Color(255, 255, 255, 255); } } - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 30f) + Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; + Projectile.velocity = Vector2.Zero; + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] >= 30f) { - projectile.Kill(); + Projectile.Kill(); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Vector2 vector59 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = Main.projectileTexture[projectile.type]; - Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Color alpha5 = projectile.GetAlpha(color25); + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + Vector2 vector59 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D34 = Main.projectileTexture[Projectile.type]; + Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alpha5 = Projectile.GetAlpha(color25); Vector2 origin11 = rectangle17.Size() / 2f; - Color color60 = Main.hslToRgb(projectile.ai[0], 1f, 0.5f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, projectile.rotation, origin11, projectile.scale * 2f, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, 0f, origin11, projectile.scale * 2f, SpriteEffects.None, 0f); - if (projectile.ai[1] != -1f && projectile.Opacity > 0.3f) + Color color60 = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f).MultiplyRGBA(new Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, Projectile.rotation, origin11, Projectile.scale * 2f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, 0f, origin11, Projectile.scale * 2f, SpriteEffects.None, 0f); + if (Projectile.ai[1] != -1f && Projectile.Opacity > 0.3f) { - Vector2 vector61 = Main.projectile[(int)projectile.ai[1]].Center - projectile.Center; + Vector2 vector61 = Main.projectile[(int)Projectile.ai[1]].Center - Projectile.Center; Vector2 vector62 = new Vector2(1f, vector61.Length() / (float)texture2D34.Height); float rotation27 = vector61.ToRotation() + 1.57079637f; - float num279 = MathHelper.Distance(15f, projectile.localAI[1]) / 20f; + float num279 = MathHelper.Distance(15f, Projectile.localAI[1]) / 20f; num279 = MathHelper.Clamp(num279, 0f, 1f); if (num279 > 0f) { @@ -167,13 +167,13 @@ namespace CalamityMod.Projectiles.Summon Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); float num69 = (float)Main.rand.Next(7, 13); Vector2 value5 = new Vector2(2.1f, 2f); - Color newColor = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); + Color newColor = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); newColor.A = 255; float num72; for (float num70 = 0f; num70 < num69; num70 = num72 + 1f) { - int num71 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num71].position = projectile.Center; + int num71 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[num71].position = Projectile.Center; Main.dust[num71].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num70 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[num71].noGravity = true; Main.dust[num71].scale = 2f; @@ -188,8 +188,8 @@ namespace CalamityMod.Projectiles.Summon } for (float num73 = 0f; num73 < num69; num73 = num72 + 1f) { - int num74 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num74].position = projectile.Center; + int num74 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[num74].position = Projectile.Center; Main.dust[num74].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num73 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); Dust dust = Main.dust[num74]; dust.velocity *= Main.rand.NextFloat() * 0.8f; @@ -204,31 +204,31 @@ namespace CalamityMod.Projectiles.Summon dust12.color = new Color(255, 255, 255, 255); num72 = num73; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - projectile.friendly = true; - int width = projectile.width; - int height2 = projectile.height; - int num75 = projectile.penetrate; - projectile.position = projectile.Center; - projectile.width = projectile.height = 60; - projectile.Center = projectile.position; - projectile.penetrate = -1; - projectile.maxPenetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - projectile.penetrate = num75; - projectile.position = projectile.Center; - projectile.width = width; - projectile.height = height2; - projectile.Center = projectile.position; + Projectile.friendly = true; + int width = Projectile.width; + int height2 = Projectile.height; + int num75 = Projectile.penetrate; + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 60; + Projectile.Center = Projectile.position; + Projectile.penetrate = -1; + Projectile.maxPenetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + Projectile.penetrate = num75; + Projectile.position = Projectile.Center; + Projectile.width = width; + Projectile.height = height2; + Projectile.Center = Projectile.position; } } public override Color? GetAlpha(Color lightColor) { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } } } diff --git a/Projectiles/Summon/SirenSongFriendly.cs b/Projectiles/Summon/SirenSongFriendly.cs index 60bb725ded..32ae7e3f63 100644 --- a/Projectiles/Summon/SirenSongFriendly.cs +++ b/Projectiles/Summon/SirenSongFriendly.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -10,48 +11,48 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Song"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (projectile.localAI[0] == 0f) + Projectile.velocity.X *= 0.985f; + Projectile.velocity.Y *= 0.985f; + if (Projectile.localAI[0] == 0f) { - projectile.scale += 0.02f; - if (projectile.scale >= 1.25f) + Projectile.scale += 0.02f; + if (Projectile.scale >= 1.25f) { - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale -= 0.02f; - if (projectile.scale <= 0.75f) + Projectile.scale -= 0.02f; + if (Projectile.scale <= 0.75f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; Main.harpNote = soundPitch; - Main.PlaySound(SoundID.Item26, projectile.position); + SoundEngine.PlaySound(SoundID.Item26, Projectile.position); } - Lighting.AddLight(projectile.Center, 0f, 0f, 1.2f); + Lighting.AddLight(Projectile.Center, 0f, 0f, 1.2f); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Summon/SiriusBeam.cs b/Projectiles/Summon/SiriusBeam.cs index 9237b21737..d2e8acc5f1 100644 --- a/Projectiles/Summon/SiriusBeam.cs +++ b/Projectiles/Summon/SiriusBeam.cs @@ -13,33 +13,33 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.extraUpdates = 220; - projectile.timeLeft = 1000; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 110; - projectile.tileCollide = false; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.extraUpdates = 220; + Projectile.timeLeft = 1000; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 110; + Projectile.tileCollide = false; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 3f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 3f) { for (int num447 = 0; num447 < 4; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); + Projectile.alpha = 255; int num448 = Dust.NewDust(vector33, 1, 1, 20, 0f, 0f, 0, default, 1f); Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Summon { target.AddBuff(ModContent.BuffType(), 180); float x4 = Main.rgbToHsl(new Color(103, 203, Main.DiscoB)).X; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, x4, (float)projectile.whoAmI); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, x4, (float)Projectile.whoAmI); } } } diff --git a/Projectiles/Summon/SiriusExplosion.cs b/Projectiles/Summon/SiriusExplosion.cs index 57f5e5abfb..1f149f3579 100644 --- a/Projectiles/Summon/SiriusExplosion.cs +++ b/Projectiles/Summon/SiriusExplosion.cs @@ -13,63 +13,63 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 900; - projectile.minion = true; + Projectile.width = 14; + Projectile.height = 14; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 900; + Projectile.minion = true; } public override void AI() { - Color newColor2 = Main.hslToRgb(0.5f, 1f, projectile.ai[0]); - int num978 = (int)projectile.ai[1]; + Color newColor2 = Main.hslToRgb(0.5f, 1f, Projectile.ai[0]); + int num978 = (int)Projectile.ai[1]; if (num978 < 0 || num978 >= 1000 || (!Main.projectile[num978].active && Main.projectile[num978].type != ModContent.ProjectileType())) { - projectile.ai[1] = -1f; + Projectile.ai[1] = -1f; } else { DelegateMethods.v3_1 = newColor2.ToVector3() * 0.5f; - Utils.PlotTileLine(projectile.Center, Main.projectile[num978].Center, 8f, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Main.projectile[num978].Center, 8f, new Utils.PerLinePoint(DelegateMethods.CastLight)); } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = Main.rand.NextFloat() * 0.8f + 0.8f; - projectile.direction = (Main.rand.Next(2) > 0) ? 1 : -1; + Projectile.localAI[0] = Main.rand.NextFloat() * 0.8f + 0.8f; + Projectile.direction = (Main.rand.Next(2) > 0) ? 1 : -1; } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.alpha > 0) + Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; + if (Projectile.alpha > 0) { - projectile.alpha -= 8; + Projectile.alpha -= 8; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - Lighting.AddLight(projectile.Center, newColor2.ToVector3() * 0.5f); + Lighting.AddLight(Projectile.Center, newColor2.ToVector3() * 0.5f); } int num3; for (int num979 = 0; num979 < 2; num979 = num3 + 1) { if (Main.rand.NextBool(10)) { - Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust24 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust dust24 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; dust24.noGravity = true; dust24.noLight = true; - dust24.scale = projectile.Opacity * projectile.localAI[0]; - dust24.position = projectile.Center; + dust24.scale = Projectile.Opacity * Projectile.localAI[0]; + dust24.position = Projectile.Center; dust24.velocity = value55 * 2.5f; } num3 = num979; @@ -79,11 +79,11 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(10)) { Vector2 value56 = Vector2.UnitY.RotatedBy((double)((float)num980 * 3.14159274f), default); - Dust dust25 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + Dust dust25 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; dust25.noGravity = true; dust25.noLight = true; - dust25.scale = projectile.Opacity * projectile.localAI[0]; - dust25.position = projectile.Center; + dust25.scale = Projectile.Opacity * Projectile.localAI[0]; + dust25.position = Projectile.Center; dust25.velocity = value56 * 2.5f; } num3 = num980; @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Summon vector136.Normalize(); } vector136 *= 20f + Main.rand.NextFloat() * 100f; - Vector2 vector137 = projectile.Center + vector136; + Vector2 vector137 = Projectile.Center + vector136; Point point3 = vector137.ToTileCoordinates(); bool flag52 = true; if (!WorldGen.InWorld(point3.X, point3.Y, 0)) @@ -127,33 +127,33 @@ namespace CalamityMod.Projectiles.Summon dust27.color = new Color(255, 255, 255, 255); } } - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 60f) + Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; + Projectile.velocity = Vector2.Zero; + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] >= 60f) { - projectile.Kill(); + Projectile.Kill(); return; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Vector2 vector59 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = Main.projectileTexture[projectile.type]; - Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Color alpha5 = projectile.GetAlpha(color25); + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + Vector2 vector59 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D34 = Main.projectileTexture[Projectile.type]; + Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alpha5 = Projectile.GetAlpha(color25); Vector2 origin11 = rectangle17.Size() / 2f; - Color color60 = Main.hslToRgb(0.5f, 1f, projectile.ai[0]).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, projectile.rotation, origin11, projectile.scale * 2f, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, 0f, origin11, projectile.scale * 2f, SpriteEffects.None, 0f); - if (projectile.ai[1] != -1f && projectile.Opacity > 0.3f) + Color color60 = Main.hslToRgb(0.5f, 1f, Projectile.ai[0]).MultiplyRGBA(new Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, Projectile.rotation, origin11, Projectile.scale * 2f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, 0f, origin11, Projectile.scale * 2f, SpriteEffects.None, 0f); + if (Projectile.ai[1] != -1f && Projectile.Opacity > 0.3f) { - Vector2 vector61 = Main.projectile[(int)projectile.ai[1]].Center - projectile.Center; + Vector2 vector61 = Main.projectile[(int)Projectile.ai[1]].Center - Projectile.Center; Vector2 vector62 = new Vector2(1f, vector61.Length() / (float)texture2D34.Height); float rotation27 = vector61.ToRotation() + 1.57079637f; - float num279 = MathHelper.Distance(30f, projectile.localAI[1]) / 20f; + float num279 = MathHelper.Distance(30f, Projectile.localAI[1]) / 20f; num279 = MathHelper.Clamp(num279, 0f, 1f); if (num279 > 0f) { @@ -169,13 +169,13 @@ namespace CalamityMod.Projectiles.Summon Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); float num69 = (float)Main.rand.Next(7, 13); Vector2 value5 = new Vector2(2.1f, 2f); - Color newColor = Main.hslToRgb(0.5f, 1f, projectile.ai[0]); + Color newColor = Main.hslToRgb(0.5f, 1f, Projectile.ai[0]); newColor.A = 255; float num72; for (float num70 = 0f; num70 < num69; num70 = num72 + 1f) { - int num71 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num71].position = projectile.Center; + int num71 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[num71].position = Projectile.Center; Main.dust[num71].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num70 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[num71].noGravity = true; Main.dust[num71].scale = 2f; @@ -190,8 +190,8 @@ namespace CalamityMod.Projectiles.Summon } for (float num73 = 0f; num73 < num69; num73 = num72 + 1f) { - int num74 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num74].position = projectile.Center; + int num74 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[num74].position = Projectile.Center; Main.dust[num74].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num73 / num69), default) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); Dust dust = Main.dust[num74]; dust.velocity *= Main.rand.NextFloat() * 0.8f; @@ -206,31 +206,31 @@ namespace CalamityMod.Projectiles.Summon dust12.color = new Color(255, 255, 255, 255); num72 = num73; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - projectile.friendly = true; - int width = projectile.width; - int height2 = projectile.height; - int num75 = projectile.penetrate; - projectile.position = projectile.Center; - projectile.width = projectile.height = 60; - projectile.Center = projectile.position; - projectile.penetrate = -1; - projectile.maxPenetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - projectile.penetrate = num75; - projectile.position = projectile.Center; - projectile.width = width; - projectile.height = height2; - projectile.Center = projectile.position; + Projectile.friendly = true; + int width = Projectile.width; + int height2 = Projectile.height; + int num75 = Projectile.penetrate; + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 60; + Projectile.Center = Projectile.position; + Projectile.penetrate = -1; + Projectile.maxPenetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + Projectile.penetrate = num75; + Projectile.position = Projectile.Center; + Projectile.width = width; + Projectile.height = height2; + Projectile.Center = Projectile.position; } } public override Color? GetAlpha(Color lightColor) { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/SiriusMinion.cs b/Projectiles/Summon/SiriusMinion.cs index 608636d846..436512428b 100644 --- a/Projectiles/Summon/SiriusMinion.cs +++ b/Projectiles/Summon/SiriusMinion.cs @@ -12,31 +12,31 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Sirius"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 38; - projectile.height = 48; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 38; + Projectile.height = 48; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (correctMinion) { if (player.dead) @@ -45,69 +45,69 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.sirius) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } player.AddBuff(ModContent.BuffType(), 3600); - projectile.minionSlots = projectile.ai[0]; - Lighting.AddLight(projectile.Center, 1f, 0.5f, 5f); + Projectile.minionSlots = Projectile.ai[0]; + Lighting.AddLight(Projectile.Center, 1f, 0.5f, 5f); - projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { - projectile.position.Y += 120f; - projectile.rotation = MathHelper.Pi; + Projectile.position.Y += 120f; + Projectile.rotation = MathHelper.Pi; } else { - projectile.rotation = 0f; + Projectile.rotation = 0f; } - projectile.position.X = (int)projectile.position.X; - projectile.position.Y = (int)projectile.position.Y; + Projectile.position.X = (int)Projectile.position.X; + Projectile.position.Y = (int)Projectile.position.Y; float scalar = (float)Main.mouseTextColor / 200f - 0.35f; scalar *= 0.2f; - projectile.scale = scalar + 0.95f; + Projectile.scale = scalar + 0.95f; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { - int sirius = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 20, 0f, 0f, 0, default, 1f); + int sirius = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 20, 0f, 0f, 0, default, 1f); Main.dust[sirius].velocity *= 2f; Main.dust[sirius].scale *= 1.15f; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + Projectile.damage = damage2; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - if (projectile.ai[1] != 0f) + if (Projectile.ai[1] != 0f) { - projectile.ai[1] -= 1f; + Projectile.ai[1] -= 1f; return; } - Vector2 targetVec = projectile.position; + Vector2 targetVec = Projectile.position; float maxDistance = 7000f; bool hasTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDistance = (npc.width / 2) + (npc.height / 2); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) { targetVec = npc.Center; hasTarget = true; @@ -119,11 +119,11 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float extraDistance = (npc.width / 2) + (npc.height / 2); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) { targetVec = npc.Center; hasTarget = true; @@ -134,16 +134,16 @@ namespace CalamityMod.Projectiles.Summon if (hasTarget) { float projSpeed = 15f; - Vector2 source = new Vector2(projectile.Center.X - 4f, projectile.Center.Y); - Vector2 velocity = targetVec - projectile.Center; + Vector2 source = new Vector2(Projectile.Center.X - 4f, Projectile.Center.Y); + Vector2 velocity = targetVec - Projectile.Center; float targetDist = velocity.Length(); targetDist = projSpeed / targetDist; velocity.X *= targetDist; velocity.Y *= targetDist; - float damageMult = ((float)Math.Log(projectile.ai[0], MathHelper.E)) + 1f; - int beam = Projectile.NewProjectile(source, velocity, ModContent.ProjectileType(), (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner); - Main.projectile[beam].penetrate = (int)projectile.ai[0]; - projectile.ai[1] = 30f; + float damageMult = ((float)Math.Log(Projectile.ai[0], MathHelper.E)) + 1f; + int beam = Projectile.NewProjectile(source, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner); + Main.projectile[beam].penetrate = (int)Projectile.ai[0]; + Projectile.ai[1] = 30f; } } } diff --git a/Projectiles/Summon/SkeletalDragonChild.cs b/Projectiles/Summon/SkeletalDragonChild.cs index 675b973d63..cb3594b5f8 100644 --- a/Projectiles/Summon/SkeletalDragonChild.cs +++ b/Projectiles/Summon/SkeletalDragonChild.cs @@ -10,67 +10,67 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Child"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 52; - projectile.height = 48; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 7; - projectile.minionSlots = 0f; - projectile.extraUpdates = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 52; + Projectile.height = 48; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 7; + Projectile.minionSlots = 0f; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; - if (projectile.localAI[0] == 0f) + Player player = Main.player[Projectile.owner]; + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - if (projectile.ai[0] < 0 || projectile.ai[0] >= Main.projectile.Length) + if (Projectile.ai[0] < 0 || Projectile.ai[0] >= Main.projectile.Length) { - projectile.Kill(); + Projectile.Kill(); return; } - Projectile mother = Main.projectile[(int)projectile.ai[0]]; + Projectile mother = Main.projectile[(int)Projectile.ai[0]]; if (!mother.active || mother.type != ModContent.ProjectileType()) { - projectile.Kill(); + Projectile.Kill(); return; } - NPC target = projectile.Center.MinionHoming(SkeletalDragonMother.DistanceToCheck * 0.666f, player); + NPC target = Projectile.Center.MinionHoming(SkeletalDragonMother.DistanceToCheck * 0.666f, player); if (target != null) { - projectile.ai[1]++; - if (projectile.ai[1] % 55f == 54f && Main.myPlayer == projectile.owner) + Projectile.ai[1]++; + if (Projectile.ai[1] % 55f == 54f && Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(target.Center) * 19f, ModContent.ProjectileType(), mother.damage, mother.knockBack, mother.owner); + Projectile.NewProjectile(Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 19f, ModContent.ProjectileType(), mother.damage, mother.knockBack, mother.owner); } } @@ -79,58 +79,58 @@ namespace CalamityMod.Projectiles.Summon { if (target != null) { - if (projectile.Distance(mother.Center) > 620f) + if (Projectile.Distance(mother.Center) > 620f) { - projectile.velocity = (mother.Center - projectile.Center) / 45f; + Projectile.velocity = (mother.Center - Projectile.Center) / 45f; } else { - projectile.velocity = (projectile.velocity * 19f + projectile.SafeDirectionTo(mother.Center) * 18f) / 20f; + Projectile.velocity = (Projectile.velocity * 19f + Projectile.SafeDirectionTo(mother.Center) * 18f) / 20f; } } else { - if (projectile.Distance(mother.Center) > 250f) + if (Projectile.Distance(mother.Center) > 250f) { - projectile.velocity = (mother.Center - projectile.Center) / 28f; + Projectile.velocity = (mother.Center - Projectile.Center) / 28f; } else { - projectile.velocity += new Vector2(Math.Sign(mother.Center.X - projectile.Center.X), Math.Sign(mother.Center.Y - projectile.Center.Y)) * new Vector2(0.04f, 0.0225f); - if (projectile.velocity.Length() > 8f) + Projectile.velocity += new Vector2(Math.Sign(mother.Center.X - Projectile.Center.X), Math.Sign(mother.Center.Y - Projectile.Center.Y)) * new Vector2(0.04f, 0.0225f); + if (Projectile.velocity.Length() > 8f) { - projectile.velocity *= 8f / projectile.velocity.Length(); + Projectile.velocity *= 8f / Projectile.velocity.Length(); } } } } else { - if (projectile.Distance(mother.Center) > 250f) + if (Projectile.Distance(mother.Center) > 250f) { - projectile.velocity = (mother.Center - projectile.Center) / 28f; + Projectile.velocity = (mother.Center - Projectile.Center) / 28f; } else { - projectile.velocity += new Vector2(Math.Sign(mother.Center.X - projectile.Center.X), Math.Sign(mother.Center.Y - projectile.Center.Y)) * new Vector2(0.04f, 0.0225f); - if (projectile.velocity.Length() > 8f) + Projectile.velocity += new Vector2(Math.Sign(mother.Center.X - Projectile.Center.X), Math.Sign(mother.Center.Y - Projectile.Center.Y)) * new Vector2(0.04f, 0.0225f); + if (Projectile.velocity.Length() > 8f) { - projectile.velocity *= 8f / projectile.velocity.Length(); + Projectile.velocity *= 8f / Projectile.velocity.Length(); } } } - projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + Projectile.direction = Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } } } diff --git a/Projectiles/Summon/SkeletalDragonMother.cs b/Projectiles/Summon/SkeletalDragonMother.cs index 4828d11028..275041f870 100644 --- a/Projectiles/Summon/SkeletalDragonMother.cs +++ b/Projectiles/Summon/SkeletalDragonMother.cs @@ -12,51 +12,51 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Mother"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 92; - projectile.height = 78; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.minionSlots = 6f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 92; + Projectile.height = 78; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; + Projectile.minionSlots = 6f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 2; i++) { - Projectile.NewProjectile(projectile.Center + Utils.RandomVector2(Main.rand, -24f, 24f), - Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 4f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, player.whoAmI, projectile.whoAmI); + Projectile.NewProjectile(Projectile.Center + Utils.RandomVector2(Main.rand, -24f, 24f), + Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 4f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, player.whoAmI, Projectile.whoAmI); } - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) { @@ -66,81 +66,81 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.dragonFamily) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - NPC target = projectile.Center.MinionHoming(DistanceToCheck, player); + NPC target = Projectile.Center.MinionHoming(DistanceToCheck, player); if (target != null) { - projectile.extraUpdates = 1; - projectile.ai[0]++; + Projectile.extraUpdates = 1; + Projectile.ai[0]++; // Arc towards enemy every 60 frames for 30 frames. - float modulo = projectile.ai[0] % 150f; + float modulo = Projectile.ai[0] % 150f; if ((modulo < 30f) || (modulo >= 90 && modulo < 120f)) { - if (projectile.velocity.Length() == 0f) - projectile.velocity = projectile.SafeDirectionTo(target.Center).RotatedByRandom(0.5f) * -8f; - float angleToTarget = projectile.AngleTo(target.Center); - float velocityAngle = projectile.velocity.ToRotation(); + if (Projectile.velocity.Length() == 0f) + Projectile.velocity = Projectile.SafeDirectionTo(target.Center).RotatedByRandom(0.5f) * -8f; + float angleToTarget = Projectile.AngleTo(target.Center); + float velocityAngle = Projectile.velocity.ToRotation(); float resultantAngle = velocityAngle.AngleLerp(angleToTarget, 0.08f); - if (projectile.Distance(target.Center) > 70f) + if (Projectile.Distance(target.Center) > 70f) { - projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(resultantAngle); + Projectile.velocity = new Vector2(Projectile.velocity.Length(), 0f).RotatedBy(resultantAngle); } else { - projectile.velocity = (projectile.velocity * 44f + projectile.SafeDirectionTo(player.Center) * 24f) / 45f; - projectile.ai[0] += 30 - projectile.ai[0] % 30f; + Projectile.velocity = (Projectile.velocity * 44f + Projectile.SafeDirectionTo(player.Center) * 24f) / 45f; + Projectile.ai[0] += 30 - Projectile.ai[0] % 30f; } - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; } else { - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; } if ((modulo >= 30f && modulo <= 60f) || (modulo >= 90f && modulo <= 120f)) { - if (projectile.owner == player.whoAmI && projectile.spriteDirection == (projectile.SafeDirectionTo(target.Center).X > 0).ToDirectionInt()) + if (Projectile.owner == player.whoAmI && Projectile.spriteDirection == (Projectile.SafeDirectionTo(target.Center).X > 0).ToDirectionInt()) { - Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(target.Center) * 11.5f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 11.5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); } } } - else if (projectile.Distance(player.Center) > 175f) + else if (Projectile.Distance(player.Center) > 175f) { - projectile.extraUpdates = 0; - projectile.ai[1] = 0f; - projectile.velocity = (projectile.velocity * 24f + projectile.SafeDirectionTo(player.Center) * 16f) / 25f; - if (projectile.Distance(player.Center) > 3250f) + Projectile.extraUpdates = 0; + Projectile.ai[1] = 0f; + Projectile.velocity = (Projectile.velocity * 24f + Projectile.SafeDirectionTo(player.Center) * 16f) / 25f; + if (Projectile.Distance(player.Center) > 3250f) { - projectile.Center = player.Center; + Projectile.Center = player.Center; for (int i = 0; i < Main.projectile.Length; i++) { - if (Main.projectile[i].active && Main.projectile[i].owner == projectile.owner && + if (Main.projectile[i].active && Main.projectile[i].owner == Projectile.owner && Main.projectile[i].type == ModContent.ProjectileType()) { Main.projectile[i].Center = player.Center; Main.projectile[i].netUpdate = true; } } - projectile.netUpdate = true; + Projectile.netUpdate = true; } } - projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + Projectile.direction = Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } } } diff --git a/Projectiles/Summon/SlimePuppet.cs b/Projectiles/Summon/SlimePuppet.cs index b740bcb063..dc7314ceec 100644 --- a/Projectiles/Summon/SlimePuppet.cs +++ b/Projectiles/Summon/SlimePuppet.cs @@ -4,32 +4,33 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class SlimePuppet : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { DisplayName.SetDefault("Slime Puppet"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 1; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 1; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 60; - projectile.height = 60; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 0; - projectile.timeLeft = 300; - projectile.penetrate = 1; - projectile.minion = true; - projectile.tileCollide = false; + Projectile.width = 60; + Projectile.height = 60; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 0; + Projectile.timeLeft = 300; + Projectile.penetrate = 1; + Projectile.minion = true; + Projectile.tileCollide = false; } public override void AI() @@ -37,73 +38,73 @@ namespace CalamityMod.Projectiles.Summon ResetDamage(); // Prevent clumping of other slime puppets near this one. - projectile.MinionAntiClump(); + Projectile.MinionAntiClump(); - NPC potentialTarget = projectile.Center.MinionHoming(800f, Owner); + NPC potentialTarget = Projectile.Center.MinionHoming(800f, Owner); if (potentialTarget is null) { // Movement above the player, depending on the index of the projectile in the Main.projectile array. - float destinationAngularOffset = (float)Math.Sin(projectile.identity / 6f % 6f * MathHelper.Pi) * MathHelper.Pi / 10f; + float destinationAngularOffset = (float)Math.Sin(Projectile.identity / 6f % 6f * MathHelper.Pi) * MathHelper.Pi / 10f; Vector2 destination = Owner.Center - Vector2.UnitY.RotatedBy(destinationAngularOffset) * 160f; - if (projectile.DistanceSQ(destination) > 18f * 18f) - projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(destination) * 9f) / 21f; + if (Projectile.DistanceSQ(destination) > 18f * 18f) + Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(destination) * 9f) / 21f; } else { - float nudgedVelocityDirection = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(potentialTarget.Center), 0.078f); - projectile.velocity = nudgedVelocityDirection.ToRotationVector2() * MathHelper.Lerp(projectile.velocity.Length(), 16f, 0.25f); - if (projectile.WithinRange(potentialTarget.Center, 240f)) + float nudgedVelocityDirection = Projectile.velocity.ToRotation().AngleTowards(Projectile.AngleTo(potentialTarget.Center), 0.078f); + Projectile.velocity = nudgedVelocityDirection.ToRotationVector2() * MathHelper.Lerp(Projectile.velocity.Length(), 16f, 0.25f); + if (Projectile.WithinRange(potentialTarget.Center, 240f)) { - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(potentialTarget.Center) * 16f, 0.1f); - projectile.Center = projectile.Center.MoveTowards(potentialTarget.Center, 6f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(potentialTarget.Center) * 16f, 0.1f); + Projectile.Center = Projectile.Center.MoveTowards(potentialTarget.Center, 6f); } } - if (projectile.ai[0] > 0f) + if (Projectile.ai[0] > 0f) { - projectile.rotation += MathHelper.ToRadians(projectile.velocity.Length() / 4f) * Math.Sign(projectile.velocity.X); - projectile.ai[0]--; + Projectile.rotation += MathHelper.ToRadians(Projectile.velocity.Length() / 4f) * Math.Sign(Projectile.velocity.X); + Projectile.ai[0]--; } else if (potentialTarget != null) - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.rotation = Projectile.velocity.ToRotation(); - if (Vector2.Dot(projectile.oldVelocity.SafeNormalize(Vector2.Zero), projectile.velocity.SafeNormalize(Vector2.Zero)) < 0.87) - projectile.ai[0] = 50f; + if (Vector2.Dot(Projectile.oldVelocity.SafeNormalize(Vector2.Zero), Projectile.velocity.SafeNormalize(Vector2.Zero)) < 0.87) + Projectile.ai[0] = 50f; } public void ResetDamage() { // Initialize minion damage values the moment the projectile is spawned. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1f; } - if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - projectile.damage = trueDamage; + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); + Projectile.damage = trueDamage; } } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 100); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.NPCDeath1, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 100); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); if (!Main.dedServ) { for (int i = 0; i < 20; i++) { Vector2 spawnOffset = Main.rand.NextVector2Unit() * Main.rand.NextFloat(4f, 36f); - Dust slime = Dust.NewDustPerfect(projectile.Center + spawnOffset, 243); + Dust slime = Dust.NewDustPerfect(Projectile.Center + spawnOffset, 243); slime.velocity = spawnOffset.RotatedBy(MathHelper.PiOver2 * Main.rand.NextBool(2).ToDirectionInt()) * 0.16f; slime.scale = 1.2f; } @@ -114,7 +115,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } } diff --git a/Projectiles/Summon/SmallSkeletonMinion.cs b/Projectiles/Summon/SmallSkeletonMinion.cs index 2a4a64689d..af6a277030 100644 --- a/Projectiles/Summon/SmallSkeletonMinion.cs +++ b/Projectiles/Summon/SmallSkeletonMinion.cs @@ -15,25 +15,25 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Small Skeleton"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - Main.projFrames[projectile.type] = 7; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Projectile.type] = 7; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 34; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.aiStyle = aiType = -1; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = true; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 24; + Projectile.height = 34; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.aiStyle = aiType = -1; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = true; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void SendExtraAI(BinaryWriter writer) { @@ -45,41 +45,41 @@ namespace CalamityMod.Projectiles.Summon } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; Variant = Main.rand.Next(3); - projectile.netUpdate = true; - projectile.localAI[0] += 1f; + Projectile.netUpdate = true; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - projectile.frameCounter++; - if (projectile.frameCounter % 6f == 5f) + Projectile.frameCounter++; + if (Projectile.frameCounter % 6f == 5f) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame < 1) + if (Projectile.frame < 1) { - projectile.frame = 1; + Projectile.frame = 1; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 1; + Projectile.frame = 1; } - bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isCorrectProjectile) { @@ -89,82 +89,82 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.necrosteocytesDudes) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - NPC potentialTarget = projectile.Center.MinionHoming(900f, player); - if (projectile.velocity.Y == 0 && (HoleBelow() || (projectile.Distance(player.Center) > 205f && projectile.position.X == projectile.oldPosition.X))) + NPC potentialTarget = Projectile.Center.MinionHoming(900f, player); + if (Projectile.velocity.Y == 0 && (HoleBelow() || (Projectile.Distance(player.Center) > 205f && Projectile.position.X == Projectile.oldPosition.X))) { - projectile.velocity.Y = -10f; + Projectile.velocity.Y = -10f; } - else if (projectile.velocity.Y != 0f) + else if (Projectile.velocity.Y != 0f) { - projectile.frame = 2; + Projectile.frame = 2; } - if (projectile.velocity.Y > -16f) + if (Projectile.velocity.Y > -16f) { - projectile.velocity.Y += 0.3f; + Projectile.velocity.Y += 0.3f; } - projectile.ai[0]++; - if (projectile.ai[0] % 60f == 59f && Main.myPlayer == projectile.owner) + Projectile.ai[0]++; + if (Projectile.ai[0] % 60f == 59f && Main.myPlayer == Projectile.owner) { int type = Utils.SelectRandom(Main.rand, ModContent.ProjectileType(), ModContent.ProjectileType()); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, type, projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, type, Projectile.damage, Projectile.knockBack, Projectile.owner); } if (potentialTarget is null) { - if (Math.Abs(player.Center.X - projectile.Center.X + 40f * projectile.minionPos) > 160f) + if (Math.Abs(player.Center.X - Projectile.Center.X + 40f * Projectile.minionPos) > 160f) { - projectile.velocity.X += Main.rand.NextFloat(0.11f, 0.16f) * (player.Center.X - projectile.Center.X + 40f * projectile.minionPos > 0f).ToDirectionInt(); - projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -13f, 13f); + Projectile.velocity.X += Main.rand.NextFloat(0.11f, 0.16f) * (player.Center.X - Projectile.Center.X + 40f * Projectile.minionPos > 0f).ToDirectionInt(); + Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -13f, 13f); } else { - projectile.velocity.X *= 0.95f; + Projectile.velocity.X *= 0.95f; } - if (projectile.Distance(player.Center) <= 150f) + if (Projectile.Distance(player.Center) <= 150f) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.Distance(player.Center) > 1600f) + if (Projectile.Distance(player.Center) > 1600f) { - projectile.Center = player.Center; - projectile.netUpdate = true; + Projectile.Center = player.Center; + Projectile.netUpdate = true; } } else { - if (Math.Abs(potentialTarget.Center.X - projectile.Center.X + (int)MathHelper.Min(potentialTarget.width / 2, 40f)) > (int)MathHelper.Min(potentialTarget.width / 2, 40f)) + if (Math.Abs(potentialTarget.Center.X - Projectile.Center.X + (int)MathHelper.Min(potentialTarget.width / 2, 40f)) > (int)MathHelper.Min(potentialTarget.width / 2, 40f)) { - projectile.velocity.X += Main.rand.NextFloat(0.08f, 0.15f) * (potentialTarget.Center.X - projectile.Center.X > 0f).ToDirectionInt(); - projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -16f, 16f); + Projectile.velocity.X += Main.rand.NextFloat(0.08f, 0.15f) * (potentialTarget.Center.X - Projectile.Center.X > 0f).ToDirectionInt(); + Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -16f, 16f); } else { - projectile.velocity.X *= 0.95f; + Projectile.velocity.X *= 0.95f; } - if (projectile.Distance(player.Center) > 1400f) + if (Projectile.Distance(player.Center) > 1400f) { - projectile.Center = player.Center; - projectile.netUpdate = true; + Projectile.Center = player.Center; + Projectile.netUpdate = true; } - projectile.MinionAntiClump(0.075f); + Projectile.MinionAntiClump(0.075f); } - if (projectile.velocity.X > 0.25f) - projectile.spriteDirection = 1; - else if (projectile.velocity.X < -0.25f) - projectile.spriteDirection = -1; + if (Projectile.velocity.X > 0.25f) + Projectile.spriteDirection = 1; + else if (Projectile.velocity.X < -0.25f) + Projectile.spriteDirection = -1; } public bool HoleBelow() { int tileWidth = 4; - int tileX = (int)(projectile.Center.X / 16f) - tileWidth; - if (projectile.velocity.X > 0) + int tileX = (int)(Projectile.Center.X / 16f) - tileWidth; + if (Projectile.velocity.X > 0) { tileX += tileWidth; } - int tileY = (int)((projectile.position.Y + projectile.height) / 16f); + int tileY = (int)((Projectile.position.Y + Projectile.height) / 16f); for (int y = tileY; y < tileY + 2; y++) { for (int x = tileX; x < tileX + tileWidth; x++) @@ -179,14 +179,14 @@ namespace CalamityMod.Projectiles.Summon } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Rectangle frame = new Rectangle(Variant * projectile.width, projectile.frame * projectile.height, projectile.width, projectile.height); - SpriteEffects spriteEffects = (projectile.spriteDirection == 1) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.GetTexture(Texture), projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2f, 1f, spriteEffects, 0f); + Rectangle frame = new Rectangle(Variant * Projectile.width, Projectile.frame * Projectile.height, Projectile.width, Projectile.height); + SpriteEffects spriteEffects = (Projectile.spriteDirection == 1) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(ModContent.Request(Texture), Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2f, 1f, spriteEffects, 0f); return false; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { - fallThrough = projectile.Bottom.Y < Main.player[projectile.owner].Top.Y - 120f; + fallThrough = Projectile.Bottom.Y < Main.player[Projectile.owner].Top.Y - 120f; return base.TileCollideStyle(ref width, ref height, ref fallThrough); } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Summon/SolarBeam.cs b/Projectiles/Summon/SolarBeam.cs index 982e7df62f..4e3e5e0a0d 100644 --- a/Projectiles/Summon/SolarBeam.cs +++ b/Projectiles/Summon/SolarBeam.cs @@ -11,32 +11,32 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 48; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.extraUpdates = 220; - projectile.timeLeft = 200; + Projectile.width = 4; + Projectile.height = 4; + Projectile.aiStyle = 48; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = 1; + Projectile.extraUpdates = 220; + Projectile.timeLeft = 200; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 9f) { for (int num447 = 0; num447 < 4; num447++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * ((float)num447 * 0.25f); + Projectile.alpha = 255; int num448 = Dust.NewDust(vector33, 1, 1, 246, 0f, 0f, 0, default, 1f); Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; diff --git a/Projectiles/Summon/SolarGod.cs b/Projectiles/Summon/SolarGod.cs index f2f935691f..cb82ddbac9 100644 --- a/Projectiles/Summon/SolarGod.cs +++ b/Projectiles/Summon/SolarGod.cs @@ -11,31 +11,31 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Solar God"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 74; - projectile.height = 90; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 74; + Projectile.height = 90; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (correctMinion) { if (player.dead) @@ -44,62 +44,62 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.SPG) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { - projectile.position.Y += 120f; - projectile.rotation = MathHelper.Pi; + Projectile.position.Y += 120f; + Projectile.rotation = MathHelper.Pi; } else { - projectile.rotation = 0f; + Projectile.rotation = 0f; } - projectile.position.X = (int)projectile.position.X; - projectile.position.Y = (int)projectile.position.Y; + Projectile.position.X = (int)Projectile.position.X; + Projectile.position.Y = (int)Projectile.position.Y; float sizeScale = (float)Main.mouseTextColor / 200f - 0.35f; sizeScale *= 0.2f; - projectile.scale = sizeScale + 0.95f; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f); - if (projectile.localAI[0] == 0f) + Projectile.scale = sizeScale + 0.95f; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f); + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { - int fire = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 244, 0f, 0f, 0, default, 1f); + int fire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 244, 0f, 0f, 0, default, 1f); Main.dust[fire].velocity *= 2f; Main.dust[fire].scale *= 1.15f; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; return; } - Vector2 targetPos = projectile.position; + Vector2 targetPos = Projectile.position; float maxDistance = 700f; bool foundTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float npcDist = Vector2.Distance(projectile.Center, npc.Center); - if (npcDist < maxDistance && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float npcDist = Vector2.Distance(Projectile.Center, npc.Center); + if (npcDist < maxDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { targetPos = npc.Center; foundTarget = true; @@ -111,10 +111,10 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float npcDist = Vector2.Distance(projectile.Center, npc.Center); - if (npcDist < maxDistance && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float npcDist = Vector2.Distance(Projectile.Center, npc.Center); + if (npcDist < maxDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { maxDistance = npcDist; targetPos = npc.Center; @@ -126,12 +126,12 @@ namespace CalamityMod.Projectiles.Summon if (foundTarget) { float shootSpeed = 15f; - Vector2 source = projectile.Center; + Vector2 source = Projectile.Center; Vector2 velocity = targetPos - source; velocity.Normalize(); velocity *= shootSpeed; - Projectile.NewProjectile(source, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - projectile.ai[0] = 20f; + Projectile.NewProjectile(source, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.ai[0] = 20f; } } } diff --git a/Projectiles/Summon/SolarPixie.cs b/Projectiles/Summon/SolarPixie.cs index f5dfacf2fa..21c5575c56 100644 --- a/Projectiles/Summon/SolarPixie.cs +++ b/Projectiles/Summon/SolarPixie.cs @@ -11,31 +11,31 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Solar Pixie"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 50; + Projectile.height = 50; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (correctMinion) { if (player.dead) @@ -44,62 +44,62 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.SP) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { - projectile.position.Y += 120f; - projectile.rotation = MathHelper.Pi; + Projectile.position.Y += 120f; + Projectile.rotation = MathHelper.Pi; } else { - projectile.rotation = 0f; + Projectile.rotation = 0f; } - projectile.position.X = (int)projectile.position.X; - projectile.position.Y = (int)projectile.position.Y; + Projectile.position.X = (int)Projectile.position.X; + Projectile.position.Y = (int)Projectile.position.Y; float sizeScale = (float)Main.mouseTextColor / 200f - 0.35f; sizeScale *= 0.2f; - projectile.scale = sizeScale + 0.95f; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f); - if (projectile.localAI[0] == 0f) + Projectile.scale = sizeScale + 0.95f; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0f / 255f); + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 25; for (int d = 0; d < dustAmt; d++) { - int fire = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 244, 0f, 0f, 0, default, 1f); + int fire = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 244, 0f, 0f, 0, default, 1f); Main.dust[fire].velocity *= 2f; Main.dust[fire].scale *= 1.15f; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; return; } - Vector2 targetPos = projectile.position; + Vector2 targetPos = Projectile.position; float maxDistance = 700f; bool foundTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float npcDist = Vector2.Distance(projectile.Center, npc.Center); - if (npcDist < maxDistance && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float npcDist = Vector2.Distance(Projectile.Center, npc.Center); + if (npcDist < maxDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { targetPos = npc.Center; foundTarget = true; @@ -111,10 +111,10 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float npcDist = Vector2.Distance(projectile.Center, npc.Center); - if (npcDist < maxDistance && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float npcDist = Vector2.Distance(Projectile.Center, npc.Center); + if (npcDist < maxDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { maxDistance = npcDist; targetPos = npc.Center; @@ -126,14 +126,14 @@ namespace CalamityMod.Projectiles.Summon if (foundTarget) { float shootSpeed = 30f; - Vector2 source = projectile.Center; + Vector2 source = Projectile.Center; Vector2 velocity = targetPos - source; velocity.Normalize(); velocity *= shootSpeed; - int beam = Projectile.NewProjectile(source, velocity, ProjectileID.HeatRay, projectile.damage, projectile.knockBack, projectile.owner); + int beam = Projectile.NewProjectile(source, velocity, ProjectileID.HeatRay, Projectile.damage, Projectile.knockBack, Projectile.owner); if (beam.WithinBounds(Main.maxProjectiles)) Main.projectile[beam].Calamity().forceMinion = true; - projectile.ai[0] = 50f; + Projectile.ai[0] = 50f; } } } diff --git a/Projectiles/Summon/SonOfYharon.cs b/Projectiles/Summon/SonOfYharon.cs index fd50005f50..56dfd2ee50 100644 --- a/Projectiles/Summon/SonOfYharon.cs +++ b/Projectiles/Summon/SonOfYharon.cs @@ -6,39 +6,40 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class SonOfYharon : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float AttackTimer => ref projectile.ai[0]; - public ref float RamCountdown => ref projectile.ai[1]; - public ref float RamReboundCountdown => ref projectile.localAI[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float AttackTimer => ref Projectile.ai[0]; + public ref float RamCountdown => ref Projectile.ai[1]; + public ref float RamReboundCountdown => ref Projectile.localAI[1]; public const int FireballShootRate = 20; public override void SetStaticDefaults() { DisplayName.SetDefault("Draconid"); - Main.projFrames[projectile.type] = 10; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 10; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 100; - projectile.height = 100; - projectile.extraUpdates = 1; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = projectile.MaxUpdates * 9; - projectile.minionSlots = 5f; - projectile.timeLeft = 90000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; + Projectile.width = 100; + Projectile.height = 100; + Projectile.extraUpdates = 1; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 9; + Projectile.minionSlots = 5f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; } public override void SendExtraAI(BinaryWriter writer) @@ -53,60 +54,60 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) PerformInitialization(); - projectile.localAI[0]++; + Projectile.localAI[0]++; // Perform minion checks. PerformMinionChecks(); // Dynamically adjust damage if it changes. - if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - projectile.damage = trueDamage; + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); + Projectile.damage = trueDamage; } // Handle frame logic. - if (projectile.FinalExtraUpdate()) - projectile.frameCounter++; - if (projectile.frameCounter % 8 == 0) + if (Projectile.FinalExtraUpdate()) + Projectile.frameCounter++; + if (Projectile.frameCounter % 8 == 0) { - projectile.frame++; + Projectile.frame++; } if (RamCountdown > 0f || RamReboundCountdown > 0f) { - if (projectile.frame < 6) + if (Projectile.frame < 6) { - projectile.frame = 6; + Projectile.frame = 6; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 6; + Projectile.frame = 6; } } else { - if (projectile.frame >= 6) + if (Projectile.frame >= 6) { - projectile.frame = 0; + Projectile.frame = 0; } } - NPC potentialTarget = projectile.Center.MinionHoming(2000f, Owner); + NPC potentialTarget = Projectile.Center.MinionHoming(2000f, Owner); // Teleport to the player if extremely far away. - if (!projectile.WithinRange(Owner.Center, 4000f)) + if (!Projectile.WithinRange(Owner.Center, 4000f)) { - projectile.Center = Owner.Center + Main.rand.NextVector2Circular(16f, 16f); - projectile.netUpdate = true; + Projectile.Center = Owner.Center + Main.rand.NextVector2Circular(16f, 16f); + Projectile.netUpdate = true; return; } // Rebound for a bit after a ram. if (RamReboundCountdown > 0f) { - projectile.velocity *= 0.97f; + Projectile.velocity *= 0.97f; RamReboundCountdown--; return; } @@ -125,12 +126,12 @@ namespace CalamityMod.Projectiles.Summon public void PerformInitialization() { - projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 45; i++) { - Dust fire = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(55f, 55f), 244); + Dust fire = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(55f, 55f), 244); fire.velocity *= 2f; fire.scale *= 1.15f; } @@ -138,7 +139,7 @@ namespace CalamityMod.Projectiles.Summon public void PerformMinionChecks() { - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); Owner.AddBuff(ModContent.BuffType(), 3600); if (!correctMinion) return; @@ -147,27 +148,27 @@ namespace CalamityMod.Projectiles.Summon Owner.Calamity().aChicken = false; if (Owner.Calamity().aChicken) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } public void DoPlayerHoverMovement() { // Move away from other minions of the same type. - projectile.MinionAntiClump(0.1f); + Projectile.MinionAntiClump(0.1f); Vector2 hoverDestination = Owner.Top - Vector2.UnitY * 50f; - if (!projectile.WithinRange(hoverDestination, 60f)) - projectile.velocity = (projectile.velocity * 19f + projectile.SafeDirectionTo(hoverDestination) * 11f) / 20f; + if (!Projectile.WithinRange(hoverDestination, 60f)) + Projectile.velocity = (Projectile.velocity * 19f + Projectile.SafeDirectionTo(hoverDestination) * 11f) / 20f; // Adjust the sprite direction to point towards the hover destination. This does not happen if already really close // horizontally to the destination, to prevent direction changing spam. - if (MathHelper.Distance(projectile.Center.X, hoverDestination.X) > 45f) - projectile.spriteDirection = (projectile.Center.X - hoverDestination.X > 0).ToDirectionInt(); + if (MathHelper.Distance(Projectile.Center.X, hoverDestination.X) > 45f) + Projectile.spriteDirection = (Projectile.Center.X - hoverDestination.X > 0).ToDirectionInt(); } public void AttackTarget(NPC target) { - float distanceFromTarget = projectile.Distance(target.Center); + float distanceFromTarget = Projectile.Distance(target.Center); // Approach the target quickly if far enough away. // Movement becomes sharper the farther away from the target the minion is. @@ -175,23 +176,23 @@ namespace CalamityMod.Projectiles.Summon if (distanceFromTarget > 220f) { float interpolantToIdealVelocity = MathHelper.Lerp(0.05f, 0.3f, Utils.InverseLerp(300f, 560f, distanceFromTarget, true)); - Vector2 idealVelocity = projectile.SafeDirectionTo(target.Center) * MathHelper.Min(distanceFromTarget, 14f); - projectile.velocity = Vector2.Lerp(projectile.velocity, idealVelocity, interpolantToIdealVelocity); + Vector2 idealVelocity = Projectile.SafeDirectionTo(target.Center) * MathHelper.Min(distanceFromTarget, 14f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, interpolantToIdealVelocity); // Adjust the sprite direction to point towards the hover destination. - projectile.spriteDirection = (projectile.Center.X - target.Center.X > 0).ToDirectionInt(); + Projectile.spriteDirection = (Projectile.Center.X - target.Center.X > 0).ToDirectionInt(); // Periodically release fireballs at the target. // They move faster the farther away from the target the minion is. if (AttackTimer % FireballShootRate == FireballShootRate - 1f) { float shootSpeed = (distanceFromTarget - 220f) * 0.015f + 45f; - Main.PlaySound(SoundID.Item73, projectile.Center); - if (Main.myPlayer == projectile.owner) + SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); + if (Main.myPlayer == Projectile.owner) { - Vector2 shootPosition = projectile.Center + Vector2.UnitX * projectile.spriteDirection * 10f; - Vector2 shootVelocity = (target.Center - shootPosition).SafeNormalize(Vector2.UnitX * projectile.spriteDirection) * shootSpeed; - Projectile.NewProjectile(shootPosition, shootVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack * 0.5f, projectile.owner); + Vector2 shootPosition = Projectile.Center + Vector2.UnitX * Projectile.spriteDirection * 10f; + Vector2 shootVelocity = (target.Center - shootPosition).SafeNormalize(Vector2.UnitX * Projectile.spriteDirection) * shootSpeed; + Projectile.NewProjectile(shootPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.5f, Projectile.owner); } } } @@ -201,8 +202,8 @@ namespace CalamityMod.Projectiles.Summon { RamCountdown = 60f; - projectile.velocity = projectile.SafeDirectionTo(target.Center, -Vector2.UnitY) * 23f; - projectile.netUpdate = true; + Projectile.velocity = Projectile.SafeDirectionTo(target.Center, -Vector2.UnitY) * 23f; + Projectile.netUpdate = true; } } @@ -213,22 +214,22 @@ namespace CalamityMod.Projectiles.Summon { RamCountdown = 0f; RamReboundCountdown = 30f; - projectile.velocity *= -0.6f; + Projectile.velocity *= -0.6f; // Create an explosion of dust. for (int i = 0; i < 150; i++) { - Dust fire = Dust.NewDustPerfect(projectile.Center, 244); + Dust fire = Dust.NewDustPerfect(Projectile.Center, 244); fire.velocity = Main.rand.NextVector2Circular(20f, 20f); fire.scale *= 3f; fire.noGravity = true; - fire = Dust.NewDustPerfect(projectile.Center, 244); + fire = Dust.NewDustPerfect(Projectile.Center, 244); fire.velocity *= Main.rand.NextVector2Circular(8f, 8f); fire.scale *= 2f; } - projectile.netUpdate = true; + Projectile.netUpdate = true; } } @@ -239,15 +240,15 @@ namespace CalamityMod.Projectiles.Summon damage = (int)(damage * AngryChickenStaff.ReboundRamDamageFactor); } - public override bool CanDamage() => projectile.localAI[0] > 1f; + public override bool CanDamage() => Projectile.localAI[0] > 1f; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Rectangle(0, y6, texture2D13.Width, num214), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle(0, y6, texture2D13.Width, num214), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Summon/Spikecrag.cs b/Projectiles/Summon/Spikecrag.cs index 920a9c290e..aee95c3e1f 100644 --- a/Projectiles/Summon/Spikecrag.cs +++ b/Projectiles/Summon/Spikecrag.cs @@ -10,61 +10,61 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Spikecrag"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 70; - projectile.height = 42; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; + Projectile.width = 70; + Projectile.height = 42; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.sentry = true; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.penetrate = -1; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.velocity.Y += 0.5f; - if (projectile.velocity.Y > 10f) + Projectile.velocity.Y += 0.5f; + if (Projectile.velocity.Y > 10f) { - projectile.velocity.Y = 10f; + Projectile.velocity.Y = 10f; } - projectile.StickToTiles(false, false); + Projectile.StickToTiles(false, false); - if (projectile.ai[0] > 0f) + if (Projectile.ai[0] > 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; return; } @@ -73,11 +73,11 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].CanBeChasedBy(projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { float extraDistance = (float)(Main.npc[i].width / 2) + (Main.npc[i].height / 2); - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(projectile.Center, projectile.width, projectile.height, Main.npc[i].Center, Main.npc[i].width, Main.npc[i].height)) + if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(Projectile.Center, Projectile.width, Projectile.height, Main.npc[i].Center, Main.npc[i].width, Main.npc[i].height)) { homeIn = true; break; @@ -85,17 +85,17 @@ namespace CalamityMod.Projectiles.Summon } } - if (projectile.owner == Main.myPlayer && homeIn) + if (Projectile.owner == Main.myPlayer && homeIn) { - projectile.ai[1] += 1f; - if ((projectile.ai[1] % 10f) == 0f) + Projectile.ai[1] += 1f; + if ((Projectile.ai[1] % 10f) == 0f) { int amount = Main.rand.Next(5, 8); for (int i = 0; i < amount; i++) { float velocityX = Main.rand.NextFloat(-10f, 10f); float velocityY = Main.rand.NextFloat(-15f, -8f); - Projectile.NewProjectile(projectile.oldPosition.X + (projectile.width / 2), projectile.oldPosition.Y + (projectile.height / 2), velocityX, velocityY, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.oldPosition.X + (Projectile.width / 2), Projectile.oldPosition.Y + (Projectile.height / 2), velocityX, velocityY, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Summon/SpikecragSpike.cs b/Projectiles/Summon/SpikecragSpike.cs index 431048eb23..045b80a763 100644 --- a/Projectiles/Summon/SpikecragSpike.cs +++ b/Projectiles/Summon/SpikecragSpike.cs @@ -8,25 +8,25 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Spikecrag Spike"); - ProjectileID.Sets.SentryShot[projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.aiStyle = 1; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.aiStyle = 1; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.velocity.Y += 0.1f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Projectile.velocity.Y += 0.1f; } } } diff --git a/Projectiles/Summon/SquirrelSquireAcorn.cs b/Projectiles/Summon/SquirrelSquireAcorn.cs index d8dbfa6510..720cd2e49d 100644 --- a/Projectiles/Summon/SquirrelSquireAcorn.cs +++ b/Projectiles/Summon/SquirrelSquireAcorn.cs @@ -10,30 +10,30 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Acorn"); - ProjectileID.Sets.SentryShot[projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 16; - projectile.friendly = true; - projectile.minion = true; - projectile.penetrate = 2; - projectile.timeLeft = 180; - projectile.MaxUpdates = 2; + Projectile.width = 10; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 180; + Projectile.MaxUpdates = 2; } public override void AI() { - projectile.velocity.Y += Gravity; - projectile.rotation += (projectile.velocity.X > 0f).ToDirectionInt() * 0.3f; + Projectile.velocity.Y += Gravity; + Projectile.rotation += (Projectile.velocity.X > 0f).ToDirectionInt() * 0.3f; } public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 7, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 7, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Summon/SquirrelSquireMinion.cs b/Projectiles/Summon/SquirrelSquireMinion.cs index b86684a4af..3556c2fe97 100644 --- a/Projectiles/Summon/SquirrelSquireMinion.cs +++ b/Projectiles/Summon/SquirrelSquireMinion.cs @@ -7,95 +7,95 @@ namespace CalamityMod.Projectiles.Summon { public class SquirrelSquireMinion : ModProjectile { - public ref float AttackTimer => ref projectile.ai[1]; + public ref float AttackTimer => ref Projectile.ai[1]; public bool Attacking { - get => projectile.localAI[1] == 1f; - set => projectile.localAI[1] = value.ToInt(); + get => Projectile.localAI[1] == 1f; + set => Projectile.localAI[1] = value.ToInt(); } public bool OnSolidGround { get { bool groundSolid = false; - for (int i = (int)projectile.Left.X / 16 - 1; i < (int)projectile.Right.X / 16 + 1; i++) + for (int i = (int)Projectile.Left.X / 16 - 1; i < (int)Projectile.Right.X / 16 + 1; i++) { - bool bottomTileSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)projectile.Bottom.Y / 16).IsTileSolidGround(); - bool firstTileDownSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)projectile.Bottom.Y / 16 + 1).IsTileSolidGround(); - bool secondTileDownSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)projectile.Bottom.Y / 16 + 2).IsTileSolidGround(); + bool bottomTileSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)Projectile.Bottom.Y / 16).IsTileSolidGround(); + bool firstTileDownSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)Projectile.Bottom.Y / 16 + 1).IsTileSolidGround(); + bool secondTileDownSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)Projectile.Bottom.Y / 16 + 2).IsTileSolidGround(); groundSolid |= bottomTileSolid || firstTileDownSolid || secondTileDownSolid; } return groundSolid; } } - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { DisplayName.SetDefault("Squirrel Squire"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - Main.projFrames[projectile.type] = 16; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Projectile.type] = 16; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 64; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; - projectile.tileCollide = true; - projectile.minion = true; - projectile.sentry = true; + Projectile.width = 34; + Projectile.height = 64; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.penetrate = -1; + Projectile.tileCollide = true; + Projectile.minion = true; + Projectile.sentry = true; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { DoInitializationEffects(); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } // Re-adjust damage as needed. - if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - projectile.damage = trueDamage; + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); + Projectile.damage = trueDamage; } - projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.004f, -12f, 12f); - projectile.frameCounter++; + Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y + 0.004f, -12f, 12f); + Projectile.frameCounter++; Attacking = false; - NPC potentialTarget = projectile.Center.MinionHoming(800f, Owner, false); + NPC potentialTarget = Projectile.Center.MinionHoming(800f, Owner, false); if (potentialTarget is null) { if (OnSolidGround) { - if (projectile.frameCounter > 3) + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } else { - if (projectile.frameCounter > 5) + if (Projectile.frameCounter > 5) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame < 8 || projectile.frame > 11) + if (Projectile.frame < 8 || Projectile.frame > 11) { - projectile.frame = 9; + Projectile.frame = 9; } } } @@ -105,20 +105,20 @@ namespace CalamityMod.Projectiles.Summon AttackTarget(potentialTarget); } - projectile.rotation = 0f; - projectile.tileCollide = true; - projectile.StickToTiles(false, false); + Projectile.rotation = 0f; + Projectile.tileCollide = true; + Projectile.StickToTiles(false, false); } public void DoInitializationEffects() { - projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustQuantity = 36; for (int d = 0; d < dustQuantity; d++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, 7); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 7); dust.scale = 1.4f; dust.velocity = (MathHelper.TwoPi * d / dustQuantity).ToRotationVector2() * 4f; dust.noGravity = true; @@ -128,28 +128,28 @@ namespace CalamityMod.Projectiles.Summon public void AttackTarget(NPC target) { - float horizontalDistanceFromTarget = MathHelper.Distance(projectile.Center.X, target.Center.X); + float horizontalDistanceFromTarget = MathHelper.Distance(Projectile.Center.X, target.Center.X); AttackTimer++; // Pelt the target with acorns. if (!OnSolidGround) - projectile.frame = 12 + (int)(AttackTimer / 6.4) % 4; + Projectile.frame = 12 + (int)(AttackTimer / 6.4) % 4; else { - projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.2f, -12f, 12f); - projectile.frame = 4 + (int)(AttackTimer / 6.4) % 4; + Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y + 0.2f, -12f, 12f); + Projectile.frame = 4 + (int)(AttackTimer / 6.4) % 4; } - if (Main.myPlayer == projectile.owner && AttackTimer % 30f == 27f) + if (Main.myPlayer == Projectile.owner && AttackTimer % 30f == 27f) { - projectile.spriteDirection = (target.Center.X > projectile.Center.X).ToDirectionInt(); - Vector2 acornSpawnPosition = projectile.Center + new Vector2(projectile.spriteDirection * 6f, 10f); - float acornShootSpeed = MathHelper.Lerp(15f, 32f, projectile.Distance(target.Center) / 800f); + Projectile.spriteDirection = (target.Center.X > Projectile.Center.X).ToDirectionInt(); + Vector2 acornSpawnPosition = Projectile.Center + new Vector2(Projectile.spriteDirection * 6f, 10f); + float acornShootSpeed = MathHelper.Lerp(15f, 32f, Projectile.Distance(target.Center) / 800f); Vector2 acornShootVelocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(acornSpawnPosition, target.Top + target.velocity * 25f, SquirrelSquireAcorn.Gravity, acornShootSpeed); - if (projectile.WithinRange(target.Center, 200f)) + if (Projectile.WithinRange(target.Center, 200f)) acornShootVelocity = (target.Center - acornSpawnPosition).SafeNormalize(-Vector2.UnitY) * acornShootSpeed; - Projectile.NewProjectile(acornSpawnPosition, acornShootVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(acornSpawnPosition, acornShootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } @@ -159,7 +159,7 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - int index = Gore.NewGore(projectile.Center, Vector2.Zero, Main.rand.Next(61, 64), projectile.scale); + int index = Gore.NewGore(Projectile.Center, Vector2.Zero, Main.rand.Next(61, 64), Projectile.scale); Main.gore[index].velocity *= 0.1f; } } diff --git a/Projectiles/Summon/StormMarkSummon.cs b/Projectiles/Summon/StormMarkSummon.cs index 837269884e..2178bf1f1f 100644 --- a/Projectiles/Summon/StormMarkSummon.cs +++ b/Projectiles/Summon/StormMarkSummon.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class StormMarkSummon : ModProjectile @@ -17,26 +18,26 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.localNPCHitCooldown = 30; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 900; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.localNPCHitCooldown = 30; } public override void AI() { Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = -1; - Main.PlaySound(SoundID.Item60, projectile.position); + Projectile.soundDelay = -1; + SoundEngine.PlaySound(SoundID.Item60, Projectile.position); } - if (projectile.localAI[1] < 30f) + if (Projectile.localAI[1] < 30f) { for (int num1134 = 0; num1134 < 1; num1134++) { @@ -47,10 +48,10 @@ namespace CalamityMod.Projectiles.Summon value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); value81.X *= -1f; Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 16, 0f, 0f, 0, default, 0.5f)]; dust34.position = position4; - dust34.customData = projectile.Center + value82; + dust34.customData = Projectile.Center + value82; dust34.fadeIn = 1f; dust34.scale = 0.3f; if (value81.X > -1.2f) @@ -60,50 +61,50 @@ namespace CalamityMod.Projectiles.Summon dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; } } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + Projectile.localAI[0] = 0.8f; + Projectile.direction = 1; + Point point9 = Projectile.Center.ToTileCoordinates(); + Projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) + Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; + if (Projectile.localAI[1] < 33f) { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 8; + Projectile.alpha -= 8; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } } - if (projectile.localAI[1] > 103f) + if (Projectile.localAI[1] > 103f) { - if (projectile.alpha < 255) + if (Projectile.alpha < 255) { - projectile.alpha += 16; + Projectile.alpha += 16; } - if (projectile.alpha > 255) + if (Projectile.alpha > 255) { - projectile.alpha = 255; + Projectile.alpha = 255; } } - if (projectile.alpha == 0) + if (Projectile.alpha == 0) { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); } for (int num1135 = 0; num1135 < 2; num1135++) { if (Main.rand.NextBool(10)) { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); + Dust dust35 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; dust35.noGravity = true; dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; + dust35.scale = Projectile.Opacity * Projectile.localAI[0]; + dust35.position = Projectile.Center; dust35.velocity = value83 * 2.5f; } } @@ -112,50 +113,50 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(10)) { Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; + Dust dust36 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; dust36.noGravity = true; dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; + dust36.scale = Projectile.Opacity * Projectile.localAI[0]; + dust36.position = Projectile.Center; dust36.velocity = value84 * 2.5f; } } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + Projectile.velocity = Vector2.Zero; + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) { - int storm = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner, 1f, 0f); + int storm = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner, 1f, 0f); Main.projectile[storm].minion = true; - Main.projectile[storm].melee = false; + // Main.projectile[storm].melee = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; } - if (projectile.localAI[1] >= 120f) + if (Projectile.localAI[1] >= 120f) { - projectile.Kill(); + Projectile.Kill(); return; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Color alpha5 = projectile.GetAlpha(color25); + Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[Projectile.type]; + Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color alpha5 = Projectile.GetAlpha(color25); Vector2 origin7 = rectangle11.Size() / 2f; Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, Projectile.rotation, origin7, Projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Summon/StormjawBaby.cs b/Projectiles/Summon/StormjawBaby.cs index bd8c7240a2..1fb2065a59 100644 --- a/Projectiles/Summon/StormjawBaby.cs +++ b/Projectiles/Summon/StormjawBaby.cs @@ -14,29 +14,29 @@ namespace CalamityMod.Projectiles.Summon private int sparkCounter = 0; private int targetIndex = -1; private Vector2 idlePos = Vector2.Zero; - public Player player => Main.player[projectile.owner]; + public Player player => Main.player[Projectile.owner]; public override void SetStaticDefaults() { DisplayName.SetDefault("Stormjaw Baby"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - Main.projFrames[projectile.type] = 10; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + Main.projFrames[Projectile.type] = 10; } public override void SetDefaults() { - projectile.width = 56; - projectile.height = 38; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 56; + Projectile.height = 38; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Summon idlePos = player.Center; idlePos.X -= (15f + player.width / 2f) * player.direction; - idlePos.X -= projectile.minionPos * 40f * player.direction; + idlePos.X -= Projectile.minionPos * 40f * player.direction; FindTarget(); FlyBackToPlayer(); @@ -60,14 +60,14 @@ namespace CalamityMod.Projectiles.Summon // Handle stuff on spawn & variable damage if (dust == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { - Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 dustVel = source - projectile.Center; + Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 dustVel = source - Projectile.Center; int spark = Dust.NewDust(source + dustVel, 0, 0, 132, dustVel.X * 1.1f, dustVel.Y * 1.1f, 100, default, 1.4f); Main.dust[spark].noGravity = true; Main.dust[spark].noLight = true; @@ -79,14 +79,14 @@ namespace CalamityMod.Projectiles.Summon private void SummonChecks() { - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + Projectile.damage = damage2; } - bool projTypeCheck = projectile.type == ModContent.ProjectileType(); + bool projTypeCheck = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (projTypeCheck) { @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Summon } if (player.Calamity().stormjaw) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } } @@ -105,12 +105,12 @@ namespace CalamityMod.Projectiles.Summon { targetIndex = -1; float maxDistance = 800f; - if (projectile.ai[0] == 0f) //find target + if (Projectile.ai[0] == 0f) //find target { - NPC targetedNPC = projectile.OwnerMinionAttackTargetNPC; - if (targetedNPC != null && targetedNPC.CanBeChasedBy(projectile, false)) + NPC targetedNPC = Projectile.OwnerMinionAttackTargetNPC; + if (targetedNPC != null && targetedNPC.CanBeChasedBy(Projectile, false)) { - float num1 = (targetedNPC.Center - projectile.Center).Length(); + float num1 = (targetedNPC.Center - Projectile.Center).Length(); if (num1 < maxDistance) { targetIndex = targetedNPC.whoAmI; @@ -122,9 +122,9 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxNPCs; ++i) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float num1 = (npc.Center - projectile.Center).Length(); + float num1 = (npc.Center - Projectile.Center).Length(); if (num1 < maxDistance) { targetIndex = i; @@ -138,36 +138,36 @@ namespace CalamityMod.Projectiles.Summon private void FlyBackToPlayer() { - if (projectile.ai[0] == 1f) //returning to player + if (Projectile.ai[0] == 1f) //returning to player { - projectile.tileCollide = false; - Vector2 returnPos = player.Center - projectile.Center; + Projectile.tileCollide = false; + Vector2 returnPos = player.Center - Projectile.Center; returnPos.X -= (float) (40 * player.direction); - returnPos.X -= (float) (40 * projectile.minionPos * player.direction); + returnPos.X -= (float) (40 * Projectile.minionPos * player.direction); returnPos.Y -= 60f; float playerDist = returnPos.Length(); float returnSpeed = 12f; float acceleration = 0.4f; - if (returnSpeed < projectile.velocity.Length()) - returnSpeed = projectile.velocity.Length(); + if (returnSpeed < Projectile.velocity.Length()) + returnSpeed = Projectile.velocity.Length(); //if close enough to the player and has tile to stand on, return to normal - if (playerDist < 100f && player.velocity.Y == 0f && (projectile.Bottom.Y <= player.Bottom.Y && !Collision.SolidCollision(projectile.Center, projectile.width, projectile.height))) + if (playerDist < 100f && player.velocity.Y == 0f && (Projectile.Bottom.Y <= player.Bottom.Y && !Collision.SolidCollision(Projectile.Center, Projectile.width, Projectile.height))) { - projectile.ai[0] = 0f; - if (projectile.velocity.Y < -6f) - projectile.velocity.Y = -6f; + Projectile.ai[0] = 0f; + if (Projectile.velocity.Y < -6f) + Projectile.velocity.Y = -6f; } if (playerDist > 2000f) { - projectile.position = player.Center - projectile.Size / 2f; - projectile.netUpdate = true; + Projectile.position = player.Center - Projectile.Size / 2f; + Projectile.netUpdate = true; } if (playerDist < 50f) { - if (projectile.velocity.Length() > 2f) + if (Projectile.velocity.Length() > 2f) { - projectile.velocity *= 0.99f; + Projectile.velocity *= 0.99f; } acceleration = 0.01f; } @@ -184,112 +184,112 @@ namespace CalamityMod.Projectiles.Summon playerDist = returnSpeed / playerDist; returnPos *= playerDist; } - if (projectile.velocity.X < returnPos.X) + if (Projectile.velocity.X < returnPos.X) { - projectile.velocity.X += acceleration; - if (acceleration > 0.05f && projectile.velocity.X < 0f) + Projectile.velocity.X += acceleration; + if (acceleration > 0.05f && Projectile.velocity.X < 0f) { - projectile.velocity.X += acceleration; + Projectile.velocity.X += acceleration; } } - if (projectile.velocity.X > returnPos.X) + if (Projectile.velocity.X > returnPos.X) { - projectile.velocity.X -= acceleration; - if (acceleration > 0.05f && projectile.velocity.X > 0f) + Projectile.velocity.X -= acceleration; + if (acceleration > 0.05f && Projectile.velocity.X > 0f) { - projectile.velocity.X -= acceleration; + Projectile.velocity.X -= acceleration; } } - if (projectile.velocity.Y < returnPos.Y) + if (Projectile.velocity.Y < returnPos.Y) { - projectile.velocity.Y += acceleration; - if (acceleration > 0.05f && projectile.velocity.Y < 0f) + Projectile.velocity.Y += acceleration; + if (acceleration > 0.05f && Projectile.velocity.Y < 0f) { - projectile.velocity.Y += acceleration * 2f; + Projectile.velocity.Y += acceleration * 2f; } } - if (projectile.velocity.Y > returnPos.Y) + if (Projectile.velocity.Y > returnPos.Y) { - projectile.velocity.Y -= acceleration; - if (acceleration > 0.05f && projectile.velocity.Y > 0f) + Projectile.velocity.Y -= acceleration; + if (acceleration > 0.05f && Projectile.velocity.Y > 0f) { - projectile.velocity.Y -= acceleration * 2f; + Projectile.velocity.Y -= acceleration * 2f; } } - if (projectile.frame < 6 || projectile.frame > 9) + if (Projectile.frame < 6 || Projectile.frame > 9) { - projectile.frame = 6; + Projectile.frame = 6; } else { - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 10) + if (Projectile.frame >= 10) { - projectile.frame = 6; + Projectile.frame = 6; } } - if (projectile.velocity.X > 0.5f) - projectile.spriteDirection = 1; - else if (projectile.velocity.X < -0.5f) - projectile.spriteDirection = -1; - projectile.rotation = projectile.velocity.ToRotation() + projectile.spriteDirection != 1 ? MathHelper.Pi : 0f; + if (Projectile.velocity.X > 0.5f) + Projectile.spriteDirection = 1; + else if (Projectile.velocity.X < -0.5f) + Projectile.spriteDirection = -1; + Projectile.rotation = Projectile.velocity.ToRotation() + Projectile.spriteDirection != 1 ? MathHelper.Pi : 0f; } } private void AttackTarget() { - if (projectile.ai[0] == 2f) //attack target + if (Projectile.ai[0] == 2f) //attack target { - projectile.spriteDirection = -projectile.direction; - projectile.rotation = 0f; - if (projectile.velocity.Y == 0f) + Projectile.spriteDirection = -Projectile.direction; + Projectile.rotation = 0f; + if (Projectile.velocity.Y == 0f) { - if (projectile.velocity.X == 0f) + if (Projectile.velocity.X == 0f) { - projectile.frame = 0; - projectile.frameCounter = 0; + Projectile.frame = 0; + Projectile.frameCounter = 0; } - else if (Math.Abs(projectile.velocity.X) >= 0.5f) + else if (Math.Abs(Projectile.velocity.X) >= 0.5f) { - projectile.frameCounter += (int)Math.Abs(projectile.velocity.X); - projectile.frameCounter += 1; - if (projectile.frameCounter > 10) + Projectile.frameCounter += (int)Math.Abs(Projectile.velocity.X); + Projectile.frameCounter += 1; + if (Projectile.frameCounter > 10) { - projectile.frame += 1; - projectile.frameCounter = 0; + Projectile.frame += 1; + Projectile.frameCounter = 0; } - if (projectile.frame >= 6) - projectile.frame = 0; + if (Projectile.frame >= 6) + Projectile.frame = 0; } else { - projectile.frame = 0; - projectile.frameCounter = 0; + Projectile.frame = 0; + Projectile.frameCounter = 0; } } - else if (projectile.velocity.Y != 0f) + else if (Projectile.velocity.Y != 0f) { - projectile.frameCounter = 0; - projectile.frame = 0; + Projectile.frameCounter = 0; + Projectile.frame = 0; } - projectile.velocity.Y += 0.4f; - if (projectile.velocity.Y > 10f) - projectile.velocity.Y = 10f; + Projectile.velocity.Y += 0.4f; + if (Projectile.velocity.Y > 10f) + Projectile.velocity.Y = 10f; sparkCounter += Main.rand.Next(1,4); if (sparkCounter >= 20) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { for (int i = 0; i < Main.rand.Next(1,4); i++) { Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); - int spark = Projectile.NewProjectile(projectile.Center, sparkS, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + int spark = Projectile.NewProjectile(Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); if (spark.WithinBounds(Main.maxProjectiles)) { Main.projectile[spark].Calamity().forceMinion = true; @@ -304,22 +304,22 @@ namespace CalamityMod.Projectiles.Summon } } - projectile.ai[1] -= 1f; - if (projectile.ai[1] <= 0f) + Projectile.ai[1] -= 1f; + if (Projectile.ai[1] <= 0f) { - projectile.ai[1] = 0f; - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; return; } } else { - Rectangle rectangle = new Rectangle((int)(projectile.position.X + projectile.velocity.X * 0.5f - 4f), (int)(projectile.position.Y + projectile.velocity.Y * 0.5f - 4f), projectile.width + 8, projectile.height + 8); + Rectangle rectangle = new Rectangle((int)(Projectile.position.X + Projectile.velocity.X * 0.5f - 4f), (int)(Projectile.position.Y + Projectile.velocity.Y * 0.5f - 4f), Projectile.width + 8, Projectile.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false) && npc.immune[projectile.owner] <= 0) + if (npc.CanBeChasedBy(Projectile, false) && npc.immune[Projectile.owner] <= 0) { Rectangle rect = npc.getRect(); if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) @@ -327,12 +327,12 @@ namespace CalamityMod.Projectiles.Summon sparkCounter += Main.rand.Next(1,3); if (sparkCounter >= 20) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { for (int j = 0; j < Main.rand.Next(1,4); j++) { Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); - int spark = Projectile.NewProjectile(projectile.Center, sparkS, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + int spark = Projectile.NewProjectile(Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); if (spark.WithinBounds(Main.maxProjectiles)) { Main.projectile[spark].Calamity().forceMinion = true; @@ -358,41 +358,41 @@ namespace CalamityMod.Projectiles.Summon { float rangeofSight = 700f; float attackZone = 20f; - if (projectile.position.Y > Main.worldSurface * 16f) + if (Projectile.position.Y > Main.worldSurface * 16f) rangeofSight *= 0.7f; NPC npc = Main.npc[targetIndex]; - float targetDist = (npc.Center - projectile.Center).Length(); - Collision.CanHit(projectile.Center, projectile.width, projectile.height, npc.Center, npc.width, npc.height); + float targetDist = (npc.Center - Projectile.Center).Length(); + Collision.CanHit(Projectile.Center, Projectile.width, Projectile.height, npc.Center, npc.width, npc.height); if (targetDist < rangeofSight) { idlePos = npc.Center; - if (npc.Center.Y < projectile.Center.Y - 30f && projectile.velocity.Y == 0f) + if (npc.Center.Y < Projectile.Center.Y - 30f && Projectile.velocity.Y == 0f) { - float targetYDist = Math.Abs(npc.Center.Y - projectile.Center.Y); + float targetYDist = Math.Abs(npc.Center.Y - Projectile.Center.Y); if (targetYDist < 120f) - projectile.velocity.Y = -10f; + Projectile.velocity.Y = -10f; else if (targetYDist < 210f) - projectile.velocity.Y = -13f; + Projectile.velocity.Y = -13f; else if (targetYDist < 270f) - projectile.velocity.Y = -15f; + Projectile.velocity.Y = -15f; else if (targetYDist < 310f) - projectile.velocity.Y = -17f; + Projectile.velocity.Y = -17f; else if (targetYDist < 380f) - projectile.velocity.Y = -18f; + Projectile.velocity.Y = -18f; } } if (targetDist < attackZone) { - projectile.ai[0] = 2f; - projectile.ai[1] = 15f; - projectile.netUpdate = true; + Projectile.ai[0] = 2f; + Projectile.ai[1] = 15f; + Projectile.netUpdate = true; } } } private void IdleBehavior() { - if (projectile.ai[0] == 0f && targetIndex < 0) //passive AI + if (Projectile.ai[0] == 0f && targetIndex < 0) //passive AI { if (sparkCounter > 0) sparkCounter--; @@ -400,25 +400,25 @@ namespace CalamityMod.Projectiles.Summon sparkCounter = 0; float sepAnxietyDist = 500f; - Vector2 playerDist = player.Center - projectile.Center; + Vector2 playerDist = player.Center - Projectile.Center; // Teleport to the player if too far if (playerDist.Length() > 2000f) - projectile.position = player.Center - projectile.Size / 2f; + Projectile.position = player.Center - Projectile.Size / 2f; // Fly back if too far from the player else if (playerDist.Length() > sepAnxietyDist || Math.Abs(playerDist.Y) > 300f) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - if (projectile.velocity.Y > 0f && playerDist.Y < 0f) - projectile.velocity.Y = 0f; - if (projectile.velocity.Y < 0f && playerDist.Y > 0f) - projectile.velocity.Y = 0f; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; + if (Projectile.velocity.Y > 0f && playerDist.Y < 0f) + Projectile.velocity.Y = 0f; + if (Projectile.velocity.Y < 0f && playerDist.Y > 0f) + Projectile.velocity.Y = 0f; } } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - projectile.tileCollide = true; + Projectile.tileCollide = true; float accelFast = 0.5f; float maxSpeed = 4f; float xVel = 4f; @@ -430,149 +430,149 @@ namespace CalamityMod.Projectiles.Summon } int direction = 0; bool flag3 = false; - float idleDist = idlePos.X - projectile.Center.X; + float idleDist = idlePos.X - Projectile.Center.X; if (Math.Abs(idleDist) > 5f) { if (idleDist < 0f) { direction = -1; - if (projectile.velocity.X > -maxSpeed) + if (Projectile.velocity.X > -maxSpeed) { - projectile.velocity.X -= accelFast; + Projectile.velocity.X -= accelFast; } else { - projectile.velocity.X -= accelSlow; + Projectile.velocity.X -= accelSlow; } } else { direction = 1; - if (projectile.velocity.X < maxSpeed) + if (Projectile.velocity.X < maxSpeed) { - projectile.velocity.X += accelFast; + Projectile.velocity.X += accelFast; } else { - projectile.velocity.X += accelSlow; + Projectile.velocity.X += accelSlow; } } } else { - projectile.velocity.X *= 0.9f; - if (Math.Abs(projectile.velocity.X) < accelFast * 2f) - projectile.velocity.X = 0.0f; + Projectile.velocity.X *= 0.9f; + if (Math.Abs(Projectile.velocity.X) < accelFast * 2f) + Projectile.velocity.X = 0.0f; } if (direction != 0) { - int xPos = (int)projectile.Center.X / 16; - int yPos = (int)projectile.position.Y / 16; - int x = xPos + direction + (int) projectile.velocity.X; - for (int y = yPos; y < yPos + projectile.height / 16 + 1; ++y) + int xPos = (int)Projectile.Center.X / 16; + int yPos = (int)Projectile.position.Y / 16; + int x = xPos + direction + (int) Projectile.velocity.X; + for (int y = yPos; y < yPos + Projectile.height / 16 + 1; ++y) { if (WorldGen.SolidTile(x, y)) flag3 = true; } } - Collision.StepUp(ref projectile.position, ref projectile.velocity, projectile.width, projectile.height, ref projectile.stepSpeed, ref projectile.gfxOffY, 1, false, 0); - if (projectile.velocity.Y == 0f && flag3) + Collision.StepUp(ref Projectile.position, ref Projectile.velocity, Projectile.width, Projectile.height, ref Projectile.stepSpeed, ref Projectile.gfxOffY, 1, false, 0); + if (Projectile.velocity.Y == 0f && flag3) { for (int i = 0; i < 3; ++i) { - int x = (int)projectile.Center.X / 16; + int x = (int)Projectile.Center.X / 16; if (i == 0) - x = (int)projectile.Left.X / 16; + x = (int)Projectile.Left.X / 16; if (i == 2) - x = (int)projectile.Right.X / 16; - int y = (int)projectile.Bottom.Y / 16; + x = (int)Projectile.Right.X / 16; + int y = (int)Projectile.Bottom.Y / 16; Tile tile = Main.tile[x, y]; - if (WorldGen.SolidTile(x, y) || tile.halfBrick() || tile.slope() > 0 || TileID.Sets.Platforms[tile.type] && tile.active() && !tile.inActive()) + if (WorldGen.SolidTile(x, y) || tile.halfBrick() || tile.slope() > 0 || TileID.Sets.Platforms[tile.TileType] && tile.active() && !tile.inActive()) { try { - int xPos = (int)projectile.Center.X / 16; - int yPos = (int)projectile.Center.Y / 16; - int i2 = xPos + direction + (int)projectile.velocity.X; + int xPos = (int)Projectile.Center.X / 16; + int yPos = (int)Projectile.Center.Y / 16; + int i2 = xPos + direction + (int)Projectile.velocity.X; if (!WorldGen.SolidTile(i2, yPos - 1) && !WorldGen.SolidTile(i2, yPos - 2)) - projectile.velocity.Y = -5.1f; + Projectile.velocity.Y = -5.1f; else if (!WorldGen.SolidTile(i2, yPos - 2)) - projectile.velocity.Y = -7.1f; + Projectile.velocity.Y = -7.1f; else if (WorldGen.SolidTile(i2, yPos - 5)) - projectile.velocity.Y = -11.1f; + Projectile.velocity.Y = -11.1f; else if (WorldGen.SolidTile(i2, yPos - 4)) - projectile.velocity.Y = -10.1f; + Projectile.velocity.Y = -10.1f; else - projectile.velocity.Y = -9.1f; + Projectile.velocity.Y = -9.1f; } catch { - projectile.velocity.Y = -9.1f; + Projectile.velocity.Y = -9.1f; } } } } - if (projectile.velocity.X > xVel) - projectile.velocity.X = xVel; - if (projectile.velocity.X < -xVel) - projectile.velocity.X = -xVel; - if (projectile.velocity.X < 0f) - projectile.direction = -1; - if (projectile.velocity.X > 0f) - projectile.direction = 1; - if (projectile.velocity.X > accelFast && direction == 1) - projectile.direction = 1; - if (projectile.velocity.X < -accelFast && direction == -1) - projectile.direction = -1; - projectile.spriteDirection = -projectile.direction; - projectile.rotation = 0f; - if (projectile.velocity.Y == 0f) + if (Projectile.velocity.X > xVel) + Projectile.velocity.X = xVel; + if (Projectile.velocity.X < -xVel) + Projectile.velocity.X = -xVel; + if (Projectile.velocity.X < 0f) + Projectile.direction = -1; + if (Projectile.velocity.X > 0f) + Projectile.direction = 1; + if (Projectile.velocity.X > accelFast && direction == 1) + Projectile.direction = 1; + if (Projectile.velocity.X < -accelFast && direction == -1) + Projectile.direction = -1; + Projectile.spriteDirection = -Projectile.direction; + Projectile.rotation = 0f; + if (Projectile.velocity.Y == 0f) { - if (projectile.velocity.X == 0f) + if (Projectile.velocity.X == 0f) { - projectile.frame = 0; - projectile.frameCounter = 0; - float xDist = player.Center.X - projectile.Center.X; + Projectile.frame = 0; + Projectile.frameCounter = 0; + float xDist = player.Center.X - Projectile.Center.X; xDist -= 40f * player.direction; - xDist -= 40f * projectile.minionPos * player.direction; + xDist -= 40f * Projectile.minionPos * player.direction; if (xDist > 0) - projectile.spriteDirection = projectile.direction; + Projectile.spriteDirection = Projectile.direction; } - else if (Math.Abs(projectile.velocity.X) >= 0.5f) + else if (Math.Abs(Projectile.velocity.X) >= 0.5f) { - projectile.frameCounter += (int)Math.Abs(projectile.velocity.X); - projectile.frameCounter += 1; - if (projectile.frameCounter > 10) + Projectile.frameCounter += (int)Math.Abs(Projectile.velocity.X); + Projectile.frameCounter += 1; + if (Projectile.frameCounter > 10) { - projectile.frame += 1; - projectile.frameCounter = 0; + Projectile.frame += 1; + Projectile.frameCounter = 0; } - if (projectile.frame >= 6) - projectile.frame = 0; + if (Projectile.frame >= 6) + Projectile.frame = 0; } else { - projectile.frame = 0; - projectile.frameCounter = 0; + Projectile.frame = 0; + Projectile.frameCounter = 0; } } - else if (projectile.velocity.Y != 0f) + else if (Projectile.velocity.Y != 0f) { - projectile.frameCounter = 0; - projectile.frame = 0; + Projectile.frameCounter = 0; + Projectile.frame = 0; } - projectile.velocity.Y += 0.4f; - if (projectile.velocity.Y > 10f) - projectile.velocity.Y = 10f; + Projectile.velocity.Y += 0.4f; + if (Projectile.velocity.Y > 10f) + Projectile.velocity.Y = 10f; } } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { if (targetIndex < 0) - fallThrough = projectile.Bottom.Y < player.Top.Y; + fallThrough = Projectile.Bottom.Y < player.Top.Y; else - fallThrough = projectile.Bottom.Y < Main.npc[targetIndex].Top.Y; + fallThrough = Projectile.Bottom.Y < Main.npc[targetIndex].Top.Y; return true; } @@ -580,7 +580,7 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - int index = Gore.NewGore(projectile.Center, new Vector2(0f, 0f), Main.rand.Next(61, 64), projectile.scale); + int index = Gore.NewGore(Projectile.Center, new Vector2(0f, 0f), Main.rand.Next(61, 64), Projectile.scale); Main.gore[index].velocity *= 0.1f; } diff --git a/Projectiles/Summon/SummonAstralExplosion.cs b/Projectiles/Summon/SummonAstralExplosion.cs index 6367f246c9..0ae75ba937 100644 --- a/Projectiles/Summon/SummonAstralExplosion.cs +++ b/Projectiles/Summon/SummonAstralExplosion.cs @@ -8,28 +8,28 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 44; - projectile.height = 48; - projectile.friendly = true; - projectile.minion = true; - projectile.penetrate = 2; - projectile.timeLeft = Main.projFrames[projectile.type] * 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + Projectile.width = 44; + Projectile.height = 48; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.penetrate = 2; + Projectile.timeLeft = Main.projFrames[Projectile.type] * 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() { // Bluish cyan light - Lighting.AddLight(projectile.Center, 66f / 255f, 189f / 255f, 181f / 255f); - if (projectile.timeLeft % 5f == 4f) - projectile.frame++; + Lighting.AddLight(Projectile.Center, 66f / 255f, 189f / 255f, 181f / 255f); + if (Projectile.timeLeft % 5f == 4f) + Projectile.frame++; } } } diff --git a/Projectiles/Summon/SummonBrimstoneExplosion.cs b/Projectiles/Summon/SummonBrimstoneExplosion.cs index 12bcd894bc..0900fc0e11 100644 --- a/Projectiles/Summon/SummonBrimstoneExplosion.cs +++ b/Projectiles/Summon/SummonBrimstoneExplosion.cs @@ -11,34 +11,34 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = projectile.height = 160; - projectile.friendly = true; - projectile.hostile = true; - projectile.minion = true; - projectile.penetrate = -1; - projectile.timeLeft = Main.projFrames[projectile.type] * 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = Projectile.height = 160; + Projectile.friendly = true; + Projectile.hostile = true; + Projectile.minion = true; + Projectile.penetrate = -1; + Projectile.timeLeft = Main.projFrames[Projectile.type] * 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { CreateInitialDust(); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } // Emit crimson light. - Lighting.AddLight(projectile.Center, Color.Red.ToVector3() * 1.1f); - if (projectile.timeLeft % 5f == 4f) - projectile.frame++; + Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * 1.1f); + if (Projectile.timeLeft % 5f == 4f) + Projectile.frame++; } public void CreateInitialDust() @@ -52,15 +52,15 @@ namespace CalamityMod.Projectiles.Summon for (int j = 0; j < 30; j++) { Vector2 velocity = Main.rand.NextVector2Square(-randomnessSmoothness, randomnessSmoothness).SafeNormalize(Vector2.UnitY) * randomnessSmoothness * 0.48f; - Dust dust = Dust.NewDustDirect(projectile.Center, offsetVariance, offsetVariance, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.6f); + Dust dust = Dust.NewDustDirect(Projectile.Center, offsetVariance, offsetVariance, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.6f); dust.position += Main.rand.NextVector2Square(-10f, 10f); dust.velocity = velocity; dust.noGravity = true; } } - projectile.Damage(); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 48); + Projectile.Damage(); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 48); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs b/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs index 592d27ef65..c8d3b0438f 100644 --- a/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs +++ b/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs @@ -11,34 +11,34 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = projectile.height = 108; - projectile.friendly = true; - projectile.hostile = false; - projectile.minion = true; - projectile.penetrate = -1; - projectile.timeLeft = Main.projFrames[projectile.type] * 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = Projectile.height = 108; + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.minion = true; + Projectile.penetrate = -1; + Projectile.timeLeft = Main.projFrames[Projectile.type] * 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { CreateInitialDust(); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } // Emit crimson light. - Lighting.AddLight(projectile.Center, Color.Red.ToVector3() * 1.1f); - if (projectile.timeLeft % 5f == 4f) - projectile.frame++; + Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * 1.1f); + if (Projectile.timeLeft % 5f == 4f) + Projectile.frame++; } public void CreateInitialDust() @@ -51,14 +51,14 @@ namespace CalamityMod.Projectiles.Summon for (int j = 0; j < 30; j++) { Vector2 velocity = Main.rand.NextVector2Square(-randomnessSmoothness, randomnessSmoothness).SafeNormalize(Vector2.UnitY) * randomnessSmoothness * 0.48f; - Dust dust = Dust.NewDustDirect(projectile.position + Vector2.One * 22f, 1, 1, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.6f); + Dust dust = Dust.NewDustDirect(Projectile.position + Vector2.One * 22f, 1, 1, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.6f); dust.position += Main.rand.NextVector2Square(-10f, 10f); dust.velocity = velocity; dust.noGravity = true; } } - projectile.Damage(); + Projectile.Damage(); } } } diff --git a/Projectiles/Summon/TacticalPlagueJet.cs b/Projectiles/Summon/TacticalPlagueJet.cs index 480bfb6c90..ef80a8266e 100644 --- a/Projectiles/Summon/TacticalPlagueJet.cs +++ b/Projectiles/Summon/TacticalPlagueJet.cs @@ -16,24 +16,24 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Tactical Plague Jet"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 52; - projectile.height = 32; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; - projectile.extraUpdates = 1; + Projectile.width = 52; + Projectile.height = 32; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 1; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 1; } // Defines an Item which is a hacked clone of a P90, edited to be summon class instead of ranged. @@ -43,73 +43,73 @@ namespace CalamityMod.Projectiles.Summon int p90ID = ModContent.ItemType(); FalseGun = new Item(); FalseGun.SetDefaults(p90ID, true); - FalseGun.ranged = false; - FalseGun.summon = true; + // FalseGun.ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; + FalseGun.DamageType = DamageClass.Summon; } public override bool CanDamage() => false; public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); // Frame 1 spawning effects. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; // Spawn dust. for (int i = 0; i < 45; i++) { float angle = MathHelper.TwoPi / 45f * i; Vector2 velocity = angle.ToRotationVector2() * 4f; - Dust dust = Dust.NewDustPerfect(projectile.Center + velocity * 2f, (int)CalamityDusts.Plague, velocity); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velocity * 2f, (int)CalamityDusts.Plague, velocity); dust.noGravity = true; } // Construct a fake item to use with vanilla code for the sake of firing bullets. if (FalseGun is null) DefineFalseGun(); - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } // Animation handling. - if (projectile.frameCounter++ > 6f) + if (Projectile.frameCounter++ > 6f) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; // Correct for minion damage changes every single frame. - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } player.AddBuff(ModContent.BuffType(), 3600); - bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); if (isCorrectProjectile) { if (player.dead) modPlayer.plagueEngine = false; if (modPlayer.plagueEngine) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } // Pick a target and possibly fire at them. - NPC potentialTarget = projectile.Center.MinionHoming(1560f, player); + NPC potentialTarget = Projectile.Center.MinionHoming(1560f, player); // If the jet has no target or is out of ammo, passively fly around the player. if (potentialTarget is null || !player.HasAmmo(FalseGun, false)) { - float distanceToOwner = (player.Center - projectile.Center).Length(); + float distanceToOwner = (player.Center - Projectile.Center).Length(); float acceleration = 0.1f; // Reduce acceleration significantly if close to the player. @@ -121,56 +121,56 @@ namespace CalamityMod.Projectiles.Summon // Push away from the player constantly, but only if more than 100 pixels away. (What???) if (distanceToOwner > 100f) { - if (Math.Abs(player.Center.X - projectile.Center.X) > 20f) - projectile.velocity.X += acceleration * Math.Sign(player.Center.X - projectile.Center.X); - if (Math.Abs(player.Center.Y - projectile.Center.Y) > 10f) - projectile.velocity.Y += acceleration * Math.Sign(player.Center.Y - projectile.Center.Y); + if (Math.Abs(player.Center.X - Projectile.Center.X) > 20f) + Projectile.velocity.X += acceleration * Math.Sign(player.Center.X - Projectile.Center.X); + if (Math.Abs(player.Center.Y - Projectile.Center.Y) > 10f) + Projectile.velocity.Y += acceleration * Math.Sign(player.Center.Y - Projectile.Center.Y); } // If the jet is moving too fast, start giving it air friction. - else if (projectile.velocity.Length() > 4f) - projectile.velocity *= 0.95f; + else if (Projectile.velocity.Length() > 4f) + Projectile.velocity *= 0.95f; // The jet vertically sticks to the player. - if (Math.Abs(projectile.velocity.Y) < 2f) - projectile.velocity.Y += 0.1f * Math.Sign(player.Center.Y - projectile.Center.Y); + if (Math.Abs(Projectile.velocity.Y) < 2f) + Projectile.velocity.Y += 0.1f * Math.Sign(player.Center.Y - Projectile.Center.Y); // If the jet is moving WAY too fast, clamp its velocity. - if (projectile.velocity.Length() > 9f) - projectile.velocity = Vector2.Normalize(projectile.velocity) * 9f; + if (Projectile.velocity.Length() > 9f) + Projectile.velocity = Vector2.Normalize(Projectile.velocity) * 9f; // Change the sprite direction of the jet if it's moving more than a tiny bit in either direction. - if (projectile.velocity.X > 0.25f) - projectile.spriteDirection = 1; - else if (projectile.velocity.X < -0.25f) - projectile.spriteDirection = -1; + if (Projectile.velocity.X > 0.25f) + Projectile.spriteDirection = 1; + else if (Projectile.velocity.X < -0.25f) + Projectile.spriteDirection = -1; // Angle the jet as it moves. - projectile.rotation = projectile.rotation.AngleTowards(0f, 0.2f); + Projectile.rotation = Projectile.rotation.AngleTowards(0f, 0.2f); // If the jet is absurdly far away, teleport directly onto the player. if (distanceToOwner > 2700f) { - projectile.Center = player.Center; - projectile.netUpdate = true; + Projectile.Center = player.Center; + Projectile.netUpdate = true; } } // The jet has ammo and has a target. Open fire. else { - projectile.spriteDirection = 1; - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(potentialTarget.Center - Vector2.UnitY * 195f) * 17f, 0.035f); - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(potentialTarget.Center), 0.1f); + Projectile.spriteDirection = 1; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(potentialTarget.Center - Vector2.UnitY * 195f) * 17f, 0.035f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(potentialTarget.Center), 0.1f); - if (projectile.ai[0]++ % 75f == 24f) + if (Projectile.ai[0]++ % 75f == 24f) { 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; + 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; @@ -183,12 +183,12 @@ namespace CalamityMod.Projectiles.Summon { int rocketDamage = (int)(damage * 1.5f); float rocketKB = kb + 5f; - projIndex = Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(potentialTarget.Center) * 18f, ModContent.ProjectileType(), rocketDamage, rocketKB, projectile.owner); + projIndex = Projectile.NewProjectile(Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center) * 18f, ModContent.ProjectileType(), rocketDamage, rocketKB, Projectile.owner); } // Fire the selected bullet, nothing special. else - projIndex = Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(potentialTarget.Center) * shootSpeed, projID, damage, kb, projectile.owner); + projIndex = Projectile.NewProjectile(Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center) * shootSpeed, projID, damage, kb, Projectile.owner); // Regardless of what was fired, force it to be a summon projectile so that summon accessories work. if (projIndex.WithinBounds(Main.maxProjectiles)) @@ -196,7 +196,7 @@ namespace CalamityMod.Projectiles.Summon } // Prevent minion clumping while firing. - projectile.MinionAntiClump(0.25f); + Projectile.MinionAntiClump(0.25f); } } } diff --git a/Projectiles/Summon/TundraFlameBlossom.cs b/Projectiles/Summon/TundraFlameBlossom.cs index cf1a25a257..c943336167 100644 --- a/Projectiles/Summon/TundraFlameBlossom.cs +++ b/Projectiles/Summon/TundraFlameBlossom.cs @@ -12,29 +12,29 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Frost Blossom"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.coldDamage = true; + Projectile.width = Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; + Projectile.coldDamage = true; } public override void AI() { - bool isCorrectMinion = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool isCorrectMinion = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); if (isCorrectMinion) @@ -45,54 +45,54 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.tundraFlameBlossom) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.Center = player.Center + (projectile.ai[1] / 32f).ToRotationVector2() * 95f; - projectile.scale = 1f + (float)Math.Sin(projectile.ai[1] / 40f) * 0.085f; - projectile.Opacity = 1f - (float)Math.Sin(projectile.ai[1] / 45f) * 0.1f - 0.1f; // Range of 1f to 0.8f - projectile.rotation += MathHelper.ToRadians(5f); - if (projectile.localAI[0] == 0f) + Projectile.Center = player.Center + (Projectile.ai[1] / 32f).ToRotationVector2() * 95f; + Projectile.scale = 1f + (float)Math.Sin(Projectile.ai[1] / 40f) * 0.085f; + Projectile.Opacity = 1f - (float)Math.Sin(Projectile.ai[1] / 45f) * 0.1f - 0.1f; // Range of 1f to 0.8f + Projectile.rotation += MathHelper.ToRadians(5f); + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 36; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, 179); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 179); dust.noGravity = true; dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2f, 7f); } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } int fireRate = 130; float fireSpeed = 6f; - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - NPC potentialTarget = projectile.Center.MinionHoming(850f, player); + NPC potentialTarget = Projectile.Center.MinionHoming(850f, player); if (potentialTarget != null) { fireRate = 42; fireSpeed = 14f; - projectile.ai[0] = MathHelper.Lerp(projectile.ai[0], projectile.AngleTo(potentialTarget.Center) + MathHelper.PiOver2, 0.1f); + Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], Projectile.AngleTo(potentialTarget.Center) + MathHelper.PiOver2, 0.1f); } - else projectile.ai[0] = MathHelper.Lerp(projectile.ai[0], 0f, 0.1f); + else Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], 0f, 0.1f); } - if (projectile.ai[1]++ % fireRate == fireRate - 1) + if (Projectile.ai[1]++ % fireRate == fireRate - 1) { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - int count = projectile.ai[1] % (2 * fireRate) == (2 * fireRate - 1) ? 4 : 3; + int count = Projectile.ai[1] % (2 * fireRate) == (2 * fireRate - 1) ? 4 : 3; for (int i = 0; i < count; i++) { - Projectile.NewProjectile(projectile.Center, -Vector2.UnitY.RotatedBy(MathHelper.TwoPi / count * i + projectile.ai[0]) * fireSpeed, - ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(Projectile.Center, -Vector2.UnitY.RotatedBy(MathHelper.TwoPi / count * i + Projectile.ai[0]) * fireSpeed, + ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Summon/TundraFlameBlossomsOrb.cs b/Projectiles/Summon/TundraFlameBlossomsOrb.cs index d171d9dbc0..598829d616 100644 --- a/Projectiles/Summon/TundraFlameBlossomsOrb.cs +++ b/Projectiles/Summon/TundraFlameBlossomsOrb.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class TundraFlameBlossomsOrb : ModProjectile @@ -10,35 +11,35 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Blossom Orb"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.minionSlots = 0f; - projectile.minion = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.minionSlots = 0f; + Projectile.minion = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.White.ToVector3()); - projectile.rotation += MathHelper.ToRadians(projectile.velocity.X); + Lighting.AddLight(Projectile.Center, Color.White.ToVector3()); + Projectile.rotation += MathHelper.ToRadians(Projectile.velocity.X); // Arc around after a bit of time. - if (projectile.timeLeft > 110f && projectile.timeLeft < 150f) + if (Projectile.timeLeft > 110f && Projectile.timeLeft < 150f) { - projectile.velocity = projectile.velocity.RotatedBy(MathHelper.PiOver2 / 40f); + Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.PiOver2 / 40f); } - if (projectile.timeLeft < 60f) + if (Projectile.timeLeft < 60f) { - projectile.alpha = (int)MathHelper.Lerp(0f, 255f, 1f - projectile.timeLeft / 60f); + Projectile.alpha = (int)MathHelper.Lerp(0f, 255f, 1f - Projectile.timeLeft / 60f); } } @@ -46,16 +47,16 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Grass, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Grass, (int)Projectile.position.X, (int)Projectile.position.Y); for (int k = 0; k < 10; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 179, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 179, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Summon/UniverseSplitterField.cs b/Projectiles/Summon/UniverseSplitterField.cs index 2715b0c256..8e354b7811 100644 --- a/Projectiles/Summon/UniverseSplitterField.cs +++ b/Projectiles/Summon/UniverseSplitterField.cs @@ -4,6 +4,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class UniverseSplitterField : ModProjectile @@ -12,8 +13,8 @@ namespace CalamityMod.Projectiles.Summon public float Timer { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public float DustRadius = 0f; public const float DustChargeTime = 30f; @@ -27,18 +28,18 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Field"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 200; - projectile.alpha = 255; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.timeLeft = TimeLeft; + Projectile.width = Projectile.height = 200; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.ignoreWater = true; + Projectile.timeLeft = TimeLeft; } public override void SendExtraAI(BinaryWriter writer) @@ -74,7 +75,7 @@ namespace CalamityMod.Projectiles.Summon // Generate a dust ring that pulsates for (int i = 0; i < 80; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + (i / 80f * MathHelper.TwoPi).ToRotationVector2() * DustRadius, 247); + Dust dust = Dust.NewDustPerfect(Projectile.Center + (i / 80f * MathHelper.TwoPi).ToRotationVector2() * DustRadius, 247); dust.velocity = Vector2.Zero; dust.scale = 1.2f; dust.noGravity = true; @@ -87,7 +88,7 @@ namespace CalamityMod.Projectiles.Summon { for (int j = 0; j < SpiralRings; j++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + + Dust dust = Dust.NewDustPerfect(Projectile.Center + Vector2.UnitY.RotatedBy(Timer / SpiralPrecision * direction).RotatedBy(j / (float)SpiralRings * MathHelper.TwoPi).RotatedBy(i / (float)SpiralPrecision * MathHelper.TwoPi / SpiralRings * direction) * DustRadius * i / SpiralPrecision, 261); dust.velocity = Vector2.Zero; @@ -101,7 +102,7 @@ namespace CalamityMod.Projectiles.Summon bool firingGiantLaserBeam = Timer > TimeLeft - UniverseSplitterHugeBeam.TimeLeft; for (int i = 0; i < (firingGiantLaserBeam ? 30 : 16); i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, 247); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 247); dust.velocity = Main.rand.NextVector2Circular(8f, 8f) * (firingGiantLaserBeam ? 1.6f : 1f); dust.noGravity = true; dust.scale = 1.25f; @@ -113,10 +114,10 @@ namespace CalamityMod.Projectiles.Summon float outwardCircleRadius = MathHelper.Lerp(0f, DustRadius * 1.2f, MathHelper.Clamp((Timer - (TimeLeft - UniverseSplitterHugeBeam.TimeLeft - 120f)) / 40f, 0f, 1f)); for (int i = 0; i < 95; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + (i / 95f * MathHelper.TwoPi).ToRotationVector2() * outwardCircleRadius, 247); + Dust dust = Dust.NewDustPerfect(Projectile.Center + (i / 95f * MathHelper.TwoPi).ToRotationVector2() * outwardCircleRadius, 247); dust.scale = 1.2f; dust.noGravity = true; - dust.velocity = Main.rand.NextBool(7) ? projectile.DirectionFrom(dust.position) * 6f : Vector2.Zero; + dust.velocity = Main.rand.NextBool(7) ? Projectile.DirectionFrom(dust.position) * 6f : Vector2.Zero; } } } @@ -128,29 +129,29 @@ namespace CalamityMod.Projectiles.Summon Timer < TimeLeft - UniverseSplitterHugeBeam.TimeLeft && Timer % 60f == 0f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"), projectile.Center); - if (Main.myPlayer == projectile.owner) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"), Projectile.Center); + if (Main.myPlayer == Projectile.owner) { Vector2 offset = new Vector2(Main.rand.NextFloat(-800f, 800f), -1460f); - Projectile.NewProjectile(projectile.Center + offset, + Projectile.NewProjectile(Projectile.Center + offset, -Vector2.Normalize(offset), ModContent.ProjectileType(), - projectile.damage, - projectile.knockBack, - projectile.owner, + Projectile.damage, + Projectile.knockBack, + Projectile.owner, (-Vector2.Normalize(offset)).ToRotation()); } } // Summon a giant beam - if (Timer == TimeLeft - UniverseSplitterHugeBeam.TimeLeft && Main.myPlayer == projectile.owner) + if (Timer == TimeLeft - UniverseSplitterHugeBeam.TimeLeft && Main.myPlayer == Projectile.owner) { - Main.PlaySound(SoundID.Zombie, projectile.Center, 104); - Projectile.NewProjectile(projectile.Center + Vector2.UnitY * -UniverseSplitterHugeBeam.MaximumLength / 2f, + SoundEngine.PlaySound(SoundID.Zombie, Projectile.Center, 104); + Projectile.NewProjectile(Projectile.Center + Vector2.UnitY * -UniverseSplitterHugeBeam.MaximumLength / 2f, Vector2.UnitY, ModContent.ProjectileType(), - projectile.damage, - projectile.knockBack, - projectile.owner, + Projectile.damage, + Projectile.knockBack, + Projectile.owner, 0f); } } diff --git a/Projectiles/Summon/UniverseSplitterHugeBeam.cs b/Projectiles/Summon/UniverseSplitterHugeBeam.cs index c471fd8371..9dd85ee5da 100644 --- a/Projectiles/Summon/UniverseSplitterHugeBeam.cs +++ b/Projectiles/Summon/UniverseSplitterHugeBeam.cs @@ -7,6 +7,7 @@ using Terraria.Enums; using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; using Terraria.GameContent.Events; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -26,15 +27,15 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.minion = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = TimeLeft; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = TimeLeft; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } // Netcode for sending and receiving shit @@ -42,40 +43,40 @@ namespace CalamityMod.Projectiles.Summon public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - projectile.velocity = (projectile.velocity.ToRotation() + projectile.ai[0]).ToRotationVector2(); - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.velocity = (Projectile.velocity.ToRotation() + Projectile.ai[0]).ToRotationVector2(); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - projectile.localAI[0]++; + Projectile.localAI[0]++; // Fadein/out. The timeleft varies, so this must be done manually. - if (projectile.localAI[0] < TotalFadeoutTime) + if (Projectile.localAI[0] < TotalFadeoutTime) { - projectile.scale = MathHelper.Lerp(0.01f, LaserSize, projectile.localAI[0] / TotalFadeoutTime); + Projectile.scale = MathHelper.Lerp(0.01f, LaserSize, Projectile.localAI[0] / TotalFadeoutTime); } - if (projectile.timeLeft < TotalFadeoutTime) + if (Projectile.timeLeft < TotalFadeoutTime) { - projectile.scale = MathHelper.Lerp(LaserSize, 0f, 1f - (projectile.timeLeft / (float)TotalFadeoutTime)); + Projectile.scale = MathHelper.Lerp(LaserSize, 0f, 1f - (Projectile.timeLeft / (float)TotalFadeoutTime)); } - Vector2 samplingPoint = projectile.Top; + Vector2 samplingPoint = Projectile.Top; float[] samples = new float[12]; float determinedLength = 0f; - Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, MaximumLength, samples); + Collision.LaserScan(samplingPoint, Projectile.velocity, Projectile.width * Projectile.scale, MaximumLength, samples); for (int i = 0; i < samples.Length; i++) { determinedLength += samples[i]; @@ -85,17 +86,17 @@ namespace CalamityMod.Projectiles.Summon determinedLength = MathHelper.Clamp(determinedLength, MaximumLength * 0.3f, MaximumLength); float lerpDelta = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], determinedLength - 20f, lerpDelta); - if (projectile.localAI[0] < 30f) + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], determinedLength - 20f, lerpDelta); + if (Projectile.localAI[0] < 30f) { - projectile.localAI[1] = MathHelper.Lerp(72f, projectile.localAI[1], projectile.localAI[0] / 30f); + Projectile.localAI[1] = MathHelper.Lerp(72f, Projectile.localAI[1], Projectile.localAI[0] / 30f); } - Vector2 beamEndPosition = projectile.Center + projectile.velocity * (projectile.localAI[1] - 6f); - if (projectile.localAI[0] >= 30f && - projectile.localAI[0] <= 35f) + Vector2 beamEndPosition = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 6f); + if (Projectile.localAI[0] >= 30f && + Projectile.localAI[0] <= 35f) { - if (projectile.localAI[0] == 30f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), projectile.Center); + if (Projectile.localAI[0] == 30f) + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), Projectile.Center); for (int i = 0; i < 75; i++) { Dust dust = Dust.NewDustPerfect(beamEndPosition, 269); @@ -111,50 +112,50 @@ namespace CalamityMod.Projectiles.Summon } } - if (projectile.localAI[0] > TimeLeft - 50f) + if (Projectile.localAI[0] > TimeLeft - 50f) { float light = 1f; - if (projectile.localAI[0] < TimeLeft - 30f) + if (Projectile.localAI[0] < TimeLeft - 30f) { - light = MathHelper.Lerp(0f, 1f, (projectile.localAI[0] - (TimeLeft - 30f)) / 30f); + light = MathHelper.Lerp(0f, 1f, (Projectile.localAI[0] - (TimeLeft - 30f)) / 30f); } MoonlordDeathDrama.RequestLight(light, beamEndPosition); } // Draw acid green light across the laser DelegateMethods.v3_1 = new Vector3(0.62f, 0.94f, 0.38f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) { return false; } - Texture2D laserTailTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UniverseSplitterHugeBeamEnd"); - Texture2D laserBodyTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UniverseSplitterHugeBeamMid"); - float laserLength = projectile.localAI[1]; + Texture2D laserTailTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/UniverseSplitterHugeBeamEnd"); + Texture2D laserBodyTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/UniverseSplitterHugeBeamMid"); + float laserLength = Projectile.localAI[1]; Color drawColor = new Color(1f, 1f, 1f) * 0.9f; // Laser body logic - laserLength -= laserTailTexture.Height / 2 * projectile.scale; - Vector2 centerDelta = projectile.Center - 76f * projectile.velocity * projectile.scale; - centerDelta += projectile.velocity * projectile.scale * laserTailTexture.Height / 2f; + laserLength -= laserTailTexture.Height / 2 * Projectile.scale; + Vector2 centerDelta = Projectile.Center - 76f * Projectile.velocity * Projectile.scale; + centerDelta += Projectile.velocity * Projectile.scale * laserTailTexture.Height / 2f; if (laserLength > 0f) { float laserLengthDelta = 0f; - Rectangle sourceRectangle = new Rectangle(0, 76 * (projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 76); + Rectangle sourceRectangle = new Rectangle(0, 76 * (Projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 76); while (laserLengthDelta + 1f < laserLength) { if (laserLength - laserLengthDelta < sourceRectangle.Height) { sourceRectangle.Height = (int)(laserLength - laserLengthDelta); } - Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); - laserLengthDelta += sourceRectangle.Height * projectile.scale; - centerDelta += projectile.velocity * sourceRectangle.Height * projectile.scale; - sourceRectangle.Y += (int)(76 * projectile.scale); + Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, Projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), Projectile.scale, SpriteEffects.None, 0f); + laserLengthDelta += sourceRectangle.Height * Projectile.scale; + centerDelta += Projectile.velocity * sourceRectangle.Height * Projectile.scale; + sourceRectangle.Y += (int)(76 * Projectile.scale); if (sourceRectangle.Y + sourceRectangle.Height > laserBodyTexture.Height) { sourceRectangle.Y = 0; @@ -163,9 +164,9 @@ namespace CalamityMod.Projectiles.Summon } // Laser tail logic - centerDelta += projectile.velocity * projectile.scale * 38f; - Rectangle tailFrameRectangle = new Rectangle(0, 76 * (projectile.timeLeft / 3 % 5), laserTailTexture.Width, 76); - Main.spriteBatch.Draw(laserTailTexture, centerDelta - Main.screenPosition, tailFrameRectangle, drawColor, projectile.rotation, new Vector2(148f, 76f) / 2f, projectile.scale, SpriteEffects.None, 0f); + centerDelta += Projectile.velocity * Projectile.scale * 38f; + Rectangle tailFrameRectangle = new Rectangle(0, 76 * (Projectile.timeLeft / 3 % 5), laserTailTexture.Width, 76); + Main.spriteBatch.Draw(laserTailTexture, centerDelta - Main.screenPosition, tailFrameRectangle, drawColor, Projectile.rotation, new Vector2(148f, 76f) / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -175,8 +176,8 @@ namespace CalamityMod.Projectiles.Summon public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Projectile.localAI[1], (float)Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -186,7 +187,7 @@ namespace CalamityMod.Projectiles.Summon return true; } float value = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * (projectile.localAI[1] + 76f), 22f * projectile.scale, ref value)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * (Projectile.localAI[1] + 76f), 22f * Projectile.scale, ref value)) { return true; } diff --git a/Projectiles/Summon/UniverseSplitterSmallBeam.cs b/Projectiles/Summon/UniverseSplitterSmallBeam.cs index 9c392560b5..d5a5a6b2cc 100644 --- a/Projectiles/Summon/UniverseSplitterSmallBeam.cs +++ b/Projectiles/Summon/UniverseSplitterSmallBeam.cs @@ -26,15 +26,15 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.minion = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = TimeLeft; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = TimeLeft; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } // Netcode for sending and receiving shit @@ -42,14 +42,14 @@ namespace CalamityMod.Projectiles.Summon public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public static float CosineInterpolation(float start, float end, float time) @@ -62,71 +62,71 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - if (projectile.localAI[0] <= MovementTime) + if (Projectile.localAI[0] <= MovementTime) { - projectile.velocity = (projectile.ai[0] + (float)Math.Cos(projectile.localAI[0] / MovementTime * TotalSweeps) * - CosineInterpolation(1f, 0f, projectile.localAI[0] / MovementTime) * UniverseSplitterField.SmallBeamAngleMax).ToRotationVector2(); + Projectile.velocity = (Projectile.ai[0] + (float)Math.Cos(Projectile.localAI[0] / MovementTime * TotalSweeps) * + CosineInterpolation(1f, 0f, Projectile.localAI[0] / MovementTime) * UniverseSplitterField.SmallBeamAngleMax).ToRotationVector2(); } - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; // Fadein/out. The timeleft varies, so this must be done manually. - if (projectile.localAI[0] < FadeinTime) + if (Projectile.localAI[0] < FadeinTime) { - projectile.scale = MathHelper.Lerp(0.01f, LaserSize, projectile.localAI[0] / FadeinTime); + Projectile.scale = MathHelper.Lerp(0.01f, LaserSize, Projectile.localAI[0] / FadeinTime); } - if (projectile.localAI[0] > MovementTime && - projectile.localAI[0] <= MovementTime + 10f) + if (Projectile.localAI[0] > MovementTime && + Projectile.localAI[0] <= MovementTime + 10f) { - projectile.scale = MathHelper.Lerp(LaserSize, 3.25f, (projectile.localAI[0] - MovementTime) / 10f); + Projectile.scale = MathHelper.Lerp(LaserSize, 3.25f, (Projectile.localAI[0] - MovementTime) / 10f); } - if (projectile.localAI[0] > TimeLeft - 15f) + if (Projectile.localAI[0] > TimeLeft - 15f) { - projectile.scale = MathHelper.Lerp(3.25f, 0.01f, (projectile.localAI[0] - (TimeLeft - 15f)) / 15f); + Projectile.scale = MathHelper.Lerp(3.25f, 0.01f, (Projectile.localAI[0] - (TimeLeft - 15f)) / 15f); } - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], MaximumLength, 0.5f); - Vector2 beamEndPosiiton = projectile.Center + projectile.velocity * (projectile.localAI[1] - 6f); + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], MaximumLength, 0.5f); + Vector2 beamEndPosiiton = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 6f); // Draw white light across the laser DelegateMethods.v3_1 = Color.White.ToVector3(); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.velocity == Vector2.Zero) + if (Projectile.velocity == Vector2.Zero) { return false; } - Texture2D laserTailTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UniverseSplitterSmallBeamBegin"); - Texture2D laserBodyTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UniverseSplitterSmallBeamMid"); - Texture2D laserHeadTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UniverseSplitterSmallBeamEnd"); - float laserLength = projectile.localAI[1]; + Texture2D laserTailTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/UniverseSplitterSmallBeamBegin"); + Texture2D laserBodyTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/UniverseSplitterSmallBeamMid"); + Texture2D laserHeadTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/UniverseSplitterSmallBeamEnd"); + float laserLength = Projectile.localAI[1]; Color drawColor = new Color(1f, 1f, 1f) * 0.9f; // Laser tail logic - Main.spriteBatch.Draw(laserTailTexture, projectile.Center - Main.screenPosition, null, drawColor, projectile.rotation, laserTailTexture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(laserTailTexture, Projectile.Center - Main.screenPosition, null, drawColor, Projectile.rotation, laserTailTexture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); // Laser body logic - laserLength -= (laserTailTexture.Height / 2 + laserHeadTexture.Height) * projectile.scale; - Vector2 centerDelta = projectile.Center; - centerDelta += projectile.velocity * projectile.scale * (float)laserTailTexture.Height / 2f; + laserLength -= (laserTailTexture.Height / 2 + laserHeadTexture.Height) * Projectile.scale; + Vector2 centerDelta = Projectile.Center; + centerDelta += Projectile.velocity * Projectile.scale * (float)laserTailTexture.Height / 2f; if (laserLength > 0f) { float laserLengthDelta = 0f; - Rectangle sourceRectangle = new Rectangle(0, 14 * (projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 16); + Rectangle sourceRectangle = new Rectangle(0, 14 * (Projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 16); while (laserLengthDelta + 1f < laserLength) { if (laserLength - laserLengthDelta < sourceRectangle.Height) { sourceRectangle.Height = (int)(laserLength - laserLengthDelta); } - Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); - laserLengthDelta += sourceRectangle.Height * projectile.scale; - centerDelta += projectile.velocity * sourceRectangle.Height * projectile.scale; + Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, Projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), Projectile.scale, SpriteEffects.None, 0f); + laserLengthDelta += sourceRectangle.Height * Projectile.scale; + centerDelta += Projectile.velocity * sourceRectangle.Height * Projectile.scale; sourceRectangle.Y += 14; if (sourceRectangle.Y + sourceRectangle.Height > laserBodyTexture.Height) { @@ -137,15 +137,15 @@ namespace CalamityMod.Projectiles.Summon // Laser head logic - Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, projectile.rotation, laserHeadTexture.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, Projectile.rotation, laserHeadTexture.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Projectile.localAI[1], (float)Projectile.width * Projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -155,7 +155,7 @@ namespace CalamityMod.Projectiles.Summon return true; } float value = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref value)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref value)) { return true; } diff --git a/Projectiles/Summon/Urchin.cs b/Projectiles/Summon/Urchin.cs index de969af346..134334e242 100644 --- a/Projectiles/Summon/Urchin.cs +++ b/Projectiles/Summon/Urchin.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -13,34 +14,34 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Urchin"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; + Projectile.width = 30; + Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.urchin) { - projectile.active = false; + Projectile.active = false; return; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (correctMinion) { if (player.dead) @@ -49,49 +50,49 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.vUrchin) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } dust--; if (dust >= 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { - int index = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 179, 0f, 0f, 0, default, 1f); + int index = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 179, 0f, 0f, 0, default, 1f); Main.dust[index].velocity *= 2f; Main.dust[index].scale *= 1.15f; } } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } float scalar = (float)Main.mouseTextColor / 200f - 0.35f; scalar *= 0.2f; - projectile.scale = scalar + 0.95f; - projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + Projectile.scale = scalar + 0.95f; + Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { - projectile.position.Y += 120f; - projectile.rotation = MathHelper.Pi; + Projectile.position.Y += 120f; + Projectile.rotation = MathHelper.Pi; } else { - projectile.rotation = 0f; + Projectile.rotation = 0f; } - projectile.position.X = (int)projectile.position.X; - projectile.position.Y = (int)projectile.position.Y; - if (projectile.owner == Main.myPlayer) + Projectile.position.X = (int)Projectile.position.X; + Projectile.position.Y = (int)Projectile.position.Y; + if (Projectile.owner == Main.myPlayer) { - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; return; } bool foundTarget = false; @@ -99,9 +100,9 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - if (Vector2.Distance(projectile.Center, npc.Center) < maxDist && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + if (Vector2.Distance(Projectile.Center, npc.Center) < maxDist && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { foundTarget = true; break; @@ -113,14 +114,14 @@ namespace CalamityMod.Projectiles.Summon int projAmt = Main.rand.Next(3, 7); for (int u = 0; u < projAmt; u++) { - Vector2 source = new Vector2(projectile.Center.X - 4f, projectile.Center.Y); + Vector2 source = new Vector2(Projectile.Center.X - 4f, Projectile.Center.Y); Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int spore = Projectile.NewProjectile(source, velocity, ModContent.ProjectileType(), projectile.damage, 1f, projectile.owner, 0f, 0f); + int spore = Projectile.NewProjectile(source, velocity, ModContent.ProjectileType(), Projectile.damage, 1f, Projectile.owner, 0f, 0f); Main.projectile[spore].minion = true; Main.projectile[spore].minionSlots = 0f; } - Main.PlaySound(SoundID.Item42, projectile.position); - projectile.ai[0] = 60f; + SoundEngine.PlaySound(SoundID.Item42, Projectile.position); + Projectile.ai[0] = 60f; } } } diff --git a/Projectiles/Summon/UrchinSpike.cs b/Projectiles/Summon/UrchinSpike.cs index 3052ef049a..1558d594b7 100644 --- a/Projectiles/Summon/UrchinSpike.cs +++ b/Projectiles/Summon/UrchinSpike.cs @@ -10,24 +10,24 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Urchin Spike"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.aiStyle = 1; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.aiStyle = 1; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/Valkyrie.cs b/Projectiles/Summon/Valkyrie.cs index 4f2216a485..80ef4ef69a 100644 --- a/Projectiles/Summon/Valkyrie.cs +++ b/Projectiles/Summon/Valkyrie.cs @@ -13,38 +13,38 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Valkyrie"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 90; - projectile.height = 90; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 90; + Projectile.height = 90; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.valkyrie) { - projectile.active = false; + Projectile.active = false; return; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (correctMinion) { if (player.dead) @@ -53,63 +53,63 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.aValkyrie) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 30; for (int num502 = 0; num502 < num501; num502++) { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 59, 0f, 0f, 0, default, 1f); + int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 59, 0f, 0f, 0, default, 1f); Main.dust[num503].velocity *= 2f; Main.dust[num503].scale *= 1.15f; } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } //Adjust sprite direction so it faces correctly - if (Math.Abs(projectile.velocity.X) > 0.2f) + if (Math.Abs(Projectile.velocity.X) > 0.2f) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } - projectile.ChargingMinionAI(700f, 800f, 1200f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 8f, false, true); + Projectile.ChargingMinionAI(700f, 800f, 1200f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 8f, false, true); //Give off some light float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; lightScalar *= Main.essScale; - Lighting.AddLight(projectile.Center, 0f * lightScalar, 0.2f * lightScalar, 0.45f * lightScalar); + Lighting.AddLight(Projectile.Center, 0f * lightScalar, 0.2f * lightScalar, 0.45f * lightScalar); //Frames - projectile.frameCounter++; - if (projectile.frameCounter > 7) + Projectile.frameCounter++; + if (Projectile.frameCounter > 7) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Summon/VileFeederProjectile.cs b/Projectiles/Summon/VileFeederProjectile.cs index d56dd50985..a2c2423509 100644 --- a/Projectiles/Summon/VileFeederProjectile.cs +++ b/Projectiles/Summon/VileFeederProjectile.cs @@ -11,75 +11,75 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Eater of Souls Mini"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.minion = true; - projectile.extraUpdates = 3; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.minion = true; + Projectile.extraUpdates = 3; } public override void AI() { - Player player = Main.player[projectile.owner]; - if (projectile.alpha > 0) + Player player = Main.player[Projectile.owner]; + if (Projectile.alpha > 0) { - projectile.alpha -= 50; + Projectile.alpha -= 50; } else { - projectile.extraUpdates = 0; + Projectile.extraUpdates = 0; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - projectile.frameCounter++; - if (projectile.frameCounter >= 6) + Projectile.frameCounter++; + if (Projectile.frameCounter >= 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } for (int num369 = 0; num369 < 1; num369++) { int dustType = 7; - float num370 = projectile.velocity.X / 3f * (float)num369; - float num371 = projectile.velocity.Y / 3f * (float)num369; - int num372 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); + float num370 = Projectile.velocity.X / 3f * (float)num369; + float num371 = Projectile.velocity.Y / 3f * (float)num369; + int num372 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num372]; - dust.position.X = projectile.Center.X - num370; - dust.position.Y = projectile.Center.Y - num371; + dust.position.X = Projectile.Center.X - num370; + dust.position.Y = Projectile.Center.Y - num371; dust.velocity *= 0f; dust.scale = 0.5f; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - MathHelper.PiOver2; - float num373 = projectile.position.X; - float num374 = projectile.position.Y; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; + float num373 = Projectile.position.X; + float num374 = Projectile.position.Y; float num375 = 100000f; bool flag10 = false; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 30f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 30f) { if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float num377 = npc.position.X + (float)(npc.width / 2); float num378 = npc.position.Y + (float)(npc.height / 2); - float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); - if (num379 < 640f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float num379 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num377) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num378); + if (num379 < 640f && num379 < num375 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { num375 = num379; num373 = num377; @@ -93,12 +93,12 @@ namespace CalamityMod.Projectiles.Summon for (int num376 = 0; num376 < Main.maxNPCs; num376++) { NPC npc = Main.npc[num376]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float num377 = npc.position.X + (float)(npc.width / 2); float num378 = npc.position.Y + (float)(npc.height / 2); - float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); - if (num379 < 640f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float num379 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num377) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num378); + if (num379 < 640f && num379 < num375 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { num375 = num379; num373 = num377; @@ -111,48 +111,48 @@ namespace CalamityMod.Projectiles.Summon } if (!flag10) { - num373 = projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X * 100f; - num374 = projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y * 100f; + num373 = Projectile.position.X + (float)(Projectile.width / 2) + Projectile.velocity.X * 100f; + num374 = Projectile.position.Y + (float)(Projectile.height / 2) + Projectile.velocity.Y * 100f; } float num380 = 10f; float num381 = 0.16f; - Vector2 vector30 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector30 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num382 = num373 - vector30.X; float num383 = num374 - vector30.Y; float num384 = (float)Math.Sqrt((double)(num382 * num382 + num383 * num383)); num384 = num380 / num384; num382 *= num384; num383 *= num384; - if (projectile.velocity.X < num382) + if (Projectile.velocity.X < num382) { - projectile.velocity.X = projectile.velocity.X + num381; - if (projectile.velocity.X < 0f && num382 > 0f) + Projectile.velocity.X = Projectile.velocity.X + num381; + if (Projectile.velocity.X < 0f && num382 > 0f) { - projectile.velocity.X = projectile.velocity.X + num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X + num381 * 2f; } } - else if (projectile.velocity.X > num382) + else if (Projectile.velocity.X > num382) { - projectile.velocity.X = projectile.velocity.X - num381; - if (projectile.velocity.X > 0f && num382 < 0f) + Projectile.velocity.X = Projectile.velocity.X - num381; + if (Projectile.velocity.X > 0f && num382 < 0f) { - projectile.velocity.X = projectile.velocity.X - num381 * 2f; + Projectile.velocity.X = Projectile.velocity.X - num381 * 2f; } } - if (projectile.velocity.Y < num383) + if (Projectile.velocity.Y < num383) { - projectile.velocity.Y = projectile.velocity.Y + num381; - if (projectile.velocity.Y < 0f && num383 > 0f) + Projectile.velocity.Y = Projectile.velocity.Y + num381; + if (Projectile.velocity.Y < 0f && num383 > 0f) { - projectile.velocity.Y = projectile.velocity.Y + num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y + num381 * 2f; } } - else if (projectile.velocity.Y > num383) + else if (Projectile.velocity.Y > num383) { - projectile.velocity.Y = projectile.velocity.Y - num381; - if (projectile.velocity.Y > 0f && num383 < 0f) + Projectile.velocity.Y = Projectile.velocity.Y - num381; + if (Projectile.velocity.Y > 0f && num383 < 0f) { - projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; + Projectile.velocity.Y = Projectile.velocity.Y - num381 * 2f; } } } @@ -162,23 +162,23 @@ namespace CalamityMod.Projectiles.Summon bounce--; if (bounce <= 0) { - projectile.Kill(); + Projectile.Kill(); } else { - projectile.ai[0] += 15f; - if (projectile.velocity.X != oldVelocity.X) + Projectile.ai[0] += 15f; + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } } return false; } - public override bool CanDamage() => projectile.ai[0] >= 30f; + public override bool CanDamage() => Projectile.ai[0] >= 30f; } } diff --git a/Projectiles/Summon/VileFeederSummon.cs b/Projectiles/Summon/VileFeederSummon.cs index e2279f5eb4..b7dcc22763 100644 --- a/Projectiles/Summon/VileFeederSummon.cs +++ b/Projectiles/Summon/VileFeederSummon.cs @@ -17,66 +17,66 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Baby Eater"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.Calamity().lineColor); + writer.Write(Projectile.Calamity().lineColor); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.Calamity().lineColor = reader.ReadInt32(); + Projectile.Calamity().lineColor = reader.ReadInt32(); } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (spawnDust) { - projectile.Calamity().lineColor = -1; - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().lineColor = -1; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { - Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 dustVel = source - projectile.Center; + Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 dustVel = source - Projectile.Center; int num228 = Dust.NewDust(source + dustVel, 0, 0, 7, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = dustVel; } spawnDust = false; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) { @@ -86,43 +86,43 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.vileFeeder) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } if (eaterCooldown < 0) eaterCooldown = 0; - if (projectile.ai[0] != 3f) + if (Projectile.ai[0] != 3f) { if (eaterCooldown > 0) eaterCooldown--; - projectile.ChargingMinionAI(640f, 1100f, 2400f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 8f, false, false); - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.ChargingMinionAI(640f, 1100f, 2400f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 8f, false, false); + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(270); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(270); } else { - projectile.frame = 0; - projectile.extraUpdates = 0; + Projectile.frame = 0; + Projectile.extraUpdates = 0; bool breakAway = false; bool spawnDust = false; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] % 30f == 0f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] % 30f == 0f) { spawnDust = true; } - int npcIndex = projectile.Calamity().lineColor; - if (projectile.localAI[0] >= 600000f) //tryna make it stay on there "forever" without glitching + int npcIndex = Projectile.Calamity().lineColor; + if (Projectile.localAI[0] >= 600000f) //tryna make it stay on there "forever" without glitching { breakAway = true; } @@ -132,8 +132,8 @@ namespace CalamityMod.Projectiles.Summon } else if (Main.npc[npcIndex].active && !Main.npc[npcIndex].dontTakeDamage && Main.npc[npcIndex].defense < 9999) { - projectile.Center = Main.npc[npcIndex].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[npcIndex].gfxOffY; + Projectile.Center = Main.npc[npcIndex].Center - Projectile.velocity * 2f; + Projectile.gfxOffY = Main.npc[npcIndex].gfxOffY; if (spawnDust) { Main.npc[npcIndex].HitEffect(0, 1.0); @@ -145,11 +145,11 @@ namespace CalamityMod.Projectiles.Summon } if (breakAway) { - projectile.ai[0] = 0f; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; + Projectile.ai[0] = 0f; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 0f; } - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { if (eaterCooldown > 0) eaterCooldown -= Main.rand.Next(1,3); @@ -163,7 +163,7 @@ namespace CalamityMod.Projectiles.Summon float yVector = (float)Main.rand.Next(-35, 36) * 0.02f; xVector *= 10f; yVector *= 10f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, xVector, yVector, ModContent.ProjectileType(), (int)(projectile.damage * 1.25f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, xVector, yVector, ModContent.ProjectileType(), (int)(Projectile.damage * 1.25f), Projectile.knockBack, Projectile.owner, 0f, 0f); } eaterCooldown = 80; } @@ -173,20 +173,20 @@ namespace CalamityMod.Projectiles.Summon public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Player player = Main.player[projectile.owner]; - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Player player = Main.player[Projectile.owner]; + Rectangle myRect = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { NPC npc = Main.npc[npcIndex]; //covers most edge cases like voodoo dolls if (npc.active && !npc.dontTakeDamage && npc.defense < 9999 && npc.Calamity().DR < 0.99f && - ((projectile.friendly && (!npc.friendly || (npc.type == NPCID.Guide && projectile.owner < Main.maxPlayers && player.killGuide) || (npc.type == NPCID.Clothier && projectile.owner < Main.maxPlayers && player.killClothier))) || - (projectile.hostile && npc.friendly && !npc.dontTakeDamageFromHostiles)) && (projectile.owner < 0 || npc.immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) + ((Projectile.friendly && (!npc.friendly || (npc.type == NPCID.Guide && Projectile.owner < Main.maxPlayers && player.killGuide) || (npc.type == NPCID.Clothier && Projectile.owner < Main.maxPlayers && player.killClothier))) || + (Projectile.hostile && npc.friendly && !npc.dontTakeDamageFromHostiles)) && (Projectile.owner < 0 || npc.immune[Projectile.owner] == 0 || Projectile.maxPenetrate == 1)) { - if (npc.noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(npc)) + if (npc.noTileCollide || !Projectile.ownerHitCheck || Projectile.CanHit(npc)) { bool stickingToNPC; //Solar Crawltipede tail has special collision @@ -198,29 +198,29 @@ namespace CalamityMod.Projectiles.Summon rect.Y -= num5; rect.Width += num5 * 2; rect.Height += num5 * 2; - stickingToNPC = projectile.Colliding(myRect, rect); + stickingToNPC = Projectile.Colliding(myRect, rect); } else { - stickingToNPC = projectile.Colliding(myRect, npc.getRect()); + stickingToNPC = Projectile.Colliding(myRect, npc.getRect()); } if (stickingToNPC) { //reflect projectile if the npc can reflect it (like Selenians) - if (npc.reflectingProjectiles && projectile.CanReflect()) + if (npc.reflectingProjectiles && Projectile.CanReflect()) { - npc.ReflectProjectile(projectile.whoAmI); + npc.ReflectProjectile(Projectile.whoAmI); return; } //let the projectile know it is sticking and the npc it is sticking too - projectile.ai[0] = 3f; - projectile.Calamity().lineColor = npcIndex; + Projectile.ai[0] = 3f; + Projectile.Calamity().lineColor = npcIndex; //follow the NPC - projectile.velocity = (npc.Center - projectile.Center) * 0.75f; + Projectile.velocity = (npc.Center - Projectile.Center) * 0.75f; - projectile.netUpdate = true; + Projectile.netUpdate = true; //Count how many projectiles are attached, delete as necessary Point[] array2 = new Point[10]; @@ -228,7 +228,7 @@ namespace CalamityMod.Projectiles.Summon for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { Projectile proj = Main.projectile[projIndex]; - if (projIndex != projectile.whoAmI && proj.active && proj.owner == Main.myPlayer && proj.type == projectile.type && proj.ai[0] == 3f && proj.Calamity().lineColor == npcIndex) + if (projIndex != Projectile.whoAmI && proj.active && proj.owner == Main.myPlayer && proj.type == Projectile.type && proj.ai[0] == 3f && proj.Calamity().lineColor == npcIndex) { array2[projCount++] = new Point(projIndex, proj.timeLeft); if (projCount >= array2.Length) @@ -267,20 +267,20 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Main.projectileTexture[projectile.type]; - int num214 = texture.Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Main.projectileTexture[Projectile.type]; + int num214 = texture.Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)num214 / 2f), Projectile.scale, spriteEffects, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 0; + target.immune[Projectile.owner] = 0; } - public override bool CanDamage() => projectile.ai[0] != 3f; + public override bool CanDamage() => Projectile.ai[0] != 3f; public override bool OnTileCollide(Vector2 oldVelocity) => false; } diff --git a/Projectiles/Summon/ViridVanguardBlade.cs b/Projectiles/Summon/ViridVanguardBlade.cs index 8f86a10d39..48c7a856ba 100644 --- a/Projectiles/Summon/ViridVanguardBlade.cs +++ b/Projectiles/Summon/ViridVanguardBlade.cs @@ -21,31 +21,31 @@ namespace CalamityMod.Projectiles.Summon public Vector2 IdealPosition; public float Angle { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => Projectile.ai[0]; + set => Projectile.ai[0] = value; } public override void SetStaticDefaults() { DisplayName.SetDefault("Vanguard Blade"); - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7; } public override void SetDefaults() { - projectile.width = 60; - projectile.height = 156; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1.5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 14; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 60; + Projectile.height = 156; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1.5f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 14; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void SendExtraAI(BinaryWriter writer) { @@ -61,23 +61,23 @@ namespace CalamityMod.Projectiles.Summon } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - projectile.spriteDirection = AltTexture.ToDirectionInt(); - if (projectile.localAI[0] == 0f) + Projectile.spriteDirection = AltTexture.ToDirectionInt(); + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } - bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) { @@ -87,51 +87,51 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.viridVanguard) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } if (FiringTime <= 0f) { - projectile.ai[1]++; + Projectile.ai[1]++; float outwardPosition = 320f; outwardPosition += (float)Math.Sin(Angle) * 200f; - projectile.Center = player.Center + Angle.ToRotationVector2().RotatedBy((float)Math.Cos(Angle) * MathHelper.PiOver4 + AltTexture.ToInt() * MathHelper.Pi) * outwardPosition; - projectile.rotation = player.AngleTo(projectile.Center) + MathHelper.PiOver4; + Projectile.Center = player.Center + Angle.ToRotationVector2().RotatedBy((float)Math.Cos(Angle) * MathHelper.PiOver4 + AltTexture.ToInt() * MathHelper.Pi) * outwardPosition; + Projectile.rotation = player.AngleTo(Projectile.Center) + MathHelper.PiOver4; Angle += MathHelper.ToRadians(4f); } else { - projectile.spriteDirection = 1; + Projectile.spriteDirection = 1; if (FiringTime >= 239f) { - RemainingSlices = projectile.penetrate = 3; + RemainingSlices = Projectile.penetrate = 3; IdealPosition = player.Center - Vector2.UnitY.RotatedBy(RedirectAngle) * 550f; } else if (FiringTime > 120f) { - projectile.Center = Vector2.Lerp(projectile.Center, IdealPosition, 1f / 40f); - projectile.rotation = projectile.rotation.AngleLerp(RedirectAngle + MathHelper.ToRadians(82f), 1f / 60f); + Projectile.Center = Vector2.Lerp(Projectile.Center, IdealPosition, 1f / 40f); + Projectile.rotation = Projectile.rotation.AngleLerp(RedirectAngle + MathHelper.ToRadians(82f), 1f / 60f); } else if (FiringTime > 80f) { - projectile.Center = IdealPosition; - projectile.rotation = projectile.rotation.AngleLerp(projectile.AngleTo(Main.MouseWorld) + MathHelper.ToRadians(82f), 1f / 20f); + Projectile.Center = IdealPosition; + Projectile.rotation = Projectile.rotation.AngleLerp(Projectile.AngleTo(Main.MouseWorld) + MathHelper.ToRadians(82f), 1f / 20f); } else if (FiringTime == 80f) { PostSliceDeathTimer = 80; - projectile.velocity = projectile.SafeDirectionTo(Main.MouseWorld) * 30f; + Projectile.velocity = Projectile.SafeDirectionTo(Main.MouseWorld) * 30f; } else if (FiringTime == 1f) { if (RemainingSlices <= 0) { - projectile.Kill(); + Projectile.Kill(); } else if (RemainingSlices <= 2) { - projectile.velocity *= -1; + Projectile.velocity *= -1; FiringTime = 20f; } } @@ -141,12 +141,12 @@ namespace CalamityMod.Projectiles.Summon if (RemainingSlices > 0) PostSliceDeathTimer--; if (PostSliceDeathTimer == 1) - projectile.Kill(); + Projectile.Kill(); - if (projectile.localAI[1] > 0) + if (Projectile.localAI[1] > 0) { - projectile.alpha = (int)MathHelper.Lerp(255, 0, 1f - projectile.localAI[1] / 80f); - projectile.localAI[1]--; + Projectile.alpha = (int)MathHelper.Lerp(255, 0, 1f - Projectile.localAI[1] / 80f); + Projectile.localAI[1]--; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -161,36 +161,36 @@ namespace CalamityMod.Projectiles.Summon { for (int j = 0; j < 40; j++) { - Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 66); + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 66); dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool(2).ToDirectionInt(); dust.noGravity = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/ViridVanguardBlade" + (AltTexture ? "" : "Alt")); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Summon/ViridVanguardBlade" + (AltTexture ? "" : "Alt")); Rectangle rectangle = new Rectangle(0, 0, texture.Width, texture.Height); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; if (CalamityConfig.Instance.Afterimages && FiringTime > 0f && FiringTime < 80f) { - for (int i = 0; i < projectile.oldPos.Length; i++) + for (int i = 0; i < Projectile.oldPos.Length; i++) { - Vector2 drawPos = projectile.oldPos[i] + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - Color color = Color.Lerp(Color.White, Color.DarkOliveGreen, i / (float)projectile.oldPos.Length) * - ((projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); - float scale = MathHelper.Lerp(projectile.scale * 1f, projectile.scale * 0.5f, i / (float)projectile.oldPos.Length); + Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color color = Color.Lerp(Color.White, Color.DarkOliveGreen, i / (float)Projectile.oldPos.Length) * + ((Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); + float scale = MathHelper.Lerp(Projectile.scale * 1f, Projectile.scale * 0.5f, i / (float)Projectile.oldPos.Length); Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, - projectile.rotation, + Projectile.rotation, rectangle.Size() / 2f, scale, spriteEffects, 0f); } } - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Rectangle?(rectangle), Color.White, - projectile.rotation, + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle?(rectangle), Color.White, + Projectile.rotation, rectangle.Size() / 2f, 1f, spriteEffects, 0f); return false; } diff --git a/Projectiles/Summon/VoidConcentrationAura.cs b/Projectiles/Summon/VoidConcentrationAura.cs index 6af8a77da8..053212b1e8 100644 --- a/Projectiles/Summon/VoidConcentrationAura.cs +++ b/Projectiles/Summon/VoidConcentrationAura.cs @@ -18,18 +18,18 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 46; - projectile.height = 80; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 3f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; + Projectile.width = 46; + Projectile.height = 80; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 3f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void SendExtraAI(BinaryWriter writer) @@ -49,29 +49,29 @@ namespace CalamityMod.Projectiles.Summon public void HandleRightClick() { - Vector2 velocity = Main.MouseWorld - Main.player[projectile.owner].Center; + Vector2 velocity = Main.MouseWorld - Main.player[Projectile.owner].Center; velocity.Normalize(); velocity *= 2f; - Projectile.NewProjectile(Main.player[projectile.owner].Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 5f), 0f, projectile.owner); - projectile.Kill(); + Projectile.NewProjectile(Main.player[Projectile.owner].Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 5f), 0f, Projectile.owner); + Projectile.Kill(); } public override void AI() { - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; CalamityPlayer mp = owner.Calamity(); - projectile.Center = owner.Center; + Projectile.Center = owner.Center; mp.voidAuraDamage = true; if (owner.dead) mp.voidAuraDamage = false; - if (!mp.voidAuraDamage || !mp.voidConcentrationAura && projectile.ai[0] == 1f) + if (!mp.voidAuraDamage || !mp.voidConcentrationAura && Projectile.ai[0] == 1f) { mp.voidAura = false; - projectile.Kill(); + Projectile.Kill(); } - if (owner.whoAmI == Main.myPlayer && owner.ownedProjectileCounts[projectile.type] <= 25 && timer > 0 && timer % 4 == 0) + if (owner.whoAmI == Main.myPlayer && owner.ownedProjectileCounts[Projectile.type] <= 25 && timer > 0 && timer % 4 == 0) { - NPC target = CalamityUtils.MinionHoming(projectile.Center, 1800f, owner); + NPC target = CalamityUtils.MinionHoming(Projectile.Center, 1800f, owner); if (target != null) { Vector2 correctedVelocity = target.Center - owner.Center; @@ -79,11 +79,11 @@ namespace CalamityMod.Projectiles.Summon correctedVelocity *= 3f; int perturbificator9000 = Main.rand.Next(-1, 2); Vector2 perturbedspeed = new Vector2(correctedVelocity.X + perturbificator9000, correctedVelocity.Y + perturbificator9000).RotatedBy(MathHelper.ToRadians(Main.rand.Next(1, 3))); - Projectile.NewProjectile(projectile.Center, perturbedspeed, ModContent.ProjectileType(), (int)(projectile.damage * 0.75f), 0f, owner.whoAmI); + Projectile.NewProjectile(Projectile.Center, perturbedspeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), 0f, owner.whoAmI); } timer = -1; } - projectile.ai[0] = 1f; + Projectile.ai[0] = 1f; if (timer > 50 && timer % 4 == 0) return; timer++; diff --git a/Projectiles/Summon/VoidConcentrationBlackhole.cs b/Projectiles/Summon/VoidConcentrationBlackhole.cs index 4281fbf8aa..16fa935db5 100644 --- a/Projectiles/Summon/VoidConcentrationBlackhole.cs +++ b/Projectiles/Summon/VoidConcentrationBlackhole.cs @@ -5,6 +5,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -25,37 +26,37 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Black Hole"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 80; //32 base, 2.5x the normal (for hitbox purposes) - projectile.height = 85; //34 base, 2.5x the normal (for hitbox purposes) - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 1800; - projectile.penetrate = -1; + Projectile.width = 80; //32 base, 2.5x the normal (for hitbox purposes) + Projectile.height = 85; //34 base, 2.5x the normal (for hitbox purposes) + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 1800; + Projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; - projectile.scale = 0.01f; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.scale = 0.01f; } private void ApplySucc(NPC npc) { - float succStrength = 4f / projectile.scale; - succStrength *= projectile.scale; - Vector2 velocity = projectile.Center - npc.Center; + float succStrength = 4f / Projectile.scale; + succStrength *= Projectile.scale; + Vector2 velocity = Projectile.Center - npc.Center; velocity *= 2f; velocity.SafeNormalize(Vector2.Zero); - float num550 = 5f * projectile.scale; + float num550 = 5f * Projectile.scale; Vector2 vector43 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num551 = projectile.Center.X - vector43.X; - float num552 = projectile.Center.Y - vector43.Y; + float num551 = Projectile.Center.X - vector43.X; + float num552 = Projectile.Center.Y - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); if (num553 < 100f) { @@ -71,20 +72,20 @@ namespace CalamityMod.Projectiles.Summon private void Death() { - if (projectile.scale >= 2.5f) //it's boom o' clock + if (Projectile.scale >= 2.5f) //it's boom o' clock { - projectile.height *= 2; - projectile.width *= 2; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage = damage; - projectile.Damage(); - projectile.friendly = false; - projectile.Damage(); - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - projectile.Kill(); + Projectile.height *= 2; + Projectile.width *= 2; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.damage = damage; + Projectile.Damage(); + Projectile.friendly = false; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.Center.X, (int)Projectile.Center.Y, 14); + Projectile.Kill(); } } @@ -92,7 +93,7 @@ namespace CalamityMod.Projectiles.Summon { for (int d = 0; d < 6; d++) { - int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 4f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 4f); Main.dust[shadow].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -102,10 +103,10 @@ namespace CalamityMod.Projectiles.Summon } for (int d = 0; d < 18; d++) { - int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 4f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 4f); Main.dust[shadow].noGravity = true; Main.dust[shadow].velocity *= 5f; - shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); + shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); Main.dust[shadow].velocity *= 2f; } } @@ -114,70 +115,70 @@ namespace CalamityMod.Projectiles.Summon { if (damage == 0) { - damage = projectile.damage; - projectile.damage = 0; - projectile.position = Main.player[projectile.owner].position; + damage = Projectile.damage; + Projectile.damage = 0; + Projectile.position = Main.player[Projectile.owner].position; } return true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - int height = texture.Height / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameHeight, texture.Width, height); Vector2 origin = new Vector2(texture.Width / 2f, height / 2f); SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); return false; } public override void AI() { - projectile.scale += 0.01f; - if (projectile.scale % 0.02f == 0) + Projectile.scale += 0.01f; + if (Projectile.scale % 0.02f == 0) { - projectile.scale += 0.01f; //speeds up the projectile's growth to prevent it being too long + Projectile.scale += 0.01f; //speeds up the projectile's growth to prevent it being too long } - int radius = (int)(projectile.scale * 100f); //0.01f; to a max of 2.5f; so radius of 1 to 250 by default - if (projectile.scale >= 2f) + int radius = (int)(Projectile.scale * 100f); //0.01f; to a max of 2.5f; so radius of 1 to 250 by default + if (Projectile.scale >= 2f) radius *= 2; int baseWidth = 32; int baseHeight = 34; - int newWidth = (int)(baseWidth * projectile.scale); - int newHeight = (int)(baseHeight * projectile.scale); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, newWidth, newHeight); + int newWidth = (int)(baseWidth * Projectile.scale); + int newHeight = (int)(baseHeight * Projectile.scale); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, newWidth, newHeight); - if (projectile.frameCounter > 6) + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type] - 1) + if (Projectile.frame >= Main.projFrames[Projectile.type] - 1) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.frameCounter++; + Projectile.frameCounter++; for (int i = 0; i < Main.npc.Length; i++) { if (Main.npc[i].active && !Main.npc[i].friendly /*&& CalamityGlobalNPC.ShouldAffectNPC(Main.npc[i])*/) //TODO - REMOVE COMMENT BEFORE MERGE { - if (Vector2.Distance(projectile.Center, Main.npc[i].Center) <= radius) + if (Vector2.Distance(Projectile.Center, Main.npc[i].Center) <= radius) ApplySucc(Main.npc[i]); } } - if (projectile.scale >= 2.5f) //it's boom o' clock + if (Projectile.scale >= 2.5f) //it's boom o' clock { Death(); } diff --git a/Projectiles/Summon/VoidConcentrationOrb.cs b/Projectiles/Summon/VoidConcentrationOrb.cs index 51bd4f81ad..9a097c8bc8 100644 --- a/Projectiles/Summon/VoidConcentrationOrb.cs +++ b/Projectiles/Summon/VoidConcentrationOrb.cs @@ -12,29 +12,29 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Void Orb"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 54; - projectile.height = 50; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 300; - projectile.penetrate = 1; + Projectile.width = 54; + Projectile.height = 50; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 300; + Projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.minion = true; - projectile.scale = 0.01f; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.scale = 0.01f; } public override bool? CanHitNPC(NPC target) { - if (projectile.scale < 1f) + if (Projectile.scale < 1f) return false; return null; } @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon { for (int d = 0; d < 6; d++) { - int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); Main.dust[shadow].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -53,25 +53,25 @@ namespace CalamityMod.Projectiles.Summon } for (int d = 0; d < 10; d++) { - int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); + int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); Main.dust[shadow].noGravity = true; Main.dust[shadow].velocity *= 5f; - shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); + shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f); Main.dust[shadow].velocity *= 2f; } } public override void AI() { - Player owner = Main.player[projectile.owner]; - NPC target = CalamityUtils.MinionHoming(projectile.Center, 1800f, owner); + Player owner = Main.player[Projectile.owner]; + NPC target = CalamityUtils.MinionHoming(Projectile.Center, 1800f, owner); - if (projectile.scale >= 1f) + if (Projectile.scale >= 1f) { if (target != null) { float num550 = 40f; - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector43 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num551 = target.Center.X - vector43.X; float num552 = target.Center.Y - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -82,33 +82,33 @@ namespace CalamityMod.Projectiles.Summon num553 = num550 / num553; num551 *= num553; num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 25f + num551) / 26f; - projectile.velocity.Y = (projectile.velocity.Y * 25f + num552) / 26f; + Projectile.velocity.X = (Projectile.velocity.X * 25f + num551) / 26f; + Projectile.velocity.Y = (Projectile.velocity.Y * 25f + num552) / 26f; if (Main.rand.NextBool(5)) - projectile.velocity *= 1.1f; + Projectile.velocity *= 1.1f; } } else { - projectile.scale += 0.025f; - projectile.velocity *= 1.03f; + Projectile.scale += 0.025f; + Projectile.velocity *= 1.03f; } - if (projectile.frameCounter > 6) + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type] - 1) + if (Projectile.frame >= Main.projFrames[Projectile.type] - 1) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.frameCounter++; + Projectile.frameCounter++; - if (projectile.timeLeft <= 60) + if (Projectile.timeLeft <= 60) { - projectile.alpha += 4; + Projectile.alpha += 4; } } } diff --git a/Projectiles/Summon/WaterElementalMinion.cs b/Projectiles/Summon/WaterElementalMinion.cs index 5a32d33a0a..2d9029c52a 100644 --- a/Projectiles/Summon/WaterElementalMinion.cs +++ b/Projectiles/Summon/WaterElementalMinion.cs @@ -14,34 +14,34 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Anahita"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 100; - projectile.height = 190; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; + Projectile.width = 100; + Projectile.height = 190; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; } public override void AI() { - bool flag64 = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool flag64 = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.sirenWaifu && !modPlayer.allWaifus) { - projectile.active = false; + Projectile.active = false; return; } if (flag64) @@ -52,75 +52,75 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.slWaifu) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } if (dust > 0) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 33, 0f, 0f, 0, default, 1f); + int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 33, 0f, 0f, 0, default, 1f); Main.dust[num503].velocity *= 2f; Main.dust[num503].scale *= 1.15f; } dust--; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + Projectile.damage = damage2; } - Lighting.AddLight(projectile.Center, 0f, 0.25f, 1.5f); - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Lighting.AddLight(Projectile.Center, 0f, 0.25f, 1.5f); + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 6) + if (Projectile.frame >= 6) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 180f); + Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 180f); if (player.gravDir == -1f) { - projectile.position.Y += 360f; - projectile.rotation = MathHelper.Pi; + Projectile.position.Y += 360f; + Projectile.rotation = MathHelper.Pi; } else { - projectile.rotation = 0f; + Projectile.rotation = 0f; } - projectile.position.X = (int)projectile.position.X; - projectile.position.Y = (int)projectile.position.Y; - if (projectile.owner == Main.myPlayer) + Projectile.position.X = (int)Projectile.position.X; + Projectile.position.Y = (int)Projectile.position.Y; + if (Projectile.owner == Main.myPlayer) { // Prevent firing immediately - if (projectile.localAI[0] < 120f) - projectile.localAI[0] += 1f; + if (Projectile.localAI[0] < 120f) + Projectile.localAI[0] += 1f; - if (projectile.ai[0] != 0f) + if (Projectile.ai[0] != 0f) { - projectile.ai[0] -= 1f; + Projectile.ai[0] -= 1f; return; } bool flag18 = false; - float num506 = projectile.Center.X; - float num507 = projectile.Center.Y; + float num506 = Projectile.Center.X; + float num507 = Projectile.Center.Y; float num508 = 1000f; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { float num539 = npc.position.X + (float)(npc.width / 2); float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float num541 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num539) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num540); + if (num541 < num508 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { num506 = num539; num507 = num540; @@ -132,12 +132,12 @@ namespace CalamityMod.Projectiles.Summon { for (int num512 = 0; num512 < Main.maxNPCs; num512++) { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) + if (Main.npc[num512].CanBeChasedBy(Projectile, false)) { float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + float num515 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - num513) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) { num508 = num515; num506 = num513; @@ -147,19 +147,19 @@ namespace CalamityMod.Projectiles.Summon } } } - if (flag18 && projectile.localAI[0] >= 120f) + if (flag18 && Projectile.localAI[0] >= 120f) { float num516 = num506; float num517 = num507; - num506 -= projectile.Center.X; - num507 -= projectile.Center.Y; + num506 -= Projectile.Center.X; + num507 -= Projectile.Center.Y; if (num506 < 0f) { - projectile.spriteDirection = 1; + Projectile.spriteDirection = 1; } else { - projectile.spriteDirection = -1; + Projectile.spriteDirection = -1; } int projectileType = ModContent.ProjectileType(); if (Main.rand.NextBool(9)) @@ -171,15 +171,15 @@ namespace CalamityMod.Projectiles.Summon projectileType = ModContent.ProjectileType(); } float num403 = Main.rand.Next(12, 20); - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector29 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); float num404 = num516 - vector29.X; float num405 = num517 - vector29.Y; float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); num406 = num403 / num406; num404 *= num406; num405 *= num406; - Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, projectileType, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - projectile.ai[0] = 12f; + Projectile.NewProjectile(Projectile.Center.X - 4f, Projectile.Center.Y, num404, num405, projectileType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.ai[0] = 12f; } } } diff --git a/Projectiles/Summon/WaterSpearFriendly.cs b/Projectiles/Summon/WaterSpearFriendly.cs index 465acd66a3..ea0b9af971 100644 --- a/Projectiles/Summon/WaterSpearFriendly.cs +++ b/Projectiles/Summon/WaterSpearFriendly.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class WaterSpearFriendly : ModProjectile @@ -11,31 +12,31 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Spear"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.alpha = 255; } public override void AI() { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (projectile.ai[1] == 0f) + Projectile.velocity.X *= 1.01f; + Projectile.velocity.Y *= 1.01f; + if (Projectile.ai[1] == 0f) { for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -43,50 +44,50 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item21, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item21, Projectile.position); } - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) + Projectile.scale -= 0.02f; + Projectile.alpha += 30; + if (Projectile.alpha >= 250) { - projectile.alpha = 255; - projectile.localAI[0] = 1f; + Projectile.alpha = 255; + Projectile.localAI[0] = 1f; } } - else if (projectile.localAI[0] == 1f) + else if (Projectile.localAI[0] == 1f) { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) + Projectile.scale += 0.02f; + Projectile.alpha -= 30; + if (Projectile.alpha <= 0) { - projectile.alpha = 0; - projectile.localAI[0] = 0f; + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; } } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.35f / 255f); + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(200, 200, 200, Projectile.alpha); } public override void Kill(int timeLeft) { for (int k = 0; k < 3; k++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 33, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Summon/WitherBlossom.cs b/Projectiles/Summon/WitherBlossom.cs index 94bf3ee576..8ca2b7e12a 100644 --- a/Projectiles/Summon/WitherBlossom.cs +++ b/Projectiles/Summon/WitherBlossom.cs @@ -8,33 +8,33 @@ namespace CalamityMod.Projectiles.Summon { public class WitherBlossom : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float OffsetAngle => ref projectile.ai[0]; - public ref float Time => ref projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public ref float OffsetAngle => ref Projectile.ai[0]; + public ref float Time => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Wither Blossom"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 90000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.minion = true; + Projectile.width = Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0.5f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; } public override void AI() { - bool isCorrectMinion = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool isCorrectMinion = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); if (isCorrectMinion) @@ -42,43 +42,43 @@ namespace CalamityMod.Projectiles.Summon if (player.dead) modPlayer.witherBlossom = false; if (modPlayer.witherBlossom) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } SetProjectileDamage(); Time++; - NPC potentialTarget = projectile.Center.MinionHoming(950f, Owner); - if (Time % 50 == 49 && Main.myPlayer == projectile.owner && potentialTarget != null) + NPC potentialTarget = Projectile.Center.MinionHoming(950f, Owner); + if (Time % 50 == 49 && Main.myPlayer == Projectile.owner && potentialTarget != null) { - Vector2 shootVelocity = projectile.SafeDirectionTo(potentialTarget.Center).RotatedByRandom(0.25f) * 8f; - Projectile.NewProjectile(projectile.Center, shootVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Vector2 shootVelocity = Projectile.SafeDirectionTo(potentialTarget.Center).RotatedByRandom(0.25f) * 8f; + Projectile.NewProjectile(Projectile.Center, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } - projectile.Center = player.Center + OffsetAngle.ToRotationVector2() * 150f; - projectile.rotation += MathHelper.ToRadians(5f); + Projectile.Center = player.Center + OffsetAngle.ToRotationVector2() * 150f; + Projectile.rotation += MathHelper.ToRadians(5f); OffsetAngle += MathHelper.ToRadians(4f); } public void SetProjectileDamage() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 36; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, 179); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 179); dust.noGravity = true; dust.velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(2f, 7f); } - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } } diff --git a/Projectiles/Summon/WitherBolt.cs b/Projectiles/Summon/WitherBolt.cs index bb51c0afe3..53d95270d9 100644 --- a/Projectiles/Summon/WitherBolt.cs +++ b/Projectiles/Summon/WitherBolt.cs @@ -12,56 +12,56 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Wither Bolt"); - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 25; - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 25; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.scale = 0.8f; - projectile.width = projectile.height = (int)(72 * projectile.scale); - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 180; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.scale = 0.8f; + Projectile.width = Projectile.height = (int)(72 * Projectile.scale); + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 180; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, Color.DarkGreen.ToVector3() * 1.25f); - float oldSpeed = projectile.velocity.Length(); + Lighting.AddLight(Projectile.Center, Color.DarkGreen.ToVector3() * 1.25f); + float oldSpeed = Projectile.velocity.Length(); - NPC potentialTarget = projectile.Center.MinionHoming(800f, Main.player[projectile.owner]); + NPC potentialTarget = Projectile.Center.MinionHoming(800f, Main.player[Projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 3f + projectile.SafeDirectionTo(potentialTarget.Center) * oldSpeed) / 4f; - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * oldSpeed * 1.01f; + Projectile.velocity = (Projectile.velocity * 3f + Projectile.SafeDirectionTo(potentialTarget.Center) * oldSpeed) / 4f; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * oldSpeed * 1.01f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - projectile.Opacity = MathHelper.Lerp(projectile.Opacity, 0f, 0.25f); + Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, 0f, 0.25f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D boltTexture = Main.projectileTexture[projectile.type]; - for (int i = 0; i < projectile.oldPos.Length; i++) + Texture2D boltTexture = Main.projectileTexture[Projectile.type]; + for (int i = 0; i < Projectile.oldPos.Length; i++) { - float completionRatio = i / (float)projectile.oldPos.Length; + float completionRatio = i / (float)Projectile.oldPos.Length; Color drawColor = Color.Lerp(lightColor, Color.Olive, 0.6f); drawColor = Color.Lerp(drawColor, Color.Black, completionRatio); drawColor = Color.Lerp(drawColor, Color.Transparent, completionRatio); - Vector2 drawPosition = projectile.oldPos[i] + projectile.Size * 0.5f - Main.screenPosition; - spriteBatch.Draw(boltTexture, drawPosition, null, projectile.GetAlpha(drawColor), projectile.oldRot[i], boltTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + Vector2 drawPosition = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + spriteBatch.Draw(boltTexture, drawPosition, null, Projectile.GetAlpha(drawColor), Projectile.oldRot[i], boltTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); } return false; } @@ -70,24 +70,24 @@ namespace CalamityMod.Projectiles.Summon { if (!Main.dedServ) { - for (int i = 0; i < projectile.oldPos.Length / 2; i++) + for (int i = 0; i < Projectile.oldPos.Length / 2; i++) { for (int j = 0; j < 2; j++) { - Dust plague = Dust.NewDustDirect(projectile.oldPos[i], projectile.width / 2, projectile.height / 2, 107); - plague.velocity = (projectile.oldRot[i] - MathHelper.PiOver2).ToRotationVector2() * 4.5f + Main.rand.NextVector2Circular(2f, 2f); + Dust plague = Dust.NewDustDirect(Projectile.oldPos[i], Projectile.width / 2, Projectile.height / 2, 107); + plague.velocity = (Projectile.oldRot[i] - MathHelper.PiOver2).ToRotationVector2() * 4.5f + Main.rand.NextVector2Circular(2f, 2f); plague.color = Color.Olive; plague.noGravity = true; } } } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { for (int i = 0; i < 2; i++) { - Vector2 spawnPosition = projectile.Center + Main.rand.NextVector2CircularEdge(8f, 8f); - int seeker = Projectile.NewProjectile(spawnPosition, Main.rand.NextVector2Circular(12f, 12f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2CircularEdge(8f, 8f); + int seeker = Projectile.NewProjectile(spawnPosition, Main.rand.NextVector2Circular(12f, 12f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); Main.projectile[seeker].Calamity().forceMinion = true; } } diff --git a/Projectiles/Summon/WulfrumBoltMinion.cs b/Projectiles/Summon/WulfrumBoltMinion.cs index 9514f9fb76..b4e71602e8 100644 --- a/Projectiles/Summon/WulfrumBoltMinion.cs +++ b/Projectiles/Summon/WulfrumBoltMinion.cs @@ -12,48 +12,48 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.minionSlots = 0f; - projectile.minion = true; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.minionSlots = 0f; + Projectile.minion = true; } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.1f / 255f, 0f); + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.1f / 255f, 0f); for (int num151 = 0; num151 < 3; num151++) { int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 61, 0f, 0f, 100, default, 3f); + int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 61, 0f, 0f, 100, default, 3f); Main.dust[num155].noGravity = true; Main.dust[num155].noLight = true; Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; + Main.dust[num155].velocity += Projectile.velocity * 0.5f; } if (Main.rand.NextBool(8)) { int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 61, 0f, 0f, 100, default, 2.25f); + int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 61, 0f, 0f, 100, default, 2.25f); Main.dust[num157].velocity *= 0.25f; Main.dust[num157].noLight = true; - Main.dust[num157].velocity += projectile.velocity * 0.5f; + Main.dust[num157].velocity += Projectile.velocity * 0.5f; return; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Summon/WulfrumDroid.cs b/Projectiles/Summon/WulfrumDroid.cs index f6def8fff0..d40f86061f 100644 --- a/Projectiles/Summon/WulfrumDroid.cs +++ b/Projectiles/Summon/WulfrumDroid.cs @@ -14,40 +14,40 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Droid"); - Main.projFrames[projectile.type] = 12; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 12; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 26; - projectile.height = 32; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 26; + Projectile.height = 32; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 1f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - source = source.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; - Vector2 dustVel = source - projectile.Center; + Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 dustVel = source - Projectile.Center; int green = Dust.NewDust(source + dustVel, 0, 0, 61, dustVel.X * 1.1f, dustVel.Y * 1.1f, 100, default, 1.4f); Main.dust[green].noGravity = true; Main.dust[green].noLight = true; @@ -55,23 +55,23 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + Projectile.damage = damage2; } - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) { @@ -81,11 +81,11 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.wDroid) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } - projectile.MinionAntiClump(); - Vector2 targetVector = projectile.position; + Projectile.MinionAntiClump(); + Vector2 targetVector = Projectile.position; float range = 450f; bool foundTarget = false; int targetIndex = -1; @@ -94,8 +94,8 @@ namespace CalamityMod.Projectiles.Summon NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy((object) this, false)) { - float targetDist = Vector2.Distance(npc.Center, projectile.Center); - if ((!foundTarget && targetDist < range) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if ((!foundTarget && targetDist < range) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { range = targetDist; targetVector = npc.Center; @@ -111,8 +111,8 @@ namespace CalamityMod.Projectiles.Summon NPC npc = Main.npc[npcIndex]; if (npc.CanBeChasedBy((object) this, false)) { - float targetDist = Vector2.Distance(npc.Center, projectile.Center); - if ((!foundTarget && targetDist < range) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if ((!foundTarget && targetDist < range) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { range = targetDist; targetVector = npc.Center; @@ -125,90 +125,90 @@ namespace CalamityMod.Projectiles.Summon float separationAnxietyDist = 500f; if (foundTarget) separationAnxietyDist = 1000f; - if (Vector2.Distance(player.Center, projectile.Center) > separationAnxietyDist) + if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist) { - projectile.ai[0] = 1f; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; } - if (projectile.ai[0] == 1f) - projectile.tileCollide = false; - if (foundTarget && projectile.ai[0] == 0f) + if (Projectile.ai[0] == 1f) + Projectile.tileCollide = false; + if (foundTarget && Projectile.ai[0] == 0f) { - Vector2 targetPos = targetVector - projectile.Center; + Vector2 targetPos = targetVector - Projectile.Center; float targetDist = targetPos.Length(); targetPos.Normalize(); if (targetDist > 200f) { float speed = 6f; Vector2 goToTarget = targetPos * speed; - projectile.velocity.X = (projectile.velocity.X * 40f + goToTarget.X) / 41f; - projectile.velocity.Y = (projectile.velocity.Y * 40f + goToTarget.Y) / 41f; + Projectile.velocity.X = (Projectile.velocity.X * 40f + goToTarget.X) / 41f; + Projectile.velocity.Y = (Projectile.velocity.Y * 40f + goToTarget.Y) / 41f; } - else if (projectile.velocity.Y > -1f) - projectile.velocity.Y -= 0.1f; + else if (Projectile.velocity.Y > -1f) + Projectile.velocity.Y -= 0.1f; } else { - if (!Collision.CanHitLine(projectile.Center, 1, 1, player.Center, 1, 1)) - projectile.ai[0] = 1f; + if (!Collision.CanHitLine(Projectile.Center, 1, 1, player.Center, 1, 1)) + Projectile.ai[0] = 1f; float returnSpeed = 6f; - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) returnSpeed = 15f; - Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, -60f); + Vector2 playerVec = player.Center - Projectile.Center + new Vector2(0f, -60f); float playerDist = playerVec.Length(); if (playerDist > 200f && returnSpeed < 9f) returnSpeed = 9f; - if (playerDist < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerDist < 100f && Projectile.ai[0] == 1f && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (playerDist > 2000f) { - projectile.position.X = player.Center.X - (float) (projectile.width / 2); - projectile.position.Y = player.Center.Y - (float) (projectile.width / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (float) (Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float) (Projectile.width / 2); + Projectile.netUpdate = true; } else if (playerDist > 70f) { playerVec.Normalize(); - projectile.velocity = (projectile.velocity * 20f + playerVec * returnSpeed) / 21f; + Projectile.velocity = (Projectile.velocity * 20f + playerVec * returnSpeed) / 21f; } else { - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; } - projectile.velocity *= 1.01f; + Projectile.velocity *= 1.01f; } } - projectile.rotation = projectile.velocity.X * 0.05f; - if (projectile.velocity.X > 0f) - projectile.spriteDirection = projectile.direction = 1; - else if (projectile.velocity.X < 0f) - projectile.spriteDirection = projectile.direction = -1; - if (projectile.ai[1] > 0f) - projectile.ai[1] += (float) Main.rand.Next(1, 4); - if (projectile.ai[1] > 90f) + Projectile.rotation = Projectile.velocity.X * 0.05f; + if (Projectile.velocity.X > 0f) + Projectile.spriteDirection = Projectile.direction = 1; + else if (Projectile.velocity.X < 0f) + Projectile.spriteDirection = Projectile.direction = -1; + if (Projectile.ai[1] > 0f) + Projectile.ai[1] += (float) Main.rand.Next(1, 4); + if (Projectile.ai[1] > 90f) { - projectile.ai[1] = 0.0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0.0f; + Projectile.netUpdate = true; } - if (projectile.ai[1] != 0f) + if (Projectile.ai[1] != 0f) return; - ++projectile.ai[1]; - if (Main.myPlayer != projectile.owner) + ++Projectile.ai[1]; + if (Main.myPlayer != Projectile.owner) return; if (!foundTarget) return; - Vector2 velocity = targetVector - projectile.Center; + Vector2 velocity = targetVector - Projectile.Center; velocity.Normalize(); velocity *= 10f; - int bolt = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + int bolt = Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); Main.projectile[bolt].netUpdate = true; - projectile.netUpdate = true; + Projectile.netUpdate = true; } public override bool CanDamage() => false; diff --git a/Projectiles/Summon/YharonMinionFireball.cs b/Projectiles/Summon/YharonMinionFireball.cs index bfe190d799..a1f4d77f27 100644 --- a/Projectiles/Summon/YharonMinionFireball.cs +++ b/Projectiles/Summon/YharonMinionFireball.cs @@ -3,94 +3,95 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class YharonMinionFireball : ModProjectile { - public ref float InitialSpeed => ref projectile.ai[0]; + public ref float InitialSpeed => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Projectiles/Boss/YharonFireball"; public override void SetStaticDefaults() { DisplayName.SetDefault("Dragon Fireball"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.minion = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.minionSlots = 0f; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; + Projectile.width = 34; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.minionSlots = 0f; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; } public override void AI() { - projectile.frameCounter++; - projectile.frame = projectile.frameCounter / 5 % Main.projFrames[projectile.type]; - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.075f, 0f, 1f); + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.075f, 0f, 1f); if (InitialSpeed == 0f) { - InitialSpeed = projectile.velocity.Length(); - projectile.netUpdate = true; + InitialSpeed = Projectile.velocity.Length(); + Projectile.netUpdate = true; return; } - NPC potentialTarget = projectile.Center.MinionHoming(600f, Main.player[projectile.owner]); + NPC potentialTarget = Projectile.Center.MinionHoming(600f, Main.player[Projectile.owner]); if (potentialTarget != null) - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(potentialTarget.Center) * InitialSpeed, 0.15f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(potentialTarget.Center) * InitialSpeed, 0.15f); } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Texture2D texture = Main.projectileTexture[Projectile.type]; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); SpriteEffects direction = SpriteEffects.None; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) direction = SpriteEffects.FlipHorizontally; if (CalamityConfig.Instance.Afterimages) { - for (int i = 0; i < projectile.oldPos.Length; i++) + for (int i = 0; i < Projectile.oldPos.Length; i++) { - Vector2 afterimageDrawPosition = projectile.oldPos[i] + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - Color afterimageColor = projectile.GetAlpha(lightColor) * ((projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); - spriteBatch.Draw(texture, afterimageDrawPosition, frame, afterimageColor, projectile.rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + Vector2 afterimageDrawPosition = Projectile.oldPos[i] + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color afterimageColor = Projectile.GetAlpha(lightColor) * ((Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); + spriteBatch.Draw(texture, afterimageDrawPosition, frame, afterimageColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); } } - Vector2 drawPosition = projectile.Center - Main.screenPosition - Vector2.UnitY * projectile.gfxOffY; - spriteBatch.Draw(texture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + Vector2 drawPosition = Projectile.Center - Main.screenPosition - Vector2.UnitY * Projectile.gfxOffY; + spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item74, projectile.Center); + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); for (int d = 0; d < 2; d++) - Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 55, 0f, 0f, 50, default, 1.5f); for (int d = 0; d < 20; d++) { - Dust fire = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, default, 2.2f); + Dust fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, default, 2.2f); fire.noGravity = true; fire.velocity *= 4f; - fire = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 50, default, 1.5f); + fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 50, default, 1.5f); fire.velocity *= 5f; fire.noGravity = true; } diff --git a/Projectiles/Summon/YoungDuke.cs b/Projectiles/Summon/YoungDuke.cs index c349a3861c..99298b7c4e 100644 --- a/Projectiles/Summon/YoungDuke.cs +++ b/Projectiles/Summon/YoungDuke.cs @@ -13,36 +13,36 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Young Old Duke"); - Main.projFrames[projectile.type] = 16; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 16; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.minion = true; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.miniOldDuke) { - projectile.active = false; + Projectile.active = false; return; } - bool correctMinion = projectile.type == ModContent.ProjectileType(); + bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (correctMinion) { if (player.dead) @@ -51,74 +51,74 @@ namespace CalamityMod.Projectiles.Summon } if (modPlayer.youngDuke) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } // Adjust damage as needed - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = trueDamage; + Projectile.damage = trueDamage; } bool playerHalfLife = player.statLife <= player.statLifeMax2 * 0.5f; // Frames - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - if (playerHalfLife && projectile.frame < Main.projFrames[projectile.type] / 2) + if (playerHalfLife && Projectile.frame < Main.projFrames[Projectile.type] / 2) { - projectile.frame += Main.projFrames[projectile.type] / 2; + Projectile.frame += Main.projFrames[Projectile.type] / 2; } - else if (!playerHalfLife && projectile.frame >= Main.projFrames[projectile.type] / 2) + else if (!playerHalfLife && Projectile.frame >= Main.projFrames[Projectile.type] / 2) { - projectile.frame -= Main.projFrames[projectile.type] / 2; + Projectile.frame -= Main.projFrames[Projectile.type] / 2; } - NPC potentialTarget = projectile.Center.ClosestNPCAt(1600f); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(1600f); if (potentialTarget != null) { - if (projectile.Distance(potentialTarget.Center) < DistanceBeforeCharge) + if (Projectile.Distance(potentialTarget.Center) < DistanceBeforeCharge) { - projectile.ai[0] += 1f; + Projectile.ai[0] += 1f; int timePerCharge = playerHalfLife ? 25 : 35; float chargeSpeed = playerHalfLife ? 25f : 20f; - if (projectile.ai[0] >= timePerCharge) + if (Projectile.ai[0] >= timePerCharge) { - projectile.velocity = projectile.SafeDirectionTo(potentialTarget.Center) * chargeSpeed; - projectile.ai[0] = 0f; + Projectile.velocity = Projectile.SafeDirectionTo(potentialTarget.Center) * chargeSpeed; + Projectile.ai[0] = 0f; } else - projectile.velocity *= 0.9825f; + Projectile.velocity *= 0.9825f; } else { float intertia = 0.94f; float homeSpeed = playerHalfLife ? 38f : 32f; - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(potentialTarget.Center) * homeSpeed, 1f - intertia); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(potentialTarget.Center) * homeSpeed, 1f - intertia); } } - else if (!projectile.WithinRange(player.Center, 140f)) - projectile.velocity = (projectile.velocity * 30f + projectile.SafeDirectionTo(player.Center) * 16f) / 31f; + else if (!Projectile.WithinRange(player.Center, 140f)) + Projectile.velocity = (Projectile.velocity * 30f + Projectile.SafeDirectionTo(player.Center) * 16f) / 31f; - projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + Projectile.direction = Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); } } } diff --git a/Projectiles/Typeless/AeroExplosive.cs b/Projectiles/Typeless/AeroExplosive.cs index e5b2b262f8..2183c077ca 100644 --- a/Projectiles/Typeless/AeroExplosive.cs +++ b/Projectiles/Typeless/AeroExplosive.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -18,80 +19,80 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 15; - projectile.height = 15; - projectile.friendly = true; - projectile.tileCollide = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; + Projectile.width = 15; + Projectile.height = 15; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.timeLeft < 2) + if (Projectile.timeLeft < 2) { - projectile.damage = AeroDynamite.Damage; // Like most explosives, not boosted by damage boosts - projectile.knockBack = AeroDynamite.Knockback; + Projectile.damage = AeroDynamite.Damage; // Like most explosives, not boosted by damage boosts + Projectile.knockBack = AeroDynamite.Knockback; } - if (projectile.timeLeft % 4 == 0 && projectile.timeLeft < 270) - projectile.ai[0]++; - projectile.velocity *= 0.999f - projectile.ai[0] * Main.rand.NextFloat(0.00075f, 0.00125f); - projectile.rotation += projectile.velocity.Length() * 0.09f * projectile.direction; + if (Projectile.timeLeft % 4 == 0 && Projectile.timeLeft < 270) + Projectile.ai[0]++; + Projectile.velocity *= 0.999f - Projectile.ai[0] * Main.rand.NextFloat(0.00075f, 0.00125f); + Projectile.rotation += Projectile.velocity.Length() * 0.09f * Projectile.direction; if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); } if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 16, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 16, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } if (Main.rand.NextBool()) { - int smoke = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1f); + int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1f); Main.dust[smoke].scale = 0.1f + Main.rand.NextFloat(0f, 0.5f); Main.dust[smoke].fadeIn = 1.5f + Main.rand.NextFloat(0f, 0.5f); Main.dust[smoke].noGravity = true; - Main.dust[smoke].position = projectile.Center + new Vector2(0f, -projectile.height / 2f).RotatedBy(projectile.rotation, default) * 1.1f; - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); + Main.dust[smoke].position = Projectile.Center + new Vector2(0f, -Projectile.height / 2f).RotatedBy(Projectile.rotation, default) * 1.1f; + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); Main.dust[fire].scale = 1f + Main.rand.NextFloat(0f, 0.5f); Main.dust[fire].noGravity = true; - Main.dust[fire].position = projectile.Center + new Vector2(0f, -projectile.height / 2f).RotatedBy(projectile.rotation, default) * 1.1f; + Main.dust[fire].position = Projectile.Center + new Vector2(0f, -Projectile.height / 2f).RotatedBy(Projectile.rotation, default) * 1.1f; } } // Makes the projectile bounce infinitely, but lose a ton of speed on bounce. public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - if (projectile.velocity.X != oldVelocity.X) + Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X * 0.1f; + Projectile.velocity.X = -oldVelocity.X * 0.1f; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y * 0.1f; + Projectile.velocity.Y = -oldVelocity.Y * 0.1f; } return false; } public override void Kill(int timeLeft) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 200); - projectile.maxPenetrate = projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 200); + Projectile.maxPenetrate = Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int d = 0; d < 40; d++) { - int smoke = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); + int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Main.dust[smoke].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -101,19 +102,19 @@ namespace CalamityMod.Projectiles.Typeless } for (int d = 0; d < 70; d++) { - int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 15); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 15); - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ExplodeandDestroyTiles(projectile, 7, true, new List() { }, new List() { }); + CalamityUtils.ExplodeandDestroyTiles(Projectile, 7, true, new List() { }, new List() { }); } } } diff --git a/Projectiles/Typeless/AllianceTriangle.cs b/Projectiles/Typeless/AllianceTriangle.cs index 086161f55e..442cc5995e 100644 --- a/Projectiles/Typeless/AllianceTriangle.cs +++ b/Projectiles/Typeless/AllianceTriangle.cs @@ -13,43 +13,43 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 154; - projectile.height = 134; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.alpha = 254; + Projectile.width = 154; + Projectile.height = 134; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.alpha = 254; } public override void AI() { - Player player = Main.player[projectile.owner]; - Lighting.AddLight(projectile.Center, new Vector3(240, 185, 7) * (3f / 255)); - projectile.Center = player.Center; + Player player = Main.player[Projectile.owner]; + Lighting.AddLight(Projectile.Center, new Vector3(240, 185, 7) * (3f / 255)); + Projectile.Center = player.Center; - projectile.ai[0]++; - if (projectile.ai[0] <= 5f) + Projectile.ai[0]++; + if (Projectile.ai[0] <= 5f) { - projectile.alpha -= 75; - if (projectile.alpha < 0) - projectile.alpha = 0; + Projectile.alpha -= 75; + if (Projectile.alpha < 0) + Projectile.alpha = 0; } else { - projectile.scale *= 1.06f; - projectile.alpha += 10; + Projectile.scale *= 1.06f; + Projectile.alpha += 10; } - if (projectile.alpha >= 255 || player is null || player.dead) + if (Projectile.alpha >= 255 || player is null || player.dead) { - projectile.Kill(); + Projectile.Kill(); } } public override Color? GetAlpha(Color lightColor) { - if (projectile.alpha <= 0) + if (Projectile.alpha <= 0) return new Color(200, 200, 200, 200); return null; } diff --git a/Projectiles/Typeless/ArtifactOfResilienceShards.cs b/Projectiles/Typeless/ArtifactOfResilienceShards.cs index 0319e169ff..1444495cfc 100644 --- a/Projectiles/Typeless/ArtifactOfResilienceShards.cs +++ b/Projectiles/Typeless/ArtifactOfResilienceShards.cs @@ -21,31 +21,31 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Artifact Shard"); - Main.projFrames[projectile.type] = 1; + Main.projFrames[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = MaxTimeLeft; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = MaxTimeLeft; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.frameCounter); + writer.Write(Projectile.frameCounter); writer.WriteVector2(StartingPosition); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.frameCounter = reader.ReadInt32(); + Projectile.frameCounter = reader.ReadInt32(); StartingPosition = reader.ReadVector2(); } @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Typeless } } public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShardAI(projectile, ref StartingPosition, ref Timer); + public override void AI() => ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); } public class ArtifactOfResilienceShard2 : ModProjectile { @@ -146,36 +146,36 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Artifact Shard"); - Main.projFrames[projectile.type] = 1; + Main.projFrames[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.frameCounter); + writer.Write(Projectile.frameCounter); writer.WriteVector2(StartingPosition); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.frameCounter = reader.ReadInt32(); + Projectile.frameCounter = reader.ReadInt32(); StartingPosition = reader.ReadVector2(); } public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(projectile, ref StartingPosition, ref Timer); + public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); } public class ArtifactOfResilienceShard3 : ModProjectile { @@ -185,35 +185,35 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Artifact Shard"); - Main.projFrames[projectile.type] = 1; + Main.projFrames[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.frameCounter); + writer.Write(Projectile.frameCounter); writer.WriteVector2(StartingPosition); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.frameCounter = reader.ReadInt32(); + Projectile.frameCounter = reader.ReadInt32(); StartingPosition = reader.ReadVector2(); } public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(projectile, ref StartingPosition, ref Timer); + public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); } public class ArtifactOfResilienceShard4 : ModProjectile { @@ -223,35 +223,35 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Artifact Shard"); - Main.projFrames[projectile.type] = 1; + Main.projFrames[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.frameCounter); + writer.Write(Projectile.frameCounter); writer.WriteVector2(StartingPosition); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.frameCounter = reader.ReadInt32(); + Projectile.frameCounter = reader.ReadInt32(); StartingPosition = reader.ReadVector2(); } public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(projectile, ref StartingPosition, ref Timer); + public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); } public class ArtifactOfResilienceShard5 : ModProjectile { @@ -261,35 +261,35 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Artifact Shard"); - Main.projFrames[projectile.type] = 1; + Main.projFrames[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.frameCounter); + writer.Write(Projectile.frameCounter); writer.WriteVector2(StartingPosition); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.frameCounter = reader.ReadInt32(); + Projectile.frameCounter = reader.ReadInt32(); StartingPosition = reader.ReadVector2(); } public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(projectile, ref StartingPosition, ref Timer); + public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); } public class ArtifactOfResilienceShard6 : ModProjectile { @@ -299,34 +299,34 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Artifact Shard"); - Main.projFrames[projectile.type] = 1; + Main.projFrames[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.frameCounter); + writer.Write(Projectile.frameCounter); writer.WriteVector2(StartingPosition); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.frameCounter = reader.ReadInt32(); + Projectile.frameCounter = reader.ReadInt32(); StartingPosition = reader.ReadVector2(); } public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(projectile, ref StartingPosition, ref Timer); + public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); } } diff --git a/Projectiles/Typeless/AstralFallingSand.cs b/Projectiles/Typeless/AstralFallingSand.cs index 86a3288bff..29d8e15e21 100644 --- a/Projectiles/Typeless/AstralFallingSand.cs +++ b/Projectiles/Typeless/AstralFallingSand.cs @@ -11,30 +11,30 @@ namespace CalamityMod.Projectiles.Typeless { public override void SetDefaults() { - projectile.knockBack = 6f; - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = -1; - projectile.friendly = true; - projectile.hostile = true; - projectile.penetrate = -1; + Projectile.knockBack = 6f; + Projectile.width = 10; + Projectile.height = 10; + Projectile.aiStyle = -1; + Projectile.friendly = true; + Projectile.hostile = true; + Projectile.penetrate = -1; base.SetDefaults(); } public override void Kill(int timeLeft) { - Point p = projectile.Center.ToTileCoordinates(); + Point p = Projectile.Center.ToTileCoordinates(); // If the sand is dying outside the world border, cancel placing sand. if (p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY) return; Tile t = Main.tile[p.X, p.Y]; // If the sand hit a half brick, but was mostly going downwards (at a lower than 45 degree angle), then stack atop the half brick. - if (t.halfBrick() && projectile.velocity.Y > 0f && Math.Abs(projectile.velocity.Y) > Math.Abs(projectile.velocity.X)) + if (t.halfBrick() && Projectile.velocity.Y > 0f && Math.Abs(Projectile.velocity.Y) > Math.Abs(Projectile.velocity.X)) t = Main.tile[p.X, --p.Y]; // Under no circumstances can falling sand destroy minecart tracks. - if (!t.active() && t.type != TileID.MinecartTrack) + if (!t.active() && t.TileType != TileID.MinecartTrack) { WorldGen.PlaceTile(p.X, p.Y, ModContent.TileType(), false, true); WorldGen.SquareTileFrame(p.X, p.Y); @@ -45,14 +45,14 @@ namespace CalamityMod.Projectiles.Typeless { if (Main.rand.NextBool(2)) { - int i = Dust.NewDust(projectile.position, projectile.width, projectile.height, 108, 0f, projectile.velocity.Y * 0.5f); + int i = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 108, 0f, Projectile.velocity.Y * 0.5f); Main.dust[i].velocity.X *= 0.2f; } - projectile.velocity.Y += 0.2f; - projectile.rotation += 0.1f; - if (projectile.velocity.Y > 10f) + Projectile.velocity.Y += 0.2f; + Projectile.rotation += 0.1f; + if (Projectile.velocity.Y > 10f) { - projectile.velocity.Y = 10f; + Projectile.velocity.Y = 10f; } base.AI(); } diff --git a/Projectiles/Typeless/AstralSpray.cs b/Projectiles/Typeless/AstralSpray.cs index eab7a3aa49..3ef01689cc 100644 --- a/Projectiles/Typeless/AstralSpray.cs +++ b/Projectiles/Typeless/AstralSpray.cs @@ -9,55 +9,55 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.aiStyle = -1; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.tileCollide = false; - projectile.ignoreWater = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.aiStyle = -1; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; } public override bool CanDamage() => false; public override bool PreAI() { - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - int x = (int)(projectile.Center.X / 16f); - int y = (int)(projectile.Center.Y / 16f); + int x = (int)(Projectile.Center.X / 16f); + int y = (int)(Projectile.Center.Y / 16f); AstralBiome.ConvertToAstral(x - 1, x + 1, y - 1, y + 1); } - if (projectile.timeLeft > 133) + if (Projectile.timeLeft > 133) { - projectile.timeLeft = 133; + Projectile.timeLeft = 133; } - if (projectile.ai[0] > 7f) + if (Projectile.ai[0] > 7f) { float scalar = 1f; - if (projectile.ai[0] == 8f) + if (Projectile.ai[0] == 8f) { scalar = 0.2f; } - else if (projectile.ai[0] == 9f) + else if (Projectile.ai[0] == 9f) { scalar = 0.4f; } - else if (projectile.ai[0] == 10f) + else if (Projectile.ai[0] == 10f) { scalar = 0.6f; } - else if (projectile.ai[0] == 11f) + else if (Projectile.ai[0] == 11f) { scalar = 0.8f; } - projectile.ai[0]++; + Projectile.ai[0]++; for (int i = 0; i < 1; i++) { - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 118, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 118, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100); Main.dust[d].noGravity = true; Main.dust[d].scale *= 1.75f * scalar; Main.dust[d].velocity.X *= 2f; @@ -66,9 +66,9 @@ namespace CalamityMod.Projectiles.Typeless } else { - projectile.ai[0]++; + Projectile.ai[0]++; } - projectile.rotation += 0.3f * projectile.direction; + Projectile.rotation += 0.3f * Projectile.direction; return false; } } diff --git a/Projectiles/Typeless/AstralStar.cs b/Projectiles/Typeless/AstralStar.cs index 8257b38b32..c197468012 100644 --- a/Projectiles/Typeless/AstralStar.cs +++ b/Projectiles/Typeless/AstralStar.cs @@ -6,6 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -16,78 +17,78 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.alpha = 50; - projectile.penetrate = 1; - projectile.tileCollide = false; + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.alpha = 50; + Projectile.penetrate = 1; + Projectile.tileCollide = false; } public override void AI() { - if (projectile.ai[0] == 3f) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20); + if (Projectile.ai[0] == 3f) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 300f, 12f, 20); - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - projectile.Calamity().rogue = true; + Projectile.Calamity().rogue = true; } int randomToSubtract = Main.rand.Next(1, 3); noTileHitCounter -= randomToSubtract; if (noTileHitCounter == 0) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - if (projectile.soundDelay == 0) + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); + Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 9); + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 9); } } - projectile.alpha -= 15; + Projectile.alpha -= 15; int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) + if (Projectile.Center.Y >= Projectile.ai[1]) { num58 = 0; } - if (projectile.alpha < num58) + if (Projectile.alpha < num58) { - projectile.alpha = num58; + Projectile.alpha = num58; } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType(), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; + Main.dust[num59].position = Projectile.Center + value3 * 12f; } if (Main.rand.NextBool(48)) { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + int num60 = Gore.NewGore(Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; + Main.gore[num60].velocity += Projectile.velocity * 0.3f; } - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) { - projectile.light = 0.9f; + Projectile.light = 0.9f; if (Main.rand.NextBool(10)) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType(), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } if (Main.rand.NextBool(20)) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } } @@ -104,20 +105,20 @@ namespace CalamityMod.Projectiles.Typeless public override Color? GetAlpha(Color lightColor) { - return new Color(200, 100, 250, projectile.alpha); + return new Color(200, 100, 250, Projectile.alpha); } public override void Kill(int timeLeft) { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -127,21 +128,21 @@ namespace CalamityMod.Projectiles.Typeless } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } for (int num480 = 0; num480 < 3; num480++) { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + Gore.NewGore(Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Typeless/AtaxiaOrb.cs b/Projectiles/Typeless/AtaxiaOrb.cs index 39346646d2..bab671a777 100644 --- a/Projectiles/Typeless/AtaxiaOrb.cs +++ b/Projectiles/Typeless/AtaxiaOrb.cs @@ -16,25 +16,25 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.tileCollide = false; - projectile.timeLeft = 200; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 200; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 170 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 170 && target.CanBeChasedBy(Projectile); public override void AI() { - Dust fire = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, 2f); + Dust fire = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); fire.noGravity = true; fire.velocity = Vector2.Zero; - if (projectile.timeLeft < 170) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 9f, 20f); + if (Projectile.timeLeft < 170) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 9f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Typeless/BallisticPoisonCloud.cs b/Projectiles/Typeless/BallisticPoisonCloud.cs index eb20f4d4f2..84fe059061 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud.cs @@ -10,55 +10,55 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 10; + Main.projFrames[Projectile.type] = 10; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 3600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; } public override void AI() { - projectile.ai[0] += 1f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.ai[0] += 1f; + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.ai[0] < 219f) //255 - frameCounter tick * number of disippation frames + if (Projectile.ai[0] < 219f) //255 - frameCounter tick * number of disippation frames { - if (projectile.frame >= 4) + if (Projectile.frame >= 4) { - projectile.frame = 0; + Projectile.frame = 0; } } - else if (projectile.owner == Main.myPlayer && projectile.frame >= Main.projFrames[projectile.type]) + else if (Projectile.owner == Main.myPlayer && Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.Kill(); + Projectile.Kill(); } - projectile.velocity *= 0.98f; - if (projectile.alpha > 80) + Projectile.velocity *= 0.98f; + if (Projectile.alpha > 80) { - projectile.alpha -= 30; - if (projectile.alpha < 80) + Projectile.alpha -= 30; + if (Projectile.alpha < 80) { - projectile.alpha = 80; + Projectile.alpha = 80; } } - if (Math.Abs(projectile.velocity.X) > 0.1f) + if (Math.Abs(Projectile.velocity.X) > 0.1f) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } } diff --git a/Projectiles/Typeless/BlazingSun.cs b/Projectiles/Typeless/BlazingSun.cs index 44fa368b11..25882758d5 100644 --- a/Projectiles/Typeless/BlazingSun.cs +++ b/Projectiles/Typeless/BlazingSun.cs @@ -16,48 +16,48 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 130; - projectile.height = 130; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.penetrate = -1; + Projectile.width = 130; + Projectile.height = 130; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.alpha = 255; + Projectile.timeLeft = 600; + Projectile.penetrate = -1; } public override void AI() { - if (projectile.ai[0] < 45) - projectile.ai[0]++; + if (Projectile.ai[0] < 45) + Projectile.ai[0]++; //Alpha - if (projectile.timeLeft > 50) + if (Projectile.timeLeft > 50) { - if (projectile.alpha > 50) - projectile.alpha -= 5; - if (projectile.alpha < 50) - projectile.alpha = 50; + if (Projectile.alpha > 50) + Projectile.alpha -= 5; + if (Projectile.alpha < 50) + Projectile.alpha = 50; } else { - if(projectile.alpha < 255) - projectile.alpha += 5; - if (projectile.alpha > 255) - projectile.alpha = 255; + if(Projectile.alpha < 255) + Projectile.alpha += 5; + if (Projectile.alpha > 255) + Projectile.alpha = 255; } //Rotation - projectile.rotation += 0.025f; + Projectile.rotation += 0.025f; //Light - Lighting.AddLight(projectile.Center, new Vector3(240, 185, 7) * (3f / 255)); + Lighting.AddLight(Projectile.Center, new Vector3(240, 185, 7) * (3f / 255)); //Dust - if(projectile.timeLeft > 40) + if(Projectile.timeLeft > 40) { - Vector2 Dpos = projectile.Center + new Vector2(Main.rand.NextFloat(80f,100f), Main.rand.NextFloat(80f,100f)).RotatedBy(MathHelper.ToRadians(Main.rand.Next(1,360))); - Vector2 Dspeed = Dpos - projectile.Center; + Vector2 Dpos = Projectile.Center + new Vector2(Main.rand.NextFloat(80f,100f), Main.rand.NextFloat(80f,100f)).RotatedBy(MathHelper.ToRadians(Main.rand.Next(1,360))); + Vector2 Dspeed = Dpos - Projectile.Center; Dspeed.Normalize(); Dspeed *= -5f; float Dscale = Main.rand.NextFloat(1.5f, 2f); @@ -66,19 +66,19 @@ namespace CalamityMod.Projectiles.Typeless } //Suction - if (projectile.ai[0] >= 45) + if (Projectile.ai[0] >= 45) { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; + float num472 = Projectile.Center.X; + float num473 = Projectile.Center.Y; float num474 = 600f; for (int num475 = 0; num475 < 200; num475++) { NPC npc = Main.npc[num475]; - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { float npcCenterX = npc.position.X + (float)(npc.width / 2); float npcCenterY = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); + float num478 = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY); if (num478 < num474) { if (npc.position.X < num472) diff --git a/Projectiles/Typeless/BlazingSun2.cs b/Projectiles/Typeless/BlazingSun2.cs index 676c01f6e9..b07eba89a9 100644 --- a/Projectiles/Typeless/BlazingSun2.cs +++ b/Projectiles/Typeless/BlazingSun2.cs @@ -11,37 +11,37 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 130; - projectile.height = 130; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.penetrate = -1; + Projectile.width = 130; + Projectile.height = 130; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + Projectile.alpha = 255; + Projectile.timeLeft = 600; + Projectile.penetrate = -1; } public override void AI() { //Alpha - if (projectile.timeLeft > 50) + if (Projectile.timeLeft > 50) { - if (projectile.alpha > 50) - projectile.alpha -= 5; - if (projectile.alpha < 50) - projectile.alpha = 50; + if (Projectile.alpha > 50) + Projectile.alpha -= 5; + if (Projectile.alpha < 50) + Projectile.alpha = 50; } else { - if (projectile.alpha < 255) - projectile.alpha += 5; - if (projectile.alpha > 255) - projectile.alpha = 255; + if (Projectile.alpha < 255) + Projectile.alpha += 5; + if (Projectile.alpha > 255) + Projectile.alpha = 255; } //Rotation - projectile.rotation -= 0.025f; + Projectile.rotation -= 0.025f; } } diff --git a/Projectiles/Typeless/BloodBomb.cs b/Projectiles/Typeless/BloodBomb.cs index 529ca96f00..33b1766b92 100644 --- a/Projectiles/Typeless/BloodBomb.cs +++ b/Projectiles/Typeless/BloodBomb.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -16,36 +17,36 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 600; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.4f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.4f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 73); + Projectile.localAI[0] += 1f; } for (int num457 = 0; num457 < 3; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.2f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.2f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Typeless/BloodBombExplosion.cs b/Projectiles/Typeless/BloodBombExplosion.cs index 3bc242d30a..f1a79ed80e 100644 --- a/Projectiles/Typeless/BloodBombExplosion.cs +++ b/Projectiles/Typeless/BloodBombExplosion.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -17,59 +18,59 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 250; + Projectile.height = 250; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 1f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 1f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 74); + Projectile.localAI[0] += 1f; } bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -80,11 +81,11 @@ namespace CalamityMod.Projectiles.Typeless num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 1.8f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 5, 0f, 0f, 100, default, 1.8f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Typeless/BlunderBoosterAura.cs b/Projectiles/Typeless/BlunderBoosterAura.cs index 5424027daf..368d4165fd 100644 --- a/Projectiles/Typeless/BlunderBoosterAura.cs +++ b/Projectiles/Typeless/BlunderBoosterAura.cs @@ -17,52 +17,52 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Red Lightning Aura"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 218; - projectile.height = 218; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.timeLeft *= 5; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 25; + Projectile.width = 218; + Projectile.height = 218; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.timeLeft *= 5; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 25; } public override void AI() { //Protect against other mod projectile reflection like emode Granite Golems - projectile.friendly = true; - projectile.hostile = false; + Projectile.friendly = true; + Projectile.hostile = false; - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.localAI[0]++; - projectile.frameCounter = 0; + Projectile.localAI[0]++; + Projectile.frameCounter = 0; } - if (projectile.localAI[0] >= framesY) + if (Projectile.localAI[0] >= framesY) { - projectile.localAI[0] = 0; - projectile.localAI[1]++; + Projectile.localAI[0] = 0; + Projectile.localAI[1]++; } - if (projectile.localAI[1] >= framesX) + if (Projectile.localAI[1] >= framesX) { - projectile.localAI[1] = 0; + Projectile.localAI[1] = 0; } - Player player = Main.player[projectile.owner]; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.01f / 255f); - projectile.Center = player.Center; + Player player = Main.player[Projectile.owner]; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + Projectile.Center = player.Center; if (player is null || player.dead) { player.Calamity().blunderBooster = false; - projectile.Kill(); + Projectile.Kill(); } } @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Typeless { knockbackMultiplier = 0; } - Vector2 trueKnockback = target.Center - projectile.Center; + Vector2 trueKnockback = target.Center - Projectile.Center; trueKnockback.Normalize(); target.velocity = trueKnockback * knockbackMultiplier; } @@ -93,20 +93,20 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D sprite = Main.projectileTexture[projectile.type]; + Texture2D sprite = Main.projectileTexture[Projectile.type]; Color drawColour = Color.White; - Rectangle sourceRect = new Rectangle(projectile.width * (int)projectile.localAI[1], projectile.height * (int)projectile.localAI[0], projectile.width, projectile.height); - Vector2 origin = new Vector2(projectile.width / 2, projectile.height / 2); + Rectangle sourceRect = new Rectangle(Projectile.width * (int)Projectile.localAI[1], Projectile.height * (int)Projectile.localAI[0], Projectile.width, Projectile.height); + Vector2 origin = new Vector2(Projectile.width / 2, Projectile.height / 2); float opacity = 1f; int sparkCount = 0; int fadeTime = 20; - if (projectile.timeLeft < fadeTime) + if (Projectile.timeLeft < fadeTime) { - opacity = projectile.timeLeft * (1f / fadeTime); - sparkCount = fadeTime - projectile.timeLeft; + opacity = Projectile.timeLeft * (1f / fadeTime); + sparkCount = fadeTime - Projectile.timeLeft; } for (int i = 0; i < sparkCount * 2; i++) @@ -122,15 +122,15 @@ namespace CalamityMod.Projectiles.Typeless dustPos.Normalize(); dustPos *= radius + Main.rand.NextFloat(-rangeDiff, rangeDiff); - int dust = Dust.NewDust(projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); + int dust = Dust.NewDust(Projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); Main.dust[dust].noGravity = true; } - spriteBatch.Draw(sprite, projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(sprite, Projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); public override bool? CanHitNPC(NPC target) { diff --git a/Projectiles/Typeless/BobbitHead.cs b/Projectiles/Typeless/BobbitHead.cs index a92519919a..83801289ab 100644 --- a/Projectiles/Typeless/BobbitHead.cs +++ b/Projectiles/Typeless/BobbitHead.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.GemHookAmethyst); + Projectile.CloneDefaults(ProjectileID.GemHookAmethyst); } // Use this hook for hooks that can have multiple hooks mid-flight: Dual Hook, Web Slinger, Fish Hook, Static Hook, Lunar Hook @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Typeless int hooksOut = 0; for (int l = 0; l < Main.maxProjectiles; l++) { - if (Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type) + if (Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == Projectile.type) { hooksOut++; } @@ -62,18 +62,18 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawHook(projectile, GetTexture("CalamityMod/ExtraTextures/Chains/BobbitHookChain")); + CalamityUtils.DrawHook(Projectile, GetTexture("CalamityMod/ExtraTextures/Chains/BobbitHookChain")); return true; } public override void AI() { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; - if (projectile.ai[0] == 2f) - projectile.extraUpdates = 1; + if (Projectile.ai[0] == 2f) + Projectile.extraUpdates = 1; else - projectile.extraUpdates = 0; + Projectile.extraUpdates = 0; } } } diff --git a/Projectiles/Typeless/BossRushEffectThing.cs b/Projectiles/Typeless/BossRushEffectThing.cs index a3d353f3e4..a976bbb51f 100644 --- a/Projectiles/Typeless/BossRushEffectThing.cs +++ b/Projectiles/Typeless/BossRushEffectThing.cs @@ -9,23 +9,23 @@ namespace CalamityMod.Projectiles.Typeless { public class BossRushEffectThing : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float Time => ref projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.aiStyle = -1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = BossRushEvent.StartEffectTotalTime; - projectile.penetrate = -1; + Projectile.width = 2; + Projectile.height = 2; + Projectile.aiStyle = -1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = BossRushEvent.StartEffectTotalTime; + Projectile.penetrate = -1; } public override void AI() { - projectile.Center = Owner.Center; + Projectile.Center = Owner.Center; if (Time >= 70f) MoonlordDeathDrama.RequestLight(Utils.InverseLerp(70f, 85f, Time, true), Main.LocalPlayer.Center); @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Typeless BossRushEvent.SyncStartTimer((int)Time); float currentShakePower = MathHelper.Lerp(8f, 12f, Utils.InverseLerp(BossRushEvent.StartEffectTotalTime * 0.6f, BossRushEvent.StartEffectTotalTime, Time, true)); - currentShakePower *= 1f - Utils.InverseLerp(1500f, 3700f, Main.LocalPlayer.Distance(projectile.Center), true); + currentShakePower *= 1f - Utils.InverseLerp(1500f, 3700f, Main.LocalPlayer.Distance(Projectile.Center), true); Main.LocalPlayer.Calamity().GeneralScreenShakePower = currentShakePower; Time++; @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Typeless CalamityNetcode.SyncWorld(); if (Main.netMode == NetmodeID.Server) { - var netMessage = mod.GetPacket(); + var netMessage = Mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.BossRushStage); netMessage.Write(BossRushEvent.BossRushStage); netMessage.Send(); diff --git a/Projectiles/Typeless/BossRushEndEffectThing.cs b/Projectiles/Typeless/BossRushEndEffectThing.cs index acccecce51..0630a9e7d8 100644 --- a/Projectiles/Typeless/BossRushEndEffectThing.cs +++ b/Projectiles/Typeless/BossRushEndEffectThing.cs @@ -4,37 +4,38 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Events; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class BossRushEndEffectThing : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float Time => ref projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.aiStyle = -1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = BossRushEvent.EndVisualEffectTime; - projectile.penetrate = -1; + Projectile.width = 2; + Projectile.height = 2; + Projectile.aiStyle = -1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = BossRushEvent.EndVisualEffectTime; + Projectile.penetrate = -1; } public override void AI() { if (Time == 25f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BossRushEnd"), Main.LocalPlayer.Center); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BossRushEnd"), Main.LocalPlayer.Center); - projectile.Center = Owner.Center; + Projectile.Center = Owner.Center; BossRushEvent.SyncEndTimer((int)Time); - float currentShakePower = MathHelper.Lerp(1f, 20f, Utils.InverseLerp(140f, 180f, Time, true) * Utils.InverseLerp(10f, 40f, projectile.timeLeft, true)); + float currentShakePower = MathHelper.Lerp(1f, 20f, Utils.InverseLerp(140f, 180f, Time, true) * Utils.InverseLerp(10f, 40f, Projectile.timeLeft, true)); Main.LocalPlayer.Calamity().GeneralScreenShakePower = currentShakePower; - MoonlordDeathDrama.RequestLight(Utils.InverseLerp(220f, 265f, Time, true) * Utils.InverseLerp(10f, 30f, projectile.timeLeft, true), Main.LocalPlayer.Center); + MoonlordDeathDrama.RequestLight(Utils.InverseLerp(220f, 265f, Time, true) * Utils.InverseLerp(10f, 30f, Projectile.timeLeft, true), Main.LocalPlayer.Center); Time++; } diff --git a/Projectiles/Typeless/BossRushFailureEffectThing.cs b/Projectiles/Typeless/BossRushFailureEffectThing.cs index 26a7ce475f..f3c82d3559 100644 --- a/Projectiles/Typeless/BossRushFailureEffectThing.cs +++ b/Projectiles/Typeless/BossRushFailureEffectThing.cs @@ -3,23 +3,24 @@ using Terraria; using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class BossRushFailureEffectThing : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float Time => ref projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.aiStyle = -1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 120; - projectile.penetrate = -1; + Projectile.width = 2; + Projectile.height = 2; + Projectile.aiStyle = -1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 120; + Projectile.penetrate = -1; } public override void AI() @@ -27,9 +28,9 @@ namespace CalamityMod.Projectiles.Typeless MoonlordDeathDrama.RequestLight(Utils.InverseLerp(0f, 8f, Time, true), Main.LocalPlayer.Center); if (Time >= 45f) { - Main.PlaySound(SoundID.DD2_EtherianPortalOpen, Main.LocalPlayer.Center); + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalOpen, Main.LocalPlayer.Center); BossRushEvent.End(); - projectile.Kill(); + Projectile.Kill(); } Time++; } diff --git a/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs b/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs index a1f250d65d..659794e807 100644 --- a/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs +++ b/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -18,40 +19,40 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 50; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 50; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item, (int)Projectile.position.X, (int)Projectile.position.Y, 20); + Projectile.localAI[0] += 1f; } for (int num457 = 0; num457 < 5; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 0.6f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 0.6f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } return; } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } diff --git a/Projectiles/Typeless/ChaosBlaze.cs b/Projectiles/Typeless/ChaosBlaze.cs index 449c733fb1..d5228cb60d 100644 --- a/Projectiles/Typeless/ChaosBlaze.cs +++ b/Projectiles/Typeless/ChaosBlaze.cs @@ -17,58 +17,58 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 80; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.width = 250; + Projectile.height = 250; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 80; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.01f / 255f); - if (projectile.wet && !projectile.lavaWet) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + if (Projectile.wet && !Projectile.lavaWet) { - projectile.Kill(); + Projectile.Kill(); } bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -79,11 +79,11 @@ namespace CalamityMod.Projectiles.Typeless num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Typeless/ChaosFlare.cs b/Projectiles/Typeless/ChaosFlare.cs index 79d43e3bfb..78f0293823 100644 --- a/Projectiles/Typeless/ChaosFlare.cs +++ b/Projectiles/Typeless/ChaosFlare.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class ChaosFlare : ModProjectile @@ -15,37 +16,37 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 120; - projectile.penetrate = 1; - projectile.extraUpdates = 1; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 120; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 105 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 105 && target.CanBeChasedBy(Projectile); public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.localAI[0] += 1f; } for (int i = 0; i < 6; i++) { - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.2f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1.2f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 0.5f; - Main.dust[d].velocity += projectile.velocity * 0.1f; + Main.dust[d].velocity += Projectile.velocity * 0.1f; } - if (projectile.timeLeft < 105) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 12f, 20f); + if (Projectile.timeLeft < 105) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 12f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Typeless/ChaosFlare2.cs b/Projectiles/Typeless/ChaosFlare2.cs index ddd4e28198..331a7c479b 100644 --- a/Projectiles/Typeless/ChaosFlare2.cs +++ b/Projectiles/Typeless/ChaosFlare2.cs @@ -15,28 +15,28 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.penetrate = 1; - projectile.extraUpdates = 2; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 285 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 285 && target.CanBeChasedBy(Projectile); public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, 2f); + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 2f); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 0.5f; - Main.dust[d].velocity += projectile.velocity * 0.1f; + Main.dust[d].velocity += Projectile.velocity * 0.1f; - if (projectile.timeLeft < 285) - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 250f, 11f, 20f); + if (Projectile.timeLeft < 285) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 250f, 11f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Typeless/ChaosGeyser.cs b/Projectiles/Typeless/ChaosGeyser.cs index aa433eb911..365b6d1ebc 100644 --- a/Projectiles/Typeless/ChaosGeyser.cs +++ b/Projectiles/Typeless/ChaosGeyser.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -16,19 +17,19 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 12; - projectile.height = 96; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = 120; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 12; + Projectile.height = 96; + Projectile.friendly = true; + Projectile.penetrate = 3; + Projectile.timeLeft = 120; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } // Reduce damage of projectiles if more than the cap are active public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - int projectileCount = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + int projectileCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type]; int cap = 3; int oldDamage = damage; if (projectileCount > cap) @@ -41,40 +42,40 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + Projectile.velocity.X = Projectile.velocity.X * -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, (int)projectile.position.X, (int)projectile.position.Y); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item20, (int)Projectile.position.X, (int)Projectile.position.Y); } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1f); + Projectile.rotation += Projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num199]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -83,7 +84,7 @@ namespace CalamityMod.Projectiles.Typeless dust.velocity.Y -= 16f; if (Main.rand.NextBool(2)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 100, default, 1f); Dust dust2 = Main.dust[num200]; dust2.position.X -= 2f; dust2.position.Y += 2f; @@ -91,14 +92,14 @@ namespace CalamityMod.Projectiles.Typeless dust2.noGravity = true; dust2.velocity *= 0.8f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + Projectile.velocity.X = Projectile.velocity.X * 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) + Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } diff --git a/Projectiles/Typeless/ChaoticSpreadBobber.cs b/Projectiles/Typeless/ChaoticSpreadBobber.cs index ba7effc6ef..deb44890cb 100644 --- a/Projectiles/Typeless/ChaoticSpreadBobber.cs +++ b/Projectiles/Typeless/ChaoticSpreadBobber.cs @@ -22,11 +22,11 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 61; - projectile.bobber = true; - projectile.penetrate = -1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 61; + Projectile.bobber = true; + Projectile.penetrate = -1; } //What if we want to randomize the line color @@ -43,10 +43,10 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDrawExtras(SpriteBatch spriteBatch) { if (fishingLineColor == PossibleLineColors[0]) - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0f); else - Lighting.AddLight(projectile.Center, 0f, 0.45f, 0.46f); - return projectile.DrawFishingLine(ModContent.ItemType(), fishingLineColor, 65, 30f); + Lighting.AddLight(Projectile.Center, 0f, 0.45f, 0.46f); + return Projectile.DrawFishingLine(ModContent.ItemType(), fishingLineColor, 65, 30f); } } } diff --git a/Projectiles/Typeless/ChlorophyteLifePulse.cs b/Projectiles/Typeless/ChlorophyteLifePulse.cs index b381cb3a27..839bc643b0 100644 --- a/Projectiles/Typeless/ChlorophyteLifePulse.cs +++ b/Projectiles/Typeless/ChlorophyteLifePulse.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Typeless public class ChlorophyteLifePulse : ModProjectile { public const int Lifetime = 95; - public float LifetimeCompletion => 1f - projectile.timeLeft / (float)Lifetime; + public float LifetimeCompletion => 1f - Projectile.timeLeft / (float)Lifetime; public override void SetStaticDefaults() { DisplayName.SetDefault("Life Pulse"); @@ -20,26 +20,26 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 96; - projectile.height = 96; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 30; - projectile.timeLeft = Lifetime; + Projectile.width = 96; + Projectile.height = 96; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 30; + Projectile.timeLeft = Lifetime; } public override void AI() { - projectile.Opacity = 1f - (float)Math.Pow(LifetimeCompletion, 1.56); - projectile.scale = MathHelper.Lerp(0.5f, 12f, LifetimeCompletion); + Projectile.Opacity = 1f - (float)Math.Pow(LifetimeCompletion, 1.56); + Projectile.scale = MathHelper.Lerp(0.5f, 12f, LifetimeCompletion); // Heal all members of the same team. - if (projectile.timeLeft == (int)(Lifetime * 0.925f)) + if (Projectile.timeLeft == (int)(Lifetime * 0.925f)) { - Player owner = Main.player[projectile.owner]; + Player owner = Main.player[Projectile.owner]; List membersOfSameTeam = new List() { owner @@ -64,25 +64,25 @@ namespace CalamityMod.Projectiles.Typeless { Color c1 = new Color(142, 255, 155, 0); Color c2 = new Color(0, 142, 113, 92); - return Color.Lerp(c1, c2, 1f - projectile.Opacity) * projectile.Opacity * 0.67f; + return Color.Lerp(c1, c2, 1f - Projectile.Opacity) * Projectile.Opacity * 0.67f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Color drawColor = projectile.GetAlpha(lightColor) * 0.4f; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Color drawColor = Projectile.GetAlpha(lightColor) * 0.4f; for (int i = 0; i < 8; i++) { Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 4f; - Vector2 drawPosition = projectile.Center - Main.screenPosition + drawOffset; - spriteBatch.Draw(texture, drawPosition, null, drawColor, 0f, texture.Size() * 0.5f, projectile.scale, 0, 0f); + Vector2 drawPosition = Projectile.Center - Main.screenPosition + drawOffset; + spriteBatch.Draw(texture, drawPosition, null, drawColor, 0f, texture.Size() * 0.5f, Projectile.scale, 0, 0f); } return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - return CalamityUtils.CircularHitboxCollision(projectile.Center, projectile.scale * 48f, targetHitbox); + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.scale * 48f, targetHitbox); } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Typeless/CoralBubble.cs b/Projectiles/Typeless/CoralBubble.cs index 9802478afc..03cada508b 100644 --- a/Projectiles/Typeless/CoralBubble.cs +++ b/Projectiles/Typeless/CoralBubble.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -15,80 +16,80 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.alpha = 255; - projectile.timeLeft = 360; - projectile.penetrate = 1; + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.timeLeft = 360; + Projectile.penetrate = 1; } public override void AI() { - if (projectile.localAI[0] > 2f) + if (Projectile.localAI[0] > 2f) { - projectile.alpha -= 5; - if (projectile.alpha < 100) + Projectile.alpha -= 5; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } } else { - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (projectile.ai[1] > 30f) + if (Projectile.ai[1] > 30f) { - if (projectile.velocity.Y > -1.5f) + if (Projectile.velocity.Y > -1.5f) { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.05f; } } else { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; } - if (projectile.wet) + if (Projectile.wet) { - if (projectile.velocity.Y > 0f) + if (Projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; + Projectile.velocity.Y = Projectile.velocity.Y * 0.98f; } - if (projectile.velocity.Y > -1f) + if (Projectile.velocity.Y > -1f) { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; } } - int closestPlayer = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 distance = Main.player[closestPlayer].Center - projectile.Center; - if (projectile.Distance(Main.player[closestPlayer].Center) < 14f) + int closestPlayer = (int)Player.FindClosest(Projectile.Center, 1, 1); + Vector2 distance = Main.player[closestPlayer].Center - Projectile.Center; + if (Projectile.Distance(Main.player[closestPlayer].Center) < 14f) { Main.player[closestPlayer].AddBuff(BuffID.Gills, 90); - projectile.Kill(); + Projectile.Kill(); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); - projectile.position = projectile.Center; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num190 = Main.rand.Next(5, 9); for (int num191 = 0; num191 < num190; num191++) { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); + int num192 = Dust.NewDust(Projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, Projectile.Center, 0.5f); Main.dust[num192].noGravity = true; } } diff --git a/Projectiles/Typeless/CoralBubbleSmall.cs b/Projectiles/Typeless/CoralBubbleSmall.cs index cdb4df05b8..3f1a05c150 100644 --- a/Projectiles/Typeless/CoralBubbleSmall.cs +++ b/Projectiles/Typeless/CoralBubbleSmall.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -16,72 +17,72 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.scale = 0.5f; - projectile.friendly = true; - projectile.alpha = 255; - projectile.timeLeft = 360; - projectile.penetrate = 1; + Projectile.width = 28; + Projectile.height = 28; + Projectile.scale = 0.5f; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.timeLeft = 360; + Projectile.penetrate = 1; } public override void AI() { - if (projectile.localAI[0] > 2f) + if (Projectile.localAI[0] > 2f) { - projectile.alpha -= 5; - if (projectile.alpha < 100) + Projectile.alpha -= 5; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } } else { - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (projectile.ai[1] > 30f) + if (Projectile.ai[1] > 30f) { - if (projectile.velocity.Y > -1.5f) + if (Projectile.velocity.Y > -1.5f) { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.05f; } } else { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; } - if (projectile.wet) + if (Projectile.wet) { - if (projectile.velocity.Y > 0f) + if (Projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; + Projectile.velocity.Y = Projectile.velocity.Y * 0.98f; } - if (projectile.velocity.Y > -1f) + if (Projectile.velocity.Y > -1f) { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; } } - int closestPlayer = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 distance = Main.player[closestPlayer].Center - projectile.Center; - if (projectile.Distance(Main.player[closestPlayer].Center) < 7f) + int closestPlayer = (int)Player.FindClosest(Projectile.Center, 1, 1); + Vector2 distance = Main.player[closestPlayer].Center - Projectile.Center; + if (Projectile.Distance(Main.player[closestPlayer].Center) < 7f) { Main.player[closestPlayer].AddBuff(BuffID.Gills, 30); - projectile.Kill(); + Projectile.Kill(); } } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); - projectile.position = projectile.Center; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num190 = Main.rand.Next(5, 9); for (int num191 = 0; num191 < num190; num191++) { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); + int num192 = Dust.NewDust(Projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, Projectile.Center, 0.5f); Main.dust[num192].noGravity = true; } } diff --git a/Projectiles/Typeless/CryonicShield.cs b/Projectiles/Typeless/CryonicShield.cs index 927fe40904..2d587467e7 100644 --- a/Projectiles/Typeless/CryonicShield.cs +++ b/Projectiles/Typeless/CryonicShield.cs @@ -10,43 +10,43 @@ namespace CalamityMod.Projectiles.Typeless { public class CryonicShield : ModProjectile { - public Player Owner => Main.player[projectile.owner]; + public Player Owner => Main.player[Projectile.owner]; public override string Texture => "CalamityMod/NPCs/Cryogen/CryogenIce"; public override void SetStaticDefaults() { DisplayName.SetDefault("Cryonic Shield"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 222; - projectile.height = 216; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 90000; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 25; + Projectile.width = 222; + Projectile.height = 216; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 90000; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 25; } public override void AI() { // Protect against projectile reflection. - projectile.friendly = true; - projectile.hostile = false; + Projectile.friendly = true; + Projectile.hostile = false; // Spin around. - projectile.rotation += MathHelper.Pi / 48f; + Projectile.rotation += MathHelper.Pi / 48f; - projectile.Center = Owner.Center; - Lighting.AddLight(projectile.Center, projectile.Opacity * 0.2f, projectile.Opacity * 0.45f, projectile.Opacity * 0.5f); + Projectile.Center = Owner.Center; + Lighting.AddLight(Projectile.Center, Projectile.Opacity * 0.2f, Projectile.Opacity * 0.45f, Projectile.Opacity * 0.5f); if (Owner is null || !Owner.active || Owner.dead) - projectile.Kill(); + Projectile.Kill(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Typeless if (knockbackMultiplier < 0) knockbackMultiplier = 0; - Vector2 trueKnockback = projectile.SafeDirectionTo(target.Center); + Vector2 trueKnockback = Projectile.SafeDirectionTo(target.Center); target.velocity = trueKnockback * knockbackMultiplier; } } @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Typeless target.AddBuff(ModContent.BuffType(), 30); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, projectile.Size.Length() * 0.5f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.Size.Length() * 0.5f, targetHitbox); public override bool? CanHitNPC(NPC target) { diff --git a/Projectiles/Typeless/CursorProj.cs b/Projectiles/Typeless/CursorProj.cs index 662197aac7..90b6d3c7b3 100644 --- a/Projectiles/Typeless/CursorProj.cs +++ b/Projectiles/Typeless/CursorProj.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class CursorProj : ModProjectile @@ -12,29 +13,29 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Aestheticus Crystal"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.alpha = 255; - projectile.timeLeft = 300; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 300; } public override void AI() { - if (projectile.alpha > 0) - projectile.alpha -= 15; + if (Projectile.alpha > 0) + Projectile.alpha -= 15; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; - if (projectile.timeLeft > 285) + if (Projectile.timeLeft > 285) return; float num29 = 5f; @@ -42,7 +43,7 @@ namespace CalamityMod.Projectiles.Typeless float scaleFactor = 6f; Vector2 value7 = new Vector2(10f, 20f); //float num31 = 1f; - int num32 = 3 * projectile.MaxUpdates; + int num32 = 3 * Projectile.MaxUpdates; int num33 = Utils.SelectRandom(Main.rand, new int[] { 246, @@ -52,22 +53,22 @@ namespace CalamityMod.Projectiles.Typeless 247 }); int num34 = 255; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - projectile.localAI[0] = (float)-(float)Main.rand.Next(48); + Projectile.ai[1] = 1f; + Projectile.localAI[0] = (float)-(float)Main.rand.Next(48); } - else if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) + else if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) { int num35 = -1; float num36 = num30; for (int num37 = 0; num37 < 200; num37++) { - if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(projectile, false)) + if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(Projectile, false)) { Vector2 center3 = Main.npc[num37].Center; - float num38 = Vector2.Distance(center3, projectile.Center); - if (num38 < num36 && num35 == -1 && Collision.CanHitLine(projectile.Center, 1, 1, center3, 1, 1)) + float num38 = Vector2.Distance(center3, Projectile.Center); + if (num38 < num36 && num35 == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, center3, 1, 1)) { num36 = num38; num35 = num37; @@ -76,33 +77,33 @@ namespace CalamityMod.Projectiles.Typeless } if (num36 < 4f) { - projectile.Kill(); + Projectile.Kill(); return; } if (num35 != -1) { - projectile.ai[1] = num29 + 1f; - projectile.ai[0] = (float)num35; - projectile.netUpdate = true; + Projectile.ai[1] = num29 + 1f; + Projectile.ai[0] = (float)num35; + Projectile.netUpdate = true; } } - else if (projectile.ai[1] > num29) + else if (Projectile.ai[1] > num29) { - projectile.ai[1] += 1f; - int num39 = (int)projectile.ai[0]; - if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(projectile, false)) + Projectile.ai[1] += 1f; + int num39 = (int)Projectile.ai[0]; + if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(Projectile, false)) { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 1f; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } else { - projectile.velocity.ToRotation(); - Vector2 vector6 = Main.npc[num39].Center - projectile.Center; + Projectile.velocity.ToRotation(); + Vector2 vector6 = Main.npc[num39].Center - Projectile.Center; if (vector6.Length() < 10f) { - projectile.Kill(); + Projectile.Kill(); return; } if (vector6 != Vector2.Zero) @@ -111,36 +112,36 @@ namespace CalamityMod.Projectiles.Typeless vector6 *= scaleFactor; } float num40 = 30f; - projectile.velocity = (projectile.velocity * (num40 - 1f) + vector6) / num40; + Projectile.velocity = (Projectile.velocity * (num40 - 1f) + vector6) / num40; } } - if (projectile.ai[1] >= 1f && projectile.ai[1] < num29) + if (Projectile.ai[1] >= 1f && Projectile.ai[1] < num29) { - projectile.ai[1] += 1f; - if (projectile.ai[1] == num29) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] == num29) { - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 48f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } if (Main.rand.NextBool(12)) { - Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num44 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num34, 0f, 0f, 160, default, 1f); + Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num44 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num34, 0f, 0f, 160, default, 1f); Main.dust[num44].velocity *= 0.1f; - Main.dust[num44].position = projectile.Center + value9 * (float)projectile.width / 2f + projectile.velocity * 2f; + Main.dust[num44].position = Projectile.Center + value9 * (float)Projectile.width / 2f + Projectile.velocity * 2f; Main.dust[num44].fadeIn = 0.9f; } if (Main.rand.NextBool(18)) { - Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num46 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 155, default, 0.8f); + Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num46 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 155, default, 0.8f); Main.dust[num46].velocity *= 0.3f; - Main.dust[num46].position = projectile.Center + value10 * (float)projectile.width / 2f; + Main.dust[num46].position = Projectile.Center + value10 * (float)Projectile.width / 2f; if (Main.rand.NextBool(2)) { Main.dust[num46].fadeIn = 1.4f; @@ -148,11 +149,11 @@ namespace CalamityMod.Projectiles.Typeless } if (Main.rand.NextBool(8)) { - Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num48 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num33, 0f, 0f, 0, default, 1f); + Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num48 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num33, 0f, 0f, 0, default, 1f); Main.dust[num48].velocity *= 0.3f; Main.dust[num48].noGravity = true; - Main.dust[num48].position = projectile.Center + value11 * (float)projectile.width / 2f; + Main.dust[num48].position = Projectile.Center + value11 * (float)Projectile.width / 2f; if (Main.rand.NextBool(2)) { Main.dust[num48].fadeIn = 1.4f; @@ -160,32 +161,32 @@ namespace CalamityMod.Projectiles.Typeless } if (Main.rand.NextBool(6)) { - Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num50 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num34, 0f, 0f, 100, default, 1f); + Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num50 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num34, 0f, 0f, 100, default, 1f); Main.dust[num50].velocity *= 0.3f; - Main.dust[num50].position = projectile.Center + value13 * (float)projectile.width / 2f; + Main.dust[num50].position = Projectile.Center + value13 * (float)Projectile.width / 2f; Main.dust[num50].fadeIn = 1.2f; Main.dust[num50].scale = 1.5f; Main.dust[num50].noGravity = true; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.2f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 234, 0f, 0f, 100, default, 0.8f); + int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 234, 0f, 0f, 100, default, 0.8f); Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; + Main.dust[num155].velocity += Projectile.velocity * 0.5f; Main.dust[num155].noGravity = true; if (Main.rand.NextBool(12)) { int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 159, 0f, 0f, 100, default, 1f); + int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 159, 0f, 0f, 100, default, 1f); Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; + Main.dust[num157].velocity += Projectile.velocity * 0.5f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -201,7 +202,7 @@ namespace CalamityMod.Projectiles.Typeless public override void Kill(int timeLeft) { - Vector2 velocity = projectile.velocity; + Vector2 velocity = Projectile.velocity; velocity.Normalize(); velocity *= 4f; @@ -216,11 +217,11 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < numProj; i++) { offsetAngle = startAngle + deltaAngle * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), - ModContent.ProjectileType(), projectile.damage / 3, projectile.knockBack * 0.33f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), + ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.33f, Projectile.owner, 0f, 0f); } - Main.PlaySound(SoundID.Item110, projectile.Center); + SoundEngine.PlaySound(SoundID.Item110, Projectile.Center); } } } diff --git a/Projectiles/Typeless/CursorProjSplit.cs b/Projectiles/Typeless/CursorProjSplit.cs index c6e064a96e..bcc3041eab 100644 --- a/Projectiles/Typeless/CursorProjSplit.cs +++ b/Projectiles/Typeless/CursorProjSplit.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class CursorProjSplit : ModProjectile @@ -14,34 +15,34 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Aestheticus Crystal"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.alpha = 255; - projectile.timeLeft = 300; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 300; } public override void AI() { - if (projectile.alpha > 0) - projectile.alpha -= 3; + if (Projectile.alpha > 0) + Projectile.alpha -= 3; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; float num29 = 5f; float num30 = 300f; float scaleFactor = 6f; Vector2 value7 = new Vector2(10f, 20f); //float num31 = 1f; - int num32 = 3 * projectile.MaxUpdates; + int num32 = 3 * Projectile.MaxUpdates; int num33 = Utils.SelectRandom(Main.rand, new int[] { 246, @@ -51,24 +52,24 @@ namespace CalamityMod.Projectiles.Typeless 247 }); int num34 = 255; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - projectile.localAI[0] = (float)-(float)Main.rand.Next(48); + Projectile.ai[1] = 1f; + Projectile.localAI[0] = (float)-(float)Main.rand.Next(48); } - else if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) + else if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) { - if (projectile.alpha < 128) + if (Projectile.alpha < 128) { int num35 = -1; float num36 = num30; for (int num37 = 0; num37 < 200; num37++) { - if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(projectile, false)) + if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(Projectile, false)) { Vector2 center3 = Main.npc[num37].Center; - float num38 = Vector2.Distance(center3, projectile.Center); - if (num38 < num36 && num35 == -1 && Collision.CanHitLine(projectile.Center, 1, 1, center3, 1, 1)) + float num38 = Vector2.Distance(center3, Projectile.Center); + if (num38 < num36 && num35 == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, center3, 1, 1)) { num36 = num38; num35 = num37; @@ -77,34 +78,34 @@ namespace CalamityMod.Projectiles.Typeless } if (num36 < 4f) { - projectile.Kill(); + Projectile.Kill(); return; } if (num35 != -1) { - projectile.ai[1] = num29 + 1f; - projectile.ai[0] = (float)num35; - projectile.netUpdate = true; + Projectile.ai[1] = num29 + 1f; + Projectile.ai[0] = (float)num35; + Projectile.netUpdate = true; } } } - else if (projectile.ai[1] > num29) + else if (Projectile.ai[1] > num29) { - projectile.ai[1] += 1f; - int num39 = (int)projectile.ai[0]; - if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(projectile, false)) + Projectile.ai[1] += 1f; + int num39 = (int)Projectile.ai[0]; + if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(Projectile, false)) { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 1f; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } else { - projectile.velocity.ToRotation(); - Vector2 vector6 = Main.npc[num39].Center - projectile.Center; + Projectile.velocity.ToRotation(); + Vector2 vector6 = Main.npc[num39].Center - Projectile.Center; if (vector6.Length() < 10f) { - projectile.Kill(); + Projectile.Kill(); return; } if (vector6 != Vector2.Zero) @@ -113,36 +114,36 @@ namespace CalamityMod.Projectiles.Typeless vector6 *= scaleFactor; } float num40 = 30f; - projectile.velocity = (projectile.velocity * (num40 - 1f) + vector6) / num40; + Projectile.velocity = (Projectile.velocity * (num40 - 1f) + vector6) / num40; } } - if (projectile.ai[1] >= 1f && projectile.ai[1] < num29) + if (Projectile.ai[1] >= 1f && Projectile.ai[1] < num29) { - projectile.ai[1] += 1f; - if (projectile.ai[1] == num29) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] == num29) { - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 48f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } if (Main.rand.NextBool(12)) { - Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num44 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num34, 0f, 0f, 100, default, 1f); + Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num44 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num34, 0f, 0f, 100, default, 1f); Main.dust[num44].velocity *= 0.1f; - Main.dust[num44].position = projectile.Center + value9 * (float)projectile.width / 2f + projectile.velocity * 2f; + Main.dust[num44].position = Projectile.Center + value9 * (float)Projectile.width / 2f + Projectile.velocity * 2f; Main.dust[num44].fadeIn = 0.9f; } if (Main.rand.NextBool(18)) { - Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num46 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 155, default, 0.8f); + Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num46 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 155, default, 0.8f); Main.dust[num46].velocity *= 0.3f; - Main.dust[num46].position = projectile.Center + value10 * (float)projectile.width / 2f; + Main.dust[num46].position = Projectile.Center + value10 * (float)Projectile.width / 2f; if (Main.rand.NextBool(2)) { Main.dust[num46].fadeIn = 1.4f; @@ -150,11 +151,11 @@ namespace CalamityMod.Projectiles.Typeless } if (Main.rand.NextBool(8)) { - Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num48 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num33, 0f, 0f, 0, default, 1f); + Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num48 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num33, 0f, 0f, 0, default, 1f); Main.dust[num48].velocity *= 0.3f; Main.dust[num48].noGravity = true; - Main.dust[num48].position = projectile.Center + value11 * (float)projectile.width / 2f; + Main.dust[num48].position = Projectile.Center + value11 * (float)Projectile.width / 2f; if (Main.rand.NextBool(2)) { Main.dust[num48].fadeIn = 1.4f; @@ -162,32 +163,32 @@ namespace CalamityMod.Projectiles.Typeless } if (Main.rand.NextBool(6)) { - Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num50 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num34, 0f, 0f, 100, default, 1f); + Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num50 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num34, 0f, 0f, 100, default, 1f); Main.dust[num50].velocity *= 0.3f; - Main.dust[num50].position = projectile.Center + value13 * (float)projectile.width / 2f; + Main.dust[num50].position = Projectile.Center + value13 * (float)Projectile.width / 2f; Main.dust[num50].fadeIn = 1.2f; Main.dust[num50].scale = 1.5f; Main.dust[num50].noGravity = true; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.2f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 234, 0f, 0f, 100, default, 0.8f); + int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 234, 0f, 0f, 100, default, 0.8f); Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; + Main.dust[num155].velocity += Projectile.velocity * 0.5f; Main.dust[num155].noGravity = true; if (Main.rand.NextBool(12)) { int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 159, 0f, 0f, 100, default, 1f); + int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 159, 0f, 0f, 100, default, 1f); Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; + Main.dust[num157].velocity += Projectile.velocity * 0.5f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } @@ -203,14 +204,14 @@ namespace CalamityMod.Projectiles.Typeless public override bool? CanHitNPC(NPC target) { - if (projectile.alpha >= 128) + if (Projectile.alpha >= 128) { return false; } return null; } - public override bool CanHitPvp(Player target) => projectile.alpha < 128; + public override bool CanHitPvp(Player target) => Projectile.alpha < 128; public override void Kill(int timeLeft) { @@ -230,23 +231,23 @@ namespace CalamityMod.Projectiles.Typeless float num51 = 0.6f; float num52 = 1.5f; - Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; + Vector2 value3 = (Projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); int num3; for (int num53 = 0; num53 < 20; num53 = num3 + 1) { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num47, 0f, 0f, 200, default, num50); + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num47, 0f, 0f, 200, default, num50); Dust dust = Main.dust[num54]; - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity.Y -= 6f; dust.velocity *= 3f; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num48, 0f, 0f, 100, default, num51); - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num48, 0f, 0f, 100, default, num51); + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.velocity.Y -= 6f; dust.velocity *= 2f; dust.noGravity = true; @@ -258,8 +259,8 @@ namespace CalamityMod.Projectiles.Typeless for (int num55 = 0; num55 < 10; num55 = num3 + 1) { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num49, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num49, 0f, 0f, 0, default, num52); + Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; Dust dust = Main.dust[num56]; dust.noGravity = true; dust.velocity.Y -= 6f; diff --git a/Projectiles/Typeless/CyanLabSeeker.cs b/Projectiles/Typeless/CyanLabSeeker.cs index d23e3ab73f..e51e42a5ba 100644 --- a/Projectiles/Typeless/CyanLabSeeker.cs +++ b/Projectiles/Typeless/CyanLabSeeker.cs @@ -9,32 +9,32 @@ namespace CalamityMod.Projectiles.Typeless { public class CyanLabSeeker : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Items/LabFinders/CyanSeekingMechanism"; public override void SetStaticDefaults() { DisplayName.SetDefault("Seeking Mechanism"); - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; } public override void SetDefaults() { - projectile.width = projectile.height = 24; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 300; + Projectile.width = Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; } - public override void AI() => RedLabSeeker.Behavior(projectile, CalamityWorld.SunkenSeaLabCenter, Color.Cyan, ref Time); + public override void AI() => RedLabSeeker.Behavior(Projectile, CalamityWorld.SunkenSeaLabCenter, Color.Cyan, ref Time); public override void Kill(int timeLeft) { for (int i = 0; i < 8; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); dust.color = Color.Cyan; dust.scale = Main.rand.NextFloat(0.95f, 1.25f); dust.velocity = Main.rand.NextVector2Circular(2.5f, 2.5f); @@ -48,13 +48,13 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - if (Time > 80f && projectile.ai[1] == 0f) + Texture2D texture = Main.projectileTexture[Projectile.type]; + if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) { - Vector2 drawPosition = projectile.Center - projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; - spriteBatch.Draw(texture, drawPosition, null, projectile.GetAlpha(lightColor) * (1f - i / 24f), projectile.rotation, texture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + Vector2 drawPosition = Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; + spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor) * (1f - i / 24f), Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); } } return true; diff --git a/Projectiles/Typeless/DarkIce.cs b/Projectiles/Typeless/DarkIce.cs index 0574a74c27..544714d386 100644 --- a/Projectiles/Typeless/DarkIce.cs +++ b/Projectiles/Typeless/DarkIce.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -13,16 +14,16 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.aiStyle = 1; + Projectile.width = 28; + Projectile.height = 28; + Projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; - projectile.coldDamage = true; - projectile.npcProj = true; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 1; + Projectile.coldDamage = true; + Projectile.npcProj = true; } public override void SetStaticDefaults() @@ -32,19 +33,19 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - if (projectile.localAI[0] != 1f) + if (Projectile.localAI[0] != 1f) { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item8, projectile.Center); + Projectile.localAI[0] = 1f; + SoundEngine.PlaySound(SoundID.Item8, Projectile.Center); } - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 16f) { - projectile.velocity *= 1.04f; + Projectile.velocity *= 1.04f; } //make pretty dust - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.25f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.25f); Main.dust[index2].noGravity = true; } @@ -67,10 +68,10 @@ namespace CalamityMod.Projectiles.Typeless public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int i = 0; i < 30; i++) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, 0f, 0f, 0, default, Main.rand.NextFloat(1f, 2f)); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, 0f, 0f, 0, default, Main.rand.NextFloat(1f, 2f)); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 4f; } diff --git a/Projectiles/Typeless/DemonshadeRedDevil.cs b/Projectiles/Typeless/DemonshadeRedDevil.cs index 9c347a1b4d..4ead9fd93e 100644 --- a/Projectiles/Typeless/DemonshadeRedDevil.cs +++ b/Projectiles/Typeless/DemonshadeRedDevil.cs @@ -16,32 +16,32 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Red Devil"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 48; - projectile.height = 48; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; + Projectile.width = 48; + Projectile.height = 48; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; } public override void AI() { - bool flag64 = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool flag64 = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.redDevil) { - projectile.active = false; + Projectile.active = false; return; } if (flag64) @@ -52,66 +52,66 @@ namespace CalamityMod.Projectiles.Typeless } if (modPlayer.rDevil) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } dust--; if (dust == 2) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.AverageDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.AverageDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; } if (dust >= 0) { int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); + int num503 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); Main.dust[num503].velocity *= 2f; Main.dust[num503].scale *= 1.15f; } } - if (player.AverageDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.AverageDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.AverageDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 4) + if (Projectile.frame > 4) { - projectile.frame = 0; + Projectile.frame = 0; } float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight(projectile.Center, 1f * num, 0f * num, 0.15f * num); - projectile.rotation = projectile.velocity.X * 0.04f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + Lighting.AddLight(Projectile.Center, 1f * num, 0f * num, 0.15f * num); + Projectile.rotation = Projectile.velocity.X * 0.04f; + if ((double)Math.Abs(Projectile.velocity.X) > 0.2) { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } float num633 = 2000f; float num634 = 2000f; float num635 = 3000f; float num636 = 150f; bool flag24 = false; - if (projectile.ai[0] == 2f) + if (Projectile.ai[0] == 2f) { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 40f) + Projectile.ai[1] += 1f; + Projectile.extraUpdates = 1; + if (Projectile.ai[1] > 40f) { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; + Projectile.ai[1] = 1f; + Projectile.ai[0] = 0f; + Projectile.extraUpdates = 0; + Projectile.numUpdates = 0; + Projectile.netUpdate = true; } else { @@ -122,22 +122,22 @@ namespace CalamityMod.Projectiles.Typeless { return; } - Vector2 vector46 = projectile.position; + Vector2 vector46 = Projectile.position; bool flag25 = false; - if (projectile.ai[0] != 1f) + if (Projectile.ai[0] != 1f) { - projectile.tileCollide = false; + Projectile.tileCollide = false; } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) + if (Projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16))) { - projectile.tileCollide = false; + Projectile.tileCollide = false; } if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) + if (npc.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(npc.Center, projectile.Center); + float num646 = Vector2.Distance(npc.Center, Projectile.Center); if (!flag25 && num646 < num633) { num633 = num646; @@ -151,10 +151,10 @@ namespace CalamityMod.Projectiles.Typeless for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + if (nPC2.CanBeChasedBy(Projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float num646 = Vector2.Distance(nPC2.Center, Projectile.Center); + if ((!flag25 && num646 < num633) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num633 = num646; vector46 = nPC2.Center; @@ -168,28 +168,28 @@ namespace CalamityMod.Projectiles.Typeless { num647 = num635; } - if (Vector2.Distance(player.Center, projectile.Center) > num647) + if (Vector2.Distance(player.Center, Projectile.Center) > num647) { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; + Projectile.ai[0] = 1f; + Projectile.tileCollide = false; + Projectile.netUpdate = true; } - if (flag25 && projectile.ai[0] == 0f) + if (flag25 && Projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - projectile.Center; + Vector2 vector47 = vector46 - Projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 16f; //8 vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 4f; vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector47) / 41f; } } else @@ -197,65 +197,65 @@ namespace CalamityMod.Projectiles.Typeless bool flag26 = false; if (!flag26) { - flag26 = projectile.ai[0] == 1f; + flag26 = Projectile.ai[0] == 1f; } float num650 = 5f; //6 if (flag26) { num650 = 12f; //15 } - Vector2 center2 = projectile.Center; + Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -30f); //-60 float num651 = vector48.Length(); if (num651 > 200f && num650 < 6.5f) //200 and 8 { num650 = 6.5f; //8 } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (num651 < num636 && flag26 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } if (num651 > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + Projectile.velocity = (Projectile.velocity * 40f + vector48) / 41f; } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) { - projectile.velocity.X = -0.2f; - projectile.velocity.Y = -0.1f; + Projectile.velocity.X = -0.2f; + Projectile.velocity.Y = -0.1f; } } - if (projectile.ai[1] > 0f) + if (Projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 4); + Projectile.ai[1] += (float)Main.rand.Next(1, 4); } - if (projectile.ai[1] > 80f) + if (Projectile.ai[1] > 80f) { - projectile.ai[1] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { float speed = 24f; int projType = ProjectileID.UnholyTridentFriendly; - if (flag25 && projectile.ai[1] == 0f) + if (flag25 && Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.Center, projectile.width, projectile.height, vector46, 0, 0)) + Projectile.ai[1] += 1f; + if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.Center, Projectile.width, Projectile.height, vector46, 0, 0)) { - Vector2 velocity = vector46 - projectile.Center; + Vector2 velocity = vector46 - Projectile.Center; velocity.Normalize(); velocity *= speed; - int trident = Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, 0f, Main.myPlayer); + int trident = Projectile.NewProjectile(Projectile.Center, velocity, projType, Projectile.damage, 0f, Main.myPlayer); if (trident.WithinBounds(Main.maxProjectiles)) { Main.projectile[trident].timeLeft = 300; @@ -263,7 +263,7 @@ namespace CalamityMod.Projectiles.Typeless Main.projectile[trident].localNPCHitCooldown = 10; Main.projectile[trident].Calamity().forceTypeless = true; //typeless } - projectile.netUpdate = true; + Projectile.netUpdate = true; } } } @@ -271,11 +271,11 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, spriteEffects, 0f); return false; } diff --git a/Projectiles/Typeless/DevourerofCodsBobber.cs b/Projectiles/Typeless/DevourerofCodsBobber.cs index 46a47b7caf..b3776e5094 100644 --- a/Projectiles/Typeless/DevourerofCodsBobber.cs +++ b/Projectiles/Typeless/DevourerofCodsBobber.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 61; - projectile.bobber = true; - projectile.penetrate = -1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 61; + Projectile.bobber = true; + Projectile.penetrate = -1; } //What if we want to randomize the line color @@ -45,25 +45,25 @@ namespace CalamityMod.Projectiles.Typeless //i second this notion -Dominic public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Projectiles/Typeless/DevourerofCodsGlow"); - float xOffset = (glowmask.Width - projectile.width) * 0.5f + projectile.width * 0.5f; - Vector2 drawPos = projectile.position - Main.screenPosition; + Texture2D glowmask = ModContent.Request("CalamityMod/Projectiles/Typeless/DevourerofCodsGlow"); + float xOffset = (glowmask.Width - Projectile.width) * 0.5f + Projectile.width * 0.5f; + Vector2 drawPos = Projectile.position - Main.screenPosition; drawPos.X += xOffset; - drawPos.Y += projectile.height / 2f + projectile.gfxOffY; + drawPos.Y += Projectile.height / 2f + Projectile.gfxOffY; Rectangle frame = new Microsoft.Xna.Framework.Rectangle(0, 0, glowmask.Width, glowmask.Height); - Vector2 origin = new Vector2(xOffset, projectile.height / 2f); - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 origin = new Vector2(xOffset, Projectile.height / 2f); + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - if (projectile.ai[0] <= 1f) + if (Projectile.ai[0] <= 1f) { - Main.spriteBatch.Draw(glowmask, drawPos, frame, Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(glowmask, drawPos, frame, Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); } } public override bool PreDrawExtras(SpriteBatch spriteBatch) { - Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.25f); - return projectile.DrawFishingLine(ModContent.ItemType(), fishingLineColor); + Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0.25f); + return Projectile.DrawFishingLine(ModContent.ItemType(), fishingLineColor); } } } diff --git a/Projectiles/Typeless/DirectStrike.cs b/Projectiles/Typeless/DirectStrike.cs index e066310c5e..406f07d123 100644 --- a/Projectiles/Typeless/DirectStrike.cs +++ b/Projectiles/Typeless/DirectStrike.cs @@ -14,21 +14,21 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 0; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.timeLeft = 2; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 0; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.timeLeft = 2; } // If the AI parameter isn't a valid NPC slot, it can hit anything. Otherwise it can only hit one NPC. public override bool? CanHitNPC(NPC target) { - if (projectile.ai[0] < 0f || projectile.ai[0] > 199f || projectile.ai[0] == target.whoAmI) + if (Projectile.ai[0] < 0f || Projectile.ai[0] > 199f || Projectile.ai[0] == target.whoAmI) return null; return (bool?)false; } diff --git a/Projectiles/Typeless/DragonDust.cs b/Projectiles/Typeless/DragonDust.cs index 5ac0bd88db..171e30fc7c 100644 --- a/Projectiles/Typeless/DragonDust.cs +++ b/Projectiles/Typeless/DragonDust.cs @@ -16,51 +16,51 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 46; - projectile.height = 46; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; + Projectile.width = 46; + Projectile.height = 46; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f); bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 60f) + if (Projectile.ai[0] > 60f) { - num461 -= (projectile.ai[0] - 60f) / 2f; + num461 -= (Projectile.ai[0] - 60f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -71,11 +71,11 @@ namespace CalamityMod.Projectiles.Typeless num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1.5f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 0; + target.immune[Projectile.owner] = 0; target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Typeless/EarlyBloomBobber.cs b/Projectiles/Typeless/EarlyBloomBobber.cs index 6eefb384f1..a508355e2a 100644 --- a/Projectiles/Typeless/EarlyBloomBobber.cs +++ b/Projectiles/Typeless/EarlyBloomBobber.cs @@ -14,17 +14,17 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 61; - projectile.bobber = true; - projectile.penetrate = -1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 61; + Projectile.bobber = true; + Projectile.penetrate = -1; } public override bool PreDrawExtras(SpriteBatch spriteBatch) { - Lighting.AddLight(projectile.Center, 0.1f, 0.5f, 0.15f); - return projectile.DrawFishingLine(ModContent.ItemType(), new Color(190, 140, 69, 100)); + Lighting.AddLight(Projectile.Center, 0.1f, 0.5f, 0.15f); + return Projectile.DrawFishingLine(ModContent.ItemType(), new Color(190, 140, 69, 100)); } } } diff --git a/Projectiles/Typeless/EnergyShell.cs b/Projectiles/Typeless/EnergyShell.cs index 7b6fc6b505..1598414b66 100644 --- a/Projectiles/Typeless/EnergyShell.cs +++ b/Projectiles/Typeless/EnergyShell.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Weapons.Melee; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -13,55 +14,55 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Energy Shell"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[Projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 58; - projectile.height = 72; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.penetrate = -1; + Projectile.width = 58; + Projectile.height = 72; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; } public override void AI() { if (!playedSound) { - Main.PlaySound(SoundID.Item92, (int)projectile.position.X, (int)projectile.position.Y); + SoundEngine.PlaySound(SoundID.Item92, (int)Projectile.position.X, (int)Projectile.position.Y); playedSound = true; } - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= 6) + if (Projectile.frame >= 6) { - projectile.frame = 0; + Projectile.frame = 0; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.01f / 255f); - if (projectile.timeLeft < 51) //fade out + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + if (Projectile.timeLeft < 51) //fade out { - projectile.alpha += 5; + Projectile.alpha += 5; } - Player player = Main.player[projectile.owner]; - projectile.Center = player.Center; + 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.ActiveItem().type != ModContent.ItemType()) { - projectile.Kill(); + Projectile.Kill(); } } public override void Kill(int timeLeft) { - Player player = Main.player[projectile.owner]; - Main.PlaySound(SoundID.Item94, (int)projectile.position.X, (int)projectile.position.Y); + Player player = Main.player[Projectile.owner]; + SoundEngine.PlaySound(SoundID.Item94, (int)Projectile.position.X, (int)Projectile.position.Y); player.AddCooldown(LionHeartShield.ID, CalamityUtils.SecondsToFrames(45)); } diff --git a/Projectiles/Typeless/FabsolDust.cs b/Projectiles/Typeless/FabsolDust.cs index 0178d7219c..081199444f 100644 --- a/Projectiles/Typeless/FabsolDust.cs +++ b/Projectiles/Typeless/FabsolDust.cs @@ -14,25 +14,25 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 70; - projectile.height = 40; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 70; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 5; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, default, 0.5f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, default, 0.5f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } diff --git a/Projectiles/Typeless/FeralDoubleBobber.cs b/Projectiles/Typeless/FeralDoubleBobber.cs index b565b20ce7..c296f73b5c 100644 --- a/Projectiles/Typeless/FeralDoubleBobber.cs +++ b/Projectiles/Typeless/FeralDoubleBobber.cs @@ -14,17 +14,17 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 61; - projectile.bobber = true; - projectile.penetrate = -1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 61; + Projectile.bobber = true; + Projectile.penetrate = -1; } public override bool PreDrawExtras(SpriteBatch spriteBatch) { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); - return projectile.DrawFishingLine(ModContent.ItemType(), new Color(220, 20, 60, 100)); + Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0f); + return Projectile.DrawFishingLine(ModContent.ItemType(), new Color(220, 20, 60, 100)); } } } diff --git a/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs b/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs index 260d4d8f5a..dac9de109b 100644 --- a/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs +++ b/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless.FiniteUse { public class ExplosiveShotgunShell : ModProjectile @@ -13,17 +14,17 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.extraUpdates = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) @@ -33,34 +34,34 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse public override bool OnTileCollide(Vector2 oldVelocity) { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.position); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); return true; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - projectile.width / 2; - projectile.position.Y = projectile.position.Y - projectile.height / 2; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 32; + Projectile.position.X = Projectile.position.X - Projectile.width / 2; + Projectile.position.Y = Projectile.position.Y - Projectile.height / 2; for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); } for (int num194 = 0; num194 < 20; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 0, default, 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 0, default, 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); } } } diff --git a/Projectiles/Typeless/FiniteUse/GrenadeRound.cs b/Projectiles/Typeless/FiniteUse/GrenadeRound.cs index c2f5c24a06..52ee2c05d9 100644 --- a/Projectiles/Typeless/FiniteUse/GrenadeRound.cs +++ b/Projectiles/Typeless/FiniteUse/GrenadeRound.cs @@ -3,6 +3,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless.FiniteUse { @@ -15,28 +16,28 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; } public override void AI() { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; - if (projectile.soundDelay == 0) + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 1.57f; + if (Projectile.soundDelay == 0) { - projectile.soundDelay = 90; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BazookaRocket"), (int)projectile.position.X, (int)projectile.position.Y); + Projectile.soundDelay = 90; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BazookaRocket"), (int)Projectile.position.X, (int)Projectile.position.Y); } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 30f) - projectile.velocity.Y = projectile.velocity.Y + 0.1f; - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 30f) + Projectile.velocity.Y = Projectile.velocity.Y + 0.1f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { for (int num246 = 0; num246 < 2; num246++) { @@ -44,14 +45,14 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse float num248 = 0f; if (num246 == 1) { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; + num247 = Projectile.velocity.X * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); + int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); Main.dust[num249].scale *= 2f + Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); + num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); Main.dust[num249].fadeIn = 1f + Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } @@ -65,25 +66,25 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item62, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 96; - projectile.position.X = projectile.position.X - projectile.width / 2; - projectile.position.Y = projectile.position.Y - projectile.height / 2; + SoundEngine.PlaySound(SoundID.Item62, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 96; + Projectile.position.X = Projectile.position.X - Projectile.width / 2; + Projectile.position.Y = Projectile.position.Y - Projectile.height / 2; for (int num193 = 0; num193 < 6; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); } for (int num194 = 0; num194 < 60; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 0, default, 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 0, default, 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } - projectile.Damage(); + Projectile.Damage(); } } } diff --git a/Projectiles/Typeless/FiniteUse/MagnumRound.cs b/Projectiles/Typeless/FiniteUse/MagnumRound.cs index 518ab59d86..0cf048c350 100644 --- a/Projectiles/Typeless/FiniteUse/MagnumRound.cs +++ b/Projectiles/Typeless/FiniteUse/MagnumRound.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.extraUpdates = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = 1; - projectile.timeLeft = 600; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) diff --git a/Projectiles/Typeless/FlareExplosion.cs b/Projectiles/Typeless/FlareExplosion.cs index 3d6192d769..3f43ebb663 100644 --- a/Projectiles/Typeless/FlareExplosion.cs +++ b/Projectiles/Typeless/FlareExplosion.cs @@ -15,26 +15,26 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 100; - projectile.height = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 100; + Projectile.height = 100; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 3f / 255f, (255 - projectile.alpha) * 3f / 255f, (255 - projectile.alpha) * 0f / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 3f / 255f, (255 - Projectile.alpha) * 3f / 255f, (255 - Projectile.alpha) * 0f / 255f); + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 5; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 0.5f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 0.5f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } diff --git a/Projectiles/Typeless/FuckYou.cs b/Projectiles/Typeless/FuckYou.cs index 26187dd2ef..a270977663 100644 --- a/Projectiles/Typeless/FuckYou.cs +++ b/Projectiles/Typeless/FuckYou.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -12,72 +13,72 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 60; // Lasts so long due to visuals. - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 600; // Under absolutely no circumstances should this explosion hit more than once. + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; // Lasts so long due to visuals. + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 600; // Under absolutely no circumstances should this explosion hit more than once. } public override void AI() { - Lighting.AddLight(projectile.Center, 0.9f, 0.8f, 0.6f); - projectile.ai[1] += 0.01f; - projectile.scale = projectile.ai[1] * 0.5f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= (float)(3 * Main.projFrames[projectile.type])) + Lighting.AddLight(Projectile.Center, 0.9f, 0.8f, 0.6f); + Projectile.ai[1] += 0.01f; + Projectile.scale = Projectile.ai[1] * 0.5f; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= (float)(3 * Main.projFrames[Projectile.type])) { - projectile.Kill(); + Projectile.Kill(); return; } - int incrementer = projectile.frameCounter + 1; - projectile.frameCounter = incrementer; + int incrementer = Projectile.frameCounter + 1; + Projectile.frameCounter = incrementer; if (incrementer >= 3) { - projectile.frameCounter = 0; - incrementer = projectile.frame + 1; - projectile.frame = incrementer; - if (incrementer >= Main.projFrames[projectile.type]) + Projectile.frameCounter = 0; + incrementer = Projectile.frame + 1; + Projectile.frame = incrementer; + if (incrementer >= Main.projFrames[Projectile.type]) { - projectile.hide = true; + Projectile.hide = true; } } - projectile.alpha -= 63; - if (projectile.alpha < 0) + Projectile.alpha -= 63; + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.position = projectile.Center; - projectile.width = projectile.height = (int)(52f * projectile.scale); - projectile.Center = projectile.position; - Main.PlaySound(SoundID.Item14, projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = (int)(52f * Projectile.scale); + Projectile.Center = Projectile.position; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int dustIndexA = 0; dustIndexA < 4; dustIndexA = incrementer + 1) { - int num992 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); - Main.dust[num992].position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num992 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); + Main.dust[num992].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; incrementer = dustIndexA; } for (int dustIndexB = 0; dustIndexB < 10; dustIndexB = incrementer + 1) { - int fireDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 200, default, 2.7f); + int fireDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 200, default, 2.7f); Dust dust = Main.dust[fireDust]; - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; - fireDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1.5f); - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + fireDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1.5f); + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.velocity *= 2f; dust.noGravity = true; dust.fadeIn = 2.5f; @@ -85,18 +86,18 @@ namespace CalamityMod.Projectiles.Typeless } for (int dustIndexC = 0; dustIndexC < 5; dustIndexC = incrementer + 1) { - int fireDust2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 0, default, 2.7f); + int fireDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 0, default, 2.7f); Dust dust = Main.dust[fireDust2]; - dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; incrementer = dustIndexC; } for (int dustIndexD = 0; dustIndexD < 10; dustIndexD = incrementer + 1) { - int num998 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 0, default, 1.5f); + int num998 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 0, default, 1.5f); Dust dust = Main.dust[num998]; - dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; incrementer = dustIndexD; @@ -106,7 +107,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - return projectile.ai[0] > 1f; + return Projectile.ai[0] > 1f; } public override Color? GetAlpha(Color lightColor) @@ -117,13 +118,13 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.OnFire, 180); - projectile.direction = Main.player[projectile.owner].direction; + Projectile.direction = Main.player[Projectile.owner].direction; } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.OnFire, 180); - projectile.direction = Main.player[projectile.owner].direction; + Projectile.direction = Main.player[Projectile.owner].direction; } } } diff --git a/Projectiles/Typeless/GemTechArmorGem.cs b/Projectiles/Typeless/GemTechArmorGem.cs index bce29d5271..147faff470 100644 --- a/Projectiles/Typeless/GemTechArmorGem.cs +++ b/Projectiles/Typeless/GemTechArmorGem.cs @@ -5,13 +5,14 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class GemTechArmorGem : ModProjectile { - public ref float Time => ref projectile.ai[0]; - public ref float Variant => ref projectile.ai[1]; + public ref float Time => ref Projectile.ai[0]; + public ref float Variant => ref Projectile.ai[1]; public const int UpwardFlyTime = 24; public const int RedirectTime = 12; public PrimitiveTrail FlameTrailDrawer = null; @@ -20,22 +21,22 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Trireme's Gem"); - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; } public override void SetDefaults() { - projectile.width = projectile.height = 14; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 2; - projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 13; - projectile.timeLeft = projectile.MaxUpdates * 420; - projectile.Calamity().rogue = true; + Projectile.width = Projectile.height = 14; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 2; + Projectile.MaxUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 13; + Projectile.timeLeft = Projectile.MaxUpdates * 420; + Projectile.Calamity().rogue = true; } public Color GemColor => GemTechArmorState.GetColorFromGemType((GemTechArmorGemType)Variant); @@ -43,32 +44,32 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { // Create a puff of energy on the first frame. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { for (int i = 0; i < 7; i++) { - Dust energyPuff = Dust.NewDustPerfect(projectile.Center, 267); + Dust energyPuff = Dust.NewDustPerfect(Projectile.Center, 267); energyPuff.velocity = -Vector2.UnitY.RotatedByRandom(0.81f) * Main.rand.NextFloat(1.25f, 4.5f); energyPuff.color = Color.Lerp(GemColor, Color.White, Main.rand.NextFloat(0.5f)); energyPuff.scale = 1.1f; energyPuff.alpha = 185; energyPuff.noGravity = true; } - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } // This intentionally uses boss priority when homing. - NPC potentialTarget = projectile.Center.ClosestNPCAt(2700f, true, true); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(2700f, true, true); // Increment the timer on the last extra update. - if (projectile.FinalExtraUpdate()) + if (Projectile.FinalExtraUpdate()) Time++; // Fly into the air. if (Time < UpwardFlyTime) { - projectile.velocity = Vector2.Lerp(projectile.velocity, -Vector2.UnitY * 3f, 0.1f); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, -Vector2.UnitY * 3f, 0.1f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; return; } @@ -77,20 +78,20 @@ namespace CalamityMod.Projectiles.Typeless { if (potentialTarget != null) { - float angleToTarget = projectile.AngleTo(potentialTarget.Center) + MathHelper.PiOver2; - projectile.rotation = projectile.rotation.AngleLerp(angleToTarget, 0.225f).AngleTowards(angleToTarget, 0.6f); - projectile.velocity = projectile.velocity.MoveTowards(Vector2.Zero, 1.9f) * 0.9f; + float angleToTarget = Projectile.AngleTo(potentialTarget.Center) + MathHelper.PiOver2; + Projectile.rotation = Projectile.rotation.AngleLerp(angleToTarget, 0.225f).AngleTowards(angleToTarget, 0.6f); + Projectile.velocity = Projectile.velocity.MoveTowards(Vector2.Zero, 1.9f) * 0.9f; } return; } // Create some visual and acoustic effects right before charging. - if (Time == UpwardFlyTime + RedirectTime && projectile.FinalExtraUpdate()) + if (Time == UpwardFlyTime + RedirectTime && Projectile.FinalExtraUpdate()) { - Main.PlaySound(SoundID.Item72, projectile.Center); + SoundEngine.PlaySound(SoundID.Item72, Projectile.Center); for (int i = 0; i < 12; i++) { - Dust energyPuff = Dust.NewDustPerfect(projectile.Center, 267); + Dust energyPuff = Dust.NewDustPerfect(Projectile.Center, 267); energyPuff.velocity = (MathHelper.TwoPi * i / 12f).ToRotationVector2() * 5f; energyPuff.color = GemColor; energyPuff.scale = 1.125f; @@ -100,25 +101,25 @@ namespace CalamityMod.Projectiles.Typeless } // Rapidly move towards the nearest target. - if (potentialTarget != null && projectile.penetrate >= projectile.maxPenetrate) + if (potentialTarget != null && Projectile.penetrate >= Projectile.maxPenetrate) { - float distanceFromTarget = projectile.Distance(potentialTarget.Center); + float distanceFromTarget = Projectile.Distance(potentialTarget.Center); float moveInterpolant = Utils.InverseLerp(0f, 100f, distanceFromTarget, true) * Utils.InverseLerp(600f, 400f, distanceFromTarget, true); - Vector2 targetCenterOffsetVec = potentialTarget.Center - projectile.Center; + Vector2 targetCenterOffsetVec = potentialTarget.Center - Projectile.Center; float movementSpeed = MathHelper.Min(37.5f, targetCenterOffsetVec.Length()); Vector2 idealVelocity = targetCenterOffsetVec.SafeNormalize(Vector2.Zero) * movementSpeed; // Ensure velocity never has a magnitude less than 4. - if (projectile.velocity.Length() < 4f) - projectile.velocity += projectile.velocity.RotatedBy(MathHelper.PiOver4).SafeNormalize(Vector2.Zero) * 4f; + if (Projectile.velocity.Length() < 4f) + Projectile.velocity += Projectile.velocity.RotatedBy(MathHelper.PiOver4).SafeNormalize(Vector2.Zero) * 4f; // Die if anything goes wrong with the velocity. - if (projectile.velocity.HasNaNs()) - projectile.Kill(); + if (Projectile.velocity.HasNaNs()) + Projectile.Kill(); // Approach the ideal velocity. - projectile.velocity = Vector2.Lerp(projectile.velocity, idealVelocity, moveInterpolant * 0.08f); - projectile.velocity = projectile.velocity.MoveTowards(idealVelocity, 2f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, moveInterpolant * 0.08f); + Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 2f); } } @@ -141,48 +142,48 @@ namespace CalamityMod.Projectiles.Typeless FlameTrailDrawer = new PrimitiveTrail(TrailWidth, TrailColor, null, GameShaders.Misc["CalamityMod:ImpFlameTrail"]); // Prepare the flame trail shader with its map texture. - GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/ScarletDevilStreak")); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/ScarletDevilStreak")); Texture2D texture; switch (Variant) { case (int)GemTechArmorGemType.Melee: default: - texture = Main.projectileTexture[projectile.type]; + texture = Main.projectileTexture[Projectile.type]; break; case (int)GemTechArmorGemType.Ranged: - texture = ModContent.GetTexture("CalamityMod/ExtraTextures/GemTechArmor/GreenGem"); + texture = ModContent.Request("CalamityMod/ExtraTextures/GemTechArmor/GreenGem"); break; case (int)GemTechArmorGemType.Magic: - texture = ModContent.GetTexture("CalamityMod/ExtraTextures/GemTechArmor/PurpleGem"); + texture = ModContent.Request("CalamityMod/ExtraTextures/GemTechArmor/PurpleGem"); break; case (int)GemTechArmorGemType.Summoner: - texture = ModContent.GetTexture("CalamityMod/ExtraTextures/GemTechArmor/BlueGem"); + texture = ModContent.Request("CalamityMod/ExtraTextures/GemTechArmor/BlueGem"); break; case (int)GemTechArmorGemType.Rogue: - texture = ModContent.GetTexture("CalamityMod/ExtraTextures/GemTechArmor/RedGem"); + texture = ModContent.Request("CalamityMod/ExtraTextures/GemTechArmor/RedGem"); break; case (int)GemTechArmorGemType.Base: - texture = ModContent.GetTexture("CalamityMod/ExtraTextures/GemTechArmor/PinkGem"); + texture = ModContent.Request("CalamityMod/ExtraTextures/GemTechArmor/PinkGem"); break; } - Vector2 drawPosition = projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() * 0.5f; - spriteBatch.Draw(texture, drawPosition, null, projectile.GetAlpha(Color.White), projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(Color.White), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); - if (projectile.ai[0] > UpwardFlyTime + RedirectTime) - FlameTrailDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f - Main.screenPosition, 71); + if (Projectile.ai[0] > UpwardFlyTime + RedirectTime) + FlameTrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 71); return false; } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - projectile.damage = 0; - projectile.velocity = Vector2.Zero; - projectile.timeLeft = ProjectileID.Sets.TrailCacheLength[projectile.type]; - projectile.netUpdate = true; + Projectile.damage = 0; + Projectile.velocity = Vector2.Zero; + Projectile.timeLeft = ProjectileID.Sets.TrailCacheLength[Projectile.type]; + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Typeless/GhostlyBolt.cs b/Projectiles/Typeless/GhostlyBolt.cs index ad4f730a7b..bc0076d52f 100644 --- a/Projectiles/Typeless/GhostlyBolt.cs +++ b/Projectiles/Typeless/GhostlyBolt.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -16,39 +17,39 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.tileCollide = false; + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; + Projectile.timeLeft = 900; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; } public override void AI() { - if (projectile.localAI[0] == 6f) + if (Projectile.localAI[0] == 6f) { - Main.PlaySound(SoundID.Item8, projectile.position); + SoundEngine.PlaySound(SoundID.Item8, Projectile.position); for (int num151 = 0; num151 < 40; num151++) { - int num152 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 181, 0f, 0f, 100, default, 1f); + int num152 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 181, 0f, 0f, 100, default, 1f); Main.dust[num152].velocity *= 3f; - Main.dust[num152].velocity += projectile.velocity * 0.75f; + Main.dust[num152].velocity += Projectile.velocity * 0.75f; Main.dust[num152].scale *= 1.2f; Main.dust[num152].noGravity = true; } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 6f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 6f) { for (int num153 = 0; num153 < 3; num153++) { - int num154 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 181, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num154 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 181, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); Main.dust[num154].velocity *= 0.6f; Main.dust[num154].scale *= 1.4f; Main.dust[num154].noGravity = true; diff --git a/Projectiles/Typeless/GladiatorSword.cs b/Projectiles/Typeless/GladiatorSword.cs index 1b661ba401..ef1fe109e3 100644 --- a/Projectiles/Typeless/GladiatorSword.cs +++ b/Projectiles/Typeless/GladiatorSword.cs @@ -13,45 +13,45 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Gladiator Sword"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = projectile.height = 22; - projectile.ignoreWater = true; - projectile.timeLeft = 18000; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.timeLeft *= 5; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = Projectile.height = 22; + Projectile.ignoreWater = true; + Projectile.timeLeft = 18000; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.timeLeft *= 5; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - bool flag64 = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool flag64 = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.AverageDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.AverageDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } - if (player.AverageDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.AverageDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.AverageDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } if (!modPlayer.gladiatorSword) { - projectile.active = false; + Projectile.active = false; return; } @@ -60,21 +60,21 @@ namespace CalamityMod.Projectiles.Typeless if (player.dead) modPlayer.glSword = false; if (modPlayer.glSword) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - Lighting.AddLight(projectile.Center, 0.15f, 0.15f, 0f); + Lighting.AddLight(Projectile.Center, 0.15f, 0.15f, 0f); - Vector2 vector = player.Center - projectile.Center; - projectile.rotation = vector.ToRotation() - MathHelper.PiOver2; + Vector2 vector = player.Center - Projectile.Center; + Projectile.rotation = vector.ToRotation() - MathHelper.PiOver2; - projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); + Projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); rotation += 0.1; if (rotation >= 360D) rotation = 0D; - projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; + Projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; } } } diff --git a/Projectiles/Typeless/GladiatorSword2.cs b/Projectiles/Typeless/GladiatorSword2.cs index 54c2e3598a..53285386f4 100644 --- a/Projectiles/Typeless/GladiatorSword2.cs +++ b/Projectiles/Typeless/GladiatorSword2.cs @@ -13,46 +13,46 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Gladiator Sword"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; - projectile.ignoreWater = true; - projectile.timeLeft = 18000; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.timeLeft *= 5; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 22; + Projectile.height = 22; + Projectile.ignoreWater = true; + Projectile.timeLeft = 18000; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.timeLeft *= 5; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - bool flag64 = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool flag64 = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.AverageDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] += 1f; + Projectile.Calamity().spawnedPlayerMinionDamageValue = player.AverageDamage(); + Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; + Projectile.localAI[0] += 1f; } - if (player.AverageDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.AverageDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + Projectile.Calamity().spawnedPlayerMinionDamageValue * player.AverageDamage()); - projectile.damage = damage2; + Projectile.damage = damage2; } if (!modPlayer.gladiatorSword) { - projectile.active = false; + Projectile.active = false; return; } @@ -61,22 +61,22 @@ namespace CalamityMod.Projectiles.Typeless if (player.dead) modPlayer.glSword = false; if (modPlayer.glSword) - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } - Lighting.AddLight(projectile.Center, 0.15f, 0.15f, 0f); + Lighting.AddLight(Projectile.Center, 0.15f, 0.15f, 0f); - Vector2 vector = player.Center - projectile.Center; - projectile.rotation = vector.ToRotation() - MathHelper.PiOver2; + Vector2 vector = player.Center - Projectile.Center; + Projectile.rotation = vector.ToRotation() - MathHelper.PiOver2; - projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); + Projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); // Values are slightly different from the other sword to make this sword marginally slower so the intersection point isn't always at the same spot rotation -= 0.09; if (rotation <= 0D) rotation = 360D; - projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; + Projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; } } } diff --git a/Projectiles/Typeless/GodKiller.cs b/Projectiles/Typeless/GodKiller.cs index acc7c30e62..c8a381ba3c 100644 --- a/Projectiles/Typeless/GodKiller.cs +++ b/Projectiles/Typeless/GodKiller.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class GodKiller : ModProjectile @@ -12,44 +13,44 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("God Killer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 22; - projectile.height = 46; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; + Projectile.width = 22; + Projectile.height = 46; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; } public override void AI() { - if (projectile.alpha > 0) - projectile.alpha -= 5; + if (Projectile.alpha > 0) + Projectile.alpha -= 5; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; + if (Projectile.owner == Main.myPlayer && Projectile.timeLeft <= 3) { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 100; - projectile.height = 100; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 5f; + Projectile.tileCollide = false; + Projectile.ai[1] = 0f; + Projectile.alpha = 255; + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 100; + Projectile.height = 100; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.knockBack = 5f; } else { - if (Math.Abs(projectile.velocity.X) >= 2f || Math.Abs(projectile.velocity.Y) >= 2f) + if (Math.Abs(Projectile.velocity.X) >= 2f || Math.Abs(Projectile.velocity.Y) >= 2f) { for (int num246 = 0; num246 < 2; num246++) { @@ -57,34 +58,34 @@ namespace CalamityMod.Projectiles.Typeless float num248 = 0f; if (num246 == 1) { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; + num247 = Projectile.velocity.X * 0.5f; + num248 = Projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 173, 0f, 0f, 100, default, 1f); + int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 173, 0f, 0f, 100, default, 1f); Main.dust[num249].scale *= 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 199, 0f, 0f, 100, default, 0.1f); + num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 199, 0f, 0f, 100, default, 0.1f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Vector2 origin = new Vector2(11f, 23f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Typeless/GodKillerGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Typeless/GodKillerGlow"), Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item89, projectile.position); + SoundEngine.PlaySound(SoundID.Item89, Projectile.position); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 199, 0f, 0f, 100, default, 1.5f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 199, 0f, 0f, 100, default, 1.5f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -94,10 +95,10 @@ namespace CalamityMod.Projectiles.Typeless } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.5f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.5f); Main.dust[num624].velocity *= 2f; } } @@ -114,7 +115,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Typeless/GodSlayerBlaze.cs b/Projectiles/Typeless/GodSlayerBlaze.cs index 415d58ea45..4dcbdfa391 100644 --- a/Projectiles/Typeless/GodSlayerBlaze.cs +++ b/Projectiles/Typeless/GodSlayerBlaze.cs @@ -17,36 +17,36 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + Projectile.width = 250; + Projectile.height = 250; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.5f, 0f, 0.75f); + Lighting.AddLight(Projectile.Center, 0.5f, 0f, 0.75f); float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; float scale = 0.7f; int dustType = Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(); - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { scale = 1.5f; dustType = 173; @@ -60,13 +60,13 @@ namespace CalamityMod.Projectiles.Typeless num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, scale); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, scale); Dust dust = Main.dust[num467]; if (dustType != 173) dust.color = new Color(255, 255, 255, 0); dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) target.AddBuff(ModContent.BuffType(), 300); else target.AddBuff(ModContent.BuffType(), 300); @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.ai[1] == 1f) + if (Projectile.ai[1] == 1f) target.AddBuff(ModContent.BuffType(), 300); else target.AddBuff(ModContent.BuffType(), 300); diff --git a/Projectiles/Typeless/GodSlayerOrb.cs b/Projectiles/Typeless/GodSlayerOrb.cs index 1b0368b394..0e9dee2361 100644 --- a/Projectiles/Typeless/GodSlayerOrb.cs +++ b/Projectiles/Typeless/GodSlayerOrb.cs @@ -15,21 +15,21 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 200; - projectile.extraUpdates = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 200; + Projectile.extraUpdates = 1; } public override void AI() { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Typeless/GodSlayerPhantom.cs b/Projectiles/Typeless/GodSlayerPhantom.cs index 96331c011d..0f9428ad2c 100644 --- a/Projectiles/Typeless/GodSlayerPhantom.cs +++ b/Projectiles/Typeless/GodSlayerPhantom.cs @@ -11,77 +11,77 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("God Slayer Phantom"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.penetrate = -1; - projectile.timeLeft = 300; + Projectile.width = 20; + Projectile.height = 20; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 2) + if (Projectile.frame > 2) { - projectile.frame = 0; + Projectile.frame = 0; } - int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 0, default, 0.5f); + int num822 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 0.5f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; dust.scale = 1.3f; dust.noGravity = true; - float num953 = 40f * projectile.ai[1]; //100 - float scaleFactor12 = 8f * projectile.ai[1]; //5 + float num953 = 40f * Projectile.ai[1]; //100 + float scaleFactor12 = 8f * Projectile.ai[1]; //5 float num954 = 600f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; + Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + if (Projectile.Distance(Main.player[Projectile.owner].Center) > num954) { - Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } else { - if (projectile.timeLeft > 30) + if (Projectile.timeLeft > 30) { - projectile.timeLeft = 30; + Projectile.timeLeft = 30; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } @@ -100,22 +100,22 @@ namespace CalamityMod.Projectiles.Typeless public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 40; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 40; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 0.5f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - projectile.Damage(); + Projectile.Damage(); } } } diff --git a/Projectiles/Typeless/GodSlayerShrapnel.cs b/Projectiles/Typeless/GodSlayerShrapnel.cs index 7d80e8cf30..0d5fda3ae3 100644 --- a/Projectiles/Typeless/GodSlayerShrapnel.cs +++ b/Projectiles/Typeless/GodSlayerShrapnel.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class GodSlayerShrapnel : ModProjectile @@ -15,49 +16,49 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 90; + Projectile.width = 6; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 90; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + Projectile.velocity.X = Projectile.velocity.X * -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; - if (projectile.ai[1] == 0f && projectile.type >= 326 && projectile.type <= 328) + Projectile.rotation += Projectile.velocity.X * 0.1f; + if (Projectile.ai[1] == 0f && Projectile.type >= 326 && Projectile.type <= 328) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item13, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item13, Projectile.position); } - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 0.5f); + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 0.5f); Dust dust = Main.dust[num199]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -66,7 +67,7 @@ namespace CalamityMod.Projectiles.Typeless dust.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 0.5f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 0.5f); Dust dust2 = Main.dust[num200]; dust2.position.X -= 2f; dust2.position.Y += 2f; @@ -74,14 +75,14 @@ namespace CalamityMod.Projectiles.Typeless dust2.noGravity = true; dust2.velocity *= 0.1f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + Projectile.velocity.X = Projectile.velocity.X * 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) + Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } diff --git a/Projectiles/Typeless/GodSlayerShrapnelRound.cs b/Projectiles/Typeless/GodSlayerShrapnelRound.cs index b50c2eecb4..b01c3b651b 100644 --- a/Projectiles/Typeless/GodSlayerShrapnelRound.cs +++ b/Projectiles/Typeless/GodSlayerShrapnelRound.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class GodSlayerShrapnelRound : ModProjectile @@ -15,39 +16,39 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 300; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item73, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item73, Projectile.position); + Projectile.localAI[0] += 1f; } for (int d = 0; d < 3; d++) { - int cosmilite = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); + int cosmilite = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1.2f); Main.dust[cosmilite].noGravity = true; Main.dust[cosmilite].velocity *= 0.5f; - Main.dust[cosmilite].velocity += projectile.velocity * 0.1f; + Main.dust[cosmilite].velocity += Projectile.velocity * 0.1f; } } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { int shrapnelAmt = Main.rand.Next(4, 7); for (int s = 0; s < shrapnelAmt; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 0f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Typeless/GoldenGunProj.cs b/Projectiles/Typeless/GoldenGunProj.cs index 5c7a255fc0..9db1765b68 100644 --- a/Projectiles/Typeless/GoldenGunProj.cs +++ b/Projectiles/Typeless/GoldenGunProj.cs @@ -16,23 +16,23 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.extraUpdates = 2; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.penetrate = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 2; } public override void AI() { - if (projectile.localAI[0] < 5f) + if (Projectile.localAI[0] < 5f) { - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; return; } int num3; @@ -40,10 +40,10 @@ namespace CalamityMod.Projectiles.Typeless { for (int num587 = 0; num587 < 6; num587 = num3 + 1) { - float num588 = projectile.velocity.X / 6f * (float)num587; - float num589 = projectile.velocity.Y / 6f * (float)num587; + float num588 = Projectile.velocity.X / 6f * (float)num587; + float num589 = Projectile.velocity.Y / 6f * (float)num587; int num590 = 6; - int num591 = Dust.NewDust(new Vector2(projectile.position.X + (float)num590, projectile.position.Y + (float)num590), projectile.width - num590 * 2, projectile.height - num590 * 2, 170, 0f, 0f, 75, default, 1.2f); + int num591 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num590, Projectile.position.Y + (float)num590), Projectile.width - num590 * 2, Projectile.height - num590 * 2, 170, 0f, 0f, 75, default, 1.2f); Dust dust = Main.dust[num591]; if (Main.rand.NextBool(2)) { @@ -59,8 +59,8 @@ namespace CalamityMod.Projectiles.Typeless } dust.noGravity = true; dust.velocity *= 0.3f; - dust.velocity += projectile.velocity * 0.5f; - dust.position = projectile.Center; + dust.velocity += Projectile.velocity * 0.5f; + dust.position = Projectile.Center; dust.position.X -= num588; dust.position.Y -= num589; dust.velocity *= 0.2f; @@ -69,10 +69,10 @@ namespace CalamityMod.Projectiles.Typeless if (Main.rand.NextBool(4)) { int num592 = 6; - int num593 = Dust.NewDust(new Vector2(projectile.position.X + (float)num592, projectile.position.Y + (float)num592), projectile.width - num592 * 2, projectile.height - num592 * 2, 170, 0f, 0f, 75, default, 0.65f); + int num593 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num592, Projectile.position.Y + (float)num592), Projectile.width - num592 * 2, Projectile.height - num592 * 2, 170, 0f, 0f, 75, default, 0.65f); Dust dust = Main.dust[num593]; dust.velocity *= 0.5f; - dust.velocity += projectile.velocity * 0.5f; + dust.velocity += Projectile.velocity * 0.5f; } num3 = num586; } @@ -80,11 +80,11 @@ namespace CalamityMod.Projectiles.Typeless public override void Kill(int timeLeft) { - projectile.velocity = projectile.oldVelocity * 0.2f; + Projectile.velocity = Projectile.oldVelocity * 0.2f; int num3; for (int num362 = 0; num362 < 100; num362 = num3 + 1) { - int num363 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 170, 0f, 0f, 75, default, 1.2f); + int num363 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 170, 0f, 0f, 75, default, 1.2f); Dust dust = Main.dust[num363]; if (Main.rand.NextBool(2)) { @@ -107,11 +107,11 @@ namespace CalamityMod.Projectiles.Typeless dust.noGravity = true; } dust.velocity *= 0.3f; - dust.velocity += projectile.velocity; + dust.velocity += Projectile.velocity; dust.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; dust.velocity.X += (float)Main.rand.Next(-50, 51) * 0.015f; dust.velocity.Y += (float)Main.rand.Next(-50, 51) * 0.015f; - dust.position = projectile.Center; + dust.position = Projectile.Center; num3 = num362; } } diff --git a/Projectiles/Typeless/GreenLabSeeker.cs b/Projectiles/Typeless/GreenLabSeeker.cs index d69f364ab2..f7d90ec15d 100644 --- a/Projectiles/Typeless/GreenLabSeeker.cs +++ b/Projectiles/Typeless/GreenLabSeeker.cs @@ -9,33 +9,33 @@ namespace CalamityMod.Projectiles.Typeless { public class GreenLabSeeker : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Items/LabFinders/GreenSeekingMechanism"; public override void SetStaticDefaults() { DisplayName.SetDefault("Seeking Mechanism"); - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; } public override void SetDefaults() { - projectile.width = projectile.height = 24; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 300; + Projectile.width = Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; } - public override void AI() => RedLabSeeker.Behavior(projectile, CalamityWorld.JungleLabCenter, Color.Green, ref Time); + public override void AI() => RedLabSeeker.Behavior(Projectile, CalamityWorld.JungleLabCenter, Color.Green, ref Time); public override void Kill(int timeLeft) { for (int i = 0; i < 8; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); dust.color = Color.Green; dust.scale = Main.rand.NextFloat(0.95f, 1.25f); dust.velocity = Main.rand.NextVector2Circular(2.5f, 2.5f); @@ -49,13 +49,13 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - if (Time > 80f && projectile.ai[1] == 0f) + Texture2D texture = Main.projectileTexture[Projectile.type]; + if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) { - Vector2 drawPosition = projectile.Center - projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; - spriteBatch.Draw(texture, drawPosition, null, projectile.GetAlpha(lightColor) * (1f - i / 24f), projectile.rotation, texture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + Vector2 drawPosition = Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; + spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor) * (1f - i / 24f), Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); } } return true; diff --git a/Projectiles/Typeless/HellfireExplosionFriendly2.cs b/Projectiles/Typeless/HellfireExplosionFriendly2.cs index d171636685..328b68813c 100644 --- a/Projectiles/Typeless/HellfireExplosionFriendly2.cs +++ b/Projectiles/Typeless/HellfireExplosionFriendly2.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class HellfireExplosionFriendly2 : ModProjectile @@ -18,37 +19,37 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 130; - projectile.height = 130; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 130; + Projectile.height = 130; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - if (projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); + if (Projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.localAI[0] += 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.localAI[0] += 1f; } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -59,11 +60,11 @@ namespace CalamityMod.Projectiles.Typeless num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 0.75f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 0.75f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Typeless/HeronBobber.cs b/Projectiles/Typeless/HeronBobber.cs index feb17f2640..bea7b86722 100644 --- a/Projectiles/Typeless/HeronBobber.cs +++ b/Projectiles/Typeless/HeronBobber.cs @@ -13,16 +13,16 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 61; - projectile.bobber = true; - projectile.penetrate = -1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 61; + Projectile.bobber = true; + Projectile.penetrate = -1; } public override bool PreDrawExtras(SpriteBatch spriteBatch) { - return projectile.DrawFishingLine(ModContent.ItemType(), new Color(101, 149, 154, 100)); + return Projectile.DrawFishingLine(ModContent.ItemType(), new Color(101, 149, 154, 100)); } } } diff --git a/Projectiles/Typeless/HolyEruption.cs b/Projectiles/Typeless/HolyEruption.cs index 71355595c8..b2447b1e65 100644 --- a/Projectiles/Typeless/HolyEruption.cs +++ b/Projectiles/Typeless/HolyEruption.cs @@ -15,46 +15,46 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 12; - projectile.height = 96; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 360; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 12; + Projectile.height = 96; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 360; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + Projectile.velocity.X = Projectile.velocity.X * -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Projectile.rotation += Projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num199]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Typeless dust.velocity.Y -= 16f; if (Main.rand.NextBool(2)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 1f); Dust dust2 = Main.dust[num200]; dust2.position.X -= 2f; dust2.position.Y += 2f; @@ -71,14 +71,14 @@ namespace CalamityMod.Projectiles.Typeless dust2.noGravity = true; dust2.velocity *= 0.8f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + Projectile.velocity.X = Projectile.velocity.X * 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) + Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } diff --git a/Projectiles/Typeless/HolyExplosion.cs b/Projectiles/Typeless/HolyExplosion.cs index 9cbde1ea87..ac1689cdab 100644 --- a/Projectiles/Typeless/HolyExplosion.cs +++ b/Projectiles/Typeless/HolyExplosion.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class HolyExplosion : ModProjectile @@ -15,29 +16,29 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 20; + Projectile.height = 20; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -47,10 +48,10 @@ namespace CalamityMod.Projectiles.Typeless } for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Typeless/HolyExplosionSupreme.cs b/Projectiles/Typeless/HolyExplosionSupreme.cs index 05398a1421..2494f759af 100644 --- a/Projectiles/Typeless/HolyExplosionSupreme.cs +++ b/Projectiles/Typeless/HolyExplosionSupreme.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class HolyExplosionSupreme : ModProjectile @@ -15,29 +16,29 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 60; - projectile.height = 60; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 60; - projectile.height = 60; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 60; + Projectile.height = 60; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -47,10 +48,10 @@ namespace CalamityMod.Projectiles.Typeless } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Typeless/HolyFlameBomb.cs b/Projectiles/Typeless/HolyFlameBomb.cs index 328e92cda1..24ef487b01 100644 --- a/Projectiles/Typeless/HolyFlameBomb.cs +++ b/Projectiles/Typeless/HolyFlameBomb.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class HolyFlameBomb : ModProjectile @@ -10,52 +11,52 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.ignoreWater = true; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.ignoreWater = true; } public override void AI() { - projectile.velocity.Y *= 1.005f; - projectile.alpha -= 2; - if (projectile.alpha <= 0) + Projectile.velocity.Y *= 1.005f; + Projectile.alpha -= 2; + if (Projectile.alpha <= 0) { - projectile.Kill(); + Projectile.Kill(); } - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (Projectile.frame > 3) { - projectile.frame = 0; + Projectile.frame = 0; } - Lighting.AddLight(projectile.Center, 0.5f, 0.35f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.35f, 0f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -65,10 +66,10 @@ namespace CalamityMod.Projectiles.Typeless } for (int num623 = 0; num623 < 35; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Typeless/HydrothermalSmoke.cs b/Projectiles/Typeless/HydrothermalSmoke.cs index ccd86b50ba..f6e8ce0b09 100644 --- a/Projectiles/Typeless/HydrothermalSmoke.cs +++ b/Projectiles/Typeless/HydrothermalSmoke.cs @@ -15,19 +15,19 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 20; - projectile.height = 42; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 6; + Projectile.width = 20; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 6; } public override void AI() { - if (projectile.timeLeft == 6) - projectile.Center = Main.player[projectile.owner].Center; + if (Projectile.timeLeft == 6) + Projectile.Center = Main.player[Projectile.owner].Center; int randomDust = Main.rand.Next(4); if (randomDust == 3) @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Typeless } if (Main.rand.NextBool(4)) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); if (Main.rand.NextBool(4)) { Main.dust[num469].scale *= 0.35f; @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[num469].velocity *= 0f; } - Vector2 goreVec = new Vector2(projectile.position.X, projectile.position.Y); + Vector2 goreVec = new Vector2(Projectile.position.X, Projectile.position.Y); if (Main.rand.NextBool(8)) { int smoke = Gore.NewGore(goreVec, default, Main.rand.Next(375, 378), 0.75f); diff --git a/Projectiles/Typeless/KelvinCatalystStar.cs b/Projectiles/Typeless/KelvinCatalystStar.cs index d417ceec92..e88abb922c 100644 --- a/Projectiles/Typeless/KelvinCatalystStar.cs +++ b/Projectiles/Typeless/KelvinCatalystStar.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -11,43 +12,43 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Kelvin Catalyst Star"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.coldDamage = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.coldDamage = true; } public override void AI() { - if (projectile.ai[0] < 90f) + if (Projectile.ai[0] < 90f) { - projectile.ai[0] += 1f; - projectile.velocity.X *= 0.98f; - projectile.velocity.Y *= 0.98f; + Projectile.ai[0] += 1f; + Projectile.velocity.X *= 0.98f; + Projectile.velocity.Y *= 0.98f; } else { - projectile.extraUpdates = 1; + Projectile.extraUpdates = 1; - Vector2 center = projectile.Center; + Vector2 center = Projectile.Center; float maxDistance = 500f; bool homeIn = false; for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].CanBeChasedBy(projectile, false)) + if (Main.npc[i].CanBeChasedBy(Projectile, false)) { float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) { center = Main.npc[i].Center; homeIn = true; @@ -58,52 +59,52 @@ namespace CalamityMod.Projectiles.Typeless if (homeIn) { - Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * 20f + moveDirection * 12f) / (21f); + Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 12f) / (21f); } else - projectile.Kill(); + Projectile.Kill(); } - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.075f / 255f, Main.DiscoR * 0.1f / 255f, Main.DiscoR * 0.125f / 255f); + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.075f / 255f, Main.DiscoR * 0.1f / 255f, Main.DiscoR * 0.125f / 255f); if (Main.rand.NextBool(6)) { - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 0.4f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 0.4f); Main.dust[dust].velocity *= 0.3f; Main.dust[dust].noGravity = true; } - projectile.rotation += 0.25f; + Projectile.rotation += 0.25f; } public override bool CanDamage() { - return projectile.ai[0] >= 90f; + return Projectile.ai[0] >= 90f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 24); + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 24); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 67, vector7.X * 0.5f, vector7.Y * 0.5f, 100, default, 0.75f); Main.dust[num228].noGravity = true; } - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Typeless/LunicBeam.cs b/Projectiles/Typeless/LunicBeam.cs index 9da1e19cd6..becb54469d 100644 --- a/Projectiles/Typeless/LunicBeam.cs +++ b/Projectiles/Typeless/LunicBeam.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class LunicBeam : ModProjectile @@ -17,13 +18,13 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.alpha = 255; + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.alpha = 255; } public override void AI() @@ -33,7 +34,7 @@ namespace CalamityMod.Projectiles.Typeless float scaleFactor = 6f; Vector2 value7 = new Vector2(10f, 20f); float num31 = 1f; - int num32 = 3 * projectile.MaxUpdates; + int num32 = 3 * Projectile.MaxUpdates; int num33 = Utils.SelectRandom(Main.rand, new int[] { 246, @@ -43,22 +44,22 @@ namespace CalamityMod.Projectiles.Typeless 247 }); int num34 = 259; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.ai[1] = 1f; - projectile.localAI[0] = (float)-(float)Main.rand.Next(48); + Projectile.ai[1] = 1f; + Projectile.localAI[0] = (float)-(float)Main.rand.Next(48); } - else if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) + else if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) { int num35 = -1; float num36 = num30; for (int num37 = 0; num37 < 200; num37++) { - if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(projectile, false)) + if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(Projectile, false)) { Vector2 center3 = Main.npc[num37].Center; - float num38 = Vector2.Distance(center3, projectile.Center); - if (num38 < num36 && num35 == -1 && Collision.CanHitLine(projectile.Center, 1, 1, center3, 1, 1)) + float num38 = Vector2.Distance(center3, Projectile.Center); + if (num38 < num36 && num35 == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, center3, 1, 1)) { num36 = num38; num35 = num37; @@ -67,33 +68,33 @@ namespace CalamityMod.Projectiles.Typeless } if (num36 < 8f) { - projectile.Kill(); + Projectile.Kill(); return; } if (num35 != -1) { - projectile.ai[1] = num29 + 1f; - projectile.ai[0] = (float)num35; - projectile.netUpdate = true; + Projectile.ai[1] = num29 + 1f; + Projectile.ai[0] = (float)num35; + Projectile.netUpdate = true; } } - else if (projectile.ai[1] > num29) + else if (Projectile.ai[1] > num29) { - projectile.ai[1] += 1f; - int num39 = (int)projectile.ai[0]; - if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(projectile, false)) + Projectile.ai[1] += 1f; + int num39 = (int)Projectile.ai[0]; + if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(Projectile, false)) { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.netUpdate = true; + Projectile.ai[1] = 1f; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; } else { - projectile.velocity.ToRotation(); - Vector2 vector6 = Main.npc[num39].Center - projectile.Center; + Projectile.velocity.ToRotation(); + Vector2 vector6 = Main.npc[num39].Center - Projectile.Center; if (vector6.Length() < 20f) { - projectile.Kill(); + Projectile.Kill(); return; } if (vector6 != Vector2.Zero) @@ -102,43 +103,43 @@ namespace CalamityMod.Projectiles.Typeless vector6 *= scaleFactor; } float num40 = 30f; - projectile.velocity = (projectile.velocity * (num40 - 1f) + vector6) / num40; + Projectile.velocity = (Projectile.velocity * (num40 - 1f) + vector6) / num40; } } - if (projectile.ai[1] >= 1f && projectile.ai[1] < num29) + if (Projectile.ai[1] >= 1f && Projectile.ai[1] < num29) { - projectile.ai[1] += 1f; - if (projectile.ai[1] == num29) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] == num29) { - projectile.ai[1] = 1f; + Projectile.ai[1] = 1f; } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 48f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 48f) { - projectile.localAI[0] = 0f; + Projectile.localAI[0] = 0f; } - else if (projectile.alpha == 0) + else if (Projectile.alpha == 0) { for (int num41 = 0; num41 < 2; num41++) { Vector2 value8 = Vector2.UnitX * -30f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - projectile.rotation.ToRotationVector2() * 10f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, num34, 0f, 0f, 160, default, 1f); + value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - Projectile.rotation.ToRotationVector2() * 10f; + int num42 = Dust.NewDust(Projectile.Center, 0, 0, num34, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = num31; Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8 + projectile.velocity * 2f; - Main.dust[num42].velocity = Vector2.Normalize(projectile.Center + projectile.velocity * 2f * 8f - Main.dust[num42].position) * 2f + projectile.velocity * 2f; + Main.dust[num42].position = Projectile.Center + value8 + Projectile.velocity * 2f; + Main.dust[num42].velocity = Vector2.Normalize(Projectile.Center + Projectile.velocity * 2f * 8f - Main.dust[num42].position) * 2f + Projectile.velocity * 2f; } } if (Main.rand.NextBool(12)) { for (int num43 = 0; num43 < 1; num43++) { - Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num44 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num44 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); Main.dust[num44].velocity *= 0.1f; - Main.dust[num44].position = projectile.Center + value9 * (float)projectile.width / 2f + projectile.velocity * 2f; + Main.dust[num44].position = Projectile.Center + value9 * (float)Projectile.width / 2f + Projectile.velocity * 2f; Main.dust[num44].fadeIn = 0.9f; } } @@ -146,10 +147,10 @@ namespace CalamityMod.Projectiles.Typeless { for (int num45 = 0; num45 < 1; num45++) { - Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num46 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 155, default, 0.8f); + Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num46 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 155, default, 0.8f); Main.dust[num46].velocity *= 0.3f; - Main.dust[num46].position = projectile.Center + value10 * (float)projectile.width / 2f; + Main.dust[num46].position = Projectile.Center + value10 * (float)Projectile.width / 2f; if (Main.rand.NextBool(2)) { Main.dust[num46].fadeIn = 1.4f; @@ -160,11 +161,11 @@ namespace CalamityMod.Projectiles.Typeless { for (int num47 = 0; num47 < 2; num47++) { - Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num48 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num33, 0f, 0f, 0, default, 1.2f); + Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num48 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num33, 0f, 0f, 0, default, 1.2f); Main.dust[num48].velocity *= 0.3f; Main.dust[num48].noGravity = true; - Main.dust[num48].position = projectile.Center + value11 * (float)projectile.width / 2f; + Main.dust[num48].position = Projectile.Center + value11 * (float)Projectile.width / 2f; if (Main.rand.NextBool(2)) { Main.dust[num48].fadeIn = 1.4f; @@ -173,37 +174,37 @@ namespace CalamityMod.Projectiles.Typeless } if (Main.rand.NextBool(3)) { - Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num50 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num34, 0f, 0f, 100, default, 1f); + Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int num50 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num34, 0f, 0f, 100, default, 1f); Main.dust[num50].velocity *= 0.3f; - Main.dust[num50].position = projectile.Center + value13 * (float)projectile.width / 2f; + Main.dust[num50].position = Projectile.Center + value13 * (float)Projectile.width / 2f; Main.dust[num50].fadeIn = 1.2f; Main.dust[num50].scale = 1.5f; Main.dust[num50].noGravity = true; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); for (int num151 = 0; num151 < 3; num151++) { int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 259, 0f, 0f, 100, default, 1.35f); + int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 259, 0f, 0f, 100, default, 1.35f); Main.dust[num155].noGravity = true; Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; + Main.dust[num155].velocity += Projectile.velocity * 0.5f; } if (Main.rand.NextBool(8)) { int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 259, 0f, 0f, 100, default, 1f); + int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 259, 0f, 0f, 100, default, 1f); Main.dust[num157].velocity *= 0.25f; Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += projectile.velocity * 0.5f; + Main.dust[num157].velocity += Projectile.velocity * 0.5f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } @@ -233,17 +234,17 @@ namespace CalamityMod.Projectiles.Typeless float num50 = 1.7f; float num51 = 0.8f; float num52 = 2f; - Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + Vector2 value3 = (Projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = height; + Projectile.Center = Projectile.position; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); int num3; for (int num53 = 0; num53 < 40; num53 = num3 + 1) { @@ -255,14 +256,14 @@ namespace CalamityMod.Projectiles.Typeless 262, 247 }); - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num47, 0f, 0f, 200, default, num50); + int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num47, 0f, 0f, 200, default, num50); Dust dust = Main.dust[num54]; - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.noGravity = true; dust.velocity *= 3f; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num48, 0f, 0f, 100, default, num51); - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num48, 0f, 0f, 100, default, num51); + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; dust.velocity *= 2f; dust.noGravity = true; dust.fadeIn = 1f; @@ -272,9 +273,9 @@ namespace CalamityMod.Projectiles.Typeless } for (int num55 = 0; num55 < 20; num55 = num3 + 1) { - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num49, 0f, 0f, 0, default, num52); + int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num49, 0f, 0f, 0, default, num52); Dust dust = Main.dust[num56]; - dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; dust.noGravity = true; dust.velocity *= 0.5f; dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); diff --git a/Projectiles/Typeless/MageHammerBoom.cs b/Projectiles/Typeless/MageHammerBoom.cs index 9dcc2656fb..f0321439fc 100644 --- a/Projectiles/Typeless/MageHammerBoom.cs +++ b/Projectiles/Typeless/MageHammerBoom.cs @@ -12,15 +12,15 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 500; - projectile.height = 500; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + Projectile.width = 500; + Projectile.height = 500; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6; } } } diff --git a/Projectiles/Typeless/MarkRound.cs b/Projectiles/Typeless/MarkRound.cs index 6ea435f392..9df9c29e29 100644 --- a/Projectiles/Typeless/MarkRound.cs +++ b/Projectiles/Typeless/MarkRound.cs @@ -16,56 +16,56 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 300; + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 300; } public override void AI() { - if (projectile.alpha > 0) + if (Projectile.alpha > 0) { - projectile.alpha -= 25; + Projectile.alpha -= 25; } - if (projectile.alpha < 0) + if (Projectile.alpha < 0) { - projectile.alpha = 0; + Projectile.alpha = 0; } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.5f, 0f, 0.7f); + Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0.5f, 0f, 0.7f); float num55 = 30f; float num56 = 2f; - if (projectile.ai[1] == 0f) + if (Projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) + Projectile.localAI[0] += num56; + if (Projectile.localAI[0] > num55) { - projectile.localAI[0] = num55; + Projectile.localAI[0] = num55; } } else { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) + Projectile.localAI[0] -= num56; + if (Projectile.localAI[0] <= 0f) { - projectile.Kill(); + Projectile.Kill(); } } } public override Color? GetAlpha(Color lightColor) => new Color(200, 0, 250, 0); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(30f, 2f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => Projectile.DrawBeam(30f, 2f, lightColor); public override void Kill(int timeLeft) { int dustAmt = Main.rand.Next(3, 7); for (int d = 0; d < dustAmt; d++) { - int purple = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 173, 0f, 0f, 100, default, 2.1f); + int purple = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, 173, 0f, 0f, 100, default, 2.1f); Main.dust[purple].velocity *= 2f; Main.dust[purple].noGravity = true; } diff --git a/Projectiles/Typeless/MomentumCapacitorOrb.cs b/Projectiles/Typeless/MomentumCapacitorOrb.cs index 0a0c42b0a2..032d0df7fd 100644 --- a/Projectiles/Typeless/MomentumCapacitorOrb.cs +++ b/Projectiles/Typeless/MomentumCapacitorOrb.cs @@ -15,21 +15,21 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 18; - projectile.height = 18; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 4; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.width = 18; + Projectile.height = 18; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 4; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.momentumCapacitor) - projectile.Kill(); + Projectile.Kill(); if (Main.rand.NextBool(4)) { float numDust = MathHelper.TwoPi * Radius / 5f; @@ -39,8 +39,8 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < (int)numDust; i++) { dustOffset = dustOffset.RotatedBy(angleIncrement); - int dustIndex = Dust.NewDust(projectile.Center, 1, 1, 226); - Main.dust[dustIndex].position = projectile.Center + dustOffset; + int dustIndex = Dust.NewDust(Projectile.Center, 1, 1, 226); + Main.dust[dustIndex].position = Projectile.Center + dustOffset; Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].fadeIn = 1f; Main.dust[dustIndex].velocity *= 0f; @@ -53,9 +53,9 @@ namespace CalamityMod.Projectiles.Typeless Main.projectile[k].type == ModContent.ProjectileType() || Main.projectile[k].type == ModContent.ProjectileType()) continue; - if (Main.projectile[k].owner == projectile.owner && Main.projectile[k].Calamity().rogue && + if (Main.projectile[k].owner == Projectile.owner && Main.projectile[k].Calamity().rogue && !Main.projectile[k].Calamity().momentumCapacitatorBoost && Main.projectile[k].friendly && - Vector2.Distance(Main.projectile[k].Center, projectile.Center) < Radius) + Vector2.Distance(Main.projectile[k].Center, Projectile.Center) < Radius) { Main.projectile[k].damage = (int)(Main.projectile[k].damage * 1.15f); Main.projectile[k].Calamity().momentumCapacitatorBoost = true; diff --git a/Projectiles/Typeless/MythrilFlare.cs b/Projectiles/Typeless/MythrilFlare.cs index ac8666ed6b..9ea4f57ae0 100644 --- a/Projectiles/Typeless/MythrilFlare.cs +++ b/Projectiles/Typeless/MythrilFlare.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Typeless public class MythrilFlare : ModProjectile { public PrimitiveTrail FlameTrailDrawer = null; - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public const int AttackDelay = 22; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -18,64 +18,64 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Mythril Flare"); - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; } public override void SetDefaults() { - projectile.width = projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = projectile.MaxUpdates * 210; - projectile.Calamity().rogue = true; + Projectile.width = Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = Projectile.MaxUpdates * 210; + Projectile.Calamity().rogue = true; } public override void AI() { // Create a puff of energy on the first frame. - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { for (int i = 0; i < 15; i++) { - Dust energyPuff = Dust.NewDustPerfect(projectile.Center, 267); + Dust energyPuff = Dust.NewDustPerfect(Projectile.Center, 267); energyPuff.velocity = -Vector2.UnitY.RotatedByRandom(0.81f) * Main.rand.NextFloat(1.25f, 6f); energyPuff.color = Color.Lerp(new Color(104, 183, 136), Color.White, Main.rand.NextFloat(0.5f)); energyPuff.scale = 1.1f; energyPuff.alpha = 185; energyPuff.noGravity = true; } - projectile.localAI[0] = 1f; + Projectile.localAI[0] = 1f; } - NPC potentialTarget = projectile.Center.ClosestNPCAt(176f); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(176f); // Increment the timer on the last extra update. - if (projectile.FinalExtraUpdate()) + if (Projectile.FinalExtraUpdate()) Time++; // Sit in place for a moment. if (Time < AttackDelay) - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.Pi / 8f) * 5f; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.Pi / 8f) * 5f; // Rapidly move towards the nearest target. if (potentialTarget != null) { - float distanceFromTarget = projectile.Distance(potentialTarget.Center); + float distanceFromTarget = Projectile.Distance(potentialTarget.Center); float moveInterpolant = Utils.InverseLerp(0f, 100f, distanceFromTarget, true) * Utils.InverseLerp(600f, 400f, distanceFromTarget, true); - Vector2 targetCenterOffsetVec = potentialTarget.Center - projectile.Center; + Vector2 targetCenterOffsetVec = potentialTarget.Center - Projectile.Center; float movementSpeed = MathHelper.Min(17.5f, targetCenterOffsetVec.Length()); Vector2 idealVelocity = targetCenterOffsetVec.SafeNormalize(Vector2.Zero) * movementSpeed; // Die if anything goes wrong with the velocity. - if (projectile.velocity.HasNaNs()) - projectile.Kill(); + if (Projectile.velocity.HasNaNs()) + Projectile.Kill(); // Approach the ideal velocity. - projectile.velocity = Vector2.Lerp(projectile.velocity, idealVelocity, moveInterpolant * 0.08f); - projectile.velocity = projectile.velocity.MoveTowards(idealVelocity, 2f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, moveInterpolant * 0.08f); + Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 2f); } } @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Typeless return CalamityUtils.MulticolorLerp(completionRatio, startingColor, middleColor, endColor) * trailOpacity; } - public float TrailWidth(float completionRatio) => MathHelper.SmoothStep(projectile.width, 4.25f, completionRatio); + public float TrailWidth(float completionRatio) => MathHelper.SmoothStep(Projectile.width, 4.25f, completionRatio); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -98,8 +98,8 @@ namespace CalamityMod.Projectiles.Typeless FlameTrailDrawer = new PrimitiveTrail(TrailWidth, TrailColor, null, GameShaders.Misc["CalamityMod:ImpFlameTrail"]); // Prepare the flame trail shader with its map texture. - GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/EternityStreak")); - FlameTrailDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f - Main.screenPosition, 74); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/EternityStreak")); + FlameTrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 74); return false; } @@ -107,8 +107,8 @@ namespace CalamityMod.Projectiles.Typeless { for (int i = 0; i < 15; i++) { - Dust energyPuff = Dust.NewDustPerfect(projectile.Center, 267); - energyPuff.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.97f) * Main.rand.NextFloat(1f, 8f); + Dust energyPuff = Dust.NewDustPerfect(Projectile.Center, 267); + energyPuff.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.97f) * Main.rand.NextFloat(1f, 8f); energyPuff.color = Color.Lerp(new Color(104, 183, 136), Color.White, Main.rand.NextFloat(0.5f)); energyPuff.scale = 1.1f; energyPuff.alpha = 185; diff --git a/Projectiles/Typeless/NanoFlare.cs b/Projectiles/Typeless/NanoFlare.cs index 5e4fe5c78d..ff10f68103 100644 --- a/Projectiles/Typeless/NanoFlare.cs +++ b/Projectiles/Typeless/NanoFlare.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -16,13 +17,13 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.extraUpdates = 10; - projectile.timeLeft = 60; + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 10; + Projectile.timeLeft = 60; } public override void AI() @@ -30,9 +31,9 @@ namespace CalamityMod.Projectiles.Typeless //Dust for (int i = 0; i< 3; i++) { - int dint = Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 0, default, 0.75f); + int dint = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 107, 0f, 0f, 0, default, 0.75f); Dust dust = Main.dust[dint]; - dust.velocity = projectile.velocity * Main.rand.NextFloat(-0.3f,0.3f); + dust.velocity = Projectile.velocity * Main.rand.NextFloat(-0.3f,0.3f); dust.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); dust.color = Color.Lerp(dust.color, Color.White, 0.3f); } @@ -43,23 +44,23 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < 20; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-6f, 6f)); - int dint = Dust.NewDust(projectile.Center, 1, 1, 107, dspeed.X, dspeed.Y, 0, default, 0.7f); + int dint = Dust.NewDust(Projectile.Center, 1, 1, 107, dspeed.X, dspeed.Y, 0, default, 0.7f); Dust dust = Main.dust[dint]; dust.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); dust.color = Color.Lerp(dust.color, Color.White, 0.3f); } - Main.PlaySound(SoundID.Item14, projectile.Center); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.width = 60; - projectile.height = 60; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.width = 60; + Projectile.height = 60; + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); - Vector2 goreVec = new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f); + Vector2 goreVec = new Vector2(Projectile.position.X + (float)(Projectile.width / 2) - 24f, Projectile.position.Y + (float)(Projectile.height / 2) - 24f); float smokeScale = 0.66f; for (int i = 0; i < 2; i++) { diff --git a/Projectiles/Typeless/Nanotech.cs b/Projectiles/Typeless/Nanotech.cs index 9dd489e27d..5c6909ab72 100644 --- a/Projectiles/Typeless/Nanotech.cs +++ b/Projectiles/Typeless/Nanotech.cs @@ -13,46 +13,46 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; } - public override bool? CanHitNPC(NPC target) => projectile.ai[1] >= 30f && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.ai[1] >= 30f && target.CanBeChasedBy(Projectile); public override void AI() { - Lighting.AddLight(projectile.Center, new Vector3(0.075f, 0.4f, 0.15f)); + Lighting.AddLight(Projectile.Center, new Vector3(0.075f, 0.4f, 0.15f)); - projectile.rotation += projectile.velocity.X * 0.2f; - if (projectile.velocity.X > 0f) - projectile.rotation += 0.08f; + Projectile.rotation += Projectile.velocity.X * 0.2f; + if (Projectile.velocity.X > 0f) + Projectile.rotation += 0.08f; else - projectile.rotation -= 0.08f; + Projectile.rotation -= 0.08f; - projectile.ai[1] += 1f; - if (projectile.ai[1] > 60f) + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > 60f) { - projectile.alpha += 5; - if (projectile.alpha >= 255) + Projectile.alpha += 5; + if (Projectile.alpha >= 255) { - projectile.alpha = 255; - projectile.Kill(); + Projectile.alpha = 255; + Projectile.Kill(); return; } } - if (projectile.ai[1] >= 30f) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + if (Projectile.ai[1] >= 30f) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); } // Reduce damage of projectiles if more than the cap are active public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - int projectileCount = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + int projectileCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type]; int cap = 5; int oldDamage = damage; if (projectileCount > cap) @@ -68,11 +68,11 @@ namespace CalamityMod.Projectiles.Typeless int num3; for (int num191 = 0; num191 < 2; num191 = num3 + 1) { - int num192 = (int)(10f * projectile.scale); - int num193 = Dust.NewDust(projectile.Center - Vector2.One * (float)num192, num192 * 2, num192 * 2, 107, 0f, 0f, 0, default, 1f); + int num192 = (int)(10f * Projectile.scale); + int num193 = Dust.NewDust(Projectile.Center - Vector2.One * (float)num192, num192 * 2, num192 * 2, 107, 0f, 0f, 0, default, 1f); Dust dust20 = Main.dust[num193]; - Vector2 value8 = Vector2.Normalize(dust20.position - projectile.Center); - dust20.position = projectile.Center + value8 * (float)num192 * projectile.scale; + Vector2 value8 = Vector2.Normalize(dust20.position - Projectile.Center); + dust20.position = Projectile.Center + value8 * (float)num192 * Projectile.scale; if (num191 < 30) { dust20.velocity = value8 * dust20.velocity.Length(); diff --git a/Projectiles/Typeless/NavyBobber.cs b/Projectiles/Typeless/NavyBobber.cs index a0bf92df88..d6d2bac755 100644 --- a/Projectiles/Typeless/NavyBobber.cs +++ b/Projectiles/Typeless/NavyBobber.cs @@ -14,17 +14,17 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 61; - projectile.bobber = true; - projectile.penetrate = -1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 61; + Projectile.bobber = true; + Projectile.penetrate = -1; } public override bool PreDrawExtras(SpriteBatch spriteBatch) { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f); - return projectile.DrawFishingLine(ModContent.ItemType(), new Color(36, 61, 111, 100), 55, 33f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); + return Projectile.DrawFishingLine(ModContent.ItemType(), new Color(36, 61, 111, 100), 55, 33f); } } } diff --git a/Projectiles/Typeless/NebulaDust.cs b/Projectiles/Typeless/NebulaDust.cs index 654dcb2fc2..7ded18b95e 100644 --- a/Projectiles/Typeless/NebulaDust.cs +++ b/Projectiles/Typeless/NebulaDust.cs @@ -16,55 +16,55 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.Opacity = 0f; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.Opacity = 0f; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 3600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 3; } public override void AI() { - projectile.rotation += projectile.velocity.X * 0.02f; + Projectile.rotation += Projectile.velocity.X * 0.02f; - if (projectile.velocity.X < 0f) - projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; + if (Projectile.velocity.X < 0f) + Projectile.rotation -= Math.Abs(Projectile.velocity.Y) * 0.02f; else - projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; + Projectile.rotation += Math.Abs(Projectile.velocity.Y) * 0.02f; - projectile.velocity *= 0.98f; + Projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 60f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 60f) { - if (projectile.Opacity > 0f) + if (Projectile.Opacity > 0f) { - projectile.Opacity -= 0.02f; - if (projectile.Opacity < 0f) - projectile.Opacity = 0f; + Projectile.Opacity -= 0.02f; + if (Projectile.Opacity < 0f) + Projectile.Opacity = 0f; } - else if (projectile.owner == Main.myPlayer) - projectile.Kill(); + else if (Projectile.owner == Main.myPlayer) + Projectile.Kill(); } - else if (projectile.Opacity < 0.7f) + else if (Projectile.Opacity < 0.7f) { - projectile.Opacity += 0.1f; - if (projectile.Opacity > 0.7f) - projectile.Opacity = 0.7f; + Projectile.Opacity += 0.1f; + if (Projectile.Opacity > 0.7f) + Projectile.Opacity = 0.7f; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)(255 * projectile.Opacity); - lightColor.B = (byte)(255 * projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Typeless/NebulaStar.cs b/Projectiles/Typeless/NebulaStar.cs index ffeb3ced1d..545fab0a04 100644 --- a/Projectiles/Typeless/NebulaStar.cs +++ b/Projectiles/Typeless/NebulaStar.cs @@ -15,28 +15,28 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = projectile.height = 34; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; + Projectile.width = Projectile.height = 34; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 3600; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer && !FadingOut) + if (Projectile.owner == Main.myPlayer && !FadingOut) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 1f, 1f, 0.3f); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); } } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Rectangle frame = new Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Typeless/NebulaStarGlow"), projectile.Center - Main.screenPosition, frame, Color.White * ((255 - projectile.alpha) / 255f), projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + Rectangle frame = new Rectangle(0, 0, Main.projectileTexture[Projectile.type].Width, Main.projectileTexture[Projectile.type].Height); + spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Typeless/NebulaStarGlow"), Projectile.Center - Main.screenPosition, frame, Color.White * ((255 - Projectile.alpha) / 255f), Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0f); } } } diff --git a/Projectiles/Typeless/NobodyKnows.cs b/Projectiles/Typeless/NobodyKnows.cs index e519c8d03f..436f17b0f7 100644 --- a/Projectiles/Typeless/NobodyKnows.cs +++ b/Projectiles/Typeless/NobodyKnows.cs @@ -12,11 +12,11 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 1; + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 1; } } } diff --git a/Projectiles/Typeless/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index a917cf028f..7c28226b2b 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -20,15 +20,15 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; - projectile.timeLeft = 8; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 24; + Projectile.height = 24; + Projectile.timeLeft = 8; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override bool PreAI() @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Typeless initSegments = true; for (int i = 0; i < 6; i++) { - segment[i] = projectile.Center; + segment[i] = Projectile.Center; } } return true; @@ -46,39 +46,39 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; bool hentai = player.Calamity().omegaBlueHentai; if (player.active && player.Calamity().omegaBlueSet) - projectile.timeLeft = 8; + Projectile.timeLeft = 8; //tentacle head movement (homing) Vector2 playerVel = player.position - player.oldPosition; - projectile.position += playerVel; - projectile.ai[0]++; - if (projectile.ai[0] >= 0f) + Projectile.position += playerVel; + Projectile.ai[0]++; + if (Projectile.ai[0] >= 0f) { - Vector2 home = player.Center + new Vector2(50, 0).RotatedBy(MathHelper.ToRadians(60) * projectile.ai[1]); - Vector2 distance = home - projectile.Center; + Vector2 home = player.Center + new Vector2(50, 0).RotatedBy(MathHelper.ToRadians(60) * Projectile.ai[1]); + Vector2 distance = home - Projectile.Center; float range = distance.Length(); distance.Normalize(); - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { if (range > 13f) { - projectile.ai[0] = -1f; //if in fast mode, stay fast until back in range + Projectile.ai[0] = -1f; //if in fast mode, stay fast until back in range if (range > 1300f) { - projectile.Kill(); + Projectile.Kill(); return; } } else { if (hentai) - projectile.ai[0] = 120f;//45f + Main.rand.Next(45); - projectile.velocity.Normalize(); - projectile.velocity *= 3f + Main.rand.NextFloat(3f); - projectile.netUpdate = true; + Projectile.ai[0] = 120f;//45f + Main.rand.Next(45); + Projectile.velocity.Normalize(); + Projectile.velocity *= 3f + Main.rand.NextFloat(3f); + Projectile.netUpdate = true; } } else @@ -87,24 +87,24 @@ namespace CalamityMod.Projectiles.Typeless } if (range > 120f) //switch to fast return mode { - projectile.ai[0] = -1f; - projectile.netUpdate = true; + Projectile.ai[0] = -1f; + Projectile.netUpdate = true; } - projectile.velocity += distance; + Projectile.velocity += distance; if (range > 30f) - projectile.velocity *= 0.96f; + Projectile.velocity *= 0.96f; - if (projectile.ai[0] > 120f) //attack nearby enemy + if (Projectile.ai[0] > 120f) //attack nearby enemy { - projectile.ai[0] = 10 + Main.rand.Next(10); + Projectile.ai[0] = 10 + Main.rand.Next(10); float maxDistance = hentai ? 900f : 600f; int target = -1; for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile)) + if (npc.CanBeChasedBy(Projectile)) { - float npcDistance = projectile.Distance(npc.Center); + float npcDistance = Projectile.Distance(npc.Center); if (npcDistance < maxDistance) { maxDistance = npcDistance; @@ -114,14 +114,14 @@ namespace CalamityMod.Projectiles.Typeless } if (target != -1) { - projectile.velocity = Main.npc[target].Center - projectile.Center; - projectile.velocity.Normalize(); - projectile.velocity *= 13f; - projectile.velocity += Main.npc[target].velocity / 2f; - projectile.velocity -= playerVel / 2f; - projectile.ai[0] *= -1f; + Projectile.velocity = Main.npc[target].Center - Projectile.Center; + Projectile.velocity.Normalize(); + Projectile.velocity *= 13f; + Projectile.velocity += Main.npc[target].velocity / 2f; + Projectile.velocity -= playerVel / 2f; + Projectile.ai[0] *= -1f; } - projectile.netUpdate = true; + Projectile.netUpdate = true; } } @@ -131,21 +131,21 @@ namespace CalamityMod.Projectiles.Typeless { MoveSegment(segment[i - 1], ref segment[i], segment[i + 1]); } - MoveSegment(segment[4], ref segment[5], projectile.Center + projectile.velocity); + MoveSegment(segment[4], ref segment[5], Projectile.Center + Projectile.velocity); if (hentai) { - if (projectile.ai[0] != -1f) - projectile.ai[0]++; - projectile.position += projectile.velocity; + if (Projectile.ai[0] != -1f) + Projectile.ai[0]++; + Projectile.position += Projectile.velocity; //SMOOTH ASS DUST - Vector2 dustPos = projectile.position + projectile.velocity; - Vector2 tickVel = dustPos - projectile.oldPosition; //playerVel + projectile.velocity * 2f; - dustPos += new Vector2(projectile.width / 2, 0).RotatedBy(projectile.rotation); + Vector2 dustPos = Projectile.position + Projectile.velocity; + Vector2 tickVel = dustPos - Projectile.oldPosition; //playerVel + projectile.velocity * 2f; + dustPos += new Vector2(Projectile.width / 2, 0).RotatedBy(Projectile.rotation); dustPos.X -= 4; - dustPos.X += projectile.width / 2; + dustPos.X += Projectile.width / 2; dustPos.Y -= 4; - dustPos.Y += projectile.height / 2; + dustPos.Y += Projectile.height / 2; const float factor = 3f; int limit = (int)(tickVel.Length() / factor); if (limit == 0) @@ -181,50 +181,50 @@ namespace CalamityMod.Projectiles.Typeless public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (Main.player[projectile.owner].Calamity().omegaBlueHentai) + if (Main.player[Projectile.owner].Calamity().omegaBlueHentai) crit = true; } public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) { - if (Main.player[projectile.owner].Calamity().omegaBlueHentai) + if (Main.player[Projectile.owner].Calamity().omegaBlueHentai) crit = true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].lifeSteal > 0f && !Main.player[projectile.owner].moonLeech) + if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].lifeSteal > 0f && !Main.player[Projectile.owner].moonLeech) { - int healAmount = 10 * damage / projectile.damage; //should always be around max, less if enemy has defense/DR + int healAmount = 10 * damage / Projectile.damage; //should always be around max, less if enemy has defense/DR if (healAmount > 0) { - Main.player[projectile.owner].lifeSteal -= healAmount; - if (Main.player[projectile.owner].Calamity().omegaBlueHentai) //hentai always crits, this makes it have same lifesteal delay - Main.player[projectile.owner].lifeSteal += healAmount / 2; + Main.player[Projectile.owner].lifeSteal -= healAmount; + if (Main.player[Projectile.owner].Calamity().omegaBlueHentai) //hentai always crits, this makes it have same lifesteal delay + Main.player[Projectile.owner].lifeSteal += healAmount / 2; /*Main.player[projectile.owner].statLife += healAmount; if (Main.player[projectile.owner].statLife > Main.player[projectile.owner].statLifeMax2) Main.player[projectile.owner].statLife = Main.player[projectile.owner].statLifeMax2; Main.player[projectile.owner].HealEffect(healAmount, false);*/ - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileID.SpiritHeal, 0, 0f, projectile.owner, projectile.owner, healAmount); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ProjectileID.SpiritHeal, 0, 0f, Projectile.owner, Projectile.owner, healAmount); } } } public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].lifeSteal > 0f && !Main.player[projectile.owner].moonLeech) + if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].lifeSteal > 0f && !Main.player[Projectile.owner].moonLeech) { - int healAmount = 10 * damage / projectile.damage; //should always be around max, less if enemy has defense/DR + int healAmount = 10 * damage / Projectile.damage; //should always be around max, less if enemy has defense/DR if (healAmount > 0) { - Main.player[projectile.owner].lifeSteal -= healAmount; - if (Main.player[projectile.owner].Calamity().omegaBlueHentai) //hentai always crits, this makes it have same lifesteal delay - Main.player[projectile.owner].lifeSteal += healAmount / 2; + Main.player[Projectile.owner].lifeSteal -= healAmount; + if (Main.player[Projectile.owner].Calamity().omegaBlueHentai) //hentai always crits, this makes it have same lifesteal delay + Main.player[Projectile.owner].lifeSteal += healAmount / 2; /*Main.player[projectile.owner].statLife += healAmount; if (Main.player[projectile.owner].statLife > Main.player[projectile.owner].statLifeMax2) Main.player[projectile.owner].statLife = Main.player[projectile.owner].statLifeMax2; Main.player[projectile.owner].HealEffect(healAmount, false);*/ - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileID.SpiritHeal, 0, 0f, projectile.owner, projectile.owner, healAmount); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ProjectileID.SpiritHeal, 0, 0f, Projectile.owner, Projectile.owner, healAmount); } } } @@ -234,15 +234,15 @@ namespace CalamityMod.Projectiles.Typeless spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - GameShaders.Armor.ApplySecondary(Main.player[projectile.owner].cBody, Main.player[projectile.owner], new DrawData?()); - projectile.rotation = (projectile.Center - segment[5]).ToRotation(); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - Texture2D segmentSprite = ModContent.GetTexture("CalamityMod/ExtraTextures/Chains/OmegaBlueTentacleSegment"); + GameShaders.Armor.ApplySecondary(Main.player[Projectile.owner].cBody, Main.player[Projectile.owner], new DrawData?()); + Projectile.rotation = (Projectile.Center - segment[5]).ToRotation(); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + Texture2D segmentSprite = ModContent.Request("CalamityMod/ExtraTextures/Chains/OmegaBlueTentacleSegment"); for (int i = 0; i < 6; i++) { - Main.spriteBatch.Draw(segmentSprite, segment[i] - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), segmentSprite.Bounds, projectile.GetAlpha(lightColor), 0f, segmentSprite.Bounds.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(segmentSprite, segment[i] - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), segmentSprite.Bounds, Projectile.GetAlpha(lightColor), 0f, segmentSprite.Bounds.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); } - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), texture2D13.Bounds, projectile.GetAlpha(lightColor), projectile.rotation, texture2D13.Bounds.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), texture2D13.Bounds, Projectile.GetAlpha(lightColor), Projectile.rotation, texture2D13.Bounds.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Typeless/PendantProjectile1.cs b/Projectiles/Typeless/PendantProjectile1.cs index e5d765f52c..17e6711d3c 100644 --- a/Projectiles/Typeless/PendantProjectile1.cs +++ b/Projectiles/Typeless/PendantProjectile1.cs @@ -13,25 +13,25 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 220; - projectile.penetrate = 1; - projectile.tileCollide = false; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 220; + Projectile.penetrate = 1; + Projectile.tileCollide = false; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.2f / 255f); - projectile.rotation += projectile.velocity.X * 1.25f; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); + Projectile.rotation += Projectile.velocity.X * 1.25f; for (int num457 = 0; num457 < 5; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 0.6f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 0.6f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } } diff --git a/Projectiles/Typeless/PendantProjectile2.cs b/Projectiles/Typeless/PendantProjectile2.cs index d6f84e322d..63f6462ca6 100644 --- a/Projectiles/Typeless/PendantProjectile2.cs +++ b/Projectiles/Typeless/PendantProjectile2.cs @@ -13,25 +13,25 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 220; - projectile.penetrate = 1; - projectile.tileCollide = false; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 220; + Projectile.penetrate = 1; + Projectile.tileCollide = false; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.2f / 255f); - projectile.rotation += projectile.velocity.X * 1.25f; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); + Projectile.rotation += Projectile.velocity.X * 1.25f; for (int num457 = 0; num457 < 5; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 0.6f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 0.6f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } } diff --git a/Projectiles/Typeless/PendantProjectile3.cs b/Projectiles/Typeless/PendantProjectile3.cs index 2fbc91ac0b..f327cd9ef5 100644 --- a/Projectiles/Typeless/PendantProjectile3.cs +++ b/Projectiles/Typeless/PendantProjectile3.cs @@ -13,27 +13,27 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 220; - projectile.penetrate = 1; - projectile.tileCollide = false; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 220; + Projectile.penetrate = 1; + Projectile.tileCollide = false; } public override void AI() { - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 10f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 10f, 20f); - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.2f / 255f); - projectile.rotation += projectile.velocity.X * 1.25f; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); + Projectile.rotation += Projectile.velocity.X * 1.25f; for (int num457 = 0; num457 < 5; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 0.6f); + int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 187, 0f, 0f, 100, default, 0.6f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + Main.dust[num458].velocity += Projectile.velocity * 0.1f; } } diff --git a/Projectiles/Typeless/PoisonousSeawater.cs b/Projectiles/Typeless/PoisonousSeawater.cs index 80b6136901..a06e02d3fe 100644 --- a/Projectiles/Typeless/PoisonousSeawater.cs +++ b/Projectiles/Typeless/PoisonousSeawater.cs @@ -16,21 +16,21 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 6; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 6; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.4f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.4f / 255f); int randomDust = Main.rand.Next(4); if (randomDust == 3) { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Typeless } for (int num468 = 0; num468 < 2; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); if (randomDust == 89) { Main.dust[num469].scale *= 0.35f; diff --git a/Projectiles/Typeless/PurpleLabSeeker.cs b/Projectiles/Typeless/PurpleLabSeeker.cs index ebaa4d21e2..3828761043 100644 --- a/Projectiles/Typeless/PurpleLabSeeker.cs +++ b/Projectiles/Typeless/PurpleLabSeeker.cs @@ -9,32 +9,32 @@ namespace CalamityMod.Projectiles.Typeless { public class PurpleLabSeeker : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Items/LabFinders/PurpleSeekingMechanism"; public override void SetStaticDefaults() { DisplayName.SetDefault("Seeking Mechanism"); - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; } public override void SetDefaults() { - projectile.width = projectile.height = 24; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 300; + Projectile.width = Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; } - public override void AI() => RedLabSeeker.Behavior(projectile, CalamityWorld.PlanetoidLabCenter, Color.Magenta, ref Time); + public override void AI() => RedLabSeeker.Behavior(Projectile, CalamityWorld.PlanetoidLabCenter, Color.Magenta, ref Time); public override void Kill(int timeLeft) { for (int i = 0; i < 8; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); dust.color = Color.Magenta; dust.scale = Main.rand.NextFloat(0.95f, 1.25f); dust.velocity = Main.rand.NextVector2Circular(2.5f, 2.5f); @@ -48,13 +48,13 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - if (Time > 80f && projectile.ai[1] == 0f) + Texture2D texture = Main.projectileTexture[Projectile.type]; + if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) { - Vector2 drawPosition = projectile.Center - projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; - spriteBatch.Draw(texture, drawPosition, null, projectile.GetAlpha(lightColor) * (1f - i / 24f), projectile.rotation, texture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + Vector2 drawPosition = Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; + spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor) * (1f - i / 24f), Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); } } return true; diff --git a/Projectiles/Typeless/ReaverOrb.cs b/Projectiles/Typeless/ReaverOrb.cs index 869ce2a71f..fb81713214 100644 --- a/Projectiles/Typeless/ReaverOrb.cs +++ b/Projectiles/Typeless/ReaverOrb.cs @@ -16,26 +16,26 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 48; - projectile.height = 50; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 18000; - projectile.alpha = 50; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; + Projectile.width = 48; + Projectile.height = 50; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 18000; + Projectile.alpha = 50; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; } public override void AI() { - bool correctMinion = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; + bool correctMinion = Projectile.type == ModContent.ProjectileType(); + Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.reaverExplore) { - projectile.active = false; + Projectile.active = false; return; } if (correctMinion) @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Typeless } if (modPlayer.rOrb) { - projectile.timeLeft = 2; + Projectile.timeLeft = 2; } } dust--; @@ -55,26 +55,26 @@ namespace CalamityMod.Projectiles.Typeless int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { - int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 157, 0f, 0f, 0, default, 1f); + int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 157, 0f, 0f, 0, default, 1f); Main.dust[idx].velocity *= 2f; Main.dust[idx].scale *= 1.15f; } } - Lighting.AddLight(projectile.Center, 0.5f, 2f, 0.5f); + Lighting.AddLight(Projectile.Center, 0.5f, 2f, 0.5f); - projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { - projectile.position.Y += 120f; - projectile.rotation = MathHelper.Pi; + Projectile.position.Y += 120f; + Projectile.rotation = MathHelper.Pi; } else { - projectile.rotation = 0f; + Projectile.rotation = 0f; } - projectile.position.X = (int)projectile.position.X; - projectile.position.Y = (int)projectile.position.Y; + Projectile.position.X = (int)Projectile.position.X; + Projectile.position.Y = (int)Projectile.position.Y; } public override bool CanDamage() => false; diff --git a/Projectiles/Typeless/ReaverThornBase.cs b/Projectiles/Typeless/ReaverThornBase.cs index 384835f987..e8f923eba6 100644 --- a/Projectiles/Typeless/ReaverThornBase.cs +++ b/Projectiles/Typeless/ReaverThornBase.cs @@ -14,56 +14,56 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.aiStyle = 4; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.ignoreWater = true; + Projectile.aiStyle = 4; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (projectile.ai[0] == 0f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.ai[0] == 0f) { - projectile.alpha -= 50; - if (projectile.alpha > 0) + Projectile.alpha -= 50; + if (Projectile.alpha > 0) return; - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) + Projectile.alpha = 0; + Projectile.ai[0] = 1f; + if (Projectile.ai[1] == 0f) { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; + Projectile.ai[1] += 1f; + Projectile.position += Projectile.velocity * 1f; } - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - int type = projectile.type; - if (projectile.ai[1] >= 6f) + int type = Projectile.type; + if (Projectile.ai[1] >= 6f) type = ModContent.ProjectileType(); - int thorn = Projectile.NewProjectile(projectile.Center + projectile.velocity, projectile.velocity, type, projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[thorn].ai[1] = projectile.ai[1] + 1f; + int thorn = Projectile.NewProjectile(Projectile.Center + Projectile.velocity, Projectile.velocity, type, Projectile.damage, Projectile.knockBack, Projectile.owner); + Main.projectile[thorn].ai[1] = Projectile.ai[1] + 1f; } } else { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170) { for (int index = 0; index < 3; ++index) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 18, projectile.velocity.X * 0.025f, projectile.velocity.Y * 0.025f, 170, new Color(), 1.2f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 18, Projectile.velocity.X * 0.025f, Projectile.velocity.Y * 0.025f, 170, new Color(), 1.2f); } - Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, 0f, 0f, 170, new Color(), 1.1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 170, new Color(), 1.1f); } - projectile.alpha += 3; - if (projectile.alpha < 255) + Projectile.alpha += 3; + if (Projectile.alpha < 255) return; - projectile.Kill(); + Projectile.Kill(); } } } diff --git a/Projectiles/Typeless/ReaverThornTip.cs b/Projectiles/Typeless/ReaverThornTip.cs index b22dea3d7f..d60392b3fb 100644 --- a/Projectiles/Typeless/ReaverThornTip.cs +++ b/Projectiles/Typeless/ReaverThornTip.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 28; - projectile.height = 28; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.ignoreWater = true; + Projectile.width = 28; + Projectile.height = 28; + Projectile.aiStyle = 4; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.ignoreWater = true; aiType = ProjectileID.VilethornTip; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } } } diff --git a/Projectiles/Typeless/RedLabSeeker.cs b/Projectiles/Typeless/RedLabSeeker.cs index f95a580946..52db939133 100644 --- a/Projectiles/Typeless/RedLabSeeker.cs +++ b/Projectiles/Typeless/RedLabSeeker.cs @@ -10,23 +10,23 @@ namespace CalamityMod.Projectiles.Typeless { public class RedLabSeeker : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Items/LabFinders/RedSeekingMechanism"; public override void SetStaticDefaults() { DisplayName.SetDefault("Seeking Mechanism"); - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; } public override void SetDefaults() { - projectile.width = projectile.height = 24; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 300; + Projectile.width = Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; } public static void Behavior(Projectile projectile, Vector2 destination, Color dustColor, ref float time) @@ -72,13 +72,13 @@ namespace CalamityMod.Projectiles.Typeless time++; } - public override void AI() => Behavior(projectile, CalamityWorld.HellLabCenter, Color.Red, ref Time); + public override void AI() => Behavior(Projectile, CalamityWorld.HellLabCenter, Color.Red, ref Time); public override void Kill(int timeLeft) { for (int i = 0; i < 8; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); dust.color = Color.Red; dust.scale = Main.rand.NextFloat(0.95f, 1.25f); dust.velocity = Main.rand.NextVector2Circular(2.5f, 2.5f); @@ -92,13 +92,13 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - if (Time > 80f && projectile.ai[1] == 0f) + Texture2D texture = Main.projectileTexture[Projectile.type]; + if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) { - Vector2 drawPosition = projectile.Center - projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; - spriteBatch.Draw(texture, drawPosition, null, projectile.GetAlpha(lightColor) * (1f - i / 24f), projectile.rotation, texture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + Vector2 drawPosition = Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; + spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor) * (1f - i / 24f), Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); } } return true; diff --git a/Projectiles/Typeless/RelicOfConvergenceCrystal.cs b/Projectiles/Typeless/RelicOfConvergenceCrystal.cs index 1cdfbd8c8f..2e5c4660ef 100644 --- a/Projectiles/Typeless/RelicOfConvergenceCrystal.cs +++ b/Projectiles/Typeless/RelicOfConvergenceCrystal.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -21,20 +22,20 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 32; - projectile.height = 46; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 240; + Projectile.width = 32; + Projectile.height = 46; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 240; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (!player.channel) { - projectile.Kill(); + Projectile.Kill(); return; } // Restrict player movement (as a penalty). @@ -45,28 +46,28 @@ namespace CalamityMod.Projectiles.Typeless } UpdatePlayerVisuals(player); // Make a constant "magical" sound. - if (projectile.soundDelay <= 0) + if (Projectile.soundDelay <= 0) { - Main.PlaySound(SoundID.Item4, projectile.Center); - projectile.soundDelay = SoundInterval; + SoundEngine.PlaySound(SoundID.Item4, Projectile.Center); + Projectile.soundDelay = SoundInterval; } - projectile.ai[0]++; + Projectile.ai[0]++; // Make a sound when fully charged. - if (projectile.ai[0] == CrystalsDrawTime) + if (Projectile.ai[0] == CrystalsDrawTime) { - Main.PlaySound(SoundID.DD2_DarkMageHealImpact, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Projectile.Center); } // Create a circle of dust. The circle expands outward at first until it reaches its "destination" radius. // Once the circle is at its maximum size, some of the dust moves inward. - if (projectile.ai[0] >= CrystalsDrawTime) + if (Projectile.ai[0] >= CrystalsDrawTime) { GeneratePassiveDust(player); } - if (projectile.timeLeft == 1) + if (Projectile.timeLeft == 1) { for (int i = 0; i < 45; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.ProfanedFire); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire); dust.velocity = Utils.NextVector2Circular(Main.rand, 28f, 28f); dust.fadeIn = Main.rand.NextFloat(3f, 4f); dust.noGravity = true; @@ -77,16 +78,16 @@ namespace CalamityMod.Projectiles.Typeless { player.statLife = player.statLifeMax2; } - Main.PlaySound(SoundID.DD2_DarkMageHealImpact, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Projectile.Center); } } public void UpdatePlayerVisuals(Player player) { - projectile.Center = player.Center + Vector2.UnitX * 15f * player.direction; + Projectile.Center = player.Center + Vector2.UnitX * 15f * player.direction; // The crystal is a holdout projectile, so change the player's variables to reflect that - player.heldProj = projectile.whoAmI; + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; } @@ -94,21 +95,21 @@ namespace CalamityMod.Projectiles.Typeless public void GeneratePassiveDust(Player player) { float radius = 45f; - if (projectile.ai[0] < CrystalsDrawTime + 30f) + if (Projectile.ai[0] < CrystalsDrawTime + 30f) { - radius = MathHelper.Lerp(0f, 45f, (projectile.ai[0] - CrystalsDrawTime) / 30f); + radius = MathHelper.Lerp(0f, 45f, (Projectile.ai[0] - CrystalsDrawTime) / 30f); } for (float angle = 0f; angle <= MathHelper.TwoPi; angle += MathHelper.ToRadians(Main.rand.NextFloat(6f, 8f))) { - Dust dust = Dust.NewDustPerfect(projectile.Center + angle.ToRotationVector2() * radius, (int)CalamityDusts.ProfanedFire); - dust.position = projectile.Center + angle.ToRotationVector2() * radius; + Dust dust = Dust.NewDustPerfect(Projectile.Center + angle.ToRotationVector2() * radius, (int)CalamityDusts.ProfanedFire); + dust.position = Projectile.Center + angle.ToRotationVector2() * radius; dust.scale = Main.rand.NextFloat(0.8f, 1.1f); dust.noGravity = true; dust.velocity = player.velocity; - if (Main.rand.NextBool(15) || projectile.timeLeft == 1) + if (Main.rand.NextBool(15) || Projectile.timeLeft == 1) { - dust.velocity = projectile.DirectionFrom(dust.position) * Main.rand.NextFloat(4f, 5f); - if (projectile.timeLeft == 1) + dust.velocity = Projectile.DirectionFrom(dust.position) * Main.rand.NextFloat(4f, 5f); + if (Projectile.timeLeft == 1) dust.velocity *= 1.7f; } } @@ -116,23 +117,23 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.ai[0] >= CrystalsDrawTime) + if (Projectile.ai[0] >= CrystalsDrawTime) return true; - float opacity = projectile.ai[0] / CrystalsDrawTime; - Texture2D crystalTexture = ModContent.GetTexture(Texture); + float opacity = Projectile.ai[0] / CrystalsDrawTime; + Texture2D crystalTexture = ModContent.Request(Texture); for (int i = 0; i < TotalCrystalsToDraw; i++) { - float angle = MathHelper.TwoPi / TotalCrystalsToDraw * i + projectile.ai[0] / 10f; - float radius = MathHelper.Lerp(MaxCrystalOffsetRadius, 0f, projectile.ai[0] / CrystalsDrawTime); + float angle = MathHelper.TwoPi / TotalCrystalsToDraw * i + Projectile.ai[0] / 10f; + float radius = MathHelper.Lerp(MaxCrystalOffsetRadius, 0f, Projectile.ai[0] / CrystalsDrawTime); Vector2 drawPositionOffset = angle.ToRotationVector2() * radius; - Vector2 drawPosition = projectile.Center + drawPositionOffset; + Vector2 drawPosition = Projectile.Center + drawPositionOffset; spriteBatch.Draw(crystalTexture, drawPosition - Main.screenPosition, null, Color.White * opacity, - projectile.rotation, - projectile.Size * 0.5f, - projectile.scale, + Projectile.rotation, + Projectile.Size * 0.5f, + Projectile.scale, SpriteEffects.None, 0f); } diff --git a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs index 9c42b58359..642054d456 100644 --- a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs +++ b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -23,116 +24,116 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Relic of Deliverance"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 68; - projectile.height = 32; - projectile.penetrate = -1; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + Projectile.width = 68; + Projectile.height = 32; + Projectile.penetrate = -1; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); writer.WriteVector2(IdealVelocity); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); IdealVelocity = reader.ReadVector2(); } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; if (player.dead || - projectile.Center.Y < 200f || - projectile.Center.X < 200f || - projectile.Center.X > Main.maxTilesX * 16f - 200f) + Projectile.Center.Y < 200f || + Projectile.Center.X < 200f || + Projectile.Center.X > Main.maxTilesX * 16f - 200f) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.frameCounter++; - if (projectile.frameCounter > 4) + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame >= Main.projFrames[projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type]) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.ai[0]++; - if (projectile.velocity == Vector2.Zero) + Projectile.ai[0]++; + if (Projectile.velocity == Vector2.Zero) { // Immediately die if the player is not holding the spear if (player.ActiveItem() == null) { - projectile.Kill(); + Projectile.Kill(); return; } if (player.ActiveItem().type != ModContent.ItemType()) { - projectile.Kill(); + Projectile.Kill(); return; } - projectile.rotation = projectile.AngleTo(Main.MouseWorld); - projectile.Center = player.Center; - if (projectile.ai[0] >= WaitTimeRequiredForCharge) + Projectile.rotation = Projectile.AngleTo(Main.MouseWorld); + Projectile.Center = player.Center; + if (Projectile.ai[0] >= WaitTimeRequiredForCharge) { // Begin the lunge - bool noObstaclesInWay = Collision.CanHitLine(projectile.Center, 1, 1, projectile.Center + projectile.SafeDirectionTo(Main.MouseWorld) * 25f, 1, 1); - if (Main.myPlayer == projectile.owner && Main.mouseLeft && !Main.blockMouse && !player.mouseInterface && noObstaclesInWay) + bool noObstaclesInWay = Collision.CanHitLine(Projectile.Center, 1, 1, Projectile.Center + Projectile.SafeDirectionTo(Main.MouseWorld) * 25f, 1, 1); + if (Main.myPlayer == Projectile.owner && Main.mouseLeft && !Main.blockMouse && !player.mouseInterface && noObstaclesInWay) { - float chargeSpeed = MathHelper.Lerp(MinChargeSpeed, MaxChargeSpeed, (projectile.ai[0] - WaitTimeRequiredForCharge) / WaitTimeRequiredForMaximumCharge); + float chargeSpeed = MathHelper.Lerp(MinChargeSpeed, MaxChargeSpeed, (Projectile.ai[0] - WaitTimeRequiredForCharge) / WaitTimeRequiredForMaximumCharge); if (chargeSpeed > MaxChargeSpeed) chargeSpeed = MaxChargeSpeed; - projectile.velocity = projectile.SafeDirectionTo(Main.MouseWorld) * chargeSpeed; - IdealVelocity = projectile.velocity; - projectile.ai[1] = chargeSpeed; - Main.PlaySound(SoundID.Item73, projectile.Center); - projectile.netUpdate = true; + Projectile.velocity = Projectile.SafeDirectionTo(Main.MouseWorld) * chargeSpeed; + IdealVelocity = Projectile.velocity; + Projectile.ai[1] = chargeSpeed; + SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); + Projectile.netUpdate = true; } // Charge-up dust - if (projectile.ai[0] <= WaitTimeRequiredForCharge + WaitTimeRequiredForMaximumCharge) + if (Projectile.ai[0] <= WaitTimeRequiredForCharge + WaitTimeRequiredForMaximumCharge) { for (int i = 0; i < 3; i++) { - Vector2 dustPosition = Utils.NextVector2Circular(Main.rand, projectile.width * 1.6f, projectile.height * 2.3f) / 2f + projectile.Center; + Vector2 dustPosition = Utils.NextVector2Circular(Main.rand, Projectile.width * 1.6f, Projectile.height * 2.3f) / 2f + Projectile.Center; Dust dust = Dust.NewDustPerfect(dustPosition, (int)CalamityDusts.ProfanedFire); - dust.velocity = projectile.SafeDirectionTo(dust.position) * projectile.Distance(dust.position) / -11f; + dust.velocity = Projectile.SafeDirectionTo(dust.position) * Projectile.Distance(dust.position) / -11f; dust.velocity += player.velocity; dust.noGravity = true; dust.fadeIn = 1.6f; } - projectile.Center += Utils.NextVector2Circular(Main.rand, 1.8f, 1.8f); + Projectile.Center += Utils.NextVector2Circular(Main.rand, 1.8f, 1.8f); } // Full charge dust indicator - if (projectile.ai[0] == WaitTimeRequiredForCharge + WaitTimeRequiredForMaximumCharge) + if (Projectile.ai[0] == WaitTimeRequiredForCharge + WaitTimeRequiredForMaximumCharge) { for (int i = 0; i < 60; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.ProfanedFire); + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire); dust.velocity = Utils.NextVector2Circular(Main.rand, 9f, 9f) * Main.rand.NextFloat(0.8f, 1.2f); dust.velocity += player.velocity; dust.noGravity = true; dust.fadeIn = 1.6f; } - Main.PlaySound(SoundID.DD2_DarkMageHealImpact, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Projectile.Center); } - player.direction = (Math.Cos(projectile.rotation) > 0).ToDirectionInt(); + player.direction = (Math.Cos(Projectile.rotation) > 0).ToDirectionInt(); } } else @@ -141,70 +142,70 @@ namespace CalamityMod.Projectiles.Typeless // However, if the mouse position is really close to the projectile, don't do anything. // Being close to the target may cause erratic movements. // The projectile.localAI[1] part is to prevent the projectile from redirecting on a frame-by-frame basis (Main.mouseLeft seems to mean mouse hold, not release). - if (projectile.Distance(Main.MouseWorld) > 60f && + if (Projectile.Distance(Main.MouseWorld) > 60f && Main.mouseLeft && !Main.blockMouse && !player.mouseInterface && - projectile.localAI[0] <= MaxCharges && - projectile.localAI[1] <= 0f) + Projectile.localAI[0] <= MaxCharges && + Projectile.localAI[1] <= 0f) { - IdealVelocity = projectile.SafeDirectionTo(Main.MouseWorld) * projectile.ai[1]; - projectile.localAI[0]++; - projectile.localAI[1] = 40f; - Main.PlaySound(SoundID.Item73, projectile.Center); - projectile.netUpdate = true; + IdealVelocity = Projectile.SafeDirectionTo(Main.MouseWorld) * Projectile.ai[1]; + Projectile.localAI[0]++; + Projectile.localAI[1] = 40f; + SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); + Projectile.netUpdate = true; } - else if (projectile.localAI[0] > MaxCharges) + else if (Projectile.localAI[0] > MaxCharges) { - if (projectile.timeLeft > 120) + if (Projectile.timeLeft > 120) { - projectile.timeLeft = 120; + Projectile.timeLeft = 120; } - projectile.alpha = (int)MathHelper.Lerp(0, 255, 1f - projectile.timeLeft / 120f); + Projectile.alpha = (int)MathHelper.Lerp(0, 255, 1f - Projectile.timeLeft / 120f); } - if (projectile.velocity != IdealVelocity) + if (Projectile.velocity != IdealVelocity) { - projectile.velocity = Vector2.Lerp(projectile.velocity, IdealVelocity, 0.125f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, IdealVelocity, 0.125f); } - player.velocity = projectile.velocity; + player.velocity = Projectile.velocity; // Count down the charge cooldown - if (projectile.localAI[1] > 0f) - projectile.localAI[1]--; - projectile.rotation = projectile.velocity.ToRotation(); + if (Projectile.localAI[1] > 0f) + Projectile.localAI[1]--; + Projectile.rotation = Projectile.velocity.ToRotation(); // Player manipulations (setting the center point and disallowing mounts). - player.Center = projectile.Center; + player.Center = Projectile.Center; // Adjust the player's held projectile type. if (player.heldProj == -1) - player.heldProj = projectile.whoAmI; + player.heldProj = Projectile.whoAmI; if (player.mount != null) { player.mount.Dismount(player); } - player.direction = (projectile.velocity.X > 0).ToDirectionInt(); + player.direction = (Projectile.velocity.X > 0).ToDirectionInt(); // Generate dust - if (projectile.ai[0] % DustSpawnInterval == DustSpawnInterval - 1f) + if (Projectile.ai[0] % DustSpawnInterval == DustSpawnInterval - 1f) { for (int i = 0; i < 12; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + (projectile.Size / 2f).RotatedBy(projectile.rotation), (int)CalamityDusts.ProfanedFire); - dust.velocity = projectile.velocity.RotatedBy(MathHelper.ToRadians(20f * (i % 2 == 0).ToDirectionInt())); + Dust dust = Dust.NewDustPerfect(Projectile.Center + (Projectile.Size / 2f).RotatedBy(Projectile.rotation), (int)CalamityDusts.ProfanedFire); + dust.velocity = Projectile.velocity.RotatedBy(MathHelper.ToRadians(20f * (i % 2 == 0).ToDirectionInt())); dust.noGravity = true; dust.fadeIn = 1.8f; } } } // Don't die when colliding with tiles unless the spear is lunging (and after a bit of time has passed). - projectile.tileCollide = projectile.velocity != Vector2.Zero && projectile.ai[0] >= WaitTimeRequiredForCharge + 10f; + Projectile.tileCollide = Projectile.velocity != Vector2.Zero && Projectile.ai[0] >= WaitTimeRequiredForCharge + 10f; // Die immediately if the owner of this projectile is clipping into tiles because of its movement. - if (Collision.SolidCollision(player.position, player.width, player.height) && projectile.velocity != Vector2.Zero) + if (Collision.SolidCollision(player.position, player.width, player.height) && Projectile.velocity != Vector2.Zero) { player.velocity.Y = 0f; - DoDeathDust(projectile.oldVelocity); + DoDeathDust(Projectile.oldVelocity); - projectile.Kill(); + Projectile.Kill(); } - Lighting.AddLight(projectile.Center, Color.LightGoldenrodYellow.ToVector3()); + Lighting.AddLight(Projectile.Center, Color.LightGoldenrodYellow.ToVector3()); } public void DoDeathDust(Vector2 oldVelocity) { @@ -213,22 +214,22 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < 60; i++) { - Vector2 spawnOffset = (projectile.Size / 2f).RotatedBy(projectile.rotation); + Vector2 spawnOffset = (Projectile.Size / 2f).RotatedBy(Projectile.rotation); spawnOffset += Utils.NextVector2Circular(Main.rand, 10f, 10f); - Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, (int)CalamityDusts.ProfanedFire); + Dust dust = Dust.NewDustPerfect(Projectile.Center + spawnOffset, (int)CalamityDusts.ProfanedFire); dust.velocity = Utils.NextVector2Circular(Main.rand, 5f, 5f) + oldVelocity; dust.noGravity = true; dust.fadeIn = 1.9f; } - Main.PlaySound(SoundID.Item14, projectile.Center); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); } - public override bool CanDamage() => projectile.velocity != Vector2.Zero; + public override bool CanDamage() => Projectile.velocity != Vector2.Zero; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } // Force the spear to have "priority" when drawing so that it draws over the player. diff --git a/Projectiles/Typeless/SabatonBoom.cs b/Projectiles/Typeless/SabatonBoom.cs index 8f2e88e3a6..58e6c3c931 100644 --- a/Projectiles/Typeless/SabatonBoom.cs +++ b/Projectiles/Typeless/SabatonBoom.cs @@ -9,23 +9,23 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.penetrate = -1; - projectile.width = 450; - projectile.height = 450; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.timeLeft = 40; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + Projectile.penetrate = -1; + Projectile.width = 450; + Projectile.height = 450; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 40; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 100); //Not really an expansion - projectile.timeLeft /= 2; - projectile.ai[0] = 0f; + CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 100); //Not really an expansion + Projectile.timeLeft /= 2; + Projectile.ai[0] = 0f; } } diff --git a/Projectiles/Typeless/SabatonSlam.cs b/Projectiles/Typeless/SabatonSlam.cs index 35d66da747..e2643c811e 100644 --- a/Projectiles/Typeless/SabatonSlam.cs +++ b/Projectiles/Typeless/SabatonSlam.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -12,11 +13,11 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 10; - projectile.height = 35; - projectile.friendly = true; - projectile.timeLeft = 300; - projectile.tileCollide = true; + Projectile.width = 10; + Projectile.height = 35; + Projectile.friendly = true; + Projectile.timeLeft = 300; + Projectile.tileCollide = true; } public override void AI() @@ -24,31 +25,31 @@ namespace CalamityMod.Projectiles.Typeless Player player = Main.player[Main.myPlayer]; if (player.Calamity().gSabatonFall == 0) { - projectile.Kill(); + Projectile.Kill(); } //Makes the projectiles follow the player - projectile.velocity.X = player.velocity.X; - projectile.velocity.Y = player.velocity.Y; + Projectile.velocity.X = player.velocity.X; + Projectile.velocity.Y = player.velocity.Y; } public override bool OnTileCollide(Vector2 oldVelocity) { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; //Spawns the shockwave - if (Main.myPlayer == projectile.owner) + if (Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(projectile.position.X + 25, projectile.position.Y + 25, 0f, 0f, ModContent.ProjectileType(), (int)(300 * player.AverageDamage()), 12, projectile.owner); - Main.PlaySound(SoundID.Item14, projectile.position); + Projectile.NewProjectile(Projectile.position.X + 25, Projectile.position.Y + 25, 0f, 0f, ModContent.ProjectileType(), (int)(300 * player.AverageDamage()), 12, Projectile.owner); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); player.Calamity().gSabatonFall = 0; - projectile.Kill(); + Projectile.Kill(); } //Pretty things for (int dustexplode = 0; dustexplode < 360; dustexplode++) { Vector2 dustd = new Vector2(17f, 17f).RotatedBy(MathHelper.ToRadians(dustexplode)); - int d = Dust.NewDust(projectile.Center, projectile.width, projectile.height, Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(), dustd.X, dustd.Y, 100, default, 3f); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(), dustd.X, dustd.Y, 100, default, 3f); Main.dust[d].noGravity = true; - Main.dust[d].position = projectile.Center; + Main.dust[d].position = Projectile.Center; } return false; } diff --git a/Projectiles/Typeless/SandCloakVeil.cs b/Projectiles/Typeless/SandCloakVeil.cs index 907e1849a4..2a2cc9c7d4 100644 --- a/Projectiles/Typeless/SandCloakVeil.cs +++ b/Projectiles/Typeless/SandCloakVeil.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 450; - projectile.height = 450; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = duration; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 450; + Projectile.height = 450; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = duration; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.rotation += 0.01f; + Projectile.rotation += 0.01f; Player player = Main.player[Main.myPlayer]; - Vector2 posDiff = player.Center - projectile.Center; + Vector2 posDiff = player.Center - Projectile.Center; if (posDiff.Length() <= radius) { player.statDefense += 6; @@ -45,37 +45,37 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { // Sprite Circle - Texture2D tex = Main.projectileTexture[projectile.type]; + Texture2D tex = Main.projectileTexture[Projectile.type]; float scaleStep = 0.03f; float rotationOffset = 0.03f; - Color drawCol = projectile.GetAlpha(lightColor); + Color drawCol = Projectile.GetAlpha(lightColor); float drawTransparency = 0.1f; - if (projectile.timeLeft > duration - 10) + if (Projectile.timeLeft > duration - 10) { - drawTransparency = (duration - projectile.timeLeft) * 0.01f; + drawTransparency = (duration - Projectile.timeLeft) * 0.01f; } - else if (projectile.timeLeft < 25) + else if (Projectile.timeLeft < 25) { - drawTransparency = projectile.timeLeft * 0.004f; + drawTransparency = Projectile.timeLeft * 0.004f; } // Dust effects - Circle dustCircle = new Circle(projectile.Center, radius); + Circle dustCircle = new Circle(Projectile.Center, radius); for (int i = 0; i < 20; i++) { // Sprite - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, drawCol * drawTransparency, projectile.rotation + (rotationOffset * i * i), tex.Size() / 2f, projectile.scale - (i * scaleStep), SpriteEffects.None, 0f); + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, drawCol * drawTransparency, Projectile.rotation + (rotationOffset * i * i), tex.Size() / 2f, Projectile.scale - (i * scaleStep), SpriteEffects.None, 0f); // Dust Vector2 dustPos = dustCircle.RandomPointInCircle(); - if ((dustPos - projectile.Center).Length() > 48) + if ((dustPos - Projectile.Center).Length() > 48) { int dustIndex = Dust.NewDust(dustPos, 1, 1, 32); Main.dust[dustIndex].noGravity = true; Main.dust[dustIndex].fadeIn = 1f; - Vector2 dustVelocity = projectile.Center - Main.dust[dustIndex].position; + Vector2 dustVelocity = Projectile.Center - Main.dust[dustIndex].position; float distToCenter = dustVelocity.Length(); dustVelocity.Normalize(); dustVelocity = dustVelocity.RotatedBy(MathHelper.ToRadians(-90f)); @@ -101,12 +101,12 @@ namespace CalamityMod.Projectiles.Typeless { knockbackMultiplier = 0; } - Vector2 trueKnockback = target.Center - projectile.Center; + Vector2 trueKnockback = target.Center - Projectile.Center; trueKnockback.Normalize(); target.velocity = trueKnockback * knockbackMultiplier; } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); } } diff --git a/Projectiles/Typeless/SandExplosion.cs b/Projectiles/Typeless/SandExplosion.cs index 22a4ec6ac4..c862e4bd33 100644 --- a/Projectiles/Typeless/SandExplosion.cs +++ b/Projectiles/Typeless/SandExplosion.cs @@ -15,15 +15,15 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 64; - projectile.height = 64; - projectile.timeLeft = 1; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.maxPenetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 64; + Projectile.height = 64; + Projectile.timeLeft = 1; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.maxPenetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -32,9 +32,9 @@ namespace CalamityMod.Projectiles.Typeless { Vector2 dustspeed = new Vector2(5f, 5f).RotatedBy(MathHelper.ToRadians(i)); float size = Main.rand.NextFloat(1.1f, 1.6f); - int d = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 85, dustspeed.X, dustspeed.Y, 0, default, size); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 85, dustspeed.X, dustspeed.Y, 0, default, size); Main.dust[d].noGravity = true; - Main.dust[d].position = projectile.Center; + Main.dust[d].position = Projectile.Center; } } } diff --git a/Projectiles/Typeless/Seashell.cs b/Projectiles/Typeless/Seashell.cs index 834dade7b2..4515a82cb2 100644 --- a/Projectiles/Typeless/Seashell.cs +++ b/Projectiles/Typeless/Seashell.cs @@ -12,27 +12,27 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.aiStyle = 3; - projectile.timeLeft = 300; + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.aiStyle = 3; + Projectile.timeLeft = 300; aiType = ProjectileID.WoodenBoomerang; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) + Projectile.ai[0] += 0.1f; + if (Projectile.velocity.X != oldVelocity.X) { - projectile.velocity.X = -oldVelocity.X; + Projectile.velocity.X = -oldVelocity.X; } - if (projectile.velocity.Y != oldVelocity.Y) + if (Projectile.velocity.Y != oldVelocity.Y) { - projectile.velocity.Y = -oldVelocity.Y; + Projectile.velocity.Y = -oldVelocity.Y; } return false; } diff --git a/Projectiles/Typeless/SepulcherSoul.cs b/Projectiles/Typeless/SepulcherSoul.cs index 507140ddae..721766c0da 100644 --- a/Projectiles/Typeless/SepulcherSoul.cs +++ b/Projectiles/Typeless/SepulcherSoul.cs @@ -7,35 +7,35 @@ namespace CalamityMod.Projectiles.Typeless { public class SepulcherSoul : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Tormented Soul"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = projectile.height = 16; - projectile.Opacity = 0f; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 120; + Projectile.width = Projectile.height = 16; + Projectile.Opacity = 0f; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 120; } public override void AI() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); - projectile.localAI[0] = 1f; + Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); + Projectile.localAI[0] = 1f; } Vector2 idealVelocity = Vector2.Zero; - idealVelocity.X = (float)(Math.Sin(Time / 27f + projectile.identity * 1.1f) + (float)Math.Cos(Math.E * (Time / 27f + projectile.identity * 1.1f))) * 4f; - idealVelocity.Y = MathHelper.SmoothStep(-3f, -9f, (float)Math.Sin(Time / 23f + projectile.identity * 1.1f) * 0.5f + 0.5f); - projectile.velocity = Vector2.Lerp(projectile.velocity, idealVelocity, 0.075f); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.Opacity = Utils.InverseLerp(0f, 15f, Time, true) * Utils.InverseLerp(0f, 25f, projectile.timeLeft, true); + idealVelocity.X = (float)(Math.Sin(Time / 27f + Projectile.identity * 1.1f) + (float)Math.Cos(Math.E * (Time / 27f + Projectile.identity * 1.1f))) * 4f; + idealVelocity.Y = MathHelper.SmoothStep(-3f, -9f, (float)Math.Sin(Time / 23f + Projectile.identity * 1.1f) * 0.5f + 0.5f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, 0.075f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.Opacity = Utils.InverseLerp(0f, 15f, Time, true) * Utils.InverseLerp(0f, 25f, Projectile.timeLeft, true); Time++; } } diff --git a/Projectiles/Typeless/SerpentsBiteHook.cs b/Projectiles/Typeless/SerpentsBiteHook.cs index e27201f2a5..a1ba78791e 100644 --- a/Projectiles/Typeless/SerpentsBiteHook.cs +++ b/Projectiles/Typeless/SerpentsBiteHook.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.GemHookAmethyst); + Projectile.CloneDefaults(ProjectileID.GemHookAmethyst); } // Use this hook for hooks that can have multiple hooks mid-flight: Dual Hook, Web Slinger, Fish Hook, Static Hook, Lunar Hook @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Typeless int hooksOut = 0; for (int l = 0; l < Main.maxProjectiles; l++) { - if (Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type) + if (Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == Projectile.type) { hooksOut++; } @@ -62,13 +62,13 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawHook(projectile, GetTexture("CalamityMod/ExtraTextures/Chains/SerpentsBiteChain")); + CalamityUtils.DrawHook(Projectile, GetTexture("CalamityMod/ExtraTextures/Chains/SerpentsBiteChain")); return true; } public override void AI() { - projectile.spriteDirection = -projectile.direction; + Projectile.spriteDirection = -Projectile.direction; } } } diff --git a/Projectiles/Typeless/ShadowflameExplosion.cs b/Projectiles/Typeless/ShadowflameExplosion.cs index fadc0d6a12..cea05d7c09 100644 --- a/Projectiles/Typeless/ShadowflameExplosion.cs +++ b/Projectiles/Typeless/ShadowflameExplosion.cs @@ -17,34 +17,34 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 75; - projectile.height = 75; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 75; + Projectile.height = 75; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 30; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.ai[1]++; - if (projectile.ai[1] >= 3f) + Projectile.ai[1]++; + if (Projectile.ai[1] >= 3f) { for (int i = 0; i < 2; i++) { - Vector2 Dspeed = new Vector2(2.3f, 2.3f).RotatedBy(MathHelper.ToRadians(projectile.ai[0])); + Vector2 Dspeed = new Vector2(2.3f, 2.3f).RotatedBy(MathHelper.ToRadians(Projectile.ai[0])); float Dscale = Main.rand.NextFloat(1f, 1.3f); - Dust.NewDust(projectile.Center, 1, 1, DustID.Shadowflame, Dspeed.X, Dspeed.Y, 0, default, Dscale); - Dust.NewDust(projectile.Center, 1, 1, DustID.Shadowflame, -Dspeed.X, -Dspeed.Y, 0, default, Dscale); - projectile.ai[0] += 19f; + Dust.NewDust(Projectile.Center, 1, 1, DustID.Shadowflame, Dspeed.X, Dspeed.Y, 0, default, Dscale); + Dust.NewDust(Projectile.Center, 1, 1, DustID.Shadowflame, -Dspeed.X, -Dspeed.Y, 0, default, Dscale); + Projectile.ai[0] += 19f; } - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; } - if (projectile.timeLeft < 25) + if (Projectile.timeLeft < 25) { - projectile.damage = 0; + Projectile.damage = 0; } } diff --git a/Projectiles/Typeless/ShadowflameExplosionBig.cs b/Projectiles/Typeless/ShadowflameExplosionBig.cs index d59b33c22f..64bd7a9d7f 100644 --- a/Projectiles/Typeless/ShadowflameExplosionBig.cs +++ b/Projectiles/Typeless/ShadowflameExplosionBig.cs @@ -17,37 +17,37 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 130; - projectile.height = 130; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 130; + Projectile.height = 130; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 30; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.ai[1]++; - if (projectile.ai[1] >= 3f) + Projectile.ai[1]++; + if (Projectile.ai[1] >= 3f) { for (int i = 0; i < 3; i++) { - Vector2 Dspeed = new Vector2(4.3f, 4.3f).RotatedBy(MathHelper.ToRadians(projectile.ai[0])); + Vector2 Dspeed = new Vector2(4.3f, 4.3f).RotatedBy(MathHelper.ToRadians(Projectile.ai[0])); float Dscale = Main.rand.NextFloat(1f, 1.5f); - Dust.NewDust(projectile.Center, 1, 1, DustID.Shadowflame, Dspeed.X, Dspeed.Y, 0, default, Dscale); + Dust.NewDust(Projectile.Center, 1, 1, DustID.Shadowflame, Dspeed.X, Dspeed.Y, 0, default, Dscale); Vector2 Ds2 = Dspeed.RotatedBy(MathHelper.ToRadians(120)); - Dust.NewDust(projectile.Center, 1, 1, DustID.Shadowflame, Ds2.X, Ds2.Y, 0, default, Dscale); + Dust.NewDust(Projectile.Center, 1, 1, DustID.Shadowflame, Ds2.X, Ds2.Y, 0, default, Dscale); Vector2 Ds3 = Dspeed.RotatedBy(MathHelper.ToRadians(240)); - Dust.NewDust(projectile.Center, 1, 1, DustID.Shadowflame, Ds3.X, Ds3.Y, 0, default, Dscale); - projectile.ai[0] += 19f; + Dust.NewDust(Projectile.Center, 1, 1, DustID.Shadowflame, Ds3.X, Ds3.Y, 0, default, Dscale); + Projectile.ai[0] += 19f; } - projectile.ai[1] = 0f; + Projectile.ai[1] = 0f; } - if (projectile.timeLeft < 25) + if (Projectile.timeLeft < 25) { - projectile.damage = 0; + Projectile.damage = 0; } } diff --git a/Projectiles/Typeless/SkyFlareFriendly.cs b/Projectiles/Typeless/SkyFlareFriendly.cs index 86062b7014..54cb80f780 100644 --- a/Projectiles/Typeless/SkyFlareFriendly.cs +++ b/Projectiles/Typeless/SkyFlareFriendly.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -12,56 +13,56 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Flare"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { - projectile.width = 42; - projectile.height = 42; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; + Projectile.width = 42; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 1; + Projectile.penetrate = 1; } public override void AI() { - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 2) + if (Projectile.frame > 2) { - projectile.frame = 0; + Projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0f); + Lighting.AddLight(Projectile.Center, 0.7f, 0.3f, 0f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = Projectile.height = 200; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 4; num621++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -71,13 +72,13 @@ namespace CalamityMod.Projectiles.Typeless } for (int num623 = 0; num623 < 12; num623++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile.Center, 3); + CalamityUtils.ExplosionGores(Projectile.Center, 3); } } } diff --git a/Projectiles/Typeless/SlurperBobber.cs b/Projectiles/Typeless/SlurperBobber.cs index d79ec02103..0816034bab 100644 --- a/Projectiles/Typeless/SlurperBobber.cs +++ b/Projectiles/Typeless/SlurperBobber.cs @@ -14,17 +14,17 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 61; - projectile.bobber = true; - projectile.penetrate = -1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 61; + Projectile.bobber = true; + Projectile.penetrate = -1; } public override bool PreDrawExtras(SpriteBatch spriteBatch) { - Lighting.AddLight(projectile.Center, 0.25f, 0f, 0f); - return projectile.DrawFishingLine(ModContent.ItemType(), new Color(227, 79, 79, 100)); + Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0f); + return Projectile.DrawFishingLine(ModContent.ItemType(), new Color(227, 79, 79, 100)); } } } diff --git a/Projectiles/Typeless/SpiritOriginBullseye.cs b/Projectiles/Typeless/SpiritOriginBullseye.cs index 440c38e4e6..2f0303e5cd 100644 --- a/Projectiles/Typeless/SpiritOriginBullseye.cs +++ b/Projectiles/Typeless/SpiritOriginBullseye.cs @@ -9,26 +9,26 @@ namespace CalamityMod.Projectiles.Typeless { public class SpiritOriginBullseye : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public NPC Target => Main.npc[(int)projectile.ai[0]]; + public Player Owner => Main.player[Projectile.owner]; + public NPC Target => Main.npc[(int)Projectile.ai[0]]; public bool FadingOut { - get => projectile.ai[1] == 1f; - set => projectile.ai[1] = value.ToInt(); + get => Projectile.ai[1] == 1f; + set => Projectile.ai[1] = value.ToInt(); } public Vector2 BullseyeOffsetFromCenter; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { - projectile.width = projectile.height = (int)(2 * DaawnlightSpiritOrigin.RegularEnemyBullseyeRadius); - projectile.aiStyle = -1; - projectile.friendly = false; - projectile.hostile = false; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.Opacity = 0f; - projectile.penetrate = -1; + Projectile.width = Projectile.height = (int)(2 * DaawnlightSpiritOrigin.RegularEnemyBullseyeRadius); + Projectile.aiStyle = -1; + Projectile.friendly = false; + Projectile.hostile = false; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.Opacity = 0f; + Projectile.penetrate = -1; } public override void SendExtraAI(BinaryWriter writer) => writer.WriteVector2(BullseyeOffsetFromCenter); @@ -37,57 +37,57 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - if (!Main.npc.IndexInRange((int)projectile.ai[0]) || !Owner.Calamity().spiritOrigin || !Target.active || Target.life <= 0 || Target.dontTakeDamage) + if (!Main.npc.IndexInRange((int)Projectile.ai[0]) || !Owner.Calamity().spiritOrigin || !Target.active || Target.life <= 0 || Target.dontTakeDamage) { - projectile.Kill(); + Projectile.Kill(); return; } - if (projectile.timeLeft < 45) + if (Projectile.timeLeft < 45) FadingOut = true; - projectile.Opacity = MathHelper.Clamp(projectile.Opacity + (FadingOut ? -0.08f : 0.04f), 0f, 1f); - projectile.scale = projectile.Opacity; - if (FadingOut && projectile.Opacity <= 0f) - projectile.Kill(); + Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + (FadingOut ? -0.08f : 0.04f), 0f, 1f); + Projectile.scale = Projectile.Opacity; + if (FadingOut && Projectile.Opacity <= 0f) + Projectile.Kill(); if (BullseyeOffsetFromCenter == Vector2.Zero) { BullseyeOffsetFromCenter = Main.rand.NextVector2CircularEdge(Target.width, Target.height) * Main.rand.NextFloat(0.925f, 1f) * 0.54f; if (BullseyeOffsetFromCenter.Y > 0f) BullseyeOffsetFromCenter.Y *= -1f; - projectile.netUpdate = true; + Projectile.netUpdate = true; } else - projectile.Center = Target.Center + BullseyeOffsetFromCenter; + Projectile.Center = Target.Center + BullseyeOffsetFromCenter; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (Main.myPlayer != projectile.owner) + if (Main.myPlayer != Projectile.owner) return false; - float scale = 2f - projectile.scale; - float rotation = MathHelper.TwoPi * projectile.scale; + float scale = 2f - Projectile.scale; + float rotation = MathHelper.TwoPi * Projectile.scale; Vector2 drawPosition = Target.Center + BullseyeOffsetFromCenter - Main.screenPosition; if (FadingOut) { - scale = projectile.scale; + scale = Projectile.scale; rotation = 0f; } - Texture2D bullseyeTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/DaawnlightSpiritOriginRegularBullseye"); + Texture2D bullseyeTexture = ModContent.Request("CalamityMod/ExtraTextures/DaawnlightSpiritOriginRegularBullseye"); Rectangle frame = bullseyeTexture.Frame(); if (Target.IsABoss()) { - bullseyeTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/DaawnlightSpiritOriginBossBullseye"); + bullseyeTexture = ModContent.Request("CalamityMod/ExtraTextures/DaawnlightSpiritOriginBossBullseye"); frame = bullseyeTexture.Frame(1, 4, 0, (int)(Main.GlobalTime * 7f) % 4); rotation = 0f; drawPosition.Y -= 17; drawPosition.X -= 1; } - spriteBatch.Draw(bullseyeTexture, drawPosition, frame, Color.White * projectile.Opacity, rotation, frame.Size() * 0.5f, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(bullseyeTexture, drawPosition, frame, Color.White * Projectile.Opacity, rotation, frame.Size() * 0.5f, scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Typeless/StandingFire.cs b/Projectiles/Typeless/StandingFire.cs index 4c53894270..34fc3f232a 100644 --- a/Projectiles/Typeless/StandingFire.cs +++ b/Projectiles/Typeless/StandingFire.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class StandingFire : ModProjectile @@ -17,51 +18,51 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 240; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 7; + Projectile.width = 6; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 240; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 7; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + Projectile.velocity.X = Projectile.velocity.X * -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; - if (projectile.ai[1] == 0f && projectile.type >= 326 && projectile.type <= 328) + Projectile.rotation += Projectile.velocity.X * 0.1f; + if (Projectile.ai[1] == 0f && Projectile.type >= 326 && Projectile.type <= 328) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item13, projectile.position); + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item13, Projectile.position); } - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num199]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -70,7 +71,7 @@ namespace CalamityMod.Projectiles.Typeless dust.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Dust dust2 = Main.dust[num200]; dust2.position.X -= 2f; dust2.position.Y += 2f; @@ -78,14 +79,14 @@ namespace CalamityMod.Projectiles.Typeless dust2.noGravity = true; dust2.velocity *= 0.1f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + Projectile.velocity.X = Projectile.velocity.X * 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) + Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } diff --git a/Projectiles/Typeless/StarStruckWaterBottle.cs b/Projectiles/Typeless/StarStruckWaterBottle.cs index 3ab2600d04..61129d7708 100644 --- a/Projectiles/Typeless/StarStruckWaterBottle.cs +++ b/Projectiles/Typeless/StarStruckWaterBottle.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -17,39 +18,39 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 2; - projectile.friendly = true; - projectile.penetrate = 1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 2; + Projectile.friendly = true; + Projectile.penetrate = 1; } public override void AI() { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 10f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 10f) { - projectile.velocity.Y += 0.1f; - projectile.velocity.X *= 0.998f; + Projectile.velocity.Y += 0.1f; + Projectile.velocity.X *= 0.998f; } } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Main.PlaySound(SoundID.Shatter, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.Shatter, (int)Projectile.position.X, (int)Projectile.position.Y, 1, 1f, 0f); for (int index = 0; index < 5; ++index) - Dust.NewDust(projectile.position, projectile.width, projectile.height, 13, 0f, 0f, 0, new Color(), 1f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 13, 0f, 0f, 0, new Color(), 1f); for (int index1 = 0; index1 < 30; ++index1) { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType(), 0f, -2f, 0, new Color(), 1.1f); + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, -2f, 0, new Color(), 1.1f); Dust dust = Main.dust[index2]; dust.alpha = 100; dust.velocity.X *= 1.5f; dust.velocity *= 3f; } - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, projectile.owner, 4f); + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Projectile.owner, 4f); } } } diff --git a/Projectiles/Typeless/StickyFeatherAero.cs b/Projectiles/Typeless/StickyFeatherAero.cs index 9b055b38c1..b2f3fb7299 100644 --- a/Projectiles/Typeless/StickyFeatherAero.cs +++ b/Projectiles/Typeless/StickyFeatherAero.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class StickyFeatherAero : ModProjectile @@ -15,38 +16,38 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.timeLeft = 360; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.aiStyle = 93; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 360; + Projectile.penetrate = 3; + Projectile.alpha = 255; + Projectile.aiStyle = 93; aiType = ProjectileID.NailFriendly; } public override void AI() { - if (projectile.timeLeft < 320) + if (Projectile.timeLeft < 320) { - projectile.tileCollide = true; + Projectile.tileCollide = true; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 150f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 150f, 12f, 20f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 50; + Projectile.height = 50; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -56,10 +57,10 @@ namespace CalamityMod.Projectiles.Typeless } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Typeless/StormBolt.cs b/Projectiles/Typeless/StormBolt.cs index acb469cbfe..26fce7e521 100644 --- a/Projectiles/Typeless/StormBolt.cs +++ b/Projectiles/Typeless/StormBolt.cs @@ -14,24 +14,24 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.light = 1f; - projectile.timeLeft = 300; + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.light = 1f; + Projectile.timeLeft = 300; } public override void AI() { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 16, projectile.velocity.X * 0.15f, projectile.velocity.Y * 0.15f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 16, Projectile.velocity.X * 0.15f, Projectile.velocity.Y * 0.15f); } public override void Kill(int timeLeft) { - if (projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Typeless/SuicideBomberDemon.cs b/Projectiles/Typeless/SuicideBomberDemon.cs index f03ad218a4..97780cd193 100644 --- a/Projectiles/Typeless/SuicideBomberDemon.cs +++ b/Projectiles/Typeless/SuicideBomberDemon.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -13,42 +14,42 @@ namespace CalamityMod.Projectiles.Typeless { public bool HasDamagedSomething { - get => projectile.ai[0] == 1f; - set => projectile.ai[0] = value.ToInt(); + get => Projectile.ai[0] == 1f; + set => Projectile.ai[0] = value.ToInt(); } - public ref float Time => ref projectile.ai[1]; - public Player Owner => Main.player[projectile.owner]; + public ref float Time => ref Projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; public PrimitiveTrail FlameTrailDrawer = null; public override void SetStaticDefaults() { DisplayName.SetDefault("Demon"); - Main.projFrames[projectile.type] = 12; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 11; + Main.projFrames[Projectile.type] = 12; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 11; } public override void SetDefaults() { - projectile.width = projectile.height = 48; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.Opacity = 0f; - projectile.timeLeft = 600; + Projectile.width = Projectile.height = 48; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.Opacity = 0f; + Projectile.timeLeft = 600; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(projectile.friendly); - writer.Write(projectile.hostile); + writer.Write(Projectile.friendly); + writer.Write(Projectile.hostile); } public override void ReceiveExtraAI(BinaryReader reader) { - projectile.friendly = reader.ReadBoolean(); - projectile.hostile = reader.ReadBoolean(); + Projectile.friendly = reader.ReadBoolean(); + Projectile.hostile = reader.ReadBoolean(); } public override void AI() @@ -56,11 +57,11 @@ namespace CalamityMod.Projectiles.Typeless Time++; // Decide an owner if necessary. - if (projectile.owner == 255) - projectile.owner = Player.FindClosest(projectile.Center, 1, 1); + if (Projectile.owner == 255) + Projectile.owner = Player.FindClosest(Projectile.Center, 1, 1); // Rapidly fade in. - projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.025f, 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.025f, 0f, 1f); // Anti-clumping behavior. float pushForce = 0.08f; @@ -69,32 +70,32 @@ namespace CalamityMod.Projectiles.Typeless Projectile otherProj = Main.projectile[k]; // Short circuits to make the loop as fast as possible. - if (!otherProj.active || otherProj.type != projectile.type || k == projectile.whoAmI) + if (!otherProj.active || otherProj.type != Projectile.type || k == Projectile.whoAmI) continue; // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. - bool sameProjType = otherProj.type == projectile.type; - float taxicabDist = MathHelper.Distance(projectile.position.X, otherProj.position.X) + MathHelper.Distance(projectile.position.Y, otherProj.position.Y); + bool sameProjType = otherProj.type == Projectile.type; + float taxicabDist = MathHelper.Distance(Projectile.position.X, otherProj.position.X) + MathHelper.Distance(Projectile.position.Y, otherProj.position.Y); if (sameProjType && taxicabDist < 60f) { - if (projectile.position.X < otherProj.position.X) - projectile.velocity.X -= pushForce; + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; else - projectile.velocity.X += pushForce; + Projectile.velocity.X += pushForce; - if (projectile.position.Y < otherProj.position.Y) - projectile.velocity.Y -= pushForce; + if (Projectile.position.Y < otherProj.position.Y) + Projectile.velocity.Y -= pushForce; else - projectile.velocity.Y += pushForce; + Projectile.velocity.Y += pushForce; } } Entity target = Owner; float attackFlySpeed = 18.5f; float flyInertia = 25f; - if (projectile.friendly) + if (Projectile.friendly) { - target = projectile.Center.ClosestNPCAt(1360f); + target = Projectile.Center.ClosestNPCAt(1360f); attackFlySpeed = 26.75f; flyInertia = 8f; } @@ -103,89 +104,89 @@ namespace CalamityMod.Projectiles.Typeless else if (!Owner.active || Owner.dead) target = null; - int oldSpriteDirection = projectile.spriteDirection; + int oldSpriteDirection = Projectile.spriteDirection; // Rise upward somewhat slowly and flap wings. if (Time < 45f) { - projectile.velocity = Vector2.Lerp(projectile.velocity, -Vector2.UnitY * 5f, 0.06f); - if (projectile.frameCounter >= 6) + Projectile.velocity = Vector2.Lerp(Projectile.velocity, -Vector2.UnitY * 5f, 0.06f); + if (Projectile.frameCounter >= 6) { - projectile.frame = (projectile.frame + 1) % 5; - projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % 5; + Projectile.frameCounter = 0; } } else if (Time < 90f) { // Slow down. - projectile.velocity = projectile.velocity.MoveTowards(Vector2.Zero, 0.4f) * 0.95f; + Projectile.velocity = Projectile.velocity.MoveTowards(Vector2.Zero, 0.4f) * 0.95f; // Handle frames. - projectile.frame = (int)Math.Round(MathHelper.Lerp(5f, 10f, Utils.InverseLerp(45f, 90f, Time, true))); + Projectile.frame = (int)Math.Round(MathHelper.Lerp(5f, 10f, Utils.InverseLerp(45f, 90f, Time, true))); // And look at the target. - float idealAngle = target is null ? 0f : projectile.AngleTo(target.Center); - projectile.spriteDirection = target is null ? 1 : (target.Center.X > projectile.Center.X).ToDirectionInt(); - if (projectile.spriteDirection != oldSpriteDirection) - projectile.rotation += MathHelper.Pi; + float idealAngle = target is null ? 0f : Projectile.AngleTo(target.Center); + Projectile.spriteDirection = target is null ? 1 : (target.Center.X > Projectile.Center.X).ToDirectionInt(); + if (Projectile.spriteDirection != oldSpriteDirection) + Projectile.rotation += MathHelper.Pi; - if (projectile.spriteDirection == -1) + if (Projectile.spriteDirection == -1) idealAngle += MathHelper.Pi; - projectile.rotation = projectile.rotation.AngleTowards(idealAngle, 0.3f).AngleLerp(idealAngle, 0.08f); + Projectile.rotation = Projectile.rotation.AngleTowards(idealAngle, 0.3f).AngleLerp(idealAngle, 0.08f); if (Time == 75f) - Main.PlaySound(SoundID.DD2_WyvernScream, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_WyvernScream, Projectile.Center); // Reset the oldPos array in anticipation of a trail being drawn during the fly phase. - projectile.oldPos = new Vector2[projectile.oldPos.Length]; + Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; } else { if (Time == 90f) - Main.PlaySound(SoundID.DD2_WyvernDiveDown, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_WyvernDiveDown, Projectile.Center); - projectile.frame = Main.projFrames[projectile.type] - 1; + Projectile.frame = Main.projFrames[Projectile.type] - 1; // Fly away if no valid target was found. if (target is null) - projectile.velocity = -Vector2.UnitY * 18f; + Projectile.velocity = -Vector2.UnitY * 18f; // Otherwise fly towards the target. else - projectile.velocity = (projectile.velocity * (flyInertia - 1f) + projectile.SafeDirectionTo(target.Center) * attackFlySpeed) / flyInertia; + Projectile.velocity = (Projectile.velocity * (flyInertia - 1f) + Projectile.SafeDirectionTo(target.Center) * attackFlySpeed) / flyInertia; - projectile.spriteDirection = (projectile.velocity.X > 0f).ToDirectionInt(); - projectile.rotation = CalamityUtils.WrapAngle90Degrees(projectile.velocity.ToRotation()); + Projectile.spriteDirection = (Projectile.velocity.X > 0f).ToDirectionInt(); + Projectile.rotation = CalamityUtils.WrapAngle90Degrees(Projectile.velocity.ToRotation()); if (target is null) { - projectile.spriteDirection = 1; - projectile.rotation = projectile.velocity.ToRotation(); + Projectile.spriteDirection = 1; + Projectile.rotation = Projectile.velocity.ToRotation(); } // Die if something has been hit and the target is either gone or really close. - if (HasDamagedSomething && (target is null || target == Owner || projectile.WithinRange(target.Center, target.Size.Length() * 0.4f))) - projectile.Kill(); + if (HasDamagedSomething && (target is null || target == Owner || Projectile.WithinRange(target.Center, target.Size.Length() * 0.4f))) + Projectile.Kill(); } - if (target != null && !HasDamagedSomething && projectile.Center.ManhattanDistance(target.Center) < target.height) + if (target != null && !HasDamagedSomething && Projectile.Center.ManhattanDistance(target.Center) < target.height) { HasDamagedSomething = true; - projectile.netUpdate = true; + Projectile.netUpdate = true; } if (Time >= 300f) - projectile.Kill(); + Projectile.Kill(); - projectile.frameCounter++; + Projectile.frameCounter++; } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.DD2_KoboldExplosion, projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_KoboldExplosion, Projectile.Center); for (int i = 0; i < 40; i++) { - Dust explosion = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 267); + Dust explosion = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 267); explosion.velocity = Main.rand.NextVector2Circular(4f, 4f); explosion.color = Color.Red; explosion.scale = 1.35f; @@ -203,7 +204,7 @@ namespace CalamityMod.Projectiles.Typeless } } - public override bool CanDamage() => projectile.Opacity >= 1f; + public override bool CanDamage() => Projectile.Opacity >= 1f; // Ensure damage is not absolutely obscene when hitting players. public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = 95; @@ -228,24 +229,24 @@ namespace CalamityMod.Projectiles.Typeless FlameTrailDrawer = new PrimitiveTrail(FlameTrailWidthFunction, FlameTrailColorFunction, null, GameShaders.Misc["CalamityMod:ImpFlameTrail"]); // Prepare the flame trail shader with its map texture. - GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/ScarletDevilStreak")); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/ScarletDevilStreak")); - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Typeless/SuicideBomberDemon"); - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Projectiles/Typeless/SuicideBomberDemonGlowmask"); - Texture2D orbTexture = ModContent.GetTexture("CalamityMod/Projectiles/Typeless/SuicideBomberDemonOrb"); - if (projectile.friendly) + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Typeless/SuicideBomberDemon"); + Texture2D glowmask = ModContent.Request("CalamityMod/Projectiles/Typeless/SuicideBomberDemonGlowmask"); + Texture2D orbTexture = ModContent.Request("CalamityMod/Projectiles/Typeless/SuicideBomberDemonOrb"); + if (Projectile.friendly) { - texture = ModContent.GetTexture("CalamityMod/Projectiles/Typeless/SuicideBomberDemonFriendly"); - glowmask = ModContent.GetTexture("CalamityMod/Projectiles/Typeless/SuicideBomberDemonGlowmaskFriendly"); - orbTexture = ModContent.GetTexture("CalamityMod/Projectiles/Typeless/SuicideBomberDemonOrbFriendly"); + texture = ModContent.Request("CalamityMod/Projectiles/Typeless/SuicideBomberDemonFriendly"); + glowmask = ModContent.Request("CalamityMod/Projectiles/Typeless/SuicideBomberDemonGlowmaskFriendly"); + orbTexture = ModContent.Request("CalamityMod/Projectiles/Typeless/SuicideBomberDemonOrbFriendly"); } - Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Vector2 drawPosition = projectile.Center - Main.screenPosition; - SpriteEffects direction = projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; // Draw the base sprite and glowmask. - spriteBatch.Draw(texture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); - spriteBatch.Draw(glowmask, drawPosition, frame, projectile.GetAlpha(Color.White), projectile.rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); + spriteBatch.Draw(glowmask, drawPosition, frame, Projectile.GetAlpha(Color.White), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); // Draw the flame trail and flame orb once ready. if (Time >= 90f) @@ -257,12 +258,12 @@ namespace CalamityMod.Projectiles.Typeless flameOrbColor.A = 0; Vector2 flameOrbDrawOffset = (MathHelper.TwoPi * i / 12f + Main.GlobalTime * 2f).ToRotationVector2(); flameOrbDrawOffset *= flameOrbGlowIntensity * 3f; - spriteBatch.Draw(orbTexture, drawPosition + flameOrbDrawOffset, frame, projectile.GetAlpha(flameOrbColor), projectile.rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + spriteBatch.Draw(orbTexture, drawPosition + flameOrbDrawOffset, frame, Projectile.GetAlpha(flameOrbColor), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0f); } - Vector2 trailOffset = projectile.Size * 0.5f; - trailOffset += (projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 20f; - FlameTrailDrawer.Draw(projectile.oldPos, trailOffset - Main.screenPosition, 61); + Vector2 trailOffset = Projectile.Size * 0.5f; + trailOffset += (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 20f; + FlameTrailDrawer.Draw(Projectile.oldPos, trailOffset - Main.screenPosition, 61); } spriteBatch.ExitShaderRegion(); @@ -273,13 +274,13 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitPlayer(Player target, int damage, bool crit) { HasDamagedSomething = true; - projectile.netUpdate = true; + Projectile.netUpdate = true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { HasDamagedSomething = true; - projectile.netUpdate = true; + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs index 3089dac510..338a4fcd72 100644 --- a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs +++ b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -14,135 +15,135 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Bubble"); - Main.projFrames[projectile.type] = 7; + Main.projFrames[Projectile.type] = 7; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 0.1f; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.timeLeft = 360; - projectile.penetrate = 1; + Projectile.width = 30; + Projectile.height = 30; + Projectile.scale = 0.1f; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.timeLeft = 360; + Projectile.penetrate = 1; } public override void AI() { - if (projectile.ai[0] == 1f) + if (Projectile.ai[0] == 1f) { - projectile.ai[0] = 0f; - projectile.scale = 1f; + Projectile.ai[0] = 0f; + Projectile.scale = 1f; fromArmour = true; } - projectile.frameCounter++; - if (projectile.frameCounter > 6) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - projectile.frame++; - projectile.frameCounter = 0; + Projectile.frame++; + Projectile.frameCounter = 0; } - if (projectile.frame > 6) + if (Projectile.frame > 6) { - projectile.frame = 0; + Projectile.frame = 0; } - if (projectile.localAI[1] < 1f) + if (Projectile.localAI[1] < 1f) { - projectile.localAI[1] += 0.01f; - if (projectile.scale < 1f || (fromArmour && projectile.scale < 1.8f)) - projectile.scale += 0.02f; - projectile.width = (int)(30f * projectile.scale); - projectile.height = (int)(30f * projectile.scale); + Projectile.localAI[1] += 0.01f; + if (Projectile.scale < 1f || (fromArmour && Projectile.scale < 1.8f)) + Projectile.scale += 0.02f; + Projectile.width = (int)(30f * Projectile.scale); + Projectile.height = (int)(30f * Projectile.scale); } else { - projectile.width = fromArmour ? projectile.width : 30; - projectile.height = fromArmour ? projectile.height : 30; - projectile.tileCollide = true; + Projectile.width = fromArmour ? Projectile.width : 30; + Projectile.height = fromArmour ? Projectile.height : 30; + Projectile.tileCollide = true; } - if (projectile.localAI[0] > 2f) + if (Projectile.localAI[0] > 2f) { - projectile.alpha -= 20; - if (projectile.alpha < 100) + Projectile.alpha -= 20; + if (Projectile.alpha < 100) { - projectile.alpha = 100; + Projectile.alpha = 100; } } else { - projectile.localAI[0] += 1f; + Projectile.localAI[0] += 1f; } - if (projectile.ai[1] > 30f) + if (Projectile.ai[1] > 30f) { - if (projectile.velocity.Y > -2f) + if (Projectile.velocity.Y > -2f) { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.05f; } } else { - projectile.ai[1] += 1f; + Projectile.ai[1] += 1f; } - if (projectile.wet) + if (Projectile.wet) { - if (projectile.velocity.Y > 0f) + if (Projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; + Projectile.velocity.Y = Projectile.velocity.Y * 0.98f; } - if (projectile.velocity.Y > -1f) + if (Projectile.velocity.Y > -1f) { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Texture2D texture2D13 = Main.projectileTexture[Projectile.type]; + int num214 = Main.projectileTexture[Projectile.type].Height / Main.projFrames[Projectile.type]; + int y6 = num214 * Projectile.frame; + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0f); return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.localAI[1] < 1f) + if (Projectile.localAI[1] < 1f) { return; } target.AddBuff(BuffID.Venom, fromArmour ? 150 : 120); - projectile.Kill(); + Projectile.Kill(); } public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.localAI[1] < 1f) + if (Projectile.localAI[1] < 1f) { return; } target.AddBuff(BuffID.Venom, fromArmour ? 150 : 120); - projectile.Kill(); + Projectile.Kill(); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item54, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 60; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 60; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int num3; for (int num246 = 0; num246 < 25; num246 = num3 + 1) { - int num247 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 0, default, 1f); - Main.dust[num247].position = (Main.dust[num247].position + projectile.position) / 2f; + int num247 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 0, default, 1f); + Main.dust[num247].position = (Main.dust[num247].position + Projectile.position) / 2f; Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); Main.dust[num247].velocity.Normalize(); Dust dust = Main.dust[num247]; dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[num247].alpha = projectile.alpha; + Main.dust[num247].alpha = Projectile.alpha; num3 = num246; } } diff --git a/Projectiles/Typeless/TarraEnergy.cs b/Projectiles/Typeless/TarraEnergy.cs index 560931e917..37d895f20a 100644 --- a/Projectiles/Typeless/TarraEnergy.cs +++ b/Projectiles/Typeless/TarraEnergy.cs @@ -15,20 +15,20 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 200; - projectile.extraUpdates = 1; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 200; + Projectile.extraUpdates = 1; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 170 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 170 && target.CanBeChasedBy(Projectile); // Reduce damage of projectiles if more than the cap are active public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - int projectileCount = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + int projectileCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type]; int cap = 2; int oldDamage = damage; if (projectileCount > cap) @@ -43,11 +43,11 @@ namespace CalamityMod.Projectiles.Typeless { for (int num136 = 0; num136 < 2; num136++) { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - Vector2 dspeed = projectile.velocity * Main.rand.NextFloat(0.7f, 0.4f); + float x2 = Projectile.position.X - Projectile.velocity.X / 10f * (float)num136; + float y2 = Projectile.position.Y - Projectile.velocity.Y / 10f * (float)num136; + Vector2 dspeed = Projectile.velocity * Main.rand.NextFloat(0.7f, 0.4f); int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f); - Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].alpha = Projectile.alpha; Main.dust[num137].position.X = x2; Main.dust[num137].position.Y = y2; Main.dust[num137].velocity = dspeed; @@ -55,8 +55,8 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[num137].noLight = true; } - if (projectile.timeLeft < 170) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 9f, 20f); + if (Projectile.timeLeft < 170) + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 9f, 20f); } } } diff --git a/Projectiles/Typeless/TerminusHoldout.cs b/Projectiles/Typeless/TerminusHoldout.cs index 6f591ee242..3e0c779d15 100644 --- a/Projectiles/Typeless/TerminusHoldout.cs +++ b/Projectiles/Typeless/TerminusHoldout.cs @@ -6,24 +6,25 @@ using Terraria; using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { public class TerminusHoldout : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public ref float Time => ref projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; public const int Lifetime = 300; public override string Texture => "CalamityMod/Items/SummonItems/BossRush"; public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = -1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = Lifetime; - projectile.penetrate = -1; + Projectile.width = 50; + Projectile.height = 50; + Projectile.aiStyle = -1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = Lifetime; + Projectile.penetrate = -1; } public override void AI() @@ -36,7 +37,7 @@ namespace CalamityMod.Projectiles.Typeless BossRushEvent.SyncStartTimer(BossRushEvent.StartEffectTotalTime); CreateMysticDeathDust(); - projectile.Kill(); + Projectile.Kill(); return; } @@ -50,36 +51,36 @@ namespace CalamityMod.Projectiles.Typeless MoonlordDeathDrama.RequestLight(Utils.InverseLerp(0f, 15f, Time, true), Main.LocalPlayer.Center); if (Time >= 45f) { - Main.PlaySound(SoundID.DD2_EtherianPortalOpen, Main.LocalPlayer.Center); + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalOpen, Main.LocalPlayer.Center); if (Main.netMode != NetmodeID.MultiplayerClient) BossRushEvent.End(); - projectile.Kill(); + Projectile.Kill(); } return; } - if (projectile.timeLeft == 1) + if (Projectile.timeLeft == 1) { - projectile.Kill(); + Projectile.Kill(); CreateEffectsHandler(); return; } CreateIdleMagicDust(); float currentShakePower = MathHelper.Lerp(0.2f, 8f, Utils.InverseLerp(Lifetime * 0.725f, Lifetime, Time, true)); - currentShakePower *= 1f - Utils.InverseLerp(1000f, 3100f, Main.LocalPlayer.Distance(projectile.Center), true); + currentShakePower *= 1f - Utils.InverseLerp(1000f, 3100f, Main.LocalPlayer.Distance(Projectile.Center), true); Main.LocalPlayer.Calamity().GeneralScreenShakePower = currentShakePower; } public void CreateEffectsHandler() { - Main.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, Main.LocalPlayer.Center); + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, Main.LocalPlayer.Center); Main.LocalPlayer.Calamity().GeneralScreenShakePower = 16f; - if (Main.myPlayer == projectile.owner) - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, projectile.owner); + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Projectile.owner); } public void CreateMysticDeathDust() @@ -89,7 +90,7 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < 20; i++) { - Dust paleMagic = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(22f, 28f), 261); + Dust paleMagic = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(22f, 28f), 261); paleMagic.velocity = -Vector2.UnitY * Main.rand.NextFloat(1.8f, 3.2f); paleMagic.color = Color.White; paleMagic.scale = Main.rand.NextFloat(1.1f, 1.35f); @@ -108,8 +109,8 @@ namespace CalamityMod.Projectiles.Typeless float dustScale = MathHelper.Lerp(1.15f, 1.725f, Time / Lifetime); for (int i = 0; i < dustCount; i++) { - Vector2 spawnPosition = projectile.Center + Main.rand.NextVector2Unit() * outwardness * Main.rand.NextFloat(0.75f, 1.1f); - Vector2 dustVelocity = (projectile.Center - spawnPosition) * 0.085f + Owner.velocity; + Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Unit() * outwardness * Main.rand.NextFloat(0.75f, 1.1f); + Vector2 dustVelocity = (Projectile.Center - spawnPosition) * 0.085f + Owner.velocity; Dust paleMagic = Dust.NewDustPerfect(spawnPosition, 264); paleMagic.velocity = dustVelocity; @@ -122,27 +123,27 @@ namespace CalamityMod.Projectiles.Typeless public void UpdatePlayerFields() { - if (projectile.localAI[0] == 0f) + if (Projectile.localAI[0] == 0f) { - projectile.spriteDirection = Owner.direction; - projectile.localAI[0] = 1f; + Projectile.spriteDirection = Owner.direction; + Projectile.localAI[0] = 1f; } Owner.itemRotation = 0f; - Owner.heldProj = projectile.whoAmI; + Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; - Owner.ChangeDir(projectile.spriteDirection); + Owner.ChangeDir(Projectile.spriteDirection); - projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter, true) + Vector2.UnitX * projectile.spriteDirection * 26f; + Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter, true) + Vector2.UnitX * Projectile.spriteDirection * 26f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - Vector2 baseDrawPosition = projectile.Center - Main.screenPosition; + Texture2D texture = Main.projectileTexture[Projectile.type]; + Vector2 baseDrawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() * 0.5f; - Color baseColor = Color.Lerp(projectile.GetAlpha(lightColor), Color.White, Utils.InverseLerp(40f, 120f, Time, true)); - SpriteEffects direction = projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Color baseColor = Color.Lerp(Projectile.GetAlpha(lightColor), Color.White, Utils.InverseLerp(40f, 120f, Time, true)); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; if (Time >= 150f) { float outwardness = MathHelper.SmoothStep(1f, 15f, Utils.InverseLerp(150f, Lifetime - 30f, Time, true)); @@ -152,10 +153,10 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < 10; i++) { Vector2 drawOffset = (MathHelper.TwoPi * i / 10f + Main.GlobalTime * 4.4f).ToRotationVector2() * outwardness; - spriteBatch.Draw(texture, baseDrawPosition + drawOffset, null, afterimageColor, 0f, origin, projectile.scale, direction, 0f); + spriteBatch.Draw(texture, baseDrawPosition + drawOffset, null, afterimageColor, 0f, origin, Projectile.scale, direction, 0f); } } - spriteBatch.Draw(texture, baseDrawPosition, null, baseColor, 0f, origin, projectile.scale, direction, 0f); + spriteBatch.Draw(texture, baseDrawPosition, null, baseColor, 0f, origin, Projectile.scale, direction, 0f); return false; } diff --git a/Projectiles/Typeless/TeslaAura.cs b/Projectiles/Typeless/TeslaAura.cs index ec6dac1637..d635f014b6 100644 --- a/Projectiles/Typeless/TeslaAura.cs +++ b/Projectiles/Typeless/TeslaAura.cs @@ -19,53 +19,53 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Tesla's Electricity"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; } public override void SetDefaults() { - projectile.width = 218; - projectile.height = 218; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.timeLeft *= 5; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 25; + Projectile.width = 218; + Projectile.height = 218; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.timeLeft *= 5; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 25; } public override void AI() { //Protect against other mod projectile reflection like emode Granite Golems - projectile.friendly = true; - projectile.hostile = false; + Projectile.friendly = true; + Projectile.hostile = false; - projectile.frameCounter++; - if (projectile.frameCounter > 3) + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) { - projectile.localAI[0]++; - projectile.frameCounter = 0; + Projectile.localAI[0]++; + Projectile.frameCounter = 0; } - if (projectile.localAI[0] >= framesY) + if (Projectile.localAI[0] >= framesY) { - projectile.localAI[0] = 0; - projectile.localAI[1]++; + Projectile.localAI[0] = 0; + Projectile.localAI[1]++; } - if (projectile.localAI[1] >= framesX) + if (Projectile.localAI[1] >= framesX) { - projectile.localAI[1] = 0; + Projectile.localAI[1] = 0; } - Player player = Main.player[projectile.owner]; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.01f / 255f); - projectile.Center = player.Center; + Player player = Main.player[Projectile.owner]; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + Projectile.Center = player.Center; if (player is null || player.dead) { player.ClearBuff(ModContent.BuffType()); player.Calamity().tesla = false; - projectile.Kill(); + Projectile.Kill(); } } @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Typeless { knockbackMultiplier = 0; } - Vector2 trueKnockback = target.Center - projectile.Center; + Vector2 trueKnockback = target.Center - Projectile.Center; trueKnockback.Normalize(); target.velocity = trueKnockback * knockbackMultiplier; } @@ -98,20 +98,20 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D sprite = Main.projectileTexture[projectile.type]; + Texture2D sprite = Main.projectileTexture[Projectile.type]; Color drawColour = Color.White; - Rectangle sourceRect = new Rectangle(projectile.width * (int)projectile.localAI[1], projectile.height * (int)projectile.localAI[0], projectile.width, projectile.height); - Vector2 origin = new Vector2(projectile.width / 2, projectile.height / 2); + Rectangle sourceRect = new Rectangle(Projectile.width * (int)Projectile.localAI[1], Projectile.height * (int)Projectile.localAI[0], Projectile.width, Projectile.height); + Vector2 origin = new Vector2(Projectile.width / 2, Projectile.height / 2); float opacity = 1f; int sparkCount = 0; int fadeTime = 20; - if (projectile.timeLeft < fadeTime) + if (Projectile.timeLeft < fadeTime) { - opacity = projectile.timeLeft * (1f / fadeTime); - sparkCount = fadeTime - projectile.timeLeft; + opacity = Projectile.timeLeft * (1f / fadeTime); + sparkCount = fadeTime - Projectile.timeLeft; } for (int i = 0; i < sparkCount * 2; i++) @@ -127,15 +127,15 @@ namespace CalamityMod.Projectiles.Typeless dustPos.Normalize(); dustPos *= radius + Main.rand.NextFloat(-rangeDiff, rangeDiff); - int dust = Dust.NewDust(projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); + int dust = Dust.NewDust(Projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); Main.dust[dust].noGravity = true; } - spriteBatch.Draw(sprite, projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(sprite, Projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, Projectile.rotation, origin, 1f, SpriteEffects.None, 0f); return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); public override bool? CanHitNPC(NPC target) { diff --git a/Projectiles/Typeless/TrueBattleSpawn.cs b/Projectiles/Typeless/TrueBattleSpawn.cs index bf690db289..e9b8709244 100644 --- a/Projectiles/Typeless/TrueBattleSpawn.cs +++ b/Projectiles/Typeless/TrueBattleSpawn.cs @@ -15,25 +15,25 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; - projectile.aiStyle = 1; - projectile.scale = 1f; - projectile.penetrate = 1; - projectile.timeLeft = 20; - projectile.tileCollide = false; + Projectile.width = 6; + Projectile.height = 6; + Projectile.aiStyle = 1; + Projectile.scale = 1f; + Projectile.penetrate = 1; + Projectile.timeLeft = 20; + Projectile.tileCollide = false; aiType = ProjectileID.Bullet; } public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.ai[1]++; + Player player = Main.player[Projectile.owner]; + Projectile.ai[1]++; - if (projectile.ai[1] >= 0) + if (Projectile.ai[1] >= 0) { NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - projectile.ai[1] = -30; + Projectile.ai[1] = -30; } } } diff --git a/Projectiles/Typeless/UnstableSpark.cs b/Projectiles/Typeless/UnstableSpark.cs index 3cae7f859e..10639aefb9 100644 --- a/Projectiles/Typeless/UnstableSpark.cs +++ b/Projectiles/Typeless/UnstableSpark.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 90; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + Projectile.width = 6; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 90; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } // Reduce damage of projectiles if more than the cap are active public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - int projectileCount = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + int projectileCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type]; int cap = 5; int oldDamage = damage; if (projectileCount > cap) @@ -39,35 +39,35 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + Projectile.velocity.X = Projectile.velocity.X * -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if (projectile.velocity.X > -0.01 && projectile.velocity.X < 0.01) + Projectile.velocity.X = Projectile.velocity.X * 0.97f; + if (Projectile.velocity.X > -0.01 && Projectile.velocity.X < 0.01) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); + Projectile.rotation += Projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 0.5f); Dust dust = Main.dust[num199]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Typeless dust.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 0.5f); Dust dust2 = Main.dust[num200]; dust2.position.X -= 2f; dust2.position.Y += 2f; @@ -84,14 +84,14 @@ namespace CalamityMod.Projectiles.Typeless dust2.noGravity = true; dust2.velocity *= 0.1f; } - if (projectile.velocity.Y < 0.25 && projectile.velocity.Y > 0.15) + if (Projectile.velocity.Y < 0.25 && Projectile.velocity.Y > 0.15) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + Projectile.velocity.X = Projectile.velocity.X * 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) + Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } diff --git a/Projectiles/Typeless/VanquisherArrowSplit.cs b/Projectiles/Typeless/VanquisherArrowSplit.cs index d594499d55..3d3471c1ce 100644 --- a/Projectiles/Typeless/VanquisherArrowSplit.cs +++ b/Projectiles/Typeless/VanquisherArrowSplit.cs @@ -16,43 +16,43 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; - projectile.friendly = true; - projectile.arrow = true; - projectile.timeLeft = 90; - projectile.penetrate = 1; - projectile.extraUpdates = 1; + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.arrow = true; + Projectile.timeLeft = 90; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; } public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + CalamityGlobalProjectile.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft < 90) + if (Projectile.timeLeft < 90) { Vector2 origin = new Vector2(0f, 0f); Color color = Color.White; - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * (b2 / 255f)); color = new Color(b2, b2, b2, a2); } - Rectangle frame = new Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Ammo/VanquisherArrowGlow"), projectile.Center - Main.screenPosition, frame, color, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + Rectangle frame = new Rectangle(0, 0, Main.projectileTexture[Projectile.type].Width, Main.projectileTexture[Projectile.type].Height); + spriteBatch.Draw(ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow"), Projectile.Center - Main.screenPosition, frame, color, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0f); } } public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (Projectile.timeLeft < 85) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(Projectile.timeLeft * 3); byte a2 = (byte)(100f * (b2 / 255f)); return new Color(b2, b2, b2, a2); } diff --git a/Projectiles/Typeless/VerstaltiteBobber.cs b/Projectiles/Typeless/VerstaltiteBobber.cs index c2f070140a..0d76c04f97 100644 --- a/Projectiles/Typeless/VerstaltiteBobber.cs +++ b/Projectiles/Typeless/VerstaltiteBobber.cs @@ -15,17 +15,17 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { //projectile.CloneDefaults(360); //Wooden Bobber - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 61; - projectile.bobber = true; - projectile.penetrate = -1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 61; + Projectile.bobber = true; + Projectile.penetrate = -1; } public override bool PreDrawExtras(SpriteBatch spriteBatch) { - Lighting.AddLight(projectile.Center, 0.4f, 0f, 0.4f); - CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType(), new Color(95, 158, 160, 100)); + Lighting.AddLight(Projectile.Center, 0.4f, 0f, 0.4f); + CalamityUtils.DrawFishingLine(Projectile, ModContent.ItemType(), new Color(95, 158, 160, 100)); return false; } } diff --git a/Projectiles/Typeless/WaterConvertor.cs b/Projectiles/Typeless/WaterConvertor.cs index c0781ba45a..a1f4ef853b 100644 --- a/Projectiles/Typeless/WaterConvertor.cs +++ b/Projectiles/Typeless/WaterConvertor.cs @@ -10,23 +10,23 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.penetrate = -1; - projectile.width = 160; - projectile.height = 160; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 10; + Projectile.penetrate = -1; + Projectile.width = 160; + Projectile.height = 160; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 10; } public override void AI() { - ConvertShit(projectile); + ConvertShit(Projectile); } public override void PostAI() { - ConvertShit(projectile); + ConvertShit(Projectile); } public void ConvertShit(Projectile projectile) diff --git a/Projectiles/Typeless/WulfrumBobber.cs b/Projectiles/Typeless/WulfrumBobber.cs index d90a056c1a..94170c03b6 100644 --- a/Projectiles/Typeless/WulfrumBobber.cs +++ b/Projectiles/Typeless/WulfrumBobber.cs @@ -13,16 +13,16 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 61; - projectile.bobber = true; - projectile.penetrate = -1; + Projectile.width = 14; + Projectile.height = 14; + Projectile.aiStyle = 61; + Projectile.bobber = true; + Projectile.penetrate = -1; } public override bool PreDrawExtras(SpriteBatch spriteBatch) { - return projectile.DrawFishingLine(ModContent.ItemType(), new Color(200, 200, 200, 100), 38, 28f); + return Projectile.DrawFishingLine(ModContent.ItemType(), new Color(200, 200, 200, 100), 38, 28f); } } } diff --git a/Projectiles/Typeless/XerocBlast.cs b/Projectiles/Typeless/XerocBlast.cs index a54813179f..2364b0752e 100644 --- a/Projectiles/Typeless/XerocBlast.cs +++ b/Projectiles/Typeless/XerocBlast.cs @@ -16,52 +16,52 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 5; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 5; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.25f / 255f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); bool flag15 = false; bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) { flag15 = true; } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) { flag16 = true; } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) { flag16 = true; } if (flag15 && flag16) { - projectile.Kill(); + Projectile.Kill(); } float num461 = 25f; - if (projectile.ai[0] > 180f) + if (Projectile.ai[0] > 180f) { - num461 -= (projectile.ai[0] - 180f) / 2f; + num461 -= (Projectile.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; - projectile.Kill(); + Projectile.Kill(); } num461 *= 0.7f; - projectile.ai[0] += 4f; + Projectile.ai[0] += 4f; int num462 = 0; while ((float)num462 < num461) { @@ -72,11 +72,11 @@ namespace CalamityMod.Projectiles.Typeless num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 1f); + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num467]; dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; dust.position.X += (float)Main.rand.Next(-10, 11); dust.position.Y += (float)Main.rand.Next(-10, 11); dust.velocity.X = num463; diff --git a/Projectiles/Typeless/XerocBubble.cs b/Projectiles/Typeless/XerocBubble.cs index 1dd98f344d..e831a2ca95 100644 --- a/Projectiles/Typeless/XerocBubble.cs +++ b/Projectiles/Typeless/XerocBubble.cs @@ -13,25 +13,25 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.alpha = 100; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 200; + Projectile.width = 20; + Projectile.height = 20; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 200; } public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 8f, 20f); } } } diff --git a/Projectiles/Typeless/XerocFire.cs b/Projectiles/Typeless/XerocFire.cs index 4f6f55447a..1892649035 100644 --- a/Projectiles/Typeless/XerocFire.cs +++ b/Projectiles/Typeless/XerocFire.cs @@ -13,46 +13,46 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; + Projectile.width = 6; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 180; } public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + Projectile.velocity.X = Projectile.velocity.X * -0.1f; } - if (projectile.velocity.X != projectile.velocity.X) + if (Projectile.velocity.X != Projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.5f; } - if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] > 5f) { - projectile.ai[0] = 5f; - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - projectile.velocity.X *= 0.97f; - if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) + Projectile.velocity.X *= 0.97f; + if (Projectile.velocity.X > -0.01f && Projectile.velocity.X < 0.01f) { - projectile.velocity.X = 0f; - projectile.netUpdate = true; + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.X * 0.1f; if (Main.rand.NextBool(3)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 62, 0f, 0f, 100, default, 0.75f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 0.75f); Dust dust2 = Main.dust[num200]; dust2.position.X -= 2f; dust2.position.Y += 2f; @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Typeless } else { - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 62, 0f, 0f, 100, default, 0.75f); + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 0.75f); Dust dust = Main.dust[num199]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -70,14 +70,14 @@ namespace CalamityMod.Projectiles.Typeless dust.noGravity = true; dust.velocity.Y -= 2f; } - if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) + if (Projectile.velocity.Y < 0.25f && Projectile.velocity.Y > 0.15f) { - projectile.velocity.X *= 0.8f; + Projectile.velocity.X *= 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) + Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) { - projectile.velocity.Y = 16f; + Projectile.velocity.Y = 16f; } } diff --git a/Projectiles/Typeless/XerocOrb.cs b/Projectiles/Typeless/XerocOrb.cs index 0c2bd037d4..6751059f5c 100644 --- a/Projectiles/Typeless/XerocOrb.cs +++ b/Projectiles/Typeless/XerocOrb.cs @@ -15,20 +15,20 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 200; + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 200; } public override void AI() { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 2f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 7f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 7f, 20f); } } } diff --git a/Projectiles/Typeless/XerocStar.cs b/Projectiles/Typeless/XerocStar.cs index dddcc953a2..1d0a408921 100644 --- a/Projectiles/Typeless/XerocStar.cs +++ b/Projectiles/Typeless/XerocStar.cs @@ -14,33 +14,33 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; - projectile.alpha = 100; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 300; + Projectile.width = 20; + Projectile.height = 20; + Projectile.alpha = 100; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; } public override void AI() { - projectile.rotation += 0.25f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + Projectile.rotation += 0.25f; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 2f); + int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 100, default, 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 10f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 200f, 10f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Texture2D tex = Main.projectileTexture[Projectile.type]; + spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0f); return false; } } diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.cs b/Projectiles/Typeless/YanmeisKnifeSlash.cs index cb41d9bd28..80c3b9f4d8 100644 --- a/Projectiles/Typeless/YanmeisKnifeSlash.cs +++ b/Projectiles/Typeless/YanmeisKnifeSlash.cs @@ -9,6 +9,7 @@ using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -36,58 +37,58 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Yanmei's Knife"); - Main.projFrames[projectile.type] = 5; + Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 180; - projectile.height = 96; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ownerHitCheck = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + Projectile.width = 180; + Projectile.height = 96; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ownerHitCheck = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - Player player = Main.player[projectile.owner]; + Player player = Main.player[Projectile.owner]; // Frames and crap - projectile.frameCounter++; - if (projectile.frameCounter % 7 == 0) + Projectile.frameCounter++; + if (Projectile.frameCounter % 7 == 0) { - projectile.frame++; - if (projectile.frame >= Main.projFrames[projectile.type]) - projectile.Kill(); + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.Kill(); } // Create idle light and dust. - Vector2 origin = projectile.Center + projectile.velocity * 3f; + Vector2 origin = Projectile.Center + Projectile.velocity * 3f; Lighting.AddLight(origin, 0f, 1.5f, 0.1f); Vector2 playerRotatedPoint = player.RotatedRelativePoint(player.MountedCenter, true); // Rotation and directioning. - float velocityAngle = projectile.velocity.ToRotation(); - projectile.rotation = velocityAngle + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; - projectile.direction = (Math.Cos(velocityAngle) > 0).ToDirectionInt(); + float velocityAngle = Projectile.velocity.ToRotation(); + Projectile.rotation = velocityAngle + (Projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + Projectile.direction = (Math.Cos(velocityAngle) > 0).ToDirectionInt(); // Positioning close to the end of the player's arm. - projectile.position = playerRotatedPoint - projectile.Size * 0.5f + velocityAngle.ToRotationVector2() * 80f; + Projectile.position = playerRotatedPoint - Projectile.Size * 0.5f + velocityAngle.ToRotationVector2() * 80f; // Sprite and player directioning. - projectile.spriteDirection = projectile.direction; - player.ChangeDir(projectile.direction); + Projectile.spriteDirection = Projectile.direction; + player.ChangeDir(Projectile.direction); // Prevents the projectile from dying - projectile.timeLeft = 2; + Projectile.timeLeft = 2; // Player item-based field manipulation. - player.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); - player.heldProj = projectile.whoAmI; + player.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; } @@ -95,18 +96,18 @@ namespace CalamityMod.Projectiles.Typeless public void HandleAttachmentMovement(Player player, Vector2 playerRotatedPoint) { float speed = 1f; - if (player.ActiveItem().shoot == projectile.type) + if (player.ActiveItem().shoot == Projectile.type) { - speed = player.ActiveItem().shootSpeed * projectile.scale; + speed = player.ActiveItem().shootSpeed * Projectile.scale; } Vector2 newVelocity = (Main.MouseWorld - playerRotatedPoint).SafeNormalize(Vector2.UnitX * player.direction) * speed; // Sync if a velocity component changes. - if (projectile.velocity.X != newVelocity.X || projectile.velocity.Y != newVelocity.Y) + if (Projectile.velocity.X != newVelocity.X || Projectile.velocity.Y != newVelocity.Y) { - projectile.netUpdate = true; + Projectile.netUpdate = true; } - projectile.velocity = newVelocity; + Projectile.velocity = newVelocity; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { @@ -117,7 +118,7 @@ namespace CalamityMod.Projectiles.Typeless { for (int i = 0; i < 60; i++) { - Dust dust = Dust.NewDustDirect(Main.player[projectile.owner].position, Main.player[projectile.owner].width, Main.player[projectile.owner].height, 267); + Dust dust = Dust.NewDustDirect(Main.player[Projectile.owner].position, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height, 267); dust.position.X += Main.rand.NextFloat(-16f, 16f); dust.color = Main.hslToRgb(Main.rand.NextFloat(0.26f, 0.37f), 1f, 0.75f); dust.velocity = Main.rand.NextVector2Circular(24f, 24f); @@ -125,12 +126,12 @@ namespace CalamityMod.Projectiles.Typeless dust.noGravity = true; } } - if (projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/YanmeiKnifeHit"), (int)projectile.position.X, (int)projectile.position.Y); - projectile.ai[0] = 1f; + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/YanmeiKnifeHit"), (int)Projectile.position.X, (int)Projectile.position.Y); + Projectile.ai[0] = 1f; } - Main.player[projectile.owner].AddBuff(ModContent.BuffType(), 600); + Main.player[Projectile.owner].AddBuff(ModContent.BuffType(), 600); } public override Color? GetAlpha(Color lightColor) => new Color(0, 215, 0, 0); } diff --git a/Projectiles/Typeless/YellowLabSeeker.cs b/Projectiles/Typeless/YellowLabSeeker.cs index e60d12ff87..4feb15e5af 100644 --- a/Projectiles/Typeless/YellowLabSeeker.cs +++ b/Projectiles/Typeless/YellowLabSeeker.cs @@ -9,32 +9,32 @@ namespace CalamityMod.Projectiles.Typeless { public class YellowLabSeeker : ModProjectile { - public ref float Time => ref projectile.ai[0]; + public ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Items/LabFinders/YellowSeekingMechanism"; public override void SetStaticDefaults() { DisplayName.SetDefault("Seeking Mechanism"); - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; } public override void SetDefaults() { - projectile.width = projectile.height = 24; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 300; + Projectile.width = Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; } - public override void AI() => RedLabSeeker.Behavior(projectile, CalamityWorld.IceLabCenter, Color.Yellow, ref Time); + public override void AI() => RedLabSeeker.Behavior(Projectile, CalamityWorld.IceLabCenter, Color.Yellow, ref Time); public override void Kill(int timeLeft) { for (int i = 0; i < 8; i++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); dust.color = Color.Yellow; dust.scale = Main.rand.NextFloat(0.95f, 1.25f); dust.velocity = Main.rand.NextVector2Circular(2.5f, 2.5f); @@ -48,13 +48,13 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = Main.projectileTexture[projectile.type]; - if (Time > 80f && projectile.ai[1] == 0f) + Texture2D texture = Main.projectileTexture[Projectile.type]; + if (Time > 80f && Projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) { - Vector2 drawPosition = projectile.Center - projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; - spriteBatch.Draw(texture, drawPosition, null, projectile.GetAlpha(lightColor) * (1f - i / 24f), projectile.rotation, texture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + Vector2 drawPosition = Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.InverseLerp(80f, 125f, Time, true) * 25f - Main.screenPosition; + spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor) * (1f - i / 24f), Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0f); } } return true; diff --git a/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs b/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs index 03ef529b83..4413e8efca 100644 --- a/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs +++ b/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Projectiles.VanillaProjectileOverrides { @@ -43,7 +44,7 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides // Emit life pulses periodically. if (timer % PulseReleaseRate == PulseReleaseRate - 1f) { - Main.PlaySound(SoundID.Item45, projectile.Center); + SoundEngine.PlaySound(SoundID.Item45, projectile.Center); if (Main.myPlayer == projectile.owner) { int pulseDamage = (int)(owner.AverageDamage() * 300f); diff --git a/Schematics/CalamitySchematicIO.cs b/Schematics/CalamitySchematicIO.cs index 88c3f3cd68..9c5280ac9b 100644 --- a/Schematics/CalamitySchematicIO.cs +++ b/Schematics/CalamitySchematicIO.cs @@ -32,13 +32,13 @@ namespace CalamityMod.Schematics bTileHeader2 = t.bTileHeader2; bTileHeader3 = t.bTileHeader3; sTileHeader = t.sTileHeader; - type = t.type; // This is changed later if it's modded - wall = t.wall; // This is changed later if it's modded + type = t.TileType; // This is changed later if it's modded + wall = t.WallType; // This is changed later if it's modded originalType = type; // This is never changed originalWall = wall; // This is never changed liquid = t.liquid; - frameX = t.frameX; - frameY = t.frameY; + frameX = t.TileFrameX; + frameY = t.TileFrameY; keepTile = false; keepWall = false; } @@ -68,7 +68,7 @@ namespace CalamityMod.Schematics else if (keepWall) // wall from original, tile from replacement { target.CopyFrom(replacement); - target.wall = original.wall; + target.WallType = original.WallType; target.wallFrameX(original.wallFrameX()); target.wallFrameY(original.wallFrameY()); target.wallColor(original.wallColor()); @@ -76,7 +76,7 @@ namespace CalamityMod.Schematics else if (keepTile) // tile from original, wall from replacement { target.CopyFrom(original); - target.wall = replacement.wall; + target.WallType = replacement.WallType; target.wallFrameX(replacement.wallFrameX()); target.wallFrameY(replacement.wallFrameY()); target.wallColor(replacement.wallColor()); @@ -170,16 +170,16 @@ namespace CalamityMod.Schematics if (!tileHeadersMatch) return false; - bool typesMatch = t.type == smt.originalType; + bool typesMatch = t.TileType == smt.originalType; if (!typesMatch) return false; - bool wallsMatch = t.wall == smt.originalWall; + bool wallsMatch = t.WallType == smt.originalWall; if (!wallsMatch) return false; - bool framesMatch = t.frameX == smt.frameX; - framesMatch &= t.frameY == smt.frameY; + bool framesMatch = t.TileFrameX == smt.frameX; + framesMatch &= t.TileFrameY == smt.frameY; // Wall frames are not checked separately because these are computed from binary headers. // wallFrameX() => (bTileHeader2 & 0xF) * 36; // wallFrameY() => (bTileHeader3 & 7) * 36; @@ -201,8 +201,8 @@ namespace CalamityMod.Schematics return -1; } - private static string GetFullName(this ModTile mt) => $"{mt.mod.Name}/{mt.Name}"; - private static string GetFullName(this ModWall mw) => $"{mw.mod.Name}/{mw.Name}"; + private static string GetFullName(this ModTile mt) => $"{mt.Mod.Name}/{mt.Name}"; + private static string GetFullName(this ModWall mw) => $"{mw.Mod.Name}/{mw.Name}"; private static void ComputeMetaIndices(ref SchematicData schematic, ref SchematicMetaTile smt) { @@ -455,7 +455,7 @@ namespace CalamityMod.Schematics ModContent.SplitName(tileFullName, out string mod, out string tileName); Mod theMod = ModLoader.GetMod(mod); // If that mod isn't loaded, spawn in a MysteryTile instead. - smt.type = (ushort)(theMod is null ? ModContent.TileType() : theMod.TileType(tileName)); + smt.type = (ushort)(theMod is null ? ModContent.TileType() : theMod.Find(tileName).Type); } } // If this schematic tile has a modded wall, replace the meta index offset with that modded wall's ID. @@ -470,7 +470,7 @@ namespace CalamityMod.Schematics ModContent.SplitName(wallFullName, out string mod, out string wallName); Mod theMod = ModLoader.GetMod(mod); // tModLoader does not have a MysteryWall, so if that mod isn't loaded, this wall will disappear. - smt.wall = (ushort)(theMod is null ? 0 : theMod.WallType(wallName)); + smt.wall = (ushort)(theMod is null ? 0 : theMod.Find(wallName).Type); } } } diff --git a/Schematics/SchematicManager.cs b/Schematics/SchematicManager.cs index 6ca01e2121..1449195e10 100644 --- a/Schematics/SchematicManager.cs +++ b/Schematics/SchematicManager.cs @@ -146,7 +146,7 @@ namespace CalamityMod.Schematics for (int y = 0; y < height; ++y) { Tile t = Main.tile[x + cornerX, y + cornerY]; - if (t.type == TileID.Trees || t.type == TileID.PineTree || t.type == TileID.Cactus) + if (t.TileType == TileID.Trees || t.TileType == TileID.PineTree || t.TileType == TileID.Cactus) WorldGen.KillTile(x + cornerX, y + cornerY); } for (int x = 0; x < width; ++x) @@ -154,7 +154,7 @@ namespace CalamityMod.Schematics originalTiles[x, y] = new Tile(Main.tile[x + cornerX, y + cornerY]); for (int x = 0; x < width; ++x) for (int y = 0; y < height; ++y) - if (originalTiles[x, y].type != TileID.Containers) + if (originalTiles[x, y].TileType != TileID.Containers) WorldGen.KillTile(x + cornerX, y + cornerY); // Lay down the schematic. If the schematic calls for it, bring back tiles that are stored in the old tiles array. @@ -199,12 +199,12 @@ namespace CalamityMod.Schematics return; // Ignore tiles that aren't at the top left of the tile. // All of Calamity's worldgen-placed tile entities refuse to exist except at the top left corner of their host tile. - if (t.frameX != 0 || t.frameY != 0) + if (t.TileFrameX != 0 || t.TileFrameY != 0) return; // This cannot be a switch because switch cases must be compile time constants, which ModContent calls are not. // Therefore the only option is an if-else ladder. - int tileType = t.type; + int tileType = t.TileType; if (tileType == ModContent.TileType()) TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); else if (tileType == ModContent.TileType()) diff --git a/Skies/CryogenSky.cs b/Skies/CryogenSky.cs index d67c777d02..7b152bbf28 100644 --- a/Skies/CryogenSky.cs +++ b/Skies/CryogenSky.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Skies public static bool ShouldDrawRegularly; - internal static Texture2D AuroraTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/AuroraTexture"); + internal static Texture2D AuroraTexture => ModContent.Request("CalamityMod/ExtraTextures/AuroraTexture"); public static void UpdateDrawEligibility() { diff --git a/Skies/ExoMechsSky.cs b/Skies/ExoMechsSky.cs index 7ded899e2c..053a727576 100644 --- a/Skies/ExoMechsSky.cs +++ b/Skies/ExoMechsSky.cs @@ -9,6 +9,7 @@ using Terraria.Graphics; using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Skies { @@ -84,7 +85,7 @@ namespace CalamityMod.Skies if (playSound && !Main.gamePaused) { - var lightningSound = Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), Main.LocalPlayer.Center); + var lightningSound = SoundEngine.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), Main.LocalPlayer.Center); if (lightningSound != null) lightningSound.Volume *= 0.5f; } @@ -119,7 +120,7 @@ namespace CalamityMod.Skies if (!Main.gamePaused) { - var lightningSound = Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), Main.LocalPlayer.Center); + var lightningSound = SoundEngine.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), Main.LocalPlayer.Center); if (lightningSound != null) lightningSound.Volume *= 0.5f; } diff --git a/Skies/SCalSky.cs b/Skies/SCalSky.cs index d0e2978fe8..4e67da6f02 100644 --- a/Skies/SCalSky.cs +++ b/Skies/SCalSky.cs @@ -203,7 +203,7 @@ namespace CalamityMod.Skies } // Draw cinders. - Texture2D cinderTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/CalamitasCinder"); + Texture2D cinderTexture = ModContent.Request("CalamityMod/ExtraTextures/CalamitasCinder"); for (int i = 0; i < Cinders.Count; i++) { Vector2 drawPosition = Cinders[i].Center - Main.screenPosition; diff --git a/TileEntities/TEBaseTurret.cs b/TileEntities/TEBaseTurret.cs index 2a1461bc78..d9c8971778 100644 --- a/TileEntities/TEBaseTurret.cs +++ b/TileEntities/TEBaseTurret.cs @@ -61,7 +61,7 @@ namespace CalamityMod.TileEntities public override bool ValidTile(int i, int j) { Tile tile = Main.tile[i, j]; - return tile.active() && tile.type == TileType; + return tile.active() && tile.TileType == TileType; } #region Update and Turret Behavior @@ -196,7 +196,7 @@ namespace CalamityMod.TileEntities { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = mod.GetPacket(); + ModPacket packet = Mod.GetPacket(); packet.Write((byte)CalamityModMessageType.Turret); packet.Write(ID); packet.Write(FiringTime); diff --git a/TileEntities/TEChargingStation.cs b/TileEntities/TEChargingStation.cs index 042d4be0f6..7d76b673a6 100644 --- a/TileEntities/TEChargingStation.cs +++ b/TileEntities/TEChargingStation.cs @@ -51,7 +51,7 @@ namespace CalamityMod.TileEntities public override bool ValidTile(int i, int j) { Tile tile = Main.tile[i, j]; - return tile.active() && tile.type == ModContent.TileType() && tile.frameX == 0 && tile.frameY == 0; + return tile.active() && tile.TileType == ModContent.TileType() && tile.TileFrameX == 0 && tile.TileFrameY == 0; } public override void Update() @@ -204,7 +204,7 @@ namespace CalamityMod.TileEntities { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = mod.GetPacket(); + ModPacket packet = Mod.GetPacket(); packet.Write((byte)CalamityModMessageType.ChargingStationStandard); packet.Write(ID); packet.Write(ChargingTimer); @@ -269,7 +269,7 @@ namespace CalamityMod.TileEntities { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = mod.GetPacket(1024); + ModPacket packet = Mod.GetPacket(1024); packet.Write((byte)CalamityModMessageType.ChargingStationItemChange); packet.Write(ID); packet.WriteItem(PluggedItem, true); diff --git a/TileEntities/TECodebreaker.cs b/TileEntities/TECodebreaker.cs index 489cb55250..116286ab33 100644 --- a/TileEntities/TECodebreaker.cs +++ b/TileEntities/TECodebreaker.cs @@ -1,4 +1,4 @@ -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.DraedonMisc; using CalamityMod.Tiles.DraedonSummoner; using Microsoft.Xna.Framework; @@ -118,7 +118,7 @@ namespace CalamityMod.TileEntities public override bool ValidTile(int i, int j) { Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); - return tile.active() && tile.type == ModContent.TileType() && tile.frameX == 0 && tile.frameY == 0; + return tile.active() && tile.TileType == ModContent.TileType() && tile.TileFrameX == 0 && tile.TileFrameY == 0; } // This code is called as a hook when the player places the Codebreaker tile so that the tile entity may be placed. @@ -176,7 +176,7 @@ namespace CalamityMod.TileEntities if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = mod.GetPacket(); + ModPacket packet = Mod.GetPacket(); BitsByte containmentFlagWrapper = new BitsByte(); containmentFlagWrapper[0] = ContainsDecryptionComputer; containmentFlagWrapper[1] = ContainsSensorArray; @@ -234,7 +234,7 @@ namespace CalamityMod.TileEntities if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = mod.GetPacket(); + ModPacket packet = Mod.GetPacket(); packet.Write((byte)CalamityModMessageType.UpdateCodebreakerContainedStuff); packet.Write(ID); packet.Write(InputtedCellCount); @@ -274,7 +274,7 @@ namespace CalamityMod.TileEntities if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = mod.GetPacket(); + ModPacket packet = Mod.GetPacket(); packet.Write((byte)CalamityModMessageType.UpdateCodebreakerDecryptCountdown); packet.Write(ID); packet.Write(DecryptionCountdown); diff --git a/TileEntities/TEDraedonLabTurret.cs b/TileEntities/TEDraedonLabTurret.cs index a4d0c76f92..ea8a8c0f39 100644 --- a/TileEntities/TEDraedonLabTurret.cs +++ b/TileEntities/TEDraedonLabTurret.cs @@ -52,7 +52,7 @@ namespace CalamityMod.TileEntities public override bool ValidTile(int i, int j) { Tile tile = Main.tile[i, j]; - return tile.active() && tile.type == TileType && tile.frameX == 0 && tile.frameY == 0; + return tile.active() && tile.TileType == TileType && tile.TileFrameX == 0 && tile.TileFrameY == 0; } protected override Vector2 ChooseTarget(Vector2 targetingCenter) diff --git a/TileEntities/TELabHologramProjector.cs b/TileEntities/TELabHologramProjector.cs index aaaa91d535..d07ed30ccc 100644 --- a/TileEntities/TELabHologramProjector.cs +++ b/TileEntities/TELabHologramProjector.cs @@ -20,7 +20,7 @@ namespace CalamityMod.TileEntities public override bool ValidTile(int i, int j) { Tile tile = Main.tile[i, j]; - return tile.active() && tile.type == ModContent.TileType() && tile.frameX == 0 && tile.frameY == 0; + return tile.active() && tile.TileType == ModContent.TileType() && tile.TileFrameX == 0 && tile.TileFrameY == 0; } // Check if the hologram should become visible. @@ -100,7 +100,7 @@ namespace CalamityMod.TileEntities { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = mod.GetPacket(); + ModPacket packet = Mod.GetPacket(); packet.Write((byte)CalamityModMessageType.LabHologramProjector); packet.Write(ID); packet.Write(PoppingUp); diff --git a/TileEntities/TEPowerCellFactory.cs b/TileEntities/TEPowerCellFactory.cs index 04b91f0f73..db5c7643da 100644 --- a/TileEntities/TEPowerCellFactory.cs +++ b/TileEntities/TEPowerCellFactory.cs @@ -66,13 +66,13 @@ namespace CalamityMod.TileEntities public override bool ValidTile(int i, int j) { Tile tile = Main.tile[i, j]; - return tile.active() && tile.type == ModContent.TileType() && tile.frameX == 0 && tile.frameY == 0; + return tile.active() && tile.TileType == ModContent.TileType() && tile.TileFrameX == 0 && tile.TileFrameY == 0; } public override void Update() { ++Time; - int maxCellStack = ModContent.GetModItem(ModContent.ItemType()).item.maxStack; + int maxCellStack = ModContent.GetModItem(ModContent.ItemType()).Item.maxStack; if (IsCellFrame && CellStack < maxCellStack) // The property setter will automatically send the necessary packet. CellStack++; @@ -149,7 +149,7 @@ namespace CalamityMod.TileEntities { if (Main.netMode == NetmodeID.SinglePlayer) return; - ModPacket packet = mod.GetPacket(); + ModPacket packet = Mod.GetPacket(); packet.Write((byte)CalamityModMessageType.PowerCellFactory); packet.Write(ID); packet.Write(Time); diff --git a/Tiles/Abyss/AbyssGravel.cs b/Tiles/Abyss/AbyssGravel.cs index ee8de41d3a..33c125187a 100644 --- a/Tiles/Abyss/AbyssGravel.cs +++ b/Tiles/Abyss/AbyssGravel.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Abyss { public class AbyssGravel : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/Abyss/AbyssalCrateTile.cs b/Tiles/Abyss/AbyssalCrateTile.cs index 6f0cd81ce7..266b8a9d5b 100644 --- a/Tiles/Abyss/AbyssalCrateTile.cs +++ b/Tiles/Abyss/AbyssalCrateTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Abyss { public class AbyssalCrateTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolidTop[Type] = true; Main.tileLighted[Type] = true; diff --git a/Tiles/Abyss/AbyssalPots.cs b/Tiles/Abyss/AbyssalPots.cs index 343d020e19..23a5d52ecc 100644 --- a/Tiles/Abyss/AbyssalPots.cs +++ b/Tiles/Abyss/AbyssalPots.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Abyss { public class AbyssalPots : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; diff --git a/Tiles/Abyss/AcidWoodTree.cs b/Tiles/Abyss/AcidWoodTree.cs index 619ef91a07..a211093b35 100644 --- a/Tiles/Abyss/AcidWoodTree.cs +++ b/Tiles/Abyss/AcidWoodTree.cs @@ -6,8 +6,8 @@ namespace CalamityMod.Tiles.Abyss { public class AcidWoodTree : ModPalmTree { - public override Texture2D GetTopTextures() => ModContent.GetTexture("CalamityMod/Tiles/Abyss/AcidWoodTreeTops"); - public override Texture2D GetTexture() => ModContent.GetTexture("CalamityMod/Tiles/Abyss/AcidWoodTree"); + public override Texture2D GetTopTextures() => ModContent.Request("CalamityMod/Tiles/Abyss/AcidWoodTreeTops"); + public override Texture2D GetTexture() => ModContent.Request("CalamityMod/Tiles/Abyss/AcidWoodTree"); public override int DropWood() => ModContent.ItemType(); public override int CreateDust() => (int)CalamityDusts.SulfurousSeaAcid; } diff --git a/Tiles/Abyss/AcidWoodTreeSapling.cs b/Tiles/Abyss/AcidWoodTreeSapling.cs index 5b11e68f0b..ef2b3514d2 100644 --- a/Tiles/Abyss/AcidWoodTreeSapling.cs +++ b/Tiles/Abyss/AcidWoodTreeSapling.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.Abyss //All of this code is taken directly from Example Mod. //Cheers Blushie - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; @@ -54,7 +54,7 @@ namespace CalamityMod.Tiles.Abyss if (WorldGen.genRand.Next(20) == 0) { int trueStartingPositionY = j; - while (TileLoader.IsSapling((int)Main.tile[i, trueStartingPositionY].type)) + while (TileLoader.IsSapling((int)Main.tile[i, trueStartingPositionY].TileType)) { trueStartingPositionY++; } @@ -64,7 +64,7 @@ namespace CalamityMod.Tiles.Abyss { return; } - if (tileAbovePosition.wall != 0 || tileAbovePosition.liquid != 0) + if (tileAbovePosition.WallType != 0 || tileAbovePosition.liquid != 0) { return; } @@ -82,16 +82,16 @@ namespace CalamityMod.Tiles.Abyss if (k == 0) { tileAtPosition.active(true); - tileAtPosition.type = TileID.PalmTree; - tileAtPosition.frameX = 66; - tileAtPosition.frameY = 0; + tileAtPosition.TileType = TileID.PalmTree; + tileAtPosition.TileFrameX = 66; + tileAtPosition.TileFrameY = 0; } else if (k == treeHeight - 1) { tileAtPosition.active(true); - tileAtPosition.type = TileID.PalmTree; - tileAtPosition.frameX = (short)(22 * WorldGen.genRand.Next(4, 7)); - tileAtPosition.frameY = frameY; + tileAtPosition.TileType = TileID.PalmTree; + tileAtPosition.TileFrameX = (short)(22 * WorldGen.genRand.Next(4, 7)); + tileAtPosition.TileFrameY = frameY; } else { @@ -105,9 +105,9 @@ namespace CalamityMod.Tiles.Abyss } } tileAtPosition.active(true); - tileAtPosition.type = TileID.PalmTree; - tileAtPosition.frameX = (short)(22 * WorldGen.genRand.Next(0, 3)); - tileAtPosition.frameY = frameY; + tileAtPosition.TileType = TileID.PalmTree; + tileAtPosition.TileFrameX = (short)(22 * WorldGen.genRand.Next(0, 3)); + tileAtPosition.TileFrameY = frameY; } } bool isPlayerNear = WorldGen.PlayerLOS(i, j); diff --git a/Tiles/Abyss/AcidwoodTile.cs b/Tiles/Abyss/AcidwoodTile.cs index a82d90d8c7..8412734377 100644 --- a/Tiles/Abyss/AcidwoodTile.cs +++ b/Tiles/Abyss/AcidwoodTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Abyss { public class AcidwoodTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; diff --git a/Tiles/Abyss/HardenedSulphurousSandstone.cs b/Tiles/Abyss/HardenedSulphurousSandstone.cs index 1be7d6246a..fac6032645 100644 --- a/Tiles/Abyss/HardenedSulphurousSandstone.cs +++ b/Tiles/Abyss/HardenedSulphurousSandstone.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.Abyss { public class HardenedSulphurousSandstone : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -29,7 +29,7 @@ namespace CalamityMod.Tiles.Abyss public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { if (CalamityUtils.ParanoidTileRetrieval(i, j + 1).active() && - CalamityUtils.ParanoidTileRetrieval(i, j + 1).type == (ushort)ModContent.TileType()) + CalamityUtils.ParanoidTileRetrieval(i, j + 1).TileType == (ushort)ModContent.TileType()) { WorldGen.KillTile(i, j + 1); } @@ -50,7 +50,7 @@ namespace CalamityMod.Tiles.Abyss if (WorldGen.InWorld(x, y)) { if (CalamityUtils.ParanoidTileRetrieval(x, y).active() && - CalamityUtils.ParanoidTileRetrieval(x, y).type == (ushort)ModContent.TileType()) + CalamityUtils.ParanoidTileRetrieval(x, y).TileType == (ushort)ModContent.TileType()) { nearbyVineCount++; } @@ -59,7 +59,7 @@ namespace CalamityMod.Tiles.Abyss } if (Main.tile[i, j + 1] != null && nearbyVineCount < 5) { - if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)ModContent.TileType()) + if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].TileType != (ushort)ModContent.TileType()) { if (Main.tile[i, j + 1].liquid == 255 && !Main.tile[i, j + 1].lava()) @@ -82,7 +82,7 @@ namespace CalamityMod.Tiles.Abyss { int num53 = i; int num54 = j + 1; - Main.tile[num53, num54].type = (ushort)ModContent.TileType(); + Main.tile[num53, num54].TileType = (ushort)ModContent.TileType(); Main.tile[num53, num54].active(true); WorldGen.SquareTileFrame(num53, num54, true); if (Main.netMode == NetmodeID.Server) diff --git a/Tiles/Abyss/LumenylCrystals.cs b/Tiles/Abyss/LumenylCrystals.cs index f4cc95c989..3131743fcf 100644 --- a/Tiles/Abyss/LumenylCrystals.cs +++ b/Tiles/Abyss/LumenylCrystals.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Abyss { public class LumenylCrystals : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileNoFail[Type] = true; @@ -52,23 +52,23 @@ namespace CalamityMod.Tiles.Abyss public override void PlaceInWorld(int i, int j, Item item) { - if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) + if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].TileType] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) { - Main.tile[i, j].frameY = (short)(0 * 18); + Main.tile[i, j].TileFrameY = (short)(0 * 18); } - else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) + else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].TileType] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) { - Main.tile[i, j].frameY = (short)(1 * 18); + Main.tile[i, j].TileFrameY = (short)(1 * 18); } - else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) + else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].TileType] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) { - Main.tile[i, j].frameY = (short)(2 * 18); + Main.tile[i, j].TileFrameY = (short)(2 * 18); } - else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) + else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].TileType] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) { - Main.tile[i, j].frameY = (short)(3 * 18); + Main.tile[i, j].TileFrameY = (short)(3 * 18); } - Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); + Main.tile[i, j].TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); } } } diff --git a/Tiles/Abyss/PlantyMush.cs b/Tiles/Abyss/PlantyMush.cs index 4d518bfb95..331861c31c 100644 --- a/Tiles/Abyss/PlantyMush.cs +++ b/Tiles/Abyss/PlantyMush.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Abyss { public class PlantyMush : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -48,10 +48,10 @@ namespace CalamityMod.Tiles.Abyss int num8 = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); if (Main.tile[i, j + 1] != null) { - if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)ModContent.TileType()) + if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].TileType != (ushort)ModContent.TileType()) { if (Main.tile[i, j + 1].liquid == 255 && - Main.tile[i, j + 1].wall == (ushort)ModContent.WallType() && + Main.tile[i, j + 1].WallType == (ushort)ModContent.WallType() && !Main.tile[i, j + 1].lava()) { bool flag13 = false; @@ -72,7 +72,7 @@ namespace CalamityMod.Tiles.Abyss { int num53 = i; int num54 = j + 1; - Main.tile[num53, num54].type = (ushort)ModContent.TileType(); + Main.tile[num53, num54].TileType = (ushort)ModContent.TileType(); Main.tile[num53, num54].active(true); WorldGen.SquareTileFrame(num53, num54, true); if (Main.netMode == NetmodeID.Server) diff --git a/Tiles/Abyss/RustyChestTile.cs b/Tiles/Abyss/RustyChestTile.cs index 1459eb9784..7895740068 100644 --- a/Tiles/Abyss/RustyChestTile.cs +++ b/Tiles/Abyss/RustyChestTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Abyss { public class RustyChestTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(); ModTranslation name = CreateMapEntryName(); @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.Abyss Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.ChestRightClick(i, j); } diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite1.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite1.cs index f493fb19c7..fce60b595a 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalacmite1.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite1.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite { public class SulphurousStalacmite1 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite2.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite2.cs index 86a7bc67cb..bf9057742e 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalacmite2.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite2.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite { public class SulphurousStalacmite2 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite3.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite3.cs index f8eaf5faf7..5974be86b5 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalacmite3.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite3.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite { public class SulphurousStalacmite3 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite4.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite4.cs index d9179447e0..c5db6ec0b7 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalacmite4.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite4.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite { public class SulphurousStalacmite4 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite5.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite5.cs index 717095abd1..09fe2cbb57 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalacmite5.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite5.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite { public class SulphurousStalacmite5 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/Stalactite/SulphurousStalacmite6.cs b/Tiles/Abyss/Stalactite/SulphurousStalacmite6.cs index 14473333d9..8d25a27d11 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalacmite6.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalacmite6.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite { public class SulphurousStalacmite6 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite1.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite1.cs index b2e78e9eca..78f99ae02b 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalactite1.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite1.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite { public class SulphurousStalactite1 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite2.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite2.cs index 15e77505a2..03d5ab192f 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalactite2.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite2.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite { public class SulphurousStalactite2 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite3.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite3.cs index 5dee77e334..20e319e030 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalactite3.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite3.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite { public class SulphurousStalactite3 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite4.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite4.cs index 5eecdf57fb..5a25c52785 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalactite4.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite4.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite { public class SulphurousStalactite4 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite5.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite5.cs index 0902142cd8..718d9f2dca 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalactite5.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite5.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite { public class SulphurousStalactite5 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/Stalactite/SulphurousStalactite6.cs b/Tiles/Abyss/Stalactite/SulphurousStalactite6.cs index 913d7117ae..e04c6c6d86 100644 --- a/Tiles/Abyss/Stalactite/SulphurousStalactite6.cs +++ b/Tiles/Abyss/Stalactite/SulphurousStalactite6.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss.Stalactite { public class SulphurousStalactite6 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/SteamGeyser.cs b/Tiles/Abyss/SteamGeyser.cs index 5838c8ccb7..2472a621da 100644 --- a/Tiles/Abyss/SteamGeyser.cs +++ b/Tiles/Abyss/SteamGeyser.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss { public class SteamGeyser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; diff --git a/Tiles/Abyss/SulphuricFossil1.cs b/Tiles/Abyss/SulphuricFossil1.cs index cef3f99cc3..a9a7796d2f 100644 --- a/Tiles/Abyss/SulphuricFossil1.cs +++ b/Tiles/Abyss/SulphuricFossil1.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Abyss { public class SulphuricFossil1 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Abyss/SulphuricFossil2.cs b/Tiles/Abyss/SulphuricFossil2.cs index 1dfc116c73..f2335d81c5 100644 --- a/Tiles/Abyss/SulphuricFossil2.cs +++ b/Tiles/Abyss/SulphuricFossil2.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Abyss { public class SulphuricFossil2 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Abyss/SulphuricFossil3.cs b/Tiles/Abyss/SulphuricFossil3.cs index 2a0bf68f7a..0468a2762d 100644 --- a/Tiles/Abyss/SulphuricFossil3.cs +++ b/Tiles/Abyss/SulphuricFossil3.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Abyss { public class SulphuricFossil3 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Abyss/SulphurousCactus.cs b/Tiles/Abyss/SulphurousCactus.cs index f517239b1a..aae13e63b0 100644 --- a/Tiles/Abyss/SulphurousCactus.cs +++ b/Tiles/Abyss/SulphurousCactus.cs @@ -5,6 +5,6 @@ namespace CalamityMod.Tiles.Abyss { public class SulphurousCactus : ModCactus { - public override Texture2D GetTexture() => ModContent.GetTexture("CalamityMod/Tiles/Abyss/SulphurousCactus"); + public override Texture2D GetTexture() => ModContent.Request("CalamityMod/Tiles/Abyss/SulphurousCactus"); } } diff --git a/Tiles/Abyss/SulphurousColumn.cs b/Tiles/Abyss/SulphurousColumn.cs index 1a7164e41b..d262b9666f 100644 --- a/Tiles/Abyss/SulphurousColumn.cs +++ b/Tiles/Abyss/SulphurousColumn.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss { public class SulphurousColumn : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; @@ -46,7 +46,7 @@ namespace CalamityMod.Tiles.Abyss { Gore.NewGore(new Vector2(i, j) * 16f, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * WorldGen.genRand.NextFloat(1.4f, 3.2f), - mod.GetGoreSlot($"Gores/SulphSeaGen/SulphurousRockGore{WorldGen.genRand.Next(3) + 1}")); + Mod.GetGoreSlot($"Gores/SulphSeaGen/SulphurousRockGore{WorldGen.genRand.Next(3) + 1}")); } } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Abyss/SulphurousPots.cs b/Tiles/Abyss/SulphurousPots.cs index e5cabdfa7b..7cd6a27a7d 100644 --- a/Tiles/Abyss/SulphurousPots.cs +++ b/Tiles/Abyss/SulphurousPots.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Abyss { public class SulphurousPots : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; diff --git a/Tiles/Abyss/SulphurousRib1.cs b/Tiles/Abyss/SulphurousRib1.cs index 3afa1a24d0..8c9c9f1ad4 100644 --- a/Tiles/Abyss/SulphurousRib1.cs +++ b/Tiles/Abyss/SulphurousRib1.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss { public class SulphurousRib1 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/SulphurousRib2.cs b/Tiles/Abyss/SulphurousRib2.cs index 7fd43d1493..86f401af55 100644 --- a/Tiles/Abyss/SulphurousRib2.cs +++ b/Tiles/Abyss/SulphurousRib2.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss { public class SulphurousRib2 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/SulphurousRib3.cs b/Tiles/Abyss/SulphurousRib3.cs index a667bf2aed..94ae4bcff4 100644 --- a/Tiles/Abyss/SulphurousRib3.cs +++ b/Tiles/Abyss/SulphurousRib3.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss { public class SulphurousRib3 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/SulphurousRib4.cs b/Tiles/Abyss/SulphurousRib4.cs index d2f36f5f54..2eaef462cf 100644 --- a/Tiles/Abyss/SulphurousRib4.cs +++ b/Tiles/Abyss/SulphurousRib4.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss { public class SulphurousRib4 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/SulphurousRib5.cs b/Tiles/Abyss/SulphurousRib5.cs index 7677f76700..29b4747c15 100644 --- a/Tiles/Abyss/SulphurousRib5.cs +++ b/Tiles/Abyss/SulphurousRib5.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss { public class SulphurousRib5 : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 1; diff --git a/Tiles/Abyss/SulphurousSand.cs b/Tiles/Abyss/SulphurousSand.cs index 4b71230ae7..bbbf3d4902 100644 --- a/Tiles/Abyss/SulphurousSand.cs +++ b/Tiles/Abyss/SulphurousSand.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Abyss { public class SulphurousSand : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -117,7 +117,7 @@ namespace CalamityMod.Tiles.Abyss public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { if (CalamityUtils.ParanoidTileRetrieval(i, j + 1).active() && - CalamityUtils.ParanoidTileRetrieval(i, j + 1).type == (ushort)ModContent.TileType()) + CalamityUtils.ParanoidTileRetrieval(i, j + 1).TileType == (ushort)ModContent.TileType()) { WorldGen.KillTile(i, j + 1); } @@ -147,7 +147,7 @@ namespace CalamityMod.Tiles.Abyss { for (int m = tileLocationY - num13; m <= tileLocationY + num13; m++) { - if (Main.tile[l, m].active() && Main.tile[l, m].type == 81) + if (Main.tile[l, m].active() && Main.tile[l, m].TileType == 81) { num15++; } @@ -173,7 +173,7 @@ namespace CalamityMod.Tiles.Abyss { for (int m = tileLocationY - num13; m <= tileLocationY + num13; m++) { - if (Main.tile[l, m].active() && Main.tile[l, m].type == 324) + if (Main.tile[l, m].active() && Main.tile[l, m].TileType == 324) { num15++; } @@ -202,7 +202,7 @@ namespace CalamityMod.Tiles.Abyss if (WorldGen.InWorld(x, y)) { if (CalamityUtils.ParanoidTileRetrieval(x, y).active() && - CalamityUtils.ParanoidTileRetrieval(x, y).type == (ushort)ModContent.TileType()) + CalamityUtils.ParanoidTileRetrieval(x, y).TileType == (ushort)ModContent.TileType()) { nearbyVineCount++; } @@ -211,7 +211,7 @@ namespace CalamityMod.Tiles.Abyss } if (Main.tile[i, j + 1] != null && nearbyVineCount < 5) { - if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)ModContent.TileType()) + if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].TileType != (ushort)ModContent.TileType()) { if (Main.tile[i, j + 1].liquid == 255 && !Main.tile[i, j + 1].lava()) @@ -234,7 +234,7 @@ namespace CalamityMod.Tiles.Abyss { int num53 = i; int num54 = j + 1; - Main.tile[num53, num54].type = (ushort)ModContent.TileType(); + Main.tile[num53, num54].TileType = (ushort)ModContent.TileType(); Main.tile[num53, num54].active(true); WorldGen.SquareTileFrame(num53, num54, true); if (Main.netMode == NetmodeID.Server) diff --git a/Tiles/Abyss/SulphurousSandNoWater.cs b/Tiles/Abyss/SulphurousSandNoWater.cs index f760ff8e59..4bd20adbea 100644 --- a/Tiles/Abyss/SulphurousSandNoWater.cs +++ b/Tiles/Abyss/SulphurousSandNoWater.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.Abyss { public class SulphurousSandNoWater : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/Abyss/SulphurousSandstone.cs b/Tiles/Abyss/SulphurousSandstone.cs index d6f296f702..2fbc6ea0e0 100644 --- a/Tiles/Abyss/SulphurousSandstone.cs +++ b/Tiles/Abyss/SulphurousSandstone.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.Abyss { public class SulphurousSandstone : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -29,7 +29,7 @@ namespace CalamityMod.Tiles.Abyss public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { if (CalamityUtils.ParanoidTileRetrieval(i, j + 1).active() && - CalamityUtils.ParanoidTileRetrieval(i, j + 1).type == (ushort)ModContent.TileType()) + CalamityUtils.ParanoidTileRetrieval(i, j + 1).TileType == (ushort)ModContent.TileType()) { WorldGen.KillTile(i, j + 1); } @@ -50,7 +50,7 @@ namespace CalamityMod.Tiles.Abyss if (WorldGen.InWorld(x, y)) { if (CalamityUtils.ParanoidTileRetrieval(x, y).active() && - CalamityUtils.ParanoidTileRetrieval(x, y).type == (ushort)ModContent.TileType()) + CalamityUtils.ParanoidTileRetrieval(x, y).TileType == (ushort)ModContent.TileType()) { nearbyVineCount++; } @@ -59,7 +59,7 @@ namespace CalamityMod.Tiles.Abyss } if (Main.tile[i, j + 1] != null && nearbyVineCount < 5) { - if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)ModContent.TileType()) + if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].TileType != (ushort)ModContent.TileType()) { if (Main.tile[i, j + 1].liquid == 255 && !Main.tile[i, j + 1].lava()) @@ -82,7 +82,7 @@ namespace CalamityMod.Tiles.Abyss { int num53 = i; int num54 = j + 1; - Main.tile[num53, num54].type = (ushort)ModContent.TileType(); + Main.tile[num53, num54].TileType = (ushort)ModContent.TileType(); Main.tile[num53, num54].active(true); WorldGen.SquareTileFrame(num53, num54, true); if (Main.netMode == NetmodeID.Server) diff --git a/Tiles/Abyss/SulphurousVines.cs b/Tiles/Abyss/SulphurousVines.cs index f8e00d88c2..24173d7f02 100644 --- a/Tiles/Abyss/SulphurousVines.cs +++ b/Tiles/Abyss/SulphurousVines.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.Abyss { public class SulphurousVines : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileCut[Type] = true; @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.Abyss { if (Main.tile[i, j + 1].active()) { - if (Main.tile[i, j + 1].type == ModContent.TileType()) + if (Main.tile[i, j + 1].TileType == ModContent.TileType()) { WorldGen.KillTile(i, j + 1, false, false, false); if (!Main.tile[i, j + 1].active() && Main.netMode != NetmodeID.SinglePlayer) @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles.Abyss { if (Main.tile[i, j + 1] != null) { - if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)ModContent.TileType()) + if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].TileType != (ushort)ModContent.TileType()) { if (Main.tile[i, j + 1].liquid >= 128 && !Main.tile[i, j + 1].lava()) { @@ -75,11 +75,11 @@ namespace CalamityMod.Tiles.Abyss { int num53 = i; int num54 = j + 1; - Main.tile[num53, num54].type = (ushort)ModContent.TileType(); - Main.tile[num53, num54].frameX = (short)(WorldGen.genRand.Next(8) * 18); - Main.tile[num53, num54].frameY = (short)(4 * 18); - Main.tile[num53, num54 - 1].frameX = (short)(WorldGen.genRand.Next(12) * 18); - Main.tile[num53, num54 - 1].frameY = (short)(WorldGen.genRand.Next(4) * 18); + Main.tile[num53, num54].TileType = (ushort)ModContent.TileType(); + Main.tile[num53, num54].TileFrameX = (short)(WorldGen.genRand.Next(8) * 18); + Main.tile[num53, num54].TileFrameY = (short)(4 * 18); + Main.tile[num53, num54 - 1].TileFrameX = (short)(WorldGen.genRand.Next(12) * 18); + Main.tile[num53, num54 - 1].TileFrameY = (short)(WorldGen.genRand.Next(4) * 18); Main.tile[num53, num54].active(true); WorldGen.SquareTileFrame(num53, num54, true); WorldGen.SquareTileFrame(num53, num54 - 1, true); diff --git a/Tiles/Abyss/Tenebris.cs b/Tiles/Abyss/Tenebris.cs index 26a1c31a63..e2c1f508ea 100644 --- a/Tiles/Abyss/Tenebris.cs +++ b/Tiles/Abyss/Tenebris.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.Abyss { public class Tenebris : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; diff --git a/Tiles/Abyss/ViperVines.cs b/Tiles/Abyss/ViperVines.cs index 4143805eb9..0e82646c47 100644 --- a/Tiles/Abyss/ViperVines.cs +++ b/Tiles/Abyss/ViperVines.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.Abyss { public class ViperVines : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileCut[Type] = true; Main.tileBlockLight[Type] = true; @@ -36,7 +36,7 @@ namespace CalamityMod.Tiles.Abyss { if (Main.tile[i, j + 1].active()) { - if (Main.tile[i, j + 1].type == ModContent.TileType()) + if (Main.tile[i, j + 1].TileType == ModContent.TileType()) { WorldGen.KillTile(i, j + 1, false, false, false); if (!Main.tile[i, j + 1].active() && Main.netMode != NetmodeID.SinglePlayer) @@ -52,7 +52,7 @@ namespace CalamityMod.Tiles.Abyss { if (Main.tile[i, j + 1] != null) { - if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)ModContent.TileType()) + if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].TileType != (ushort)ModContent.TileType()) { if (Main.tile[i, j + 1].liquid >= 128 && !Main.tile[i, j + 1].lava()) { @@ -74,11 +74,11 @@ namespace CalamityMod.Tiles.Abyss { int num53 = i; int num54 = j + 1; - Main.tile[num53, num54].type = (ushort)ModContent.TileType(); - Main.tile[num53, num54].frameX = (short)(WorldGen.genRand.Next(8) * 18); - Main.tile[num53, num54].frameY = (short)(4 * 18); - Main.tile[num53, num54 - 1].frameX = (short)(WorldGen.genRand.Next(12) * 18); - Main.tile[num53, num54 - 1].frameY = (short)(WorldGen.genRand.Next(4) * 18); + Main.tile[num53, num54].TileType = (ushort)ModContent.TileType(); + Main.tile[num53, num54].TileFrameX = (short)(WorldGen.genRand.Next(8) * 18); + Main.tile[num53, num54].TileFrameY = (short)(4 * 18); + Main.tile[num53, num54 - 1].TileFrameX = (short)(WorldGen.genRand.Next(12) * 18); + Main.tile[num53, num54 - 1].TileFrameY = (short)(WorldGen.genRand.Next(4) * 18); Main.tile[num53, num54].active(true); WorldGen.SquareTileFrame(num53, num54, true); WorldGen.SquareTileFrame(num53, num54 - 1, true); diff --git a/Tiles/Abyss/Voidstone.cs b/Tiles/Abyss/Voidstone.cs index 9b311aa544..ec14d93b4f 100644 --- a/Tiles/Abyss/Voidstone.cs +++ b/Tiles/Abyss/Voidstone.cs @@ -10,10 +10,10 @@ namespace CalamityMod.Tiles.Abyss public class Voidstone : ModTile { internal static Texture2D GlowTexture; - public override void SetDefaults() + public override void SetStaticDefaults() { if (!Main.dedServ) - GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/Abyss/Voidstone_Glowmask"); + GlowTexture = ModContent.Request("CalamityMod/Tiles/Abyss/Voidstone_Glowmask"); Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -138,8 +138,8 @@ namespace CalamityMod.Tiles.Abyss if (GlowTexture is null) return; - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; int xOffset = 0; int relativeXPos = i % 4; int relativeYPos = j % 4; diff --git a/Tiles/AerialiteBarTile.cs b/Tiles/AerialiteBarTile.cs index 222aa95d8a..1f6cbe0fa1 100644 --- a/Tiles/AerialiteBarTile.cs +++ b/Tiles/AerialiteBarTile.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles { public class AerialiteBarTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBar(new Color(141, 232, 246)); dustType = 187; diff --git a/Tiles/AerialiteBrick.cs b/Tiles/AerialiteBrick.cs index 6dae292b4c..d1d79ddd84 100644 --- a/Tiles/AerialiteBrick.cs +++ b/Tiles/AerialiteBrick.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles { public class AerialiteBrick : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/ArenaTile.cs b/Tiles/ArenaTile.cs index d5fb99356a..3d85dbe92d 100644 --- a/Tiles/ArenaTile.cs +++ b/Tiles/ArenaTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles { public class ArenaTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; diff --git a/Tiles/Astral/AstralBeacon.cs b/Tiles/Astral/AstralBeacon.cs index 9a2a23148f..a92ce66a8d 100644 --- a/Tiles/Astral/AstralBeacon.cs +++ b/Tiles/Astral/AstralBeacon.cs @@ -9,6 +9,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ObjectData; +using Terraria.Audio; namespace CalamityMod.Tiles.Astral { @@ -17,7 +18,7 @@ namespace CalamityMod.Tiles.Astral public const int Width = 5; public const int Height = 4; public static readonly Color FailColor = new Color(237, 93, 83); - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; @@ -44,12 +45,12 @@ namespace CalamityMod.Tiles.Astral Item.NewItem(i * 16, j * 16, Width * 16, Height * 16, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { Tile tile = Main.tile[i, j]; - int left = i - tile.frameX / 18; - int top = j - tile.frameY / 18; + int left = i - tile.TileFrameX / 18; + int top = j - tile.TileFrameY / 18; if (!Main.LocalPlayer.HasItem(ModContent.ItemType()) && !Main.LocalPlayer.HasItem(ModContent.ItemType())) @@ -72,7 +73,7 @@ namespace CalamityMod.Tiles.Astral Vector2 ritualSpawnPosition = new Vector2(left + Width / 2, top).ToWorldCoordinates(); ritualSpawnPosition += new Vector2(0f, -24f); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconUse"), ritualSpawnPosition); + SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconUse"), ritualSpawnPosition); Projectile.NewProjectile(ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, usingStarcore.ToInt()); if (!usingStarcore) diff --git a/Tiles/Astral/AstralChestLocked.cs b/Tiles/Astral/AstralChestLocked.cs index dd49aa368d..e94c1827ff 100644 --- a/Tiles/Astral/AstralChestLocked.cs +++ b/Tiles/Astral/AstralChestLocked.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralChestLocked : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(); @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.Astral public override bool HasSmartInteract() => true; - public override bool IsLockedChest(int i, int j) => Main.tile[i, j].frameX / 36 == 1; + public override bool IsLockedChest(int i, int j) => Main.tile[i, j].TileFrameX / 36 == 1; public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) { @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.Astral return true; } - public override ushort GetMapOption(int i, int j) => (ushort)(Main.tile[i, j].frameX / 36); + public override ushort GetMapOption(int i, int j) => (ushort)(Main.tile[i, j].TileFrameX / 36); public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); @@ -58,18 +58,18 @@ namespace CalamityMod.Tiles.Astral Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { Tile tile = Main.tile[i, j]; int left = i; int top = j; - if (tile.frameX % 36 != 0) + if (tile.TileFrameX % 36 != 0) { left--; } - if (tile.frameY != 0) + if (tile.TileFrameY != 0) { top--; } diff --git a/Tiles/Astral/AstralClay.cs b/Tiles/Astral/AstralClay.cs index f96309ea44..004b8dd514 100644 --- a/Tiles/Astral/AstralClay.cs +++ b/Tiles/Astral/AstralClay.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralClay : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/Astral/AstralCrateTile.cs b/Tiles/Astral/AstralCrateTile.cs index 9b962de188..16430b60e0 100644 --- a/Tiles/Astral/AstralCrateTile.cs +++ b/Tiles/Astral/AstralCrateTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralCrateTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolidTop[Type] = true; Main.tileLighted[Type] = true; diff --git a/Tiles/Astral/AstralDirt.cs b/Tiles/Astral/AstralDirt.cs index 84eac815ac..a59acf1082 100644 --- a/Tiles/Astral/AstralDirt.cs +++ b/Tiles/Astral/AstralDirt.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralDirt : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.Astral Tile down = Main.tile[i, j + 1]; Tile left = Main.tile[i - 1, j]; Tile right = Main.tile[i + 1, j]; - if (WorldGen.genRand.Next(3) == 0 && (up.type == ModContent.TileType() || down.type == ModContent.TileType() || left.type == ModContent.TileType() || right.type == ModContent.TileType())) + if (WorldGen.genRand.Next(3) == 0 && (up.TileType == ModContent.TileType() || down.TileType == ModContent.TileType() || left.TileType == ModContent.TileType() || right.TileType == ModContent.TileType())) { WorldGen.SpreadGrass(i, j, Type, ModContent.TileType(), false); } diff --git a/Tiles/Astral/AstralGrass.cs b/Tiles/Astral/AstralGrass.cs index 2e34f8987e..5b74546ddb 100644 --- a/Tiles/Astral/AstralGrass.cs +++ b/Tiles/Astral/AstralGrass.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralGrass : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.Astral { if (fail && !effectOnly) { - Main.tile[i, j].type = (ushort)ModContent.TileType(); + Main.tile[i, j].TileType = (ushort)ModContent.TileType(); } } diff --git a/Tiles/Astral/AstralMonolith.cs b/Tiles/Astral/AstralMonolith.cs index 718b189222..f49fe3a798 100644 --- a/Tiles/Astral/AstralMonolith.cs +++ b/Tiles/Astral/AstralMonolith.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.Astral private static int sheetWidth = 216; private static int sheetHeight = 72; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -65,11 +65,11 @@ namespace CalamityMod.Tiles.Astral xOffset *= sheetWidth; yOffset *= sheetHeight; - int xPos = tile.frameX; - int yPos = tile.frameY; + int xPos = tile.TileFrameX; + int yPos = tile.TileFrameY; xPos += xOffset; yPos += yOffset; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Astral/AstralMonolithGlow"); + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Astral/AstralMonolithGlow"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); diff --git a/Tiles/Astral/AstralNormalLargePiles.cs b/Tiles/Astral/AstralNormalLargePiles.cs index 6305c78522..26c789ddfe 100644 --- a/Tiles/Astral/AstralNormalLargePiles.cs +++ b/Tiles/Astral/AstralNormalLargePiles.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralNormalLargePiles : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; diff --git a/Tiles/Astral/AstralNormalMediumPiles.cs b/Tiles/Astral/AstralNormalMediumPiles.cs index 13c9ad7197..97b7569609 100644 --- a/Tiles/Astral/AstralNormalMediumPiles.cs +++ b/Tiles/Astral/AstralNormalMediumPiles.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralNormalMediumPiles : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; diff --git a/Tiles/Astral/AstralNormalSmallPiles.cs b/Tiles/Astral/AstralNormalSmallPiles.cs index 7e38372873..cdde3ea1b4 100644 --- a/Tiles/Astral/AstralNormalSmallPiles.cs +++ b/Tiles/Astral/AstralNormalSmallPiles.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralNormalSmallPiles : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; diff --git a/Tiles/Astral/AstralNormalStalactite.cs b/Tiles/Astral/AstralNormalStalactite.cs index 8b27115871..5054017027 100644 --- a/Tiles/Astral/AstralNormalStalactite.cs +++ b/Tiles/Astral/AstralNormalStalactite.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralNormalStalactite : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; @@ -25,11 +25,11 @@ namespace CalamityMod.Tiles.Astral public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height) { Tile tile = Main.tile[i, j]; - if (tile.frameY <= 18 || tile.frameY == 72) + if (tile.TileFrameY <= 18 || tile.TileFrameY == 72) { offsetY = -2; } - else if ((tile.frameY >= 36 && tile.frameY <= 54) || tile.frameY == 90) + else if ((tile.TileFrameY >= 36 && tile.TileFrameY <= 54) || tile.TileFrameY == 90) { offsetY = 2; } diff --git a/Tiles/Astral/AstralShortPlants.cs b/Tiles/Astral/AstralShortPlants.cs index d27e3e6627..f5b6b99f51 100644 --- a/Tiles/Astral/AstralShortPlants.cs +++ b/Tiles/Astral/AstralShortPlants.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralShortPlants : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileCut[Type] = true; Main.tileSolid[Type] = false; diff --git a/Tiles/Astral/AstralSilt.cs b/Tiles/Astral/AstralSilt.cs index 2c8daae3a7..63a254d611 100644 --- a/Tiles/Astral/AstralSilt.cs +++ b/Tiles/Astral/AstralSilt.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralSilt : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/Astral/AstralStone.cs b/Tiles/Astral/AstralStone.cs index 170fbdc0f1..b3550f9ce5 100644 --- a/Tiles/Astral/AstralStone.cs +++ b/Tiles/Astral/AstralStone.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralStone : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/Astral/AstralTallPlants.cs b/Tiles/Astral/AstralTallPlants.cs index 0335b5bc86..a14324835c 100644 --- a/Tiles/Astral/AstralTallPlants.cs +++ b/Tiles/Astral/AstralTallPlants.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralTallPlants : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileCut[Type] = true; Main.tileSolid[Type] = false; diff --git a/Tiles/Astral/AstralTree.cs b/Tiles/Astral/AstralTree.cs index 1357ebc013..a7869d0963 100644 --- a/Tiles/Astral/AstralTree.cs +++ b/Tiles/Astral/AstralTree.cs @@ -8,11 +8,11 @@ namespace CalamityMod.Tiles.Astral public override Texture2D GetTopTextures(int i, int j, ref int frame, ref int frameWidth, ref int frameHeight, ref int xOffsetLeft, ref int yOffset) { frame = (i + j * j) % 3; - return ModContent.GetTexture("CalamityMod/Tiles/Astral/AstralTree_Tops"); + return ModContent.Request("CalamityMod/Tiles/Astral/AstralTree_Tops"); } - public override Texture2D GetBranchTextures(int i, int j, int trunkOffset, ref int frame) => ModContent.GetTexture("CalamityMod/Tiles/Astral/AstralTree_Branches"); - public override Texture2D GetTexture() => ModContent.GetTexture("CalamityMod/Tiles/Astral/AstralTree"); + public override Texture2D GetBranchTextures(int i, int j, int trunkOffset, ref int frame) => ModContent.Request("CalamityMod/Tiles/Astral/AstralTree_Branches"); + public override Texture2D GetTexture() => ModContent.Request("CalamityMod/Tiles/Astral/AstralTree"); public override int DropWood() => ModContent.ItemType(); public override int CreateDust() => ModContent.DustType(); public override int GrowthFXGore() => -1; diff --git a/Tiles/Astral/AstralTreeSapling.cs b/Tiles/Astral/AstralTreeSapling.cs index 1261d8e4fc..c12105dc44 100644 --- a/Tiles/Astral/AstralTreeSapling.cs +++ b/Tiles/Astral/AstralTreeSapling.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Tiles.Astral //All of this code is taken directly from Example Mod. //Cheers Blushie - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; diff --git a/Tiles/Astral/AstralVines.cs b/Tiles/Astral/AstralVines.cs index 7b2d1fc82f..0d8621c3f1 100644 --- a/Tiles/Astral/AstralVines.cs +++ b/Tiles/Astral/AstralVines.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralVines : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileCut[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/AstralBar.cs b/Tiles/AstralBar.cs index 924c959f02..8a698d0ab5 100644 --- a/Tiles/AstralBar.cs +++ b/Tiles/AstralBar.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles { public class AstralBar : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBar(new Color(47, 66, 90)); dustType = ModContent.DustType(); diff --git a/Tiles/AstralBrick.cs b/Tiles/AstralBrick.cs index 2b87d1a42e..7cbac1eee1 100644 --- a/Tiles/AstralBrick.cs +++ b/Tiles/AstralBrick.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles private const short subsheetWidth = 324; private const short subsheetHeight = 90; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -42,15 +42,15 @@ namespace CalamityMod.Tiles public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; int xOffset = i % 2; int yOffset = j % 2; xOffset *= subsheetWidth; yOffset *= subsheetHeight; xPos += xOffset; yPos += yOffset; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/AstralBrickGlow"); + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/AstralBrickGlow"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); diff --git a/Tiles/AstralDesert/AstralDesertLargePiles.cs b/Tiles/AstralDesert/AstralDesertLargePiles.cs index e603c336da..a9f9f1e15a 100644 --- a/Tiles/AstralDesert/AstralDesertLargePiles.cs +++ b/Tiles/AstralDesert/AstralDesertLargePiles.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.AstralDesert { public class AstralDesertLargePiles : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; diff --git a/Tiles/AstralDesert/AstralDesertMediumPiles.cs b/Tiles/AstralDesert/AstralDesertMediumPiles.cs index af498e69c0..2f8e7d1de0 100644 --- a/Tiles/AstralDesert/AstralDesertMediumPiles.cs +++ b/Tiles/AstralDesert/AstralDesertMediumPiles.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.AstralDesert { public class AstralDesertMediumPiles : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; diff --git a/Tiles/AstralDesert/AstralDesertSmallPiles.cs b/Tiles/AstralDesert/AstralDesertSmallPiles.cs index 1247a89797..44ef9118c7 100644 --- a/Tiles/AstralDesert/AstralDesertSmallPiles.cs +++ b/Tiles/AstralDesert/AstralDesertSmallPiles.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.AstralDesert { public class AstralDesertSmallPiles : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; diff --git a/Tiles/AstralDesert/AstralDesertStalactite.cs b/Tiles/AstralDesert/AstralDesertStalactite.cs index d2f72a8089..c1bca4fd09 100644 --- a/Tiles/AstralDesert/AstralDesertStalactite.cs +++ b/Tiles/AstralDesert/AstralDesertStalactite.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.AstralDesert { public class AstralDesertStalactite : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; @@ -31,11 +31,11 @@ namespace CalamityMod.Tiles.AstralDesert public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height) { Tile tile = Main.tile[i, j]; - if (tile.frameY <= 18 || tile.frameY == 72) + if (tile.TileFrameY <= 18 || tile.TileFrameY == 72) { offsetY = -2; } - else if ((tile.frameY >= 36 && tile.frameY <= 54) || tile.frameY == 90) + else if ((tile.TileFrameY >= 36 && tile.TileFrameY <= 54) || tile.TileFrameY == 90) { offsetY = 2; } diff --git a/Tiles/AstralDesert/AstralFossil.cs b/Tiles/AstralDesert/AstralFossil.cs index 4f27a702b4..5a2afc498f 100644 --- a/Tiles/AstralDesert/AstralFossil.cs +++ b/Tiles/AstralDesert/AstralFossil.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.AstralDesert { public class AstralFossil : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/AstralDesert/AstralPalmSapling.cs b/Tiles/AstralDesert/AstralPalmSapling.cs index a063e2d644..fa70545614 100644 --- a/Tiles/AstralDesert/AstralPalmSapling.cs +++ b/Tiles/AstralDesert/AstralPalmSapling.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Tiles.AstralDesert //All of this code is taken directly from Example Mod. //Cheers Blushie - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; diff --git a/Tiles/AstralDesert/AstralPalmTree.cs b/Tiles/AstralDesert/AstralPalmTree.cs index 4d7cb94fd6..2ca33e750c 100644 --- a/Tiles/AstralDesert/AstralPalmTree.cs +++ b/Tiles/AstralDesert/AstralPalmTree.cs @@ -7,12 +7,12 @@ namespace CalamityMod.Tiles.AstralDesert { public override Texture2D GetTexture() { - return ModContent.GetTexture("CalamityMod/Tiles/AstralDesert/AstralPalmTree"); + return ModContent.Request("CalamityMod/Tiles/AstralDesert/AstralPalmTree"); } public override Texture2D GetTopTextures() { - return ModContent.GetTexture("CalamityMod/Tiles/AstralDesert/AstralPalmTree_Tops"); + return ModContent.Request("CalamityMod/Tiles/AstralDesert/AstralPalmTree_Tops"); } public override int DropWood() diff --git a/Tiles/AstralDesert/AstralSand.cs b/Tiles/AstralDesert/AstralSand.cs index 9d1dfc61d6..12b714dfef 100644 --- a/Tiles/AstralDesert/AstralSand.cs +++ b/Tiles/AstralDesert/AstralSand.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.AstralDesert { public class AstralSand : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/AstralDesert/AstralSandstone.cs b/Tiles/AstralDesert/AstralSandstone.cs index f4b527988c..72944978fd 100644 --- a/Tiles/AstralDesert/AstralSandstone.cs +++ b/Tiles/AstralDesert/AstralSandstone.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.AstralDesert { public class AstralSandstone : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/AstralDesert/HardenedAstralSand.cs b/Tiles/AstralDesert/HardenedAstralSand.cs index adbb8d9dc5..095e2da67f 100644 --- a/Tiles/AstralDesert/HardenedAstralSand.cs +++ b/Tiles/AstralDesert/HardenedAstralSand.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.AstralDesert { public class HardenedAstralSand : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/AstralSnow/AstralIce.cs b/Tiles/AstralSnow/AstralIce.cs index e2916f8c6d..97f7b44aee 100644 --- a/Tiles/AstralSnow/AstralIce.cs +++ b/Tiles/AstralSnow/AstralIce.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.AstralSnow { public class AstralIce : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/AstralSnow/AstralIceLargePiles.cs b/Tiles/AstralSnow/AstralIceLargePiles.cs index c67751a01a..4db5e210ae 100644 --- a/Tiles/AstralSnow/AstralIceLargePiles.cs +++ b/Tiles/AstralSnow/AstralIceLargePiles.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.AstralSnow { public class AstralIceLargePiles : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; diff --git a/Tiles/AstralSnow/AstralIceMediumPiles.cs b/Tiles/AstralSnow/AstralIceMediumPiles.cs index 8478a1731b..3bee00c397 100644 --- a/Tiles/AstralSnow/AstralIceMediumPiles.cs +++ b/Tiles/AstralSnow/AstralIceMediumPiles.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.AstralSnow { public class AstralIceMediumPiles : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; diff --git a/Tiles/AstralSnow/AstralIceSmallPiles.cs b/Tiles/AstralSnow/AstralIceSmallPiles.cs index d0b65efc19..5e8137b0c9 100644 --- a/Tiles/AstralSnow/AstralIceSmallPiles.cs +++ b/Tiles/AstralSnow/AstralIceSmallPiles.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.AstralSnow { public class AstralIceSmallPiles : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; diff --git a/Tiles/AstralSnow/AstralIceStalactite.cs b/Tiles/AstralSnow/AstralIceStalactite.cs index 51f0974bf2..913b17f727 100644 --- a/Tiles/AstralSnow/AstralIceStalactite.cs +++ b/Tiles/AstralSnow/AstralIceStalactite.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.AstralSnow { public class AstralIceStalactite : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.AstralSnow public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height) { Tile tile = Main.tile[i, j]; - if (tile.frameY <= 18 || tile.frameY == 72) + if (tile.TileFrameY <= 18 || tile.TileFrameY == 72) { offsetY = -2; } - else if ((tile.frameY >= 36 && tile.frameY <= 54) || tile.frameY == 90) + else if ((tile.TileFrameY >= 36 && tile.TileFrameY <= 54) || tile.TileFrameY == 90) { offsetY = 2; } diff --git a/Tiles/AstralSnow/AstralSnow.cs b/Tiles/AstralSnow/AstralSnow.cs index 1a005c3c5f..8683645b0e 100644 --- a/Tiles/AstralSnow/AstralSnow.cs +++ b/Tiles/AstralSnow/AstralSnow.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.AstralSnow { public class AstralSnow : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/AstralSnow/AstralSnowTree.cs b/Tiles/AstralSnow/AstralSnowTree.cs index 1d3c22882a..60d3bcfa30 100644 --- a/Tiles/AstralSnow/AstralSnowTree.cs +++ b/Tiles/AstralSnow/AstralSnowTree.cs @@ -8,17 +8,17 @@ namespace CalamityMod.Tiles public override Texture2D GetTopTextures(int i, int j, ref int frame, ref int frameWidth, ref int frameHeight, ref int xOffsetLeft, ref int yOffset) { frame = (i + j * j) % 6; - return ModContent.GetTexture("CalamityMod/Tiles/AstralSnow/AstralSnowTree_Tops"); + return ModContent.Request("CalamityMod/Tiles/AstralSnow/AstralSnowTree_Tops"); } public override Texture2D GetBranchTextures(int i, int j, int trunkOffset, ref int frame) { - return ModContent.GetTexture("CalamityMod/Tiles/AstralSnow/AstralSnowTree_Branches"); + return ModContent.Request("CalamityMod/Tiles/AstralSnow/AstralSnowTree_Branches"); } public override Texture2D GetTexture() { - return ModContent.GetTexture("CalamityMod/Tiles/AstralSnow/AstralSnowTree"); + return ModContent.Request("CalamityMod/Tiles/AstralSnow/AstralSnowTree"); } public override int DropWood() diff --git a/Tiles/AstralSnow/AstralSnowTreeSapling.cs b/Tiles/AstralSnow/AstralSnowTreeSapling.cs index 8eaa8b4515..e0a8fbbcd2 100644 --- a/Tiles/AstralSnow/AstralSnowTreeSapling.cs +++ b/Tiles/AstralSnow/AstralSnowTreeSapling.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Tiles.AstralSnow //All of this code is taken directly from Example Mod. //Cheers Blushie - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.AstralSnow TileObjectData.newTile.CoordinateHeights = new[] { 16, 18 }; TileObjectData.newTile.CoordinateWidth = 16; TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.AnchorValidTiles = new[] { mod.TileType("AstralSnow") }; + TileObjectData.newTile.AnchorValidTiles = new[] { Mod.Find("AstralSnow") .Type}; TileObjectData.newTile.StyleHorizontal = true; TileObjectData.newTile.DrawFlipHorizontal = true; TileObjectData.newTile.WaterPlacement = LiquidPlacement.NotAllowed; @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.AstralSnow ModTranslation name = CreateMapEntryName(); name.SetDefault("Sapling"); AddMapEntry(new Color(200, 200, 200), name); - dustType = mod.DustType("AstralBasic"); + dustType = Mod.Find("AstralBasic").Type; adjTiles = new int[] { TileID.Saplings }; } diff --git a/Tiles/AuricTeslaBar.cs b/Tiles/AuricTeslaBar.cs index 1c809997fd..5e1bce7c67 100644 --- a/Tiles/AuricTeslaBar.cs +++ b/Tiles/AuricTeslaBar.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles { public class AuricTeslaBar : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBar(new Color(255, 227, 81)); dustType = ModContent.DustType(); diff --git a/Tiles/BaseTiles/DoubleDirectionalTile.cs b/Tiles/BaseTiles/DoubleDirectionalTile.cs index a41b6a97ca..0edcc1b8b3 100644 --- a/Tiles/BaseTiles/DoubleDirectionalTile.cs +++ b/Tiles/BaseTiles/DoubleDirectionalTile.cs @@ -49,11 +49,11 @@ namespace CalamityMod.Tiles.BaseTiles Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); // We enforce racism here. - if (tile.type != typeToConnectTo) + if (tile.TileType != typeToConnectTo) return null; - int slotY = tile.frameX / 18; - int slotX = tile.frameY / 18; + int slotY = tile.TileFrameX / 18; + int slotX = tile.TileFrameY / 18; //Just to be safe if (slotX >= 5 || slotY >= 13) return null; @@ -63,8 +63,8 @@ namespace CalamityMod.Tiles.BaseTiles public int GiveVariant(int i, int j) { Tile tile = Main.tile[i, j]; - int slotY = tile.frameX / 18; - int slotX = tile.frameY / 18; + int slotY = tile.TileFrameX / 18; + int slotX = tile.TileFrameY / 18; return (int)WhatVariantAmI[slotX, slotY]; } diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 36bfe14f56..9c53b6ef34 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Tiles (ushort)ModContent.TileType() }; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSpelunker[TileID.LunarOre] = true; Main.tileValue[TileID.LunarOre] = 900; @@ -90,8 +90,8 @@ namespace CalamityMod.Tiles Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); if (Main.drawToScreen) zero = Vector2.Zero; - int frameX = tile.frameX; - int frameY = tile.frameY; + int frameX = tile.TileFrameX; + int frameY = tile.TileFrameY; // Search down the cactus to find out whether the block it is planted in is Astral Sand. bool astralCactus = false; @@ -106,10 +106,10 @@ namespace CalamityMod.Tiles xTile += (frameY == 18) ? -1 : 1; int yTile = j; - bool slidingDownCactus = Main.tile[xTile, yTile] != null && Main.tile[xTile, yTile].type == TileID.Cactus && Main.tile[xTile, yTile].active(); - while (!Main.tile[xTile, yTile].active() || !Main.tileSolid[Main.tile[xTile, yTile].type] || !slidingDownCactus) + bool slidingDownCactus = Main.tile[xTile, yTile] != null && Main.tile[xTile, yTile].TileType == TileID.Cactus && Main.tile[xTile, yTile].active(); + while (!Main.tile[xTile, yTile].active() || !Main.tileSolid[Main.tile[xTile, yTile].TileType] || !slidingDownCactus) { - if (Main.tile[xTile, yTile].type == TileID.Cactus && Main.tile[xTile, yTile].active()) + if (Main.tile[xTile, yTile].TileType == TileID.Cactus && Main.tile[xTile, yTile].active()) { slidingDownCactus = true; } @@ -118,7 +118,7 @@ namespace CalamityMod.Tiles if (yTile > i + 20) break; } - astralCactus = Main.tile[xTile, yTile].type == (ushort)ModContent.TileType(); + astralCactus = Main.tile[xTile, yTile].TileType == (ushort)ModContent.TileType(); } // If it is actually astral cactus, then draw its glowmask. @@ -143,7 +143,7 @@ namespace CalamityMod.Tiles if (xPos < 0 || xPos >= Main.maxTilesX || yPos < 0 || yPos >= Main.maxTilesY) return; Tile t = Main.tile[xPos, yPos]; - if (t != null && t.active() && (t.type == ModContent.TileType() || (t.type == ModContent.TileType() && CalamityWorld.downedDesertScourge))) + if (t != null && t.active() && (t.TileType == ModContent.TileType() || (t.TileType == ModContent.TileType() && CalamityWorld.downedDesertScourge))) { WorldGen.KillTile(xPos, yPos, false, false, false); if (!Main.tile[xPos, yPos].active() && Main.netMode != NetmodeID.SinglePlayer) @@ -152,7 +152,7 @@ namespace CalamityMod.Tiles } // CONSIDER -- Lumenyl Crystals and Sea Prism Crystals aren't solid. They shouldn't need to be checked here. - if (Main.tileSolid[tile.type] && tile.type != ModContent.TileType() && tile.type != ModContent.TileType()) + if (Main.tileSolid[tile.TileType] && tile.TileType != ModContent.TileType() && tile.TileType != ModContent.TileType()) { CheckShatterCrystal(i + 1, j); CheckShatterCrystal(i - 1, j); @@ -176,7 +176,7 @@ namespace CalamityMod.Tiles public override bool Drop(int i, int j, int type) { Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(i, j); - if (tileAtPosition.frameX % 36 == 0 && tileAtPosition.frameY % 36 == 0) + if (tileAtPosition.TileFrameX % 36 == 0 && tileAtPosition.TileFrameY % 36 == 0) { if (type == ModContent.TileType()) { @@ -184,8 +184,8 @@ namespace CalamityMod.Tiles for (int k = 0; k < Main.rand.Next(1, 2 + 1); k++) { - Gore.NewGore(new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), mod.GetGoreSlot("Gores/SulphSeaGen/AbyssPotGore1")); - Gore.NewGore(new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), mod.GetGoreSlot("Gores/SulphSeaGen/AbyssPotGore2")); + Gore.NewGore(new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.GetGoreSlot("Gores/SulphSeaGen/AbyssPotGore1")); + Gore.NewGore(new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.GetGoreSlot("Gores/SulphSeaGen/AbyssPotGore2")); } } else if (type == ModContent.TileType()) @@ -194,8 +194,8 @@ namespace CalamityMod.Tiles for (int k = 0; k < Main.rand.Next(1, 2 + 1); k++) { - Gore.NewGore(new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), mod.GetGoreSlot("Gores/SulphSeaGen/SulphPotGore1")); - Gore.NewGore(new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), mod.GetGoreSlot("Gores/SulphSeaGen/SulphPotGore2")); + Gore.NewGore(new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.GetGoreSlot("Gores/SulphSeaGen/SulphPotGore1")); + Gore.NewGore(new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.GetGoreSlot("Gores/SulphSeaGen/SulphPotGore2")); } } else if (type == TileID.DemonAltar && Main.hardMode) @@ -538,7 +538,7 @@ namespace CalamityMod.Tiles Tile aboveTile = CalamityUtils.ParanoidTileRetrieval(x, y - 1); // Prevent tiles below invincible tiles from being destroyed. This is like chests in vanilla. - return aboveTile.active() && checkTile.type != aboveTile.type && invincibleTiles.Contains(aboveTile.type); + return aboveTile.active() && checkTile.TileType != aboveTile.TileType && invincibleTiles.Contains(aboveTile.TileType); } public override bool CanExplode(int i, int j, int type) diff --git a/Tiles/ChaoticBarPlaced.cs b/Tiles/ChaoticBarPlaced.cs index 9232c7632d..f89ed933bc 100644 --- a/Tiles/ChaoticBarPlaced.cs +++ b/Tiles/ChaoticBarPlaced.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles { public class ChaoticBarPlaced : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBar(new Color(255, 165, 0)); dustType = 87; diff --git a/Tiles/ChaoticBrick.cs b/Tiles/ChaoticBrick.cs index d698d4fd13..be2a186962 100644 --- a/Tiles/ChaoticBrick.cs +++ b/Tiles/ChaoticBrick.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles { public class ChaoticBrick : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; diff --git a/Tiles/CosmiliteBarTile.cs b/Tiles/CosmiliteBarTile.cs index 230c1b3fbd..571365ec23 100644 --- a/Tiles/CosmiliteBarTile.cs +++ b/Tiles/CosmiliteBarTile.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles { public class CosmiliteBarTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBar(new Color(229, 141, 246)); dustType = ModContent.DustType(); diff --git a/Tiles/Crags/BrimstoneCrateTile.cs b/Tiles/Crags/BrimstoneCrateTile.cs index 2a06ac0fdf..6df8971433 100644 --- a/Tiles/Crags/BrimstoneCrateTile.cs +++ b/Tiles/Crags/BrimstoneCrateTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Crags { public class BrimstoneCrateTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolidTop[Type] = true; Main.tileLighted[Type] = true; diff --git a/Tiles/Crags/BrimstoneSlag.cs b/Tiles/Crags/BrimstoneSlag.cs index 5a3cad964a..c794a35a71 100644 --- a/Tiles/Crags/BrimstoneSlag.cs +++ b/Tiles/Crags/BrimstoneSlag.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.Crags private const short subsheetWidth = 450; private const short subsheetHeight = 198; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/CryonicBar.cs b/Tiles/CryonicBar.cs index b2c697c6cd..ce1b6a276a 100644 --- a/Tiles/CryonicBar.cs +++ b/Tiles/CryonicBar.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles { public class CryonicBar : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBar(new Color(138, 43, 226)); dustType = 44; diff --git a/Tiles/CryonicBrick.cs b/Tiles/CryonicBrick.cs index ded776769a..fc506c07ee 100644 --- a/Tiles/CryonicBrick.cs +++ b/Tiles/CryonicBrick.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles { int subsheetHeight = 90; int subsheetWidth = 234; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/DraedonStructures/AgedLaboratoryConsole.cs b/Tiles/DraedonStructures/AgedLaboratoryConsole.cs index abaf13d9fa..5b93f70bcf 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryConsole.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryConsole.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class AgedLaboratoryConsole : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -57,9 +57,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryConsoleGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryConsoleGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/DraedonStructures/AgedLaboratoryContainmentBox.cs b/Tiles/DraedonStructures/AgedLaboratoryContainmentBox.cs index 0cc14fdb8a..dbf250bd68 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryContainmentBox.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryContainmentBox.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class AgedLaboratoryContainmentBox : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs b/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs index 46994b7a6a..2ebd685e82 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class AgedLaboratoryDisplay : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -51,9 +51,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryDisplayGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryDisplayGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/DraedonStructures/AgedLaboratoryDoorClosed.cs b/Tiles/DraedonStructures/AgedLaboratoryDoorClosed.cs index 88c6d4d7fe..93be3c9bdc 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryDoorClosed.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryDoorClosed.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class AgedLaboratoryDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/DraedonStructures/AgedLaboratoryDoorOpen.cs b/Tiles/DraedonStructures/AgedLaboratoryDoorOpen.cs index ed8985c7e6..8b97c1a42c 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryDoorOpen.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryDoorOpen.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class AgedLaboratoryDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/DraedonStructures/AgedLaboratoryElectricPanel.cs b/Tiles/DraedonStructures/AgedLaboratoryElectricPanel.cs index e7ce79cb0d..8120331343 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryElectricPanel.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryElectricPanel.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class AgedLaboratoryElectricPanel : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; diff --git a/Tiles/DraedonStructures/AgedLaboratoryScreen.cs b/Tiles/DraedonStructures/AgedLaboratoryScreen.cs index 4db2a1c1fd..445ff46977 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryScreen.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryScreen.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class AgedLaboratoryScreen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; @@ -39,9 +39,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryScreenGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryScreenGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/DraedonStructures/AgedLaboratoryServer.cs b/Tiles/DraedonStructures/AgedLaboratoryServer.cs index d1afbd35ec..c53788d2e4 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryServer.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryServer.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class AgedLaboratoryServer : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -57,9 +57,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryServerGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryServerGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/DraedonStructures/AgedLaboratoryTerminal.cs b/Tiles/DraedonStructures/AgedLaboratoryTerminal.cs index 1bc8b5d738..4565d35b63 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryTerminal.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryTerminal.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class AgedLaboratoryTerminal : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/DraedonStructures/AgedReinforcedCrate.cs b/Tiles/DraedonStructures/AgedReinforcedCrate.cs index 664e89a983..be52a8c151 100644 --- a/Tiles/DraedonStructures/AgedReinforcedCrate.cs +++ b/Tiles/DraedonStructures/AgedReinforcedCrate.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class AgedReinforcedCrate : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -45,9 +45,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/AgedReinforcedCrateGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedReinforcedCrateGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/DraedonStructures/AgedSecurityChestTile.cs b/Tiles/DraedonStructures/AgedSecurityChestTile.cs index 9f1a3423f7..f5543e11e9 100644 --- a/Tiles/DraedonStructures/AgedSecurityChestTile.cs +++ b/Tiles/DraedonStructures/AgedSecurityChestTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class AgedSecurityChestTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(); ModTranslation name = CreateMapEntryName(); @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.DraedonStructures Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); public override void MouseOver(int i, int j) { diff --git a/Tiles/DraedonStructures/ChargingStation.cs b/Tiles/DraedonStructures/ChargingStation.cs index 9a9c6589e8..499cb2df7f 100644 --- a/Tiles/DraedonStructures/ChargingStation.cs +++ b/Tiles/DraedonStructures/ChargingStation.cs @@ -9,6 +9,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; +using Terraria.Audio; namespace CalamityMod.Tiles.DraedonStructures { @@ -24,7 +25,7 @@ namespace CalamityMod.Tiles.DraedonStructures // One cell of charge is placed into the weapon on a timer of this many frames. public const int FramesPerChargeAction = 8; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -63,8 +64,8 @@ namespace CalamityMod.Tiles.DraedonStructures Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType()); Tile t = Main.tile[i, j]; - int left = i - t.frameX % (Width * SheetSquare) / SheetSquare; - int top = j - t.frameY % (Height * SheetSquare) / SheetSquare; + int left = i - t.TileFrameX % (Width * SheetSquare) / SheetSquare; + int top = j - t.TileFrameY % (Height * SheetSquare) / SheetSquare; // Drop any cells contained in the charging station, as well as its plugged item. Vector2 dropPos = new Vector2(i, j) * 16f; @@ -82,7 +83,7 @@ namespace CalamityMod.Tiles.DraedonStructures charger?.Kill(left, top); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { TEChargingStation thisCharger = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); Player player = Main.LocalPlayer; @@ -93,14 +94,14 @@ namespace CalamityMod.Tiles.DraedonStructures if (thisCharger is null || thisCharger.ID == mp.CurrentlyViewedChargerID) { mp.CurrentlyViewedChargerID = -1; - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); } // Otherwise, "switch to" this charger when it exists. This can be either opening the GUI from nothing, or just opening a different charger. else if (thisCharger != null) { // Play a sound depending on whether the player had another charger open previously. - Main.PlaySound(mp.CurrentlyViewedChargerID == -1 ? SoundID.MenuOpen : SoundID.MenuTick); + SoundEngine.PlaySound(mp.CurrentlyViewedChargerID == -1 ? SoundID.MenuOpen : SoundID.MenuTick); mp.CurrentlyViewedChargerID = thisCharger.ID; Main.playerInventory = true; Main.recBigList = false; @@ -114,13 +115,13 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - int xFrame = t.frameX; - int yFrame = t.frameY; + int xFrame = t.TileFrameX; + int yFrame = t.TileFrameY; // Grab the tile entity because its glowmask depends on whether it's currently charging. TEChargingStation charger = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/ChargingStation_Glow"); + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/ChargingStation_Glow"); Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; Color drawColor = charger?.LightColor ?? Color.Red; diff --git a/Tiles/DraedonStructures/DraedonLabTurret.cs b/Tiles/DraedonStructures/DraedonLabTurret.cs index 32ab987461..bc4233cc6e 100644 --- a/Tiles/DraedonStructures/DraedonLabTurret.cs +++ b/Tiles/DraedonStructures/DraedonLabTurret.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.DraedonStructures public const int OriginOffsetY = 1; public const int SheetSquare = 18; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -65,8 +65,8 @@ namespace CalamityMod.Tiles.DraedonStructures Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType(), 8); Tile t = Main.tile[i, j]; - int left = i - t.frameX % (Width * SheetSquare) / SheetSquare; - int top = j - t.frameY % (Height * SheetSquare) / SheetSquare; + int left = i - t.TileFrameX % (Width * SheetSquare) / SheetSquare; + int top = j - t.TileFrameY % (Height * SheetSquare) / SheetSquare; TEDraedonLabTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); te?.Kill(left, top); @@ -76,7 +76,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.frameX != 36 || t.frameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0) return; TEDraedonLabTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); @@ -85,7 +85,7 @@ namespace CalamityMod.Tiles.DraedonStructures int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); - Texture2D tex = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PulseTurret"); + Texture2D tex = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PulseTurret"); Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; drawOffset.Y -= 2f; diff --git a/Tiles/DraedonStructures/HazardChevronPanels.cs b/Tiles/DraedonStructures/HazardChevronPanels.cs index 89098588fc..925dd2f96b 100644 --- a/Tiles/DraedonStructures/HazardChevronPanels.cs +++ b/Tiles/DraedonStructures/HazardChevronPanels.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class HazardChevronPanels : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/DraedonStructures/InactivePowerCellFactory.cs b/Tiles/DraedonStructures/InactivePowerCellFactory.cs index 1ce1114b53..ef4a696598 100644 --- a/Tiles/DraedonStructures/InactivePowerCellFactory.cs +++ b/Tiles/DraedonStructures/InactivePowerCellFactory.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Tiles.DraedonStructures public const int OriginOffsetX = 0; // this tile is never placed by the player, so this makes for simpler code public const int OriginOffsetY = 3; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/DraedonStructures/LabHologramProjector.cs b/Tiles/DraedonStructures/LabHologramProjector.cs index 700b415418..26be3e6d14 100644 --- a/Tiles/DraedonStructures/LabHologramProjector.cs +++ b/Tiles/DraedonStructures/LabHologramProjector.cs @@ -9,6 +9,7 @@ using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; +using Terraria.Audio; namespace CalamityMod.Tiles.DraedonStructures { @@ -21,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures public const int TalkingFrames = 8; public const int FrameCount = IdleFrames + TalkingFrames; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; @@ -64,15 +65,15 @@ namespace CalamityMod.Tiles.DraedonStructures Item.NewItem(i * 16, j * 16, 16, 32, ModContent.ItemType()); Tile tile = Main.tile[i, j]; - int left = i - tile.frameX % (Width * SheetSquare) / SheetSquare; - int top = j - tile.frameY % (Height * SheetSquare) / SheetSquare; + int left = i - tile.TileFrameX % (Width * SheetSquare) / SheetSquare; + int top = j - tile.TileFrameY % (Height * SheetSquare) / SheetSquare; // Kill the hosted tile entity directly and immediately. TELabHologramProjector hologramTileEntity = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); hologramTileEntity?.Kill(left, top); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { Player player = Main.LocalPlayer; CalamityPlayer mp = player.Calamity(); @@ -83,7 +84,7 @@ namespace CalamityMod.Tiles.DraedonStructures mp.CurrentlyViewedHologramID = projector?.ID ?? -1; if (mp.CurrentlyViewedHologramID != -1) { - Main.PlaySound(SoundID.Chat, -1, -1, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.Chat, -1, -1, 1, 1f, 0f); player.talkNPC = -1; } } @@ -119,14 +120,14 @@ namespace CalamityMod.Tiles.DraedonStructures frame -= IdleFrames - 2; } - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; // Accomodation for X frames textures. xPos += frame / 8 * 96; yPos += frame % 8 * 112; - Texture2D tileTexture = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/LabHologramProjector"); + Texture2D tileTexture = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LabHologramProjector"); Vector2 offset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + offset; Color drawColor = Lighting.GetColor(i, j); diff --git a/Tiles/DraedonStructures/LaboratoryConsole.cs b/Tiles/DraedonStructures/LaboratoryConsole.cs index 7e54a2e199..7e2bdb6ca8 100644 --- a/Tiles/DraedonStructures/LaboratoryConsole.cs +++ b/Tiles/DraedonStructures/LaboratoryConsole.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryConsole : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -57,9 +57,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/LaboratoryConsoleGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryConsoleGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/DraedonStructures/LaboratoryContainmentBox.cs b/Tiles/DraedonStructures/LaboratoryContainmentBox.cs index d1e965e5c9..2767e7ff3b 100644 --- a/Tiles/DraedonStructures/LaboratoryContainmentBox.cs +++ b/Tiles/DraedonStructures/LaboratoryContainmentBox.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryContainmentBox : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/DraedonStructures/LaboratoryDisplay.cs b/Tiles/DraedonStructures/LaboratoryDisplay.cs index 6342b43c0c..74fee55d84 100644 --- a/Tiles/DraedonStructures/LaboratoryDisplay.cs +++ b/Tiles/DraedonStructures/LaboratoryDisplay.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryDisplay : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -61,9 +61,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/LaboratoryDisplayGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryDisplayGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/DraedonStructures/LaboratoryDoorClosed.cs b/Tiles/DraedonStructures/LaboratoryDoorClosed.cs index 170cac3fe9..f673129302 100644 --- a/Tiles/DraedonStructures/LaboratoryDoorClosed.cs +++ b/Tiles/DraedonStructures/LaboratoryDoorClosed.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/DraedonStructures/LaboratoryDoorOpen.cs b/Tiles/DraedonStructures/LaboratoryDoorOpen.cs index cffc7aa927..f4c25fc6d5 100644 --- a/Tiles/DraedonStructures/LaboratoryDoorOpen.cs +++ b/Tiles/DraedonStructures/LaboratoryDoorOpen.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/DraedonStructures/LaboratoryElectricPanel.cs b/Tiles/DraedonStructures/LaboratoryElectricPanel.cs index 71ef4babdd..a2fc9c45ce 100644 --- a/Tiles/DraedonStructures/LaboratoryElectricPanel.cs +++ b/Tiles/DraedonStructures/LaboratoryElectricPanel.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryElectricPanel : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; diff --git a/Tiles/DraedonStructures/LaboratoryPanels.cs b/Tiles/DraedonStructures/LaboratoryPanels.cs index 5f3e24aa95..5d5f6a70d1 100644 --- a/Tiles/DraedonStructures/LaboratoryPanels.cs +++ b/Tiles/DraedonStructures/LaboratoryPanels.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryPanels : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/DraedonStructures/LaboratoryPipePlating.cs b/Tiles/DraedonStructures/LaboratoryPipePlating.cs index 8c0525d80a..ee34d7976d 100644 --- a/Tiles/DraedonStructures/LaboratoryPipePlating.cs +++ b/Tiles/DraedonStructures/LaboratoryPipePlating.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryPipePlating : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/DraedonStructures/LaboratoryPlating.cs b/Tiles/DraedonStructures/LaboratoryPlating.cs index 9493de50b5..de97aeb9d1 100644 --- a/Tiles/DraedonStructures/LaboratoryPlating.cs +++ b/Tiles/DraedonStructures/LaboratoryPlating.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryPlating : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/DraedonStructures/LaboratoryScreen.cs b/Tiles/DraedonStructures/LaboratoryScreen.cs index ce260cbc03..94226e59d7 100644 --- a/Tiles/DraedonStructures/LaboratoryScreen.cs +++ b/Tiles/DraedonStructures/LaboratoryScreen.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryScreen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; @@ -39,9 +39,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/LaboratoryScreenGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryScreenGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/DraedonStructures/LaboratoryServer.cs b/Tiles/DraedonStructures/LaboratoryServer.cs index 8c13fe72e8..36731c8974 100644 --- a/Tiles/DraedonStructures/LaboratoryServer.cs +++ b/Tiles/DraedonStructures/LaboratoryServer.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryServer : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -57,9 +57,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/LaboratoryServerGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryServerGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/DraedonStructures/LaboratoryShelf.cs b/Tiles/DraedonStructures/LaboratoryShelf.cs index 21c19eba11..08ef4658c7 100644 --- a/Tiles/DraedonStructures/LaboratoryShelf.cs +++ b/Tiles/DraedonStructures/LaboratoryShelf.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryShelf : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); soundType = SoundID.Tink; diff --git a/Tiles/DraedonStructures/LaboratoryTerminal.cs b/Tiles/DraedonStructures/LaboratoryTerminal.cs index 508f6cdb3e..94e17d8abe 100644 --- a/Tiles/DraedonStructures/LaboratoryTerminal.cs +++ b/Tiles/DraedonStructures/LaboratoryTerminal.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryTerminal : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -61,9 +61,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/LaboratoryTerminalGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryTerminalGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/DraedonStructures/PowerCellFactory.cs b/Tiles/DraedonStructures/PowerCellFactory.cs index 851273c9a7..64b56eadd7 100644 --- a/Tiles/DraedonStructures/PowerCellFactory.cs +++ b/Tiles/DraedonStructures/PowerCellFactory.cs @@ -10,6 +10,7 @@ using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; +using Terraria.Audio; namespace CalamityMod.Tiles.DraedonStructures { @@ -34,7 +35,7 @@ namespace CalamityMod.Tiles.DraedonStructures // With a delay of this many extra frames after that animation frame starts. public const int MagicFrameDelay = AnimationFramerate - 1; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -78,8 +79,8 @@ namespace CalamityMod.Tiles.DraedonStructures Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType()); Tile t = Main.tile[i, j]; - int left = i - t.frameX % (Width * SheetSquare) / SheetSquare; - int top = j - t.frameY % (Height * SheetSquare) / SheetSquare; + int left = i - t.TileFrameX % (Width * SheetSquare) / SheetSquare; + int top = j - t.TileFrameY % (Height * SheetSquare) / SheetSquare; // Drop any cells contained in the factory. TEPowerCellFactory factory = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); @@ -90,7 +91,7 @@ namespace CalamityMod.Tiles.DraedonStructures factory?.Kill(left, top); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { TEPowerCellFactory thisFactory = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); Player player = Main.LocalPlayer; @@ -101,14 +102,14 @@ namespace CalamityMod.Tiles.DraedonStructures if (thisFactory is null || thisFactory.ID == mp.CurrentlyViewedFactoryID) { mp.CurrentlyViewedFactoryID = -1; - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); } // Otherwise, "switch to" this factory when it exists. This can be either opening the GUI from nothing, or just opening a different factory. else if (thisFactory != null) { // Play a sound depending on whether the player had another factory open previously. - Main.PlaySound(mp.CurrentlyViewedFactoryID == -1 ? SoundID.MenuOpen : SoundID.MenuTick); + SoundEngine.PlaySound(mp.CurrentlyViewedFactoryID == -1 ? SoundID.MenuOpen : SoundID.MenuTick); mp.CurrentlyViewedFactoryID = thisFactory.ID; Main.playerInventory = true; Main.recBigList = false; @@ -123,8 +124,8 @@ namespace CalamityMod.Tiles.DraedonStructures { // These offsets start as the tile offsets, i.e. which sub-tile of the FrameImportant structure this specific location is. Tile t = Main.tile[i, j]; - int frameXPos = t.frameX; - int frameYPos = t.frameY; + int frameXPos = t.TileFrameX; + int frameYPos = t.TileFrameY; // Grab the tile entity because its internal timer controls the animation. TEPowerCellFactory factory = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); @@ -132,7 +133,7 @@ namespace CalamityMod.Tiles.DraedonStructures frameXPos += frameIndex / FramesPerColumn * (Width * SheetSquare); frameYPos += frameIndex % FramesPerColumn * (Height * SheetSquare); - Texture2D tex = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/PowerCellFactory"); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/DraedonStructures/PowerCellFactory"); Vector2 offset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + offset; Color drawColor = Lighting.GetColor(i, j); diff --git a/Tiles/DraedonStructures/ReinforcedCrate.cs b/Tiles/DraedonStructures/ReinforcedCrate.cs index 91c0308eb7..5775955bd3 100644 --- a/Tiles/DraedonStructures/ReinforcedCrate.cs +++ b/Tiles/DraedonStructures/ReinforcedCrate.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class ReinforcedCrate : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -45,9 +45,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonStructures/ReinforcedCrateGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/ReinforcedCrateGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/DraedonStructures/RustedPipes.cs b/Tiles/DraedonStructures/RustedPipes.cs index eeb0cc7c3e..235a068a22 100644 --- a/Tiles/DraedonStructures/RustedPipes.cs +++ b/Tiles/DraedonStructures/RustedPipes.cs @@ -2,12 +2,13 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.Audio; namespace CalamityMod.Tiles.DraedonStructures { public class RustedPipes : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -25,7 +26,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PlaceInWorld(int i, int j, Item item) { - Main.PlaySound(SoundID.Item,i * 16, j * 16, 52, 0.75f, -0.5f); + SoundEngine.PlaySound(SoundID.Item,i * 16, j * 16, 52, 0.75f, -0.5f); } } } diff --git a/Tiles/DraedonStructures/RustedPlating.cs b/Tiles/DraedonStructures/RustedPlating.cs index 28b3a9a7d1..8919ed7e11 100644 --- a/Tiles/DraedonStructures/RustedPlating.cs +++ b/Tiles/DraedonStructures/RustedPlating.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class RustedPlating : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/DraedonStructures/RustedShelf.cs b/Tiles/DraedonStructures/RustedShelf.cs index 1d0f4ada31..fc1055a063 100644 --- a/Tiles/DraedonStructures/RustedShelf.cs +++ b/Tiles/DraedonStructures/RustedShelf.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class RustedShelf : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); soundType = SoundID.Tink; diff --git a/Tiles/DraedonStructures/SecurityChestTile.cs b/Tiles/DraedonStructures/SecurityChestTile.cs index 5d79866916..7358b6d081 100644 --- a/Tiles/DraedonStructures/SecurityChestTile.cs +++ b/Tiles/DraedonStructures/SecurityChestTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class SecurityChestTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(); ModTranslation name = CreateMapEntryName(); @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.DraedonStructures Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); public override void MouseOver(int i, int j) { diff --git a/Tiles/DraedonSummoner/CodebreakerTile.cs b/Tiles/DraedonSummoner/CodebreakerTile.cs index fb383ea9fd..47c56485b2 100644 --- a/Tiles/DraedonSummoner/CodebreakerTile.cs +++ b/Tiles/DraedonSummoner/CodebreakerTile.cs @@ -9,6 +9,7 @@ using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; +using Terraria.Audio; namespace CalamityMod.Tiles.DraedonSummoner { @@ -27,17 +28,17 @@ namespace CalamityMod.Tiles.DraedonSummoner public static Texture2D VoltageRegulatorTexture2; public static Texture2D CoolingCellTexture; - public override void SetDefaults() + public override void SetStaticDefaults() { if (!Main.dedServ) { - TileTexture = ModContent.GetTexture("CalamityMod/Tiles/DraedonSummoner/CodebreakerTile"); - ComputerTexture = ModContent.GetTexture("CalamityMod/Tiles/DraedonSummoner/CodebreakerDecryptionComputer"); - SensorTexture = ModContent.GetTexture("CalamityMod/Tiles/DraedonSummoner/CodebreakerLongRangedSensorArray"); - DisplayTexture = ModContent.GetTexture("CalamityMod/Tiles/DraedonSummoner/CodebreakerAdvancedDisplay"); - VoltageRegulatorTexture = ModContent.GetTexture("CalamityMod/Tiles/DraedonSummoner/CodebreakerVoltageRegulationSystem"); - VoltageRegulatorTexture2 = ModContent.GetTexture("CalamityMod/Tiles/DraedonSummoner/CodebreakerVoltageRegulationSystem2"); - CoolingCellTexture = ModContent.GetTexture("CalamityMod/Tiles/DraedonSummoner/CodebreakerAuricQuantumCoolingCell"); + TileTexture = ModContent.Request("CalamityMod/Tiles/DraedonSummoner/CodebreakerTile"); + ComputerTexture = ModContent.Request("CalamityMod/Tiles/DraedonSummoner/CodebreakerDecryptionComputer"); + SensorTexture = ModContent.Request("CalamityMod/Tiles/DraedonSummoner/CodebreakerLongRangedSensorArray"); + DisplayTexture = ModContent.Request("CalamityMod/Tiles/DraedonSummoner/CodebreakerAdvancedDisplay"); + VoltageRegulatorTexture = ModContent.Request("CalamityMod/Tiles/DraedonSummoner/CodebreakerVoltageRegulationSystem"); + VoltageRegulatorTexture2 = ModContent.Request("CalamityMod/Tiles/DraedonSummoner/CodebreakerVoltageRegulationSystem2"); + CoolingCellTexture = ModContent.Request("CalamityMod/Tiles/DraedonSummoner/CodebreakerAuricQuantumCoolingCell"); } Main.tileLighted[Type] = true; @@ -102,8 +103,8 @@ namespace CalamityMod.Tiles.DraedonSummoner Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType()); Tile t = Main.tile[i, j]; - int left = i - t.frameX % (Width * SheetSquare) / SheetSquare; - int top = j - t.frameY % (Height * SheetSquare) / SheetSquare; + int left = i - t.TileFrameX % (Width * SheetSquare) / SheetSquare; + int top = j - t.TileFrameY % (Height * SheetSquare) / SheetSquare; TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); @@ -116,7 +117,7 @@ namespace CalamityMod.Tiles.DraedonSummoner public override bool HasSmartInteract() => true; - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); Player player = Main.LocalPlayer; @@ -130,14 +131,14 @@ namespace CalamityMod.Tiles.DraedonSummoner CombatText.NewText(player.Hitbox, Color.Cyan, "No decryption computer installed"); CodebreakerUI.ViewedTileEntityID = -1; - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); } // Otherwise, open the decryption interface when it exists. This can be either opening the GUI from nothing, or just opening a separate codebreaker. else if (codebreakerTileEntity != null) { // Play a sound depending on whether the player had another codebreaker open previously. - Main.PlaySound(CodebreakerUI.ViewedTileEntityID == -1 ? SoundID.MenuOpen : SoundID.MenuTick); + SoundEngine.PlaySound(CodebreakerUI.ViewedTileEntityID == -1 ? SoundID.MenuOpen : SoundID.MenuTick); CodebreakerUI.ViewedTileEntityID = codebreakerTileEntity.ID; Main.playerInventory = true; Main.recBigList = false; @@ -152,9 +153,9 @@ namespace CalamityMod.Tiles.DraedonSummoner { // These offsets start as the tile offsets, i.e. which sub-tile of the FrameImportant structure this specific location is. Tile t = Main.tile[i, j]; - int left = i - t.frameX % (Width * SheetSquare) / SheetSquare; - int frameXPos = t.frameX; - int frameYPos = t.frameY + Height * SheetSquare * (int)((Main.GlobalTime * 12f + left) % 8); + int left = i - t.TileFrameX % (Width * SheetSquare) / SheetSquare; + int frameXPos = t.TileFrameX; + int frameYPos = t.TileFrameY + Height * SheetSquare * (int)((Main.GlobalTime * 12f + left) % 8); // Grab the tile entity because it stores the information regarding what is actually attached. TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/Furniture/AuricToiletTile.cs b/Tiles/Furniture/AuricToiletTile.cs index 648cd8eab0..f3b1855259 100644 --- a/Tiles/Furniture/AuricToiletTile.cs +++ b/Tiles/Furniture/AuricToiletTile.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.Furniture { public class AuricToiletTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; diff --git a/Tiles/Furniture/BabyFlakHermitCageTile.cs b/Tiles/Furniture/BabyFlakHermitCageTile.cs index c008dedaae..95bfb6a684 100644 --- a/Tiles/Furniture/BabyFlakHermitCageTile.cs +++ b/Tiles/Furniture/BabyFlakHermitCageTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Furniture { public class BabyFlakHermitCageTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/BabyGhostBellJarTile.cs b/Tiles/Furniture/BabyGhostBellJarTile.cs index 066ac7bb0a..04b5953196 100644 --- a/Tiles/Furniture/BabyGhostBellJarTile.cs +++ b/Tiles/Furniture/BabyGhostBellJarTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture { public class BabyGhostBellJarTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/BlueCandle.cs b/Tiles/Furniture/BlueCandle.cs index 30b7f06f73..5c76e248b0 100644 --- a/Tiles/Furniture/BlueCandle.cs +++ b/Tiles/Furniture/BlueCandle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture { public class BlueCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/BossTrophy.cs b/Tiles/Furniture/BossTrophy.cs index 4a9b94b1f3..c1f1c7cca0 100644 --- a/Tiles/Furniture/BossTrophy.cs +++ b/Tiles/Furniture/BossTrophy.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture { public class BossTrophy : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; diff --git a/Tiles/Furniture/ChaosCandle.cs b/Tiles/Furniture/ChaosCandle.cs index f839e30c82..8c57797d2d 100644 --- a/Tiles/Furniture/ChaosCandle.cs +++ b/Tiles/Furniture/ChaosCandle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture { public class ChaosCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(); drop = ModContent.ItemType(); @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.Furniture public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.85f; g = 0.25f; @@ -59,16 +59,16 @@ namespace CalamityMod.Tiles.Furniture public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) CalamityUtils.DrawFlameSparks(235, 5, i, j); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/Furniture/ChaosCandleFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/Furniture/ChaosCandleFlame"), i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; diff --git a/Tiles/Furniture/CorruptionEffigy.cs b/Tiles/Furniture/CorruptionEffigy.cs index 94c973c642..42f9ed973e 100644 --- a/Tiles/Furniture/CorruptionEffigy.cs +++ b/Tiles/Furniture/CorruptionEffigy.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Furniture { public class CorruptionEffigy : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/CraftingStations/AncientAltar.cs b/Tiles/Furniture/CraftingStations/AncientAltar.cs index 68cca97d29..ec29e54392 100644 --- a/Tiles/Furniture/CraftingStations/AncientAltar.cs +++ b/Tiles/Furniture/CraftingStations/AncientAltar.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public class AncientAltar : ModTile { int animationFrame = 0; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -63,13 +63,13 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawStaticFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/Furniture/CraftingStations/AncientAltarFlame"), i, j, offsetY: animationFrame * animationFrameHeight); + CalamityUtils.DrawStaticFlameEffect(ModContent.Request("CalamityMod/Tiles/Furniture/CraftingStations/AncientAltarFlame"), i, j, offsetY: animationFrame * animationFrameHeight); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { Tile tile = Main.tile[i, j]; - if (tile.frameX == 18 && tile.frameY == 18) + if (tile.TileFrameX == 18 && tile.TileFrameY == 18) { CalamityUtils.DrawFlameSparks(60, 5, i, j); } diff --git a/Tiles/Furniture/CraftingStations/AshenAltar.cs b/Tiles/Furniture/CraftingStations/AshenAltar.cs index bec7c3eca3..06b6919e4a 100644 --- a/Tiles/Furniture/CraftingStations/AshenAltar.cs +++ b/Tiles/Furniture/CraftingStations/AshenAltar.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public class AshenAltar : ModTile { int animationFrame = 0; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -63,13 +63,13 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawStaticFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/Furniture/CraftingStations/AshenAltarFlame"), i, j, offsetY: animationFrame * animationFrameHeight); + CalamityUtils.DrawStaticFlameEffect(ModContent.Request("CalamityMod/Tiles/Furniture/CraftingStations/AshenAltarFlame"), i, j, offsetY: animationFrame * animationFrameHeight); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { Tile tile = Main.tile[i, j]; - if (tile.frameX == 18 && tile.frameY == 18) + if (tile.TileFrameX == 18 && tile.TileFrameY == 18) { CalamityUtils.DrawFlameSparks(60, 5, i, j); } diff --git a/Tiles/Furniture/CraftingStations/BotanicPlanter.cs b/Tiles/Furniture/CraftingStations/BotanicPlanter.cs index a7328d4724..07b294f092 100644 --- a/Tiles/Furniture/CraftingStations/BotanicPlanter.cs +++ b/Tiles/Furniture/CraftingStations/BotanicPlanter.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { public class BotanicPlanter : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { Tile tile = Main.tile[i, j]; //227 79 79 - if (tile.frameX < 54) + if (tile.TileFrameX < 54) { r = 0.8f; g = 0.9f; diff --git a/Tiles/Furniture/CraftingStations/CosmicAnvil.cs b/Tiles/Furniture/CraftingStations/CosmicAnvil.cs index 06b79f13cb..d2827c9285 100644 --- a/Tiles/Furniture/CraftingStations/CosmicAnvil.cs +++ b/Tiles/Furniture/CraftingStations/CosmicAnvil.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { public class CosmicAnvil : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/CraftingStations/DraedonsForge.cs b/Tiles/Furniture/CraftingStations/DraedonsForge.cs index 5aebed6613..a215b2cb05 100644 --- a/Tiles/Furniture/CraftingStations/DraedonsForge.cs +++ b/Tiles/Furniture/CraftingStations/DraedonsForge.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { public class DraedonsForge : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/CraftingStations/EutrophicCrafting.cs b/Tiles/Furniture/CraftingStations/EutrophicCrafting.cs index 1c97fd7e83..d03cf174e1 100644 --- a/Tiles/Furniture/CraftingStations/EutrophicCrafting.cs +++ b/Tiles/Furniture/CraftingStations/EutrophicCrafting.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations // It's highly recommended you don't touch this code unless absolutely necessary. // Even slightly changing the way that this tile initializes could re-introduce the Ancients Awakened worldgen bug. // - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/CraftingStations/MonolithCrafting.cs b/Tiles/Furniture/CraftingStations/MonolithCrafting.cs index 98b68a7a92..7bc61398ae 100644 --- a/Tiles/Furniture/CraftingStations/MonolithCrafting.cs +++ b/Tiles/Furniture/CraftingStations/MonolithCrafting.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { public class MonolithCrafting : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(true, false, false); ModTranslation name = CreateMapEntryName(); @@ -30,9 +30,9 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Furniture/CraftingStations/MonolithCraftingGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Furniture/CraftingStations/MonolithCraftingGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/Furniture/CraftingStations/PlagueInfuser.cs b/Tiles/Furniture/CraftingStations/PlagueInfuser.cs index f99ed62e10..dbf911e227 100644 --- a/Tiles/Furniture/CraftingStations/PlagueInfuser.cs +++ b/Tiles/Furniture/CraftingStations/PlagueInfuser.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { public class PlagueInfuser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/CraftingStations/ProfanedBasin.cs b/Tiles/Furniture/CraftingStations/ProfanedBasin.cs index d4135e227e..c0281e216d 100644 --- a/Tiles/Furniture/CraftingStations/ProfanedBasin.cs +++ b/Tiles/Furniture/CraftingStations/ProfanedBasin.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { public class ProfanedBasin : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -48,7 +48,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.85f; diff --git a/Tiles/Furniture/CraftingStations/SilvaBasin.cs b/Tiles/Furniture/CraftingStations/SilvaBasin.cs index dc387471c5..bb800d2a48 100644 --- a/Tiles/Furniture/CraftingStations/SilvaBasin.cs +++ b/Tiles/Furniture/CraftingStations/SilvaBasin.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { public class SilvaBasin : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -50,7 +50,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { Tile tile = Main.tile[i, j]; //227 79 79 - if (tile.frameX < 54) + if (tile.TileFrameX < 54) { r = 0.6f; g = 1f; diff --git a/Tiles/Furniture/CraftingStations/StaticRefiner.cs b/Tiles/Furniture/CraftingStations/StaticRefiner.cs index a6c006b00f..29ae8d39c5 100644 --- a/Tiles/Furniture/CraftingStations/StaticRefiner.cs +++ b/Tiles/Furniture/CraftingStations/StaticRefiner.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { public class StaticRefiner : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/CraftingStations/VoidCondenser.cs b/Tiles/Furniture/CraftingStations/VoidCondenser.cs index 7a86d30b82..3ab4d1f61f 100644 --- a/Tiles/Furniture/CraftingStations/VoidCondenser.cs +++ b/Tiles/Furniture/CraftingStations/VoidCondenser.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { public class VoidCondenser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/CrimsonEffigy.cs b/Tiles/Furniture/CrimsonEffigy.cs index b167072679..40c2a7b6e7 100644 --- a/Tiles/Furniture/CrimsonEffigy.cs +++ b/Tiles/Furniture/CrimsonEffigy.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Furniture { public class CrimsonEffigy : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/EffigyOfDecayPlaceable.cs b/Tiles/Furniture/EffigyOfDecayPlaceable.cs index 89c91b2fbf..6a9d5c4fec 100644 --- a/Tiles/Furniture/EffigyOfDecayPlaceable.cs +++ b/Tiles/Furniture/EffigyOfDecayPlaceable.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.Furniture { public class EffigyOfDecayPlaceable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/Fountains/AbyssFountainTile.cs b/Tiles/Furniture/Fountains/AbyssFountainTile.cs index c4d9d75533..fa1c3bef49 100644 --- a/Tiles/Furniture/Fountains/AbyssFountainTile.cs +++ b/Tiles/Furniture/Fountains/AbyssFountainTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains { public class AbyssFountainTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpFountain(); AddMapEntry(new Color(71, 93, 107), Language.GetText("MapObject.WaterFountain")); @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void NearbyEffects(int i, int j, bool closer) { - if (Main.tile[i, j].frameX < 36) + if (Main.tile[i, j].TileFrameX < 36) { if (CalamityGlobalTile.WaterStyles.Any((style) => style.Name == "AbyssWater")) { @@ -64,7 +64,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains CalamityUtils.LightHitWire(Type, i, j, 2, 4); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 2, 4); return true; diff --git a/Tiles/Furniture/Fountains/AstralFountainTile.cs b/Tiles/Furniture/Fountains/AstralFountainTile.cs index e51871f150..14ad7d9f61 100644 --- a/Tiles/Furniture/Fountains/AstralFountainTile.cs +++ b/Tiles/Furniture/Fountains/AstralFountainTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains { public class AstralFountainTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpFountain(); AddMapEntry(new Color(59, 50, 77), Language.GetText("MapObject.WaterFountain")); @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void NearbyEffects(int i, int j, bool closer) { - if (Main.tile[i, j].frameX < 36) + if (Main.tile[i, j].TileFrameX < 36) { if (CalamityGlobalTile.WaterStyles.Any((style) => style.Name == "AstralWater")) { @@ -65,7 +65,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains CalamityUtils.LightHitWire(Type, i, j, 2, 4); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 2, 4); return true; diff --git a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs index 589de448ee..62b0276f36 100644 --- a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs +++ b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains { public class SulphurousFountainTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpFountain(); AddMapEntry(new Color(104, 195, 255), Language.GetText("MapObject.WaterFountain")); @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void NearbyEffects(int i, int j, bool closer) { - if (Main.tile[i, j].frameX < 36) + if (Main.tile[i, j].TileFrameX < 36) { if (CalamityGlobalTile.WaterStyles.Any((style) => style.Name == "SulphuricWater")) { @@ -64,7 +64,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains CalamityUtils.LightHitWire(Type, i, j, 2, 4); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 2, 4); return true; diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs index 8a0da910a9..847e8f0e41 100644 --- a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs +++ b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains { public class SunkenSeaFountainTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpFountain(); AddMapEntry(new Color(104, 195, 255), Language.GetText("MapObject.WaterFountain")); @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void NearbyEffects(int i, int j, bool closer) { - if (Main.tile[i, j].frameX < 36) + if (Main.tile[i, j].TileFrameX < 36) { if (CalamityGlobalTile.WaterStyles.Any((style) => style.Name == "SunkenSeaWater")) { @@ -64,7 +64,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains CalamityUtils.LightHitWire(Type, i, j, 2, 4); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 2, 4); return true; diff --git a/Tiles/Furniture/PiggyCageTile.cs b/Tiles/Furniture/PiggyCageTile.cs index ed77a7df78..19c0c62306 100644 --- a/Tiles/Furniture/PiggyCageTile.cs +++ b/Tiles/Furniture/PiggyCageTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Furniture { public class PiggyCageTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/PinkCandle.cs b/Tiles/Furniture/PinkCandle.cs index 00b8d39500..751556399f 100644 --- a/Tiles/Furniture/PinkCandle.cs +++ b/Tiles/Furniture/PinkCandle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture { public class PinkCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/PurpleCandle.cs b/Tiles/Furniture/PurpleCandle.cs index c37c22ca17..e11f99ac16 100644 --- a/Tiles/Furniture/PurpleCandle.cs +++ b/Tiles/Furniture/PurpleCandle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture { public class PurpleCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/SCalAltar.cs b/Tiles/Furniture/SCalAltar.cs index d2ed63dc38..5edea36246 100644 --- a/Tiles/Furniture/SCalAltar.cs +++ b/Tiles/Furniture/SCalAltar.cs @@ -11,6 +11,7 @@ using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; +using Terraria.Audio; namespace CalamityMod.Tiles.Furniture { @@ -18,7 +19,7 @@ namespace CalamityMod.Tiles.Furniture { public const int Width = 4; public const int Height = 3; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; @@ -53,12 +54,12 @@ namespace CalamityMod.Tiles.Furniture Item.NewItem(i * 16, j * 16, Width * 16, Height * 16, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { Tile tile = Main.tile[i, j]; - int left = i - tile.frameX / 18; - int top = j - tile.frameY / 18; + int left = i - tile.TileFrameX / 18; + int top = j - tile.TileFrameY / 18; if (!Main.LocalPlayer.HasItem(ModContent.ItemType()) && !Main.LocalPlayer.HasItem(ModContent.ItemType())) @@ -77,7 +78,7 @@ namespace CalamityMod.Tiles.Furniture Vector2 ritualSpawnPosition = new Vector2(left + Width / 2, top).ToWorldCoordinates(); ritualSpawnPosition += new Vector2(-10f, -24f); - Main.PlaySound(SoundID.DD2_EtherianPortalOpen, ritualSpawnPosition); + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalOpen, ritualSpawnPosition); Projectile.NewProjectile(ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); if (!usingSpecialItem) diff --git a/Tiles/Furniture/SeaMinnowJarTile.cs b/Tiles/Furniture/SeaMinnowJarTile.cs index 718dc44431..b4b8aff261 100644 --- a/Tiles/Furniture/SeaMinnowJarTile.cs +++ b/Tiles/Furniture/SeaMinnowJarTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Furniture { public class SeaMinnowJarTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/Furniture/ThaumaticChairTile.cs b/Tiles/Furniture/ThaumaticChairTile.cs index 87f34b747a..239e4e3b98 100644 --- a/Tiles/Furniture/ThaumaticChairTile.cs +++ b/Tiles/Furniture/ThaumaticChairTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture { public class ThaumaticChairTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(236, 123, 89), Language.GetText("MapObject.Chair")); diff --git a/Tiles/Furniture/TranquilityCandle.cs b/Tiles/Furniture/TranquilityCandle.cs index 9b2a0e2f09..ed3e8b7061 100644 --- a/Tiles/Furniture/TranquilityCandle.cs +++ b/Tiles/Furniture/TranquilityCandle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture { public class TranquilityCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(); drop = ModContent.ItemType(); @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.Furniture public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.55f; @@ -59,16 +59,16 @@ namespace CalamityMod.Tiles.Furniture public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) CalamityUtils.DrawFlameSparks(62, 5, i, j); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/Furniture/TranquilityCandleFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/Furniture/TranquilityCandleFlame"), i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; diff --git a/Tiles/Furniture/TwinklerInABottleTile.cs b/Tiles/Furniture/TwinklerInABottleTile.cs index a8a10c6ae7..1dfcb3ffaf 100644 --- a/Tiles/Furniture/TwinklerInABottleTile.cs +++ b/Tiles/Furniture/TwinklerInABottleTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Furniture { public class TwinklerInABottleTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/Furniture/YellowCandle.cs b/Tiles/Furniture/YellowCandle.cs index d53b7b4af2..a2b592b06d 100644 --- a/Tiles/Furniture/YellowCandle.cs +++ b/Tiles/Furniture/YellowCandle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Furniture { public class YellowCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/FurnitureAbyss/AbyssBath.cs b/Tiles/FurnitureAbyss/AbyssBath.cs index 0173c779b5..c65307cc7c 100644 --- a/Tiles/FurnitureAbyss/AbyssBath.cs +++ b/Tiles/FurnitureAbyss/AbyssBath.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssBath : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAbyss/AbyssBed.cs b/Tiles/FurnitureAbyss/AbyssBed.cs index 6c8773277e..adc02848fb 100644 --- a/Tiles/FurnitureAbyss/AbyssBed.cs +++ b/Tiles/FurnitureAbyss/AbyssBed.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssBed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.BedRightClick(i, j); } diff --git a/Tiles/FurnitureAbyss/AbyssBookcase.cs b/Tiles/FurnitureAbyss/AbyssBookcase.cs index fb63a5f07e..ad73dcfc9f 100644 --- a/Tiles/FurnitureAbyss/AbyssBookcase.cs +++ b/Tiles/FurnitureAbyss/AbyssBookcase.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssBookcase : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAbyss/AbyssCandelabra.cs b/Tiles/FurnitureAbyss/AbyssCandelabra.cs index 1cf349896a..ff27faf133 100644 --- a/Tiles/FurnitureAbyss/AbyssCandelabra.cs +++ b/Tiles/FurnitureAbyss/AbyssCandelabra.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssCandelabra : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureAbyss/AbyssCandle.cs b/Tiles/FurnitureAbyss/AbyssCandle.cs index c752127c51..15421d387b 100644 --- a/Tiles/FurnitureAbyss/AbyssCandle.cs +++ b/Tiles/FurnitureAbyss/AbyssCandle.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(true, 0); @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -59,7 +59,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; diff --git a/Tiles/FurnitureAbyss/AbyssChair.cs b/Tiles/FurnitureAbyss/AbyssChair.cs index d128dc0ccc..3bdcc86355 100644 --- a/Tiles/FurnitureAbyss/AbyssChair.cs +++ b/Tiles/FurnitureAbyss/AbyssChair.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssChair : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); diff --git a/Tiles/FurnitureAbyss/AbyssChandelier.cs b/Tiles/FurnitureAbyss/AbyssChandelier.cs index deb23b79b4..9757b4c38a 100644 --- a/Tiles/FurnitureAbyss/AbyssChandelier.cs +++ b/Tiles/FurnitureAbyss/AbyssChandelier.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssChandelier : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureAbyss/AbyssChest.cs b/Tiles/FurnitureAbyss/AbyssChest.cs index 26d2d4a0fa..c4ece773b8 100644 --- a/Tiles/FurnitureAbyss/AbyssChest.cs +++ b/Tiles/FurnitureAbyss/AbyssChest.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssChest : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(); ModTranslation name = CreateMapEntryName(); @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.ChestRightClick(i, j); } diff --git a/Tiles/FurnitureAbyss/AbyssClock.cs b/Tiles/FurnitureAbyss/AbyssClock.cs index ca38de7749..75d4c7adcb 100644 --- a/Tiles/FurnitureAbyss/AbyssClock.cs +++ b/Tiles/FurnitureAbyss/AbyssClock.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssClock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss num = fail ? 1 : 3; } - public override bool NewRightClick(int x, int y) + public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); } diff --git a/Tiles/FurnitureAbyss/AbyssDoorClosed.cs b/Tiles/FurnitureAbyss/AbyssDoorClosed.cs index 4d5df88a57..b6e1a94a8d 100644 --- a/Tiles/FurnitureAbyss/AbyssDoorClosed.cs +++ b/Tiles/FurnitureAbyss/AbyssDoorClosed.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureAbyss/AbyssDoorOpen.cs b/Tiles/FurnitureAbyss/AbyssDoorOpen.cs index bac76fc4ba..8a9b6c5fd8 100644 --- a/Tiles/FurnitureAbyss/AbyssDoorOpen.cs +++ b/Tiles/FurnitureAbyss/AbyssDoorOpen.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureAbyss/AbyssDresser.cs b/Tiles/FurnitureAbyss/AbyssDresser.cs index aeb0916653..6a529eb256 100644 --- a/Tiles/FurnitureAbyss/AbyssDresser.cs +++ b/Tiles/FurnitureAbyss/AbyssDresser.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssDresser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss return true; } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurnitureAbyss/AbyssLamp.cs b/Tiles/FurnitureAbyss/AbyssLamp.cs index 90eab0ed40..b5eda50af4 100644 --- a/Tiles/FurnitureAbyss/AbyssLamp.cs +++ b/Tiles/FurnitureAbyss/AbyssLamp.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssLamp : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(true); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureAbyss/AbyssLantern.cs b/Tiles/FurnitureAbyss/AbyssLantern.cs index a9a39aee2a..fb138e3c65 100644 --- a/Tiles/FurnitureAbyss/AbyssLantern.cs +++ b/Tiles/FurnitureAbyss/AbyssLantern.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssLantern : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureAbyss/AbyssPiano.cs b/Tiles/FurnitureAbyss/AbyssPiano.cs index 1efde13613..aa146eb5f2 100644 --- a/Tiles/FurnitureAbyss/AbyssPiano.cs +++ b/Tiles/FurnitureAbyss/AbyssPiano.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssPiano : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAbyss/AbyssSink.cs b/Tiles/FurnitureAbyss/AbyssSink.cs index 38d7341900..ff8c4a4aec 100644 --- a/Tiles/FurnitureAbyss/AbyssSink.cs +++ b/Tiles/FurnitureAbyss/AbyssSink.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssSink : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); diff --git a/Tiles/FurnitureAbyss/AbyssSofa.cs b/Tiles/FurnitureAbyss/AbyssSofa.cs index 6d13623bc4..13141f7582 100644 --- a/Tiles/FurnitureAbyss/AbyssSofa.cs +++ b/Tiles/FurnitureAbyss/AbyssSofa.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssSofa : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAbyss/AbyssTable.cs b/Tiles/FurnitureAbyss/AbyssTable.cs index 60fafa7e08..e60f3a1ff1 100644 --- a/Tiles/FurnitureAbyss/AbyssTable.cs +++ b/Tiles/FurnitureAbyss/AbyssTable.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssTable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); diff --git a/Tiles/FurnitureAbyss/AbyssTorch.cs b/Tiles/FurnitureAbyss/AbyssTorch.cs index 6a2bbe63e2..025e16185a 100644 --- a/Tiles/FurnitureAbyss/AbyssTorch.cs +++ b/Tiles/FurnitureAbyss/AbyssTorch.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssTorch : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTorch(true, true); ModTranslation name = CreateMapEntryName(); @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { Tile tile = Main.tile[i, j]; - if (tile.frameX < 66) + if (tile.TileFrameX < 66) { r = 0.9f; g = 0.9f; @@ -66,15 +66,15 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAbyss/AbyssTorchFlame"), i, j, 2); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAbyss/AbyssTorchFlame"), i, j, 2); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { - if (Main.tile[i, j].frameX < 66) + if (Main.tile[i, j].TileFrameX < 66) CalamityUtils.DrawFlameSparks(187, 5, i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; diff --git a/Tiles/FurnitureAbyss/AbyssWorkbench.cs b/Tiles/FurnitureAbyss/AbyssWorkbench.cs index de2a008120..ad5141d72f 100644 --- a/Tiles/FurnitureAbyss/AbyssWorkbench.cs +++ b/Tiles/FurnitureAbyss/AbyssWorkbench.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssWorkbench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs b/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs index f40f991a5e..1676902c8e 100644 --- a/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs +++ b/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class SmoothAbyssGravel : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; diff --git a/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs b/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs index 77363a8ff6..25b8126a40 100644 --- a/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs +++ b/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class SmoothAbyssGravelPlatform : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); soundType = SoundID.Tink; diff --git a/Tiles/FurnitureAcidwood/AcidwoodBathTile.cs b/Tiles/FurnitureAcidwood/AcidwoodBathTile.cs index bdf2e0e51d..08e45bc6d0 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodBathTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodBathTile.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodBathTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs b/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs index 0b15b66058..62c8b78756 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodBedTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(); ModTranslation name = CreateMapEntryName(); @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); public override void MouseOver(int i, int j) { diff --git a/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs b/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs index ed71629cbc..d0ce2be095 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodBenchTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAcidwood/AcidwoodBookcaseTile.cs b/Tiles/FurnitureAcidwood/AcidwoodBookcaseTile.cs index 0a6841f89c..79f280be1b 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodBookcaseTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodBookcaseTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodBookcaseTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs b/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs index f8f98de156..76e9105b5e 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodCandelabraTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(); ModTranslation name = CreateMapEntryName(); @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAcidwood/AcidwoodCandelabraTileFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAcidwood/AcidwoodCandelabraTileFlame"), i, j); } } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs b/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs index cc4ea77805..d1fe7ded70 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodCandleTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(); ModTranslation name = CreateMapEntryName(); @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -60,7 +60,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; @@ -68,7 +68,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAcidwood/AcidwoodCandleTileFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAcidwood/AcidwoodCandleTileFlame"), i, j); } } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs b/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs index 0e4fb814a6..c49241e0f6 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodChairTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; diff --git a/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs b/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs index e364cc5805..ba0eb91eeb 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodChandelierTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -56,7 +56,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAcidwood/AcidwoodChandelierTileFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAcidwood/AcidwoodChandelierTileFlame"), i, j); } } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodChestTile.cs b/Tiles/FurnitureAcidwood/AcidwoodChestTile.cs index 8e86ccdcd5..0a9350ddad 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodChestTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodChestTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodChestTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(true); ModTranslation name = CreateMapEntryName(); @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver("Acidwood Chest", i, j); diff --git a/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs b/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs index d7c1b0b371..f6d2c46cb4 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodClockTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(); ModTranslation name = CreateMapEntryName(); @@ -25,7 +25,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood return false; } - public override bool NewRightClick(int x, int y) => CalamityUtils.ClockRightClick(); + public override bool RightClick(int x, int y) => CalamityUtils.ClockRightClick(); public override void NearbyEffects(int i, int j, bool closer) { diff --git a/Tiles/FurnitureAcidwood/AcidwoodDoorClosed.cs b/Tiles/FurnitureAcidwood/AcidwoodDoorClosed.cs index af9ee0970f..94f02cd23a 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodDoorClosed.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodDoorClosed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureAcidwood/AcidwoodDoorOpen.cs b/Tiles/FurnitureAcidwood/AcidwoodDoorOpen.cs index 25994515ea..8304dec737 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodDoorOpen.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodDoorOpen.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureAcidwood/AcidwoodDresserTile.cs b/Tiles/FurnitureAcidwood/AcidwoodDresserTile.cs index 041f82b753..2cb72d9dd7 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodDresserTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodDresserTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodDresserTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool HasSmartInteract() => true; - public override bool NewRightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(chest); diff --git a/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs b/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs index ef4224acaf..51518c3002 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodLampTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAcidwood/AcidwoodLampTileFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAcidwood/AcidwoodLampTileFlame"), i, j); } } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs b/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs index 466c7f6c35..924b5388b3 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodLanternTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAcidwood/AcidwoodLanternTileFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAcidwood/AcidwoodLanternTileFlame"), i, j); } } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodPianoTile.cs b/Tiles/FurnitureAcidwood/AcidwoodPianoTile.cs index aabd6423d5..020ffb06fa 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodPianoTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodPianoTile.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodPianoTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPiano(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAcidwood/AcidwoodPlatformTile.cs b/Tiles/FurnitureAcidwood/AcidwoodPlatformTile.cs index 6880fb3b64..23f2b6dcda 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodPlatformTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodPlatformTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodPlatformTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(); AddMapEntry(new Color(218, 169, 97)); diff --git a/Tiles/FurnitureAcidwood/AcidwoodSinkTile.cs b/Tiles/FurnitureAcidwood/AcidwoodSinkTile.cs index b22b508b89..77eb4cf0f2 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodSinkTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodSinkTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodSinkTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); diff --git a/Tiles/FurnitureAcidwood/AcidwoodTableTile.cs b/Tiles/FurnitureAcidwood/AcidwoodTableTile.cs index 3c681c4f5e..8cd779df19 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodTableTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodTableTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodTableTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); diff --git a/Tiles/FurnitureAcidwood/AcidwoodWorkbenchTile.cs b/Tiles/FurnitureAcidwood/AcidwoodWorkbenchTile.cs index 2901acdb56..198e210550 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodWorkbenchTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodWorkbenchTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodWorkbenchTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAncient/AncientBasin.cs b/Tiles/FurnitureAncient/AncientBasin.cs index 61b9ed3bd6..6bfd9796f7 100644 --- a/Tiles/FurnitureAncient/AncientBasin.cs +++ b/Tiles/FurnitureAncient/AncientBasin.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { int animationFrame = 0; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -52,7 +52,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { Tile tile = Main.tile[i, j]; - if (tile.frameX < 54) + if (tile.TileFrameX < 54) { r = 1f; g = 0.5f; @@ -72,13 +72,13 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawStaticFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAncient/AncientBasinFlame"), i, j, offsetY: animationFrame * animationFrameHeight); + CalamityUtils.DrawStaticFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAncient/AncientBasinFlame"), i, j, offsetY: animationFrame * animationFrameHeight); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { Tile tile = Main.tile[i, j]; - if (tile.frameY == 18 && tile.frameX < 54) + if (tile.TileFrameY == 18 && tile.TileFrameX < 54) { CalamityUtils.DrawFlameSparks(60, 5, i, j); } diff --git a/Tiles/FurnitureAncient/AncientBath.cs b/Tiles/FurnitureAncient/AncientBath.cs index 2700624366..5b0aa79610 100644 --- a/Tiles/FurnitureAncient/AncientBath.cs +++ b/Tiles/FurnitureAncient/AncientBath.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientBath : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAncient/AncientBed.cs b/Tiles/FurnitureAncient/AncientBed.cs index 97c2b2a23b..863d8e58f9 100644 --- a/Tiles/FurnitureAncient/AncientBed.cs +++ b/Tiles/FurnitureAncient/AncientBed.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientBed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureAncient Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.BedRightClick(i, j); } diff --git a/Tiles/FurnitureAncient/AncientBookcase.cs b/Tiles/FurnitureAncient/AncientBookcase.cs index 68ded8ea36..ebc4c315b2 100644 --- a/Tiles/FurnitureAncient/AncientBookcase.cs +++ b/Tiles/FurnitureAncient/AncientBookcase.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientBookcase : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAncient/AncientChair.cs b/Tiles/FurnitureAncient/AncientChair.cs index cbe28eab62..afe5572f6f 100644 --- a/Tiles/FurnitureAncient/AncientChair.cs +++ b/Tiles/FurnitureAncient/AncientChair.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientChair : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); diff --git a/Tiles/FurnitureAncient/AncientChandelier.cs b/Tiles/FurnitureAncient/AncientChandelier.cs index 12639ee0c6..d205735869 100644 --- a/Tiles/FurnitureAncient/AncientChandelier.cs +++ b/Tiles/FurnitureAncient/AncientChandelier.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientChandelier : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAncient/AncientChandelierFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAncient/AncientChandelierFlame"), i, j); } public override void HitWire(int i, int j) @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { Tile tile = Main.tile[i, j]; - if (tile.frameX < 54 && tile.frameY == 36) + if (tile.TileFrameX < 54 && tile.TileFrameY == 36) { CalamityUtils.DrawFlameSparks(60, 5, i, j); } diff --git a/Tiles/FurnitureAncient/AncientDoorClosed.cs b/Tiles/FurnitureAncient/AncientDoorClosed.cs index 43f972daeb..9fd79424ce 100644 --- a/Tiles/FurnitureAncient/AncientDoorClosed.cs +++ b/Tiles/FurnitureAncient/AncientDoorClosed.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureAncient/AncientDoorOpen.cs b/Tiles/FurnitureAncient/AncientDoorOpen.cs index 8d4d779747..6b57d06b49 100644 --- a/Tiles/FurnitureAncient/AncientDoorOpen.cs +++ b/Tiles/FurnitureAncient/AncientDoorOpen.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureAncient/AncientDresser.cs b/Tiles/FurnitureAncient/AncientDresser.cs index b8ff54f9ba..c615ed1f2e 100644 --- a/Tiles/FurnitureAncient/AncientDresser.cs +++ b/Tiles/FurnitureAncient/AncientDresser.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientDresser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.FurnitureAncient return true; } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurnitureAncient/AncientLamp.cs b/Tiles/FurnitureAncient/AncientLamp.cs index f13bf6571d..eecfd732b6 100644 --- a/Tiles/FurnitureAncient/AncientLamp.cs +++ b/Tiles/FurnitureAncient/AncientLamp.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientLamp : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(true); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -49,13 +49,13 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAncient/AncientLampFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAncient/AncientLampFlame"), i, j); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { Tile tile = Main.tile[i, j]; - if (tile.frameY == 18 && tile.frameX < 18) + if (tile.TileFrameY == 18 && tile.TileFrameX < 18) { CalamityUtils.DrawFlameSparks(60, 5, i, j); } diff --git a/Tiles/FurnitureAncient/AncientLantern.cs b/Tiles/FurnitureAncient/AncientLantern.cs index 55e182a0bb..26e45dc749 100644 --- a/Tiles/FurnitureAncient/AncientLantern.cs +++ b/Tiles/FurnitureAncient/AncientLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientLantern : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.5f; @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAncient/AncientLanternFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAncient/AncientLanternFlame"), i, j); } public override void HitWire(int i, int j) @@ -64,7 +64,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { Tile tile = Main.tile[i, j]; - if (tile.frameY == 18 && tile.frameX < 18) + if (tile.TileFrameY == 18 && tile.TileFrameX < 18) { CalamityUtils.DrawFlameSparks(60, 5, i, j); } diff --git a/Tiles/FurnitureAncient/AncientMonolith.cs b/Tiles/FurnitureAncient/AncientMonolith.cs index 0cde559566..4771aee57b 100644 --- a/Tiles/FurnitureAncient/AncientMonolith.cs +++ b/Tiles/FurnitureAncient/AncientMonolith.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientMonolith : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.FurnitureAncient } } - public override bool NewRightClick(int x, int y) + public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); } diff --git a/Tiles/FurnitureAncient/AncientPiano.cs b/Tiles/FurnitureAncient/AncientPiano.cs index c2a4628083..7bbc6e9f30 100644 --- a/Tiles/FurnitureAncient/AncientPiano.cs +++ b/Tiles/FurnitureAncient/AncientPiano.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientPiano : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/FurnitureAncient/AncientSink.cs b/Tiles/FurnitureAncient/AncientSink.cs index bdf01869bb..6ed42f5e67 100644 --- a/Tiles/FurnitureAncient/AncientSink.cs +++ b/Tiles/FurnitureAncient/AncientSink.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientSink : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); diff --git a/Tiles/FurnitureAncient/AncientSofa.cs b/Tiles/FurnitureAncient/AncientSofa.cs index 37fcec1092..492dbb5a97 100644 --- a/Tiles/FurnitureAncient/AncientSofa.cs +++ b/Tiles/FurnitureAncient/AncientSofa.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientSofa : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAncient/AncientTable.cs b/Tiles/FurnitureAncient/AncientTable.cs index 4db605144d..ddbf0bdc72 100644 --- a/Tiles/FurnitureAncient/AncientTable.cs +++ b/Tiles/FurnitureAncient/AncientTable.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientTable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); diff --git a/Tiles/FurnitureAncient/AncientWorkbench.cs b/Tiles/FurnitureAncient/AncientWorkbench.cs index bd48139bb7..902eccb497 100644 --- a/Tiles/FurnitureAncient/AncientWorkbench.cs +++ b/Tiles/FurnitureAncient/AncientWorkbench.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientWorkbench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAshen/AshenBasin.cs b/Tiles/FurnitureAshen/AshenBasin.cs index a195bf90f2..24307a396e 100644 --- a/Tiles/FurnitureAshen/AshenBasin.cs +++ b/Tiles/FurnitureAshen/AshenBasin.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { int animationFrame = 0; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { Tile tile = Main.tile[i, j]; //227 79 79 - if (tile.frameX < 54) + if (tile.TileFrameX < 54) { r = 1f; g = 0.5f; @@ -73,13 +73,13 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawStaticFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAshen/AshenBasinFlame"), i, j, offsetY: animationFrame * animationFrameHeight); + CalamityUtils.DrawStaticFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenBasinFlame"), i, j, offsetY: animationFrame * animationFrameHeight); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { Tile tile = Main.tile[i, j]; - if (tile.frameY == 18 && tile.frameX < 54) + if (tile.TileFrameY == 18 && tile.TileFrameX < 54) { CalamityUtils.DrawFlameSparks(60, 5, i, j); } diff --git a/Tiles/FurnitureAshen/AshenBath.cs b/Tiles/FurnitureAshen/AshenBath.cs index c7a3c302c7..f8c73db4c2 100644 --- a/Tiles/FurnitureAshen/AshenBath.cs +++ b/Tiles/FurnitureAshen/AshenBath.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenBath : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAshen/AshenBed.cs b/Tiles/FurnitureAshen/AshenBed.cs index 07784f79eb..c024721f06 100644 --- a/Tiles/FurnitureAshen/AshenBed.cs +++ b/Tiles/FurnitureAshen/AshenBed.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenBed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureAshen Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.BedRightClick(i, j); } diff --git a/Tiles/FurnitureAshen/AshenBookcase.cs b/Tiles/FurnitureAshen/AshenBookcase.cs index 8269229bd1..0870ba2af1 100644 --- a/Tiles/FurnitureAshen/AshenBookcase.cs +++ b/Tiles/FurnitureAshen/AshenBookcase.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenBookcase : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAshen/AshenCandelabra.cs b/Tiles/FurnitureAshen/AshenCandelabra.cs index b65e888432..6e068f2d1a 100644 --- a/Tiles/FurnitureAshen/AshenCandelabra.cs +++ b/Tiles/FurnitureAshen/AshenCandelabra.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { int animationFrame = 0; - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); @@ -46,7 +46,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.5f; @@ -72,12 +72,12 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawStaticFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAshen/AshenCandelabraFlame"), i, j, offsetY: animationFrame * animationFrameHeight); + CalamityUtils.DrawStaticFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenCandelabraFlame"), i, j, offsetY: animationFrame * animationFrameHeight); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { - if (Main.tile[i, j].frameX < 35) + if (Main.tile[i, j].TileFrameX < 35) CalamityUtils.DrawFlameSparks(60, 5, i, j); } } diff --git a/Tiles/FurnitureAshen/AshenCandle.cs b/Tiles/FurnitureAshen/AshenCandle.cs index 5155a4efd8..4e0a1f15c4 100644 --- a/Tiles/FurnitureAshen/AshenCandle.cs +++ b/Tiles/FurnitureAshen/AshenCandle.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.5f; @@ -60,7 +60,7 @@ namespace CalamityMod.Tiles.FurnitureAshen player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; @@ -68,12 +68,12 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAshen/AshenCandleFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenCandleFlame"), i, j); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) CalamityUtils.DrawFlameSparks(60, 5, i, j); } } diff --git a/Tiles/FurnitureAshen/AshenChair.cs b/Tiles/FurnitureAshen/AshenChair.cs index a338d8ecae..dc7b314b4a 100644 --- a/Tiles/FurnitureAshen/AshenChair.cs +++ b/Tiles/FurnitureAshen/AshenChair.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenChair : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); diff --git a/Tiles/FurnitureAshen/AshenChandelier.cs b/Tiles/FurnitureAshen/AshenChandelier.cs index 22a3238f24..6aa68b13db 100644 --- a/Tiles/FurnitureAshen/AshenChandelier.cs +++ b/Tiles/FurnitureAshen/AshenChandelier.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { int animationFrame = 0; - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.5f; @@ -70,13 +70,13 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawStaticFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAshen/AshenChandelierFlame"), i, j, offsetY: animationFrame * animationFrameHeight); + CalamityUtils.DrawStaticFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenChandelierFlame"), i, j, offsetY: animationFrame * animationFrameHeight); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { Tile tile = Main.tile[i, j]; - if (tile.frameY == 18 && tile.frameX < 54) + if (tile.TileFrameY == 18 && tile.TileFrameX < 54) { CalamityUtils.DrawFlameSparks(60, 5, i, j); } diff --git a/Tiles/FurnitureAshen/AshenChest.cs b/Tiles/FurnitureAshen/AshenChest.cs index baa98396ef..c53ffe8802 100644 --- a/Tiles/FurnitureAshen/AshenChest.cs +++ b/Tiles/FurnitureAshen/AshenChest.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenChest : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(true); ModTranslation name = CreateMapEntryName(); @@ -29,11 +29,11 @@ namespace CalamityMod.Tiles.FurnitureAshen return false; } - public override ushort GetMapOption(int i, int j) => (ushort)(Main.tile[i, j].frameX / 36); + public override ushort GetMapOption(int i, int j) => (ushort)(Main.tile[i, j].TileFrameX / 36); public override bool HasSmartInteract() => true; - public override bool IsLockedChest(int i, int j) => Main.tile[i, j].frameX / 36 == 1; + public override bool IsLockedChest(int i, int j) => Main.tile[i, j].TileFrameX / 36 == 1; public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) { @@ -54,18 +54,18 @@ namespace CalamityMod.Tiles.FurnitureAshen Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { Tile tile = Main.tile[i, j]; int left = i; int top = j; - if (tile.frameX % 36 != 0) + if (tile.TileFrameX % 36 != 0) { left--; } - if (tile.frameY != 0) + if (tile.TileFrameY != 0) { top--; } diff --git a/Tiles/FurnitureAshen/AshenDoorClosed.cs b/Tiles/FurnitureAshen/AshenDoorClosed.cs index 839459df02..05e2e05fa3 100644 --- a/Tiles/FurnitureAshen/AshenDoorClosed.cs +++ b/Tiles/FurnitureAshen/AshenDoorClosed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureAshen/AshenDoorOpen.cs b/Tiles/FurnitureAshen/AshenDoorOpen.cs index 2bb07a7282..61674eb647 100644 --- a/Tiles/FurnitureAshen/AshenDoorOpen.cs +++ b/Tiles/FurnitureAshen/AshenDoorOpen.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureAshen/AshenDresser.cs b/Tiles/FurnitureAshen/AshenDresser.cs index bad5eb2b8c..39d3dae741 100644 --- a/Tiles/FurnitureAshen/AshenDresser.cs +++ b/Tiles/FurnitureAshen/AshenDresser.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenDresser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); Main.tileLavaDeath[Type] = false; @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.FurnitureAshen return true; } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurnitureAshen/AshenLamp.cs b/Tiles/FurnitureAshen/AshenLamp.cs index 208847eea6..c8265017ea 100644 --- a/Tiles/FurnitureAshen/AshenLamp.cs +++ b/Tiles/FurnitureAshen/AshenLamp.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenLamp : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(true); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.5f; @@ -58,13 +58,13 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAshen/AshenLampFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenLampFlame"), i, j); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { Tile tile = Main.tile[i, j]; - if (tile.frameY == 0 && tile.frameX < 18) + if (tile.TileFrameY == 0 && tile.TileFrameX < 18) { CalamityUtils.DrawFlameSparks(60, 5, i, j); } diff --git a/Tiles/FurnitureAshen/AshenLantern.cs b/Tiles/FurnitureAshen/AshenLantern.cs index 358ba7e3f9..23effcf37c 100644 --- a/Tiles/FurnitureAshen/AshenLantern.cs +++ b/Tiles/FurnitureAshen/AshenLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenLantern : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.5f; @@ -58,13 +58,13 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAshen/AshenLanternFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenLanternFlame"), i, j); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { Tile tile = Main.tile[i, j]; - if (tile.frameY == 18 && tile.frameX < 18) + if (tile.TileFrameY == 18 && tile.TileFrameX < 18) { CalamityUtils.DrawFlameSparks(60, 5, i, j); } diff --git a/Tiles/FurnitureAshen/AshenMonolith.cs b/Tiles/FurnitureAshen/AshenMonolith.cs index 34405c0cba..30995d3c3a 100644 --- a/Tiles/FurnitureAshen/AshenMonolith.cs +++ b/Tiles/FurnitureAshen/AshenMonolith.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenMonolith : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureAshen b = 0.5f; } - public override bool NewRightClick(int x, int y) + public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); } @@ -66,9 +66,9 @@ namespace CalamityMod.Tiles.FurnitureAshen //This is used to draw the eye, where the frame is changed depending on the player's position relative to the eye's centre. Tile currentTile = Main.tile[i, j]; Vector2 eyeCentre = new Vector2(i * 16, j * 16); - if (currentTile.frameX == 0) + if (currentTile.TileFrameX == 0) { eyeCentre += new Vector2(16f, 0f); } - if (currentTile.frameY == 0) + if (currentTile.TileFrameY == 0) { eyeCentre += new Vector2(0f, 16f); } //The eye should track the closest player Vector2 playerPos = eyeCentre; @@ -131,12 +131,12 @@ namespace CalamityMod.Tiles.FurnitureAshen frameY *= 90; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Texture2D eyeSheet = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAshen/AshenMonolith_Eye"); + Texture2D eyeSheet = ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenMonolith_Eye"); spriteBatch.Draw ( eyeSheet, drawOffset, - new Rectangle(frameX + currentTile.frameX, frameY + currentTile.frameY, 16, 16), + new Rectangle(frameX + currentTile.TileFrameX, frameY + currentTile.TileFrameY, 16, 16), new Color(255, 255, 255, 255), 0, new Vector2(0f, 0f), diff --git a/Tiles/FurnitureAshen/AshenPiano.cs b/Tiles/FurnitureAshen/AshenPiano.cs index a079c651b8..6fe7089d74 100644 --- a/Tiles/FurnitureAshen/AshenPiano.cs +++ b/Tiles/FurnitureAshen/AshenPiano.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenPiano : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/FurnitureAshen/AshenPlatform.cs b/Tiles/FurnitureAshen/AshenPlatform.cs index 381c112814..96c293ee08 100644 --- a/Tiles/FurnitureAshen/AshenPlatform.cs +++ b/Tiles/FurnitureAshen/AshenPlatform.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenPlatform : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); diff --git a/Tiles/FurnitureAshen/AshenSink.cs b/Tiles/FurnitureAshen/AshenSink.cs index b401fb07c0..95a9ba9cce 100644 --- a/Tiles/FurnitureAshen/AshenSink.cs +++ b/Tiles/FurnitureAshen/AshenSink.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenSink : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); diff --git a/Tiles/FurnitureAshen/AshenSlab.cs b/Tiles/FurnitureAshen/AshenSlab.cs index 45c58df56c..e583f9875d 100644 --- a/Tiles/FurnitureAshen/AshenSlab.cs +++ b/Tiles/FurnitureAshen/AshenSlab.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenSlab : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; @@ -505,11 +505,11 @@ namespace CalamityMod.Tiles.FurnitureAshen } int animationFrameHeight = 90; int animationFrameWidth = 234; - int xDrawPos = Main.tile[i, j].frameX + (uniqueAnimationFrameX * animationFrameWidth); - int yDrawPos = Main.tile[i, j].frameY + (uniqueAnimationFrameY * animationFrameHeight); + int xDrawPos = Main.tile[i, j].TileFrameX + (uniqueAnimationFrameX * animationFrameWidth); + int yDrawPos = Main.tile[i, j].TileFrameY + (uniqueAnimationFrameY * animationFrameHeight); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAshen/AshenSlabGlow"); + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenSlabGlow"); Color drawColour = GetDrawColour(i, j, new Color(64, 64, 64, 64)); Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; diff --git a/Tiles/FurnitureAshen/AshenSofa.cs b/Tiles/FurnitureAshen/AshenSofa.cs index 375b1f5b93..5f36dc2174 100644 --- a/Tiles/FurnitureAshen/AshenSofa.cs +++ b/Tiles/FurnitureAshen/AshenSofa.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenSofa : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAshen/AshenTable.cs b/Tiles/FurnitureAshen/AshenTable.cs index d1f9913f34..7c6492facf 100644 --- a/Tiles/FurnitureAshen/AshenTable.cs +++ b/Tiles/FurnitureAshen/AshenTable.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenTable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); diff --git a/Tiles/FurnitureAshen/AshenWorkbench.cs b/Tiles/FurnitureAshen/AshenWorkbench.cs index b6f9d4b2ba..65ebf80610 100644 --- a/Tiles/FurnitureAshen/AshenWorkbench.cs +++ b/Tiles/FurnitureAshen/AshenWorkbench.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenWorkbench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs index 411eb514f1..d80d90efd6 100644 --- a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs +++ b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class SmoothBrimstoneSlag : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; @@ -35,9 +35,9 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAshen/SmoothBrimstoneSlagGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAshen/SmoothBrimstoneSlagGlow"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j, new Color(25, 25, 25, 25)); diff --git a/Tiles/FurnitureAstral/MonolithBathtub.cs b/Tiles/FurnitureAstral/MonolithBathtub.cs index bf3190a214..97522daed9 100644 --- a/Tiles/FurnitureAstral/MonolithBathtub.cs +++ b/Tiles/FurnitureAstral/MonolithBathtub.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithBathtub : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); @@ -29,9 +29,9 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithBathtubGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithBathtubGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/FurnitureAstral/MonolithBed.cs b/Tiles/FurnitureAstral/MonolithBed.cs index 9006b9e169..9e9df25975 100644 --- a/Tiles/FurnitureAstral/MonolithBed.cs +++ b/Tiles/FurnitureAstral/MonolithBed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithBed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); @@ -33,9 +33,9 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithBedGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithBedGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -65,7 +65,7 @@ namespace CalamityMod.Tiles.FurnitureAstral Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.BedRightClick(i, j); } diff --git a/Tiles/FurnitureAstral/MonolithBench.cs b/Tiles/FurnitureAstral/MonolithBench.cs index 55177faf42..0f2d1bc749 100644 --- a/Tiles/FurnitureAstral/MonolithBench.cs +++ b/Tiles/FurnitureAstral/MonolithBench.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithBench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); @@ -28,9 +28,9 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithBenchGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithBenchGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/FurnitureAstral/MonolithBookcase.cs b/Tiles/FurnitureAstral/MonolithBookcase.cs index 9722aef922..7eb4b7e2f0 100644 --- a/Tiles/FurnitureAstral/MonolithBookcase.cs +++ b/Tiles/FurnitureAstral/MonolithBookcase.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithBookcase : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(true, false); ModTranslation name = CreateMapEntryName(); @@ -32,9 +32,9 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithBookcaseGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithBookcaseGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/FurnitureAstral/MonolithCandelabra.cs b/Tiles/FurnitureAstral/MonolithCandelabra.cs index a8e2129b24..0337119d1d 100644 --- a/Tiles/FurnitureAstral/MonolithCandelabra.cs +++ b/Tiles/FurnitureAstral/MonolithCandelabra.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithCandelabra : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); @@ -32,15 +32,15 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithCandelabraGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithCandelabraGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - Texture2D glowmaskBright = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithCandelabraFlame"); + Texture2D glowmaskBright = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithCandelabraFlame"); Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } @@ -59,7 +59,7 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureAstral/MonolithCandle.cs b/Tiles/FurnitureAstral/MonolithCandle.cs index 54aa7c084d..df4664ea01 100644 --- a/Tiles/FurnitureAstral/MonolithCandle.cs +++ b/Tiles/FurnitureAstral/MonolithCandle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); @@ -33,15 +33,15 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithCandleGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithCandleGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y - 4) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 20)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - Texture2D glowmaskBright = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithCandleFlame"); + Texture2D glowmaskBright = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithCandleFlame"); Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 20)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } @@ -60,7 +60,7 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -87,7 +87,7 @@ namespace CalamityMod.Tiles.FurnitureAstral player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; diff --git a/Tiles/FurnitureAstral/MonolithChair.cs b/Tiles/FurnitureAstral/MonolithChair.cs index f3dec38edd..f5e599fea8 100644 --- a/Tiles/FurnitureAstral/MonolithChair.cs +++ b/Tiles/FurnitureAstral/MonolithChair.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithChair : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); @@ -31,9 +31,9 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithChairGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithChairGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/FurnitureAstral/MonolithChandelier.cs b/Tiles/FurnitureAstral/MonolithChandelier.cs index f8fd95d357..a24ece281a 100644 --- a/Tiles/FurnitureAstral/MonolithChandelier.cs +++ b/Tiles/FurnitureAstral/MonolithChandelier.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithChandelier : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -30,15 +30,15 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithChandelierGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithChandelierGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - Texture2D glowmaskBright = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithChandelierFlame"); + Texture2D glowmaskBright = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithChandelierFlame"); Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } @@ -57,7 +57,7 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureAstral/MonolithChest.cs b/Tiles/FurnitureAstral/MonolithChest.cs index 6223834471..c9f7a7886d 100644 --- a/Tiles/FurnitureAstral/MonolithChest.cs +++ b/Tiles/FurnitureAstral/MonolithChest.cs @@ -4,12 +4,13 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithChest : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(); ModTranslation name = CreateMapEntryName(); @@ -34,9 +35,9 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithChestGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithChestGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -69,7 +70,7 @@ namespace CalamityMod.Tiles.FurnitureAstral Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { // Glowmask animation & custom sound Player player = Main.LocalPlayer; @@ -77,11 +78,11 @@ namespace CalamityMod.Tiles.FurnitureAstral Main.mouseRightRelease = false; int left = i; int top = j; - if (tile.frameX % 36 != 0) + if (tile.TileFrameX % 36 != 0) { left--; } - if (tile.frameY != 0) + if (tile.TileFrameY != 0) { top--; } @@ -92,7 +93,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { if (player.chest < 0) { - Main.PlaySound(SoundID.NPCKilled, Style: 22, volumeScale: 0.5f); + SoundEngine.PlaySound(SoundID.NPCKilled, Style: 22, volumeScale: 0.5f); } } } diff --git a/Tiles/FurnitureAstral/MonolithClock.cs b/Tiles/FurnitureAstral/MonolithClock.cs index 276d85dec1..189d95fa2b 100644 --- a/Tiles/FurnitureAstral/MonolithClock.cs +++ b/Tiles/FurnitureAstral/MonolithClock.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithClock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); @@ -36,9 +36,9 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithClockGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithClockGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.FurnitureAstral return colour; } - public override bool NewRightClick(int x, int y) + public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); } diff --git a/Tiles/FurnitureAstral/MonolithDoorClosed.cs b/Tiles/FurnitureAstral/MonolithDoorClosed.cs index fc9d4e11cd..9d9d673b5a 100644 --- a/Tiles/FurnitureAstral/MonolithDoorClosed.cs +++ b/Tiles/FurnitureAstral/MonolithDoorClosed.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); @@ -32,9 +32,9 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithDoorClosedGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithDoorClosedGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/FurnitureAstral/MonolithDoorOpen.cs b/Tiles/FurnitureAstral/MonolithDoorOpen.cs index 4f9d3e5249..efb463019f 100644 --- a/Tiles/FurnitureAstral/MonolithDoorOpen.cs +++ b/Tiles/FurnitureAstral/MonolithDoorOpen.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); @@ -32,9 +32,9 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithDoorOpenGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithDoorOpenGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/FurnitureAstral/MonolithDresser.cs b/Tiles/FurnitureAstral/MonolithDresser.cs index d28ef307f0..27b914b461 100644 --- a/Tiles/FurnitureAstral/MonolithDresser.cs +++ b/Tiles/FurnitureAstral/MonolithDresser.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithDresser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -29,9 +29,9 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithDresserGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithDresserGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -56,7 +56,7 @@ namespace CalamityMod.Tiles.FurnitureAstral return true; } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurnitureAstral/MonolithLamp.cs b/Tiles/FurnitureAstral/MonolithLamp.cs index 31123c554f..3f604980e7 100644 --- a/Tiles/FurnitureAstral/MonolithLamp.cs +++ b/Tiles/FurnitureAstral/MonolithLamp.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithLamp : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(true); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -37,15 +37,15 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithLampGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithLampGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - Texture2D glowmaskBright = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithLampFlame"); + Texture2D glowmaskBright = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithLampFlame"); Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } @@ -64,7 +64,7 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureAstral/MonolithLantern.cs b/Tiles/FurnitureAstral/MonolithLantern.cs index 3ad1698ea5..1a155380c6 100644 --- a/Tiles/FurnitureAstral/MonolithLantern.cs +++ b/Tiles/FurnitureAstral/MonolithLantern.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithLantern : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -32,15 +32,15 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithLanternGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithLanternGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - Texture2D glowmaskBright = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithLanternFlame"); + Texture2D glowmaskBright = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithLanternFlame"); Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } @@ -64,7 +64,7 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureAstral/MonolithPiano.cs b/Tiles/FurnitureAstral/MonolithPiano.cs index 05fe0d1fb7..1555ebfa13 100644 --- a/Tiles/FurnitureAstral/MonolithPiano.cs +++ b/Tiles/FurnitureAstral/MonolithPiano.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithPiano : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); @@ -29,9 +29,9 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithPianoGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithPianoGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/FurnitureAstral/MonolithPlatform.cs b/Tiles/FurnitureAstral/MonolithPlatform.cs index d9b9d872f3..51548dee83 100644 --- a/Tiles/FurnitureAstral/MonolithPlatform.cs +++ b/Tiles/FurnitureAstral/MonolithPlatform.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithPlatform : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); diff --git a/Tiles/FurnitureAstral/MonolithSink.cs b/Tiles/FurnitureAstral/MonolithSink.cs index d80e94df17..8d1672264d 100644 --- a/Tiles/FurnitureAstral/MonolithSink.cs +++ b/Tiles/FurnitureAstral/MonolithSink.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithSink : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); @@ -30,9 +30,9 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithSinkGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithSinkGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/FurnitureAstral/MonolithTable.cs b/Tiles/FurnitureAstral/MonolithTable.cs index 6663b93692..671b2bfbc7 100644 --- a/Tiles/FurnitureAstral/MonolithTable.cs +++ b/Tiles/FurnitureAstral/MonolithTable.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithTable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); @@ -30,9 +30,9 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithTableGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithTableGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/FurnitureAstral/MonolithWorkbench.cs b/Tiles/FurnitureAstral/MonolithWorkbench.cs index cad2e75f18..e56e937c92 100644 --- a/Tiles/FurnitureAstral/MonolithWorkbench.cs +++ b/Tiles/FurnitureAstral/MonolithWorkbench.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public class MonolithWorkBench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); @@ -32,9 +32,9 @@ namespace CalamityMod.Tiles.FurnitureAstral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureAstral/MonolithWorkBenchGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAstral/MonolithWorkBenchGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/FurnitureBotanic/BotanicBathtub.cs b/Tiles/FurnitureBotanic/BotanicBathtub.cs index bd94588bd8..3dc9b04bea 100644 --- a/Tiles/FurnitureBotanic/BotanicBathtub.cs +++ b/Tiles/FurnitureBotanic/BotanicBathtub.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicBathtub : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureBotanic/BotanicBed.cs b/Tiles/FurnitureBotanic/BotanicBed.cs index 7ef1cd0e63..540648edee 100644 --- a/Tiles/FurnitureBotanic/BotanicBed.cs +++ b/Tiles/FurnitureBotanic/BotanicBed.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicBed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.BedRightClick(i, j); } diff --git a/Tiles/FurnitureBotanic/BotanicBench.cs b/Tiles/FurnitureBotanic/BotanicBench.cs index 48a128fa58..a5c1f09f8e 100644 --- a/Tiles/FurnitureBotanic/BotanicBench.cs +++ b/Tiles/FurnitureBotanic/BotanicBench.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicBench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureBotanic/BotanicBookcase.cs b/Tiles/FurnitureBotanic/BotanicBookcase.cs index 8045439f73..ad742fbfa1 100644 --- a/Tiles/FurnitureBotanic/BotanicBookcase.cs +++ b/Tiles/FurnitureBotanic/BotanicBookcase.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicBookcase : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureBotanic/BotanicCandelabra.cs b/Tiles/FurnitureBotanic/BotanicCandelabra.cs index a165064ffb..083083e8d8 100644 --- a/Tiles/FurnitureBotanic/BotanicCandelabra.cs +++ b/Tiles/FurnitureBotanic/BotanicCandelabra.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicCandelabra : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureBotanic/BotanicCandle.cs b/Tiles/FurnitureBotanic/BotanicCandle.cs index 00fc06acec..45bb3865fa 100644 --- a/Tiles/FurnitureBotanic/BotanicCandle.cs +++ b/Tiles/FurnitureBotanic/BotanicCandle.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -60,7 +60,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; diff --git a/Tiles/FurnitureBotanic/BotanicChair.cs b/Tiles/FurnitureBotanic/BotanicChair.cs index 22e3eb74cd..05d55e6e64 100644 --- a/Tiles/FurnitureBotanic/BotanicChair.cs +++ b/Tiles/FurnitureBotanic/BotanicChair.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicChair : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); diff --git a/Tiles/FurnitureBotanic/BotanicChandelier.cs b/Tiles/FurnitureBotanic/BotanicChandelier.cs index 56b6707e6c..ab4f9c7f62 100644 --- a/Tiles/FurnitureBotanic/BotanicChandelier.cs +++ b/Tiles/FurnitureBotanic/BotanicChandelier.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicChandelier : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureBotanic/BotanicChest.cs b/Tiles/FurnitureBotanic/BotanicChest.cs index 35520d7182..80d17be228 100644 --- a/Tiles/FurnitureBotanic/BotanicChest.cs +++ b/Tiles/FurnitureBotanic/BotanicChest.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicChest : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(true); ModTranslation name = CreateMapEntryName(); @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.ChestRightClick(i, j); } diff --git a/Tiles/FurnitureBotanic/BotanicClock.cs b/Tiles/FurnitureBotanic/BotanicClock.cs index 68a355a7ff..aaf207b248 100644 --- a/Tiles/FurnitureBotanic/BotanicClock.cs +++ b/Tiles/FurnitureBotanic/BotanicClock.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicClock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); @@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic num = fail ? 1 : 3; } - public override bool NewRightClick(int x, int y) + public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); } diff --git a/Tiles/FurnitureBotanic/BotanicDoorClosed.cs b/Tiles/FurnitureBotanic/BotanicDoorClosed.cs index c394d6b123..7efb7ff68c 100644 --- a/Tiles/FurnitureBotanic/BotanicDoorClosed.cs +++ b/Tiles/FurnitureBotanic/BotanicDoorClosed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureBotanic/BotanicDoorOpen.cs b/Tiles/FurnitureBotanic/BotanicDoorOpen.cs index 7e551bee92..846a69bd5e 100644 --- a/Tiles/FurnitureBotanic/BotanicDoorOpen.cs +++ b/Tiles/FurnitureBotanic/BotanicDoorOpen.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureBotanic/BotanicDresser.cs b/Tiles/FurnitureBotanic/BotanicDresser.cs index a68fb8cb97..3d6f99307d 100644 --- a/Tiles/FurnitureBotanic/BotanicDresser.cs +++ b/Tiles/FurnitureBotanic/BotanicDresser.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicDresser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic return true; } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurnitureBotanic/BotanicLamp.cs b/Tiles/FurnitureBotanic/BotanicLamp.cs index 8a144cc5c0..5241dbc745 100644 --- a/Tiles/FurnitureBotanic/BotanicLamp.cs +++ b/Tiles/FurnitureBotanic/BotanicLamp.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicLamp : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(true); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureBotanic/BotanicLantern.cs b/Tiles/FurnitureBotanic/BotanicLantern.cs index a8682e1b1e..aad814aa15 100644 --- a/Tiles/FurnitureBotanic/BotanicLantern.cs +++ b/Tiles/FurnitureBotanic/BotanicLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicLantern : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureBotanic/BotanicPiano.cs b/Tiles/FurnitureBotanic/BotanicPiano.cs index c2c4bc4a1b..00a24bbb04 100644 --- a/Tiles/FurnitureBotanic/BotanicPiano.cs +++ b/Tiles/FurnitureBotanic/BotanicPiano.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicPiano : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureBotanic/BotanicPlatform.cs b/Tiles/FurnitureBotanic/BotanicPlatform.cs index 41c4512bbe..ae611dedc3 100644 --- a/Tiles/FurnitureBotanic/BotanicPlatform.cs +++ b/Tiles/FurnitureBotanic/BotanicPlatform.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicPlatform : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); diff --git a/Tiles/FurnitureBotanic/BotanicSink.cs b/Tiles/FurnitureBotanic/BotanicSink.cs index 929d34a9d2..b3096c3454 100644 --- a/Tiles/FurnitureBotanic/BotanicSink.cs +++ b/Tiles/FurnitureBotanic/BotanicSink.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicSink : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); diff --git a/Tiles/FurnitureBotanic/BotanicTable.cs b/Tiles/FurnitureBotanic/BotanicTable.cs index 809245d850..f78176384c 100644 --- a/Tiles/FurnitureBotanic/BotanicTable.cs +++ b/Tiles/FurnitureBotanic/BotanicTable.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicTable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); diff --git a/Tiles/FurnitureBotanic/BotanicWorkBench.cs b/Tiles/FurnitureBotanic/BotanicWorkBench.cs index b5d573c6fc..1cf451ff50 100644 --- a/Tiles/FurnitureBotanic/BotanicWorkBench.cs +++ b/Tiles/FurnitureBotanic/BotanicWorkBench.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicWorkBench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs index 2e7f5739db..1c3c13b82d 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { int animationFrame = 0; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -56,7 +56,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { Tile tile = Main.tile[i, j]; //227 79 79 - if (tile.frameX < 54) + if (tile.TileFrameX < 54) { r = 1f; g = 0.6f; @@ -76,13 +76,13 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawStaticFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureCosmilite/CosmiliteBasinFlame"), i, j, offsetY: animationFrame * animationFrameHeight); + CalamityUtils.DrawStaticFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureCosmilite/CosmiliteBasinFlame"), i, j, offsetY: animationFrame * animationFrameHeight); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { Tile tile = Main.tile[i, j]; - if (tile.frameY == 18 && tile.frameX < 54) + if (tile.TileFrameY == 18 && tile.TileFrameX < 54) { CalamityUtils.DrawFlameSparks((int)CalamityDusts.PurpleCosmilite, 5, i, j); } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBath.cs b/Tiles/FurnitureCosmilite/CosmiliteBath.cs index e45b194d49..de7fdd20e9 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBath.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBath.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteBath : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureCosmilite/CosmiliteBed.cs b/Tiles/FurnitureCosmilite/CosmiliteBed.cs index 6064cdecfe..d6bf9c33d2 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBed.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteBed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.BedRightClick(i, j); } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs b/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs index 3cc7981333..9a2ce2f407 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteBookcase : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs index 99318a382d..5adc202c78 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteBrick : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -33,9 +33,9 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureCosmilite/CosmiliteBrickGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureCosmilite/CosmiliteBrickGlow"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j, Color.White); diff --git a/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs b/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs index a7b5550f61..05ab9c7887 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteCandelabra : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.6f; diff --git a/Tiles/FurnitureCosmilite/CosmiliteCandle.cs b/Tiles/FurnitureCosmilite/CosmiliteCandle.cs index 389f844c97..a6a4c1cb9c 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteCandle.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteCandle.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.6f; @@ -59,7 +59,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; diff --git a/Tiles/FurnitureCosmilite/CosmiliteChair.cs b/Tiles/FurnitureCosmilite/CosmiliteChair.cs index 2d08970e97..68169c893b 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChair.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChair.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteChair : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); diff --git a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs index 3e8a6098f6..dd40187b9c 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteChandelier : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -29,7 +29,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.6f; diff --git a/Tiles/FurnitureCosmilite/CosmiliteChest.cs b/Tiles/FurnitureCosmilite/CosmiliteChest.cs index 99661e3e9c..dc03a1375f 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChest.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChest.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteChest : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(); ModTranslation name = CreateMapEntryName(); @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.ChestRightClick(i, j); } diff --git a/Tiles/FurnitureCosmilite/CosmiliteClock.cs b/Tiles/FurnitureCosmilite/CosmiliteClock.cs index 85c63bed20..5f597ba713 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteClock.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteClock.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteClock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite return false; } - public override bool NewRightClick(int x, int y) + public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); } diff --git a/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs b/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs index 7e56301394..cfce61f4a5 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs b/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs index 70c73dc093..4ad5295a19 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureCosmilite/CosmiliteDresser.cs b/Tiles/FurnitureCosmilite/CosmiliteDresser.cs index 05d9706986..12ce3b5b63 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDresser.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDresser.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteDresser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite return true; } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurnitureCosmilite/CosmiliteLamp.cs b/Tiles/FurnitureCosmilite/CosmiliteLamp.cs index 51ec4cb834..25791d60d5 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteLamp.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteLamp.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteLamp : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(true); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -36,7 +36,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.6f; diff --git a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs index c66ab9754a..bac0b40090 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteLantern : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -36,7 +36,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.6f; diff --git a/Tiles/FurnitureCosmilite/CosmilitePiano.cs b/Tiles/FurnitureCosmilite/CosmilitePiano.cs index cdf8c18762..c0c0d101f2 100644 --- a/Tiles/FurnitureCosmilite/CosmilitePiano.cs +++ b/Tiles/FurnitureCosmilite/CosmilitePiano.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmilitePiano : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureCosmilite/CosmilitePlatform.cs b/Tiles/FurnitureCosmilite/CosmilitePlatform.cs index fbd647b24f..4dc532a601 100644 --- a/Tiles/FurnitureCosmilite/CosmilitePlatform.cs +++ b/Tiles/FurnitureCosmilite/CosmilitePlatform.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmilitePlatform : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); diff --git a/Tiles/FurnitureCosmilite/CosmiliteSconce.cs b/Tiles/FurnitureCosmilite/CosmiliteSconce.cs index 0e3d6c437e..1d4d7a2fb6 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSconce.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSconce.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteSconce : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -49,7 +49,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.6f; diff --git a/Tiles/FurnitureCosmilite/CosmiliteSink.cs b/Tiles/FurnitureCosmilite/CosmiliteSink.cs index f73a679bea..07bb03b80b 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSink.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSink.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteSink : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); diff --git a/Tiles/FurnitureCosmilite/CosmiliteSofa.cs b/Tiles/FurnitureCosmilite/CosmiliteSofa.cs index fa0b758460..4f8b3f55bf 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSofa.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSofa.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteSofa : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureCosmilite/CosmiliteTable.cs b/Tiles/FurnitureCosmilite/CosmiliteTable.cs index af476d0006..50ecbf1f2c 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteTable.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteTable.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteTable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); diff --git a/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs b/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs index cd3493279b..730c69dbc3 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteWorkbench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureEutrophic/EutrophicBathtub.cs b/Tiles/FurnitureEutrophic/EutrophicBathtub.cs index bc5498dc7e..d0d843a504 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBathtub.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBathtub.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicBathtub : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(); TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); diff --git a/Tiles/FurnitureEutrophic/EutrophicBed.cs b/Tiles/FurnitureEutrophic/EutrophicBed.cs index 095c69adee..73cbe2810e 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBed.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBed.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicBed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(); ModTranslation name = CreateMapEntryName(); @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.BedRightClick(i, j); } diff --git a/Tiles/FurnitureEutrophic/EutrophicBench.cs b/Tiles/FurnitureEutrophic/EutrophicBench.cs index 3217ab9c4e..795a5a1e89 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBench.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBench.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicBench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureEutrophic/EutrophicBookcase.cs b/Tiles/FurnitureEutrophic/EutrophicBookcase.cs index 89ff821f32..122d92e654 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBookcase.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBookcase.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicBookcase : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureEutrophic/EutrophicCandelabra.cs b/Tiles/FurnitureEutrophic/EutrophicCandelabra.cs index a1ee07c155..8dee078066 100644 --- a/Tiles/FurnitureEutrophic/EutrophicCandelabra.cs +++ b/Tiles/FurnitureEutrophic/EutrophicCandelabra.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicCandelabra : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(); ModTranslation name = CreateMapEntryName(); @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.5f; g = 1f; diff --git a/Tiles/FurnitureEutrophic/EutrophicCandle.cs b/Tiles/FurnitureEutrophic/EutrophicCandle.cs index c05815bc10..ece8d472c3 100644 --- a/Tiles/FurnitureEutrophic/EutrophicCandle.cs +++ b/Tiles/FurnitureEutrophic/EutrophicCandle.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(); ModTranslation name = CreateMapEntryName(); @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.5f; g = 1f; @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; diff --git a/Tiles/FurnitureEutrophic/EutrophicChair.cs b/Tiles/FurnitureEutrophic/EutrophicChair.cs index e81e74694d..af2c9ee53e 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChair.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChair.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicChair : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); diff --git a/Tiles/FurnitureEutrophic/EutrophicChandelier.cs b/Tiles/FurnitureEutrophic/EutrophicChandelier.cs index 37e6d09a48..bce2ebf27e 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChandelier.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChandelier.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicChandelier : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.5f; g = 1f; diff --git a/Tiles/FurnitureEutrophic/EutrophicChest.cs b/Tiles/FurnitureEutrophic/EutrophicChest.cs index 9158f7e566..f1991b71d6 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChest.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChest.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicChest : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(true); ModTranslation name = CreateMapEntryName(); @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.ChestRightClick(i, j); } diff --git a/Tiles/FurnitureEutrophic/EutrophicClock.cs b/Tiles/FurnitureEutrophic/EutrophicClock.cs index 39b35691d4..ccc65e83e8 100644 --- a/Tiles/FurnitureEutrophic/EutrophicClock.cs +++ b/Tiles/FurnitureEutrophic/EutrophicClock.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicClock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(); ModTranslation name = CreateMapEntryName(); @@ -29,7 +29,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.5f; g = 1f; @@ -48,7 +48,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic num = fail ? 1 : 3; } - public override bool NewRightClick(int x, int y) + public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); } diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs b/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs index 141fd9c6b0..1edadd8780 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs b/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs index 580ddc3abb..e83ac6caf0 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureEutrophic/EutrophicDresser.cs b/Tiles/FurnitureEutrophic/EutrophicDresser.cs index 01830426b3..98e9c07af7 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDresser.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDresser.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicDresser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic return true; } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurnitureEutrophic/EutrophicLamp.cs b/Tiles/FurnitureEutrophic/EutrophicLamp.cs index 47edb34d9b..11e11ee3a5 100644 --- a/Tiles/FurnitureEutrophic/EutrophicLamp.cs +++ b/Tiles/FurnitureEutrophic/EutrophicLamp.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicLamp : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.5f; g = 1f; diff --git a/Tiles/FurnitureEutrophic/EutrophicLantern.cs b/Tiles/FurnitureEutrophic/EutrophicLantern.cs index 802e95b43b..f6d4dc5a9a 100644 --- a/Tiles/FurnitureEutrophic/EutrophicLantern.cs +++ b/Tiles/FurnitureEutrophic/EutrophicLantern.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicLantern : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.5f; g = 1f; diff --git a/Tiles/FurnitureEutrophic/EutrophicPiano.cs b/Tiles/FurnitureEutrophic/EutrophicPiano.cs index 814fed7c5d..95620632ff 100644 --- a/Tiles/FurnitureEutrophic/EutrophicPiano.cs +++ b/Tiles/FurnitureEutrophic/EutrophicPiano.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicPiano : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPiano(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureEutrophic/EutrophicPlatform.cs b/Tiles/FurnitureEutrophic/EutrophicPlatform.cs index 79b1bb1596..f3a34ae40a 100644 --- a/Tiles/FurnitureEutrophic/EutrophicPlatform.cs +++ b/Tiles/FurnitureEutrophic/EutrophicPlatform.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicPlatform : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(); AddMapEntry(new Color(191, 142, 111)); diff --git a/Tiles/FurnitureEutrophic/EutrophicSink.cs b/Tiles/FurnitureEutrophic/EutrophicSink.cs index 6ca83a10be..d202e4f3c0 100644 --- a/Tiles/FurnitureEutrophic/EutrophicSink.cs +++ b/Tiles/FurnitureEutrophic/EutrophicSink.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicSink : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); diff --git a/Tiles/FurnitureEutrophic/EutrophicTable.cs b/Tiles/FurnitureEutrophic/EutrophicTable.cs index 137c546934..696e6c6776 100644 --- a/Tiles/FurnitureEutrophic/EutrophicTable.cs +++ b/Tiles/FurnitureEutrophic/EutrophicTable.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicTable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); diff --git a/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs b/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs index 7207a3a55e..21db486872 100644 --- a/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs +++ b/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicWorkBench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureEutrophic/SmoothNavystone.cs b/Tiles/FurnitureEutrophic/SmoothNavystone.cs index a895f6bcde..a14c4bbb08 100644 --- a/Tiles/FurnitureEutrophic/SmoothNavystone.cs +++ b/Tiles/FurnitureEutrophic/SmoothNavystone.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class SmoothNavystone : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; diff --git a/Tiles/FurnitureExo/ExoBathtubTile.cs b/Tiles/FurnitureExo/ExoBathtubTile.cs index 9a9c9e8837..14444a6631 100644 --- a/Tiles/FurnitureExo/ExoBathtubTile.cs +++ b/Tiles/FurnitureExo/ExoBathtubTile.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoBathtubTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); @@ -36,9 +36,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoBathtubGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoBathtubGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoBedTile.cs b/Tiles/FurnitureExo/ExoBedTile.cs index 67e11d307d..1cea5b0088 100644 --- a/Tiles/FurnitureExo/ExoBedTile.cs +++ b/Tiles/FurnitureExo/ExoBedTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoBedTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureExo Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); public override void MouseOver(int i, int j) { @@ -52,9 +52,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoBedGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoBedGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoBookcaseTile.cs b/Tiles/FurnitureExo/ExoBookcaseTile.cs index 556bf7eead..dc10349e43 100644 --- a/Tiles/FurnitureExo/ExoBookcaseTile.cs +++ b/Tiles/FurnitureExo/ExoBookcaseTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoBookcaseTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); @@ -39,9 +39,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoBookcaseGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoBookcaseGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoCandelabraTile.cs b/Tiles/FurnitureExo/ExoCandelabraTile.cs index 2949aa0128..508416c658 100644 --- a/Tiles/FurnitureExo/ExoCandelabraTile.cs +++ b/Tiles/FurnitureExo/ExoCandelabraTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoCandelabraTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); @@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -60,7 +60,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoCandelabraTileFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoCandelabraTileFlame"), i, j); } } } diff --git a/Tiles/FurnitureExo/ExoCandleTile.cs b/Tiles/FurnitureExo/ExoCandleTile.cs index d2f6a672bc..bf54d6cb16 100644 --- a/Tiles/FurnitureExo/ExoCandleTile.cs +++ b/Tiles/FurnitureExo/ExoCandleTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoCandleTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -62,7 +62,7 @@ namespace CalamityMod.Tiles.FurnitureExo player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoCandleTileFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoCandleTileFlame"), i, j); } } } diff --git a/Tiles/FurnitureExo/ExoChairTile.cs b/Tiles/FurnitureExo/ExoChairTile.cs index 013ce86d0b..eaa1c45777 100644 --- a/Tiles/FurnitureExo/ExoChairTile.cs +++ b/Tiles/FurnitureExo/ExoChairTile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoChairTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; @@ -61,9 +61,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoChairGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoChairGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoChandelierTile.cs b/Tiles/FurnitureExo/ExoChandelierTile.cs index af0dbff4ce..ef8726d3b9 100644 --- a/Tiles/FurnitureExo/ExoChandelierTile.cs +++ b/Tiles/FurnitureExo/ExoChandelierTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoChandelierTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(true); AddMapEntry(new Color(71, 95, 114), Language.GetText("MapObject.Chandelier")); @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoChandelierTileFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoChandelierTileFlame"), i, j); } } } diff --git a/Tiles/FurnitureExo/ExoChestTile.cs b/Tiles/FurnitureExo/ExoChestTile.cs index b634509291..be13937d4e 100644 --- a/Tiles/FurnitureExo/ExoChestTile.cs +++ b/Tiles/FurnitureExo/ExoChestTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoChestTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(true); ModTranslation name = CreateMapEntryName(); @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureExo Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver("Exo Chest", i, j); @@ -55,11 +55,11 @@ namespace CalamityMod.Tiles.FurnitureExo { Tile tile = Main.tile[i, j]; int yOffset = TileObjectData.GetTileData(tile).DrawYOffset; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoChestGlow"); + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoChestGlow"); Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - (int)Main.screenPosition.X / 2f, j * 16 - (int)Main.screenPosition.Y + yOffset) + drawOffset; Color drawColour = Color.White; - Main.spriteBatch.Draw(glowmask, drawPosition, new Rectangle(tile.frameX, tile.frameY, 16, 16), drawColour, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(glowmask, drawPosition, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), drawColour, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } } } diff --git a/Tiles/FurnitureExo/ExoClockTile.cs b/Tiles/FurnitureExo/ExoClockTile.cs index 40cbf4451b..8540cbaab1 100644 --- a/Tiles/FurnitureExo/ExoClockTile.cs +++ b/Tiles/FurnitureExo/ExoClockTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoClockTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.FurnitureExo return false; } - public override bool NewRightClick(int x, int y) => CalamityUtils.ClockRightClick(); + public override bool RightClick(int x, int y) => CalamityUtils.ClockRightClick(); public override void NearbyEffects(int i, int j, bool closer) { @@ -50,9 +50,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoClockGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoClockGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoConsoleTile.cs b/Tiles/FurnitureExo/ExoConsoleTile.cs index dc9f67175f..96dc125f89 100644 --- a/Tiles/FurnitureExo/ExoConsoleTile.cs +++ b/Tiles/FurnitureExo/ExoConsoleTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoConsoleTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -57,9 +57,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoConsoleGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoConsoleGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoDisplayTile.cs b/Tiles/FurnitureExo/ExoDisplayTile.cs index 4f4acb2c2c..75bb44dafa 100644 --- a/Tiles/FurnitureExo/ExoDisplayTile.cs +++ b/Tiles/FurnitureExo/ExoDisplayTile.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoDisplayTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -61,9 +61,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoDisplayGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoDisplayGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoDoorClosed.cs b/Tiles/FurnitureExo/ExoDoorClosed.cs index 99891da5a3..69d866bf5d 100644 --- a/Tiles/FurnitureExo/ExoDoorClosed.cs +++ b/Tiles/FurnitureExo/ExoDoorClosed.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/FurnitureExo/ExoDoorOpen.cs b/Tiles/FurnitureExo/ExoDoorOpen.cs index 94e8cf5cd6..6734314b91 100644 --- a/Tiles/FurnitureExo/ExoDoorOpen.cs +++ b/Tiles/FurnitureExo/ExoDoorOpen.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/FurnitureExo/ExoDresserTile.cs b/Tiles/FurnitureExo/ExoDresserTile.cs index b240fc4898..37adb2c8c5 100644 --- a/Tiles/FurnitureExo/ExoDresserTile.cs +++ b/Tiles/FurnitureExo/ExoDresserTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoDresserTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool HasSmartInteract() => true; - public override bool NewRightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(chest); @@ -50,9 +50,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoDresserGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoDresserGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoKeyboardTile.cs b/Tiles/FurnitureExo/ExoKeyboardTile.cs index 7a1cefc00f..e2d11c65a9 100644 --- a/Tiles/FurnitureExo/ExoKeyboardTile.cs +++ b/Tiles/FurnitureExo/ExoKeyboardTile.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoKeyboardTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); @@ -35,9 +35,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoKeyboardGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoKeyboardGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoLampTile.cs b/Tiles/FurnitureExo/ExoLampTile.cs index 7292240066..2a66634247 100644 --- a/Tiles/FurnitureExo/ExoLampTile.cs +++ b/Tiles/FurnitureExo/ExoLampTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoLampTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(true); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -60,7 +60,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoLampTileFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoLampTileFlame"), i, j); } } } diff --git a/Tiles/FurnitureExo/ExoLanternTile.cs b/Tiles/FurnitureExo/ExoLanternTile.cs index e2e293730d..e2aa0832f3 100644 --- a/Tiles/FurnitureExo/ExoLanternTile.cs +++ b/Tiles/FurnitureExo/ExoLanternTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoLanternTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(true); AddMapEntry(new Color(71, 95, 114), Language.GetText("MapObject.Lantern")); @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -60,7 +60,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoLanternTileFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoLanternTileFlame"), i, j); } } } diff --git a/Tiles/FurnitureExo/ExoPlatformTile.cs b/Tiles/FurnitureExo/ExoPlatformTile.cs index 3f5bbd0a8a..c50c9c1a7e 100644 --- a/Tiles/FurnitureExo/ExoPlatformTile.cs +++ b/Tiles/FurnitureExo/ExoPlatformTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoPlatformTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); AddMapEntry(new Color(52, 67, 78)); diff --git a/Tiles/FurnitureExo/ExoPlatingTile.cs b/Tiles/FurnitureExo/ExoPlatingTile.cs index 01d5fd21cf..aadc6bc92c 100644 --- a/Tiles/FurnitureExo/ExoPlatingTile.cs +++ b/Tiles/FurnitureExo/ExoPlatingTile.cs @@ -11,11 +11,11 @@ namespace CalamityMod.Tiles.FurnitureExo { internal static Texture2D GlowTexture; - public override void SetDefaults() + public override void SetStaticDefaults() { if (!Main.dedServ) { - GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoPlatingTileGlow"); + GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoPlatingTileGlow"); } Main.tileSolid[Type] = true; @@ -52,9 +52,9 @@ namespace CalamityMod.Tiles.FurnitureExo return; Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); - int xPos = tile.frameX; + int xPos = tile.TileFrameX; int frameOffset = j % 2 * animationFrameHeight; - int yPos = tile.frameY + frameOffset; + int yPos = tile.TileFrameY + frameOffset; Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; diff --git a/Tiles/FurnitureExo/ExoPrismPanelTile.cs b/Tiles/FurnitureExo/ExoPrismPanelTile.cs index fdded0abc8..3c9d489250 100644 --- a/Tiles/FurnitureExo/ExoPrismPanelTile.cs +++ b/Tiles/FurnitureExo/ExoPrismPanelTile.cs @@ -11,11 +11,11 @@ namespace CalamityMod.Tiles.FurnitureExo { internal static Texture2D GlowTexture; - public override void SetDefaults() + public override void SetStaticDefaults() { if (!Main.dedServ) { - GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoPrismPanelTileGlow"); + GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoPrismPanelTileGlow"); } Main.tileSolid[Type] = true; @@ -52,9 +52,9 @@ namespace CalamityMod.Tiles.FurnitureExo return; Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); - int xPos = tile.frameX; + int xPos = tile.TileFrameX; int frameOffset = (i + j) % 6 * animationFrameHeight; - int yPos = tile.frameY + frameOffset; + int yPos = tile.TileFrameY + frameOffset; Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; diff --git a/Tiles/FurnitureExo/ExoPrismPlatformTile.cs b/Tiles/FurnitureExo/ExoPrismPlatformTile.cs index d11260e9b4..a68e22731f 100644 --- a/Tiles/FurnitureExo/ExoPrismPlatformTile.cs +++ b/Tiles/FurnitureExo/ExoPrismPlatformTile.cs @@ -11,11 +11,11 @@ namespace CalamityMod.Tiles.FurnitureExo { internal static Texture2D GlowTexture; - public override void SetDefaults() + public override void SetStaticDefaults() { if (!Main.dedServ) { - GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoPrismPlatformTileGlow"); + GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoPrismPlatformTileGlow"); } this.SetUpPlatform(true); @@ -57,9 +57,9 @@ namespace CalamityMod.Tiles.FurnitureExo return; Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); - int xPos = tile.frameX; + int xPos = tile.TileFrameX; int frameOffset = (i + j) % 6 * animationFrameHeight; - int yPos = tile.frameY + frameOffset; + int yPos = tile.TileFrameY + frameOffset; Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; diff --git a/Tiles/FurnitureExo/ExoScreenTile.cs b/Tiles/FurnitureExo/ExoScreenTile.cs index e9e36a9c88..ad8bfa711b 100644 --- a/Tiles/FurnitureExo/ExoScreenTile.cs +++ b/Tiles/FurnitureExo/ExoScreenTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoScreenTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; @@ -60,11 +60,11 @@ namespace CalamityMod.Tiles.FurnitureExo { Tile tile = Main.tile[i, j]; int yOffset = TileObjectData.GetTileData(tile).DrawYOffset; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoScreenGlow"); + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoScreenGlow"); Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - (int)Main.screenPosition.X / 2f, j * 16 - (int)Main.screenPosition.Y + yOffset) + drawOffset; Color drawColour = Color.White; - Main.spriteBatch.Draw(glowmask, drawPosition, new Rectangle(tile.frameX, tile.frameY, 16, 16), drawColour, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(glowmask, drawPosition, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), drawColour, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } } } diff --git a/Tiles/FurnitureExo/ExoServerTile.cs b/Tiles/FurnitureExo/ExoServerTile.cs index 1288c4da7a..08bfe4e7ea 100644 --- a/Tiles/FurnitureExo/ExoServerTile.cs +++ b/Tiles/FurnitureExo/ExoServerTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoServerTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -57,9 +57,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoServerGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoServerGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoSinkTile.cs b/Tiles/FurnitureExo/ExoSinkTile.cs index a00bef4e0a..5db96e6c76 100644 --- a/Tiles/FurnitureExo/ExoSinkTile.cs +++ b/Tiles/FurnitureExo/ExoSinkTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoSinkTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(true); AddMapEntry(new Color(71, 95, 114), Language.GetText("MapObject.Sink")); @@ -37,9 +37,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoSinkGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoSinkGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoSofaTile.cs b/Tiles/FurnitureExo/ExoSofaTile.cs index 346c55f589..a5942cc215 100644 --- a/Tiles/FurnitureExo/ExoSofaTile.cs +++ b/Tiles/FurnitureExo/ExoSofaTile.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoSofaTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); @@ -35,9 +35,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoSofaGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoSofaGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoTableTile.cs b/Tiles/FurnitureExo/ExoTableTile.cs index 5793e0ce38..cba8f2d09e 100644 --- a/Tiles/FurnitureExo/ExoTableTile.cs +++ b/Tiles/FurnitureExo/ExoTableTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoTableTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(true); AddMapEntry(new Color(71, 95, 114), Language.GetText("MapObject.Table")); @@ -37,9 +37,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoTableGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoTableGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoTerminalTile.cs b/Tiles/FurnitureExo/ExoTerminalTile.cs index 834d5642c0..31c93d2089 100644 --- a/Tiles/FurnitureExo/ExoTerminalTile.cs +++ b/Tiles/FurnitureExo/ExoTerminalTile.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoTerminalTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -61,9 +61,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoTerminalGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoTerminalGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoToiletTile.cs b/Tiles/FurnitureExo/ExoToiletTile.cs index eb6e7e0e50..5f41100de1 100644 --- a/Tiles/FurnitureExo/ExoToiletTile.cs +++ b/Tiles/FurnitureExo/ExoToiletTile.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoToiletTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; @@ -63,9 +63,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoToiletGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoToiletGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureExo/ExoWorkbenchTile.cs b/Tiles/FurnitureExo/ExoWorkbenchTile.cs index 6c64fd0136..1c010b2b14 100644 --- a/Tiles/FurnitureExo/ExoWorkbenchTile.cs +++ b/Tiles/FurnitureExo/ExoWorkbenchTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoWorkbenchTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); @@ -39,9 +39,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xFrameOffset = Main.tile[i, j].frameX; - int yFrameOffset = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureExo/ExoWorkbenchGlow"); + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoWorkbenchGlow"); Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; Color drawColour = Color.White; diff --git a/Tiles/FurnitureOccult/OccultBathtub.cs b/Tiles/FurnitureOccult/OccultBathtub.cs index 4ef4b4f0b0..9b23dd7b19 100644 --- a/Tiles/FurnitureOccult/OccultBathtub.cs +++ b/Tiles/FurnitureOccult/OccultBathtub.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultBathtub : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureOccult/OccultBed.cs b/Tiles/FurnitureOccult/OccultBed.cs index 4bf9ac11f7..e0ad92fe06 100644 --- a/Tiles/FurnitureOccult/OccultBed.cs +++ b/Tiles/FurnitureOccult/OccultBed.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultBed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureOccult Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.BedRightClick(i, j); } diff --git a/Tiles/FurnitureOccult/OccultBookcase.cs b/Tiles/FurnitureOccult/OccultBookcase.cs index dd961d2270..cb03fe1f44 100644 --- a/Tiles/FurnitureOccult/OccultBookcase.cs +++ b/Tiles/FurnitureOccult/OccultBookcase.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultBookcase : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureOccult/OccultCandelabra.cs b/Tiles/FurnitureOccult/OccultCandelabra.cs index de81bbc46f..73c3f7e9b6 100644 --- a/Tiles/FurnitureOccult/OccultCandelabra.cs +++ b/Tiles/FurnitureOccult/OccultCandelabra.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultCandelabra : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.FurnitureOccult public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureOccult/OccultCandle.cs b/Tiles/FurnitureOccult/OccultCandle.cs index b780778b29..caf912a09e 100644 --- a/Tiles/FurnitureOccult/OccultCandle.cs +++ b/Tiles/FurnitureOccult/OccultCandle.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.FurnitureOccult public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -60,7 +60,7 @@ namespace CalamityMod.Tiles.FurnitureOccult player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; diff --git a/Tiles/FurnitureOccult/OccultChair.cs b/Tiles/FurnitureOccult/OccultChair.cs index 022c062597..da93327b6a 100644 --- a/Tiles/FurnitureOccult/OccultChair.cs +++ b/Tiles/FurnitureOccult/OccultChair.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultChair : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); diff --git a/Tiles/FurnitureOccult/OccultChandelier.cs b/Tiles/FurnitureOccult/OccultChandelier.cs index ed18c85886..332e89ac17 100644 --- a/Tiles/FurnitureOccult/OccultChandelier.cs +++ b/Tiles/FurnitureOccult/OccultChandelier.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultChandelier : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.FurnitureOccult public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureOccult/OccultChest.cs b/Tiles/FurnitureOccult/OccultChest.cs index a4bfbc56ee..16b97fd22e 100644 --- a/Tiles/FurnitureOccult/OccultChest.cs +++ b/Tiles/FurnitureOccult/OccultChest.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultChest : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(true); ModTranslation name = CreateMapEntryName(); @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureOccult Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.ChestRightClick(i, j); } diff --git a/Tiles/FurnitureOccult/OccultClock.cs b/Tiles/FurnitureOccult/OccultClock.cs index cbe210e370..a897f10f5f 100644 --- a/Tiles/FurnitureOccult/OccultClock.cs +++ b/Tiles/FurnitureOccult/OccultClock.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultClock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); @@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.FurnitureOccult num = fail ? 1 : 3; } - public override bool NewRightClick(int x, int y) + public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); } diff --git a/Tiles/FurnitureOccult/OccultDoorClosed.cs b/Tiles/FurnitureOccult/OccultDoorClosed.cs index 71f1eacbf3..9112ee24a2 100644 --- a/Tiles/FurnitureOccult/OccultDoorClosed.cs +++ b/Tiles/FurnitureOccult/OccultDoorClosed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureOccult/OccultDoorOpen.cs b/Tiles/FurnitureOccult/OccultDoorOpen.cs index 6ef74ebd12..44308ca9ed 100644 --- a/Tiles/FurnitureOccult/OccultDoorOpen.cs +++ b/Tiles/FurnitureOccult/OccultDoorOpen.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureOccult/OccultDresser.cs b/Tiles/FurnitureOccult/OccultDresser.cs index 796c2e5597..34ada651db 100644 --- a/Tiles/FurnitureOccult/OccultDresser.cs +++ b/Tiles/FurnitureOccult/OccultDresser.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultDresser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.FurnitureOccult return true; } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurnitureOccult/OccultLamp.cs b/Tiles/FurnitureOccult/OccultLamp.cs index 263547b4df..00e446f519 100644 --- a/Tiles/FurnitureOccult/OccultLamp.cs +++ b/Tiles/FurnitureOccult/OccultLamp.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultLamp : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(true); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.FurnitureOccult public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureOccult/OccultLantern.cs b/Tiles/FurnitureOccult/OccultLantern.cs index d4b589695d..401ab72d90 100644 --- a/Tiles/FurnitureOccult/OccultLantern.cs +++ b/Tiles/FurnitureOccult/OccultLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultLantern : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.FurnitureOccult public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureOccult/OccultPiano.cs b/Tiles/FurnitureOccult/OccultPiano.cs index 35ae256df4..d837589259 100644 --- a/Tiles/FurnitureOccult/OccultPiano.cs +++ b/Tiles/FurnitureOccult/OccultPiano.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultPiano : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureOccult/OccultPlatform.cs b/Tiles/FurnitureOccult/OccultPlatform.cs index 3653c2c741..9399036c34 100644 --- a/Tiles/FurnitureOccult/OccultPlatform.cs +++ b/Tiles/FurnitureOccult/OccultPlatform.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultPlatform : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); diff --git a/Tiles/FurnitureOccult/OccultSink.cs b/Tiles/FurnitureOccult/OccultSink.cs index 0ecf34b7ac..7061e36754 100644 --- a/Tiles/FurnitureOccult/OccultSink.cs +++ b/Tiles/FurnitureOccult/OccultSink.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultSink : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); diff --git a/Tiles/FurnitureOccult/OccultSofa.cs b/Tiles/FurnitureOccult/OccultSofa.cs index b5fd982745..3a35316157 100644 --- a/Tiles/FurnitureOccult/OccultSofa.cs +++ b/Tiles/FurnitureOccult/OccultSofa.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultSofa : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureOccult/OccultStone.cs b/Tiles/FurnitureOccult/OccultStone.cs index e29fba2796..52af72be0f 100644 --- a/Tiles/FurnitureOccult/OccultStone.cs +++ b/Tiles/FurnitureOccult/OccultStone.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureOccult private int extraFrameHeight = 36; private int extraFrameWidth = 90; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; @@ -37,8 +37,8 @@ namespace CalamityMod.Tiles.FurnitureOccult public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { - if ((Main.tile[i - 1, j - 1].type != Type || Main.tile[i, j - 1].type != Type || Main.tile[i + 1, j - 1].type != Type || - Main.tile[i - 1, j - 2].type != Type || Main.tile[i, j - 2].type != Type || Main.tile[i + 1, j - 2].type != Type) && + if ((Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type || + Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type) && nextSpecialDrawIndex < Main.specX.Length) { Main.specX[nextSpecialDrawIndex] = i; @@ -52,7 +52,7 @@ namespace CalamityMod.Tiles.FurnitureOccult Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j); - Texture2D cloth = ModContent.GetTexture("CalamityMod/Tiles/FurnitureOccult/OccultStone_Cloth"); + Texture2D cloth = ModContent.Request("CalamityMod/Tiles/FurnitureOccult/OccultStone_Cloth"); DrawExtraTop(i, j, cloth, drawOffset, drawColour); DrawExtraWallEnds(i, j, cloth, drawOffset, drawColour); @@ -178,7 +178,7 @@ namespace CalamityMod.Tiles.FurnitureOccult private bool CheckTile(int type, bool equal, int x, int y, int i, int j) { //Subtract y so that y is vertical for ease of readability - return Main.tile[i + x, j - y].type == type == equal; + return Main.tile[i + x, j - y].TileType == type == equal; } private Color GetDrawColour(int i, int j) diff --git a/Tiles/FurnitureOccult/OccultTable.cs b/Tiles/FurnitureOccult/OccultTable.cs index b24df60cad..56e979e22a 100644 --- a/Tiles/FurnitureOccult/OccultTable.cs +++ b/Tiles/FurnitureOccult/OccultTable.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultTable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); diff --git a/Tiles/FurnitureOccult/OccultWorkbench.cs b/Tiles/FurnitureOccult/OccultWorkbench.cs index 93cd208b16..e9e58fee0e 100644 --- a/Tiles/FurnitureOccult/OccultWorkbench.cs +++ b/Tiles/FurnitureOccult/OccultWorkbench.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public class OccultWorkBench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs index 8e0d0baf5d..0cf07082ba 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlate : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -37,9 +37,9 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurniturePlaguedPlate/PlaguedPlateGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurniturePlaguedPlate/PlaguedPlateGlow"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j, new Color(128, 128, 128, 128)); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs index af025ad57c..7cfe2408bc 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateBasin : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; @@ -48,7 +48,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { Tile tile = Main.tile[i, j]; //227 79 79 - if (tile.frameX < 54) + if (tile.TileFrameX < 54) { r = 0.4f; g = 1f; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs index 6b2944dc42..e7e430ac75 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateBathtub : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs index ca6cffc7b2..a789e7c22f 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateBed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; @@ -47,14 +47,14 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; + int spawnX = i - tile.TileFrameX / 18; int spawnY = j + 2; - spawnX += tile.frameX >= 54 ? 5 : 2; - spawnY -= tile.frameY / 18; + spawnX += tile.TileFrameX >= 54 ? 5 : 2; + spawnY -= tile.TileFrameY / 18; player.FindSpawn(); if (player.SpawnX == spawnX && player.SpawnY == spawnY) { diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs index eb9359871d..845359e061 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateBookcase : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs index 89c41c8886..33304d61ee 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateCandelabra : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.4f; g = 1f; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs index ae5f03cb75..230166e74a 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.4f; g = 1f; @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs index aca7a24f36..bd1c3ba92c 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateChair : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs index 25989a6642..64fd426861 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateChandelier : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.4f; g = 1f; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs index 424e8a0ac2..856c1ae813 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateChest : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(true); ModTranslation name = CreateMapEntryName(); @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.ChestRightClick(i, j); } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs index 7c987f01d0..c137f1d241 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateClock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate return true; } - public override bool NewRightClick(int x, int y) + public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs index ba26a1a7d6..91cebb4e72 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs index 76182ba1db..06c19e802b 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs index 103380a6bd..8a88894f0e 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateDresser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate num = fail ? 1 : 3; } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs index 36a575efc9..e691403d4c 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateLamp : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(true); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.4f; g = 1f; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs index e6a87d9dc4..7e6b318875 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateLantern : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.4f; g = 1f; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs index 9a55c14027..90e965b390 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlatePiano : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs index a8d08d849a..84bf5ce066 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlatePlatform : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs index 6aad580bef..2bf4705b61 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateSink : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs index e22cb848fc..cf68318b85 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateSofa : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs index d10b3dedeb..ee0ce6f41d 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateTable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs index ee34af8472..82285d986f 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateWorkbench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureProfaned/ProfanedBath.cs b/Tiles/FurnitureProfaned/ProfanedBath.cs index 83477779b5..9624149fe0 100644 --- a/Tiles/FurnitureProfaned/ProfanedBath.cs +++ b/Tiles/FurnitureProfaned/ProfanedBath.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedBath : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureProfaned/ProfanedBed.cs b/Tiles/FurnitureProfaned/ProfanedBed.cs index 0724a26634..fc8afdb8de 100644 --- a/Tiles/FurnitureProfaned/ProfanedBed.cs +++ b/Tiles/FurnitureProfaned/ProfanedBed.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedBed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.BedRightClick(i, j); } diff --git a/Tiles/FurnitureProfaned/ProfanedBench.cs b/Tiles/FurnitureProfaned/ProfanedBench.cs index dcd83dd7ad..a089133475 100644 --- a/Tiles/FurnitureProfaned/ProfanedBench.cs +++ b/Tiles/FurnitureProfaned/ProfanedBench.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedBench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureProfaned/ProfanedBookcase.cs b/Tiles/FurnitureProfaned/ProfanedBookcase.cs index a86f3f8c23..aa309a01f0 100644 --- a/Tiles/FurnitureProfaned/ProfanedBookcase.cs +++ b/Tiles/FurnitureProfaned/ProfanedBookcase.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedBookcase : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureProfaned/ProfanedCandelabra.cs b/Tiles/FurnitureProfaned/ProfanedCandelabra.cs index 6754512810..ff268297b3 100644 --- a/Tiles/FurnitureProfaned/ProfanedCandelabra.cs +++ b/Tiles/FurnitureProfaned/ProfanedCandelabra.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedCandelabra : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.85f; @@ -59,12 +59,12 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureProfaned/ProfanedCandelabraFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureProfaned/ProfanedCandelabraFlame"), i, j); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { - if (Main.tile[i, j].frameX < 35) + if (Main.tile[i, j].TileFrameX < 35) CalamityUtils.DrawFlameSparks(246, 5, i, j); } } diff --git a/Tiles/FurnitureProfaned/ProfanedCandle.cs b/Tiles/FurnitureProfaned/ProfanedCandle.cs index d7e8cccfbc..986dc1709f 100644 --- a/Tiles/FurnitureProfaned/ProfanedCandle.cs +++ b/Tiles/FurnitureProfaned/ProfanedCandle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); @@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.85f; @@ -61,7 +61,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; @@ -69,12 +69,12 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureProfaned/ProfanedCandleFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureProfaned/ProfanedCandleFlame"), i, j); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) CalamityUtils.DrawFlameSparks(246, 5, i, j); } } diff --git a/Tiles/FurnitureProfaned/ProfanedChair.cs b/Tiles/FurnitureProfaned/ProfanedChair.cs index c647a8b984..b47d943afd 100644 --- a/Tiles/FurnitureProfaned/ProfanedChair.cs +++ b/Tiles/FurnitureProfaned/ProfanedChair.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedChair : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); diff --git a/Tiles/FurnitureProfaned/ProfanedChandelier.cs b/Tiles/FurnitureProfaned/ProfanedChandelier.cs index 26ab70d057..edb12a408d 100644 --- a/Tiles/FurnitureProfaned/ProfanedChandelier.cs +++ b/Tiles/FurnitureProfaned/ProfanedChandelier.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedChandelier : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.85f; diff --git a/Tiles/FurnitureProfaned/ProfanedChest.cs b/Tiles/FurnitureProfaned/ProfanedChest.cs index bb4a9b1c38..fa5870308d 100644 --- a/Tiles/FurnitureProfaned/ProfanedChest.cs +++ b/Tiles/FurnitureProfaned/ProfanedChest.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedChest : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(); ModTranslation name = CreateMapEntryName(); @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.ChestRightClick(i, j); } diff --git a/Tiles/FurnitureProfaned/ProfanedClock.cs b/Tiles/FurnitureProfaned/ProfanedClock.cs index e81c3c6e45..ae34038828 100644 --- a/Tiles/FurnitureProfaned/ProfanedClock.cs +++ b/Tiles/FurnitureProfaned/ProfanedClock.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedClock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); @@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned num = fail ? 1 : 3; } - public override bool NewRightClick(int x, int y) + public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); } diff --git a/Tiles/FurnitureProfaned/ProfanedCrystal.cs b/Tiles/FurnitureProfaned/ProfanedCrystal.cs index a1d031af3d..1f392c5612 100644 --- a/Tiles/FurnitureProfaned/ProfanedCrystal.cs +++ b/Tiles/FurnitureProfaned/ProfanedCrystal.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { int subsheetWidth = 324; int subsheetHeight = 90; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileNoAttach[Type] = true; diff --git a/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs b/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs index 85969cfd41..27b1c928aa 100644 --- a/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs +++ b/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs b/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs index 29e738548e..9d37aa51e0 100644 --- a/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs +++ b/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureProfaned/ProfanedDresser.cs b/Tiles/FurnitureProfaned/ProfanedDresser.cs index 92fedcb671..c8787cec5b 100644 --- a/Tiles/FurnitureProfaned/ProfanedDresser.cs +++ b/Tiles/FurnitureProfaned/ProfanedDresser.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedDresser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned return true; } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurnitureProfaned/ProfanedLamp.cs b/Tiles/FurnitureProfaned/ProfanedLamp.cs index 9c02986e5d..6b1b25eb0b 100644 --- a/Tiles/FurnitureProfaned/ProfanedLamp.cs +++ b/Tiles/FurnitureProfaned/ProfanedLamp.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedLamp : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(true); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.85f; @@ -59,12 +59,12 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureProfaned/ProfanedLampFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureProfaned/ProfanedLampFlame"), i, j); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { - if (Main.tile[i, j].frameY == 0 && Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameY == 0 && Main.tile[i, j].TileFrameX < 18) { CalamityUtils.DrawFlameSparks(246, 5, i, j); } diff --git a/Tiles/FurnitureProfaned/ProfanedLantern.cs b/Tiles/FurnitureProfaned/ProfanedLantern.cs index 292c16686d..909720f58d 100644 --- a/Tiles/FurnitureProfaned/ProfanedLantern.cs +++ b/Tiles/FurnitureProfaned/ProfanedLantern.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedLantern : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 1f; g = 0.85f; @@ -59,12 +59,12 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureProfaned/ProfanedLanternFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureProfaned/ProfanedLanternFlame"), i, j); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) CalamityUtils.DrawFlameSparks(246, 5, i, j); } } diff --git a/Tiles/FurnitureProfaned/ProfanedPiano.cs b/Tiles/FurnitureProfaned/ProfanedPiano.cs index 146600ca0b..a8bb4bf667 100644 --- a/Tiles/FurnitureProfaned/ProfanedPiano.cs +++ b/Tiles/FurnitureProfaned/ProfanedPiano.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedPiano : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/FurnitureProfaned/ProfanedPlatform.cs b/Tiles/FurnitureProfaned/ProfanedPlatform.cs index f1913ea446..60ca8cde24 100644 --- a/Tiles/FurnitureProfaned/ProfanedPlatform.cs +++ b/Tiles/FurnitureProfaned/ProfanedPlatform.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedPlatform : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); diff --git a/Tiles/FurnitureProfaned/ProfanedRock.cs b/Tiles/FurnitureProfaned/ProfanedRock.cs index 75737dcea3..276e7e29ae 100644 --- a/Tiles/FurnitureProfaned/ProfanedRock.cs +++ b/Tiles/FurnitureProfaned/ProfanedRock.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedRock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -128,8 +128,8 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; int xOffset = 0; int relativeXPos = i % 4; int relativeYPos = j % 4; @@ -218,7 +218,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned } xOffset *= 288; xPos += xOffset; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureProfaned/ProfanedRockGlow"); + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureProfaned/ProfanedRockGlow"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j, new Color(25, 25, 25, 25)); diff --git a/Tiles/FurnitureProfaned/ProfanedSink.cs b/Tiles/FurnitureProfaned/ProfanedSink.cs index 4006478c3a..5a5f1ad140 100644 --- a/Tiles/FurnitureProfaned/ProfanedSink.cs +++ b/Tiles/FurnitureProfaned/ProfanedSink.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedSink : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); diff --git a/Tiles/FurnitureProfaned/ProfanedSlab.cs b/Tiles/FurnitureProfaned/ProfanedSlab.cs index ee7b9df4f6..193a3510d8 100644 --- a/Tiles/FurnitureProfaned/ProfanedSlab.cs +++ b/Tiles/FurnitureProfaned/ProfanedSlab.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedSlab : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/FurnitureProfaned/ProfanedTable.cs b/Tiles/FurnitureProfaned/ProfanedTable.cs index 949a985326..79c35990c7 100644 --- a/Tiles/FurnitureProfaned/ProfanedTable.cs +++ b/Tiles/FurnitureProfaned/ProfanedTable.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedTable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); diff --git a/Tiles/FurnitureProfaned/ProfanedWorkbench.cs b/Tiles/FurnitureProfaned/ProfanedWorkbench.cs index 6ce5a88440..0afda723b9 100644 --- a/Tiles/FurnitureProfaned/ProfanedWorkbench.cs +++ b/Tiles/FurnitureProfaned/ProfanedWorkbench.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedWorkbench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs index 98142b69db..293ee83bd4 100644 --- a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs +++ b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class RunicProfanedBrick : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -42,15 +42,15 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; int xOffset = i % 2; int yOffset = j % 2; xOffset *= animationFrameWidth; yOffset *= animationFrameHeight; xPos += xOffset; yPos += yOffset; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureProfaned/RunicProfanedBrickGlow"); + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureProfaned/RunicProfanedBrickGlow"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j, new Color(128, 128, 128, 128)); diff --git a/Tiles/FurnitureSilva/SilvaBathtub.cs b/Tiles/FurnitureSilva/SilvaBathtub.cs index 8599bbdfca..6de6f85893 100644 --- a/Tiles/FurnitureSilva/SilvaBathtub.cs +++ b/Tiles/FurnitureSilva/SilvaBathtub.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaBathtub : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureSilva/SilvaBed.cs b/Tiles/FurnitureSilva/SilvaBed.cs index 71fd528220..13ec7df0e8 100644 --- a/Tiles/FurnitureSilva/SilvaBed.cs +++ b/Tiles/FurnitureSilva/SilvaBed.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaBed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureSilva Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.BedRightClick(i, j); } diff --git a/Tiles/FurnitureSilva/SilvaBench.cs b/Tiles/FurnitureSilva/SilvaBench.cs index 3329f3ce8f..6969eddba6 100644 --- a/Tiles/FurnitureSilva/SilvaBench.cs +++ b/Tiles/FurnitureSilva/SilvaBench.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaBench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureSilva/SilvaBookcase.cs b/Tiles/FurnitureSilva/SilvaBookcase.cs index 68b8eb74bc..85b4dc7157 100644 --- a/Tiles/FurnitureSilva/SilvaBookcase.cs +++ b/Tiles/FurnitureSilva/SilvaBookcase.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaBookcase : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureSilva/SilvaCandelabra.cs b/Tiles/FurnitureSilva/SilvaCandelabra.cs index 2ac8ae17f3..85969bcf50 100644 --- a/Tiles/FurnitureSilva/SilvaCandelabra.cs +++ b/Tiles/FurnitureSilva/SilvaCandelabra.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaCandelabra : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.6f; g = 1f; diff --git a/Tiles/FurnitureSilva/SilvaCandle.cs b/Tiles/FurnitureSilva/SilvaCandle.cs index 5f91281e7e..9042678935 100644 --- a/Tiles/FurnitureSilva/SilvaCandle.cs +++ b/Tiles/FurnitureSilva/SilvaCandle.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.6f; g = 1f; @@ -60,7 +60,7 @@ namespace CalamityMod.Tiles.FurnitureSilva player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; diff --git a/Tiles/FurnitureSilva/SilvaChair.cs b/Tiles/FurnitureSilva/SilvaChair.cs index ce29826be0..7fcc75b87f 100644 --- a/Tiles/FurnitureSilva/SilvaChair.cs +++ b/Tiles/FurnitureSilva/SilvaChair.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaChair : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); diff --git a/Tiles/FurnitureSilva/SilvaChandelier.cs b/Tiles/FurnitureSilva/SilvaChandelier.cs index 1f79df9066..6672f88f8d 100644 --- a/Tiles/FurnitureSilva/SilvaChandelier.cs +++ b/Tiles/FurnitureSilva/SilvaChandelier.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaChandelier : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.6f; g = 1f; diff --git a/Tiles/FurnitureSilva/SilvaChest.cs b/Tiles/FurnitureSilva/SilvaChest.cs index 17fe2b23be..c7893c2461 100644 --- a/Tiles/FurnitureSilva/SilvaChest.cs +++ b/Tiles/FurnitureSilva/SilvaChest.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaChest : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(true); ModTranslation name = CreateMapEntryName(); @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureSilva Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.ChestRightClick(i, j); } diff --git a/Tiles/FurnitureSilva/SilvaClock.cs b/Tiles/FurnitureSilva/SilvaClock.cs index c308bdc714..26641147f4 100644 --- a/Tiles/FurnitureSilva/SilvaClock.cs +++ b/Tiles/FurnitureSilva/SilvaClock.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaClock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); @@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.FurnitureSilva num = fail ? 1 : 3; } - public override bool NewRightClick(int x, int y) + public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); } diff --git a/Tiles/FurnitureSilva/SilvaCrystal.cs b/Tiles/FurnitureSilva/SilvaCrystal.cs index 98b5c640b6..a07700759e 100644 --- a/Tiles/FurnitureSilva/SilvaCrystal.cs +++ b/Tiles/FurnitureSilva/SilvaCrystal.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaCrystal : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; diff --git a/Tiles/FurnitureSilva/SilvaDoorClosed.cs b/Tiles/FurnitureSilva/SilvaDoorClosed.cs index 80502414a7..54dd2a4d04 100644 --- a/Tiles/FurnitureSilva/SilvaDoorClosed.cs +++ b/Tiles/FurnitureSilva/SilvaDoorClosed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureSilva/SilvaDoorOpen.cs b/Tiles/FurnitureSilva/SilvaDoorOpen.cs index 6072c348a0..bc5c7eed0c 100644 --- a/Tiles/FurnitureSilva/SilvaDoorOpen.cs +++ b/Tiles/FurnitureSilva/SilvaDoorOpen.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureSilva/SilvaDresser.cs b/Tiles/FurnitureSilva/SilvaDresser.cs index 66ec338e01..e1b3de1ea0 100644 --- a/Tiles/FurnitureSilva/SilvaDresser.cs +++ b/Tiles/FurnitureSilva/SilvaDresser.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaDresser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.FurnitureSilva return true; } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurnitureSilva/SilvaLamp.cs b/Tiles/FurnitureSilva/SilvaLamp.cs index 86a7737b69..40d99436a0 100644 --- a/Tiles/FurnitureSilva/SilvaLamp.cs +++ b/Tiles/FurnitureSilva/SilvaLamp.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaLamp : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(true); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.6f; g = 1f; diff --git a/Tiles/FurnitureSilva/SilvaLantern.cs b/Tiles/FurnitureSilva/SilvaLantern.cs index f339ade4f7..7b13dfd875 100644 --- a/Tiles/FurnitureSilva/SilvaLantern.cs +++ b/Tiles/FurnitureSilva/SilvaLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaLantern : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.6f; g = 1f; diff --git a/Tiles/FurnitureSilva/SilvaPiano.cs b/Tiles/FurnitureSilva/SilvaPiano.cs index 49d1a9ca24..e0c1850336 100644 --- a/Tiles/FurnitureSilva/SilvaPiano.cs +++ b/Tiles/FurnitureSilva/SilvaPiano.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaPiano : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureSilva/SilvaPlatform.cs b/Tiles/FurnitureSilva/SilvaPlatform.cs index 570a00395c..d8b7d2644e 100644 --- a/Tiles/FurnitureSilva/SilvaPlatform.cs +++ b/Tiles/FurnitureSilva/SilvaPlatform.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaPlatform : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); diff --git a/Tiles/FurnitureSilva/SilvaSink.cs b/Tiles/FurnitureSilva/SilvaSink.cs index e46af6301b..e70e7f5c4e 100644 --- a/Tiles/FurnitureSilva/SilvaSink.cs +++ b/Tiles/FurnitureSilva/SilvaSink.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaSink : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); diff --git a/Tiles/FurnitureSilva/SilvaTable.cs b/Tiles/FurnitureSilva/SilvaTable.cs index fa50da360d..905e98f5cc 100644 --- a/Tiles/FurnitureSilva/SilvaTable.cs +++ b/Tiles/FurnitureSilva/SilvaTable.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaTable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); diff --git a/Tiles/FurnitureSilva/SilvaWorkBench.cs b/Tiles/FurnitureSilva/SilvaWorkBench.cs index 06c8de2b82..87949e6b15 100644 --- a/Tiles/FurnitureSilva/SilvaWorkBench.cs +++ b/Tiles/FurnitureSilva/SilvaWorkBench.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaWorkBench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureStatigel/StatigelBath.cs b/Tiles/FurnitureStatigel/StatigelBath.cs index 21653dc616..d3ba9f1363 100644 --- a/Tiles/FurnitureStatigel/StatigelBath.cs +++ b/Tiles/FurnitureStatigel/StatigelBath.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelBath : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureStatigel/StatigelBed.cs b/Tiles/FurnitureStatigel/StatigelBed.cs index 39b0cf9f30..21aa19996b 100644 --- a/Tiles/FurnitureStatigel/StatigelBed.cs +++ b/Tiles/FurnitureStatigel/StatigelBed.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelBed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(); ModTranslation name = CreateMapEntryName(); @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.BedRightClick(i, j); } diff --git a/Tiles/FurnitureStatigel/StatigelBlock.cs b/Tiles/FurnitureStatigel/StatigelBlock.cs index 32290a99c0..eeacf1d382 100644 --- a/Tiles/FurnitureStatigel/StatigelBlock.cs +++ b/Tiles/FurnitureStatigel/StatigelBlock.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelBlock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; diff --git a/Tiles/FurnitureStatigel/StatigelBookcase.cs b/Tiles/FurnitureStatigel/StatigelBookcase.cs index a52a57d55f..6fbb86fbfb 100644 --- a/Tiles/FurnitureStatigel/StatigelBookcase.cs +++ b/Tiles/FurnitureStatigel/StatigelBookcase.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelBookcase : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureStatigel/StatigelCandelabra.cs b/Tiles/FurnitureStatigel/StatigelCandelabra.cs index 0718c5debd..cd5efe1dcd 100644 --- a/Tiles/FurnitureStatigel/StatigelCandelabra.cs +++ b/Tiles/FurnitureStatigel/StatigelCandelabra.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelCandelabra : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(); ModTranslation name = CreateMapEntryName(); @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -57,7 +57,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureStatigel/StatigelCandelabraFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureStatigel/StatigelCandelabraFlame"), i, j); } } } diff --git a/Tiles/FurnitureStatigel/StatigelCandle.cs b/Tiles/FurnitureStatigel/StatigelCandle.cs index 00586bbefa..0d84566a86 100644 --- a/Tiles/FurnitureStatigel/StatigelCandle.cs +++ b/Tiles/FurnitureStatigel/StatigelCandle.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(); ModTranslation name = CreateMapEntryName(); @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -59,7 +59,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; @@ -67,7 +67,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureStatigel/StatigelCandleFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureStatigel/StatigelCandleFlame"), i, j); } } } diff --git a/Tiles/FurnitureStatigel/StatigelChair.cs b/Tiles/FurnitureStatigel/StatigelChair.cs index c9a7a1024a..feb7b5e974 100644 --- a/Tiles/FurnitureStatigel/StatigelChair.cs +++ b/Tiles/FurnitureStatigel/StatigelChair.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelChair : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); diff --git a/Tiles/FurnitureStatigel/StatigelChandelier.cs b/Tiles/FurnitureStatigel/StatigelChandelier.cs index 1e773cbbea..7daa64d579 100644 --- a/Tiles/FurnitureStatigel/StatigelChandelier.cs +++ b/Tiles/FurnitureStatigel/StatigelChandelier.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelChandelier : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -29,7 +29,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -55,7 +55,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureStatigel/StatigelChandelierFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureStatigel/StatigelChandelierFlame"), i, j); } } } diff --git a/Tiles/FurnitureStatigel/StatigelChest.cs b/Tiles/FurnitureStatigel/StatigelChest.cs index dfb4a48336..5196334630 100644 --- a/Tiles/FurnitureStatigel/StatigelChest.cs +++ b/Tiles/FurnitureStatigel/StatigelChest.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelChest : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(true); ModTranslation name = CreateMapEntryName(); @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.ChestRightClick(i, j); } diff --git a/Tiles/FurnitureStatigel/StatigelClock.cs b/Tiles/FurnitureStatigel/StatigelClock.cs index 8ab4dffe36..e3f99b2be6 100644 --- a/Tiles/FurnitureStatigel/StatigelClock.cs +++ b/Tiles/FurnitureStatigel/StatigelClock.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelClock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(); ModTranslation name = CreateMapEntryName(); @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel return false; } - public override bool NewRightClick(int x, int y) + public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); } diff --git a/Tiles/FurnitureStatigel/StatigelDoorClosed.cs b/Tiles/FurnitureStatigel/StatigelDoorClosed.cs index df18f453b1..74268ddc29 100644 --- a/Tiles/FurnitureStatigel/StatigelDoorClosed.cs +++ b/Tiles/FurnitureStatigel/StatigelDoorClosed.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureStatigel/StatigelDoorOpen.cs b/Tiles/FurnitureStatigel/StatigelDoorOpen.cs index 92087a19f7..4f5e9a150d 100644 --- a/Tiles/FurnitureStatigel/StatigelDoorOpen.cs +++ b/Tiles/FurnitureStatigel/StatigelDoorOpen.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureStatigel/StatigelDresser.cs b/Tiles/FurnitureStatigel/StatigelDresser.cs index 17ca56c32f..4b8ec5fa01 100644 --- a/Tiles/FurnitureStatigel/StatigelDresser.cs +++ b/Tiles/FurnitureStatigel/StatigelDresser.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelDresser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel return true; } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurnitureStatigel/StatigelLamp.cs b/Tiles/FurnitureStatigel/StatigelLamp.cs index 76d2be23fc..592d763eea 100644 --- a/Tiles/FurnitureStatigel/StatigelLamp.cs +++ b/Tiles/FurnitureStatigel/StatigelLamp.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelLamp : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -36,7 +36,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -57,7 +57,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureStatigel/StatigelLampFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureStatigel/StatigelLampFlame"), i, j); } } } diff --git a/Tiles/FurnitureStatigel/StatigelLantern.cs b/Tiles/FurnitureStatigel/StatigelLantern.cs index 11e08a0e71..1ea5e8fb8d 100644 --- a/Tiles/FurnitureStatigel/StatigelLantern.cs +++ b/Tiles/FurnitureStatigel/StatigelLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelLantern : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -36,7 +36,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -57,7 +57,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureStatigel/StatigelLanternFlame"), i, j); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureStatigel/StatigelLanternFlame"), i, j); } } } diff --git a/Tiles/FurnitureStatigel/StatigelPiano.cs b/Tiles/FurnitureStatigel/StatigelPiano.cs index 4d67bee64c..25b1540578 100644 --- a/Tiles/FurnitureStatigel/StatigelPiano.cs +++ b/Tiles/FurnitureStatigel/StatigelPiano.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelPiano : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPiano(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureStatigel/StatigelPlatform.cs b/Tiles/FurnitureStatigel/StatigelPlatform.cs index ba56da70f4..ca2d20c50c 100644 --- a/Tiles/FurnitureStatigel/StatigelPlatform.cs +++ b/Tiles/FurnitureStatigel/StatigelPlatform.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelPlatform : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(); AddMapEntry(new Color(191, 142, 111)); diff --git a/Tiles/FurnitureStatigel/StatigelSink.cs b/Tiles/FurnitureStatigel/StatigelSink.cs index ab3d99013d..d6ab3858ee 100644 --- a/Tiles/FurnitureStatigel/StatigelSink.cs +++ b/Tiles/FurnitureStatigel/StatigelSink.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelSink : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); diff --git a/Tiles/FurnitureStatigel/StatigelSofa.cs b/Tiles/FurnitureStatigel/StatigelSofa.cs index d1f3df75b2..c06db5c232 100644 --- a/Tiles/FurnitureStatigel/StatigelSofa.cs +++ b/Tiles/FurnitureStatigel/StatigelSofa.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelSofa : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureStatigel/StatigelTable.cs b/Tiles/FurnitureStatigel/StatigelTable.cs index 75646e4a07..3796da962e 100644 --- a/Tiles/FurnitureStatigel/StatigelTable.cs +++ b/Tiles/FurnitureStatigel/StatigelTable.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelTable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); diff --git a/Tiles/FurnitureStatigel/StatigelWorkbench.cs b/Tiles/FurnitureStatigel/StatigelWorkbench.cs index ac43a0195c..a82936a879 100644 --- a/Tiles/FurnitureStatigel/StatigelWorkbench.cs +++ b/Tiles/FurnitureStatigel/StatigelWorkbench.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelWorkbench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureStratus/StratusBathtub.cs b/Tiles/FurnitureStratus/StratusBathtub.cs index 77ec32cfb4..4adefb735e 100644 --- a/Tiles/FurnitureStratus/StratusBathtub.cs +++ b/Tiles/FurnitureStratus/StratusBathtub.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusBathtub : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureStratus/StratusBed.cs b/Tiles/FurnitureStratus/StratusBed.cs index 0c96108556..14fb55810b 100644 --- a/Tiles/FurnitureStratus/StratusBed.cs +++ b/Tiles/FurnitureStratus/StratusBed.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusBed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureStratus Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.BedRightClick(i, j); } diff --git a/Tiles/FurnitureStratus/StratusBookcase.cs b/Tiles/FurnitureStratus/StratusBookcase.cs index 4a6bbed011..fcd414a345 100644 --- a/Tiles/FurnitureStratus/StratusBookcase.cs +++ b/Tiles/FurnitureStratus/StratusBookcase.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusBookcase : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureStratus/StratusBricks.cs b/Tiles/FurnitureStratus/StratusBricks.cs index 5a4ae4470a..2b826e75cf 100644 --- a/Tiles/FurnitureStratus/StratusBricks.cs +++ b/Tiles/FurnitureStratus/StratusBricks.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusBricks : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -37,9 +37,9 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureStratus/StratusBricksGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureStratus/StratusBricksGlow"); Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/FurnitureStratus/StratusCandelabra.cs b/Tiles/FurnitureStratus/StratusCandelabra.cs index 4290ff0734..a95aa1c05f 100644 --- a/Tiles/FurnitureStratus/StratusCandelabra.cs +++ b/Tiles/FurnitureStratus/StratusCandelabra.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusCandelabra : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.6f; g = 0.8f; diff --git a/Tiles/FurnitureStratus/StratusCandle.cs b/Tiles/FurnitureStratus/StratusCandle.cs index a296c32845..7d11bbe2c3 100644 --- a/Tiles/FurnitureStratus/StratusCandle.cs +++ b/Tiles/FurnitureStratus/StratusCandle.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.6f; g = 0.8f; @@ -60,7 +60,7 @@ namespace CalamityMod.Tiles.FurnitureStratus player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; @@ -68,7 +68,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureStratus/StratusCandleFlame"), i, j, 0, -7); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureStratus/StratusCandleFlame"), i, j, 0, -7); } } } diff --git a/Tiles/FurnitureStratus/StratusChair.cs b/Tiles/FurnitureStratus/StratusChair.cs index 3ec0cc459f..51621edb3b 100644 --- a/Tiles/FurnitureStratus/StratusChair.cs +++ b/Tiles/FurnitureStratus/StratusChair.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusChair : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); diff --git a/Tiles/FurnitureStratus/StratusChandelier.cs b/Tiles/FurnitureStratus/StratusChandelier.cs index 664cbcf0d5..30115300d5 100644 --- a/Tiles/FurnitureStratus/StratusChandelier.cs +++ b/Tiles/FurnitureStratus/StratusChandelier.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusChandelier : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -29,7 +29,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.6f; g = 0.8f; diff --git a/Tiles/FurnitureStratus/StratusChest.cs b/Tiles/FurnitureStratus/StratusChest.cs index 7321369bfb..c0dd50b804 100644 --- a/Tiles/FurnitureStratus/StratusChest.cs +++ b/Tiles/FurnitureStratus/StratusChest.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusChest : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(true); ModTranslation name = CreateMapEntryName(); @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureStratus Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.ChestRightClick(i, j); } diff --git a/Tiles/FurnitureStratus/StratusClock.cs b/Tiles/FurnitureStratus/StratusClock.cs index e0d5369765..0ee4392c63 100644 --- a/Tiles/FurnitureStratus/StratusClock.cs +++ b/Tiles/FurnitureStratus/StratusClock.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusClock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.FurnitureStratus return false; } - public override bool NewRightClick(int x, int y) + public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); } diff --git a/Tiles/FurnitureStratus/StratusDoorClosed.cs b/Tiles/FurnitureStratus/StratusDoorClosed.cs index b4eae2725a..023e1a196f 100644 --- a/Tiles/FurnitureStratus/StratusDoorClosed.cs +++ b/Tiles/FurnitureStratus/StratusDoorClosed.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureStratus/StratusDoorOpen.cs b/Tiles/FurnitureStratus/StratusDoorOpen.cs index 04fcddc6cb..5cb7b0d446 100644 --- a/Tiles/FurnitureStratus/StratusDoorOpen.cs +++ b/Tiles/FurnitureStratus/StratusDoorOpen.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureStratus/StratusDresser.cs b/Tiles/FurnitureStratus/StratusDresser.cs index b9bf0a81c4..691a08d031 100644 --- a/Tiles/FurnitureStratus/StratusDresser.cs +++ b/Tiles/FurnitureStratus/StratusDresser.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusDresser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.FurnitureStratus return true; } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurnitureStratus/StratusLamp.cs b/Tiles/FurnitureStratus/StratusLamp.cs index 02cf4a49ce..f1e3d8285a 100644 --- a/Tiles/FurnitureStratus/StratusLamp.cs +++ b/Tiles/FurnitureStratus/StratusLamp.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusLamp : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(true); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -36,7 +36,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.6f; g = 0.8f; diff --git a/Tiles/FurnitureStratus/StratusLantern.cs b/Tiles/FurnitureStratus/StratusLantern.cs index 7717f41982..12c91a6b90 100644 --- a/Tiles/FurnitureStratus/StratusLantern.cs +++ b/Tiles/FurnitureStratus/StratusLantern.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusLantern : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -36,7 +36,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.6f; g = 0.8f; diff --git a/Tiles/FurnitureStratus/StratusPiano.cs b/Tiles/FurnitureStratus/StratusPiano.cs index 037d3576a2..ab2f28f9c8 100644 --- a/Tiles/FurnitureStratus/StratusPiano.cs +++ b/Tiles/FurnitureStratus/StratusPiano.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusPiano : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureStratus/StratusPlatform.cs b/Tiles/FurnitureStratus/StratusPlatform.cs index 8acbeac080..a948eda538 100644 --- a/Tiles/FurnitureStratus/StratusPlatform.cs +++ b/Tiles/FurnitureStratus/StratusPlatform.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusPlatform : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); @@ -31,9 +31,9 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureStratus/StratusPlatformGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureStratus/StratusPlatformGlow"); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + (Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange)); Tile trackTile = Main.tile[i, j]; if (!(trackTile.halfBrick() && trackTile.slope() == 0)) diff --git a/Tiles/FurnitureStratus/StratusSink.cs b/Tiles/FurnitureStratus/StratusSink.cs index 4bb158fcd2..f6347da355 100644 --- a/Tiles/FurnitureStratus/StratusSink.cs +++ b/Tiles/FurnitureStratus/StratusSink.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusSink : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); diff --git a/Tiles/FurnitureStratus/StratusSofa.cs b/Tiles/FurnitureStratus/StratusSofa.cs index 416386b782..9e73c48ffc 100644 --- a/Tiles/FurnitureStratus/StratusSofa.cs +++ b/Tiles/FurnitureStratus/StratusSofa.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusSofa : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureStratus/StratusStarPlatform.cs b/Tiles/FurnitureStratus/StratusStarPlatform.cs index aed1ca4564..d57682b835 100644 --- a/Tiles/FurnitureStratus/StratusStarPlatform.cs +++ b/Tiles/FurnitureStratus/StratusStarPlatform.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusStarPlatform : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); @@ -32,9 +32,9 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureStratus/StratusStarPlatformGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureStratus/StratusStarPlatformGlow"); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + (Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange)); Tile trackTile = Main.tile[i, j]; if (!(trackTile.halfBrick() && trackTile.slope() == 0)) diff --git a/Tiles/FurnitureStratus/StratusTable.cs b/Tiles/FurnitureStratus/StratusTable.cs index c42aebe680..cebbd41c6d 100644 --- a/Tiles/FurnitureStratus/StratusTable.cs +++ b/Tiles/FurnitureStratus/StratusTable.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusTable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); diff --git a/Tiles/FurnitureStratus/StratusWorkbench.cs b/Tiles/FurnitureStratus/StratusWorkbench.cs index 16c04538f7..8a98181de4 100644 --- a/Tiles/FurnitureStratus/StratusWorkbench.cs +++ b/Tiles/FurnitureStratus/StratusWorkbench.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusWorkbench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureVoid/SmoothVoidstone.cs b/Tiles/FurnitureVoid/SmoothVoidstone.cs index c14ee9e237..926590fb42 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstone.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstone.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class SmoothVoidstone : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -126,8 +126,8 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; int xOffset = 0; int relativeXPos = i % 4; int relativeYPos = j % 4; @@ -216,7 +216,7 @@ namespace CalamityMod.Tiles.FurnitureVoid } xOffset *= 288; xPos += xOffset; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureVoid/SmoothVoidstoneGlow"); + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureVoid/SmoothVoidstoneGlow"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); diff --git a/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs b/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs index 987ebfca08..0893b8bf48 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class SmoothVoidstonePlatform : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); diff --git a/Tiles/FurnitureVoid/VoidBath.cs b/Tiles/FurnitureVoid/VoidBath.cs index 9ca28f7952..5bd0b0616e 100644 --- a/Tiles/FurnitureVoid/VoidBath.cs +++ b/Tiles/FurnitureVoid/VoidBath.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidBath : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureVoid/VoidBed.cs b/Tiles/FurnitureVoid/VoidBed.cs index 16e97b9e42..c09c1f33a9 100644 --- a/Tiles/FurnitureVoid/VoidBed.cs +++ b/Tiles/FurnitureVoid/VoidBed.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidBed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureVoid Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.BedRightClick(i, j); } diff --git a/Tiles/FurnitureVoid/VoidBookcase.cs b/Tiles/FurnitureVoid/VoidBookcase.cs index 0b60dcabf6..efe51e3476 100644 --- a/Tiles/FurnitureVoid/VoidBookcase.cs +++ b/Tiles/FurnitureVoid/VoidBookcase.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidBookcase : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureVoid/VoidCandelabra.cs b/Tiles/FurnitureVoid/VoidCandelabra.cs index 4944ccd7c7..5d0612a182 100644 --- a/Tiles/FurnitureVoid/VoidCandelabra.cs +++ b/Tiles/FurnitureVoid/VoidCandelabra.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidCandelabra : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureVoid/VoidCandle.cs b/Tiles/FurnitureVoid/VoidCandle.cs index 2098bc1644..e5a133a4c5 100644 --- a/Tiles/FurnitureVoid/VoidCandle.cs +++ b/Tiles/FurnitureVoid/VoidCandle.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidCandle : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.FurnitureVoid player.showItemIcon2 = ModContent.ItemType(); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { CalamityUtils.RightClickBreak(i, j); return true; diff --git a/Tiles/FurnitureVoid/VoidChair.cs b/Tiles/FurnitureVoid/VoidChair.cs index 2437fec3c8..ff13d1186c 100644 --- a/Tiles/FurnitureVoid/VoidChair.cs +++ b/Tiles/FurnitureVoid/VoidChair.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidChair : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); diff --git a/Tiles/FurnitureVoid/VoidChandelier.cs b/Tiles/FurnitureVoid/VoidChandelier.cs index 29de8e37d2..33d56c5ab0 100644 --- a/Tiles/FurnitureVoid/VoidChandelier.cs +++ b/Tiles/FurnitureVoid/VoidChandelier.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidChandelier : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChandelier(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chandelier")); @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureVoid/VoidChest.cs b/Tiles/FurnitureVoid/VoidChest.cs index b05d86daf7..82d50f6452 100644 --- a/Tiles/FurnitureVoid/VoidChest.cs +++ b/Tiles/FurnitureVoid/VoidChest.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidChest : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpChest(true); ModTranslation name = CreateMapEntryName(); @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureVoid Chest.DestroyChest(i, j); } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.ChestRightClick(i, j); } diff --git a/Tiles/FurnitureVoid/VoidClock.cs b/Tiles/FurnitureVoid/VoidClock.cs index f8991975ed..0fb492f9fb 100644 --- a/Tiles/FurnitureVoid/VoidClock.cs +++ b/Tiles/FurnitureVoid/VoidClock.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidClock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpClock(true); animationFrameHeight = 90; @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureVoid } } - public override bool NewRightClick(int x, int y) + public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); } diff --git a/Tiles/FurnitureVoid/VoidDoorClosed.cs b/Tiles/FurnitureVoid/VoidDoorClosed.cs index b39ce16441..3ca389e0bb 100644 --- a/Tiles/FurnitureVoid/VoidDoorClosed.cs +++ b/Tiles/FurnitureVoid/VoidDoorClosed.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidDoorClosed : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorClosed(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureVoid/VoidDoorOpen.cs b/Tiles/FurnitureVoid/VoidDoorOpen.cs index b9632252ff..4670e2cc10 100644 --- a/Tiles/FurnitureVoid/VoidDoorOpen.cs +++ b/Tiles/FurnitureVoid/VoidDoorOpen.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidDoorOpen : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDoorOpen(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Door")); diff --git a/Tiles/FurnitureVoid/VoidDresser.cs b/Tiles/FurnitureVoid/VoidDresser.cs index 828e33e204..83d185f6c4 100644 --- a/Tiles/FurnitureVoid/VoidDresser.cs +++ b/Tiles/FurnitureVoid/VoidDresser.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidDresser : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.FurnitureVoid return true; } - public override bool NewRightClick(int i, int j) + public override bool RightClick(int i, int j) { return CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurnitureVoid/VoidLamp.cs b/Tiles/FurnitureVoid/VoidLamp.cs index 692494fb84..640ac0a4b7 100644 --- a/Tiles/FurnitureVoid/VoidLamp.cs +++ b/Tiles/FurnitureVoid/VoidLamp.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidLamp : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLamp(true); AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureVoid/VoidLantern.cs b/Tiles/FurnitureVoid/VoidLantern.cs index 9e01e42454..388ab4e6be 100644 --- a/Tiles/FurnitureVoid/VoidLantern.cs +++ b/Tiles/FurnitureVoid/VoidLantern.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidLantern : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpLantern(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Lantern")); @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - if (Main.tile[i, j].frameX < 18) + if (Main.tile[i, j].TileFrameX < 18) { r = 0.8f; g = 0.9f; diff --git a/Tiles/FurnitureVoid/VoidPiano.cs b/Tiles/FurnitureVoid/VoidPiano.cs index 225967011c..045869299c 100644 --- a/Tiles/FurnitureVoid/VoidPiano.cs +++ b/Tiles/FurnitureVoid/VoidPiano.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidPiano : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureVoid/VoidSink.cs b/Tiles/FurnitureVoid/VoidSink.cs index 302ce22419..67420bddb5 100644 --- a/Tiles/FurnitureVoid/VoidSink.cs +++ b/Tiles/FurnitureVoid/VoidSink.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidSink : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSink(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); diff --git a/Tiles/FurnitureVoid/VoidSofa.cs b/Tiles/FurnitureVoid/VoidSofa.cs index c623f5ae27..150504abf2 100644 --- a/Tiles/FurnitureVoid/VoidSofa.cs +++ b/Tiles/FurnitureVoid/VoidSofa.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidSofa : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureVoid/VoidTable.cs b/Tiles/FurnitureVoid/VoidTable.cs index c97cc52951..10f3ec29cb 100644 --- a/Tiles/FurnitureVoid/VoidTable.cs +++ b/Tiles/FurnitureVoid/VoidTable.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidTable : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpTable(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Table")); diff --git a/Tiles/FurnitureVoid/VoidWorkbench.cs b/Tiles/FurnitureVoid/VoidWorkbench.cs index 3619800ed8..c72c0ebd27 100644 --- a/Tiles/FurnitureVoid/VoidWorkbench.cs +++ b/Tiles/FurnitureVoid/VoidWorkbench.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidWorkbench : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureVoid/VoidstoneSlab.cs b/Tiles/FurnitureVoid/VoidstoneSlab.cs index 9ca593cd3e..bf6621223c 100644 --- a/Tiles/FurnitureVoid/VoidstoneSlab.cs +++ b/Tiles/FurnitureVoid/VoidstoneSlab.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidstoneSlab : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -92,10 +92,10 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - if (Main.tile[i, j].type == ModContent.TileType()) + if (Main.tile[i, j].TileType == ModContent.TileType()) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; int yOffset = 0; int relavtiveXPos = i % 3; int relavtiveYPos = j % 3; @@ -155,7 +155,7 @@ namespace CalamityMod.Tiles.FurnitureVoid } yOffset *= 270; yPos += yOffset; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/FurnitureVoid/VoidstoneSlabGlow"); + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureVoid/VoidstoneSlabGlow"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j, new Color(75, 75, 75, 75)); diff --git a/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs b/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs index 8bcb009f38..9008d5332e 100644 --- a/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs +++ b/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.LivingFire public class LivingBrimstoneFireBlockTile : ModTile { //Thank you to Seraph for getting living fire blocks to work properly. - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; soundType = SoundID.Dig; @@ -59,7 +59,7 @@ namespace CalamityMod.Tiles.LivingFire //return true; //temporary for testing purposes - if (Main.tile[i, j].wall != WallID.None) + if (Main.tile[i, j].WallType != WallID.None) { return true; } @@ -67,7 +67,7 @@ namespace CalamityMod.Tiles.LivingFire for (int k = 0; k < around.Count; ++k) { Tile tile = Main.tile[around[k][0], around[k][1]]; - if (tile.active() && (Main.tileSolid[tile.type] || CalamityLists.livingFireBlockList.Contains(tile.type))) + if (tile.active() && (Main.tileSolid[tile.TileType] || CalamityLists.livingFireBlockList.Contains(tile.TileType))) { return true; } diff --git a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs index ab18c76b3e..648f8311c0 100644 --- a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs +++ b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.LivingFire { public class LivingGodSlayerFireBlockTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; soundType = SoundID.Dig; @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.LivingFire //return true; //temporary for testing purposes - if (Main.tile[i, j].wall != WallID.None) + if (Main.tile[i, j].WallType != WallID.None) { return true; } @@ -66,7 +66,7 @@ namespace CalamityMod.Tiles.LivingFire for (int k = 0; k < around.Count; ++k) { Tile tile = Main.tile[around[k][0], around[k][1]]; - if (tile.active() && (Main.tileSolid[tile.type] || CalamityLists.livingFireBlockList.Contains(tile.type))) + if (tile.active() && (Main.tileSolid[tile.TileType] || CalamityLists.livingFireBlockList.Contains(tile.TileType))) { return true; } diff --git a/Tiles/LivingFire/LivingHolyFireBlockTile.cs b/Tiles/LivingFire/LivingHolyFireBlockTile.cs index c3acb824fb..9e0551acf3 100644 --- a/Tiles/LivingFire/LivingHolyFireBlockTile.cs +++ b/Tiles/LivingFire/LivingHolyFireBlockTile.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.LivingFire { public class LivingHolyFireBlockTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; soundType = SoundID.Dig; @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.LivingFire //return true; //temporary for testing purposes - if (Main.tile[i, j].wall != WallID.None) + if (Main.tile[i, j].WallType != WallID.None) { return true; } @@ -66,7 +66,7 @@ namespace CalamityMod.Tiles.LivingFire for (int k = 0; k < around.Count; ++k) { Tile tile = Main.tile[around[k][0], around[k][1]]; - if (tile.active() && (Main.tileSolid[tile.type] || CalamityLists.livingFireBlockList.Contains(tile.type))) + if (tile.active() && (Main.tileSolid[tile.TileType] || CalamityLists.livingFireBlockList.Contains(tile.TileType))) { return true; } diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 8877eed27a..5a90d1947f 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles { public class MonsterBanner : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles if (player is null || !player.active || player.dead) return; - int style = Main.tile[i, j].frameX / 18; + int style = Main.tile[i, j].TileFrameX / 18; int npc = CalamityUtils.GetBannerNPC(style); if (npc != -1) { diff --git a/Tiles/Ores/AerialiteOre.cs b/Tiles/Ores/AerialiteOre.cs index d6e8259014..983ee7704c 100644 --- a/Tiles/Ores/AerialiteOre.cs +++ b/Tiles/Ores/AerialiteOre.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Ores { public class AerialiteOre : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileValue[Type] = 450; Main.tileSolid[Type] = true; diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index 41a27f994b..64674b6147 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.Ores { public class AstralOre : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; diff --git a/Tiles/Ores/AuricOre.cs b/Tiles/Ores/AuricOre.cs index 9e80a75a8a..e1277c3fd9 100644 --- a/Tiles/Ores/AuricOre.cs +++ b/Tiles/Ores/AuricOre.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.Ores { public class AuricOre : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; diff --git a/Tiles/Ores/ChaoticOre.cs b/Tiles/Ores/ChaoticOre.cs index ee38d34235..920ef433a6 100644 --- a/Tiles/Ores/ChaoticOre.cs +++ b/Tiles/Ores/ChaoticOre.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Ores { public class ChaoticOre : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; @@ -84,9 +84,9 @@ namespace CalamityMod.Tiles.Ores public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Ores/ChaoticOreGlow"); + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Ores/ChaoticOreGlow"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); diff --git a/Tiles/Ores/CharredOre.cs b/Tiles/Ores/CharredOre.cs index 56e3b4981f..dbce2bbcee 100644 --- a/Tiles/Ores/CharredOre.cs +++ b/Tiles/Ores/CharredOre.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.Ores private int sheetWidth = 288; private int sheetHeight = 270; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/Ores/CryonicOre.cs b/Tiles/Ores/CryonicOre.cs index e10737a1a6..fb03790ffc 100644 --- a/Tiles/Ores/CryonicOre.cs +++ b/Tiles/Ores/CryonicOre.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.Ores { public class CryonicOre : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; diff --git a/Tiles/Ores/ExodiumOre.cs b/Tiles/Ores/ExodiumOre.cs index 858e3b3e67..112e34fe63 100644 --- a/Tiles/Ores/ExodiumOre.cs +++ b/Tiles/Ores/ExodiumOre.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.Ores { public class ExodiumOre : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/Ores/HallowedOre.cs b/Tiles/Ores/HallowedOre.cs index 8235c1f242..eacd182e5d 100644 --- a/Tiles/Ores/HallowedOre.cs +++ b/Tiles/Ores/HallowedOre.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.Ores { public class HallowedOre : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; diff --git a/Tiles/Ores/PerennialOre.cs b/Tiles/Ores/PerennialOre.cs index 34c71a9f1a..decae83765 100644 --- a/Tiles/Ores/PerennialOre.cs +++ b/Tiles/Ores/PerennialOre.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Ores { public class PerennialOre : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; diff --git a/Tiles/Ores/UelibloomOre.cs b/Tiles/Ores/UelibloomOre.cs index c0ce986162..b4640b7334 100644 --- a/Tiles/Ores/UelibloomOre.cs +++ b/Tiles/Ores/UelibloomOre.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.Ores { public class UelibloomOre : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/PerennialBar.cs b/Tiles/PerennialBar.cs index 2ad2f1d48f..9a51c743b6 100644 --- a/Tiles/PerennialBar.cs +++ b/Tiles/PerennialBar.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles { public class PerennialBar : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBar(new Color(157, 255, 0)); dustType = 44; diff --git a/Tiles/PerennialBrick.cs b/Tiles/PerennialBrick.cs index 18fe55e282..407d827bf5 100644 --- a/Tiles/PerennialBrick.cs +++ b/Tiles/PerennialBrick.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles { public class PerennialBrick : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; diff --git a/Tiles/PlacedRock.cs b/Tiles/PlacedRock.cs index 742922575a..08b138857c 100644 --- a/Tiles/PlacedRock.cs +++ b/Tiles/PlacedRock.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles { public class PlacedRock : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -33,8 +33,8 @@ namespace CalamityMod.Tiles public override void PlaceInWorld(int i, int j, Item item) { - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0; + Main.tile[i, j].TileFrameX = 0; + Main.tile[i, j].TileFrameY = 0; } } } diff --git a/Tiles/Plates/Chaosplate.cs b/Tiles/Plates/Chaosplate.cs index 887db531b6..ad1884fbed 100644 --- a/Tiles/Plates/Chaosplate.cs +++ b/Tiles/Plates/Chaosplate.cs @@ -13,14 +13,14 @@ namespace CalamityMod.Tiles.Plates internal static Texture2D PulseTexture; internal static Color[] PulseColors; - public override void SetDefaults() + public override void SetStaticDefaults() { if (!Main.dedServ) { - PulseTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/ChaosplatePulse"); + PulseTexture = ModContent.Request("CalamityMod/Tiles/Plates/ChaosplatePulse"); PulseColors = new Color[PulseTexture.Width]; PulseTexture.GetData(PulseColors); - GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/ChaosplateGlow"); + GlowTexture = ModContent.Request("CalamityMod/Tiles/Plates/ChaosplateGlow"); } Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -52,8 +52,8 @@ namespace CalamityMod.Tiles.Plates if (GlowTexture is null || PulseTexture is null) return; - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/Plates/Cinderplate.cs b/Tiles/Plates/Cinderplate.cs index 7a8a6ab9b0..302b519d66 100644 --- a/Tiles/Plates/Cinderplate.cs +++ b/Tiles/Plates/Cinderplate.cs @@ -12,14 +12,14 @@ namespace CalamityMod.Tiles.Plates internal static Texture2D GlowTexture; internal static Texture2D PulseTexture; internal static Color[] PulseColors; - public override void SetDefaults() + public override void SetStaticDefaults() { if (!Main.dedServ) { - PulseTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/CinderplatePulse"); + PulseTexture = ModContent.Request("CalamityMod/Tiles/Plates/CinderplatePulse"); PulseColors = new Color[PulseTexture.Width]; PulseTexture.GetData(PulseColors); - GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/CinderplateGlow"); + GlowTexture = ModContent.Request("CalamityMod/Tiles/Plates/CinderplateGlow"); } Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -51,8 +51,8 @@ namespace CalamityMod.Tiles.Plates if (GlowTexture is null || PulseTexture is null) return; - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/Plates/Elumplate.cs b/Tiles/Plates/Elumplate.cs index 1611ec6cb3..f9638fbc6b 100644 --- a/Tiles/Plates/Elumplate.cs +++ b/Tiles/Plates/Elumplate.cs @@ -12,14 +12,14 @@ namespace CalamityMod.Tiles.Plates internal static Texture2D GlowTexture; internal static Texture2D PulseTexture; internal static Color[] PulseColors; - public override void SetDefaults() + public override void SetStaticDefaults() { if (!Main.dedServ) { - PulseTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/ElumplatePulse"); + PulseTexture = ModContent.Request("CalamityMod/Tiles/Plates/ElumplatePulse"); PulseColors = new Color[PulseTexture.Width]; PulseTexture.GetData(PulseColors); - GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/ElumplateGlow"); + GlowTexture = ModContent.Request("CalamityMod/Tiles/Plates/ElumplateGlow"); } Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -51,8 +51,8 @@ namespace CalamityMod.Tiles.Plates if (GlowTexture is null || PulseTexture is null) return; - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/Plates/Navyplate.cs b/Tiles/Plates/Navyplate.cs index 631e1a22fa..6e7e893f03 100644 --- a/Tiles/Plates/Navyplate.cs +++ b/Tiles/Plates/Navyplate.cs @@ -12,14 +12,14 @@ namespace CalamityMod.Tiles.Plates internal static Texture2D GlowTexture; internal static Texture2D PulseTexture; internal static Color[] PulseColors; - public override void SetDefaults() + public override void SetStaticDefaults() { if (!Main.dedServ) { - PulseTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/NavyplatePulse"); + PulseTexture = ModContent.Request("CalamityMod/Tiles/Plates/NavyplatePulse"); PulseColors = new Color[PulseTexture.Width]; PulseTexture.GetData(PulseColors); - GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/NavyplateGlow"); + GlowTexture = ModContent.Request("CalamityMod/Tiles/Plates/NavyplateGlow"); } Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -51,8 +51,8 @@ namespace CalamityMod.Tiles.Plates if (GlowTexture is null || PulseTexture is null) return; - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/Plates/PlagueContainmentCells.cs b/Tiles/Plates/PlagueContainmentCells.cs index ea73b12a9e..6fdd283f15 100644 --- a/Tiles/Plates/PlagueContainmentCells.cs +++ b/Tiles/Plates/PlagueContainmentCells.cs @@ -11,14 +11,14 @@ namespace CalamityMod.Tiles.Plates internal static Texture2D GlowTexture; internal static Texture2D PulseTexture; internal static Color[] PulseColors; - public override void SetDefaults() + public override void SetStaticDefaults() { if (!Main.dedServ) { - PulseTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/PlagueContainmentCellsPulse"); + PulseTexture = ModContent.Request("CalamityMod/Tiles/Plates/PlagueContainmentCellsPulse"); PulseColors = new Color[PulseTexture.Width]; PulseTexture.GetData(PulseColors); - GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/PlagueContainmentCellsGlow"); + GlowTexture = ModContent.Request("CalamityMod/Tiles/Plates/PlagueContainmentCellsGlow"); } Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -55,8 +55,8 @@ namespace CalamityMod.Tiles.Plates if (GlowTexture is null || PulseTexture is null) return; - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/RoxTile.cs b/Tiles/RoxTile.cs index 79f0272927..8d49e51d19 100644 --- a/Tiles/RoxTile.cs +++ b/Tiles/RoxTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles { public class RoxTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; diff --git a/Tiles/ShadowspecBarTile.cs b/Tiles/ShadowspecBarTile.cs index faea740711..c3b933b35d 100644 --- a/Tiles/ShadowspecBarTile.cs +++ b/Tiles/ShadowspecBarTile.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles { public class ShadowspecBarTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBar(new Color(128, 41, 149)); dustType = ModContent.DustType(); diff --git a/Tiles/SunkenSea/BrainCoral.cs b/Tiles/SunkenSea/BrainCoral.cs index cb986aeae3..f81b010ee6 100644 --- a/Tiles/SunkenSea/BrainCoral.cs +++ b/Tiles/SunkenSea/BrainCoral.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.SunkenSea { public class BrainCoral : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 52e9cc633a..af59b3d012 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.SunkenSea { public class EutrophicSand : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/SunkenSea/FanCoral.cs b/Tiles/SunkenSea/FanCoral.cs index 108cf62bf7..911be21cf6 100644 --- a/Tiles/SunkenSea/FanCoral.cs +++ b/Tiles/SunkenSea/FanCoral.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.SunkenSea { public class FanCoral : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index 8be157b2aa..07f073105b 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.SunkenSea { public class Navystone : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/SunkenSea/SeaAnemone.cs b/Tiles/SunkenSea/SeaAnemone.cs index 79170af7aa..678971ac9f 100644 --- a/Tiles/SunkenSea/SeaAnemone.cs +++ b/Tiles/SunkenSea/SeaAnemone.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.SunkenSea { public class SeaAnemone : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { animationFrameHeight = 36; Main.tileFrameImportant[Type] = true; diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index 6337a4a41e..b80659b9d8 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.SunkenSea { public class SeaPrism : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; diff --git a/Tiles/SunkenSea/SeaPrismCrystals.cs b/Tiles/SunkenSea/SeaPrismCrystals.cs index 789244a49e..2c1e44d151 100644 --- a/Tiles/SunkenSea/SeaPrismCrystals.cs +++ b/Tiles/SunkenSea/SeaPrismCrystals.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.SunkenSea { public class SeaPrismCrystals : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileNoFail[Type] = true; @@ -61,23 +61,23 @@ namespace CalamityMod.Tiles.SunkenSea public override void PlaceInWorld(int i, int j, Item item) { - if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) + if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].TileType] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) { - Main.tile[i, j].frameY = (short)(0 * 18); + Main.tile[i, j].TileFrameY = (short)(0 * 18); } - else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) + else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].TileType] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) { - Main.tile[i, j].frameY = (short)(1 * 18); + Main.tile[i, j].TileFrameY = (short)(1 * 18); } - else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) + else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].TileType] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) { - Main.tile[i, j].frameY = (short)(2 * 18); + Main.tile[i, j].TileFrameY = (short)(2 * 18); } - else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) + else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].TileType] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) { - Main.tile[i, j].frameY = (short)(3 * 18); + Main.tile[i, j].TileFrameY = (short)(3 * 18); } - Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); + Main.tile[i, j].TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); } } } diff --git a/Tiles/SunkenSea/SmallBrainCoral.cs b/Tiles/SunkenSea/SmallBrainCoral.cs index 000f914a56..dd3c509b3a 100644 --- a/Tiles/SunkenSea/SmallBrainCoral.cs +++ b/Tiles/SunkenSea/SmallBrainCoral.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.SunkenSea { public class SmallBrainCoral : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; diff --git a/Tiles/SunkenSea/SmallTubeCoral.cs b/Tiles/SunkenSea/SmallTubeCoral.cs index b055d0dcaa..a479321b0d 100644 --- a/Tiles/SunkenSea/SmallTubeCoral.cs +++ b/Tiles/SunkenSea/SmallTubeCoral.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.SunkenSea { public class SmallTubeCoral : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; diff --git a/Tiles/SunkenSea/SunkenCrateTile.cs b/Tiles/SunkenSea/SunkenCrateTile.cs index f3a9d887ea..da47bb06aa 100644 --- a/Tiles/SunkenSea/SunkenCrateTile.cs +++ b/Tiles/SunkenSea/SunkenCrateTile.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.SunkenSea { public class SunkenCrateTile : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolidTop[Type] = true; Main.tileLighted[Type] = true; diff --git a/Tiles/SunkenSea/SunkenSeaStalactite.cs b/Tiles/SunkenSea/SunkenSeaStalactite.cs index 1df118cef9..7516cff558 100644 --- a/Tiles/SunkenSea/SunkenSeaStalactite.cs +++ b/Tiles/SunkenSea/SunkenSeaStalactite.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Tiles.SunkenSea { public class SunkenSeaStalactite : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; @@ -20,11 +20,11 @@ namespace CalamityMod.Tiles.SunkenSea public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height) { Tile tile = Main.tile[i, j]; - if (tile.frameY <= 18 || tile.frameY == 72) + if (tile.TileFrameY <= 18 || tile.TileFrameY == 72) { offsetY = -2; } - else if ((tile.frameY >= 36 && tile.frameY <= 54) || tile.frameY == 90) + else if ((tile.TileFrameY >= 36 && tile.TileFrameY <= 54) || tile.TileFrameY == 90) { offsetY = 2; } diff --git a/Tiles/SunkenSea/TableCoral.cs b/Tiles/SunkenSea/TableCoral.cs index d90b3f0d9f..55838100a1 100644 --- a/Tiles/SunkenSea/TableCoral.cs +++ b/Tiles/SunkenSea/TableCoral.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.SunkenSea { public class TableCoral : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; diff --git a/Tiles/SunkenSea/TubeCoral.cs b/Tiles/SunkenSea/TubeCoral.cs index 7a48e7e4bc..48640282a8 100644 --- a/Tiles/SunkenSea/TubeCoral.cs +++ b/Tiles/SunkenSea/TubeCoral.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.SunkenSea { public class TubeCoral : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; diff --git a/Tiles/UelibloomBar.cs b/Tiles/UelibloomBar.cs index 08d3d55059..0b93af87da 100644 --- a/Tiles/UelibloomBar.cs +++ b/Tiles/UelibloomBar.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles { public class UelibloomBar : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { this.SetUpBar(new Color(134, 209, 102)); dustType = ModContent.DustType(); diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs index b204630414..aef91e50bb 100644 --- a/Tiles/UelibloomBrick.cs +++ b/Tiles/UelibloomBrick.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles private int extraFrameHeight = 36; private int extraFrameWidth = 90; - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; @@ -37,8 +37,8 @@ namespace CalamityMod.Tiles public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { - if ((Main.tile[i - 1, j - 1].type != Type || Main.tile[i, j - 1].type != Type || Main.tile[i + 1, j - 1].type != Type || - Main.tile[i - 1, j - 2].type != Type || Main.tile[i, j - 2].type != Type || Main.tile[i + 1, j - 2].type != Type) && + if ((Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type || + Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type) && nextSpecialDrawIndex < Main.specX.Length) { Main.specX[nextSpecialDrawIndex] = i; @@ -57,7 +57,7 @@ namespace CalamityMod.Tiles Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j); - Texture2D leaves = ModContent.GetTexture("CalamityMod/Tiles/UelibloomBrick_Leaves"); + Texture2D leaves = ModContent.Request("CalamityMod/Tiles/UelibloomBrick_Leaves"); DrawExtraTop(i, j, leaves, drawOffset, drawColour); DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour); @@ -183,7 +183,7 @@ namespace CalamityMod.Tiles private bool CheckTile(int type, bool equal, int x, int y, int i, int j) { //Subtract y so that y is vertical for ease of readability - return Main.tile[i + x, j - y].type == type == equal; + return Main.tile[i + x, j - y].TileType == type == equal; } private Color GetDrawColour(int i, int j) diff --git a/UI/AcidRainUI.cs b/UI/AcidRainUI.cs index ae342cdc6c..4ade89f0b9 100644 --- a/UI/AcidRainUI.cs +++ b/UI/AcidRainUI.cs @@ -13,6 +13,6 @@ namespace CalamityMod.UI public override float CompletionRatio => 1f - CalamityWorld.AcidRainCompletionRatio; public override string InvasionName => "Acid Rain"; public override Color InvasionBarColor => AcidRainEvent.TextColor; - public override Texture2D IconTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AcidRainIcon"); + public override Texture2D IconTexture => ModContent.Request("CalamityMod/ExtraTextures/UI/AcidRainIcon"); } } diff --git a/UI/AstralArcanumUI.cs b/UI/AstralArcanumUI.cs index 24ea2c6b89..45e6336261 100644 --- a/UI/AstralArcanumUI.cs +++ b/UI/AstralArcanumUI.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.UI { @@ -29,7 +30,7 @@ namespace CalamityMod.UI public static void Load(Mod mod) { - CircleTextures = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AstralArcanumCircles"); + CircleTextures = ModContent.Request("CalamityMod/ExtraTextures/UI/AstralArcanumCircles"); CircleNames = new string[] { "Underworld", @@ -134,7 +135,7 @@ namespace CalamityMod.UI { LastHovered = selectedCircle; if (LastHovered != -1) - Main.PlaySound(SoundID.MenuTick, -1, -1, 1, 1f, 0f); + SoundEngine.PlaySound(SoundID.MenuTick, -1, -1, 1, 1f, 0f); } string text = "Select"; @@ -158,7 +159,7 @@ namespace CalamityMod.UI if (Main.netMode == NetmodeID.SinglePlayer) { p.TeleportationPotion(); - Main.PlaySound(SoundID.Item, (int)p.position.X, (int)p.position.Y, 6, 1f, 0f); + SoundEngine.PlaySound(SoundID.Item, (int)p.position.X, (int)p.position.Y, 6, 1f, 0f); } else if (Main.netMode == NetmodeID.MultiplayerClient) { diff --git a/UI/BossRushUI.cs b/UI/BossRushUI.cs index b587436dee..7b57ced67d 100644 --- a/UI/BossRushUI.cs +++ b/UI/BossRushUI.cs @@ -33,7 +33,7 @@ namespace CalamityMod.UI } public override string InvasionName => "Boss Rush"; public override Color InvasionBarColor => Color.DarkSlateBlue; - public override Texture2D IconTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/UI/BossRushIcon"); + public override Texture2D IconTexture => ModContent.Request("CalamityMod/ExtraTextures/UI/BossRushIcon"); public static float EvaluationLifeRatioFromNPCTypes(params int[] types) { diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 87630a768f..933ec16aff 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -7,6 +7,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.UI; using Terraria.UI.Chat; +using Terraria.Audio; namespace CalamityMod.UI.CalamitasEnchants { @@ -81,7 +82,7 @@ namespace CalamityMod.UI.CalamitasEnchants Main.playerInventory = true; Main.npcChatText = string.Empty; - Texture2D backgroundTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseBackground"); + Texture2D backgroundTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/CalamitasCurseBackground"); Vector2 backgroundScale = Vector2.One * Main.UIScale; // Draw the background. @@ -106,7 +107,7 @@ namespace CalamityMod.UI.CalamitasEnchants DrawEnchantmentDescription(spriteBatch, descriptionDrawPositionTopLeft); if (!string.IsNullOrEmpty(SelectedEnchantment.Value.IconTexturePath)) { - Texture2D iconTexture = ModContent.GetTexture(SelectedEnchantment.Value.IconTexturePath); + Texture2D iconTexture = ModContent.Request(SelectedEnchantment.Value.IconTexturePath); DrawIcon(spriteBatch, iconDrawPositionTopLeft, iconTexture); } } @@ -216,20 +217,20 @@ namespace CalamityMod.UI.CalamitasEnchants public static void DrawItemIcon(SpriteBatch spriteBatch, Vector2 itemSlotDrawPosition, Vector2 reforgeIconDrawPosition, Vector2 scale, out bool isHoveringOverItemIcon, out bool isHoveringOverReforgeIcon) { isHoveringOverReforgeIcon = false; - Texture2D itemSlotTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseItemSlot"); + Texture2D itemSlotTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/CalamitasCurseItemSlot"); - Texture2D reforgeIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_Button"); + Texture2D reforgeIconTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_Button"); Rectangle reforgeIconArea = new Rectangle((int)reforgeIconDrawPosition.X, (int)reforgeIconDrawPosition.Y, (int)(reforgeIconTexture.Width * scale.X), (int)(reforgeIconTexture.Height * scale.Y)); // Have the reforge icon light up if the mouse is hovering over it. if (MouseScreenArea.Intersects(reforgeIconArea)) { - reforgeIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ButtonHovered"); + reforgeIconTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ButtonHovered"); isHoveringOverReforgeIcon = true; } if (ReforgeButtonClickCountdown > 0f) - reforgeIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ButtonClicked"); + reforgeIconTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ButtonClicked"); // This will be used for item deposit/withdrawal logic. isHoveringOverItemIcon = MouseScreenArea.Intersects(new Rectangle((int)itemSlotDrawPosition.X, (int)itemSlotDrawPosition.Y, (int)(itemSlotTexture.Width * scale.X), (int)(itemSlotTexture.Height * scale.Y))); @@ -287,7 +288,7 @@ namespace CalamityMod.UI.CalamitasEnchants { EnchantIndex = 0; Utils.Swap(ref Main.mouseItem, ref CurrentlyHeldItem); - Main.PlaySound(SoundID.Grab); + SoundEngine.PlaySound(SoundID.Grab); } } @@ -298,22 +299,22 @@ namespace CalamityMod.UI.CalamitasEnchants return; // Decide textures. - Texture2D topArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowUp"); - Texture2D bottomArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowDown"); + Texture2D topArrowTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowUp"); + Texture2D bottomArrowTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowDown"); if (TopButtonClickCountdown > 0f) - topArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowUpClicked"); + topArrowTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowUpClicked"); if (BottomButtonClickCountdown > 0f) - bottomArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowDownClicked"); + bottomArrowTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowDownClicked"); Rectangle topButtonArea = new Rectangle((int)topButtonTopLeft.X, (int)topButtonTopLeft.Y, (int)(topArrowTexture.Width * scale.X), (int)(topArrowTexture.Height * scale.Y)); Rectangle bottomButtonArea = new Rectangle((int)bottomButtonTopLeft.X, (int)bottomButtonTopLeft.Y, (int)(bottomArrowTexture.Width * scale.X), (int)(bottomArrowTexture.Height * scale.Y)); bool hoveringOverTopArrow = MouseScreenArea.Intersects(topButtonArea); bool hoveringOverBottomArrow = MouseScreenArea.Intersects(bottomButtonArea); if (hoveringOverTopArrow) - topArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowUpHovered"); + topArrowTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowUpHovered"); if (hoveringOverBottomArrow) - bottomArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowDownHovered"); + bottomArrowTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowDownHovered"); // Draw the arrows. if (EnchantIndex > 0) @@ -328,7 +329,7 @@ namespace CalamityMod.UI.CalamitasEnchants { EnchantIndex--; TopButtonClickCountdown = 15f; - Main.PlaySound(SoundID.MenuTick); + SoundEngine.PlaySound(SoundID.MenuTick); } // Increment the enchantment index if the bottom button is pressed. @@ -336,7 +337,7 @@ namespace CalamityMod.UI.CalamitasEnchants { EnchantIndex++; BottomButtonClickCountdown = 15f; - Main.PlaySound(SoundID.MenuTick); + SoundEngine.PlaySound(SoundID.MenuTick); } } } @@ -400,10 +401,10 @@ namespace CalamityMod.UI.CalamitasEnchants // Reset the enchantment index to prevent index problems on a different item. EnchantIndex = 0; - Main.PlaySound(SoundID.DD2_BetsyFlameBreath, Main.LocalPlayer.Center); + SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath, Main.LocalPlayer.Center); if (SelectedEnchantment.Value.Name == EnchantmentManager.UpgradeEnchantName) - Main.PlaySound(SoundID.DD2_DarkMageHealImpact, Main.LocalPlayer.Center); + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Main.LocalPlayer.Center); } } } diff --git a/UI/ChargeMeterUI.cs b/UI/ChargeMeterUI.cs index 69757c0ea0..b52a8aad16 100644 --- a/UI/ChargeMeterUI.cs +++ b/UI/ChargeMeterUI.cs @@ -32,8 +32,8 @@ namespace CalamityMod.UI Reset(); return; } - Texture2D edgeTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ChargeMeterBorder"); - Texture2D barTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ChargeMeter"); + Texture2D edgeTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/ChargeMeterBorder"); + Texture2D barTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/ChargeMeter"); float uiScale = Main.UIScale; spriteBatch.Draw(edgeTexture, DrawPosition, null, Color.White, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); diff --git a/UI/ChargingStationUI.cs b/UI/ChargingStationUI.cs index e3add0f604..1bcde751c6 100644 --- a/UI/ChargingStationUI.cs +++ b/UI/ChargingStationUI.cs @@ -9,6 +9,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.UI; +using Terraria.Audio; namespace CalamityMod.UI { @@ -55,7 +56,7 @@ namespace CalamityMod.UI Vector2 chargerWorldCenter = charger.Center; if (p.DistanceSQ(chargerWorldCenter) > MaxPlayerDistance * MaxPlayerDistance) { - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); mp.CurrentlyViewedChargerID = -1; return; } @@ -128,7 +129,7 @@ namespace CalamityMod.UI else if((playerHandItem.IsAir && !pluggedItem.IsAir) || (!playerHandItem.IsAir && playerHandItem.Calamity().UsesCharge)) { Utils.Swap(ref playerHandItem, ref pluggedItem); - Main.PlaySound(SoundID.Grab); + SoundEngine.PlaySound(SoundID.Grab); syncRequired = true; } @@ -193,7 +194,7 @@ namespace CalamityMod.UI if (chargerStackDiff != 0) { if (!shiftClicked) - Main.PlaySound(SoundID.Grab); + SoundEngine.PlaySound(SoundID.Grab); charger.CellStack += chargerStackDiff; } } @@ -207,7 +208,7 @@ namespace CalamityMod.UI public static void DrawWeaponSlot(SpriteBatch spriteBatch, Item item, Vector2 drawPosition) { - Texture2D slotBackgroundTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ChargerWeaponSlot"); + Texture2D slotBackgroundTex = ModContent.Request("CalamityMod/ExtraTextures/UI/ChargerWeaponSlot"); spriteBatch.Draw(slotBackgroundTex, drawPosition, null, Color.White, 0f, slotBackgroundTex.Size() * 0.5f, IconScale, SpriteEffects.None, 0f); if (!item.IsAir) diff --git a/UI/CodebreakerUI.cs b/UI/CodebreakerUI.cs index 8506d1f916..8f488ec0d1 100644 --- a/UI/CodebreakerUI.cs +++ b/UI/CodebreakerUI.cs @@ -11,6 +11,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.UI.Chat; +using Terraria.Audio; namespace CalamityMod.UI { @@ -43,7 +44,7 @@ namespace CalamityMod.UI } // Draw the background. - Texture2D backgroundTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonDecrypterBackground"); + Texture2D backgroundTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonDecrypterBackground"); spriteBatch.Draw(backgroundTexture, BackgroundCenter, null, Color.White, 0f, backgroundTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f); Rectangle backgroundArea = Utils.CenteredRectangle(BackgroundCenter, backgroundTexture.Size()); @@ -54,9 +55,9 @@ namespace CalamityMod.UI Vector2 backgroundTopLeft = BackgroundCenter - backgroundTexture.Size() * GeneralScale * 0.5f; // Draw the cell payment slot icon. - Texture2D emptyCellIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/PowerCellSlot_Empty"); - Texture2D occupiedCellIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/PowerCellSlot_Filled"); - Texture2D textPanelTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonDecrypterScreen"); + Texture2D emptyCellIconTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/PowerCellSlot_Empty"); + Texture2D occupiedCellIconTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/PowerCellSlot_Filled"); + Texture2D textPanelTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonDecrypterScreen"); Texture2D cellTexture = codebreakerTileEntity.InputtedCellCount > 0 ? occupiedCellIconTexture : emptyCellIconTexture; Vector2 cellDrawCenter = backgroundTopLeft + Vector2.One * GeneralScale * 60f; @@ -103,7 +104,7 @@ namespace CalamityMod.UI DrawDecryptCancelConfirmationText(textPanelCenter); // Draw the schematic icon. - Texture2D schematicIconBG = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/EncryptedSchematicSlotBackground"); + Texture2D schematicIconBG = ModContent.Request("CalamityMod/ExtraTextures/UI/EncryptedSchematicSlotBackground"); Texture2D schematicIconTexture = schematicIconBG; int schematicType = 0; @@ -111,13 +112,13 @@ namespace CalamityMod.UI schematicType = CalamityLists.EncryptedSchematicIDRelationship[codebreakerTileEntity.HeldSchematicID]; if (schematicType == ModContent.ItemType()) - schematicIconTexture = ModContent.GetTexture("CalamityMod/Items/DraedonMisc/EncryptedSchematicPlanetoid"); + schematicIconTexture = ModContent.Request("CalamityMod/Items/DraedonMisc/EncryptedSchematicPlanetoid"); if (schematicType == ModContent.ItemType()) - schematicIconTexture = ModContent.GetTexture("CalamityMod/Items/DraedonMisc/EncryptedSchematicJungle"); + schematicIconTexture = ModContent.Request("CalamityMod/Items/DraedonMisc/EncryptedSchematicJungle"); if (schematicType == ModContent.ItemType()) - schematicIconTexture = ModContent.GetTexture("CalamityMod/Items/DraedonMisc/EncryptedSchematicHell"); + schematicIconTexture = ModContent.Request("CalamityMod/Items/DraedonMisc/EncryptedSchematicHell"); if (schematicType == ModContent.ItemType()) - schematicIconTexture = ModContent.GetTexture("CalamityMod/Items/DraedonMisc/EncryptedSchematicIce"); + schematicIconTexture = ModContent.Request("CalamityMod/Items/DraedonMisc/EncryptedSchematicIce"); spriteBatch.Draw(schematicIconBG, schematicSlotDrawCenter, null, Color.White, 0f, schematicIconBG.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f); if (codebreakerTileEntity.HeldSchematicID != 0) @@ -199,7 +200,7 @@ namespace CalamityMod.UI if (cellStackDiff != 0) { if (shouldPlaySound) - Main.PlaySound(SoundID.Grab); + SoundEngine.PlaySound(SoundID.Grab); AwaitingDecryptionTextClose = false; codebreakerTileEntity.InputtedCellCount += cellStackDiff; codebreakerTileEntity.SyncContainedStuff(); @@ -233,7 +234,7 @@ namespace CalamityMod.UI codebreakerTileEntity.HeldSchematicID = 0; codebreakerTileEntity.DecryptionCountdown = 0; codebreakerTileEntity.SyncContainedStuff(); - Main.PlaySound(SoundID.Grab); + SoundEngine.PlaySound(SoundID.Grab); AwaitingDecryptionTextClose = false; } @@ -244,7 +245,7 @@ namespace CalamityMod.UI codebreakerTileEntity.HeldSchematicID = CalamityLists.EncryptedSchematicIDRelationship.First(i => i.Value == Main.mouseItem.type).Key; playerHandItem.TurnToAir(); codebreakerTileEntity.SyncContainedStuff(); - Main.PlaySound(SoundID.Grab); + SoundEngine.PlaySound(SoundID.Grab); AwaitingDecryptionTextClose = false; } @@ -255,7 +256,7 @@ namespace CalamityMod.UI int previouslyHeldSchematic = CalamityLists.EncryptedSchematicIDRelationship[codebreakerTileEntity.HeldSchematicID]; // If the schematics are the same, don't actually do anything, just play the sound as an illusion, to prevent having to send a packet. - Main.PlaySound(SoundID.Grab); + SoundEngine.PlaySound(SoundID.Grab); if (playerHandItem.type != previouslyHeldSchematic) { codebreakerTileEntity.HeldSchematicID = CalamityLists.EncryptedSchematicIDRelationship.First(i => i.Value == Main.mouseItem.type).Key; @@ -275,7 +276,7 @@ namespace CalamityMod.UI Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, text, drawPosition.X, drawPosition.Y + GeneralScale * 20f, Color.White * (Main.mouseTextColor / 255f), Color.Black, Vector2.Zero, GeneralScale); // And draw the cells to the right of the text. - Texture2D cellTexture = ModContent.GetTexture("CalamityMod/Items/DraedonMisc/PowerCell"); + Texture2D cellTexture = ModContent.Request("CalamityMod/Items/DraedonMisc/PowerCell"); Vector2 offsetDrawPosition = new Vector2(drawPosition.X + ChatManager.GetStringSize(Main.fontMouseText, text, Vector2.One, -1f).X * GeneralScale + GeneralScale * 15f, drawPosition.Y + GeneralScale * 30f); Main.spriteBatch.Draw(cellTexture, offsetDrawPosition, null, Color.White, 0f, cellTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f); @@ -285,7 +286,7 @@ namespace CalamityMod.UI public static void DrawCostVerificationButton(TECodebreaker codebreakerTileEntity, Vector2 drawPosition) { - Texture2D confirmationTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DecryptIcon"); + Texture2D confirmationTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/DecryptIcon"); Rectangle clickArea = Utils.CenteredRectangle(drawPosition, confirmationTexture.Size() * VerificationButtonScale); // Check if the mouse is hovering over the cost button area. @@ -299,7 +300,7 @@ namespace CalamityMod.UI // Also play a cool sound. if (Main.mouseLeft && Main.mouseLeftRelease) { - Main.PlaySound(SoundID.Zombie, Main.LocalPlayer.Center, 67); + SoundEngine.PlaySound(SoundID.Zombie, Main.LocalPlayer.Center, 67); AwaitingDecryptionTextClose = true; codebreakerTileEntity.InitialCellCountBeforeDecrypting = codebreakerTileEntity.InputtedCellCount; codebreakerTileEntity.DecryptionCountdown = codebreakerTileEntity.DecryptionTotalTime; @@ -319,7 +320,7 @@ namespace CalamityMod.UI public static void DisplayDecryptCancelButton(TECodebreaker codebreakerTileEntity, Vector2 drawPosition) { bool clickingMouse = Main.mouseLeft && Main.mouseLeftRelease; - Texture2D cancelTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DecryptCancelIcon"); + Texture2D cancelTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/DecryptCancelIcon"); Rectangle clickArea = Utils.CenteredRectangle(drawPosition, cancelTexture.Size() * CancelButtonScale * 1.2f); // Check if the mouse is hovering over the decrypt button area. @@ -334,7 +335,7 @@ namespace CalamityMod.UI { if (AwaitingCloseConfirmation) { - Main.PlaySound(SoundID.Item94, Main.LocalPlayer.Center); + SoundEngine.PlaySound(SoundID.Item94, Main.LocalPlayer.Center); AwaitingDecryptionTextClose = false; codebreakerTileEntity.InitialCellCountBeforeDecrypting = 0; @@ -362,7 +363,7 @@ namespace CalamityMod.UI public static void DrawDecryptCancelConfirmationText(Vector2 drawPosition) { - Texture2D textPanelTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonDecrypterScreen"); + Texture2D textPanelTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonDecrypterScreen"); Vector2 scale = new Vector2(1f, 0.3f) * GeneralScale; Main.spriteBatch.Draw(textPanelTexture, drawPosition, null, Color.White, 0f, textPanelTexture.Size() * 0.5f, scale, SpriteEffects.None, 0); @@ -373,7 +374,7 @@ namespace CalamityMod.UI public static void HandleDecryptionStuff(TECodebreaker codebreakerTileEntity, Texture2D backgroundTexture, Vector2 backgroundTopLeft, Vector2 barCenter) { - Texture2D textPanelTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonDecrypterScreen"); + Texture2D textPanelTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonDecrypterScreen"); Vector2 textPanelCenter = backgroundTopLeft + Vector2.UnitX * backgroundTexture.Width * GeneralScale + textPanelTexture.Size() * new Vector2(-0.5f, 0.5f) * GeneralScale; Main.spriteBatch.Draw(textPanelTexture, textPanelCenter, null, Color.White, 0f, textPanelTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f); @@ -415,8 +416,8 @@ namespace CalamityMod.UI return; // Draw a small bar at the bottom to indicate how much work is left. - Texture2D borderTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CodebreakerDecyptionBar"); - Texture2D barTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CodebreakerDecyptionBarCharge"); + Texture2D borderTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/CodebreakerDecyptionBar"); + Texture2D barTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/CodebreakerDecyptionBarCharge"); Main.spriteBatch.Draw(borderTexture, barCenter, null, Color.White, 0f, borderTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0); Rectangle barRectangle = new Rectangle(0, 0, (int)(barTexture.Width * codebreakerTileEntity.DecryptionCompletion), barTexture.Width); Main.spriteBatch.Draw(barTexture, barCenter, barRectangle, Color.White, 0f, barTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0); @@ -429,7 +430,7 @@ namespace CalamityMod.UI public static void HandleDraedonSummonButton(TECodebreaker codebreakerTileEntity, Vector2 drawPosition) { - Texture2D contactButton = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ContactIcon_THanos"); + Texture2D contactButton = ModContent.Request("CalamityMod/ExtraTextures/UI/ContactIcon_THanos"); Rectangle clickArea = Utils.CenteredRectangle(drawPosition, contactButton.Size() * VerificationButtonScale); @@ -446,7 +447,7 @@ namespace CalamityMod.UI { CalamityWorld.DraedonSummonCountdown = CalamityWorld.DraedonSummonCountdownMax; CalamityWorld.DraedonSummonPosition = codebreakerTileEntity.Center + new Vector2(-8f, -100f); - Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/CodebreakerBeam"), CalamityWorld.DraedonSummonPosition); + SoundEngine.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/CodebreakerBeam"), CalamityWorld.DraedonSummonPosition); if (Main.netMode != NetmodeID.SinglePlayer) { diff --git a/UI/DefenseDamageDisplayUI.cs b/UI/DefenseDamageDisplayUI.cs index 5c5597e5b0..7ea0169097 100644 --- a/UI/DefenseDamageDisplayUI.cs +++ b/UI/DefenseDamageDisplayUI.cs @@ -18,7 +18,7 @@ namespace CalamityMod.UI return; string defenseDamageText = (-defenseDamage).ToString(); - Texture2D defenseDamageIcon = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DefenseDamage"); + Texture2D defenseDamageIcon = ModContent.Request("CalamityMod/ExtraTextures/UI/DefenseDamage"); Vector2 defenseDamageIconCenter = new Vector2(Main.screenWidth - Main.UIScale * 96f, Main.UIScale * 4f) + defenseDamageIcon.Size() * 0.5f; Rectangle defenseDamageIconArea = Utils.CenteredRectangle(defenseDamageIconCenter, defenseDamageIcon.Size() * Main.UIScale); Vector2 defenseDamageTextArea = Main.fontMouseText.MeasureString(defenseDamageText); @@ -26,7 +26,7 @@ namespace CalamityMod.UI Rectangle mouseArea = new Rectangle(Main.mouseX, Main.mouseY, 2, 2); bool hoveringOverIcon = mouseArea.Intersects(defenseDamageIconArea); if (hoveringOverIcon) - defenseDamageIcon = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DefenseDamageHover"); + defenseDamageIcon = ModContent.Request("CalamityMod/ExtraTextures/UI/DefenseDamageHover"); // Draw the icon. spriteBatch.Draw(defenseDamageIcon, defenseDamageIconCenter, null, Color.White, 0f, defenseDamageIcon.Size() * 0.5f, Main.UIScale, 0, 0f); diff --git a/UI/DraedonLogHellGUI.cs b/UI/DraedonLogHellGUI.cs index 2b37c0a0fa..239757c933 100644 --- a/UI/DraedonLogHellGUI.cs +++ b/UI/DraedonLogHellGUI.cs @@ -29,11 +29,11 @@ namespace CalamityMod.UI switch (Page) { case 0: - return ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogCragsBiome"); + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogCragsBiome"); case 1: - return ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogWallOfFlesh"); + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogWallOfFlesh"); default: - return ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogMurasamaPhaseslayer"); + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogMurasamaPhaseslayer"); } } } diff --git a/UI/DraedonLogJungleGUI.cs b/UI/DraedonLogJungleGUI.cs index 83bae2f5b9..dace85ef60 100644 --- a/UI/DraedonLogJungleGUI.cs +++ b/UI/DraedonLogJungleGUI.cs @@ -29,11 +29,11 @@ namespace CalamityMod.UI switch (Page) { case 0: - return ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogJungleBiome"); + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogJungleBiome"); case 1: - return ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogPlagueCell"); + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogPlagueCell"); default: - return ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogPlaguebringerGoliath"); + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogPlaguebringerGoliath"); } } } diff --git a/UI/DraedonLogPlanetoidGUI.cs b/UI/DraedonLogPlanetoidGUI.cs index fbe7b9a0e8..0eb894e7c7 100644 --- a/UI/DraedonLogPlanetoidGUI.cs +++ b/UI/DraedonLogPlanetoidGUI.cs @@ -29,11 +29,11 @@ namespace CalamityMod.UI switch (Page) { case 0: - return ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogPlanetoid"); + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogPlanetoid"); case 1: return null; // The Draedon's backstory page does not have an image, and probably shouldn't. default: - return ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogDoGArmor"); + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogDoGArmor"); } } } diff --git a/UI/DraedonLogSnowBiomeGUI.cs b/UI/DraedonLogSnowBiomeGUI.cs index 56f707ff8c..4d84ed7850 100644 --- a/UI/DraedonLogSnowBiomeGUI.cs +++ b/UI/DraedonLogSnowBiomeGUI.cs @@ -29,11 +29,11 @@ namespace CalamityMod.UI switch (Page) { case 0: - return ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogIceBiome"); + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogIceBiome"); case 1: return null; // No image exists for Daedalus' ruins at the moment. default: - return ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogPermafrost"); + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogPermafrost"); } } } diff --git a/UI/DraedonLogSunkenSeaGUI.cs b/UI/DraedonLogSunkenSeaGUI.cs index 0e0caa5904..a815730163 100644 --- a/UI/DraedonLogSunkenSeaGUI.cs +++ b/UI/DraedonLogSunkenSeaGUI.cs @@ -31,11 +31,11 @@ namespace CalamityMod.UI switch (Page) { case 0: - return ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogSunkenSeaBiome"); + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogSunkenSeaBiome"); case 1: - return ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogEutrophicRayGhostBell"); + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogEutrophicRayGhostBell"); default: - return ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogGiantClam"); + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogGiantClam"); } } } diff --git a/UI/DraedonsLogGUI.cs b/UI/DraedonsLogGUI.cs index 4ffc8ab1c4..d0e687c3d0 100644 --- a/UI/DraedonsLogGUI.cs +++ b/UI/DraedonsLogGUI.cs @@ -46,7 +46,7 @@ namespace CalamityMod.UI public override void Draw(SpriteBatch spriteBatch) { - Texture2D pageTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogPage"); + Texture2D pageTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogPage"); float xScale = MathHelper.Lerp(0.004f, 1f, FadeTime / (float)FadeTimeMax); Vector2 scale = new Vector2(xScale, 1f) * new Vector2(Main.screenWidth, Main.screenHeight) / pageTexture.Size(); scale.Y *= 1.5f; @@ -124,7 +124,7 @@ namespace CalamityMod.UI public void DrawArrows(SpriteBatch spriteBatch, float xResolutionScale, float yResolutionScale, float yPageBottom, Rectangle mouseRectangle) { float arrowScale = 0.6f; - Texture2D arrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogArrow"); + Texture2D arrowTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogArrow"); if (Page > 0) { Vector2 drawPosition = new Vector2(Main.screenWidth / 2 - 80f, yPageBottom); @@ -134,7 +134,7 @@ namespace CalamityMod.UI if (mouseRectangle.Intersects(arrowRectangle)) { - arrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogArrowHover"); + arrowTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogArrowHover"); if (ArrowClickCooldown <= 0 && Main.mouseLeft) { Page--; @@ -155,7 +155,7 @@ namespace CalamityMod.UI if (mouseRectangle.Intersects(arrowRectangle)) { - arrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogArrowHover"); + arrowTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogArrowHover"); if (ArrowClickCooldown <= 0 && Main.mouseLeft) { Page++; diff --git a/UI/EnchantmentMetersUI.cs b/UI/EnchantmentMetersUI.cs index 1e9ef17ad0..185fc152a9 100644 --- a/UI/EnchantmentMetersUI.cs +++ b/UI/EnchantmentMetersUI.cs @@ -20,8 +20,8 @@ namespace CalamityMod.UI if (player.Calamity().dischargingItemEnchant) { float dischargeFactor = heldItem.Calamity().DischargeExhaustionRatio; - Texture2D barBorderTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/EphemeralBarBorder"); - Texture2D barTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/EphemeralBar"); + Texture2D barBorderTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/EphemeralBarBorder"); + Texture2D barTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/EphemeralBar"); int barCutoff = (int)(barTexture.Height * (1f - dischargeFactor)); Rectangle barFrame = new Rectangle(0, barCutoff, barTexture.Width, barTexture.Height - barCutoff); diff --git a/UI/ExoMechSelectionUI.cs b/UI/ExoMechSelectionUI.cs index cbaaddc449..a6e8b11d0c 100644 --- a/UI/ExoMechSelectionUI.cs +++ b/UI/ExoMechSelectionUI.cs @@ -38,18 +38,18 @@ namespace CalamityMod.UI { case ExoMech.Destroyer: iconScale = DestroyerIconScale; - iconMechTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/HeadIcon_THanos"); + iconMechTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/HeadIcon_THanos"); description = "Thanatos, a serpentine terror with impervious armor and innumerable laser turrets."; break; case ExoMech.Prime: iconScale = PrimeIconScale; - iconMechTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/HeadIcon_Ares"); + iconMechTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/HeadIcon_Ares"); description = "Ares, a heavyweight, diabolical monstrosity with four Exo superweapons."; break; default: case ExoMech.Twins: iconScale = TwinsIconScale; - iconMechTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/HeadIcon_ArtemisApollo"); + iconMechTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/HeadIcon_ArtemisApollo"); description = "Artemis and Apollo, a pair of extremely agile destroyers with pulse cannons."; break; } diff --git a/UI/LabHologramProjectorUI.cs b/UI/LabHologramProjectorUI.cs index b3d0d77ec9..6c7f97ce1b 100644 --- a/UI/LabHologramProjectorUI.cs +++ b/UI/LabHologramProjectorUI.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; +using Terraria.Audio; namespace CalamityMod.UI { @@ -68,7 +69,7 @@ namespace CalamityMod.UI Vector2 projectorWorldCenter = projector.Center; if (p.DistanceSQ(projectorWorldCenter) > MaxPlayerDistance * MaxPlayerDistance) { - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); mp.CurrentlyViewedHologramID = -1; mp.CurrentlyViewedHologramText = string.Empty; return; diff --git a/UI/ModeIndicatorUI.cs b/UI/ModeIndicatorUI.cs index 2d2f300f52..f3e914a7b7 100644 --- a/UI/ModeIndicatorUI.cs +++ b/UI/ModeIndicatorUI.cs @@ -14,7 +14,7 @@ namespace CalamityMod.UI if (!Main.playerInventory) return; - Texture2D indicatorTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicator"); + Texture2D indicatorTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/ModeIndicator"); int indicatorFrame = 0; if (CalamityWorld.revenge) indicatorFrame = 1; diff --git a/UI/PowerCellFactoryUI.cs b/UI/PowerCellFactoryUI.cs index f3b619d42f..df4479a928 100644 --- a/UI/PowerCellFactoryUI.cs +++ b/UI/PowerCellFactoryUI.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod.UI { @@ -51,7 +52,7 @@ namespace CalamityMod.UI Vector2 factoryWorldCenter = factory.Center; if (p.DistanceSQ(factoryWorldCenter) > MaxPlayerDistance * MaxPlayerDistance) { - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); mp.CurrentlyViewedFactoryID = -1; return; } @@ -114,7 +115,7 @@ namespace CalamityMod.UI // Play a sound, but ONLY if the player didn't shift click. // If they did, they're going to hear the item be picked up in a few frames anyway because it spawned on their face. if (!shiftClicked) - Main.PlaySound(SoundID.Grab); + SoundEngine.PlaySound(SoundID.Grab); } // Since HoverItem is active, we don't need to input anything into this method. diff --git a/UI/RipperUI.cs b/UI/RipperUI.cs index d291dd270a..e7b60b8b81 100644 --- a/UI/RipperUI.cs +++ b/UI/RipperUI.cs @@ -44,22 +44,22 @@ namespace CalamityMod.UI internal static void Load() { - rageBarTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/RageBar"); - rageBorderTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/RageBarBorder"); - rageAnimTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/RageFullAnimation"); + rageBarTex = ModContent.Request("CalamityMod/ExtraTextures/UI/RageBar"); + rageBorderTex = ModContent.Request("CalamityMod/ExtraTextures/UI/RageBarBorder"); + rageAnimTex = ModContent.Request("CalamityMod/ExtraTextures/UI/RageFullAnimation"); - adrenBarTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AdrenalineBar"); - adrenBorderTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AdrenalineBarBorder"); - adrenBorderTexFull = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AdrenalineBarBorderFull"); - adrenAnimTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AdrenalineFullAnimation"); + adrenBarTex = ModContent.Request("CalamityMod/ExtraTextures/UI/AdrenalineBar"); + adrenBorderTex = ModContent.Request("CalamityMod/ExtraTextures/UI/AdrenalineBarBorder"); + adrenBorderTexFull = ModContent.Request("CalamityMod/ExtraTextures/UI/AdrenalineBarBorderFull"); + adrenAnimTex = ModContent.Request("CalamityMod/ExtraTextures/UI/AdrenalineFullAnimation"); - mushroomPlasmaTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/RageDisplay_MushroomPlasmaRoot"); - infernalBloodTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/RageDisplay_InfernalBlood"); - redLightningTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/RageDisplay_RedLightningContainer"); + mushroomPlasmaTex = ModContent.Request("CalamityMod/ExtraTextures/UI/RageDisplay_MushroomPlasmaRoot"); + infernalBloodTex = ModContent.Request("CalamityMod/ExtraTextures/UI/RageDisplay_InfernalBlood"); + redLightningTex = ModContent.Request("CalamityMod/ExtraTextures/UI/RageDisplay_RedLightningContainer"); - electrolyteGelTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AdrenalineDisplay_ElectrolyteGelPack"); - starlightFuelTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AdrenalineDisplay_StarlightFuelCell"); - ectoheartTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AdrenalineDisplay_Ectoheart"); + electrolyteGelTex = ModContent.Request("CalamityMod/ExtraTextures/UI/AdrenalineDisplay_ElectrolyteGelPack"); + starlightFuelTex = ModContent.Request("CalamityMod/ExtraTextures/UI/AdrenalineDisplay_StarlightFuelCell"); + ectoheartTex = ModContent.Request("CalamityMod/ExtraTextures/UI/AdrenalineDisplay_Ectoheart"); pearlOffsetLeft = new Vector2(rageBorderTex.Width * 0.3333f - 6f, rageBorderTex.Height - 9f); pearlOffsetCenter = new Vector2(rageBorderTex.Width * 0.5f - 6f, rageBorderTex.Height - 9f); diff --git a/UI/StealthUI.cs b/UI/StealthUI.cs index 7d7794cc3e..c668cf963d 100644 --- a/UI/StealthUI.cs +++ b/UI/StealthUI.cs @@ -34,10 +34,10 @@ namespace CalamityMod.UI } return; } - Texture2D edgeTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/StealthMeter"); - Texture2D indicatorTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/StealthMeterStrikeIndicator"); - Texture2D barTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/StealthMeterBar"); - Texture2D fullBarTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/StealthMeterBarFull"); + Texture2D edgeTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/StealthMeter"); + Texture2D indicatorTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/StealthMeterStrikeIndicator"); + Texture2D barTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/StealthMeterBar"); + Texture2D fullBarTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/StealthMeterBarFull"); float uiScale = Main.UIScale; spriteBatch.Draw(edgeTexture, DrawPosition, null, Color.White * modPlayer.stealthUIAlpha, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); if (modPlayer.StealthStrikeAvailable()) diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 3891cbd1fe..390780b61e 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -28,118 +28,16 @@ namespace CalamityMod public static void AddRecipes() { - EditLeatherRecipe(); - EditPhoenixBlasterRecipe(); - EditFlamarangRecipe(); - EditTerraBladeRecipe(); - EditFireGauntletRecipe(); - EditSpiritFlameRecipe(); - EditBeetleArmorRecipes(); - EditGoblinArmySummonRecipe(); - EditEvilBossSummonRecipes(); - EditEarlyHardmodeRecipes(); - EditMechBossSummonRecipes(); - EditPumpkinMoonSummonRecipe(); - EditFrostMoonSummonRecipe(); - EditWingRecipes(); - EditEvilBulletRecipes(); - EditPhasesaberRecipes(); - EditOpticStaffRecipe(); - AstralAlternatives(); - EditShroomiteBarRecipe(); - EditChlorophyteBarRecipe(); // Don't remove this in 1.4 since it has 1 less ore required than that version - EditTier3HardmodeBarRecipes(); // Remove this when we get 1.4 port - EditHardmodeOreSetRecipes(); - - AddPotionRecipes(); - AddCookedFood(); - AddToolRecipes(); - AddProgressionRecipes(); - AddEarlyGameWeaponRecipes(); - AddEarlyGameAccessoryRecipes(); - AddArmorRecipes(); - AddAnkhShieldRecipes(); - AddAlternateHardmodeRecipes(); - - // Leather from Vertebrae, for Crimson worlds - ModRecipe r = GetNewRecipe(); - r.AddIngredient(ItemID.Vertebrae, 2); - r.AddTile(TileID.WorkBenches); - r.SetResult(ItemID.Leather); - r.AddRecipe(); - - // Black Lens - r = GetNewRecipe(); - r.AddIngredient(ItemID.Lens); - r.AddIngredient(ItemID.BlackDye); - r.AddTile(TileID.DyeVat); - r.SetResult(ItemID.BlackLens); - r.AddRecipe(); - - // Fallen Star - r = GetNewRecipe(); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.FallenStar); - r.AddRecipe(); - - // Hallowed Bars - r = GetNewRecipe(); - r.AddIngredient(ModContent.ItemType(), 4); - r.AddTile(TileID.AdamantiteForge); - r.SetResult(ItemID.HallowedBar); - r.AddRecipe(); - - // Rocket I from Empty Bullet - r = GetNewRecipe(); - r.AddIngredient(ItemID.EmptyBullet, 20); - r.AddIngredient(ItemID.ExplosivePowder, 1); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.RocketI, 20); - r.AddRecipe(); - - // Life Crystal - r = GetNewRecipe(); - r.AddIngredient(ItemID.StoneBlock, 5); - r.AddIngredient(ItemID.Ruby, 2); - r.AddIngredient(ItemID.HealingPotion); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.LifeCrystal); - r.AddRecipe(); - - // Life Fruit - r = GetNewRecipe(); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddIngredient(ModContent.ItemType()); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.LifeFruit); - r.AddRecipe(); - - // Ultrabright Torch - r = GetNewRecipe(); - r.AddIngredient(ItemID.Torch, 33); - r.AddIngredient(ModContent.ItemType()); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.UltrabrightTorch, 33); - r.AddRecipe(); - - // Money Trough - r = GetNewRecipe(); - r.AddIngredient(ItemID.PiggyBank); - r.AddIngredient(ItemID.Feather, 2); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ItemID.GoldCoin, 15); - r.AddRecipeGroup("AnyGoldBar", 8); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.MoneyTrough); - r.AddRecipe(); - - // Target Dummy Reverse Compatibility - r = GetNewRecipe(); - r.AddIngredient(ModContent.ItemType()); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.TargetDummy); - r.AddRecipe(); + CreateRecipe(1).AddIngredient(ItemID.Vertebrae, 2).AddTile(TileID.WorkBenches).ReplaceResult(ItemID.Leather); + CreateRecipe(1).AddIngredient(ItemID.Lens).AddIngredient(ItemID.BlackDye).AddTile(TileID.DyeVat).ReplaceResult(ItemID.BlackLens); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.Anvils).ReplaceResult(ItemID.FallenStar); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.AdamantiteForge).ReplaceResult(ItemID.HallowedBar); + CreateRecipe(20).AddIngredient(ItemID.EmptyBullet, 20).AddIngredient(ItemID.ExplosivePowder, 1).AddTile(TileID.MythrilAnvil).ReplaceResult(ItemID.RocketI); + CreateRecipe(1).AddIngredient(ItemID.StoneBlock, 5).AddIngredient(ItemID.Ruby, 2).AddIngredient(ItemID.HealingPotion).AddTile(TileID.Anvils).ReplaceResult(ItemID.LifeCrystal); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType()).AddTile(TileID.MythrilAnvil).ReplaceResult(ItemID.LifeFruit); + CreateRecipe(33).AddIngredient(ItemID.Torch, 33).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).ReplaceResult(ItemID.UltrabrightTorch); + CreateRecipe(1).AddIngredient(ItemID.PiggyBank).AddIngredient(ItemID.Feather, 2).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.GoldCoin, 15).AddRecipeGroup("AnyGoldBar", 8).AddTile(TileID.Anvils).ReplaceResult(ItemID.MoneyTrough); + CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).ReplaceResult(ItemID.TargetDummy); } // Change Leather's recipe to require 2 Rotten Chunks/Vertebrae diff --git a/Utilities/CollisionUtils.cs b/Utilities/CollisionUtils.cs index 3d79b60d96..3458a94218 100644 --- a/Utilities/CollisionUtils.cs +++ b/Utilities/CollisionUtils.cs @@ -72,7 +72,7 @@ namespace CalamityMod // Since Terraria's tile coordinate system is discrete and does not care for more advanced concepts, // the amount of tiles searched such far is a sufficient answer. Tile tile = ParanoidTileRetrieval(checkPosition.X, checkPosition.Y); - if (WorldGen.SolidTile(tile) || (checkDirection.Y >= 0f && tile.active() && Main.tileSolidTop[tile.type])) + if (WorldGen.SolidTile(tile) || (checkDirection.Y >= 0f && tile.active() && Main.tileSolidTop[tile.TileType])) return i; } return null; diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index e21c57620c..7142497a4c 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -252,7 +252,7 @@ namespace CalamityMod start -= Main.screenPosition; end -= Main.screenPosition; - Texture2D line = ModContent.GetTexture("InfernumMode/ExtraTextures/Line"); + Texture2D line = ModContent.Request("InfernumMode/ExtraTextures/Line"); float rotation = (end - start).ToRotation(); Vector2 scale = new Vector2(Vector2.Distance(start, end) / line.Width, width); @@ -587,7 +587,7 @@ namespace CalamityMod public static void DrawAuroras(Player player, float auroraCount, float opacity, Color color) { float time = Main.GlobalTime % 3f / 3f; - Texture2D auroraTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AuroraTexture"); + Texture2D auroraTexture = ModContent.Request("CalamityMod/ExtraTextures/AuroraTexture"); for (int i = 0; i < auroraCount; i++) { float incrementOffsetAngle = MathHelper.TwoPi * i / auroraCount; diff --git a/Utilities/FurnitureSetupUtils.cs b/Utilities/FurnitureSetupUtils.cs index 0426924d45..bc66a164e9 100644 --- a/Utilities/FurnitureSetupUtils.cs +++ b/Utilities/FurnitureSetupUtils.cs @@ -8,6 +8,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod { @@ -29,10 +30,10 @@ namespace CalamityMod { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; + int spawnX = i - tile.TileFrameX / 18; int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) + spawnX += tile.TileFrameX >= 72 ? 5 : 2; + if (tile.TileFrameY % 38 != 0) { spawnY--; } @@ -57,24 +58,24 @@ namespace CalamityMod Main.mouseRightRelease = false; int left = i; int top = j; - if (tile.frameX % 36 != 0) + if (tile.TileFrameX % 36 != 0) { left--; } - if (tile.frameY != 0) + if (tile.TileFrameY != 0) { top--; } if (player.sign >= 0) { - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); player.sign = -1; Main.editSign = false; Main.npcChatText = ""; } if (Main.editChest) { - Main.PlaySound(SoundID.MenuTick); + SoundEngine.PlaySound(SoundID.MenuTick); Main.editChest = false; Main.npcChatText = ""; } @@ -90,7 +91,7 @@ namespace CalamityMod { player.chest = -1; Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); } else { @@ -107,7 +108,7 @@ namespace CalamityMod if (chest == player.chest) { player.chest = -1; - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); } else { @@ -116,7 +117,7 @@ namespace CalamityMod Main.recBigList = false; player.chestX = left; player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + SoundEngine.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); } Recipe.FindRecipes(); } @@ -130,11 +131,11 @@ namespace CalamityMod Tile tile = Main.tile[i, j]; int left = i; int top = j; - if (tile.frameX % 36 != 0) + if (tile.TileFrameX % 36 != 0) { left--; } - if (tile.frameY != 0) + if (tile.TileFrameY != 0) { top--; } @@ -220,24 +221,24 @@ namespace CalamityMod public static bool DresserRightClick() { Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + if (Main.tile[Player.tileTargetX, Player.tileTargetY].TileFrameY == 0) { Main.CancelClothesWindow(true); - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].TileFrameX / 18); left %= 3; left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].TileFrameY / 18); if (player.sign > -1) { - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); player.sign = -1; Main.editSign = false; Main.npcChatText = string.Empty; } if (Main.editChest) { - Main.PlaySound(SoundID.MenuTick); + SoundEngine.PlaySound(SoundID.MenuTick); Main.editChest = false; Main.npcChatText = string.Empty; } @@ -252,7 +253,7 @@ namespace CalamityMod { player.chest = -1; Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); } else { @@ -272,14 +273,14 @@ namespace CalamityMod { player.chest = -1; Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); } else if (num213 != player.chest && player.chest == -1) { player.chest = num213; Main.playerInventory = true; Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); + SoundEngine.PlaySound(SoundID.MenuOpen); player.chestX = left; player.chestY = top; } @@ -288,7 +289,7 @@ namespace CalamityMod player.chest = num213; Main.playerInventory = true; Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); + SoundEngine.PlaySound(SoundID.MenuTick); player.chestX = left; player.chestY = top; } @@ -317,8 +318,8 @@ namespace CalamityMod Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; int left = Player.tileTargetX; int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) + left -= (int)(tile.TileFrameX % 54 / 18); + if (tile.TileFrameY % 36 != 0) { top--; } @@ -359,8 +360,8 @@ namespace CalamityMod Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; int left = Player.tileTargetX; int top = Player.tileTargetY; - left -= (int)(tile.frameX % 54 / 18); - if (tile.frameY % 36 != 0) + left -= (int)(tile.TileFrameX % 54 / 18); + if (tile.TileFrameY % 36 != 0) { top--; } @@ -388,7 +389,7 @@ namespace CalamityMod } player.noThrow = 2; player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + if (Main.tile[Player.tileTargetX, Player.tileTargetY].TileFrameY > 0) { player.showItemIcon2 = ItemID.FamiliarShirt; } @@ -401,7 +402,7 @@ namespace CalamityMod // If the player right clicked the chest while editing a sign, finish that up if (player.sign >= 0) { - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); player.sign = -1; Main.editSign = false; Main.npcChatText = ""; @@ -410,7 +411,7 @@ namespace CalamityMod // If the player right clicked the chest while editing a chest, finish that up if (Main.editChest) { - Main.PlaySound(SoundID.MenuTick); + SoundEngine.PlaySound(SoundID.MenuTick); Main.editChest = false; Main.npcChatText = ""; } @@ -428,7 +429,7 @@ namespace CalamityMod { player.chest = -1; Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); } // Right clicking this chest opens it if it's not already open. This counts as interaction. @@ -465,7 +466,7 @@ namespace CalamityMod if (chest == player.chest) { player.chest = -1; - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); } // If you right click this chest when you have a different chest selected, that one closes and this one opens. This counts as interaction. @@ -476,7 +477,7 @@ namespace CalamityMod Main.recBigList = false; player.chestX = left; player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + SoundEngine.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); } Recipe.FindRecipes(); @@ -496,11 +497,11 @@ namespace CalamityMod Tile tile = Main.tile[i, j]; int left = i; int top = j; - if (tile.frameX % 36 != 0) + if (tile.TileFrameX % 36 != 0) { left--; } - if (tile.frameY != 0) + if (tile.TileFrameY != 0) { top--; } @@ -516,7 +517,7 @@ namespace CalamityMod if (player.showItemIconText == chestName) { player.showItemIcon2 = ItemType(); - if (Main.tile[left, top].frameX / 36 == 1) + if (Main.tile[left, top].TileFrameX / 36 == 1) player.showItemIcon2 = ItemType(); player.showItemIconText = ""; } diff --git a/Utilities/GenericAIUtils.cs b/Utilities/GenericAIUtils.cs index 3fd95161bd..6686b019c1 100644 --- a/Utilities/GenericAIUtils.cs +++ b/Utilities/GenericAIUtils.cs @@ -580,11 +580,11 @@ namespace CalamityMod Tile tile = Main.tile[x, y]; bool platformCheck = true; if (ignorePlatforms) - platformCheck = !TileID.Sets.Platforms[tile.type] && tile.type != TileID.PlanterBox; + platformCheck = !TileID.Sets.Platforms[tile.TileType] && tile.TileType != TileID.PlanterBox; bool tableCheck = false; if (stickToEverything) - tableCheck = Main.tileSolidTop[tile.type] && tile.frameY == 0; - if (tile != null && tile.nactive() && platformCheck && (Main.tileSolid[tile.type] || tableCheck)) + tableCheck = Main.tileSolidTop[tile.TileType] && tile.TileFrameY == 0; + if (tile != null && tile.nactive() && platformCheck && (Main.tileSolid[tile.TileType] || tableCheck)) { Vector2 tileSize; tileSize.X = (float)(x * 16); diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 7ce307cefd..35d6b4bd97 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -7,6 +7,7 @@ using System.Text; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; namespace CalamityMod { @@ -348,7 +349,7 @@ namespace CalamityMod } // Broadsword use style - if (item.useStyle == ItemUseStyleID.SwingThrow) + if (item.useStyle == ItemUseStyleID.Swing) { // Third hitbox size adjustments if (player.itemAnimation < player.itemAnimationMax * 0.333) @@ -437,7 +438,7 @@ namespace CalamityMod if (!showsOver) { - Main.PlaySound(item.UseSound, player.Center); + SoundEngine.PlaySound(item.UseSound, player.Center); double healMult = 1D + (player.Calamity().coreOfTheBloodGod ? 0.15 : 0) + diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 9ea4f431df..4615a45d97 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -15,13 +15,13 @@ namespace CalamityMod { #region Damage // These functions factor in TML 0.11 allDamage to get the player's total damage boost which affects the specified class. - public static float MeleeDamage(this Player player) => player.allDamage + player.meleeDamage - 1f; - public static float RangedDamage(this Player player) => player.allDamage + player.rangedDamage - 1f; - public static float MagicDamage(this Player player) => player.allDamage + player.magicDamage - 1f; - public static float MinionDamage(this Player player) => player.allDamage + player.minionDamage - 1f; - public static float ThrownDamage(this Player player) => player.allDamage + player.thrownDamage - 1f; - public static float RogueDamage(this Player player) => player.allDamage + player.thrownDamage + player.Calamity().throwingDamage - 2f; - public static float AverageDamage(this Player player) => player.allDamage + (player.meleeDamage + player.rangedDamage + player.magicDamage + player.minionDamage + player.Calamity().throwingDamage - 5f) / 5f; + public static float MeleeDamage(this Player player) => player.allDamage + player.GetDamage(DamageClass.Melee) - 1f; + public static float RangedDamage(this Player player) => player.allDamage + player.GetDamage(DamageClass.Ranged) - 1f; + public static float MagicDamage(this Player player) => player.allDamage + player.GetDamage(DamageClass.Magic) - 1f; + public static float MinionDamage(this Player player) => player.allDamage + player.GetDamage(DamageClass.Summon) - 1f; + public static float ThrownDamage(this Player player) => player.allDamage + player.GetDamage(DamageClass.Throwing) - 1f; + public static float RogueDamage(this Player player) => player.allDamage + player.GetDamage(DamageClass.Throwing) + player.Calamity().throwingDamage - 2f; + public static float AverageDamage(this Player player) => player.allDamage + (player.GetDamage(DamageClass.Melee) + player.GetDamage(DamageClass.Ranged) + player.GetDamage(DamageClass.Magic) + player.GetDamage(DamageClass.Summon) + player.Calamity().throwingDamage - 5f) / 5f; #endregion public static bool StandingStill(this Player player, float velocity = 0.05f) => player.velocity.Length() < velocity; @@ -300,7 +300,7 @@ namespace CalamityMod { checkedTile = Main.tile[(int)player.Center.X / 16 + player.direction * i, (int)(player.position.Y + (float)player.height - 1f) / 16 + 1 - j]; - ConditionMet = !(checkedTile != null && checkedTile.nactive() && Main.tileSolid[checkedTile.type]); //IsTileSolidGround minus the ground part, to avoid platforms and other half solid tiles messing it up + ConditionMet = !(checkedTile != null && checkedTile.nactive() && Main.tileSolid[checkedTile.TileType]); //IsTileSolidGround minus the ground part, to avoid platforms and other half solid tiles messing it up if (!ConditionMet) return ConditionMet; } diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index 350bd7dcd3..c0e5da308f 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -336,7 +336,7 @@ namespace CalamityMod { Vector2 explodeArea = new Vector2(Math.Abs(x - projectile.position.X / 16f), Math.Abs(y - projectile.position.Y / 16f)); float distance = explodeArea.Length(); - if (distance < explosionRadius && Main.tile[x, y] != null && Main.tile[x, y].wall == WallID.None) + if (distance < explosionRadius && Main.tile[x, y] != null && Main.tile[x, y].WallType == WallID.None) { canKillWalls = true; break; @@ -387,7 +387,7 @@ namespace CalamityMod { if (checkExplosions) { - if (Main.tileDungeon[tile.type] || explosionCheckList.Contains(tile.type)) + if (Main.tileDungeon[tile.TileType] || explosionCheckList.Contains(tile.TileType)) { canKillTile = false; } @@ -396,11 +396,11 @@ namespace CalamityMod canKillTile = false; } } - if (Main.tileContainer[tile.type]) + if (Main.tileContainer[tile.TileType]) canKillTile = false; - if (!TileLoader.CanKillTile(i, j, tile.type, ref t) || !TileLoader.CanKillTile(i, j, tile.type, ref f)) + if (!TileLoader.CanKillTile(i, j, tile.TileType, ref t) || !TileLoader.CanKillTile(i, j, tile.TileType, ref f)) canKillTile = false; - if (tileExcludeList.Contains(tile.type)) + if (tileExcludeList.Contains(tile.TileType)) canKillTile = false; if (canKillTile) @@ -420,13 +420,13 @@ namespace CalamityMod { bool canExplode = true; if (checkExplosions) - canExplode = WallLoader.CanExplode(x, y, Main.tile[x, y].wall); - if (wallExcludeList.Any() && wallExcludeList.Contains(Main.tile[x, y].wall)) + canExplode = WallLoader.CanExplode(x, y, Main.tile[x, y].WallType); + if (wallExcludeList.Any() && wallExcludeList.Contains(Main.tile[x, y].WallType)) canKillWalls = false; - if (Main.tile[x, y] != null && Main.tile[x, y].wall > WallID.None && canKillWalls && canExplode) + if (Main.tile[x, y] != null && Main.tile[x, y].WallType > WallID.None && canKillWalls && canExplode) { WorldGen.KillWall(x, y, false); - if (Main.tile[x, y].wall == WallID.None && Main.netMode != NetmodeID.SinglePlayer) + if (Main.tile[x, y].WallType == WallID.None && Main.netMode != NetmodeID.SinglePlayer) { NetMessage.SendData(MessageID.TileChange, -1, -1, null, 2, x, y, 0f, 0, 0, 0); } diff --git a/Utilities/TileEntityUtils.cs b/Utilities/TileEntityUtils.cs index b664f635f5..22844da034 100644 --- a/Utilities/TileEntityUtils.cs +++ b/Utilities/TileEntityUtils.cs @@ -6,6 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.UI.Chat; using static Terraria.ModLoader.ModContent; +using Terraria.Audio; namespace CalamityMod { @@ -31,8 +32,8 @@ namespace CalamityMod { // Find the top left corner of the FrameImportant tile that the player clicked on in the world. Tile t = Main.tile[i, j]; - int left = i - t.frameX % (width * sheetSquare) / sheetSquare; - int top = j - t.frameY % (height * sheetSquare) / sheetSquare; + int left = i - t.TileFrameX % (width * sheetSquare) / sheetSquare; + int top = j - t.TileFrameY % (height * sheetSquare) / sheetSquare; byte chargerType = GetInstance().type; bool exists = TileEntity.ByPosition.TryGetValue(new Point16(left, top), out TileEntity te); @@ -50,14 +51,14 @@ namespace CalamityMod // If a sign or chest was in use previously, close those GUIs. if (player.sign >= 0) { - Main.PlaySound(SoundID.MenuClose); + SoundEngine.PlaySound(SoundID.MenuClose); player.sign = -1; Main.editSign = false; Main.npcChatText = ""; } if (Main.editChest) { - Main.PlaySound(SoundID.MenuTick); + SoundEngine.PlaySound(SoundID.MenuTick); Main.editChest = false; Main.npcChatText = ""; } diff --git a/Utilities/TileFraming.cs b/Utilities/TileFraming.cs index e7d21ef6ff..48e94d0176 100644 --- a/Utilities/TileFraming.cs +++ b/Utilities/TileFraming.cs @@ -34,9 +34,9 @@ namespace CalamityMod if (check is null || !check.active()) return Similarity.None; - if (check.type == myType || Main.tileMerge[myType][check.type]) + if (check.TileType == myType || Main.tileMerge[myType][check.TileType]) return Similarity.Same; - else if (check.type == mergeType) + else if (check.TileType == mergeType) return Similarity.MergeLink; return Similarity.None; @@ -109,7 +109,7 @@ namespace CalamityMod { if (myTile is null || mergeTile is null) return false; - return mergeTile.active() && (mergeTile.type == myTile.type || Main.tileMerge[myTile.type][mergeTile.type]); + return mergeTile.active() && (mergeTile.TileType == myTile.TileType || Main.tileMerge[myTile.TileType][mergeTile.TileType]); } private static void GetAdjacentTiles(int x, int y, out bool up, out bool down, out bool left, out bool right, out bool upLeft, out bool upRight, out bool downLeft, out bool downRight) @@ -157,8 +157,8 @@ namespace CalamityMod Tile tile = Main.tile[x, y]; if (tile != null) { - tile.frameX = (short)frameX; - tile.frameY = (short)frameY; + tile.TileFrameX = (short)frameX; + tile.TileFrameY = (short)frameY; } } #endregion @@ -175,7 +175,7 @@ namespace CalamityMod return; int checkType = -1; - int plantType = tile.type; + int plantType = tile.TileType; // If the tile below is off the bottom of the map, then assume it's the same tile type. if (y + 1 >= Main.maxTilesY) @@ -184,7 +184,7 @@ namespace CalamityMod { Tile below = Main.tile[x, y + 1]; if (below != null && below.nactive() && !below.halfBrick() && below.slope() == 0) - checkType = below.type; + checkType = below.TileType; } // Sub function to determine whether the plant needs an update @@ -205,21 +205,21 @@ namespace CalamityMod if (checkType == -1 || !PlantNeedsUpdate(plantType, checkType)) return; - if ((plantType == TileID.Plants || plantType == TileID.Plants2) && checkType != TileID.Grass && tile.frameX >= 162) + if ((plantType == TileID.Plants || plantType == TileID.Plants2) && checkType != TileID.Grass && tile.TileFrameX >= 162) { - Main.tile[x, y].frameX = 126; + Main.tile[x, y].TileFrameX = 126; } - if (plantType == TileID.JunglePlants2 && checkType != TileID.JungleGrass && tile.frameX >= 162) + if (plantType == TileID.JunglePlants2 && checkType != TileID.JungleGrass && tile.TileFrameX >= 162) { - Main.tile[x, y].frameX = 126; + Main.tile[x, y].TileFrameX = 126; } if (checkType == TileID.CorruptGrass) { plantType = TileID.CorruptPlants; - if (tile.frameX >= 162) + if (tile.TileFrameX >= 162) { - Main.tile[x, y].frameX = 126; + Main.tile[x, y].TileFrameX = 126; } } else if (checkType == TileID.Grass) @@ -237,14 +237,14 @@ namespace CalamityMod else if (checkType == TileID.MushroomGrass) { plantType = TileID.MushroomPlants; - while (Main.tile[x, y].frameX > 72) + while (Main.tile[x, y].TileFrameX > 72) { - Main.tile[x, y].frameX -= 72; + Main.tile[x, y].TileFrameX -= 72; } } // Astral grass and plant behavior - else if (checkType == ModContent.GetInstance().TileType("AstralGrass")) + else if (checkType == ModContent.GetInstance().Find("AstralGrass").Type) { bool isShortPlant = plantType == TileID.Plants || plantType == TileID.CorruptPlants || @@ -252,12 +252,12 @@ namespace CalamityMod plantType == TileID.HallowedPlants || plantType == TileID.MushroomPlants || plantType == TileID.JunglePlants; - plantType = ModContent.GetInstance().TileType(isShortPlant ? "AstralShortPlants" : "AstralTallPlants"); + plantType = ModContent.GetInstance().Find(isShortPlant ? "AstralShortPlants" : "AstralTallPlants").Type; } // If the tile type is not the same as the plant type, then set it equal. Otherwise, destroy it. - if (Main.tile[x, y].type != plantType) - Main.tile[x, y].type = (ushort)plantType; + if (Main.tile[x, y].TileType != plantType) + Main.tile[x, y].TileType = (ushort)plantType; else WorldGen.KillTile(x, y, false, false, false); } @@ -272,11 +272,11 @@ namespace CalamityMod if (tile is null) return; - int myType = tile.type; + int myType = tile.TileType; // Get the type of the tile above this vine. If that tile doesn't exist, just assume it's another vine. Tile north = y <= 0 ? null : Main.tile[x, y - 1]; - int northType = north is null ? myType : (!north.active() || north.bottomSlope()) ? -1 : north.type; + int northType = north is null ? myType : (!north.active() || north.bottomSlope()) ? -1 : north.TileType; // Make this vine match the tile above it if that's another vine or a grass tile. ushort[] vines = VineToGrass.Keys.ToArray(); @@ -285,7 +285,7 @@ namespace CalamityMod ushort correspondingGrass = VineToGrass[vines[i]]; if (myType != vines[i] && (northType == correspondingGrass || northType == vines[i])) { - Main.tile[x, y].type = vines[i]; + Main.tile[x, y].TileType = vines[i]; WorldGen.SquareTileFrame(x, y, true); return; } @@ -327,7 +327,7 @@ namespace CalamityMod if (tile is null) return false; - if (tile.slope() > 0 && TileID.Sets.HasSlopeFrames[tile.type]) + if (tile.slope() > 0 && TileID.Sets.HasSlopeFrames[tile.TileType]) { return true; } @@ -355,26 +355,26 @@ namespace CalamityMod #region L States if (!up && down && !left && right && !downRight) { - tile.frameX = 13 * 18; - tile.frameY = 0; + tile.TileFrameX = 13 * 18; + tile.TileFrameY = 0; return false; } if (!up && down && left && !right && !downLeft) { - tile.frameX = 15 * 18; - tile.frameY = 0; + tile.TileFrameX = 15 * 18; + tile.TileFrameY = 0; return false; } if (up && !down && !left && right && !upRight) { - tile.frameX = 13 * 18; - tile.frameY = 2 * 18; + tile.TileFrameX = 13 * 18; + tile.TileFrameY = 2 * 18; return false; } if (up && !down && left && !right && !upLeft) { - tile.frameX = 15 * 18; - tile.frameY = 2 * 18; + tile.TileFrameX = 15 * 18; + tile.TileFrameY = 2 * 18; return false; } #endregion @@ -382,26 +382,26 @@ namespace CalamityMod #region T States if (!up && down && left && right && !downLeft && !downRight) { - tile.frameX = 14 * 18; - tile.frameY = 0; + tile.TileFrameX = 14 * 18; + tile.TileFrameY = 0; return false; } if (up && !down && left && right && !upLeft && !upRight) { - tile.frameX = 14 * 18; - tile.frameY = 2 * 18; + tile.TileFrameX = 14 * 18; + tile.TileFrameY = 2 * 18; return false; } if (up && down && !left && right && !downRight && !upRight) { - tile.frameX = 13 * 18; - tile.frameY = 18; + tile.TileFrameX = 13 * 18; + tile.TileFrameY = 18; return false; } if (up && down && left && !right && !downLeft && !upLeft) { - tile.frameX = 15 * 18; - tile.frameY = 18; + tile.TileFrameX = 15 * 18; + tile.TileFrameY = 18; return false; } #endregion @@ -409,8 +409,8 @@ namespace CalamityMod #region X State if (up && down && left && right && !downLeft && !downRight && !upLeft && !upRight) { - tile.frameX = 14 * 18; - tile.frameY = 18; + tile.TileFrameX = 14 * 18; + tile.TileFrameY = 18; return false; } #endregion @@ -418,26 +418,26 @@ namespace CalamityMod #region Inner Corner x1 if (up && down && left && right && !downLeft && downRight && upLeft && upRight) { - tile.frameX = 15 * 18; - tile.frameY = 3 * 18; + tile.TileFrameX = 15 * 18; + tile.TileFrameY = 3 * 18; return false; } if (up && down && left && right && downLeft && !downRight && upLeft && upRight) { - tile.frameX = 14 * 18; - tile.frameY = 3 * 18; + tile.TileFrameX = 14 * 18; + tile.TileFrameY = 3 * 18; return false; } if (up && down && left && right && downLeft && downRight && !upLeft && upRight) { - tile.frameX = 15 * 18; - tile.frameY = 4 * 18; + tile.TileFrameX = 15 * 18; + tile.TileFrameY = 4 * 18; return false; } if (up && down && left && right && downLeft && downRight && upLeft && !upRight) { - tile.frameX = 14 * 18; - tile.frameY = 4 * 18; + tile.TileFrameX = 14 * 18; + tile.TileFrameY = 4 * 18; return false; } #endregion @@ -445,26 +445,26 @@ namespace CalamityMod #region Inner Corner x2 (same side) if (up && down && left && right && !downLeft && !downRight && upLeft && upRight) { - tile.frameX = (short)((6 * 18) + (randomFrame * 18)); - tile.frameY = 2 * 18; + tile.TileFrameX = (short)((6 * 18) + (randomFrame * 18)); + tile.TileFrameY = 2 * 18; return false; } if (up && down && left && right && downLeft && downRight && !upLeft && !upRight) { - tile.frameX = (short)((6 * 18) + (randomFrame * 18)); - tile.frameY = 1 * 18; + tile.TileFrameX = (short)((6 * 18) + (randomFrame * 18)); + tile.TileFrameY = 1 * 18; return false; } if (up && down && left && right && !downLeft && downRight && !upLeft && upRight) { - tile.frameX = 10 * 18; - tile.frameY = (short)(randomFrame * 18); + tile.TileFrameX = 10 * 18; + tile.TileFrameY = (short)(randomFrame * 18); return false; } if (up && down && left && right && downLeft && !downRight && upLeft && !upRight) { - tile.frameX = 11 * 18; - tile.frameY = (short)(randomFrame * 18); + tile.TileFrameX = 11 * 18; + tile.TileFrameY = (short)(randomFrame * 18); return false; } #endregion @@ -472,14 +472,14 @@ namespace CalamityMod #region Inner Corner x2 (opposite corners) if (up && down && left && right && !downLeft && downRight && upLeft && !upRight) { - tile.frameX = 16 * 18; - tile.frameY = 4 * 18; + tile.TileFrameX = 16 * 18; + tile.TileFrameY = 4 * 18; return false; } if (up && down && left && right && downLeft && !downRight && !upLeft && upRight) { - tile.frameX = 17 * 18; - tile.frameY = 4 * 18; + tile.TileFrameX = 17 * 18; + tile.TileFrameY = 4 * 18; return false; } #endregion @@ -487,26 +487,26 @@ namespace CalamityMod #region Inner Corner x3 if (up && down && left && right && !downLeft && !downRight && !upLeft && upRight) { - tile.frameX = 12 * 18; - tile.frameY = 4 * 18; + tile.TileFrameX = 12 * 18; + tile.TileFrameY = 4 * 18; return false; } if (up && down && left && right && !downLeft && downRight && !upLeft && !upRight) { - tile.frameX = 12 * 18; - tile.frameY = 3 * 18; + tile.TileFrameX = 12 * 18; + tile.TileFrameY = 3 * 18; return false; } if (up && down && left && right && !downLeft && !downRight && upLeft && !upRight) { - tile.frameX = 13 * 18; - tile.frameY = 4 * 18; + tile.TileFrameX = 13 * 18; + tile.TileFrameY = 4 * 18; return false; } if (up && down && left && right && downLeft && !downRight && !upLeft && !upRight) { - tile.frameX = 13 * 18; - tile.frameY = 3 * 18; + tile.TileFrameX = 13 * 18; + tile.TileFrameY = 3 * 18; return false; } #endregion @@ -514,50 +514,50 @@ namespace CalamityMod #region Corner and Side if (!up && down && left && right && !downLeft && downRight && !upLeft && !upRight) { - tile.frameX = 17 * 18; - tile.frameY = 2 * 18; + tile.TileFrameX = 17 * 18; + tile.TileFrameY = 2 * 18; return false; } if (!up && down && left && right && downLeft && !downRight && !upLeft && !upRight) { - tile.frameX = 16 * 18; - tile.frameY = 2 * 18; + tile.TileFrameX = 16 * 18; + tile.TileFrameY = 2 * 18; return false; } if (up && !down && left && right && !downLeft && !downRight && !upLeft && upRight) { - tile.frameX = 17 * 18; - tile.frameY = 3 * 18; + tile.TileFrameX = 17 * 18; + tile.TileFrameY = 3 * 18; return false; } if (up && !down && left && right && !downLeft && !downRight && upLeft && !upRight) { - tile.frameX = 16 * 18; - tile.frameY = 3 * 18; + tile.TileFrameX = 16 * 18; + tile.TileFrameY = 3 * 18; return false; } if (up && down && !left && right && !downLeft && !downRight && !upLeft && upRight) { - tile.frameX = 16 * 18; - tile.frameY = 0; + tile.TileFrameX = 16 * 18; + tile.TileFrameY = 0; return false; } if (up && down && !left && right && !downLeft && downRight && !upLeft && !upRight) { - tile.frameX = 16 * 18; - tile.frameY = 18; + tile.TileFrameX = 16 * 18; + tile.TileFrameY = 18; return false; } if (up && down && left && !right && !downLeft && !downRight && upLeft && !upRight) { - tile.frameX = 17 * 18; - tile.frameY = 0; + tile.TileFrameX = 17 * 18; + tile.TileFrameY = 0; return false; } if (up && down && left && !right && downLeft && !downRight && !upLeft && !upRight) { - tile.frameX = 17 * 18; - tile.frameY = 18; + tile.TileFrameX = 17 * 18; + tile.TileFrameY = 18; return false; } #endregion @@ -575,7 +575,7 @@ namespace CalamityMod if (tile is null) return false; - if (tile.slope() > 0 && TileID.Sets.HasSlopeFrames[tile.type]) + if (tile.slope() > 0 && TileID.Sets.HasSlopeFrames[tile.TileType]) { return true; } @@ -603,26 +603,26 @@ namespace CalamityMod #region L States if (!up && down && !left && right && !downRight) { - tile.frameX = (short)((16 * 18) + (randomFrame * 54)); - tile.frameY = 0; + tile.TileFrameX = (short)((16 * 18) + (randomFrame * 54)); + tile.TileFrameY = 0; return false; } if (!up && down && left && !right && !downLeft) { - tile.frameX = (short)((18 * 18) + (randomFrame * 54)); - tile.frameY = 0; + tile.TileFrameX = (short)((18 * 18) + (randomFrame * 54)); + tile.TileFrameY = 0; return false; } if (up && !down && !left && right && !upRight) { - tile.frameX = (short)((16 * 18) + (randomFrame * 54)); - tile.frameY = 2 * 18; + tile.TileFrameX = (short)((16 * 18) + (randomFrame * 54)); + tile.TileFrameY = 2 * 18; return false; } if (up && !down && left && !right && !upLeft) { - tile.frameX = (short)((18 * 18) + (randomFrame * 54)); - tile.frameY = 2 * 18; + tile.TileFrameX = (short)((18 * 18) + (randomFrame * 54)); + tile.TileFrameY = 2 * 18; return false; } #endregion @@ -630,26 +630,26 @@ namespace CalamityMod #region T States if (!up && down && left && right && !downLeft && !downRight) { - tile.frameX = (short)((17 * 18) + (randomFrame * 54)); - tile.frameY = 0; + tile.TileFrameX = (short)((17 * 18) + (randomFrame * 54)); + tile.TileFrameY = 0; return false; } if (up && !down && left && right && !upLeft && !upRight) { - tile.frameX = (short)((17 * 18) + (randomFrame * 54)); - tile.frameY = 2 * 18; + tile.TileFrameX = (short)((17 * 18) + (randomFrame * 54)); + tile.TileFrameY = 2 * 18; return false; } if (up && down && !left && right && !downRight && !upRight) { - tile.frameX = (short)((16 * 18) + (randomFrame * 54)); - tile.frameY = 18; + tile.TileFrameX = (short)((16 * 18) + (randomFrame * 54)); + tile.TileFrameY = 18; return false; } if (up && down && left && !right && !downLeft && !upLeft) { - tile.frameX = (short)((18 * 18) + (randomFrame * 54)); - tile.frameY = 18; + tile.TileFrameX = (short)((18 * 18) + (randomFrame * 54)); + tile.TileFrameY = 18; return false; } #endregion @@ -657,8 +657,8 @@ namespace CalamityMod #region X State if (up && down && left && right && !downLeft && !downRight && !upLeft && !upRight) { - tile.frameX = (short)((17 * 18) + (randomFrame * 54)); - tile.frameY = 18; + tile.TileFrameX = (short)((17 * 18) + (randomFrame * 54)); + tile.TileFrameY = 18; return false; } #endregion @@ -666,26 +666,26 @@ namespace CalamityMod #region Inner Corner x1 if (up && down && left && right && !downLeft && downRight && upLeft && upRight) { - tile.frameX = 14 * 18; - tile.frameY = (short)((5 * 18) + (randomFrame * 36)); + tile.TileFrameX = 14 * 18; + tile.TileFrameY = (short)((5 * 18) + (randomFrame * 36)); return false; } if (up && down && left && right && downLeft && !downRight && upLeft && upRight) { - tile.frameX = 13 * 18; - tile.frameY = (short)((5 * 18) + (randomFrame * 36)); + tile.TileFrameX = 13 * 18; + tile.TileFrameY = (short)((5 * 18) + (randomFrame * 36)); return false; } if (up && down && left && right && downLeft && downRight && !upLeft && upRight) { - tile.frameX = 14 * 18; - tile.frameY = (short)((6 * 18) + (randomFrame * 36)); + tile.TileFrameX = 14 * 18; + tile.TileFrameY = (short)((6 * 18) + (randomFrame * 36)); return false; } if (up && down && left && right && downLeft && downRight && upLeft && !upRight) { - tile.frameX = 13 * 18; - tile.frameY = (short)((6 * 18) + (randomFrame * 36)); + tile.TileFrameX = 13 * 18; + tile.TileFrameY = (short)((6 * 18) + (randomFrame * 36)); return false; } #endregion @@ -693,26 +693,26 @@ namespace CalamityMod #region Inner Corner x2 (same side) if (up && down && left && right && !downLeft && !downRight && upLeft && upRight) { - tile.frameX = (short)((6 * 18) + (randomFrame * 18)); - tile.frameY = 2 * 18; + tile.TileFrameX = (short)((6 * 18) + (randomFrame * 18)); + tile.TileFrameY = 2 * 18; return false; } if (up && down && left && right && downLeft && downRight && !upLeft && !upRight) { - tile.frameX = (short)((6 * 18) + (randomFrame * 18)); - tile.frameY = 1 * 18; + tile.TileFrameX = (short)((6 * 18) + (randomFrame * 18)); + tile.TileFrameY = 1 * 18; return false; } if (up && down && left && right && !downLeft && downRight && !upLeft && upRight) { - tile.frameX = 10 * 18; - tile.frameY = (short)(randomFrame * 18); + tile.TileFrameX = 10 * 18; + tile.TileFrameY = (short)(randomFrame * 18); return false; } if (up && down && left && right && downLeft && !downRight && upLeft && !upRight) { - tile.frameX = 11 * 18; - tile.frameY = (short)(randomFrame * 18); + tile.TileFrameX = 11 * 18; + tile.TileFrameY = (short)(randomFrame * 18); return false; } #endregion @@ -720,14 +720,14 @@ namespace CalamityMod #region Inner Corner x2 (opposite corners) if (up && down && left && right && !downLeft && downRight && upLeft && !upRight) { - tile.frameX = (short)((10 * 18) + (randomFrame * 18)); - tile.frameY = 4 * 18; + tile.TileFrameX = (short)((10 * 18) + (randomFrame * 18)); + tile.TileFrameY = 4 * 18; return false; } if (up && down && left && right && downLeft && !downRight && !upLeft && upRight) { - tile.frameX = (short)((13 * 18) + (randomFrame * 18)); - tile.frameY = 4 * 18; + tile.TileFrameX = (short)((13 * 18) + (randomFrame * 18)); + tile.TileFrameY = 4 * 18; return false; } #endregion @@ -735,26 +735,26 @@ namespace CalamityMod #region Inner Corner x3 if (up && down && left && right && !downLeft && !downRight && !upLeft && upRight) { - tile.frameX = 15 * 18; - tile.frameY = (short)((6 * 18) + (randomFrame * 36)); + tile.TileFrameX = 15 * 18; + tile.TileFrameY = (short)((6 * 18) + (randomFrame * 36)); return false; } if (up && down && left && right && !downLeft && downRight && !upLeft && !upRight) { - tile.frameX = 15 * 18; - tile.frameY = (short)((5 * 18) + (randomFrame * 36)); + tile.TileFrameX = 15 * 18; + tile.TileFrameY = (short)((5 * 18) + (randomFrame * 36)); return false; } if (up && down && left && right && !downLeft && !downRight && upLeft && !upRight) { - tile.frameX = 16 * 18; - tile.frameY = (short)((6 * 18) + (randomFrame * 36)); + tile.TileFrameX = 16 * 18; + tile.TileFrameY = (short)((6 * 18) + (randomFrame * 36)); return false; } if (up && down && left && right && downLeft && !downRight && !upLeft && !upRight) { - tile.frameX = 16 * 18; - tile.frameY = (short)((5 * 18) + (randomFrame * 36)); + tile.TileFrameX = 16 * 18; + tile.TileFrameY = (short)((5 * 18) + (randomFrame * 36)); return false; } #endregion @@ -762,50 +762,50 @@ namespace CalamityMod #region Corner and Side if (!up && down && left && right && !downLeft && downRight && !upLeft && !upRight) { - tile.frameX = (short)((17 * 18) + (randomFrame * 36)); - tile.frameY = 3 * 18; + tile.TileFrameX = (short)((17 * 18) + (randomFrame * 36)); + tile.TileFrameY = 3 * 18; return false; } if (!up && down && left && right && downLeft && !downRight && !upLeft && !upRight) { - tile.frameX = (short)((16 * 18) + (randomFrame * 36)); - tile.frameY = 3 * 18; + tile.TileFrameX = (short)((16 * 18) + (randomFrame * 36)); + tile.TileFrameY = 3 * 18; return false; } if (up && !down && left && right && !downLeft && !downRight && !upLeft && upRight) { - tile.frameX = (short)((17 * 18) + (randomFrame * 36)); - tile.frameY = 4 * 18; + tile.TileFrameX = (short)((17 * 18) + (randomFrame * 36)); + tile.TileFrameY = 4 * 18; return false; } if (up && !down && left && right && !downLeft && !downRight && upLeft && !upRight) { - tile.frameX = (short)((16 * 18) + (randomFrame * 36)); - tile.frameY = 4 * 18; + tile.TileFrameX = (short)((16 * 18) + (randomFrame * 36)); + tile.TileFrameY = 4 * 18; return false; } if (up && down && !left && right && !downLeft && !downRight && !upLeft && upRight) { - tile.frameX = 17 * 18; - tile.frameY = (short)((5 * 18) + (randomFrame * 36)); + tile.TileFrameX = 17 * 18; + tile.TileFrameY = (short)((5 * 18) + (randomFrame * 36)); return false; } if (up && down && !left && right && !downLeft && downRight && !upLeft && !upRight) { - tile.frameX = 17 * 18; - tile.frameY = (short)((6 * 18) + (randomFrame * 36)); + tile.TileFrameX = 17 * 18; + tile.TileFrameY = (short)((6 * 18) + (randomFrame * 36)); return false; } if (up && down && left && !right && !downLeft && !downRight && upLeft && !upRight) { - tile.frameX = 18 * 18; - tile.frameY = (short)((5 * 18) + (randomFrame * 36)); + tile.TileFrameX = 18 * 18; + tile.TileFrameY = (short)((5 * 18) + (randomFrame * 36)); return false; } if (up && down && left && !right && downLeft && !downRight && !upLeft && !upRight) { - tile.frameX = 18 * 18; - tile.frameY = (short)((6 * 18) + (randomFrame * 36)); + tile.TileFrameX = 18 * 18; + tile.TileFrameY = (short)((6 * 18) + (randomFrame * 36)); return false; } #endregion @@ -823,7 +823,7 @@ namespace CalamityMod if (tile is null) return; - if (tile.slope() > 0 && TileID.Sets.HasSlopeFrames[tile.type]) + if (tile.slope() > 0 && TileID.Sets.HasSlopeFrames[tile.TileType]) { return; } @@ -845,8 +845,8 @@ namespace CalamityMod #region Middle State if (up && down && left && right && upLeft && upRight && downLeft && downRight) { - tile.frameX = 18; - tile.frameY = 18; + tile.TileFrameX = 18; + tile.TileFrameY = 18; return; } #endregion @@ -854,8 +854,8 @@ namespace CalamityMod #region Single State if (!up && !down && !left && !right) { - tile.frameX = 54; - tile.frameY = 54; + tile.TileFrameX = 54; + tile.TileFrameY = 54; return; } #endregion @@ -863,26 +863,26 @@ namespace CalamityMod #region Edges if (!up && down && left && right && downLeft && downRight) { - tile.frameX = 18; - tile.frameY = 0; + tile.TileFrameX = 18; + tile.TileFrameY = 0; return; } if (up && down && !left && right && upRight && downRight) { - tile.frameX = 0; - tile.frameY = 18; + tile.TileFrameX = 0; + tile.TileFrameY = 18; return; } if (up && !down && left && right && upLeft && upRight) { - tile.frameX = 18; - tile.frameY = 36; + tile.TileFrameX = 18; + tile.TileFrameY = 36; return; } if (up && down && left && !right && upLeft && downLeft) { - tile.frameX = 36; - tile.frameY = 18; + tile.TileFrameX = 36; + tile.TileFrameY = 18; return; } #endregion @@ -890,26 +890,26 @@ namespace CalamityMod #region Edge Corners if (!up && down && !left && right && downRight) { - tile.frameX = 0; - tile.frameY = 0; + tile.TileFrameX = 0; + tile.TileFrameY = 0; return; } if (!up && down && left && !right && downLeft) { - tile.frameX = 36; - tile.frameY = 0; + tile.TileFrameX = 36; + tile.TileFrameY = 0; return; } if (up && !down && !left && right && upRight) { - tile.frameX = 0; - tile.frameY = 36; + tile.TileFrameX = 0; + tile.TileFrameY = 36; return; } if (up && !down && left && !right && upLeft) { - tile.frameX = 36; - tile.frameY = 36; + tile.TileFrameX = 36; + tile.TileFrameY = 36; return; } #endregion @@ -917,14 +917,14 @@ namespace CalamityMod #region I States if (up && down && !left && !right) { - tile.frameX = 54; - tile.frameY = 18; + tile.TileFrameX = 54; + tile.TileFrameY = 18; return; } if (!up && !down && left && right) { - tile.frameX = 18; - tile.frameY = 54; + tile.TileFrameX = 18; + tile.TileFrameY = 54; return; } #endregion @@ -932,26 +932,26 @@ namespace CalamityMod #region I End States if (!up && down && !left && !right) { - tile.frameX = 54; - tile.frameY = 0; + tile.TileFrameX = 54; + tile.TileFrameY = 0; return; } if (up && !down && !left && !right) { - tile.frameX = 54; - tile.frameY = 36; + tile.TileFrameX = 54; + tile.TileFrameY = 36; return; } if (!up && !down && !left && right) { - tile.frameX = 0; - tile.frameY = 54; + tile.TileFrameX = 0; + tile.TileFrameY = 54; return; } if (!up && !down && left && !right) { - tile.frameX = 36; - tile.frameY = 54; + tile.TileFrameX = 36; + tile.TileFrameY = 54; return; } #endregion @@ -959,26 +959,26 @@ namespace CalamityMod #region L States if (!up && down && !left && right && !downRight) { - tile.frameX = 72; - tile.frameY = 0; + tile.TileFrameX = 72; + tile.TileFrameY = 0; return; } if (!up && down && left && !right && !downLeft) { - tile.frameX = 108; - tile.frameY = 0; + tile.TileFrameX = 108; + tile.TileFrameY = 0; return; } if (up && !down && !left && right && !upRight) { - tile.frameX = 72; - tile.frameY = 36; + tile.TileFrameX = 72; + tile.TileFrameY = 36; return; } if (up && !down && left && !right && !upLeft) { - tile.frameX = 108; - tile.frameY = 36; + tile.TileFrameX = 108; + tile.TileFrameY = 36; return; } #endregion @@ -986,26 +986,26 @@ namespace CalamityMod #region T States if (!up && down && left && right && !downLeft && !downRight) { - tile.frameX = 90; - tile.frameY = 0; + tile.TileFrameX = 90; + tile.TileFrameY = 0; return; } if (up && !down && left && right && !upLeft && !upRight) { - tile.frameX = 90; - tile.frameY = 36; + tile.TileFrameX = 90; + tile.TileFrameY = 36; return; } if (up && down && !left && right && !downRight && !upRight) { - tile.frameX = 72; - tile.frameY = 18; + tile.TileFrameX = 72; + tile.TileFrameY = 18; return; } if (up && down && left && !right && !downLeft && !upLeft) { - tile.frameX = 108; - tile.frameY = 18; + tile.TileFrameX = 108; + tile.TileFrameY = 18; return; } #endregion @@ -1013,8 +1013,8 @@ namespace CalamityMod #region X State if (up && down && left && right && !downLeft && !downRight && !upLeft && !upRight) { - tile.frameX = 90; - tile.frameY = 18; + tile.TileFrameX = 90; + tile.TileFrameY = 18; return; } #endregion @@ -1022,26 +1022,26 @@ namespace CalamityMod #region Inner Corner x1 if (up && down && left && right && !downLeft && downRight && upLeft && upRight) { - tile.frameX = 144; - tile.frameY = 36; + tile.TileFrameX = 144; + tile.TileFrameY = 36; return; } if (up && down && left && right && downLeft && !downRight && upLeft && upRight) { - tile.frameX = 126; - tile.frameY = 36; + tile.TileFrameX = 126; + tile.TileFrameY = 36; return; } if (up && down && left && right && downLeft && downRight && !upLeft && upRight) { - tile.frameX = 144; - tile.frameY = 54; + tile.TileFrameX = 144; + tile.TileFrameY = 54; return; } if (up && down && left && right && downLeft && downRight && upLeft && !upRight) { - tile.frameX = 126; - tile.frameY = 54; + tile.TileFrameX = 126; + tile.TileFrameY = 54; return; } #endregion @@ -1049,26 +1049,26 @@ namespace CalamityMod #region Inner Corner x2 (same side) if (up && down && left && right && !downLeft && !downRight && upLeft && upRight) { - tile.frameX = 198; - tile.frameY = 18; + tile.TileFrameX = 198; + tile.TileFrameY = 18; return; } if (up && down && left && right && downLeft && downRight && !upLeft && !upRight) { - tile.frameX = 198; - tile.frameY = 18; + tile.TileFrameX = 198; + tile.TileFrameY = 18; return; } if (up && down && left && right && !downLeft && downRight && !upLeft && upRight) { - tile.frameX = 198; - tile.frameY = 36; + tile.TileFrameX = 198; + tile.TileFrameY = 36; return; } if (up && down && left && right && downLeft && !downRight && upLeft && !upRight) { - tile.frameX = 198; - tile.frameY = 54; + tile.TileFrameX = 198; + tile.TileFrameY = 54; return; } #endregion @@ -1076,14 +1076,14 @@ namespace CalamityMod #region Inner Corner x2 (opposite corners) if (up && down && left && right && !downLeft && downRight && upLeft && !upRight) { - tile.frameX = 108; - tile.frameY = 54; + tile.TileFrameX = 108; + tile.TileFrameY = 54; return; } if (up && down && left && right && downLeft && !downRight && !upLeft && upRight) { - tile.frameX = 90; - tile.frameY = 54; + tile.TileFrameX = 90; + tile.TileFrameY = 54; return; } #endregion @@ -1091,26 +1091,26 @@ namespace CalamityMod #region Inner Corner x3 if (up && down && left && right && !downLeft && !downRight && !upLeft && upRight) { - tile.frameX = 126; - tile.frameY = 18; + tile.TileFrameX = 126; + tile.TileFrameY = 18; return; } if (up && down && left && right && !downLeft && downRight && !upLeft && !upRight) { - tile.frameX = 126; - tile.frameY = 0; + tile.TileFrameX = 126; + tile.TileFrameY = 0; return; } if (up && down && left && right && !downLeft && !downRight && upLeft && !upRight) { - tile.frameX = 144; - tile.frameY = 18; + tile.TileFrameX = 144; + tile.TileFrameY = 18; return; } if (up && down && left && right && downLeft && !downRight && !upLeft && !upRight) { - tile.frameX = 144; - tile.frameY = 0; + tile.TileFrameX = 144; + tile.TileFrameY = 0; return; } #endregion @@ -1118,50 +1118,50 @@ namespace CalamityMod #region Corner and Side if (!up && down && left && right && !downLeft && downRight && !upLeft && !upRight) { - tile.frameX = 180; - tile.frameY = 0; + tile.TileFrameX = 180; + tile.TileFrameY = 0; return; } if (!up && down && left && right && downLeft && !downRight && !upLeft && !upRight) { - tile.frameX = 162; - tile.frameY = 0; + tile.TileFrameX = 162; + tile.TileFrameY = 0; return; } if (up && !down && left && right && !downLeft && !downRight && !upLeft && upRight) { - tile.frameX = 180; - tile.frameY = 18; + tile.TileFrameX = 180; + tile.TileFrameY = 18; return; } if (up && !down && left && right && !downLeft && !downRight && upLeft && !upRight) { - tile.frameX = 162; - tile.frameY = 18; + tile.TileFrameX = 162; + tile.TileFrameY = 18; return; } if (up && down && !left && right && !downLeft && !downRight && !upLeft && upRight) { - tile.frameX = 162; - tile.frameY = 36; + tile.TileFrameX = 162; + tile.TileFrameY = 36; return; } if (up && down && !left && right && !downLeft && downRight && !upLeft && !upRight) { - tile.frameX = 162; - tile.frameY = 54; + tile.TileFrameX = 162; + tile.TileFrameY = 54; return; } if (up && down && left && !right && !downLeft && !downRight && upLeft && !upRight) { - tile.frameX = 180; - tile.frameY = 36; + tile.TileFrameX = 180; + tile.TileFrameY = 36; return; } if (up && down && left && !right && downLeft && !downRight && !upLeft && !upRight) { - tile.frameX = 180; - tile.frameY = 54; + tile.TileFrameX = 180; + tile.TileFrameY = 54; return; } #endregion @@ -1741,41 +1741,41 @@ namespace CalamityMod Tile west = Main.tile[x - 1, y]; Tile east = Main.tile[x + 1, y]; - if (north != null && north.active() && tileMergeTypes[myType][north.type]) + if (north != null && north.active() && tileMergeTypes[myType][north.TileType]) { // Register this tile as not automatically merging with the tile above it. - CalamityUtils.SetMerge(myType, north.type, false); + CalamityUtils.SetMerge(myType, north.TileType, false); TileID.Sets.ChecksForMerge[myType] = true; // Properly frame the tile given this constraint. - CustomMergeFrameExplicit(x, y - 1, north.type, myType, out _, out _, out _, out forceSameUp, false, false, false, false, false); + CustomMergeFrameExplicit(x, y - 1, north.TileType, myType, out _, out _, out _, out forceSameUp, false, false, false, false, false); } - if (west != null && west.active() && tileMergeTypes[myType][west.type]) + if (west != null && west.active() && tileMergeTypes[myType][west.TileType]) { // Register this tile as not automatically merging with the tile to the left of it. - CalamityUtils.SetMerge(myType, west.type, false); + CalamityUtils.SetMerge(myType, west.TileType, false); TileID.Sets.ChecksForMerge[myType] = true; // Properly frame the tile given this constraint. - CustomMergeFrameExplicit(x - 1, y, west.type, myType, out _, out _, out forceSameLeft, out _, false, false, false, false, false); + CustomMergeFrameExplicit(x - 1, y, west.TileType, myType, out _, out _, out forceSameLeft, out _, false, false, false, false, false); } - if (east != null && east.active() && tileMergeTypes[myType][east.type]) + if (east != null && east.active() && tileMergeTypes[myType][east.TileType]) { // Register this tile as not automatically merging with the tile to the right of it. - CalamityUtils.SetMerge(myType, east.type, false); + CalamityUtils.SetMerge(myType, east.TileType, false); TileID.Sets.ChecksForMerge[myType] = true; // Properly frame the tile given this constraint. - CustomMergeFrameExplicit(x + 1, y, east.type, myType, out _, out forceSameRight , out _, out _, false, false, false, false, false); + CustomMergeFrameExplicit(x + 1, y, east.TileType, myType, out _, out forceSameRight , out _, out _, false, false, false, false, false); } - if (south != null && south.active() && tileMergeTypes[myType][south.type]) + if (south != null && south.active() && tileMergeTypes[myType][south.TileType]) { // Register this tile as not automatically merging with the tile below it. - CalamityUtils.SetMerge(myType, south.type, false); + CalamityUtils.SetMerge(myType, south.TileType, false); TileID.Sets.ChecksForMerge[myType] = true; // Properly frame the tile given this constraint. - CustomMergeFrameExplicit(x, y + 1, south.type, myType, out forceSameDown, out _, out _, out _, false, false, false, false, false); + CustomMergeFrameExplicit(x, y + 1, south.TileType, myType, out forceSameDown, out _, out _, out _, false, false, false, false, false); } // With all constraints determined, properly frame the tile a final time. diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index affcc1c806..7dd79ba7d5 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -38,9 +38,9 @@ namespace CalamityMod int left = x; int top = y; - if (tile.frameX % 36 != 0) + if (tile.TileFrameX % 36 != 0) left--; - if (tile.frameY != 0) + if (tile.TileFrameY != 0) top--; int chest = Chest.FindChest(left, top); @@ -85,8 +85,8 @@ namespace CalamityMod public static void LightHitWire(int type, int i, int j, int tileX, int tileY) { - int x = i - Main.tile[i, j].frameX / 18 % tileX; - int y = j - Main.tile[i, j].frameY / 18 % tileY; + int x = i - Main.tile[i, j].TileFrameX / 18 % tileX; + int y = j - Main.tile[i, j].TileFrameY / 18 % tileY; for (int l = x; l < x + tileX; l++) { for (int m = y; m < y + tileY; m++) @@ -95,15 +95,15 @@ namespace CalamityMod { Main.tile[l, m] = new Tile(); } - if (Main.tile[l, m].active() && Main.tile[l, m].type == type) + if (Main.tile[l, m].active() && Main.tile[l, m].TileType == type) { - if (Main.tile[l, m].frameX < (18 * tileX)) + if (Main.tile[l, m].TileFrameX < (18 * tileX)) { - Main.tile[l, m].frameX += (short)(18 * tileX); + Main.tile[l, m].TileFrameX += (short)(18 * tileX); } else { - Main.tile[l, m].frameX -= (short)(18 * tileX); + Main.tile[l, m].TileFrameX -= (short)(18 * tileX); } } } @@ -135,14 +135,14 @@ namespace CalamityMod { float shakeX = Utils.RandomInt(ref num190, -10, 11) * 0.15f; float shakeY = Utils.RandomInt(ref num190, -10, 1) * 0.35f; - Main.spriteBatch.Draw(flameTexture, new Vector2(i * 16 - (int)Main.screenPosition.X - (width - 16f) / 2f + shakeX, j * 16 - (int)Main.screenPosition.Y + shakeY + yOffset) + zero, new Rectangle(tile.frameX + offsetX, tile.frameY + offsetY, width, height), new Color(100, 100, 100, 0), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(flameTexture, new Vector2(i * 16 - (int)Main.screenPosition.X - (width - 16f) / 2f + shakeX, j * 16 - (int)Main.screenPosition.Y + shakeY + yOffset) + zero, new Rectangle(tile.TileFrameX + offsetX, tile.TileFrameY + offsetY, width, height), new Color(100, 100, 100, 0), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } public static void DrawStaticFlameEffect(Texture2D flameTexture, int i, int j, int offsetX = 0, int offsetY = 0) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; Color drawColour = new Color(100, 100, 100, 0); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -201,8 +201,8 @@ namespace CalamityMod /// The offset for the animation. This is set to frameXOffset in horizontal animations and frameYOffset in vertical animations in the AnimateIndividualTile() function. internal static int GetAnimationOffset(this ModTile mt, int i, int j, int frameAmt, int xLength, int yLength, int xTiles, int yTiles, int animationFrameLength) { - int frameX = Main.tile[i, j].frameX; - int frameY = Main.tile[i, j].frameY; + int frameX = Main.tile[i, j].TileFrameX; + int frameY = Main.tile[i, j].TileFrameY; // Tweak the frame drawn so tiles next to each other are off-sync and look much more interesting. frameX %= (xLength * xTiles); @@ -275,7 +275,7 @@ namespace CalamityMod public static bool TileActiveAndOfType(int x, int y, int type) { - return ParanoidTileRetrieval(x, y).active() && ParanoidTileRetrieval(x, y).type == type; + return ParanoidTileRetrieval(x, y).active() && ParanoidTileRetrieval(x, y).TileType == type; } /// @@ -512,13 +512,13 @@ namespace CalamityMod /// Determines if a tile is solid ground based on whether it's active and not actuated or if the tile is solid in any way, including just the top. /// /// The tile to check. - public static bool IsTileSolidGround(this Tile tile) => tile != null && tile.nactive() && (Main.tileSolid[tile.type] || Main.tileSolidTop[tile.type]); + public static bool IsTileSolidGround(this Tile tile) => tile != null && tile.nactive() && (Main.tileSolid[tile.TileType] || Main.tileSolidTop[tile.TileType]); /// /// Determines if a tile is solid based on whether it's active and not actuated or if the tile is solid. This will not count platforms and other non-solid ground tiles /// /// The tile to check. - public static bool IsTileSolid(this Tile tile) => tile != null && tile.nactive() && Main.tileSolid[tile.type]; + public static bool IsTileSolid(this Tile tile) => tile != null && tile.nactive() && Main.tileSolid[tile.TileType]; } } diff --git a/Utilities/WorldgenUtils.cs b/Utilities/WorldgenUtils.cs index 0713adb895..eb6e2ad781 100644 --- a/Utilities/WorldgenUtils.cs +++ b/Utilities/WorldgenUtils.cs @@ -26,7 +26,7 @@ namespace CalamityMod { int tilesX = WorldGen.genRand.Next(0, x); int tilesY = WorldGen.genRand.Next((int)(y * verticalStartFactor), (int)(y * verticalEndFactor)); - if (convertibleTiles.Length <= 0 || convertibleTiles.Contains(ParanoidTileRetrieval(tilesX, tilesY).type)) + if (convertibleTiles.Length <= 0 || convertibleTiles.Contains(ParanoidTileRetrieval(tilesX, tilesY).TileType)) WorldGen.OreRunner(tilesX, tilesY, WorldGen.genRand.Next(strengthMin, strengthMax), WorldGen.genRand.Next(3, 8), (ushort)type); } } diff --git a/Walls/AbyssGravelWall.cs b/Walls/AbyssGravelWall.cs index 83b492bb54..88335faf6d 100644 --- a/Walls/AbyssGravelWall.cs +++ b/Walls/AbyssGravelWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class AbyssGravelWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = 33; AddMapEntry(new Color(6, 10, 54)); diff --git a/Walls/AbyssGravelWallSafe.cs b/Walls/AbyssGravelWallSafe.cs index 8945011954..7c95f7139c 100644 --- a/Walls/AbyssGravelWallSafe.cs +++ b/Walls/AbyssGravelWallSafe.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class AbyssGravelWallSafe : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; drop = ModContent.ItemType(); diff --git a/Walls/AerialiteBrickWall.cs b/Walls/AerialiteBrickWall.cs index 0f7e36a95e..7516212507 100644 --- a/Walls/AerialiteBrickWall.cs +++ b/Walls/AerialiteBrickWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class AerialiteBrickWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; drop = ModContent.ItemType(); diff --git a/Walls/AshenSlabWall.cs b/Walls/AshenSlabWall.cs index 86eb527244..8b369cdf29 100644 --- a/Walls/AshenSlabWall.cs +++ b/Walls/AshenSlabWall.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls { public class AshenSlabWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; drop = ModContent.ItemType(); @@ -25,7 +25,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { - Texture2D sprite = ModContent.GetTexture("CalamityMod/Walls/AshenSlabWall"); + Texture2D sprite = ModContent.Request("CalamityMod/Walls/AshenSlabWall"); Color lightColor = GetWallColour(i, j); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); diff --git a/Walls/AstralBrickWall.cs b/Walls/AstralBrickWall.cs index eeba4b4ee4..6f81b259c0 100644 --- a/Walls/AstralBrickWall.cs +++ b/Walls/AstralBrickWall.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls { public class AstralBrickWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; Main.wallLargeFrames[Type] = 2; diff --git a/Walls/AstralDirtWall.cs b/Walls/AstralDirtWall.cs index 151f1b77af..33d4966c81 100644 --- a/Walls/AstralDirtWall.cs +++ b/Walls/AstralDirtWall.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Walls return true; }*/ - public override void SetDefaults() + public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Dirt. dustType = DustID.Shadowflame; diff --git a/Walls/AstralDirtWallSafe.cs b/Walls/AstralDirtWallSafe.cs index 7c76b76fa6..2ad5de211b 100644 --- a/Walls/AstralDirtWallSafe.cs +++ b/Walls/AstralDirtWallSafe.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Walls public class AstralDirtWallSafe : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Dirt. dustType = DustID.Shadowflame; diff --git a/Walls/AstralFossilWall.cs b/Walls/AstralFossilWall.cs index bca198d6bf..ed9d0cafcc 100644 --- a/Walls/AstralFossilWall.cs +++ b/Walls/AstralFossilWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls public class AstralFossilWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = ModContent.DustType(); drop = ModContent.ItemType(); diff --git a/Walls/AstralGrassWall.cs b/Walls/AstralGrassWall.cs index b942472095..cfd52d956c 100644 --- a/Walls/AstralGrassWall.cs +++ b/Walls/AstralGrassWall.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Walls return base.Autoload(ref name, ref texture); }*/ - public override void SetDefaults() + public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Grass. dustType = DustID.Shadowflame; diff --git a/Walls/AstralIceWall.cs b/Walls/AstralIceWall.cs index df46c0c79c..80f33335a7 100644 --- a/Walls/AstralIceWall.cs +++ b/Walls/AstralIceWall.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Walls return base.Autoload(ref name, ref texture); }*/ - public override void SetDefaults() + public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Ice. dustType = DustID.Shadowflame; diff --git a/Walls/AstralIceWallSafe.cs b/Walls/AstralIceWallSafe.cs index c4ce21fe76..9a0da56015 100644 --- a/Walls/AstralIceWallSafe.cs +++ b/Walls/AstralIceWallSafe.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls public class AstralIceWallSafe : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Ice. Main.wallHouse[Type] = true; diff --git a/Walls/AstralMonolithWall.cs b/Walls/AstralMonolithWall.cs index 059061ec93..cd41407dd0 100644 --- a/Walls/AstralMonolithWall.cs +++ b/Walls/AstralMonolithWall.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Walls { public class AstralMonolithWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; drop = ModContent.ItemType(); @@ -25,7 +25,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { - Texture2D sprite = ModContent.GetTexture("CalamityMod/Walls/AstralMonolithWall"); + Texture2D sprite = ModContent.Request("CalamityMod/Walls/AstralMonolithWall"); Color lightColor = GetWallColour(i, j); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); diff --git a/Walls/AstralSandstoneWall.cs b/Walls/AstralSandstoneWall.cs index 5ad25fb8e7..c8e46694e6 100644 --- a/Walls/AstralSandstoneWall.cs +++ b/Walls/AstralSandstoneWall.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Walls return base.Autoload(ref name, ref texture); }*/ - public override void SetDefaults() + public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Sandstone. dustType = DustID.Shadowflame; diff --git a/Walls/AstralSandstoneWallSafe.cs b/Walls/AstralSandstoneWallSafe.cs index 602a9737fd..f5b8cbb713 100644 --- a/Walls/AstralSandstoneWallSafe.cs +++ b/Walls/AstralSandstoneWallSafe.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls public class AstralSandstoneWallSafe : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Sandstone. dustType = DustID.Shadowflame; diff --git a/Walls/AstralSnowWall.cs b/Walls/AstralSnowWall.cs index 9ad6d3d0e9..fb246f680d 100644 --- a/Walls/AstralSnowWall.cs +++ b/Walls/AstralSnowWall.cs @@ -5,7 +5,7 @@ namespace CalamityMod.Walls { public class AstralSnowWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = ModContent.DustType(); diff --git a/Walls/AstralSnowWallSafe.cs b/Walls/AstralSnowWallSafe.cs index 4dff8f6ee1..fbb2ee3843 100644 --- a/Walls/AstralSnowWallSafe.cs +++ b/Walls/AstralSnowWallSafe.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls public class AstralSnowWallSafe : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = ModContent.DustType(); drop = ModContent.ItemType(); diff --git a/Walls/AstralStoneWall.cs b/Walls/AstralStoneWall.cs index 689514643e..67f344d03d 100644 --- a/Walls/AstralStoneWall.cs +++ b/Walls/AstralStoneWall.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Walls return base.Autoload(ref name, ref texture); }*/ - public override void SetDefaults() + public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Stone. dustType = DustID.Shadowflame; diff --git a/Walls/AstralStoneWallSafe.cs b/Walls/AstralStoneWallSafe.cs index b03515ac39..049e3aa117 100644 --- a/Walls/AstralStoneWallSafe.cs +++ b/Walls/AstralStoneWallSafe.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls public class AstralStoneWallSafe : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Stone. dustType = DustID.Shadowflame; diff --git a/Walls/BrimstoneSlagWall.cs b/Walls/BrimstoneSlagWall.cs index 077e5935d8..70c7d7801c 100644 --- a/Walls/BrimstoneSlagWall.cs +++ b/Walls/BrimstoneSlagWall.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls { public class BrimstoneSlagWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; drop = ModContent.ItemType(); @@ -25,7 +25,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { - Texture2D sprite = ModContent.GetTexture("CalamityMod/Walls/BrimstoneSlagWall"); + Texture2D sprite = ModContent.Request("CalamityMod/Walls/BrimstoneSlagWall"); Color lightColor = GetWallColour(i, j); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); diff --git a/Walls/BrimstoneSlagWallUnsafe.cs b/Walls/BrimstoneSlagWallUnsafe.cs index 2b90da2409..cd7153c897 100644 --- a/Walls/BrimstoneSlagWallUnsafe.cs +++ b/Walls/BrimstoneSlagWallUnsafe.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls { public class BrimstoneSlagWallUnsafe : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { drop = ModContent.ItemType(); AddMapEntry(new Color(24, 16, 29)); @@ -24,7 +24,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { - Texture2D sprite = ModContent.GetTexture("CalamityMod/Walls/BrimstoneSlagWall"); + Texture2D sprite = ModContent.Request("CalamityMod/Walls/BrimstoneSlagWall"); Color lightColor = GetWallColour(i, j); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); diff --git a/Walls/ChaosplateWall.cs b/Walls/ChaosplateWall.cs index f9bac87271..730b5fdeb8 100644 --- a/Walls/ChaosplateWall.cs +++ b/Walls/ChaosplateWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class ChaosplateWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/ChaoticBrickWall.cs b/Walls/ChaoticBrickWall.cs index f70b01532c..66ea0af9ed 100644 --- a/Walls/ChaoticBrickWall.cs +++ b/Walls/ChaoticBrickWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class ChaoticBrickWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; drop = ModContent.ItemType(); diff --git a/Walls/CinderplateWall.cs b/Walls/CinderplateWall.cs index 7f8c76186a..04dc005719 100644 --- a/Walls/CinderplateWall.cs +++ b/Walls/CinderplateWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class CinderplateWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/CosmiliteBrickWall.cs b/Walls/CosmiliteBrickWall.cs index b679361afc..ab5b35cfc9 100644 --- a/Walls/CosmiliteBrickWall.cs +++ b/Walls/CosmiliteBrickWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class CosmiliteBrickWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/CryonicBrickWall.cs b/Walls/CryonicBrickWall.cs index 633ee628e0..de76b7b44c 100644 --- a/Walls/CryonicBrickWall.cs +++ b/Walls/CryonicBrickWall.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls { public class CryonicBrickWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; @@ -25,7 +25,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { - Texture2D sprite = ModContent.GetTexture("CalamityMod/Walls/CryonicBrickWall"); + Texture2D sprite = ModContent.Request("CalamityMod/Walls/CryonicBrickWall"); Color lightColor = GetWallColour(i, j); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); diff --git a/Walls/DraedonStructures/HazardChevronWall.cs b/Walls/DraedonStructures/HazardChevronWall.cs index d1e1709177..be2b7bd2b5 100644 --- a/Walls/DraedonStructures/HazardChevronWall.cs +++ b/Walls/DraedonStructures/HazardChevronWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls.DraedonStructures public class HazardChevronWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = 19; drop = ModContent.ItemType(); diff --git a/Walls/DraedonStructures/LaboratoryPanelWall.cs b/Walls/DraedonStructures/LaboratoryPanelWall.cs index 8987f9a605..163c3730f7 100644 --- a/Walls/DraedonStructures/LaboratoryPanelWall.cs +++ b/Walls/DraedonStructures/LaboratoryPanelWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls.DraedonStructures public class LaboratoryPanelWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = 1; drop = ModContent.ItemType(); diff --git a/Walls/DraedonStructures/LaboratoryPlateBeam.cs b/Walls/DraedonStructures/LaboratoryPlateBeam.cs index 3268b47970..9e5c1d7ef0 100644 --- a/Walls/DraedonStructures/LaboratoryPlateBeam.cs +++ b/Walls/DraedonStructures/LaboratoryPlateBeam.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls.DraedonStructures public class LaboratoryPlateBeam : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = 109; drop = ModContent.ItemType(); diff --git a/Walls/DraedonStructures/LaboratoryPlatePillar.cs b/Walls/DraedonStructures/LaboratoryPlatePillar.cs index 4ab0ab8736..5722dbf9f5 100644 --- a/Walls/DraedonStructures/LaboratoryPlatePillar.cs +++ b/Walls/DraedonStructures/LaboratoryPlatePillar.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls.DraedonStructures public class LaboratoryPlatePillar : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = 109; drop = ModContent.ItemType(); diff --git a/Walls/DraedonStructures/LaboratoryPlatingWall.cs b/Walls/DraedonStructures/LaboratoryPlatingWall.cs index 701c3af2dc..a3e72a52d0 100644 --- a/Walls/DraedonStructures/LaboratoryPlatingWall.cs +++ b/Walls/DraedonStructures/LaboratoryPlatingWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls.DraedonStructures public class LaboratoryPlatingWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = 30; drop = ModContent.ItemType(); diff --git a/Walls/DraedonStructures/RustedPlateBeam.cs b/Walls/DraedonStructures/RustedPlateBeam.cs index aae3694027..c6a02ad073 100644 --- a/Walls/DraedonStructures/RustedPlateBeam.cs +++ b/Walls/DraedonStructures/RustedPlateBeam.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls.DraedonStructures public class RustedPlateBeam : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = 32; drop = ModContent.ItemType(); diff --git a/Walls/DraedonStructures/RustedPlatePillar.cs b/Walls/DraedonStructures/RustedPlatePillar.cs index 46266d4ffa..7a15f0de66 100644 --- a/Walls/DraedonStructures/RustedPlatePillar.cs +++ b/Walls/DraedonStructures/RustedPlatePillar.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls.DraedonStructures public class RustedPlatePillar : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = 32; drop = ModContent.ItemType(); diff --git a/Walls/DraedonStructures/RustedPlatingWall.cs b/Walls/DraedonStructures/RustedPlatingWall.cs index 90ba394c24..5b17dbf817 100644 --- a/Walls/DraedonStructures/RustedPlatingWall.cs +++ b/Walls/DraedonStructures/RustedPlatingWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls.DraedonStructures public class RustedPlatingWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = 32; drop = ModContent.ItemType(); diff --git a/Walls/ElumplateWall.cs b/Walls/ElumplateWall.cs index 46be124c5e..b64874a292 100644 --- a/Walls/ElumplateWall.cs +++ b/Walls/ElumplateWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class ElumplateWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/EutrophicSandWall.cs b/Walls/EutrophicSandWall.cs index 639bbe7110..b68b284ef8 100644 --- a/Walls/EutrophicSandWall.cs +++ b/Walls/EutrophicSandWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class EutrophicSandWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = 108; AddMapEntry(new Color(80, 80, 120)); diff --git a/Walls/EutrophicSandWallSafe.cs b/Walls/EutrophicSandWallSafe.cs index 24167ac4af..8fd1b8c463 100644 --- a/Walls/EutrophicSandWallSafe.cs +++ b/Walls/EutrophicSandWallSafe.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class EutrophicSandWallSafe : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; dustType = 108; diff --git a/Walls/ExoPlatingWall.cs b/Walls/ExoPlatingWall.cs index 19f818f37e..7e2786d8c3 100644 --- a/Walls/ExoPlatingWall.cs +++ b/Walls/ExoPlatingWall.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls { public class ExoPlatingWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; drop = ModContent.ItemType(); diff --git a/Walls/ExoPrismPanelWall.cs b/Walls/ExoPrismPanelWall.cs index 2444afe884..2747477cd7 100644 --- a/Walls/ExoPrismPanelWall.cs +++ b/Walls/ExoPrismPanelWall.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Walls { public class ExoPrismPanelWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; drop = ModContent.ItemType(); diff --git a/Walls/HardenedAstralSandWall.cs b/Walls/HardenedAstralSandWall.cs index 83e44253bc..6e2542cb6d 100644 --- a/Walls/HardenedAstralSandWall.cs +++ b/Walls/HardenedAstralSandWall.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Walls return base.Autoload(ref name, ref texture); }*/ - public override void SetDefaults() + public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Hardened Astral Sand. dustType = DustID.Shadowflame; diff --git a/Walls/HardenedAstralSandWallSafe.cs b/Walls/HardenedAstralSandWallSafe.cs index f5564234e2..4d3a444b47 100644 --- a/Walls/HardenedAstralSandWallSafe.cs +++ b/Walls/HardenedAstralSandWallSafe.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls public class HardenedAstralSandWallSafe : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Hardened Astral Sand. dustType = DustID.Shadowflame; diff --git a/Walls/HardenedSulphurousSandstoneWall.cs b/Walls/HardenedSulphurousSandstoneWall.cs index 547cc98e78..0f6622251f 100644 --- a/Walls/HardenedSulphurousSandstoneWall.cs +++ b/Walls/HardenedSulphurousSandstoneWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class HardenedSulphurousSandstoneWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; dustType = 32; diff --git a/Walls/NavyplateWall.cs b/Walls/NavyplateWall.cs index fc9e903f2e..bb3975950e 100644 --- a/Walls/NavyplateWall.cs +++ b/Walls/NavyplateWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class NavyplateWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/NavystoneWall.cs b/Walls/NavystoneWall.cs index 40b0a24320..2f68936888 100644 --- a/Walls/NavystoneWall.cs +++ b/Walls/NavystoneWall.cs @@ -4,7 +4,7 @@ namespace CalamityMod.Walls { public class NavystoneWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = 96; AddMapEntry(new Color(0, 50, 50)); diff --git a/Walls/NavystoneWallSafe.cs b/Walls/NavystoneWallSafe.cs index 11058d48fc..310d4963e3 100644 --- a/Walls/NavystoneWallSafe.cs +++ b/Walls/NavystoneWallSafe.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class NavystoneWallSafe : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; dustType = 96; diff --git a/Walls/OccultStoneWall.cs b/Walls/OccultStoneWall.cs index 9f8fad61e5..fd81292386 100644 --- a/Walls/OccultStoneWall.cs +++ b/Walls/OccultStoneWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class OccultStoneWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/PerennialBrickWall.cs b/Walls/PerennialBrickWall.cs index 1a0b6e48ab..df6e74f478 100644 --- a/Walls/PerennialBrickWall.cs +++ b/Walls/PerennialBrickWall.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls { public class PerennialBrickWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; @@ -26,7 +26,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { - Texture2D sprite = ModContent.GetTexture("CalamityMod/Walls/PerennialBrickWall"); + Texture2D sprite = ModContent.Request("CalamityMod/Walls/PerennialBrickWall"); Color lightColor = GetWallColour(i, j); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); diff --git a/Walls/PlagueContainmentCellsWall.cs b/Walls/PlagueContainmentCellsWall.cs index 3dbe9d1626..ab3f0eef6c 100644 --- a/Walls/PlagueContainmentCellsWall.cs +++ b/Walls/PlagueContainmentCellsWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class PlagueContainmentCellsWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/PlaguedPlateWall.cs b/Walls/PlaguedPlateWall.cs index 79764cc370..2c50f5d304 100644 --- a/Walls/PlaguedPlateWall.cs +++ b/Walls/PlaguedPlateWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class PlaguedPlateWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/ProfanedCrystalWall.cs b/Walls/ProfanedCrystalWall.cs index ab3c1d6730..90df9db509 100644 --- a/Walls/ProfanedCrystalWall.cs +++ b/Walls/ProfanedCrystalWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class ProfanedCrystalWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; Main.wallLargeFrames[Type] = 2; diff --git a/Walls/ProfanedRockWall.cs b/Walls/ProfanedRockWall.cs index 93276a5ce8..fceebaf08c 100644 --- a/Walls/ProfanedRockWall.cs +++ b/Walls/ProfanedRockWall.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls { public class ProfanedRockWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/ProfanedSlabWall.cs b/Walls/ProfanedSlabWall.cs index df17376bd2..dd3730554b 100644 --- a/Walls/ProfanedSlabWall.cs +++ b/Walls/ProfanedSlabWall.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Walls { public class ProfanedSlabWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; @@ -26,7 +26,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { - Texture2D sprite = ModContent.GetTexture("CalamityMod/Walls/ProfanedSlabWall"); + Texture2D sprite = ModContent.Request("CalamityMod/Walls/ProfanedSlabWall"); Color lightColor = GetWallColour(i, j); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); diff --git a/Walls/RunicProfanedBrickWall.cs b/Walls/RunicProfanedBrickWall.cs index 6945117f83..ee98e10252 100644 --- a/Walls/RunicProfanedBrickWall.cs +++ b/Walls/RunicProfanedBrickWall.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Walls { public class RunicProfanedBrickWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; @@ -27,7 +27,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { - Texture2D sprite = ModContent.GetTexture("CalamityMod/Walls/RunicProfanedBrickWall"); + Texture2D sprite = ModContent.Request("CalamityMod/Walls/RunicProfanedBrickWall"); Color lightColor = GetWallColour(i, j); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); diff --git a/Walls/SilvaWall.cs b/Walls/SilvaWall.cs index 2d9ededb10..ad62d15e34 100644 --- a/Walls/SilvaWall.cs +++ b/Walls/SilvaWall.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls { public class SilvaWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/SmoothAbyssGravelWall.cs b/Walls/SmoothAbyssGravelWall.cs index 50e9b75654..960f6689f6 100644 --- a/Walls/SmoothAbyssGravelWall.cs +++ b/Walls/SmoothAbyssGravelWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class SmoothAbyssGravelWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/SmoothBrimstoneSlagWall.cs b/Walls/SmoothBrimstoneSlagWall.cs index df6a364204..017fdc1aec 100644 --- a/Walls/SmoothBrimstoneSlagWall.cs +++ b/Walls/SmoothBrimstoneSlagWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class SmoothBrimstoneSlagWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/SmoothNavystoneWall.cs b/Walls/SmoothNavystoneWall.cs index e2b050cf23..2959514fa1 100644 --- a/Walls/SmoothNavystoneWall.cs +++ b/Walls/SmoothNavystoneWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class SmoothNavystoneWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/SmoothVoidstoneWall.cs b/Walls/SmoothVoidstoneWall.cs index 51e16872e6..0ffb1bbaf7 100644 --- a/Walls/SmoothVoidstoneWall.cs +++ b/Walls/SmoothVoidstoneWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class SmoothVoidstoneWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/StatigelWall.cs b/Walls/StatigelWall.cs index 48ad7e9b28..28b3d40385 100644 --- a/Walls/StatigelWall.cs +++ b/Walls/StatigelWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class StatigelWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/StratusWall.cs b/Walls/StratusWall.cs index 63e77280b1..e7adc8b9c0 100644 --- a/Walls/StratusWall.cs +++ b/Walls/StratusWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class StratusWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/SulphurousSandWall.cs b/Walls/SulphurousSandWall.cs index 3e42165236..c4640f7fc3 100644 --- a/Walls/SulphurousSandWall.cs +++ b/Walls/SulphurousSandWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class SulphurousSandWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = 32; AddMapEntry(new Color(84, 71, 46)); diff --git a/Walls/SulphurousSandWallSafe.cs b/Walls/SulphurousSandWallSafe.cs index f19f55ca43..c29aed40f0 100644 --- a/Walls/SulphurousSandWallSafe.cs +++ b/Walls/SulphurousSandWallSafe.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class SulphurousSandWallSafe : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; dustType = 32; diff --git a/Walls/SulphurousSandstoneWall.cs b/Walls/SulphurousSandstoneWall.cs index f5a9d1aff2..b538aa1f1a 100644 --- a/Walls/SulphurousSandstoneWall.cs +++ b/Walls/SulphurousSandstoneWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class SulphurousSandstoneWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = 32; AddMapEntry(new Color(57, 45, 38)); diff --git a/Walls/SulphurousSandstoneWallSafe.cs b/Walls/SulphurousSandstoneWallSafe.cs index 1dfa178607..f9e7f4285b 100644 --- a/Walls/SulphurousSandstoneWallSafe.cs +++ b/Walls/SulphurousSandstoneWallSafe.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class SulphurousSandstoneWallSafe : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; dustType = 32; diff --git a/Walls/UelibloomBrickWall.cs b/Walls/UelibloomBrickWall.cs index 23ed548719..1ba0f6fe41 100644 --- a/Walls/UelibloomBrickWall.cs +++ b/Walls/UelibloomBrickWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class UelibloomBrickWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/VoidstoneSlabWall.cs b/Walls/VoidstoneSlabWall.cs index df83efdc84..cf7b52ad7d 100644 --- a/Walls/VoidstoneSlabWall.cs +++ b/Walls/VoidstoneSlabWall.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls { public class VoidstoneSlabWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; @@ -25,7 +25,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { - Texture2D sprite = ModContent.GetTexture("CalamityMod/Walls/VoidstoneSlabWall"); + Texture2D sprite = ModContent.Request("CalamityMod/Walls/VoidstoneSlabWall"); Color lightColor = GetWallColour(i, j); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); diff --git a/Walls/VoidstoneWall.cs b/Walls/VoidstoneWall.cs index e5466aed4f..c9d41a5602 100644 --- a/Walls/VoidstoneWall.cs +++ b/Walls/VoidstoneWall.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class VoidstoneWall : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/VoidstoneWallUnsafe.cs index a6b27e1c0f..e904d54c83 100644 --- a/Walls/VoidstoneWallUnsafe.cs +++ b/Walls/VoidstoneWallUnsafe.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Walls { public class VoidstoneWallUnsafe : ModWall { - public override void SetDefaults() + public override void SetStaticDefaults() { dustType = 187; AddMapEntry(new Color(0, 0, 0)); diff --git a/Waters/AbyssWater.cs b/Waters/AbyssWater.cs index e611aba111..6846c1727c 100644 --- a/Waters/AbyssWater.cs +++ b/Waters/AbyssWater.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Waters public override int ChooseWaterfallStyle() { - return mod.GetWaterfallStyleSlot("AbyssWaterflow"); + return Mod.GetWaterfallStyleSlot("AbyssWaterflow"); } public override int GetSplashDust() diff --git a/Waters/AstralWater.cs b/Waters/AstralWater.cs index cfa10fc018..78e7320dd7 100644 --- a/Waters/AstralWater.cs +++ b/Waters/AstralWater.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Waters public override int ChooseWaterfallStyle() { - return mod.GetWaterfallStyleSlot("AstralWaterflow"); + return Mod.GetWaterfallStyleSlot("AstralWaterflow"); } public override int GetSplashDust() @@ -25,7 +25,7 @@ namespace CalamityMod.Waters public override int GetDropletGore() { - return mod.GetGoreSlot("Gores/AstralWaterDroplet"); + return Mod.GetGoreSlot("Gores/AstralWaterDroplet"); } public override Color BiomeHairColor() diff --git a/Waters/CustomLavaManagement.cs b/Waters/CustomLavaManagement.cs index 4ca4c1929c..c8d884960c 100644 --- a/Waters/CustomLavaManagement.cs +++ b/Waters/CustomLavaManagement.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Waters if (Main.netMode != NetmodeID.Server) { - LavaBlockTexture = ModContent.GetTexture("Terraria/Liquid_1"); - LavaTexture = ModContent.GetTexture("Terraria/Misc/water_1"); + LavaBlockTexture = ModContent.Request("Terraria/Liquid_1"); + LavaTexture = ModContent.Request("Terraria/Misc/water_1"); } } diff --git a/Waters/CustomLavaStyle.cs b/Waters/CustomLavaStyle.cs index 15ad98ccaf..8d64e7f4c6 100644 --- a/Waters/CustomLavaStyle.cs +++ b/Waters/CustomLavaStyle.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Waters if (Main.netMode == NetmodeID.Server) return; - LavaTexture = ModContent.GetTexture(LavaTexturePath); - BlockTexture = ModContent.GetTexture(BlockTexturePath); + LavaTexture = ModContent.Request(LavaTexturePath); + BlockTexture = ModContent.Request(BlockTexturePath); } internal void Unload() diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index 13d93e5794..f9205f7e4f 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Waters public override int ChooseWaterfallStyle() { - return mod.GetWaterfallStyleSlot("SulphuricWaterflow"); + return Mod.GetWaterfallStyleSlot("SulphuricWaterflow"); } public override int GetSplashDust() diff --git a/Waters/SunkenSeaWater.cs b/Waters/SunkenSeaWater.cs index 8dc8eac1eb..7b3560e74f 100644 --- a/Waters/SunkenSeaWater.cs +++ b/Waters/SunkenSeaWater.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Waters public override int ChooseWaterfallStyle() { - return mod.GetWaterfallStyleSlot("SunkenSeaWaterflow"); + return Mod.GetWaterfallStyleSlot("SunkenSeaWaterflow"); } public override int GetSplashDust() diff --git a/World/Abyss.cs b/World/Abyss.cs index 36444a473a..d945b8be6a 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -43,16 +43,16 @@ namespace CalamityMod.World { Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); bool canConvert = tile.active() && - tile.type < TileID.Count && - tile.type != TileID.DyePlants && - tile.type != TileID.Trees && - tile.type != TileID.PalmTree && - tile.type != TileID.Sand && - tile.type != TileID.Containers && - tile.type != TileID.Coral && - tile.type != TileID.BeachPiles && - tile.type != ModContent.TileType() && - tile.type != ModContent.TileType(); + tile.TileType < TileID.Count && + tile.TileType != TileID.DyePlants && + tile.TileType != TileID.Trees && + tile.TileType != TileID.PalmTree && + tile.TileType != TileID.Sand && + tile.TileType != TileID.Containers && + tile.TileType != TileID.Coral && + tile.TileType != TileID.BeachPiles && + tile.TileType != ModContent.TileType() && + tile.TileType != ModContent.TileType(); if (abyssIndex2 > rockLayer - WorldGen.genRand.Next(30)) { if (abyssIndex > abyssChasmX + 75 - WorldGen.genRand.Next(30)) @@ -61,14 +61,14 @@ namespace CalamityMod.World { if (canConvert) { - tile.wall = (ushort)ModContent.WallType(); - tile.type = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); } else if (!tile.active()) { tile.active(true); - tile.wall = (ushort)ModContent.WallType(); - tile.type = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); } } } @@ -78,14 +78,14 @@ namespace CalamityMod.World { if (canConvert) { - tile.wall = (ushort)ModContent.WallType(); - tile.type = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); } else if (!tile.active()) { tile.active(true); - tile.wall = (ushort)ModContent.WallType(); - tile.type = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); } } } @@ -95,18 +95,18 @@ namespace CalamityMod.World { if (abyssIndex2 > (rockLayer + y * 0.262)) { - tile.type = (ushort)ModContent.TileType(); - tile.wall = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) { - tile.type = (ushort)ModContent.TileType(); - tile.wall = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } else { - tile.type = (ushort)ModContent.TileType(); - tile.wall = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } } else if (!tile.active()) @@ -114,18 +114,18 @@ namespace CalamityMod.World tile.active(true); if (abyssIndex2 > (rockLayer + y * 0.262)) { - tile.type = (ushort)ModContent.TileType(); - tile.wall = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) { - tile.type = (ushort)ModContent.TileType(); - tile.wall = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } else { - tile.wall = (ushort)ModContent.WallType(); - tile.type = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); } } } @@ -141,14 +141,14 @@ namespace CalamityMod.World { Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); bool canConvert = tile.active() && - tile.type < TileID.Count && - tile.type != TileID.DyePlants && - tile.type != TileID.Trees && - tile.type != TileID.PalmTree && - tile.type != TileID.Sand && - tile.type != TileID.Containers && - tile.type != TileID.Coral && - tile.type != TileID.BeachPiles; + tile.TileType < TileID.Count && + tile.TileType != TileID.DyePlants && + tile.TileType != TileID.Trees && + tile.TileType != TileID.PalmTree && + tile.TileType != TileID.Sand && + tile.TileType != TileID.Containers && + tile.TileType != TileID.Coral && + tile.TileType != TileID.BeachPiles; if (abyssIndex2 > rockLayer - WorldGen.genRand.Next(30)) { if (abyssIndex < abyssChasmX - 75) @@ -157,14 +157,14 @@ namespace CalamityMod.World { if (canConvert) { - tile.wall = (ushort)ModContent.WallType(); - tile.type = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); } else if (!tile.active()) { tile.active(true); - tile.wall = (ushort)ModContent.WallType(); - tile.type = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); } } } @@ -174,14 +174,14 @@ namespace CalamityMod.World { if (canConvert) { - tile.wall = (ushort)ModContent.WallType(); - tile.type = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); } else if (!tile.active()) { tile.active(true); - tile.wall = (ushort)ModContent.WallType(); - tile.type = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); } } } @@ -191,18 +191,18 @@ namespace CalamityMod.World { if (abyssIndex2 > (rockLayer + y * 0.262)) { - tile.type = (ushort)ModContent.TileType(); - tile.wall = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) { - tile.type = (ushort)ModContent.TileType(); - tile.wall = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } else { - tile.type = (ushort)ModContent.TileType(); - tile.wall = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } } else if (!tile.active()) @@ -210,18 +210,18 @@ namespace CalamityMod.World tile.active(true); if (abyssIndex2 > (rockLayer + y * 0.262)) { - tile.type = (ushort)ModContent.TileType(); - tile.wall = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.Next(3) == 0) { - tile.type = (ushort)ModContent.TileType(); - tile.wall = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } else { - tile.wall = (ushort)ModContent.WallType(); - tile.type = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + tile.TileType = (ushort)ModContent.TileType(); } } } @@ -449,7 +449,7 @@ namespace CalamityMod.World num6 = l; } Main.tile[k, l].active(true); - Main.tile[k, l].type = (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType()); + Main.tile[k, l].TileType = (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType()); CalamityUtils.SafeSquareTileFrame(k, l, true); } } @@ -501,7 +501,7 @@ namespace CalamityMod.World if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) { Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; + Main.tile[n, num17].TileType = (ushort)num16; CalamityUtils.SafeSquareTileFrame(n, num17, true); } } @@ -533,7 +533,7 @@ namespace CalamityMod.World if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num150 + WorldGen.genRand.Next(2))) { Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; + Main.tile[n, num17].TileType = (ushort)num16; CalamityUtils.SafeSquareTileFrame(n, num17, true); } } @@ -581,7 +581,7 @@ namespace CalamityMod.World while (num23 < num4) { int num24 = num6; - while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) + while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].TileType != 0) && num23 < num4) { num24--; if (num24 < num5) @@ -605,7 +605,7 @@ namespace CalamityMod.World float num29 = (float)(Math.Abs(num28 - num24) * 2); if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) { - Main.tile[num27, num28].type = (ushort)num26; + Main.tile[num27, num28].TileType = (ushort)num26; CalamityUtils.SafeSquareTileFrame(num27, num28, true); } } @@ -631,7 +631,7 @@ namespace CalamityMod.World } if (flag) { - Main.tile[num30, num31].wall = (ushort)(isVoid ? ModContent.WallType() : ModContent.WallType()); + Main.tile[num30, num31].WallType = (ushort)(isVoid ? ModContent.WallType() : ModContent.WallType()); WorldGen.SquareWallFrame(num30, num31, true); } } @@ -643,28 +643,28 @@ namespace CalamityMod.World { num35++; } - if (num35 < num6 && Main.tile[num34, num35 + 1].type == (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType())) + if (num35 < num6 && Main.tile[num34, num35 + 1].TileType == (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType())) { if (WorldGen.genRand.Next(10) == 0) { int num36 = WorldGen.genRand.Next(1, 3); for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) { - if (Main.tile[num37, num35].type == (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType())) + if (Main.tile[num37, num35].TileType == (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType())) { Main.tile[num37, num35].active(false); Main.tile[num37, num35].liquid = 255; Main.tile[num37, num35].lava(false); CalamityUtils.SafeSquareTileFrame(num34, num35, true); } - if (Main.tile[num37, num35 + 1].type == (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType())) + if (Main.tile[num37, num35 + 1].TileType == (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType())) { Main.tile[num37, num35 + 1].active(false); Main.tile[num37, num35 + 1].liquid = 255; Main.tile[num37, num35 + 1].lava(false); CalamityUtils.SafeSquareTileFrame(num34, num35 + 1, true); } - if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType())) + if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].TileType == (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType())) { Main.tile[num37, num35 + 2].active(false); Main.tile[num37, num35 + 2].liquid = 255; @@ -732,8 +732,8 @@ namespace CalamityMod.World if (m != num6 - 1 || (l != num4 && l != num5)) { Main.tile[l, m].active(true); - Main.tile[l, m].type = type; - Main.tile[l, m].wall = wall; + Main.tile[l, m].TileType = type; + Main.tile[l, m].WallType = wall; Main.tile[l, m].halfBrick(false); Main.tile[l, m].slope(0); } @@ -763,7 +763,7 @@ namespace CalamityMod.World { for (int num8 = num6; num8 < num7; num8++) { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == wall) + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].WallType == wall) { Main.tile[n, num8].active(false); } diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index ceb49bda5c..8ffdc3d848 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -13,7 +13,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Utilities; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World { @@ -29,7 +29,7 @@ namespace CalamityMod.World int y = 5; while (y < Main.worldSurface) { - if (Main.tile[x, y].active() && Main.tile[x, y].type == ModContent.TileType()) + if (Main.tile[x, y].active() && Main.tile[x, y].TileType == ModContent.TileType()) { astralOreCount++; if (astralOreCount > astralOreAllowed) @@ -52,12 +52,12 @@ namespace CalamityMod.World while (y < Main.worldSurface) { if (Main.tile[x, y].active() && - (Main.tile[x, y].type == ModContent.TileType() || Main.tile[x, y].type == ModContent.TileType() || - Main.tile[x, y].type == ModContent.TileType() || Main.tile[x, y].type == ModContent.TileType() || - Main.tile[x, y].type == ModContent.TileType() || Main.tile[x, y].type == ModContent.TileType() || - Main.tile[x, y].type == ModContent.TileType() || Main.tile[x, y].type == ModContent.TileType() || - Main.tile[x, y].type == ModContent.TileType() || Main.tile[x, y].type == ModContent.TileType() || - Main.tile[x, y].type == ModContent.TileType() || Main.tile[x, y].type == ModContent.TileType())) + (Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType())) { astralTileCount++; if (astralTileCount > astralTilesAllowed) @@ -108,7 +108,7 @@ namespace CalamityMod.World int y = (int)(Main.worldSurface * 0.5); //Large = 522, Medium = 444, Small = 336 while (y < Main.maxTilesY) { - if (Main.tile[x, y].active() && Main.tileSolid[(int)Main.tile[x, y].type]) + if (Main.tile[x, y].active() && Main.tileSolid[(int)Main.tile[x, y].TileType]) { int suitableTiles = 0; int checkRadius = 15; @@ -121,12 +121,12 @@ namespace CalamityMod.World suitableTiles++; // Avoid floating islands: Clouds and Sunplate both harshly punish attempted meteor spawns - if (Main.tile[l, m].type == TileID.Cloud || Main.tile[l, m].type == TileID.Sunplate) + if (Main.tile[l, m].TileType == TileID.Cloud || Main.tile[l, m].TileType == TileID.Sunplate) { suitableTiles -= 100; } // Avoid Sulphurous Sea beach: Cannot be converted by astral - else if (Main.tile[l, m].type == ModContent.TileType() || Main.tile[l, m].type == ModContent.TileType()) + else if (Main.tile[l, m].TileType == ModContent.TileType() || Main.tile[l, m].TileType == ModContent.TileType()) { suitableTiles -= 100; } @@ -134,12 +134,12 @@ namespace CalamityMod.World // Prevent the Astral biome from overriding or interfering with an AA biome else if (ancientsAwakened != null) { - if (Main.tile[l, m].type == ancientsAwakened.TileType("InfernoGrass") || Main.tile[l, m].type == ancientsAwakened.TileType("Torchstone") || - Main.tile[l, m].type == ancientsAwakened.TileType("Torchsand") || Main.tile[l, m].type == ancientsAwakened.TileType("Torchsandstone") || - Main.tile[l, m].type == ancientsAwakened.TileType("Torchsandhardened") || Main.tile[l, m].type == ancientsAwakened.TileType("Torchice") || - Main.tile[l, m].type == ancientsAwakened.TileType("Depthstone") || Main.tile[l, m].type == ancientsAwakened.TileType("Depthsand") || - Main.tile[l, m].type == ancientsAwakened.TileType("Depthsandstone") || Main.tile[l, m].type == ancientsAwakened.TileType("Depthsandhardened") || - Main.tile[l, m].type == ancientsAwakened.TileType("Depthice")) + if (Main.tile[l, m].TileType == ancientsAwakened.Find("InfernoGrass") .Type|| Main.tile[l, m].TileType == ancientsAwakened.Find("Torchstone") .Type|| + Main.tile[l, m].TileType == ancientsAwakened.Find("Torchsand") .Type|| Main.tile[l, m].TileType == ancientsAwakened.Find("Torchsandstone") .Type|| + Main.tile[l, m].TileType == ancientsAwakened.Find("Torchsandhardened") .Type|| Main.tile[l, m].TileType == ancientsAwakened.Find("Torchice") .Type|| + Main.tile[l, m].TileType == ancientsAwakened.Find("Depthstone") .Type|| Main.tile[l, m].TileType == ancientsAwakened.Find("Depthsand") .Type|| + Main.tile[l, m].TileType == ancientsAwakened.Find("Depthsandstone") .Type|| Main.tile[l, m].TileType == ancientsAwakened.Find("Depthsandhardened") .Type|| + Main.tile[l, m].TileType == ancientsAwakened.Find("Depthice").Type) { suitableTiles -= 100; } @@ -228,7 +228,7 @@ namespace CalamityMod.World { for (int n = j - num; n < j + num; n++) { - if (Main.tile[m, n].active() && Main.tile[m, n].type == 21) + if (Main.tile[m, n].active() && Main.tile[m, n].TileType == 21) { return false; } @@ -248,11 +248,11 @@ namespace CalamityMod.World { if (Main.tile[num2, num3] != null) { - if (!Main.tileSolid[(int)Main.tile[num2, num3].type]) + if (!Main.tileSolid[(int)Main.tile[num2, num3].TileType]) { Main.tile[num2, num3].active(false); } - Main.tile[num2, num3].type = (ushort)ModContent.TileType(); + Main.tile[num2, num3].TileType = (ushort)ModContent.TileType(); } } } @@ -288,7 +288,7 @@ namespace CalamityMod.World { if ((double)num16 < (double)num * 0.7) { - if (Main.tile[num12, num13].type == 5 || Main.tile[num12, num13].type == 32 || Main.tile[num12, num13].type == 352) + if (Main.tile[num12, num13].TileType == 5 || Main.tile[num12, num13].TileType == 32 || Main.tile[num12, num13].TileType == 352) { try { WorldGen.KillTile(num12, num13, false, false, true); } @@ -297,7 +297,7 @@ namespace CalamityMod.World } Main.tile[num12, num13].liquid = 0; } - if (Main.tile[num12, num13].type == (ushort)ModContent.TileType()) + if (Main.tile[num12, num13].TileType == (ushort)ModContent.TileType()) { if (!WorldGen.SolidTile(num12 - 1, num13) && !WorldGen.SolidTile(num12 + 1, num13) && !WorldGen.SolidTile(num12, num13 - 1) && !WorldGen.SolidTile(num12, num13 + 1)) { @@ -327,11 +327,11 @@ namespace CalamityMod.World { if (Main.tile[num17, num18] != null) { - if (Main.tile[num17, num18].type == 5 || Main.tile[num17, num18].type == 32 || Main.tile[num17, num18].type == 352) + if (Main.tile[num17, num18].TileType == 5 || Main.tile[num17, num18].TileType == 32 || Main.tile[num17, num18].TileType == 352) { WorldGen.KillTile(num17, num18, false, false, false); } - Main.tile[num17, num18].type = (ushort)ModContent.TileType(); + Main.tile[num17, num18].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(num17, num18, true); } } @@ -352,11 +352,11 @@ namespace CalamityMod.World { if (Main.tile[num22, num23] != null) { - if (Main.tile[num22, num23].type == 5 || Main.tile[num22, num23].type == 32 || Main.tile[num22, num23].type == 352) + if (Main.tile[num22, num23].TileType == 5 || Main.tile[num22, num23].TileType == 32 || Main.tile[num22, num23].TileType == 352) { WorldGen.KillTile(num22, num23, false, false, false); } - Main.tile[num22, num23].type = (ushort)ModContent.TileType(); + Main.tile[num22, num23].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(num22, num23, true); } } @@ -410,9 +410,9 @@ namespace CalamityMod.World { int y = j - 200; Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(x, y); - while (!Main.tileSolid[tileAtPosition.type] || + while (!Main.tileSolid[tileAtPosition.TileType] || !tileAtPosition.active() || - TileID.Sets.Platforms[tileAtPosition.type]) + TileID.Sets.Platforms[tileAtPosition.TileType]) { y++; if (y > j - 10) @@ -505,32 +505,32 @@ namespace CalamityMod.World { if (WorldGen.InWorld(x, y, 1)) { - int type = Main.tile[x, y].type; - int wallType = Main.tile[x, y].wall; + int type = Main.tile[x, y].TileType; + int wallType = Main.tile[x, y].WallType; if (Main.tile[x, y] != null) { if (WallID.Sets.Conversion.Grass[wallType]) { - Main.tile[x, y].wall = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } else if (WallID.Sets.Conversion.HardenedSand[wallType]) { - Main.tile[x, y].wall = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } else if (WallID.Sets.Conversion.Sandstone[wallType]) { - Main.tile[x, y].wall = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } else if (WallID.Sets.Conversion.Stone[wallType]) { - Main.tile[x, y].wall = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } @@ -545,27 +545,27 @@ namespace CalamityMod.World case WallID.DirtUnsafe4: case WallID.Cave6Unsafe: case WallID.Dirt: - Main.tile[x, y].wall = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; case WallID.SnowWallUnsafe: - Main.tile[x, y].wall = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; case WallID.DesertFossil: - Main.tile[x, y].wall = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; case WallID.IceUnsafe: - Main.tile[x, y].wall = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; case WallID.LivingWood: - Main.tile[x, y].wall = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; @@ -573,37 +573,37 @@ namespace CalamityMod.World } if (TileID.Sets.Conversion.Grass[type] && !TileID.Sets.GrassSpecial[type]) { - Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } else if (TileID.Sets.Conversion.Stone[type] || Main.tileMoss[type]) { - Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } else if (TileID.Sets.Conversion.Sand[type]) { - Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } else if (TileID.Sets.Conversion.HardenedSand[type]) { - Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } else if (TileID.Sets.Conversion.Sandstone[type]) { - Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } else if (TileID.Sets.Conversion.Ice[type]) { - Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } @@ -613,38 +613,38 @@ namespace CalamityMod.World switch (type) { case TileID.Dirt: - Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; case TileID.SnowBlock: - Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; case TileID.Silt: case TileID.Slush: - Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; case TileID.DesertFossil: - Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; case TileID.ClayBlock: - Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; case TileID.Vines: - Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; case TileID.LivingWood: - Main.tile[x, y].type = (ushort)ModContent.TileType(); + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; @@ -657,42 +657,42 @@ namespace CalamityMod.World } break; case TileID.LargePiles: - if (tile.frameX <= 1170) + if (tile.TileFrameX <= 1170) { RecursiveReplaceToAstral(TileID.LargePiles, (ushort)ModContent.TileType(), x, y, 324, 0, 1170, 0, 18); } - if (tile.frameX >= 1728) + if (tile.TileFrameX >= 1728) { RecursiveReplaceToAstral(TileID.LargePiles, (ushort)ModContent.TileType(), x, y, 324, 1728, 1872, 0, 18); } - if (tile.frameX >= 1404 && tile.frameX <= 1710) + if (tile.TileFrameX >= 1404 && tile.TileFrameX <= 1710) { RecursiveReplaceToAstral(TileID.LargePiles, (ushort)ModContent.TileType(), x, y, 324, 1404, 1710, 0, 18); } break; case TileID.LargePiles2: - if (tile.frameX >= 1566 && tile.frameY < 36) + if (tile.TileFrameX >= 1566 && tile.TileFrameY < 36) { RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)ModContent.TileType(), x, y, 324, 1566, 1872, 0, 18); } - if (tile.frameX >= 756 && tile.frameX <= 900) + if (tile.TileFrameX >= 756 && tile.TileFrameX <= 900) { RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)ModContent.TileType(), x, y, 324, 756, 900, 0, 18); } break; case TileID.SmallPiles: - if (tile.frameY == 18) + if (tile.TileFrameY == 18) { ushort newType; - if (tile.frameX >= 1476 && tile.frameX <= 1674) + if (tile.TileFrameX >= 1476 && tile.TileFrameX <= 1674) { newType = (ushort)ModContent.TileType(); } - else if (tile.frameX <= 558 || (tile.frameX >= 1368 && tile.frameX <= 1458)) + else if (tile.TileFrameX <= 558 || (tile.TileFrameX >= 1368 && tile.TileFrameX <= 1458)) { newType = (ushort)ModContent.TileType(); } - else if (tile.frameX >= 900 && tile.frameX <= 1098) + else if (tile.TileFrameX >= 900 && tile.TileFrameX <= 1098) { newType = (ushort)ModContent.TileType(); } @@ -701,42 +701,42 @@ namespace CalamityMod.World break; } int leftMost = x; - if (tile.frameX % 36 != 0) //this means it's the right tile of the two + if (tile.TileFrameX % 36 != 0) //this means it's the right tile of the two { leftMost--; } if (Main.tile[leftMost, y] != null) { - Main.tile[leftMost, y].type = newType; + Main.tile[leftMost, y].TileType = newType; WorldGen.SquareTileFrame(leftMost, y, true); NetMessage.SendTileSquare(-1, leftMost, y, 1); } if (Main.tile[leftMost + 1, y] != null) { - Main.tile[leftMost + 1, y].type = newType; + Main.tile[leftMost + 1, y].TileType = newType; WorldGen.SquareTileFrame(leftMost + 1, y, true); NetMessage.SendTileSquare(-1, leftMost + 1, y, 1); } - while (Main.tile[leftMost, y].frameX >= 216) + while (Main.tile[leftMost, y].TileFrameX >= 216) { if (Main.tile[leftMost, y] != null) - Main.tile[leftMost, y].frameX -= 216; + Main.tile[leftMost, y].TileFrameX -= 216; if (Main.tile[leftMost + 1, y] != null) - Main.tile[leftMost + 1, y].frameX -= 216; + Main.tile[leftMost + 1, y].TileFrameX -= 216; } } - else if (tile.frameY == 0) + else if (tile.TileFrameY == 0) { ushort newType3; - if (tile.frameX >= 972 && tile.frameX <= 1062) + if (tile.TileFrameX >= 972 && tile.TileFrameX <= 1062) { newType3 = (ushort)ModContent.TileType(); } - else if (tile.frameX <= 486) + else if (tile.TileFrameX <= 486) { newType3 = (ushort)ModContent.TileType(); } - else if (tile.frameX >= 648 && tile.frameX <= 846) + else if (tile.TileFrameX >= 648 && tile.TileFrameX <= 846) { newType3 = (ushort)ModContent.TileType(); } @@ -744,29 +744,29 @@ namespace CalamityMod.World { break; } - Main.tile[x, y].type = newType3; - while (Main.tile[x, y].frameX >= 108) //REFRAME IT + Main.tile[x, y].TileType = newType3; + while (Main.tile[x, y].TileFrameX >= 108) //REFRAME IT { - Main.tile[x, y].frameX -= 108; + Main.tile[x, y].TileFrameX -= 108; } WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } break; case TileID.Stalactite: - int topMost = tile.frameY <= 54 ? (tile.frameY % 36 == 0 ? y : y - 1) : y; - bool twoTall = tile.frameY <= 54; - bool hanging = tile.frameY <= 18 || tile.frameY == 72; + int topMost = tile.TileFrameY <= 54 ? (tile.TileFrameY % 36 == 0 ? y : y - 1) : y; + bool twoTall = tile.TileFrameY <= 54; + bool hanging = tile.TileFrameY <= 18 || tile.TileFrameY == 72; ushort newType2; - if (tile.frameX >= 378 && tile.frameX <= 414) //DESERT + if (tile.TileFrameX >= 378 && tile.TileFrameX <= 414) //DESERT { newType2 = (ushort)ModContent.TileType(); } - else if ((tile.frameX >= 54 && tile.frameX <= 90) || (tile.frameX >= 216 && tile.frameX <= 360)) + else if ((tile.TileFrameX >= 54 && tile.TileFrameX <= 90) || (tile.TileFrameX >= 216 && tile.TileFrameX <= 360)) { newType2 = (ushort)ModContent.TileType(); } - else if (tile.frameX <= 36) + else if (tile.TileFrameX <= 36) { newType2 = (ushort)ModContent.TileType(); } @@ -778,23 +778,23 @@ namespace CalamityMod.World //Set types if (Main.tile[x, topMost] != null) { - Main.tile[x, topMost].type = newType2; + Main.tile[x, topMost].TileType = newType2; } if (twoTall) { if (Main.tile[x, topMost + 1] != null) - Main.tile[x, topMost + 1].type = newType2; + Main.tile[x, topMost + 1].TileType = newType2; } //Fix frames - while (Main.tile[x, topMost].frameX >= 54) + while (Main.tile[x, topMost].TileFrameX >= 54) { if (Main.tile[x, topMost] != null) - Main.tile[x, topMost].frameX -= 54; + Main.tile[x, topMost].TileFrameX -= 54; if (twoTall) { if (Main.tile[x, topMost + 1] != null) - Main.tile[x, topMost + 1].frameX -= 54; + Main.tile[x, topMost + 1].TileFrameX -= 54; } } @@ -834,8 +834,8 @@ namespace CalamityMod.World public static void ConvertFromAstral(int x, int y, ConvertType convert, bool tileframe = true) { Tile tile = Main.tile[x, y]; - int type = tile.type; - int wallType = tile.wall; + int type = tile.TileType; + int wallType = tile.WallType; if (WorldGen.InWorld(x, y, 1)) { @@ -844,57 +844,57 @@ namespace CalamityMod.World { if (wallType == ModContent.WallType()) { - Main.tile[x, y].wall = WallID.DirtUnsafe; + Main.tile[x, y].WallType = WallID.DirtUnsafe; } else if (wallType == ModContent.WallType() || wallType == ModContent.WallType()) { - Main.tile[x, y].wall = WallID.SnowWallUnsafe; + Main.tile[x, y].WallType = WallID.SnowWallUnsafe; } else if (wallType == ModContent.WallType()) { - Main.tile[x, y].wall = WallID.DesertFossil; + Main.tile[x, y].WallType = WallID.DesertFossil; } else if (wallType == ModContent.WallType()) { switch (convert) { case ConvertType.Corrupt: - Main.tile[x, y].wall = WallID.CorruptGrassUnsafe; + Main.tile[x, y].WallType = WallID.CorruptGrassUnsafe; break; case ConvertType.Crimson: - Main.tile[x, y].wall = WallID.CrimsonGrassUnsafe; + Main.tile[x, y].WallType = WallID.CrimsonGrassUnsafe; break; case ConvertType.Hallow: - Main.tile[x, y].wall = WallID.HallowedGrassUnsafe; + Main.tile[x, y].WallType = WallID.HallowedGrassUnsafe; break; case ConvertType.Pure: - Main.tile[x, y].wall = WallID.GrassUnsafe; + Main.tile[x, y].WallType = WallID.GrassUnsafe; break; } } else if (wallType == ModContent.WallType()) { - Main.tile[x, y].wall = WallID.IceUnsafe; + Main.tile[x, y].WallType = WallID.IceUnsafe; } else if (wallType == ModContent.WallType()) { - Main.tile[x, y].wall = WallID.LivingWood; + Main.tile[x, y].WallType = WallID.LivingWood; } else if (wallType == ModContent.WallType()) { switch (convert) { case ConvertType.Corrupt: - Main.tile[x, y].wall = WallID.EbonstoneUnsafe; + Main.tile[x, y].WallType = WallID.EbonstoneUnsafe; break; case ConvertType.Crimson: - Main.tile[x, y].wall = WallID.CrimstoneUnsafe; + Main.tile[x, y].WallType = WallID.CrimstoneUnsafe; break; case ConvertType.Hallow: - Main.tile[x, y].wall = WallID.PearlstoneBrickUnsafe; + Main.tile[x, y].WallType = WallID.PearlstoneBrickUnsafe; break; case ConvertType.Pure: - Main.tile[x, y].wall = WallID.Stone; + Main.tile[x, y].WallType = WallID.Stone; break; } } @@ -906,23 +906,23 @@ namespace CalamityMod.World { if (type == ModContent.TileType()) { - tile.type = TileID.Dirt; + tile.TileType = TileID.Dirt; } else if (type == ModContent.TileType()) { - tile.type = TileID.SnowBlock; + tile.TileType = TileID.SnowBlock; } else if (type == ModContent.TileType()) { - tile.type = TileID.Silt; + tile.TileType = TileID.Silt; } else if (type == ModContent.TileType()) { - tile.type = TileID.DesertFossil; + tile.TileType = TileID.DesertFossil; } else if (type == ModContent.TileType()) { - tile.type = TileID.ClayBlock; + tile.TileType = TileID.ClayBlock; } else if (type == ModContent.TileType()) { @@ -934,7 +934,7 @@ namespace CalamityMod.World } else if (type == ModContent.TileType()) { - tile.type = TileID.LivingWood; + tile.TileType = TileID.LivingWood; } else if (type == ModContent.TileType()) { @@ -1066,28 +1066,28 @@ namespace CalamityMod.World case ConvertType.Corrupt: if (corrupt != ushort.MaxValue) { - Main.tile[x, y].type = corrupt; + Main.tile[x, y].TileType = corrupt; WorldGen.SquareTileFrame(x, y); } break; case ConvertType.Crimson: if (crimson != ushort.MaxValue) { - Main.tile[x, y].type = crimson; + Main.tile[x, y].TileType = crimson; WorldGen.SquareTileFrame(x, y); } break; case ConvertType.Hallow: if (hallow != ushort.MaxValue) { - Main.tile[x, y].type = hallow; + Main.tile[x, y].TileType = hallow; WorldGen.SquareTileFrame(x, y); } break; case ConvertType.Pure: if (pure != ushort.MaxValue) { - Main.tile[x, y].type = pure; + Main.tile[x, y].TileType = pure; WorldGen.SquareTileFrame(x, y); } break; @@ -1097,13 +1097,13 @@ namespace CalamityMod.World public static void RecursiveReplaceToAstral(ushort checkType, ushort replaceType, int x, int y, int replaceTextureWidth, int minFrameX = 0, int maxFrameX = int.MaxValue, int minFrameY = 0, int maxFrameY = int.MaxValue) { Tile tile = Main.tile[x, y]; - if (tile == null || !tile.active() || tile.type != checkType || tile.frameX < minFrameX || tile.frameX > maxFrameX || tile.frameY < minFrameY || tile.frameY > maxFrameY) + if (tile == null || !tile.active() || tile.TileType != checkType || tile.TileFrameX < minFrameX || tile.TileFrameX > maxFrameX || tile.TileFrameY < minFrameY || tile.TileFrameY > maxFrameY) return; - Main.tile[x, y].type = replaceType; - while (Main.tile[x, y].frameX >= replaceTextureWidth) + Main.tile[x, y].TileType = replaceType; + while (Main.tile[x, y].TileFrameX >= replaceTextureWidth) { - Main.tile[x, y].frameX -= (short)replaceTextureWidth; + Main.tile[x, y].TileFrameX -= (short)replaceTextureWidth; } if (Main.tile[x - 1, y] != null) @@ -1119,12 +1119,12 @@ namespace CalamityMod.World public static void RecursiveReplaceFromAstral(ushort checkType, ushort replaceType, int x, int y, int addFrameX, int addFrameY) { Tile tile = Main.tile[x, y]; - if (tile == null || !tile.active() || tile.type != checkType) + if (tile == null || !tile.active() || tile.TileType != checkType) return; - Main.tile[x, y].type = replaceType; - Main.tile[x, y].frameX += (short)addFrameX; - Main.tile[x, y].frameY += (short)addFrameY; + Main.tile[x, y].TileType = replaceType; + Main.tile[x, y].TileFrameX += (short)addFrameX; + Main.tile[x, y].TileFrameY += (short)addFrameY; if (Main.tile[x - 1, y] != null) RecursiveReplaceFromAstral(checkType, replaceType, x - 1, y, addFrameX, addFrameY); @@ -1140,21 +1140,21 @@ namespace CalamityMod.World { Tile tile = Main.tile[x, y]; - int topMost = tile.frameY <= 54 ? (tile.frameY % 36 == 0 ? y : y - 1) : y; - bool twoTall = tile.frameY <= 54; - bool hanging = tile.frameY <= 18 || tile.frameY == 72; + int topMost = tile.TileFrameY <= 54 ? (tile.TileFrameY % 36 == 0 ? y : y - 1) : y; + bool twoTall = tile.TileFrameY <= 54; + bool hanging = tile.TileFrameY <= 18 || tile.TileFrameY == 72; int yOriginTile = hanging ? topMost - 1 : (twoTall ? topMost + 2 : y + 1); if (Main.tile[x, topMost++] != null) - Main.tile[x, topMost++].type = replaceType; + Main.tile[x, topMost++].TileType = replaceType; if (twoTall) { if (Main.tile[x, topMost] != null) - Main.tile[x, topMost].type = replaceType; + Main.tile[x, topMost].TileType = replaceType; } if (Main.tile[x, yOriginTile] != null) - Main.tile[x, yOriginTile].type = replaceOriginTile; + Main.tile[x, yOriginTile].TileType = replaceOriginTile; } public static bool CheckInEllipse(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false) diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index bbe270a0b1..ba23f40152 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -22,7 +22,7 @@ using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World { @@ -1275,12 +1275,12 @@ namespace CalamityMod.World for (int chestIndex = 0; chestIndex < Main.maxChests; chestIndex++) { Chest chest = Main.chest[chestIndex]; - if (chest != null && Main.tile[chest.x, chest.y].type == TileID.Containers) + if (chest != null && Main.tile[chest.x, chest.y].TileType == TileID.Containers) { - bool isGoldChest = Main.tile[chest.x, chest.y].frameX == 36; - bool isMahoganyChest = Main.tile[chest.x, chest.y].frameX == 8 * 36; - bool isIvyChest = Main.tile[chest.x, chest.y].frameX == 10 * 36; - bool isIceChest = Main.tile[chest.x, chest.y].frameX == 11 * 36; + bool isGoldChest = Main.tile[chest.x, chest.y].TileFrameX == 36; + bool isMahoganyChest = Main.tile[chest.x, chest.y].TileFrameX == 8 * 36; + bool isIvyChest = Main.tile[chest.x, chest.y].TileFrameX == 10 * 36; + bool isIceChest = Main.tile[chest.x, chest.y].TileFrameX == 11 * 36; if (isGoldChest || isMahoganyChest || isIvyChest || isIceChest) { for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++) diff --git a/World/CustomActions.cs b/World/CustomActions.cs index 19781906c4..e102141969 100644 --- a/World/CustomActions.cs +++ b/World/CustomActions.cs @@ -3,7 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World { @@ -23,7 +23,7 @@ namespace CalamityMod.World public override bool Apply(Point origin, int x, int y, params object[] args) { Tile tile = GenBase._tiles[x, y]; - if (tile.active() && Main.tileSolid[tile.type]) + if (tile.active() && Main.tileSolid[tile.TileType]) { _count++; } diff --git a/World/CustomConditions.cs b/World/CustomConditions.cs index 28e5a09f31..624ad047b4 100644 --- a/World/CustomConditions.cs +++ b/World/CustomConditions.cs @@ -1,7 +1,7 @@ using Terraria; using Terraria.ID; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World { @@ -33,7 +33,7 @@ namespace CalamityMod.World public class SolidOrPlatform : GenCondition { - protected override bool CheckValidity(int x, int y) => TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(x, y).type] || WorldGen.SolidTile(x, y); + protected override bool CheckValidity(int x, int y) => TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(x, y).TileType] || WorldGen.SolidTile(x, y); } public class IsNotTouchingAir : GenCondition diff --git a/World/CustomShapes.cs b/World/CustomShapes.cs index a6d3dcb37c..41a50f7123 100644 --- a/World/CustomShapes.cs +++ b/World/CustomShapes.cs @@ -1,7 +1,7 @@ using Microsoft.Xna.Framework; using System; using Terraria; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World { diff --git a/World/CustomTemple.cs b/World/CustomTemple.cs index 548c28f3cb..9b3ebfac27 100644 --- a/World/CustomTemple.cs +++ b/World/CustomTemple.cs @@ -20,7 +20,7 @@ namespace CalamityMod.World int y = WorldGen.genRand.Next((int)Main.rockLayer, Main.maxTilesY - 500); - if (Main.tile[x, y].active() && Main.tile[x, y].type == 60) + if (Main.tile[x, y].active() && Main.tile[x, y].TileType == 60) { success = true; GenNewTemple(x, y); @@ -159,7 +159,7 @@ namespace CalamityMod.World for (int roomPositionY = roomTop; roomPositionY < roomBottom; roomPositionY++) { Main.tile[roomPositionX, roomPositionY].active(true); - Main.tile[roomPositionX, roomPositionY].type = TileID.LihzahrdBrick; + Main.tile[roomPositionX, roomPositionY].TileType = TileID.LihzahrdBrick; Main.tile[roomPositionX, roomPositionY].liquid = 0; Main.tile[roomPositionX, roomPositionY].slope(0); Main.tile[roomPositionX, roomPositionY].halfBrick(false); @@ -179,7 +179,7 @@ namespace CalamityMod.World for (int roomPositionY = roomBounds[i].Y; roomPositionY < roomBounds[i].Y + roomBounds[i].Height; roomPositionY++) { Main.tile[roomPositionX, roomPositionY].active(true); - Main.tile[roomPositionX, roomPositionY].type = TileID.LihzahrdBrick; + Main.tile[roomPositionX, roomPositionY].TileType = TileID.LihzahrdBrick; Main.tile[roomPositionX, roomPositionY].liquid = 0; Main.tile[roomPositionX, roomPositionY].slope(0); Main.tile[roomPositionX, roomPositionY].halfBrick(false); @@ -340,14 +340,14 @@ namespace CalamityMod.World int dy = (int)endPathPosition.Y - yArea; while (dy < endPathPosition.Y + yArea) { - if (Main.tile[(int)endPathPosition.X, dy].wall == WallID.LihzahrdBrickUnsafe || (Main.tile[(int)endPathPosition.X, dy].active() && Main.tile[(int)endPathPosition.X, dy].type == TileID.LihzahrdBrick)) + if (Main.tile[(int)endPathPosition.X, dy].WallType == WallID.LihzahrdBrickUnsafe || (Main.tile[(int)endPathPosition.X, dy].active() && Main.tile[(int)endPathPosition.X, dy].TileType == TileID.LihzahrdBrick)) { success = false; } - if (Main.tile[(int)endPathPosition.X, dy].active() && Main.tile[(int)endPathPosition.X, dy].type == TileID.LihzahrdBrick) + if (Main.tile[(int)endPathPosition.X, dy].active() && Main.tile[(int)endPathPosition.X, dy].TileType == TileID.LihzahrdBrick) { Main.tile[(int)endPathPosition.X, dy].active(false); - Main.tile[(int)endPathPosition.X, dy].wall = WallID.LihzahrdBrickUnsafe; + Main.tile[(int)endPathPosition.X, dy].WallType = WallID.LihzahrdBrickUnsafe; } dy++; } @@ -362,7 +362,7 @@ namespace CalamityMod.World } doorPositionY -= 4; int doorTop = doorPositionY; - while ((Main.tile[doorPositionX, doorTop].active() && Main.tile[doorPositionX, doorTop].type == TileID.LihzahrdBrick) || Main.tile[doorPositionX, doorTop].wall == WallID.LihzahrdBrickUnsafe) + while ((Main.tile[doorPositionX, doorTop].active() && Main.tile[doorPositionX, doorTop].TileType == TileID.LihzahrdBrick) || Main.tile[doorPositionX, doorTop].WallType == WallID.LihzahrdBrickUnsafe) { doorTop--; } @@ -372,7 +372,7 @@ namespace CalamityMod.World for (int dy = doorTop; dy <= doorPositionY; dy++) { Main.tile[dx, dy].active(true); - Main.tile[dx, dy].type = TileID.LihzahrdBrick; + Main.tile[dx, dy].TileType = TileID.LihzahrdBrick; Main.tile[dx, dy].liquid = 0; Main.tile[dx, dy].slope(0); Main.tile[dx, dy].halfBrick(false); @@ -383,7 +383,7 @@ namespace CalamityMod.World for (int dy = doorPositionY - 1; dy < doorPositionY + 3; dy++) { Main.tile[dx, dy].active(false); - Main.tile[dx, dy].wall = WallID.LihzahrdBrickUnsafe; + Main.tile[dx, dy].WallType = WallID.LihzahrdBrickUnsafe; } } for (int dx = doorPositionX - 1; dx <= doorPositionX + 1; dx++) @@ -391,7 +391,7 @@ namespace CalamityMod.World for (int dy = doorPositionY - 5; dy <= doorPositionY + 8; dy++) { Main.tile[dx, dy].active(true); - Main.tile[dx, dy].type = TileID.LihzahrdBrick; + Main.tile[dx, dy].TileType = TileID.LihzahrdBrick; Main.tile[dx, dy].liquid = 0; Main.tile[dx, dy].slope(0); Main.tile[dx, dy].halfBrick(false); @@ -402,7 +402,7 @@ namespace CalamityMod.World for (int dy = doorPositionY; dy < doorPositionY + 3; dy++) { Main.tile[dx, dy].active(false); - Main.tile[dx, dy].wall = WallID.LihzahrdBrickUnsafe; + Main.tile[dx, dy].WallType = WallID.LihzahrdBrickUnsafe; } } @@ -435,7 +435,7 @@ namespace CalamityMod.World { for (int dy2 = dy - 1; dy2 <= dy + 1; dy2++) { - if ((!Main.tile[dx2, dy2].active() || Main.tile[dx2, dy2].type != TileID.LihzahrdBrick) && Main.tile[dx2, dy2].wall != WallID.LihzahrdBrickUnsafe) + if ((!Main.tile[dx2, dy2].active() || Main.tile[dx2, dy2].TileType != TileID.LihzahrdBrick) && Main.tile[dx2, dy2].WallType != WallID.LihzahrdBrickUnsafe) { shouldPlaceWalls = false; break; @@ -444,7 +444,7 @@ namespace CalamityMod.World } if (shouldPlaceWalls) { - Main.tile[dx, dy].wall = WallID.LihzahrdBrickUnsafe; + Main.tile[dx, dy].WallType = WallID.LihzahrdBrickUnsafe; } } } @@ -458,7 +458,7 @@ namespace CalamityMod.World int roomToFillIndex = WorldGen.genRand.Next(totalRooms); int randomPointInRoomX = WorldGen.genRand.Next(roomBounds[roomToFillIndex].X, roomBounds[roomToFillIndex].X + roomBounds[roomToFillIndex].Width); int randomPointInRoomY = WorldGen.genRand.Next(roomBounds[roomToFillIndex].Y, roomBounds[roomToFillIndex].Y + roomBounds[roomToFillIndex].Height); - if (Main.tile[randomPointInRoomX, randomPointInRoomY].wall == 87 && !Main.tile[randomPointInRoomX, randomPointInRoomY].active()) + if (Main.tile[randomPointInRoomX, randomPointInRoomY].WallType == 87 && !Main.tile[randomPointInRoomX, randomPointInRoomY].active()) { bool successPlacingSpikes = false; if (WorldGen.genRand.Next(2) == 0) @@ -476,7 +476,7 @@ namespace CalamityMod.World { for (int dy = randomPointInRoomY - areaToCheck; dy < randomPointInRoomY + areaToCheck; dy++) { - if (Main.tile[dx, dy].active() && Main.tile[dx, dy].type == 10) + if (Main.tile[dx, dy].active() && Main.tile[dx, dy].TileType == 10) { noDoorInWay = false; break; @@ -489,18 +489,18 @@ namespace CalamityMod.World { for (int dy = randomPointInRoomY - areaToCheck; dy < randomPointInRoomY + areaToCheck; dy++) { - if (WorldGen.SolidTile(dx, dy) && Main.tile[dx, dy].type != TileID.WoodenSpikes && !WorldGen.SolidTile(dx, dy - xMoveDirection)) + if (WorldGen.SolidTile(dx, dy) && Main.tile[dx, dy].TileType != TileID.WoodenSpikes && !WorldGen.SolidTile(dx, dy - xMoveDirection)) { - Main.tile[dx, dy].type = TileID.WoodenSpikes; + Main.tile[dx, dy].TileType = TileID.WoodenSpikes; successPlacingSpikes = true; if (yMoveDirection == 0) { - Main.tile[dx, dy - 1].type = TileID.WoodenSpikes; + Main.tile[dx, dy - 1].TileType = TileID.WoodenSpikes; Main.tile[dx, dy - 1].active(true); } else { - Main.tile[dx, dy + 1].type = TileID.WoodenSpikes; + Main.tile[dx, dy + 1].TileType = TileID.WoodenSpikes; Main.tile[dx, dy + 1].active(true); } yMoveDirection++; @@ -533,7 +533,7 @@ namespace CalamityMod.World { for (int dy = randomPointInRoomY - areaToCheck; dy < randomPointInRoomY + areaToCheck; dy++) { - if (Main.tile[dx, dy].active() && Main.tile[dx, dy].type == 10) + if (Main.tile[dx, dy].active() && Main.tile[dx, dy].TileType == 10) { noDoorInWay = false; break; @@ -546,18 +546,18 @@ namespace CalamityMod.World { for (int dy = randomPointInRoomY - areaToCheck; dy < randomPointInRoomY + areaToCheck; dy++) { - if (WorldGen.SolidTile(dx, dy) && Main.tile[dx, dy].type != TileID.WoodenSpikes && !WorldGen.SolidTile(dx - xMoveDirection, dy)) + if (WorldGen.SolidTile(dx, dy) && Main.tile[dx, dy].TileType != TileID.WoodenSpikes && !WorldGen.SolidTile(dx - xMoveDirection, dy)) { - Main.tile[dx, dy].type = TileID.WoodenSpikes; + Main.tile[dx, dy].TileType = TileID.WoodenSpikes; successPlacingSpikes = true; if (yMoveDirection == 0) { - Main.tile[dx - 1, dy].type = TileID.WoodenSpikes; + Main.tile[dx - 1, dy].TileType = TileID.WoodenSpikes; Main.tile[dx - 1, dy].active(true); } else { - Main.tile[dx + 1, dy].type = TileID.WoodenSpikes; + Main.tile[dx + 1, dy].TileType = TileID.WoodenSpikes; Main.tile[dx + 1, dy].active(true); } yMoveDirection++; @@ -637,7 +637,7 @@ namespace CalamityMod.World { Main.tile[dx, dy].active(false); Main.tile[dx, dy].liquid = 0; // Apparently this can indeed happen, and it can interfere with furniture placement. - Main.tile[dx, dy].wall = WallID.LihzahrdBrickUnsafe; + Main.tile[dx, dy].WallType = WallID.LihzahrdBrickUnsafe; } } } @@ -666,7 +666,7 @@ namespace CalamityMod.World { Main.tile[dx, dy].active(false); Main.tile[dx, dy].liquid = 0; // Apparently this can indeed happen, and it can interfere with furniture placement. - Main.tile[dx, dy].wall = WallID.LihzahrdBrickUnsafe; + Main.tile[dx, dy].WallType = WallID.LihzahrdBrickUnsafe; } } } @@ -681,7 +681,7 @@ namespace CalamityMod.World { Main.tile[dx, dy].active(false); Main.tile[dx, dy].liquid = 0; // Apparently this can indeed happen, and it can interfere with furniture placement. - Main.tile[dx, dy].wall = WallID.LihzahrdBrickUnsafe; + Main.tile[dx, dy].WallType = WallID.LihzahrdBrickUnsafe; } } @@ -710,10 +710,10 @@ namespace CalamityMod.World for (int y = roomBottom - height; y <= roomBottom; y++) { Main.tile[roomCenterX - dx, y].active(true); - Main.tile[roomCenterX - dx, y].type = TileID.LihzahrdBrick; + Main.tile[roomCenterX - dx, y].TileType = TileID.LihzahrdBrick; Main.tile[roomCenterX + dx, y].active(true); - Main.tile[roomCenterX + dx, y].type = TileID.LihzahrdBrick; + Main.tile[roomCenterX + dx, y].TileType = TileID.LihzahrdBrick; } } @@ -738,7 +738,7 @@ namespace CalamityMod.World WorldGen.PlaceTile(x, roomBottom - 1, TileID.Tables, style: 9); // Try again if the table failed to place. - if (Main.tile[x, roomBottom - 1].type != TileID.Tables) + if (Main.tile[x, roomBottom - 1].TileType != TileID.Tables) { i--; continue; @@ -763,7 +763,7 @@ namespace CalamityMod.World { int randomPointInRoomX = WorldGen.genRand.Next(templeLeft, templeRight); int randomPointInRoomY = WorldGen.genRand.Next(templeTop, templeBottom); - if (Main.tile[randomPointInRoomX, randomPointInRoomY].wall == WallID.LihzahrdBrickUnsafe && !Main.tile[randomPointInRoomX, randomPointInRoomY].active()) + if (Main.tile[randomPointInRoomX, randomPointInRoomY].WallType == WallID.LihzahrdBrickUnsafe && !Main.tile[randomPointInRoomX, randomPointInRoomY].active()) { if (WorldGen.mayanTrap(randomPointInRoomX, randomPointInRoomY)) { @@ -794,7 +794,7 @@ namespace CalamityMod.World { int randomPointInTempleX = WorldGen.genRand.Next(templeLeft, templeRight); int randomPointInTempleY = WorldGen.genRand.Next(templeTop, templeBottom); - if (Main.tile[randomPointInTempleX, randomPointInTempleY].wall == WallID.LihzahrdBrickUnsafe && + if (Main.tile[randomPointInTempleX, randomPointInTempleY].WallType == WallID.LihzahrdBrickUnsafe && !Main.tile[randomPointInTempleX, randomPointInTempleY].active() && WorldGen.AddBuriedChest(randomPointInTempleX, randomPointInTempleY, ItemID.LihzahrdPowerCell, true, 16)) { @@ -813,7 +813,7 @@ namespace CalamityMod.World placementAttempts++; int randomPointInTempleX = WorldGen.genRand.Next(templeLeft, templeRight); int randomPointInTempleY = WorldGen.genRand.Next(templeTop, templeBottom); - if (Main.tile[randomPointInTempleX, randomPointInTempleY].wall == WallID.LihzahrdBrickUnsafe && !Main.tile[randomPointInTempleX, randomPointInTempleY].active()) + if (Main.tile[randomPointInTempleX, randomPointInTempleY].WallType == WallID.LihzahrdBrickUnsafe && !Main.tile[randomPointInTempleX, randomPointInTempleY].active()) { int statuePlacementPositionY = randomPointInTempleY; while (!Main.tile[randomPointInTempleX, statuePlacementPositionY].active()) @@ -828,7 +828,7 @@ namespace CalamityMod.World if (statuePlacementPositionY <= templeBottom) { WorldGen.PlaceTile(randomPointInTempleX, statuePlacementPositionY, TileID.Statues, true, false, -1, WorldGen.genRand.Next(43, 46)); - if (Main.tile[randomPointInTempleX, statuePlacementPositionY].type == TileID.Statues) + if (Main.tile[randomPointInTempleX, statuePlacementPositionY].TileType == TileID.Statues) { totalStatuesToPlace--; } @@ -844,7 +844,7 @@ namespace CalamityMod.World placementAttempts++; int randomPointInTempleX = WorldGen.genRand.Next(templeLeft, templeRight); int randomPointInTempleY = WorldGen.genRand.Next(templeTop, templeBottom); - if (Main.tile[randomPointInTempleX, randomPointInTempleY].wall == WallID.LihzahrdBrickUnsafe && !Main.tile[randomPointInTempleX, randomPointInTempleY].active()) + if (Main.tile[randomPointInTempleX, randomPointInTempleY].WallType == WallID.LihzahrdBrickUnsafe && !Main.tile[randomPointInTempleX, randomPointInTempleY].active()) { int furniturePlacementPositionY = randomPointInTempleY; while (!Main.tile[randomPointInTempleX, furniturePlacementPositionY].active()) @@ -862,21 +862,21 @@ namespace CalamityMod.World { case 0: WorldGen.PlaceTile(randomPointInTempleX, furniturePlacementPositionY, TileID.WorkBenches, true, false, -1, 10); - if (Main.tile[randomPointInTempleX, furniturePlacementPositionY].type == TileID.WorkBenches) + if (Main.tile[randomPointInTempleX, furniturePlacementPositionY].TileType == TileID.WorkBenches) { totalFurnitureElementsToPlace--; } break; case 1: WorldGen.PlaceTile(randomPointInTempleX, furniturePlacementPositionY, TileID.Tables, true, false, -1, 9); - if (Main.tile[randomPointInTempleX, furniturePlacementPositionY].type == TileID.Tables) + if (Main.tile[randomPointInTempleX, furniturePlacementPositionY].TileType == TileID.Tables) { totalFurnitureElementsToPlace--; } break; case 2: WorldGen.PlaceTile(randomPointInTempleX, furniturePlacementPositionY, TileID.Chairs, true, false, -1, 12); - if (Main.tile[randomPointInTempleX, furniturePlacementPositionY].type == TileID.Chairs) + if (Main.tile[randomPointInTempleX, furniturePlacementPositionY].TileType == TileID.Chairs) { totalFurnitureElementsToPlace--; } @@ -905,16 +905,16 @@ namespace CalamityMod.World int framedAlterPositionX = alterPositionX + i; int framedAlterPositionY = alterPositionY + j; Main.tile[framedAlterPositionX, framedAlterPositionY].active(true); - Main.tile[framedAlterPositionX, framedAlterPositionY].type = TileID.LihzahrdAltar; - Main.tile[framedAlterPositionX, framedAlterPositionY].frameX = (short)(i * 18); - Main.tile[framedAlterPositionX, framedAlterPositionY].frameY = (short)(j * 18); + Main.tile[framedAlterPositionX, framedAlterPositionY].TileType = TileID.LihzahrdAltar; + Main.tile[framedAlterPositionX, framedAlterPositionY].TileFrameX = (short)(i * 18); + Main.tile[framedAlterPositionX, framedAlterPositionY].TileFrameY = (short)(j * 18); } // Ensure that the tiles below the altar are active and valid. Main.tile[i, alterPositionY + 2].active(true); Main.tile[i, alterPositionY + 2].slope(0); Main.tile[i, alterPositionY + 2].halfBrick(false); - Main.tile[i, alterPositionY + 2].type = TileID.LihzahrdBrick; + Main.tile[i, alterPositionY + 2].TileType = TileID.LihzahrdBrick; } } } diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index 406527baae..03d96019a2 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -34,7 +34,7 @@ namespace CalamityMod.World "OvergrownLabTile" }; foreach (string tileName in redemptionAvoidTiles) - avoid.Add(mor.TileType(tileName)); + avoid.Add(mor.Find(tileName).Type); } otherModTilesToAvoid = avoid.ToArray(); @@ -50,21 +50,21 @@ namespace CalamityMod.World Tile tile = CalamityUtils.ParanoidTileRetrieval(placementPoint.X, placementPoint.Y); if (tile.lava() && careAboutLava) return true; - if (tile.type == TileID.BlueDungeonBrick || - tile.type == TileID.GreenDungeonBrick || - tile.type == TileID.PinkDungeonBrick) + if (tile.TileType == TileID.BlueDungeonBrick || + tile.TileType == TileID.GreenDungeonBrick || + tile.TileType == TileID.PinkDungeonBrick) { return true; } - if (tile.type == TileID.LihzahrdBrick || - tile.wall == WallID.LihzahrdBrickUnsafe) + if (tile.TileType == TileID.LihzahrdBrick || + tile.WallType == WallID.LihzahrdBrickUnsafe) { return true; } - if (tile.type == TileID.Crimstone || - tile.wall == WallID.CrimstoneUnsafe || - tile.type == TileID.Ebonstone || - tile.wall == WallID.EbonstoneUnsafe) + if (tile.TileType == TileID.Crimstone || + tile.WallType == WallID.CrimstoneUnsafe || + tile.TileType == TileID.Ebonstone || + tile.WallType == WallID.EbonstoneUnsafe) { return true; } @@ -74,10 +74,10 @@ namespace CalamityMod.World // // Avoid Thorium's Blood Chamber (where you summon Viscount). This is done separately because it uses vanilla tiles. - if (tile.type == TileID.StoneSlab || tile.wall == WallID.StoneSlab) + if (tile.TileType == TileID.StoneSlab || tile.WallType == WallID.StoneSlab) return true; // Avoid all other registered modded tiles to avoid. - return otherModTilesToAvoid.Any(id => tile.type == id); + return otherModTilesToAvoid.Any(id => tile.TileType == id); } #region Workshop @@ -421,7 +421,7 @@ namespace CalamityMod.World Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); if (tile.active()) { - if (tile.type == TileID.SnowBlock || tile.type == TileID.IceBlock) + if (tile.TileType == TileID.SnowBlock || tile.TileType == TileID.IceBlock) iceTilesInArea++; activeTilesInArea++; } @@ -501,7 +501,7 @@ namespace CalamityMod.World canGenerateInLocation = false; if (tile.active()) { - if (tile.type == TileID.Mud || tile.type == TileID.JungleGrass) + if (tile.TileType == TileID.Mud || tile.TileType == TileID.JungleGrass) jungleTilesInArea++; activeTilesInArea++; } @@ -553,7 +553,7 @@ namespace CalamityMod.World Mod thorium = CalamityMod.Instance.thorium; if (thorium != null) - contents.Add(new ChestItem(thorium.ItemType("MarineKelpPlanterBox"), WorldGen.genRand.Next(5, 9 + 1))); + contents.Add(new ChestItem(thorium.Find("MarineKelpPlanterBox").Type, WorldGen.genRand.Next(5, 9 + 1))); if (!hasPlacedLogAndSchematic) { diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs index 149fade501..4072602976 100644 --- a/World/MiscWorldgenRoutines.cs +++ b/World/MiscWorldgenRoutines.cs @@ -14,7 +14,7 @@ using System.Reflection; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World { @@ -46,7 +46,7 @@ namespace CalamityMod.World attempts++; int x = WorldGen.genRand.Next(MinX, MaxX); int y = WorldGen.genRand.Next((int)Main.worldSurface, MaxY); - if (Main.wallDungeon[Main.tile[x, y].wall] && !Main.tile[x, y].active()) + if (Main.wallDungeon[Main.tile[x, y].WallType] && !Main.tile[x, y].active()) chest = AddChestWithLoot(x, y, (ushort)ChestTypes[i], tileStyle: ChestStyles[i]); } @@ -184,9 +184,9 @@ namespace CalamityMod.World { for (int y = 0; y < Main.maxTilesY; y++) { - if (Main.tile[x, y] != null && Main.tile[x, y].type == TileID.LargePiles) + if (Main.tile[x, y] != null && Main.tile[x, y].TileType == TileID.LargePiles) { - if ((Main.tile[x, y].frameX == 18 && Main.tile[x, y].frameY == 0) || (Main.tile[x, y].frameX == 45 && Main.tile[x, y].frameY == 0)) + if ((Main.tile[x, y].TileFrameX == 18 && Main.tile[x, y].TileFrameY == 0) || (Main.tile[x, y].TileFrameX == 45 && Main.tile[x, y].TileFrameY == 0)) { if (WorldGen.genRand.Next(3) == 0) { @@ -295,7 +295,7 @@ namespace CalamityMod.World num6 = l; } Main.tile[k, l].active(true); - Main.tile[k, l].type = (ushort)ModContent.TileType(); + Main.tile[k, l].TileType = (ushort)ModContent.TileType(); WorldGen.SquareTileFrame(k, l, true); } } @@ -349,7 +349,7 @@ namespace CalamityMod.World if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) { Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; + Main.tile[n, num17].TileType = (ushort)num16; WorldGen.SquareTileFrame(n, num17, true); } } @@ -394,7 +394,7 @@ namespace CalamityMod.World while (num23 < num4) { int num24 = num6; - while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) + while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].TileType != 0) && num23 < num4) { num24--; if (num24 < num5) @@ -418,7 +418,7 @@ namespace CalamityMod.World float num29 = (float)(Math.Abs(num28 - num24) * 2); if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) { - Main.tile[num27, num28].type = (ushort)num26; + Main.tile[num27, num28].TileType = (ushort)num26; WorldGen.SquareTileFrame(num27, num28, true); } } @@ -434,28 +434,28 @@ namespace CalamityMod.World { num35++; } - if (num35 < num6 && Main.tile[num34, num35 + 1].type == (ushort)ModContent.TileType()) + if (num35 < num6 && Main.tile[num34, num35 + 1].TileType == (ushort)ModContent.TileType()) { if (WorldGen.genRand.Next(10) == 0) { int num36 = WorldGen.genRand.Next(1, 3); for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) { - if (Main.tile[num37, num35].type == (ushort)ModContent.TileType()) + if (Main.tile[num37, num35].TileType == (ushort)ModContent.TileType()) { Main.tile[num37, num35].active(false); Main.tile[num37, num35].liquid = 255; Main.tile[num37, num35].lava(false); WorldGen.SquareTileFrame(num34, num35, true); } - if (Main.tile[num37, num35 + 1].type == (ushort)ModContent.TileType()) + if (Main.tile[num37, num35 + 1].TileType == (ushort)ModContent.TileType()) { Main.tile[num37, num35 + 1].active(false); Main.tile[num37, num35 + 1].liquid = 255; Main.tile[num37, num35 + 1].lava(false); WorldGen.SquareTileFrame(num34, num35 + 1, true); } - if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (ushort)ModContent.TileType()) + if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].TileType == (ushort)ModContent.TileType()) { Main.tile[num37, num35 + 2].active(false); Main.tile[num37, num35 + 2].liquid = 255; @@ -526,8 +526,8 @@ namespace CalamityMod.World { Main.tile[l, m].active(true); Main.tile[l, m].liquid = 0; - Main.tile[l, m].type = type; - Main.tile[l, m].wall = 0; + Main.tile[l, m].TileType = type; + Main.tile[l, m].WallType = 0; Main.tile[l, m].halfBrick(false); Main.tile[l, m].slope(0); } @@ -557,10 +557,10 @@ namespace CalamityMod.World { for (int num8 = num6; num8 < num7; num8++) { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].WallType == 0) { Main.tile[n, num8].active(false); - Main.tile[n, num8].wall = wall; + Main.tile[n, num8].WallType = wall; } } } @@ -578,8 +578,8 @@ namespace CalamityMod.World { Main.tile[num9, num12].active(true); Main.tile[num9, num12].liquid = 0; - Main.tile[num9, num12].type = type; - Main.tile[num9, num12].wall = 0; + Main.tile[num9, num12].TileType = type; + Main.tile[num9, num12].WallType = 0; Main.tile[num9, num12].halfBrick(false); Main.tile[num9, num12].slope(0); } @@ -588,9 +588,9 @@ namespace CalamityMod.World WorldGen.PlaceTile(num22, num7 - 1, ModContent.TileType(), true, false, -1); //table WorldGen.PlaceTile(num22 - 2, num7 - 1, ModContent.TileType(), true, false, 0); //chair Tile tile = Main.tile[num22 - 2, num7 - 1]; - tile.frameX += 18; + tile.TileFrameX += 18; Tile tile2 = Main.tile[num22 - 2, num7 - 2]; - tile2.frameX += 18; + tile2.TileFrameX += 18; WorldGen.PlaceTile(num22 + 2, num7 - 1, ModContent.TileType(), true, false, 0); //chair } #endregion @@ -845,30 +845,30 @@ namespace CalamityMod.World { if (Main.tile[x, y] != null) { - if (Main.tile[x, y].type == TileID.Emerald || Main.tile[x, y].type == TileID.Sapphire) - Main.tile[x, y].type = TileID.Diamond; - else if (Main.tile[x, y].type == TileID.Topaz || Main.tile[x, y].type == TileID.Amethyst) - Main.tile[x, y].type = TileID.Ruby; + if (Main.tile[x, y].TileType == TileID.Emerald || Main.tile[x, y].TileType == TileID.Sapphire) + Main.tile[x, y].TileType = TileID.Diamond; + else if (Main.tile[x, y].TileType == TileID.Topaz || Main.tile[x, y].TileType == TileID.Amethyst) + Main.tile[x, y].TileType = TileID.Ruby; } } else if (y > verticalStartFactor_Layer2) { if (Main.tile[x, y] != null) { - if (Main.tile[x, y].type == TileID.Diamond || Main.tile[x, y].type == TileID.Ruby) - Main.tile[x, y].type = TileID.Emerald; - else if (Main.tile[x, y].type == TileID.Topaz || Main.tile[x, y].type == TileID.Amethyst) - Main.tile[x, y].type = TileID.Sapphire; + if (Main.tile[x, y].TileType == TileID.Diamond || Main.tile[x, y].TileType == TileID.Ruby) + Main.tile[x, y].TileType = TileID.Emerald; + else if (Main.tile[x, y].TileType == TileID.Topaz || Main.tile[x, y].TileType == TileID.Amethyst) + Main.tile[x, y].TileType = TileID.Sapphire; } } else if (y > verticalStartFactor_Layer1) { if (Main.tile[x, y] != null) { - if (Main.tile[x, y].type == TileID.Diamond || Main.tile[x, y].type == TileID.Ruby) - Main.tile[x, y].type = TileID.Topaz; - else if (Main.tile[x, y].type == TileID.Emerald || Main.tile[x, y].type == TileID.Sapphire) - Main.tile[x, y].type = TileID.Amethyst; + if (Main.tile[x, y].TileType == TileID.Diamond || Main.tile[x, y].TileType == TileID.Ruby) + Main.tile[x, y].TileType = TileID.Topaz; + else if (Main.tile[x, y].TileType == TileID.Emerald || Main.tile[x, y].TileType == TileID.Sapphire) + Main.tile[x, y].TileType = TileID.Amethyst; } } } diff --git a/World/Planets/GrassPlanet.cs b/World/Planets/GrassPlanet.cs index 97cc474fd1..5c0ba02e13 100644 --- a/World/Planets/GrassPlanet.cs +++ b/World/Planets/GrassPlanet.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using Terraria; using Terraria.GameContent.Generation; using Terraria.ID; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World.Planets { diff --git a/World/Planets/HeartPlanet.cs b/World/Planets/HeartPlanet.cs index 9138468659..a5e2fcadca 100644 --- a/World/Planets/HeartPlanet.cs +++ b/World/Planets/HeartPlanet.cs @@ -1,7 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World.Planets { diff --git a/World/Planets/LuminitePlanet.cs b/World/Planets/LuminitePlanet.cs index 8993b6589a..04d295cba9 100644 --- a/World/Planets/LuminitePlanet.cs +++ b/World/Planets/LuminitePlanet.cs @@ -3,7 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World.Planets { diff --git a/World/Planets/LuminitePlanet2.cs b/World/Planets/LuminitePlanet2.cs index 6ef92addaf..d4dca0d9b4 100644 --- a/World/Planets/LuminitePlanet2.cs +++ b/World/Planets/LuminitePlanet2.cs @@ -3,7 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World.Planets { diff --git a/World/Planets/MainPlanet.cs b/World/Planets/MainPlanet.cs index dc3332ea30..2006a70d89 100644 --- a/World/Planets/MainPlanet.cs +++ b/World/Planets/MainPlanet.cs @@ -7,7 +7,7 @@ using System.Linq; using Terraria; using Terraria.GameContent.Generation; using Terraria.ID; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World.Planets { diff --git a/World/Planets/MudPlanet.cs b/World/Planets/MudPlanet.cs index 4cfcb6194f..7fe4951680 100644 --- a/World/Planets/MudPlanet.cs +++ b/World/Planets/MudPlanet.cs @@ -5,7 +5,7 @@ using Terraria; using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World.Planets { diff --git a/World/Planets/Planetoid.cs b/World/Planets/Planetoid.cs index d0a1ac8823..fb1fdf77f3 100644 --- a/World/Planets/Planetoid.cs +++ b/World/Planets/Planetoid.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World.Planets { @@ -81,11 +81,11 @@ namespace CalamityMod.World.Planets { for (int j = area.Top; j < area.Bottom; j++) { - if (Main.tile[i, j].type == TileID.Cloud || Main.tile[i, j].type == TileID.RainCloud || Main.tile[i, j].type == TileID.Sunplate) + if (Main.tile[i, j].TileType == TileID.Cloud || Main.tile[i, j].TileType == TileID.RainCloud || Main.tile[i, j].TileType == TileID.Sunplate) return false; if (varia != null && - (Main.tile[i, j].type == varia.TileType("StarplateBrick") || Main.tile[i, j].type == varia.TileType("ForgottenCloud"))) + (Main.tile[i, j].TileType == varia.Find("StarplateBrick") .Type|| Main.tile[i, j].TileType == varia.Find("ForgottenCloud").Type)) { return false; } diff --git a/World/SulphurousSea.cs b/World/SulphurousSea.cs index c5dcec1700..d584867922 100644 --- a/World/SulphurousSea.cs +++ b/World/SulphurousSea.cs @@ -11,7 +11,7 @@ using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World { @@ -168,7 +168,7 @@ namespace CalamityMod.World wall = generateSand ? sandWallType : sandstoneWallType }; if (y - YStart - 6 < wallBoundAtPosition(xRatio * MathHelper.TwoPi * 4f)) - Main.tile[trueX, y].wall = WallID.None; + Main.tile[trueX, y].WallType = WallID.None; Main.tile[trueX, y].active(true); } @@ -205,7 +205,7 @@ namespace CalamityMod.World int lakeDepth = (int)(Math.Sin(MathHelper.Min((1f - xRatio) * MathHelper.PiOver2 * lakeSteepness * 1.2f, MathHelper.PiOver2)) * lakeDepthMax); for (int y = YStart; y <= YStart + lakeDepth; y++) { - ushort oldWall = Main.tile[trueX, y].wall; + ushort oldWall = Main.tile[trueX, y].WallType; Main.tile[trueX, y] = new Tile() { wall = oldWall, @@ -240,7 +240,7 @@ namespace CalamityMod.World } if (perlinAverage > PerlinThreshold * WorldGen.genRand.NextFloat(1f - PerlinNoiseMax, 1f + PerlinNoiseMax)) { - ushort oldWall = Main.tile[trueX, y].wall; + ushort oldWall = Main.tile[trueX, y].WallType; Main.tile[trueX, y] = new Tile() { wall = oldWall, @@ -277,10 +277,10 @@ namespace CalamityMod.World { if (WorldGen.InWorld(trueX + dx, y + dy)) { - if (CalamityUtils.ParanoidTileRetrieval(trueX + dx, y + dy).type != (ushort)ModContent.TileType() && - SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(trueX + dx, y + dy).type)) + if (CalamityUtils.ParanoidTileRetrieval(trueX + dx, y + dy).TileType != (ushort)ModContent.TileType() && + SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(trueX + dx, y + dy).TileType)) { - Main.tile[trueX + dx, y + dy].type = (ushort)ModContent.TileType(); + Main.tile[trueX + dx, y + dy].TileType = (ushort)ModContent.TileType(); } } } @@ -387,7 +387,7 @@ namespace CalamityMod.World int extraHeight = WorldGen.genRand.Next(0, 1 + 1); for (int y2 = 0; y2 <= extraHeight; y2++) { - Main.tile[x + dx, y + dy - y2].type = (ushort)ModContent.TileType(); + Main.tile[x + dx, y + dy - y2].TileType = (ushort)ModContent.TileType(); Main.tile[x + dx, y + dy - y2].slope(0); Main.tile[x + dx, y + dy - y2].halfBrick(false); Main.tile[x + dx, y + dy - y2].active(true); @@ -502,7 +502,7 @@ namespace CalamityMod.World { if (WorldGen.SolidTile(trueX, y + 1) && WorldGen.SolidTile(trueX + 1, y + 1) && - SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(trueX, y + 1).type) && + SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(trueX, y + 1).TileType) && WorldGen.genRand.NextBool(3) && Math.Abs(trueX - previousX) >= ColumnMinDistanceX) { @@ -527,7 +527,7 @@ namespace CalamityMod.World yFrame = 0; if (Main.tile[trueX, y - dy] is null) Main.tile[trueX, y - dy] = new Tile(); - ushort oldWall = Main.tile[trueX, y - dy].wall; + ushort oldWall = Main.tile[trueX, y - dy].WallType; Main.tile[trueX, y - dy] = new Tile { type = (ushort)ModContent.TileType(), @@ -541,7 +541,7 @@ namespace CalamityMod.World if (Main.tile[trueX + 1, y - dy] is null) Main.tile[trueX + 1, y - dy] = new Tile(); - oldWall = Main.tile[trueX + 1, y - dy].wall; + oldWall = Main.tile[trueX + 1, y - dy].WallType; Main.tile[trueX + 1, y - dy] = new Tile { type = (ushort)ModContent.TileType(), @@ -592,9 +592,9 @@ namespace CalamityMod.World type++; int height = heightFromType(type); - PlaceStalactite(trueX, y, height, (ushort)CalamityMod.Instance.TileType($"SulphurousStalactite{type}")); + PlaceStalactite(trueX, y, height, (ushort)CalamityMod.Instance.Find($"SulphurousStalactite{type}").Type); if (WorldGen.SolidTile(trueX, y + dy + 1)) - PlaceStalacmite(trueX, y + dy, height, (ushort)CalamityMod.Instance.TileType($"SulphurousStalacmite{type}")); + PlaceStalacmite(trueX, y + dy, height, (ushort)CalamityMod.Instance.Find($"SulphurousStalacmite{type}").Type); } } } @@ -623,7 +623,7 @@ namespace CalamityMod.World { Main.tile[i, y + 1] = new Tile(); } - if (!Main.tile[i, y + 1].nactive() || Main.tile[i, y + 1].halfBrick() || Main.tile[i, y + 1].slope() != 0 || !Main.tileSolid[Main.tile[i, y + 1].type]) + if (!Main.tile[i, y + 1].nactive() || Main.tile[i, y + 1].halfBrick() || Main.tile[i, y + 1].slope() != 0 || !Main.tileSolid[Main.tile[i, y + 1].TileType]) { canGenerate = false; } @@ -642,7 +642,7 @@ namespace CalamityMod.World { for (int dy = 0; dy < height; dy++) { - ushort oldWall = Main.tile[x, y + dy].wall; + ushort oldWall = Main.tile[x, y + dy].WallType; Main.tile[x, y + dy] = new Tile { wall = oldWall, @@ -656,7 +656,7 @@ namespace CalamityMod.World { for (int dy = height - 1; dy > 0; dy--) { - ushort oldWall = Main.tile[x, y + dy].wall; + ushort oldWall = Main.tile[x, y + dy].WallType; Main.tile[x, y - dy] = new Tile { type = type, @@ -695,7 +695,7 @@ namespace CalamityMod.World if (WorldGen.InWorld(x, y)) { if (!CalamityUtils.ParanoidTileRetrieval(x, y).active() && - SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(x, y + 1).type) && + SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(x, y + 1).TileType) && CalamityUtils.ParanoidTileRetrieval(x, y + 1).active()) { chest = MiscWorldgenRoutines.AddChestWithLoot(x, y, (ushort)ModContent.TileType()); @@ -754,7 +754,7 @@ namespace CalamityMod.World int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; for (int y = YStart - 140; y < YStart + 80; y++) { - int type = CalamityUtils.ParanoidTileRetrieval(trueX, y).type; + int type = CalamityUtils.ParanoidTileRetrieval(trueX, y).TileType; if (YStartWhitelist.Contains(type) || OtherTilesForSulphSeaToDestroy.Contains(type)) { @@ -762,9 +762,9 @@ namespace CalamityMod.World Main.tile[trueX, y] = new Tile(); Main.tile[trueX, y].active(false); } - if (WallsForSulphSeaToDestroy.Contains(Main.tile[trueX, y].wall)) + if (WallsForSulphSeaToDestroy.Contains(Main.tile[trueX, y].WallType)) { - Main.tile[trueX, y].wall = 0; + Main.tile[trueX, y].WallType = 0; } } } @@ -811,9 +811,9 @@ namespace CalamityMod.World Tile tileAtEdge = CalamityUtils.ParanoidTileRetrieval(determinedPoint.X, determinedPoint.Y); // Extend outward to encompass some of the desert, if there is one. - if (tileAtEdge.type == TileID.Sand || - tileAtEdge.type == TileID.Ebonsand || - tileAtEdge.type == TileID.Crimsand) + if (tileAtEdge.TileType == TileID.Sand || + tileAtEdge.TileType == TileID.Ebonsand || + tileAtEdge.TileType == TileID.Crimsand) { beachWidth += 85; } @@ -826,18 +826,18 @@ namespace CalamityMod.World for (int y = YStart - 40; y < YStart + depth; y++) { Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(trueX, y); - if (tileAtPosition.active() && ValidBeachDestroyTiles.Contains(tileAtPosition.type)) + if (tileAtPosition.active() && ValidBeachDestroyTiles.Contains(tileAtPosition.TileType)) { // Kill trees manually so that no leftover tiles are present. - if (Main.tile[trueX, y].type == TileID.Trees) + if (Main.tile[trueX, y].TileType == TileID.Trees) WorldGen.KillTile(trueX, y); else Main.tile[trueX, y].active(false); } - else if (tileAtPosition.active() && ValidBeachCovertTiles.Contains(tileAtPosition.type)) + else if (tileAtPosition.active() && ValidBeachCovertTiles.Contains(tileAtPosition.TileType)) { - Main.tile[trueX, y].type = (ushort)ModContent.TileType(); + Main.tile[trueX, y].TileType = (ushort)ModContent.TileType(); } } } @@ -990,13 +990,13 @@ namespace CalamityMod.World WorldUtils.Find(new Point(xCheckPosition, (int)WorldGen.worldSurfaceLow - 20), searchCondition, out determinedPoint); xCheckPosition += CalamityWorld.abyssSide.ToDirectionInt(); } - while (CalamityUtils.ParanoidTileRetrieval(determinedPoint.X, determinedPoint.Y).type == TileID.Ebonstone); + while (CalamityUtils.ParanoidTileRetrieval(determinedPoint.X, determinedPoint.Y).TileType == TileID.Ebonstone); YStart = determinedPoint.Y; } public static void GrowSaplingImmediately(int i, int j) { int trueStartingPositionY = j; - while (TileLoader.IsSapling(Main.tile[i, trueStartingPositionY].type)) + while (TileLoader.IsSapling(Main.tile[i, trueStartingPositionY].TileType)) { trueStartingPositionY++; } @@ -1006,7 +1006,7 @@ namespace CalamityMod.World { return; } - if (tileAbovePosition.wall != 0) + if (tileAbovePosition.WallType != 0) { return; } @@ -1024,16 +1024,16 @@ namespace CalamityMod.World if (k == 0) { tileAtPosition.active(true); - tileAtPosition.type = TileID.PalmTree; - tileAtPosition.frameX = 66; - tileAtPosition.frameY = 0; + tileAtPosition.TileType = TileID.PalmTree; + tileAtPosition.TileFrameX = 66; + tileAtPosition.TileFrameY = 0; } else if (k == treeHeight - 1) { tileAtPosition.active(true); - tileAtPosition.type = TileID.PalmTree; - tileAtPosition.frameX = (short)(22 * WorldGen.genRand.Next(4, 7)); - tileAtPosition.frameY = frameY; + tileAtPosition.TileType = TileID.PalmTree; + tileAtPosition.TileFrameX = (short)(22 * WorldGen.genRand.Next(4, 7)); + tileAtPosition.TileFrameY = frameY; } else { @@ -1047,9 +1047,9 @@ namespace CalamityMod.World } } tileAtPosition.active(true); - tileAtPosition.type = TileID.PalmTree; - tileAtPosition.frameX = (short)(22 * WorldGen.genRand.Next(0, 3)); - tileAtPosition.frameY = frameY; + tileAtPosition.TileType = TileID.PalmTree; + tileAtPosition.TileFrameX = (short)(22 * WorldGen.genRand.Next(0, 3)); + tileAtPosition.TileFrameY = frameY; } } WorldGen.RangeFrame(i - 2, trueStartingPositionY - treeHeight - 1, i + 2, trueStartingPositionY + 1); diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 388ae8fe23..7e4547ad93 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using Terraria; using Terraria.ModLoader; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World { @@ -242,7 +242,7 @@ namespace CalamityMod.World if (num10 > 3.5f) //Adjust num10 for all cases if you want different tile frequencies; higher is less frequent, lower is more frequent { tile.ClearEverything(); - tile.wall = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); tile.liquid = 192; if (num4 % 15 == 2) { @@ -254,7 +254,7 @@ namespace CalamityMod.World } else if (num10 > 1.8f) { - tile.wall = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); tile.liquid = 192; if (!flag || tile.active()) { @@ -274,7 +274,7 @@ namespace CalamityMod.World Tile.SmoothSlope(num6, num7, true); tile.liquid = 0; } - tile.wall = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } else if (num10 > 0.25f) { @@ -286,12 +286,12 @@ namespace CalamityMod.World tile.ResetToType((ushort)ModContent.TileType()); tile.active(true); Tile.SmoothSlope(num6, num7, true); - tile.wall = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); tile.liquid = 0; } else { - tile.wall = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); tile.liquid = 192; } } @@ -438,9 +438,9 @@ namespace CalamityMod.World Tile tile = Main.tile[num3, num4]; Tile testTile = Main.tile[num3, num4 + 1]; Tile testTile2 = Main.tile[num3, num4 + 2]; - if (tile.type == ModContent.TileType() && (!WorldGen.SolidTile(testTile) || !WorldGen.SolidTile(testTile2))) //Tile variation + if (tile.TileType == ModContent.TileType() && (!WorldGen.SolidTile(testTile) || !WorldGen.SolidTile(testTile2))) //Tile variation { - tile.type = (ushort)ModContent.TileType(); + tile.TileType = (ushort)ModContent.TileType(); } } } @@ -453,7 +453,7 @@ namespace CalamityMod.World Tile tile2 = Main.tile[num5, num6]; if (tile2 is null) continue; - if (tile2.active() && (tile2.type == ModContent.TileType() || tile2.type == ModContent.TileType())) + if (tile2.active() && (tile2.TileType == ModContent.TileType() || tile2.TileType == ModContent.TileType())) { bool flag = true; for (int m = -1; m >= -3; m--) @@ -491,23 +491,23 @@ namespace CalamityMod.World break; } } - if (tile2.type == ModContent.TileType() || (tile2.type == ModContent.TileType() && WorldGen.genRand.Next(8) == 0)) + if (tile2.TileType == ModContent.TileType() || (tile2.TileType == ModContent.TileType() && WorldGen.genRand.Next(8) == 0)) { if (flag3 ^ flag4) { if (tile2.slope() == 0 && !tile2.halfBrick()) { Tile tile3 = Main.tile[num5 + (flag3 ? -1 : 1), num6]; - tile3.type = (ushort)ModContent.TileType(); - if (Main.tile[num5 - 1, num6].type == ModContent.TileType()) + tile3.TileType = (ushort)ModContent.TileType(); + if (Main.tile[num5 - 1, num6].TileType == ModContent.TileType()) { - Main.tile[num5 - 1, num6].frameY = (short)(2 * 18); + Main.tile[num5 - 1, num6].TileFrameY = (short)(2 * 18); } - else if (Main.tile[num5 + 1, num6].type == ModContent.TileType()) + else if (Main.tile[num5 + 1, num6].TileType == ModContent.TileType()) { - Main.tile[num5 + 1, num6].frameY = (short)(3 * 18); + Main.tile[num5 + 1, num6].TileFrameY = (short)(3 * 18); } - tile3.frameX = (short)(WorldGen.genRand.Next(18) * 18); + tile3.TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); tile3.active(true); } } @@ -516,16 +516,16 @@ namespace CalamityMod.World if (tile2.slope() == 0 && !tile2.halfBrick()) { Tile tile3 = Main.tile[num5, num6 + (flag ? -1 : 1)]; - tile3.type = (ushort)ModContent.TileType(); - if (Main.tile[num5, num6 - 1].type == ModContent.TileType()) + tile3.TileType = (ushort)ModContent.TileType(); + if (Main.tile[num5, num6 - 1].TileType == ModContent.TileType()) { - Main.tile[num5, num6 - 1].frameY = (short)(0 * 18); + Main.tile[num5, num6 - 1].TileFrameY = (short)(0 * 18); } - else if (Main.tile[num5, num6 + 1].type == ModContent.TileType()) + else if (Main.tile[num5, num6 + 1].TileType == ModContent.TileType()) { - Main.tile[num5, num6 + 1].frameY = (short)(1 * 18); + Main.tile[num5, num6 + 1].TileFrameY = (short)(1 * 18); } - tile3.frameX = (short)(WorldGen.genRand.Next(18) * 18); + tile3.TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); tile3.active(true); } } @@ -533,7 +533,7 @@ namespace CalamityMod.World } if (!tile2.active()) { - if (tile2.wall == ModContent.WallType() || tile2.wall == ModContent.WallType()) + if (tile2.WallType == ModContent.WallType() || tile2.WallType == ModContent.WallType()) { if (WorldGen.genRand.Next(5) == 0) { @@ -619,27 +619,27 @@ namespace CalamityMod.World } if (WorldGen.SolidTile(x, y - 1) && !Main.tile[x, y].active() && !Main.tile[x, y + 1].active()) { - if (Main.tile[x, y - 1].type == (ushort)ModContent.TileType()) + if (Main.tile[x, y - 1].TileType == (ushort)ModContent.TileType()) { if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y + 2].active()) { int num2 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y].type = type; + Main.tile[x, y].TileType = type; Main.tile[x, y].active(true); - Main.tile[x, y].frameX = (short)num2; - Main.tile[x, y].frameY = 72; + Main.tile[x, y].TileFrameX = (short)num2; + Main.tile[x, y].TileFrameY = 72; } else { int num3 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y].type = type; + Main.tile[x, y].TileType = type; Main.tile[x, y].active(true); - Main.tile[x, y].frameX = (short)num3; - Main.tile[x, y].frameY = 0; - Main.tile[x, y + 1].type = type; + Main.tile[x, y].TileFrameX = (short)num3; + Main.tile[x, y].TileFrameY = 0; + Main.tile[x, y + 1].TileType = type; Main.tile[x, y + 1].active(true); - Main.tile[x, y + 1].frameX = (short)num3; - Main.tile[x, y + 1].frameY = 18; + Main.tile[x, y + 1].TileFrameX = (short)num3; + Main.tile[x, y + 1].TileFrameY = 18; } } } @@ -647,27 +647,27 @@ namespace CalamityMod.World { if (WorldGen.SolidTile(x, y + 1) && !Main.tile[x, y].active() && !Main.tile[x, y - 1].active()) { - if (Main.tile[x, y + 1].type == (ushort)ModContent.TileType()) + if (Main.tile[x, y + 1].TileType == (ushort)ModContent.TileType()) { if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y - 2].active()) { int num13 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y].type = type; + Main.tile[x, y].TileType = type; Main.tile[x, y].active(true); - Main.tile[x, y].frameX = (short)num13; - Main.tile[x, y].frameY = 90; + Main.tile[x, y].TileFrameX = (short)num13; + Main.tile[x, y].TileFrameY = 90; } else { int num14 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y - 1].type = type; + Main.tile[x, y - 1].TileType = type; Main.tile[x, y - 1].active(true); - Main.tile[x, y - 1].frameX = (short)num14; - Main.tile[x, y - 1].frameY = 36; - Main.tile[x, y].type = type; + Main.tile[x, y - 1].TileFrameX = (short)num14; + Main.tile[x, y - 1].TileFrameY = 36; + Main.tile[x, y].TileType = type; Main.tile[x, y].active(true); - Main.tile[x, y].frameX = (short)num14; - Main.tile[x, y].frameY = 54; + Main.tile[x, y].TileFrameX = (short)num14; + Main.tile[x, y].TileFrameY = 54; } } } diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index 992bdefc14..f46ddb063b 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -40,7 +40,7 @@ namespace CalamityMod.World for (int y = shrineLocationY - randomY - 1; y <= shrineLocationY + randomY + 1; y++) { Main.tile[x, y].active(true); - Main.tile[x, y].type = tile; + Main.tile[x, y].TileType = tile; Main.tile[x, y].slope(0); Main.tile[x, y].liquid = 0; Main.tile[x, y].lava(false); @@ -53,7 +53,7 @@ namespace CalamityMod.World for (int y = shrineLocationY - randomY; y <= shrineLocationY + randomY; y++) { Main.tile[x, y].active(false); - Main.tile[x, y].wall = wall; + Main.tile[x, y].WallType = wall; } } @@ -77,7 +77,7 @@ namespace CalamityMod.World while (!Main.tile[x, y].active() && y < Main.maxTilesY && verticalOffset > 0) { Main.tile[x, y].active(true); - Main.tile[x, y].type = tile2; + Main.tile[x, y].TileType = tile2; Main.tile[x, y].slope(0); y++; verticalOffset--; @@ -92,7 +92,7 @@ namespace CalamityMod.World for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) { Main.tile[x, num21].active(true); - Main.tile[x, num21].type = tile; + Main.tile[x, num21].TileType = tile; } randomX -= WorldGen.genRand.Next(1, 3); num21--; @@ -192,12 +192,12 @@ namespace CalamityMod.World int tilesX2 = WorldGen.genRand.Next(generateForward, (int)(x * 0.65)); int tilesY = WorldGen.genRand.Next((int)(y * 0.3f), (int)(y * 0.35f)); - if (Main.tile[tilesX, tilesY].type == TileID.Dirt || Main.tile[tilesX, tilesY].type == TileID.Stone) + if (Main.tile[tilesX, tilesY].TileType == TileID.Dirt || Main.tile[tilesX, tilesY].TileType == TileID.Stone) { SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX, tilesY); break; } - if (Main.tile[tilesX2, tilesY].type == TileID.Dirt || Main.tile[tilesX2, tilesY].type == TileID.Stone) + if (Main.tile[tilesX2, tilesY].TileType == TileID.Dirt || Main.tile[tilesX2, tilesY].TileType == TileID.Stone) { SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX2, tilesY); break; @@ -209,7 +209,7 @@ namespace CalamityMod.World int tilesX = WorldGen.genRand.Next(0, x); int tilesY = WorldGen.genRand.Next((int)(y * 0.3f), (int)(y * 0.35f)); - if (Main.tile[tilesX, tilesY].type == (WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone)) + if (Main.tile[tilesX, tilesY].TileType == (WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone)) { SpecialHut(WorldGen.crimson ? TileID.CrimtaneBrick : TileID.DemoniteBrick, WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone, @@ -224,12 +224,12 @@ namespace CalamityMod.World int tilesX2 = WorldGen.genRand.Next(generateForward, (int)(x * 0.7)); int tilesY = WorldGen.genRand.Next((int)(y * 0.55f), (int)(y * 0.8f)); - if (Main.tile[tilesX, tilesY].type == TileID.Stone) + if (Main.tile[tilesX, tilesY].TileType == TileID.Stone) { SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, UndergroundShrineType.Cavern, tilesX, tilesY); break; } - if (Main.tile[tilesX2, tilesY].type == TileID.Stone) + if (Main.tile[tilesX2, tilesY].TileType == TileID.Stone) { SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, UndergroundShrineType.Cavern, tilesX2, tilesY); break; @@ -241,7 +241,7 @@ namespace CalamityMod.World int tilesX = WorldGen.genRand.Next(0, x); int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); - if (Main.tile[tilesX, tilesY].type == TileID.IceBlock) + if (Main.tile[tilesX, tilesY].TileType == TileID.IceBlock) { SpecialHut(TileID.IceBrick, TileID.IceBlock, WallID.IceBrick, UndergroundShrineType.Ice, tilesX, tilesY); break; @@ -253,7 +253,7 @@ namespace CalamityMod.World int tilesX = WorldGen.genRand.Next(0, x); int tilesY = WorldGen.genRand.Next((int)(y * 0.3f), (int)(y * 0.5f)); - if (Main.tile[tilesX, tilesY].type == TileID.DesertFossil) + if (Main.tile[tilesX, tilesY].TileType == TileID.DesertFossil) { SpecialHut(TileID.DesertFossil, TileID.Sandstone, WallID.DesertFossil, UndergroundShrineType.Desert, tilesX, tilesY); break; @@ -265,7 +265,7 @@ namespace CalamityMod.World int tilesX = WorldGen.genRand.Next(0, x); int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); - if (Main.tile[tilesX, tilesY].type == TileID.MushroomGrass) + if (Main.tile[tilesX, tilesY].TileType == TileID.MushroomGrass) { SpecialHut(TileID.MushroomBlock, TileID.Mud, WallID.MushroomUnsafe, UndergroundShrineType.Mushroom, tilesX, tilesY); break; @@ -277,7 +277,7 @@ namespace CalamityMod.World int tilesX = WorldGen.genRand.Next(0, x); int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); - if (Main.tile[tilesX, tilesY].type == TileID.Granite) + if (Main.tile[tilesX, tilesY].TileType == TileID.Granite) { SpecialHut(TileID.GraniteBlock, TileID.Granite, WallID.GraniteUnsafe, UndergroundShrineType.Granite, tilesX, tilesY); break; @@ -289,7 +289,7 @@ namespace CalamityMod.World int tilesX = WorldGen.genRand.Next(0, x); int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); - if (Main.tile[tilesX, tilesY].type == TileID.Marble) + if (Main.tile[tilesX, tilesY].TileType == TileID.Marble) { SpecialHut(TileID.MarbleBlock, TileID.Marble, WallID.MarbleUnsafe, UndergroundShrineType.Marble, tilesX, tilesY); break; diff --git a/World/WorldEvilIsland.cs b/World/WorldEvilIsland.cs index e9f8ff73d3..8c9b5cb76b 100644 --- a/World/WorldEvilIsland.cs +++ b/World/WorldEvilIsland.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using Terraria; using Terraria.ID; -using Terraria.World.Generation; +using Terraria.WorldBuilding; namespace CalamityMod.World { @@ -106,7 +106,7 @@ namespace CalamityMod.World { if (!CalamityUtils.ParanoidTileRetrieval(i + dx, j + dy).active()) { - Main.tile[i + dx, j + dy].type = WorldGen.crimson ? TileID.CorruptSandstone : TileID.CrimsonSandstone; + Main.tile[i + dx, j + dy].TileType = WorldGen.crimson ? TileID.CorruptSandstone : TileID.CrimsonSandstone; Main.tile[i + dx, j + dy].active(true); } } @@ -117,7 +117,7 @@ namespace CalamityMod.World for (int dx = -leftOffset + 14; dx < rightOffset - 14; dx++) { int verticalBorder = j - 10; - while (CalamityUtils.ParanoidTileRetrieval(i + dx, verticalBorder).type != TileID.Cloud) + while (CalamityUtils.ParanoidTileRetrieval(i + dx, verticalBorder).TileType != TileID.Cloud) { verticalBorder++; if (verticalBorder > j + 35) @@ -184,7 +184,7 @@ namespace CalamityMod.World while (!CalamityUtils.ParanoidTileRetrieval(i + dx, surface).active()) { surface++; - if (CalamityUtils.ParanoidTileRetrieval(i + dx, surface).type == TileID.Cloud) + if (CalamityUtils.ParanoidTileRetrieval(i + dx, surface).TileType == TileID.Cloud) { hitCloud = true; break; @@ -205,7 +205,7 @@ namespace CalamityMod.World Point surfaceToGenerateAt = surfacePoints[WorldGen.genRand.Next(surfacePoints.Count)]; Point blotchPosition = (surfaceToGenerateAt.ToVector2() + Vector2.UnitY * 5f).ToPoint(); WorldUtils.Gen(blotchPosition, new Shapes.Circle(WorldGen.genRand.Next(8, 10)), Actions.Chain( - new Actions.SetTile(CalamityUtils.ParanoidTileRetrieval(surfaceToGenerateAt.X, surfaceToGenerateAt.Y).type), + new Actions.SetTile(CalamityUtils.ParanoidTileRetrieval(surfaceToGenerateAt.X, surfaceToGenerateAt.Y).TileType), new Modifiers.SkipTiles(TileID.Demonite, TileID.Crimtane), new Modifiers.Blotches(5, 1f))); } @@ -229,7 +229,7 @@ namespace CalamityMod.World { for (int dy = -8; dy < 55; dy++) { - if (CalamityUtils.ParanoidTileRetrieval(i + dx, j + dy).type == TileID.Cloud) + if (CalamityUtils.ParanoidTileRetrieval(i + dx, j + dy).TileType == TileID.Cloud) WorldGen.paintTile(i + dx, j + dy, WorldGen.crimson ? PaintID.Purple : PaintID.Red); } } @@ -285,8 +285,8 @@ namespace CalamityMod.World { Main.tile[l, m].active(true); Main.tile[l, m].liquid = 0; - Main.tile[l, m].type = type; - Main.tile[l, m].wall = 0; + Main.tile[l, m].TileType = type; + Main.tile[l, m].WallType = 0; Main.tile[l, m].halfBrick(false); Main.tile[l, m].slope(0); } @@ -316,10 +316,10 @@ namespace CalamityMod.World { for (int num8 = num6; num8 < num7; num8++) { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].WallType == 0) { Main.tile[n, num8].active(false); - Main.tile[n, num8].wall = wall; + Main.tile[n, num8].WallType = wall; } } } @@ -337,8 +337,8 @@ namespace CalamityMod.World { Main.tile[num9, num12].active(true); Main.tile[num9, num12].liquid = 0; - Main.tile[num9, num12].type = type; - Main.tile[num9, num12].wall = 0; + Main.tile[num9, num12].TileType = type; + Main.tile[num9, num12].WallType = 0; Main.tile[num9, num12].halfBrick(false); Main.tile[num9, num12].slope(0); } @@ -364,23 +364,23 @@ namespace CalamityMod.World { for (int num19 = num17 - 1; num19 <= num17 + 1; num19++) { - Main.tile[num18, num19].wall = 21; //glass + Main.tile[num18, num19].WallType = 21; //glass } } for (int num20 = num15 - num16; num20 <= num15 + num16; num20++) { for (int num21 = num17 - 1; num21 <= num17 + 1; num21++) { - Main.tile[num20, num21].wall = 21; //glass + Main.tile[num20, num21].WallType = 21; //glass } } int num22 = i + (num2 / 2 + 1) * -num; WorldGen.PlaceTile(num22, num7 - 1, 14, true, false, -1, WorldGen.crimson ? 1 : 8); //table WorldGen.PlaceTile(num22 - 2, num7 - 1, 15, true, false, 0, WorldGen.crimson ? 2 : 11); //chair Tile tile = Main.tile[num22 - 2, num7 - 1]; - tile.frameX += 18; + tile.TileFrameX += 18; Tile tile2 = Main.tile[num22 - 2, num7 - 2]; - tile2.frameX += 18; + tile2.TileFrameX += 18; WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, WorldGen.crimson ? 2 : 11); //chair } } diff --git a/World/WorldUpdateMiscEffects.cs b/World/WorldUpdateMiscEffects.cs index 343aee649b..ec809f86c9 100644 --- a/World/WorldUpdateMiscEffects.cs +++ b/World/WorldUpdateMiscEffects.cs @@ -151,7 +151,7 @@ namespace CalamityMod.World { if (Main.tile[x, y].liquid <= 32) { - if (Main.tile[x, y].type == TileID.JungleGrass) + if (Main.tile[x, y].TileType == TileID.JungleGrass) { if (Main.tile[x, y2].liquid == 0) { @@ -166,7 +166,7 @@ namespace CalamityMod.World { for (int j = y - minDistanceFromOtherBulbs; j < y + minDistanceFromOtherBulbs; j += 2) { - if (i > 1 && i < Main.maxTilesX - 2 && j > 1 && j < Main.maxTilesY - 2 && Main.tile[i, j].active() && Main.tile[i, j].type == TileID.PlanteraBulb) + if (i > 1 && i < Main.maxTilesX - 2 && j > 1 && j < Main.maxTilesY - 2 && Main.tile[i, j].active() && Main.tile[i, j].TileType == TileID.PlanteraBulb) { placeBulb = false; break; @@ -180,7 +180,7 @@ namespace CalamityMod.World WorldGen.SquareTileFrame(x, y2); WorldGen.SquareTileFrame(x + 2, y2); WorldGen.SquareTileFrame(x - 1, y2); - if (Main.tile[x, y2].type == TileID.PlanteraBulb && Main.netMode == NetmodeID.Server) + if (Main.tile[x, y2].TileType == TileID.PlanteraBulb && Main.netMode == NetmodeID.Server) { NetMessage.SendTileSquare(-1, x, y2, 5); } @@ -200,7 +200,7 @@ namespace CalamityMod.World { for (int j = y - minDistanceFromOtherFruit; j < y + minDistanceFromOtherFruit; j += 2) { - if (i > 1 && i < Main.maxTilesX - 2 && j > 1 && j < Main.maxTilesY - 2 && Main.tile[i, j].active() && Main.tile[i, j].type == TileID.LifeFruit) + if (i > 1 && i < Main.maxTilesX - 2 && j > 1 && j < Main.maxTilesY - 2 && Main.tile[i, j].active() && Main.tile[i, j].TileType == TileID.LifeFruit) { placeFruit = false; break; @@ -213,7 +213,7 @@ namespace CalamityMod.World WorldGen.PlaceJunglePlant(x, y2, TileID.LifeFruit, WorldGen.genRand.Next(3), 0); WorldGen.SquareTileFrame(x, y2); WorldGen.SquareTileFrame(x + 1, y2 + 1); - if (Main.tile[x, y2].type == TileID.LifeFruit && Main.netMode == NetmodeID.Server) + if (Main.tile[x, y2].TileType == TileID.LifeFruit && Main.netMode == NetmodeID.Server) { NetMessage.SendTileSquare(-1, x, y2, 4); } @@ -224,7 +224,7 @@ namespace CalamityMod.World } } - int tileType = Main.tile[x, y].type; + int tileType = Main.tile[x, y].TileType; bool tenebris = tileType == ModContent.TileType() && downedCalamitas; if (CalamityGlobalTile.GrowthTiles.Contains(tileType) || tenebris) @@ -256,7 +256,7 @@ namespace CalamityMod.World if (Main.tile[x, y] != null) { Tile tile = Main.tile[x, y]; - bool growTile = tenebris ? (tile.active() && tile.type == ModContent.TileType()) : (!tile.active() && tile.liquid >= 128); + bool growTile = tenebris ? (tile.active() && tile.TileType == ModContent.TileType()) : (!tile.active() && tile.liquid >= 128); bool isSunkenSeaTile = tileType == ModContent.TileType() || tileType == ModContent.TileType() || tileType == ModContent.TileType(); bool meetsAdditionalGrowConditions = tile.slope() == 0 && !tile.halfBrick() && !tile.lava(); @@ -273,28 +273,28 @@ namespace CalamityMod.World if (canPlaceBasedOnAttached && (CanPlaceBasedOnProximity(x, y, tileType2) || tenebris)) { - tile.type = tenebris ? (ushort)tileType : (ushort)tileType2; + tile.TileType = tenebris ? (ushort)tileType : (ushort)tileType2; if (!tenebris) { tile.active(true); - if (Main.tile[x, y + 1].active() && Main.tileSolid[Main.tile[x, y + 1].type] && Main.tile[x, y + 1].slope() == 0 && !Main.tile[x, y + 1].halfBrick()) + if (Main.tile[x, y + 1].active() && Main.tileSolid[Main.tile[x, y + 1].TileType] && Main.tile[x, y + 1].slope() == 0 && !Main.tile[x, y + 1].halfBrick()) { - tile.frameY = 0; + tile.TileFrameY = 0; } - else if (Main.tile[x, y - 1].active() && Main.tileSolid[Main.tile[x, y - 1].type] && Main.tile[x, y - 1].slope() == 0 && !Main.tile[x, y - 1].halfBrick()) + else if (Main.tile[x, y - 1].active() && Main.tileSolid[Main.tile[x, y - 1].TileType] && Main.tile[x, y - 1].slope() == 0 && !Main.tile[x, y - 1].halfBrick()) { - tile.frameY = 18; + tile.TileFrameY = 18; } - else if (Main.tile[x + 1, y].active() && Main.tileSolid[Main.tile[x + 1, y].type] && Main.tile[x + 1, y].slope() == 0 && !Main.tile[x + 1, y].halfBrick()) + else if (Main.tile[x + 1, y].active() && Main.tileSolid[Main.tile[x + 1, y].TileType] && Main.tile[x + 1, y].slope() == 0 && !Main.tile[x + 1, y].halfBrick()) { - tile.frameY = 36; + tile.TileFrameY = 36; } - else if (Main.tile[x - 1, y].active() && Main.tileSolid[Main.tile[x - 1, y].type] && Main.tile[x - 1, y].slope() == 0 && !Main.tile[x - 1, y].halfBrick()) + else if (Main.tile[x - 1, y].active() && Main.tileSolid[Main.tile[x - 1, y].TileType] && Main.tile[x - 1, y].slope() == 0 && !Main.tile[x - 1, y].halfBrick()) { - tile.frameY = 54; + tile.TileFrameY = 54; } - tile.frameX = (short)(WorldGen.genRand.Next(18) * 18); + tile.TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); } WorldGen.SquareTileFrame(x, y); @@ -324,7 +324,7 @@ namespace CalamityMod.World { for (int j = y - minDistanceFromOtherTiles; j < y + minDistanceFromOtherTiles; j++) { - if (Main.tile[i, j].active() && Main.tile[i, j].type == tileType) + if (Main.tile[i, j].active() && Main.tile[i, j].TileType == tileType) { sameTilesNearby++; if (sameTilesNearby > 1)